@coolon/angular-ui-powerups 16.1.0-alpha.244 → 16.1.0-alpha.245

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.
@@ -1,20 +1,49 @@
1
1
  import { InjectOptions, OnInit, ProviderToken } from '@angular/core';
2
- import { Loadable, LoadingStateTracker } from '@coolon/pectin';
2
+ import { HasValue, Loadable, LoadingStateTracker, ValueModel } from '@coolon/pectin';
3
3
  import { DisposableComponent } from './disposable-component';
4
4
  import * as i0 from "@angular/core";
5
5
  export declare class LoadableComponent extends DisposableComponent implements OnInit {
6
6
  #private;
7
7
  protected readonly loadTracker: LoadingStateTracker.Tracker | undefined;
8
8
  constructor();
9
- get loaded$(): import("@coolon/pectin").ValueModel<boolean>;
9
+ get loaded$(): ValueModel<boolean>;
10
10
  ngOnInit(): void;
11
11
  private loadDependencies;
12
- protected injectLoadable<T extends Loadable>(token: ProviderToken<T>, options?: InjectOptions & {
13
- wait: boolean;
14
- }): T;
15
- registerLoadable<T extends Loadable>(loadable: T, options?: {
16
- wait: boolean;
17
- }): T;
12
+ protected injectLoadable<T extends Loadable>(token: ProviderToken<T>, options?: InjectOptions & LoadableComponent.RegisterOptions): T;
13
+ registerLoadable<T extends Loadable>(loadable: T, options?: LoadableComponent.RegisterOptions): T;
18
14
  static ɵfac: i0.ɵɵFactoryDeclaration<LoadableComponent, never>;
19
15
  static ɵdir: i0.ɵɵDirectiveDeclaration<LoadableComponent, never, never, {}, {}, never, never, false, never>;
20
16
  }
17
+ export declare namespace LoadableComponent {
18
+ interface RegisterOptions {
19
+ /**
20
+ * Block the component's `loaded$` until this loadable finishes loading. Defaults to `true`.
21
+ * Must be absent when a gate ({@link asLongAs}/{@link unless}) is supplied — a gated load is
22
+ * conditional and therefore always non-blocking.
23
+ */
24
+ wait?: boolean;
25
+ /**
26
+ * Load only while/once this condition holds. A reactive model (`ValueModel<boolean>`, e.g.
27
+ * `userPermissions.can$(role)`) is watched: the load fires when it becomes true, and immediately
28
+ * if it is already true. A bare `() => boolean` predicate is evaluated once, at load time.
29
+ * Mutually exclusive with {@link unless}.
30
+ */
31
+ asLongAs?: HasValue<boolean> | (() => boolean);
32
+ /** The inverse of {@link asLongAs}: load unless this condition holds. */
33
+ unless?: HasValue<boolean> | (() => boolean);
34
+ }
35
+ type Gate = {
36
+ kind: 'model';
37
+ model$: ValueModel<boolean>;
38
+ negate: boolean;
39
+ } | {
40
+ kind: 'predicate';
41
+ predicate: () => boolean;
42
+ };
43
+ /**
44
+ * Normalises `asLongAs`/`unless` into a {@link Gate} (or `undefined` when neither is given).
45
+ * Model conditions stay observable so they can be watched reactively; `unless` is represented by
46
+ * `negate: true` (for models) or a negated predicate. Throws if both options are supplied.
47
+ */
48
+ function normalizeGate(options: RegisterOptions | undefined): Gate | undefined;
49
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coolon/angular-ui-powerups",
3
- "version": "16.1.0-alpha.244",
3
+ "version": "16.1.0-alpha.245",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "^16.2.9",
6
6
  "@angular/common": "^16.2.9",
@@ -12,7 +12,7 @@
12
12
  "@angular/platform-browser-dynamic": "^16.2.9",
13
13
  "@angular/material-moment-adapter": "^16.2.10",
14
14
  "@angular/router": "^16.2.9",
15
- "@coolon/pectin": "^5.0.0-alpha.125",
15
+ "@coolon/pectin": "^5.0.0-alpha.127",
16
16
  "fast-typescript-memoize": "^1.1.1",
17
17
  "lodash-es": "^4.17.21",
18
18
  "marked": "4.0.10",