@infinite-canvas-tutorial/webcomponents
Version:
WebComponents UI implementation
64 lines (61 loc) • 2.49 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { html, css, LitElement } from 'lit';
import { customElement } from 'lit/decorators.js';
import { consume } from '@lit/context';
import { apiContext, appStateContext, Task } from '../context';
let PropertiesPanel = class PropertiesPanel extends LitElement {
handleClose() {
this.api.setTaskbars(this.appState.taskbarSelected.filter((task) => task !== Task.SHOW_PROPERTIES_PANEL));
}
render() {
return this.appState.taskbarSelected.includes(Task.SHOW_PROPERTIES_PANEL)
? html `<section>
<h4>
Properties
<sp-action-button quiet size="s" @click=${this.handleClose}>
<sp-icon-close slot="icon"></sp-icon-close>
</sp-action-button>
</h4>
<sp-accordion allow-multiple size="s">
<sp-accordion-item label="Transform"> </sp-accordion-item>
</sp-accordion>
</section>`
: null;
}
};
PropertiesPanel.styles = css `
section {
display: flex;
flex-direction: column;
background: var(--spectrum-gray-100);
border-radius: var(--spectrum-corner-radius-200);
padding: var(--spectrum-global-dimension-size-100);
margin: 4px;
filter: drop-shadow(
var(--spectrum-drop-shadow-color) 0px var(--spectrum-drop-shadow-y)
var(--spectrum-drop-shadow-blur)
);
}
h4 {
display: flex;
align-items: center;
justify-content: space-between;
margin: 0;
}
`;
__decorate([
consume({ context: appStateContext, subscribe: true })
], PropertiesPanel.prototype, "appState", void 0);
__decorate([
consume({ context: apiContext, subscribe: true })
], PropertiesPanel.prototype, "api", void 0);
PropertiesPanel = __decorate([
customElement('ic-spectrum-properties-panel')
], PropertiesPanel);
export { PropertiesPanel };
//# sourceMappingURL=properties-panel.js.map