@odoo/owl 3.0.0-alpha.35 → 3.0.0-alpha.37
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 +99 -36
- package/dist/owl.es.js +99 -36
- package/dist/owl.iife.js +99 -36
- package/dist/owl.iife.min.js +8 -8
- package/dist/types/owl.d.ts +72 -46
- package/package.json +4 -4
package/dist/types/owl.d.ts
CHANGED
|
@@ -156,21 +156,19 @@ export type Optional<T> = T & {
|
|
|
156
156
|
declare const typeBrand: unique symbol;
|
|
157
157
|
export type Type<T> = T & {
|
|
158
158
|
[typeBrand]: T;
|
|
159
|
-
/**
|
|
160
|
-
* Attaches a default value to the type. A defaulted value is implicitly
|
|
161
|
-
* optional: `undefined` passes validation (the default is meant to fill
|
|
162
|
-
* it). The default can be given as a factory (`() => value`), which is
|
|
163
|
-
* called once per consumer, so mutable defaults ([], {}) are not shared. A
|
|
164
|
-
* default for a function type must use the factory form.
|
|
165
|
-
*/
|
|
166
|
-
default(value: T extends Function ? () => T : T | (() => T)): WithDefault<T>;
|
|
167
159
|
/**
|
|
168
160
|
* Marks the type as optional: `undefined` passes validation, and an object
|
|
169
|
-
* key with an optional type may be omitted.
|
|
170
|
-
* already implicitly optional, so `.optional()` and `.default()` do not
|
|
171
|
-
* need to be combined (and cannot be chained).
|
|
161
|
+
* key with an optional type may be omitted.
|
|
172
162
|
*/
|
|
173
163
|
optional(): Optional<T>;
|
|
164
|
+
/**
|
|
165
|
+
* Marks the type as optional, with a default value to fill it: the reader
|
|
166
|
+
* of the value always gets one (the default replaces an omitted value). The
|
|
167
|
+
* default can be given as a factory (`() => value`), which is called once
|
|
168
|
+
* per consumer, so mutable defaults ([], {}) are not shared. A default for
|
|
169
|
+
* a function type must use the factory form.
|
|
170
|
+
*/
|
|
171
|
+
optional(value: T extends Function ? () => T : T | (() => T)): WithDefault<T>;
|
|
174
172
|
};
|
|
175
173
|
export type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
176
174
|
export type HasDefault<T> = IsAny<T> extends true ? false : T extends {
|
|
@@ -192,9 +190,7 @@ export type StripBrands<T> = StripType<StripDefault<StripOptional<T>>>;
|
|
|
192
190
|
export type StripBrandsAll<T extends any[]> = {
|
|
193
191
|
[K in keyof T]: StripBrands<T[K]>;
|
|
194
192
|
};
|
|
195
|
-
export type
|
|
196
|
-
[K in keyof T as HasDefault<T[K]> extends true ? K : never]: StripBrands<T[K]>;
|
|
197
|
-
};
|
|
193
|
+
export type GetDefaultedKeys<T> = keyof T extends infer K ? K extends keyof T ? HasDefault<T[K]> extends true ? K : never : never : never;
|
|
198
194
|
export type GetOptionalEntries<T> = {
|
|
199
195
|
[K in keyof T as IsOptional<T[K]> extends true ? K : HasDefault<T[K]> extends true ? K : never]?: StripBrands<T[K]>;
|
|
200
196
|
};
|
|
@@ -205,6 +201,11 @@ export type PrettifyShape<T> = T extends Function ? T : {
|
|
|
205
201
|
[K in keyof T]: T[K];
|
|
206
202
|
};
|
|
207
203
|
export type ResolveOptionalEntries<T> = PrettifyShape<GetRequiredEntries<T> & GetOptionalEntries<T>>;
|
|
204
|
+
export type ResolveReaderObjectType<T> = PrettifyShape<{
|
|
205
|
+
[K in keyof T as IsOptional<T[K]> extends true ? never : K]: StripBrands<T[K]>;
|
|
206
|
+
} & {
|
|
207
|
+
[K in keyof T as IsOptional<T[K]> extends true ? K : never]?: StripBrands<T[K]>;
|
|
208
|
+
}>;
|
|
208
209
|
export type KeyedObject<K extends string[]> = {
|
|
209
210
|
[P in K[number]]: any;
|
|
210
211
|
};
|
|
@@ -212,8 +213,8 @@ export type ResolveShapedObject<T extends {}> = PrettifyShape<ResolveOptionalEnt
|
|
|
212
213
|
export type ResolveObjectType<T extends {}> = ResolveShapedObject<T extends string[] ? KeyedObject<T> : T>;
|
|
213
214
|
export type UnionToIntersection<U> = (U extends any ? (_: U) => any : never) extends (_: infer I) => void ? I : never;
|
|
214
215
|
/**
|
|
215
|
-
* Returns the default value factory attached to a type by `.
|
|
216
|
-
* any. This is how consumers (props, config, ...) resolve defaults at
|
|
216
|
+
* Returns the default value factory attached to a type by `.optional(value)`,
|
|
217
|
+
* if any. This is how consumers (props, config, ...) resolve defaults at
|
|
217
218
|
* runtime: validation only runs in dev mode, so defaults are metadata on the
|
|
218
219
|
* schema, not a validation side-effect.
|
|
219
220
|
*/
|
|
@@ -238,9 +239,9 @@ declare function arrayType<T>(elementType: T): Type<StripBrands<T>[]>;
|
|
|
238
239
|
declare function constructorType<T extends Constructor>(constructor: T): Type<T>;
|
|
239
240
|
declare function customValidator<T>(type: T, validator: (value: StripBrands<T>) => boolean, errorMessage?: string): Type<StripBrands<T>>;
|
|
240
241
|
declare function functionType(): Type<(...parameters: any[]) => any>;
|
|
241
|
-
declare function functionType<const P extends
|
|
242
|
-
declare function functionType<const P extends
|
|
243
|
-
declare function functionType<const P extends
|
|
242
|
+
declare function functionType<const P extends unknown[]>(parameters: P): Type<(...parameters: StripBrandsAll<P>) => void>;
|
|
243
|
+
declare function functionType<const P extends unknown[], R>(): Type<(...parameters: P) => R>;
|
|
244
|
+
declare function functionType<const P extends unknown[], R>(parameters: P, result: R): Type<(...parameters: StripBrandsAll<P>) => StripBrands<R>>;
|
|
244
245
|
declare function instanceType<T extends Constructor>(constructor: T): Type<InstanceType<T>>;
|
|
245
246
|
declare function intersection<T extends any[]>(types: T): Type<UnionToIntersection<StripBrands<T[number]>>>;
|
|
246
247
|
export type LiteralTypes = number | string | boolean | null | undefined;
|
|
@@ -256,8 +257,8 @@ declare function promiseType(): Type<Promise<void>>;
|
|
|
256
257
|
declare function promiseType<T>(type: T): Type<Promise<StripBrands<T>>>;
|
|
257
258
|
declare function recordType(): Type<Record<PropertyKey, any>>;
|
|
258
259
|
declare function recordType<V>(valueType: V): Type<Record<PropertyKey, StripBrands<V>>>;
|
|
259
|
-
declare function tuple<const T extends
|
|
260
|
-
declare function union<T extends
|
|
260
|
+
declare function tuple<const T extends unknown[]>(types: T): Type<StripBrandsAll<T>>;
|
|
261
|
+
declare function union<T extends unknown[]>(types: T): Type<StripBrands<T[number]>>;
|
|
261
262
|
declare function reactiveValueType(): Type<ReactiveValue<any>>;
|
|
262
263
|
declare function reactiveValueType<T>(): Type<ReactiveValue<T>>;
|
|
263
264
|
declare function reactiveValueType<T>(type: T): Type<ReactiveValue<StripBrands<T>>>;
|
|
@@ -637,6 +638,11 @@ declare class ComponentNode extends Scope implements VNode<ComponentNode> {
|
|
|
637
638
|
willPatch: LifecycleHook[];
|
|
638
639
|
patched: LifecycleHook[];
|
|
639
640
|
signalComputation: ComputationAtom;
|
|
641
|
+
trackedRefs: Map<{
|
|
642
|
+
set(v: null): void;
|
|
643
|
+
}, {
|
|
644
|
+
value: HTMLElement | null;
|
|
645
|
+
}> | null;
|
|
640
646
|
constructor(C: ComponentConstructor, props: Record<string, any>, app: App, parent: ComponentNode | null, parentKey: string | null);
|
|
641
647
|
decorate(f: Function, hookName: string): Function;
|
|
642
648
|
initiateRender(fiber: Fiber | MountFiber): Promise<void>;
|
|
@@ -645,6 +651,19 @@ declare class ComponentNode extends Scope implements VNode<ComponentNode> {
|
|
|
645
651
|
_cancel(): void;
|
|
646
652
|
destroy(): void;
|
|
647
653
|
_destroy(): void;
|
|
654
|
+
/**
|
|
655
|
+
* Unset any tracked t-ref whose element is no longer in the document, and stop
|
|
656
|
+
* tracking it (createRef re-registers it on the next render if the element
|
|
657
|
+
* comes back). `isConnected` is the discriminator: a ref the block's own
|
|
658
|
+
* remove() failed to clear (bulk removal) points at a detached element and is
|
|
659
|
+
* cleared, while a ref a surviving sibling just took over (t-if/t-else with a
|
|
660
|
+
* shared signal) points at a still-connected element and is left alone.
|
|
661
|
+
*
|
|
662
|
+
* Called after this component's dom settles: at the tail of `_patch` (before
|
|
663
|
+
* user `onPatched`), so an element removed in place is caught, and — for the
|
|
664
|
+
* nodes collected during `_destroy` — after a removed subtree is detached.
|
|
665
|
+
*/
|
|
666
|
+
sweepRefs(): void;
|
|
648
667
|
/**
|
|
649
668
|
* Finds a child that has dom that is not yet updated, and update it. This
|
|
650
669
|
* method is meant to be used only in the context of repatching the dom after
|
|
@@ -655,6 +674,16 @@ declare class ComponentNode extends Scope implements VNode<ComponentNode> {
|
|
|
655
674
|
mount(parent: HTMLElement, anchor: ChildNode): void;
|
|
656
675
|
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement): void;
|
|
657
676
|
moveBeforeVNode(other: ComponentNode | null, afterNode: Node | null): void;
|
|
677
|
+
/**
|
|
678
|
+
* Register a t-ref signal bound to an element this component hosts, so its
|
|
679
|
+
* lifecycle can clear it (see sweepRefs / _destroy). Idempotent — re-tracking
|
|
680
|
+
* the same signal on each render just refreshes its atom.
|
|
681
|
+
*/
|
|
682
|
+
trackRef(ref: {
|
|
683
|
+
set(v: null): void;
|
|
684
|
+
}, atom: {
|
|
685
|
+
value: HTMLElement | null;
|
|
686
|
+
}): void;
|
|
658
687
|
patch(): void;
|
|
659
688
|
_patch(): void;
|
|
660
689
|
beforeRemove(): void;
|
|
@@ -680,22 +709,31 @@ declare function staticProp<T>(key: string, type: WithDefault<T>): T;
|
|
|
680
709
|
declare function staticProp<T>(key: string, type: Optional<T>): T | undefined;
|
|
681
710
|
declare function staticProp<T>(key: string, type: T): StripBrands<T>;
|
|
682
711
|
declare const isProps: unique symbol;
|
|
683
|
-
export type WithDefaults<T, D> = T & Required<D>;
|
|
684
712
|
export type Props<T extends {}> = T & {
|
|
685
|
-
[isProps]:
|
|
713
|
+
[isProps]: never;
|
|
714
|
+
};
|
|
715
|
+
export type PropsWithDefaults<T extends {}, DK extends PropertyKey> = T & {
|
|
716
|
+
[isProps]: DK;
|
|
686
717
|
};
|
|
687
|
-
export type GetPropsWithOptionals<T> = T extends
|
|
718
|
+
export type GetPropsWithOptionals<T> = T extends {
|
|
719
|
+
[isProps]: infer DK extends PropertyKey;
|
|
720
|
+
} ? Omit<T, typeof isProps | (DK & keyof T)> & Partial<Pick<T, DK & keyof T>> : never;
|
|
688
721
|
export type GetProps<T> = {
|
|
689
722
|
[K in keyof T]: T[K] extends {
|
|
690
|
-
[isProps]:
|
|
723
|
+
[isProps]: PropertyKey;
|
|
691
724
|
} ? (x: GetPropsWithOptionals<T[K]>) => void : never;
|
|
692
725
|
}[keyof T] extends (x: infer I) => void ? {
|
|
693
726
|
[K in keyof I]: I[K];
|
|
694
727
|
} : never;
|
|
728
|
+
export type ResolveProps<Shape> = [
|
|
729
|
+
GetDefaultedKeys<Shape>
|
|
730
|
+
] extends [
|
|
731
|
+
never
|
|
732
|
+
] ? Props<ResolveReaderObjectType<Shape>> : PropsWithDefaults<ResolveReaderObjectType<Shape>, GetDefaultedKeys<Shape> & PropertyKey>;
|
|
695
733
|
export interface PropsFunction {
|
|
696
734
|
(): Props<Record<string, any>>;
|
|
697
735
|
<const Keys extends string[]>(keys: Keys): Props<ResolveObjectType<Keys>>;
|
|
698
|
-
<Shape extends {}>(shape: Shape):
|
|
736
|
+
<Shape extends {}>(shape: Shape): ResolveProps<Shape>;
|
|
699
737
|
static: typeof staticProp;
|
|
700
738
|
}
|
|
701
739
|
export declare const props: PropsFunction;
|
|
@@ -789,41 +827,29 @@ export declare class App extends TemplateSet {
|
|
|
789
827
|
declare function mount$1<T extends ComponentConstructor>(C: T, target: MountTarget, config?: AppConfig & RootConfig<GetProps<ComponentInstance<T>>> & MountOptions): Promise<ComponentInstance<T>>;
|
|
790
828
|
export declare class ErrorBoundary extends Component {
|
|
791
829
|
static template: string;
|
|
792
|
-
props:
|
|
793
|
-
error
|
|
794
|
-
},
|
|
795
|
-
error: WithDefault<ReactiveValue<any, any>>;
|
|
796
|
-
}>>>;
|
|
830
|
+
props: PropsWithDefaults<{
|
|
831
|
+
error: ReactiveValue<any, any>;
|
|
832
|
+
}, "error">;
|
|
797
833
|
setup(): void;
|
|
798
834
|
}
|
|
799
835
|
export declare class Portal extends Component {
|
|
800
836
|
static template: string;
|
|
801
|
-
props: Props<
|
|
837
|
+
props: Props<{
|
|
802
838
|
slots: {
|
|
803
839
|
default: any;
|
|
804
840
|
};
|
|
805
|
-
target:
|
|
806
|
-
}
|
|
807
|
-
slots: Type<{
|
|
808
|
-
default: any;
|
|
809
|
-
}>;
|
|
810
|
-
target: any;
|
|
811
|
-
}>>>;
|
|
841
|
+
target: string | HTMLElement | ReactiveValue<HTMLElement, HTMLElement>;
|
|
842
|
+
}>;
|
|
812
843
|
setup(): void;
|
|
813
844
|
}
|
|
814
845
|
export declare class Suspense extends Component {
|
|
815
846
|
static template: string;
|
|
816
|
-
props: Props<
|
|
847
|
+
props: Props<{
|
|
817
848
|
slots: {
|
|
818
849
|
default: any;
|
|
819
850
|
fallback: any;
|
|
820
851
|
};
|
|
821
|
-
}
|
|
822
|
-
slots: Type<{
|
|
823
|
-
default: any;
|
|
824
|
-
fallback: any;
|
|
825
|
-
}>;
|
|
826
|
-
}>>>;
|
|
852
|
+
}>;
|
|
827
853
|
private prepared;
|
|
828
854
|
private mounted;
|
|
829
855
|
private subRootMounted;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odoo/owl",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.37",
|
|
4
4
|
"description": "Odoo Web Library (OWL)",
|
|
5
5
|
"main": "dist/owl.cjs.js",
|
|
6
6
|
"module": "dist/owl.es.js",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
},
|
|
44
44
|
"homepage": "https://github.com/odoo/owl#readme",
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@odoo/owl-compiler": "3.0.0-alpha.
|
|
47
|
-
"@odoo/owl-core": "3.0.0-alpha.
|
|
48
|
-
"@odoo/owl-runtime": "3.0.0-alpha.
|
|
46
|
+
"@odoo/owl-compiler": "3.0.0-alpha.37",
|
|
47
|
+
"@odoo/owl-core": "3.0.0-alpha.37",
|
|
48
|
+
"@odoo/owl-runtime": "3.0.0-alpha.37",
|
|
49
49
|
"jsdom": "^25.0.1"
|
|
50
50
|
}
|
|
51
51
|
}
|