@coolon/angular-ui-powerups 16.1.0-alpha.286 → 16.1.0-alpha.290

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.
@@ -7,6 +7,22 @@ export declare class LoadableComponent extends DisposableComponent implements On
7
7
  protected readonly loadTracker: LoadingStateTracker.Tracker | undefined;
8
8
  constructor();
9
9
  get loaded$(): ValueModel<boolean>;
10
+ /**
11
+ * How far through loading the component is, from 0 to 1, for a determinate progress bar: combined over
12
+ * the loadables that {@link loaded$} waits for, with a part they share counted once (see
13
+ * {@link Loadable.combinedProgress}). Loadables registered with `wait: false` or a gate are left out,
14
+ * as they are from loaded$. Reads 1 exactly when loaded$ is true, and so stays 1 if a loadable
15
+ * later reloads, as loaded$ does; 0 until `ngOnInit`.
16
+ */
17
+ get loadProgress$(): ValueModel<number>;
18
+ /**
19
+ * Items loaded so far and expected, [loadedCount, totalItems], over the same loadables as
20
+ * {@link loadProgress$}, for "1,200 of 4,000" (see {@link Loadable.combinedCounts}). totalItems is
21
+ * undefined until every one of them knows its own; [0, undefined] until `ngOnInit`.
22
+ */
23
+ get loadCounts$(): ValueModel<Loadable.Counts>;
24
+ /** The loadables {@link loaded$} waits for, so anything combining this component with others counts them once. */
25
+ get loadableParts(): readonly Loadable[];
10
26
  ngOnInit(): void;
11
27
  private loadDependencies;
12
28
  protected injectLoadable<T extends Loadable>(token: ProviderToken<T>, options?: InjectOptions & LoadableComponent.RegisterOptions): T;
@@ -1,12 +1,24 @@
1
1
  import { PageController } from '@coolon/pectin';
2
2
  import { DisposableComponent } from '../../disposable-component';
3
3
  import * as i0 from "@angular/core";
