mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[ADD] add basic infrastructure to buid owl-runtime without compiler
This commit is contained in:
committed by
Sam Degueldre
parent
b10a700381
commit
e4b810c027
@@ -118,13 +118,8 @@ export class TemplateSet {
|
||||
return this.templates[name];
|
||||
}
|
||||
|
||||
_compileTemplate(name: string, template: string | Element) {
|
||||
return compile(template, {
|
||||
name,
|
||||
dev: this.dev,
|
||||
translateFn: this.translateFn,
|
||||
translatableAttributes: this.translatableAttributes,
|
||||
});
|
||||
_compileTemplate(name: string, template: string | Element): ReturnType<typeof compile> {
|
||||
throw new Error(`Unable to compile a template. Please use owl full build instead`);
|
||||
}
|
||||
|
||||
callTemplate(owner: any, subTemplate: string, ctx: any, parent: any, key: any): any {
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
import {
|
||||
config,
|
||||
createBlock,
|
||||
html,
|
||||
list,
|
||||
mount as blockMount,
|
||||
multi,
|
||||
patch,
|
||||
remove,
|
||||
text,
|
||||
toggler,
|
||||
comment,
|
||||
} from "./blockdom";
|
||||
import { mainEventHandler } from "./component/handler";
|
||||
export type { Reactive } from "./reactivity";
|
||||
|
||||
config.shouldNormalizeDom = false;
|
||||
config.mainEventHandler = mainEventHandler;
|
||||
|
||||
export const blockDom = {
|
||||
config,
|
||||
// bdom entry points
|
||||
mount: blockMount,
|
||||
patch,
|
||||
remove,
|
||||
// bdom block types
|
||||
list,
|
||||
multi,
|
||||
text,
|
||||
toggler,
|
||||
createBlock,
|
||||
html,
|
||||
comment,
|
||||
};
|
||||
|
||||
export { App, mount } from "./app/app";
|
||||
export { xml } from "./app/template_set";
|
||||
export { Component } from "./component/component";
|
||||
export { useComponent, useState } from "./component/component_node";
|
||||
export { status } from "./component/status";
|
||||
export { reactive, markRaw, toRaw } from "./reactivity";
|
||||
export { useEffect, useEnv, useExternalListener, useRef, useChildSubEnv, useSubEnv } from "./hooks";
|
||||
export { EventBus, whenReady, loadFile, markup } from "./utils";
|
||||
export {
|
||||
onWillStart,
|
||||
onMounted,
|
||||
onWillUnmount,
|
||||
onWillUpdateProps,
|
||||
onWillPatch,
|
||||
onPatched,
|
||||
onWillRender,
|
||||
onRendered,
|
||||
onWillDestroy,
|
||||
onError,
|
||||
} from "./component/lifecycle_hooks";
|
||||
export { validate } from "./validation";
|
||||
|
||||
export const __info__ = {};
|
||||
+13
-55
@@ -1,58 +1,16 @@
|
||||
import {
|
||||
config,
|
||||
createBlock,
|
||||
html,
|
||||
list,
|
||||
mount as blockMount,
|
||||
multi,
|
||||
patch,
|
||||
remove,
|
||||
text,
|
||||
toggler,
|
||||
comment,
|
||||
} from "./blockdom";
|
||||
import { mainEventHandler } from "./component/handler";
|
||||
export type { Reactive } from "./reactivity";
|
||||
import { TemplateSet } from "./app/template_set";
|
||||
import { compile } from "./compiler";
|
||||
|
||||
config.shouldNormalizeDom = false;
|
||||
config.mainEventHandler = mainEventHandler;
|
||||
export * from "./index.runtime";
|
||||
|
||||
export const blockDom = {
|
||||
config,
|
||||
// bdom entry points
|
||||
mount: blockMount,
|
||||
patch,
|
||||
remove,
|
||||
// bdom block types
|
||||
list,
|
||||
multi,
|
||||
text,
|
||||
toggler,
|
||||
createBlock,
|
||||
html,
|
||||
comment,
|
||||
TemplateSet.prototype._compileTemplate = function _compileTemplate(
|
||||
name: string,
|
||||
template: string | Element
|
||||
) {
|
||||
return compile(template, {
|
||||
name,
|
||||
dev: this.dev,
|
||||
translateFn: this.translateFn,
|
||||
translatableAttributes: this.translatableAttributes,
|
||||
});
|
||||
};
|
||||
|
||||
export { App, mount } from "./app/app";
|
||||
export { xml } from "./app/template_set";
|
||||
export { Component } from "./component/component";
|
||||
export { useComponent, useState } from "./component/component_node";
|
||||
export { status } from "./component/status";
|
||||
export { reactive, markRaw, toRaw } from "./reactivity";
|
||||
export { useEffect, useEnv, useExternalListener, useRef, useChildSubEnv, useSubEnv } from "./hooks";
|
||||
export { EventBus, whenReady, loadFile, markup } from "./utils";
|
||||
export {
|
||||
onWillStart,
|
||||
onMounted,
|
||||
onWillUnmount,
|
||||
onWillUpdateProps,
|
||||
onWillPatch,
|
||||
onPatched,
|
||||
onWillRender,
|
||||
onRendered,
|
||||
onWillDestroy,
|
||||
onError,
|
||||
} from "./component/lifecycle_hooks";
|
||||
export { validate } from "./validation";
|
||||
|
||||
export const __info__ = {};
|
||||
|
||||
+1
-1
@@ -1,5 +1,4 @@
|
||||
import { onWillUnmount } from "./component/lifecycle_hooks";
|
||||
// import { xml } from "./app/template_set";
|
||||
import { BDom, text, VNode } from "./blockdom";
|
||||
import { Component } from "./component/component";
|
||||
|
||||
@@ -62,6 +61,7 @@ export function portalTemplate(app: any, bdom: any, helpers: any) {
|
||||
return callSlot(ctx, node, key, "default", false, null);
|
||||
};
|
||||
}
|
||||
|
||||
export class Portal extends Component {
|
||||
static template = "__portal__";
|
||||
static props = {
|
||||
|
||||
Reference in New Issue
Block a user