@signosoft/signpad-js 0.3.5 → 0.3.7

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 CHANGED
@@ -680,6 +680,8 @@ The complete list of keys that can be translated is maintained in `src/i18n/en.j
680
680
  | `INVALID_LICENSE_KEY` | Invalid license key. |
681
681
  | `READY_TO_CONNECT` | Ready to connect. |
682
682
  | `SIGNPAD_DETECTED` | Signpad detected. Click 'Connect Signpad' to begin. |
683
+ | `READY_TO_SIGN_MOUSE` | Ready to sign. Use your mouse. |
684
+ | `READY_TO_SIGN_PHYSICAL` | Ready to sign. Use the device pen. |
683
685
 
684
686
  If you add any new keys, mirror them in every language file you provide to guarantee they fall back gracefully to English.
685
687
 
@@ -704,6 +706,7 @@ Standard event listeners triggered _after_ specific actions. Useful for observin
704
706
  | Callback | Payload | Description |
705
707
  | :------------- | :----------------------------------------------- | :------------------------------------------------------------------------------------------------- |
706
708
  | `onPen` | `event: CustomEvent<IPenData>` | Dispatched when a device or mouse fallback are in contact with component or signature pad display. |
709
+ | `onConnecting` | `event: CustomEvent<void>` | Dispatched when a device is in loading state. |
707
710
  | `onConnect` | `event: CustomEvent<{ deviceInfo: any }>` | Dispatched when a device or mouse fallback connects. |
708
711
  | `onDisconnect` | `event: CustomEvent<void>` | Dispatched when the hardware connection is closed. |
709
712
  | `onOk` | `event: CustomEvent<ISignatureConfirmationData>` | Dispatched when signature is confirmed. |
@@ -745,7 +748,7 @@ The following methods are available on the component instance to control the sig
745
748
 
746
749
  | Method | Returns | Description |
747
750
  | :--------------- | :------------------------------------------------- | :------------------------------------------------------------------------------- |
748
- | `connect()` | `Promise<boolean>` | Connects device to component |
751
+ | `connect()` | `Promise<void>` | Connects device to component |
749
752
  | `disconnect()` | `Promise<void>` | Disconnects device from component |
750
753
  | `startSigning()` | `Promise<void>` | Initializes a new signing session on the canvas and hardware. |
751
754
  | `stopSigning()` | `Promise<any>` | Low-level session stop that returns the raw driver payload. |
@@ -755,18 +758,15 @@ The following methods are available on the component instance to control the sig
755
758
 
756
759
  ---
757
760
 
758
- #### 📜 `connect(autoConnect = false, allowFallback = false)`
761
+ #### 📜 `connect()`
759
762
 
760
- This is the primary method to start using the Signpad. Because it uses the **WebHID API**, the first time this is called (without `autoConnect`), it must be triggered by a **user gesture** (like a button click) to satisfy browser security requirements.
763
+ This is the primary method to start using the Signpad. Because it uses the **WebHID API**, this must be triggered by a **user gesture** (like a button click) to satisfy browser security requirements.
761
764
 
762
- **Parameters:**
763
-
764
- - **`autoConnect`** (`boolean`): If set to `true`, the browser will attempt to reconnect to a previously paired and authorized device without opening the device selection dialog from WebHID.
765
- - **`allowFallback`** (`boolean`): If `true` and no physical device is found or connected, the component will automatically transition to **Mouse/Touch mode**, allowing the user to sign using their cursor.
765
+ The method first attempts to silently reconnect to a previously authorized device. If that fails, it opens the browser's device selection dialog and, if no physical device is selected, falls back to mouse/touch mode automatically.
766
766
 
767
767
  **Returns:**
768
768
 
769
- - A `Promise<boolean>` that resolves to `true` if either a physical device or a fallback mode was successfully initialized.
769
+ - A `Promise<void>` that resolves once the connection attempt (or fallback) is complete.
770
770
 
771
771
  #### 📜 `disconnect()`
772
772
 
@@ -782,8 +782,8 @@ Safely terminates the communication channel with the signature tablet.
782
782
 
783
783
  #### 💡 Best Practices
784
784
 
785
- - **Initial Connection:** Always call `connect(false, true)` from a click handler the very first time so the user can select their device from the browser list.
786
- - **Auto-Reconnect:** In many workflows, you can call `connect(true, true)`. If the user has already authorized the device in a previous session, it will connect silently.
785
+ - **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
787
  - **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
788
 
789
789
  #### 📜 `startSigning(options?: IDrawingOptions)`
package/dist/index.d.ts CHANGED
@@ -43,11 +43,6 @@ declare class ButtonManager {
43
43
  * @returns The next ready state (physical or fallback).
44
44
  */
45
45
  private getReadyState;
46
- /**
47
- * Handles post-action flow (state transition or auto-restart).
48
- * @returns Resolves after state transition or auto-restart completes.
49
- */
50
- private finalizePostAction;
51
46
  /**
52
47
  * Fallback handling when startSigning cannot proceed.
53
48
  */
@@ -303,23 +298,6 @@ export declare interface IActionHandlers {
303
298
  handleCancel?: () => any | Promise<any>;
304
299
  }
305
300
 
306
- export declare interface IAutoconnectOptions {
307
- /**
308
- * Enables silent reconnect attempts to already-authorized devices
309
- * during component startup/config updates.
310
- */
311
- autoConnect?: boolean;
312
- /**
313
- * Triggers auto-connect flow when WebHID reports a plug-in event.
314
- * If used without `autoConnect`, connection is attempted only after plug-in.
315
- */
316
- autoConnectOnPlugIn?: boolean;
317
- /**
318
- * Starts a fresh signing session automatically after OK/Clear/Cancel actions.
319
- */
320
- autoRestartSigningAfterAction?: boolean;
321
- }
322
-
323
301
  export declare interface IDrawingOptions {
324
302
  minWidth?: number;
325
303
  maxWidth?: number;
@@ -338,6 +316,7 @@ export declare interface IEventCallbacks {
338
316
  onConnect?: (event: CustomEvent<{
339
317
  deviceInfo: any;
340
318
  }>) => void;
319
+ onConnecting?: (event: CustomEvent<void>) => void;
341
320
  onDisconnect?: (event: CustomEvent<void>) => void;
342
321
  onPen?: (event: CustomEvent<IPenData_2>) => void;
343
322
  onOk?: (event: CustomEvent<ISignatureConfirmationData>) => void;
@@ -737,8 +716,6 @@ export declare class SignosoftSignpad extends LitElement {
737
716
  */
738
717
  private onHidDeviceDisconnected;
739
718
  private isMouseFallbackActive;
740
- private shouldAutoConnectOnPlugIn;
741
- private showDeviceDetectedState;
742
719
  /**
743
720
  * Initializes the CanvasManager for rendering signature strokes.
744
721
  * @private
@@ -761,7 +738,6 @@ export declare class SignosoftSignpad extends LitElement {
761
738
  * Safe to call repeatedly; initialization is performed at most once.
762
739
  */
763
740
  private initializeFromConfigLeaseIfNeeded;
764
- private shouldAutoConnect;
765
741
  private autoConnectIfConfigured;
766
742
  private canAttemptAutoConnect;
767
743
  private ensureSignatureLayerReady;
@@ -811,7 +787,6 @@ export declare type SignosoftSignpadProps = {
811
787
  export declare interface SignpadConfig {
812
788
  lease?: {};
813
789
  languageOptions?: ILanguageOptions;
814
- autoconnectOptions?: IAutoconnectOptions;
815
790
  uiVisibilityOptions?: IUIVisibilityOptions;
816
791
  canvasAndDrawingOptions?: IDrawingOptions;
817
792
  actionHandlers?: IActionHandlers;
@@ -825,7 +800,8 @@ export declare enum SignpadEventType {
825
800
  SIGN_CANCEL = "sign-cancel",
826
801
  SIGN_ERROR = "sign-error",
827
802
  SIGN_CONNECT = "sign-connect",
828
- SIGN_DISCONNECT = "sign-disconnect"
803
+ SIGN_DISCONNECT = "sign-disconnect",
804
+ SIGN_CONNECTING = "sign-connecting"
829
805
  }
830
806
 
831
807
  export declare enum SignpadMessage {
@@ -846,7 +822,9 @@ export declare enum SignpadMessage {
846
822
  SIGNPAD_DISCONNECTED = "SIGNPAD_DISCONNECTED",
847
823
  INVALID_LICENSE_KEY = "INVALID_LICENSE_KEY",
848
824
  READY_TO_CONNECT = "READY_TO_CONNECT",
849
- SIGNPAD_DETECTED = "SIGNPAD_DETECTED"
825
+ SIGNPAD_DETECTED = "SIGNPAD_DETECTED",
826
+ READY_TO_SIGN_MOUSE = "READY_TO_SIGN_MOUSE",
827
+ READY_TO_SIGN_PHYSICAL = "READY_TO_SIGN_PHYSICAL"
850
828
  }
851
829
 
852
830
  export declare enum SignpadState {