@wix/site-service-interactions 1.0.10 → 1.0.11

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.
Files changed (53) hide show
  1. package/cjs/build/implementations/coreInteractions.js +31 -24
  2. package/cjs/build/implementations/coreInteractions.js.map +1 -1
  3. package/cjs/build/implementations/v2/InteractionsScriptElement.js +1 -1
  4. package/cjs/build/implementations/v2/InteractionsScriptElement.js.map +1 -1
  5. package/cjs/build/implementations/v2/cdnUrls.d.ts +2 -2
  6. package/cjs/build/implementations/v2/cdnUrls.js +2 -2
  7. package/cjs/build/implementations/v2/cdnUrls.js.map +1 -1
  8. package/cjs/build/implementations/v2/configCss.d.ts +1 -1
  9. package/cjs/build/implementations/v2/configCss.js +40 -5
  10. package/cjs/build/implementations/v2/configCss.js.map +1 -1
  11. package/cjs/build/implementations/v2/interactionsScriptContent.d.ts +2 -3
  12. package/cjs/build/implementations/v2/interactionsScriptContent.js +23 -39
  13. package/cjs/build/implementations/v2/interactionsScriptContent.js.map +1 -1
  14. package/dist/implementations/coreInteractions.js +28 -21
  15. package/dist/implementations/coreInteractions.js.map +1 -1
  16. package/dist/implementations/v2/InteractionsScriptElement.js +1 -1
  17. package/dist/implementations/v2/InteractionsScriptElement.js.map +1 -1
  18. package/dist/implementations/v2/cdnUrls.d.ts +2 -2
  19. package/dist/implementations/v2/cdnUrls.js +2 -2
  20. package/dist/implementations/v2/cdnUrls.js.map +1 -1
  21. package/dist/implementations/v2/configCss.d.ts +1 -1
  22. package/dist/implementations/v2/configCss.js +6 -4
  23. package/dist/implementations/v2/configCss.js.map +1 -1
  24. package/dist/implementations/v2/interactionsScriptContent.d.ts +2 -3
  25. package/dist/implementations/v2/interactionsScriptContent.js +23 -39
  26. package/dist/implementations/v2/interactionsScriptContent.js.map +1 -1
  27. package/package.json +5 -4
  28. package/src/implementations/coreInteractions.ts +31 -24
  29. package/src/implementations/v2/InteractionsScriptElement.tsx +1 -1
  30. package/src/implementations/v2/cdnUrls.ts +2 -3
  31. package/src/implementations/v2/configCss.ts +11 -5
  32. package/src/implementations/v2/interactionsScriptContent.ts +9 -36
  33. package/cjs/build/implementations/v2/motionPresets.d.ts +0 -13
  34. package/cjs/build/implementations/v2/motionPresets.js +0 -54
  35. package/cjs/build/implementations/v2/motionPresets.js.map +0 -1
  36. package/cjs/build/implementations/v2/namedEffectTypes.d.ts +0 -2
  37. package/cjs/build/implementations/v2/namedEffectTypes.js +0 -42
  38. package/cjs/build/implementations/v2/namedEffectTypes.js.map +0 -1
  39. package/cjs/build/implementations/v2/registerConfigEffects.d.ts +0 -6
  40. package/cjs/build/implementations/v2/registerConfigEffects.js +0 -27
  41. package/cjs/build/implementations/v2/registerConfigEffects.js.map +0 -1
  42. package/dist/implementations/v2/motionPresets.d.ts +0 -13
  43. package/dist/implementations/v2/motionPresets.js +0 -16
  44. package/dist/implementations/v2/motionPresets.js.map +0 -1
  45. package/dist/implementations/v2/namedEffectTypes.d.ts +0 -2
  46. package/dist/implementations/v2/namedEffectTypes.js +0 -38
  47. package/dist/implementations/v2/namedEffectTypes.js.map +0 -1
  48. package/dist/implementations/v2/registerConfigEffects.d.ts +0 -6
  49. package/dist/implementations/v2/registerConfigEffects.js +0 -23
  50. package/dist/implementations/v2/registerConfigEffects.js.map +0 -1
  51. package/src/implementations/v2/motionPresets.ts +0 -26
  52. package/src/implementations/v2/namedEffectTypes.ts +0 -52
  53. package/src/implementations/v2/registerConfigEffects.ts +0 -31
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/site-service-interactions",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "main": "cjs/build/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -43,15 +43,16 @@
43
43
  }
44
44
  },
45
45
  "dependencies": {
46
- "@wix/interact": "^2.5.8",
46
+ "@wix/interact": "^1.103.0",
47
+ "@wix/interact-v2": "npm:@wix/interact@^2.5.14",
47
48
  "@wix/services-manager": "^0.2.20",
48
49
  "@wix/services-manager-react": "^0.1.26",
49
50
  "@wix/site-service-device-info": "1.0.2",
50
51
  "@wix/site-service-experiments": "1.0.3",
51
52
  "@wix/site-service-head-appender": "1.0.1",
52
- "@wix/site-service-pages": "1.1.0",
53
53
  "@wix/site-service-provide-css": "1.0.1",
54
54
  "@wix/static-service": "1.0.19",
55
+ "@wix/viewer-service-pages": "1.0.11",
55
56
  "@wix/wix-motion-presets": "^1.0.0"
56
57
  },
