@schukai/monster
Version:
Monster is a simple library for creating fast, robust and lightweight websites.
81 lines (72 loc) • 2.01 kB
JavaScript
/**
* Copyright © Volker Schukai and all contributing authors, {{copyRightYear}}. All rights reserved.
* Node module: @schukai/monster
*
* This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
* The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
*
* For those who do not wish to adhere to the AGPLv3, a commercial license is available.
* Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
* For more information about purchasing a commercial license, please contact Volker Schukai.
*
* SPDX-License-Identifier: AGPL-3.0
*/
import { instanceSymbol } from "../../../constants.mjs";
import {
CustomElement,
registerCustomElement,
} from "../../../dom/customelement.mjs";
import { ThreadMessageStyleSheet } from "../stylesheet/thread-message.mjs";
export { ThreadMessage };
/**
* The ThreadMessage component encapsulates a message in a shadow root
* to prevent list styling from the thread control from leaking in.
*
* @summary Isolated message content for thread entries.
*/
class ThreadMessage extends CustomElement {
/**
* This method is called by the `instanceof` operator.
* @return {symbol}
*/
static get [instanceSymbol]() {
return Symbol.for(
"@schukai/monster/components/state/thread-message@@instance",
);
}
/**
* @return {object}
*/
get defaults() {
return Object.assign({}, super.defaults, {
content: "",
templates: {
main: getTemplate(),
},
});
}
/**
* @return {string}
*/
static getTag() {
return "monster-thread-message";
}
/**
* @return {CSSStyleSheet[]}
*/
static getCSSStyleSheet() {
return [ThreadMessageStyleSheet];
}
}
/**
* @private
* @return {string}
*/
function getTemplate() {
// language=HTML
return `
<div data-monster-role="content" part="content"
data-monster-replace="path:content"></div>
`;
}
registerCustomElement(ThreadMessage);