@odoo/owl 3.0.0-alpha.36 → 3.0.0-alpha.38

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.
@@ -169,6 +169,7 @@ export type Type<T> = T & {
169
169
  * a function type must use the factory form.
170
170
  */
171
171
  optional(value: T extends Function ? () => T : T | (() => T)): WithDefault<T>;
172
+ type: T;
172
173
  };
173
174
  export type IsAny<T> = 0 extends 1 & T ? true : false;
174
175
  export type HasDefault<T> = IsAny<T> extends true ? false : T extends {
@@ -239,9 +240,9 @@ declare function arrayType<T>(elementType: T): Type<StripBrands<T>[]>;
239
240
  declare function constructorType<T extends Constructor>(constructor: T): Type<T>;
240
241
  declare function customValidator<T>(type: T, validator: (value: StripBrands<T>) => boolean, errorMessage?: string): Type<StripBrands<T>>;
241
242
  declare function functionType(): Type<(...parameters: any[]) => any>;
242
- declare function functionType<const P extends any[]>(parameters: P): Type<(...parameters: StripBrandsAll<P>) => void>;
243
- declare function functionType<const P extends any[], R>(): Type<(...parameters: P) => R>;
244
- declare function functionType<const P extends any[], R>(parameters: P, result: R): Type<(...parameters: StripBrandsAll<P>) => StripBrands<R>>;
243
+ declare function functionType<const P extends unknown[]>(parameters: P): Type<(...parameters: StripBrandsAll<P>) => void>;
244
+ declare function functionType<const P extends unknown[], R>(): Type<(...parameters: P) => R>;
245
+ declare function functionType<const P extends unknown[], R>(parameters: P, result: R): Type<(...parameters: StripBrandsAll<P>) => StripBrands<R>>;
245
246
  declare function instanceType<T extends Constructor>(constructor: T): Type<InstanceType<T>>;
246
247
  declare function intersection<T extends any[]>(types: T): Type<UnionToIntersection<StripBrands<T[number]>>>;
247
248
  export type LiteralTypes = number | string | boolean | null | undefined;
@@ -257,8 +258,8 @@ declare function promiseType(): Type<Promise<void>>;
257
258
  declare function promiseType<T>(type: T): Type<Promise<StripBrands<T>>>;
258
259
  declare function recordType(): Type<Record<PropertyKey, any>>;
259
260
  declare function recordType<V>(valueType: V): Type<Record<PropertyKey, StripBrands<V>>>;
260
- declare function tuple<const T extends any[]>(types: T): Type<StripBrandsAll<T>>;
261
- declare function union<T extends any[]>(types: T): Type<StripBrands<T[number]>>;
261
+ declare function tuple<const T extends unknown[]>(types: T): Type<StripBrandsAll<T>>;
262
+ declare function union<T extends unknown[]>(types: T): Type<StripBrands<T[number]>>;
262
263
  declare function reactiveValueType(): Type<ReactiveValue<any>>;
263
264
  declare function reactiveValueType<T>(): Type<ReactiveValue<T>>;
264
265
  declare function reactiveValueType<T>(type: T): Type<ReactiveValue<StripBrands<T>>>;
@@ -638,6 +639,11 @@ declare class ComponentNode extends Scope implements VNode<ComponentNode> {
638
639
  willPatch: LifecycleHook[];
639
640
  patched: LifecycleHook[];
640
641
  signalComputation: ComputationAtom;
642
+ trackedRefs: Map<{
643
+ set(v: null): void;
644
+ }, {
645
+ value: HTMLElement | null;
646
+ }> | null;
641
647
  constructor(C: ComponentConstructor, props: Record<string, any>, app: App, parent: ComponentNode | null, parentKey: string | null);
642
648
  decorate(f: Function, hookName: string): Function;
643
649
  initiateRender(fiber: Fiber | MountFiber): Promise<void>;
@@ -646,6 +652,19 @@ declare class ComponentNode extends Scope implements VNode<ComponentNode> {
646
652
  _cancel(): void;
647
653
  destroy(): void;
648
654
  _destroy(): void;
655
+ /**
656
+ * Unset any tracked t-ref whose element is no longer in the document, and stop
657
+ * tracking it (createRef re-registers it on the next render if the element
658
+ * comes back). `isConnected` is the discriminator: a ref the block's own
659
+ * remove() failed to clear (bulk removal) points at a detached element and is
660
+ * cleared, while a ref a surviving sibling just took over (t-if/t-else with a
661
+ * shared signal) points at a still-connected element and is left alone.
662
+ *
663
+ * Called after this component's dom settles: at the tail of `_patch` (before
664
+ * user `onPatched`), so an element removed in place is caught, and — for the
665
+ * nodes collected during `_destroy` — after a removed subtree is detached.
666
+ */
667
+ sweepRefs(): void;
649
668
  /**
650
669
  * Finds a child that has dom that is not yet updated, and update it. This
651
670
  * method is meant to be used only in the context of repatching the dom after
@@ -656,6 +675,16 @@ declare class ComponentNode extends Scope implements VNode<ComponentNode> {
656
675
  mount(parent: HTMLElement, anchor: ChildNode): void;
657
676
  moveBeforeDOMNode(node: Node | null, parent?: HTMLElement): void;
658
677
  moveBeforeVNode(other: ComponentNode | null, afterNode: Node | null): void;
678
+ /**
679
+ * Register a t-ref signal bound to an element this component hosts, so its
680
+ * lifecycle can clear it (see sweepRefs / _destroy). Idempotent — re-tracking
681
+ * the same signal on each render just refreshes its atom.
682
+ */
683
+ trackRef(ref: {
684
+ set(v: null): void;
685
+ }, atom: {
686
+ value: HTMLElement | null;
687
+ }): void;
659
688
  patch(): void;
660
689
  _patch(): void;
661
690
  beforeRemove(): void;
@@ -810,7 +839,7 @@ export declare class Portal extends Component {
810
839
  slots: {
811
840
  default: any;
812
841
  };
813
- target: any;
842
+ target: string | HTMLElement | ReactiveValue<HTMLElement, HTMLElement>;
814
843
  }>;
815
844
  setup(): void;
816
845
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odoo/owl",
3
- "version": "3.0.0-alpha.36",
3
+ "version": "3.0.0-alpha.38",
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.36",
47
- "@odoo/owl-core": "3.0.0-alpha.36",
48
- "@odoo/owl-runtime": "3.0.0-alpha.36",
46
+ "@odoo/owl-compiler": "3.0.0-alpha.38",
47
+ "@odoo/owl-core": "3.0.0-alpha.38",
48
+ "@odoo/owl-runtime": "3.0.0-alpha.38",
49
49
  "jsdom": "^25.0.1"
50
50
  }
51
51
  }