@infinite-canvas-tutorial/webcomponents
Version:
WebComponents UI implementation
66 lines (63 loc) • 2.37 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, property } from 'lit/decorators.js';
import { when } from 'lit/directives/when.js';
let ContextCommonBar = class ContextCommonBar extends LitElement {
render() {
var _a;
const isText = ((_a = this.node) === null || _a === void 0 ? void 0 : _a.type) === 'text';
return html `<ic-spectrum-fill-action-button
.node=${this.node}
></ic-spectrum-fill-action-button>
${when(!isText, () => html `<ic-spectrum-stroke-action-button
.node=${this.node}
></ic-spectrum-stroke-action-button>
<sp-action-button quiet size="m" id="stroke-options">
<sp-tooltip self-managed placement="bottom">
Stroke options
</sp-tooltip>
<sp-icon-stroke-width slot="icon"></sp-icon-stroke-width>
</sp-action-button>
<sp-overlay
trigger="stroke-options@click"
placement="bottom"
type="auto"
>
<sp-popover dialog>
<h4>Stroke options</h4>
<ic-spectrum-stroke-content
.node=${this.node}
></ic-spectrum-stroke-content>
</sp-popover>
</sp-overlay>`)}`;
}
};
ContextCommonBar.styles = css `
:host {
display: flex;
}
sp-popover {
padding: 0;
}
h4 {
margin: 0;
padding: 8px;
padding-bottom: 0;
}
ic-spectrum-stroke-content {
padding: 8px;
}
`;
__decorate([
property()
], ContextCommonBar.prototype, "node", void 0);
ContextCommonBar = __decorate([
customElement('ic-spectrum-context-common-bar')
], ContextCommonBar);
export { ContextCommonBar };
//# sourceMappingURL=context-common-bar.js.map