@operato/ocr 0.2.9 → 0.2.20

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/demo/index.html +699 -25
  3. package/dist/src/index.d.ts +1 -1
  4. package/dist/src/index.js +1 -1
  5. package/dist/src/index.js.map +1 -1
  6. package/dist/src/ox-camera-capturer.d.ts +14 -0
  7. package/dist/src/ox-camera-capturer.js +178 -0
  8. package/dist/src/ox-camera-capturer.js.map +1 -0
  9. package/dist/src/{ocr-helper.d.ts → ox-ocr-helper.d.ts} +8 -4
  10. package/dist/src/{ocr-helper.js → ox-ocr-helper.js} +47 -51
  11. package/dist/src/ox-ocr-helper.js.map +1 -0
  12. package/dist/src/ox-ocr-result-image.d.ts +37 -0
  13. package/dist/src/ox-ocr-result-image.js +279 -0
  14. package/dist/src/ox-ocr-result-image.js.map +1 -0
  15. package/dist/src/type.d.ts +15 -0
  16. package/dist/src/type.js +6 -0
  17. package/dist/src/type.js.map +1 -0
  18. package/dist/src/utils/file-drop-helper.d.ts +16 -0
  19. package/dist/src/utils/file-drop-helper.js +47 -0
  20. package/dist/src/utils/file-drop-helper.js.map +1 -0
  21. package/dist/src/utils/touch-to-mouse-event.d.ts +1 -0
  22. package/dist/src/utils/touch-to-mouse-event.js +34 -0
  23. package/dist/src/utils/touch-to-mouse-event.js.map +1 -0
  24. package/dist/stories/index.stories.d.ts +1 -1
  25. package/dist/stories/index.stories.js +10 -14
  26. package/dist/stories/index.stories.js.map +1 -1
  27. package/dist/test/ox-ocr-helper.test.d.ts +1 -0
  28. package/dist/test/{ocr-helper.test.js → ox-ocr-helper.test.js} +7 -7
  29. package/dist/test/ox-ocr-helper.test.js.map +1 -0
  30. package/dist/tsconfig.tsbuildinfo +1 -1
  31. package/package.json +4 -27
  32. package/src/index.ts +1 -1
  33. package/src/ox-camera-capturer.ts +189 -0
  34. package/src/{ocr-helper.ts → ox-ocr-helper.ts} +43 -49
  35. package/src/ox-ocr-result-image.ts +303 -0
  36. package/src/type.ts +13 -0
  37. package/src/utils/file-drop-helper.ts +62 -0
  38. package/src/utils/touch-to-mouse-event.ts +39 -0
  39. package/stories/index.stories.ts +29 -37
  40. package/test/{ocr-helper.test.ts → ox-ocr-helper.test.ts} +8 -7
  41. package/dist/src/ocr-helper.js.map +0 -1
  42. package/dist/test/ocr-helper.test.d.ts +0 -1
  43. package/dist/test/ocr-helper.test.js.map +0 -1
  44. package/src/camera-capturer.js +0 -184
package/demo/index.html CHANGED
@@ -1,29 +1,703 @@
1
- <!doctype html>
1
+ <!DOCTYPE html>
2
2
  <html lang="en-GB">
3
- <head>
4
- <meta charset="utf-8">
5
- <style>
6
- body {
7
- background: #fafafa;
8
- }
9
- </style>
10
- </head>
11
- <body>
12
- <div id="demo"></div>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <style>
6
+ body {
7
+ margin: 0;
8
+ padding: 0;
9
+ overflow: hidden;
13
10
 
14
- <script type="module">
15
- import { html, render } from 'lit';
16
- import '../dist/src/ocr-helper.js';
11
+ /* This is a font-stack that tries to use the system-default sans-serifs first */
12
+ font-family: Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
13
+ line-height: 1.5;
14
+ -webkit-font-smoothing: antialiased;
15
+ }
17
16
 
