vanilla-beans
Version:
Thin layer on top of HTML and DOM API, dramatically simplify development of SPA using Vanilla Js.
80 lines (66 loc) • 1.58 kB
TypeScript
interface Factory {
with: (context?: any) => FactoryInitiated
}
interface CJSModule {
script?: string,
src: string,
evaluated?: any,
imports?:{}
}
interface CSSModule {
style:string,
src:string,
evaluated?: CSSStyleSheet,
imports?:{}
}
interface FactoryInitiated {
create: (
tag: string,
attributes?:{
[name:string]: string
}) => Element
}
interface BeanDescriptor {
t: string,
a?: {
[name: string]: string
},
c?: [BeanDescriptor | string],
script?: string,
init?: (
$context: any,
$factory: Factory,
$ref: {
[refId: string]: Node
},
document: Document,
require: (moduleKey: string) => any
) => void
}
interface BeansModule {
beans: {
[name: string]: BeanDescriptor,
},
imports?: {
[moduleKey: string]: {
type: 'html' | 'cjs' | 'css',
src: string
}
},
src: string
}
interface BeanInstance extends Element {
beanMount: (target: Node, before: Node | number) => void,
beanUnmount: () => void,
beanStart: () => void,
beanStop: () => void,
beanDestroy: () => void,
beanUpdate: (data: any, options: any, additional: any) => void,
onBeanMount?: () => void,
onBeanUnmount?: () => void,
onBeanStart?: () => void,
onBeanStop?: () => void,
onBeanUpdate?: (data, options, additional) => void,
transformBeanData?: (data, options, additional) => any,
onBeanDestroy?: () => void
}