@hprint/plugins 0.0.1-alpha.0 → 0.0.1-alpha.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 +48 -49
- package/src/plugins/CreateElementPlugin.ts +3 -32
package/package.json
CHANGED
|
@@ -1,51 +1,50 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"packageManager": "pnpm@10.20.0"
|
|
2
|
+
"name": "@hprint/plugins",
|
|
3
|
+
"version": "0.0.1-alpha.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@webtoon/psd": "^0.4.0",
|
|
17
|
+
"axios": "^1.13.2",
|
|
18
|
+
"fontfaceobserver": "~2.1.0",
|
|
19
|
+
"jsbarcode": "~3.12.1",
|
|
20
|
+
"lodash-es": "^4.17.21",
|
|
21
|
+
"qr-code-styling": "^1.9.2",
|
|
22
|
+
"qs": "~6.12.3",
|
|
23
|
+
"socket.io-client": "^4.8.1",
|
|
24
|
+
"uuid": "~8.3.2",
|
|
25
|
+
"@hprint/core": "0.0.1-alpha.1",
|
|
26
|
+
"@hprint/shared": "0.0.1-alpha.1"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/fontfaceobserver": "~2.1.3",
|
|
30
|
+
"@types/lodash-es": "^4.17.12",
|
|
31
|
+
"@types/qs": "^6.14.0",
|
|
32
|
+
"@types/uuid": "^9.0.8",
|
|
33
|
+
"rimraf": "^6.1.2",
|
|
34
|
+
"vite": "^7.2.4",
|
|
35
|
+
"vite-plugin-dts": "^4.5.4"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [],
|
|
38
|
+
"author": "george-hong",
|
|
39
|
+
"license": "ISC",
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "vite build",
|
|
45
|
+
"clean": "node -e \"require('fs').rmSync('dist', {recursive: true, force: true})\"",
|
|
46
|
+
"type-check": "tsc --noEmit",
|
|
47
|
+
"watch": "vite build --watch",
|
|
48
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
49
|
+
}
|
|
51
50
|
}
|
|
@@ -151,22 +151,9 @@ class CreateElementPlugin implements IPluginTempl {
|
|
|
151
151
|
hasFieldsArray && (fieldsOrDpi as string[])?.length ? (fieldsOrDpi as string[]) : singleFields;
|
|
152
152
|
targetFields.forEach((field) => {
|
|
153
153
|
if (field === 'points') return;
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
const base = field === 'width' ? (this as any).width : (this as any).height;
|
|
158
|
-
const scale = field === 'width' ? ((this as any).scaleX ?? 1) : ((this as any).scaleY ?? 1);
|
|
159
|
-
if (typeof base === 'number' && !isNaN(base)) {
|
|
160
|
-
valPx = base * scale;
|
|
161
|
-
}
|
|
162
|
-
} else {
|
|
163
|
-
const currentVal = (this as any).get ? (this as any).get(field) : (this as any)[field];
|
|
164
|
-
if (typeof currentVal === 'number' && !isNaN(currentVal)) {
|
|
165
|
-
valPx = currentVal;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
if (typeof valPx === 'number' && !isNaN(valPx)) {
|
|
169
|
-
origin[field] = editorRef.getSizeByUnit(valPx);
|
|
154
|
+
const currentVal = (this as any).get ? (this as any).get(field) : (this as any)[field];
|
|
155
|
+
if (typeof currentVal === 'number' && !isNaN(currentVal)) {
|
|
156
|
+
origin[field] = editorRef.getSizeByUnit(currentVal);
|
|
170
157
|
}
|
|
171
158
|
});
|
|
172
159
|
const shouldSyncPoints =
|
|
@@ -364,14 +351,6 @@ class CreateElementPlugin implements IPluginTempl {
|
|
|
364
351
|
const unit = getUnit(this.editor);
|
|
365
352
|
const precision = (this.editor as any).getPrecision?.();
|
|
366
353
|
this.addSetAndSyncByUnit(img);
|
|
367
|
-
(img as any).off?.('scaled');
|
|
368
|
-
(img as any).off?.('modified');
|
|
369
|
-
(img as any).on?.('scaled', () => {
|
|
370
|
-
(img as any).syncOriginSizeByUnit?.(['width', 'height']);
|
|
371
|
-
});
|
|
372
|
-
(img as any).on?.('modified', () => {
|
|
373
|
-
(img as any).syncOriginSizeByUnit?.(['width', 'height']);
|
|
374
|
-
});
|
|
375
354
|
if (opts) {
|
|
376
355
|
const singleFields = CreateElementPlugin.lengthFieldConfigs.filter((c) => c.dealMethod === 'single').map((c) => c.field);
|
|
377
356
|
const { originByUnit } = processOptions(opts, unit, dpi, singleFields);
|
|
@@ -436,14 +415,6 @@ class CreateElementPlugin implements IPluginTempl {
|
|
|
436
415
|
const unit = getUnit(this.editor);
|
|
437
416
|
const precision = (this.editor as any).getPrecision?.();
|
|
438
417
|
this.addSetAndSyncByUnit(img);
|
|
439
|
-
(img as any).off?.('scaled');
|
|
440
|
-
(img as any).off?.('modified');
|
|
441
|
-
(img as any).on?.('scaled', () => {
|
|
442
|
-
(img as any).syncOriginSizeByUnit?.(['width', 'height']);
|
|
443
|
-
});
|
|
444
|
-
(img as any).on?.('modified', () => {
|
|
445
|
-
(img as any).syncOriginSizeByUnit?.(['width', 'height']);
|
|
446
|
-
});
|
|
447
418
|
if (opts) {
|
|
448
419
|
const singleFields = CreateElementPlugin.lengthFieldConfigs
|
|
449
420
|
.filter((c) => c.dealMethod === 'single')
|