@scalar/api-client 0.5.1 → 0.5.2

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 (59) hide show
  1. package/package.json +6 -7
  2. package/src/components/ApiClient/AddressBar.vue +0 -462
  3. package/src/components/ApiClient/ApiClient.vue +0 -266
  4. package/src/components/ApiClient/Request/Request.vue +0 -271
  5. package/src/components/ApiClient/Request/RequestAuth.vue +0 -221
  6. package/src/components/ApiClient/Request/RequestBody.vue +0 -40
  7. package/src/components/ApiClient/Request/RequestHeaders.vue +0 -24
  8. package/src/components/ApiClient/Request/RequestQuery.vue +0 -25
  9. package/src/components/ApiClient/Request/RequestVariables.vue +0 -25
  10. package/src/components/ApiClient/Request/index.ts +0 -1
  11. package/src/components/ApiClient/RequestHistory.vue +0 -114
  12. package/src/components/ApiClient/RequestHistoryItem.vue +0 -59
  13. package/src/components/ApiClient/Response/Copilot.vue.bak +0 -385
  14. package/src/components/ApiClient/Response/Response.vue +0 -120
  15. package/src/components/ApiClient/Response/ResponseBody.vue +0 -24
  16. package/src/components/ApiClient/Response/ResponseHeaders.vue +0 -52
  17. package/src/components/ApiClient/Response/ResponseMetaInformation.vue +0 -58
  18. package/src/components/ApiClient/Response/index.ts +0 -1
  19. package/src/components/ApiClient/index.ts +0 -1
  20. package/src/components/CollapsibleSection/CollapsibleSection.vue +0 -149
  21. package/src/components/CollapsibleSection/index.ts +0 -1
  22. package/src/components/FlowModal.vue +0 -133
  23. package/src/components/Grid/Grid.vue +0 -511
  24. package/src/components/Grid/SimpleGrid.vue +0 -33
  25. package/src/components/Grid/index.ts +0 -2
  26. package/src/components/HelpfulLink.vue +0 -19
  27. package/src/components/SimpleTable/SimpleCell.vue +0 -47
  28. package/src/components/SimpleTable/SimpleHeader.vue +0 -17
  29. package/src/components/SimpleTable/SimpleRow.vue +0 -14
  30. package/src/components/SimpleTable/SimpleTable.vue +0 -13
  31. package/src/components/SimpleTable/index.ts +0 -4
  32. package/src/fixtures/httpHeaders.ts +0 -530
  33. package/src/fixtures/httpStatusCodes.ts +0 -259
  34. package/src/fixtures/index.ts +0 -6
  35. package/src/helpers/concatenateUrlAndPath.test.ts +0 -27
  36. package/src/helpers/concatenateUrlAndPath.ts +0 -13
  37. package/src/helpers/createPlaceholderRequest.ts +0 -16
  38. package/src/helpers/generateParameters.ts +0 -19
  39. package/src/helpers/generateRequest.ts +0 -26
  40. package/src/helpers/index.ts +0 -10
  41. package/src/helpers/mapFromArray.ts +0 -16
  42. package/src/helpers/normalizePath.test.ts +0 -17
  43. package/src/helpers/normalizePath.ts +0 -16
  44. package/src/helpers/normalizeRequestMethod.test.ts +0 -29
  45. package/src/helpers/normalizeRequestMethod.ts +0 -43
  46. package/src/helpers/normalizeUrl.test.ts +0 -25
  47. package/src/helpers/normalizeUrl.ts +0 -24
  48. package/src/helpers/replaceVariables.test.ts +0 -13
  49. package/src/helpers/replaceVariables.ts +0 -11
  50. package/src/helpers/sendRequest.test.ts +0 -50
  51. package/src/helpers/sendRequest.ts +0 -105
  52. package/src/hooks/index.ts +0 -2
  53. package/src/hooks/useCopilot.ts +0 -64
  54. package/src/hooks/useOperation.ts +0 -43
  55. package/src/index.ts +0 -8
  56. package/src/stores/apiClientRequestStore.ts +0 -103
  57. package/src/stores/apiClientStore.ts +0 -57
  58. package/src/stores/index.ts +0 -5
  59. package/src/types.ts +0 -185
