@odoo/owl 3.0.0-alpha.40 → 3.0.0-alpha.42

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.
@@ -171,6 +171,20 @@ export type Type<T> = T & {
171
171
  optional(value: T extends Function ? () => T : T | (() => T)): WithDefault<T>;
172
172
  type: T;
173
173
  };
174
+ /**
175
+ * A {@link Type} that also carries the object shape it was built from, exposed
176
+ * through `toShape()`: `t.object`/`t.strictObject` return their own shape, and
177
+ * `t.and` merges the shapes of the members that have one. The shape is the
178
+ * `{ key: type }` map (with `.optional()` brands intact), so it can be reused —
179
+ * most notably to drive component props: `props(schema.toShape())`.
180
+ */
181
+ export type ShapeType<Shape, T> = Type<T> & {
182
+ toShape(): Shape;
183
+ };
184
+ export type MemberShape<M> = M extends {
185
+ toShape(): infer S;
186
+ } ? S : never;
187
+ export type MergedShape<T extends any[]> = UnionToIntersection<MemberShape<T[number]>>;
174
188
  export type IsAny<T> = 0 extends 1 & T ? true : false;
175
189
  export type HasDefault<T> = IsAny<T> extends true ? false : T extends {
176
190
  [hasDefault]: any;
@@ -244,16 +258,16 @@ declare function functionType<const P extends unknown[]>(parameters: P): Type<(.
244
258
  declare function functionType<const P extends unknown[], R>(): Type<(...parameters: P) => R>;
245
259
  declare function functionType<const P extends unknown[], R>(parameters: P, result: R): Type<(...parameters: StripBrandsAll<P>) => StripBrands<R>>;
246
260
  declare function instanceType<T extends Constructor>(constructor: T): Type<InstanceType<T>>;
247
- declare function intersection<T extends any[]>(types: T): Type<UnionToIntersection<StripBrands<T[number]>>>;
261
+ declare function intersection<T extends any[]>(types: T): ShapeType<MergedShape<T>, UnionToIntersection<StripBrands<T[number]>>>;
248
262
  export type LiteralTypes = number | string | boolean | null | undefined;
249
263
  declare function literalType<const T extends LiteralTypes>(literal: T): Type<T>;
250
264
  declare function literalSelection<const T extends LiteralTypes>(literals: T[]): Type<T>;
251
- declare function objectType(): Type<Record<string, any>>;
252
- declare function objectType<const Keys extends string[]>(keys: Keys): Type<ResolveOptionalEntries<KeyedObject<Keys>>>;
253
- declare function objectType<Shape extends {}>(): Type<ResolveOptionalEntries<Shape>>;
254
- declare function objectType<Shape extends {}>(shape: Shape): Type<ResolveOptionalEntries<Shape>>;
255
- declare function strictObjectType<const Keys extends string[]>(keys: Keys): Type<ResolveOptionalEntries<KeyedObject<Keys>>>;
256
- declare function strictObjectType<Shape extends {}>(shape: Shape): Type<ResolveOptionalEntries<Shape>>;
265
+ declare function objectType(): ShapeType<Record<string, any>, Record<string, any>>;
266
+ declare function objectType<const Keys extends string[]>(keys: Keys): ShapeType<Keys, ResolveOptionalEntries<KeyedObject<Keys>>>;
267
+ declare function objectType<Shape extends {}>(): ShapeType<Shape, ResolveOptionalEntries<Shape>>;
268
+ declare function objectType<Shape extends {}>(shape: Shape): ShapeType<Shape, ResolveOptionalEntries<Shape>>;
269
+ declare function strictObjectType<const Keys extends string[]>(keys: Keys): ShapeType<Keys, ResolveOptionalEntries<KeyedObject<Keys>>>;
270
+ declare function strictObjectType<Shape extends {}>(shape: Shape): ShapeType<Shape, ResolveOptionalEntries<Shape>>;
257
271
  declare function promiseType(): Type<Promise<void>>;
258
272
  declare function promiseType<T>(type: T): Type<Promise<StripBrands<T>>>;
259
273
  declare function recordType(): Type<Record<PropertyKey, any>>;
@@ -455,8 +469,10 @@ export interface SignalOptions<T> {
455
469
  declare function triggerSignal(signal: Signal<any>): void;
456
470
  declare function signalRef(): Signal<HTMLElement | null>;
457
471
  declare function signalRef<T extends Constructor<HTMLElement>>(type: T): Signal<InstanceType<T> | null>;
472
+ declare function signalArray<T>(): Signal<T[]>;
458
473
  declare function signalArray<T>(initialValue: T[]): Signal<T[]>;
459
474
  declare function signalArray<T>(initialValue: NoInfer<T>[], options: SignalOptions<T>): Signal<T[]>;
475
+ declare function signalObject<T extends Record<PropertyKey, any>>(): Signal<T>;
460
476
  declare function signalObject<T extends Record<PropertyKey, any>>(initialValue: T): Signal<T>;
461
477
  declare function signalObject<T extends Record<PropertyKey, any>>(initialValue: NoInfer<T>, options: SignalOptions<T>): Signal<T>;
462
478
  export interface MapSignalOptions<K, V> {
@@ -464,8 +480,10 @@ export interface MapSignalOptions<K, V> {
464
480
  keyType?: K;
465
481
  valueType?: V;
466
482
  }
483
+ declare function signalMap<K, V>(): Signal<Map<K, V>>;
467
484
  declare function signalMap<K, V>(initialValue: Map<K, V>): Signal<Map<K, V>>;
468
485
  declare function signalMap<K, V>(initialValue: NoInfer<Map<K, V>>, options: MapSignalOptions<K, V>): Signal<Map<K, V>>;
486
+ declare function signalSet<T>(): Signal<Set<T>>;
469
487
  declare function signalSet<T>(initialValue: Set<T>): Signal<Set<T>>;
470
488
  declare function signalSet<T>(initialValue: Set<NoInfer<T>>, options: SignalOptions<T>): Signal<Set<T>>;
471
489
  export declare function signal<T>(value: T): Signal<T>;
@@ -602,6 +620,7 @@ declare class Fiber {
602
620
  }
603
621
  declare class RootFiber extends Fiber {
604
622
  counter: number;
623
+ renderCount: number;
605
624
  willPatch: Fiber[];
606
625
  patched: Fiber[];
607
626
  mounted: Fiber[];
@@ -814,8 +833,8 @@ export interface AppConfig extends TemplateSetConfig {
814
833
  test?: boolean;
815
834
  }
816
835
  export interface Root<T extends ComponentConstructor> {
817
- node: ComponentNode;
818
836
  promise: Promise<ComponentInstance<T>>;
837
+ readonly prepared: boolean;
819
838
  prepare(): Promise<void>;
820
839
  mount(target: MountTarget, options?: MountOptions): Promise<ComponentInstance<T>>;
821
840
  destroy(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odoo/owl",
3
- "version": "3.0.0-alpha.40",
3
+ "version": "3.0.0-alpha.42",
4
4
  "description": "Odoo Web Library (OWL)",
5
5
  "main": "dist/owl.cjs",
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.40",
47
- "@odoo/owl-core": "3.0.0-alpha.40",
48
- "@odoo/owl-runtime": "3.0.0-alpha.40",
46
+ "@odoo/owl-compiler": "3.0.0-alpha.42",
47
+ "@odoo/owl-core": "3.0.0-alpha.42",
48
+ "@odoo/owl-runtime": "3.0.0-alpha.42",
49
49
  "jsdom": "^25.0.1"
50
50
  }
51
51
  }