k-qr-scanner 0.2.0 → 0.3.0

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 (72) hide show
  1. package/CHANGELOG.md +22 -1
  2. package/README.md +38 -10
  3. package/dist/chunks/chunk-PUUIGXID.js +149 -0
  4. package/dist/chunks/engine-EJ4OC3LZ.js +1 -0
  5. package/dist/cli.js +22 -9
  6. package/dist/element.d.ts +11 -1
  7. package/dist/emv.d.ts +89 -0
  8. package/dist/engine.d.ts +5 -0
  9. package/dist/index.cjs +24 -10
  10. package/dist/index.d.ts +2 -0
  11. package/dist/index.js +1 -2
  12. package/dist/kqrcode.engine.js +1 -1
  13. package/dist/kqrcode.global.js +24 -10
  14. package/dist/kqrcode.jsqr.js +0 -1
  15. package/dist/react-native.d.ts +4 -0
  16. package/dist/react.cjs +1 -2
  17. package/dist/react.d.ts +2 -0
  18. package/dist/react.js +1 -2
  19. package/dist/rn/index.js +5 -6
  20. package/dist/rn/runtime.js +1 -1
  21. package/dist/scan-qr.d.ts +2 -0
  22. package/dist/sr.cjs +0 -1
  23. package/dist/sr.js +1 -2
  24. package/dist/svelte.cjs +1 -2
  25. package/dist/svelte.d.ts +2 -0
  26. package/dist/svelte.js +1 -2
  27. package/dist/vue.cjs +1 -2
  28. package/dist/vue.d.ts +2 -0
  29. package/dist/vue.js +1 -2
  30. package/llms.txt +15 -8
  31. package/package.json +2 -3
  32. package/dist/chunks/chunk-E66QYIQI.js +0 -135
  33. package/dist/chunks/chunk-E66QYIQI.js.map +0 -6
  34. package/dist/chunks/chunk-HCGRA6GM.js +0 -2
  35. package/dist/chunks/chunk-HCGRA6GM.js.map +0 -6
  36. package/dist/chunks/decoder-jsqr-54X2IQSI.js +0 -2
  37. package/dist/chunks/decoder-jsqr-54X2IQSI.js.map +0 -6
  38. package/dist/chunks/engine-QWSAAVKN.js +0 -2
  39. package/dist/chunks/engine-QWSAAVKN.js.map +0 -6
  40. package/dist/chunks/worker-source.generated-24WX42PC.js +0 -2
  41. package/dist/chunks/worker-source.generated-24WX42PC.js.map +0 -6
  42. package/dist/cli.d.ts +0 -17
  43. package/dist/decoder-jsqr.d.ts +0 -3
  44. package/dist/decoder-zxing.d.ts +0 -3
  45. package/dist/engine-host.d.ts +0 -48
  46. package/dist/engine.cjs +0 -1
  47. package/dist/index.cjs.map +0 -6
  48. package/dist/index.js.map +0 -6
  49. package/dist/jsqr.cjs +0 -2
  50. package/dist/jsqr.cjs.map +0 -6
  51. package/dist/kqrcode.global.js.map +0 -6
  52. package/dist/kqrcode.jsqr.js.map +0 -6
  53. package/dist/react.cjs.map +0 -6
  54. package/dist/react.js.map +0 -6
  55. package/dist/rn/index.js.map +0 -6
  56. package/dist/rn-bridge.d.ts +0 -103
  57. package/dist/rn-runtime.generated.d.ts +0 -2
  58. package/dist/sr-model.generated.d.ts +0 -4
  59. package/dist/sr.cjs.map +0 -6
  60. package/dist/sr.js.map +0 -6
  61. package/dist/svelte.cjs.map +0 -6
  62. package/dist/svelte.js.map +0 -6
  63. package/dist/vue.cjs.map +0 -6
  64. package/dist/vue.js.map +0 -6
  65. package/dist/worker-source.generated.d.ts +0 -2
  66. package/dist/worker.d.ts +0 -1
  67. package/docs/API.md +0 -292
  68. package/docs/BENCHMARK.md +0 -101
  69. package/docs/CUSTOMIZE.md +0 -150
  70. package/docs/FRAMEWORKS.md +0 -241
  71. package/docs/REACT_NATIVE.md +0 -181
  72. package/docs/TESTING.md +0 -90
