@scalar/api-client 2.12.0 → 2.14.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 +66 -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/helpers/oauth.d.ts +2 -2
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +90 -75
- 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 +84 -99
- 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 +36 -30
- 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/dist/views/Request/libs/oauth2.d.ts +2 -2
- package/dist/views/Request/libs/oauth2.d.ts.map +1 -1
- package/dist/views/Request/libs/oauth2.js +66 -53
- package/package.json +134 -44
|
@@ -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":"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"}
|
|
@@ -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.14.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":"AAGA,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;AAiTpD;;;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"}
|
|
@@ -1,135 +1,120 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { getResolvedRef as b } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
1
|
+
import { sortByOrder as B } from "@scalar/helpers/array/sort-by-order";
|
|
2
|
+
import { dereference as k, escapeJsonPointer as j } from "@scalar/openapi-parser";
|
|
4
3
|
import { unpackProxyObject as x } from "@scalar/workspace-store/helpers/unpack-proxy";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
AFTER: 1,
|
|
11
|
-
/** Drop into the hovered item */
|
|
12
|
-
INTO: 2
|
|
13
|
-
}, B = (n, t, e, o) => {
|
|
14
|
-
if (t === -1 || e === -1 || t === e)
|
|
4
|
+
import { getParentEntry as d, getOpenapiObject as h } from "@scalar/workspace-store/navigation";
|
|
5
|
+
import { toValue as b } from "vue";
|
|
6
|
+
import { removeCircular as A } from "./remove-circular.js";
|
|
7
|
+
const P = (r, t, n, a) => {
|
|
8
|
+
if (t === -1 || n === -1 || t === n)
|
|
15
9
|
return null;
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
10
|
+
const o = [...r], [e] = o.splice(t, 1);
|
|
11
|
+
if (e === void 0)
|
|
18
12
|
return null;
|
|
19
|
-
const u =
|
|
20
|
-
return
|
|
21
|
-
},
|
|
22
|
-
const
|
|
23
|
-
return
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}) => {
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
30
|
-
return null;
|
|
31
|
-
const o = n.workspace.documents[e.name];
|
|
32
|
-
return o ? t.type === "document" ? o : t.type === "tag" ? o.tags?.find((c) => c.name === t.name) ?? null : t.type === "operation" ? b(o.paths?.[t.path]?.[t.method]) ?? null : null : null;
|
|
33
|
-
}, O = ({ store: n, entry: t }) => {
|
|
34
|
-
const e = i("document", t);
|
|
35
|
-
e && n.buildSidebar(e.name);
|
|
36
|
-
}, P = (n, t) => n["x-scalar-order"] ?? t.children?.map((o) => o.id) ?? [], T = (n, t, e, o) => {
|
|
37
|
-
const c = t.parent;
|
|
38
|
-
if (!c || !h(c, ["tag", "document"]))
|
|
13
|
+
const u = R(t, n, a, o.length);
|
|
14
|
+
return o.splice(u, 0, e), x(o, { depth: 1 });
|
|
15
|
+
}, R = (r, t, n, a) => {
|
|
16
|
+
const o = r < t;
|
|
17
|
+
return n === "after" ? o ? t : t + 1 : n === "before" ? o ? t - 1 : t : n === "into" ? a : t;
|
|
18
|
+
}, y = (r, t) => t.includes(r.type), p = (r) => r.offset === "before" || r.offset === "after", m = (r) => r.offset === "into", l = (r, t) => !r.parent || !t.parent ? !1 : r.parent.id === t.parent.id, O = ({ store: r, entry: t }) => {
|
|
19
|
+
const n = d("document", t);
|
|
20
|
+
n && r.buildSidebar(n.name);
|
|
21
|
+
}, M = (r, t) => r["x-scalar-order"] ?? t.children?.map((a) => a.id) ?? [], w = (r, t, n, a) => {
|
|
22
|
+
const o = t.parent;
|
|
23
|
+
if (!o || !y(o, ["tag", "document"]))
|
|
39
24
|
return !1;
|
|
40
|
-
const
|
|
41
|
-
if (!
|
|
25
|
+
const e = h({ store: r, entry: o });
|
|
26
|
+
if (!e)
|
|
42
27
|
return !1;
|
|
43
|
-
const u =
|
|
44
|
-
return
|
|
45
|
-
},
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
[
|
|
51
|
-
[
|
|
28
|
+
const u = M(e, o), s = u.findIndex((f) => f === t.id), c = u.findIndex((f) => f === n.id), i = P(u, s, c, a);
|
|
29
|
+
return i ? (e["x-scalar-order"] = i, O({ store: r, entry: o }), !0) : !1;
|
|
30
|
+
}, T = (r, t, n) => {
|
|
31
|
+
const a = new Set(r.tags ?? []);
|
|
32
|
+
n && a.add(n.name), t && a.delete(t.name), r.tags = Array.from(a);
|
|
33
|
+
}, $ = (r, t, n, a) => {
|
|
34
|
+
r.paths?.[n.path]?.[n.method] && delete r.paths[n.path][n.method], t.paths ? (t.paths[n.path] || (t.paths[n.path] = {}), t.paths[n.path][n.method] = a) : t.paths = {
|
|
35
|
+
[n.path]: {
|
|
36
|
+
[n.method]: a
|
|
52
37
|
}
|
|
53
38
|
};
|
|
54
|
-
},
|
|
55
|
-
const
|
|
56
|
-
return o
|
|
57
|
-
},
|
|
58
|
-
const
|
|
59
|
-
if (!
|
|
39
|
+
}, C = (r, t, n) => {
|
|
40
|
+
const o = k(r).schema.paths?.[t]?.[n];
|
|
41
|
+
return A(o, { prefix: `#/paths/${j(t)}/${n}` });
|
|
42
|
+
}, F = (r, t, n) => {
|
|
43
|
+
const a = d("document", t), o = d("document", n);
|
|
44
|
+
if (!a || !o)
|
|
60
45
|
return !1;
|
|
61
|
-
const
|
|
62
|
-
if (!
|
|
46
|
+
const e = h({ store: r, entry: a }), u = h({ store: r, entry: o });
|
|
47
|
+
if (!e || !u)
|
|
63
48
|
return !1;
|
|
64
|
-
const
|
|
65
|
-
x(
|
|
49
|
+
const s = C(
|
|
50
|
+
x(e),
|
|
66
51
|
t.path,
|
|
67
52
|
t.method
|
|
68
53
|
);
|
|
69
|
-
if (!
|
|
54
|
+
if (!s)
|
|
70
55
|
return !1;
|
|
71
|
-
const
|
|
72
|
-
return
|
|
73
|
-
},
|
|
74
|
-
const
|
|
75
|
-
return
|
|
76
|
-
},
|
|
77
|
-
store:
|
|
56
|
+
const c = d("tag", t) ?? null, i = d("tag", n) ?? null;
|
|
57
|
+
return T(s, c, i), $(e, u, t, s), O({ store: r, entry: t }), O({ store: r, entry: n }), !0;
|
|
58
|
+
}, H = (r, t, n, a) => {
|
|
59
|
+
const o = r.workspace["x-scalar-order"] ?? [], e = Object.keys(r.workspace.documents), u = B(e, o, (f) => f), s = u.findIndex((f) => f === t.id), c = u.findIndex((f) => f === n.id), i = P(u, s, c, a);
|
|
60
|
+
return i ? (r.update("x-scalar-order", i), !0) : !1;
|
|
61
|
+
}, G = ({
|
|
62
|
+
store: r,
|
|
78
63
|
sidebarState: t
|
|
79
64
|
}) => ({
|
|
80
|
-
handleDragEnd: (
|
|
81
|
-
const u =
|
|
65
|
+
handleDragEnd: (o, e) => {
|
|
66
|
+
const u = b(r);
|
|
82
67
|
if (!u)
|
|
83
68
|
return !1;
|
|
84
|
-
const
|
|
85
|
-
if (!
|
|
69
|
+
const s = t.getEntryById(o.id), c = t.getEntryById(e.id);
|
|
70
|
+
if (!s || !c)
|
|
86
71
|
return !1;
|
|
87
|
-
if (
|
|
88
|
-
return
|
|
89
|
-
if (
|
|
90
|
-
return
|
|
72
|
+
if (s.type === "document")
|
|
73
|
+
return c.type !== "document" || !p(e) ? !1 : H(u, s, c, e.offset);
|
|
74
|
+
if (s.type === "tag")
|
|
75
|
+
return c.type !== "tag" || !p(e) || !l(s, c) ? !1 : w(
|
|
91
76
|
u,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
77
|
+
s,
|
|
78
|
+
c,
|
|
79
|
+
e.offset
|
|
95
80
|
);
|
|
96
|
-
if (
|
|
97
|
-
if (p(
|
|
98
|
-
return
|
|
81
|
+
if (s.type === "operation") {
|
|
82
|
+
if (p(e) && l(s, c))
|
|
83
|
+
return w(
|
|
99
84
|
u,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
85
|
+
s,
|
|
86
|
+
c,
|
|
87
|
+
e.offset
|
|
103
88
|
);
|
|
104
|
-
if (
|
|
105
|
-
return
|
|
89
|
+
if (y(c, ["tag", "document"]) && m(e))
|
|
90
|
+
return F(u, s, c);
|
|
106
91
|
}
|
|
107
92
|
return !1;
|
|
108
93
|
},
|
|
109
|
-
isDroppable: (
|
|
110
|
-
const u =
|
|
94
|
+
isDroppable: (o, e) => {
|
|
95
|
+
const u = b(r);
|
|
111
96
|
if (!u)
|
|
112
97
|
return !1;
|
|
113
|
-
const
|
|
114
|
-
if (!
|
|
98
|
+
const s = t.getEntryById(o.id), c = t.getEntryById(e.id);
|
|
99
|
+
if (!s || !c || s.type === "example")
|
|
115
100
|
return !1;
|
|
116
|
-
if (
|
|
117
|
-
return
|
|
118
|
-
if (
|
|
119
|
-
return p(
|
|
120
|
-
if (
|
|
121
|
-
const
|
|
122
|
-
if (!
|
|
101
|
+
if (s.type === "document")
|
|
102
|
+
return c.type === "document" && p(e);
|
|
103
|
+
if (s.type === "tag")
|
|
104
|
+
return p(e) && l(s, c);
|
|
105
|
+
if (s.type === "operation") {
|
|
106
|
+
const i = d("document", c), f = d("document", s);
|
|
107
|
+
if (!i || !f)
|
|
123
108
|
return !1;
|
|
124
|
-
const
|
|
125
|
-
if (!
|
|
109
|
+
const E = h({ store: u, entry: i });
|
|
110
|
+
if (!E)
|
|
126
111
|
return !1;
|
|
127
|
-
const
|
|
128
|
-
return p(
|
|
112
|
+
const D = l(s, c);
|
|
113
|
+
return p(e) && !D ? !1 : D ? p(e) || m(e) && y(c, ["tag", "document"]) : m(e) && y(c, ["tag", "document"]) && (f.id === i.id || E.paths?.[s.path]?.[s.method] === void 0);
|
|
129
114
|
}
|
|
130
115
|
return !1;
|
|
131
116
|
}
|
|
132
117
|
});
|
|
133
118
|
export {
|
|
134
|
-
|
|
119
|
+
G as dragHandleFactory
|
|
135
120
|
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { HttpMethod } from '@scalar/helpers/http/http-methods';
|
|
2
|
+
import type { Tab } from '@scalar/workspace-store/schemas/extensions/workspace';
|
|
3
|
+
import type { UseSidebarStateReturn } from '../../v2/hooks/use-sidebar-state.js';
|
|
4
|
+
/**
|
|
5
|
+
* Returns display details for a tab in the API client UI.
|
|
6
|
+
* Determines the title and icon to use based on workspace, document, path, and method.
|
|
7
|
+
*
|
|
8
|
+
* - If no workspace is provided, returns { title: 'Untitled Tab' }.
|
|
9
|
+
* - If document is present, attempts to fetch an entry using getEntryByLocation, and returns:
|
|
10
|
+
* - { title: entry.title, icon: 'document' } for document entry types,
|
|
11
|
+
* - { title: entry.title, icon: 'request' } for all other types,
|
|
12
|
+
* - If no entry found, returns { title: 'Untitled Tab' }.
|
|
13
|
+
* - If neither document nor entry is available, returns { title: 'Workspace' }.
|
|
14
|
+
*
|
|
15
|
+
* Example:
|
|
16
|
+
* ```
|
|
17
|
+
* const result = getTabDetails({
|
|
18
|
+
* workspace: "main",
|
|
19
|
+
* document: "doc1",
|
|
20
|
+
* path: "/users",
|
|
21
|
+
* method: "get",
|
|
22
|
+
* getEntryByLocation: ({ document, path, method }) => {
|
|
23
|
+
* // Mock lookup:
|
|
24
|
+
* if (document === "doc1" && path === "/users") {
|
|
25
|
+
* return { type: "document", title: "Users" }
|
|
26
|
+
* }
|
|
27
|
+
* return null
|
|
28
|
+
* }
|
|
29
|
+
* })
|
|
30
|
+
* // result: { title: "Users", icon: "document" }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare const getTabDetails: ({ workspace, document, path, method, getEntryByLocation, }: {
|
|
34
|
+
workspace?: string;
|
|
35
|
+
document?: string;
|
|
36
|
+
path?: string;
|
|
37
|
+
method?: HttpMethod;
|
|
38
|
+
getEntryByLocation: UseSidebarStateReturn["getEntryByLocation"];
|
|
39
|
+
}) => {
|
|
40
|
+
title: string;
|
|
41
|
+
icon?: Tab["icon"];
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=get-tab-details.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-tab-details.d.ts","sourceRoot":"","sources":["../../../src/v2/helpers/get-tab-details.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sDAAsD,CAAA;AAE/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,aAAa,GAAI,4DAM3B;IACD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,kBAAkB,EAAE,qBAAqB,CAAC,oBAAoB,CAAC,CAAA;CAChE,KAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAoCtC,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const o = ({
|
|
2
|
+
workspace: i,
|
|
3
|
+
document: e,
|
|
4
|
+
path: r,
|
|
5
|
+
method: n,
|
|
6
|
+
getEntryByLocation: l
|
|
7
|
+
}) => {
|
|
8
|
+
if (!i)
|
|
9
|
+
return {
|
|
10
|
+
title: "Untitled Tab"
|
|
11
|
+
};
|
|
12
|
+
if (e) {
|
|
13
|
+
const t = l({
|
|
14
|
+
document: e,
|
|
15
|
+
path: r,
|
|
16
|
+
method: n
|
|
17
|
+
});
|
|
18
|
+
return t ? t.type === "document" ? {
|
|
19
|
+
title: t.title,
|
|
20
|
+
icon: "document"
|
|
21
|
+
} : {
|
|
22
|
+
title: t.title,
|
|
23
|
+
icon: "request"
|
|
24
|
+
} : {
|
|
25
|
+
title: "Untitled Tab"
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
title: "Workspace"
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
o as getTabDetails
|
|
34
|
+
};
|
|
@@ -2,7 +2,7 @@ import { isMacOS as f } from "@scalar/helpers/general/is-mac-os";
|
|
|
2
2
|
const r = {
|
|
3
3
|
Enter: { event: "operation:send:request", modifiers: ["default"] },
|
|
4
4
|
b: { event: "ui:toggle:sidebar", modifiers: ["default"] },
|
|
5
|
-
|
|
5
|
+
p: { event: "ui:open:command-palette", modifiers: ["shiftKey"] },
|
|
6
6
|
l: { event: "ui:focus:address-bar", modifiers: ["default"] }
|
|
7
7
|
}, n = {
|
|
8
8
|
web: r,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-url.d.ts","sourceRoot":"","sources":["../../../src/v2/helpers/is-url.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,YAElC,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type RemoveCircularOptions = {
|
|
2
|
+
/** Prefix to add before the path in $ref values */
|
|
3
|
+
prefix?: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Recursively processes an object and replaces circular references with JSON Reference objects.
|
|
7
|
+
* When a circular reference is detected, it returns `{ $ref: "#/path/to/original" }`.
|
|
8
|
+
*
|
|
9
|
+
* @param obj - The object to process
|
|
10
|
+
* @param options - Configuration options
|
|
11
|
+
* @returns A new object with circular references replaced by $ref pointers
|
|
12
|
+
*/
|
|
13
|
+
export declare const removeCircular: <T>(obj: T, options?: RemoveCircularOptions) => T;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=remove-circular.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-circular.d.ts","sourceRoot":"","sources":["../../../src/v2/helpers/remove-circular.ts"],"names":[],"mappings":"AAAA,KAAK,qBAAqB,GAAG;IAC3B,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,EAAE,KAAK,CAAC,EAAE,UAAS,qBAA0B,KAAG,CAiC/E,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const n = (a, i = {}) => {
|
|
2
|
+
const { prefix: $ = "" } = i, e = /* @__PURE__ */ new WeakMap(), s = (r, c = "") => {
|
|
3
|
+
if (typeof r != "object" || r === null)
|
|
4
|
+
return r;
|
|
5
|
+
if (e.has(r))
|
|
6
|
+
return { $ref: `#${$}${e.get(r)}` };
|
|
7
|
+
if (e.set(r, c), Array.isArray(r))
|
|
8
|
+
return r.map((t, f) => s(t, `${c}/${f}`));
|
|
9
|
+
const u = {};
|
|
10
|
+
for (const [t, f] of Object.entries(r))
|
|
11
|
+
u[t] = s(f, `${c}/${t}`);
|
|
12
|
+
return u;
|
|
13
|
+
};
|
|
14
|
+
return s(a);
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
n as removeCircular
|
|
18
|
+
};
|
|
@@ -12,14 +12,12 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const workspaceStorage: {
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @returns {string | undefined} The currently active workspace ID, or undefined if not set.
|
|
15
|
+
* We keep the currently active path so we can reload it if needed
|
|
17
16
|
*/
|
|
18
|
-
readonly
|
|
17
|
+
readonly setCurrentPath: (path: string) => void;
|
|
19
18
|
/**
|
|
20
|
-
*
|
|
21
|
-
* @param {string} id - The workspace ID to set as active.
|
|
19
|
+
* Retrieve the last active path
|
|
22
20
|
*/
|
|
23
|
-
readonly
|
|
21
|
+
readonly getLastPath: () => string | null;
|
|
24
22
|
};
|
|
25
23
|
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/v2/helpers/storage.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB;IAC3B
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/v2/helpers/storage.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB;IAC3B;;OAEG;oCACoB,MAAM,KAAG,IAAI;IAIpC;;OAEG;gCACc,MAAM,GAAG,IAAI;CAGtB,CAAA"}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import { safeLocalStorage as
|
|
2
|
-
const
|
|
1
|
+
import { safeLocalStorage as t } from "@scalar/helpers/object/local-storage";
|
|
2
|
+
const e = "scalar.currentPath", o = {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* @returns {string | undefined} The currently active workspace ID, or undefined if not set.
|
|
4
|
+
* We keep the currently active path so we can reload it if needed
|
|
6
5
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
setCurrentPath: (r) => {
|
|
7
|
+
t().setItem(e, r);
|
|
9
8
|
},
|
|
10
9
|
/**
|
|
11
|
-
*
|
|
12
|
-
* @param {string} id - The workspace ID to set as active.
|
|
10
|
+
* Retrieve the last active path
|
|
13
11
|
*/
|
|
14
|
-
|
|
15
|
-
e().setItem(t, o);
|
|
16
|
-
}
|
|
12
|
+
getLastPath: () => t().getItem(e)
|
|
17
13
|
};
|
|
18
14
|
export {
|
|
19
|
-
|
|
15
|
+
o as workspaceStorage
|
|
20
16
|
};
|