@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.
Files changed (104) hide show
  1. package/README.md +3 -0
  2. package/demo/app-shell.html +852 -0
  3. package/demo/nxtgen-classes.css +2 -2
  4. package/demo/nxtgen-properties.css +2 -2
  5. package/demo/nxtgen-utilities.css +2 -2
  6. package/demo/nxtgen.css +2 -2
  7. package/demo/utilities.css +2 -2
  8. package/demo/variables.css +2 -2
  9. package/dist/index.cjs.js +1 -1
  10. package/dist/index.esm.js +1 -1
  11. package/dist/index.js +579 -296
  12. package/dist/internal/app-shell-utility-control-styles.cjs.js +2 -0
  13. package/dist/internal/app-shell-utility-control-styles.cjs.js.map +1 -0
  14. package/dist/internal/app-shell-utility-control-styles.esm.js +16 -0
  15. package/dist/nile-app-shell/index.cjs.js +1 -1
  16. package/dist/nile-app-shell/index.esm.js +1 -1
  17. package/dist/nile-app-shell/nile-app-shell.cjs.js +1 -1
  18. package/dist/nile-app-shell/nile-app-shell.cjs.js.map +1 -1
  19. package/dist/nile-app-shell/nile-app-shell.css.cjs.js +1 -1
  20. package/dist/nile-app-shell/nile-app-shell.css.cjs.js.map +1 -1
  21. package/dist/nile-app-shell/nile-app-shell.css.esm.js +270 -92
  22. package/dist/nile-app-shell/nile-app-shell.esm.js +61 -10
  23. package/dist/nile-app-shell/shell-controller.cjs.js.map +1 -1
  24. package/dist/nile-app-shell-main/nile-app-shell-main.cjs.js.map +1 -1
  25. package/dist/nile-app-shell-nav-toggle/index.cjs.js +1 -1
  26. package/dist/nile-app-shell-nav-toggle/index.esm.js +1 -1
  27. package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.cjs.js +1 -1
  28. package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.cjs.js.map +1 -1
  29. package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.cjs.js +1 -1
  30. package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.cjs.js.map +1 -1
  31. package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.esm.js +7 -3
  32. package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.esm.js +3 -3
  33. package/dist/nile-app-shell-panel/index.cjs.js +1 -1
  34. package/dist/nile-app-shell-panel/index.esm.js +1 -1
  35. package/dist/nile-app-shell-panel/nile-app-shell-panel.cjs.js +1 -1
  36. package/dist/nile-app-shell-panel/nile-app-shell-panel.cjs.js.map +1 -1
  37. package/dist/nile-app-shell-panel/nile-app-shell-panel.css.cjs.js +1 -1
  38. package/dist/nile-app-shell-panel/nile-app-shell-panel.css.cjs.js.map +1 -1
  39. package/dist/nile-app-shell-panel/nile-app-shell-panel.css.esm.js +29 -7
  40. package/dist/nile-app-shell-panel/nile-app-shell-panel.esm.js +18 -5
  41. package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.cjs.js.map +1 -1
  42. package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.css.cjs.js.map +1 -1
  43. package/dist/src/internal/app-shell-utility-control-styles.d.ts +12 -0
  44. package/dist/src/internal/app-shell-utility-control-styles.js +29 -0
  45. package/dist/src/internal/app-shell-utility-control-styles.js.map +1 -0
  46. package/dist/src/nile-app-shell/nile-app-shell-regions.test.d.ts +3 -0
  47. package/dist/src/nile-app-shell/nile-app-shell-regions.test.js +206 -0
  48. package/dist/src/nile-app-shell/nile-app-shell-regions.test.js.map +1 -1
  49. package/dist/src/nile-app-shell/nile-app-shell.css.d.ts +1 -9
  50. package/dist/src/nile-app-shell/nile-app-shell.css.js +270 -99
  51. package/dist/src/nile-app-shell/nile-app-shell.css.js.map +1 -1
  52. package/dist/src/nile-app-shell/nile-app-shell.d.ts +90 -122
  53. package/dist/src/nile-app-shell/nile-app-shell.js +224 -143
  54. package/dist/src/nile-app-shell/nile-app-shell.js.map +1 -1
  55. package/dist/src/nile-app-shell/nile-app-shell.test.d.ts +3 -0
  56. package/dist/src/nile-app-shell/nile-app-shell.test.js +898 -29
  57. package/dist/src/nile-app-shell/nile-app-shell.test.js.map +1 -1
  58. package/dist/src/nile-app-shell/shell-controller.d.ts +1 -8
  59. package/dist/src/nile-app-shell/shell-controller.js +2 -14
  60. package/dist/src/nile-app-shell/shell-controller.js.map +1 -1
  61. package/dist/src/nile-app-shell-main/nile-app-shell-main.d.ts +2 -6
  62. package/dist/src/nile-app-shell-main/nile-app-shell-main.js +2 -6
  63. package/dist/src/nile-app-shell-main/nile-app-shell-main.js.map +1 -1
  64. package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.d.ts +1 -4
  65. package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.js +7 -5
  66. package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.js.map +1 -1
  67. package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.d.ts +4 -8
  68. package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.js +5 -6
  69. package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.js.map +1 -1
  70. package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.js +28 -5
  71. package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.js.map +1 -1
  72. package/dist/src/nile-app-shell-panel/nile-app-shell-panel.d.ts +18 -13
  73. package/dist/src/nile-app-shell-panel/nile-app-shell-panel.js +45 -16
  74. package/dist/src/nile-app-shell-panel/nile-app-shell-panel.js.map +1 -1
  75. package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.d.ts +1 -4
  76. package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.js +1 -4
  77. package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.js.map +1 -1
  78. package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.d.ts +4 -12
  79. package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.js +4 -12
  80. package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.js.map +1 -1
  81. package/dist/src/version.js +1 -1
  82. package/dist/src/version.js.map +1 -1
  83. package/dist/tsconfig.tsbuildinfo +1 -1
  84. package/dist/version.cjs.js +1 -1
  85. package/dist/version.cjs.js.map +1 -1
  86. package/dist/version.esm.js +1 -1
  87. package/package.json +1 -1
  88. package/plop-templates/lit/lit.test.ts.hbs +22 -0
  89. package/plop-templates/lit/lit.ts.hbs +10 -5
  90. package/plopfile.js +12 -0
  91. package/src/internal/app-shell-utility-control-styles.ts +30 -0
  92. package/src/nile-app-shell/nile-app-shell-regions.test.ts +248 -0
  93. package/src/nile-app-shell/nile-app-shell.css.ts +270 -99
  94. package/src/nile-app-shell/nile-app-shell.test.ts +1120 -29
  95. package/src/nile-app-shell/nile-app-shell.ts +241 -148
  96. package/src/nile-app-shell/shell-controller.ts +2 -14
  97. package/src/nile-app-shell-main/nile-app-shell-main.ts +2 -6
  98. package/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.ts +7 -5
  99. package/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.ts +7 -11
  100. package/src/nile-app-shell-panel/nile-app-shell-panel.css.ts +28 -5
  101. package/src/nile-app-shell-panel/nile-app-shell-panel.ts +44 -16
  102. package/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.ts +1 -4
  103. package/src/nile-app-shell-side-nav/nile-app-shell-side-nav.ts +4 -12
  104. package/vscode-html-custom-data.json +114 -37
