@scalar/types 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @scalar/types
2
2
 
3
+ ## 0.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 543a16c: feat: allow to explicitly set the default source
8
+ - 57e96a0: feat: add onDocumentSelect callback when switching multi configs
9
+
10
+ ## 0.1.2
11
+
12
+ ### Patch Changes
13
+
14
+ - 7a8965c: chore: remove spec prefix
15
+ - 49dffff: feat: expose the isLoading prop to control loading of references
16
+
3
17
  ## 0.1.1
4
18
 
5
19
  ### Patch Changes
@@ -395,620 +395,10 @@ export declare const apiReferenceConfigurationSchema: z.ZodEffects<z.ZodObject<z
395
395
  */
396
396
  isEditable: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
397
397
  /**
398
- * Whether to show models in the sidebar, search, and content.
399
- * @default false
400
- */
401
- hideModels: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
402
- /**
403
- * Whether to show the "Download OpenAPI Document" button
404
- * @default false
405
- */
406
- hideDownloadButton: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
407
- /**
408
- * Whether to show the "Test Request" button
409
- * @default false
410
- */
411
- hideTestRequestButton: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
412
- /**
413
- * Whether to show the sidebar search bar
414
- * @default false
415
- */
416
- hideSearch: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
417
- /** Whether dark mode is on or off initially (light mode) */
418
- darkMode: z.ZodOptional<z.ZodBoolean>;
419
- /** forceDarkModeState makes it always this state no matter what */
420
- forceDarkModeState: z.ZodOptional<z.ZodEnum<["dark", "light"]>>;
421
- /**
422
- * Whether to show the dark mode toggle
423
- * @default false
424
- */
425
- hideDarkModeToggle: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
426
- /**
427
- * If used, passed data will be added to the HTML header
428
- * @see https://unhead.unjs.io/usage/composables/use-seo-meta
429
- */
430
- metaData: z.ZodOptional<z.ZodAny>;
431
- /**
432
- * Path to a favicon image
433
- * @default undefined
434
- * @example '/favicon.svg'
435
- */
436
- favicon: z.ZodOptional<z.ZodString>;
437
- /**
438
- * List of httpsnippet clients to hide from the clients menu
439
- * By default hides Unirest, pass `[]` to show all clients
440
- */
441
- hiddenClients: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodBoolean, z.ZodArray<z.ZodString, "many">]>>, z.ZodArray<z.ZodString, "many">, z.ZodLiteral<true>]>>;
442
- /** Determine the HTTP client that's selected by default */
443
- defaultHttpClient: z.ZodOptional<z.ZodObject<{
444
- targetKey: z.ZodType<"c" | "clojure" | "csharp" | "go" | "http" | "java" | "js" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "r" | "ruby" | "shell" | "swift" | "dart", z.ZodTypeDef, "c" | "clojure" | "csharp" | "go" | "http" | "java" | "js" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "r" | "ruby" | "shell" | "swift" | "dart">;
445
- clientKey: z.ZodString;
446
- }, "strip", z.ZodTypeAny, {
447
- targetKey: "c" | "clojure" | "csharp" | "go" | "http" | "java" | "js" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "r" | "ruby" | "shell" | "swift" | "dart";
448
- clientKey: string;
449
- }, {
450
- targetKey: "c" | "clojure" | "csharp" | "go" | "http" | "java" | "js" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "r" | "ruby" | "shell" | "swift" | "dart";
451
- clientKey: string;
452
- }>>;
453
- /** Custom CSS to be added to the page */
454
- customCss: z.ZodOptional<z.ZodString>;
455
- /** onSpecUpdate is fired on spec/swagger content change */
456
- onSpecUpdate: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodVoid>>;
457
- /** onServerChange is fired on selected server change */
458
- onServerChange: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodVoid>>;
459
- /**
460
- * Route using paths instead of hashes, your server MUST support this
461
- * @example '/standalone-api-reference/:custom(.*)?'
462
- * @experimental
463
- * @default undefined
464
- */
465
- pathRouting: z.ZodOptional<z.ZodObject<{
466
- /** Base path for the API reference */
467
- basePath: z.ZodString;
468
- }, "strip", z.ZodTypeAny, {
469
- basePath: string;
470
- }, {
471
- basePath: string;
472
- }>>;
473
- /**
474
- * Customize the heading portion of the hash
475
- * @param heading - The heading object
476
- * @returns A string ID used to generate the URL hash
477
- * @default (heading) => `#description/${heading.slug}`
478
- */
479
- generateHeadingSlug: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
480
- slug: z.ZodDefault<z.ZodString>;
481
- }, "strip", z.ZodTypeAny, {
482
- slug: string;
483
- }, {
484
- slug?: string | undefined;
485
- }>], z.ZodUnknown>, z.ZodString>>;
486
- /**
487
- * Customize the model portion of the hash
488
- * @param model - The model object with a name property
489
- * @returns A string ID used to generate the URL hash
490
- * @default (model) => slug(model.name)
491
- */
492
- generateModelSlug: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
493
- name: z.ZodDefault<z.ZodString>;
494
- }, "strip", z.ZodTypeAny, {
495
- name: string;
496
- }, {
497
- name?: string | undefined;
498
- }>], z.ZodUnknown>, z.ZodString>>;
499
- /**
500
- * Customize the tag portion of the hash
501
- * @param tag - The tag object
502
- * @returns A string ID used to generate the URL hash
503
- * @default (tag) => slug(tag.name)
504
- */
505
- generateTagSlug: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
506
- name: z.ZodDefault<z.ZodString>;
507
- }, "strip", z.ZodTypeAny, {
508
- name: string;
509
- }, {
510
- name?: string | undefined;
511
- }>], z.ZodUnknown>, z.ZodString>>;
512
- /**
513
- * Customize the operation portion of the hash
514
- * @param operation - The operation object
515
- * @returns A string ID used to generate the URL hash
516
- * @default (operation) => `${operation.method}${operation.path}`
517
- */
518
- generateOperationSlug: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
519
- path: z.ZodString;
520
- operationId: z.ZodOptional<z.ZodString>;
521
- method: z.ZodString;
522
- summary: z.ZodOptional<z.ZodString>;
523
- }, "strip", z.ZodTypeAny, {
524
- path: string;
525
- method: string;
526
- operationId?: string | undefined;
527
- summary?: string | undefined;
528
- }, {
529
- path: string;
530
- method: string;
531
- operationId?: string | undefined;
532
- summary?: string | undefined;
533
- }>], z.ZodUnknown>, z.ZodString>>;
534
- /**
535
- * Customize the webhook portion of the hash
536
- * @param webhook - The webhook object
537
- * @returns A string ID used to generate the URL hash
538
- * @default (webhook) => slug(webhook.name)
539
- */
540
- generateWebhookSlug: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
541
- name: z.ZodString;
542
- method: z.ZodOptional<z.ZodString>;
543
- }, "strip", z.ZodTypeAny, {
544
- name: string;
545
- method?: string | undefined;
546
- }, {
547
- name: string;
548
- method?: string | undefined;
549
- }>], z.ZodUnknown>, z.ZodString>>;
550
- /** Callback fired when the reference is fully loaded */
551
- onLoaded: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodVoid>>;
552
- /**
553
- * To handle redirects, pass a function that will recieve:
554
- * - The current path with hash if pathRouting is enabled
555
- * - The current hash if hashRouting (default)
556
- * And then passes that to history.replaceState
557
- *
558
- * @example hashRouting (default)
559
- * ```ts
560
- * redirect: (hash: string) => hash.replace('#v1/old-path', '#v2/new-path')
561
- * ```
562
- * @example pathRouting
563
- * ```ts
564
- * redirect: (pathWithHash: string) => {
565
- * if (pathWithHash.includes('#')) {
566
- * return pathWithHash.replace('/v1/tags/user#operation/get-user', '/v1/tags/user/operation/get-user')
567
- * }
568
- * return null
569
- * }
570
- * ```
571
- */
572
- redirect: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodOptional<z.ZodNullable<z.ZodString>>>>;
573
- /**
574
- * Whether to include default fonts
575
- * @default true
576
- */
577
- withDefaultFonts: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
578
- /** Whether to expand all tags by default */
579
- defaultOpenAllTags: z.ZodOptional<z.ZodBoolean>;
580
- /**
581
- * Function to sort tags
582
- * @default 'alpha' for alphabetical sorting
583
- */
584
- tagsSorter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"alpha">, z.ZodFunction<z.ZodTuple<[z.ZodAny, z.ZodAny], z.ZodUnknown>, z.ZodNumber>]>>;
585
- /**
586
- * Function to sort operations
587
- * @default 'alpha' for alphabetical sorting
588
- */
589
- operationsSorter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"alpha">, z.ZodLiteral<"method">, z.ZodFunction<z.ZodTuple<[z.ZodAny, z.ZodAny], z.ZodUnknown>, z.ZodNumber>]>>;
590
- }>, "strip", z.ZodTypeAny, {
591
- hideClientButton: boolean;
592
- showSidebar: boolean;
593
- theme: "alternate" | "default" | "moon" | "purple" | "solarized" | "bluePlanet" | "deepSpace" | "saturn" | "kepler" | "elysiajs" | "fastify" | "mars" | "none";
594
- layout: "modern" | "classic";
595
- isEditable: boolean;
596
- hideModels: boolean;
597
- hideDownloadButton: boolean;
598
- hideTestRequestButton: boolean;
599
- hideSearch: boolean;
600
- hideDarkModeToggle: boolean;
601
- withDefaultFonts: boolean;
602
- url?: string | undefined;
603
- content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
604
- title?: string | undefined;
605
- slug?: string | undefined;
606
- spec?: {
607
- url?: string | undefined;
608
- content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
609
- title?: string | undefined;
610
- slug?: string | undefined;
611
- } | undefined;
612
- authentication?: any;
613
- baseServerURL?: string | undefined;
614
- proxyUrl?: string | undefined;
615
- searchHotKey?: "c" | "r" | "o" | "n" | "a" | "b" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "p" | "q" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | undefined;
616
- servers?: any[] | undefined;
617
- _integration?: "go" | "elysiajs" | "fastify" | "adonisjs" | "docusaurus" | "dotnet" | "express" | "fastapi" | "hono" | "html" | "laravel" | "litestar" | "nestjs" | "nextjs" | "nitro" | "nuxt" | "platformatic" | "react" | "rust" | "vue" | null | undefined;
618
- proxy?: string | undefined;
619
- darkMode?: boolean | undefined;
620
- forceDarkModeState?: "dark" | "light" | undefined;
621
- metaData?: any;
622
- favicon?: string | undefined;
623
- hiddenClients?: true | string[] | Record<string, boolean | string[]> | undefined;
624
- defaultHttpClient?: {
625
- targetKey: "c" | "clojure" | "csharp" | "go" | "http" | "java" | "js" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "r" | "ruby" | "shell" | "swift" | "dart";
626
- clientKey: string;
627
- } | undefined;
628
- customCss?: string | undefined;
629
- onSpecUpdate?: ((args_0: string, ...args: unknown[]) => void) | undefined;
630
- onServerChange?: ((args_0: string, ...args: unknown[]) => void) | undefined;
631
- pathRouting?: {
632
- basePath: string;
633
- } | undefined;
634
- generateHeadingSlug?: ((args_0: {
635
- slug?: string | undefined;
636
- }, ...args: unknown[]) => string) | undefined;
637
- generateModelSlug?: ((args_0: {
638
- name?: string | undefined;
639
- }, ...args: unknown[]) => string) | undefined;
640
- generateTagSlug?: ((args_0: {
641
- name?: string | undefined;
642
- }, ...args: unknown[]) => string) | undefined;
643
- generateOperationSlug?: ((args_0: {
644
- path: string;
645
- method: string;
646
- operationId?: string | undefined;
647
- summary?: string | undefined;
648
- }, ...args: unknown[]) => string) | undefined;
649
- generateWebhookSlug?: ((args_0: {
650
- name: string;
651
- method?: string | undefined;
652
- }, ...args: unknown[]) => string) | undefined;
653
- onLoaded?: ((...args: unknown[]) => void) | undefined;
654
- redirect?: ((args_0: string, ...args: unknown[]) => string | null | undefined) | undefined;
655
- defaultOpenAllTags?: boolean | undefined;
656
- tagsSorter?: "alpha" | ((args_0: any, args_1: any, ...args: unknown[]) => number) | undefined;
657
- operationsSorter?: "method" | "alpha" | ((args_0: any, args_1: any, ...args: unknown[]) => number) | undefined;
658
- }, {
659
- url?: string | undefined;
660
- content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
661
- title?: string | undefined;
662
- slug?: string | undefined;
663
- spec?: {
664
- url?: string | undefined;
665
- content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
666
- title?: string | undefined;
667
- slug?: string | undefined;
668
- } | undefined;
669
- authentication?: any;
670
- baseServerURL?: string | undefined;
671
- hideClientButton?: unknown;
672
- proxyUrl?: string | undefined;
673
- searchHotKey?: "c" | "r" | "o" | "n" | "a" | "b" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "p" | "q" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | undefined;
674
- servers?: any[] | undefined;
675
- showSidebar?: unknown;
676
- theme?: unknown;
677
- _integration?: "go" | "elysiajs" | "fastify" | "adonisjs" | "docusaurus" | "dotnet" | "express" | "fastapi" | "hono" | "html" | "laravel" | "litestar" | "nestjs" | "nextjs" | "nitro" | "nuxt" | "platformatic" | "react" | "rust" | "vue" | null | undefined;
678
- layout?: unknown;
679
- proxy?: string | undefined;
680
- isEditable?: unknown;
681
- hideModels?: unknown;
682
- hideDownloadButton?: unknown;
683
- hideTestRequestButton?: unknown;
684
- hideSearch?: unknown;
685
- darkMode?: boolean | undefined;
686
- forceDarkModeState?: "dark" | "light" | undefined;
687
- hideDarkModeToggle?: unknown;
688
- metaData?: any;
689
- favicon?: string | undefined;
690
- hiddenClients?: true | string[] | Record<string, boolean | string[]> | undefined;
691
- defaultHttpClient?: {
692
- targetKey: "c" | "clojure" | "csharp" | "go" | "http" | "java" | "js" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "r" | "ruby" | "shell" | "swift" | "dart";
693
- clientKey: string;
694
- } | undefined;
695
- customCss?: string | undefined;
696
- onSpecUpdate?: ((args_0: string, ...args: unknown[]) => void) | undefined;
697
- onServerChange?: ((args_0: string, ...args: unknown[]) => void) | undefined;
698
- pathRouting?: {
699
- basePath: string;
700
- } | undefined;
701
- generateHeadingSlug?: ((args_0: {
702
- slug: string;
703
- }, ...args: unknown[]) => string) | undefined;
704
- generateModelSlug?: ((args_0: {
705
- name: string;
706
- }, ...args: unknown[]) => string) | undefined;
707
- generateTagSlug?: ((args_0: {
708
- name: string;
709
- }, ...args: unknown[]) => string) | undefined;
710
- generateOperationSlug?: ((args_0: {
711
- path: string;
712
- method: string;
713
- operationId?: string | undefined;
714
- summary?: string | undefined;
715
- }, ...args: unknown[]) => string) | undefined;
716
- generateWebhookSlug?: ((args_0: {
717
- name: string;
718
- method?: string | undefined;
719
- }, ...args: unknown[]) => string) | undefined;
720
- onLoaded?: ((...args: unknown[]) => void) | undefined;
721
- redirect?: ((args_0: string, ...args: unknown[]) => string | null | undefined) | undefined;
722
- withDefaultFonts?: unknown;
723
- defaultOpenAllTags?: boolean | undefined;
724
- tagsSorter?: "alpha" | ((args_0: any, args_1: any, ...args: unknown[]) => number) | undefined;
725
- operationsSorter?: "method" | "alpha" | ((args_0: any, args_1: any, ...args: unknown[]) => number) | undefined;
726
- }>, {
727
- hideClientButton: boolean;
728
- showSidebar: boolean;
729
- theme: "alternate" | "default" | "moon" | "purple" | "solarized" | "bluePlanet" | "deepSpace" | "saturn" | "kepler" | "elysiajs" | "fastify" | "mars" | "none";
730
- layout: "modern" | "classic";
731
- isEditable: boolean;
732
- hideModels: boolean;
733
- hideDownloadButton: boolean;
734
- hideTestRequestButton: boolean;
735
- hideSearch: boolean;
736
- hideDarkModeToggle: boolean;
737
- withDefaultFonts: boolean;
738
- url?: string | undefined;
739
- content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
740
- title?: string | undefined;
741
- slug?: string | undefined;
742
- spec?: {
743
- url?: string | undefined;
744
- content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
745
- title?: string | undefined;
746
- slug?: string | undefined;
747
- } | undefined;
748
- authentication?: any;
749
- baseServerURL?: string | undefined;
750
- proxyUrl?: string | undefined;
751
- searchHotKey?: "c" | "r" | "o" | "n" | "a" | "b" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "p" | "q" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | undefined;
752
- servers?: any[] | undefined;
753
- _integration?: "go" | "elysiajs" | "fastify" | "adonisjs" | "docusaurus" | "dotnet" | "express" | "fastapi" | "hono" | "html" | "laravel" | "litestar" | "nestjs" | "nextjs" | "nitro" | "nuxt" | "platformatic" | "react" | "rust" | "vue" | null | undefined;
754
- proxy?: string | undefined;
755
- darkMode?: boolean | undefined;
756
- forceDarkModeState?: "dark" | "light" | undefined;
757
- metaData?: any;
758
- favicon?: string | undefined;
759
- hiddenClients?: true | string[] | Record<string, boolean | string[]> | undefined;
760
- defaultHttpClient?: {
761
- targetKey: "c" | "clojure" | "csharp" | "go" | "http" | "java" | "js" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "r" | "ruby" | "shell" | "swift" | "dart";
762
- clientKey: string;
763
- } | undefined;
764
- customCss?: string | undefined;
765
- onSpecUpdate?: ((args_0: string, ...args: unknown[]) => void) | undefined;
766
- onServerChange?: ((args_0: string, ...args: unknown[]) => void) | undefined;
767
- pathRouting?: {
768
- basePath: string;
769
- } | undefined;
770
- generateHeadingSlug?: ((args_0: {
771
- slug?: string | undefined;
772
- }, ...args: unknown[]) => string) | undefined;
773
- generateModelSlug?: ((args_0: {
774
- name?: string | undefined;
775
- }, ...args: unknown[]) => string) | undefined;
776
- generateTagSlug?: ((args_0: {
777
- name?: string | undefined;
778
- }, ...args: unknown[]) => string) | undefined;
779
- generateOperationSlug?: ((args_0: {
780
- path: string;
781
- method: string;
782
- operationId?: string | undefined;
783
- summary?: string | undefined;
784
- }, ...args: unknown[]) => string) | undefined;
785
- generateWebhookSlug?: ((args_0: {
786
- name: string;
787
- method?: string | undefined;
788
- }, ...args: unknown[]) => string) | undefined;
789
- onLoaded?: ((...args: unknown[]) => void) | undefined;
790
- redirect?: ((args_0: string, ...args: unknown[]) => string | null | undefined) | undefined;
791
- defaultOpenAllTags?: boolean | undefined;
792
- tagsSorter?: "alpha" | ((args_0: any, args_1: any, ...args: unknown[]) => number) | undefined;
793
- operationsSorter?: "method" | "alpha" | ((args_0: any, args_1: any, ...args: unknown[]) => number) | undefined;
794
- }, {
795
- url?: string | undefined;
796
- content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
797
- title?: string | undefined;
798
- slug?: string | undefined;
799
- spec?: {
800
- url?: string | undefined;
801
- content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
802
- title?: string | undefined;
803
- slug?: string | undefined;
804
- } | undefined;
805
- authentication?: any;
806
- baseServerURL?: string | undefined;
807
- hideClientButton?: unknown;
808
- proxyUrl?: string | undefined;
809
- searchHotKey?: "c" | "r" | "o" | "n" | "a" | "b" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "p" | "q" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | undefined;
810
- servers?: any[] | undefined;
811
- showSidebar?: unknown;
812
- theme?: unknown;
813
- _integration?: "go" | "elysiajs" | "fastify" | "adonisjs" | "docusaurus" | "dotnet" | "express" | "fastapi" | "hono" | "html" | "laravel" | "litestar" | "nestjs" | "nextjs" | "nitro" | "nuxt" | "platformatic" | "react" | "rust" | "vue" | null | undefined;
814
- layout?: unknown;
815
- proxy?: string | undefined;
816
- isEditable?: unknown;
817
- hideModels?: unknown;
818
- hideDownloadButton?: unknown;
819
- hideTestRequestButton?: unknown;
820
- hideSearch?: unknown;
821
- darkMode?: boolean | undefined;
822
- forceDarkModeState?: "dark" | "light" | undefined;
823
- hideDarkModeToggle?: unknown;
824
- metaData?: any;
825
- favicon?: string | undefined;
826
- hiddenClients?: true | string[] | Record<string, boolean | string[]> | undefined;
827
- defaultHttpClient?: {
828
- targetKey: "c" | "clojure" | "csharp" | "go" | "http" | "java" | "js" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "r" | "ruby" | "shell" | "swift" | "dart";
829
- clientKey: string;
830
- } | undefined;
831
- customCss?: string | undefined;
832
- onSpecUpdate?: ((args_0: string, ...args: unknown[]) => void) | undefined;
833
- onServerChange?: ((args_0: string, ...args: unknown[]) => void) | undefined;
834
- pathRouting?: {
835
- basePath: string;
836
- } | undefined;
837
- generateHeadingSlug?: ((args_0: {
838
- slug: string;
839
- }, ...args: unknown[]) => string) | undefined;
840
- generateModelSlug?: ((args_0: {
841
- name: string;
842
- }, ...args: unknown[]) => string) | undefined;
843
- generateTagSlug?: ((args_0: {
844
- name: string;
845
- }, ...args: unknown[]) => string) | undefined;
846
- generateOperationSlug?: ((args_0: {
847
- path: string;
848
- method: string;
849
- operationId?: string | undefined;
850
- summary?: string | undefined;
851
- }, ...args: unknown[]) => string) | undefined;
852
- generateWebhookSlug?: ((args_0: {
853
- name: string;
854
- method?: string | undefined;
855
- }, ...args: unknown[]) => string) | undefined;
856
- onLoaded?: ((...args: unknown[]) => void) | undefined;
857
- redirect?: ((args_0: string, ...args: unknown[]) => string | null | undefined) | undefined;
858
- withDefaultFonts?: unknown;
859
- defaultOpenAllTags?: boolean | undefined;
860
- tagsSorter?: "alpha" | ((args_0: any, args_1: any, ...args: unknown[]) => number) | undefined;
861
- operationsSorter?: "method" | "alpha" | ((args_0: any, args_1: any, ...args: unknown[]) => number) | undefined;
862
- }>;
863
- /** Configuration after parsing, this is the main type */
864
- export type ApiReferenceConfiguration = Omit<z.infer<typeof apiReferenceConfigurationSchema>, 'proxy' | 'spec'>;
865
- /** Props for the ApiReference components, coming from user input */
866
- export declare const apiReferenceConfigurationWithSourcesSchema: z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
867
- /**
868
- * URL to an OpenAPI/Swagger document
869
- **/
870
- url: z.ZodOptional<z.ZodString>;
871
- /**
872
- * Directly embed the OpenAPI document.
873
- * Can be a string, object, function returning an object, or null.
874
- *
875
- * @remarks It’s recommended to pass a URL instead of content.
876
- **/
877
- content: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodNull]>>;
878
- /**
879
- * The title of the OpenAPI document.
880
- *
881
- * @example 'Scalar Galaxy'
882
- */
883
- title: z.ZodOptional<z.ZodString>;
884
- /**
885
- * The slug of the OpenAPI document used in the URL.
886
- *
887
- * If none is passed, the title will be used.
888
- *
889
- * If no title is used, it’ll just use the index.
890
- *
891
- * @example 'scalar-galaxy'
892
- */
893
- slug: z.ZodOptional<z.ZodString>;
894
- /**
895
- * The OpenAPI/Swagger document to render
896
- *
897
- * @deprecated Use `url` and `content` on the top level instead.
898
- **/
899
- spec: z.ZodOptional<z.ZodObject<{
900
- /**
901
- * URL to an OpenAPI/Swagger document
902
- *
903
- * @deprecated Please move `url` to the top level and remove the `spec` prefix.
904
- *
905
- * @example
906
- * ```ts
907
- * const oldConfiguration = {
908
- * spec: {
909
- * url: 'https://example.com/openapi.json',
910
- * },
911
- * }
912
- *
913
- * const newConfiguration = {
914
- * url: 'https://example.com/openapi.json',
915
- * }
916
- * ```
917
- **/
918
- url: z.ZodOptional<z.ZodString>;
919
- /**
920
- * Directly embed the OpenAPI document.
921
- * Can be a string, object, function returning an object, or null.
922
- *
923
- * @remarks It's recommended to pass a URL instead of content.
924
- *
925
- * @deprecated Please move `content` to the top level and remove the `spec` prefix.
926
- *
927
- * @example
928
- * ```ts
929
- * const oldConfiguration = {
930
- * spec: {
931
- * content: '…',
932
- * },
933
- * }
934
- *
935
- * const newConfiguration = {
936
- * content: '…',
937
- * }
938
- * ```
939
- **/
940
- content: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodNull]>>;
941
- /**
942
- * The title of the OpenAPI document.
943
- *
944
- * @example 'Scalar Galaxy'
945
- *
946
- * @deprecated Please move `title` to the top level and remove the `spec` prefix.
947
- */
948
- title: z.ZodOptional<z.ZodString>;
949
- /**
950
- * The slug of the OpenAPI document used in the URL.
951
- *
952
- * If none is passed, the title will be used.
953
- *
954
- * If no title is used, it’ll just use the index.
955
- *
956
- * @example 'scalar-galaxy'
957
- *
958
- * @deprecated Please move `slug` to the top level and remove the `spec` prefix.
959
- */
960
- slug: z.ZodOptional<z.ZodString>;
961
- }, "strip", z.ZodTypeAny, {
962
- url?: string | undefined;
963
- content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
964
- title?: string | undefined;
965
- slug?: string | undefined;
966
- }, {
967
- url?: string | undefined;
968
- content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
969
- title?: string | undefined;
970
- slug?: string | undefined;
971
- }>>;
972
- /** Prefill authentication */
973
- authentication: z.ZodOptional<z.ZodAny>;
974
- /** Base URL for the API server */
975
- baseServerURL: z.ZodOptional<z.ZodString>;
976
- /**
977
- * Whether to hide the client button
978
- * @default false
979
- */
980
- hideClientButton: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
981
- /** URL to a request proxy for the API client */
982
- proxyUrl: z.ZodOptional<z.ZodString>;
983
- /** Key used with CTRL/CMD to open the search modal (defaults to 'k' e.g. CMD+k) */
984
- searchHotKey: z.ZodOptional<z.ZodEnum<["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]>>;
985
- /** List of OpenAPI server objects */
986
- servers: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
987
- /**
988
- * Whether to show the sidebar
989
- * @default true
990
- */
991
- showSidebar: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
992
- /** A string to use one of the color presets */
993
- theme: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodEnum<["alternate", "default", "moon", "purple", "solarized", "bluePlanet", "deepSpace", "saturn", "kepler", "elysiajs", "fastify", "mars", "none"]>>>>;
994
- /** Integration type identifier */
995
- _integration: z.ZodOptional<z.ZodNullable<z.ZodEnum<["adonisjs", "docusaurus", "dotnet", "elysiajs", "express", "fastapi", "fastify", "go", "hono", "html", "laravel", "litestar", "nestjs", "nextjs", "nitro", "nuxt", "platformatic", "react", "rust", "vue"]>>>;
996
- }, {
997
- /**
998
- * The layout to use for the references
999
- * @default 'modern'
1000
- */
1001
- layout: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodEnum<["modern", "classic"]>>>>;
1002
- /**
1003
- * URL to a request proxy for the API client
1004
- * @deprecated Use proxyUrl instead
1005
- */
1006
- proxy: z.ZodOptional<z.ZodString>;
1007
- /**
1008
- * Whether the spec input should show
398
+ * Controls whether the references show a loading state in the intro
1009
399
  * @default false
1010
400
  */
1011
- isEditable: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
401
+ isLoading: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
1012
402
  /**
1013
403
  * Whether to show models in the sidebar, search, and content.
1014
404
  * @default false
@@ -1071,6 +461,8 @@ export declare const apiReferenceConfigurationWithSourcesSchema: z.ZodEffects<z.
1071
461
  onSpecUpdate: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodVoid>>;
1072
462
  /** onServerChange is fired on selected server change */
1073
463
  onServerChange: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodVoid>>;
464
+ /** onDocumentSelect is fired when the config is selected */
465
+ onDocumentSelect: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodVoid>>;
1074
466
  /**
1075
467
  * Route using paths instead of hashes, your server MUST support this
1076
468
  * @example '/standalone-api-reference/:custom(.*)?'
@@ -1202,98 +594,19 @@ export declare const apiReferenceConfigurationWithSourcesSchema: z.ZodEffects<z.
1202
594
  * @default 'alpha' for alphabetical sorting
1203
595
  */
1204
596
  operationsSorter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"alpha">, z.ZodLiteral<"method">, z.ZodFunction<z.ZodTuple<[z.ZodAny, z.ZodAny], z.ZodUnknown>, z.ZodNumber>]>>;
