{"version":3,"file":"onecx-angular-utils-style.mjs","sources":["../../../../libs/angular-utils/style/src/api/constants.ts","../../../../libs/angular-utils/style/src/utils/app-styles-usage.utils.ts","../../../../libs/angular-utils/style/src/utils/dom-style.utils.ts","../../../../libs/angular-utils/style/src/utils/app-styles-scope.utils.ts","../../../../libs/angular-utils/style/src/utils/app-styles-lifecycle.utils.ts","../../../../libs/angular-utils/style/src/utils/logger.utils.ts","../../../../libs/angular-utils/style/src/utils/fetch-app-css.util.ts","../../../../libs/angular-utils/style/src/index.ts","../../../../libs/angular-utils/style/src/onecx-angular-utils-style.ts"],"sourcesContent":["/**\n * @constant {string} dataRcStylesKey\n * @description Marks style element as one used by the current RC.\n */\nexport const dataRcStylesStart = 'slot'\n\n/**\n * @constant {string} dataAppStylesKey\n * @description Marks style element as one containing styles for scopeId (which is based on the application)\n * Such style sheet contains variables applied globally and CSS scoped to a given scope until style isolation.\n * (e.g. data-app-styles=\"onecx-workspace|onecx-workspace-ui\")\n */\nexport const dataAppStylesKey = 'appStyles'\n\n/**\n * @constant {string} dataMfeStylesKey\n * @description Marks style element as one used by the current MFE.\n */\nexport const dataMfeStylesKey = 'mfeStyles'\n\n/**\n * @function dataRcStylesKey\n * @description Marks style element as one used by any component in a slot given by the SLOT_NAME.\n * @param {string} slotName - The name of the slot.\n * @returns {string} The key for the slot styles.\n */\nexport const dataRcStylesKey = (slotName: string) =>\n  `${dataRcStylesStart}${slotName.replace(slotName.charAt(0), slotName.charAt(0).toUpperCase())}Styles`\n\n/**\n * @constant {string} dataShellStylesKey\n * @description Marks style element as one containing styles for the shell.\n * Such style sheet contains variables applied globally and CSS scoped to a shell scope until style isolation.\n */\nexport const dataShellStylesKey = 'shellStyles'\n\n/**\n * @constant {string} dataAppStylesAttribute\n * @description HTML attribute for appStyles. See {@link dataAppStylesKey} for more details.\n */\nexport const dataAppStylesAttribute = 'data-app-styles'\n\n/**\n * @constant {string} dataMfeStylesAttribute\n * @description HTML attribute for mfeStyles. See {@link dataMfeStylesKey} for more details.\n */\nexport const dataMfeStylesAttribute = 'data-mfe-styles'\n\n/**\n * @function dataRcStylesAttribute\n * @description HTML attribute for slot styles. See {@link dataRcStylesKey} for more details.\n * @param {string} slotName - The name of the slot.\n * @returns {string} The attribute for the slot styles.\n */\nexport const dataRcStylesAttribute = (slotName: string) => `data-${dataRcStylesStart}-${slotName}-styles`\n\n/**\n * @constant {string} dataShellStylesAttribute\n * @description HTML attribute for shellStyles. See {@link dataShellStylesKey} for more details.\n */\nexport const dataShellStylesAttribute = 'data-shell-styles'","import { dataMfeStylesKey, dataRcStylesKey, dataRcStylesStart } from '../index'\n/**\n * Returns the count of MFEs and RCs using the style element.\n * @param styleElement - style element\n * @returns {number} number of MFEs and RCs using the style element\n */\nexport function getStyleUsageCount(styleElement: HTMLStyleElement): number {\n  let usages = 0\n  if (isStyleUsedByMfe(styleElement)) usages++\n  usages += getStyleUsageCountForRc(styleElement)\n  return usages\n}\n\n/**\n * Returns formatted string that reflects property name with given slot name\n * @param slotName - name of the slot hosting\n * @returns {string} - changed slot name which is a property name\n */\nexport function slotNameToPropertyName(slotName: string) : string{\n  return slotName.replace(/-([a-z])/g, (match, letter) => letter.toUpperCase())\n}\n\n/**\n * Check if style is used by MFE.\n * @param styleElement - style element to check\n * @returns {boolean} if style is used by the MFE\n */\nexport function isStyleUsedByMfe(styleElement: HTMLElement): boolean {\n  return styleElement.dataset[dataMfeStylesKey] !== undefined\n}\n\n/**\n * Returns the count of RCs using a given style element.\n * @param styleElement - style element to check\n * @returns {number} the count of RCs using a given style element\n */\nexport function getStyleUsageCountForRc(styleElement: HTMLStyleElement): number {\n  return Object.keys(styleElement.dataset).filter((key) => key.startsWith(dataRcStylesStart)).length\n}\n\n/**\n * Returns all style elements with styles registered with attribute key\n * @param key - style attribute key associated with html element style\n * @returns {HTMLStyleElement[]} - a list of html elements with matching attribute key\n */\nexport function getAllStylesUsedByKey(key: string): HTMLStyleElement[] {\n  return Array.from(document.head.querySelectorAll<HTMLStyleElement>(`style[${key}]`))\n}\n\n/**\n * Removes the MFE from list of users of the style element.\n * @param styleElement - style element to modify\n */\nexport function removeMfeUsageFromStyle(styleElement: HTMLStyleElement) {\n    delete styleElement.dataset[dataMfeStylesKey]\n}\n\n/**\n * Removes the RC from list of users of the style element.\n * @param styleElement - style element to modify\n * @param slotName - name of the slot hosting the RC\n */\nexport function removeRcUsageFromStyle(styleElement: HTMLStyleElement, slotName: string) {\n    delete styleElement.dataset[slotNameToPropertyName(dataRcStylesKey(slotName))]\n}\n\n/**\n * Registers the RC as a user of the style element.\n * @param styleElement - style element to register for\n * @param slotName - name of the slot hosting the RC\n */\nexport function useStyleForRc(styleElement: HTMLStyleElement, slotName: string) {\n  styleElement.dataset[slotNameToPropertyName(dataRcStylesKey(slotName))] = ''\n}\n\n/**\n * Registers the MFE as a user of the style element.\n * @param styleElement - style element to modify\n */\nexport function useStyleForMfe(styleElement: HTMLStyleElement) {\n  styleElement.dataset[dataMfeStylesKey] = ''\n}\n","import { dataAppStylesKey, useStyleForMfe, useStyleForRc } from '../index'\n\n/**\n * Creates new style sheet with given content and optional dataset attributes and appends it to the document head.\n * @param content - content for new style sheet\n * @param datasetAttributes - attributes to add to new style element\n * @returns {HTMLStyleElement} new style element\n */\nexport function addStyleToHead(content: string, datasetAttributes?: { [key: string]: string }): HTMLStyleElement {\n  const style = document.createElement('style')\n\n  style.appendChild(document.createTextNode(content))\n  if (datasetAttributes) {\n    Object.keys(datasetAttributes).forEach((key) => {\n      style.dataset[key] = datasetAttributes[key]\n    })\n  }\n  document.head.appendChild(style)\n  return style\n}\n\n/**\n * Replaces content of a given style element.\n * @param selectorOrElement - selector for a style element or exact element\n * @param content - content to be put in the style element\n * @returns {HTMLStyleElement} updated style element\n */\nexport function replaceStyleContent(\n  selectorOrElement: string | HTMLStyleElement,\n  content: string\n): HTMLStyleElement | null {\n  if (selectorOrElement instanceof HTMLStyleElement) {\n    selectorOrElement.textContent = content\n    return selectorOrElement\n  }\n\n  const styleElement = document.head.querySelector<HTMLStyleElement>(selectorOrElement)\n  if (styleElement) styleElement.textContent = content\n  return styleElement\n}\n\n/**\n * Creates new style element and register MFE or RC as the user of it\n * @param scopeId - scope id related to the app\n * @param options - registration options\n * @returns {HTMLStyleElement} style element with MFE or RC registered\n */\nexport function createStyleUsedByMfeRc(\n    scopeId: string,\n    options: {type:'rc'; slotName: string} | {type: 'mfe'}\n): HTMLStyleElement {    \n    const element = addStyleToHead('', {\n        [dataAppStylesKey]: scopeId,\n    });\n\n    if (options.type === 'rc') {\n        useStyleForRc(element, options.slotName);\n    } else {\n        useStyleForMfe(element);\n    }\n\n    return element;\n}","import { dataMfeElementAttribute, dataNoPortalLayoutStylesAttribute, dataStyleIdAttribute, dataStyleIsolationAttribute, isCssScopeRuleSupported} from \"@onecx/angular-utils\";\nimport { \n    dataAppStylesAttribute\n} from \"../index\";\n\n/**\n * Get the style element with application styles based on a scope.\n * @param scopeId - scope id related to the app\n * @returns {HTMLStyleElement | null} the style element related for a given scope\n */\nexport function getAppStyleByScope(scopeId: string): HTMLStyleElement | null {\n  return document.head.querySelector<HTMLStyleElement>(`style[${dataAppStylesAttribute}=\"${scopeId}\"]`)\n}\n\n/**\n * Replace \":root\" selector with \":scope\" for a given css.\n *\n * :scope === :root if \"@scope\" is not used\n * :scope === top level element of the scope if \"@scope\" is used\n * @param css - css text to transform\n * @returns {string} css with replaced selector\n */\nexport function replaceRootWithScope(css: string): string {\n  return css.replaceAll(':root', ':scope')\n}\n\n/**\n * Replace \"html\" and \":root\" selector with \":scope\" for a given css.\n *\n * :scope === :root if \"@scope\" is not used\n * :scope === top level element of the scope if \"@scope\" is used\n * @param css - css text to transform\n * @returns {string} css with replaced selector\n */\nexport function replaceRootAndHtmlWithScope(css: string): string {\n  return replaceRootWithScope(css.replaceAll('html',':scope'))\n}\n\n/**\n * 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.\n * @param css - css for scoping\n * @param scopeId - scope id for scoping\n * @returns {string} css scoped by the given id\n */\nexport function createApplicationScopedCss(css: string, scopeId: string): string {\n  const isScopeSupported = isCssScopeRuleSupported()\n  const scopeSelector = `[${dataStyleIdAttribute}=\"${scopeId}\"]:is([${dataNoPortalLayoutStylesAttribute}], [${dataMfeElementAttribute}])`\n  // Apply styles to all v6 elements and the MFE\n  return isScopeSupported\n    ? `\n      @scope(${scopeSelector}) to ([${dataStyleIsolationAttribute}]) {\n        ${replaceRootAndHtmlWithScope(css)}\n          }\n      `\n    : `\n      @supports (@scope(${scopeSelector}) to ([${dataStyleIsolationAttribute}])) {\n        ${replaceRootAndHtmlWithScope(css)}\n          }\n      `\n}","import { scopeIdFromProductNameAndAppId } from \"@onecx/angular-utils\";\nimport { HttpClient } from \"@angular/common/http\";\nimport {\n  getAppStyleByScope, \n  getStyleUsageCount, \n  fetchAppCss,\n  dataAppStylesKey,\n  useStyleForMfe, \n  useStyleForRc, \n  replaceStyleContent, \n  removeMfeUsageFromStyle,\n  removeRcUsageFromStyle,\n  createStyleUsedByMfeRc,\n  createApplicationScopedCss,\n  getAllStylesUsedByKey,\n  dataMfeStylesAttribute,\n  dataRcStylesAttribute\n} from \"../index\";\n\n/**\n * Update page styles.\n *\n * It removes old mfe usages and unused style elements.\n * Loads and creates new style element with MFE application styles css and registers the MFE for the usage.\n * If style element for the MFE application is already created, it only registers for the usage.\n *\n * @param productName - product name MFE belongs to\n * @param appId - id of the application MFE belongs to\n * @param httpClient - http client to make requests\n * @param mfeUrl - url of the MFE application to make requests\n */\nexport function updateStylesForMfeChange(\n  productName: string,\n  appId: string,\n  httpClient: HttpClient,\n  mfeUrl: string\n) {\n  updateStyles(\n    productName,\n    appId,\n    httpClient,\n    mfeUrl,\n    {type:'mfe'},\n    (document) => useStyleForMfe(document),\n    (document) => removeMfeUsageFromStyle(document) \n  );\n}\n\n/**\n * Update page styles.\n *\n * Loads and creates new style element with RC application styles css and registers the RC for the usage.\n * If style element for the RC application is already created, it only registers for the usage.\n * @param productName - product name RC belongs to\n * @param appId - id of the application RC belongs to\n * @param httpClient - http client to make requests\n * @param rcUrl - url of the RC application to make requests\n * @param slotName - name of the slot hosting the RC\n */\nexport function updateStylesForRcCreation(\n  productName: string,\n  appId: string,\n  httpClient: HttpClient,\n  rcUrl: string,\n  slotName: string\n) {\n  updateStyles(\n    productName,\n    appId,\n    httpClient,\n    rcUrl,\n    {type:'rc',slotName:slotName},\n    (document) => useStyleForRc(document, slotName),\n    (document) => removeRcUsageFromStyle(document,slotName) \n  );\n}\n\n/**\n * Update page styles.\n *\n * Loads and creates new style element with RC or MFE application styles css and registers the MFE or RC for the usage depending on passed callback function.\n * If style element for application is already created, it only registers for the usage.\n * The old and unused style usages are removed based on a passed callback function.\n * @param productName - product name style belongs to\n * @param appId - id of the application style belongs to\n * @param httpClient - http client to make requests\n * @param url - url of the application to make requests\n * @param options - defines type of style together with the name of the slot hosting the style for RC\n * @param useStyleCallback - function used for style registration based on the style type\n * @param removeUsageFromStyleCallback - function used for style removal based on the style type\n */\nasync function updateStyles(\n  productName: string,\n  appId: string,\n  httpClient: HttpClient,\n  url: string,\n  options: {type:'rc',slotName:string} | {type:'mfe'},\n  useStyleCallback: (document: HTMLStyleElement) => void,\n  removeUsageFromStyleCallback: (document: HTMLStyleElement) => void\n){\n  const scopeId = scopeIdFromProductNameAndAppId(productName, appId)\n\n  if(options.type === 'mfe') removeAllMfeUsagesFromStyles(scopeId)\n  \n  const existingStyleElement = getAppStyleByScope(scopeId)\n\n  if (existingStyleElement) {\n    useStyleCallback(existingStyleElement)\n    return\n  }\n\n  const styleElement = createStyleUsedByMfeRc(scopeId, options)\n  const css = await fetchAppCss(httpClient, url);\n  (styleElement as any).onecxOriginalCss = css\n\n  if (!css) {\n    removeUsageFromStyleCallback(styleElement)\n    if (getStyleUsageCount(styleElement) === 0) {\n      styleElement.remove()\n    }\n    return\n  }\n  const scopedCss = createApplicationScopedCss(css, scopeId)\n  replaceStyleContent(styleElement, scopedCss)\n}\n\n/**\n * Removes usages for all MFEs not related to the given scope.\n *\n * This will remove the style element completely if no other active users are present.\n *\n * @param scopeId - id of the scope to not deactivate\n */\nexport function removeAllMfeUsagesFromStyles(scopeId: string) {\n  removeInactiveStyles(\n    scopeId,\n    getAllStylesUsedByKey(dataMfeStylesAttribute),\n    (style) => removeMfeUsageFromStyle(style)\n  );\n}\n\n/**\n * Update page styles.\n *\n * Remove usages of the RC from the style elements it is register for.\n * If usage removal leads to style element not being used by any MFE or RC its removed from the page.\n * @param scopeId - id of the scope to not deactivate\n * @param slotName - name of the slot hosting the RC\n */\nexport function removeAllRcUsagesFromStyles(scopeId: string, slotName: string) {\n  removeInactiveStyles(\n    scopeId,\n    getAllStylesUsedByKey(dataRcStylesAttribute(slotName)),\n    (style) => removeRcUsageFromStyle(style,slotName)\n  );\n}\n\n\n/**\n * Remove usage of the  RC or MFE style from elements it is registered for.\n * If usage removal leads to style element not being used by any MFE or RC its removed from the page.\n * @param scopeId - id of the scope where the style has to be removed\n * @param styles - list of the style elements that have to be modified\n * @param removeUsageCallback - function used for style removal depending on style type\n */\nfunction removeInactiveStyles(\n    scopeId: string,\n    styles: HTMLStyleElement[],\n    removeUsageCallback: (style: HTMLStyleElement) => void\n): void{  \n  styles\n    .filter((styleElement) => !(styleElement.dataset[dataAppStylesKey] === scopeId))\n    .forEach((style) => {\n      removeUsageCallback(style);\n      if (getStyleUsageCount(style) === 0) {\n        style.remove();\n      }\n    });\n}","// This file is not planned to be in the index.ts so it is private to this lib\nimport { createLoggerFactory } from '@onecx/accelerator'\n\nexport const createLogger = createLoggerFactory('@onecx/angular-utils:style')\n","import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http'\nimport { catchError, firstValueFrom, mergeMap, of, throwError } from 'rxjs'\nimport { Location } from '@angular/common'\nimport { createLogger } from './logger.utils'\n\nconst logger = createLogger('fetch-app-css')\n\n/**\n * Fetches the css for an application.\n * @param http - http client for making requests\n * @param appUrl - url of the application used for making requests\n * @returns {Promise<string | undefined | null>} application css content\n */\nexport async function fetchAppCss(http: HttpClient, appUrl: string): Promise<string | undefined | null> {\n  return await firstValueFrom(\n    http\n      .get(Location.joinWithSlash(appUrl, 'styles.css'), {\n        headers: createCssRequestHeaders(),\n        observe: 'response',\n        responseType: 'text',\n      })\n      .pipe(\n        mergeMap((response) => {\n          if (!isResponseValidCss(response)) {\n            return throwError(\n              () =>\n                new Error(\n                  `Application returned different content type than text/css: ${response.headers.get('Content-Type')}. Please, make sure that the application exposes the styles.css file.`\n                )\n            )\n          }\n\n          return of(response.body)\n        }),\n        catchError((error: Error) => {\n          logger.error(\n            `Error while loading app css for ${appUrl}: ${error.message}.  Please, make sure that the application exposes the styles.css file in your application.`\n          )\n          return of(undefined)\n        })\n      )\n  )\n}\n\n/**\n * Creates HttpHeaders for Css request.\n */\nexport function createCssRequestHeaders() {\n  return new HttpHeaders({}).set('Accept', 'text/css')\n}\n\n/**\n * Returns if response is valid css.\n * @param response - response to validate\n * @returns {boolean} if response is valid css\n */\nexport function isResponseValidCss<T>(response: HttpResponse<T>) {\n  return response.headers.get('Content-Type')?.includes('text/css')\n}","//api\nexport * from './api/constants'\n\n//utils\nexport * from './utils/app-styles-usage.utils'\nexport * from './utils/dom-style.utils'\nexport * from './utils/app-styles-scope.utils'\nexport * from './utils/app-styles-lifecycle.utils'\nexport * from './utils/fetch-app-css.util'","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;;;AAGG;AACI,MAAM,iBAAiB,GAAG;AAEjC;;;;;AAKG;AACI,MAAM,gBAAgB,GAAG;AAEhC;;;AAGG;AACI,MAAM,gBAAgB,GAAG;AAEhC;;;;;AAKG;AACI,MAAM,eAAe,GAAG,CAAC,QAAgB,KAC9C,GAAG,iBAAiB,CAAA,EAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,CAA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