@scalar/api-client 2.21.0 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/components/OpenApiClientButton.vue.d.ts.map +1 -1
  3. package/dist/components/OpenApiClientButton.vue.js +2 -2
  4. package/dist/components/OpenApiClientButton.vue2.js +1 -1
  5. package/dist/hooks/useClientConfig.d.ts +9 -0
  6. package/dist/hooks/useClientConfig.d.ts.map +1 -1
  7. package/dist/layouts/App/create-api-client-app.d.ts +2 -2
  8. package/dist/layouts/Web/create-api-client-web.d.ts +2 -2
  9. package/dist/libs/create-client.d.ts +2 -2
  10. package/dist/store/request-example.d.ts +2 -2
  11. package/dist/store/store.d.ts +2 -2
  12. package/dist/style.css +1 -1
  13. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts +2 -2
  14. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -1
  15. package/dist/v2/blocks/operation-block/helpers/get-example.js +29 -22
  16. package/dist/v2/blocks/operation-block/index.d.ts +1 -0
  17. package/dist/v2/blocks/operation-block/index.d.ts.map +1 -1
  18. package/dist/v2/blocks/operation-block/index.js +2 -0
  19. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
  20. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +2 -2
  21. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +4 -4
  22. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +3 -2
  23. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +1 -1
  24. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.js +96 -78
  25. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue3.js +5 -0
  26. package/dist/v2/features/app/App.vue.d.ts +3 -0
  27. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  28. package/dist/v2/features/app/App.vue.js +43 -42
  29. package/dist/v2/features/app/app-events.d.ts +1 -3
  30. package/dist/v2/features/app/app-events.d.ts.map +1 -1
  31. package/dist/v2/features/app/app-events.js +37 -43
  32. package/dist/v2/features/app/app-state.d.ts +0 -2
  33. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  34. package/dist/v2/features/app/app-state.js +87 -90
  35. package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
  36. package/dist/v2/features/app/helpers/create-api-client-app.js +14 -8
  37. package/dist/v2/features/app/index.d.ts +1 -0
  38. package/dist/v2/features/app/index.d.ts.map +1 -1
  39. package/dist/v2/features/app/index.js +11 -7
  40. package/dist/v2/features/command-palette/{components/TheCommandPalette.vue.d.ts → TheCommandPalette.vue.d.ts} +3 -3
  41. package/dist/v2/features/command-palette/TheCommandPalette.vue.d.ts.map +1 -0
  42. package/dist/v2/features/command-palette/TheCommandPalette.vue.js +7 -0
  43. package/dist/v2/features/command-palette/TheCommandPalette.vue2.js +152 -0
  44. package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts +9 -2
  45. package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts.map +1 -1
  46. package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.js +61 -55
  47. package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue.d.ts +2 -2
  48. package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue.d.ts.map +1 -1
  49. package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue.js +1 -1
  50. package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue2.js +26 -26
  51. package/dist/v2/features/command-palette/helpers/get-operation-from-curl.d.ts.map +1 -1
  52. package/dist/v2/features/command-palette/helpers/get-operation-from-curl.js +30 -24
  53. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +240 -151
  54. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -1
  55. package/dist/v2/features/command-palette/hooks/use-command-palette-state.js +114 -102
  56. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  57. package/dist/v2/features/modal/Modal.vue.js +2 -2
  58. package/dist/v2/features/modal/Modal.vue2.js +17 -15
  59. package/dist/v2/features/operation/Operation.vue.js +1 -1
  60. package/dist/views/Request/RequestSection/RequestTable.vue.d.ts +2 -2
  61. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  62. package/package.json +17 -22
  63. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue2.js +0 -4
  64. package/dist/v2/features/command-palette/components/TheCommandPalette.vue.d.ts.map +0 -1
  65. package/dist/v2/features/command-palette/components/TheCommandPalette.vue.js +0 -7
  66. package/dist/v2/features/command-palette/components/TheCommandPalette.vue2.js +0 -172
  67. package/dist/v2/features/command-palette/components/index.d.ts +0 -2
  68. package/dist/v2/features/command-palette/components/index.d.ts.map +0 -1
  69. package/dist/v2/features/command-palette/components/index.js +0 -4
  70. package/dist/v2/features/command-palette/types.d.ts +0 -83
  71. package/dist/v2/features/command-palette/types.d.ts.map +0 -1
