,
) {
super.willUpdate(changedProperties);
// Handle Cell subscription before render so first render has correct value
if (changedProperties.has("content")) {
// Clean up previous subscription
if (this._unsubscribe) {
this._unsubscribe();
this._unsubscribe = null;
}
// Subscribe to new Cell if it's a Cell
if (this.content && isCellHandle(this.content)) {
this._unsubscribe = this.content.subscribe(() => {
this.requestUpdate();
});
}
}
}
override disconnectedCallback() {
super.disconnectedCallback();
if (this._unsubscribe) {
this._unsubscribe();
this._unsubscribe = null;
}
}
override render() {
const contentValue = this._getContentValue();
return html`
${unsafeHTML(sanitizeSvg(contentValue))}
`;
}
}
globalThis.customElements.define("ct-svg", CTSvg);