@infinite-canvas-tutorial/webcomponents
Version:
WebComponents UI implementation
69 lines (66 loc) • 2.6 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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContextCommonBar = void 0;
const lit_1 = require("lit");
const decorators_js_1 = require("lit/decorators.js");
const when_js_1 = require("lit/directives/when.js");
let ContextCommonBar = class ContextCommonBar extends lit_1.LitElement {
render() {
var _a;
const isText = ((_a = this.node) === null || _a === void 0 ? void 0 : _a.type) === 'text';
return (0, lit_1.html) `<ic-spectrum-fill-action-button
.node=${this.node}
></ic-spectrum-fill-action-button>
${(0, when_js_1.when)(!isText, () => (0, lit_1.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>`)}`;
}
};
exports.ContextCommonBar = ContextCommonBar;
ContextCommonBar.styles = (0, lit_1.css) `
:host {
display: flex;
}
sp-popover {
padding: 0;
}
h4 {
margin: 0;
padding: 8px;
padding-bottom: 0;
}
ic-spectrum-stroke-content {
padding: 8px;
}
`;
__decorate([
(0, decorators_js_1.property)()
], ContextCommonBar.prototype, "node", void 0);
exports.ContextCommonBar = ContextCommonBar = __decorate([
(0, decorators_js_1.customElement)('ic-spectrum-context-common-bar')
], ContextCommonBar);
//# sourceMappingURL=context-common-bar.js.map