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
|
@@ -5365,7 +5365,7 @@
|
|
|
5365
5365
|
button.disabled = get(audioState) === AudioState.LOADING || get(audioState) === AudioState.ERROR;
|
|
5366
5366
|
set_attribute(button, "aria-label", get(audioState) === AudioState.LOADING ? strings().loading : strings().getAudioChallenge);
|
|
5367
5367
|
});
|
|
5368
|
-
|
|
5368
|
+
event("click", button, () => onPlayAudio(), true);
|
|
5369
5369
|
append($$anchor2, button);
|
|
5370
5370
|
};
|
|
5371
5371
|
if_block(node_1, ($$render) => {
|
|
@@ -5420,12 +5420,12 @@
|
|
|
5420
5420
|
event("submit", form, onSubmitCapture, true);
|
|
5421
5421
|
delegated("keydown", input, onInputKeyDown);
|
|
5422
5422
|
bind_value(input, () => get(code), ($$value) => set(code, $$value));
|
|
5423
|
-
|
|
5424
|
-
|
|
5423
|
+
event("click", button_1, () => onReload()?.(), true);
|
|
5424
|
+
event("click", button_3, () => onCancel()?.(), true);
|
|
5425
5425
|
append($$anchor, div);
|
|
5426
5426
|
return pop($$exports);
|
|
5427
5427
|
}
|
|
5428
|
-
delegate(["keydown"
|
|
5428
|
+
delegate(["keydown"]);
|
|
5429
5429
|
create_custom_element(
|
|
5430
5430
|
Code,
|
|
5431
5431
|
{
|
|
@@ -5448,7 +5448,7 @@
|
|
|
5448
5448
|
var root$1 = /* @__PURE__ */ from_html(`<!> <div><!> <!> <div class="altcha-popover-content"><!></div></div>`, 1);
|
|
5449
5449
|
function Popover($$anchor, $$props) {
|
|
5450
5450
|
push($$props, true);
|
|
5451
|
-
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, [
|
|
5451
|
+
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, [
|
|
5452
5452
|
"$$slots",
|
|
5453
5453
|
"$$events",
|
|
5454
5454
|
"$$legacy",
|
|
@@ -5461,6 +5461,7 @@
|
|
|
5461
5461
|
"onClickOutsideDelay",
|
|
5462
5462
|
"onClose",
|
|
5463
5463
|
"placement",
|
|
5464
|
+
"updateUISignal",
|
|
5464
5465
|
"variant"
|
|
5465
5466
|
]);
|
|
5466
5467
|
let el = /* @__PURE__ */ state(void 0);
|
|
@@ -5472,6 +5473,11 @@
|
|
|
5472
5473
|
set(top, placement() === "top");
|
|
5473
5474
|
}
|
|
5474
5475
|
});
|
|
5476
|
+
user_effect(() => {
|
|
5477
|
+
if (updateUISignal()) {
|
|
5478
|
+
reposition();
|
|
5479
|
+
}
|
|
5480
|
+
});
|
|
5475
5481
|
onMount(() => {
|
|
5476
5482
|
const moveToBody = display() === "bottomsheet" || display() === "overlay";
|
|
5477
5483
|
if (moveToBody) {
|
|
@@ -5494,7 +5500,7 @@
|
|
|
5494
5500
|
}
|
|
5495
5501
|
function onWindowClick(ev) {
|
|
5496
5502
|
const target = ev.target;
|
|
5497
|
-
if (!get(el)?.contains(target) &&
|
|
5503
|
+
if (!get(el)?.contains(target) && (!onClickOutsideDelay() || get(mountedAt) + onClickOutsideDelay() < Date.now())) {
|
|
5498
5504
|
onClickOutside()?.();
|
|
5499
5505
|
}
|
|
5500
5506
|
}
|
|
@@ -5571,6 +5577,13 @@
|
|
|
5571
5577
|
placement($$value);
|
|
5572
5578
|
flushSync();
|
|
5573
5579
|
},
|
|
5580
|
+
get updateUISignal() {
|
|
5581
|
+
return updateUISignal();
|
|
5582
|
+
},
|
|
5583
|
+
set updateUISignal($$value) {
|
|
5584
|
+
updateUISignal($$value);
|
|
5585
|
+
flushSync();
|
|
5586
|
+
},
|
|
5574
5587
|
get variant() {
|
|
5575
5588
|
return variant();
|
|
5576
5589
|
},
|
|
@@ -5580,7 +5593,7 @@
|
|
|
5580
5593
|
}
|
|
5581
5594
|
};
|
|
5582
5595
|
var fragment = root$1();
|
|
5583
|
-
event("click", $window, onWindowClick);
|
|
5596
|
+
event("click", $window, onWindowClick, true);
|
|
5584
5597
|
event("resize", $window, onWindowResize);
|
|
5585
5598
|
event("scroll", $window, onWindowScroll);
|
|
5586
5599
|
var node = first_child(fragment);
|
|
@@ -5617,7 +5630,7 @@
|
|
|
5617
5630
|
{
|
|
5618
5631
|
var consequent_2 = ($$anchor2) => {
|
|
5619
5632
|
var div_3 = root_3$1();
|
|
5620
|
-
|
|
5633
|
+
event("click", div_3, onCloseClick, true);
|
|
5621
5634
|
append($$anchor2, div_3);
|
|
5622
5635
|
};
|
|
5623
5636
|
if_block(node_2, ($$render) => {
|
|
@@ -5633,7 +5646,6 @@
|
|
|
5633
5646
|
append($$anchor, fragment);
|
|
5634
5647
|
return pop($$exports);
|
|
5635
5648
|
}
|
|
5636
|
-
delegate(["click"]);
|
|
5637
5649
|
create_custom_element(
|
|
5638
5650
|
Popover,
|
|
5639
5651
|
{
|
|
@@ -5645,6 +5657,7 @@
|
|
|
5645
5657
|
onClickOutsideDelay: {},
|
|
5646
5658
|
onClose: {},
|
|
5647
5659
|
placement: {},
|
|
5660
|
+
updateUISignal: {},
|
|
5648
5661
|
variant: {}
|
|
5649
5662
|
},
|
|
5650
5663
|
[],
|
|
@@ -5919,6 +5932,7 @@
|
|
|
5919
5932
|
let checked = /* @__PURE__ */ state(false);
|
|
5920
5933
|
let codeChallenge = /* @__PURE__ */ state(null);
|
|
5921
5934
|
let currentController = /* @__PURE__ */ state(null);
|
|
5935
|
+
let currentDisplay = /* @__PURE__ */ state(null);
|
|
5922
5936
|
let currentState = /* @__PURE__ */ state(proxy(State.UNVERIFIED));
|
|
5923
5937
|
let elAnchorArrow = /* @__PURE__ */ state(void 0);
|
|
5924
5938
|
let elFloatingAnchor = /* @__PURE__ */ state(void 0);
|
|
@@ -5929,6 +5943,7 @@
|
|
|
5929
5943
|
let expirationTimeout = /* @__PURE__ */ state(null);
|
|
5930
5944
|
let payload = /* @__PURE__ */ state(null);
|
|
5931
5945
|
let plugins = /* @__PURE__ */ state(proxy([]));
|
|
5946
|
+
let updateUISignal = /* @__PURE__ */ state(0);
|
|
5932
5947
|
let userConfig = /* @__PURE__ */ state(proxy({}));
|
|
5933
5948
|
let visible = /* @__PURE__ */ state(true);
|
|
5934
5949
|
const config = /* @__PURE__ */ user_derived(() => ({
|
|
@@ -6008,7 +6023,9 @@
|
|
|
6008
6023
|
}
|
|
6009
6024
|
});
|
|
6010
6025
|
user_effect(() => {
|
|
6011
|
-
|
|
6026
|
+
if (get(currentDisplay) !== get(config).display) {
|
|
6027
|
+
setDisplay(get(config).display);
|
|
6028
|
+
}
|
|
6012
6029
|
});
|
|
6013
6030
|
user_effect(() => {
|
|
6014
6031
|
if (get(checked) && get(currentState) === State.VERIFYING) {
|
|
@@ -6059,7 +6076,7 @@
|
|
|
6059
6076
|
}
|
|
6060
6077
|
});
|
|
6061
6078
|
onMount(() => {
|
|
6062
|
-
log("mounted", "3.0.
|
|
6079
|
+
log("mounted", "3.0.6");
|
|
6063
6080
|
if (instance) {
|
|
6064
6081
|
globalThis.$altcha.instances.add(instance);
|
|
6065
6082
|
}
|
|
@@ -6310,9 +6327,6 @@
|
|
|
6310
6327
|
}
|
|
6311
6328
|
}
|
|
6312
6329
|
function onCloseClick() {
|
|
6313
|
-
if (get(currentController)) {
|
|
6314
|
-
get(currentController).abort();
|
|
6315
|
-
}
|
|
6316
6330
|
setDisplay(get(config).display);
|
|
6317
6331
|
reset$1();
|
|
6318
6332
|
}
|
|
@@ -6331,9 +6345,6 @@
|
|
|
6331
6345
|
}
|
|
6332
6346
|
}
|
|
6333
6347
|
function onFormReset() {
|
|
6334
|
-
if (get(currentController)) {
|
|
6335
|
-
get(currentController).abort();
|
|
6336
|
-
}
|
|
6337
6348
|
setDisplay(get(config).display);
|
|
6338
6349
|
reset$1();
|
|
6339
6350
|
}
|
|
@@ -6352,8 +6363,11 @@
|
|
|
6352
6363
|
});
|
|
6353
6364
|
}
|
|
6354
6365
|
}
|
|
6355
|
-
function onWindowPageshow() {
|
|
6356
|
-
|
|
6366
|
+
function onWindowPageshow(ev) {
|
|
6367
|
+
if (ev.persisted) {
|
|
6368
|
+
setDisplay(get(config).display);
|
|
6369
|
+
reset$1();
|
|
6370
|
+
}
|
|
6357
6371
|
}
|
|
6358
6372
|
function onWindowResize() {
|
|
6359
6373
|
updateUI();
|
|
@@ -6473,6 +6487,9 @@
|
|
|
6473
6487
|
case "standard":
|
|
6474
6488
|
show();
|
|
6475
6489
|
}
|
|
6490
|
+
if (get(currentDisplay) !== value) {
|
|
6491
|
+
set(currentDisplay, value, true);
|
|
6492
|
+
}
|
|
6476
6493
|
}
|
|
6477
6494
|
function setChallengeExpiration(expiresAt) {
|
|
6478
6495
|
if (get(expirationTimeout)) {
|
|
@@ -6571,6 +6588,9 @@
|
|
|
6571
6588
|
set(checked, false);
|
|
6572
6589
|
set(error, err, true);
|
|
6573
6590
|
set(payload, null);
|
|
6591
|
+
if (get(currentController)) {
|
|
6592
|
+
get(currentController).abort();
|
|
6593
|
+
}
|
|
6574
6594
|
if (get(expirationTimeout)) {
|
|
6575
6595
|
clearTimeout(get(expirationTimeout));
|
|
6576
6596
|
set(expirationTimeout, null);
|
|
@@ -6593,6 +6613,7 @@
|
|
|
6593
6613
|
case "floating":
|
|
6594
6614
|
return repositionFloating();
|
|
6595
6615
|
}
|
|
6616
|
+
set(updateUISignal, get(updateUISignal) + 1);
|
|
6596
6617
|
}
|
|
6597
6618
|
async function verify(options = {}) {
|
|
6598
6619
|
const {
|
|
@@ -6608,8 +6629,8 @@
|
|
|
6608
6629
|
if (hook !== void 0) {
|
|
6609
6630
|
return hook;
|
|
6610
6631
|
}
|
|
6611
|
-
set(currentController, controller, true);
|
|
6612
6632
|
reset$1(State.VERIFYING);
|
|
6633
|
+
set(currentController, controller, true);
|
|
6613
6634
|
try {
|
|
6614
6635
|
if (!isSecureContext) {
|
|
6615
6636
|
throw new Error("Secure context (HTTPS) required.");
|
|
@@ -6620,6 +6641,10 @@
|
|
|
6620
6641
|
if (get(config).test) {
|
|
6621
6642
|
log("running test mode with null challenge");
|
|
6622
6643
|
await delay(Math.max(0, minDuration - (performance.now() - start)));
|
|
6644
|
+
if (get(currentController)?.signal.aborted) {
|
|
6645
|
+
reset$1();
|
|
6646
|
+
return null;
|
|
6647
|
+
}
|
|
6623
6648
|
set(payload, btoa(JSON.stringify({ challenge: null, solution: null, test: true })), true);
|
|
6624
6649
|
log("verified");
|
|
6625
6650
|
setState(State.VERIFIED);
|
|
@@ -6750,7 +6775,7 @@
|
|
|
6750
6775
|
if (get(config).overlayContent) $$render(consequent_1);
|
|
6751
6776
|
});
|
|
6752
6777
|
}
|
|
6753
|
-
|
|
6778
|
+
event("click", div_2, onCloseClick, true);
|
|
6754
6779
|
append($$anchor2, fragment_1);
|
|
6755
6780
|
};
|
|
6756
6781
|
if_block(node_1, ($$render) => {
|
|
@@ -6895,6 +6920,9 @@
|
|
|
6895
6920
|
get dir() {
|
|
6896
6921
|
return get(dir);
|
|
6897
6922
|
},
|
|
6923
|
+
get updateUISignal() {
|
|
6924
|
+
return get(updateUISignal);
|
|
6925
|
+
},
|
|
6898
6926
|
children: ($$anchor3, $$slotProps) => {
|
|
6899
6927
|
var fragment_9 = comment();
|
|
6900
6928
|
var node_10 = first_child(fragment_9);
|
|
@@ -6960,6 +6988,9 @@
|
|
|
6960
6988
|
get dir() {
|
|
6961
6989
|
return get(dir);
|
|
6962
6990
|
},
|
|
6991
|
+
get updateUISignal() {
|
|
6992
|
+
return get(updateUISignal);
|
|
6993
|
+
},
|
|
6963
6994
|
children: ($$anchor4, $$slotProps) => {
|
|
6964
6995
|
var fragment_12 = root_19();
|
|
6965
6996
|
var node_12 = first_child(fragment_12);
|
|
@@ -7031,7 +7062,6 @@
|
|
|
7031
7062
|
$$cleanup();
|
|
7032
7063
|
return $$pop;
|
|
7033
7064
|
}
|
|
7034
|
-
delegate(["click"]);
|
|
7035
7065
|
if (typeof window !== "undefined" && window.customElements) customElements.define("altcha-widget", create_custom_element(
|
|
7036
7066
|
Widget,
|
|
7037
7067
|
{
|