diff --git a/examples/boundle/boundle.js b/examples/boundle/boundle.js index a7528d3..bdcfe8a 100644 --- a/examples/boundle/boundle.js +++ b/examples/boundle/boundle.js @@ -6,6 +6,16 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Vact = {})); })(this, (function (exports) { 'use strict'; + const TextSymbol = Symbol('Text'); + + const FragmentSymbol = Symbol('Fragment'); + + const VComponentSymbol = Symbol('VComponent'); + + const ArraySymbol = Symbol('ArrayNode'); + + const AliveSymbol = Symbol('Alive'); + /** * 虚拟dom节点类型枚举 */ @@ -21,12 +31,6 @@ VNODE_TYPE[VNODE_TYPE["ALIVE"] = 5] = "ALIVE"; })(VNODE_TYPE || (VNODE_TYPE = {})); - const FragmentSymbol = Symbol('Fragment'); - - const TextSymbol = Symbol('Text'); - - const ArraySymbol = Symbol('ArrayNode'); - function isString(content) { return typeof content === 'string'; } @@ -183,6 +187,10 @@ function setActiver(fn) { activeWatcher = fn; } + // 设置全局变量 + function getActiver() { + return activeWatcher; + } class RefImpl { constructor(value) { @@ -229,9 +237,49 @@ return new Activer(fn); } - const AliveSymbol = Symbol('Alive'); - - const VComponentSymbol = Symbol('VComponent'); + class ComponentLifeCycle { + constructor() { + this.createdList = []; + this.beforeMountedList = []; + this.readyMountedList = []; + this.mountedList = []; + this.beforeUnMountedList = []; + this.unMountedList = []; + } + created(fn) { + this.createdList.push(fn); + } + beforeMounted(fn) { + this.beforeMountedList.push(fn); + } + readyMounted(fn) { + this.readyMountedList.push(fn); + } + mounted(fn) { + this.mountedList.push(fn); + } + beforeUnMounted(fn) { + this.beforeUnMountedList.push(fn); + } + unMounted(fn) { + this.unMountedList.push(fn); + } + emit(lifeName) { + this[`${lifeName}List`].forEach(fn => fn()); + } + } + // 生成类组件生命周期实例 + function createClassComponentLife(component) { + let lifeNames = ['created', 'beforeMounted', 'readyMounted', 'mounted', 'beforeUnMounted', 'unMounted']; + let lifeCycle = new ComponentLifeCycle(); + lifeNames.forEach(lifeName => { + let fn = component[lifeName]; + if (!fn) + return; + lifeCycle[lifeName](fn.bind(component)); + }); + return lifeCycle; + } /** * 函数转化为activer转化为VAlive @@ -262,6 +310,13 @@ return retText; } } + /** + * text(不需要props)、fragment(不需要props)、element、component为显性创建 + * array(不需要props)、alive(不需要props)为隐形创建 + */ + function renderApi(type, props, children) { + return render(type, props || undefined, children); + } function render(type, originProps, originChildren) { // text的children比较特殊先处理 if (isText(type)) { @@ -348,6 +403,14 @@ } return componentProps; } + // 渲染一个活跃的节点 + function renderAlive(activer) { + return { + type: AliveSymbol, + flag: VNODE_TYPE.ALIVE, + activer + }; + } // 判断是普通函数还是构造函数 function renderComponent(component, props, children) { let componentProps = createComponentProps(props); @@ -358,32 +421,37 @@ let result = new ClassComponent(componentProps, children); result.props = componentProps; result.children = children; - return { + let lifeCycle = createClassComponentLife(result); + let vn = result.render(renderApi); + lifeCycle.emit('created'); + let vc = { type: VComponentSymbol, - root: createVNode(result.render(render)), + root: createVNode(vn), props: componentProps, children: children, - flag: VNODE_TYPE.COMPONENT + flag: VNODE_TYPE.COMPONENT, + lifeStyleInstance: lifeCycle }; + lifeCycle.emit('beforeMounted'); + return vc; } else { let FunctionComponent = component; - return { + let lifeCycle = new ComponentLifeCycle(); + let vn = FunctionComponent(componentProps, children, lifeCycle); + lifeCycle.emit('created'); + let vc = { type: VComponentSymbol, - root: createVNode(FunctionComponent(componentProps, children)), + root: createVNode(vn), props: componentProps, children: children, - flag: VNODE_TYPE.COMPONENT + flag: VNODE_TYPE.COMPONENT, + lifeStyleInstance: lifeCycle }; + lifeCycle.emit('beforeMounted'); + return vc; } } - function renderAlive(activer) { - return { - type: AliveSymbol, - flag: VNODE_TYPE.ALIVE, - activer - }; - } /** * 观察者 @@ -764,10 +832,14 @@ } function mountComponent(vNode, container, anchor, app) { const root = vNode.root; + vNode.lifeStyleInstance.emit('readyMounted'); mount(root, container, anchor, app); + vNode.lifeStyleInstance.emit('mounted'); } function unmountComponent(vNode, container) { + vNode.lifeStyleInstance.emit('beforeUnMounted'); unmount(vNode.root); + vNode.lifeStyleInstance.emit('unMounted'); } function mountAlive(vnode, container, anchor, app) { let firstVNode = watchVNode(vnode, (oldVNode, newVNode) => patch(oldVNode, newVNode, container, app)); @@ -776,22 +848,24 @@ } class Component { - constructor(config = {}) { - this.config = config; - this.data = defineState(config.data || {}); - } } - class Vact { + class App { constructor(vnode, options) { this.rootVNode = vnode; this.options = options || {}; } mount(selector) { - const el = document.querySelector(selector); - let container = document.createElement('div'); - mount(this.rootVNode, container, undefined, this); - el === null || el === void 0 ? void 0 : el.replaceWith(...container.childNodes); + if (selector) { + const el = document.querySelector(selector) || document.body; + mount(this.rootVNode, el, undefined, this); + } + else { + mount(this.rootVNode, document.body, undefined, this); + } + // let container = document.createElement('div') + // mount(this.rootVNode, container, undefined, this) + // el?.replaceWith(...container.childNodes) } use(plugin) { const utils = { state, defineState, h: render }; @@ -800,22 +874,31 @@ } } function createApp(vnode, options) { - return new Vact(vnode, options); + return new App(vnode, options); } exports.Activer = Activer; exports.Component = Component; - exports.Fragment = FragmentSymbol; - exports.Text = TextSymbol; + exports.RefImpl = RefImpl; + exports.VArray = ArraySymbol; + exports.VComponent = VComponentSymbol; + exports.VFragment = FragmentSymbol; + exports.VText = TextSymbol; + exports.Watcher = Watcher; + exports.active = active; exports.createApp = createApp; - exports.createVNode = render; - exports["default"] = Vact; + exports.createVNode = renderApi; + exports["default"] = App; exports.defineState = defineState; + exports.getActiver = getActiver; exports.mount = mount; exports.reactive = reactive; exports.ref = ref; - exports.render = render; + exports.render = renderApi; + exports.setActiver = setActiver; exports.state = state; + exports.track = track; + exports.trigger = trigger; exports.watch = watch; exports.watchProp = watchProp; exports.watchVNode = watchVNode; diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..b0ed63e --- /dev/null +++ b/index.d.ts @@ -0,0 +1,254 @@ +declare class RefImpl { + private _value; + private readonly _target; + constructor(value: T); + get value(): T; + set value(value: T); +} +declare function ref(value: T): RefImpl; + +declare function state(value: T): RefImpl; +declare function defineState>(target: T): T; + +/** + * 响应式对象 +*/ +declare class Activer { + callback: () => T; + flag: string; + constructor(fn: () => T); + get value(): T; +} +/** + * 外置函数 +*/ +declare function active(fn: () => T): Activer; + +declare type Meta = { + targetPropOldValue: any; + targetPropnewValue: any; +}; +/** + * 观察者 + * 观察数据的变化 +*/ +declare class Watcher { + value: T; + callback: (oldValue: T, newValue: T, meta?: Meta) => void; + activeProps: Activer; + depArr?: Array | false; + nextDepArr?: Array; + constructor(activeProps: Activer, callback: (oldValue: T, newValue: T, meta?: Meta) => void); + update(): void; +} +/** + * 监控自定义响应式属性 +*/ +declare function watch(activeProps: (() => T) | Activer, callback: (oldValue: T, newValue: T) => void): Watcher; +/** + * 监控可变状态dom +*/ +declare function watchVNode(activeVNode: VAlive, callback: (oldVNode: VNode, newVNode: VNode) => void): VNode; +/** + * 监控可变dom的prop +*/ +declare function watchProp(activeProp: Activer, callback: (oldVNode: VNode, newVNode: VNode) => void): any; + +/** + * 实现响应式对象 +*/ +declare function reactive>(target: T): T; +/** + * 响应触发依赖 +*/ +declare function trigger(target: Record, prop: string | symbol): void; +/** + * 追踪绑定依赖 +*/ +declare function track(target: Record, prop: string | symbol): void; +declare function setActiver(fn: Watcher | null): void; +declare function getActiver(): Watcher | null; + +/** + * 传说中的render函数 +*/ +declare type HSymbol = typeof TextSymbol | typeof FragmentSymbol | typeof AliveSymbol | typeof ArraySymbol; +declare type HType = string | HSymbol | ComponentType; +declare type H = (type: HType, props?: VNodeProps, children?: OriginVNode | Array) => VNode; +/** + * text(不需要props)、fragment(不需要props)、element、component为显性创建 + * array(不需要props)、alive(不需要props)为隐形创建 +*/ +declare function renderApi(type: HType, props?: VNodeProps | null, children?: OriginVNode | Array): VNode; + +interface AppUtils { + state: typeof state; + defineState: typeof defineState; + h: typeof renderApi; + watch: typeof watch; +} +interface AppContext { + utils: AppUtils; +} +interface AppPlugin { + install(utils: AppContext): void; +} + +/** + * 根类组件用于类型提示 + * 抽象类 +*/ +interface ComponentInstance { + props?: VNodeProps; + children?: Array; + utils: AppUtils; + life?: ComponentLifeCycle; + render(h?: H): OriginVNode; + /** 组件示例创建之后触发 */ + created?(): void; + /** 组件示例在渲染之前触发(DOM还没有生成) */ + beforeMounted?(): void; + /** dom已经生成到js内存但还没挂载 */ + readyMounted?(): void; + /** dom挂载到了页面上*/ + mounted?(): void; + /** 卸载之前触发 */ + beforeUnMounted?(): void; + /** 卸载之后触发 */ + unMounted?(): void; +} +declare abstract class Component implements ComponentInstance { + abstract props?: VNodeProps; + abstract children?: Array; + abstract render(h?: H): VNode; + utils: AppUtils; + abstract life?: ComponentLifeCycle; + /** 组件示例创建之后触发 */ + abstract created?(): void; + /** 组件示例在渲染之前触发(DOM还没有生成) */ + abstract beforeMounted?(): void; + /** dom已经生成到js内存但还没挂载 */ + abstract readyMounted?(): void; + /** dom挂载到了页面上*/ + abstract mounted?(): void; + /** 卸载之前触发 */ + abstract beforeUnMounted?(): void; + /** 卸载之后触发 */ + abstract unMounted?(): void; +} +declare function defineComponent(componentType: FunctionComponentType): FunctionComponentType; + +/** + * 主要实现关于组件的生命周期 + */ +interface ComponentLifeCycleInstance { + /** 组件示例创建之后触发 */ + created(fn: () => void): void; + /** 组件示例在渲染之前触发(DOM还没有生成) */ + beforeMounted(fn: () => void): void; + /** dom已经生成到js内存但还没挂载 */ + readyMounted(fn: () => void): void; + /** dom挂载到了页面上*/ + mounted(fn: () => void): void; + /** 卸载之前触发 */ + beforeUnMounted(fn: () => void): void; + /** 卸载之后触发 */ + unMounted(fn: () => void): void; +} +declare class ComponentLifeCycle implements ComponentLifeCycleInstance { + private readonly createdList; + private readonly beforeMountedList; + private readonly readyMountedList; + private readonly mountedList; + private readonly beforeUnMountedList; + private readonly unMountedList; + constructor(createdList?: Array<() => void>, beforeMountedList?: Array<() => void>, readyMountedList?: Array<() => void>, mountedList?: Array<() => void>, beforeUnMountedList?: Array<() => void>, unMountedList?: Array<() => void>); + created(fn: () => void): void; + beforeMounted(fn: () => void): void; + readyMounted(fn: () => void): void; + mounted(fn: () => void): void; + beforeUnMounted(fn: () => void): void; + unMounted(fn: () => void): void; + emit(lifeName: keyof ComponentLifeCycleInstance): void; +} + +interface ComponentContext { + props: Record; + children: Array; + life: ComponentLifeCycle; + utils: AppUtils; +} +/** 函数组件类型 */ +interface FunctionComponentType { + (context: ComponentContext): OriginVNode; +} +/** 类组件类型 */ +interface ClassComponentType { + new (props: Record, children: Array): ComponentInstance; +} +declare type ComponentType = FunctionComponentType | ClassComponentType; +declare const VComponentSymbol: unique symbol; + +/** + * 虚拟dom节点类型枚举 +*/ +declare enum VNODE_TYPE { + ELEMENT = 0, + TEXT = 1, + FRAGMENT = 2, + COMPONENT = 3, + ARRAYNODE = 4, + ALIVE = 5 +} +declare type VNodeElement = ChildNode; +/** + * 虚拟dom接口类型 +*/ +interface VNode { + type: string | symbol | ComponentType; + flag: VNODE_TYPE; + props?: Record; + children?: Array | string; + el?: VNodeElement; + anchor?: VNodeElement; + activer?: Activer; + vnode?: VNode; +} +declare type NotFunctionOriginVNode = string | VNode | Array | Activer; +declare type WithFunctionOriginVNode = (() => OriginVNode) | NotFunctionOriginVNode; +declare type OriginVNode = WithFunctionOriginVNode | Exclude; +/** 虚拟节点属性 todo */ +interface VNodeProps { + [propName: string]: any; +} + +declare const TextSymbol: unique symbol; + +declare const FragmentSymbol: unique symbol; + +declare const ArraySymbol: unique symbol; + +declare const AliveSymbol: unique symbol; +interface VAlive extends VNode { + type: symbol; + flag: VNODE_TYPE.ELEMENT; + activer: Activer; + vnode: VNode; +} + +interface Options { + arrayDiff?: boolean; +} +declare class App { + rootVNode: VNode; + options: Options; + private pluginList; + constructor(vNode: VNode, options?: Options); + mount(selector?: string | HTMLElement): void; + use(plugin: AppPlugin): this; +} +declare function createApp(vNode: VNode, options?: Options): App; + +declare function mount(vnode: VNode, container: HTMLElement, anchor?: VNodeElement, app?: App): void; + +export { Activer, Component, RefImpl, ArraySymbol as VArray, VComponentSymbol as VComponent, FragmentSymbol as VFragment, TextSymbol as VText, Watcher, active, createApp, renderApi as createVNode, App as default, defineComponent, defineState, getActiver, renderApi as h, mount, reactive, ref, renderApi as render, setActiver, state, track, trigger, watch, watchProp, watchVNode }; diff --git a/lib/boundle.js b/lib/boundle.js index 2a4cb42..2630d57 100644 --- a/lib/boundle.js +++ b/lib/boundle.js @@ -1,9 +1,17 @@ - -(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document); 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); +const TextSymbol = Symbol('Text'); + +const FragmentSymbol = Symbol('Fragment'); + +const VComponentSymbol = Symbol('VComponent'); + +const ArraySymbol = Symbol('ArrayNode'); + +const AliveSymbol = Symbol('Alive'); + /** * 虚拟dom节点类型枚举 */ @@ -19,12 +27,6 @@ var VNODE_TYPE; VNODE_TYPE[VNODE_TYPE["ALIVE"] = 5] = "ALIVE"; })(VNODE_TYPE || (VNODE_TYPE = {})); -const FragmentSymbol = Symbol('Fragment'); - -const TextSymbol = Symbol('Text'); - -const ArraySymbol = Symbol('ArrayNode'); - function isString(content) { return typeof content === 'string'; } @@ -181,6 +183,10 @@ function track(target, prop) { function setActiver(fn) { activeWatcher = fn; } +// 设置全局变量 +function getActiver() { + return activeWatcher; +} class RefImpl { constructor(value) { @@ -227,9 +233,64 @@ function active(fn) { return new Activer(fn); } -const AliveSymbol = Symbol('Alive'); +class ComponentLifeCycle { + constructor(createdList = [], beforeMountedList = [], readyMountedList = [], mountedList = [], beforeUnMountedList = [], unMountedList = []) { + this.createdList = createdList; + this.beforeMountedList = beforeMountedList; + this.readyMountedList = readyMountedList; + this.mountedList = mountedList; + this.beforeUnMountedList = beforeUnMountedList; + this.unMountedList = unMountedList; + // this.createdList = [] + // this.beforeMountedList = [] + // this.readyMountedList = [] + // this.mountedList = [] + // this.beforeUnMountedList = [] + // this.unMountedList = [] + } + created(fn) { + this.createdList.push(fn); + } + beforeMounted(fn) { + this.beforeMountedList.push(fn); + } + readyMounted(fn) { + this.readyMountedList.push(fn); + } + mounted(fn) { + this.mountedList.push(fn); + } + beforeUnMounted(fn) { + this.beforeUnMountedList.push(fn); + } + unMounted(fn) { + this.unMountedList.push(fn); + } + emit(lifeName) { + this[`${lifeName}List`].forEach(fn => fn()); + } +} +// 生成类组件生命周期实例 +function createClassComponentLife(component) { + let lifeNames = ['created', 'beforeMounted', 'readyMounted', 'mounted', 'beforeUnMounted', 'unMounted']; + let lifeCycle = new ComponentLifeCycle(); + component.life = lifeCycle; + lifeNames.forEach(lifeName => { + let fn = component[lifeName]; + if (!fn) + return; + lifeCycle[lifeName](fn.bind(component)); + }); + return lifeCycle; +} -const VComponentSymbol = Symbol('VComponent'); +// 给插件提供的能力 +const appUtils = { + state, + defineState, + h: renderApi, + watch +}; /** * 函数转化为activer转化为VAlive @@ -260,6 +321,13 @@ function createVNode(originVNode) { return retText; } } +/** + * text(不需要props)、fragment(不需要props)、element、component为显性创建 + * array(不需要props)、alive(不需要props)为隐形创建 +*/ +function renderApi(type, props, children) { + return render(type, props || undefined, children); +} function render(type, originProps, originChildren) { // text的children比较特殊先处理 if (isText(type)) { @@ -346,6 +414,14 @@ function createComponentProps(props) { } return componentProps; } +// 渲染一个活跃的节点 +function renderAlive(activer) { + return { + type: AliveSymbol, + flag: VNODE_TYPE.ALIVE, + activer + }; +} // 判断是普通函数还是构造函数 function renderComponent(component, props, children) { let componentProps = createComponentProps(props); @@ -356,32 +432,37 @@ function renderComponent(component, props, children) { let result = new ClassComponent(componentProps, children); result.props = componentProps; result.children = children; - return { + let lifeCycle = createClassComponentLife(result); + let vn = result.render(renderApi); + lifeCycle.emit('created'); + let vc = { type: VComponentSymbol, - root: createVNode(result.render(render)), + root: createVNode(vn), props: componentProps, children: children, - flag: VNODE_TYPE.COMPONENT + flag: VNODE_TYPE.COMPONENT, + lifeStyleInstance: lifeCycle }; + lifeCycle.emit('beforeMounted'); + return vc; } else { let FunctionComponent = component; - return { + let lifeCycle = new ComponentLifeCycle(); + let vn = FunctionComponent({ props: componentProps, children: children, life: lifeCycle, utils: appUtils }); + lifeCycle.emit('created'); + let vc = { type: VComponentSymbol, - root: createVNode(FunctionComponent(componentProps, children)), + root: createVNode(vn), props: componentProps, children: children, - flag: VNODE_TYPE.COMPONENT + flag: VNODE_TYPE.COMPONENT, + lifeStyleInstance: lifeCycle }; + lifeCycle.emit('beforeMounted'); + return vc; } } -function renderAlive(activer) { - return { - type: AliveSymbol, - flag: VNODE_TYPE.ALIVE, - activer - }; -} /** * 观察者 @@ -762,10 +843,14 @@ function unmountArrayNode(vnode, container, anchor) { } function mountComponent(vNode, container, anchor, app) { const root = vNode.root; + vNode.lifeStyleInstance.emit('readyMounted'); mount(root, container, anchor, app); + vNode.lifeStyleInstance.emit('mounted'); } function unmountComponent(vNode, container) { + vNode.lifeStyleInstance.emit('beforeUnMounted'); unmount(vNode.root); + vNode.lifeStyleInstance.emit('unMounted'); } function mountAlive(vnode, container, anchor, app) { let firstVNode = watchVNode(vnode, (oldVNode, newVNode) => patch(oldVNode, newVNode, container, app)); @@ -774,46 +859,68 @@ function mountAlive(vnode, container, anchor, app) { } class Component { - constructor(config = {}) { - this.config = config; - this.data = defineState(config.data || {}); + constructor() { + this.utils = appUtils; } } +function defineComponent(componentType) { + return componentType; +} -class Vact { - constructor(vnode, options) { - this.rootVNode = vnode; +class App { + constructor(vNode, options) { + this.rootVNode = vNode; this.options = options || {}; + this.pluginList = []; } mount(selector) { - const el = document.querySelector(selector); - let container = document.createElement('div'); - mount(this.rootVNode, container, undefined, this); - el === null || el === void 0 ? void 0 : el.replaceWith(...container.childNodes); + if (selector) { + const el = (isString(selector) ? document.querySelector(selector) : selector) || document.body; + mount(this.rootVNode, el, undefined, this); + } + else { + mount(this.rootVNode, document.body, undefined, this); + } + // let container = document.createElement('div') + // mount(this.rootVNode, container, undefined, this) + // el?.replaceWith(...container.childNodes) } use(plugin) { - const utils = { state, defineState, h: render }; - plugin.install(utils); + let index = this.pluginList.indexOf(plugin); + if (index > -1) + return this; + plugin.install({ utils: appUtils }); return this; } } -function createApp(vnode, options) { - return new Vact(vnode, options); +function createApp(vNode, options) { + return new App(vNode, options); } exports.Activer = Activer; exports.Component = Component; -exports.Fragment = FragmentSymbol; -exports.Text = TextSymbol; +exports.RefImpl = RefImpl; +exports.VArray = ArraySymbol; +exports.VComponent = VComponentSymbol; +exports.VFragment = FragmentSymbol; +exports.VText = TextSymbol; +exports.Watcher = Watcher; +exports.active = active; exports.createApp = createApp; -exports.createVNode = render; -exports["default"] = Vact; +exports.createVNode = renderApi; +exports["default"] = App; +exports.defineComponent = defineComponent; exports.defineState = defineState; +exports.getActiver = getActiver; +exports.h = renderApi; exports.mount = mount; exports.reactive = reactive; exports.ref = ref; -exports.render = render; +exports.render = renderApi; +exports.setActiver = setActiver; exports.state = state; +exports.track = track; +exports.trigger = trigger; exports.watch = watch; exports.watchProp = watchProp; exports.watchVNode = watchVNode; diff --git a/lib/boundle.js.map b/lib/boundle.js.map index 14b964a..41cf041 100644 --- a/lib/boundle.js.map +++ b/lib/boundle.js.map @@ -1 +1 @@ -{"version":3,"file":"boundle.js","sources":["../src/vnode/vnode.ts","../src/vnode/fragment.ts","../src/vnode/text.ts","../src/vnode/array.ts","../src/utils.ts","../src/reactive/update.ts","../src/reactive/reactive.ts","../src/reactive/ref.ts","../src/reactive/utils.ts","../src/reactive/active.ts","../src/vnode/alive.ts","../src/vnode/component.ts","../src/render.ts","../src/reactive/watch.ts","../src/mount/element.ts","../src/mount/patch.ts","../src/mount/mount.ts","../src/component.ts","../src/vact.ts"],"sourcesContent":["import { Activer } from \"../reactive\"\r\nimport { ComponentConstructor } from './component'\r\n\r\n/**\r\n * 虚拟dom节点类型枚举\r\n*/\r\nexport enum VNODE_TYPE {\r\n // 普通元素节点类型\r\n ELEMENT,\r\n // 文本节点类型\r\n TEXT,\r\n FRAGMENT,\r\n COMPONENT,\r\n ARRAYNODE,\r\n ALIVE\r\n}\r\n\r\n/**\r\n * 虚拟dom接口类型\r\n*/\r\nexport interface VNode {\r\n\r\n // 虚拟节点类型\r\n type: string | symbol | ComponentConstructor,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE\r\n\r\n // 虚拟节点属性\r\n props?: Record,\r\n\r\n // 虚拟节点子节点\r\n children?: Array | string,\r\n\r\n // 真实节点\r\n el?: HTMLElement | Text\r\n anchor?: Text\r\n\r\n activer?: Activer\r\n // 目前存在的节点\r\n vnode?: VNode\r\n\r\n}\r\n\r\n// 未经过标准化的childVNode类型\r\nexport type NotFunctionOriginVNode= string | VNode | Array | Activer\r\nexport type WithFunctionOriginVNode= (() => OriginVNode) | NotFunctionOriginVNode\r\nexport type OriginVNode= WithFunctionOriginVNode | Exclude\r\n\r\n/** 虚拟节点属性 */\r\nexport interface VNodeProps {\r\n [propName: string]: any\r\n}\r\n\r\n","import { VNode, VNODE_TYPE } from \"./vnode\";\r\n\r\nexport const FragmentSymbol = Symbol('Fragment');\r\nexport interface VFragment extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n\r\n // 虚拟节点子节点\r\n children: Array,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.FRAGMENT\r\n\r\n // 锚点\r\n anchor: Text,\r\n el: Text\r\n\r\n}","import { VNode, VNODE_TYPE } from \"./vnode\";\r\n\r\n\r\nexport const TextSymbol = Symbol('Text');\r\nexport interface VText extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n\r\n // 虚拟节点子节点\r\n children: string,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.TEXT\r\n\r\n el: Text\r\n\r\n}","import { VNode, VNODE_TYPE } from \"./vnode\";\r\n\r\nexport const ArraySymbol = Symbol('ArrayNode');\r\nexport interface VArrayNode extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n\r\n // 虚拟节点子节点\r\n children: Array,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.ARRAYNODE\r\n\r\n // 锚点\r\n anchor: Text,\r\n el: Text,\r\n\r\n // 记录当前数组节点依赖的响应式数组\r\n depArray: Array\r\n}","import { VNode, VNODE_TYPE } from './vnode/vnode'\r\nimport { Activer } from './reactive/active'\r\nimport { FragmentSymbol } from './vnode/fragment'\r\nimport { TextSymbol } from './vnode/text'\r\nimport { ArraySymbol } from './vnode/array'\r\n\r\nexport function isString(content: unknown): content is string {\r\n return typeof content === 'string'\r\n}\r\n\r\nexport function isFunction(content: unknown): content is Function {\r\n return typeof content === 'function'\r\n}\r\n\r\nexport function isFragment(content: unknown): boolean {\r\n return content === FragmentSymbol\r\n}\r\n\r\nexport function isArrayNode(content: unknown): boolean {\r\n return content === ArraySymbol\r\n}\r\n\r\nexport function isText(content: unknown): boolean {\r\n return content === TextSymbol\r\n}\r\n\r\nexport function isActiver(content: unknown): content is Activer {\r\n return isObject(content) && (content as Record).flag === 'activer'\r\n}\r\n\r\nexport function isVNode(content: unknown): content is VNode {\r\n return isObject(content) && (content as Record).flag in VNODE_TYPE\r\n}\r\n\r\nexport function isObjectExact(content: unknown): content is Object {\r\n return isObject(content) && content.constructor === Object\r\n}\r\n\r\nexport function isOnEvent(str: string): boolean {\r\n return /^on.+$/.test(str)\r\n}\r\n\r\nexport function isObject(content: unknown): content is object {\r\n return typeof content === 'object' && content !== null\r\n}\r\n\r\n\r\nexport function isArray(content: unknown): content is Array {\r\n return Array.isArray(content)\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n","import { Watcher } from \"./watch\";\r\n\r\nlet updating = false\r\nconst watcherTask: Array = []\r\n\r\nexport function runUpdate(watcher: Watcher) {\r\n let index: number = watcherTask.indexOf(watcher)\r\n if (!(index > -1)) watcherTask.push(watcher)\r\n if (!updating) {\r\n updating = true\r\n Promise.resolve()\r\n .then(() => {\r\n let watcher: Watcher | undefined = undefined\r\n while (watcher = watcherTask.shift()) {\r\n watcher.update()\r\n }\r\n }).finally(() => {\r\n updating = false\r\n })\r\n }\r\n}","import { isArray, isObjectExact, isVNode } from \"../utils\"\r\nimport { Watcher } from \"./watch\"\r\nimport { runUpdate } from './update'\r\n\r\n// 目标对象到映射对象\r\nconst targetMap = new WeakMap()\r\n// 全局变量watcher\r\nlet activeWatcher: Watcher | null = null\r\nconst REACTIVE = Symbol('reactive')\r\n\r\n/**\r\n * 实现响应式对象\r\n*/\r\nexport function reactive>(target: T): T {\r\n if (target[REACTIVE]) return target\r\n\r\n let handler: ProxyHandler = {\r\n get(target, prop, receiver) {\r\n if (prop === REACTIVE) return true\r\n const res = Reflect.get(target, prop, receiver)\r\n\r\n if (isObjectExact(res) && !isVNode(res)) {\r\n return reactive(res)\r\n }\r\n\r\n if (Array.isArray(res)) {\r\n track(target, prop)\r\n return reactiveArray(res, target, prop)\r\n }\r\n\r\n track(target, prop)\r\n return res\r\n },\r\n\r\n set(target, prop, value, receiver) {\r\n const res = Reflect.set(target, prop, value, receiver)\r\n trigger(target, prop)\r\n return res\r\n }\r\n }\r\n\r\n return new Proxy(target, handler)\r\n}\r\n\r\n/**\r\n * 设置响应式数组\r\n*/\r\nfunction reactiveArray(targetArr: Array, targetObj: Record, Arrprop: string | symbol) {\r\n let handler: ProxyHandler> = {\r\n get(target, prop, receiver) {\r\n const res = Reflect.get(target, prop, receiver)\r\n\r\n if (isObjectExact(res)) {\r\n return reactive(res)\r\n }\r\n\r\n return res\r\n },\r\n set(target, prop, value, receiver) {\r\n const res = Reflect.set(target, prop, value, receiver)\r\n trigger(targetObj, Arrprop)\r\n return res\r\n }\r\n }\r\n\r\n return new Proxy(targetArr, handler)\r\n}\r\n\r\n/**\r\n * 响应触发依赖\r\n*/\r\nexport function trigger(target: Record, prop: string | symbol) {\r\n let mapping: Record> = targetMap.get(target)\r\n if (!mapping) return\r\n\r\n let mappingProp: Array = mapping[prop]\r\n if (!mappingProp) return\r\n\r\n // mappingProp.forEach(watcher => watcher.update(oldValue, newValue))\r\n mappingProp.forEach(watcher => {\r\n // 针对于对数组响应做特殊处理\r\n if (isArray(target[prop])) {\r\n watcher.nextDepArr = target[prop]\r\n }\r\n runUpdate(watcher)\r\n })\r\n}\r\n\r\n/**\r\n * 追踪绑定依赖\r\n*/\r\nexport function track(target: Record, prop: string | symbol) {\r\n if (!activeWatcher) return\r\n\r\n let mapping: Record> = targetMap.get(target)\r\n if (!mapping) targetMap.set(target, mapping = {})\r\n\r\n let mappingProp: Array = mapping[prop]\r\n if (!mappingProp) mappingProp = mapping[prop] = []\r\n\r\n // 针对于对数组响应做特殊处理\r\n if (isArray(target[prop])) {\r\n if (activeWatcher.depArr) {\r\n activeWatcher.depArr = false\r\n } else {\r\n if (activeWatcher.depArr === undefined) {\r\n activeWatcher.depArr = target[prop].slice()\r\n }\r\n }\r\n }\r\n\r\n mappingProp.push(activeWatcher)\r\n}\r\n\r\n// 设置全局变量\r\nexport function setActiver(fn: Watcher | null) {\r\n activeWatcher = fn\r\n}\r\n// 设置全局变量\r\nexport function getActiver(): Watcher | null {\r\n return activeWatcher\r\n}\r\n\r\n","import { track, trigger } from './reactive'\r\n\r\nexport class RefImpl {\r\n private _value: T\r\n private readonly _target: Record\r\n\r\n constructor(value: T) {\r\n this._value = value\r\n this._target = { value: this._value }\r\n }\r\n\r\n get value() {\r\n track(this._target, 'value')\r\n return this._value\r\n }\r\n\r\n set value(value) {\r\n this._value = value\r\n this._target.value = this._value\r\n trigger(this._target, 'value')\r\n }\r\n}\r\n\r\n\r\nexport function ref(value: T): RefImpl {\r\n return new RefImpl(value)\r\n}","import { ref } from './ref'\r\nimport { reactive } from './reactive'\r\n\r\n\r\nexport function state(value: T) {\r\n return ref(value)\r\n}\r\n\r\nexport function defineState>(target: T): T {\r\n return reactive(target)\r\n}\r\n\r\n\r\n\r\n\r\n\r\n","\r\n/**\r\n * 响应式对象\r\n*/\r\nexport class Activer {\r\n callback: () => T\r\n flag: string = 'activer'\r\n\r\n constructor(fn: () => T) {\r\n this.callback = fn\r\n }\r\n\r\n get value(): T {\r\n return this.callback()\r\n }\r\n}\r\n\r\n/**\r\n * 外置函数\r\n*/\r\nexport function active(fn: () => T): Activer {\r\n return new Activer(fn)\r\n}\r\n\r\n","import { Activer } from \"../reactive\"\r\nimport { Child } from \"../render\"\r\nimport { VNode, VNODE_TYPE } from \"./vnode\"\r\n\r\nexport const AliveSymbol = Symbol('Alive')\r\nexport interface VAlive extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.ELEMENT\r\n\r\n activer: Activer\r\n // 目前存在的节点\r\n vnode: VNode\r\n}","import { Activer } from \"../reactive\";\r\nimport {VNode, VNODE_TYPE, OriginVNode, VNodeProps} from \"./vnode\";\r\nimport { H } from '../render'\r\n\r\n// export type FunctionConstructor = (props: Record, children: Array) => Child\r\n// export type ClassConstructor = new (props: Record, children: Array) => Component\r\n// export type ComponentConstructor = ClassConstructor | FunctionConstructor\r\n\r\n/** 函数组件类型 */\r\nexport interface FunctionComponentType {\r\n (props: Record, children: Array): OriginVNode\r\n}\r\n\r\n/** 类组件类型 */\r\nexport interface ClassComponentType {\r\n new (props: Record, children: Array): Component\r\n}\r\n\r\nexport type ComponentType = FunctionComponentType | ClassComponentType\r\n\r\nexport const VComponentSymbol = Symbol('VComponent')\r\nexport type VComponentType = typeof VComponentSymbol\r\n\r\nexport interface VComponent extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: VComponentType,\r\n\r\n // 虚拟节点属性\r\n props: VNodeProps,\r\n\r\n // 虚拟节点子节点\r\n children: Array,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.COMPONENT\r\n\r\n root: VNode,\r\n // root的el\r\n el?: Text | HTMLElement\r\n\r\n}\r\n\r\n// todo\r\nexport interface Component {\r\n props: Record\r\n children: Array\r\n render(h?: H): OriginVNode\r\n}\r\n\r\n\r\n// todo\r\nfunction defineComponent(Component: T): T {\r\n return Component\r\n}\r\n\r\n","import {active} from \"./reactive/active\";\r\nimport {Activer} from './reactive'\r\nimport {isActiver, isArray, isArrayNode, isFragment, isFunction, isOnEvent, isString, isText, isVNode} from \"./utils\";\r\nimport {ClassComponentType, ComponentType, FunctionComponentType, VComponent} from \"./vnode/component\";\r\nimport {OriginVNode, VNode, VNODE_TYPE, VNodeProps} from \"./vnode/vnode\";\r\nimport {ArraySymbol} from \"./vnode/array\";\r\nimport {AliveSymbol} from \"./vnode/alive\";\r\nimport {TextSymbol} from './vnode/text'\r\nimport {FragmentSymbol} from \"./vnode/fragment\";\r\nimport {VComponentSymbol} from './vnode/component'\r\n\r\n/**\r\n * 传说中的render函数\r\n*/\r\n\r\nexport type HSymbol = typeof TextSymbol | typeof FragmentSymbol | typeof AliveSymbol | typeof ArraySymbol\r\nexport type HType = string | HSymbol | ComponentType\r\nexport type H = (type: HType, props?: VNodeProps, children?: OriginVNode | Array) => VNode\r\n\r\n/**\r\n * 函数转化为activer转化为VAlive\r\n * activer转化为VAlive\r\n * string转化为VText\r\n * 数组转化为VArray\r\n * 其他转化为VText\r\n*/\r\nexport function createVNode(originVNode: OriginVNode): VNode {\r\n if (isVNode(originVNode)) return originVNode\r\n\r\n if (isFunction(originVNode)) return renderAlive(active(originVNode))\r\n else if (isActiver(originVNode)) return renderAlive(originVNode)\r\n else if (isString(originVNode)) return renderText(originVNode)\r\n else if (isArray(originVNode)) return renderArrayNode(originVNode.map(item => createVNode(item)))\r\n else {\r\n // todo\r\n let value = originVNode\r\n let retText: VNode\r\n if (!value && typeof value !== 'number') retText = renderText('')\r\n else retText = renderText(String(value))\r\n return retText\r\n }\r\n}\r\n\r\n\r\n/**\r\n * text(不需要props)、fragment(不需要props)、element、component为显性创建\r\n * array(不需要props)、alive(不需要props)为隐形创建\r\n*/\r\nexport function renderApi(type: HType, props?: VNodeProps, children?: OriginVNode | Array): VNode {\r\n return render(type, props, children)\r\n}\r\n\r\nexport function render(type: HType, originProps?: VNodeProps, originChildren?: OriginVNode | Array): VNode {\r\n // text的children比较特殊先处理\r\n if (isText(type)) {\r\n return renderText(String(originChildren))\r\n }\r\n\r\n // 预处理 处理为单个的children\r\n let originChildrenList: Array = []\r\n if (isArray(originChildren)) originChildrenList.push(...originChildren)\r\n else originChildrenList.push(originChildren)\r\n // 创建VNode列表\r\n let vNodeChildren: Array = originChildrenList.map(originChild => createVNode(originChild))\r\n\r\n // 属性预处理\r\n let props: VNodeProps = originProps || {}\r\n handleProps(props)\r\n\r\n if (isString(type)) return renderElement(type, props , vNodeChildren)\r\n if (isFragment(type)) return renderFragment(vNodeChildren)\r\n if (isArrayNode(type)) return renderArrayNode(vNodeChildren)\r\n if (isFunction(type)) return renderComponent(type, props, vNodeChildren)\r\n throw '传入参数不合法'\r\n}\r\n\r\n\r\n/**\r\n * 对属性进行预处理\r\n */\r\nfunction handleProps(originProps: VNodeProps): VNodeProps {\r\n for (const prop in originProps) {\r\n // 以on开头的事件不需要处理\r\n if (\r\n !isOnEvent(prop) &&\r\n isFunction(originProps[prop])\r\n ) {\r\n // 如不为on且为函数则判断为响应式\r\n originProps[prop] = active(originProps[prop])\r\n }\r\n }\r\n\r\n return originProps\r\n}\r\n\r\nfunction renderText(text: string): VNode {\r\n return {\r\n type: TextSymbol,\r\n flag: VNODE_TYPE.TEXT,\r\n children: text\r\n }\r\n}\r\n\r\nfunction renderElement(tag: string, props: Record, children: Array): VNode {\r\n return {\r\n type: tag,\r\n flag: VNODE_TYPE.ELEMENT,\r\n props,\r\n children\r\n }\r\n}\r\n\r\nfunction renderFragment(children: Array): VNode {\r\n return {\r\n type: FragmentSymbol,\r\n flag: VNODE_TYPE.FRAGMENT,\r\n children\r\n }\r\n}\r\n\r\nfunction renderArrayNode(children: Array): VNode {\r\n return {\r\n type: ArraySymbol,\r\n flag: VNODE_TYPE.ARRAYNODE,\r\n children\r\n }\r\n}\r\n\r\nfunction createComponentProps(props: VNodeProps): VNodeProps {\r\n let componentProps:VNodeProps = {}\r\n for (const prop in props) {\r\n let curProp = props[prop]\r\n if (isActiver(curProp)) {\r\n Object.defineProperty(componentProps, prop, {\r\n get() {\r\n return (curProp as Activer).value\r\n }\r\n })\r\n } else {\r\n componentProps[prop] = curProp\r\n }\r\n }\r\n\r\n return componentProps\r\n}\r\n\r\n// 判断是普通函数还是构造函数\r\nfunction renderComponent(component: ComponentType, props: VNodeProps, children: Array): VComponent {\r\n let componentProps = createComponentProps(props)\r\n\r\n if (\r\n component.prototype &&\r\n component.prototype.render &&\r\n isFunction(component.prototype.render)\r\n ) {\r\n let ClassComponent = component as ClassComponentType\r\n let result = new ClassComponent(componentProps, children)\r\n result.props = componentProps\r\n result.children = children\r\n return {\r\n type: VComponentSymbol,\r\n root: createVNode(result.render(render)),\r\n props: componentProps,\r\n children: children,\r\n flag: VNODE_TYPE.COMPONENT\r\n }\r\n } else {\r\n let FunctionComponent = component as FunctionComponentType\r\n return {\r\n type: VComponentSymbol,\r\n root: createVNode(FunctionComponent(componentProps, children)),\r\n props: componentProps,\r\n children: children,\r\n flag: VNODE_TYPE.COMPONENT\r\n }\r\n }\r\n}\r\n\r\n\r\nfunction renderAlive(activer: Activer): VNode {\r\n return {\r\n type: AliveSymbol,\r\n flag: VNODE_TYPE.ALIVE,\r\n activer\r\n }\r\n}\r\n","import { setActiver } from \"./reactive\"\r\nimport { active, Activer } from './active'\r\nimport { VNode, VNODE_TYPE, OriginVNode } from \"../vnode/vnode\"\r\nimport { isActiver } from \"../utils\"\r\nimport { createVNode } from \"../render\"\r\nimport { VArrayNode } from \"../vnode/array\"\r\nimport { VAlive } from \"../vnode/alive\"\r\n\r\ntype Meta = {\r\n targetPropOldValue: any,\r\n targetPropnewValue: any\r\n}\r\n\r\n/**\r\n * 观察者\r\n * 观察数据的变化\r\n*/\r\nexport class Watcher {\r\n value: T\r\n callback: (oldValue: T, newValue: T, meta?: Meta) => void\r\n activeProps: Activer\r\n depArr?: Array | false\r\n nextDepArr?: Array\r\n\r\n constructor(activeProps: Activer, callback: (oldValue: T, newValue: T, meta?: Meta) => void) {\r\n setActiver(this)\r\n this.value = activeProps.value\r\n this.callback = callback\r\n this.activeProps = activeProps\r\n setActiver(null)\r\n }\r\n\r\n update() {\r\n let newValue = this.activeProps.value\r\n let oldValue = this.value\r\n this.value = newValue\r\n let meta = { targetPropOldValue: this.depArr, targetPropnewValue: this.nextDepArr }\r\n this.callback(oldValue, newValue, meta)\r\n this.depArr = this.nextDepArr?.slice()\r\n }\r\n}\r\n\r\n\r\n/**\r\n * 监控自定义响应式属性\r\n*/\r\nexport function watch(activeProps: (() => T) | Activer, callback: (oldValue: T, newValue: T) => void): Watcher {\r\n if (!isActiver(activeProps)) activeProps = active(activeProps)\r\n return new Watcher(activeProps, function (oldValue: T, newValue: T) {\r\n callback(oldValue, newValue)\r\n })\r\n}\r\n\r\n/**\r\n * 监控可变状态dom\r\n*/\r\nexport function watchVNode(activeVNode: VAlive, callback: (oldVNode: VNode, newVNode: VNode) => void): VNode {\r\n let watcher = new Watcher(activeVNode.activer, function (oldValue: OriginVNode, newValue: OriginVNode, meta) {\r\n const oldVNode = oldValue as VNode\r\n const newVNode = createVNode(newValue)\r\n\r\n // 对于数组节点后期需要记录它的响应式数组用于节点更新\r\n if (oldVNode.flag === VNODE_TYPE.ARRAYNODE) {\r\n (oldVNode).depArray = meta?.targetPropOldValue\r\n }\r\n // 对于数组节点后期需要记录它的响应式数组用于节点更新\r\n if (newVNode.flag === VNODE_TYPE.ARRAYNODE) {\r\n (newVNode).depArray = meta?.targetPropnewValue\r\n }\r\n\r\n callback(oldVNode, newVNode)\r\n watcher.value = newVNode\r\n activeVNode.vnode = newVNode\r\n })\r\n\r\n return watcher.value = createVNode(watcher.value)\r\n}\r\n\r\n\r\n/**\r\n * 监控可变dom的prop\r\n*/\r\nexport function watchProp(activeProp: Activer, callback: (oldVNode: VNode, newVNode: VNode) => void): any {\r\n return new Watcher(activeProp, callback).value\r\n}\r\n","import { Vact } from \"../vact\"\r\nimport { watchProp } from \"../reactive\"\r\nimport { isActiver, isOnEvent, isFunction, isObject } from \"../utils\"\r\nimport { VElement } from \"../vnode/element\"\r\nimport { mountChildren } from \"./mount\"\r\nimport { patchElementProp } from \"./patch\"\r\n\r\n\r\n\r\nexport function mountElement(vnode: VElement, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n const el = document.createElement(vnode.type)\r\n vnode.el = el\r\n mountElementProps(vnode)\r\n mountChildren(vnode.children, el, undefined, app)\r\n container.insertBefore(el, anchor!)\r\n}\r\n\r\nexport function unmountElement(vnode: VElement, container: HTMLElement) {\r\n vnode.el.remove()\r\n}\r\n\r\nexport function mountElementProps(vnode: VElement) {\r\n let el = vnode.el\r\n let props = vnode.props\r\n\r\n // 处理标签属性\r\n for (let prop in props) {\r\n let value = props[prop]\r\n if (isActiver(value)) {\r\n let firstValue = watchProp(value, (oldValue, newValue) => patchElementProp(oldValue, newValue, el, prop))\r\n setElementProp(el, prop, firstValue)\r\n } else {\r\n setElementProp(el, prop, value)\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * 处理单个dom属性\r\n*/\r\nexport function setElementProp(el: HTMLElement, prop: string, value: any) {\r\n if (isOnEvent(prop) && isFunction(value)) {\r\n let pattern = /^on(.+)$/\r\n let result = prop.match(pattern)\r\n result && el.addEventListener(result[1].toLocaleLowerCase(), value.bind(el))\r\n return\r\n }\r\n\r\n switch (prop) {\r\n case 'className':\r\n el.className = String(value)\r\n break\r\n case 'style':\r\n if (isObject(value)) {\r\n value = mergeStyle(value)\r\n }\r\n default:\r\n el.setAttribute(prop, value)\r\n }\r\n}\r\n\r\n/**\r\n * 将对象形式的style转化为字符串\r\n*/\r\nexport function mergeStyle(style: Record): string {\r\n let styleStringList = []\r\n for (let cssAttr in style) {\r\n styleStringList.push(`${cssAttr}:${style[cssAttr]};`)\r\n }\r\n return styleStringList.join('')\r\n}","import {mount, unmount} from \"./mount\";\r\nimport {Vact} from \"../vact\";\r\nimport {VArrayNode} from \"../vnode/array\";\r\nimport {VText} from \"../vnode/text\";\r\nimport {VNode, VNODE_TYPE} from \"../vnode/vnode\";\r\nimport {setElementProp} from \"./element\";\r\nimport {VComponent} from \"../vnode/component\";\r\n\r\nexport function isSameVNode(oldVNode: VNode, newVNode: VNode): boolean {\r\n return oldVNode.flag === newVNode.flag\r\n}\r\n\r\n// todo\r\nexport function getNextSibling(vNode: VNode): ChildNode | null {\r\n switch (vNode.flag) {\r\n case VNODE_TYPE.TEXT:\r\n case VNODE_TYPE.ELEMENT:\r\n case VNODE_TYPE.ARRAYNODE:\r\n case VNODE_TYPE.FRAGMENT:\r\n return vNode.el!.nextSibling\r\n case VNODE_TYPE.COMPONENT:\r\n return (vNode as VComponent).root.el!.nextSibling\r\n case VNODE_TYPE.ALIVE:\r\n return getNextSibling(vNode.vnode!)\r\n }\r\n}\r\n\r\nexport function patch(oldVNode: VNode, newVNode: VNode, container: HTMLElement, app?: Vact): void {\r\n\r\n // 如果两个节点引用一样不需要判断\r\n if (oldVNode === newVNode) return\r\n\r\n // 这里在判断相同类型的节点后可以做进一步优化\r\n if (isSameVNode(oldVNode, newVNode)) {\r\n let flag = oldVNode.flag = newVNode.flag\r\n\r\n if (flag === VNODE_TYPE.TEXT) {\r\n patchText(oldVNode, newVNode, container)\r\n } else if (flag === VNODE_TYPE.ARRAYNODE) {\r\n if (app?.options.arrayDiff) {\r\n patchArrayNodeT(oldVNode, newVNode, container)\r\n } else {\r\n patchArrayNode(oldVNode, newVNode, container)\r\n }\r\n } else {\r\n // const nextSibling = oldVNode?.el?.nextSibling\r\n const nextSibling = getNextSibling(oldVNode)\r\n unmount(oldVNode, container)\r\n mount(newVNode, container, nextSibling as HTMLElement | undefined)\r\n }\r\n\r\n } else {\r\n // const nextSibling = oldVNode?.el?.nextSibling\r\n const nextSibling = getNextSibling(oldVNode)\r\n unmount(oldVNode, container)\r\n mount(newVNode, container, nextSibling as HTMLElement | undefined)\r\n }\r\n\r\n}\r\n\r\nexport function patchText(oldVNode: VText, newVNode: VText, container: HTMLElement) {\r\n oldVNode.el!.nodeValue = newVNode.children\r\n newVNode.el = oldVNode.el\r\n}\r\n\r\nexport function patchElementProp(oldValue: any, newValue: any, el: HTMLElement, prop: string) {\r\n setElementProp(el, prop, newValue)\r\n}\r\n\r\nexport function patchArrayNodeT(oldVNode: VArrayNode, newVNode: VArrayNode, container: HTMLElement) {\r\n if (!oldVNode.depArray) {\r\n patchArrayNode(oldVNode, newVNode, container)\r\n return\r\n }\r\n\r\n const oldDepArray = oldVNode.depArray\r\n const newDepArray = newVNode.depArray\r\n const oldChildren = oldVNode.children\r\n const newChildren = newVNode.children\r\n\r\n if (!oldDepArray.length || !newDepArray.length) {\r\n patchArrayNode(oldVNode, newVNode, container)\r\n return\r\n }\r\n\r\n newVNode.anchor = oldVNode.anchor\r\n newVNode.el = oldVNode.el\r\n\r\n type NodeInfo = { node: VNode, index: number, used: boolean }\r\n // 为映射做初始化\r\n let map = new Map>()\r\n oldDepArray.forEach((item, index) => {\r\n let arr = map.get(item)\r\n if (!arr) map.set(item, arr = [])\r\n arr.push({ node: oldChildren[index], index, used: false })\r\n })\r\n\r\n let getOld = (item: any) => {\r\n let arr = map.get(item)\r\n if (!arr) return false\r\n\r\n let index = arr.findIndex(alone => !alone.used)\r\n\r\n if (index > -1) return arr[index]\r\n else return false\r\n }\r\n\r\n let moveOld = (item: any, node: NodeInfo) => {\r\n let arr = map.get(item)\r\n if (!arr) return\r\n\r\n let index = arr.findIndex(alone => alone === node)\r\n arr.splice(index, 1)\r\n }\r\n\r\n let maxIndexSoFar = { node: oldChildren[0], index: 0 }\r\n\r\n newDepArray.forEach((item, newIndex) => {\r\n let old = getOld(item)\r\n if (old) {\r\n if (old.index < maxIndexSoFar.index) {\r\n let next: ChildNode | null\r\n if (newIndex > 0) {\r\n next = getNextSibling(newChildren[newIndex - 1]) as ChildNode | null\r\n } else {\r\n next = getNextSibling(maxIndexSoFar.node) as ChildNode | null\r\n }\r\n\r\n VNodeInsertBefore(container, old.node, next)\r\n // container.insertBefore(old.node.el!, next)\r\n } else {\r\n maxIndexSoFar = old\r\n }\r\n\r\n newChildren[newIndex] = old.node\r\n moveOld(item, old)\r\n } else {\r\n // let next = maxIndexSoFar.node.el!.nextSibling\r\n let next: ChildNode | null\r\n if (newIndex > 0) {\r\n next = getNextSibling(newChildren[newIndex - 1]) as ChildNode | null\r\n } else {\r\n next = getNextSibling(maxIndexSoFar.node) as ChildNode | null\r\n }\r\n\r\n let newNode = newChildren[newIndex]\r\n mount(newNode, container, next as HTMLElement | undefined)\r\n // maxIndexSoFar = { node: newNode, index: maxIndexSoFar.index + 1 }\r\n }\r\n })\r\n\r\n\r\n map.forEach(value => {\r\n value.forEach(item => {\r\n if (!item.used) {\r\n unmount(item.node, container)\r\n }\r\n })\r\n })\r\n}\r\n\r\nfunction patchArrayNode(oldVNode: VArrayNode, newVNode: VArrayNode, container: HTMLElement) {\r\n const nextSibling = oldVNode.el.nextSibling\r\n unmount(oldVNode, container)\r\n mount(newVNode, container, nextSibling as HTMLElement | undefined)\r\n}\r\n\r\n\r\nfunction patchComponent() {\r\n\r\n}\r\n\r\n\r\n/**\r\n * 将一个虚拟节点挂载到一个锚点前面\r\n */\r\nfunction VNodeInsertBefore(container: HTMLElement, node: VNode, next: HTMLElement | undefined | Text | ChildNode | null) {\r\n if (node.flag === VNODE_TYPE.ELEMENT || node.flag === VNODE_TYPE.TEXT) {\r\n container.insertBefore(node.el!, next!)\r\n } else if (node.flag === VNODE_TYPE.COMPONENT) {\r\n container.insertBefore((node as VComponent).root.el!, next!)\r\n }\r\n else if (node.flag === VNODE_TYPE.ARRAYNODE || node.flag === VNODE_TYPE.FRAGMENT) {\r\n let start: ChildNode | null | undefined = node.anchor\r\n let nextToMove = start?.nextSibling\r\n let end: ChildNode | null | undefined = node.el\r\n while (start !== end) {\r\n container.insertBefore(start!, next!)\r\n start = nextToMove\r\n nextToMove = start?.nextSibling\r\n }\r\n container.insertBefore(end!, next!)\r\n }\r\n}\r\n","import { patch } from \"./patch\";\r\nimport { watchVNode } from \"../reactive/watch\";\r\nimport { Vact } from \"../vact\";\r\nimport { VAlive } from \"../vnode/alive\";\r\nimport { VArrayNode } from \"../vnode/array\";\r\nimport { VComponent } from \"../vnode/component\";\r\nimport { VElement } from \"../vnode/element\";\r\nimport { VFragment } from \"../vnode/fragment\";\r\nimport { VText } from '../vnode/text'\r\nimport { VNode, VNODE_TYPE } from \"../vnode/vnode\";\r\nimport { mountElement, unmountElement } from \"./element\";\r\n\r\nexport function mount(vnode: VNode, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n switch (vnode.flag) {\r\n case VNODE_TYPE.ELEMENT:\r\n mountElement(vnode as VElement, container, anchor, app)\r\n break\r\n case VNODE_TYPE.TEXT:\r\n mountText(vnode as VText, container, anchor)\r\n break\r\n case VNODE_TYPE.FRAGMENT:\r\n mountFragment(vnode as VFragment, container, anchor, app)\r\n break\r\n case VNODE_TYPE.ARRAYNODE:\r\n mountArrayNode(vnode as VArrayNode, container, anchor, app)\r\n break\r\n case VNODE_TYPE.COMPONENT:\r\n mountComponent(vnode as VComponent, container, anchor, app)\r\n break\r\n case VNODE_TYPE.ALIVE:\r\n mountAlive(vnode as VAlive, container, anchor, app)\r\n break\r\n }\r\n}\r\n\r\nexport function unmount(vnode: VNode, container: HTMLElement) {\r\n switch (vnode.flag) {\r\n case VNODE_TYPE.ELEMENT:\r\n unmountElement(vnode as VElement, container)\r\n break\r\n case VNODE_TYPE.TEXT:\r\n unmountText(vnode as VText, container)\r\n break\r\n case VNODE_TYPE.FRAGMENT:\r\n unmountFragment(vnode as VFragment, container)\r\n break\r\n case VNODE_TYPE.ARRAYNODE:\r\n unmountArrayNode(vnode as VArrayNode, container)\r\n break\r\n case VNODE_TYPE.COMPONENT:\r\n unmountComponent(vnode as VComponent, container)\r\n break\r\n }\r\n}\r\n\r\nexport function mountChildren(children: Array, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n children.forEach(child => mount(child, container, anchor, app))\r\n}\r\n\r\nexport function mountText(vnode: VText, container: HTMLElement, anchor?: HTMLElement) {\r\n const el = document.createTextNode(vnode.children)\r\n vnode.el = el\r\n container.insertBefore(el, anchor!)\r\n}\r\n\r\nexport function unmountText(vnode: VText, container: HTMLElement) {\r\n vnode.el.remove()\r\n}\r\n\r\nexport function mountFragment(vnode: VFragment, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n const start = document.createTextNode('')\r\n const end = document.createTextNode('')\r\n vnode.anchor = start\r\n vnode.el = end\r\n container.insertBefore(start, anchor!)\r\n mountChildren(vnode.children, container, anchor, app)\r\n container.insertBefore(end, anchor!)\r\n}\r\n\r\nexport function unmountFragment(vnode: VFragment, container: HTMLElement) {\r\n const start = vnode.anchor\r\n const end = vnode.el\r\n let cur: ChildNode | null = start\r\n while (cur && cur !== end) {\r\n let next: ChildNode | null = cur.nextSibling\r\n cur.remove()\r\n cur = next\r\n }\r\n end.remove()\r\n}\r\n\r\nexport function mountArrayNode(vnode: VArrayNode, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n const start = document.createTextNode('')\r\n const end = document.createTextNode('')\r\n vnode.anchor = start\r\n vnode.el = end\r\n container.insertBefore(start, anchor!)\r\n mountChildren(vnode.children, container, anchor, app)\r\n container.insertBefore(end, anchor!)\r\n}\r\n\r\nexport function unmountArrayNode(vnode: VArrayNode, container: HTMLElement, anchor?: HTMLElement) {\r\n const start = vnode.anchor\r\n const end = vnode.el\r\n let cur: ChildNode | null = start\r\n while (cur && cur !== end) {\r\n let next: ChildNode | null = cur.nextSibling\r\n cur.remove()\r\n cur = next\r\n }\r\n end.remove()\r\n}\r\n\r\nexport function mountComponent(vNode: VComponent, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n const root = vNode.root\r\n mount(root, container, anchor, app)\r\n}\r\n\r\nexport function unmountComponent(vNode: VComponent, container: HTMLElement) {\r\n unmount(vNode.root, container)\r\n}\r\n\r\nexport function mountAlive(vnode: VAlive, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n let firstVNode = watchVNode(vnode, (oldVNode, newVNode) => patch(oldVNode, newVNode, container, app))\r\n vnode.vnode = firstVNode\r\n mount(firstVNode, container, anchor, app)\r\n}\r\n","import { defineState } from \"./reactive\"\r\nimport { H } from './render'\r\nimport { VNode } from \"./vnode/vnode\"\r\n\r\n\r\n/**\r\n * 根类组件(向下兼容)\r\n * 已废弃\r\n*/\r\n\r\ninterface Config {\r\n data?: Record\r\n}\r\n\r\nexport abstract class Component {\r\n // 组件配置\r\n private config: Config\r\n // 组件响应式数据\r\n public data: Record\r\n // 组件属性\r\n props?: Record\r\n // 组件子元素\r\n children?: Record\r\n\r\n constructor(config: Config = {}) {\r\n this.config = config\r\n this.data = defineState(config.data || {})\r\n }\r\n\r\n abstract render(h: H): VNode\r\n}\r\n","import { mount } from \"./mount/mount\";\r\nimport { defineState, state } from \"./reactive\";\r\nimport { RefImpl } from \"./reactive/ref\";\r\nimport { render } from \"./render\";\r\nimport { VNode } from \"./vnode/vnode\";\r\nimport { H } from './render'\r\n\r\nexport interface Options {\r\n arrayDiff?: boolean\r\n}\r\n\r\nexport interface VactUtils {\r\n state(value: T): RefImpl\r\n defineState>(target: T): T\r\n h: H\r\n}\r\n\r\nexport interface VactPlugin {\r\n install(utils: VactUtils): void\r\n}\r\n\r\nexport class Vact {\r\n rootVNode: VNode\r\n options: Options\r\n\r\n constructor(vnode: VNode, options?: Options) {\r\n this.rootVNode = vnode\r\n this.options = options || {}\r\n }\r\n\r\n mount(selector: string): void {\r\n const el = document.querySelector(selector)\r\n let container = document.createElement('div')\r\n mount(this.rootVNode, container, undefined, this)\r\n el?.replaceWith(...container.childNodes)\r\n }\r\n\r\n use(plugin: VactPlugin) {\r\n const utils: VactUtils = { state, defineState, h: render }\r\n plugin.install(utils)\r\n return this\r\n }\r\n}\r\n\r\nexport function createApp(vnode: VNode, options?: Options): Vact {\r\n return new Vact(vnode, options)\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C,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;KAC3C;AAGF;;MCTY,IAAI,CAAA;IAIf,WAAY,CAAA,KAAY,EAAE,OAAiB,EAAA;AACzC,QAAA,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;AACtB,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAA;KAC7B;AAED,IAAA,KAAK,CAAC,QAAgB,EAAA;QACpB,MAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;QAC3C,IAAI,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QAC7C,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;AACjD,QAAA,EAAE,KAAF,IAAA,IAAA,EAAE,KAAF,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAE,CAAE,WAAW,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,CAAA;KACzC;AAED,IAAA,GAAG,CAAC,MAAkB,EAAA;QACpB,MAAM,KAAK,GAAc,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,CAAA;AAC1D,QAAA,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AACrB,QAAA,OAAO,IAAI,CAAA;KACZ;AACF,CAAA;AAEe,SAAA,SAAS,CAAC,KAAY,EAAE,OAAiB,EAAA;AACvD,IAAA,OAAO,IAAI,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;AACjC;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"boundle.js","sources":["../src/vnode/text.ts","../src/vnode/fragment.ts","../src/vnode/component.ts","../src/vnode/array.ts","../src/vnode/alive.ts","../src/vnode/vnode.ts","../src/utils.ts","../src/reactive/update.ts","../src/reactive/reactive.ts","../src/reactive/ref.ts","../src/reactive/utils.ts","../src/reactive/active.ts","../src/lifeCycle.ts","../src/plugin.ts","../src/render.ts","../src/reactive/watch.ts","../src/mount/element.ts","../src/mount/patch.ts","../src/mount/mount.ts","../src/component.ts","../src/app.ts"],"sourcesContent":["import {VNode, VNODE_TYPE, VNodeElement} from \"./vnode\";\r\n\r\n\r\nexport const TextSymbol = Symbol('Text');\r\nexport interface VText extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n\r\n // 虚拟节点子节点\r\n children: string,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.TEXT\r\n\r\n el: Text\r\n\r\n}\r\n","import {VNode, VNODE_TYPE, VNodeElement} from \"./vnode\";\r\n\r\nexport const FragmentSymbol = Symbol('Fragment');\r\nexport interface VFragment extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n\r\n // 虚拟节点子节点\r\n children: Array,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.FRAGMENT\r\n\r\n // 锚点\r\n anchor: Text,\r\n el: Text\r\n\r\n}\r\n","import {VNode, VNODE_TYPE, OriginVNode, VNodeProps} from \"./vnode\";\r\nimport { ComponentLifeCycle } from '../lifeCycle'\r\nimport { ComponentInstance } from '../component'\r\nimport {AppUtils} from '../plugin'\r\n\r\nexport interface ComponentContext {\r\n props: Record\r\n children: Array\r\n life: ComponentLifeCycle\r\n utils: AppUtils\r\n}\r\n\r\n/** 函数组件类型 */\r\nexport interface FunctionComponentType {\r\n (context: ComponentContext): OriginVNode\r\n}\r\n\r\n/** 类组件类型 */\r\nexport interface ClassComponentType {\r\n new (props: Record, children: Array): ComponentInstance\r\n}\r\n\r\nexport type ComponentType = FunctionComponentType | ClassComponentType\r\n\r\nexport const VComponentSymbol = Symbol('VComponent')\r\nexport type VComponentType = typeof VComponentSymbol\r\n\r\nexport interface VComponent extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: VComponentType,\r\n\r\n // 虚拟节点属性\r\n props: VNodeProps,\r\n\r\n // 虚拟节点子节点\r\n children: Array,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.COMPONENT\r\n\r\n root: VNode,\r\n\r\n lifeStyleInstance: ComponentLifeCycle\r\n\r\n}\r\n\r\n","import {VNode, VNODE_TYPE, VNodeElement} from \"./vnode\";\r\n\r\nexport const ArraySymbol = Symbol('ArrayNode');\r\nexport type VArrayType = typeof ArraySymbol\r\nexport interface VArrayNode extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n\r\n // 虚拟节点子节点\r\n children: Array,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.ARRAYNODE\r\n\r\n // 锚点\r\n anchor: Text,\r\n el: Text,\r\n\r\n // 记录当前数组节点依赖的响应式数组\r\n depArray: Array\r\n}\r\n","import { Activer } from \"../reactive\"\r\nimport { VNode, VNODE_TYPE, OriginVNode } from \"./vnode\"\r\n\r\nexport const AliveSymbol = Symbol('Alive')\r\nexport type VAliveType = typeof AliveSymbol\r\nexport interface VAlive extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.ELEMENT\r\n\r\n activer: Activer\r\n // 目前存在的节点\r\n vnode: VNode\r\n}\r\n","import { Activer } from \"../reactive\"\r\nimport { ComponentType } from './component'\r\n\r\n/**\r\n * 虚拟dom节点类型枚举\r\n*/\r\nexport enum VNODE_TYPE {\r\n // 普通元素节点类型\r\n ELEMENT,\r\n // 文本节点类型\r\n TEXT,\r\n FRAGMENT,\r\n COMPONENT,\r\n ARRAYNODE,\r\n ALIVE\r\n}\r\n\r\nexport type VNodeElement = ChildNode\r\n\r\n/**\r\n * 虚拟dom接口类型\r\n*/\r\nexport interface VNode {\r\n\r\n // 虚拟节点类型\r\n type: string | symbol | ComponentType,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE\r\n\r\n // 虚拟节点属性\r\n props?: Record,\r\n\r\n // 虚拟节点子节点\r\n children?: Array | string,\r\n\r\n // 真实节点\r\n el?: VNodeElement\r\n anchor?: VNodeElement\r\n\r\n activer?: Activer\r\n // 目前存在的节点\r\n vnode?: VNode\r\n\r\n}\r\n\r\n// 未经过标准化的childVNode类型\r\nexport type NotFunctionOriginVNode= string | VNode | Array | Activer\r\nexport type WithFunctionOriginVNode= (() => OriginVNode) | NotFunctionOriginVNode\r\nexport type OriginVNode= WithFunctionOriginVNode | Exclude\r\n\r\n/** 虚拟节点属性 todo */\r\nexport interface VNodeProps {\r\n [propName: string]: any\r\n}\r\n\r\n","import { VNode, VNODE_TYPE } from './vnode'\r\nimport { Activer } from './reactive'\r\nimport { FragmentSymbol, TextSymbol, ArraySymbol } from './vnode'\r\n\r\nexport function isString(content: unknown): content is string {\r\n return typeof content === 'string'\r\n}\r\n\r\nexport function isFunction(content: unknown): content is Function {\r\n return typeof content === 'function'\r\n}\r\n\r\nexport function isFragment(content: unknown): boolean {\r\n return content === FragmentSymbol\r\n}\r\n\r\nexport function isArrayNode(content: unknown): boolean {\r\n return content === ArraySymbol\r\n}\r\n\r\nexport function isText(content: unknown): boolean {\r\n return content === TextSymbol\r\n}\r\n\r\nexport function isActiver(content: unknown): content is Activer {\r\n return isObject(content) && (content as Record).flag === 'activer'\r\n}\r\n\r\nexport function isVNode(content: unknown): content is VNode {\r\n return isObject(content) && (content as Record).flag in VNODE_TYPE\r\n}\r\n\r\nexport function isObjectExact(content: unknown): content is Object {\r\n return isObject(content) && content.constructor === Object\r\n}\r\n\r\nexport function isOnEvent(str: string): boolean {\r\n return /^on.+$/.test(str)\r\n}\r\n\r\nexport function isObject(content: unknown): content is object {\r\n return typeof content === 'object' && content !== null\r\n}\r\n\r\n\r\nexport function isArray(content: unknown): content is Array {\r\n return Array.isArray(content)\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n","import { Watcher } from \"./watch\";\r\n\r\nlet updating = false\r\nconst watcherTask: Array = []\r\n\r\nexport function runUpdate(watcher: Watcher) {\r\n let index: number = watcherTask.indexOf(watcher)\r\n if (!(index > -1)) watcherTask.push(watcher)\r\n if (!updating) {\r\n updating = true\r\n Promise.resolve()\r\n .then(() => {\r\n let watcher: Watcher | undefined = undefined\r\n while (watcher = watcherTask.shift()) {\r\n watcher.update()\r\n }\r\n }).finally(() => {\r\n updating = false\r\n })\r\n }\r\n}","import { isArray, isObjectExact, isVNode } from \"../utils\"\r\nimport { Watcher } from \"./watch\"\r\nimport { runUpdate } from './update'\r\n\r\n// 目标对象到映射对象\r\nconst targetMap = new WeakMap()\r\n// 全局变量watcher\r\nlet activeWatcher: Watcher | null = null\r\nconst REACTIVE = Symbol('reactive')\r\n\r\n/**\r\n * 实现响应式对象\r\n*/\r\nexport function reactive>(target: T): T {\r\n if (target[REACTIVE]) return target\r\n\r\n let handler: ProxyHandler = {\r\n get(target, prop, receiver) {\r\n if (prop === REACTIVE) return true\r\n const res = Reflect.get(target, prop, receiver)\r\n\r\n if (isObjectExact(res) && !isVNode(res)) {\r\n return reactive(res)\r\n }\r\n\r\n if (Array.isArray(res)) {\r\n track(target, prop)\r\n return reactiveArray(res, target, prop)\r\n }\r\n\r\n track(target, prop)\r\n return res\r\n },\r\n\r\n set(target, prop, value, receiver) {\r\n const res = Reflect.set(target, prop, value, receiver)\r\n trigger(target, prop)\r\n return res\r\n }\r\n }\r\n\r\n return new Proxy(target, handler)\r\n}\r\n\r\n/**\r\n * 设置响应式数组\r\n*/\r\nfunction reactiveArray(targetArr: Array, targetObj: Record, Arrprop: string | symbol) {\r\n let handler: ProxyHandler> = {\r\n get(target, prop, receiver) {\r\n const res = Reflect.get(target, prop, receiver)\r\n\r\n if (isObjectExact(res)) {\r\n return reactive(res)\r\n }\r\n\r\n return res\r\n },\r\n set(target, prop, value, receiver) {\r\n const res = Reflect.set(target, prop, value, receiver)\r\n trigger(targetObj, Arrprop)\r\n return res\r\n }\r\n }\r\n\r\n return new Proxy(targetArr, handler)\r\n}\r\n\r\n/**\r\n * 响应触发依赖\r\n*/\r\nexport function trigger(target: Record, prop: string | symbol) {\r\n let mapping: Record> = targetMap.get(target)\r\n if (!mapping) return\r\n\r\n let mappingProp: Array = mapping[prop]\r\n if (!mappingProp) return\r\n\r\n // mappingProp.forEach(watcher => watcher.update(oldValue, newValue))\r\n mappingProp.forEach(watcher => {\r\n // 针对于对数组响应做特殊处理\r\n if (isArray(target[prop])) {\r\n watcher.nextDepArr = target[prop]\r\n }\r\n runUpdate(watcher)\r\n })\r\n}\r\n\r\n/**\r\n * 追踪绑定依赖\r\n*/\r\nexport function track(target: Record, prop: string | symbol) {\r\n if (!activeWatcher) return\r\n\r\n let mapping: Record> = targetMap.get(target)\r\n if (!mapping) targetMap.set(target, mapping = {})\r\n\r\n let mappingProp: Array = mapping[prop]\r\n if (!mappingProp) mappingProp = mapping[prop] = []\r\n\r\n // 针对于对数组响应做特殊处理\r\n if (isArray(target[prop])) {\r\n if (activeWatcher.depArr) {\r\n activeWatcher.depArr = false\r\n } else {\r\n if (activeWatcher.depArr === undefined) {\r\n activeWatcher.depArr = target[prop].slice()\r\n }\r\n }\r\n }\r\n\r\n mappingProp.push(activeWatcher)\r\n}\r\n\r\n// 设置全局变量\r\nexport function setActiver(fn: Watcher | null) {\r\n activeWatcher = fn\r\n}\r\n// 设置全局变量\r\nexport function getActiver(): Watcher | null {\r\n return activeWatcher\r\n}\r\n\r\n","import { track, trigger } from './reactive'\r\n\r\nexport class RefImpl {\r\n private _value: T\r\n private readonly _target: Record\r\n\r\n constructor(value: T) {\r\n this._value = value\r\n this._target = { value: this._value }\r\n }\r\n\r\n get value() {\r\n track(this._target, 'value')\r\n return this._value\r\n }\r\n\r\n set value(value) {\r\n this._value = value\r\n this._target.value = this._value\r\n trigger(this._target, 'value')\r\n }\r\n}\r\n\r\n\r\nexport function ref(value: T): RefImpl {\r\n return new RefImpl(value)\r\n}","import { ref } from './ref'\r\nimport { reactive } from './reactive'\r\n\r\n\r\nexport function state(value: T) {\r\n return ref(value)\r\n}\r\n\r\nexport function defineState>(target: T): T {\r\n return reactive(target)\r\n}\r\n\r\n\r\n\r\n\r\n\r\n","\r\n/**\r\n * 响应式对象\r\n*/\r\nexport class Activer {\r\n callback: () => T\r\n flag: string = 'activer'\r\n\r\n constructor(fn: () => T) {\r\n this.callback = fn\r\n }\r\n\r\n get value(): T {\r\n return this.callback()\r\n }\r\n}\r\n\r\n/**\r\n * 外置函数\r\n*/\r\nexport function active(fn: () => T): Activer {\r\n return new Activer(fn)\r\n}\r\n\r\n","import { ComponentInstance } from './component'\r\n\r\n/**\r\n * 主要实现关于组件的生命周期\r\n */\r\n\r\n\r\nexport interface ComponentLifeCycleInstance {\r\n\r\n /** 组件示例创建之后触发 */\r\n created(fn: () => void): void\r\n\r\n /** 组件示例在渲染之前触发(DOM还没有生成) */\r\n beforeMounted(fn: () => void): void\r\n\r\n /** dom已经生成到js内存但还没挂载 */\r\n readyMounted(fn: () => void): void\r\n\r\n /** dom挂载到了页面上*/\r\n mounted(fn: () => void): void\r\n\r\n /** 卸载之前触发 */\r\n beforeUnMounted(fn: () => void):void\r\n\r\n /** 卸载之后触发 */\r\n unMounted(fn: () => void):void\r\n}\r\n\r\ntype LifeCycleNames = T extends string ? `${T}List` : never\r\ntype GetCycleName = T extends `${infer U}List` ? U : never\r\n\r\n\r\n\r\nexport class ComponentLifeCycle implements ComponentLifeCycleInstance {\r\n\r\n\r\n constructor(\r\n private readonly createdList: Array<() => void> = [],\r\n private readonly beforeMountedList: Array<() => void> = [],\r\n private readonly readyMountedList: Array<() => void> = [],\r\n private readonly mountedList: Array<() => void> = [],\r\n private readonly beforeUnMountedList: Array<() => void> = [],\r\n private readonly unMountedList: Array<() => void> = []\r\n ) {\r\n // this.createdList = []\r\n // this.beforeMountedList = []\r\n // this.readyMountedList = []\r\n // this.mountedList = []\r\n // this.beforeUnMountedList = []\r\n // this.unMountedList = []\r\n }\r\n\r\n created(fn: () => void): void {\r\n this.createdList.push(fn)\r\n }\r\n\r\n beforeMounted(fn: () => void): void {\r\n this.beforeMountedList.push(fn)\r\n }\r\n\r\n readyMounted(fn: () => void): void {\r\n this.readyMountedList.push(fn)\r\n }\r\n\r\n mounted(fn: () => void): void {\r\n this.mountedList.push(fn)\r\n }\r\n\r\n beforeUnMounted(fn: () => void): void {\r\n this.beforeUnMountedList.push(fn)\r\n }\r\n\r\n unMounted(fn: () => void): void {\r\n this.unMountedList.push(fn)\r\n }\r\n\r\n emit(lifeName: keyof ComponentLifeCycleInstance) {\r\n this[`${lifeName}List`].forEach(fn => fn())\r\n }\r\n\r\n}\r\n\r\n// 生成类组件生命周期实例\r\nexport function createClassComponentLife(component: ComponentInstance) {\r\n let lifeNames: [\r\n 'created',\r\n 'beforeMounted',\r\n 'readyMounted',\r\n 'mounted',\r\n 'beforeUnMounted',\r\n 'unMounted'\r\n ] = ['created', 'beforeMounted', 'readyMounted', 'mounted', 'beforeUnMounted', 'unMounted']\r\n\r\n let lifeCycle = new ComponentLifeCycle()\r\n component.life = lifeCycle\r\n\r\n lifeNames.forEach(lifeName => {\r\n let fn = component[lifeName]\r\n if(!fn) return\r\n lifeCycle[lifeName](fn.bind(component))\r\n })\r\n\r\n return lifeCycle\r\n}\r\n\r\n\r\n","import {\r\n state,\r\n defineState,\r\n watch\r\n} from \"./reactive\";\r\nimport { renderApi as h } from \"./render\";\r\n\r\n// todo\r\n\r\n// 实现插件功能\r\n\r\nexport interface AppUtils {\r\n state: typeof state\r\n defineState: typeof defineState\r\n h: typeof h\r\n watch: typeof watch\r\n}\r\n\r\nexport interface AppContext {\r\n utils: AppUtils\r\n}\r\n\r\nexport interface AppPlugin {\r\n install(utils: AppContext): void\r\n}\r\n\r\n// 给插件提供的能力\r\nexport const appUtils: AppUtils = {\r\n state,\r\n defineState,\r\n h,\r\n watch\r\n}\r\n","import {active} from \"./reactive\";\r\nimport {Activer} from './reactive'\r\nimport {\r\n isActiver,\r\n isArray,\r\n isArrayNode,\r\n isFragment,\r\n isFunction,\r\n isOnEvent,\r\n isString,\r\n isText,\r\n isVNode} from \"./utils\";\r\nimport {\r\n ClassComponentType,\r\n ComponentType,\r\n FunctionComponentType,\r\n VComponent\r\n} from \"./vnode\";\r\nimport {\r\n OriginVNode,\r\n VNode,\r\n VNODE_TYPE,\r\n VNodeProps\r\n} from \"./vnode\";\r\nimport {\r\n ArraySymbol,\r\n AliveSymbol,\r\n TextSymbol,\r\n FragmentSymbol,\r\n VComponentSymbol\r\n} from \"./vnode\";\r\nimport {ComponentLifeCycle, createClassComponentLife} from \"./lifeCycle\";\r\nimport {appUtils} from \"./plugin\";\r\n\r\n/**\r\n * 传说中的render函数\r\n*/\r\n\r\nexport type HSymbol = typeof TextSymbol | typeof FragmentSymbol | typeof AliveSymbol | typeof ArraySymbol\r\nexport type HType = string | HSymbol | ComponentType\r\nexport type H = (type: HType, props?: VNodeProps, children?: OriginVNode | Array) => VNode\r\n\r\n/**\r\n * 函数转化为activer转化为VAlive\r\n * activer转化为VAlive\r\n * string转化为VText\r\n * 数组转化为VArray\r\n * 其他转化为VText\r\n*/\r\nexport function createVNode(originVNode: OriginVNode): VNode {\r\n if (isVNode(originVNode)) return originVNode\r\n\r\n if (isFunction(originVNode)) return renderAlive(active(originVNode))\r\n else if (isActiver(originVNode)) return renderAlive(originVNode)\r\n else if (isString(originVNode)) return renderText(originVNode)\r\n else if (isArray(originVNode)) return renderArrayNode(originVNode.map(item => createVNode(item)))\r\n else {\r\n // todo\r\n let value = originVNode\r\n let retText: VNode\r\n if (!value && typeof value !== 'number') retText = renderText('')\r\n else retText = renderText(String(value))\r\n return retText\r\n }\r\n}\r\n\r\n\r\n/**\r\n * text(不需要props)、fragment(不需要props)、element、component为显性创建\r\n * array(不需要props)、alive(不需要props)为隐形创建\r\n*/\r\nexport function renderApi(type: HType, props?: VNodeProps | null, children?: OriginVNode | Array): VNode {\r\n return render(type, props || undefined, children)\r\n}\r\n\r\nexport function render(type: HType, originProps?: VNodeProps, originChildren?: OriginVNode | Array): VNode {\r\n // text的children比较特殊先处理\r\n if (isText(type)) {\r\n return renderText(String(originChildren))\r\n }\r\n\r\n // 预处理 处理为单个的children\r\n let originChildrenList: Array = []\r\n if (isArray(originChildren)) originChildrenList.push(...originChildren)\r\n else originChildrenList.push(originChildren)\r\n // 创建VNode列表\r\n let vNodeChildren: Array = originChildrenList.map(originChild => createVNode(originChild))\r\n\r\n // 属性预处理\r\n let props: VNodeProps = originProps || {}\r\n handleProps(props)\r\n\r\n if (isString(type)) return renderElement(type, props , vNodeChildren)\r\n if (isFragment(type)) return renderFragment(vNodeChildren)\r\n if (isArrayNode(type)) return renderArrayNode(vNodeChildren)\r\n if (isFunction(type)) return renderComponent(type, props, vNodeChildren)\r\n throw '传入参数不合法'\r\n}\r\n\r\n\r\n/**\r\n * 对属性进行预处理\r\n */\r\nfunction handleProps(originProps: VNodeProps): VNodeProps {\r\n for (const prop in originProps) {\r\n // 以on开头的事件不需要处理\r\n if (\r\n !isOnEvent(prop) &&\r\n isFunction(originProps[prop])\r\n ) {\r\n // 如不为on且为函数则判断为响应式\r\n originProps[prop] = active(originProps[prop])\r\n }\r\n }\r\n\r\n return originProps\r\n}\r\n\r\nfunction renderText(text: string): VNode {\r\n return {\r\n type: TextSymbol,\r\n flag: VNODE_TYPE.TEXT,\r\n children: text\r\n }\r\n}\r\n\r\nfunction renderElement(tag: string, props: Record, children: Array): VNode {\r\n return {\r\n type: tag,\r\n flag: VNODE_TYPE.ELEMENT,\r\n props,\r\n children\r\n }\r\n}\r\n\r\nfunction renderFragment(children: Array): VNode {\r\n return {\r\n type: FragmentSymbol,\r\n flag: VNODE_TYPE.FRAGMENT,\r\n children\r\n }\r\n}\r\n\r\nfunction renderArrayNode(children: Array): VNode {\r\n return {\r\n type: ArraySymbol,\r\n flag: VNODE_TYPE.ARRAYNODE,\r\n children\r\n }\r\n}\r\n\r\nfunction createComponentProps(props: VNodeProps): VNodeProps {\r\n let componentProps:VNodeProps = {}\r\n for (const prop in props) {\r\n let curProp = props[prop]\r\n if (isActiver(curProp)) {\r\n Object.defineProperty(componentProps, prop, {\r\n get() {\r\n return (curProp as Activer).value\r\n }\r\n })\r\n } else {\r\n componentProps[prop] = curProp\r\n }\r\n }\r\n\r\n return componentProps\r\n}\r\n\r\n// 渲染一个活跃的节点\r\nfunction renderAlive(activer: Activer): VNode {\r\n return {\r\n type: AliveSymbol,\r\n flag: VNODE_TYPE.ALIVE,\r\n activer\r\n }\r\n}\r\n\r\n// 判断是普通函数还是构造函数\r\nfunction renderComponent(component: ComponentType, props: VNodeProps, children: Array): VComponent {\r\n let componentProps = createComponentProps(props)\r\n\r\n if (\r\n component.prototype &&\r\n component.prototype.render &&\r\n isFunction(component.prototype.render)\r\n ) {\r\n let ClassComponent = component as ClassComponentType\r\n let result = new ClassComponent(componentProps, children)\r\n\r\n result.props = componentProps\r\n result.children = children\r\n\r\n let lifeCycle = createClassComponentLife(result)\r\n\r\n let vn = result.render(renderApi)\r\n lifeCycle.emit('created')\r\n let vc: VComponent = {\r\n type: VComponentSymbol,\r\n root: createVNode(vn),\r\n props: componentProps,\r\n children: children,\r\n flag: VNODE_TYPE.COMPONENT,\r\n lifeStyleInstance: lifeCycle\r\n }\r\n\r\n lifeCycle.emit('beforeMounted')\r\n\r\n return vc\r\n } else {\r\n let FunctionComponent = component as FunctionComponentType\r\n let lifeCycle = new ComponentLifeCycle()\r\n let vn = FunctionComponent({props: componentProps, children: children, life: lifeCycle, utils: appUtils})\r\n lifeCycle.emit('created')\r\n let vc: VComponent = {\r\n type: VComponentSymbol,\r\n root: createVNode(vn),\r\n props: componentProps,\r\n children: children,\r\n flag: VNODE_TYPE.COMPONENT,\r\n lifeStyleInstance: lifeCycle\r\n }\r\n\r\n lifeCycle.emit('beforeMounted')\r\n return vc\r\n }\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n","import { setActiver } from \"./reactive\"\r\nimport { active, Activer } from './active'\r\nimport { VNode, VNODE_TYPE, OriginVNode } from \"../vnode\"\r\nimport { isActiver } from \"../utils\"\r\nimport { createVNode } from \"../render\"\r\nimport { VArrayNode } from \"../vnode\"\r\nimport { VAlive } from \"../vnode\"\r\n\r\ntype Meta = {\r\n targetPropOldValue: any,\r\n targetPropnewValue: any\r\n}\r\n\r\n/**\r\n * 观察者\r\n * 观察数据的变化\r\n*/\r\nexport class Watcher {\r\n value: T\r\n callback: (oldValue: T, newValue: T, meta?: Meta) => void\r\n activeProps: Activer\r\n depArr?: Array | false\r\n nextDepArr?: Array\r\n\r\n constructor(activeProps: Activer, callback: (oldValue: T, newValue: T, meta?: Meta) => void) {\r\n setActiver(this)\r\n this.value = activeProps.value\r\n this.callback = callback\r\n this.activeProps = activeProps\r\n setActiver(null)\r\n }\r\n\r\n update() {\r\n let newValue = this.activeProps.value\r\n let oldValue = this.value\r\n this.value = newValue\r\n let meta = { targetPropOldValue: this.depArr, targetPropnewValue: this.nextDepArr }\r\n this.callback(oldValue, newValue, meta)\r\n this.depArr = this.nextDepArr?.slice()\r\n }\r\n}\r\n\r\n\r\n/**\r\n * 监控自定义响应式属性\r\n*/\r\nexport function watch(activeProps: (() => T) | Activer, callback: (oldValue: T, newValue: T) => void): Watcher {\r\n if (!isActiver(activeProps)) activeProps = active(activeProps)\r\n return new Watcher(activeProps, function (oldValue: T, newValue: T) {\r\n callback(oldValue, newValue)\r\n })\r\n}\r\n\r\n/**\r\n * 监控可变状态dom\r\n*/\r\nexport function watchVNode(activeVNode: VAlive, callback: (oldVNode: VNode, newVNode: VNode) => void): VNode {\r\n let watcher = new Watcher(activeVNode.activer, function (oldValue: OriginVNode, newValue: OriginVNode, meta) {\r\n const oldVNode = oldValue as VNode\r\n const newVNode = createVNode(newValue)\r\n\r\n // 对于数组节点后期需要记录它的响应式数组用于节点更新\r\n if (oldVNode.flag === VNODE_TYPE.ARRAYNODE) {\r\n (oldVNode).depArray = meta?.targetPropOldValue\r\n }\r\n // 对于数组节点后期需要记录它的响应式数组用于节点更新\r\n if (newVNode.flag === VNODE_TYPE.ARRAYNODE) {\r\n (newVNode).depArray = meta?.targetPropnewValue\r\n }\r\n\r\n callback(oldVNode, newVNode)\r\n watcher.value = newVNode\r\n activeVNode.vnode = newVNode\r\n })\r\n\r\n return watcher.value = createVNode(watcher.value)\r\n}\r\n\r\n\r\n/**\r\n * 监控可变dom的prop\r\n*/\r\nexport function watchProp(activeProp: Activer, callback: (oldVNode: VNode, newVNode: VNode) => void): any {\r\n return new Watcher(activeProp, callback).value\r\n}\r\n","import { App } from \"../app\"\r\nimport { watchProp } from \"../reactive\"\r\nimport { isActiver, isOnEvent, isFunction, isObject } from \"../utils\"\r\nimport {VElement, VNodeElement} from \"../vnode\"\r\nimport { mountChildren } from \"./mount\"\r\nimport { patchElementProp } from \"./patch\"\r\n\r\n\r\n\r\nexport function mountElement(vnode: VElement, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n const el = document.createElement(vnode.type)\r\n vnode.el = el\r\n mountElementProps(vnode)\r\n mountChildren(vnode.children, el, undefined, app)\r\n container.insertBefore(el, anchor!)\r\n}\r\n\r\nexport function unmountElement(vnode: VElement, container: HTMLElement) {\r\n vnode.el.remove()\r\n}\r\n\r\nexport function mountElementProps(vnode: VElement) {\r\n let el = vnode.el\r\n let props = vnode.props\r\n\r\n // 处理标签属性\r\n for (let prop in props) {\r\n let value = props[prop]\r\n if (isActiver(value)) {\r\n let firstValue = watchProp(value, (oldValue, newValue) => patchElementProp(oldValue, newValue, el, prop))\r\n setElementProp(el, prop, firstValue)\r\n } else {\r\n setElementProp(el, prop, value)\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * 处理单个dom属性\r\n*/\r\nexport function setElementProp(el: HTMLElement, prop: string, value: any) {\r\n if (isOnEvent(prop) && isFunction(value)) {\r\n let pattern = /^on(.+)$/\r\n let result = prop.match(pattern)\r\n result && el.addEventListener(result[1].toLocaleLowerCase(), value.bind(el))\r\n return\r\n }\r\n\r\n switch (prop) {\r\n case 'className':\r\n el.className = String(value)\r\n break\r\n case 'style':\r\n if (isObject(value)) {\r\n value = mergeStyle(value)\r\n }\r\n default:\r\n el.setAttribute(prop, value)\r\n }\r\n}\r\n\r\n/**\r\n * 将对象形式的style转化为字符串\r\n*/\r\nexport function mergeStyle(style: Record): string {\r\n let styleStringList = []\r\n for (let cssAttr in style) {\r\n styleStringList.push(`${cssAttr}:${style[cssAttr]};`)\r\n }\r\n return styleStringList.join('')\r\n}\r\n","import {mount, unmount} from \"./mount\";\r\nimport { App } from \"../app\";\r\nimport {VArrayNode} from \"../vnode\";\r\nimport {VText} from \"../vnode\";\r\nimport {VNode, VNODE_TYPE} from \"../vnode\";\r\nimport {setElementProp} from \"./element\";\r\nimport {VComponent} from \"../vnode\";\r\n\r\nexport function isSameVNode(oldVNode: VNode, newVNode: VNode): boolean {\r\n return oldVNode.flag === newVNode.flag\r\n}\r\n\r\n// todo\r\nexport function getNextSibling(vNode: VNode): ChildNode | null {\r\n switch (vNode.flag) {\r\n case VNODE_TYPE.TEXT:\r\n case VNODE_TYPE.ELEMENT:\r\n case VNODE_TYPE.ARRAYNODE:\r\n case VNODE_TYPE.FRAGMENT:\r\n return vNode.el!.nextSibling\r\n case VNODE_TYPE.COMPONENT:\r\n return (vNode as VComponent).root.el!.nextSibling\r\n case VNODE_TYPE.ALIVE:\r\n return getNextSibling(vNode.vnode!)\r\n }\r\n}\r\n\r\nexport function patch(oldVNode: VNode, newVNode: VNode, container: HTMLElement, app?: App): void {\r\n\r\n // 如果两个节点引用一样不需要判断\r\n if (oldVNode === newVNode) return\r\n\r\n // 这里在判断相同类型的节点后可以做进一步优化\r\n if (isSameVNode(oldVNode, newVNode)) {\r\n let flag = oldVNode.flag = newVNode.flag\r\n\r\n if (flag === VNODE_TYPE.TEXT) {\r\n patchText(oldVNode, newVNode, container)\r\n } else if (flag === VNODE_TYPE.ARRAYNODE) {\r\n if (app?.options.arrayDiff) {\r\n patchArrayNodeT(oldVNode, newVNode, container)\r\n } else {\r\n patchArrayNode(oldVNode, newVNode, container)\r\n }\r\n } else {\r\n // const nextSibling = oldVNode?.el?.nextSibling\r\n const nextSibling = getNextSibling(oldVNode)\r\n unmount(oldVNode, container)\r\n mount(newVNode, container, nextSibling as ChildNode | undefined)\r\n }\r\n\r\n } else {\r\n // const nextSibling = oldVNode?.el?.nextSibling\r\n const nextSibling = getNextSibling(oldVNode)\r\n unmount(oldVNode, container)\r\n mount(newVNode, container, nextSibling as ChildNode | undefined)\r\n }\r\n\r\n}\r\n\r\nexport function patchText(oldVNode: VText, newVNode: VText, container: HTMLElement) {\r\n oldVNode.el!.nodeValue = newVNode.children\r\n newVNode.el = oldVNode.el\r\n}\r\n\r\nexport function patchElementProp(oldValue: any, newValue: any, el: HTMLElement, prop: string) {\r\n setElementProp(el, prop, newValue)\r\n}\r\n\r\nexport function patchArrayNodeT(oldVNode: VArrayNode, newVNode: VArrayNode, container: HTMLElement) {\r\n if (!oldVNode.depArray) {\r\n patchArrayNode(oldVNode, newVNode, container)\r\n return\r\n }\r\n\r\n const oldDepArray = oldVNode.depArray\r\n const newDepArray = newVNode.depArray\r\n const oldChildren = oldVNode.children\r\n const newChildren = newVNode.children\r\n\r\n if (!oldDepArray.length || !newDepArray.length) {\r\n patchArrayNode(oldVNode, newVNode, container)\r\n return\r\n }\r\n\r\n newVNode.anchor = oldVNode.anchor\r\n newVNode.el = oldVNode.el\r\n\r\n type NodeInfo = { node: VNode, index: number, used: boolean }\r\n // 为映射做初始化\r\n let map = new Map>()\r\n oldDepArray.forEach((item, index) => {\r\n let arr = map.get(item)\r\n if (!arr) map.set(item, arr = [])\r\n arr.push({ node: oldChildren[index], index, used: false })\r\n })\r\n\r\n let getOld = (item: any) => {\r\n let arr = map.get(item)\r\n if (!arr) return false\r\n\r\n let index = arr.findIndex(alone => !alone.used)\r\n\r\n if (index > -1) return arr[index]\r\n else return false\r\n }\r\n\r\n let moveOld = (item: any, node: NodeInfo) => {\r\n let arr = map.get(item)\r\n if (!arr) return\r\n\r\n let index = arr.findIndex(alone => alone === node)\r\n arr.splice(index, 1)\r\n }\r\n\r\n let maxIndexSoFar = { node: oldChildren[0], index: 0 }\r\n\r\n newDepArray.forEach((item, newIndex) => {\r\n let old = getOld(item)\r\n if (old) {\r\n if (old.index < maxIndexSoFar.index) {\r\n let next: ChildNode | null\r\n if (newIndex > 0) {\r\n next = getNextSibling(newChildren[newIndex - 1]) as ChildNode | null\r\n } else {\r\n next = getNextSibling(maxIndexSoFar.node) as ChildNode | null\r\n }\r\n\r\n VNodeInsertBefore(container, old.node, next as ChildNode | undefined)\r\n // container.insertBefore(old.node.el!, next)\r\n } else {\r\n maxIndexSoFar = old\r\n }\r\n\r\n newChildren[newIndex] = old.node\r\n moveOld(item, old)\r\n } else {\r\n // let next = maxIndexSoFar.node.el!.nextSibling\r\n let next: ChildNode | null\r\n if (newIndex > 0) {\r\n next = getNextSibling(newChildren[newIndex - 1]) as ChildNode | null\r\n } else {\r\n next = getNextSibling(maxIndexSoFar.node) as ChildNode | null\r\n }\r\n\r\n let newNode = newChildren[newIndex]\r\n mount(newNode, container, next as HTMLElement | undefined)\r\n // maxIndexSoFar = { node: newNode, index: maxIndexSoFar.index + 1 }\r\n }\r\n })\r\n\r\n\r\n map.forEach(value => {\r\n value.forEach(item => {\r\n if (!item.used) {\r\n unmount(item.node, container)\r\n }\r\n })\r\n })\r\n}\r\n\r\nfunction patchArrayNode(oldVNode: VArrayNode, newVNode: VArrayNode, container: HTMLElement) {\r\n const nextSibling = oldVNode.el.nextSibling\r\n unmount(oldVNode, container)\r\n mount(newVNode, container, nextSibling as ChildNode | undefined)\r\n}\r\n\r\n\r\n/**\r\n * 将一个虚拟节点挂载到一个锚点前面\r\n */\r\nfunction VNodeInsertBefore(container: HTMLElement, node: VNode, next?: ChildNode) {\r\n if (node.flag === VNODE_TYPE.ELEMENT || node.flag === VNODE_TYPE.TEXT) {\r\n container.insertBefore(node.el!, next!)\r\n } else if (node.flag === VNODE_TYPE.COMPONENT) {\r\n container.insertBefore((node as VComponent).root.el!, next!)\r\n }\r\n else if (node.flag === VNODE_TYPE.ARRAYNODE || node.flag === VNODE_TYPE.FRAGMENT) {\r\n let start: ChildNode | null | undefined = node.anchor\r\n let nextToMove = start?.nextSibling\r\n let end: ChildNode | null | undefined = node.el\r\n while (start !== end) {\r\n container.insertBefore(start!, next!)\r\n start = nextToMove\r\n nextToMove = start?.nextSibling\r\n }\r\n container.insertBefore(end!, next!)\r\n }\r\n}\r\n","import { patch } from \"./patch\";\r\nimport { watchVNode } from \"../reactive\";\r\nimport { App } from \"../app\";\r\nimport {\r\n VAlive,\r\n VArrayNode,\r\n VComponent,\r\n VElement,\r\n VFragment, VNodeElement,\r\n VText\r\n} from \"../vnode\";\r\nimport { VNode, VNODE_TYPE } from \"../vnode\";\r\nimport { mountElement, unmountElement } from \"./element\";\r\n\r\nexport function mount(vnode: VNode, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n switch (vnode.flag) {\r\n case VNODE_TYPE.ELEMENT:\r\n mountElement(vnode as VElement, container, anchor, app)\r\n break\r\n case VNODE_TYPE.TEXT:\r\n mountText(vnode as VText, container, anchor)\r\n break\r\n case VNODE_TYPE.FRAGMENT:\r\n mountFragment(vnode as VFragment, container, anchor, app)\r\n break\r\n case VNODE_TYPE.ARRAYNODE:\r\n mountArrayNode(vnode as VArrayNode, container, anchor, app)\r\n break\r\n case VNODE_TYPE.COMPONENT:\r\n mountComponent(vnode as VComponent, container, anchor, app)\r\n break\r\n case VNODE_TYPE.ALIVE:\r\n mountAlive(vnode as VAlive, container, anchor, app)\r\n break\r\n }\r\n}\r\n\r\nexport function unmount(vnode: VNode, container: HTMLElement) {\r\n switch (vnode.flag) {\r\n case VNODE_TYPE.ELEMENT:\r\n unmountElement(vnode as VElement, container)\r\n break\r\n case VNODE_TYPE.TEXT:\r\n unmountText(vnode as VText, container)\r\n break\r\n case VNODE_TYPE.FRAGMENT:\r\n unmountFragment(vnode as VFragment, container)\r\n break\r\n case VNODE_TYPE.ARRAYNODE:\r\n unmountArrayNode(vnode as VArrayNode, container)\r\n break\r\n case VNODE_TYPE.COMPONENT:\r\n unmountComponent(vnode as VComponent, container)\r\n break\r\n }\r\n}\r\n\r\nexport function mountChildren(children: Array, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n children.forEach(child => mount(child, container, anchor, app))\r\n}\r\n\r\nexport function mountText(vnode: VText, container: HTMLElement, anchor?: VNodeElement) {\r\n const el = document.createTextNode(vnode.children)\r\n vnode.el = el\r\n container.insertBefore(el, anchor!)\r\n}\r\n\r\nexport function unmountText(vnode: VText, container: HTMLElement) {\r\n vnode.el.remove()\r\n}\r\n\r\nexport function mountFragment(vnode: VFragment, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n const start = document.createTextNode('')\r\n const end = document.createTextNode('')\r\n vnode.anchor = start\r\n vnode.el = end\r\n container.insertBefore(start, anchor!)\r\n mountChildren(vnode.children, container, anchor, app)\r\n container.insertBefore(end, anchor!)\r\n}\r\n\r\nexport function unmountFragment(vnode: VFragment, container: HTMLElement) {\r\n const start = vnode.anchor\r\n const end = vnode.el\r\n let cur: ChildNode | null = start\r\n while (cur && cur !== end) {\r\n let next: ChildNode | null = cur.nextSibling\r\n cur.remove()\r\n cur = next\r\n }\r\n end.remove()\r\n}\r\n\r\nexport function mountArrayNode(vnode: VArrayNode, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n const start = document.createTextNode('')\r\n const end = document.createTextNode('')\r\n vnode.anchor = start\r\n vnode.el = end\r\n container.insertBefore(start, anchor!)\r\n mountChildren(vnode.children, container, anchor, app)\r\n container.insertBefore(end, anchor!)\r\n}\r\n\r\nexport function unmountArrayNode(vnode: VArrayNode, container: HTMLElement, anchor?: HTMLElement) {\r\n const start = vnode.anchor\r\n const end = vnode.el\r\n let cur: ChildNode | null = start\r\n while (cur && cur !== end) {\r\n let next: ChildNode | null = cur.nextSibling\r\n cur.remove()\r\n cur = next\r\n }\r\n end.remove()\r\n}\r\n\r\nexport function mountComponent(vNode: VComponent, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n const root = vNode.root\r\n vNode.lifeStyleInstance.emit('readyMounted')\r\n mount(root, container, anchor, app)\r\n vNode.lifeStyleInstance.emit('mounted')\r\n}\r\n\r\nexport function unmountComponent(vNode: VComponent, container: HTMLElement) {\r\n vNode.lifeStyleInstance.emit('beforeUnMounted')\r\n unmount(vNode.root, container)\r\n vNode.lifeStyleInstance.emit('unMounted')\r\n}\r\n\r\nexport function mountAlive(vnode: VAlive, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n let firstVNode = watchVNode(vnode, (oldVNode, newVNode) => patch(oldVNode, newVNode, container, app))\r\n vnode.vnode = firstVNode\r\n mount(firstVNode, container, anchor, app)\r\n}\r\n","import { H } from './render'\r\nimport { VNode, VNodeProps, OriginVNode, FunctionComponentType } from \"./vnode\"\r\nimport {appUtils, AppUtils} from \"./plugin\";\r\nimport {ComponentLifeCycle} from \"./lifeCycle\";\r\n\r\n\r\n/**\r\n * 根类组件用于类型提示\r\n * 抽象类\r\n*/\r\n\r\n// todo\r\nexport interface ComponentInstance {\r\n props?: VNodeProps\r\n children?: Array\r\n utils: AppUtils\r\n life?: ComponentLifeCycle\r\n render(h?: H): OriginVNode\r\n\r\n /** 组件示例创建之后触发 */\r\n created?(): void\r\n\r\n /** 组件示例在渲染之前触发(DOM还没有生成) */\r\n beforeMounted?(): void\r\n\r\n /** dom已经生成到js内存但还没挂载 */\r\n readyMounted?(): void\r\n\r\n /** dom挂载到了页面上*/\r\n mounted?(): void\r\n\r\n /** 卸载之前触发 */\r\n beforeUnMounted?():void\r\n\r\n /** 卸载之后触发 */\r\n unMounted?():void\r\n}\r\n\r\nexport abstract class Component implements ComponentInstance{\r\n // 组件属性\r\n abstract props?: VNodeProps\r\n // 组件子元素\r\n abstract children?: Array\r\n\r\n abstract render(h?: H): VNode\r\n\r\n utils: AppUtils = appUtils\r\n abstract life?: ComponentLifeCycle\r\n\r\n /** 组件示例创建之后触发 */\r\n abstract created?(): void\r\n\r\n /** 组件示例在渲染之前触发(DOM还没有生成) */\r\n abstract beforeMounted?(): void\r\n\r\n /** dom已经生成到js内存但还没挂载 */\r\n abstract readyMounted?(): void\r\n\r\n /** dom挂载到了页面上*/\r\n abstract mounted?(): void\r\n\r\n /** 卸载之前触发 */\r\n abstract beforeUnMounted?():void\r\n\r\n /** 卸载之后触发 */\r\n abstract unMounted?():void\r\n}\r\n\r\nexport function defineComponent(componentType: FunctionComponentType): FunctionComponentType {\r\n return componentType\r\n}\r\n","import { mount } from \"./mount/mount\";\r\nimport { VNode } from \"./vnode\";\r\nimport {isString} from \"./utils\";\r\nimport { AppPlugin, appUtils } from './plugin'\r\n\r\nexport interface Options {\r\n arrayDiff?: boolean\r\n}\r\n\r\nexport class App {\r\n rootVNode: VNode\r\n options: Options\r\n\r\n private pluginList: Array\r\n\r\n constructor(vNode: VNode, options?: Options) {\r\n this.rootVNode = vNode\r\n this.options = options || {}\r\n this.pluginList = []\r\n }\r\n\r\n mount(selector?: string | HTMLElement): void {\r\n if(selector) {\r\n const el = (isString(selector) ? document.querySelector(selector) : selector) || document.body\r\n mount(this.rootVNode, el as HTMLElement, undefined, this)\r\n }else {\r\n mount(this.rootVNode, document.body, undefined, this)\r\n }\r\n\r\n // let container = document.createElement('div')\r\n // mount(this.rootVNode, container, undefined, this)\r\n // el?.replaceWith(...container.childNodes)\r\n }\r\n\r\n use(plugin: AppPlugin) {\r\n let index = this.pluginList.indexOf(plugin)\r\n if(index > -1) return this\r\n\r\n plugin.install({utils: appUtils})\r\n return this\r\n }\r\n}\r\n\r\nexport function createApp(vNode: VNode, options?: Options): App {\r\n return new App(vNode, options)\r\n}\r\n\r\n"],"names":["h"],"mappings":";;;;MAGa,UAAU,GAAG,MAAM,CAAC,MAAM;;MCD1B,cAAc,GAAG,MAAM,CAAC,UAAU;;MCsBlC,gBAAgB,GAAG,MAAM,CAAC,YAAY;;MCtBtC,WAAW,GAAG,MAAM,CAAC,WAAW;;ACCtC,MAAM,WAAW,GAAG,MAAM,CAAC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G,CAAC,MAAiB,EAAA;QACnB,IAAI,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAC3C,IAAG,KAAK,GAAG,CAAC,CAAC;AAAE,YAAA,OAAO,IAAI,CAAA;QAE1B,MAAM,CAAC,OAAO,CAAC,EAAC,KAAK,EAAE,QAAQ,EAAC,CAAC,CAAA;AACjC,QAAA,OAAO,IAAI,CAAA;KACZ;AACF,CAAA;AAEe,SAAA,SAAS,CAAC,KAAY,EAAE,OAAiB,EAAA;AACvD,IAAA,OAAO,IAAI,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;AAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/lib/boundle.umd.js b/lib/boundle.umd.js index c37f8e7..ce339af 100644 --- a/lib/boundle.umd.js +++ b/lib/boundle.umd.js @@ -4,6 +4,16 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Vact = {})); })(this, (function (exports) { 'use strict'; + const TextSymbol = Symbol('Text'); + + const FragmentSymbol = Symbol('Fragment'); + + const VComponentSymbol = Symbol('VComponent'); + + const ArraySymbol = Symbol('ArrayNode'); + + const AliveSymbol = Symbol('Alive'); + /** * 虚拟dom节点类型枚举 */ @@ -19,12 +29,6 @@ VNODE_TYPE[VNODE_TYPE["ALIVE"] = 5] = "ALIVE"; })(VNODE_TYPE || (VNODE_TYPE = {})); - const FragmentSymbol = Symbol('Fragment'); - - const TextSymbol = Symbol('Text'); - - const ArraySymbol = Symbol('ArrayNode'); - function isString(content) { return typeof content === 'string'; } @@ -181,6 +185,10 @@ function setActiver(fn) { activeWatcher = fn; } + // 设置全局变量 + function getActiver() { + return activeWatcher; + } class RefImpl { constructor(value) { @@ -227,7 +235,64 @@ return new Activer(fn); } - const AliveSymbol = Symbol('Alive'); + class ComponentLifeCycle { + constructor(createdList = [], beforeMountedList = [], readyMountedList = [], mountedList = [], beforeUnMountedList = [], unMountedList = []) { + this.createdList = createdList; + this.beforeMountedList = beforeMountedList; + this.readyMountedList = readyMountedList; + this.mountedList = mountedList; + this.beforeUnMountedList = beforeUnMountedList; + this.unMountedList = unMountedList; + // this.createdList = [] + // this.beforeMountedList = [] + // this.readyMountedList = [] + // this.mountedList = [] + // this.beforeUnMountedList = [] + // this.unMountedList = [] + } + created(fn) { + this.createdList.push(fn); + } + beforeMounted(fn) { + this.beforeMountedList.push(fn); + } + readyMounted(fn) { + this.readyMountedList.push(fn); + } + mounted(fn) { + this.mountedList.push(fn); + } + beforeUnMounted(fn) { + this.beforeUnMountedList.push(fn); + } + unMounted(fn) { + this.unMountedList.push(fn); + } + emit(lifeName) { + this[`${lifeName}List`].forEach(fn => fn()); + } + } + // 生成类组件生命周期实例 + function createClassComponentLife(component) { + let lifeNames = ['created', 'beforeMounted', 'readyMounted', 'mounted', 'beforeUnMounted', 'unMounted']; + let lifeCycle = new ComponentLifeCycle(); + component.life = lifeCycle; + lifeNames.forEach(lifeName => { + let fn = component[lifeName]; + if (!fn) + return; + lifeCycle[lifeName](fn.bind(component)); + }); + return lifeCycle; + } + + // 给插件提供的能力 + const appUtils = { + state, + defineState, + h: renderApi, + watch + }; /** * 函数转化为activer转化为VAlive @@ -236,19 +301,20 @@ * 数组转化为VArray * 其他转化为VText */ - function standarVNode(node) { - if (isVNode(node)) - return node; - if (isFunction(node)) - return renderAlive(active(node)); - else if (isActiver(node)) - return renderAlive(node); - else if (isString(node)) - return renderText(node); - else if (isArray(node)) - return renderArrayNode(node.map(item => standarVNode(item))); + function createVNode(originVNode) { + if (isVNode(originVNode)) + return originVNode; + if (isFunction(originVNode)) + return renderAlive(active(originVNode)); + else if (isActiver(originVNode)) + return renderAlive(originVNode); + else if (isString(originVNode)) + return renderText(originVNode); + else if (isArray(originVNode)) + return renderArrayNode(originVNode.map(item => createVNode(item))); else { - let value = node; + // todo + let value = originVNode; let retText; if (!value && typeof value !== 'number') retText = renderText(''); @@ -261,37 +327,49 @@ * text(不需要props)、fragment(不需要props)、element、component为显性创建 * array(不需要props)、alive(不需要props)为隐形创建 */ - function render(type, props, mayChildren) { + function renderApi(type, props, children) { + return render(type, props || undefined, children); + } + function render(type, originProps, originChildren) { // text的children比较特殊先处理 if (isText(type)) { - return renderText(String(mayChildren)); + return renderText(String(originChildren)); } - let children; // 预处理 处理为单个的children - if (isArray(mayChildren)) - children = mayChildren; + let originChildrenList = []; + if (isArray(originChildren)) + originChildrenList.push(...originChildren); else - children = [mayChildren]; - let standardChildren = children.map(child => standarVNode(child)); + originChildrenList.push(originChildren); + // 创建VNode列表 + let vNodeChildren = originChildrenList.map(originChild => createVNode(originChild)); // 属性预处理 - if (props) { - for (const prop in props) { - // 以on开头的事件不需要处理 - if (!isOnEvent(prop) && isFunction(props[prop])) { - props[prop] = active(props[prop]); - } - } - } + let props = originProps || {}; + handleProps(props); if (isString(type)) - return renderElement(type, props || {}, standardChildren); + return renderElement(type, props, vNodeChildren); if (isFragment(type)) - return renderFragment(standardChildren); + return renderFragment(vNodeChildren); if (isArrayNode(type)) - return renderArrayNode(standardChildren); + return renderArrayNode(vNodeChildren); if (isFunction(type)) - return renderComponent(type, props || {}, standardChildren); + return renderComponent(type, props, vNodeChildren); throw '传入参数不合法'; } + /** + * 对属性进行预处理 + */ + function handleProps(originProps) { + for (const prop in originProps) { + // 以on开头的事件不需要处理 + if (!isOnEvent(prop) && + isFunction(originProps[prop])) { + // 如不为on且为函数则判断为响应式 + originProps[prop] = active(originProps[prop]); + } + } + return originProps; + } function renderText(text) { return { type: TextSymbol, @@ -321,34 +399,24 @@ children }; } - // 判断是普通函数还是构造函数 - function renderComponent(component, props, children) { - let cprops = {}; - for (let prop in props) { - let cur = props[prop]; - if (isActiver(cur)) { - Object.defineProperty(cprops, prop, { + function createComponentProps(props) { + let componentProps = {}; + for (const prop in props) { + let curProp = props[prop]; + if (isActiver(curProp)) { + Object.defineProperty(componentProps, prop, { get() { - return cur.value; + return curProp.value; } }); } else { - cprops[prop] = cur; + componentProps[prop] = curProp; } } - if (component.prototype && component.prototype.render && isFunction(component.prototype.render)) { - let Constructor = component; - let result = new Constructor(cprops, children); - result.props = cprops; - result.children = children; - return standarVNode(result.render(render)); - } - else { - let Fun = component; - return standarVNode(Fun(cprops, children)); - } + return componentProps; } + // 渲染一个活跃的节点 function renderAlive(activer) { return { type: AliveSymbol, @@ -356,6 +424,47 @@ activer }; } + // 判断是普通函数还是构造函数 + function renderComponent(component, props, children) { + let componentProps = createComponentProps(props); + if (component.prototype && + component.prototype.render && + isFunction(component.prototype.render)) { + let ClassComponent = component; + let result = new ClassComponent(componentProps, children); + result.props = componentProps; + result.children = children; + let lifeCycle = createClassComponentLife(result); + let vn = result.render(renderApi); + lifeCycle.emit('created'); + let vc = { + type: VComponentSymbol, + root: createVNode(vn), + props: componentProps, + children: children, + flag: VNODE_TYPE.COMPONENT, + lifeStyleInstance: lifeCycle + }; + lifeCycle.emit('beforeMounted'); + return vc; + } + else { + let FunctionComponent = component; + let lifeCycle = new ComponentLifeCycle(); + let vn = FunctionComponent({ props: componentProps, children: children, life: lifeCycle, utils: appUtils }); + lifeCycle.emit('created'); + let vc = { + type: VComponentSymbol, + root: createVNode(vn), + props: componentProps, + children: children, + flag: VNODE_TYPE.COMPONENT, + lifeStyleInstance: lifeCycle + }; + lifeCycle.emit('beforeMounted'); + return vc; + } + } /** * 观察者 @@ -395,7 +504,7 @@ function watchVNode(activeVNode, callback) { let watcher = new Watcher(activeVNode.activer, function (oldValue, newValue, meta) { const oldVNode = oldValue; - const newVNode = standarVNode(newValue); + const newVNode = createVNode(newValue); // 对于数组节点后期需要记录它的响应式数组用于节点更新 if (oldVNode.flag === VNODE_TYPE.ARRAYNODE) { oldVNode.depArray = meta === null || meta === void 0 ? void 0 : meta.targetPropOldValue; @@ -408,7 +517,7 @@ watcher.value = newVNode; activeVNode.vnode = newVNode; }); - return watcher.value = standarVNode(watcher.value); + return watcher.value = createVNode(watcher.value); } /** * 监控可变dom的prop @@ -478,8 +587,21 @@ function isSameVNode(oldVNode, newVNode) { return oldVNode.flag === newVNode.flag; } + // todo + function getNextSibling(vNode) { + switch (vNode.flag) { + case VNODE_TYPE.TEXT: + case VNODE_TYPE.ELEMENT: + case VNODE_TYPE.ARRAYNODE: + case VNODE_TYPE.FRAGMENT: + return vNode.el.nextSibling; + case VNODE_TYPE.COMPONENT: + return vNode.root.el.nextSibling; + case VNODE_TYPE.ALIVE: + return getNextSibling(vNode.vnode); + } + } function patch(oldVNode, newVNode, container, app) { - var _a, _b; // 如果两个节点引用一样不需要判断 if (oldVNode === newVNode) return; @@ -498,15 +620,15 @@ } } else { - const nextSibling = (_a = oldVNode === null || oldVNode === void 0 ? void 0 : oldVNode.el) === null || _a === void 0 ? void 0 : _a.nextSibling; - // const nextSibling = getNextSibling(oldVNode) + // const nextSibling = oldVNode?.el?.nextSibling + const nextSibling = getNextSibling(oldVNode); unmount(oldVNode); mount(newVNode, container, nextSibling); } } else { - const nextSibling = (_b = oldVNode === null || oldVNode === void 0 ? void 0 : oldVNode.el) === null || _b === void 0 ? void 0 : _b.nextSibling; - // const nextSibling = getNextSibling(oldVNode) + // const nextSibling = oldVNode?.el?.nextSibling + const nextSibling = getNextSibling(oldVNode); unmount(oldVNode); mount(newVNode, container, nextSibling); } @@ -565,10 +687,10 @@ if (old.index < maxIndexSoFar.index) { let next; if (newIndex > 0) { - next = newChildren[newIndex - 1].el.nextSibling; + next = getNextSibling(newChildren[newIndex - 1]); } else { - next = maxIndexSoFar.node.el.nextSibling; + next = getNextSibling(maxIndexSoFar.node); } VNodeInsertBefore(container, old.node, next); // container.insertBefore(old.node.el!, next) @@ -583,10 +705,10 @@ // let next = maxIndexSoFar.node.el!.nextSibling let next; if (newIndex > 0) { - next = newChildren[newIndex - 1].el.nextSibling; + next = getNextSibling(newChildren[newIndex - 1]); } else { - next = maxIndexSoFar.node.el.nextSibling; + next = getNextSibling(maxIndexSoFar.node); } let newNode = newChildren[newIndex]; mount(newNode, container, next); @@ -606,10 +728,16 @@ unmount(oldVNode); mount(newVNode, container, nextSibling); } + /** + * 将一个虚拟节点挂载到一个锚点前面 + */ function VNodeInsertBefore(container, node, next) { if (node.flag === VNODE_TYPE.ELEMENT || node.flag === VNODE_TYPE.TEXT) { container.insertBefore(node.el, next); } + else if (node.flag === VNODE_TYPE.COMPONENT) { + container.insertBefore(node.root.el, next); + } else if (node.flag === VNODE_TYPE.ARRAYNODE || node.flag === VNODE_TYPE.FRAGMENT) { let start = node.anchor; let nextToMove = start === null || start === void 0 ? void 0 : start.nextSibling; @@ -637,9 +765,9 @@ case VNODE_TYPE.ARRAYNODE: mountArrayNode(vnode, container, anchor, app); break; - // case VNODE_TYPE.COMPONENT: - // mountComponent(vnode as VComponent, container, anchor, app) - // break + case VNODE_TYPE.COMPONENT: + mountComponent(vnode, container, anchor, app); + break; case VNODE_TYPE.ALIVE: mountAlive(vnode, container, anchor, app); break; @@ -659,9 +787,9 @@ case VNODE_TYPE.ARRAYNODE: unmountArrayNode(vnode); break; - // case VNODE_TYPE.COMPONENT: - // unmountComponent(vnode as VComponent, container) - // break + case VNODE_TYPE.COMPONENT: + unmountComponent(vnode); + break; } } function mountChildren(children, container, anchor, app) { @@ -715,16 +843,17 @@ } end.remove(); } - // export function mountComponent(vnode: VComponent, container: HTMLElement, anchor?: HTMLElement, app?: Vact) { - // console.log(1111); - // const root = vnode.type.render(render) - // vnode.root = root - // mount(root, container, anchor, app) - // vnode.el = root.el! - // } - // export function unmountComponent(vnode: VComponent, container: HTMLElement) { - // unmount(vnode.root, container) - // } + function mountComponent(vNode, container, anchor, app) { + const root = vNode.root; + vNode.lifeStyleInstance.emit('readyMounted'); + mount(root, container, anchor, app); + vNode.lifeStyleInstance.emit('mounted'); + } + function unmountComponent(vNode, container) { + vNode.lifeStyleInstance.emit('beforeUnMounted'); + unmount(vNode.root); + vNode.lifeStyleInstance.emit('unMounted'); + } function mountAlive(vnode, container, anchor, app) { let firstVNode = watchVNode(vnode, (oldVNode, newVNode) => patch(oldVNode, newVNode, container, app)); vnode.vnode = firstVNode; @@ -732,46 +861,68 @@ } class Component { - constructor(config = {}) { - this.config = config; - this.data = defineState(config.data || {}); + constructor() { + this.utils = appUtils; } } + function defineComponent(componentType) { + return componentType; + } - class Vact { - constructor(vnode, options) { - this.rootVNode = vnode; + class App { + constructor(vNode, options) { + this.rootVNode = vNode; this.options = options || {}; + this.pluginList = []; } mount(selector) { - const el = document.querySelector(selector); - let container = document.createElement('div'); - mount(this.rootVNode, container, undefined, this); - el === null || el === void 0 ? void 0 : el.replaceWith(...container.childNodes); + if (selector) { + const el = (isString(selector) ? document.querySelector(selector) : selector) || document.body; + mount(this.rootVNode, el, undefined, this); + } + else { + mount(this.rootVNode, document.body, undefined, this); + } + // let container = document.createElement('div') + // mount(this.rootVNode, container, undefined, this) + // el?.replaceWith(...container.childNodes) } use(plugin) { - const utils = { state, defineState, h: render }; - plugin.install(utils); + let index = this.pluginList.indexOf(plugin); + if (index > -1) + return this; + plugin.install({ utils: appUtils }); return this; } } - function createApp(vnode, options) { - return new Vact(vnode, options); + function createApp(vNode, options) { + return new App(vNode, options); } exports.Activer = Activer; exports.Component = Component; - exports.Fragment = FragmentSymbol; - exports.Text = TextSymbol; + exports.RefImpl = RefImpl; + exports.VArray = ArraySymbol; + exports.VComponent = VComponentSymbol; + exports.VFragment = FragmentSymbol; + exports.VText = TextSymbol; + exports.Watcher = Watcher; + exports.active = active; exports.createApp = createApp; - exports.createVNode = render; - exports["default"] = Vact; + exports.createVNode = renderApi; + exports["default"] = App; + exports.defineComponent = defineComponent; exports.defineState = defineState; + exports.getActiver = getActiver; + exports.h = renderApi; exports.mount = mount; exports.reactive = reactive; exports.ref = ref; - exports.render = render; + exports.render = renderApi; + exports.setActiver = setActiver; exports.state = state; + exports.track = track; + exports.trigger = trigger; exports.watch = watch; exports.watchProp = watchProp; exports.watchVNode = watchVNode; diff --git a/lib/boundle.umd.js.map b/lib/boundle.umd.js.map index e026907..19365f3 100644 --- a/lib/boundle.umd.js.map +++ b/lib/boundle.umd.js.map @@ -1 +1 @@ -{"version":3,"file":"boundle.umd.js","sources":["../src/vnode/vnode.ts","../src/vnode/fragment.ts","../src/vnode/text.ts","../src/vnode/array.ts","../src/utils.ts","../src/reactive/update.ts","../src/reactive/reactive.ts","../src/reactive/ref.ts","../src/reactive/utils.ts","../src/reactive/active.ts","../src/vnode/alive.ts","../src/render.ts","../src/reactive/watch.ts","../src/mount/element.ts","../src/mount/patch.ts","../src/mount/mount.ts","../src/component.ts","../src/vact.ts"],"sourcesContent":["import { Activer } from \"../reactive\"\r\nimport { ComponentConstructor } from './component'\r\n\r\n/**\r\n * 虚拟dom节点类型枚举\r\n*/\r\nexport enum VNODE_TYPE {\r\n // 普通元素节点类型\r\n ELEMENT,\r\n // 文本节点类型\r\n TEXT,\r\n FRAGMENT,\r\n COMPONENT,\r\n ARRAYNODE,\r\n ALIVE\r\n}\r\n\r\n/**\r\n * 虚拟dom接口类型\r\n*/\r\nexport interface VNode {\r\n\r\n // 虚拟节点类型\r\n type: string | symbol | ComponentConstructor,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE\r\n\r\n // 虚拟节点属性\r\n props?: Record,\r\n\r\n // 虚拟节点子节点\r\n children?: Array | string,\r\n\r\n // 真实节点\r\n el?: HTMLElement | Text\r\n anchor?: Text\r\n\r\n activer?: Activer\r\n // 目前存在的节点\r\n vnode?: VNode\r\n\r\n}\r\n\r\n","import { VNode, VNODE_TYPE } from \"./vnode\";\r\n\r\nexport const FragmentSymbol = Symbol('Fragment');\r\nexport interface VFragment extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n\r\n // 虚拟节点子节点\r\n children: Array,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.FRAGMENT\r\n\r\n // 锚点\r\n anchor: Text,\r\n el: Text\r\n\r\n}","import { VNode, VNODE_TYPE } from \"./vnode\";\r\n\r\n\r\nexport const TextSymbol = Symbol('Text');\r\nexport interface VText extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n\r\n // 虚拟节点子节点\r\n children: string,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.TEXT\r\n\r\n el: Text\r\n\r\n}","import { VNode, VNODE_TYPE } from \"./vnode\";\r\n\r\nexport const ArraySymbol = Symbol('ArrayNode');\r\nexport interface VArrayNode extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n\r\n // 虚拟节点子节点\r\n children: Array,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.ARRAYNODE\r\n\r\n // 锚点\r\n anchor: Text,\r\n el: Text,\r\n\r\n // 记录当前数组节点依赖的响应式数组\r\n depArray: Array\r\n}","import { VNode, VNODE_TYPE } from './vnode/vnode'\r\nimport { Activer } from './reactive/active'\r\nimport { FragmentSymbol } from './vnode/fragment'\r\nimport { TextSymbol } from './vnode/text'\r\nimport { ArraySymbol } from './vnode/array'\r\n\r\nexport function isString(content: unknown): content is string {\r\n return typeof content === 'string'\r\n}\r\n\r\nexport function isFunction(content: unknown): content is Function {\r\n return typeof content === 'function'\r\n}\r\n\r\nexport function isFragment(content: unknown): boolean {\r\n return content === FragmentSymbol\r\n}\r\n\r\nexport function isArrayNode(content: unknown): boolean {\r\n return content === ArraySymbol\r\n}\r\n\r\nexport function isText(content: unknown): boolean {\r\n return content === TextSymbol\r\n}\r\n\r\nexport function isActiver(content: unknown): content is Activer {\r\n return isObject(content) && (content as Record).flag === 'activer'\r\n}\r\n\r\nexport function isVNode(content: unknown): content is VNode {\r\n return isObject(content) && (content as Record).flag in VNODE_TYPE\r\n}\r\n\r\nexport function isObjectExact(content: unknown): content is Object {\r\n return isObject(content) && content.constructor === Object\r\n}\r\n\r\nexport function isOnEvent(str: string): boolean {\r\n return /^on.+$/.test(str)\r\n}\r\n\r\nexport function isObject(content: unknown): content is object {\r\n return typeof content === 'object' && content !== null\r\n}\r\n\r\n\r\nexport function isArray(content: unknown): content is Array {\r\n return Array.isArray(content)\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n","import { Watcher } from \"./watch\";\r\n\r\nlet updating = false\r\nconst watcherTask: Array = []\r\n\r\nexport function runUpdate(watcher: Watcher) {\r\n let index: number = watcherTask.indexOf(watcher)\r\n if (!(index > -1)) watcherTask.push(watcher)\r\n if (!updating) {\r\n updating = true\r\n Promise.resolve()\r\n .then(() => {\r\n let watcher: Watcher | undefined = undefined\r\n while (watcher = watcherTask.shift()) {\r\n watcher.update()\r\n }\r\n }).finally(() => {\r\n updating = false\r\n })\r\n }\r\n}","import { isArray, isObjectExact, isVNode } from \"../utils\"\r\nimport { Watcher } from \"./watch\"\r\nimport { runUpdate } from './update'\r\n\r\n// 目标对象到映射对象\r\nconst targetMap = new WeakMap()\r\n// 全局变量watcher\r\nlet activeWatcher: Watcher | null = null\r\nconst REACTIVE = Symbol('reactive')\r\n\r\n/**\r\n * 实现响应式对象\r\n*/\r\nexport function reactive>(target: T): T {\r\n if (target[REACTIVE]) return target\r\n\r\n let handler: ProxyHandler = {\r\n get(target, prop, receiver) {\r\n if (prop === REACTIVE) return true\r\n const res = Reflect.get(target, prop, receiver)\r\n\r\n if (isObjectExact(res) && !isVNode(res)) {\r\n return reactive(res)\r\n }\r\n\r\n if (Array.isArray(res)) {\r\n track(target, prop)\r\n return reactiveArray(res, target, prop)\r\n }\r\n\r\n track(target, prop)\r\n return res\r\n },\r\n\r\n set(target, prop, value, receiver) {\r\n const res = Reflect.set(target, prop, value, receiver)\r\n trigger(target, prop)\r\n return res\r\n }\r\n }\r\n\r\n return new Proxy(target, handler)\r\n}\r\n\r\n/**\r\n * 设置响应式数组\r\n*/\r\nfunction reactiveArray(targetArr: Array, targetObj: Record, Arrprop: string | symbol) {\r\n let handler: ProxyHandler> = {\r\n get(target, prop, receiver) {\r\n const res = Reflect.get(target, prop, receiver)\r\n\r\n if (isObjectExact(res)) {\r\n return reactive(res)\r\n }\r\n\r\n return res\r\n },\r\n set(target, prop, value, receiver) {\r\n const res = Reflect.set(target, prop, value, receiver)\r\n trigger(targetObj, Arrprop)\r\n return res\r\n }\r\n }\r\n\r\n return new Proxy(targetArr, handler)\r\n}\r\n\r\n/**\r\n * 响应触发依赖\r\n*/\r\nexport function trigger(target: Record, prop: string | symbol) {\r\n let mapping: Record> = targetMap.get(target)\r\n if (!mapping) return\r\n\r\n let mappingProp: Array = mapping[prop]\r\n if (!mappingProp) return\r\n\r\n // mappingProp.forEach(watcher => watcher.update(oldValue, newValue))\r\n mappingProp.forEach(watcher => {\r\n // 针对于对数组响应做特殊处理\r\n if (isArray(target[prop])) {\r\n watcher.nextDepArr = target[prop]\r\n }\r\n runUpdate(watcher)\r\n })\r\n}\r\n\r\n/**\r\n * 追踪绑定依赖\r\n*/\r\nexport function track(target: Record, prop: string | symbol) {\r\n if (!activeWatcher) return\r\n\r\n let mapping: Record> = targetMap.get(target)\r\n if (!mapping) targetMap.set(target, mapping = {})\r\n\r\n let mappingProp: Array = mapping[prop]\r\n if (!mappingProp) mappingProp = mapping[prop] = []\r\n\r\n // 针对于对数组响应做特殊处理\r\n if (isArray(target[prop])) {\r\n if (activeWatcher.depArr) {\r\n activeWatcher.depArr = false\r\n } else {\r\n if (activeWatcher.depArr === undefined) {\r\n activeWatcher.depArr = target[prop].slice()\r\n }\r\n }\r\n }\r\n\r\n mappingProp.push(activeWatcher)\r\n}\r\n\r\n// 设置全局变量\r\nexport function setActiver(fn: Watcher | null) {\r\n activeWatcher = fn\r\n}\r\n// 设置全局变量\r\nexport function getActiver(): Watcher | null {\r\n return activeWatcher\r\n}\r\n\r\n","import { track, trigger } from './reactive'\r\n\r\nexport class RefImpl {\r\n private _value: T\r\n private readonly _target: Record\r\n\r\n constructor(value: T) {\r\n this._value = value\r\n this._target = { value: this._value }\r\n }\r\n\r\n get value() {\r\n track(this._target, 'value')\r\n return this._value\r\n }\r\n\r\n set value(value) {\r\n this._value = value\r\n this._target.value = this._value\r\n trigger(this._target, 'value')\r\n }\r\n}\r\n\r\n\r\nexport function ref(value: T): RefImpl {\r\n return new RefImpl(value)\r\n}","import { ref } from './ref'\r\nimport { reactive } from './reactive'\r\n\r\n\r\nexport function state(value: T) {\r\n return ref(value)\r\n}\r\n\r\nexport function defineState>(target: T): T {\r\n return reactive(target)\r\n}\r\n\r\n\r\n\r\n\r\n\r\n","\r\n/**\r\n * 响应式对象\r\n*/\r\nexport class Activer {\r\n callback: () => T\r\n flag: string = 'activer'\r\n\r\n constructor(fn: () => T) {\r\n this.callback = fn\r\n }\r\n\r\n get value(): T {\r\n return this.callback()\r\n }\r\n}\r\n\r\n/**\r\n * 外置函数\r\n*/\r\nexport function active(fn: () => T): Activer {\r\n return new Activer(fn)\r\n}\r\n\r\n","import { Activer } from \"../reactive\"\r\nimport { Child } from \"../render\"\r\nimport { VNode, VNODE_TYPE } from \"./vnode\"\r\n\r\nexport const AliveSymbol = Symbol('Alive')\r\nexport interface VAlive extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.ELEMENT\r\n\r\n activer: Activer\r\n // 目前存在的节点\r\n vnode: VNode\r\n}","import { active } from \"./reactive/active\";\r\nimport { Activer } from './reactive'\r\nimport { isString, isFragment, isText, isFunction, isArrayNode, isOnEvent, isVNode, isActiver, isArray } from \"./utils\";\r\nimport { ComponentConstructor, FunctionConstructor, ClassConstructor } from \"./vnode/component\";\r\nimport { VNode, VNODE_TYPE } from \"./vnode/vnode\";\r\nimport { ArraySymbol } from \"./vnode/array\";\r\nimport { AliveSymbol } from \"./vnode/alive\";\r\nimport { TextSymbol } from './vnode/text'\r\nimport { FragmentSymbol } from \"./vnode/fragment\";\r\n\r\n/**\r\n * 传说中的render函数\r\n*/\r\n\r\nexport type HSymbol = typeof TextSymbol | typeof FragmentSymbol | typeof AliveSymbol | typeof ArraySymbol\r\nexport type H = (type: string | HSymbol | ComponentConstructor, props?: Record | null, mayChildren?: Child | Array) => VNode\r\n// 未经过标准化的children类型\r\nexport type Child = (() => Child) | string | VNode | Array | Activer | Exclude<(() => Child) | string | VNode | Array | Activer, any>\r\n\r\n/**\r\n * 函数转化为activer转化为VAlive\r\n * activer转化为VAlive\r\n * string转化为VText\r\n * 数组转化为VArray\r\n * 其他转化为VText\r\n*/\r\nexport function standarVNode(node: Child): VNode {\r\n if (isVNode(node)) return node\r\n\r\n if (isFunction(node)) return renderAlive(active(node))\r\n else if (isActiver(node)) return renderAlive(node)\r\n else if (isString(node)) return renderText(node)\r\n else if (isArray(node)) return renderArrayNode(node.map(item => standarVNode(item)))\r\n else {\r\n let value = node\r\n let retText: VNode\r\n if (!value && typeof value !== 'number') retText = renderText('')\r\n else retText = renderText(String(value))\r\n return retText\r\n }\r\n}\r\n\r\n\r\n/**\r\n * text(不需要props)、fragment(不需要props)、element、component为显性创建\r\n * array(不需要props)、alive(不需要props)为隐形创建\r\n*/\r\nexport function render(type: string | symbol | ComponentConstructor, props?: Record | null, mayChildren?: Child | Array): VNode {\r\n // text的children比较特殊先处理\r\n if (isText(type)) {\r\n return renderText(String(mayChildren))\r\n }\r\n\r\n let children: Array\r\n // 预处理 处理为单个的children\r\n if (isArray(mayChildren)) children = mayChildren\r\n else children = [mayChildren as Child]\r\n\r\n let standardChildren: Array = children.map(child => standarVNode(child))\r\n\r\n // 属性预处理\r\n if (props) {\r\n for (const prop in props) {\r\n // 以on开头的事件不需要处理\r\n if (!isOnEvent(prop) && isFunction(props[prop])) {\r\n props[prop] = active(props[prop])\r\n }\r\n }\r\n }\r\n\r\n if (isString(type)) return renderElement(type, props || {}, standardChildren)\r\n if (isFragment(type)) return renderFragment(standardChildren)\r\n if (isArrayNode(type)) return renderArrayNode(standardChildren)\r\n if (isFunction(type)) return renderComponent(type, props || {}, standardChildren)\r\n throw '传入参数不合法'\r\n}\r\n\r\nfunction renderText(text: string): VNode {\r\n return {\r\n type: TextSymbol,\r\n flag: VNODE_TYPE.TEXT,\r\n children: text\r\n }\r\n}\r\n\r\nfunction renderElement(tag: string, props: Record, children: Array): VNode {\r\n return {\r\n type: tag,\r\n flag: VNODE_TYPE.ELEMENT,\r\n props,\r\n children\r\n }\r\n}\r\n\r\nfunction renderFragment(children: Array): VNode {\r\n return {\r\n type: FragmentSymbol,\r\n flag: VNODE_TYPE.FRAGMENT,\r\n children\r\n }\r\n}\r\n\r\nfunction renderArrayNode(children: Array): VNode {\r\n return {\r\n type: ArraySymbol,\r\n flag: VNODE_TYPE.ARRAYNODE,\r\n children\r\n }\r\n}\r\n\r\n\r\n// 判断是普通函数还是构造函数\r\nfunction renderComponent(component: ComponentConstructor, props: Record, children: Array): VNode {\r\n let cprops: Record = {}\r\n for (let prop in props) {\r\n let cur = props[prop]\r\n if (isActiver(cur)) {\r\n Object.defineProperty(cprops, prop, {\r\n get() {\r\n return (cur).value\r\n }\r\n })\r\n } else {\r\n cprops[prop] = cur\r\n }\r\n }\r\n\r\n if (component.prototype && component.prototype.render && isFunction(component.prototype.render)) {\r\n let Constructor = component as ClassConstructor\r\n let result = new Constructor(cprops, children)\r\n result.props = cprops\r\n result.children = children\r\n return standarVNode(result.render(render))\r\n } else {\r\n let Fun = component as FunctionConstructor\r\n return standarVNode(Fun(cprops, children))\r\n }\r\n}\r\n\r\n\r\nfunction renderAlive(activer: Activer): VNode {\r\n return {\r\n type: AliveSymbol,\r\n flag: VNODE_TYPE.ALIVE,\r\n activer\r\n }\r\n}\r\n","import { setActiver } from \"./reactive\"\r\nimport { active, Activer } from './active'\r\nimport { VNode, VNODE_TYPE } from \"../vnode/vnode\"\r\nimport { isActiver } from \"../utils\"\r\nimport { Child, standarVNode } from \"../render\"\r\nimport { VArrayNode } from \"../vnode/array\"\r\nimport { VAlive } from \"../vnode/alive\"\r\n\r\ntype Meta = {\r\n targetPropOldValue: any,\r\n targetPropnewValue: any\r\n}\r\n\r\n/**\r\n * 观察者\r\n * 观察数据的变化\r\n*/\r\nexport class Watcher {\r\n value: T\r\n callback: (oldValue: T, newValue: T, meta?: Meta) => void\r\n activeProps: Activer\r\n depArr?: Array | false\r\n nextDepArr?: Array\r\n\r\n constructor(activeProps: Activer, callback: (oldValue: T, newValue: T, meta?: Meta) => void) {\r\n setActiver(this)\r\n this.value = activeProps.value\r\n this.callback = callback\r\n this.activeProps = activeProps\r\n setActiver(null)\r\n }\r\n\r\n update() {\r\n let newValue = this.activeProps.value\r\n let oldValue = this.value\r\n this.value = newValue\r\n let meta = { targetPropOldValue: this.depArr, targetPropnewValue: this.nextDepArr }\r\n this.callback(oldValue, newValue, meta)\r\n this.depArr = this.nextDepArr?.slice()\r\n }\r\n}\r\n\r\n\r\n/**\r\n * 监控自定义响应式属性\r\n*/\r\nexport function watch(activeProps: (() => T) | Activer, callback: (oldValue: T, newValue: T) => void): Watcher {\r\n if (!isActiver(activeProps)) activeProps = active(activeProps)\r\n return new Watcher(activeProps, function (oldValue: T, newValue: T) {\r\n callback(oldValue, newValue)\r\n })\r\n}\r\n\r\n/**\r\n * 监控可变状态dom\r\n*/\r\nexport function watchVNode(activeVNode: VAlive, callback: (oldVNode: VNode, newVNode: VNode) => void): VNode {\r\n let watcher = new Watcher(activeVNode.activer, function (oldValue: Child, newValue: Child, meta) {\r\n const oldVNode = oldValue as VNode\r\n const newVNode = standarVNode(newValue)\r\n\r\n // 对于数组节点后期需要记录它的响应式数组用于节点更新\r\n if (oldVNode.flag === VNODE_TYPE.ARRAYNODE) {\r\n (oldVNode).depArray = meta?.targetPropOldValue\r\n }\r\n // 对于数组节点后期需要记录它的响应式数组用于节点更新\r\n if (newVNode.flag === VNODE_TYPE.ARRAYNODE) {\r\n (newVNode).depArray = meta?.targetPropnewValue\r\n }\r\n\r\n callback(oldVNode, newVNode)\r\n watcher.value = newVNode\r\n activeVNode.vnode = newVNode\r\n })\r\n\r\n return watcher.value = standarVNode(watcher.value)\r\n}\r\n\r\n\r\n/**\r\n * 监控可变dom的prop\r\n*/\r\nexport function watchProp(activeProp: Activer, callback: (oldVNode: VNode, newVNode: VNode) => void): any {\r\n return new Watcher(activeProp, callback).value\r\n}","import { Vact } from \"../vact\"\r\nimport { watchProp } from \"../reactive\"\r\nimport { isActiver, isOnEvent, isFunction, isObject } from \"../utils\"\r\nimport { VElement } from \"../vnode/element\"\r\nimport { mountChildren } from \"./mount\"\r\nimport { patchElementProp } from \"./patch\"\r\n\r\n\r\n\r\nexport function mountElement(vnode: VElement, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n const el = document.createElement(vnode.type)\r\n vnode.el = el\r\n mountElementProps(vnode)\r\n mountChildren(vnode.children, el, undefined, app)\r\n container.insertBefore(el, anchor!)\r\n}\r\n\r\nexport function unmountElement(vnode: VElement, container: HTMLElement) {\r\n vnode.el.remove()\r\n}\r\n\r\nexport function mountElementProps(vnode: VElement) {\r\n let el = vnode.el\r\n let props = vnode.props\r\n\r\n // 处理标签属性\r\n for (let prop in props) {\r\n let value = props[prop]\r\n if (isActiver(value)) {\r\n let firstValue = watchProp(value, (oldValue, newValue) => patchElementProp(oldValue, newValue, el, prop))\r\n setElementProp(el, prop, firstValue)\r\n } else {\r\n setElementProp(el, prop, value)\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * 处理单个dom属性\r\n*/\r\nexport function setElementProp(el: HTMLElement, prop: string, value: any) {\r\n if (isOnEvent(prop) && isFunction(value)) {\r\n let pattern = /^on(.+)$/\r\n let result = prop.match(pattern)\r\n result && el.addEventListener(result[1].toLocaleLowerCase(), value.bind(el))\r\n return\r\n }\r\n\r\n switch (prop) {\r\n case 'className':\r\n el.className = String(value)\r\n break\r\n case 'style':\r\n if (isObject(value)) {\r\n value = mergeStyle(value)\r\n }\r\n default:\r\n el.setAttribute(prop, value)\r\n }\r\n}\r\n\r\n/**\r\n * 将对象形式的style转化为字符串\r\n*/\r\nexport function mergeStyle(style: Record): string {\r\n let styleStringList = []\r\n for (let cssAttr in style) {\r\n styleStringList.push(`${cssAttr}:${style[cssAttr]};`)\r\n }\r\n return styleStringList.join('')\r\n}","import { unmount, mount } from \"./mount\";\r\nimport { Vact } from \"../vact\";\r\nimport { VArrayNode } from \"../vnode/array\";\r\nimport { VText } from \"../vnode/text\";\r\nimport { VNode, VNODE_TYPE } from \"../vnode/vnode\";\r\nimport { setElementProp } from \"./element\";\r\n\r\nexport function isSameVNode(oldVNode: VNode, newVNode: VNode): boolean {\r\n return oldVNode.flag === newVNode.flag\r\n}\r\n\r\nexport function getNextSibling(vnode: VNode): HTMLElement | Text | undefined {\r\n switch (vnode.flag) {\r\n case VNODE_TYPE.TEXT:\r\n case VNODE_TYPE.ELEMENT:\r\n case VNODE_TYPE.ARRAYNODE:\r\n case VNODE_TYPE.FRAGMENT:\r\n return vnode.el!\r\n case VNODE_TYPE.ALIVE:\r\n return getNextSibling(vnode.vnode!)\r\n }\r\n}\r\n\r\nexport function patch(oldVNode: VNode, newVNode: VNode, container: HTMLElement, app?: Vact): void {\r\n\r\n // 如果两个节点引用一样不需要判断\r\n if (oldVNode === newVNode) return\r\n\r\n // 这里在判断相同类型的节点后可以做进一步优化\r\n if (isSameVNode(oldVNode, newVNode)) {\r\n let flag = oldVNode.flag = newVNode.flag\r\n\r\n if (flag === VNODE_TYPE.TEXT) {\r\n patchText(oldVNode, newVNode, container)\r\n } else if (flag === VNODE_TYPE.ARRAYNODE) {\r\n if (app?.options.arrayDiff) {\r\n patchArrayNodeT(oldVNode, newVNode, container)\r\n } else {\r\n patchArrayNode(oldVNode, newVNode, container)\r\n }\r\n } else {\r\n const nextSibling = oldVNode?.el?.nextSibling\r\n // const nextSibling = getNextSibling(oldVNode)\r\n unmount(oldVNode, container)\r\n mount(newVNode, container, nextSibling as HTMLElement | undefined)\r\n }\r\n\r\n } else {\r\n const nextSibling = oldVNode?.el?.nextSibling\r\n // const nextSibling = getNextSibling(oldVNode)\r\n unmount(oldVNode, container)\r\n mount(newVNode, container, nextSibling as HTMLElement | undefined)\r\n }\r\n\r\n}\r\n\r\nexport function patchText(oldVNode: VText, newVNode: VText, container: HTMLElement) {\r\n oldVNode.el!.nodeValue = newVNode.children\r\n newVNode.el = oldVNode.el\r\n}\r\n\r\nexport function patchElementProp(oldValue: any, newValue: any, el: HTMLElement, prop: string) {\r\n setElementProp(el, prop, newValue)\r\n}\r\n\r\nexport function patchArrayNodeT(oldVNode: VArrayNode, newVNode: VArrayNode, container: HTMLElement) {\r\n if (!oldVNode.depArray) {\r\n patchArrayNode(oldVNode, newVNode, container)\r\n return\r\n }\r\n\r\n const oldDepArray = oldVNode.depArray\r\n const newDepArray = newVNode.depArray\r\n const oldChildren = oldVNode.children\r\n const newChildren = newVNode.children\r\n\r\n if (!oldDepArray.length || !newDepArray.length) {\r\n patchArrayNode(oldVNode, newVNode, container)\r\n return\r\n }\r\n\r\n newVNode.anchor = oldVNode.anchor\r\n newVNode.el = oldVNode.el\r\n\r\n type NodeInfo = { node: VNode, index: number, used: boolean }\r\n // 为映射做初始化\r\n let map = new Map>()\r\n oldDepArray.forEach((item, index) => {\r\n let arr = map.get(item)\r\n if (!arr) map.set(item, arr = [])\r\n arr.push({ node: oldChildren[index], index, used: false })\r\n })\r\n\r\n let getOld = (item: any) => {\r\n let arr = map.get(item)\r\n if (!arr) return false\r\n\r\n let index = arr.findIndex(alone => !alone.used)\r\n\r\n if (index > -1) return arr[index]\r\n else return false\r\n }\r\n\r\n let moveOld = (item: any, node: NodeInfo) => {\r\n let arr = map.get(item)\r\n if (!arr) return\r\n\r\n let index = arr.findIndex(alone => alone === node)\r\n arr.splice(index, 1)\r\n }\r\n\r\n let maxIndexSoFar = { node: oldChildren[0], index: 0 }\r\n\r\n newDepArray.forEach((item, newIndex) => {\r\n let old = getOld(item)\r\n if (old) {\r\n if (old.index < maxIndexSoFar.index) {\r\n let next: ChildNode | null\r\n if (newIndex > 0) {\r\n next = newChildren[newIndex - 1].el!.nextSibling\r\n } else {\r\n next = maxIndexSoFar.node.el!.nextSibling\r\n }\r\n\r\n VNodeInsertBefore(container, old.node, next)\r\n // container.insertBefore(old.node.el!, next)\r\n } else {\r\n maxIndexSoFar = old\r\n }\r\n\r\n newChildren[newIndex] = old.node\r\n moveOld(item, old)\r\n } else {\r\n // let next = maxIndexSoFar.node.el!.nextSibling\r\n let next: ChildNode | null\r\n if (newIndex > 0) {\r\n next = newChildren[newIndex - 1].el!.nextSibling\r\n } else {\r\n next = maxIndexSoFar.node.el!.nextSibling\r\n }\r\n\r\n let newNode = newChildren[newIndex]\r\n mount(newNode, container, next as HTMLElement | undefined)\r\n // maxIndexSoFar = { node: newNode, index: maxIndexSoFar.index + 1 }\r\n }\r\n })\r\n\r\n\r\n map.forEach(value => {\r\n value.forEach(item => {\r\n if (!item.used) {\r\n unmount(item.node, container)\r\n }\r\n })\r\n })\r\n}\r\n\r\nfunction patchArrayNode(oldVNode: VArrayNode, newVNode: VArrayNode, container: HTMLElement) {\r\n const nextSibling = oldVNode.el.nextSibling\r\n unmount(oldVNode, container)\r\n mount(newVNode, container, nextSibling as HTMLElement | undefined)\r\n}\r\n\r\nfunction VNodeInsertBefore(container: HTMLElement, node: VNode, next: HTMLElement | undefined | Text | ChildNode | null) {\r\n if (node.flag === VNODE_TYPE.ELEMENT || node.flag === VNODE_TYPE.TEXT) {\r\n container.insertBefore(node.el!, next!)\r\n } else if (node.flag === VNODE_TYPE.ARRAYNODE || node.flag === VNODE_TYPE.FRAGMENT) {\r\n let start: ChildNode | null | undefined = node.anchor\r\n let nextToMove = start?.nextSibling\r\n let end: ChildNode | null | undefined = node.el\r\n while (start !== end) {\r\n container.insertBefore(start!, next!)\r\n start = nextToMove\r\n nextToMove = start?.nextSibling\r\n }\r\n container.insertBefore(end!, next!)\r\n }\r\n}","import { patch } from \"./patch\";\r\nimport { watchVNode } from \"../reactive/watch\";\r\nimport { Vact } from \"../vact\";\r\nimport { VAlive } from \"../vnode/alive\";\r\nimport { VArrayNode } from \"../vnode/array\";\r\nimport { VComponent } from \"../vnode/component\";\r\nimport { VElement } from \"../vnode/element\";\r\nimport { VFragment } from \"../vnode/fragment\";\r\nimport { VText } from '../vnode/text'\r\nimport { VNode, VNODE_TYPE } from \"../vnode/vnode\";\r\nimport { mountElement, unmountElement } from \"./element\";\r\n\r\nexport function mount(vnode: VNode, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n switch (vnode.flag) {\r\n case VNODE_TYPE.ELEMENT:\r\n mountElement(vnode as VElement, container, anchor, app)\r\n break\r\n case VNODE_TYPE.TEXT:\r\n mountText(vnode as VText, container, anchor)\r\n break\r\n case VNODE_TYPE.FRAGMENT:\r\n mountFragment(vnode as VFragment, container, anchor, app)\r\n break\r\n case VNODE_TYPE.ARRAYNODE:\r\n mountArrayNode(vnode as VArrayNode, container, anchor, app)\r\n break\r\n // case VNODE_TYPE.COMPONENT:\r\n // mountComponent(vnode as VComponent, container, anchor, app)\r\n // break\r\n case VNODE_TYPE.ALIVE:\r\n mountAlive(vnode as VAlive, container, anchor, app)\r\n break\r\n }\r\n}\r\n\r\nexport function unmount(vnode: VNode, container: HTMLElement) {\r\n switch (vnode.flag) {\r\n case VNODE_TYPE.ELEMENT:\r\n unmountElement(vnode as VElement, container)\r\n break\r\n case VNODE_TYPE.TEXT:\r\n unmountText(vnode as VText, container)\r\n break\r\n case VNODE_TYPE.FRAGMENT:\r\n unmountFragment(vnode as VFragment, container)\r\n break\r\n case VNODE_TYPE.ARRAYNODE:\r\n unmountArrayNode(vnode as VArrayNode, container)\r\n break\r\n // case VNODE_TYPE.COMPONENT:\r\n // unmountComponent(vnode as VComponent, container)\r\n // break\r\n }\r\n}\r\n\r\nexport function mountChildren(children: Array, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n children.forEach(child => mount(child, container, anchor, app))\r\n}\r\n\r\nexport function mountText(vnode: VText, container: HTMLElement, anchor?: HTMLElement) {\r\n const el = document.createTextNode(vnode.children)\r\n vnode.el = el\r\n container.insertBefore(el, anchor!)\r\n}\r\n\r\nexport function unmountText(vnode: VText, container: HTMLElement) {\r\n vnode.el.remove()\r\n}\r\n\r\nexport function mountFragment(vnode: VFragment, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n const start = document.createTextNode('')\r\n const end = document.createTextNode('')\r\n vnode.anchor = start\r\n vnode.el = end\r\n container.insertBefore(start, anchor!)\r\n mountChildren(vnode.children, container, anchor, app)\r\n container.insertBefore(end, anchor!)\r\n}\r\n\r\nexport function unmountFragment(vnode: VFragment, container: HTMLElement) {\r\n const start = vnode.anchor\r\n const end = vnode.el\r\n let cur: ChildNode | null = start\r\n while (cur && cur !== end) {\r\n let next: ChildNode | null = cur.nextSibling\r\n cur.remove()\r\n cur = next\r\n }\r\n end.remove()\r\n}\r\n\r\nexport function mountArrayNode(vnode: VArrayNode, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n const start = document.createTextNode('')\r\n const end = document.createTextNode('')\r\n vnode.anchor = start\r\n vnode.el = end\r\n container.insertBefore(start, anchor!)\r\n mountChildren(vnode.children, container, anchor, app)\r\n container.insertBefore(end, anchor!)\r\n}\r\n\r\nexport function unmountArrayNode(vnode: VArrayNode, container: HTMLElement, anchor?: HTMLElement) {\r\n const start = vnode.anchor\r\n const end = vnode.el\r\n let cur: ChildNode | null = start\r\n while (cur && cur !== end) {\r\n let next: ChildNode | null = cur.nextSibling\r\n cur.remove()\r\n cur = next\r\n }\r\n end.remove()\r\n}\r\n\r\n// export function mountComponent(vnode: VComponent, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n// console.log(1111);\r\n\r\n// const root = vnode.type.render(render)\r\n// vnode.root = root\r\n// mount(root, container, anchor, app)\r\n// vnode.el = root.el!\r\n// }\r\n\r\n// export function unmountComponent(vnode: VComponent, container: HTMLElement) {\r\n// unmount(vnode.root, container)\r\n// }\r\n\r\nexport function mountAlive(vnode: VAlive, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n let firstVNode = watchVNode(vnode, (oldVNode, newVNode) => patch(oldVNode, newVNode, container, app))\r\n vnode.vnode = firstVNode\r\n mount(firstVNode, container, anchor, app)\r\n}","import { defineState } from \"./reactive\"\r\nimport { H } from './render'\r\nimport { VNode } from \"./vnode/vnode\"\r\n\r\n/**\r\n * 根类组件(向下兼容)\r\n * 已废弃\r\n*/\r\n\r\ninterface Config {\r\n data?: Record\r\n}\r\n\r\nexport abstract class Component {\r\n // 组件配置\r\n private config: Config\r\n // 组件响应式数据\r\n public data: Record\r\n // 组件属性\r\n props?: Record\r\n // 组件子元素\r\n children?: Record\r\n\r\n constructor(config: Config = {}) {\r\n this.config = config\r\n this.data = defineState(config.data || {})\r\n }\r\n\r\n abstract render(h: H): VNode\r\n}","import { mount } from \"./mount/mount\";\r\nimport { defineState, state } from \"./reactive\";\r\nimport { RefImpl } from \"./reactive/ref\";\r\nimport { render } from \"./render\";\r\nimport { VNode } from \"./vnode/vnode\";\r\nimport { H } from './render'\r\n\r\nexport interface Options {\r\n arrayDiff?: boolean\r\n}\r\n\r\nexport interface VactUtils {\r\n state(value: T): RefImpl\r\n defineState>(target: T): T\r\n h: H\r\n}\r\n\r\nexport interface VactPlugin {\r\n install(utils: VactUtils): void\r\n}\r\n\r\nexport class Vact {\r\n rootVNode: VNode\r\n options: Options\r\n\r\n constructor(vnode: VNode, options?: Options) {\r\n this.rootVNode = vnode\r\n this.options = options || {}\r\n }\r\n\r\n mount(selector: string): void {\r\n const el = document.querySelector(selector)\r\n let container = document.createElement('div')\r\n mount(this.rootVNode, container, undefined, this)\r\n el?.replaceWith(...container.childNodes)\r\n }\r\n\r\n use(plugin: VactPlugin) {\r\n const utils: VactUtils = { state, defineState, h: render }\r\n plugin.install(utils)\r\n return this\r\n }\r\n}\r\n\r\nexport function createApp(vnode: VNode, options?: Options): Vact {\r\n return new Vact(vnode, options)\r\n}\r\n\r\n"],"names":[],"mappings":";;;;;;EAGA;;EAEE;EACF,IAAY,UASX,CAAA;EATD,CAAA,UAAY,UAAU,EAAA;;EAEpB,IAAA,UAAA,CAAA,UAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAO,CAAA;;EAEP,IAAA,UAAA,CAAA,UAAA,CAAA,MAAA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AAC,aAAa,CAAC,KAAK,CAAC,CAAA;UAC7C,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;EACjD,QAAA,EAAE,KAAF,IAAA,IAAA,EAAE,KAAF,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAE,CAAE,WAAW,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,CAAA;OACzC;EAED,IAAA,GAAG,CAAC,MAAkB,EAAA;UACpB,MAAM,KAAK,GAAc,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,CAAA;EAC1D,QAAA,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;EACrB,QAAA,OAAO,IAAI,CAAA;OACZ;EACF,CAAA;EAEe,SAAA,SAAS,CAAC,KAAY,EAAE,OAAiB,EAAA;EACvD,IAAA,OAAO,IAAI,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;EACjC;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"boundle.umd.js","sources":["../src/vnode/text.ts","../src/vnode/fragment.ts","../src/vnode/component.ts","../src/vnode/array.ts","../src/vnode/alive.ts","../src/vnode/vnode.ts","../src/utils.ts","../src/reactive/update.ts","../src/reactive/reactive.ts","../src/reactive/ref.ts","../src/reactive/utils.ts","../src/reactive/active.ts","../src/lifeCycle.ts","../src/plugin.ts","../src/render.ts","../src/reactive/watch.ts","../src/mount/element.ts","../src/mount/patch.ts","../src/mount/mount.ts","../src/component.ts","../src/app.ts"],"sourcesContent":["import {VNode, VNODE_TYPE, VNodeElement} from \"./vnode\";\r\n\r\n\r\nexport const TextSymbol = Symbol('Text');\r\nexport interface VText extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n\r\n // 虚拟节点子节点\r\n children: string,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.TEXT\r\n\r\n el: Text\r\n\r\n}\r\n","import {VNode, VNODE_TYPE, VNodeElement} from \"./vnode\";\r\n\r\nexport const FragmentSymbol = Symbol('Fragment');\r\nexport interface VFragment extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n\r\n // 虚拟节点子节点\r\n children: Array,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.FRAGMENT\r\n\r\n // 锚点\r\n anchor: Text,\r\n el: Text\r\n\r\n}\r\n","import {VNode, VNODE_TYPE, OriginVNode, VNodeProps} from \"./vnode\";\r\nimport { ComponentLifeCycle } from '../lifeCycle'\r\nimport { ComponentInstance } from '../component'\r\nimport {AppUtils} from '../plugin'\r\n\r\nexport interface ComponentContext {\r\n props: Record\r\n children: Array\r\n life: ComponentLifeCycle\r\n utils: AppUtils\r\n}\r\n\r\n/** 函数组件类型 */\r\nexport interface FunctionComponentType {\r\n (context: ComponentContext): OriginVNode\r\n}\r\n\r\n/** 类组件类型 */\r\nexport interface ClassComponentType {\r\n new (props: Record, children: Array): ComponentInstance\r\n}\r\n\r\nexport type ComponentType = FunctionComponentType | ClassComponentType\r\n\r\nexport const VComponentSymbol = Symbol('VComponent')\r\nexport type VComponentType = typeof VComponentSymbol\r\n\r\nexport interface VComponent extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: VComponentType,\r\n\r\n // 虚拟节点属性\r\n props: VNodeProps,\r\n\r\n // 虚拟节点子节点\r\n children: Array,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.COMPONENT\r\n\r\n root: VNode,\r\n\r\n lifeStyleInstance: ComponentLifeCycle\r\n\r\n}\r\n\r\n","import {VNode, VNODE_TYPE, VNodeElement} from \"./vnode\";\r\n\r\nexport const ArraySymbol = Symbol('ArrayNode');\r\nexport type VArrayType = typeof ArraySymbol\r\nexport interface VArrayNode extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n\r\n // 虚拟节点子节点\r\n children: Array,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.ARRAYNODE\r\n\r\n // 锚点\r\n anchor: Text,\r\n el: Text,\r\n\r\n // 记录当前数组节点依赖的响应式数组\r\n depArray: Array\r\n}\r\n","import { Activer } from \"../reactive\"\r\nimport { VNode, VNODE_TYPE, OriginVNode } from \"./vnode\"\r\n\r\nexport const AliveSymbol = Symbol('Alive')\r\nexport type VAliveType = typeof AliveSymbol\r\nexport interface VAlive extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.ELEMENT\r\n\r\n activer: Activer\r\n // 目前存在的节点\r\n vnode: VNode\r\n}\r\n","import { Activer } from \"../reactive\"\r\nimport { ComponentType } from './component'\r\n\r\n/**\r\n * 虚拟dom节点类型枚举\r\n*/\r\nexport enum VNODE_TYPE {\r\n // 普通元素节点类型\r\n ELEMENT,\r\n // 文本节点类型\r\n TEXT,\r\n FRAGMENT,\r\n COMPONENT,\r\n ARRAYNODE,\r\n ALIVE\r\n}\r\n\r\nexport type VNodeElement = ChildNode\r\n\r\n/**\r\n * 虚拟dom接口类型\r\n*/\r\nexport interface VNode {\r\n\r\n // 虚拟节点类型\r\n type: string | symbol | ComponentType,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE\r\n\r\n // 虚拟节点属性\r\n props?: Record,\r\n\r\n // 虚拟节点子节点\r\n children?: Array | string,\r\n\r\n // 真实节点\r\n el?: VNodeElement\r\n anchor?: VNodeElement\r\n\r\n activer?: Activer\r\n // 目前存在的节点\r\n vnode?: VNode\r\n\r\n}\r\n\r\n// 未经过标准化的childVNode类型\r\nexport type NotFunctionOriginVNode= string | VNode | Array | Activer\r\nexport type WithFunctionOriginVNode= (() => OriginVNode) | NotFunctionOriginVNode\r\nexport type OriginVNode= WithFunctionOriginVNode | Exclude\r\n\r\n/** 虚拟节点属性 todo */\r\nexport interface VNodeProps {\r\n [propName: string]: any\r\n}\r\n\r\n","import { VNode, VNODE_TYPE } from './vnode'\r\nimport { Activer } from './reactive'\r\nimport { FragmentSymbol, TextSymbol, ArraySymbol } from './vnode'\r\n\r\nexport function isString(content: unknown): content is string {\r\n return typeof content === 'string'\r\n}\r\n\r\nexport function isFunction(content: unknown): content is Function {\r\n return typeof content === 'function'\r\n}\r\n\r\nexport function isFragment(content: unknown): boolean {\r\n return content === FragmentSymbol\r\n}\r\n\r\nexport function isArrayNode(content: unknown): boolean {\r\n return content === ArraySymbol\r\n}\r\n\r\nexport function isText(content: unknown): boolean {\r\n return content === TextSymbol\r\n}\r\n\r\nexport function isActiver(content: unknown): content is Activer {\r\n return isObject(content) && (content as Record).flag === 'activer'\r\n}\r\n\r\nexport function isVNode(content: unknown): content is VNode {\r\n return isObject(content) && (content as Record).flag in VNODE_TYPE\r\n}\r\n\r\nexport function isObjectExact(content: unknown): content is Object {\r\n return isObject(content) && content.constructor === Object\r\n}\r\n\r\nexport function isOnEvent(str: string): boolean {\r\n return /^on.+$/.test(str)\r\n}\r\n\r\nexport function isObject(content: unknown): content is object {\r\n return typeof content === 'object' && content !== null\r\n}\r\n\r\n\r\nexport function isArray(content: unknown): content is Array {\r\n return Array.isArray(content)\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n","import { Watcher } from \"./watch\";\r\n\r\nlet updating = false\r\nconst watcherTask: Array = []\r\n\r\nexport function runUpdate(watcher: Watcher) {\r\n let index: number = watcherTask.indexOf(watcher)\r\n if (!(index > -1)) watcherTask.push(watcher)\r\n if (!updating) {\r\n updating = true\r\n Promise.resolve()\r\n .then(() => {\r\n let watcher: Watcher | undefined = undefined\r\n while (watcher = watcherTask.shift()) {\r\n watcher.update()\r\n }\r\n }).finally(() => {\r\n updating = false\r\n })\r\n }\r\n}","import { isArray, isObjectExact, isVNode } from \"../utils\"\r\nimport { Watcher } from \"./watch\"\r\nimport { runUpdate } from './update'\r\n\r\n// 目标对象到映射对象\r\nconst targetMap = new WeakMap()\r\n// 全局变量watcher\r\nlet activeWatcher: Watcher | null = null\r\nconst REACTIVE = Symbol('reactive')\r\n\r\n/**\r\n * 实现响应式对象\r\n*/\r\nexport function reactive>(target: T): T {\r\n if (target[REACTIVE]) return target\r\n\r\n let handler: ProxyHandler = {\r\n get(target, prop, receiver) {\r\n if (prop === REACTIVE) return true\r\n const res = Reflect.get(target, prop, receiver)\r\n\r\n if (isObjectExact(res) && !isVNode(res)) {\r\n return reactive(res)\r\n }\r\n\r\n if (Array.isArray(res)) {\r\n track(target, prop)\r\n return reactiveArray(res, target, prop)\r\n }\r\n\r\n track(target, prop)\r\n return res\r\n },\r\n\r\n set(target, prop, value, receiver) {\r\n const res = Reflect.set(target, prop, value, receiver)\r\n trigger(target, prop)\r\n return res\r\n }\r\n }\r\n\r\n return new Proxy(target, handler)\r\n}\r\n\r\n/**\r\n * 设置响应式数组\r\n*/\r\nfunction reactiveArray(targetArr: Array, targetObj: Record, Arrprop: string | symbol) {\r\n let handler: ProxyHandler> = {\r\n get(target, prop, receiver) {\r\n const res = Reflect.get(target, prop, receiver)\r\n\r\n if (isObjectExact(res)) {\r\n return reactive(res)\r\n }\r\n\r\n return res\r\n },\r\n set(target, prop, value, receiver) {\r\n const res = Reflect.set(target, prop, value, receiver)\r\n trigger(targetObj, Arrprop)\r\n return res\r\n }\r\n }\r\n\r\n return new Proxy(targetArr, handler)\r\n}\r\n\r\n/**\r\n * 响应触发依赖\r\n*/\r\nexport function trigger(target: Record, prop: string | symbol) {\r\n let mapping: Record> = targetMap.get(target)\r\n if (!mapping) return\r\n\r\n let mappingProp: Array = mapping[prop]\r\n if (!mappingProp) return\r\n\r\n // mappingProp.forEach(watcher => watcher.update(oldValue, newValue))\r\n mappingProp.forEach(watcher => {\r\n // 针对于对数组响应做特殊处理\r\n if (isArray(target[prop])) {\r\n watcher.nextDepArr = target[prop]\r\n }\r\n runUpdate(watcher)\r\n })\r\n}\r\n\r\n/**\r\n * 追踪绑定依赖\r\n*/\r\nexport function track(target: Record, prop: string | symbol) {\r\n if (!activeWatcher) return\r\n\r\n let mapping: Record> = targetMap.get(target)\r\n if (!mapping) targetMap.set(target, mapping = {})\r\n\r\n let mappingProp: Array = mapping[prop]\r\n if (!mappingProp) mappingProp = mapping[prop] = []\r\n\r\n // 针对于对数组响应做特殊处理\r\n if (isArray(target[prop])) {\r\n if (activeWatcher.depArr) {\r\n activeWatcher.depArr = false\r\n } else {\r\n if (activeWatcher.depArr === undefined) {\r\n activeWatcher.depArr = target[prop].slice()\r\n }\r\n }\r\n }\r\n\r\n mappingProp.push(activeWatcher)\r\n}\r\n\r\n// 设置全局变量\r\nexport function setActiver(fn: Watcher | null) {\r\n activeWatcher = fn\r\n}\r\n// 设置全局变量\r\nexport function getActiver(): Watcher | null {\r\n return activeWatcher\r\n}\r\n\r\n","import { track, trigger } from './reactive'\r\n\r\nexport class RefImpl {\r\n private _value: T\r\n private readonly _target: Record\r\n\r\n constructor(value: T) {\r\n this._value = value\r\n this._target = { value: this._value }\r\n }\r\n\r\n get value() {\r\n track(this._target, 'value')\r\n return this._value\r\n }\r\n\r\n set value(value) {\r\n this._value = value\r\n this._target.value = this._value\r\n trigger(this._target, 'value')\r\n }\r\n}\r\n\r\n\r\nexport function ref(value: T): RefImpl {\r\n return new RefImpl(value)\r\n}","import { ref } from './ref'\r\nimport { reactive } from './reactive'\r\n\r\n\r\nexport function state(value: T) {\r\n return ref(value)\r\n}\r\n\r\nexport function defineState>(target: T): T {\r\n return reactive(target)\r\n}\r\n\r\n\r\n\r\n\r\n\r\n","\r\n/**\r\n * 响应式对象\r\n*/\r\nexport class Activer {\r\n callback: () => T\r\n flag: string = 'activer'\r\n\r\n constructor(fn: () => T) {\r\n this.callback = fn\r\n }\r\n\r\n get value(): T {\r\n return this.callback()\r\n }\r\n}\r\n\r\n/**\r\n * 外置函数\r\n*/\r\nexport function active(fn: () => T): Activer {\r\n return new Activer(fn)\r\n}\r\n\r\n","import { ComponentInstance } from './component'\r\n\r\n/**\r\n * 主要实现关于组件的生命周期\r\n */\r\n\r\n\r\nexport interface ComponentLifeCycleInstance {\r\n\r\n /** 组件示例创建之后触发 */\r\n created(fn: () => void): void\r\n\r\n /** 组件示例在渲染之前触发(DOM还没有生成) */\r\n beforeMounted(fn: () => void): void\r\n\r\n /** dom已经生成到js内存但还没挂载 */\r\n readyMounted(fn: () => void): void\r\n\r\n /** dom挂载到了页面上*/\r\n mounted(fn: () => void): void\r\n\r\n /** 卸载之前触发 */\r\n beforeUnMounted(fn: () => void):void\r\n\r\n /** 卸载之后触发 */\r\n unMounted(fn: () => void):void\r\n}\r\n\r\ntype LifeCycleNames = T extends string ? `${T}List` : never\r\ntype GetCycleName = T extends `${infer U}List` ? U : never\r\n\r\n\r\n\r\nexport class ComponentLifeCycle implements ComponentLifeCycleInstance {\r\n\r\n\r\n constructor(\r\n private readonly createdList: Array<() => void> = [],\r\n private readonly beforeMountedList: Array<() => void> = [],\r\n private readonly readyMountedList: Array<() => void> = [],\r\n private readonly mountedList: Array<() => void> = [],\r\n private readonly beforeUnMountedList: Array<() => void> = [],\r\n private readonly unMountedList: Array<() => void> = []\r\n ) {\r\n // this.createdList = []\r\n // this.beforeMountedList = []\r\n // this.readyMountedList = []\r\n // this.mountedList = []\r\n // this.beforeUnMountedList = []\r\n // this.unMountedList = []\r\n }\r\n\r\n created(fn: () => void): void {\r\n this.createdList.push(fn)\r\n }\r\n\r\n beforeMounted(fn: () => void): void {\r\n this.beforeMountedList.push(fn)\r\n }\r\n\r\n readyMounted(fn: () => void): void {\r\n this.readyMountedList.push(fn)\r\n }\r\n\r\n mounted(fn: () => void): void {\r\n this.mountedList.push(fn)\r\n }\r\n\r\n beforeUnMounted(fn: () => void): void {\r\n this.beforeUnMountedList.push(fn)\r\n }\r\n\r\n unMounted(fn: () => void): void {\r\n this.unMountedList.push(fn)\r\n }\r\n\r\n emit(lifeName: keyof ComponentLifeCycleInstance) {\r\n this[`${lifeName}List`].forEach(fn => fn())\r\n }\r\n\r\n}\r\n\r\n// 生成类组件生命周期实例\r\nexport function createClassComponentLife(component: ComponentInstance) {\r\n let lifeNames: [\r\n 'created',\r\n 'beforeMounted',\r\n 'readyMounted',\r\n 'mounted',\r\n 'beforeUnMounted',\r\n 'unMounted'\r\n ] = ['created', 'beforeMounted', 'readyMounted', 'mounted', 'beforeUnMounted', 'unMounted']\r\n\r\n let lifeCycle = new ComponentLifeCycle()\r\n component.life = lifeCycle\r\n\r\n lifeNames.forEach(lifeName => {\r\n let fn = component[lifeName]\r\n if(!fn) return\r\n lifeCycle[lifeName](fn.bind(component))\r\n })\r\n\r\n return lifeCycle\r\n}\r\n\r\n\r\n","import {\r\n state,\r\n defineState,\r\n watch\r\n} from \"./reactive\";\r\nimport { renderApi as h } from \"./render\";\r\n\r\n// todo\r\n\r\n// 实现插件功能\r\n\r\nexport interface AppUtils {\r\n state: typeof state\r\n defineState: typeof defineState\r\n h: typeof h\r\n watch: typeof watch\r\n}\r\n\r\nexport interface AppContext {\r\n utils: AppUtils\r\n}\r\n\r\nexport interface AppPlugin {\r\n install(utils: AppContext): void\r\n}\r\n\r\n// 给插件提供的能力\r\nexport const appUtils: AppUtils = {\r\n state,\r\n defineState,\r\n h,\r\n watch\r\n}\r\n","import {active} from \"./reactive\";\r\nimport {Activer} from './reactive'\r\nimport {\r\n isActiver,\r\n isArray,\r\n isArrayNode,\r\n isFragment,\r\n isFunction,\r\n isOnEvent,\r\n isString,\r\n isText,\r\n isVNode} from \"./utils\";\r\nimport {\r\n ClassComponentType,\r\n ComponentType,\r\n FunctionComponentType,\r\n VComponent\r\n} from \"./vnode\";\r\nimport {\r\n OriginVNode,\r\n VNode,\r\n VNODE_TYPE,\r\n VNodeProps\r\n} from \"./vnode\";\r\nimport {\r\n ArraySymbol,\r\n AliveSymbol,\r\n TextSymbol,\r\n FragmentSymbol,\r\n VComponentSymbol\r\n} from \"./vnode\";\r\nimport {ComponentLifeCycle, createClassComponentLife} from \"./lifeCycle\";\r\nimport {appUtils} from \"./plugin\";\r\n\r\n/**\r\n * 传说中的render函数\r\n*/\r\n\r\nexport type HSymbol = typeof TextSymbol | typeof FragmentSymbol | typeof AliveSymbol | typeof ArraySymbol\r\nexport type HType = string | HSymbol | ComponentType\r\nexport type H = (type: HType, props?: VNodeProps, children?: OriginVNode | Array) => VNode\r\n\r\n/**\r\n * 函数转化为activer转化为VAlive\r\n * activer转化为VAlive\r\n * string转化为VText\r\n * 数组转化为VArray\r\n * 其他转化为VText\r\n*/\r\nexport function createVNode(originVNode: OriginVNode): VNode {\r\n if (isVNode(originVNode)) return originVNode\r\n\r\n if (isFunction(originVNode)) return renderAlive(active(originVNode))\r\n else if (isActiver(originVNode)) return renderAlive(originVNode)\r\n else if (isString(originVNode)) return renderText(originVNode)\r\n else if (isArray(originVNode)) return renderArrayNode(originVNode.map(item => createVNode(item)))\r\n else {\r\n // todo\r\n let value = originVNode\r\n let retText: VNode\r\n if (!value && typeof value !== 'number') retText = renderText('')\r\n else retText = renderText(String(value))\r\n return retText\r\n }\r\n}\r\n\r\n\r\n/**\r\n * text(不需要props)、fragment(不需要props)、element、component为显性创建\r\n * array(不需要props)、alive(不需要props)为隐形创建\r\n*/\r\nexport function renderApi(type: HType, props?: VNodeProps | null, children?: OriginVNode | Array): VNode {\r\n return render(type, props || undefined, children)\r\n}\r\n\r\nexport function render(type: HType, originProps?: VNodeProps, originChildren?: OriginVNode | Array): VNode {\r\n // text的children比较特殊先处理\r\n if (isText(type)) {\r\n return renderText(String(originChildren))\r\n }\r\n\r\n // 预处理 处理为单个的children\r\n let originChildrenList: Array = []\r\n if (isArray(originChildren)) originChildrenList.push(...originChildren)\r\n else originChildrenList.push(originChildren)\r\n // 创建VNode列表\r\n let vNodeChildren: Array = originChildrenList.map(originChild => createVNode(originChild))\r\n\r\n // 属性预处理\r\n let props: VNodeProps = originProps || {}\r\n handleProps(props)\r\n\r\n if (isString(type)) return renderElement(type, props , vNodeChildren)\r\n if (isFragment(type)) return renderFragment(vNodeChildren)\r\n if (isArrayNode(type)) return renderArrayNode(vNodeChildren)\r\n if (isFunction(type)) return renderComponent(type, props, vNodeChildren)\r\n throw '传入参数不合法'\r\n}\r\n\r\n\r\n/**\r\n * 对属性进行预处理\r\n */\r\nfunction handleProps(originProps: VNodeProps): VNodeProps {\r\n for (const prop in originProps) {\r\n // 以on开头的事件不需要处理\r\n if (\r\n !isOnEvent(prop) &&\r\n isFunction(originProps[prop])\r\n ) {\r\n // 如不为on且为函数则判断为响应式\r\n originProps[prop] = active(originProps[prop])\r\n }\r\n }\r\n\r\n return originProps\r\n}\r\n\r\nfunction renderText(text: string): VNode {\r\n return {\r\n type: TextSymbol,\r\n flag: VNODE_TYPE.TEXT,\r\n children: text\r\n }\r\n}\r\n\r\nfunction renderElement(tag: string, props: Record, children: Array): VNode {\r\n return {\r\n type: tag,\r\n flag: VNODE_TYPE.ELEMENT,\r\n props,\r\n children\r\n }\r\n}\r\n\r\nfunction renderFragment(children: Array): VNode {\r\n return {\r\n type: FragmentSymbol,\r\n flag: VNODE_TYPE.FRAGMENT,\r\n children\r\n }\r\n}\r\n\r\nfunction renderArrayNode(children: Array): VNode {\r\n return {\r\n type: ArraySymbol,\r\n flag: VNODE_TYPE.ARRAYNODE,\r\n children\r\n }\r\n}\r\n\r\nfunction createComponentProps(props: VNodeProps): VNodeProps {\r\n let componentProps:VNodeProps = {}\r\n for (const prop in props) {\r\n let curProp = props[prop]\r\n if (isActiver(curProp)) {\r\n Object.defineProperty(componentProps, prop, {\r\n get() {\r\n return (curProp as Activer).value\r\n }\r\n })\r\n } else {\r\n componentProps[prop] = curProp\r\n }\r\n }\r\n\r\n return componentProps\r\n}\r\n\r\n// 渲染一个活跃的节点\r\nfunction renderAlive(activer: Activer): VNode {\r\n return {\r\n type: AliveSymbol,\r\n flag: VNODE_TYPE.ALIVE,\r\n activer\r\n }\r\n}\r\n\r\n// 判断是普通函数还是构造函数\r\nfunction renderComponent(component: ComponentType, props: VNodeProps, children: Array): VComponent {\r\n let componentProps = createComponentProps(props)\r\n\r\n if (\r\n component.prototype &&\r\n component.prototype.render &&\r\n isFunction(component.prototype.render)\r\n ) {\r\n let ClassComponent = component as ClassComponentType\r\n let result = new ClassComponent(componentProps, children)\r\n\r\n result.props = componentProps\r\n result.children = children\r\n\r\n let lifeCycle = createClassComponentLife(result)\r\n\r\n let vn = result.render(renderApi)\r\n lifeCycle.emit('created')\r\n let vc: VComponent = {\r\n type: VComponentSymbol,\r\n root: createVNode(vn),\r\n props: componentProps,\r\n children: children,\r\n flag: VNODE_TYPE.COMPONENT,\r\n lifeStyleInstance: lifeCycle\r\n }\r\n\r\n lifeCycle.emit('beforeMounted')\r\n\r\n return vc\r\n } else {\r\n let FunctionComponent = component as FunctionComponentType\r\n let lifeCycle = new ComponentLifeCycle()\r\n let vn = FunctionComponent({props: componentProps, children: children, life: lifeCycle, utils: appUtils})\r\n lifeCycle.emit('created')\r\n let vc: VComponent = {\r\n type: VComponentSymbol,\r\n root: createVNode(vn),\r\n props: componentProps,\r\n children: children,\r\n flag: VNODE_TYPE.COMPONENT,\r\n lifeStyleInstance: lifeCycle\r\n }\r\n\r\n lifeCycle.emit('beforeMounted')\r\n return vc\r\n }\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n","import { setActiver } from \"./reactive\"\r\nimport { active, Activer } from './active'\r\nimport { VNode, VNODE_TYPE, OriginVNode } from \"../vnode\"\r\nimport { isActiver } from \"../utils\"\r\nimport { createVNode } from \"../render\"\r\nimport { VArrayNode } from \"../vnode\"\r\nimport { VAlive } from \"../vnode\"\r\n\r\ntype Meta = {\r\n targetPropOldValue: any,\r\n targetPropnewValue: any\r\n}\r\n\r\n/**\r\n * 观察者\r\n * 观察数据的变化\r\n*/\r\nexport class Watcher {\r\n value: T\r\n callback: (oldValue: T, newValue: T, meta?: Meta) => void\r\n activeProps: Activer\r\n depArr?: Array | false\r\n nextDepArr?: Array\r\n\r\n constructor(activeProps: Activer, callback: (oldValue: T, newValue: T, meta?: Meta) => void) {\r\n setActiver(this)\r\n this.value = activeProps.value\r\n this.callback = callback\r\n this.activeProps = activeProps\r\n setActiver(null)\r\n }\r\n\r\n update() {\r\n let newValue = this.activeProps.value\r\n let oldValue = this.value\r\n this.value = newValue\r\n let meta = { targetPropOldValue: this.depArr, targetPropnewValue: this.nextDepArr }\r\n this.callback(oldValue, newValue, meta)\r\n this.depArr = this.nextDepArr?.slice()\r\n }\r\n}\r\n\r\n\r\n/**\r\n * 监控自定义响应式属性\r\n*/\r\nexport function watch(activeProps: (() => T) | Activer, callback: (oldValue: T, newValue: T) => void): Watcher {\r\n if (!isActiver(activeProps)) activeProps = active(activeProps)\r\n return new Watcher(activeProps, function (oldValue: T, newValue: T) {\r\n callback(oldValue, newValue)\r\n })\r\n}\r\n\r\n/**\r\n * 监控可变状态dom\r\n*/\r\nexport function watchVNode(activeVNode: VAlive, callback: (oldVNode: VNode, newVNode: VNode) => void): VNode {\r\n let watcher = new Watcher(activeVNode.activer, function (oldValue: OriginVNode, newValue: OriginVNode, meta) {\r\n const oldVNode = oldValue as VNode\r\n const newVNode = createVNode(newValue)\r\n\r\n // 对于数组节点后期需要记录它的响应式数组用于节点更新\r\n if (oldVNode.flag === VNODE_TYPE.ARRAYNODE) {\r\n (oldVNode).depArray = meta?.targetPropOldValue\r\n }\r\n // 对于数组节点后期需要记录它的响应式数组用于节点更新\r\n if (newVNode.flag === VNODE_TYPE.ARRAYNODE) {\r\n (newVNode).depArray = meta?.targetPropnewValue\r\n }\r\n\r\n callback(oldVNode, newVNode)\r\n watcher.value = newVNode\r\n activeVNode.vnode = newVNode\r\n })\r\n\r\n return watcher.value = createVNode(watcher.value)\r\n}\r\n\r\n\r\n/**\r\n * 监控可变dom的prop\r\n*/\r\nexport function watchProp(activeProp: Activer, callback: (oldVNode: VNode, newVNode: VNode) => void): any {\r\n return new Watcher(activeProp, callback).value\r\n}\r\n","import { App } from \"../app\"\r\nimport { watchProp } from \"../reactive\"\r\nimport { isActiver, isOnEvent, isFunction, isObject } from \"../utils\"\r\nimport {VElement, VNodeElement} from \"../vnode\"\r\nimport { mountChildren } from \"./mount\"\r\nimport { patchElementProp } from \"./patch\"\r\n\r\n\r\n\r\nexport function mountElement(vnode: VElement, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n const el = document.createElement(vnode.type)\r\n vnode.el = el\r\n mountElementProps(vnode)\r\n mountChildren(vnode.children, el, undefined, app)\r\n container.insertBefore(el, anchor!)\r\n}\r\n\r\nexport function unmountElement(vnode: VElement, container: HTMLElement) {\r\n vnode.el.remove()\r\n}\r\n\r\nexport function mountElementProps(vnode: VElement) {\r\n let el = vnode.el\r\n let props = vnode.props\r\n\r\n // 处理标签属性\r\n for (let prop in props) {\r\n let value = props[prop]\r\n if (isActiver(value)) {\r\n let firstValue = watchProp(value, (oldValue, newValue) => patchElementProp(oldValue, newValue, el, prop))\r\n setElementProp(el, prop, firstValue)\r\n } else {\r\n setElementProp(el, prop, value)\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * 处理单个dom属性\r\n*/\r\nexport function setElementProp(el: HTMLElement, prop: string, value: any) {\r\n if (isOnEvent(prop) && isFunction(value)) {\r\n let pattern = /^on(.+)$/\r\n let result = prop.match(pattern)\r\n result && el.addEventListener(result[1].toLocaleLowerCase(), value.bind(el))\r\n return\r\n }\r\n\r\n switch (prop) {\r\n case 'className':\r\n el.className = String(value)\r\n break\r\n case 'style':\r\n if (isObject(value)) {\r\n value = mergeStyle(value)\r\n }\r\n default:\r\n el.setAttribute(prop, value)\r\n }\r\n}\r\n\r\n/**\r\n * 将对象形式的style转化为字符串\r\n*/\r\nexport function mergeStyle(style: Record): string {\r\n let styleStringList = []\r\n for (let cssAttr in style) {\r\n styleStringList.push(`${cssAttr}:${style[cssAttr]};`)\r\n }\r\n return styleStringList.join('')\r\n}\r\n","import {mount, unmount} from \"./mount\";\r\nimport { App } from \"../app\";\r\nimport {VArrayNode} from \"../vnode\";\r\nimport {VText} from \"../vnode\";\r\nimport {VNode, VNODE_TYPE} from \"../vnode\";\r\nimport {setElementProp} from \"./element\";\r\nimport {VComponent} from \"../vnode\";\r\n\r\nexport function isSameVNode(oldVNode: VNode, newVNode: VNode): boolean {\r\n return oldVNode.flag === newVNode.flag\r\n}\r\n\r\n// todo\r\nexport function getNextSibling(vNode: VNode): ChildNode | null {\r\n switch (vNode.flag) {\r\n case VNODE_TYPE.TEXT:\r\n case VNODE_TYPE.ELEMENT:\r\n case VNODE_TYPE.ARRAYNODE:\r\n case VNODE_TYPE.FRAGMENT:\r\n return vNode.el!.nextSibling\r\n case VNODE_TYPE.COMPONENT:\r\n return (vNode as VComponent).root.el!.nextSibling\r\n case VNODE_TYPE.ALIVE:\r\n return getNextSibling(vNode.vnode!)\r\n }\r\n}\r\n\r\nexport function patch(oldVNode: VNode, newVNode: VNode, container: HTMLElement, app?: App): void {\r\n\r\n // 如果两个节点引用一样不需要判断\r\n if (oldVNode === newVNode) return\r\n\r\n // 这里在判断相同类型的节点后可以做进一步优化\r\n if (isSameVNode(oldVNode, newVNode)) {\r\n let flag = oldVNode.flag = newVNode.flag\r\n\r\n if (flag === VNODE_TYPE.TEXT) {\r\n patchText(oldVNode, newVNode, container)\r\n } else if (flag === VNODE_TYPE.ARRAYNODE) {\r\n if (app?.options.arrayDiff) {\r\n patchArrayNodeT(oldVNode, newVNode, container)\r\n } else {\r\n patchArrayNode(oldVNode, newVNode, container)\r\n }\r\n } else {\r\n // const nextSibling = oldVNode?.el?.nextSibling\r\n const nextSibling = getNextSibling(oldVNode)\r\n unmount(oldVNode, container)\r\n mount(newVNode, container, nextSibling as ChildNode | undefined)\r\n }\r\n\r\n } else {\r\n // const nextSibling = oldVNode?.el?.nextSibling\r\n const nextSibling = getNextSibling(oldVNode)\r\n unmount(oldVNode, container)\r\n mount(newVNode, container, nextSibling as ChildNode | undefined)\r\n }\r\n\r\n}\r\n\r\nexport function patchText(oldVNode: VText, newVNode: VText, container: HTMLElement) {\r\n oldVNode.el!.nodeValue = newVNode.children\r\n newVNode.el = oldVNode.el\r\n}\r\n\r\nexport function patchElementProp(oldValue: any, newValue: any, el: HTMLElement, prop: string) {\r\n setElementProp(el, prop, newValue)\r\n}\r\n\r\nexport function patchArrayNodeT(oldVNode: VArrayNode, newVNode: VArrayNode, container: HTMLElement) {\r\n if (!oldVNode.depArray) {\r\n patchArrayNode(oldVNode, newVNode, container)\r\n return\r\n }\r\n\r\n const oldDepArray = oldVNode.depArray\r\n const newDepArray = newVNode.depArray\r\n const oldChildren = oldVNode.children\r\n const newChildren = newVNode.children\r\n\r\n if (!oldDepArray.length || !newDepArray.length) {\r\n patchArrayNode(oldVNode, newVNode, container)\r\n return\r\n }\r\n\r\n newVNode.anchor = oldVNode.anchor\r\n newVNode.el = oldVNode.el\r\n\r\n type NodeInfo = { node: VNode, index: number, used: boolean }\r\n // 为映射做初始化\r\n let map = new Map>()\r\n oldDepArray.forEach((item, index) => {\r\n let arr = map.get(item)\r\n if (!arr) map.set(item, arr = [])\r\n arr.push({ node: oldChildren[index], index, used: false })\r\n })\r\n\r\n let getOld = (item: any) => {\r\n let arr = map.get(item)\r\n if (!arr) return false\r\n\r\n let index = arr.findIndex(alone => !alone.used)\r\n\r\n if (index > -1) return arr[index]\r\n else return false\r\n }\r\n\r\n let moveOld = (item: any, node: NodeInfo) => {\r\n let arr = map.get(item)\r\n if (!arr) return\r\n\r\n let index = arr.findIndex(alone => alone === node)\r\n arr.splice(index, 1)\r\n }\r\n\r\n let maxIndexSoFar = { node: oldChildren[0], index: 0 }\r\n\r\n newDepArray.forEach((item, newIndex) => {\r\n let old = getOld(item)\r\n if (old) {\r\n if (old.index < maxIndexSoFar.index) {\r\n let next: ChildNode | null\r\n if (newIndex > 0) {\r\n next = getNextSibling(newChildren[newIndex - 1]) as ChildNode | null\r\n } else {\r\n next = getNextSibling(maxIndexSoFar.node) as ChildNode | null\r\n }\r\n\r\n VNodeInsertBefore(container, old.node, next as ChildNode | undefined)\r\n // container.insertBefore(old.node.el!, next)\r\n } else {\r\n maxIndexSoFar = old\r\n }\r\n\r\n newChildren[newIndex] = old.node\r\n moveOld(item, old)\r\n } else {\r\n // let next = maxIndexSoFar.node.el!.nextSibling\r\n let next: ChildNode | null\r\n if (newIndex > 0) {\r\n next = getNextSibling(newChildren[newIndex - 1]) as ChildNode | null\r\n } else {\r\n next = getNextSibling(maxIndexSoFar.node) as ChildNode | null\r\n }\r\n\r\n let newNode = newChildren[newIndex]\r\n mount(newNode, container, next as HTMLElement | undefined)\r\n // maxIndexSoFar = { node: newNode, index: maxIndexSoFar.index + 1 }\r\n }\r\n })\r\n\r\n\r\n map.forEach(value => {\r\n value.forEach(item => {\r\n if (!item.used) {\r\n unmount(item.node, container)\r\n }\r\n })\r\n })\r\n}\r\n\r\nfunction patchArrayNode(oldVNode: VArrayNode, newVNode: VArrayNode, container: HTMLElement) {\r\n const nextSibling = oldVNode.el.nextSibling\r\n unmount(oldVNode, container)\r\n mount(newVNode, container, nextSibling as ChildNode | undefined)\r\n}\r\n\r\n\r\n/**\r\n * 将一个虚拟节点挂载到一个锚点前面\r\n */\r\nfunction VNodeInsertBefore(container: HTMLElement, node: VNode, next?: ChildNode) {\r\n if (node.flag === VNODE_TYPE.ELEMENT || node.flag === VNODE_TYPE.TEXT) {\r\n container.insertBefore(node.el!, next!)\r\n } else if (node.flag === VNODE_TYPE.COMPONENT) {\r\n container.insertBefore((node as VComponent).root.el!, next!)\r\n }\r\n else if (node.flag === VNODE_TYPE.ARRAYNODE || node.flag === VNODE_TYPE.FRAGMENT) {\r\n let start: ChildNode | null | undefined = node.anchor\r\n let nextToMove = start?.nextSibling\r\n let end: ChildNode | null | undefined = node.el\r\n while (start !== end) {\r\n container.insertBefore(start!, next!)\r\n start = nextToMove\r\n nextToMove = start?.nextSibling\r\n }\r\n container.insertBefore(end!, next!)\r\n }\r\n}\r\n","import { patch } from \"./patch\";\r\nimport { watchVNode } from \"../reactive\";\r\nimport { App } from \"../app\";\r\nimport {\r\n VAlive,\r\n VArrayNode,\r\n VComponent,\r\n VElement,\r\n VFragment, VNodeElement,\r\n VText\r\n} from \"../vnode\";\r\nimport { VNode, VNODE_TYPE } from \"../vnode\";\r\nimport { mountElement, unmountElement } from \"./element\";\r\n\r\nexport function mount(vnode: VNode, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n switch (vnode.flag) {\r\n case VNODE_TYPE.ELEMENT:\r\n mountElement(vnode as VElement, container, anchor, app)\r\n break\r\n case VNODE_TYPE.TEXT:\r\n mountText(vnode as VText, container, anchor)\r\n break\r\n case VNODE_TYPE.FRAGMENT:\r\n mountFragment(vnode as VFragment, container, anchor, app)\r\n break\r\n case VNODE_TYPE.ARRAYNODE:\r\n mountArrayNode(vnode as VArrayNode, container, anchor, app)\r\n break\r\n case VNODE_TYPE.COMPONENT:\r\n mountComponent(vnode as VComponent, container, anchor, app)\r\n break\r\n case VNODE_TYPE.ALIVE:\r\n mountAlive(vnode as VAlive, container, anchor, app)\r\n break\r\n }\r\n}\r\n\r\nexport function unmount(vnode: VNode, container: HTMLElement) {\r\n switch (vnode.flag) {\r\n case VNODE_TYPE.ELEMENT:\r\n unmountElement(vnode as VElement, container)\r\n break\r\n case VNODE_TYPE.TEXT:\r\n unmountText(vnode as VText, container)\r\n break\r\n case VNODE_TYPE.FRAGMENT:\r\n unmountFragment(vnode as VFragment, container)\r\n break\r\n case VNODE_TYPE.ARRAYNODE:\r\n unmountArrayNode(vnode as VArrayNode, container)\r\n break\r\n case VNODE_TYPE.COMPONENT:\r\n unmountComponent(vnode as VComponent, container)\r\n break\r\n }\r\n}\r\n\r\nexport function mountChildren(children: Array, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n children.forEach(child => mount(child, container, anchor, app))\r\n}\r\n\r\nexport function mountText(vnode: VText, container: HTMLElement, anchor?: VNodeElement) {\r\n const el = document.createTextNode(vnode.children)\r\n vnode.el = el\r\n container.insertBefore(el, anchor!)\r\n}\r\n\r\nexport function unmountText(vnode: VText, container: HTMLElement) {\r\n vnode.el.remove()\r\n}\r\n\r\nexport function mountFragment(vnode: VFragment, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n const start = document.createTextNode('')\r\n const end = document.createTextNode('')\r\n vnode.anchor = start\r\n vnode.el = end\r\n container.insertBefore(start, anchor!)\r\n mountChildren(vnode.children, container, anchor, app)\r\n container.insertBefore(end, anchor!)\r\n}\r\n\r\nexport function unmountFragment(vnode: VFragment, container: HTMLElement) {\r\n const start = vnode.anchor\r\n const end = vnode.el\r\n let cur: ChildNode | null = start\r\n while (cur && cur !== end) {\r\n let next: ChildNode | null = cur.nextSibling\r\n cur.remove()\r\n cur = next\r\n }\r\n end.remove()\r\n}\r\n\r\nexport function mountArrayNode(vnode: VArrayNode, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n const start = document.createTextNode('')\r\n const end = document.createTextNode('')\r\n vnode.anchor = start\r\n vnode.el = end\r\n container.insertBefore(start, anchor!)\r\n mountChildren(vnode.children, container, anchor, app)\r\n container.insertBefore(end, anchor!)\r\n}\r\n\r\nexport function unmountArrayNode(vnode: VArrayNode, container: HTMLElement, anchor?: HTMLElement) {\r\n const start = vnode.anchor\r\n const end = vnode.el\r\n let cur: ChildNode | null = start\r\n while (cur && cur !== end) {\r\n let next: ChildNode | null = cur.nextSibling\r\n cur.remove()\r\n cur = next\r\n }\r\n end.remove()\r\n}\r\n\r\nexport function mountComponent(vNode: VComponent, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n const root = vNode.root\r\n vNode.lifeStyleInstance.emit('readyMounted')\r\n mount(root, container, anchor, app)\r\n vNode.lifeStyleInstance.emit('mounted')\r\n}\r\n\r\nexport function unmountComponent(vNode: VComponent, container: HTMLElement) {\r\n vNode.lifeStyleInstance.emit('beforeUnMounted')\r\n unmount(vNode.root, container)\r\n vNode.lifeStyleInstance.emit('unMounted')\r\n}\r\n\r\nexport function mountAlive(vnode: VAlive, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n let firstVNode = watchVNode(vnode, (oldVNode, newVNode) => patch(oldVNode, newVNode, container, app))\r\n vnode.vnode = firstVNode\r\n mount(firstVNode, container, anchor, app)\r\n}\r\n","import { H } from './render'\r\nimport { VNode, VNodeProps, OriginVNode, FunctionComponentType } from \"./vnode\"\r\nimport {appUtils, AppUtils} from \"./plugin\";\r\nimport {ComponentLifeCycle} from \"./lifeCycle\";\r\n\r\n\r\n/**\r\n * 根类组件用于类型提示\r\n * 抽象类\r\n*/\r\n\r\n// todo\r\nexport interface ComponentInstance {\r\n props?: VNodeProps\r\n children?: Array\r\n utils: AppUtils\r\n life?: ComponentLifeCycle\r\n render(h?: H): OriginVNode\r\n\r\n /** 组件示例创建之后触发 */\r\n created?(): void\r\n\r\n /** 组件示例在渲染之前触发(DOM还没有生成) */\r\n beforeMounted?(): void\r\n\r\n /** dom已经生成到js内存但还没挂载 */\r\n readyMounted?(): void\r\n\r\n /** dom挂载到了页面上*/\r\n mounted?(): void\r\n\r\n /** 卸载之前触发 */\r\n beforeUnMounted?():void\r\n\r\n /** 卸载之后触发 */\r\n unMounted?():void\r\n}\r\n\r\nexport abstract class Component implements ComponentInstance{\r\n // 组件属性\r\n abstract props?: VNodeProps\r\n // 组件子元素\r\n abstract children?: Array\r\n\r\n abstract render(h?: H): VNode\r\n\r\n utils: AppUtils = appUtils\r\n abstract life?: ComponentLifeCycle\r\n\r\n /** 组件示例创建之后触发 */\r\n abstract created?(): void\r\n\r\n /** 组件示例在渲染之前触发(DOM还没有生成) */\r\n abstract beforeMounted?(): void\r\n\r\n /** dom已经生成到js内存但还没挂载 */\r\n abstract readyMounted?(): void\r\n\r\n /** dom挂载到了页面上*/\r\n abstract mounted?(): void\r\n\r\n /** 卸载之前触发 */\r\n abstract beforeUnMounted?():void\r\n\r\n /** 卸载之后触发 */\r\n abstract unMounted?():void\r\n}\r\n\r\nexport function defineComponent(componentType: FunctionComponentType): FunctionComponentType {\r\n return componentType\r\n}\r\n","import { mount } from \"./mount/mount\";\r\nimport { VNode } from \"./vnode\";\r\nimport {isString} from \"./utils\";\r\nimport { AppPlugin, appUtils } from './plugin'\r\n\r\nexport interface Options {\r\n arrayDiff?: boolean\r\n}\r\n\r\nexport class App {\r\n rootVNode: VNode\r\n options: Options\r\n\r\n private pluginList: Array\r\n\r\n constructor(vNode: VNode, options?: Options) {\r\n this.rootVNode = vNode\r\n this.options = options || {}\r\n this.pluginList = []\r\n }\r\n\r\n mount(selector?: string | HTMLElement): void {\r\n if(selector) {\r\n const el = (isString(selector) ? document.querySelector(selector) : selector) || document.body\r\n mount(this.rootVNode, el as HTMLElement, undefined, this)\r\n }else {\r\n mount(this.rootVNode, document.body, undefined, this)\r\n }\r\n\r\n // let container = document.createElement('div')\r\n // mount(this.rootVNode, container, undefined, this)\r\n // el?.replaceWith(...container.childNodes)\r\n }\r\n\r\n use(plugin: AppPlugin) {\r\n let index = this.pluginList.indexOf(plugin)\r\n if(index > -1) return this\r\n\r\n plugin.install({utils: appUtils})\r\n return this\r\n }\r\n}\r\n\r\nexport function createApp(vNode: VNode, options?: Options): App {\r\n return new App(vNode, options)\r\n}\r\n\r\n"],"names":["h"],"mappings":";;;;;;QAGa,UAAU,GAAG,MAAM,CAAC,MAAM;;QCD1B,cAAc,GAAG,MAAM,CAAC,UAAU;;QCsBlC,gBAAgB,GAAG,MAAM,CAAC,YAAY;;QCtBtC,WAAW,GAAG,MAAM,CAAC,WAAW;;ECCtC,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC;;ECA1C;;EAEE;EACF,IAAY,UASX,CAAA;EATD,CAAA,UAAY,UAAU,EAAA;;EAEpB,IAAA,UAAA,CAAA,UAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAO,CAAA;;EAEP,IAAA,UAAA,CAAA,UAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;EACJ,IAAA,UAAA,CAAA,UAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAQ,CAAA;EACR,IAAA,UAAA,CAAA,UAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS,CAAA;EACT,IA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;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/lib/bundle.esm.js b/lib/bundle.esm.js index dde50e9..13dbb8b 100644 --- a/lib/bundle.esm.js +++ b/lib/bundle.esm.js @@ -1,3 +1,13 @@ +const TextSymbol = Symbol('Text'); + +const FragmentSymbol = Symbol('Fragment'); + +const VComponentSymbol = Symbol('VComponent'); + +const ArraySymbol = Symbol('ArrayNode'); + +const AliveSymbol = Symbol('Alive'); + /** * 虚拟dom节点类型枚举 */ @@ -13,12 +23,6 @@ var VNODE_TYPE; VNODE_TYPE[VNODE_TYPE["ALIVE"] = 5] = "ALIVE"; })(VNODE_TYPE || (VNODE_TYPE = {})); -const FragmentSymbol = Symbol('Fragment'); - -const TextSymbol = Symbol('Text'); - -const ArraySymbol = Symbol('ArrayNode'); - function isString(content) { return typeof content === 'string'; } @@ -175,6 +179,10 @@ function track(target, prop) { function setActiver(fn) { activeWatcher = fn; } +// 设置全局变量 +function getActiver() { + return activeWatcher; +} class RefImpl { constructor(value) { @@ -221,7 +229,64 @@ function active(fn) { return new Activer(fn); } -const AliveSymbol = Symbol('Alive'); +class ComponentLifeCycle { + constructor(createdList = [], beforeMountedList = [], readyMountedList = [], mountedList = [], beforeUnMountedList = [], unMountedList = []) { + this.createdList = createdList; + this.beforeMountedList = beforeMountedList; + this.readyMountedList = readyMountedList; + this.mountedList = mountedList; + this.beforeUnMountedList = beforeUnMountedList; + this.unMountedList = unMountedList; + // this.createdList = [] + // this.beforeMountedList = [] + // this.readyMountedList = [] + // this.mountedList = [] + // this.beforeUnMountedList = [] + // this.unMountedList = [] + } + created(fn) { + this.createdList.push(fn); + } + beforeMounted(fn) { + this.beforeMountedList.push(fn); + } + readyMounted(fn) { + this.readyMountedList.push(fn); + } + mounted(fn) { + this.mountedList.push(fn); + } + beforeUnMounted(fn) { + this.beforeUnMountedList.push(fn); + } + unMounted(fn) { + this.unMountedList.push(fn); + } + emit(lifeName) { + this[`${lifeName}List`].forEach(fn => fn()); + } +} +// 生成类组件生命周期实例 +function createClassComponentLife(component) { + let lifeNames = ['created', 'beforeMounted', 'readyMounted', 'mounted', 'beforeUnMounted', 'unMounted']; + let lifeCycle = new ComponentLifeCycle(); + component.life = lifeCycle; + lifeNames.forEach(lifeName => { + let fn = component[lifeName]; + if (!fn) + return; + lifeCycle[lifeName](fn.bind(component)); + }); + return lifeCycle; +} + +// 给插件提供的能力 +const appUtils = { + state, + defineState, + h: renderApi, + watch +}; /** * 函数转化为activer转化为VAlive @@ -230,19 +295,20 @@ const AliveSymbol = Symbol('Alive'); * 数组转化为VArray * 其他转化为VText */ -function standarVNode(node) { - if (isVNode(node)) - return node; - if (isFunction(node)) - return renderAlive(active(node)); - else if (isActiver(node)) - return renderAlive(node); - else if (isString(node)) - return renderText(node); - else if (isArray(node)) - return renderArrayNode(node.map(item => standarVNode(item))); +function createVNode(originVNode) { + if (isVNode(originVNode)) + return originVNode; + if (isFunction(originVNode)) + return renderAlive(active(originVNode)); + else if (isActiver(originVNode)) + return renderAlive(originVNode); + else if (isString(originVNode)) + return renderText(originVNode); + else if (isArray(originVNode)) + return renderArrayNode(originVNode.map(item => createVNode(item))); else { - let value = node; + // todo + let value = originVNode; let retText; if (!value && typeof value !== 'number') retText = renderText(''); @@ -255,37 +321,49 @@ function standarVNode(node) { * text(不需要props)、fragment(不需要props)、element、component为显性创建 * array(不需要props)、alive(不需要props)为隐形创建 */ -function render(type, props, mayChildren) { +function renderApi(type, props, children) { + return render(type, props || undefined, children); +} +function render(type, originProps, originChildren) { // text的children比较特殊先处理 if (isText(type)) { - return renderText(String(mayChildren)); + return renderText(String(originChildren)); } - let children; // 预处理 处理为单个的children - if (isArray(mayChildren)) - children = mayChildren; + let originChildrenList = []; + if (isArray(originChildren)) + originChildrenList.push(...originChildren); else - children = [mayChildren]; - let standardChildren = children.map(child => standarVNode(child)); + originChildrenList.push(originChildren); + // 创建VNode列表 + let vNodeChildren = originChildrenList.map(originChild => createVNode(originChild)); // 属性预处理 - if (props) { - for (const prop in props) { - // 以on开头的事件不需要处理 - if (!isOnEvent(prop) && isFunction(props[prop])) { - props[prop] = active(props[prop]); - } - } - } + let props = originProps || {}; + handleProps(props); if (isString(type)) - return renderElement(type, props || {}, standardChildren); + return renderElement(type, props, vNodeChildren); if (isFragment(type)) - return renderFragment(standardChildren); + return renderFragment(vNodeChildren); if (isArrayNode(type)) - return renderArrayNode(standardChildren); + return renderArrayNode(vNodeChildren); if (isFunction(type)) - return renderComponent(type, props || {}, standardChildren); + return renderComponent(type, props, vNodeChildren); throw '传入参数不合法'; } +/** + * 对属性进行预处理 + */ +function handleProps(originProps) { + for (const prop in originProps) { + // 以on开头的事件不需要处理 + if (!isOnEvent(prop) && + isFunction(originProps[prop])) { + // 如不为on且为函数则判断为响应式 + originProps[prop] = active(originProps[prop]); + } + } + return originProps; +} function renderText(text) { return { type: TextSymbol, @@ -315,34 +393,24 @@ function renderArrayNode(children) { children }; } -// 判断是普通函数还是构造函数 -function renderComponent(component, props, children) { - let cprops = {}; - for (let prop in props) { - let cur = props[prop]; - if (isActiver(cur)) { - Object.defineProperty(cprops, prop, { +function createComponentProps(props) { + let componentProps = {}; + for (const prop in props) { + let curProp = props[prop]; + if (isActiver(curProp)) { + Object.defineProperty(componentProps, prop, { get() { - return cur.value; + return curProp.value; } }); } else { - cprops[prop] = cur; + componentProps[prop] = curProp; } } - if (component.prototype && component.prototype.render && isFunction(component.prototype.render)) { - let Constructor = component; - let result = new Constructor(cprops, children); - result.props = cprops; - result.children = children; - return standarVNode(result.render(render)); - } - else { - let Fun = component; - return standarVNode(Fun(cprops, children)); - } + return componentProps; } +// 渲染一个活跃的节点 function renderAlive(activer) { return { type: AliveSymbol, @@ -350,6 +418,47 @@ function renderAlive(activer) { activer }; } +// 判断是普通函数还是构造函数 +function renderComponent(component, props, children) { + let componentProps = createComponentProps(props); + if (component.prototype && + component.prototype.render && + isFunction(component.prototype.render)) { + let ClassComponent = component; + let result = new ClassComponent(componentProps, children); + result.props = componentProps; + result.children = children; + let lifeCycle = createClassComponentLife(result); + let vn = result.render(renderApi); + lifeCycle.emit('created'); + let vc = { + type: VComponentSymbol, + root: createVNode(vn), + props: componentProps, + children: children, + flag: VNODE_TYPE.COMPONENT, + lifeStyleInstance: lifeCycle + }; + lifeCycle.emit('beforeMounted'); + return vc; + } + else { + let FunctionComponent = component; + let lifeCycle = new ComponentLifeCycle(); + let vn = FunctionComponent({ props: componentProps, children: children, life: lifeCycle, utils: appUtils }); + lifeCycle.emit('created'); + let vc = { + type: VComponentSymbol, + root: createVNode(vn), + props: componentProps, + children: children, + flag: VNODE_TYPE.COMPONENT, + lifeStyleInstance: lifeCycle + }; + lifeCycle.emit('beforeMounted'); + return vc; + } +} /** * 观察者 @@ -389,7 +498,7 @@ function watch(activeProps, callback) { function watchVNode(activeVNode, callback) { let watcher = new Watcher(activeVNode.activer, function (oldValue, newValue, meta) { const oldVNode = oldValue; - const newVNode = standarVNode(newValue); + const newVNode = createVNode(newValue); // 对于数组节点后期需要记录它的响应式数组用于节点更新 if (oldVNode.flag === VNODE_TYPE.ARRAYNODE) { oldVNode.depArray = meta === null || meta === void 0 ? void 0 : meta.targetPropOldValue; @@ -402,7 +511,7 @@ function watchVNode(activeVNode, callback) { watcher.value = newVNode; activeVNode.vnode = newVNode; }); - return watcher.value = standarVNode(watcher.value); + return watcher.value = createVNode(watcher.value); } /** * 监控可变dom的prop @@ -472,8 +581,21 @@ function mergeStyle(style) { function isSameVNode(oldVNode, newVNode) { return oldVNode.flag === newVNode.flag; } +// todo +function getNextSibling(vNode) { + switch (vNode.flag) { + case VNODE_TYPE.TEXT: + case VNODE_TYPE.ELEMENT: + case VNODE_TYPE.ARRAYNODE: + case VNODE_TYPE.FRAGMENT: + return vNode.el.nextSibling; + case VNODE_TYPE.COMPONENT: + return vNode.root.el.nextSibling; + case VNODE_TYPE.ALIVE: + return getNextSibling(vNode.vnode); + } +} function patch(oldVNode, newVNode, container, app) { - var _a, _b; // 如果两个节点引用一样不需要判断 if (oldVNode === newVNode) return; @@ -492,15 +614,15 @@ function patch(oldVNode, newVNode, container, app) { } } else { - const nextSibling = (_a = oldVNode === null || oldVNode === void 0 ? void 0 : oldVNode.el) === null || _a === void 0 ? void 0 : _a.nextSibling; - // const nextSibling = getNextSibling(oldVNode) + // const nextSibling = oldVNode?.el?.nextSibling + const nextSibling = getNextSibling(oldVNode); unmount(oldVNode); mount(newVNode, container, nextSibling); } } else { - const nextSibling = (_b = oldVNode === null || oldVNode === void 0 ? void 0 : oldVNode.el) === null || _b === void 0 ? void 0 : _b.nextSibling; - // const nextSibling = getNextSibling(oldVNode) + // const nextSibling = oldVNode?.el?.nextSibling + const nextSibling = getNextSibling(oldVNode); unmount(oldVNode); mount(newVNode, container, nextSibling); } @@ -559,10 +681,10 @@ function patchArrayNodeT(oldVNode, newVNode, container) { if (old.index < maxIndexSoFar.index) { let next; if (newIndex > 0) { - next = newChildren[newIndex - 1].el.nextSibling; + next = getNextSibling(newChildren[newIndex - 1]); } else { - next = maxIndexSoFar.node.el.nextSibling; + next = getNextSibling(maxIndexSoFar.node); } VNodeInsertBefore(container, old.node, next); // container.insertBefore(old.node.el!, next) @@ -577,10 +699,10 @@ function patchArrayNodeT(oldVNode, newVNode, container) { // let next = maxIndexSoFar.node.el!.nextSibling let next; if (newIndex > 0) { - next = newChildren[newIndex - 1].el.nextSibling; + next = getNextSibling(newChildren[newIndex - 1]); } else { - next = maxIndexSoFar.node.el.nextSibling; + next = getNextSibling(maxIndexSoFar.node); } let newNode = newChildren[newIndex]; mount(newNode, container, next); @@ -600,10 +722,16 @@ function patchArrayNode(oldVNode, newVNode, container) { unmount(oldVNode); mount(newVNode, container, nextSibling); } +/** + * 将一个虚拟节点挂载到一个锚点前面 + */ function VNodeInsertBefore(container, node, next) { if (node.flag === VNODE_TYPE.ELEMENT || node.flag === VNODE_TYPE.TEXT) { container.insertBefore(node.el, next); } + else if (node.flag === VNODE_TYPE.COMPONENT) { + container.insertBefore(node.root.el, next); + } else if (node.flag === VNODE_TYPE.ARRAYNODE || node.flag === VNODE_TYPE.FRAGMENT) { let start = node.anchor; let nextToMove = start === null || start === void 0 ? void 0 : start.nextSibling; @@ -631,9 +759,9 @@ function mount(vnode, container, anchor, app) { case VNODE_TYPE.ARRAYNODE: mountArrayNode(vnode, container, anchor, app); break; - // case VNODE_TYPE.COMPONENT: - // mountComponent(vnode as VComponent, container, anchor, app) - // break + case VNODE_TYPE.COMPONENT: + mountComponent(vnode, container, anchor, app); + break; case VNODE_TYPE.ALIVE: mountAlive(vnode, container, anchor, app); break; @@ -653,9 +781,9 @@ function unmount(vnode, container) { case VNODE_TYPE.ARRAYNODE: unmountArrayNode(vnode); break; - // case VNODE_TYPE.COMPONENT: - // unmountComponent(vnode as VComponent, container) - // break + case VNODE_TYPE.COMPONENT: + unmountComponent(vnode); + break; } } function mountChildren(children, container, anchor, app) { @@ -709,16 +837,17 @@ function unmountArrayNode(vnode, container, anchor) { } end.remove(); } -// export function mountComponent(vnode: VComponent, container: HTMLElement, anchor?: HTMLElement, app?: Vact) { -// console.log(1111); -// const root = vnode.type.render(render) -// vnode.root = root -// mount(root, container, anchor, app) -// vnode.el = root.el! -// } -// export function unmountComponent(vnode: VComponent, container: HTMLElement) { -// unmount(vnode.root, container) -// } +function mountComponent(vNode, container, anchor, app) { + const root = vNode.root; + vNode.lifeStyleInstance.emit('readyMounted'); + mount(root, container, anchor, app); + vNode.lifeStyleInstance.emit('mounted'); +} +function unmountComponent(vNode, container) { + vNode.lifeStyleInstance.emit('beforeUnMounted'); + unmount(vNode.root); + vNode.lifeStyleInstance.emit('unMounted'); +} function mountAlive(vnode, container, anchor, app) { let firstVNode = watchVNode(vnode, (oldVNode, newVNode) => patch(oldVNode, newVNode, container, app)); vnode.vnode = firstVNode; @@ -726,32 +855,43 @@ function mountAlive(vnode, container, anchor, app) { } class Component { - constructor(config = {}) { - this.config = config; - this.data = defineState(config.data || {}); + constructor() { + this.utils = appUtils; } } +function defineComponent(componentType) { + return componentType; +} -class Vact { - constructor(vnode, options) { - this.rootVNode = vnode; +class App { + constructor(vNode, options) { + this.rootVNode = vNode; this.options = options || {}; + this.pluginList = []; } mount(selector) { - const el = document.querySelector(selector); - let container = document.createElement('div'); - mount(this.rootVNode, container, undefined, this); - el === null || el === void 0 ? void 0 : el.replaceWith(...container.childNodes); + if (selector) { + const el = (isString(selector) ? document.querySelector(selector) : selector) || document.body; + mount(this.rootVNode, el, undefined, this); + } + else { + mount(this.rootVNode, document.body, undefined, this); + } + // let container = document.createElement('div') + // mount(this.rootVNode, container, undefined, this) + // el?.replaceWith(...container.childNodes) } use(plugin) { - const utils = { state, defineState, h: render }; - plugin.install(utils); + let index = this.pluginList.indexOf(plugin); + if (index > -1) + return this; + plugin.install({ utils: appUtils }); return this; } } -function createApp(vnode, options) { - return new Vact(vnode, options); +function createApp(vNode, options) { + return new App(vNode, options); } -export { Activer, Component, FragmentSymbol as Fragment, TextSymbol as Text, createApp, render as createVNode, Vact as default, defineState, mount, reactive, ref, render, state, watch, watchProp, watchVNode }; +export { Activer, Component, RefImpl, ArraySymbol as VArray, VComponentSymbol as VComponent, FragmentSymbol as VFragment, TextSymbol as VText, Watcher, active, createApp, renderApi as createVNode, App as default, defineComponent, defineState, getActiver, renderApi as h, mount, reactive, ref, renderApi as render, setActiver, state, track, trigger, watch, watchProp, watchVNode }; //# sourceMappingURL=bundle.esm.js.map diff --git a/lib/bundle.esm.js.map b/lib/bundle.esm.js.map index 0fd8b96..db1b37c 100644 --- a/lib/bundle.esm.js.map +++ b/lib/bundle.esm.js.map @@ -1 +1 @@ -{"version":3,"file":"bundle.esm.js","sources":["../src/vnode/vnode.ts","../src/vnode/fragment.ts","../src/vnode/text.ts","../src/vnode/array.ts","../src/utils.ts","../src/reactive/update.ts","../src/reactive/reactive.ts","../src/reactive/ref.ts","../src/reactive/utils.ts","../src/reactive/active.ts","../src/vnode/alive.ts","../src/render.ts","../src/reactive/watch.ts","../src/mount/element.ts","../src/mount/patch.ts","../src/mount/mount.ts","../src/component.ts","../src/vact.ts"],"sourcesContent":["import { Activer } from \"../reactive\"\r\nimport { ComponentConstructor } from './component'\r\n\r\n/**\r\n * 虚拟dom节点类型枚举\r\n*/\r\nexport enum VNODE_TYPE {\r\n // 普通元素节点类型\r\n ELEMENT,\r\n // 文本节点类型\r\n TEXT,\r\n FRAGMENT,\r\n COMPONENT,\r\n ARRAYNODE,\r\n ALIVE\r\n}\r\n\r\n/**\r\n * 虚拟dom接口类型\r\n*/\r\nexport interface VNode {\r\n\r\n // 虚拟节点类型\r\n type: string | symbol | ComponentConstructor,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE\r\n\r\n // 虚拟节点属性\r\n props?: Record,\r\n\r\n // 虚拟节点子节点\r\n children?: Array | string,\r\n\r\n // 真实节点\r\n el?: HTMLElement | Text\r\n anchor?: Text\r\n\r\n activer?: Activer\r\n // 目前存在的节点\r\n vnode?: VNode\r\n\r\n}\r\n\r\n","import { VNode, VNODE_TYPE } from \"./vnode\";\r\n\r\nexport const FragmentSymbol = Symbol('Fragment');\r\nexport interface VFragment extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n\r\n // 虚拟节点子节点\r\n children: Array,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.FRAGMENT\r\n\r\n // 锚点\r\n anchor: Text,\r\n el: Text\r\n\r\n}","import { VNode, VNODE_TYPE } from \"./vnode\";\r\n\r\n\r\nexport const TextSymbol = Symbol('Text');\r\nexport interface VText extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n\r\n // 虚拟节点子节点\r\n children: string,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.TEXT\r\n\r\n el: Text\r\n\r\n}","import { VNode, VNODE_TYPE } from \"./vnode\";\r\n\r\nexport const ArraySymbol = Symbol('ArrayNode');\r\nexport interface VArrayNode extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n\r\n // 虚拟节点子节点\r\n children: Array,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.ARRAYNODE\r\n\r\n // 锚点\r\n anchor: Text,\r\n el: Text,\r\n\r\n // 记录当前数组节点依赖的响应式数组\r\n depArray: Array\r\n}","import { VNode, VNODE_TYPE } from './vnode/vnode'\r\nimport { Activer } from './reactive/active'\r\nimport { FragmentSymbol } from './vnode/fragment'\r\nimport { TextSymbol } from './vnode/text'\r\nimport { ArraySymbol } from './vnode/array'\r\n\r\nexport function isString(content: unknown): content is string {\r\n return typeof content === 'string'\r\n}\r\n\r\nexport function isFunction(content: unknown): content is Function {\r\n return typeof content === 'function'\r\n}\r\n\r\nexport function isFragment(content: unknown): boolean {\r\n return content === FragmentSymbol\r\n}\r\n\r\nexport function isArrayNode(content: unknown): boolean {\r\n return content === ArraySymbol\r\n}\r\n\r\nexport function isText(content: unknown): boolean {\r\n return content === TextSymbol\r\n}\r\n\r\nexport function isActiver(content: unknown): content is Activer {\r\n return isObject(content) && (content as Record).flag === 'activer'\r\n}\r\n\r\nexport function isVNode(content: unknown): content is VNode {\r\n return isObject(content) && (content as Record).flag in VNODE_TYPE\r\n}\r\n\r\nexport function isObjectExact(content: unknown): content is Object {\r\n return isObject(content) && content.constructor === Object\r\n}\r\n\r\nexport function isOnEvent(str: string): boolean {\r\n return /^on.+$/.test(str)\r\n}\r\n\r\nexport function isObject(content: unknown): content is object {\r\n return typeof content === 'object' && content !== null\r\n}\r\n\r\n\r\nexport function isArray(content: unknown): content is Array {\r\n return Array.isArray(content)\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n","import { Watcher } from \"./watch\";\r\n\r\nlet updating = false\r\nconst watcherTask: Array = []\r\n\r\nexport function runUpdate(watcher: Watcher) {\r\n let index: number = watcherTask.indexOf(watcher)\r\n if (!(index > -1)) watcherTask.push(watcher)\r\n if (!updating) {\r\n updating = true\r\n Promise.resolve()\r\n .then(() => {\r\n let watcher: Watcher | undefined = undefined\r\n while (watcher = watcherTask.shift()) {\r\n watcher.update()\r\n }\r\n }).finally(() => {\r\n updating = false\r\n })\r\n }\r\n}","import { isArray, isObjectExact, isVNode } from \"../utils\"\r\nimport { Watcher } from \"./watch\"\r\nimport { runUpdate } from './update'\r\n\r\n// 目标对象到映射对象\r\nconst targetMap = new WeakMap()\r\n// 全局变量watcher\r\nlet activeWatcher: Watcher | null = null\r\nconst REACTIVE = Symbol('reactive')\r\n\r\n/**\r\n * 实现响应式对象\r\n*/\r\nexport function reactive>(target: T): T {\r\n if (target[REACTIVE]) return target\r\n\r\n let handler: ProxyHandler = {\r\n get(target, prop, receiver) {\r\n if (prop === REACTIVE) return true\r\n const res = Reflect.get(target, prop, receiver)\r\n\r\n if (isObjectExact(res) && !isVNode(res)) {\r\n return reactive(res)\r\n }\r\n\r\n if (Array.isArray(res)) {\r\n track(target, prop)\r\n return reactiveArray(res, target, prop)\r\n }\r\n\r\n track(target, prop)\r\n return res\r\n },\r\n\r\n set(target, prop, value, receiver) {\r\n const res = Reflect.set(target, prop, value, receiver)\r\n trigger(target, prop)\r\n return res\r\n }\r\n }\r\n\r\n return new Proxy(target, handler)\r\n}\r\n\r\n/**\r\n * 设置响应式数组\r\n*/\r\nfunction reactiveArray(targetArr: Array, targetObj: Record, Arrprop: string | symbol) {\r\n let handler: ProxyHandler> = {\r\n get(target, prop, receiver) {\r\n const res = Reflect.get(target, prop, receiver)\r\n\r\n if (isObjectExact(res)) {\r\n return reactive(res)\r\n }\r\n\r\n return res\r\n },\r\n set(target, prop, value, receiver) {\r\n const res = Reflect.set(target, prop, value, receiver)\r\n trigger(targetObj, Arrprop)\r\n return res\r\n }\r\n }\r\n\r\n return new Proxy(targetArr, handler)\r\n}\r\n\r\n/**\r\n * 响应触发依赖\r\n*/\r\nexport function trigger(target: Record, prop: string | symbol) {\r\n let mapping: Record> = targetMap.get(target)\r\n if (!mapping) return\r\n\r\n let mappingProp: Array = mapping[prop]\r\n if (!mappingProp) return\r\n\r\n // mappingProp.forEach(watcher => watcher.update(oldValue, newValue))\r\n mappingProp.forEach(watcher => {\r\n // 针对于对数组响应做特殊处理\r\n if (isArray(target[prop])) {\r\n watcher.nextDepArr = target[prop]\r\n }\r\n runUpdate(watcher)\r\n })\r\n}\r\n\r\n/**\r\n * 追踪绑定依赖\r\n*/\r\nexport function track(target: Record, prop: string | symbol) {\r\n if (!activeWatcher) return\r\n\r\n let mapping: Record> = targetMap.get(target)\r\n if (!mapping) targetMap.set(target, mapping = {})\r\n\r\n let mappingProp: Array = mapping[prop]\r\n if (!mappingProp) mappingProp = mapping[prop] = []\r\n\r\n // 针对于对数组响应做特殊处理\r\n if (isArray(target[prop])) {\r\n if (activeWatcher.depArr) {\r\n activeWatcher.depArr = false\r\n } else {\r\n if (activeWatcher.depArr === undefined) {\r\n activeWatcher.depArr = target[prop].slice()\r\n }\r\n }\r\n }\r\n\r\n mappingProp.push(activeWatcher)\r\n}\r\n\r\n// 设置全局变量\r\nexport function setActiver(fn: Watcher | null) {\r\n activeWatcher = fn\r\n}\r\n// 设置全局变量\r\nexport function getActiver(): Watcher | null {\r\n return activeWatcher\r\n}\r\n\r\n","import { track, trigger } from './reactive'\r\n\r\nexport class RefImpl {\r\n private _value: T\r\n private readonly _target: Record\r\n\r\n constructor(value: T) {\r\n this._value = value\r\n this._target = { value: this._value }\r\n }\r\n\r\n get value() {\r\n track(this._target, 'value')\r\n return this._value\r\n }\r\n\r\n set value(value) {\r\n this._value = value\r\n this._target.value = this._value\r\n trigger(this._target, 'value')\r\n }\r\n}\r\n\r\n\r\nexport function ref(value: T): RefImpl {\r\n return new RefImpl(value)\r\n}","import { ref } from './ref'\r\nimport { reactive } from './reactive'\r\n\r\n\r\nexport function state(value: T) {\r\n return ref(value)\r\n}\r\n\r\nexport function defineState>(target: T): T {\r\n return reactive(target)\r\n}\r\n\r\n\r\n\r\n\r\n\r\n","\r\n/**\r\n * 响应式对象\r\n*/\r\nexport class Activer {\r\n callback: () => T\r\n flag: string = 'activer'\r\n\r\n constructor(fn: () => T) {\r\n this.callback = fn\r\n }\r\n\r\n get value(): T {\r\n return this.callback()\r\n }\r\n}\r\n\r\n/**\r\n * 外置函数\r\n*/\r\nexport function active(fn: () => T): Activer {\r\n return new Activer(fn)\r\n}\r\n\r\n","import { Activer } from \"../reactive\"\r\nimport { Child } from \"../render\"\r\nimport { VNode, VNODE_TYPE } from \"./vnode\"\r\n\r\nexport const AliveSymbol = Symbol('Alive')\r\nexport interface VAlive extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.ELEMENT\r\n\r\n activer: Activer\r\n // 目前存在的节点\r\n vnode: VNode\r\n}","import { active } from \"./reactive/active\";\r\nimport { Activer } from './reactive'\r\nimport { isString, isFragment, isText, isFunction, isArrayNode, isOnEvent, isVNode, isActiver, isArray } from \"./utils\";\r\nimport { ComponentConstructor, FunctionConstructor, ClassConstructor } from \"./vnode/component\";\r\nimport { VNode, VNODE_TYPE } from \"./vnode/vnode\";\r\nimport { ArraySymbol } from \"./vnode/array\";\r\nimport { AliveSymbol } from \"./vnode/alive\";\r\nimport { TextSymbol } from './vnode/text'\r\nimport { FragmentSymbol } from \"./vnode/fragment\";\r\n\r\n/**\r\n * 传说中的render函数\r\n*/\r\n\r\nexport type HSymbol = typeof TextSymbol | typeof FragmentSymbol | typeof AliveSymbol | typeof ArraySymbol\r\nexport type H = (type: string | HSymbol | ComponentConstructor, props?: Record | null, mayChildren?: Child | Array) => VNode\r\n// 未经过标准化的children类型\r\nexport type Child = (() => Child) | string | VNode | Array | Activer | Exclude<(() => Child) | string | VNode | Array | Activer, any>\r\n\r\n/**\r\n * 函数转化为activer转化为VAlive\r\n * activer转化为VAlive\r\n * string转化为VText\r\n * 数组转化为VArray\r\n * 其他转化为VText\r\n*/\r\nexport function standarVNode(node: Child): VNode {\r\n if (isVNode(node)) return node\r\n\r\n if (isFunction(node)) return renderAlive(active(node))\r\n else if (isActiver(node)) return renderAlive(node)\r\n else if (isString(node)) return renderText(node)\r\n else if (isArray(node)) return renderArrayNode(node.map(item => standarVNode(item)))\r\n else {\r\n let value = node\r\n let retText: VNode\r\n if (!value && typeof value !== 'number') retText = renderText('')\r\n else retText = renderText(String(value))\r\n return retText\r\n }\r\n}\r\n\r\n\r\n/**\r\n * text(不需要props)、fragment(不需要props)、element、component为显性创建\r\n * array(不需要props)、alive(不需要props)为隐形创建\r\n*/\r\nexport function render(type: string | symbol | ComponentConstructor, props?: Record | null, mayChildren?: Child | Array): VNode {\r\n // text的children比较特殊先处理\r\n if (isText(type)) {\r\n return renderText(String(mayChildren))\r\n }\r\n\r\n let children: Array\r\n // 预处理 处理为单个的children\r\n if (isArray(mayChildren)) children = mayChildren\r\n else children = [mayChildren as Child]\r\n\r\n let standardChildren: Array = children.map(child => standarVNode(child))\r\n\r\n // 属性预处理\r\n if (props) {\r\n for (const prop in props) {\r\n // 以on开头的事件不需要处理\r\n if (!isOnEvent(prop) && isFunction(props[prop])) {\r\n props[prop] = active(props[prop])\r\n }\r\n }\r\n }\r\n\r\n if (isString(type)) return renderElement(type, props || {}, standardChildren)\r\n if (isFragment(type)) return renderFragment(standardChildren)\r\n if (isArrayNode(type)) return renderArrayNode(standardChildren)\r\n if (isFunction(type)) return renderComponent(type, props || {}, standardChildren)\r\n throw '传入参数不合法'\r\n}\r\n\r\nfunction renderText(text: string): VNode {\r\n return {\r\n type: TextSymbol,\r\n flag: VNODE_TYPE.TEXT,\r\n children: text\r\n }\r\n}\r\n\r\nfunction renderElement(tag: string, props: Record, children: Array): VNode {\r\n return {\r\n type: tag,\r\n flag: VNODE_TYPE.ELEMENT,\r\n props,\r\n children\r\n }\r\n}\r\n\r\nfunction renderFragment(children: Array): VNode {\r\n return {\r\n type: FragmentSymbol,\r\n flag: VNODE_TYPE.FRAGMENT,\r\n children\r\n }\r\n}\r\n\r\nfunction renderArrayNode(children: Array): VNode {\r\n return {\r\n type: ArraySymbol,\r\n flag: VNODE_TYPE.ARRAYNODE,\r\n children\r\n }\r\n}\r\n\r\n\r\n// 判断是普通函数还是构造函数\r\nfunction renderComponent(component: ComponentConstructor, props: Record, children: Array): VNode {\r\n let cprops: Record = {}\r\n for (let prop in props) {\r\n let cur = props[prop]\r\n if (isActiver(cur)) {\r\n Object.defineProperty(cprops, prop, {\r\n get() {\r\n return (cur).value\r\n }\r\n })\r\n } else {\r\n cprops[prop] = cur\r\n }\r\n }\r\n\r\n if (component.prototype && component.prototype.render && isFunction(component.prototype.render)) {\r\n let Constructor = component as ClassConstructor\r\n let result = new Constructor(cprops, children)\r\n result.props = cprops\r\n result.children = children\r\n return standarVNode(result.render(render))\r\n } else {\r\n let Fun = component as FunctionConstructor\r\n return standarVNode(Fun(cprops, children))\r\n }\r\n}\r\n\r\n\r\nfunction renderAlive(activer: Activer): VNode {\r\n return {\r\n type: AliveSymbol,\r\n flag: VNODE_TYPE.ALIVE,\r\n activer\r\n }\r\n}\r\n","import { setActiver } from \"./reactive\"\r\nimport { active, Activer } from './active'\r\nimport { VNode, VNODE_TYPE } from \"../vnode/vnode\"\r\nimport { isActiver } from \"../utils\"\r\nimport { Child, standarVNode } from \"../render\"\r\nimport { VArrayNode } from \"../vnode/array\"\r\nimport { VAlive } from \"../vnode/alive\"\r\n\r\ntype Meta = {\r\n targetPropOldValue: any,\r\n targetPropnewValue: any\r\n}\r\n\r\n/**\r\n * 观察者\r\n * 观察数据的变化\r\n*/\r\nexport class Watcher {\r\n value: T\r\n callback: (oldValue: T, newValue: T, meta?: Meta) => void\r\n activeProps: Activer\r\n depArr?: Array | false\r\n nextDepArr?: Array\r\n\r\n constructor(activeProps: Activer, callback: (oldValue: T, newValue: T, meta?: Meta) => void) {\r\n setActiver(this)\r\n this.value = activeProps.value\r\n this.callback = callback\r\n this.activeProps = activeProps\r\n setActiver(null)\r\n }\r\n\r\n update() {\r\n let newValue = this.activeProps.value\r\n let oldValue = this.value\r\n this.value = newValue\r\n let meta = { targetPropOldValue: this.depArr, targetPropnewValue: this.nextDepArr }\r\n this.callback(oldValue, newValue, meta)\r\n this.depArr = this.nextDepArr?.slice()\r\n }\r\n}\r\n\r\n\r\n/**\r\n * 监控自定义响应式属性\r\n*/\r\nexport function watch(activeProps: (() => T) | Activer, callback: (oldValue: T, newValue: T) => void): Watcher {\r\n if (!isActiver(activeProps)) activeProps = active(activeProps)\r\n return new Watcher(activeProps, function (oldValue: T, newValue: T) {\r\n callback(oldValue, newValue)\r\n })\r\n}\r\n\r\n/**\r\n * 监控可变状态dom\r\n*/\r\nexport function watchVNode(activeVNode: VAlive, callback: (oldVNode: VNode, newVNode: VNode) => void): VNode {\r\n let watcher = new Watcher(activeVNode.activer, function (oldValue: Child, newValue: Child, meta) {\r\n const oldVNode = oldValue as VNode\r\n const newVNode = standarVNode(newValue)\r\n\r\n // 对于数组节点后期需要记录它的响应式数组用于节点更新\r\n if (oldVNode.flag === VNODE_TYPE.ARRAYNODE) {\r\n (oldVNode).depArray = meta?.targetPropOldValue\r\n }\r\n // 对于数组节点后期需要记录它的响应式数组用于节点更新\r\n if (newVNode.flag === VNODE_TYPE.ARRAYNODE) {\r\n (newVNode).depArray = meta?.targetPropnewValue\r\n }\r\n\r\n callback(oldVNode, newVNode)\r\n watcher.value = newVNode\r\n activeVNode.vnode = newVNode\r\n })\r\n\r\n return watcher.value = standarVNode(watcher.value)\r\n}\r\n\r\n\r\n/**\r\n * 监控可变dom的prop\r\n*/\r\nexport function watchProp(activeProp: Activer, callback: (oldVNode: VNode, newVNode: VNode) => void): any {\r\n return new Watcher(activeProp, callback).value\r\n}","import { Vact } from \"../vact\"\r\nimport { watchProp } from \"../reactive\"\r\nimport { isActiver, isOnEvent, isFunction, isObject } from \"../utils\"\r\nimport { VElement } from \"../vnode/element\"\r\nimport { mountChildren } from \"./mount\"\r\nimport { patchElementProp } from \"./patch\"\r\n\r\n\r\n\r\nexport function mountElement(vnode: VElement, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n const el = document.createElement(vnode.type)\r\n vnode.el = el\r\n mountElementProps(vnode)\r\n mountChildren(vnode.children, el, undefined, app)\r\n container.insertBefore(el, anchor!)\r\n}\r\n\r\nexport function unmountElement(vnode: VElement, container: HTMLElement) {\r\n vnode.el.remove()\r\n}\r\n\r\nexport function mountElementProps(vnode: VElement) {\r\n let el = vnode.el\r\n let props = vnode.props\r\n\r\n // 处理标签属性\r\n for (let prop in props) {\r\n let value = props[prop]\r\n if (isActiver(value)) {\r\n let firstValue = watchProp(value, (oldValue, newValue) => patchElementProp(oldValue, newValue, el, prop))\r\n setElementProp(el, prop, firstValue)\r\n } else {\r\n setElementProp(el, prop, value)\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * 处理单个dom属性\r\n*/\r\nexport function setElementProp(el: HTMLElement, prop: string, value: any) {\r\n if (isOnEvent(prop) && isFunction(value)) {\r\n let pattern = /^on(.+)$/\r\n let result = prop.match(pattern)\r\n result && el.addEventListener(result[1].toLocaleLowerCase(), value.bind(el))\r\n return\r\n }\r\n\r\n switch (prop) {\r\n case 'className':\r\n el.className = String(value)\r\n break\r\n case 'style':\r\n if (isObject(value)) {\r\n value = mergeStyle(value)\r\n }\r\n default:\r\n el.setAttribute(prop, value)\r\n }\r\n}\r\n\r\n/**\r\n * 将对象形式的style转化为字符串\r\n*/\r\nexport function mergeStyle(style: Record): string {\r\n let styleStringList = []\r\n for (let cssAttr in style) {\r\n styleStringList.push(`${cssAttr}:${style[cssAttr]};`)\r\n }\r\n return styleStringList.join('')\r\n}","import { unmount, mount } from \"./mount\";\r\nimport { Vact } from \"../vact\";\r\nimport { VArrayNode } from \"../vnode/array\";\r\nimport { VText } from \"../vnode/text\";\r\nimport { VNode, VNODE_TYPE } from \"../vnode/vnode\";\r\nimport { setElementProp } from \"./element\";\r\n\r\nexport function isSameVNode(oldVNode: VNode, newVNode: VNode): boolean {\r\n return oldVNode.flag === newVNode.flag\r\n}\r\n\r\nexport function getNextSibling(vnode: VNode): HTMLElement | Text | undefined {\r\n switch (vnode.flag) {\r\n case VNODE_TYPE.TEXT:\r\n case VNODE_TYPE.ELEMENT:\r\n case VNODE_TYPE.ARRAYNODE:\r\n case VNODE_TYPE.FRAGMENT:\r\n return vnode.el!\r\n case VNODE_TYPE.ALIVE:\r\n return getNextSibling(vnode.vnode!)\r\n }\r\n}\r\n\r\nexport function patch(oldVNode: VNode, newVNode: VNode, container: HTMLElement, app?: Vact): void {\r\n\r\n // 如果两个节点引用一样不需要判断\r\n if (oldVNode === newVNode) return\r\n\r\n // 这里在判断相同类型的节点后可以做进一步优化\r\n if (isSameVNode(oldVNode, newVNode)) {\r\n let flag = oldVNode.flag = newVNode.flag\r\n\r\n if (flag === VNODE_TYPE.TEXT) {\r\n patchText(oldVNode, newVNode, container)\r\n } else if (flag === VNODE_TYPE.ARRAYNODE) {\r\n if (app?.options.arrayDiff) {\r\n patchArrayNodeT(oldVNode, newVNode, container)\r\n } else {\r\n patchArrayNode(oldVNode, newVNode, container)\r\n }\r\n } else {\r\n const nextSibling = oldVNode?.el?.nextSibling\r\n // const nextSibling = getNextSibling(oldVNode)\r\n unmount(oldVNode, container)\r\n mount(newVNode, container, nextSibling as HTMLElement | undefined)\r\n }\r\n\r\n } else {\r\n const nextSibling = oldVNode?.el?.nextSibling\r\n // const nextSibling = getNextSibling(oldVNode)\r\n unmount(oldVNode, container)\r\n mount(newVNode, container, nextSibling as HTMLElement | undefined)\r\n }\r\n\r\n}\r\n\r\nexport function patchText(oldVNode: VText, newVNode: VText, container: HTMLElement) {\r\n oldVNode.el!.nodeValue = newVNode.children\r\n newVNode.el = oldVNode.el\r\n}\r\n\r\nexport function patchElementProp(oldValue: any, newValue: any, el: HTMLElement, prop: string) {\r\n setElementProp(el, prop, newValue)\r\n}\r\n\r\nexport function patchArrayNodeT(oldVNode: VArrayNode, newVNode: VArrayNode, container: HTMLElement) {\r\n if (!oldVNode.depArray) {\r\n patchArrayNode(oldVNode, newVNode, container)\r\n return\r\n }\r\n\r\n const oldDepArray = oldVNode.depArray\r\n const newDepArray = newVNode.depArray\r\n const oldChildren = oldVNode.children\r\n const newChildren = newVNode.children\r\n\r\n if (!oldDepArray.length || !newDepArray.length) {\r\n patchArrayNode(oldVNode, newVNode, container)\r\n return\r\n }\r\n\r\n newVNode.anchor = oldVNode.anchor\r\n newVNode.el = oldVNode.el\r\n\r\n type NodeInfo = { node: VNode, index: number, used: boolean }\r\n // 为映射做初始化\r\n let map = new Map>()\r\n oldDepArray.forEach((item, index) => {\r\n let arr = map.get(item)\r\n if (!arr) map.set(item, arr = [])\r\n arr.push({ node: oldChildren[index], index, used: false })\r\n })\r\n\r\n let getOld = (item: any) => {\r\n let arr = map.get(item)\r\n if (!arr) return false\r\n\r\n let index = arr.findIndex(alone => !alone.used)\r\n\r\n if (index > -1) return arr[index]\r\n else return false\r\n }\r\n\r\n let moveOld = (item: any, node: NodeInfo) => {\r\n let arr = map.get(item)\r\n if (!arr) return\r\n\r\n let index = arr.findIndex(alone => alone === node)\r\n arr.splice(index, 1)\r\n }\r\n\r\n let maxIndexSoFar = { node: oldChildren[0], index: 0 }\r\n\r\n newDepArray.forEach((item, newIndex) => {\r\n let old = getOld(item)\r\n if (old) {\r\n if (old.index < maxIndexSoFar.index) {\r\n let next: ChildNode | null\r\n if (newIndex > 0) {\r\n next = newChildren[newIndex - 1].el!.nextSibling\r\n } else {\r\n next = maxIndexSoFar.node.el!.nextSibling\r\n }\r\n\r\n VNodeInsertBefore(container, old.node, next)\r\n // container.insertBefore(old.node.el!, next)\r\n } else {\r\n maxIndexSoFar = old\r\n }\r\n\r\n newChildren[newIndex] = old.node\r\n moveOld(item, old)\r\n } else {\r\n // let next = maxIndexSoFar.node.el!.nextSibling\r\n let next: ChildNode | null\r\n if (newIndex > 0) {\r\n next = newChildren[newIndex - 1].el!.nextSibling\r\n } else {\r\n next = maxIndexSoFar.node.el!.nextSibling\r\n }\r\n\r\n let newNode = newChildren[newIndex]\r\n mount(newNode, container, next as HTMLElement | undefined)\r\n // maxIndexSoFar = { node: newNode, index: maxIndexSoFar.index + 1 }\r\n }\r\n })\r\n\r\n\r\n map.forEach(value => {\r\n value.forEach(item => {\r\n if (!item.used) {\r\n unmount(item.node, container)\r\n }\r\n })\r\n })\r\n}\r\n\r\nfunction patchArrayNode(oldVNode: VArrayNode, newVNode: VArrayNode, container: HTMLElement) {\r\n const nextSibling = oldVNode.el.nextSibling\r\n unmount(oldVNode, container)\r\n mount(newVNode, container, nextSibling as HTMLElement | undefined)\r\n}\r\n\r\nfunction VNodeInsertBefore(container: HTMLElement, node: VNode, next: HTMLElement | undefined | Text | ChildNode | null) {\r\n if (node.flag === VNODE_TYPE.ELEMENT || node.flag === VNODE_TYPE.TEXT) {\r\n container.insertBefore(node.el!, next!)\r\n } else if (node.flag === VNODE_TYPE.ARRAYNODE || node.flag === VNODE_TYPE.FRAGMENT) {\r\n let start: ChildNode | null | undefined = node.anchor\r\n let nextToMove = start?.nextSibling\r\n let end: ChildNode | null | undefined = node.el\r\n while (start !== end) {\r\n container.insertBefore(start!, next!)\r\n start = nextToMove\r\n nextToMove = start?.nextSibling\r\n }\r\n container.insertBefore(end!, next!)\r\n }\r\n}","import { patch } from \"./patch\";\r\nimport { watchVNode } from \"../reactive/watch\";\r\nimport { Vact } from \"../vact\";\r\nimport { VAlive } from \"../vnode/alive\";\r\nimport { VArrayNode } from \"../vnode/array\";\r\nimport { VComponent } from \"../vnode/component\";\r\nimport { VElement } from \"../vnode/element\";\r\nimport { VFragment } from \"../vnode/fragment\";\r\nimport { VText } from '../vnode/text'\r\nimport { VNode, VNODE_TYPE } from \"../vnode/vnode\";\r\nimport { mountElement, unmountElement } from \"./element\";\r\n\r\nexport function mount(vnode: VNode, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n switch (vnode.flag) {\r\n case VNODE_TYPE.ELEMENT:\r\n mountElement(vnode as VElement, container, anchor, app)\r\n break\r\n case VNODE_TYPE.TEXT:\r\n mountText(vnode as VText, container, anchor)\r\n break\r\n case VNODE_TYPE.FRAGMENT:\r\n mountFragment(vnode as VFragment, container, anchor, app)\r\n break\r\n case VNODE_TYPE.ARRAYNODE:\r\n mountArrayNode(vnode as VArrayNode, container, anchor, app)\r\n break\r\n // case VNODE_TYPE.COMPONENT:\r\n // mountComponent(vnode as VComponent, container, anchor, app)\r\n // break\r\n case VNODE_TYPE.ALIVE:\r\n mountAlive(vnode as VAlive, container, anchor, app)\r\n break\r\n }\r\n}\r\n\r\nexport function unmount(vnode: VNode, container: HTMLElement) {\r\n switch (vnode.flag) {\r\n case VNODE_TYPE.ELEMENT:\r\n unmountElement(vnode as VElement, container)\r\n break\r\n case VNODE_TYPE.TEXT:\r\n unmountText(vnode as VText, container)\r\n break\r\n case VNODE_TYPE.FRAGMENT:\r\n unmountFragment(vnode as VFragment, container)\r\n break\r\n case VNODE_TYPE.ARRAYNODE:\r\n unmountArrayNode(vnode as VArrayNode, container)\r\n break\r\n // case VNODE_TYPE.COMPONENT:\r\n // unmountComponent(vnode as VComponent, container)\r\n // break\r\n }\r\n}\r\n\r\nexport function mountChildren(children: Array, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n children.forEach(child => mount(child, container, anchor, app))\r\n}\r\n\r\nexport function mountText(vnode: VText, container: HTMLElement, anchor?: HTMLElement) {\r\n const el = document.createTextNode(vnode.children)\r\n vnode.el = el\r\n container.insertBefore(el, anchor!)\r\n}\r\n\r\nexport function unmountText(vnode: VText, container: HTMLElement) {\r\n vnode.el.remove()\r\n}\r\n\r\nexport function mountFragment(vnode: VFragment, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n const start = document.createTextNode('')\r\n const end = document.createTextNode('')\r\n vnode.anchor = start\r\n vnode.el = end\r\n container.insertBefore(start, anchor!)\r\n mountChildren(vnode.children, container, anchor, app)\r\n container.insertBefore(end, anchor!)\r\n}\r\n\r\nexport function unmountFragment(vnode: VFragment, container: HTMLElement) {\r\n const start = vnode.anchor\r\n const end = vnode.el\r\n let cur: ChildNode | null = start\r\n while (cur && cur !== end) {\r\n let next: ChildNode | null = cur.nextSibling\r\n cur.remove()\r\n cur = next\r\n }\r\n end.remove()\r\n}\r\n\r\nexport function mountArrayNode(vnode: VArrayNode, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n const start = document.createTextNode('')\r\n const end = document.createTextNode('')\r\n vnode.anchor = start\r\n vnode.el = end\r\n container.insertBefore(start, anchor!)\r\n mountChildren(vnode.children, container, anchor, app)\r\n container.insertBefore(end, anchor!)\r\n}\r\n\r\nexport function unmountArrayNode(vnode: VArrayNode, container: HTMLElement, anchor?: HTMLElement) {\r\n const start = vnode.anchor\r\n const end = vnode.el\r\n let cur: ChildNode | null = start\r\n while (cur && cur !== end) {\r\n let next: ChildNode | null = cur.nextSibling\r\n cur.remove()\r\n cur = next\r\n }\r\n end.remove()\r\n}\r\n\r\n// export function mountComponent(vnode: VComponent, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n// console.log(1111);\r\n\r\n// const root = vnode.type.render(render)\r\n// vnode.root = root\r\n// mount(root, container, anchor, app)\r\n// vnode.el = root.el!\r\n// }\r\n\r\n// export function unmountComponent(vnode: VComponent, container: HTMLElement) {\r\n// unmount(vnode.root, container)\r\n// }\r\n\r\nexport function mountAlive(vnode: VAlive, container: HTMLElement, anchor?: HTMLElement, app?: Vact) {\r\n let firstVNode = watchVNode(vnode, (oldVNode, newVNode) => patch(oldVNode, newVNode, container, app))\r\n vnode.vnode = firstVNode\r\n mount(firstVNode, container, anchor, app)\r\n}","import { defineState } from \"./reactive\"\r\nimport { H } from './render'\r\nimport { VNode } from \"./vnode/vnode\"\r\n\r\n/**\r\n * 根类组件(向下兼容)\r\n * 已废弃\r\n*/\r\n\r\ninterface Config {\r\n data?: Record\r\n}\r\n\r\nexport abstract class Component {\r\n // 组件配置\r\n private config: Config\r\n // 组件响应式数据\r\n public data: Record\r\n // 组件属性\r\n props?: Record\r\n // 组件子元素\r\n children?: Record\r\n\r\n constructor(config: Config = {}) {\r\n this.config = config\r\n this.data = defineState(config.data || {})\r\n }\r\n\r\n abstract render(h: H): VNode\r\n}","import { mount } from \"./mount/mount\";\r\nimport { defineState, state } from \"./reactive\";\r\nimport { RefImpl } from \"./reactive/ref\";\r\nimport { render } from \"./render\";\r\nimport { VNode } from \"./vnode/vnode\";\r\nimport { H } from './render'\r\n\r\nexport interface Options {\r\n arrayDiff?: boolean\r\n}\r\n\r\nexport interface VactUtils {\r\n state(value: T): RefImpl\r\n defineState>(target: T): T\r\n h: H\r\n}\r\n\r\nexport interface VactPlugin {\r\n install(utils: VactUtils): void\r\n}\r\n\r\nexport class Vact {\r\n rootVNode: VNode\r\n options: Options\r\n\r\n constructor(vnode: VNode, options?: Options) {\r\n this.rootVNode = vnode\r\n this.options = options || {}\r\n }\r\n\r\n mount(selector: string): void {\r\n const el = document.querySelector(selector)\r\n let container = document.createElement('div')\r\n mount(this.rootVNode, container, undefined, this)\r\n el?.replaceWith(...container.childNodes)\r\n }\r\n\r\n use(plugin: VactPlugin) {\r\n const utils: VactUtils = { state, defineState, h: render }\r\n plugin.install(utils)\r\n return this\r\n }\r\n}\r\n\r\nexport function createApp(vnode: VNode, options?: Options): Vact {\r\n return new Vact(vnode, options)\r\n}\r\n\r\n"],"names":[],"mappings":"AAGA;;AAEE;AACF,IAAY,UASX,CAAA;AATD,CAAA,UAAY,UAAU,EAAA;;AAEpB,IAAA,UAAA,CAAA,UAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAO,CAAA;;AAEP,IAAA,UAAA,CAAA,UAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;AACJ,IAAA,UAAA,CAAA,UAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAQ,CAAA;AACR,IAAA,UAAA,CAAA,UAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS,CAAA;AACT,IAAA,UAAA,CAAA,UAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS,CAAA;AACT,IAAA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A;QACpB,MAAM,KAAK,GAAc,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,CAAA;AAC1D,QAAA,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AACrB,QAAA,OAAO,IAAI,CAAA;KACZ;AACF,CAAA;AAEe,SAAA,SAAS,CAAC,KAAY,EAAE,OAAiB,EAAA;AACvD,IAAA,OAAO,IAAI,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;AACjC;;;;"} \ No newline at end of file +{"version":3,"file":"bundle.esm.js","sources":["../src/vnode/text.ts","../src/vnode/fragment.ts","../src/vnode/component.ts","../src/vnode/array.ts","../src/vnode/alive.ts","../src/vnode/vnode.ts","../src/utils.ts","../src/reactive/update.ts","../src/reactive/reactive.ts","../src/reactive/ref.ts","../src/reactive/utils.ts","../src/reactive/active.ts","../src/lifeCycle.ts","../src/plugin.ts","../src/render.ts","../src/reactive/watch.ts","../src/mount/element.ts","../src/mount/patch.ts","../src/mount/mount.ts","../src/component.ts","../src/app.ts"],"sourcesContent":["import {VNode, VNODE_TYPE, VNodeElement} from \"./vnode\";\r\n\r\n\r\nexport const TextSymbol = Symbol('Text');\r\nexport interface VText extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n\r\n // 虚拟节点子节点\r\n children: string,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.TEXT\r\n\r\n el: Text\r\n\r\n}\r\n","import {VNode, VNODE_TYPE, VNodeElement} from \"./vnode\";\r\n\r\nexport const FragmentSymbol = Symbol('Fragment');\r\nexport interface VFragment extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n\r\n // 虚拟节点子节点\r\n children: Array,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.FRAGMENT\r\n\r\n // 锚点\r\n anchor: Text,\r\n el: Text\r\n\r\n}\r\n","import {VNode, VNODE_TYPE, OriginVNode, VNodeProps} from \"./vnode\";\r\nimport { ComponentLifeCycle } from '../lifeCycle'\r\nimport { ComponentInstance } from '../component'\r\nimport {AppUtils} from '../plugin'\r\n\r\nexport interface ComponentContext {\r\n props: Record\r\n children: Array\r\n life: ComponentLifeCycle\r\n utils: AppUtils\r\n}\r\n\r\n/** 函数组件类型 */\r\nexport interface FunctionComponentType {\r\n (context: ComponentContext): OriginVNode\r\n}\r\n\r\n/** 类组件类型 */\r\nexport interface ClassComponentType {\r\n new (props: Record, children: Array): ComponentInstance\r\n}\r\n\r\nexport type ComponentType = FunctionComponentType | ClassComponentType\r\n\r\nexport const VComponentSymbol = Symbol('VComponent')\r\nexport type VComponentType = typeof VComponentSymbol\r\n\r\nexport interface VComponent extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: VComponentType,\r\n\r\n // 虚拟节点属性\r\n props: VNodeProps,\r\n\r\n // 虚拟节点子节点\r\n children: Array,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.COMPONENT\r\n\r\n root: VNode,\r\n\r\n lifeStyleInstance: ComponentLifeCycle\r\n\r\n}\r\n\r\n","import {VNode, VNODE_TYPE, VNodeElement} from \"./vnode\";\r\n\r\nexport const ArraySymbol = Symbol('ArrayNode');\r\nexport type VArrayType = typeof ArraySymbol\r\nexport interface VArrayNode extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n\r\n // 虚拟节点子节点\r\n children: Array,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.ARRAYNODE\r\n\r\n // 锚点\r\n anchor: Text,\r\n el: Text,\r\n\r\n // 记录当前数组节点依赖的响应式数组\r\n depArray: Array\r\n}\r\n","import { Activer } from \"../reactive\"\r\nimport { VNode, VNODE_TYPE, OriginVNode } from \"./vnode\"\r\n\r\nexport const AliveSymbol = Symbol('Alive')\r\nexport type VAliveType = typeof AliveSymbol\r\nexport interface VAlive extends VNode {\r\n\r\n // 虚拟节点类型\r\n type: symbol,\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE.ELEMENT\r\n\r\n activer: Activer\r\n // 目前存在的节点\r\n vnode: VNode\r\n}\r\n","import { Activer } from \"../reactive\"\r\nimport { ComponentType } from './component'\r\n\r\n/**\r\n * 虚拟dom节点类型枚举\r\n*/\r\nexport enum VNODE_TYPE {\r\n // 普通元素节点类型\r\n ELEMENT,\r\n // 文本节点类型\r\n TEXT,\r\n FRAGMENT,\r\n COMPONENT,\r\n ARRAYNODE,\r\n ALIVE\r\n}\r\n\r\nexport type VNodeElement = ChildNode\r\n\r\n/**\r\n * 虚拟dom接口类型\r\n*/\r\nexport interface VNode {\r\n\r\n // 虚拟节点类型\r\n type: string | symbol | ComponentType,\r\n\r\n // 虚拟节点表标识\r\n flag: VNODE_TYPE\r\n\r\n // 虚拟节点属性\r\n props?: Record,\r\n\r\n // 虚拟节点子节点\r\n children?: Array | string,\r\n\r\n // 真实节点\r\n el?: VNodeElement\r\n anchor?: VNodeElement\r\n\r\n activer?: Activer\r\n // 目前存在的节点\r\n vnode?: VNode\r\n\r\n}\r\n\r\n// 未经过标准化的childVNode类型\r\nexport type NotFunctionOriginVNode= string | VNode | Array | Activer\r\nexport type WithFunctionOriginVNode= (() => OriginVNode) | NotFunctionOriginVNode\r\nexport type OriginVNode= WithFunctionOriginVNode | Exclude\r\n\r\n/** 虚拟节点属性 todo */\r\nexport interface VNodeProps {\r\n [propName: string]: any\r\n}\r\n\r\n","import { VNode, VNODE_TYPE } from './vnode'\r\nimport { Activer } from './reactive'\r\nimport { FragmentSymbol, TextSymbol, ArraySymbol } from './vnode'\r\n\r\nexport function isString(content: unknown): content is string {\r\n return typeof content === 'string'\r\n}\r\n\r\nexport function isFunction(content: unknown): content is Function {\r\n return typeof content === 'function'\r\n}\r\n\r\nexport function isFragment(content: unknown): boolean {\r\n return content === FragmentSymbol\r\n}\r\n\r\nexport function isArrayNode(content: unknown): boolean {\r\n return content === ArraySymbol\r\n}\r\n\r\nexport function isText(content: unknown): boolean {\r\n return content === TextSymbol\r\n}\r\n\r\nexport function isActiver(content: unknown): content is Activer {\r\n return isObject(content) && (content as Record).flag === 'activer'\r\n}\r\n\r\nexport function isVNode(content: unknown): content is VNode {\r\n return isObject(content) && (content as Record).flag in VNODE_TYPE\r\n}\r\n\r\nexport function isObjectExact(content: unknown): content is Object {\r\n return isObject(content) && content.constructor === Object\r\n}\r\n\r\nexport function isOnEvent(str: string): boolean {\r\n return /^on.+$/.test(str)\r\n}\r\n\r\nexport function isObject(content: unknown): content is object {\r\n return typeof content === 'object' && content !== null\r\n}\r\n\r\n\r\nexport function isArray(content: unknown): content is Array {\r\n return Array.isArray(content)\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n","import { Watcher } from \"./watch\";\r\n\r\nlet updating = false\r\nconst watcherTask: Array = []\r\n\r\nexport function runUpdate(watcher: Watcher) {\r\n let index: number = watcherTask.indexOf(watcher)\r\n if (!(index > -1)) watcherTask.push(watcher)\r\n if (!updating) {\r\n updating = true\r\n Promise.resolve()\r\n .then(() => {\r\n let watcher: Watcher | undefined = undefined\r\n while (watcher = watcherTask.shift()) {\r\n watcher.update()\r\n }\r\n }).finally(() => {\r\n updating = false\r\n })\r\n }\r\n}","import { isArray, isObjectExact, isVNode } from \"../utils\"\r\nimport { Watcher } from \"./watch\"\r\nimport { runUpdate } from './update'\r\n\r\n// 目标对象到映射对象\r\nconst targetMap = new WeakMap()\r\n// 全局变量watcher\r\nlet activeWatcher: Watcher | null = null\r\nconst REACTIVE = Symbol('reactive')\r\n\r\n/**\r\n * 实现响应式对象\r\n*/\r\nexport function reactive>(target: T): T {\r\n if (target[REACTIVE]) return target\r\n\r\n let handler: ProxyHandler = {\r\n get(target, prop, receiver) {\r\n if (prop === REACTIVE) return true\r\n const res = Reflect.get(target, prop, receiver)\r\n\r\n if (isObjectExact(res) && !isVNode(res)) {\r\n return reactive(res)\r\n }\r\n\r\n if (Array.isArray(res)) {\r\n track(target, prop)\r\n return reactiveArray(res, target, prop)\r\n }\r\n\r\n track(target, prop)\r\n return res\r\n },\r\n\r\n set(target, prop, value, receiver) {\r\n const res = Reflect.set(target, prop, value, receiver)\r\n trigger(target, prop)\r\n return res\r\n }\r\n }\r\n\r\n return new Proxy(target, handler)\r\n}\r\n\r\n/**\r\n * 设置响应式数组\r\n*/\r\nfunction reactiveArray(targetArr: Array, targetObj: Record, Arrprop: string | symbol) {\r\n let handler: ProxyHandler> = {\r\n get(target, prop, receiver) {\r\n const res = Reflect.get(target, prop, receiver)\r\n\r\n if (isObjectExact(res)) {\r\n return reactive(res)\r\n }\r\n\r\n return res\r\n },\r\n set(target, prop, value, receiver) {\r\n const res = Reflect.set(target, prop, value, receiver)\r\n trigger(targetObj, Arrprop)\r\n return res\r\n }\r\n }\r\n\r\n return new Proxy(targetArr, handler)\r\n}\r\n\r\n/**\r\n * 响应触发依赖\r\n*/\r\nexport function trigger(target: Record, prop: string | symbol) {\r\n let mapping: Record> = targetMap.get(target)\r\n if (!mapping) return\r\n\r\n let mappingProp: Array = mapping[prop]\r\n if (!mappingProp) return\r\n\r\n // mappingProp.forEach(watcher => watcher.update(oldValue, newValue))\r\n mappingProp.forEach(watcher => {\r\n // 针对于对数组响应做特殊处理\r\n if (isArray(target[prop])) {\r\n watcher.nextDepArr = target[prop]\r\n }\r\n runUpdate(watcher)\r\n })\r\n}\r\n\r\n/**\r\n * 追踪绑定依赖\r\n*/\r\nexport function track(target: Record, prop: string | symbol) {\r\n if (!activeWatcher) return\r\n\r\n let mapping: Record> = targetMap.get(target)\r\n if (!mapping) targetMap.set(target, mapping = {})\r\n\r\n let mappingProp: Array = mapping[prop]\r\n if (!mappingProp) mappingProp = mapping[prop] = []\r\n\r\n // 针对于对数组响应做特殊处理\r\n if (isArray(target[prop])) {\r\n if (activeWatcher.depArr) {\r\n activeWatcher.depArr = false\r\n } else {\r\n if (activeWatcher.depArr === undefined) {\r\n activeWatcher.depArr = target[prop].slice()\r\n }\r\n }\r\n }\r\n\r\n mappingProp.push(activeWatcher)\r\n}\r\n\r\n// 设置全局变量\r\nexport function setActiver(fn: Watcher | null) {\r\n activeWatcher = fn\r\n}\r\n// 设置全局变量\r\nexport function getActiver(): Watcher | null {\r\n return activeWatcher\r\n}\r\n\r\n","import { track, trigger } from './reactive'\r\n\r\nexport class RefImpl {\r\n private _value: T\r\n private readonly _target: Record\r\n\r\n constructor(value: T) {\r\n this._value = value\r\n this._target = { value: this._value }\r\n }\r\n\r\n get value() {\r\n track(this._target, 'value')\r\n return this._value\r\n }\r\n\r\n set value(value) {\r\n this._value = value\r\n this._target.value = this._value\r\n trigger(this._target, 'value')\r\n }\r\n}\r\n\r\n\r\nexport function ref(value: T): RefImpl {\r\n return new RefImpl(value)\r\n}","import { ref } from './ref'\r\nimport { reactive } from './reactive'\r\n\r\n\r\nexport function state(value: T) {\r\n return ref(value)\r\n}\r\n\r\nexport function defineState>(target: T): T {\r\n return reactive(target)\r\n}\r\n\r\n\r\n\r\n\r\n\r\n","\r\n/**\r\n * 响应式对象\r\n*/\r\nexport class Activer {\r\n callback: () => T\r\n flag: string = 'activer'\r\n\r\n constructor(fn: () => T) {\r\n this.callback = fn\r\n }\r\n\r\n get value(): T {\r\n return this.callback()\r\n }\r\n}\r\n\r\n/**\r\n * 外置函数\r\n*/\r\nexport function active(fn: () => T): Activer {\r\n return new Activer(fn)\r\n}\r\n\r\n","import { ComponentInstance } from './component'\r\n\r\n/**\r\n * 主要实现关于组件的生命周期\r\n */\r\n\r\n\r\nexport interface ComponentLifeCycleInstance {\r\n\r\n /** 组件示例创建之后触发 */\r\n created(fn: () => void): void\r\n\r\n /** 组件示例在渲染之前触发(DOM还没有生成) */\r\n beforeMounted(fn: () => void): void\r\n\r\n /** dom已经生成到js内存但还没挂载 */\r\n readyMounted(fn: () => void): void\r\n\r\n /** dom挂载到了页面上*/\r\n mounted(fn: () => void): void\r\n\r\n /** 卸载之前触发 */\r\n beforeUnMounted(fn: () => void):void\r\n\r\n /** 卸载之后触发 */\r\n unMounted(fn: () => void):void\r\n}\r\n\r\ntype LifeCycleNames = T extends string ? `${T}List` : never\r\ntype GetCycleName = T extends `${infer U}List` ? U : never\r\n\r\n\r\n\r\nexport class ComponentLifeCycle implements ComponentLifeCycleInstance {\r\n\r\n\r\n constructor(\r\n private readonly createdList: Array<() => void> = [],\r\n private readonly beforeMountedList: Array<() => void> = [],\r\n private readonly readyMountedList: Array<() => void> = [],\r\n private readonly mountedList: Array<() => void> = [],\r\n private readonly beforeUnMountedList: Array<() => void> = [],\r\n private readonly unMountedList: Array<() => void> = []\r\n ) {\r\n // this.createdList = []\r\n // this.beforeMountedList = []\r\n // this.readyMountedList = []\r\n // this.mountedList = []\r\n // this.beforeUnMountedList = []\r\n // this.unMountedList = []\r\n }\r\n\r\n created(fn: () => void): void {\r\n this.createdList.push(fn)\r\n }\r\n\r\n beforeMounted(fn: () => void): void {\r\n this.beforeMountedList.push(fn)\r\n }\r\n\r\n readyMounted(fn: () => void): void {\r\n this.readyMountedList.push(fn)\r\n }\r\n\r\n mounted(fn: () => void): void {\r\n this.mountedList.push(fn)\r\n }\r\n\r\n beforeUnMounted(fn: () => void): void {\r\n this.beforeUnMountedList.push(fn)\r\n }\r\n\r\n unMounted(fn: () => void): void {\r\n this.unMountedList.push(fn)\r\n }\r\n\r\n emit(lifeName: keyof ComponentLifeCycleInstance) {\r\n this[`${lifeName}List`].forEach(fn => fn())\r\n }\r\n\r\n}\r\n\r\n// 生成类组件生命周期实例\r\nexport function createClassComponentLife(component: ComponentInstance) {\r\n let lifeNames: [\r\n 'created',\r\n 'beforeMounted',\r\n 'readyMounted',\r\n 'mounted',\r\n 'beforeUnMounted',\r\n 'unMounted'\r\n ] = ['created', 'beforeMounted', 'readyMounted', 'mounted', 'beforeUnMounted', 'unMounted']\r\n\r\n let lifeCycle = new ComponentLifeCycle()\r\n component.life = lifeCycle\r\n\r\n lifeNames.forEach(lifeName => {\r\n let fn = component[lifeName]\r\n if(!fn) return\r\n lifeCycle[lifeName](fn.bind(component))\r\n })\r\n\r\n return lifeCycle\r\n}\r\n\r\n\r\n","import {\r\n state,\r\n defineState,\r\n watch\r\n} from \"./reactive\";\r\nimport { renderApi as h } from \"./render\";\r\n\r\n// todo\r\n\r\n// 实现插件功能\r\n\r\nexport interface AppUtils {\r\n state: typeof state\r\n defineState: typeof defineState\r\n h: typeof h\r\n watch: typeof watch\r\n}\r\n\r\nexport interface AppContext {\r\n utils: AppUtils\r\n}\r\n\r\nexport interface AppPlugin {\r\n install(utils: AppContext): void\r\n}\r\n\r\n// 给插件提供的能力\r\nexport const appUtils: AppUtils = {\r\n state,\r\n defineState,\r\n h,\r\n watch\r\n}\r\n","import {active} from \"./reactive\";\r\nimport {Activer} from './reactive'\r\nimport {\r\n isActiver,\r\n isArray,\r\n isArrayNode,\r\n isFragment,\r\n isFunction,\r\n isOnEvent,\r\n isString,\r\n isText,\r\n isVNode} from \"./utils\";\r\nimport {\r\n ClassComponentType,\r\n ComponentType,\r\n FunctionComponentType,\r\n VComponent\r\n} from \"./vnode\";\r\nimport {\r\n OriginVNode,\r\n VNode,\r\n VNODE_TYPE,\r\n VNodeProps\r\n} from \"./vnode\";\r\nimport {\r\n ArraySymbol,\r\n AliveSymbol,\r\n TextSymbol,\r\n FragmentSymbol,\r\n VComponentSymbol\r\n} from \"./vnode\";\r\nimport {ComponentLifeCycle, createClassComponentLife} from \"./lifeCycle\";\r\nimport {appUtils} from \"./plugin\";\r\n\r\n/**\r\n * 传说中的render函数\r\n*/\r\n\r\nexport type HSymbol = typeof TextSymbol | typeof FragmentSymbol | typeof AliveSymbol | typeof ArraySymbol\r\nexport type HType = string | HSymbol | ComponentType\r\nexport type H = (type: HType, props?: VNodeProps, children?: OriginVNode | Array) => VNode\r\n\r\n/**\r\n * 函数转化为activer转化为VAlive\r\n * activer转化为VAlive\r\n * string转化为VText\r\n * 数组转化为VArray\r\n * 其他转化为VText\r\n*/\r\nexport function createVNode(originVNode: OriginVNode): VNode {\r\n if (isVNode(originVNode)) return originVNode\r\n\r\n if (isFunction(originVNode)) return renderAlive(active(originVNode))\r\n else if (isActiver(originVNode)) return renderAlive(originVNode)\r\n else if (isString(originVNode)) return renderText(originVNode)\r\n else if (isArray(originVNode)) return renderArrayNode(originVNode.map(item => createVNode(item)))\r\n else {\r\n // todo\r\n let value = originVNode\r\n let retText: VNode\r\n if (!value && typeof value !== 'number') retText = renderText('')\r\n else retText = renderText(String(value))\r\n return retText\r\n }\r\n}\r\n\r\n\r\n/**\r\n * text(不需要props)、fragment(不需要props)、element、component为显性创建\r\n * array(不需要props)、alive(不需要props)为隐形创建\r\n*/\r\nexport function renderApi(type: HType, props?: VNodeProps | null, children?: OriginVNode | Array): VNode {\r\n return render(type, props || undefined, children)\r\n}\r\n\r\nexport function render(type: HType, originProps?: VNodeProps, originChildren?: OriginVNode | Array): VNode {\r\n // text的children比较特殊先处理\r\n if (isText(type)) {\r\n return renderText(String(originChildren))\r\n }\r\n\r\n // 预处理 处理为单个的children\r\n let originChildrenList: Array = []\r\n if (isArray(originChildren)) originChildrenList.push(...originChildren)\r\n else originChildrenList.push(originChildren)\r\n // 创建VNode列表\r\n let vNodeChildren: Array = originChildrenList.map(originChild => createVNode(originChild))\r\n\r\n // 属性预处理\r\n let props: VNodeProps = originProps || {}\r\n handleProps(props)\r\n\r\n if (isString(type)) return renderElement(type, props , vNodeChildren)\r\n if (isFragment(type)) return renderFragment(vNodeChildren)\r\n if (isArrayNode(type)) return renderArrayNode(vNodeChildren)\r\n if (isFunction(type)) return renderComponent(type, props, vNodeChildren)\r\n throw '传入参数不合法'\r\n}\r\n\r\n\r\n/**\r\n * 对属性进行预处理\r\n */\r\nfunction handleProps(originProps: VNodeProps): VNodeProps {\r\n for (const prop in originProps) {\r\n // 以on开头的事件不需要处理\r\n if (\r\n !isOnEvent(prop) &&\r\n isFunction(originProps[prop])\r\n ) {\r\n // 如不为on且为函数则判断为响应式\r\n originProps[prop] = active(originProps[prop])\r\n }\r\n }\r\n\r\n return originProps\r\n}\r\n\r\nfunction renderText(text: string): VNode {\r\n return {\r\n type: TextSymbol,\r\n flag: VNODE_TYPE.TEXT,\r\n children: text\r\n }\r\n}\r\n\r\nfunction renderElement(tag: string, props: Record, children: Array): VNode {\r\n return {\r\n type: tag,\r\n flag: VNODE_TYPE.ELEMENT,\r\n props,\r\n children\r\n }\r\n}\r\n\r\nfunction renderFragment(children: Array): VNode {\r\n return {\r\n type: FragmentSymbol,\r\n flag: VNODE_TYPE.FRAGMENT,\r\n children\r\n }\r\n}\r\n\r\nfunction renderArrayNode(children: Array): VNode {\r\n return {\r\n type: ArraySymbol,\r\n flag: VNODE_TYPE.ARRAYNODE,\r\n children\r\n }\r\n}\r\n\r\nfunction createComponentProps(props: VNodeProps): VNodeProps {\r\n let componentProps:VNodeProps = {}\r\n for (const prop in props) {\r\n let curProp = props[prop]\r\n if (isActiver(curProp)) {\r\n Object.defineProperty(componentProps, prop, {\r\n get() {\r\n return (curProp as Activer).value\r\n }\r\n })\r\n } else {\r\n componentProps[prop] = curProp\r\n }\r\n }\r\n\r\n return componentProps\r\n}\r\n\r\n// 渲染一个活跃的节点\r\nfunction renderAlive(activer: Activer): VNode {\r\n return {\r\n type: AliveSymbol,\r\n flag: VNODE_TYPE.ALIVE,\r\n activer\r\n }\r\n}\r\n\r\n// 判断是普通函数还是构造函数\r\nfunction renderComponent(component: ComponentType, props: VNodeProps, children: Array): VComponent {\r\n let componentProps = createComponentProps(props)\r\n\r\n if (\r\n component.prototype &&\r\n component.prototype.render &&\r\n isFunction(component.prototype.render)\r\n ) {\r\n let ClassComponent = component as ClassComponentType\r\n let result = new ClassComponent(componentProps, children)\r\n\r\n result.props = componentProps\r\n result.children = children\r\n\r\n let lifeCycle = createClassComponentLife(result)\r\n\r\n let vn = result.render(renderApi)\r\n lifeCycle.emit('created')\r\n let vc: VComponent = {\r\n type: VComponentSymbol,\r\n root: createVNode(vn),\r\n props: componentProps,\r\n children: children,\r\n flag: VNODE_TYPE.COMPONENT,\r\n lifeStyleInstance: lifeCycle\r\n }\r\n\r\n lifeCycle.emit('beforeMounted')\r\n\r\n return vc\r\n } else {\r\n let FunctionComponent = component as FunctionComponentType\r\n let lifeCycle = new ComponentLifeCycle()\r\n let vn = FunctionComponent({props: componentProps, children: children, life: lifeCycle, utils: appUtils})\r\n lifeCycle.emit('created')\r\n let vc: VComponent = {\r\n type: VComponentSymbol,\r\n root: createVNode(vn),\r\n props: componentProps,\r\n children: children,\r\n flag: VNODE_TYPE.COMPONENT,\r\n lifeStyleInstance: lifeCycle\r\n }\r\n\r\n lifeCycle.emit('beforeMounted')\r\n return vc\r\n }\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n","import { setActiver } from \"./reactive\"\r\nimport { active, Activer } from './active'\r\nimport { VNode, VNODE_TYPE, OriginVNode } from \"../vnode\"\r\nimport { isActiver } from \"../utils\"\r\nimport { createVNode } from \"../render\"\r\nimport { VArrayNode } from \"../vnode\"\r\nimport { VAlive } from \"../vnode\"\r\n\r\ntype Meta = {\r\n targetPropOldValue: any,\r\n targetPropnewValue: any\r\n}\r\n\r\n/**\r\n * 观察者\r\n * 观察数据的变化\r\n*/\r\nexport class Watcher {\r\n value: T\r\n callback: (oldValue: T, newValue: T, meta?: Meta) => void\r\n activeProps: Activer\r\n depArr?: Array | false\r\n nextDepArr?: Array\r\n\r\n constructor(activeProps: Activer, callback: (oldValue: T, newValue: T, meta?: Meta) => void) {\r\n setActiver(this)\r\n this.value = activeProps.value\r\n this.callback = callback\r\n this.activeProps = activeProps\r\n setActiver(null)\r\n }\r\n\r\n update() {\r\n let newValue = this.activeProps.value\r\n let oldValue = this.value\r\n this.value = newValue\r\n let meta = { targetPropOldValue: this.depArr, targetPropnewValue: this.nextDepArr }\r\n this.callback(oldValue, newValue, meta)\r\n this.depArr = this.nextDepArr?.slice()\r\n }\r\n}\r\n\r\n\r\n/**\r\n * 监控自定义响应式属性\r\n*/\r\nexport function watch(activeProps: (() => T) | Activer, callback: (oldValue: T, newValue: T) => void): Watcher {\r\n if (!isActiver(activeProps)) activeProps = active(activeProps)\r\n return new Watcher(activeProps, function (oldValue: T, newValue: T) {\r\n callback(oldValue, newValue)\r\n })\r\n}\r\n\r\n/**\r\n * 监控可变状态dom\r\n*/\r\nexport function watchVNode(activeVNode: VAlive, callback: (oldVNode: VNode, newVNode: VNode) => void): VNode {\r\n let watcher = new Watcher(activeVNode.activer, function (oldValue: OriginVNode, newValue: OriginVNode, meta) {\r\n const oldVNode = oldValue as VNode\r\n const newVNode = createVNode(newValue)\r\n\r\n // 对于数组节点后期需要记录它的响应式数组用于节点更新\r\n if (oldVNode.flag === VNODE_TYPE.ARRAYNODE) {\r\n (oldVNode).depArray = meta?.targetPropOldValue\r\n }\r\n // 对于数组节点后期需要记录它的响应式数组用于节点更新\r\n if (newVNode.flag === VNODE_TYPE.ARRAYNODE) {\r\n (newVNode).depArray = meta?.targetPropnewValue\r\n }\r\n\r\n callback(oldVNode, newVNode)\r\n watcher.value = newVNode\r\n activeVNode.vnode = newVNode\r\n })\r\n\r\n return watcher.value = createVNode(watcher.value)\r\n}\r\n\r\n\r\n/**\r\n * 监控可变dom的prop\r\n*/\r\nexport function watchProp(activeProp: Activer, callback: (oldVNode: VNode, newVNode: VNode) => void): any {\r\n return new Watcher(activeProp, callback).value\r\n}\r\n","import { App } from \"../app\"\r\nimport { watchProp } from \"../reactive\"\r\nimport { isActiver, isOnEvent, isFunction, isObject } from \"../utils\"\r\nimport {VElement, VNodeElement} from \"../vnode\"\r\nimport { mountChildren } from \"./mount\"\r\nimport { patchElementProp } from \"./patch\"\r\n\r\n\r\n\r\nexport function mountElement(vnode: VElement, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n const el = document.createElement(vnode.type)\r\n vnode.el = el\r\n mountElementProps(vnode)\r\n mountChildren(vnode.children, el, undefined, app)\r\n container.insertBefore(el, anchor!)\r\n}\r\n\r\nexport function unmountElement(vnode: VElement, container: HTMLElement) {\r\n vnode.el.remove()\r\n}\r\n\r\nexport function mountElementProps(vnode: VElement) {\r\n let el = vnode.el\r\n let props = vnode.props\r\n\r\n // 处理标签属性\r\n for (let prop in props) {\r\n let value = props[prop]\r\n if (isActiver(value)) {\r\n let firstValue = watchProp(value, (oldValue, newValue) => patchElementProp(oldValue, newValue, el, prop))\r\n setElementProp(el, prop, firstValue)\r\n } else {\r\n setElementProp(el, prop, value)\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * 处理单个dom属性\r\n*/\r\nexport function setElementProp(el: HTMLElement, prop: string, value: any) {\r\n if (isOnEvent(prop) && isFunction(value)) {\r\n let pattern = /^on(.+)$/\r\n let result = prop.match(pattern)\r\n result && el.addEventListener(result[1].toLocaleLowerCase(), value.bind(el))\r\n return\r\n }\r\n\r\n switch (prop) {\r\n case 'className':\r\n el.className = String(value)\r\n break\r\n case 'style':\r\n if (isObject(value)) {\r\n value = mergeStyle(value)\r\n }\r\n default:\r\n el.setAttribute(prop, value)\r\n }\r\n}\r\n\r\n/**\r\n * 将对象形式的style转化为字符串\r\n*/\r\nexport function mergeStyle(style: Record): string {\r\n let styleStringList = []\r\n for (let cssAttr in style) {\r\n styleStringList.push(`${cssAttr}:${style[cssAttr]};`)\r\n }\r\n return styleStringList.join('')\r\n}\r\n","import {mount, unmount} from \"./mount\";\r\nimport { App } from \"../app\";\r\nimport {VArrayNode} from \"../vnode\";\r\nimport {VText} from \"../vnode\";\r\nimport {VNode, VNODE_TYPE} from \"../vnode\";\r\nimport {setElementProp} from \"./element\";\r\nimport {VComponent} from \"../vnode\";\r\n\r\nexport function isSameVNode(oldVNode: VNode, newVNode: VNode): boolean {\r\n return oldVNode.flag === newVNode.flag\r\n}\r\n\r\n// todo\r\nexport function getNextSibling(vNode: VNode): ChildNode | null {\r\n switch (vNode.flag) {\r\n case VNODE_TYPE.TEXT:\r\n case VNODE_TYPE.ELEMENT:\r\n case VNODE_TYPE.ARRAYNODE:\r\n case VNODE_TYPE.FRAGMENT:\r\n return vNode.el!.nextSibling\r\n case VNODE_TYPE.COMPONENT:\r\n return (vNode as VComponent).root.el!.nextSibling\r\n case VNODE_TYPE.ALIVE:\r\n return getNextSibling(vNode.vnode!)\r\n }\r\n}\r\n\r\nexport function patch(oldVNode: VNode, newVNode: VNode, container: HTMLElement, app?: App): void {\r\n\r\n // 如果两个节点引用一样不需要判断\r\n if (oldVNode === newVNode) return\r\n\r\n // 这里在判断相同类型的节点后可以做进一步优化\r\n if (isSameVNode(oldVNode, newVNode)) {\r\n let flag = oldVNode.flag = newVNode.flag\r\n\r\n if (flag === VNODE_TYPE.TEXT) {\r\n patchText(oldVNode, newVNode, container)\r\n } else if (flag === VNODE_TYPE.ARRAYNODE) {\r\n if (app?.options.arrayDiff) {\r\n patchArrayNodeT(oldVNode, newVNode, container)\r\n } else {\r\n patchArrayNode(oldVNode, newVNode, container)\r\n }\r\n } else {\r\n // const nextSibling = oldVNode?.el?.nextSibling\r\n const nextSibling = getNextSibling(oldVNode)\r\n unmount(oldVNode, container)\r\n mount(newVNode, container, nextSibling as ChildNode | undefined)\r\n }\r\n\r\n } else {\r\n // const nextSibling = oldVNode?.el?.nextSibling\r\n const nextSibling = getNextSibling(oldVNode)\r\n unmount(oldVNode, container)\r\n mount(newVNode, container, nextSibling as ChildNode | undefined)\r\n }\r\n\r\n}\r\n\r\nexport function patchText(oldVNode: VText, newVNode: VText, container: HTMLElement) {\r\n oldVNode.el!.nodeValue = newVNode.children\r\n newVNode.el = oldVNode.el\r\n}\r\n\r\nexport function patchElementProp(oldValue: any, newValue: any, el: HTMLElement, prop: string) {\r\n setElementProp(el, prop, newValue)\r\n}\r\n\r\nexport function patchArrayNodeT(oldVNode: VArrayNode, newVNode: VArrayNode, container: HTMLElement) {\r\n if (!oldVNode.depArray) {\r\n patchArrayNode(oldVNode, newVNode, container)\r\n return\r\n }\r\n\r\n const oldDepArray = oldVNode.depArray\r\n const newDepArray = newVNode.depArray\r\n const oldChildren = oldVNode.children\r\n const newChildren = newVNode.children\r\n\r\n if (!oldDepArray.length || !newDepArray.length) {\r\n patchArrayNode(oldVNode, newVNode, container)\r\n return\r\n }\r\n\r\n newVNode.anchor = oldVNode.anchor\r\n newVNode.el = oldVNode.el\r\n\r\n type NodeInfo = { node: VNode, index: number, used: boolean }\r\n // 为映射做初始化\r\n let map = new Map>()\r\n oldDepArray.forEach((item, index) => {\r\n let arr = map.get(item)\r\n if (!arr) map.set(item, arr = [])\r\n arr.push({ node: oldChildren[index], index, used: false })\r\n })\r\n\r\n let getOld = (item: any) => {\r\n let arr = map.get(item)\r\n if (!arr) return false\r\n\r\n let index = arr.findIndex(alone => !alone.used)\r\n\r\n if (index > -1) return arr[index]\r\n else return false\r\n }\r\n\r\n let moveOld = (item: any, node: NodeInfo) => {\r\n let arr = map.get(item)\r\n if (!arr) return\r\n\r\n let index = arr.findIndex(alone => alone === node)\r\n arr.splice(index, 1)\r\n }\r\n\r\n let maxIndexSoFar = { node: oldChildren[0], index: 0 }\r\n\r\n newDepArray.forEach((item, newIndex) => {\r\n let old = getOld(item)\r\n if (old) {\r\n if (old.index < maxIndexSoFar.index) {\r\n let next: ChildNode | null\r\n if (newIndex > 0) {\r\n next = getNextSibling(newChildren[newIndex - 1]) as ChildNode | null\r\n } else {\r\n next = getNextSibling(maxIndexSoFar.node) as ChildNode | null\r\n }\r\n\r\n VNodeInsertBefore(container, old.node, next as ChildNode | undefined)\r\n // container.insertBefore(old.node.el!, next)\r\n } else {\r\n maxIndexSoFar = old\r\n }\r\n\r\n newChildren[newIndex] = old.node\r\n moveOld(item, old)\r\n } else {\r\n // let next = maxIndexSoFar.node.el!.nextSibling\r\n let next: ChildNode | null\r\n if (newIndex > 0) {\r\n next = getNextSibling(newChildren[newIndex - 1]) as ChildNode | null\r\n } else {\r\n next = getNextSibling(maxIndexSoFar.node) as ChildNode | null\r\n }\r\n\r\n let newNode = newChildren[newIndex]\r\n mount(newNode, container, next as HTMLElement | undefined)\r\n // maxIndexSoFar = { node: newNode, index: maxIndexSoFar.index + 1 }\r\n }\r\n })\r\n\r\n\r\n map.forEach(value => {\r\n value.forEach(item => {\r\n if (!item.used) {\r\n unmount(item.node, container)\r\n }\r\n })\r\n })\r\n}\r\n\r\nfunction patchArrayNode(oldVNode: VArrayNode, newVNode: VArrayNode, container: HTMLElement) {\r\n const nextSibling = oldVNode.el.nextSibling\r\n unmount(oldVNode, container)\r\n mount(newVNode, container, nextSibling as ChildNode | undefined)\r\n}\r\n\r\n\r\n/**\r\n * 将一个虚拟节点挂载到一个锚点前面\r\n */\r\nfunction VNodeInsertBefore(container: HTMLElement, node: VNode, next?: ChildNode) {\r\n if (node.flag === VNODE_TYPE.ELEMENT || node.flag === VNODE_TYPE.TEXT) {\r\n container.insertBefore(node.el!, next!)\r\n } else if (node.flag === VNODE_TYPE.COMPONENT) {\r\n container.insertBefore((node as VComponent).root.el!, next!)\r\n }\r\n else if (node.flag === VNODE_TYPE.ARRAYNODE || node.flag === VNODE_TYPE.FRAGMENT) {\r\n let start: ChildNode | null | undefined = node.anchor\r\n let nextToMove = start?.nextSibling\r\n let end: ChildNode | null | undefined = node.el\r\n while (start !== end) {\r\n container.insertBefore(start!, next!)\r\n start = nextToMove\r\n nextToMove = start?.nextSibling\r\n }\r\n container.insertBefore(end!, next!)\r\n }\r\n}\r\n","import { patch } from \"./patch\";\r\nimport { watchVNode } from \"../reactive\";\r\nimport { App } from \"../app\";\r\nimport {\r\n VAlive,\r\n VArrayNode,\r\n VComponent,\r\n VElement,\r\n VFragment, VNodeElement,\r\n VText\r\n} from \"../vnode\";\r\nimport { VNode, VNODE_TYPE } from \"../vnode\";\r\nimport { mountElement, unmountElement } from \"./element\";\r\n\r\nexport function mount(vnode: VNode, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n switch (vnode.flag) {\r\n case VNODE_TYPE.ELEMENT:\r\n mountElement(vnode as VElement, container, anchor, app)\r\n break\r\n case VNODE_TYPE.TEXT:\r\n mountText(vnode as VText, container, anchor)\r\n break\r\n case VNODE_TYPE.FRAGMENT:\r\n mountFragment(vnode as VFragment, container, anchor, app)\r\n break\r\n case VNODE_TYPE.ARRAYNODE:\r\n mountArrayNode(vnode as VArrayNode, container, anchor, app)\r\n break\r\n case VNODE_TYPE.COMPONENT:\r\n mountComponent(vnode as VComponent, container, anchor, app)\r\n break\r\n case VNODE_TYPE.ALIVE:\r\n mountAlive(vnode as VAlive, container, anchor, app)\r\n break\r\n }\r\n}\r\n\r\nexport function unmount(vnode: VNode, container: HTMLElement) {\r\n switch (vnode.flag) {\r\n case VNODE_TYPE.ELEMENT:\r\n unmountElement(vnode as VElement, container)\r\n break\r\n case VNODE_TYPE.TEXT:\r\n unmountText(vnode as VText, container)\r\n break\r\n case VNODE_TYPE.FRAGMENT:\r\n unmountFragment(vnode as VFragment, container)\r\n break\r\n case VNODE_TYPE.ARRAYNODE:\r\n unmountArrayNode(vnode as VArrayNode, container)\r\n break\r\n case VNODE_TYPE.COMPONENT:\r\n unmountComponent(vnode as VComponent, container)\r\n break\r\n }\r\n}\r\n\r\nexport function mountChildren(children: Array, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n children.forEach(child => mount(child, container, anchor, app))\r\n}\r\n\r\nexport function mountText(vnode: VText, container: HTMLElement, anchor?: VNodeElement) {\r\n const el = document.createTextNode(vnode.children)\r\n vnode.el = el\r\n container.insertBefore(el, anchor!)\r\n}\r\n\r\nexport function unmountText(vnode: VText, container: HTMLElement) {\r\n vnode.el.remove()\r\n}\r\n\r\nexport function mountFragment(vnode: VFragment, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n const start = document.createTextNode('')\r\n const end = document.createTextNode('')\r\n vnode.anchor = start\r\n vnode.el = end\r\n container.insertBefore(start, anchor!)\r\n mountChildren(vnode.children, container, anchor, app)\r\n container.insertBefore(end, anchor!)\r\n}\r\n\r\nexport function unmountFragment(vnode: VFragment, container: HTMLElement) {\r\n const start = vnode.anchor\r\n const end = vnode.el\r\n let cur: ChildNode | null = start\r\n while (cur && cur !== end) {\r\n let next: ChildNode | null = cur.nextSibling\r\n cur.remove()\r\n cur = next\r\n }\r\n end.remove()\r\n}\r\n\r\nexport function mountArrayNode(vnode: VArrayNode, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n const start = document.createTextNode('')\r\n const end = document.createTextNode('')\r\n vnode.anchor = start\r\n vnode.el = end\r\n container.insertBefore(start, anchor!)\r\n mountChildren(vnode.children, container, anchor, app)\r\n container.insertBefore(end, anchor!)\r\n}\r\n\r\nexport function unmountArrayNode(vnode: VArrayNode, container: HTMLElement, anchor?: HTMLElement) {\r\n const start = vnode.anchor\r\n const end = vnode.el\r\n let cur: ChildNode | null = start\r\n while (cur && cur !== end) {\r\n let next: ChildNode | null = cur.nextSibling\r\n cur.remove()\r\n cur = next\r\n }\r\n end.remove()\r\n}\r\n\r\nexport function mountComponent(vNode: VComponent, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n const root = vNode.root\r\n vNode.lifeStyleInstance.emit('readyMounted')\r\n mount(root, container, anchor, app)\r\n vNode.lifeStyleInstance.emit('mounted')\r\n}\r\n\r\nexport function unmountComponent(vNode: VComponent, container: HTMLElement) {\r\n vNode.lifeStyleInstance.emit('beforeUnMounted')\r\n unmount(vNode.root, container)\r\n vNode.lifeStyleInstance.emit('unMounted')\r\n}\r\n\r\nexport function mountAlive(vnode: VAlive, container: HTMLElement, anchor?: VNodeElement, app?: App) {\r\n let firstVNode = watchVNode(vnode, (oldVNode, newVNode) => patch(oldVNode, newVNode, container, app))\r\n vnode.vnode = firstVNode\r\n mount(firstVNode, container, anchor, app)\r\n}\r\n","import { H } from './render'\r\nimport { VNode, VNodeProps, OriginVNode, FunctionComponentType } from \"./vnode\"\r\nimport {appUtils, AppUtils} from \"./plugin\";\r\nimport {ComponentLifeCycle} from \"./lifeCycle\";\r\n\r\n\r\n/**\r\n * 根类组件用于类型提示\r\n * 抽象类\r\n*/\r\n\r\n// todo\r\nexport interface ComponentInstance {\r\n props?: VNodeProps\r\n children?: Array\r\n utils: AppUtils\r\n life?: ComponentLifeCycle\r\n render(h?: H): OriginVNode\r\n\r\n /** 组件示例创建之后触发 */\r\n created?(): void\r\n\r\n /** 组件示例在渲染之前触发(DOM还没有生成) */\r\n beforeMounted?(): void\r\n\r\n /** dom已经生成到js内存但还没挂载 */\r\n readyMounted?(): void\r\n\r\n /** dom挂载到了页面上*/\r\n mounted?(): void\r\n\r\n /** 卸载之前触发 */\r\n beforeUnMounted?():void\r\n\r\n /** 卸载之后触发 */\r\n unMounted?():void\r\n}\r\n\r\nexport abstract class Component implements ComponentInstance{\r\n // 组件属性\r\n abstract props?: VNodeProps\r\n // 组件子元素\r\n abstract children?: Array\r\n\r\n abstract render(h?: H): VNode\r\n\r\n utils: AppUtils = appUtils\r\n abstract life?: ComponentLifeCycle\r\n\r\n /** 组件示例创建之后触发 */\r\n abstract created?(): void\r\n\r\n /** 组件示例在渲染之前触发(DOM还没有生成) */\r\n abstract beforeMounted?(): void\r\n\r\n /** dom已经生成到js内存但还没挂载 */\r\n abstract readyMounted?(): void\r\n\r\n /** dom挂载到了页面上*/\r\n abstract mounted?(): void\r\n\r\n /** 卸载之前触发 */\r\n abstract beforeUnMounted?():void\r\n\r\n /** 卸载之后触发 */\r\n abstract unMounted?():void\r\n}\r\n\r\nexport function defineComponent(componentType: FunctionComponentType): FunctionComponentType {\r\n return componentType\r\n}\r\n","import { mount } from \"./mount/mount\";\r\nimport { VNode } from \"./vnode\";\r\nimport {isString} from \"./utils\";\r\nimport { AppPlugin, appUtils } from './plugin'\r\n\r\nexport interface Options {\r\n arrayDiff?: boolean\r\n}\r\n\r\nexport class App {\r\n rootVNode: VNode\r\n options: Options\r\n\r\n private pluginList: Array\r\n\r\n constructor(vNode: VNode, options?: Options) {\r\n this.rootVNode = vNode\r\n this.options = options || {}\r\n this.pluginList = []\r\n }\r\n\r\n mount(selector?: string | HTMLElement): void {\r\n if(selector) {\r\n const el = (isString(selector) ? document.querySelector(selector) : selector) || document.body\r\n mount(this.rootVNode, el as HTMLElement, undefined, this)\r\n }else {\r\n mount(this.rootVNode, document.body, undefined, this)\r\n }\r\n\r\n // let container = document.createElement('div')\r\n // mount(this.rootVNode, container, undefined, this)\r\n // el?.replaceWith(...container.childNodes)\r\n }\r\n\r\n use(plugin: AppPlugin) {\r\n let index = this.pluginList.indexOf(plugin)\r\n if(index > -1) return this\r\n\r\n plugin.install({utils: appUtils})\r\n return this\r\n }\r\n}\r\n\r\nexport function createApp(vNode: VNode, options?: Options): App {\r\n return new App(vNode, options)\r\n}\r\n\r\n"],"names":["h"],"mappings":"MAGa,UAAU,GAAG,MAAM,CAAC,MAAM;;MCD1B,cAAc,GAAG,MAAM,CAAC,UAAU;;MCsBlC,gBAAgB,GAAG,MAAM,CAAC,YAAY;;MCtBtC,WAAW,GAAG,MAAM,CAAC,WAAW;;ACCtC,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC;;ACA1C;;AAEE;AACF,IAAY,UASX,CAAA;AATD,CAAA,UAAY,UAAU,EAAA;;AAEpB,IAAA,UAAA,CAAA,UAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAO,CAAA;;AAEP,IAAA,UAAA,CAAA,UAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;AACJ,IAAA,UAAA,CAAA,UAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAQ,CAAA;AACR,IAAA,UAAA,CAAA,UAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS,CAAA;AACT,IAAA,UAAA,CAAA,UAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS,CAAA;AACT,IAAA,UAAA,CAAA,UAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAK,CAAA;AACP,CAAC,EATW,UAAU,KAAV,UAAU,GASrB,EAAA,CAAA,CAAA;;ACXK,SAAU,QAAQ,CAAC,OAAgB,EAAA;AACvC,IAAA,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAA;AACpC,CAAC;AAEK,SAAU,UAAU,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