1205
- }>, {
1206
- sources: z.ZodArray<z.ZodObject<{
1207
- /**
1208
- * URL to an OpenAPI/Swagger document
1209
- *
1210
- * @deprecated Please move `url` to the top level and remove the `spec` prefix.
1211
- *
1212
- * @example
1213
- * ```ts
1214
- * const oldConfiguration = {
1215
- * spec: {
1216
- * url: 'https://example.com/openapi.json',
1217
- * },
1218
- * }
1219
- *
1220
- * const newConfiguration = {
1221
- * url: 'https://example.com/openapi.json',
1222
- * }
1223
- * ```
1224
- **/
1225
- url: z.ZodOptional<z.ZodString>;
1226
- /**
1227
- * Directly embed the OpenAPI document.
1228
- * Can be a string, object, function returning an object, or null.
1229
- *
1230
- * @remarks It's recommended to pass a URL instead of content.
1231
- *
1232
- * @deprecated Please move `content` to the top level and remove the `spec` prefix.
1233
- *
1234
- * @example
1235
- * ```ts
1236
- * const oldConfiguration = {
1237
- * spec: {
1238
- * content: '…',
1239
- * },
1240
- * }
1241
- *
1242
- * const newConfiguration = {
1243
- * content: '…',
1244
- * }
1245
- * ```
1246
- **/
1247
- content: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodNull]>>;
1248
- /**
1249
- * The title of the OpenAPI document.
1250
- *
1251
- * @example 'Scalar Galaxy'
1252
- *
1253
- * @deprecated Please move `title` to the top level and remove the `spec` prefix.
1254
- */
1255
- title: z.ZodOptional<z.ZodString>;
1256
- /**
1257
- * The slug of the OpenAPI document used in the URL.
1258
- *
1259
- * If none is passed, the title will be used.
1260
- *
1261
- * If no title is used, it’ll just use the index.
1262
- *
1263
- * @example 'scalar-galaxy'
1264
- *
1265
- * @deprecated Please move `slug` to the top level and remove the `spec` prefix.
1266
- */
1267
- slug: z.ZodOptional<z.ZodString>;
1268
- }, "strip", z.ZodTypeAny, {
1269
- url?: string | undefined;
1270
- content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
1271
- title?: string | undefined;
1272
- slug?: string | undefined;
1273
- }, {
1274
- url?: string | undefined;
1275
- content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
1276
- title?: string | undefined;
1277
- slug?: string | undefined;
1278
- }>, "many">;
1279
597
  }>, "strip", z.ZodTypeAny, {
1280
598
  hideClientButton: boolean;
1281
599
  showSidebar: boolean;
1282
600
  theme: "alternate" | "default" | "moon" | "purple" | "solarized" | "bluePlanet" | "deepSpace" | "saturn" | "kepler" | "elysiajs" | "fastify" | "mars" | "none";
1283
601
  layout: "modern" | "classic";
1284
602
  isEditable: boolean;
603
+ isLoading: boolean;
1285
604
  hideModels: boolean;
1286
605
  hideDownloadButton: boolean;
1287
606
  hideTestRequestButton: boolean;
1288
607
  hideSearch: boolean;
1289
608
  hideDarkModeToggle: boolean;
1290
609
  withDefaultFonts: boolean;
1291
- sources: {
1292
- url?: string | undefined;
1293
- content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
1294
- title?: string | undefined;
1295
- slug?: string | undefined;
1296
- }[];
1297
610
  url?: string | undefined;
1298
611
  content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
1299
612
  title?: string | undefined;
@@ -1323,6 +636,7 @@ export declare const apiReferenceConfigurationWithSourcesSchema: z.ZodEffects<z.
1323
636
  customCss?: string | undefined;
1324
637
  onSpecUpdate?: ((args_0: string, ...args: unknown[]) => void) | undefined;
1325
638
  onServerChange?: ((args_0: string, ...args: unknown[]) => void) | undefined;
639
+ onDocumentSelect?: ((...args: unknown[]) => void) | undefined;
1326
640
  pathRouting?: {
1327
641
  basePath: string;
1328
642
  } | undefined;
@@ -1351,12 +665,6 @@ export declare const apiReferenceConfigurationWithSourcesSchema: z.ZodEffects<z.
1351
665
  tagsSorter?: "alpha" | ((args_0: any, args_1: any, ...args: unknown[]) => number) | undefined;
1352
666
  operationsSorter?: "method" | "alpha" | ((args_0: any, args_1: any, ...args: unknown[]) => number) | undefined;
1353
667
  }, {
1354
- sources: {
1355
- url?: string | undefined;
1356
- content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
1357
- title?: string | undefined;
1358
- slug?: string | undefined;
1359
- }[];
1360
668
  url?: string | undefined;
1361
669
  content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
1362
670
  title?: string | undefined;
@@ -1379,6 +687,7 @@ export declare const apiReferenceConfigurationWithSourcesSchema: z.ZodEffects<z.
1379
687
  layout?: unknown;
1380
688
  proxy?: string | undefined;
1381
689
  isEditable?: unknown;
690
+ isLoading?: unknown;
1382
691
  hideModels?: unknown;
1383
692
  hideDownloadButton?: unknown;
1384
693
  hideTestRequestButton?: unknown;
@@ -1396,6 +705,7 @@ export declare const apiReferenceConfigurationWithSourcesSchema: z.ZodEffects<z.
1396
705
  customCss?: string | undefined;
1397
706
  onSpecUpdate?: ((args_0: string, ...args: unknown[]) => void) | undefined;
1398
707
  onServerChange?: ((args_0: string, ...args: unknown[]) => void) | undefined;
708
+ onDocumentSelect?: ((...args: unknown[]) => void) | undefined;
1399
709
  pathRouting?: {
1400
710
  basePath: string;
1401
711
  } | undefined;
@@ -1430,18 +740,13 @@ export declare const apiReferenceConfigurationWithSourcesSchema: z.ZodEffects<z.
1430
740
  theme: "alternate" | "default" | "moon" | "purple" | "solarized" | "bluePlanet" | "deepSpace" | "saturn" | "kepler" | "elysiajs" | "fastify" | "mars" | "none";
1431
741
  layout: "modern" | "classic";
1432
742
  isEditable: boolean;
743
+ isLoading: boolean;
1433
744
  hideModels: boolean;
1434
745
  hideDownloadButton: boolean;
1435
746
  hideTestRequestButton: boolean;
1436
747
  hideSearch: boolean;
1437
748
  hideDarkModeToggle: boolean;
1438
749
  withDefaultFonts: boolean;
1439
- sources: {
1440
- url?: string | undefined;
1441
- content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
1442
- title?: string | undefined;
1443
- slug?: string | undefined;
1444
- }[];
1445
750
  url?: string | undefined;
1446
751
  content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
1447
752
  title?: string | undefined;
@@ -1471,6 +776,7 @@ export declare const apiReferenceConfigurationWithSourcesSchema: z.ZodEffects<z.
1471
776
  customCss?: string | undefined;
1472
777
  onSpecUpdate?: ((args_0: string, ...args: unknown[]) => void) | undefined;
1473
778
  onServerChange?: ((args_0: string, ...args: unknown[]) => void) | undefined;
779
+ onDocumentSelect?: ((...args: unknown[]) => void) | undefined;
1474
780
  pathRouting?: {
1475
781
  basePath: string;
1476
782
  } | undefined;
@@ -1499,12 +805,6 @@ export declare const apiReferenceConfigurationWithSourcesSchema: z.ZodEffects<z.
1499
805
  tagsSorter?: "alpha" | ((args_0: any, args_1: any, ...args: unknown[]) => number) | undefined;
1500
806
  operationsSorter?: "method" | "alpha" | ((args_0: any, args_1: any, ...args: unknown[]) => number) | undefined;
1501
807
  }, {
1502
- sources: {
1503
- url?: string | undefined;
1504
- content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
1505
- title?: string | undefined;
1506
- slug?: string | undefined;
1507
- }[];
1508
808
  url?: string | undefined;
1509
809
  content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
1510
810
  title?: string | undefined;
@@ -1527,6 +827,7 @@ export declare const apiReferenceConfigurationWithSourcesSchema: z.ZodEffects<z.
1527
827
  layout?: unknown;
1528
828
  proxy?: string | undefined;
1529
829
  isEditable?: unknown;
830
+ isLoading?: unknown;
1530
831
  hideModels?: unknown;
1531
832
  hideDownloadButton?: unknown;
1532
833
  hideTestRequestButton?: unknown;
@@ -1544,6 +845,7 @@ export declare const apiReferenceConfigurationWithSourcesSchema: z.ZodEffects<z.
1544
845
  customCss?: string | undefined;
1545
846
  onSpecUpdate?: ((args_0: string, ...args: unknown[]) => void) | undefined;
1546
847
  onServerChange?: ((args_0: string, ...args: unknown[]) => void) | undefined;
848
+ onDocumentSelect?: ((...args: unknown[]) => void) | undefined;
1547
849
  pathRouting?: {
1548
850
  basePath: string;
1549
851
  } | undefined;
@@ -1573,9 +875,22 @@ export declare const apiReferenceConfigurationWithSourcesSchema: z.ZodEffects<z.
1573
875
  tagsSorter?: "alpha" | ((args_0: any, args_1: any, ...args: unknown[]) => number) | undefined;
1574
876
  operationsSorter?: "method" | "alpha" | ((args_0: any, args_1: any, ...args: unknown[]) => number) | undefined;
1575
877
  }>;