@@ -1,266 +0,0 @@
1
- <script setup lang="ts">
2
- import { Tab, TabGroup, TabList, TabPanel, TabPanels } from '@headlessui/vue'
3
- import '@scalar/default-theme/scrollbar.css'
4
- import '@scalar/default-theme/theme.css'
5
- import { useKeyboardEvent } from '@scalar/use-keyboard-event'
6
- import { useMediaQuery } from '@vueuse/core'
7
- import { ref } from 'vue'
8
-
9
- import { useApiClientRequestStore } from '../../stores'
10
- import AdressBar from './AddressBar.vue'
11
- import { Request } from './Request'
12
- import { Response } from './Response'
13
-
14
- defineProps<{
15
- proxyUrl: string
16
- }>()
17
-
18
- const emit = defineEmits<{
19
- (e: 'escapeKeyPress'): void
20
- }>()
21
-
22
- const { activeRequest } = useApiClientRequestStore()
23
-
24
- const isSmallScreen = useMediaQuery('(max-width: 820px)')
25
-
26
- const selectedTab = ref(0)
27
-
28
- const Tabs = {
29
- Request: 0,
30
- Response: 1,
31
- }
32
-
33
- function changeTab(index: number) {
34
- selectedTab.value = index
35
- }
36
-
37
- useKeyboardEvent({
38
- keyList: ['escape'],
39
- handler: () => emit('escapeKeyPress'),
40
- })
41
- </script>
42
-
43
- <template>
44
- <div
45
- class="scalar-api-client"
46
- :class="`scalar-api-client--${activeRequest.type.toLowerCase() || 'get'}`"
47
- @keydown.esc="emit('escapeKeyPress')">
48
- <AdressBar
49
- :proxyUrl="proxyUrl"
50
- @onSend="changeTab(Tabs.Response)" />
51
- <div class="scalar-api-client__main">
52
- <!-- Desktop-->
53
- <template v-if="!isSmallScreen">
54
- <Request />
55
- <Response />
56
- </template>
57
- <!-- Mobile-->
58
- <template v-else>
59
- <TabGroup
60
- :selectedIndex="selectedTab"
61
- @change="changeTab">
62
- <TabList class="scalar-api-client__mobile-navigation">
63
- <Tab
64
- v-slot="{ selected }"
65
- class="scalar-api-client__mobile-navigation__toggle">
66
- <button
67
- :class="{
68
- 'scalar-api-client__mobile-navigation--active': selected,
69
- }"
70
- type="button">
71
- Request
72
- </button>
73
- </Tab>
74
- <Tab
75
- v-slot="{ selected }"
76
- class="scalar-api-client__mobile-navigation__toggle">
77
- <button
78
- :class="{
79
- 'scalar-api-client__mobile-navigation--active': selected,
80
- }"
81
- type="button">
82
- Response
83
- </button>
84
- </Tab>
85
- </TabList>
86
- <TabPanels>
87
- <TabPanel>
88
- <Request />
89
- </TabPanel>
90
- <TabPanel>
91
- <Response />
92
- </TabPanel>
93
- </TabPanels>
94
- </TabGroup>
95
- </template>
96
- </div>
97
- </div>
98
- </template>
99
-
100
- <style>
101
- .scalar-api-client {
102
- background: var(--theme-background-1);
103
- position: relative;
104
- height: 100%;
105
- overflow: hidden !important;
106
- display: flex;
107
- flex-direction: column;
108
- font-family: var(--theme-font);
109
- }
110
- @media screen and (max-width: 1000px) {
111
- .scalar-api-client {
112
- width: 100%;
113
- }
114
- }
115
- .scalar-api-client pre {
116
- font-family: var(--theme-font-code);
117
- }
118
-
119
- .scalar-api-client--post {
120
- --scalar-api-client-color: var(--theme-post-color);
121
- --scalar-api-client-background: var(--theme-post-background);
122
- }
123
-
124
- .scalar-api-client--delete {
125
- --scalar-api-client-color: var(--theme-delete-color);
126
- --scalar-api-client-background: var(--theme-delete-background);
127
- }
128
-
129
- .scalar-api-client--patch {
130
- --scalar-api-client-color: var(--theme-patch-color);
131
- --scalar-api-client-background: var(--theme-patch-background);
132
- }
133
-
134
- .scalar-api-client--get {
135
- --scalar-api-client-color: var(--theme-get-color);
136
- --scalar-api-client-background: var(--theme-get-background);
137
- }
138
-
139
- .scalar-api-client--put {
140
- --scalar-api-client-color: var(--theme-put-color);
141
- --scalar-api-client-background: var(--theme-put-background);
142
- }
143
-
144
- .scalar-api-client__mobile-navigation {
145
- padding: 12px 12px 0 12px;
146
- display: flex;
147
- font-size: var(--theme-small);
148
- color: var(--theme-color-2);
149
- font-weight: var(--theme-bold);
150
- }
151
-
152
- .scalar-api-client__mobile-navigation__toggle {
153
- appearance: none;
154
- margin-right: 9px;
155
- cursor: pointer;
156
- }
157
-
158
- .scalar-api-client__mobile-navigation--active {
159
- color: var(--theme-color-1);
160
- }
161
-
162
- .scalar-api-client__mobile-navigation--active:hover {
163
- cursor: pointer;
164
- }
165
-
166
- .scalar-api-client__main {
167
- display: flex;
168
- height: 100%;
169
- min-height: 0;
170
- background: var(--theme-background-1);
171
- border-top: 1px solid var(--theme-border-color);
172
- }
173
-
174
- @media screen and (max-width: 820px) {
175
- .scalar-api-client__main {
176
- display: block;
177
- }
178
- }
179
-
180
- /** TODO: Consider to make a Column component */
181
- .scalar-api-client__main__content {
182
- padding: 12px;
183
- background: var(--theme-background-1);
184
- top: 0;
185
- position: sticky;
186
- z-index: 100;
187
- }
188
- .scalar-api-client__main__content label {
189
- font-size: var(--theme-small);
190
- color: var(--theme-color-1);
191
- font-weight: var(--theme-bold);
192
- display: flex;
193
- align-items: center;
194
- }
195
- @media screen and (max-width: 820px) {
196
- .scalar-api-client__main__content {
197
- padding: 0 0 12px 0;
198
- }
199
-
200
- .scalar-api-client__main__content label {
201
- display: none;
202
- }
203
- }
204
-
205
- .meta {
206
- display: flex;
207
- font-size: var(--theme-font-size-2);
208
- font-weight: var(--theme-font-size-2);
209
- color: var(--scalar-api-client-color2);
210
- }
211
-
212
- .meta-item svg {
213
- fill: var(--theme-color-ghost);
214
- height: 14px;
215
- width: 14px;
216
- margin-right: 6px;
217
- }
218
-
219
- .meta-item {
220
- display: flex;
221
- align-items: center;
222
- margin-right: 12px;
223
- white-space: nowrap;
224
- font-weight: var(--theme-bold);
225
- font-size: 12px;
226
- color: var(--theme-color-disabled);
227
- padding: 3px 0;
228
- }
229
-
230
- .meta-item__input {
231
- padding: 3px 0;
232
- background: transparent;
233
- width: 100%;
234
- margin-right: 0;
235
- }
236
-
237
- .types {
238
- margin: auto;
239
- width: 580px;
240
- display: flex;
241
- align-items: center;
242
- justify-content: center;
243
- flex-flow: wrap;
244
- }
245
-
246
- .types-heading {
247
- width: 100%;
248
- text-align: center;
249
- }
250
-
251
- .types-heading b {
252
- font-size: 42px;
253
- }
254
- .types-heading p {
255
- margin-bottom: 20px;
256
- margin-top: 12px;
257
- font-size: 24px;
258
- }
259
- .scalar-api-client__empty-state {
260
- border: 1px dashed var(--theme-border-color);
261
- width: 100%;
262
- text-align: center;
263
- font-size: var(--theme-small);
264
- padding: 20px;
265
- }
266
- </style>
@@ -1,271 +0,0 @@
1
- <script setup lang="ts">
2
- import { useApiClientRequestStore } from '../../../stores/apiClientRequestStore'
3
- import RequestAuth from './RequestAuth.vue'
4
- import RequestBody from './RequestBody.vue'
5
- import RequestHeaders from './RequestHeaders.vue'
6
- import RequestQuery from './RequestQuery.vue'
7
- import RequestVariables from './RequestVariables.vue'
8
-
9
- const { activeRequest, readOnly } = useApiClientRequestStore()
10
- </script>
11
- <template>
12
- <div class="scalar-api-client__main__left custom-scroll">
13
- <div class="scalar-api-client__main__content">
14
- <label>Request</label>
15
- <div class="meta">
16
- <div class="meta-item meta-item__input">
17
- <input
18
- v-model="activeRequest.name"
19
- class="scalar-api-client__request-name"
20
- :disabled="readOnly"
21
- placeholder="Request Name"
22
- type="text" />
23
- </div>
24
- </div>
25
- </div>
26
- <div>
27
- <RequestAuth />
28
- <RequestVariables :variables="activeRequest.parameters" />
29
- <RequestQuery :queries="activeRequest.query" />
30
- <RequestHeaders :headers="activeRequest.headers" />
31
- <RequestBody
32
- :body="activeRequest.body"
33
- :formData="activeRequest.formData"
34
- :requestBody="activeRequest.body" />
35
- <div class="scalar-api-client__main__scroll-container" />
36
- </div>
37
- </div>
38
- </template>
39
- <style>
40
- .scalar-api-client__main__left {
41
- width: 50%;
42
- border-right: 1px solid var(--theme-border-color);
43
- padding: 0 0 12px 12px;
44
- }
45
- @media screen and (max-width: 820px) {
46
- .scalar-api-client__main__left {
47
- width: 100%;
48
- border-right: none;
49
- }
50
- }
51
- .scalar-api-client__item__content {
52
- flex-flow: wrap;
53
- padding: 0 12px 12px;
54
- border-radius: 3px;
55
- color: var(--theme-color-disabled);
56
- font-size: 12px;
57
- margin-top: -3px;
58
- justify-content: space-between;
59
- }
60
- .scalar-api-client__item__content .cm-s-default {
61
- border: 1px solid var(--theme-border-color);
62
- border-radius: var(--theme-radius-lg);
63
- }
64
- .scalar-api-client__item__content .scalar-api-client__item__content--code {
65
- width: 100%;
66
- max-height: calc(100vh - 200px);
67
- overflow: auto;
68
- }
69
- .scalar-api-client__item__content .cm-scroller {
70
- border: 1px solid var(--theme-border-color);
71
- border-radius: 3px;
72
- }
73
- .scalar-api-client__item__content .cm-editor {
74
- outline: none !important;
75
- }
76
- .scalar-api-client__item__content .cm-editor .cm-gutters {
77
- background: transparent;
78
- }
79
- .scalar-api-client__item__content .cm-scroll {
80
- background: transparent;
81
- }
82
- .scalar-api-client__item__content .cm-editor * {
83
- font-size: 11px;
84
- }
85
- .scalar-api-client__item__content .cm-editor .cm-line {
86
- color: var(--theme-color-1);
87
- }
88
- .scalar-api-client__item__content-button {
89
- width: 100%;
90
- appearance: none;
91
- border: none;
92
- outline: none;
93
- font-size: 12px;
94
- background: var(--scalar-api-client-color) !important;
95
- text-align: center;
96
- font-weight: var(--theme-bold);
97
- padding: 12px;
98
- text-transform: uppercase;
99
- border-radius: var(--theme-radius-lg);
100
- color: white;
101
- cursor: pointer;
102
- }
103
- .scalar-api-client__item__content__split {
104
- justify-content: space-between;
105
- }
106
- .scalar-collapsible-section-flex {
107
- width: 100%;
108
- }
109
- .input {
110
- background: var(--theme-background-2);
111
- border: 1px solid var(--theme-border-color);
112
- border-radius: 3px;
113
- position: relative;
114
- width: 100%;
115
- text-align: left;
116
- margin-bottom: 6px;
117
- }
118
- .input__half {
119
- width: calc(50% - 3px);
120
- }
121
- .input:focus-within {
122
- background: var(--theme-background-3);
123
- }
124
- .input label,
125
- .input input {
126
- padding: 12px;
127
- border: 0;
128
- outline: none;
129
- font-size: 12px;
130
- color: var(--theme-color-1);
131
- width: 100%;
132
- background: transparent;
133
- appearance: none;
134
- -webkit-appearance: none;
135
- left: 0;
136
- }
137
- .input label {
138
- position: absolute;
139
- color: var(--theme-color-2);
140
- }
141
- .input input {
142
- opacity: 0;
143
- position: relative;
144
- z-index: 99;
145
- padding: 18px 12px 6px 12px;
146
- }
147
- .input input:not(:placeholder-shown),
148
- .input:focus-within input {
149
- opacity: 1;
150
- }
151
- .input input:not(:placeholder-shown) + label,
152
- .input:focus-within label {
153
- font-size: 10px;
154
- top: -6px;
155
- color: var(--theme-color-1);
156
- }
157
- .input input:not(:placeholder-shown) + label {
158
- color: var(--theme-color-2);
159
- }
160
- .select {
161
- background: --theme-background-1;
162
- border-radius: var(--theme-radius-lg);
163
- font-size: 12px;
164
- border: 1px solid var(--theme-border-color);
165
- width: 100%;
166
- position: relative;
167
- margin-bottom: 6px;
168
- }
169
- .select:focus-within {
170
- background: var(--theme-background-3);
171
- }
172
- .select:hover {
173
- background: var(--theme-background-3);
174
- }
175
- .select svg {
176
- position: absolute;
177
- right: 12px;
178
- pointer-events: none;
179
- color: var(--theme-color-2);
180
- width: 6px;
181
- top: 10px;
182
- }
183
- .select label {
184
- display: block;
185
- font-size: 10px;
186
- color: var(--theme-color-2);
187
- position: absolute;
188
- left: 12px;
189
- top: 6px;
190
- }
191
- .select select {
192
- background: transparent;
193
- outline: none;
194
- border: none;
195
- -webkit-appearance: none;
196
- font-size: 12px;
197
- color: var(--theme-color-1);
198
- appearance: none;
199
- width: 100%;
200
- padding: 18px 12px 6px 12px;
201
- top: 0;
202
- position: relative;
203
- cursor: pointer;
204
- }
205
-
206
- .check {
207
- display: flex;
208
- position: relative;
209
- cursor: pointer;
210
- align-items: center;
211
- font-size: 12px;
212
- border: 1px solid var(--theme-border-color);
213
- border-radius: 3px;
214
- padding: 10px 12px;
215
- user-select: none;
216
- width: 100%;
217
- }
218
- .check p {
219
- color: var(--theme-color-2);
220
- }
221
- .check input {
222
- position: absolute;
223
- opacity: 0;
224
- cursor: pointer;
225
- height: 0;
226
- width: 0;
227
- }
228
-
229
- .checkmark {
230
- height: 15px;
231
- width: 15px;
232
- background: var(--theme-background-3);
233
- margin-right: 10px;
234
- border-radius: 3px;
235
- display: flex;
236
- align-items: center;
237
- justify-content: center;
238
- position: relative;
239
- }
240
-
241
- .check input:checked ~ p {
242
- color: var(--theme-color-1);
243
- }
244
- .check .checkmark:after {
245
- content: '';
246
- display: none;
247
- width: 5px;
248
- height: 8px;
249
- border: solid var(--theme-color-disabled);
250
- border-width: 0 2px 2px 0;
251
- transform: rotate(45deg) translate3d(0, -1px, 0);
252
- }
253
- .check input:checked ~ .checkmark:after {
254
- display: block;
255
- }
256
- .scalar-api-client__main__scroll-container {
257
- height: calc(100vh - 320px);
258
- }
259
- .scalar-api-client__request-name {
260
- outline: none;
261
- border: none;
262
- appearance: none;
263
- -webkit-appearance: none;
264
- color: var(--theme-color-disabled);
265
- border-radius: var(--theme-radius-lg);
266
- font-size: var(--theme-mini);
267
- font-weight: var(--theme-bold);
268
- width: 100%;
269
- background: transparent;
270
- }
271
- </style>