@aquera/nile-elements 2.0.5 → 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 +4 -0
- package/demo/nxtgen-classes.css +15 -12
- package/demo/nxtgen-dark.css +24 -24
- package/demo/nxtgen-properties.css +27 -24
- package/demo/nxtgen-utilities.css +39 -36
- package/demo/nxtgen.css +15 -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 +1353 -340
- 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-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-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 +51 -8
- 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 +7 -2
- 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-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 +55 -7
- package/vscode-html-custom-data.json +216 -5
|
@@ -0,0 +1,100 @@
|
|
|
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
|
+
|
|
8
|
+
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
9
|
+
import type { NileAppShell } from './nile-app-shell';
|
|
10
|
+
|
|
11
|
+
/** Events on the shell that change what a region component renders. */
|
|
12
|
+
const SHELL_EVENTS = [
|
|
13
|
+
'nile-nav-toggle',
|
|
14
|
+
'nile-panel-toggle',
|
|
15
|
+
'nile-panel-mode-change',
|
|
16
|
+
];
|
|
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
|
+
*/
|
|
26
|
+
export class AppShellController implements ReactiveController {
|
|
27
|
+
host: ReactiveControllerHost & HTMLElement;
|
|
28
|
+
|
|
29
|
+
/** Id of the shell to link to. Defaults to the nearest ancestor. */
|
|
30
|
+
shellId?: string;
|
|
31
|
+
|
|
32
|
+
private linked?: NileAppShell;
|
|
33
|
+
private observer?: MutationObserver;
|
|
34
|
+
|
|
35
|
+
constructor(host: ReactiveControllerHost & HTMLElement) {
|
|
36
|
+
(this.host = host).addController(this);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** The linked shell, resolving it first if it has not been found yet. */
|
|
40
|
+
get shell(): NileAppShell | null {
|
|
41
|
+
if (!this.linked) this.link();
|
|
42
|
+
return this.linked ?? null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
hostConnected(): void {
|
|
46
|
+
// The shell can upgrade after its children; give it a microtask.
|
|
47
|
+
Promise.resolve().then(() => {
|
|
48
|
+
if (this.link()) this.host.requestUpdate();
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
hostDisconnected(): void {
|
|
53
|
+
this.unlink();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Resolve the shell and subscribe to it. Returns true when newly linked. */
|
|
57
|
+
private link(): boolean {
|
|
58
|
+
const found = this.find();
|
|
59
|
+
if (!found || found === this.linked) return false;
|
|
60
|
+
this.unlink();
|
|
61
|
+
this.linked = found;
|
|
62
|
+
SHELL_EVENTS.forEach(name =>
|
|
63
|
+
found.addEventListener(name, this.handleShellChange)
|
|
64
|
+
);
|
|
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
|
+
*/
|
|
71
|
+
this.observer = new MutationObserver(this.handleShellChange);
|
|
72
|
+
this.observer.observe(found, { attributes: true });
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
private unlink(): void {
|
|
77
|
+
const shell = this.linked;
|
|
78
|
+
if (!shell) return;
|
|
79
|
+
SHELL_EVENTS.forEach(name =>
|
|
80
|
+
shell.removeEventListener(name, this.handleShellChange)
|
|
81
|
+
);
|
|
82
|
+
this.observer?.disconnect();
|
|
83
|
+
this.observer = undefined;
|
|
84
|
+
this.linked = undefined;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private find(): NileAppShell | null {
|
|
88
|
+
if (this.shellId) {
|
|
89
|
+
const root = this.host.getRootNode() as Document | ShadowRoot;
|
|
90
|
+
return root.querySelector<NileAppShell>(`nile-app-shell#${this.shellId}`);
|
|
91
|
+
}
|
|
92
|
+
return this.host.closest('nile-app-shell');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private handleShellChange = (): void => {
|
|
96
|
+
this.host.requestUpdate();
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export default AppShellController;
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
|
|
8
|
+
import { css } from 'lit';
|
|
9
|
+
|
|
10
|
+
export const styles = css`
|
|
11
|
+
:host {
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
display: block;
|
|
14
|
+
width: 100%;
|
|
15
|
+
min-width: 0;
|
|
16
|
+
container-type: inline-size;
|
|
17
|
+
container-name: nile-content;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:host([no-container]) {
|
|
21
|
+
container-type: normal;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host([hidden]) {
|
|
25
|
+
display: none;
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
export default [styles];
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
|
|
8
|
+
import { html, CSSResultArray, TemplateResult } from 'lit';
|
|
9
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
10
|
+
import { styles } from './nile-app-shell-main.css';
|
|
11
|
+
import NileElement from '../internal/nile-element';
|
|
12
|
+
|
|
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.
|
|
17
|
+
*
|
|
18
|
+
* @status stable
|
|
19
|
+
* @since 2.0
|
|
20
|
+
*
|
|
21
|
+
* @tag nile-app-shell-main
|
|
22
|
+
*
|
|
23
|
+
* @dependency nile-app-shell
|
|
24
|
+
*
|
|
25
|
+
* @slot - The page body.
|
|
26
|
+
*
|
|
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.
|
|
30
|
+
*/
|
|
31
|
+
@customElement('nile-app-shell-main')
|
|
32
|
+
export class NileAppShellMain extends NileElement {
|
|
33
|
+
public static get styles(): CSSResultArray {
|
|
34
|
+
return [styles];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Drops the size query container. */
|
|
38
|
+
@property({ type: Boolean, reflect: true, attribute: 'no-container' })
|
|
39
|
+
noContainer: boolean = false;
|
|
40
|
+
|
|
41
|
+
public render(): TemplateResult {
|
|
42
|
+
return html`<slot></slot>`;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default NileAppShellMain;
|
|
47
|
+
|
|
48
|
+
declare global {
|
|
49
|
+
interface HTMLElementTagNameMap {
|
|
50
|
+
'nile-app-shell-main': NileAppShellMain;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
|
|
8
|
+
import { css } from 'lit';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* AppShellNavToggle CSS. The button itself is the shared utility recipe; this
|
|
12
|
+
* file only handles the host box and the rule.
|
|
13
|
+
*/
|
|
14
|
+
export const styles = css`
|
|
15
|
+
:host {
|
|
16
|
+
display: inline-flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
gap: var(--nile-spacing-lg, var(--ng-spacing-lg));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:host([hidden]) {
|
|
22
|
+
display: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.toggle {
|
|
26
|
+
margin-inline-start: var(--nile-app-shell-nav-toggle-offset, -7px);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.rule {
|
|
30
|
+
flex: 0 0 auto;
|
|
31
|
+
width: var(--nile-border-width-1, var(--ng-border-width-1));
|
|
32
|
+
height: 24px;
|
|
33
|
+
background: var(
|
|
34
|
+
--nile-colors-neutral-400,
|
|
35
|
+
var(--ng-colors-border-secondary)
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:host(:not([with-rule])) .rule {
|
|
40
|
+
display: none;
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
export default [styles];
|
|
@@ -0,0 +1,138 @@
|
|
|
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
|
+
|
|
8
|
+
import { html, CSSResultArray, TemplateResult } from 'lit';
|
|
9
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
10
|
+
import { styles } from './nile-app-shell-nav-toggle.css';
|
|
11
|
+
import { renderGlyph } from '../internal/glyph';
|
|
12
|
+
import '../nile-button/nile-button';
|
|
13
|
+
import NileElement from '../internal/nile-element';
|
|
14
|
+
import type { NileAppShell } from '../nile-app-shell/nile-app-shell';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @summary The side-nav toggle, as a standalone control. `nile-app-shell`
|
|
18
|
+
* renders one in its own top bar; mount this in a header you build yourself, or
|
|
19
|
+
* a route has no way to expand the rail.
|
|
20
|
+
*
|
|
21
|
+
* @status stable
|
|
22
|
+
* @since 2.0
|
|
23
|
+
*
|
|
24
|
+
* @tag nile-app-shell-nav-toggle
|
|
25
|
+
*
|
|
26
|
+
* @dependency nile-app-shell
|
|
27
|
+
* @dependency nile-glyph
|
|
28
|
+
*
|
|
29
|
+
* @csspart button - The toggle button.
|
|
30
|
+
* @csspart rule - The trailing vertical rule.
|
|
31
|
+
*
|
|
32
|
+
* @cssproperty [--nile-app-shell-nav-toggle-offset=-4px] - Optical start offset.
|
|
33
|
+
*/
|
|
34
|
+
@customElement('nile-app-shell-nav-toggle')
|
|
35
|
+
export class NileAppShellNavToggle extends NileElement {
|
|
36
|
+
public static get styles(): CSSResultArray {
|
|
37
|
+
return [styles];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Draws the vertical rule the shell's own bar puts after the toggle. */
|
|
41
|
+
@property({ type: Boolean, reflect: true, attribute: 'with-rule' })
|
|
42
|
+
withRule: boolean = false;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The shell to drive. Defaults to the nearest `nile-app-shell` ancestor, or
|
|
46
|
+
* the element with this id.
|
|
47
|
+
*/
|
|
48
|
+
@property({ type: String })
|
|
49
|
+
shell?: string;
|
|
50
|
+
|
|
51
|
+
@state() private _rail: boolean = false;
|
|
52
|
+
@state() private _locked: boolean = false;
|
|
53
|
+
|
|
54
|
+
private _observed?: NileAppShell;
|
|
55
|
+
|
|
56
|
+
public connectedCallback(): void {
|
|
57
|
+
super.connectedCallback();
|
|
58
|
+
// The shell may upgrade after this element does, so read it on a microtask.
|
|
59
|
+
Promise.resolve().then(() => this._attach());
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public disconnectedCallback(): void {
|
|
63
|
+
super.disconnectedCallback();
|
|
64
|
+
this._observed?.removeEventListener('nile-nav-toggle', this._onShellToggle);
|
|
65
|
+
this._observed = undefined;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The shell this toggle drives, if it found one. */
|
|
69
|
+
public get appShell(): NileAppShell | null {
|
|
70
|
+
if (this.shell) {
|
|
71
|
+
const root = this.getRootNode() as Document | ShadowRoot;
|
|
72
|
+
return (root.querySelector(`#${this.shell}`) as NileAppShell) ?? null;
|
|
73
|
+
}
|
|
74
|
+
return this.closest('nile-app-shell') ?? null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
private _attach(): void {
|
|
78
|
+
const shell = this.appShell;
|
|
79
|
+
if (!shell || shell === this._observed) return;
|
|
80
|
+
this._observed?.removeEventListener('nile-nav-toggle', this._onShellToggle);
|
|
81
|
+
this._observed = shell;
|
|
82
|
+
shell.addEventListener('nile-nav-toggle', this._onShellToggle);
|
|
83
|
+
this._sync();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
private _onShellToggle = (): void => {
|
|
87
|
+
this._sync();
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
private _sync(): void {
|
|
91
|
+
const shell = this._observed;
|
|
92
|
+
if (!shell) return;
|
|
93
|
+
this._rail = shell.rail;
|
|
94
|
+
this._locked = shell.navLocked;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public render(): TemplateResult {
|
|
98
|
+
const expanded = !this._rail;
|
|
99
|
+
return html`
|
|
100
|
+
<nile-button
|
|
101
|
+
class="toggle"
|
|
102
|
+
part="button"
|
|
103
|
+
variant="ghost"
|
|
104
|
+
circle
|
|
105
|
+
aria-expanded=${expanded ? 'true' : 'false'}
|
|
106
|
+
?disabled=${this._locked}
|
|
107
|
+
title=${this._locked
|
|
108
|
+
? 'The navigation stays collapsed at this window width'
|
|
109
|
+
: expanded
|
|
110
|
+
? 'Collapse navigation'
|
|
111
|
+
: 'Expand navigation'}
|
|
112
|
+
aria-label=${expanded ? 'Collapse navigation' : 'Expand navigation'}
|
|
113
|
+
@click=${this._onClick}
|
|
114
|
+
>
|
|
115
|
+
${renderGlyph(
|
|
116
|
+
expanded ? 'ng-panel-left-close' : 'ng-panel-left-open',
|
|
117
|
+
24,
|
|
118
|
+
'currentColor'
|
|
119
|
+
)}
|
|
120
|
+
</nile-button>
|
|
121
|
+
<span class="rule" part="rule"></span>
|
|
122
|
+
`;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
private _onClick = (): void => {
|
|
126
|
+
this._attach();
|
|
127
|
+
this._observed?.toggleNav();
|
|
128
|
+
this._sync();
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export default NileAppShellNavToggle;
|
|
133
|
+
|
|
134
|
+
declare global {
|
|
135
|
+
interface HTMLElementTagNameMap {
|
|
136
|
+
'nile-app-shell-nav-toggle': NileAppShellNavToggle;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
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
|
+
|
|
8
|
+
import { css } from 'lit';
|
|
9
|
+
|
|
10
|
+
export const styles = css`
|
|
11
|
+
:host {
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
/* A flex item of the shell's panel region, filling it. */
|
|
14
|
+
flex: 1 1 auto;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
min-height: 0;
|
|
18
|
+
height: 100%;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:host([hidden]) {
|
|
23
|
+
display: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.header {
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
flex: 0 0 auto;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
gap: var(--nile-spacing-lg, var(--ng-spacing-lg));
|
|
32
|
+
height: var(--nile-app-shell-top-bar-height, 56px);
|
|
33
|
+
padding-inline: var(--nile-spacing-xl, var(--ng-spacing-xl));
|
|
34
|
+
border-bottom: var(--nile-border-width-1, var(--ng-border-width-1)) solid
|
|
35
|
+
var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:host([no-header]) .header {
|
|
39
|
+
display: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.heading {
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
gap: var(--nile-spacing-md, var(--ng-spacing-md));
|
|
46
|
+
min-width: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.mark {
|
|
50
|
+
display: inline-flex;
|
|
51
|
+
color: var(
|
|
52
|
+
--nile-colors-primary-600,
|
|
53
|
+
var(--ng-colors-fg-brand-primary-600)
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.mark nile-glyph {
|
|
58
|
+
--nile-svg-fill: currentColor;
|
|
59
|
+
--nile-svg-stroke-width: var(--ng-svg-stroke-width);
|
|
60
|
+
width: 20px;
|
|
61
|
+
height: 20px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.title {
|
|
65
|
+
margin: 0;
|
|
66
|
+
font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
|
|
67
|
+
font-weight: var(
|
|
68
|
+
--nile-font-weight-semi-bold,
|
|
69
|
+
var(--ng-font-weight-semibold)
|
|
70
|
+
);
|
|
71
|
+
color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));
|
|
72
|
+
white-space: nowrap;
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
text-overflow: ellipsis;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.actions {
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
gap: var(--nile-spacing-xs, var(--ng-spacing-xs));
|
|
81
|
+
margin-inline-start: auto;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
:host([no-close]) .close {
|
|
85
|
+
display: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.body {
|
|
89
|
+
flex: 1 1 auto;
|
|
90
|
+
min-height: 0;
|
|
91
|
+
overflow-y: auto;
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-direction: column;
|
|
94
|
+
gap: var(--nile-spacing-xl, var(--ng-spacing-xl));
|
|
95
|
+
padding: var(--nile-spacing-xl, var(--ng-spacing-xl));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
:host([no-padding]) .body {
|
|
99
|
+
padding: 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.footer {
|
|
103
|
+
flex: 0 0 auto;
|
|
104
|
+
padding: var(--nile-spacing-xl, var(--ng-spacing-xl));
|
|
105
|
+
border-top: var(--nile-border-width-1, var(--ng-border-width-1)) solid
|
|
106
|
+
var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
:host(:not([has-footer])) .footer {
|
|
110
|
+
display: none;
|
|
111
|
+
}
|
|
112
|
+
`;
|
|
113
|
+
|
|
114
|
+
export default [styles];
|
|
@@ -0,0 +1,161 @@
|
|
|
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
|
+
|
|
8
|
+
import { html, CSSResultArray, TemplateResult } from 'lit';
|
|
9
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
10
|
+
import { styles } from './nile-app-shell-panel.css';
|
|
11
|
+
import { renderGlyph } from '../internal/glyph';
|
|
12
|
+
import { AppShellController } from '../nile-app-shell/shell-controller';
|
|
13
|
+
import '../nile-button/nile-button';
|
|
14
|
+
import NileElement from '../internal/nile-element';
|
|
15
|
+
import type { NileAppShellPanelMode } from '../nile-app-shell/nile-app-shell';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @summary The shell's right region — the AI assistant panel. Assigns itself to
|
|
19
|
+
* the shell's `panel` slot and takes over the panel chrome: heading, actions,
|
|
20
|
+
* close button, scroll region and composer footer. The shell keeps the geometry
|
|
21
|
+
* — 480px docked, an overlay drawer when narrow — and the open/closed state.
|
|
22
|
+
*
|
|
23
|
+
* @status stable
|
|
24
|
+
* @since 2.0
|
|
25
|
+
*
|
|
26
|
+
* @tag nile-app-shell-panel
|
|
27
|
+
*
|
|
28
|
+
* @dependency nile-app-shell
|
|
29
|
+
* @dependency nile-glyph
|
|
30
|
+
*
|
|
31
|
+
* @slot - The panel body. Scrolls.
|
|
32
|
+
* @slot header - Replaces the default heading (mark plus label).
|
|
33
|
+
* @slot actions - Controls added before the close button.
|
|
34
|
+
* @slot footer - A composer, docked below the scroll region.
|
|
35
|
+
*
|
|
36
|
+
* @event nile-close - Emitted when the close button is pressed, after the shell
|
|
37
|
+
* has been told to close. Cancelable is not honoured; listen to it to react,
|
|
38
|
+
* and use `no-close` to own the control yourself.
|
|
39
|
+
*
|
|
40
|
+
* @csspart header - The header bar.
|
|
41
|
+
* @csspart title - The default heading text.
|
|
42
|
+
* @csspart actions - The header action group.
|
|
43
|
+
* @csspart close - The close button.
|
|
44
|
+
* @csspart body - The scrolling body.
|
|
45
|
+
* @csspart footer - The footer.
|
|
46
|
+
*/
|
|
47
|
+
@customElement('nile-app-shell-panel')
|
|
48
|
+
export class NileAppShellPanel extends NileElement {
|
|
49
|
+
public static get styles(): CSSResultArray {
|
|
50
|
+
return [styles];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private shellLink = new AppShellController(this);
|
|
54
|
+
|
|
55
|
+
/** The heading, and the accessible name of the region. */
|
|
56
|
+
@property({ type: String })
|
|
57
|
+
label: string = 'Ask Aquera';
|
|
58
|
+
|
|
59
|
+
/** Drops the header bar entirely. */
|
|
60
|
+
@property({ type: Boolean, reflect: true, attribute: 'no-header' })
|
|
61
|
+
noHeader: boolean = false;
|
|
62
|
+
|
|
63
|
+
/** Drops the close button — for a panel the page closes its own way. */
|
|
64
|
+
@property({ type: Boolean, reflect: true, attribute: 'no-close' })
|
|
65
|
+
noClose: boolean = false;
|
|
66
|
+
|
|
67
|
+
/** Removes the body's padding, for a full-bleed transcript. */
|
|
68
|
+
@property({ type: Boolean, reflect: true, attribute: 'no-padding' })
|
|
69
|
+
noPadding: boolean = false;
|
|
70
|
+
|
|
71
|
+
/** Id of the shell to follow. Defaults to the nearest ancestor. */
|
|
72
|
+
@property({ type: String })
|
|
73
|
+
shell?: string;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Mirrors the shell's panel mode. Set by the shell; treat it as read-only and
|
|
77
|
+
* style against it (`nile-app-shell-panel[mode='overlay']`).
|
|
78
|
+
*/
|
|
79
|
+
@property({ type: String, reflect: true })
|
|
80
|
+
mode: NileAppShellPanelMode = 'docked';
|
|
81
|
+
|
|
82
|
+
@state() private _hasFooter: boolean = false;
|
|
83
|
+
|
|
84
|
+
public connectedCallback(): void {
|
|
85
|
+
super.connectedCallback();
|
|
86
|
+
// Claim the shell's right region unless the author placed it elsewhere.
|
|
87
|
+
if (!this.hasAttribute('slot')) this.setAttribute('slot', 'panel');
|
|
88
|
+
if (!this.hasAttribute('role')) this.setAttribute('role', 'complementary');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
protected willUpdate(): void {
|
|
92
|
+
this.shellLink.shellId = this.shell;
|
|
93
|
+
const shell = this.shellLink.shell;
|
|
94
|
+
if (shell) this.mode = shell.panelMode;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
protected updated(): void {
|
|
98
|
+
this.toggleAttribute('has-footer', this._hasFooter);
|
|
99
|
+
this.setAttribute('aria-label', this.label);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Close the panel through the shell. */
|
|
103
|
+
public close(): void {
|
|
104
|
+
this.shellLink.shell?.closePanel();
|
|
105
|
+
this.emit('nile-close');
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private handleFooterSlotChange(event: Event): void {
|
|
109
|
+
this._hasFooter = (event.target as HTMLSlotElement)
|
|
110
|
+
.assignedNodes({ flatten: true })
|
|
111
|
+
.some(
|
|
112
|
+
node =>
|
|
113
|
+
node.nodeType === Node.ELEMENT_NODE ||
|
|
114
|
+
(node.textContent ?? '').trim() !== ''
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
public render(): TemplateResult {
|
|
119
|
+
return html`
|
|
120
|
+
<header class="header" part="header">
|
|
121
|
+
<slot name="header">
|
|
122
|
+
<span class="heading">
|
|
123
|
+
<span class="mark">${renderGlyph('ng-sparkles', 20, 'currentColor')}</span>
|
|
124
|
+
<h2 class="title" part="title">${this.label}</h2>
|
|
125
|
+
</span>
|
|
126
|
+
</slot>
|
|
127
|
+
<div class="actions" part="actions">
|
|
128
|
+
<slot name="actions"></slot>
|
|
129
|
+
<nile-button
|
|
130
|
+
class="close"
|
|
131
|
+
part="close"
|
|
132
|
+
variant="ghost"
|
|
133
|
+
circle
|
|
134
|
+
title="Close ${this.label}"
|
|
135
|
+
aria-label="Close ${this.label}"
|
|
136
|
+
@click=${() => this.close()}
|
|
137
|
+
>
|
|
138
|
+
${renderGlyph('ng-x-close', 24, 'currentColor')}
|
|
139
|
+
</nile-button>
|
|
140
|
+
</div>
|
|
141
|
+
</header>
|
|
142
|
+
|
|
143
|
+
<div class="body" part="body"><slot></slot></div>
|
|
144
|
+
|
|
145
|
+
<div class="footer" part="footer">
|
|
146
|
+
<slot
|
|
147
|
+
name="footer"
|
|
148
|
+
@slotchange=${(e: Event) => this.handleFooterSlotChange(e)}
|
|
149
|
+
></slot>
|
|
150
|
+
</div>
|
|
151
|
+
`;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export default NileAppShellPanel;
|
|
156
|
+
|
|
157
|
+
declare global {
|
|
158
|
+
interface HTMLElementTagNameMap {
|
|
159
|
+
'nile-app-shell-panel': NileAppShellPanel;
|
|
160
|
+
}
|
|
161
|
+
}
|