@scalar/api-reference 1.44.2 → 1.44.4
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 +73 -0
- package/dist/browser/standalone.js +19621 -19559
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/AgentScalar/AgentScalarButton.vue.d.ts +3 -0
- package/dist/components/AgentScalar/AgentScalarButton.vue.d.ts.map +1 -0
- package/dist/components/AgentScalar/AgentScalarButton.vue.js +22 -0
- package/dist/components/AgentScalar/AgentScalarButton.vue2.js +4 -0
- package/dist/components/{AgentChat.vue.d.ts → AgentScalar/AgentScalarChatInterface.vue.d.ts} +4 -2
- package/dist/components/AgentScalar/AgentScalarChatInterface.vue.d.ts.map +1 -0
- package/dist/components/AgentScalar/AgentScalarChatInterface.vue.js +4 -0
- package/dist/components/{AgentChat.vue2.js → AgentScalar/AgentScalarChatInterface.vue2.js} +9 -7
- package/dist/components/AgentScalar/AgentScalarDrawer.vue.d.ts +12 -0
- package/dist/components/AgentScalar/AgentScalarDrawer.vue.d.ts.map +1 -0
- package/dist/components/AgentScalar/AgentScalarDrawer.vue.js +7 -0
- package/dist/components/AgentScalar/AgentScalarDrawer.vue2.js +53 -0
- package/dist/components/AgentScalar/AgentScalarTooltip.vue.d.ts +19 -0
- package/dist/components/AgentScalar/AgentScalarTooltip.vue.d.ts.map +1 -0
- package/dist/components/AgentScalar/AgentScalarTooltip.vue.js +35 -0
- package/dist/components/AgentScalar/AgentScalarTooltip.vue2.js +4 -0
- package/dist/components/AgentScalar/index.d.ts +4 -0
- package/dist/components/AgentScalar/index.d.ts.map +1 -0
- package/dist/components/ApiReference.vue.d.ts.map +1 -1
- package/dist/components/ApiReference.vue.js +1 -1
- package/dist/components/ApiReference.vue2.js +51 -70
- package/dist/components/MobileHeader.vue.js +2 -2
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue2.js +2 -0
- package/dist/features/ask-agent-button/AskAgentButton.vue.d.ts +3 -0
- package/dist/features/ask-agent-button/AskAgentButton.vue.d.ts.map +1 -0
- package/dist/features/ask-agent-button/AskAgentButton.vue.js +7 -0
- package/dist/features/ask-agent-button/AskAgentButton.vue2.js +47 -0
- package/dist/helpers/lazy-bus.d.ts.map +1 -1
- package/dist/helpers/lazy-bus.js +5 -3
- package/dist/helpers/storage.d.ts +2 -2
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/use-agent.d.ts +36 -0
- package/dist/hooks/use-agent.d.ts.map +1 -0
- package/dist/hooks/use-agent.js +42 -0
- package/dist/style.css +271 -204
- package/package.json +15 -15
- package/dist/components/AgentChat.vue.d.ts.map +0 -1
- package/dist/components/AgentChat.vue.js +0 -4
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { defineComponent, ref, createElementBlock, createCommentVNode, unref, openBlock, createVNode, withDirectives, createElementVNode, withKeys, withModifiers, vModelText } from "vue";
|
|
2
|
+
import { ScalarIconSparkle, ScalarIconArrowUp } from "@scalar/icons";
|
|
3
|
+
import { useAgentContext } from "../../hooks/use-agent.js";
|
|
4
|
+
const _hoisted_1 = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "agent-button-container flex"
|
|
7
|
+
};
|
|
8
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
|
+
__name: "AskAgentButton",
|
|
10
|
+
setup(__props) {
|
|
11
|
+
const agentContext = useAgentContext();
|
|
12
|
+
const message = ref("");
|
|
13
|
+
function handleSubmit() {
|
|
14
|
+
agentContext.value?.openAgent(message.value);
|
|
15
|
+
message.value = "";
|
|
16
|
+
}
|
|
17
|
+
return (_ctx, _cache) => {
|
|
18
|
+
return unref(agentContext)?.agentEnabled.value ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
19
|
+
createVNode(unref(ScalarIconSparkle), {
|
|
20
|
+
class: "size-3 shrink-0",
|
|
21
|
+
weight: "fill"
|
|
22
|
+
}),
|
|
23
|
+
withDirectives(createElementVNode("input", {
|
|
24
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => message.value = $event),
|
|
25
|
+
class: "ask-agent-scalar-input",
|
|
26
|
+
placeholder: "Ask AI Agent",
|
|
27
|
+
onKeydown: _cache[1] || (_cache[1] = withKeys(withModifiers(($event) => handleSubmit(), ["stop"]), ["enter"]))
|
|
28
|
+
}, null, 544), [
|
|
29
|
+
[vModelText, message.value]
|
|
30
|
+
]),
|
|
31
|
+
createElementVNode("button", {
|
|
32
|
+
class: "ask-agent-scalar-send",
|
|
33
|
+
type: "button",
|
|
34
|
+
onClick: _cache[2] || (_cache[2] = ($event) => handleSubmit())
|
|
35
|
+
}, [
|
|
36
|
+
createVNode(unref(ScalarIconArrowUp), {
|
|
37
|
+
class: "size-3",
|
|
38
|
+
weight: "bold"
|
|
39
|
+
})
|
|
40
|
+
])
|
|
41
|
+
])) : createCommentVNode("", true);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
export {
|
|
46
|
+
_sfc_main as default
|
|
47
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy-bus.d.ts","sourceRoot":"","sources":["../../src/helpers/lazy-bus.ts"],"names":[],"mappings":"AAqBA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,qCAAa,CAAA;AAc/C,KAAK,SAAS,GAAG,MAAM,IAAI,CAAA;AAE3B;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,SAMpC,CAAA;AAED,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,oCAAkD,CAAA;
|
|
1
|
+
{"version":3,"file":"lazy-bus.d.ts","sourceRoot":"","sources":["../../src/helpers/lazy-bus.ts"],"names":[],"mappings":"AAqBA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,qCAAa,CAAA;AAc/C,KAAK,SAAS,GAAG,MAAM,IAAI,CAAA;AAE3B;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,SAMpC,CAAA;AAED,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,oCAAkD,CAAA;AAkGlF;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM;;EAUpC;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,GACvB,IAAI,MAAM,EACV,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,EACjD,cAAc,CAAC,EAAE,EAAE,MAAM,KAAK;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,QAAQ,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,GAAG,SAAS,SA2D/G,CAAA"}
|
package/dist/helpers/lazy-bus.js
CHANGED
|
@@ -29,7 +29,9 @@ const runLazyBus = () => {
|
|
|
29
29
|
if (pendingQueue.size > 0 || priorityQueue.size > 0) {
|
|
30
30
|
isRunning.value = true;
|
|
31
31
|
for (const id of [...pendingQueue, ...priorityQueue]) {
|
|
32
|
-
readyQueue.
|
|
32
|
+
if (!readyQueue.has(id)) {
|
|
33
|
+
readyQueue.add(id);
|
|
34
|
+
}
|
|
33
35
|
pendingQueue.delete(id);
|
|
34
36
|
priorityQueue.delete(id);
|
|
35
37
|
}
|
|
@@ -57,12 +59,12 @@ watchDebounced(
|
|
|
57
59
|
{ debounce: 300, maxWait: 1500 }
|
|
58
60
|
);
|
|
59
61
|
const addToPendingQueue = (id) => {
|
|
60
|
-
if (!!id && !priorityQueue.has(id)) {
|
|
62
|
+
if (!!id && !readyQueue.has(id) && !priorityQueue.has(id)) {
|
|
61
63
|
pendingQueue.add(id);
|
|
62
64
|
}
|
|
63
65
|
};
|
|
64
66
|
const addToPriorityQueue = (id) => {
|
|
65
|
-
if (id) {
|
|
67
|
+
if (id && !priorityQueue.has(id)) {
|
|
66
68
|
priorityQueue.add(id);
|
|
67
69
|
}
|
|
68
70
|
};
|
|
@@ -31,8 +31,8 @@ export declare const authStorage: () => {
|
|
|
31
31
|
'x-scalar-secret-token': string;
|
|
32
32
|
} & {
|
|
33
33
|
type: "apiKey";
|
|
34
|
-
name: string;
|
|
35
34
|
in: "header" | "query" | "cookie";
|
|
35
|
+
name: string;
|
|
36
36
|
}) | ({
|
|
37
37
|
description?: string | undefined;
|
|
38
38
|
} & {
|
|
@@ -181,8 +181,8 @@ export declare const authStorage: () => {
|
|
|
181
181
|
'x-scalar-secret-token': string;
|
|
182
182
|
} & {
|
|
183
183
|
type: "apiKey";
|
|
184
|
-
name: string;
|
|
185
184
|
in: "header" | "query" | "cookie";
|
|
185
|
+
name: string;
|
|
186
186
|
}) | ({
|
|
187
187
|
description?: string | undefined;
|
|
188
188
|
} & {
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,QAAQ,EACR,eAAe,GAChB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { type InjectionKey } from 'vue';
|
|
3
|
+
type UseAgentOptions = {
|
|
4
|
+
/** Optional. When provided, controls whether the agent UI is enabled (e.g. from doc config). Defaults to isLocalUrl. */
|
|
5
|
+
agentEnabled?: ComputedRef<boolean>;
|
|
6
|
+
};
|
|
7
|
+
type UseAgentReturn = {
|
|
8
|
+
showAgent: Ref<boolean>;
|
|
9
|
+
agentEnabled: ComputedRef<boolean>;
|
|
10
|
+
/** Ref used to pass a prefill message into the agent when opening. Cleared on close. */
|
|
11
|
+
prefilledMessage: Ref<string>;
|
|
12
|
+
openAgent: (message?: string) => void;
|
|
13
|
+
closeAgent: () => void;
|
|
14
|
+
toggleAgent: () => void;
|
|
15
|
+
};
|
|
16
|
+
export declare const AGENT_CONTEXT_SYMBOL: InjectionKey<UseAgentReturn>;
|
|
17
|
+
/**
|
|
18
|
+
* Hook for agent visibility and enabled state.
|
|
19
|
+
* Call from the API Reference root (e.g. ApiReference.vue) with options to create the state, then provide it so descendants can inject it.
|
|
20
|
+
*
|
|
21
|
+
* Returns:
|
|
22
|
+
* - showAgent: whether the agent panel is visible
|
|
23
|
+
* - agentEnabled: whether the agent is enabled
|
|
24
|
+
* - openAgent, closeAgent, toggleAgent: imperative controls
|
|
25
|
+
*/
|
|
26
|
+
export declare function useAgent(options: UseAgentOptions): UseAgentReturn;
|
|
27
|
+
/**
|
|
28
|
+
* Inject the agent context provided by ApiReference.
|
|
29
|
+
* Falls back to module-level state when inject is undefined (e.g. async boundary or mount order).
|
|
30
|
+
* Use in descendant components (e.g. AskAgentButton) to open the agent or check if it is enabled.
|
|
31
|
+
*
|
|
32
|
+
* Returns a computed ref; use v-if="agentContext?.agentEnabled" so the button only renders when context exists and agent is enabled.
|
|
33
|
+
*/
|
|
34
|
+
export declare function useAgentContext(): ComputedRef<UseAgentReturn | undefined>;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=use-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-agent.d.ts","sourceRoot":"","sources":["../../src/hooks/use-agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,KAAK,YAAY,EAAyB,MAAM,KAAK,CAAA;AAE9D,KAAK,eAAe,GAAG;IACrB,wHAAwH;IACxH,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;CACpC,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACvB,YAAY,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IAClC,wFAAwF;IACxF,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC7B,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,UAAU,EAAE,MAAM,IAAI,CAAA;IACtB,WAAW,EAAE,MAAM,IAAI,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,oBAAoB,EAAe,YAAY,CAAC,cAAc,CAAC,CAAA;AAQ5E;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,cAAc,CAiCjE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,IAAI,WAAW,CAAC,cAAc,GAAG,SAAS,CAAC,CAGzE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { isLocalUrl } from "@scalar/helpers/url/is-local-url";
|
|
2
|
+
import { ref, computed, inject } from "vue";
|
|
3
|
+
const AGENT_CONTEXT_SYMBOL = /* @__PURE__ */ Symbol();
|
|
4
|
+
const agentStateRef = ref(null);
|
|
5
|
+
function useAgent(options) {
|
|
6
|
+
const showAgent = ref(false);
|
|
7
|
+
const prefilledMessage = ref("");
|
|
8
|
+
const agentEnabled = options.agentEnabled ?? computed(() => isLocalUrl(window.location.href));
|
|
9
|
+
const openAgent = (message) => {
|
|
10
|
+
prefilledMessage.value = message ?? "";
|
|
11
|
+
showAgent.value = true;
|
|
12
|
+
};
|
|
13
|
+
const closeAgent = () => {
|
|
14
|
+
showAgent.value = false;
|
|
15
|
+
prefilledMessage.value = "";
|
|
16
|
+
};
|
|
17
|
+
const toggleAgent = () => {
|
|
18
|
+
showAgent.value = !showAgent.value;
|
|
19
|
+
if (!showAgent.value) {
|
|
20
|
+
prefilledMessage.value = "";
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const state = {
|
|
24
|
+
showAgent,
|
|
25
|
+
agentEnabled,
|
|
26
|
+
prefilledMessage,
|
|
27
|
+
openAgent,
|
|
28
|
+
closeAgent,
|
|
29
|
+
toggleAgent
|
|
30
|
+
};
|
|
31
|
+
agentStateRef.value = state;
|
|
32
|
+
return state;
|
|
33
|
+
}
|
|
34
|
+
function useAgentContext() {
|
|
35
|
+
const injected = inject(AGENT_CONTEXT_SYMBOL, void 0);
|
|
36
|
+
return computed(() => injected ?? agentStateRef.value ?? void 0);
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
AGENT_CONTEXT_SYMBOL,
|
|
40
|
+
useAgent,
|
|
41
|
+
useAgentContext
|
|
42
|
+
};
|