@@ -1,83 +0,0 @@
1
- import type { WorkspaceStore } from '@scalar/workspace-store/client';
2
- import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
3
- import type { AllowedComponentProps, Component, VNodeProps } from 'vue';
4
- import type { CommandPropsMap, OpenCommandEvent, UiCommandIds } from '../../../v2/features/command-palette/hooks/use-command-palette-state.js';
5
- /**
6
- * Default props that all command components receive.
7
- * These are injected automatically by the command palette.
8
- */
9
- type DefaultCommandProps = {
10
- /** The workspace store for accessing documents and operations */
11
- workspaceStore: WorkspaceStore;
12
- /** Event bus for emitting workspace events */
13
- eventBus: WorkspaceEventBus;
14
- /** Function to open a command */
15
- 'onOpen-command': OpenCommandEvent;
16
- };
17
- /** Helper type to make all properties writable */
18
- type Writable<T> = {
19
- -readonly [K in keyof T]: T[K];
20
- };
21
- /**
22
- * Extracts the props type from a Vue component.
23
- * Strips out VNode and Vue-specific props to get only user-defined props.
24
- */
25
- type ComponentProps<C extends Component> = C extends new (...args: any) => {
26
- $props: infer P;
27
- } ? Omit<P, keyof VNodeProps | keyof AllowedComponentProps> : never;
28
- /**
29
- * Maps command IDs to their actual component props.
30
- * Used for validating that components accept the correct props.
31
- */
32
- type CommandComponentPropsMap<T extends Record<string, Component>> = {
33
- [K in keyof T]: ComponentProps<T[K]>;
34
- };
35
- /**
36
- * Maps command IDs to their expected props (default props + command-specific props).
37
- * This is what each command component should accept.
38
- */
39
- type ExpectedCommandComponentPropsMap = {
40
- [K in UiCommandIds]: DefaultCommandProps & (CommandPropsMap[K] extends undefined ? unknown : CommandPropsMap[K]);
41
- };
42
- /** Helper type to flatten and display complex types in IDE tooltips */
43
- type Prettify<T> = {
44
- [K in keyof T]: T[K];
45
- } & {};
46
- /**
47
- * Type-level assertion that compares actual component props with expected props.
48
- * Returns 'valid' if they match, otherwise returns a detailed debug object.
49
- *
50
- * Using literals prevents union collapse (true | never = true, but 'valid' | object stays distinct).
51
- */
52
- type AssertPropsMatch<Actual, Expected> = [Actual] extends [Expected] ? 'valid' : {
53
- status: 'invalid';
54
- actual: Prettify<Actual>;
55
- expected: Prettify<Expected>;
56
- missingProps: Prettify<Exclude<keyof Expected, keyof Actual>>;
57
- };
58
- /**
59
- * Validates that all command components have the correct props.
60
- * This type is used at the type-checking level to ensure type safety.
61
- */
62
- type CommandComponentPropsCheck<T extends Record<string, Component>> = {
63
- [K in UiCommandIds]: AssertPropsMatch<Writable<CommandComponentPropsMap<T>[K]>, Partial<ExpectedCommandComponentPropsMap[K]>>;
64
- };
65
- /** All validation results for command components */
66
- type PropsCheckResults<T extends Record<string, Component>> = CommandComponentPropsCheck<T>[keyof CommandComponentPropsCheck<T>];
67
- /**
68
- * Filter to show only invalid components.
69
- * Makes error messages clearer by excluding valid components.
70
- */
71
- type InvalidComponents<T extends Record<string, Component>> = {
72
- [K in keyof CommandComponentPropsCheck<T> as CommandComponentPropsCheck<T>[K] extends 'valid' ? never : K]: CommandComponentPropsCheck<T>[K];
73
- };
74
- /**
75
- * Final assertion type that shows only errors.
76
- * If all components are valid, evaluates to 'valid'.
77
- * If any component is invalid, shows only the invalid ones.
78
- */
79
- export type AssertAllValid<T extends Record<string, Component>> = PropsCheckResults<T> extends 'valid' ? PropsCheckResults<T> extends {
80
- status: 'invalid';
81
- } ? Prettify<InvalidComponents<T>> : PropsCheckResults<T> : Prettify<InvalidComponents<T>>;
82
- export {};
83
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/command-palette/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAEvE,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,YAAY,EACb,MAAM,+DAA+D,CAAA;AAEtE;;;GAGG;AACH,KAAK,mBAAmB,GAAG;IACzB,iEAAiE;IACjE,cAAc,EAAE,cAAc,CAAA;IAC9B,8CAA8C;IAC9C,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,iCAAiC;IACjC,gBAAgB,EAAE,gBAAgB,CAAA;CACnC,CAAA;AAED,kDAAkD;AAClD,KAAK,QAAQ,CAAC,CAAC,IAAI;IAAE,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAA;AAErD;;;GAGG;AACH,KAAK,cAAc,CAAC,CAAC,SAAS,SAAS,IAAI,CAAC,SAAS,KACnD,GAAG,IAAI,EAAE,GAAG,KACT;IACH,MAAM,EAAE,MAAM,CAAC,CAAA;CAChB,GACG,IAAI,CAAC,CAAC,EAAE,MAAM,UAAU,GAAG,MAAM,qBAA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