Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3a6ef2f
Begin work on Common OS skeleton
gordonbrander Sep 26, 2024
af00def
Add common-ui
gordonbrander Sep 26, 2024
80f5713
Update sidebar
gordonbrander Sep 26, 2024
7c17261
Stub ooout some dummy items in sidebar
gordonbrander Sep 26, 2024
f11bb28
Add more scaffolding, incl scene layout
gordonbrander Sep 26, 2024
a1e0e13
Stub in buttons, change prefix to os-
gordonbrander Sep 26, 2024
f5ed90b
Stub in scrolling sidebar
gordonbrander Sep 26, 2024
87d94e3
Add icon button active state
gordonbrander Sep 26, 2024
e978a5e
Add gap to sidebar content items
gordonbrander Sep 26, 2024
bf51c59
Reworking font styles a bit
gordonbrander Sep 26, 2024
80d73b8
Add location pill
gordonbrander Sep 26, 2024
06680e4
Add Material Icon component
gordonbrander Sep 27, 2024
ab0d2bd
Fine-tune icon font
gordonbrander Sep 27, 2024
8db03a3
Add hover state to location
gordonbrander Sep 27, 2024
18f2992
Refine label styles and sidebar group spacing
gordonbrander Sep 27, 2024
b9ea9b3
Stub in sidebar states for os-scene
gordonbrander Sep 27, 2024
4c99db8
Wire up show/hide sidebar to button
gordonbrander Sep 27, 2024
3777fb7
Add activated property
gordonbrander Sep 30, 2024
3bc6a2d
Refine open/close animation
gordonbrander Sep 30, 2024
68f571d
Rename os-scene to os-chrome
gordonbrander Sep 30, 2024
db89ac3
Simplify CSS variable naming convention
gordonbrander Sep 30, 2024
e9e92b3
Allow specifying location title
gordonbrander Sep 30, 2024
4bc6d5d
Work around broken container queries vs slots
gordonbrander Oct 1, 2024
1db1fec
Remove unused import
gordonbrander Oct 1, 2024
d9a6597
Allow container to get wider
gordonbrander Oct 1, 2024
469ed75
Add CSS transition util
gordonbrander Oct 1, 2024
fe35698
Support modal sidebar with os-navstack
gordonbrander Oct 1, 2024
b67f4a3
Stub in os-fab
gordonbrander Oct 2, 2024
ad37c87
Add hover state to fab and bubbles
gordonbrander Oct 2, 2024
9bd5409
Add pinned charm group components
gordonbrander Oct 2, 2024
d101182
Add cursor-pointer to bubble
gordonbrander Oct 2, 2024
b44cfd7
Undock and overlap sidebar at small screen sizes
gordonbrander Oct 2, 2024
41264d9
Sidebar now supports splitscreen attr
gordonbrander Oct 3, 2024
2e173f3
Change sidebar attribute to wide
gordonbrander Oct 3, 2024
070f165
Add dialog component
gordonbrander Oct 3, 2024
0f333bb
Add dialog component
gordonbrander Oct 3, 2024
286e53c
Rename numbered vars for consistency
gordonbrander Oct 3, 2024
fd29437
Make icon sizeable
gordonbrander Oct 3, 2024
05dce26
Make AI icon sizeable
gordonbrander Oct 3, 2024
32cb071
Add charm chips and demo dialog box
gordonbrander Oct 3, 2024
496232a
Set cursor pointer on charm chip
gordonbrander Oct 3, 2024
0957b05
Set safe area for dialog left/right at small size
gordonbrander Oct 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Support modal sidebar with os-navstack
Navstack pushes groups of panels without any animation, but dismisses
them with a back-stack-like slide-off-of-screen animation.

- Introduce animation utils
- Remove os-toolbar, move .toolbar to shared styles. We ended up needing
  this flexibility.
- Introduce navpanel as a scrollable content view with a toolbar.
  • Loading branch information
gordonbrander committed Oct 1, 2024
commit fe35698f7ecef9d4589e9af42d01bce08b35a8f5
263 changes: 133 additions & 130 deletions typescript/packages/common-os-ui/index.html

Large diffs are not rendered by default.

98 changes: 41 additions & 57 deletions typescript/packages/common-os-ui/src/components/os-chrome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,12 @@ export class OsChrome extends LitElement {
height: 100vh;

.chrome-sidebar-inner {
display: grid;
grid-template-rows: auto 1fr;
display: block;
/* Set fixed width on inner element to prevent text reflow on
sidebar animation. */
width: var(--sidebar-width);
/* Needed to correctly trigger scrolling in sidebar main */
height: 100vh;
}

.chrome-sidebar-content {
overflow-x: hidden;
overflow-y: auto;
}
}

/* Sidebar animation */
Expand All @@ -89,56 +82,25 @@ export class OsChrome extends LitElement {
grid-template-columns: 1fr 1fr;
}
}

