@coolon/angular-ui-powerups 16.1.0-alpha.317 → 16.1.0-alpha.319

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.
@@ -45,6 +45,11 @@ export declare class ActivityActionsComponent extends DisposableComponent {
45
45
  */
46
46
  set style(style: ActivityActionsComponent.Style);
47
47
  layout: ActivityActionsComponent.Layout;
48
+ /**
49
+ * Where the buttons sit. 'start' and 'end' put both at that end, the content filling the rest; 'stretch' puts cancel
50
+ * at the start and confirm at the end, the content between them. 'fill' shares the bar's width between the buttons, so
51
+ * a lone button spans it, as the one action at the foot of a phone's sheet does; the content sits above them.
52
+ */
48
53
  align: ActivityActionsComponent.Align;
49
54
  alignContent: ActivityActionsComponent.AlignContent;
50
55
  protected readonly activityContext: ActivityContext;
@@ -66,6 +71,7 @@ export declare namespace ActivityActionsComponent {
66
71
  START: "start";
67
72
  STRETCH: "stretch";
68
73
  END: "end";
74
+ FILL: "fill";
69
75
  };
70
76
  type Align = Enum<typeof Align>;
71
77
  const AlignContent: {
@@ -11,7 +11,7 @@ import { ActivityOutletComponent } from "./activity-outlet/activity-outlet.compo
11
11
  import * as i0 from "@angular/core";
12
12
  export declare class ActivityContainerComponent<D, R, E> extends AbstractInteractionContext {
13
13
  readonly placeRouter: PlaceRouter;
14
- private readonly elementRef;
14
+ readonly elementRef: ElementRef<HTMLElement>;
15
15
  dynamicHeight: boolean;
16
16
  tabs: MatTabGroup;
17
17
  activityOutlets: QueryList<ActivityOutletComponent<unknown, unknown, unknown>>;
@@ -16,6 +16,8 @@ export interface ActivityHost {
16
16
  afterClosed(): Observable<unknown>;
17
17
  backdropClick(): Observable<MouseEvent>;
18
18
  keydownEvents(): Observable<KeyboardEvent>;
19
+ /** A gesture asking the surface to close, as Escape does: a sheet's swipe down. A dialog has none. */
20
+ swipedClosed?(): Observable<unknown>;
19
21
  /** Fits the surface to its content again, where the surface needs telling. */
20
22
  updateSize(): void;
21
23
  }
@@ -4,7 +4,8 @@ import type { InteractionService } from '../interaction.service';
4
4
  /**
5
5
  * Runs each activity in a sheet that rises from the foot of the screen, as a phone shows a choice. The
6
6
  * sheet is as tall as its activity, up to most of the screen. An activity started from inside one
7
- * slides in over it in the same sheet, and its own Back returns to the one before.
7
+ * slides in over it in the same sheet, and its own Back returns to the one before. A swipe down from
8
+ * its handle or title closes it as Escape does (see `SheetSwipe`).
8
9
  */
9
10
  export declare class BottomSheetInteractionContext extends HostedInteractionContext {
10
11
  private readonly bottomSheet;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Lets a sheet be swiped down to close, as a phone's sheets are.
3
+ *
4
+ * A drag starts only in the sheet's top strip, its handle and its activity's title, so it never takes over a scroll in
5
+ * the activity's body. The sheet follows the pointer down. Released a third of its height down, or flicked down, it
6
+ * asks to close, as Escape does; otherwise it springs back. A sheet whose activity does not let it close
7
+ * springs back too.
8
+ *
9
+ * The drag moves the sheet's overlay pane rather than the sheet itself. Material animates the sheet's own position as
10
+ * it closes, so a sheet that closes slides on down from where the drag left it.
11
+ */
12
+ export declare class SheetSwipe {
13
+ private readonly sheet;
14
+ private readonly pane;
15
+ private readonly requestClose;
16
+ private readonly closing;
17
+ private tracking?;
18
+ private offset?;
19
+ private readonly listeners;
20
+ /**
21
+ * @param sheet the sheet's container, which holds the handle and the activity.
22
+ * @param pane the overlay pane holding the sheet, which the drag moves.
23
+ * @param requestClose asks the sheet to close, as Escape does. The sheet closes only if its activity allows.
24
+ * @param closing whether the sheet has begun to close.
25
+ */
26
+ constructor(sheet: HTMLElement, pane: HTMLElement, requestClose: (event: PointerEvent) => void, closing: () => boolean);
27
+ dispose(): void;
28
+ private pointerDown;
29
+ private pointerMove;
30
+ private pointerUp;
31
+ private springBack;
32
+ /** The handle sits in the sheet's top padding, above the activity; the title is the activity's own top strip. */
33
+ private inTopStrip;
34
+ /** A drag that started on a button in the title must not also press it. The click, if any, follows pointerup at once. */
35
+ private swallowNextClick;
36
+ }
37
+ export declare namespace SheetSwipe {
38
+ /** How far, in px, a pointer moves before it drags the sheet rather than taps what is under it. */
39
+ const START_DISTANCE = 6;
40
+ /** The share of its height a sheet is dragged down before letting go closes it. */
41
+ const CLOSE_FRACTION: number;
42
+ /** The downward speed, in px per millisecond, at which letting go closes a sheet however far it was dragged. */
43
+ const FLICK_SPEED = 0.5;
44
+ /** How long, in milliseconds, before letting go the pointer's speed is measured for a flick. */
45
+ const FLICK_WINDOW = 100;
46
+ /** The height, in px, of the strip at the sheet's top that holds its handle. */
47
+ const HANDLE_STRIP_HEIGHT = 24;
48
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coolon/angular-ui-powerups",
3
- "version": "16.1.0-alpha.317",
3
+ "version": "16.1.0-alpha.319",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "^16.2.9",
6
6
  "@angular/common": "^16.2.9",