@@ -22,6 +22,9 @@ export type NileAppShellTopBarPlacement = 'content' | 'shell';
22
22
  /** How the main region lays its content out. */
23
23
  export type NileAppShellContentAlign = 'fluid' | 'centered';
24
24
 
25
+ /** What sits before the page title in the top bar. */
26
+ export type NileAppShellLeading = 'none' | 'back' | 'app-icon';
27
+
25
28
  /** The shell's own track and region widths, in px. */
26
29
  interface ShellGeometry {
27
30
  nav: number;
@@ -33,9 +36,7 @@ interface ShellGeometry {
33
36
  }
34
37
 
35
38
  /**
36
- * @summary The application frame every route inherits: a side nav, a content
37
- * container, an optional aside and an AI assistant panel. It holds anything —
38
- * the shell owns the boxes, the page owns what goes in them.
39
+ * @summary The application frame every route inherits: a side nav, a content container, an optional aside and an AI assistant panel.
39
40
  *
40
41
  * @status stable
41
42
  * @since 2.0
@@ -47,29 +48,22 @@ interface ShellGeometry {
47
48
  *
48
49
  * @slot - The page body, inside the content container.
49
50
  * @slot banner - A full-width strip above every other region.
50
- * @slot top-bar - The page-title bar. Mounted inside the container by default,
51
- * or spanning the shell when `top-bar-placement="shell"`. The nav toggle is
52
- * rendered before whatever is slotted here.
51
+ * @slot top-bar - The page-title bar, mounted inside the container by default or spanning the shell when `top-bar-placement="shell"`.
53
52
  * @slot top-bar-actions - Controls pinned to the end of the top bar.
54
- * @slot tabs - A hoisted second-level tab strip, flush under the top bar and
55
- * outside `<main>`'s scroller, so it never scrolls away. The region carries
56
- * the strip's height, padding and rule, so slot a `<nile-tab-group>` or the
57
- * tab controls themselves.
53
+ * @slot tabs - A hoisted second-level tab strip, flush under the top bar and outside `<main>`'s scroller.
54
+ * @slot app-icon - The mark shown when `leading="app-icon"`, clipped to the shell's box.
58
55
  * @slot side-nav - The navigation track. Works best with `<nile-side-bar>`.
59
56
  * @slot aside - A secondary column between the content container and the panel.
60
- * @slot panel - The AI panel's body. When nothing is slotted here the panel is
61
- * unmounted and `openPanel()` is a no-op.
57
+ * @slot panel - The AI panel's body. When empty the panel is unmounted and `openPanel()` is a no-op.
62
58
  * @slot panel-header - Replaces the default panel heading (mark plus title).
63
59
  * @slot panel-actions - Controls added before the panel's close button.
64
- * @slot panel-footer - A bar docked below the panel's scroll region, for a
65
- * composer.
60
+ * @slot panel-footer - A bar docked below the panel's scroll region, for a composer.
66
61
  *
67
- * @event nile-nav-toggle - Emitted after the nav's collapsed state or its
68
- * forced-rail lock changes. `detail: { collapsed, locked }`.
69
- * @event nile-panel-toggle - Emitted after the panel opens or closes.
70
- * `detail: { open, mode }`.
71
- * @event nile-panel-mode-change - Emitted when the panel flips between docked
72
- * and overlay. `detail: { mode }`.
62
+ * @event nile-nav-toggle - Emitted after the nav's collapsed state or forced-rail lock changes. `detail: { collapsed, locked }`.
63
+ * @event nile-panel-toggle - Emitted after the panel opens or closes. `detail: { open, mode }`.
64
+ * @event nile-panel-mode-change - Emitted when the panel flips between docked and overlay. `detail: { mode }`.
65
+ * @event nile-header-back - Emitted when the header's back control is pressed.
66
+ * @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.
73
67
  *
74
68
  * @csspart skip-link - The skip-to-content link.
75
69
  * @csspart banner - The banner region.
@@ -77,12 +71,15 @@ interface ShellGeometry {
77
71
  * @csspart top-bar - The top bar, in either placement.
78
72
  * @csspart nav-toggle - The built-in nav toggle button.
79
73
  * @csspart rule - The vertical rule after the nav toggle.
80
- * @csspart top-bar-actions - The end-aligned top bar action group. Unmounted
81
- * when it holds neither slotted actions nor the Ask button, so it reserves
82
- * no gap.
74
+ * @csspart top-bar-actions - The end-aligned top bar action group.
83
75
  * @csspart ask - The built-in Ask button, the shell's single door to the panel.
84
- * A `<nile-button>`; its inner surface and label are exported as
85
- * `ask__base` and `ask__label`.
76
+ * @csspart title-area - The header's own title block: leading, title, badge and description.
77
+ * @csspart page-title - The title text, exposed as a heading whose level `headingLevel` sets.
78
+ * @csspart description - The second line under the title.
79
+ * @csspart badge - The pill after the title.
80
+ * @csspart leading - The line box holding the leading control.
81
+ * @csspart back - The back control shown by `leading="back"`.
82
+ * @csspart app-icon - The block shown by `leading="app-icon"`, sized by `--nile-app-shell-app-icon-size`.
86
83
  * @csspart tabs - The hoisted tab-strip region, under the top bar.
87
84
  * @csspart side-nav - The navigation track.
88
85
  * @csspart content-section - The flex row holding container, aside and panel.
@@ -91,42 +88,32 @@ interface ShellGeometry {
91
88
  * @csspart aside - The aside region.
92
89
  * @csspart panel - The AI panel.
93
90
  * @csspart panel-header - The panel's header bar.
91
+ * @csspart panel-back - The panel's back control, shown by `panelBack`.
94
92
  * @csspart panel-title - The panel's title text.
95
93
  * @csspart panel-actions - The panel's header action group.
96
94
  * @csspart panel-close - The panel's close button.
97
95
  * @csspart panel-body - The panel's scroll region.
98
96
  * @csspart panel-footer - The panel's footer.
99
97
  *
100
- * @cssproperty [--nile-app-shell-side-nav-width=260px] - Expanded nav track.
101
- * @cssproperty [--nile-app-shell-side-nav-rail-width=64px] - Collapsed track.
102
- * @cssproperty [--nile-app-shell-side-nav-bg=transparent] - Surface behind a
103
- * slotted side nav. Transparent by default: the nav and the page share one
104
- * surface.
105
- * @cssproperty [--nile-app-shell-side-nav-border=0] - Edge on a slotted side
106
- * nav.
107
- * @cssproperty [--nile-app-shell-gutter=8px] - Content-section padding, and the
108
- * gap between container, aside and panel.
109
- * @cssproperty [--nile-app-shell-content-padding=24px] - Container inner
110
- * padding. The origin every top bar starts at.
111
- * @cssproperty [--nile-app-shell-top-bar-height=56px] - Top bar and panel
112
- * header height. Drops to 48px under 600px of viewport height.
113
- * @cssproperty [--nile-app-shell-tabs-height=48px] - Tab strip height.
114
- * @cssproperty [--nile-app-shell-panel-width=480px] - Docked panel width, and
115
- * the `min()` ceiling for the overlay drawer.
116
- * @cssproperty [--nile-app-shell-panel-min-width=360px] - How far a docked
117
- * panel shrinks to keep pushing rather than covering the page.
98
+ * @cssproperty [--nile-app-shell-side-nav-width=240px] - Expanded nav track.
99
+ * @cssproperty [--nile-app-shell-side-nav-rail-width=70px] - Collapsed track.
100
+ * @cssproperty [--nile-app-shell-side-nav-bg=transparent] - Surface behind a slotted side nav.
101
+ * @cssproperty [--nile-app-shell-side-nav-border=0] - Edge on a slotted side nav.
102
+ * @cssproperty [--nile-app-shell-gutter=4px] - Content-section padding, and the gap between container, aside and panel.
103
+ * @cssproperty [--nile-app-shell-content-padding=24px] - Container inner padding.
104
+ * @cssproperty [--nile-app-shell-top-bar-height=68px] - Top bar height.
105
+ * @cssproperty [--nile-app-shell-panel-header-height=56px] - The panel header's own height.
106
+ * @cssproperty [--nile-app-shell-tabs-height=33px] - Tab strip height.
107
+ * @cssproperty [--nile-app-shell-panel-width=480px] - Docked panel width, and the `min()` ceiling for the overlay drawer.
108
+ * @cssproperty [--nile-app-shell-panel-min-width=360px] - How far a docked panel shrinks to keep pushing rather than covering the page.
118
109
  * @cssproperty [--nile-app-shell-aside-width=320px] - Aside width.
119
- * @cssproperty [--nile-app-shell-aside-min-width=240px] - How far the aside
120
- * shrinks before the page is asked for room.
110
+ * @cssproperty [--nile-app-shell-aside-min-width=240px] - How far the aside shrinks before the page is asked for room.
121
111
  * @cssproperty [--nile-app-shell-content-min-width=640px] - Container floor.
122
- * @cssproperty [--nile-app-shell-min-width=768px] - Below this the window
123
- * scrolls rather than the shell compressing.
124
- * @cssproperty [--nile-app-shell-centered-width=824px] - Column width under
125
- * `content-align="centered"`.
126
- * @cssproperty [--nile-app-shell-utility-size=32px] - Height of the Ask
127
- * button. The toggle and close controls are nile-buttons and size themselves.
128
- * @cssproperty [--nile-app-shell-radius=16px] - Container, aside and panel
129
- * radius.
112
+ * @cssproperty [--nile-app-shell-min-width=768px] - Below this the window scrolls rather than the shell compressing.
113
+ * @cssproperty [--nile-app-shell-centered-width=824px] - Column width under `content-align="centered"`.
114
+ * @cssproperty [--nile-app-shell-app-icon-size=20px] - The leading app icon's box.
115
+ * @cssproperty [--nile-app-shell-utility-size=32px] - Box the shell's own icon controls sit in.
116
+ * @cssproperty [--nile-app-shell-radius=16px] - Container, aside and panel radius.
130
117
  * @cssproperty [--nile-app-shell-duration=250ms] - Track and panel motion.
131
118
  * @cssproperty [--nile-app-shell-ease] - Easing for moves and resizes.
132
119
  *
@@ -136,6 +123,10 @@ interface ShellGeometry {
136
123
  * @method expandNav() - Expand the side nav.
137
124
  * @method collapseNav() - Collapse the side nav to a rail.
138
125
  * @method toggleNav(force?) - Toggle, or force a specific collapsed state.
126
+ * @method goBackHeader() - Emit `nile-header-back`, as the header's back control does.
127
+ * @method goBackPanel() - Emit `nile-panel-back`, as the panel's back control does.
128
+ * @method goBackPage() - Deprecated alias of `goBackHeader()`.
129
+ * @method goBack() - Deprecated alias of `goBackPanel()`.
139
130
  */
140
131
  @customElement('nile-app-shell')
141
132
  export class NileAppShell extends NileElement {
@@ -143,10 +134,7 @@ export class NileAppShell extends NileElement {
143
134
  return [styles];
144
135
  }
145
136
 
146
- /**
147
- * The user's nav preference. The nav can still render as a rail while this is
148
- * false — see `navLocked`.
149
- */
137
+ /** The user's nav preference. The nav can still render as a rail while this is false — see `navLocked`. */
150
138
  @property({ type: Boolean, reflect: true, attribute: 'nav-collapsed' })
151
139
  navCollapsed: boolean = false;
152
140
 
@@ -154,10 +142,7 @@ export class NileAppShell extends NileElement {
154
142
  @property({ type: Boolean, reflect: true, attribute: 'panel-open' })
155
143
  panelOpen: boolean = false;
156
144
 
157
- /**
158
- * Unmounts the AI panel for this route even when the `panel` slot is filled.
159
- * `openPanel()` becomes a no-op.
160
- */
145
+ /** Unmounts the AI panel for this route even when the `panel` slot is filled; `openPanel()` becomes a no-op. */
161
146
  @property({ type: Boolean, reflect: true, attribute: 'no-panel' })
162
147
  noPanel: boolean = false;
163
148
 
@@ -165,6 +150,30 @@ export class NileAppShell extends NileElement {
165
150
  @property({ type: String, attribute: 'panel-label' })
166
151
  panelLabel: string = 'Ask Aquera';
167
152
 
153
+ /** The page title, rendered as the top bar's own heading (`role="heading"`, level from `headingLevel`) before anything slotted into `top-bar`; leave unset and no title block renders. */
154
+ @property({ type: String, attribute: true, reflect: true })
155
+ pageTitle?: string;
156
+
157
+ /** 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. */
158
+ @property({ type: Number, attribute: true, reflect: true })
159
+ headingLevel: number = 1;
160
+
161
+ /** A second line under the page title; a modifier on `pageTitle` that renders nothing with no title, and takes the bar to 76px. */
162
+ @property({ type: String, attribute: true, reflect: true })
163
+ description?: string;
164
+
165
+ /** A pill after the page title; a modifier on `pageTitle` like `description`, so with no title there is no badge. */
166
+ @property({ type: String, attribute: true, reflect: true })
167
+ badge?: string;
168
+
169
+ /** 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. */
170
+ @property({ type: String, attribute: true, reflect: true })
171
+ leading: NileAppShellLeading = 'none';
172
+
173
+ /** The previous-page label drawn by `leading="back"`. */
174
+ @property({ type: String, attribute: true, reflect: true })
175
+ backLabel: string = 'Back';
176
+
168
177
  /** Hides the built-in nav toggle. Mount `nile-app-shell-nav-toggle` yourself. */
169
178
  @property({ type: Boolean, reflect: true, attribute: 'no-nav-toggle' })
170
179
  noNavToggle: boolean = false;
@@ -189,13 +198,7 @@ export class NileAppShell extends NileElement {
189
198
  @property({ type: String, reflect: true, attribute: 'content-align' })
190
199
  contentAlign: NileAppShellContentAlign = 'fluid';
191
200
 
192
- /**
193
- * Makes the slotted page root a size query container, so page CSS can size
194
- * against the content container instead of the viewport. Query it unnamed —
195
- * `@container (min-width: 720px)` — because a container name declared inside
196
- * the shell's shadow tree is not visible to page CSS. Opt-in, because it
197
- * also applies layout containment to that element.
198
- */
201
+ /** Makes the slotted page root a size query container, so page CSS can size against the content container instead of the viewport. */
199
202
  @property({ type: Boolean, reflect: true, attribute: 'content-container' })
200
203
  contentContainer: boolean = false;
201
204
 
@@ -207,14 +210,7 @@ export class NileAppShell extends NileElement {
207
210
  @property({ type: Boolean, reflect: true, attribute: 'no-padding' })
208
211
  noPadding: boolean = false;
209
212
 
210
- /**
211
- * The label on the built-in Ask button.
212
- *
213
- * The button is the shell's, not the app's: it is the one control that has
214
- * to know whether a panel is mounted for this route and how to open it, and
215
- * slotted content can see neither. Everything else in the bar — the
216
- * breadcrumb, the page actions, the tab strip — is slotted markup.
217
- */
213
+ /** The label on the built-in Ask button. */
218
214
  @property({ type: String, attribute: 'ask-label' })
219
215
  askLabel: string = 'Ask';
220
216
 
@@ -222,36 +218,31 @@ export class NileAppShell extends NileElement {
222
218
  @property({ type: Boolean, reflect: true, attribute: 'no-ask' })
223
219
  noAsk: boolean = false;
224
220
 
221
+ /** Shows a back control at the start of the panel header for a panel sub-view; emits `nile-panel-back`. */
222
+ @property({ type: Boolean, reflect: true })
223
+ panelBack: boolean = false;
224
+
225
+ /** Accessible name of the panel's back control. */
226
+ @property({ type: String })
227
+ panelBackLabel: string = 'Back';
228
+
229
+ /** Hides the tab strip for this route even when the `tabs` slot is filled. */
230
+ @property({ type: Boolean, reflect: true })
231
+ noTabs: boolean = false;
232
+
225
233
  /** Sizes the shell to the viewport instead of its parent. */
226
234
  @property({ type: Boolean, reflect: true, attribute: 'full-height' })
227
235
  fullHeight: boolean = false;
228
236
 
229
- /**
230
- * Below this shell width the panel overlays the content instead of pushing
231
- * it, and the nav is forced to a rail.
232
- *
233
- * Zero — the default — means never: the panel is furniture that squeezes the
234
- * page, at every width. It earns its room from the nav rail first and from
235
- * its own width next (see `--nile-app-shell-panel-min-width`), so it does
236
- * not have to cover the page to fit. Set a width here to opt back into an
237
- * overlay drawer below it.
238
- */
237
+ /** 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. */
239
238
  @property({ type: Number, attribute: 'overlay-breakpoint' })
240
239
  overlayBreakpoint: number = 0;
241
240
 
242
- /**
243
- * Below this shell width an open docked panel forces the nav to a rail.
244
- * A floor, not the whole rule: the nav also rails as soon as the expanded
245
- * track is what stops the row from fitting. This is the first thing the
246
- * panel takes room from, so it can push rather than cover.
247
- */
241
+ /** Below this shell width an open docked panel forces the nav to a rail. */
248
242
  @property({ type: Number, attribute: 'docked-rail-breakpoint' })
249
243
  dockedRailBreakpoint: number = 1440;
250
244
 
251
- /**
252
- * Persists the nav preference and the docked panel state under this key.
253
- * Overlay panel state is never persisted — a reload opens closed.
254
- */
245
+ /** Persists the nav preference and docked panel state under this key. Overlay panel state is never persisted. */
255
246
  @property({ type: String, attribute: 'persist-key' })
256
247
  persistKey?: string;
257
248
 
@@ -269,12 +260,7 @@ export class NileAppShell extends NileElement {
269
260
  @state() private _hasPanel: boolean = false;
270
261
  @state() private _hasPanelFooter: boolean = false;
271
262
 
272
- /**
273
- * True when a `nile-app-shell-panel` is slotted. That component owns the
274
- * panel's heading, actions, close button and footer, so the shell renders a
275
- * bare region and keeps only the geometry and the open state — the same
276
- * hand-off as `no-nav-toggle` plus `nile-app-shell-nav-toggle`.
277
- */
263
+ /** True when a `nile-app-shell-panel` is slotted, owning the panel's own chrome so the shell renders a bare region. */
278
264
  @state() private _panelOwnsChrome: boolean = false;
279
265
  @state() private _hasAside: boolean = false;
280
266
 
@@ -299,6 +285,11 @@ export class NileAppShell extends NileElement {
299
285
  return this._hasPanel && !this.noPanel;
300
286
  }
301
287
 
288
+ /** Whether the tab strip is rendered: something slotted, and not switched off. */
289
+ public get tabsVisible(): boolean {
290
+ return this._hasTabs && !this.noTabs;
291
+ }
292
+
302
293
  /** Whether the built-in Ask button is rendered. */
303
294
  public get askVisible(): boolean {
304
295
  return this.panelAvailable && !this.noAsk;
@@ -333,8 +324,7 @@ export class NileAppShell extends NileElement {
333
324
  changed.has('noPanel') ||
334
325
  changed.has('overlayBreakpoint') ||
335
326
  changed.has('dockedRailBreakpoint') ||
336
- // Mounting an aside changes what a docked panel has to fit beside.
337
- // Private state is outside `keyof this`, so ask the map directly.
327
+ // Aside/side-nav mounting changes what a docked panel fits beside; ask the map since private state is outside `keyof this`.
338
328
  (changed as Map<string, unknown>).has('_hasAside') ||
339
329
  (changed as Map<string, unknown>).has('_hasSideNav')
340
330
  ) {
@@ -352,11 +342,18 @@ export class NileAppShell extends NileElement {
352
342
  this.toggleAttribute('has-side-nav', this._hasSideNav);
353
343
  this.toggleAttribute(
354
344
  'has-top-bar',
355
- this._hasTopBar || (!this.noNavToggle && this._hasSideNav)
345
+ this._hasTopBar ||
346
+ this._hasTitleBlock ||
347
+ (!this.noNavToggle && this._hasSideNav)
348
+ );
349
+ // Only with a title to sit under: see _hasTitleBlock.
350
+ this.toggleAttribute(
351
+ 'has-description',
352
+ !!this.description && !!this.pageTitle
356
353
  );
357
354
  this.toggleAttribute('has-top-bar-actions', this._hasTopBarActions);
358
355
  this.toggleAttribute('has-ask', this.askVisible);
359
- this.toggleAttribute('has-tabs', this._hasTabs);
356
+ this.toggleAttribute('has-tabs', this.tabsVisible);
360
357
  this.toggleAttribute('has-aside', this._hasAside);
361
358
  this.toggleAttribute('has-panel', this.panelAvailable);
362
359
  this.toggleAttribute('has-panel-footer', this._hasPanelFooter);
@@ -380,17 +377,33 @@ export class NileAppShell extends NileElement {
380
377
  this._setPanelOpen(false);
381
378
  }
382
379
 
383
- /**
384
- * Toggle the panel, or force a state. Call `openPanel()` from a page action —
385
- * a page action that toggles closes the panel for a user who already had it
386
- * open.
387
- */
380
+ /** Toggle the panel, or force a state. */
388
381
  public togglePanel(force?: boolean): void {
389
382
  const next = force ?? !this.panelOpen;
390
383
  if (next) this.openPanel();
391
384
  else this.closePanel();
392
385
  }
393
386
 
387
+ /** Emit `nile-header-back`, as the header's back control does; the page owns the history. */
388
+ public goBackHeader(): void {
389
+ this.emit('nile-header-back');
390
+ }
391
+
392
+ /** Emit `nile-panel-back`, as the panel's back control does; the page owns the view stack. */
393
+ public goBackPanel(): void {
394
+ this.emit('nile-panel-back');
395
+ }
396
+
397
+ /** @deprecated Use `goBackHeader()`; kept as an alias that emits `nile-header-back`. */
398
+ public goBackPage(): void {
399
+ this.goBackHeader();
400
+ }
401
+
402
+ /** @deprecated Use `goBackPanel()`; kept as an alias that emits `nile-panel-back`. */
403
+ public goBack(): void {
404
+ this.goBackPanel();
405
+ }
406
+
394
407
  /** Expand the side nav. */
395
408
  public expandNav(): void {
396
409
  this._setNavCollapsed(false);
@@ -443,11 +456,7 @@ export class NileAppShell extends NileElement {
443
456
  }
444
457
  }
445
458
 
446
- /**
447
- * The shell's geometry, read off its own custom properties so a consumer's
448
- * overrides are part of the sum. Falls back to the stylesheet's defaults
449
- * before the element has a computed style.
450
- */
459
+ /** The shell's geometry, read off its own custom properties, falling back to defaults before a computed style exists. */
451
460
  private _geometry(): ShellGeometry {
452
461
  const style = getComputedStyle(this);
453
462
  const px = (name: string, fallback: number): number => {
@@ -455,51 +464,35 @@ export class NileAppShell extends NileElement {
455
464
  return Number.isFinite(value) ? value : fallback;
456
465
  };
457
466
  return {
458
- nav: px('--nile-app-shell-side-nav-width', 260),
459
- rail: px('--nile-app-shell-side-nav-rail-width', 64),
460
- gutter: px('--nile-app-shell-gutter', 8),
467
+ // Read the substituted value so they follow the active theme; the literals are the enterprise fallback.
468
+ nav: px('--nile-app-shell-side-nav-width', 240),
469
+ rail: px('--nile-app-shell-side-nav-rail-width', 70),
470
+ gutter: px('--nile-app-shell-gutter', 4),
461
471
  content: px('--nile-app-shell-content-min-width', 640),
462
472
  aside: px('--nile-app-shell-aside-width', 320),
463
473
  panel: px('--nile-app-shell-panel-width', 480),
464
474
  };
465
475
  }
466
476
 
467
- /**
468
- * The shell width a docked panel needs to sit beside the content floor, over
469
- * a side-nav `track` wide.
470
- *
471
- * A fixed breakpoint cannot answer this: what shares the row changes per
472
- * route. An aside alone adds 328px, so a shell wide enough to hold the
473
- * expanded nav beside a docked panel on one route is 328px short on the
474
- * next. Summing what is actually mounted rails the nav exactly when the
475
- * track is what the row cannot afford.
476
- */
477
+ /** The shell width a docked panel needs to sit beside the content floor, over a side-nav `track` wide. */
477
478
  private _dockRequirement(geo: ShellGeometry, track: number): number {
478
479
  const nav = this._hasSideNav ? track : 0;
479
480
  const aside = this._hasAside ? geo.aside + geo.gutter : 0;
480
- // Two gutters of padding on the content column, one between container and
481
- // panel; the aside carries its own gutter above.
482
- return nav + geo.content + aside + geo.panel + geo.gutter * 3;
481
+ /* 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. */
482
+ const gutters = this._hasSideNav ? 2 : 3;
483
+ return nav + geo.content + aside + geo.panel + geo.gutter * gutters;
483
484
  }
484
485
 
485
486
  private _recompute(): void {
486
487
  const width = this._width;
487
488
  const geo = this._geometry();
488
489
 
489
- /*
490
- * Overlay is opt-in and nothing derives it: a panel that covers the page
491
- * hides the thing the user is asking about. Running out of room is not a
492
- * reason to switch — the rail and the panel's own min width absorb that —
493
- * so the shell only overlays below a width the author names.
494
- */
490
+ /* Overlay is opt-in: the shell only overlays below a width the author names, never from running out of room. */
495
491
  const overlay =
496
492
  this.overlayBreakpoint > 0 && width > 0 && width < this.overlayBreakpoint;
497
493
  const mode: NileAppShellPanelMode = overlay ? 'overlay' : 'docked';
498
494
 
499
- // A docked panel squeezes the container, so a narrow shell trades the
500
- // expanded nav for content width before the page gives any up. Measured
501
- // against the expanded track: the nav rails exactly when it is the track
502
- // that stops the row from fitting.
495
+ // A docked panel squeezes the container, so a narrow shell trades the expanded nav for content width, measured against the expanded track.
503
496
  const railAt = Math.max(
504
497
  this.dockedRailBreakpoint,
505
498
  this._dockRequirement(geo, geo.nav)
@@ -646,7 +639,7 @@ export class NileAppShell extends NileElement {
646
639
  return html`
647
640
  <div class="nav-toggle-group">
648
641
  <nile-button
649
- class="nav-toggle"
642
+ class="nav-toggle utility-control"
650
643
  part="nav-toggle"
651
644
  variant="ghost"
652
645
  circle
@@ -662,12 +655,98 @@ export class NileAppShell extends NileElement {
662
655
  @click=${() => this.toggleNav()}
663
656
  >
664
657
  ${renderGlyph(
665
- expanded ? 'ng-panel-left-close' : 'ng-panel-left-open',
666
- 24,
658
+ expanded ? 'ng-panel-left' : 'ng-panel-right',
659
+ 20,
667
660
  'currentColor'
668
661
  )}
669
662
  </nile-button>
670
- ${this._hasTopBar ? html`<span class="rule" part="rule"></span>` : ''}
663
+ ${this._hasTopBar || this._hasTitleBlock
664
+ ? html`<span class="rule" part="rule"></span>`
665
+ : ''}
666
+ </div>
667
+ `;
668
+ }
669
+
670
+ /** Whether the header has a title block of its own to draw: only a title or a leading control mounts it. */
671
+ private get _hasTitleBlock(): boolean {
672
+ return !!this.pageTitle || this._hasLeading;
673
+ }
674
+
675
+ /** Whether `leading` names a control that renders; an empty or unknown value draws nothing, like `none`. */
676
+ private get _hasLeading(): boolean {
677
+ return this.leading === 'back' || this.leading === 'app-icon';
678
+ }
679
+
680
+ /** `headingLevel` as a safe `aria-level`: a whole number clamped to 1–6, and 1 for anything non-numeric. */
681
+ private get _headingLevel(): number {
682
+ const level = Math.trunc(Number(this.headingLevel));
683
+ return Number.isFinite(level) ? Math.min(6, Math.max(1, level)) : 1;
684
+ }
685
+
686
+ private _renderLeading(): TemplateResult | string {
687
+ if (this.leading === 'app-icon') {
688
+ return html`
689
+ <span class="app-icon" part="app-icon">
690
+ <slot name="app-icon"></slot>
691
+ </span>
692
+ `;
693
+ }
694
+
695
+ if (this.leading === 'back') {
696
+ return html`
697
+ <button
698
+ class="back"
699
+ part="back"
700
+ type="button"
701
+ @click=${() => this.goBackHeader()}
702
+ >
703
+ ${renderGlyph('ng-chevron-left', 20, 'currentColor')}
704
+ <span>${this.backLabel}</span>
705
+ </button>
706
+ ${this.pageTitle
707
+ ? html`<span class="crumb-divider" aria-hidden="true">
708
+ ${renderGlyph('ng-slash', 16, 'currentColor')}
709
+ </span>`
710
+ : ''}
711
+ `;
712
+ }
713
+
714
+ return '';
715
+ }
716
+
717
+ private _renderTitleBlock(): TemplateResult | string {
718
+ if (!this._hasTitleBlock) return '';
719
+
720
+ /* 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. */
721
+ return html`
722
+ <div class="title-area" part="title-area">
723
+ ${this._hasLeading
724
+ ? html`<span class="leading" part="leading"
725
+ >${this._renderLeading()}</span
726
+ >`
727
+ : ''}
728
+ ${this.pageTitle
729
+ ? html`
730
+ <div class="title-stack">
731
+ <div class="title-row">
732
+ <div
733
+ class="page-title"
734
+ part="page-title"
735
+ role="heading"
736
+ aria-level=${this._headingLevel}
737
+ >${this.pageTitle}</div>
738
+ ${this.badge
739
+ ? html`<span class="badge" part="badge">${this.badge}</span>`
740
+ : ''}
741
+ </div>
742
+ ${this.description
743
+ ? html`<p class="description" part="description">
744
+ ${this.description}
745
+ </p>`
746
+ : ''}
747
+ </div>
748
+ `
749
+ : ''}
671
750
  </div>
672
751
  `;
673
752
  }
@@ -682,6 +761,7 @@ export class NileAppShell extends NileElement {
682
761
  >
683
762
  ${this._renderNavToggle()}
684
763
  <div class="top-bar-content">
764
+ ${this._renderTitleBlock()}
685
765
  <slot
686
766
  name="top-bar"
687
767
  @slotchange=${(e: Event) => this._onSlotChange('top-bar', e)}
@@ -784,6 +864,19 @@ export class NileAppShell extends NileElement {
784
864
  ></slot>`
785
865
  : html`
786
866
  <header class="panel-header" part="panel-header">
867
+ ${this.panelBack
868
+ ? html`<nile-button
869
+ class="panel-back utility-control"
870
+ part="panel-back"
871
+ variant="ghost"
872
+ circle
873
+ title=${this.panelBackLabel}
874
+ aria-label=${this.panelBackLabel}
875
+ @click=${() => this.goBackPanel()}
876
+ >
877
+ ${renderGlyph('ng-arrow-left', 20, 'currentColor')}
878
+ </nile-button>`
879
+ : ''}
787
880
  <slot name="panel-header">
788
881
  <span class="panel-heading">
789
882
  <span class="panel-mark">
@@ -797,7 +890,7 @@ export class NileAppShell extends NileElement {
797
890
  <div class="panel-actions" part="panel-actions">
798
891
  <slot name="panel-actions"></slot>
799
892
  <nile-button
800
- class="panel-close"
893
+ class="panel-close utility-control"
801
894
  part="panel-close"
802
895
  variant="ghost"
803
896
  circle
@@ -805,7 +898,7 @@ export class NileAppShell extends NileElement {
805
898
  aria-label="Close ${this.panelLabel}"
806
899
  @click=${() => this.closePanel()}
807
900
  >
808
- ${renderGlyph('ng-x-close', 24, 'currentColor')}
901
+ ${renderGlyph('ng-x-close', 20, 'currentColor')}
809
902
  </nile-button>
810
903
  </div>
811
904
  </header>
@@ -15,14 +15,7 @@ const SHELL_EVENTS = [
15
15
  'nile-panel-mode-change',
16
16
  ];
17
17
 
18
- /**
19
- * A reactive controller that links a region component to its shell.
20
- *
21
- * Region components sit in the shell's light DOM, so the shell is just an
22
- * ancestor — `closest()` finds it. The shell may upgrade after its children do,
23
- * so the lookup is deferred to a microtask and retried on demand. While linked,
24
- * the host re-renders whenever the shell's nav or panel state changes.
25
- */
18
+ /** A reactive controller that links a region component to its shell, re-rendering the host when the shell's nav or panel state changes. */
26
19
  export class AppShellController implements ReactiveController {
27
20
  host: ReactiveControllerHost & HTMLElement;
28
21
 
@@ -62,12 +55,7 @@ export class AppShellController implements ReactiveController {
62
55
  SHELL_EVENTS.forEach(name =>
63
56
  found.addEventListener(name, this.handleShellChange)
64
57
  );
65
- /*
66
- * Not every state a region renders from has an event. Panel availability
67
- * flips when the panel slot fills, which emits nothing — a header would
68
- * render its Ask button hidden and never re-render. The shell reflects that
69
- * state onto itself, so watching its attributes covers the whole surface.
70
- */
58
+ /* Not every state a region renders from has an event, so watch the shell's reflected attributes to cover the whole surface. */
71
59
  this.observer = new MutationObserver(this.handleShellChange);
72
60
  this.observer.observe(found, { attributes: true });
73
61
  return true;
@@ -11,9 +11,7 @@ import { styles } from './nile-app-shell-main.css';
11
11
  import NileElement from '../internal/nile-element';
12
12
 
13
13
  /**
14
- * @summary The shell's centre region — the page body. Goes in the shell's
15
- * default slot and declares the size query container that page CSS sizes
16
- * against, which the shell itself cannot do across its shadow boundary.
14
+ * @summary The shell's centre region — the page body; declares the size query container that page CSS sizes against.
17
15
  *
18
16
  * @status stable
19
17
  * @since 2.0
@@ -24,9 +22,7 @@ import NileElement from '../internal/nile-element';
24
22
  *
25
23
  * @slot - The page body.
26
24
  *
27
- * @attr no-container - Drops the query container. Size containment makes this a
28
- * containing block for absolutely and fixed-positioned descendants; set this
29
- * when page content needs to escape to the viewport instead.
25
+ * @attr no-container - Drops the query container, so page content can escape to the viewport.
30
26
  */
31
27
  @customElement('nile-app-shell-main')
32
28
  export class NileAppShellMain extends NileElement {