generated from digitalbazaar/bedrock-module-template-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Vue components supporting bedrock web optical scanner library #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bparth24
wants to merge
18
commits into
main
Choose a base branch
from
add-vue-components
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
bfd5c32
Add MRZ scanning support with Dynamsoft native camera UI.
bparth24 79f7fad
constrain MRZ scanner to component container using Dynamsoft containe…
bparth24 4431075
functional mrz scan - working demo
bparth24 d149f62
Refactor OpticalScanner to use CameraScanner delegation.
bparth24 a6aefda
Streamline ScannerUI for pure framework integration.
bparth24 a68a6c9
Update ScannerDemo to showcase new architecture.
bparth24 33e0463
Update eslint and ensure eslint rules followed in all files
bparth24 f9fc57c
Update changelog
bparth24 74091fd
Update readme instructions
bparth24 7616656
Update package.json dependencies
bparth24 b26b660
Remove edv pouch related test files from this lib
bparth24 6c31ffd
Rename directory - src to demo - for clarity
bparth24 850cb90
docs: remove word from OpticalScanner comment
bparth24 394872f
Update package.json
mandyvenables 0721419
Update package.json
mandyvenables bb6385c
Update ScannerDemo.vue
mandyvenables 572bdcd
Move license configuration to bedrock config.
bparth24 a37b8cd
Update Changelog.
bparth24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,3 +10,4 @@ coverage | |
| node_modules | ||
| reports | ||
| .cache | ||
| .DS_STORE | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,114 +1,32 @@ | ||
| # bedrock-web-pouch-edv ChangeLog | ||
| # bedrock-vue-optical-scanner ChangeLog | ||
|
|
||
| ## 8.2.0 - 2025-07-18 | ||
|
|
||
| ### Changed | ||
| - Update dependencies: | ||
| - `@digitalbazaar/[email protected]` | ||
| - `pouchdb@9` | ||
| - `pouchdb-adapter-indexeddb@9` | ||
| - `pouchdb-find@9` | ||
| - dev deps and removal of `uuid`. | ||
| - Note: While pouchdb* packages have been bumped by two major versions, no | ||
| significant breaking changes are expected. The changes included internal | ||
| ES5 => ES6+ API changes that were not relevant here and a new default | ||
| limit on `find()` queries of `25`, but every `find()` query is already | ||
| expected to have provided a default or a default is provided by this | ||
| library. | ||
|
|
||
| ## 8.1.0 - 2023-11-07 | ||
| ## 1.1.0 - 2025-09-27 | ||
|
|
||
| ### Added | ||
| - Add new `cipherVersion` parameter to control whether the cipher version | ||
| is "recommended" or "fips". The default (and previous only option) | ||
| remains "recommended". | ||
|
|
||
| ## 8.0.0 - 2023-10-16 | ||
| - **BREAKING**: Refactored Vue components to use CameraScanner delegation pattern | ||
| - OpticalScanner.vue now uses CameraScanner from `bedrock-web-optical-scanner` | ||
| - Thin wrapper architecture enables easy duplication in other frameworks | ||
|
|
||
| ### Changed | ||
| - **BREAKING**: Drop support for Node.js < 18. | ||
| - Use `@digitalbazaar/[email protected]` that drops support for Node.js < 18 and | ||
| uses `@digitalbazaar/http-client@4` and `canonicalize@2`. | ||
|
|
||
| ## 7.0.0 - 2022-08-19 | ||
|
|
||
| ### Changed | ||
| - **BREAKING**: Use `exports` instead of `module`. | ||
| - Update dependencies. | ||
| - Lint module. | ||
| - **NOTE**: Vue components are now thin wrappers focused purely on UI concerns | ||
| - ScannerUI.vue streamlined for pure framework integration | ||
| - Clean separation between CameraScanner area and Vue overlay area | ||
| - Removed scanning business logic to achieve framework-agnostic design | ||
| - Configuration simplified to scanType/scanMode props instead of complex plugin setup | ||
|
|
||
| ## 6.0.1 - 2022-05-30 | ||
|
|
||
| ### Fixed | ||
| - Add purge operation to clean up deleted docs to prevent premature storage | ||
| quota overflow. | ||
|
|
||
| ## 6.0.0 - 2022-05-30 | ||
|
|
||
| ### Changed | ||
| - **BREAKING**: Use `indexeddb` adapter instead of `idb` adapter. This version | ||
| will also impose a `br_edv_` (bedrock EDV) prefix on database names, | ||
| causing all new databases to be created, leaving old ones alone. There is | ||
| no migration code available to convert an old database to a new one in this | ||
| version. | ||
| ### Improved | ||
|
|
||
| ## 5.0.0 - 2022-05-05 | ||
|
|
||
| ### Changed | ||
| - **BREAKING**: Use `@digitalbazaar/edv-client@14` with new blind | ||
| attributes version. | ||
|
|
||
| ## 4.1.0 - 2022-05-03 | ||
|
|
||
| ### Changed | ||
| - Improve pouchdb index performance by marking deleted EDV doc | ||
| records with `_deleted` flag. | ||
|
|
||
| ## 4.0.0 - 2022-04-05 | ||
|
|
||
| ### Changed | ||
| - **BREAKING**: Rename package to `@bedrock/web-pouch-edv`. | ||
| - **BREAKING**: Convert to module (ESM). | ||
| - **BREAKING**: Remove default export. | ||
| - **BREAKING**: Require node 14.x. | ||
| - All scanning complexity now delegated to `bedrock-web-optical-scanner` module | ||
| - Vue components leverage framework-specific features (Quasar UI, reactivity) without scanning logic | ||
| - Architecture enables rapid React/other framework development with minimal duplication | ||
| - Better separation of concerns between presentation layer and scanning engine | ||
|
|
||
| ## 3.0.0 - 2022-03-01 | ||
|
|
||
| ### Changed | ||
| - **BREAKING**: Use `@digitalbazaar/edv-client@13`. | ||
|
|
||
| ## 2.0.1 - 2022-02-24 | ||
|
|
||
| ### Fixed | ||
| - Provide alternative to `crypto.randomUUID` via `uuid` package. | ||
|
|
||
| ## 2.0.0 - 2022-02-23 | ||
|
|
||
| ### Changed | ||
| - **BREAKING**: Use `@digitalbazaar/edv-client@12`. This new version | ||
| produces encrypted indexes differently (more privacy preserving) | ||
| and is incompatible with the previous version. | ||
|
|
||
| ## 1.2.0 - 2022-02-05 | ||
| ## 1.0.0 - 2025-09-14 | ||
|
|
||
| ### Added | ||
| - Add support for `limit` in EDV queries. | ||
|
|
||
| ## 1.1.0 - 2022-02-03 | ||
|
|
||
| ### Added | ||
| - Automatically initialize databases when using | ||
| `PouchEdvClient` to generate a new EDV or load an one. | ||
|
|
||
| ### Fixed | ||
| - Fix `db.type()` deprecation warnings. | ||
| - Prevent double initialization of databases. | ||
|
|
||
| ## 1.0.1 - 2022-02-02 | ||
|
|
||
| ### Changed | ||
| - Update dependencies. | ||
|
|
||
| ## 1.0.0 - 2022-01-31 | ||
|
|
||
| - See git history for changes. | ||
| - Vue.js components `OpticalScanner.vue` and `ScannerUI.vue` with reactive state management. | ||
| - Scan type selection interface allowing users to choose between barcode/QR scanning and MRZ document scanning. | ||
| - Timeout configuration system with format-specific timeouts (no timeout for MRZ camera mode, configurable timeouts for other formats). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,216 @@ | ||
| # bedrock-web-pouch-edv | ||
| # @bedrock/vue-optical-scanner | ||
|
|
||
| A Vue.js component library for optical scanning that provides reusable UI components | ||
| for barcode, QR code, MRZ (Machine Readable Zone), and other optical code scanning. | ||
| This library follows a plugin-based architecture and separates scanning logic from | ||
| UI components. | ||
|
|
||
| ## Architecture | ||
|
|
||
| This library is part of a two-tier architecture for optical scanning: | ||
|
|
||
| ### Core Libraries | ||
|
|
||
| - **@bedrock/web-optical-scanner**: Low-level scanning engine with plugin architecture | ||
| - **CameraScanner**: High-level abstraction for camera management and continuous scanning | ||
| - **OpticalScanner**: Core scanning engine with plugin system | ||
| - **@bedrock/vue-optical-scanner**: Vue-specific UI components (this library) | ||
|
|
||
| ### Architecture Benefits | ||
|
|
||
| #### Separation of Concerns | ||
|
|
||
| - **Vue Layer**: Handles only UI presentation, Quasar integration, and Vue-specific reactivity | ||
| - **Web Module**: Manages all scanning logic, camera control, and business rules | ||
| - **Clean Delegation**: Vue components pass containers to CameraScanner and handle results via events | ||
|
|
||
| #### Framework Agnostic Design | ||
|
|
||
| - All scanning improvements happen in one place (web module) | ||
| - Vue components can be rapidly duplicated for React, Angular, etc. | ||
| - Framework wrappers focus only on what frameworks do best (UI, reactivity, styling) | ||
|
|
||
| ### Architecture Principles | ||
|
|
||
| #### Plugin-Based Scanning Engine | ||
|
|
||
| The underlying `@bedrock/web-optical-scanner` provides: | ||
|
|
||
| - Async API that accepts elements/images and options, returns scan results | ||
| - Multiple scan modes: | ||
| - `first`: Resolves as soon as any specified format is detected | ||
| - `all`: Resolves when all specified formats have results | ||
| - `exhaustive`: Resolves after all plugins have completed their efforts | ||
| - Extensible plugin system for adding new scanning formats | ||
| - Future-ready for web worker threading (API designed to support this) | ||
|
|
||
| #### Vue UI Components (Thin Wrappers) | ||
|
|
||
| This library provides: | ||
|
|
||
| - **Thin wrapper components** that delegate all scanning complexity to CameraScanner | ||
| - Vue-specific UI components focused purely on presentation and framework integration | ||
| - Camera display containers that CameraScanner manages internally | ||
| - Simple prop-based configuration (scanType, scanMode, licenseKey) | ||
| - Event-based result handling with no business logic in Vue layer | ||
| - **Easy duplication**: Components designed for rapid porting to React/other frameworks | ||
|
|
||
| ### Supported Formats | ||
|
|
||
| - **QR Codes**: Standard QR code scanning | ||
| - **PDF417**: Standard PDF417 barcode format | ||
| - **Enhanced PDF417**: Advanced PDF417 with additional processing for driver licenses | ||
| - **MRZ**: Machine Readable Zone for passports and ID documents | ||
|
|
||
| ## Components | ||
|
|
||
| ### OpticalScanner | ||
|
|
||
| A thin wrapper component that delegates camera and scanning operations to CameraScanner from `@bedrock/web-optical-scanner`. | ||
|
|
||
| **Architecture**: This component provides Vue-specific UI and event handling while CameraScanner handles all scanning complexity internally. | ||
|
|
||
| **Props:** | ||
|
|
||
| - `scanType` (required): `'mrz'` or `'barcode'` | ||
| - `scanMode`: `'first'` (default), `'all'`, or `'exhaustive'` | ||
| - `tipText`: Instruction text for users | ||
| - `showQrBox`: Boolean to show/hide scanning frame overlay | ||
dlongley marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - `torchOn`: Boolean to control camera flash | ||
| - `licenseKey`: Dynamsoft License key for enhanced scanning features | ||
dlongley marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| **Events:** | ||
|
|
||
| - `@result`: Emitted when scan is successful | ||
| - `@error`: Emitted when scan fails | ||
| - `@close`: Emitted when scanner is closed | ||
|
|
||
| ### ScannerUI | ||
|
|
||
| Lower-level UI component that handles camera display and controls. | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Basic Usage | ||
|
|
||
| ```vue | ||
| <template> | ||
| <div> | ||
| <q-btn @click="openScanner">Start Scan</q-btn> | ||
| <q-dialog v-model="scannerOpen" maximized> | ||
| <OpticalScanner | ||
| scan-type="barcode" | ||
| scan-mode="first" | ||
| @result="onResult" | ||
| @error="onError" | ||
| @close="scannerOpen = false" | ||
| /> | ||
| </q-dialog> | ||
| </div> | ||
| </template> | ||
| <script> | ||
| import {OpticalScanner} from '@bedrock/vue-optical-scanner'; | ||
| // OpticalScanner now uses CameraScanner delegation internally | ||
bparth24 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| export default { | ||
| components: { OpticalScanner }, | ||
| data() { | ||
| return { | ||
| scannerOpen: false | ||
| }; | ||
| }, | ||
| methods: { | ||
| onResult(result) { | ||
| console.log('Scan result:', result); | ||
| this.scannerOpen = false; | ||
| }, | ||
| onError(error) { | ||
| console.error('Scan error:', error); | ||
| } | ||
| } | ||
| }; | ||
| </script> | ||
| ``` | ||
|
|
||
| ScannerDemo Component | ||
| The ScannerDemo component provides a complete example implementation showing: | ||
|
|
||
| - Document type selection (MRZ vs Barcode) | ||
| - Scanner controls and modal integration | ||
| - Result display for different scan types | ||
| - Error handling | ||
|
|
||
| Key Features Demonstrated: | ||
|
|
||
| - MRZ Scanning: Passport and ID document recognition with field validation | ||
| - Barcode Scanning: QR codes, PDF417, and enhanced PDF417 for driver licenses | ||
dlongley marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Result Processing: Type-specific result handling and display | ||
| - Camera Management: Start/stop controls with proper lifecycle management | ||
|
|
||
| Usage in Demo: | ||
|
|
||
| ```vue | ||
| <template> | ||
| <!-- Document type selection --> | ||
| <q-option-group v-model="scanType" :options="scanTypeOptions" /> | ||
| <!-- Scanner integration --> | ||
| <OpticalScanner | ||
| :scan-type="scanType" | ||
| :scan-mode="scanMode" | ||
| @result="onResult" | ||
| @error="onError" | ||
| /> | ||
| </template> | ||
| ``` | ||
|
|
||
| Installation | ||
|
|
||
| ```bash | ||
| npm install @bedrock/vue-optical-scanner | ||
| ``` | ||
|
|
||
| Peer Dependencies | ||
|
|
||
| ```bash | ||
| npm install vue@^3.4.21 @bedrock/quasar@^10.0.0 @bedrock/web-fontawesome@^2.0.0 | ||
| ``` | ||
|
|
||
| Development Setup | ||
| Prerequisites | ||
|
|
||
| - Node.js >= 20 | ||
| - npm or yarn | ||
|
|
||
| Getting Started | ||
|
|
||
| 1. Clone and install dependencies: | ||
|
|
||
| ```bash | ||
| git clone URL | ||
| cd vue-optical-scanner | ||
| npm install | ||
| ``` | ||
|
|
||
| 2. Start development server: | ||
|
|
||
| ```bash | ||
| npm run dev | ||
| ``` | ||
|
|
||
| 3. Access the demo: Navigate to `http://localhost:5173` to see the ScannerDemo component in action. | ||
|
|
||
| Development Scripts | ||
|
|
||
| ```bash | ||
| # Start development server with hot reload | ||
| npm run dev | ||
|
|
||
| # Lint code | ||
| npm run lint | ||
|
|
||
| # Fix linting issues | ||
| npm run lint:fix | ||
| ``` | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidlehn if you have time and could help wipe out / squash-away the old history from the module this built off of before we release 1.0 that would be great, it's ok if not.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dlongley @davidlehn
There is a PR already - digitalbazaar/bedrock-module-template-web#1 -- need to make decision on where certain content should be -- readme versus some other place.