@odoo/owl 3.0.0-alpha.3 → 3.0.0-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -117
- package/dist/owl.cjs.js +6522 -6686
- package/dist/owl.es.js +6501 -6640
- package/dist/owl.iife.js +6525 -6691
- package/dist/owl.iife.min.js +27 -1
- package/dist/types/owl.d.ts +763 -668
- package/package.json +22 -79
- package/dist/compile_templates.mjs +0 -2553
- package/dist/owl-devtools.zip +0 -0
- package/dist/types/common/owl_error.d.ts +0 -3
- package/dist/types/common/types.d.ts +0 -29
- package/dist/types/common/utils.d.ts +0 -8
- package/dist/types/compiler/code_generator.d.ts +0 -152
- package/dist/types/compiler/index.d.ts +0 -13
- package/dist/types/compiler/inline_expressions.d.ts +0 -59
- package/dist/types/compiler/parser.d.ts +0 -178
- package/dist/types/compiler/standalone/index.d.ts +0 -2
- package/dist/types/compiler/standalone/setup_jsdom.d.ts +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/runtime/app.d.ts +0 -62
- package/dist/types/runtime/blockdom/attributes.d.ts +0 -6
- package/dist/types/runtime/blockdom/block_compiler.d.ts +0 -21
- package/dist/types/runtime/blockdom/config.d.ts +0 -8
- package/dist/types/runtime/blockdom/event_catcher.d.ts +0 -7
- package/dist/types/runtime/blockdom/events.d.ts +0 -8
- package/dist/types/runtime/blockdom/html.d.ts +0 -17
- package/dist/types/runtime/blockdom/index.d.ts +0 -26
- package/dist/types/runtime/blockdom/list.d.ts +0 -18
- package/dist/types/runtime/blockdom/multi.d.ts +0 -17
- package/dist/types/runtime/blockdom/text.d.ts +0 -26
- package/dist/types/runtime/blockdom/toggler.d.ts +0 -17
- package/dist/types/runtime/cancellableContext.d.ts +0 -15
- package/dist/types/runtime/cancellablePromise.d.ts +0 -15
- package/dist/types/runtime/component.d.ts +0 -28
- package/dist/types/runtime/component_node.d.ts +0 -83
- package/dist/types/runtime/error_handling.d.ts +0 -13
- package/dist/types/runtime/event_handling.d.ts +0 -1
- package/dist/types/runtime/executionContext.d.ts +0 -0
- package/dist/types/runtime/fibers.d.ts +0 -37
- package/dist/types/runtime/hooks.d.ts +0 -57
- package/dist/types/runtime/index.d.ts +0 -35
- package/dist/types/runtime/lifecycle_hooks.d.ts +0 -12
- package/dist/types/runtime/listOperation.d.ts +0 -1
- package/dist/types/runtime/plugins.d.ts +0 -39
- package/dist/types/runtime/portal.d.ts +0 -15
- package/dist/types/runtime/reactivity.d.ts +0 -46
- package/dist/types/runtime/registry.d.ts +0 -15
- package/dist/types/runtime/relationalModel/discussModel.d.ts +0 -19
- package/dist/types/runtime/relationalModel/discussModelTypes.d.ts +0 -22
- package/dist/types/runtime/relationalModel/field.d.ts +0 -20
- package/dist/types/runtime/relationalModel/model.d.ts +0 -59
- package/dist/types/runtime/relationalModel/modelData.d.ts +0 -18
- package/dist/types/runtime/relationalModel/modelRegistry.d.ts +0 -3
- package/dist/types/runtime/relationalModel/modelUtils.d.ts +0 -4
- package/dist/types/runtime/relationalModel/store.d.ts +0 -16
- package/dist/types/runtime/relationalModel/types.d.ts +0 -83
- package/dist/types/runtime/relationalModel/util.d.ts +0 -1
- package/dist/types/runtime/relationalModel/web/WebDataPoint.d.ts +0 -25
- package/dist/types/runtime/relationalModel/web/WebRecord.d.ts +0 -131
- package/dist/types/runtime/relationalModel/web/WebStaticList.d.ts +0 -63
- package/dist/types/runtime/relationalModel/web/webModel.d.ts +0 -5
- package/dist/types/runtime/relationalModel/web/webModelTypes.d.ts +0 -139
- package/dist/types/runtime/scheduler.d.ts +0 -21
- package/dist/types/runtime/signals.d.ts +0 -17
- package/dist/types/runtime/status.d.ts +0 -10
- package/dist/types/runtime/task.d.ts +0 -12
- package/dist/types/runtime/template_helpers.d.ts +0 -58
- package/dist/types/runtime/template_set.d.ts +0 -40
- package/dist/types/runtime/utils.d.ts +0 -25
- package/dist/types/runtime/validation.d.ts +0 -36
- package/dist/types/utils/registry.d.ts +0 -15
- package/dist/types/version.d.ts +0 -1
- package/tools/compile_owl_templates.mjs +0 -31
package/dist/owl-devtools.zip
DELETED
|
Binary file
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export declare type customDirectives = Record<string, (node: Element, value: string, modifier: string[]) => void>;
|
|
2
|
-
export declare enum ComputationState {
|
|
3
|
-
EXECUTED = 0,
|
|
4
|
-
STALE = 1,
|
|
5
|
-
PENDING = 2
|
|
6
|
-
}
|
|
7
|
-
export declare type Computation<T = any> = {
|
|
8
|
-
compute?: () => T;
|
|
9
|
-
state: ComputationState;
|
|
10
|
-
sources: Set<Atom | Derived<any, any>>;
|
|
11
|
-
isEager?: boolean;
|
|
12
|
-
isDerived?: boolean;
|
|
13
|
-
value: T;
|
|
14
|
-
childrenEffect?: Computation[];
|
|
15
|
-
} & Opts;
|
|
16
|
-
export declare type Opts = {
|
|
17
|
-
name?: string;
|
|
18
|
-
};
|
|
19
|
-
export declare type Atom<T = any> = {
|
|
20
|
-
value: T;
|
|
21
|
-
observers: Set<Computation>;
|
|
22
|
-
} & Opts;
|
|
23
|
-
export interface Derived<Prev, Next = Prev> extends Atom<Next>, Computation<Next> {
|
|
24
|
-
}
|
|
25
|
-
export declare type OldValue = any;
|
|
26
|
-
export declare type Getter<V> = () => V | null;
|
|
27
|
-
export declare type Setter<T, V> = (this: T, value: V) => void;
|
|
28
|
-
export declare type MakeGetSetReturn<T, V> = readonly [Getter<V>] | readonly [Getter<V>, Setter<T, V>];
|
|
29
|
-
export declare type MakeGetSet<T, V> = (obj: T) => MakeGetSetReturn<T, V>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parses an XML string into an XML document, throwing errors on parser errors
|
|
3
|
-
* instead of returning an XML document containing the parseerror.
|
|
4
|
-
*
|
|
5
|
-
* @param xml the string to parse
|
|
6
|
-
* @returns an XML document corresponding to the content of the string
|
|
7
|
-
*/
|
|
8
|
-
export declare function parseXML(xml: string): XMLDocument;
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { AST, ASTComment, ASTComponent, ASTDebug, ASTDomNode, ASTLog, ASTMulti, ASTSlot, ASTTCall, ASTTCallBlock, ASTTEsc, ASTText, ASTTForEach, ASTTif, ASTTKey, ASTTOut, ASTTPortal, ASTTranslation, ASTTranslationContext, ASTTSet, EventHandlers } from "./parser";
|
|
2
|
-
declare type BlockType = "block" | "text" | "multi" | "list" | "html" | "comment";
|
|
3
|
-
export interface Config {
|
|
4
|
-
translateFn?: (s: string, translationCtx: string) => string;
|
|
5
|
-
translatableAttributes?: string[];
|
|
6
|
-
dev?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export interface CodeGenOptions extends Config {
|
|
9
|
-
hasSafeContext?: boolean;
|
|
10
|
-
name?: string;
|
|
11
|
-
hasGlobalValues: boolean;
|
|
12
|
-
}
|
|
13
|
-
declare class BlockDescription {
|
|
14
|
-
static nextBlockId: number;
|
|
15
|
-
varName: string;
|
|
16
|
-
blockName: string;
|
|
17
|
-
dynamicTagName: string | null;
|
|
18
|
-
isRoot: boolean;
|
|
19
|
-
hasDynamicChildren: boolean;
|
|
20
|
-
children: BlockDescription[];
|
|
21
|
-
data: string[];
|
|
22
|
-
dom?: Node;
|
|
23
|
-
currentDom?: Element;
|
|
24
|
-
childNumber: number;
|
|
25
|
-
target: CodeTarget;
|
|
26
|
-
type: BlockType;
|
|
27
|
-
parentVar: string;
|
|
28
|
-
id: number;
|
|
29
|
-
constructor(target: CodeTarget, type: BlockType);
|
|
30
|
-
insertData(str: string, prefix?: string): number;
|
|
31
|
-
insert(dom: Node): void;
|
|
32
|
-
generateExpr(expr: string): string;
|
|
33
|
-
asXmlString(): string;
|
|
34
|
-
}
|
|
35
|
-
interface Context {
|
|
36
|
-
block: BlockDescription | null;
|
|
37
|
-
index: number | string;
|
|
38
|
-
forceNewBlock: boolean;
|
|
39
|
-
isLast?: boolean;
|
|
40
|
-
translate: boolean;
|
|
41
|
-
translationCtx: string;
|
|
42
|
-
tKeyExpr: string | null;
|
|
43
|
-
nameSpace?: string;
|
|
44
|
-
tModelSelectedExpr?: string;
|
|
45
|
-
ctxVar?: string;
|
|
46
|
-
inPreTag?: boolean;
|
|
47
|
-
}
|
|
48
|
-
declare class CodeTarget {
|
|
49
|
-
name: string;
|
|
50
|
-
indentLevel: number;
|
|
51
|
-
loopLevel: number;
|
|
52
|
-
code: string[];
|
|
53
|
-
hasRoot: boolean;
|
|
54
|
-
hasCache: boolean;
|
|
55
|
-
shouldProtectScope: boolean;
|
|
56
|
-
on: EventHandlers | null;
|
|
57
|
-
hasRefWrapper: boolean;
|
|
58
|
-
constructor(name: string, on?: EventHandlers | null);
|
|
59
|
-
addLine(line: string, idx?: number): void;
|
|
60
|
-
generateCode(): string;
|
|
61
|
-
currentKey(ctx: Context): string;
|
|
62
|
-
}
|
|
63
|
-
export declare class CodeGenerator {
|
|
64
|
-
blocks: BlockDescription[];
|
|
65
|
-
nextBlockId: number;
|
|
66
|
-
hasSafeContext: boolean;
|
|
67
|
-
isDebug: boolean;
|
|
68
|
-
targets: CodeTarget[];
|
|
69
|
-
target: CodeTarget;
|
|
70
|
-
templateName?: string;
|
|
71
|
-
dev: boolean;
|
|
72
|
-
translateFn: (s: string, translationCtx: string) => string;
|
|
73
|
-
translatableAttributes: string[];
|
|
74
|
-
ast: AST;
|
|
75
|
-
staticDefs: {
|
|
76
|
-
id: string;
|
|
77
|
-
expr: string;
|
|
78
|
-
}[];
|
|
79
|
-
slotNames: Set<String>;
|
|
80
|
-
helpers: Set<string>;
|
|
81
|
-
constructor(ast: AST, options: CodeGenOptions);
|
|
82
|
-
generateCode(): string;
|
|
83
|
-
compileInNewTarget(prefix: string, ast: AST, ctx: Context, on?: EventHandlers | null): string;
|
|
84
|
-
addLine(line: string, idx?: number): void;
|
|
85
|
-
define(varName: string, expr: string): void;
|
|
86
|
-
insertAnchor(block: BlockDescription, index?: number): void;
|
|
87
|
-
createBlock(parentBlock: BlockDescription | null, type: BlockType, ctx: Context): BlockDescription;
|
|
88
|
-
insertBlock(expression: string, block: BlockDescription, ctx: Context): void;
|
|
89
|
-
/**
|
|
90
|
-
* Captures variables that are used inside of an expression. This is useful
|
|
91
|
-
* because in compiled code, almost all variables are accessed through the ctx
|
|
92
|
-
* object. In the case of functions, that lookup in the context can be delayed
|
|
93
|
-
* which can cause issues if the value has changed since the function was
|
|
94
|
-
* defined.
|
|
95
|
-
*
|
|
96
|
-
* @param expr the expression to capture
|
|
97
|
-
* @param forceCapture whether the expression should capture its scope even if
|
|
98
|
-
* it doesn't contain a function. Useful when the expression will be used as
|
|
99
|
-
* a function body.
|
|
100
|
-
* @returns a new expression that uses the captured values
|
|
101
|
-
*/
|
|
102
|
-
captureExpression(expr: string, forceCapture?: boolean): string;
|
|
103
|
-
translate(str: string, translationCtx: string): string;
|
|
104
|
-
/**
|
|
105
|
-
* @returns the newly created block name, if any
|
|
106
|
-
*/
|
|
107
|
-
compileAST(ast: AST, ctx: Context): string | null;
|
|
108
|
-
compileDebug(ast: ASTDebug, ctx: Context): string | null;
|
|
109
|
-
compileLog(ast: ASTLog, ctx: Context): string | null;
|
|
110
|
-
compileComment(ast: ASTComment, ctx: Context): string;
|
|
111
|
-
compileText(ast: ASTText, ctx: Context): string;
|
|
112
|
-
generateHandlerCode(rawEvent: string, handler: string): string;
|
|
113
|
-
compileTDomNode(ast: ASTDomNode, ctx: Context): string;
|
|
114
|
-
compileTEsc(ast: ASTTEsc, ctx: Context): string;
|
|
115
|
-
compileTOut(ast: ASTTOut, ctx: Context): string;
|
|
116
|
-
compileTIfBranch(content: AST, block: BlockDescription, ctx: Context): void;
|
|
117
|
-
compileTIf(ast: ASTTif, ctx: Context, nextNode?: ASTDomNode): string;
|
|
118
|
-
compileTForeach(ast: ASTTForEach, ctx: Context): string;
|
|
119
|
-
compileTKey(ast: ASTTKey, ctx: Context): string | null;
|
|
120
|
-
compileMulti(ast: ASTMulti, ctx: Context): string | null;
|
|
121
|
-
compileTCall(ast: ASTTCall, ctx: Context): string;
|
|
122
|
-
compileTCallBlock(ast: ASTTCallBlock, ctx: Context): string;
|
|
123
|
-
compileTSet(ast: ASTTSet, ctx: Context): null;
|
|
124
|
-
generateComponentKey(currentKey?: string): string;
|
|
125
|
-
/**
|
|
126
|
-
* Formats a prop name and value into a string suitable to be inserted in the
|
|
127
|
-
* generated code. For example:
|
|
128
|
-
*
|
|
129
|
-
* Name Value Result
|
|
130
|
-
* ---------------------------------------------------------
|
|
131
|
-
* "number" "state" "number: ctx['state']"
|
|
132
|
-
* "something" "" "something: undefined"
|
|
133
|
-
* "some-prop" "state" "'some-prop': ctx['state']"
|
|
134
|
-
* "onClick.bind" "onClick" "onClick: bind(ctx, ctx['onClick'])"
|
|
135
|
-
*/
|
|
136
|
-
formatProp(name: string, value: string, attrsTranslationCtx: {
|
|
137
|
-
[name: string]: string;
|
|
138
|
-
} | null, translationCtx: string): string;
|
|
139
|
-
formatPropObject(obj: {
|
|
140
|
-
[prop: string]: any;
|
|
141
|
-
}, attrsTranslationCtx: {
|
|
142
|
-
[name: string]: string;
|
|
143
|
-
} | null, translationCtx: string): string[];
|
|
144
|
-
getPropString(props: string[], dynProps: string | null): string;
|
|
145
|
-
compileComponent(ast: ASTComponent, ctx: Context): string;
|
|
146
|
-
wrapWithEventCatcher(expr: string, on: EventHandlers): string;
|
|
147
|
-
compileTSlot(ast: ASTSlot, ctx: Context): string;
|
|
148
|
-
compileTTranslation(ast: ASTTranslation, ctx: Context): string | null;
|
|
149
|
-
compileTTranslationContext(ast: ASTTranslationContext, ctx: Context): string | null;
|
|
150
|
-
compileTPortal(ast: ASTTPortal, ctx: Context): string;
|
|
151
|
-
}
|
|
152
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { customDirectives } from "../common/types";
|
|
2
|
-
import type { TemplateSet } from "../runtime/template_set";
|
|
3
|
-
import type { BDom } from "../runtime/blockdom";
|
|
4
|
-
import { Config } from "./code_generator";
|
|
5
|
-
export declare type Template = (context: any, vnode: any, key?: string) => BDom;
|
|
6
|
-
export declare type TemplateFunction = (app: TemplateSet, bdom: any, helpers: any) => Template;
|
|
7
|
-
interface CompileOptions extends Config {
|
|
8
|
-
name?: string;
|
|
9
|
-
customDirectives?: customDirectives;
|
|
10
|
-
hasGlobalValues: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare function compile(template: string | Element, options?: CompileOptions): TemplateFunction;
|
|
13
|
-
export {};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
export interface QWebVar {
|
|
2
|
-
id: string;
|
|
3
|
-
expr: string;
|
|
4
|
-
value?: string;
|
|
5
|
-
hasBody?: boolean;
|
|
6
|
-
}
|
|
7
|
-
declare type TKind = "LEFT_BRACE" | "RIGHT_BRACE" | "LEFT_BRACKET" | "RIGHT_BRACKET" | "LEFT_PAREN" | "RIGHT_PAREN" | "COMMA" | "VALUE" | "TEMPLATE_STRING" | "SYMBOL" | "OPERATOR" | "COLON";
|
|
8
|
-
interface Token {
|
|
9
|
-
type: TKind;
|
|
10
|
-
value: string;
|
|
11
|
-
originalValue?: string;
|
|
12
|
-
size?: number;
|
|
13
|
-
varName?: string;
|
|
14
|
-
replace?: Function;
|
|
15
|
-
isLocal?: boolean;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Convert a javascript expression (as a string) into a list of tokens. For
|
|
19
|
-
* example: `tokenize("1 + b")` will return:
|
|
20
|
-
* ```js
|
|
21
|
-
* [
|
|
22
|
-
* {type: "VALUE", value: "1"},
|
|
23
|
-
* {type: "OPERATOR", value: "+"},
|
|
24
|
-
* {type: "SYMBOL", value: "b"}
|
|
25
|
-
* ]
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare function tokenize(expr: string): Token[];
|
|
29
|
-
/**
|
|
30
|
-
* This is the main function exported by this file. This is the code that will
|
|
31
|
-
* process an expression (given as a string) and returns another expression with
|
|
32
|
-
* proper lookups in the context.
|
|
33
|
-
*
|
|
34
|
-
* Usually, this kind of code would be very simple to do if we had an AST (so,
|
|
35
|
-
* if we had a javascript parser), since then, we would only need to find the
|
|
36
|
-
* variables and replace them. However, a parser is more complicated, and there
|
|
37
|
-
* are no standard builtin parser API.
|
|
38
|
-
*
|
|
39
|
-
* Since this method is applied to simple javasript expressions, and the work to
|
|
40
|
-
* be done is actually quite simple, we actually can get away with not using a
|
|
41
|
-
* parser, which helps with the code size.
|
|
42
|
-
*
|
|
43
|
-
* Here is the heuristic used by this method to determine if a token is a
|
|
44
|
-
* variable:
|
|
45
|
-
* - by default, all symbols are considered a variable
|
|
46
|
-
* - unless the previous token is a dot (in that case, this is a property: `a.b`)
|
|
47
|
-
* - or if the previous token is a left brace or a comma, and the next token is
|
|
48
|
-
* a colon (in that case, this is an object key: `{a: b}`)
|
|
49
|
-
*
|
|
50
|
-
* Some specific code is also required to support arrow functions. If we detect
|
|
51
|
-
* the arrow operator, then we add the current (or some previous tokens) token to
|
|
52
|
-
* the list of variables so it does not get replaced by a lookup in the context
|
|
53
|
-
*/
|
|
54
|
-
export declare function compileExprToArray(expr: string): Token[];
|
|
55
|
-
export declare function compileExpr(expr: string): string;
|
|
56
|
-
export declare const INTERP_REGEXP: RegExp;
|
|
57
|
-
export declare function replaceDynamicParts(s: string, replacer: (s: string) => string): string;
|
|
58
|
-
export declare function interpolate(s: string): string;
|
|
59
|
-
export {};
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import type { customDirectives } from "../common/types";
|
|
2
|
-
export declare type EventHandlers = {
|
|
3
|
-
[eventName: string]: string;
|
|
4
|
-
};
|
|
5
|
-
export declare type Attrs = {
|
|
6
|
-
[attrs: string]: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const enum ASTType {
|
|
9
|
-
Text = 0,
|
|
10
|
-
Comment = 1,
|
|
11
|
-
DomNode = 2,
|
|
12
|
-
Multi = 3,
|
|
13
|
-
TEsc = 4,
|
|
14
|
-
TIf = 5,
|
|
15
|
-
TSet = 6,
|
|
16
|
-
TCall = 7,
|
|
17
|
-
TOut = 8,
|
|
18
|
-
TForEach = 9,
|
|
19
|
-
TKey = 10,
|
|
20
|
-
TComponent = 11,
|
|
21
|
-
TDebug = 12,
|
|
22
|
-
TLog = 13,
|
|
23
|
-
TSlot = 14,
|
|
24
|
-
TCallBlock = 15,
|
|
25
|
-
TTranslation = 16,
|
|
26
|
-
TTranslationContext = 17,
|
|
27
|
-
TPortal = 18
|
|
28
|
-
}
|
|
29
|
-
export interface BaseAST {
|
|
30
|
-
type: ASTType;
|
|
31
|
-
hasNoRepresentation?: true;
|
|
32
|
-
}
|
|
33
|
-
export interface ASTText extends BaseAST {
|
|
34
|
-
type: ASTType.Text;
|
|
35
|
-
value: string;
|
|
36
|
-
}
|
|
37
|
-
export interface ASTComment extends BaseAST {
|
|
38
|
-
type: ASTType.Comment;
|
|
39
|
-
value: string;
|
|
40
|
-
}
|
|
41
|
-
interface TModelInfo {
|
|
42
|
-
baseExpr: string;
|
|
43
|
-
expr: string;
|
|
44
|
-
targetAttr: string;
|
|
45
|
-
eventType: "change" | "click" | "input";
|
|
46
|
-
shouldTrim: boolean;
|
|
47
|
-
shouldNumberize: boolean;
|
|
48
|
-
hasDynamicChildren: boolean;
|
|
49
|
-
specialInitTargetAttr: string | null;
|
|
50
|
-
}
|
|
51
|
-
export interface ASTDomNode extends BaseAST {
|
|
52
|
-
type: ASTType.DomNode;
|
|
53
|
-
tag: string;
|
|
54
|
-
content: AST[];
|
|
55
|
-
attrs: Attrs | null;
|
|
56
|
-
attrsTranslationCtx: Attrs | null;
|
|
57
|
-
ref: string | null;
|
|
58
|
-
on: EventHandlers | null;
|
|
59
|
-
model: TModelInfo | null;
|
|
60
|
-
dynamicTag: string | null;
|
|
61
|
-
ns: string | null;
|
|
62
|
-
}
|
|
63
|
-
export interface ASTMulti extends BaseAST {
|
|
64
|
-
type: ASTType.Multi;
|
|
65
|
-
content: AST[];
|
|
66
|
-
}
|
|
67
|
-
export interface ASTTEsc extends BaseAST {
|
|
68
|
-
type: ASTType.TEsc;
|
|
69
|
-
expr: string;
|
|
70
|
-
defaultValue: string;
|
|
71
|
-
}
|
|
72
|
-
export interface ASTTOut extends BaseAST {
|
|
73
|
-
type: ASTType.TOut;
|
|
74
|
-
expr: string;
|
|
75
|
-
body: AST[] | null;
|
|
76
|
-
}
|
|
77
|
-
export interface ASTTif extends BaseAST {
|
|
78
|
-
type: ASTType.TIf;
|
|
79
|
-
condition: string;
|
|
80
|
-
content: AST;
|
|
81
|
-
tElif: {
|
|
82
|
-
condition: string;
|
|
83
|
-
content: AST;
|
|
84
|
-
}[] | null;
|
|
85
|
-
tElse: AST | null;
|
|
86
|
-
}
|
|
87
|
-
export interface ASTTSet extends BaseAST {
|
|
88
|
-
type: ASTType.TSet;
|
|
89
|
-
name: string;
|
|
90
|
-
value: string | null;
|
|
91
|
-
defaultValue: string | null;
|
|
92
|
-
body: AST[] | null;
|
|
93
|
-
hasNoRepresentation: true;
|
|
94
|
-
}
|
|
95
|
-
export interface ASTTForEach extends BaseAST {
|
|
96
|
-
type: ASTType.TForEach;
|
|
97
|
-
collection: string;
|
|
98
|
-
elem: string;
|
|
99
|
-
body: AST;
|
|
100
|
-
memo: string;
|
|
101
|
-
hasNoFirst: boolean;
|
|
102
|
-
hasNoLast: boolean;
|
|
103
|
-
hasNoIndex: boolean;
|
|
104
|
-
hasNoValue: boolean;
|
|
105
|
-
key: string | null;
|
|
106
|
-
}
|
|
107
|
-
export interface ASTTKey extends BaseAST {
|
|
108
|
-
type: ASTType.TKey;
|
|
109
|
-
expr: string;
|
|
110
|
-
content: AST;
|
|
111
|
-
}
|
|
112
|
-
export interface ASTTCall extends BaseAST {
|
|
113
|
-
type: ASTType.TCall;
|
|
114
|
-
name: string;
|
|
115
|
-
body: AST[] | null;
|
|
116
|
-
context: string | null;
|
|
117
|
-
}
|
|
118
|
-
interface SlotDefinition {
|
|
119
|
-
content: AST | null;
|
|
120
|
-
scope: string | null;
|
|
121
|
-
on: EventHandlers | null;
|
|
122
|
-
attrs: Attrs | null;
|
|
123
|
-
attrsTranslationCtx: Attrs | null;
|
|
124
|
-
}
|
|
125
|
-
export interface ASTComponent extends BaseAST {
|
|
126
|
-
type: ASTType.TComponent;
|
|
127
|
-
name: string;
|
|
128
|
-
isDynamic: boolean;
|
|
129
|
-
dynamicProps: string | null;
|
|
130
|
-
on: EventHandlers | null;
|
|
131
|
-
props: {
|
|
132
|
-
[name: string]: string;
|
|
133
|
-
} | null;
|
|
134
|
-
propsTranslationCtx: {
|
|
135
|
-
[name: string]: string;
|
|
136
|
-
} | null;
|
|
137
|
-
slots: {
|
|
138
|
-
[name: string]: SlotDefinition;
|
|
139
|
-
} | null;
|
|
140
|
-
}
|
|
141
|
-
export interface ASTSlot extends BaseAST {
|
|
142
|
-
type: ASTType.TSlot;
|
|
143
|
-
name: string;
|
|
144
|
-
attrs: Attrs | null;
|
|
145
|
-
attrsTranslationCtx: Attrs | null;
|
|
146
|
-
on: EventHandlers | null;
|
|
147
|
-
defaultContent: AST | null;
|
|
148
|
-
}
|
|
149
|
-
export interface ASTTCallBlock extends BaseAST {
|
|
150
|
-
type: ASTType.TCallBlock;
|
|
151
|
-
name: string;
|
|
152
|
-
}
|
|
153
|
-
export interface ASTDebug extends BaseAST {
|
|
154
|
-
type: ASTType.TDebug;
|
|
155
|
-
content: AST | null;
|
|
156
|
-
}
|
|
157
|
-
export interface ASTLog extends BaseAST {
|
|
158
|
-
type: ASTType.TLog;
|
|
159
|
-
expr: string;
|
|
160
|
-
content: AST | null;
|
|
161
|
-
}
|
|
162
|
-
export interface ASTTranslation extends BaseAST {
|
|
163
|
-
type: ASTType.TTranslation;
|
|
164
|
-
content: AST | null;
|
|
165
|
-
}
|
|
166
|
-
export interface ASTTranslationContext extends BaseAST {
|
|
167
|
-
type: ASTType.TTranslationContext;
|
|
168
|
-
content: AST | null;
|
|
169
|
-
translationCtx: string;
|
|
170
|
-
}
|
|
171
|
-
export interface ASTTPortal extends BaseAST {
|
|
172
|
-
type: ASTType.TPortal;
|
|
173
|
-
target: string;
|
|
174
|
-
content: AST;
|
|
175
|
-
}
|
|
176
|
-
export declare type AST = ASTText | ASTComment | ASTDomNode | ASTMulti | ASTTEsc | ASTTif | ASTTSet | ASTTCall | ASTTOut | ASTTForEach | ASTTKey | ASTComponent | ASTSlot | ASTTCallBlock | ASTLog | ASTDebug | ASTTranslation | ASTTranslationContext | ASTTPortal;
|
|
177
|
-
export declare function parse(xml: string | Element, customDir?: customDirectives): AST;
|
|
178
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./runtime";
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Component, ComponentConstructor, Props } from "./component";
|
|
2
|
-
import { ComponentNode } from "./component_node";
|
|
3
|
-
import { handleError } from "./error_handling";
|
|
4
|
-
import { Fiber, RootFiber, MountOptions } from "./fibers";
|
|
5
|
-
import { Scheduler } from "./scheduler";
|
|
6
|
-
import { TemplateSet, TemplateSetConfig } from "./template_set";
|
|
7
|
-
import { validateTarget } from "./utils";
|
|
8
|
-
import { toRaw, reactive } from "./reactivity";
|
|
9
|
-
import { PluginCtor, PluginManager } from "./plugins";
|
|
10
|
-
export interface Env {
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
}
|
|
13
|
-
export interface RootConfig<P, E> {
|
|
14
|
-
props?: P;
|
|
15
|
-
env?: E;
|
|
16
|
-
Plugins?: PluginCtor[];
|
|
17
|
-
}
|
|
18
|
-
export interface AppConfig<P, E> extends TemplateSetConfig, RootConfig<P, E> {
|
|
19
|
-
name?: string;
|
|
20
|
-
test?: boolean;
|
|
21
|
-
warnIfNoStaticProps?: boolean;
|
|
22
|
-
}
|
|
23
|
-
declare global {
|
|
24
|
-
interface Window {
|
|
25
|
-
__OWL_DEVTOOLS__: {
|
|
26
|
-
apps: Set<App>;
|
|
27
|
-
Fiber: typeof Fiber;
|
|
28
|
-
RootFiber: typeof RootFiber;
|
|
29
|
-
toRaw: typeof toRaw;
|
|
30
|
-
reactive: typeof reactive;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
interface Root<P extends Props, E> {
|
|
35
|
-
node: ComponentNode<P, E>;
|
|
36
|
-
mount(target: HTMLElement | ShadowRoot, options?: MountOptions): Promise<Component<P, E>>;
|
|
37
|
-
destroy(): void;
|
|
38
|
-
}
|
|
39
|
-
export declare class App<T extends abstract new (...args: any) => any = any, Plugins = any, P extends object = any, E = any> extends TemplateSet {
|
|
40
|
-
static validateTarget: typeof validateTarget;
|
|
41
|
-
static apps: Set<App<any, any, any, any>>;
|
|
42
|
-
static version: string;
|
|
43
|
-
name: string;
|
|
44
|
-
Root: ComponentConstructor<P, Plugins, E>;
|
|
45
|
-
props: P;
|
|
46
|
-
env: E;
|
|
47
|
-
scheduler: Scheduler;
|
|
48
|
-
subRoots: Set<ComponentNode>;
|
|
49
|
-
root: ComponentNode<P, E> | null;
|
|
50
|
-
warnIfNoStaticProps: boolean;
|
|
51
|
-
pluginManager: PluginManager;
|
|
52
|
-
constructor(Root: ComponentConstructor<P, Plugins, E>, config?: AppConfig<P, E>);
|
|
53
|
-
mount(target: HTMLElement | ShadowRoot, options?: MountOptions): Promise<Component<P, E> & InstanceType<T>>;
|
|
54
|
-
createRoot<Props extends object, Plugins = any, SubEnv = any>(Root: ComponentConstructor<Props, Plugins, E>, config?: RootConfig<Props, SubEnv>): Root<Props, SubEnv>;
|
|
55
|
-
makeNode(Component: ComponentConstructor, props: any): ComponentNode;
|
|
56
|
-
mountNode(node: ComponentNode, target: HTMLElement | ShadowRoot, options?: MountOptions): any;
|
|
57
|
-
destroy(): void;
|
|
58
|
-
createComponent<P extends Props>(name: string | null, isStatic: boolean, hasSlotsProp: boolean, hasDynamicPropList: boolean, propList: string[]): (props: P, key: string, ctx: ComponentNode, parent: any, C: any) => any;
|
|
59
|
-
handleError(...args: Parameters<typeof handleError>): void;
|
|
60
|
-
}
|
|
61
|
-
export declare function mount<T extends abstract new (...args: any) => any = any, Plugins = any, P extends object = any, E = any>(C: T & ComponentConstructor<P, Plugins, E>, target: HTMLElement, config?: AppConfig<P, E> & MountOptions): Promise<Component<P, Plugins, E> & InstanceType<T>>;
|
|
62
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Setter } from "./block_compiler";
|
|
2
|
-
export declare function createAttrUpdater(attr: string): Setter<HTMLElement>;
|
|
3
|
-
export declare function attrsSetter(this: HTMLElement, attrs: any): void;
|
|
4
|
-
export declare function attrsUpdater(this: HTMLElement, attrs: any, oldAttrs: any): void;
|
|
5
|
-
export declare function setClass(this: HTMLElement, val: any): void;
|
|
6
|
-
export declare function updateClass(this: HTMLElement, val: any, oldVal: any): void;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { VNode } from "./index";
|
|
2
|
-
declare type BlockType = (data?: any[], children?: VNode[]) => VNode;
|
|
3
|
-
/**
|
|
4
|
-
* Compiling blocks is a multi-step process:
|
|
5
|
-
*
|
|
6
|
-
* 1. build an IntermediateTree from the HTML element. This intermediate tree
|
|
7
|
-
* is a binary tree structure that encode dynamic info sub nodes, and the
|
|
8
|
-
* path required to reach them
|
|
9
|
-
* 2. process the tree to build a block context, which is an object that aggregate
|
|
10
|
-
* all dynamic info in a list, and also, all ref indexes.
|
|
11
|
-
* 3. process the context to build appropriate builder/setter functions
|
|
12
|
-
* 4. make a dynamic block class, which will efficiently collect references and
|
|
13
|
-
* create/update dynamic locations/children
|
|
14
|
-
*
|
|
15
|
-
* @param str
|
|
16
|
-
* @returns a new block type, that can build concrete blocks
|
|
17
|
-
*/
|
|
18
|
-
export declare function createBlock(str: string): BlockType;
|
|
19
|
-
export declare type Setter<T = any> = (this: T, value: any) => void;
|
|
20
|
-
export declare type Updater<T = any> = (this: T, value: any, oldVal: any) => void;
|
|
21
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare function filterOutModifiersFromData(dataList: any[]): {
|
|
2
|
-
modifiers: string[];
|
|
3
|
-
data: any[];
|
|
4
|
-
};
|
|
5
|
-
export declare const config: {
|
|
6
|
-
shouldNormalizeDom: boolean;
|
|
7
|
-
mainEventHandler: (data: any, ev: Event, currentTarget?: EventTarget | null | undefined) => boolean;
|
|
8
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
declare type EventHandlerSetter = (this: HTMLElement, data: any) => void;
|
|
2
|
-
interface EventHandlerCreator {
|
|
3
|
-
setup: EventHandlerSetter;
|
|
4
|
-
update: EventHandlerSetter;
|
|
5
|
-
remove: (this: HTMLElement) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare function createEventHandler(rawEvent: string): EventHandlerCreator;
|
|
8
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { VNode } from "./index";
|
|
2
|
-
declare class VHtml {
|
|
3
|
-
html: string;
|
|
4
|
-
parentEl?: HTMLElement | undefined;
|
|
5
|
-
content: ChildNode[];
|
|
6
|
-
constructor(html: string);
|
|
7
|
-
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
8
|
-
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement | undefined): void;
|
|
9
|
-
moveBeforeVNode(other: VHtml | null, afterNode: Node | null): void;
|
|
10
|
-
patch(other: VHtml): void;
|
|
11
|
-
beforeRemove(): void;
|
|
12
|
-
remove(): void;
|
|
13
|
-
firstNode(): Node;
|
|
14
|
-
toString(): string;
|
|
15
|
-
}
|
|
16
|
-
export declare function html(str: string): VNode<VHtml>;
|
|
17
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export { config } from "./config";
|
|
2
|
-
export { toggler } from "./toggler";
|
|
3
|
-
export { createBlock } from "./block_compiler";
|
|
4
|
-
export { list } from "./list";
|
|
5
|
-
export { multi } from "./multi";
|
|
6
|
-
export { text, comment } from "./text";
|
|
7
|
-
export { html } from "./html";
|
|
8
|
-
export { createCatcher } from "./event_catcher";
|
|
9
|
-
export interface VNode<T = any> {
|
|
10
|
-
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
11
|
-
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement): void;
|
|
12
|
-
moveBeforeVNode(other: T | null, afterNode: Node | null): void;
|
|
13
|
-
patch(other: T, withBeforeRemove: boolean): void;
|
|
14
|
-
beforeRemove(): void;
|
|
15
|
-
remove(): void;
|
|
16
|
-
firstNode(): Node | undefined;
|
|
17
|
-
el?: undefined | HTMLElement | Text;
|
|
18
|
-
parentEl?: undefined | HTMLElement;
|
|
19
|
-
isOnlyChild?: boolean | undefined;
|
|
20
|
-
key?: any;
|
|
21
|
-
}
|
|
22
|
-
export declare type BDom = VNode<any>;
|
|
23
|
-
export declare function mount(vnode: VNode, fixture: HTMLElement, afterNode?: Node | null): void;
|
|
24
|
-
export declare function patch(vnode1: VNode, vnode2: VNode, withBeforeRemove?: boolean): void;
|
|
25
|
-
export declare function remove(vnode: VNode, withBeforeRemove?: boolean): void;
|
|
26
|
-
export declare function withKey(vnode: VNode, key: any): VNode<any>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { VNode } from "./index";
|
|
2
|
-
declare class VList {
|
|
3
|
-
children: VNode[];
|
|
4
|
-
anchor: Node | undefined;
|
|
5
|
-
parentEl?: HTMLElement | undefined;
|
|
6
|
-
isOnlyChild?: boolean | undefined;
|
|
7
|
-
constructor(children: VNode[]);
|
|
8
|
-
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
9
|
-
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement | undefined): void;
|
|
10
|
-
moveBeforeVNode(other: VList | null, afterNode: Node | null): void;
|
|
11
|
-
patch(other: VList, withBeforeRemove: boolean): void;
|
|
12
|
-
beforeRemove(): void;
|
|
13
|
-
remove(): void;
|
|
14
|
-
firstNode(): Node | undefined;
|
|
15
|
-
toString(): string;
|
|
16
|
-
}
|
|
17
|
-
export declare function list(children: VNode[]): VNode<VList>;
|
|
18
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { VNode } from "./index";
|
|
2
|
-
export declare class VMulti {
|
|
3
|
-
children: (VNode | undefined)[];
|
|
4
|
-
anchors?: Node[] | undefined;
|
|
5
|
-
parentEl?: HTMLElement | undefined;
|
|
6
|
-
isOnlyChild?: boolean | undefined;
|
|
7
|
-
constructor(children: (VNode | undefined)[]);
|
|
8
|
-
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
9
|
-
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement | undefined): void;
|
|
10
|
-
moveBeforeVNode(other: VMulti | null, afterNode: Node | null): void;
|
|
11
|
-
patch(other: VMulti, withBeforeRemove: boolean): void;
|
|
12
|
-
beforeRemove(): void;
|
|
13
|
-
remove(): void;
|
|
14
|
-
firstNode(): Node | undefined;
|
|
15
|
-
toString(): string;
|
|
16
|
-
}
|
|
17
|
-
export declare function multi(children: (VNode | undefined)[]): VNode<VMulti>;
|