import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http'; /** * @constant {string} dataRcStylesKey * @description Marks style element as one used by the current RC. */ declare const dataRcStylesStart = "slot"; /** * @constant {string} dataAppStylesKey * @description Marks style element as one containing styles for scopeId (which is based on the application) * Such style sheet contains variables applied globally and CSS scoped to a given scope until style isolation. * (e.g. data-app-styles="onecx-workspace|onecx-workspace-ui") */ declare const dataAppStylesKey = "appStyles"; /** * @constant {string} dataMfeStylesKey * @description Marks style element as one used by the current MFE. */ declare const dataMfeStylesKey = "mfeStyles"; /** * @function dataRcStylesKey * @description Marks style element as one used by any component in a slot given by the SLOT_NAME. * @param {string} slotName - The name of the slot. * @returns {string} The key for the slot styles. */ declare const dataRcStylesKey: (slotName: string) => string; /** * @constant {string} dataShellStylesKey * @description Marks style element as one containing styles for the shell. * Such style sheet contains variables applied globally and CSS scoped to a shell scope until style isolation. */ declare const dataShellStylesKey = "shellStyles"; /** * @constant {string} dataAppStylesAttribute * @description HTML attribute for appStyles. See {@link dataAppStylesKey} for more details. */ declare const dataAppStylesAttribute = "data-app-styles"; /** * @constant {string} dataMfeStylesAttribute * @description HTML attribute for mfeStyles. See {@link dataMfeStylesKey} for more details. */ declare const dataMfeStylesAttribute = "data-mfe-styles"; /** * @function dataRcStylesAttribute * @description HTML attribute for slot styles. See {@link dataRcStylesKey} for more details. * @param {string} slotName - The name of the slot. * @returns {string} The attribute for the slot styles. */ declare const dataRcStylesAttribute: (slotName: string) => string; /** * @constant {string} dataShellStylesAttribute * @description HTML attribute for shellStyles. See {@link dataShellStylesKey} for more details. */ declare const dataShellStylesAttribute = "data-shell-styles"; /** * Returns the count of MFEs and RCs using the style element. * @param styleElement - style element * @returns {number} number of MFEs and RCs using the style element */ declare function getStyleUsageCount(styleElement: HTMLStyleElement): number; /** * Returns formatted string that reflects property name with given slot name * @param slotName - name of the slot hosting * @returns {string} - changed slot name which is a property name */ declare function slotNameToPropertyName(slotName: string): string; /** * Check if style is used by MFE. * @param styleElement - style element to check * @returns {boolean} if style is used by the MFE */ declare function isStyleUsedByMfe(styleElement: HTMLElement): boolean; /** * Returns the count of RCs using a given style element. * @param styleElement - style element to check * @returns {number} the count of RCs using a given style element */ declare function getStyleUsageCountForRc(styleElement: HTMLStyleElement): number; /** * Returns all style elements with styles registered with attribute key * @param key - style attribute key associated with html element style * @returns {HTMLStyleElement[]} - a list of html elements with matching attribute key */ declare function getAllStylesUsedByKey(key: string): HTMLStyleElement[]; /** * Removes the MFE from list of users of the style element. * @param styleElement - style element to modify */ declare function removeMfeUsageFromStyle(styleElement: HTMLStyleElement): void; /** * Removes the RC from list of users of the style element. * @param styleElement - style element to modify * @param slotName - name of the slot hosting the RC */ declare function removeRcUsageFromStyle(styleElement: HTMLStyleElement, slotName: string): void; /** * Registers the RC as a user of the style element. * @param styleElement - style element to register for * @param slotName - name of the slot hosting the RC */ declare function useStyleForRc(styleElement: HTMLStyleElement, slotName: string): void; /** * Registers the MFE as a user of the style element. * @param styleElement - style element to modify */ declare function useStyleForMfe(styleElement: HTMLStyleElement): void; /** * Creates new style sheet with given content and optional dataset attributes and appends it to the document head. * @param content - content for new style sheet * @param datasetAttributes - attributes to add to new style element * @returns {HTMLStyleElement} new style element */ declare function addStyleToHead(content: string, datasetAttributes?: { [key: string]: string; }): HTMLStyleElement; /** * Replaces content of a given style element. * @param selectorOrElement - selector for a style element or exact element * @param content - content to be put in the style element * @returns {HTMLStyleElement} updated style element */ declare function replaceStyleContent(selectorOrElement: string | HTMLStyleElement, content: string): HTMLStyleElement | null; /** * Creates new style element and register MFE or RC as the user of it * @param scopeId - scope id related to the app * @param options - registration options * @returns {HTMLStyleElement} style element with MFE or RC registered */ declare function createStyleUsedByMfeRc(scopeId: string, options: { type: 'rc'; slotName: string; } | { type: 'mfe'; }): HTMLStyleElement; /** * Get the style element with application styles based on a scope. * @param scopeId - scope id related to the app * @returns {HTMLStyleElement | null} the style element related for a given scope */ declare function getAppStyleByScope(scopeId: string): HTMLStyleElement | null; /** * Replace ":root" selector with ":scope" for a given css. * * :scope === :root if "@scope" is not used * :scope === top level element of the scope if "@scope" is used * @param css - css text to transform * @returns {string} css with replaced selector */ declare function replaceRootWithScope(css: string): string; /** * Replace "html" and ":root" selector with ":scope" for a given css. * * :scope === :root if "@scope" is not used * :scope === top level element of the scope if "@scope" is used * @param css - css text to transform * @returns {string} css with replaced selector */ declare function replaceRootAndHtmlWithScope(css: string): string; /** * Creates a string with application scoped css. The scope will apply the css to the element with given scopeId that has dataNoPortalLayoutStylesAttribute or dataMfeElementAttribute and will be available until element with dataStyleIsolationAttribute. * @param css - css for scoping * @param scopeId - scope id for scoping * @returns {string} css scoped by the given id */ declare function createApplicationScopedCss(css: string, scopeId: string): string; /** * Update page styles. * * It removes old mfe usages and unused style elements. * Loads and creates new style element with MFE application styles css and registers the MFE for the usage. * If style element for the MFE application is already created, it only registers for the usage. * * @param productName - product name MFE belongs to * @param appId - id of the application MFE belongs to * @param httpClient - http client to make requests * @param mfeUrl - url of the MFE application to make requests */ declare function updateStylesForMfeChange(productName: string, appId: string, httpClient: HttpClient, mfeUrl: string): void; /** * Update page styles. * * Loads and creates new style element with RC application styles css and registers the RC for the usage. * If style element for the RC application is already created, it only registers for the usage. * @param productName - product name RC belongs to * @param appId - id of the application RC belongs to * @param httpClient - http client to make requests * @param rcUrl - url of the RC application to make requests * @param slotName - name of the slot hosting the RC */ declare function updateStylesForRcCreation(productName: string, appId: string, httpClient: HttpClient, rcUrl: string, slotName: string): void; /** * Removes usages for all MFEs not related to the given scope. * * This will remove the style element completely if no other active users are present. * * @param scopeId - id of the scope to not deactivate */ declare function removeAllMfeUsagesFromStyles(scopeId: string): void; /** * Update page styles. * * Remove usages of the RC from the style elements it is register for. * If usage removal leads to style element not being used by any MFE or RC its removed from the page. * @param scopeId - id of the scope to not deactivate * @param slotName - name of the slot hosting the RC */ declare function removeAllRcUsagesFromStyles(scopeId: string, slotName: string): void; /** * Fetches the css for an application. * @param http - http client for making requests * @param appUrl - url of the application used for making requests * @returns {Promise} application css content */ declare function fetchAppCss(http: HttpClient, appUrl: string): Promise; /** * Creates HttpHeaders for Css request. */ declare function createCssRequestHeaders(): HttpHeaders; /** * Returns if response is valid css. * @param response - response to validate * @returns {boolean} if response is valid css */ declare function isResponseValidCss(response: HttpResponse): boolean | undefined; export { addStyleToHead, createApplicationScopedCss, createCssRequestHeaders, createStyleUsedByMfeRc, dataAppStylesAttribute, dataAppStylesKey, dataMfeStylesAttribute, dataMfeStylesKey, dataRcStylesAttribute, dataRcStylesKey, dataRcStylesStart, dataShellStylesAttribute, dataShellStylesKey, fetchAppCss, getAllStylesUsedByKey, getAppStyleByScope, getStyleUsageCount, getStyleUsageCountForRc, isResponseValidCss, isStyleUsedByMfe, removeAllMfeUsagesFromStyles, removeAllRcUsagesFromStyles, removeMfeUsageFromStyle, removeRcUsageFromStyle, replaceRootAndHtmlWithScope, replaceRootWithScope, replaceStyleContent, slotNameToPropertyName, updateStylesForMfeChange, updateStylesForRcCreation, useStyleForMfe, useStyleForRc };