@aquera/nile-elements 2.0.10 → 2.0.11
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.
- package/README.md +3 -0
- package/demo/app-shell.html +852 -0
- package/demo/nxtgen-classes.css +2 -2
- package/demo/nxtgen-properties.css +2 -2
- package/demo/nxtgen-utilities.css +2 -2
- package/demo/nxtgen.css +2 -2
- package/demo/utilities.css +2 -2
- package/demo/variables.css +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +579 -296
- package/dist/internal/app-shell-utility-control-styles.cjs.js +2 -0
- package/dist/internal/app-shell-utility-control-styles.cjs.js.map +1 -0
- package/dist/internal/app-shell-utility-control-styles.esm.js +16 -0
- package/dist/nile-app-shell/index.cjs.js +1 -1
- package/dist/nile-app-shell/index.esm.js +1 -1
- package/dist/nile-app-shell/nile-app-shell.cjs.js +1 -1
- package/dist/nile-app-shell/nile-app-shell.cjs.js.map +1 -1
- package/dist/nile-app-shell/nile-app-shell.css.cjs.js +1 -1
- package/dist/nile-app-shell/nile-app-shell.css.cjs.js.map +1 -1
- package/dist/nile-app-shell/nile-app-shell.css.esm.js +270 -92
- package/dist/nile-app-shell/nile-app-shell.esm.js +61 -10
- package/dist/nile-app-shell/shell-controller.cjs.js.map +1 -1
- package/dist/nile-app-shell-main/nile-app-shell-main.cjs.js.map +1 -1
- package/dist/nile-app-shell-nav-toggle/index.cjs.js +1 -1
- package/dist/nile-app-shell-nav-toggle/index.esm.js +1 -1
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.cjs.js +1 -1
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.cjs.js.map +1 -1
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.cjs.js +1 -1
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.cjs.js.map +1 -1
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.esm.js +7 -3
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.esm.js +3 -3
- package/dist/nile-app-shell-panel/index.cjs.js +1 -1
- package/dist/nile-app-shell-panel/index.esm.js +1 -1
- package/dist/nile-app-shell-panel/nile-app-shell-panel.cjs.js +1 -1
- package/dist/nile-app-shell-panel/nile-app-shell-panel.cjs.js.map +1 -1
- package/dist/nile-app-shell-panel/nile-app-shell-panel.css.cjs.js +1 -1
- package/dist/nile-app-shell-panel/nile-app-shell-panel.css.cjs.js.map +1 -1
- package/dist/nile-app-shell-panel/nile-app-shell-panel.css.esm.js +29 -7
- package/dist/nile-app-shell-panel/nile-app-shell-panel.esm.js +18 -5
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.cjs.js.map +1 -1
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.css.cjs.js.map +1 -1
- package/dist/src/internal/app-shell-utility-control-styles.d.ts +12 -0
- package/dist/src/internal/app-shell-utility-control-styles.js +29 -0
- package/dist/src/internal/app-shell-utility-control-styles.js.map +1 -0
- package/dist/src/nile-app-shell/nile-app-shell-regions.test.d.ts +3 -0
- package/dist/src/nile-app-shell/nile-app-shell-regions.test.js +206 -0
- package/dist/src/nile-app-shell/nile-app-shell-regions.test.js.map +1 -1
- package/dist/src/nile-app-shell/nile-app-shell.css.d.ts +1 -9
- package/dist/src/nile-app-shell/nile-app-shell.css.js +270 -99
- package/dist/src/nile-app-shell/nile-app-shell.css.js.map +1 -1
- package/dist/src/nile-app-shell/nile-app-shell.d.ts +90 -122
- package/dist/src/nile-app-shell/nile-app-shell.js +224 -143
- package/dist/src/nile-app-shell/nile-app-shell.js.map +1 -1
- package/dist/src/nile-app-shell/nile-app-shell.test.d.ts +3 -0
- package/dist/src/nile-app-shell/nile-app-shell.test.js +898 -29
- package/dist/src/nile-app-shell/nile-app-shell.test.js.map +1 -1
- package/dist/src/nile-app-shell/shell-controller.d.ts +1 -8
- package/dist/src/nile-app-shell/shell-controller.js +2 -14
- package/dist/src/nile-app-shell/shell-controller.js.map +1 -1
- package/dist/src/nile-app-shell-main/nile-app-shell-main.d.ts +2 -6
- package/dist/src/nile-app-shell-main/nile-app-shell-main.js +2 -6
- package/dist/src/nile-app-shell-main/nile-app-shell-main.js.map +1 -1
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.d.ts +1 -4
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.js +7 -5
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.js.map +1 -1
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.d.ts +4 -8
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.js +5 -6
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.js.map +1 -1
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.js +28 -5
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.js.map +1 -1
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.d.ts +18 -13
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.js +45 -16
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.js.map +1 -1
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.d.ts +1 -4
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.js +1 -4
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.js.map +1 -1
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.d.ts +4 -12
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.js +4 -12
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/version.cjs.js +1 -1
- package/dist/version.cjs.js.map +1 -1
- package/dist/version.esm.js +1 -1
- package/package.json +1 -1
- package/plop-templates/lit/lit.test.ts.hbs +22 -0
- package/plop-templates/lit/lit.ts.hbs +10 -5
- package/plopfile.js +12 -0
- package/src/internal/app-shell-utility-control-styles.ts +30 -0
- package/src/nile-app-shell/nile-app-shell-regions.test.ts +248 -0
- package/src/nile-app-shell/nile-app-shell.css.ts +270 -99
- package/src/nile-app-shell/nile-app-shell.test.ts +1120 -29
- package/src/nile-app-shell/nile-app-shell.ts +241 -148
- package/src/nile-app-shell/shell-controller.ts +2 -14
- package/src/nile-app-shell-main/nile-app-shell-main.ts +2 -6
- package/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.ts +7 -5
- package/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.ts +7 -11
- package/src/nile-app-shell-panel/nile-app-shell-panel.css.ts +28 -5
- package/src/nile-app-shell-panel/nile-app-shell-panel.ts +44 -16
- package/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.ts +1 -4
- package/src/nile-app-shell-side-nav/nile-app-shell-side-nav.ts +4 -12
- package/vscode-html-custom-data.json +114 -37
|
@@ -13,9 +13,7 @@ import { renderGlyph } from '../internal/glyph';
|
|
|
13
13
|
import NileElement from '../internal/nile-element';
|
|
14
14
|
import '../nile-button/nile-button';
|
|
15
15
|
/**
|
|
16
|
-
* @summary The application frame every route inherits: a side nav, a content
|
|
17
|
-
* container, an optional aside and an AI assistant panel. It holds anything —
|
|
18
|
-
* the shell owns the boxes, the page owns what goes in them.
|
|
16
|
+
* @summary The application frame every route inherits: a side nav, a content container, an optional aside and an AI assistant panel.
|
|
19
17
|
*
|
|
20
18
|
* @status stable
|
|
21
19
|
* @since 2.0
|
|
@@ -27,29 +25,22 @@ import '../nile-button/nile-button';
|
|
|
27
25
|
*
|
|
28
26
|
* @slot - The page body, inside the content container.
|
|
29
27
|
* @slot banner - A full-width strip above every other region.
|
|
30
|
-
* @slot top-bar - The page-title bar
|
|
31
|
-
* or spanning the shell when `top-bar-placement="shell"`. The nav toggle is
|
|
32
|
-
* rendered before whatever is slotted here.
|
|
28
|
+
* @slot top-bar - The page-title bar, mounted inside the container by default or spanning the shell when `top-bar-placement="shell"`.
|
|
33
29
|
* @slot top-bar-actions - Controls pinned to the end of the top bar.
|
|
34
|
-
* @slot tabs - A hoisted second-level tab strip, flush under the top bar and
|
|
35
|
-
*
|
|
36
|
-
* the strip's height, padding and rule, so slot a `<nile-tab-group>` or the
|
|
37
|
-
* tab controls themselves.
|
|
30
|
+
* @slot tabs - A hoisted second-level tab strip, flush under the top bar and outside `<main>`'s scroller.
|
|
31
|
+
* @slot app-icon - The mark shown when `leading="app-icon"`, clipped to the shell's box.
|
|
38
32
|
* @slot side-nav - The navigation track. Works best with `<nile-side-bar>`.
|
|
39
33
|
* @slot aside - A secondary column between the content container and the panel.
|
|
40
|
-
* @slot panel - The AI panel's body. When
|
|
41
|
-
* unmounted and `openPanel()` is a no-op.
|
|
34
|
+
* @slot panel - The AI panel's body. When empty the panel is unmounted and `openPanel()` is a no-op.
|
|
42
35
|
* @slot panel-header - Replaces the default panel heading (mark plus title).
|
|
43
36
|
* @slot panel-actions - Controls added before the panel's close button.
|
|
44
|
-
* @slot panel-footer - A bar docked below the panel's scroll region, for a
|
|
45
|
-
* composer.
|
|
37
|
+
* @slot panel-footer - A bar docked below the panel's scroll region, for a composer.
|
|
46
38
|
*
|
|
47
|
-
* @event nile-nav-toggle - Emitted after the nav's collapsed state or
|
|
48
|
-
*
|
|
49
|
-
* @event nile-panel-
|
|
50
|
-
*
|
|
51
|
-
* @event nile-panel-
|
|
52
|
-
* and overlay. `detail: { mode }`.
|
|
39
|
+
* @event nile-nav-toggle - Emitted after the nav's collapsed state or forced-rail lock changes. `detail: { collapsed, locked }`.
|
|
40
|
+
* @event nile-panel-toggle - Emitted after the panel opens or closes. `detail: { open, mode }`.
|
|
41
|
+
* @event nile-panel-mode-change - Emitted when the panel flips between docked and overlay. `detail: { mode }`.
|
|
42
|
+
* @event nile-header-back - Emitted when the header's back control is pressed.
|
|
43
|
+
* @event nile-panel-back - Emitted when the panel's back control is pressed, whether the shell's built-in panel chrome or a slotted `nile-app-shell-panel` draws it.
|
|
53
44
|
*
|
|
54
45
|
* @csspart skip-link - The skip-to-content link.
|
|
55
46
|
* @csspart banner - The banner region.
|
|
@@ -57,12 +48,15 @@ import '../nile-button/nile-button';
|
|
|
57
48
|
* @csspart top-bar - The top bar, in either placement.
|
|
58
49
|
* @csspart nav-toggle - The built-in nav toggle button.
|
|
59
50
|
* @csspart rule - The vertical rule after the nav toggle.
|
|
60
|
-
* @csspart top-bar-actions - The end-aligned top bar action group.
|
|
61
|
-
* when it holds neither slotted actions nor the Ask button, so it reserves
|
|
62
|
-
* no gap.
|
|
51
|
+
* @csspart top-bar-actions - The end-aligned top bar action group.
|
|
63
52
|
* @csspart ask - The built-in Ask button, the shell's single door to the panel.
|
|
64
|
-
*
|
|
65
|
-
*
|
|
53
|
+
* @csspart title-area - The header's own title block: leading, title, badge and description.
|
|
54
|
+
* @csspart page-title - The title text, exposed as a heading whose level `headingLevel` sets.
|
|
55
|
+
* @csspart description - The second line under the title.
|
|
56
|
+
* @csspart badge - The pill after the title.
|
|
57
|
+
* @csspart leading - The line box holding the leading control.
|
|
58
|
+
* @csspart back - The back control shown by `leading="back"`.
|
|
59
|
+
* @csspart app-icon - The block shown by `leading="app-icon"`, sized by `--nile-app-shell-app-icon-size`.
|
|
66
60
|
* @csspart tabs - The hoisted tab-strip region, under the top bar.
|
|
67
61
|
* @csspart side-nav - The navigation track.
|
|
68
62
|
* @csspart content-section - The flex row holding container, aside and panel.
|
|
@@ -71,42 +65,32 @@ import '../nile-button/nile-button';
|
|
|
71
65
|
* @csspart aside - The aside region.
|
|
72
66
|
* @csspart panel - The AI panel.
|
|
73
67
|
* @csspart panel-header - The panel's header bar.
|
|
68
|
+
* @csspart panel-back - The panel's back control, shown by `panelBack`.
|
|
74
69
|
* @csspart panel-title - The panel's title text.
|
|
75
70
|
* @csspart panel-actions - The panel's header action group.
|
|
76
71
|
* @csspart panel-close - The panel's close button.
|
|
77
72
|
* @csspart panel-body - The panel's scroll region.
|
|
78
73
|
* @csspart panel-footer - The panel's footer.
|
|
79
74
|
*
|
|
80
|
-
* @cssproperty [--nile-app-shell-side-nav-width=
|
|
81
|
-
* @cssproperty [--nile-app-shell-side-nav-rail-width=
|
|
82
|
-
* @cssproperty [--nile-app-shell-side-nav-bg=transparent] - Surface behind a
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* @cssproperty [--nile-app-shell-
|
|
86
|
-
*
|
|
87
|
-
* @cssproperty [--nile-app-shell-
|
|
88
|
-
*
|
|
89
|
-
* @cssproperty [--nile-app-shell-
|
|
90
|
-
*
|
|
91
|
-
* @cssproperty [--nile-app-shell-top-bar-height=56px] - Top bar and panel
|
|
92
|
-
* header height. Drops to 48px under 600px of viewport height.
|
|
93
|
-
* @cssproperty [--nile-app-shell-tabs-height=48px] - Tab strip height.
|
|
94
|
-
* @cssproperty [--nile-app-shell-panel-width=480px] - Docked panel width, and
|
|
95
|
-
* the `min()` ceiling for the overlay drawer.
|
|
96
|
-
* @cssproperty [--nile-app-shell-panel-min-width=360px] - How far a docked
|
|
97
|
-
* panel shrinks to keep pushing rather than covering the page.
|
|
75
|
+
* @cssproperty [--nile-app-shell-side-nav-width=240px] - Expanded nav track.
|
|
76
|
+
* @cssproperty [--nile-app-shell-side-nav-rail-width=70px] - Collapsed track.
|
|
77
|
+
* @cssproperty [--nile-app-shell-side-nav-bg=transparent] - Surface behind a slotted side nav.
|
|
78
|
+
* @cssproperty [--nile-app-shell-side-nav-border=0] - Edge on a slotted side nav.
|
|
79
|
+
* @cssproperty [--nile-app-shell-gutter=4px] - Content-section padding, and the gap between container, aside and panel.
|
|
80
|
+
* @cssproperty [--nile-app-shell-content-padding=24px] - Container inner padding.
|
|
81
|
+
* @cssproperty [--nile-app-shell-top-bar-height=68px] - Top bar height.
|
|
82
|
+
* @cssproperty [--nile-app-shell-panel-header-height=56px] - The panel header's own height.
|
|
83
|
+
* @cssproperty [--nile-app-shell-tabs-height=33px] - Tab strip height.
|
|
84
|
+
* @cssproperty [--nile-app-shell-panel-width=480px] - Docked panel width, and the `min()` ceiling for the overlay drawer.
|
|
85
|
+
* @cssproperty [--nile-app-shell-panel-min-width=360px] - How far a docked panel shrinks to keep pushing rather than covering the page.
|
|
98
86
|
* @cssproperty [--nile-app-shell-aside-width=320px] - Aside width.
|
|
99
|
-
* @cssproperty [--nile-app-shell-aside-min-width=240px] - How far the aside
|
|
100
|
-
* shrinks before the page is asked for room.
|
|
87
|
+
* @cssproperty [--nile-app-shell-aside-min-width=240px] - How far the aside shrinks before the page is asked for room.
|
|
101
88
|
* @cssproperty [--nile-app-shell-content-min-width=640px] - Container floor.
|
|
102
|
-
* @cssproperty [--nile-app-shell-min-width=768px] - Below this the window
|
|
103
|
-
*
|
|
104
|
-
* @cssproperty [--nile-app-shell-
|
|
105
|
-
*
|
|
106
|
-
* @cssproperty [--nile-app-shell-
|
|
107
|
-
* button. The toggle and close controls are nile-buttons and size themselves.
|
|
108
|
-
* @cssproperty [--nile-app-shell-radius=16px] - Container, aside and panel
|
|
109
|
-
* radius.
|
|
89
|
+
* @cssproperty [--nile-app-shell-min-width=768px] - Below this the window scrolls rather than the shell compressing.
|
|
90
|
+
* @cssproperty [--nile-app-shell-centered-width=824px] - Column width under `content-align="centered"`.
|
|
91
|
+
* @cssproperty [--nile-app-shell-app-icon-size=20px] - The leading app icon's box.
|
|
92
|
+
* @cssproperty [--nile-app-shell-utility-size=32px] - Box the shell's own icon controls sit in.
|
|
93
|
+
* @cssproperty [--nile-app-shell-radius=16px] - Container, aside and panel radius.
|
|
110
94
|
* @cssproperty [--nile-app-shell-duration=250ms] - Track and panel motion.
|
|
111
95
|
* @cssproperty [--nile-app-shell-ease] - Easing for moves and resizes.
|
|
112
96
|
*
|
|
@@ -116,24 +100,28 @@ import '../nile-button/nile-button';
|
|
|
116
100
|
* @method expandNav() - Expand the side nav.
|
|
117
101
|
* @method collapseNav() - Collapse the side nav to a rail.
|
|
118
102
|
* @method toggleNav(force?) - Toggle, or force a specific collapsed state.
|
|
103
|
+
* @method goBackHeader() - Emit `nile-header-back`, as the header's back control does.
|
|
104
|
+
* @method goBackPanel() - Emit `nile-panel-back`, as the panel's back control does.
|
|
105
|
+
* @method goBackPage() - Deprecated alias of `goBackHeader()`.
|
|
106
|
+
* @method goBack() - Deprecated alias of `goBackPanel()`.
|
|
119
107
|
*/
|
|
120
108
|
let NileAppShell = class NileAppShell extends NileElement {
|
|
121
109
|
constructor() {
|
|
122
110
|
super(...arguments);
|
|
123
|
-
/**
|
|
124
|
-
* The user's nav preference. The nav can still render as a rail while this is
|
|
125
|
-
* false — see `navLocked`.
|
|
126
|
-
*/
|
|
111
|
+
/** The user's nav preference. The nav can still render as a rail while this is false — see `navLocked`. */
|
|
127
112
|
this.navCollapsed = false;
|
|
128
113
|
/** Whether the AI panel is open. */
|
|
129
114
|
this.panelOpen = false;
|
|
130
|
-
/**
|
|
131
|
-
* Unmounts the AI panel for this route even when the `panel` slot is filled.
|
|
132
|
-
* `openPanel()` becomes a no-op.
|
|
133
|
-
*/
|
|
115
|
+
/** Unmounts the AI panel for this route even when the `panel` slot is filled; `openPanel()` becomes a no-op. */
|
|
134
116
|
this.noPanel = false;
|
|
135
117
|
/** The default panel heading. Ignored when `panel-header` is slotted. */
|
|
136
118
|
this.panelLabel = 'Ask Aquera';
|
|
119
|
+
/** The `aria-level` of the `pageTitle` heading, 1–6, so the title can fit the page's own heading outline; e.g. 2 when the page body or banner already has its h1. Out-of-range values clamp to 1–6 and non-numbers fall back to 1. */
|
|
120
|
+
this.headingLevel = 1;
|
|
121
|
+
/** What sits before the page title: `back` draws a breadcrumb and emits `nile-header-back`; `app-icon` draws a 20px block for the `app-icon` slot. */
|
|
122
|
+
this.leading = 'none';
|
|
123
|
+
/** The previous-page label drawn by `leading="back"`. */
|
|
124
|
+
this.backLabel = 'Back';
|
|
137
125
|
/** Hides the built-in nav toggle. Mount `nile-app-shell-nav-toggle` yourself. */
|
|
138
126
|
this.noNavToggle = false;
|
|
139
127
|
/** Drops the Cmd/Ctrl+J and Escape panel shortcuts. */
|
|
@@ -146,48 +134,27 @@ let NileAppShell = class NileAppShell extends NileElement {
|
|
|
146
134
|
this.topBarPlacement = 'content';
|
|
147
135
|
/** `centered` caps the page body at `--nile-app-shell-centered-width`. */
|
|
148
136
|
this.contentAlign = 'fluid';
|
|
149
|
-
/**
|
|
150
|
-
* Makes the slotted page root a size query container, so page CSS can size
|
|
151
|
-
* against the content container instead of the viewport. Query it unnamed —
|
|
152
|
-
* `@container (min-width: 720px)` — because a container name declared inside
|
|
153
|
-
* the shell's shadow tree is not visible to page CSS. Opt-in, because it
|
|
154
|
-
* also applies layout containment to that element.
|
|
155
|
-
*/
|
|
137
|
+
/** Makes the slotted page root a size query container, so page CSS can size against the content container instead of the viewport. */
|
|
156
138
|
this.contentContainer = false;
|
|
157
139
|
/** Drops the container's card chrome for a full-bleed page. */
|
|
158
140
|
this.flat = false;
|
|
159
141
|
/** Removes the container's inner padding. */
|
|
160
142
|
this.noPadding = false;
|
|
161
|
-
/**
|
|
162
|
-
* The label on the built-in Ask button.
|
|
163
|
-
*
|
|
164
|
-
* The button is the shell's, not the app's: it is the one control that has
|
|
165
|
-
* to know whether a panel is mounted for this route and how to open it, and
|
|
166
|
-
* slotted content can see neither. Everything else in the bar — the
|
|
167
|
-
* breadcrumb, the page actions, the tab strip — is slotted markup.
|
|
168
|
-
*/
|
|
143
|
+
/** The label on the built-in Ask button. */
|
|
169
144
|
this.askLabel = 'Ask';
|
|
170
145
|
/** Drops the built-in Ask button, for a bar that renders its own. */
|
|
171
146
|
this.noAsk = false;
|
|
147
|
+
/** Shows a back control at the start of the panel header for a panel sub-view; emits `nile-panel-back`. */
|
|
148
|
+
this.panelBack = false;
|
|
149
|
+
/** Accessible name of the panel's back control. */
|
|
150
|
+
this.panelBackLabel = 'Back';
|
|
151
|
+
/** Hides the tab strip for this route even when the `tabs` slot is filled. */
|
|
152
|
+
this.noTabs = false;
|
|
172
153
|
/** Sizes the shell to the viewport instead of its parent. */
|
|
173
154
|
this.fullHeight = false;
|
|
174
|
-
/**
|
|
175
|
-
* Below this shell width the panel overlays the content instead of pushing
|
|
176
|
-
* it, and the nav is forced to a rail.
|
|
177
|
-
*
|
|
178
|
-
* Zero — the default — means never: the panel is furniture that squeezes the
|
|
179
|
-
* page, at every width. It earns its room from the nav rail first and from
|
|
180
|
-
* its own width next (see `--nile-app-shell-panel-min-width`), so it does
|
|
181
|
-
* not have to cover the page to fit. Set a width here to opt back into an
|
|
182
|
-
* overlay drawer below it.
|
|
183
|
-
*/
|
|
155
|
+
/** Below this shell width the panel overlays the content instead of pushing it, and the nav is forced to a rail; zero (default) means never. */
|
|
184
156
|
this.overlayBreakpoint = 0;
|
|
185
|
-
/**
|
|
186
|
-
* Below this shell width an open docked panel forces the nav to a rail.
|
|
187
|
-
* A floor, not the whole rule: the nav also rails as soon as the expanded
|
|
188
|
-
* track is what stops the row from fitting. This is the first thing the
|
|
189
|
-
* panel takes room from, so it can push rather than cover.
|
|
190
|
-
*/
|
|
157
|
+
/** Below this shell width an open docked panel forces the nav to a rail. */
|
|
191
158
|
this.dockedRailBreakpoint = 1440;
|
|
192
159
|
/** The panel's current mode. Derived from the shell's width. */
|
|
193
160
|
this._panelMode = 'docked';
|
|
@@ -200,12 +167,7 @@ let NileAppShell = class NileAppShell extends NileElement {
|
|
|
200
167
|
this._hasTabs = false;
|
|
201
168
|
this._hasPanel = false;
|
|
202
169
|
this._hasPanelFooter = false;
|
|
203
|
-
/**
|
|
204
|
-
* True when a `nile-app-shell-panel` is slotted. That component owns the
|
|
205
|
-
* panel's heading, actions, close button and footer, so the shell renders a
|
|
206
|
-
* bare region and keeps only the geometry and the open state — the same
|
|
207
|
-
* hand-off as `no-nav-toggle` plus `nile-app-shell-nav-toggle`.
|
|
208
|
-
*/
|
|
170
|
+
/** True when a `nile-app-shell-panel` is slotted, owning the panel's own chrome so the shell renders a bare region. */
|
|
209
171
|
this._panelOwnsChrome = false;
|
|
210
172
|
this._hasAside = false;
|
|
211
173
|
this._width = 0;
|
|
@@ -247,6 +209,10 @@ let NileAppShell = class NileAppShell extends NileElement {
|
|
|
247
209
|
get panelAvailable() {
|
|
248
210
|
return this._hasPanel && !this.noPanel;
|
|
249
211
|
}
|
|
212
|
+
/** Whether the tab strip is rendered: something slotted, and not switched off. */
|
|
213
|
+
get tabsVisible() {
|
|
214
|
+
return this._hasTabs && !this.noTabs;
|
|
215
|
+
}
|
|
250
216
|
/** Whether the built-in Ask button is rendered. */
|
|
251
217
|
get askVisible() {
|
|
252
218
|
return this.panelAvailable && !this.noAsk;
|
|
@@ -276,8 +242,7 @@ let NileAppShell = class NileAppShell extends NileElement {
|
|
|
276
242
|
changed.has('noPanel') ||
|
|
277
243
|
changed.has('overlayBreakpoint') ||
|
|
278
244
|
changed.has('dockedRailBreakpoint') ||
|
|
279
|
-
//
|
|
280
|
-
// Private state is outside `keyof this`, so ask the map directly.
|
|
245
|
+
// Aside/side-nav mounting changes what a docked panel fits beside; ask the map since private state is outside `keyof this`.
|
|
281
246
|
changed.has('_hasAside') ||
|
|
282
247
|
changed.has('_hasSideNav')) {
|
|
283
248
|
this._recompute();
|
|
@@ -290,10 +255,14 @@ let NileAppShell = class NileAppShell extends NileElement {
|
|
|
290
255
|
this.toggleAttribute('nav-locked', this._navLocked);
|
|
291
256
|
this.toggleAttribute('has-banner', this._hasBanner);
|
|
292
257
|
this.toggleAttribute('has-side-nav', this._hasSideNav);
|
|
293
|
-
this.toggleAttribute('has-top-bar', this._hasTopBar ||
|
|
258
|
+
this.toggleAttribute('has-top-bar', this._hasTopBar ||
|
|
259
|
+
this._hasTitleBlock ||
|
|
260
|
+
(!this.noNavToggle && this._hasSideNav));
|
|
261
|
+
// Only with a title to sit under: see _hasTitleBlock.
|
|
262
|
+
this.toggleAttribute('has-description', !!this.description && !!this.pageTitle);
|
|
294
263
|
this.toggleAttribute('has-top-bar-actions', this._hasTopBarActions);
|
|
295
264
|
this.toggleAttribute('has-ask', this.askVisible);
|
|
296
|
-
this.toggleAttribute('has-tabs', this.
|
|
265
|
+
this.toggleAttribute('has-tabs', this.tabsVisible);
|
|
297
266
|
this.toggleAttribute('has-aside', this._hasAside);
|
|
298
267
|
this.toggleAttribute('has-panel', this.panelAvailable);
|
|
299
268
|
this.toggleAttribute('has-panel-footer', this._hasPanelFooter);
|
|
@@ -311,11 +280,7 @@ let NileAppShell = class NileAppShell extends NileElement {
|
|
|
311
280
|
closePanel() {
|
|
312
281
|
this._setPanelOpen(false);
|
|
313
282
|
}
|
|
314
|
-
/**
|
|
315
|
-
* Toggle the panel, or force a state. Call `openPanel()` from a page action —
|
|
316
|
-
* a page action that toggles closes the panel for a user who already had it
|
|
317
|
-
* open.
|
|
318
|
-
*/
|
|
283
|
+
/** Toggle the panel, or force a state. */
|
|
319
284
|
togglePanel(force) {
|
|
320
285
|
const next = force ?? !this.panelOpen;
|
|
321
286
|
if (next)
|
|
@@ -323,6 +288,22 @@ let NileAppShell = class NileAppShell extends NileElement {
|
|
|
323
288
|
else
|
|
324
289
|
this.closePanel();
|
|
325
290
|
}
|
|
291
|
+
/** Emit `nile-header-back`, as the header's back control does; the page owns the history. */
|
|
292
|
+
goBackHeader() {
|
|
293
|
+
this.emit('nile-header-back');
|
|
294
|
+
}
|
|
295
|
+
/** Emit `nile-panel-back`, as the panel's back control does; the page owns the view stack. */
|
|
296
|
+
goBackPanel() {
|
|
297
|
+
this.emit('nile-panel-back');
|
|
298
|
+
}
|
|
299
|
+
/** @deprecated Use `goBackHeader()`; kept as an alias that emits `nile-header-back`. */
|
|
300
|
+
goBackPage() {
|
|
301
|
+
this.goBackHeader();
|
|
302
|
+
}
|
|
303
|
+
/** @deprecated Use `goBackPanel()`; kept as an alias that emits `nile-panel-back`. */
|
|
304
|
+
goBack() {
|
|
305
|
+
this.goBackPanel();
|
|
306
|
+
}
|
|
326
307
|
/** Expand the side nav. */
|
|
327
308
|
expandNav() {
|
|
328
309
|
this._setNavCollapsed(false);
|
|
@@ -371,11 +352,7 @@ let NileAppShell = class NileAppShell extends NileElement {
|
|
|
371
352
|
this.openPanel();
|
|
372
353
|
}
|
|
373
354
|
}
|
|
374
|
-
/**
|
|
375
|
-
* The shell's geometry, read off its own custom properties so a consumer's
|
|
376
|
-
* overrides are part of the sum. Falls back to the stylesheet's defaults
|
|
377
|
-
* before the element has a computed style.
|
|
378
|
-
*/
|
|
355
|
+
/** The shell's geometry, read off its own custom properties, falling back to defaults before a computed style exists. */
|
|
379
356
|
_geometry() {
|
|
380
357
|
const style = getComputedStyle(this);
|
|
381
358
|
const px = (name, fallback) => {
|
|
@@ -383,46 +360,30 @@ let NileAppShell = class NileAppShell extends NileElement {
|
|
|
383
360
|
return Number.isFinite(value) ? value : fallback;
|
|
384
361
|
};
|
|
385
362
|
return {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
363
|
+
// Read the substituted value so they follow the active theme; the literals are the enterprise fallback.
|
|
364
|
+
nav: px('--nile-app-shell-side-nav-width', 240),
|
|
365
|
+
rail: px('--nile-app-shell-side-nav-rail-width', 70),
|
|
366
|
+
gutter: px('--nile-app-shell-gutter', 4),
|
|
389
367
|
content: px('--nile-app-shell-content-min-width', 640),
|
|
390
368
|
aside: px('--nile-app-shell-aside-width', 320),
|
|
391
369
|
panel: px('--nile-app-shell-panel-width', 480),
|
|
392
370
|
};
|
|
393
371
|
}
|
|
394
|
-
/**
|
|
395
|
-
* The shell width a docked panel needs to sit beside the content floor, over
|
|
396
|
-
* a side-nav `track` wide.
|
|
397
|
-
*
|
|
398
|
-
* A fixed breakpoint cannot answer this: what shares the row changes per
|
|
399
|
-
* route. An aside alone adds 328px, so a shell wide enough to hold the
|
|
400
|
-
* expanded nav beside a docked panel on one route is 328px short on the
|
|
401
|
-
* next. Summing what is actually mounted rails the nav exactly when the
|
|
402
|
-
* track is what the row cannot afford.
|
|
403
|
-
*/
|
|
372
|
+
/** The shell width a docked panel needs to sit beside the content floor, over a side-nav `track` wide. */
|
|
404
373
|
_dockRequirement(geo, track) {
|
|
405
374
|
const nav = this._hasSideNav ? track : 0;
|
|
406
375
|
const aside = this._hasAside ? geo.aside + geo.gutter : 0;
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
return nav + geo.content + aside + geo.panel + geo.gutter *
|
|
376
|
+
/* The content row's chrome is end-edge padding plus one flex gap between container and panel (an aside carries its own gap above), and start-edge padding too when no nav track is there to sit flush against. */
|
|
377
|
+
const gutters = this._hasSideNav ? 2 : 3;
|
|
378
|
+
return nav + geo.content + aside + geo.panel + geo.gutter * gutters;
|
|
410
379
|
}
|
|
411
380
|
_recompute() {
|
|
412
381
|
const width = this._width;
|
|
413
382
|
const geo = this._geometry();
|
|
414
|
-
/*
|
|
415
|
-
* Overlay is opt-in and nothing derives it: a panel that covers the page
|
|
416
|
-
* hides the thing the user is asking about. Running out of room is not a
|
|
417
|
-
* reason to switch — the rail and the panel's own min width absorb that —
|
|
418
|
-
* so the shell only overlays below a width the author names.
|
|
419
|
-
*/
|
|
383
|
+
/* Overlay is opt-in: the shell only overlays below a width the author names, never from running out of room. */
|
|
420
384
|
const overlay = this.overlayBreakpoint > 0 && width > 0 && width < this.overlayBreakpoint;
|
|
421
385
|
const mode = overlay ? 'overlay' : 'docked';
|
|
422
|
-
// A docked panel squeezes the container, so a narrow shell trades the
|
|
423
|
-
// expanded nav for content width before the page gives any up. Measured
|
|
424
|
-
// against the expanded track: the nav rails exactly when it is the track
|
|
425
|
-
// that stops the row from fitting.
|
|
386
|
+
// A docked panel squeezes the container, so a narrow shell trades the expanded nav for content width, measured against the expanded track.
|
|
426
387
|
const railAt = Math.max(this.dockedRailBreakpoint, this._dockRequirement(geo, geo.nav));
|
|
427
388
|
const squeezed = !overlay &&
|
|
428
389
|
this.panelOpen &&
|
|
@@ -526,7 +487,7 @@ let NileAppShell = class NileAppShell extends NileElement {
|
|
|
526
487
|
return html `
|
|
527
488
|
<div class="nav-toggle-group">
|
|
528
489
|
<nile-button
|
|
529
|
-
class="nav-toggle"
|
|
490
|
+
class="nav-toggle utility-control"
|
|
530
491
|
part="nav-toggle"
|
|
531
492
|
variant="ghost"
|
|
532
493
|
circle
|
|
@@ -541,9 +502,88 @@ let NileAppShell = class NileAppShell extends NileElement {
|
|
|
541
502
|
aria-label=${expanded ? 'Collapse navigation' : 'Expand navigation'}
|
|
542
503
|
@click=${() => this.toggleNav()}
|
|
543
504
|
>
|
|
544
|
-
${renderGlyph(expanded ? 'ng-panel-left
|
|
505
|
+
${renderGlyph(expanded ? 'ng-panel-left' : 'ng-panel-right', 20, 'currentColor')}
|
|
545
506
|
</nile-button>
|
|
546
|
-
${this._hasTopBar
|
|
507
|
+
${this._hasTopBar || this._hasTitleBlock
|
|
508
|
+
? html `<span class="rule" part="rule"></span>`
|
|
509
|
+
: ''}
|
|
510
|
+
</div>
|
|
511
|
+
`;
|
|
512
|
+
}
|
|
513
|
+
/** Whether the header has a title block of its own to draw: only a title or a leading control mounts it. */
|
|
514
|
+
get _hasTitleBlock() {
|
|
515
|
+
return !!this.pageTitle || this._hasLeading;
|
|
516
|
+
}
|
|
517
|
+
/** Whether `leading` names a control that renders; an empty or unknown value draws nothing, like `none`. */
|
|
518
|
+
get _hasLeading() {
|
|
519
|
+
return this.leading === 'back' || this.leading === 'app-icon';
|
|
520
|
+
}
|
|
521
|
+
/** `headingLevel` as a safe `aria-level`: a whole number clamped to 1–6, and 1 for anything non-numeric. */
|
|
522
|
+
get _headingLevel() {
|
|
523
|
+
const level = Math.trunc(Number(this.headingLevel));
|
|
524
|
+
return Number.isFinite(level) ? Math.min(6, Math.max(1, level)) : 1;
|
|
525
|
+
}
|
|
526
|
+
_renderLeading() {
|
|
527
|
+
if (this.leading === 'app-icon') {
|
|
528
|
+
return html `
|
|
529
|
+
<span class="app-icon" part="app-icon">
|
|
530
|
+
<slot name="app-icon"></slot>
|
|
531
|
+
</span>
|
|
532
|
+
`;
|
|
533
|
+
}
|
|
534
|
+
if (this.leading === 'back') {
|
|
535
|
+
return html `
|
|
536
|
+
<button
|
|
537
|
+
class="back"
|
|
538
|
+
part="back"
|
|
539
|
+
type="button"
|
|
540
|
+
@click=${() => this.goBackHeader()}
|
|
541
|
+
>
|
|
542
|
+
${renderGlyph('ng-chevron-left', 20, 'currentColor')}
|
|
543
|
+
<span>${this.backLabel}</span>
|
|
544
|
+
</button>
|
|
545
|
+
${this.pageTitle
|
|
546
|
+
? html `<span class="crumb-divider" aria-hidden="true">
|
|
547
|
+
${renderGlyph('ng-slash', 16, 'currentColor')}
|
|
548
|
+
</span>`
|
|
549
|
+
: ''}
|
|
550
|
+
`;
|
|
551
|
+
}
|
|
552
|
+
return '';
|
|
553
|
+
}
|
|
554
|
+
_renderTitleBlock() {
|
|
555
|
+
if (!this._hasTitleBlock)
|
|
556
|
+
return '';
|
|
557
|
+
/* Both leading modes render beside the title stack, never inside the title row, so the description stays under the page title in every leading mode. */
|
|
558
|
+
return html `
|
|
559
|
+
<div class="title-area" part="title-area">
|
|
560
|
+
${this._hasLeading
|
|
561
|
+
? html `<span class="leading" part="leading"
|
|
562
|
+
>${this._renderLeading()}</span
|
|
563
|
+
>`
|
|
564
|
+
: ''}
|
|
565
|
+
${this.pageTitle
|
|
566
|
+
? html `
|
|
567
|
+
<div class="title-stack">
|
|
568
|
+
<div class="title-row">
|
|
569
|
+
<div
|
|
570
|
+
class="page-title"
|
|
571
|
+
part="page-title"
|
|
572
|
+
role="heading"
|
|
573
|
+
aria-level=${this._headingLevel}
|
|
574
|
+
>${this.pageTitle}</div>
|
|
575
|
+
${this.badge
|
|
576
|
+
? html `<span class="badge" part="badge">${this.badge}</span>`
|
|
577
|
+
: ''}
|
|
578
|
+
</div>
|
|
579
|
+
${this.description
|
|
580
|
+
? html `<p class="description" part="description">
|
|
581
|
+
${this.description}
|
|
582
|
+
</p>`
|
|
583
|
+
: ''}
|
|
584
|
+
</div>
|
|
585
|
+
`
|
|
586
|
+
: ''}
|
|
547
587
|
</div>
|
|
548
588
|
`;
|
|
549
589
|
}
|
|
@@ -555,6 +595,7 @@ let NileAppShell = class NileAppShell extends NileElement {
|
|
|
555
595
|
>
|
|
556
596
|
${this._renderNavToggle()}
|
|
557
597
|
<div class="top-bar-content">
|
|
598
|
+
${this._renderTitleBlock()}
|
|
558
599
|
<slot
|
|
559
600
|
name="top-bar"
|
|
560
601
|
@slotchange=${(e) => this._onSlotChange('top-bar', e)}
|
|
@@ -652,6 +693,19 @@ let NileAppShell = class NileAppShell extends NileElement {
|
|
|
652
693
|
></slot>`
|
|
653
694
|
: html `
|
|
654
695
|
<header class="panel-header" part="panel-header">
|
|
696
|
+
${this.panelBack
|
|
697
|
+
? html `<nile-button
|
|
698
|
+
class="panel-back utility-control"
|
|
699
|
+
part="panel-back"
|
|
700
|
+
variant="ghost"
|
|
701
|
+
circle
|
|
702
|
+
title=${this.panelBackLabel}
|
|
703
|
+
aria-label=${this.panelBackLabel}
|
|
704
|
+
@click=${() => this.goBackPanel()}
|
|
705
|
+
>
|
|
706
|
+
${renderGlyph('ng-arrow-left', 20, 'currentColor')}
|
|
707
|
+
</nile-button>`
|
|
708
|
+
: ''}
|
|
655
709
|
<slot name="panel-header">
|
|
656
710
|
<span class="panel-heading">
|
|
657
711
|
<span class="panel-mark">
|
|
@@ -665,7 +719,7 @@ let NileAppShell = class NileAppShell extends NileElement {
|
|
|
665
719
|
<div class="panel-actions" part="panel-actions">
|
|
666
720
|
<slot name="panel-actions"></slot>
|
|
667
721
|
<nile-button
|
|
668
|
-
class="panel-close"
|
|
722
|
+
class="panel-close utility-control"
|
|
669
723
|
part="panel-close"
|
|
670
724
|
variant="ghost"
|
|
671
725
|
circle
|
|
@@ -673,7 +727,7 @@ let NileAppShell = class NileAppShell extends NileElement {
|
|
|
673
727
|
aria-label="Close ${this.panelLabel}"
|
|
674
728
|
@click=${() => this.closePanel()}
|
|
675
729
|
>
|
|
676
|
-
${renderGlyph('ng-x-close',
|
|
730
|
+
${renderGlyph('ng-x-close', 20, 'currentColor')}
|
|
677
731
|
</nile-button>
|
|
678
732
|
</div>
|
|
679
733
|
</header>
|
|
@@ -707,6 +761,24 @@ __decorate([
|
|
|
707
761
|
__decorate([
|
|
708
762
|
property({ type: String, attribute: 'panel-label' })
|
|
709
763
|
], NileAppShell.prototype, "panelLabel", void 0);
|
|
764
|
+
__decorate([
|
|
765
|
+
property({ type: String, attribute: true, reflect: true })
|
|
766
|
+
], NileAppShell.prototype, "pageTitle", void 0);
|
|
767
|
+
__decorate([
|
|
768
|
+
property({ type: Number, attribute: true, reflect: true })
|
|
769
|
+
], NileAppShell.prototype, "headingLevel", void 0);
|
|
770
|
+
__decorate([
|
|
771
|
+
property({ type: String, attribute: true, reflect: true })
|
|
772
|
+
], NileAppShell.prototype, "description", void 0);
|
|
773
|
+
__decorate([
|
|
774
|
+
property({ type: String, attribute: true, reflect: true })
|
|
775
|
+
], NileAppShell.prototype, "badge", void 0);
|
|
776
|
+
__decorate([
|
|
777
|
+
property({ type: String, attribute: true, reflect: true })
|
|
778
|
+
], NileAppShell.prototype, "leading", void 0);
|
|
779
|
+
__decorate([
|
|
780
|
+
property({ type: String, attribute: true, reflect: true })
|
|
781
|
+
], NileAppShell.prototype, "backLabel", void 0);
|
|
710
782
|
__decorate([
|
|
711
783
|
property({ type: Boolean, reflect: true, attribute: 'no-nav-toggle' })
|
|
712
784
|
], NileAppShell.prototype, "noNavToggle", void 0);
|
|
@@ -740,6 +812,15 @@ __decorate([
|
|
|
740
812
|
__decorate([
|
|
741
813
|
property({ type: Boolean, reflect: true, attribute: 'no-ask' })
|
|
742
814
|
], NileAppShell.prototype, "noAsk", void 0);
|
|
815
|
+
__decorate([
|
|
816
|
+
property({ type: Boolean, reflect: true })
|
|
817
|
+
], NileAppShell.prototype, "panelBack", void 0);
|
|
818
|
+
__decorate([
|
|
819
|
+
property({ type: String })
|
|
820
|
+
], NileAppShell.prototype, "panelBackLabel", void 0);
|
|
821
|
+
__decorate([
|
|
822
|
+
property({ type: Boolean, reflect: true })
|
|
823
|
+
], NileAppShell.prototype, "noTabs", void 0);
|
|
743
824
|
__decorate([
|
|
744
825
|
property({ type: Boolean, reflect: true, attribute: 'full-height' })
|
|
745
826
|
], NileAppShell.prototype, "fullHeight", void 0);
|