vitepress-openapi 0.2.13 → 0.2.15
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/dist/{OAJSONEditor-Cxpub1dW.js → OAJSONEditor-BPdzinnW.js} +1 -1
- package/dist/{OAJSONEditor-B27HNYxA.cjs → OAJSONEditor-cdYfH8pW.cjs} +2 -2
- package/dist/{engine-javascript-Jp6ImdBF.js → engine-javascript-DSMQf2z2.js} +12 -12
- package/dist/{engine-javascript-C27eFBsG.cjs → engine-javascript-DsJlQOsE.cjs} +2 -2
- package/dist/standalone.css +1385 -0
- package/dist/types/src/client.d.ts +1 -12
- package/dist/types/src/components/Common/OADocRoot.vue.d.ts +15 -0
- package/dist/types/src/components/Feature/OASpec.vue.d.ts +17 -0
- package/dist/types/src/composables/useSidebar.d.ts +16 -3
- package/dist/types/src/lib/docRoot.d.ts +3 -0
- package/dist/types/src/lib/sidebar/cleanSidebarItems.d.ts +2 -3
- package/dist/types/src/lib/spec/lazyRendering.d.ts +5 -0
- package/dist/types/src/lib/utils/copyCode.d.ts +1 -0
- package/dist/types/src/vue.d.ts +35 -0
- package/dist/vitepress-openapi.client.cjs.js +1 -6
- package/dist/vitepress-openapi.client.es.js +10 -17169
- package/dist/vitepress-openapi.css +1 -1
- package/dist/vitepress-openapi.vue.cjs.js +1 -0
- package/dist/vitepress-openapi.vue.es.js +3 -0
- package/dist/vue-Cdo23EVh.cjs +6 -0
- package/dist/vue-DpVGGK22.js +17272 -0
- package/package.json +16 -4
- package/src/client.ts +6 -39
- package/src/components/Common/OADocRoot.vue +18 -0
- package/src/components/Feature/OAInfo.vue +11 -5
- package/src/components/Feature/OAIntroduction.vue +12 -6
- package/src/components/Feature/OAOperation.vue +22 -19
- package/src/components/Feature/OAServers.vue +11 -5
- package/src/components/Feature/OASpec.vue +37 -22
- package/src/components/Path/OAPaths.vue +12 -5
- package/src/components/Path/OAPathsGroup.vue +2 -1
- package/src/components/Path/OAPathsGroups.vue +2 -3
- package/src/composables/useSidebar.ts +18 -4
- package/src/lib/docRoot.ts +4 -0
- package/src/lib/sidebar/cleanSidebarItems.ts +4 -5
- package/src/lib/spec/lazyRendering.ts +12 -0
- package/src/lib/utils/copyCode.ts +46 -0
- package/src/standalone.css +38 -0
- package/src/vue.ts +81 -0
- package/dist/classPrivateFieldGet2-B5R_onup.js +0 -22
- package/dist/classPrivateFieldGet2-Bglvjmhn.cjs +0 -1
- package/dist/lib-DtBHFGXA.cjs +0 -1
- package/dist/lib-DuAv3NcE.js +0 -27
package/src/vue.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { App, Plugin } from 'vue'
|
|
2
|
+
import type { PartialUseThemeConfig } from './composables/useTheme'
|
|
3
|
+
import type { OpenAPIDocument } from './types'
|
|
4
|
+
import { createI18n } from '@byjohann/vue-i18n'
|
|
5
|
+
import { watch } from 'vue'
|
|
6
|
+
import * as components from './components'
|
|
7
|
+
import { useOpenapi } from './composables/useOpenapi'
|
|
8
|
+
import { DEFAULT_OPERATION_SLOTS, useTheme } from './composables/useTheme'
|
|
9
|
+
import { DOC_ROOT_KEY } from './lib/docRoot'
|
|
10
|
+
import { setupCopyCode } from './lib/utils/copyCode'
|
|
11
|
+
|
|
12
|
+
export interface VOpenapiOptions {
|
|
13
|
+
/** OpenAPI document (object, or a JSON/YAML string) used by components without their own `spec`. */
|
|
14
|
+
spec?: OpenAPIDocument | string
|
|
15
|
+
/** Theme configuration, the same as `useTheme(config)`. */
|
|
16
|
+
config?: PartialUseThemeConfig
|
|
17
|
+
/** Handle the copy buttons of code blocks. VitePress already does it, so its theme disables this. Default: true. */
|
|
18
|
+
copyCode?: boolean
|
|
19
|
+
/**
|
|
20
|
+
* Wrap the entry components (OAOperation, OASpec, OAIntroduction, OAInfo, OAServers) in a `.vp-doc`
|
|
21
|
+
* element, which `standalone.css` styles. VitePress pages are already inside `.vp-doc`, so its theme
|
|
22
|
+
* disables this. Default: true.
|
|
23
|
+
*/
|
|
24
|
+
vpDoc?: boolean
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Vue plugin to use the components in any Vue 3 app, without VitePress.
|
|
29
|
+
* It installs i18n and registers the components globally.
|
|
30
|
+
*/
|
|
31
|
+
export const VOpenapi: Plugin<[VOpenapiOptions?]> = {
|
|
32
|
+
install(app: App, options: VOpenapiOptions = {}) {
|
|
33
|
+
if (options.spec || options.config) {
|
|
34
|
+
useOpenapi(options)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (options.copyCode !== false) {
|
|
38
|
+
setupCopyCode()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
app.provide(DOC_ROOT_KEY, options.vpDoc !== false)
|
|
42
|
+
|
|
43
|
+
const themeConfig = useTheme()
|
|
44
|
+
|
|
45
|
+
const i18nConfig = themeConfig.getI18nConfig()
|
|
46
|
+
|
|
47
|
+
const i18n = createI18n({
|
|
48
|
+
defaultLocale: i18nConfig.locale?.value || 'en',
|
|
49
|
+
messages: i18nConfig.messages || {},
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
app.use(i18n)
|
|
53
|
+
|
|
54
|
+
watch(
|
|
55
|
+
() => themeConfig.getLocale(),
|
|
56
|
+
() => {
|
|
57
|
+
i18n.setLocale(themeConfig.getLocale())
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
immediate: true,
|
|
61
|
+
},
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
Object.entries(components).forEach(([key, component]) => {
|
|
65
|
+
app.component(key, component)
|
|
66
|
+
})
|
|
67
|
+
},
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export * from './components'
|
|
71
|
+
export { useOpenapi } from './composables/useOpenapi'
|
|
72
|
+
export { usePlayground } from './composables/usePlayground'
|
|
73
|
+
export { DEFAULT_OPERATION_SLOTS }
|
|
74
|
+
export { useShiki } from './composables/useShiki'
|
|
75
|
+
export { type SidebarItem, useSidebar } from './composables/useSidebar'
|
|
76
|
+
export { type PartialUseThemeConfig, useTheme } from './composables/useTheme'
|
|
77
|
+
export { generateCodeSample } from './lib/codeSamples/generateCodeSample'
|
|
78
|
+
export { OARequest } from './lib/codeSamples/request'
|
|
79
|
+
export { createOpenApiSpec } from './lib/spec/createOpenApiSpec'
|
|
80
|
+
export { minifyHtml } from './lib/utils/minifyHtml'
|
|
81
|
+
export { locales } from './locales'
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/checkPrivateRedeclaration.js
|
|
2
|
-
function e(e, t) {
|
|
3
|
-
if (t.has(e)) throw TypeError("Cannot initialize the same private elements twice on an object");
|
|
4
|
-
}
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/classPrivateFieldInitSpec.js
|
|
7
|
-
function t(t, n, r) {
|
|
8
|
-
e(t, n), n.set(t, r);
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/assertClassBrand.js
|
|
12
|
-
function n(e, t, n) {
|
|
13
|
-
if (typeof e == "function" ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
14
|
-
throw TypeError("Private element is not present on this object");
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/classPrivateFieldGet2.js
|
|
18
|
-
function r(e, t) {
|
|
19
|
-
return e.get(n(e, t));
|
|
20
|
-
}
|
|
21
|
-
//#endregion
|
|
22
|
-
export { e as i, n, t as r, r as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function t(t,n,r){e(t,n),n.set(t,r)}function n(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function r(e,t){return e.get(n(e,t))}Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
|
package/dist/lib-DtBHFGXA.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./useOpenapi-D3rJQzeG.cjs");let t=require("vue"),n=e.nt(t,1);t=e.nt(t);var r=e.et({Vue:()=>n,Vue2:()=>void 0,del:()=>o,install:()=>i,isVue2:()=>!1,isVue3:()=>!0,set:()=>a});e.tt(r,require("vue"));function i(){}function a(e,t,n){return Array.isArray(e)?(e.length=Math.max(e.length,t),e.splice(t,1,n),n):(e[t]=n,n)}function o(e,t){if(Array.isArray(e)){e.splice(t,1);return}delete e[t]}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
|
package/dist/lib-DuAv3NcE.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { et as e, tt as t } from "./useOpenapi-DVLwqpMR.js";
|
|
2
|
-
import * as n from "vue";
|
|
3
|
-
//#region node_modules/.pnpm/vue-demi@0.14.10_vue@3.5.42_typescript@6.0.3_/node_modules/vue-demi/lib/index.mjs
|
|
4
|
-
var r = /* @__PURE__ */ e({
|
|
5
|
-
Vue: () => n,
|
|
6
|
-
Vue2: () => void 0,
|
|
7
|
-
del: () => s,
|
|
8
|
-
install: () => a,
|
|
9
|
-
isVue2: () => !1,
|
|
10
|
-
isVue3: () => !0,
|
|
11
|
-
set: () => o
|
|
12
|
-
});
|
|
13
|
-
import * as i from "vue";
|
|
14
|
-
t(r, i);
|
|
15
|
-
function a() {}
|
|
16
|
-
function o(e, t, n) {
|
|
17
|
-
return Array.isArray(e) ? (e.length = Math.max(e.length, t), e.splice(t, 1, n), n) : (e[t] = n, n);
|
|
18
|
-
}
|
|
19
|
-
function s(e, t) {
|
|
20
|
-
if (Array.isArray(e)) {
|
|
21
|
-
e.splice(t, 1);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
delete e[t];
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
export { r as t };
|