@tooark/motion 1.2.2 → 1.3.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/README.md CHANGED
@@ -93,6 +93,30 @@ const dispose = arkSwipe(row, {
93
93
  });
94
94
  ```
95
95
 
96
+ ### In React, Vue and Angular
97
+
98
+ The helpers are plain functions, so no wrapper is needed: call them after the elements exist and call the returned stop/dispose function when the component goes away. Pass elements from a ref rather than a selector, since a selector searches the whole `document` and would also animate other instances of the component.
99
+
100
+ ```tsx
101
+ // React
102
+ useEffect(() => arkReveal(listRef.current!.querySelectorAll(":scope > li"), { preset: "fade", once: true }), []);
103
+ ```
104
+
105
+ ```ts
106
+ // Vue
107
+ let stop = () => {};
108
+ onMounted(() => (stop = arkSwipe(row.value!, { axis: "x", onSwipe: archive })));
109
+ onBeforeUnmount(() => stop());
110
+
111
+ // Angular
112
+ ngAfterViewInit(): void {
113
+ this.stop = arkReveal(this.list.nativeElement.querySelectorAll(":scope > li"), { preset: "fade" });
114
+ }
115
+ ngOnDestroy(): void {
116
+ this.stop?.();
117
+ }
118
+ ```
119
+
96
120
  ---
97
121
 
98
122
  ## 📋 Dependencies
@@ -101,8 +125,8 @@ Installed automatically unless marked as peer; peer dependencies are yours to in
101
125
 
102
126
  | Package | Version | Description |
103
127
  | ---------------------------------------------------------------- | ------- | ---------------------------------------------------------------- |
104
- | [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.2.2 | Types, i18n, toast/announce services, motion and overlay helpers |
105
- | [`@tooark/tokens`](https://www.npmjs.com/package/@tooark/tokens) | ^1.2.2 | Design tokens (colors, sizes, motion) and primitive types |
128
+ | [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.3.0 | Types, i18n, toast/announce services, motion and overlay helpers |
129
+ | [`@tooark/tokens`](https://www.npmjs.com/package/@tooark/tokens) | ^1.3.0 | Design tokens (colors, sizes, motion) and primitive types |
106
130
  | [`motion`](https://www.npmjs.com/package/motion) | ^13.4.4 | Motion animation library (spring physics, scroll, gestures) |
107
131
  | [`tslib`](https://www.npmjs.com/package/tslib) | ^2.8.1 | TypeScript runtime helpers |
108
132
 
package/README.pt-BR.md CHANGED
@@ -93,6 +93,30 @@ const dispose = arkSwipe(linha, {
93
93
  });
94
94
  ```
95
95
 
96
+ ### Em React, Vue e Angular
97
+
98
+ Os helpers são funções comuns, então não precisam de wrapper: chame depois que os elementos existem e chame a função de parar/dispose devolvida quando o componente sai. Passe elementos de uma ref em vez de um seletor, porque um seletor procura no `document` inteiro e animaria também as outras instâncias do componente.
99
+
100
+ ```tsx
101
+ // React
102
+ useEffect(() => arkReveal(listRef.current!.querySelectorAll(":scope > li"), { preset: "fade", once: true }), []);
103
+ ```
104
+
105
+ ```ts
106
+ // Vue
107
+ let stop = () => {};
108
+ onMounted(() => (stop = arkSwipe(row.value!, { axis: "x", onSwipe: archive })));
109
+ onBeforeUnmount(() => stop());
110
+
111
+ // Angular
112
+ ngAfterViewInit(): void {
113
+ this.stop = arkReveal(this.list.nativeElement.querySelectorAll(":scope > li"), { preset: "fade" });
114
+ }
115
+ ngOnDestroy(): void {
116
+ this.stop?.();
117
+ }
118
+ ```
119
+
96
120
  ---
97
121
 
98
122
  ## 📋 Dependências
@@ -101,8 +125,8 @@ Instaladas automaticamente, salvo as marcadas como peer, que ficam por sua conta
101
125
 
102
126
  | Pacote | Versão | Descrição |
103
127
  | ---------------------------------------------------------------- | ------- | -------------------------------------------------------------------- |
104
- | [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.2.2 | Tipos, i18n, serviços de toast/announce, motion e helpers de overlay |
105
- | [`@tooark/tokens`](https://www.npmjs.com/package/@tooark/tokens) | ^1.2.2 | Design tokens (cores, tamanhos, motion) e tipos primitivos |
128
+ | [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.3.0 | Tipos, i18n, serviços de toast/announce, motion e helpers de overlay |
129
+ | [`@tooark/tokens`](https://www.npmjs.com/package/@tooark/tokens) | ^1.3.0 | Design tokens (cores, tamanhos, motion) e tipos primitivos |
106
130
  | [`motion`](https://www.npmjs.com/package/motion) | ^13.4.4 | Biblioteca de animação Motion (spring, scroll, gestos) |
107
131
  | [`tslib`](https://www.npmjs.com/package/tslib) | ^2.8.1 | Helpers de runtime do TypeScript |
108
132
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tooark/motion",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "description": "Tooark Motion — opt-in animation helpers (stagger, scroll reveal, FLIP, swipe) on top of the Motion lib, with design system tokens",
5
5
  "keywords": [
6
6
  "tooark",
@@ -66,8 +66,8 @@
66
66
  "registry": "https://registry.npmjs.org/"
67
67
  },
68
68
  "dependencies": {
69
- "@tooark/core": "^1.2.2",
70
- "@tooark/tokens": "^1.2.2",
69
+ "@tooark/core": "^1.3.0",
70
+ "@tooark/tokens": "^1.3.0",
71
71
  "motion": "^13.4.4",
72
72
  "tslib": "^2.8.1"
73
73
  },