@dile/scanner 0.0.1 → 0.0.3

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 CHANGED
@@ -22,7 +22,9 @@ Read the docs and find demos on the [dile-components site](https://dile-componen
22
22
 
23
23
  ## ML detector files
24
24
 
25
- With `ml-detector` the component uses scanic's neural detector (about 2.2 MB, only downloaded when the first photo is processed). By default the files come from jsDelivr. The package installs the matching `scanic-ml` version, so you can serve your own copy with the included Vite plugin:
25
+ The ML detector is optional and off by default. Without `ml-detector` your users download nothing of it. With `ml-detector` the component uses scanic's neural detector, and the browser downloads its files (3.5 MB, about 2.2 MB with gzip) the first time a photo is processed.
26
+
27
+ By default the files come from jsDelivr. The package installs the matching `scanic-ml` version (3.5 MB in `node_modules`, only disk space in your project), so you can serve your own copy with the included Vite plugin:
26
28
 
27
29
  ```javascript
28
30
  // vite.config.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dile/scanner",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Web Component to scan documents in the browser: edge detection, perspective correction and multipage PDF or JPEG output, powered by scanic and jsPDF",
5
5
  "keywords": [
6
6
  "scanner",
@@ -30,11 +30,11 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@dile/iconlib": "^2.0.1",
33
- "@dile/ui": "^3.16.2",
33
+ "@dile/ui": "^3.17.0",
34
34
  "jspdf": "^4.2.1",
35
35
  "lit": "^2.7.0 || ^3.0.0",
36
36
  "scanic": "1.7.1",
37
37
  "scanic-ml": "0.2.0"
38
38
  },
39
- "gitHead": "0f1a6553d287b706db6f42c7001a25fdebc3bd3a"
39
+ "gitHead": "ea92314b81f3274d6f843b7a926fc528f1a13879"
40
40
  }
@@ -49,8 +49,9 @@ const SIZE_FALLBACKS = [
49
49
  // returns the result as a PDF (output="pdf", default) or as JPEG images
50
50
  // (output="images"). With "multipage" the user can add several pages, reorder
51
51
  // them, rotate them, adjust them again and remove them. With "ml-detector"
52
- // the edges are detected with scanic's neural detector (about 2 MB downloaded
53
- // the first time) instead of the classical one; off by default.
52
+ // the edges are detected with scanic's neural detector (about 2.2 MB
53
+ // downloaded with gzip the first time) instead of the classical one; off by
54
+ // default.
54
55
  //
55
56
  // It does not upload anything: when the user saves, it dispatches
56
57
  // "dile-document-scanned" with the files and closes. Closing it without saving
@@ -228,7 +229,8 @@ export class DileScanner extends LitElement {
228
229
  /**
229
230
  * Detects the edges with scanic's neural detector (more robust on hard
230
231
  * photos), falling back to the classical one when it finds nothing.
231
- * Downloads about 2 MB the first time it is used.
232
+ * Downloads about 2.2 MB with gzip (3.5 MB uncompressed) the first
233
+ * time it is used.
232
234
  */
233
235
  mlDetector: { type: Boolean, attribute: "ml-detector" },
234
236
  /**
@@ -27,10 +27,11 @@ export function preloadEngine() {
27
27
  // cluttered backgrounds, low contrast or strong perspective. It goes first,
28
28
  // not as a retry, because on hard photos the classical detector does not
29
29
  // always fail: it can return a wrong shape (e.g. a line of text) as if it
30
- // were the document. The neural detector downloads about 2 MB (model + ONNX
31
- // runtime) the first time, from jsDelivr unless mlAssetsUrl points to a
32
- // self-hosted copy of the "scanic-ml" package files. When it finds nothing
33
- // or fails (e.g. no network), the classical detector is used.
30
+ // were the document. The neural detector downloads about 2.2 MB with gzip
31
+ // (3.5 MB uncompressed: model + ONNX runtime) the first time, from jsDelivr
32
+ // unless mlAssetsUrl points to a self-hosted copy of the "scanic-ml" package
33
+ // files. When it finds nothing or fails (e.g. no network), the classical
34
+ // detector is used.
34
35
  export async function detectCorners(canvas, { ml = false, mlAssetsUrl = "" } = {}) {
35
36
  const { Scanner } = await loadScanic();
36
37
  scanner ??= new Scanner();