vaporHelpers.add('children')
}
- for (const opration of ir.opration) {
- switch (opration.type) {
+ for (const operation of ir.operation) {
+ switch (operation.type) {
case IRNodeTypes.TEXT_NODE: {
// TODO handle by runtime: document.createTextNode
- code += `const n${opration.id} = document.createTextNode(${opration.content})\n`
+ code += `const n${operation.id} = document.createTextNode(${operation.content})\n`
break
}
case IRNodeTypes.INSERT_NODE:
{
let anchor = ''
- if (typeof opration.anchor === 'number') {
- anchor = `, n${opration.anchor}`
- } else if (opration.anchor === 'first') {
+ if (typeof operation.anchor === 'number') {
+ anchor = `, n${operation.anchor}`
+ } else if (operation.anchor === 'first') {
anchor = `, 0 /* InsertPosition.FIRST */`
}
- code += `insert(n${opration.element}, n${opration.parent}${anchor})\n`
+ code += `insert(n${operation.element}, n${operation.parent}${anchor})\n`
vaporHelpers.add('insert')
}
break
template: Array<TemplateGeneratorIRNode>
children: DynamicChildren
effect: Record<string, EffectNode[]>
- opration: OprationNode[]
+ operation: OperationNode[]
helpers: Set<string>
vaporHelpers: Set<string>
}
anchor: number | 'first' | 'last'
}
-export type OprationNode = TextNodeIRNode | InsertNodeIRNode
+export type OperationNode = TextNodeIRNode | InsertNodeIRNode
export interface DynamicChild {
id: number | null
import {
type DynamicChildren,
type EffectNode,
- type OprationNode,
+ type OperationNode,
type RootIRNode,
IRNodeTypes,
} from './ir'
getElementId(): number
registerTemplate(): number
registerEffect(expr: string, effectNode: EffectNode): void
- registerOpration(...oprations: OprationNode[]): void
+ registerOpration(...oprations: OperationNode[]): void
helper(name: string): string
}
options: TransformOptions,
): TransformContext<RootNode> {
let i = 0
- const { effect, opration, helpers, vaporHelpers } = ir
+ const { effect, operation: operation, helpers, vaporHelpers } = ir
const ctx: TransformContext<RootNode> = {
node,
return ir.template.length - 1
},
registerOpration(...node) {
- opration.push(...node)
+ operation.push(...node)
},
// TODO not used yet
helper(name, vapor = true) {
template: [],
children: {},
effect: Object.create(null),
- opration: [],
+ operation: [],
helpers: new Set([]),
vaporHelpers: new Set([]),
}