@scalar/api-client 2.12.0 → 2.13.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.
- package/CHANGELOG.md +42 -0
- package/dist/components/CodeInput/CodeInput.vue.d.ts +1 -1
- package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandActionForm.vue.d.ts +2 -2
- package/dist/components/CommandPalette/CommandActionForm.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandActionForm.vue.js +14 -14
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +38 -38
- package/dist/components/EmptyState.vue.d.ts.map +1 -1
- package/dist/components/EmptyState.vue.js +2 -2
- package/dist/components/EmptyState.vue2.js +27 -16
- package/dist/components/TopNav/TopNav.vue.js +33 -33
- package/dist/layouts/App/create-api-client-app.d.ts +28 -28
- package/dist/layouts/Web/create-api-client-web.d.ts +28 -28
- package/dist/libs/create-client.d.ts +28 -28
- package/dist/libs/hot-keys.d.ts +2 -2
- package/dist/libs/send-request/create-fetch-body.d.ts +2 -2
- package/dist/store/active-entities.d.ts +2 -2
- package/dist/store/collections.d.ts +4 -4
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +8 -8
- package/dist/store/request-example.d.ts +12 -12
- package/dist/store/store.d.ts +28 -28
- package/dist/store/workspace.d.ts +12 -12
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +1 -2
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js +9 -8
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.js +3 -3
- package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue2.js +14 -11
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.js +22 -22
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts +2 -2
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js +2 -2
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue2.js +18 -15
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js +2 -2
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue2.js +17 -17
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +2 -2
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +17 -12
- package/dist/v2/blocks/scalar-address-bar-block/index.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +205 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +52 -52
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +205 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts +1 -2
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js +1 -1
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js +126 -103
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts +0 -2
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue2.js +56 -53
- package/dist/v2/features/app/components/DesktopTab.vue.d.ts +26 -0
- package/dist/v2/features/app/components/DesktopTab.vue.d.ts.map +1 -0
- package/dist/v2/features/app/components/DesktopTab.vue.js +7 -0
- package/dist/v2/features/app/components/DesktopTab.vue2.js +134 -0
- package/dist/v2/features/app/components/DesktopTabs.vue.d.ts +9 -4
- package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/DesktopTabs.vue.js +47 -13
- package/dist/v2/features/app/components/DesktopTabs.vue2.js +2 -4
- package/dist/v2/features/app/components/SplashScreen.vue.js +2 -2
- package/dist/v2/features/app/components/SplashScreen.vue2.js +2 -2
- package/dist/v2/features/app/helpers/routes.js +1 -1
- package/dist/v2/features/collection/components/Settings.vue2.js +3 -3
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.d.ts +61 -0
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.js +48 -0
- package/dist/v2/features/command-palette/components/CommandActionForm.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/CommandActionInput.vue.d.ts +39 -0
- package/dist/v2/features/command-palette/components/CommandActionInput.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandActionInput.vue.js +52 -0
- package/dist/v2/features/command-palette/components/CommandActionInput.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue.d.ts +36 -0
- package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue.js +78 -0
- package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts +30 -0
- package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.js +169 -0
- package/dist/v2/features/command-palette/components/CommandPaletteExample.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts +34 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.js +175 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue.d.ts +43 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue.js +7 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue2.js +115 -0
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts +39 -0
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.js +213 -0
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts +38 -0
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.js +89 -0
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/TheCommandPalette.vue.d.ts +41 -0
- package/dist/v2/features/command-palette/components/TheCommandPalette.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/TheCommandPalette.vue.js +7 -0
- package/dist/v2/features/command-palette/components/TheCommandPalette.vue2.js +172 -0
- package/dist/v2/features/command-palette/components/WatchModeToggle.vue.d.ts +33 -0
- package/dist/v2/features/command-palette/components/WatchModeToggle.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/WatchModeToggle.vue.js +40 -0
- package/dist/v2/features/command-palette/components/WatchModeToggle.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/index.d.ts +2 -0
- package/dist/v2/features/command-palette/components/index.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/index.js +4 -0
- package/dist/v2/features/command-palette/helpers/get-openapi-document-details.d.ts +23 -0
- package/dist/v2/features/command-palette/helpers/get-openapi-document-details.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/get-openapi-document-details.js +31 -0
- package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts +13 -0
- package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.js +12 -0
- package/dist/v2/features/command-palette/helpers/get-operation-from-curl.d.ts +26 -0
- package/dist/v2/features/command-palette/helpers/get-operation-from-curl.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/get-operation-from-curl.js +70 -0
- package/dist/v2/features/command-palette/helpers/get-postman-document-details.d.ts +23 -0
- package/dist/v2/features/command-palette/helpers/get-postman-document-details.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/get-postman-document-details.js +18 -0
- package/dist/v2/features/command-palette/helpers/is-postman-collection.d.ts +11 -0
- package/dist/v2/features/command-palette/helpers/is-postman-collection.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/is-postman-collection.js +11 -0
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +202 -0
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -0
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.js +109 -0
- package/dist/v2/features/command-palette/types.d.ts +82 -0
- package/dist/v2/features/command-palette/types.d.ts.map +1 -0
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js +24 -20
- package/dist/v2/helpers/drag-handle-factory.d.ts +1 -2
- package/dist/v2/helpers/drag-handle-factory.d.ts.map +1 -1
- package/dist/v2/helpers/drag-handle-factory.js +74 -90
- package/dist/v2/helpers/get-tab-details.d.ts +43 -0
- package/dist/v2/helpers/get-tab-details.d.ts.map +1 -0
- package/dist/v2/helpers/get-tab-details.js +34 -0
- package/dist/v2/helpers/handle-hotkeys.js +1 -1
- package/dist/v2/helpers/is-url.d.ts +2 -0
- package/dist/v2/helpers/is-url.d.ts.map +1 -0
- package/dist/v2/helpers/is-url.js +5 -0
- package/dist/v2/helpers/remove-circular.d.ts +15 -0
- package/dist/v2/helpers/remove-circular.d.ts.map +1 -0
- package/dist/v2/helpers/remove-circular.js +18 -0
- package/dist/v2/helpers/storage.d.ts +4 -6
- package/dist/v2/helpers/storage.d.ts.map +1 -1
- package/dist/v2/helpers/storage.js +8 -12
- package/dist/v2/hooks/use-sidebar-state.d.ts +12 -19
- package/dist/v2/hooks/use-sidebar-state.d.ts.map +1 -1
- package/dist/v2/hooks/use-sidebar-state.js +20 -18
- package/dist/v2/hooks/use-sync-path.d.ts +11 -0
- package/dist/v2/hooks/use-sync-path.d.ts.map +1 -0
- package/dist/v2/hooks/use-sync-path.js +51 -0
- package/dist/v2/hooks/use-tabs.d.ts +31 -0
- package/dist/v2/hooks/use-tabs.d.ts.map +1 -0
- package/dist/v2/hooks/use-tabs.js +44 -0
- package/dist/v2/hooks/use-workspace-client-events.d.ts +5 -2
- package/dist/v2/hooks/use-workspace-client-events.d.ts.map +1 -1
- package/dist/v2/hooks/use-workspace-client-events.js +91 -36
- package/dist/v2/hooks/use-workspace-selector.d.ts +16 -6
- package/dist/v2/hooks/use-workspace-selector.d.ts.map +1 -1
- package/dist/v2/hooks/use-workspace-selector.js +58 -64
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +78 -78
- package/dist/views/Request/ResponseSection/ResponseBodyStreaming.vue.js +29 -29
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue.js +2 -2
- package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue2.js +19 -19
- package/package.json +136 -46
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import type { Icon as IconType } from '@scalar/components';
|
|
2
|
+
import { type ComputedRef, type Ref } from 'vue';
|
|
3
|
+
import type { RouteLocationRaw } from 'vue-router';
|
|
4
|
+
/** Base properties shared by all command types (internal) */
|
|
5
|
+
type CommandBase = {
|
|
6
|
+
/** Unique identifier for the command */
|
|
7
|
+
id: string;
|
|
8
|
+
/** Display name shown in the command palette */
|
|
9
|
+
name: string;
|
|
10
|
+
};
|
|
11
|
+
type FolderCommand = CommandBase & {
|
|
12
|
+
type: 'folder';
|
|
13
|
+
icon: IconType;
|
|
14
|
+
/** Props for the command */
|
|
15
|
+
props?: Record<string, unknown>;
|
|
16
|
+
};
|
|
17
|
+
type HiddenFolderCommand = CommandBase & {
|
|
18
|
+
type: 'hidden-folder';
|
|
19
|
+
/** Props for the command */
|
|
20
|
+
props?: Record<string, unknown>;
|
|
21
|
+
};
|
|
22
|
+
type RouteCommand = CommandBase & {
|
|
23
|
+
type: 'route';
|
|
24
|
+
to: RouteLocationRaw;
|
|
25
|
+
icon: IconType;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Represents a single command in the command palette.
|
|
29
|
+
* Commands can be folders (open sub-actions), routes (navigate), or hidden folders.
|
|
30
|
+
*/
|
|
31
|
+
export type Command = FolderCommand | RouteCommand | HiddenFolderCommand;
|
|
32
|
+
/**
|
|
33
|
+
* A group of related commands with a label.
|
|
34
|
+
* Used to organize commands into categories in the palette.
|
|
35
|
+
*/
|
|
36
|
+
export type CommandGroup = {
|
|
37
|
+
/** Label for the command group (empty string for unlabeled groups) */
|
|
38
|
+
label: string;
|
|
39
|
+
/** List of commands in this group */
|
|
40
|
+
commands: Command[];
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Available commands in the command palette.
|
|
44
|
+
* Organized into groups for better UX and discoverability.
|
|
45
|
+
*/
|
|
46
|
+
export declare const commands: [{
|
|
47
|
+
readonly label: "";
|
|
48
|
+
readonly commands: [{
|
|
49
|
+
readonly type: "folder";
|
|
50
|
+
readonly id: "import-from-openapi-swagger-postman-curl";
|
|
51
|
+
readonly name: "Import from OpenAPI/Swagger/Postman/cURL";
|
|
52
|
+
readonly icon: "Import";
|
|
53
|
+
}, {
|
|
54
|
+
readonly type: "folder";
|
|
55
|
+
readonly id: "create-document";
|
|
56
|
+
readonly name: "Create Document";
|
|
57
|
+
readonly icon: "Collection";
|
|
58
|
+
}, {
|
|
59
|
+
readonly type: "folder";
|
|
60
|
+
readonly id: "add-tag";
|
|
61
|
+
readonly name: "Add Tag";
|
|
62
|
+
readonly icon: "Folder";
|
|
63
|
+
}, {
|
|
64
|
+
readonly type: "folder";
|
|
65
|
+
readonly id: "create-request";
|
|
66
|
+
readonly name: "Create Request";
|
|
67
|
+
readonly icon: "ExternalLink";
|
|
68
|
+
}, {
|
|
69
|
+
readonly type: "folder";
|
|
70
|
+
readonly id: "add-example";
|
|
71
|
+
readonly name: "Add Example";
|
|
72
|
+
readonly icon: "Example";
|
|
73
|
+
}, {
|
|
74
|
+
readonly type: "hidden-folder";
|
|
75
|
+
readonly id: "import-curl-command";
|
|
76
|
+
readonly name: "Import cURL Command";
|
|
77
|
+
readonly props: {
|
|
78
|
+
curl: string;
|
|
79
|
+
};
|
|
80
|
+
}];
|
|
81
|
+
}, {
|
|
82
|
+
readonly label: "Pages";
|
|
83
|
+
readonly commands: [{
|
|
84
|
+
readonly type: "route";
|
|
85
|
+
readonly id: "environment";
|
|
86
|
+
readonly name: "Environment";
|
|
87
|
+
readonly icon: "Brackets";
|
|
88
|
+
readonly to: {
|
|
89
|
+
readonly name: "workspace.environment";
|
|
90
|
+
};
|
|
91
|
+
}, {
|
|
92
|
+
readonly type: "route";
|
|
93
|
+
readonly id: "cookies";
|
|
94
|
+
readonly name: "Cookies";
|
|
95
|
+
readonly icon: "Cookie";
|
|
96
|
+
readonly to: {
|
|
97
|
+
readonly name: "workspace.cookies";
|
|
98
|
+
};
|
|
99
|
+
}, {
|
|
100
|
+
readonly type: "route";
|
|
101
|
+
readonly id: "settings";
|
|
102
|
+
readonly name: "Settings";
|
|
103
|
+
readonly icon: "Settings";
|
|
104
|
+
readonly to: {
|
|
105
|
+
readonly name: "workspace.settings";
|
|
106
|
+
};
|
|
107
|
+
}];
|
|
108
|
+
}];
|
|
109
|
+
type FlatCommand = (typeof commands)[number]['commands'][number];
|
|
110
|
+
export type FolderCommandIds = Extract<FlatCommand, {
|
|
111
|
+
type: 'folder';
|
|
112
|
+
}>['id'];
|
|
113
|
+
export type HiddenFolderCommandIds = Extract<FlatCommand, {
|
|
114
|
+
type: 'hidden-folder';
|
|
115
|
+
}>['id'];
|
|
116
|
+
/** Command IDs that map to UI components (folder and hidden-folder types) */
|
|
117
|
+
export type UiCommandIds = FolderCommandIds | HiddenFolderCommandIds;
|
|
118
|
+
/**
|
|
119
|
+
* Maps each command ID to its respective props type.
|
|
120
|
+
* If a command has no props defined, it maps to undefined.
|
|
121
|
+
*
|
|
122
|
+
* This is used by the type system to validate that command components
|
|
123
|
+
* accept the correct props for their respective command IDs.
|
|
124
|
+
*/
|
|
125
|
+
export type CommandPropsMap = {
|
|
126
|
+
[K in UiCommandIds]: Extract<FlatCommand, {
|
|
127
|
+
id: K;
|
|
128
|
+
}> extends {
|
|
129
|
+
props: infer P;
|
|
130
|
+
} ? P : undefined;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Type for the open function in the command palette.
|
|
134
|
+
* Supports two usage patterns:
|
|
135
|
+
* - open() - Opens the palette without a specific command
|
|
136
|
+
* - open(commandId) - Opens a command that does not require props
|
|
137
|
+
* - open(commandId, props) - Opens a command with required props
|
|
138
|
+
*/
|
|
139
|
+
export type OpenCommand = {
|
|
140
|
+
(): void;
|
|
141
|
+
<T extends UiCommandIds>(commandId: T, props: CommandPropsMap[T]): void;
|
|
142
|
+
};
|
|
143
|
+
export type OpenCommandEvent = <T extends UiCommandIds>(event: 'open-command', commandId: T, ...args: CommandPropsMap[T] extends undefined ? [] : [props: CommandPropsMap[T]]) => void;
|
|
144
|
+
/**
|
|
145
|
+
* Return type for the useCommandPaletteState composable.
|
|
146
|
+
* Provides reactive state and methods to control the command palette.
|
|
147
|
+
*/
|
|
148
|
+
export type UseCommandPaletteStateReturn = {
|
|
149
|
+
/** Whether the command palette is currently open */
|
|
150
|
+
isOpen: Ref<boolean>;
|
|
151
|
+
/** The currently active command, or null if showing the main list */
|
|
152
|
+
activeCommand: Ref<UiCommandIds | null>;
|
|
153
|
+
/** Properties passed to the active command component */
|
|
154
|
+
activeCommandProps: Ref<Record<string, unknown> | null>;
|
|
155
|
+
/** Current filter/search query for filtering commands */
|
|
156
|
+
filterQuery: Ref<string>;
|
|
157
|
+
/** Filtered commands based on the current search query */
|
|
158
|
+
filteredCommands: ComputedRef<readonly CommandGroup[]>;
|
|
159
|
+
/**
|
|
160
|
+
* Opens the command palette, optionally with a specific command active.
|
|
161
|
+
* When opening a command, props are required only if the command defines them.
|
|
162
|
+
*/
|
|
163
|
+
open: OpenCommand;
|
|
164
|
+
/** Closes the command palette and resets state */
|
|
165
|
+
close: () => void;
|
|
166
|
+
/** Updates the filter query for searching commands */
|
|
167
|
+
setFilterQuery: (query: string) => void;
|
|
168
|
+
/** Resets all state to initial values */
|
|
169
|
+
reset: () => void;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Composable for managing command palette state.
|
|
173
|
+
*
|
|
174
|
+
* Centralizes all state management for the command palette including:
|
|
175
|
+
* - Open/closed state
|
|
176
|
+
* - Filter/search query
|
|
177
|
+
* - Command filtering logic
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* const palette = useCommandPaletteState()
|
|
181
|
+
*
|
|
182
|
+
* // Open the palette
|
|
183
|
+
* palette.open()
|
|
184
|
+
*
|
|
185
|
+
* // Open with a specific command
|
|
186
|
+
* palette.open('create-document')
|
|
187
|
+
*
|
|
188
|
+
* // Open with command props
|
|
189
|
+
* palette.open('import-curl-command', { curl: 'curl https://api.example.com' })
|
|
190
|
+
*
|
|
191
|
+
* // Update filter query (automatically filters commands)
|
|
192
|
+
* palette.setFilterQuery('import')
|
|
193
|
+
*
|
|
194
|
+
* // Access filtered results
|
|
195
|
+
* console.log(palette.filteredCommands.value)
|
|
196
|
+
*
|
|
197
|
+
* // Close and reset
|
|
198
|
+
* palette.close()
|
|
199
|
+
*/
|
|
200
|
+
export declare const useCommandPaletteState: () => UseCommandPaletteStateReturn;
|
|
201
|
+
export {};
|
|
202
|
+
//# sourceMappingURL=use-command-palette-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-command-palette-state.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/hooks/use-command-palette-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE1D,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,GAAG,EAAiB,MAAM,KAAK,CAAA;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAQlD,6DAA6D;AAC7D,KAAK,WAAW,GAAG;IACjB,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAA;IACV,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,KAAK,aAAa,GAAG,WAAW,GAAG;IACjC,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,EAAE,QAAQ,CAAA;IACd,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC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;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,sBAAsB,QAAO,4BAmFzC,CAAA"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { useModal as y } from "@scalar/components";
|
|
2
|
+
import { ref as m, computed as i } from "vue";
|
|
3
|
+
const g = () => null, v = [
|
|
4
|
+
{
|
|
5
|
+
label: "",
|
|
6
|
+
commands: [
|
|
7
|
+
{
|
|
8
|
+
type: "folder",
|
|
9
|
+
id: "import-from-openapi-swagger-postman-curl",
|
|
10
|
+
name: "Import from OpenAPI/Swagger/Postman/cURL",
|
|
11
|
+
icon: "Import"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
type: "folder",
|
|
15
|
+
id: "create-document",
|
|
16
|
+
name: "Create Document",
|
|
17
|
+
icon: "Collection"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: "folder",
|
|
21
|
+
id: "add-tag",
|
|
22
|
+
name: "Add Tag",
|
|
23
|
+
icon: "Folder"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: "folder",
|
|
27
|
+
id: "create-request",
|
|
28
|
+
name: "Create Request",
|
|
29
|
+
icon: "ExternalLink"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: "folder",
|
|
33
|
+
id: "add-example",
|
|
34
|
+
name: "Add Example",
|
|
35
|
+
icon: "Example"
|
|
36
|
+
},
|
|
37
|
+
/** Hidden commands accessible programmatically but not shown in UI */
|
|
38
|
+
{
|
|
39
|
+
type: "hidden-folder",
|
|
40
|
+
id: "import-curl-command",
|
|
41
|
+
name: "Import cURL Command",
|
|
42
|
+
props: g()
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: "Pages",
|
|
48
|
+
commands: [
|
|
49
|
+
{
|
|
50
|
+
type: "route",
|
|
51
|
+
id: "environment",
|
|
52
|
+
name: "Environment",
|
|
53
|
+
icon: "Brackets",
|
|
54
|
+
to: {
|
|
55
|
+
name: "workspace.environment"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: "route",
|
|
60
|
+
id: "cookies",
|
|
61
|
+
name: "Cookies",
|
|
62
|
+
icon: "Cookie",
|
|
63
|
+
to: {
|
|
64
|
+
name: "workspace.cookies"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: "route",
|
|
69
|
+
id: "settings",
|
|
70
|
+
name: "Settings",
|
|
71
|
+
icon: "Settings",
|
|
72
|
+
to: {
|
|
73
|
+
name: "workspace.settings"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
], w = () => {
|
|
79
|
+
const n = y(), t = m(""), a = m(null), r = m(null), c = i(() => n.open), d = i(() => {
|
|
80
|
+
const e = t.value.toLowerCase().trim();
|
|
81
|
+
return v.map((o) => ({
|
|
82
|
+
label: o.label,
|
|
83
|
+
commands: o.commands.filter((s) => s.type === "hidden-folder" ? !1 : e ? s.name.toLowerCase().includes(e) : !0)
|
|
84
|
+
})).filter((o) => o.commands.length > 0);
|
|
85
|
+
}), p = (e, ...o) => {
|
|
86
|
+
e && (a.value = e, r.value = o[0] ?? null), n.show();
|
|
87
|
+
}, u = () => {
|
|
88
|
+
n.hide(), l();
|
|
89
|
+
}, f = (e) => {
|
|
90
|
+
t.value = e;
|
|
91
|
+
}, l = () => {
|
|
92
|
+
t.value = "", a.value = null, r.value = null;
|
|
93
|
+
};
|
|
94
|
+
return {
|
|
95
|
+
isOpen: c,
|
|
96
|
+
activeCommand: a,
|
|
97
|
+
activeCommandProps: r,
|
|
98
|
+
filterQuery: t,
|
|
99
|
+
filteredCommands: d,
|
|
100
|
+
open: p,
|
|
101
|
+
close: u,
|
|
102
|
+
setFilterQuery: f,
|
|
103
|
+
reset: l
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
export {
|
|
107
|
+
v as commands,
|
|
108
|
+
w as useCommandPaletteState
|
|
109
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
export 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
|
+
export 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
|
+
export 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
|
+
export 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
|
+
export 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
|
+
export 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
|
+
export 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
|
+
export 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
|
+
export 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
|
+
export 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
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,MAAM,MAAM,mBAAmB,GAAG;IAChC,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,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;IAAE,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAA;AAE5D;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,SAAS,IAAI,CAAC,SAAS,KAC1D,GAAG,IAAI,EAAE,GAAG,KACT;IACH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OAAO,CAAC,gCAAgC,CAAC,CAAC,CAAC,CAAC,CAC7C;CACF,CAAA;AAED,oDAAoD;AACpD,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,IAC/D,0BAA0B,CAAC,CAAC,CAAC,CAAC,MAAM,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAA;AAEpE;;;GAGG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI;KAClE,CAAC,IAAI,MAAM,0BAA0B,CAAC,CAAC,CAAC,IAAI,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,OAAO,GACzF,KAAK,GACL,CAAC,GAAG,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACzC,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,iBAAiB,CAAC,CAAC,CAAC,SAAS,OAAO,GAClG,iBAAiB,CAAC,CAAC,CAAC,SAAS;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,GAChD,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAC9B,iBAAiB,CAAC,CAAC,CAAC,GACtB,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/Operation.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/Operation.vue"],"names":[],"mappings":"AA0HA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAIlE;;;;;;;GAOG;;AACH,wBA4KC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as v, computed as r, createBlock as h, createElementBlock as
|
|
2
|
-
import { getResolvedRef as
|
|
3
|
-
import { useRouter as
|
|
1
|
+
import { defineComponent as v, computed as r, onMounted as y, createBlock as h, createElementBlock as f, openBlock as s, unref as u, createElementVNode as p } from "vue";
|
|
2
|
+
import { getResolvedRef as S } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
3
|
+
import { useRouter as B } from "vue-router";
|
|
4
4
|
import { getSecurityRequirements as k } from "./helpers/get-security-requirements.js";
|
|
5
|
-
import
|
|
6
|
-
const
|
|
5
|
+
import R from "../../blocks/operation-block/OperationBlock.vue.js";
|
|
6
|
+
const g = {
|
|
7
7
|
key: 1,
|
|
8
8
|
class: "flex h-full w-full items-center justify-center"
|
|
9
|
-
},
|
|
10
|
-
...
|
|
9
|
+
}, N = {}, q = /* @__PURE__ */ v({
|
|
10
|
+
...N,
|
|
11
11
|
__name: "Operation",
|
|
12
12
|
props: {
|
|
13
13
|
documentSlug: {},
|
|
@@ -22,24 +22,28 @@ const R = {
|
|
|
22
22
|
activeWorkspace: {}
|
|
23
23
|
},
|
|
24
24
|
setup(e) {
|
|
25
|
-
const
|
|
26
|
-
() => e.path && e.method ?
|
|
27
|
-
),
|
|
28
|
-
() => k(e.document,
|
|
25
|
+
const n = r(
|
|
26
|
+
() => e.path && e.method ? S(e.document?.paths?.[e.path]?.[e.method]) : void 0
|
|
27
|
+
), a = r(
|
|
28
|
+
() => k(e.document, n.value)
|
|
29
29
|
), m = r(
|
|
30
30
|
() => e.document?.servers?.find(
|
|
31
31
|
({ url: t }) => t === e.document?.["x-scalar-selected-server"]
|
|
32
32
|
) ?? null
|
|
33
|
-
)
|
|
33
|
+
);
|
|
34
|
+
y(() => {
|
|
35
|
+
typeof e.document?.["x-scalar-selected-server"] > "u" && e.document?.servers?.[0]?.url && e.eventBus.emit("server:update:selected", { url: e.document.servers[0].url });
|
|
36
|
+
});
|
|
37
|
+
const c = r(() => e.document?.["x-scalar-set-operation-security"] ? n.value?.["x-scalar-selected-security"] : e.document?.["x-scalar-selected-security"]), l = r(() => e.document?.["x-scalar-set-operation-security"] ? {
|
|
34
38
|
type: "operation",
|
|
35
39
|
path: e.path ?? "",
|
|
36
40
|
method: e.method ?? "get"
|
|
37
41
|
} : {
|
|
38
42
|
type: "document"
|
|
39
|
-
}), i = "2.
|
|
40
|
-
return (t,
|
|
43
|
+
}), i = "2.13.0", d = B();
|
|
44
|
+
return (t, o) => t.path && t.method && t.exampleName && n.value ? (s(), h(u(R), {
|
|
41
45
|
key: 0,
|
|
42
|
-
appVersion:
|
|
46
|
+
appVersion: u(i),
|
|
43
47
|
authMeta: l.value,
|
|
44
48
|
environment: t.environment,
|
|
45
49
|
eventBus: t.eventBus,
|
|
@@ -47,21 +51,21 @@ const R = {
|
|
|
47
51
|
history: [],
|
|
48
52
|
layout: t.layout,
|
|
49
53
|
method: t.method,
|
|
50
|
-
operation:
|
|
54
|
+
operation: n.value,
|
|
51
55
|
path: t.path,
|
|
52
56
|
plugins: [],
|
|
53
|
-
security:
|
|
57
|
+
security: a.value,
|
|
54
58
|
securitySchemes: t.document?.components?.securitySchemes ?? {},
|
|
55
59
|
selectedSecurity: c.value,
|
|
56
60
|
server: m.value,
|
|
57
61
|
servers: t.document?.servers ?? [],
|
|
58
62
|
totalPerformedRequests: 0,
|
|
59
|
-
"onUpdate:servers":
|
|
60
|
-
}, null, 8, ["appVersion", "authMeta", "environment", "eventBus", "exampleKey", "layout", "method", "operation", "path", "security", "securitySchemes", "selectedSecurity", "server", "servers"])) : (s(),
|
|
63
|
+
"onUpdate:servers": o[0] || (o[0] = (x) => u(d).push({ name: "document.servers" }))
|
|
64
|
+
}, null, 8, ["appVersion", "authMeta", "environment", "eventBus", "exampleKey", "layout", "method", "operation", "path", "security", "securitySchemes", "selectedSecurity", "server", "servers"])) : (s(), f("div", g, [...o[1] || (o[1] = [
|
|
61
65
|
p("span", { class: "text-c-3" }, "Select an operation to view details", -1)
|
|
62
66
|
])]));
|
|
63
67
|
}
|
|
64
68
|
});
|
|
65
69
|
export {
|
|
66
|
-
|
|
70
|
+
q as default
|
|
67
71
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { DraggingItem, HoveredItem } from '@scalar/
|
|
2
|
-
import { type SidebarState } from '@scalar/sidebar';
|
|
1
|
+
import type { DraggingItem, HoveredItem, SidebarState } from '@scalar/sidebar';
|
|
3
2
|
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
4
3
|
import type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation';
|
|
5
4
|
import { type MaybeRefOrGetter } from 'vue';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drag-handle-factory.d.ts","sourceRoot":"","sources":["../../../src/v2/helpers/drag-handle-factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"drag-handle-factory.d.ts","sourceRoot":"","sources":["../../../src/v2/helpers/drag-handle-factory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAc,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAIpE,OAAO,KAAK,EAEV,cAAc,EAGf,MAAM,4CAA4C,CAAA;AAGnD,OAAO,EAAE,KAAK,gBAAgB,EAAW,MAAM,KAAK,CAAA;AA+SpD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,kCAG/B;IACD,KAAK,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IAC9C,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC,CAAA;CAC3C;mCAKuC,YAAY,gBAAgB,WAAW,KAAG,OAAO;iCA2DnD,YAAY,gBAAgB,WAAW,KAAG,OAAO;CAwEtF,CAAA"}
|