artistic-elements
Version:
artistic web components
65 lines (62 loc) • 1.4 kB
JavaScript
import {
__decorateClass,
e,
e2,
i,
s,
y
} from "./chunk.FMUK5F65.js";
// src/artistic/doughnut.ts
var ArtisticDoughnut = class extends s {
constructor() {
super(...arguments);
this.diameter = 10;
this.lineWidth = 1;
this.color = "#f0f";
this.top = "0";
this.left = "0";
}
render() {
const size = this.diameter - this.lineWidth * 2;
const style = `
width: ${size}rem;
height: ${size}rem;
border: solid ${this.lineWidth}rem ${this.color};
${this.top !== "0" || this.left !== "0" ? "position: absolute;" : ""}
${this.top !== "0" ? `top: ${this.top};` : ""}
${this.left !== "0" ? `left: ${this.left};` : ""}
`;
return y`<div style="${style}">
<slot></slot>
</div>`;
}
};
ArtisticDoughnut.styles = i`
div {
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
`;
__decorateClass([
e2()
], ArtisticDoughnut.prototype, "diameter", 2);
__decorateClass([
e2()
], ArtisticDoughnut.prototype, "lineWidth", 2);
__decorateClass([
e2()
], ArtisticDoughnut.prototype, "color", 2);
__decorateClass([
e2()
], ArtisticDoughnut.prototype, "top", 2);
__decorateClass([
e2()
], ArtisticDoughnut.prototype, "left", 2);
ArtisticDoughnut = __decorateClass([
e("artistic-doughnut")
], ArtisticDoughnut);
export {
ArtisticDoughnut
};