artistic-elements
Version:
artistic web components
65 lines (64 loc) • 2.38 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';
let ArtisticTriangleRectangle = class ArtisticTriangleRectangle extends LitElement {
constructor() {
super(...arguments);
this.width = 10;
this.height = 10;
this.borderStyle = 'solid';
this.topColor = '#f0f';
this.rightColor = '#0f0';
this.bottomColor = '#ff0';
this.leftColor = '#00f';
}
render() {
const style = `
border-width: ${this.height / 2}rem ${this.width / 2}rem ${this.height / 2}rem ${this.width / 2}rem;
border-style: ${this.borderStyle};
border-top-color: ${this.topColor};
border-right-color: ${this.rightColor};
border-bottom-color: ${this.bottomColor};
border-left-color: ${this.leftColor};
`;
return html `<div style="${style}">
<slot></slot>
</div>`;
}
};
ArtisticTriangleRectangle.styles = css `
div {
width: 0;
height: 0;
}
`;
__decorate([
property()
], ArtisticTriangleRectangle.prototype, "width", void 0);
__decorate([
property()
], ArtisticTriangleRectangle.prototype, "height", void 0);
__decorate([
property()
], ArtisticTriangleRectangle.prototype, "borderStyle", void 0);
__decorate([
property()
], ArtisticTriangleRectangle.prototype, "topColor", void 0);
__decorate([
property()
], ArtisticTriangleRectangle.prototype, "rightColor", void 0);
__decorate([
property()
], ArtisticTriangleRectangle.prototype, "bottomColor", void 0);
__decorate([
property()
], ArtisticTriangleRectangle.prototype, "leftColor", void 0);
ArtisticTriangleRectangle = __decorate([
customElement('artistic-triangle-rectangle')
], ArtisticTriangleRectangle);
export { ArtisticTriangleRectangle };