vue3-yuanma/packages/runtime-dom/src/index.ts

44 lines
1.0 KiB
TypeScript
Raw Normal View History

2019-09-06 20:58:32 +00:00
import { createRenderer } from '@vue/runtime-core'
import { isHTMLTag, isSVGTag } from '@vue/shared'
2019-06-20 13:28:37 +00:00
import { nodeOps } from './nodeOps'
import { patchProp } from './patchProp'
2018-09-19 15:35:38 +00:00
2019-09-06 20:58:32 +00:00
const { render, createApp } = createRenderer<Node, Element>({
2019-06-20 13:28:37 +00:00
patchProp,
...nodeOps
2019-09-06 20:58:32 +00:00
})
2019-09-02 20:09:34 +00:00
const wrappedCreateApp = () => {
const app = createApp()
// inject `isNativeTag` dev only
Object.defineProperty(app.config, 'isNativeTag', {
value: (tag: string) => isHTMLTag(tag) || isSVGTag(tag),
writable: false
})
return app
}
const exportedCreateApp = __DEV__ ? wrappedCreateApp : createApp
export { render, exportedCreateApp as createApp }
2018-09-19 15:35:38 +00:00
2019-10-10 22:02:51 +00:00
// DOM-only runtime helpers
export {
vModelText,
vModelCheckbox,
vModelRadio,
vModelSelect,
vModelDynamic
} from './directives/vModel'
export { vOnModifiersGuard, vOnKeysGuard } from './directives/vOn'
// re-export everything from core
2019-08-20 13:58:10 +00:00
// h, Component, reactivity API, nextTick, flags & types
2018-10-26 19:44:50 +00:00
export * from '@vue/runtime-core'
2019-09-06 20:58:32 +00:00
2019-10-10 22:02:51 +00:00
// Type augmentations
2019-09-06 20:58:32 +00:00
export interface ComponentPublicInstance {
$el: Element
}