package/dist/sr.js.map DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/sr-model.generated.ts", "../src/sr.ts", "../src/sr-providers.ts"],
4
- "mappings": "mCAEO,IAAMA,EAAc,2m/BAEdC,EAAwD,CAAC,UAAW,CAAC,KAAM,IAAK,CAAC,GAAI,EAAG,EAAG,CAAC,CAAC,EAAG,UAAW,CAAC,KAAM,GAAI,CAAC,GAAI,CAAC,CAAC,EAAG,eAAgB,CAAC,KAAM,IAA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,OAAQC,EAAG,KAAAC,CAAK,EAAIb,EAChCc,EAAI,IAAI,aAAaH,EAAIC,CAAC,EAChC,QAASN,EAAI,EAAGS,EAAI,EAAGT,EAAIK,EAAIC,EAAGN,IAAKS,GAAK,EAAGD,EAAER,CAAC,GAAMO,EAAKE,CAAC,EAAI,GAAKF,EAAKE,EAAI,CAAC,EAAI,IAAMF,EAAKE,EAAI,CAAC,EAAI,IAAO,GAAK,IACrH,IAAMC,GAAO,MAAMN,EAAQ,IAAI,CAAE,KAAM,IAAIF,EAAI,OAAO,UAAWM,EAAG,CAAC,EAAG,EAAGF,EAAGD,CAAC,CAAC,CAAE,CAAC,GAAG,OAChFM,EAAKD,EAAI,KAAK,CAAC,EAAGE,EAAKF,EAAI,KAAK,CAAC,EACjCG,EAAO,IAAI,kBAAkBD,EAAKD,EAAK,CAAC,EACxCG,EAAIJ,EAAI,KACd,QAASV,EAAI,EAAGS,EAAI,EAAGT,EAAIY,EAAKD,EAAIX,IAAKS,GAAK,EAAG,CAC/C,IAAMM,EAAID,EAAEd,CAAC,EAAI,IACjBa,EAAKJ,CAAC,EAAII,EAAKJ,EAAI,CAAC,EAAII,EAAKJ,EAAI,CAAC,EAAIM,EACtCF,EAAKJ,EAAI,CAAC,EAAI,GAChB,CACA,MAAO,CAAE,KAAMI,EAAM,MAAOD,EAAI,OAAQD,CAAG,CAC7C,EACyB,CAAE,QAAS,GAAI,CAAC,CAC3C",
5
- "names": ["SR_ONNX_B64", "SR_LAYOUT", "SLOPE", "model", "cache", "param", "name", "w", "bin", "SR_ONNX_B64", "i", "off", "n", "SR_LAYOUT", "leaky", "a", "conv1x1", "inp", "ci", "hw", "co", "out", "outOff", "b", "o", "c", "dst", "bias", "p", "k", "wk", "src", "conv3x3", "h", "depthwise", "wt", "oc", "y", "x", "s", "ky", "yy", "row", "kr", "kx", "xx", "deconvDW", "oh", "ow", "ch", "iy", "ix", "v", "oy", "ox", "superResolve", "c0", "cat1", "r", "d", "cat2", "red", "up", "rec", "nw", "superResolveRGBA", "img", "data", "j", "jsSuperRes", "img", "superResolveRGBA", "srModelBytes", "bin", "SR_ONNX_B64", "u8", "i", "createOnnxSuperRes", "ort", "executionProviders", "session", "w", "h", "data", "x", "j", "out", "oh", "ow", "rgba", "y", "v"]
6
- }
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/svelte.ts"],
4
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,IAAA,eAAAC,EAAAH,GAgBA,IAAAI,EAA8G,wBAoCxGC,EAAkD,CACtD,CAAC,aAAc,YAAY,EAAG,CAAC,SAAU,QAAQ,EAAG,CAAC,aAAc,cAAc,EAAG,CAAC,YAAa,YAAY,EAC9G,CAAC,UAAW,UAAU,EAAG,CAAC,SAAU,SAAS,EAAG,CAAC,YAAa,YAAY,CAC5E,EAEA,SAASC,EAAWC,EAAuBC,EAA2B,CACpE,OAAW,CAACC,EAAGC,CAAI,IAAKL,EAAOG,EAAEC,CAAC,EAAIF,EAAG,aAAaG,EAAM,EAAE,EAAIH,EAAG,gBAAgBG,CAAI,EACzF,OAAW,CAACD,EAAGC,CAAI,GAAK,CAAC,CAAC,SAAU,QAAQ,EAAG,CAAC,SAAU,QAAQ,EAAG,CAAC,UAAW,UAAU,EAAG,CAAC,kBAAmB,kBAAkB,EAAG,CAAC,QAAS,OAAO,EAAG,CAAC,UAAW,SAAS,EAAG,CAAC,UAAW,SAAS,EAAG,CAAC,QAAS,OAAO,EAAG,CAAC,cAAe,cAAc,CAAC,EAAY,CACxQ,IAAMC,EAAIH,EAAEC,CAAC,EACME,GAAM,KAAOJ,EAAG,aAAaG,EAAM,OAAOC,CAAC,CAAC,EAAIJ,EAAG,gBAAgBG,CAAI,CAC5F,CACAF,EAAE,SAAS,OAASD,EAAG,aAAa,UAAWC,EAAE,QAAQ,KAAK,GAAG,CAAC,EAAID,EAAG,gBAAgB,SAAS,EAClGA,EAAG,OAASC,EAAE,QAAU,CAAC,EACzB,OAAW,CAACC,EAAGE,CAAC,IAAK,OAAO,QAAQH,EAAE,OAAS,CAAC,CAAC,EAAGD,EAAG,MAAM,YAAYE,EAAGE,CAAC,CAC/E,CAEO,SAAST,EAAUU,EAAmBC,EAAkC,CAAC,EAAG,IACjF,wBAAqB,EACrB,IAAIC,EAAOD,EACLN,EAAK,SAAS,cAAc,UAAQ,EAC1CD,EAAWC,EAAIO,CAAI,EACnB,IAAMC,EAAK,CAACC,EAAcC,IAA2BV,EAAG,iBAAiBS,EAAMC,CAAE,EACjFF,EAAG,OAASG,GAAMJ,EAAK,SAAUI,EAA8B,MAAM,CAAC,EACtEH,EAAG,QAAUG,GAAMJ,EAAK,UAAWI,EAA6B,MAAM,CAAC,EACvEH,EAAG,QAAS,IAAMD,EAAK,UAAU,CAAC,EAClCC,EAAG,QAAS,IAAMD,EAAK,UAAU,CAAC,EAClCC,EAAG,SAAWG,GAAM,CAClB,IAAMC,EAAKD,EAA4D,OACvEJ,EAAK,WAAWK,EAAE,OAAQA,EAAE,OAAO,CACrC,CAAC,EACDZ,EAAG,OAAU,GAAOO,EAAK,OAASA,EAAK,OAAO,CAAC,EAAI,GAEnD,QAAWM,IAAS,CAAC,GAAGR,EAAK,QAAQ,EAAoB,CACvD,IAAMS,EAAOD,EAAM,QAAQ,MAAQA,EAAM,aAAa,MAAM,EACxDC,IAAQD,EAAM,aAAa,OAAQC,CAAI,EAAGd,EAAG,YAAYa,CAAK,EACpE,CACA,OAAAR,EAAK,YAAYL,CAAE,EACZ,CACL,OAAOe,EAA8B,CACnCR,EAAOQ,EACPhB,EAAWC,EAAIe,CAAI,CACrB,EACA,SAAU,CACRf,EAAG,OAAO,CACZ,CACF,CACF",
5
- "names": ["svelte_exports", "__export", "qrScanner", "__toCommonJS", "import_element", "FLAGS", "applyAttrs", "el", "o", "k", "attr", "v", "node", "options", "opts", "on", "type", "fn", "e", "d", "child", "slot", "next"]
6
- }
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
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A2Bb,EAAG,iBAAiBY,EAAMC,CAAE,EACjFF,EAAG,OAAS,GAAMF,EAAK,SAAU,EAA8B,MAAM,CAAC,EACtEE,EAAG,QAAU,GAAMF,EAAK,UAAW,EAA6B,MAAM,CAAC,EACvEE,EAAG,QAAS,IAAMF,EAAK,UAAU,CAAC,EAClCE,EAAG,QAAS,IAAMF,EAAK,UAAU,CAAC,EAClCE,EAAG,SAAW,GAAM,CAClB,IAAMG,EAAK,EAA4D,OACvEL,EAAK,WAAWK,EAAE,OAAQA,EAAE,OAAO,CACrC,CAAC,EACDd,EAAG,OAAUe,GAAON,EAAK,OAASA,EAAK,OAAOM,CAAC,EAAI,GAEnD,QAAWC,IAAS,CAAC,GAAGV,EAAK,QAAQ,EAAoB,CACvD,IAAMW,EAAOD,EAAM,QAAQ,MAAQA,EAAM,aAAa,MAAM,EACxDC,IAAQD,EAAM,aAAa,OAAQC,CAAI,EAAGjB,EAAG,YAAYgB,CAAK,EACpE,CACA,OAAAV,EAAK,YAAYN,CAAE,EACZ,CACL,OAAOkB,EAA8B,CACnCT,EAAOS,EACPnB,EAAWC,EAAIkB,CAAI,CACrB,EACA,SAAU,CACRlB,EAAG,OAAO,CACZ,CACF,CACF",
5
- "names": ["FLAGS", "applyAttrs", "el", "o", "k", "attr", "v", "qrScanner", "node", "options", "defineScannerElement", "opts", "TAG_NAME", "on", "type", "fn", "d", "r", "child", "slot", "next"]
6
- }
package/dist/vue.cjs.map DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/vue.ts"],
4
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmD,eAEnDC,EAA8G,wBAQjGH,KAAY,mBAAgB,CACvC,KAAM,YACN,MAAO,CACL,OAAQ,CAAE,KAAM,OAA4C,QAAS,aAAc,EACnF,WAAY,QACZ,OAAQ,QACR,WAAY,QACZ,UAAW,QACX,QAAS,QAC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AAE,YAAY,EAAI,IACnCN,EAAM,UAASM,EAAE,UAAU,EAAI,IAC/BN,EAAM,SAAQM,EAAE,SAAS,EAAI,IAC7BN,EAAM,YAAWM,EAAE,YAAY,EAAI,IACnCN,EAAM,UAASM,EAAE,UAAU,EAAI,OAE5B,KAAE,WAAUA,EAAGH,EAAM,UAAU,CAAC,CACzC,CACF,CACF,CAAC",
5
- "names": ["vue_exports", "__export", "QRScanner", "__toCommonJS", "import_vue", "import_element", "_r", "_message", "_e", "props", "emit", "expose", "slots", "el", "r", "a", "e"]
6
- }
package/dist/vue.js.map DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/vue.ts"],
4
- "mappings": "yFAAA,OAAS,mBAAAA,EAAiB,KAAAC,EAAG,aAAAC,EAAW,OAAAC,MAAW,MAU5C,IAAMC,EAAYC,EAAgB,CACvC,KAAM,YACN,MAAO,CACL,OAAQ,CAAE,KAAM,OAA4C,QAAS,aAAc,EACnF,WAAY,QACZ,OAAQ,QACR,WAAY,QACZ,UAAW,QACX,QAAS,QACT,OAAQ,QACR,UAAW,QACX,QAAS,OACT,gBAAiB,OACjB,OAAQ,OACR,OAAQ,OACR,MAAO,OACP,QAAS,OACT,QAAS,OACT,MAAO,OACP,YAAa,OACb,QAAS,QAET,QAAS,MAET,OAAQ,QACV,EACA,MAAO,CACL,KAAOC,GAAmB,GAC1B,OAAQ,CAACA,EAAgBC,IAAsB,GAC/C,MAAQC,GAAgB,GACxB,MAAO,IAAM,GACb,MAAO,IAAM,EACf,EACA,MAAMC,EAAO,CAAE,KAAAC,EAAM,OAAAC,EAAQ,MAAAC,CAAM,EAAG,CACpC,IAAMC,EAAKC,EAA8B,IAAI,EAC7C,OAAAC,EAAqB,EACrBC,EAAU,IAAM,CACTH,EAAG,QACJJ,EAAM,SAAQI,EAAG,MAAM,OAASJ,EAAM,QAC1CI,EAAG,MAAM,OAAUI,GAAOR,EAAM,OAASA,EAAM,OAAOQ,CAAC,EAAI,GAC7D,CAAC,EACDN,EAAO,CAAE,GAAAE,CAAG,CAAC,EACN,IAAM,CACX,IAAMK,EAA6B,CACjC,IAAKL,EAAI,OAAQJ,EAAM,OAAQ,OAAQA,EAAM,OAAQ,WAAYA,EAAM,QAAS,mBAAoBA,EAAM,gBAC1G,MAAOA,EAAM,MAAO,QAASA,EAAM,QAAS,QAASA,EAAM,QAAS,MAAOA,EAAM,MAAO,eAAgBA,EAAM,YAC9G,QAASA,EAAM,SAAS,KAAK,GAAG,EAChC,OAASU,GAA+BT,EAAK,OAAQS,EAAE,MAAM,EAC7D,SAAWA,GAA6DT,EAAK,SAAUS,EAAE,OAAO,OAAQA,EAAE,OAAO,OAAO,EACxH,QAAUA,GAAmBT,EAAK,QAASS,EAAE,MAAM,EACnD,QAAS,IAAMT,EAAK,OAAO,EAC3B,QAAS,IAAMA,EAAK,OAAO,CAC7B,EACA,OAAID,EAAM,aAAYS,EAAE,WAAa,IACjCT,EAAM,SAAQS,EAAE,OAAS,IACzBT,EAAM,aAAYS,EAAE,cAAc,EAAI,IACtCT,EAAM,YAAWS,EAAE,YAAY,EAAI,IACnCT,EAAM,UAASS,EAAE,UAAU,EAAI,IAC/BT,EAAM,SAAQS,EAAE,SAAS,EAAI,IAC7BT,EAAM,YAAWS,EAAE,YAAY,EAAI,IACnCT,EAAM,UAASS,EAAE,UAAU,EAAI,IAE5BE,EAAEC,EAAUH,EAAGN,EAAM,UAAU,CAAC,CACzC,CACF,CACF,CAAC",
5
- "names": ["defineComponent", "h", "onMounted", "ref", "QRScanner", "defineComponent", "_r", "_message", "_e", "props", "emit", "expose", "slots", "el", "ref", "defineScannerElement", "onMounted", "r", "a", "e", "h", "TAG_NAME"]
6
- }
@@ -1,2 +0,0 @@
1
- declare const source: string;
2
- export default source;
package/dist/worker.d.ts DELETED
@@ -1 +0,0 @@
1
- export type SRMode = 'js' | 'webgpu' | 'off';
package/docs/API.md DELETED
@@ -1,292 +0,0 @@
1
- # API reference
2
-
3
- k-qr-scanner offers three levels of control:
4
-
5
- 1. **[`scanQR()`](#scanqr)**: one call that opens the scanner and resolves with a code.
6
- 2. **[`<kqr-scanner>`](#the-kqr-scanner-element)**: the full-screen UI as a custom element, for templates and frameworks.
7
- 3. **[`QRScanner`](#qrscanner-headless)**: the camera and decoding engine with no UI, for your own interface.
8
-
9
- Also on this page: [the `accept` callback](#the-accept-callback), [types](#types), [framework wrappers](#framework-wrappers), [super-resolution](#super-resolution), [`k-qr-scanner/sr`](#k-qr-scannersr) and [the CLI](#cli).
10
-
11
- ---
12
-
13
- ## `scanQR()`
14
-
15
- ```ts
16
- import { scanQR } from 'k-qr-scanner';
17
-
18
- function scanQR(options?: ScanQROptions): Promise<ScanResult>;
19
- ```
20
-
21
- Opens the full-screen scanner, resolves with the first accepted code and then removes the scanner.
22
-
23
- It rejects with:
24
-
25
- - a [`ScanError`](#types) when the camera cannot start. The scanner stays on screen so the user can read the message.
26
- - a `DOMException` when the user closes the scanner or `signal` aborts.
27
-
28
- ### Options
29
-
30
- | option | type | default | description |
31
- | :--- | :--- | :--- | :--- |
32
- | `theme` | `'wechat' \| 'alipay' \| 'grid' \| 'frame' \| 'none'` | `'wechat'` | the look, see [CUSTOMIZE.md](CUSTOMIZE.md) |
33
- | `locale` | `string` | browser language | `'en'`, `'lo'` and `'zh'` are built in |
34
- | `heading` | `string` | – | text in the top bar |
35
- | `labels` | `Partial<ScannerLabels>` | – | replace any built-in text |
36
- | `facing` | `'environment' \| 'user'` | `'environment'` | back or front camera |
37
- | `success` | `'dot' \| 'box' \| 'none'` | `'dot'` | the marker shown where the code was found |
38
- | `torch` | `'auto' \| 'always' \| 'never'` | `'auto'` | flashlight button; `auto` shows it when the scene is dark |
39
- | `zoomControl` | `'slider' \| 'none'` | `'none'` | show a zoom slider (pinch and double-tap always work) |
40
- | `autoZoom` | `boolean` | `true` | zoom in on small codes |
41
- | `maxZoom` | `number` | `8` | zoom limit (digital zoom stops at 4×) |
42
- | `gallery` | `boolean` | `true` | album button |
43
- | `beep` / `vibrate` | `boolean` | `true` | feedback on a successful scan |
44
- | `superResolution` | `'js' \| 'webgpu' \| 'off'` | `'js'` | see [super-resolution](#super-resolution) |
45
- | `onnxRuntimeUrl` | `string` | jsDelivr | where to load ONNX Runtime Web from for `'webgpu'` |
46
- | `formats` | `QRFormat[]` | all | which QR-family symbols to read |
47
- | `accept` | `AcceptFn` | – | check each code first, see [the `accept` callback](#the-accept-callback) |
48
- | `onReject` | `(result, message?) => void` | – | called when `accept` turns a code down |
49
- | `style` | `Record<string, string>` | – | CSS variables, e.g. `{ '--kqr-accent': '#e60012' }` |
50
- | `slots` | `Record<string, Node \| string>` | – | extra UI by slot name, e.g. `{ footer: tabs }` |
51
- | `container` | `HTMLElement` | `document.body` | where to mount the scanner |
52
- | `inline` | `boolean` | `false` | fill `container` instead of the whole screen |
53
- | `signal` | `AbortSignal` | – | close the scanner from your code |
54
-
55
- ---
56
-
57
- ## The `<kqr-scanner>` element
58
-
59
- Importing `k-qr-scanner` or any framework wrapper registers the element. On the server, registration is skipped.
60
-
61
- ```html
62
- <kqr-scanner theme="alipay" locale="lo" continuous></kqr-scanner>
63
- ```
64
-
65
- The camera starts as soon as the element is added to the page (unless `manual` is set) and stops when it is removed.
66
-
67
- ### Attributes
68
-
69
- | attribute | values | default |
70
- | :--- | :--- | :--- |
71
- | `theme` | `wechat` · `alipay` · `grid` · `frame` · `none` | `wechat` |
72
- | `locale` | `en` · `lo` · `zh`, or any code with your own `labels` | browser language |
73
- | `heading` | text | – |
74
- | `facing` | `environment` · `user` | `environment` |
75
- | `success` | `dot` · `box` · `none` | `dot` |
76
- | `torch` | `auto` · `always` · `never` | `auto` |
77
- | `zoom-control` | `slider` · `none` | `none` |
78
- | `max-zoom` | number | `8` |
79
- | `super-resolution` | `js` · `webgpu` · `off` | `js` |
80
- | `onnx-runtime-url` | URL | jsDelivr |
81
- | `formats` | `qr_code` · `micro_qr_code` · `rm_qr_code`, separated by spaces or commas | all |
82
- | `continuous` | flag | stop after the first result |
83
- | `keep-camera` | flag | keep the camera on after a result; call `resume()` to scan again |
84
- | `inline` | flag | fill the parent element instead of the screen |
85
- | `manual` | flag | don't start by itself; call `start()` |
86
- | `request-fullscreen` | flag | also enter browser full-screen mode |
87
- | `no-auto-zoom` · `no-torch` · `no-gallery` · `no-close` · `no-beep` · `no-vibrate` | flags | turn a feature off |
88
- | `no-candidates` | flag | hide the brackets drawn around a code that can't be read yet |
89
-
90
- ### Events
91
-
92
- | event | `detail` | fires when |
93
- | :--- | :--- | :--- |
94
- | `ready` | – | the camera is running |
95
- | `scan` | `ScanResult` | a code was read and accepted (camera or album) |
96
- | `reject` | `{ result: ScanResult, message?: string }` | `accept` turned a code down; scanning continues |
97
- | `error` | `ScanError` | the camera could not start |
98
- | `close` | – | the user pressed ✕, or `close()` was called |
99
- | `zoom` | `{ zoom, min, max, auto, digital }` | the zoom changed |
100
-
101
- ### Methods and properties
102
-
103
- | member | description |
104
- | :--- | :--- |
105
- | `start(): Promise<void>` | start the camera (only needed with `manual`, or after `stop()`) |
106
- | `stop()` | stop the camera |
107
- | `close()` | stop, hide the element and fire `close`; `start()` opens it again |
108
- | `resume()` | scan again after a result; reopens the camera if it was stopped |
109
- | `pickImage()` | open the photo picker, e.g. from your own button |
110
- | `toggleTorch(on?): Promise<boolean>` | switch the flashlight, e.g. from your own button |
111
- | `accept` | an [`AcceptFn`](#the-accept-callback), or `undefined` |
112
- | `labels` | `Partial<ScannerLabels>`: replace any built-in text |
113
- | `active` | read-only: `true` while the camera is running |
114
- | `scanner` | the underlying [`QRScanner`](#qrscanner-headless) while running, otherwise `null` |
115
-
116
- Styling with themes, CSS variables, `::part()` and slots: [CUSTOMIZE.md](CUSTOMIZE.md).
117
-
118
- ---
119
-
120
- ## `QRScanner` (headless)
121
-
122
- The camera, auto-zoom and decoding engine without any UI. You provide the `<video>` element and draw your own interface.
123
-
124
- ```ts
125
- import { QRScanner } from 'k-qr-scanner';
126
-
127
- const scanner = new QRScanner({ video: document.querySelector('video')! });
128
- scanner.on('result', (r) => console.log(r.text));
129
- await scanner.start();
130
- ```
131
-
132
- ### Options
133
-
134
- | option | type | default | description |
135
- | :--- | :--- | :--- | :--- |
136
- | `video` | `HTMLVideoElement` | **required** | where the camera stream plays |
137
- | `facingMode` | `'environment' \| 'user'` | `'environment'` | back or front camera |
138
- | `deviceId` | `string` | – | a specific camera from `enumerateDevices()` |
139
- | `autoZoom` | `boolean` | `true` | zoom in on small codes |
140
- | `maxZoom` | `number` | `8` | zoom limit |
141
- | `continuous` | `boolean` | `false` | keep scanning after a result; the same code is ignored for 1.5 s |
142
- | `maxFrameSide` | `number` | `1920` | longest side of the analysed frame; lower is faster but reads less far |
143
- | `hiRes` | `boolean` | `true` | ask for a 4K stream when the camera has no hardware zoom |
144
- | `superResolution` | `'js' \| 'webgpu' \| false` | `'js'` | see [super-resolution](#super-resolution) |
145
- | `onnxRuntimeUrl` | `string` | jsDelivr | ONNX Runtime Web for `'webgpu'` |
146
- | `formats` | `QRFormat[]` | all | which QR-family symbols to read |
147
- | `accept` | `AcceptFn` | – | see [the `accept` callback](#the-accept-callback) |
148
-
149
- ### Methods
150
-
151
- | method | description |
152
- | :--- | :--- |
153
- | `start(): Promise<void>` | open the camera and start scanning |
154
- | `stop()` | release the camera |
155
- | `pause()` / `resume()` | pause or resume analysis while the camera stays on |
156
- | `switchCamera()` | switch between the front and back camera |
157
- | `setZoom(zoom, byUser = true)` | set the zoom; when `byUser`, auto-zoom waits a few seconds before taking over again |
158
- | `setTorch(on): Promise<boolean>` | switch the flashlight; resolves `false` if the camera has none |
159
- | `focusAt(x, y)` | focus on a point, in coordinates from 0 to 1 |
160
- | `scanImage(image): Promise<ScanResult \| null>` | read a `Blob` or `ImageBitmap`; works without a camera. `null` if there is no code or `accept` turned it down |
161
- | `setFormats(formats?)` / `setAccept(fn?)` | change `formats` or `accept` while running |
162
- | `on(event, listener): () => void` | subscribe to an event; returns a function that unsubscribes |
163
-
164
- Read-only properties: `zoom`, `zoomMin`, `zoomMax`, `canZoom`, `canTorch`, `isDigitalZoom` and `superResolutionBackend` (`'js'`, `'onnx-webgpu'`, `'onnx-wasm'` or `'off'`).
165
-
166
- ### Static members
167
-
168
- | member | description |
169
- | :--- | :--- |
170
- | `QRScanner.preload()` | download and compile the engine now, so the first scan starts instantly |
171
- | `QRScanner.isSupported()` | `true` if the browser can open a camera |
172
- | `QRScanner.engineIdleTimeout` | how long the shared engine stays warm after the last scanner stops, in ms (default `30000`) |
173
- | `QRScanner.dispose()` | shut the shared engine down now |
174
-
175
- ### Events
176
-
177
- | event | payload |
178
- | :--- | :--- |
179
- | `result` | `ScanResult` |
180
- | `reject` | `{ result: ScanResult, message?: string }` |
181
- | `error` | `ScanError` |
182
- | `hint` | `{ hint: QRHint \| null, decoded, videoWidth, videoHeight }`: where a code is, even before it can be read |
183
- | `zoom` | `{ zoom, min, max, auto, digital }` |
184
- | `dark` | `boolean`: whether the scene is too dark (a good moment to offer the flashlight) |
185
-
186
- ---
187
-
188
- ## The `accept` callback
189
-
190
- `accept` runs for every decoded code, from the camera and from photos, before it becomes the result. It can be async; scanning waits for the answer.
191
-
192
- | `accept` returns | what happens |
193
- | :--- | :--- |
194
- | `true`, or nothing | accepted: `scan` / `result` fires |
195
- | `false` | ignored; scanning continues |
196
- | a string | ignored; scanning continues and the scanner shows the string to the user |
197
- | throws or rejects | treated as `false` |
198
-
199
- A code that was turned down is not checked again while it stays in view. It is checked again once it has been out of view for 2 seconds, or after `resume()`.
200
-
201
- ```ts
202
- el.accept = (r) => r.text.startsWith('000201') || 'Please scan a LaoQR payment code';
203
- ```
204
-
205
- The same callback is available as the `accept` option of `scanQR()` and `QRScanner`, the `accept` property of the element, and the `accept` prop of every wrapper.
206
-
207
- ---
208
-
209
- ## Types
210
-
211
- ```ts
212
- interface ScanResult {
213
- text: string;
214
- bytes: Uint8Array; // raw payload
215
- format: QRFormat;
216
- version: string; // '1'…'40', 'M1'…'M4' or 'R13x27'…; '' if unknown
217
- ecLevel: string; // 'L' | 'M' | 'Q' | 'H'; '' if unknown
218
- corners: { x: number; y: number }[]; // top-left, top-right, bottom-right, bottom-left in video pixels; [] for photos
219
- zoom: number; // zoom level when the code was read
220
- timestamp: number;
221
- source: 'camera' | 'image';
222
- }
223
-
224
- /** QR Code (Model 1 and 2), Micro QR, rMQR. The constant QR_FORMATS lists all three. */
225
- type QRFormat = 'qr_code' | 'micro_qr_code' | 'rm_qr_code';
226
-
227
- type AcceptFn = (result: ScanResult) => boolean | string | void | Promise<boolean | string | void>;
228
-
229
- class ScanError extends Error {
230
- code: 'permission-denied' | 'no-camera' | 'camera-busy' | 'insecure-context' | 'unsupported' | 'unknown';
231
- }
232
-
233
- /** Where a code is in the video, in pixels. `module` is the size of one QR module. */
234
- interface QRHint { cx: number; cy: number; size: number; module: number; full: boolean }
235
- ```
236
-
237
- Other exports from `k-qr-scanner`: `KQRScannerElement` and `defineScannerElement()` (the element class and its registration), `TAG_NAME` (`'kqr-scanner'`), `LABELS` (the built-in texts), `THEME_VARS` (the CSS variable names) and `QR_FORMATS`.
238
-
239
- ---
240
-
241
- ## Framework wrappers
242
-
243
- | import | export | notes |
244
- | :--- | :--- | :--- |
245
- | `k-qr-scanner/react` | `<QRScanner>` | attributes as camelCase props, plus `onScan`, `onReject`, `onError`, `onClose`, `onReady`; children with `slot="…"` go into the UI; ships with `'use client'` |
246
- | `k-qr-scanner/vue` | `<QRScanner>` | the same props; emits `scan`, `reject`, `error`, `close`, `ready`; the default slot goes into the UI |
247
- | `k-qr-scanner/svelte` | `use:qrScanner={options}` | an action; children with `data-slot="…"` go into the UI |
248
- | `k-qr-scanner/react-native` | `<QRScanner>` | iOS, Android and Expo; see [REACT_NATIVE.md](REACT_NATIVE.md) |
249
-
250
- Examples for every framework: [FRAMEWORKS.md](FRAMEWORKS.md).
251
-
252
- ---
253
-
254
- ## Super-resolution
255
-
256
- Small or blurry codes that still fail to decode get one more try: the region is upscaled by WeChat's super-resolution network, then decoded again.
257
-
258
- | `superResolution` | how it runs | cost |
259
- | :--- | :--- | :--- |
260
- | `'js'` (default) | a built-in kernel inside the worker | no download; slower, so it is used on small regions only |
261
- | `'webgpu'` | ONNX Runtime Web on WebGPU, falling back to its WebAssembly backend, then to `'js'` | loads ONNX Runtime Web from `onnxRuntimeUrl` |
262
- | `'off'` | – | – |
263
-
264
- ## `k-qr-scanner/sr`
265
-
266
- The super-resolution model on its own, for your own image pipelines: `superResolve(gray, height, width)`, `createOnnxSuperRes(ort, providers)` and `srModelBytes()`. The ONNX file is also available as `k-qr-scanner/models/wechat_sr.onnx`.
267
-
268
- ---
269
-
270
- ## CLI
271
-
272
- ```bash
273
- npx k-qr-scanner init # install and write a starter component
274
- npx k-qr-scanner doctor # check the project setup
275
- ```
276
-
277
- `init` detects the framework (Next.js, Nuxt, SvelteKit, Svelte, Angular, Vue, React Native / Expo, React or plain JavaScript) and the package manager (npm, pnpm, yarn or bun), installs the package and writes a scanner component. For React Native it also installs `react-native-webview` and adds the camera permissions.
278
-
279
- | option | description |
280
- | :--- | :--- |
281
- | `--framework <name>` | skip detection: `next`, `nuxt`, `sveltekit`, `svelte`, `angular`, `vue`, `react-native`, `react` or `vanilla` |
282
- | `--pm <name>` | skip detection: `npm`, `pnpm`, `yarn` or `bun` |
283
- | `--theme <name>` | theme for the component (default `wechat`) |
284
- | `--locale <code>` | language for the component (default `en`) |
285
- | `--out <path>` | where to write the component |
286
- | `--from <spec>` | install a specific version, tag or tarball |
287
- | `--no-install` | don't install packages; still write the component and permissions |
288
- | `--force` | overwrite an existing component |
289
- | `--dry-run` | show what would happen without changing anything |
290
- | `--cwd <dir>` | the project directory |
291
-
292
- `doctor` checks the Node version, the installation, framework-specific setup (React Native: the WebView package and both camera permissions) and any Content-Security-Policy in your HTML that would block the engine.
package/docs/BENCHMARK.md DELETED
@@ -1,101 +0,0 @@
1
- # Benchmark
2
-
3
- How k-qr-scanner compares with jsQR, ZXing and the real WeChat engine, how the numbers were measured, and what they don't cover.
4
-
5
- > The latest numbers are generated into [`bench/results.md`](../bench/results.md) and the README table by `npm run bench`. The tables below are from the 0.1.0 run on 2026-11-19. The README table comes from a later run, so its numbers differ slightly.
6
-
7
- ## Setup
8
-
9
- | | |
10
- | :--- | :--- |
11
- | machine | Intel Core Ultra 5 125U laptop (Intel Xe-LPG GPU), Windows 11 |
12
- | software | Node 26, Chrome 157 |
13
- | reproduce | `npx tsx bench/run.mts` (accuracy and CPU latency), `npx tsx bench/browser.mts` (Chrome and WebGPU) |
14
- | raw output | `bench/results.md`, and `bench/out/*.json` after a local run |
15
-
16
- ### Engines
17
-
18
- | engine | what it is |
19
- | :--- | :--- |
20
- | jsQR | a pure JavaScript decoder, on the full frame |
21
- | ZXing-C++ (WASM) | the `zxing-wasm` reader on the full frame, with `tryHarder` |
22
- | k-qr-scanner | this library without super-resolution: ZXing on the full frame, then the finder-pattern locator and texture detector, then decoding of an upscaled region |
23
- | k-qr-scanner + WeChat SR | the same, plus WeChat's super-resolution network on small regions that still fail (JS kernel or ONNX Runtime) |
24
- | **WeChat (OpenCV C++)** | the real WeChat engine as published in OpenCV contrib `wechat_qrcode` 4.14: CNN detector, CNN super-resolution and decoder, as **native C++** called from Python |
25
-
26
- ### Dataset
27
-
28
- 144 synthetic 1280×720 camera frames, plus 8 frames with no code. They combine:
29
-
30
- - perspective (±12 %) and any rotation;
31
- - Gaussian defocus (σ 0, 0.8 or 1.5);
32
- - sensor noise (σ 5) and an illumination gradient;
33
- - high or low contrast;
34
- - two payloads: a short URL and a long EMVCo / LaoQR payment string.
35
-
36
- Every engine gets identical pixels. A frame counts as a hit only when the decoded text matches exactly.
37
-
38
- ## Results
39
-
40
- ### Decode rate by module size
41
-
42
- The module size is how many pixels one QR module covers; smaller means farther away.
43
-
44
- | engine | 1.5 px | 2 px | 2.5 px | 3 px | 4 px | 6 px | **all** |
45
- | :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
46
- | jsQR | 0% | 25% | 25% | 46% | 67% | 88% | **42%** |
47
- | ZXing-C++ (WASM) | 4% | 38% | 63% | 67% | 96% | 100% | **61%** |
48
- | k-qr-scanner | 8% | 42% | 63% | 67% | 96% | 100% | **63%** |
49
- | k-qr-scanner + WeChat SR (JS kernel) | 13% | 42% | 63% | 67% | 96% | 100% | **63%** |
50
- | k-qr-scanner + WeChat SR (ONNX Runtime) | 17% | 42% | 63% | 67% | 96% | 100% | **64%** |
51
- | WeChat (OpenCV C++) | **29%** | 42% | 50% | 63% | 88% | 100% | **62%** |
52
-
53
- ### Decode rate by condition
54
-
55
- | engine | sharp | blur σ 0.8 | blur σ 1.5 | high contrast | low contrast |
56
- | :--- | :---: | :---: | :---: | :---: | :---: |
57
- | jsQR | 67% | 46% | 13% | 39% | 44% |
58
- | ZXing-C++ (WASM) | 85% | 67% | 31% | 63% | 60% |
59
- | k-qr-scanner | 88% | 69% | 31% | 64% | 61% |
60
- | k-qr-scanner + WeChat SR (ONNX Runtime) | 88% | 73% | 31% | 67% | 61% |
61
- | WeChat (OpenCV C++) | 85% | 73% | 27% | **71%** | 53% |
62
-
63
- ### Time per 1280×720 frame (CPU, one thread, ms)
64
-
65
- | engine | p50 | p95 | frame without a code (p50) | false positives |
66
- | :--- | :---: | :---: | :---: | :---: |
67
- | jsQR | 33.7 | 48.3 | 98.4 | 0 |
68
- | ZXing-C++ (WASM) | 7.6 | 12.4 | 4.9 | 0 |
69
- | k-qr-scanner | 9.7 – 17.2 ¹ | 28 – 38 ¹ | 17 – 37 ¹ | 0 |
70
- | k-qr-scanner + WeChat SR (JS kernel) | 14.3 | 167.9 | 25.8 | 0 |
71
- | k-qr-scanner + WeChat SR (ONNX Runtime) | 15.4 | 58.7 | 23.2 | 0 |
72
- | WeChat (OpenCV C++, 1 thread) | 13.9 | 96.4 | **292.5** | 0 |
73
- | WeChat (OpenCV C++, 14 threads) | 11.7 | 91.3 | 303.0 | 0 |
74
-
75
- ¹ The range of two runs of the same code. This laptop's CPU throttles under heat, so absolute times can move by about ±50 % between runs; compare engines within one run (see `bench/results.md`).
76
-
77
- ### Super-resolution in Chrome (ms per region)
78
-
79
- | region | built-in JS kernel | ONNX Runtime Web, WebAssembly | **ONNX Runtime Web, WebGPU** (Intel Xe-LPG) |
80
- | :--- | :---: | :---: | :---: |
81
- | 64×64 | 52.6 | 4.7 | 6.7 |
82
- | 96×96 | 109.3 | 9.6 | 7.8 |
83
- | 128×128 | 200.4 | 16.8 | **9.9** |
84
- | 160×160 | 346.9 | 38.5 | 16.3 |
85
- | 240×240 | 733.2 | 61.9 | **28.3** |
86
-
87
- End to end: in Chrome with a fake camera, a scanner with `superResolution: 'webgpu'` loaded ONNX Runtime in its worker, chose the `onnx-webgpu` backend and read the code.
88
-
89
- ## What the numbers say
90
-
91
- 1. **Overall accuracy matches WeChat's open-source engine**: 64 % against 62 %. k-qr-scanner does better on mid-range codes (2.5–4 px) and low contrast. WeChat is clearly better on the farthest codes (1.5 px: 29 % against 17 %) and on high contrast.
92
- 2. **WeChat's lead on the farthest codes comes from its CNN detector, not from super-resolution.** `bench/diag.mts` crops each code at its known position and decodes the crop. There, upscaling 2× with super-resolution reads about as well as plain bilinear 2×: what fails is *finding* tiny blurred codes. The locator found 0 of 8 codes at 1.5–2 px with σ 0.8 blur. Super-resolution still adds a little when it is followed by a bilinear 2×, which is how k-qr-scanner uses it.
93
- 3. **That detector is expensive on frames with no code.** WeChat spends about 290 ms on each empty 720p frame on the CPU; k-qr-scanner spends 17–37 ms (ZXing alone: 5 ms). A live camera mostly sees frames without a code, so this decides battery use and responsiveness.
94
- 4. **In the browser, run super-resolution on WebGPU or WebAssembly, not the JS kernel.** ONNX Runtime Web is 12–25× faster. That is why the JS kernel only gets regions up to 112 px, and ONNX Runtime up to 240 px.
95
-
96
- ## Limits
97
-
98
- - **Synthetic frames.** Real camera frames also have motion blur, compression and image-processing artifacts, glare and curved surfaces, which this set does not model. A set of real phone photos is the next step.
99
- - **A small sample.** Each module-size column has 24 codes, so one frame is about 4 points. Differences under about 8 points are within noise.
100
- - **Not like for like.** WeChat runs as native C++ here, while k-qr-scanner runs as WebAssembly and JavaScript. Inside the WeChat app it probably runs on optimized mobile kernels; that pipeline is not public.
101
- - **Not measured.** Alipay and TikTok (closed engines), and iOS and Android devices. Phones will give different numbers, so measure on your target devices with a page like `bench/browser.mts`.
package/docs/CUSTOMIZE.md DELETED
@@ -1,150 +0,0 @@
1
- # Customizing the scanner
2
-
3
- There are several layers of customization, from a single attribute to a UI you build yourself. Start with the lightest one that does what you need; each layer works together with the ones before it.
4
-
5
- | you want to | use |
6
- | :--- | :--- |
7
- | pick a look | [a theme](#themes) |
8
- | change colors, sizes and fonts | [CSS variables](#css-variables) |
9
- | restyle one built-in piece | [`::part()`](#parts) |
10
- | add your own buttons, tabs or screens | [slots](#slots) |
11
- | change the text or language | [languages and labels](#languages-and-labels) |
12
- | build a completely different UI | [headless mode](#headless-mode) |
13
-
14
- The examples use the `<kqr-scanner>` element. The same attributes work as props in the React, Vue and Svelte wrappers (in camelCase: `zoom-control` becomes `zoomControl`) and as options of `scanQR()`.
15
-
16
- ## Themes
17
-
18
- | `theme` | look | default accent |
19
- | :--- | :--- | :--- |
20
- | `wechat` (default) | a thin glowing line sweeps the whole screen, with no frame | `#07c160` |
21
- | `alipay` | a gradient band with a bright edge sweeps the whole screen | `#1677ff` |
22
- | `grid` | corner brackets with a grid sweeping inside, no dimming | `#1fd17a` |
23
- | `frame` | a dimmed mask around a frame with a scan line | `#1fd17a` |
24
- | `none` | the camera only; you draw the UI | – |
25
-
26
- The frame is decoration only. The scanner always reads the **whole camera image**, as WeChat and Alipay do.
27
-
28
- More options that change the look:
29
-
30
- | attribute | values | description |
31
- | :--- | :--- | :--- |
32
- | `success` | `dot` (default) · `box` · `none` | marker on the found code. `dot` is the WeChat/Alipay check mark, shown on a frozen frame |
33
- | `torch` | `auto` (default) · `always` · `never` | flashlight button; `auto` shows it only when the scene gets dark |
34
- | `zoom-control` | `none` (default) · `slider` | a zoom slider; pinch, double-tap and auto-zoom always work |
35
- | `heading` | text | title in the top bar |
36
- | `no-close` · `no-gallery` · `no-torch` · `no-beep` · `no-vibrate` | flags | hide a button or turn off feedback |
37
- | `no-candidates` | flag | hide the brackets drawn around a code that can't be read yet |
38
-
39
- ## CSS variables
40
-
41
- Set them on the element or on any parent element:
42
-
43
- ```css
44
- kqr-scanner {
45
- --kqr-accent: #e60012; /* scan line and corners */
46
- --kqr-success: #00b578; /* check mark */
47
- --kqr-scan-duration: 1.8s; /* one sweep of the scan line */
48
- --kqr-line-width: 4px;
49
- --kqr-frame-size: 260px; /* frame and grid themes */
50
- --kqr-frame-top: 40%;
51
- --kqr-frame-radius: 20px;
52
- --kqr-corner-size: 30px;
53
- --kqr-corner-width: 5px;
54
- --kqr-mask: rgba(0, 0, 0, .6); /* frame theme */
55
- --kqr-button-bg: rgba(255, 255, 255, .18);
56
- --kqr-button-size: 56px;
57
- --kqr-text: #fff;
58
- --kqr-font: "Noto Sans Lao", sans-serif;
59
- --kqr-bg: #000; /* behind the video */
60
- }
61
- ```
62
-
63
- `scanQR()` takes them as `style: { '--kqr-accent': '#e60012' }`, and the React wrapper as its `style` prop. The full list is exported as `THEME_VARS`.
64
-
65
- ## Parts
66
-
67
- Every built-in piece of the UI is exposed as a CSS part, so you can restyle it from outside:
68
-
69
- `stage` · `video` · `candidates` · `effect` · `scanline` · `frame` · `success` · `focus-ring` · `top` · `title` · `close` · `bottom` · `hint` · `torch` · `zoom` · `actions` · `gallery` · `error`
70
-
71
- ```css
72
- kqr-scanner::part(hint) { font-size: 16px; background: #0006; padding: 6px 14px; border-radius: 20px; }
73
- kqr-scanner::part(scanline) { filter: drop-shadow(0 0 8px #fff); }
74
- kqr-scanner::part(close) { display: none; }
75
- ```
76
-
77
- ## Slots
78
-
79
- Put your own elements into the scanner UI with the `slot` attribute:
80
-
81
- | slot | replaces | ideas |
82
- | :--- | :--- | :--- |
83
- | `top-left` | the ✕ close button | a back arrow |
84
- | `top-center` | the heading | your logo |
85
- | `top-right` | – | a "…" menu |
86
- | `hint` | the status text | your own animated hint |
87
- | `actions-left` | – | a "My QR code" button (WeChat) or "Receive money" (Alipay) |
88
- | `actions-right` | the album button | your own album button |
89
- | `footer` | – | tabs such as Scan · Translate · AR |
90
- | `error` | the error text | a branded camera-permission screen |
91
-
92
- ```html
93
- <kqr-scanner theme="alipay" locale="zh">
94
- <button slot="actions-left" onclick="openMyCode()">我的二维码</button>
95
- <button slot="actions-right" onclick="this.closest('kqr-scanner').pickImage()">相册</button>
96
- <nav slot="footer"><b>扫码</b><span>识物</span><span>AR</span></nav>
97
- </kqr-scanner>
98
- ```
99
-
100
- Your buttons can call the element's methods: `pickImage()`, `toggleTorch()`, `close()` and `resume()`.
101
-
102
- In the wrappers:
103
-
104
- - **React and Vue** pass children through as they are: `<QRScanner><button slot="actions-left">…</button></QRScanner>`.
105
- - **Svelte** uses `data-slot="…"` instead of `slot`, because Svelte 5 only allows `slot` inside custom elements.
106
- - **React Native** takes slots as HTML strings; see [REACT_NATIVE.md](REACT_NATIVE.md#props).
107
-
108
- ## Languages and labels
109
-
110
- English (`en`), Lao (`lo`) and Chinese (`zh`) are built in. Without a `locale` attribute, the browser language is used, falling back to English.
111
-
112
- Replace any text with the `labels` property (the `labels` prop or option in the wrappers and `scanQR()`):
113
-
114
- ```ts
115
- el.labels = { hint: 'ສະແກນເພື່ອຈ່າຍ', torchOn: 'ເປີດໄຟ' };
116
- ```
117
-
118
- | label | shown |
119
- | :--- | :--- |
120
- | `hint` | while scanning |
121
- | `zooming` | while auto-zoom moves in on a code |
122
- | `dark` | when the scene is too dark |
123
- | `torchOn` / `torchOff` | on the flashlight button |
124
- | `gallery` | on the album button |
125
- | `noQrInImage` | when a picked photo has no code |
126
- | `close` | label of the ✕ button |
127
- | `permission` | camera permission denied |
128
- | `noCamera` | no camera found |
129
- | `busy` | the camera is used by another app |
130
- | `insecure` | the page is not served over HTTPS |
131
- | `unsupported` | the browser can't open a camera |
132
-
133
- For another language, pass all labels in that language; any label you leave out is shown in English. The built-in texts are exported as `LABELS`.
134
-
135
- ## Headless mode
136
-
137
- For a completely different interface, use the `QRScanner` class with your own `<video>` element. It does the camera, auto-zoom and decoding, and reports what it sees through events:
138
-
139
- ```ts
140
- import { QRScanner } from 'k-qr-scanner';
141
-
142
- const scanner = new QRScanner({ video, superResolution: 'webgpu' });
143
- scanner.on('hint', ({ hint }) => drawBox(hint)); // a code is in view but can't be read yet
144
- scanner.on('zoom', ({ zoom }) => showZoom(zoom));
145
- scanner.on('dark', (dark) => showTorchButton(dark));
146
- scanner.on('result', (r) => done(r.text));
147
- await scanner.start();
148
- ```
149
-
150
- All options and events: [API.md](API.md#qrscanner-headless).