-
@@ -133,4 +133,4 @@ export default {
margin: 0;
padding: 0;
}
-
\ No newline at end of file
+
diff --git a/packages/vuepress-common/src/components/organisms/api/Api.vue b/packages/vuepress-common/src/components/organisms/api/Api.vue
index 0a15effc..89bfa033 100644
--- a/packages/vuepress-common/src/components/organisms/api/Api.vue
+++ b/packages/vuepress-common/src/components/organisms/api/Api.vue
@@ -40,6 +40,7 @@
\ No newline at end of file
+
diff --git a/packages/vuepress-common/src/components/organisms/warehouse/Warehouse.vue b/packages/vuepress-common/src/components/organisms/warehouse/Warehouse.vue
index fee7c34d..0436253c 100644
--- a/packages/vuepress-common/src/components/organisms/warehouse/Warehouse.vue
+++ b/packages/vuepress-common/src/components/organisms/warehouse/Warehouse.vue
@@ -159,8 +159,8 @@ export default {
components: {
BxIcon,
WarehouseStats,
- LazyHydrate,
CardPlugin,
+ LazyHydrate,
Observer
},
directives: {
@@ -394,4 +394,4 @@ export default {
}
}
}
-
\ No newline at end of file
+
diff --git a/packages/vuepress-common/src/index.js b/packages/vuepress-common/src/index.js
index da16dc23..bb579c7c 100644
--- a/packages/vuepress-common/src/index.js
+++ b/packages/vuepress-common/src/index.js
@@ -1,6 +1,7 @@
import './styles/index.css'
export * from './components'
+export * from './mixins/ApiMixin'
export * from './utils'
export * from './clients/GithubClient'
export * from './clients/OpenCollectiveClient'
diff --git a/packages/vuepress-common/src/mixins/ApiMixin.js b/packages/vuepress-common/src/mixins/ApiMixin.js
new file mode 100644
index 00000000..e73fae82
--- /dev/null
+++ b/packages/vuepress-common/src/mixins/ApiMixin.js
@@ -0,0 +1,62 @@
+import {filterSymbols} from '../utils'
+
+export const ApiMixin = {
+ created() {
+
+ },
+ methods: {
+ getApi() {
+ return this.$themeConfig.api || {}
+ },
+ getApiModules() {
+ const modules = this.getApi()
+
+ if (!modules) {
+ return {}
+ }
+
+ return Object.keys(modules)
+ .sort((a, b) => a < b ? -1 : 1)
+ .reduce((acc, key) => {
+
+ const symbols = modules[key]
+ .symbols
+ .filter((symbol) => {
+ if (!!(this.currentType && symbol.symbolType !== this.currentType)) {
+ return false
+ }
+
+ if (!!(this.currentStatus && symbol.status.indexOf(this.currentStatus))) {
+ return false
+ }
+
+ if (!!this.keyword) {
+ return symbol.symbolName.toLowerCase().indexOf(this.keyword.toLocaleLowerCase()) > -1
+ }
+
+ return true
+ })
+
+ acc[key] = {...modules[key], symbols}
+
+ return acc
+ }, {})
+ },
+ getApiRedirectUrl() {
+ return this.$themeConfig.apiRedirectUrl || ''
+ },
+ filterSymbols(query) {
+ const items = filterSymbols(this.getApi())(query)
+
+ return items.map((item) => {
+ return {
+ ...item,
+ link: this.getApiLink(item)
+ }
+ })
+ },
+ getApiLink(item) {
+ return `${this.getApiRedirectUrl()}${item.path.replace(/\/\//gi, '/')}.html`
+ }
+ }
+}
diff --git a/packages/vuepress-theme-tsed/docs/.vuepress/config.js b/packages/vuepress-theme-tsed/docs/.vuepress/config.js
index b8faf9a0..6cd8269d 100644
--- a/packages/vuepress-theme-tsed/docs/.vuepress/config.js
+++ b/packages/vuepress-theme-tsed/docs/.vuepress/config.js
@@ -54,6 +54,7 @@ module.exports = {
sidebar: 'auto',
docsBranch: 'production',
api: require('./public/api.json'),
+ apiRedirectUrl: 'https://api-doc.tsed.io',
smoothScroll: true,
lastUpdated: 'Last updated',
// algolia: {
diff --git a/packages/vuepress-theme-tsed/src/install.js b/packages/vuepress-theme-tsed/src/install.js
index 455a1a2b..51b1b8ba 100644
--- a/packages/vuepress-theme-tsed/src/install.js
+++ b/packages/vuepress-theme-tsed/src/install.js
@@ -1,18 +1,11 @@
import * as common from '@tsed/vuepress-common'
-import { filterSymbols } from '@tsed/vuepress-common'
-function isVueComponent (component) {
+function isVueComponent(component) {
return component.name && typeof component !== 'function'
}
-export default function install (Vue) {
- Vue.mixin({
- created () {
- if (this.$themeConfig.api) {
- this.$filterSymbols = filterSymbols(this.$themeConfig.api)
- }
- }
- })
+export default function install(Vue) {
+ Vue.mixin(common.ApiMixin)
try {
Object.keys(common).forEach((key) => {