@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 CHANGED
@@ -1,51 +1,50 @@
1
1
  {
2
- "name": "@hprint/plugins",
3
- "version": "0.0.1-alpha.0",
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
- "scripts": {
16
- "build": "vite build",
17
- "clean": "node -e \"require('fs').rmSync('dist', {recursive: true, force: true})\"",
18
- "type-check": "tsc --noEmit",
19
- "watch": "vite build --watch",
20
- "test": "echo \"Error: no test specified\" && exit 1"
21
- },
22
- "dependencies": {
23
- "@hprint/core": "workspace:*",
24
- "@hprint/shared": "workspace:*",
25
- "@webtoon/psd": "^0.4.0",
26
- "axios": "^1.13.2",
27
- "fontfaceobserver": "~2.1.0",
28
- "jsbarcode": "~3.12.1",
29
- "lodash-es": "^4.17.21",
30
- "qr-code-styling": "^1.9.2",
31
- "qs": "~6.12.3",
32
- "socket.io-client": "^4.8.1",
33
- "uuid": "~8.3.2"
34
- },
35
- "devDependencies": {
36
- "@types/fontfaceobserver": "~2.1.3",
37
- "@types/lodash-es": "^4.17.12",
38
- "@types/qs": "^6.14.0",
39
- "@types/uuid": "^9.0.8",
40
- "rimraf": "^6.1.2",
41
- "vite": "^7.2.4",
42
- "vite-plugin-dts": "^4.5.4"
43
- },
44
- "keywords": [],
45
- "author": "george-hong",
46
- "license": "ISC",
47
- "publishConfig": {
48
- "access": "public"
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 isImage = (this as any).type === 'image';
155
- let valPx: number | undefined;
156
- if (isImage && (field === 'width' || field === 'height')) {
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')