Skip to content

Commit

Permalink
feat(client): enhance typings
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed May 31, 2024
1 parent 6d4366b commit e81545e
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 249 deletions.
2 changes: 1 addition & 1 deletion packages/client/app/settings/settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const ctx = useContext()
interface Tree {
id: string
label: string
label?: string
children?: Tree[]
}
Expand Down
17 changes: 0 additions & 17 deletions packages/client/client/components/chat/image.vue

This file was deleted.

212 changes: 0 additions & 212 deletions packages/client/client/components/chat/overlay.vue

This file was deleted.

5 changes: 0 additions & 5 deletions packages/client/client/components/chat/utils.ts

This file was deleted.

3 changes: 1 addition & 2 deletions packages/client/client/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import components from '@cordisjs/components'
import Element, { ElLoading, ElMessage, ElMessageBox } from 'element-plus'

import common from './common'
import ChatImage from './chat/image.vue'
import * as icons from './icons'
import layout from './layout'
import link from './link'
Expand All @@ -24,7 +23,7 @@ export * from './slot'
export * from 'vue-i18n'
export * from '@cordisjs/components'

export { icons, ChatImage }
export { icons }

export default function (app: App) {
app.use(Element)
Expand Down
9 changes: 6 additions & 3 deletions packages/client/client/components/slot.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useContext } from '../context'
import { App, Component, defineComponent, h } from 'vue'
import { App, Component, DefineComponent, defineComponent, h } from 'vue'

export interface SlotItem {
order?: number
component: Component
component: Component | DefineComponent
}

export interface SlotOptions extends SlotItem {
Expand All @@ -15,7 +15,10 @@ export interface SlotOptions extends SlotItem {

export const KSlot = defineComponent({
props: {
name: String,
name: {
type: String,
required: true,
},
data: Object,
single: Boolean,
},
Expand Down
4 changes: 2 additions & 2 deletions packages/client/client/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ export class Context extends cordis.Context {
})
}

wrapComponent(component?: Component) {
if (!component) return
wrapComponent(component: Component) {
if (!component) return null!
const caller = this[Context.current] || this
if (!caller.$entry) return component
return defineComponent((props, { slots }) => {
Expand Down
7 changes: 0 additions & 7 deletions packages/client/client/plugins/router.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { createRouter, createWebHistory, START_LOCATION } from 'vue-router'
import Overlay from '../components/chat/overlay.vue'
import { Context } from '../context'
import { insert, Service } from '../utils'
import { Component, MaybeRefOrGetter, reactive, ref, toValue } from 'vue'
Expand Down Expand Up @@ -90,7 +89,6 @@ export class Activity {

disabled() {
if (this.ctx.bail('activity', this)) return true
if (this.when && !this.when()) return true
if (this.options.disabled?.()) return true
}

Expand Down Expand Up @@ -148,11 +146,6 @@ export default class RouterService extends Service {
if (result === to.fullPath) return
return result
})

this.slot({
type: 'global',
component: Overlay,
})
}

slot(options: SlotOptions) {
Expand Down

0 comments on commit e81545e

Please sign in to comment.