@animatter/react 0.0.0-stage → 0.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/LICENSE +21 -0
- package/README.md +6 -2
- package/dist/index.d.ts +72 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +188 -0
- package/dist/index.js.map +1 -0
- package/package.json +45 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alanshown
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @animatter/react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Optional React lifecycle hooks for the shared Animatter runtime. Peer dependencies: React >=18 and animatter ^0.1.0. Version 0.1.0 is available on npm.
|
|
4
|
+
|
|
5
|
+
useAnimatter returns {ref,world}; useSurface registers a ref and cleans up on unmount. Keep surface option objects stable. World options are captured on mount; configure the world for live changes.
|
|
6
|
+
|
|
7
|
+
[Usage and tests](https://github.com/Alanshown/Animatter.js/blob/main/README.md#framework-integrations). MIT.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type ReactNode, type RefObject } from "react";
|
|
2
|
+
import { createWorld, type AnimatterWorld, type Interaction, type PresetInput, type SurfaceOptions, type WorldOptions } from "animatter";
|
|
3
|
+
export interface PhysicsProviderProps {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
/** Root element the world scans and listens on. Defaults to document.body inside the browser. */
|
|
6
|
+
root?: () => HTMLElement;
|
|
7
|
+
options?: Omit<WorldOptions, "root">;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates one world per provider instance. The world is created inside an effect, so importing this module
|
|
11
|
+
* never touches the DOM, and StrictMode's double effect invocation destroys the first world cleanly.
|
|
12
|
+
*/
|
|
13
|
+
export declare function PhysicsProvider({ children, root, options }: PhysicsProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<AnimatterWorld | null>>;
|
|
14
|
+
/** Returns the shared world from the nearest PhysicsProvider, or null until it has mounted. */
|
|
15
|
+
export declare function usePhysicsWorld(): AnimatterWorld | null;
|
|
16
|
+
/** Stable identity for preset lists. Presets are plain definitions, so name plus options identifies them. */
|
|
17
|
+
export declare function presetKey(presets: PresetInput | undefined): string;
|
|
18
|
+
/**
|
|
19
|
+
* Applies presets to the element referenced by the returned ref. Changing the preset list updates the
|
|
20
|
+
* existing handle when possible; the surface itself is never re-registered.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useEnhance<T extends HTMLElement>(presets: PresetInput | undefined, disabled?: boolean): RefObject<T | null>;
|
|
23
|
+
export interface PhysicsSurfaceOptions extends SurfaceOptions {
|
|
24
|
+
presets?: PresetInput;
|
|
25
|
+
onInteraction?: (event: Interaction) => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Registers an element as a surface and optionally enhances it. Registration depends only on world and id.
|
|
29
|
+
* Material, mode and draggable changes go through world.configure. Preset changes go through the enhancement handle.
|
|
30
|
+
*/
|
|
31
|
+
export declare function usePhysicsSurface<T extends HTMLElement>(options?: PhysicsSurfaceOptions): RefObject<T | null>;
|
|
32
|
+
/** Shorthand for a magnetic pull toward the pointer. */
|
|
33
|
+
export declare function useMagnetic<T extends HTMLElement>(options?: {
|
|
34
|
+
strength?: number;
|
|
35
|
+
radius?: number;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
}): RefObject<T | null>;
|
|
38
|
+
/** Shorthand for an elastic spring response. */
|
|
39
|
+
export declare function useSpring<T extends HTMLElement>(options?: {
|
|
40
|
+
stiffness?: number;
|
|
41
|
+
damping?: number;
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
}): RefObject<T | null>;
|
|
44
|
+
/** Draggable surface with damping feedback while dragging. */
|
|
45
|
+
export declare function usePhysicsDrag<T extends HTMLElement>(options?: {
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
}): RefObject<T | null>;
|
|
48
|
+
export interface PhysicsSurfaceProps extends Omit<PhysicsSurfaceOptions, "id"> {
|
|
49
|
+
children?: ReactNode;
|
|
50
|
+
className?: string;
|
|
51
|
+
style?: Record<string, string | number>;
|
|
52
|
+
tag?: "div" | "span" | "button";
|
|
53
|
+
}
|
|
54
|
+
/** Declarative wrapper: renders a tag whose element is registered and enhanced by the nearest provider. */
|
|
55
|
+
export declare function PhysicsSurface({ children, className, style, tag, ...options }: PhysicsSurfaceProps): import("react").DetailedReactHTMLElement<{
|
|
56
|
+
ref: RefObject<HTMLElement | null>;
|
|
57
|
+
className: string | undefined;
|
|
58
|
+
style: Record<string, string | number> | undefined;
|
|
59
|
+
}, HTMLElement>;
|
|
60
|
+
export { createWorld };
|
|
61
|
+
export type { AnimatterWorld, PresetInput, SurfaceOptions, WorldOptions } from "animatter";
|
|
62
|
+
/** v0.1 compatibility: creates a world bound to a ref'd div. Options are captured on mount. */
|
|
63
|
+
export declare function useAnimatter(options?: Omit<WorldOptions, "root">): {
|
|
64
|
+
ref: RefObject<HTMLDivElement | null>;
|
|
65
|
+
world: AnimatterWorld | null;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* v0.1 compatibility: registers the ref'd element with the given world. Registration depends on the world
|
|
69
|
+
* only; inline option objects no longer cause re-registration on every render.
|
|
70
|
+
*/
|
|
71
|
+
export declare function useSurface<T extends HTMLElement>(world: AnimatterWorld | null, options?: SurfaceOptions): RefObject<T | null>;
|
|
72
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EACL,WAAW,EAEX,KAAK,cAAc,EAEnB,KAAK,WAAW,EAGhB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,iGAAiG;IACjG,IAAI,CAAC,EAAE,MAAM,WAAW,CAAC;IACzB,OAAO,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;CACtC;AAID;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,oBAAoB,kGAahF;AAED,+FAA+F;AAC/F,wBAAgB,eAAe,IAAI,cAAc,GAAG,IAAI,CAEvD;AAED,6GAA6G;AAC7G,wBAAgB,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,MAAM,GAAG,MAAM,CAAC,CAAC;IACxC,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;CACjC;AAED,2GAA2G;AAC3G,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,GAAW,EAAE,GAAG,OAAO,EAAE,EAAE,mBAAmB;;;;gBAG1G;AAED,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE3F,+FAA+F;AAC/F,wBAAgB,YAAY,CAAC,OAAO,GAAE,IAAI,CAAC,YAAY,EAAE,MAAM,CAAM,GAAG;IACtE,GAAG,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACtC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;CAC9B,CAaA;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,WAAW,EAC9C,KAAK,EAAE,cAAc,GAAG,IAAI,EAC5B,OAAO,GAAE,cAAmB,GAC3B,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,CAQrB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { createContext, createElement, useContext, useEffect, useId, useRef, useState, } from "react";
|
|
2
|
+
import { createWorld, presets as builtinPresets, } from "animatter";
|
|
3
|
+
const WorldContext = createContext(null);
|
|
4
|
+
/**
|
|
5
|
+
* Creates one world per provider instance. The world is created inside an effect, so importing this module
|
|
6
|
+
* never touches the DOM, and StrictMode's double effect invocation destroys the first world cleanly.
|
|
7
|
+
*/
|
|
8
|
+
export function PhysicsProvider({ children, root, options }) {
|
|
9
|
+
const [world, setWorld] = useState(null);
|
|
10
|
+
const initial = useRef({ root, options });
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const { root: resolveRoot, options: worldOptions } = initial.current;
|
|
13
|
+
const instance = createWorld({ ...worldOptions, root: resolveRoot?.() ?? document.body });
|
|
14
|
+
setWorld(instance);
|
|
15
|
+
return () => {
|
|
16
|
+
instance.destroy();
|
|
17
|
+
setWorld(null);
|
|
18
|
+
};
|
|
19
|
+
}, []);
|
|
20
|
+
return createElement(WorldContext.Provider, { value: world }, children);
|
|
21
|
+
}
|
|
22
|
+
/** Returns the shared world from the nearest PhysicsProvider, or null until it has mounted. */
|
|
23
|
+
export function usePhysicsWorld() {
|
|
24
|
+
return useContext(WorldContext);
|
|
25
|
+
}
|
|
26
|
+
/** Stable identity for preset lists. Presets are plain definitions, so name plus options identifies them. */
|
|
27
|
+
export function presetKey(presets) {
|
|
28
|
+
if (!presets)
|
|
29
|
+
return "";
|
|
30
|
+
const list = Array.isArray(presets) ? presets : [presets];
|
|
31
|
+
return list.map((p) => `${p.name}:${JSON.stringify(p.options)}`).join("|");
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Applies presets to the element referenced by the returned ref. Changing the preset list updates the
|
|
35
|
+
* existing handle when possible; the surface itself is never re-registered.
|
|
36
|
+
*/
|
|
37
|
+
export function useEnhance(presets, disabled = false) {
|
|
38
|
+
const world = usePhysicsWorld();
|
|
39
|
+
const ref = useRef(null);
|
|
40
|
+
const handleRef = useRef(null);
|
|
41
|
+
const disabledRef = useRef(disabled);
|
|
42
|
+
disabledRef.current = disabled;
|
|
43
|
+
const presetsRef = useRef(presets);
|
|
44
|
+
presetsRef.current = presets;
|
|
45
|
+
const key = presetKey(presets);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const list = presetsRef.current;
|
|
48
|
+
if (!world || !ref.current || !list)
|
|
49
|
+
return;
|
|
50
|
+
const handle = world.enhance(ref.current, list);
|
|
51
|
+
handleRef.current = handle;
|
|
52
|
+
if (disabledRef.current)
|
|
53
|
+
handle.disable();
|
|
54
|
+
return () => {
|
|
55
|
+
handle.destroy();
|
|
56
|
+
if (handleRef.current === handle)
|
|
57
|
+
handleRef.current = null;
|
|
58
|
+
};
|
|
59
|
+
// The preset key identifies the list; the element and world identify the surface.
|
|
60
|
+
}, [world, key]);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
const handle = handleRef.current;
|
|
63
|
+
if (!handle)
|
|
64
|
+
return;
|
|
65
|
+
if (disabled)
|
|
66
|
+
handle.disable();
|
|
67
|
+
else
|
|
68
|
+
handle.enable();
|
|
69
|
+
}, [disabled, world, key]);
|
|
70
|
+
return ref;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Registers an element as a surface and optionally enhances it. Registration depends only on world and id.
|
|
74
|
+
* Material, mode and draggable changes go through world.configure. Preset changes go through the enhancement handle.
|
|
75
|
+
*/
|
|
76
|
+
export function usePhysicsSurface(options = {}) {
|
|
77
|
+
const world = usePhysicsWorld();
|
|
78
|
+
const generated = useId();
|
|
79
|
+
const id = options.id ?? `react-${generated}`;
|
|
80
|
+
const ref = useRef(null);
|
|
81
|
+
const latest = useRef(options);
|
|
82
|
+
latest.current = options;
|
|
83
|
+
const config = JSON.stringify({
|
|
84
|
+
mode: options.mode,
|
|
85
|
+
material: options.material,
|
|
86
|
+
draggable: options.draggable ?? false,
|
|
87
|
+
collision: options.collision ?? false,
|
|
88
|
+
disabled: options.disabled ?? false,
|
|
89
|
+
});
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
if (!world || !ref.current)
|
|
92
|
+
return;
|
|
93
|
+
const { presets: _p, onInteraction: _o, ...surface } = latest.current;
|
|
94
|
+
void _p;
|
|
95
|
+
void _o;
|
|
96
|
+
return world.register(ref.current, { ...surface, id });
|
|
97
|
+
}, [world, id]);
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (!world || !world.spatial.surfaces.has(id))
|
|
100
|
+
return;
|
|
101
|
+
const parsed = JSON.parse(config);
|
|
102
|
+
const patch = {
|
|
103
|
+
draggable: parsed.draggable,
|
|
104
|
+
collision: parsed.collision,
|
|
105
|
+
disabled: parsed.disabled,
|
|
106
|
+
...(parsed.mode !== undefined ? { mode: parsed.mode } : {}),
|
|
107
|
+
...(parsed.material !== undefined ? { material: parsed.material } : {}),
|
|
108
|
+
};
|
|
109
|
+
world.configure(id, patch);
|
|
110
|
+
}, [world, id, config]);
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
if (!world)
|
|
113
|
+
return;
|
|
114
|
+
return world.on((event) => {
|
|
115
|
+
if (event.target !== id)
|
|
116
|
+
return;
|
|
117
|
+
latest.current.onInteraction?.(event);
|
|
118
|
+
});
|
|
119
|
+
}, [world, id]);
|
|
120
|
+
useEnhance(options.presets, options.disabled ?? false);
|
|
121
|
+
return ref;
|
|
122
|
+
}
|
|
123
|
+
/** Shorthand for a magnetic pull toward the pointer. */
|
|
124
|
+
export function useMagnetic(options = {}) {
|
|
125
|
+
const { strength, radius, disabled } = options;
|
|
126
|
+
return usePhysicsSurface({
|
|
127
|
+
presets: builtinPresets.magnetic({
|
|
128
|
+
...(strength !== undefined ? { strength } : {}),
|
|
129
|
+
...(radius !== undefined ? { radius } : {}),
|
|
130
|
+
}),
|
|
131
|
+
disabled: disabled ?? false,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
/** Shorthand for an elastic spring response. */
|
|
135
|
+
export function useSpring(options = {}) {
|
|
136
|
+
const { stiffness, damping, disabled } = options;
|
|
137
|
+
return usePhysicsSurface({
|
|
138
|
+
presets: builtinPresets.elastic({
|
|
139
|
+
...(stiffness !== undefined ? { stiffness } : {}),
|
|
140
|
+
...(damping !== undefined ? { damping } : {}),
|
|
141
|
+
}),
|
|
142
|
+
disabled: disabled ?? false,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/** Draggable surface with damping feedback while dragging. */
|
|
146
|
+
export function usePhysicsDrag(options = {}) {
|
|
147
|
+
return usePhysicsSurface({
|
|
148
|
+
draggable: true,
|
|
149
|
+
presets: builtinPresets.dragFeedback(),
|
|
150
|
+
disabled: options.disabled ?? false,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/** Declarative wrapper: renders a tag whose element is registered and enhanced by the nearest provider. */
|
|
154
|
+
export function PhysicsSurface({ children, className, style, tag = "div", ...options }) {
|
|
155
|
+
const ref = usePhysicsSurface(options);
|
|
156
|
+
return createElement(tag, { ref, className, style }, children);
|
|
157
|
+
}
|
|
158
|
+
export { createWorld };
|
|
159
|
+
/** v0.1 compatibility: creates a world bound to a ref'd div. Options are captured on mount. */
|
|
160
|
+
export function useAnimatter(options = {}) {
|
|
161
|
+
const ref = useRef(null), initial = useRef(options);
|
|
162
|
+
const [world, setWorld] = useState(null);
|
|
163
|
+
useEffect(() => {
|
|
164
|
+
if (!ref.current)
|
|
165
|
+
return;
|
|
166
|
+
const instance = createWorld({ ...initial.current, root: ref.current });
|
|
167
|
+
setWorld(instance);
|
|
168
|
+
return () => {
|
|
169
|
+
instance.destroy();
|
|
170
|
+
};
|
|
171
|
+
}, []);
|
|
172
|
+
return { ref, world };
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* v0.1 compatibility: registers the ref'd element with the given world. Registration depends on the world
|
|
176
|
+
* only; inline option objects no longer cause re-registration on every render.
|
|
177
|
+
*/
|
|
178
|
+
export function useSurface(world, options = {}) {
|
|
179
|
+
const ref = useRef(null);
|
|
180
|
+
const latest = useRef(options);
|
|
181
|
+
latest.current = options;
|
|
182
|
+
useEffect(() => {
|
|
183
|
+
if (world && ref.current)
|
|
184
|
+
return world.register(ref.current, latest.current);
|
|
185
|
+
}, [world]);
|
|
186
|
+
return ref;
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,SAAS,EACT,KAAK,EACL,MAAM,EACN,QAAQ,GAGT,MAAM,OAAO,CAAC;AACf,OAAO,EACL,WAAW,EACX,OAAO,IAAI,cAAc,GAS1B,MAAM,WAA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;IAE5B,MAAM,GAAG,GAAG,MAAM,CAAI,IAAI,CAAC,CAAC;IAC5B,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,KAAK,IAAI,GAAG,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/E,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACZ,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@animatter/react",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"README.md",
|
|
9
|
+
"LICENSE"
|
|
10
|
+
],
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"animatter": "^0.2.0",
|
|
21
|
+
"react": ">=18"
|
|
22
|
+
},
|
|
23
|
+
"description": "React lifecycle hooks for the shared Animatter.js physics interaction runtime",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/Alanshown/Animatter.js.git",
|
|
27
|
+
"directory": "packages/react"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://github.com/Alanshown/Animatter.js#readme",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/Alanshown/Animatter.js/issues"
|
|
32
|
+
},
|
|
33
|
+
"author": "Alanshown",
|
|
34
|
+
"keywords": [
|
|
35
|
+
"physics",
|
|
36
|
+
"interaction",
|
|
37
|
+
"animation",
|
|
38
|
+
"typescript",
|
|
39
|
+
"web",
|
|
40
|
+
"react"
|
|
41
|
+
],
|
|
42
|
+
"sideEffects": false,
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public",
|
|
45
|
+
"registry": "https://registry.npmjs.org/"
|
|
46
|
+
}
|
|
47
|
+
}
|