.toolbar {
height: var(--toolbar-height);
display: grid;
grid-template-columns: auto 1fr auto;
grid-template-areas: "start center end";
align-items: center;
gap: var(--gap-sm);
padding-left: var(--pad);
padding-right: var(--pad);

.toolbar-start {
grid-area: start;
display: flex;
gap: var(--button-gap);
align-items: center;
justify-content: flex-start;
}

.toolbar-end {
grid-area: end;
display: flex;
gap: var(--button-gap);
align-items: center;
justify-content: flex-end;
}

.toolbar-center {
grid-area: center;
display: flex;
gap: var(--button-gap);
align-items: center;
justify-content: center;
}
}
`,
];

@property({ type: String }) locationtitle = "";
@property({ type: Boolean, reflect: true }) sidebar = true;

override render() {
const onSidebarClose = () => {
this.sidebar = false;
};

const onSidebarButton = () => {
this.sidebar = !this.sidebar;
};

return html`
<div class="chrome">
<div class="chrome" @sidebarclose="${onSidebarClose}">
<section class="chrome-main">
<nav class="chrome-main-toolbar toolbar">
<nav class="chrome-main-toolbar toolbar pad-h">
<div class="toolbar-start"></div>
<div class="toolbar-center">
<os-location locationtitle="${this.locationtitle}"></os-location>
Expand All @@ -162,21 +124,43 @@ export class OsChrome extends LitElement {
</section>
<aside class="chrome-sidebar">
<div class="chrome-sidebar-inner">
<nav class="chrome-sidebar-toolbar toolbar">
<div class="toolbar-end gap-sm hstack">
<slot name="sidebar-toolbar"></slot>
<os-icon-button
@click="${onSidebarButton}"
icon="close"
></os-icon-button>
</div>
</nav>
<div class="chrome-sidebar-content">
<slot name="sidebar"></slot>
</div>
<slot name="sidebar"></slot>
</div>
</aside>
</div>
`;
}
}

export class SidebarCloseEvent extends Event {
constructor() {
super("sidebarclose", {
bubbles: true,
composed: true,
});
}
}

@customElement("os-sidebar-close-button")
export class OsCloseButton extends LitElement {
static override styles = [
css`
:host {
display: block;
width: fit-content;
height: fit-content;
}
`,
];

override render() {
const onClick = () => {
this.dispatchEvent(new SidebarCloseEvent());
};

return html`<os-icon-button
@click="${onClick}"
icon="close"
></os-icon-button>`;
}
}
53 changes: 53 additions & 0 deletions typescript/packages/common-os-ui/src/components/os-navpanel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { LitElement, html, css } from "lit";
import { customElement } from "lit/decorators.js";
import { base } from "../shared/styles.js";

@customElement("os-navpanel")
export class OsNavpanel extends LitElement {
static override styles = [
base,
css`
:host {
--panel-bg: var(--bg-2);
--toolbar-height: calc(var(--u) * 24);
display: block;
width: 100%;
height: 100%;
}

.navpanel {
background-color: var(--panel-bg);
display: grid;
grid-template-rows: auto 1fr;
width: 100%;
height: 100%;
overflow: hidden;
}

.navpanel-content {
width: 100%;
height: 100%;
overflow-x: hidden;
overflow-y: scroll;
}
`,
];

override render() {
return html`
<div class="navpanel">
<nav class="navpanel-toolbar toolbar pad-h">
<div class="toolbar-start gap-sm hstack">
<slot name="toolbar-start"></slot>
</div>
<div class="toolbar-end gap-sm hstack">
<slot name="toolbar-end"></slot>
</div>
</nav>
<div class="navpanel-content vstack gap pad-h">
<slot></slot>
</div>
</div>
`;
}
}
133 changes: 133 additions & 0 deletions typescript/packages/common-os-ui/src/components/os-navstack.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
import { LitElement, html, css } from "lit";
import { customElement, property } from "lit/decorators.js";
import {
setTransitions,
transition,
durationMd,
cubicBezierCss,
easeOutCubic,
easeOutExpo,
} from "../shared/animation.js";

@customElement("os-navstack")
export class OsNavstack extends LitElement {
static override styles = css`
:host {
display: block;
width: 100%;
height: 100%;
}

.navstack {
width: 100%;
height: 100%;
position: relative;
}

.navstack-root {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
}

.navstack-panels {
top: 0;
left: 0;
right: 0;
bottom: 0;
position: absolute;
z-index: 2;
pointer-events: none;

> * {
overflow-x: hidden;
overflow-y: scroll;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
pointer-events: all;
}
}
`;

@property({ type: Array<HTMLElement> })
panels: Array<HTMLElement> = [];

override render() {
const onNavBack = (_: NavBackEvent) => {
this.back();
};

return html`
<div @navback=${onNavBack} class="navstack">
<div class="navstack-root">
<slot></slot>
</div>
<div class="navstack-panels">${this.panels}</div>
</div>
`;
}

async back() {
const panels = [...this.panels];
let lastPanel = panels.at(-1);
if (!lastPanel) {
return;
}
await setTransitions(lastPanel, [
transition({
property: "left",
duration: durationMd,
easing: cubicBezierCss(easeOutCubic),
value: `480px`,
}),
transition({
property: "opacity",
duration: durationMd,
delay: 100,
easing: cubicBezierCss(easeOutExpo),
value: `0`,
}),
]);
panels.pop();
this.panels = panels;
}
}

/**
* Custom event for back in a navigational context
*/
export class NavBackEvent extends Event {
constructor() {
super("navback", { bubbles: true, composed: true });
}
}

@customElement("os-nav-back-button")
export class OsNavBackButton extends LitElement {
static override styles = [
css`
:host {
display: block;
width: fit-content;
height: fit-content;
}
`,
];

override render() {
const onClick = () => {
this.dispatchEvent(new NavBackEvent());
};

return html`<os-icon-button
@click="${onClick}"
icon="arrow_back"
></os-icon-button>`;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,6 @@ import { LitElement, css, html } from "lit-element";
import { customElement } from "lit/decorators.js";
import { base } from "../shared/styles.js";

@customElement("os-sidebar")
export class OsSidebar extends LitElement {
static override styles = [
base,
css`
:host {
display: block;
}

.sidebar {
padding: var(--pad);
display: flex;
flex-direction: column;
gap: var(--gap);
}
`,
];

override render() {
return html`
<aside class="sidebar">
<slot></slot>
</aside>
`;
}
}

@customElement("os-sidebar-group")
export class OsSidebarGroup extends LitElement {
static override styles = [
Expand Down
Loading