@wix/site-service-interactions 1.0.10 → 1.0.12
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/coreInteractions.js +31 -24
- package/cjs/build/implementations/coreInteractions.js.map +1 -1
- package/cjs/build/implementations/v2/InteractionsScriptElement.js +1 -1
- package/cjs/build/implementations/v2/InteractionsScriptElement.js.map +1 -1
- package/cjs/build/implementations/v2/cdnUrls.d.ts +2 -2
- package/cjs/build/implementations/v2/cdnUrls.js +2 -2
- package/cjs/build/implementations/v2/cdnUrls.js.map +1 -1
- package/cjs/build/implementations/v2/configCss.d.ts +1 -1
- package/cjs/build/implementations/v2/configCss.js +40 -5
- package/cjs/build/implementations/v2/configCss.js.map +1 -1
- package/cjs/build/implementations/v2/interactionsScriptContent.d.ts +2 -3
- package/cjs/build/implementations/v2/interactionsScriptContent.js +23 -39
- package/cjs/build/implementations/v2/interactionsScriptContent.js.map +1 -1
- package/dist/implementations/coreInteractions.js +28 -21
- package/dist/implementations/coreInteractions.js.map +1 -1
- package/dist/implementations/v2/InteractionsScriptElement.js +1 -1
- package/dist/implementations/v2/InteractionsScriptElement.js.map +1 -1
- package/dist/implementations/v2/cdnUrls.d.ts +2 -2
- package/dist/implementations/v2/cdnUrls.js +2 -2
- package/dist/implementations/v2/cdnUrls.js.map +1 -1
- package/dist/implementations/v2/configCss.d.ts +1 -1
- package/dist/implementations/v2/configCss.js +6 -4
- package/dist/implementations/v2/configCss.js.map +1 -1
- package/dist/implementations/v2/interactionsScriptContent.d.ts +2 -3
- package/dist/implementations/v2/interactionsScriptContent.js +23 -39
- package/dist/implementations/v2/interactionsScriptContent.js.map +1 -1
- package/package.json +7 -5
- package/src/implementations/coreInteractions.ts +31 -24
- package/src/implementations/v2/InteractionsScriptElement.tsx +1 -1
- package/src/implementations/v2/cdnUrls.ts +2 -3
- package/src/implementations/v2/configCss.ts +11 -5
- package/src/implementations/v2/interactionsScriptContent.ts +9 -36
- package/cjs/build/implementations/v2/motionPresets.d.ts +0 -13
- package/cjs/build/implementations/v2/motionPresets.js +0 -54
- package/cjs/build/implementations/v2/motionPresets.js.map +0 -1
- package/cjs/build/implementations/v2/namedEffectTypes.d.ts +0 -2
- package/cjs/build/implementations/v2/namedEffectTypes.js +0 -42
- package/cjs/build/implementations/v2/namedEffectTypes.js.map +0 -1
- package/cjs/build/implementations/v2/registerConfigEffects.d.ts +0 -6
- package/cjs/build/implementations/v2/registerConfigEffects.js +0 -27
- package/cjs/build/implementations/v2/registerConfigEffects.js.map +0 -1
- package/dist/implementations/v2/motionPresets.d.ts +0 -13
- package/dist/implementations/v2/motionPresets.js +0 -16
- package/dist/implementations/v2/motionPresets.js.map +0 -1
- package/dist/implementations/v2/namedEffectTypes.d.ts +0 -2
- package/dist/implementations/v2/namedEffectTypes.js +0 -38
- package/dist/implementations/v2/namedEffectTypes.js.map +0 -1
- package/dist/implementations/v2/registerConfigEffects.d.ts +0 -6
- package/dist/implementations/v2/registerConfigEffects.js +0 -23
- package/dist/implementations/v2/registerConfigEffects.js.map +0 -1
- package/src/implementations/v2/motionPresets.ts +0 -26
- package/src/implementations/v2/namedEffectTypes.ts +0 -52
- package/src/implementations/v2/registerConfigEffects.ts +0 -31
|
@@ -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
|
-
}
|