@authon/js 0.3.3 → 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.cjs CHANGED
@@ -422,12 +422,10 @@ var ModalRenderer = class {
422
422
  </button>`;
423
423
  }).join("") : "";
424
424
  const divider = showProviders && b.showDivider !== false && b.showEmailPassword !== false ? `<div class="divider"><span>or</span></div>` : "";
425
- const captchaContainer = this.captchaSiteKey ? '<div id="turnstile-container" style="display:flex;justify-content:center;margin:4px 0"></div>' : "";
426
425
  const emailForm = b.showEmailPassword !== false ? `<form class="email-form" id="email-form">
427
426
  <input type="email" placeholder="Email address" name="email" required class="input" autocomplete="email" />
428
427
  <input type="password" placeholder="Password" name="password" required class="input" autocomplete="${isSignUp ? "new-password" : "current-password"}" />
429
428
  ${isSignUp ? '<p class="password-hint">Must contain uppercase, lowercase, and a number (min 8 chars)</p>' : ""}
430
- ${captchaContainer}
431
429
  <button type="submit" class="submit-btn">${isSignUp ? "Sign up" : "Sign in"}</button>
432
430
  </form>` : "";
433
431
  const hasMethodAbove = showProviders && this.enabledProviders.length > 0 || b.showEmailPassword !== false;
@@ -485,28 +483,13 @@ var ModalRenderer = class {
485
483
  `;
486
484
  }
487
485
  renderTurnstile() {
488
- if (!this.captchaSiteKey || !this.shadowRoot) return;
489
- const anchor = this.shadowRoot.getElementById("turnstile-container");
490
- if (!anchor) return;
486
+ if (!this.captchaSiteKey) return;
491
487
  const w = window;
492
- const positionWrapper = () => {
493
- if (!this.turnstileWrapper || !anchor.isConnected) return;
494
- const rect = anchor.getBoundingClientRect();
495
- Object.assign(this.turnstileWrapper.style, {
496
- position: "fixed",
497
- top: `${rect.top}px`,
498
- left: `${rect.left}px`,
499
- width: `${rect.width}px`,
500
- zIndex: "2147483647",
501
- display: "flex",
502
- justifyContent: "center"
503
- });
504
- };
505
488
  const tryRender = () => {
506
- if (!w.turnstile || !anchor.isConnected) return;
489
+ if (!w.turnstile) return;
507
490
  this.turnstileWrapper = document.createElement("div");
491
+ this.turnstileWrapper.style.cssText = "position:fixed;bottom:10px;right:10px;z-index:2147483647;";
508
492
  document.body.appendChild(this.turnstileWrapper);
509
- positionWrapper();
510
493
  this.turnstileWidgetId = w.turnstile.render(this.turnstileWrapper, {
511
494
  sitekey: this.captchaSiteKey,
512
495
  callback: (token) => {
@@ -519,10 +502,8 @@ var ModalRenderer = class {
519
502
  this.turnstileToken = "";
520
503
  },
521
504
  theme: this.isDark() ? "dark" : "light",
522
- size: "flexible"
505
+ appearance: "interaction-only"
523
506
  });
524
- window.addEventListener("scroll", positionWrapper, { passive: true });
525
- window.addEventListener("resize", positionWrapper, { passive: true });
526
507
  };
527
508
  if (w.turnstile) {
528
509
  tryRender();