4bd75132 by Adam Heath

Add ReplaceNode(similar to WrapNode), and change the name of the called

function to Component, from Wrapped.
1 parent 3bb5a2fc
...@@ -5,8 +5,9 @@ import Node from './node.astro' ...@@ -5,8 +5,9 @@ import Node from './node.astro'
5 import Replace from './replace.astro' 5 import Replace from './replace.astro'
6 import External from './external.astro' 6 import External from './external.astro'
7 import WrapNode from './wrap-node.astro' 7 import WrapNode from './wrap-node.astro'
8 import ReplaceNode from './replace-node.astro'
8 9
9 export { Children, Custom, Match, Node, Replace, External, WrapNode } 10 export { Children, Custom, Match, Node, Replace, External, WrapNode, ReplaceNode }
10 11
11 import type { NodeType } from 'ultrahtml' 12 import type { NodeType } from 'ultrahtml'
12 type SlotHandler = (string, NodeType) => Promise<Any> 13 type SlotHandler = (string, NodeType) => Promise<Any>
......
1 ---
2 import Children from './children.astro'
3
4 const { props: { Component, args, node, special, ...rest } } = Astro
5 ---
6 {!special &&
7 <Component {...node.attributes} {...args}>
8 <Children parent={node} children={node.children} special={special} {...rest}/>
9 </Component>
10 }
1 --- 1 ---
2 import Node from './node.astro' 2 import Node from './node.astro'
3 3
4 const { props: { Wrapped, args, special, ...rest } } = Astro 4 const { props: { Component, args, special, ...rest } } = Astro
5 --- 5 ---
6 {!special && 6 {!special &&
7 <Wrapped {...args}> 7 <Component {...args}>
8 <Node {...rest}/> 8 <Node {...rest}/>
9 </Wrapped> 9 </Component>
10 } 10 }
......