type: IRNodeTypes
}
-export type CoreHelper = keyof typeof import('packages/runtime-core/src')
+export type CoreHelper = keyof typeof import('packages/runtime-dom/src')
export type VaporHelper = keyof typeof import('packages/runtime-vapor/src')
} from '../directives/vShow'
import { CSS_VAR_TEXT } from '../helpers/useCssVars'
-type Style = StyleValue | Record<string, StyleValue | StyleValue[]>
-type StyleValue = string | null | undefined
+type Style = string | null | undefined | Record<string, unknown>
const displayRE = /(^|;)\s*display\s*:/
const semicolonRE = /[^\\];\s*$/
const importantRE = /\s*!important$/
-function setStyle(
- style: CSSStyleDeclaration,
- name: string,
- val: StyleValue | StyleValue[],
-) {
- if (isArray(val)) {
- val.forEach(v => setStyle(style, name, v))
+function setStyle(style: CSSStyleDeclaration, name: string, rawVal: unknown) {
+ if (isArray(rawVal)) {
+ rawVal.forEach(v => setStyle(style, name, v))
} else {
- if (val == null) val = ''
+ const val = rawVal == null ? '' : String(rawVal)
if (__DEV__) {
if (semicolonRE.test(val)) {
warn(
inheritAttrs: false,
setup(_props, { attrs }) {
const el = document.createElement('div')
- let prev: any
- renderEffect(() => {
- prev = setDynamicProps(el, [attrs], prev, true)
- })
+ renderEffect(() => setDynamicProps(el, [attrs]))
return el
},
})
const n0 = createComponent(Wrapper, null, {
default: () => {
const n0 = template('<div>')() as HTMLDivElement
- let prev: any
- renderEffect(() => {
- prev = setDynamicProps(n0, [attrs], prev, true)
- })
+ renderEffect(() => setDynamicProps(n0, [attrs]))
return n0
},
})
watch,
watchEffect,
} from '@vue/runtime-dom'
-import { createComponent, setRef, template } from '../src'
+import { createComponent, createTemplateRefSetter, template } from '../src'
import { makeRender } from './_utils'
import type { VaporComponent } from '../src/component'
import type { RefEl } from '../src/apiTemplateRef'
const Child = {
render() {
const el = template('<div>')()
+ const setRef = createTemplateRefSetter()
setRef(el as RefEl, ref)
return el
},
import { hyphenate, isArray, isObject, isString } from './general'
-export type NormalizedStyle = Record<string, string>
+export type NormalizedStyle = Record<string, unknown>
export function normalizeStyle(
value: unknown,