@microblink/capture 1.1.1 → 1.2.1
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 +10 -6
- package/dist/capture.js +1287 -1265
- package/dist/capture.umd.cjs +37 -37
- package/dist/resources/advanced/capture-wasm.data +0 -0
- package/dist/resources/advanced/capture-wasm.js +138 -148
- package/dist/resources/advanced/capture-wasm.wasm +0 -0
- package/dist/resources/advanced-threads/capture-wasm.data +0 -0
- package/dist/resources/advanced-threads/capture-wasm.js +155 -164
- package/dist/resources/advanced-threads/capture-wasm.wasm +0 -0
- package/dist/resources/advanced-threads/capture-wasm.worker.js +1 -1
- package/dist/resources/basic/capture-wasm.data +0 -0
- package/dist/resources/basic/capture-wasm.js +138 -148
- package/dist/resources/basic/capture-wasm.wasm +0 -0
- package/dist/resources/capture-worker.js +2 -2
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/types/index.d.cts +117 -75
- package/types/index.d.ts +117 -75
- package/microblink-capture-1.1.1.tgz +0 -0
package/README.md
CHANGED
|
@@ -127,23 +127,27 @@ The SDK will terminate automatically if the video element is dismounted and requ
|
|
|
127
127
|
|
|
128
128
|
### Configuring the Capture SDK
|
|
129
129
|
|
|
130
|
-
The SDK can be configured on initialization using `createCaptureSdk(settings)` . The configuration documentation can be found on [`CaptureSdkSettings`](/packages/capture-main/src/createCaptureSdk.ts#30).
|
|
130
|
+
The SDK can be configured on initialization using `createCaptureSdk(settings)` . The configuration documentation can be found on [`CaptureSdkSettings`](/packages/capture-main/src/core/createCaptureSdk.ts#30).
|
|
131
131
|
|
|
132
132
|
The capturing process is handled using the [`Analyzer`](/packages/capture-wasm/src/Analyzer.ts). The configuration settings for the `Analyzer` can be found on [`AnalyzerSettings`](/packages/capture-wasm/src/AnalyzerSettings.ts).
|
|
133
133
|
|
|
134
134
|
### Configuring the Capture UI
|
|
135
135
|
|
|
136
|
-
`createCaptureUi` takes a [`CreateCaptureUiSettings`](/packages/capture-
|
|
136
|
+
`createCaptureUi` takes a [`CreateCaptureUiSettings`](/packages/capture-main/src/ui/createCaptureUi.tsx#52) configuration object as a parameter with both [`CaptureSdkSettings`](/packages/capture-main/src/core/createCaptureSdk.ts#30) that configures the SDK behaviour, and [`UiSettings`](/packages/capture-main/src/ui/StoreContext.tsx#36) which configures the UI itself.
|
|
137
137
|
|
|
138
138
|
You can configure the mount point of the UI, toggle the display of the onboarding screen and help screens, the error screen and provide your own localization strings.
|
|
139
139
|
|
|
140
|
-
You can find a list of all the localization strings in [`packages/capture-
|
|
140
|
+
You can find a list of all the localization strings in [`packages/capture-main/src/ui/locales/en.ts`](/packages/capture-main/src/ui/locales/en.ts)
|
|
141
141
|
|
|
142
142
|
## Advanced usage
|
|
143
143
|
|
|
144
|
+
### Instantiating the Capture UI with a preloaded `CaptureSdk` instance
|
|
145
|
+
|
|
146
|
+
In cases you want to reuse the `CaptureSdk` instance between component mounts/dismounts, preload it before showing the UI, or otherwise have greater control over the lifecycle of the SDK, you can use [`createCaptureUiWithInstance`](packages/capture-main/src/ui/createCaptureUi.tsx#67), which instead of SDK settings takes an instance of the `CaptureSdk`. You can see the usage in the `example-solidjs-sdk-preinit`.
|
|
147
|
+
|
|
144
148
|
### State management and subscriptions
|
|
145
149
|
|
|
146
|
-
The Capture SDK tracks its internal state on the [`ReactiveStore`](/packages/capture-main/src/zustandStore.ts#8) object, which is implemented using [Zustand](https://github.com/pmndrs/zustand).
|
|
150
|
+
The Capture SDK tracks its internal state on the [`ReactiveStore`](/packages/capture-main/src/core/zustandStore.ts#8) object, which is implemented using [Zustand](https://github.com/pmndrs/zustand).
|
|
147
151
|
|
|
148
152
|
The user can get the internal state of the SDK at any time by calling `getState()` on the `CaptureSdk` object returned by `createCaptureSdk`. `CaptureSdk` is also available on the `CaptureComponent` instance returned by `createCaptureUi`.
|
|
149
153
|
|
|
@@ -151,13 +155,13 @@ You can also subscribe to state changes by calling `CaptureSdk.subscribe()`. Det
|
|
|
151
155
|
|
|
152
156
|
### UI customization
|
|
153
157
|
|
|
154
|
-
The UI can be customized by either overriding the CSS variables found at `packages/capture-
|
|
158
|
+
The UI can be customized by either overriding the CSS variables found at `packages/capture-main/src/ui/root-styles.scss`, or by manually targetting the CSS classes applied to the UI component.
|
|
155
159
|
|
|
156
160
|
All components rendered by the UI are nested under `.mb-style-scope` which provides some base styles.
|
|
157
161
|
|
|
158
162
|
### Detailed capturing process information
|
|
159
163
|
|
|
160
|
-
You can find details on the internal state of the capture process using the [`onFrameAnalysis`](/packages/capture-main/src/createCaptureSdk.ts#57) callback. This callback will provide you with an `ImageData` instance of the previously processed frame and the [`FrameAnalysisResult`](/packages/capture-wasm/src/FrameAnalysisResult.ts).
|
|
164
|
+
You can find details on the internal state of the capture process using the [`onFrameAnalysis`](/packages/capture-main/src/core/createCaptureSdk.ts#57) callback. This callback will provide you with an `ImageData` instance of the previously processed frame and the [`FrameAnalysisResult`](/packages/capture-wasm/src/FrameAnalysisResult.ts).
|
|
161
165
|
|
|
162
166
|
### Low-level access Direct API
|
|
163
167
|
|