@authon/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.js CHANGED
@@ -393,12 +393,10 @@ var ModalRenderer = class {
393
393
  </button>`;
394
394
  }).join("") : "";
395
395
  const divider = showProviders && b.showDivider !== false && b.showEmailPassword !== false ? `<div class="divider"><span>or</span></div>` : "";
396
- const captchaContainer = this.captchaSiteKey ? '<div id="turnstile-container" style="display:flex;justify-content:center;margin:4px 0"></div>' : "";
397
396
  const emailForm = b.showEmailPassword !== false ? `<form class="email-form" id="email-form">
398
397
  <input type="email" placeholder="Email address" name="email" required class="input" autocomplete="email" />
399
398
  <input type="password" placeholder="Password" name="password" required class="input" autocomplete="${isSignUp ? "new-password" : "current-password"}" />
400
399
  ${isSignUp ? '<p class="password-hint">Must contain uppercase, lowercase, and a number (min 8 chars)</p>' : ""}
401
- ${captchaContainer}
402
400
  <button type="submit" class="submit-btn">${isSignUp ? "Sign up" : "Sign in"}</button>
403
401
  </form>` : "";
404
402
  const hasMethodAbove = showProviders && this.enabledProviders.length > 0 || b.showEmailPassword !== false;
@@ -456,28 +454,13 @@ var ModalRenderer = class {
456
454
  `;
457
455
  }
458
456
  renderTurnstile() {
459
- if (!this.captchaSiteKey || !this.shadowRoot) return;
460
- const anchor = this.shadowRoot.getElementById("turnstile-container");
461
- if (!anchor) return;
457
+ if (!this.captchaSiteKey) return;
462
458
  const w = window;
463
- const positionWrapper = () => {
464
- if (!this.turnstileWrapper || !anchor.isConnected) return;
465
- const rect = anchor.getBoundingClientRect();
466
- Object.assign(this.turnstileWrapper.style, {
467
- position: "fixed",
468
- top: `${rect.top}px`,
469
- left: `${rect.left}px`,
470
- width: `${rect.width}px`,
471
- zIndex: "2147483647",
472
- display: "flex",
473
- justifyContent: "center"
474
- });
475
- };
476
459
  const tryRender = () => {
477
- if (!w.turnstile || !anchor.isConnected) return;
460
+ if (!w.turnstile) return;
478
461
  this.turnstileWrapper = document.createElement("div");
462
+ this.turnstileWrapper.style.cssText = "position:fixed;bottom:10px;right:10px;z-index:2147483647;";
479
463
  document.body.appendChild(this.turnstileWrapper);
480
- positionWrapper();
481
464
  this.turnstileWidgetId = w.turnstile.render(this.turnstileWrapper, {
482
465
  sitekey: this.captchaSiteKey,
483
466
  callback: (token) => {
@@ -490,10 +473,8 @@ var ModalRenderer = class {
490
473
  this.turnstileToken = "";
491
474
  },
492
475
  theme: this.isDark() ? "dark" : "light",
493
- size: "flexible"
476
+ appearance: "interaction-only"
494
477
  });
495
- window.addEventListener("scroll", positionWrapper, { passive: true });
496
- window.addEventListener("resize", positionWrapper, { passive: true });
497
478
  };
498
479
  if (w.turnstile) {
499
480
  tryRender();