dsh-brain/src-client/index.ts

39 lines
1.0 KiB
TypeScript

// dsh-brain client bundle entry — the __ModuleLoader__ module contract.
import * as React from 'react'
import { messageOf } from './api'
import { CardBoundary } from './components'
import { SettingsCard } from './SettingsCard'
const h = React.createElement
export const inject = ['slots']
export function apply(ctx: any): void {
const card = function () {
return h(CardBoundary as any, null, h(SettingsCard as any, null))
}
const register = function (seat: string, options: any) {
try {
ctx.slots.inject(seat, function () {
return ctx.slots.register(options, card)
})
} catch (failure) {
if (typeof console !== 'undefined') console.warn('[dsh-brain] slot ' + seat + ' unavailable: ' + messageOf(failure))
}
}
register('settings.section', {
name: 'settings.section',
id: 'dsh-brain',
order: 100,
label: function () {
return '云端记忆'
},
})
register('plugins.bundle.config', { name: 'plugins.bundle.config', key: 'dsh-brain' })
}
export const name = 'dsh-brain'