1576
- export type ApiReferenceConfigurationWithSources = Omit<z.infer<typeof apiReferenceConfigurationWithSourcesSchema>, 'proxy' | 'spec'>;
878
+ /** Configuration after parsing, this is the main type */
879
+ export type ApiReferenceConfiguration = Omit<z.infer<typeof apiReferenceConfigurationSchema>, 'proxy' | 'spec'>;
880
+ /** Api Config which includes the default config */
881
+ type ApiReferenceConfigurationWithDefault = ApiReferenceConfiguration & {
882
+ /** Whether to use this config as the default one */
883
+ default?: boolean;
884
+ };
885
+ /** Configuration for a single config with sources */
886
+ export type ApiReferenceConfigurationWithSources = Omit<ApiReferenceConfigurationWithDefault, 'default'> & {
887
+ sources: (SpecConfiguration & {
888
+ default?: boolean;
889
+ })[];
890
+ };
1577
891
  /** Configuration for multiple Api References */
1578
- export type MultiReferenceConfiguration = Partial<ApiReferenceConfiguration> | Partial<ApiReferenceConfiguration>[] | Partial<ApiReferenceConfigurationWithSources>;
892
+ export type AnyApiReferenceConfiguration = Partial<ApiReferenceConfiguration> | Partial<ApiReferenceConfigurationWithSources> | Partial<ApiReferenceConfigurationWithDefault>[];
1579
893
  /** Typeguard to check to narrow the configs to the one with sources */
