@splicetree/plugin-pointer 0.3.0 → 1.0.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/CHANGELOG.md +6 -0
- package/README.md +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/package.json +2 -2
- package/src/index.ts +3 -3
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -23,14 +23,14 @@ const tree = createSpliceTree(data, {
|
|
|
23
23
|
})
|
|
24
24
|
|
|
25
25
|
// 在视图中调用
|
|
26
|
-
//
|
|
27
|
-
tree.
|
|
26
|
+
// inputNodeClick(nodeId, e) 会派发 input:node-click 事件(包含修饰键)
|
|
27
|
+
tree.inputNodeClick('a', mouseEvent)
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
## Api
|
|
31
31
|
|
|
32
32
|
- 事件派发
|
|
33
|
-
- `
|
|
33
|
+
- `inputNodeClick(nodeId, e: MouseEvent)` 派发 `input:node-click`
|
|
34
34
|
- 事件负载
|
|
35
35
|
- `nodeId: string`
|
|
36
36
|
- `modifiers: { shift: boolean; ctrl: boolean; meta: boolean; alt: boolean }`
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -10,14 +10,14 @@ function getModifiers(e) {
|
|
|
10
10
|
const pointerPlugin = {
|
|
11
11
|
name: "pointer",
|
|
12
12
|
setup(ctx) {
|
|
13
|
-
const
|
|
13
|
+
const inputNodeClick = (nodeId, e) => {
|
|
14
14
|
ctx.events.emit({
|
|
15
15
|
name: "input:node-click",
|
|
16
16
|
nodeId,
|
|
17
17
|
modifiers: getModifiers(e)
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
|
-
return {
|
|
20
|
+
return { inputNodeClick };
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
var src_default = pointerPlugin;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splicetree/plugin-pointer",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "michael.cocova@gmail.com",
|
|
7
7
|
"name": "Michael Cocova"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@splicetree/core": "0.
|
|
26
|
+
"@splicetree/core": "1.0.0"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"dev": "tsdown --watch",
|
package/src/index.ts
CHANGED
|
@@ -16,7 +16,7 @@ declare module '@splicetree/core' {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
export interface SpliceTreeInstance {
|
|
19
|
-
|
|
19
|
+
inputNodeClick: (nodeId: string, e: MouseEvent) => void
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -32,14 +32,14 @@ function getModifiers(e: MouseEvent) {
|
|
|
32
32
|
export const pointerPlugin: SpliceTreePlugin = {
|
|
33
33
|
name: 'pointer',
|
|
34
34
|
setup(ctx: SpliceTreePluginContext) {
|
|
35
|
-
const
|
|
35
|
+
const inputNodeClick = (nodeId: string, e: MouseEvent) => {
|
|
36
36
|
ctx.events.emit({
|
|
37
37
|
name: 'input:node-click',
|
|
38
38
|
nodeId,
|
|
39
39
|
modifiers: getModifiers(e),
|
|
40
40
|
})
|
|
41
41
|
}
|
|
42
|
-
return {
|
|
42
|
+
return { inputNodeClick }
|
|
43
43
|
},
|
|
44
44
|
}
|
|
45
45
|
|