@signosoft/signpad-js 0.3.9 β 0.4.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 +24 -43
- package/dist/signosoft-signpad.js +1230 -1223
- package/dist/signosoft-signpad.umd.cjs +35 -38
- package/package.json +1 -1
- package/src/styles/signosoft-signpad.css +7 -7
- package/src/styles/styles-variables.css +17 -17
package/README.md
CHANGED
|
@@ -582,9 +582,9 @@ Add the custom element tag to your HTML and create the necessary control buttons
|
|
|
582
582
|
|
|
583
583
|
The component is primarily configured through a single `config` property. This object controls everything from licensing and hardware behavior to UI visibility and localization.
|
|
584
584
|
|
|
585
|
-
| Property | Type | Default
|
|
586
|
-
| :------- | :-------------- |
|
|
587
|
-
| `config` | `SignpadConfig` | `
|
|
585
|
+
| Property | Type | Default | Description |
|
|
586
|
+
| :------- | :-------------- | :------ | :----------------------------------------------- |
|
|
587
|
+
| `config` | `SignpadConfig` | `{}` | The main configuration object for the component. |
|
|
588
588
|
|
|
589
589
|
### π Core Options
|
|
590
590
|
|
|
@@ -592,32 +592,22 @@ The component is primarily configured through a single `config` property. This o
|
|
|
592
592
|
| :---------- | :------- | :------- | :---------------------------------------------------------------------------- |
|
|
593
593
|
| **`lease`** | `object` | **Yes** | Lease payload returned from the lease API call. Mandatory for initialization. |
|
|
594
594
|
|
|
595
|
-
### π autoconnectOptions
|
|
596
|
-
|
|
597
|
-
Controls how the component handles hardware connections and session flow.
|
|
598
|
-
|
|
599
|
-
| Field | Type | Default | Description |
|
|
600
|
-
| :------------------------------ | :-------- | :------ | :---------------------------------------------------------------------------------------------------- |
|
|
601
|
-
| `autoConnect` | `boolean` | `false` | Attempts to connect to an authorized device on startup. Defaults to mouse mode if no device is found. |
|
|
602
|
-
| `autoConnectOnPlugIn` | `boolean` | `false` | Automatically initiates connection when a compatible and authorized device is plugged into USB. |
|
|
603
|
-
| `autoRestartSigningAfterAction` | `boolean` | `false` | Automatically calls `startSigning()` after a user completes an action (OK/Cancel). |
|
|
604
|
-
|
|
605
595
|
### ποΈ uiVisibilityOptions
|
|
606
596
|
|
|
607
597
|
Toggles the visibility of specific User Interface elements.
|
|
608
598
|
|
|
609
|
-
| Field | Type | Description |
|
|
610
|
-
| :--------------------------- | :-------- | :---------------------------------------------------------------- |
|
|
611
|
-
| `topBarVisible` | `boolean` | Shows/hides the entire top navigation bar. |
|
|
612
|
-
| `topBarClearButtonVisible` | `boolean` | Shows a "Clear" button in the top-left corner. |
|
|
613
|
-
| `topBarConnectButtonVisible` | `boolean` | Shows the connect/disconnect button area in the top-right corner. |
|
|
614
|
-
| `bottomBarVisible` | `boolean` | Shows/hides the entire bottom action bar. |
|
|
615
|
-
| `okButtonVisible` | `boolean` | Shows the **OK** button in the bottom bar. |
|
|
616
|
-
| `clearButtonVisible` | `boolean` | Shows the **Clear** button in the bottom bar. |
|
|
617
|
-
| `cancelButtonVisible` | `boolean` | Shows the **Cancel** button in the bottom bar. |
|
|
618
|
-
| `canvasLineVisible` | `boolean` | Shows the horizontal signature guide line on the canvas. |
|
|
619
|
-
| `deviceStatusTextVisible` | `boolean` | Shows the name of the connected device (e.g., "Wacom STU-540"). |
|
|
620
|
-
| `additionalTextVisible` | `boolean` | Shows helper status messages (e.g., "Ready to sign"). |
|
|
599
|
+
| Field | Type | Default | Description |
|
|
600
|
+
| :--------------------------- | :-------- | :------ | :---------------------------------------------------------------- |
|
|
601
|
+
| `topBarVisible` | `boolean` | `true` | Shows/hides the entire top navigation bar. |
|
|
602
|
+
| `topBarClearButtonVisible` | `boolean` | `false` | Shows a "Clear" button in the top-left corner. |
|
|
603
|
+
| `topBarConnectButtonVisible` | `boolean` | `true` | Shows the connect/disconnect button area in the top-right corner. |
|
|
604
|
+
| `bottomBarVisible` | `boolean` | `true` | Shows/hides the entire bottom action bar. |
|
|
605
|
+
| `okButtonVisible` | `boolean` | `true` | Shows the **OK** button in the bottom bar. |
|
|
606
|
+
| `clearButtonVisible` | `boolean` | `true` | Shows the **Clear** button in the bottom bar. |
|
|
607
|
+
| `cancelButtonVisible` | `boolean` | `true` | Shows the **Cancel** button in the bottom bar. |
|
|
608
|
+
| `canvasLineVisible` | `boolean` | `true` | Shows the horizontal signature guide line on the canvas. |
|
|
609
|
+
| `deviceStatusTextVisible` | `boolean` | `true` | Shows the name of the connected device (e.g., "Wacom STU-540"). |
|
|
610
|
+
| `additionalTextVisible` | `boolean` | `true` | Shows helper status messages (e.g., "Ready to sign"). |
|
|
621
611
|
|
|
622
612
|
### ποΈ canvasAndDrawingOptions
|
|
623
613
|
|
|
@@ -635,17 +625,17 @@ Adjusts the visual appearance of the digital ink.
|
|
|
635
625
|
|
|
636
626
|
Handles component localization. It can load external files or use inline definitions.
|
|
637
627
|
|
|
638
|
-
| Field | Type | Description
|
|
639
|
-
| :------------- | :------- |
|
|
640
|
-
| `lang` | `string` | The active language code. Built-in translations are bundled for `'en'` and `'
|
|
641
|
-
| `langPath` | `string` | URL path to fetch translation files. Expects files in `[path]/[lang].json` format.
|
|
642
|
-
| `translations` | `object` | An inline object containing key-value pairs (e.g., `{ "OK": "Confirm signature" }`). Overrides files.
|
|
628
|
+
| Field | Type | Description |
|
|
629
|
+
| :------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
630
|
+
| `lang` | `string` | The active language code. Built-in translations are bundled for `'en'`, `'cs'`, and `'pt'`; other languages can be supplied via `langPath` or `translations`. |
|
|
631
|
+
| `langPath` | `string` | URL path to fetch translation files. Expects files in `[path]/[lang].json` format. |
|
|
632
|
+
| `translations` | `object` | An inline object containing key-value pairs (e.g., `{ "OK": "Confirm signature" }`). Overrides files. |
|
|
643
633
|
|
|
644
634
|
## π Localization & Translation Keys
|
|
645
635
|
|
|
646
636
|
Localization is driven from `languageOptions`, but you can also provide overrides at runtime:
|
|
647
637
|
|
|
648
|
-
1. **Set the language code** in `config.languageOptions.lang`. English (`en`) is the fallback
|
|
638
|
+
1. **Set the language code** in `config.languageOptions.lang`. English (`en`) is the fallback, Czech (`cs`) and Portuguese (`pt`) are shipped alongside it.
|
|
649
639
|
2. **Load a hosted file** by pointing `languageOptions.langPath` to the directory that contains `[lang].json`. The loader will fetch `${langPath}/${lang}.json` (or the exact file if you include the `.json` suffix).
|
|
650
640
|
3. **Override only specific phrases** by passing a `translations` objectβeither a flat key map or a per-language map (`{ en: {...}, cs: {...} }`). Inline values take precedence over both built-in and fetched files.
|
|
651
641
|
4. **Dynamic placeholders** (for example, `{device}` in `TEXT_SIGNING_WITH_DEVICE`) are replaced using the `LocalizationManager.t` helper. Keep the braces intact if you expect runtime interpolation.
|
|
@@ -723,9 +713,6 @@ Standard event listeners triggered _after_ specific actions. Useful for observin
|
|
|
723
713
|
```typescript
|
|
724
714
|
this.config = {
|
|
725
715
|
lease: leasePayloadFromApi,
|
|
726
|
-
autoconnectOptions: {
|
|
727
|
-
autoConnect: true,
|
|
728
|
-
},
|
|
729
716
|
canvasAndDrawingOptions: {
|
|
730
717
|
color: "#1a1a1a",
|
|
731
718
|
},
|
|
@@ -751,7 +738,7 @@ The following methods are available on the component instance to control the sig
|
|
|
751
738
|
| `connect()` | `Promise<void>` | Connects device to component |
|
|
752
739
|
| `disconnect()` | `Promise<void>` | Disconnects device from component |
|
|
753
740
|
| `startSigning()` | `Promise<void>` | Initializes a new signing session on the canvas and hardware. |
|
|
754
|
-
| `stopSigning()` | `Promise<
|
|
741
|
+
| `stopSigning()` | `Promise<void>` | Low-level session stop that returns the raw driver payload. |
|
|
755
742
|
| `ok()` | `Promise<ISignatureConfirmationData \| undefined>` | Finalizes the session, cleans the device screen, and returns the signature data. |
|
|
756
743
|
| `clear()` | `Promise<void>` | Wipes the signature from the UI and hardware without ending the session. |
|
|
757
744
|
| `cancel()` | `Promise<void>` | Aborts the current session and resets the component state. |
|
|
@@ -783,7 +770,6 @@ Safely terminates the communication channel with the signature tablet.
|
|
|
783
770
|
#### π‘ Best Practices
|
|
784
771
|
|
|
785
772
|
- **Initial Connection:** Always call `connect()` from a click handler so the user can select their device from the browser list.
|
|
786
|
-
- **Auto-Reconnect:** Use `autoconnectOptions.autoConnect: true` in the config to silently reconnect to a previously authorized device on startup without a user gesture.
|
|
787
773
|
- **Cleanup:** It is good practice to call `disconnect()` when the component is being destroyed or the user navigates away from the signing page to free up the USB port.
|
|
788
774
|
|
|
789
775
|
#### π `startSigning(options?: IDrawingOptions)`
|
|
@@ -799,8 +785,6 @@ await signpad.startSigning({
|
|
|
799
785
|
});
|
|
800
786
|
```
|
|
801
787
|
|
|
802
|
-
If you have `autoRestartSigningAfterAction` enabled in your config, the component will automatically call `startSigning()` again after an `ok` or `cancel` action is completed.
|
|
803
|
-
|
|
804
788
|
#### π `ok()`
|
|
805
789
|
|
|
806
790
|
This is the standard way to confirm a signature. It:
|
|
@@ -836,11 +820,8 @@ This is the standard way to confirm a signature. It:
|
|
|
836
820
|
```
|
|
837
821
|
|
|
838
822
|
```js
|
|
839
|
-
// [1]
|
|
840
|
-
|
|
841
|
-
data: image / png;
|
|
842
|
-
(base64, Some - long - string);
|
|
843
|
-
}
|
|
823
|
+
// [1] imageBase64 β plain base64 PNG string
|
|
824
|
+
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
|
|
844
825
|
```
|
|
845
826
|
|
|
846
827
|
```js
|