@cfdez11/vex 0.10.1 → 0.10.3

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 +1 @@
1
- (function(){async function hydrateMarker(marker,props={}){if(marker.dataset.hydrated==="true")return;marker.dataset.hydrated="true";const componentName=marker.getAttribute("data-client:component"),componentProps=marker.getAttribute("data-client:props");let parsedProps={};try{parsedProps=JSON.parse(componentProps||"{}")}catch(e){console.warn(`Failed to parse props for component ${componentName}`,e)}const finalProps={...parsedProps,...props};try{await(await import(`/_vexjs/_components/${componentName}.js`)).hydrateClientComponent(marker,finalProps)}catch(error){console.error(`Failed to load component: ${componentName}`,error)}}async function hydrateComponents(container=document,props={}){const markers=container.querySelectorAll("[data-client\\:component]:not([data-hydrated='true'])");for(const marker of markers)await hydrateMarker(marker,props)}new MutationObserver(mutations=>{for(const mutation of mutations)for(const node of mutation.addedNodes)node.nodeType===1&&(node.matches?.("[data-client\\:component]")&&hydrateMarker(node),hydrateComponents(node))}).observe(document,{childList:!0,subtree:!0}),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>hydrateComponents()):hydrateComponents(),window.hydrateComponents=hydrateComponents})();
1
+ (function(){async function hydrateMarker(marker,props={}){if(marker.dataset.hydrated==="true")return;marker.dataset.hydrated="true";const componentName=marker.getAttribute("data-client:component"),componentProps=marker.getAttribute("data-client:props");let parsedProps={};try{parsedProps=JSON.parse(componentProps||"{}")}catch(e){console.warn(`Failed to parse props for component ${componentName}`,e)}const finalProps={...parsedProps,...props};try{await(await import(`/_vexjs/_components/${componentName}.js`)).hydrateClientComponent(marker,finalProps)}catch(error){console.error(`Failed to load component: ${componentName}`,error)}}async function hydrateComponents(container=document,props={}){let markers;do markers=container.querySelectorAll("[data-client\\:component]:not([data-hydrated='true'])"),await Promise.all([...markers].map(marker=>hydrateMarker(marker,props)));while(markers.length>0)}new MutationObserver(mutations=>{for(const mutation of mutations)for(const node of mutation.addedNodes)node.nodeType===1&&(node.matches?.("[data-client\\:component]")&&hydrateMarker(node),hydrateComponents(node))}).observe(document,{childList:!0,subtree:!0}),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>hydrateComponents()):hydrateComponents(),window.hydrateComponents=hydrateComponents})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfdez11/vex",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "description": "A vanilla JavaScript meta-framework with file-based routing, SSR/CSR/SSG/ISR and Vue-like reactivity",
5
5
  "type": "module",
6
6
  "main": "./dist/server/index.js",