altcha 3.0.4 → 3.0.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 +68 -0
- package/dist/external/altcha.js +40 -13
- package/dist/external/altcha.min.js +1 -1
- package/dist/external/altcha.umd.cjs +40 -13
- package/dist/external/altcha.umd.min.cjs +1 -1
- package/dist/main/altcha.i18n.js +40 -13
- package/dist/main/altcha.i18n.min.js +1 -1
- package/dist/main/altcha.i18n.umd.cjs +40 -13
- package/dist/main/altcha.i18n.umd.min.cjs +1 -1
- package/dist/main/altcha.js +40 -13
- package/dist/main/altcha.min.js +1 -1
- package/dist/main/altcha.umd.cjs +40 -13
- package/dist/main/altcha.umd.min.cjs +1 -1
- package/package.json +1 -1
package/dist/main/altcha.js
CHANGED
|
@@ -5363,7 +5363,7 @@ function Code($$anchor, $$props) {
|
|
|
5363
5363
|
button.disabled = get(audioState) === AudioState.LOADING || get(audioState) === AudioState.ERROR;
|
|
5364
5364
|
set_attribute(button, "aria-label", get(audioState) === AudioState.LOADING ? strings().loading : strings().getAudioChallenge);
|
|
5365
5365
|
});
|
|
5366
|
-
|
|
5366
|
+
event("click", button, () => onPlayAudio(), true);
|
|
5367
5367
|
append($$anchor2, button);
|
|
5368
5368
|
};
|
|
5369
5369
|
if_block(node_1, ($$render) => {
|
|
@@ -5418,12 +5418,12 @@ function Code($$anchor, $$props) {
|
|
|
5418
5418
|
event("submit", form, onSubmitCapture, true);
|
|
5419
5419
|
delegated("keydown", input, onInputKeyDown);
|
|
5420
5420
|
bind_value(input, () => get(code), ($$value) => set(code, $$value));
|
|
5421
|
-
|
|
5422
|
-
|
|
5421
|
+
event("click", button_1, () => onReload()?.(), true);
|
|
5422
|
+
event("click", button_3, () => onCancel()?.(), true);
|
|
5423
5423
|
append($$anchor, div);
|
|
5424
5424
|
return pop($$exports);
|
|
5425
5425
|
}
|
|
5426
|
-
delegate(["keydown"
|
|
5426
|
+
delegate(["keydown"]);
|
|
5427
5427
|
create_custom_element(
|
|
5428
5428
|
Code,
|
|
5429
5429
|
{
|
|
@@ -5446,7 +5446,7 @@ var root_3$1 = /* @__PURE__ */ from_html(`<div role="button" class="altcha-popov
|
|
|
5446
5446
|
var root$1 = /* @__PURE__ */ from_html(`<!> <div><!> <!> <div class="altcha-popover-content"><!></div></div>`, 1);
|
|
5447
5447
|
function Popover($$anchor, $$props) {
|
|
5448
5448
|
push($$props, true);
|
|
5449
|
-
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, [
|
|
5449
|
+
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, [
|
|
5450
5450
|
"$$slots",
|
|
5451
5451
|
"$$events",
|
|
5452
5452
|
"$$legacy",
|
|
@@ -5459,6 +5459,7 @@ function Popover($$anchor, $$props) {
|
|
|
5459
5459
|
"onClickOutsideDelay",
|
|
5460
5460
|
"onClose",
|
|
5461
5461
|
"placement",
|
|
5462
|
+
"updateUISignal",
|
|
5462
5463
|
"variant"
|
|
5463
5464
|
]);
|
|
5464
5465
|
let el = /* @__PURE__ */ state(void 0);
|
|
@@ -5470,6 +5471,11 @@ function Popover($$anchor, $$props) {
|
|
|
5470
5471
|
set(top, placement() === "top");
|
|
5471
5472
|
}
|
|
5472
5473
|
});
|
|
5474
|
+
user_effect(() => {
|
|
5475
|
+
if (updateUISignal()) {
|
|
5476
|
+
reposition();
|
|
5477
|
+
}
|
|
5478
|
+
});
|
|
5473
5479
|
onMount(() => {
|
|
5474
5480
|
const moveToBody = display() === "bottomsheet" || display() === "overlay";
|
|
5475
5481
|
if (moveToBody) {
|
|
@@ -5492,7 +5498,7 @@ function Popover($$anchor, $$props) {
|
|
|
5492
5498
|
}
|
|
5493
5499
|
function onWindowClick(ev) {
|
|
5494
5500
|
const target = ev.target;
|
|
5495
|
-
if (!get(el)?.contains(target) &&
|
|
5501
|
+
if (!get(el)?.contains(target) && (!onClickOutsideDelay() || get(mountedAt) + onClickOutsideDelay() < Date.now())) {
|
|
5496
5502
|
onClickOutside()?.();
|
|
5497
5503
|
}
|
|
5498
5504
|
}
|
|
@@ -5569,6 +5575,13 @@ function Popover($$anchor, $$props) {
|
|
|
5569
5575
|
placement($$value);
|
|
5570
5576
|
flushSync();
|
|
5571
5577
|
},
|
|
5578
|
+
get updateUISignal() {
|
|
5579
|
+
return updateUISignal();
|
|
5580
|
+
},
|
|
5581
|
+
set updateUISignal($$value) {
|
|
5582
|
+
updateUISignal($$value);
|
|
5583
|
+
flushSync();
|
|
5584
|
+
},
|
|
5572
5585
|
get variant() {
|
|
5573
5586
|
return variant();
|
|
5574
5587
|
},
|
|
@@ -5578,7 +5591,7 @@ function Popover($$anchor, $$props) {
|
|
|
5578
5591
|
}
|
|
5579
5592
|
};
|
|
5580
5593
|
var fragment = root$1();
|
|
5581
|
-
event("click", $window, onWindowClick);
|
|
5594
|
+
event("click", $window, onWindowClick, true);
|
|
5582
5595
|
event("resize", $window, onWindowResize);
|
|
5583
5596
|
event("scroll", $window, onWindowScroll);
|
|
5584
5597
|
var node = first_child(fragment);
|
|
@@ -5615,7 +5628,7 @@ function Popover($$anchor, $$props) {
|
|
|
5615
5628
|
{
|
|
5616
5629
|
var consequent_2 = ($$anchor2) => {
|
|
5617
5630
|
var div_3 = root_3$1();
|
|
5618
|
-
|
|
5631
|
+
event("click", div_3, onCloseClick, true);
|
|
5619
5632
|
append($$anchor2, div_3);
|
|
5620
5633
|
};
|
|
5621
5634
|
if_block(node_2, ($$render) => {
|
|
@@ -5631,7 +5644,6 @@ function Popover($$anchor, $$props) {
|
|
|
5631
5644
|
append($$anchor, fragment);
|
|
5632
5645
|
return pop($$exports);
|
|
5633
5646
|
}
|
|
5634
|
-
delegate(["click"]);
|
|
5635
5647
|
create_custom_element(
|
|
5636
5648
|
Popover,
|
|
5637
5649
|
{
|
|
@@ -5643,6 +5655,7 @@ create_custom_element(
|
|
|
5643
5655
|
onClickOutsideDelay: {},
|
|
5644
5656
|
onClose: {},
|
|
5645
5657
|
placement: {},
|
|
5658
|
+
updateUISignal: {},
|
|
5646
5659
|
variant: {}
|
|
5647
5660
|
},
|
|
5648
5661
|
[],
|
|
@@ -5917,6 +5930,7 @@ function Widget($$anchor, $$props) {
|
|
|
5917
5930
|
let checked = /* @__PURE__ */ state(false);
|
|
5918
5931
|
let codeChallenge = /* @__PURE__ */ state(null);
|
|
5919
5932
|
let currentController = /* @__PURE__ */ state(null);
|
|
5933
|
+
let currentDisplay = /* @__PURE__ */ state(null);
|
|
5920
5934
|
let currentState = /* @__PURE__ */ state(proxy(State.UNVERIFIED));
|
|
5921
5935
|
let elAnchorArrow = /* @__PURE__ */ state(void 0);
|
|
5922
5936
|
let elFloatingAnchor = /* @__PURE__ */ state(void 0);
|
|
@@ -5927,6 +5941,7 @@ function Widget($$anchor, $$props) {
|
|
|
5927
5941
|
let expirationTimeout = /* @__PURE__ */ state(null);
|
|
5928
5942
|
let payload = /* @__PURE__ */ state(null);
|
|
5929
5943
|
let plugins = /* @__PURE__ */ state(proxy([]));
|
|
5944
|
+
let updateUISignal = /* @__PURE__ */ state(0);
|
|
5930
5945
|
let userConfig = /* @__PURE__ */ state(proxy({}));
|
|
5931
5946
|
let visible = /* @__PURE__ */ state(true);
|
|
5932
5947
|
const config = /* @__PURE__ */ user_derived(() => ({
|
|
@@ -6006,7 +6021,9 @@ function Widget($$anchor, $$props) {
|
|
|
6006
6021
|
}
|
|
6007
6022
|
});
|
|
6008
6023
|
user_effect(() => {
|
|
6009
|
-
|
|
6024
|
+
if (get(currentDisplay) !== get(config).display) {
|
|
6025
|
+
setDisplay(get(config).display);
|
|
6026
|
+
}
|
|
6010
6027
|
});
|
|
6011
6028
|
user_effect(() => {
|
|
6012
6029
|
if (get(checked) && get(currentState) === State.VERIFYING) {
|
|
@@ -6057,7 +6074,7 @@ function Widget($$anchor, $$props) {
|
|
|
6057
6074
|
}
|
|
6058
6075
|
});
|
|
6059
6076
|
onMount(() => {
|
|
6060
|
-
log("mounted", "3.0.
|
|
6077
|
+
log("mounted", "3.0.5");
|
|
6061
6078
|
if (instance) {
|
|
6062
6079
|
globalThis.$altcha.instances.add(instance);
|
|
6063
6080
|
}
|
|
@@ -6351,6 +6368,7 @@ function Widget($$anchor, $$props) {
|
|
|
6351
6368
|
}
|
|
6352
6369
|
}
|
|
6353
6370
|
function onWindowPageshow() {
|
|
6371
|
+
setDisplay(get(config).display);
|
|
6354
6372
|
reset$1();
|
|
6355
6373
|
}
|
|
6356
6374
|
function onWindowResize() {
|
|
@@ -6471,6 +6489,9 @@ function Widget($$anchor, $$props) {
|
|
|
6471
6489
|
case "standard":
|
|
6472
6490
|
show();
|
|
6473
6491
|
}
|
|
6492
|
+
if (get(currentDisplay) !== value) {
|
|
6493
|
+
set(currentDisplay, value, true);
|
|
6494
|
+
}
|
|
6474
6495
|
}
|
|
6475
6496
|
function setChallengeExpiration(expiresAt) {
|
|
6476
6497
|
if (get(expirationTimeout)) {
|
|
@@ -6591,6 +6612,7 @@ function Widget($$anchor, $$props) {
|
|
|
6591
6612
|
case "floating":
|
|
6592
6613
|
return repositionFloating();
|
|
6593
6614
|
}
|
|
6615
|
+
set(updateUISignal, get(updateUISignal) + 1);
|
|
6594
6616
|
}
|
|
6595
6617
|
async function verify(options = {}) {
|
|
6596
6618
|
const {
|
|
@@ -6748,7 +6770,7 @@ function Widget($$anchor, $$props) {
|
|
|
6748
6770
|
if (get(config).overlayContent) $$render(consequent_1);
|
|
6749
6771
|
});
|
|
6750
6772
|
}
|
|
6751
|
-
|
|
6773
|
+
event("click", div_2, onCloseClick, true);
|
|
6752
6774
|
append($$anchor2, fragment_1);
|
|
6753
6775
|
};
|
|
6754
6776
|
if_block(node_1, ($$render) => {
|
|
@@ -6893,6 +6915,9 @@ function Widget($$anchor, $$props) {
|
|
|
6893
6915
|
get dir() {
|
|
6894
6916
|
return get(dir);
|
|
6895
6917
|
},
|
|
6918
|
+
get updateUISignal() {
|
|
6919
|
+
return get(updateUISignal);
|
|
6920
|
+
},
|
|
6896
6921
|
children: ($$anchor3, $$slotProps) => {
|
|
6897
6922
|
var fragment_9 = comment();
|
|
6898
6923
|
var node_10 = first_child(fragment_9);
|
|
@@ -6958,6 +6983,9 @@ function Widget($$anchor, $$props) {
|
|
|
6958
6983
|
get dir() {
|
|
6959
6984
|
return get(dir);
|
|
6960
6985
|
},
|
|
6986
|
+
get updateUISignal() {
|
|
6987
|
+
return get(updateUISignal);
|
|
6988
|
+
},
|
|
6961
6989
|
children: ($$anchor4, $$slotProps) => {
|
|
6962
6990
|
var fragment_12 = root_19();
|
|
6963
6991
|
var node_12 = first_child(fragment_12);
|
|
@@ -7029,7 +7057,6 @@ function Widget($$anchor, $$props) {
|
|
|
7029
7057
|
$$cleanup();
|
|
7030
7058
|
return $$pop;
|
|
7031
7059
|
}
|
|
7032
|
-
delegate(["click"]);
|
|
7033
7060
|
if (typeof window !== "undefined" && window.customElements) customElements.define("altcha-widget", create_custom_element(
|
|
7034
7061
|
Widget,
|
|
7035
7062
|
{
|