2023-12-08 18:16:22 +00:00
|
|
|
import {
|
|
|
|
customElement,
|
|
|
|
DeesElement,
|
|
|
|
domtools,
|
|
|
|
type TemplateResult,
|
|
|
|
html,
|
|
|
|
property,
|
|
|
|
type CSSResult,
|
|
|
|
state,
|
|
|
|
css,
|
|
|
|
cssManager,
|
|
|
|
} from '@design.estate/dees-element';
|
|
|
|
|
|
|
|
declare global {
|
|
|
|
interface HTMLElementTagNameMap {
|
|
|
|
'dees-windowcontrols': DeesWindowControls;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@customElement('dees-windowcontrols')
|
|
|
|
export class DeesWindowControls extends DeesElement {
|
2023-12-20 18:09:55 +00:00
|
|
|
// STATIC
|
2023-12-08 18:16:22 +00:00
|
|
|
public static demo = () => html`<dees-windowcontrols></dees-windowcontrols>`;
|
|
|
|
|
2023-12-20 18:09:55 +00:00
|
|
|
// Instance
|
|
|
|
@property({
|
|
|
|
reflect: true,
|
|
|
|
})
|
|
|
|
public type: 'mac' | 'linux' | 'windows' = 'mac';
|
|
|
|
|
|
|
|
@property({
|
|
|
|
reflect: true,
|
|
|
|
})
|
|
|
|
public position: 'left' | 'right' = 'left';
|
|
|
|
|
2023-12-08 18:16:22 +00:00
|
|
|
public static styles = [
|
|
|
|
cssManager.defaultStyles,
|
|
|
|
css`
|
2023-12-20 18:09:55 +00:00
|
|
|
:host {
|
|
|
|
position: relative;
|
|
|
|
display: block;
|
|
|
|
box-sizing: border-box;
|
|
|
|
padding-left: 16px;
|
|
|
|
padding-right: 16px;
|
|
|
|
}
|
|
|
|
|
2023-12-08 18:16:22 +00:00
|
|
|
.windowControls {
|
2023-12-20 18:09:55 +00:00
|
|
|
height: 100%;
|
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
2023-12-08 18:16:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.windowControls div {
|
|
|
|
width: 12px;
|
|
|
|
height: 12px;
|
|
|
|
display: inline-block;
|
|
|
|
border-radius: 50%;
|
|
|
|
margin: 0px;
|
|
|
|
padding: 0px;
|
|
|
|
background: #222222;
|
|
|
|
}
|
|
|
|
|
|
|
|
.windowControls div.close {
|
|
|
|
background: #ff5f57;
|
2023-12-20 18:09:55 +00:00
|
|
|
margin-right: 12px;
|
2023-12-08 18:16:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.windowControls div.toDock {
|
|
|
|
background: #ffbd2e;
|
2023-12-20 18:09:55 +00:00
|
|
|
margin-right: 12px;
|
2023-12-08 18:16:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.windowControls div.minMax {
|
|
|
|
background: #27c93f;
|
|
|
|
}
|
|
|
|
|
|
|
|
.windowControls div:hover {
|
|
|
|
background: #333333;
|
|
|
|
}
|
|
|
|
`,
|
|
|
|
];
|
|
|
|
|
|
|
|
public render(): TemplateResult {
|
|
|
|
return html`
|
2023-12-20 18:09:55 +00:00
|
|
|
${(this.type === 'mac' && this.position === 'left') ||
|
|
|
|
((this.type === 'linux' || this.type === 'windows') && this.position === 'right')
|
|
|
|
? html`
|
|
|
|
<div class="windowControls">
|
|
|
|
<div class="close"></div>
|
|
|
|
<div class="toDock"></div>
|
|
|
|
<div class="minMax"></div>
|
|
|
|
</div>
|
|
|
|
`
|
|
|
|
: html``}
|
2023-12-08 18:16:22 +00:00
|
|
|
`;
|
|
|
|
}
|
|
|
|
}
|