@wix/interact 2.1.4 → 2.2.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/index.js +1 -1
- package/dist/cjs/react.js +1 -1
- package/dist/cjs/web.js +1 -1
- package/dist/cjs/web.js.map +1 -1
- package/dist/es/index.js +1 -1
- package/dist/es/react.js +2 -2
- package/dist/es/web.js +15 -15
- package/dist/es/web.js.map +1 -1
- package/dist/{index-DHqlFmW8.mjs → index-ByLXasWO.mjs} +491 -485
- package/dist/index-ByLXasWO.mjs.map +1 -0
- package/dist/index-CzRuJxn8.js +18 -0
- package/dist/index-CzRuJxn8.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/core/Interact.d.ts +2 -2
- package/dist/types/core/InteractionController.d.ts +2 -2
- package/dist/types/core/InteractionController.d.ts.map +1 -1
- package/dist/types/core/add.d.ts.map +1 -1
- package/dist/types/core/css.d.ts.map +1 -1
- package/dist/types/handlers/effectHandlers.d.ts +4 -4
- package/dist/types/handlers/effectHandlers.d.ts.map +1 -1
- package/dist/types/handlers/eventTrigger.d.ts +2 -2
- package/dist/types/handlers/eventTrigger.d.ts.map +1 -1
- package/dist/types/handlers/index.d.ts.map +1 -1
- package/dist/types/handlers/viewEnter.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/react/index.d.ts +1 -1
- package/dist/types/react/index.d.ts.map +1 -1
- package/dist/types/types/config.d.ts +47 -0
- package/dist/types/types/config.d.ts.map +1 -0
- package/dist/types/types/controller.d.ts +34 -0
- package/dist/types/types/controller.d.ts.map +1 -0
- package/dist/types/types/effects.d.ts +75 -0
- package/dist/types/types/effects.d.ts.map +1 -0
- package/dist/types/types/external.d.ts +6 -0
- package/dist/types/types/external.d.ts.map +1 -0
- package/dist/types/types/global.d.ts +11 -0
- package/dist/types/types/global.d.ts.map +1 -0
- package/dist/types/types/handlers.d.ts +41 -0
- package/dist/types/types/handlers.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +8 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/internal.d.ts +36 -0
- package/dist/types/types/internal.d.ts.map +1 -0
- package/dist/types/types/triggers.d.ts +28 -0
- package/dist/types/types/triggers.d.ts.map +1 -0
- package/dist/types/web/InteractElement.d.ts +2 -2
- package/dist/types/web/InteractElement.d.ts.map +1 -1
- package/dist/types/web/index.d.ts +1 -1
- package/dist/types/web/index.d.ts.map +1 -1
- package/docs/api/README.md +2 -3
- package/docs/api/functions.md +4 -4
- package/docs/api/interact-class.md +2 -3
- package/docs/api/interact-element.md +2 -2
- package/docs/api/interaction-controller.md +4 -4
- package/docs/api/types.md +38 -69
- package/docs/examples/README.md +1 -1
- package/docs/examples/click-interactions.md +0 -7
- package/docs/examples/entrance-animations.md +28 -27
- package/docs/examples/list-patterns.md +17 -16
- package/docs/guides/conditions-and-media-queries.md +2 -3
- package/docs/guides/configuration-structure.md +5 -7
- package/docs/guides/effects-and-animations.md +2 -4
- package/docs/guides/getting-started.md +0 -1
- package/docs/guides/lists-and-dynamic-content.md +10 -9
- package/docs/guides/sequences.md +3 -4
- package/docs/guides/state-management.md +0 -2
- package/docs/guides/understanding-triggers.md +9 -13
- package/package.json +2 -2
- package/rules/click.md +96 -560
- package/rules/full-lean.md +536 -360
- package/rules/hover.md +107 -530
- package/rules/integration.md +212 -261
- package/rules/pointermove.md +154 -1407
- package/rules/viewenter.md +128 -863
- package/rules/viewprogress.md +88 -322
- package/dist/index-DHqlFmW8.mjs.map +0 -1
- package/dist/index-DYEvpIGz.js +0 -18
- package/dist/index-DYEvpIGz.js.map +0 -1
- package/dist/types/types.d.ts +0 -256
- package/dist/types/types.d.ts.map +0 -1
- package/rules/MASTER-CLEANUP-PLAN.md +0 -286
- package/rules/scroll-list.md +0 -748
package/dist/types/types.d.ts
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import type { NamedEffect, RangeOffset, ScrubTransitionEasing, MotionAnimationOptions, AnimationGroup } from '@wix/motion';
|
|
2
|
-
export type { RangeOffset };
|
|
3
|
-
export type PointerMoveAxis = 'x' | 'y';
|
|
4
|
-
declare global {
|
|
5
|
-
namespace JSX {
|
|
6
|
-
interface IntrinsicElements {
|
|
7
|
-
'interact-element': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
|
|
8
|
-
'data-interact-key'?: string;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export type TriggerType = 'hover' | 'click' | 'viewEnter' | 'pageVisible' | 'animationEnd' | 'viewProgress' | 'pointerMove' | 'activate' | 'interest';
|
|
14
|
-
export type EventTriggerKind = 'toggle' | 'enterLeave';
|
|
15
|
-
export type EventTriggerConfigToggle = readonly string[] | string[];
|
|
16
|
-
export type EventTriggerConfigEnterLeave = {
|
|
17
|
-
enter?: readonly string[];
|
|
18
|
-
leave?: readonly string[];
|
|
19
|
-
};
|
|
20
|
-
export type EventTriggerConfig = string | EventTriggerConfigToggle | EventTriggerConfigEnterLeave;
|
|
21
|
-
export type ViewEnterType = 'once' | 'repeat' | 'alternate' | 'state';
|
|
22
|
-
export type TransitionMethod = 'add' | 'remove' | 'toggle' | 'clear';
|
|
23
|
-
export type StateParams = {
|
|
24
|
-
method: TransitionMethod;
|
|
25
|
-
};
|
|
26
|
-
export type PointerTriggerParams = {
|
|
27
|
-
type?: ViewEnterType | 'state';
|
|
28
|
-
};
|
|
29
|
-
export type EventTriggerParams = (StateParams | PointerTriggerParams) & {
|
|
30
|
-
eventConfig: EventTriggerConfig;
|
|
31
|
-
};
|
|
32
|
-
export type ViewEnterParams = {
|
|
33
|
-
type?: ViewEnterType;
|
|
34
|
-
threshold?: number;
|
|
35
|
-
inset?: string;
|
|
36
|
-
useSafeViewEnter?: boolean;
|
|
37
|
-
};
|
|
38
|
-
export type PointerMoveParams = {
|
|
39
|
-
hitArea?: 'root' | 'self';
|
|
40
|
-
axis?: PointerMoveAxis;
|
|
41
|
-
};
|
|
42
|
-
export type AnimationEndParams = {
|
|
43
|
-
effectId: string;
|
|
44
|
-
};
|
|
45
|
-
export type TriggerParams = StateParams | PointerTriggerParams | ViewEnterParams | PointerMoveParams | AnimationEndParams;
|
|
46
|
-
type Fill = 'none' | 'forwards' | 'backwards' | 'both';
|
|
47
|
-
type MotionKeyframeEffect = {
|
|
48
|
-
name: string;
|
|
49
|
-
keyframes: Keyframe[];
|
|
50
|
-
};
|
|
51
|
-
type EffectEffectProperty = {
|
|
52
|
-
keyframeEffect: MotionKeyframeEffect;
|
|
53
|
-
} | {
|
|
54
|
-
namedEffect: NamedEffect;
|
|
55
|
-
} | {
|
|
56
|
-
customEffect: (element: Element, progress: any) => void;
|
|
57
|
-
};
|
|
58
|
-
export type TimeEffect = {
|
|
59
|
-
duration: number;
|
|
60
|
-
easing?: string;
|
|
61
|
-
iterations?: number;
|
|
62
|
-
alternate?: boolean;
|
|
63
|
-
fill?: Fill;
|
|
64
|
-
reversed?: boolean;
|
|
65
|
-
delay?: number;
|
|
66
|
-
} & EffectEffectProperty;
|
|
67
|
-
export type ScrubEffect = {
|
|
68
|
-
easing?: string;
|
|
69
|
-
iterations?: number;
|
|
70
|
-
alternate?: boolean;
|
|
71
|
-
fill?: Fill;
|
|
72
|
-
reversed?: boolean;
|
|
73
|
-
rangeStart?: RangeOffset;
|
|
74
|
-
rangeEnd?: RangeOffset;
|
|
75
|
-
centeredToTarget?: boolean;
|
|
76
|
-
transitionDuration?: number;
|
|
77
|
-
transitionDelay?: number;
|
|
78
|
-
transitionEasing?: ScrubTransitionEasing;
|
|
79
|
-
} & EffectEffectProperty;
|
|
80
|
-
export type TransitionOptions = {
|
|
81
|
-
duration?: number;
|
|
82
|
-
delay?: number;
|
|
83
|
-
easing?: string;
|
|
84
|
-
};
|
|
85
|
-
export type StyleProperty = {
|
|
86
|
-
name: string;
|
|
87
|
-
value: string;
|
|
88
|
-
};
|
|
89
|
-
export type TransitionProperty = StyleProperty & TransitionOptions;
|
|
90
|
-
export type TransitionEffect = {
|
|
91
|
-
key?: string;
|
|
92
|
-
effectId?: string;
|
|
93
|
-
} & {
|
|
94
|
-
transition?: TransitionOptions & {
|
|
95
|
-
styleProperties: StyleProperty[];
|
|
96
|
-
};
|
|
97
|
-
transitionProperties?: TransitionProperty[];
|
|
98
|
-
};
|
|
99
|
-
export type EffectBase = {
|
|
100
|
-
key?: string;
|
|
101
|
-
listContainer?: string;
|
|
102
|
-
listItemSelector?: string;
|
|
103
|
-
conditions?: string[];
|
|
104
|
-
selector?: string;
|
|
105
|
-
effectId?: string;
|
|
106
|
-
};
|
|
107
|
-
export type EffectRef = EffectBase & {
|
|
108
|
-
effectId: string;
|
|
109
|
-
};
|
|
110
|
-
export type Effect = EffectBase & (TimeEffect | ScrubEffect | TransitionEffect);
|
|
111
|
-
export type Condition = {
|
|
112
|
-
type: 'media' | 'container' | 'selector';
|
|
113
|
-
predicate?: string;
|
|
114
|
-
};
|
|
115
|
-
export type SequenceOptionsConfig = {
|
|
116
|
-
delay?: number;
|
|
117
|
-
offset?: number;
|
|
118
|
-
offsetEasing?: string | ((p: number) => number);
|
|
119
|
-
sequenceId?: string;
|
|
120
|
-
conditions?: string[];
|
|
121
|
-
};
|
|
122
|
-
export type SequenceConfig = SequenceOptionsConfig & {
|
|
123
|
-
effects: (Effect | EffectRef)[];
|
|
124
|
-
};
|
|
125
|
-
export type SequenceConfigRef = {
|
|
126
|
-
sequenceId: string;
|
|
127
|
-
} & {
|
|
128
|
-
delay?: number;
|
|
129
|
-
offset?: number;
|
|
130
|
-
offsetEasing?: string | ((p: number) => number);
|
|
131
|
-
conditions?: string[];
|
|
132
|
-
};
|
|
133
|
-
export type InteractionTrigger = {
|
|
134
|
-
key: string;
|
|
135
|
-
listContainer?: string;
|
|
136
|
-
listItemSelector?: string;
|
|
137
|
-
trigger: TriggerType;
|
|
138
|
-
params?: TriggerParams;
|
|
139
|
-
conditions?: string[];
|
|
140
|
-
selector?: string;
|
|
141
|
-
};
|
|
142
|
-
export type Interaction = InteractionTrigger & {
|
|
143
|
-
effects?: ((Effect | EffectRef) & {
|
|
144
|
-
interactionId?: string;
|
|
145
|
-
})[];
|
|
146
|
-
sequences?: (SequenceConfig | SequenceConfigRef)[];
|
|
147
|
-
};
|
|
148
|
-
export type InteractConfig = {
|
|
149
|
-
effects: Record<string, Effect>;
|
|
150
|
-
sequences?: Record<string, SequenceConfig>;
|
|
151
|
-
conditions?: Record<string, Condition>;
|
|
152
|
-
interactions: Interaction[];
|
|
153
|
-
};
|
|
154
|
-
export type AnimationOptions<T extends 'time' | 'scrub'> = MotionAnimationOptions<T> & EffectEffectProperty;
|
|
155
|
-
export interface IInteractionController {
|
|
156
|
-
element: HTMLElement;
|
|
157
|
-
key: string | undefined;
|
|
158
|
-
connected: boolean;
|
|
159
|
-
sheet: CSSStyleSheet | null;
|
|
160
|
-
useFirstChild: boolean;
|
|
161
|
-
_observers: WeakMap<HTMLElement, MutationObserver>;
|
|
162
|
-
connect(key?: string): void;
|
|
163
|
-
disconnect(options?: {
|
|
164
|
-
removeFromCache?: boolean;
|
|
165
|
-
}): void;
|
|
166
|
-
update(): void;
|
|
167
|
-
toggleEffect(effectId: string, method: StateParams['method'], item?: HTMLElement | null, isLegacy?: boolean): void;
|
|
168
|
-
getActiveEffects(): string[];
|
|
169
|
-
renderStyle(cssRules: string[]): void;
|
|
170
|
-
watchChildList(listContainer: string): void;
|
|
171
|
-
_childListChangeHandler(listContainer: string, entries: MutationRecord[]): void;
|
|
172
|
-
}
|
|
173
|
-
export interface IInteractElement extends HTMLElement {
|
|
174
|
-
_internals: (ElementInternals & {
|
|
175
|
-
states: Set<string>;
|
|
176
|
-
}) | null;
|
|
177
|
-
controller: IInteractionController;
|
|
178
|
-
connectedCallback(): void;
|
|
179
|
-
disconnectedCallback(): void;
|
|
180
|
-
connect(key?: string): void;
|
|
181
|
-
disconnect(options?: {
|
|
182
|
-
removeFromCache?: boolean;
|
|
183
|
-
}): void;
|
|
184
|
-
toggleEffect(effectId: string, method: StateParams['method'], item?: HTMLElement | null): void;
|
|
185
|
-
getActiveEffects(): string[];
|
|
186
|
-
}
|
|
187
|
-
export type InteractionParamsTypes = {
|
|
188
|
-
hover: StateParams | PointerTriggerParams;
|
|
189
|
-
click: StateParams | PointerTriggerParams;
|
|
190
|
-
viewEnter: ViewEnterParams;
|
|
191
|
-
pageVisible: ViewEnterParams;
|
|
192
|
-
animationEnd: AnimationEndParams;
|
|
193
|
-
viewProgress: ViewEnterParams;
|
|
194
|
-
pointerMove: PointerMoveParams;
|
|
195
|
-
activate: StateParams | PointerTriggerParams;
|
|
196
|
-
interest: StateParams | PointerTriggerParams;
|
|
197
|
-
};
|
|
198
|
-
export type InteractOptions = {
|
|
199
|
-
reducedMotion?: boolean;
|
|
200
|
-
targetController?: IInteractionController;
|
|
201
|
-
selectorCondition?: string;
|
|
202
|
-
allowA11yTriggers?: boolean;
|
|
203
|
-
animation?: AnimationGroup;
|
|
204
|
-
};
|
|
205
|
-
export type InteractionHandlerModule<T extends TriggerType> = {
|
|
206
|
-
registerOptionsGetter?: (getter: () => any) => void;
|
|
207
|
-
add: (source: HTMLElement, target: HTMLElement, effect: Effect, options: InteractionParamsTypes[T], interactOptions: InteractOptions) => void;
|
|
208
|
-
remove: (element: HTMLElement) => void;
|
|
209
|
-
};
|
|
210
|
-
export type ViewEnterHandlerModule = InteractionHandlerModule<'viewEnter'> & {
|
|
211
|
-
setOptions: (options: Partial<ViewEnterParams>) => void;
|
|
212
|
-
};
|
|
213
|
-
export type TriggerHandlerMap<T extends TriggerType> = {
|
|
214
|
-
[K in T]: InteractionHandlerModule<K>;
|
|
215
|
-
};
|
|
216
|
-
export type HandlerObject = {
|
|
217
|
-
source: HTMLElement;
|
|
218
|
-
target: HTMLElement;
|
|
219
|
-
cleanup: () => void;
|
|
220
|
-
handler?: (isIntersecting?: boolean) => void;
|
|
221
|
-
};
|
|
222
|
-
export type HandlerObjectMap = WeakMap<HTMLElement, Set<HandlerObject>>;
|
|
223
|
-
export type InteractCache = {
|
|
224
|
-
effects: {
|
|
225
|
-
[effectId: string]: Effect;
|
|
226
|
-
};
|
|
227
|
-
sequences: {
|
|
228
|
-
[sequenceId: string]: SequenceConfig;
|
|
229
|
-
};
|
|
230
|
-
conditions: {
|
|
231
|
-
[conditionId: string]: Condition;
|
|
232
|
-
};
|
|
233
|
-
interactions: {
|
|
234
|
-
[path: string]: {
|
|
235
|
-
triggers: Interaction[];
|
|
236
|
-
effects: Record<string, (InteractionTrigger & {
|
|
237
|
-
effect: Effect | EffectRef;
|
|
238
|
-
})[]>;
|
|
239
|
-
sequences: Record<string, (InteractionTrigger & {
|
|
240
|
-
sequence: SequenceConfig;
|
|
241
|
-
})[]>;
|
|
242
|
-
interactionIds: Set<string>;
|
|
243
|
-
selectors: Set<string>;
|
|
244
|
-
};
|
|
245
|
-
};
|
|
246
|
-
};
|
|
247
|
-
export type CreateTransitionCSSParams = {
|
|
248
|
-
key: string;
|
|
249
|
-
effectId: string;
|
|
250
|
-
transition?: TransitionEffect['transition'];
|
|
251
|
-
properties?: TransitionProperty[];
|
|
252
|
-
childSelector?: string;
|
|
253
|
-
selectorCondition?: string;
|
|
254
|
-
useFirstChild?: boolean;
|
|
255
|
-
};
|
|
256
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACf,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,MAAM,MAAM,eAAe,GAAG,GAAG,GAAG,GAAG,CAAC;AAExC,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,kBAA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a,GAAG;IAC1B,OAAO,EAAE;QACP,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;KAC5B,CAAC;IACF,SAAS,EAAE;QACT,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,CAAC;KACtC,CAAC;IACF,UAAU,EAAE;QACV,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;KAClC,CAAC;IACF,YAAY,EAAE;QACZ,CAAC,IAAI,EAAE,MAAM,GAAG;YACd,QAAQ,EAAE,WAAW,EAAE,CAAC;YACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,kBAAkB,GAAG;gBAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;aAAE,CAAC,EAAE,CAAC,CAAC;YACjF,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,kBAAkB,GAAG;gBAAE,QAAQ,EAAE,cAAc,CAAA;aAAE,CAAC,EAAE,CAAC,CAAC;YACjF,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;YAC5B,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;SACxB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC5C,UAAU,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC"}
|
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
# Master Cleanup Plan: `@wix/interact` Rule Files
|
|
2
|
-
|
|
3
|
-
Synthesized from three independent audits. Filtered through current best practices for documentation consumed by LLMs.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Guiding Principles (Why This Matters)
|
|
8
|
-
|
|
9
|
-
These rules are the primary context fed to AI agents generating `@wix/interact` code. Every wasted token, every duplicated section, every drift between files directly degrades output quality. The standards we apply:
|
|
10
|
-
|
|
11
|
-
1. **Token efficiency over completeness.** LLMs have broad web animation knowledge. Rules should focus exclusively on `@wix/interact`-specific contracts, constraints, and non-obvious patterns — not general CSS or animation education.
|
|
12
|
-
2. **Single source of truth, always.** Duplicated content drifts. When it drifts, models get contradictory instructions and hedge or hallucinate.
|
|
13
|
-
3. **Each file must be usable standalone.** The MCP loads one file at a time based on topic. A model fetching `"click"` gets only `click.md` — it will not automatically also receive `full-lean.md`. Each trigger file must therefore contain all `@wix/interact`-specific constraints the model needs for that trigger, including brief inline summaries of schema concepts it depends on.
|
|
14
|
-
4. **Correctness over breadth.** A contradiction is worse than a gap. Fix all confirmed conflicts before any structural changes.
|
|
15
|
-
5. **Describe when/how, not what/why at length.** A rule like `"alternate plays forward on enter, reverses on leave"` is worth keeping. A paragraph re-explaining what `IntersectionObserver` does is not.
|
|
16
|
-
6. **Delete, don't redirect.** Generic web animation advice should be deleted entirely — not moved to a shared file or linked. The model already knows it. Cross-file links are useful for human navigation only; they are not a content delivery mechanism for the MCP.
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## Current State
|
|
21
|
-
|
|
22
|
-
- 8 files, ~8,000+ lines
|
|
23
|
-
- ~30–40% estimated duplication
|
|
24
|
-
- 5 confirmed typos/errors
|
|
25
|
-
- 2 confirmed correctness contradictions
|
|
26
|
-
- 1 confirmed schema inconsistency between files (`listItemSelector` vs `selector`)
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## Phase 1 — Fix Correctness Issues (do first, no structural work yet)
|
|
31
|
-
|
|
32
|
-
These are the highest-risk problems. A model following a contradictory rule produces wrong code.
|
|
33
|
-
|
|
34
|
-
### 1.1 Resolve `keyframeEffect` + `pointerMove` conflict
|
|
35
|
-
|
|
36
|
-
**Conflict:**
|
|
37
|
-
|
|
38
|
-
- `full-lean.md` lines 366 and 403: "do NOT use `keyframeEffect` with `pointerMove` because pointer progress is two-dimensional"
|
|
39
|
-
- `full-lean.md` line 173: documents `axis?: 'x' | 'y'` param that collapses 2D progress to one axis for keyframes
|
|
40
|
-
- `pointermove.md`: Rules 10–11 document `keyframeEffect` + `axis` as a valid first-class pattern
|
|
41
|
-
|
|
42
|
-
**Resolution:** `full-lean.md` lines 366 and 403 are incomplete. The `axis` parameter exists precisely to make single-axis `keyframeEffect` valid. Update both lines to:
|
|
43
|
-
|
|
44
|
-
> Avoid `keyframeEffect` with `pointerMove` unless using `params: { axis: 'x' | 'y' }` to map a single pointer axis to linear 0–1 progress.
|
|
45
|
-
|
|
46
|
-
### 1.2 Resolve `listItemSelector` vs `selector` inconsistency
|
|
47
|
-
|
|
48
|
-
**Conflict:**
|
|
49
|
-
|
|
50
|
-
- `full-lean.md` uses `listItemSelector` as the field name
|
|
51
|
-
- `integration.md` uses `selector` for the same concept
|
|
52
|
-
|
|
53
|
-
**Resolution:** Check the TypeScript type definition. Standardize both files to the correct field name. One of these is currently giving models the wrong API.
|
|
54
|
-
|
|
55
|
-
### 1.3 Align FOUC constraints
|
|
56
|
-
|
|
57
|
-
**Conflict:**
|
|
58
|
-
|
|
59
|
-
- `full-lean.md` correctly restricts `data-interact-initial="true"` to: `viewEnter` trigger + `type: 'once'` + source element = target element
|
|
60
|
-
- `integration.md` gives the same code example but omits the constraints
|
|
61
|
-
|
|
62
|
-
**Resolution:** Add the full constraints explicitly to `integration.md`'s FOUC section.
|
|
63
|
-
|
|
64
|
-
### 1.4 Fix `pointermove.md` undefined reference
|
|
65
|
-
|
|
66
|
-
`pointermove.md` has an example referencing `indicator-effect` which is not defined in the config shown. Fix the example to be self-contained.
|
|
67
|
-
|
|
68
|
-
### 1.5 Fix all confirmed typos
|
|
69
|
-
|
|
70
|
-
| File | Line | Fix |
|
|
71
|
-
| ----------------- | ---- | ------------------------------------------------- |
|
|
72
|
-
| `viewenter.md` | 946 | `Guildelines` → `Guidelines` |
|
|
73
|
-
| `viewenter.md` | 980 | `HUge` → `Huge` |
|
|
74
|
-
| `viewprogress.md` | 43 | `effec` → `effect` |
|
|
75
|
-
| `hover.md` | 515 | `same ass` → `same as` |
|
|
76
|
-
| `integration.md` | 195 | `(Pre-built effect library)>` → remove stray `>` |
|
|
77
|
-
| `scroll-list.md` | 272 | `selector: ' .hero-image'` → remove leading space |
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
## Phase 2 — Establish Single Source of Truth (via deletion, not links)
|
|
82
|
-
|
|
83
|
-
### 2.1 Define canonical ownership
|
|
84
|
-
|
|
85
|
-
Because the MCP loads one file at a time, the "canonical" column means "most complete definition lives here." The "inline mention needed" column means trigger docs that depend on this concept must include a brief self-contained summary — not a link, not a full re-explanation.
|
|
86
|
-
|
|
87
|
-
| Content | Canonical file | Action in other files | Inline mention needed in |
|
|
88
|
-
| ----------------------------------------------------------------------- | ---------------------------------- | ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
89
|
-
| Full type/schema spec (`InteractConfig`, triggers, effects, conditions) | `full-lean.md` | Delete duplicated schema prose from `integration.md` | All trigger docs: keep brief summaries of params they use |
|
|
90
|
-
| Developer setup (install, web, react, CDN, `Interact.create`) | `integration.md` | — | — |
|
|
91
|
-
| FOUC / `generate(config)` | `full-lean.md` + `viewenter.md` | Delete full code block from `integration.md` only | `viewenter.md`: full working example with constraints — it is the most likely file fetched for entrance animations and must be self-contained |
|
|
92
|
-
| `StateParams.method` (`add`/`remove`/`toggle`/`clear`) | `full-lean.md` | — | `click.md`: inline comment on TransitionEffect rule only (`hover.md` has no TransitionEffect rule so no mention needed there) |
|
|
93
|
-
| Target cascade resolution | `full-lean.md` | — | Any trigger doc showing cross-targeting examples |
|
|
94
|
-
| `Progress` type for `customEffect` with `pointerMove` | `pointermove.md` | Delete duplicate definition from `full-lean.md` | — |
|
|
95
|
-
| `fill: 'both'` for `viewProgress` | `full-lean.md` | — | `viewprogress.md`: keep inline (model fetching viewprogress won't have full-lean) |
|
|
96
|
-
| `registerEffects` | currently only in `integration.md` | Add to `full-lean.md` | — |
|
|
97
|
-
| Generic perf/UX/a11y advice | nowhere — delete entirely | Remove from all trigger docs | — |
|
|
98
|
-
|
|
99
|
-
### 2.2 Reduce `integration.md`
|
|
100
|
-
|
|
101
|
-
`integration.md` is a developer-facing onboarding guide — not a schema reference. Effect type syntax belongs in `full-lean.md`; the 3 end-to-end examples at the bottom of `integration.md` already demonstrate effect types in context, which is more useful for onboarding than standalone snippets.
|
|
102
|
-
|
|
103
|
-
- **Keep:** install steps, web/react setup snippets, `Interact.create` usage, HTML/JSX element wrappers, `registerEffects` setup, trigger overview table, 3 working examples (hover, viewEnter, click), FOUC rules
|
|
104
|
-
- **Delete:** full effect type taxonomy (`keyframeEffect`, `TransitionEffect`, scroll/mouse effect snippets) — covered by `full-lean.md` and shown contextually in the examples
|
|
105
|
-
|
|
106
|
-
### 2.3 Strip generic best-practices content from all trigger docs
|
|
107
|
-
|
|
108
|
-
Do **not** create a shared `best-practices.md`. Instead, apply this filter to every trigger doc's Best Practices section:
|
|
109
|
-
|
|
110
|
-
**Delete (model already knows this):**
|
|
111
|
-
|
|
112
|
-
- "Use `transform`, `opacity`, `filter` for hardware acceleration"
|
|
113
|
-
- "Avoid animating layout properties"
|
|
114
|
-
- "`will-change` for complex animations"
|
|
115
|
-
- "Keep animations subtle"
|
|
116
|
-
- "Ensure content remains readable"
|
|
117
|
-
- "Progressive enhancement"
|
|
118
|
-
- Generic "Respect `prefers-reduced-motion`" without `@wix/interact`-specific guidance
|
|
119
|
-
|
|
120
|
-
**Keep (interact-specific, non-obvious):**
|
|
121
|
-
|
|
122
|
-
- `@wix/interact` conditions API for `prefers-reduced-motion`: how to wire it via `conditions` field. **Clarification:** condition IDs are user-defined strings — examples must always show the full `conditions` config map (with `type` and `predicate`) alongside the interaction that references them, not just the ID strings in isolation
|
|
123
|
-
- Trigger-specific timing constraints (e.g. click: 100–500ms, hover: 100–400ms)
|
|
124
|
-
- Trigger-specific gotchas (e.g. viewEnter: don't animate source and target as the same element with `repeat` type)
|
|
125
|
-
- `pointermove`: cache DOM queries outside `customEffect` callbacks
|
|
126
|
-
- `viewprogress`: stacking contexts freeze ViewTimeline — this belongs in `full-lean.md` general guidelines (already there) and should be removed from `viewprogress.md` best practices
|
|
127
|
-
|
|
128
|
-
**Estimated line savings: ~250 lines across trigger docs.**
|
|
129
|
-
|
|
130
|
-
---
|
|
131
|
-
|
|
132
|
-
## Phase 3 — Restructure `viewprogress.md`
|
|
133
|
-
|
|
134
|
-
This is the single largest structural problem. 9 rules are a 3×3 matrix with near-identical patterns:
|
|
135
|
-
|
|
136
|
-
| | `namedEffect` | `keyframeEffect` | `customEffect` |
|
|
137
|
-
| ------------------- | ------------- | ---------------- | -------------- |
|
|
138
|
-
| Parallax/Continuous | Rule 1 | Rule 4 | Rule 7 |
|
|
139
|
-
| Entry | Rule 2 | Rule 5 | Rule 8 |
|
|
140
|
-
| Exit | Rule 3 | Rule 6 | Rule 9 |
|
|
141
|
-
|
|
142
|
-
Every rule repeats the same config skeleton. Variable lists from Rule 5 onward explicitly say "Other variables same as Rule 1" — a direct admission of duplication.
|
|
143
|
-
|
|
144
|
-
**Why tables outperform the 9-rule format for LLM consumption:**
|
|
145
|
-
|
|
146
|
-
The 9-rule matrix looks comprehensive to humans but is inefficient for models. Once a model has seen the config pattern once, repeating it 8 more times with minor substitutions adds no information — it just consumes context tokens. The replacement structure (1 template + 2 lookup tables + 4 examples) performs better because:
|
|
147
|
-
|
|
148
|
-
- **Decision tables are scannable.** A model resolving "I need an entry animation" can map scenario → effect type → range names in one pass through the table, rather than pattern-matching a natural-language rule description to its task.
|
|
149
|
-
- **Fewer examples, correctly chosen, generalize better.** 4 curated examples (one per effect type + one non-obvious multi-range pattern) teach the model to compose, rather than encouraging copy-paste from the closest-matching rule.
|
|
150
|
-
- **Token efficiency directly affects output quality.** Fewer tokens spent on redundant patterns means more context budget for the actual user task.
|
|
151
|
-
|
|
152
|
-
The trade-off: the old format had a safer floor for weaker models that benefit from rote examples. The new format has a higher ceiling for capable models (Claude, GPT-4, Gemini) that generalize well from clean, structured docs — which is the target audience for this library.
|
|
153
|
-
|
|
154
|
-
### Target structure for `viewprogress.md`
|
|
155
|
-
|
|
156
|
-
**Section 1: Core Concept** (~5 lines)
|
|
157
|
-
One sentence on what `viewProgress` does (scroll-driven via `ViewTimeline`). No animation education.
|
|
158
|
-
|
|
159
|
-
**Section 2: Config Template** (1 canonical pattern block)
|
|
160
|
-
Single pattern showing all `viewProgress`-relevant fields with placeholders.
|
|
161
|
-
|
|
162
|
-
**Section 3: Effect Type Selection** (table)
|
|
163
|
-
|
|
164
|
-
| Scenario | Effect type | Notes |
|
|
165
|
-
| -------------------------- | ---------------- | -------------------------------- | ----- | -------------------- |
|
|
166
|
-
| Use a scroll preset | `namedEffect` | Preferred; requires `range: 'in' | 'out' | 'continuous'` option |
|
|
167
|
-
| Custom CSS animation | `keyframeEffect` | Full keyframe control |
|
|
168
|
-
| DOM/canvas/dynamic content | `customEffect` | Last resort; keep callback lean |
|
|
169
|
-
|
|
170
|
-
**Section 4: Range Reference** (table)
|
|
171
|
-
|
|
172
|
-
| Intent | `rangeStart.name` | `rangeEnd.name` | Typical offsets |
|
|
173
|
-
| ------------------------- | ----------------- | --------------- | --------------- |
|
|
174
|
-
| Element entering viewport | `entry` | `entry` | 0–60% |
|
|
175
|
-
| Element exiting viewport | `exit` | `exit` | 0–60% |
|
|
176
|
-
| Full element traversal | `cover` | `cover` | 0–100% |
|
|
177
|
-
| While fully in viewport | `contain` | `contain` | 0–100% |
|
|
178
|
-
|
|
179
|
-
Include the offset semantics note (positive = forward along scroll axis) — once, here only.
|
|
180
|
-
|
|
181
|
-
**Section 5: Named Scroll Effects Reference** (condensed list)
|
|
182
|
-
The scroll preset names currently buried in Rule 1 variables — one list, not repeated across rules.
|
|
183
|
-
|
|
184
|
-
**Section 2 note: Config Template placeholders**
|
|
185
|
-
Do not include a `direction` placeholder. `direction` is a preset-specific option (not a standard field), its valid values differ per preset, and listing generic values would be incomplete and misleading. The template uses `[NAMED_EFFECT]` with a note: only use preset-specific options you have documentation for; omit and rely on defaults otherwise.
|
|
186
|
-
|
|
187
|
-
**Section 6: Examples** (4 total)
|
|
188
|
-
|
|
189
|
-
- `namedEffect` parallax
|
|
190
|
-
- `keyframeEffect` custom entrance
|
|
191
|
-
- `customEffect` scroll counter
|
|
192
|
-
- **Multi-range (entry + exit on the same element)** — non-obvious pattern requiring two effects with the same `key` but different range scopes. Without a dedicated example, models can infer it from the tables but may get the fill/easing direction wrong. The cost (~40 lines) is worth the reliability gain.
|
|
193
|
-
|
|
194
|
-
**Section 7: Advanced Patterns** — keep existing section as-is (genuinely unique content)
|
|
195
|
-
|
|
196
|
-
**Section 8: Best Practices** — interact-specific delta only (per Phase 2.3 filter above)
|
|
197
|
-
|
|
198
|
-
**Estimated line savings: ~~600 lines (~~55% reduction of the file).**
|
|
199
|
-
|
|
200
|
-
---
|
|
201
|
-
|
|
202
|
-
## Phase 4 — Reduce `scroll-list.md`
|
|
203
|
-
|
|
204
|
-
This file's genuine value is its list-specific patterns. Everything else repeats `viewprogress.md`.
|
|
205
|
-
|
|
206
|
-
### Keep (unique to lists)
|
|
207
|
-
|
|
208
|
-
- Sticky container/item/content hierarchy explanation
|
|
209
|
-
- `listContainer` + `listItemSelector` (or `selector`) setup and rules
|
|
210
|
-
- Why `contain` range fits sticky container animations specifically
|
|
211
|
-
- Stagger pattern using shared `effectId` in the effects registry
|
|
212
|
-
- `customEffect` pattern for per-item dynamic content
|
|
213
|
-
- Responsive list animations section with a full `conditions` config map example (same pattern as other trigger docs — condition IDs are user-defined, must always be shown alongside their `type`/`predicate` definition)
|
|
214
|
-
|
|
215
|
-
### Delete (generic, already in `viewprogress.md` or model already knows it)
|
|
216
|
-
|
|
217
|
-
- Range name semantics — already in `viewprogress.md` after Phase 3
|
|
218
|
-
- Effect type taxonomy — already in `viewprogress.md` after Phase 3
|
|
219
|
-
- Generic `fill: 'both'` explanation
|
|
220
|
-
- Generic performance/UX/a11y best practices (per Phase 2.3 filter)
|
|
221
|
-
|
|
222
|
-
**Estimated line savings: ~200 lines.**
|
|
223
|
-
|
|
224
|
-
---
|
|
225
|
-
|
|
226
|
-
## Phase 5 — Trigger Doc Standardization
|
|
227
|
-
|
|
228
|
-
Minor but important for model consistency. Models that see consistent structure learn to pattern-match faster across files.
|
|
229
|
-
|
|
230
|
-
### Issues to fix
|
|
231
|
-
|
|
232
|
-
- `hover.md` title: "Hover Trigger Rules" — missing `for @wix/interact` (all others have it)
|
|
233
|
-
- `hover.md` has no Accessibility section (the only trigger doc missing it entirely) — add the interact-specific `conditions`-based reduced motion guidance
|
|
234
|
-
- Variable placeholder naming is inconsistent: `[SOURCE_KEY]` (viewprogress, pointermove) vs `[SOURCE_IDENTIFIER]` (click, hover) for the same concept
|
|
235
|
-
- `hover.md` Rules 2 and 3 overlap heavily (both are `alternate` pattern, one with `namedEffect`, one with `keyframeEffect`) — collapse into one rule with two examples
|
|
236
|
-
- `click.md` shows only `method: 'toggle'` for `TransitionEffect` — add brief mention that `add`, `remove`, `clear` also exist (already defined in `full-lean.md`, but models reading only the trigger doc will miss it)
|
|
237
|
-
- `hover.md` does **not** get a `method` mention — `hover.md` has no `TransitionEffect` rule, so adding a method summary there would be orphaned with no anchor
|
|
238
|
-
|
|
239
|
-
### Fixes
|
|
240
|
-
|
|
241
|
-
- Standardize title format: `# [Trigger] Trigger Rules for @wix/interact`
|
|
242
|
-
- Add Accessibility section to `hover.md` (interact-specific content only)
|
|
243
|
-
- Standardize placeholder names across all trigger docs: use `[SOURCE_KEY]` / `[TARGET_KEY]` everywhere
|
|
244
|
-
- Collapse `hover.md` Rules 2+3 into one rule with two examples
|
|
245
|
-
- Add one-line mention of `add`/`remove`/`clear` methods to `click.md` TransitionEffect rule
|
|
246
|
-
- Remove trailing "These rules provide comprehensive coverage..." footers from `click.md`, `viewenter.md`, `viewprogress.md`, `pointermove.md`
|
|
247
|
-
|
|
248
|
-
---
|
|
249
|
-
|
|
250
|
-
## Final File Structure
|
|
251
|
-
|
|
252
|
-
```
|
|
253
|
-
packages/interact/rules/
|
|
254
|
-
├── full-lean.md ← canonical spec: schema, types, all trigger params, effect rules, general gotchas
|
|
255
|
-
│ changes: fix keyframeEffect+axis note, add registerEffects, remove duplicate Progress type
|
|
256
|
-
├── integration.md ← onboarding only: setup, 3 working examples, trigger overview table
|
|
257
|
-
│ changes: reduce from ~370 → ~150 lines by deleting schema/effect prose
|
|
258
|
-
├── click.md ← trigger patterns + examples + interact-specific best practices
|
|
259
|
-
├── hover.md ← trigger patterns + examples; add a11y section; collapse rules 2+3
|
|
260
|
-
├── viewenter.md ← trigger patterns + examples; full FOUC example with constraints
|
|
261
|
-
├── viewprogress.md ← 1 template + 2 tables + 4 examples + advanced patterns
|
|
262
|
-
│ changes: remove 9-rule matrix (~600 lines); no direction placeholder in template
|
|
263
|
-
├── scroll-list.md ← list-specific only (sticky hierarchy, stagger, list context)
|
|
264
|
-
│ changes: delete generic scroll/range/effect content (~200 lines)
|
|
265
|
-
└── pointermove.md ← keep Core Concepts (genuine unique value); trim best practices
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
---
|
|
269
|
-
|
|
270
|
-
## Execution Order
|
|
271
|
-
|
|
272
|
-
| # | Action | Files affected | Est. lines removed | Risk |
|
|
273
|
-
| --- | ------------------------------------------------------------------------------------------------------------- | -------------------------------- | ------------------ | ------------------ |
|
|
274
|
-
| 1 | Fix correctness: `keyframeEffect`/`pointerMove` conflict | `full-lean.md` | — | High if skipped |
|
|
275
|
-
| 2 | Fix correctness: `listItemSelector` vs `selector` | `full-lean.md`, `integration.md` | — | High if skipped |
|
|
276
|
-
| 3 | Fix correctness: FOUC constraints alignment | `integration.md` | — | High if skipped |
|
|
277
|
-
| 4 | Fix 6 typos + undefined `pointermove.md` reference | all | — | Low effort, do now |
|
|
278
|
-
| 5 | Delete generic best-practices content from all trigger docs | all trigger docs | ~250 | Low |
|
|
279
|
-
| 6 | Refactor `viewprogress.md`: 1 template + 2 tables + 4 examples (added multi-range) | `viewprogress.md` | ~600 | Medium |
|
|
280
|
-
| 7 | Reduce `scroll-list.md`: delete generic scroll/range/effect content | `scroll-list.md` | ~200 | Low |
|
|
281
|
-
| 8 | Reduce `integration.md`: delete schema/effect prose | `integration.md` | ~150 | Low |
|
|
282
|
-
| 9 | Add `registerEffects` to `full-lean.md`; remove duplicate `Progress` type | `full-lean.md` | — | Low |
|
|
283
|
-
| 10 | Standardize titles, placeholders, collapse `hover.md` rules 2+3, add missing `method` mention, remove footers | all | ~50 | Very low |
|
|
284
|
-
|
|
285
|
-
**Estimated total reduction: ~~1,250 lines (~~15% of corpus), with zero loss of `@wix/interact`-specific information.**
|
|
286
|
-
The remaining content will be denser, more accurate, and cheaper for models to consume.
|