@jasonshimmy/custom-elements-runtime 0.0.9-beta.3 → 0.0.9-beta.4

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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # 🧩 Custom Elements Runtime
2
2
 
3
- > **Ultra-light, type-safe runtime for fast, reactive web components.**
3
+ > **Ultra-lightweight, type-safe runtime for fast, reactive, and maintainable web components.**
4
4
 
5
5
  Build modern components with strict TypeScript, zero dependencies, and a clean functional API. Designed for speed, standards compliance, and productivity.
6
6
 
@@ -42,7 +42,7 @@
42
42
  <h3>Error Boundary</h3>
43
43
  <div>Error: ${e.message}</div>
44
44
  </div>
45
- `}});function P(e,t){if(t=v(t),t.debug&&console.log(`[runtime] Debugging component: ${e}`,t),!e||!t.template){t&&typeof t.onError=="function"&&t.onError(new Error("Component requires tag and template"),t.state??{},{state:t.state??{},emit:()=>{},onGlobal:()=>()=>{},offGlobal:()=>{},emitGlobal:()=>{}}),t&&t.debug&&console.error("[runtime] Malformed config:",{tag:e,config:t});return}E.forEach(u=>{try{u.onInit?.(t)}catch(d){t&&typeof t.onError=="function"&&t.onError(d instanceof Error?d:new Error(String(d)),t.state,{state:t.state,emit:()=>{},onGlobal:()=>()=>{},offGlobal:()=>{},emitGlobal:()=>{}}),t&&t.debug&&console.error("[runtime] Plugin onInit error:",d)}});const n=typeof window<"u"&&window.VITE_DEV_HMR,o=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:O&&O.tagName.toUpperCase()==="SCRIPT"&&O.src||new URL("custom-elements-runtime.cjs.js",document.baseURI).href}<"u"&&void 0;if((n||o)&&customElements.get(e))try{document.querySelectorAll(e).forEach(u=>u.remove()),window.customElements._definitions&&delete window.customElements._definitions[e]}catch{}if(customElements.get(e)){t.debug&&console.warn(`[runtime] Component "${e}" already registered`);return}const s=I(t.state??{},t.computed);t.state=s,t._subscribe=s.subscribe;const i=t.state??{},a=Object.keys(i).filter(u=>["string","number","boolean"].includes(typeof i[u]));class c extends J{static get observedAttributes(){return a}constructor(){super()}}const l=c;typeof customElements<"u"&&!customElements.get(e)&&(window.__componentRegistry=window.__componentRegistry||{},window.__componentRegistry[e]=t,customElements.define(e,l))}function gt(e){const t=Y(e);return P("router-view",{template:async()=>{if(!t)return"<div>Router not initialized.</div>";const r=t.getCurrent(),{path:n}=r,o=t.matchRoute(n);return o.route?(o.route.load&&await o.route.load(),`<${o.route.component}></${o.route.component}>`):"<div>Not found</div>"},onMounted(r,n){t&&typeof t.subscribe=="function"&&t.subscribe(()=>{n.render()})}}),P("router-link",{state:{to:"",tag:"a",replace:!1,exact:!1,activeClass:"active",exactActiveClass:"exact-active",ariaCurrentValue:"page",disabled:!1,external:!1,style:U`
45
+ `}});function P(e,t){if(t=v(t),t.debug&&console.log(`[runtime] Debugging component: ${e}`,t),!e||!t.template){t&&typeof t.onError=="function"&&t.onError(new Error("Component requires tag and template"),t.state??{},{state:t.state??{},emit:()=>{},onGlobal:()=>()=>{},offGlobal:()=>{},emitGlobal:()=>{}}),t&&t.debug&&console.error("[runtime] Malformed config:",{tag:e,config:t});return}E.forEach(u=>{try{u.onInit?.(t)}catch(d){t&&typeof t.onError=="function"&&t.onError(d instanceof Error?d:new Error(String(d)),t.state,{state:t.state,emit:()=>{},onGlobal:()=>()=>{},offGlobal:()=>{},emitGlobal:()=>{}}),t&&t.debug&&console.error("[runtime] Plugin onInit error:",d)}});const n=typeof window<"u"&&window.VITE_DEV_HMR,o=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:O&&O.tagName.toUpperCase()==="SCRIPT"&&O.src||new URL("custom-elements-runtime.cjs.js",document.baseURI).href}<"u"&&void 0;if((n||o)&&typeof customElements<"u"&&customElements.get(e))try{document.querySelectorAll(e).forEach(u=>u.remove()),window.customElements._definitions&&delete window.customElements._definitions[e]}catch{}if(typeof customElements<"u"&&customElements.get(e)){t.debug&&console.warn(`[runtime] Component "${e}" already registered`);return}const s=I(t.state??{},t.computed);t.state=s,t._subscribe=s.subscribe;const i=t.state??{},a=Object.keys(i).filter(u=>["string","number","boolean"].includes(typeof i[u]));class c extends J{static get observedAttributes(){return a}constructor(){super()}}const l=c;typeof customElements<"u"&&!customElements.get(e)&&(window.__componentRegistry=window.__componentRegistry||{},window.__componentRegistry[e]=t,customElements.define(e,l))}function gt(e){const t=Y(e);return P("router-view",{template:async()=>{if(!t)return"<div>Router not initialized.</div>";const r=t.getCurrent(),{path:n}=r,o=t.matchRoute(n);return o.route?(o.route.load&&await o.route.load(),`<${o.route.component}></${o.route.component}>`):"<div>Not found</div>"},onMounted(r,n){t&&typeof t.subscribe=="function"&&t.subscribe(()=>{n.render()})}}),P("router-link",{state:{to:"",tag:"a",replace:!1,exact:!1,activeClass:"active",exactActiveClass:"exact-active",ariaCurrentValue:"page",disabled:!1,external:!1,style:U`
46
46
  [aria-disabled="true"] {
47
47
  pointer-events: none;
48
48
  opacity: 0.5;