@wix/interact 1.83.0 → 1.85.0
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/dist/cjs/WixInteractElement.js +6 -3
- package/dist/cjs/WixInteractElement.js.map +1 -1
- package/dist/cjs/core/Interact.js +21 -8
- package/dist/cjs/core/Interact.js.map +1 -1
- package/dist/cjs/core/add.js +35 -28
- package/dist/cjs/core/add.js.map +1 -1
- package/dist/cjs/core/remove.js +9 -10
- package/dist/cjs/core/remove.js.map +1 -1
- package/dist/cjs/core/utilities.js +16 -0
- package/dist/cjs/core/utilities.js.map +1 -0
- package/dist/cjs/handlers/click.js +14 -2
- package/dist/cjs/handlers/click.js.map +1 -1
- package/dist/cjs/handlers/hover.js +16 -3
- package/dist/cjs/handlers/hover.js.map +1 -1
- package/dist/cjs/handlers/viewEnter.js +3 -5
- package/dist/cjs/handlers/viewEnter.js.map +1 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/WixInteractElement.js +6 -3
- package/dist/esm/WixInteractElement.js.map +1 -1
- package/dist/esm/core/Interact.js +22 -11
- package/dist/esm/core/Interact.js.map +1 -1
- package/dist/esm/core/add.js +35 -28
- package/dist/esm/core/add.js.map +1 -1
- package/dist/esm/core/remove.js +9 -10
- package/dist/esm/core/remove.js.map +1 -1
- package/dist/esm/core/utilities.js +14 -0
- package/dist/esm/core/utilities.js.map +1 -0
- package/dist/esm/handlers/click.js +14 -2
- package/dist/esm/handlers/click.js.map +1 -1
- package/dist/esm/handlers/hover.js +16 -3
- package/dist/esm/handlers/hover.js.map +1 -1
- package/dist/esm/handlers/viewEnter.js +3 -5
- package/dist/esm/handlers/viewEnter.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/types/WixInteractElement.d.ts +1 -1
- package/dist/types/core/Interact.d.ts +6 -2
- package/dist/types/core/utilities.d.ts +2 -0
- package/dist/types/handlers/click.d.ts +2 -2
- package/dist/types/handlers/hover.d.ts +2 -2
- package/dist/types/types.d.ts +9 -11
- package/package.json +3 -3
package/dist/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/types.ts"],"sourcesContent":["import type {\n NamedEffect,\n RangeOffset,\n ScrubTransitionEasing,\n MotionAnimationOptions,\n} from '@wix/motion';\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n 'wix-interact-element': React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLElement>,\n HTMLElement\n > & {\n 'data-wix-path'?: string;\n };\n }\n }\n}\n\nexport type TriggerType =\n | 'hover'\n | 'click'\n | 'viewEnter'\n | 'pageVisible'\n | 'animationEnd'\n | 'viewProgress'\n | 'pointerMove';\n\nexport type ViewEnterType = 'once' | 'repeat' | 'alternate';\n\nexport type TransitionMethod = 'add' | 'remove' | 'toggle' | 'clear';\n\nexport type StateParams = {\n method: TransitionMethod;\n};\n\nexport type PointerTriggerParams = {\n type?: ViewEnterType | 'state';\n};\n\nexport type ViewEnterParams = {\n type?: ViewEnterType;\n threshold?: number;\n inset?: string;\n};\n\nexport type PointerMoveParams = {\n hitArea?: 'root' | 'self';\n};\n\nexport type AnimationEndParams = {\n effectId: string;\n};\n\nexport type TriggerParams =\n | StateParams\n | PointerTriggerParams\n | ViewEnterParams\n | PointerMoveParams\n | AnimationEndParams;\n\ntype Fill = 'none' | 'forwards' | 'backwards' | 'both';\n\ntype MotionKeyframeEffect = {\n name: string;\n keyframes: Keyframe[];\n};\n\ntype EffectEffectProperty =\n | {\n keyframeEffect: MotionKeyframeEffect;\n }\n | {\n namedEffect: NamedEffect;\n }\n | {\n customEffect: (element:
|
|
1
|
+
{"version":3,"names":[],"sources":["../../src/types.ts"],"sourcesContent":["import type {\n NamedEffect,\n RangeOffset,\n ScrubTransitionEasing,\n MotionAnimationOptions,\n} from '@wix/motion';\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n 'wix-interact-element': React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLElement>,\n HTMLElement\n > & {\n 'data-wix-path'?: string;\n };\n }\n }\n}\n\nexport type TriggerType =\n | 'hover'\n | 'click'\n | 'viewEnter'\n | 'pageVisible'\n | 'animationEnd'\n | 'viewProgress'\n | 'pointerMove';\n\nexport type ViewEnterType = 'once' | 'repeat' | 'alternate';\n\nexport type TransitionMethod = 'add' | 'remove' | 'toggle' | 'clear';\n\nexport type StateParams = {\n method: TransitionMethod;\n};\n\nexport type PointerTriggerParams = {\n type?: ViewEnterType | 'state';\n};\n\nexport type ViewEnterParams = {\n type?: ViewEnterType;\n threshold?: number;\n inset?: string;\n};\n\nexport type PointerMoveParams = {\n hitArea?: 'root' | 'self';\n};\n\nexport type AnimationEndParams = {\n effectId: string;\n};\n\nexport type TriggerParams =\n | StateParams\n | PointerTriggerParams\n | ViewEnterParams\n | PointerMoveParams\n | AnimationEndParams;\n\ntype Fill = 'none' | 'forwards' | 'backwards' | 'both';\n\ntype MotionKeyframeEffect = {\n name: string;\n keyframes: Keyframe[];\n};\n\ntype EffectEffectProperty =\n | {\n keyframeEffect: MotionKeyframeEffect;\n }\n | {\n namedEffect: NamedEffect;\n }\n | {\n customEffect: (element: Element, progress: any) => void;\n };\n\nexport type TimeEffect = {\n duration: number;\n easing?: string;\n iterations?: number;\n alternate?: boolean;\n fill?: Fill;\n reversed?: boolean;\n delay?: number;\n} & EffectEffectProperty;\n\nexport type ScrubEffect = {\n easing?: string;\n iterations?: number;\n alternate?: boolean;\n fill?: Fill;\n reversed?: boolean;\n rangeStart?: RangeOffset;\n rangeEnd?: RangeOffset;\n centeredToTarget?: boolean;\n transitionDuration?: number;\n transitionDelay?: number;\n transitionEasing?: ScrubTransitionEasing;\n} & EffectEffectProperty;\n\nexport type TransitionOptions = {\n duration?: number;\n delay?: number;\n easing?: string;\n};\n\nexport type StyleProperty = {\n name: string;\n value: string;\n};\n\nexport type TransitionProperty = StyleProperty & TransitionOptions;\n\nexport type TransitionEffect = {\n key?: string;\n effectId?: string;\n} & {\n transition?: TransitionOptions & {\n styleProperties: StyleProperty[];\n };\n transitionProperties?: TransitionProperty[];\n};\n\nexport type EffectBase = {\n key?: string;\n listContainer?: string;\n listItemSelector?: string;\n conditions?: string[];\n selector?: string;\n effectId?: string;\n};\n\nexport type EffectRef = EffectBase & { effectId: string };\n\nexport type Effect = EffectBase & (TimeEffect | ScrubEffect | TransitionEffect);\n\nexport type Condition = {\n type: 'media' | 'container';\n predicate?: string;\n};\n\nexport type InteractionTrigger = {\n key: string;\n listContainer?: string;\n listItemSelector?: string;\n trigger: TriggerType;\n params?: TriggerParams;\n conditions?: string[];\n selector?: string;\n};\n\nexport type Interaction = InteractionTrigger & {\n effects: ((Effect | EffectRef) & { interactionId?: string })[];\n};\n\nexport type InteractConfig = {\n effects: Record<string, Effect>;\n conditions?: Record<string, Condition>;\n interactions: Interaction[];\n};\n\nexport type AnimationOptions<T extends 'time' | 'scrub'> =\n MotionAnimationOptions<T> & EffectEffectProperty;\n\n/// ////////////////////////////////////////////////////////\n/// ////////////////////////////////////////////////////////\n/// ////////////////////////////////////////////////////////\n\nexport interface IWixInteractElement extends HTMLElement {\n _internals: (ElementInternals & { states: Set<string> }) | null;\n connected: boolean;\n sheet: CSSStyleSheet | null;\n _observers: WeakMap<HTMLElement, MutationObserver>;\n connectedCallback(): void;\n disconnectedCallback(): void;\n connect(path?: string): void;\n disconnect(): void;\n renderStyle(cssRules: string[]): void;\n toggleEffect(\n effectId: string,\n method: StateParams['method'],\n item?: HTMLElement | null,\n ): void;\n watchChildList(listContainer: string): void;\n}\n\nexport type InteractionParamsTypes = {\n hover: StateParams | PointerTriggerParams;\n click: StateParams | PointerTriggerParams;\n viewEnter: ViewEnterParams;\n pageVisible: ViewEnterParams;\n animationEnd: AnimationEndParams;\n viewProgress: ViewEnterParams;\n pointerMove: PointerMoveParams;\n};\n\nexport type InteractionHandlerModule<T extends TriggerType> = {\n add: (\n source: HTMLElement,\n target: HTMLElement,\n effect: Effect,\n options: InteractionParamsTypes[T],\n reducedMotion?: boolean,\n ) => void;\n remove: (element: HTMLElement) => void;\n};\n\nexport type TriggerHandlerMap<T extends TriggerType> = {\n [K in T]: InteractionHandlerModule<K>;\n};\n\nexport type HandlerObject = {\n source: HTMLElement;\n target: HTMLElement;\n cleanup: () => void;\n handler?: () => void;\n};\n\nexport type HandlerObjectMap = WeakMap<HTMLElement, Set<HandlerObject>>;\n\nexport type InteractCache = {\n effects: {\n [effectId: string]: Effect;\n };\n conditions: {\n [conditionId: string]: Condition;\n };\n interactions: {\n [path: string]: {\n triggers: Interaction[];\n effects: Record<\n string,\n (InteractionTrigger & { effect: Effect | EffectRef })[]\n >;\n interactionIds: Set<string>;\n selectors: Set<string>;\n };\n };\n};\n\nexport type CreateTransitionCSSParams = {\n key: string;\n effectId: string;\n transition?: TransitionEffect['transition'];\n properties?: TransitionProperty[];\n childSelector?: string;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -13,7 +13,7 @@ export declare function getWixInteractElement(): {
|
|
|
13
13
|
disconnect(): void;
|
|
14
14
|
connect(key?: string): void;
|
|
15
15
|
renderStyle(cssRules: string[]): void;
|
|
16
|
-
toggleEffect(effectId: string, method: StateParams['method']): void;
|
|
16
|
+
toggleEffect(effectId: string, method: StateParams['method'], item?: HTMLElement | null): void;
|
|
17
17
|
getActiveEffects(): string[];
|
|
18
18
|
watchChildList(listContainer: string): void;
|
|
19
19
|
_childListChangeHandler(listContainer: string, entries: MutationRecord[]): void;
|
|
@@ -19,11 +19,15 @@ export declare class Interact {
|
|
|
19
19
|
setElement(key: string, element: IWixInteractElement): void;
|
|
20
20
|
deleteElement(key: string): void;
|
|
21
21
|
has(key: string): boolean;
|
|
22
|
+
get(key: string): InteractCache['interactions'][string] | undefined;
|
|
22
23
|
clearInteractionStateForKey(key: string): void;
|
|
23
24
|
static create(config: InteractConfig): Interact;
|
|
24
25
|
static destroy(): void;
|
|
25
26
|
static getInstance(key: string): Interact | undefined;
|
|
26
|
-
static getElement(key: string): IWixInteractElement | undefined;
|
|
27
|
+
static getElement(key: string | undefined): IWixInteractElement | undefined;
|
|
27
28
|
static setElement(key: string, element: IWixInteractElement): void;
|
|
28
29
|
}
|
|
29
|
-
export declare function getSelector(d: Interaction | Effect, asCombinator?:
|
|
30
|
+
export declare function getSelector(d: Interaction | Effect, { asCombinator, addItemFilter, }?: {
|
|
31
|
+
asCombinator?: boolean;
|
|
32
|
+
addItemFilter?: boolean;
|
|
33
|
+
}): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TimeEffect, TransitionEffect, StateParams, PointerTriggerParams } from '../types';
|
|
2
|
-
declare function addClickHandler(source: HTMLElement, target: HTMLElement, effect: TimeEffect | TransitionEffect, options?: StateParams | PointerTriggerParams, reducedMotion?: boolean): void;
|
|
1
|
+
import type { TimeEffect, TransitionEffect, StateParams, PointerTriggerParams, EffectBase } from '../types';
|
|
2
|
+
declare function addClickHandler(source: HTMLElement, target: HTMLElement, effect: (TimeEffect | TransitionEffect) & EffectBase, options?: StateParams | PointerTriggerParams, reducedMotion?: boolean): void;
|
|
3
3
|
declare function removeClickHandler(element: HTMLElement): void;
|
|
4
4
|
declare const _default: {
|
|
5
5
|
add: typeof addClickHandler;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TimeEffect, TransitionEffect, StateParams, PointerTriggerParams } from '../types';
|
|
2
|
-
declare function addHoverHandler(source: HTMLElement, target: HTMLElement, effect: TransitionEffect | TimeEffect, options?: StateParams | PointerTriggerParams, reducedMotion?: boolean): void;
|
|
1
|
+
import type { TimeEffect, TransitionEffect, StateParams, PointerTriggerParams, EffectBase } from '../types';
|
|
2
|
+
declare function addHoverHandler(source: HTMLElement, target: HTMLElement, effect: (TransitionEffect | TimeEffect) & EffectBase, options?: StateParams | PointerTriggerParams, reducedMotion?: boolean): void;
|
|
3
3
|
declare function removeHoverHandler(element: HTMLElement): void;
|
|
4
4
|
declare const _default: {
|
|
5
5
|
add: typeof addHoverHandler;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -40,10 +40,9 @@ type EffectEffectProperty = {
|
|
|
40
40
|
} | {
|
|
41
41
|
namedEffect: NamedEffect;
|
|
42
42
|
} | {
|
|
43
|
-
customEffect: (element:
|
|
43
|
+
customEffect: (element: Element, progress: any) => void;
|
|
44
44
|
};
|
|
45
45
|
export type TimeEffect = {
|
|
46
|
-
key?: string;
|
|
47
46
|
duration: number;
|
|
48
47
|
easing?: string;
|
|
49
48
|
iterations?: number;
|
|
@@ -51,10 +50,8 @@ export type TimeEffect = {
|
|
|
51
50
|
fill?: Fill;
|
|
52
51
|
reversed?: boolean;
|
|
53
52
|
delay?: number;
|
|
54
|
-
effectId?: string;
|
|
55
53
|
} & EffectEffectProperty;
|
|
56
54
|
export type ScrubEffect = {
|
|
57
|
-
key?: string;
|
|
58
55
|
easing?: string;
|
|
59
56
|
iterations?: number;
|
|
60
57
|
alternate?: boolean;
|
|
@@ -86,18 +83,18 @@ export type TransitionEffect = {
|
|
|
86
83
|
};
|
|
87
84
|
transitionProperties?: TransitionProperty[];
|
|
88
85
|
};
|
|
89
|
-
export type
|
|
86
|
+
export type EffectBase = {
|
|
90
87
|
key?: string;
|
|
91
|
-
effectId: string;
|
|
92
88
|
listContainer?: string;
|
|
89
|
+
listItemSelector?: string;
|
|
93
90
|
conditions?: string[];
|
|
94
91
|
selector?: string;
|
|
92
|
+
effectId?: string;
|
|
95
93
|
};
|
|
96
|
-
export type
|
|
97
|
-
|
|
98
|
-
conditions?: string[];
|
|
99
|
-
selector?: string;
|
|
94
|
+
export type EffectRef = EffectBase & {
|
|
95
|
+
effectId: string;
|
|
100
96
|
};
|
|
97
|
+
export type Effect = EffectBase & (TimeEffect | ScrubEffect | TransitionEffect);
|
|
101
98
|
export type Condition = {
|
|
102
99
|
type: 'media' | 'container';
|
|
103
100
|
predicate?: string;
|
|
@@ -105,6 +102,7 @@ export type Condition = {
|
|
|
105
102
|
export type InteractionTrigger = {
|
|
106
103
|
key: string;
|
|
107
104
|
listContainer?: string;
|
|
105
|
+
listItemSelector?: string;
|
|
108
106
|
trigger: TriggerType;
|
|
109
107
|
params?: TriggerParams;
|
|
110
108
|
conditions?: string[];
|
|
@@ -133,7 +131,7 @@ export interface IWixInteractElement extends HTMLElement {
|
|
|
133
131
|
connect(path?: string): void;
|
|
134
132
|
disconnect(): void;
|
|
135
133
|
renderStyle(cssRules: string[]): void;
|
|
136
|
-
toggleEffect(effectId: string, method: StateParams['method']): void;
|
|
134
|
+
toggleEffect(effectId: string, method: StateParams['method'], item?: HTMLElement | null): void;
|
|
137
135
|
watchChildList(listContainer: string): void;
|
|
138
136
|
}
|
|
139
137
|
export type InteractionParamsTypes = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/interact",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.85.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "wow!Team",
|
|
6
6
|
"email": "wow-dev@wix.com"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.26.0",
|
|
35
|
-
"@wix/motion": "1.
|
|
35
|
+
"@wix/motion": "1.644.0",
|
|
36
36
|
"fizban": "^0.7.0",
|
|
37
37
|
"kuliso": "^0.4.13"
|
|
38
38
|
},
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"wallaby": {
|
|
69
69
|
"autoDetect": true
|
|
70
70
|
},
|
|
71
|
-
"falconPackageHash": "
|
|
71
|
+
"falconPackageHash": "35f45841475e6394652519a9d4346a1b4276fa35248c8f9f59aafaf0"
|
|
72
72
|
}
|