@ui5/webcomponents-base 1.12.0-rc.3 → 1.12.0

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.
Files changed (41) hide show
  1. package/.eslintignore +4 -4
  2. package/.npsrc.json +3 -0
  3. package/CHANGELOG.md +17 -0
  4. package/bundle.esm.js +2 -0
  5. package/config/wdio.conf.cjs +400 -0
  6. package/dist/assets/Boot.c60061c6.js +9 -0
  7. package/dist/assets/bundle.esm.9c467f8a.js +52 -0
  8. package/dist/assets/test/pages/{Boot.html.6c88e6c0.js → Boot.html.f5728a59.js} +1 -1
  9. package/dist/assets/test/pages/{i18n.html.8ebad660.js → i18n.html.0ea9b5b0.js} +1 -1
  10. package/dist/assets/test/pages/{i18n_texts.html.474d5e34.js → i18n_texts.html.dac50826.js} +1 -1
  11. package/dist/config/Icons.js +5 -5
  12. package/dist/config/Icons.js.map +1 -1
  13. package/dist/config/NoConflict.js +1 -0
  14. package/dist/config/NoConflict.js.map +1 -1
  15. package/dist/config/Theme.d.ts +6 -5
  16. package/dist/config/Theme.js +14 -7
  17. package/dist/config/Theme.js.map +1 -1
  18. package/dist/decorators/slot.js +2 -2
  19. package/dist/decorators/slot.js.map +1 -1
  20. package/dist/generated/AssetParameters.js +2 -0
  21. package/dist/generated/VersionInfo.js +3 -3
  22. package/dist/global.d.ts +2 -0
  23. package/dist/test/pages/AllTestElements.html +2 -2
  24. package/dist/test/pages/Boot.html +2 -2
  25. package/dist/test/pages/Configuration.html +3 -2
  26. package/dist/test/pages/ConfigurationScript.html +2 -2
  27. package/dist/test/pages/WithComplexTemplate.html +2 -2
  28. package/dist/test/pages/i18n.html +3 -3
  29. package/dist/test/pages/i18n_texts.html +3 -3
  30. package/dist/validateThemeRoot.js +14 -13
  31. package/dist/validateThemeRoot.js.map +1 -1
  32. package/index.js +227 -1
  33. package/lib/generate-asset-parameters/index.js +4 -2
  34. package/lib/generate-styles/index.js +3 -3
  35. package/lib/generate-version-info/index.js +1 -1
  36. package/{package-scripts.js → package-scripts.cjs} +2 -1
  37. package/package.json +4 -3
  38. package/config/wdio.conf.js +0 -1
  39. package/dist/assets/Boot.f55a9419.js +0 -9
  40. package/dist/assets/bundle.esm.8409a5cf.js +0 -52
  41. /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
