@wix/interact 2.6.0 → 2.8.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.
Files changed (64) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/react.js +1 -1
  3. package/dist/cjs/web.js +1 -1
  4. package/dist/es/index.js +1 -1
  5. package/dist/es/react.js +2 -2
  6. package/dist/es/web.js +2 -2
  7. package/dist/{index-BcRbaJX2.mjs → index-CHEx5VT7.mjs} +1643 -1411
  8. package/dist/index-CHEx5VT7.mjs.map +1 -0
  9. package/dist/index-DDOkQ8gk.js +29 -0
  10. package/dist/index-DDOkQ8gk.js.map +1 -0
  11. package/dist/tsconfig.build.tsbuildinfo +1 -1
  12. package/dist/types/core/Interact.d.ts +28 -16
  13. package/dist/types/core/Interact.d.ts.map +1 -1
  14. package/dist/types/core/InteractionController.d.ts +1 -0
  15. package/dist/types/core/InteractionController.d.ts.map +1 -1
  16. package/dist/types/core/add.d.ts.map +1 -1
  17. package/dist/types/core/css.d.ts +1 -1
  18. package/dist/types/core/css.d.ts.map +1 -1
  19. package/dist/types/core/reducedMotion.d.ts +21 -0
  20. package/dist/types/core/reducedMotion.d.ts.map +1 -0
  21. package/dist/types/core/resolvers.d.ts +3 -3
  22. package/dist/types/core/resolvers.d.ts.map +1 -1
  23. package/dist/types/handlers/animationEnd.d.ts +1 -1
  24. package/dist/types/handlers/animationEnd.d.ts.map +1 -1
  25. package/dist/types/handlers/effectHandlers.d.ts +1 -1
  26. package/dist/types/handlers/effectHandlers.d.ts.map +1 -1
  27. package/dist/types/handlers/eventTrigger.d.ts +1 -1
  28. package/dist/types/handlers/eventTrigger.d.ts.map +1 -1
  29. package/dist/types/handlers/pointerMove.d.ts +1 -1
  30. package/dist/types/handlers/pointerMove.d.ts.map +1 -1
  31. package/dist/types/handlers/viewEnter.d.ts +1 -1
  32. package/dist/types/handlers/viewEnter.d.ts.map +1 -1
  33. package/dist/types/handlers/viewProgress.d.ts +1 -1
  34. package/dist/types/handlers/viewProgress.d.ts.map +1 -1
  35. package/dist/types/types/config.d.ts +6 -1
  36. package/dist/types/types/config.d.ts.map +1 -1
  37. package/dist/types/types/controller.d.ts +5 -0
  38. package/dist/types/types/controller.d.ts.map +1 -1
  39. package/dist/types/types/css.d.ts +26 -0
  40. package/dist/types/types/css.d.ts.map +1 -1
  41. package/dist/types/types/effects.d.ts +2 -0
  42. package/dist/types/types/effects.d.ts.map +1 -1
  43. package/dist/types/types/external.d.ts +1 -1
  44. package/dist/types/types/external.d.ts.map +1 -1
  45. package/dist/types/types/handlers.d.ts +0 -1
  46. package/dist/types/types/handlers.d.ts.map +1 -1
  47. package/dist/types/types/internal.d.ts +3 -1
  48. package/dist/types/types/internal.d.ts.map +1 -1
  49. package/dist/types/types/plugins.d.ts +10 -0
  50. package/dist/types/types/plugins.d.ts.map +1 -1
  51. package/dist/types/utils.d.ts +1 -0
  52. package/dist/types/utils.d.ts.map +1 -1
  53. package/docs/api/interact-class.md +44 -4
  54. package/docs/api/types.md +33 -3
  55. package/docs/guides/conditions-and-media-queries.md +53 -0
  56. package/docs/guides/plugins.md +36 -1
  57. package/package.json +1 -1
  58. package/rules/full-lean.md +33 -4
  59. package/rules/integration.md +2 -2
  60. package/rules/plugins.md +19 -1
  61. package/rules/validate.md +47 -38
  62. package/dist/index-BcRbaJX2.mjs.map +0 -1
  63. package/dist/index-sqvrGHLA.js +0 -29
  64. package/dist/index-sqvrGHLA.js.map +0 -1
@@ -1,4 +1,6 @@
1
+ import type { MotionKeyframeEffect, NamedEffect } from '@wix/motion';
1
2
  import type { InteractPluginStyles } from './plugins';
3
+ import type { EffectBase, ReducedMotionPolicy, StateEffect, TimeAnimationTriggerType } from './effects';
2
4
  /**
3
5
  * Options bag for `generate()`. Passed as its single optional 2nd argument, which also accepts a
4
6
  * bare boolean for the legacy `useFirstChild` signature.
@@ -18,6 +20,16 @@ export type GenerateOptions = {
18
20
  * and each config's `Interact.create()` must get the same index, since unnamed effects' ids are suffixed too.
19
21
  */
20
22
  configIndex?: number;
23
+ /**
24
+ * Generates only the reduced-motion outcome of every effect, unconditionally. Must equal the instance's
25
+ * `forceReducedMotion` at runtime. Defaults to `Interact.forceReducedMotion` (see `Interact.setup()`).
26
+ */
27
+ forceReducedMotion?: boolean;
28
+ /**
29
+ * The policy of effects that don't set one along their interaction, sequence or effect. Must equal the
30
+ * instance's `reducedMotionPolicy` at runtime. Defaults to `Interact.reducedMotionPolicy`.
31
+ */
32
+ reducedMotionPolicy?: ReducedMotionPolicy;
21
33
  };
22
34
  export type ListPropertyName = 'animation' | 'transition' | 'animation-composition' | 'animation-timeline' | 'animation-range' | 'view-timeline';
