Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rmwc/base

Package Overview
Dependencies
Maintainers
1
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rmwc/base - npm Package Compare versions

Comparing version 14.0.7 to 14.0.8

4

index.js

@@ -1,5 +0,5 @@

"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),i=require("react"),k=require("react-dom"),A=require("@material/dom/dist/mdc.dom.js");function L(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const F=L(A),W="@rmwc/base",U="14.0.7",q="RMWC base module",z="./index.js",$="./index.d.ts",V={".":{import:"./index.mjs",types:"./index.d.ts",require:"./index.js"}},H={access:"public"},B={type:"git",url:"git+https://github.com/rmwc/rmwc.git"},K=["rmwc"],G="rmwc",J="MIT",Z={url:"https://github.com/rmwc/rmwc/issues"},Q="https://github.com/rmwc/rmwc/tree/master/packages/base#readme",X={react:">=16.8.x","react-dom":">=16.8.x"},Y={"@material/dom":"^14.0.0","@rmwc/types":"workspace:*",classnames:"^2.3.1",hyperform:"^0.11.0","mutation-observer":"^1.0.3",tslib:"^2.4.0"},ee={name:W,version:U,description:q,main:z,types:$,exports:V,publishConfig:H,repository:B,keywords:K,author:G,private:!1,license:J,bugs:Z,homepage:Q,peerDependencies:X,dependencies:Y};function te(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var P={exports:{}};/*!
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),i=require("react"),k=require("react-dom"),A=require("@material/dom/dist/mdc.dom.js");function L(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const F=L(A),W="@rmwc/base",U="14.0.8",q="RMWC base module",z="./index.js",V="./index.d.ts",$={".":{import:"./index.mjs",types:"./index.d.ts",require:"./index.js"}},H={access:"public"},B={type:"git",url:"git+https://github.com/rmwc/rmwc.git"},K=["rmwc"],G="rmwc",J="MIT",Z={url:"https://github.com/rmwc/rmwc/issues"},Q="https://github.com/rmwc/rmwc/tree/master/packages/base#readme",X={react:">=16.8.x","react-dom":">=16.8.x"},Y={"@material/dom":"^14.0.0","@rmwc/types":"workspace:*",classnames:"^2.3.1",hyperform:"^0.11.0","mutation-observer":"^1.0.3",tslib:"^2.4.0"},ee={name:W,version:U,description:q,main:z,types:V,exports:$,publishConfig:H,repository:B,keywords:K,author:G,private:!1,license:J,bugs:Z,homepage:Q,peerDependencies:X,dependencies:Y};function te(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var P={exports:{}};/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var s=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var a=typeof o;if(a==="string"||a==="number")s.push(o);else if(Array.isArray(o)){if(o.length){var l=n.apply(null,o);l&&s.push(l)}}else if(a==="object"){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){s.push(o.toString());continue}for(var c in o)e.call(o,c)&&o[c]&&s.push(c)}}}return s.join(" ")}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(P);var ne=P.exports;const m=te(ne),E={portalElement:null,setPortalElement:null},p=i.createContext(E),se=({children:t})=>{const[e,n]=i.useState(null);return u.jsx(p.Provider,{value:{portalElement:e,setPortalElement:n},children:t})},_=t=>t.replace(/(-[a-z])/g,e=>e.toUpperCase().replace("-","")),x=t=>t.replace(/(^[a-z]+|[A-Z][a-z]*|\d+)/g,e=>"-"+e.toLowerCase()).slice(1),g=t=>(Array.isArray(t)?t:[t]).filter(n=>!!n).map(n=>`mdc-theme--${x(n)}`),oe=t=>{const e=({theme:n,className:s,...r})=>{if(n){const o=m(s,g(n));return u.jsx(t,{className:o,...r})}return u.jsx(t,{className:s,...r})};return e.displayName="withTheme",e},re=i.forwardRef(function({tag:e="div",theme:n,element:s,...r},o){const a=s?s.props(r):r,l=s?S(o,s.reactRef):o;return u.jsx(e,{...a,ref:l})}),ae=(t,e)=>m(t.className,...t.theme?g(t.theme):[],...typeof e=="function"?e(t):e),S=(...t)=>e=>{for(const n of t)typeof n=="function"?n(e):n&&"current"in n&&(n.current=e)},h=(t,e)=>{typeof t=="function"?t(e):t&&"current"in t&&(t.current=e)};function R(t){const e=i.forwardRef(t),n=(s,r)=>u.jsx(u.Fragment,{});return n.displayName=t.constructor.name||"RMWCComponent",e.displayName=n.displayName,e}function ie(t){const e=R(t);return i.memo(e)}const D={blur:"onBlur",cancel:"onCancel",click:"onClick",close:"onClose",contextmenu:"onContextMenu",copy:"onCopy",cut:"onCut",auxclick:"onAuxClick",doubleclick:"onDoubleClick",dragend:"onDragEnd",dragstart:"onDragStart",drop:"onDrop",focus:"onFocus",input:"onInput",invalid:"onInvalid",keydown:"onKeyDown",keypress:"onKeyPress",keyup:"onKeyUp",mousedown:"onMouseDown",mouseup:"onMouseUp",paste:"onPaste",pause:"onPause",play:"onPlay",pointercancel:"onPointerCancel",pointerdown:"onPointerDown",pointerup:"onPointerUp",ratechange:"onRateChange",reset:"onReset",seeked:"onSeeked",submit:"onSubmit",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchstart:"onTouchStart",volumechange:"onVolumeChange",abort:"onAbort",animationend:"onAnimationEnd",animationiteration:"onAnimationIteration",animationstart:"onAnimationStart",canplay:"onCanPlay",canplaythrough:"onCanPlayThrough",drag:"onDrag",dragenter:"onDragEnter",dragexit:"onDragExit",dragleave:"onDragLeave",dragover:"onDragOver",durationchange:"onDurationChange",emptied:"onEmptied",encrypted:"onEncrypted",ended:"onEnded",error:"onError",gotpointercapture:"onGotPointerCapture",load:"onLoad",loadeddata:"onLoadedData",loadedmetadata:"onLoadedMetadata",loadstart:"onLoadStart",lostpointercapture:"onLostPointerCapture",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseover:"onMouseOver",playing:"onPlaying",pointermove:"onPointerMove",pointerout:"onPointerOut",pointerover:"onPointerOver",progress:"onProgress",scroll:"onScroll",seeking:"onSeeking",stalled:"onStalled",suspend:"onSuspend",timeupdate:"onTimeUpdate",toggle:"onToggle",touchmove:"onTouchMove",transitionend:"onTransitionEnd",waiting:"onWaiting",wheel:"onWheel",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",pointerenter:"onPointerEnter",pointerleave:"onPointerLeave",change:"onChange",select:"onSelect",beforeinput:"onBeforeInput",compositionend:"onCompositionEnd",compositionstart:"onCompositionStart",compositionupdate:"onCompositionUpdate"},C=t=>D[t]||t;class M{constructor(e){this._classes=new Set,this._events={},this._style={},this._props={},this._onChange=null,this.reactRef=i.createRef(),this._onChange=e,this.onChange=this.onChange.bind(this),this.addClass=this.addClass.bind(this),this.removeClass=this.removeClass.bind(this),this.hasClass=this.hasClass.bind(this),this.setProp=this.setProp.bind(this),this.getProp=this.getProp.bind(this),this.removeProp=this.removeProp.bind(this),this.setStyle=this.setStyle.bind(this),this.addEventListener=this.addEventListener.bind(this),this.removeEventListener=this.removeEventListener.bind(this)}onChange(){this._onChange&&this._onChange()}destroy(){this._onChange=null,this._events={},this._style={},this._props={},this._classes=new Set}addClass(e){this._classes.has(e)||(this._classes.add(e),this.onChange())}removeClass(e){this._classes.has(e)&&(this._classes.delete(e),this.onChange())}hasClass(e){return this._classes.has(e)}setProp(e,n,s=!1){this._props[e]!==n&&(this._props[e]=n,!s&&this.onChange())}getProp(e){return this._props[e]}removeProp(e){this._props[e]!==void 0&&(delete this._props[e],this.onChange())}props(e){const{className:n="",style:s={}}=e,r=Object.entries(e).reduce((l,[c,d])=>{const y=this._events[c];if(typeof d=="function"&&typeof y=="function"){const I=v=>(y(v),d(v));l[c]=I}return l},{...this._events}),o=m(n,[...this._classes]),a={...this._style,...s};return{...e,...this._props,...r,style:a,className:o}}setStyle(e,n){e=e.startsWith("--")?e:_(e),this._style[e]!==n&&(this._style[e]=n,this.onChange())}addEventListener(e,n){const s=C(e);this._events[s]!==n&&(this._events[s]=n,this.onChange())}removeEventListener(e,n){const s=C(e);this._events[s]&&(delete this._events[s],this.onChange())}get ref(){return this.reactRef.current}}const ce=t=>(e,n,s=!1)=>{let r;r=new CustomEvent(e,{detail:n,bubbles:s}),Object.defineProperty(r,"target",{value:n,writable:!1}),Object.defineProperty(r,"currentTarget",{value:n,writable:!1});const o=e;return t[o]&&t[o](r),r},le=({foundation:t,props:e,elements:n,api:s})=>{const[,r]=i.useReducer(c=>c+1,0),o=i.useRef(e);o.current=e;const a=i.useMemo(()=>Object.keys(n).reduce((c,d)=>(c[d]=new M(()=>{r()}),c),{}),[]),l=i.useMemo(()=>{const c=t({...a,getProps:()=>o.current,emit:(...d)=>ce(o.current)(...d)});return s&&h(o.current.apiRef,s({foundation:c,...a})),c},[]);return i.useEffect(()=>{const c=l;return c.init(),s&&h(o.current.apiRef,s({foundation:c,...a})),h(o.current.foundationRef,c),()=>{c.destroy(),h(o.current.apiRef,null),h(o.current.foundationRef,null),Object.values(a).map(d=>d.destroy()),o.current={}}},[l,a]),{foundation:l,...a}},O="rmwcPortal",ue=t=>{const e=i.useContext(p),n=e==null?void 0:e.setPortalElement,s=i.useCallback(r=>{r!==null&&n&&n(r)},[n]);return u.jsx("div",{ref:s,id:O,...t})};function de({children:t,renderTo:e,menuSurfaceDomPositionRef:n}){const[s,r]=i.useState(),{portalElement:o}=i.useContext(p);return i.useEffect(()=>{let a;e===!0&&o?a=o:e===!0?(a=(document==null?void 0:document.getElementById(O))??void 0,a||console.warn('No default Portal found. Did you forget to include it in the root of your app? `import { Portal } from "@rmwc/base";`')):typeof e=="string"?(a=(document==null?void 0:document.querySelector(e))??void 0,a||console.warn(`The selector you provided for renderToPortal "${e}" didn't find any elements.`)):e instanceof Element&&(a=e),a!==s&&r(a)},[e,s,o]),e?s?u.jsx("div",{ref:n,children:k.createPortal(t,s)}):null:u.jsx(u.Fragment,{children:t})}const he=function(t,e){var n;return function(){var s=this,r=arguments,o=function(){n=null,t.apply(s,r)};n!==null&&clearTimeout(n),n=setTimeout(o,e)}},me=t=>{},pe=(t,e,n)=>{t={...t};for(const s in e){const r=e[s];let o,a=l=>l;Array.isArray(r)?(o=r[0],a=r[1]):o=r,t[s]!==void 0&&(o===""||(t[o]=a(t[s]),t[o]!==t[s]&&`${t[s]}${t[o]}`),delete t[s])}return t},fe=F.focusTrap.FocusTrap,ge=(t,e)=>new fe(t,e);function ye(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}const ve=ye()?i.useLayoutEffect:i.useEffect;let f=!1,Ce=0;function w(){return++Ce}const b=i["useId".toString()],we=(t,e)=>{const n=be(e.label);return e.id?e.id:`${t}-${n}`},be=t=>{if(b!==void 0){let r=b();return t??r}let e=t??(f?w():null),[n,s]=i.useState(e);return ve(()=>{n===null&&s(w())},[]),i.useEffect(()=>{f===!1&&(f=!0)},[]),t??n??void 0},Pe=(t,e)=>{if(t instanceof Element){if(t&&t.closest)return t.closest(e);{let n=t;for(;n;){if(j(n,e))return n;n=n.parentElement}}}return null},j=(t,e)=>(t.matches||t.webkitMatchesSelector||t.msMatchesSelector).call(t,e),Ee=t=>{const e=(Math.random()+Math.random()+1).toString(36).substring(2);return`${t}-${e}`},_e=t=>{const e=i.Children.only(t.children);return i.cloneElement(e,{...t,...e.props,className:m(t.className,e.props.className),style:{...e.props.style,...t.style}})};class N{constructor(){this.events_={}}on(e,n){this.events_=this.events_||{},this.events_[e]=this.events_[e]||[],this.events_[e].push(n)}off(e,n){this.events_=this.events_||{},e in this.events_&&this.events_[e].splice(this.events_[e].indexOf(n),1)}trigger(e,...n){if(this.events_=this.events_||{},e in this.events_)for(var s=0;s<this.events_[e].length;s++)this.events_[e][s].apply(this,Array.prototype.slice.call(arguments,1))}}class xe extends N{constructor(){super(...arguments),this.array=[]}push(...e){const n=this.array.push(...e);return this.trigger("change"),n}empty(){this.array.length=0,this.trigger("change")}remove(e){const n=this.array.indexOf(e);return n>-1?(this.array.splice(n,1),this.trigger("change"),!0):!1}}const Se=t=>{var s,r,o;const e=Array.isArray(t)?t[0]:t;return((s=e==null?void 0:e.type)==null?void 0:s.displayName)||((r=e==null?void 0:e.constructor)==null?void 0:r.displayName)||(e==null?void 0:e.displayName)||(e==null?void 0:e.name)||((o=e==null?void 0:e.constructor)==null?void 0:o.name)||"Unknown"},Re={bottom:0,height:0,left:0,right:0,top:0,width:0},De=i.createContext(!1),Me=i.createContext(!1),Oe=()=>{window.dispatchEvent(new Event("resize"))},T=(t,e=1,n=1)=>{window.requestAnimationFrame(()=>{n>=e?t():T(t,e,n+1)})},je=ee.version;exports.ArrayEmitter=xe;exports.DataTableContext=De;exports.DataTableHeadContext=Me;exports.EventEmitter=N;exports.FoundationElement=M;exports.Portal=ue;exports.PortalChild=de;exports.PortalContext=p;exports.PortalProvider=se;exports.RMWC_VERSION=je;exports.Tag=re;exports.classNames=m;exports.closest=Pe;exports.createComponent=R;exports.createMemoComponent=ie;exports.debounce=he;exports.deprecationWarning=me;exports.emptyClientRect=Re;exports.eventsMap=D;exports.focusTrapFactory=ge;exports.getDisplayName=Se;exports.handleDeprecations=pe;exports.handleRef=h;exports.matches=j;exports.mergeRefs=S;exports.parseThemeOptions=g;exports.portalContextDefaultValues=E;exports.raf=T;exports.randomId=Ee;exports.toCamel=_;exports.toDashCase=x;exports.triggerWindowResize=Oe;exports.useClassNames=ae;exports.useFoundation=le;exports.useId=we;exports.withTheme=oe;exports.wrapChild=_e;
*/(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var o="",a=0;a<arguments.length;a++){var c=arguments[a];c&&(o=r(o,s(c)))}return o}function s(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var a="";for(var c in o)e.call(o,c)&&o[c]&&(a=r(a,c));return a}function r(o,a){return a?o?o+" "+a:o+a:o}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(P);var ne=P.exports;const m=te(ne),E={portalElement:null,setPortalElement:null},f=i.createContext(E),oe=({children:t})=>{const[e,n]=i.useState(null);return u.jsx(f.Provider,{value:{portalElement:e,setPortalElement:n},children:t})},_=t=>t.replace(/(-[a-z])/g,e=>e.toUpperCase().replace("-","")),x=t=>t.replace(/(^[a-z]+|[A-Z][a-z]*|\d+)/g,e=>"-"+e.toLowerCase()).slice(1),g=t=>(Array.isArray(t)?t:[t]).filter(n=>!!n).map(n=>`mdc-theme--${x(n)}`),se=t=>{const e=({theme:n,className:s,...r})=>{if(n){const o=m(s,g(n));return u.jsx(t,{className:o,...r})}return u.jsx(t,{className:s,...r})};return e.displayName="withTheme",e},re=i.forwardRef(function({tag:e="div",theme:n,element:s,...r},o){const a=s?s.props(r):r,c=s?S(o,s.reactRef):o;return u.jsx(e,{...a,ref:c})}),ae=(t,e)=>m(t.className,...t.theme?g(t.theme):[],...typeof e=="function"?e(t):e),S=(...t)=>e=>{for(const n of t)typeof n=="function"?n(e):n&&"current"in n&&(n.current=e)},h=(t,e)=>{typeof t=="function"?t(e):t&&"current"in t&&(t.current=e)};function R(t){const e=i.forwardRef(t),n=(s,r)=>u.jsx(u.Fragment,{});return n.displayName=t.constructor.name||"RMWCComponent",e.displayName=n.displayName,e}function ie(t){const e=R(t);return i.memo(e)}const D={blur:"onBlur",cancel:"onCancel",click:"onClick",close:"onClose",contextmenu:"onContextMenu",copy:"onCopy",cut:"onCut",auxclick:"onAuxClick",doubleclick:"onDoubleClick",dragend:"onDragEnd",dragstart:"onDragStart",drop:"onDrop",focus:"onFocus",input:"onInput",invalid:"onInvalid",keydown:"onKeyDown",keypress:"onKeyPress",keyup:"onKeyUp",mousedown:"onMouseDown",mouseup:"onMouseUp",paste:"onPaste",pause:"onPause",play:"onPlay",pointercancel:"onPointerCancel",pointerdown:"onPointerDown",pointerup:"onPointerUp",ratechange:"onRateChange",reset:"onReset",seeked:"onSeeked",submit:"onSubmit",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchstart:"onTouchStart",volumechange:"onVolumeChange",abort:"onAbort",animationend:"onAnimationEnd",animationiteration:"onAnimationIteration",animationstart:"onAnimationStart",canplay:"onCanPlay",canplaythrough:"onCanPlayThrough",drag:"onDrag",dragenter:"onDragEnter",dragexit:"onDragExit",dragleave:"onDragLeave",dragover:"onDragOver",durationchange:"onDurationChange",emptied:"onEmptied",encrypted:"onEncrypted",ended:"onEnded",error:"onError",gotpointercapture:"onGotPointerCapture",load:"onLoad",loadeddata:"onLoadedData",loadedmetadata:"onLoadedMetadata",loadstart:"onLoadStart",lostpointercapture:"onLostPointerCapture",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseover:"onMouseOver",playing:"onPlaying",pointermove:"onPointerMove",pointerout:"onPointerOut",pointerover:"onPointerOver",progress:"onProgress",scroll:"onScroll",seeking:"onSeeking",stalled:"onStalled",suspend:"onSuspend",timeupdate:"onTimeUpdate",toggle:"onToggle",touchmove:"onTouchMove",transitionend:"onTransitionEnd",waiting:"onWaiting",wheel:"onWheel",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",pointerenter:"onPointerEnter",pointerleave:"onPointerLeave",change:"onChange",select:"onSelect",beforeinput:"onBeforeInput",compositionend:"onCompositionEnd",compositionstart:"onCompositionStart",compositionupdate:"onCompositionUpdate"},C=t=>D[t]||t;class M{constructor(e){this._classes=new Set,this._events={},this._style={},this._props={},this._onChange=null,this.reactRef=i.createRef(),this._onChange=e,this.onChange=this.onChange.bind(this),this.addClass=this.addClass.bind(this),this.removeClass=this.removeClass.bind(this),this.hasClass=this.hasClass.bind(this),this.setProp=this.setProp.bind(this),this.getProp=this.getProp.bind(this),this.removeProp=this.removeProp.bind(this),this.setStyle=this.setStyle.bind(this),this.addEventListener=this.addEventListener.bind(this),this.removeEventListener=this.removeEventListener.bind(this)}onChange(){this._onChange&&this._onChange()}destroy(){this._onChange=null,this._events={},this._style={},this._props={},this._classes=new Set}addClass(e){this._classes.has(e)||(this._classes.add(e),this.onChange())}removeClass(e){this._classes.has(e)&&(this._classes.delete(e),this.onChange())}hasClass(e){return this._classes.has(e)}setProp(e,n,s=!1){this._props[e]!==n&&(this._props[e]=n,!s&&this.onChange())}getProp(e){return this._props[e]}removeProp(e){this._props[e]!==void 0&&(delete this._props[e],this.onChange())}props(e){const{className:n="",style:s={}}=e,r=Object.entries(e).reduce((c,[l,d])=>{const y=this._events[l];if(typeof d=="function"&&typeof y=="function"){const I=v=>(y(v),d(v));c[l]=I}return c},{...this._events}),o=m(n,[...this._classes]),a={...this._style,...s};return{...e,...this._props,...r,style:a,className:o}}setStyle(e,n){e=e.startsWith("--")?e:_(e),this._style[e]!==n&&(this._style[e]=n,this.onChange())}addEventListener(e,n){const s=C(e);this._events[s]!==n&&(this._events[s]=n,this.onChange())}removeEventListener(e,n){const s=C(e);this._events[s]&&(delete this._events[s],this.onChange())}get ref(){return this.reactRef.current}}const ce=t=>(e,n,s=!1)=>{let r;r=new CustomEvent(e,{detail:n,bubbles:s}),Object.defineProperty(r,"target",{value:n,writable:!1}),Object.defineProperty(r,"currentTarget",{value:n,writable:!1});const o=e;return t[o]&&t[o](r),r},le=({foundation:t,props:e,elements:n,api:s})=>{const[,r]=i.useReducer(l=>l+1,0),o=i.useRef(e);o.current=e;const a=i.useMemo(()=>Object.keys(n).reduce((l,d)=>(l[d]=new M(()=>{r()}),l),{}),[]),c=i.useMemo(()=>{const l=t({...a,getProps:()=>o.current,emit:(...d)=>ce(o.current)(...d)});return s&&h(o.current.apiRef,s({foundation:l,...a})),l},[]);return i.useEffect(()=>{const l=c;return l.init(),s&&h(o.current.apiRef,s({foundation:l,...a})),h(o.current.foundationRef,l),()=>{l.destroy(),h(o.current.apiRef,null),h(o.current.foundationRef,null),Object.values(a).map(d=>d.destroy()),o.current={}}},[c,a]),{foundation:c,...a}},O="rmwcPortal",ue=t=>{const e=i.useContext(f),n=e==null?void 0:e.setPortalElement,s=i.useCallback(r=>{r!==null&&n&&n(r)},[n]);return u.jsx("div",{ref:s,id:O,...t})};function de({children:t,renderTo:e,menuSurfaceDomPositionRef:n}){const[s,r]=i.useState(),{portalElement:o}=i.useContext(f);return i.useEffect(()=>{let a;e===!0&&o?a=o:e===!0?(a=(document==null?void 0:document.getElementById(O))??void 0,a||console.warn('No default Portal found. Did you forget to include it in the root of your app? `import { Portal } from "@rmwc/base";`')):typeof e=="string"?(a=(document==null?void 0:document.querySelector(e))??void 0,a||console.warn(`The selector you provided for renderToPortal "${e}" didn't find any elements.`)):e instanceof Element&&(a=e),a!==s&&r(a)},[e,s,o]),e?s?u.jsx("div",{ref:n,children:k.createPortal(t,s)}):null:u.jsx(u.Fragment,{children:t})}const he=function(t,e){var n;return function(){var s=this,r=arguments,o=function(){n=null,t.apply(s,r)};n!==null&&clearTimeout(n),n=setTimeout(o,e)}},me=t=>{},fe=(t,e,n)=>{t={...t};for(const s in e){const r=e[s];let o,a=c=>c;Array.isArray(r)?(o=r[0],a=r[1]):o=r,t[s]!==void 0&&(o===""||(t[o]=a(t[s]),t[o]!==t[s]&&`${t[s]}${t[o]}`),delete t[s])}return t},pe=F.focusTrap.FocusTrap,ge=(t,e)=>new pe(t,e);function ye(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}const ve=ye()?i.useLayoutEffect:i.useEffect;let p=!1,Ce=0;function b(){return++Ce}const w=i.useId,be=(t,e)=>{const n=we(e.label);return e.id?e.id:`${t}-${n}`},we=t=>{if(w!==void 0){let r=w();return t??r}let e=t??(p?b():null),[n,s]=i.useState(e);return ve(()=>{n===null&&s(b())},[]),i.useEffect(()=>{p===!1&&(p=!0)},[]),t??n??void 0},Pe=(t,e)=>{if(t instanceof Element){if(t&&t.closest)return t.closest(e);{let n=t;for(;n;){if(j(n,e))return n;n=n.parentElement}}}return null},j=(t,e)=>(t.matches||t.webkitMatchesSelector||t.msMatchesSelector).call(t,e),Ee=t=>{const e=(Math.random()+Math.random()+1).toString(36).substring(2);return`${t}-${e}`},_e=t=>{const e=i.Children.only(t.children);return i.cloneElement(e,{...t,...e.props,className:m(t.className,e.props.className),style:{...e.props.style,...t.style}})};class T{constructor(){this.events_={}}on(e,n){this.events_=this.events_||{},this.events_[e]=this.events_[e]||[],this.events_[e].push(n)}off(e,n){this.events_=this.events_||{},e in this.events_&&this.events_[e].splice(this.events_[e].indexOf(n),1)}trigger(e,...n){if(this.events_=this.events_||{},e in this.events_)for(var s=0;s<this.events_[e].length;s++)this.events_[e][s].apply(this,Array.prototype.slice.call(arguments,1))}}class xe extends T{constructor(){super(...arguments),this.array=[]}push(...e){const n=this.array.push(...e);return this.trigger("change"),n}empty(){this.array.length=0,this.trigger("change")}remove(e){const n=this.array.indexOf(e);return n>-1?(this.array.splice(n,1),this.trigger("change"),!0):!1}}const Se=t=>{var s,r,o;const e=Array.isArray(t)?t[0]:t;return((s=e==null?void 0:e.type)==null?void 0:s.displayName)||((r=e==null?void 0:e.constructor)==null?void 0:r.displayName)||(e==null?void 0:e.displayName)||(e==null?void 0:e.name)||((o=e==null?void 0:e.constructor)==null?void 0:o.name)||"Unknown"},Re={bottom:0,height:0,left:0,right:0,top:0,width:0},De=i.createContext(!1),Me=i.createContext(!1),Oe=()=>{window.dispatchEvent(new Event("resize"))},N=(t,e=1,n=1)=>{window.requestAnimationFrame(()=>{n>=e?t():N(t,e,n+1)})},je=ee.version;exports.ArrayEmitter=xe;exports.DataTableContext=De;exports.DataTableHeadContext=Me;exports.EventEmitter=T;exports.FoundationElement=M;exports.Portal=ue;exports.PortalChild=de;exports.PortalContext=f;exports.PortalProvider=oe;exports.RMWC_VERSION=je;exports.Tag=re;exports.classNames=m;exports.closest=Pe;exports.createComponent=R;exports.createMemoComponent=ie;exports.debounce=he;exports.deprecationWarning=me;exports.emptyClientRect=Re;exports.eventsMap=D;exports.focusTrapFactory=ge;exports.getDisplayName=Se;exports.handleDeprecations=fe;exports.handleRef=h;exports.matches=j;exports.mergeRefs=S;exports.parseThemeOptions=g;exports.portalContextDefaultValues=E;exports.raf=N;exports.randomId=Ee;exports.toCamel=_;exports.toDashCase=x;exports.triggerWindowResize=Oe;exports.useClassNames=ae;exports.useFoundation=le;exports.useId=be;exports.withTheme=se;exports.wrapChild=_e;
{
"name": "@rmwc/base",
"version": "14.0.7",
"version": "14.0.8",
"description": "RMWC base module",

@@ -37,3 +37,3 @@ "main": "./index.js",

"@material/dom": "^14.0.0",
"@rmwc/types": "14.0.7",
"@rmwc/types": "14.0.8",
"classnames": "^2.3.1",

@@ -40,0 +40,0 @@ "hyperform": "^0.11.0",

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