@signosoft/signpad-js 0.3.3 → 0.3.5

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 {
@@ -632,9 +669,9 @@ export declare class SignosoftSignpad extends LitElement {
632
669
  * @param allowFallback - If true, enables mouse/touch signing if no device is found.
633
670
  * @returns A promise resolving to true if connection (or fallback) succeeded.
634
671
  */
635
- connect(autoConnect?: boolean, allowFallback?: boolean): Promise<boolean>;
672
+ private connectWith;
636
673
  /**
637
- * Closes the active tablet connection and cleans up the state.
674
+ * Closes the active tablet connection and switches to mouse fallback mode.
638
675
  * @returns A promise that resolves when disconnection is complete.
639
676
  */
640
677
  disconnect(): Promise<void>;
@@ -661,16 +698,18 @@ export declare class SignosoftSignpad extends LitElement {
661
698
  */
662
699
  private handleWindowResize;
663
700
  /**
664
- * Connect button workflow:
701
+ * Runs the full connect flow:
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
+ connect: () => Promise<void>;
708
+ private prepareForManualConnect;
709
+ private tryAuthorizedManualConnect;
710
+ private tryInteractiveManualConnectFallback;
670
711
  /**
671
- * UI disconnect action:
672
- * when physical device is active, switch seamlessly to mouse fallback.
673
- * For other states, perform regular disconnect.
712
+ * UI disconnect action: delegates to the public disconnect method.
674
713
  */
675
714
  private handleDisconnectClick;
676
715
  /**
@@ -690,22 +729,22 @@ export declare class SignosoftSignpad extends LitElement {
690
729
  * @private
691
730
  * @returns void
692
731
  */
693
- private handleHIDConnect;
732
+ private onHidDeviceConnected;
694
733
  /**
695
734
  * Handler for HID device disconnection.
696
735
  * @private
697
736
  * @returns void
698
737
  */
699
- private handleHIDDisconnect;
700
- private shouldPromoteMouseFallback;
738
+ private onHidDeviceDisconnected;
739
+ private isMouseFallbackActive;
701
740
  private shouldAutoConnectOnPlugIn;
702
- private showSignpadDetectedState;
741
+ private showDeviceDetectedState;
703
742
  /**
704
743
  * Initializes the CanvasManager for rendering signature strokes.
705
744
  * @private
706
745
  * @returns void
707
746
  */
708
- private initializeCanvasManger;
747
+ private initializeCanvasManager;
709
748
  /**
710
749
  * Initializes the MouseManager for mouse and touch fallback.
711
750
  * @private
@@ -738,6 +777,16 @@ export declare class SignosoftSignpad extends LitElement {
738
777
  * Used for smooth mode switching (mouse <-> physical).
739
778
  */
740
779
  private disconnectForSeamlessSwitch;
780
+ /**
781
+ * Forces the component into mouse fallback mode without re-attempting physical reconnection.
782
+ */
783
+ private activateMouseFallbackMode;
784
+ /**
785
+ * Starts fallback signing without running device connect flow.
786
+ * This keeps mouse drawing active after manual disconnect, even if a tablet
787
+ * stays physically plugged in.
788
+ */
789
+ private startMouseFallbackSigningSession;
741
790
  /**
742
791
  * Switches from physical tablet mode to mouse fallback after disconnect.
743
792
  */
@@ -746,11 +795,6 @@ export declare class SignosoftSignpad extends LitElement {
746
795
  * Promotes active mouse fallback session to a physical tablet when one is plugged in.
747
796
  */
748
797
  private promoteMouseFallbackToPhysical;
749
- /**
750
- * Renders the HTML template for the component.
751
- * Uses Lit's html template literal.
752
- * @returns Rendered template.
753
- */
754
798
  render(): TemplateResult<1>;
755
799
  }
756
800