export class Space extends HTMLElement {
scale: (number | string)[] | Record;
constructor() {
super();
this.scale = [];
}
connectedCallback() {
const scaleValues = (
Array.isArray(this.scale)
? this.scale.map((s, i) => [i, s])
: Object.keys(this.scale).map((k) => [k, this.scale[k]])
).map(([k, v]) => [k, typeof v === 'number' ? `${v}px` : v]);
const cells = scaleValues
.map(
([name, value]) => /*html*/ `
| ${name} |
${value} |
|
`
)
.join(' ');
this.innerHTML = /*html*/ `
`;
}
}