1580
- export declare const isConfigurationWithSources: (config: MultiReferenceConfiguration) => config is Partial<ApiReferenceConfigurationWithSources>;
894
+ export declare const isConfigurationWithSources: (config: AnyApiReferenceConfiguration) => config is Partial<ApiReferenceConfigurationWithSources>;
895
+ export {};
1581
896
  //# sourceMappingURL=api-reference-configuration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-reference-configuration.d.ts","sourceRoot":"","sources":["../../src/api-reference/api-reference-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AA8EvB,0DAA0D;AAC1D,eAAO,MAAM,uBAAuB;IAClC;;;;;;;;;;;;;;;;;QAiBI;;IAEJ;;;;;;;;;;;;;;;;;;;;QAoBI;;IAEJ;;;;;;OAMG;;IAEH;;;;;;;;;;OAUG;;;;;;;;;;;;EAEH,CAAA;AACF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAQvE,uCAAuC;AACvC,eAAO,MAAM,4BAA4B;IACvC;;QAEI;;IAEJ;;;;;QAKI;;IAEJ;;;;OAIG;;IAEH;;;;;;;;OAQG;;IAEH;;;;QAII;;QAvGJ;;;;;;;;;;;;;;;;;YAiBI;;QAEJ;;;;;;;;;;;;;;;;;;;;YAoBI;;QAEJ;;;;;;WAMG;;QAEH;;;;;;;;;;WAUG;;;;;;;;;;;;;IA8CH,6BAA6B;;IAE7B,kCAAkC;;IAElC;;;OAGG;;IAEH,gDAAgD;;IAEhD,mFAAmF;;IAEnF,qCAAqC;;IAErC;;;OAGG;;IAEH,+CAA+C;;IAE/C,kC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CAAoC,GAAG,IAAI,CAAC,oCAAoC,EAAE,SAAS,CAAC,GAAG;IACzG,OAAO,EAAE,CAAC,iBAAiB,GAAG;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,EAAE,CAAA;CACvD,CAAA;AAED,gDAAgD;AAChD,MAAM,MAAM,4BAA4B,GACpC,OAAO,CAAC,yBAAyB,CAAC,GAClC,OAAO,CAAC,oCAAoC,CAAC,GAC7C,OAAO,CAAC,oCAAoC,CAAC,EAAE,CAAA;AAEnD,uEAAuE;AACvE,eAAO,MAAM,0BAA0B,WAC7B,4BAA4B,KACnC,MAAM,IAAI,OAAO,CAAC,oCAAoC,CAC0C,CAAA"}
