@ui5/webcomponents-base 2.23.0 → 2.23.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Boot.ts"],
4
- "sourcesContent": ["import whenDOMReady from \"./util/whenDOMReady.js\";\nimport EventProvider from \"./EventProvider.js\";\nimport insertFontFace from \"./FontFace.js\";\nimport insertSystemCSSVars from \"./SystemCSSVars.js\";\nimport insertScrollbarStyles from \"./ScrollbarStyles.js\";\nimport { getTheme, getBaseTheme } from \"./config/Theme.js\";\nimport applyTheme from \"./theming/applyTheme.js\";\nimport { registerCurrentRuntime } from \"./Runtimes.js\";\nimport { getFeature } from \"./FeaturesRegistry.js\";\nimport type OpenUI5Support from \"./features/OpenUI5Support.js\";\nimport type F6Navigation from \"./features/F6Navigation.js\";\nimport type { PromiseResolve } from \"./types.js\";\nimport { attachThemeRegistered } from \"./theming/ThemeRegistered.js\";\nimport fixSafariActiveState from \"./util/fixSafariActiveState.js\";\n\nlet booted = false;\nlet bootPromise: Promise<void>;\nlet openUI5ListenersAttached = false;\nconst eventProvider = new EventProvider<void, void>();\n\nconst isBooted = (): boolean => {\n\treturn booted;\n};\n\n/**\n * Attaches a callback that will be executed after boot finishes.\n * **Note:** If the framework already booted, the callback will be immediately executed.\n * @public\n * @param { Function } listener\n */\nconst attachBoot = (listener: () => void) => {\n\tif (!booted) {\n\t\teventProvider.attachEvent(\"boot\", listener);\n\t\treturn;\n\t}\n\n\tlistener();\n};\n\n/**\n * This function may now be called twice - once without OpenUI5Support, and then later again, when OpenUI5 is loaded dynamically\n * In this case, deregister the UI5 Web Components listener\n */\nconst initF6Navigation = async () => {\n\tconst openUI5Support = getFeature<typeof OpenUI5Support>(\"OpenUI5Support\");\n\tconst isOpenUI5Loaded = openUI5Support ? openUI5Support.isOpenUI5Detected() : false;\n\tconst f6Navigation = getFeature<typeof F6Navigation>(\"F6Navigation\");\n\n\tif (openUI5Support) {\n\t\tf6Navigation && f6Navigation.destroy(); // F6Navigation is not needed when OpenUI5 is used\n\t\tawait openUI5Support.init();\n\t}\n\n\tif (f6Navigation && !isOpenUI5Loaded) {\n\t\tf6Navigation.init();\n\t}\n};\n\nconst attachOpenUI5SupportListeners = () => {\n\tif (openUI5ListenersAttached) {\n\t\treturn;\n\t}\n\n\tconst openUI5Support = getFeature<typeof OpenUI5Support>(\"OpenUI5Support\");\n\tif (openUI5Support) {\n\t\topenUI5ListenersAttached = openUI5Support.attachListeners(); // listeners will be attached (return true) only if OpenUI5 is loaded\n\t}\n};\n\nconst boot = async (): Promise<void> => {\n\tif (bootPromise !== undefined) {\n\t\treturn bootPromise;\n\t}\n\n\tconst bootExecutor = async (resolve: PromiseResolve) => {\n\t\tregisterCurrentRuntime();\n\n\t\tif (typeof document === \"undefined\") {\n\t\t\tresolve();\n\t\t\treturn;\n\t\t}\n\n\t\tattachThemeRegistered(onThemeRegistered);\n\n\t\tawait initF6Navigation(); // depends on OpenUI5Support\n\t\tawait whenDOMReady();\n\t\tawait applyTheme(getTheme());\n\t\tattachOpenUI5SupportListeners(); // depends on OpenUI5Support\n\t\tinsertFontFace();\n\t\tinsertSystemCSSVars();\n\t\tinsertScrollbarStyles();\n\t\tfixSafariActiveState();\n\n\t\tresolve();\n\n\t\tbooted = true;\n\t\teventProvider.fireEvent(\"boot\");\n\t};\n\n\tbootPromise = new Promise(bootExecutor as (resolve: PromiseResolve) => void);\n\treturn bootPromise;\n};\n\nconst secondaryBoot = async (): Promise<void> => {\n\tawait boot(); // make sure we're not in the middle of boot before re-running the skipped parts\n\tawait initF6Navigation();\n\tattachOpenUI5SupportListeners();\n};\n\n/**\n * Callback, executed after theme properties registration\n * to apply the newly registered theme.\n * @private\n * @param { string } theme\n */\nconst onThemeRegistered = (theme: string) => {\n\tif (!booted) {\n\t\treturn;\n\t}\n\n\tconst currentTheme = getTheme();\n\tconst currentBaseTheme = getBaseTheme();\n\n\tif (theme === currentTheme || theme === currentBaseTheme) {\n\t\tapplyTheme(currentTheme);\n\t}\n};\n\nexport {\n\tboot,\n\tsecondaryBoot,\n\tattachBoot,\n\tisBooted,\n};\n"],
5
- "mappings": "aAAA,OAAOA,MAAkB,yBACzB,OAAOC,MAAmB,qBAC1B,OAAOC,MAAoB,gBAC3B,OAAOC,MAAyB,qBAChC,OAAOC,MAA2B,uBAClC,OAAS,YAAAC,EAAU,gBAAAC,MAAoB,oBACvC,OAAOC,MAAgB,0BACvB,OAAS,0BAAAC,MAA8B,gBACvC,OAAS,cAAAC,MAAkB,wBAI3B,OAAS,yBAAAC,MAA6B,+BACtC,OAAOC,MAA0B,iCAEjC,IAAIC,EAAS,GACTC,EACAC,EAA2B,GAC/B,MAAMC,EAAgB,IAAId,EAEpBe,EAAW,IACTJ,EASFK,EAAcC,GAAyB,CAC5C,GAAI,CAACN,EAAQ,CACZG,EAAc,YAAY,OAAQG,CAAQ,EAC1C,MACD,CAEAA,EAAS,CACV,EAMMC,EAAmB,SAAY,CACpC,MAAMC,EAAiBX,EAAkC,gBAAgB,EACnEY,EAAkBD,EAAiBA,EAAe,kBAAkB,EAAI,GACxEE,EAAeb,EAAgC,cAAc,EAE/DW,IACHE,GAAgBA,EAAa,QAAQ,EACrC,MAAMF,EAAe,KAAK,GAGvBE,GAAgB,CAACD,GACpBC,EAAa,KAAK,CAEpB,EAEMC,EAAgC,IAAM,CAC3C,GAAIT,EACH,OAGD,MAAMM,EAAiBX,EAAkC,gBAAgB,EACrEW,IACHN,EAA2BM,EAAe,gBAAgB,EAE5D,EAEMI,EAAO,SAA2B,CACvC,GAAIX,IAAgB,OACnB,OAAOA,EAGR,MAAMY,EAAe,MAAOC,GAA4B,CAGvD,GAFAlB,EAAuB,EAEnB,OAAO,SAAa,IAAa,CACpCkB,EAAQ,EACR,MACD,CAEAhB,EAAsBiB,CAAiB,EAEvC,MAAMR,EAAiB,EACvB,MAAMnB,EAAa,EACnB,MAAMO,EAAWF,EAAS,CAAC,EAC3BkB,EAA8B,EAC9BrB,EAAe,EACfC,EAAoB,EACpBC,EAAsB,EACtBO,EAAqB,EAErBe,EAAQ,EAERd,EAAS,GACTG,EAAc,UAAU,MAAM,CAC/B,EAEA,OAAAF,EAAc,IAAI,QAAQY,CAAiD,EACpEZ,CACR,EAEMe,EAAgB,SAA2B,CAChD,MAAMJ,EAAK,EACX,MAAML,EAAiB,EACvBI,EAA8B,CAC/B,EAQMI,EAAqBE,GAAkB,CAC5C,GAAI,CAACjB,EACJ,OAGD,MAAMkB,EAAezB,EAAS,EACxB0B,EAAmBzB,EAAa,GAElCuB,IAAUC,GAAgBD,IAAUE,IACvCxB,EAAWuB,CAAY,CAEzB,EAEA,OACCN,KAAA,KACAI,KAAA,cACAX,KAAA,WACAD,KAAA",
4
+ "sourcesContent": ["import whenDOMReady from \"./util/whenDOMReady.js\";\nimport EventProvider from \"./EventProvider.js\";\nimport insertFontFace from \"./FontFace.js\";\nimport insertSystemCSSVars from \"./SystemCSSVars.js\";\nimport insertScrollbarStyles from \"./ScrollbarStyles.js\";\nimport { getTheme, getBaseTheme } from \"./config/Theme.js\";\nimport applyTheme from \"./theming/applyTheme.js\";\nimport { registerCurrentRuntime } from \"./Runtimes.js\";\nimport { getFeature } from \"./FeaturesRegistry.js\";\nimport type OpenUI5Support from \"./features/OpenUI5Support.js\";\nimport type F6Navigation from \"./features/F6Navigation.js\";\nimport type { PromiseResolve } from \"./types.js\";\nimport { attachThemeRegistered } from \"./theming/ThemeRegistered.js\";\nimport fixSafariActiveState from \"./util/fixSafariActiveState.js\";\n\nlet booted = false;\nlet bootPromise: Promise<void>;\nlet openUI5ListenersAttached = false;\nconst eventProvider = new EventProvider<void, void>();\n\nconst isBooted = (): boolean => {\n\treturn booted;\n};\n\n/**\n * Attaches a callback that will be executed after boot finishes.\n * **Note:** If the framework already booted, the callback will be immediately executed.\n * @public\n * @param { Function } listener\n */\nconst attachBoot = (listener: () => void) => {\n\tif (!booted) {\n\t\teventProvider.attachEvent(\"boot\", listener);\n\t\treturn;\n\t}\n\n\tlistener();\n};\n\n/**\n * This function may now be called twice - once without OpenUI5Support, and then later again, when OpenUI5 is loaded dynamically\n * In this case, deregister the UI5 Web Components listener\n */\nconst initF6Navigation = async () => {\n\tconst openUI5Support = getFeature<typeof OpenUI5Support>(\"OpenUI5Support\");\n\tconst isOpenUI5Loaded = openUI5Support ? openUI5Support.isOpenUI5Detected() : false;\n\tconst f6Navigation = getFeature<typeof F6Navigation>(\"F6Navigation\");\n\n\tif (openUI5Support) {\n\t\tf6Navigation && f6Navigation.destroy(); // F6Navigation is not needed when OpenUI5 is used\n\t\tawait openUI5Support.init();\n\t}\n\n\tif (f6Navigation && !isOpenUI5Loaded) {\n\t\tf6Navigation.init();\n\t}\n};\n\nconst attachOpenUI5SupportListeners = () => {\n\tif (openUI5ListenersAttached) {\n\t\treturn;\n\t}\n\n\tconst openUI5Support = getFeature<typeof OpenUI5Support>(\"OpenUI5Support\");\n\tif (openUI5Support) {\n\t\topenUI5ListenersAttached = openUI5Support.attachListeners(); // listeners will be attached (return true) only if OpenUI5 is loaded\n\t}\n};\n\nconst boot = async (): Promise<void> => {\n\tif (bootPromise !== undefined) {\n\t\treturn bootPromise;\n\t}\n\n\tconst bootExecutor = async (resolve: PromiseResolve) => {\n\t\tregisterCurrentRuntime();\n\n\t\tif (typeof document === \"undefined\") {\n\t\t\tresolve();\n\t\t\treturn;\n\t\t}\n\n\t\tattachThemeRegistered(onThemeRegistered);\n\n\t\tawait initF6Navigation(); // depends on OpenUI5Support\n\t\tawait whenDOMReady();\n\t\tawait applyTheme(getTheme());\n\t\tattachOpenUI5SupportListeners(); // depends on OpenUI5Support\n\t\tinsertFontFace();\n\t\tinsertSystemCSSVars();\n\t\tinsertScrollbarStyles();\n\t\tfixSafariActiveState();\n\n\t\tresolve();\n\n\t\tbooted = true;\n\t\teventProvider.fireEvent(\"boot\");\n\t};\n\n\tbootPromise = new Promise(bootExecutor as (resolve: PromiseResolve) => void);\n\treturn bootPromise;\n};\n\nconst secondaryBoot = async (): Promise<void> => {\n\tawait boot(); // make sure we're not in the middle of boot before re-running the skipped parts\n\tawait initF6Navigation();\n\tattachOpenUI5SupportListeners();\n\tawait applyTheme(getTheme()); // Re-apply theme to detect external theme from OpenUI5 and clean up\n};\n\n/**\n * Callback, executed after theme properties registration\n * to apply the newly registered theme.\n * @private\n * @param { string } theme\n */\nconst onThemeRegistered = (theme: string) => {\n\tif (!booted) {\n\t\treturn;\n\t}\n\n\tconst currentTheme = getTheme();\n\tconst currentBaseTheme = getBaseTheme();\n\n\tif (theme === currentTheme || theme === currentBaseTheme) {\n\t\tapplyTheme(currentTheme);\n\t}\n};\n\nexport {\n\tboot,\n\tsecondaryBoot,\n\tattachBoot,\n\tisBooted,\n};\n"],
5
+ "mappings": "aAAA,OAAOA,MAAkB,yBACzB,OAAOC,MAAmB,qBAC1B,OAAOC,MAAoB,gBAC3B,OAAOC,MAAyB,qBAChC,OAAOC,MAA2B,uBAClC,OAAS,YAAAC,EAAU,gBAAAC,MAAoB,oBACvC,OAAOC,MAAgB,0BACvB,OAAS,0BAAAC,MAA8B,gBACvC,OAAS,cAAAC,MAAkB,wBAI3B,OAAS,yBAAAC,MAA6B,+BACtC,OAAOC,MAA0B,iCAEjC,IAAIC,EAAS,GACTC,EACAC,EAA2B,GAC/B,MAAMC,EAAgB,IAAId,EAEpBe,EAAW,IACTJ,EASFK,EAAcC,GAAyB,CAC5C,GAAI,CAACN,EAAQ,CACZG,EAAc,YAAY,OAAQG,CAAQ,EAC1C,MACD,CAEAA,EAAS,CACV,EAMMC,EAAmB,SAAY,CACpC,MAAMC,EAAiBX,EAAkC,gBAAgB,EACnEY,EAAkBD,EAAiBA,EAAe,kBAAkB,EAAI,GACxEE,EAAeb,EAAgC,cAAc,EAE/DW,IACHE,GAAgBA,EAAa,QAAQ,EACrC,MAAMF,EAAe,KAAK,GAGvBE,GAAgB,CAACD,GACpBC,EAAa,KAAK,CAEpB,EAEMC,EAAgC,IAAM,CAC3C,GAAIT,EACH,OAGD,MAAMM,EAAiBX,EAAkC,gBAAgB,EACrEW,IACHN,EAA2BM,EAAe,gBAAgB,EAE5D,EAEMI,EAAO,SAA2B,CACvC,GAAIX,IAAgB,OACnB,OAAOA,EAGR,MAAMY,EAAe,MAAOC,GAA4B,CAGvD,GAFAlB,EAAuB,EAEnB,OAAO,SAAa,IAAa,CACpCkB,EAAQ,EACR,MACD,CAEAhB,EAAsBiB,CAAiB,EAEvC,MAAMR,EAAiB,EACvB,MAAMnB,EAAa,EACnB,MAAMO,EAAWF,EAAS,CAAC,EAC3BkB,EAA8B,EAC9BrB,EAAe,EACfC,EAAoB,EACpBC,EAAsB,EACtBO,EAAqB,EAErBe,EAAQ,EAERd,EAAS,GACTG,EAAc,UAAU,MAAM,CAC/B,EAEA,OAAAF,EAAc,IAAI,QAAQY,CAAiD,EACpEZ,CACR,EAEMe,EAAgB,SAA2B,CAChD,MAAMJ,EAAK,EACX,MAAML,EAAiB,EACvBI,EAA8B,EAC9B,MAAMhB,EAAWF,EAAS,CAAC,CAC5B,EAQMsB,EAAqBE,GAAkB,CAC5C,GAAI,CAACjB,EACJ,OAGD,MAAMkB,EAAezB,EAAS,EACxB0B,EAAmBzB,EAAa,GAElCuB,IAAUC,GAAgBD,IAAUE,IACvCxB,EAAWuB,CAAY,CAEzB,EAEA,OACCN,KAAA,KACAI,KAAA,cACAX,KAAA,WACAD,KAAA",
6
6
  "names": ["whenDOMReady", "EventProvider", "insertFontFace", "insertSystemCSSVars", "insertScrollbarStyles", "getTheme", "getBaseTheme", "applyTheme", "registerCurrentRuntime", "getFeature", "attachThemeRegistered", "fixSafariActiveState", "booted", "bootPromise", "openUI5ListenersAttached", "eventProvider", "isBooted", "attachBoot", "listener", "initF6Navigation", "openUI5Support", "isOpenUI5Loaded", "f6Navigation", "attachOpenUI5SupportListeners", "boot", "bootExecutor", "resolve", "onThemeRegistered", "secondaryBoot", "theme", "currentTheme", "currentBaseTheme"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";import{hasStyle as e,createStyle as o}from"./ManagedStyles.js";import{getFeature as r}from"./FeaturesRegistry.js";import n from"./generated/css/FontFace.css.js";import{getDefaultFontLoading as p}from"./config/Fonts.js";const a=()=>{const t=r("OpenUI5Support");(!t||!t.isOpenUI5Detected())&&f()},f=()=>{const t=document.querySelector("head>style[data-ui5-font-face]");!p()||t||e("data-ui5-font-face")||o(n,"data-ui5-font-face")};export default a;
1
+ "use strict";import{createOrUpdateStyle as e}from"./ManagedStyles.js";import{getFeature as o}from"./FeaturesRegistry.js";import r from"./generated/css/FontFace.css.js";import{getDefaultFontLoading as p}from"./config/Fonts.js";const n=()=>{const t=o("OpenUI5Support");(!t||!t.isOpenUI5Detected())&&a()},a=()=>{const t=document.querySelector("head>style[data-ui5-font-face]");!p()||t||e(r,"data-ui5-font-face")};export default n;
2
2
  //# sourceMappingURL=FontFace.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/FontFace.ts"],
4
- "sourcesContent": ["import { hasStyle, createStyle } from \"./ManagedStyles.js\";\nimport { getFeature } from \"./FeaturesRegistry.js\";\nimport fontFaceCSS from \"./generated/css/FontFace.css.js\";\nimport type OpenUI5Support from \"./features/OpenUI5Support.js\";\nimport { getDefaultFontLoading } from \"./config/Fonts.js\";\n\nconst insertFontFace = () => {\n\tconst openUI5Support = getFeature<typeof OpenUI5Support>(\"OpenUI5Support\");\n\n\t// Only set the main font if there is no OpenUI5 support, or there is, but OpenUI5 is not loaded\n\tif ((!openUI5Support || !openUI5Support.isOpenUI5Detected())) {\n\t\tinsertMainFontFace();\n\t}\n};\n\nconst insertMainFontFace = () => {\n\tconst hasFontStyles = document.querySelector(\"head>style[data-ui5-font-face]\");\n\n\tif (!getDefaultFontLoading() || hasFontStyles) {\n\t\treturn;\n\t}\n\n\tif (!hasStyle(\"data-ui5-font-face\")) {\n\t\tcreateStyle(fontFaceCSS, \"data-ui5-font-face\");\n\t}\n};\n\nexport default insertFontFace;\n"],
5
- "mappings": "aAAA,OAAS,YAAAA,EAAU,eAAAC,MAAmB,qBACtC,OAAS,cAAAC,MAAkB,wBAC3B,OAAOC,MAAiB,kCAExB,OAAS,yBAAAC,MAA6B,oBAEtC,MAAMC,EAAiB,IAAM,CAC5B,MAAMC,EAAiBJ,EAAkC,gBAAgB,GAGpE,CAACI,GAAkB,CAACA,EAAe,kBAAkB,IACzDC,EAAmB,CAErB,EAEMA,EAAqB,IAAM,CAChC,MAAMC,EAAgB,SAAS,cAAc,gCAAgC,EAEzE,CAACJ,EAAsB,GAAKI,GAI3BR,EAAS,oBAAoB,GACjCC,EAAYE,EAAa,oBAAoB,CAE/C,EAEA,eAAeE",
6
- "names": ["hasStyle", "createStyle", "getFeature", "fontFaceCSS", "getDefaultFontLoading", "insertFontFace", "openUI5Support", "insertMainFontFace", "hasFontStyles"]
4
+ "sourcesContent": ["import { createOrUpdateStyle } from \"./ManagedStyles.js\";\nimport { getFeature } from \"./FeaturesRegistry.js\";\nimport fontFaceCSS from \"./generated/css/FontFace.css.js\";\nimport type OpenUI5Support from \"./features/OpenUI5Support.js\";\nimport { getDefaultFontLoading } from \"./config/Fonts.js\";\n\nconst insertFontFace = () => {\n\tconst openUI5Support = getFeature<typeof OpenUI5Support>(\"OpenUI5Support\");\n\n\t// Only set the main font if there is no OpenUI5 support, or there is, but OpenUI5 is not loaded\n\tif ((!openUI5Support || !openUI5Support.isOpenUI5Detected())) {\n\t\tinsertMainFontFace();\n\t}\n};\n\nconst insertMainFontFace = () => {\n\tconst hasFontStyles = document.querySelector(\"head>style[data-ui5-font-face]\");\n\n\tif (!getDefaultFontLoading() || hasFontStyles) {\n\t\treturn;\n\t}\n\n\tcreateOrUpdateStyle(fontFaceCSS, \"data-ui5-font-face\");\n};\n\nexport default insertFontFace;\n"],
5
+ "mappings": "aAAA,OAAS,uBAAAA,MAA2B,qBACpC,OAAS,cAAAC,MAAkB,wBAC3B,OAAOC,MAAiB,kCAExB,OAAS,yBAAAC,MAA6B,oBAEtC,MAAMC,EAAiB,IAAM,CAC5B,MAAMC,EAAiBJ,EAAkC,gBAAgB,GAGpE,CAACI,GAAkB,CAACA,EAAe,kBAAkB,IACzDC,EAAmB,CAErB,EAEMA,EAAqB,IAAM,CAChC,MAAMC,EAAgB,SAAS,cAAc,gCAAgC,EAEzE,CAACJ,EAAsB,GAAKI,GAIhCP,EAAoBE,EAAa,oBAAoB,CACtD,EAEA,eAAeE",
6
+ "names": ["createOrUpdateStyle", "getFeature", "fontFaceCSS", "getDefaultFontLoading", "insertFontFace", "openUI5Support", "insertMainFontFace", "hasFontStyles"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";import{getCurrentRuntimeIndex as u,compareRuntimes as a}from"./Runtimes.js";const g=typeof document>"u",i=(e,t)=>t?`${e}|${t}`:e,l=e=>e===void 0?!0:a(u(),parseInt(e))>=1,c=(e,t,r="",s)=>{const d=u(),n=new CSSStyleSheet;n.replaceSync(e),n._ui5StyleId=i(t,r),s&&(n._ui5RuntimeIndex=d,n._ui5Theme=s),document.adoptedStyleSheets=[...document.adoptedStyleSheets,n]},y=(e,t,r="",s)=>{const d=u(),n=document.adoptedStyleSheets.find(o=>o._ui5StyleId===i(t,r));if(n)if(!s)n.replaceSync(e||"");else{const o=n._ui5RuntimeIndex;(n._ui5Theme!==s||l(o))&&(n.replaceSync(e||""),n._ui5RuntimeIndex=String(d),n._ui5Theme=s)}},S=(e,t="")=>g?!0:!!document.adoptedStyleSheets.find(r=>r._ui5StyleId===i(e,t)),f=(e,t="")=>{document.adoptedStyleSheets=document.adoptedStyleSheets.filter(r=>r._ui5StyleId!==i(e,t))},R=(e,t,r="",s)=>{S(t,r)?y(e,t,r,s):c(e,t,r,s)},m=(e,t)=>e===void 0?t:t===void 0?e:`${e} ${t}`;export{c as createStyle,S as hasStyle,y as updateStyle,f as removeStyle,R as createOrUpdateStyle,m as mergeStyles};
1
+ "use strict";import{getCurrentRuntimeIndex as u,compareRuntimes as g}from"./Runtimes.js";const c=typeof document>"u",i=(e,t)=>t?`${e}|${t}`:e,l=e=>e===void 0?!0:g(u(),parseInt(e))>=1,y=(e,t,r="",s)=>{const d=u(),n=new CSSStyleSheet;n.replaceSync(e),n._ui5StyleId=i(t,r),s&&(n._ui5RuntimeIndex=d,n._ui5Theme=s),document.adoptedStyleSheets=[...document.adoptedStyleSheets,n]},S=(e,t,r="",s)=>{if(c)return;const d=u(),n=document.adoptedStyleSheets.find(o=>o._ui5StyleId===i(t,r));if(n)if(!s)n.replaceSync(e||"");else{const o=n._ui5RuntimeIndex;(n._ui5Theme!==s||l(o))&&(n.replaceSync(e||""),n._ui5RuntimeIndex=String(d),n._ui5Theme=s)}},a=(e,t="")=>c?!0:!!document.adoptedStyleSheets.find(r=>r._ui5StyleId===i(e,t)),f=(e,t="")=>{document.adoptedStyleSheets=document.adoptedStyleSheets.filter(r=>r._ui5StyleId!==i(e,t))},R=(e,t,r="",s)=>{a(t,r)?S(e,t,r,s):y(e,t,r,s)},m=(e,t)=>e===void 0?t:t===void 0?e:`${e} ${t}`;export{y as createStyle,a as hasStyle,S as updateStyle,f as removeStyle,R as createOrUpdateStyle,m as mergeStyles};
2
2
  //# sourceMappingURL=ManagedStyles.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ManagedStyles.ts"],
4
- "sourcesContent": ["import { getCurrentRuntimeIndex, compareRuntimes } from \"./Runtimes.js\";\n\nconst isSSR = typeof document === \"undefined\";\n\nconst getStyleId = (name: string, value: string) => {\n\treturn value ? `${name}|${value}` : name;\n};\n\nconst shouldUpdate = (runtimeIndex: string | undefined) => {\n\tif (runtimeIndex === undefined) {\n\t\treturn true;\n\t}\n\treturn compareRuntimes(getCurrentRuntimeIndex(), parseInt(runtimeIndex)) >= 1; // 1 or larger means the current is newer, 0 means the same, -1 means the resource's runtime is newer\n};\n\nconst createStyle = (content: string, name: string, value = \"\", theme?: string) => {\n\tconst currentRuntimeIndex = getCurrentRuntimeIndex();\n\n\tconst stylesheet = new CSSStyleSheet();\n\tstylesheet.replaceSync(content);\n\t(stylesheet as Record<string, any>)._ui5StyleId = getStyleId(name, value); // set an id so that we can find the style later\n\tif (theme) {\n\t\t(stylesheet as Record<string, any>)._ui5RuntimeIndex = currentRuntimeIndex;\n\t\t(stylesheet as Record<string, any>)._ui5Theme = theme;\n\t}\n\tdocument.adoptedStyleSheets = [...document.adoptedStyleSheets, stylesheet];\n};\n\nconst updateStyle = (content: string, name: string, value = \"\", theme?: string) => {\n\tconst currentRuntimeIndex = getCurrentRuntimeIndex();\n\n\tconst stylesheet = document.adoptedStyleSheets.find(sh => (sh as Record<string, any>)._ui5StyleId === getStyleId(name, value));\n\tif (!stylesheet) {\n\t\treturn;\n\t}\n\n\tif (!theme) {\n\t\tstylesheet.replaceSync(content || \"\");\n\t} else {\n\t\tconst stylesheetRuntimeIndex: string | undefined = (stylesheet as Record<string, any>)._ui5RuntimeIndex;\n\t\tconst stylesheetTheme: string | undefined = (stylesheet as Record<string, any>)._ui5Theme;\n\t\tif (stylesheetTheme !== theme || shouldUpdate(stylesheetRuntimeIndex)) {\n\t\t\tstylesheet.replaceSync(content || \"\");\n\t\t\t(stylesheet as Record<string, any>)._ui5RuntimeIndex = String(currentRuntimeIndex);\n\t\t\t(stylesheet as Record<string, any>)._ui5Theme = theme;\n\t\t}\n\t}\n};\n\nconst hasStyle = (name: string, value = \"\"): boolean => {\n\tif (isSSR) {\n\t\treturn true;\n\t}\n\n\treturn !!document.adoptedStyleSheets.find(sh => (sh as Record<string, any>)._ui5StyleId === getStyleId(name, value));\n};\n\nconst removeStyle = (name: string, value = \"\") => {\n\tdocument.adoptedStyleSheets = document.adoptedStyleSheets.filter(sh => (sh as Record<string, any>)._ui5StyleId !== getStyleId(name, value));\n};\n\nconst createOrUpdateStyle = (content: string, name: string, value = \"\", theme?: string) => {\n\tif (hasStyle(name, value)) {\n\t\tupdateStyle(content, name, value, theme);\n\t} else {\n\t\tcreateStyle(content, name, value, theme);\n\t}\n};\n\nconst mergeStyles = (style1?: string, style2?: string) => {\n\tif (style1 === undefined) {\n\t\treturn style2;\n\t}\n\tif (style2 === undefined) {\n\t\treturn style1;\n\t}\n\treturn `${style1} ${style2}`;\n};\n\nexport {\n\tcreateStyle,\n\thasStyle,\n\tupdateStyle,\n\tremoveStyle,\n\tcreateOrUpdateStyle,\n\tmergeStyles,\n};\n"],
5
- "mappings": "aAAA,OAAS,0BAAAA,EAAwB,mBAAAC,MAAuB,gBAExD,MAAMC,EAAQ,OAAO,SAAa,IAE5BC,EAAa,CAACC,EAAcC,IAC1BA,EAAQ,GAAGD,CAAI,IAAIC,CAAK,GAAKD,EAG/BE,EAAgBC,GACjBA,IAAiB,OACb,GAEDN,EAAgBD,EAAuB,EAAG,SAASO,CAAY,CAAC,GAAK,EAGvEC,EAAc,CAACC,EAAiBL,EAAcC,EAAQ,GAAIK,IAAmB,CAClF,MAAMC,EAAsBX,EAAuB,EAE7CY,EAAa,IAAI,cACvBA,EAAW,YAAYH,CAAO,EAC7BG,EAAmC,YAAcT,EAAWC,EAAMC,CAAK,EACpEK,IACFE,EAAmC,iBAAmBD,EACtDC,EAAmC,UAAYF,GAEjD,SAAS,mBAAqB,CAAC,GAAG,SAAS,mBAAoBE,CAAU,CAC1E,EAEMC,EAAc,CAACJ,EAAiBL,EAAcC,EAAQ,GAAIK,IAAmB,CAClF,MAAMC,EAAsBX,EAAuB,EAE7CY,EAAa,SAAS,mBAAmB,KAAKE,GAAOA,EAA2B,cAAgBX,EAAWC,EAAMC,CAAK,CAAC,EAC7H,GAAKO,EAIL,GAAI,CAACF,EACJE,EAAW,YAAYH,GAAW,EAAE,MAC9B,CACN,MAAMM,EAA8CH,EAAmC,kBAC1CA,EAAmC,YACxDF,GAASJ,EAAaS,CAAsB,KACnEH,EAAW,YAAYH,GAAW,EAAE,EACnCG,EAAmC,iBAAmB,OAAOD,CAAmB,EAChFC,EAAmC,UAAYF,EAElD,CACD,EAEMM,EAAW,CAACZ,EAAcC,EAAQ,KACnCH,EACI,GAGD,CAAC,CAAC,SAAS,mBAAmB,KAAKY,GAAOA,EAA2B,cAAgBX,EAAWC,EAAMC,CAAK,CAAC,EAG9GY,EAAc,CAACb,EAAcC,EAAQ,KAAO,CACjD,SAAS,mBAAqB,SAAS,mBAAmB,OAAOS,GAAOA,EAA2B,cAAgBX,EAAWC,EAAMC,CAAK,CAAC,CAC3I,EAEMa,EAAsB,CAACT,EAAiBL,EAAcC,EAAQ,GAAIK,IAAmB,CACtFM,EAASZ,EAAMC,CAAK,EACvBQ,EAAYJ,EAASL,EAAMC,EAAOK,CAAK,EAEvCF,EAAYC,EAASL,EAAMC,EAAOK,CAAK,CAEzC,EAEMS,EAAc,CAACC,EAAiBC,IACjCD,IAAW,OACPC,EAEJA,IAAW,OACPD,EAED,GAAGA,CAAM,IAAIC,CAAM,GAG3B,OACCb,KAAA,YACAQ,KAAA,SACAH,KAAA,YACAI,KAAA,YACAC,KAAA,oBACAC,KAAA",
4
+ "sourcesContent": ["import { getCurrentRuntimeIndex, compareRuntimes } from \"./Runtimes.js\";\n\nconst isSSR = typeof document === \"undefined\";\n\nconst getStyleId = (name: string, value: string) => {\n\treturn value ? `${name}|${value}` : name;\n};\n\nconst shouldUpdate = (runtimeIndex: string | undefined) => {\n\tif (runtimeIndex === undefined) {\n\t\treturn true;\n\t}\n\treturn compareRuntimes(getCurrentRuntimeIndex(), parseInt(runtimeIndex)) >= 1; // 1 or larger means the current is newer, 0 means the same, -1 means the resource's runtime is newer\n};\n\nconst createStyle = (content: string, name: string, value = \"\", theme?: string) => {\n\tconst currentRuntimeIndex = getCurrentRuntimeIndex();\n\n\tconst stylesheet = new CSSStyleSheet();\n\tstylesheet.replaceSync(content);\n\t(stylesheet as Record<string, any>)._ui5StyleId = getStyleId(name, value); // set an id so that we can find the style later\n\tif (theme) {\n\t\t(stylesheet as Record<string, any>)._ui5RuntimeIndex = currentRuntimeIndex;\n\t\t(stylesheet as Record<string, any>)._ui5Theme = theme;\n\t}\n\tdocument.adoptedStyleSheets = [...document.adoptedStyleSheets, stylesheet];\n};\n\nconst updateStyle = (content: string, name: string, value = \"\", theme?: string) => {\n\tif (isSSR) {\n\t\treturn;\n\t}\n\n\tconst currentRuntimeIndex = getCurrentRuntimeIndex();\n\n\tconst stylesheet = document.adoptedStyleSheets.find(sh => (sh as Record<string, any>)._ui5StyleId === getStyleId(name, value));\n\tif (!stylesheet) {\n\t\treturn;\n\t}\n\n\tif (!theme) {\n\t\tstylesheet.replaceSync(content || \"\");\n\t} else {\n\t\tconst stylesheetRuntimeIndex: string | undefined = (stylesheet as Record<string, any>)._ui5RuntimeIndex;\n\t\tconst stylesheetTheme: string | undefined = (stylesheet as Record<string, any>)._ui5Theme;\n\t\tif (stylesheetTheme !== theme || shouldUpdate(stylesheetRuntimeIndex)) {\n\t\t\tstylesheet.replaceSync(content || \"\");\n\t\t\t(stylesheet as Record<string, any>)._ui5RuntimeIndex = String(currentRuntimeIndex);\n\t\t\t(stylesheet as Record<string, any>)._ui5Theme = theme;\n\t\t}\n\t}\n};\n\nconst hasStyle = (name: string, value = \"\"): boolean => {\n\tif (isSSR) {\n\t\treturn true;\n\t}\n\n\treturn !!document.adoptedStyleSheets.find(sh => (sh as Record<string, any>)._ui5StyleId === getStyleId(name, value));\n};\n\nconst removeStyle = (name: string, value = \"\") => {\n\tdocument.adoptedStyleSheets = document.adoptedStyleSheets.filter(sh => (sh as Record<string, any>)._ui5StyleId !== getStyleId(name, value));\n};\n\nconst createOrUpdateStyle = (content: string, name: string, value = \"\", theme?: string) => {\n\tif (hasStyle(name, value)) {\n\t\tupdateStyle(content, name, value, theme);\n\t} else {\n\t\tcreateStyle(content, name, value, theme);\n\t}\n};\n\nconst mergeStyles = (style1?: string, style2?: string) => {\n\tif (style1 === undefined) {\n\t\treturn style2;\n\t}\n\tif (style2 === undefined) {\n\t\treturn style1;\n\t}\n\treturn `${style1} ${style2}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GY,EAAc,CAACb,EAAcC,EAAQ,KAAO,CACjD,SAAS,mBAAqB,SAAS,mBAAmB,OAAOS,GAAOA,EAA2B,cAAgBX,EAAWC,EAAMC,CAAK,CAAC,CAC3I,EAEMa,EAAsB,CAACT,EAAiBL,EAAcC,EAAQ,GAAIK,IAAmB,CACtFM,EAASZ,EAAMC,CAAK,EACvBQ,EAAYJ,EAASL,EAAMC,EAAOK,CAAK,EAEvCF,EAAYC,EAASL,EAAMC,EAAOK,CAAK,CAEzC,EAEMS,EAAc,CAACC,EAAiBC,IACjCD,IAAW,OACPC,EAEJA,IAAW,OACPD,EAED,GAAGA,CAAM,IAAIC,CAAM,GAG3B,OACCb,KAAA,YACAQ,KAAA,SACAH,KAAA,YACAI,KAAA,YACAC,KAAA,oBACAC,KAAA",
6
6
  "names": ["getCurrentRuntimeIndex", "compareRuntimes", "isSSR", "getStyleId", "name", "value", "shouldUpdate", "runtimeIndex", "createStyle", "content", "theme", "currentRuntimeIndex", "stylesheet", "updateStyle", "sh", "stylesheetRuntimeIndex", "hasStyle", "removeStyle", "createOrUpdateStyle", "mergeStyles", "style1", "style2"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";import{hasStyle as l,createStyle as r}from"./ManagedStyles.js";import t from"./generated/css/ScrollbarStyles.css.js";const s=()=>{l("data-ui5-scrollbar-styles")||r(t,"data-ui5-scrollbar-styles")};export default s;
1
+ "use strict";import{createOrUpdateStyle as r}from"./ManagedStyles.js";import t from"./generated/css/ScrollbarStyles.css.js";const l=()=>{r(t,"data-ui5-scrollbar-styles")};export default l;
2
2
  //# sourceMappingURL=ScrollbarStyles.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ScrollbarStyles.ts"],
4
- "sourcesContent": ["import { hasStyle, createStyle } from \"./ManagedStyles.js\";\nimport scrollbarStyles from \"./generated/css/ScrollbarStyles.css.js\";\n\nconst insertScrollbarStyles = () => {\n\tif (!hasStyle(\"data-ui5-scrollbar-styles\")) {\n\t\tcreateStyle(scrollbarStyles, \"data-ui5-scrollbar-styles\");\n\t}\n};\n\nexport default insertScrollbarStyles;\n"],
5
- "mappings": "aAAA,OAAS,YAAAA,EAAU,eAAAC,MAAmB,qBACtC,OAAOC,MAAqB,yCAE5B,MAAMC,EAAwB,IAAM,CAC9BH,EAAS,2BAA2B,GACxCC,EAAYC,EAAiB,2BAA2B,CAE1D,EAEA,eAAeC",
6
- "names": ["hasStyle", "createStyle", "scrollbarStyles", "insertScrollbarStyles"]
4
+ "sourcesContent": ["import { createOrUpdateStyle } from \"./ManagedStyles.js\";\nimport scrollbarStyles from \"./generated/css/ScrollbarStyles.css.js\";\n\nconst insertScrollbarStyles = () => {\n\tcreateOrUpdateStyle(scrollbarStyles, \"data-ui5-scrollbar-styles\");\n};\n\nexport default insertScrollbarStyles;\n"],
5
+ "mappings": "aAAA,OAAS,uBAAAA,MAA2B,qBACpC,OAAOC,MAAqB,yCAE5B,MAAMC,EAAwB,IAAM,CACnCF,EAAoBC,EAAiB,2BAA2B,CACjE,EAEA,eAAeC",
6
+ "names": ["createOrUpdateStyle", "scrollbarStyles", "insertScrollbarStyles"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";import{hasStyle as p,createStyle as t}from"../ManagedStyles.js";import e from"../generated/css/OpenUI5PopupStyles.css.js";const o=()=>{p("data-ui5-popup-styles")||t(e,"data-ui5-popup-styles")};export default o;
1
+ "use strict";import{createOrUpdateStyle as p}from"../ManagedStyles.js";import t from"../generated/css/OpenUI5PopupStyles.css.js";const e=()=>{p(t,"data-ui5-popup-styles")};export default e;
2
2
  //# sourceMappingURL=insertOpenUI5PopupStyles.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/features/insertOpenUI5PopupStyles.ts"],
4
- "sourcesContent": ["import { hasStyle, createStyle } from \"../ManagedStyles.js\";\nimport openUI5PopupStyles from \"../generated/css/OpenUI5PopupStyles.css.js\";\n\nconst insertOpenUI5PopupStyles = () => {\n\tif (!hasStyle(\"data-ui5-popup-styles\")) {\n\t\tcreateStyle(openUI5PopupStyles, \"data-ui5-popup-styles\");\n\t}\n};\n\nexport default insertOpenUI5PopupStyles;\n"],
5
- "mappings": "aAAA,OAAS,YAAAA,EAAU,eAAAC,MAAmB,sBACtC,OAAOC,MAAwB,6CAE/B,MAAMC,EAA2B,IAAM,CACjCH,EAAS,uBAAuB,GACpCC,EAAYC,EAAoB,uBAAuB,CAEzD,EAEA,eAAeC",
6
- "names": ["hasStyle", "createStyle", "openUI5PopupStyles", "insertOpenUI5PopupStyles"]
4
+ "sourcesContent": ["import { createOrUpdateStyle } from \"../ManagedStyles.js\";\nimport openUI5PopupStyles from \"../generated/css/OpenUI5PopupStyles.css.js\";\n\nconst insertOpenUI5PopupStyles = () => {\n\tcreateOrUpdateStyle(openUI5PopupStyles, \"data-ui5-popup-styles\");\n};\n\nexport default insertOpenUI5PopupStyles;\n"],
5
+ "mappings": "aAAA,OAAS,uBAAAA,MAA2B,sBACpC,OAAOC,MAAwB,6CAE/B,MAAMC,EAA2B,IAAM,CACtCF,EAAoBC,EAAoB,uBAAuB,CAChE,EAEA,eAAeC",
6
+ "names": ["createOrUpdateStyle", "openUI5PopupStyles", "insertOpenUI5PopupStyles"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";import u from"../getSharedResource.js";import P from"./insertOpenUI5PopupStyles.js";import i from"../generated/VersionInfo.js";import{compareVersions as h}from"../Runtimes.js";const t=u("PatchedFunctions",{}),a=o=>{const e=t[o];return!e||!e.version?!0:h(i,e.version)>0},p=u("AllOpenedPopupsRegistry",{openedRegistry:[]}),y=o=>{p.openedRegistry.push(o)},d=o=>{const e=p.openedRegistry.findIndex(n=>n.instance===o);e===p.openedRegistry.length-1&&O(),e>-1&&p.openedRegistry.splice(e,1)},g=()=>p.openedRegistry.length===0?null:p.openedRegistry[p.openedRegistry.length-1].instance,f=o=>{for(let e=p.openedRegistry.length-1;e>=0;e--){const n=p.openedRegistry[e];if(n.type==="WebComponent")return!0;if(n.instance===o)break}return!1},c=o=>{const e=o.getContent();return e instanceof HTMLElement?e:e?.getDomRef()||null},v=o=>{if(!["OPENING","OPEN"].includes(o.getOpenState())||!l())return;const n=c(o);if(!n)return;const s=document.getElementById("sap-ui-blocklayer-popup");o.getModal()&&s&&(s.setAttribute("popover","manual"),s.hidePopover(),s.showPopover()),n.setAttribute("popover","manual"),n.showPopover()},I=o=>{const e=c(o);if(e&&(e.hasAttribute("popover")&&(e.hidePopover(),e.removeAttribute("popover")),g()===o&&o.getModal())){const n=document.getElementById("sap-ui-blocklayer-popup");n&&n.hasAttribute("popover")&&n.hidePopover()}},O=()=>{if(!l())return;const o=p.openedRegistry[p.openedRegistry.length-2];if(!o||o.type!=="OpenUI5"||!o.instance.getModal())return;const e=c(o.instance),n=document.getElementById("sap-ui-blocklayer-popup");e?.hidePopover(),n?.showPopover(),e?.showPopover()},l=(o=document)=>o.querySelector(":popover-open")?!0:Array.from(o.querySelectorAll("*")).some(e=>{const n=e.shadowRoot;return n&&l(n)}),m=o=>{const e="Dialog.prototype.onsapescape";a(e)&&(t[e]={version:i,originalFn:t[e]?.originalFn??o.prototype.onsapescape});const n=t[e].originalFn;o.prototype.onsapescape=function(...r){f(this.oPopup)||n.apply(this,r)}},R=o=>{const e="Popup.prototype.open";a(e)&&(t[e]={version:i,originalFn:t[e]?.originalFn??o.prototype.open});const n=t[e].originalFn;o.prototype.open=function(...r){n.apply(this,r),v(this),y({type:"OpenUI5",instance:this})}},F=o=>{const e="Popup.prototype._closed";a(e)&&(t[e]={version:i,originalFn:t[e]?.originalFn??o.prototype._closed});const n=t[e].originalFn;o.prototype._closed=function(...r){I(this),n.apply(this,r),d(this)}},U=o=>{const e="Popup.prototype.onFocusEvent";a(e)&&(t[e]={version:i,originalFn:t[e]?.originalFn??o.prototype.onFocusEvent});const n=t[e].originalFn;o.prototype.onFocusEvent=function(...r){f(this)||n.apply(this,r)}},C=()=>{const o=new CSSStyleSheet;o.replaceSync(".sapMPopup-CTX:popover-open { inset: unset; }"),document.adoptedStyleSheets=[...document.adoptedStyleSheets,o]},b=(o,e)=>{P(),R(o),F(o),C(),U(o),m(e)};export{b as patchPopup,y as addOpenedPopup,d as removeOpenedPopup,g as getTopmostPopup};
1
+ "use strict";import u from"../getSharedResource.js";import f from"./insertOpenUI5PopupStyles.js";import i from"../generated/VersionInfo.js";import{compareVersions as h}from"../Runtimes.js";const t=u("PatchedFunctions",{}),a=o=>{const e=t[o];return!e||!e.version?!0:h(i,e.version)>0},p=u("AllOpenedPopupsRegistry",{openedRegistry:[]}),y=o=>{p.openedRegistry.push(o)},d=o=>{const e=p.openedRegistry.findIndex(n=>n.instance===o);e===p.openedRegistry.length-1&&O(),e>-1&&p.openedRegistry.splice(e,1)},g=()=>p.openedRegistry.length===0?null:p.openedRegistry[p.openedRegistry.length-1].instance,P=o=>{for(let e=p.openedRegistry.length-1;e>=0;e--){const n=p.openedRegistry[e];if(n.type==="WebComponent")return!0;if(n.instance===o)break}return!1},c=o=>{const e=o.getContent();return e instanceof HTMLElement?e:e?.getDomRef()||null},v=o=>{if(!["OPENING","OPEN"].includes(o.getOpenState())||!l())return;const n=c(o);if(!n)return;const s=document.getElementById("sap-ui-blocklayer-popup");o.getModal()&&s&&(s.setAttribute("popover","manual"),s.hidePopover(),s.showPopover()),n.setAttribute("popover","manual"),n.hidePopover(),n.showPopover()},I=o=>{const e=c(o);if(e&&(e.hasAttribute("popover")&&(e.hidePopover(),e.removeAttribute("popover")),g()===o&&o.getModal())){const n=document.getElementById("sap-ui-blocklayer-popup");n&&n.hasAttribute("popover")&&n.hidePopover()}},O=()=>{if(!l())return;const o=p.openedRegistry[p.openedRegistry.length-2];if(!o||o.type!=="OpenUI5"||!o.instance.getModal())return;const e=c(o.instance),n=document.getElementById("sap-ui-blocklayer-popup");e?.hidePopover(),n?.showPopover(),e?.showPopover()},l=(o=document)=>o.querySelector(":popover-open")?!0:Array.from(o.querySelectorAll("*")).some(e=>{const n=e.shadowRoot;return n&&l(n)}),m=o=>{const e="Dialog.prototype.onsapescape";a(e)&&(t[e]={version:i,originalFn:t[e]?.originalFn??o.prototype.onsapescape});const n=t[e].originalFn;o.prototype.onsapescape=function(...r){P(this.oPopup)||n.apply(this,r)}},R=o=>{const e="Popup.prototype.open";a(e)&&(t[e]={version:i,originalFn:t[e]?.originalFn??o.prototype.open});const n=t[e].originalFn;o.prototype.open=function(...r){n.apply(this,r),v(this),y({type:"OpenUI5",instance:this})}},F=o=>{const e="Popup.prototype._closed";a(e)&&(t[e]={version:i,originalFn:t[e]?.originalFn??o.prototype._closed});const n=t[e].originalFn;o.prototype._closed=function(...r){I(this),n.apply(this,r),d(this)}},U=o=>{const e="Popup.prototype.onFocusEvent";a(e)&&(t[e]={version:i,originalFn:t[e]?.originalFn??o.prototype.onFocusEvent});const n=t[e].originalFn;o.prototype.onFocusEvent=function(...r){P(this)||n.apply(this,r)}},C=()=>{const o=new CSSStyleSheet;o.replaceSync(".sapMPopup-CTX:popover-open { inset: unset; }"),document.adoptedStyleSheets=[...document.adoptedStyleSheets,o]},b=(o,e)=>{f(),R(o),F(o),C(),U(o),m(e)};export{b as patchPopup,y as addOpenedPopup,d as removeOpenedPopup,g as getTopmostPopup};
2
2
  //# sourceMappingURL=patchPopup.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/features/patchPopup.ts"],
4
- "sourcesContent": ["// OpenUI5's Control.js subset\nimport getSharedResource from \"../getSharedResource.js\";\nimport insertOpenUI5PopupStyles from \"./insertOpenUI5PopupStyles.js\";\nimport VersionInfo from \"../generated/VersionInfo.js\";\nimport { compareVersions } from \"../Runtimes.js\";\n\ntype PatchedFunctionRecord = {\n\tversion: VersionInfo | undefined;\n\toriginalFn: (...args: any[]) => any;\n};\n\ntype PatchedFunctionsRegistry = Record<string, PatchedFunctionRecord>;\n\nconst PatchedFunctions = getSharedResource<PatchedFunctionsRegistry>(\"PatchedFunctions\", {});\n\nconst shouldRepatch = (key: string): boolean => {\n\tconst existing = PatchedFunctions[key];\n\tif (!existing) {\n\t\treturn true;\n\t}\n\n\tif (!existing.version) {\n\t\treturn true;\n\t}\n\treturn compareVersions(VersionInfo, existing.version) > 0;\n};\n\ntype Control = {\n\tgetDomRef: () => HTMLElement | null,\n}\n\n// The lifecycle of Popup.js is open -> _opened -> close -> _closed, we're interested in the first (open) and last (_closed)\ntype OpenUI5Popup = {\n\topen: (...args: any[]) => void,\n\t_closed: (...args: any[]) => void,\n\tgetOpenState: () => \"CLOSED\" | \"CLOSING\" | \"OPEN\" | \"OPENING\",\n\tgetContent: () => Control | HTMLElement | null, // this is the OpenUI5 Element/Control instance that opens the Popup (usually sap.m.Popover/sap.m.Dialog)\n\tonFocusEvent: (...args: any[]) => void,\n\tgetModal: () => boolean\n};\n\ntype OpenUI5PopupClass = {\n\tprototype: OpenUI5Popup\n};\n\ntype OpenUI5DialogClass = {\n\tprototype: {\n\t\tonsapescape: (...args: any[]) => void,\n\t\toPopup: OpenUI5Popup,\n\t}\n};\n\ntype PopupInfo = {\n\ttype: \"WebComponent\";\n\tinstance: object;\n} | {\n\ttype: \"OpenUI5\";\n\tinstance: OpenUI5Popup;\n};\n\n// contains all OpenUI5 and Web Component popups that are currently opened\nconst AllOpenedPopupsRegistry = getSharedResource<{ openedRegistry: Array<PopupInfo> }>(\"AllOpenedPopupsRegistry\", { openedRegistry: [] });\n\nconst addOpenedPopup = (popupInfo: PopupInfo) => {\n\tAllOpenedPopupsRegistry.openedRegistry.push(popupInfo);\n};\n\nconst removeOpenedPopup = (popup: object) => {\n\tconst index = AllOpenedPopupsRegistry.openedRegistry.findIndex(el => el.instance === popup);\n\n\tif (index === AllOpenedPopupsRegistry.openedRegistry.length - 1) {\n\t\tfixTopmostOpenUI5Popup();\n\t}\n\n\tif (index > -1) {\n\t\tAllOpenedPopupsRegistry.openedRegistry.splice(index, 1);\n\t}\n};\n\nconst getTopmostPopup = () => {\n\tif (AllOpenedPopupsRegistry.openedRegistry.length === 0) {\n\t\treturn null;\n\t}\n\treturn AllOpenedPopupsRegistry.openedRegistry[AllOpenedPopupsRegistry.openedRegistry.length - 1].instance;\n};\n\n/**\n * Determines whether there is a Web Component popup opened above (a specified popup).\n *\n * @param {object} popup The popup instance to check against.\n * @returns {boolean} `true` if a Web Component popup is opened above (the given popup instance); otherwise `false`.\n */\nconst hasWebComponentPopupAbove = (popup: object) => {\n\tfor (let i = AllOpenedPopupsRegistry.openedRegistry.length - 1; i >= 0; i--) {\n\t\tconst popupInfo = AllOpenedPopupsRegistry.openedRegistry[i];\n\t\tif (popupInfo.type === \"WebComponent\") {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (popupInfo.instance === popup) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn false;\n};\n\nconst getPopupContentElement = (popup: OpenUI5Popup): HTMLElement | null => {\n\tconst content = popup.getContent();\n\treturn content instanceof HTMLElement ? content : content?.getDomRef() || null;\n};\n\nconst openNativePopoverForOpenUI5 = (popup: OpenUI5Popup) => {\n\tconst openingInitiated = [\"OPENING\", \"OPEN\"].includes(popup.getOpenState());\n\tif (!openingInitiated || !isNativePopoverOpen()) {\n\t\treturn;\n\t}\n\n\tconst domRef = getPopupContentElement(popup);\n\n\tif (!domRef) {\n\t\treturn;\n\t}\n\n\tconst openUI5BlockLayer = document.getElementById(\"sap-ui-blocklayer-popup\");\n\n\tif (popup.getModal() && openUI5BlockLayer) {\n\t\topenUI5BlockLayer.setAttribute(\"popover\", \"manual\");\n\t\topenUI5BlockLayer.hidePopover();\n\t\topenUI5BlockLayer.showPopover();\n\t}\n\n\tdomRef.setAttribute(\"popover\", \"manual\");\n\tdomRef.showPopover();\n};\n\nconst closeNativePopoverForOpenUI5 = (popup: OpenUI5Popup) => {\n\tconst domRef = getPopupContentElement(popup);\n\n\tif (!domRef) {\n\t\treturn;\n\t}\n\n\tif (domRef.hasAttribute(\"popover\")) {\n\t\tdomRef.hidePopover();\n\t\tdomRef.removeAttribute(\"popover\");\n\t}\n\n\tif (getTopmostPopup() !== popup) {\n\t\treturn;\n\t}\n\n\t// The OpenUI5 block layer is only one for all modal OpenUI5 popups,\n\t// and it is displayed above all opened pupups - OpenUI5 and Web Components,\n\t// as a result, we need to hide this block layer.\n\t// If the underlying popup is a Web Component - it is displayed like a native popover, and we don't need to do anything\n\t// If the underlying popup is an OpenUI5 popup, it will be fixed in fixTopmostOpenUI5Popup method.\n\tif (popup.getModal()) {\n\t\tconst openUI5BlockLayer = document.getElementById(\"sap-ui-blocklayer-popup\");\n\t\tif (openUI5BlockLayer && openUI5BlockLayer.hasAttribute(\"popover\")) {\n\t\t\topenUI5BlockLayer.hidePopover();\n\t\t}\n\t}\n};\n\nconst fixTopmostOpenUI5Popup = () => {\n\tif (!isNativePopoverOpen()) {\n\t\treturn;\n\t}\n\n\tconst prevPopup = AllOpenedPopupsRegistry.openedRegistry[AllOpenedPopupsRegistry.openedRegistry.length - 2];\n\tif (!prevPopup\n\t\t|| prevPopup.type !== \"OpenUI5\"\n\t\t|| !prevPopup.instance.getModal()) {\n\t\treturn;\n\t}\n\n\tconst content = getPopupContentElement(prevPopup.instance);\n\tconst openUI5BlockLayer = document.getElementById(\"sap-ui-blocklayer-popup\");\n\n\tcontent?.hidePopover();\n\topenUI5BlockLayer?.showPopover();\n\n\tcontent?.showPopover();\n};\n\nconst isNativePopoverOpen = (root: Document | ShadowRoot = document): boolean => {\n\tif (root.querySelector(\":popover-open\")) {\n\t\treturn true;\n\t}\n\n\treturn Array.from(root.querySelectorAll(\"*\")).some(element => {\n\t\tconst shadowRoot = element.shadowRoot;\n\t\treturn shadowRoot && isNativePopoverOpen(shadowRoot);\n\t});\n};\n\nconst patchDialog = (Dialog: OpenUI5DialogClass) => {\n\tconst key = \"Dialog.prototype.onsapescape\";\n\tif (shouldRepatch(key)) {\n\t\tPatchedFunctions[key] = { version: VersionInfo, originalFn: PatchedFunctions[key]?.originalFn ?? Dialog.prototype.onsapescape };\n\t}\n\tconst origOnsapescape = PatchedFunctions[key].originalFn;\n\tDialog.prototype.onsapescape = function onsapescape(...args: any[]) {\n\t\tif (hasWebComponentPopupAbove(this.oPopup)) {\n\t\t\treturn;\n\t\t}\n\n\t\torigOnsapescape.apply(this, args);\n\t};\n};\n\nconst patchOpen = (Popup: OpenUI5PopupClass) => {\n\tconst key = \"Popup.prototype.open\";\n\tif (shouldRepatch(key)) {\n\t\tPatchedFunctions[key] = { version: VersionInfo, originalFn: PatchedFunctions[key]?.originalFn ?? Popup.prototype.open };\n\t}\n\tconst origOpen = PatchedFunctions[key].originalFn;\n\tPopup.prototype.open = function open(...args: any[]) {\n\t\torigOpen.apply(this, args); // call open first to initiate opening\n\t\topenNativePopoverForOpenUI5(this);\n\n\t\taddOpenedPopup({\n\t\t\ttype: \"OpenUI5\",\n\t\t\tinstance: this,\n\t\t});\n\t};\n};\n\nconst patchClosed = (Popup: OpenUI5PopupClass) => {\n\tconst key = \"Popup.prototype._closed\";\n\tif (shouldRepatch(key)) {\n\t\tPatchedFunctions[key] = { version: VersionInfo, originalFn: PatchedFunctions[key]?.originalFn ?? Popup.prototype._closed };\n\t}\n\tconst _origClosed = PatchedFunctions[key].originalFn;\n\tPopup.prototype._closed = function _closed(...args: any[]) {\n\t\tcloseNativePopoverForOpenUI5(this);\n\t\t_origClosed.apply(this, args); // only then call _close\n\t\tremoveOpenedPopup(this);\n\t};\n};\n\nconst patchFocusEvent = (Popup: OpenUI5PopupClass) => {\n\tconst key = \"Popup.prototype.onFocusEvent\";\n\tif (shouldRepatch(key)) {\n\t\tPatchedFunctions[key] = { version: VersionInfo, originalFn: PatchedFunctions[key]?.originalFn ?? Popup.prototype.onFocusEvent };\n\t}\n\tconst origFocusEvent = PatchedFunctions[key].originalFn;\n\tPopup.prototype.onFocusEvent = function onFocusEvent(...args: any[]) {\n\t\tif (!hasWebComponentPopupAbove(this)) {\n\t\t\torigFocusEvent.apply(this, args);\n\t\t}\n\t};\n};\n\nconst createGlobalStyles = () => {\n\tconst stylesheet = new CSSStyleSheet();\n\tstylesheet.replaceSync(`.sapMPopup-CTX:popover-open { inset: unset; }`);\n\tdocument.adoptedStyleSheets = [...document.adoptedStyleSheets, stylesheet];\n};\n\nconst patchPopup = (Popup: OpenUI5PopupClass, Dialog: OpenUI5DialogClass) => {\n\tinsertOpenUI5PopupStyles();\n\tpatchOpen(Popup); // Popup.prototype.open\n\tpatchClosed(Popup); // Popup.prototype._closed\n\tcreateGlobalStyles(); // Ensures correct popover positioning by OpenUI5 (otherwise 0,0 is the center of the screen)\n\tpatchFocusEvent(Popup);// Popup.prototype.onFocusEvent\n\tpatchDialog(Dialog); // Dialog.prototype.onsapescape\n};\n\nexport {\n\tpatchPopup,\n\taddOpenedPopup,\n\tremoveOpenedPopup,\n\tgetTopmostPopup,\n};\n\nexport type { OpenUI5PopupClass, OpenUI5DialogClass, PopupInfo };\n"],
5
- "mappings": "aACA,OAAOA,MAAuB,0BAC9B,OAAOC,MAA8B,gCACrC,OAAOC,MAAiB,8BACxB,OAAS,mBAAAC,MAAuB,iBAShC,MAAMC,EAAmBJ,EAA4C,mBAAoB,CAAC,CAAC,EAErFK,EAAiBC,GAAyB,CAC/C,MAAMC,EAAWH,EAAiBE,CAAG,EAKrC,MAJI,CAACC,GAID,CAACA,EAAS,QACN,GAEDJ,EAAgBD,EAAaK,EAAS,OAAO,EAAI,CACzD,EAoCMC,EAA0BR,EAAwD,0BAA2B,CAAE,eAAgB,CAAC,CAAE,CAAC,EAEnIS,EAAkBC,GAAyB,CAChDF,EAAwB,eAAe,KAAKE,CAAS,CACtD,EAEMC,EAAqBC,GAAkB,CAC5C,MAAMC,EAAQL,EAAwB,eAAe,UAAUM,GAAMA,EAAG,WAAaF,CAAK,EAEtFC,IAAUL,EAAwB,eAAe,OAAS,GAC7DO,EAAuB,EAGpBF,EAAQ,IACXL,EAAwB,eAAe,OAAOK,EAAO,CAAC,CAExD,EAEMG,EAAkB,IACnBR,EAAw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AAc6B,EAAM,UAAU,OAAQ,GAE1H,MAAMG,EAAclC,EAAiBE,CAAG,EAAE,WAC1C6B,EAAM,UAAU,QAAU,YAAoBF,EAAa,CAC1DR,EAA6B,IAAI,EACjCa,EAAY,MAAM,KAAML,CAAI,EAC5BtB,EAAkB,IAAI,CACvB,CACD,EAEM4B,EAAmBJ,GAA6B,CACrD,MAAM7B,EAAM,+BACRD,EAAcC,CAAG,IACpBF,EAAiBE,CAAG,EAAI,CAAE,QAASJ,EAAa,WAAYE,EAAiBE,CAAG,GAAG,YAAc6B,EAAM,UAAU,YAAa,GAE/H,MAAMK,EAAiBpC,EAAiBE,CAAG,EAAE,WAC7C6B,EAAM,UAAU,aAAe,YAAyBF,EAAa,CAC/DhB,EAA0B,IAAI,GAClCuB,EAAe,MAAM,KAAMP,CAAI,CAEjC,CACD,EAEMQ,EAAqB,IAAM,CAChC,MAAMC,EAAa,IAAI,cACvBA,EAAW,YAAY,+CAA+C,EACtE,SAAS,mBAAqB,CAAC,GAAG,SAAS,mBAAoBA,CAAU,CAC1E,EAEMC,EAAa,CAACR,EAA0BJ,IAA+B,CAC5E9B,EAAyB,EACzBiC,EAAUC,CAAK,EACfE,EAAYF,CAAK,EACjBM,EAAmB,EACnBF,EAAgBJ,CAAK,EACrBL,EAAYC,CAAM,CACnB,EAEA,OACCY,KAAA,WACAlC,KAAA,eACAE,KAAA,kBACAK,KAAA",
4
+ "sourcesContent": ["// OpenUI5's Control.js subset\nimport getSharedResource from \"../getSharedResource.js\";\nimport insertOpenUI5PopupStyles from \"./insertOpenUI5PopupStyles.js\";\nimport VersionInfo from \"../generated/VersionInfo.js\";\nimport { compareVersions } from \"../Runtimes.js\";\n\ntype PatchedFunctionRecord = {\n\tversion: VersionInfo | undefined;\n\toriginalFn: (...args: any[]) => any;\n};\n\ntype PatchedFunctionsRegistry = Record<string, PatchedFunctionRecord>;\n\nconst PatchedFunctions = getSharedResource<PatchedFunctionsRegistry>(\"PatchedFunctions\", {});\n\nconst shouldRepatch = (key: string): boolean => {\n\tconst existing = PatchedFunctions[key];\n\tif (!existing) {\n\t\treturn true;\n\t}\n\n\tif (!existing.version) {\n\t\treturn true;\n\t}\n\treturn compareVersions(VersionInfo, existing.version) > 0;\n};\n\ntype Control = {\n\tgetDomRef: () => HTMLElement | null,\n}\n\n// The lifecycle of Popup.js is open -> _opened -> close -> _closed, we're interested in the first (open) and last (_closed)\ntype OpenUI5Popup = {\n\topen: (...args: any[]) => void,\n\t_closed: (...args: any[]) => void,\n\tgetOpenState: () => \"CLOSED\" | \"CLOSING\" | \"OPEN\" | \"OPENING\",\n\tgetContent: () => Control | HTMLElement | null, // this is the OpenUI5 Element/Control instance that opens the Popup (usually sap.m.Popover/sap.m.Dialog)\n\tonFocusEvent: (...args: any[]) => void,\n\tgetModal: () => boolean\n};\n\ntype OpenUI5PopupClass = {\n\tprototype: OpenUI5Popup\n};\n\ntype OpenUI5DialogClass = {\n\tprototype: {\n\t\tonsapescape: (...args: any[]) => void,\n\t\toPopup: OpenUI5Popup,\n\t}\n};\n\ntype PopupInfo = {\n\ttype: \"WebComponent\";\n\tinstance: object;\n} | {\n\ttype: \"OpenUI5\";\n\tinstance: OpenUI5Popup;\n};\n\n// contains all OpenUI5 and Web Component popups that are currently opened\nconst AllOpenedPopupsRegistry = getSharedResource<{ openedRegistry: Array<PopupInfo> }>(\"AllOpenedPopupsRegistry\", { openedRegistry: [] });\n\nconst addOpenedPopup = (popupInfo: PopupInfo) => {\n\tAllOpenedPopupsRegistry.openedRegistry.push(popupInfo);\n};\n\nconst removeOpenedPopup = (popup: object) => {\n\tconst index = AllOpenedPopupsRegistry.openedRegistry.findIndex(el => el.instance === popup);\n\n\tif (index === AllOpenedPopupsRegistry.openedRegistry.length - 1) {\n\t\tfixTopmostOpenUI5Popup();\n\t}\n\n\tif (index > -1) {\n\t\tAllOpenedPopupsRegistry.openedRegistry.splice(index, 1);\n\t}\n};\n\nconst getTopmostPopup = () => {\n\tif (AllOpenedPopupsRegistry.openedRegistry.length === 0) {\n\t\treturn null;\n\t}\n\treturn AllOpenedPopupsRegistry.openedRegistry[AllOpenedPopupsRegistry.openedRegistry.length - 1].instance;\n};\n\n/**\n * Determines whether there is a Web Component popup opened above (a specified popup).\n *\n * @param {object} popup The popup instance to check against.\n * @returns {boolean} `true` if a Web Component popup is opened above (the given popup instance); otherwise `false`.\n */\nconst hasWebComponentPopupAbove = (popup: object) => {\n\tfor (let i = AllOpenedPopupsRegistry.openedRegistry.length - 1; i >= 0; i--) {\n\t\tconst popupInfo = AllOpenedPopupsRegistry.openedRegistry[i];\n\t\tif (popupInfo.type === \"WebComponent\") {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (popupInfo.instance === popup) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn false;\n};\n\nconst getPopupContentElement = (popup: OpenUI5Popup): HTMLElement | null => {\n\tconst content = popup.getContent();\n\treturn content instanceof HTMLElement ? content : content?.getDomRef() || null;\n};\n\nconst openNativePopoverForOpenUI5 = (popup: OpenUI5Popup) => {\n\tconst openingInitiated = [\"OPENING\", \"OPEN\"].includes(popup.getOpenState());\n\tif (!openingInitiated || !isNativePopoverOpen()) {\n\t\treturn;\n\t}\n\n\tconst domRef = getPopupContentElement(popup);\n\n\tif (!domRef) {\n\t\treturn;\n\t}\n\n\tconst openUI5BlockLayer = document.getElementById(\"sap-ui-blocklayer-popup\");\n\n\tif (popup.getModal() && openUI5BlockLayer) {\n\t\topenUI5BlockLayer.setAttribute(\"popover\", \"manual\");\n\t\topenUI5BlockLayer.hidePopover();\n\t\topenUI5BlockLayer.showPopover();\n\t}\n\n\tdomRef.setAttribute(\"popover\", \"manual\");\n\tdomRef.hidePopover();\n\tdomRef.showPopover();\n};\n\nconst closeNativePopoverForOpenUI5 = (popup: OpenUI5Popup) => {\n\tconst domRef = getPopupContentElement(popup);\n\n\tif (!domRef) {\n\t\treturn;\n\t}\n\n\tif (domRef.hasAttribute(\"popover\")) {\n\t\tdomRef.hidePopover();\n\t\tdomRef.removeAttribute(\"popover\");\n\t}\n\n\tif (getTopmostPopup() !== popup) {\n\t\treturn;\n\t}\n\n\t// The OpenUI5 block layer is only one for all modal OpenUI5 popups,\n\t// and it is displayed above all opened pupups - OpenUI5 and Web Components,\n\t// as a result, we need to hide this block layer.\n\t// If the underlying popup is a Web Component - it is displayed like a native popover, and we don't need to do anything\n\t// If the underlying popup is an OpenUI5 popup, it will be fixed in fixTopmostOpenUI5Popup method.\n\tif (popup.getModal()) {\n\t\tconst openUI5BlockLayer = document.getElementById(\"sap-ui-blocklayer-popup\");\n\t\tif (openUI5BlockLayer && openUI5BlockLayer.hasAttribute(\"popover\")) {\n\t\t\topenUI5BlockLayer.hidePopover();\n\t\t}\n\t}\n};\n\nconst fixTopmostOpenUI5Popup = () => {\n\tif (!isNativePopoverOpen()) {\n\t\treturn;\n\t}\n\n\tconst prevPopup = AllOpenedPopupsRegistry.openedRegistry[AllOpenedPopupsRegistry.openedRegistry.length - 2];\n\tif (!prevPopup\n\t\t|| prevPopup.type !== \"OpenUI5\"\n\t\t|| !prevPopup.instance.getModal()) {\n\t\treturn;\n\t}\n\n\tconst content = getPopupContentElement(prevPopup.instance);\n\tconst openUI5BlockLayer = document.getElementById(\"sap-ui-blocklayer-popup\");\n\n\tcontent?.hidePopover();\n\topenUI5BlockLayer?.showPopover();\n\n\tcontent?.showPopover();\n};\n\nconst isNativePopoverOpen = (root: Document | ShadowRoot = document): boolean => {\n\tif (root.querySelector(\":popover-open\")) {\n\t\treturn true;\n\t}\n\n\treturn Array.from(root.querySelectorAll(\"*\")).some(element => {\n\t\tconst shadowRoot = element.shadowRoot;\n\t\treturn shadowRoot && isNativePopoverOpen(shadowRoot);\n\t});\n};\n\nconst patchDialog = (Dialog: OpenUI5DialogClass) => {\n\tconst key = \"Dialog.prototype.onsapescape\";\n\tif (shouldRepatch(key)) {\n\t\tPatchedFunctions[key] = { version: VersionInfo, originalFn: PatchedFunctions[key]?.originalFn ?? Dialog.prototype.onsapescape };\n\t}\n\tconst origOnsapescape = PatchedFunctions[key].originalFn;\n\tDialog.prototype.onsapescape = function onsapescape(...args: any[]) {\n\t\tif (hasWebComponentPopupAbove(this.oPopup)) {\n\t\t\treturn;\n\t\t}\n\n\t\torigOnsapescape.apply(this, args);\n\t};\n};\n\nconst patchOpen = (Popup: OpenUI5PopupClass) => {\n\tconst key = \"Popup.prototype.open\";\n\tif (shouldRepatch(key)) {\n\t\tPatchedFunctions[key] = { version: VersionInfo, originalFn: PatchedFunctions[key]?.originalFn ?? Popup.prototype.open };\n\t}\n\tconst origOpen = PatchedFunctions[key].originalFn;\n\tPopup.prototype.open = function open(...args: any[]) {\n\t\torigOpen.apply(this, args); // call open first to initiate opening\n\t\topenNativePopoverForOpenUI5(this);\n\n\t\taddOpenedPopup({\n\t\t\ttype: \"OpenUI5\",\n\t\t\tinstance: this,\n\t\t});\n\t};\n};\n\nconst patchClosed = (Popup: OpenUI5PopupClass) => {\n\tconst key = \"Popup.prototype._closed\";\n\tif (shouldRepatch(key)) {\n\t\tPatchedFunctions[key] = { version: VersionInfo, originalFn: PatchedFunctions[key]?.originalFn ?? Popup.prototype._closed };\n\t}\n\tconst _origClosed = PatchedFunctions[key].originalFn;\n\tPopup.prototype._closed = function _closed(...args: any[]) {\n\t\tcloseNativePopoverForOpenUI5(this);\n\t\t_origClosed.apply(this, args); // only then call _close\n\t\tremoveOpenedPopup(this);\n\t};\n};\n\nconst patchFocusEvent = (Popup: OpenUI5PopupClass) => {\n\tconst key = \"Popup.prototype.onFocusEvent\";\n\tif (shouldRepatch(key)) {\n\t\tPatchedFunctions[key] = { version: VersionInfo, originalFn: PatchedFunctions[key]?.originalFn ?? Popup.prototype.onFocusEvent };\n\t}\n\tconst origFocusEvent = PatchedFunctions[key].originalFn;\n\tPopup.prototype.onFocusEvent = function onFocusEvent(...args: any[]) {\n\t\tif (!hasWebComponentPopupAbove(this)) {\n\t\t\torigFocusEvent.apply(this, args);\n\t\t}\n\t};\n};\n\nconst createGlobalStyles = () => {\n\tconst stylesheet = new CSSStyleSheet();\n\tstylesheet.replaceSync(`.sapMPopup-CTX:popover-open { inset: unset; }`);\n\tdocument.adoptedStyleSheets = [...document.adoptedStyleSheets, stylesheet];\n};\n\nconst patchPopup = (Popup: OpenUI5PopupClass, Dialog: OpenUI5DialogClass) => {\n\tinsertOpenUI5PopupStyles();\n\tpatchOpen(Popup); // Popup.prototype.open\n\tpatchClosed(Popup); // Popup.prototype._closed\n\tcreateGlobalStyles(); // Ensures correct popover positioning by OpenUI5 (otherwise 0,0 is the center of the screen)\n\tpatchFocusEvent(Popup);// Popup.prototype.onFocusEvent\n\tpatchDialog(Dialog); // Dialog.prototype.onsapescape\n};\n\nexport {\n\tpatchPopup,\n\taddOpenedPopup,\n\tremoveOpenedPopup,\n\tgetTopmostPopup,\n};\n\nexport type { OpenUI5PopupClass, OpenUI5DialogClass, PopupInfo };\n"],
5
+ "mappings": "aACA,OAAOA,MAAuB,0BAC9B,OAAOC,MAA8B,gCACrC,OAAOC,MAAiB,8BACxB,OAAS,mBAAAC,MAAuB,iBAShC,MAAMC,EAAmBJ,EAA4C,mBAAoB,CAAC,CAAC,EAErFK,EAAiBC,GAAyB,CAC/C,MAAMC,EAAWH,EAAiBE,CAAG,EAKrC,MAJI,CAACC,GAID,CAACA,EAAS,QACN,GAEDJ,EAAgBD,EAAaK,EAAS,OAAO,EAAI,CACzD,EAoCMC,EAA0BR,EAAwD,0BAA2B,CAAE,eAAgB,CAAC,CAAE,CAAC,EAEnIS,EAAkBC,GAAyB,CAChDF,EAAwB,eAAe,KAAKE,CAAS,CACtD,EAEMC,EAAqBC,GAAkB,CAC5C,MAAMC,EAAQL,EAAwB,eAAe,UAAUM,GAAMA,EAAG,WAAaF,CAAK,EAEtFC,IAAUL,EAAwB,eAAe,OAAS,GAC7DO,EAAuB,EAGpBF,EAAQ,IACXL,EAAwB,eAAe,OAAOK,EAAO,CAAC,CAExD,EAEMG,EAAkB,IACnBR,EAAwB,eAAe,S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G,GAAG,YAAc6B,EAAM,UAAU,OAAQ,GAE1H,MAAMG,EAAclC,EAAiBE,CAAG,EAAE,WAC1C6B,EAAM,UAAU,QAAU,YAAoBF,EAAa,CAC1DR,EAA6B,IAAI,EACjCa,EAAY,MAAM,KAAML,CAAI,EAC5BtB,EAAkB,IAAI,CACvB,CACD,EAEM4B,EAAmBJ,GAA6B,CACrD,MAAM7B,EAAM,+BACRD,EAAcC,CAAG,IACpBF,EAAiBE,CAAG,EAAI,CAAE,QAASJ,EAAa,WAAYE,EAAiBE,CAAG,GAAG,YAAc6B,EAAM,UAAU,YAAa,GAE/H,MAAMK,EAAiBpC,EAAiBE,CAAG,EAAE,WAC7C6B,EAAM,UAAU,aAAe,YAAyBF,EAAa,CAC/DhB,EAA0B,IAAI,GAClCuB,EAAe,MAAM,KAAMP,CAAI,CAEjC,CACD,EAEMQ,EAAqB,IAAM,CAChC,MAAMC,EAAa,IAAI,cACvBA,EAAW,YAAY,+CAA+C,EACtE,SAAS,mBAAqB,CAAC,GAAG,SAAS,mBAAoBA,CAAU,CAC1E,EAEMC,EAAa,CAACR,EAA0BJ,IAA+B,CAC5E9B,EAAyB,EACzBiC,EAAUC,CAAK,EACfE,EAAYF,CAAK,EACjBM,EAAmB,EACnBF,EAAgBJ,CAAK,EACrBL,EAAYC,CAAM,CACnB,EAEA,OACCY,KAAA,WACAlC,KAAA,eACAE,KAAA,kBACAK,KAAA",
6
6
  "names": ["getSharedResource", "insertOpenUI5PopupStyles", "VersionInfo", "compareVersions", "PatchedFunctions", "shouldRepatch", "key", "existing", "AllOpenedPopupsRegistry", "addOpenedPopup", "popupInfo", "removeOpenedPopup", "popup", "index", "el", "fixTopmostOpenUI5Popup", "getTopmostPopup", "hasWebComponentPopupAbove", "i", "getPopupContentElement", "content", "openNativePopoverForOpenUI5", "isNativePopoverOpen", "domRef", "openUI5BlockLayer", "closeNativePopoverForOpenUI5", "prevPopup", "root", "element", "shadowRoot", "patchDialog", "Dialog", "origOnsapescape", "args", "patchOpen", "Popup", "origOpen", "patchClosed", "_origClosed", "patchFocusEvent", "origFocusEvent", "createGlobalStyles", "stylesheet", "patchPopup"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";const e={version:"2.23.0",major:2,minor:23,patch:0,suffix:"",isNext:!1,buildTime:1780660955};export default e;
1
+ "use strict";const e={version:"2.23.2",major:2,minor:23,patch:2,suffix:"",isNext:!1,buildTime:1782484484};export default e;
2
2
  //# sourceMappingURL=VersionInfo.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/generated/VersionInfo.ts"],
4
- "sourcesContent": ["const VersionInfo = {\n\tversion: \"2.23.0\",\n\tmajor: 2,\n\tminor: 23,\n\tpatch: 0,\n\tsuffix: \"\",\n\tisNext: false,\n\tbuildTime: 1780660955,\n};\nexport default VersionInfo;"],
4
+ "sourcesContent": ["const VersionInfo = {\n\tversion: \"2.23.2\",\n\tmajor: 2,\n\tminor: 23,\n\tpatch: 2,\n\tsuffix: \"\",\n\tisNext: false,\n\tbuildTime: 1782484484,\n};\nexport default VersionInfo;"],
5
5
  "mappings": "aAAA,MAAMA,EAAc,CACnB,QAAS,SACT,MAAO,EACP,MAAO,GACP,MAAO,EACP,OAAQ,GACR,OAAQ,GACR,UAAW,UACZ,EACA,eAAeA",
6
6
  "names": ["VersionInfo"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-base",
3
- "version": "2.23.0",
3
+ "version": "2.23.2",
4
4
  "description": "UI5 Web Components: webcomponents.base",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -66,7 +66,7 @@
66
66
  "@openui5/sap.ui.core": "1.146.0",
67
67
  "@sap-theming/theming-base-content": "11.36.3",
68
68
  "@ui5/cypress-internal": "0.1.0",
69
- "@ui5/webcomponents-tools": "2.23.0",
69
+ "@ui5/webcomponents-tools": "2.23.2",
70
70
  "clean-css": "^5.2.2",
71
71
  "cypress": "15.9.0",
72
72
  "mocha": "^11.7.2",
@@ -85,5 +85,5 @@
85
85
  }
86
86
  },
87
87
  "customElements": "dist/custom-elements.json",
88
- "gitHead": "2b920fe2cdaba740dda6caa7bd0bd32302264e35"
88
+ "gitHead": "a12f5a616f6880d9b64543b7ecee99f0fe054af8"
89
89
  }