@@ -25,7 +25,6 @@ export enum IRNodeTypes {
2525
2626 INSERT_NODE ,
2727 PREPEND_NODE ,
28- CREATE_TEXT_NODE ,
2928 CREATE_COMPONENT_NODE ,
3029 SLOT_OUTLET_NODE ,
3130
@@ -36,6 +35,9 @@ export enum IRNodeTypes {
3635 FOR ,
3736
3837 GET_TEXT_CHILD ,
38+
39+ CREATE_NODES ,
40+ SET_NODES ,
3941}
4042
4143export interface BaseIRNode {
@@ -78,6 +80,8 @@ export interface IfIRNode extends BaseIRNode {
7880 positive : BlockIRNode
7981 negative ?: BlockIRNode | IfIRNode
8082 once ?: boolean
83+ parent ?: number
84+ anchor ?: number
8185}
8286
8387export interface IRFor {
@@ -95,6 +99,8 @@ export interface ForIRNode extends BaseIRNode, IRFor {
9599 once : boolean
96100 component : boolean
97101 onlyChild : boolean
102+ parent ?: number
103+ anchor ?: number
98104}
99105
100106export interface SetPropIRNode extends BaseIRNode {
@@ -118,12 +124,11 @@ export interface SetDynamicEventsIRNode extends BaseIRNode {
118124 event : SimpleExpressionNode
119125}
120126
121- export interface SetTextIRNode extends BaseIRNode {
122- type : IRNodeTypes . SET_TEXT
127+ export interface SetNodesIRNode extends BaseIRNode {
128+ type : IRNodeTypes . SET_NODES
123129 element : number
124130 values : SimpleExpressionNode [ ]
125131 generated ?: boolean // whether this is a generated empty text node by `processTextLikeContainer`
126- jsx ?: boolean
127132}
128133
129134export type KeyOverride = [ find : string , replacement : string ]
@@ -160,11 +165,10 @@ export interface SetTemplateRefIRNode extends BaseIRNode {
160165 effect : boolean
161166}
162167
163- export interface CreateTextNodeIRNode extends BaseIRNode {
164- type : IRNodeTypes . CREATE_TEXT_NODE
168+ export interface CreateNodesIRNode extends BaseIRNode {
169+ type : IRNodeTypes . CREATE_NODES
165170 id : number
166171 values ?: SimpleExpressionNode [ ]
167- jsx ?: boolean
168172}
169173
170174export interface InsertNodeIRNode extends BaseIRNode {
@@ -200,6 +204,8 @@ export interface CreateComponentIRNode extends BaseIRNode {
200204 root : boolean
201205 once : boolean
202206 dynamic ?: SimpleExpressionNode
207+ parent ?: number
208+ anchor ?: number
203209}
204210
205211export interface DeclareOldRefIRNode extends BaseIRNode {
@@ -213,6 +219,8 @@ export interface SlotOutletIRNode extends BaseIRNode {
213219 name : SimpleExpressionNode
214220 props : IRProps [ ]
215221 fallback ?: BlockIRNode
222+ parent ?: number
223+ anchor ?: number
216224}
217225
218226export interface GetTextChildIRNode extends BaseIRNode {
@@ -224,12 +232,12 @@ export type IRNode = OperationNode | RootIRNode
224232export type OperationNode =
225233 | SetPropIRNode
226234 | SetDynamicPropsIRNode
227- | SetTextIRNode
235+ | SetNodesIRNode
228236 | SetEventIRNode
229237 | SetDynamicEventsIRNode
230238 | SetHtmlIRNode
231239 | SetTemplateRefIRNode
232- | CreateTextNodeIRNode
240+ | CreateNodesIRNode
233241 | InsertNodeIRNode
234242 | PrependNodeIRNode
235243 | DirectiveIRNode
@@ -263,6 +271,7 @@ export interface IRDynamicInfo {
263271 children : IRDynamicInfo [ ]
264272 template ?: number
265273 hasDynamicChild ?: boolean
274+ operation ?: OperationNode
266275}
267276
268277export interface IREffect {
@@ -290,3 +299,19 @@ export type VaporDirectiveNode = Overwrite<
290299 arg : Exclude < DirectiveNode [ 'arg' ] , CompoundExpressionNode >
291300 }
292301>
302+
303+ export type InsertionStateTypes =
304+ | IfIRNode
305+ | ForIRNode
306+ | SlotOutletIRNode
307+ | CreateComponentIRNode
308+
309+ export function isBlockOperation ( op : OperationNode ) : op is InsertionStateTypes {
310+ const type = op . type
311+ return (
312+ type === IRNodeTypes . CREATE_COMPONENT_NODE ||
313+ type === IRNodeTypes . SLOT_OUTLET_NODE ||
314+ type === IRNodeTypes . IF ||
315+ type === IRNodeTypes . FOR
316+ )
317+ }
0 commit comments