@sparkvault/sdk-js 8.2.0 → 8.3.0

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.
@@ -2023,6 +2023,38 @@ function getStyles(options) {
2023
2023
  : '0 8px 24px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04)',
2024
2024
  };
2025
2025
  return `
2026
+ /* ========================================
2027
+ MOTION SYSTEM — shared duration/easing tokens so every transition in
2028
+ the flow is consistent. Enters decelerate (ease-out-expo), exits
2029
+ accelerate, spring is reserved for the success moment.
2030
+ ======================================== */
2031
+ :root {
2032
+ --sv-dur-instant: 80ms;
2033
+ --sv-dur-fast: 140ms;
2034
+ --sv-dur-base: 220ms;
2035
+ --sv-dur-slow: 320ms;
2036
+ --sv-dur-slower: 480ms;
2037
+ --sv-ease-standard: cubic-bezier(0.2, 0, 0, 1);
2038
+ --sv-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
2039
+ --sv-ease-accelerate: cubic-bezier(0.3, 0, 1, 1);
2040
+ --sv-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
2041
+ }
2042
+
2043
+ /* Each mounted view enters with a calm fade + rise. Applied by the renderer
2044
+ on every step change; the brand lockup and footer never move. */
2045
+ @keyframes sv-step-in {
2046
+ from { opacity: 0; transform: translateY(8px); }
2047
+ to { opacity: 1; transform: none; }
2048
+ }
2049
+ .sv-step-enter { animation: sv-step-in var(--sv-dur-base) var(--sv-ease-out) both; }
2050
+
2051
+ /* The top progress bar itself is owned and styled by the sign-in page
2052
+ (login-popup.js); the renderer only drives it via window.__sparkvaultProgress. */
2053
+
2054
+ @media (prefers-reduced-motion: reduce) {
2055
+ .sv-step-enter { animation-duration: 1ms; }
2056
+ }
2057
+
2026
2058
  /* ========================================
2027
2059
  OVERLAY & MODAL CONTAINER
2028
2060
  ======================================== */
@@ -2143,11 +2175,11 @@ function getStyles(options) {
2143
2175
  ======================================== */
2144
2176
 
2145
2177
  .sv-title {
2146
- font-size: 18px;
2178
+ font-size: 21px;
2147
2179
  font-weight: 600;
2148
- letter-spacing: -0.02em;
2149
- line-height: 1.3;
2150
- margin: 0 0 6px 0;
2180
+ letter-spacing: -0.021em;
2181
+ line-height: 1.22;
2182
+ margin: 0 0 7px 0;
2151
2183
  text-align: center;
2152
2184
  color: ${tokens.textPrimary};
2153
2185
  }
@@ -2186,16 +2218,17 @@ function getStyles(options) {
2186
2218
 
2187
2219
  .sv-input {
2188
2220
  width: 100%;
2189
- padding: 10px 12px;
2221
+ padding: 13px 14px;
2190
2222
  font-size: 15px;
2191
2223
  font-weight: 400;
2192
2224
  line-height: 1.4;
2193
- border: 1px solid ${tokens.border};
2194
- border-radius: 8px;
2225
+ border: 1px solid ${tokens.borderHover};
2226
+ border-radius: 10px;
2195
2227
  background: ${tokens.bgInput};
2196
2228
  color: ${tokens.textPrimary};
2197
2229
  box-sizing: border-box;
2198
- transition: border-color 0.15s ease, box-shadow 0.15s ease;
2230
+ box-shadow: 0 1px 1px ${isDark ? 'rgba(0,0,0,0.3)' : 'rgba(10,10,10,0.04)'};
2231
+ transition: border-color var(--sv-dur-fast) var(--sv-ease-standard), box-shadow var(--sv-dur-fast) var(--sv-ease-standard);
2199
2232
  }
2200
2233
 
2201
2234
  .sv-input:hover:not(:focus):not(:disabled) {
@@ -2237,15 +2270,15 @@ function getStyles(options) {
2237
2270
  justify-content: center;
2238
2271
  gap: 8px;
2239
2272
  width: 100%;
2240
- padding: 10px 16px;
2241
- font-size: 14px;
2242
- font-weight: 500;
2243
- letter-spacing: -0.005em;
2244
- line-height: 1.4;
2273
+ padding: 14px 16px;
2274
+ font-size: 15px;
2275
+ font-weight: 600;
2276
+ letter-spacing: -0.006em;
2277
+ line-height: 1.35;
2245
2278
  border: none;
2246
- border-radius: 8px;
2279
+ border-radius: 10px;
2247
2280
  cursor: pointer;
2248
- transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
2281
+ transition: background var(--sv-dur-fast) var(--sv-ease-standard), transform var(--sv-dur-instant) var(--sv-ease-standard), box-shadow var(--sv-dur-fast) var(--sv-ease-standard);
2249
2282
  box-sizing: border-box;
2250
2283
  }
2251
2284
 
@@ -2288,14 +2321,17 @@ function getStyles(options) {
2288
2321
  border-color: ${tokens.borderHover};
2289
2322
  }
2290
2323
 
2291
- /* Method Button */
2324
+ /* Method Button — a full-width row that lifts on hover with a nudging
2325
+ chevron affordance (added via ::after so no DOM change is needed). */
2292
2326
  .sv-btn-method {
2327
+ position: relative;
2293
2328
  background: ${tokens.bg};
2294
- border: 1px solid ${tokens.border};
2329
+ border: 1px solid ${tokens.borderHover};
2330
+ border-radius: 12px;
2295
2331
  color: ${tokens.textPrimary};
2296
2332
  text-align: left;
2297
- padding: 12px 14px;
2298
- margin-bottom: 8px;
2333
+ padding: 15px 40px 15px 14px;
2334
+ margin-bottom: 9px;
2299
2335
  /* Inset 2px on either side so the focus outline (drawn outside the
2300
2336
  border-box) has room to render without clipping against the
2301
2337
  dialog's container edges. width:auto pairs with this to prevent
@@ -2303,6 +2339,25 @@ function getStyles(options) {
2303
2339
  margin-left: 2px;
2304
2340
  margin-right: 2px;
2305
2341
  width: calc(100% - 4px);
2342
+ transition: transform var(--sv-dur-base) var(--sv-ease-out), background var(--sv-dur-fast) var(--sv-ease-standard), border-color var(--sv-dur-fast) var(--sv-ease-standard);
2343
+ }
2344
+
2345
+ .sv-btn-method::after {
2346
+ content: "";
2347
+ position: absolute;
2348
+ right: 16px;
2349
+ top: 50%;
2350
+ width: 8px;
2351
+ height: 8px;
2352
+ border-right: 1.6px solid ${tokens.textMuted};
2353
+ border-top: 1.6px solid ${tokens.textMuted};
2354
+ transform: translateY(-50%) rotate(45deg);
2355
+ transition: transform var(--sv-dur-base) var(--sv-ease-out), border-color var(--sv-dur-fast) var(--sv-ease-standard);
2356
+ }
2357
+
2358
+ .sv-btn-method:hover:not(:disabled)::after {
2359
+ transform: translateY(-50%) translateX(3px) rotate(45deg);
2360
+ border-color: ${tokens.textSecondary};
2306
2361
  }
2307
2362
 
2308
2363
  /* The shared .sv-btn focus rule sets outline-offset:2px which sits
@@ -2315,7 +2370,8 @@ function getStyles(options) {
2315
2370
 
2316
2371
  .sv-btn-method:hover:not(:disabled) {
2317
2372
  background: ${tokens.bgSubtle};
2318
- border-color: ${tokens.borderHover};
2373
+ border-color: ${tokens.border};
2374
+ transform: translateY(-2px);
2319
2375
  }
2320
2376
 
2321
2377
  .sv-btn-method:last-child {
@@ -2356,18 +2412,25 @@ function getStyles(options) {
2356
2412
  }
2357
2413
 
2358
2414
  .sv-method-icon {
2359
- width: 20px;
2360
- height: 20px;
2415
+ width: 36px;
2416
+ height: 36px;
2361
2417
  flex-shrink: 0;
2362
2418
  display: flex;
2363
2419
  align-items: center;
2364
2420
  justify-content: center;
2421
+ border-radius: 9px;
2422
+ background: ${tokens.bgSubtle};
2365
2423
  color: ${tokens.textSecondary};
2424
+ transition: background var(--sv-dur-fast) var(--sv-ease-standard);
2425
+ }
2426
+
2427
+ .sv-btn-method:hover:not(:disabled) .sv-method-icon {
2428
+ background: ${tokens.bg};
2366
2429
  }
2367
2430
 
2368
2431
  .sv-method-icon svg {
2369
- width: 20px;
2370
- height: 20px;
2432
+ width: 19px;
2433
+ height: 19px;
2371
2434
  }
2372
2435
 
2373
2436
  .sv-method-text {
@@ -2399,18 +2462,20 @@ function getStyles(options) {
2399
2462
  }
2400
2463
 
2401
2464
  .sv-otp-digit {
2402
- width: 44px;
2403
- height: 52px;
2465
+ width: 46px;
2466
+ height: 56px;
2404
2467
  text-align: center;
2405
- font-size: 20px;
2468
+ font-size: 22px;
2406
2469
  font-weight: 600;
2407
2470
  letter-spacing: 0;
2408
- border: 1px solid ${tokens.border};
2409
- border-radius: 8px;
2471
+ font-variant-numeric: tabular-nums;
2472
+ caret-color: transparent;
2473
+ border: 1px solid ${tokens.borderHover};
2474
+ border-radius: 11px;
2410
2475
  background: ${tokens.bgInput};
2411
2476
  color: ${tokens.textPrimary};
2412
2477
  box-sizing: border-box;
2413
- transition: border-color 0.15s ease, box-shadow 0.15s ease;
2478
+ transition: border-color var(--sv-dur-fast) var(--sv-ease-standard), box-shadow var(--sv-dur-fast) var(--sv-ease-standard), transform var(--sv-dur-fast) var(--sv-ease-spring);
2414
2479
  }
2415
2480
 
2416
2481
  .sv-otp-digit:hover:not(:focus):not(:disabled) {
@@ -2421,6 +2486,7 @@ function getStyles(options) {
2421
2486
  outline: none;
2422
2487
  border-color: ${tokens.borderFocus};
2423
2488
  box-shadow: 0 0 0 3px ${tokens.primaryLight};
2489
+ transform: translateY(-2px);
2424
2490
  }
2425
2491
 
2426
2492
  .sv-otp-digit:disabled {
@@ -5938,6 +6004,14 @@ class OriginNotAllowedView {
5938
6004
  * Orchestrates view state and rendering for identity verification flows.
5939
6005
  * Uses extracted handlers for OTP and Passkey operations.
5940
6006
  */
6007
+ function progressHook() {
6008
+ if (typeof window === 'undefined')
6009
+ return null;
6010
+ const hook = window.__sparkvaultProgress;
6011
+ return hook && typeof hook.start === 'function' ? hook : null;
6012
+ }
6013
+ function progressStart() { progressHook()?.start(); }
6014
+ function progressDone() { progressHook()?.done(); }
5941
6015
  /**
5942
6016
  * End-user copy for a blocked Identity. Intentionally non-leaky — it never names
5943
6017
  * the trial, billing, usage, or any owner-facing internal. When the site's
@@ -6215,7 +6289,24 @@ class IdentityRenderer {
6215
6289
  const view = this.createViewForState(this.viewState);
6216
6290
  this.currentView = view;
6217
6291
  clearChildren(body);
6218
- body.appendChild(view.render());
6292
+ const rendered = view.render();
6293
+ // Each step enters with a calm fade + rise (see .sv-step-enter). The brand
6294
+ // lockup and footer live outside `body`, so only the flow content moves.
6295
+ if (rendered instanceof HTMLElement) {
6296
+ rendered.classList.add('sv-step-enter');
6297
+ }
6298
+ body.appendChild(rendered);
6299
+ // Drive the top progress bar (owned by login-popup.js as
6300
+ // `window.__sparkvaultProgress`) off the view: a transient `loading` view
6301
+ // means a network step is in flight, so keep the bar trickling; any real
6302
+ // view completes it. The controller is idempotent, so overlapping calls are
6303
+ // safe, and it is a no-op when the hook is absent (any non-popup host).
6304
+ if (this.viewState.view === 'loading') {
6305
+ progressStart();
6306
+ }
6307
+ else {
6308
+ progressDone();
6309
+ }
6219
6310
  // Auto-focus: prefer inputs first, then primary/method buttons (skip back links)
6220
6311
  const focusable = body.querySelector('input:not([disabled]), ' +
6221
6312
  'button.sv-btn-primary:not([disabled]), ' +
@@ -6597,6 +6688,7 @@ class IdentityRenderer {
6597
6688
  if (this.viewState.view !== 'otp-verify')
6598
6689
  return;
6599
6690
  const currentMethod = this.verificationState.otp.method ?? 'email';
6691
+ progressStart();
6600
6692
  const result = await this.otpHandler.verify(code);
6601
6693
  if (result.secondFactor) {
6602
6694
  this.setState({