@kontent-ai/smart-link
Version:
Kontent.ai Smart Link SDK allowing to automatically inject [smart links](https://docs.kontent.ai/tutorials/develop-apps/build-strong-foundation/set-up-editing-from-preview#a-using-smart-links) to Kontent.ai according to manually specified [HTML data attri
35 lines • 1.49 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.defineAllRequiredWebComponents = defineAllRequiredWebComponents;
exports.isElementWebComponent = isElementWebComponent;
const KSLAddButtonElement_1 = require("./KSLAddButtonElement");
const KSLButtonElement_1 = require("./KSLButtonElement");
const KSLContainerElement_1 = require("./KSLContainerElement");
const KSLHighlightElement_1 = require("./KSLHighlightElement");
const KSLIconElement_1 = require("./KSLIconElement");
const KSLPopoverElement_1 = require("./KSLPopoverElement");
const KSLTooltipElement_1 = require("./KSLTooltipElement");
const webComponents = [
KSLIconElement_1.KSLIconElement,
KSLButtonElement_1.KSLButtonElement,
KSLAddButtonElement_1.KSLAddButtonElement,
KSLHighlightElement_1.KSLHighlightElement,
KSLContainerElement_1.KSLContainerElement,
KSLTooltipElement_1.KSLTooltipElement,
KSLPopoverElement_1.KSLPopoverElement,
];
const webComponentTags = webComponents.map((component) => component.is);
/**
* Define all web components if it is possible.
*/
function defineAllRequiredWebComponents() {
const allDefined = webComponents.map(async (webComponent) => await webComponent.define());
return Promise.all(allDefined);
}
/**
* Check if element is a web component based on its tag name.
*/
function isElementWebComponent(element) {
return webComponentTags.includes(element.tagName.toLowerCase());
}
//# sourceMappingURL=components.js.map