@signosoft/signpad-js 0.6.0 → 0.7.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/dist/index.d.ts CHANGED
@@ -1,280 +1,7 @@
1
- import { ConnectionMode } from '@signosoft/tablet-driver';
2
1
  import { CSSResult } from 'lit';
3
2
  import { LitElement } from 'lit';
4
3
  import { TemplateResult } from 'lit-html';
5
4
 
6
- declare class ButtonManager {
7
- private component;
8
- constructor(component: SignosoftSignpad);
9
- /**
10
- * Clears the current signature on device and UI, then dispatches SIGN_CLEAR.
11
- * @returns Resolves when the clear flow completes.
12
- */
13
- handleClear(): Promise<void>;
14
- /**
15
- * Finalizes the signature, dispatches SIGN_OK, and returns captured data.
16
- * @returns Captured signature payload from the driver.
17
- */
18
- handleOk(): Promise<ISignatureConfirmationData | undefined>;
19
- /**
20
- * Cancels the signature without collecting data, dispatches SIGN_CANCEL.
21
- * @returns Resolves when the cancel flow completes.
22
- */
23
- handleCancel(): Promise<void>;
24
- /**
25
- * Starts a new signing session and transitions to the ready state.
26
- * @param drawingOptions - Optional line thickness and color settings.
27
- * @returns Resolves when the session is ready.
28
- */
29
- startSigning(drawingOptions?: IDrawingOptions): Promise<void>;
30
- /**
31
- * Stops the current signing session and returns captured data.
32
- * @returns Captured signature payload from the driver.
33
- */
34
- stopSigning(): Promise<any>;
35
- /**
36
- * Shared template for OK, Cancel, and Clear actions.
37
- * @param processingState - State used while processing the action.
38
- * @param actionLogic - Action-specific logic to execute.
39
- * @returns Result produced by the action logic.
40
- */
41
- private executeAction;
42
- /**
43
- * Resolves the ready state based on current connection type.
44
- * @returns The next ready state (physical or fallback).
45
- */
46
- private getReadyState;
47
- /**
48
- * Fallback handling when startSigning cannot proceed.
49
- */
50
- private handleStartSigningError;
51
- /**
52
- * Centralized error handling for button actions.
53
- * @param message - Human-readable error description.
54
- * @param error - Original error instance.
55
- */
56
- private handleError;
57
- }
58
-
59
- /**
60
- * `CanvasManager` is a lightweight canvas utility.
61
- * Drawing is handled by SignatureLayer from `@signosoft/tablet-driver`.
62
- */
63
- declare class CanvasManager {
64
- /** @private The target canvas element */
65
- private canvas;
66
- /** @private The 2D rendering context */
67
- private ctx;
68
- /** @private The active configuration for line styles */
69
- private currentDrawingOptions;
70
- /**
71
- * Creates an instance of CanvasManager.
72
- * @param canvas - The HTMLCanvasElement to draw on.
73
- * @param initialDrawingOptions - Configuration for colors and line thickness.
74
- */
75
- constructor(canvas: HTMLCanvasElement, initialDrawingOptions?: IDrawingOptions);
76
- /**
77
- * Returns the currently active drawing configuration.
78
- * @returns A copy of the current drawing options.
79
- */
80
- get drawingOptions(): IDrawingOptions;
81
- /**
82
- * Updates the drawing options and immediately applies them to the context.
83
- * @param options - The new drawing configuration.
84
- */
85
- updateDrawingOptions(options: IDrawingOptions): void;
86
- /**
87
- * Wipes the canvas clean and resets the drawing state.
88
- */
89
- clear(): void;
90
- /**
91
- * Adjusts the canvas internal resolution to match high-DPI (Retina) screens.
92
- * Prevents signatures from appearing blurry.
93
- * @private
94
- */
95
- configureCanvasForDPI(): void;
96
- /**
97
- * Applies line caps, joins, and composite operations to the rendering context.
98
- * @param options - The style options to apply.
99
- * @private
100
- */
101
- private applyDrawingStyles;
102
- }
103
-
104
- /**
105
- * Handles config-driven side effects for the signpad component.
106
- */
107
- declare class ConfigManager {
108
- private component;
109
- private configEventHandlers;
110
- private customEventListenerCache;
111
- /**
112
- * @param component - The host SignosoftSignpad instance.
113
- */
114
- constructor(component: SignosoftSignpad);
115
- /**
116
- * Applies config-driven side effects (localization, drawing, callbacks).
117
- * @param prevConfig - Optional previous config for diffing.
118
- */
119
- apply(prevConfig?: SignpadConfig): void;
120
- /**
121
- * Returns resolved UI visibility options with defaults applied.
122
- * @returns UI visibility options.
123
- */
124
- getUiVisibilityOptions(): IUIVisibilityOptions;
125
- /**
126
- * Returns resolved drawing options with defaults applied.
127
- * @returns Drawing options for the canvas.
128
- */
129
- getDrawingOptions(): IDrawingOptions;
130
- /**
131
- * Applies localization updates when language configuration changes.
132
- * @param prevConfig - Previous configuration.
133
- * @param currentConfig - Current configuration.
134
- */
135
- private applyLocalization;
136
- /**
137
- * Applies drawing option updates when configuration changes.
138
- * @param prevConfig - Previous configuration.
139
- * @param currentConfig - Current configuration.
140
- */
141
- private applyDrawingOptions;
142
- /**
143
- * Syncs config-provided event handlers with component listeners,
144
- * adding, replacing, or removing them as needed.
145
- * @param config - Current signpad configuration.
146
- */
147
- private syncConfigEventHandlers;
148
- /**
149
- * Removes all config-based event handlers from the component.
150
- */
151
- private clearConfigEventHandlers;
152
- }
153
-
154
- /**
155
- * `ConnectionManager` handles the lifecycle of the signature pad connection.
156
- * It manages driver initialization, license authentication, device handshaking,
157
- * and event forwarding from the physical driver to the component.
158
- */
159
- declare class ConnectionManager {
160
- /** @private Reference to the parent component */
161
- private component;
162
- /** @private The low-level driver instance */
163
- private sigLayer;
164
- /** @private Cached device info from the last successful connect */
165
- private cachedDeviceInfo;
166
- /** @private Timestamp of the last pen event dispatch */
167
- private lastPenDispatchTime;
168
- /** @private Buffered pen data for throttling */
169
- private penDataToDispatch;
170
- /** @private Minimum delay between pen events (approx 60fps) */
171
- private throttleDelayMs;
172
- private static readonly POINTER_FALLBACK_DEVICE_NAME;
173
- /**
174
- * @param component - The host SignosoftSignpad instance.
175
- */
176
- constructor(component: SignosoftSignpad);
177
- /**
178
- * Initiates the connection process to a physical device or a mouse fallback.
179
- *
180
- * @param autoConnect - Connect mode: "manual" opens the browser device selection
181
- * dialog; "auto"/"hotplug" attempt already-authorized devices silently.
182
- * @param allowFallback - If true, enables mouse/pointer input if no physical device is found.
183
- * @returns A promise resolving to true if connection (or fallback) was successful.
184
- */
185
- connect(autoConnect?: ConnectionMode, allowFallback?: boolean): Promise<boolean>;
186
- /**
187
- * Terminates the connection with the device and cleans up the driver instance.
188
- * @returns Resolves when disconnection completes.
189
- */
190
- disconnect(): Promise<void>;
191
- /**
192
- * Returns true when a SignatureLayer instance exists.
193
- * @returns True if the driver instance is available.
194
- */
195
- hasSignatureLayer(): boolean;
196
- /**
197
- * Returns the device info from SignatureLayer if available.
198
- * @returns Device info or null if unavailable.
199
- */
200
- getDeviceInfo(): Promise<any | null>;
201
- /**
202
- * Returns true if the SignatureLayer reports an active connection.
203
- * @returns True if a device is connected.
204
- */
205
- isDeviceConnected(): boolean;
206
- /**
207
- * Starts a signing session on the provided canvas.
208
- * @param canvasElement - Optional canvas reference.
209
- * @param drawingOptions - Optional drawing options.
210
- * @returns A promise resolving to true if the session started successfully.
211
- */
212
- startSigning(canvas: HTMLCanvasElement, drawingOptions?: IDrawingOptions): Promise<boolean>;
213
- /**
214
- * Stops the current signing session if active.
215
- * @returns Signature data if available.
216
- */
217
- stopSigning(): Promise<any>;
218
- /**
219
- * Clears the signature on the device if a signing session is active.
220
- * Silently does nothing if no session is active.
221
- * @returns Resolves when the clear completes.
222
- */
223
- clearSignature(): Promise<void>;
224
- /**
225
- * Instantiates the SignatureLayer if it doesn't exist and attaches listeners.
226
- * @returns Resolves when the driver is ready.
227
- */
228
- private ensureSignatureLayer;
229
- /**
230
- * Configures driver event listeners (OK, Clear, Cancel, Pen events).
231
- * @returns void
232
- */
233
- private setupCallbacks;
234
- /**
235
- * Throttles pen data dispatches to optimize event bus performance.
236
- * @param data - The IPenData received from the driver.
237
- */
238
- private runThrottledPenDispatch;
239
- /**
240
- * Fetches a lease from the license server and initializes the driver.
241
- * @returns Resolves when the driver is initialized.
242
- */
243
- initWithLease(lease: any): Promise<void>;
244
- /**
245
- * Called by the driver when the lease has run out of signing credits.
246
- * @param detail - Driver-provided description of the denial.
247
- * @returns Always false — declines the driver's own retry; signpad-js's
248
- * auto-restart (triggered by the ERROR transition below) handles recovery.
249
- */
250
- private handleBillingDenied;
251
- /**
252
- * Called by the driver when the billing check itself fails (e.g. the
253
- * billing server is unreachable). Treated as a network error.
254
- * @param detail - Driver-provided description of the failure.
255
- * @returns Always false — see handleBillingDenied.
256
- */
257
- private handleBillingError;
258
- isFallback(deviceInfo: any | null, isDeviceConnected: boolean, includeDisconnected: boolean): boolean;
259
- /**
260
- * Normalizes device info to always include deviceName.
261
- * @param deviceInfo - Raw device info.
262
- * @returns Normalized device info or null.
263
- */
264
- private normalizeDeviceInfo;
265
- /**
266
- * Driver connect step (this is where interactive vs silent HID behavior happens).
267
- * `autoConnect = false` may open the browser HID picker.
268
- * `autoConnect = true` tries reconnecting already-authorized devices silently.
269
- */
270
- private runDriverConnectAttempt;
271
- /**
272
- * Chooses whether the component should finish in physical mode or mouse fallback.
273
- * This step only decides state; it does not trigger HID dialog itself.
274
- */
275
- private resolveConnectionTarget;
276
- }
277
-
278
5
  export declare enum DeviceStatusText {
279
6
  MOUSE = "MOUSE",
280
7
  CONNECTED_UNKNOWN = "CONNECTED_UNKNOWN_DEVICE"
@@ -375,7 +102,7 @@ export declare interface ISignatureTabletMeta {
375
102
  }
376
103
 
377
104
  export declare interface ISignpadErrorDetail {
378
- category: SignpadErrorCategory;
105
+ code: SignpadErrorCode;
379
106
  message: string;
380
107
  error: Error;
381
108
  }
@@ -395,80 +122,11 @@ export declare interface IUIVisibilityOptions {
395
122
  canvasLineVisible?: boolean;
396
123
  deviceStatusTextVisible?: boolean;
397
124
  additionalTextVisible?: boolean;
125
+ startNewSignatureButtonVisible?: boolean;
398
126
  }
399
127
 
400
128
  export declare type LanguageCode = "en" | "cs" | "pt" | (string & {});
401
129
 
402
- /**
403
- * Manages localization for the signpad component.
404
- *
405
- * This manager supports:
406
- * 1. Built-in translations (English as default fallback).
407
- * 2. External translation overrides via remote JSON files.
408
- * 3. Dynamic parameter interpolation in strings.
409
- */
410
- declare class LocalizationManager {
411
- /** @private Reference to the parent component to trigger updates */
412
- private component;
413
- /** @private The currently active translation dictionary */
414
- private translations;
415
- /** @private The ISO code of the currently loaded language */
416
- private currentLang;
417
- /** @private The last used path for external translations */
418
- private currentPath;
419
- /**
420
- * @param component - The LitElement instance that uses this manager.
421
- */
422
- constructor(component: LitElement);
423
- /**
424
- * Translates a key based on the loaded dictionary.
425
- * Supports parameter interpolation using the `{key}` syntax.
426
- *
427
- * @param key - The translation key (e.g., "CONNECT_DEVICE").
428
- * @param params - Key-value pairs to replace placeholders in the string.
429
- * @returns The translated string, or the raw key if no translation exists.
430
- */
431
- t(key: string, params?: Record<string, string>): string;
432
- /**
433
- * Loads and merges translations for the specified language.
434
- *
435
- * Strategy:
436
- * 1. Check for redundancy: If lang and path haven't changed, skip.
437
- * 2. Baseline: Start with built-in translations (merged with English as fallback).
438
- * 3. Fetch: If a path is provided, attempt to fetch an external JSON file.
439
- * 4. Merge: External translations override built-in ones.
440
- *
441
- * @param langCode - ISO language code (e.g., 'en', 'cs', 'de').
442
- * @param basePath - Optional path/URL to fetch external translation files.
443
- * @param inlineTranslations - Optional inline translations to apply.
444
- * @returns Resolves when translations are loaded and applied.
445
- */
446
- loadLanguage(langCode: string, basePath?: string, inlineTranslations?: ITranslationSet | Record<string, ITranslationSet>): Promise<void>;
447
- /**
448
- * Determines the initial translation set.
449
- * If the language is built-in, it merges it with English to ensure no missing keys.
450
- *
451
- * @param langCode - The target language code.
452
- * @returns Baseline translations for the language.
453
- */
454
- private getBaselineTranslations;
455
- /**
456
- * Resolves inline translations for the requested language, if provided.
457
- * @param langCode - The target language code.
458
- * @param inline - Inline translation map or set.
459
- * @returns Inline translations for the language if found.
460
- */
461
- private resolveInlineTranslations;
462
- /**
463
- * Constructs the full URL for the translation JSON file.
464
- *
465
- * @param langCode - The language code.
466
- * @param basePath - The directory path.
467
- * @returns Resolved translation file URL.
468
- */
469
- private constructUrl;
470
- }
471
-
472
130
  /**
473
131
  * SignosoftSignpad Web Component.
474
132
  * A professional signature capture component supporting physical tablets and mouse fallback.
@@ -485,25 +143,16 @@ export declare class SignosoftSignpad extends LitElement {
485
143
  * @private
486
144
  */
487
145
  canvasRef: HTMLCanvasElement;
488
- /** Current state of the signpad machine. */
489
- get currentState(): SignpadState;
146
+ /** Current state of the signpad machine. Starts as CONNECTING: waiting for the lease before the first connect. */
147
+ currentState: SignpadState;
490
148
  /** Current status message key for localization. */
491
- get statusMessage(): string;
149
+ statusMessage: string;
150
+ /** Code of the current ERROR, or null outside ERROR. */
151
+ errorCode: SignpadErrorCode | null;
492
152
  /** Boolean flag indicating if the user has started drawing. */
493
- get hasStartedDrawing(): boolean;
153
+ hasStartedDrawing: boolean;
494
154
  /** Text representation of the current device status. */
495
- get deviceStatusText(): string;
496
- setCurrentState(value: SignpadState): void;
497
- setStatusMessage(value: string): void;
498
- setHasStartedDrawing(value: boolean): void;
499
- setDeviceStatusText(value: string): void;
500
- canvasManager: CanvasManager | null;
501
- connectionManager: ConnectionManager;
502
- stateManager: StateManager;
503
- buttonManager: ButtonManager;
504
- localizationManager: LocalizationManager;
505
- configManager: ConfigManager;
506
- webHIDAPI: any;
155
+ deviceStatusText: string;
507
156
  clear: () => Promise<void>;
508
157
  ok: () => Promise<ISignatureConfirmationData | undefined>;
509
158
  cancel: () => Promise<void>;
@@ -528,18 +177,16 @@ export declare class SignosoftSignpad extends LitElement {
528
177
  * @protected
529
178
  */
530
179
  protected updated(changedProperties: Map<PropertyKey, unknown>): void;
180
+ /**
181
+ * Moves focus to the restart button when an error appears, but only if
182
+ * focus is already inside the component so host-page focus isn't stolen.
183
+ */
184
+ private focusRestartButtonOnError;
531
185
  /**
532
186
  * Component constructor.
533
187
  * Initializes all sub-managers.
534
188
  */
535
189
  constructor();
536
- /**
537
- * Dispatches a custom event from the component.
538
- * @param name - The name of the event.
539
- * @param detail - Optional data payload for the event.
540
- * @returns void
541
- */
542
- dispatch(name: string, detail?: any): void;
543
190
  /**
544
191
  * Attempts to establish a connection with a signature tablet.
545
192
  * @param autoConnect - Connect mode: "manual" opens the browser HID picker;
@@ -548,27 +195,36 @@ export declare class SignosoftSignpad extends LitElement {
548
195
  * @returns A promise resolving to true if connection (or fallback) succeeded.
549
196
  */
550
197
  private connectWith;
198
+ /** True until the first connect attempt starts (waiting for the lease). */
199
+ private get isInitializing();
200
+ /** Moves to ERROR with `error`'s own code, or `fallback` if it has none. */
201
+ private reportError;
202
+ /**
203
+ * Resolves once `config.lease` is available. Waits up to LEASE_WAIT_ATTEMPTS
204
+ * times LEASE_WAIT_TIMEOUT_MS; after that the wait is spent and LICENSE_MISSING
205
+ * is reported immediately until a lease arrives (config change re-runs auto-connect).
206
+ * @returns True when a lease is present.
207
+ */
208
+ private requireLease;
209
+ private waitForLease;
551
210
  /**
552
211
  * Closes the active tablet connection and switches to mouse fallback mode.
553
212
  * @returns A promise that resolves when disconnection is complete.
554
213
  */
555
214
  disconnect(): Promise<void>;
556
- /**
557
- * Resets the UI canvas and internal drawing flags.
558
- * @returns void
559
- */
560
- resetDrawingState(): void;
561
- /**
562
- * Enables or disables browser pointer interaction on the drawing canvas.
563
- * Physical tablet mode disables browser pointer input to prevent mouse drawing.
564
- */
565
- setCanvasPointerInputEnabled(enabled: boolean): void;
566
215
  /**
567
216
  * Lit lifecycle: Invoked when the component is removed from the document's DOM.
568
217
  * Performs necessary cleanup of listeners and connections.
569
218
  * @returns void
570
219
  */
220
+ connectedCallback(): void;
571
221
  disconnectedCallback(): void;
222
+ /**
223
+ * Ends the driver session after the element was removed from the DOM. Unlike `disconnect()`
224
+ * it does not start a mouse fallback session (that would re-initialize the driver on a
225
+ * detached element).
226
+ */
227
+ private releaseDriver;
572
228
  /**
573
229
  * Keeps canvas internal size in sync with responsive layout changes.
574
230
  * @private
@@ -585,7 +241,7 @@ export declare class SignosoftSignpad extends LitElement {
585
241
  connect: () => Promise<void>;
586
242
  /**
587
243
  * If currently in mouse fallback, tears that session down seamlessly
588
- * (no DISCONNECTED UI flash) so a physical-device connect attempt can
244
+ * (no intermediate UI flash) so a physical-device connect attempt can
589
245
  * proceed cleanly.
590
246
  */
591
247
  private prepareForManualConnect;
@@ -643,6 +299,7 @@ export declare class SignosoftSignpad extends LitElement {
643
299
  */
644
300
  private initializeFromConfigLeaseIfNeeded;
645
301
  private autoConnectIfConfigured;
302
+ private runAutoConnect;
646
303
  private ensureSignatureLayerReady;
647
304
  private deferAutoConnectForState;
648
305
  private clearPendingAutoConnectTimeout;
@@ -651,21 +308,21 @@ export declare class SignosoftSignpad extends LitElement {
651
308
  private scheduleAutoConnectRetry;
652
309
  private clearAutoConnectQueue;
653
310
  /**
654
- * Schedules signing to restart automatically after a BILLING_DENIED/OTHER
655
- * error, so the flow recovers without requiring a manual reconnect.
656
- * NETWORK errors never reach this — they stay shown until the user retries.
657
- * @param delayMs - How long to keep the error visible before restarting.
658
- */
659
- private scheduleErrorAutoRestart;
660
- /**
661
- * Restarts the signing session after an auto-recoverable error, respecting
311
+ * Restarts the signing session after an error (restart button), respecting
662
312
  * the connect/disconnect reentrancy lock so it never races a concurrent
663
313
  * manual connect/disconnect or hotplug transition.
664
314
  */
665
315
  private restartSigningAfterError;
316
+ /**
317
+ * Runs `action` as the only connect/disconnect transition. Other transitions wait for it
318
+ * instead of interleaving (or being dropped), so state changes stay serialized.
319
+ */
320
+ private withTransitionLock;
321
+ /** Restart button in the error overlay. */
322
+ private handleRestartSessionClick;
666
323
  private delay;
667
324
  /**
668
- * Disconnects current session without transitioning through DISCONNECTED UI.
325
+ * Disconnects current session without an intermediate UI state.
669
326
  * Used for smooth mode switching (mouse <-> physical).
670
327
  */
671
328
  private disconnectForSeamlessSwitch;
@@ -679,10 +336,6 @@ export declare class SignosoftSignpad extends LitElement {
679
336
  * stays physically plugged in.
680
337
  */
681
338
  private startMouseFallbackSigningSession;
682
- /**
683
- * Switches from physical tablet mode to mouse fallback after disconnect.
684
- */
685
- recoverToMouseFallback(messageKey?: string, minLoadingMs?: number): Promise<void>;
686
339
  /**
687
340
  * Promotes active mouse fallback session to a physical tablet when one is plugged in.
688
341
  */
@@ -702,6 +355,8 @@ export declare type SignosoftSignpadProps = {
702
355
 
703
356
  export declare interface SignpadConfig {
704
357
  lease?: {};
358
+ /** `"light"` (default), `"dark"`, or `"auto"` to follow the OS `prefers-color-scheme`. */
359
+ theme?: SignpadTheme;
705
360
  languageOptions?: ILanguageOptions;
706
361
  uiVisibilityOptions?: IUIVisibilityOptions;
707
362
  canvasAndDrawingOptions?: IDrawingOptions;
@@ -709,10 +364,20 @@ export declare interface SignpadConfig {
709
364
  eventCallbacks?: IEventCallbacks;
710
365
  }
711
366
 
712
- export declare enum SignpadErrorCategory {
713
- BILLING_DENIED = "billing_denied",
714
- NETWORK = "network",
715
- OTHER = "other"
367
+ /**
368
+ * Error identifiers delivered in `onError` (`detail.code`), formatted `AREA-NN`:
369
+ * LIC license, DRV driver, CON connection, NET network, BIL billing,
370
+ * SES signing session, ACT signing actions (OK/Clear/Cancel).
371
+ */
372
+ export declare enum SignpadErrorCode {
373
+ LICENSE_MISSING = "LIC-01",
374
+ LICENSE_INVALID = "LIC-02",
375
+ DRIVER_INIT_FAILED = "DRV-01",
376
+ CONNECT_FAILED = "CON-01",
377
+ NETWORK_ERROR = "NET-01",
378
+ BILLING_DENIED = "BIL-01",
379
+ START_SIGNING_FAILED = "SES-01",
380
+ ACTION_FAILED = "ACT-01"
716
381
  }
717
382
 
718
383
  export declare enum SignpadEventType {
@@ -731,32 +396,34 @@ export declare enum SignpadMessage {
731
396
  CONNECTING_TO_DEVICE = "CONNECTING_TO_DEVICE",
732
397
  REVERTING_TO_DEFAULT = "REVERTING_TO_DEFAULT",
733
398
  DISCONNECTING_DEVICE = "DISCONNECTING_DEVICE",
734
- COMPONENT_INITIALIZED = "COMPONENT_INITIALIZED",
399
+ PREPARING_SESSION = "PREPARING_SESSION",
400
+ RESTART_SESSION = "RESTART_SESSION",
401
+ PROCESSING_OK = "PROCESSING_OK",
402
+ PROCESSING_CLEAR = "PROCESSING_CLEAR",
403
+ PROCESSING_CANCEL = "PROCESSING_CANCEL",
404
+ INITIALIZING = "INITIALIZING",
735
405
  TEXT_START_SIGNING = "TEXT_START_SIGNING",
736
406
  TEXT_SIGN_WITH_PHYSICAL = "TEXT_SIGN_WITH_PHYSICAL",
737
407
  TEXT_SIGN_WITH_MOUSE = "TEXT_SIGN_WITH_MOUSE",
738
408
  TEXT_SIGN_GENERIC = "TEXT_SIGN_GENERIC",
739
409
  TEXT_SIGNING_WITH_DEVICE = "TEXT_SIGNING_WITH_DEVICE",
740
- NO_DEVICE_FOUND = "NO_DEVICE_FOUND",
410
+ TEXT_PRESS_START_SIGNING = "TEXT_PRESS_START_SIGNING",
411
+ LICENSE_MISSING = "LICENSE_MISSING",
412
+ INVALID_LICENSE_KEY = "INVALID_LICENSE_KEY",
413
+ ERROR_DRIVER_INIT = "ERROR_DRIVER_INIT",
741
414
  CONNECTION_ERROR = "CONNECTION_ERROR",
742
- ERROR_DISCONNECTION = "ERROR_DISCONNECTION",
743
- ERROR_INSTANTIATING_DRIVER = "ERROR_INSTANTIATING_DRIVER",
415
+ NETWORK_ERROR = "NETWORK_ERROR",
744
416
  INSUFFICIENT_TOKENS = "INSUFFICIENT_TOKENS",
745
- INVALID_LICENSE_KEY = "INVALID_LICENSE_KEY",
746
- READY_TO_CONNECT = "READY_TO_CONNECT",
747
- SIGNPAD_DETECTED = "SIGNPAD_DETECTED",
417
+ ERROR_STARTING_SIGNING = "ERROR_STARTING_SIGNING",
418
+ ERROR_PROCESSING_ACTION = "ERROR_PROCESSING_ACTION",
748
419
  READY_TO_SIGN_MOUSE = "READY_TO_SIGN_MOUSE",
749
420
  READY_TO_SIGN_PHYSICAL = "READY_TO_SIGN_PHYSICAL"
750
421
  }
751
422
 
752
423
  export declare enum SignpadState {
753
- INITIAL = "initial",
754
- DISCONNECTED = "disconnected",
755
424
  CONNECTING = "connecting",
756
- WAITING_FOR_DEVICE_SELECTION = "waiting_for_device_selection",
757
425
  CONNECTED_PHYSICAL = "connected_physical",
758
426
  CONNECTED_MOUSE_FALLBACK = "connected_mouse_fallback",
759
- SIGNING_ACTIVE = "signing_active",
760
427
  PROCESSING_OK = "processing_ok",
761
428
  PROCESSING_CLEAR = "processing_clear",
762
429
  PROCESSING_CANCEL = "processing_cancel",
@@ -764,105 +431,7 @@ export declare enum SignpadState {
764
431
  ERROR = "error"
765
432
  }
766
433
 
767
- /**
768
- * Manages the finite state machine and UI logic for the Signpad component.
769
- * It handles state transitions, side effects (like adding/removing listeners),
770
- * and provides computed properties for the UI (button states, visibility, etc.).
771
- */
772
- declare class StateManager {
773
- /**
774
- * Reference to the parent component.
775
- * @private
776
- */
777
- private component;
778
- /**
779
- * @param component - The host SignosoftSignpad instance.
780
- */
781
- constructor(component: SignosoftSignpad);
782
- /**
783
- * Returns the localization key or device name for the current status.
784
- * @returns Localization key or device name.
785
- */
786
- get deviceStatusKey(): string;
787
- /**
788
- * Returns the current status message key.
789
- * @returns Status message key.
790
- */
791
- get statusMessageKey(): string;
792
- /**
793
- * Computes the localization key for instructions based on current state.
794
- * Returns null if custom additionalText is provided by the user.
795
- * @returns Localization key for additional text.
796
- */
797
- get additionalTextKey(): string;
798
- /**
799
- * Returns true if the component is in any connected state (Physical or Fallback).
800
- * @returns True when connected or signing.
801
- */
802
- get isConnected(): boolean;
803
- /**
804
- * Returns true only for a physical device connection lifecycle.
805
- * Mouse fallback is intentionally excluded.
806
- * @returns True when a physical device is connected/signing/processing.
807
- */
808
- get isPhysicalConnected(): boolean;
809
- /**
810
- * Returns true if the component is performing an asynchronous operation.
811
- * @returns True when busy.
812
- */
813
- get isBusy(): boolean;
814
- /**
815
- * Returns true if the component is in an ERROR state.
816
- * @returns True when in error state.
817
- */
818
- get isError(): boolean;
819
- /**
820
- * Logic for disabling primary action buttons (OK, Clear, Cancel).
821
- * Buttons are disabled if not connected, if no drawing has occurred, or if busy.
822
- * @returns True if action buttons should be disabled.
823
- */
824
- get actionButtonsDisabled(): boolean;
825
- /**
826
- * Logic for disabling the Connect button.
827
- * @returns True if the connect button should be disabled.
828
- */
829
- get connectButtonDisabled(): boolean;
830
- /**
831
- * Logic for disabling the Disconnect button.
832
- * @returns True if the disconnect button should be disabled.
833
- */
834
- get disconnectButtonDisabled(): boolean;
835
- /**
836
- * Transitions the component to a new state and triggers side effects.
837
- *
838
- * @param newState - The target SignpadState.
839
- * @param messageKey - An optional localization key for status messages.
840
- * @param error - Optional error object if transitioning to an ERROR state.
841
- * @returns void
842
- */
843
- transitionTo(newState: SignpadState, messageKey?: string, error?: Error, category?: SignpadErrorCategory): void;
844
- /**
845
- * Heuristically classifies an error for auto-recovery decisions.
846
- * Explicit categories (e.g. from billing hooks) should be passed to
847
- * transitionTo directly rather than relying on this fallback.
848
- * @param error - The error to classify.
849
- * @returns The inferred error category.
850
- */
851
- private classifyError;
852
- /**
853
- * Updates the internal drawing flag. Triggers a UI update if the value changes.
854
- * @param started - Boolean indicating if the user has started drawing.
855
- */
856
- setDrawingStarted(started: boolean): void;
857
- /**
858
- * Handles side effects triggered by state transitions, such as
859
- * initializing mouse listeners or clearing the canvas.
860
- * @param newState - The state being transitioned to.
861
- * @param oldState - The previous state.
862
- * @private
863
- */
864
- private handleSideEffects;
865
- }
434
+ export declare type SignpadTheme = "light" | "dark" | "auto";
866
435
 
867
436
  export { }
868
437