@splicetree/plugin-pointer 0.2.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @splicetree/plugin-pointer
2
2
 
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 重命名实例方法:`onClick` 更名为 `inputNodeClick`,与事件 `input:node-click` 保持一致的语义。请将调用更新为:`tree.inputNodeClick(nodeId, e)`;所有文档与示例已同步更新。此更改为不兼容更新。
8
+
9
+ ## 0.3.0
10
+
3
11
  ## 0.2.0
4
12
 
5
13
  ### Minor Changes
package/README.md CHANGED
@@ -23,14 +23,14 @@ const tree = createSpliceTree(data, {
23
23
  })
24
24
 
25
25
  // 在视图中调用
26
- // onClick(nodeId, e) 会派发 input:node-click 事件(包含修饰键)
27
- tree.onClick('a', mouseEvent)
26
+ // inputNodeClick(nodeId, e) 会派发 input:node-click 事件(包含修饰键)
27
+ tree.inputNodeClick('a', mouseEvent)
28
28
  ```
29
29
 
30
30
  ## Api
31
31
 
32
32
  - 事件派发
33
- - `onClick(nodeId, e: MouseEvent)` 派发 `input:node-click`
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
@@ -15,7 +15,7 @@ declare module '@splicetree/core' {
15
15
  };
16
16
  }
17
17
  interface SpliceTreeInstance {
18
- onClick: (nodeId: string, e: MouseEvent) => void;
18
+ inputNodeClick: (nodeId: string, e: MouseEvent) => void;
19
19
  }
20
20
  }
21
21
  declare const pointerPlugin: SpliceTreePlugin;
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 onClick = (nodeId, e) => {
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 { onClick };
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.2.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.2.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
- onClick: (nodeId: string, e: MouseEvent) => void
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 onClick = (nodeId: string, e: MouseEvent) => {
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 { onClick }
42
+ return { inputNodeClick }
43
43
  },
44
44
  }
45
45