@aquera/nile-elements 2.0.4 → 2.0.6
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 +9 -0
- package/demo/nxtgen-classes.css +609 -12
- package/demo/nxtgen-dark.css +254 -35
- package/demo/nxtgen-properties.css +27 -24
- package/demo/nxtgen-utilities.css +633 -36
- package/demo/nxtgen.css +70 -12
- package/demo/utilities.css +3 -0
- package/demo/variables.css +3 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1375 -358
- package/dist/internal/glyph.cjs.js +1 -1
- package/dist/internal/glyph.cjs.js.map +1 -1
- package/dist/internal/glyph.esm.js +6 -5
- package/dist/nile-app-shell/index.cjs.js +2 -0
- package/dist/nile-app-shell/index.cjs.js.map +1 -0
- package/dist/nile-app-shell/index.esm.js +1 -0
- package/dist/nile-app-shell/nile-app-shell.cjs.js +2 -0
- package/dist/nile-app-shell/nile-app-shell.cjs.js.map +1 -0
- package/dist/nile-app-shell/nile-app-shell.css.cjs.js +2 -0
- package/dist/nile-app-shell/nile-app-shell.css.cjs.js.map +1 -0
- package/dist/nile-app-shell/nile-app-shell.css.esm.js +554 -0
- package/dist/nile-app-shell/nile-app-shell.esm.js +155 -0
- package/dist/nile-app-shell/shell-controller.cjs.js +2 -0
- package/dist/nile-app-shell/shell-controller.cjs.js.map +1 -0
- package/dist/nile-app-shell/shell-controller.esm.js +1 -0
- package/dist/nile-app-shell-main/index.cjs.js +2 -0
- package/dist/nile-app-shell-main/index.cjs.js.map +1 -0
- package/dist/nile-app-shell-main/index.esm.js +1 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.cjs.js +2 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.cjs.js.map +1 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.css.cjs.js +2 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.css.cjs.js.map +1 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.css.esm.js +18 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.esm.js +1 -0
- package/dist/nile-app-shell-nav-toggle/index.cjs.js +2 -0
- package/dist/nile-app-shell-nav-toggle/index.cjs.js.map +1 -0
- package/dist/nile-app-shell-nav-toggle/index.esm.js +1 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.cjs.js +2 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.cjs.js.map +1 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.cjs.js +2 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.cjs.js.map +1 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.esm.js +29 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.esm.js +16 -0
- package/dist/nile-app-shell-panel/index.cjs.js +2 -0
- package/dist/nile-app-shell-panel/index.cjs.js.map +1 -0
- package/dist/nile-app-shell-panel/index.esm.js +1 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.cjs.js +2 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.cjs.js.map +1 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.css.cjs.js +2 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.css.cjs.js.map +1 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.css.esm.js +103 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.esm.js +33 -0
- package/dist/nile-app-shell-side-nav/index.cjs.js +2 -0
- package/dist/nile-app-shell-side-nav/index.cjs.js.map +1 -0
- package/dist/nile-app-shell-side-nav/index.esm.js +1 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.cjs.js +2 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.cjs.js.map +1 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.css.cjs.js +2 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.css.cjs.js.map +1 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.css.esm.js +55 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.esm.js +5 -0
- package/dist/nile-combobox/nile-combobox.cjs.js +1 -1
- package/dist/nile-combobox/nile-combobox.cjs.js.map +1 -1
- package/dist/nile-combobox/nile-combobox.css.cjs.js +1 -1
- package/dist/nile-combobox/nile-combobox.css.cjs.js.map +1 -1
- package/dist/nile-combobox/nile-combobox.css.esm.js +28 -15
- package/dist/nile-combobox/nile-combobox.esm.js +11 -8
- package/dist/nile-combobox/portal-manager.cjs.js +1 -1
- package/dist/nile-combobox/portal-manager.cjs.js.map +1 -1
- package/dist/nile-combobox/portal-manager.esm.js +1 -1
- package/dist/nile-combobox/renderer.cjs.js +1 -1
- package/dist/nile-combobox/renderer.cjs.js.map +1 -1
- package/dist/nile-combobox/renderer.esm.js +31 -43
- package/dist/nile-floating-panel/nile-floating-panel.cjs.js +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.cjs.js.map +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.css.cjs.js +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.css.cjs.js.map +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.css.esm.js +46 -8
- package/dist/nile-floating-panel/nile-floating-panel.esm.js +1 -1
- package/dist/nile-popover/nile-popover.cjs.js +1 -1
- package/dist/nile-popover/nile-popover.cjs.js.map +1 -1
- package/dist/nile-popover/nile-popover.css.cjs.js +1 -1
- package/dist/nile-popover/nile-popover.css.cjs.js.map +1 -1
- package/dist/nile-popover/nile-popover.css.esm.js +32 -17
- package/dist/nile-popover/nile-popover.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.esm.js +2 -2
- package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-menu.esm.js +4 -4
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-menu.esm.js +1 -1
- package/dist/src/index.d.ts +7 -2
- package/dist/src/index.js +6 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal/glyph.d.ts +6 -1
- package/dist/src/internal/glyph.js +8 -1
- package/dist/src/internal/glyph.js.map +1 -1
- package/dist/src/nile-app-shell/index.d.ts +7 -0
- package/dist/src/nile-app-shell/index.js +8 -0
- package/dist/src/nile-app-shell/index.js.map +1 -0
- package/dist/src/nile-app-shell/nile-app-shell-regions.test.d.ts +4 -0
- package/dist/src/nile-app-shell/nile-app-shell-regions.test.js +177 -0
- package/dist/src/nile-app-shell/nile-app-shell-regions.test.js.map +1 -0
- package/dist/src/nile-app-shell/nile-app-shell.css.d.ts +18 -0
- package/dist/src/nile-app-shell/nile-app-shell.css.js +572 -0
- package/dist/src/nile-app-shell/nile-app-shell.css.js.map +1 -0
- package/dist/src/nile-app-shell/nile-app-shell.d.ts +292 -0
- package/dist/src/nile-app-shell/nile-app-shell.js +796 -0
- package/dist/src/nile-app-shell/nile-app-shell.js.map +1 -0
- 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 +454 -0
- package/dist/src/nile-app-shell/nile-app-shell.test.js.map +1 -0
- package/dist/src/nile-app-shell/shell-controller.d.ts +34 -0
- package/dist/src/nile-app-shell/shell-controller.js +80 -0
- package/dist/src/nile-app-shell/shell-controller.js.map +1 -0
- package/dist/src/nile-app-shell-main/index.d.ts +7 -0
- package/dist/src/nile-app-shell-main/index.js +8 -0
- package/dist/src/nile-app-shell-main/index.js.map +1 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.css.d.ts +9 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.css.js +27 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.css.js.map +1 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.d.ts +38 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.js +51 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.js.map +1 -0
- package/dist/src/nile-app-shell-nav-toggle/index.d.ts +7 -0
- package/dist/src/nile-app-shell-nav-toggle/index.js +8 -0
- package/dist/src/nile-app-shell-nav-toggle/index.js.map +1 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.d.ts +13 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.js +42 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.js.map +1 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.d.ts +56 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.js +126 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.js.map +1 -0
- package/dist/src/nile-app-shell-panel/index.d.ts +7 -0
- package/dist/src/nile-app-shell-panel/index.js +8 -0
- package/dist/src/nile-app-shell-panel/index.js.map +1 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.d.ts +9 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.js +112 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.js.map +1 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.d.ts +73 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.js +158 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.js.map +1 -0
- package/dist/src/nile-app-shell-side-nav/index.d.ts +7 -0
- package/dist/src/nile-app-shell-side-nav/index.js +8 -0
- package/dist/src/nile-app-shell-side-nav/index.js.map +1 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.d.ts +13 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.js +68 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.js.map +1 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.d.ts +54 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.js +83 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.js.map +1 -0
- package/dist/src/nile-combobox/nile-combobox.css.js +28 -15
- package/dist/src/nile-combobox/nile-combobox.css.js.map +1 -1
- package/dist/src/nile-combobox/nile-combobox.js +49 -10
- package/dist/src/nile-combobox/nile-combobox.js.map +1 -1
- package/dist/src/nile-combobox/portal-manager.js +2 -22
- package/dist/src/nile-combobox/portal-manager.js.map +1 -1
- package/dist/src/nile-combobox/renderer.d.ts +2 -3
- package/dist/src/nile-combobox/renderer.js +14 -45
- package/dist/src/nile-combobox/renderer.js.map +1 -1
- package/dist/src/nile-floating-panel/nile-floating-panel.css.js +46 -8
- package/dist/src/nile-floating-panel/nile-floating-panel.css.js.map +1 -1
- package/dist/src/nile-floating-panel/nile-floating-panel.js +13 -1
- package/dist/src/nile-floating-panel/nile-floating-panel.js.map +1 -1
- package/dist/src/nile-popover/nile-popover.css.js +30 -15
- package/dist/src/nile-popover/nile-popover.css.js.map +1 -1
- package/dist/src/nile-popover/nile-popover.js +1 -1
- package/dist/src/nile-popover/nile-popover.js.map +1 -1
- package/dist/src/nile-popover/nile-popover.test.js +1 -1
- package/dist/src/nile-popover/nile-popover.test.js.map +1 -1
- package/dist/src/version.d.ts +11 -1
- package/dist/src/version.js +56 -5
- 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 +8 -2
- package/scripts/replace-version.cjs +12 -10
- package/src/index.ts +16 -4
- package/src/internal/glyph.ts +12 -1
- package/src/nile-app-shell/index.ts +8 -0
- package/src/nile-app-shell/nile-app-shell-regions.test.ts +215 -0
- package/src/nile-app-shell/nile-app-shell.css.ts +574 -0
- package/src/nile-app-shell/nile-app-shell.test.ts +536 -0
- package/src/nile-app-shell/nile-app-shell.ts +838 -0
- package/src/nile-app-shell/shell-controller.ts +100 -0
- package/src/nile-app-shell-main/index.ts +8 -0
- package/src/nile-app-shell-main/nile-app-shell-main.css.ts +29 -0
- package/src/nile-app-shell-main/nile-app-shell-main.ts +52 -0
- package/src/nile-app-shell-nav-toggle/index.ts +8 -0
- package/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.ts +44 -0
- package/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.ts +138 -0
- package/src/nile-app-shell-panel/index.ts +8 -0
- package/src/nile-app-shell-panel/nile-app-shell-panel.css.ts +114 -0
- package/src/nile-app-shell-panel/nile-app-shell-panel.ts +161 -0
- package/src/nile-app-shell-side-nav/index.ts +8 -0
- package/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.ts +70 -0
- package/src/nile-app-shell-side-nav/nile-app-shell-side-nav.ts +86 -0
- package/src/nile-combobox/nile-combobox.css.ts +28 -15
- package/src/nile-combobox/nile-combobox.ts +61 -12
- package/src/nile-combobox/portal-manager.ts +4 -22
- package/src/nile-combobox/renderer.ts +26 -69
- package/src/nile-floating-panel/nile-floating-panel.css.ts +46 -8
- package/src/nile-floating-panel/nile-floating-panel.ts +19 -1
- package/src/nile-popover/nile-popover.css.ts +30 -15
- package/src/nile-popover/nile-popover.test.ts +1 -1
- package/src/nile-popover/nile-popover.ts +1 -1
- package/src/version.ts +61 -4
- package/vscode-html-custom-data.json +216 -5
|
@@ -0,0 +1,796 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Aquera Inc 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { __decorate } from "tslib";
|
|
8
|
+
import { html } from 'lit';
|
|
9
|
+
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
10
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
11
|
+
import { styles } from './nile-app-shell.css';
|
|
12
|
+
import { renderGlyph } from '../internal/glyph';
|
|
13
|
+
import NileElement from '../internal/nile-element';
|
|
14
|
+
import '../nile-button/nile-button';
|
|
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.
|
|
19
|
+
*
|
|
20
|
+
* @status stable
|
|
21
|
+
* @since 2.0
|
|
22
|
+
*
|
|
23
|
+
* @tag nile-app-shell
|
|
24
|
+
*
|
|
25
|
+
* @dependency nile-button
|
|
26
|
+
* @dependency nile-glyph
|
|
27
|
+
*
|
|
28
|
+
* @slot - The page body, inside the content container.
|
|
29
|
+
* @slot banner - A full-width strip above every other region.
|
|
30
|
+
* @slot top-bar - The page-title bar. Mounted inside the container by default,
|
|
31
|
+
* or spanning the shell when `top-bar-placement="shell"`. The nav toggle is
|
|
32
|
+
* rendered before whatever is slotted here.
|
|
33
|
+
* @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
|
+
* outside `<main>`'s scroller, so it never scrolls away. The region carries
|
|
36
|
+
* the strip's height, padding and rule, so slot a `<nile-tab-group>` or the
|
|
37
|
+
* tab controls themselves.
|
|
38
|
+
* @slot side-nav - The navigation track. Works best with `<nile-side-bar>`.
|
|
39
|
+
* @slot aside - A secondary column between the content container and the panel.
|
|
40
|
+
* @slot panel - The AI panel's body. When nothing is slotted here the panel is
|
|
41
|
+
* unmounted and `openPanel()` is a no-op.
|
|
42
|
+
* @slot panel-header - Replaces the default panel heading (mark plus title).
|
|
43
|
+
* @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.
|
|
46
|
+
*
|
|
47
|
+
* @event nile-nav-toggle - Emitted after the nav's collapsed state or its
|
|
48
|
+
* forced-rail lock changes. `detail: { collapsed, locked }`.
|
|
49
|
+
* @event nile-panel-toggle - Emitted after the panel opens or closes.
|
|
50
|
+
* `detail: { open, mode }`.
|
|
51
|
+
* @event nile-panel-mode-change - Emitted when the panel flips between docked
|
|
52
|
+
* and overlay. `detail: { mode }`.
|
|
53
|
+
*
|
|
54
|
+
* @csspart skip-link - The skip-to-content link.
|
|
55
|
+
* @csspart banner - The banner region.
|
|
56
|
+
* @csspart shell-top-bar - The top bar when it spans the shell.
|
|
57
|
+
* @csspart top-bar - The top bar, in either placement.
|
|
58
|
+
* @csspart nav-toggle - The built-in nav toggle button.
|
|
59
|
+
* @csspart rule - The vertical rule after the nav toggle.
|
|
60
|
+
* @csspart top-bar-actions - The end-aligned top bar action group. Unmounted
|
|
61
|
+
* when it holds neither slotted actions nor the Ask button, so it reserves
|
|
62
|
+
* no gap.
|
|
63
|
+
* @csspart ask - The built-in Ask button, the shell's single door to the panel.
|
|
64
|
+
* A `<nile-button>`; its inner surface and label are exported as
|
|
65
|
+
* `ask__base` and `ask__label`.
|
|
66
|
+
* @csspart tabs - The hoisted tab-strip region, under the top bar.
|
|
67
|
+
* @csspart side-nav - The navigation track.
|
|
68
|
+
* @csspart content-section - The flex row holding container, aside and panel.
|
|
69
|
+
* @csspart container - The content container.
|
|
70
|
+
* @csspart main - The scrolling page body.
|
|
71
|
+
* @csspart aside - The aside region.
|
|
72
|
+
* @csspart panel - The AI panel.
|
|
73
|
+
* @csspart panel-header - The panel's header bar.
|
|
74
|
+
* @csspart panel-title - The panel's title text.
|
|
75
|
+
* @csspart panel-actions - The panel's header action group.
|
|
76
|
+
* @csspart panel-close - The panel's close button.
|
|
77
|
+
* @csspart panel-body - The panel's scroll region.
|
|
78
|
+
* @csspart panel-footer - The panel's footer.
|
|
79
|
+
*
|
|
80
|
+
* @cssproperty [--nile-app-shell-side-nav-width=260px] - Expanded nav track.
|
|
81
|
+
* @cssproperty [--nile-app-shell-side-nav-rail-width=64px] - Collapsed track.
|
|
82
|
+
* @cssproperty [--nile-app-shell-side-nav-bg=transparent] - Surface behind a
|
|
83
|
+
* slotted side nav. Transparent by default: the nav and the page share one
|
|
84
|
+
* surface.
|
|
85
|
+
* @cssproperty [--nile-app-shell-side-nav-border=0] - Edge on a slotted side
|
|
86
|
+
* nav.
|
|
87
|
+
* @cssproperty [--nile-app-shell-gutter=8px] - Content-section padding, and the
|
|
88
|
+
* gap between container, aside and panel.
|
|
89
|
+
* @cssproperty [--nile-app-shell-content-padding=24px] - Container inner
|
|
90
|
+
* padding. The origin every top bar starts at.
|
|
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.
|
|
98
|
+
* @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.
|
|
101
|
+
* @cssproperty [--nile-app-shell-content-min-width=640px] - Container floor.
|
|
102
|
+
* @cssproperty [--nile-app-shell-min-width=768px] - Below this the window
|
|
103
|
+
* scrolls rather than the shell compressing.
|
|
104
|
+
* @cssproperty [--nile-app-shell-centered-width=824px] - Column width under
|
|
105
|
+
* `content-align="centered"`.
|
|
106
|
+
* @cssproperty [--nile-app-shell-utility-size=32px] - Height of the Ask
|
|
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.
|
|
110
|
+
* @cssproperty [--nile-app-shell-duration=250ms] - Track and panel motion.
|
|
111
|
+
* @cssproperty [--nile-app-shell-ease] - Easing for moves and resizes.
|
|
112
|
+
*
|
|
113
|
+
* @method openPanel() - Open the AI panel. No-op when the panel is unavailable.
|
|
114
|
+
* @method closePanel() - Close the AI panel.
|
|
115
|
+
* @method togglePanel(force?) - Toggle, or force a specific open state.
|
|
116
|
+
* @method expandNav() - Expand the side nav.
|
|
117
|
+
* @method collapseNav() - Collapse the side nav to a rail.
|
|
118
|
+
* @method toggleNav(force?) - Toggle, or force a specific collapsed state.
|
|
119
|
+
*/
|
|
120
|
+
let NileAppShell = class NileAppShell extends NileElement {
|
|
121
|
+
constructor() {
|
|
122
|
+
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
|
+
*/
|
|
127
|
+
this.navCollapsed = false;
|
|
128
|
+
/** Whether the AI panel is open. */
|
|
129
|
+
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
|
+
*/
|
|
134
|
+
this.noPanel = false;
|
|
135
|
+
/** The default panel heading. Ignored when `panel-header` is slotted. */
|
|
136
|
+
this.panelLabel = 'Ask Aquera';
|
|
137
|
+
/** Hides the built-in nav toggle. Mount `nile-app-shell-nav-toggle` yourself. */
|
|
138
|
+
this.noNavToggle = false;
|
|
139
|
+
/** Drops the Cmd/Ctrl+J and Escape panel shortcuts. */
|
|
140
|
+
this.noPanelShortcut = false;
|
|
141
|
+
/** Hides the skip-to-content link. */
|
|
142
|
+
this.noSkipLink = false;
|
|
143
|
+
/** Label for the skip-to-content link. */
|
|
144
|
+
this.skipLinkLabel = 'Skip to main content';
|
|
145
|
+
/** Where the top bar is mounted: inside the container, or spanning the shell. */
|
|
146
|
+
this.topBarPlacement = 'content';
|
|
147
|
+
/** `centered` caps the page body at `--nile-app-shell-centered-width`. */
|
|
148
|
+
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
|
+
*/
|
|
156
|
+
this.contentContainer = false;
|
|
157
|
+
/** Drops the container's card chrome for a full-bleed page. */
|
|
158
|
+
this.flat = false;
|
|
159
|
+
/** Removes the container's inner padding. */
|
|
160
|
+
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
|
+
*/
|
|
169
|
+
this.askLabel = 'Ask';
|
|
170
|
+
/** Drops the built-in Ask button, for a bar that renders its own. */
|
|
171
|
+
this.noAsk = false;
|
|
172
|
+
/** Sizes the shell to the viewport instead of its parent. */
|
|
173
|
+
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
|
+
*/
|
|
184
|
+
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
|
+
*/
|
|
191
|
+
this.dockedRailBreakpoint = 1440;
|
|
192
|
+
/** The panel's current mode. Derived from the shell's width. */
|
|
193
|
+
this._panelMode = 'docked';
|
|
194
|
+
/** Whether the nav is held at a rail by the shell's width. */
|
|
195
|
+
this._navLocked = false;
|
|
196
|
+
this._hasBanner = false;
|
|
197
|
+
this._hasSideNav = false;
|
|
198
|
+
this._hasTopBar = false;
|
|
199
|
+
this._hasTopBarActions = false;
|
|
200
|
+
this._hasTabs = false;
|
|
201
|
+
this._hasPanel = false;
|
|
202
|
+
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
|
+
*/
|
|
209
|
+
this._panelOwnsChrome = false;
|
|
210
|
+
this._hasAside = false;
|
|
211
|
+
this._width = 0;
|
|
212
|
+
this._restoredPanelOpen = null;
|
|
213
|
+
/** A slotted sidebar's own expand button is the same toggle. */
|
|
214
|
+
this._onSideNavToggle = (event) => {
|
|
215
|
+
const detail = event.detail;
|
|
216
|
+
if (detail && typeof detail.collapsed === 'boolean') {
|
|
217
|
+
this._setNavCollapsed(detail.collapsed);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
this._onKeyDown = (event) => {
|
|
221
|
+
if (this.noPanelShortcut || !this.panelAvailable)
|
|
222
|
+
return;
|
|
223
|
+
const key = event.key ?? '';
|
|
224
|
+
if ((event.metaKey || event.ctrlKey) && key.toLowerCase() === 'j') {
|
|
225
|
+
event.preventDefault();
|
|
226
|
+
this.togglePanel();
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
// A docked panel is furniture, not a dismissible overlay.
|
|
230
|
+
if (key === 'Escape' && this.panelOpen && this._panelMode === 'overlay') {
|
|
231
|
+
this.closePanel();
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
static get styles() {
|
|
236
|
+
return [styles];
|
|
237
|
+
}
|
|
238
|
+
/** The panel's current mode: `docked` or `overlay`. */
|
|
239
|
+
get panelMode() {
|
|
240
|
+
return this._panelMode;
|
|
241
|
+
}
|
|
242
|
+
/** Whether the shell is holding the nav at a rail. The toggle is disabled. */
|
|
243
|
+
get navLocked() {
|
|
244
|
+
return this._navLocked;
|
|
245
|
+
}
|
|
246
|
+
/** Whether a panel is mounted for this route. */
|
|
247
|
+
get panelAvailable() {
|
|
248
|
+
return this._hasPanel && !this.noPanel;
|
|
249
|
+
}
|
|
250
|
+
/** Whether the built-in Ask button is rendered. */
|
|
251
|
+
get askVisible() {
|
|
252
|
+
return this.panelAvailable && !this.noAsk;
|
|
253
|
+
}
|
|
254
|
+
/** Whether the nav renders as a rail right now, preference or lock. */
|
|
255
|
+
get rail() {
|
|
256
|
+
return this.navCollapsed || this._navLocked;
|
|
257
|
+
}
|
|
258
|
+
connectedCallback() {
|
|
259
|
+
super.connectedCallback();
|
|
260
|
+
this._restore();
|
|
261
|
+
this._resizeObserver = new ResizeObserver(entries => {
|
|
262
|
+
const entry = entries[entries.length - 1];
|
|
263
|
+
this._measure(entry.contentRect.width);
|
|
264
|
+
});
|
|
265
|
+
this._resizeObserver.observe(this);
|
|
266
|
+
document.addEventListener('keydown', this._onKeyDown);
|
|
267
|
+
}
|
|
268
|
+
disconnectedCallback() {
|
|
269
|
+
super.disconnectedCallback();
|
|
270
|
+
this._resizeObserver?.disconnect();
|
|
271
|
+
this._resizeObserver = undefined;
|
|
272
|
+
document.removeEventListener('keydown', this._onKeyDown);
|
|
273
|
+
}
|
|
274
|
+
willUpdate(changed) {
|
|
275
|
+
if (changed.has('panelOpen') ||
|
|
276
|
+
changed.has('noPanel') ||
|
|
277
|
+
changed.has('overlayBreakpoint') ||
|
|
278
|
+
changed.has('dockedRailBreakpoint') ||
|
|
279
|
+
// Mounting an aside changes what a docked panel has to fit beside.
|
|
280
|
+
// Private state is outside `keyof this`, so ask the map directly.
|
|
281
|
+
changed.has('_hasAside') ||
|
|
282
|
+
changed.has('_hasSideNav')) {
|
|
283
|
+
this._recompute();
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
updated(changed) {
|
|
287
|
+
super.updated(changed);
|
|
288
|
+
// Derived state the stylesheet and consumers read off the host.
|
|
289
|
+
this.toggleAttribute('rail', this.rail);
|
|
290
|
+
this.toggleAttribute('nav-locked', this._navLocked);
|
|
291
|
+
this.toggleAttribute('has-banner', this._hasBanner);
|
|
292
|
+
this.toggleAttribute('has-side-nav', this._hasSideNav);
|
|
293
|
+
this.toggleAttribute('has-top-bar', this._hasTopBar || (!this.noNavToggle && this._hasSideNav));
|
|
294
|
+
this.toggleAttribute('has-top-bar-actions', this._hasTopBarActions);
|
|
295
|
+
this.toggleAttribute('has-ask', this.askVisible);
|
|
296
|
+
this.toggleAttribute('has-tabs', this._hasTabs);
|
|
297
|
+
this.toggleAttribute('has-aside', this._hasAside);
|
|
298
|
+
this.toggleAttribute('has-panel', this.panelAvailable);
|
|
299
|
+
this.toggleAttribute('has-panel-footer', this._hasPanelFooter);
|
|
300
|
+
this.setAttribute('panel-mode', this._panelMode);
|
|
301
|
+
this.setAttribute('panel-chrome', this._panelOwnsChrome ? 'external' : 'internal');
|
|
302
|
+
this._syncSideNav();
|
|
303
|
+
}
|
|
304
|
+
/** Open the AI panel. No-op when no panel is mounted for this route. */
|
|
305
|
+
openPanel() {
|
|
306
|
+
if (!this.panelAvailable)
|
|
307
|
+
return;
|
|
308
|
+
this._setPanelOpen(true);
|
|
309
|
+
}
|
|
310
|
+
/** Close the AI panel. */
|
|
311
|
+
closePanel() {
|
|
312
|
+
this._setPanelOpen(false);
|
|
313
|
+
}
|
|
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
|
+
*/
|
|
319
|
+
togglePanel(force) {
|
|
320
|
+
const next = force ?? !this.panelOpen;
|
|
321
|
+
if (next)
|
|
322
|
+
this.openPanel();
|
|
323
|
+
else
|
|
324
|
+
this.closePanel();
|
|
325
|
+
}
|
|
326
|
+
/** Expand the side nav. */
|
|
327
|
+
expandNav() {
|
|
328
|
+
this._setNavCollapsed(false);
|
|
329
|
+
}
|
|
330
|
+
/** Collapse the side nav to a rail. */
|
|
331
|
+
collapseNav() {
|
|
332
|
+
this._setNavCollapsed(true);
|
|
333
|
+
}
|
|
334
|
+
/** Toggle the side nav, or force a collapsed state. */
|
|
335
|
+
toggleNav(force) {
|
|
336
|
+
this._setNavCollapsed(force ?? !this.navCollapsed);
|
|
337
|
+
}
|
|
338
|
+
/** Move focus to the page body. */
|
|
339
|
+
focusMain() {
|
|
340
|
+
this._main?.focus();
|
|
341
|
+
}
|
|
342
|
+
_setPanelOpen(value) {
|
|
343
|
+
if (this.panelOpen === value)
|
|
344
|
+
return;
|
|
345
|
+
this.panelOpen = value;
|
|
346
|
+
this._persist();
|
|
347
|
+
this.emit('nile-panel-toggle', { open: value, mode: this._panelMode });
|
|
348
|
+
}
|
|
349
|
+
_setNavCollapsed(value) {
|
|
350
|
+
if (this.navCollapsed === value)
|
|
351
|
+
return;
|
|
352
|
+
this.navCollapsed = value;
|
|
353
|
+
this._persist();
|
|
354
|
+
this.emit('nile-nav-toggle', {
|
|
355
|
+
collapsed: value,
|
|
356
|
+
locked: this._navLocked,
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
/** Records the shell's width and re-derives everything that depends on it. */
|
|
360
|
+
_measure(width) {
|
|
361
|
+
if (width === this._width)
|
|
362
|
+
return;
|
|
363
|
+
const first = this._width === 0;
|
|
364
|
+
this._width = width;
|
|
365
|
+
this._recompute();
|
|
366
|
+
// A persisted panel state only applies once we know the panel would dock.
|
|
367
|
+
if (first && this._restoredPanelOpen !== null) {
|
|
368
|
+
const open = this._restoredPanelOpen;
|
|
369
|
+
this._restoredPanelOpen = null;
|
|
370
|
+
if (open && this._panelMode === 'docked')
|
|
371
|
+
this.openPanel();
|
|
372
|
+
}
|
|
373
|
+
}
|
|
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
|
+
*/
|
|
379
|
+
_geometry() {
|
|
380
|
+
const style = getComputedStyle(this);
|
|
381
|
+
const px = (name, fallback) => {
|
|
382
|
+
const value = parseFloat(style.getPropertyValue(name));
|
|
383
|
+
return Number.isFinite(value) ? value : fallback;
|
|
384
|
+
};
|
|
385
|
+
return {
|
|
386
|
+
nav: px('--nile-app-shell-side-nav-width', 260),
|
|
387
|
+
rail: px('--nile-app-shell-side-nav-rail-width', 64),
|
|
388
|
+
gutter: px('--nile-app-shell-gutter', 8),
|
|
389
|
+
content: px('--nile-app-shell-content-min-width', 640),
|
|
390
|
+
aside: px('--nile-app-shell-aside-width', 320),
|
|
391
|
+
panel: px('--nile-app-shell-panel-width', 480),
|
|
392
|
+
};
|
|
393
|
+
}
|
|
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
|
+
*/
|
|
404
|
+
_dockRequirement(geo, track) {
|
|
405
|
+
const nav = this._hasSideNav ? track : 0;
|
|
406
|
+
const aside = this._hasAside ? geo.aside + geo.gutter : 0;
|
|
407
|
+
// Two gutters of padding on the content column, one between container and
|
|
408
|
+
// panel; the aside carries its own gutter above.
|
|
409
|
+
return nav + geo.content + aside + geo.panel + geo.gutter * 3;
|
|
410
|
+
}
|
|
411
|
+
_recompute() {
|
|
412
|
+
const width = this._width;
|
|
413
|
+
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
|
+
*/
|
|
420
|
+
const overlay = this.overlayBreakpoint > 0 && width > 0 && width < this.overlayBreakpoint;
|
|
421
|
+
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.
|
|
426
|
+
const railAt = Math.max(this.dockedRailBreakpoint, this._dockRequirement(geo, geo.nav));
|
|
427
|
+
const squeezed = !overlay &&
|
|
428
|
+
this.panelOpen &&
|
|
429
|
+
this.panelAvailable &&
|
|
430
|
+
width > 0 &&
|
|
431
|
+
width < railAt;
|
|
432
|
+
const locked = overlay || squeezed;
|
|
433
|
+
if (mode !== this._panelMode) {
|
|
434
|
+
this._panelMode = mode;
|
|
435
|
+
this.emit('nile-panel-mode-change', { mode });
|
|
436
|
+
}
|
|
437
|
+
if (locked !== this._navLocked) {
|
|
438
|
+
this._navLocked = locked;
|
|
439
|
+
this.emit('nile-nav-toggle', {
|
|
440
|
+
collapsed: this.navCollapsed,
|
|
441
|
+
locked,
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
/** Mirrors the effective rail state onto a slotted `nile-side-bar`. */
|
|
446
|
+
_syncSideNav() {
|
|
447
|
+
this.querySelectorAll('[slot="side-nav"]').forEach(el => {
|
|
448
|
+
if (el.tagName === 'NILE-SIDE-BAR')
|
|
449
|
+
el.toggleAttribute('collapsed', this.rail);
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
_storageKey(part) {
|
|
453
|
+
return `nile-app-shell:${this.persistKey}:${part}`;
|
|
454
|
+
}
|
|
455
|
+
_restore() {
|
|
456
|
+
if (!this.persistKey)
|
|
457
|
+
return;
|
|
458
|
+
try {
|
|
459
|
+
const nav = localStorage.getItem(this._storageKey('nav-collapsed'));
|
|
460
|
+
if (nav !== null)
|
|
461
|
+
this.navCollapsed = nav === 'true';
|
|
462
|
+
const panel = localStorage.getItem(this._storageKey('panel-open'));
|
|
463
|
+
if (panel !== null)
|
|
464
|
+
this._restoredPanelOpen = panel === 'true';
|
|
465
|
+
}
|
|
466
|
+
catch {
|
|
467
|
+
/* Storage can be blocked; the shell still works without it. */
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
_persist() {
|
|
471
|
+
if (!this.persistKey)
|
|
472
|
+
return;
|
|
473
|
+
try {
|
|
474
|
+
localStorage.setItem(this._storageKey('nav-collapsed'), String(this.navCollapsed));
|
|
475
|
+
if (this._panelMode === 'docked') {
|
|
476
|
+
localStorage.setItem(this._storageKey('panel-open'), String(this.panelOpen));
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
catch {
|
|
480
|
+
/* Storage can be blocked; the shell still works without it. */
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
_onSlotChange(slot, event) {
|
|
484
|
+
const assigned = event.target.assignedNodes({
|
|
485
|
+
flatten: true,
|
|
486
|
+
});
|
|
487
|
+
const filled = assigned.some(node => node.nodeType === Node.ELEMENT_NODE ||
|
|
488
|
+
(node.textContent ?? '').trim() !== '');
|
|
489
|
+
switch (slot) {
|
|
490
|
+
case 'banner':
|
|
491
|
+
this._hasBanner = filled;
|
|
492
|
+
break;
|
|
493
|
+
case 'side-nav':
|
|
494
|
+
this._hasSideNav = filled;
|
|
495
|
+
this._syncSideNav();
|
|
496
|
+
break;
|
|
497
|
+
case 'top-bar':
|
|
498
|
+
this._hasTopBar = filled;
|
|
499
|
+
break;
|
|
500
|
+
case 'top-bar-actions':
|
|
501
|
+
this._hasTopBarActions = filled;
|
|
502
|
+
break;
|
|
503
|
+
case 'tabs':
|
|
504
|
+
this._hasTabs = filled;
|
|
505
|
+
break;
|
|
506
|
+
case 'aside':
|
|
507
|
+
this._hasAside = filled;
|
|
508
|
+
break;
|
|
509
|
+
case 'panel':
|
|
510
|
+
this._hasPanel = filled;
|
|
511
|
+
this._panelOwnsChrome = assigned.some(node => node.nodeType === Node.ELEMENT_NODE &&
|
|
512
|
+
node.tagName === 'NILE-APP-SHELL-PANEL');
|
|
513
|
+
this._recompute();
|
|
514
|
+
break;
|
|
515
|
+
case 'panel-footer':
|
|
516
|
+
this._hasPanelFooter = filled;
|
|
517
|
+
break;
|
|
518
|
+
default:
|
|
519
|
+
break;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
_renderNavToggle() {
|
|
523
|
+
if (this.noNavToggle || !this._hasSideNav)
|
|
524
|
+
return '';
|
|
525
|
+
const expanded = !this.rail;
|
|
526
|
+
return html `
|
|
527
|
+
<div class="nav-toggle-group">
|
|
528
|
+
<nile-button
|
|
529
|
+
class="nav-toggle"
|
|
530
|
+
part="nav-toggle"
|
|
531
|
+
variant="ghost"
|
|
532
|
+
circle
|
|
533
|
+
aria-controls="side-nav"
|
|
534
|
+
aria-expanded=${expanded ? 'true' : 'false'}
|
|
535
|
+
?disabled=${this._navLocked}
|
|
536
|
+
title=${this._navLocked
|
|
537
|
+
? 'The navigation stays collapsed at this window width'
|
|
538
|
+
: expanded
|
|
539
|
+
? 'Collapse navigation'
|
|
540
|
+
: 'Expand navigation'}
|
|
541
|
+
aria-label=${expanded ? 'Collapse navigation' : 'Expand navigation'}
|
|
542
|
+
@click=${() => this.toggleNav()}
|
|
543
|
+
>
|
|
544
|
+
${renderGlyph(expanded ? 'ng-panel-left-close' : 'ng-panel-left-open', 24, 'currentColor')}
|
|
545
|
+
</nile-button>
|
|
546
|
+
${this._hasTopBar ? html `<span class="rule" part="rule"></span>` : ''}
|
|
547
|
+
</div>
|
|
548
|
+
`;
|
|
549
|
+
}
|
|
550
|
+
_renderTopBar(placement) {
|
|
551
|
+
return html `
|
|
552
|
+
<div
|
|
553
|
+
class=${placement === 'shell' ? 'top-bar shell-top-bar' : 'top-bar'}
|
|
554
|
+
part=${placement === 'shell' ? 'top-bar shell-top-bar' : 'top-bar'}
|
|
555
|
+
>
|
|
556
|
+
${this._renderNavToggle()}
|
|
557
|
+
<div class="top-bar-content">
|
|
558
|
+
<slot
|
|
559
|
+
name="top-bar"
|
|
560
|
+
@slotchange=${(e) => this._onSlotChange('top-bar', e)}
|
|
561
|
+
></slot>
|
|
562
|
+
</div>
|
|
563
|
+
<div class="top-bar-actions" part="top-bar-actions">
|
|
564
|
+
<slot
|
|
565
|
+
name="top-bar-actions"
|
|
566
|
+
@slotchange=${(e) => this._onSlotChange('top-bar-actions', e)}
|
|
567
|
+
></slot>
|
|
568
|
+
${this.askVisible
|
|
569
|
+
? html `
|
|
570
|
+
<nile-button
|
|
571
|
+
class="ask"
|
|
572
|
+
part="ask"
|
|
573
|
+
exportparts="base: ask__base, label: ask__label"
|
|
574
|
+
variant="primary"
|
|
575
|
+
@click=${() => this.openPanel()}
|
|
576
|
+
>
|
|
577
|
+
<span slot="prefix" class="ask-mark">
|
|
578
|
+
${renderGlyph('ng-sparkles', 16, 'currentColor')}
|
|
579
|
+
</span>
|
|
580
|
+
${this.askLabel}
|
|
581
|
+
</nile-button>
|
|
582
|
+
`
|
|
583
|
+
: ''}
|
|
584
|
+
</div>
|
|
585
|
+
</div>
|
|
586
|
+
`;
|
|
587
|
+
}
|
|
588
|
+
render() {
|
|
589
|
+
const shellBar = this.topBarPlacement === 'shell';
|
|
590
|
+
return html `
|
|
591
|
+
<button
|
|
592
|
+
class="skip-link"
|
|
593
|
+
part="skip-link"
|
|
594
|
+
type="button"
|
|
595
|
+
@click=${() => this.focusMain()}
|
|
596
|
+
>
|
|
597
|
+
${this.skipLinkLabel}
|
|
598
|
+
</button>
|
|
599
|
+
|
|
600
|
+
<div class="banner" part="banner">
|
|
601
|
+
<slot
|
|
602
|
+
name="banner"
|
|
603
|
+
@slotchange=${(e) => this._onSlotChange('banner', e)}
|
|
604
|
+
></slot>
|
|
605
|
+
</div>
|
|
606
|
+
|
|
607
|
+
${shellBar ? this._renderTopBar('shell') : ''}
|
|
608
|
+
|
|
609
|
+
<div
|
|
610
|
+
id="side-nav"
|
|
611
|
+
class="side-nav"
|
|
612
|
+
part="side-nav"
|
|
613
|
+
@nile-toggle=${this._onSideNavToggle}
|
|
614
|
+
>
|
|
615
|
+
<slot
|
|
616
|
+
name="side-nav"
|
|
617
|
+
@slotchange=${(e) => this._onSlotChange('side-nav', e)}
|
|
618
|
+
></slot>
|
|
619
|
+
</div>
|
|
620
|
+
|
|
621
|
+
<div class="content-section" part="content-section">
|
|
622
|
+
<div class="container" part="container">
|
|
623
|
+
${shellBar ? '' : this._renderTopBar('content')}
|
|
624
|
+
<div class="tabs" part="tabs">
|
|
625
|
+
<slot
|
|
626
|
+
name="tabs"
|
|
627
|
+
@slotchange=${(e) => this._onSlotChange('tabs', e)}
|
|
628
|
+
></slot>
|
|
629
|
+
</div>
|
|
630
|
+
<main class="main" part="main" tabindex="-1">
|
|
631
|
+
<div class="main-inner"><slot></slot></div>
|
|
632
|
+
</main>
|
|
633
|
+
</div>
|
|
634
|
+
|
|
635
|
+
<div class="aside" part="aside">
|
|
636
|
+
<slot
|
|
637
|
+
name="aside"
|
|
638
|
+
@slotchange=${(e) => this._onSlotChange('aside', e)}
|
|
639
|
+
></slot>
|
|
640
|
+
</div>
|
|
641
|
+
|
|
642
|
+
<aside
|
|
643
|
+
class="panel"
|
|
644
|
+
part="panel"
|
|
645
|
+
aria-label=${ifDefined(this._panelOwnsChrome ? undefined : this.panelLabel)}
|
|
646
|
+
aria-hidden=${this.panelOpen ? 'false' : 'true'}
|
|
647
|
+
>
|
|
648
|
+
${this._panelOwnsChrome
|
|
649
|
+
? html `<slot
|
|
650
|
+
name="panel"
|
|
651
|
+
@slotchange=${(e) => this._onSlotChange('panel', e)}
|
|
652
|
+
></slot>`
|
|
653
|
+
: html `
|
|
654
|
+
<header class="panel-header" part="panel-header">
|
|
655
|
+
<slot name="panel-header">
|
|
656
|
+
<span class="panel-heading">
|
|
657
|
+
<span class="panel-mark">
|
|
658
|
+
${renderGlyph('ng-sparkles', 20, 'currentColor')}
|
|
659
|
+
</span>
|
|
660
|
+
<h2 class="panel-title" part="panel-title">
|
|
661
|
+
${this.panelLabel}
|
|
662
|
+
</h2>
|
|
663
|
+
</span>
|
|
664
|
+
</slot>
|
|
665
|
+
<div class="panel-actions" part="panel-actions">
|
|
666
|
+
<slot name="panel-actions"></slot>
|
|
667
|
+
<nile-button
|
|
668
|
+
class="panel-close"
|
|
669
|
+
part="panel-close"
|
|
670
|
+
variant="ghost"
|
|
671
|
+
circle
|
|
672
|
+
title="Close ${this.panelLabel}"
|
|
673
|
+
aria-label="Close ${this.panelLabel}"
|
|
674
|
+
@click=${() => this.closePanel()}
|
|
675
|
+
>
|
|
676
|
+
${renderGlyph('ng-x-close', 24, 'currentColor')}
|
|
677
|
+
</nile-button>
|
|
678
|
+
</div>
|
|
679
|
+
</header>
|
|
680
|
+
<div class="panel-body" part="panel-body">
|
|
681
|
+
<slot
|
|
682
|
+
name="panel"
|
|
683
|
+
@slotchange=${(e) => this._onSlotChange('panel', e)}
|
|
684
|
+
></slot>
|
|
685
|
+
</div>
|
|
686
|
+
<div class="panel-footer" part="panel-footer">
|
|
687
|
+
<slot
|
|
688
|
+
name="panel-footer"
|
|
689
|
+
@slotchange=${(e) => this._onSlotChange('panel-footer', e)}
|
|
690
|
+
></slot>
|
|
691
|
+
</div>
|
|
692
|
+
`}
|
|
693
|
+
</aside>
|
|
694
|
+
</div>
|
|
695
|
+
`;
|
|
696
|
+
}
|
|
697
|
+
};
|
|
698
|
+
__decorate([
|
|
699
|
+
property({ type: Boolean, reflect: true, attribute: 'nav-collapsed' })
|
|
700
|
+
], NileAppShell.prototype, "navCollapsed", void 0);
|
|
701
|
+
__decorate([
|
|
702
|
+
property({ type: Boolean, reflect: true, attribute: 'panel-open' })
|
|
703
|
+
], NileAppShell.prototype, "panelOpen", void 0);
|
|
704
|
+
__decorate([
|
|
705
|
+
property({ type: Boolean, reflect: true, attribute: 'no-panel' })
|
|
706
|
+
], NileAppShell.prototype, "noPanel", void 0);
|
|
707
|
+
__decorate([
|
|
708
|
+
property({ type: String, attribute: 'panel-label' })
|
|
709
|
+
], NileAppShell.prototype, "panelLabel", void 0);
|
|
710
|
+
__decorate([
|
|
711
|
+
property({ type: Boolean, reflect: true, attribute: 'no-nav-toggle' })
|
|
712
|
+
], NileAppShell.prototype, "noNavToggle", void 0);
|
|
713
|
+
__decorate([
|
|
714
|
+
property({ type: Boolean, attribute: 'no-panel-shortcut' })
|
|
715
|
+
], NileAppShell.prototype, "noPanelShortcut", void 0);
|
|
716
|
+
__decorate([
|
|
717
|
+
property({ type: Boolean, reflect: true, attribute: 'no-skip-link' })
|
|
718
|
+
], NileAppShell.prototype, "noSkipLink", void 0);
|
|
719
|
+
__decorate([
|
|
720
|
+
property({ type: String, attribute: 'skip-link-label' })
|
|
721
|
+
], NileAppShell.prototype, "skipLinkLabel", void 0);
|
|
722
|
+
__decorate([
|
|
723
|
+
property({ type: String, reflect: true, attribute: 'top-bar-placement' })
|
|
724
|
+
], NileAppShell.prototype, "topBarPlacement", void 0);
|
|
725
|
+
__decorate([
|
|
726
|
+
property({ type: String, reflect: true, attribute: 'content-align' })
|
|
727
|
+
], NileAppShell.prototype, "contentAlign", void 0);
|
|
728
|
+
__decorate([
|
|
729
|
+
property({ type: Boolean, reflect: true, attribute: 'content-container' })
|
|
730
|
+
], NileAppShell.prototype, "contentContainer", void 0);
|
|
731
|
+
__decorate([
|
|
732
|
+
property({ type: Boolean, reflect: true })
|
|
733
|
+
], NileAppShell.prototype, "flat", void 0);
|
|
734
|
+
__decorate([
|
|
735
|
+
property({ type: Boolean, reflect: true, attribute: 'no-padding' })
|
|
736
|
+
], NileAppShell.prototype, "noPadding", void 0);
|
|
737
|
+
__decorate([
|
|
738
|
+
property({ type: String, attribute: 'ask-label' })
|
|
739
|
+
], NileAppShell.prototype, "askLabel", void 0);
|
|
740
|
+
__decorate([
|
|
741
|
+
property({ type: Boolean, reflect: true, attribute: 'no-ask' })
|
|
742
|
+
], NileAppShell.prototype, "noAsk", void 0);
|
|
743
|
+
__decorate([
|
|
744
|
+
property({ type: Boolean, reflect: true, attribute: 'full-height' })
|
|
745
|
+
], NileAppShell.prototype, "fullHeight", void 0);
|
|
746
|
+
__decorate([
|
|
747
|
+
property({ type: Number, attribute: 'overlay-breakpoint' })
|
|
748
|
+
], NileAppShell.prototype, "overlayBreakpoint", void 0);
|
|
749
|
+
__decorate([
|
|
750
|
+
property({ type: Number, attribute: 'docked-rail-breakpoint' })
|
|
751
|
+
], NileAppShell.prototype, "dockedRailBreakpoint", void 0);
|
|
752
|
+
__decorate([
|
|
753
|
+
property({ type: String, attribute: 'persist-key' })
|
|
754
|
+
], NileAppShell.prototype, "persistKey", void 0);
|
|
755
|
+
__decorate([
|
|
756
|
+
state()
|
|
757
|
+
], NileAppShell.prototype, "_panelMode", void 0);
|
|
758
|
+
__decorate([
|
|
759
|
+
state()
|
|
760
|
+
], NileAppShell.prototype, "_navLocked", void 0);
|
|
761
|
+
__decorate([
|
|
762
|
+
state()
|
|
763
|
+
], NileAppShell.prototype, "_hasBanner", void 0);
|
|
764
|
+
__decorate([
|
|
765
|
+
state()
|
|
766
|
+
], NileAppShell.prototype, "_hasSideNav", void 0);
|
|
767
|
+
__decorate([
|
|
768
|
+
state()
|
|
769
|
+
], NileAppShell.prototype, "_hasTopBar", void 0);
|
|
770
|
+
__decorate([
|
|
771
|
+
state()
|
|
772
|
+
], NileAppShell.prototype, "_hasTopBarActions", void 0);
|
|
773
|
+
__decorate([
|
|
774
|
+
state()
|
|
775
|
+
], NileAppShell.prototype, "_hasTabs", void 0);
|
|
776
|
+
__decorate([
|
|
777
|
+
state()
|
|
778
|
+
], NileAppShell.prototype, "_hasPanel", void 0);
|
|
779
|
+
__decorate([
|
|
780
|
+
state()
|
|
781
|
+
], NileAppShell.prototype, "_hasPanelFooter", void 0);
|
|
782
|
+
__decorate([
|
|
783
|
+
state()
|
|
784
|
+
], NileAppShell.prototype, "_panelOwnsChrome", void 0);
|
|
785
|
+
__decorate([
|
|
786
|
+
state()
|
|
787
|
+
], NileAppShell.prototype, "_hasAside", void 0);
|
|
788
|
+
__decorate([
|
|
789
|
+
query('.main')
|
|
790
|
+
], NileAppShell.prototype, "_main", void 0);
|
|
791
|
+
NileAppShell = __decorate([
|
|
792
|
+
customElement('nile-app-shell')
|
|
793
|
+
], NileAppShell);
|
|
794
|
+
export { NileAppShell };
|
|
795
|
+
export default NileAppShell;
|
|
796
|
+
//# sourceMappingURL=nile-app-shell.js.map
|