@zzalai/leafer-point-annotation 1.1.0 → 1.1.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/README.md +55 -1
- package/README_EN.md +55 -1
- package/package.json +7 -2
- package/tsconfig.json +5 -1
- package/vite.config.ts +6 -1
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ pnpm add @zzalai/leafer-point-annotation
|
|
|
38
38
|
|
|
39
39
|
## 快速开始
|
|
40
40
|
|
|
41
|
-
###
|
|
41
|
+
### 使用远程图片
|
|
42
42
|
|
|
43
43
|
```vue
|
|
44
44
|
<template>
|
|
@@ -60,6 +60,7 @@ pnpm add @zzalai/leafer-point-annotation
|
|
|
60
60
|
<script setup lang="ts">
|
|
61
61
|
import { ref, computed } from 'vue'
|
|
62
62
|
import { PointAnnotation } from '@zzalai/leafer-point-annotation'
|
|
63
|
+
import '@zzalai/leafer-point-annotation/dist/leafer-point-annotation.css'
|
|
63
64
|
|
|
64
65
|
const annotationRef = ref<InstanceType<typeof PointAnnotation> | null>(null)
|
|
65
66
|
const imageSource = computed(() => ({
|
|
@@ -127,6 +128,59 @@ const exportMask = async () => {
|
|
|
127
128
|
</style>
|
|
128
129
|
```
|
|
129
130
|
|
|
131
|
+
### 使用本地图片上传
|
|
132
|
+
|
|
133
|
+
不提供 `imageSource` prop 时,会显示本地上传界面,支持点击选择或拖拽上传。
|
|
134
|
+
|
|
135
|
+
```vue
|
|
136
|
+
<template>
|
|
137
|
+
<div class="demo-container">
|
|
138
|
+
<PointAnnotation
|
|
139
|
+
ref="annotationRef"
|
|
140
|
+
:options="options"
|
|
141
|
+
@pointChange="handlePointChange"
|
|
142
|
+
@loadSuccess="handleLoadSuccess"
|
|
143
|
+
/>
|
|
144
|
+
</div>
|
|
145
|
+
</template>
|
|
146
|
+
|
|
147
|
+
<script setup lang="ts">
|
|
148
|
+
import { ref } from 'vue'
|
|
149
|
+
import { PointAnnotation } from '@zzalai/leafer-point-annotation'
|
|
150
|
+
import '@zzalai/leafer-point-annotation/dist/leafer-point-annotation.css'
|
|
151
|
+
|
|
152
|
+
const annotationRef = ref<InstanceType<typeof PointAnnotation> | null>(null)
|
|
153
|
+
|
|
154
|
+
const options = ref({
|
|
155
|
+
pointStyle: {
|
|
156
|
+
circleFill: '#ff4d4f',
|
|
157
|
+
circleStroke: '#ffffff',
|
|
158
|
+
labelBackgroundColor: '#ffffff'
|
|
159
|
+
},
|
|
160
|
+
brushStyle: {
|
|
161
|
+
color: '#ff4d4f',
|
|
162
|
+
opacity: 0.55,
|
|
163
|
+
size: 100
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
const handlePointChange = (points) => {
|
|
168
|
+
console.log('标注点变化:', points)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const handleLoadSuccess = () => {
|
|
172
|
+
console.log('图片加载成功')
|
|
173
|
+
}
|
|
174
|
+
</script>
|
|
175
|
+
|
|
176
|
+
<style scoped>
|
|
177
|
+
.demo-container {
|
|
178
|
+
width: 100%;
|
|
179
|
+
height: 600px;
|
|
180
|
+
}
|
|
181
|
+
</style>
|
|
182
|
+
```
|
|
183
|
+
|
|
130
184
|
## API 文档
|
|
131
185
|
|
|
132
186
|
### Props
|
package/README_EN.md
CHANGED
|
@@ -38,7 +38,7 @@ pnpm add @zzalai/leafer-point-annotation
|
|
|
38
38
|
|
|
39
39
|
## Quick Start
|
|
40
40
|
|
|
41
|
-
###
|
|
41
|
+
### Using Remote Image
|
|
42
42
|
|
|
43
43
|
```vue
|
|
44
44
|
<template>
|
|
@@ -60,6 +60,7 @@ pnpm add @zzalai/leafer-point-annotation
|
|
|
60
60
|
<script setup lang="ts">
|
|
61
61
|
import { ref, computed } from 'vue'
|
|
62
62
|
import { PointAnnotation } from '@zzalai/leafer-point-annotation'
|
|
63
|
+
import '@zzalai/leafer-point-annotation/dist/leafer-point-annotation.css'
|
|
63
64
|
|
|
64
65
|
const annotationRef = ref<InstanceType<typeof PointAnnotation> | null>(null)
|
|
65
66
|
const imageSource = computed(() => ({
|
|
@@ -127,6 +128,59 @@ const exportMask = async () => {
|
|
|
127
128
|
</style>
|
|
128
129
|
```
|
|
129
130
|
|
|
131
|
+
### Using Local Image Upload
|
|
132
|
+
|
|
133
|
+
When not providing the `imageSource` prop, the local upload interface will be displayed, supporting click to select or drag and drop.
|
|
134
|
+
|
|
135
|
+
```vue
|
|
136
|
+
<template>
|
|
137
|
+
<div class="demo-container">
|
|
138
|
+
<PointAnnotation
|
|
139
|
+
ref="annotationRef"
|
|
140
|
+
:options="options"
|
|
141
|
+
@pointChange="handlePointChange"
|
|
142
|
+
@loadSuccess="handleLoadSuccess"
|
|
143
|
+
/>
|
|
144
|
+
</div>
|
|
145
|
+
</template>
|
|
146
|
+
|
|
147
|
+
<script setup lang="ts">
|
|
148
|
+
import { ref } from 'vue'
|
|
149
|
+
import { PointAnnotation } from '@zzalai/leafer-point-annotation'
|
|
150
|
+
import '@zzalai/leafer-point-annotation/dist/leafer-point-annotation.css'
|
|
151
|
+
|
|
152
|
+
const annotationRef = ref<InstanceType<typeof PointAnnotation> | null>(null)
|
|
153
|
+
|
|
154
|
+
const options = ref({
|
|
155
|
+
pointStyle: {
|
|
156
|
+
circleFill: '#ff4d4f',
|
|
157
|
+
circleStroke: '#ffffff',
|
|
158
|
+
labelBackgroundColor: '#ffffff'
|
|
159
|
+
},
|
|
160
|
+
brushStyle: {
|
|
161
|
+
color: '#ff4d4f',
|
|
162
|
+
opacity: 0.55,
|
|
163
|
+
size: 100
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
const handlePointChange = (points) => {
|
|
168
|
+
console.log('Points changed:', points)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const handleLoadSuccess = () => {
|
|
172
|
+
console.log('Image loaded successfully')
|
|
173
|
+
}
|
|
174
|
+
</script>
|
|
175
|
+
|
|
176
|
+
<style scoped>
|
|
177
|
+
.demo-container {
|
|
178
|
+
width: 100%;
|
|
179
|
+
height: 600px;
|
|
180
|
+
}
|
|
181
|
+
</style>
|
|
182
|
+
```
|
|
183
|
+
|
|
130
184
|
## API Documentation
|
|
131
185
|
|
|
132
186
|
### Props
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zzalai/leafer-point-annotation",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "A Vue3 component for point annotation and brush painting on images using LeaferJS, supporting COCO/YOLO/JSON export, designed for AI model training dataset annotation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
"import": "./dist/leafer-point-annotation.es.js",
|
|
15
15
|
"require": "./dist/leafer-point-annotation.umd.js",
|
|
16
16
|
"types": "./dist/index.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./dist/leafer-point-annotation.css": {
|
|
19
|
+
"import": "./dist/leafer-point-annotation.css",
|
|
20
|
+
"require": "./dist/leafer-point-annotation.css"
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
23
|
"scripts": {
|
|
@@ -57,9 +61,10 @@
|
|
|
57
61
|
"devDependencies": {
|
|
58
62
|
"@types/node": "^25.6.0",
|
|
59
63
|
"@vitejs/plugin-vue": "^6.0.6",
|
|
64
|
+
"@vue/language-core": "^3.3.3",
|
|
60
65
|
"terser": "^5.46.1",
|
|
61
66
|
"typescript": "^6.0.2",
|
|
62
67
|
"vite": "^8.0.8",
|
|
63
|
-
"vite-plugin-dts": "^
|
|
68
|
+
"vite-plugin-dts": "^5.0.2"
|
|
64
69
|
}
|
|
65
70
|
}
|
package/tsconfig.json
CHANGED
|
@@ -17,7 +17,11 @@
|
|
|
17
17
|
"noFallthroughCasesInSwitch": true,
|
|
18
18
|
"paths": {
|
|
19
19
|
"@/*": ["./src/*"]
|
|
20
|
-
}
|
|
20
|
+
},
|
|
21
|
+
"declaration": true,
|
|
22
|
+
"declarationDir": "./dist",
|
|
23
|
+
"rootDir": "./src",
|
|
24
|
+
"emitDeclarationOnly": false
|
|
21
25
|
},
|
|
22
26
|
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
|
|
23
27
|
"references": [{ "path": "./tsconfig.node.json" }]
|
package/vite.config.ts
CHANGED
|
@@ -6,7 +6,12 @@ import path from 'path'
|
|
|
6
6
|
export default defineConfig({
|
|
7
7
|
plugins: [
|
|
8
8
|
vue(),
|
|
9
|
-
process.env.NODE_ENV === 'production' ? dts(
|
|
9
|
+
process.env.NODE_ENV === 'production' ? dts({
|
|
10
|
+
outDirs: ['dist'],
|
|
11
|
+
include: ['src/**/*.ts', 'src/**/*.vue'],
|
|
12
|
+
exclude: ['src/**/*.spec.ts', 'src/**/*.test.ts'],
|
|
13
|
+
tsconfigPath: './tsconfig.json'
|
|
14
|
+
}) : null
|
|
10
15
|
].filter(Boolean),
|
|
11
16
|
resolve: {
|
|
12
17
|
alias: {
|