@odoo/owl 3.0.0-alpha.2 → 3.0.0-alpha.21
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 +100 -110
- package/dist/compile_templates.mjs +2434 -2532
- package/dist/compiler.js +2371 -0
- package/dist/owl-devtools.zip +0 -0
- package/dist/owl.cjs.js +6709 -6616
- package/dist/owl.cjs.runtime.js +4480 -0
- package/dist/owl.es.js +6697 -6600
- package/dist/owl.es.runtime.js +4436 -0
- package/dist/owl.iife.js +6710 -6617
- package/dist/owl.iife.min.js +1 -1
- package/dist/owl.iife.runtime.js +4484 -0
- package/dist/owl.iife.runtime.min.js +1 -0
- package/dist/types/common/owl_error.d.ts +3 -3
- package/dist/types/common/types.d.ts +1 -29
- package/dist/types/common/utils.d.ts +8 -8
- package/dist/types/compiler/code_generator.d.ts +133 -152
- package/dist/types/compiler/index.d.ts +13 -13
- package/dist/types/compiler/inline_expressions.d.ts +41 -59
- package/dist/types/compiler/parser.d.ts +170 -178
- package/dist/types/compiler/standalone/index.d.ts +2 -2
- package/dist/types/compiler/standalone/setup_jsdom.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/owl.d.ts +709 -665
- package/dist/types/runtime/app.d.ts +55 -62
- package/dist/types/runtime/blockdom/attributes.d.ts +8 -6
- package/dist/types/runtime/blockdom/block_compiler.d.ts +21 -21
- package/dist/types/runtime/blockdom/config.d.ts +8 -8
- package/dist/types/runtime/blockdom/event_catcher.d.ts +7 -7
- package/dist/types/runtime/blockdom/events.d.ts +8 -8
- package/dist/types/runtime/blockdom/html.d.ts +17 -17
- package/dist/types/runtime/blockdom/index.d.ts +25 -26
- package/dist/types/runtime/blockdom/list.d.ts +18 -18
- package/dist/types/runtime/blockdom/multi.d.ts +17 -17
- package/dist/types/runtime/blockdom/text.d.ts +26 -26
- package/dist/types/runtime/blockdom/toggler.d.ts +17 -17
- package/dist/types/runtime/component.d.ts +17 -28
- package/dist/types/runtime/component_node.d.ts +59 -83
- package/dist/types/runtime/context.d.ts +36 -0
- package/dist/types/runtime/error_handling.d.ts +13 -13
- package/dist/types/runtime/event_handling.d.ts +1 -1
- package/dist/types/runtime/fibers.d.ts +37 -37
- package/dist/types/runtime/hooks.d.ts +32 -57
- package/dist/types/runtime/index.d.ts +46 -35
- package/dist/types/runtime/lifecycle_hooks.d.ts +10 -12
- package/dist/types/runtime/plugin_hooks.d.ts +6 -0
- package/dist/types/runtime/plugin_manager.d.ts +36 -0
- package/dist/types/runtime/props.d.ts +21 -0
- package/dist/types/runtime/reactivity/computations.d.ts +34 -0
- package/dist/types/runtime/reactivity/computed.d.ts +6 -0
- package/dist/types/runtime/reactivity/effect.d.ts +1 -0
- package/dist/types/runtime/reactivity/proxy.d.ts +47 -0
- package/dist/types/runtime/reactivity/signal.d.ts +31 -0
- package/dist/types/runtime/reactivity.d.ts +57 -46
- package/dist/types/runtime/registry.d.ts +24 -15
- package/dist/types/runtime/rendering/error_handling.d.ts +13 -0
- package/dist/types/runtime/rendering/fibers.d.ts +37 -0
- package/dist/types/runtime/rendering/scheduler.d.ts +21 -0
- package/dist/types/runtime/rendering/template_helpers.d.ts +51 -0
- package/dist/types/runtime/resource.d.ts +18 -0
- package/dist/types/runtime/scheduler.d.ts +21 -21
- package/dist/types/runtime/status.d.ts +11 -10
- package/dist/types/runtime/template_set.d.ts +36 -40
- package/dist/types/runtime/types.d.ts +70 -0
- package/dist/types/runtime/utils.d.ts +24 -25
- package/dist/types/runtime/validation.d.ts +19 -36
- package/dist/types/version.d.ts +1 -1
- package/package.json +45 -19
- package/dist/types/runtime/cancellableContext.d.ts +0 -15
- package/dist/types/runtime/cancellablePromise.d.ts +0 -15
- package/dist/types/runtime/executionContext.d.ts +0 -0
- package/dist/types/runtime/listOperation.d.ts +0 -1
- package/dist/types/runtime/plugins.d.ts +0 -39
- 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/signals.d.ts +0 -17
- package/dist/types/runtime/task.d.ts +0 -12
- package/dist/types/utils/registry.d.ts +0 -15
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Atom } from "./computations";
|
|
2
|
+
type Target = object;
|
|
3
|
+
type Reactive<T extends Target> = T;
|
|
4
|
+
/**
|
|
5
|
+
* Mark an object or array so that it is ignored by the reactivity system
|
|
6
|
+
*
|
|
7
|
+
* @param value the value to mark
|
|
8
|
+
* @returns the object itself
|
|
9
|
+
*/
|
|
10
|
+
export declare function markRaw<T extends Target>(value: T): T;
|
|
11
|
+
/**
|
|
12
|
+
* Given a proxy objet, return the raw (non proxy) underlying object
|
|
13
|
+
*
|
|
14
|
+
* @param value a proxy value
|
|
15
|
+
* @returns the underlying value
|
|
16
|
+
*/
|
|
17
|
+
export declare function toRaw<T extends Target, U extends Reactive<T>>(value: U | T): T;
|
|
18
|
+
export declare function proxifyTarget<T extends Target>(target: T, atom: Atom | null): T;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a reactive proxy for an object. Reading data on the proxy object
|
|
21
|
+
* subscribes to changes to the data. Writing data on the object will cause the
|
|
22
|
+
* notify callback to be called if there are suscriptions to that data. Nested
|
|
23
|
+
* objects and arrays are automatically made reactive as well.
|
|
24
|
+
*
|
|
25
|
+
* Whenever you are notified of a change, all subscriptions are cleared, and if
|
|
26
|
+
* you would like to be notified of any further changes, you should go read
|
|
27
|
+
* the underlying data again. We assume that if you don't go read it again after
|
|
28
|
+
* being notified, it means that you are no longer interested in that data.
|
|
29
|
+
*
|
|
30
|
+
* Subscriptions:
|
|
31
|
+
* + Reading a property on an object will subscribe you to changes in the value
|
|
32
|
+
* of that property.
|
|
33
|
+
* + Accessing an object's keys (eg with Object.keys or with `for..in`) will
|
|
34
|
+
* subscribe you to the creation/deletion of keys. Checking the presence of a
|
|
35
|
+
* key on the object with 'in' has the same effect.
|
|
36
|
+
* - getOwnPropertyDescriptor does not currently subscribe you to the property.
|
|
37
|
+
* This is a choice that was made because changing a key's value will trigger
|
|
38
|
+
* this trap and we do not want to subscribe by writes. This also means that
|
|
39
|
+
* Object.hasOwnProperty doesn't subscribe as it goes through this trap.
|
|
40
|
+
*
|
|
41
|
+
* @param target the object for which to create a proxy proxy
|
|
42
|
+
* @param callback the function to call when an observed property of the
|
|
43
|
+
* proxy has changed
|
|
44
|
+
* @returns a proxy that tracks changes to it
|
|
45
|
+
*/
|
|
46
|
+
export declare function proxy<T extends Target>(target: T): T;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ReactiveValue } from "./computations";
|
|
2
|
+
export interface Signal<T> extends ReactiveValue<T> {
|
|
3
|
+
/**
|
|
4
|
+
* Update the value of the signal with a new value. If the new value is different
|
|
5
|
+
* from the previous values, all computations that depends on this signal will
|
|
6
|
+
* be invalidated, and effects will rerun.
|
|
7
|
+
*/
|
|
8
|
+
set(nextValue: T): void;
|
|
9
|
+
}
|
|
10
|
+
interface SignalOptions<T> {
|
|
11
|
+
type?: T;
|
|
12
|
+
}
|
|
13
|
+
declare function invalidateSignal(signal: Signal<any>): void;
|
|
14
|
+
declare function signalArray<T>(initialValue: T[], options?: SignalOptions<T>): Signal<T[]>;
|
|
15
|
+
declare function signalObject<T extends Record<PropertyKey, any>>(initialValue: T, options?: SignalOptions<T>): Signal<T>;
|
|
16
|
+
interface MapSignalOptions<K, V> {
|
|
17
|
+
name?: string;
|
|
18
|
+
keyType?: K;
|
|
19
|
+
valueType?: V;
|
|
20
|
+
}
|
|
21
|
+
declare function signalMap<K, V>(initialValue: Map<K, V>, options?: MapSignalOptions<K, V>): Signal<Map<K, V>>;
|
|
22
|
+
declare function signalSet<T>(initialValue: Set<T>, options?: SignalOptions<T>): Signal<Set<T>>;
|
|
23
|
+
export declare function signal<T>(value: T, options?: SignalOptions<T>): Signal<T>;
|
|
24
|
+
export declare namespace signal {
|
|
25
|
+
var invalidate: typeof invalidateSignal;
|
|
26
|
+
var Array: typeof signalArray;
|
|
27
|
+
var Map: typeof signalMap;
|
|
28
|
+
var Object: typeof signalObject;
|
|
29
|
+
var Set: typeof signalSet;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -1,46 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* @
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export declare
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
1
|
+
import type { Callback } from "./utils";
|
|
2
|
+
type Target = object;
|
|
3
|
+
type Reactive<T extends Target> = T;
|
|
4
|
+
/**
|
|
5
|
+
* Mark an object or array so that it is ignored by the reactivity system
|
|
6
|
+
*
|
|
7
|
+
* @param value the value to mark
|
|
8
|
+
* @returns the object itself
|
|
9
|
+
*/
|
|
10
|
+
export declare function markRaw<T extends Target>(value: T): T;
|
|
11
|
+
/**
|
|
12
|
+
* Given a reactive objet, return the raw (non reactive) underlying object
|
|
13
|
+
*
|
|
14
|
+
* @param value a reactive value
|
|
15
|
+
* @returns the underlying value
|
|
16
|
+
*/
|
|
17
|
+
export declare function toRaw<T extends Target, U extends Reactive<T>>(value: U | T): T;
|
|
18
|
+
/**
|
|
19
|
+
* Clears all subscriptions of the Reactives associated with a given callback.
|
|
20
|
+
*
|
|
21
|
+
* @param callback the callback for which the reactives need to be cleared
|
|
22
|
+
*/
|
|
23
|
+
export declare function clearReactivesForCallback(callback: Callback): void;
|
|
24
|
+
export declare function getSubscriptions(callback: Callback): {
|
|
25
|
+
target: object;
|
|
26
|
+
keys: (string | number | symbol)[];
|
|
27
|
+
}[];
|
|
28
|
+
export declare const targets: WeakMap<object, object>;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a reactive proxy for an object. Reading data on the reactive object
|
|
31
|
+
* subscribes to changes to the data. Writing data on the object will cause the
|
|
32
|
+
* notify callback to be called if there are suscriptions to that data. Nested
|
|
33
|
+
* objects and arrays are automatically made reactive as well.
|
|
34
|
+
*
|
|
35
|
+
* Whenever you are notified of a change, all subscriptions are cleared, and if
|
|
36
|
+
* you would like to be notified of any further changes, you should go read
|
|
37
|
+
* the underlying data again. We assume that if you don't go read it again after
|
|
38
|
+
* being notified, it means that you are no longer interested in that data.
|
|
39
|
+
*
|
|
40
|
+
* Subscriptions:
|
|
41
|
+
* + Reading a property on an object will subscribe you to changes in the value
|
|
42
|
+
* of that property.
|
|
43
|
+
* + Accessing an object's keys (eg with Object.keys or with `for..in`) will
|
|
44
|
+
* subscribe you to the creation/deletion of keys. Checking the presence of a
|
|
45
|
+
* key on the object with 'in' has the same effect.
|
|
46
|
+
* - getOwnPropertyDescriptor does not currently subscribe you to the property.
|
|
47
|
+
* This is a choice that was made because changing a key's value will trigger
|
|
48
|
+
* this trap and we do not want to subscribe by writes. This also means that
|
|
49
|
+
* Object.hasOwnProperty doesn't subscribe as it goes through this trap.
|
|
50
|
+
*
|
|
51
|
+
* @param target the object for which to create a reactive proxy
|
|
52
|
+
* @param callback the function to call when an observed property of the
|
|
53
|
+
* reactive has changed
|
|
54
|
+
* @returns a proxy that tracks changes to it
|
|
55
|
+
*/
|
|
56
|
+
export declare function reactive<T extends Target>(target: T, callback?: Callback): T;
|
|
57
|
+
export {};
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
_name
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
entries:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
1
|
+
interface RegistryOptions<T> {
|
|
2
|
+
name?: string;
|
|
3
|
+
validation?: T;
|
|
4
|
+
}
|
|
5
|
+
export declare class Registry<T> {
|
|
6
|
+
private _map;
|
|
7
|
+
private _name;
|
|
8
|
+
private _validation?;
|
|
9
|
+
constructor(options?: RegistryOptions<T>);
|
|
10
|
+
entries: import(".").ReactiveValue<[string, T][], [string, T][]>;
|
|
11
|
+
items: import(".").ReactiveValue<T[], T[]>;
|
|
12
|
+
addById<U extends {
|
|
13
|
+
id: string;
|
|
14
|
+
} & T>(item: U, options?: {
|
|
15
|
+
sequence?: number;
|
|
16
|
+
}): Registry<T>;
|
|
17
|
+
add(key: string, value: T, options?: {
|
|
18
|
+
sequence?: number;
|
|
19
|
+
}): Registry<T>;
|
|
20
|
+
get(key: string, defaultValue?: T): T;
|
|
21
|
+
delete(key: string): void;
|
|
22
|
+
has(key: string): boolean;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ComponentNode } from "../component_node";
|
|
2
|
+
import type { Fiber } from "./fibers";
|
|
3
|
+
export declare const fibersInError: WeakMap<Fiber, any>;
|
|
4
|
+
export declare const nodeErrorHandlers: WeakMap<ComponentNode, ((error: any, finalize: Function) => void)[]>;
|
|
5
|
+
type ErrorParams = {
|
|
6
|
+
error: any;
|
|
7
|
+
} & ({
|
|
8
|
+
node: ComponentNode;
|
|
9
|
+
} | {
|
|
10
|
+
fiber: Fiber;
|
|
11
|
+
});
|
|
12
|
+
export declare function handleError(params: ErrorParams): void;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BDom } from "../blockdom";
|
|
2
|
+
import type { ComponentNode } from "../component_node";
|
|
3
|
+
export declare function makeChildFiber(node: ComponentNode, parent: Fiber): Fiber;
|
|
4
|
+
export declare function makeRootFiber(node: ComponentNode): Fiber;
|
|
5
|
+
export declare class Fiber {
|
|
6
|
+
node: ComponentNode;
|
|
7
|
+
bdom: BDom | null;
|
|
8
|
+
root: RootFiber | null;
|
|
9
|
+
parent: Fiber | null;
|
|
10
|
+
children: Fiber[];
|
|
11
|
+
appliedToDom: boolean;
|
|
12
|
+
deep: boolean;
|
|
13
|
+
childrenMap: ComponentNode["children"];
|
|
14
|
+
constructor(node: ComponentNode, parent: Fiber | null);
|
|
15
|
+
render(): void;
|
|
16
|
+
_render(): void;
|
|
17
|
+
}
|
|
18
|
+
export declare class RootFiber extends Fiber {
|
|
19
|
+
counter: number;
|
|
20
|
+
willPatch: Fiber[];
|
|
21
|
+
patched: Fiber[];
|
|
22
|
+
mounted: Fiber[];
|
|
23
|
+
locked: boolean;
|
|
24
|
+
complete(): void;
|
|
25
|
+
setCounter(newValue: number): void;
|
|
26
|
+
}
|
|
27
|
+
type Position = "first-child" | "last-child";
|
|
28
|
+
export interface MountOptions {
|
|
29
|
+
position?: Position;
|
|
30
|
+
}
|
|
31
|
+
export declare class MountFiber extends RootFiber {
|
|
32
|
+
target: HTMLElement;
|
|
33
|
+
position: Position;
|
|
34
|
+
constructor(node: ComponentNode, target: HTMLElement, options?: MountOptions);
|
|
35
|
+
complete(): void;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ComponentNode } from "../component_node";
|
|
2
|
+
import { Fiber, RootFiber } from "./fibers";
|
|
3
|
+
export declare class Scheduler {
|
|
4
|
+
static requestAnimationFrame: (callback: FrameRequestCallback) => number;
|
|
5
|
+
tasks: Set<RootFiber>;
|
|
6
|
+
requestAnimationFrame: Window["requestAnimationFrame"];
|
|
7
|
+
frame: number;
|
|
8
|
+
delayedRenders: Fiber[];
|
|
9
|
+
cancelledNodes: Set<ComponentNode>;
|
|
10
|
+
processing: boolean;
|
|
11
|
+
constructor();
|
|
12
|
+
addFiber(fiber: Fiber): void;
|
|
13
|
+
scheduleDestroy(node: ComponentNode): void;
|
|
14
|
+
/**
|
|
15
|
+
* Process all current tasks. This only applies to the fibers that are ready.
|
|
16
|
+
* Other tasks are left unchanged.
|
|
17
|
+
*/
|
|
18
|
+
flush(): void;
|
|
19
|
+
processTasks(): void;
|
|
20
|
+
processFiber(fiber: RootFiber): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { OwlError } from "../../common/owl_error";
|
|
2
|
+
import { App } from "../app";
|
|
3
|
+
import { BDom, createCatcher, toggler } from "../blockdom";
|
|
4
|
+
import { ComponentNode } from "../component_node";
|
|
5
|
+
import { markRaw } from "../reactivity/proxy";
|
|
6
|
+
/**
|
|
7
|
+
* This file contains utility functions that will be injected in each template,
|
|
8
|
+
* to perform various useful tasks in the compiled code.
|
|
9
|
+
*/
|
|
10
|
+
declare function withDefault(value: any, defaultValue: any): any;
|
|
11
|
+
declare function callSlot(ctx: any, parent: any, key: string, name: string, dynamic: boolean, extra: any, defaultContent?: (ctx: any, node: any, key: string) => BDom): BDom;
|
|
12
|
+
declare function withKey(elem: any, k: string): any;
|
|
13
|
+
declare function prepareList(collection: unknown): [unknown[], unknown[], number, undefined[]];
|
|
14
|
+
declare function toNumber(val: string): number | string;
|
|
15
|
+
declare function shallowEqual(l1: any[], l2: any[]): boolean;
|
|
16
|
+
declare class LazyValue {
|
|
17
|
+
fn: any;
|
|
18
|
+
ctx: any;
|
|
19
|
+
component: any;
|
|
20
|
+
node: any;
|
|
21
|
+
key: any;
|
|
22
|
+
constructor(fn: any, ctx: any, component: any, node: any, key: any);
|
|
23
|
+
evaluate(): any;
|
|
24
|
+
toString(): any;
|
|
25
|
+
}
|
|
26
|
+
export declare function safeOutput(value: any, defaultValue?: any): ReturnType<typeof toggler>;
|
|
27
|
+
declare function createRef(ref: any): (el: HTMLElement | null, previousEl: HTMLElement | null) => void;
|
|
28
|
+
declare function callHandler(fn: any, ctx: any, ev: Event): void;
|
|
29
|
+
declare function modelExpr(value: any): any;
|
|
30
|
+
declare function createComponent<P extends Record<string, any>>(app: App, name: string | null, isStatic: boolean, hasSlotsProp: boolean, hasDynamicPropList: boolean, propList: string[]): (props: P, key: string, ctx: ComponentNode, parent: any, C: any) => any;
|
|
31
|
+
declare function callTemplate(subTemplate: string, owner: any, app: App, ctx: any, parent: any, key: any): any;
|
|
32
|
+
export declare const helpers: {
|
|
33
|
+
withDefault: typeof withDefault;
|
|
34
|
+
zero: symbol;
|
|
35
|
+
callSlot: typeof callSlot;
|
|
36
|
+
withKey: typeof withKey;
|
|
37
|
+
prepareList: typeof prepareList;
|
|
38
|
+
shallowEqual: typeof shallowEqual;
|
|
39
|
+
toNumber: typeof toNumber;
|
|
40
|
+
LazyValue: typeof LazyValue;
|
|
41
|
+
safeOutput: typeof safeOutput;
|
|
42
|
+
createCatcher: typeof createCatcher;
|
|
43
|
+
markRaw: typeof markRaw;
|
|
44
|
+
OwlError: typeof OwlError;
|
|
45
|
+
createRef: typeof createRef;
|
|
46
|
+
modelExpr: typeof modelExpr;
|
|
47
|
+
createComponent: typeof createComponent;
|
|
48
|
+
callTemplate: typeof callTemplate;
|
|
49
|
+
callHandler: typeof callHandler;
|
|
50
|
+
};
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface ResourceOptions<T> {
|
|
2
|
+
name?: string;
|
|
3
|
+
validation?: T;
|
|
4
|
+
}
|
|
5
|
+
export declare class Resource<T> {
|
|
6
|
+
private _items;
|
|
7
|
+
private _name?;
|
|
8
|
+
private _validation?;
|
|
9
|
+
constructor(options?: ResourceOptions<T>);
|
|
10
|
+
items: import(".").ReactiveValue<T[], T[]>;
|
|
11
|
+
add(item: T, options?: {
|
|
12
|
+
sequence?: number;
|
|
13
|
+
}): Resource<T>;
|
|
14
|
+
delete(item: T): Resource<T>;
|
|
15
|
+
has(item: T): boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function useResource<T>(r: Resource<T>, elements: T[]): void;
|
|
18
|
+
export {};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import type { ComponentNode } from "./component_node";
|
|
2
|
-
import { Fiber, RootFiber } from "./fibers";
|
|
3
|
-
export declare class Scheduler {
|
|
4
|
-
static requestAnimationFrame: ((callback: FrameRequestCallback) => number) & typeof requestAnimationFrame;
|
|
5
|
-
tasks: Set<RootFiber>;
|
|
6
|
-
requestAnimationFrame: Window["requestAnimationFrame"];
|
|
7
|
-
frame: number;
|
|
8
|
-
delayedRenders: Fiber[];
|
|
9
|
-
cancelledNodes: Set<ComponentNode>;
|
|
10
|
-
processing: boolean;
|
|
11
|
-
constructor();
|
|
12
|
-
addFiber(fiber: Fiber): void;
|
|
13
|
-
scheduleDestroy(node: ComponentNode): void;
|
|
14
|
-
/**
|
|
15
|
-
* Process all current tasks. This only applies to the fibers that are ready.
|
|
16
|
-
* Other tasks are left unchanged.
|
|
17
|
-
*/
|
|
18
|
-
flush(): void;
|
|
19
|
-
processTasks(): void;
|
|
20
|
-
processFiber(fiber: RootFiber): void;
|
|
21
|
-
}
|
|
1
|
+
import type { ComponentNode } from "./component_node";
|
|
2
|
+
import { Fiber, RootFiber } from "./fibers";
|
|
3
|
+
export declare class Scheduler {
|
|
4
|
+
static requestAnimationFrame: ((callback: FrameRequestCallback) => number) & typeof requestAnimationFrame;
|
|
5
|
+
tasks: Set<RootFiber>;
|
|
6
|
+
requestAnimationFrame: Window["requestAnimationFrame"];
|
|
7
|
+
frame: number;
|
|
8
|
+
delayedRenders: Fiber[];
|
|
9
|
+
cancelledNodes: Set<ComponentNode>;
|
|
10
|
+
processing: boolean;
|
|
11
|
+
constructor();
|
|
12
|
+
addFiber(fiber: Fiber): void;
|
|
13
|
+
scheduleDestroy(node: ComponentNode): void;
|
|
14
|
+
/**
|
|
15
|
+
* Process all current tasks. This only applies to the fibers that are ready.
|
|
16
|
+
* Other tasks are left unchanged.
|
|
17
|
+
*/
|
|
18
|
+
flush(): void;
|
|
19
|
+
processTasks(): void;
|
|
20
|
+
processFiber(fiber: RootFiber): void;
|
|
21
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { Component } from "./component";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export
|
|
1
|
+
import type { Component } from "./component";
|
|
2
|
+
import { Plugin } from "./plugin_manager";
|
|
3
|
+
export declare const enum STATUS {
|
|
4
|
+
NEW = 0,
|
|
5
|
+
MOUNTED = 1,// is ready, and in DOM. It has a valid el
|
|
6
|
+
CANCELLED = 2,
|
|
7
|
+
DESTROYED = 3
|
|
8
|
+
}
|
|
9
|
+
type STATUS_DESCR = "new" | "started" | "mounted" | "cancelled" | "destroyed";
|
|
10
|
+
export declare function status(entity: Component | Plugin): STATUS_DESCR;
|
|
11
|
+
export {};
|
|
@@ -1,40 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
export declare
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
export declare function xml(...args: Parameters<typeof String.raw>): string;
|
|
38
|
-
export declare namespace xml {
|
|
39
|
-
var nextId: number;
|
|
40
|
-
}
|
|
1
|
+
import { CustomDirectives, Template, TemplateFunction } from "../compiler";
|
|
2
|
+
export interface TemplateSetConfig {
|
|
3
|
+
dev?: boolean;
|
|
4
|
+
translatableAttributes?: string[];
|
|
5
|
+
translateFn?: (s: string, translationCtx: string) => string;
|
|
6
|
+
templates?: string | Document | Record<string, string>;
|
|
7
|
+
getTemplate?: (s: string) => Element | Function | string | void;
|
|
8
|
+
customDirectives?: CustomDirectives;
|
|
9
|
+
globalValues?: object;
|
|
10
|
+
}
|
|
11
|
+
export declare class TemplateSet {
|
|
12
|
+
static registerTemplate(name: string, fn: TemplateFunction): void;
|
|
13
|
+
dev: boolean;
|
|
14
|
+
rawTemplates: typeof globalTemplates;
|
|
15
|
+
templates: {
|
|
16
|
+
[name: string]: Template;
|
|
17
|
+
};
|
|
18
|
+
getRawTemplate?: (s: string) => Element | Function | string | void;
|
|
19
|
+
translateFn?: (s: string, translationCtx: string) => string;
|
|
20
|
+
translatableAttributes?: string[];
|
|
21
|
+
customDirectives: CustomDirectives;
|
|
22
|
+
runtimeUtils: object;
|
|
23
|
+
hasGlobalValues: boolean;
|
|
24
|
+
constructor(config?: TemplateSetConfig);
|
|
25
|
+
addTemplate(name: string, template: string | Element): void;
|
|
26
|
+
addTemplates(xml: string | Document): void;
|
|
27
|
+
getTemplate(name: string): Template;
|
|
28
|
+
private _compileTemplate;
|
|
29
|
+
}
|
|
30
|
+
export declare const globalTemplates: {
|
|
31
|
+
[key: string]: string | Element | TemplateFunction;
|
|
32
|
+
};
|
|
33
|
+
export declare function xml(...args: Parameters<typeof String.raw>): string;
|
|
34
|
+
export declare namespace xml {
|
|
35
|
+
var nextId: number;
|
|
36
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ReactiveValue } from "./reactivity/computations";
|
|
2
|
+
type Constructor<T = any> = {
|
|
3
|
+
new (...args: any[]): T;
|
|
4
|
+
};
|
|
5
|
+
export type GetOptionalEntries<T> = {
|
|
6
|
+
[K in keyof T as K extends `${infer P}?` ? P : never]?: T[K];
|
|
7
|
+
};
|
|
8
|
+
export type GetRequiredEntries<T> = {
|
|
9
|
+
[K in keyof T as K extends `${string}?` ? never : K]: T[K];
|
|
10
|
+
};
|
|
11
|
+
export type PrettifyShape<T> = T extends Function ? T : {
|
|
12
|
+
[K in keyof T]: T[K];
|
|
13
|
+
};
|
|
14
|
+
type ResolveOptionalEntries<T> = PrettifyShape<GetRequiredEntries<T> & GetOptionalEntries<T>>;
|
|
15
|
+
export type KeyedObject<K extends string[]> = {
|
|
16
|
+
[P in K[number]]: any;
|
|
17
|
+
};
|
|
18
|
+
type ResolveShapedObject<T extends {}> = PrettifyShape<ResolveOptionalEntries<T>>;
|
|
19
|
+
export type ResolveObjectType<T extends {}> = ResolveShapedObject<T extends string[] ? KeyedObject<T> : T>;
|
|
20
|
+
type UnionToIntersection<U> = (U extends any ? (_: U) => any : never) extends (_: infer I) => void ? I : never;
|
|
21
|
+
declare function arrayType(): any[];
|
|
22
|
+
declare function arrayType<T>(elementType: T): T[];
|
|
23
|
+
declare function constructorType<T extends Constructor>(constructor: T): T;
|
|
24
|
+
declare function customValidator<T>(type: T, validator: (value: T) => boolean, errorMessage?: string): T;
|
|
25
|
+
declare function functionType(): (...parameters: any[]) => any;
|
|
26
|
+
declare function functionType<const P extends any[]>(parameters: P): (...parameters: P) => void;
|
|
27
|
+
declare function functionType<const P extends any[], R>(parameters: P, result: R): (...parameters: P) => R;
|
|
28
|
+
declare function instanceType<T extends Constructor>(constructor: T): InstanceType<T>;
|
|
29
|
+
declare function intersection<T extends any[]>(types: T): UnionToIntersection<T[number]>;
|
|
30
|
+
type LiteralTypes = number | string | boolean | null | undefined;
|
|
31
|
+
declare function literalType<const T extends LiteralTypes>(literal: T): T;
|
|
32
|
+
declare function literalSelection<const T extends LiteralTypes>(literals: T[]): T;
|
|
33
|
+
declare function objectType(): Record<string, any>;
|
|
34
|
+
declare function objectType<const Keys extends string[]>(keys: Keys): ResolveOptionalEntries<KeyedObject<Keys>>;
|
|
35
|
+
declare function objectType<Shape extends {}>(shape: Shape): ResolveOptionalEntries<Shape>;
|
|
36
|
+
declare function strictObjectType<const Keys extends string[]>(keys: Keys): ResolveOptionalEntries<KeyedObject<Keys>>;
|
|
37
|
+
declare function strictObjectType<Shape extends {}>(shape: Shape): ResolveOptionalEntries<Shape>;
|
|
38
|
+
declare function promiseType(): Promise<void>;
|
|
39
|
+
declare function promiseType<T>(type: T): Promise<T>;
|
|
40
|
+
declare function recordType(): Record<PropertyKey, any>;
|
|
41
|
+
declare function recordType<V>(valueType: V): Record<PropertyKey, V>;
|
|
42
|
+
declare function tuple<const T extends any[]>(types: T): T;
|
|
43
|
+
declare function union<T extends any[]>(types: T): T[number];
|
|
44
|
+
declare function reactiveValueType(): ReactiveValue<any>;
|
|
45
|
+
declare function reactiveValueType<T>(type: T): ReactiveValue<T>;
|
|
46
|
+
declare function ref(): HTMLElement | null;
|
|
47
|
+
declare function ref<T extends Constructor<HTMLElement>>(type: T): InstanceType<T> | null;
|
|
48
|
+
export declare const types: {
|
|
49
|
+
and: typeof intersection;
|
|
50
|
+
any: any;
|
|
51
|
+
array: typeof arrayType;
|
|
52
|
+
boolean: boolean;
|
|
53
|
+
constructor: typeof constructorType;
|
|
54
|
+
customValidator: typeof customValidator;
|
|
55
|
+
function: typeof functionType;
|
|
56
|
+
instanceOf: typeof instanceType;
|
|
57
|
+
literal: typeof literalType;
|
|
58
|
+
number: number;
|
|
59
|
+
object: typeof objectType;
|
|
60
|
+
or: typeof union;
|
|
61
|
+
promise: typeof promiseType;
|
|
62
|
+
record: typeof recordType;
|
|
63
|
+
ref: typeof ref;
|
|
64
|
+
selection: typeof literalSelection;
|
|
65
|
+
signal: typeof reactiveValueType;
|
|
66
|
+
strictObject: typeof strictObjectType;
|
|
67
|
+
string: string;
|
|
68
|
+
tuple: typeof tuple;
|
|
69
|
+
};
|
|
70
|
+
export {};
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
export
|
|
2
|
-
/**
|
|
3
|
-
* Creates a batched version of a callback so that all calls to it in the same
|
|
4
|
-
* microtick will only call the original callback once.
|
|
5
|
-
*
|
|
6
|
-
* @param callback the callback to batch
|
|
7
|
-
* @returns a batched version of the original callback
|
|
8
|
-
*/
|
|
9
|
-
export declare function batched(callback: Callback): Callback;
|
|
10
|
-
/**
|
|
11
|
-
* Determine whether the given element is contained in its ownerDocument:
|
|
12
|
-
* either directly or with a shadow root in between.
|
|
13
|
-
*/
|
|
14
|
-
export declare function inOwnerDocument(el?: HTMLElement): boolean;
|
|
15
|
-
export declare function validateTarget(target: HTMLElement | ShadowRoot): void;
|
|
16
|
-
export declare class EventBus extends EventTarget {
|
|
17
|
-
trigger(name: string, payload?: any): void;
|
|
18
|
-
}
|
|
19
|
-
export declare function whenReady(fn?: any): Promise<void>;
|
|
20
|
-
export declare
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export declare function
|
|
24
|
-
export declare function markup(
|
|
25
|
-
export declare function markup(value: string): Markup;
|
|
1
|
+
export type Callback = (...args: any[]) => void;
|
|
2
|
+
/**
|
|
3
|
+
* Creates a batched version of a callback so that all calls to it in the same
|
|
4
|
+
* microtick will only call the original callback once.
|
|
5
|
+
*
|
|
6
|
+
* @param callback the callback to batch
|
|
7
|
+
* @returns a batched version of the original callback
|
|
8
|
+
*/
|
|
9
|
+
export declare function batched(callback: Callback): Callback;
|
|
10
|
+
/**
|
|
11
|
+
* Determine whether the given element is contained in its ownerDocument:
|
|
12
|
+
* either directly or with a shadow root in between.
|
|
13
|
+
*/
|
|
14
|
+
export declare function inOwnerDocument(el?: HTMLElement): boolean;
|
|
15
|
+
export declare function validateTarget(target: HTMLElement | ShadowRoot): void;
|
|
16
|
+
export declare class EventBus extends EventTarget {
|
|
17
|
+
trigger(name: string, payload?: any): void;
|
|
18
|
+
}
|
|
19
|
+
export declare function whenReady(fn?: any): Promise<void>;
|
|
20
|
+
export declare class Markup extends String {
|
|
21
|
+
}
|
|
22
|
+
export declare function htmlEscape(str: any): Markup;
|
|
23
|
+
export declare function markup(strings: TemplateStringsArray, ...placeholders: unknown[]): Markup;
|
|
24
|
+
export declare function markup(value: string): Markup;
|