4
+ /**
5
+ * Page controls for a collection read a window at a time, showing which window is on screen and how
6
+ * big the whole collection is.
7
+ *
8
+ * It binds to any {@link PageController}, so it works over a client-side slice of an already-loaded
9
+ * list and over a server-paged data source alike — the difference between them is not the pager's
10
+ * business.
11
+ */
4
12
  export declare class PaginatorComponent extends DisposableComponent {
5
13
  accessor pageController: PageController;
6
14
  constructor();
7
15
  get totalItems(): number;
8
16
  get totalPages(): number;
9
17
  get pageNumber(): number;
18
+ /** The position of the first row on screen, counting from one. Zero when there are no rows at all. */
19
+ get firstItem(): number;
20
+ /** The position of the last row on screen, which on a short final page is the end of the collection. */
21
+ get lastItem(): number;
10
22
  get previousCommand(): import("@coolon/pectin").Command<void>;
11
23
  get nextCommand(): import("@coolon/pectin").Command<void>;
12
24
  static ɵfac: i0.ɵɵFactoryDeclaration<PaginatorComponent, never>;
@@ -1,27 +1,56 @@
1
- import { TemplateRef } from "@angular/core";
2
- import { MutableValueModel } from "@coolon/pectin";
1
+ import { TemplateRef, TrackByFunction } from "@angular/core";
2
+ import { BooleanValueModelChain, ListModelChain, MutableValueModel } from "@coolon/pectin";
3
+ import type { CommandFace } from '../../../components/commands/command-face';
4
+ import type { PlaceDefinition } from '../../place-definition';
3
5
  import { PlaceRouter } from '../../place-router';
4
6
  import { AbstractPlaceNavigationComponent } from '../abstract-place-navigation.component';
5
7
  import * as i0 from "@angular/core";
6
8
  /**
9
+ * A place with children is listed as a group header with its children beneath it, when:
10
+ * - it has `redirectToFirstChild` (it has no page of its own, so its header never navigates while
11
+ * the rail is open);
12
+ * - it hasn't opted out with `navDepth: 1` (see {@link Place.Options.navDepth});
13
+ * - at least two of its children are authorised: one child isn't a choice, so a parent with one
14
+ * authorised child is a single entry that navigates to it.
15
+ * Anything else is a leaf that navigates to its place. A `redirectToFirstChild` parent with no
16
+ * authorised child is dropped, as it has nowhere to land. Only two levels are shown; deeper places
17
+ * stay as tabs in their pages.
18
+ *
19
+ * The rail collapses to an icon strip from the Menu row, and expands over the content when the
20
+ * pointer rests on it. The pinned state is kept in localStorage under {@link persistKey}.
21
+ *
22
+ * {@link currentPath$} names where the user is the way the rail does, for a breadcrumb.
23
+ *
7
24
  * @example
8
25
  * // Usage
9
- * <aup-vertical-place-navigation [places]="placeConstructorArray"
10
- * [placeOutlet]="placeOutletComponent">
11
- * </aup-vertical-place-navigation>
26
+ * <aup-side-place-navigation [places]="placeConstructorArray"
27
+ * [placeOutlet]="placeOutletComponent">
28
+ * </aup-side-place-navigation>
12
29
  * <aup-place-outlet #placeOutletComponent></aup-place-outlet>
13
30
  *
14
- * // CSS overrides:
31
+ * // Layout: the host is the rail's slot, so give it a height (it stretches in a flex row or a
32
+ * // grid) and put the content beside it. The content is offset by the pinned width; the
33
+ * // hover-expanded rail overlays it.
34
+ *
35
+ * // CSS overrides (set on the element or any ancestor; defaults shown):
15
36
  * aup-side-place-navigation {
16
- * --nav-width: 56px
17
- * --nav-expanded-width: 235px
18
- * --nav-item-height: var(--nav-width)
37
+ * --nav-width: 56px; // the collapsed rail
38
+ * --nav-expanded-width: 232px;
19
39
  * --nav-background-color: #555;
20
- * --nav-color: rgba(255, 255, 255, 0.9);
40
+ * --nav-color: #fff; // the Menu row, and the current place's labels
41
+ * --nav-item-color: #eee; // top-level labels
42
+ * --nav-child-color: #d0d0d0; // child labels
43
+ * --nav-current-background: #3a3a3a; // the current place's row
44
+ * --nav-hover-background: #4c4c4c;
45
+ * --nav-chevron-color: #bdbdbd;
46
+ * --nav-current-chevron-color: #757575; // the current group's chevron: it can't be collapsed
47
+ * --nav-focus-color: rgba(255, 255, 255, 0.6);
48
+ * --nav-overlay-shadow: 6px 0 18px rgba(0, 0, 0, 0.28); // the hover-expanded rail
49
+ * --nav-z-index: 100; // lifts the hover-expanded rail over the content
21
50
  * }
22
51
  *
23
52
  * // Content Templates:
24
- * #navEndTemplate
53
+ * #navEndTemplate, rendered below the items
25
54
  * <ng-template #navEndTemplate>
26
55
  * <a mat-list-item (click)="logout()" matTooltip="Logout">
27
56
  * <mat-icon>exit_to_app</mat-icon>
@@ -47,12 +76,99 @@ import * as i0 from "@angular/core";
47
76
  */
48
77
  export declare class SidePlaceNavigationComponent extends AbstractPlaceNavigationComponent {
49
78
  accessor expanded$: MutableValueModel<boolean>;
79
+ /**
80
+ * Whether the rail is pinned expanded (true) or collapsed to icons. The binding is the initial
81
+ * state: once the user has pinned the rail from the Menu row, the state they chose is restored
82
+ * from {@link persistKey} instead.
83
+ */
50
84
  accessor expanded: boolean;
85
+ /** Show the Menu row, so the user can pin the rail expanded or collapsed. */
86
+ collapsible: boolean;
87
+ /** How long, in ms, the pointer must rest on the collapsed rail before it expands. */
88
+ hoverExpandDelay: number;
89
+ /**
90
+ * The localStorage key the pinned state is kept under; `null` turns persistence off. The default
91
+ * is shared by everyone using the browser, so include the user in the key for a per-user state.
92
+ */
93
+ persistKey: string | null;
51
94
  navEndTemplate: TemplateRef<any>;
95
+ /** The pointer has rested on the collapsed rail, so it is expanded over the content. */
96
+ readonly hovering$: MutableValueModel<boolean>;
97
+ /** Labels and children are shown: pinned expanded, or hover-expanded. */
98
+ readonly open$: BooleanValueModelChain;
99
+ /** Hover-expanded over the content, as opposed to pinned expanded beside it. */
100
+ readonly overlay$: BooleanValueModelChain;
101
+ readonly navItems$: ListModelChain<SidePlaceNavigationComponent.Item>;
102
+ /**
103
+ * Where the user is, as the rail names it: the group and the current child in it, or else the one
104
+ * current entry. Grouped by the rail's rules and settled when it is, after a navigation, so a
105
+ * breadcrumb bound to it always agrees with the rail. Empty while no listed place is current.
106
+ */
107
+ readonly currentPath$: ListModelChain<SidePlaceNavigationComponent.PathSegment>;
108
+ /** Groups the user has opened. The current place's group joins on arrival and stays. */
109
+ private readonly openGroups$;
110
+ readonly childListAnimation: {
111
+ value: string;
112
+ params: {
113
+ duration: string;
114
+ };
115
+ };
116
+ readonly trackByNavItem: TrackByFunction<SidePlaceNavigationComponent.Item>;
117
+ readonly trackByNavChild: TrackByFunction<SidePlaceNavigationComponent.Child>;
118
+ /**
119
+ * Animations are suppressed while a navigation is in flight, and for a frame after it settles, so
120
+ * the current group doesn't visibly slide open on every page load. What should animate is a group
121
+ * the user opens or closes, and the children leaving as the rail collapses. Same arrangement as
122
+ * TabbedPlaceNavigationComponent.
123
+ */
124
+ protected animationsDisabled: boolean;
125
+ private readonly idPrefix;
126
+ private hoverTimer;
127
+ private resetHandle;
52
128
  constructor(router: PlaceRouter);
129
+ /** A group header toggles while the rail is open; anything else navigates. */
130
+ activate(item: SidePlaceNavigationComponent.Item): void;
131
+ navigateTo(place: PlaceDefinition): void;
132
+ toggleMenu(): void;
53
133
  expandMenu(): void;
54
134
  collapseMenu(): void;
55
- toggleMenu(): void;
135
+ onRailEnter(event?: PointerEvent): void;
136
+ onRailLeave(): void;
137
+ private toggleGroup;
138
+ private openGroup;
139
+ private pin;
140
+ private clearHoverTimer;
141
+ private restorePinnedState;
142
+ private writePinnedState;
143
+ private readStorage;
56
144
  static ɵfac: i0.ɵɵFactoryDeclaration<SidePlaceNavigationComponent, never>;
57
- static ɵcmp: i0.ɵɵComponentDeclaration<SidePlaceNavigationComponent, "aup-side-place-navigation", never, { "expanded$": { "alias": "expanded$"; "required": false; }; "expanded": { "alias": "expanded"; "required": false; }; }, {}, ["navEndTemplate"], never, false, never>;
145
+ static ɵcmp: i0.ɵɵComponentDeclaration<SidePlaceNavigationComponent, "aup-side-place-navigation", never, { "expanded$": { "alias": "expanded$"; "required": false; }; "expanded": { "alias": "expanded"; "required": false; }; "collapsible": { "alias": "collapsible"; "required": false; }; "hoverExpandDelay": { "alias": "hoverExpandDelay"; "required": false; }; "persistKey": { "alias": "persistKey"; "required": false; }; }, {}, ["navEndTemplate"], never, false, never>;
146
+ }
147
+ export declare namespace SidePlaceNavigationComponent {
148
+ /** A top-level entry in the rail: a leaf, or a group header with its children. */
149
+ interface Item {
150
+ readonly place: PlaceDefinition;
151
+ readonly face: CommandFace;
152
+ /** Lists its children, and never navigates while the rail is open. */
153
+ readonly group: boolean;
154
+ /** Is the current place, or contains it. */
155
+ readonly current: boolean;
156
+ /** An open group on an open rail. */
157
+ readonly showChildren: boolean;
158
+ /** The current place's row, while nothing below it shows the current place instead. */
159
+ readonly highlighted: boolean;
160
+ readonly children: ReadonlyArray<Child>;
161
+ /** For the header's `aria-controls`. */
162
+ readonly childListId: string;
163
+ }
164
+ interface Child {
165
+ readonly place: PlaceDefinition;
166
+ readonly face: CommandFace;
167
+ readonly current: boolean;
168
+ }
169
+ /** One step of {@link SidePlaceNavigationComponent.currentPath$}. */
170
+ interface PathSegment {
171
+ readonly place: PlaceDefinition;
172
+ readonly face: CommandFace;
173
+ }
58
174
  }
@@ -28,21 +28,27 @@ export type TabbedPlaceNavigationAppearance = 'folder' | 'segmented' | 'tonal' |
28
28
  * --aup-tab-nav-selected-color: <accent>; // selected label
29
29
  * --aup-tab-nav-hover-color: #212121; // unselected label on hover
30
30
  * --aup-tab-nav-hover-background: rgba(63, 81, 181, 0.07);
31
- * --aup-tab-nav-bar-background: #f0f2f5; // folder: the strip behind the tabs
31
+ * --aup-tab-nav-bar-background: #fff; // folder: the strip behind the tabs
32
32
  * --aup-tab-nav-inset: 8px; // folder: space before the first tab
33
33
  * --aup-tab-nav-page-background: var(--aup-default-background, #fff); // folder: the page colour;
34
34
  * // the selected tab takes it so the two join up
35
- * --aup-tab-nav-edge-color: #aeb4be; // folder: selected tab outline and join line
35
+ * --aup-tab-nav-edge-color: <--pinstripe-border-color, else rgba(0,0,0,.2)>; // folder: selected
36
+ * // tab outline and join line
36
37
  * --aup-tab-nav-top-line-width: 2px; // folder: accent line on the selected tab
37
38
  * --aup-tab-nav-label-padding-bottom: 0 | 8px; // folder: room under the label (8px when the
38
39
  * // tab has an icon, so it balances the top line)
39
- * --aup-tab-nav-segment-track-background: <bar-background>; // segmented: the track
40
+ * --aup-tab-nav-segment-track-background: <bar-background if set, else #f0f2f5>; // segmented: track
40
41
  * --aup-tab-nav-segment-border-color: #d9dce2; // segmented: the track outline
41
42
  * --aup-tab-nav-segment-selected-background: #fff; // segmented: the sliding highlight
42
43
  * --aup-tab-nav-segmented-padding: 12px 12px 4px; // segmented: space around the control
43
44
  * --aup-tab-nav-tonal-selected-background: <theme primary 50>; // tonal: the sliding tint
44
45
  * --aup-tab-nav-underline-color: #d9dce2; // tonal: the full-width line under the bar
45
46
  * --aup-tab-nav-tonal-padding: 8px 12px; // tonal: space around the options
47
+ * --aup-tab-nav-tonal-tab-height: 30px; // tonal: each option's height
48
+ * --aup-tab-nav-tonal-tab-padding: 0 12px; // tonal: space inside each option
49
+ * --aup-tab-nav-tonal-gap: 2px; // tonal: space between the options
50
+ * --aup-tab-nav-tonal-font-size: 13px;
51
+ * --aup-tab-nav-tonal-selected-weight: 700; // tonal: the selected option's label
46
52
  * }
47
53
  */
48
54
  export declare class TabbedPlaceNavigationComponent extends AbstractPlaceNavigationComponent {
@@ -13,9 +13,10 @@ export declare class PlaceDefinition {
13
13
  readonly children: PlaceDefinition[];
14
14
  readonly redirectToFirstChild: boolean;
15
15
  readonly rememberLastChild: boolean;
16
+ readonly navDepth: PlaceDefinition.NavDepth;
16
17
  private _parent;
17
18
  readonly name: string;
18
- constructor(component: Constructable<PlaceComponent>, path: string, authenticate: boolean, role: any, data: Record<string, any>, routeParameters: ParameterDefinition<any>[], children: PlaceDefinition[], redirectToFirstChild: boolean, rememberLastChild: boolean);
19
+ constructor(component: Constructable<PlaceComponent>, path: string, authenticate: boolean, role: any, data: Record<string, any>, routeParameters: ParameterDefinition<any>[], children: PlaceDefinition[], redirectToFirstChild: boolean, rememberLastChild: boolean, navDepth?: PlaceDefinition.NavDepth);
19
20
  ancestors(): PlaceDefinition[];
20
21
  ancestorsAndSelf(): PlaceDefinition[];
21
22
  get placeId(): string;
@@ -44,6 +45,8 @@ export declare class PlaceDefinition {
44
45
  hasAncestor(placeComponent: Constructable<PlaceComponent>): boolean;
45
46
  }
46
47
  export declare namespace PlaceDefinition {
48
+ /** See {@link Place.Options.navDepth}. */
49
+ type NavDepth = 1 | 2;
47
50
  interface ParameterOptions {
48
51
  includeRouteId?: boolean;
49
52
  includeRouteParameters?: boolean;
@@ -1,5 +1,6 @@
1
1
  import { Constructable } from '@coolon/pectin';
2
2
  import { PlaceComponent } from './place-component';
3
+ import { PlaceDefinition } from './place-definition';
3
4
  export declare function Place(options: Place.Options): (target: Constructable<any>) => void;
4
5
  export declare namespace Place {
5
6
  interface Options {
@@ -27,5 +28,15 @@ export declare namespace Place {
27
28
  * Only meaningful alongside `redirectToFirstChild: true`. Defaults to `true`.
28
29
  */
29
30
  rememberLastChild?: boolean;
31
+ /**
32
+ * How many levels of the place tree `aup-side-place-navigation` shows from this place. `2` (the
33
+ * default) lists the place's children beneath it as a group; `1` keeps them out of the side nav,
34
+ * so the place is a single entry that navigates via {@link redirectToFirstChild} and its children
35
+ * stay as tabs in the page.
36
+ *
37
+ * Only meaningful alongside `redirectToFirstChild: true`: a place without it has a page of its
38
+ * own, so it is always a single entry.
39
+ */
40
+ navDepth?: PlaceDefinition.NavDepth;
30
41
  }
31
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coolon/angular-ui-powerups",
3
- "version": "16.1.0-alpha.286",
3
+ "version": "16.1.0-alpha.290",
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.139",
15
+ "@coolon/pectin": "^5.0.0-alpha.141",
16
16
  "fast-typescript-memoize": "^1.1.1",
17
17
  "lodash-es": "^4.17.21",
18
18
  "marked": "4.0.10",