leafer-x-tooltip-canvas 1.0.0 → 1.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/package.json CHANGED
@@ -1,52 +1,63 @@
1
1
  {
2
- "name": "leafer-x-tooltip-canvas",
3
- "version": "1.0.0",
4
- "author": "214L",
5
- "license": "MIT",
6
- "type": "module",
7
- "main": "dist/index.esm.js",
8
- "exports": {
9
- "import": "./dist/index.esm.js",
10
- "require": "./dist/index.cjs"
11
- },
12
- "types": "types/index.d.ts",
13
- "files": ["src", "types", "dev", "dist"],
14
- "repository": {
15
- "type": "git",
16
- "url": "https://github.com/214L/leafer-x-popup-canvas"
17
- },
18
- "homepage": "https://github.com/214L/leafer-x-popup-canvas",
19
- "bugs": "https://github.com/214L/leafer-x-popup-canvas/issues",
20
- "scripts": {
21
- "start": "cross-env NODE_ENV=development rollup -c -w",
22
- "build": "cross-env PLATFORM=all rollup -c",
23
- "test": "vitest"
24
- },
25
- "devDependencies": {
26
- "@rollup/plugin-commonjs": "^25.0.4",
27
- "@rollup/plugin-html": "^1.0.2",
28
- "@rollup/plugin-multi-entry": "^6.0.0",
29
- "@rollup/plugin-node-resolve": "^15.2.1",
30
- "@rollup/plugin-terser": "^0.4.3",
31
- "@rollup/plugin-typescript": "^11.1.3",
32
- "@typescript-eslint/eslint-plugin": "^5.54.1",
33
- "@typescript-eslint/parser": "^5.54.1",
34
- "rollup": "^3.29.2",
35
- "rollup-plugin-dts": "^6.0.2",
36
- "rollup-plugin-livereload": "^2.0.5",
37
- "rollup-plugin-serve": "^2.0.2",
38
- "rollup-plugin-string": "^3.0.0",
39
- "tslib": "^2.6.2",
40
- "typescript": "^5.2.2",
41
- "vite": "^4.4.9",
42
- "vitest": "^0.34.4",
43
- "jsdom": "^22.0.0",
44
- "cross-env": "^7.0.3",
45
- "eslint": "^8.49.0",
46
- "leafer-ui": "^1.0.0-rc.22"
47
- },
48
- "dependencies": {
49
- "@leafer-ui/core": "^1.0.0-rc.22"
50
- },
51
- "publishConfig": { "registry": "https://registry.npmjs.org" }
2
+ "name": "leafer-x-tooltip-canvas",
3
+ "description": "A tooltip plugin for Leafer-ui.",
4
+ "version": "1.0.1",
5
+ "author": "214L",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "main": "dist/index.esm.js",
9
+ "exports": {
10
+ "import": "./dist/index.esm.js",
11
+ "require": "./dist/index.cjs"
12
+ },
13
+ "types": "types/index.d.ts",
14
+ "files": [
15
+ "src",
16
+ "types",
17
+ "dev",
18
+ "dist"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/214L/leafer-x-tooltip-canvas"
23
+ },
24
+ "homepage": "https://github.com/214L/leafer-x-tooltip-canvas",
25
+ "bugs": "https://github.com/214L/leafer-x-tooltip-canvas/issues",
26
+ "scripts": {
27
+ "start": "cross-env NODE_ENV=development rollup -c -w",
28
+ "build": "cross-env PLATFORM=all rollup -c",
29
+ "test": "vitest"
30
+ },
31
+ "devDependencies": {
32
+ "@rollup/plugin-commonjs": "^25.0.4",
33
+ "@rollup/plugin-html": "^1.0.2",
34
+ "@rollup/plugin-multi-entry": "^6.0.0",
35
+ "@rollup/plugin-node-resolve": "^15.2.1",
36
+ "@rollup/plugin-terser": "^0.4.3",
37
+ "@rollup/plugin-typescript": "^11.1.3",
38
+ "@typescript-eslint/eslint-plugin": "^5.54.1",
39
+ "@typescript-eslint/parser": "^5.54.1",
40
+ "rollup": "^3.29.2",
41
+ "rollup-plugin-dts": "^6.0.2",
42
+ "rollup-plugin-livereload": "^2.0.5",
43
+ "rollup-plugin-serve": "^2.0.2",
44
+ "rollup-plugin-string": "^3.0.0",
45
+ "rollup-plugin-copy": "^3.5.0",
46
+ "tslib": "^2.6.2",
47
+ "typescript": "^5.2.2",
48
+ "vite": "^4.4.9",
49
+ "vitest": "^0.34.4",
50
+ "jsdom": "^22.0.0",
51
+ "cross-env": "^7.0.3",
52
+ "eslint": "^8.49.0",
53
+ "leafer-ui": "^1.0.4"
54
+ },
55
+ "dependencies": {
56
+ "@leafer-ui/core": "^1.0.4",
57
+ "leafer-ui": "^1.0.4",
58
+ "@leafer-in/flow": "^1.0.4"
59
+ },
60
+ "publishConfig": {
61
+ "registry": "https://registry.npmjs.org"
62
+ }
52
63
  }
