import { RendererOptions } from '@vue/runtime-core' ; import { VNNode , VNWidget } from 'widgets/config' ; import { VNText } from 'widgets/Text/VNText' ; import { VNButton } from 'widgets/Button/VNButton' ; import { VNMetaWidget } from '../widgets/MetaWidget/VNMetaWidget' ; import { ValidNativeWidgets } from '../widgets/nativeWidget' ; import getConfigByType from '../widgets/widgetMap' ; import patchProp from './patchProp' ; const nodeOps = { insert : ( child , parent , anchor ) => { if ( anchor ) { parent . insertBefore ( child , anchor ) ; } else { parent . insertChild ( child as VNWidget < any > ) ; } ( child as VNWidget < any > ) . setNodeParent ( parent ) ; } , remove : ( child ) => { const { nodeParent } = child ; if ( nodeParent ) { ( nodeParent as VNNode < any > ) . removeChild ( child ) ; } } , createElement : ( type ) => { const config = getConfigByType ( type ) ; return config . createElement ( ) ; } , createText : ( ) => new VNMetaWidget ( ) , createComment : ( ) => new VNMetaWidget ( ) , setText : ( node , text ) => { node . setText ( text ) ; } , setElementText : ( node , text ) => { node . setText ( text ) ; } , parentNode : ( node ) => { if ( node ) { return node . nodeParent as VNNode < any > ; } return null ; } , nextSibling : ( node ) => { const nodeParent = node . nodeParent as VNNode < any > ; return nodeParent . getNextSibling ( node ) as VNWidget < any > ; } , patchProp , } ; export default nodeOps ;