57
58
  "devDependencies": {
@@ -93,5 +94,5 @@
93
94
  ]
94
95
  }
95
96
  },
96
- "falconPackageHash": "6a5a4c22b50ccbb6b82b1bbe1aa5a588d4987df274e1b605bc05d9b6"
97
+ "falconPackageHash": "734ab56bc526bfeff605dd11b9244ff0ef20ff101b76e970334c2137"
97
98
  }
@@ -1,9 +1,14 @@
1
- import { Interact } from '@wix/interact/web'
1
+ import { Interact } from '@wix/interact'
2
2
  import type { InteractConfig } from '@wix/interact'
3
3
  import { DeviceInfoDefinition } from '@wix/site-service-device-info/definition'
4
4
  import { ExperimentsDefinition } from '@wix/site-service-experiments/definition'
5
- import { PagesDefinition } from '@wix/site-service-pages/definition'
5
+ // Deliberately the deprecated pages service. Thunderbolt registers the site-service-pages page
6
+ // config only for sites that list it in `requiredServicesMap`, which ordinary sites do not, so
7
+ // `currentPage` falls back to EMPTY_PAGE and the id is ''. The legacy pages feature carries an
8
+ // explicit `interactionsFeature` escape hatch, so its config is populated for us.
9
+ import { PagesDefinition } from '@wix/viewer-service-pages/definition'
6
10
  import { HeadAppenderDefinition } from '@wix/site-service-head-appender/definition'
11
+ import { HeadContentType } from '@wix/site-service-head-appender/types'
7
12
  import { ProvideComponentServiceDefinition } from '@wix/services-manager-react/core-services/provide-component'
8
13
  import type { ServicesManager } from '@wix/services-manager/types'
9
14
  import { createInteractionsScriptElement } from './InteractionsScriptElement'
@@ -11,12 +16,9 @@ import { createV2InteractionsScriptElement } from './v2/InteractionsScriptElemen
11
16
  import { getV2ConfigCss } from './v2/configCss'
12
17
  import { getV2ConfigStyleHeadContent } from './v2/configStyleHeadContent'
13
18
  import { getV2ModulePreloadHeadContent } from './v2/interactionsScriptContent'
14
- import { registerConfigEffects } from './v2/registerConfigEffects'
15
19
 
