@signosoft/signpad-js 0.3.4 → 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/dist/index.d.ts +5 -6
- package/dist/signosoft-signpad.js +12 -14
- package/dist/signosoft-signpad.umd.cjs +15 -15
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -669,9 +669,9 @@ export declare class SignosoftSignpad extends LitElement {
|
|
|
669
669
|
* @param allowFallback - If true, enables mouse/touch signing if no device is found.
|
|
670
670
|
* @returns A promise resolving to true if connection (or fallback) succeeded.
|
|
671
671
|
*/
|
|
672
|
-
|
|
672
|
+
private connectWith;
|
|
673
673
|
/**
|
|
674
|
-
* Closes the active tablet connection and
|
|
674
|
+
* Closes the active tablet connection and switches to mouse fallback mode.
|
|
675
675
|
* @returns A promise that resolves when disconnection is complete.
|
|
676
676
|
*/
|
|
677
677
|
disconnect(): Promise<void>;
|
|
@@ -698,19 +698,18 @@ export declare class SignosoftSignpad extends LitElement {
|
|
|
698
698
|
*/
|
|
699
699
|
private handleWindowResize;
|
|
700
700
|
/**
|
|
701
|
-
*
|
|
701
|
+
* Runs the full connect flow:
|
|
702
702
|
* - if currently in mouse fallback, disconnect it first
|
|
703
703
|
* - then silently reconnect already-authorized HID devices that are plugged in
|
|
704
704
|
* - otherwise run the interactive physical-device connect flow
|
|
705
705
|
* - if physical is not available, allow fallback as a secondary attempt
|
|
706
706
|
*/
|
|
707
|
-
|
|
707
|
+
connect: () => Promise<void>;
|
|
708
708
|
private prepareForManualConnect;
|
|
709
709
|
private tryAuthorizedManualConnect;
|
|
710
710
|
private tryInteractiveManualConnectFallback;
|
|
711
711
|
/**
|
|
712
|
-
* UI disconnect action:
|
|
713
|
-
* switches from physical device to mouse fallback without reconnecting the tablet.
|
|
712
|
+
* UI disconnect action: delegates to the public disconnect method.
|
|
714
713
|
*/
|
|
715
714
|
private handleDisconnectClick;
|
|
716
715
|
/**
|
|
@@ -4441,11 +4441,9 @@ let FA = class extends bg {
|
|
|
4441
4441
|
constructor() {
|
|
4442
4442
|
super(), this.config = {}, O(this, OA, h.INITIAL), O(this, TA, k.COMPONENT_INITIALIZED), O(this, jA, !1), O(this, WA, P.MOUSE), O(this, iA, null), O(this, bA, !1), O(this, X, !1), O(this, u, null), O(this, RA, null), O(this, mA, !1), O(this, _, !1), O(this, NA, 0), O(this, DI, 16), this.canvasManager = null, this.mouseManager = null, this.webHIDAPI = navigator.hid, this.handleWindowResize = () => {
|
|
4443
4443
|
this.canvasManager?.configureCanvasForDPI();
|
|
4444
|
-
}, this.
|
|
4444
|
+
}, this.connect = async () => {
|
|
4445
4445
|
await this.prepareForManualConnect(), !(await this.tryAuthorizedManualConnect() || this.stateManager.isError) && await this.tryInteractiveManualConnectFallback();
|
|
4446
|
-
}, this.handleDisconnectClick =
|
|
4447
|
-
await this.disconnectForSeamlessSwitch(k.REVERTING_TO_DEFAULT), this.activateMouseFallbackMode(), await this.startMouseFallbackSigningSession();
|
|
4448
|
-
}, this.onHidDeviceConnected = () => {
|
|
4446
|
+
}, this.handleDisconnectClick = () => this.disconnect(), this.onHidDeviceConnected = () => {
|
|
4449
4447
|
if (J(this, RA, !0), this.isMouseFallbackActive()) {
|
|
4450
4448
|
this.promoteMouseFallbackToPhysical();
|
|
4451
4449
|
return;
|
|
@@ -4563,7 +4561,7 @@ let FA = class extends bg {
|
|
|
4563
4561
|
* @param allowFallback - If true, enables mouse/touch signing if no device is found.
|
|
4564
4562
|
* @returns A promise resolving to true if connection (or fallback) succeeded.
|
|
4565
4563
|
*/
|
|
4566
|
-
async
|
|
4564
|
+
async connectWith(Q = !1, A = !1) {
|
|
4567
4565
|
try {
|
|
4568
4566
|
if (this.config.lease == null && await this.delay(300), this.config.lease == null)
|
|
4569
4567
|
return this.stateManager.transitionTo(
|
|
@@ -4582,7 +4580,7 @@ let FA = class extends bg {
|
|
|
4582
4580
|
return !0;
|
|
4583
4581
|
await this.disconnectForSeamlessSwitch(
|
|
4584
4582
|
k.CONNECTING_TO_DEVICE
|
|
4585
|
-
);
|
|
4583
|
+
), await this.initializeFromConfigLeaseIfNeeded();
|
|
4586
4584
|
}
|
|
4587
4585
|
return this.currentState !== h.DISCONNECTING && (this.stateManager.isBusy || this.stateManager.isConnected) ? this.stateManager.isPhysicalConnected : await this.connectionManager.connect(Q, A);
|
|
4588
4586
|
} catch (I) {
|
|
@@ -4597,11 +4595,11 @@ let FA = class extends bg {
|
|
|
4597
4595
|
}
|
|
4598
4596
|
}
|
|
4599
4597
|
/**
|
|
4600
|
-
* Closes the active tablet connection and
|
|
4598
|
+
* Closes the active tablet connection and switches to mouse fallback mode.
|
|
4601
4599
|
* @returns A promise that resolves when disconnection is complete.
|
|
4602
4600
|
*/
|
|
4603
4601
|
async disconnect() {
|
|
4604
|
-
this.clearAutoConnectQueue(), this.stateManager.isConnected && (await this.
|
|
4602
|
+
this.clearAutoConnectQueue(), this.stateManager.isConnected && (await this.disconnectForSeamlessSwitch(k.REVERTING_TO_DEFAULT), this.activateMouseFallbackMode(), await this.startMouseFallbackSigningSession());
|
|
4605
4603
|
}
|
|
4606
4604
|
/**
|
|
4607
4605
|
* Resets the UI canvas and internal drawing flags.
|
|
@@ -4631,10 +4629,10 @@ let FA = class extends bg {
|
|
|
4631
4629
|
);
|
|
4632
4630
|
}
|
|
4633
4631
|
async tryAuthorizedManualConnect() {
|
|
4634
|
-
return await this.
|
|
4632
|
+
return await this.connectWith(!0, !1);
|
|
4635
4633
|
}
|
|
4636
4634
|
async tryInteractiveManualConnectFallback() {
|
|
4637
|
-
!await this.
|
|
4635
|
+
!await this.connectWith(!1, !0) && !this.stateManager.isError && await this.connectWith(!0, !0);
|
|
4638
4636
|
}
|
|
4639
4637
|
/**
|
|
4640
4638
|
* Attaches WebHID API event listeners for device connection and disconnection.
|
|
@@ -4759,7 +4757,7 @@ let FA = class extends bg {
|
|
|
4759
4757
|
e(this, u) !== null && (window.clearTimeout(e(this, u)), J(this, u, null));
|
|
4760
4758
|
}
|
|
4761
4759
|
async performAutoConnectSequence() {
|
|
4762
|
-
await this.
|
|
4760
|
+
await this.connectWith(!0, !0);
|
|
4763
4761
|
}
|
|
4764
4762
|
shouldScheduleImmediateRetry() {
|
|
4765
4763
|
return e(this, X) && !this.stateManager.isConnected ? (J(this, X, !1), !0) : !1;
|
|
@@ -4824,7 +4822,7 @@ let FA = class extends bg {
|
|
|
4824
4822
|
const I = Date.now();
|
|
4825
4823
|
this.clearAutoConnectQueue(), await this.disconnectForSeamlessSwitch(Q);
|
|
4826
4824
|
const g = Date.now() - I;
|
|
4827
|
-
g < A && await this.delay(A - g), this.stateManager.isError || await this.
|
|
4825
|
+
g < A && await this.delay(A - g), this.stateManager.isError || await this.connectWith(!0, !0);
|
|
4828
4826
|
} finally {
|
|
4829
4827
|
J(this, _, !1);
|
|
4830
4828
|
}
|
|
@@ -4845,7 +4843,7 @@ let FA = class extends bg {
|
|
|
4845
4843
|
return;
|
|
4846
4844
|
await this.disconnectForSeamlessSwitch(
|
|
4847
4845
|
k.REVERTING_TO_DEFAULT
|
|
4848
|
-
), !await this.
|
|
4846
|
+
), !await this.connectWith(!0, !1) && !this.stateManager.isError && await this.connectWith(!1, !0);
|
|
4849
4847
|
} finally {
|
|
4850
4848
|
J(this, _, !1);
|
|
4851
4849
|
}
|
|
@@ -4867,7 +4865,7 @@ let FA = class extends bg {
|
|
|
4867
4865
|
<button
|
|
4868
4866
|
class="btn btn-link connect-button"
|
|
4869
4867
|
?disabled=${a}
|
|
4870
|
-
@click=${this.
|
|
4868
|
+
@click=${this.connect}
|
|
4871
4869
|
>
|
|
4872
4870
|
${Q.t("CONNECT_SIGNPAD")}
|
|
4873
4871
|
</button>
|