@scalar/api-client 3.29.0 → 3.29.1

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.
Files changed (21) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/style.css +97 -75
  3. package/dist/v2/blocks/operation-block/OperationBlock.vue_vue_type_script_setup_true_lang.js +1 -1
  4. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  5. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +1 -1
  6. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue_vue_type_script_setup_true_lang.js +5 -2
  7. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue_vue_type_script_setup_true_lang.js.map +1 -1
  8. package/dist/v2/blocks/scalar-address-bar-block/helpers/refocus-blur-target.d.ts +3 -1
  9. package/dist/v2/blocks/scalar-address-bar-block/helpers/refocus-blur-target.d.ts.map +1 -1
  10. package/dist/v2/blocks/scalar-address-bar-block/helpers/refocus-blur-target.js +4 -2
  11. package/dist/v2/blocks/scalar-address-bar-block/helpers/refocus-blur-target.js.map +1 -1
  12. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue_vue_type_script_setup_true_lang.js +1 -1
  13. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
  14. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +3 -3
  15. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js.map +1 -1
  16. package/dist/v2/components/data-table/DataTableCell.vue_vue_type_script_setup_true_lang.js +8 -1
  17. package/dist/v2/components/data-table/DataTableCell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  18. package/dist/v2/constants.js +1 -1
  19. package/dist/v2/features/operation/Operation.vue_vue_type_script_setup_true_lang.js +1 -1
  20. package/dist/vue-styles.css +14 -14
  21. package/package.json +17 -17
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @scalar/api-client
2
2
 
