altcha 3.0.4 → 3.0.6
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 +68 -0
- package/dist/external/altcha.js +52 -22
- package/dist/external/altcha.min.js +1 -1
- package/dist/external/altcha.umd.cjs +52 -22
- package/dist/external/altcha.umd.min.cjs +1 -1
- package/dist/main/altcha.i18n.js +52 -22
- package/dist/main/altcha.i18n.min.js +1 -1
- package/dist/main/altcha.i18n.umd.cjs +52 -22
- package/dist/main/altcha.i18n.umd.min.cjs +1 -1
- package/dist/main/altcha.js +52 -22
- package/dist/main/altcha.min.js +1 -1
- package/dist/main/altcha.umd.cjs +52 -22
- package/dist/main/altcha.umd.min.cjs +1 -1
- package/package.json +1 -1
|
@@ -5368,7 +5368,7 @@
|
|
|
5368
5368
|
button.disabled = get(audioState) === AudioState.LOADING || get(audioState) === AudioState.ERROR;
|
|
5369
5369
|
set_attribute(button, "aria-label", get(audioState) === AudioState.LOADING ? strings().loading : strings().getAudioChallenge);
|
|
5370
5370
|
});
|
|
5371
|
-
|
|
5371
|
+
event("click", button, () => onPlayAudio(), true);
|
|
5372
5372
|
append($$anchor2, button);
|
|
5373
5373
|
};
|
|
5374
5374
|
if_block(node_1, ($$render) => {
|
|
@@ -5423,12 +5423,12 @@
|
|
|
5423
5423
|
event("submit", form, onSubmitCapture, true);
|
|
5424
5424
|
delegated("keydown", input, onInputKeyDown);
|
|
5425
5425
|
bind_value(input, () => get(code), ($$value) => set(code, $$value));
|
|
5426
|
-
|
|
5427
|
-
|
|
5426
|
+
event("click", button_1, () => onReload()?.(), true);
|
|
5427
|
+
event("click", button_3, () => onCancel()?.(), true);
|
|
5428
5428
|
append($$anchor, div);
|
|
5429
5429
|
return pop($$exports);
|
|
5430
5430
|
}
|
|
5431
|
-
delegate(["keydown"
|
|
5431
|
+
delegate(["keydown"]);
|
|
5432
5432
|
create_custom_element(
|
|
5433
5433
|
Code,
|
|
5434
5434
|
{
|
|
@@ -5451,7 +5451,7 @@
|
|
|
5451
5451
|
var root$1 = /* @__PURE__ */ from_html(`<!> <div><!> <!> <div class="altcha-popover-content"><!></div></div>`, 1);
|
|
5452
5452
|
function Popover($$anchor, $$props) {
|
|
5453
5453
|
push($$props, true);
|
|
5454
|
-
let anchor = prop($$props, "anchor"), children = prop($$props, "children"), display = prop($$props, "display", 7, "standard"), backdrop = prop($$props, "backdrop", 7, false), onClickOutside = prop($$props, "onClickOutside"), onClickOutsideDelay = prop($$props, "onClickOutsideDelay", 7, 600), onClose = prop($$props, "onClose"), placement = prop($$props, "placement", 7, "auto"), variant = prop($$props, "variant", 7, "neutral"), rest = /* @__PURE__ */ rest_props($$props, [
|
|
5454
|
+
let anchor = prop($$props, "anchor"), children = prop($$props, "children"), display = prop($$props, "display", 7, "standard"), backdrop = prop($$props, "backdrop", 7, false), onClickOutside = prop($$props, "onClickOutside"), onClickOutsideDelay = prop($$props, "onClickOutsideDelay", 7, 600), onClose = prop($$props, "onClose"), placement = prop($$props, "placement", 7, "auto"), updateUISignal = prop($$props, "updateUISignal"), variant = prop($$props, "variant", 7, "neutral"), rest = /* @__PURE__ */ rest_props($$props, [
|
|
5455
5455
|
"$$slots",
|
|
5456
5456
|
"$$events",
|
|
5457
5457
|
"$$legacy",
|
|
@@ -5464,6 +5464,7 @@
|
|
|
5464
5464
|
"onClickOutsideDelay",
|
|
5465
5465
|
"onClose",
|
|
5466
5466
|
"placement",
|
|
5467
|
+
"updateUISignal",
|
|
5467
5468
|
"variant"
|
|
5468
5469
|
]);
|
|
5469
5470
|
let el = /* @__PURE__ */ state(void 0);
|
|
@@ -5475,6 +5476,11 @@
|
|
|
5475
5476
|
set(top, placement() === "top");
|
|
5476
5477
|
}
|
|
5477
5478
|
});
|
|
5479
|
+
user_effect(() => {
|
|
5480
|
+
if (updateUISignal()) {
|
|
5481
|
+
reposition();
|
|
5482
|
+
}
|
|
5483
|
+
});
|
|
5478
5484
|
onMount(() => {
|
|
5479
5485
|
const moveToBody = display() === "bottomsheet" || display() === "overlay";
|
|
5480
5486
|
if (moveToBody) {
|
|
@@ -5497,7 +5503,7 @@
|
|
|
5497
5503
|
}
|
|
5498
5504
|
function onWindowClick(ev) {
|
|
5499
5505
|
const target = ev.target;
|
|
5500
|
-
if (!get(el)?.contains(target) &&
|
|
5506
|
+
if (!get(el)?.contains(target) && (!onClickOutsideDelay() || get(mountedAt) + onClickOutsideDelay() < Date.now())) {
|
|
5501
5507
|
onClickOutside()?.();
|
|
5502
5508
|
}
|
|
5503
5509
|
}
|
|
@@ -5574,6 +5580,13 @@
|
|
|
5574
5580
|
placement($$value);
|
|
5575
5581
|
flushSync();
|
|
5576
5582
|
},
|
|
5583
|
+
get updateUISignal() {
|
|
5584
|
+
return updateUISignal();
|
|
5585
|
+
},
|
|
5586
|
+
set updateUISignal($$value) {
|
|
5587
|
+
updateUISignal($$value);
|
|
5588
|
+
flushSync();
|
|
5589
|
+
},
|
|
5577
5590
|
get variant() {
|
|
5578
5591
|
return variant();
|
|
5579
5592
|
},
|
|
@@ -5583,7 +5596,7 @@
|
|
|
5583
5596
|
}
|
|
5584
5597
|
};
|
|
5585
5598
|
var fragment = root$1();
|
|
5586
|
-
event("click", $window, onWindowClick);
|
|
5599
|
+
event("click", $window, onWindowClick, true);
|
|
5587
5600
|
event("resize", $window, onWindowResize);
|
|
5588
5601
|
event("scroll", $window, onWindowScroll);
|
|
5589
5602
|
var node = first_child(fragment);
|
|
@@ -5620,7 +5633,7 @@
|
|
|
5620
5633
|
{
|
|
5621
5634
|
var consequent_2 = ($$anchor2) => {
|
|
5622
5635
|
var div_3 = root_3$1();
|
|
5623
|
-
|
|
5636
|
+
event("click", div_3, onCloseClick, true);
|
|
5624
5637
|
append($$anchor2, div_3);
|
|
5625
5638
|
};
|
|
5626
5639
|
if_block(node_2, ($$render) => {
|
|
@@ -5636,7 +5649,6 @@
|
|
|
5636
5649
|
append($$anchor, fragment);
|
|
5637
5650
|
return pop($$exports);
|
|
5638
5651
|
}
|
|
5639
|
-
delegate(["click"]);
|
|
5640
5652
|
create_custom_element(
|
|
5641
5653
|
Popover,
|
|
5642
5654
|
{
|
|
@@ -5648,6 +5660,7 @@
|
|
|
5648
5660
|
onClickOutsideDelay: {},
|
|
5649
5661
|
onClose: {},
|
|
5650
5662
|
placement: {},
|
|
5663
|
+
updateUISignal: {},
|
|
5651
5664
|
variant: {}
|
|
5652
5665
|
},
|
|
5653
5666
|
[],
|
|
@@ -5914,6 +5927,7 @@
|
|
|
5914
5927
|
let checked = /* @__PURE__ */ state(false);
|
|
5915
5928
|
let codeChallenge = /* @__PURE__ */ state(null);
|
|
5916
5929
|
let currentController = /* @__PURE__ */ state(null);
|
|
5930
|
+
let currentDisplay = /* @__PURE__ */ state(null);
|
|
5917
5931
|
let currentState = /* @__PURE__ */ state(proxy(State.UNVERIFIED));
|
|
5918
5932
|
let elAnchorArrow = /* @__PURE__ */ state(void 0);
|
|
5919
5933
|
let elFloatingAnchor = /* @__PURE__ */ state(void 0);
|
|
@@ -5924,6 +5938,7 @@
|
|
|
5924
5938
|
let expirationTimeout = /* @__PURE__ */ state(null);
|
|
5925
5939
|
let payload = /* @__PURE__ */ state(null);
|
|
5926
5940
|
let plugins = /* @__PURE__ */ state(proxy([]));
|
|
5941
|
+
let updateUISignal = /* @__PURE__ */ state(0);
|
|
5927
5942
|
let userConfig = /* @__PURE__ */ state(proxy({}));
|
|
5928
5943
|
let visible = /* @__PURE__ */ state(true);
|
|
5929
5944
|
const config = /* @__PURE__ */ user_derived(() => ({
|
|
@@ -6003,7 +6018,9 @@
|
|
|
6003
6018
|
}
|
|
6004
6019
|
});
|
|
6005
6020
|
user_effect(() => {
|
|
6006
|
-
|
|
6021
|
+
if (get(currentDisplay) !== get(config).display) {
|
|
6022
|
+
setDisplay(get(config).display);
|
|
6023
|
+
}
|
|
6007
6024
|
});
|
|
6008
6025
|
user_effect(() => {
|
|
6009
6026
|
if (get(checked) && get(currentState) === State.VERIFYING) {
|
|
@@ -6054,7 +6071,7 @@
|
|
|
6054
6071
|
}
|
|
6055
6072
|
});
|
|
6056
6073
|
onMount(() => {
|
|
6057
|
-
log("mounted", "3.0.
|
|
6074
|
+
log("mounted", "3.0.6");
|
|
6058
6075
|
if (instance) {
|
|
6059
6076
|
globalThis.$altcha.instances.add(instance);
|
|
6060
6077
|
}
|
|
@@ -6305,9 +6322,6 @@
|
|
|
6305
6322
|
}
|
|
6306
6323
|
}
|
|
6307
6324
|
function onCloseClick() {
|
|
6308
|
-
if (get(currentController)) {
|
|
6309
|
-
get(currentController).abort();
|
|
6310
|
-
}
|
|
6311
6325
|
setDisplay(get(config).display);
|
|
6312
6326
|
reset$1();
|
|
6313
6327
|
}
|
|
@@ -6326,9 +6340,6 @@
|
|
|
6326
6340
|
}
|
|
6327
6341
|
}
|
|
6328
6342
|
function onFormReset() {
|
|
6329
|
-
if (get(currentController)) {
|
|
6330
|
-
get(currentController).abort();
|
|
6331
|
-
}
|
|
6332
6343
|
setDisplay(get(config).display);
|
|
6333
6344
|
reset$1();
|
|
6334
6345
|
}
|
|
@@ -6347,8 +6358,11 @@
|
|
|
6347
6358
|
});
|
|
6348
6359
|
}
|
|
6349
6360
|
}
|
|
6350
|
-
function onWindowPageshow() {
|
|
6351
|
-
|
|
6361
|
+
function onWindowPageshow(ev) {
|
|
6362
|
+
if (ev.persisted) {
|
|
6363
|
+
setDisplay(get(config).display);
|
|
6364
|
+
reset$1();
|
|
6365
|
+
}
|
|
6352
6366
|
}
|
|
6353
6367
|
function onWindowResize() {
|
|
6354
6368
|
updateUI();
|
|
@@ -6468,6 +6482,9 @@
|
|
|
6468
6482
|
case "standard":
|
|
6469
6483
|
show();
|
|
6470
6484
|
}
|
|
6485
|
+
if (get(currentDisplay) !== value) {
|
|
6486
|
+
set(currentDisplay, value, true);
|
|
6487
|
+
}
|
|
6471
6488
|
}
|
|
6472
6489
|
function setChallengeExpiration(expiresAt) {
|
|
6473
6490
|
if (get(expirationTimeout)) {
|
|
@@ -6566,6 +6583,9 @@
|
|
|
6566
6583
|
set(checked, false);
|
|
6567
6584
|
set(error, err, true);
|
|
6568
6585
|
set(payload, null);
|
|
6586
|
+
if (get(currentController)) {
|
|
6587
|
+
get(currentController).abort();
|
|
6588
|
+
}
|
|
6569
6589
|
if (get(expirationTimeout)) {
|
|
6570
6590
|
clearTimeout(get(expirationTimeout));
|
|
6571
6591
|
set(expirationTimeout, null);
|
|
@@ -6588,6 +6608,7 @@
|
|
|
6588
6608
|
case "floating":
|
|
6589
6609
|
return repositionFloating();
|
|
6590
6610
|
}
|
|
6611
|
+
set(updateUISignal, get(updateUISignal) + 1);
|
|
6591
6612
|
}
|
|
6592
6613
|
async function verify(options = {}) {
|
|
6593
6614
|
const {
|
|
@@ -6603,8 +6624,8 @@
|
|
|
6603
6624
|
if (hook !== void 0) {
|
|
6604
6625
|
return hook;
|
|
6605
6626
|
}
|
|
6606
|
-
set(currentController, controller, true);
|
|
6607
6627
|
reset$1(State.VERIFYING);
|
|
6628
|
+
set(currentController, controller, true);
|
|
6608
6629
|
try {
|
|
6609
6630
|
if (!isSecureContext) {
|
|
6610
6631
|
throw new Error("Secure context (HTTPS) required.");
|
|
@@ -6615,6 +6636,10 @@
|
|
|
6615
6636
|
if (get(config).test) {
|
|
6616
6637
|
log("running test mode with null challenge");
|
|
6617
6638
|
await delay(Math.max(0, minDuration - (performance.now() - start)));
|
|
6639
|
+
if (get(currentController)?.signal.aborted) {
|
|
6640
|
+
reset$1();
|
|
6641
|
+
return null;
|
|
6642
|
+
}
|
|
6618
6643
|
set(payload, btoa(JSON.stringify({ challenge: null, solution: null, test: true })), true);
|
|
6619
6644
|
log("verified");
|
|
6620
6645
|
setState(State.VERIFIED);
|
|
@@ -6745,7 +6770,7 @@
|
|
|
6745
6770
|
if (get(config).overlayContent) $$render(consequent_1);
|
|
6746
6771
|
});
|
|
6747
6772
|
}
|
|
6748
|
-
|
|
6773
|
+
event("click", div_2, onCloseClick, true);
|
|
6749
6774
|
append($$anchor2, fragment_1);
|
|
6750
6775
|
};
|
|
6751
6776
|
if_block(node_1, ($$render) => {
|
|
@@ -6890,6 +6915,9 @@
|
|
|
6890
6915
|
get dir() {
|
|
6891
6916
|
return get(dir);
|
|
6892
6917
|
},
|
|
6918
|
+
get updateUISignal() {
|
|
6919
|
+
return get(updateUISignal);
|
|
6920
|
+
},
|
|
6893
6921
|
children: ($$anchor3, $$slotProps) => {
|
|
6894
6922
|
var fragment_9 = comment();
|
|
6895
6923
|
var node_10 = first_child(fragment_9);
|
|
@@ -6955,6 +6983,9 @@
|
|
|
6955
6983
|
get dir() {
|
|
6956
6984
|
return get(dir);
|
|
6957
6985
|
},
|
|
6986
|
+
get updateUISignal() {
|
|
6987
|
+
return get(updateUISignal);
|
|
6988
|
+
},
|
|
6958
6989
|
children: ($$anchor4, $$slotProps) => {
|
|
6959
6990
|
var fragment_12 = root_19();
|
|
6960
6991
|
var node_12 = first_child(fragment_12);
|
|
@@ -7026,7 +7057,6 @@
|
|
|
7026
7057
|
$$cleanup();
|
|
7027
7058
|
return $$pop;
|
|
7028
7059
|
}
|
|
7029
|
-
delegate(["click"]);
|
|
7030
7060
|
if (typeof window !== "undefined" && window.customElements) customElements.define("altcha-widget", create_custom_element(
|
|
7031
7061
|
Widget,
|
|
7032
7062
|
{
|