@lwrjs/client-modules 0.17.2-alpha.8 → 0.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import{BOOTSTRAP_END as e,INIT as o,INIT_MODULE as r}from"lwr/metrics";import{logOperationStart as i,logOperationEnd as t}from"lwr/profiler";import{hydrateComponent as n,createElement as c}from"lwc";const s=(()=>{if(!globalThis.performance)return()=>!1;let e=globalThis.performance.now();return()=>{const o=globalThis.performance.now();return o-e>50&&(e=o,!0)}})();function l(e,o){return c(e,{is:o})}function a(e){return e.replace(/\/v\/[a-zA-Z0-9-_.]+$/,"").replace("/","-").replace(/([A-Z])/g,(e=>`-${e.toLowerCase()}`))}const d=/-([a-z])/g;function f(e){return e.replace(d,(e=>e[1].toUpperCase()))}function p(c,d={}){if(void 0===globalThis.customElements||void 0===globalThis.document)return void i({id:e});i({id:o});let p=0;const m=globalThis.document;for(const[e,o]of c){const c=a(e);if(!m.body.querySelector(c)){i({id:r,specifier:e,specifierIndex:++p});const n=l(c,o),s=m.querySelector("[lwr-root]");s?s.appendChild(n):m.body.appendChild(n),t({id:r,specifier:e,specifierIndex:p,metadata:{renderMode:"spa"}});continue}const h=m.querySelectorAll(c);(async()=>{const a=++p;for(const w of h){i({id:r,specifier:e,specifierIndex:a});const h=w.dataset.lwrPropsId;if(h){s()&&await u(),m=w,b=o,g=d[h]||{},n(m,b,g),t({id:r,specifier:e,specifierIndex:p,metadata:{renderMode:"ssr"}});continue}const y=l(c,o);for(const{name:e,value:o}of w.attributes){y.setAttribute(e,o);const r=f(e);r in y&&(y[r]=o)}for(;w.firstChild;)y.appendChild(w.firstChild);w.replaceWith(y),t({id:r,specifier:e,specifierIndex:a,metadata:{renderMode:"csr"}})}var m,b,g})()}t({id:o}),i({id:e})}async function u(){const e=globalThis.scheduler;return function(e){let o,r=e[0],i=1;for(;i<e.length;){const t=e[i],n=e[i+1];if(i+=2,("optionalAccess"===t||"optionalCall"===t)&&null==r)return;"access"===t||"optionalAccess"===t?(o=r,r=n(r)):"call"!==t&&"optionalCall"!==t||(r=n(((...e)=>r.call(o,...e))),o=void 0)}return r}([e,"optionalAccess",e=>e.yield])?e.yield():new Promise((e=>setTimeout(e,0)))}export{f as getPropFromAttrName,p as init,a as toKebabCase};
1
+ import{BOOTSTRAP_END as e,INIT as o,INIT_MODULE as r}from"lwr/metrics";import{logOperationStart as t,logOperationEnd as n}from"lwr/profiler";import{hydrateComponent as i,createElement as c}from"lwc";const l=(()=>{const e=globalThis,{SSREnabled:o}=e.LWR&&e.LWR.env||{};if(!globalThis.performance||!o)return()=>!1;let r=globalThis.performance.now();return()=>{const e=globalThis.performance.now();return e-r>50&&(r=e,!0)}})();function s(e,o){return c(e,{is:o})}function a(e){return e.replace(/\/v\/[a-zA-Z0-9-_.]+$/,"").replace("/","-").replace(/([A-Z])/g,(e=>`-${e.toLowerCase()}`))}const d=/-([a-z])/g;function p(e){return e.replace(d,(e=>e[1].toUpperCase()))}function f(c,d={}){void 0!==globalThis.customElements&&void 0!==globalThis.document?(t({id:o}),(async()=>{let e=0;const o=globalThis.document;for(const[b,g]of c){l()&&await u();const c=++e,w=a(b);if(!o.body.querySelector(w)){t({id:r,specifier:b,specifierIndex:c});const e=s(w,g),i=o.querySelector("[lwr-root]");i?i.appendChild(e):o.body.appendChild(e),n({id:r,specifier:b,specifierIndex:c,metadata:{renderMode:"spa"}});continue}const y=o.querySelectorAll(w);for(const e of y){t({id:r,specifier:b,specifierIndex:c});const o=e.dataset.lwrPropsId;if(o){f=e,m=g,h=d[o]||{},i(f,m,h),n({id:r,specifier:b,specifierIndex:c,metadata:{renderMode:"ssr"}});continue}const l=s(w,g);for(const{name:o,value:r}of e.attributes){l.setAttribute(o,r);const e=p(o);e in l&&(l[e]=r)}for(;e.childNodes.length>0;)l.appendChild(e.childNodes[0]);const a=e.parentElement;a&&a.replaceChild(l,e),n({id:r,specifier:b,specifierIndex:c,metadata:{renderMode:"csr"}})}}var f,m,h})(),n({id:o}),t({id:e})):t({id:e})}async function u(){const e=globalThis.scheduler;return function(e){let o,r=e[0],t=1;for(;t<e.length;){const n=e[t],i=e[t+1];if(t+=2,("optionalAccess"===n||"optionalCall"===n)&&null==r)return;"access"===n||"optionalAccess"===n?(o=r,r=i(r)):"call"!==n&&"optionalCall"!==n||(r=i(((...e)=>r.call(o,...e))),o=void 0)}return r}([e,"optionalAccess",e=>e.yield])?e.yield():new Promise((e=>setTimeout(e,0)))}export{p as getPropFromAttrName,f as init,a as toKebabCase};
2
2
  //# sourceMappingURL=init.js.map