18
- const title = 'Hello owc World!';
19
- render(
20
- html`
21
- <ocr-helper .title=${title}>
22
- some light-dom
23
- </ocr-helper>
24
- `,
25
- document.querySelector('#demo')
26
- );
27
- </script>
28
- </body>
17
+ #demo {
18
+ height: 100vh;
19
+ }
20
+
21
+ ox-ocr-helper {
22
+ height: 100%;
23
+ }
24
+ </style>
25
+ <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet" />
26
+ <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
27
+ </head>
28
+ <body>
29
+ <div id="demo"></div>
30
+
31
+ <script type="module">
32
+ import { html, render } from 'lit'
33
+ import '../dist/src/ox-ocr-helper.js'
34
+
35
+ const RESULT = {
36
+ status_code: 200,
37
+ key_values: {
38
+ '1P': ['LNK304PG'],
39
+ Q: ['259', '311', '430'],
40
+ '9D': ['2139', '2139', '2135'],
41
+ '1T': ['BA268F', 'BA268C', 'BC488D']
42
+ },
43
+ boundaries: [
44
+ [
45
+ {
46
+ x: 217.0,
47
+ y: 117.0
48
+ },
49
+ {
50
+ x: 291.0,
51
+ y: 120.0
52
+ },
53
+ {
54
+ x: 291.0,
55
+ y: 143.0
56
+ },
57
+ {
58
+ x: 216.0,
59
+ y: 140.0
60
+ }
61
+ ],
62
+ [
63
+ {
64
+ x: 294.0,
65
+ y: 120.0
66
+ },
67
+ {
68
+ x: 442.0,
69
+ y: 129.0
70
+ },
71
+ {
72
+ x: 441.0,
73
+ y: 151.0
74
+ },
75
+ {
76
+ x: 292.0,
77
+ y: 143.0
78
+ }
79
+ ],
80
+ [
81
+ {
82
+ x: 443.0,
83
+ y: 130.0
84
+ },
85
+ {
86
+ x: 484.0,
87
+ y: 130.0
88
+ },
89
+ {
90
+ x: 484.0,
91
+ y: 151.0
92
+ },
93
+ {
94
+ x: 443.0,
95
+ y: 151.0
96
+ }
97
+ ],
98
+ [
99
+ {
100
+ x: 549.0,
101
+ y: 134.0
102
+ },
103
+ {
104
+ x: 642.0,
105
+ y: 138.0
106
+ },
107
+ {
108
+ x: 642.0,
109
+ y: 157.0
110
+ },
111
+ {
112
+ x: 548.0,
113
+ y: 152.0
114
+ }
115
+ ],
116
+ [
117
+ {
118
+ x: 255.0,
119
+ y: 163.0
120
+ },
121
+ {
122
+ x: 390.0,
123
+ y: 167.0
124
+ },
125
+ {
126
+ x: 389.0,
127
+ y: 191.0
128
+ },
129
+ {
130
+ x: 254.0,
131
+ y: 187.0
132
+ }
133
+ ],
134
+ [
135
+ {
136
+ x: 212.0,
137
+ y: 208.0
138
+ },
139
+ {
140
+ x: 255.0,
141
+ y: 208.0
142
+ },
143
+ {
144
+ x: 255.0,
145
+ y: 235.0
146
+ },
147
+ {
148
+ x: 212.0,
149
+ y: 235.0
150
+ }
151
+ ],
152
+ [
153
+ {
154
+ x: 257.0,
155
+ y: 210.0
156
+ },
157
+ {
158
+ x: 320.0,
159
+ y: 210.0
160
+ },
161
+ {
162
+ x: 320.0,
163
+ y: 232.0
164
+ },
165
+ {
166
+ x: 257.0,
167
+ y: 232.0
168
+ }
169
+ ],
170
+ [
171
+ {
172
+ x: 383.0,
173
+ y: 214.0
174
+ },
175
+ {
176
+ x: 480.0,
177
+ y: 218.0
178
+ },
179
+ {
180
+ x: 480.0,
181
+ y: 240.0
182
+ },
183
+ {
184
+ x: 383.0,
185
+ y: 236.0
186
+ }
187
+ ],
188
+ [
189
+ {
190
+ x: 215.0,
191
+ y: 301.0
192
+ },
193
+ {
194
+ x: 382.0,
195
+ y: 301.0
196
+ },
197
+ {
198
+ x: 382.0,
199
+ y: 325.0
200
+ },
201
+ {
202
+ x: 215.0,
203
+ y: 325.0
204
+ }
205
+ ],
206
+ [
207
+ {
208
+ x: 436.0,
209
+ y: 305.0
210
+ },
211
+ {
212
+ x: 539.0,
213
+ y: 305.0
214
+ },
215
+ {
216
+ x: 539.0,
217
+ y: 327.0
218
+ },
219
+ {
220
+ x: 436.0,
221
+ y: 327.0
222
+ }
223
+ ],
224
+ [
225
+ {
226
+ x: 537.0,
227
+ y: 308.0
228
+ },
229
+ {
230
+ x: 582.0,
231
+ y: 308.0
232
+ },
233
+ {
234
+ x: 582.0,
235
+ y: 328.0
236
+ },
237
+ {
238
+ x: 537.0,
239
+ y: 328.0
240
+ }
241
+ ],
242
+ [
243
+ {
244
+ x: 594.0,
245
+ y: 309.0
246
+ },
247
+ {
248
+ x: 624.0,
249
+ y: 309.0
250
+ },
251
+ {
252
+ x: 624.0,
253
+ y: 334.0
254
+ },
255
+ {
256
+ x: 594.0,
257
+ y: 334.0
258
+ }
259
+ ],
260
+ [
261
+ {
262
+ x: 624.0,
263
+ y: 310.0
264
+ },
265
+ {
266
+ x: 659.0,
267
+ y: 310.0
268
+ },
269
+ {
270
+ x: 659.0,
271
+ y: 330.0
272
+ },
273
+ {
274
+ x: 624.0,
275
+ y: 330.0
276
+ }
277
+ ],
278
+ [
279
+ {
280
+ x: 675.0,
281
+ y: 311.0
282
+ },
283
+ {
284
+ x: 707.0,
285
+ y: 311.0
286
+ },
287
+ {
288
+ x: 707.0,
289
+ y: 330.0
290
+ },
291
+ {
292
+ x: 675.0,
293
+ y: 330.0
294
+ }
295
+ ],
296
+ [
297
+ {
298
+ x: 735.0,
299
+ y: 342.0
300
+ },
301
+ {
302
+ x: 775.0,
303
+ y: 342.0
304
+ },
305
+ {
306
+ x: 775.0,
307
+ y: 360.0
308
+ },
309
+ {
310
+ x: 735.0,
311
+ y: 360.0
312
+ }
313
+ ],
314
+ [
315
+ {
316
+ x: 806.0,
317
+ y: 341.0
318
+ },
319
+ {
320
+ x: 829.0,
321
+ y: 341.0
322
+ },
323
+ {
324
+ x: 829.0,
325
+ y: 359.0
326
+ },
327
+ {
328
+ x: 806.0,
329
+ y: 359.0
330
+ }
331
+ ],
332
+ [
333
+ {
334
+ x: 217.0,
335
+ y: 386.0
336
+ },
337
+ {
338
+ x: 381.0,
339
+ y: 383.0
340
+ },
341
+ {
342
+ x: 381.0,
343
+ y: 407.0
344
+ },
345
+ {
346
+ x: 217.0,
347
+ y: 410.0
348
+ }
349
+ ],
350
+ [
351
+ {
352
+ x: 436.0,
353
+ y: 387.0
354
+ },
355
+ {
356
+ x: 536.0,
357
+ y: 387.0
358
+ },
359
+ {
360
+ x: 536.0,
361
+ y: 410.0
362
+ },
363
+ {
364
+ x: 436.0,
365
+ y: 410.0
366
+ }
367
+ ],
368
+ [
369
+ {
370
+ x: 535.0,
371
+ y: 388.0
372
+ },
373
+ {
374
+ x: 577.0,
375
+ y: 388.0
376
+ },
377
+ {
378
+ x: 577.0,
379
+ y: 407.0
380
+ },
381
+ {
382
+ x: 535.0,
383
+ y: 407.0
384
+ }
385
+ ],
386
+ [
387
+ {
388
+ x: 590.0,
389
+ y: 387.0
390
+ },
391
+ {
392
+ x: 617.0,
393
+ y: 387.0
394
+ },
395
+ {
396
+ x: 617.0,
397
+ y: 411.0
398
+ },
399
+ {
400
+ x: 590.0,
401
+ y: 411.0
402
+ }
403
+ ],
404
+ [
405
+ {
406
+ x: 618.0,
407
+ y: 388.0
408
+ },
409
+ {
410
+ x: 653.0,
411
+ y: 388.0
412
+ },
413
+ {
414
+ x: 653.0,
415
+ y: 409.0
416
+ },
417
+ {
418
+ x: 618.0,
419
+ y: 409.0
420
+ }
421
+ ],
422
+ [
423
+ {
424
+ x: 669.0,
425
+ y: 389.0
426
+ },
427
+ {
428
+ x: 702.0,
429
+ y: 389.0
430
+ },
431
+ {
432
+ x: 702.0,
433
+ y: 408.0
434
+ },
435
+ {
436
+ x: 669.0,
437
+ y: 408.0
438
+ }
439
+ ],
440
+ [
441
+ {
442
+ x: 728.0,
443
+ y: 416.0
444
+ },
445
+ {
446
+ x: 769.0,
447
+ y: 416.0
448
+ },
449
+ {
450
+ x: 769.0,
451
+ y: 436.0
452
+ },
453
+ {
454
+ x: 728.0,
455
+ y: 436.0
456
+ }
457
+ ],
458
+ [
459
+ {
460
+ x: 798.0,
461
+ y: 416.0
462
+ },
463
+ {
464
+ x: 822.0,
465
+ y: 416.0
466
+ },
467
+ {
468
+ x: 822.0,
469
+ y: 433.0
470
+ },
471
+ {
472
+ x: 798.0,
473
+ y: 433.0
474
+ }
475
+ ],
476
+ [
477
+ {
478
+ x: 219.0,
479
+ y: 465.0
480
+ },
481
+ {
482
+ x: 381.0,
483
+ y: 460.0
484
+ },
485
+ {
486
+ x: 382.0,
487
+ y: 482.0
488
+ },
489
+ {
490
+ x: 220.0,
491
+ y: 487.0
492
+ }
493
+ ],
494
+ [
495
+ {
496
+ x: 434.0,
497
+ y: 463.0
498
+ },
499
+ {
500
+ x: 534.0,
501
+ y: 461.0
502
+ },
503
+ {
504
+ x: 534.0,
505
+ y: 481.0
506
+ },
507
+ {
508
+ x: 435.0,
509
+ y: 483.0
510
+ }
511
+ ],
512
+ [
513
+ {
514
+ x: 532.0,
515
+ y: 462.0
516
+ },
517
+ {
518
+ x: 574.0,
519
+ y: 462.0
520
+ },
521
+ {
522
+ x: 574.0,
523
+ y: 479.0
524
+ },
525
+ {
526
+ x: 532.0,
527
+ y: 479.0
528
+ }
529
+ ],
530
+ [
531
+ {
532
+ x: 587.0,
533
+ y: 461.0
534
+ },
535
+ {
536
+ x: 614.0,
537
+ y: 461.0
538
+ },
539
+ {
540
+ x: 614.0,
541
+ y: 482.0
542
+ },
543
+ {
544
+ x: 587.0,
545
+ y: 482.0
546
+ }
547
+ ],
548
+ [
549
+ {
550
+ x: 616.0,
551
+ y: 461.0
552
+ },
553
+ {
554
+ x: 650.0,
555
+ y: 463.0
556
+ },
557
+ {
558
+ x: 649.0,
559
+ y: 481.0
560
+ },
561
+ {
562
+ x: 615.0,
563
+ y: 479.0
564
+ }
565
+ ],
566
+ [
567
+ {
568
+ x: 664.0,
569
+ y: 461.0
570
+ },
571
+ {
572
+ x: 697.0,
573
+ y: 461.0
574
+ },
575
+ {
576
+ x: 697.0,
577
+ y: 479.0
578
+ },
579
+ {
580
+ x: 664.0,
581
+ y: 479.0
582
+ }
583
+ ],
584
+ [
585
+ {
586
+ x: 723.0,
587
+ y: 486.0
588
+ },
589
+ {
590
+ x: 761.0,
591
+ y: 486.0
592
+ },
593
+ {
594
+ x: 761.0,
595
+ y: 504.0
596
+ },
597
+ {
598
+ x: 723.0,
599
+ y: 504.0
600
+ }
601
+ ],
602
+ [
603
+ {
604
+ x: 792.0,
605
+ y: 485.0
606
+ },
607
+ {
608
+ x: 814.0,
609
+ y: 485.0
610
+ },
611
+ {
612
+ x: 814.0,
613
+ y: 500.0
614
+ },
615
+ {
616
+ x: 792.0,
617
+ y: 500.0
618
+ }
619
+ ],
620
+ [
621
+ {
622
+ x: 586.0,
623
+ y: 535.0
624
+ },
625
+ {
626
+ x: 626.0,
627
+ y: 535.0
628
+ },
629
+ {
630
+ x: 626.0,
631
+ y: 551.0
632
+ },
633
+ {
634
+ x: 586.0,
635
+ y: 551.0
636
+ }
637
+ ],
638
+ [
639
+ {
640
+ x: 664.0,
641
+ y: 533.0
642
+ },
643
+ {
644
+ x: 700.0,
645
+ y: 533.0
646
+ },
647
+ {
648
+ x: 700.0,
649
+ y: 548.0
650
+ },
651
+ {
652
+ x: 664.0,
653
+ y: 548.0
654
+ }
655
+ ]
656
+ ],
657
+ texts: [
658
+ 'POWER',
659
+ 'INTEGRATIONS',
660
+ 'INC.',
661
+ '15/10/2021',
662
+ 'LinkSwitchTM',
663
+ '(1P)',
664
+ 'PROD:',
665
+ 'LNK304PG',
666
+ '(1T)LotNo:BA268F',
667
+ '(9D)DtCode:',
668
+ '2139',
669
+ '(Q)',
670
+ 'Qty:',
671
+ '259',
672
+ 'COO:',
673
+ 'CN',
674
+ '(1T)LotNo:BA268C',
675
+ '(9D)DtCode:',
676
+ '2139',
677
+ '(Q)',
678
+ 'Qty:',
679
+ '311',
680
+ 'COO:',
681
+ 'CN',
682
+ '(1T)LotNo:BC488D',
683
+ '(9D)DtCode:',
684
+ '2135',
685
+ '(Q)',
686
+ 'Qty:',
687
+ '430',
688
+ 'COO:',
689
+ 'CN',
690
+ 'Total',
691
+ '1000'
692
+ ]
693
+ }
694
+
695
+ function attached(e) {
696
+ const helper = document.querySelector('ox-ocr-helper')
697
+ helper.result = [JSON.parse(JSON.stringify(RESULT))]
698
+ }
699
+
700
+ render(html` <ox-ocr-helper @attached=${attached}></ox-ocr-helper> `, document.querySelector('#demo'))
701
+ </script>
702
+ </body>
29
703
  </html>
@@ -1 +1 @@
1
- export * from './ocr-helper.js';
1
+ export * from './ox-ocr-helper.js';
package/dist/src/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export * from './ocr-helper.js';
1
+ export * from './ox-ocr-helper.js';
2
2
  //# sourceMappingURL=index.js.map