sane-wasm 0.3.0 → 0.3.2
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 +1 -1
- package/build/libsane.html +29 -10
- package/build/libsane.js +2145 -2192
- package/build/libsane.wasm +0 -0
- package/build/libsane.worker.js +13 -22
- package/dist/index.d.ts +2 -0
- package/dist/index.js +16 -0
- package/dist/options.d.ts +127 -0
- package/dist/options.js +165 -0
- package/dist/readers.d.ts +108 -0
- package/dist/readers.js +320 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ A project to bring the [SANE API](http://www.sane-project.org/intro.html) to Nod
|
|
|
4
4
|
|
|
5
5
|
It supports USB scanners on browser environments through the [WebUSB API](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API) and on Node.js using [node-usb](https://github.com/node-usb/node-usb).
|
|
6
6
|
|
|
7
|
-
This works by compiling all SANE backends (and required dependencies) to WebAssembly using Emscripten. The other key piece is @RReverser's
|
|
7
|
+
This works by compiling all SANE backends (and required dependencies) to WebAssembly using Emscripten. The other key piece is @RReverser's bridge from libusb to WebUSB ([article](https://web.dev/articles/porting-libusb-to-webusb)/[article](https://web.dev/articles/porting-gphoto2-to-the-web)/[code](https://github.com/libusb/libusb/pull/1057)/[code](https://github.com/libusb/libusb/pull/1339)) for direct USB access.
|
|
8
8
|
|
|
9
9
|
Right now, it includes [all backends](http://www.sane-project.org/lists/sane-backends-cvs.html) that have support for at least one USB device ([genesys is not included due to issues](https://github.com/goncalomb/sane-wasm/issues/3)). No [external backends](http://www.sane-project.org/lists/sane-backends-external.html) are included at the moment.
|
|
10
10
|
|
package/build/libsane.html
CHANGED
|
@@ -14,6 +14,21 @@
|
|
|
14
14
|
max-width: 950px;
|
|
15
15
|
margin: 0 auto;
|
|
16
16
|
}
|
|
17
|
+
table#options {
|
|
18
|
+
width: 100%;
|
|
19
|
+
border-collapse: collapse;
|
|
20
|
+
}
|
|
21
|
+
table#options tr td {
|
|
22
|
+
padding: 2px;
|
|
23
|
+
}
|
|
24
|
+
table#options tr:not(:last-child) td {
|
|
25
|
+
border-bottom: 1px solid #555;
|
|
26
|
+
}
|
|
27
|
+
table#options tr td:last-child {
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
text-overflow: ellipsis;
|
|
30
|
+
max-width: 250px;
|
|
31
|
+
}
|
|
17
32
|
canvas {
|
|
18
33
|
border: 2px solid #555;
|
|
19
34
|
margin-bottom: 25px;
|
|
@@ -262,16 +277,22 @@
|
|
|
262
277
|
}
|
|
263
278
|
}
|
|
264
279
|
const options = document.querySelector("#options");
|
|
280
|
+
options.style.display = null;
|
|
265
281
|
options.innerHTML = "";
|
|
266
282
|
options.append(tree(option_descriptors.map((opt, n) => (
|
|
267
|
-
["
|
|
268
|
-
["
|
|
269
|
-
|
|
270
|
-
["
|
|
271
|
-
[
|
|
272
|
-
["
|
|
283
|
+
["tr", null, [
|
|
284
|
+
["td", null, `${n}`],
|
|
285
|
+
["td", null, [
|
|
286
|
+
["strong", null, `${opt.title}`],
|
|
287
|
+
` [name=${opt.name}] [type=${LibSANE.SANE_TYPE.asString(opt.type)}] [unit=${LibSANE.SANE_UNIT.asString(opt.unit)}] [size=${opt.size}]`, ["br"],
|
|
288
|
+
["abbr", { title: [
|
|
289
|
+
`cap=${JSON.stringify(opt.cap, null, 2)}`,
|
|
290
|
+
`constraint_type=${LibSANE.SANE_CONSTRAINT.asString(opt.constraint_type)}`,
|
|
291
|
+
`constraint=${JSON.stringify(opt.constraint, null, 2)}`,
|
|
292
|
+
].join("\n") }, "[cap=...] [constraint_type=...] [constraint=...]"], ["br"],
|
|
293
|
+
["small", null, opt.desc],
|
|
273
294
|
]],
|
|
274
|
-
["
|
|
295
|
+
["td", { id: `option-${n}` }]
|
|
275
296
|
]]
|
|
276
297
|
))));
|
|
277
298
|
let n = 0;
|
|
@@ -333,7 +354,7 @@
|
|
|
333
354
|
["button", { onclick: e => callSANE("sane_close") }, "LibSANE.sane_close()"], " ",
|
|
334
355
|
]],
|
|
335
356
|
["h3", null, "Options"],
|
|
336
|
-
["
|
|
357
|
+
["table", { id: "options", style: "display: none;" }],
|
|
337
358
|
["h3", null, "Scan"],
|
|
338
359
|
["p", null, [
|
|
339
360
|
["button", { onclick: e => callSANE("sane_get_parameters") }, "LibSANE.sane_get_parameters()"], " ",
|
|
@@ -353,5 +374,3 @@
|
|
|
353
374
|
</script>
|
|
354
375
|
</body>
|
|
355
376
|
</html>
|
|
356
|
-
|
|
357
|
-
|