@pyreon/runtime-dom 0.11.5 → 0.11.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -22
- package/lib/analysis/index.js.html +1 -1
- package/lib/index.js +4 -3
- package/lib/index.js.map +1 -1
- package/package.json +12 -12
- package/src/delegate.ts +25 -25
- package/src/devtools.ts +37 -37
- package/src/hydrate.ts +30 -30
- package/src/hydration-debug.ts +2 -2
- package/src/index.ts +20 -20
- package/src/keep-alive.ts +6 -6
- package/src/mount.ts +46 -46
- package/src/nodes.ts +31 -19
- package/src/props.ts +93 -93
- package/src/template.ts +6 -6
- package/src/tests/coverage-gaps.test.ts +669 -669
- package/src/tests/coverage.test.ts +299 -299
- package/src/tests/mount.test.ts +1183 -1183
- package/src/tests/props.test.ts +219 -219
- package/src/tests/setup.ts +1 -1
- package/src/tests/show-context.test.ts +43 -43
- package/src/tests/template.test.ts +71 -71
- package/src/tests/transition.test.ts +124 -124
- package/src/transition-group.ts +22 -22
- package/src/transition.ts +18 -18
package/src/template.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { NativeItem } from
|
|
2
|
-
import { renderEffect } from
|
|
1
|
+
import type { NativeItem } from '@pyreon/core'
|
|
2
|
+
import { renderEffect } from '@pyreon/reactivity'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Creates a row/item factory backed by HTML template cloning.
|
|
@@ -30,7 +30,7 @@ export function createTemplate<T>(
|
|
|
30
30
|
html: string,
|
|
31
31
|
bind: (el: HTMLElement, item: T) => (() => void) | null,
|
|
32
32
|
): (item: T) => NativeItem {
|
|
33
|
-
const tmpl = document.createElement(
|
|
33
|
+
const tmpl = document.createElement('template')
|
|
34
34
|
tmpl.innerHTML = html
|
|
35
35
|
const proto = tmpl.content.firstElementChild as HTMLElement
|
|
36
36
|
|
|
@@ -67,7 +67,7 @@ export function _bindText(
|
|
|
67
67
|
if (source.direct) {
|
|
68
68
|
const textUpdate = () => {
|
|
69
69
|
const v = source._v
|
|
70
|
-
node.data = v == null || v === false ?
|
|
70
|
+
node.data = v == null || v === false ? '' : String(v as string | number)
|
|
71
71
|
}
|
|
72
72
|
textUpdate()
|
|
73
73
|
return source.direct(textUpdate)
|
|
@@ -76,7 +76,7 @@ export function _bindText(
|
|
|
76
76
|
const fn = source as unknown as () => unknown
|
|
77
77
|
return renderEffect(() => {
|
|
78
78
|
const v = fn()
|
|
79
|
-
node.data = v == null || v === false ?
|
|
79
|
+
node.data = v == null || v === false ? '' : String(v as string | number)
|
|
80
80
|
})
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -143,7 +143,7 @@ const _tplCache = new Map<string, HTMLTemplateElement>()
|
|
|
143
143
|
export function _tpl(html: string, bind: (el: HTMLElement) => (() => void) | null): NativeItem {
|
|
144
144
|
let tpl = _tplCache.get(html)
|
|
145
145
|
if (!tpl) {
|
|
146
|
-
tpl = document.createElement(
|
|
146
|
+
tpl = document.createElement('template')
|
|
147
147
|
tpl.innerHTML = html
|
|
148
148
|
_tplCache.set(html, tpl)
|
|
149
149
|
}
|