@odoo/owl 3.0.0-alpha.25 → 3.0.0-alpha.28
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/dist/owl.cjs.js +6648 -6618
- package/dist/owl.es.js +6628 -6577
- package/dist/owl.iife.js +6818 -6790
- package/dist/owl.iife.min.js +27 -1
- package/dist/types/owl.d.ts +679 -624
- package/package.json +9 -95
- package/LICENSE +0 -856
- package/README.md +0 -139
- package/dist/compile_templates.mjs +0 -2458
- package/dist/owl-devtools.zip +0 -0
- package/dist/types/common/owl_error.d.ts +0 -3
- package/dist/types/common/utils.d.ts +0 -8
- package/dist/types/compiler/code_generator.d.ts +0 -133
- package/dist/types/compiler/index.d.ts +0 -13
- package/dist/types/compiler/inline_expressions.d.ts +0 -41
- package/dist/types/compiler/parser.d.ts +0 -170
- 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 -54
- package/dist/types/runtime/blockdom/attributes.d.ts +0 -8
- 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 -25
- 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/component.d.ts +0 -17
- package/dist/types/runtime/component_node.d.ts +0 -59
- package/dist/types/runtime/context.d.ts +0 -36
- package/dist/types/runtime/event_handling.d.ts +0 -1
- package/dist/types/runtime/hooks.d.ts +0 -32
- package/dist/types/runtime/index.d.ts +0 -46
- package/dist/types/runtime/lifecycle_hooks.d.ts +0 -10
- package/dist/types/runtime/plugin_hooks.d.ts +0 -6
- package/dist/types/runtime/plugin_manager.d.ts +0 -36
- package/dist/types/runtime/props.d.ts +0 -21
- package/dist/types/runtime/reactivity/computations.d.ts +0 -34
- package/dist/types/runtime/reactivity/computed.d.ts +0 -6
- package/dist/types/runtime/reactivity/effect.d.ts +0 -1
- package/dist/types/runtime/reactivity/proxy.d.ts +0 -47
- package/dist/types/runtime/reactivity/signal.d.ts +0 -31
- package/dist/types/runtime/registry.d.ts +0 -24
- package/dist/types/runtime/rendering/error_handling.d.ts +0 -13
- package/dist/types/runtime/rendering/fibers.d.ts +0 -36
- package/dist/types/runtime/rendering/scheduler.d.ts +0 -20
- package/dist/types/runtime/rendering/template_helpers.d.ts +0 -51
- package/dist/types/runtime/resource.d.ts +0 -18
- package/dist/types/runtime/status.d.ts +0 -11
- package/dist/types/runtime/template_set.d.ts +0 -36
- package/dist/types/runtime/types.d.ts +0 -77
- package/dist/types/runtime/utils.d.ts +0 -24
- package/dist/types/runtime/validation.d.ts +0 -19
- package/dist/types/version.d.ts +0 -1
- package/tools/compile_owl_templates.mjs +0 -31
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { App } from "./app";
|
|
2
|
-
import { BDom, VNode } from "./blockdom";
|
|
3
|
-
import { Component, ComponentConstructor } from "./component";
|
|
4
|
-
import { PluginManager } from "./plugin_manager";
|
|
5
|
-
import { ComputationAtom } from "./reactivity/computations";
|
|
6
|
-
import { Fiber, MountFiber, MountOptions } from "./rendering/fibers";
|
|
7
|
-
import { STATUS } from "./status";
|
|
8
|
-
type LifecycleHook = Function;
|
|
9
|
-
export declare class ComponentNode implements VNode<ComponentNode> {
|
|
10
|
-
el?: HTMLElement | Text | undefined;
|
|
11
|
-
app: App;
|
|
12
|
-
fiber: Fiber | null;
|
|
13
|
-
component: Component;
|
|
14
|
-
bdom: BDom | null;
|
|
15
|
-
status: STATUS;
|
|
16
|
-
forceNextRender: boolean;
|
|
17
|
-
parentKey: string | null;
|
|
18
|
-
props: Record<string, any>;
|
|
19
|
-
defaultProps: Record<string, any>;
|
|
20
|
-
renderFn: Function;
|
|
21
|
-
parent: ComponentNode | null;
|
|
22
|
-
children: {
|
|
23
|
-
[key: string]: ComponentNode;
|
|
24
|
-
};
|
|
25
|
-
willStart: LifecycleHook[];
|
|
26
|
-
willUpdateProps: LifecycleHook[];
|
|
27
|
-
willUnmount: LifecycleHook[];
|
|
28
|
-
mounted: LifecycleHook[];
|
|
29
|
-
willPatch: LifecycleHook[];
|
|
30
|
-
patched: LifecycleHook[];
|
|
31
|
-
willDestroy: LifecycleHook[];
|
|
32
|
-
signalComputation: ComputationAtom;
|
|
33
|
-
computations: ComputationAtom[];
|
|
34
|
-
pluginManager: PluginManager;
|
|
35
|
-
constructor(C: ComponentConstructor, props: Record<string, any>, app: App, parent: ComponentNode | null, parentKey: string | null);
|
|
36
|
-
mountComponent(target: any, options?: MountOptions): void;
|
|
37
|
-
initiateRender(fiber: Fiber | MountFiber): Promise<void>;
|
|
38
|
-
render(deep: boolean): Promise<void>;
|
|
39
|
-
cancel(): void;
|
|
40
|
-
_cancel(): void;
|
|
41
|
-
destroy(): void;
|
|
42
|
-
_destroy(): void;
|
|
43
|
-
updateAndRender(props: Record<string, any>, parentFiber: Fiber): Promise<void>;
|
|
44
|
-
/**
|
|
45
|
-
* Finds a child that has dom that is not yet updated, and update it. This
|
|
46
|
-
* method is meant to be used only in the context of repatching the dom after
|
|
47
|
-
* a mounted hook failed and was handled.
|
|
48
|
-
*/
|
|
49
|
-
updateDom(): void;
|
|
50
|
-
firstNode(): Node | undefined;
|
|
51
|
-
mount(parent: HTMLElement, anchor: ChildNode): void;
|
|
52
|
-
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement): void;
|
|
53
|
-
moveBeforeVNode(other: ComponentNode | null, afterNode: Node | null): void;
|
|
54
|
-
patch(): void;
|
|
55
|
-
_patch(): void;
|
|
56
|
-
beforeRemove(): void;
|
|
57
|
-
remove(): void;
|
|
58
|
-
}
|
|
59
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { App } from "./app";
|
|
2
|
-
import { type ComponentNode } from "./component_node";
|
|
3
|
-
import { PluginManager } from "./plugin_manager";
|
|
4
|
-
import { STATUS } from "./status";
|
|
5
|
-
interface ComponentContext {
|
|
6
|
-
type: "component";
|
|
7
|
-
app: App;
|
|
8
|
-
componentName: string;
|
|
9
|
-
node: ComponentNode;
|
|
10
|
-
status: STATUS;
|
|
11
|
-
}
|
|
12
|
-
interface PluginContext {
|
|
13
|
-
type: "plugin";
|
|
14
|
-
app: App;
|
|
15
|
-
manager: PluginManager;
|
|
16
|
-
status: STATUS;
|
|
17
|
-
}
|
|
18
|
-
type Contexts = {
|
|
19
|
-
plugin: PluginContext;
|
|
20
|
-
component: ComponentContext;
|
|
21
|
-
};
|
|
22
|
-
type Context = Contexts[keyof Contexts];
|
|
23
|
-
export declare let contextStack: Context[];
|
|
24
|
-
export declare function saveContext(): () => void;
|
|
25
|
-
export declare function getContext<K extends keyof Contexts>(type?: K): K extends string ? Contexts[K] : Context;
|
|
26
|
-
export interface CapturedContext {
|
|
27
|
-
run<T = void>(callback: () => T): T;
|
|
28
|
-
protectAsync<P extends any[], R>(callback: (...args: P) => Promise<R>): (...args: P) => Promise<R>;
|
|
29
|
-
runWithAsyncProtection<T>(callback: () => Promise<T>): Promise<T>;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Captures the current context and gives methods to run
|
|
33
|
-
* functions within the captured context.
|
|
34
|
-
*/
|
|
35
|
-
export declare function useContext(): CapturedContext;
|
|
36
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const mainEventHandler: (data: any, ev: Event, currentTarget?: EventTarget | null) => boolean;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { App } from "./app";
|
|
2
|
-
import { effect } from "./reactivity/effect";
|
|
3
|
-
import { Signal } from "./reactivity/signal";
|
|
4
|
-
/**
|
|
5
|
-
* This hook will run a callback when a component is mounted and patched, and
|
|
6
|
-
* will run a cleanup function before patching and before unmounting the
|
|
7
|
-
* the component.
|
|
8
|
-
*
|
|
9
|
-
* @template T
|
|
10
|
-
* @param {Effect<T>} effect the effect to run on component mount and/or patch
|
|
11
|
-
* @param {()=>[...T]} [computeDependencies=()=>[NaN]] a callback to compute
|
|
12
|
-
* dependencies that will decide if the effect needs to be cleaned up and
|
|
13
|
-
* run again. If the dependencies did not change, the effect will not run
|
|
14
|
-
* again. The default value returns an array containing only NaN because
|
|
15
|
-
* NaN !== NaN, which will cause the effect to rerun on every patch.
|
|
16
|
-
*/
|
|
17
|
-
export declare function useEffect(fn: Parameters<typeof effect>[0]): void;
|
|
18
|
-
/**
|
|
19
|
-
* When a component needs to listen to DOM Events on element(s) that are not
|
|
20
|
-
* part of his hierarchy, we can use the `useListener` hook.
|
|
21
|
-
* It will immediately add the listener, and remove it whenever the plugin or
|
|
22
|
-
* component is destroyed.
|
|
23
|
-
*
|
|
24
|
-
* Example:
|
|
25
|
-
* a menu needs to listen to the click on window to be closed automatically
|
|
26
|
-
*
|
|
27
|
-
* Usage:
|
|
28
|
-
* in the constructor of the OWL component that needs to be notified,
|
|
29
|
-
* `useListener(window, 'click', () => this._doSomething());`
|
|
30
|
-
* */
|
|
31
|
-
export declare function useListener(target: EventTarget | Signal<EventTarget | null>, eventName: string, handler: EventListener, eventParams?: AddEventListenerOptions): void;
|
|
32
|
-
export declare function useApp(): App;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { createBlock, html, list, mount as blockMount, multi, patch, remove, text, toggler, comment } from "./blockdom";
|
|
2
|
-
export { Resource, useResource } from "./resource";
|
|
3
|
-
export { Registry } from "./registry";
|
|
4
|
-
export declare const blockDom: {
|
|
5
|
-
config: {
|
|
6
|
-
shouldNormalizeDom: boolean;
|
|
7
|
-
mainEventHandler: (data: any, ev: Event, currentTarget?: EventTarget | null) => boolean;
|
|
8
|
-
};
|
|
9
|
-
mount: typeof blockMount;
|
|
10
|
-
patch: typeof patch;
|
|
11
|
-
remove: typeof remove;
|
|
12
|
-
list: typeof list;
|
|
13
|
-
multi: typeof multi;
|
|
14
|
-
text: typeof text;
|
|
15
|
-
toggler: typeof toggler;
|
|
16
|
-
createBlock: typeof createBlock;
|
|
17
|
-
html: typeof html;
|
|
18
|
-
comment: typeof comment;
|
|
19
|
-
};
|
|
20
|
-
export { App, mount } from "./app";
|
|
21
|
-
export { xml } from "./template_set";
|
|
22
|
-
export { Component } from "./component";
|
|
23
|
-
export type { ComponentConstructor } from "./component";
|
|
24
|
-
export { props } from "./props";
|
|
25
|
-
export type { GetProps } from "./props";
|
|
26
|
-
export { status } from "./status";
|
|
27
|
-
export { proxy, markRaw, toRaw } from "./reactivity/proxy";
|
|
28
|
-
export { untrack, type ReactiveValue } from "./reactivity/computations";
|
|
29
|
-
export { signal, type Signal } from "./reactivity/signal";
|
|
30
|
-
export { computed } from "./reactivity/computed";
|
|
31
|
-
export { effect } from "./reactivity/effect";
|
|
32
|
-
export { useEffect, useListener, useApp } from "./hooks";
|
|
33
|
-
export { batched, EventBus, htmlEscape, whenReady, markup } from "./utils";
|
|
34
|
-
export { onWillStart, onMounted, onWillUnmount, onWillUpdateProps, onWillPatch, onPatched, onWillDestroy, onError, } from "./lifecycle_hooks";
|
|
35
|
-
export { assertType, validateType } from "./validation";
|
|
36
|
-
export { types } from "./types";
|
|
37
|
-
export { OwlError } from "../common/owl_error";
|
|
38
|
-
export { config, plugin, providePlugins } from "./plugin_hooks";
|
|
39
|
-
export type { PluginInstance } from "./plugin_hooks";
|
|
40
|
-
export { Plugin } from "./plugin_manager";
|
|
41
|
-
export type { PluginConstructor } from "./plugin_manager";
|
|
42
|
-
export { useContext } from "./context";
|
|
43
|
-
export type { CapturedContext } from "./context";
|
|
44
|
-
export declare const __info__: {
|
|
45
|
-
version: string;
|
|
46
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare function onWillStart(fn: () => Promise<void> | void | any): void;
|
|
2
|
-
export declare function onWillUpdateProps(fn: (nextProps: any) => Promise<void> | void | any): void;
|
|
3
|
-
export declare function onMounted(fn: () => void | any): void;
|
|
4
|
-
export declare function onWillPatch(fn: () => any | void): void;
|
|
5
|
-
export declare function onPatched(fn: () => void | any): void;
|
|
6
|
-
export declare function onWillUnmount(fn: () => void | any): void;
|
|
7
|
-
export declare function onWillDestroy(fn: () => void | any): void;
|
|
8
|
-
type OnErrorCallback = (error: any) => void | any;
|
|
9
|
-
export declare function onError(callback: OnErrorCallback): void;
|
|
10
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { PluginConstructor } from "./plugin_manager";
|
|
2
|
-
import { Resource } from "./resource";
|
|
3
|
-
export type PluginInstance<T extends PluginConstructor> = Omit<InstanceType<T>, "setup">;
|
|
4
|
-
export declare function plugin<T extends PluginConstructor>(pluginType: T): PluginInstance<T>;
|
|
5
|
-
export declare function config<T = any>(name: string, type?: T): T;
|
|
6
|
-
export declare function providePlugins(pluginConstructors: PluginConstructor[] | Resource<PluginConstructor>, config?: Record<string, any>): void;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { App } from "./app";
|
|
2
|
-
import { ComputationAtom } from "./reactivity/computations";
|
|
3
|
-
import { Resource } from "./resource";
|
|
4
|
-
import { STATUS } from "./status";
|
|
5
|
-
export interface PluginConstructor {
|
|
6
|
-
new (...args: any[]): Plugin;
|
|
7
|
-
id: string;
|
|
8
|
-
}
|
|
9
|
-
export declare class Plugin {
|
|
10
|
-
private static _shadowId;
|
|
11
|
-
static get id(): string;
|
|
12
|
-
static set id(shadowId: string);
|
|
13
|
-
__owl__: PluginManager;
|
|
14
|
-
constructor(manager: PluginManager);
|
|
15
|
-
setup(): void;
|
|
16
|
-
}
|
|
17
|
-
interface PluginManagerOptions {
|
|
18
|
-
parent?: PluginManager | null;
|
|
19
|
-
config?: Record<string, any>;
|
|
20
|
-
}
|
|
21
|
-
export declare class PluginManager {
|
|
22
|
-
app: App;
|
|
23
|
-
config: Record<string, any>;
|
|
24
|
-
onDestroyCb: Function[];
|
|
25
|
-
computations: ComputationAtom[];
|
|
26
|
-
plugins: Record<string, Plugin>;
|
|
27
|
-
status: STATUS;
|
|
28
|
-
constructor(app: App, options?: PluginManagerOptions);
|
|
29
|
-
destroy(): void;
|
|
30
|
-
getPluginById<T extends Plugin>(id: string): T | null;
|
|
31
|
-
getPlugin<T extends PluginConstructor>(pluginConstructor: T): InstanceType<T> | null;
|
|
32
|
-
startPlugin<T extends PluginConstructor>(pluginConstructor: T): InstanceType<T> | null;
|
|
33
|
-
startPlugins(pluginConstructors: PluginConstructor[]): void;
|
|
34
|
-
}
|
|
35
|
-
export declare function startPlugins(manager: PluginManager, plugins: PluginConstructor[] | Resource<PluginConstructor>): void;
|
|
36
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { GetOptionalEntries, KeyedObject, PrettifyShape, ResolveObjectType } from "./types";
|
|
2
|
-
declare const isProps: unique symbol;
|
|
3
|
-
export type WithDefaults<T, D> = T & Required<D>;
|
|
4
|
-
export type Props<T extends {}> = T & {
|
|
5
|
-
[isProps]: true;
|
|
6
|
-
};
|
|
7
|
-
type GetPropsDefaults<T extends object> = PrettifyShape<GetOptionalEntries<T>>;
|
|
8
|
-
type GetPropsWithOptionals<T> = T extends Props<infer P> ? (P extends WithDefaults<infer R, any> ? R : P) : never;
|
|
9
|
-
export type GetProps<T> = {
|
|
10
|
-
[K in keyof T]: T[K] extends {
|
|
11
|
-
[isProps]: true;
|
|
12
|
-
} ? (x: GetPropsWithOptionals<T[K]>) => void : never;
|
|
13
|
-
}[keyof T] extends (x: infer I) => void ? {
|
|
14
|
-
[K in keyof I]: I[K];
|
|
15
|
-
} : never;
|
|
16
|
-
export declare function props(): Props<Record<string, any>>;
|
|
17
|
-
export declare function props<const Keys extends string[]>(keys: Keys): Props<ResolveObjectType<Keys>>;
|
|
18
|
-
export declare function props<const Keys extends string[], Defaults>(keys: Keys, defaults: Defaults & GetPropsDefaults<KeyedObject<Keys>>): Props<WithDefaults<ResolveObjectType<Keys>, Defaults>>;
|
|
19
|
-
export declare function props<Shape extends {}>(shape: Shape): Props<ResolveObjectType<Shape>>;
|
|
20
|
-
export declare function props<Shape extends {}, Defaults>(shape: Shape, defaults: Defaults & GetPropsDefaults<Shape>): Props<WithDefaults<ResolveObjectType<Shape>, Defaults>>;
|
|
21
|
-
export {};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export interface ReactiveValue<TRead, TWrite = TRead> {
|
|
2
|
-
(): TRead;
|
|
3
|
-
/**
|
|
4
|
-
* Update the value of the reactive with a new value. If the new value is different
|
|
5
|
-
* from the previous values, all computations that depends on this reactive will
|
|
6
|
-
* be invalidated, and effects will rerun.
|
|
7
|
-
*/
|
|
8
|
-
set(nextValue: TWrite): void;
|
|
9
|
-
}
|
|
10
|
-
export declare enum ComputationState {
|
|
11
|
-
EXECUTED = 0,
|
|
12
|
-
STALE = 1,
|
|
13
|
-
PENDING = 2
|
|
14
|
-
}
|
|
15
|
-
export interface Atom<T = any> {
|
|
16
|
-
observers: Set<ComputationAtom>;
|
|
17
|
-
value: T;
|
|
18
|
-
}
|
|
19
|
-
export interface ComputationAtom<T = any> extends Atom<T> {
|
|
20
|
-
compute: () => T;
|
|
21
|
-
isDerived: boolean;
|
|
22
|
-
sources: Set<Atom>;
|
|
23
|
-
state: ComputationState;
|
|
24
|
-
}
|
|
25
|
-
export declare const atomSymbol: unique symbol;
|
|
26
|
-
export declare function createComputation(compute: () => any, isDerived: boolean, state?: ComputationState): ComputationAtom;
|
|
27
|
-
export declare function onReadAtom(atom: Atom): void;
|
|
28
|
-
export declare function onWriteAtom(atom: Atom): void;
|
|
29
|
-
export declare function getCurrentComputation(): ComputationAtom<any> | undefined;
|
|
30
|
-
export declare function setComputation(computation: ComputationAtom | undefined): void;
|
|
31
|
-
export declare function updateComputation(computation: ComputationAtom): void;
|
|
32
|
-
export declare function removeSources(computation: ComputationAtom): void;
|
|
33
|
-
export declare function disposeComputation(computation: ComputationAtom): void;
|
|
34
|
-
export declare function untrack<T>(fn: (...args: any[]) => T): T;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ReactiveValue } from "./computations";
|
|
2
|
-
interface ComputedOptions<TWrite> {
|
|
3
|
-
set?(value: TWrite): void;
|
|
4
|
-
}
|
|
5
|
-
export declare function computed<TRead, TWrite = TRead>(getter: () => TRead, options?: ComputedOptions<TWrite>): ReactiveValue<TRead, TWrite>;
|
|
6
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function effect<T>(fn: () => T): () => void;
|
|
@@ -1,47 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,31 +0,0 @@
|
|
|
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,24 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,13 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,36 +0,0 @@
|
|
|
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
|
-
}
|
|
17
|
-
export declare class RootFiber extends Fiber {
|
|
18
|
-
counter: number;
|
|
19
|
-
willPatch: Fiber[];
|
|
20
|
-
patched: Fiber[];
|
|
21
|
-
mounted: Fiber[];
|
|
22
|
-
locked: boolean;
|
|
23
|
-
complete(): void;
|
|
24
|
-
setCounter(newValue: number): void;
|
|
25
|
-
}
|
|
26
|
-
type Position = "first-child" | "last-child";
|
|
27
|
-
export interface MountOptions {
|
|
28
|
-
position?: Position;
|
|
29
|
-
}
|
|
30
|
-
export declare class MountFiber extends RootFiber {
|
|
31
|
-
target: HTMLElement;
|
|
32
|
-
position: Position;
|
|
33
|
-
constructor(node: ComponentNode, target: HTMLElement, options?: MountOptions);
|
|
34
|
-
complete(): void;
|
|
35
|
-
}
|
|
36
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,18 +0,0 @@
|
|
|
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,11 +0,0 @@
|
|
|
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,36 +0,0 @@
|
|
|
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
|
-
}
|