22 effectScope ,
33 insert ,
44 isFragment ,
5+ isVaporComponent ,
56 remove ,
67 renderEffect ,
78 VaporFragment ,
@@ -12,27 +13,29 @@ import {
1213export { shallowRef as useRef } from 'vue'
1314
1415function createFragment (
15- nodes : Block [ ] ,
16+ nodes : Block ,
1617 anchor : Node | undefined = document . createTextNode ( '' ) ,
1718) {
1819 const frag = new VaporFragment ( nodes )
1920 frag . anchor = anchor
2021 return frag
2122}
2223
23- function normalizeValue ( value : any , anchor ?: Element ) : Block {
24- if ( value instanceof Node || isFragment ( value ) ) {
24+ function normalizeNode ( node : any , anchor ?: Element ) : Block {
25+ if ( node instanceof Node || isFragment ( node ) ) {
2526 anchor && ( anchor . textContent = '' )
26- return value
27- } else if ( Array . isArray ( value ) ) {
27+ return node
28+ } else if ( isVaporComponent ( node ) ) {
29+ anchor && ( anchor . textContent = '' )
30+ return createFragment ( node , anchor )
31+ } else if ( Array . isArray ( node ) ) {
2832 anchor && ( anchor . textContent = '' )
2933 return createFragment (
30- value . map ( ( i ) => normalizeValue ( i ) ) ,
34+ node . map ( ( i ) => normalizeNode ( i ) ) ,
3135 anchor ,
3236 )
3337 } else {
34- const result =
35- value == null || typeof value === 'boolean' ? '' : String ( value )
38+ const result = node == null || typeof node === 'boolean' ? '' : String ( node )
3639 if ( anchor ) {
3740 anchor . textContent = result
3841 return anchor
@@ -43,7 +46,7 @@ function normalizeValue(value: any, anchor?: Element): Block {
4346}
4447
4548function resolveValue ( current : Block , value : any , anchor ?: Element ) {
46- const node = normalizeValue ( value , anchor )
49+ const node = normalizeNode ( value , anchor )
4750 if ( current ) {
4851 if ( isFragment ( current ) ) {
4952 const { anchor } = current
0 commit comments