@signosoft/signpad-js 0.3.3 → 0.3.4

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
@@ -660,7 +660,6 @@ The complete list of keys that can be translated is maintained in `src/i18n/en.j
660
660
  | `CLEAR_SIGNATURE` | Clear signature |
661
661
  | `DISCONNECT` | Disconnect |
662
662
  | `CONNECT_SIGNPAD` | Connect Signpad |
663
- | `NOT_CONNECTED` | Not Connected |
664
663
  | `MOUSE` | Mouse |
665
664
  | `CONNECTED_UNKNOWN_DEVICE` | Connected (Unknown Device) |
666
665
  | `AUTO_CONNECTING` | Auto-connecting to device... |
package/dist/index.d.ts CHANGED
@@ -161,6 +161,12 @@ declare class ConfigManager {
161
161
  private clearConfigEventHandlers;
162
162
  }
163
163
 
164
+ export declare interface ConnectAttempt {
165
+ connected: boolean;
166
+ deviceInfo: any | null;
167
+ isPointerFallback: boolean;
168
+ }
169
+
164
170
  /**
165
171
  * `ConnectionManager` handles the lifecycle of the signature pad connection.
166
172
  * It manages driver initialization, license authentication, device handshaking,
@@ -181,6 +187,7 @@ declare class ConnectionManager {
181
187
  private penDataToDispatch;
182
188
  /** @private Minimum delay between pen events (approx 60fps) */
183
189
  private throttleDelayMs;
190
+ private static readonly POINTER_FALLBACK_DEVICE_NAME;
184
191
  /**
185
192
  * @param component - The host SignosoftSignpad instance.
186
193
  */
@@ -263,10 +270,29 @@ declare class ConnectionManager {
263
270
  * @returns Normalized device info or null.
264
271
  */
265
272
  private normalizeDeviceInfo;
273
+ /**
274
+ * Driver connect step (this is where interactive vs silent HID behavior happens).
275
+ * `autoConnect = false` may open the browser HID picker.
276
+ * `autoConnect = true` tries reconnecting already-authorized devices silently.
277
+ */
278
+ private runDriverConnectAttempt;
279
+ /**
280
+ * Chooses whether the component should finish in physical mode or mouse fallback.
281
+ * This step only decides state; it does not trigger HID dialog itself.
282
+ */
283
+ private resolveConnectionTarget;
284
+ /**
285
+ * Starts a fresh signing session for whichever target mode was selected.
286
+ */
287
+ private prepareSigningSession;
288
+ }
289
+
290
+ export declare interface ConnectionTarget {
291
+ targetState: SignpadState;
292
+ statusMessageKey: string;
266
293
  }
267
294
 
268
295
  export declare enum DeviceStatusText {
269
- NOT_CONNECTED = "NOT_CONNECTED",
270
296
  MOUSE = "MOUSE",
271
297
  CONNECTED_UNKNOWN = "CONNECTED_UNKNOWN_DEVICE"
272
298
  }
@@ -278,8 +304,19 @@ export declare interface IActionHandlers {
278
304
  }
279
305
 
280
306
  export declare interface IAutoconnectOptions {
307
+ /**
308
+ * Enables silent reconnect attempts to already-authorized devices
309
+ * during component startup/config updates.
310
+ */
281
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
+ */
282
316
  autoConnectOnPlugIn?: boolean;
317
+ /**
318
+ * Starts a fresh signing session automatically after OK/Clear/Cancel actions.
319
+ */
283
320
  autoRestartSigningAfterAction?: boolean;
284
321
  }
285
322
 
@@ -315,7 +352,7 @@ export declare interface ILanguageOptions {
315
352
  translations?: ITranslationSet | Record<string, ITranslationSet>;
316
353
  }
317
354
 
318
- declare type IPenData_2 = {
355
+ declare interface IPenData_2 {
319
356
  relativeX: number;
320
357
  relativeY: number;
321
358
  absoluteX?: number;
@@ -326,7 +363,7 @@ declare type IPenData_2 = {
326
363
  timestamp?: number | bigint;
327
364
  inContact: boolean;
328
365
  [key: string]: any;
329
- };
366
+ }
330
367
  export { IPenData_2 as IPenData }
331
368
 
332
369
  export declare interface IPenDataCallback {
@@ -663,14 +700,17 @@ export declare class SignosoftSignpad extends LitElement {
663
700
  /**
664
701
  * Connect button workflow:
665
702
  * - if currently in mouse fallback, disconnect it first
666
- * - then try physical device connect
703
+ * - then silently reconnect already-authorized HID devices that are plugged in
704
+ * - otherwise run the interactive physical-device connect flow
667
705
  * - if physical is not available, allow fallback as a secondary attempt
668
706
  */
669
- private handleConnectClick;
707
+ private connectFromUserAction;
708
+ private prepareForManualConnect;
709
+ private tryAuthorizedManualConnect;
710
+ private tryInteractiveManualConnectFallback;
670
711
  /**
671
712
  * UI disconnect action:
672
- * when physical device is active, switch seamlessly to mouse fallback.
673
- * For other states, perform regular disconnect.
713
+ * switches from physical device to mouse fallback without reconnecting the tablet.
674
714
  */
675
715
  private handleDisconnectClick;
676
716
  /**
@@ -690,22 +730,22 @@ export declare class SignosoftSignpad extends LitElement {
690
730
  * @private
691
731
  * @returns void
692
732
  */
693
- private handleHIDConnect;
733
+ private onHidDeviceConnected;
694
734
  /**
695
735
  * Handler for HID device disconnection.
696
736
  * @private
697
737
  * @returns void
698
738
  */
699
- private handleHIDDisconnect;
700
- private shouldPromoteMouseFallback;
739
+ private onHidDeviceDisconnected;
740
+ private isMouseFallbackActive;
701
741
  private shouldAutoConnectOnPlugIn;
702
- private showSignpadDetectedState;
742
+ private showDeviceDetectedState;
703
743
  /**
704
744
  * Initializes the CanvasManager for rendering signature strokes.
705
745
  * @private
706
746
  * @returns void
707
747
  */
708
- private initializeCanvasManger;
748
+ private initializeCanvasManager;
709
749
  /**
710
750
  * Initializes the MouseManager for mouse and touch fallback.
711
751
  * @private
@@ -738,6 +778,16 @@ export declare class SignosoftSignpad extends LitElement {
738
778
  * Used for smooth mode switching (mouse <-> physical).
739
779
  */
740
780
  private disconnectForSeamlessSwitch;
781
+ /**
782
+ * Forces the component into mouse fallback mode without re-attempting physical reconnection.
783
+ */
784
+ private activateMouseFallbackMode;
785
+ /**
786
+ * Starts fallback signing without running device connect flow.
787
+ * This keeps mouse drawing active after manual disconnect, even if a tablet
788
+ * stays physically plugged in.
789
+ */
790
+ private startMouseFallbackSigningSession;
741
791
  /**
742
792
  * Switches from physical tablet mode to mouse fallback after disconnect.
743
793
  */
@@ -746,11 +796,6 @@ export declare class SignosoftSignpad extends LitElement {
746
796
  * Promotes active mouse fallback session to a physical tablet when one is plugged in.
747
797
  */
748
798
  private promoteMouseFallbackToPhysical;
749
- /**
750
- * Renders the HTML template for the component.
751
- * Uses Lit's html template literal.
752
- * @returns Rendered template.
753
- */
754
799
  render(): TemplateResult<1>;
755
800
  }
756
801