@@ -1,9 +1,5 @@
1
1
  import { App, PointerEvent } from '@leafer-ui/core'
2
- import type {
3
- IEventListenerId,
4
- ILeaf,
5
- ILeafer,
6
- } from '@leafer-ui/interface'
2
+ import type { IEventListenerId, ILeaf, ILeafer } from '@leafer-ui/interface'
7
3
  import { IUserConfig } from './interface'
8
4
  import { Tooltip } from './Tooltip'
9
5
  import { getTooltipId } from './utils'
@@ -54,13 +50,13 @@ export class TooltipPlugin {
54
50
  }
55
51
  }
56
52
 
57
- private handleConfig(){
58
- if(this.config.theme==='dark'){
59
- this.config.style.backgroundColor = "black"
60
- this.config.style.color = "white"
61
- }
53
+ private handleConfig() {
54
+ if (this.config.theme === 'dark') {
55
+ this.config.style.backgroundColor = 'black'
56
+ this.config.style.color = 'white'
62
57
  }
63
-
58
+ }
59
+
64
60
  /**
65
61
  * @description 初始化事件处理
66
62
  * @private
@@ -95,12 +91,13 @@ export class TooltipPlugin {
95
91
  }
96
92
  this.handleTooltip(event, target)
97
93
  }
98
-
99
94
  private filterTarget(list: ILeaf[]): ILeaf | null {
100
- const ignoreTag = ['Leafer', 'App']
95
+ const { ignoreType, excludesType, throughExcludes } = this.config
96
+ const arr = throughExcludes ? ignoreType.concat(excludesType) : ignoreType
97
+
101
98
  const pureResult = list.filter((item) => {
102
99
  if (
103
- ignoreTag.includes(item?.tag) ||
100
+ arr.includes(item?.tag) ||
104
101
  item?.parent?.tag === 'Tooltip' ||
105
102
  item?.className === 'leafer-x-tooltip'
106
103
  ) {
@@ -12,6 +12,8 @@ export const defaultConfig: IUserConfig = {
12
12
  preventOverflow: false,
13
13
  includesType: [],
14
14
  excludesType: [],
15
+ ignoreType:['Leafer','App','Flow'],
16
+ throughExcludes:false,
15
17
  theme: 'light',
16
18
  style: {
17
19
  backgroundColor: 'white',
@@ -24,6 +24,8 @@ interface IUserConfig {
24
24
  preventOverflow?: boolean
25
25
  includesType?: Array<string>
26
26
  excludesType?: Array<string>
27
+ ignoreType?: Array<string>
28
+ throughExcludes?: boolean
27
29
  theme?: 'light' | 'dark'
28
30
  style?: IStyleConfig
29
31
  }
package/types/index.d.ts CHANGED
@@ -14,6 +14,8 @@ interface IUserConfig {
14
14
  preventOverflow?: boolean;
15
15
  includesType?: Array<string>;
16
16
  excludesType?: Array<string>;
17
+ ignoreType?: Array<string>;
18
+ throughExcludes?: boolean;
17
19
  theme?: 'light' | 'dark';
18
20
  style?: IStyleConfig;
19
21
  }