import { Appliers, GetChild, GetHandler, GetTotalSize } from "@/core/interpretator/dom/instructions/api.instructions"; import { AnalyzisResult } from "@/core/interpretator/dom/analyzer/type.analyze"; import { text, event, stick, list, slot } from "@/core/interpretator/dom/embedded/index" export function Apply(node: HTMLElement, instructions: AnalyzisResult): void { let index = 0 let array = instructions.Array while (index < instructions.Length) { const handler = GetHandler(index, array) switch (handler) { case text.TEXT_HANDLER_ID: { text.ApplyText(node, index, array) break } case event.EVENT_HANDLER_ID: { event.ApplyEvents(node, index, array) break } case slot.SLOT_HANDLER_ID: { slot.ApplySlot(node, index, array) break } case stick.STICK_HANDLER_ID: { stick.ApplyStick(node, index, array) break } case list.LIST_HANDLER_ID: { list.ApplyList(node, index, array) break } default: { const applier = Appliers[handler] applier(node, index, array) } } index += GetTotalSize(index, instructions.Array) } }