@@ -0,0 +1,52 @@
1
+ import{f as he,g as pe,a as pt,r as Ht,s as kt,b as Bt,E as K,c as J,d as fe,e as Vt,h as ge,i as Ut,j as me,k as ye,l as _e,m as ve,n as Ae,o as $e,p as we,q as Ce,t as Se,u as be,v as Ee,w as C,x as Me,y as Te,z as Ft,A as xe,B as De,C as Ie,_ as Le,D as Pe}from"./Boot.c60061c6.js";const Ne=/('')|'([^']+(?:''[^']*)*)(?:'|$)|\{([0-9]+(?:\s*,[^{}]*)?)\}|[{}]/g,Oe=(s,t)=>(t=t||[],s.replace(Ne,(e,n,i,r,o)=>{if(n)return"'";if(i)return i.replace(/''/g,"'");if(r){const c=typeof r=="string"?parseInt(r):r;return String(t[c])}throw new Error(`[i18n]: pattern syntax error at pos ${o}`)})),Y=new Map;class Re{constructor(t){this.packageName=t}getText(t,...e){if(typeof t=="string"&&(t={key:t,defaultText:t}),!t||!t.key)return"";const n=pe(this.packageName);n&&!n[t.key]&&console.warn(`Key ${t.key} not found in the i18n bundle, the default text will be used`);const i=n&&n[t.key]?n[t.key]:t.defaultText||t.key;return Oe(i,e)}}const He=s=>{if(Y.has(s))return Y.get(s);const t=new Re(s);return Y.set(s,t),t},ke=async s=>(await he(s),He(s)),Be=pt("PopupUtilsData",{currentZIndex:100}),_t=()=>Be.currentZIndex,A=()=>{var s,t,e;return(e=(t=(s=window.sap)==null?void 0:s.ui)==null?void 0:t.getCore)==null?void 0:e.call(t)};class ft{static isLoaded(){return!!A()}static init(){const t=A();return t?new Promise(e=>{t.attachInit(()=>{window.sap.ui.require(["sap/ui/core/LocaleData","sap/ui/core/Popup"],(n,i)=>{i.setInitialZIndex(_t()),e()})})}):Promise.resolve()}static getConfigurationSettingsObject(){const t=A();if(!t)return;const e=t.getConfiguration(),n=window.sap.ui.require("sap/ui/core/LocaleData");return{animationMode:e.getAnimationMode(),language:e.getLanguage(),theme:e.getTheme(),themeRoot:e.getThemeRoot(),rtl:e.getRTL(),calendarType:e.getCalendarType(),formatSettings:{firstDayOfWeek:n?n.getInstance(e.getLocale()).getFirstDayOfWeek():void 0,legacyDateCalendarCustomizing:e.getFormatSettings().getLegacyDateCalendarCustomizing()}}}static getLocaleDataObject(){const t=A();if(!t)return;const e=t.getConfiguration();return window.sap.ui.require("sap/ui/core/LocaleData").getInstance(e.getLocale())._get()}static _listenForThemeChange(){const t=A(),e=t.getConfiguration();t.attachThemeChanged(async()=>{await kt(e.getTheme())})}static attachListeners(){!A()||ft._listenForThemeChange()}static cssVariablesLoaded(){if(!A())return;const e=[...document.head.children].find(n=>n.id==="sap-ui-theme-sap.ui.core");if(!!e)return!!e.href.match(/\/css(-|_)variables\.css/)}static getNextZIndex(){return A()?window.sap.ui.require("sap/ui/core/Popup").getNextZIndex():void 0}static setInitialZIndex(){if(!A())return;window.sap.ui.require("sap/ui/core/Popup").setInitialZIndex(_t())}}Ht("OpenUI5Support",ft);const Q=new Map,tt=new Map,vt=s=>{if(!Q.has(s)){const t=Ve(s.split("-"));Q.set(s,t)}return Q.get(s)},jt=s=>{if(!tt.has(s)){const t=s.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();tt.set(s,t)}return tt.get(s)},Ve=s=>s.map((t,e)=>e===0?t.toLowerCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(""),Ue=s=>{if(!(s instanceof HTMLElement))return"default";const t=s.getAttribute("slot");if(t){const e=t.match(/^(.+?)-\d+$/);return e?e[1]:t}return"default"},zt=s=>s instanceof HTMLSlotElement?s.assignedNodes({flatten:!0}).filter(t=>t instanceof HTMLElement):[s],Fe=s=>s.reduce((t,e)=>t.concat(zt(e)),[]);let je,At={include:[/^ui5-/],exclude:[]};const et=new Map,Wt=()=>je,ct=s=>{if(!et.has(s)){const t=At.include.some(e=>s.match(e))&&!At.exclude.some(e=>s.match(e));et.set(s,t)}return et.get(s)},qt=s=>{if(ct(s))return Wt()};class ze{constructor(t){this.metadata=t}getInitialState(){if(Object.prototype.hasOwnProperty.call(this,"_initialState"))return this._initialState;const t={},e=this.slotsAreManaged(),n=this.getProperties();for(const i in n){const r=n[i].type,o=n[i].defaultValue;r===Boolean?(t[i]=!1,o!==void 0&&console.warn("The 'defaultValue' metadata key is ignored for all booleans properties, they would be initialized with 'false' by default")):n[i].multiple?t[i]=[]:r===Object?t[i]="defaultValue"in n[i]?n[i].defaultValue:{}:r===String?t[i]="defaultValue"in n[i]?n[i].defaultValue:"":t[i]=o}if(e){const i=this.getSlots();for(const[r,o]of Object.entries(i)){const c=o.propertyName||r;t[c]=[]}}return this._initialState=t,t}static validatePropertyValue(t,e){return e.multiple&&t?t.map(i=>$t(i,e)):$t(t,e)}static validateSlotValue(t,e){return We(t,e)}getPureTag(){return this.metadata.tag||""}getTag(){const t=this.metadata.tag;if(!t)return"";const e=qt(t);return e?`${t}-${e}`:t}hasAttribute(t){const e=this.getProperties()[t];return e.type!==Object&&!e.noAttribute&&!e.multiple}getPropertiesList(){return Object.keys(this.getProperties())}getAttributesList(){return this.getPropertiesList().filter(this.hasAttribute.bind(this)).map(jt)}canSlotText(){const t=this.getSlots().default;return t&&t.type===Node}hasSlots(){return!!Object.entries(this.getSlots()).length}hasIndividualSlots(){return this.slotsAreManaged()&&Object.values(this.getSlots()).some(t=>t.individualSlots)}slotsAreManaged(){return!!this.metadata.managedSlots}supportsF6FastNavigation(){return!!this.metadata.fastNavigation}getProperties(){return this.metadata.properties||(this.metadata.properties={}),this.metadata.properties}getEvents(){return this.metadata.events||(this.metadata.events={}),this.metadata.events}getSlots(){return this.metadata.slots||(this.metadata.slots={}),this.metadata.slots}isLanguageAware(){return!!this.metadata.languageAware}isThemeAware(){return!!this.metadata.themeAware}shouldInvalidateOnChildChange(t,e,n){const i=this.getSlots()[t].invalidateOnChildChange;if(i===void 0)return!1;if(typeof i=="boolean")return i;if(typeof i=="object"){if(e==="property"){if(i.properties===void 0)return!1;if(typeof i.properties=="boolean")return i.properties;if(Array.isArray(i.properties))return i.properties.includes(n);throw new Error("Wrong format for invalidateOnChildChange.properties: boolean or array is expected")}if(e==="slot"){if(i.slots===void 0)return!1;if(typeof i.slots=="boolean")return i.slots;if(Array.isArray(i.slots))return i.slots.includes(n);throw new Error("Wrong format for invalidateOnChildChange.slots: boolean or array is expected")}}throw new Error("Wrong format for invalidateOnChildChange: boolean or object is expected")}}const $t=(s,t)=>{const e=t.type;let n=t.validator;return e&&e.isDataTypeClass&&(n=e),n?n.isValid(s)?s:t.defaultValue:!e||e===String?typeof s=="string"||typeof s>"u"||s===null?s:s.toString():e===Boolean?typeof s=="boolean"?s:!1:e===Object?typeof s=="object"?s:t.defaultValue:s in e?s:t.defaultValue},We=(s,t)=>(s&&zt(s).forEach(e=>{if(!(e instanceof t.type))throw new Error(`The element is not of type ${t.type.toString()}`)}),s);customElements.get("ui5-static-area")||customElements.define("ui5-static-area",class extends HTMLElement{});const qe=(s,t)=>{const e=Ze(t),n=Wt();return s(t,e,n)},Ze=s=>{const t=s.constructor,e=t.getMetadata().getPureTag(),n=t.getUniqueDependencies().map(i=>i.getMetadata().getPureTag()).filter(ct);return ct(e)&&n.push(e),n},Ge=()=>pt("CustomStyle.eventProvider",new K),Ke="CustomCSSChange",gt=s=>{Ge().attachEvent(Ke,s)},Je=()=>pt("CustomStyle.customCSSFor",{});gt(s=>{Bt({tag:s})});const Xe=s=>{const t=Je();return t[s]?t[s].join(""):""},Ye=10,st=s=>Array.isArray(s)?s.filter(t=>!!t).flat(Ye).map(t=>typeof t=="string"?t:t.content).join(" "):typeof s=="string"?s:s.content,W=new Map;gt(s=>{W.delete(`${s}_normal`)});const Zt=(s,t=!1)=>{const e=s.getMetadata().getTag(),n=`${e}_${t?"static":"normal"}`,i=J("OpenUI5Enablement");if(!W.has(n)){let r,o="";if(i&&(o=st(i.getBusyIndicatorStyles())),t)r=st(s.staticAreaStyles);else{const c=Xe(e)||"";r=`${st(s.styles)} ${c}`}r=`${r} ${o}`,W.set(n,r)}return W.get(n)},q=new Map;gt(s=>{q.delete(`${s}_normal`)});const Qe=(s,t=!1)=>{const n=`${s.getMetadata().getTag()}_${t?"static":"normal"}`;if(!q.has(n)){const i=Zt(s,t),r=new CSSStyleSheet;r.replaceSync(i),q.set(n,[r])}return q.get(n)},dt=(s,t=!1)=>{let e;const n=s.constructor,r=n[t?"staticAreaTemplate":"template"],o=t?s.staticAreaItem.shadowRoot:s.shadowRoot,c=qe(r,s);if(!o){console.warn("There is no shadow root to update");return}if(document.adoptedStyleSheets?o.adoptedStyleSheets=Qe(n,t):e=Zt(n,t),n.renderer){n.renderer(c,o,e,t,{host:s});return}n.render(c,o,e,t,{host:s})},ts="--_ui5_content_density",es=s=>getComputedStyle(s).getPropertyValue(ts),ss=s=>{const t=/\$([-a-z0-9A-Z._]+)(?::([^$]*))?\$/.exec(s);return t&&t[2]?t[2].split(/,/):null},ns={iw:"he",ji:"yi",in:"id",sh:"sr"},is=ss("$cldr-rtl-locales:ar,fa,he$")||[],rs=s=>(s=s&&ns[s]||s,is.indexOf(s)>=0),Gt=()=>{if(typeof document>"u")return!1;const s=fe();return s!==void 0?!!s:rs(Vt()||ge())},os="--_ui5_dir",Kt=s=>{const t=window.document,e=["ltr","rtl"],n=getComputedStyle(s).getPropertyValue(os);return e.includes(n)?n:e.includes(s.dir)?s.dir:e.includes(t.documentElement.dir)?t.documentElement.dir:e.includes(t.body.dir)?t.body.dir:Gt()?"rtl":void 0},z="ui5-static-area-item",as="data-sap-ui-integration-popup-content";class R extends HTMLElement{constructor(){super(),this._rendered=!1,this.attachShadow({mode:"open"})}setOwnerElement(t){this.ownerElement=t,this.classList.add(this.ownerElement._id),this.ownerElement.hasAttribute("data-ui5-static-stable")&&this.setAttribute("data-ui5-stable",this.ownerElement.getAttribute("data-ui5-static-stable"))}update(){this._rendered&&(this._updateAdditionalAttrs(),this._updateContentDensity(),this._updateDirection(),dt(this.ownerElement,!0))}_updateContentDensity(){es(this.ownerElement)==="compact"?(this.classList.add("sapUiSizeCompact"),this.classList.add("ui5-content-density-compact")):(this.classList.remove("sapUiSizeCompact"),this.classList.remove("ui5-content-density-compact"))}_updateDirection(){if(this.ownerElement){const t=Kt(this.ownerElement);t?this.setAttribute("dir",t):this.removeAttribute("dir")}}_updateAdditionalAttrs(){this.setAttribute(z,""),this.setAttribute(as,"")}async getDomRef(){return this._updateContentDensity(),this._rendered||(this._rendered=!0,dt(this.ownerElement,!0)),await Ut(),this.shadowRoot}static getTag(){const t=qt(z);return t?`${z}-${t}`:z}static createInstance(){return customElements.get(R.getTag())||customElements.define(R.getTag(),R),document.createElement(this.getTag())}}const ut=new WeakMap,ls=(s,t,e)=>{const n=new MutationObserver(t);ut.set(s,n),n.observe(s,e)},cs=s=>{const t=ut.get(s);t&&(t.disconnect(),ut.delete(s))},ds=["value-changed","click"];let Z;const us=s=>ds.includes(s),hs=s=>{const t=mt();return!(typeof t!="boolean"&&t.events&&t.events.includes&&t.events.includes(s))},mt=()=>(Z===void 0&&(Z=me()),Z),ps=s=>{Z=s},fs=s=>{const t=mt();return us(s)?!1:t===!0?!0:!hs(s)},gs=["disabled","title","hidden","role","draggable"],wt=s=>gs.includes(s)||s.startsWith("aria")?!0:![HTMLElement,Element,Node].some(e=>e.prototype.hasOwnProperty(s)),Ct=(s,t)=>{if(s.length!==t.length)return!1;for(let e=0;e<s.length;e++)if(s[e]!==t[e])return!1;return!0};let ms=0;const St=new Map,nt=new Map;function L(s){this._suppressInvalidation||(this.onInvalidation(s),this._changedState.push(s),Ee(this),this._eventProvider.fireEvent("invalidate",{...s,target:this}))}class w extends HTMLElement{constructor(){super();const t=this.constructor;this._changedState=[],this._suppressInvalidation=!0,this._inDOM=!1,this._fullyConnected=!1,this._childChangeListeners=new Map,this._slotChangeListeners=new Map,this._eventProvider=new K;let e;this._domRefReadyPromise=new Promise(n=>{e=n}),this._domRefReadyPromise._deferredResolve=e,this._doNotSyncAttributes=new Set,this._state={...t.getMetadata().getInitialState()},this._upgradeAllProperties(),t._needsShadowDOM()&&this.attachShadow({mode:"open"})}get _id(){return this.__id||(this.__id=`ui5wc_${++ms}`),this.__id}async connectedCallback(){const t=this.constructor;this.setAttribute(t.getMetadata().getPureTag(),""),t.getMetadata().supportsF6FastNavigation()&&this.setAttribute("data-sap-ui-fastnavgroup","true");const e=t.getMetadata().slotsAreManaged();this._inDOM=!0,e&&(this._startObservingDOMChildren(),await this._processChildren()),this._inDOM&&(ye(this),this._domRefReadyPromise._deferredResolve(),this._fullyConnected=!0,this.onEnterDOM())}disconnectedCallback(){const e=this.constructor.getMetadata().slotsAreManaged();this._inDOM=!1,e&&this._stopObservingDOMChildren(),this._fullyConnected&&(this.onExitDOM(),this._fullyConnected=!1),this.staticAreaItem&&this.staticAreaItem.parentElement&&this.staticAreaItem.parentElement.removeChild(this.staticAreaItem),_e(this)}onBeforeRendering(){}onAfterRendering(){}onEnterDOM(){}onExitDOM(){}_startObservingDOMChildren(){const t=this.constructor;if(!t.getMetadata().hasSlots())return;const n=t.getMetadata().canSlotText(),i={childList:!0,subtree:n,characterData:n};ls(this,this._processChildren.bind(this),i)}_stopObservingDOMChildren(){cs(this)}async _processChildren(){this.constructor.getMetadata().hasSlots()&&await this._updateSlots()}async _updateSlots(){const t=this.constructor,e=t.getMetadata().getSlots(),n=t.getMetadata().canSlotText(),i=Array.from(n?this.childNodes:this.children),r=new Map,o=new Map;for(const[d,u]of Object.entries(e)){const h=u.propertyName||d;o.set(h,d),r.set(h,[...this._state[h]]),this._clearSlot(d,u)}const c=new Map,a=new Map,l=i.map(async(d,u)=>{const h=Ue(d),f=e[h];if(f===void 0){if(h!=="default"){const g=Object.keys(e).join(", ");console.warn(`Unknown slotName: ${h}, ignoring`,d,`Valid values are: ${g}`)}return}if(f.individualSlots){const g=(c.get(h)||0)+1;c.set(h,g),d._individualSlot=`${h}-${g}`}if(d instanceof HTMLElement){const g=d.localName;if(g.includes("-")){if(!window.customElements.get(g)){const de=window.customElements.whenDefined(g);let j=St.get(g);j||(j=new Promise(ue=>setTimeout(ue,1e3)),St.set(g,j)),await Promise.race([de,j])}window.customElements.upgrade(d)}}if(d=t.getMetadata().constructor.validateSlotValue(d,f),bt(d)&&f.invalidateOnChildChange){const g=this._getChildChangeListener(h);g&&d.attachInvalidate.call(d,g)}d instanceof HTMLSlotElement&&this._attachSlotChange(d,h);const m=f.propertyName||h;a.has(m)?a.get(m).push({child:d,idx:u}):a.set(m,[{child:d,idx:u}])});await Promise.all(l),a.forEach((d,u)=>{this._state[u]=d.sort((h,f)=>h.idx-f.idx).map(h=>h.child)});let p=!1;for(const[d,u]of Object.entries(e)){const h=u.propertyName||d;Ct(r.get(h),this._state[h])||(L.call(this,{type:"slot",name:o.get(h),reason:"children"}),p=!0)}p||L.call(this,{type:"slot",name:"default",reason:"textcontent"})}_clearSlot(t,e){const n=e.propertyName||t;this._state[n].forEach(r=>{if(bt(r)){const o=this._getChildChangeListener(t);o&&r.detachInvalidate.call(r,o)}r instanceof HTMLSlotElement&&this._detachSlotChange(r,t)}),this._state[n]=[]}attachInvalidate(t){this._eventProvider.attachEvent("invalidate",t)}detachInvalidate(t){this._eventProvider.detachEvent("invalidate",t)}_onChildChange(t,e){!this.constructor.getMetadata().shouldInvalidateOnChildChange(t,e.type,e.name)||L.call(this,{type:"slot",name:t,reason:"childchange",child:e.target})}attributeChangedCallback(t,e,n){let i;if(this._doNotSyncAttributes.has(t))return;const r=this.constructor.getMetadata().getProperties(),o=t.replace(/^ui5-/,""),c=vt(o);if(r.hasOwnProperty(c)){const a=r[c],l=a.type;let p=a.validator;l&&l.isDataTypeClass&&(p=l),p?i=p.attributeToProperty(n):l===Boolean?i=n!==null:i=n,this[c]=i}}_updateAttribute(t,e){const n=this.constructor;if(!n.getMetadata().hasAttribute(t))return;const r=n.getMetadata().getProperties()[t],o=r.type;let c=r.validator;const a=jt(t),l=this.getAttribute(a);if(o&&o.isDataTypeClass&&(c=o),c){const p=c.propertyToAttribute(e);p===null?(this._doNotSyncAttributes.add(a),this.removeAttribute(a),this._doNotSyncAttributes.delete(a)):this.setAttribute(a,p)}else o===Boolean?e===!0&&l===null?this.setAttribute(a,""):e===!1&&l!==null&&this.removeAttribute(a):typeof e!="object"&&l!==e&&this.setAttribute(a,e)}_upgradeProperty(t){if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this[t]=e}}_upgradeAllProperties(){this.constructor.getMetadata().getPropertiesList().forEach(this._upgradeProperty.bind(this))}_getChildChangeListener(t){return this._childChangeListeners.has(t)||this._childChangeListeners.set(t,this._onChildChange.bind(this,t)),this._childChangeListeners.get(t)}_getSlotChangeListener(t){return this._slotChangeListeners.has(t)||this._slotChangeListeners.set(t,this._onSlotChange.bind(this,t)),this._slotChangeListeners.get(t)}_attachSlotChange(t,e){const n=this._getSlotChangeListener(e);n&&t.addEventListener("slotchange",n)}_detachSlotChange(t,e){t.removeEventListener("slotchange",this._getSlotChangeListener(e))}_onSlotChange(t){L.call(this,{type:"slot",name:t,reason:"slotchange"})}onInvalidation(t){}_render(){const t=this.constructor,e=t.getMetadata().hasIndividualSlots();this._suppressInvalidation=!0,this.onBeforeRendering(),this._onComponentStateFinalized&&this._onComponentStateFinalized(),this._suppressInvalidation=!1,this._changedState=[],t._needsShadowDOM()&&dt(this),this.staticAreaItem&&this.staticAreaItem.update(),e&&this._assignIndividualSlotsToChildren(),this.onAfterRendering()}_assignIndividualSlotsToChildren(){Array.from(this.children).forEach(e=>{e._individualSlot&&e.setAttribute("slot",e._individualSlot)})}_waitForDomRef(){return this._domRefReadyPromise}getDomRef(){if(typeof this._getRealDomRef=="function")return this._getRealDomRef();if(!this.shadowRoot||this.shadowRoot.children.length===0)return;const t=[...this.shadowRoot.children].filter(e=>!["link","style"].includes(e.localName));return t.length!==1&&console.warn(`The shadow DOM for ${this.constructor.getMetadata().getTag()} does not have a top level element, the getDomRef() method might not work as expected`),t[0]}getFocusDomRef(){const t=this.getDomRef();if(t)return t.querySelector("[data-sap-focus-ref]")||t}async getFocusDomRefAsync(){return await this._waitForDomRef(),this.getFocusDomRef()}async focus(t){await this._waitForDomRef();const e=this.getFocusDomRef();e&&typeof e.focus=="function"&&e.focus(t)}fireEvent(t,e,n=!1,i=!0){const r=this._fireEvent(t,e,n,i),o=vt(t);return o!==t?r&&this._fireEvent(o,e,n):r}_fireEvent(t,e,n=!1,i=!0){const r=new CustomEvent(`ui5-${t}`,{detail:e,composed:!1,bubbles:i,cancelable:n}),o=this.dispatchEvent(r);if(fs(t))return o;const c=new CustomEvent(t,{detail:e,composed:!1,bubbles:i,cancelable:n});return this.dispatchEvent(c)&&o}getSlottedNodes(t){return Fe(this[t])}get effectiveDir(){return ve(this.constructor),Kt(this)}get isUI5Element(){return!0}get classes(){return{}}static get observedAttributes(){return this.getMetadata().getAttributesList()}static _needsShadowDOM(){return!!this.template}static _needsStaticArea(){return!!this.staticAreaTemplate}getStaticAreaItemDomRef(){if(!this.constructor._needsStaticArea())throw new Error("This component does not use the static area");return this.staticAreaItem||(this.staticAreaItem=R.createInstance(),this.staticAreaItem.setOwnerElement(this)),this.staticAreaItem.parentElement||Ae("ui5-static-area").appendChild(this.staticAreaItem),this.staticAreaItem.getDomRef()}static _generateAccessors(){const t=this.prototype,e=this.getMetadata().slotsAreManaged(),n=this.getMetadata().getProperties();for(const[i,r]of Object.entries(n)){if(wt(i)||console.warn(`"${i}" is not a valid property name. Use a name that does not collide with DOM APIs`),r.type===Boolean&&r.defaultValue)throw new Error(`Cannot set a default value for property "${i}". All booleans are false by default.`);if(r.type===Array)throw new Error(`Wrong type for property "${i}". Properties cannot be of type Array - use "multiple: true" and set "type" to the single value type, such as "String", "Object", etc...`);if(r.type===Object&&r.defaultValue)throw new Error(`Cannot set a default value for property "${i}". All properties of type "Object" are empty objects by default.`);if(r.multiple&&r.defaultValue)throw new Error(`Cannot set a default value for property "${i}". All multiple properties are empty arrays by default.`);Object.defineProperty(t,i,{get(){if(this._state[i]!==void 0)return this._state[i];const o=r.defaultValue;return r.type===Boolean?!1:r.type===String?o:r.multiple?[]:o},set(o){let c;o=this.constructor.getMetadata().constructor.validatePropertyValue(o,r);const p=r.type;let d=r.validator;const u=this._state[i];p&&p.isDataTypeClass&&(d=p),d?c=!d.valuesAreEqual(u,o):Array.isArray(u)&&Array.isArray(o)&&r.multiple&&r.compareValues?c=!Ct(u,o):c=u!==o,c&&(this._state[i]=o,L.call(this,{type:"property",name:i,newValue:o,oldValue:u}),this._updateAttribute(i,o))}})}if(e){const i=this.getMetadata().getSlots();for(const[r,o]of Object.entries(i)){wt(r)||console.warn(`"${r}" is not a valid property name. Use a name that does not collide with DOM APIs`);const c=o.propertyName||r;Object.defineProperty(t,c,{get(){return this._state[c]!==void 0?this._state[c]:[]},set(){throw new Error("Cannot set slot content directly, use the DOM APIs (appendChild, removeChild, etc...)")}})}}}static get styles(){return""}static get staticAreaStyles(){return""}static get dependencies(){return[]}static getUniqueDependencies(){if(!nt.has(this)){const t=this.dependencies.filter((e,n,i)=>i.indexOf(e)===n);nt.set(this,t)}return nt.get(this)||[]}static whenDependenciesDefined(){return Promise.all(this.getUniqueDependencies().map(t=>t.define()))}static async onDefine(){return Promise.resolve()}static async define(){await $e(),await Promise.all([this.whenDependenciesDefined(),this.onDefine()]);const t=this.getMetadata().getTag(),e=we(t),n=customElements.get(t);return n&&!e?Ce(t):n||(this._generateAccessors(),Se(t),window.customElements.define(t,this)),this}static getMetadata(){if(this.hasOwnProperty("_metadata"))return this._metadata;const t=[this.metadata];let e=this;for(;e!==w;)e=Object.getPrototypeOf(e),t.unshift(e.metadata);const n=be({},...t);return this._metadata=new ze(n),this._metadata}}w.metadata={};const bt=s=>"isUI5Element"in s;/**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */var it;const G=window,x=G.trustedTypes,Et=x?x.createPolicy("lit-html",{createHTML:s=>s}):void 0,$=`lit$${(Math.random()+"").slice(9)}$`,yt="?"+$,ys=`<${yt}>`,D=document,H=(s="")=>D.createComment(s),k=s=>s===null||typeof s!="object"&&typeof s!="function",Jt=Array.isArray,Xt=s=>Jt(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Mt=/-->/g,Tt=/>/g,S=RegExp(`>|[
6
+ \f\r](?:([^\\s"'>=/]+)([
7
+ \f\r]*=[
8
+ \f\r]*(?:[^
9
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),xt=/'/g,Dt=/"/g,Yt=/^(?:script|style|textarea|title)$/i,_s=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),vs=_s(1),E=Symbol.for("lit-noChange"),y=Symbol.for("lit-nothing"),It=new WeakMap,T=D.createTreeWalker(D,129,null,!1),Qt=(s,t)=>{const e=s.length-1,n=[];let i,r=t===2?"<svg>":"",o=P;for(let a=0;a<e;a++){const l=s[a];let p,d,u=-1,h=0;for(;h<l.length&&(o.lastIndex=h,d=o.exec(l),d!==null);)h=o.lastIndex,o===P?d[1]==="!--"?o=Mt:d[1]!==void 0?o=Tt:d[2]!==void 0?(Yt.test(d[2])&&(i=RegExp("</"+d[2],"g")),o=S):d[3]!==void 0&&(o=S):o===S?d[0]===">"?(o=i!=null?i:P,u=-1):d[1]===void 0?u=-2:(u=o.lastIndex-d[2].length,p=d[1],o=d[3]===void 0?S:d[3]==='"'?Dt:xt):o===Dt||o===xt?o=S:o===Mt||o===Tt?o=P:(o=S,i=void 0);const f=o===S&&s[a+1].startsWith("/>")?" ":"";r+=o===P?l+ys:u>=0?(n.push(p),l.slice(0,u)+"$lit$"+l.slice(u)+$+f):l+$+(u===-2?(n.push(void 0),a):f)}const c=r+(s[e]||"<?>")+(t===2?"</svg>":"");if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return[Et!==void 0?Et.createHTML(c):c,n]};class B{constructor({strings:t,_$litType$:e},n){let i;this.parts=[];let r=0,o=0;const c=t.length-1,a=this.parts,[l,p]=Qt(t,e);if(this.el=B.createElement(l,n),T.currentNode=this.el.content,e===2){const d=this.el.content,u=d.firstChild;u.remove(),d.append(...u.childNodes)}for(;(i=T.nextNode())!==null&&a.length<c;){if(i.nodeType===1){if(i.hasAttributes()){const d=[];for(const u of i.getAttributeNames())if(u.endsWith("$lit$")||u.startsWith($)){const h=p[o++];if(d.push(u),h!==void 0){const f=i.getAttribute(h.toLowerCase()+"$lit$").split($),m=/([.?@])?(.*)/.exec(h);a.push({type:1,index:r,name:m[2],strings:f,ctor:m[1]==="."?ee:m[1]==="?"?se:m[1]==="@"?ne:V})}else a.push({type:6,index:r})}for(const u of d)i.removeAttribute(u)}if(Yt.test(i.tagName)){const d=i.textContent.split($),u=d.length-1;if(u>0){i.textContent=x?x.emptyScript:"";for(let h=0;h<u;h++)i.append(d[h],H()),T.nextNode(),a.push({type:2,index:++r});i.append(d[u],H())}}}else if(i.nodeType===8)if(i.data===yt)a.push({type:2,index:r});else{let d=-1;for(;(d=i.data.indexOf($,d+1))!==-1;)a.push({type:7,index:r}),d+=$.length-1}r++}}static createElement(t,e){const n=D.createElement("template");return n.innerHTML=t,n}}function M(s,t,e=s,n){var i,r,o,c;if(t===E)return t;let a=n!==void 0?(i=e._$Co)===null||i===void 0?void 0:i[n]:e._$Cl;const l=k(t)?void 0:t._$litDirective$;return(a==null?void 0:a.constructor)!==l&&((r=a==null?void 0:a._$AO)===null||r===void 0||r.call(a,!1),l===void 0?a=void 0:(a=new l(s),a._$AT(s,e,n)),n!==void 0?((o=(c=e)._$Co)!==null&&o!==void 0?o:c._$Co=[])[n]=a:e._$Cl=a),a!==void 0&&(t=M(s,a._$AS(s,t.values),a,n)),t}class te{constructor(t,e){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var e;const{el:{content:n},parts:i}=this._$AD,r=((e=t==null?void 0:t.creationScope)!==null&&e!==void 0?e:D).importNode(n,!0);T.currentNode=r;let o=T.nextNode(),c=0,a=0,l=i[0];for(;l!==void 0;){if(c===l.index){let p;l.type===2?p=new I(o,o.nextSibling,this,t):l.type===1?p=new l.ctor(o,l.name,l.strings,this,t):l.type===6&&(p=new ie(o,this,t)),this.u.push(p),l=i[++a]}c!==(l==null?void 0:l.index)&&(o=T.nextNode(),c++)}return r}p(t){let e=0;for(const n of this.u)n!==void 0&&(n.strings!==void 0?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}}class I{constructor(t,e,n,i){var r;this.type=2,this._$AH=y,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=i,this._$Cm=(r=i==null?void 0:i.isConnected)===null||r===void 0||r}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$Cm}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&t.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=M(this,t,e),k(t)?t===y||t==null||t===""?(this._$AH!==y&&this._$AR(),this._$AH=y):t!==this._$AH&&t!==E&&this.g(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Xt(t)?this.k(t):this.g(t)}O(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==y&&k(this._$AH)?this._$AA.nextSibling.data=t:this.T(D.createTextNode(t)),this._$AH=t}$(t){var e;const{values:n,_$litType$:i}=t,r=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=B.createElement(i.h,this.options)),i);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===r)this._$AH.p(n);else{const o=new te(r,this),c=o.v(this.options);o.p(n),this.T(c),this._$AH=o}}_$AC(t){let e=It.get(t.strings);return e===void 0&&It.set(t.strings,e=new B(t)),e}k(t){Jt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,i=0;for(const r of t)i===e.length?e.push(n=new I(this.O(H()),this.O(H()),this,this.options)):n=e[i],n._$AI(r),i++;i<e.length&&(this._$AR(n&&n._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var n;for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,e);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cm=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}}class V{constructor(t,e,n,i,r){this.type=1,this._$AH=y,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=r,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=y}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,n,i){const r=this.strings;let o=!1;if(r===void 0)t=M(this,t,e,0),o=!k(t)||t!==this._$AH&&t!==E,o&&(this._$AH=t);else{const c=t;let a,l;for(t=r[0],a=0;a<r.length-1;a++)l=M(this,c[n+a],e,a),l===E&&(l=this._$AH[a]),o||(o=!k(l)||l!==this._$AH[a]),l===y?t=y:t!==y&&(t+=(l!=null?l:"")+r[a+1]),this._$AH[a]=l}o&&!i&&this.j(t)}j(t){t===y?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}}class ee extends V{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===y?void 0:t}}const As=x?x.emptyScript:"";class se extends V{constructor(){super(...arguments),this.type=4}j(t){t&&t!==y?this.element.setAttribute(this.name,As):this.element.removeAttribute(this.name)}}class ne extends V{constructor(t,e,n,i,r){super(t,e,n,i,r),this.type=5}_$AI(t,e=this){var n;if((t=(n=M(this,t,e,0))!==null&&n!==void 0?n:y)===E)return;const i=this._$AH,r=t===y&&i!==y||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==y&&(i===y||r);r&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,n;typeof this._$AH=="function"?this._$AH.call((n=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&n!==void 0?n:this.element,t):this._$AH.handleEvent(t)}}class ie{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){M(this,t)}}const $s={P:"$lit$",A:$,M:yt,C:1,L:Qt,R:te,D:Xt,V:M,I,H:V,N:se,U:ne,B:ee,F:ie},Lt=G.litHtmlPolyfillSupport;Lt==null||Lt(B,I),((it=G.litHtmlVersions)!==null&&it!==void 0?it:G.litHtmlVersions=[]).push("2.6.1");const ws=(s,t,e)=>{var n,i;const r=(n=e==null?void 0:e.renderBefore)!==null&&n!==void 0?n:t;let o=r._$litPart$;if(o===void 0){const c=(i=e==null?void 0:e.renderBefore)!==null&&i!==void 0?i:null;r._$litPart$=o=new I(t.insertBefore(H(),c),c,void 0,e!=null?e:{})}return o._$AI(s),o};/**
10
+ * @license
11
+ * Copyright 2017 Google LLC
12
+ * SPDX-License-Identifier: BSD-3-Clause
13
+ */const re={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Cs=s=>(...t)=>({_$litDirective$:s,values:t});class oe{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}/**
14
+ * @license
15
+ * Copyright 2020 Google LLC
16
+ * SPDX-License-Identifier: BSD-3-Clause
17
+ */const{I:Ss}=$s,Pt=()=>document.createComment(""),N=(s,t,e)=>{var n;const i=s._$AA.parentNode,r=t===void 0?s._$AB:t._$AA;if(e===void 0){const o=i.insertBefore(Pt(),r),c=i.insertBefore(Pt(),r);e=new Ss(o,c,s,s.options)}else{const o=e._$AB.nextSibling,c=e._$AM,a=c!==s;if(a){let l;(n=e._$AQ)===null||n===void 0||n.call(e,s),e._$AM=s,e._$AP!==void 0&&(l=s._$AU)!==c._$AU&&e._$AP(l)}if(o!==r||a){let l=e._$AA;for(;l!==o;){const p=l.nextSibling;i.insertBefore(l,r),l=p}}}return e},b=(s,t,e=s)=>(s._$AI(t,e),s),bs={},Es=(s,t=bs)=>s._$AH=t,Ms=s=>s._$AH,rt=s=>{var t;(t=s._$AP)===null||t===void 0||t.call(s,!1,!0);let e=s._$AA;const n=s._$AB.nextSibling;for(;e!==n;){const i=e.nextSibling;e.remove(),e=i}};/**
18
+ * @license
19
+ * Copyright 2017 Google LLC
20
+ * SPDX-License-Identifier: BSD-3-Clause
21
+ */const Nt=(s,t,e)=>{const n=new Map;for(let i=t;i<=e;i++)n.set(s[i],i);return n},ae=Cs(class extends oe{constructor(s){if(super(s),s.type!==re.CHILD)throw Error("repeat() can only be used in text expressions")}ht(s,t,e){let n;e===void 0?e=t:t!==void 0&&(n=t);const i=[],r=[];let o=0;for(const c of s)i[o]=n?n(c,o):o,r[o]=e(c,o),o++;return{values:r,keys:i}}render(s,t,e){return this.ht(s,t,e).values}update(s,[t,e,n]){var i;const r=Ms(s),{values:o,keys:c}=this.ht(t,e,n);if(!Array.isArray(r))return this.ut=c,o;const a=(i=this.ut)!==null&&i!==void 0?i:this.ut=[],l=[];let p,d,u=0,h=r.length-1,f=0,m=o.length-1;for(;u<=h&&f<=m;)if(r[u]===null)u++;else if(r[h]===null)h--;else if(a[u]===c[f])l[f]=b(r[u],o[f]),u++,f++;else if(a[h]===c[m])l[m]=b(r[h],o[m]),h--,m--;else if(a[u]===c[m])l[m]=b(r[u],o[m]),N(s,l[m+1],r[u]),u++,m--;else if(a[h]===c[f])l[f]=b(r[h],o[f]),N(s,r[u],r[h]),h--,f++;else if(p===void 0&&(p=Nt(c,f,m),d=Nt(a,u,h)),p.has(a[u]))if(p.has(a[h])){const g=d.get(c[f]),F=g!==void 0?r[g]:null;if(F===null){const X=N(s,r[u]);b(X,o[f]),l[f]=X}else l[f]=b(F,o[f]),N(s,r[u],F),r[g]=null;f++}else rt(r[h]),h--;else rt(r[u]),u++;for(;f<=m;){const g=N(s,l[m+1]);b(g,o[f]),l[f++]=g}for(;u<=h;){const g=r[u++];g!==null&&rt(g)}return this.ut=c,Es(s,l),E}});/**
22
+ * @license
23
+ * Copyright 2018 Google LLC
24
+ * SPDX-License-Identifier: BSD-3-Clause
25
+ */const v=s=>s!=null?s:y;/**
26
+ * @license
27
+ * Copyright 2017 Google LLC
28
+ * SPDX-License-Identifier: BSD-3-Clause
29
+ */class Ot extends oe{constructor(t){if(super(t),this.it=y,t.type!==re.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===y||t==null)return this._t=void 0,this.it=t;if(t===E)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}Ot.directiveName="unsafeHTML",Ot.resultType=1;const _=(s,...t)=>{const e=J("LitStatic");return(e?e.html:vs)(s,...t)},U=(s,t,e,n,i)=>{const r=J("OpenUI5Enablement");r&&!n&&(s=r.wrapTemplateResultInBusyMarkup(_,i.host,s)),typeof e=="string"?s=_`<style>${e}</style>${s}`:Array.isArray(e)&&e.length&&(s=_`${e.map(o=>_`<link type="text/css" rel="stylesheet" href="${o}">`)}${s}`),ws(s,t,i)},Ts={tag:"ui5-test-generic",properties:{strProp:{type:String},boolProp:{type:Boolean},objectProp:{type:Object},noAttributeProp:{type:String,noAttribute:!0},multiProp:{type:String,multiple:!0},defaultValueProp:{type:String,defaultValue:"Hello"}},managedSlots:!0,slots:{default:{type:Node},other:{type:HTMLElement},individual:{type:HTMLElement,individualSlots:!0},named:{type:HTMLElement,propertyName:"items"}}};class le extends w{static get metadata(){return Ts}static get render(){return U}static get template(){return t=>_`<div><p>
30
+ <slot></slot>
31
+ <slot name="other"></slot>
32
+ <slot name="individual-1"></slot>
33
+ <slot name="individual-2"></slot>
34
+ </p></div>`}static get styles(){return`:host {
35
+ display: inline-block;
36
+ border: 1px solid black;
37
+ color: var(--var1);
38
+ }`}onBeforeRendering(){}onAfterRendering(){}onEnterDOM(){}onExitDOM(){}}le.define();const xs={tag:"ui5-test-no-shadow"};class Ds extends w{static get metadata(){return xs}}Ds.define();const Is={tag:"ui5-test-parent",managedSlots:!0,slots:{default:{type:Node,invalidateOnChildChange:{properties:["prop1"]}},items:{type:HTMLElement,invalidateOnChildChange:{properties:!0}}}};class Ls extends w{static get metadata(){return Is}static get render(){return U}static get template(){return t=>_`<div>
39
+ <slot></slot>
40
+ </div>`}}Ls.define();const Ps={tag:"ui5-test-child",properties:{prop1:{type:String},prop2:{type:String},prop3:{type:String}}};class Ns extends w{static get metadata(){return Ps}static get render(){return U}static get template(){return t=>_`<div></div>`}}Ns.define();const Os={tag:"ui5-with-static-area",properties:{staticContent:{type:Boolean}},slots:{}};class Rs extends w{static get metadata(){return Os}static get render(){return U}static get template(){return t=>_`
41
+ <div dir=${t.effectiveDir}>
42
+ WithStaticArea works!
43
+ </div>`}static get staticAreaTemplate(){return t=>_`
44
+ <div class="ui5-with-static-area-content">
45
+ Static area content.
46
+ </div>`}static get styles(){return`
47
+ :host {
48
+ display: inline-block;
49
+ border: 1px solid black;
50
+ color: red;
51
+ }`}async addStaticArea(){if(!this.staticContent)return;const t=await this.getStaticAreaItemDomRef();return this.responsivePopover=t.querySelector(".ui5-with-static-area-content"),this.responsivePopover}onBeforeRendering(){this.addStaticArea()}onAfterRendering(){}onEnterDOM(){}onExitDOM(){}}Rs.define();const Hs=(s,t,e)=>_`<div>Root text: ${v(s.text)}${ae(s.items,(n,i)=>n._id||i,(n,i)=>ks(n,i,s))} Root text: ${v(s.text)}</div>`,ks=(s,t,e,n,i)=>_`<h3>Item-${t}</h3>${s.text?Bs(s,t,e):void 0}<ul>${ae(s.words,(r,o)=>r._id||o,(r,o)=>Vs(r,o,e))}</ul>${s.text?Us(s,t,e):void 0}`,Bs=(s,t,e,n,i)=>_`<div class="before-each-content--start--${t}">Root text: ${v(e.text)}, Item text: ${v(s.text)}</div>`,Vs=(s,t,e,n,i)=>_`<li><h3>Word-${t}</h3><div class="nested-each-content--${t}--0">Root Text: ${v(e.text)}, Word text: ${v(s.text)}</div><div class="nested-each-content--${t}--1">Root Text: ${v(e.text)}, Word text: ${v(s.text)}</div></li>`,Us=(s,t,e,n,i)=>_`<div class="after-each-content--end--${t}">Root text: ${v(e.text)}, Item text: ${v(s.text)}</div>`;class Fs extends w{static get metadata(){return{tag:"ui5-test-complex-template"}}static get render(){return U}static get template(){return Hs}get text(){return"root"}get items(){return[{text:"positives",words:[{text:"word1_good"},{text:"word2_nice"},{text:"word3_kind"}]},{text:"negatives",words:[{text:"word4_bad"},{text:"word5_rude"},{text:"word6_unpolite"}]}]}}Fs.define();const js={tag:"ui5-test-generic-ext",properties:{extProp:{type:String},strProp:{defaultValue:"Ext"}},slots:{extSlot:{type:HTMLElement}}};class zs extends le{static get metadata(){return js}}zs.define();const Ws={content:":root{ --var1: red; }",packageName:"",fileName:""},qs={content:":root{ --var1: green; }",packageName:"",fileName:""},Zs={content:":root{ --var1: blue; }",packageName:"",fileName:""},Gs={content:":root{ --var1: orange; }",packageName:"",fileName:""},Ks={content:":root{ --var1: orange; }",packageName:"",fileName:""},Js={content:":root{ --var1: yellow; }",packageName:"",fileName:""},Xs={content:":root{ --var1: yellow; }",packageName:"",fileName:""};C("@ui5/webcomponents-base-test","sap_fiori_3",()=>Ws);C("@ui5/webcomponents-base-test","sap_fiori_3_dark",()=>qs);C("@ui5/webcomponents-base-test","sap_belize",()=>Zs);C("@ui5/webcomponents-base-test","sap_belize_hcb",()=>Gs);C("@ui5/webcomponents-base-test","sap_belize_hcw",()=>Ks);C("@ui5/webcomponents-base-test","sap_fiori_3_hcb",()=>Js);C("@ui5/webcomponents-base-test","sap_fiori_3_hcw",()=>Xs);const Ys=typeof window.chrome=="object"||typeof window.v8=="object"?(s,t)=>(t>2&&40*t>s.length,s):s=>s,Qs=/(?:\r\n|\r|\n|^)[ \t\f]*/,tn=/(\\u[0-9a-fA-F]{0,4})|(\\.)|(\\$)|([ \t\f]*[ \t\f:=][ \t\f]*)/g,en=/(\\u[0-9a-fA-F]{0,4})|(\\.)|(\\$)/g,sn={"\\f":"\f","\\n":`
52
+ `,"\\r":"\r","\\t":" "},nn=s=>{const t={},e=s.split(Qs);let n,i,r,o,c,a,l,p;const d=u=>{o?(o=`${o}${u}`,p++):(o=u,p=0)};for(c=0;c<e.length;c++)if(n=e[c],!(n===""||n.charAt(0)==="#"||n.charAt(0)==="!")){for(i=tn,l=0,i.lastIndex=l,r=null,o="",a=i.exec(n);a!==null;){if(l<a.index&&d(n.slice(l,a.index)),l=i.lastIndex,a[1]){if(a[1].length!==6)throw new Error(`Incomplete Unicode Escape '${a[1]}'`);d(String.fromCharCode(parseInt(a[1].slice(2),16)))}else a[2]?d(sn[a[2]]||a[2].slice(1)):a[3]?(n=e[++c],l=0,i.lastIndex=l):a[4]&&(r=o,o="",i=en,i.lastIndex=l);a=i.exec(n)}l<n.length&&d(n.slice(l)),r==null&&(r=o,o=""),t[r]=Ys(o,o?p:0)}return t};let ot;const rn=()=>(ot===void 0&&(ot=Me()),ot);var ht;(function(s){s.Gregorian="Gregorian",s.Islamic="Islamic",s.Japanese="Japanese",s.Buddhist="Buddhist",s.Persian="Persian"})(ht||(ht={}));const Rt=ht;let O;const on=()=>(O===void 0&&(O=Te()),O&&O in Rt?O:Rt.Gregorian);let at;class ce{static getLegacyDateCalendarCustomizing(){return at===void 0&&(at=Ft()),at.legacyDateCalendarCustomizing||[]}}Ht("LegacyDateFormats",ce);let lt;const an=()=>(lt===void 0&&(lt=Ft()),lt.firstDayOfWeek),ln=J("LegacyDateFormats"),cn=ln?ce.getLegacyDateCalendarCustomizing:()=>[],dn=new K,un="directionChange",hn=()=>dn.fireEvent(un,void 0),pn=async()=>{const s=hn();await Promise.all(s),await Bt({rtlAware:!0})};window.registerThemePropertiesLoader=C;window["sap-ui-webcomponents-bundle"]={configuration:{getAnimationMode:rn,getLanguage:Vt,setLanguage:xe,getTheme:De,getThemeRoot:Ie,setTheme:kt,getNoConflict:mt,setNoConflict:ps,getCalendarType:on,getRTL:Gt,getFirstDayOfWeek:an,getLegacyDateCalendarCustomizing:cn},getIconNames:Le,parseProperties:nn,registerI18nLoader:Pe,getI18nBundle:ke,renderFinished:Ut,applyDirection:pn,EventProvider:K};
@@ -1 +1 @@
1
- import{D as o,o as e,w as t}from"../../Boot.f55a9419.js";o(()=>{console.log("Listener1: after framework booted!")});e();const s={registerThemeProps:async()=>{t("@ui5/webcomponents-theming","sap_fiori_3",()=>({content:":root{ --customCol: #fff; --customBg: #000; }",packageName:"",fileName:""}))}};window["sap-ui-webcomponents-bundle"]=s;
1
+ import{F as o,o as e,w as t}from"../../Boot.c60061c6.js";o(()=>{console.log("Listener1: after framework booted!")});e();const s={registerThemeProps:async()=>{t("@ui5/webcomponents-theming","sap_fiori_3",()=>({content:":root{ --customCol: #fff; --customBg: #000; }",packageName:"",fileName:""}))}};window["sap-ui-webcomponents-bundle"]=s;
@@ -1 +1 @@
1
- import"../../Boot.f55a9419.js";import"../../bundle.esm.8409a5cf.js";const s=async()=>{["de","es","fr","en"].forEach(e=>window["sap-ui-webcomponents-bundle"].registerI18nLoader("myApp",e,()=>`./assets/messagebundle_${e}.properties`));const n=(await window["sap-ui-webcomponents-bundle"].getI18nBundle("myApp")).getText("PLEASE_WAIT");console.log("Please wait in the current language is: ",n)};s();
1
+ import"../../Boot.c60061c6.js";import"../../bundle.esm.9c467f8a.js";const s=async()=>{["de","es","fr","en"].forEach(e=>window["sap-ui-webcomponents-bundle"].registerI18nLoader("myApp",e,()=>`./assets/messagebundle_${e}.properties`));const n=(await window["sap-ui-webcomponents-bundle"].getI18nBundle("myApp")).getText("PLEASE_WAIT");console.log("Please wait in the current language is: ",n)};s();
@@ -1 +1 @@
1
- import"../../Boot.f55a9419.js";import"../../bundle.esm.8409a5cf.js";const a=async()=>{window["sap-ui-webcomponents-bundle"].configuration.setLanguage("fr");const s=["test_1","test_2","test_3","test_4","test_5","test_6","test_7","test_8","test_9"];window["sap-ui-webcomponents-bundle"].registerI18nLoader("myApp","fr",async e=>{const t=await(await fetch(`./assets/messagebundle_${e}.properties`)).text();return window["sap-ui-webcomponents-bundle"].parseProperties(t)});const r=await window["sap-ui-webcomponents-bundle"].getI18nBundle("myApp");s.forEach(e=>{const t=r.getText(e.toUpperCase(),"test"),n=document.getElementById(`${e}_text`);n.innerText=t}),s.forEach(e=>{const t=document.getElementById(`${e}_text`),n=document.getElementById(`${e}_result`);if(t.innerText!==n.innerText){const o=n.parentElement;o.style.textDecoration="underline",o.style.color="red"}})};a();
1
+ import"../../Boot.c60061c6.js";import"../../bundle.esm.9c467f8a.js";const a=async()=>{window["sap-ui-webcomponents-bundle"].configuration.setLanguage("fr");const s=["test_1","test_2","test_3","test_4","test_5","test_6","test_7","test_8","test_9"];window["sap-ui-webcomponents-bundle"].registerI18nLoader("myApp","fr",async e=>{const t=await(await fetch(`./assets/messagebundle_${e}.properties`)).text();return window["sap-ui-webcomponents-bundle"].parseProperties(t)});const r=await window["sap-ui-webcomponents-bundle"].getI18nBundle("myApp");s.forEach(e=>{const t=r.getText(e.toUpperCase(),"test"),n=document.getElementById(`${e}_text`);n.innerText=t}),s.forEach(e=>{const t=document.getElementById(`${e}_text`),n=document.getElementById(`${e}_result`);if(t.innerText!==n.innerText){const o=n.parentElement;o.style.textDecoration="underline",o.style.color="red"}})};a();
@@ -1,4 +1,4 @@
1
- import { getTheme, isThemeFamily } from "./Theme.js";
1
+ import { getTheme, isLegacyThemeFamily } from "./Theme.js";
2
2
  import { getIconCollectionByAlias } from "../assets-meta/IconCollectionsAlias.js";
3
3
  const IconCollectionConfiguration = new Map();
4
4
  // All registered icon collections - all icon collections resolves to these options at the end
@@ -87,15 +87,15 @@ const getEffectiveIconCollection = (collectionName) => {
87
87
  * @returns { RegisteredIconCollection } the registered collection name
88
88
  */
89
89
  const getIconCollectionByTheme = (collectionName) => {
90
- const horizonThemeFamily = isThemeFamily("sap_horizon");
90
+ const legacyThemeFamily = isLegacyThemeFamily();
91
91
  if (!collectionName) {
92
- return horizonThemeFamily ? RegisteredIconCollection.SAPIconsV5 : RegisteredIconCollection.SAPIconsV4;
92
+ return legacyThemeFamily ? RegisteredIconCollection.SAPIconsV4 : RegisteredIconCollection.SAPIconsV5;
93
93
  }
94
94
  if (collectionName === "tnt") {
95
- return horizonThemeFamily ? RegisteredIconCollection.SAPIconsTNTV3 : RegisteredIconCollection.SAPIconsTNTV2;
95
+ return legacyThemeFamily ? RegisteredIconCollection.SAPIconsTNTV2 : RegisteredIconCollection.SAPIconsTNTV3;
96
96
  }
97
97
  if (collectionName === "business-suite") {
98
- return horizonThemeFamily ? RegisteredIconCollection.SAPBSIconsV2 : RegisteredIconCollection.SAPBSIconsV1;
98
+ return legacyThemeFamily ? RegisteredIconCollection.SAPBSIconsV1 : RegisteredIconCollection.SAPBSIconsV2;
99
99
  }
100
100
  return collectionName;
101
101
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Icons.js","sourceRoot":"","sources":["../../src/config/Icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAElF,MAAM,2BAA2B,GAAG,IAAI,GAAG,EAAkB,CAAC;AAK9D,8FAA8F;AAC9F,IAAK,wBAOJ;AAPD,WAAK,wBAAwB;IAC5B,uDAA2B,CAAA;IAC3B,uDAA2B,CAAA;IAC3B,oDAAwB,CAAA;IACxB,oDAAwB,CAAA;IACxB,8DAAkC,CAAA;IAClC,8DAAkC,CAAA;AACnC,CAAC,EAPI,wBAAwB,KAAxB,wBAAwB,QAO5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,wBAAwB,GAAG,CAAC,KAAa,EAAE,cAA8B,EAAE,EAAE;IAClF,2BAA2B,CAAC,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,wBAAwB,GAAG,CAAC,KAAa,EAAsB,EAAE;IACtE,OAAO,2BAA2B,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,0BAA0B,GAAG,CAAC,cAA+B,EAAkB,EAAE;IACtF,MAAM,YAAY,GAAG,QAAQ,EAAE,CAAC;IAChC,MAAM,yBAAyB,GAAG,2BAA2B,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAEhF,yGAAyG;IACzG,IAAI,CAAC,cAAc,IAAI,yBAAyB,EAAE;QACjD,OAAO,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;KAC3D;IAED,sEAAsE;IACtE,yHAAyH;IACzH,OAAO,wBAAwB,CAAC,cAAc,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,wBAAwB,GAAG,CAAC,cAA+B,EAA4B,EAAE;IAC9F,MAAM,kBAAkB,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;IAExD,IAAI,CAAC,cAAc,EAAE;QACpB,OAAO,kBAAkB,CAAC,CAAC,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC,CAAC,wBAAwB,CAAC,UAAU,CAAC;KACtG;IAED,IAAI,cAAc,KAAK,KAAK,EAAE;QAC7B,OAAO,kBAAkB,CAAC,CAAC,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC,CAAC,wBAAwB,CAAC,aAAa,CAAC;KAC5G;IAED,IAAI,cAAc,KAAK,gBAAgB,EAAE;QACxC,OAAO,kBAAkB,CAAC,CAAC,CAAC,wBAAwB,CAAC,YAAY,CAAC,CAAC,CAAC,wBAAwB,CAAC,YAAY,CAAC;KAC1G;IAED,OAAO,cAA0C,CAAC;AACnD,CAAC,CAAC;AAEF,OAAO,EACN,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,GACxB,CAAC","sourcesContent":["import { getTheme, isThemeFamily } from \"./Theme.js\";\nimport { getIconCollectionByAlias } from \"../assets-meta/IconCollectionsAlias.js\";\n\nconst IconCollectionConfiguration = new Map<string, string>();\n\n// All supported icon collections + unknown custom ones\ntype IconCollection = \"SAP-icons\" | \"SAP-icons-v4\" | \"SAP-icons-v5\" | \"horizon\" | \"tnt\" | \"tnt-v2\" | \"tnt-v3\" | \"business-suite\" | \"business-suite-v1\" | \"business-suite-v2\" | string;\n\n// All registered icon collections - all icon collections resolves to these options at the end\nenum RegisteredIconCollection {\n\tSAPIconsV4 = \"SAP-icons-v4\",\n\tSAPIconsV5 = \"SAP-icons-v5\",\n\tSAPIconsTNTV2 = \"tnt-v2\",\n\tSAPIconsTNTV3 = \"tnt-v3\",\n\tSAPBSIconsV1 = \"business-suite-v1\",\n\tSAPBSIconsV2 = \"business-suite-v2\",\n}\n\n/**\n * Sets the default icon collection for a given theme.\n *\n * SAP Icons is the default icon collection (that resolves to SAP-icons version 5.x in Horizon theme family and SAP-icons version 4.x in all other themes)\n * and to display icons from other collections, you have to specify the icon collection in addition to the icon name, for example: \"tnt/actor\", \"business-suite/1x2-grid-layout\", etc.\n * This method allows setting another (built-in or custom) icon collection as default per theme.\n *\n * <b>Usage</b>\n * <b>For example</b>, to make \"SAP-icons version 5.x\" the default icon collection in \"sap_fiori_3\":\n *\n * <pre>\n * setDefaultIconCollection(\"sap_fiori_3\", \"SAP-icons-v5\");\n *\n * <ui5-icon name=\"home\"></ui5-icon>\n * </pre>\n *\n * <b>For example</b>, to make a custom icon collection (with name \"my-custom-collection\") the default icon collection in \"sap_fiori_3\":\n *\n * <pre>\n * setDefaultIconCollection(\"sap_fiori_3\", \"my-custom-collection\");\n *\n * <ui5-icon name=\"custom-icon-name\"></ui5-icon>\n * </pre>\n *\n * @public\n * @param { string } theme\n * @param { string } collectionName\n */\nconst setDefaultIconCollection = (theme: string, collectionName: IconCollection) => {\n\tIconCollectionConfiguration.set(theme, collectionName);\n};\n\n/**\n * Returns the configured default icon collection for a given theme.\n *\n * @param { string } theme\n * @public\n * @returns { string | undefined }\n */\nconst getDefaultIconCollection = (theme: string): string | undefined => {\n\treturn IconCollectionConfiguration.get(theme);\n};\n\n/**\n * Returns the effective icon collection,\n * based on the default icon collection configuration and the current theme:\n * @param { IconCollection } collectionName\n * @returns { IconCollection } the effective collection name\n */\nconst getEffectiveIconCollection = (collectionName?: IconCollection): IconCollection => {\n\tconst currentTheme = getTheme();\n\tconst currentThemeConfiguration = IconCollectionConfiguration.get(currentTheme);\n\n\t// when no collection is set and default collection is configured - return the configured icon collection\n\tif (!collectionName && currentThemeConfiguration) {\n\t\treturn getIconCollectionByAlias(currentThemeConfiguration);\n\t}\n\n\t// when collection is set - return the theme dependant icon collection\n\t// when collection is not set and there is no default icon collection configured - return theme dependant icon collection\n\treturn getIconCollectionByTheme(collectionName);\n};\n\n/**\n * Returns the icon theme dependant collection, based on the collection name and current theme as follows:\n *\n * - \"no collection\" resolves to \"SAP-icons-v4\" in \"Quartz\" and \"Belize\", and to \"SAP-icons-v5\" in \"Horizon\" (or as confugred via setDefaultIconCollection)\n * - \"SAP-icons-v4\" (and its alias \"SAP-icons\") forces \"SAP-icons v4\" in any theme and resolves to itself \"SAP-icons-v4\"\n * - \"SAP-icons-v5\" (and its alias \"horizon\") forces \"SAP-icons v5\" in any theme and resolves to itself \"SAP-icons-v5\"\n * - \"tnt\" (and its alias \"SAP-icons-TNT\") resolves to \"tnt-v2\" in \"Quartz\", \"Belize\", and resolves to \"tnt-v3\" in \"Horizon\"\n * - \"tnt-v2\" forces \"TNT icons v2\" in any theme and resolves to itself \"tnt-v2\"\n * - \"tnt-v3\" forces \"TNT icons v3\" in any theme and resolves to itself \"tnt-v3\"\n * - \"business-suite\" (and its alias \"BusinessSuiteInAppSymbols\") resolves to \"business-suite-v1\" in \"Quartz\", \"Belize\", and resolves to \"business-suite-v2\" in \"Horizon\"\n * - \"business-suite-v1\" forces \"Business Suite icons v1\" in any theme and resolves to itself \"business-suite-v1\"\n * - \"business-suite-v2\" forces \"Business Suite icons v2\" in any theme and resolves to itself \"business-suite-v2\"\n *\n * <b>Note:</b> \"SAP-icons-v4\", \"SAP-icons-v5\", \"tnt-v2\", \"tnt-v3\", \"business-suite-v1\" and \"business-suite-v2\" are just returned\n * @param { IconCollection } collectionName\n * @returns { RegisteredIconCollection } the registered collection name\n */\nconst getIconCollectionByTheme = (collectionName?: IconCollection): RegisteredIconCollection => {\n\tconst horizonThemeFamily = isThemeFamily(\"sap_horizon\");\n\n\tif (!collectionName) {\n\t\treturn horizonThemeFamily ? RegisteredIconCollection.SAPIconsV5 : RegisteredIconCollection.SAPIconsV4;\n\t}\n\n\tif (collectionName === \"tnt\") {\n\t\treturn horizonThemeFamily ? RegisteredIconCollection.SAPIconsTNTV3 : RegisteredIconCollection.SAPIconsTNTV2;\n\t}\n\n\tif (collectionName === \"business-suite\") {\n\t\treturn horizonThemeFamily ? RegisteredIconCollection.SAPBSIconsV2 : RegisteredIconCollection.SAPBSIconsV1;\n\t}\n\n\treturn collectionName as RegisteredIconCollection;\n};\n\nexport {\n\tsetDefaultIconCollection,\n\tgetDefaultIconCollection,\n\tgetEffectiveIconCollection,\n\tRegisteredIconCollection,\n};\n\nexport type {\n\tIconCollection,\n};\n"]}
1
+ {"version":3,"file":"Icons.js","sourceRoot":"","sources":["../../src/config/Icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAElF,MAAM,2BAA2B,GAAG,IAAI,GAAG,EAAkB,CAAC;AAK9D,8FAA8F;AAC9F,IAAK,wBAOJ;AAPD,WAAK,wBAAwB;IAC5B,uDAA2B,CAAA;IAC3B,uDAA2B,CAAA;IAC3B,oDAAwB,CAAA;IACxB,oDAAwB,CAAA;IACxB,8DAAkC,CAAA;IAClC,8DAAkC,CAAA;AACnC,CAAC,EAPI,wBAAwB,KAAxB,wBAAwB,QAO5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,wBAAwB,GAAG,CAAC,KAAa,EAAE,cAA8B,EAAE,EAAE;IAClF,2BAA2B,CAAC,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,wBAAwB,GAAG,CAAC,KAAa,EAAsB,EAAE;IACtE,OAAO,2BAA2B,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,0BAA0B,GAAG,CAAC,cAA+B,EAAkB,EAAE;IACtF,MAAM,YAAY,GAAG,QAAQ,EAAE,CAAC;IAChC,MAAM,yBAAyB,GAAG,2BAA2B,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAEhF,yGAAyG;IACzG,IAAI,CAAC,cAAc,IAAI,yBAAyB,EAAE;QACjD,OAAO,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;KAC3D;IAED,sEAAsE;IACtE,yHAAyH;IACzH,OAAO,wBAAwB,CAAC,cAAc,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,wBAAwB,GAAG,CAAC,cAA+B,EAA4B,EAAE;IAC9F,MAAM,iBAAiB,GAAG,mBAAmB,EAAE,CAAC;IAEhD,IAAI,CAAC,cAAc,EAAE;QACpB,OAAO,iBAAiB,CAAC,CAAC,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC,CAAC,wBAAwB,CAAC,UAAU,CAAC;KACrG;IAED,IAAI,cAAc,KAAK,KAAK,EAAE;QAC7B,OAAO,iBAAiB,CAAC,CAAC,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC,CAAC,wBAAwB,CAAC,aAAa,CAAC;KAC3G;IAED,IAAI,cAAc,KAAK,gBAAgB,EAAE;QACxC,OAAO,iBAAiB,CAAC,CAAC,CAAC,wBAAwB,CAAC,YAAY,CAAC,CAAC,CAAC,wBAAwB,CAAC,YAAY,CAAC;KACzG;IAED,OAAO,cAA0C,CAAC;AACnD,CAAC,CAAC;AAEF,OAAO,EACN,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,GACxB,CAAC","sourcesContent":["import { getTheme, isLegacyThemeFamily } from \"./Theme.js\";\nimport { getIconCollectionByAlias } from \"../assets-meta/IconCollectionsAlias.js\";\n\nconst IconCollectionConfiguration = new Map<string, string>();\n\n// All supported icon collections + unknown custom ones\ntype IconCollection = \"SAP-icons\" | \"SAP-icons-v4\" | \"SAP-icons-v5\" | \"horizon\" | \"tnt\" | \"tnt-v2\" | \"tnt-v3\" | \"business-suite\" | \"business-suite-v1\" | \"business-suite-v2\" | string;\n\n// All registered icon collections - all icon collections resolves to these options at the end\nenum RegisteredIconCollection {\n\tSAPIconsV4 = \"SAP-icons-v4\",\n\tSAPIconsV5 = \"SAP-icons-v5\",\n\tSAPIconsTNTV2 = \"tnt-v2\",\n\tSAPIconsTNTV3 = \"tnt-v3\",\n\tSAPBSIconsV1 = \"business-suite-v1\",\n\tSAPBSIconsV2 = \"business-suite-v2\",\n}\n\n/**\n * Sets the default icon collection for a given theme.\n *\n * SAP Icons is the default icon collection (that resolves to SAP-icons version 5.x in Horizon theme family and SAP-icons version 4.x in all other themes)\n * and to display icons from other collections, you have to specify the icon collection in addition to the icon name, for example: \"tnt/actor\", \"business-suite/1x2-grid-layout\", etc.\n * This method allows setting another (built-in or custom) icon collection as default per theme.\n *\n * <b>Usage</b>\n * <b>For example</b>, to make \"SAP-icons version 5.x\" the default icon collection in \"sap_fiori_3\":\n *\n * <pre>\n * setDefaultIconCollection(\"sap_fiori_3\", \"SAP-icons-v5\");\n *\n * <ui5-icon name=\"home\"></ui5-icon>\n * </pre>\n *\n * <b>For example</b>, to make a custom icon collection (with name \"my-custom-collection\") the default icon collection in \"sap_fiori_3\":\n *\n * <pre>\n * setDefaultIconCollection(\"sap_fiori_3\", \"my-custom-collection\");\n *\n * <ui5-icon name=\"custom-icon-name\"></ui5-icon>\n * </pre>\n *\n * @public\n * @param { string } theme\n * @param { string } collectionName\n */\nconst setDefaultIconCollection = (theme: string, collectionName: IconCollection) => {\n\tIconCollectionConfiguration.set(theme, collectionName);\n};\n\n/**\n * Returns the configured default icon collection for a given theme.\n *\n * @param { string } theme\n * @public\n * @returns { string | undefined }\n */\nconst getDefaultIconCollection = (theme: string): string | undefined => {\n\treturn IconCollectionConfiguration.get(theme);\n};\n\n/**\n * Returns the effective icon collection,\n * based on the default icon collection configuration and the current theme:\n * @param { IconCollection } collectionName\n * @returns { IconCollection } the effective collection name\n */\nconst getEffectiveIconCollection = (collectionName?: IconCollection): IconCollection => {\n\tconst currentTheme = getTheme();\n\tconst currentThemeConfiguration = IconCollectionConfiguration.get(currentTheme);\n\n\t// when no collection is set and default collection is configured - return the configured icon collection\n\tif (!collectionName && currentThemeConfiguration) {\n\t\treturn getIconCollectionByAlias(currentThemeConfiguration);\n\t}\n\n\t// when collection is set - return the theme dependant icon collection\n\t// when collection is not set and there is no default icon collection configured - return theme dependant icon collection\n\treturn getIconCollectionByTheme(collectionName);\n};\n\n/**\n * Returns the icon theme dependant collection, based on the collection name and current theme as follows:\n *\n * - \"no collection\" resolves to \"SAP-icons-v4\" in \"Quartz\" and \"Belize\", and to \"SAP-icons-v5\" in \"Horizon\" (or as confugred via setDefaultIconCollection)\n * - \"SAP-icons-v4\" (and its alias \"SAP-icons\") forces \"SAP-icons v4\" in any theme and resolves to itself \"SAP-icons-v4\"\n * - \"SAP-icons-v5\" (and its alias \"horizon\") forces \"SAP-icons v5\" in any theme and resolves to itself \"SAP-icons-v5\"\n * - \"tnt\" (and its alias \"SAP-icons-TNT\") resolves to \"tnt-v2\" in \"Quartz\", \"Belize\", and resolves to \"tnt-v3\" in \"Horizon\"\n * - \"tnt-v2\" forces \"TNT icons v2\" in any theme and resolves to itself \"tnt-v2\"\n * - \"tnt-v3\" forces \"TNT icons v3\" in any theme and resolves to itself \"tnt-v3\"\n * - \"business-suite\" (and its alias \"BusinessSuiteInAppSymbols\") resolves to \"business-suite-v1\" in \"Quartz\", \"Belize\", and resolves to \"business-suite-v2\" in \"Horizon\"\n * - \"business-suite-v1\" forces \"Business Suite icons v1\" in any theme and resolves to itself \"business-suite-v1\"\n * - \"business-suite-v2\" forces \"Business Suite icons v2\" in any theme and resolves to itself \"business-suite-v2\"\n *\n * <b>Note:</b> \"SAP-icons-v4\", \"SAP-icons-v5\", \"tnt-v2\", \"tnt-v3\", \"business-suite-v1\" and \"business-suite-v2\" are just returned\n * @param { IconCollection } collectionName\n * @returns { RegisteredIconCollection } the registered collection name\n */\nconst getIconCollectionByTheme = (collectionName?: IconCollection): RegisteredIconCollection => {\n\tconst legacyThemeFamily = isLegacyThemeFamily();\n\n\tif (!collectionName) {\n\t\treturn legacyThemeFamily ? RegisteredIconCollection.SAPIconsV4 : RegisteredIconCollection.SAPIconsV5;\n\t}\n\n\tif (collectionName === \"tnt\") {\n\t\treturn legacyThemeFamily ? RegisteredIconCollection.SAPIconsTNTV2 : RegisteredIconCollection.SAPIconsTNTV3;\n\t}\n\n\tif (collectionName === \"business-suite\") {\n\t\treturn legacyThemeFamily ? RegisteredIconCollection.SAPBSIconsV1 : RegisteredIconCollection.SAPBSIconsV2;\n\t}\n\n\treturn collectionName as RegisteredIconCollection;\n};\n\nexport {\n\tsetDefaultIconCollection,\n\tgetDefaultIconCollection,\n\tgetEffectiveIconCollection,\n\tRegisteredIconCollection,\n};\n\nexport type {\n\tIconCollection,\n};\n"]}
@@ -2,6 +2,7 @@ import { getNoConflict as getConfiguredNoConflict } from "../InitialConfiguratio
2
2
  // Fire these events even with noConflict: true
3
3
  const excludeList = [
4
4
  "value-changed",
5
+ "click",
5
6
  ];
6
7
  let noConflict;
7
8
  const shouldFireOriginalEvent = (eventName) => {
@@ -1 +1 @@
1
- {"version":3,"file":"NoConflict.js","sourceRoot":"","sources":["../../src/config/NoConflict.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAEtF,+CAA+C;AAC/C,MAAM,WAAW,GAAG;IACnB,eAAe;CACf,CAAC;AAIF,IAAI,UAA0B,CAAC;AAE/B,MAAM,uBAAuB,GAAG,CAAC,SAAiB,EAAE,EAAE;IACrD,OAAO,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF,MAAM,0BAA0B,GAAG,CAAC,SAAiB,EAAE,EAAE;IACxD,MAAM,EAAE,GAAG,aAAa,EAAE,CAAC;IAC3B,8EAA8E;IAC9E,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,SAAS,IAAI,EAAE,CAAC,MAAM,IAAI,EAAE,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;AACvG,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,aAAa,GAAG,GAAmB,EAAE;IAC1C,IAAI,UAAU,KAAK,SAAS,EAAE;QAC7B,UAAU,GAAG,uBAAuB,EAAE,CAAC;KACvC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,aAAa,GAAG,CAAC,cAA8B,EAAE,EAAE;IACxD,UAAU,GAAG,cAAc,CAAC;AAC7B,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,SAAiB,EAAE,EAAE;IAC/C,MAAM,EAAE,GAAG,aAAa,EAAE,CAAC;IAE3B,2BAA2B;IAC3B,IAAI,uBAAuB,CAAC,SAAS,CAAC,EAAE;QACvC,OAAO,KAAK,CAAC;KACb;IAED,8BAA8B;IAC9B,IAAI,EAAE,KAAK,IAAI,EAAE;QAChB,OAAO,IAAI,CAAC;KACZ;IAED,OAAO,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,OAAO,EACN,aAAa,EACb,aAAa,EACb,iBAAiB,GACjB,CAAC","sourcesContent":["import { getNoConflict as getConfiguredNoConflict } from \"../InitialConfiguration.js\";\n\n// Fire these events even with noConflict: true\nconst excludeList = [\n\t\"value-changed\",\n];\n\ntype NoConflictData = boolean | { events: Array<string>};\n\nlet noConflict: NoConflictData;\n\nconst shouldFireOriginalEvent = (eventName: string) => {\n\treturn excludeList.includes(eventName);\n};\n\nconst shouldNotFireOriginalEvent = (eventName: string) => {\n\tconst nc = getNoConflict();\n\t// return !(nc.events && nc.events.includes && nc.events.includes(eventName));\n\treturn !(typeof nc !== \"boolean\" && nc.events && nc.events.includes && nc.events.includes(eventName));\n};\n\n/**\n * Returns if the \"noConflict\" configuration is set.\n * @public\n * @returns { NoConflictData }\n */\nconst getNoConflict = (): NoConflictData => {\n\tif (noConflict === undefined) {\n\t\tnoConflict = getConfiguredNoConflict();\n\t}\n\n\treturn noConflict;\n};\n\n/**\n * Sets the \"noConflict\" mode.\n * - When \"false\" (default value), all custom events are fired with and without the \"ui5-\" prefix.\n * - When \"true\", all custom events are fired with the \"ui5-\" prefix only.\n * - When an object is supplied, just the specified events will be fired with the \"ui5-\" prefix.\n * @public\n * @param { NoConflictData } noConflictData\n */\nconst setNoConflict = (noConflictData: NoConflictData) => {\n\tnoConflict = noConflictData;\n};\n\nconst skipOriginalEvent = (eventName: string) => {\n\tconst nc = getNoConflict();\n\n\t// Always fire these events\n\tif (shouldFireOriginalEvent(eventName)) {\n\t\treturn false;\n\t}\n\n\t// Read from the configuration\n\tif (nc === true) {\n\t\treturn true;\n\t}\n\n\treturn !shouldNotFireOriginalEvent(eventName);\n};\n\nexport {\n\tgetNoConflict,\n\tsetNoConflict,\n\tskipOriginalEvent,\n};\n"]}
1
+ {"version":3,"file":"NoConflict.js","sourceRoot":"","sources":["../../src/config/NoConflict.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAEtF,+CAA+C;AAC/C,MAAM,WAAW,GAAG;IACnB,eAAe;IACf,OAAO;CACP,CAAC;AAIF,IAAI,UAA0B,CAAC;AAE/B,MAAM,uBAAuB,GAAG,CAAC,SAAiB,EAAE,EAAE;IACrD,OAAO,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF,MAAM,0BAA0B,GAAG,CAAC,SAAiB,EAAE,EAAE;IACxD,MAAM,EAAE,GAAG,aAAa,EAAE,CAAC;IAC3B,8EAA8E;IAC9E,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,SAAS,IAAI,EAAE,CAAC,MAAM,IAAI,EAAE,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;AACvG,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,aAAa,GAAG,GAAmB,EAAE;IAC1C,IAAI,UAAU,KAAK,SAAS,EAAE;QAC7B,UAAU,GAAG,uBAAuB,EAAE,CAAC;KACvC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,aAAa,GAAG,CAAC,cAA8B,EAAE,EAAE;IACxD,UAAU,GAAG,cAAc,CAAC;AAC7B,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,SAAiB,EAAE,EAAE;IAC/C,MAAM,EAAE,GAAG,aAAa,EAAE,CAAC;IAE3B,2BAA2B;IAC3B,IAAI,uBAAuB,CAAC,SAAS,CAAC,EAAE;QACvC,OAAO,KAAK,CAAC;KACb;IAED,8BAA8B;IAC9B,IAAI,EAAE,KAAK,IAAI,EAAE;QAChB,OAAO,IAAI,CAAC;KACZ;IAED,OAAO,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,OAAO,EACN,aAAa,EACb,aAAa,EACb,iBAAiB,GACjB,CAAC","sourcesContent":["import { getNoConflict as getConfiguredNoConflict } from \"../InitialConfiguration.js\";\n\n// Fire these events even with noConflict: true\nconst excludeList = [\n\t\"value-changed\",\n\t\"click\",\n];\n\ntype NoConflictData = boolean | { events: Array<string>};\n\nlet noConflict: NoConflictData;\n\nconst shouldFireOriginalEvent = (eventName: string) => {\n\treturn excludeList.includes(eventName);\n};\n\nconst shouldNotFireOriginalEvent = (eventName: string) => {\n\tconst nc = getNoConflict();\n\t// return !(nc.events && nc.events.includes && nc.events.includes(eventName));\n\treturn !(typeof nc !== \"boolean\" && nc.events && nc.events.includes && nc.events.includes(eventName));\n};\n\n/**\n * Returns if the \"noConflict\" configuration is set.\n * @public\n * @returns { NoConflictData }\n */\nconst getNoConflict = (): NoConflictData => {\n\tif (noConflict === undefined) {\n\t\tnoConflict = getConfiguredNoConflict();\n\t}\n\n\treturn noConflict;\n};\n\n/**\n * Sets the \"noConflict\" mode.\n * - When \"false\" (default value), all custom events are fired with and without the \"ui5-\" prefix.\n * - When \"true\", all custom events are fired with the \"ui5-\" prefix only.\n * - When an object is supplied, just the specified events will be fired with the \"ui5-\" prefix.\n * @public\n * @param { NoConflictData } noConflictData\n */\nconst setNoConflict = (noConflictData: NoConflictData) => {\n\tnoConflict = noConflictData;\n};\n\nconst skipOriginalEvent = (eventName: string) => {\n\tconst nc = getNoConflict();\n\n\t// Always fire these events\n\tif (shouldFireOriginalEvent(eventName)) {\n\t\treturn false;\n\t}\n\n\t// Read from the configuration\n\tif (nc === true) {\n\t\treturn true;\n\t}\n\n\treturn !shouldNotFireOriginalEvent(eventName);\n};\n\nexport {\n\tgetNoConflict,\n\tsetNoConflict,\n\tskipOriginalEvent,\n};\n"]}
@@ -28,10 +28,11 @@ declare const getDefaultTheme: () => string;
28
28
  */
29
29
  declare const isTheme: (theme: string) => boolean;
30
30
  /**
31
- * Returns if the current theme is part of given theme family.
31
+ * Returns if the currently set theme is part of legacy theme families ("sap_belize" or "sap_fiori_3").
32
+ * <b>Note</b>: in addition, the method checks the base theme of a custom theme, built via the ThemeDesigner.
33
+ *
32
34
  * @private
33
- * @param {string} theme the theme family
34
- * @returns {boolean}
35
+ * @returns { boolean }
35
36
  */
36
- declare const isThemeFamily: (theme: string) => boolean;
37
- export { getTheme, setTheme, isTheme, isThemeFamily, getDefaultTheme, };
37
+ declare const isLegacyThemeFamily: () => boolean;
38
+ export { getTheme, setTheme, isTheme, isLegacyThemeFamily, getDefaultTheme, };
@@ -1,7 +1,8 @@
1
1
  import { getTheme as getConfiguredTheme } from "../InitialConfiguration.js";
2
2
  import { reRenderAllUI5Elements } from "../Render.js";
3
3
  import applyTheme from "../theming/applyTheme.js";
4
- import { DEFAULT_THEME } from "../generated/AssetParameters.js";
4
+ import getThemeDesignerTheme from "../theming/getThemeDesignerTheme.js";
5
+ import { DEFAULT_THEME, SUPPORTED_THEMES } from "../generated/AssetParameters.js";
5
6
  let curTheme;
6
7
  /**
7
8
  * Returns the current theme.
@@ -51,13 +52,19 @@ const isTheme = (theme) => {
51
52
  return currentTheme === theme || currentTheme === `${theme}_exp`;
52
53
  };
53
54
  /**
54
- * Returns if the current theme is part of given theme family.
55
+ * Returns if the currently set theme is part of legacy theme families ("sap_belize" or "sap_fiori_3").
56
+ * <b>Note</b>: in addition, the method checks the base theme of a custom theme, built via the ThemeDesigner.
57
+ *
55
58
  * @private
56
- * @param {string} theme the theme family
57
- * @returns {boolean}
59
+ * @returns { boolean }
58
60
  */
59
- const isThemeFamily = (theme) => {
60
- return getTheme().startsWith(theme);
61
+ const isLegacyThemeFamily = () => {
62
+ const currentTheme = getTheme();
63
+ if (!isKnownTheme(currentTheme)) {
64
+ return !getThemeDesignerTheme()?.baseThemeName?.startsWith("sap_horizon");
65
+ }
66
+ return !currentTheme.startsWith("sap_horizon");
61
67
  };
62
- export { getTheme, setTheme, isTheme, isThemeFamily, getDefaultTheme, };
68
+ const isKnownTheme = (theme) => SUPPORTED_THEMES.includes(theme);
69
+ export { getTheme, setTheme, isTheme, isLegacyThemeFamily, getDefaultTheme, };
63
70
  //# sourceMappingURL=Theme.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Theme.js","sourceRoot":"","sources":["../../src/config/Theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE,IAAI,QAAgB,CAAC;AAErB;;;;GAIG;AACH,MAAM,QAAQ,GAAG,GAAW,EAAE;IAC7B,IAAI,QAAQ,KAAK,SAAS,EAAE;QAC3B,QAAQ,GAAG,kBAAkB,EAAE,CAAC;KAChC;IAED,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,QAAQ,GAAG,KAAK,EAAE,KAAa,EAAiB,EAAE;IACvD,IAAI,QAAQ,KAAK,KAAK,EAAE;QACvB,OAAO;KACP;IAED,QAAQ,GAAG,KAAK,CAAC;IAEjB,+BAA+B;IAC/B,MAAM,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC3B,MAAM,sBAAsB,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,eAAe,GAAG,GAAW,EAAE;IACpC,OAAO,aAAa,CAAC;AACtB,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,EAAE;IACjC,MAAM,YAAY,GAAG,QAAQ,EAAE,CAAC;IAChC,OAAO,YAAY,KAAK,KAAK,IAAI,YAAY,KAAK,GAAG,KAAK,MAAM,CAAC;AAClE,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,aAAa,GAAG,CAAC,KAAa,EAAE,EAAE;IACvC,OAAO,QAAQ,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC,CAAC;AAEF,OAAO,EACN,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,aAAa,EACb,eAAe,GACf,CAAC","sourcesContent":["import { getTheme as getConfiguredTheme } from \"../InitialConfiguration.js\";\nimport { reRenderAllUI5Elements } from \"../Render.js\";\nimport applyTheme from \"../theming/applyTheme.js\";\nimport { DEFAULT_THEME } from \"../generated/AssetParameters.js\";\n\nlet curTheme: string;\n\n/**\n * Returns the current theme.\n * @public\n * @returns {string} the current theme name\n */\nconst getTheme = (): string => {\n\tif (curTheme === undefined) {\n\t\tcurTheme = getConfiguredTheme();\n\t}\n\n\treturn curTheme;\n};\n\n/**\n * Applies a new theme after fetching its assets from the network.\n * @public\n * @param {string} theme the name of the new theme\n * @returns {Promise<void>} a promise that is resolved when the new theme assets have been fetched and applied to the DOM\n */\nconst setTheme = async (theme: string): Promise<void> => {\n\tif (curTheme === theme) {\n\t\treturn;\n\t}\n\n\tcurTheme = theme;\n\n\t// Update CSS Custom Properties\n\tawait applyTheme(curTheme);\n\tawait reRenderAllUI5Elements({ themeAware: true });\n};\n\n/**\n * Returns the default theme.\n *\n * Note: Default theme might be different than the configurated one.\n *\n * @public\n * @returns {string}\n */\nconst getDefaultTheme = (): string => {\n\treturn DEFAULT_THEME;\n};\n\n/**\n * Returns if the given theme name is the one currently applied.\n * @private\n * @param {string} theme\n * @returns {boolean}\n */\nconst isTheme = (theme: string) => {\n\tconst currentTheme = getTheme();\n\treturn currentTheme === theme || currentTheme === `${theme}_exp`;\n};\n\n/**\n * Returns if the current theme is part of given theme family.\n * @private\n * @param {string} theme the theme family\n * @returns {boolean}\n */\nconst isThemeFamily = (theme: string) => {\n\treturn getTheme().startsWith(theme);\n};\n\nexport {\n\tgetTheme,\n\tsetTheme,\n\tisTheme,\n\tisThemeFamily,\n\tgetDefaultTheme,\n};\n"]}
1
+ {"version":3,"file":"Theme.js","sourceRoot":"","sources":["../../src/config/Theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,qBAAqB,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAElF,IAAI,QAAgB,CAAC;AAErB;;;;GAIG;AACH,MAAM,QAAQ,GAAG,GAAW,EAAE;IAC7B,IAAI,QAAQ,KAAK,SAAS,EAAE;QAC3B,QAAQ,GAAG,kBAAkB,EAAE,CAAC;KAChC;IAED,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,QAAQ,GAAG,KAAK,EAAE,KAAa,EAAiB,EAAE;IACvD,IAAI,QAAQ,KAAK,KAAK,EAAE;QACvB,OAAO;KACP;IAED,QAAQ,GAAG,KAAK,CAAC;IAEjB,+BAA+B;IAC/B,MAAM,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC3B,MAAM,sBAAsB,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,eAAe,GAAG,GAAW,EAAE;IACpC,OAAO,aAAa,CAAC;AACtB,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,EAAE;IACjC,MAAM,YAAY,GAAG,QAAQ,EAAE,CAAC;IAChC,OAAO,YAAY,KAAK,KAAK,IAAI,YAAY,KAAK,GAAG,KAAK,MAAM,CAAC;AAClE,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,mBAAmB,GAAG,GAAG,EAAE;IAChC,MAAM,YAAY,GAAG,QAAQ,EAAE,CAAC;IAEhC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE;QAChC,OAAO,CAAC,qBAAqB,EAAE,EAAE,aAAa,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;KAC1E;IAED,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAChD,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAEzE,OAAO,EACN,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,mBAAmB,EACnB,eAAe,GACf,CAAC","sourcesContent":["import { getTheme as getConfiguredTheme } from \"../InitialConfiguration.js\";\nimport { reRenderAllUI5Elements } from \"../Render.js\";\nimport applyTheme from \"../theming/applyTheme.js\";\nimport getThemeDesignerTheme from \"../theming/getThemeDesignerTheme.js\";\nimport { DEFAULT_THEME, SUPPORTED_THEMES } from \"../generated/AssetParameters.js\";\n\nlet curTheme: string;\n\n/**\n * Returns the current theme.\n * @public\n * @returns {string} the current theme name\n */\nconst getTheme = (): string => {\n\tif (curTheme === undefined) {\n\t\tcurTheme = getConfiguredTheme();\n\t}\n\n\treturn curTheme;\n};\n\n/**\n * Applies a new theme after fetching its assets from the network.\n * @public\n * @param {string} theme the name of the new theme\n * @returns {Promise<void>} a promise that is resolved when the new theme assets have been fetched and applied to the DOM\n */\nconst setTheme = async (theme: string): Promise<void> => {\n\tif (curTheme === theme) {\n\t\treturn;\n\t}\n\n\tcurTheme = theme;\n\n\t// Update CSS Custom Properties\n\tawait applyTheme(curTheme);\n\tawait reRenderAllUI5Elements({ themeAware: true });\n};\n\n/**\n * Returns the default theme.\n *\n * Note: Default theme might be different than the configurated one.\n *\n * @public\n * @returns {string}\n */\nconst getDefaultTheme = (): string => {\n\treturn DEFAULT_THEME;\n};\n\n/**\n * Returns if the given theme name is the one currently applied.\n * @private\n * @param {string} theme\n * @returns {boolean}\n */\nconst isTheme = (theme: string) => {\n\tconst currentTheme = getTheme();\n\treturn currentTheme === theme || currentTheme === `${theme}_exp`;\n};\n\n/**\n * Returns if the currently set theme is part of legacy theme families (\"sap_belize\" or \"sap_fiori_3\").\n * <b>Note</b>: in addition, the method checks the base theme of a custom theme, built via the ThemeDesigner.\n *\n * @private\n * @returns { boolean }\n */\nconst isLegacyThemeFamily = () => {\n\tconst currentTheme = getTheme();\n\n\tif (!isKnownTheme(currentTheme)) {\n\t\treturn !getThemeDesignerTheme()?.baseThemeName?.startsWith(\"sap_horizon\");\n\t}\n\n\treturn !currentTheme.startsWith(\"sap_horizon\");\n};\n\nconst isKnownTheme = (theme: string) => SUPPORTED_THEMES.includes(theme);\n\nexport {\n\tgetTheme,\n\tsetTheme,\n\tisTheme,\n\tisLegacyThemeFamily,\n\tgetDefaultTheme,\n};\n"]}
@@ -15,10 +15,10 @@ const slot = (slotData) => {
15
15
  metadata.slots = {};
16
16
  }
17
17
  const slotMetadata = metadata.slots;
18
- if (slotData?.default && slotMetadata.default) {
18
+ if (slotData && slotData.default && slotMetadata.default) {
19
19
  throw new Error("Only one slot can be the default slot.");
20
20
  }
21
- const key = slotData?.default ? "default" : slotKey;
21
+ const key = slotData && slotData.default ? "default" : slotKey;
22
22
  slotData = slotData || { type: HTMLElement };
23
23
  if (!slotData.type) {
24
24
  slotData.type = HTMLElement;
@@ -1 +1 @@
1
- {"version":3,"file":"slot.js","sourceRoot":"","sources":["../../src/decorators/slot.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,IAAI,GAAG,CAAC,QAAe,EAAqB,EAAE;IACnD,OAAO,CAAC,MAAW,EAAE,OAAwB,EAAE,EAAE;QAChD,MAAM,IAAI,GAAG,MAAM,CAAC,WAAgC,CAAC;QAErD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE;YAC5D,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;SACnB;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE;YACpB,QAAQ,CAAC,KAAK,GAAG,EAAE,CAAC;SACpB;QAED,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC;QAEpC,IAAI,QAAQ,EAAE,OAAO,IAAI,YAAY,CAAC,OAAO,EAAE;YAC9C,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;SAC1D;QAED,MAAM,GAAG,GAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAiB,CAAC;QAC9D,QAAQ,GAAG,QAAQ,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;QAE7C,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE;YACnB,QAAQ,CAAC,IAAI,GAAG,WAAW,CAAC;SAC5B;QAED,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE;YACvB,YAAY,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;SAC7B;QAED,IAAI,QAAQ,CAAC,OAAO,EAAE;YACrB,OAAO,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC;YACpC,YAAY,CAAC,OAAO,CAAC,YAAY,GAAG,OAAiB,CAAC;SACtD;QAED,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAC;IACnC,CAAC,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import type UI5Element from \"../UI5Element.js\";\nimport { Slot } from \"../UI5ElementMetadata.js\";\n\n/**\n * Returns a slot decorator.\n *\n * @param { Slot } slotData\n * @returns { PropertyDecorator }\n */\nconst slot = (slotData?: Slot): PropertyDecorator => {\n\treturn (target: any, slotKey: string | symbol) => {\n\t\tconst ctor = target.constructor as typeof UI5Element;\n\n\t\tif (!Object.prototype.hasOwnProperty.call(ctor, \"metadata\")) {\n\t\t\tctor.metadata = {};\n\t\t}\n\n\t\tconst metadata = ctor.metadata;\n\t\tif (!metadata.slots) {\n\t\t\tmetadata.slots = {};\n\t\t}\n\n\t\tconst slotMetadata = metadata.slots;\n\n\t\tif (slotData?.default && slotMetadata.default) {\n\t\t\tthrow new Error(\"Only one slot can be the default slot.\");\n\t\t}\n\n\t\tconst key = slotData?.default ? \"default\" : slotKey as string;\n\t\tslotData = slotData || { type: HTMLElement };\n\n\t\tif (!slotData.type) {\n\t\t\tslotData.type = HTMLElement;\n\t\t}\n\n\t\tif (!slotMetadata[key]) {\n\t\t\tslotMetadata[key] = slotData;\n\t\t}\n\n\t\tif (slotData.default) {\n\t\t\tdelete slotMetadata.default.default;\n\t\t\tslotMetadata.default.propertyName = slotKey as string;\n\t\t}\n\n\t\tctor.metadata.managedSlots = true;\n\t};\n};\n\nexport default slot;\n"]}
1
+ {"version":3,"file":"slot.js","sourceRoot":"","sources":["../../src/decorators/slot.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,IAAI,GAAG,CAAC,QAAe,EAAqB,EAAE;IACnD,OAAO,CAAC,MAAW,EAAE,OAAwB,EAAE,EAAE;QAChD,MAAM,IAAI,GAAG,MAAM,CAAC,WAAgC,CAAC;QAErD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE;YAC5D,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;SACnB;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE;YACpB,QAAQ,CAAC,KAAK,GAAG,EAAE,CAAC;SACpB;QAED,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC;QAEpC,IAAI,QAAQ,IAAI,QAAQ,CAAC,OAAO,IAAI,YAAY,CAAC,OAAO,EAAE;YACzD,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;SAC1D;QAED,MAAM,GAAG,GAAG,QAAQ,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAiB,CAAC;QACzE,QAAQ,GAAG,QAAQ,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;QAE7C,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE;YACnB,QAAQ,CAAC,IAAI,GAAG,WAAW,CAAC;SAC5B;QAED,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE;YACvB,YAAY,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;SAC7B;QAED,IAAI,QAAQ,CAAC,OAAO,EAAE;YACrB,OAAO,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC;YACpC,YAAY,CAAC,OAAO,CAAC,YAAY,GAAG,OAAiB,CAAC;SACtD;QAED,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAC;IACnC,CAAC,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import type UI5Element from \"../UI5Element.js\";\nimport { Slot } from \"../UI5ElementMetadata.js\";\n\n/**\n * Returns a slot decorator.\n *\n * @param { Slot } slotData\n * @returns { PropertyDecorator }\n */\nconst slot = (slotData?: Slot): PropertyDecorator => {\n\treturn (target: any, slotKey: string | symbol) => {\n\t\tconst ctor = target.constructor as typeof UI5Element;\n\n\t\tif (!Object.prototype.hasOwnProperty.call(ctor, \"metadata\")) {\n\t\t\tctor.metadata = {};\n\t\t}\n\n\t\tconst metadata = ctor.metadata;\n\t\tif (!metadata.slots) {\n\t\t\tmetadata.slots = {};\n\t\t}\n\n\t\tconst slotMetadata = metadata.slots;\n\n\t\tif (slotData && slotData.default && slotMetadata.default) {\n\t\t\tthrow new Error(\"Only one slot can be the default slot.\");\n\t\t}\n\n\t\tconst key = slotData && slotData.default ? \"default\" : slotKey as string;\n\t\tslotData = slotData || { type: HTMLElement };\n\n\t\tif (!slotData.type) {\n\t\t\tslotData.type = HTMLElement;\n\t\t}\n\n\t\tif (!slotMetadata[key]) {\n\t\t\tslotMetadata[key] = slotData;\n\t\t}\n\n\t\tif (slotData.default) {\n\t\t\tdelete slotMetadata.default.default;\n\t\t\tslotMetadata.default.propertyName = slotKey as string;\n\t\t}\n\n\t\tctor.metadata.managedSlots = true;\n\t};\n};\n\nexport default slot;\n"]}
@@ -1,12 +1,14 @@
1
1
  const assetParameters = {"themes":{"default":"sap_fiori_3","all":["sap_fiori_3","sap_fiori_3_dark","sap_belize","sap_belize_hcb","sap_belize_hcw","sap_fiori_3_hcb","sap_fiori_3_hcw","sap_horizon","sap_horizon_dark","sap_horizon_hcb","sap_horizon_hcw","sap_horizon_exp"]},"languages":{"default":"en","all":["ar","bg","ca","cs","cy","da","de","el","en","en_GB","en_US_sappsd","en_US_saprigi","en_US_saptrc","es","es_MX","et","fi","fr","fr_CA","hi","hr","hu","in","it","iw","ja","kk","ko","lt","lv","ms","nl","no","pl","pt_PT","pt","ro","ru","sh","sk","sl","sv","th","tr","uk","vi","zh_CN","zh_TW"]},"locales":{"default":"en","all":["ar","ar_EG","ar_SA","bg","ca","cs","da","de","de_AT","de_CH","el","el_CY","en","en_AU","en_GB","en_HK","en_IE","en_IN","en_NZ","en_PG","en_SG","en_ZA","es","es_AR","es_BO","es_CL","es_CO","es_MX","es_PE","es_UY","es_VE","et","fa","fi","fr","fr_BE","fr_CA","fr_CH","fr_LU","he","hi","hr","hu","id","it","it_CH","ja","kk","ko","lt","lv","ms","nb","nl","nl_BE","pl","pt","pt_PT","ro","ru","ru_UA","sk","sl","sr","sr_Latn","sv","th","tr","uk","vi","zh_CN","zh_HK","zh_SG","zh_TW"]}};
2
2
 
3
3
  const DEFAULT_THEME = assetParameters.themes.default;
4
+ const SUPPORTED_THEMES = assetParameters.themes.all;
4
5
  const DEFAULT_LANGUAGE = assetParameters.languages.default;
5
6
  const DEFAULT_LOCALE = assetParameters.locales.default;
6
7
  const SUPPORTED_LOCALES = assetParameters.locales.all;
7
8
 
8
9
  export {
9
10
  DEFAULT_THEME,
11
+ SUPPORTED_THEMES,
10
12
  DEFAULT_LANGUAGE,
11
13
  DEFAULT_LOCALE,
12
14
  SUPPORTED_LOCALES,
@@ -1,10 +1,10 @@
1
1
  const VersionInfo = {
2
- version: "1.12.0-rc.3",
2
+ version: "1.12.0",
3
3
  major: 1,
4
4
  minor: 12,
5
5
  patch: 0,
6
- suffix: "-rc.3",
6
+ suffix: "",
7
7
  isNext: false,
8
- buildTime: 1680163836,
8
+ buildTime: 1680595917,
9
9
  };
10
10
  export default VersionInfo;
package/dist/global.d.ts CHANGED
@@ -20,11 +20,13 @@ declare global {
20
20
 
21
21
  module "*generated/AssetParameters.js" {
22
22
  const DEFAULT_THEME: string;
23
+ const SUPPORTED_THEMES: Array<string>;
23
24
  const DEFAULT_LANGUAGE: string;
24
25
  const DEFAULT_LOCALE: string;
25
26
  const SUPPORTED_LOCALES: Array<string>;
26
27
  export {
27
28
  DEFAULT_THEME,
29
+ SUPPORTED_THEMES,
28
30
  DEFAULT_LANGUAGE,
29
31
  DEFAULT_LOCALE,
30
32
  SUPPORTED_LOCALES,
@@ -6,8 +6,8 @@
6
6
  <title>Base package default test page</title>
7
7
 
8
8
 
9
- <script type="module" crossorigin src="/assets/Boot.f55a9419.js"></script>
10
- <script type="module" crossorigin src="/assets/bundle.esm.8409a5cf.js"></script>
9
+ <script type="module" crossorigin src="/assets/Boot.c60061c6.js"></script>
10
+ <script type="module" crossorigin src="/assets/bundle.esm.9c467f8a.js"></script>
11
11
  </head>
12
12
 
13
13
  <body>
@@ -6,8 +6,8 @@
6
6
  <script>delete Document.prototype.adoptedStyleSheets</script>
7
7
 
8
8
 
9
- <script type="module" crossorigin src="/assets/test/pages/Boot.html.6c88e6c0.js"></script>
10
- <link rel="modulepreload" crossorigin href="/assets/Boot.f55a9419.js">
9
+ <script type="module" crossorigin src="/assets/test/pages/Boot.html.f5728a59.js"></script>
10
+ <link rel="modulepreload" crossorigin href="/assets/Boot.c60061c6.js">
11
11
  <link rel="stylesheet" href="/assets/Boot.34b7cea0.css">
12
12
  </head>
13
13
  <body>
@@ -2,13 +2,14 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta charset="utf-8">
5
+ <meta name="sap-allowedThemeOrigins" content="https://example.com">
5
6
 
6
7
  <title>Base package default test page</title>
7
8
 
8
9
 
9
10
 
10
- <script type="module" crossorigin src="/assets/Boot.f55a9419.js"></script>
11
- <script type="module" crossorigin src="/assets/bundle.esm.8409a5cf.js"></script>
11
+ <script type="module" crossorigin src="/assets/Boot.c60061c6.js"></script>
12
+ <script type="module" crossorigin src="/assets/bundle.esm.9c467f8a.js"></script>
12
13
  </head>
13
14
 
14
15
  <body>
@@ -40,8 +40,8 @@
40
40
 
41
41
 
42
42
 
43
- <script type="module" crossorigin src="/assets/Boot.f55a9419.js"></script>
44
- <script type="module" crossorigin src="/assets/bundle.esm.8409a5cf.js"></script>
43
+ <script type="module" crossorigin src="/assets/Boot.c60061c6.js"></script>
44
+ <script type="module" crossorigin src="/assets/bundle.esm.9c467f8a.js"></script>
45
45
  </head>
46
46
 
47
47
  <body>
@@ -4,8 +4,8 @@
4
4
  <meta charset="utf-8">
5
5
  <title>Compex Template Test Page</title>
6
6
 
7
- <script type="module" crossorigin src="/assets/Boot.f55a9419.js"></script>
8
- <script type="module" crossorigin src="/assets/bundle.esm.8409a5cf.js"></script>
7
+ <script type="module" crossorigin src="/assets/Boot.c60061c6.js"></script>
8
+ <script type="module" crossorigin src="/assets/bundle.esm.9c467f8a.js"></script>
9
9
  </head>
10
10
 
11
11
  <body>
@@ -7,9 +7,9 @@
7
7
 
8
8
 
9
9
 
10
- <script type="module" crossorigin src="/assets/test/pages/i18n.html.8ebad660.js"></script>
11
- <link rel="modulepreload" crossorigin href="/assets/Boot.f55a9419.js">
12
- <link rel="modulepreload" crossorigin href="/assets/bundle.esm.8409a5cf.js">
10
+ <script type="module" crossorigin src="/assets/test/pages/i18n.html.0ea9b5b0.js"></script>
11
+ <link rel="modulepreload" crossorigin href="/assets/Boot.c60061c6.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/bundle.esm.9c467f8a.js">
13
13
  </head>
14
14
 
15
15
  <body>
@@ -8,9 +8,9 @@
8
8
 
9
9
 
10
10
 
11
- <script type="module" crossorigin src="/assets/test/pages/i18n_texts.html.474d5e34.js"></script>
12
- <link rel="modulepreload" crossorigin href="/assets/Boot.f55a9419.js">
13
- <link rel="modulepreload" crossorigin href="/assets/bundle.esm.8409a5cf.js">
11
+ <script type="module" crossorigin src="/assets/test/pages/i18n_texts.html.dac50826.js"></script>
12
+ <link rel="modulepreload" crossorigin href="/assets/Boot.c60061c6.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/bundle.esm.9c467f8a.js">
14
14
  </head>
15
15
 
16
16
  <body>
@@ -13,26 +13,27 @@ const buildCorrectUrl = (oldUrl, newOrigin) => {
13
13
  return new URL(oldUrlPath, newOrigin).toString();
14
14
  };
15
15
  const validateThemeRoot = (themeRoot) => {
16
- let themeRootURL, resultUrl;
16
+ let resultUrl;
17
17
  try {
18
- themeRootURL = new URL(themeRoot);
19
- const origin = themeRootURL.origin;
20
- themeRootURL = themeRootURL.toString();
21
- if (themeRootURL.startsWith(".") || themeRootURL.startsWith("/")) {
18
+ if (themeRoot.startsWith(".") || themeRoot.startsWith("/")) {
22
19
  // Handle relative url
23
20
  // new URL("/newExmPath", "http://example.com/exmPath") => http://example.com/newExmPath
24
21
  // new URL("./newExmPath", "http://example.com/exmPath") => http://example.com/exmPath/newExmPath
25
22
  // new URL("../newExmPath", "http://example.com/exmPath") => http://example.com/newExmPath
26
- resultUrl = new URL(themeRootURL, window.location.href).toString();
27
- }
28
- else if (origin && validateThemeOrigin(origin)) {
29
- // If origin is allowed, use it
30
- resultUrl = themeRootURL.toString();
23
+ resultUrl = new URL(themeRoot, window.location.href).toString();
31
24
  }
32
25
  else {
33
- // If origin is not allow and the URL is not relative, we have to replace the origin
34
- // with current location
35
- resultUrl = buildCorrectUrl(themeRootURL, window.location.href);
26
+ const themeRootURL = new URL(themeRoot);
27
+ const origin = themeRootURL.origin;
28
+ if (origin && validateThemeOrigin(origin)) {
29
+ // If origin is allowed, use it
30
+ resultUrl = themeRootURL.toString();
31
+ }
32
+ else {
33
+ // If origin is not allow and the URL is not relative, we have to replace the origin
34
+ // with current location
35
+ resultUrl = buildCorrectUrl(themeRootURL.toString(), window.location.href);
36
+ }
36
37
  }
37
38
  if (!resultUrl.endsWith("/")) {
38
39
  resultUrl = `${resultUrl}/`;
@@ -1 +1 @@
1
- {"version":3,"file":"validateThemeRoot.js","sourceRoot":"","sources":["../src/validateThemeRoot.ts"],"names":[],"mappings":"AAAA,MAAM,eAAe,GAAG,CAAC,WAAmB,EAAE,EAAE;IAC/C,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,cAAc,WAAW,IAAI,CAAC,EACpE,cAAc,GAAG,OAAO,IAAI,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAE7D,OAAO,cAAc,CAAC;AACvB,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,MAAc,EAAE,EAAE;IAC9C,MAAM,cAAc,GAAG,eAAe,CAAC,yBAAyB,CAAC,CAAC;IAElE,OAAO,cAAc,IAAI,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE;QACvE,OAAO,aAAa,KAAK,GAAG,IAAI,MAAM,KAAK,aAAa,CAAC,IAAI,EAAE,CAAC;IACjE,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,MAAc,EAAE,SAAiB,EAAE,EAAE;IAC7D,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC;IAE5C,OAAO,IAAI,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAC;AAClD,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,SAAiB,EAAE,EAAE;IAC/C,IAAI,YAAY,EACf,SAAS,CAAC;IAEX,IAAI;QACH,YAAY,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;QAElC,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;QAEnC,YAAY,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;QAEvC,IAAI,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YACjE,sBAAsB;YACtB,wFAAwF;YACxF,iGAAiG;YACjG,0FAA0F;YAC1F,SAAS,GAAG,IAAI,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;SACnE;aAAM,IAAI,MAAM,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE;YACjD,+BAA+B;YAC/B,SAAS,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;SACpC;aAAM;YACN,oFAAoF;YACpF,wBAAwB;YACxB,SAAS,GAAG,eAAe,CAAC,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;SAChE;QAED,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC7B,SAAS,GAAG,GAAG,SAAS,GAAG,CAAC;SAC5B;QAED,OAAO,GAAG,SAAS,MAAM,CAAC;KAC1B;IAAC,OAAO,CAAC,EAAE;QACX,8BAA8B;KAC9B;AACF,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["const getMetaTagValue = (metaTagName: string) => {\n\tconst metaTag = document.querySelector(`META[name=\"${metaTagName}\"]`),\n\t\tmetaTagContent = metaTag && metaTag.getAttribute(\"content\");\n\n\treturn metaTagContent;\n};\n\nconst validateThemeOrigin = (origin: string) => {\n\tconst allowedOrigins = getMetaTagValue(\"sap-allowedThemeOrigins\");\n\n\treturn allowedOrigins && allowedOrigins.split(\",\").some(allowedOrigin => {\n\t\treturn allowedOrigin === \"*\" || origin === allowedOrigin.trim();\n\t});\n};\n\nconst buildCorrectUrl = (oldUrl: string, newOrigin: string) => {\n\tconst oldUrlPath = new URL(oldUrl).pathname;\n\n\treturn new URL(oldUrlPath, newOrigin).toString();\n};\n\nconst validateThemeRoot = (themeRoot: string) => {\n\tlet themeRootURL,\n\t\tresultUrl;\n\n\ttry {\n\t\tthemeRootURL = new URL(themeRoot);\n\n\t\tconst origin = themeRootURL.origin;\n\n\t\tthemeRootURL = themeRootURL.toString();\n\n\t\tif (themeRootURL.startsWith(\".\") || themeRootURL.startsWith(\"/\")) {\n\t\t\t// Handle relative url\n\t\t\t// new URL(\"/newExmPath\", \"http://example.com/exmPath\") => http://example.com/newExmPath\n\t\t\t// new URL(\"./newExmPath\", \"http://example.com/exmPath\") => http://example.com/exmPath/newExmPath\n\t\t\t// new URL(\"../newExmPath\", \"http://example.com/exmPath\") => http://example.com/newExmPath\n\t\t\tresultUrl = new URL(themeRootURL, window.location.href).toString();\n\t\t} else if (origin && validateThemeOrigin(origin)) {\n\t\t\t// If origin is allowed, use it\n\t\t\tresultUrl = themeRootURL.toString();\n\t\t} else {\n\t\t\t// If origin is not allow and the URL is not relative, we have to replace the origin\n\t\t\t// with current location\n\t\t\tresultUrl = buildCorrectUrl(themeRootURL, window.location.href);\n\t\t}\n\n\t\tif (!resultUrl.endsWith(\"/\")) {\n\t\t\tresultUrl = `${resultUrl}/`;\n\t\t}\n\n\t\treturn `${resultUrl}UI5/`;\n\t} catch (e) {\n\t\t// Catch if URL is not correct\n\t}\n};\n\nexport default validateThemeRoot;\n"]}
1
+ {"version":3,"file":"validateThemeRoot.js","sourceRoot":"","sources":["../src/validateThemeRoot.ts"],"names":[],"mappings":"AAAA,MAAM,eAAe,GAAG,CAAC,WAAmB,EAAE,EAAE;IAC/C,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,cAAc,WAAW,IAAI,CAAC,EACpE,cAAc,GAAG,OAAO,IAAI,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAE7D,OAAO,cAAc,CAAC;AACvB,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,MAAc,EAAE,EAAE;IAC9C,MAAM,cAAc,GAAG,eAAe,CAAC,yBAAyB,CAAC,CAAC;IAElE,OAAO,cAAc,IAAI,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE;QACvE,OAAO,aAAa,KAAK,GAAG,IAAI,MAAM,KAAK,aAAa,CAAC,IAAI,EAAE,CAAC;IACjE,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,MAAc,EAAE,SAAiB,EAAE,EAAE;IAC7D,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC;IAE5C,OAAO,IAAI,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAC;AAClD,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,SAAiB,EAAE,EAAE;IAC/C,IAAI,SAAS,CAAC;IAEd,IAAI;QACH,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YAC3D,sBAAsB;YACtB,wFAAwF;YACxF,iGAAiG;YACjG,0FAA0F;YAC1F,SAAS,GAAG,IAAI,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;SAChE;aAAM;YACN,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;YACxC,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;YAEnC,IAAI,MAAM,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE;gBAC1C,+BAA+B;gBAC/B,SAAS,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;aACpC;iBAAM;gBACN,oFAAoF;gBACpF,wBAAwB;gBACxB,SAAS,GAAG,eAAe,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;aAC3E;SACD;QAED,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC7B,SAAS,GAAG,GAAG,SAAS,GAAG,CAAC;SAC5B;QAED,OAAO,GAAG,SAAS,MAAM,CAAC;KAC1B;IAAC,OAAO,CAAC,EAAE;QACX,8BAA8B;KAC9B;AACF,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["const getMetaTagValue = (metaTagName: string) => {\n\tconst metaTag = document.querySelector(`META[name=\"${metaTagName}\"]`),\n\t\tmetaTagContent = metaTag && metaTag.getAttribute(\"content\");\n\n\treturn metaTagContent;\n};\n\nconst validateThemeOrigin = (origin: string) => {\n\tconst allowedOrigins = getMetaTagValue(\"sap-allowedThemeOrigins\");\n\n\treturn allowedOrigins && allowedOrigins.split(\",\").some(allowedOrigin => {\n\t\treturn allowedOrigin === \"*\" || origin === allowedOrigin.trim();\n\t});\n};\n\nconst buildCorrectUrl = (oldUrl: string, newOrigin: string) => {\n\tconst oldUrlPath = new URL(oldUrl).pathname;\n\n\treturn new URL(oldUrlPath, newOrigin).toString();\n};\n\nconst validateThemeRoot = (themeRoot: string) => {\n\tlet resultUrl;\n\n\ttry {\n\t\tif (themeRoot.startsWith(\".\") || themeRoot.startsWith(\"/\")) {\n\t\t\t// Handle relative url\n\t\t\t// new URL(\"/newExmPath\", \"http://example.com/exmPath\") => http://example.com/newExmPath\n\t\t\t// new URL(\"./newExmPath\", \"http://example.com/exmPath\") => http://example.com/exmPath/newExmPath\n\t\t\t// new URL(\"../newExmPath\", \"http://example.com/exmPath\") => http://example.com/newExmPath\n\t\t\tresultUrl = new URL(themeRoot, window.location.href).toString();\n\t\t} else {\n\t\t\tconst themeRootURL = new URL(themeRoot);\n\t\t\tconst origin = themeRootURL.origin;\n\n\t\t\tif (origin && validateThemeOrigin(origin)) {\n\t\t\t\t// If origin is allowed, use it\n\t\t\t\tresultUrl = themeRootURL.toString();\n\t\t\t} else {\n\t\t\t\t// If origin is not allow and the URL is not relative, we have to replace the origin\n\t\t\t\t// with current location\n\t\t\t\tresultUrl = buildCorrectUrl(themeRootURL.toString(), window.location.href);\n\t\t\t}\n\t\t}\n\n\t\tif (!resultUrl.endsWith(\"/\")) {\n\t\t\tresultUrl = `${resultUrl}/`;\n\t\t}\n\n\t\treturn `${resultUrl}UI5/`;\n\t} catch (e) {\n\t\t// Catch if URL is not correct\n\t}\n};\n\nexport default validateThemeRoot;\n"]}