@aegis-framework/pandora 0.1.7 → 0.3.0
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/LICENSE +1 -1
- package/README.md +746 -27
- package/dist/pandora.browser.js +10 -0
- package/dist/pandora.browser.js.map +14 -0
- package/dist/pandora.js +10 -806
- package/dist/pandora.js.map +13 -1
- package/dist/types/Component.d.ts +266 -0
- package/dist/types/Component.d.ts.map +1 -0
- package/dist/types/Registry.d.ts +276 -0
- package/dist/types/Registry.d.ts.map +1 -0
- package/dist/types/ShadowComponent.d.ts +35 -0
- package/dist/types/ShadowComponent.d.ts.map +1 -0
- package/dist/types/Types.d.ts +9 -0
- package/dist/types/Types.d.ts.map +1 -0
- package/dist/types/Util.d.ts +16 -0
- package/dist/types/Util.d.ts.map +1 -0
- package/dist/types/browser.d.ts +7 -0
- package/dist/types/browser.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +41 -22
- package/dist/pandora.min.js +0 -10
- package/dist/pandora.min.js.map +0 -1
- package/index.js +0 -3
- package/src/Component.js +0 -502
- package/src/Registry.js +0 -74
- package/src/ShadowComponent.js +0 -47
- package/src/Util.js +0 -66
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var D=Object.defineProperty;var E=(x,B)=>{for(var F in B)D(x,F,{get:B[F],enumerable:!0,configurable:!0,set:(G)=>B[F]=()=>G})};var U={};E(U,{Util:()=>N,Types:()=>A,ShadowComponent:()=>f,Registry:()=>R,Component:()=>Z});var N={};E(N,{deserializeCSS:()=>$,callAsync:()=>q});function q(x,B,...F){try{let G=x.apply(B,F);return G instanceof Promise?G:Promise.resolve(G)}catch(G){return Promise.reject(G)}}function $(x,B="",F=0){let G=Object.keys(x),H="";for(let J of G){let X=x[J];if(typeof X==="object"&&X!==null){if(B&&!J.startsWith("@"))if(J.startsWith("&"))H+=`${J.replace(/&/g,B)} {
|
|
2
|
+
`;else H+=`${B} ${J} {
|
|
3
|
+
`;else H+=`${J} {
|
|
4
|
+
`;let _=Object.keys(X);for(let K of _){H+="\t".repeat(F);let W=X[K];if(typeof W==="object"&&W!==null){let Y={};Y[K]=W,H+=$(Y,B,F+1)}else H+=` ${K}: ${W};
|
|
5
|
+
`}H+=`}
|
|
6
|
+
`}else H+="\t".repeat(F),H+=` ${J}: ${X};
|
|
7
|
+
`}return H}class P extends HTMLElement{_children;_state;_props;_ready;_connected;_isReady;_style;_styleElement;static _tag;static _template;static _observedAttributes=[];static _onMount;static _onUnmount;static _onError;static _applyMiddleware;static _hasMiddleware;static get observedAttributes(){return this._observedAttributes}static set observedAttributes(x){this._observedAttributes=x}static get tag(){if(typeof this._tag>"u"){let x=this.name,B=x.match(/([A-Z])/g);if(B!==null)for(let F of B)x=x.replace(F,`-${F}`.toLowerCase());this._tag=x.slice(1)}return this._tag}static set tag(x){this._tag=x}static template(x=null,B=null){if(x!==null)this._template=x,document.querySelectorAll(this.tag).forEach((F)=>{if(F instanceof P&&F._isReady)F.forceRender()});else{if(typeof this._template==="function")return this._template.call(B,B);return this._template}}constructor(){super();this._children=this.innerHTML.trim(),this._state={},this._props={},this._ready=[],this._connected=!1,this._isReady=!1,this._style={},this._styleElement=null}get width(){return parseInt(getComputedStyle(this).width.replace("px",""))}set width(x){this.style.width=typeof x==="number"?`${x}px`:x}get height(){return parseInt(getComputedStyle(this).height.replace("px",""))}set height(x){this.style.height=typeof x==="number"?`${x}px`:x}get static(){return this.constructor}set static(x){throw Error("Component static properties cannot be reassigned.")}get props(){return new Proxy(this._props,{get:(x,B)=>{if(this.hasAttribute(B)){let F=this.getAttribute(B);if(typeof F==="string"){if(F==="false")F=!1;else if(F==="true"||F==="")F=!0;else if(!isNaN(Number(F)))F=F.includes(".")?parseFloat(F):parseInt(F)}return F}else if(B in x)return x[B];return null},set:()=>{throw Error("Component props should be set using the `setProps` function.")}})}set props(x){if(!this._connected)this._props={...this._props,...x};else throw Error("Component props cannot be directly assigned. Use the `setProps` function instead.")}get state(){return new Proxy(this._state,{get:(x,B)=>x[B],set:(x,B,F)=>{if(!this._connected)return x[B]=F,!0;else throw Error("Component state should be set using the `setState` function instead.")}})}set state(x){if(!this._connected)this._state={...this._state,...x};else throw Error("Component state should be set using the `setState` function instead.")}get dom(){return this}set dom(x){throw Error("Component DOM can not be overwritten.")}get isConnected(){return this._connected}get isReady(){return this._isReady}static register(){window.customElements.define(this.tag,this)}template(x=null){return this.constructor.template(x,this)}_createStyleElement(){let x=document.body.querySelector(`style#${this.constructor.tag}`);if(x instanceof HTMLStyleElement)this._styleElement=x;if(this._styleElement instanceof HTMLStyleElement)return;this._styleElement=document.createElement("style"),this._styleElement.id=this.constructor.tag,document.body.prepend(this._styleElement)}setStyle(x,B=!1){if(this._createStyleElement(),typeof x==="object"){if(!B)this._style={...this._style,...x};else this._style={...x};this._styleElement.innerHTML=$(this._style,this.constructor.tag)}else if(typeof x==="string")if(!B)this._styleElement.innerHTML+=x;else this._styleElement.innerHTML=x;return this._style}setState(x){let B=x;if(P._hasMiddleware?.("state")&&P._applyMiddleware)B=P._applyMiddleware("state",this,x);let F={...this._state};this._state={...this._state,...B};for(let G of Object.keys(B))this.updateCallback(G,F[G],this._state[G],"state",F,this._state)}setProps(x){let B=x;if(P._hasMiddleware?.("props")&&P._applyMiddleware)B=P._applyMiddleware("props",this,x);let F={...this._props};this._props={...this._props,...B};for(let G of Object.keys(B))this.updateCallback(G,F[G],this._props[G],"props",F,this._props);this._setPropAttributes(!0)}_setPropAttributes(x=!1){for(let[B,F]of Object.entries(this._props)){let G=typeof F;if(G==="string"||G==="number"||G==="boolean")if(x)this.setAttribute(B,String(F));else this._props[B]=this.props[B],this.setAttribute(B,String(this.props[B]))}}on(x,B,F){return this.addEventListener(x,B,F),this}off(x,B,F){return this.removeEventListener(x,B,F),this}once(x,B,F){let G=typeof F==="boolean"?{capture:F,once:!0}:{...F,once:!0};return this.addEventListener(x,B,G),this}emit(x,B,F){let G=new CustomEvent(x,{detail:B,bubbles:!0,cancelable:!0,composed:!0,...F});return this.dispatchEvent(G)}query(x){return this.dom.querySelector(x)}queryAll(x){return this.dom.querySelectorAll(x)}willUpdate(x,B,F,G,H,J){return Promise.resolve()}update(x,B,F,G,H,J){return Promise.resolve()}didUpdate(x,B,F,G,H,J){return Promise.resolve()}onStateUpdate(x,B,F,G,H){return Promise.resolve()}onPropsUpdate(x,B,F,G,H){return Promise.resolve()}willMount(){return Promise.resolve()}didMount(){return Promise.resolve()}willUnmount(){return Promise.resolve()}unmount(){return Promise.resolve()}didUnmount(){return Promise.resolve()}forceRender(){return this._render()}render(){return""}async _render(){let x=this.render;if(this.constructor._template!==void 0)x=this.template;let B=await q(x,this);if(B=B.trim(),P._hasMiddleware?.("render")&&P._applyMiddleware)B=P._applyMiddleware("render",this,B);if(B==="")return"";let F=this.dom.querySelector("slot");if(F!==null)F.replaceWith(B);else if(this.innerHTML=B,this._children!==""&&B.indexOf(this._children)===-1)this.innerHTML+=this._children;return B}async connectedCallback(){let x=this.static.tag;try{if(this._connected=!0,this.dataset.component=x,typeof this.static._template>"u"){let F=document.querySelector(`template#${x}`);if(F!==null)this.template(F.innerHTML);else this.static._template=void 0}this._setPropAttributes(!1),await this.willMount(),await this._render(),await this.didMount(),this._isReady=!0;let B=[...this._ready];this._ready=[];for(let F of B)F.call(this);if(P._onMount)P._onMount(this,x)}catch(B){if(P._onError)P._onError(B,this,x,"connectedCallback");else throw B}}ready(x){if(this._ready.push(x),this._isReady)x.call(this)}async disconnectedCallback(){let x=this.static.tag;try{if(await this.willUnmount(),await this.unmount(),await this.didUnmount(),this._connected=!1,P._onUnmount)P._onUnmount(this,x)}catch(B){if(P._onError)P._onError(B,this,x,"disconnectedCallback");else throw B}}async updateCallback(x,B,F,G="props",H={},J={}){if(await this.willUpdate(G,x,B,F,H,J),await this.update(G,x,B,F,H,J),G==="state")await this.onStateUpdate(x,B,F,H,J);else if(G==="props"||G==="attribute")await this.onPropsUpdate(x,B,F,H,J);await this.didUpdate(G,x,B,F,H,J)}attributeChangedCallback(x,B,F){if(B!==F)this.updateCallback(x,B,F,"attribute")}}var Z=P;class M extends Z{_shadowDOM;constructor(){super();this._shadowDOM=this.attachShadow({mode:"open"})}setStyle(x,B=!1){if(this._createStyleElement(),typeof x==="object"){if(!B)this._style={...this._style,...x};else this._style={...x};this._styleElement.innerHTML=$(this._style)}else if(typeof x==="string")if(!B)this._styleElement.innerHTML+=x;else this._styleElement.innerHTML=x;return this._style}_createStyleElement(){if(this._styleElement instanceof HTMLStyleElement)return;this._styleElement=document.createElement("style"),this._shadowDOM.prepend(this._styleElement)}async _render(){let x=this.render;if(this.constructor._template!==void 0)x=this.template;let B=await q(x,this),F=Array.from(this._shadowDOM.childNodes);for(let H of F)if(H!==this._styleElement)H.remove();let G=document.createElement("template");return G.innerHTML=B,this._shadowDOM.appendChild(G.content),B}get dom(){throw Error("ShadowComponent DOM can not be accessed. Use the `shadowRoot` property instead.")}set dom(x){throw Error("ShadowComponent DOM can not be overwritten.")}get shadowRoot(){return this._shadowDOM}set shadowRoot(x){throw Error("ShadowComponent shadowRoot can not be overwritten.")}query(x){return this._shadowDOM.querySelector(x)}queryAll(x){return this._shadowDOM.querySelectorAll(x)}}var f=M;class Q{static _debug=!1;static components={};static implementations={};static state={};static subscribers={};static mountCallbacks=new Set;static unmountCallbacks=new Set;static errorCallbacks=new Set;static aliases={};static lazyLoaders={};static middleware={props:new Set,state:new Set,render:new Set};static _initialized=!1;static _init(){if(this._initialized)return;this._initialized=!0,Z._onMount=(x,B)=>this._notifyMount(x,B),Z._onUnmount=(x,B)=>this._notifyUnmount(x,B),Z._onError=(x,B,F,G)=>this._notifyError(x,B,F,G),Z._applyMiddleware=(x,B,F)=>this._applyMiddleware(x,B,F),Z._hasMiddleware=(x)=>this._hasMiddleware(x)}static register(x,B){if(this._init(),typeof this.components[x]>"u")this.components[x]=B,this.implementations[x]=B,B._tag=x,window.customElements.define(x,B),this.components[x]._registered=!0,this.log(`Registered: <${x}>`);else throw Error("A component with this tag has already been registered. Use the evolve() function to modify the component.")}static getImplementation(x){return this.implementations[x]||this.components[x]}static evolve(x,B,F=!1){if(typeof this.components[x]>"u")throw Error("No component with this tag has been registered. Cannot Evolve.");if(this.implementations[x]=B,B._registered=!0,this.log(`Evolved: <${x}>`),F){let G=B.prototype,H=Object.getOwnPropertyNames(G),J=Object.create(G);try{B.call(J)}catch{}document.querySelectorAll(x).forEach((X)=>{if(X instanceof Z&&X.isReady){let _=X;for(let K of H)if(K!=="constructor"&&typeof G[K]==="function"){let W=G[K];_[K]=W.bind(X)}if(J._state){let K=_._state||{},W=J._state;for(let Y of Object.keys(W))if(!(Y in K))K[Y]=W[Y];_._state=K}if(J._props){let K=_._props||{},W=J._props;for(let Y of Object.keys(W))if(!(Y in K))K[Y]=W[Y];_._props=K}X.forceRender()}})}}static instances(x,B){if(typeof this.components[x]<"u")if(typeof B==="function")document.querySelectorAll(x).forEach(B);else return document.querySelectorAll(x);else throw Error("No component with the provided tag has been registered.")}static instantiate(x,B){if(!this.has(x))throw Error(`No component with tag "${x}" has been registered.`);if(!this.components[x]._registered)this.register(x,this.components[x]);let F=document.createElement(this.components[x].tag);return F.setProps(B),F}static has(x){return typeof this.components[x]<"u"}static get(x){return this.components[x]}static setState(x,B){let F=this.state[x];if(this.state[x]=B,this.subscribers[x])this.subscribers[x].forEach((G)=>{G(B,F)})}static getState(x){return this.state[x]}static hasState(x){return x in this.state}static deleteState(x){if(x in this.state){let B=this.state[x];if(delete this.state[x],this.subscribers[x])this.subscribers[x].forEach((F)=>{F(void 0,B)});return!0}return!1}static subscribe(x,B){if(!this.subscribers[x])this.subscribers[x]=new Set;return this.subscribers[x].add(B),()=>{this.unsubscribe(x,B)}}static unsubscribe(x,B){if(this.subscribers[x])this.subscribers[x].delete(B)}static getAllState(){return{...this.state}}static clearState(){let x=Object.keys(this.state);for(let B of x)this.deleteState(B)}static get debug(){return this._debug}static set debug(x){this._debug=x}static log(x,B){if(this._debug)if(B!==void 0)console.log(`[Pandora] ${x}`,B);else console.log(`[Pandora] ${x}`)}static list(){return Object.keys(this.components)}static stats(x){if(x){if(!this.has(x))throw Error(`No component with tag "${x}" has been registered.`);return{tag:x,instanceCount:document.querySelectorAll(x).length,isRegistered:this.components[x]?._registered??!1,isLazy:x in this.lazyLoaders}}return this.list().map((B)=>({tag:B,instanceCount:document.querySelectorAll(B).length,isRegistered:this.components[B]?._registered??!1,isLazy:B in this.lazyLoaders}))}static onMount(x){return this._init(),this.mountCallbacks.add(x),()=>this.mountCallbacks.delete(x)}static onUnmount(x){return this._init(),this.unmountCallbacks.add(x),()=>this.unmountCallbacks.delete(x)}static _notifyMount(x,B){this.log(`Mounted: <${B}>`),this.mountCallbacks.forEach((F)=>{try{F(x,B)}catch(G){console.error("[Pandora] Error in onMount callback:",G)}})}static _notifyUnmount(x,B){this.log(`Unmounted: <${B}>`),this.unmountCallbacks.forEach((F)=>{try{F(x,B)}catch(G){console.error("[Pandora] Error in onUnmount callback:",G)}})}static onError(x){return this._init(),this.errorCallbacks.add(x),()=>this.errorCallbacks.delete(x)}static _notifyError(x,B,F,G){if(this.log(`Error in <${F}> during ${G}:`,x),this.errorCallbacks.size===0)throw x;this.errorCallbacks.forEach((H)=>{try{H(x,B,F,G)}catch(J){console.error("[Pandora] Error in onError callback:",J)}})}static alias(x,B){if(!this.has(B))throw Error(`Cannot create alias: no component with tag "${B}" has been registered.`);if(this.has(x))throw Error(`Cannot create alias: a component with tag "${x}" already exists.`);this.aliases[x]=B;let F=this.components[B],G=class extends F{static _tag=x};this.components[x]=G,window.customElements.define(x,G),this.log(`Created alias: <${x}> -> <${B}>`)}static getOriginalTag(x){return this.aliases[x]}static isAlias(x){return x in this.aliases}static lazy(x,B){if(this._init(),this.has(x))throw Error(`Cannot register lazy component: a component with tag "${x}" already exists.`);this.lazyLoaders[x]=B;let F=Q;class G extends Z{static _tag=x;_lazyLoaded=!1;async connectedCallback(){await F._loadLazyComponent(x);let H=F.getImplementation(x);if(H&&H!==G){let J=H.prototype,X=Object.getOwnPropertyNames(J),_=this;for(let W of X)if(W!=="constructor"&&typeof J[W]==="function"){let Y=J[W];_[W]=Y.bind(this)}let K=Object.create(J);try{H.call(K)}catch{}if(K._state)_._state={...K._state};if(K._props)_._props={...K._props};this._lazyLoaded=!0}await super.connectedCallback()}}this.components[x]=G,window.customElements.define(x,G),this.log(`Registered lazy component: <${x}>`)}static async _loadLazyComponent(x){if(!(x in this.lazyLoaders))return;let B=this.lazyLoaders[x];this.log(`Loading lazy component: <${x}>`);try{let F=await B(),G="default"in F?F.default:F;delete this.lazyLoaders[x],this.implementations[x]=G,G._registered=!0,this.log(`Loaded lazy component: <${x}>`)}catch(F){throw console.error(`[Pandora] Failed to load lazy component <${x}>:`,F),F}}static isLazy(x){return x in this.lazyLoaders}static async preload(x){if(this.isLazy(x))await this._loadLazyComponent(x)}static use(x,B){return this._init(),this.middleware[x].add(B),()=>this.middleware[x].delete(B)}static _applyMiddleware(x,B,F){let G=F;return this.middleware[x].forEach((H)=>{try{G=H(B,G)}catch(J){console.error(`[Pandora] Error in ${x} middleware:`,J)}}),G}static _hasMiddleware(x){return this.middleware[x].size>0}}var R=Q;var A={};if(typeof window==="object")window.Pandora=U;
|
|
8
|
+
|
|
9
|
+
//# debugId=35D63DF32B8B755564756E2164756E21
|
|
10
|
+
//# sourceMappingURL=pandora.browser.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/Util.ts", "../src/Component.ts", "../src/ShadowComponent.ts", "../src/Registry.ts", "../src/browser.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { CSSObject } from './Types';\n\n/**\n * Calls a function asynchronously and returns a Promise with its result\n * @param callable - The function to call\n * @param context - The context (this) to use when calling the function\n * @param args - Additional arguments to pass to the function\n */\nexport function callAsync<T>(callable: (...args: any[]) => T, context: any, ...args: any[]): Promise<T> {\n try {\n const result = callable.apply(context, args);\n return result instanceof Promise ? result : Promise.resolve(result);\n } catch (e) {\n return Promise.reject(e);\n }\n}\n\n/**\n * Converts a CSS object to a CSS string\n * @param object - The CSS object to convert\n * @param encapsulation - Optional selector to encapsulate the CSS\n * @param level - Current nesting level for indentation\n */\nexport function deserializeCSS(object: CSSObject, encapsulation: string = '', level: number = 0): string {\n const keys = Object.keys(object);\n let css = '';\n\n for (const key of keys) {\n const value = object[key];\n\n if (typeof value === 'object' && value !== null) {\n if (encapsulation && !key.startsWith('@')) {\n if (key.startsWith('&')) {\n css += `${key.replace(/&/g, encapsulation)} {\\n`;\n } else {\n css += `${encapsulation} ${key} {\\n`;\n }\n } else {\n css += `${key} {\\n`;\n }\n\n const properties = Object.keys(value);\n for (const property of properties) {\n css += '\\t'.repeat(level);\n const propValue = value[property];\n\n if (typeof propValue === 'object' && propValue !== null) {\n const temp: CSSObject = {};\n temp[property] = propValue;\n css += deserializeCSS(temp, encapsulation, level + 1);\n } else {\n css += `\\t${property}: ${propValue};\\n`;\n }\n }\n css += '}\\n';\n } else {\n css += '\\t'.repeat(level);\n css += `\\t${key}: ${value};\\n`;\n }\n }\n\n return css;\n}",
|
|
6
|
+
"import { callAsync, deserializeCSS } from './Util';\nimport { Properties, Style, ReadyCallback } from './Types';\n\n/**\n * A component represents a custom HTML element, and has all of its functionality\n * as well as its general structure and representation self contained on it.\n *\n * @template P - The type of the component's props (defaults to Properties)\n * @template S - The type of the component's state (defaults to Properties)\n */\nclass Component<P extends Properties = Properties, S extends Properties = Properties> extends HTMLElement {\n protected _children: string;\n protected _state: S;\n protected _props: P;\n protected _ready: ReadyCallback[];\n protected _connected: boolean;\n protected _isReady: boolean;\n protected _style: Style;\n protected _styleElement: HTMLStyleElement | null;\n\n // This is the tag name for the component\n static _tag?: string;\n\n static _template?: string | ((context: any) => string);\n\n // List of attributes to observe for changes\n // https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#responding_to_attribute_changes\n static _observedAttributes: string[] = [];\n\n // Registry integration hooks. These are set by the Registry.\n static _onMount?: (component: Component, tag: string) => void;\n static _onUnmount?: (component: Component, tag: string) => void;\n static _onError?: (error: Error, component: Component, tag: string, lifecycle: string) => void;\n static _applyMiddleware?: (type: string, component: Component, value: any) => any;\n static _hasMiddleware?: (type: string) => boolean;\n\n /**\n * Returns the list of attributes to observe for changes.\n * Override this in subclasses to specify which attributes should trigger attributeChangedCallback.\n *\n * @returns {string[]} - Array of attribute names to observe\n */\n static get observedAttributes(): string[] {\n return this._observedAttributes;\n }\n\n /**\n * Sets the list of attributes to observe for changes.\n *\n * @param value - The new list of attributes to observe\n */\n static set observedAttributes(value: string[]) {\n this._observedAttributes = value;\n }\n\n static get tag(): string {\n if (typeof this._tag === 'undefined') {\n let tag = this.name;\n\n const matches = tag.match(/([A-Z])/g);\n\n if (matches !== null) {\n for (const match of matches) {\n tag = tag.replace(match, `-${match}`.toLowerCase());\n }\n }\n\n this._tag = tag.slice(1);\n }\n\n return this._tag;\n }\n\n static set tag(value: string) {\n this._tag = value;\n }\n\n static template(html: string | ((context: any) => string) | null = null, context: any = null): string | undefined | void {\n if (html !== null) {\n this._template = html;\n\n document.querySelectorAll(this.tag).forEach((instance) => {\n if (instance instanceof Component && instance._isReady) {\n instance.forceRender();\n }\n });\n } else {\n // Check if no parameters were set but the HTML is still a function to be called\n if (typeof this._template === 'function') {\n return this._template.call(context, context);\n }\n\n // If this is reached, the HTML was just a string\n return this._template;\n }\n }\n\n constructor() {\n super();\n\n this._children = this.innerHTML.trim();\n\n // State Object for the component\n this._state = {} as S;\n\n // Props Object for the component\n this._props = {} as P;\n\n // List of callbacks to run once the component has been mounted successfully\n this._ready = [];\n\n // Whether the component is connected to the DOM\n this._connected = false;\n this._isReady = false;\n\n // Style Object for the component\n this._style = {};\n this._styleElement = null;\n }\n\n // Determines the real (computed) width of the element\n get width(): number {\n return parseInt(getComputedStyle(this).width.replace('px', ''));\n }\n\n set width(value: number | string) {\n this.style.width = typeof value === 'number' ? `${value}px` : value;\n }\n\n // Determines the real (computed) height of the element\n get height(): number {\n return parseInt(getComputedStyle(this).height.replace('px', ''));\n }\n\n set height(value: number | string) {\n this.style.height = typeof value === 'number' ? `${value}px` : value;\n }\n\n get static(): typeof Component {\n return this.constructor as typeof Component;\n }\n\n set static(value: typeof Component) {\n throw new Error('Component static properties cannot be reassigned.');\n }\n\n get props(): P {\n return new Proxy(this._props, {\n get: (target, key: string) => {\n if (this.hasAttribute(key)) {\n let value: any = this.getAttribute(key);\n\n if (typeof value === 'string') {\n if (value === 'false') {\n value = false;\n } else if (value === 'true' || value === '') {\n value = true;\n } else if (!isNaN(Number(value))) {\n value = value.includes('.') ? parseFloat(value) : parseInt(value);\n }\n }\n\n return value;\n } else if (key in target) {\n return target[key as keyof P];\n }\n\n return null;\n },\n set: () => {\n throw new Error('Component props should be set using the `setProps` function.');\n }\n }) as P;\n }\n\n set props(value: P) {\n if (!this._connected) {\n this._props = { ...this._props, ...value };\n } else {\n throw new Error('Component props cannot be directly assigned. Use the `setProps` function instead.');\n }\n }\n\n get state(): S {\n return new Proxy(this._state, {\n get: (target, key: string) => target[key as keyof S],\n set: (target, key: string, value) => {\n if (!this._connected) {\n (target as any)[key] = value;\n return true;\n } else {\n throw new Error('Component state should be set using the `setState` function instead.');\n }\n }\n }) as S;\n }\n\n set state(value: S) {\n if (!this._connected) {\n this._state = { ...this._state, ...value };\n } else {\n throw new Error('Component state should be set using the `setState` function instead.');\n }\n }\n\n get dom(): HTMLElement {\n return this;\n }\n\n set dom(value: HTMLElement) {\n throw new Error('Component DOM can not be overwritten.');\n }\n\n /**\n * Returns whether the component is currently connected to the DOM.\n */\n get isConnected(): boolean {\n return this._connected;\n }\n\n /**\n * Returns whether the component has completed its initial mount cycle.\n */\n get isReady(): boolean {\n return this._isReady;\n }\n\n /**\n\t * register - Register the component as a custom HTML element\n\t * using the component's tag as the actual element tag.\n\t *\n\t * This action cannot be reverted nor the controller class for\n\t * the element can be changed.\n\t */\n static register(): void {\n window.customElements.define(this.tag, this);\n }\n\n /**\n\t * template - A simple function providing access to the basic HTML\n\t * structure of the component.\n\t *\n\t * @param {function|string} html - A string or function that renders the\n\t * component into a valid HTML structure.\n\t *\n\t * @returns {void|string} - Void or the HTML structure in a string\n\t */\n template(html: string | ((context: any) => string) | null = null): string | undefined | void {\n return (this.constructor as typeof Component).template(html, this);\n }\n\n protected _createStyleElement(): void {\n // Check if there is a shared style element for the component\n const sharedStyle = document.body.querySelector(`style#${(this.constructor as typeof Component).tag}`);\n\n // If there is, use it\n if (sharedStyle instanceof HTMLStyleElement) {\n this._styleElement = sharedStyle;\n }\n\n if (this._styleElement instanceof HTMLStyleElement) {\n return;\n }\n\n // If there is no shared style element, create a new one\n this._styleElement = document.createElement('style');\n this._styleElement.id = (this.constructor as typeof Component).tag;\n\n // For normal components, the style element is added to the body\n document.body.prepend(this._styleElement);\n }\n\n setStyle(style: Style | string, reset: boolean = false): Style {\n this._createStyleElement();\n\n if (typeof style === 'object') {\n if (!reset) {\n this._style = { ...this._style, ...style };\n } else {\n this._style = { ...style };\n }\n\n this._styleElement!.innerHTML = deserializeCSS(this._style, (this.constructor as typeof Component).tag);\n } else if (typeof style === 'string') {\n if (!reset) {\n this._styleElement!.innerHTML += style;\n } else {\n this._styleElement!.innerHTML = style;\n }\n }\n\n return this._style;\n }\n\n setState(state: Partial<S>): void {\n // Apply middleware if available\n let processedState = state;\n\n if (Component._hasMiddleware?.('state') && Component._applyMiddleware) {\n processedState = Component._applyMiddleware('state', this, state);\n }\n\n const oldState = { ...this._state };\n this._state = { ...this._state, ...processedState };\n\n for (const key of Object.keys(processedState)) {\n this.updateCallback(key, oldState[key as keyof S], this._state[key as keyof S], 'state', oldState, this._state);\n }\n }\n\n setProps(props: Partial<P>): void {\n // Apply middleware if available\n let processedProps = props;\n\n if (Component._hasMiddleware?.('props') && Component._applyMiddleware) {\n processedProps = Component._applyMiddleware('props', this, props);\n }\n\n const oldProps = { ...this._props };\n this._props = { ...this._props, ...processedProps };\n\n for (const key of Object.keys(processedProps)) {\n this.updateCallback(key, oldProps[key as keyof P], this._props[key as keyof P], 'props', oldProps, this._props);\n }\n\n this._setPropAttributes(true);\n }\n\n protected _setPropAttributes(update: boolean = false): void {\n for (const [key, value] of Object.entries(this._props)) {\n const valueType = typeof value;\n\n if (valueType === 'string' || valueType === 'number' || valueType === 'boolean') {\n if (update) {\n this.setAttribute(key, String(value));\n } else {\n (this._props as Record<string, unknown>)[key] = this.props[key as keyof P];\n this.setAttribute(key, String(this.props[key as keyof P]));\n }\n }\n }\n }\n\n /*\n * =========================\n * Event Helpers\n * =========================\n */\n\n /**\n * Adds an event listener to the component.\n *\n * @param event - The event type to listen for\n * @param callback - The callback function to execute when the event occurs\n * @param options - Optional event listener options\n * @returns The component instance for chaining\n */\n on<K extends keyof HTMLElementEventMap>(\n event: K,\n callback: (this: this, ev: HTMLElementEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n ): this;\n on(event: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;\n on(event: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this {\n this.addEventListener(event, callback, options);\n return this;\n }\n\n /**\n * Removes an event listener from the component.\n *\n * @param event - The event type to remove the listener for\n * @param callback - The callback function to remove\n * @param options - Optional event listener options\n * @returns The component instance for chaining\n */\n off<K extends keyof HTMLElementEventMap>(\n event: K,\n callback: (this: this, ev: HTMLElementEventMap[K]) => any,\n options?: boolean | EventListenerOptions\n ): this;\n off(event: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): this;\n off(event: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): this {\n this.removeEventListener(event, callback, options);\n return this;\n }\n\n /**\n * Adds a one-time event listener that removes itself after the first trigger.\n *\n * @param event - The event type to listen for\n * @param callback - The callback function to execute when the event occurs\n * @param options - Optional event listener options\n * @returns The component instance for chaining\n */\n once<K extends keyof HTMLElementEventMap>(\n event: K,\n callback: (this: this, ev: HTMLElementEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n ): this;\n once(event: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;\n once(event: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this {\n const opts = typeof options === 'boolean' ? { capture: options, once: true } : { ...options, once: true };\n this.addEventListener(event, callback, opts);\n return this;\n }\n\n /**\n * Emits a custom event from the component.\n *\n * @param event - The event name to emit\n * @param detail - Optional data to include with the event\n * @param options - Optional CustomEvent init options (bubbles, cancelable, composed)\n * @returns Whether the event was not cancelled\n */\n emit<T = unknown>(event: string, detail?: T, options?: Omit<CustomEventInit<T>, 'detail'>): boolean {\n const customEvent = new CustomEvent(event, {\n detail,\n bubbles: true,\n cancelable: true,\n composed: true,\n ...options\n });\n return this.dispatchEvent(customEvent);\n }\n\n /*\n * =========================\n * Query Helpers\n * =========================\n */\n\n /**\n * Queries for a single element within the component's DOM.\n *\n * @param selector - CSS selector to query for\n * @returns The first matching element or null\n */\n query<E extends Element = Element>(selector: string): E | null {\n return this.dom.querySelector<E>(selector);\n }\n\n /**\n * Queries for all matching elements within the component's DOM.\n *\n * @param selector - CSS selector to query for\n * @returns A NodeList of all matching elements\n */\n queryAll<E extends Element = Element>(selector: string): NodeListOf<E> {\n return this.dom.querySelectorAll<E>(selector);\n }\n\n /*\n * =========================\n * Update Cycle\n * =========================\n */\n\n /**\n * Called before the component updates due to state or props changes.\n * Override this method to perform actions before an update occurs.\n *\n * @param origin - Whether the update was triggered by 'state' or 'props'\n * @param property - The name of the property that changed\n * @param oldValue - The previous value of the property\n * @param newValue - The new value of the property\n * @param oldObject - The previous state/props object\n * @param newObject - The new state/props object\n * @returns A promise that resolves when the pre-update logic completes\n */\n protected willUpdate(origin: string, property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called when the component updates due to state or props changes.\n * Override this method to perform actions during an update.\n *\n * @param origin - Whether the update was triggered by 'state' or 'props'\n * @param property - The name of the property that changed\n * @param oldValue - The previous value of the property\n * @param newValue - The new value of the property\n * @param oldObject - The previous state/props object\n * @param newObject - The new state/props object\n * @returns A promise that resolves when the update logic completes\n */\n protected update(origin: string, property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called after the component updates due to state or props changes.\n * Override this method to perform actions after an update completes.\n *\n * @param origin - Whether the update was triggered by 'state' or 'props'\n * @param property - The name of the property that changed\n * @param oldValue - The previous value of the property\n * @param newValue - The new value of the property\n * @param oldObject - The previous state/props object\n * @param newObject - The new state/props object\n * @returns A promise that resolves when the post-update logic completes\n */\n protected didUpdate(origin: string, property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called when the component's state updates.\n * Override this method to react specifically to state changes.\n *\n * @param property - The name of the state property that changed\n * @param oldValue - The previous value of the property\n * @param newValue - The new value of the property\n * @param oldObject - The previous state object\n * @param newObject - The new state object\n * @returns A promise that resolves when the state update logic completes\n */\n protected onStateUpdate(property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called when the component's props update.\n * Override this method to react specifically to props changes.\n *\n * @param property - The name of the prop that changed\n * @param oldValue - The previous value of the property\n * @param newValue - The new value of the property\n * @param oldObject - The previous props object\n * @param newObject - The new props object\n * @returns A promise that resolves when the props update logic completes\n */\n protected onPropsUpdate(property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void> {\n return Promise.resolve();\n }\n\n /*\n * =========================\n * Mount Cycle\n * =========================\n */\n\n /**\n * Called before the component is mounted to the DOM.\n * Override this method to perform setup before rendering.\n *\n * @returns A promise that resolves when the pre-mount logic completes\n */\n protected willMount(): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called after the component is mounted to the DOM.\n * Override this method to perform actions after the component is rendered.\n *\n * @returns A promise that resolves when the post-mount logic completes\n */\n protected didMount(): Promise<void> {\n return Promise.resolve();\n }\n\n /*\n * =========================\n * Unmount Cycle\n * =========================\n */\n\n /**\n * Called before the component is removed from the DOM.\n * Override this method to perform cleanup before unmounting.\n *\n * @returns A promise that resolves when the pre-unmount logic completes\n */\n protected willUnmount(): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called when the component is being removed from the DOM.\n * Override this method to perform cleanup during unmounting.\n *\n * @returns A promise that resolves when the unmount logic completes\n */\n protected unmount(): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called after the component is removed from the DOM.\n * Override this method to perform final cleanup after unmounting.\n *\n * @returns A promise that resolves when the post-unmount logic completes\n */\n protected didUnmount(): Promise<void> {\n return Promise.resolve();\n }\n\n /*\n * =========================\n * Render Cycle\n * =========================\n */\n\n /**\n * Forces the component to be rendered again.\n *\n * @returns A promise that resolves with the rendered HTML string\n */\n forceRender(): string | Promise<string> {\n return this._render();\n }\n\n /**\n * Returns the HTML content for the component.\n * Override this method to define the component's template.\n *\n * @returns The HTML string to render\n */\n render(): string {\n return '';\n }\n\n protected async _render(): Promise<string> {\n let render = this.render;\n\n if ((this.constructor as typeof Component)._template !== undefined) {\n render = this.template as () => string;\n }\n\n let html = await callAsync<string>(render, this);\n\n html = html.trim();\n\n // Apply render middleware if available\n if (Component._hasMiddleware?.('render') && Component._applyMiddleware) {\n html = Component._applyMiddleware('render', this, html);\n }\n\n if (html === '') {\n return '';\n }\n\n const slot = this.dom.querySelector('slot');\n\n if (slot !== null) {\n slot.replaceWith(html);\n } else {\n this.innerHTML = html;\n\n if (this._children !== '' && html.indexOf(this._children) === -1) {\n this.innerHTML += this._children;\n }\n }\n\n return html;\n }\n\n async connectedCallback(): Promise<void> {\n const tag = this.static.tag;\n\n try {\n // Set the state as connected\n this._connected = true;\n\n // Add a data property with the tag of the component\n this.dataset.component = tag;\n\n // Check if a template for this component was set. The contents on this\n // if block will only be run once.\n if (typeof this.static._template === 'undefined') {\n\n // Check if there is an HTML template for this component\n const template = document.querySelector(`template#${tag}`);\n\n if (template !== null) {\n // If there is, set is as the template for the component\n this.template(template.innerHTML);\n } else {\n // If not, set is as null\n this.static._template = undefined;\n }\n }\n\n // Set the initial prop attributes for the component using the given props\n this._setPropAttributes(false);\n\n // Run the Mount Cycle\n await this.willMount();\n await this._render();\n await this.didMount();\n\n // Set the component as ready\n this._isReady = true;\n\n // Execute and clear ready callbacks\n const callbacks = [...this._ready];\n this._ready = [];\n\n for (const callback of callbacks) {\n callback.call(this);\n }\n\n // Notify Registry of mount\n if (Component._onMount) {\n Component._onMount(this, tag);\n }\n\n } catch (error) {\n if (Component._onError) {\n Component._onError(error as Error, this, tag, 'connectedCallback');\n } else {\n throw error;\n }\n }\n }\n\n ready(callback: ReadyCallback): void {\n this._ready.push(callback);\n\n if (this._isReady) {\n callback.call(this);\n }\n }\n\n async disconnectedCallback(): Promise<void> {\n const tag = this.static.tag;\n\n try {\n // Run the Unmount Cycle\n await this.willUnmount();\n await this.unmount();\n await this.didUnmount();\n\n // Set the state as disconnected\n this._connected = false;\n\n // Notify Registry of unmount\n if (Component._onUnmount) {\n Component._onUnmount(this, tag);\n }\n\n } catch (error) {\n if (Component._onError) {\n Component._onError(error as Error, this, tag, 'disconnectedCallback');\n } else {\n throw error;\n }\n }\n }\n\n protected async updateCallback(\n property: string,\n oldValue: unknown,\n newValue: unknown,\n origin: 'props' | 'state' | 'attribute' = 'props',\n oldObject: P | S = {} as P | S,\n newObject: P | S = {} as P | S\n ): Promise<void> {\n await this.willUpdate(origin, property, oldValue, newValue, oldObject, newObject);\n await this.update(origin, property, oldValue, newValue, oldObject, newObject);\n\n if (origin === 'state') {\n await this.onStateUpdate(property, oldValue, newValue, oldObject, newObject);\n } else if (origin === 'props' || origin === 'attribute') {\n await this.onPropsUpdate(property, oldValue, newValue, oldObject, newObject);\n }\n\n await this.didUpdate(origin, property, oldValue, newValue, oldObject, newObject);\n }\n\n /**\n * Called when an observed attribute changes.\n * This is a Web Components lifecycle callback.\n *\n * @param property - The name of the attribute that changed\n * @param oldValue - The previous value of the attribute\n * @param newValue - The new value of the attribute\n */\n attributeChangedCallback(property: string, oldValue: string | null, newValue: string | null): void {\n if (oldValue !== newValue) {\n this.updateCallback(property, oldValue, newValue, 'attribute');\n }\n }\n}\n\nexport default Component;",
|
|
7
|
+
"import Component from './Component';\nimport { callAsync, deserializeCSS } from './Util';\nimport { Properties, Style } from './Types';\n\n/**\n * A component that uses Shadow DOM for encapsulation\n *\n * @template P - The type of the component's props (defaults to Properties)\n * @template S - The type of the component's state (defaults to Properties)\n */\nclass ShadowComponent<P extends Properties = Properties, S extends Properties = Properties> extends Component<P, S> {\n protected _shadowDOM: ShadowRoot;\n\n constructor() {\n super();\n\n // Create the shadow DOM for the component\n this._shadowDOM = this.attachShadow({ mode: 'open' });\n }\n\n setStyle(style: Style | string, reset: boolean = false): Style {\n this._createStyleElement();\n\n if (typeof style === 'object') {\n if (!reset) {\n this._style = { ...this._style, ...style };\n } else {\n this._style = { ...style };\n }\n\n this._styleElement!.innerHTML = deserializeCSS(this._style);\n } else if (typeof style === 'string') {\n if (!reset) {\n this._styleElement!.innerHTML += style;\n } else {\n this._styleElement!.innerHTML = style;\n }\n }\n\n return this._style;\n }\n\n protected _createStyleElement(): void {\n if (this._styleElement instanceof HTMLStyleElement) {\n return;\n }\n\n this._styleElement = document.createElement('style');\n this._shadowDOM.prepend(this._styleElement);\n }\n\n protected async _render(): Promise<string> {\n let render = this.render;\n\n // Check if a template has been set to this component, and if that's the\n // case, use that instead of the render function to render the component's\n // HTML code.\n if ((this.constructor as typeof Component)._template !== undefined) {\n render = this.template as () => string;\n }\n\n // Call the render function asynchronously and set the HTML from it to the\n // component.\n const html = await callAsync(render, this);\n\n // Remove all children except the style element\n const children = Array.from(this._shadowDOM.childNodes);\n for (const child of children) {\n if (child !== this._styleElement) {\n child.remove();\n }\n }\n\n // Create a template to parse the HTML and append the content\n const template = document.createElement('template');\n template.innerHTML = html;\n\n this._shadowDOM.appendChild(template.content);\n\n return html;\n }\n\n get dom(): HTMLElement {\n throw new Error('ShadowComponent DOM can not be accessed. Use the `shadowRoot` property instead.');\n }\n\n set dom(value: HTMLElement) {\n throw new Error('ShadowComponent DOM can not be overwritten.');\n }\n\n get shadowRoot(): ShadowRoot {\n return this._shadowDOM;\n }\n\n set shadowRoot(value: ShadowRoot) {\n throw new Error('ShadowComponent shadowRoot can not be overwritten.');\n }\n\n /**\n * Queries for a single element within the shadow DOM.\n *\n * @param selector - CSS selector to query for\n * @returns The first matching element or null\n */\n override query<E extends Element = Element>(selector: string): E | null {\n return this._shadowDOM.querySelector<E>(selector);\n }\n\n /**\n * Queries for all matching elements within the shadow DOM.\n *\n * @param selector - CSS selector to query for\n * @returns A NodeList of all matching elements\n */\n override queryAll<E extends Element = Element>(selector: string): NodeListOf<E> {\n return this._shadowDOM.querySelectorAll<E>(selector);\n }\n}\n\nexport default ShadowComponent;",
|
|
8
|
+
"import Component from './Component';\n\ntype ComponentClass = typeof Component & {\n tag: string;\n _registered?: boolean;\n};\n\ntype StateSubscriber<T = unknown> = (newValue: T, oldValue: T | undefined) => void;\ntype LifecycleCallback = (component: Component, tag: string) => void;\ntype ErrorCallback = (error: Error, component: Component, tag: string, lifecycle: string) => void;\ntype MiddlewareType = 'props' | 'state' | 'render';\ntype Middleware = (component: Component, value: any) => any;\ntype ComponentLoader = () => Promise<ComponentClass | { default: ComponentClass }>;\n\ninterface ComponentStats {\n tag: string;\n instanceCount: number;\n isRegistered: boolean;\n isLazy: boolean;\n}\n\n/**\n * Registry for managing web components and global state\n */\nclass Registry {\n // We won't show logs by default\n private static _debug: boolean = false;\n\n private static components: Record<string, ComponentClass> = {};\n\n private static implementations: Record<string, ComponentClass> = {};\n\n private static state: Record<string, unknown> = {};\n private static subscribers: Record<string, Set<StateSubscriber>> = {};\n\n private static mountCallbacks: Set<LifecycleCallback> = new Set();\n private static unmountCallbacks: Set<LifecycleCallback> = new Set();\n private static errorCallbacks: Set<ErrorCallback> = new Set();\n private static aliases: Record<string, string> = {};\n private static lazyLoaders: Record<string, ComponentLoader> = {};\n\n private static middleware: Record<MiddlewareType, Set<Middleware>> = {\n props: new Set(),\n state: new Set(),\n render: new Set()\n };\n\n private static _initialized = false;\n\n /**\n * Initialize Registry hooks on the Component class. Called automatically on first use\n */\n private static _init(): void {\n if (this._initialized) return;\n this._initialized = true;\n\n // Set up Component hooks\n Component._onMount = (component, tag) => this._notifyMount(component, tag);\n Component._onUnmount = (component, tag) => this._notifyUnmount(component, tag);\n Component._onError = (error, component, tag, lifecycle) => this._notifyError(error, component, tag, lifecycle);\n Component._applyMiddleware = (type, component, value) => this._applyMiddleware(type as MiddlewareType, component, value);\n Component._hasMiddleware = (type) => this._hasMiddleware(type as MiddlewareType);\n }\n\n /**\n * Register a new component with a specific tag name\n *\n * @param tag - The tag name for the component\n * @param component - The component constructor\n */\n static register(tag: string, component: ComponentClass): void {\n this._init();\n\n if (typeof this.components[tag] === 'undefined') {\n this.components[tag] = component;\n this.implementations[tag] = component;\n component._tag = tag;\n\n window.customElements.define(tag, component);\n\n this.components[tag]._registered = true;\n this.log(`Registered: <${tag}>`);\n } else {\n throw new Error('A component with this tag has already been registered. Use the evolve() function to modify the component.');\n }\n }\n\n /**\n * Get the current implementation for a tag\n *\n * @internal\n */\n static getImplementation(tag: string): ComponentClass | undefined {\n return this.implementations[tag] || this.components[tag];\n }\n\n /**\n * Update an existing component with a new implementation\n *\n * @param tag - The tag name of the component to update\n * @param component - The new component constructor\n * @param rerender - Whether to re-render all existing instances (default: false)\n */\n static evolve(tag: string, component: ComponentClass, rerender: boolean = false): void {\n if (typeof this.components[tag] === 'undefined') {\n throw new Error('No component with this tag has been registered. Cannot Evolve.');\n }\n\n // Store the new implementation\n this.implementations[tag] = component;\n component._registered = true;\n\n this.log(`Evolved: <${tag}>`);\n\n // Update all existing instances with the new implementation\n if (rerender) {\n const proto = component.prototype as unknown as Record<string, unknown>;\n const protoMethods = Object.getOwnPropertyNames(proto);\n\n // Create a temporary instance to get default state/props. This avoids calling\n // the constructor's side effects\n const tempInstance = Object.create(proto);\n\n try {\n component.call(tempInstance);\n } catch {\n // Just skip state/props merging if the constructor fails\n }\n\n document.querySelectorAll(tag).forEach((instance) => {\n if (instance instanceof Component && (instance as Component).isReady) {\n const inst = instance as unknown as Record<string, unknown>;\n\n // Copy all prototype methods from the new component to the instance\n for (const method of protoMethods) {\n if (method !== 'constructor' && typeof proto[method] === 'function') {\n const fn = proto[method] as (...args: unknown[]) => unknown;\n inst[method] = fn.bind(instance);\n }\n }\n\n // Merge new default state properties\n if (tempInstance._state) {\n const existingState = inst._state as Record<string, unknown> || {};\n const newDefaults = tempInstance._state as Record<string, unknown>;\n for (const key of Object.keys(newDefaults)) {\n if (!(key in existingState)) {\n existingState[key] = newDefaults[key];\n }\n }\n inst._state = existingState;\n }\n\n // Merge new default props properties\n if (tempInstance._props) {\n const existingProps = inst._props as Record<string, unknown> || {};\n const newDefaults = tempInstance._props as Record<string, unknown>;\n for (const key of Object.keys(newDefaults)) {\n if (!(key in existingProps)) {\n existingProps[key] = newDefaults[key];\n }\n }\n inst._props = existingProps;\n }\n\n // _connected, _isReady, _ready are preserved as we do want to keep\n // the state of the component on those.\n\n (instance as Component).forceRender();\n }\n });\n }\n }\n\n /**\n * Get all instances of a component or execute a callback on them\n *\n * @param tag - The tag name of the component\n * @param callback - Optional callback to execute on each instance\n */\n static instances(tag: string, callback?: (instance: Element) => void): NodeListOf<Element> | void {\n if (typeof this.components[tag] !== 'undefined') {\n if (typeof callback === 'function') {\n document.querySelectorAll(tag).forEach(callback);\n } else {\n return document.querySelectorAll(tag);\n }\n } else {\n throw new Error('No component with the provided tag has been registered.');\n }\n }\n\n /**\n * Create a new instance of a component\n *\n * @param tag - The tag name of the component\n * @param props - Properties to set on the component\n * @returns The created component instance\n */\n static instantiate(tag: string, props: Record<string, any>): Component {\n if (!this.has(tag)) {\n throw new Error(`No component with tag \"${tag}\" has been registered.`);\n }\n\n if (!this.components[tag]._registered) {\n this.register(tag, this.components[tag]);\n }\n\n const element = document.createElement(this.components[tag].tag) as Component;\n\n element.setProps(props);\n\n return element;\n }\n\n /**\n * Check if a component is registered with the given tag\n *\n * @param tag - The tag name to check\n * @returns True if a component is registered with the tag\n */\n static has(tag: string): boolean {\n return typeof this.components[tag] !== 'undefined';\n }\n\n /**\n * Get the component class registered with the given tag\n *\n * @param tag - The tag name of the component\n * @returns The component class or undefined if not registered\n */\n static get(tag: string): ComponentClass | undefined {\n return this.components[tag];\n }\n\n /*\n * =========================\n * Global State Management\n * =========================\n */\n\n /**\n * Set a global state value\n *\n * @param key - The state key\n * @param value - The value to set\n */\n static setState<T>(key: string, value: T): void {\n const oldValue = this.state[key] as T | undefined;\n this.state[key] = value;\n\n // Notify subscribers\n if (this.subscribers[key]) {\n this.subscribers[key].forEach((callback) => {\n callback(value, oldValue);\n });\n }\n }\n\n /**\n * Get a global state value\n *\n * @param key - The state key\n * @returns The state value or undefined if not set\n */\n static getState<T>(key: string): T | undefined {\n return this.state[key] as T | undefined;\n }\n\n /**\n * Check if a global state key exists\n *\n * @param key - The state key to check\n * @returns True if the state key exists\n */\n static hasState(key: string): boolean {\n return key in this.state;\n }\n\n /**\n * Delete a global state value\n *\n * @param key - The state key to delete\n * @returns True if the key existed and was deleted\n */\n static deleteState(key: string): boolean {\n if (key in this.state) {\n const oldValue = this.state[key];\n delete this.state[key];\n\n // Notify subscribers with undefined as new value\n if (this.subscribers[key]) {\n this.subscribers[key].forEach((callback) => {\n callback(undefined, oldValue);\n });\n }\n\n return true;\n }\n\n return false;\n }\n\n /**\n * Subscribe to changes on a global state key\n *\n * @param key - The state key to subscribe to\n * @param callback - Function called when the state changes\n * @returns An unsubscribe function\n */\n static subscribe<T>(key: string, callback: StateSubscriber<T>): () => void {\n if (!this.subscribers[key]) {\n this.subscribers[key] = new Set();\n }\n\n this.subscribers[key].add(callback as StateSubscriber);\n\n // Return unsubscribe function\n return () => {\n this.unsubscribe(key, callback);\n };\n }\n\n /**\n * Unsubscribe from changes on a global state key\n *\n * @param key - The state key to unsubscribe from\n * @param callback - The callback function to remove\n */\n static unsubscribe<T>(key: string, callback: StateSubscriber<T>): void {\n if (this.subscribers[key]) {\n this.subscribers[key].delete(callback as StateSubscriber);\n }\n }\n\n /**\n * Get all global state as an object\n *\n * @returns A copy of the global state object\n */\n static getAllState(): Record<string, unknown> {\n return { ...this.state };\n }\n\n /**\n * Clear all global state and notify subscribers\n */\n static clearState(): void {\n const keys = Object.keys(this.state);\n\n for (const key of keys) {\n this.deleteState(key);\n }\n }\n\n /*\n * =========================\n * Debugging Tools\n * =========================\n */\n\n /**\n * Enable or disable debug mode.\n * When enabled, lifecycle events are logged to the console.\n */\n static get debug(): boolean {\n return this._debug;\n }\n\n static set debug(value: boolean) {\n this._debug = value;\n }\n\n /**\n * Log a debug message if debug mode is enabled\n *\n * @param message - The message to log\n * @param data - Optional data to include\n */\n static log(message: string, data?: unknown): void {\n if (this._debug) {\n if (data !== undefined) {\n console.log(`[Pandora] ${message}`, data);\n } else {\n console.log(`[Pandora] ${message}`);\n }\n }\n }\n\n /**\n * List all registered component tags\n *\n * @returns Array of registered component tag names\n */\n static list(): string[] {\n return Object.keys(this.components);\n }\n\n /**\n * Get statistics for a specific component or all components\n *\n * @param tag - Optional tag to get stats for a specific component\n * @returns Component stats or array of all component stats\n */\n static stats(tag?: string): ComponentStats | ComponentStats[] {\n if (tag) {\n if (!this.has(tag)) {\n throw new Error(`No component with tag \"${tag}\" has been registered.`);\n }\n\n return {\n tag,\n instanceCount: document.querySelectorAll(tag).length,\n isRegistered: this.components[tag]?._registered ?? false,\n isLazy: tag in this.lazyLoaders\n };\n }\n\n return this.list().map((tag) => ({\n tag: tag,\n instanceCount: document.querySelectorAll(tag).length,\n isRegistered: this.components[tag]?._registered ?? false,\n isLazy: tag in this.lazyLoaders\n }));\n }\n\n /*\n * =========================\n * Global Lifecycle Hooks\n * =========================\n */\n\n /**\n * Register a callback to be called when any component mounts\n *\n * @param callback - Function called with (component, tag) when a component mounts\n * @returns Unsubscribe function\n */\n static onMount(callback: LifecycleCallback): () => void {\n this._init();\n this.mountCallbacks.add(callback);\n\n return () => this.mountCallbacks.delete(callback);\n }\n\n /**\n * Register a callback to be called when any component unmounts\n *\n * @param callback - Function called with (component, tag) when a component unmounts\n * @returns Unsubscribe function\n */\n static onUnmount(callback: LifecycleCallback): () => void {\n this._init();\n this.unmountCallbacks.add(callback);\n\n return () => this.unmountCallbacks.delete(callback);\n }\n\n /**\n * Notify Registry that a component has mounted\n * @internal\n */\n static _notifyMount(component: Component, tag: string): void {\n this.log(`Mounted: <${tag}>`);\n this.mountCallbacks.forEach((callback) => {\n try {\n callback(component, tag);\n } catch (error) {\n console.error('[Pandora] Error in onMount callback:', error);\n }\n });\n }\n\n /**\n * Notify Registry that a component has unmounted\n *\n * @internal\n */\n static _notifyUnmount(component: Component, tag: string): void {\n this.log(`Unmounted: <${tag}>`);\n this.unmountCallbacks.forEach((callback) => {\n try {\n callback(component, tag);\n } catch (error) {\n console.error('[Pandora] Error in onUnmount callback:', error);\n }\n });\n }\n\n /*\n * =========================\n * Error Boundaries\n * =========================\n */\n\n /**\n * Register a global error handler for component errors\n *\n * @param callback - Function called with (error, component, tag, lifecycle) when an error occurs\n * @returns Unsubscribe function\n */\n static onError(callback: ErrorCallback): () => void {\n this._init();\n this.errorCallbacks.add(callback);\n\n return () => this.errorCallbacks.delete(callback);\n }\n\n /**\n * Notify Registry that an error occurred in a component\n *\n * @internal\n */\n static _notifyError(error: Error, component: Component, tag: string, lifecycle: string): void {\n this.log(`Error in <${tag}> during ${lifecycle}:`, error);\n\n if (this.errorCallbacks.size === 0) {\n // No error handlers registered, re-throw\n throw error;\n }\n\n this.errorCallbacks.forEach((callback) => {\n try {\n callback(error, component, tag, lifecycle);\n } catch (callbackError) {\n console.error('[Pandora] Error in onError callback:', callbackError);\n }\n });\n }\n\n /*\n * =========================\n * Component Aliases\n * =========================\n */\n\n /**\n * Create an alias for an existing component tag\n *\n * @param aliasTag - The new tag name to use as an alias\n * @param originalTag - The original component tag name\n */\n static alias(aliasTag: string, originalTag: string): void {\n if (!this.has(originalTag)) {\n throw new Error(`Cannot create alias: no component with tag \"${originalTag}\" has been registered.`);\n }\n\n if (this.has(aliasTag)) {\n throw new Error(`Cannot create alias: a component with tag \"${aliasTag}\" already exists.`);\n }\n\n this.aliases[aliasTag] = originalTag;\n\n // Create a subclass that inherits from the original component\n const OriginalClass = this.components[originalTag];\n\n // Create a subclass with a different tag\n const AliasClass = class extends (OriginalClass as typeof Component) {\n static _tag = aliasTag;\n };\n\n this.components[aliasTag] = AliasClass as unknown as ComponentClass;\n window.customElements.define(aliasTag, AliasClass);\n\n this.log(`Created alias: <${aliasTag}> -> <${originalTag}>`);\n }\n\n /**\n * Get the original tag for an alias\n *\n * @param aliasTag - The alias tag name\n * @returns The original tag name or undefined if not an alias\n */\n static getOriginalTag(aliasTag: string): string | undefined {\n return this.aliases[aliasTag];\n }\n\n /**\n * Check if a tag is an alias\n *\n * @param tag - The tag name to check\n * @returns True if the tag is an alias\n */\n static isAlias(tag: string): boolean {\n return tag in this.aliases;\n }\n\n /*\n * =========================\n * Lazy Loading\n * =========================\n */\n\n /**\n * Register a component to be lazily loaded on first use\n *\n * @param tag - The tag name for the component\n * @param loader - Async function that returns the component class\n */\n static lazy(tag: string, loader: ComponentLoader): void {\n this._init();\n\n if (this.has(tag)) {\n throw new Error(`Cannot register lazy component: a component with tag \"${tag}\" already exists.`);\n }\n\n this.lazyLoaders[tag] = loader;\n\n // Store reference to Registry for use in the class\n const registry = Registry;\n\n // Create a placeholder class that will load and delegate to the real component\n class LazyComponent extends Component {\n static _tag = tag;\n private _lazyLoaded = false;\n\n async connectedCallback(): Promise<void> {\n // Load the real component on first mount\n await registry._loadLazyComponent(tag);\n\n // Get the loaded implementation\n const RealComponent = registry.getImplementation(tag);\n if (RealComponent && RealComponent !== LazyComponent) {\n const proto = RealComponent.prototype as unknown as Record<string, unknown>;\n const protoMethods = Object.getOwnPropertyNames(proto);\n const inst = this as unknown as Record<string, unknown>;\n\n // Copy prototype methods from the real component to this instance\n for (const method of protoMethods) {\n if (method !== 'constructor' && typeof proto[method] === 'function') {\n const fn = proto[method] as (...args: unknown[]) => unknown;\n inst[method] = fn.bind(this);\n }\n }\n\n // Get default state/props from the real component\n const tempInstance = Object.create(proto);\n\n try {\n RealComponent.call(tempInstance);\n } catch {\n // If constructor fails, skip state/props initialization\n }\n\n // Apply default state from real component\n if (tempInstance._state) {\n inst._state = { ...(tempInstance._state as object) };\n }\n\n // Apply default props from real component\n if (tempInstance._props) {\n inst._props = { ...(tempInstance._props as object) };\n }\n\n this._lazyLoaded = true;\n }\n\n // Now run the normal connected callback\n await super.connectedCallback();\n }\n }\n\n this.components[tag] = LazyComponent as unknown as ComponentClass;\n window.customElements.define(tag, LazyComponent);\n this.log(`Registered lazy component: <${tag}>`);\n }\n\n /**\n * Load a lazy component\n *\n * @internal\n */\n static async _loadLazyComponent(tag: string): Promise<void> {\n if (!(tag in this.lazyLoaders)) {\n return;\n }\n\n const loader = this.lazyLoaders[tag];\n this.log(`Loading lazy component: <${tag}>`);\n\n try {\n const result = await loader();\n const componentClass = 'default' in result ? result.default : result;\n\n // Remove from lazy loaders\n delete this.lazyLoaders[tag];\n\n // Store as the implementation\n this.implementations[tag] = componentClass;\n componentClass._registered = true;\n\n this.log(`Loaded lazy component: <${tag}>`);\n } catch (error) {\n console.error(`[Pandora] Failed to load lazy component <${tag}>:`, error);\n throw error;\n }\n }\n\n /**\n * Check if a component is lazy (not yet loaded)\n *\n * @param tag - The tag name to check\n * @returns True if the component is registered as lazy and not yet loaded\n */\n static isLazy(tag: string): boolean {\n return tag in this.lazyLoaders;\n }\n\n /**\n * Preload a lazy component without mounting it\n *\n * @param tag - The tag name of the lazy component to preload\n */\n static async preload(tag: string): Promise<void> {\n if (this.isLazy(tag)) {\n await this._loadLazyComponent(tag);\n }\n }\n\n /*\n * =========================\n * Middleware\n * =========================\n */\n\n /**\n * Register middleware to intercept props, state, or render operations\n *\n * @param type - The type of middleware: 'props', 'state', or 'render'\n * @param middleware - Function that receives (component, value) and returns the modified value\n * @returns Unsubscribe function\n */\n static use(type: MiddlewareType, middleware: Middleware): () => void {\n this._init();\n this.middleware[type].add(middleware);\n\n return () => this.middleware[type].delete(middleware);\n }\n\n /**\n * Apply middleware to a value\n *\n * @internal\n */\n static _applyMiddleware(type: MiddlewareType, component: Component, value: any): any {\n let result = value;\n\n this.middleware[type].forEach((middleware) => {\n try {\n result = middleware(component, result);\n } catch (error) {\n console.error(`[Pandora] Error in ${type} middleware:`, error);\n }\n });\n\n return result;\n }\n\n /**\n * Check if there are any middleware registered for a type\n *\n * @internal\n */\n static _hasMiddleware(type: MiddlewareType): boolean {\n return this.middleware[type].size > 0;\n }\n}\n\nexport default Registry;",
|
|
9
|
+
"// This file is basically just a hack to expose the Pandora namespace in the\n// window object. Once/if bun adds support for this, we can remove this file.\n\nimport * as Pandora from './index';\n\ndeclare global {\n interface Window {\n Pandora: typeof Pandora;\n }\n}\n\nif (typeof window === 'object') {\n window.Pandora = Pandora;\n}"
|
|
10
|
+
],
|
|
11
|
+
"mappings": "+QAQO,SAAS,CAAY,CAAC,EAAiC,KAAiB,EAAyB,CACtG,GAAI,CACF,IAAM,EAAS,EAAS,MAAM,EAAS,CAAI,EAC3C,OAAO,aAAkB,QAAU,EAAS,QAAQ,QAAQ,CAAM,EAClE,MAAO,EAAG,CACV,OAAO,QAAQ,OAAO,CAAC,GAUpB,SAAS,CAAc,CAAC,EAAmB,EAAwB,GAAI,EAAgB,EAAW,CACvG,IAAM,EAAO,OAAO,KAAK,CAAM,EAC3B,EAAM,GAEV,QAAW,KAAO,EAAM,CACtB,IAAM,EAAQ,EAAO,GAErB,GAAI,OAAO,IAAU,UAAY,IAAU,KAAM,CAC/C,GAAI,GAAiB,CAAC,EAAI,WAAW,GAAG,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