@@ -202,7 +202,7 @@ const apiClientConfigurationSchema = z.object({
202
202
  });
203
203
  const OLD_PROXY_URL = 'https://api.scalar.com/request-proxy';
204
204
  const NEW_PROXY_URL = 'https://proxy.scalar.com';
205
- /** Configuration for the Api Reference without the transform since it cannot be merged */
205
+ /** Configuration for the Api Client without the transform since it cannot be merged */
206
206
  const _apiReferenceConfigurationSchema = apiClientConfigurationSchema.merge(z.object({
207
207
  /**
208
208
  * The layout to use for the references
@@ -219,6 +219,11 @@ const _apiReferenceConfigurationSchema = apiClientConfigurationSchema.merge(z.ob
219
219
  * @default false
220
220
  */
221
221
  isEditable: z.boolean().optional().default(false).catch(false),
222
+ /**
223
+ * Controls whether the references show a loading state in the intro
224
+ * @default false
225
+ */
226
+ isLoading: z.boolean().optional().default(false).catch(false),
222
227
  /**
223
228
  * Whether to show models in the sidebar, search, and content.
224
229
  * @default false
@@ -279,6 +284,8 @@ const _apiReferenceConfigurationSchema = apiClientConfigurationSchema.merge(z.ob
279
284
  onSpecUpdate: z.function().args(z.string()).returns(z.void()).optional(),
280
285
  /** onServerChange is fired on selected server change */
281
286
  onServerChange: z.function().args(z.string()).returns(z.void()).optional(),
287
+ /** onDocumentSelect is fired when the config is selected */
288
+ onDocumentSelect: z.function().returns(z.void()).optional(),
282
289
  /**
283
290
  * Route using paths instead of hashes, your server MUST support this
284
291
  * @example '/standalone-api-reference/:custom(.*)?'
@@ -392,10 +399,6 @@ const _apiReferenceConfigurationSchema = apiClientConfigurationSchema.merge(z.ob
392
399
  .union([z.literal('alpha'), z.literal('method'), z.function().args(z.any(), z.any()).returns(z.number())])
393
400
  .optional(),
394
401
  }));
395
- /** Configuration for the Api Reference with sources before transforming */
396
- const _apiReferenceConfigurationWithSourcesSchema = _apiReferenceConfigurationSchema.merge(z.object({
397
- sources: z.array(specConfigurationSchema),
398
- }));
399
402
  /** Migrate the configuration through a transform */
400
403
  const migrateConfiguration = (_configuration) => {
401
404
  const configuration = { ..._configuration };
@@ -432,9 +435,7 @@ const migrateConfiguration = (_configuration) => {
432
435
  };
433
436
  /** Configuration for the Api Reference */
434
437
  const apiReferenceConfigurationSchema = _apiReferenceConfigurationSchema.transform(migrateConfiguration);
435
- /** Props for the ApiReference components, coming from user input */
436
- const apiReferenceConfigurationWithSourcesSchema = _apiReferenceConfigurationWithSourcesSchema.transform(migrateConfiguration);
437
438
  /** Typeguard to check to narrow the configs to the one with sources */
438
439
  const isConfigurationWithSources = (config) => Boolean(!Array.isArray(config) && config && 'sources' in config && Array.isArray(config.sources));
439
440
 
440
- export { apiClientConfigurationSchema, apiReferenceConfigurationSchema, apiReferenceConfigurationWithSourcesSchema, isConfigurationWithSources, specConfigurationSchema };
441
+ export { apiClientConfigurationSchema, apiReferenceConfigurationSchema, isConfigurationWithSources, specConfigurationSchema };
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-theme-variables.d.ts","sourceRoot":"","sources":["../../../src/api-reference/helpers/migrate-theme-variables.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,eAAO,MAAM,iBAAiB,6FAGpB,CAAA;AAEV,eAAO,MAAM,eAAe,+BAA8C,CAAA;AAE1E;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAU5D"}
1
+ {"version":3,"file":"migrate-theme-variables.d.ts","sourceRoot":"","sources":["../../../src/api-reference/helpers/migrate-theme-variables.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,eAAO,MAAM,iBAAiB,6FAGpB,CAAA;AAEV,eAAO,MAAM,eAAe,+BAA8C,CAAA;AAE1E;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAY5D"}
@@ -11,8 +11,9 @@ const LEGACY_PREFIXES = PREFIX_MIGRATIONS.map(([legacy]) => legacy);
11
11
  */
12
12
  function migrateThemeVariables(styles) {
13
13
  const hasLegacyPrefixes = LEGACY_PREFIXES.some((p) => styles.includes(p));
14
- if (!hasLegacyPrefixes)
14
+ if (!hasLegacyPrefixes) {
15
15
  return styles;
16
+ }
16
17
  console.warn(`DEPRECATION WARNING: It looks like you're using legacy CSS variables in your custom CSS string. Please migrate them to use the updated prefixes. See https://github.com/scalar/scalar/blob/main/documentation/themes.md#theme-prefix-changes`);
17
18
  // Replaces each old variable in the prefix migrations
18
19
  return PREFIX_MIGRATIONS.reduce((s, [o, n]) => s.replaceAll(o, n), styles);
@@ -1,4 +1,4 @@
1
- export { type ApiClientConfiguration, type ApiReferenceConfiguration, type ApiReferenceConfigurationWithSources, type MultiReferenceConfiguration, type SpecConfiguration, apiClientConfigurationSchema, apiReferenceConfigurationSchema, apiReferenceConfigurationWithSourcesSchema, specConfigurationSchema, isConfigurationWithSources, } from './api-reference-configuration.ts';
1
+ export { type ApiClientConfiguration, type ApiReferenceConfiguration, type ApiReferenceConfigurationWithSources, type AnyApiReferenceConfiguration, type SpecConfiguration, apiClientConfigurationSchema, apiReferenceConfigurationSchema, specConfigurationSchema, isConfigurationWithSources, } from './api-reference-configuration.ts';
2
2
  export { type HtmlRenderingConfiguration, htmlRenderingConfigurationSchema, } from './html-rendering-configuration.ts';
3
3
  export { migrateThemeVariables } from './helpers/migrate-theme-variables.ts';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api-reference/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,oCAAoC,EACzC,KAAK,2BAA2B,EAChC,KAAK,iBAAiB,EACtB,4BAA4B,EAC5B,+BAA+B,EAC/B,0CAA0C,EAC1C,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,kCAAkC,CAAA;AAEzC,OAAO,EACL,KAAK,0BAA0B,EAC/B,gCAAgC,GACjC,MAAM,mCAAmC,CAAA;AAE1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api-reference/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,oCAAoC,EACzC,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EACtB,4BAA4B,EAC5B,+BAA+B,EAC/B,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,kCAAkC,CAAA;AAEzC,OAAO,EACL,KAAK,0BAA0B,EAC/B,gCAAgC,GACjC,MAAM,mCAAmC,CAAA;AAE1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAA"}
@@ -1,3 +1,3 @@
1
- export { apiClientConfigurationSchema, apiReferenceConfigurationSchema, apiReferenceConfigurationWithSourcesSchema, isConfigurationWithSources, specConfigurationSchema } from './api-reference-configuration.js';
1
+ export { apiClientConfigurationSchema, apiReferenceConfigurationSchema, isConfigurationWithSources, specConfigurationSchema } from './api-reference-configuration.js';
2
2
  export { htmlRenderingConfigurationSchema } from './html-rendering-configuration.js';
3
3
  export { migrateThemeVariables } from './helpers/migrate-theme-variables.js';
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "scalar",
17
17
  "references"
18
18
  ],
19
- "version": "0.1.1",
19
+ "version": "0.1.3",
20
20
  "engines": {
21
21
  "node": ">=18"
22
22
  },