Socket
Socket
Sign inDemoInstall

@ui5/webcomponents-base

Package Overview
Dependencies
Maintainers
5
Versions
479
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ui5/webcomponents-base - npm Package Compare versions

Comparing version 2.0.0-rc.6 to 2.0.0

dist/converters/DOMReference.d.ts

2

dist/asset-registries/Icons.d.ts

@@ -36,5 +36,5 @@ import type { I18nText } from "../i18nBundle.js";

*/
declare const getIconAccessibleName: (name: string) => Promise<string | undefined>;
declare const getIconAccessibleName: (name: string | undefined) => Promise<string | undefined>;
declare const _getRegisteredNames: () => Promise<string[]>;
export { registerIconLoader, getIconData, getIconDataSync, getIconAccessibleName, registerIcon, _getRegisteredNames, };
export type { IconData, CollectionData, };

@@ -19,3 +19,3 @@ /**

if (!propsMetadata[propertyKey]) {
propsMetadata[propertyKey] = propData || { type: String };
propsMetadata[propertyKey] = propData ?? {};
}

@@ -22,0 +22,0 @@ };

@@ -6,3 +6,3 @@ import NavigationMode from "../types/NavigationMode.js";

id: string;
forcedTabIndex: string;
forcedTabIndex?: string;
}

@@ -9,0 +9,0 @@ type ItemNavigationOptions = {

@@ -6,3 +6,3 @@ import type UI5Element from "../UI5Element.js";

interface IFormInputElement extends IFormElement {
name: string;
name?: string;
formFormattedValue: FormData | string | null;

@@ -9,0 +9,0 @@ formValidityMessage?: string;

@@ -7,2 +7,5 @@ import patchPatcher from "./patchPatcher.js";

static isAtLeastVersion116() {
if (!window.sap.ui.version) {
return true; // sap.ui.version will be removed in newer OpenUI5 versions
}
const version = window.sap.ui.version;

@@ -9,0 +12,0 @@ const parts = version.split(".");

const VersionInfo = {
version: "2.0.0-rc.6",
version: "2.0.0",
major: 2,
minor: 0,
patch: 0,
suffix: "-rc.6",
suffix: "",
isNext: false,
buildTime: 1718638412,
buildTime: 1720013643,
};
export default VersionInfo;
//# sourceMappingURL=VersionInfo.js.map

@@ -1,2 +0,2 @@

"use strict";import y from"../getSharedResource.js";import{getIconCollectionByAlias as d}from"./util/IconCollectionsAlias.js";import{registerIconCollectionForTheme as h}from"./util/IconCollectionsByTheme.js";import m from"./util/getIconCollectionByTheme.js";import{getI18nBundle as C}from"../i18nBundle.js";const w="legacy",c=new Map,s=y("SVGIcons.registry",new Map),i=y("SVGIcons.promises",new Map),l="ICON_NOT_FOUND",T=(e,t)=>{c.set(e,t)},N=async e=>{if(!i.has(e)){if(!c.has(e))throw new Error(`No loader registered for the ${e} icons collection. Probably you forgot to import the "AllIcons.js" module for the respective package.`);const t=c.get(e);i.set(e,t(e))}return i.get(e)},I=e=>{Object.keys(e.data).forEach(t=>{const o=e.data[t];f(t,{pathData:o.path||o.paths,ltr:o.ltr,accData:o.acc,collection:e.collection,packageName:e.packageName})})},f=(e,t)=>{const o=`${t.collection}/${e}`;s.set(o,{pathData:t.pathData,ltr:t.ltr,accData:t.accData,packageName:t.packageName,customTemplate:t.customTemplate,viewBox:t.viewBox,collection:t.collection})},D=e=>{e.startsWith("sap-icon://")&&(e=e.replace("sap-icon://",""));let t;return[e,t]=e.split("/").reverse(),e=e.replace("icon-",""),t&&(t=d(t)),{name:e,collection:t}},u=e=>{const{name:t,collection:o}=D(e);return g(o,t)},n=async e=>{const{name:t,collection:o}=D(e);let r=l;try{r=await N(m(o))}catch(a){console.error(a.message)}if(r===l)return r;const p=g(o,t);return p||(Array.isArray(r)?r.forEach(a=>{I(a),h(o,{[a.themeFamily||w]:a.collection})}):I(r),g(o,t))},g=(e,t)=>{const o=`${m(e)}/${t}`;return s.get(o)},A=async e=>{if(!e)return;let t=u(e);if(t||(t=await n(e)),t&&t!==l&&t.accData)return(await C(t.packageName)).getText(t.accData)},k=async()=>(await n("edit"),await n("tnt/arrow"),await n("business-suite/3d"),Array.from(s.keys()));export{T as registerIconLoader,n as getIconData,u as getIconDataSync,A as getIconAccessibleName,f as registerIcon,k as _getRegisteredNames};
"use strict";import y from"../getSharedResource.js";import{getIconCollectionByAlias as D}from"./util/IconCollectionsAlias.js";import{registerIconCollectionForTheme as h}from"./util/IconCollectionsByTheme.js";import m from"./util/getIconCollectionByTheme.js";import{getI18nBundle as C}from"../i18nBundle.js";const w="legacy",c=new Map,s=y("SVGIcons.registry",new Map),i=y("SVGIcons.promises",new Map),l="ICON_NOT_FOUND",T=(e,t)=>{c.set(e,t)},N=async e=>{if(!i.has(e)){if(!c.has(e))throw new Error(`No loader registered for the ${e} icons collection. Probably you forgot to import the "AllIcons.js" module for the respective package.`);const t=c.get(e);i.set(e,t(e))}return i.get(e)},I=e=>{Object.keys(e.data).forEach(t=>{const o=e.data[t];f(t,{pathData:o.path||o.paths,ltr:o.ltr,accData:o.acc,collection:e.collection,packageName:e.packageName})})},f=(e,t)=>{const o=`${t.collection}/${e}`;s.set(o,{pathData:t.pathData,ltr:t.ltr,accData:t.accData,packageName:t.packageName,customTemplate:t.customTemplate,viewBox:t.viewBox,collection:t.collection})},d=e=>{e.startsWith("sap-icon://")&&(e=e.replace("sap-icon://",""));let t;return[e,t]=e.split("/").reverse(),e=e.replace("icon-",""),t&&(t=D(t)),{name:e,collection:t}},u=e=>{const{name:t,collection:o}=d(e);return g(o,t)},n=async e=>{const{name:t,collection:o}=d(e);let r=l;try{r=await N(m(o))}catch(a){console.error(a.message)}if(r===l)return r;const p=g(o,t);return p||(Array.isArray(r)?r.forEach(a=>{I(a),h(o,{[a.themeFamily||w]:a.collection})}):I(r),g(o,t))},g=(e,t)=>{const o=`${m(e)}/${t}`;return s.get(o)},A=async e=>{if(!e)return;let t=u(e);if(t||(t=await n(e)),t&&t!==l&&t.accData)return(await C(t.packageName)).getText(t.accData)},k=async()=>(await n("edit"),await n("tnt/arrow"),await n("business-suite/3d"),Array.from(s.keys()));export{T as registerIconLoader,n as getIconData,u as getIconDataSync,A as getIconAccessibleName,f as registerIcon,k as _getRegisteredNames};
//# sourceMappingURL=Icons.js.map

@@ -1,2 +0,2 @@

"use strict";const s=o=>(p,r)=>{const t=p.constructor;Object.prototype.hasOwnProperty.call(t,"metadata")||(t.metadata={});const e=t.metadata;e.properties||(e.properties={});const a=e.properties;a[r]||(a[r]=o||{type:String})};export default s;
"use strict";const s=o=>(p,r)=>{const t=p.constructor;Object.prototype.hasOwnProperty.call(t,"metadata")||(t.metadata={});const e=t.metadata;e.properties||(e.properties={});const a=e.properties;a[r]||(a[r]=o??{})};export default s;
//# sourceMappingURL=property.js.map

@@ -1,2 +0,2 @@

"use strict";import u from"./patchPatcher.js";import l from"./patchPopup.js";import{registerFeature as m}from"../FeaturesRegistry.js";import{setTheme as g}from"../config/Theme.js";class a{static isAtLeastVersion116(){const e=window.sap.ui.version.split(".");return!e||e.length<2?!1:parseInt(e[0])>1||parseInt(e[1])>=116}static isOpenUI5Detected(){return typeof window.sap?.ui?.require=="function"}static init(){return a.isOpenUI5Detected()?new Promise(t=>{window.sap.ui.require(["sap/ui/core/Core"],async e=>{const i=()=>{let n=["sap/ui/core/Popup","sap/ui/core/Patcher","sap/ui/core/LocaleData"];a.isAtLeastVersion116()&&(n=[...n,"sap/base/i18n/Formatting","sap/base/i18n/Localization","sap/ui/core/ControlBehavior","sap/ui/core/Theming","sap/ui/core/date/CalendarUtils"]),window.sap.ui.require(n,(o,r)=>{u(r),l(o),t()})};a.isAtLeastVersion116()?(await e.ready(),i()):e.attachInit(i)})}):Promise.resolve()}static getConfigurationSettingsObject(){if(!a.isOpenUI5Detected())return{};if(a.isAtLeastVersion116()){const n=window.sap.ui.require("sap/ui/core/ControlBehavior"),o=window.sap.ui.require("sap/base/i18n/Localization"),r=window.sap.ui.require("sap/ui/core/Theming"),s=window.sap.ui.require("sap/base/i18n/Formatting"),c=window.sap.ui.require("sap/ui/core/date/CalendarUtils");return{animationMode:n.getAnimationMode(),language:o.getLanguage(),theme:r.getTheme(),themeRoot:r.getThemeRoot(),rtl:o.getRTL(),timezone:o.getTimezone(),calendarType:s.getCalendarType(),formatSettings:{firstDayOfWeek:c.getWeekConfigurationValues().firstDayOfWeek,legacyDateCalendarCustomizing:s.getCustomIslamicCalendarData?.()??s.getLegacyDateCalendarCustomizing?.()}}}const e=window.sap.ui.require("sap/ui/core/Core").getConfiguration(),i=window.sap.ui.require("sap/ui/core/LocaleData");return{animationMode:e.getAnimationMode(),language:e.getLanguage(),theme:e.getTheme(),themeRoot:e.getThemeRoot(),rtl:e.getRTL(),timezone:e.getTimezone(),calendarType:e.getCalendarType(),formatSettings:{firstDayOfWeek:i?i.getInstance(e.getLocale()).getFirstDayOfWeek():void 0,legacyDateCalendarCustomizing:e.getFormatSettings().getLegacyDateCalendarCustomizing()}}}static getLocaleDataObject(){if(!a.isOpenUI5Detected())return;const t=window.sap.ui.require("sap/ui/core/LocaleData");if(a.isAtLeastVersion116()){const n=window.sap.ui.require("sap/base/i18n/Localization");return t.getInstance(n.getLanguageTag())._get()}const i=window.sap.ui.require("sap/ui/core/Core").getConfiguration();return t.getInstance(i.getLocale())._get()}static _listenForThemeChange(){if(a.isAtLeastVersion116()){const t=window.sap.ui.require("sap/ui/core/Theming");t.attachApplied(()=>{g(t.getTheme())})}else{const t=window.sap.ui.require("sap/ui/core/Core"),e=t.getConfiguration();t.attachThemeChanged(()=>{g(e.getTheme())})}}static attachListeners(){a.isOpenUI5Detected()&&a._listenForThemeChange()}static cssVariablesLoaded(){if(!a.isOpenUI5Detected())return;const t=[...document.head.children].find(e=>e.id==="sap-ui-theme-sap.ui.core");return t?!!t.href.match(/\/css(-|_)variables\.css/):!1}}m("OpenUI5Support",a);export default a;
"use strict";import u from"./patchPatcher.js";import l from"./patchPopup.js";import{registerFeature as m}from"../FeaturesRegistry.js";import{setTheme as g}from"../config/Theme.js";class a{static isAtLeastVersion116(){if(!window.sap.ui.version)return!0;const e=window.sap.ui.version.split(".");return!e||e.length<2?!1:parseInt(e[0])>1||parseInt(e[1])>=116}static isOpenUI5Detected(){return typeof window.sap?.ui?.require=="function"}static init(){return a.isOpenUI5Detected()?new Promise(t=>{window.sap.ui.require(["sap/ui/core/Core"],async e=>{const i=()=>{let n=["sap/ui/core/Popup","sap/ui/core/Patcher","sap/ui/core/LocaleData"];a.isAtLeastVersion116()&&(n=[...n,"sap/base/i18n/Formatting","sap/base/i18n/Localization","sap/ui/core/ControlBehavior","sap/ui/core/Theming","sap/ui/core/date/CalendarUtils"]),window.sap.ui.require(n,(o,r)=>{u(r),l(o),t()})};a.isAtLeastVersion116()?(await e.ready(),i()):e.attachInit(i)})}):Promise.resolve()}static getConfigurationSettingsObject(){if(!a.isOpenUI5Detected())return{};if(a.isAtLeastVersion116()){const n=window.sap.ui.require("sap/ui/core/ControlBehavior"),o=window.sap.ui.require("sap/base/i18n/Localization"),r=window.sap.ui.require("sap/ui/core/Theming"),s=window.sap.ui.require("sap/base/i18n/Formatting"),c=window.sap.ui.require("sap/ui/core/date/CalendarUtils");return{animationMode:n.getAnimationMode(),language:o.getLanguage(),theme:r.getTheme(),themeRoot:r.getThemeRoot(),rtl:o.getRTL(),timezone:o.getTimezone(),calendarType:s.getCalendarType(),formatSettings:{firstDayOfWeek:c.getWeekConfigurationValues().firstDayOfWeek,legacyDateCalendarCustomizing:s.getCustomIslamicCalendarData?.()??s.getLegacyDateCalendarCustomizing?.()}}}const e=window.sap.ui.require("sap/ui/core/Core").getConfiguration(),i=window.sap.ui.require("sap/ui/core/LocaleData");return{animationMode:e.getAnimationMode(),language:e.getLanguage(),theme:e.getTheme(),themeRoot:e.getThemeRoot(),rtl:e.getRTL(),timezone:e.getTimezone(),calendarType:e.getCalendarType(),formatSettings:{firstDayOfWeek:i?i.getInstance(e.getLocale()).getFirstDayOfWeek():void 0,legacyDateCalendarCustomizing:e.getFormatSettings().getLegacyDateCalendarCustomizing()}}}static getLocaleDataObject(){if(!a.isOpenUI5Detected())return;const t=window.sap.ui.require("sap/ui/core/LocaleData");if(a.isAtLeastVersion116()){const n=window.sap.ui.require("sap/base/i18n/Localization");return t.getInstance(n.getLanguageTag())._get()}const i=window.sap.ui.require("sap/ui/core/Core").getConfiguration();return t.getInstance(i.getLocale())._get()}static _listenForThemeChange(){if(a.isAtLeastVersion116()){const t=window.sap.ui.require("sap/ui/core/Theming");t.attachApplied(()=>{g(t.getTheme())})}else{const t=window.sap.ui.require("sap/ui/core/Core"),e=t.getConfiguration();t.attachThemeChanged(()=>{g(e.getTheme())})}}static attachListeners(){a.isOpenUI5Detected()&&a._listenForThemeChange()}static cssVariablesLoaded(){if(!a.isOpenUI5Detected())return;const t=[...document.head.children].find(e=>e.id==="sap-ui-theme-sap.ui.core");return t?!!t.href.match(/\/css(-|_)variables\.css/):!1}}m("OpenUI5Support",a);export default a;
//# sourceMappingURL=OpenUI5Support.js.map

@@ -1,2 +0,2 @@

"use strict";const e={version:"2.0.0-rc.6",major:2,minor:0,patch:0,suffix:"-rc.6",isNext:!1,buildTime:1718638412};export default e;
"use strict";const e={version:"2.0.0",major:2,minor:0,patch:0,suffix:"",isNext:!1,buildTime:1720013643};export default e;
//# sourceMappingURL=VersionInfo.js.map

@@ -1,2 +0,2 @@

"use strict";import"@ui5/webcomponents-base/dist/ssr-dom.js";import O from"./thirdparty/merge.js";import{boot as L}from"./Boot.js";import U from"./UI5ElementMetadata.js";import S from"./EventProvider.js";import F from"./updateShadowRoot.js";import{shouldIgnoreCustomElement as V}from"./IgnoreCustomElements.js";import{renderDeferred as N,renderImmediately as j,cancelRender as k}from"./Render.js";import{registerTag as x,isTagRegistered as H,recordTagRegistrationFailure as $}from"./CustomElementsRegistry.js";import{observeDOMNode as z,unobserveDOMNode as W}from"./DOMObserver.js";import{skipOriginalEvent as q}from"./config/NoConflict.js";import B from"./locale/getEffectiveDir.js";import{kebabToCamelCase as I,camelToKebabCase as K}from"./util/StringHelper.js";import D from"./util/isValidPropertyName.js";import{getSlotName as G,getSlottedNodesList as b}from"./util/SlotsHelper.js";import A from"./util/arraysAreEqual.js";import{markAsRtlAware as J}from"./locale/RTLAwareRegistry.js";import Q from"./renderer/executeTemplate.js";import{attachFormElementInternals as X,setFormValue as P}from"./features/InputElementsFormSupport.js";let Y=0;const T=new Map,E=new Map;function y(m){this._suppressInvalidation||(this.onInvalidation(m),this._changedState.push(m),N(this),this._invalidationEventProvider.fireEvent("invalidate",{...m,target:this}))}function Z(m,M){do{const t=Object.getOwnPropertyDescriptor(m,M);if(t)return t;m=Object.getPrototypeOf(m)}while(m&&m!==HTMLElement.prototype)}class C 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._invalidationEventProvider=new S,this._componentStateFinalizedEventProvider=new S;let e;if(this._domRefReadyPromise=new Promise(o=>{e=o}),this._domRefReadyPromise._deferredResolve=e,this._doNotSyncAttributes=new Set,this._slotsAssignedNodes=new WeakMap,this._state={...t.getMetadata().getInitialState()},this._upgradeAllProperties(),t._needsShadowDOM()){const o={mode:"open"};this.attachShadow({...o,...t.getMetadata().getShadowRootOptions()})}}get _id(){return this.__id||(this.__id=`ui5wc_${++Y}`),this.__id}render(){const t=this.constructor.template;return Q(t,this)}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&&(j(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._domRefReadyPromise._deferredResolve(),k(this)}onBeforeRendering(){}onAfterRendering(){}onEnterDOM(){}onExitDOM(){}_startObservingDOMChildren(){const e=this.constructor.getMetadata();if(!e.hasSlots())return;const a=e.canSlotText(),s=Object.keys(e.getSlots()).some(d=>e.getSlots()[d].cloned),i={childList:!0,subtree:a||s,characterData:a};z(this,this._processChildren.bind(this),i)}_stopObservingDOMChildren(){W(this)}async _processChildren(){this.constructor.getMetadata().hasSlots()&&await this._updateSlots()}async _updateSlots(){const t=this.constructor,e=t.getMetadata().getSlots(),o=t.getMetadata().canSlotText(),a=Array.from(o?this.childNodes:this.children),s=new Map,i=new Map;for(const[l,u]of Object.entries(e)){const c=u.propertyName||l;i.set(c,l),s.set(c,[...this._state[c]]),this._clearSlot(l,u)}const d=new Map,n=new Map,r=a.map(async(l,u)=>{const c=G(l),f=e[c];if(f===void 0){if(c!=="default"){const p=Object.keys(e).join(", ");console.warn(`Unknown slotName: ${c}, ignoring`,l,`Valid values are: ${p}`)}return}if(f.individualSlots){const p=(d.get(c)||0)+1;d.set(c,p),l._individualSlot=`${c}-${p}`}if(l instanceof HTMLElement){const p=l.localName;if(p.includes("-")&&!V(p)){if(!customElements.get(p)){const w=customElements.whenDefined(p);let _=T.get(p);_||(_=new Promise(R=>setTimeout(R,1e3)),T.set(p,_)),await Promise.race([w,_])}customElements.upgrade(l)}}if(l=t.getMetadata().constructor.validateSlotValue(l,f),v(l)&&f.invalidateOnChildChange){const p=this._getChildChangeListener(c);l.attachInvalidate.call(l,p)}l instanceof HTMLSlotElement&&this._attachSlotChange(l,c,!!f.invalidateOnChildChange);const g=f.propertyName||c;n.has(g)?n.get(g).push({child:l,idx:u}):n.set(g,[{child:l,idx:u}])});await Promise.all(r),n.forEach((l,u)=>{this._state[u]=l.sort((c,f)=>c.idx-f.idx).map(c=>c.child)});let h=!1;for(const[l,u]of Object.entries(e)){const c=u.propertyName||l;A(s.get(c),this._state[c])||(y.call(this,{type:"slot",name:i.get(c),reason:"children"}),h=!0,t.getMetadata().isFormAssociated()&&P(this))}h||y.call(this,{type:"slot",name:"default",reason:"textcontent"})}_clearSlot(t,e){const o=e.propertyName||t;this._state[o].forEach(s=>{if(v(s)){const i=this._getChildChangeListener(t);s.detachInvalidate.call(s,i)}s instanceof HTMLSlotElement&&this._detachSlotChange(s,t)}),this._state[o]=[]}attachInvalidate(t){this._invalidationEventProvider.attachEvent("invalidate",t)}detachInvalidate(t){this._invalidationEventProvider.detachEvent("invalidate",t)}_onChildChange(t,e){this.constructor.getMetadata().shouldInvalidateOnChildChange(t,e.type,e.name)&&y.call(this,{type:"slot",name:t,reason:"childchange",child:e.target})}attributeChangedCallback(t,e,o){let a;if(this._doNotSyncAttributes.has(t))return;const s=this.constructor.getMetadata().getProperties(),i=t.replace(/^ui5-/,""),d=I(i);if(s.hasOwnProperty(d)){const n=s[d],r=n.type;let h=n.validator;r&&r.isDataTypeClass&&(h=r),h?a=h.attributeToProperty(o):r===Boolean?a=o!==null:a=o,this[d]=a}}formAssociatedCallback(){this.constructor.getMetadata().isFormAssociated()&&X(this)}static get formAssociated(){return this.getMetadata().isFormAssociated()}_updateAttribute(t,e){const o=this.constructor;if(!o.getMetadata().hasAttribute(t))return;const s=o.getMetadata().getProperties()[t],i=s.type;let d=s.validator;const n=K(t),r=this.getAttribute(n);if(i&&i.isDataTypeClass&&(d=i),d){const h=d.propertyToAttribute(e);h===null?(this._doNotSyncAttributes.add(n),this.removeAttribute(n),this._doNotSyncAttributes.delete(n)):this.setAttribute(n,h)}else i===Boolean?e===!0&&r===null?this.setAttribute(n,""):e===!1&&r!==null&&this.removeAttribute(n):typeof e!="object"&&r!==e&&this.setAttribute(n,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,o){const a=this._getSlotChangeListener(e);t.addEventListener("slotchange",s=>{if(a.call(t,s),o){const i=this._slotsAssignedNodes.get(t);i&&i.forEach(n=>{if(v(n)){const r=this._getChildChangeListener(e);n.detachInvalidate.call(n,r)}});const d=b([t]);this._slotsAssignedNodes.set(t,d),d.forEach(n=>{if(v(n)){const r=this._getChildChangeListener(e);n.attachInvalidate.call(n,r)}})}})}_detachSlotChange(t,e){t.removeEventListener("slotchange",this._getSlotChangeListener(e))}_onSlotChange(t){y.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._componentStateFinalizedEventProvider.fireEvent("componentStateFinalized"),this._suppressInvalidation=!1,this._changedState=[],t._needsShadowDOM()&&F(this),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 this.shadowRoot.children[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===this?HTMLElement.prototype.focus.call(this,t):e&&typeof e.focus=="function"&&e.focus(t)}fireEvent(t,e,o=!1,a=!0){const s=this._fireEvent(t,e,o,a),i=I(t);return i!==t?s&&this._fireEvent(i,e,o,a):s}_fireEvent(t,e,o=!1,a=!0){const s=new CustomEvent(`ui5-${t}`,{detail:e,composed:!1,bubbles:a,cancelable:o}),i=this.dispatchEvent(s);if(q(t))return i;const d=new CustomEvent(t,{detail:e,composed:!1,bubbles:a,cancelable:o});return this.dispatchEvent(d)&&i}getSlottedNodes(t){return b(this[t])}attachComponentStateFinalized(t){this._componentStateFinalizedEventProvider.attachEvent("componentStateFinalized",t)}detachComponentStateFinalized(t){this._componentStateFinalizedEventProvider.detachEvent("componentStateFinalized",t)}get effectiveDir(){return J(this.constructor),B(this)}get isUI5Element(){return!0}get classes(){return{}}get accessibilityInfo(){return{}}static get observedAttributes(){return this.getMetadata().getAttributesList()}static _needsShadowDOM(){return!!this.template||Object.prototype.hasOwnProperty.call(this.prototype,"render")}static _generateAccessors(){const t=this.prototype,e=this.getMetadata().slotsAreManaged(),o=this.getMetadata().getProperties();for(const[a,s]of Object.entries(o)){if(D(a)||console.warn(`"${a}" is not a valid property name. Use a name that does not collide with DOM APIs`),s.type===Boolean&&s.defaultValue)throw new Error(`Cannot set a default value for property "${a}". All booleans are false by default.`);if(s.type===Array)throw new Error(`Wrong type for property "${a}". Properties cannot be of type Array - use "multiple: true" and set "type" to the single value type, such as "String", "Object", etc...`);if(s.type===Object&&s.defaultValue)throw new Error(`Cannot set a default value for property "${a}". All properties of type "Object" are empty objects by default.`);if(s.multiple&&s.defaultValue)throw new Error(`Cannot set a default value for property "${a}". All multiple properties are empty arrays by default.`);const i=Z(t,a);let d;i?.set&&(d=i.set);let n;i?.get&&(n=i.get),Object.defineProperty(t,a,{get(){if(n)return n.call(this);if(this._state[a]!==void 0)return this._state[a];const r=s.defaultValue;return s.type===Boolean?!1:s.type===String?r:s.multiple?[]:r},set(r){let h;const l=this.constructor;r=l.getMetadata().constructor.validatePropertyValue(r,s);const c=s.type;let f=s.validator;const g=n?n.call(this):this._state[a];c&&c.isDataTypeClass&&(f=c),f?h=!f.valuesAreEqual(g,r):Array.isArray(g)&&Array.isArray(r)&&s.multiple&&s.compareValues?h=!A(g,r):h=g!==r,h&&(d?d.call(this,r):this._state[a]=r,y.call(this,{type:"property",name:a,newValue:r,oldValue:g}),l.getMetadata().isFormAssociated()&&P(this),this._updateAttribute(a,r))}})}if(e){const a=this.getMetadata().getSlots();for(const[s,i]of Object.entries(a)){D(s)||console.warn(`"${s}" is not a valid property name. Use a name that does not collide with DOM APIs`);const d=i.propertyName||s;Object.defineProperty(t,d,{get(){return this._state[d]!==void 0?this._state[d]:[]},set(){throw new Error("Cannot set slot content directly, use the DOM APIs (appendChild, removeChild, etc...)")}})}}}static{this.metadata={}}static{this.styles=""}static get dependencies(){return[]}static getUniqueDependencies(){if(!E.has(this)){const t=this.dependencies.filter((e,o,a)=>a.indexOf(e)===o);E.set(this,t)}return E.get(this)||[]}static whenDependenciesDefined(){return Promise.all(this.getUniqueDependencies().map(t=>t.define()))}static async onDefine(){return Promise.resolve()}static async define(){await L(),await Promise.all([this.whenDependenciesDefined(),this.onDefine()]);const t=this.getMetadata().getTag(),e=H(t),o=customElements.get(t);return o&&!e?$(t):o||(this._generateAccessors(),x(t),customElements.define(t,this)),this}static getMetadata(){if(this.hasOwnProperty("_metadata"))return this._metadata;const t=[this.metadata];let e=this;for(;e!==C;)e=Object.getPrototypeOf(e),t.unshift(e.metadata);const o=O({},...t);return this._metadata=new U(o),this._metadata}get validity(){return this._internals?.validity}get validationMessage(){return this._internals?.validationMessage}checkValidity(){return this._internals?.checkValidity()}reportValidity(){return this._internals?.reportValidity()}}const v=m=>"isUI5Element"in m;export default C;export{v as instanceOfUI5Element};
"use strict";import"@ui5/webcomponents-base/dist/ssr-dom.js";import T from"./thirdparty/merge.js";import{boot as U}from"./Boot.js";import L from"./UI5ElementMetadata.js";import S from"./EventProvider.js";import F from"./updateShadowRoot.js";import{shouldIgnoreCustomElement as N}from"./IgnoreCustomElements.js";import{renderDeferred as V,renderImmediately as k,cancelRender as j}from"./Render.js";import{registerTag as x,isTagRegistered as z,recordTagRegistrationFailure as H}from"./CustomElementsRegistry.js";import{observeDOMNode as $,unobserveDOMNode as W}from"./DOMObserver.js";import{skipOriginalEvent as B}from"./config/NoConflict.js";import K from"./locale/getEffectiveDir.js";import{kebabToCamelCase as g,camelToKebabCase as q}from"./util/StringHelper.js";import w from"./util/isValidPropertyName.js";import{getSlotName as G,getSlottedNodesList as R}from"./util/SlotsHelper.js";import J from"./util/arraysAreEqual.js";import{markAsRtlAware as Q}from"./locale/RTLAwareRegistry.js";import X from"./renderer/executeTemplate.js";import{attachFormElementInternals as Y,setFormValue as b}from"./features/InputElementsFormSupport.js";let Z=0;const P=new Map,M=new Map,A={fromAttribute(d,u){return u===Boolean?d!==null:u===Number?d===null?void 0:parseFloat(d):d},toAttribute(d,u){return u===Boolean?d?"":null:u===Object||u===Array||d==null?null:String(d)}};function y(d){this._suppressInvalidation||(this.onInvalidation(d),this._changedState.push(d),V(this),this._invalidationEventProvider.fireEvent("invalidate",{...d,target:this}))}function tt(d,u){do{const t=Object.getOwnPropertyDescriptor(d,u);if(t)return t;d=Object.getPrototypeOf(d)}while(d&&d!==HTMLElement.prototype)}class I extends HTMLElement{constructor(){super();this._rendered=!1;const t=this.constructor;this._changedState=[],this._suppressInvalidation=!0,this._inDOM=!1,this._fullyConnected=!1,this._childChangeListeners=new Map,this._slotChangeListeners=new Map,this._invalidationEventProvider=new S,this._componentStateFinalizedEventProvider=new S;let e;this._domRefReadyPromise=new Promise(n=>{e=n}),this._domRefReadyPromise._deferredResolve=e,this._doNotSyncAttributes=new Set,this._slotsAssignedNodes=new WeakMap,this._state={...t.getMetadata().getInitialState()},this.initializedProperties=new Map,this.constructor.getMetadata().getPropertiesList().forEach(n=>{if(this.hasOwnProperty(n)){const o=this[n];this.initializedProperties.set(n,o)}}),this._initShadowRoot()}_initShadowRoot(){const t=this.constructor;if(t._needsShadowDOM()){const e={mode:"open"};this.attachShadow({...e,...t.getMetadata().getShadowRootOptions()}),t.getMetadata().slotsAreManaged()&&this.shadowRoot.addEventListener("slotchange",this._onShadowRootSlotChange.bind(this))}}_onShadowRootSlotChange(t){t.target?.getRootNode()===this.shadowRoot&&this._processChildren()}get _id(){return this.__id||(this.__id=`ui5wc_${++Z}`),this.__id}render(){const t=this.constructor.template;return X(t,this)}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&&(k(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._domRefReadyPromise._deferredResolve(),j(this)}onBeforeRendering(){}onAfterRendering(){}onEnterDOM(){}onExitDOM(){}_startObservingDOMChildren(){const e=this.constructor.getMetadata();if(!e.hasSlots())return;const n=e.canSlotText(),o={childList:!0,subtree:n,characterData:n};$(this,this._processChildren.bind(this),o)}_stopObservingDOMChildren(){W(this)}async _processChildren(){this.constructor.getMetadata().hasSlots()&&await this._updateSlots()}async _updateSlots(){const t=this.constructor,e=t.getMetadata().getSlots(),s=t.getMetadata().canSlotText(),n=Array.from(s?this.childNodes:this.children),o=new Map,a=new Map;for(const[r,f]of Object.entries(e)){const c=f.propertyName||r;a.set(c,r),o.set(c,[...this._state[c]]),this._clearSlot(r,f)}const l=new Map,i=new Map,h=n.map(async(r,f)=>{const c=G(r),m=e[c];if(m===void 0){if(c!=="default"){const p=Object.keys(e).join(", ");console.warn(`Unknown slotName: ${c}, ignoring`,r,`Valid values are: ${p}`)}return}if(m.individualSlots){const p=(l.get(c)||0)+1;l.set(c,p),r._individualSlot=`${c}-${p}`}if(r instanceof HTMLElement){const p=r.localName;if(p.includes("-")&&!N(p)){if(!customElements.get(p)){const D=customElements.whenDefined(p);let E=P.get(p);E||(E=new Promise(O=>setTimeout(O,1e3)),P.set(p,E)),await Promise.race([D,E])}customElements.upgrade(r)}}if(r=t.getMetadata().constructor.validateSlotValue(r,m),v(r)&&m.invalidateOnChildChange){const p=this._getChildChangeListener(c);r.attachInvalidate.call(r,p)}r instanceof HTMLSlotElement&&this._attachSlotChange(r,c,!!m.invalidateOnChildChange);const C=m.propertyName||c;i.has(C)?i.get(C).push({child:r,idx:f}):i.set(C,[{child:r,idx:f}])});await Promise.all(h),i.forEach((r,f)=>{this._state[f]=r.sort((c,m)=>c.idx-m.idx).map(c=>c.child),this._state[g(f)]=this._state[f]});let _=!1;for(const[r,f]of Object.entries(e)){const c=f.propertyName||r;J(o.get(c),this._state[c])||(y.call(this,{type:"slot",name:a.get(c),reason:"children"}),_=!0,t.getMetadata().isFormAssociated()&&b(this))}_||y.call(this,{type:"slot",name:"default",reason:"textcontent"})}_clearSlot(t,e){const s=e.propertyName||t;this._state[s].forEach(o=>{if(v(o)){const a=this._getChildChangeListener(t);o.detachInvalidate.call(o,a)}o instanceof HTMLSlotElement&&this._detachSlotChange(o,t)}),this._state[s]=[],this._state[g(s)]=this._state[s]}attachInvalidate(t){this._invalidationEventProvider.attachEvent("invalidate",t)}detachInvalidate(t){this._invalidationEventProvider.detachEvent("invalidate",t)}_onChildChange(t,e){this.constructor.getMetadata().shouldInvalidateOnChildChange(t,e.type,e.name)&&y.call(this,{type:"slot",name:t,reason:"childchange",child:e.target})}attributeChangedCallback(t,e,s){let n;if(this._doNotSyncAttributes.has(t))return;const o=this.constructor.getMetadata().getProperties(),a=t.replace(/^ui5-/,""),l=g(a);if(o.hasOwnProperty(l)){const i=o[l];n=(i.converter??A).fromAttribute(s,i.type),this[l]=n}}formAssociatedCallback(){this.constructor.getMetadata().isFormAssociated()&&Y(this)}static get formAssociated(){return this.getMetadata().isFormAssociated()}_updateAttribute(t,e){const s=this.constructor;if(!s.getMetadata().hasAttribute(t))return;const o=s.getMetadata().getProperties()[t],a=q(t),i=(o.converter||A).toAttribute(e,o.type);i==null?(this._doNotSyncAttributes.add(a),this.removeAttribute(a),this._doNotSyncAttributes.delete(a)):this.setAttribute(a,i)}_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,s){const n=this._getSlotChangeListener(e);t.addEventListener("slotchange",o=>{if(n.call(t,o),s){const a=this._slotsAssignedNodes.get(t);a&&a.forEach(i=>{if(v(i)){const h=this._getChildChangeListener(e);i.detachInvalidate.call(i,h)}});const l=R([t]);this._slotsAssignedNodes.set(t,l),l.forEach(i=>{if(v(i)){const h=this._getChildChangeListener(e);i.attachInvalidate.call(i,h)}})}})}_detachSlotChange(t,e){t.removeEventListener("slotchange",this._getSlotChangeListener(e))}_onSlotChange(t){y.call(this,{type:"slot",name:t,reason:"slotchange"})}onInvalidation(t){}updateAttributes(){const e=this.constructor.getMetadata().getProperties();for(const[s,n]of Object.entries(e))this._updateAttribute(s,this[s])}_render(){const t=this.constructor,e=t.getMetadata().hasIndividualSlots();this.initializedProperties.size>0&&(Array.from(this.initializedProperties.entries()).forEach(([s,n])=>{delete this[s],this[s]=n}),this.initializedProperties.clear()),this._suppressInvalidation=!0,this.onBeforeRendering(),this._rendered||this.updateAttributes(),this._componentStateFinalizedEventProvider.fireEvent("componentStateFinalized"),this._suppressInvalidation=!1,this._changedState=[],t._needsShadowDOM()&&F(this),this._rendered=!0,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 this.shadowRoot.children[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===this?HTMLElement.prototype.focus.call(this,t):e&&typeof e.focus=="function"&&e.focus(t)}fireEvent(t,e,s=!1,n=!0){const o=this._fireEvent(t,e,s,n),a=g(t);return a!==t?o&&this._fireEvent(a,e,s,n):o}_fireEvent(t,e,s=!1,n=!0){const o=new CustomEvent(`ui5-${t}`,{detail:e,composed:!1,bubbles:n,cancelable:s}),a=this.dispatchEvent(o);if(B(t))return a;const l=new CustomEvent(t,{detail:e,composed:!1,bubbles:n,cancelable:s});return this.dispatchEvent(l)&&a}getSlottedNodes(t){return R(this[t])}attachComponentStateFinalized(t){this._componentStateFinalizedEventProvider.attachEvent("componentStateFinalized",t)}detachComponentStateFinalized(t){this._componentStateFinalizedEventProvider.detachEvent("componentStateFinalized",t)}get effectiveDir(){return Q(this.constructor),K(this)}get isUI5Element(){return!0}get classes(){return{}}get accessibilityInfo(){return{}}static get observedAttributes(){return this.getMetadata().getAttributesList()}static _needsShadowDOM(){return!!this.template||Object.prototype.hasOwnProperty.call(this.prototype,"render")}static _generateAccessors(){const t=this.prototype,e=this.getMetadata().slotsAreManaged(),s=this.getMetadata().getProperties();for(const[n,o]of Object.entries(s)){w(n)||console.warn(`"${n}" is not a valid property name. Use a name that does not collide with DOM APIs`);const a=tt(t,n);let l;a?.set&&(l=a.set);let i;a?.get&&(i=a.get),Object.defineProperty(t,n,{get(){return i?i.call(this):this._state[n]},set(h){const _=this.constructor,r=i?i.call(this):this._state[n];r!==h&&(l?l.call(this,h):this._state[n]=h,y.call(this,{type:"property",name:n,newValue:h,oldValue:r}),this._rendered&&this._updateAttribute(n,h),_.getMetadata().isFormAssociated()&&b(this))}})}if(e){const n=this.getMetadata().getSlots();for(const[o,a]of Object.entries(n)){w(o)||console.warn(`"${o}" is not a valid property name. Use a name that does not collide with DOM APIs`);const l=a.propertyName||o,i={get(){return this._state[l]!==void 0?this._state[l]:[]},set(){throw new Error("Cannot set slot content directly, use the DOM APIs (appendChild, removeChild, etc...)")}};Object.defineProperty(t,l,i),l!==g(l)&&Object.defineProperty(t,g(l),i)}}}static{this.metadata={}}static{this.styles=""}static get dependencies(){return[]}static getUniqueDependencies(){if(!M.has(this)){const t=this.dependencies.filter((e,s,n)=>n.indexOf(e)===s);M.set(this,t)}return M.get(this)||[]}static whenDependenciesDefined(){return Promise.all(this.getUniqueDependencies().map(t=>t.define()))}static async onDefine(){return Promise.resolve()}static async define(){await U(),await Promise.all([this.whenDependenciesDefined(),this.onDefine()]);const t=this.getMetadata().getTag(),e=z(t),s=customElements.get(t);return s&&!e?H(t):s||(this._generateAccessors(),x(t),customElements.define(t,this)),this}static getMetadata(){if(this.hasOwnProperty("_metadata"))return this._metadata;const t=[this.metadata];let e=this;for(;e!==I;)e=Object.getPrototypeOf(e),t.unshift(e.metadata);const s=T({},...t);return this._metadata=new L(s),this._metadata}get validity(){return this._internals?.validity}get validationMessage(){return this._internals?.validationMessage}checkValidity(){return this._internals?.checkValidity()}reportValidity(){return this._internals?.reportValidity()}}const v=d=>"isUI5Element"in d;export default I;export{v as instanceOfUI5Element};
//# sourceMappingURL=UI5Element.js.map

@@ -1,2 +0,2 @@

"use strict";import{camelToKebabCase as p}from"./util/StringHelper.js";import{getSlottedNodes as d}from"./util/SlotsHelper.js";import{getEffectiveScopingSuffixForTag as u}from"./CustomElementsScopeUtils.js";class f{constructor(t){this.metadata=t}getInitialState(){if(Object.prototype.hasOwnProperty.call(this,"_initialState"))return this._initialState;const t={},a=this.slotsAreManaged(),o=this.getProperties();for(const e in o){const i=o[e].type,n=o[e].defaultValue;i===Boolean?(t[e]=!1,n!==void 0&&console.warn("The 'defaultValue' metadata key is ignored for all booleans properties, they would be initialized with 'false' by default")):o[e].multiple?Object.defineProperty(t,e,{enumerable:!0,get(){return[]}}):i===Object?Object.defineProperty(t,e,{enumerable:!0,get(){return"defaultValue"in o[e]?o[e].defaultValue:{}}}):i===String?t[e]="defaultValue"in o[e]?o[e].defaultValue:"":t[e]=n}if(a){const e=this.getSlots();for(const[i,n]of Object.entries(e)){const l=n.propertyName||i;t[l]=[]}}return this._initialState=t,t}static validatePropertyValue(t,a){return a.multiple&&t?t.map(e=>s(e,a)):s(t,a)}static validateSlotValue(t,a){return y(t,a)}getPureTag(){return this.metadata.tag||""}getTag(){const t=this.metadata.tag;if(!t)return"";const a=u(t);return a?`${t}-${a}`:t}hasAttribute(t){const a=this.getProperties()[t];return a.type!==Object&&!a.noAttribute&&!a.multiple}getPropertiesList(){return Object.keys(this.getProperties())}getAttributesList(){return this.getPropertiesList().filter(this.hasAttribute.bind(this)).map(p)}canSlotText(){return this.getSlots().default?.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}getShadowRootOptions(){return this.metadata.shadowRootOptions||{}}isFormAssociated(){return!!this.metadata.formAssociated}shouldInvalidateOnChildChange(t,a,o){const e=this.getSlots()[t].invalidateOnChildChange;if(e===void 0)return!1;if(typeof e=="boolean")return e;if(typeof e=="object"){if(a==="property"){if(e.properties===void 0)return!1;if(typeof e.properties=="boolean")return e.properties;if(Array.isArray(e.properties))return e.properties.includes(o);throw new Error("Wrong format for invalidateOnChildChange.properties: boolean or array is expected")}if(a==="slot"){if(e.slots===void 0)return!1;if(typeof e.slots=="boolean")return e.slots;if(Array.isArray(e.slots))return e.slots.includes(o);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 s=(r,t)=>{const a=t.type;let o=t.validator;return a&&a.isDataTypeClass&&(o=a),o?o.isValid(r)?r:t.defaultValue:!a||a===String?typeof r=="string"||typeof r>"u"||r===null?r:r.toString():a===Boolean?typeof r=="boolean"?r:!1:a===Object?typeof r=="object"?r:t.defaultValue:r in a?r:t.defaultValue},y=(r,t)=>(r&&d(r).forEach(a=>{if(!(a instanceof t.type))throw new Error(`The element is not of type ${t.type.toString()}`)}),r);export default f;
"use strict";import{camelToKebabCase as s,kebabToCamelCase as l}from"./util/StringHelper.js";import{getSlottedNodes as d}from"./util/SlotsHelper.js";import{getEffectiveScopingSuffixForTag as p}from"./CustomElementsScopeUtils.js";class u{constructor(t){this.metadata=t}getInitialState(){if(Object.prototype.hasOwnProperty.call(this,"_initialState"))return this._initialState;const t={};if(this.slotsAreManaged()){const r=this.getSlots();for(const[e,i]of Object.entries(r)){const n=i.propertyName||e;t[n]=[],t[l(n)]=t[n]}}return this._initialState=t,t}static validateSlotValue(t,a){return g(t,a)}getPureTag(){return this.metadata.tag||""}getTag(){const t=this.metadata.tag;if(!t)return"";const a=p(t);return a?`${t}-${a}`:t}hasAttribute(t){const a=this.getProperties()[t];return a.type!==Object&&a.type!==Array&&!a.noAttribute}getPropertiesList(){return Object.keys(this.getProperties())}getAttributesList(){return this.getPropertiesList().filter(this.hasAttribute.bind(this)).map(s)}canSlotText(){return this.getSlots().default?.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}getShadowRootOptions(){return this.metadata.shadowRootOptions||{}}isFormAssociated(){return!!this.metadata.formAssociated}shouldInvalidateOnChildChange(t,a,r){const e=this.getSlots()[t].invalidateOnChildChange;if(e===void 0)return!1;if(typeof e=="boolean")return e;if(typeof e=="object"){if(a==="property"){if(e.properties===void 0)return!1;if(typeof e.properties=="boolean")return e.properties;if(Array.isArray(e.properties))return e.properties.includes(r);throw new Error("Wrong format for invalidateOnChildChange.properties: boolean or array is expected")}if(a==="slot"){if(e.slots===void 0)return!1;if(typeof e.slots=="boolean")return e.slots;if(Array.isArray(e.slots))return e.slots.includes(r);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 g=(o,t)=>(o&&d(o).forEach(a=>{if(!(a instanceof t.type))throw new Error(`The element is not of type ${t.type.toString()}`)}),o);export default u;
//# sourceMappingURL=UI5ElementMetadata.js.map

@@ -57,4 +57,11 @@ import "@ui5/webcomponents-base/dist/ssr-dom.js";

static renderer: Renderer;
initializedProperties: Map<string, unknown>;
_rendered: boolean;
constructor();
_initShadowRoot(): void;
/**
* Note: this "slotchange" listener is for slots, rendered in the component's shadow root
*/
_onShadowRootSlotChange(e: Event): void;
/**
* Returns a unique ID for this UI5 Element

@@ -153,10 +160,2 @@ *

/**
* @private
*/
_upgradeProperty(this: Record<string, any>, propertyName: string): void;
/**
* @private
*/
_upgradeAllProperties(): void;
/**
* Returns a singleton event listener for the "change" event of a child in a given slot

@@ -185,2 +184,3 @@ *

* Whenever a slot element is slotted inside a UI5 Web Component, its slotchange event invalidates the component
* Note: this "slotchange" listener is for slots that are children of the component (in the light dom, as opposed to slots rendered by the component in the shadow root)
*

@@ -219,2 +219,3 @@ * @param slotName the name of the slot, where the slot element (whose slotchange event we're listening to) is

onInvalidation(changeInfo: ChangeInfo): void;
updateAttributes(): void;
/**

@@ -221,0 +222,0 @@ * Do not call this method directly, only intended to be called by js

@@ -25,2 +25,27 @@ // eslint-disable-next-line import/no-extraneous-dependencies

const uniqueDependenciesCache = new Map();
const defaultConverter = {
fromAttribute(value, type) {
if (type === Boolean) {
return value !== null;
}
if (type === Number) {
return value === null ? undefined : parseFloat(value);
}
return value;
},
toAttribute(value, type) {
if (type === Boolean) {
return value ? "" : null;
}
// don't set attributes for arrays and objects
if (type === Object || type === Array) {
return null;
}
// object, array, other
if (value === null || value === undefined) {
return null;
}
return String(value);
},
};
/**

@@ -69,2 +94,6 @@ * Triggers re-rendering of a UI5Element instance due to state change.

super();
// used to differentiate whether a setter is called from the constructor (from an initializer) or later
// setters from the constructor should not set attributes, this is delegated after the first rendering but is async
// setters after the constructor can set attributes synchronously for more convinient development
this._rendered = false;
const ctor = this.constructor;

@@ -87,9 +116,34 @@ this._changedState = []; // Filled on each invalidation, cleared on re-render (used for debugging)

this._state = { ...ctor.getMetadata().getInitialState() };
this._upgradeAllProperties();
// save properties set before element is upgraded, as they will be overriden by the field initializers in the constructor
this.initializedProperties = new Map();
const allProps = this.constructor.getMetadata().getPropertiesList();
allProps.forEach(propertyName => {
if (this.hasOwnProperty(propertyName)) { // eslint-disable-line
const value = this[propertyName];
this.initializedProperties.set(propertyName, value);
}
});
this._initShadowRoot();
}
_initShadowRoot() {
const ctor = this.constructor;
if (ctor._needsShadowDOM()) {
const defaultOptions = { mode: "open" };
this.attachShadow({ ...defaultOptions, ...ctor.getMetadata().getShadowRootOptions() });
const slotsAreManaged = ctor.getMetadata().slotsAreManaged();
if (slotsAreManaged) {
this.shadowRoot.addEventListener("slotchange", this._onShadowRootSlotChange.bind(this));
}
}
}
/**
* Note: this "slotchange" listener is for slots, rendered in the component's shadow root
*/
_onShadowRootSlotChange(e) {
const targetShadowRoot = e.target?.getRootNode(); // the "slotchange" event target is always a slot element
if (targetShadowRoot === this.shadowRoot) { // only for slotchange events that originate from slots, belonging to the component's shadow root
this._processChildren();
}
}
/**
* Returns a unique ID for this UI5 Element

@@ -130,3 +184,4 @@ *

for (const [prop, propData] of Object.entries(props)) { // eslint-disable-line
if (Object.hasOwn(this, prop)) {
if (Object.hasOwn(this, prop) && !this.initializedProperties.has(prop)) {
// initialized properties should not trigger this error as they will be reassigned, only property initializers will trigger this in case unsupported TS mode
// eslint-disable-next-line no-console

@@ -206,6 +261,5 @@ console.error(`[UI5-FWK] ${this.constructor.getMetadata().getTag()} has a property [${prop}] that is shadowed by the instance. Updates to this property will not invalidate the component. Possible reason is TS target ES2022 or TS useDefineForClassFields`);

const canSlotText = metadata.canSlotText();
const hasClonedSlot = Object.keys(metadata.getSlots()).some(slotName => metadata.getSlots()[slotName].cloned);
const mutationObserverOptions = {
childList: true,
subtree: canSlotText || hasClonedSlot,
subtree: canSlotText,
characterData: canSlotText,

@@ -309,2 +363,3 @@ };

this._state[propertyName] = children.sort((a, b) => a.idx - b.idx).map(_ => _.child);
this._state[kebabToCamelCase(propertyName)] = this._state[propertyName];
});

@@ -354,2 +409,3 @@ // Compare the content of each slot with the cached values and invalidate for the ones that changed

this._state[propertyName] = [];
this._state[kebabToCamelCase(propertyName)] = this._state[propertyName];
}

@@ -408,16 +464,4 @@ /**

const propData = properties[nameInCamelCase];
const propertyType = propData.type;
let propertyValidator = propData.validator;
if (propertyType && propertyType.isDataTypeClass) {
propertyValidator = propertyType;
}
if (propertyValidator) {
newPropertyValue = propertyValidator.attributeToProperty(newValue);
}
else if (propertyType === Boolean) {
newPropertyValue = newValue !== null;
}
else {
newPropertyValue = newValue;
}
const converter = propData.converter ?? defaultConverter;
newPropertyValue = converter.fromAttribute(newValue, propData.type);
this[nameInCamelCase] = newPropertyValue;

@@ -446,52 +490,26 @@ }

const propData = properties[name];
const propertyType = propData.type;
let propertyValidator = propData.validator;
const attrName = camelToKebabCase(name);
const attrValue = this.getAttribute(attrName);
if (propertyType && propertyType.isDataTypeClass) {
propertyValidator = propertyType;
}
if (propertyValidator) {
const newAttrValue = propertyValidator.propertyToAttribute(newValue);
if (newAttrValue === null) { // null means there must be no attribute for the current value of the property
this._doNotSyncAttributes.add(attrName); // skip the attributeChangedCallback call for this attribute
this.removeAttribute(attrName); // remove the attribute safely (will not trigger synchronization to the property value due to the above line)
this._doNotSyncAttributes.delete(attrName); // enable synchronization again for this attribute
const converter = propData.converter || defaultConverter;
if (DEV_MODE) {
const tag = this.constructor.getMetadata().getTag();
if (typeof newValue === "boolean" && propData.type !== Boolean) {
// eslint-disable-next-line
console.error(`[UI5-FWK] boolean value for property [${name}] of component [${tag}] is missing "{ type: Boolean }" in its property decorator. Attribute conversion will treat it as a string. If this is intended, pass the value converted to string, otherwise add the type to the property decorator`);
}
else {
this.setAttribute(attrName, newAttrValue);
if (typeof newValue === "number" && propData.type !== Number) {
// eslint-disable-next-line
console.error(`[UI5-FWK] numeric value for property [${name}] of component [${tag}] is missing "{ type: Number }" in its property decorator. Attribute conversion will treat it as a string. If this is intended, pass the value converted to string, otherwise add the type to the property decorator`);
}
}
else if (propertyType === Boolean) {
if (newValue === true && attrValue === null) {
this.setAttribute(attrName, "");
}
else if (newValue === false && attrValue !== null) {
this.removeAttribute(attrName);
}
const newAttrValue = converter.toAttribute(newValue, propData.type);
if (newAttrValue === null || newAttrValue === undefined) { // null means there must be no attribute for the current value of the property
this._doNotSyncAttributes.add(attrName); // skip the attributeChangedCallback call for this attribute
this.removeAttribute(attrName); // remove the attribute safely (will not trigger synchronization to the property value due to the above line)
this._doNotSyncAttributes.delete(attrName); // enable synchronization again for this attribute
}
else if (typeof newValue !== "object") {
if (attrValue !== newValue) {
this.setAttribute(attrName, newValue);
}
} // else { return; } // old object handling
}
/**
* @private
*/
_upgradeProperty(propertyName) {
if (this.hasOwnProperty(propertyName)) { // eslint-disable-line
const value = this[propertyName];
delete this[propertyName];
this[propertyName] = value;
else {
this.setAttribute(attrName, newAttrValue);
}
}
/**
* @private
*/
_upgradeAllProperties() {
const allProps = this.constructor.getMetadata().getPropertiesList();
allProps.forEach(this._upgradeProperty.bind(this));
}
/**
* Returns a singleton event listener for the "change" event of a child in a given slot

@@ -558,2 +576,3 @@ *

* Whenever a slot element is slotted inside a UI5 Web Component, its slotchange event invalidates the component
* Note: this "slotchange" listener is for slots that are children of the component (in the light dom, as opposed to slots rendered by the component in the shadow root)
*

@@ -598,2 +617,9 @@ * @param slotName the name of the slot, where the slot element (whose slotchange event we're listening to) is

onInvalidation(changeInfo) { } // eslint-disable-line
updateAttributes() {
const ctor = this.constructor;
const props = ctor.getMetadata().getProperties();
for (const [prop, propData] of Object.entries(props)) { // eslint-disable-line
this._updateAttribute(prop, this[prop]);
}
}
/**

@@ -606,5 +632,17 @@ * Do not call this method directly, only intended to be called by js

const hasIndividualSlots = ctor.getMetadata().hasIndividualSlots();
// restore properties that were initialized before `define` by calling the setter
if (this.initializedProperties.size > 0) {
Array.from(this.initializedProperties.entries()).forEach(([prop, value]) => {
delete this[prop];
this[prop] = value;
});
this.initializedProperties.clear();
}
// suppress invalidation to prevent state changes scheduling another rendering
this._suppressInvalidation = true;
this.onBeforeRendering();
if (!this._rendered) {
// first time rendering, previous setters might have been initializers from the constructor - update attributes here
this.updateAttributes();
}
// Intended for framework usage only. Currently ItemNavigation updates tab indexes after the component has updated its state but before the template is rendered

@@ -640,2 +678,3 @@ this._componentStateFinalizedEventProvider.fireEvent("componentStateFinalized");

}
this._rendered = true;
// Safari requires that children get the slot attribute only after the slot tags have been rendered in the shadow DOM

@@ -838,14 +877,2 @@ if (hasIndividualSlots) {

}
if (propData.type === Boolean && propData.defaultValue) {
throw new Error(`Cannot set a default value for property "${prop}". All booleans are false by default.`);
}
if (propData.type === Array) {
throw new Error(`Wrong type for property "${prop}". Properties cannot be of type Array - use "multiple: true" and set "type" to the single value type, such as "String", "Object", etc...`);
}
if (propData.type === Object && propData.defaultValue) {
throw new Error(`Cannot set a default value for property "${prop}". All properties of type "Object" are empty objects by default.`);
}
if (propData.multiple && propData.defaultValue) {
throw new Error(`Cannot set a default value for property "${prop}". All multiple properties are empty arrays by default.`);
}
const descriptor = getPropertyDescriptor(proto, prop);

@@ -870,39 +897,8 @@ // if the decorator is on a setter, proxy the new setter to it

}
if (this._state[prop] !== undefined) {
return this._state[prop];
}
const propDefaultValue = propData.defaultValue;
if (propData.type === Boolean) {
return false;
}
else if (propData.type === String) { // eslint-disable-line
return propDefaultValue;
}
else if (propData.multiple) { // eslint-disable-line
return [];
}
else {
return propDefaultValue;
}
return this._state[prop];
},
set(value) {
let isDifferent;
const ctor = this.constructor;
const metadataCtor = ctor.getMetadata().constructor;
value = metadataCtor.validatePropertyValue(value, propData);
const propertyType = propData.type;
let propertyValidator = propData.validator;
const oldState = origGet ? origGet.call(this) : this._state[prop];
if (propertyType && propertyType.isDataTypeClass) {
propertyValidator = propertyType;
}
if (propertyValidator) {
isDifferent = !propertyValidator.valuesAreEqual(oldState, value);
}
else if (Array.isArray(oldState) && Array.isArray(value) && propData.multiple && propData.compareValues) { // compareValues is added for IE, test if needed now
isDifferent = !arraysAreEqual(oldState, value);
}
else {
isDifferent = oldState !== value;
}
const isDifferent = oldState !== value;
if (isDifferent) {

@@ -922,6 +918,9 @@ // if the decorator is on a setter, use it for storage

});
if (this._rendered) {
// is already rendered so it is not the constructor - can set the attribute synchronously
this._updateAttribute(prop, value);
}
if (ctor.getMetadata().isFormAssociated()) {
setFormValue(this);
}
this._updateAttribute(prop, value);
}

@@ -939,3 +938,3 @@ },

const propertyName = slotData.propertyName || slotName;
Object.defineProperty(proto, propertyName, {
const propertyDescriptor = {
get() {

@@ -950,3 +949,7 @@ if (this._state[propertyName] !== undefined) {

},
});
};
Object.defineProperty(proto, propertyName, propertyDescriptor);
if (propertyName !== kebabToCamelCase(propertyName)) {
Object.defineProperty(proto, kebabToCamelCase(propertyName), propertyDescriptor);
}
}

@@ -953,0 +956,0 @@ }

@@ -1,2 +0,1 @@

import type DataType from "./types/DataType.js";
type SlotInvalidation = {

@@ -12,14 +11,13 @@ properties: boolean | Array<string>;

invalidateOnChildChange?: boolean | SlotInvalidation;
cloned?: boolean;
};
type SlotValue = Node;
type Property = {
type?: BooleanConstructor | StringConstructor | ObjectConstructor | DataType;
validator?: DataType;
defaultValue?: PropertyValue;
type?: BooleanConstructor | StringConstructor | ObjectConstructor | NumberConstructor | ArrayConstructor;
noAttribute?: boolean;
multiple?: boolean;
compareValues?: boolean;
converter?: {
fromAttribute(value: string | null, type: unknown): string | number | boolean | null | undefined;
toAttribute(value: unknown, type: unknown): string | null;
};
};
type PropertyValue = boolean | number | string | object | undefined | null | DataType;
type PropertyValue = boolean | number | string | object | undefined | null;
type EventData = Record<string, object>;

@@ -49,9 +47,2 @@ type Metadata = {

/**
* Validates the property's value and returns it if correct
* or returns the default value if not.
* **Note:** Only intended for use by UI5Element.js
* @public
*/
static validatePropertyValue(value: PropertyValue, propData: Property): PropertyValue;
/**
* Validates the slot's value and returns it if correct

@@ -58,0 +49,0 @@ * or throws an exception if not.

@@ -1,2 +0,2 @@

import { camelToKebabCase } from "./util/StringHelper.js";
import { camelToKebabCase, kebabToCamelCase } from "./util/StringHelper.js";
import { getSlottedNodes } from "./util/SlotsHelper.js";

@@ -18,36 +18,2 @@ import { getEffectiveScopingSuffixForTag } from "./CustomElementsScopeUtils.js";

const slotsAreManaged = this.slotsAreManaged();
// Initialize properties
const props = this.getProperties();
for (const propName in props) { // eslint-disable-line
const propType = props[propName].type;
const propDefaultValue = props[propName].defaultValue;
if (propType === Boolean) {
initialState[propName] = false;
if (propDefaultValue !== undefined) {
console.warn("The 'defaultValue' metadata key is ignored for all booleans properties, they would be initialized with 'false' by default"); // eslint-disable-line
}
}
else if (props[propName].multiple) {
Object.defineProperty(initialState, propName, {
enumerable: true,
get() {
return [];
},
});
}
else if (propType === Object) {
Object.defineProperty(initialState, propName, {
enumerable: true,
get() {
return "defaultValue" in props[propName] ? props[propName].defaultValue : {};
},
});
}
else if (propType === String) {
initialState[propName] = "defaultValue" in props[propName] ? props[propName].defaultValue : "";
}
else {
initialState[propName] = propDefaultValue;
}
}
// Initialize slots

@@ -59,2 +25,3 @@ if (slotsAreManaged) {

initialState[propertyName] = [];
initialState[kebabToCamelCase(propertyName)] = initialState[propertyName];
}

@@ -66,15 +33,2 @@ }

/**
* Validates the property's value and returns it if correct
* or returns the default value if not.
* **Note:** Only intended for use by UI5Element.js
* @public
*/
static validatePropertyValue(value, propData) {
const isMultiple = propData.multiple;
if (isMultiple && value) {
return value.map((propValue) => validateSingleProperty(propValue, propData));
}
return validateSingleProperty(value, propData);
}
/**
* Validates the slot's value and returns it if correct

@@ -117,3 +71,3 @@ * or throws an exception if not.

const propData = this.getProperties()[propName];
return propData.type !== Object && !propData.noAttribute && !propData.multiple;
return propData.type !== Object && propData.type !== Array && !propData.noAttribute;
}

@@ -275,24 +229,2 @@ /**

}
const validateSingleProperty = (value, propData) => {
const propertyType = propData.type;
let propertyValidator = propData.validator;
if (propertyType && propertyType.isDataTypeClass) {
propertyValidator = propertyType;
}
if (propertyValidator) {
return propertyValidator.isValid(value) ? value : propData.defaultValue;
}
if (!propertyType || propertyType === String) {
// eslint-disable-next-line @typescript-eslint/no-base-to-string -- if an object is passed as a value to a string property, this was an error so displaying [object Object] will indicate the issue to the developer
return (typeof value === "string" || typeof value === "undefined" || value === null) ? value : value.toString();
}
if (propertyType === Boolean) {
return typeof value === "boolean" ? value : false;
}
if (propertyType === Object) {
return typeof value === "object" ? value : propData.defaultValue;
}
// Check if "value" is part of the enum (propertyType) values and return the defaultValue if not found.
return value in propertyType ? value : propData.defaultValue;
};
const validateSingleSlot = (value, slotData) => {

@@ -299,0 +231,0 @@ value && getSlottedNodes(value).forEach(el => {

@@ -25,2 +25,6 @@ import type UI5Element from "../UI5Element.js";

_getRealDomRef?: (() => HTMLElement) | undefined;
initializedProperties: Map<string, unknown>;
_rendered: boolean;
_initShadowRoot(): void;
_onShadowRootSlotChange(e: Event): void;
readonly _id: string;

@@ -49,4 +53,2 @@ render(): object;

_updateAttribute(name: string, newValue: import("../UI5ElementMetadata.js").PropertyValue): void;
_upgradeProperty(this: Record<string, any>, propertyName: string): void;
_upgradeAllProperties(): void;
_getChildChangeListener(slotName: string): (param: import("../UI5Element.js").ChangeInfo & {

@@ -60,2 +62,3 @@ target: UI5Element;

onInvalidation(changeInfo: import("../UI5Element.js").ChangeInfo): void;
updateAttributes(): void;
_render(): void;

@@ -62,0 +65,0 @@ _assignIndividualSlotsToChildren(): void;

{
"name": "@ui5/webcomponents-base",
"version": "2.0.0-rc.6",
"version": "2.0.0",
"description": "UI5 Web Components: webcomponents.base",

@@ -54,3 +54,3 @@ "author": "SAP SE (https://www.sap.com)",

"@openui5/sap.ui.core": "1.120.5",
"@ui5/webcomponents-tools": "2.0.0-rc.6",
"@ui5/webcomponents-tools": "2.0.0",
"chromedriver": "^125.0.0",

@@ -66,3 +66,3 @@ "clean-css": "^5.2.2",

},
"gitHead": "19380fe3b367d021be5caf60e531ff50be91feef"
"gitHead": "2960694d66c4b62d4240e3d45e1401dd94f61aec"
}

@@ -1,6 +0,3 @@

![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-webcomponents/main/docs/images/UI5_logo_wide.png)
# ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-webcomponents/main/docs/images/UI5_logo_water.png)UI5 Web Components - Base
# UI5 Web Components - Base
[![npm Package Version](https://badge.fury.io/js/%40ui5%2Fwebcomponents.svg)](https://www.npmjs.com/package/@ui5/webcomponents)

@@ -7,0 +4,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc