mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
50 lines
1.4 KiB
TypeScript
Executable File
50 lines
1.4 KiB
TypeScript
Executable File
import {Hooks} from './hooks';
|
|
import {AttachData} from './helpers/attachto'
|
|
import {VNodeStyle} from './modules/style'
|
|
import {On} from './modules/eventlisteners'
|
|
import {Attrs} from './modules/attributes'
|
|
import {Classes} from './modules/class'
|
|
import {Props} from './modules/props'
|
|
import {Dataset} from './modules/dataset'
|
|
import {Hero} from './modules/hero'
|
|
|
|
export type Key = string | number;
|
|
|
|
export interface VNode {
|
|
sel: string | undefined;
|
|
data: VNodeData | undefined;
|
|
children: Array<VNode | string> | undefined;
|
|
elm: Node | undefined;
|
|
text: string | undefined;
|
|
key: Key | undefined;
|
|
}
|
|
|
|
export interface VNodeData {
|
|
props?: Props;
|
|
attrs?: Attrs;
|
|
class?: Classes;
|
|
style?: VNodeStyle;
|
|
dataset?: Dataset;
|
|
on?: On;
|
|
hero?: Hero;
|
|
attachData?: AttachData;
|
|
hook?: Hooks;
|
|
key?: Key;
|
|
ns?: string; // for SVGs
|
|
fn?: () => VNode; // for thunks
|
|
args?: Array<any>; // for thunks
|
|
[key: string]: any; // for any other 3rd party module
|
|
}
|
|
|
|
export function vnode(sel: string | undefined,
|
|
data: any | undefined,
|
|
children: Array<VNode | string> | undefined,
|
|
text: string | undefined,
|
|
elm: Element | Text | undefined): VNode {
|
|
let key = data === undefined ? undefined : data.key;
|
|
return {sel: sel, data: data, children: children,
|
|
text: text, elm: elm, key: key};
|
|
}
|
|
|
|
export default vnode;
|