3
+ ## 3.29.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#11195](https://github.com/scalar/scalar/pull/11195): Update compatible dependencies for AI chat, focus management, code and Markdown rendering, HTTP requests, mock servers, and application data fetching.
8
+ - [#11165](https://github.com/scalar/scalar/pull/11165): Update compatible npm dependencies for Vue rendering, HTTP requests and serving, editor utilities, and query caching while preserving supported consumer TypeScript versions.
9
+
10
+ Keep string target IDs valid in the production-built Floating component after the Vue update.
11
+ - [#11169](https://github.com/scalar/scalar/pull/11169): Look up elements and focus through the provided document root instead of `document`. Nothing provides one yet, so behavior is unchanged until shadow-root mounts wire it up
12
+ - [#11206](https://github.com/scalar/scalar/pull/11206): Use empty OpenAPI server variable defaults in request URLs, OAuth server URLs, and code snippets.
13
+
3
14
  ## 3.29.0
4
15
 
5
16
  ### Minor Changes
package/dist/style.css CHANGED
@@ -2426,7 +2426,7 @@ code.property-detail-value[data-v-8b57daa7] {
2426
2426
  flex: 1;
2427
2427
  }
2428
2428
 
2429
- .property-heading[data-v-09888606] {
2429
+ .property-heading[data-v-8d6403f4] {
2430
2430
  white-space: nowrap;
2431
2431
  flex-wrap: wrap;
2432
2432
  align-items: baseline;
@@ -2434,19 +2434,19 @@ code.property-detail-value[data-v-8b57daa7] {
2434
2434
  display: flex;
2435
2435
  }
2436
2436
 
2437
- :is(.property-heading[data-v-09888606]:has( + .children), .property-heading[data-v-09888606]:has( + .property-rule)) {
2437
+ :is(.property-heading[data-v-8d6403f4]:has( + .children), .property-heading[data-v-8d6403f4]:has( + .property-rule)) {
2438
2438
  margin-bottom: 9px;
2439
2439
  }
2440
2440
 
2441
- .property-heading[data-v-09888606] > * {
2441
+ .property-heading[data-v-8d6403f4] > * {
2442
2442
  margin-right: 9px;
2443
2443
  }
2444
2444
 
2445
- .property-heading[data-v-09888606]:last-child {
2445
+ .property-heading[data-v-8d6403f4]:last-child {
2446
2446
  margin-right: 0;
2447
2447
  }
2448
2448
 
2449
- .property-name[data-v-09888606] {
2449
+ .property-name[data-v-8d6403f4] {
2450
2450
  max-width: 100%;
2451
2451
  font-family: var(--scalar-font-code);
2452
2452
  font-weight: var(--scalar-bold);
@@ -2455,45 +2455,45 @@ code.property-detail-value[data-v-8b57daa7] {
2455
2455
  overflow-wrap: break-word;
2456
2456
  }
2457
2457
 
2458
- .property-additional[data-v-09888606] {
2458
+ .property-additional[data-v-8d6403f4] {
2459
2459
  font-family: var(--scalar-font-code);
2460
2460
  }
2461
2461
 
2462
- .property-required[data-v-09888606], .property-optional[data-v-09888606] {
2462
+ .property-required[data-v-8d6403f4], .property-optional[data-v-8d6403f4] {
2463
2463
  color: var(--scalar-color-2);
2464
2464
  }
2465
2465
 
2466
- .property-required[data-v-09888606] {
2466
+ .property-required[data-v-8d6403f4] {
2467
2467
  font-size: var(--scalar-mini);
2468
2468
  color: var(--scalar-color-orange);
2469
2469
  }
2470
2470
 
2471
- .light-mode .property-required[data-v-09888606] {
2471
+ .light-mode .property-required[data-v-8d6403f4] {
2472
2472
  color: var(--scalar-color-orange);
2473
2473
  }
2474
2474
 
2475
2475
  @supports (color: color-mix(in lab, red, red)) {
2476
- .light-mode .property-required[data-v-09888606] {
2476
+ .light-mode .property-required[data-v-8d6403f4] {
2477
2477
  color: color-mix(in srgb, var(--scalar-color-orange), var(--scalar-color-1) 32%);
2478
2478
  }
2479
2479
  }
2480
2480
 
2481
- .property-read-only[data-v-09888606] {
2481
+ .property-read-only[data-v-8d6403f4] {
2482
2482
  font-size: var(--scalar-mini);
2483
2483
  color: var(--scalar-color-blue);
2484
2484
  }
2485
2485
 
2486
- .property-write-only[data-v-09888606] {
2486
+ .property-write-only[data-v-8d6403f4] {
2487
2487
  font-size: var(--scalar-mini);
2488
2488
  color: var(--scalar-color-green);
2489
2489
  }
2490
2490
 
2491
- .property-discriminator[data-v-09888606] {
2491
+ .property-discriminator[data-v-8d6403f4] {
2492
2492
  font-size: var(--scalar-mini);
2493
2493
  color: var(--scalar-color-purple);
2494
2494
  }
2495
2495
 
2496
- .property-detail[data-v-09888606] {
2496
+ .property-detail[data-v-8d6403f4] {
2497
2497
  font-size: var(--scalar-mini);
2498
2498
  color: var(--scalar-color-2);
2499
2499
  align-items: center;
@@ -2501,15 +2501,15 @@ code.property-detail-value[data-v-8b57daa7] {
2501
2501
  display: flex;
2502
2502
  }
2503
2503
 
2504
- .property-const[data-v-09888606] {
2504
+ .property-const[data-v-8d6403f4] {
2505
2505
  color: var(--scalar-color-1);
2506
2506
  }
2507
2507
 
2508
- .deprecated[data-v-09888606] {
2508
+ .deprecated[data-v-8d6403f4] {
2509
2509
  text-decoration: line-through;
2510
2510
  }
2511
2511
 
2512
- .property[data-v-00f22f7c] {
2512
+ .property[data-v-ae49201c] {
2513
2513
  color: var(--scalar-color-1);
2514
2514
  font-size: var(--scalar-small);
2515
2515
  flex-direction: column;
@@ -2518,61 +2518,61 @@ code.property-detail-value[data-v-8b57daa7] {
2518
2518
  position: relative;
2519
2519
  }
2520
2520
 
2521
- .property[data-v-00f22f7c]:has( > .property-rule:first-of-type):not(.property--compact) {
2521
+ .property[data-v-ae49201c]:has( > .property-rule:first-of-type):not(.property--compact) {
2522
2522
  padding-top: 8px;
2523
2523
  padding-bottom: 8px;
2524
2524
  }
2525
2525
 
2526
- .property--deprecated[data-v-00f22f7c] {
2526
+ .property--deprecated[data-v-ae49201c] {
2527
2527
  background: repeating-linear-gradient(-45deg, var(--scalar-background-2) 0, var(--scalar-background-2) 2px, transparent 2px, transparent 5px);
2528
2528
  background-size: 100%;
2529
2529
  }
2530
2530
 
2531
- .property-description[data-v-00f22f7c] {
2531
+ .property-description[data-v-ae49201c] {
2532
2532
  line-height: 1.4;
2533
2533
  font-size: var(--scalar-small);
2534
2534
  margin-top: 6px;
2535
2535
  }
2536
2536
 
2537
- .property-description[data-v-00f22f7c]:has( + .property-rule) {
2537
+ .property-description[data-v-ae49201c]:has( + .property-rule) {
2538
2538
  margin-bottom: 9px;
2539
2539
  }
2540
2540
 
2541
- [data-v-00f22f7c] .property-description * {
2541
+ [data-v-ae49201c] .property-description :not(:where(pre, pre *)) {
2542
2542
  color: var(--scalar-color-2) !important;
2543
2543
  }
2544
2544
 
2545
- .property[data-v-00f22f7c]:not(:last-of-type) {
2545
+ .property[data-v-ae49201c]:not(:last-of-type) {
2546
2546
  border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);
2547
2547
  }
2548
2548
 
2549
- .property-description + .children[data-v-00f22f7c], .children + .property-rule[data-v-00f22f7c] {
2549
+ .property-description + .children[data-v-ae49201c], .children + .property-rule[data-v-ae49201c] {
2550
2550
  margin-top: 9px;
2551
2551
  }
2552
2552
 
2553
- .children[data-v-00f22f7c] {
2553
+ .children[data-v-ae49201c] {
2554
2554
  flex-direction: column;
2555
2555
  display: flex;
2556
2556
  }
2557
2557
 
2558
- .children .property--compact.property--level-1[data-v-00f22f7c] {
2558
+ .children .property--compact.property--level-1[data-v-ae49201c] {
2559
2559
  padding: 12px;
2560
2560
  }
2561
2561
 
2562
- .property-example-value[data-v-00f22f7c] {
2562
+ .property-example-value[data-v-ae49201c] {
2563
2563
  all: unset;
2564
2564
  font-family: var(--scalar-font-code);
2565
2565
  border-top: var(--scalar-border-width) solid var(--scalar-border-color);
2566
2566
  padding: 6px;
2567
2567
  }
2568
2568
 
2569
- .property-rule[data-v-00f22f7c] {
2569
+ .property-rule[data-v-ae49201c] {
2570
2570
  border-radius: var(--scalar-radius-lg);
2571
2571
  flex-direction: column;
2572
2572
  display: flex;
2573
2573
  }
2574
2574
 
2575
- .property-example[data-v-00f22f7c] {
2575
+ .property-example[data-v-ae49201c] {
2576
2576
  background: none;
2577
2577
  border: none;
2578
2578
  flex-direction: row;
@@ -2580,23 +2580,23 @@ code.property-detail-value[data-v-8b57daa7] {
2580
2580
  display: flex;
2581
2581
  }
2582
2582
 
2583
- .property-example-label[data-v-00f22f7c], .property-example-value[data-v-00f22f7c] {
2583
+ .property-example-label[data-v-ae49201c], .property-example-value[data-v-ae49201c] {
2584
2584
  padding: 3px 0 0;
2585
2585
  }
2586
2586
 
2587
- .property-example-value[data-v-00f22f7c] {
2587
+ .property-example-value[data-v-ae49201c] {
2588
2588
  background: var(--scalar-background-2);
2589
2589
  border-radius: var(--scalar-radius);
2590
2590
  border-top: 0;
2591
2591
  padding: 3px 4px;
2592
2592
  }
2593
2593
 
2594
- .property-name[data-v-00f22f7c] {
2594
+ .property-name[data-v-ae49201c] {
2595
2595
  font-family: var(--scalar-font-code);
2596
2596
  font-weight: var(--scalar-semibold);
2597
2597
  }
2598
2598
 
2599
- .property-name-additional-properties[data-v-00f22f7c]:before, .property-name-pattern-properties[data-v-00f22f7c]:before {
2599
+ .property-name-additional-properties[data-v-ae49201c]:before, .property-name-pattern-properties[data-v-ae49201c]:before {
2600
2600
  text-transform: uppercase;
2601
2601
  font-size: var(--scalar-micro);
2602
2602
  border-radius: var(--scalar-radius);
@@ -2608,11 +2608,11 @@ code.property-detail-value[data-v-8b57daa7] {
2608
2608
  display: inline-block;
2609
2609
  }
2610
2610
 
2611
- .property-name-pattern-properties[data-v-00f22f7c]:before {
2611
+ .property-name-pattern-properties[data-v-ae49201c]:before {
2612
2612
  content: "regex";
2613
2613
  }
2614
2614
 
2615
- .property-name-additional-properties[data-v-00f22f7c], .property-name-pattern-properties[data-v-00f22f7c] {
2615
+ .property-name-additional-properties[data-v-ae49201c], .property-name-pattern-properties[data-v-ae49201c] {
2616
2616
  border: 1px dashed var(--scalar-border-color);
2617
2617
  color: var(--scalar-color-accent);
2618
2618
  border-radius: var(--scalar-radius);
@@ -2620,16 +2620,16 @@ code.property-detail-value[data-v-8b57daa7] {
2620
2620
  display: inline-block;
2621
2621
  }
2622
2622
 
2623
- .error[data-v-86862f28] {
2623
+ .error[data-v-d72dd68d] {
2624
2624
  background-color: var(--scalar-color-red);
2625
2625
  }
2626
2626
 
2627
- .schema-card[data-v-86862f28] {
2627
+ .schema-card[data-v-d72dd68d] {
2628
2628
  font-size: var(--scalar-font-size-4);
2629
2629
  color: var(--scalar-color-1);
2630
2630
  }
2631
2631
 
2632
- .schema-card-title[data-v-86862f28] {
2632
+ .schema-card-title[data-v-d72dd68d] {
2633
2633
  height: var(--schema-title-height);
2634
2634
  color: var(--scalar-color-2);
2635
2635
  font-weight: var(--scalar-semibold);
@@ -2641,48 +2641,48 @@ code.property-detail-value[data-v-8b57daa7] {
2641
2641
  display: flex;
2642
2642
  }
2643
2643
 
2644
- button.schema-card-title[data-v-86862f28] {
2644
+ button.schema-card-title[data-v-d72dd68d] {
2645
2645
  cursor: pointer;
2646
2646
  }
2647
2647
 
2648
- button.schema-card-title[data-v-86862f28]:hover {
2648
+ button.schema-card-title[data-v-d72dd68d]:hover {
2649
2649
  color: var(--scalar-color-1);
2650
2650
  }
2651
2651
 
2652
- .schema-properties-open > .schema-card-title[data-v-86862f28] {
2652
+ .schema-properties-open > .schema-card-title[data-v-d72dd68d] {
2653
2653
  border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);
2654
2654
  border-bottom-right-radius: 0;
2655
2655
  border-bottom-left-radius: 0;
2656
2656
  }
2657
2657
 
2658
- .schema-properties-open > .schema-properties[data-v-86862f28] {
2658
+ .schema-properties-open > .schema-properties[data-v-d72dd68d] {
2659
2659
  width: fit-content;
2660
2660
  }
2661
2661
 
2662
- .schema-card-description[data-v-86862f28] {
2662
+ .schema-card-description[data-v-d72dd68d] {
2663
2663
  color: var(--scalar-color-2);
2664
2664
  }
2665
2665
 
2666
- .schema-card-description + .schema-properties[data-v-86862f28] {
2666
+ .schema-card-description + .schema-properties[data-v-d72dd68d] {
2667
2667
  width: fit-content;
2668
2668
  margin-top: 8px;
2669
2669
  }
2670
2670
 
2671
- .schema-card--level-0:first-of-type > .schema-card-description[data-v-86862f28]:has( + .schema-properties) {
2671
+ .schema-card--level-0:first-of-type > .schema-card-description[data-v-d72dd68d]:has( + .schema-properties) {
2672
2672
  border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);
2673
2673
  margin-bottom: -8px;
2674
2674
  padding-bottom: 8px;
2675
2675
  }
2676
2676
 
2677
- .schema-card--level-0 ~ .schema-card--level-0 > .schema-card-description[data-v-86862f28]:has( + .schema-properties) {
2677
+ .schema-card--level-0 ~ .schema-card--level-0 > .schema-card-description[data-v-d72dd68d]:has( + .schema-properties) {
2678
2678
  padding-top: 8px;
2679
2679
  }
2680
2680
 
2681
- .schema-properties-open.schema-properties[data-v-86862f28], .schema-properties-open > .schema-card--open[data-v-86862f28] {
2681
+ .schema-properties-open.schema-properties[data-v-d72dd68d], .schema-properties-open > .schema-card--open[data-v-d72dd68d] {
2682
2682
  width: 100%;
2683
2683
  }
2684
2684
 
2685
- .schema-properties[data-v-86862f28] {
2685
+ .schema-properties[data-v-d72dd68d] {
2686
2686
  border: var(--scalar-border-width) solid var(--scalar-border-color);
2687
2687
  border-radius: var(--scalar-radius-lg);
2688
2688
  flex-direction: column;
@@ -2690,61 +2690,61 @@ button.schema-card-title[data-v-86862f28]:hover {
2690
2690
  display: flex;
2691
2691
  }
2692
2692
 
2693
- .schema-properties-name[data-v-86862f28] {
2693
+ .schema-properties-name[data-v-d72dd68d] {
2694
2694
  width: 100%;
2695
2695
  }
2696
2696
 
2697
- .schema-properties .schema-properties[data-v-86862f28] {
2697
+ .schema-properties .schema-properties[data-v-d72dd68d] {
2698
2698
  border-radius: 13.5px;
2699
2699
  }
2700
2700
 
2701
- .schema-properties .schema-properties.schema-properties-open[data-v-86862f28] {
2701
+ .schema-properties .schema-properties.schema-properties-open[data-v-d72dd68d] {
2702
2702
  border-radius: var(--scalar-radius-lg);
2703
2703
  }
2704
2704
 
2705
- .schema-properties-open[data-v-86862f28] {
2705
+ .schema-properties-open[data-v-d72dd68d] {
2706
2706
  width: 100%;
2707
2707
  }
2708
2708
 
2709
- .schema-card--compact[data-v-86862f28] {
2709
+ .schema-card--compact[data-v-d72dd68d] {
2710
2710
  align-self: flex-start;
2711
2711
  }
2712
2712
 
2713
- .schema-card--compact.schema-card--open[data-v-86862f28] {
2713
+ .schema-card--compact.schema-card--open[data-v-d72dd68d] {
2714
2714
  align-self: initial;
2715
2715
  }
2716
2716
 
2717
- .schema-card-title--compact[data-v-86862f28] {
2717
+ .schema-card-title--compact[data-v-d72dd68d] {
2718
2718
  color: var(--scalar-color-2);
2719
2719
  border-bottom: none;
2720
2720
  height: auto;
2721
2721
  padding: 6px 10px 6px 8px;
2722
2722
  }
2723
2723
 
2724
- .schema-properties-open > .schema-card-title--compact[data-v-86862f28] {
2724
+ .schema-properties-open > .schema-card-title--compact[data-v-d72dd68d] {
2725
2725
  position: static;
2726
2726
  }
2727
2727
 
2728
- .property--level-0 > .schema-properties > .schema-card--level-0 > .schema-properties[data-v-86862f28] {
2728
+ .property--level-0 > .schema-properties > .schema-card--level-0 > .schema-properties[data-v-d72dd68d] {
2729
2729
  border: none;
2730
2730
  }
2731
2731
 
2732
- .property--level-0 .schema-card--level-0:not(.schema-card--compact) .property--level-1[data-v-86862f28] {
2732
+ .property--level-0 .schema-card--level-0:not(.schema-card--compact) .property--level-1[data-v-d72dd68d] {
2733
2733
  padding: 0 0 8px;
2734
2734
  }
2735
2735
 
2736
- :not(.composition-panel) > .schema-card--compact.schema-card--level-0 > .schema-properties[data-v-86862f28] {
2736
+ :not(.composition-panel) > .schema-card--compact.schema-card--level-0 > .schema-properties[data-v-d72dd68d] {
2737
2737
  border: none;
2738
2738
  }
2739
2739
 
2740
- [data-v-86862f28] .schema-card-description p {
2740
+ [data-v-d72dd68d] .schema-card-description p {
2741
2741
  font-size: var(--scalar-small, var(--scalar-paragraph));
2742
2742
  color: var(--scalar-color-2);
2743
2743
  margin-bottom: 6px;
2744
2744
  display: block;
2745
2745
  }
2746
2746
 
2747
- .children .schema-card-description[data-v-86862f28]:first-of-type {
2747
+ .children .schema-card-description[data-v-d72dd68d]:first-of-type {
2748
2748
  padding-top: 0;
2749
2749
  }
2750
2750
 
@@ -3800,6 +3800,10 @@ button.schema-card-title[data-v-86862f28]:hover {
3800
3800
  max-height: 80svh;
3801
3801
  }
3802
3802
 
3803
+ .scalar-app .max-h-\[85svh\] {
3804
+ max-height: 85svh;
3805
+ }
3806
+
3803
3807
  .scalar-app .max-h-\[90svh\] {
3804
3808
  max-height: 90svh;
3805
3809
  }
@@ -3952,6 +3956,10 @@ button.schema-card-title[data-v-86862f28]:hover {
3952
3956
  width: 38px;
3953
3957
  }
3954
3958
 
3959
+ .scalar-app .w-\[calc\(100dvw-2rem\)\] {
3960
+ width: calc(100dvw - 2rem);
3961
+ }
3962
+
3955
3963
  .scalar-app .w-\[calc\(100vw-12px\)\] {
3956
3964
  width: calc(100vw - 12px);
3957
3965
  }
@@ -4052,6 +4060,10 @@ button.schema-card-title[data-v-86862f28]:hover {
4052
4060
  max-width: max-content;
4053
4061
  }
4054
4062
 
4063
+ .scalar-app .max-w-md {
4064
+ max-width: 448px;
4065
+ }
4066
+
4055
4067
  .scalar-app .max-w-screen-padded-4 {
4056
4068
  max-width: calc(100vw - 32px);
4057
4069
  }
@@ -6370,6 +6382,10 @@ button.schema-card-title[data-v-86862f28]:hover {
6370
6382
  font-family: inherit;
6371
6383
  }
6372
6384
 
6385
+ .scalar-app .backdrop\:bg-backdrop::backdrop {
6386
+ background-color: #00000038;
6387
+ }
6388
+
6373
6389
  .scalar-app .before\:hidden\!:before {
6374
6390
  content: var(--tw-content);
6375
6391
  display: none !important;
@@ -7037,7 +7053,13 @@ button.schema-card-title[data-v-86862f28]:hover {
7037
7053
  background-color: color-mix(in srgb, var(--scalar-background-1), var(--scalar-background-2));
7038
7054
  }
7039
7055
  }
7056
+ }
7040
7057
 
7058
+ .scalar-app .dark\:backdrop\:bg-backdrop-dark:where(.dark-mode, .dark-mode *)::backdrop {
7059
+ background-color: #00000073;
7060
+ }
7061
+
7062
+ @media (hover: hover) {
7041
7063
  .scalar-app .dark\:hover\:bg-b-2:where(.dark-mode, .dark-mode *):hover {
7042
7064
  background-color: var(--scalar-background-2);
7043
7065
  }
@@ -8220,21 +8242,21 @@ to {
8220
8242
  background: var(--scalar-background-2);
8221
8243
  }
8222
8244
 
8223
- [data-v-b5b0a654] .cm-editor {
8245
+ [data-v-7abeb15f] .cm-editor {
8224
8246
  height: 100%;
8225
8247
  outline: none;
8226
8248
  width: 100%;
8227
8249
  }
8228
- [data-v-b5b0a654] .cm-line {
8250
+ [data-v-7abeb15f] .cm-line {
8229
8251
  padding: 0;
8230
8252
  }
8231
- [data-v-b5b0a654] .cm-content {
8253
+ [data-v-7abeb15f] .cm-content {
8232
8254
  padding: 0;
8233
8255
  display: flex;
8234
8256
  align-items: center;
8235
8257
  font-size: var(--scalar-small);
8236
8258
  }
8237
- .scroll-timeline-x[data-v-b5b0a654] {
8259
+ .scroll-timeline-x[data-v-7abeb15f] {
8238
8260
  -ms-overflow-style: none;
8239
8261
  /* Fade the URL at the viewport edges. Mask lives on the scrollport (this
8240
8262
  element) rather than on `.cm-scroller`, whose width follows the URL's
@@ -8247,31 +8269,31 @@ to {
8247
8269
  transparent 100%
8248
8270
  );
8249
8271
  }
8250
- .scroll-timeline-x-hidden[data-v-b5b0a654] {
8272
+ .scroll-timeline-x-hidden[data-v-7abeb15f] {
8251
8273
  overflow-x: auto;
8252
8274
  }
8253
- .scroll-timeline-x-hidden[data-v-b5b0a654] .cm-scroller {
8275
+ .scroll-timeline-x-hidden[data-v-7abeb15f] .cm-scroller {
8254
8276
  scrollbar-width: none;
8255
8277
  -ms-overflow-style: none;
8256
8278
  padding-right: 20px;
8257
8279
  overflow: auto;
8258
8280
  }
8259
- .scroll-timeline-x-hidden[data-v-b5b0a654]::-webkit-scrollbar {
8281
+ .scroll-timeline-x-hidden[data-v-7abeb15f]::-webkit-scrollbar {
8260
8282
  width: 0;
8261
8283
  height: 0;
8262
8284
  display: none;
8263
8285
  }
8264
- .scroll-timeline-x-hidden[data-v-b5b0a654] .cm-scroller::-webkit-scrollbar {
8286
+ .scroll-timeline-x-hidden[data-v-7abeb15f] .cm-scroller::-webkit-scrollbar {
8265
8287
  width: 0;
8266
8288
  height: 0;
8267
8289
  display: none;
8268
8290
  }
8269
- .scroll-timeline-x-address[data-v-b5b0a654] {
8291
+ .scroll-timeline-x-address[data-v-7abeb15f] {
8270
8292
  line-height: 27px;
8271
8293
  scrollbar-width: none; /* Firefox */
8272
8294
  }
8273
8295
  /* make clickable are to left of send button */
8274
- .scroll-timeline-x-address[data-v-b5b0a654]:after {
8296
+ .scroll-timeline-x-address[data-v-7abeb15f]:after {
8275
8297
  content: '';
8276
8298
  position: absolute;
8277
8299
  height: 100%;
@@ -8279,7 +8301,7 @@ to {
8279
8301
  right: 0;
8280
8302
  cursor: text;
8281
8303
  }
8282
- .address-bar-bg-states[data-v-b5b0a654] {
8304
+ .address-bar-bg-states[data-v-7abeb15f] {
8283
8305
  --scalar-address-bar-bg: color-mix(
8284
8306
  in srgb,
8285
8307
  var(--scalar-background-1),
@@ -8287,14 +8309,14 @@ to {
8287
8309
  );
8288
8310
  background: var(--scalar-address-bar-bg);
8289
8311
  }
8290
- .address-bar-bg-states[data-v-b5b0a654]:has(.cm-focused) {
8312
+ .address-bar-bg-states[data-v-7abeb15f]:has(.cm-focused) {
8291
8313
  --scalar-address-bar-bg: var(--scalar-background-1);
8292
8314
  border-color: var(--scalar-border-color);
8293
8315
  outline-width: 1px;
8294
8316
  outline-style: solid;
8295
8317
  }
8296
- .address-bar-bg-states:has(.cm-focused) .fade-left[data-v-b5b0a654],
8297
- .address-bar-bg-states:has(.cm-focused) .fade-right[data-v-b5b0a654] {
8318
+ .address-bar-bg-states:has(.cm-focused) .fade-left[data-v-7abeb15f],
8319
+ .address-bar-bg-states:has(.cm-focused) .fade-right[data-v-7abeb15f] {
8298
8320
  --scalar-address-bar-bg: var(--scalar-background-1);
8299
8321
  }
8300
8322
 
@@ -81,7 +81,7 @@ var OperationBlock_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
81
81
  securityRequirements: {},
82
82
  defaultHeaders: {},
83
83
  requestBodyCompositionSelection: {},
84
- options: {}
84
+ options: { type: [Object, Function] }
85
85
  },
86
86
  emits: ["retry:externalExamples"],
87
87
  setup(__props) {
@@ -1 +1 @@
1
- {"version":3,"file":"AddressBar.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-address-bar-block/components/AddressBar.vue"],"names":[],"mappings":"AAowBA,OAAO,KAAK,EAEV,UAAU,EACV,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAqBhG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,OAA0B,EAAE,KAAK,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAGzE;;;;GAIG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAKzC,MAAM,MAAM,eAAe,GAAG;IAC5B,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,gEAAgE;IAChE,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,4BAA4B;IAC5B,YAAY,EAAE,MAAM,CAAA;IACpB,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAA;IAClB,gCAAgC;IAChC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,mDAAmD;IACnD,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,8BAA8B;IAC9B,OAAO,EAAE,OAAO,EAAE,CAAA;IAClB,oBAAoB;IACpB,MAAM,EAAE,YAAY,CAAA;IACpB,gBAAgB;IAChB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,kBAAkB;IAClB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,sCAAsC;IACtC,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AACD,QAAA,MAAM,YAAY;;;;;eAwB6B,MAAM;;;;;;;eAAN,MAAM;;;;;kFAihCjD,CAAC"}
1
+ {"version":3,"file":"AddressBar.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-address-bar-block/components/AddressBar.vue"],"names":[],"mappings":"AAywBA,OAAO,KAAK,EAEV,UAAU,EACV,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAqBhG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,OAA0B,EAAE,KAAK,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAGzE;;;;GAIG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAKzC,MAAM,MAAM,eAAe,GAAG;IAC5B,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,gEAAgE;IAChE,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,4BAA4B;IAC5B,YAAY,EAAE,MAAM,CAAA;IACpB,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAA;IAClB,gCAAgC;IAChC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,mDAAmD;IACnD,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,8BAA8B;IAC9B,OAAO,EAAE,OAAO,EAAE,CAAA;IAClB,oBAAoB;IACpB,MAAM,EAAE,YAAY,CAAA;IACpB,gBAAgB;IAChB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,kBAAkB;IAClB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,sCAAsC;IACtC,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AACD,QAAA,MAAM,YAAY;;;;;eAwB6B,MAAM;;;;;;;eAAN,MAAM;;;;;kFAohCjD,CAAC"}
@@ -2,7 +2,7 @@ import AddressBar_vue_vue_type_script_setup_true_lang_default from "./AddressBar
2
2
  /* empty css */
3
3
  import _plugin_vue_export_helper_default from "../../../../_virtual/_plugin-vue_export-helper.js";
4
4
  // src/v2/blocks/scalar-address-bar-block/components/AddressBar.vue
5
- var AddressBar_default = /*#__PURE__*/ _plugin_vue_export_helper_default(AddressBar_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-b5b0a654"]]);
5
+ var AddressBar_default = /*#__PURE__*/ _plugin_vue_export_helper_default(AddressBar_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-7abeb15f"]]);
6
6
  export { AddressBar_default as default };
7
7
 
8
8
  //# sourceMappingURL=AddressBar.vue.js.map
@@ -17,6 +17,7 @@ import { EditorView } from "@scalar/use-codemirror";
17
17
  import { ScalarTooltip } from "@scalar/components/tooltip";
18
18
  import { getSelector } from "@scalar/helpers/dom/get-selector";
19
19
  import { extractServerFromPath } from "@scalar/helpers/url/extract-server-from-path";
20
+ import { useDocumentRoot } from "@scalar/use-hooks/useDocumentRoot";
20
21
  // src/v2/blocks/scalar-address-bar-block/components/AddressBar.vue?vue&type=script&setup=true&lang.ts
21
22
  var _hoisted_1 = { class: "order-last flex h-auto w-full max-w-3xl grow-3 flex-wrap items-stretch [--scalar-address-bar-height:32px] @3xl:order-0 @3xl:flex-nowrap" };
22
23
  var _hoisted_2 = ["id"];
@@ -76,6 +77,8 @@ var AddressBar_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
76
77
  setup(__props, { expose: __expose, emit: __emit }) {
77
78
  const emit = __emit;
78
79
  const { translate } = useLocalization();
80
+ /** Where the blur target is looked up again, the shadow root when the client is embedded in one */
81
+ const documentRoot = useDocumentRoot();
79
82
  const id = useId();
80
83
  const sendButtonRef = useTemplateRef("sendButtonRef");
81
84
  const mobileSendButtonRef = useTemplateRef("mobileSendButtonRef");
@@ -167,7 +170,7 @@ var AddressBar_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
167
170
  emit("update:webhook-url", webhookUrl);
168
171
  methodConflict.value = null;
169
172
  pathConflict.value = null;
170
- nextTick(() => refocusBlurTarget(blurTargetSelector));
173
+ nextTick(() => refocusBlurTarget(blurTargetSelector, documentRoot));
171
174
  return;
172
175
  }
173
176
  const extractedPath = extractAndSelectServer(targetPath);
@@ -194,7 +197,7 @@ var AddressBar_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
194
197
  }
195
198
  const mirrorContent = addressBarRef.value?.codeMirrorRef?.textContent;
196
199
  if (status === "no-change" && mirrorContent && mirrorContent !== extractedPath) addressBarRef.value?.setCodeMirrorContent(extractedPath);
197
- nextTick(() => refocusBlurTarget(returnedSelector));
200
+ nextTick(() => refocusBlurTarget(returnedSelector, documentRoot));
198
201
  }
199
202
  });
200
203
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AddressBar.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_createElementVNode","_unref","_normalizeClass","_normalizeStyle","_createVNode","HttpMethod","_createBlock","ServerDropdown","CodeInput","_withKeys","_withCtx","_toDisplayString","AddressBarHistory"],"sources":["../../../../../src/v2/blocks/scalar-address-bar-block/components/AddressBar.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * AddressBar component\n * This component is used to display the address bar for the operation block\n * It is used to display the path, method, server, and history for the operation\n */\nexport default {\n name: 'AddressBar',\n}\nexport type AddressBarProps = {\n /** An external example must finish loading before sending. */\n executionDisabled?: boolean\n /** Current request path */\n path: string\n /** Current request method */\n method: string\n /** Whether the request target belongs to an OpenAPI webhook. */\n isWebhook?: boolean\n /** Openapi document slug */\n documentSlug: string\n /** Currently selected example key for the current operation */\n exampleKey: string\n /** Currently selected server */\n server: ServerObject | null\n /** Server list available for operation/document */\n servers: ServerObject[]\n /** List of request history */\n history: History[]\n /** Client layout */\n layout: ClientLayout\n /** Event bus */\n eventBus: WorkspaceEventBus\n /** Environment */\n environment: XScalarEnvironment\n /** Meta information for the server */\n serverMeta: ServerMeta\n}\n</script>\n<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { ScalarTooltip } from '@scalar/components/tooltip'\nimport { getSelector } from '@scalar/helpers/dom/get-selector'\nimport { getHttpMethodInfo } from '@scalar/helpers/http/http-info'\nimport { extractServerFromPath } from '@scalar/helpers/url/extract-server-from-path'\nimport {\n ScalarIconArrowSquareOut,\n ScalarIconCopy,\n ScalarIconWarningCircle,\n} from '@scalar/icons'\nimport { EditorView } from '@scalar/use-codemirror'\nimport type {\n ApiReferenceEvents,\n ServerMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport {\n computed,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useId,\n useTemplateRef,\n watch,\n} from 'vue'\n\nimport { HttpMethod } from '@/components/HttpMethod'\nimport { getOperationExampleKey } from '@/v2/blocks/operation-block/helpers/response-cache'\nimport { isPlaceholderPath } from '@/v2/blocks/scalar-address-bar-block/helpers/is-placeholder-path'\nimport { refocusBlurTarget } from '@/v2/blocks/scalar-address-bar-block/helpers/refocus-blur-target'\nimport { useLoadingAnimation } from '@/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation'\nimport { usePathMasking } from '@/v2/blocks/scalar-address-bar-block/hooks/use-path-masking'\nimport { CodeInput } from '@/v2/components/code-input'\nimport { ServerDropdown } from '@/v2/components/server'\nimport { useLocalization } from '@/v2/features/localization'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport AddressBarHistory, { type History } from './AddressBarHistory.vue'\n\nconst {\n path,\n method,\n layout,\n eventBus,\n exampleKey,\n documentSlug,\n server,\n servers,\n environment,\n serverMeta,\n isWebhook = false,\n executionDisabled = false,\n} = defineProps<AddressBarProps>()\n\nconst emit = defineEmits<{\n /** Open the GET destination using browser navigation. */\n (e: 'open:browser'): void\n /** Execute the current operation example */\n (e: 'execute'): void\n /** Select a request history item by index */\n (e: 'select:history:item', payload: { index: number }): void\n /** Update the full destination URL used to deliver a webhook. */\n (e: 'update:webhook-url', url: string): void\n}>()\n\nconst { translate } = useLocalization()\n\n// ───────────────────────────────────────────────────────────────────\n// Template refs & reactive state\n// ───────────────────────────────────────────────────────────────────\n\nconst id = useId()\nconst sendButtonRef = useTemplateRef('sendButtonRef')\nconst mobileSendButtonRef = useTemplateRef('mobileSendButtonRef')\nconst addressBarRef = useTemplateRef('addressBarRef')\n\nconst { percentage, startLoading, stopLoading, isLoading } =\n useLoadingAnimation()\n\nconst pathConflict = ref<string | null>(null)\nconst methodConflict = ref<string | null>(null)\nconst tabbedOut = ref(false)\nconst isServerDropdownOpen = ref(false)\nconst isHistoryDropdownOpen = ref(false)\n\n// ───────────────────────────────────────────────────────────────────\n// Derived state\n// ───────────────────────────────────────────────────────────────────\n\n/** Keeps the cursor visible past the fade-right overlay while typing */\nconst addressBarScrollMargins = EditorView.scrollMargins.of(() => ({\n right: 24,\n}))\n\n/** Animated background transform for the loading indicator */\nconst style = computed(() => ({\n backgroundColor: `color-mix(in srgb, transparent 90%, ${getHttpMethodInfo(method).colorVar})`,\n transform: `translate3d(-${percentage.value}%,0,0)`,\n}))\n\n/** Whether there is a path or method conflict */\nconst hasConflict = computed(() => methodConflict.value || pathConflict.value)\n\n/**\n * Placeholder for the path field.\n *\n * Webhooks have no server to prefix the path, so the field doubles as the full\n * destination URL. Hint that a complete URL (including the host) is expected,\n * rather than a bare path.\n */\nconst pathPlaceholder = computed(() => {\n if (server) {\n return ''\n }\n return isWebhook\n ? translate('apiClient.addressBar.webhookUrlPlaceholder')\n : translate('apiClient.addressBar.urlPlaceholder')\n})\n\n/** Whether either dropdown (server or history) is open */\nconst isDropdownOpen = computed(\n () => isServerDropdownOpen.value || isHistoryDropdownOpen.value,\n)\n\n/** Uniquely identifies the currently selected operation + example */\nconst uniqueKey = computed(() =>\n getOperationExampleKey(method, path, exampleKey, documentSlug),\n)\n\n/** Clear conflict state when switching to a different operation */\nwatch(uniqueKey, () => {\n pathConflict.value = null\n methodConflict.value = null\n})\n\n// ───────────────────────────────────────────────────────────────────\n// Focus helpers\n// ───────────────────────────────────────────────────────────────────\n\nconst handleFocusSendButton = (): void => {\n const desktop = sendButtonRef.value?.$el\n const mobile = mobileSendButtonRef.value?.$el\n\n // Focus whichever send button is currently visible\n if (desktop && desktop.offsetParent !== null) {\n desktop.focus()\n } else {\n mobile?.focus()\n }\n}\n\nconst handleFocusAddressBar = (\n payload: ApiReferenceEvents['ui:focus:address-bar'],\n): void => {\n // On non-desktop layouts, if already focused we let the browser handle the\n // native behavior (e.g. selecting the browser's own address bar).\n if (addressBarRef.value?.isFocused && layout !== 'desktop') {\n return\n }\n\n addressBarRef.value?.focus('end')\n\n if (payload && 'clear' in payload && payload.clear) {\n addressBarRef.value?.setCodeMirrorContent('')\n }\n\n if (payload && 'event' in payload) {\n payload.event.preventDefault()\n }\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Path masking\n//\n// Drafts on `/` and auto-generated `/_scalar_temp...` paths are internal\n// placeholders — the address bar focuses and clears on mount and on\n// navigation so the user sees a blank prompt instead of the internal\n// path. The deferred mask only clears when CodeMirror still contains that\n// placeholder path, so a user edit that lands before the frame is preserved.\n// ───────────────────────────────────────────────────────────────────\n\nusePathMasking({\n isReady: () => addressBarRef.value?.codeMirror,\n operationKey: () => uniqueKey.value,\n shouldMask: () => isPlaceholderPath(path, documentSlug),\n // Defer to the next frame so focus() runs after click-handler side\n // effects that move focus (e.g. a dropdown refocusing its trigger),\n // which would otherwise blur our input and emit a spurious path\n // update against the now-empty value.\n onMask: () =>\n requestAnimationFrame(() => {\n const editorContent =\n addressBarRef.value?.codeMirror?.state.doc.toString()\n\n if (editorContent && editorContent !== path) {\n return\n }\n\n handleFocusAddressBar({ clear: true })\n }),\n})\n\n// ───────────────────────────────────────────────────────────────────\n// Server extraction\n// ───────────────────────────────────────────────────────────────────\n\n/** If the path contains a server URL, extract it and select or add that server */\nconst extractAndSelectServer = (targetPath: string): string => {\n const extracted = extractServerFromPath(targetPath)\n if (!extracted) {\n return targetPath\n }\n\n const [url, remainingPath] = extracted\n\n // Server is already selected — nothing to do\n if (url === server?.url) {\n return remainingPath\n }\n\n const matchingServer = servers.find((s) => s.url === url)\n if (matchingServer) {\n eventBus.emit('server:update:selected', { url, meta: serverMeta })\n } else {\n eventBus.emit('server:add:server', {\n url,\n select: true,\n meta: { type: 'operation', path, method },\n })\n }\n\n return remainingPath\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Path / method updates\n// ───────────────────────────────────────────────────────────────────\n\nconst normalizePath = (value: string): string =>\n value.startsWith('/') ? value : `/${value}`\n\n/** Emit a path/method update and reconcile conflicts + cursor state on the result */\nconst emitPathMethodUpdate = (\n targetMethod: string,\n targetPath: string,\n blurTargetSelector: string | null = null,\n): void => {\n if (isWebhook) {\n // A webhook has no OpenAPI server, so the field holds the full destination\n // URL. Keep exactly what the user entered — do not split it into an invisible\n // server plus a leftover path, and do not force a leading slash. That split\n // is what made a typed URL collapse to a stray \"/\" on blur.\n const webhookUrl = targetPath.trim()\n addressBarRef.value?.setCodeMirrorContent(webhookUrl)\n emit('update:webhook-url', webhookUrl)\n methodConflict.value = null\n pathConflict.value = null\n nextTick(() => refocusBlurTarget(blurTargetSelector))\n return\n }\n\n const extractedPath = extractAndSelectServer(targetPath)\n const normalizedPath = normalizePath(extractedPath)\n\n // Keep CodeMirror in sync so a conflict does not leave a stale value on screen\n addressBarRef.value?.setCodeMirrorContent(normalizedPath)\n\n eventBus.emit('operation:update:pathMethod', {\n meta: { method, path },\n blurTargetSelector,\n payload: { method: targetMethod, path: normalizedPath },\n callback: (status, returnedSelector) => {\n if (status === 'success' || status === 'no-change') {\n methodConflict.value = null\n pathConflict.value = null\n } else if (status === 'conflict') {\n if (targetMethod !== method) {\n methodConflict.value = targetMethod\n }\n if (normalizedPath !== path) {\n pathConflict.value = normalizedPath\n }\n\n return\n }\n\n // Edge case: pasting a full URL extracts the server but leaves the path\n // unchanged. CodeMirror still shows the full URL, so force it back to\n // just the path.\n const mirrorContent = addressBarRef.value?.codeMirrorRef?.textContent\n if (\n status === 'no-change' &&\n mirrorContent &&\n mirrorContent !== extractedPath\n ) {\n addressBarRef.value?.setCodeMirrorContent(extractedPath)\n }\n\n nextTick(() => refocusBlurTarget(returnedSelector))\n },\n })\n}\n\n/** Change the operation's method, preferring the conflicting path if present */\nconst handleMethodChange = (newMethod: string): void =>\n emitPathMethodUpdate(newMethod, pathConflict.value ?? path)\n\n/**\n * Save the path on blur and replay the click that caused the blur (so e.g. a\n * click on the Send button still fires after the async update resolves).\n *\n * Tab-outs do not replay — tabbing to a button should not trigger its click\n * (`tabbedOut` is set on `@keydown.tab`).\n *\n * Programmatic focus moves also do not replay. On first navigation into a\n * draft operation, `usePathMasking` focuses and clears the address bar while\n * `ScalarSidebarNestedItems` focuses the drilled-in Back button in\n * `nextTick`. That steals focus from CodeMirror, fires blur with a\n * `relatedTarget` (the Back button), and without a guard we would treat it\n * like a user click: capture the selector, then `refocusBlurTarget` would\n * synthesize `.click()` on Back and navigate away.\n *\n * `FocusEvent.sourceCapabilities` is null when no input device caused the\n * focus change (e.g. `element.focus()`). A real pointer click sets it on the\n * blur that precedes the click, so we still replay Send and other buttons.\n */\nconst handlePathBlur = (newPath: string, event: FocusEvent): void => {\n const relatedTarget =\n event.relatedTarget instanceof Element ? event.relatedTarget : null\n const blurTargetSelector =\n tabbedOut.value ||\n ('sourceCapabilities' in event && event.sourceCapabilities === null)\n ? null\n : getSelector(relatedTarget)\n tabbedOut.value = false\n\n emitPathMethodUpdate(\n methodConflict.value ?? method,\n newPath,\n blurTargetSelector,\n )\n}\n\n/** Save the path on Enter and trigger the Send button after the update resolves */\nconst handlePathSubmit = (\n newPath: string,\n event: KeyboardEvent | FocusEvent,\n): void => {\n // Prevent the global hotkey listener from also handling this Enter press\n event.stopPropagation()\n\n emitPathMethodUpdate(\n methodConflict.value ?? method,\n newPath,\n '[data-addressbar-action=\"send\"]',\n )\n}\n\n/** Unset the server when backspace is pressed on an empty path */\nconst handlePathBackspace = (event: KeyboardEvent): void => {\n if (event.target instanceof HTMLElement && event.target.innerText === '\\n') {\n // A webhook has no server to unset; its full URL lives in the field itself.\n if (isWebhook) {\n return\n }\n eventBus.emit('server:update:selected', { url: '', meta: serverMeta })\n }\n}\n\nconst handleServerSelect = (\n payload: ApiReferenceEvents['server:update:selected'],\n): void => {\n eventBus.emit('server:update:selected', payload)\n}\n\nconst handleServerVariable = (\n payload: ApiReferenceEvents['server:update:variables'],\n): void => {\n eventBus.emit('server:update:variables', payload)\n}\n\nconst isGetRequest = computed(() => method.toLowerCase() === 'get')\nconst isOpenInBrowserDisabled = computed(\n () => executionDisabled || !!hasConflict.value,\n)\n\nconst requestOpenInBrowser = (): void => {\n if (isOpenInBrowserDisabled.value) return\n emit('open:browser')\n}\n\n/** Address bar copy is handled in OperationBlock (same URL as Send). */\nconst requestCopyUrl = (): void => {\n eventBus.emit('copy-url:address-bar')\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Navigation\n// ───────────────────────────────────────────────────────────────────\n\nconst navigateToServersPage = (): void => {\n if (serverMeta.type === 'operation') {\n eventBus.emit('ui:navigate', {\n page: 'operation',\n path: 'servers',\n operationPath: serverMeta.path,\n method: serverMeta.method,\n })\n return\n }\n\n eventBus.emit('ui:navigate', { page: 'document', path: 'servers' })\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Lifecycle\n// ───────────────────────────────────────────────────────────────────\n\nconst unsubscribes: Array<() => void> = []\n\nonMounted(() => {\n unsubscribes.push(\n eventBus.on('ui:focus:address-bar', handleFocusAddressBar),\n eventBus.on('ui:focus:send-button', handleFocusSendButton),\n eventBus.on('hooks:on:request:sent', startLoading),\n eventBus.on('hooks:on:request:complete', stopLoading),\n )\n})\n\nonBeforeUnmount(() => {\n for (const unsubscribe of unsubscribes) {\n unsubscribe()\n }\n\n // Prevents the loading animation from continuing after unmount\n stopLoading()\n})\n\ndefineExpose({\n methodConflict,\n pathConflict,\n})\n</script>\n<template>\n <!--\n Address bar.\n\n The wide-container layout is a single row:\n `[Method | URL | Copy | History | Send]`. When the surrounding\n `@container` drops below `@3xl` only the send button moves to a\n second row, where it spans the full width. The method and copy\n controls stay inside the bar at every width so they keep belonging\n to the URL they act on rather than floating beside it.\n -->\n <div\n class=\"order-last flex h-auto w-full max-w-3xl grow-3 flex-wrap items-stretch [--scalar-address-bar-height:32px] @3xl:order-0 @3xl:flex-nowrap\">\n <!-- Address Bar -->\n <div\n :id=\"id\"\n class=\"address-bar-bg-states text-xxs group relative flex h-(--scalar-address-bar-height) w-full flex-1 flex-row items-stretch rounded-lg p-0.75\"\n :class=\"{\n 'outline-c-danger outline': hasConflict,\n 'rounded-b-none': isDropdownOpen,\n }\">\n <div\n class=\"pointer-events-none absolute top-0 left-0 block h-full w-full overflow-hidden rounded-lg border\"\n :class=\"{\n 'rounded-b-none': isDropdownOpen,\n }\">\n <div\n class=\"absolute top-0 left-0 h-full w-full\"\n :style />\n </div>\n\n <!-- Only Send leaves the bar below `@3xl`; see the trailing row. -->\n <div class=\"flex\">\n <HttpMethod\n :isEditable=\"layout !== 'modal' && !isWebhook\"\n isSquare\n :method=\"methodConflict ?? method\"\n teleport\n @change=\"handleMethodChange\" />\n </div>\n\n <div\n class=\"scroll-timeline-x scroll-timeline-x-hidden relative flex w-full bg-blend-normal\"\n dir=\"ltr\">\n <!-- Servers -->\n <ServerDropdown\n v-if=\"servers.length\"\n :layout=\"isWebhook ? 'modal' : layout\"\n :meta=\"serverMeta\"\n :server=\"server\"\n :servers=\"servers\"\n :target=\"id\"\n @update:open=\"(value) => (isServerDropdownOpen = value)\"\n @update:selectedServer=\"handleServerSelect\"\n @update:servers=\"navigateToServersPage\"\n @update:variable=\"handleServerVariable\" />\n\n <!-- Path + URL + env vars -->\n <CodeInput\n ref=\"addressBarRef\"\n alwaysEmitChange\n :aria-label=\"translate('apiClient.addressBar.path')\"\n class=\"ml-1 min-w-fit pl-px outline-none\"\n disableCloseBrackets\n :disabled=\"layout === 'modal' && !isWebhook\"\n disableEnter\n disableTabIndent\n :emitOnBlur=\"false\"\n :environment=\"environment\"\n :extensions=\"[addressBarScrollMargins]\"\n importCurl\n :layout=\"layout\"\n :modelValue=\"path\"\n :placeholder=\"pathPlaceholder\"\n server\n @blur=\"handlePathBlur\"\n @keydown.delete=\"handlePathBackspace\"\n @keydown.tab=\"tabbedOut = true\"\n @submit=\"handlePathSubmit\" />\n </div>\n\n <!-- Copy url button -->\n <ScalarButton\n class=\"hover:bg-b-3 mx-1 flex\"\n size=\"xs\"\n variant=\"ghost\"\n @click=\"requestCopyUrl\">\n <ScalarIconCopy />\n <span class=\"sr-only\">{{\n translate('apiClient.addressBar.copyUrl')\n }}</span>\n </ScalarButton>\n\n <ScalarTooltip\n v-if=\"isGetRequest\"\n :content=\"translate('apiClient.addressBar.openInBrowserHint')\">\n <ScalarButton\n :aria-label=\"translate('apiClient.addressBar.openInBrowser')\"\n class=\"hover:bg-b-3 mr-1 flex\"\n :disabled=\"isOpenInBrowserDisabled\"\n size=\"xs\"\n variant=\"ghost\"\n @click=\"requestOpenInBrowser\">\n <ScalarIconArrowSquareOut />\n </ScalarButton>\n </ScalarTooltip>\n\n <AddressBarHistory\n :history=\"history\"\n :target=\"id\"\n @select:history:item=\"(payload) => emit('select:history:item', payload)\"\n @update:open=\"(value) => (isHistoryDropdownOpen = value)\" />\n <!-- Error message -->\n <div\n v-if=\"hasConflict\"\n class=\"z-context absolute inset-x-0 top-[calc(100%+4px)] flex flex-col items-center rounded px-6\">\n <div\n class=\"text-c-danger bg-b-danger border-c-danger flex items-center gap-1 rounded border p-1\">\n <ScalarIconWarningCircle size=\"sm\" />\n <div class=\"min-w-0 flex-1\">\n {{\n translate('apiClient.addressBar.duplicateRequest', {\n method: (methodConflict ?? method).toUpperCase(),\n path: pathConflict ?? path,\n })\n }}\n </div>\n </div>\n </div>\n\n <ScalarButton\n ref=\"sendButtonRef\"\n class=\"relative hidden h-auto shrink-0 overflow-hidden py-1 pr-2.5 pl-2 font-bold @3xl:flex\"\n data-addressbar-action=\"send\"\n :disabled=\"isLoading || executionDisabled\"\n @click=\"emit('execute')\">\n <span\n aria-hidden=\"true\"\n class=\"inline-flex items-center gap-1\">\n <ScalarIcon\n class=\"relative shrink-0 fill-current\"\n icon=\"Play\"\n size=\"xs\" />\n <span class=\"text-xxs flex\">{{\n translate('apiClient.addressBar.send')\n }}</span>\n </span>\n <span class=\"sr-only\"\n >{{\n translate('apiClient.addressBar.sendRequest', {\n method,\n url: `${server?.url ?? ''}${path}`,\n })\n }}\n </span>\n </ScalarButton>\n </div>\n\n <!--\n Below `@3xl` the send button moves out of the bar onto its own row\n and spans the full width, so the primary action stays easy to hit\n once the container is too narrow to hold it beside the URL.\n -->\n <ScalarButton\n ref=\"mobileSendButtonRef\"\n class=\"relative mt-2 h-(--scalar-address-bar-height) w-full shrink-0 justify-center overflow-hidden py-1 font-bold @3xl:hidden\"\n data-addressbar-action=\"send\"\n :disabled=\"isLoading || executionDisabled\"\n @click=\"emit('execute')\">\n <span\n aria-hidden=\"true\"\n class=\"inline-flex items-center gap-1\">\n <ScalarIcon\n class=\"relative shrink-0 fill-current\"\n icon=\"Play\"\n size=\"xs\" />\n <span class=\"text-xxs\">{{\n translate('apiClient.addressBar.send')\n }}</span>\n </span>\n <span class=\"sr-only\"\n >{{\n translate('apiClient.addressBar.sendRequest', {\n method,\n url: `${server?.url ?? ''}${path}`,\n })\n }}\n </span>\n </ScalarButton>\n </div>\n</template>\n<style scoped>\n:deep(.cm-editor) {\n height: 100%;\n outline: none;\n width: 100%;\n}\n:deep(.cm-line) {\n padding: 0;\n}\n:deep(.cm-content) {\n padding: 0;\n display: flex;\n align-items: center;\n font-size: var(--scalar-small);\n}\n.scroll-timeline-x {\n -ms-overflow-style: none;\n /* Fade the URL at the viewport edges. Mask lives on the scrollport (this\n element) rather than on `.cm-scroller`, whose width follows the URL's\n full content and pushes the right edge off-screen when overflowing. */\n mask-image: linear-gradient(\n to right,\n transparent 0,\n black 6px,\n black calc(100% - 24px),\n transparent 100%\n );\n}\n.scroll-timeline-x-hidden {\n overflow-x: auto;\n}\n.scroll-timeline-x-hidden :deep(.cm-scroller) {\n scrollbar-width: none;\n -ms-overflow-style: none;\n padding-right: 20px;\n overflow: auto;\n}\n.scroll-timeline-x-hidden::-webkit-scrollbar {\n width: 0;\n height: 0;\n display: none;\n}\n.scroll-timeline-x-hidden :deep(.cm-scroller::-webkit-scrollbar) {\n width: 0;\n height: 0;\n display: none;\n}\n.scroll-timeline-x-address {\n line-height: 27px;\n scrollbar-width: none; /* Firefox */\n}\n/* make clickable are to left of send button */\n.scroll-timeline-x-address:after {\n content: '';\n position: absolute;\n height: 100%;\n width: 24px;\n right: 0;\n cursor: text;\n}\n\n.address-bar-bg-states {\n --scalar-address-bar-bg: color-mix(\n in srgb,\n var(--scalar-background-1),\n var(--scalar-background-2)\n );\n background: var(--scalar-address-bar-bg);\n}\n.address-bar-bg-states:has(.cm-focused) {\n --scalar-address-bar-bg: var(--scalar-background-1);\n border-color: var(--scalar-border-color);\n outline-width: 1px;\n outline-style: solid;\n}\n.address-bar-bg-states:has(.cm-focused) .fade-left,\n.address-bar-bg-states:has(.cm-focused) .fade-right {\n --scalar-address-bar-bg: var(--scalar-background-1);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0FR,MAAM,OAAO;EAWb,MAAM,EAAE,cAAc,gBAAgB;EAMtC,MAAM,KAAK,MAAM;EACjB,MAAM,gBAAgB,eAAe,eAAe;EACpD,MAAM,sBAAsB,eAAe,qBAAqB;EACh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G,KAAS,QAAA;;;;G,oBAcxHG,YAyBeH,MAAA,YAAA,GAAA;IAxBT,SAAA;IAAJ,KAAI;IACJ,OAAM;IACN,0BAAuB;IACtB,UAAUA,MAAA,SAAA,KAAa,QAAA;IACvB,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,KAAI,SAAA;;IACZ,SAAAS,cAUO,CAVPV,mBAUO,QAVP,aAUO,CAPLI,YAGcH,MAAA,UAAA,GAAA;KAFZ,OAAM;KACN,MAAK;KACL,MAAK;I,IACPD,mBAES,QAFT,aAESW,gBADPV,MAAA,SAAA,CAAS,CAAA,2BAAA,CAAA,GAAA,CAAA,C,IAGbD,mBAOO,QAPP,aAOOW,gBALHV,MAAA,SAAA,CAAS,CAAA,oCAAA;KAAmD,QAAA,QAAA;KAA4B,KAAA,GAAA,QAAA,QAAQ,OAAG,KAAS,QAAA"}
1
+ {"version":3,"file":"AddressBar.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_createElementVNode","_unref","_normalizeClass","_normalizeStyle","_createVNode","HttpMethod","_createBlock","ServerDropdown","CodeInput","_withKeys","_withCtx","_toDisplayString","AddressBarHistory"],"sources":["../../../../../src/v2/blocks/scalar-address-bar-block/components/AddressBar.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * AddressBar component\n * This component is used to display the address bar for the operation block\n * It is used to display the path, method, server, and history for the operation\n */\nexport default {\n name: 'AddressBar',\n}\nexport type AddressBarProps = {\n /** An external example must finish loading before sending. */\n executionDisabled?: boolean\n /** Current request path */\n path: string\n /** Current request method */\n method: string\n /** Whether the request target belongs to an OpenAPI webhook. */\n isWebhook?: boolean\n /** Openapi document slug */\n documentSlug: string\n /** Currently selected example key for the current operation */\n exampleKey: string\n /** Currently selected server */\n server: ServerObject | null\n /** Server list available for operation/document */\n servers: ServerObject[]\n /** List of request history */\n history: History[]\n /** Client layout */\n layout: ClientLayout\n /** Event bus */\n eventBus: WorkspaceEventBus\n /** Environment */\n environment: XScalarEnvironment\n /** Meta information for the server */\n serverMeta: ServerMeta\n}\n</script>\n<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { ScalarTooltip } from '@scalar/components/tooltip'\nimport { getSelector } from '@scalar/helpers/dom/get-selector'\nimport { getHttpMethodInfo } from '@scalar/helpers/http/http-info'\nimport { extractServerFromPath } from '@scalar/helpers/url/extract-server-from-path'\nimport {\n ScalarIconArrowSquareOut,\n ScalarIconCopy,\n ScalarIconWarningCircle,\n} from '@scalar/icons'\nimport { EditorView } from '@scalar/use-codemirror'\nimport { useDocumentRoot } from '@scalar/use-hooks/useDocumentRoot'\nimport type {\n ApiReferenceEvents,\n ServerMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport {\n computed,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useId,\n useTemplateRef,\n watch,\n} from 'vue'\n\nimport { HttpMethod } from '@/components/HttpMethod'\nimport { getOperationExampleKey } from '@/v2/blocks/operation-block/helpers/response-cache'\nimport { isPlaceholderPath } from '@/v2/blocks/scalar-address-bar-block/helpers/is-placeholder-path'\nimport { refocusBlurTarget } from '@/v2/blocks/scalar-address-bar-block/helpers/refocus-blur-target'\nimport { useLoadingAnimation } from '@/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation'\nimport { usePathMasking } from '@/v2/blocks/scalar-address-bar-block/hooks/use-path-masking'\nimport { CodeInput } from '@/v2/components/code-input'\nimport { ServerDropdown } from '@/v2/components/server'\nimport { useLocalization } from '@/v2/features/localization'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport AddressBarHistory, { type History } from './AddressBarHistory.vue'\n\nconst {\n path,\n method,\n layout,\n eventBus,\n exampleKey,\n documentSlug,\n server,\n servers,\n environment,\n serverMeta,\n isWebhook = false,\n executionDisabled = false,\n} = defineProps<AddressBarProps>()\n\nconst emit = defineEmits<{\n /** Open the GET destination using browser navigation. */\n (e: 'open:browser'): void\n /** Execute the current operation example */\n (e: 'execute'): void\n /** Select a request history item by index */\n (e: 'select:history:item', payload: { index: number }): void\n /** Update the full destination URL used to deliver a webhook. */\n (e: 'update:webhook-url', url: string): void\n}>()\n\nconst { translate } = useLocalization()\n\n/** Where the blur target is looked up again, the shadow root when the client is embedded in one */\nconst documentRoot = useDocumentRoot()\n\n// ───────────────────────────────────────────────────────────────────\n// Template refs & reactive state\n// ───────────────────────────────────────────────────────────────────\n\nconst id = useId()\nconst sendButtonRef = useTemplateRef('sendButtonRef')\nconst mobileSendButtonRef = useTemplateRef('mobileSendButtonRef')\nconst addressBarRef = useTemplateRef('addressBarRef')\n\nconst { percentage, startLoading, stopLoading, isLoading } =\n useLoadingAnimation()\n\nconst pathConflict = ref<string | null>(null)\nconst methodConflict = ref<string | null>(null)\nconst tabbedOut = ref(false)\nconst isServerDropdownOpen = ref(false)\nconst isHistoryDropdownOpen = ref(false)\n\n// ───────────────────────────────────────────────────────────────────\n// Derived state\n// ───────────────────────────────────────────────────────────────────\n\n/** Keeps the cursor visible past the fade-right overlay while typing */\nconst addressBarScrollMargins = EditorView.scrollMargins.of(() => ({\n right: 24,\n}))\n\n/** Animated background transform for the loading indicator */\nconst style = computed(() => ({\n backgroundColor: `color-mix(in srgb, transparent 90%, ${getHttpMethodInfo(method).colorVar})`,\n transform: `translate3d(-${percentage.value}%,0,0)`,\n}))\n\n/** Whether there is a path or method conflict */\nconst hasConflict = computed(() => methodConflict.value || pathConflict.value)\n\n/**\n * Placeholder for the path field.\n *\n * Webhooks have no server to prefix the path, so the field doubles as the full\n * destination URL. Hint that a complete URL (including the host) is expected,\n * rather than a bare path.\n */\nconst pathPlaceholder = computed(() => {\n if (server) {\n return ''\n }\n return isWebhook\n ? translate('apiClient.addressBar.webhookUrlPlaceholder')\n : translate('apiClient.addressBar.urlPlaceholder')\n})\n\n/** Whether either dropdown (server or history) is open */\nconst isDropdownOpen = computed(\n () => isServerDropdownOpen.value || isHistoryDropdownOpen.value,\n)\n\n/** Uniquely identifies the currently selected operation + example */\nconst uniqueKey = computed(() =>\n getOperationExampleKey(method, path, exampleKey, documentSlug),\n)\n\n/** Clear conflict state when switching to a different operation */\nwatch(uniqueKey, () => {\n pathConflict.value = null\n methodConflict.value = null\n})\n\n// ───────────────────────────────────────────────────────────────────\n// Focus helpers\n// ───────────────────────────────────────────────────────────────────\n\nconst handleFocusSendButton = (): void => {\n const desktop = sendButtonRef.value?.$el\n const mobile = mobileSendButtonRef.value?.$el\n\n // Focus whichever send button is currently visible\n if (desktop && desktop.offsetParent !== null) {\n desktop.focus()\n } else {\n mobile?.focus()\n }\n}\n\nconst handleFocusAddressBar = (\n payload: ApiReferenceEvents['ui:focus:address-bar'],\n): void => {\n // On non-desktop layouts, if already focused we let the browser handle the\n // native behavior (e.g. selecting the browser's own address bar).\n if (addressBarRef.value?.isFocused && layout !== 'desktop') {\n return\n }\n\n addressBarRef.value?.focus('end')\n\n if (payload && 'clear' in payload && payload.clear) {\n addressBarRef.value?.setCodeMirrorContent('')\n }\n\n if (payload && 'event' in payload) {\n payload.event.preventDefault()\n }\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Path masking\n//\n// Drafts on `/` and auto-generated `/_scalar_temp...` paths are internal\n// placeholders — the address bar focuses and clears on mount and on\n// navigation so the user sees a blank prompt instead of the internal\n// path. The deferred mask only clears when CodeMirror still contains that\n// placeholder path, so a user edit that lands before the frame is preserved.\n// ───────────────────────────────────────────────────────────────────\n\nusePathMasking({\n isReady: () => addressBarRef.value?.codeMirror,\n operationKey: () => uniqueKey.value,\n shouldMask: () => isPlaceholderPath(path, documentSlug),\n // Defer to the next frame so focus() runs after click-handler side\n // effects that move focus (e.g. a dropdown refocusing its trigger),\n // which would otherwise blur our input and emit a spurious path\n // update against the now-empty value.\n onMask: () =>\n requestAnimationFrame(() => {\n const editorContent =\n addressBarRef.value?.codeMirror?.state.doc.toString()\n\n if (editorContent && editorContent !== path) {\n return\n }\n\n handleFocusAddressBar({ clear: true })\n }),\n})\n\n// ───────────────────────────────────────────────────────────────────\n// Server extraction\n// ───────────────────────────────────────────────────────────────────\n\n/** If the path contains a server URL, extract it and select or add that server */\nconst extractAndSelectServer = (targetPath: string): string => {\n const extracted = extractServerFromPath(targetPath)\n if (!extracted) {\n return targetPath\n }\n\n const [url, remainingPath] = extracted\n\n // Server is already selected — nothing to do\n if (url === server?.url) {\n return remainingPath\n }\n\n const matchingServer = servers.find((s) => s.url === url)\n if (matchingServer) {\n eventBus.emit('server:update:selected', { url, meta: serverMeta })\n } else {\n eventBus.emit('server:add:server', {\n url,\n select: true,\n meta: { type: 'operation', path, method },\n })\n }\n\n return remainingPath\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Path / method updates\n// ───────────────────────────────────────────────────────────────────\n\nconst normalizePath = (value: string): string =>\n value.startsWith('/') ? value : `/${value}`\n\n/** Emit a path/method update and reconcile conflicts + cursor state on the result */\nconst emitPathMethodUpdate = (\n targetMethod: string,\n targetPath: string,\n blurTargetSelector: string | null = null,\n): void => {\n if (isWebhook) {\n // A webhook has no OpenAPI server, so the field holds the full destination\n // URL. Keep exactly what the user entered — do not split it into an invisible\n // server plus a leftover path, and do not force a leading slash. That split\n // is what made a typed URL collapse to a stray \"/\" on blur.\n const webhookUrl = targetPath.trim()\n addressBarRef.value?.setCodeMirrorContent(webhookUrl)\n emit('update:webhook-url', webhookUrl)\n methodConflict.value = null\n pathConflict.value = null\n nextTick(() => refocusBlurTarget(blurTargetSelector, documentRoot))\n return\n }\n\n const extractedPath = extractAndSelectServer(targetPath)\n const normalizedPath = normalizePath(extractedPath)\n\n // Keep CodeMirror in sync so a conflict does not leave a stale value on screen\n addressBarRef.value?.setCodeMirrorContent(normalizedPath)\n\n eventBus.emit('operation:update:pathMethod', {\n meta: { method, path },\n blurTargetSelector,\n payload: { method: targetMethod, path: normalizedPath },\n callback: (status, returnedSelector) => {\n if (status === 'success' || status === 'no-change') {\n methodConflict.value = null\n pathConflict.value = null\n } else if (status === 'conflict') {\n if (targetMethod !== method) {\n methodConflict.value = targetMethod\n }\n if (normalizedPath !== path) {\n pathConflict.value = normalizedPath\n }\n\n return\n }\n\n // Edge case: pasting a full URL extracts the server but leaves the path\n // unchanged. CodeMirror still shows the full URL, so force it back to\n // just the path.\n const mirrorContent = addressBarRef.value?.codeMirrorRef?.textContent\n if (\n status === 'no-change' &&\n mirrorContent &&\n mirrorContent !== extractedPath\n ) {\n addressBarRef.value?.setCodeMirrorContent(extractedPath)\n }\n\n nextTick(() => refocusBlurTarget(returnedSelector, documentRoot))\n },\n })\n}\n\n/** Change the operation's method, preferring the conflicting path if present */\nconst handleMethodChange = (newMethod: string): void =>\n emitPathMethodUpdate(newMethod, pathConflict.value ?? path)\n\n/**\n * Save the path on blur and replay the click that caused the blur (so e.g. a\n * click on the Send button still fires after the async update resolves).\n *\n * Tab-outs do not replay — tabbing to a button should not trigger its click\n * (`tabbedOut` is set on `@keydown.tab`).\n *\n * Programmatic focus moves also do not replay. On first navigation into a\n * draft operation, `usePathMasking` focuses and clears the address bar while\n * `ScalarSidebarNestedItems` focuses the drilled-in Back button in\n * `nextTick`. That steals focus from CodeMirror, fires blur with a\n * `relatedTarget` (the Back button), and without a guard we would treat it\n * like a user click: capture the selector, then `refocusBlurTarget` would\n * synthesize `.click()` on Back and navigate away.\n *\n * `FocusEvent.sourceCapabilities` is null when no input device caused the\n * focus change (e.g. `element.focus()`). A real pointer click sets it on the\n * blur that precedes the click, so we still replay Send and other buttons.\n */\nconst handlePathBlur = (newPath: string, event: FocusEvent): void => {\n const relatedTarget =\n event.relatedTarget instanceof Element ? event.relatedTarget : null\n const blurTargetSelector =\n tabbedOut.value ||\n ('sourceCapabilities' in event && event.sourceCapabilities === null)\n ? null\n : getSelector(relatedTarget)\n tabbedOut.value = false\n\n emitPathMethodUpdate(\n methodConflict.value ?? method,\n newPath,\n blurTargetSelector,\n )\n}\n\n/** Save the path on Enter and trigger the Send button after the update resolves */\nconst handlePathSubmit = (\n newPath: string,\n event: KeyboardEvent | FocusEvent,\n): void => {\n // Prevent the global hotkey listener from also handling this Enter press\n event.stopPropagation()\n\n emitPathMethodUpdate(\n methodConflict.value ?? method,\n newPath,\n '[data-addressbar-action=\"send\"]',\n )\n}\n\n/** Unset the server when backspace is pressed on an empty path */\nconst handlePathBackspace = (event: KeyboardEvent): void => {\n if (event.target instanceof HTMLElement && event.target.innerText === '\\n') {\n // A webhook has no server to unset; its full URL lives in the field itself.\n if (isWebhook) {\n return\n }\n eventBus.emit('server:update:selected', { url: '', meta: serverMeta })\n }\n}\n\nconst handleServerSelect = (\n payload: ApiReferenceEvents['server:update:selected'],\n): void => {\n eventBus.emit('server:update:selected', payload)\n}\n\nconst handleServerVariable = (\n payload: ApiReferenceEvents['server:update:variables'],\n): void => {\n eventBus.emit('server:update:variables', payload)\n}\n\nconst isGetRequest = computed(() => method.toLowerCase() === 'get')\nconst isOpenInBrowserDisabled = computed(\n () => executionDisabled || !!hasConflict.value,\n)\n\nconst requestOpenInBrowser = (): void => {\n if (isOpenInBrowserDisabled.value) return\n emit('open:browser')\n}\n\n/** Address bar copy is handled in OperationBlock (same URL as Send). */\nconst requestCopyUrl = (): void => {\n eventBus.emit('copy-url:address-bar')\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Navigation\n// ───────────────────────────────────────────────────────────────────\n\nconst navigateToServersPage = (): void => {\n if (serverMeta.type === 'operation') {\n eventBus.emit('ui:navigate', {\n page: 'operation',\n path: 'servers',\n operationPath: serverMeta.path,\n method: serverMeta.method,\n })\n return\n }\n\n eventBus.emit('ui:navigate', { page: 'document', path: 'servers' })\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Lifecycle\n// ───────────────────────────────────────────────────────────────────\n\nconst unsubscribes: Array<() => void> = []\n\nonMounted(() => {\n unsubscribes.push(\n eventBus.on('ui:focus:address-bar', handleFocusAddressBar),\n eventBus.on('ui:focus:send-button', handleFocusSendButton),\n eventBus.on('hooks:on:request:sent', startLoading),\n eventBus.on('hooks:on:request:complete', stopLoading),\n )\n})\n\nonBeforeUnmount(() => {\n for (const unsubscribe of unsubscribes) {\n unsubscribe()\n }\n\n // Prevents the loading animation from continuing after unmount\n stopLoading()\n})\n\ndefineExpose({\n methodConflict,\n pathConflict,\n})\n</script>\n<template>\n <!--\n Address bar.\n\n The wide-container layout is a single row:\n `[Method | URL | Copy | History | Send]`. When the surrounding\n `@container` drops below `@3xl` only the send button moves to a\n second row, where it spans the full width. The method and copy\n controls stay inside the bar at every width so they keep belonging\n to the URL they act on rather than floating beside it.\n -->\n <div\n class=\"order-last flex h-auto w-full max-w-3xl grow-3 flex-wrap items-stretch [--scalar-address-bar-height:32px] @3xl:order-0 @3xl:flex-nowrap\">\n <!-- Address Bar -->\n <div\n :id=\"id\"\n class=\"address-bar-bg-states text-xxs group relative flex h-(--scalar-address-bar-height) w-full flex-1 flex-row items-stretch rounded-lg p-0.75\"\n :class=\"{\n 'outline-c-danger outline': hasConflict,\n 'rounded-b-none': isDropdownOpen,\n }\">\n <div\n class=\"pointer-events-none absolute top-0 left-0 block h-full w-full overflow-hidden rounded-lg border\"\n :class=\"{\n 'rounded-b-none': isDropdownOpen,\n }\">\n <div\n class=\"absolute top-0 left-0 h-full w-full\"\n :style />\n </div>\n\n <!-- Only Send leaves the bar below `@3xl`; see the trailing row. -->\n <div class=\"flex\">\n <HttpMethod\n :isEditable=\"layout !== 'modal' && !isWebhook\"\n isSquare\n :method=\"methodConflict ?? method\"\n teleport\n @change=\"handleMethodChange\" />\n </div>\n\n <div\n class=\"scroll-timeline-x scroll-timeline-x-hidden relative flex w-full bg-blend-normal\"\n dir=\"ltr\">\n <!-- Servers -->\n <ServerDropdown\n v-if=\"servers.length\"\n :layout=\"isWebhook ? 'modal' : layout\"\n :meta=\"serverMeta\"\n :server=\"server\"\n :servers=\"servers\"\n :target=\"id\"\n @update:open=\"(value) => (isServerDropdownOpen = value)\"\n @update:selectedServer=\"handleServerSelect\"\n @update:servers=\"navigateToServersPage\"\n @update:variable=\"handleServerVariable\" />\n\n <!-- Path + URL + env vars -->\n <CodeInput\n ref=\"addressBarRef\"\n alwaysEmitChange\n :aria-label=\"translate('apiClient.addressBar.path')\"\n class=\"ml-1 min-w-fit pl-px outline-none\"\n disableCloseBrackets\n :disabled=\"layout === 'modal' && !isWebhook\"\n disableEnter\n disableTabIndent\n :emitOnBlur=\"false\"\n :environment=\"environment\"\n :extensions=\"[addressBarScrollMargins]\"\n importCurl\n :layout=\"layout\"\n :modelValue=\"path\"\n :placeholder=\"pathPlaceholder\"\n server\n @blur=\"handlePathBlur\"\n @keydown.delete=\"handlePathBackspace\"\n @keydown.tab=\"tabbedOut = true\"\n @submit=\"handlePathSubmit\" />\n </div>\n\n <!-- Copy url button -->\n <ScalarButton\n class=\"hover:bg-b-3 mx-1 flex\"\n size=\"xs\"\n variant=\"ghost\"\n @click=\"requestCopyUrl\">\n <ScalarIconCopy />\n <span class=\"sr-only\">{{\n translate('apiClient.addressBar.copyUrl')\n }}</span>\n </ScalarButton>\n\n <ScalarTooltip\n v-if=\"isGetRequest\"\n :content=\"translate('apiClient.addressBar.openInBrowserHint')\">\n <ScalarButton\n :aria-label=\"translate('apiClient.addressBar.openInBrowser')\"\n class=\"hover:bg-b-3 mr-1 flex\"\n :disabled=\"isOpenInBrowserDisabled\"\n size=\"xs\"\n variant=\"ghost\"\n @click=\"requestOpenInBrowser\">\n <ScalarIconArrowSquareOut />\n </ScalarButton>\n </ScalarTooltip>\n\n <AddressBarHistory\n :history=\"history\"\n :target=\"id\"\n @select:history:item=\"(payload) => emit('select:history:item', payload)\"\n @update:open=\"(value) => (isHistoryDropdownOpen = value)\" />\n <!-- Error message -->\n <div\n v-if=\"hasConflict\"\n class=\"z-context absolute inset-x-0 top-[calc(100%+4px)] flex flex-col items-center rounded px-6\">\n <div\n class=\"text-c-danger bg-b-danger border-c-danger flex items-center gap-1 rounded border p-1\">\n <ScalarIconWarningCircle size=\"sm\" />\n <div class=\"min-w-0 flex-1\">\n {{\n translate('apiClient.addressBar.duplicateRequest', {\n method: (methodConflict ?? method).toUpperCase(),\n path: pathConflict ?? path,\n })\n }}\n </div>\n </div>\n </div>\n\n <ScalarButton\n ref=\"sendButtonRef\"\n class=\"relative hidden h-auto shrink-0 overflow-hidden py-1 pr-2.5 pl-2 font-bold @3xl:flex\"\n data-addressbar-action=\"send\"\n :disabled=\"isLoading || executionDisabled\"\n @click=\"emit('execute')\">\n <span\n aria-hidden=\"true\"\n class=\"inline-flex items-center gap-1\">\n <ScalarIcon\n class=\"relative shrink-0 fill-current\"\n icon=\"Play\"\n size=\"xs\" />\n <span class=\"text-xxs flex\">{{\n translate('apiClient.addressBar.send')\n }}</span>\n </span>\n <span class=\"sr-only\"\n >{{\n translate('apiClient.addressBar.sendRequest', {\n method,\n url: `${server?.url ?? ''}${path}`,\n })\n }}\n </span>\n </ScalarButton>\n </div>\n\n <!--\n Below `@3xl` the send button moves out of the bar onto its own row\n and spans the full width, so the primary action stays easy to hit\n once the container is too narrow to hold it beside the URL.\n -->\n <ScalarButton\n ref=\"mobileSendButtonRef\"\n class=\"relative mt-2 h-(--scalar-address-bar-height) w-full shrink-0 justify-center overflow-hidden py-1 font-bold @3xl:hidden\"\n data-addressbar-action=\"send\"\n :disabled=\"isLoading || executionDisabled\"\n @click=\"emit('execute')\">\n <span\n aria-hidden=\"true\"\n class=\"inline-flex items-center gap-1\">\n <ScalarIcon\n class=\"relative shrink-0 fill-current\"\n icon=\"Play\"\n size=\"xs\" />\n <span class=\"text-xxs\">{{\n translate('apiClient.addressBar.send')\n }}</span>\n </span>\n <span class=\"sr-only\"\n >{{\n translate('apiClient.addressBar.sendRequest', {\n method,\n url: `${server?.url ?? ''}${path}`,\n })\n }}\n </span>\n </ScalarButton>\n </div>\n</template>\n<style scoped>\n:deep(.cm-editor) {\n height: 100%;\n outline: none;\n width: 100%;\n}\n:deep(.cm-line) {\n padding: 0;\n}\n:deep(.cm-content) {\n padding: 0;\n display: flex;\n align-items: center;\n font-size: var(--scalar-small);\n}\n.scroll-timeline-x {\n -ms-overflow-style: none;\n /* Fade the URL at the viewport edges. Mask lives on the scrollport (this\n element) rather than on `.cm-scroller`, whose width follows the URL's\n full content and pushes the right edge off-screen when overflowing. */\n mask-image: linear-gradient(\n to right,\n transparent 0,\n black 6px,\n black calc(100% - 24px),\n transparent 100%\n );\n}\n.scroll-timeline-x-hidden {\n overflow-x: auto;\n}\n.scroll-timeline-x-hidden :deep(.cm-scroller) {\n scrollbar-width: none;\n -ms-overflow-style: none;\n padding-right: 20px;\n overflow: auto;\n}\n.scroll-timeline-x-hidden::-webkit-scrollbar {\n width: 0;\n height: 0;\n display: none;\n}\n.scroll-timeline-x-hidden :deep(.cm-scroller::-webkit-scrollbar) {\n width: 0;\n height: 0;\n display: none;\n}\n.scroll-timeline-x-address {\n line-height: 27px;\n scrollbar-width: none; /* Firefox */\n}\n/* make clickable are to left of send button */\n.scroll-timeline-x-address:after {\n content: '';\n position: absolute;\n height: 100%;\n width: 24px;\n right: 0;\n cursor: text;\n}\n\n.address-bar-bg-states {\n --scalar-address-bar-bg: color-mix(\n in srgb,\n var(--scalar-background-1),\n var(--scalar-background-2)\n );\n background: var(--scalar-address-bar-bg);\n}\n.address-bar-bg-states:has(.cm-focused) {\n --scalar-address-bar-bg: var(--scalar-background-1);\n border-color: var(--scalar-border-color);\n outline-width: 1px;\n outline-style: solid;\n}\n.address-bar-bg-states:has(.cm-focused) .fade-left,\n.address-bar-bg-states:has(.cm-focused) .fade-right {\n --scalar-address-bar-bg: var(--scalar-background-1);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2FR,MAAM,OAAO;EAWb,MAAM,EAAE,cAAc,gBAAgB;;EAGtC,MAAM,eAAe,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D,mBAOO,QAPP,aAOOW,gBALHV,MAAA,SAAA,CAAS,CAAA,oCAAA;MAAqD,QAAA,QAAA;MAA8B,KAAA,GAAA,QAAA,QAAQ,OAAG,KAAS,QAAA;;;;G,oBAcxHG,YAyBeH,MAAA,YAAA,GAAA;IAxBT,SAAA;IAAJ,KAAI;IACJ,OAAM;IACN,0BAAuB;IACtB,UAAUA,MAAA,SAAA,KAAa,QAAA;IACvB,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,KAAI,SAAA;;IACZ,SAAAS,cAUO,CAVPV,mBAUO,QAVP,aAUO,CAPLI,YAGcH,MAAA,UAAA,GAAA;KAFZ,OAAM;KACN,MAAK;KACL,MAAK;I,IACPD,mBAES,QAFT,aAESW,gBADPV,MAAA,SAAA,CAAS,CAAA,2BAAA,CAAA,GAAA,CAAA,C,IAGbD,mBAOO,QAPP,aAOOW,gBALHV,MAAA,SAAA,CAAS,CAAA,oCAAA;KAAmD,QAAA,QAAA;KAA4B,KAAA,GAAA,QAAA,QAAQ,OAAG,KAAS,QAAA"}
@@ -11,6 +11,8 @@
11
11
  * - Text inputs and contenteditable elements regain focus so typing resumes
12
12
  * where the user intended.
13
13
  * - Anything else is ignored silently.
14
+ *
15
+ * @param root - Where the selector was captured, so it resolves inside a shadow root too
14
16
  */
15
- export declare const refocusBlurTarget: (selector: string | null) => void;
17
+ export declare const refocusBlurTarget: (selector: string | null, root?: Document | ShadowRoot) => void;
16
18
  //# sourceMappingURL=refocus-blur-target.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"refocus-blur-target.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-address-bar-block/helpers/refocus-blur-target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU,MAAM,GAAG,IAAI,KAAG,IAoB3D,CAAA"}
1
+ {"version":3,"file":"refocus-blur-target.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-address-bar-block/helpers/refocus-blur-target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU,MAAM,GAAG,IAAI,EAAE,OAAM,QAAQ,GAAG,UAAqB,KAAG,IAoBnG,CAAA"}
@@ -12,10 +12,12 @@
12
12
  * - Text inputs and contenteditable elements regain focus so typing resumes
13
13
  * where the user intended.
14
14
  * - Anything else is ignored silently.
15
+ *
16
+ * @param root - Where the selector was captured, so it resolves inside a shadow root too
15
17
  */
16
- var refocusBlurTarget = (selector) => {
18
+ var refocusBlurTarget = (selector, root = document) => {
17
19
  if (!selector) return;
18
- const element = document.querySelector(selector);
20
+ const element = root.querySelector(selector);
19
21
  if (element instanceof HTMLButtonElement) {
20
22
  element.click();
21
23
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"refocus-blur-target.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-address-bar-block/helpers/refocus-blur-target.ts"],"sourcesContent":["/**\n * Re-triggers the interaction that caused the address bar to blur.\n *\n * When the user clicks a button or focuses another input while the address\n * bar is focused, CodeMirror's blur fires first and the path/method update\n * event runs asynchronously. By the time the update resolves, the click has\n * already been consumed — so we capture the blur target via a selector and\n * replay the original interaction once the update completes.\n *\n * - Buttons get a synthetic click to complete the action the user started.\n * - Text inputs and contenteditable elements regain focus so typing resumes\n * where the user intended.\n * - Anything else is ignored silently.\n */\nexport const refocusBlurTarget = (selector: string | null): void => {\n if (!selector) {\n return\n }\n\n const element = document.querySelector(selector)\n\n if (element instanceof HTMLButtonElement) {\n element.click()\n return\n }\n\n const isEditable =\n element instanceof HTMLInputElement ||\n element instanceof HTMLTextAreaElement ||\n (element instanceof HTMLElement && element.getAttribute('contenteditable') === 'true')\n\n if (isEditable) {\n element.focus()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,IAAa,qBAAqB,aAAkC;CAClE,IAAI,CAAC,UACH;CAGF,MAAM,UAAU,SAAS,cAAc,QAAQ;CAE/C,IAAI,mBAAmB,mBAAmB;EACxC,QAAQ,MAAM;EACd;CACF;CAOA,IAJE,mBAAmB,oBACnB,mBAAmB,uBAClB,mBAAmB,eAAe,QAAQ,aAAa,iBAAiB,MAAM,QAG/E,QAAQ,MAAM;AAElB"}
1
+ {"version":3,"file":"refocus-blur-target.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-address-bar-block/helpers/refocus-blur-target.ts"],"sourcesContent":["/**\n * Re-triggers the interaction that caused the address bar to blur.\n *\n * When the user clicks a button or focuses another input while the address\n * bar is focused, CodeMirror's blur fires first and the path/method update\n * event runs asynchronously. By the time the update resolves, the click has\n * already been consumed — so we capture the blur target via a selector and\n * replay the original interaction once the update completes.\n *\n * - Buttons get a synthetic click to complete the action the user started.\n * - Text inputs and contenteditable elements regain focus so typing resumes\n * where the user intended.\n * - Anything else is ignored silently.\n *\n * @param root - Where the selector was captured, so it resolves inside a shadow root too\n */\nexport const refocusBlurTarget = (selector: string | null, root: Document | ShadowRoot = document): void => {\n if (!selector) {\n return\n }\n\n const element = root.querySelector(selector)\n\n if (element instanceof HTMLButtonElement) {\n element.click()\n return\n }\n\n const isEditable =\n element instanceof HTMLInputElement ||\n element instanceof HTMLTextAreaElement ||\n (element instanceof HTMLElement && element.getAttribute('contenteditable') === 'true')\n\n if (isEditable) {\n element.focus()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,IAAa,qBAAqB,UAAyB,OAA8B,aAAmB;CAC1G,IAAI,CAAC,UACH;CAGF,MAAM,UAAU,KAAK,cAAc,QAAQ;CAE3C,IAAI,mBAAmB,mBAAmB;EACxC,QAAQ,MAAM;EACd;CACF;CAOA,IAJE,mBAAmB,oBACnB,mBAAmB,uBAClB,mBAAmB,eAAe,QAAQ,aAAa,iBAAiB,MAAM,QAG/E,QAAQ,MAAM;AAElB"}
@@ -11,7 +11,7 @@ var RequestAuthDataTableInput_vue_vue_type_script_setup_true_lang_default = /*@_
11
11
  type: Boolean,
12
12
  default: false
13
13
  },
14
- containerClass: {},
14
+ containerClass: { type: [Object, Function] },
15
15
  environment: {},
16
16
  readOnly: {
17
17
  type: Boolean,
@@ -1 +1 @@
1
- {"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAA;AAM3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAA;AAErF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGhG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAA;AAInF,OAAO,EAAE,KAAK,0BAA0B,EAAmB,MAAM,8BAA8B,CAAA;AAW/F,KAAK,gBAAgB,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;AAE1F,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,MAAM,EAAE;IAC3C,6EAA6E;IAC7E,gBAAgB,EAAE,MAAM,CAAA;CACzB,KAAK,OAAO,CACX,aAAa,CAAC;IACZ,4FAA4F;IAC5F,WAAW,EAAE,MAAM,CAAA;IACnB,wFAAwF;IACxF,WAAW,EAAE,MAAM,CAAA;CACpB,CAAC,CACH,CAAA;AAED,kEAAkE;AAClE,KAAK,gBAAgB,GAAG,OAAO,CAAC,MAAM,sBAAsB,EAAE,UAAU,CAAC,CAAA;AAEzE;;;GAGG;AACH,eAAO,MAAM,YAAY,GACvB,cAAc,YAAY,GAAG,IAAI,EACjC,uBAAsB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,KAChD,MAIA,CAAA;AAEH;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC9B,cAAc,YAAY,GAAG,IAAI,EACjC,uBAAsB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,KAChD,gBAWF,CAAA;AAuCD;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,sBAAsB,EAC7B,MAAM,MAAM,sBAAsB,EAClC,gBAAgB,MAAM,EAAE;AACxB,wEAAwE;AACxE,cAAc,YAAY,GAAG,IAAI;AACjC,kCAAkC;AAClC,UAAU,MAAM;AAChB,6FAA6F;AAC7F,uBAAsB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;AACjD,mHAAmH;AACnH,cAAc,WAAW;AACzB;;;;GAIG;AACH,kBAAkB,qBAAqB,EACvC,gBAAgB,0BAA0B,KACzC,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CAkPrC,CAAA;AAoJD;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,sBAAsB,EAC7B,MAAM,gBAAgB;AACtB,kCAAkC;AAClC,UAAU,MAAM;AAChB,+DAA+D;AAC/D,cAAc,YAAY,GAAG,IAAI;AACjC,2EAA2E;AAC3E,uBAAsB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;AACjD,gIAAgI;AAChI,cAAa,WAAmB,KAC/B,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CA4FrC,CAAA"}
1
+ {"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAA;AAM3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAA;AAErF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGhG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,C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jD,mHAAmH;AACnH,cAAc,WAAW;AACzB;;;;GAIG;AACH,kBAAkB,qBAAqB,EACvC,gBAAgB,0BAA0B,KACzC,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CAkPrC,CAAA;AAoJD;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,sBAAsB,EAC7B,MAAM,gBAAgB;AACtB,kCAAkC;AAClC,UAAU,MAAM;AAChB,+DAA+D;AAC/D,cAAc,YAAY,GAAG,IAAI;AACjC,2EAA2E;AAC3E,uBAAsB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;AACjD,gIAAgI;AAChI,cAAa,WAAmB,KAC/B,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CA4FrC,CAAA"}
@@ -1,10 +1,10 @@
1
1
  import { getOAuthCallbackData } from "./oauth-callback.js";
2
2
  import { oauthClientAuthorization } from "./oauth-client-authorization.js";
3
3
  import { authorizeDevice } from "./oauth-device-authorization.js";
4
- import { getServerVariables } from "@scalar/workspace-store/request-example";
4
+ import { resolveServerUrl } from "@scalar/workspace-store/request-example";
5
5
  import { makeUrlAbsolute } from "@scalar/helpers/url/make-url-absolute";
6
6
  import { isAllowedOAuthUrl } from "@scalar/helpers/url/is-allowed-oauth-url";
7
- import { replaceEnvVariables, replacePathVariables } from "@scalar/helpers/regex/replace-variables";
7
+ import { replaceEnvVariables } from "@scalar/helpers/regex/replace-variables";
8
8
  import { isRelativePath } from "@scalar/helpers/url/is-relative-path";
9
9
  import { shouldUseProxy } from "@scalar/helpers/url/redirect-to-proxy";
10
10
  import { fromUint8Array } from "js-base64";
@@ -13,7 +13,7 @@ import { fromUint8Array } from "js-base64";
13
13
  * Resolves the active server URL using OpenAPI server variables first, then
14
14
  * Scalar environment variables.
15
15
  */
16
- var getServerUrl = (activeServer, environmentVariables = {}) => replaceEnvVariables(replacePathVariables(activeServer?.url ?? "", getServerVariables(activeServer)), environmentVariables);
16
+ var getServerUrl = (activeServer, environmentVariables = {}) => replaceEnvVariables(resolveServerUrl(activeServer), environmentVariables);
17
17
  /**
18
18
  * Builds the base option used when OAuth URLs are relative to the active server.
19
19
  *
@@ -1 +1 @@
1
- {"version":3,"file":"oauth.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/oauth.ts"],"sourcesContent":["import type { ErrorResponse } from '@scalar/helpers/errors/normalize-error'\nimport { replaceEnvVariables, replacePathVariables } from '@scalar/helpers/regex/replace-variables'\nimport { isAllowedOAuthUrl } from '@scalar/helpers/url/is-allowed-oauth-url'\nimport { isRelativePath } from '@scalar/helpers/url/is-relative-path'\nimport { makeUrlAbsolute } from '@scalar/helpers/url/make-url-absolute'\nimport { shouldUseProxy } from '@scalar/helpers/url/redirect-to-proxy'\nimport type { OAuthFlowsObjectSecret } from '@scalar/workspace-store/request-example'\nimport { getServerVariables } from '@scalar/workspace-store/request-example'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { fromUint8Array } from 'js-base64'\n\nimport type { CustomFetch } from '@/v2/blocks/operation-block/helpers/send-request'\n\nimport { getOAuthCallbackData } from './oauth-callback'\nimport { oauthClientAuthorization } from './oauth-client-authorization'\nimport { type DeviceAuthorizationOptions, authorizeDevice } from './oauth-device-authorization'\n\n/** Oauth2 security schemes which are not implicit */\ntype NonImplicitFlows = Omit<OAuthFlowsObjectSecret, 'implicit'>\n\ntype PKCEState = {\n codeVerifier: string\n codeChallenge: string\n codeChallengeMethod: string\n}\n\ntype ActiveServerBase = { basePath: string } | { baseUrl: string } | Record<string, never>\n\nexport type OAuth2Tokens = {\n accessToken: string\n refreshToken?: string\n}\n\n/**\n * Captures the OAuth2 redirect for environments where the browser-popup polling\n * approach cannot work (notably the Electron desktop app, where the renderer\n * runs on `file://` and providers reject `file://` redirect URIs).\n *\n * The implementation opens the authorization URL in the system browser and\n * resolves once the provider redirects back. Because the redirect target (for\n * example an ephemeral loopback port) is only known to the host environment, the\n * implementation appends the `redirect_uri` itself and reports back the exact\n * value it used so the token exchange can send the matching `redirect_uri`.\n */\nexport type CaptureOAuth2Callback = (params: {\n /** The fully built authorization URL, without a `redirect_uri` parameter. */\n authorizationUrl: string\n}) => Promise<\n ErrorResponse<{\n /** The full callback URL the provider redirected to, including query and/or hash params. */\n callbackUrl: string\n /** The `redirect_uri` the host environment used, so the token exchange can match it. */\n redirectUri: string\n }>\n>\n\n/** Flow types that support token refresh (all except implicit) */\ntype RefreshableFlows = Exclude<keyof OAuthFlowsObjectSecret, 'implicit'>\n\n/**\n * Resolves the active server URL using OpenAPI server variables first, then\n * Scalar environment variables.\n */\nexport const getServerUrl = (\n activeServer: ServerObject | null,\n environmentVariables: Record<string, string> = {},\n): string =>\n replaceEnvVariables(\n replacePathVariables(activeServer?.url ?? '', getServerVariables(activeServer)),\n environmentVariables,\n )\n\n/**\n * Builds the base option used when OAuth URLs are relative to the active server.\n *\n * Relative server URLs become browser-only base paths because they need the\n * current window location to resolve correctly.\n */\nexport const getActiveServerBase = (\n activeServer: ServerObject | null,\n environmentVariables: Record<string, string> = {},\n): ActiveServerBase => {\n const serverUrl = getServerUrl(activeServer, environmentVariables)\n if (!serverUrl) {\n return {}\n }\n\n if (isRelativePath(serverUrl)) {\n return typeof window === 'undefined' ? {} : { basePath: serverUrl }\n }\n\n return { baseUrl: serverUrl }\n}\n\n/**\n * Generates a random string for PKCE code verifier\n *\n * @see https://www.rfc-editor.org/rfc/rfc7636#page-8\n */\nconst generateCodeVerifier = (): string => {\n // Generate 32 random bytes\n const buffer = new Uint8Array(32)\n crypto.getRandomValues(buffer)\n\n // Base64URL encode the bytes\n return fromUint8Array(buffer, true)\n}\n\n/**\n * Creates a code challenge from the code verifier\n */\nconst generateCodeChallenge = async (verifier: string, encoding: 'SHA-256' | 'plain'): Promise<string> => {\n if (encoding === 'plain') {\n return verifier\n }\n\n // If crypto.subtle.digest is not a function, we cannot use SHA-256\n if (typeof crypto?.subtle?.digest !== 'function') {\n console.warn('SHA-256 is only supported when using https, using a plain text code challenge instead.')\n return verifier\n }\n\n // ASCII encoding is just taking the lower 8 bits of each character\n const encoder = new TextEncoder()\n const data = encoder.encode(verifier)\n const digest = await crypto.subtle.digest('SHA-256', data)\n\n // Base64URL encode the bytes\n return fromUint8Array(new Uint8Array(digest), true)\n}\n\n/**\n * Authorize oauth2 flow\n *\n * @returns the resolved oauth2 tokens\n */\nexport const authorizeOauth2 = async (\n flows: OAuthFlowsObjectSecret,\n type: keyof OAuthFlowsObjectSecret,\n selectedScopes: string[],\n /** We use the active server to set a base for relative redirect uris */\n activeServer: ServerObject | null,\n /** If we want to use the proxy */\n proxyUrl: string,\n /** Flattened environment variables used to resolve server URL templates like `{protocol}` */\n environmentVariables: Record<string, string> = {},\n /** Fetch used for the token request; the desktop app passes an IPC-backed fetch (see {@link authorizeServers}). */\n customFetch?: CustomFetch,\n /**\n * Optional redirect capture for interactive flows (authorization code and implicit).\n * When provided, the system browser plus a host-owned redirect target replaces the\n * default popup-polling approach. Required for the Electron desktop app.\n */\n captureCallback?: CaptureOAuth2Callback,\n deviceOptions?: DeviceAuthorizationOptions,\n): Promise<ErrorResponse<OAuth2Tokens>> => {\n const flow = flows[type]\n\n try {\n if (!flow) {\n return [new Error('Flow not found'), null]\n }\n\n if (type === 'deviceAuthorization' && flows.deviceAuthorization) {\n return authorizeDevice(\n flows.deviceAuthorization,\n selectedScopes,\n activeServer,\n proxyUrl,\n environmentVariables,\n customFetch,\n deviceOptions,\n )\n }\n if (type === 'deviceAuthorization') {\n return [new Error('Flow not found'), null]\n }\n const scopes = selectedScopes.join(' ')\n\n // Client Credentials or Password Flow\n if (type === 'clientCredentials' || type === 'password') {\n return authorizeServers(\n flows,\n type,\n scopes,\n {\n proxyUrl,\n customFetch,\n },\n activeServer,\n environmentVariables,\n )\n }\n\n // Generate a random state string with the length of 8 characters\n const state = (Math.random() + 1).toString(36).substring(2, 10)\n\n const authUrl = flows[type]!['x-scalar-secret-auth-url'] ?? flows[type]!.authorizationUrl\n if (!authUrl.trim()) {\n return [new Error('Authorization URL is required'), null]\n }\n const authorizationUrl = makeUrlAbsolute(authUrl, getActiveServerBase(activeServer, environmentVariables))\n\n const url = new URL(authorizationUrl)\n if (!isAllowedOAuthUrl(url)) {\n return [new Error('Authorization URL must use HTTPS or HTTP for local development URLs'), null]\n }\n\n /** Special PKCE state */\n let pkce: PKCEState | null = null\n\n // Params unique to the flows\n if (type === 'implicit') {\n url.searchParams.set('response_type', 'token')\n } else if (type === 'authorizationCode') {\n const typedFlow = flows[type]! // Safe to assert due to earlier check\n\n url.searchParams.set('response_type', 'code')\n\n // PKCE\n if (typedFlow['x-usePkce'] !== 'no') {\n const codeVerifier = generateCodeVerifier()\n const codeChallenge = await generateCodeChallenge(codeVerifier, typedFlow['x-usePkce'])\n\n // Set state for later verification\n pkce = {\n codeVerifier,\n codeChallenge,\n codeChallengeMethod: typedFlow['x-usePkce'] === 'SHA-256' ? 'S256' : 'plain',\n }\n\n // Set the code challenge and method on the url\n url.searchParams.set('code_challenge', codeChallenge)\n url.searchParams.set('code_challenge_method', pkce.codeChallengeMethod)\n }\n }\n\n const typedFlow = flows[type]! // Safe to assert due to earlier check\n\n // The capture path appends its own `redirect_uri` (it owns the target, for\n // example an ephemeral loopback port), so we only set it here for the popup path.\n if (!captureCallback) {\n // Handle relative redirect uris\n if (typedFlow['x-scalar-secret-redirect-uri'].startsWith('/')) {\n const baseUrl =\n getServerUrl(activeServer, environmentVariables) || window.location.origin + window.location.pathname\n const redirectUri = new URL(typedFlow['x-scalar-secret-redirect-uri'], baseUrl).toString()\n\n url.searchParams.set('redirect_uri', redirectUri)\n } else {\n url.searchParams.set('redirect_uri', typedFlow['x-scalar-secret-redirect-uri'])\n }\n }\n\n if (flow['x-scalar-security-query']) {\n Object.keys(flow['x-scalar-security-query']).forEach((key: string): void => {\n const value = flow['x-scalar-security-query']?.[key]\n if (!value) {\n return\n }\n url.searchParams.set(key, value)\n })\n }\n\n // Common to all flows\n url.searchParams.set(\n 'client_id',\n replaceEnvVariables(flow['x-scalar-secret-client-id'], environmentVariables).trim(),\n )\n url.searchParams.set('state', state)\n if (scopes) {\n url.searchParams.set('scope', scopes)\n }\n\n // Capture path: open the system browser and let the host environment catch\n // the redirect (used by the desktop app, where popup polling cannot work).\n if (captureCallback) {\n const [captureError, capture] = await captureCallback({ authorizationUrl: url.toString() })\n\n if (captureError || !capture) {\n return [captureError ?? new Error('Failed to capture the OAuth2 redirect'), null]\n }\n\n const { accessToken, accessTokenParams, code, codeParams, error, errorDescription, refreshToken } =\n getOAuthCallbackData(() => capture.callbackUrl, flow['x-tokenName'] || 'access_token')\n\n if (error) {\n return [new Error(`OAuth error: ${error}${errorDescription ? ` (${errorDescription})` : ''}`), null]\n }\n\n // Implicit Flow\n if (accessToken) {\n if ((accessTokenParams?.get('state') ?? null) !== state) {\n return [new Error('State mismatch'), null]\n }\n return [null, { accessToken, ...(refreshToken ? { refreshToken } : {}) }]\n }\n\n // Authorization Code Server Flow\n if (code && type === 'authorizationCode') {\n if ((codeParams?.get('state') ?? null) !== state) {\n return [new Error('State mismatch'), null]\n }\n return authorizeServers(\n flows,\n type,\n scopes,\n {\n code,\n pkce,\n proxyUrl,\n customFetch,\n // The token request must echo the exact redirect_uri used in the authorization request.\n redirectUri: capture.redirectUri,\n },\n activeServer,\n environmentVariables,\n )\n }\n\n return [new Error('No authorization code or access token was returned'), null]\n }\n\n const windowFeatures = 'left=100,top=100,width=800,height=600'\n const authWindow = window.open(url, 'openAuth2Window', windowFeatures)\n\n // Open up a window and poll until closed or we have the data we want\n if (authWindow) {\n // We need to return a promise here due to the setInterval\n return new Promise<ErrorResponse<OAuth2Tokens>>((resolve) => {\n const checkWindowClosed = setInterval(() => {\n const { accessToken, accessTokenParams, code, codeParams, error, errorDescription, refreshToken } =\n getOAuthCallbackData(() => authWindow.location.href, flow['x-tokenName'] || 'access_token')\n\n // The window has closed OR we have what we are looking for so we stop polling\n if (authWindow.closed || accessToken || code || error) {\n clearInterval(checkWindowClosed)\n authWindow.close()\n\n if (error) {\n resolve([new Error(`OAuth error: ${error}${errorDescription ? ` (${errorDescription})` : ''}`), null])\n return\n }\n\n // Implicit Flow\n if (accessToken) {\n const _state = accessTokenParams?.get('state') ?? null\n\n if (_state === state) {\n resolve([null, { accessToken, ...(refreshToken ? { refreshToken } : {}) }])\n } else {\n resolve([new Error('State mismatch'), null])\n }\n return\n }\n\n // Authorization Code Server Flow\n if (code && type === 'authorizationCode') {\n const _state = codeParams?.get('state') ?? null\n\n if (_state === state) {\n void authorizeServers(\n flows,\n type,\n scopes,\n {\n code,\n pkce,\n proxyUrl,\n customFetch,\n },\n activeServer,\n environmentVariables,\n )\n .then(resolve)\n .catch((error: unknown) => {\n resolve([\n error instanceof Error ? error : new Error('Failed to get an access token', { cause: error }),\n null,\n ])\n })\n } else {\n resolve([new Error('State mismatch'), null])\n }\n return\n }\n\n // User closed window without authorizing\n resolve([new Error('Window was closed without granting authorization'), null])\n }\n }, 200)\n })\n }\n return [new Error('Failed to open auth window'), null]\n } catch (error) {\n return [error instanceof Error ? error : new Error('Failed to authorize oauth2 flow', { cause: error }), null]\n }\n}\n\n/**\n * Makes the BE authorization call to grab the token server to server\n * Used for clientCredentials and authorizationCode\n */\nconst authorizeServers = async (\n flows: NonImplicitFlows,\n type: keyof NonImplicitFlows,\n scopes: string,\n {\n code,\n pkce,\n proxyUrl,\n customFetch = fetch,\n redirectUri,\n }: {\n code?: string\n pkce?: PKCEState | null\n proxyUrl?: string\n customFetch?: CustomFetch\n /** Overrides the stored redirect_uri (the capture path owns the real target). */\n redirectUri?: string\n } = {},\n activeServer: ServerObject | null,\n environmentVariables: Record<string, string> = {},\n): Promise<ErrorResponse<OAuth2Tokens>> => {\n const flow = flows[type]\n\n if (!flow) {\n return [new Error('OAuth2 flow was not defined'), null]\n }\n\n const formData = new URLSearchParams()\n\n // Only client credentials and password flows support scopes in the token request\n if (scopes && (type === 'clientCredentials' || type === 'password')) {\n formData.set('scope', scopes)\n }\n\n // Ignore surrounding copy/paste whitespace without changing stored credentials or other secrets.\n const clientId = replaceEnvVariables(flow['x-scalar-secret-client-id'], environmentVariables).trim()\n const clientSecret = replaceEnvVariables(flow['x-scalar-secret-client-secret'], environmentVariables).trim()\n /** Where to add the credentials */\n const addCredentialsToBody = flow['x-scalar-credentials-location'] === 'body'\n /**\n * PKCE and client authentication are independent: a confidential client may use both.\n * We send the client_secret whenever one is set, regardless of PKCE (see RFC 9700 Section 2.1.1).\n */\n const hasClientSecret = Boolean(clientSecret)\n /**\n * Public authorization-code clients still need client_id in the token body.\n * We only send it implicitly for that case to avoid conflicting with Basic auth.\n */\n const shouldSendClientIdInBody =\n addCredentialsToBody || ((type === 'authorizationCode' || type === 'deviceAuthorization') && !hasClientSecret)\n\n if (shouldSendClientIdInBody) {\n formData.set('client_id', clientId)\n }\n if (addCredentialsToBody && hasClientSecret) {\n formData.set('client_secret', clientSecret)\n }\n if (redirectUri) {\n formData.set('redirect_uri', redirectUri)\n } else if ('x-scalar-secret-redirect-uri' in flow && flow['x-scalar-secret-redirect-uri']) {\n formData.set('redirect_uri', flow['x-scalar-secret-redirect-uri'])\n }\n\n // Authorization Code\n if (code) {\n formData.set('code', code)\n formData.set('grant_type', 'authorization_code')\n\n // PKCE\n if (pkce) {\n formData.set('code_verifier', pkce.codeVerifier)\n }\n }\n // Password\n else if (type === 'password') {\n const typedFlow = flows[type]! // Safe to assert due to earlier check\n formData.set('grant_type', 'password')\n formData.set('username', typedFlow['x-scalar-secret-username'])\n formData.set('password', typedFlow['x-scalar-secret-password'])\n }\n // Client Credentials\n else {\n formData.set('grant_type', 'client_credentials')\n }\n\n // Additional request body parameters\n if (flow['x-scalar-security-body']) {\n Object.entries(flow['x-scalar-security-body']).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n formData.set(key, String(value))\n }\n })\n }\n\n try {\n const headers: Record<string, string> = {\n 'Content-Type': 'application/x-www-form-urlencoded',\n }\n\n // Add client id + secret to headers for confidential clients.\n if (!addCredentialsToBody && hasClientSecret) {\n headers.Authorization = oauthClientAuthorization(clientId, clientSecret)\n }\n\n // Check if we should use the proxy\n const tokenUrlValue = flow['x-scalar-secret-token-url'] ?? flow.tokenUrl\n if (!tokenUrlValue.trim()) {\n return [new Error('Token URL is required'), null]\n }\n const tokenUrl = makeUrlAbsolute(tokenUrlValue, getActiveServerBase(activeServer, environmentVariables))\n const url = shouldUseProxy(proxyUrl, tokenUrl)\n ? `${proxyUrl}?${new URLSearchParams([['scalar_url', tokenUrl]]).toString()}`\n : tokenUrl\n\n // Make the call\n const resp = await customFetch(url, {\n method: 'POST',\n headers,\n body: formData,\n })\n const responseData = await resp.json()\n\n // Use custom token name if specified, otherwise default to access_token\n const tokenName = flow['x-tokenName'] || 'access_token'\n const accessToken = responseData[tokenName]\n const refreshToken = responseData.refresh_token\n\n if (!accessToken) {\n return [new Error(responseData.error_description ?? responseData.error ?? 'Failed to get an access token'), null]\n }\n\n return [null, { accessToken, ...(typeof refreshToken === 'string' ? { refreshToken } : {}) }]\n } catch (error) {\n return [\n error instanceof Error\n ? error\n : new Error('Failed to get an access token. Please check your credentials.', { cause: error }),\n null,\n ]\n }\n}\n\n/**\n * Exchange a refresh token for a new access token using the `grant_type=refresh_token` flow.\n *\n * Uses the stored refresh token, client credentials, and the token URL (or refreshUrl when available)\n * to request fresh tokens from the authorization server per RFC 6749 Section 6.\n */\nexport const refreshOauth2Token = async (\n flows: OAuthFlowsObjectSecret,\n type: RefreshableFlows,\n /** If we want to use the proxy */\n proxyUrl: string,\n /** We use the active server to set a base for relative URLs */\n activeServer: ServerObject | null,\n /** Flattened environment variables used to resolve server URL templates */\n environmentVariables: Record<string, string> = {},\n /** Fetch used for the refresh request; the desktop app passes an IPC-backed fetch so it leaves the renderer's network stack. */\n customFetch: CustomFetch = fetch,\n): Promise<ErrorResponse<OAuth2Tokens>> => {\n const flow = flows[type]\n\n if (!flow) {\n return [new Error('OAuth2 flow was not defined'), null]\n }\n\n const refreshToken = flow['x-scalar-secret-refresh-token']\n if (!refreshToken) {\n return [new Error('No refresh token available'), null]\n }\n\n const formData = new URLSearchParams()\n formData.set('grant_type', 'refresh_token')\n formData.set('refresh_token', refreshToken)\n\n // Ignore surrounding copy/paste whitespace without changing stored credentials or other secrets.\n const clientId = replaceEnvVariables(flow['x-scalar-secret-client-id'], environmentVariables).trim()\n const clientSecret = replaceEnvVariables(flow['x-scalar-secret-client-secret'], environmentVariables).trim()\n const addCredentialsToBody = flow['x-scalar-credentials-location'] === 'body'\n /** A confidential client keeps using its secret on refresh, even when PKCE is enabled. */\n const hasClientSecret = Boolean(clientSecret)\n /**\n * Public authorization-code clients still need client_id in the refresh body per RFC 6749 Section 6.\n * We only send it implicitly for that case to avoid conflicting with Basic auth.\n */\n const shouldSendClientIdInBody =\n addCredentialsToBody || ((type === 'authorizationCode' || type === 'deviceAuthorization') && !hasClientSecret)\n\n if (shouldSendClientIdInBody) {\n formData.set('client_id', clientId)\n }\n if (addCredentialsToBody && hasClientSecret) {\n formData.set('client_secret', clientSecret)\n }\n\n if (flow['x-scalar-security-body']) {\n Object.entries(flow['x-scalar-security-body']).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n formData.set(key, String(value))\n }\n })\n }\n\n try {\n const headers: Record<string, string> = {\n 'Content-Type': 'application/x-www-form-urlencoded',\n }\n\n if (!addCredentialsToBody && hasClientSecret) {\n headers.Authorization = oauthClientAuthorization(clientId, clientSecret)\n }\n\n const refreshUrl = flow.refreshUrl || (flow['x-scalar-secret-token-url'] ?? flow.tokenUrl)\n if (!refreshUrl.trim()) {\n return [new Error('Token URL is required'), null]\n }\n const absoluteRefreshUrl = makeUrlAbsolute(refreshUrl, getActiveServerBase(activeServer, environmentVariables))\n const url = shouldUseProxy(proxyUrl, absoluteRefreshUrl)\n ? `${proxyUrl}?${new URLSearchParams([['scalar_url', absoluteRefreshUrl]]).toString()}`\n : absoluteRefreshUrl\n\n const resp = await customFetch(url, {\n method: 'POST',\n headers,\n body: formData,\n })\n const responseData = await resp.json()\n\n const tokenName = flow['x-tokenName'] || 'access_token'\n const accessToken = responseData[tokenName]\n const newRefreshToken = responseData.refresh_token\n\n if (!accessToken) {\n return [new Error(responseData.error_description ?? responseData.error ?? 'Token refresh failed'), null]\n }\n\n return [\n null,\n {\n accessToken,\n ...(typeof newRefreshToken === 'string' ? { refreshToken: newRefreshToken } : { refreshToken }),\n },\n ]\n } catch (error) {\n return [\n error instanceof Error\n ? error\n : new Error('Failed to refresh the access token. Please re-authorize.', { cause: error }),\n null,\n ]\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AA+DA,IAAa,gBACX,cACA,uBAA+C,CAAC,MAEhD,oBACE,qBAAqB,cAAc,OAAO,IAAI,mBAAmB,YAAY,CAAC,GAC9E,oBACF;;;;;;;AAQF,IAAa,uBACX,cACA,uBAA+C,CAAC,MAC3B;CACrB,MAAM,YAAY,aAAa,cAAc,oBAAoB;CACjE,IAAI,CAAC,WACH,OAAO,CAAC;CAGV,IAAI,eAAe,SAAS,GAC1B,OAAO,OAAO,WAAW,cAAc,CAAC,IAAI,EAAE,UAAU,UAAU;CAGpE,OAAO,EAAE,SAAS,UAAU;AAC9B;;;;;;AAOA,IAAM,6BAAqC;CAEzC,MAAM,yBAAS,IAAI,WAAW,EAAE;CAChC,OAAO,gBAAgB,MAAM;CAG7B,OAAO,eAAe,QAAQ,IAAI;AACpC;;;;AAKA,IAAM,wBAAwB,OAAO,UAAkB,aAAmD;CACxG,IAAI,aAAa,SACf,OAAO;CAIT,IAAI,OAAO,QAAQ,QAAQ,WAAW,YAAY;EAChD,QAAQ,KAAK,wFAAwF;EACrG,OAAO;CACT;CAIA,MAAM,OAAO,IADO,YACP,CAAA,CAAQ,OAAO,QAAQ;CACpC,MAAM,SAAS,MAAM,OAAO,OAAO,OAAO,WAAW,IAAI;CAGzD,OAAO,eAAe,IAAI,WAAW,MAAM,GAAG,IAAI;AACpD;;;;;;AAOA,IAAa,kBAAkB,OAC7B,OACA,MACA,gBAEA,cAEA,U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EACF,MAAM,UAAkC,EACtC,gBAAgB,oCAClB;EAEA,IAAI,CAAC,wBAAwB,iBAC3B,QAAQ,gBAAgB,yBAAyB,UAAU,YAAY;EAGzE,MAAM,aAAa,KAAK,eAAe,KAAK,gCAAgC,KAAK;EACjF,IAAI,CAAC,WAAW,KAAK,GACnB,OAAO,iBAAC,IAAI,MAAM,uBAAuB,GAAG,IAAI;EAElD,MAAM,qBAAqB,gBAAgB,YAAY,oBAAoB,cAAc,oBAAoB,CAAC;EAU9G,MAAM,eAAe,OAAM,MALR,YAJP,eAAe,UAAU,kBAAkB,IACnD,GAAG,SAAS,GAAG,IAAI,gBAAgB,CAAC,CAAC,cAAc,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS,MAClF,oBAEgC;GAClC,QAAQ;GACR;GACA,MAAM;EACR,CAAC,EAAA,CAC+B,KAAK;EAGrC,MAAM,cAAc,aADF,KAAK,kBAAkB;EAEzC,MAAM,kBAAkB,aAAa;EAErC,IAAI,CAAC,aACH,OAAO,CAAC,IAAI,MAAM,aAAa,qBAAqB,aAAa,SAAS,sBAAsB,GAAG,IAAI;EAGzG,OAAO,CACL,MACA;GACE;GACA,GAAI,OAAO,oBAAoB,WAAW,EAAE,cAAc,gBAAgB,IAAI,EAAE,aAAa;EAC/F,CACF;CACF,SAAS,OAAO;EACd,OAAO,CACL,iBAAiB,QACb,QACA,IAAI,MAAM,4DAA4D,EAAE,OAAO,MAAM,CAAC,GAC1F,IACF;CACF;AACF"}
1
+ {"version":3,"file":"oauth.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/oauth.ts"],"sourcesContent":["import type { ErrorResponse } from '@scalar/helpers/errors/normalize-error'\nimport { replaceEnvVariables } from '@scalar/helpers/regex/replace-variables'\nimport { isAllowedOAuthUrl } from '@scalar/helpers/url/is-allowed-oauth-url'\nimport { isRelativePath } from '@scalar/helpers/url/is-relative-path'\nimport { makeUrlAbsolute } from '@scalar/helpers/url/make-url-absolute'\nimport { shouldUseProxy } from '@scalar/helpers/url/redirect-to-proxy'\nimport type { OAuthFlowsObjectSecret } from '@scalar/workspace-store/request-example'\nimport { resolveServerUrl } from '@scalar/workspace-store/request-example'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { fromUint8Array } from 'js-base64'\n\nimport type { CustomFetch } from '@/v2/blocks/operation-block/helpers/send-request'\n\nimport { getOAuthCallbackData } from './oauth-callback'\nimport { oauthClientAuthorization } from './oauth-client-authorization'\nimport { type DeviceAuthorizationOptions, authorizeDevice } from './oauth-device-authorization'\n\n/** Oauth2 security schemes which are not implicit */\ntype NonImplicitFlows = Omit<OAuthFlowsObjectSecret, 'implicit'>\n\ntype PKCEState = {\n codeVerifier: string\n codeChallenge: string\n codeChallengeMethod: string\n}\n\ntype ActiveServerBase = { basePath: string } | { baseUrl: string } | Record<string, never>\n\nexport type OAuth2Tokens = {\n accessToken: string\n refreshToken?: string\n}\n\n/**\n * Captures the OAuth2 redirect for environments where the browser-popup polling\n * approach cannot work (notably the Electron desktop app, where the renderer\n * runs on `file://` and providers reject `file://` redirect URIs).\n *\n * The implementation opens the authorization URL in the system browser and\n * resolves once the provider redirects back. Because the redirect target (for\n * example an ephemeral loopback port) is only known to the host environment, the\n * implementation appends the `redirect_uri` itself and reports back the exact\n * value it used so the token exchange can send the matching `redirect_uri`.\n */\nexport type CaptureOAuth2Callback = (params: {\n /** The fully built authorization URL, without a `redirect_uri` parameter. */\n authorizationUrl: string\n}) => Promise<\n ErrorResponse<{\n /** The full callback URL the provider redirected to, including query and/or hash params. */\n callbackUrl: string\n /** The `redirect_uri` the host environment used, so the token exchange can match it. */\n redirectUri: string\n }>\n>\n\n/** Flow types that support token refresh (all except implicit) */\ntype RefreshableFlows = Exclude<keyof OAuthFlowsObjectSecret, 'implicit'>\n\n/**\n * Resolves the active server URL using OpenAPI server variables first, then\n * Scalar environment variables.\n */\nexport const getServerUrl = (\n activeServer: ServerObject | null,\n environmentVariables: Record<string, string> = {},\n): string => replaceEnvVariables(resolveServerUrl(activeServer), environmentVariables)\n\n/**\n * Builds the base option used when OAuth URLs are relative to the active server.\n *\n * Relative server URLs become browser-only base paths because they need the\n * current window location to resolve correctly.\n */\nexport const getActiveServerBase = (\n activeServer: ServerObject | null,\n environmentVariables: Record<string, string> = {},\n): ActiveServerBase => {\n const serverUrl = getServerUrl(activeServer, environmentVariables)\n if (!serverUrl) {\n return {}\n }\n\n if (isRelativePath(serverUrl)) {\n return typeof window === 'undefined' ? {} : { basePath: serverUrl }\n }\n\n return { baseUrl: serverUrl }\n}\n\n/**\n * Generates a random string for PKCE code verifier\n *\n * @see https://www.rfc-editor.org/rfc/rfc7636#page-8\n */\nconst generateCodeVerifier = (): string => {\n // Generate 32 random bytes\n const buffer = new Uint8Array(32)\n crypto.getRandomValues(buffer)\n\n // Base64URL encode the bytes\n return fromUint8Array(buffer, true)\n}\n\n/**\n * Creates a code challenge from the code verifier\n */\nconst generateCodeChallenge = async (verifier: string, encoding: 'SHA-256' | 'plain'): Promise<string> => {\n if (encoding === 'plain') {\n return verifier\n }\n\n // If crypto.subtle.digest is not a function, we cannot use SHA-256\n if (typeof crypto?.subtle?.digest !== 'function') {\n console.warn('SHA-256 is only supported when using https, using a plain text code challenge instead.')\n return verifier\n }\n\n // ASCII encoding is just taking the lower 8 bits of each character\n const encoder = new TextEncoder()\n const data = encoder.encode(verifier)\n const digest = await crypto.subtle.digest('SHA-256', data)\n\n // Base64URL encode the bytes\n return fromUint8Array(new Uint8Array(digest), true)\n}\n\n/**\n * Authorize oauth2 flow\n *\n * @returns the resolved oauth2 tokens\n */\nexport const authorizeOauth2 = async (\n flows: OAuthFlowsObjectSecret,\n type: keyof OAuthFlowsObjectSecret,\n selectedScopes: string[],\n /** We use the active server to set a base for relative redirect uris */\n activeServer: ServerObject | null,\n /** If we want to use the proxy */\n proxyUrl: string,\n /** Flattened environment variables used to resolve server URL templates like `{protocol}` */\n environmentVariables: Record<string, string> = {},\n /** Fetch used for the token request; the desktop app passes an IPC-backed fetch (see {@link authorizeServers}). */\n customFetch?: CustomFetch,\n /**\n * Optional redirect capture for interactive flows (authorization code and implicit).\n * When provided, the system browser plus a host-owned redirect target replaces the\n * default popup-polling approach. Required for the Electron desktop app.\n */\n captureCallback?: CaptureOAuth2Callback,\n deviceOptions?: DeviceAuthorizationOptions,\n): Promise<ErrorResponse<OAuth2Tokens>> => {\n const flow = flows[type]\n\n try {\n if (!flow) {\n return [new Error('Flow not found'), null]\n }\n\n if (type === 'deviceAuthorization' && flows.deviceAuthorization) {\n return authorizeDevice(\n flows.deviceAuthorization,\n selectedScopes,\n activeServer,\n proxyUrl,\n environmentVariables,\n customFetch,\n deviceOptions,\n )\n }\n if (type === 'deviceAuthorization') {\n return [new Error('Flow not found'), null]\n }\n const scopes = selectedScopes.join(' ')\n\n // Client Credentials or Password Flow\n if (type === 'clientCredentials' || type === 'password') {\n return authorizeServers(\n flows,\n type,\n scopes,\n {\n proxyUrl,\n customFetch,\n },\n activeServer,\n environmentVariables,\n )\n }\n\n // Generate a random state string with the length of 8 characters\n const state = (Math.random() + 1).toString(36).substring(2, 10)\n\n const authUrl = flows[type]!['x-scalar-secret-auth-url'] ?? flows[type]!.authorizationUrl\n if (!authUrl.trim()) {\n return [new Error('Authorization URL is required'), null]\n }\n const authorizationUrl = makeUrlAbsolute(authUrl, getActiveServerBase(activeServer, environmentVariables))\n\n const url = new URL(authorizationUrl)\n if (!isAllowedOAuthUrl(url)) {\n return [new Error('Authorization URL must use HTTPS or HTTP for local development URLs'), null]\n }\n\n /** Special PKCE state */\n let pkce: PKCEState | null = null\n\n // Params unique to the flows\n if (type === 'implicit') {\n url.searchParams.set('response_type', 'token')\n } else if (type === 'authorizationCode') {\n const typedFlow = flows[type]! // Safe to assert due to earlier check\n\n url.searchParams.set('response_type', 'code')\n\n // PKCE\n if (typedFlow['x-usePkce'] !== 'no') {\n const codeVerifier = generateCodeVerifier()\n const codeChallenge = await generateCodeChallenge(codeVerifier, typedFlow['x-usePkce'])\n\n // Set state for later verification\n pkce = {\n codeVerifier,\n codeChallenge,\n codeChallengeMethod: typedFlow['x-usePkce'] === 'SHA-256' ? 'S256' : 'plain',\n }\n\n // Set the code challenge and method on the url\n url.searchParams.set('code_challenge', codeChallenge)\n url.searchParams.set('code_challenge_method', pkce.codeChallengeMethod)\n }\n }\n\n const typedFlow = flows[type]! // Safe to assert due to earlier check\n\n // The capture path appends its own `redirect_uri` (it owns the target, for\n // example an ephemeral loopback port), so we only set it here for the popup path.\n if (!captureCallback) {\n // Handle relative redirect uris\n if (typedFlow['x-scalar-secret-redirect-uri'].startsWith('/')) {\n const baseUrl =\n getServerUrl(activeServer, environmentVariables) || window.location.origin + window.location.pathname\n const redirectUri = new URL(typedFlow['x-scalar-secret-redirect-uri'], baseUrl).toString()\n\n url.searchParams.set('redirect_uri', redirectUri)\n } else {\n url.searchParams.set('redirect_uri', typedFlow['x-scalar-secret-redirect-uri'])\n }\n }\n\n if (flow['x-scalar-security-query']) {\n Object.keys(flow['x-scalar-security-query']).forEach((key: string): void => {\n const value = flow['x-scalar-security-query']?.[key]\n if (!value) {\n return\n }\n url.searchParams.set(key, value)\n })\n }\n\n // Common to all flows\n url.searchParams.set(\n 'client_id',\n replaceEnvVariables(flow['x-scalar-secret-client-id'], environmentVariables).trim(),\n )\n url.searchParams.set('state', state)\n if (scopes) {\n url.searchParams.set('scope', scopes)\n }\n\n // Capture path: open the system browser and let the host environment catch\n // the redirect (used by the desktop app, where popup polling cannot work).\n if (captureCallback) {\n const [captureError, capture] = await captureCallback({ authorizationUrl: url.toString() })\n\n if (captureError || !capture) {\n return [captureError ?? new Error('Failed to capture the OAuth2 redirect'), null]\n }\n\n const { accessToken, accessTokenParams, code, codeParams, error, errorDescription, refreshToken } =\n getOAuthCallbackData(() => capture.callbackUrl, flow['x-tokenName'] || 'access_token')\n\n if (error) {\n return [new Error(`OAuth error: ${error}${errorDescription ? ` (${errorDescription})` : ''}`), null]\n }\n\n // Implicit Flow\n if (accessToken) {\n if ((accessTokenParams?.get('state') ?? null) !== state) {\n return [new Error('State mismatch'), null]\n }\n return [null, { accessToken, ...(refreshToken ? { refreshToken } : {}) }]\n }\n\n // Authorization Code Server Flow\n if (code && type === 'authorizationCode') {\n if ((codeParams?.get('state') ?? null) !== state) {\n return [new Error('State mismatch'), null]\n }\n return authorizeServers(\n flows,\n type,\n scopes,\n {\n code,\n pkce,\n proxyUrl,\n customFetch,\n // The token request must echo the exact redirect_uri used in the authorization request.\n redirectUri: capture.redirectUri,\n },\n activeServer,\n environmentVariables,\n )\n }\n\n return [new Error('No authorization code or access token was returned'), null]\n }\n\n const windowFeatures = 'left=100,top=100,width=800,height=600'\n const authWindow = window.open(url, 'openAuth2Window', windowFeatures)\n\n // Open up a window and poll until closed or we have the data we want\n if (authWindow) {\n // We need to return a promise here due to the setInterval\n return new Promise<ErrorResponse<OAuth2Tokens>>((resolve) => {\n const checkWindowClosed = setInterval(() => {\n const { accessToken, accessTokenParams, code, codeParams, error, errorDescription, refreshToken } =\n getOAuthCallbackData(() => authWindow.location.href, flow['x-tokenName'] || 'access_token')\n\n // The window has closed OR we have what we are looking for so we stop polling\n if (authWindow.closed || accessToken || code || error) {\n clearInterval(checkWindowClosed)\n authWindow.close()\n\n if (error) {\n resolve([new Error(`OAuth error: ${error}${errorDescription ? ` (${errorDescription})` : ''}`), null])\n return\n }\n\n // Implicit Flow\n if (accessToken) {\n const _state = accessTokenParams?.get('state') ?? null\n\n if (_state === state) {\n resolve([null, { accessToken, ...(refreshToken ? { refreshToken } : {}) }])\n } else {\n resolve([new Error('State mismatch'), null])\n }\n return\n }\n\n // Authorization Code Server Flow\n if (code && type === 'authorizationCode') {\n const _state = codeParams?.get('state') ?? null\n\n if (_state === state) {\n void authorizeServers(\n flows,\n type,\n scopes,\n {\n code,\n pkce,\n proxyUrl,\n customFetch,\n },\n activeServer,\n environmentVariables,\n )\n .then(resolve)\n .catch((error: unknown) => {\n resolve([\n error instanceof Error ? error : new Error('Failed to get an access token', { cause: error }),\n null,\n ])\n })\n } else {\n resolve([new Error('State mismatch'), null])\n }\n return\n }\n\n // User closed window without authorizing\n resolve([new Error('Window was closed without granting authorization'), null])\n }\n }, 200)\n })\n }\n return [new Error('Failed to open auth window'), null]\n } catch (error) {\n return [error instanceof Error ? error : new Error('Failed to authorize oauth2 flow', { cause: error }), null]\n }\n}\n\n/**\n * Makes the BE authorization call to grab the token server to server\n * Used for clientCredentials and authorizationCode\n */\nconst authorizeServers = async (\n flows: NonImplicitFlows,\n type: keyof NonImplicitFlows,\n scopes: string,\n {\n code,\n pkce,\n proxyUrl,\n customFetch = fetch,\n redirectUri,\n }: {\n code?: string\n pkce?: PKCEState | null\n proxyUrl?: string\n customFetch?: CustomFetch\n /** Overrides the stored redirect_uri (the capture path owns the real target). */\n redirectUri?: string\n } = {},\n activeServer: ServerObject | null,\n environmentVariables: Record<string, string> = {},\n): Promise<ErrorResponse<OAuth2Tokens>> => {\n const flow = flows[type]\n\n if (!flow) {\n return [new Error('OAuth2 flow was not defined'), null]\n }\n\n const formData = new URLSearchParams()\n\n // Only client credentials and password flows support scopes in the token request\n if (scopes && (type === 'clientCredentials' || type === 'password')) {\n formData.set('scope', scopes)\n }\n\n // Ignore surrounding copy/paste whitespace without changing stored credentials or other secrets.\n const clientId = replaceEnvVariables(flow['x-scalar-secret-client-id'], environmentVariables).trim()\n const clientSecret = replaceEnvVariables(flow['x-scalar-secret-client-secret'], environmentVariables).trim()\n /** Where to add the credentials */\n const addCredentialsToBody = flow['x-scalar-credentials-location'] === 'body'\n /**\n * PKCE and client authentication are independent: a confidential client may use both.\n * We send the client_secret whenever one is set, regardless of PKCE (see RFC 9700 Section 2.1.1).\n */\n const hasClientSecret = Boolean(clientSecret)\n /**\n * Public authorization-code clients still need client_id in the token body.\n * We only send it implicitly for that case to avoid conflicting with Basic auth.\n */\n const shouldSendClientIdInBody =\n addCredentialsToBody || ((type === 'authorizationCode' || type === 'deviceAuthorization') && !hasClientSecret)\n\n if (shouldSendClientIdInBody) {\n formData.set('client_id', clientId)\n }\n if (addCredentialsToBody && hasClientSecret) {\n formData.set('client_secret', clientSecret)\n }\n if (redirectUri) {\n formData.set('redirect_uri', redirectUri)\n } else if ('x-scalar-secret-redirect-uri' in flow && flow['x-scalar-secret-redirect-uri']) {\n formData.set('redirect_uri', flow['x-scalar-secret-redirect-uri'])\n }\n\n // Authorization Code\n if (code) {\n formData.set('code', code)\n formData.set('grant_type', 'authorization_code')\n\n // PKCE\n if (pkce) {\n formData.set('code_verifier', pkce.codeVerifier)\n }\n }\n // Password\n else if (type === 'password') {\n const typedFlow = flows[type]! // Safe to assert due to earlier check\n formData.set('grant_type', 'password')\n formData.set('username', typedFlow['x-scalar-secret-username'])\n formData.set('password', typedFlow['x-scalar-secret-password'])\n }\n // Client Credentials\n else {\n formData.set('grant_type', 'client_credentials')\n }\n\n // Additional request body parameters\n if (flow['x-scalar-security-body']) {\n Object.entries(flow['x-scalar-security-body']).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n formData.set(key, String(value))\n }\n })\n }\n\n try {\n const headers: Record<string, string> = {\n 'Content-Type': 'application/x-www-form-urlencoded',\n }\n\n // Add client id + secret to headers for confidential clients.\n if (!addCredentialsToBody && hasClientSecret) {\n headers.Authorization = oauthClientAuthorization(clientId, clientSecret)\n }\n\n // Check if we should use the proxy\n const tokenUrlValue = flow['x-scalar-secret-token-url'] ?? flow.tokenUrl\n if (!tokenUrlValue.trim()) {\n return [new Error('Token URL is required'), null]\n }\n const tokenUrl = makeUrlAbsolute(tokenUrlValue, getActiveServerBase(activeServer, environmentVariables))\n const url = shouldUseProxy(proxyUrl, tokenUrl)\n ? `${proxyUrl}?${new URLSearchParams([['scalar_url', tokenUrl]]).toString()}`\n : tokenUrl\n\n // Make the call\n const resp = await customFetch(url, {\n method: 'POST',\n headers,\n body: formData,\n })\n const responseData = await resp.json()\n\n // Use custom token name if specified, otherwise default to access_token\n const tokenName = flow['x-tokenName'] || 'access_token'\n const accessToken = responseData[tokenName]\n const refreshToken = responseData.refresh_token\n\n if (!accessToken) {\n return [new Error(responseData.error_description ?? responseData.error ?? 'Failed to get an access token'), null]\n }\n\n return [null, { accessToken, ...(typeof refreshToken === 'string' ? { refreshToken } : {}) }]\n } catch (error) {\n return [\n error instanceof Error\n ? error\n : new Error('Failed to get an access token. Please check your credentials.', { cause: error }),\n null,\n ]\n }\n}\n\n/**\n * Exchange a refresh token for a new access token using the `grant_type=refresh_token` flow.\n *\n * Uses the stored refresh token, client credentials, and the token URL (or refreshUrl when available)\n * to request fresh tokens from the authorization server per RFC 6749 Section 6.\n */\nexport const refreshOauth2Token = async (\n flows: OAuthFlowsObjectSecret,\n type: RefreshableFlows,\n /** If we want to use the proxy */\n proxyUrl: string,\n /** We use the active server to set a base for relative URLs */\n activeServer: ServerObject | null,\n /** Flattened environment variables used to resolve server URL templates */\n environmentVariables: Record<string, string> = {},\n /** Fetch used for the refresh request; the desktop app passes an IPC-backed fetch so it leaves the renderer's network stack. */\n customFetch: CustomFetch = fetch,\n): Promise<ErrorResponse<OAuth2Tokens>> => {\n const flow = flows[type]\n\n if (!flow) {\n return [new Error('OAuth2 flow was not defined'), null]\n }\n\n const refreshToken = flow['x-scalar-secret-refresh-token']\n if (!refreshToken) {\n return [new Error('No refresh token available'), null]\n }\n\n const formData = new URLSearchParams()\n formData.set('grant_type', 'refresh_token')\n formData.set('refresh_token', refreshToken)\n\n // Ignore surrounding copy/paste whitespace without changing stored credentials or other secrets.\n const clientId = replaceEnvVariables(flow['x-scalar-secret-client-id'], environmentVariables).trim()\n const clientSecret = replaceEnvVariables(flow['x-scalar-secret-client-secret'], environmentVariables).trim()\n const addCredentialsToBody = flow['x-scalar-credentials-location'] === 'body'\n /** A confidential client keeps using its secret on refresh, even when PKCE is enabled. */\n const hasClientSecret = Boolean(clientSecret)\n /**\n * Public authorization-code clients still need client_id in the refresh body per RFC 6749 Section 6.\n * We only send it implicitly for that case to avoid conflicting with Basic auth.\n */\n const shouldSendClientIdInBody =\n addCredentialsToBody || ((type === 'authorizationCode' || type === 'deviceAuthorization') && !hasClientSecret)\n\n if (shouldSendClientIdInBody) {\n formData.set('client_id', clientId)\n }\n if (addCredentialsToBody && hasClientSecret) {\n formData.set('client_secret', clientSecret)\n }\n\n if (flow['x-scalar-security-body']) {\n Object.entries(flow['x-scalar-security-body']).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n formData.set(key, String(value))\n }\n })\n }\n\n try {\n const headers: Record<string, string> = {\n 'Content-Type': 'application/x-www-form-urlencoded',\n }\n\n if (!addCredentialsToBody && hasClientSecret) {\n headers.Authorization = oauthClientAuthorization(clientId, clientSecret)\n }\n\n const refreshUrl = flow.refreshUrl || (flow['x-scalar-secret-token-url'] ?? flow.tokenUrl)\n if (!refreshUrl.trim()) {\n return [new Error('Token URL is required'), null]\n }\n const absoluteRefreshUrl = makeUrlAbsolute(refreshUrl, getActiveServerBase(activeServer, environmentVariables))\n const url = shouldUseProxy(proxyUrl, absoluteRefreshUrl)\n ? `${proxyUrl}?${new URLSearchParams([['scalar_url', absoluteRefreshUrl]]).toString()}`\n : absoluteRefreshUrl\n\n const resp = await customFetch(url, {\n method: 'POST',\n headers,\n body: formData,\n })\n const responseData = await resp.json()\n\n const tokenName = flow['x-tokenName'] || 'access_token'\n const accessToken = responseData[tokenName]\n const newRefreshToken = responseData.refresh_token\n\n if (!accessToken) {\n return [new Error(responseData.error_description ?? responseData.error ?? 'Token refresh failed'), null]\n }\n\n return [\n null,\n {\n accessToken,\n ...(typeof newRefreshToken === 'string' ? { refreshToken: newRefreshToken } : { refreshToken }),\n },\n ]\n } catch (error) {\n return [\n error instanceof Error\n ? error\n : new Error('Failed to refresh the access token. Please re-authorize.', { cause: error }),\n null,\n ]\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AA+DA,IAAa,gBACX,cACA,uBAA+C,CAAC,MACrC,oBAAoB,iBAAiB,YAAY,GAAG,oBAAoB;;;;;;;AAQrF,IAAa,u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R;GACA,MAAM;EACR,CAAC,EAAA,CAC+B,KAAK;EAGrC,MAAM,cAAc,aADF,KAAK,kBAAkB;EAEzC,MAAM,kBAAkB,aAAa;EAErC,IAAI,CAAC,aACH,OAAO,CAAC,IAAI,MAAM,aAAa,qBAAqB,aAAa,SAAS,sBAAsB,GAAG,IAAI;EAGzG,OAAO,CACL,MACA;GACE;GACA,GAAI,OAAO,oBAAoB,WAAW,EAAE,cAAc,gBAAgB,IAAI,EAAE,aAAa;EAC/F,CACF;CACF,SAAS,OAAO;EACd,OAAO,CACL,iBAAiB,QACb,QACA,IAAI,MAAM,4DAA4D,EAAE,OAAO,MAAM,CAAC,GAC1F,IACF;CACF;AACF"}
@@ -4,7 +4,14 @@ import { useBindCx } from "@scalar/use-hooks/useBindCx";
4
4
  var DataTableCell_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
5
5
  inheritAttrs: false,
6
6
  __name: "DataTableCell",
7
- props: { is: { default: "td" } },
7
+ props: { is: {
8
+ type: [
9
+ String,
10
+ Object,
11
+ Function
12
+ ],
13
+ default: "td"
14
+ } },
8
15
  setup(__props) {
9
16
  const { cx } = useBindCx();
10
17
  return (_ctx, _cache) => {
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableCell.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_resolveDynamicComponent","_mergeProps","_unref","_withCtx","_renderSlot"],"sources":["../../../../src/v2/components/data-table/DataTableCell.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\nimport type { Component } from 'vue'\n\nwithDefaults(\n defineProps<{\n is?: string | Component\n }>(),\n { is: 'td' },\n)\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <component\n :is=\"is\"\n v-bind=\"\n cx(\n 'box-content max-h-8 min-h-8 min-w-8 border-l-0 border-t border-b-0 border-r flex text-base/5 last:border-r-0 group-last:border-b-transparent p-0 m-0 relative',\n )\n \"\n class=\"group-[.alert]:bg-b-alert group-[.error]:bg-b-danger\">\n <slot />\n </component>\n</template>\n"],"mappings":";;;;;;;;EAYA,MAAM,EAAE,OAAO,UAAU;;GAGvB,OAAAA,UAAA,GAAAC,YASYC,wBARL,QAAA,EAAE,GADTC,WAEiBC,MAAA,EAAA,CAAE,C,kKAKjB,EAAA,OAAM,uDAAsD,CAAA,GAAA;IAC5D,SAAAC,cAAQ,CAARC,WAAQ,KAAA,QAAA,SAAA,C"}
1
+ {"version":3,"file":"DataTableCell.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_resolveDynamicComponent","_mergeProps","_unref","_withCtx","_renderSlot"],"sources":["../../../../src/v2/components/data-table/DataTableCell.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\nimport type { Component } from 'vue'\n\nwithDefaults(\n defineProps<{\n is?: string | Component\n }>(),\n { is: 'td' },\n)\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <component\n :is=\"is\"\n v-bind=\"\n cx(\n 'box-content max-h-8 min-h-8 min-w-8 border-l-0 border-t border-b-0 border-r flex text-base/5 last:border-r-0 group-last:border-b-transparent p-0 m-0 relative',\n )\n \"\n class=\"group-[.alert]:bg-b-alert group-[.error]:bg-b-danger\">\n <slot />\n </component>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;EAYA,MAAM,EAAE,OAAO,UAAU;;GAGvB,OAAAA,UAAA,GAAAC,YASYC,wBARL,QAAA,EAAE,GADTC,WAEiBC,MAAA,EAAA,CAAE,C,kKAKjB,EAAA,OAAM,uDAAsD,CAAA,GAAA;IAC5D,SAAAC,cAAQ,CAARC,WAAQ,KAAA,QAAA,SAAA,C"}
@@ -1,6 +1,6 @@
1
1
  // src/v2/constants.ts
2
2
  /** The version number taken from the package.json. Consumers can override at build time via define (e.g. OVERRIDE_PACKAGE_VERSION: JSON.stringify('1.2.3')). */
3
- var APP_VERSION = typeof OVERRIDE_PACKAGE_VERSION !== "undefined" ? OVERRIDE_PACKAGE_VERSION : "3.29.0";
3
+ var APP_VERSION = typeof OVERRIDE_PACKAGE_VERSION !== "undefined" ? OVERRIDE_PACKAGE_VERSION : "3.29.1";
4
4
  export { APP_VERSION };
5
5
 
6
6
  //# sourceMappingURL=constants.js.map
@@ -32,7 +32,7 @@ var Operation_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
32
32
  environment: {},
33
33
  workspaceStore: {},
34
34
  plugins: {},
35
- options: {},
35
+ options: { type: [Object, Function] },
36
36
  requestBodyCompositionSelection: {}
37
37
  },
38
38
  setup(__props) {
@@ -625,21 +625,21 @@ to {
625
625
  background: var(--scalar-background-2);
626
626
  }
627
627
 
628
- [data-v-b5b0a654] .cm-editor {
628
+ [data-v-7abeb15f] .cm-editor {
629
629
  height: 100%;
630
630
  outline: none;
631
631
  width: 100%;
632
632
  }
633
- [data-v-b5b0a654] .cm-line {
633
+ [data-v-7abeb15f] .cm-line {
634
634
  padding: 0;
635
635
  }
636
- [data-v-b5b0a654] .cm-content {
636
+ [data-v-7abeb15f] .cm-content {
637
637
  padding: 0;
638
638
  display: flex;
639
639
  align-items: center;
640
640
  font-size: var(--scalar-small);
641
641
  }
642
- .scroll-timeline-x[data-v-b5b0a654] {
642
+ .scroll-timeline-x[data-v-7abeb15f] {
643
643
  -ms-overflow-style: none;
644
644
  /* Fade the URL at the viewport edges. Mask lives on the scrollport (this
645
645
  element) rather than on `.cm-scroller`, whose width follows the URL's
@@ -652,31 +652,31 @@ to {
652
652
  transparent 100%
653
653
  );
654
654
  }
655
- .scroll-timeline-x-hidden[data-v-b5b0a654] {
655
+ .scroll-timeline-x-hidden[data-v-7abeb15f] {
656
656
  overflow-x: auto;
657
657
  }
658
- .scroll-timeline-x-hidden[data-v-b5b0a654] .cm-scroller {
658
+ .scroll-timeline-x-hidden[data-v-7abeb15f] .cm-scroller {
659
659
  scrollbar-width: none;
660
660
  -ms-overflow-style: none;
661
661
  padding-right: 20px;
662
662
  overflow: auto;
663
663
  }
664
- .scroll-timeline-x-hidden[data-v-b5b0a654]::-webkit-scrollbar {
664
+ .scroll-timeline-x-hidden[data-v-7abeb15f]::-webkit-scrollbar {
665
665
  width: 0;
666
666
  height: 0;
667
667
  display: none;
668
668
  }
669
- .scroll-timeline-x-hidden[data-v-b5b0a654] .cm-scroller::-webkit-scrollbar {
669
+ .scroll-timeline-x-hidden[data-v-7abeb15f] .cm-scroller::-webkit-scrollbar {
670
670
  width: 0;
671
671
  height: 0;
672
672
  display: none;
673
673
  }
674
- .scroll-timeline-x-address[data-v-b5b0a654] {
674
+ .scroll-timeline-x-address[data-v-7abeb15f] {
675
675
  line-height: 27px;
676
676
  scrollbar-width: none; /* Firefox */
677
677
  }
678
678
  /* make clickable are to left of send button */
679
- .scroll-timeline-x-address[data-v-b5b0a654]:after {
679
+ .scroll-timeline-x-address[data-v-7abeb15f]:after {
680
680
  content: '';
681
681
  position: absolute;
682
682
  height: 100%;
@@ -684,7 +684,7 @@ to {
684
684
  right: 0;
685
685
  cursor: text;
686
686
  }
687
- .address-bar-bg-states[data-v-b5b0a654] {
687
+ .address-bar-bg-states[data-v-7abeb15f] {
688
688
  --scalar-address-bar-bg: color-mix(
689
689
  in srgb,
690
690
  var(--scalar-background-1),
@@ -692,14 +692,14 @@ to {
692
692
  );
693
693
  background: var(--scalar-address-bar-bg);
694
694
  }
695
- .address-bar-bg-states[data-v-b5b0a654]:has(.cm-focused) {
695
+ .address-bar-bg-states[data-v-7abeb15f]:has(.cm-focused) {
696
696
  --scalar-address-bar-bg: var(--scalar-background-1);
697
697
  border-color: var(--scalar-border-color);
698
698
  outline-width: 1px;
699
699
  outline-style: solid;
700
700
  }
701
- .address-bar-bg-states:has(.cm-focused) .fade-left[data-v-b5b0a654],
702
- .address-bar-bg-states:has(.cm-focused) .fade-right[data-v-b5b0a654] {
701
+ .address-bar-bg-states:has(.cm-focused) .fade-left[data-v-7abeb15f],
702
+ .address-bar-bg-states:has(.cm-focused) .fade-right[data-v-7abeb15f] {
703
703
  --scalar-address-bar-bg: var(--scalar-background-1);
704
704
  }
705
705
 
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "rest",
19
19
  "testing"
20
20
  ],
21
- "version": "3.29.0",
21
+ "version": "3.29.1",
22
22
  "engines": {
23
23
  "node": ">=22"
24
24
  },
@@ -306,25 +306,25 @@
306
306
  "@headlessui/tailwindcss": "^0.2.2",
307
307
  "@headlessui/vue": "1.7.23",
308
308
  "@internationalized/date": "3.12.4",
309
- "@scalar/blocks": "0.9.0",
310
- "@scalar/components": "0.35.5",
311
- "@scalar/helpers": "0.19.0",
312
- "@scalar/icons": "0.7.11",
313
- "@scalar/localization": "0.2.15",
314
- "@scalar/oas-utils": "0.20.27",
309
+ "@scalar/blocks": "0.10.0",
310
+ "@scalar/components": "0.36.0",
311
+ "@scalar/helpers": "0.20.0",
312
+ "@scalar/icons": "0.7.12",
313
+ "@scalar/localization": "0.2.16",
314
+ "@scalar/oas-utils": "0.20.28",
315
315
  "@scalar/openapi-types": "0.9.10",
316
- "@scalar/sidebar": "0.13.2",
317
- "@scalar/snippetz": "0.10.22",
316
+ "@scalar/sidebar": "0.13.3",
317
+ "@scalar/snippetz": "0.10.23",
318
318
  "@scalar/themes": "0.21.1",
319
- "@scalar/types": "0.32.0",
320
- "@scalar/use-codemirror": "0.14.20",
321
- "@scalar/use-hooks": "0.4.29",
322
- "@scalar/use-toasts": "0.10.9",
319
+ "@scalar/types": "0.32.1",
320
+ "@scalar/use-codemirror": "0.14.21",
321
+ "@scalar/use-hooks": "0.5.0",
322
+ "@scalar/use-toasts": "0.10.10",
323
323
  "@scalar/validation": "0.6.9",
324
- "@scalar/workspace-store": "0.76.0",
324
+ "@scalar/workspace-store": "0.77.0",
325
325
  "@vueuse/core": "15.0.0",
326
326
  "@vueuse/integrations": "15.0.0",
327
- "focus-trap": "^8.2.5",
327
+ "focus-trap": "^8.2.6",
328
328
  "fuse.js": "^7.5.0",
329
329
  "js-base64": "^3.9.7",
330
330
  "jsonc-parser": "3.3.1",
@@ -332,7 +332,7 @@
332
332
  "pretty-ms": "^10.0.0",
333
333
  "radix-vue": "^1.9.17",
334
334
  "set-cookie-parser": "4.0.0",
335
- "vue": "^3.5.45",
335
+ "vue": "^3.5.46",
336
336
  "yaml": "^2.9.1",
337
337
  "zod": "^4.6.7"
338
338
  },
@@ -343,7 +343,7 @@
343
343
  "@vue/test-utils": "2.6.0",
344
344
  "fake-indexeddb": "6.2.8",
345
345
  "jsdom": "31.0.1",
346
- "posthog-js": "1.453.0",
346
+ "posthog-js": "1.453.2",
347
347
  "tailwindcss": "^4.3.5",
348
348
  "vite": "8.3.8",
349
349
  "vite-svg-loader": "5.1.3",