23
35
  export type CSSRuleData = {
@@ -33,4 +45,18 @@ export type CSSRuleData = {
33
45
  selectorCondition?: string;
34
46
  selectorSuffix?: string;
35
47
  };
48
+ export type FullEffect = EffectBase & StateEffect & {
49
+ triggerType?: TimeAnimationTriggerType;
50
+ namedEffect?: NamedEffect;
51
+ customEffect?: (element: Element, progress: any) => void;
52
+ keyframeEffect?: MotionKeyframeEffect;
53
+ };
54
+ export type ResolveOptions = {
55
+ defaultPolicy?: ReducedMotionPolicy;
56
+ force?: boolean;
57
+ };
58
+ export type ResolveEffectOptions = ResolveOptions & {
59
+ policy?: ReducedMotionPolicy;
60
+ collapsesStagger?: boolean;
61
+ };
36
62
  //# sourceMappingURL=css.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../../src/types/css.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,iEAAiE;IACjE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM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pB,MAAM,MAAM,WAAW,GAAG;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAGF,MAAM,MAAM,UAAU,GAAG,UAAU,GACjC,WAAW,GAAG;IACZ,WAAW,CAAC,EAAE,wBAAwB,CAAC;IACvC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,IAAI,CAAC;IACzD,cAAc,CAAC,EAAE,oBAAoB,CAAC;CACvC,CAAC;AAEJ,MAAM,MAAM,cAAc,GAAG;IAE3B,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,cAAc,GAAG;IAElD,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC"}
@@ -7,6 +7,7 @@ type MotionKeyframeEffect = {
7
7
  };
8
8
  export type TimeAnimationTriggerType = 'once' | 'repeat' | 'alternate' | 'state';
9
9
  export type StateAction = 'add' | 'remove' | 'toggle' | 'clear';
10
+ export type ReducedMotionPolicy = 'ignore' | 'cancel' | 'collapse' | (string & {});
10
11
  type EffectEffectProperty = {
11
12
  keyframeEffect: MotionKeyframeEffect;
12
13
  } | {
@@ -65,6 +66,7 @@ export type EffectBase = {
65
66
  conditions?: string[];
66
67
  selector?: string;
67
68
  effectId?: string;
69
+ reducedMotionPolicy?: ReducedMotionPolicy;
68
70
  } & PluginFields;
69
71
  export type EffectRef = EffectBase & {
70
72
  effectId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"effects.d.ts","sourceRoot":"","sources":["../../../src/types/effects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,KAAK,IAAI,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,MAAM,CAAC;AAEvD,KAAK,oBAAoB,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,OAAO,CAAC;AAEjF,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEhE,KAAK,oBAAoB,GACrB;IACE,cAAc,EAAE,oBAAoB,CAAC;CACtC,GACD;IACE,WAAW,EAAE,WAAW,CAAC;CAC1B,GACD;IACE,YAAY,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,IAAI,CAAC;CACzD,CAAC;AAEN,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,wBAAwB,CAAC;IAC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from './controller';
5
5
  export type { GenerateOptions } from './css';
6
6
  export type { InteractOptions } from './handlers';
7
- export type { InteractPlugin, InteractPluginContext, InteractPluginCleanup, InteractPluginConfigMap, InteractPluginStyleContext, InteractPluginStyleGenerator, InteractPluginStyles, PluginFields, } from './plugins';
7
+ export type { InteractPlugin, InteractPluginContext, InteractPluginCleanup, InteractPluginOptions, InteractPluginConfigMap, InteractPluginStyleContext, InteractPluginStyleGenerator, InteractPluginStyles, PluginFields, } from './plugins';
8
8
  //# sourceMappingURL=external.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../../src/types/external.ts"],"names":[],"mappings":"AACA,YAAY,EACV,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,WAAW,GACZ,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,wBAAwB,EACxB,WAAW,EACX,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,MAAM,GACP,MAAM,WAAW,CAAC;AAGnB,YAAY,EACV,SAAS,EACT,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,cAAc,GACf,MAAM,UAAU,CAAC;AAGlB,YAAY,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAG7E,YAAY,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAG7C,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,4BAA4B,EAC5B,oBAAoB,EACpB,YAAY,GACb,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../../src/types/external.ts"],"names":[],"mappings":"AACA,YAAY,EACV,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,WAAW,GACZ,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,wBAAwB,EACxB,WAAW,EACX,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,MAAM,GACP,MAAM,WAAW,CAAC;AAGnB,YAAY,EACV,SAAS,EACT,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,cAAc,GACf,MAAM,UAAU,CAAC;AAGlB,YAAY,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAG7E,YAAY,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAG7C,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,4BAA4B,EAC5B,oBAAoB,EACpB,YAAY,GACb,MAAM,WAAW,CAAC"}
@@ -13,7 +13,6 @@ export type InteractionParamsTypes = {
13
13
  interest: Record<string, never>;
14
14
  };
15
15
  export type InteractOptions = {
16
- reducedMotion?: boolean;
17
16
  targetController?: IInteractionController;
18
17
  selectorCondition?: string;
19
18
  allowA11yTriggers?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/types/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MA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O,CAAC,WAAW,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Effect, EffectRef, StateEffect, TransitionProperty } from './effects';
1
+ import type { Effect, EffectRef, ReducedMotionPolicy, StateEffect, TransitionProperty } from './effects';
2
2
  import type { Condition, SequenceConfig, Interaction, InteractionTrigger } from './config';
3
3
  export type InteractCache = {
4
4
  effects: {
@@ -10,6 +10,8 @@ export type InteractCache = {
10
10
  conditions: {
11
11
  [conditionId: string]: Condition;
12
12
  };
13
+ reducedMotionPolicy?: ReducedMotionPolicy;
14
+ forceReducedMotion?: boolean;
13
15
  interactions: {
14
16
  [path: string]: {
15
17
  triggers: Interaction[];
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/types/internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACpF,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE3F,MAAM,MAAM,aAAa,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,MAA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AW,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,WAAW,CAAC,YAAY,CAAC,CAAC;IACvC,oBAAoB,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC"}
@@ -31,6 +31,16 @@ export type InteractPluginCleanup = () => void;
31
31
  * context, and may return a cleanup function. Interact is agnostic to the shape of `value`.
32
32
  */
33
33
  export type InteractPlugin = (value: unknown, context: InteractPluginContext) => void | InteractPluginCleanup;
34
+ /** Registration options passed as the third argument of `Interact.use()`. */
35
+ export type InteractPluginOptions = {
36
+ /**
37
+ * Name(s) this plugin is deferred until, released with `Interact.ready(name, key?)`. While
38
+ * deferred, the plugin does not run, and neither does the interaction, effect, or sequence that
39
+ * carries its `$`-prefixed field (they may resolve against the DOM the plugin creates). A plugin
40
+ * with several names stays deferred until all of them are released.
41
+ */
42
+ defer?: string | string[];
43
+ };
34
44
  /**
35
45
  * Context passed to a plugin's SSR style generator (see {@link InteractPluginStyleGenerator}).
36
46
  * Unlike {@link InteractPluginContext}, there is no live DOM — only the selector that scopes to
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/types/plugins.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC,MAAM,MAAM,qBAAqB,GAAG;IAClC,oEAAoE;IACpE,IAAI,EAAE,WAAW,CAAC;IAClB,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAC;IACZ,yEAAyE;IACzE,KAAK,EAAE,aAAa,GAAG,QAAQ,CAAC;IAChC,kFAAkF;IAClF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC,CAAC;AAEF,kGAAkG;AAClG,MAAM,MAAM,qBAAqB,GAAG,MAAM,IAAI,CAAC;AAE/C;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAC3B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,qBAAqB,KAC3B,IAAI,GAAG,qBAAqB,CAAC;AAElC;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,4EAA4E;IAC5E,GAAG,EAAE,MAAM,CAAC;IACZ,+EAA+E;IAC/E,KAAK,EAAE,aAAa,GAAG,QAAQ,CAAC;IAChC,kFAAkF;IAClF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B,GAAG,CACzC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,0BAA0B,KAChC,IAAI,CAAC,WAAW,EAAE,cAAc,GAAG,gBAAgB,CAAC,EAAE,CAAC;AAE5D,2FAA2F;AAC3F,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;AAEhF;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,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MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B,GAAG,CACzC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,0BAA0B,KAChC,IAAI,CAAC,WAAW,EAAE,cAAc,GAAG,gBAAgB,CAAC,EAAE,CAAC;AAE5D,2FAA2F;AAC3F,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;AAEhF;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,uBAAuB;CAAG;AAE3C;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;KACxB,CAAC,IAAI,MAAM,uBAAuB,IAAI,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,CAAC,EAAE,uBAAuB,CAAC,CAAC,CAAC;CACtF,GAAG;IACF,CAAC,WAAW,EAAE,IAAI,MAAM,EAAE,GAAG,OAAO,CAAC;CACtC,CAAC"}
@@ -9,6 +9,7 @@ export declare function camelToKebabCase(property: string): string;
9
9
  */
10
10
  export declare function applySelectorCondition(baseSelector: string, predicate: string): string;
11
11
  export declare function generateId(): string;
12
+ export declare function isTransitionEffect(effect: object): effect is Pick<StateEffect, 'transition' | 'transitionProperties'>;
12
13
  /**
13
14
  * Resolves the style properties of a state effect - `transition.styleProperties` wins
14
15
  * when both are set - with property names normalized to the kebab-case form CSS expects.
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,yBAAyB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEhG,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,SAAI,GAAG,MAAM,CAE9D;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,WAEzC;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,M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AgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAKtF;AAED,wBAAgB,UAAU,WAQzB;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,GACb,MAAM,IAAI,IAAI,CAAC,WAAW,EAAE,YAAY,GAAG,sBAAsB,CAAC,CAEpE;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,gBAAgB,EAAE,IAAI,CAAC,WAAW,EAAE,YAAY,GAAG,sBAAsB,CAAC,GACzE,aAAa,EAAE,CAQjB;AAED,wBAAgB,iCAAiC,CAAC,gBAAgB,EAAE,WAAW,YAwC9E;AAID,wBAAgB,mBAAmB,CAAC,EAClC,GAAG,EACH,QAAQ,EACR,UAAU,EACV,oBAAoB,EACpB,aAAgC,EAChC,iBAAiB,GAClB,EAAE,yBAAyB,GAAG,MAAM,EAAE,CAyCtC;AAED,wBAAgB,sBAAsB,CACpC,cAAc,EAAE,MAAM,EAAE,GAAG,SAAS,EACpC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EACrC,IAAI,EAAE,OAAO,GAAG,WAAW,UAY5B;AAED,wBAAgB,aAAa,CAC3B,cAAc,EAAE,MAAM,EAAE,GAAG,SAAS,EACpC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,uBAMtC;AAED,wBAAgB,oBAAoB,CAClC,cAAc,EAAE,MAAM,EAAE,GAAG,SAAS,EACpC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GACpC,MAAM,GAAG,SAAS,CASpB"}
@@ -22,7 +22,12 @@ class Interact {
22
22
  // Static methods
23
23
  static create(
24
24
  config: InteractConfig,
25
- options?: { useCustomElement?: boolean; configIndex?: number },
25
+ options?: {
26
+ useCustomElement?: boolean;
27
+ configIndex?: number;
28
+ forceReducedMotion?: boolean;
29
+ reducedMotionPolicy?: ReducedMotionPolicy;
30
+ },
26
31
  ): Interact;
27
32
  static getInstance(key: string): Interact | undefined;
28
33
  static destroy(): void;
@@ -31,10 +36,13 @@ class Interact {
31
36
  pointerOptionsGetter?: () => Partial<PointerConfig>;
32
37
  viewEnter?: Partial<ViewEnterParams>;
33
38
  allowA11yTriggers?: boolean;
39
+ forceReducedMotion?: boolean;
40
+ reducedMotionPolicy?: ReducedMotionPolicy;
34
41
  }): void;
35
42
  static registerEffects(effects: Record<string, NamedEffect>): void;
36
43
  static getController(key: string | undefined): IInteractionController | undefined;
37
- static use(name: string, plugin: InteractPlugin): void;
44
+ static use(name: string, plugin: InteractPlugin, options?: InteractPluginOptions): void;
45
+ static ready(name: string, key?: string): void;
38
46
  static getPlugin(name: string): InteractPlugin | undefined;
39
47
  static getPluginNames(): Set<string>;
40
48
 
@@ -60,6 +68,8 @@ Creates a new `Interact` instance with the provided configuration and initialize
60
68
  - `config: InteractConfig` - The interaction configuration object
61
69
  - `options?.useCustomElement?: boolean` - Whether elements are wrapped in `<interact-element>` (defaults to whether the custom element is available)
62
70
  - `options?.configIndex?: number` - The config's index when several configs are on the same page. It must match the `configIndex` passed to [`generate()`](./functions.md#generateconfig-options) for the same config. Unnamed effects and sequences get ids suffixed by it (`eff-c1-0-0`), which become their generated keyframe and state names, so the configs' names don't collide.
71
+ - `options?.forceReducedMotion?: boolean` - Forces reduced motion for this instance, overriding the one set by [`Interact.setup()`](#interactsetupoptions). It must match the `forceReducedMotion` passed to `generate()` for the same config.
72
+ - `options?.reducedMotionPolicy?: ReducedMotionPolicy` - The [`ReducedMotionPolicy`](./types.md#reducedmotionpolicy) of the instance's effects that don't set one on their interaction, sequence or effect, overriding the one set by `Interact.setup()`. It must match the `reducedMotionPolicy` passed to `generate()` for the same config.
63
73
 
64
74
  **Returns:** `Interact` - The initialized interact instance
65
75
 
@@ -143,8 +153,10 @@ Configures global settings for the Interact system.
143
153
  - `options.pointerOptionsGetter` - Optional callback returning default partial pointer config for `pointerMove` trigger
144
154
  - `options.viewEnter` - Optional default partial `ViewEnterParams` (e.g. `threshold`, `inset`, `useSafeViewEnter`)
145
155
  - `options.allowA11yTriggers` - When `true`, `click` and `hover` triggers also respond to keyboard (Enter/Space) and focus
156
+ - `options.forceReducedMotion` - When `true`, applies the reduced-motion outcome of each effect's `reducedMotionPolicy` regardless of the OS setting (sets `Interact.forceReducedMotion`)
157
+ - `options.reducedMotionPolicy` - The default [`ReducedMotionPolicy`](./types.md#reducedmotionpolicy) of every instance's effects (`'collapse'` unless set; sets `Interact.reducedMotionPolicy`)
146
158
 
147
- To force reduced motion globally, set `Interact.forceReducedMotion = true` (static property, not via `setup`).
159
+ Both reduced-motion options can be overridden per instance with `Interact.create(config, options)`. `generate()` defaults to the values set here, so set them before generating, or pass the instance's values to `generate()`.
148
160
 
149
161
  **Example:**
150
162
 
@@ -164,6 +176,9 @@ Interact.setup({
164
176
  }),
165
177
  });
166
178
 
179
+ // Keep effects as they are for users who prefer reduced motion, unless an effect sets its own policy
180
+ Interact.setup({ reducedMotionPolicy: 'ignore' });
181
+
167
182
  // Enable accessibility for all click and hover triggers
168
183
  Interact.setup({
169
184
  allowA11yTriggers: true,
@@ -241,7 +256,7 @@ Interact.registerEffects({
241
256
  - Effects must be registered before calling `Interact.create()` with configurations that reference them
242
257
  - Registration is global — once registered, effects are available to all Interact instances
243
258
 
244
- ### `Interact.use(name, plugin)`
259
+ ### `Interact.use(name, plugin, options?)`
245
260
 
246
261
  Registers a plugin under a name. When an interaction or effect carries a `$<name>` field, Interact invokes the plugin with that field's value and a context. Interact is agnostic to what the plugin does — see the [Plugins guide](../guides/plugins.md).
247
262
 
@@ -249,6 +264,7 @@ Registers a plugin under a name. When an interaction or effect carries a `$<name
249
264
 
250
265
  - `name: string` - The plugin name, matched against `$<name>` config fields
251
266
  - `plugin: InteractPlugin` - `(value, context) => void | (() => void)`; the returned cleanup runs on disconnect/teardown
267
+ - `options.defer?: string | string[]` - Name(s) to defer the plugin until. While deferred, neither the plugin nor the interaction, effect, or sequence carrying its `$<name>` field runs; each name is released with [`Interact.ready()`](#interactreadyname-key). See [Deferring plugins](../guides/plugins.md#deferring-plugins)
252
268
 
253
269
  **Example:**
254
270
 
@@ -265,6 +281,30 @@ Interact.create(config); // configs may now use a `$splitText: { ... }` field
265
281
  - Register plugins **before** `Interact.create()`.
266
282
  - Registration is global. A `$<name>` field naming an unregistered plugin is ignored.
267
283
 
284
+ ### `Interact.ready(name, key?)`
285
+
286
+ Releases a defer name used by a plugin's `defer` option, and applies everything that was deferred on it.
287
+
288
+ **Parameters:**
289
+
290
+ - `name: string` - The defer name to release
291
+ - `key?: string` - Release it only for the element with this key. Without a key, it is released for every element
292
+
293
+ **Example:**
294
+
295
+ ```typescript
296
+ Interact.use('splitText', splitTextPlugin, { defer: 'hydrated' });
297
+ Interact.create(config);
298
+
299
+ // React: effects run after the hydration commit
300
+ useEffect(() => Interact.ready('hydrated'), []);
301
+ ```
302
+
303
+ **Notes:**
304
+
305
+ - A plugin with several defer names stays deferred until all of them are released.
306
+ - Releasing is permanent until `Interact.destroy()`. Elements that connect after a name is released are not deferred on it.
307
+
268
308
  ### `Interact.getPlugin(name)`
269
309
 
270
310
  Returns the plugin registered under `name`, or `undefined`.
package/docs/api/types.md CHANGED
@@ -274,7 +274,6 @@ Options passed to interaction handlers.
274
274
 
275
275
  ```typescript
276
276
  type InteractOptions = {
277
- reducedMotion?: boolean;
278
277
  targetController?: IInteractionController;
279
278
  selectorCondition?: string;
280
279
  allowA11yTriggers?: boolean;
@@ -283,7 +282,6 @@ type InteractOptions = {
283
282
 
284
283
  **Properties:**
285
284
 
286
- - `reducedMotion` - Whether reduced motion is enabled (respects `prefers-reduced-motion` or `Interact.forceReducedMotion`)
287
285
  - `targetController` - The controller managing the target element
288
286
  - `selectorCondition` - Optional CSS selector condition for element matching
289
287
  - `allowA11yTriggers` - Whether to enable accessibility triggers (keyboard events) for `click` and `hover` triggers. When `true`, `click` responds to Enter/Space keys and `hover` responds to focus events. Defaults to `true`.
@@ -293,7 +291,6 @@ type InteractOptions = {
293
291
  ```typescript
294
292
  // Used internally by handlers
295
293
  const options: InteractOptions = {
296
- reducedMotion: Interact.forceReducedMotion,
297
294
  targetController: Interact.getController('my-element'),
298
295
  };
299
296
  ```
@@ -864,6 +861,27 @@ type Interaction = InteractionTrigger & {
864
861
 
865
862
  An interaction can have `effects` only, `sequences` only, or both.
866
863
 
864
+ ## Reduced Motion Types
865
+
866
+ ### `ReducedMotionPolicy`
867
+
868
+ What an effect does when the user prefers reduced motion: `(prefers-reduced-motion: reduce)` matches, or reduced motion is forced (`forceReducedMotion` of `Interact.setup()` or `Interact.create()`).
869
+
870
+ ```typescript
871
+ type ReducedMotionPolicy = 'ignore' | 'cancel' | 'collapse' | (string & {}); // string = effectId
872
+ ```
873
+
874
+ Accepted on `Interaction`, `SequenceConfig` / `SequenceConfigRef` and effects, and per instance as an option of `Interact.create()` / `Interact.setup()` (it isn't a config field). The most specific level wins: inline effect → its `effects` registry entry → sequence → interaction → instance → `'collapse'`.
875
+
876
+ - `'collapse'` (default) - Plays with duration 0, keeping everything else (delay, iterations, fill, keyframes), so it jumps to its end state. Transitions become 0ms and keep their delay. Effects with no end state (infinite iterations, `viewProgress` / `pointerMove`) are cancelled instead.
877
+ - `'ignore'` - Plays as usual.
878
+ - `'cancel'` - Dropped, exactly like a `(prefers-reduced-motion: no-preference)` media condition.
879
+ - effectId - Replaced by the animation of `effects[effectId]` (effect type, keyframes and timing), keeping the original's target, conditions, `effectId` and `triggerType`. It must be of the same kind (time, scrub or state) and exist, otherwise the effect collapses.
880
+
881
+ A sequence's stagger (`offset`) collapses to 0 under reduced motion, unless the sequence's own policy resolves to `'ignore'`. Its `delay` and its effects' delays are kept.
882
+
883
+ `generate()` emits both outcomes under exclusive `prefers-reduced-motion` media queries, so the CSS and the runtime agree. `generate()` takes the instance's `reducedMotionPolicy` and `forceReducedMotion` as options, defaulting to the ones set by `Interact.setup()`.
884
+
867
885
  ## Condition Types
868
886
 
869
887
  ### `Condition`
@@ -969,6 +987,18 @@ type InteractPluginContext = {
969
987
  type InteractPluginCleanup = () => void; // runs on disconnect/teardown
970
988
  ```
971
989
 
990
+ ### `InteractPluginOptions`
991
+
992
+ Registration options, passed as the third argument of `Interact.use()`.
993
+
994
+ ```typescript
995
+ type InteractPluginOptions = {
996
+ defer?: string | string[]; // name(s) to defer until, released with `Interact.ready(name, key?)`
997
+ };
998
+ ```
999
+
1000
+ See [Deferring plugins](../guides/plugins.md#deferring-plugins).
1001
+
972
1002
  ### `InteractPluginConfigMap`
973
1003
 
974
1004
  Augmentable interface for typing plugin fields, keyed by the **unprefixed** plugin name. Empty by default; consumers merge into it:
@@ -269,6 +269,59 @@ const accessibleConfig: InteractConfig = {
269
269
  };
270
270
  ```
271
271
 
272
+ ### Reduced Motion Policy
273
+
274
+ Instead of writing a separate interaction per motion preference, set `reducedMotionPolicy` and let Interact derive the reduced-motion version of each effect. It is accepted on interactions, sequences and effects — the most specific level wins. By default every effect collapses: it jumps to its end state for users who prefer reduced motion. To change that default, pass `reducedMotionPolicy` to `Interact.setup()` for every instance, or to `Interact.create(config, options)` for one.
275
+
276
+ ```typescript
277
+ const config: InteractConfig = {
278
+ effects: {
279
+ fade: {
280
+ keyframeEffect: { name: 'fade', keyframes: [{ opacity: '0' }, { opacity: '1' }] },
281
+ duration: 300,
282
+ easing: 'ease-out',
283
+ },
284
+ },
285
+
286
+ interactions: [
287
+ {
288
+ key: 'hero-title',
289
+ trigger: 'viewEnter',
290
+ effects: [
291
+ {
292
+ keyframeEffect: {
293
+ name: 'fade-move',
294
+ keyframes: [
295
+ { opacity: '0', transform: 'translateY(50px) rotate(-2deg)' },
296
+ { opacity: '1', transform: 'translateY(0) rotate(0deg)' },
297
+ ],
298
+ },
299
+ duration: 800,
300
+ // swap in the subtle `fade` effect instead of collapsing
301
+ reducedMotionPolicy: 'fade',
302
+ },
303
+ ],
304
+ },
305
+ {
306
+ key: 'background',
307
+ trigger: 'viewProgress',
308
+ // drop the parallax entirely
309
+ reducedMotionPolicy: 'cancel',
310
+ effects: [{ namedEffect: { type: 'ParallaxScroll' } }],
311
+ },
312
+ ],
313
+ };
314
+ ```
315
+
316
+ - `'collapse'` (default) plays it with duration 0, keeping its iterations, so it jumps to its end state after its delay. Looping and scroll/pointer-driven effects have no end state, so they're cancelled instead.
317
+ - `'ignore'` plays the effect as usual.
318
+ - `'cancel'` drops it, exactly as if it had a `(prefers-reduced-motion: no-preference)` condition.
319
+ - An effectId replaces the effect's animation with that registry effect's, keeping the original target and conditions. It must be the same kind of effect (time-based, scroll/pointer-driven or a state transition), otherwise the effect collapses.
320
+
321
+ A sequence's stagger collapses too, so its items land together, unless the sequence's policy is `'ignore'`.
322
+
323
+ `Interact.setup({ forceReducedMotion: true })` (or `Interact.create(config, { forceReducedMotion: true })` for a single instance) applies the reduced-motion outcome regardless of the user's setting. `generate()` defaults to the values set by `Interact.setup()`; pass it the instance's values otherwise.
324
+
272
325
  ## Device-Specific Patterns
273
326
 
274
327
  ### Touch vs Mouse Devices
@@ -55,7 +55,7 @@ type InteractPlugin = (
55
55
 
56
56
  - Plugins run at **connect** time (when the element enters the DOM / is added).
57
57
  - A returned **cleanup** runs on disconnect, on teardown (`Interact.destroy()`), and when an interaction re-connects after a media-query change — so plugins can fully undo their work.
58
- - Each distinct plugin value is applied **once per connect**, even if referenced by multiple triggers on the same element.
58
+ - Each distinct plugin value is applied **once per connect**, even if referenced by multiple triggers on the same element. That dedup relies on the value's identity, so plugin values should be objects.
59
59
 
60
60
  ### Type-safe config (optional)
61
61
 
@@ -139,6 +139,41 @@ A `$`-prefixed field can also sit on an individual effect, using that effect's *
139
139
  }
140
140
  ```
141
141
 
142
+ ## Deferring plugins
143
+
144
+ Plugins that change the DOM can conflict with frameworks that own it. React, for example, hydrates server-rendered markup and expects it unchanged. If a plugin like `@wix/splittext` runs first (e.g. from `<interact-element>`'s `connectedCallback`, which fires while the HTML is parsed), hydration can wipe its changes, leaving animations bound to detached elements.
145
+
146
+ Pass `defer` to `Interact.use()` to hold a plugin back until you release it with `Interact.ready()`:
147
+
148
+ ```ts
149
+ Interact.use('splitText', splitTextPlugin, { defer: 'hydrated' });
150
+ Interact.create(config);
151
+
152
+ // React client root: effects run after the hydration commit
153
+ useEffect(() => Interact.ready('hydrated'), []);
154
+ ```
155
+
156
+ While a plugin is deferred, Interact also defers everything that may resolve against the DOM the plugin creates:
157
+
158
+ | Where the `$<name>` field sits | What is deferred |
159
+ | --------------------------------------------------------------------------------- | ------------------------------------------------ |
160
+ | On an interaction | The whole interaction: its effects and sequences |
161
+ | On an effect in `effects` (or in its definition under the config's `effects` map) | Only that effect |
162
+ | On any effect of a sequence | The whole sequence |
163
+
164
+ Everything else in the config is applied immediately, as usual. Once released, deferred parts are applied exactly as they would have been on connect.
165
+
166
+ - `Interact.ready(name, key)` releases a name for a single element only — useful when parts of the page hydrate separately (e.g. Suspense boundaries).
167
+ - `defer` accepts several names; the plugin stays deferred until all are released. A name can stand for any event, not just hydration — for example, `@wix/splittext`'s `lines` mode measures text, so it should wait for fonts:
168
+
169
+ ```ts
170
+ Interact.use('splitText', splitTextPlugin, { defer: ['hydrated', 'fonts'] });
171
+ document.fonts.ready.then(() => Interact.ready('fonts'));
172
+ ```
173
+
174
+ - Elements that connect after a name was released are not deferred on it. Released names are reset by `Interact.destroy()`.
175
+ - SSR styles keep applying while deferred: content hidden by a plugin's style generator (e.g. `hideUntilReady`) or by entrance FOUC-prevention CSS stays hidden until the name is released.
176
+
142
177
  ## SSR styling (FOUC prevention)
143
178
 
144
179
  A plugin often needs initial CSS _before_ it runs — e.g. hiding the un-split text so an entrance animation doesn't flash the raw content. That's a build-time concern, so it lives in [`generate()`](../api/functions.md#generateconfig-options), not in the runtime `use()` callback.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/interact",
3
- "version": "2.6.0",
3
+ "version": "2.8.0",
4
4
  "description": "Declarative, configuration-driven interaction library — web-native, AI-ready, and framework-agnostic.",
5
5
  "license": "MIT",
6
6
  "main": "dist/cjs/index.js",
@@ -22,6 +22,7 @@ Declarative configuration-driven interaction library. Binds animations to trigge
22
22
  - [Animation Payloads](#animation-payloads)
23
23
  - [Sequences](#sequences)
24
24
  - [Conditions](#conditions)
25
+ - [Reduced Motion](#reduced-motion)
25
26
  - [CSS Generation & FOUC Prevention](#css-generation--fouc-prevention)
26
27
  - [Element Resolution](#element-resolution)
27
28
  - [Plugins](#plugins)
@@ -39,7 +40,7 @@ Each item here is CRITICAL — ignoring any of them will break animations.
39
40
  events and flickering. Use `selector` to target a child element, or set the effect's `key` to a different element.
40
41
  - **CRITICAL**: For `pointerMove` trigger MUST AVOID using the same element as both source and target with `hitArea: 'self'` and effects that change size or position (e.g. `transform: translate(…)`, `scale(…)`). The transform shifts the hit area, causing jittery re-entry cycles. Instead, use `selector` to target a child element for the animation.
41
42
  - **CRITICAL — Do NOT guess preset options**: If you don't know the expected type/structure for a `namedEffect` param, omit it — rely on defaults rather than guessing.
42
- - **Reduced motion**: Use conditions to provide gentler alternatives (shorter durations, fewer transforms, no perpetual motion) for users who prefer reduced motion. You can also set `Interact.forceReducedMotion = matchMedia('(prefers-reduced-motion: reduce)').matches` to force a global reduced-motion behavior programmatically.
43
+ - **Reduced motion**: Effects collapse by default (see [Reduced Motion](#reduced-motion)) — users who prefer reduced motion get the end state without the tween. Use `'cancel'` to drop an effect, an effectId to swap in a gentler effect, or `'ignore'` to keep it as is. `Interact.setup({ reducedMotionPolicy, forceReducedMotion })` changes the default and forces the reduced outcome for every instance; `Interact.create(config, options)` takes both per instance. Never put `reducedMotionPolicy` on the config root.
43
44
  - **Perspective**: Prefer `transform: perspective(...)` inside keyframes. Use the CSS `perspective` property only when multiple children share the same `perspective-origin`.
44
45
 
45
46
  ---
@@ -197,6 +198,7 @@ Each interaction maps a source element + trigger to one or more effects.
197
198
  effects?: (Effect | EffectRef)[]; // possible to add multiple effects for same trigger
198
199
  sequences?: (SequenceConfig | SequenceConfigRef)[]; // possible to add multiple sequences for same trigger
199
200
  conditions?: string[]; // ids referencing the top-level conditions map; all must pass
201
+ reducedMotionPolicy?: ReducedMotionPolicy; // default for the interaction's effects
200
202
  selector?: string; // optional - CSS selector to refine source element selection within the root element
201
203
  listContainer?: string; // optional — CSS selector for list container
202
204
  listItemSelector?: string; // optional — CSS selector to filter which children of listContainer are observed as sources
@@ -361,6 +363,7 @@ Each effect applies a visual change to a target element. An effect is either inl
361
363
  key?: string; // target element key; omit to target the source
362
364
  effectId?: string; // reference to effects registry (EffectRef)
363
365
  conditions?: string[]; // ids referencing the top-level conditions map; all must pass
366
+ reducedMotionPolicy?: ReducedMotionPolicy; // see Reduced Motion
364
367
  selector?: string; // optional — CSS selector to refine target element
365
368
  listContainer?: string; // optional — CSS selector for list container
366
369
  listItemSelector?: string; // optional — filter which children of listContainer are selected
@@ -542,6 +545,7 @@ Coordinate multiple effects with staggered timing. Prefer sequences over manual
542
545
  sequenceId?: string; // for caching/referencing; also names the CSS stagger custom
543
546
  // properties. Defaults to `seq-<interactionIdx>-<sequenceIdx>`
544
547
  conditions?: string[]; // ids referencing the top-level conditions map
548
+ reducedMotionPolicy?: ReducedMotionPolicy; // default for the sequence's effects
545
549
  }
546
550
  ```
547
551
 
@@ -618,6 +622,27 @@ conditions: {
618
622
 
619
623
  ---
620
624
 
625
+ ## Reduced Motion
626
+
627
+ ```ts
628
+ type ReducedMotionPolicy = 'ignore' | 'cancel' | 'collapse' | string; // string = effectId in the effects registry
629
+ ```
630
+
631
+ What an effect does when the user prefers reduced motion (`(prefers-reduced-motion: reduce)`, or forced by `forceReducedMotion` of `Interact.setup()` / `Interact.create()`). Set on an interaction, a sequence or an effect, or per instance (`Interact.setup()` / `Interact.create()` option, not a config field); the most specific wins: effect (inline, then its registry entry) → sequence → interaction → instance → `'collapse'`.
632
+
633
+ | Value | Under reduced motion |
634
+ | :----------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
635
+ | `'collapse'` | Default. Plays with duration 0, keeping everything else (delay, iterations, fill, keyframes), so it jumps to its end state. Transitions become 0ms (with delay). Looping and scroll/pointer-driven effects are cancelled. |
636
+ | `'ignore'` | Plays as usual. |
637
+ | `'cancel'` | Dropped, like a `(prefers-reduced-motion: no-preference)` media condition — an earlier effect of the same interaction on the same target may then apply instead. |
638
+ | effectId | Replaced by that registry effect's animation (effect type, keyframes and timing); the original's target, conditions and `triggerType` stay. It must be of the same kind (time, scrub or state) — otherwise it collapses. |
639
+
640
+ - A sequence's stagger (`offset`) collapses to 0, unless the sequence's policy is `'ignore'`; delays are kept.
641
+ - An `animationEnd` source resolves its policy from its registry entry and the instance only — set it there.
642
+ - `generate()` emits both outcomes under exclusive `prefers-reduced-motion` media. It takes the instance's `reducedMotionPolicy` / `forceReducedMotion` as options, defaulting to `Interact.setup()`'s.
643
+
644
+ ---
645
+
621
646
  ## CSS Generation & FOUC Prevention
622
647
 
623
648
  ### Generating CSS
@@ -727,6 +752,7 @@ Interact can route config to external plugins registered with `Interact.use(name
727
752
  - A plugin may return a cleanup function; Interact runs it on disconnect/teardown.
728
753
  - A `$<name>` field with no registered plugin is ignored.
729
754
  - Plugin fields MUST be `$`-prefixed — a non-prefixed unknown key on an interaction/effect is rejected by `@wix/interact-validate`.
755
+ - **Deferring (hydration):** in apps that hydrate server-rendered markup (e.g. React), register DOM-changing plugins with `Interact.use('splitText', splitTextPlugin, { defer: 'hydrated' })` and call `Interact.ready('hydrated')` once hydration is done (e.g. in a root `useEffect`). While deferred, the plugin and what carries its field don't run: the whole interaction (interaction-level field), only that effect (effect-level field), or the whole sequence (field on a sequence effect). `Interact.ready(name, key)` releases a single element; `defer` may list several names, all of which must be released.
730
756
  - **SSR styling:** for FOUC prevention (e.g. hiding un-split text before an entrance animation), pass a **separate** per-plugin callback in the `plugins` option of `generate()`'s options bag: `generate(config, { useFirstChild: true, plugins: { myPlugin: (value, context) => { declarations, selectorSuffix }[] } })`. `generate()` does not inspect the value; the callback returns CSS rule(s) data and scopes them under the base selector (`[data-interact-key="<key>"]`). It is NOT the `use()` callback. If the plugin package ships a generator (e.g. `splitTextStyle` from `@wix/splittext/plugin`), pass that instead of writing one.
731
757
 
732
758
  **Example — split text, then stagger the generated char spans.** Use the adapter shipped from `@wix/splittext/plugin` (`splitTextPlugin` + its SSR counterpart `splitTextStyle`); do NOT hand-roll it:
@@ -766,13 +792,14 @@ Default split wrapper classes: `.split-c` (chars), `.split-w` (words), `.split-l
766
792
  | Method / Property | Description |
767
793
  | :---------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
768
794
  | `generate(config, options?)` | Produce complete CSS for all interactions. Call at build/generation time; embed in HTML. `options` = `{ useFirstChild?, plugins? }`, or a bare boolean for legacy `useFirstChild`. `plugins` = per-plugin SSR style generators (see [Plugins](#plugins)). |
769
- | `Interact.create(config)` | Initialize with a config. Returns the instance. Store the instance to manage its lifecycle. |
795
+ | `Interact.create(config, options?)` | Initialize with a config. Returns the instance. Store the instance to manage its lifecycle. `options.forceReducedMotion` / `options.reducedMotionPolicy` override `Interact.setup()`'s for the instance. |
770
796
  | `Interact.registerEffects(presets)` | Register named effect presets. MUST be called before `generate()` and `create`. |
771
797
  | `Interact.destroy()` | Tear down all instances. Call on unmount or route change to prevent memory leaks. |
772
- | `Interact.forceReducedMotion` | `boolean` (default: `false`) — force reduced-motion behavior regardless of OS setting. |
798
+ | `Interact.forceReducedMotion` | `boolean` (default: `false`) — apply the reduced-motion outcome of `reducedMotionPolicy` regardless of OS setting. Set by `Interact.setup()`. |
773
799
  | `Interact.allowA11yTriggers` | `boolean` (default: `true`) — enable accessibility trigger variants (`interest`, `activate`). |
774
800
  | `Interact.setup(options)` | Configure global options for scroll, pointer, and viewEnter systems. Call before `create`. See options below. |
775
- | `Interact.use(name, plugin)` | Register an external plugin by name (see [Plugins](#plugins)). Call before `create`. |
801
+ | `Interact.use(name, plugin, opts?)` | Register an external plugin by name (see [Plugins](#plugins)). Call before `create`. `opts.defer` defers it until `Interact.ready()`. |
802
+ | `Interact.ready(name, key?)` | Release a plugin `defer` name — for all elements, or only `key` — and apply what was deferred on it. |
776
803
 
777
804
  **`Interact.setup(options)`** — optional configuration object:
778
805
 
@@ -782,6 +809,8 @@ Default split wrapper classes: `.split-c` (chars), `.split-w` (words), `.split-l
782
809
  | `pointerOptionsGetter` | `() => Partial<PointerConfig>` | Function returning defaults for pointer-move animation configuration |
783
810
  | `viewEnter` | `Partial<ViewEnterParams>` | Defaults for all viewEnter triggers (`threshold`,`inset`) |
784
811
  | `allowA11yTriggers` | `boolean` | Enable accessibility trigger variants (use `interest` and `activate`) |
812
+ | `forceReducedMotion` | `boolean` | Apply the reduced-motion outcome regardless of OS setting |
813
+ | `reducedMotionPolicy` | `ReducedMotionPolicy` | Default policy of effects (default `'collapse'`) |
785
814
 
786
815
  Use `setup()` when you need to override default observer thresholds or provide global configuration that applies to all interactions of a given trigger type.
787
816
 
@@ -363,6 +363,6 @@ Each `Interact.create(config)` call returns an instance. Keep a reference if you
363
363
  | `Interact.create(config)` | Initialize with a config. Returns the instance. Multiple configs create separate instances. |
364
364
  | `Interact.registerEffects(presets)` | Register named effect presets before `generate()` and `create`. Required for `namedEffect`. |
365
365
  | `Interact.destroy()` | Tear down all instances. |
366
- | `Interact.forceReducedMotion` | `boolean` — force reduced-motion behavior regardless of OS setting. Default: `false`. |
366
+ | `Interact.forceReducedMotion` | `boolean` — apply the reduced-motion outcome of `reducedMotionPolicy` regardless of OS setting. Set by `Interact.setup()`, overridable per instance. Default: `false`. |
367
367
  | `Interact.allowA11yTriggers` | `boolean` — enable accessibility triggers (`interest`, `activate`). Default: `true`. |
368
- | `Interact.setup(options)` | Configure global defaults for scroll/pointer/viewEnter trigger params. Call before `create`. |
368
+ | `Interact.setup(options)` | Configure global defaults for scroll/pointer/viewEnter trigger params and reduced motion (`forceReducedMotion`, `reducedMotionPolicy`). Call before `create`. |