16
20
  const initInteract = (config: InteractConfig, isReducedMotion: boolean) => {
17
- // The bundled runtime is v2, where named effects come from a separate package the loader
18
- // script imports on the SSR path. Here they have to be registered before create().
19
- registerConfigEffects(config)
21
+ // Bundled runtime is v1. v2 on the client is the CDN loader.
20
22
  Interact.forceReducedMotion = isReducedMotion
21
23
  Interact.setup({
22
24
  scrollOptionsGetter: () => globalThis.document.getElementById('site-root'),
@@ -38,27 +40,18 @@ const initRuntime = (
38
40
  return
39
41
  }
40
42
 
41
- const pageId = getService(PagesDefinition).currentPage?.id
43
+ const pageId = getService(PagesDefinition).currentPageId()
42
44
  if (!pageId) {
43
45
  return
44
46
  }
45
47
 
46
48
  const { addTopComponent } = getService(ProvideComponentServiceDefinition)
47
49
 
48
- if (!useV2) {
49
- addTopComponent(createInteractionsScriptElement(config, isReducedMotion, pageId))
50
- return
51
- }
50
+ const interactionsScript = useV2
51
+ ? createV2InteractionsScriptElement(config, isReducedMotion, pageId)
52
+ : createInteractionsScriptElement(config, isReducedMotion, pageId)
52
53
 
53
- // Both belong in the head: the preload links only help while the document is still parsing,
54
- // and the generated CSS hides elements before their entrance effect, so it has to apply
55
- // before the body renders.
56
- const css = getV2ConfigCss(config).trim()
57
- getService(HeadAppenderDefinition).setHead(
58
- getV2ModulePreloadHeadContent(config) + (css ? getV2ConfigStyleHeadContent(css) : '')
59
- )
60
-
61
- addTopComponent(createV2InteractionsScriptElement(config, isReducedMotion, pageId))
54
+ addTopComponent(interactionsScript)
62
55
  }
63
56
 
64
57
  const getInteractiveComps = (interactions: InteractConfig['interactions']) =>
@@ -76,14 +69,28 @@ export const coreInteractions = (config: InteractConfig, getService: ServicesMan
76
69
  const { reducedMotion: isReducedMotion } = getService(DeviceInfoDefinition)
77
70
  const { isOpen } = getService(ExperimentsDefinition)
78
71
 
79
- if (isOpen('specs.thunderbolt.interactionsInSsr')) {
72
+ if (isOpen('specs.thunderbolt.vsm_interactions_v2')) {
73
+ // Both belong in the head: the preload links only help while the document is still parsing,
74
+ // and the generated CSS hides elements before their entrance effect, so it has to apply
75
+ // before the body renders.
76
+ if (!process.env.browser) {
77
+ const css = getV2ConfigCss(config).trim()
78
+ // GENERAL rather than setHead's AFTER_SECURITY default: thunderbolt only reads the
79
+ // after-security bucket on its SEO path, so the default drops this on every normal
80
+ // request. GENERAL reaches the document as raw markup before `</head>`.
81
+ getService(HeadAppenderDefinition).setHead(
82
+ getV2ModulePreloadHeadContent() + (css ? getV2ConfigStyleHeadContent(css) : ''),
83
+ HeadContentType.GENERAL
84
+ )
85
+ }
86
+
87
+ initRuntime(config, isReducedMotion, getService, true)
88
+ } else if (isOpen('specs.thunderbolt.interactionsInSsr')) {
80
89
  // Emits the config and loader scripts. Works in both environments: SSR serves markup the
81
90
  // parser executes, and on the client the loader's ref revives it into a script that runs —
82
91
  // which is what pages rendered only on the client (password-protected / members-only,
83
92
  // client-side navigation) need, since they never get a server-rendered document.
84
- // v2 is only reachable from here: it ships as a loader script plus generated CSS, both of
85
- // which exist only on this path.
86
- initRuntime(config, isReducedMotion, getService, isOpen('specs.thunderbolt.vsm_interactions_v2'))
93
+ initRuntime(config, isReducedMotion, getService, false)
87
94
  } else {
88
95
  initInteract(config, isReducedMotion)
89
96
  }
@@ -20,7 +20,7 @@ export const createV2InteractionsScriptElement =
20
20
  // script delimiters and template-literal syntax while keeping the ID deterministic.
21
21
  const safePageId = encodeURIComponent(pageId)
22
22
  const configId = `interactions-config-${safePageId}`
23
- const interactionsScriptContent = getV2InteractionsScriptContent(config, configId, isReducedMotion)
23
+ const interactionsScriptContent = getV2InteractionsScriptContent(configId, isReducedMotion)
24
24
  const configProps = {
25
25
  [DANGEROUSLY_SET_INNER_HTML.join('')]: { __html: serializeConfigForScriptElement(config) },
26
26
  }
@@ -1,4 +1,3 @@
1
- export const INTERACT_V2_IMPORT_URL = 'https://cdn.jsdelivr.net/npm/@wix/interact@2/dist/es/web.min.js'
1
+ export const INTERACT_V2_IMPORT_URL = 'https://cdn.jsdelivr.net/npm/@wix/interact@2.5.14/dist/es/web.min.js'
2
2
 
3
- export const WIX_MOTION_PRESETS_IMPORT_URL =
4
- 'https://static.parastorage.com/services/wix-motion-presets/dist/wix-motion-presets.esm.min.js'
3
+ export const WIX_MOTION_PRESETS_IMPORT_URL = 'https://cdn.jsdelivr.net/npm/@wix/wix-motion-presets@1.0.0/+esm'
@@ -1,12 +1,18 @@
1
- import { generate } from '@wix/interact'
1
+ import { generate, Interact } from '@wix/interact-v2'
2
2
  import type { InteractConfig } from '@wix/interact'
3
+ import type { InteractConfig as InteractV2Config } from '@wix/interact-v2'
4
+ import * as motionPresets from '@wix/wix-motion-presets'
3
5
  import { getClickTriggerCss } from './clickTriggerCss'
4
- import { registerConfigEffects } from './registerConfigEffects'
5
6
 
6
- /** Register config-used presets, then emit animation FOUC CSS and click-trigger cursor rules. */
7
+ type PresetRegistry = Parameters<typeof Interact.registerEffects>[0]
8
+
9
+ // Interact's registry is process-global. This module is only pulled into the server bundle
10
+ // (`process.env.browser` DCE), so the namespace is registered once per Node process.
11
+ Interact.registerEffects(motionPresets as unknown as PresetRegistry)
12
+
13
+ /** Emit animation FOUC CSS and click-trigger cursor rules. */
7
14
  export const getV2ConfigCss = (config: InteractConfig): string => {
8
- registerConfigEffects(config)
9
- const animationCss = generate(config, true).trim()
15
+ const animationCss = generate(config as InteractV2Config, true).trim()
10
16
  const clickCss = getClickTriggerCss(config).trim()
11
17
 
12
18
  return [animationCss, clickCss].filter(Boolean).join('\n')
@@ -1,12 +1,4 @@
1
- import type { InteractConfig } from '@wix/interact'
2
1
  import { INTERACT_V2_IMPORT_URL, WIX_MOTION_PRESETS_IMPORT_URL } from './cdnUrls'
3
- import { collectNamedEffectTypes } from './namedEffectTypes'
4
- import { filterKnownPresetTypes } from './motionPresets'
5
-
6
- const getPresetTypes = (config: InteractConfig): string[] => filterKnownPresetTypes(collectNamedEffectTypes(config))
7
-
8
- const getModuleUrls = (presetTypes: string[]): string[] =>
9
- presetTypes.length > 0 ? [INTERACT_V2_IMPORT_URL, WIX_MOTION_PRESETS_IMPORT_URL] : [INTERACT_V2_IMPORT_URL]
10
2
 
11
3
  /**
12
4
  * The loader reaches these modules through dynamic `import()`, which the preload scanner cannot
@@ -14,35 +6,19 @@ const getModuleUrls = (presetTypes: string[]): string[] =>
14
6
  * `modulepreload` fetches with the same credentials mode as a bare `import()`, and a mismatch
15
7
  * would download each module twice.
16
8
  */
17
- export const getV2ModulePreloadHeadContent = (config: InteractConfig): string =>
18
- getModuleUrls(getPresetTypes(config))
19
- .map(url => `<link rel="modulepreload" href="${url}">`)
20
- .join('')
21
-
22
- export const getV2InteractionsScriptContent = (
23
- config: InteractConfig,
24
- configId: string,
25
- isReducedMotion: boolean
26
- ): string => {
27
- const presetTypes = getPresetTypes(config)
28
- const bindings = ['{ Interact }']
29
- const imports = getModuleUrls(presetTypes).map(url => `import(\`${url}\`)`)
30
-
31
- if (presetTypes.length > 0) {
32
- bindings.push(`{ ${presetTypes.join(', ')} }`)
33
- }
34
-
35
- const registerEffects =
36
- presetTypes.length > 0 ? ` Interact.registerEffects({ ${presetTypes.join(', ')} })` : undefined
9
+ export const getV2ModulePreloadHeadContent = (): string =>
10
+ `<link rel="modulepreload" href="${INTERACT_V2_IMPORT_URL}"><link rel="modulepreload" href="${WIX_MOTION_PRESETS_IMPORT_URL}">`
37
11
 
38
- return [
12
+ export const getV2InteractionsScriptContent = (configId: string, isReducedMotion: boolean): string =>
13
+ [
39
14
  `const configElement = document.getElementById(\`${configId}\`)`,
40
15
  'if (configElement) {',
41
16
  ' const config = JSON.parse(configElement.textContent)',
42
- ` const [${bindings.join(', ')}] = await Promise.all([`,
43
- ...imports.map(importCall => ` ${importCall},`),
17
+ ' const [{ Interact }, presets] = await Promise.all([',
18
+ ` import(\`${INTERACT_V2_IMPORT_URL}\`),`,
19
+ ` import(\`${WIX_MOTION_PRESETS_IMPORT_URL}\`),`,
44
20
  ' ])',
45
- registerEffects,
21
+ ' Interact.registerEffects(presets)',
46
22
  ` Interact.forceReducedMotion = ${isReducedMotion}`,
47
23
  ' Interact.setup({',
48
24
  ' scrollOptionsGetter: function () {',
@@ -55,7 +31,4 @@ export const getV2InteractionsScriptContent = (
55
31
  ' })',
56
32
  ' Interact.create(config)',
57
33
  '}',
58
- ]
59
- .filter((line): line is string => line !== undefined)
60
- .join('\n')
61
- }
34
+ ].join('\n')
@@ -1,13 +0,0 @@
1
- type EffectModule = {
2
- web: unknown;
3
- style?: unknown;
4
- getNames: unknown;
5
- };
6
- export declare const motionPresets: Record<string, EffectModule>;
7
- export declare const isKnownPresetType: (type: string) => boolean;
8
- /**
9
- * Preset names become bare JavaScript identifiers in the client loader. Filtering against the
10
- * installed package prevents unknown names from creating invalid source or a failed import.
11
- */
12
- export declare const filterKnownPresetTypes: (types: string[]) => string[];
13
- export {};
@@ -1,54 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.filterKnownPresetTypes = exports.isKnownPresetType = exports.motionPresets = void 0;
37
- const allPresets = __importStar(require("@wix/wix-motion-presets"));
38
- exports.motionPresets = allPresets;
39
- const knownPresetTypes = new Set(Object.keys(exports.motionPresets));
40
- const isKnownPresetType = (type) => knownPresetTypes.has(type);
41
- exports.isKnownPresetType = isKnownPresetType;
42
- /**
43
- * Preset names become bare JavaScript identifiers in the client loader. Filtering against the
44
- * installed package prevents unknown names from creating invalid source or a failed import.
45
- */
46
- const filterKnownPresetTypes = (types) => {
47
- const unknown = types.filter(type => !(0, exports.isKnownPresetType)(type));
48
- if (unknown.length > 0) {
49
- console.warn(`Interactions: skipping unknown Wix motion preset type(s): ${unknown.join(', ')}`);
50
- }
51
- return types.filter(exports.isKnownPresetType);
52
- };
53
- exports.filterKnownPresetTypes = filterKnownPresetTypes;
54
- //# sourceMappingURL=motionPresets.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"motionPresets.js","sourceRoot":"","sources":["../../../../src/implementations/v2/motionPresets.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oEAAqD;AAQxC,QAAA,aAAa,GAAiC,UAAqD,CAAA;AAEhH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAa,CAAC,CAAC,CAAA;AAErD,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AAAzE,QAAA,iBAAiB,qBAAwD;AAEtF;;;GAGG;AACI,MAAM,sBAAsB,GAAG,CAAC,KAAe,EAAY,EAAE;IAChE,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAA,yBAAiB,EAAC,IAAI,CAAC,CAAC,CAAA;IAC9D,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,6DAA6D,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACnG,CAAC;IAED,OAAO,KAAK,CAAC,MAAM,CAAC,yBAAiB,CAAC,CAAA;AAC1C,CAAC,CAAA;AAPY,QAAA,sBAAsB,0BAOlC"}
@@ -1,2 +0,0 @@
1
- import type { InteractConfig } from '@wix/interact';
2
- export declare const collectNamedEffectTypes: (config: InteractConfig) => string[];
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.collectNamedEffectTypes = void 0;
4
- /** Prefer the effects map; fall back to an inline named effect when an effect id misses. */
5
- const resolveEffect = (config, effect) => {
6
- if (!effect.effectId) {
7
- return effect;
8
- }
9
- return config.effects?.[effect.effectId] ?? effect;
10
- };
11
- const readNamedEffectType = (effect) => {
12
- if (!('namedEffect' in effect) || !effect.namedEffect) {
13
- return undefined;
14
- }
15
- const { type } = effect.namedEffect;
16
- return typeof type === 'string' ? type : undefined;
17
- };
18
- const collectNamedEffectTypes = (config) => {
19
- const types = new Set();
20
- const collectFromEffects = (effects) => {
21
- for (const effect of effects) {
22
- const type = readNamedEffectType(resolveEffect(config, effect));
23
- if (type) {
24
- types.add(type);
25
- }
26
- }
27
- };
28
- for (const interaction of config.interactions) {
29
- collectFromEffects(interaction.effects ?? []);
30
- for (const sequence of interaction.sequences ?? []) {
31
- if ('effects' in sequence) {
32
- collectFromEffects(sequence.effects);
33
- continue;
34
- }
35
- const referencedSequence = config.sequences?.[sequence.sequenceId];
36
- collectFromEffects(referencedSequence?.effects ?? []);
37
- }
38
- }
39
- return [...types].sort();
40
- };
41
- exports.collectNamedEffectTypes = collectNamedEffectTypes;
42
- //# sourceMappingURL=namedEffectTypes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"namedEffectTypes.js","sourceRoot":"","sources":["../../../../src/implementations/v2/namedEffectTypes.ts"],"names":[],"mappings":";;;AAMA,4FAA4F;AAC5F,MAAM,aAAa,GAAG,CAAC,MAAsB,EAAE,MAAoB,EAAsB,EAAE;IACvF,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACnB,OAAO,MAAM,CAAA;IACjB,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAA;AACtD,CAAC,CAAA;AAED,MAAM,mBAAmB,GAAG,CAAC,MAA0B,EAAsB,EAAE;IAC3E,IAAI,CAAC,CAAC,aAAa,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QACpD,OAAO,SAAS,CAAA;IACpB,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,WAAW,CAAA;IACnC,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;AACtD,CAAC,CAAA;AAEM,MAAM,uBAAuB,GAAG,CAAC,MAAsB,EAAY,EAAE;IACxE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAA;IAE/B,MAAM,kBAAkB,GAAG,CAAC,OAAuB,EAAE,EAAE;QACnD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,IAAI,GAAG,mBAAmB,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;YAC/D,IAAI,IAAI,EAAE,CAAC;gBACP,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YACnB,CAAC;QACL,CAAC;IACL,CAAC,CAAA;IAED,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QAC5C,kBAAkB,CAAC,WAAW,CAAC,OAAO,IAAI,EAAE,CAAC,CAAA;QAE7C,KAAK,MAAM,QAAQ,IAAI,WAAW,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC;YACjD,IAAI,SAAS,IAAI,QAAQ,EAAE,CAAC;gBACxB,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;gBACpC,SAAQ;YACZ,CAAC;YAED,MAAM,kBAAkB,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;YAClE,kBAAkB,CAAC,kBAAkB,EAAE,OAAO,IAAI,EAAE,CAAC,CAAA;QACzD,CAAC;IACL,CAAC;IAED,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAA;AAC5B,CAAC,CAAA;AA3BY,QAAA,uBAAuB,2BA2BnC"}
@@ -1,6 +0,0 @@
1
- import type { InteractConfig } from '@wix/interact';
2
- /**
3
- * A named effect only runs once its preset is registered, so every path that reaches
4
- * `Interact.create` or `generate` has to register the config's presets first.
5
- */
6
- export declare const registerConfigEffects: (config: InteractConfig) => void;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.registerConfigEffects = void 0;
4
- const interact_1 = require("@wix/interact");
5
- const namedEffectTypes_1 = require("./namedEffectTypes");
6
- const motionPresets_1 = require("./motionPresets");
7
- // Interact's effect registry is process-global, so mirror it across repeated SSR renders.
8
- const registeredTypes = new Set();
9
- /**
10
- * A named effect only runs once its preset is registered, so every path that reaches
11
- * `Interact.create` or `generate` has to register the config's presets first.
12
- */
13
- const registerConfigEffects = (config) => {
14
- const presetsToRegister = {};
15
- for (const type of (0, motionPresets_1.filterKnownPresetTypes)((0, namedEffectTypes_1.collectNamedEffectTypes)(config))) {
16
- if (registeredTypes.has(type)) {
17
- continue;
18
- }
19
- presetsToRegister[type] = motionPresets_1.motionPresets[type];
20
- }
21
- if (Object.keys(presetsToRegister).length > 0) {
22
- interact_1.Interact.registerEffects(presetsToRegister);
23
- Object.keys(presetsToRegister).forEach(type => registeredTypes.add(type));
24
- }
25
- };
26
- exports.registerConfigEffects = registerConfigEffects;
27
- //# sourceMappingURL=registerConfigEffects.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerConfigEffects.js","sourceRoot":"","sources":["../../../../src/implementations/v2/registerConfigEffects.ts"],"names":[],"mappings":";;;AAAA,4CAAwC;AAExC,yDAA4D;AAC5D,mDAAuE;AAKvE,0FAA0F;AAC1F,MAAM,eAAe,GAAG,IAAI,GAAG,EAAU,CAAA;AAEzC;;;GAGG;AACI,MAAM,qBAAqB,GAAG,CAAC,MAAsB,EAAE,EAAE;IAC5D,MAAM,iBAAiB,GAAmB,EAAE,CAAA;IAE5C,KAAK,MAAM,IAAI,IAAI,IAAA,sCAAsB,EAAC,IAAA,0CAAuB,EAAC,MAAM,CAAC,CAAC,EAAE,CAAC;QACzE,IAAI,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5B,SAAQ;QACZ,CAAC;QAED,iBAAiB,CAAC,IAAI,CAAC,GAAG,6BAAa,CAAC,IAAI,CAAiB,CAAA;IACjE,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5C,mBAAQ,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAA;QAC3C,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;IAC7E,CAAC;AACL,CAAC,CAAA;AAfY,QAAA,qBAAqB,yBAejC"}
@@ -1,13 +0,0 @@
1
- type EffectModule = {
2
- web: unknown;
3
- style?: unknown;
4
- getNames: unknown;
5
- };
6
- export declare const motionPresets: Record<string, EffectModule>;
7
- export declare const isKnownPresetType: (type: string) => boolean;
8
- /**
9
- * Preset names become bare JavaScript identifiers in the client loader. Filtering against the
10
- * installed package prevents unknown names from creating invalid source or a failed import.
11
- */
12
- export declare const filterKnownPresetTypes: (types: string[]) => string[];
13
- export {};
@@ -1,16 +0,0 @@
1
- import * as allPresets from '@wix/wix-motion-presets';
2
- export const motionPresets = allPresets;
3
- const knownPresetTypes = new Set(Object.keys(motionPresets));
4
- export const isKnownPresetType = (type) => knownPresetTypes.has(type);
5
- /**
6
- * Preset names become bare JavaScript identifiers in the client loader. Filtering against the
7
- * installed package prevents unknown names from creating invalid source or a failed import.
8
- */
9
- export const filterKnownPresetTypes = (types) => {
10
- const unknown = types.filter(type => !isKnownPresetType(type));
11
- if (unknown.length > 0) {
12
- console.warn(`Interactions: skipping unknown Wix motion preset type(s): ${unknown.join(', ')}`);
13
- }
14
- return types.filter(isKnownPresetType);
15
- };
16
- //# sourceMappingURL=motionPresets.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"motionPresets.js","sourceRoot":"","sources":["../../../src/implementations/v2/motionPresets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,yBAAyB,CAAA;AAQrD,MAAM,CAAC,MAAM,aAAa,GAAiC,UAAqD,CAAA;AAEhH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAA;AAE5D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AAEtF;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAe,EAAY,EAAE;IAChE,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAA;IAC9D,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,6DAA6D,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACnG,CAAC;IAED,OAAO,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAA;AAC1C,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- import type { InteractConfig } from '@wix/interact';
2
- export declare const collectNamedEffectTypes: (config: InteractConfig) => string[];
@@ -1,38 +0,0 @@
1
- /** Prefer the effects map; fall back to an inline named effect when an effect id misses. */
2
- const resolveEffect = (config, effect) => {
3
- if (!effect.effectId) {
4
- return effect;
5
- }
6
- return config.effects?.[effect.effectId] ?? effect;
7
- };
8
- const readNamedEffectType = (effect) => {
9
- if (!('namedEffect' in effect) || !effect.namedEffect) {
10
- return undefined;
11
- }
12
- const { type } = effect.namedEffect;
13
- return typeof type === 'string' ? type : undefined;
14
- };
15
- export const collectNamedEffectTypes = (config) => {
16
- const types = new Set();
17
- const collectFromEffects = (effects) => {
18
- for (const effect of effects) {
19
- const type = readNamedEffectType(resolveEffect(config, effect));
20
- if (type) {
21
- types.add(type);
22
- }
23
- }
24
- };
25
- for (const interaction of config.interactions) {
26
- collectFromEffects(interaction.effects ?? []);
27
- for (const sequence of interaction.sequences ?? []) {
28
- if ('effects' in sequence) {
29
- collectFromEffects(sequence.effects);
30
- continue;
31
- }
32
- const referencedSequence = config.sequences?.[sequence.sequenceId];
33
- collectFromEffects(referencedSequence?.effects ?? []);
34
- }
35
- }
36
- return [...types].sort();
37
- };
38
- //# sourceMappingURL=namedEffectTypes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"namedEffectTypes.js","sourceRoot":"","sources":["../../../src/implementations/v2/namedEffectTypes.ts"],"names":[],"mappings":"AAMA,4FAA4F;AAC5F,MAAM,aAAa,GAAG,CAAC,MAAsB,EAAE,MAAoB,EAAsB,EAAE;IACvF,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACnB,OAAO,MAAM,CAAA;IACjB,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAA;AACtD,CAAC,CAAA;AAED,MAAM,mBAAmB,GAAG,CAAC,MAA0B,EAAsB,EAAE;IAC3E,IAAI,CAAC,CAAC,aAAa,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QACpD,OAAO,SAAS,CAAA;IACpB,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,WAAW,CAAA;IACnC,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;AACtD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAAsB,EAAY,EAAE;IACxE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAA;IAE/B,MAAM,kBAAkB,GAAG,CAAC,OAAuB,EAAE,EAAE;QACnD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,IAAI,GAAG,mBAAmB,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;YAC/D,IAAI,IAAI,EAAE,CAAC;gBACP,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YACnB,CAAC;QACL,CAAC;IACL,CAAC,CAAA;IAED,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QAC5C,kBAAkB,CAAC,WAAW,CAAC,OAAO,IAAI,EAAE,CAAC,CAAA;QAE7C,KAAK,MAAM,QAAQ,IAAI,WAAW,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC;YACjD,IAAI,SAAS,IAAI,QAAQ,EAAE,CAAC;gBACxB,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;gBACpC,SAAQ;YACZ,CAAC;YAED,MAAM,kBAAkB,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;YAClE,kBAAkB,CAAC,kBAAkB,EAAE,OAAO,IAAI,EAAE,CAAC,CAAA;QACzD,CAAC;IACL,CAAC;IAED,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAA;AAC5B,CAAC,CAAA"}
@@ -1,6 +0,0 @@
1
- import type { InteractConfig } from '@wix/interact';
2
- /**
3
- * A named effect only runs once its preset is registered, so every path that reaches
4
- * `Interact.create` or `generate` has to register the config's presets first.
5
- */
6
- export declare const registerConfigEffects: (config: InteractConfig) => void;
@@ -1,23 +0,0 @@
1
- import { Interact } from '@wix/interact';
2
- import { collectNamedEffectTypes } from './namedEffectTypes';
3
- import { filterKnownPresetTypes, motionPresets } from './motionPresets';
4
- // Interact's effect registry is process-global, so mirror it across repeated SSR renders.
5
- const registeredTypes = new Set();
6
- /**
7
- * A named effect only runs once its preset is registered, so every path that reaches
8
- * `Interact.create` or `generate` has to register the config's presets first.
9
- */
10
- export const registerConfigEffects = (config) => {
11
- const presetsToRegister = {};
12
- for (const type of filterKnownPresetTypes(collectNamedEffectTypes(config))) {
13
- if (registeredTypes.has(type)) {
14
- continue;
15
- }
16
- presetsToRegister[type] = motionPresets[type];
17
- }
18
- if (Object.keys(presetsToRegister).length > 0) {
19
- Interact.registerEffects(presetsToRegister);
20
- Object.keys(presetsToRegister).forEach(type => registeredTypes.add(type));
21
- }
22
- };
23
- //# sourceMappingURL=registerConfigEffects.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerConfigEffects.js","sourceRoot":"","sources":["../../../src/implementations/v2/registerConfigEffects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAKvE,0FAA0F;AAC1F,MAAM,eAAe,GAAG,IAAI,GAAG,EAAU,CAAA;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAAsB,EAAE,EAAE;IAC5D,MAAM,iBAAiB,GAAmB,EAAE,CAAA;IAE5C,KAAK,MAAM,IAAI,IAAI,sBAAsB,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;QACzE,IAAI,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5B,SAAQ;QACZ,CAAC;QAED,iBAAiB,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,IAAI,CAAiB,CAAA;IACjE,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5C,QAAQ,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAA;QAC3C,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;IAC7E,CAAC;AACL,CAAC,CAAA"}
@@ -1,26 +0,0 @@
1
- import * as allPresets from '@wix/wix-motion-presets'
2
-
3
- type EffectModule = {
4
- web: unknown
5
- style?: unknown
6
- getNames: unknown
7
- }
8
-
9
- export const motionPresets: Record<string, EffectModule> = allPresets as unknown as Record<string, EffectModule>
10
-
11
- const knownPresetTypes = new Set(Object.keys(motionPresets))
12
-
13
- export const isKnownPresetType = (type: string): boolean => knownPresetTypes.has(type)
14
-
15
- /**
16
- * Preset names become bare JavaScript identifiers in the client loader. Filtering against the
17
- * installed package prevents unknown names from creating invalid source or a failed import.
18
- */
19
- export const filterKnownPresetTypes = (types: string[]): string[] => {
20
- const unknown = types.filter(type => !isKnownPresetType(type))
21
- if (unknown.length > 0) {
22
- console.warn(`Interactions: skipping unknown Wix motion preset type(s): ${unknown.join(', ')}`)
23
- }
24
-
25
- return types.filter(isKnownPresetType)
26
- }
@@ -1,52 +0,0 @@
1
- import type { Effect, EffectRef, InteractConfig } from '@wix/interact'
2
-
3
- type InteractionEffect = NonNullable<InteractConfig['interactions'][number]['effects']>[number]
4
- type SequenceEffect = NonNullable<InteractConfig['sequences']>[string]['effects'][number]
5
- type ConfigEffect = InteractionEffect | SequenceEffect
6
-
7
- /** Prefer the effects map; fall back to an inline named effect when an effect id misses. */
8
- const resolveEffect = (config: InteractConfig, effect: ConfigEffect): Effect | EffectRef => {
9
- if (!effect.effectId) {
10
- return effect
11
- }
12
-
13
- return config.effects?.[effect.effectId] ?? effect
14
- }
15
-
16
- const readNamedEffectType = (effect: Effect | EffectRef): string | undefined => {
17
- if (!('namedEffect' in effect) || !effect.namedEffect) {
18
- return undefined
19
- }
20
-
21
- const { type } = effect.namedEffect
22
- return typeof type === 'string' ? type : undefined
23
- }
24
-
25
- export const collectNamedEffectTypes = (config: InteractConfig): string[] => {
26
- const types = new Set<string>()
27
-
28
- const collectFromEffects = (effects: ConfigEffect[]) => {
29
- for (const effect of effects) {
30
- const type = readNamedEffectType(resolveEffect(config, effect))
31
- if (type) {
32
- types.add(type)
33
- }
34
- }
35
- }
36
-
37
- for (const interaction of config.interactions) {
38
- collectFromEffects(interaction.effects ?? [])
39
-
40
- for (const sequence of interaction.sequences ?? []) {
41
- if ('effects' in sequence) {
42
- collectFromEffects(sequence.effects)
43
- continue
44
- }
45
-
46
- const referencedSequence = config.sequences?.[sequence.sequenceId]
47
- collectFromEffects(referencedSequence?.effects ?? [])
48
- }
49
- }
50
-
51
- return [...types].sort()
52
- }
@@ -1,31 +0,0 @@
1
- import { Interact } from '@wix/interact'
2
- import type { InteractConfig } from '@wix/interact'
3
- import { collectNamedEffectTypes } from './namedEffectTypes'
4
- import { filterKnownPresetTypes, motionPresets } from './motionPresets'
5
-
6
- type PresetRegistry = Parameters<typeof Interact.registerEffects>[0]
7
- type EffectModule = PresetRegistry[string]
8
-
9
- // Interact's effect registry is process-global, so mirror it across repeated SSR renders.
10
- const registeredTypes = new Set<string>()
11
-
12
- /**
13
- * A named effect only runs once its preset is registered, so every path that reaches
14
- * `Interact.create` or `generate` has to register the config's presets first.
15
- */
16
- export const registerConfigEffects = (config: InteractConfig) => {
17
- const presetsToRegister: PresetRegistry = {}
18
-
19
- for (const type of filterKnownPresetTypes(collectNamedEffectTypes(config))) {
20
- if (registeredTypes.has(type)) {
21
- continue
22
- }
23
-
24
- presetsToRegister[type] = motionPresets[type] as EffectModule
25
- }
26
-
27
- if (Object.keys(presetsToRegister).length > 0) {
28
- Interact.registerEffects(presetsToRegister)
29
- Object.keys(presetsToRegister).forEach(type => registeredTypes.add(type))
30
- }
31
- }