@supermousejs/states 2.0.0 → 2.0.1
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/CHANGELOG.md +9 -0
- package/README.md +40 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
|
|
2
|
+
# @supermousejs/states
|
|
3
|
+
|
|
4
|
+
A **Logic Controller** that enables/disables other plugins based on hover attributes.
|
|
5
|
+
Useful for creating complex interaction modes (e.g. "View" mode vs "Edit" mode).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @supermousejs/states
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { Supermouse } from '@supermousejs/core';
|
|
17
|
+
import { States } from '@supermousejs/states';
|
|
18
|
+
|
|
19
|
+
const app = new Supermouse();
|
|
20
|
+
|
|
21
|
+
// Define your plugins normally (names are required)
|
|
22
|
+
app.use(Dot({ name: 'dot' }));
|
|
23
|
+
app.use(Ring({ name: 'ring' }));
|
|
24
|
+
app.use(Text({ name: 'text' }));
|
|
25
|
+
|
|
26
|
+
// Configure states
|
|
27
|
+
app.use(States({
|
|
28
|
+
default: ['dot'], // Plugins active by default
|
|
29
|
+
states: {
|
|
30
|
+
'hover': ['dot', 'ring'],
|
|
31
|
+
'info': ['text']
|
|
32
|
+
}
|
|
33
|
+
}));
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**HTML:**
|
|
37
|
+
```html
|
|
38
|
+
<div data-supermouse-state="hover">Hover me</div>
|
|
39
|
+
<div data-supermouse-state="info" data-supermouse-text="Hello">Info</div>
|
|
40
|
+
```
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supermousejs/states",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"main": "dist/index.umd.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@supermousejs/core": "2.0.
|
|
9
|
-
"@supermousejs/utils": "2.0.
|
|
8
|
+
"@supermousejs/core": "2.0.1",
|
|
9
|
+
"@supermousejs/utils": "2.0.1"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {},
|
|
12
12
|
"peerDependencies": {},
|