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