@wix/interact 2.8.4 → 2.8.6
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/es/index.js +1 -1
- package/dist/es/react.js +2 -2
- package/dist/es/web.js +2 -2
- package/dist/index-D8zv4Q-3.js +29 -0
- package/dist/index-D8zv4Q-3.js.map +1 -0
- package/dist/{index-DxihyZYQ.mjs → index-DSREj0qw.mjs} +1628 -1427
- package/dist/index-DSREj0qw.mjs.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 +6 -1
- package/dist/types/core/InteractionController.d.ts.map +1 -1
- package/dist/types/core/add.d.ts.map +1 -1
- package/dist/types/handlers/animationEnd.d.ts +15 -0
- package/dist/types/handlers/animationEnd.d.ts.map +1 -1
- package/dist/types/handlers/viewEnter.d.ts +8 -0
- package/dist/types/handlers/viewEnter.d.ts.map +1 -1
- package/dist/types/react/Interaction.d.ts +1 -1
- package/dist/types/types/controller.d.ts +15 -2
- package/dist/types/types/controller.d.ts.map +1 -1
- package/dist/types/types/handlers.d.ts +18 -0
- package/dist/types/types/handlers.d.ts.map +1 -1
- package/dist/types/types/internal.d.ts +2 -0
- package/dist/types/types/internal.d.ts.map +1 -1
- package/dist/types/types/plugins.d.ts +12 -4
- package/dist/types/types/plugins.d.ts.map +1 -1
- package/docs/api/interact-class.md +1 -1
- package/docs/api/types.md +3 -1
- package/docs/guides/plugins.md +28 -3
- package/package.json +2 -2
- package/rules/full-lean.md +2 -1
- package/rules/plugins.md +5 -1
- package/dist/index-DxihyZYQ.mjs.map +0 -1
- package/dist/index-OM5ScKV3.js +0 -29
- package/dist/index-OM5ScKV3.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/interact",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.6",
|
|
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",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"url": "https://github.com/wix/interact/issues"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@wix/motion": "^2.2.
|
|
71
|
+
"@wix/motion": "^2.2.3",
|
|
72
72
|
"fastdom": "^1.0.12",
|
|
73
73
|
"fizban": "^0.7.2",
|
|
74
74
|
"kuliso": "^0.4.13"
|
package/rules/full-lean.md
CHANGED
|
@@ -750,9 +750,10 @@ Interact can route config to external plugins registered with `Interact.use(name
|
|
|
750
750
|
- Reference with a `$<name>` field on an **interaction** or **effect**: `$splitText: { container: '.title', type: 'chars' }`.
|
|
751
751
|
- Plugins run at connect time, **before** target resolution — so DOM they create (e.g. `.split-c` spans) is visible to `selector` queries that follow.
|
|
752
752
|
- A plugin may return a cleanup function; Interact runs it on disconnect/teardown.
|
|
753
|
+
- A plugin may be async (return a promise of an optional cleanup): what carries its field is held back until it settles, like a deferred plugin.
|
|
753
754
|
- A `$<name>` field with no registered plugin is ignored.
|
|
754
755
|
- 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.
|
|
756
|
+
- **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. A `viewEnter` `once` entry or a matching source `animationend` that happens while held back is replayed once the trigger attaches (except a `viewEnter` entry of a source the plugin itself creates or replaces, via the interaction's own `selector` / `listContainer`); other trigger events are not.
|
|
756
757
|
- **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.
|
|
757
758
|
|
|
758
759
|
**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:
|
package/rules/plugins.md
CHANGED
|
@@ -20,9 +20,12 @@ Interact.use('<plugin-name>', (value, context) => {
|
|
|
20
20
|
// value: the value of the `$<plugin-name>` field
|
|
21
21
|
// context: { root, key, scope: 'interaction' | 'effect', config }
|
|
22
22
|
// return: optional cleanup () => void, run on disconnect/teardown
|
|
23
|
+
// — or a promise of one (async plugin)
|
|
23
24
|
});
|
|
24
25
|
```
|
|
25
26
|
|
|
27
|
+
- An async plugin (returning a promise) holds back the interaction carrying its field — same scope as deferring, below — until the promise settles; it starts only once its element connects, so siblings already attached by then are not held. It runs once per connect; a primitive value (no identity to dedup by) is not awaited; a stale resolution (element disconnected meanwhile) only runs its cleanup; a rejection is logged and the held-back parts apply without it.
|
|
28
|
+
|
|
26
29
|
- `Interact.getPlugin(name) / Interact.getPluginsNames()` inspect the registry.
|
|
27
30
|
|
|
28
31
|
### Deferring (hydration)
|
|
@@ -37,8 +40,9 @@ Interact.create(config);
|
|
|
37
40
|
useEffect(() => Interact.ready('hydrated'), []);
|
|
38
41
|
```
|
|
39
42
|
|
|
40
|
-
- While deferred, the plugin does not run, and neither does what carries its `$<name>` field: the whole interaction (interaction
|
|
43
|
+
- While deferred, the plugin does not run, and neither does what carries its `$<name>` field: the whole interaction — its effects and sequences wait for each other, wherever the field sits (interaction, effect, or sequence effect) and even when a sibling's target is another element, connected or not; releasing only that element's key attaches all of them. Everything else applies immediately.
|
|
41
44
|
- `Interact.ready(name, key)` releases a name for one element only; `Interact.ready(name)` releases it for all.
|
|
45
|
+
- A `viewEnter` `once` entry, or a source `animationend` matching an `animationEnd` trigger, that happens while held back (deferred or async) is replayed when the trigger attaches (it plays once) — also for an interaction-level field on an interaction with its own `selector` / `listContainer`, which attaches once the plugin is done; there, only a `viewEnter` source the plugin creates or replaces is not replayed (it plays when it next enters the viewport). `click` / `hover` events fired while held back are NOT replayed.
|
|
42
46
|
- `defer` may list several names (e.g. `['hydrated', 'fonts']`); all must be released. Release `'fonts'` with `document.fonts.ready.then(() => Interact.ready('fonts'))`.
|
|
43
47
|
- Released names persist until `Interact.destroy()`.
|
|
44
48
|
|