@wix/site-service-interactions 1.0.21 → 1.0.23
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/definition/index.d.ts +8 -2
- package/cjs/build/definition/index.js.map +1 -1
- package/cjs/build/implementations/InteractionsScriptElement.d.ts +1 -1
- package/cjs/build/implementations/coreInteractions.d.ts +1 -1
- package/cjs/build/implementations/coreInteractions.js +13 -7
- package/cjs/build/implementations/coreInteractions.js.map +1 -1
- package/cjs/build/implementations/v2/InteractionsScriptElement.d.ts +1 -1
- package/cjs/build/implementations/v2/authoredStyles.js +43 -48
- package/cjs/build/implementations/v2/authoredStyles.js.map +1 -1
- package/cjs/build/implementations/v2/clickTriggerCss.d.ts +1 -1
- package/cjs/build/implementations/v2/configCss.d.ts +1 -1
- package/cjs/build/implementations/v2/configCss.js +3 -3
- package/cjs/build/implementations/v2/configCss.js.map +1 -1
- package/cjs/build/implementations/v2/motionPresets.d.ts +1 -1
- package/cjs/build/types/index.d.ts +1 -1
- package/dist/definition/index.d.ts +8 -2
- package/dist/definition/index.js.map +1 -1
- package/dist/implementations/InteractionsScriptElement.d.ts +1 -1
- package/dist/implementations/coreInteractions.d.ts +1 -1
- package/dist/implementations/coreInteractions.js +11 -5
- package/dist/implementations/coreInteractions.js.map +1 -1
- package/dist/implementations/v2/InteractionsScriptElement.d.ts +1 -1
- package/dist/implementations/v2/authoredStyles.js +43 -48
- package/dist/implementations/v2/authoredStyles.js.map +1 -1
- package/dist/implementations/v2/clickTriggerCss.d.ts +1 -1
- package/dist/implementations/v2/configCss.d.ts +1 -1
- package/dist/implementations/v2/configCss.js +1 -1
- package/dist/implementations/v2/configCss.js.map +1 -1
- package/dist/implementations/v2/motionPresets.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +5 -4
- package/src/definition/index.ts +8 -2
- package/src/implementations/InteractionsScriptElement.tsx +1 -1
- package/src/implementations/coreInteractions.ts +15 -6
- package/src/implementations/v2/InteractionsScriptElement.tsx +1 -1
- package/src/implementations/v2/authoredStyles.ts +44 -54
- package/src/implementations/v2/clickTriggerCss.ts +1 -1
- package/src/implementations/v2/configCss.ts +2 -2
- package/src/implementations/v2/motionPresets.ts +1 -1
- package/src/types/index.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StaticServiceDefinition } from '@wix/static-service';
|
|
2
|
-
import type { InteractConfig } from '@wix/interact
|
|
2
|
+
import type { InteractConfig } from '@wix/interact';
|
|
3
3
|
export type { InteractConfig };
|
|
4
4
|
export type InteractStyleRule = {
|
|
5
5
|
key?: string;
|
|
@@ -14,8 +14,14 @@ export type InteractConfigEntry = {
|
|
|
14
14
|
interact: InteractConfig;
|
|
15
15
|
styles?: InteractStyleRule[];
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* `version` is the dialect the config was emitted in (Thunderbolt's `InteractionsPageConfig.version`). It is
|
|
19
|
+
* the only input that picks the interact runtime; absent means v1.
|
|
20
|
+
*/
|
|
21
|
+
export type IInteractionsServiceConfig = (InteractConfig | {
|
|
18
22
|
entries: InteractConfigEntry[];
|
|
23
|
+
}) & {
|
|
24
|
+
version?: 'v1' | 'v2';
|
|
19
25
|
};
|
|
20
26
|
export interface IInteractionsService {
|
|
21
27
|
hasInteractions: (path: string) => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/definition/index.ts"],"names":[],"mappings":";;;AAAA,wDAAyD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/definition/index.ts"],"names":[],"mappings":";;;AAAA,wDAAyD;AAmC5C,QAAA,sBAAsB,GAAG,IAAA,oCAAmB,EACxD,gCAAgC,CAChC,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { FunctionComponent } from 'react';
|
|
2
|
-
import type { InteractConfig } from '@wix/interact
|
|
2
|
+
import type { InteractConfig } from '@wix/interact';
|
|
3
3
|
export declare const createInteractionsScriptElement: (config: InteractConfig, isReducedMotion: boolean, pageId: string) => FunctionComponent;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ServicesManager } from '@wix/services-manager/types';
|
|
2
2
|
import type { IInteractionsServiceConfig } from '../definition';
|
|
3
|
-
export declare const coreInteractions: (config: IInteractionsServiceConfig, getService: ServicesManager['getService']) => {
|
|
3
|
+
export declare const coreInteractions: ({ version, ...config }: IInteractionsServiceConfig, getService: ServicesManager['getService']) => {
|
|
4
4
|
interactiveComps: Set<string>;
|
|
5
5
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.coreInteractions = void 0;
|
|
4
|
-
const
|
|
4
|
+
const interact_v1_1 = require("@wix/interact-v1");
|
|
5
5
|
const definition_1 = require("@wix/site-service-device-info/definition");
|
|
6
6
|
const definition_2 = require("@wix/site-service-experiments/definition");
|
|
7
7
|
// Deliberately the deprecated pages service. Thunderbolt registers the site-service-pages page
|
|
@@ -22,17 +22,23 @@ const configEntries_1 = require("./configEntries");
|
|
|
22
22
|
/** An entry without interactions contributes CSS only; nothing has to load Interact for it. */
|
|
23
23
|
const getRuntimeConfigs = (entries) => entries.map(({ interact }) => interact).filter(({ interactions }) => interactions.length > 0);
|
|
24
24
|
const initInteract = (entries, isReducedMotion) => {
|
|
25
|
+
const runtimeConfigs = getRuntimeConfigs(entries);
|
|
26
|
+
// v1 registers its interact-element on create, and a tag can only be defined once: starting it for
|
|
27
|
+
// an empty config (the editor's disabled config, the site-level config) would lock out a later v2 loader.
|
|
28
|
+
if (!runtimeConfigs.length) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
25
31
|
// Bundled runtime is v1. v2 on the client is the CDN loader.
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
interact_v1_1.Interact.forceReducedMotion = isReducedMotion;
|
|
33
|
+
interact_v1_1.Interact.setup({
|
|
28
34
|
scrollOptionsGetter: () => globalThis.document.getElementById('site-root'),
|
|
29
35
|
allowA11yTriggers: true,
|
|
30
36
|
viewEnter: {
|
|
31
37
|
useSafeViewEnter: true,
|
|
32
38
|
},
|
|
33
39
|
});
|
|
34
|
-
for (const
|
|
35
|
-
|
|
40
|
+
for (const config of runtimeConfigs) {
|
|
41
|
+
interact_v1_1.Interact.create(config);
|
|
36
42
|
}
|
|
37
43
|
};
|
|
38
44
|
const getV2HeadContent = (entries) => {
|
|
@@ -72,10 +78,10 @@ const getInteractiveComps = (entries) => {
|
|
|
72
78
|
}
|
|
73
79
|
return keys;
|
|
74
80
|
};
|
|
75
|
-
const coreInteractions = (config, getService) => {
|
|
81
|
+
const coreInteractions = ({ version, ...config }, getService) => {
|
|
76
82
|
const { reducedMotion: isReducedMotion } = getService(definition_1.DeviceInfoDefinition);
|
|
77
83
|
const { isOpen } = getService(definition_2.ExperimentsDefinition);
|
|
78
|
-
const useV2 =
|
|
84
|
+
const useV2 = version === 'v2';
|
|
79
85
|
// The v1 runtime has no preset registration and doesn't understand LEGACY_* names; skip
|
|
80
86
|
// aliasing on those paths so named reaction effects remain resolvable.
|
|
81
87
|
const entries = (0, configEntries_1.resolveInteractKeyConflicts)((useV2 ? configEntries_1.getResolvedConfigEntries : configEntries_1.getInteractConfigEntries)(config));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreInteractions.js","sourceRoot":"","sources":["../../../src/implementations/coreInteractions.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"coreInteractions.js","sourceRoot":"","sources":["../../../src/implementations/coreInteractions.ts"],"names":[],"mappings":";;;AAAA,kDAA2C;AAE3C,yEAA+E;AAC/E,yEAAgF;AAChF,+FAA+F;AAC/F,+FAA+F;AAC/F,+FAA+F;AAC/F,kFAAkF;AAClF,qEAAsE;AACtE,2EAAmF;AACnF,iEAAuE;AACvE,mGAA+G;AAG/G,2EAA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sB,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,uBAAe,CAAC,OAAO,CAAC,CAAA;YACjF,CAAC;QACF,CAAC;QAED,WAAW,CAAC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA;IACxD,CAAC;SAAM,IAAI,MAAM,CAAC,qCAAqC,CAAC,EAAE,CAAC;QAC1D,yFAAyF;QACzF,2FAA2F;QAC3F,sFAAsF;QACtF,iFAAiF;QACjF,WAAW,CAAC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,KAAK,CAAC,CAAA;IACzD,CAAC;SAAM,CAAC;QACP,YAAY,CAAC,OAAO,EAAE,eAAe,CAAC,CAAA;IACvC,CAAC;IAED,OAAO;QACN,gBAAgB,EAAE,mBAAmB,CAAC,OAAO,CAAC;KAC9C,CAAA;AACF,CAAC,CAAA;AAvCY,QAAA,gBAAgB,GAAhB,gBAAgB,CAuC5B"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { FunctionComponent } from 'react';
|
|
2
|
-
import type { InteractConfig } from '@wix/interact
|
|
2
|
+
import type { InteractConfig } from '@wix/interact';
|
|
3
3
|
export declare const createV2InteractionsScriptElement: (config: InteractConfig | InteractConfig[], isReducedMotion: boolean, pageId: string) => FunctionComponent;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAuthoredStylesCss = void 0;
|
|
4
|
+
const interact_experience_renderer_1 = require("@wix/interact-experience-renderer");
|
|
4
5
|
const SELECTOR_TOKEN = /"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[()[\]]|,/g;
|
|
5
6
|
const escapeCssString = (value) => value.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\a ').replace(/\r/g, '\\d ').replace(/\f/g, '\\c ');
|
|
6
7
|
const splitSelectorList = (selector) => {
|
|
@@ -24,47 +25,43 @@ const splitSelectorList = (selector) => {
|
|
|
24
25
|
parts.push(selector.slice(start));
|
|
25
26
|
return parts.map((part) => part.trim()).filter(Boolean);
|
|
26
27
|
};
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
.join('\n');
|
|
34
|
-
const wrapWithConditions = (block, rule) => {
|
|
35
|
-
let result = block;
|
|
36
|
-
if (rule['@container']) {
|
|
37
|
-
result = `@container ${rule['@container']} {\n${indentCssBlock(result)}\n}`;
|
|
28
|
+
const getSectionId = (namespace) => namespace.slice(namespace.lastIndexOf('/') + 1);
|
|
29
|
+
const normalizeRule = (namespace, rule) => {
|
|
30
|
+
const { key, selector, properties } = rule;
|
|
31
|
+
let normalizedSelector;
|
|
32
|
+
if (!key) {
|
|
33
|
+
normalizedSelector = selector ?? '&';
|
|
38
34
|
}
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const scopeWrapper = `[data-interact-key="${escapeCssString(namespace)}"]`;
|
|
49
|
-
const scopeRoot = `${scopeWrapper} > :first-child`;
|
|
50
|
-
if (!rule.key) {
|
|
51
|
-
if (!rule.selector) {
|
|
52
|
-
return scopeRoot;
|
|
35
|
+
else if (key === namespace) {
|
|
36
|
+
if (!selector) {
|
|
37
|
+
normalizedSelector = '&';
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const separator = /^\s/.test(selector) ? ' ' : '';
|
|
41
|
+
normalizedSelector = splitSelectorList(selector)
|
|
42
|
+
.map((part) => `&${separator}${part}`)
|
|
43
|
+
.join(', ');
|
|
53
44
|
}
|
|
54
|
-
return splitSelectorList(rule.selector)
|
|
55
|
-
.map((selector) => `${scopeRoot} ${selector}`)
|
|
56
|
-
.join(', ');
|
|
57
45
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
46
|
+
else {
|
|
47
|
+
const keyRoot = `[data-interact-key="${escapeCssString(key)}"] > :first-child`;
|
|
48
|
+
if (!selector) {
|
|
49
|
+
normalizedSelector = keyRoot;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
const separator = /^\s/.test(selector) ? ' ' : '';
|
|
53
|
+
normalizedSelector = splitSelectorList(selector)
|
|
54
|
+
.map((part) => `${keyRoot}${separator}${part}`)
|
|
55
|
+
.join(', ');
|
|
56
|
+
}
|
|
63
57
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
58
|
+
return {
|
|
59
|
+
selector: normalizedSelector,
|
|
60
|
+
properties,
|
|
61
|
+
...(rule['@container'] && { '@container': rule['@container'] }),
|
|
62
|
+
...(rule['@media'] && { '@media': rule['@media'] }),
|
|
63
|
+
...(rule['@supports'] && { '@supports': rule['@supports'] }),
|
|
64
|
+
};
|
|
68
65
|
};
|
|
69
66
|
const getEntryStylesCss = ({ namespace, styles = [] }) => {
|
|
70
67
|
if (!styles.length) {
|
|
@@ -73,17 +70,15 @@ const getEntryStylesCss = ({ namespace, styles = [] }) => {
|
|
|
73
70
|
if (!namespace) {
|
|
74
71
|
throw new Error('Interactions config entries with authored styles must define a namespace.');
|
|
75
72
|
}
|
|
76
|
-
|
|
77
|
-
.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
})
|
|
85
|
-
.filter(Boolean)
|
|
86
|
-
.join('\n\n');
|
|
73
|
+
const experience = {
|
|
74
|
+
$schema: 'interact-experience/1.0',
|
|
75
|
+
id: namespace,
|
|
76
|
+
name: namespace,
|
|
77
|
+
elements: {},
|
|
78
|
+
styles: styles.map((rule) => normalizeRule(namespace, rule)),
|
|
79
|
+
interact: { effects: {}, interactions: [] },
|
|
80
|
+
};
|
|
81
|
+
return (0, interact_experience_renderer_1.renderStyles)(experience, {}, '', `#main_MF #${getSectionId(namespace)}`);
|
|
87
82
|
};
|
|
88
83
|
const getAuthoredStylesCss = (entries) => entries.map(getEntryStylesCss).filter(Boolean).join('\n\n');
|
|
89
84
|
exports.getAuthoredStylesCss = getAuthoredStylesCss;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authoredStyles.js","sourceRoot":"","sources":["../../../../src/implementations/v2/authoredStyles.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"authoredStyles.js","sourceRoot":"","sources":["../../../../src/implementations/v2/authoredStyles.ts"],"names":[],"mappings":";;;AAAA,oFAAgE;AAMhE,MAAM,cAAc,GAAG,gDAAgD,CAAA;AAEvE,MAAM,eAAe,GAAG,CAAC,KAAa,EAAU,EAAE,CACjD,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;AAEvH,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAAY,EAAE;IACxD,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,IAAI,KAAK,GAAG,CAAC,CAAA;IAEb,cAAc,CAAC,SAAS,GAAG,CAAC,CAAA;IAC5B,KAAK,IAAI,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC9F,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QACtB,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,GAAG,EAAE,CAAC;YACpC,KAAK,EAAE,CAAA;QACR,CAAC;aAAM,IAAI,KAAK,KAAK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AI,CAAC,SAAS,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAA;IAC7F,CAAC;IAED,MAAM,UAAU,GAAe;QAC9B,OAAO,EAAE,yBAAyB;QAClC,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC5D,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE;KAC3C,CAAA;IAED,OAAO,IAAA,2CAAY,EAAC,UAAU,EAAE,EAAE,EAAE,EAAE,EAAE,aAAa,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;AAChF,CAAC,CAAA;AAEM,MAAM,oBAAoB,GAAG,CAAC,OAA8B,EAAU,EAAE,CAC9E,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAD/C,QAAA,oBAAoB,GAApB,oBAAoB,CAC2B"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { InteractConfig } from '@wix/interact
|
|
1
|
+
import type { InteractConfig } from '@wix/interact';
|
|
2
2
|
/** Emits `cursor: pointer` for click interaction triggers (`'activate' || 'click'`), one rule per unique source selector. */
|
|
3
3
|
export declare const getClickTriggerCss: (config: InteractConfig) => string;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getV2ConfigCss = void 0;
|
|
4
|
-
const
|
|
4
|
+
const interact_1 = require("@wix/interact");
|
|
5
5
|
const clickTriggerCss_1 = require("./clickTriggerCss");
|
|
6
6
|
const motionPresets_1 = require("./motionPresets");
|
|
7
7
|
// Interact's registry is process-global. This module is only pulled into the server bundle
|
|
8
8
|
// (`process.env.browser` DCE), so both namespaces are registered once per Node process.
|
|
9
|
-
|
|
9
|
+
interact_1.Interact.registerEffects(motionPresets_1.motionPresets);
|
|
10
10
|
/** Emit animation FOUC CSS and click-trigger cursor rules. */
|
|
11
11
|
const getV2ConfigCss = (config) => {
|
|
12
|
-
const animationCss = (0,
|
|
12
|
+
const animationCss = (0, interact_1.generate)(config, true).trim();
|
|
13
13
|
const clickCss = (0, clickTriggerCss_1.getClickTriggerCss)(config).trim();
|
|
14
14
|
return [animationCss, clickCss].filter(Boolean).join('\n');
|
|
15
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configCss.js","sourceRoot":"","sources":["../../../../src/implementations/v2/configCss.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"configCss.js","sourceRoot":"","sources":["../../../../src/implementations/v2/configCss.ts"],"names":[],"mappings":";;;AAAA,4CAAkD;AAElD,uDAAsD;AACtD,mDAA+C;AAI/C,2FAA2F;AAC3F,wFAAwF;AACxF,mBAAQ,CAAC,eAAe,CAAC,6BAA0C,CAAC,CAAA;AAEpE,8DAA8D;AACvD,MAAM,cAAc,GAAG,CAAC,MAAsB,EAAU,EAAE;IAChE,MAAM,YAAY,GAAG,IAAA,mBAAQ,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAA;IAClD,MAAM,QAAQ,GAAG,IAAA,oCAAkB,EAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAA;IAElD,OAAO,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC3D,CAAC,CAAA;AALY,QAAA,cAAc,GAAd,cAAc,CAK1B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type { IInteractionsService, IInteractionsServiceConfig, IInteractionsDefinition } from '../definition';
|
|
2
|
-
export type { InteractConfig } from '@wix/interact
|
|
2
|
+
export type { InteractConfig } from '@wix/interact';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StaticServiceDefinition } from '@wix/static-service';
|
|
2
|
-
import type { InteractConfig } from '@wix/interact
|
|
2
|
+
import type { InteractConfig } from '@wix/interact';
|
|
3
3
|
export type { InteractConfig };
|
|
4
4
|
export type InteractStyleRule = {
|
|
5
5
|
key?: string;
|
|
@@ -14,8 +14,14 @@ export type InteractConfigEntry = {
|
|
|
14
14
|
interact: InteractConfig;
|
|
15
15
|
styles?: InteractStyleRule[];
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* `version` is the dialect the config was emitted in (Thunderbolt's `InteractionsPageConfig.version`). It is
|
|
19
|
+
* the only input that picks the interact runtime; absent means v1.
|
|
20
|
+
*/
|
|
21
|
+
export type IInteractionsServiceConfig = (InteractConfig | {
|
|
18
22
|
entries: InteractConfigEntry[];
|
|
23
|
+
}) & {
|
|
24
|
+
version?: 'v1' | 'v2';
|
|
19
25
|
};
|
|
20
26
|
export interface IInteractionsService {
|
|
21
27
|
hasInteractions: (path: string) => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAmCzD,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CACxD,gCAAgC,CAChC,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { FunctionComponent } from 'react';
|
|
2
|
-
import type { InteractConfig } from '@wix/interact
|
|
2
|
+
import type { InteractConfig } from '@wix/interact';
|
|
3
3
|
export declare const createInteractionsScriptElement: (config: InteractConfig, isReducedMotion: boolean, pageId: string) => FunctionComponent;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ServicesManager } from '@wix/services-manager/types';
|
|
2
2
|
import type { IInteractionsServiceConfig } from '../definition';
|
|
3
|
-
export declare const coreInteractions: (config: IInteractionsServiceConfig, getService: ServicesManager['getService']) => {
|
|
3
|
+
export declare const coreInteractions: ({ version, ...config }: IInteractionsServiceConfig, getService: ServicesManager['getService']) => {
|
|
4
4
|
interactiveComps: Set<string>;
|
|
5
5
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Interact } from '@wix/interact';
|
|
1
|
+
import { Interact } from '@wix/interact-v1';
|
|
2
2
|
import { DeviceInfoDefinition } from '@wix/site-service-device-info/definition';
|
|
3
3
|
import { ExperimentsDefinition } from '@wix/site-service-experiments/definition';
|
|
4
4
|
// Deliberately the deprecated pages service. Thunderbolt registers the site-service-pages page
|
|
@@ -19,6 +19,12 @@ import { getInteractConfigEntries, getInteractiveKeys, getResolvedConfigEntries,
|
|
|
19
19
|
/** An entry without interactions contributes CSS only; nothing has to load Interact for it. */
|
|
20
20
|
const getRuntimeConfigs = (entries) => entries.map(({ interact }) => interact).filter(({ interactions }) => interactions.length > 0);
|
|
21
21
|
const initInteract = (entries, isReducedMotion) => {
|
|
22
|
+
const runtimeConfigs = getRuntimeConfigs(entries);
|
|
23
|
+
// v1 registers its interact-element on create, and a tag can only be defined once: starting it for
|
|
24
|
+
// an empty config (the editor's disabled config, the site-level config) would lock out a later v2 loader.
|
|
25
|
+
if (!runtimeConfigs.length) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
22
28
|
// Bundled runtime is v1. v2 on the client is the CDN loader.
|
|
23
29
|
Interact.forceReducedMotion = isReducedMotion;
|
|
24
30
|
Interact.setup({
|
|
@@ -28,8 +34,8 @@ const initInteract = (entries, isReducedMotion) => {
|
|
|
28
34
|
useSafeViewEnter: true,
|
|
29
35
|
},
|
|
30
36
|
});
|
|
31
|
-
for (const
|
|
32
|
-
Interact.create(
|
|
37
|
+
for (const config of runtimeConfigs) {
|
|
38
|
+
Interact.create(config);
|
|
33
39
|
}
|
|
34
40
|
};
|
|
35
41
|
const getV2HeadContent = (entries) => {
|
|
@@ -69,10 +75,10 @@ const getInteractiveComps = (entries) => {
|
|
|
69
75
|
}
|
|
70
76
|
return keys;
|
|
71
77
|
};
|
|
72
|
-
export const coreInteractions = (config, getService) => {
|
|
78
|
+
export const coreInteractions = ({ version, ...config }, getService) => {
|
|
73
79
|
const { reducedMotion: isReducedMotion } = getService(DeviceInfoDefinition);
|
|
74
80
|
const { isOpen } = getService(ExperimentsDefinition);
|
|
75
|
-
const useV2 =
|
|
81
|
+
const useV2 = version === 'v2';
|
|
76
82
|
// The v1 runtime has no preset registration and doesn't understand LEGACY_* names; skip
|
|
77
83
|
// aliasing on those paths so named reaction effects remain resolvable.
|
|
78
84
|
const entries = resolveInteractKeyConflicts((useV2 ? getResolvedConfigEntries : getInteractConfigEntries)(config));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreInteractions.js","sourceRoot":"","sources":["../../src/implementations/coreInteractions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"coreInteractions.js","sourceRoot":"","sources":["../../src/implementations/coreInteractions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAA;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAA;AAChF,+FAA+F;AAC/F,+FAA+F;AAC/F,+FAA+F;AAC/F,kFAAkF;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAA;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAA;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,uC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C,CAAC,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAElH,IAAI,KAAK,EAAE,CAAC;QACX,4FAA4F;QAC5F,wFAAwF;QACxF,2BAA2B;QAC3B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YAC1B,MAAM,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAA;YAC7C,mFAAmF;YACnF,mFAAmF;YACnF,wEAAwE;YACxE,IAAI,WAAW,EAAE,CAAC;gBACjB,UAAU,CAAC,sBAAsB,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,eAAe,CAAC,OAAO,CAAC,CAAA;YACjF,CAAC;QACF,CAAC;QAED,WAAW,CAAC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA;IACxD,CAAC;SAAM,IAAI,MAAM,CAAC,qCAAqC,CAAC,EAAE,CAAC;QAC1D,yFAAyF;QACzF,2FAA2F;QAC3F,sFAAsF;QACtF,iFAAiF;QACjF,WAAW,CAAC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,KAAK,CAAC,CAAA;IACzD,CAAC;SAAM,CAAC;QACP,YAAY,CAAC,OAAO,EAAE,eAAe,CAAC,CAAA;IACvC,CAAC;IAED,OAAO;QACN,gBAAgB,EAAE,mBAAmB,CAAC,OAAO,CAAC;KAC9C,CAAA;AACF,CAAC,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { FunctionComponent } from 'react';
|
|
2
|
-
import type { InteractConfig } from '@wix/interact
|
|
2
|
+
import type { InteractConfig } from '@wix/interact';
|
|
3
3
|
export declare const createV2InteractionsScriptElement: (config: InteractConfig | InteractConfig[], isReducedMotion: boolean, pageId: string) => FunctionComponent;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { renderStyles } from '@wix/interact-experience-renderer';
|
|
1
2
|
const SELECTOR_TOKEN = /"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[()[\]]|,/g;
|
|
2
3
|
const escapeCssString = (value) => value.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\a ').replace(/\r/g, '\\d ').replace(/\f/g, '\\c ');
|
|
3
4
|
const splitSelectorList = (selector) => {
|
|
@@ -21,47 +22,43 @@ const splitSelectorList = (selector) => {
|
|
|
21
22
|
parts.push(selector.slice(start));
|
|
22
23
|
return parts.map((part) => part.trim()).filter(Boolean);
|
|
23
24
|
};
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
.join('\n');
|
|
31
|
-
const wrapWithConditions = (block, rule) => {
|
|
32
|
-
let result = block;
|
|
33
|
-
if (rule['@container']) {
|
|
34
|
-
result = `@container ${rule['@container']} {\n${indentCssBlock(result)}\n}`;
|
|
25
|
+
const getSectionId = (namespace) => namespace.slice(namespace.lastIndexOf('/') + 1);
|
|
26
|
+
const normalizeRule = (namespace, rule) => {
|
|
27
|
+
const { key, selector, properties } = rule;
|
|
28
|
+
let normalizedSelector;
|
|
29
|
+
if (!key) {
|
|
30
|
+
normalizedSelector = selector ?? '&';
|
|
35
31
|
}
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const scopeWrapper = `[data-interact-key="${escapeCssString(namespace)}"]`;
|
|
46
|
-
const scopeRoot = `${scopeWrapper} > :first-child`;
|
|
47
|
-
if (!rule.key) {
|
|
48
|
-
if (!rule.selector) {
|
|
49
|
-
return scopeRoot;
|
|
32
|
+
else if (key === namespace) {
|
|
33
|
+
if (!selector) {
|
|
34
|
+
normalizedSelector = '&';
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const separator = /^\s/.test(selector) ? ' ' : '';
|
|
38
|
+
normalizedSelector = splitSelectorList(selector)
|
|
39
|
+
.map((part) => `&${separator}${part}`)
|
|
40
|
+
.join(', ');
|
|
50
41
|
}
|
|
51
|
-
return splitSelectorList(rule.selector)
|
|
52
|
-
.map((selector) => `${scopeRoot} ${selector}`)
|
|
53
|
-
.join(', ');
|
|
54
42
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
43
|
+
else {
|
|
44
|
+
const keyRoot = `[data-interact-key="${escapeCssString(key)}"] > :first-child`;
|
|
45
|
+
if (!selector) {
|
|
46
|
+
normalizedSelector = keyRoot;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const separator = /^\s/.test(selector) ? ' ' : '';
|
|
50
|
+
normalizedSelector = splitSelectorList(selector)
|
|
51
|
+
.map((part) => `${keyRoot}${separator}${part}`)
|
|
52
|
+
.join(', ');
|
|
53
|
+
}
|
|
60
54
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
55
|
+
return {
|
|
56
|
+
selector: normalizedSelector,
|
|
57
|
+
properties,
|
|
58
|
+
...(rule['@container'] && { '@container': rule['@container'] }),
|
|
59
|
+
...(rule['@media'] && { '@media': rule['@media'] }),
|
|
60
|
+
...(rule['@supports'] && { '@supports': rule['@supports'] }),
|
|
61
|
+
};
|
|
65
62
|
};
|
|
66
63
|
const getEntryStylesCss = ({ namespace, styles = [] }) => {
|
|
67
64
|
if (!styles.length) {
|
|
@@ -70,17 +67,15 @@ const getEntryStylesCss = ({ namespace, styles = [] }) => {
|
|
|
70
67
|
if (!namespace) {
|
|
71
68
|
throw new Error('Interactions config entries with authored styles must define a namespace.');
|
|
72
69
|
}
|
|
73
|
-
|
|
74
|
-
.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
})
|
|
82
|
-
.filter(Boolean)
|
|
83
|
-
.join('\n\n');
|
|
70
|
+
const experience = {
|
|
71
|
+
$schema: 'interact-experience/1.0',
|
|
72
|
+
id: namespace,
|
|
73
|
+
name: namespace,
|
|
74
|
+
elements: {},
|
|
75
|
+
styles: styles.map((rule) => normalizeRule(namespace, rule)),
|
|
76
|
+
interact: { effects: {}, interactions: [] },
|
|
77
|
+
};
|
|
78
|
+
return renderStyles(experience, {}, '', `#main_MF #${getSectionId(namespace)}`);
|
|
84
79
|
};
|
|
85
80
|
export const getAuthoredStylesCss = (entries) => entries.map(getEntryStylesCss).filter(Boolean).join('\n\n');
|
|
86
81
|
//# sourceMappingURL=authoredStyles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authoredStyles.js","sourceRoot":"","sources":["../../../src/implementations/v2/authoredStyles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"authoredStyles.js","sourceRoot":"","sources":["../../../src/implementations/v2/authoredStyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAMhE,MAAM,cAAc,GAAG,gDAAgD,CAAA;AAEvE,MAAM,eAAe,GAAG,CAAC,KAAa,EAAU,EAAE,CACjD,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;AAEvH,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAAY,EAAE;IACxD,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,IAAI,KAAK,GAAG,CAAC,CAAA;IAEb,cAAc,CAAC,SAAS,GAAG,CAAC,CAAA;IAC5B,KAAK,IAAI,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,QAAQ,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AA;AACF,CAAC,CAAA;AAED,MAAM,iBAAiB,GAAG,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,EAAE,EAAuB,EAAU,EAAE;IACrF,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACpB,OAAO,EAAE,CAAA;IACV,CAAC;IACD,IAAI,CAAC,SAAS,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAA;IAC7F,CAAC;IAED,MAAM,UAAU,GAAe;QAC9B,OAAO,EAAE,yBAAyB;QAClC,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC5D,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE;KAC3C,CAAA;IAED,OAAO,YAAY,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,EAAE,aAAa,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;AAChF,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAA8B,EAAU,EAAE,CAC9E,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { InteractConfig } from '@wix/interact
|
|
1
|
+
import type { InteractConfig } from '@wix/interact';
|
|
2
2
|
/** Emits `cursor: pointer` for click interaction triggers (`'activate' || 'click'`), one rule per unique source selector. */
|
|
3
3
|
export declare const getClickTriggerCss: (config: InteractConfig) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { generate, Interact } from '@wix/interact
|
|
1
|
+
import { generate, Interact } from '@wix/interact';
|
|
2
2
|
import { getClickTriggerCss } from './clickTriggerCss';
|
|
3
3
|
import { motionPresets } from './motionPresets';
|
|
4
4
|
// Interact's registry is process-global. This module is only pulled into the server bundle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configCss.js","sourceRoot":"","sources":["../../../src/implementations/v2/configCss.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"configCss.js","sourceRoot":"","sources":["../../../src/implementations/v2/configCss.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAI/C,2FAA2F;AAC3F,wFAAwF;AACxF,QAAQ,CAAC,eAAe,CAAC,aAA0C,CAAC,CAAA;AAEpE,8DAA8D;AAC9D,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAsB,EAAU,EAAE;IAChE,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAA;IAClD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAA;IAElD,OAAO,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC3D,CAAC,CAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type { IInteractionsService, IInteractionsServiceConfig, IInteractionsDefinition } from '../definition';
|
|
2
|
-
export type { InteractConfig } from '@wix/interact
|
|
2
|
+
export type { InteractConfig } from '@wix/interact';
|
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.23",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -54,8 +54,9 @@
|
|
|
54
54
|
"test-type-check": "echo 'validating typescript in test files' && tsc --project tsconfig.test.json && echo 'Finished validating typescript in test files successfully'"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@wix/interact": "
|
|
58
|
-
"@wix/interact-
|
|
57
|
+
"@wix/interact": "2.5.14",
|
|
58
|
+
"@wix/interact-experience-renderer": "0.21.0",
|
|
59
|
+
"@wix/interact-v1": "npm:@wix/interact@^1.103.0",
|
|
59
60
|
"@wix/motion": "2.1.14",
|
|
60
61
|
"@wix/motion-presets": "1.0.7",
|
|
61
62
|
"@wix/services-manager": "^0.2.20",
|
|
@@ -96,5 +97,5 @@
|
|
|
96
97
|
]
|
|
97
98
|
}
|
|
98
99
|
},
|
|
99
|
-
"falconPackageHash": "
|
|
100
|
+
"falconPackageHash": "ebf6dc97acd426c4432715eab42f89c715950832bb81dee383d3d2f8"
|
|
100
101
|
}
|
package/src/definition/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineStaticService } from '@wix/static-service'
|
|
2
2
|
import type { StaticServiceDefinition } from '@wix/static-service'
|
|
3
|
-
import type { InteractConfig } from '@wix/interact
|
|
3
|
+
import type { InteractConfig } from '@wix/interact'
|
|
4
4
|
|
|
5
5
|
export type { InteractConfig }
|
|
6
6
|
|
|
@@ -19,7 +19,13 @@ export type InteractConfigEntry = {
|
|
|
19
19
|
styles?: InteractStyleRule[]
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* `version` is the dialect the config was emitted in (Thunderbolt's `InteractionsPageConfig.version`). It is
|
|
24
|
+
* the only input that picks the interact runtime; absent means v1.
|
|
25
|
+
*/
|
|
26
|
+
export type IInteractionsServiceConfig = (InteractConfig | { entries: InteractConfigEntry[] }) & {
|
|
27
|
+
version?: 'v1' | 'v2'
|
|
28
|
+
}
|
|
23
29
|
|
|
24
30
|
export interface IInteractionsService {
|
|
25
31
|
hasInteractions: (path: string) => boolean
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import type { FunctionComponent } from 'react'
|
|
3
|
-
import type { InteractConfig } from '@wix/interact
|
|
3
|
+
import type { InteractConfig } from '@wix/interact'
|
|
4
4
|
import { getInteractionsScriptContent } from './interactionsScriptContent'
|
|
5
5
|
import { reviveScriptElement } from './reviveScriptElement'
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Interact } from '@wix/interact'
|
|
2
|
-
import type { InteractConfig as InteractV1Config } from '@wix/interact'
|
|
1
|
+
import { Interact } from '@wix/interact-v1'
|
|
2
|
+
import type { InteractConfig as InteractV1Config } from '@wix/interact-v1'
|
|
3
3
|
import { DeviceInfoDefinition } from '@wix/site-service-device-info/definition'
|
|
4
4
|
import { ExperimentsDefinition } from '@wix/site-service-experiments/definition'
|
|
5
5
|
// Deliberately the deprecated pages service. Thunderbolt registers the site-service-pages page
|
|
@@ -30,6 +30,12 @@ const getRuntimeConfigs = (entries: InteractConfigEntry[]): InteractConfig[] =>
|
|
|
30
30
|
entries.map(({ interact }) => interact).filter(({ interactions }) => interactions.length > 0)
|
|
31
31
|
|
|
32
32
|
const initInteract = (entries: InteractConfigEntry[], isReducedMotion: boolean) => {
|
|
33
|
+
const runtimeConfigs = getRuntimeConfigs(entries)
|
|
34
|
+
// v1 registers its interact-element on create, and a tag can only be defined once: starting it for
|
|
35
|
+
// an empty config (the editor's disabled config, the site-level config) would lock out a later v2 loader.
|
|
36
|
+
if (!runtimeConfigs.length) {
|
|
37
|
+
return
|
|
38
|
+
}
|
|
33
39
|
// Bundled runtime is v1. v2 on the client is the CDN loader.
|
|
34
40
|
Interact.forceReducedMotion = isReducedMotion
|
|
35
41
|
Interact.setup({
|
|
@@ -39,8 +45,8 @@ const initInteract = (entries: InteractConfigEntry[], isReducedMotion: boolean)
|
|
|
39
45
|
useSafeViewEnter: true,
|
|
40
46
|
},
|
|
41
47
|
})
|
|
42
|
-
for (const
|
|
43
|
-
Interact.create(
|
|
48
|
+
for (const config of runtimeConfigs) {
|
|
49
|
+
Interact.create(config as InteractV1Config)
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
52
|
|
|
@@ -96,10 +102,13 @@ const getInteractiveComps = (entries: InteractConfigEntry[]): Set<string> => {
|
|
|
96
102
|
return keys
|
|
97
103
|
}
|
|
98
104
|
|
|
99
|
-
export const coreInteractions = (
|
|
105
|
+
export const coreInteractions = (
|
|
106
|
+
{ version, ...config }: IInteractionsServiceConfig,
|
|
107
|
+
getService: ServicesManager['getService']
|
|
108
|
+
) => {
|
|
100
109
|
const { reducedMotion: isReducedMotion } = getService(DeviceInfoDefinition)
|
|
101
110
|
const { isOpen } = getService(ExperimentsDefinition)
|
|
102
|
-
const useV2 =
|
|
111
|
+
const useV2 = version === 'v2'
|
|
103
112
|
// The v1 runtime has no preset registration and doesn't understand LEGACY_* names; skip
|
|
104
113
|
// aliasing on those paths so named reaction effects remain resolvable.
|
|
105
114
|
const entries = resolveInteractKeyConflicts((useV2 ? getResolvedConfigEntries : getInteractConfigEntries)(config))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import type { FunctionComponent } from 'react'
|
|
3
|
-
import type { InteractConfig } from '@wix/interact
|
|
3
|
+
import type { InteractConfig } from '@wix/interact'
|
|
4
4
|
import { reviveScriptElement } from '../reviveScriptElement'
|
|
5
5
|
import { getV2InteractionsScriptContent } from './interactionsScriptContent'
|
|
6
6
|
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { renderStyles } from '@wix/interact-experience-renderer'
|
|
1
2
|
import type { InteractConfigEntry, InteractStyleRule } from '../../definition'
|
|
2
3
|
|
|
4
|
+
type Experience = Parameters<typeof renderStyles>[0]
|
|
5
|
+
type RendererStyleRule = NonNullable<Experience['styles']>[number]
|
|
6
|
+
|
|
3
7
|
const SELECTOR_TOKEN = /"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[()[\]]|,/g
|
|
4
8
|
|
|
5
9
|
const escapeCssString = (value: string): string =>
|
|
@@ -27,55 +31,42 @@ const splitSelectorList = (selector: string): string[] => {
|
|
|
27
31
|
return parts.map((part) => part.trim()).filter(Boolean)
|
|
28
32
|
}
|
|
29
33
|
|
|
30
|
-
const
|
|
31
|
-
css
|
|
32
|
-
.split('\n')
|
|
33
|
-
.map((line) => (line ? ` ${line}` : line))
|
|
34
|
-
.join('\n')
|
|
35
|
-
|
|
36
|
-
const renderProperties = (properties: Record<string, string>): string =>
|
|
37
|
-
Object.entries(properties)
|
|
38
|
-
.map(([property, value]) => ` ${property}: ${value};`)
|
|
39
|
-
.join('\n')
|
|
34
|
+
const getSectionId = (namespace: string): string => namespace.slice(namespace.lastIndexOf('/') + 1)
|
|
40
35
|
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
result = `@container ${rule['@container']} {\n${indentCssBlock(result)}\n}`
|
|
45
|
-
}
|
|
46
|
-
if (rule['@media']) {
|
|
47
|
-
result = `@media ${rule['@media']} {\n${indentCssBlock(result)}\n}`
|
|
48
|
-
}
|
|
49
|
-
if (rule['@supports']) {
|
|
50
|
-
result = `@supports ${rule['@supports']} {\n${indentCssBlock(result)}\n}`
|
|
51
|
-
}
|
|
52
|
-
return result
|
|
53
|
-
}
|
|
36
|
+
const normalizeRule = (namespace: string, rule: InteractStyleRule): RendererStyleRule => {
|
|
37
|
+
const { key, selector, properties } = rule
|
|
38
|
+
let normalizedSelector: string
|
|
54
39
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
40
|
+
if (!key) {
|
|
41
|
+
normalizedSelector = selector ?? '&'
|
|
42
|
+
} else if (key === namespace) {
|
|
43
|
+
if (!selector) {
|
|
44
|
+
normalizedSelector = '&'
|
|
45
|
+
} else {
|
|
46
|
+
const separator = /^\s/.test(selector) ? ' ' : ''
|
|
47
|
+
normalizedSelector = splitSelectorList(selector)
|
|
48
|
+
.map((part) => `&${separator}${part}`)
|
|
49
|
+
.join(', ')
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
const keyRoot = `[data-interact-key="${escapeCssString(key)}"] > :first-child`
|
|
53
|
+
if (!selector) {
|
|
54
|
+
normalizedSelector = keyRoot
|
|
55
|
+
} else {
|
|
56
|
+
const separator = /^\s/.test(selector) ? ' ' : ''
|
|
57
|
+
normalizedSelector = splitSelectorList(selector)
|
|
58
|
+
.map((part) => `${keyRoot}${separator}${part}`)
|
|
59
|
+
.join(', ')
|
|
62
60
|
}
|
|
63
|
-
return splitSelectorList(rule.selector)
|
|
64
|
-
.map((selector) => `${scopeRoot} ${selector}`)
|
|
65
|
-
.join(', ')
|
|
66
61
|
}
|
|
67
62
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
return {
|
|
64
|
+
selector: normalizedSelector,
|
|
65
|
+
properties,
|
|
66
|
+
...(rule['@container'] && { '@container': rule['@container'] }),
|
|
67
|
+
...(rule['@media'] && { '@media': rule['@media'] }),
|
|
68
|
+
...(rule['@supports'] && { '@supports': rule['@supports'] }),
|
|
73
69
|
}
|
|
74
|
-
|
|
75
|
-
const separator = /^\s/.test(rule.selector) ? ' ' : ''
|
|
76
|
-
return splitSelectorList(rule.selector)
|
|
77
|
-
.map((selector) => `${keyRoot}${separator}${selector}`)
|
|
78
|
-
.join(', ')
|
|
79
70
|
}
|
|
80
71
|
|
|
81
72
|
const getEntryStylesCss = ({ namespace, styles = [] }: InteractConfigEntry): string => {
|
|
@@ -86,17 +77,16 @@ const getEntryStylesCss = ({ namespace, styles = [] }: InteractConfigEntry): str
|
|
|
86
77
|
throw new Error('Interactions config entries with authored styles must define a namespace.')
|
|
87
78
|
}
|
|
88
79
|
|
|
89
|
-
|
|
90
|
-
.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
.join('\n\n')
|
|
80
|
+
const experience: Experience = {
|
|
81
|
+
$schema: 'interact-experience/1.0',
|
|
82
|
+
id: namespace,
|
|
83
|
+
name: namespace,
|
|
84
|
+
elements: {},
|
|
85
|
+
styles: styles.map((rule) => normalizeRule(namespace, rule)),
|
|
86
|
+
interact: { effects: {}, interactions: [] },
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return renderStyles(experience, {}, '', `#main_MF #${getSectionId(namespace)}`)
|
|
100
90
|
}
|
|
101
91
|
|
|
102
92
|
export const getAuthoredStylesCss = (entries: InteractConfigEntry[]): string =>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { generate, Interact } from '@wix/interact
|
|
2
|
-
import type { InteractConfig } from '@wix/interact
|
|
1
|
+
import { generate, Interact } from '@wix/interact'
|
|
2
|
+
import type { InteractConfig } from '@wix/interact'
|
|
3
3
|
import { getClickTriggerCss } from './clickTriggerCss'
|
|
4
4
|
import { motionPresets } from './motionPresets'
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as allLegacyPresets from '@wix/wix-motion-presets'
|
|
2
2
|
import * as allPresets from '@wix/motion-presets'
|
|
3
|
-
import type { Effect, EffectRef, InteractConfig } from '@wix/interact
|
|
3
|
+
import type { Effect, EffectRef, InteractConfig } from '@wix/interact'
|
|
4
4
|
|
|
5
5
|
type EffectModule = {
|
|
6
6
|
web: unknown
|
package/src/types/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type { IInteractionsService, IInteractionsServiceConfig, IInteractionsDefinition } from '../definition'
|
|
2
|
-
export type { InteractConfig } from '@wix/interact
|
|
2
|
+
export type { InteractConfig } from '@wix/interact'
|