Socket
Socket
Sign inDemoInstall

@ui5/webcomponents-base

Package Overview
Dependencies
Maintainers
5
Versions
478
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.1.0-rc.2 to 2.1.0-rc.3

1

dist/decorators/customElement.d.ts

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

shadowRootOptions?: Partial<ShadowRootInit>;
features?: Array<string>;
}) => ClassDecorator;
export default customElement;

5

dist/decorators/customElement.js

@@ -16,3 +16,3 @@ /**

}
const { tag, languageAware, themeAware, fastNavigation, formAssociated, shadowRootOptions, } = tagNameOrComponentSettings;
const { tag, languageAware, themeAware, fastNavigation, formAssociated, shadowRootOptions, features, } = tagNameOrComponentSettings;
target.metadata.tag = tag;

@@ -22,2 +22,5 @@ if (languageAware) {

}
if (features) {
target.metadata.features = features;
}
if (themeAware) {

@@ -24,0 +27,0 @@ target.metadata.themeAware = themeAware;

@@ -0,3 +1,12 @@

import type UI5Element from "./UI5Element.js";
declare abstract class ComponentFeature {
constructor(...args: any[]);
static define?: () => Promise<void>;
static dependencies?: Array<typeof UI5Element>;
}
declare const registerFeature: (name: string, feature: object) => void;
declare const getFeature: <T>(name: string) => T;
export { registerFeature, getFeature, };
declare const registerComponentFeature: (name: string, feature: typeof ComponentFeature) => Promise<void>;
declare const getComponentFeature: <T>(name: string) => T;
declare const subscribeForFeatureLoad: (name: string, klass: typeof UI5Element, callback: () => void) => void;
export { registerFeature, getFeature, registerComponentFeature, getComponentFeature, subscribeForFeatureLoad, ComponentFeature, };

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

import EventProvider from "./EventProvider.js";
class ComponentFeature {
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-empty-function
constructor(...args) { }
}
const features = new Map();
const componentFeatures = new Map();
const subscribers = new Map();
const EVENT_NAME = "componentFeatureLoad";
const eventProvider = new EventProvider();
const featureLoadEventName = (name) => `${EVENT_NAME}_${name}`;
const registerFeature = (name, feature) => {

@@ -8,3 +18,29 @@ features.set(name, feature);

};
export { registerFeature, getFeature, };
const registerComponentFeature = async (name, feature) => {
await Promise.all(feature.dependencies?.map(dep => dep.define()) || []);
await feature.define?.();
componentFeatures.set(name, feature);
notifyForFeatureLoad(name);
};
const getComponentFeature = (name) => {
return componentFeatures.get(name);
};
const subscribeForFeatureLoad = (name, klass, callback) => {
const subscriber = subscribers.get(klass);
const isSubscribed = subscriber?.includes(name);
if (isSubscribed) {
return;
}
if (!subscriber) {
subscribers.set(klass, [name]);
}
else {
subscriber.push(name);
}
eventProvider.attachEvent(featureLoadEventName(name), callback);
};
const notifyForFeatureLoad = (name) => {
eventProvider.fireEvent(featureLoadEventName(name), undefined);
};
export { registerFeature, getFeature, registerComponentFeature, getComponentFeature, subscribeForFeatureLoad, ComponentFeature, };
//# sourceMappingURL=FeaturesRegistry.js.map
const VersionInfo = {
version: "2.1.0-rc.2",
version: "2.1.0-rc.3",
major: 2,
minor: 1,
patch: 0,
suffix: "-rc.2",
suffix: "-rc.3",
isNext: false,
buildTime: 1721894897,
buildTime: 1722499673,
};
export default VersionInfo;
//# sourceMappingURL=VersionInfo.js.map

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

"use strict";const m=(a={})=>e=>{if(Object.prototype.hasOwnProperty.call(e,"metadata")||(e.metadata={}),typeof a=="string"){e.metadata.tag=a;return}const{tag:i,languageAware:o,themeAware:s,fastNavigation:r,formAssociated:n,shadowRootOptions:l}=a;e.metadata.tag=i,o&&(e.metadata.languageAware=o),s&&(e.metadata.themeAware=s),r&&(e.metadata.fastNavigation=r),n&&(e.metadata.formAssociated=n),l&&(e.metadata.shadowRootOptions=l),["renderer","template","styles","dependencies"].forEach(t=>{a[t]&&Object.defineProperty(e,t,{get:()=>a[t]})})};export default m;
"use strict";const m=(a={})=>e=>{if(Object.prototype.hasOwnProperty.call(e,"metadata")||(e.metadata={}),typeof a=="string"){e.metadata.tag=a;return}const{tag:l,languageAware:o,themeAware:s,fastNavigation:r,formAssociated:n,shadowRootOptions:i,features:f}=a;e.metadata.tag=l,o&&(e.metadata.languageAware=o),f&&(e.metadata.features=f),s&&(e.metadata.themeAware=s),r&&(e.metadata.fastNavigation=r),n&&(e.metadata.formAssociated=n),i&&(e.metadata.shadowRootOptions=i),["renderer","template","styles","dependencies"].forEach(t=>{a[t]&&Object.defineProperty(e,t,{get:()=>a[t]})})};export default m;
//# sourceMappingURL=customElement.js.map

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

"use strict";const e=new Map,s=(t,r)=>{e.set(t,r)},n=t=>e.get(t);export{s as registerFeature,n as getFeature};
"use strict";import u from"./EventProvider.js";class d{constructor(...t){}}const s=new Map,o=new Map,i=new Map,p="componentFeatureLoad",a=new u,c=e=>`${p}_${e}`,g=(e,t)=>{s.set(e,t)},m=e=>s.get(e),f=async(e,t)=>{await Promise.all(t.dependencies?.map(n=>n.define())||[]),await t.define?.(),o.set(e,t),E(e)},F=e=>o.get(e),b=(e,t,n)=>{const r=i.get(t);r?.includes(e)||(r?r.push(e):i.set(t,[e]),a.attachEvent(c(e),n))},E=e=>{a.fireEvent(c(e),void 0)};export{g as registerFeature,m as getFeature,f as registerComponentFeature,F as getComponentFeature,b as subscribeForFeatureLoad,d as ComponentFeature};
//# sourceMappingURL=FeaturesRegistry.js.map

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

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

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

"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};
"use strict";import"@ui5/webcomponents-base/dist/ssr-dom.js";import U from"./thirdparty/merge.js";import{boot as T}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 q}from"./DOMObserver.js";import{skipOriginalEvent as W}from"./config/NoConflict.js";import B from"./locale/getEffectiveDir.js";import{kebabToCamelCase as g,camelToKebabCase as K}from"./util/StringHelper.js";import w from"./util/isValidPropertyName.js";import{getSlotName as G,getSlottedNodesList as b}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 R}from"./features/InputElementsFormSupport.js";import{getComponentFeature as Z,subscribeForFeatureLoad as tt}from"./FeaturesRegistry.js";let et=0;const P=new Map,M=new Map,D={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 nt(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_${++et}`),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(){q(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 A=customElements.whenDefined(p);let E=P.get(p);E||(E=new Promise(O=>setTimeout(O,1e3)),P.set(p,E)),await Promise.race([A,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()&&R(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??D).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=K(t),i=(o.converter||D).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=b([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(W(t))return a;const l=new CustomEvent(t,{detail:e,composed:!1,bubbles:n,cancelable:s});return this.dispatchEvent(l)&&a}getSlottedNodes(t){return b(this[t])}attachComponentStateFinalized(t){this._componentStateFinalizedEventProvider.attachEvent("componentStateFinalized",t)}detachComponentStateFinalized(t){this._componentStateFinalizedEventProvider.detachEvent("componentStateFinalized",t)}get effectiveDir(){return Q(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(),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=nt(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()&&R(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 cacheUniqueDependencies(){const t=this.dependencies.filter((e,s,n)=>n.indexOf(e)===s);M.set(this,t)}static getUniqueDependencies(){return M.has(this)||this.cacheUniqueDependencies(),M.get(this)||[]}static whenDependenciesDefined(){return Promise.all(this.getUniqueDependencies().map(t=>t.define()))}static async onDefine(){return Promise.resolve()}static async define(){await T(),await Promise.all([this.whenDependenciesDefined(),this.onDefine()]);const t=this.getMetadata().getTag();this.getMetadata().getFeatures().forEach(o=>{Z(o)&&this.cacheUniqueDependencies(),tt(o,this,this.cacheUniqueDependencies.bind(this))});const s=z(t),n=customElements.get(t);return n&&!s?H(t):n||(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=U({},...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 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;
"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 o=this.getSlots();for(const[e,i]of Object.entries(o)){const n=i.propertyName||e;t[n]=[],t[l(n)]=t[n]}}return this._initialState=t,t}static validateSlotValue(t,r){return g(t,r)}getPureTag(){return this.metadata.tag||""}getFeatures(){return this.metadata.features||[]}getTag(){const t=this.metadata.tag;if(!t)return"";const r=p(t);return r?`${t}-${r}`:t}hasAttribute(t){const r=this.getProperties()[t];return r.type!==Object&&r.type!==Array&&!r.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,r,o){const e=this.getSlots()[t].invalidateOnChildChange;if(e===void 0)return!1;if(typeof e=="boolean")return e;if(typeof e=="object"){if(r==="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(r==="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 g=(a,t)=>(a&&d(a).forEach(r=>{if(!(r instanceof t.type))throw new Error(`The element is not of type ${t.type.toString()}`)}),a);export default u;
//# sourceMappingURL=UI5ElementMetadata.js.map

@@ -340,2 +340,3 @@ import "@ui5/webcomponents-base/dist/ssr-dom.js";

static get dependencies(): Array<typeof UI5Element>;
static cacheUniqueDependencies(this: typeof UI5Element): void;
/**

@@ -342,0 +343,0 @@ * Returns a list of the unique dependencies for this UI5 Web Component

@@ -21,2 +21,3 @@ // eslint-disable-next-line import/no-extraneous-dependencies

import { attachFormElementInternals, setFormValue } from "./features/InputElementsFormSupport.js";
import { getComponentFeature, subscribeForFeatureLoad } from "./FeaturesRegistry.js";
const DEV_MODE = true;

@@ -951,2 +952,6 @@ let autoId = 0;

}
static cacheUniqueDependencies() {
const filtered = this.dependencies.filter((dep, index, deps) => deps.indexOf(dep) === index);
uniqueDependenciesCache.set(this, filtered);
}
/**

@@ -959,4 +964,3 @@ * Returns a list of the unique dependencies for this UI5 Web Component

if (!uniqueDependenciesCache.has(this)) {
const filtered = this.dependencies.filter((dep, index, deps) => deps.indexOf(dep) === index);
uniqueDependenciesCache.set(this, filtered);
this.cacheUniqueDependencies();
}

@@ -990,2 +994,9 @@ return uniqueDependenciesCache.get(this) || [];

const tag = this.getMetadata().getTag();
const features = this.getMetadata().getFeatures();
features.forEach(feature => {
if (getComponentFeature(feature)) {
this.cacheUniqueDependencies();
}
subscribeForFeatureLoad(feature, this, this.cacheUniqueDependencies.bind(this));
});
const definedLocally = isTagRegistered(tag);

@@ -992,0 +1003,0 @@ const definedGlobally = customElements.get(tag);

@@ -34,2 +34,3 @@ type SlotInvalidation = {

shadowRootOptions?: Partial<ShadowRootInit>;
features?: Array<string>;
};

@@ -59,2 +60,7 @@ type State = Record<string, PropertyValue | Array<SlotValue>>;

/**
* Returns the tag of the UI5 Element without the scope
* @private
*/
getFeatures(): Array<string>;
/**
* Returns the tag of the UI5 Element

@@ -61,0 +67,0 @@ * @public

@@ -47,2 +47,9 @@ import { camelToKebabCase, kebabToCamelCase } from "./util/StringHelper.js";

/**
* Returns the tag of the UI5 Element without the scope
* @private
*/
getFeatures() {
return this.metadata.features || [];
}
/**
* Returns the tag of the UI5 Element

@@ -49,0 +56,0 @@ * @public

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

readonly dependencies: (typeof UI5Element)[];
cacheUniqueDependencies(this: typeof UI5Element): void;
getUniqueDependencies(this: typeof UI5Element): (typeof UI5Element)[];

@@ -420,0 +421,0 @@ whenDependenciesDefined(): Promise<(typeof UI5Element)[]>;

{
"name": "@ui5/webcomponents-base",
"version": "2.1.0-rc.2",
"version": "2.1.0-rc.3",
"description": "UI5 Web Components: webcomponents.base",

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

"@openui5/sap.ui.core": "1.120.17",
"@ui5/webcomponents-tools": "2.1.0-rc.2",
"chromedriver": "^125.0.0",
"@ui5/webcomponents-tools": "2.1.0-rc.3",
"chromedriver": "^126.0.0",
"clean-css": "^5.2.2",

@@ -66,3 +66,3 @@ "copy-and-watch": "^0.1.5",

},
"gitHead": "fdefc6672a5a050030bdfff133222d714886272b"
"gitHead": "d2d25384e15721c1682b1267f360ed2fefba4c25"
}

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

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