Initial commit

This commit is contained in:
Porawit Dongwang
2026-09-16 23:20:08 +07:00
commit 0041668dbb
32577 changed files with 3687927 additions and 0 deletions
@@ -0,0 +1,20 @@
import { directive } from '../directives'
import { destroyTree, initTree } from '../lifecycle'
import { mutateDom } from '../mutation'
directive('html', (el, { expression }, { effect, evaluateLater }) => {
let evaluate = evaluateLater(expression)
effect(() => {
evaluate(value => {
mutateDom(() => {
Array.from(el.children).forEach(child => destroyTree(child))
el.innerHTML = value ?? ''
el._x_ignoreSelf = true
initTree(el)
delete el._x_ignoreSelf
})
})
}, { priority: 'structural' })
})