@twobirds/microcomponents 0.10.0 → 0.10.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.
Files changed (39) hide show
  1. package/dist/MC.min.js +1 -1
  2. package/dist/autoload.min.js +1 -1
  3. package/dist/cli/index.js +18 -22
  4. package/dist/cli/inliner.d.ts +8 -5
  5. package/dist/cli/inliner.d.ts.map +1 -1
  6. package/dist/core/MC.d.ts +98 -50
  7. package/dist/core/MC.d.ts.map +1 -1
  8. package/dist/core/elements.js +134 -76
  9. package/dist/core/index.d.ts +5 -4
  10. package/dist/core/index.d.ts.map +1 -1
  11. package/dist/docs/api-external.d.ts +101 -0
  12. package/dist/docs/api-external.d.ts.map +1 -0
  13. package/dist/docs/cli.d.ts +115 -0
  14. package/dist/docs/cli.d.ts.map +1 -0
  15. package/dist/docs/concepts.d.ts +42 -0
  16. package/dist/docs/concepts.d.ts.map +1 -0
  17. package/dist/docs/installation.d.ts +74 -0
  18. package/dist/docs/installation.d.ts.map +1 -0
  19. package/dist/docs/mcp.d.ts +45 -0
  20. package/dist/docs/mcp.d.ts.map +1 -0
  21. package/dist/elements.min.js +1 -1
  22. package/dist/formValues.min.js +1 -1
  23. package/dist/mcp/api.json +325 -29
  24. package/dist/mcp/concepts/event-system.md +1 -1
  25. package/dist/mcp/index.js +13 -6
  26. package/dist/microcomponents.js +145 -82
  27. package/dist/microcomponents.min.js +1 -1
  28. package/dist/observables.min.js +1 -1
  29. package/dist/state/formValues.d.ts +3 -3
  30. package/dist/state/formValues.js +139 -81
  31. package/dist/state/index.d.ts +3 -0
  32. package/dist/state/index.d.ts.map +1 -1
  33. package/dist/state/observables.d.ts +2 -2
  34. package/dist/state/observables.js +136 -78
  35. package/dist/types/index.d.ts +1 -0
  36. package/dist/types/index.d.ts.map +1 -1
  37. package/dist/utils/helpers.d.ts +12 -0
  38. package/dist/utils/helpers.d.ts.map +1 -1
  39. package/package.json +7 -3
package/dist/MC.min.js CHANGED
@@ -1 +1 @@
1
- function e(e,t){let n=t.toLowerCase();return`on`+n in e?n:`_mc`+t[0].toUpperCase()+t.substring(1)}function t(n,r,i){if(n){if(typeof n==`string`){document.querySelectorAll(n).forEach(e=>t(e,r,i));return}n.removeEventListener(e(n,r),i)}}function n(t,r,i,a=!1){if(t){if(typeof t==`string`){document.querySelectorAll(t).forEach(e=>n(e,r,i));return}return t.addEventListener(e(t,r),i,{capture:!1,once:a}),i}}function r(e,t,i){if(e){if(typeof e==`string`){document.querySelectorAll(e).forEach(e=>r(e,t,i));return}return n(e,t,i,!0),i}}var i=class{stopped=!1;constructor(){}stop(){this.stopped=!0}};function a(t,n,r={},o=`l`,s){if(!t)return;if(typeof t==`string`){document.querySelectorAll(t).forEach(e=>a(e,n,r,o));return}let c=/^_mc/.test(n)?n:e(t,n),l=s||new i,u=new CustomEvent(c,{detail:{data:r,control:l},bubbles:!1});l.stopped||/l/.test(o)&&(t.dispatchEvent(u),l.stopped)||/[ud]/.test(o)&&queueMicrotask(()=>{if(o.indexOf(`u`)>-1&&a(t.parentElement,c,r,`lu`,l),o.indexOf(`d`)>-1)for(let e of t.children)a(e,c,r,`ld`)})}var o=new WeakMap;function s(e,t){let n=o.get(e)??new Set;if(n.has(t))return e.adoptedStyleSheets[0];n.add(t),o.set(e,n);let r=new CSSStyleSheet;return r.replaceSync(t),e.adoptedStyleSheets.push(r),r}function c(e,t){let n=e.target,r=n.shadowRoot;!r&&Object.keys(t).some(e=>e.indexOf(`shadow`)===0)&&(r=n.attachShadow({mode:`open`})),Object.keys(t).forEach(i=>{switch(i){case`css`:s(document,t[i]);break;case`targetCss`:s(document,t[i]);break;case`shadowCss`:s(r,t[i]);break;case`shadowHtml`:r.innerHTML=t[i],u(r,e);break;case`targetHtml`:n.innerHTML=t[i],u(n,e);break}})}function l(e,t){let n=t=>{let n=t.match(/^([a-z]+)([A-Z][a-z]*)$/);return n?`./${e.replace(/-/g,`/`)}.${n[1]}.${n[2].toLowerCase()}`:`./${e.replace(/-/g,`/`)}.${t.toLowerCase()}`};return Promise.all(t.map(async e=>{let t=n(e);try{let n=await fetch(t);if(!n.ok)return`file not found: ${t}`;if(t.endsWith(`json`)){let r=await n.text();try{return JSON.parse(r)}catch{return console.error(`could not JSON.parse() asset '${e}' from ${t}:\n`,r),null}}return n.text()}catch{return`file not found: ${t}`}}))}function u(e,t){let r=[...e.querySelectorAll(`*`)];for(let e of r){if(!(e instanceof HTMLElement))continue;let r=[...e.attributes];for(let i of r){let r=i.name.toLowerCase();if(!(`on`+r in e))continue;let o=i.value.trim().split(`|`);if(o.length<2)continue;let[s,c,l]=o;e.removeAttribute(i.name);let u;if(l)try{u=JSON.parse(l)}catch{u=l}s===`this`||s===``?n(e,r,()=>t.trigger(c,u)):n(e,r,()=>a(s,c,u))}}}function d(e,t){return typeof HTMLElement<`u`&&e instanceof HTMLElement&&`_mc`in e&&(t===void 0||t in e._mc)}function f(e,t,n={}){let r=e;`_mc`in e||(r._mc=new b(e));let i=r._mc;return t.length&&!i[t]&&(i[t]=n,e instanceof HTMLElement&&!e.getAttribute(`data-mc`)&&e.setAttribute(`data-mc`,``)),r}function p(e,t){if(!t)return;let n=e._mc;n&&(n[t]&&delete n[t],!Object.keys(n).length&&e instanceof HTMLElement&&e.hasAttribute(`data-mc`)&&e.removeAttribute(`data-mc`))}function m(e){queueMicrotask(()=>{e.trigger(`Init`,null)})}function h(e){let t=e.target,r=Object.getPrototypeOf(e),i=e,a=Object.getOwnPropertyNames(r).filter(e=>/^(on[A-Z]|one[A-Z])/.test(e)&&typeof r[e]==`function`);for(let e of a){let r=/^one/.test(e);n(t,e.replace(/^one?/,``),t=>i[e](t),r)}}function g(e){return Array.from(e.querySelectorAll(`[data-mc]:not(:scope [data-mc] [data-mc])`)).filter(e=>e instanceof HTMLElement&&`_mc`in e).map(e=>e._mc)}function _(e,t){let n=e.parentElement?.closest(`[data-mc]`);for(;n instanceof HTMLElement;){if(`_mc`in n){let e=n._mc;if(t===void 0||t in e)return e}n=n.parentElement?.closest(`[data-mc]`)}return null}var v=class{_target;constructor(e){if(this._target=new WeakRef(e||{}),this instanceof b&&this.constructor!==b){h(this);let e=this.constructor.tag;(e===void 0||e.toUpperCase()===this.target.tagName)&&m(this)}}get target(){return this._target.deref()}},y=class extends v{constructor(e){super(e)}},b=class e extends v{static tag;static _assets={};static assets=[];static _assetsPromise;static attributes={};constructor(t){super(t);let n=this.constructor;if(n===e)return;let r=this.target.tagName.toLowerCase();if(n.tag!==void 0&&r!==n.tag&&n.tag!==``){let t=document.createElement(n.tag);t.classList.add(r),n._originalTag=r,e.add(t,n.name,new n(t)),delete n._originalTag,r.includes(`-`)&&!this.target.isConnected?this.on(`connected`,()=>this.target.replaceWith(t)):this.target.replaceWith(t);return}let i=n.attributes;n.attributes&&Object.keys(n.attributes).forEach(e=>{this.target.setAttribute(e,i[e])});let a=this,o=n.assets.filter(e=>!n._assets[e]);if(Object.keys(n._assets).length&&c(this,n._assets),o.length?(n._assetsPromise||=l(n._originalTag||r,o).then(e=>{let t={};o.forEach((n,r)=>{t[n]=e[r]}),n._assets=Object.assign({},n._assets,t);for(let e of[`css`,`targetCss`])t[e]!==void 0&&delete n._assets[e];return n.assets=n.assets.filter(e=>e!==`css`&&e!==`targetCss`),t}),n._assetsPromise.then(e=>{c(this,e),a.trigger(`assets`,n._assets)})):[...Object.keys(n._assets)].length&&queueMicrotask(()=>a.trigger(`assets`,n._assets)),n.tag===``){this.target.remove();return}}getAssets(){return this.constructor._assets||{}}static add(e,t,n={}){return f(e,t,n)}static remove(e,t){p(e,t)}static get(e,t,n){if(!d(e))return;let r=e._mc[t];return r instanceof n?r:void 0}off(e,n){t(this.target,e,n)}on(e,t){return n(this.target,e,t)}one(e,t){return r(this.target,e,t)}trigger(e,t={},n=`l`,r){a(this.target,e,t,n,r)}ancestors(e){let t=[],n=_(this.target,e);for(;n;)t.push(n),n=_(n.target,e);return t}closest(e){return _(this.target,e)}children(e){let t=g(this.target);return e===void 0?t:t.filter(t=>e in t)}descendants(e){return Array.from(this.target.querySelectorAll(`[data-mc]`)).filter(e=>e instanceof HTMLElement&&`_mc`in e).map(e=>e._mc).filter(t=>e===void 0||e in t)}};export{b as DC,y as MC,v as McBase,d as isMcHost};
1
+ function e(e,t){let n=t.toLowerCase();return`on`+n in e?n:`_mc`+t[0].toUpperCase()+t.substring(1)}function t(n,r,i){if(n){if(typeof n==`string`){document.querySelectorAll(n).forEach(e=>t(e,r,i));return}n.removeEventListener(e(n,r),i)}}function n(t,r,i,a=!1){if(t){if(typeof t==`string`){document.querySelectorAll(t).forEach(e=>n(e,r,i));return}return t.addEventListener(e(t,r),i,{capture:!1,once:a}),i}}function r(e,t,i){if(e){if(typeof e==`string`){document.querySelectorAll(e).forEach(e=>r(e,t,i));return}return n(e,t,i,!0),i}}var i=class{stopped=!1;constructor(){}stop(){this.stopped=!0}};function a(t,n,r={},o=`l`,s){if(!t)return;if(typeof t==`string`){document.querySelectorAll(t).forEach(e=>a(e,n,r,o));return}let c=/^_mc/.test(n)?n:e(t,n),l=s||new i,u=new CustomEvent(c,{detail:{data:r,control:l},bubbles:!1});l.stopped||/l/.test(o)&&(t.dispatchEvent(u),l.stopped)||/[ud]/.test(o)&&queueMicrotask(()=>{if(o.indexOf(`u`)>-1&&a(t.parentElement,c,r,`lu`,l),o.indexOf(`d`)>-1)for(let e of t.children)a(e,c,r,`ld`)})}function o(e){return e.replace(/[A-Z]/g,(e,t)=>(t?`-`:``)+e.toLowerCase())}var s=new WeakMap;function c(e,t){let n=s.get(e)??new Set;if(n.has(t))return e.adoptedStyleSheets[0];n.add(t),s.set(e,n);let r=new CSSStyleSheet;return r.replaceSync(t),e.adoptedStyleSheets.push(r),r}function l(e,t){let n=e.target,r=n.shadowRoot;!r&&Object.keys(t).some(e=>e.indexOf(`shadow`)===0)&&(r=n.attachShadow({mode:`open`})),Object.keys(t).forEach(i=>{switch(i){case`css`:c(document,t[i]);break;case`targetCss`:c(document,t[i]);break;case`shadowCss`:c(r,t[i]);break;case`shadowHtml`:r.innerHTML=t[i],d(r,e);break;case`targetHtml`:n.innerHTML=t[i],d(n,e);break}})}function u(e,t){let n=t=>{let n=t.match(/^([a-z]+)([A-Z][a-z]*)$/);return n?`./${e.replace(/-/g,`/`)}.${n[1]}.${n[2].toLowerCase()}`:`./${e.replace(/-/g,`/`)}.${t.toLowerCase()}`};return Promise.all(t.map(async e=>{let t=n(e);try{let n=await fetch(t);if(!n.ok)return`file not found: ${t}`;if(t.endsWith(`json`)){let r=await n.text();try{return JSON.parse(r)}catch{return console.error(`could not JSON.parse() asset '${e}' from ${t}:\n`,r),null}}return n.text()}catch{return`file not found: ${t}`}}))}function d(e,t){let r=[...e.querySelectorAll(`*`)];for(let e of r){if(!(e instanceof HTMLElement))continue;let r=[...e.attributes];for(let i of r){let r=i.name.toLowerCase();if(!(`on`+r in e))continue;let o=i.value.trim().split(`|`);if(o.length<2)continue;let[s,c,l]=o;e.removeAttribute(i.name);let u;if(l)try{u=JSON.parse(l)}catch{u=l}s===`this`||s===``?n(e,r,()=>t.trigger(c,u)):n(e,r,()=>a(s,c,u))}}}function f(e,t){return typeof HTMLElement<`u`&&e instanceof HTMLElement&&`_mc`in e&&(t===void 0||t in e._mc)}function p(e,t,n={}){let r=e;`_mc`in e||(r._mc=new x(e));let i=r._mc;return t.length&&!i[t]&&(i[t]=n,e instanceof HTMLElement&&!e.getAttribute(`data-mc`)&&e.setAttribute(`data-mc`,``)),r}function m(e,t){if(!t)return;let n=e._mc;n&&(n[t]&&delete n[t],!Object.keys(n).length&&e instanceof HTMLElement&&e.hasAttribute(`data-mc`)&&e.removeAttribute(`data-mc`))}function h(e){queueMicrotask(()=>{e.trigger(`Init`,null)})}function g(e){let t=e.target,r=Object.getPrototypeOf(e),i=e,a=Object.getOwnPropertyNames(r).filter(e=>/^(on[A-Z]|one[A-Z])/.test(e)&&typeof r[e]==`function`);for(let e of a){let r=/^one/.test(e);n(t,e.replace(/^one?/,``),t=>i[e](t),r)}}function _(e){return Array.from(e.querySelectorAll(`[data-mc]:not(:scope [data-mc] [data-mc])`)).filter(e=>e instanceof HTMLElement&&`_mc`in e).map(e=>e._mc)}function v(e,t){let n=e.parentElement?.closest(`[data-mc]`);for(;n instanceof HTMLElement;){if(`_mc`in n){let e=n._mc;if(t===void 0||t in e)return e}n=n.parentElement?.closest(`[data-mc]`)}return null}var y=class{_target;static _assets={};static assets=[];static _assetsPromise;constructor(e){this._target=new WeakRef(e||{});let t=this.constructor;this instanceof x&&this.constructor!==x&&g(this);let n=(t.assets??[]).filter(e=>!t._assets[e]);n.length&&!t._assetsPromise&&(t._assetsPromise=u(t._originalTag||(this instanceof x?this.target.tagName.toLowerCase():o(t.name)),n).then(e=>{let r={};return n.forEach((t,n)=>{r[t]=e[n]}),t._assets=Object.assign({},t._assets,r),r}))}get target(){return this._target.deref()}get assets(){return this.constructor._assets||{}}},b=class extends y{constructor(e){super(e)}},x=class e extends y{static tag;static attributes={};constructor(t){super(t);let n=this.constructor;if(n===e)return;let r=this.target.tagName.toLowerCase();if(n.tag!==void 0&&r!==n.tag&&n.tag!==``){let t=document.createElement(n.tag);t.classList.add(r),n._originalTag=r,e.add(t,n.name,new n(t)),delete n._originalTag,r.includes(`-`)&&!this.target.isConnected?this.on(`connected`,()=>this.target.replaceWith(t)):this.target.replaceWith(t);return}let i=n.attributes;if(n.attributes&&Object.keys(n.attributes).forEach(e=>{this.target.setAttribute(e,i[e])}),Object.keys(n._assets).length){l(this,n._assets);for(let e of[`css`,`targetCss`])delete n._assets[e];n.assets=n.assets.filter(e=>e!==`css`&&e!==`targetCss`)}if(n._assetsPromise?n._assetsPromise.then(e=>{l(this,e);for(let e of[`css`,`targetCss`])delete n._assets[e];n.assets=n.assets.filter(e=>e!==`css`&&e!==`targetCss`),h(this)}):h(this),n.tag===``){this.target.remove();return}}static add(e,t,n={}){return p(e,t,n)}static remove(e,t){m(e,t)}static get(e,t,n){if(!f(e))return;let r=e._mc[t];return r instanceof n?r:void 0}off(e,n){t(this.target,e,n)}on(e,t){return n(this.target,e,t)}one(e,t){return r(this.target,e,t)}trigger(e,t={},n=`l`,r){a(this.target,e,t,n,r)}ancestors(e){let t=[],n=v(this.target,e);for(;n;)t.push(n),n=v(n.target,e);return t}closest(e){return v(this.target,e)}children(e){let t=_(this.target);return e===void 0?t:t.filter(t=>e in t)}descendants(e){return Array.from(this.target.querySelectorAll(`[data-mc]`)).filter(e=>e instanceof HTMLElement&&`_mc`in e).map(e=>e._mc).filter(t=>e===void 0||e in t)}};export{x as DC,b as MC,y as McBase,f as isMcHost};
@@ -1 +1 @@
1
- function e(e,t){let n=t.toLowerCase();return`on`+n in e?n:`_mc`+t[0].toUpperCase()+t.substring(1)}function t(n,r,i){if(n){if(typeof n==`string`){document.querySelectorAll(n).forEach(e=>t(e,r,i));return}n.removeEventListener(e(n,r),i)}}function n(t,r,i,a=!1){if(t){if(typeof t==`string`){document.querySelectorAll(t).forEach(e=>n(e,r,i));return}return t.addEventListener(e(t,r),i,{capture:!1,once:a}),i}}function r(e,t,i){if(e){if(typeof e==`string`){document.querySelectorAll(e).forEach(e=>r(e,t,i));return}return n(e,t,i,!0),i}}var i=class{stopped=!1;constructor(){}stop(){this.stopped=!0}};function a(t,n,r={},o=`l`,s){if(!t)return;if(typeof t==`string`){document.querySelectorAll(t).forEach(e=>a(e,n,r,o));return}let c=/^_mc/.test(n)?n:e(t,n),l=s||new i,u=new CustomEvent(c,{detail:{data:r,control:l},bubbles:!1});l.stopped||/l/.test(o)&&(t.dispatchEvent(u),l.stopped)||/[ud]/.test(o)&&queueMicrotask(()=>{if(o.indexOf(`u`)>-1&&a(t.parentElement,c,r,`lu`,l),o.indexOf(`d`)>-1)for(let e of t.children)a(e,c,r,`ld`)})}var o=new WeakMap;function s(e,t){let n=o.get(e)??new Set;if(n.has(t))return e.adoptedStyleSheets[0];n.add(t),o.set(e,n);let r=new CSSStyleSheet;return r.replaceSync(t),e.adoptedStyleSheets.push(r),r}function c(e,t){let n=e.target,r=n.shadowRoot;!r&&Object.keys(t).some(e=>e.indexOf(`shadow`)===0)&&(r=n.attachShadow({mode:`open`})),Object.keys(t).forEach(i=>{switch(i){case`css`:s(document,t[i]);break;case`targetCss`:s(document,t[i]);break;case`shadowCss`:s(r,t[i]);break;case`shadowHtml`:r.innerHTML=t[i],u(r,e);break;case`targetHtml`:n.innerHTML=t[i],u(n,e);break}})}function l(e,t){let n=t=>{let n=t.match(/^([a-z]+)([A-Z][a-z]*)$/);return n?`./${e.replace(/-/g,`/`)}.${n[1]}.${n[2].toLowerCase()}`:`./${e.replace(/-/g,`/`)}.${t.toLowerCase()}`};return Promise.all(t.map(async e=>{let t=n(e);try{let n=await fetch(t);if(!n.ok)return`file not found: ${t}`;if(t.endsWith(`json`)){let r=await n.text();try{return JSON.parse(r)}catch{return console.error(`could not JSON.parse() asset '${e}' from ${t}:\n`,r),null}}return n.text()}catch{return`file not found: ${t}`}}))}function u(e,t){let r=[...e.querySelectorAll(`*`)];for(let e of r){if(!(e instanceof HTMLElement))continue;let r=[...e.attributes];for(let i of r){let r=i.name.toLowerCase();if(!(`on`+r in e))continue;let o=i.value.trim().split(`|`);if(o.length<2)continue;let[s,c,l]=o;e.removeAttribute(i.name);let u;if(l)try{u=JSON.parse(l)}catch{u=l}s===`this`||s===``?n(e,r,()=>t.trigger(c,u)):n(e,r,()=>a(s,c,u))}}}function d(e,t){return typeof HTMLElement<`u`&&e instanceof HTMLElement&&`_mc`in e&&(t===void 0||t in e._mc)}function f(e,t,n={}){let r=e;`_mc`in e||(r._mc=new y(e));let i=r._mc;return t.length&&!i[t]&&(i[t]=n,e instanceof HTMLElement&&!e.getAttribute(`data-mc`)&&e.setAttribute(`data-mc`,``)),r}function p(e,t){if(!t)return;let n=e._mc;n&&(n[t]&&delete n[t],!Object.keys(n).length&&e instanceof HTMLElement&&e.hasAttribute(`data-mc`)&&e.removeAttribute(`data-mc`))}function m(e){queueMicrotask(()=>{e.trigger(`Init`,null)})}function h(e){let t=e.target,r=Object.getPrototypeOf(e),i=e,a=Object.getOwnPropertyNames(r).filter(e=>/^(on[A-Z]|one[A-Z])/.test(e)&&typeof r[e]==`function`);for(let e of a){let r=/^one/.test(e);n(t,e.replace(/^one?/,``),t=>i[e](t),r)}}function g(e){return Array.from(e.querySelectorAll(`[data-mc]:not(:scope [data-mc] [data-mc])`)).filter(e=>e instanceof HTMLElement&&`_mc`in e).map(e=>e._mc)}function _(e,t){let n=e.parentElement?.closest(`[data-mc]`);for(;n instanceof HTMLElement;){if(`_mc`in n){let e=n._mc;if(t===void 0||t in e)return e}n=n.parentElement?.closest(`[data-mc]`)}return null}var v=class{_target;constructor(e){if(this._target=new WeakRef(e||{}),this instanceof y&&this.constructor!==y){h(this);let e=this.constructor.tag;(e===void 0||e.toUpperCase()===this.target.tagName)&&m(this)}}get target(){return this._target.deref()}},y=class e extends v{static tag;static _assets={};static assets=[];static _assetsPromise;static attributes={};constructor(t){super(t);let n=this.constructor;if(n===e)return;let r=this.target.tagName.toLowerCase();if(n.tag!==void 0&&r!==n.tag&&n.tag!==``){let t=document.createElement(n.tag);t.classList.add(r),n._originalTag=r,e.add(t,n.name,new n(t)),delete n._originalTag,r.includes(`-`)&&!this.target.isConnected?this.on(`connected`,()=>this.target.replaceWith(t)):this.target.replaceWith(t);return}let i=n.attributes;n.attributes&&Object.keys(n.attributes).forEach(e=>{this.target.setAttribute(e,i[e])});let a=this,o=n.assets.filter(e=>!n._assets[e]);if(Object.keys(n._assets).length&&c(this,n._assets),o.length?(n._assetsPromise||=l(n._originalTag||r,o).then(e=>{let t={};o.forEach((n,r)=>{t[n]=e[r]}),n._assets=Object.assign({},n._assets,t);for(let e of[`css`,`targetCss`])t[e]!==void 0&&delete n._assets[e];return n.assets=n.assets.filter(e=>e!==`css`&&e!==`targetCss`),t}),n._assetsPromise.then(e=>{c(this,e),a.trigger(`assets`,n._assets)})):[...Object.keys(n._assets)].length&&queueMicrotask(()=>a.trigger(`assets`,n._assets)),n.tag===``){this.target.remove();return}}getAssets(){return this.constructor._assets||{}}static add(e,t,n={}){return f(e,t,n)}static remove(e,t){p(e,t)}static get(e,t,n){if(!d(e))return;let r=e._mc[t];return r instanceof n?r:void 0}off(e,n){t(this.target,e,n)}on(e,t){return n(this.target,e,t)}one(e,t){return r(this.target,e,t)}trigger(e,t={},n=`l`,r){a(this.target,e,t,n,r)}ancestors(e){let t=[],n=_(this.target,e);for(;n;)t.push(n),n=_(n.target,e);return t}closest(e){return _(this.target,e)}children(e){let t=g(this.target);return e===void 0?t:t.filter(t=>e in t)}descendants(e){return Array.from(this.target.querySelectorAll(`[data-mc]`)).filter(e=>e instanceof HTMLElement&&`_mc`in e).map(e=>e._mc).filter(t=>e===void 0||e in t)}};function b(e){return e.split(`-`).join(`/`)}function x(e){return`./`+b(e)+`.js`}var S=new Set;function C(e){return()=>{let t=Array.from(document.querySelectorAll(`[data-mc*="${e}"]`)).filter(e=>e instanceof HTMLElement);if(t.length===0)return;let n=customElements.get(e);for(let r of t){try{y.add(r,n.name,new n(r))}catch{if(`create`in n&&typeof n.create==`function`){let e=n.create(r);if(!d(e))throw`create() of Class ${n.name} did not return a McHost.`;e.setAttribute(`data-mc`,r.getAttribute(`data-mc`)??``),r.replaceWith(e),r=e}else throw`Class ${n.name} doesn't have a callable constructor AND class doesn't have a static .create() method.`}let t=r.getAttribute(`data-mc`).split(` `).filter(t=>t!==e&&t!==``).join(` `).trim();r.setAttribute(`data-mc`,t)}}}function w(e){if(S.has(e))return;S.add(e);let t=x(e),n=document.createElement(`script`);n.setAttribute(`src`,t),n.setAttribute(`blocking`,`render`),n.async=!0,n.setAttribute(`type`,`module`),n.setAttribute(`data-name`,e),n.setAttribute(`loading`,``),customElements.whenDefined(e).then(C(e)),n.addEventListener(`load`,t=>{S.delete(e),document.head.querySelector(`script[data-name="${e}"]`)?.remove()}),n.addEventListener(`error`,e=>{console.error(`could not load DC code from`,t)}),document.head.append(n)}function T(){[...document.querySelectorAll(`:not(:defined)`)].filter(e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!S.has(e.tagName.toLowerCase())).forEach(e=>{w(e.tagName.toLowerCase())}),[...document.querySelectorAll(`[data-mc]:not([data-mc=""]`)].filter(e=>!!e).forEach(e=>{(e.getAttribute(`data-mc`)?.split(` `).filter(e=>e!==``))?.forEach(e=>{let t=customElements.get(e);!S.has(e)&&!t?w(e):t&&C(e)()})})}var E=null;function D(e=!0){return e?E?!0:(E=new MutationObserver(T),setTimeout(()=>{E.observe(document.body,{childList:!0,subtree:!0}),T()},5),window.autoload??=D,!0):(E&&=(E.disconnect(),null),!1)}D.state=S;export{D as autoload};
1
+ function e(e,t){let n=t.toLowerCase();return`on`+n in e?n:`_mc`+t[0].toUpperCase()+t.substring(1)}function t(n,r,i){if(n){if(typeof n==`string`){document.querySelectorAll(n).forEach(e=>t(e,r,i));return}n.removeEventListener(e(n,r),i)}}function n(t,r,i,a=!1){if(t){if(typeof t==`string`){document.querySelectorAll(t).forEach(e=>n(e,r,i));return}return t.addEventListener(e(t,r),i,{capture:!1,once:a}),i}}function r(e,t,i){if(e){if(typeof e==`string`){document.querySelectorAll(e).forEach(e=>r(e,t,i));return}return n(e,t,i,!0),i}}var i=class{stopped=!1;constructor(){}stop(){this.stopped=!0}};function a(t,n,r={},o=`l`,s){if(!t)return;if(typeof t==`string`){document.querySelectorAll(t).forEach(e=>a(e,n,r,o));return}let c=/^_mc/.test(n)?n:e(t,n),l=s||new i,u=new CustomEvent(c,{detail:{data:r,control:l},bubbles:!1});l.stopped||/l/.test(o)&&(t.dispatchEvent(u),l.stopped)||/[ud]/.test(o)&&queueMicrotask(()=>{if(o.indexOf(`u`)>-1&&a(t.parentElement,c,r,`lu`,l),o.indexOf(`d`)>-1)for(let e of t.children)a(e,c,r,`ld`)})}function o(e){return e.replace(/[A-Z]/g,(e,t)=>(t?`-`:``)+e.toLowerCase())}var s=new WeakMap;function c(e,t){let n=s.get(e)??new Set;if(n.has(t))return e.adoptedStyleSheets[0];n.add(t),s.set(e,n);let r=new CSSStyleSheet;return r.replaceSync(t),e.adoptedStyleSheets.push(r),r}function l(e,t){let n=e.target,r=n.shadowRoot;!r&&Object.keys(t).some(e=>e.indexOf(`shadow`)===0)&&(r=n.attachShadow({mode:`open`})),Object.keys(t).forEach(i=>{switch(i){case`css`:c(document,t[i]);break;case`targetCss`:c(document,t[i]);break;case`shadowCss`:c(r,t[i]);break;case`shadowHtml`:r.innerHTML=t[i],d(r,e);break;case`targetHtml`:n.innerHTML=t[i],d(n,e);break}})}function u(e,t){let n=t=>{let n=t.match(/^([a-z]+)([A-Z][a-z]*)$/);return n?`./${e.replace(/-/g,`/`)}.${n[1]}.${n[2].toLowerCase()}`:`./${e.replace(/-/g,`/`)}.${t.toLowerCase()}`};return Promise.all(t.map(async e=>{let t=n(e);try{let n=await fetch(t);if(!n.ok)return`file not found: ${t}`;if(t.endsWith(`json`)){let r=await n.text();try{return JSON.parse(r)}catch{return console.error(`could not JSON.parse() asset '${e}' from ${t}:\n`,r),null}}return n.text()}catch{return`file not found: ${t}`}}))}function d(e,t){let r=[...e.querySelectorAll(`*`)];for(let e of r){if(!(e instanceof HTMLElement))continue;let r=[...e.attributes];for(let i of r){let r=i.name.toLowerCase();if(!(`on`+r in e))continue;let o=i.value.trim().split(`|`);if(o.length<2)continue;let[s,c,l]=o;e.removeAttribute(i.name);let u;if(l)try{u=JSON.parse(l)}catch{u=l}s===`this`||s===``?n(e,r,()=>t.trigger(c,u)):n(e,r,()=>a(s,c,u))}}}function f(e,t){return typeof HTMLElement<`u`&&e instanceof HTMLElement&&`_mc`in e&&(t===void 0||t in e._mc)}function p(e,t,n={}){let r=e;`_mc`in e||(r._mc=new b(e));let i=r._mc;return t.length&&!i[t]&&(i[t]=n,e instanceof HTMLElement&&!e.getAttribute(`data-mc`)&&e.setAttribute(`data-mc`,``)),r}function m(e,t){if(!t)return;let n=e._mc;n&&(n[t]&&delete n[t],!Object.keys(n).length&&e instanceof HTMLElement&&e.hasAttribute(`data-mc`)&&e.removeAttribute(`data-mc`))}function h(e){queueMicrotask(()=>{e.trigger(`Init`,null)})}function g(e){let t=e.target,r=Object.getPrototypeOf(e),i=e,a=Object.getOwnPropertyNames(r).filter(e=>/^(on[A-Z]|one[A-Z])/.test(e)&&typeof r[e]==`function`);for(let e of a){let r=/^one/.test(e);n(t,e.replace(/^one?/,``),t=>i[e](t),r)}}function _(e){return Array.from(e.querySelectorAll(`[data-mc]:not(:scope [data-mc] [data-mc])`)).filter(e=>e instanceof HTMLElement&&`_mc`in e).map(e=>e._mc)}function v(e,t){let n=e.parentElement?.closest(`[data-mc]`);for(;n instanceof HTMLElement;){if(`_mc`in n){let e=n._mc;if(t===void 0||t in e)return e}n=n.parentElement?.closest(`[data-mc]`)}return null}var y=class{_target;static _assets={};static assets=[];static _assetsPromise;constructor(e){this._target=new WeakRef(e||{});let t=this.constructor;this instanceof b&&this.constructor!==b&&g(this);let n=(t.assets??[]).filter(e=>!t._assets[e]);n.length&&!t._assetsPromise&&(t._assetsPromise=u(t._originalTag||(this instanceof b?this.target.tagName.toLowerCase():o(t.name)),n).then(e=>{let r={};return n.forEach((t,n)=>{r[t]=e[n]}),t._assets=Object.assign({},t._assets,r),r}))}get target(){return this._target.deref()}get assets(){return this.constructor._assets||{}}},b=class e extends y{static tag;static attributes={};constructor(t){super(t);let n=this.constructor;if(n===e)return;let r=this.target.tagName.toLowerCase();if(n.tag!==void 0&&r!==n.tag&&n.tag!==``){let t=document.createElement(n.tag);t.classList.add(r),n._originalTag=r,e.add(t,n.name,new n(t)),delete n._originalTag,r.includes(`-`)&&!this.target.isConnected?this.on(`connected`,()=>this.target.replaceWith(t)):this.target.replaceWith(t);return}let i=n.attributes;if(n.attributes&&Object.keys(n.attributes).forEach(e=>{this.target.setAttribute(e,i[e])}),Object.keys(n._assets).length){l(this,n._assets);for(let e of[`css`,`targetCss`])delete n._assets[e];n.assets=n.assets.filter(e=>e!==`css`&&e!==`targetCss`)}if(n._assetsPromise?n._assetsPromise.then(e=>{l(this,e);for(let e of[`css`,`targetCss`])delete n._assets[e];n.assets=n.assets.filter(e=>e!==`css`&&e!==`targetCss`),h(this)}):h(this),n.tag===``){this.target.remove();return}}static add(e,t,n={}){return p(e,t,n)}static remove(e,t){m(e,t)}static get(e,t,n){if(!f(e))return;let r=e._mc[t];return r instanceof n?r:void 0}off(e,n){t(this.target,e,n)}on(e,t){return n(this.target,e,t)}one(e,t){return r(this.target,e,t)}trigger(e,t={},n=`l`,r){a(this.target,e,t,n,r)}ancestors(e){let t=[],n=v(this.target,e);for(;n;)t.push(n),n=v(n.target,e);return t}closest(e){return v(this.target,e)}children(e){let t=_(this.target);return e===void 0?t:t.filter(t=>e in t)}descendants(e){return Array.from(this.target.querySelectorAll(`[data-mc]`)).filter(e=>e instanceof HTMLElement&&`_mc`in e).map(e=>e._mc).filter(t=>e===void 0||e in t)}};function x(e){return e.split(`-`).join(`/`)}function S(e){return`./`+x(e)+`.js`}var C=new Set;function w(e){return()=>{let t=Array.from(document.querySelectorAll(`[data-mc*="${e}"]`)).filter(e=>e instanceof HTMLElement);if(t.length===0)return;let n=customElements.get(e);for(let r of t){try{b.add(r,n.name,new n(r))}catch{if(`create`in n&&typeof n.create==`function`){let e=n.create(r);if(!f(e))throw`create() of Class ${n.name} did not return a McHost.`;e.setAttribute(`data-mc`,r.getAttribute(`data-mc`)??``),r.replaceWith(e),r=e}else throw`Class ${n.name} doesn't have a callable constructor AND class doesn't have a static .create() method.`}let t=r.getAttribute(`data-mc`).split(` `).filter(t=>t!==e&&t!==``).join(` `).trim();r.setAttribute(`data-mc`,t)}}}function T(e){if(C.has(e))return;C.add(e);let t=S(e),n=document.createElement(`script`);n.setAttribute(`src`,t),n.setAttribute(`blocking`,`render`),n.async=!0,n.setAttribute(`type`,`module`),n.setAttribute(`data-name`,e),n.setAttribute(`loading`,``),customElements.whenDefined(e).then(w(e)),n.addEventListener(`load`,t=>{C.delete(e),document.head.querySelector(`script[data-name="${e}"]`)?.remove()}),n.addEventListener(`error`,e=>{console.error(`could not load DC code from`,t)}),document.head.append(n)}function E(){[...document.querySelectorAll(`:not(:defined)`)].filter(e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!C.has(e.tagName.toLowerCase())).forEach(e=>{T(e.tagName.toLowerCase())}),[...document.querySelectorAll(`[data-mc]:not([data-mc=""]`)].filter(e=>!!e).forEach(e=>{(e.getAttribute(`data-mc`)?.split(` `).filter(e=>e!==``))?.forEach(e=>{let t=customElements.get(e);!C.has(e)&&!t?T(e):t&&w(e)()})})}var D=null;function O(e=!0){return e?D?!0:(D=new MutationObserver(E),setTimeout(()=>{D.observe(document.body,{childList:!0,subtree:!0}),E()},5),window.autoload??=O,!0):(D&&=(D.disconnect(),null),!1)}O.state=C;export{O as autoload};
package/dist/cli/index.js CHANGED
@@ -222,7 +222,7 @@ function scaffoldProject(namespace) {
222
222
  files["src/index.html"] = prodShell(tag);
223
223
  files["src/index-dev.html"] = devShell(namespace, tag);
224
224
  files[`src/${base}.ts`] = appSource(namespace, tag);
225
- files[`src/${base}.target.html`] = appHtml(namespace);
225
+ files[`src/${base}.html`] = appHtml(namespace);
226
226
  files[`src/${base}.target.css`] = appCss(tag);
227
227
  files[`src/${namespace}/bundle.ts`] = bundle();
228
228
  files["src/bundle.json"] = bundleConfig(namespace);
@@ -242,7 +242,7 @@ function packageJson(namespace) {
242
242
  preview: "mc preview",
243
243
  typecheck: "tsc --noEmit -p tsconfig.json"
244
244
  },
245
- dependencies: { "@twobirds/microcomponents": "^0.10.0" },
245
+ dependencies: { "@twobirds/microcomponents": "^0.10.2" },
246
246
  devDependencies: { typescript: "^6.0.3" }
247
247
  }, null, " ");
248
248
  }
@@ -489,7 +489,7 @@ function bundleConfig(namespace) {
489
489
  }
490
490
  function appSource(namespace, tag) {
491
491
  const className = kebabToPascal(tag);
492
- return `import { DC, defineCE, parse, processAssets, type McEvent } from '@twobirds/microcomponents';
492
+ return `import { DC, defineCE, parse } from '@twobirds/microcomponents';
493
493
 
494
494
  /**
495
495
  \`${tag}\` — the starter micro component.
@@ -500,15 +500,13 @@ function appSource(namespace, tag) {
500
500
  \`\`\`
501
501
  */
502
502
  class ${className} extends DC {
503
- static assets = ['targetHtml', 'targetCss'];
503
+ static assets = ['html', 'targetCss'];
504
504
 
505
505
  data = { title: 'Micro Components' };
506
506
 
507
- // Fill the template \`{key}\` tokens once, instead of binding reactive state.
508
- oneAssets(ev: McEvent<Record<string, string>>): void {
509
- processAssets(this, {
510
- targetHtml: parse(ev.detail.data.targetHtml, this.data),
511
- });
507
+ // Compile the plain .html template from data once, at init.
508
+ oneInit(): void {
509
+ this.target.innerHTML = parse(this.assets.html as string, this.data);
512
510
  }
513
511
  }
514
512
 
@@ -641,9 +639,10 @@ Asset inlining for the vite-free CLI bundler.
641
639
 
642
640
  Companion `.css` / `.html` files declared by a DC class through
643
641
  `static assets = [...]` are read at build time and embedded as a
644
- `static _assets = { ... }` property inserted as the first line inside the
645
- class body, so `loadAssets()` never fetches them at runtime. The original
646
- `static assets` line is preserved for debugging purposes.
642
+ `static _assets = { ... }` property that **replaces** the `static assets`
643
+ declaration, so `loadAssets()` never fetches them at runtime and the bundled
644
+ `.js` carries no `static assets` line. Each inlined `.[shadow/target].css` /
645
+ `.html` is collapsed to a single continuous line.
647
646
 
648
647
  This is the inlining the shipped Vite plugin used, ported to run inside
649
648
  {@link bundleEntry} without Vite: the bundler calls {@link inlineAssets} on
@@ -759,7 +758,7 @@ async function readAssetsInline(dir, tagName, assets) {
759
758
  const content = await readFile(filePath, "utf8");
760
759
  entries.push({
761
760
  key: asset,
762
- literal: "`" + escapeTemplateLiteral(content).replace(/[\n\t\r]/g, " ").replace(/\s\s/g, " ") + "`"
761
+ literal: "`" + escapeTemplateLiteral(content).replace(/\s+/g, " ") + "`"
763
762
  });
764
763
  } catch (_err) {
765
764
  throw new Error(`[load-assets] Cannot resolve asset "${asset}" for component "${tagName}": file not found at ${filePath}`, { cause: _err });
@@ -769,9 +768,11 @@ async function readAssetsInline(dir, tagName, assets) {
769
768
  }
770
769
  /**
771
770
  * Inline every `static assets = [...]` declaration in a module body as a
772
- * `static _assets` property, reading the companion files from `dir`.
771
+ * `static _assets` property, reading the companion files from `dir`. The
772
+ * `static assets` declaration is replaced (deleted from the bundled `.js`),
773
+ * so the runtime reads only the inlined `static _assets`.
773
774
  *
774
- * @example Returns the class with `static _assets` injected after its opening brace.
775
+ * @example Returns the class with `static _assets` in place of `static assets`.
775
776
  * ```ts
776
777
  * await inlineAssets("class A extends DC { static assets = ['targetHtml']; }", '/build/mc');
777
778
  * ```
@@ -791,13 +792,8 @@ async function inlineAssets(code, dir) {
791
792
  const match = saMatches[i];
792
793
  const assets = match[1].split(",").map((a) => a.trim().replace(/^['"]|['"]$/g, "")).filter(Boolean);
793
794
  if (assets.length === 0) continue;
794
- const assetsObj = `{ ${(await readAssetsInline(dir, tagName, assets)).map((e) => `${e.key}: ${e.literal}`).join(", ")} }`;
795
- const beforeMatch = stripped.substring(0, match.index);
796
- const classOpenMatch = /class\s+\w+[^{]*\{/.exec(beforeMatch);
797
- if (!classOpenMatch) continue;
798
- const classBraceIndex = classOpenMatch.index + classOpenMatch[0].length - 1;
799
- const injectCode = `\n static _assets = ${assetsObj};\n`;
800
- transformed = transformed.substring(0, classBraceIndex + 1) + injectCode + transformed.substring(classBraceIndex + 1);
795
+ const replacement = `static _assets = ${`{ ${(await readAssetsInline(dir, tagName, assets)).map((e) => `${e.key}: ${e.literal}`).join(", ")} }`};`;
796
+ transformed = transformed.substring(0, match.index) + replacement + transformed.substring(match.index + match[0].length);
801
797
  }
802
798
  return transformed;
803
799
  }
@@ -3,9 +3,10 @@
3
3
 
4
4
  Companion `.css` / `.html` files declared by a DC class through
5
5
  `static assets = [...]` are read at build time and embedded as a
6
- `static _assets = { ... }` property inserted as the first line inside the
7
- class body, so `loadAssets()` never fetches them at runtime. The original
8
- `static assets` line is preserved for debugging purposes.
6
+ `static _assets = { ... }` property that **replaces** the `static assets`
7
+ declaration, so `loadAssets()` never fetches them at runtime and the bundled
8
+ `.js` carries no `static assets` line. Each inlined `.[shadow/target].css` /
9
+ `.html` is collapsed to a single continuous line.
9
10
 
10
11
  This is the inlining the shipped Vite plugin used, ported to run inside
11
12
  {@link bundleEntry} without Vite: the bundler calls {@link inlineAssets} on
@@ -28,9 +29,11 @@
28
29
  export declare function stripComments(code: string): string;
29
30
  /**
30
31
  * Inline every `static assets = [...]` declaration in a module body as a
31
- * `static _assets` property, reading the companion files from `dir`.
32
+ * `static _assets` property, reading the companion files from `dir`. The
33
+ * `static assets` declaration is replaced (deleted from the bundled `.js`),
34
+ * so the runtime reads only the inlined `static _assets`.
32
35
  *
33
- * @example Returns the class with `static _assets` injected after its opening brace.
36
+ * @example Returns the class with `static _assets` in place of `static assets`.
34
37
  * ```ts
35
38
  * await inlineAssets("class A extends DC { static assets = ['targetHtml']; }", '/build/mc');
36
39
  * ```
@@ -1 +1 @@
1
- {"version":3,"file":"inliner.d.ts","sourceRoot":"","sources":["../../src/cli/inliner.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;GAeG;AAsDH;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgClD;AAgDD;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAuD7E"}
1
+ {"version":3,"file":"inliner.d.ts","sourceRoot":"","sources":["../../src/cli/inliner.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;GAgBG;AAsDH;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgClD;AAiDD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiD7E"}
package/dist/core/MC.d.ts CHANGED
@@ -6,16 +6,18 @@ export { isMcHost } from './mcGuards.js';
6
6
  The base class for all microcomponents — shared root of both {@link MC} and {@link DC}.
7
7
 
8
8
  Holds a `WeakRef` to the target (a DOM element for `DC`, or any plain object for `MC`)
9
- to avoid circular references. For `DC` subclasses it also bootstraps two automatic
10
- behaviours:
9
+ to avoid circular references. It starts loading any `static assets` for `MC` and `DC`
10
+ alike (shared per class through `_assetsPromise`), read through the {@link McBase.assets}
11
+ getter. For `DC` subclasses it bootstraps one automatic behaviour:
11
12
 
12
13
  1. **Event listener auto-attachment** — methods whose names start with `on` or `one`
13
14
  (e.g. `onClick`, `oneInit`) are wired to the target element via {@link on} / {@link one}.
14
- 2. **"Init" lifecycle event** — dispatched asynchronously in a microtask so that all
15
- synchronous constructor work finishes first.
16
15
 
17
- Both mechanisms run only when the instance is a `DC` (checked with `instanceof DC`).
18
- Plain `MC` instances skip them entirely, keeping server-side usage lightweight.
16
+ The **"Init" lifecycle event** and the DOM attach of auto-attached assets are dispatched
17
+ by the {@link DC} constructor — after the declared assets are in place — so that
18
+ `oneInit()` runs once the instance is fully constructed and its assets are loaded. Plain
19
+ `MC` instances fetch their assets server-side with no DOM attach and no `Init` lifecycle,
20
+ keeping server-side usage lightweight.
19
21
 
20
22
  ### Plugin extension points
21
23
 
@@ -67,20 +69,39 @@ runs once after the constructor.
67
69
  */
68
70
  declare class McBase<TTarget extends object = object> {
69
71
  private _target;
72
+ /**
73
+ * Loaded asset cache, keyed by camelCase descriptor (`'targetHtml'` → `.target.html`).
74
+ * Inlined by the bundler in a bundled build, filled by `loadAssets()` in dev/autoload.
75
+ * Read through the {@link McBase.assets} getter.
76
+ */
77
+ static _assets: Record<string, any>;
78
+ /**
79
+ * Declares companion files for auto-loading by convention (e.g. `['targetHtml', 'json']`).
80
+ * Asset names are camelCase and translated into file extensions: `'targetHtml'` → `.target.html`.
81
+ */
82
+ static assets: string[];
83
+ /**
84
+ * In-flight asset request, cached per class so that instances constructed while
85
+ * the first fetch is still pending (e.g. in a loop) share a single request
86
+ * instead of each triggering their own. Resolves to the freshly loaded assets.
87
+ */
88
+ static _assetsPromise?: Promise<Record<string, any>>;
70
89
  /**
71
90
  The constructor for the base `McBase` class.
72
-
73
- Initializes a weak reference to the target and triggers auto-attachment
74
- of listeners and initialization lifecycle events.
75
-
91
+
92
+ Initializes a weak reference to the target, auto-attaches listeners for `DC`
93
+ subclasses, and starts loading any `static assets` for `MC` and `DC` alike —
94
+ a server-side `MC` fetches them with no DOM, a `DC` gets them attached by its
95
+ own constructor. The load is shared per class through `_assetsPromise`.
96
+
76
97
  @param target - The object or element this microcomponent represents.
77
98
  */
78
99
  constructor(target: TTarget);
79
100
  /**
80
101
  Returns the current target object (DOM node or other data) referenced by this microcomponent.
81
-
102
+
82
103
  Uses a `WeakRef` internally to avoid circular references, and safely dereferences it here.
83
-
104
+
84
105
  The dereference is asserted non-null: the controller is stored on its target
85
106
  (`element._mc`), so any code that can reach the controller through the element is
86
107
  holding the target alive. Only a controller retained independently after its element
@@ -90,6 +111,19 @@ declare class McBase<TTarget extends object = object> {
90
111
  @returns The target object.
91
112
  */
92
113
  get target(): TTarget;
114
+ /**
115
+ The loaded assets for this component instance.
116
+
117
+ `static assets` are loaded before `oneInit()` fires on a `DC`, so this getter is
118
+ ready inside the `oneInit()` callback. A server-side `MC` fills it from `loadAssets()`;
119
+ await `MC._assetsPromise` before reading it. It returns the merged asset record keyed
120
+ by descriptor: `css` / `targetCss` / `shadowCss` / `shadowHtml` / `targetHtml` arrive
121
+ as strings, `*Json` entries arrive parsed, and a plain `html` template is returned as a
122
+ string for `parse()`. An empty object when no assets are declared.
123
+
124
+ @returns A record mapping asset keys to their content.
125
+ */
126
+ get assets(): Record<string, string | Record<string, any>>;
93
127
  }
94
128
  /**
95
129
  A general-purpose base microcomponent that does not require a DOM target.
@@ -97,6 +131,11 @@ A general-purpose base microcomponent that does not require a DOM target.
97
131
  Inherits from `McBase`, but is primarily used as a lightweight container or
98
132
  for logic not directly tied to DOM elements.
99
133
 
134
+ `static assets` work here too: a server-side `MC` fetches its companion files
135
+ (`.json`, `.html`, `.css`) with `loadAssets()` and reads them through the
136
+ {@link McBase.assets} getter — await `MC._assetsPromise` before reading. There is
137
+ no DOM attach and no `Init` lifecycle; those are `DC`-only.
138
+
100
139
  @template TTarget - The concrete type of the wrapped target data; preserved by
101
140
  the `target` getter, so `new MC({ some: 'data' }).target.some` stays typed.
102
141
  @group Micro Components
@@ -165,14 +204,26 @@ and translated into file extensions: `'targetHtml'` → `.target.html`, `'json'`
165
204
  The path is derived from the custom element tag segments, and the basename is the
166
205
  last segment. For `<cart-container-checkout>`, assets load from `/cart/container/checkout.*`.
167
206
 
168
- When assets finish loading, an `'assets'` event fires so that `oneAssets(ev)` can
169
- process them. Everything ending in `Json` arrives parsed; all other files arrive as text.
207
+ **Assets are loaded before `oneInit()` fires.** The constructor applies them to the
208
+ target, then dispatches the `Init` lifecycle event — synchronously in a bundled build
209
+ (assets inlined), after the fetch resolves in a dev/autoload build. Inside `oneInit()`
210
+ the loaded assets are read through the {@link DC.assets} getter. Everything ending in
211
+ `Json` arrives parsed; all other files arrive as text.
212
+
213
+ **Auto-attached assets**: `.css`, `.target.css`, `.shadow.css`, `.target.html` and
214
+ `.shadow.html` are attached automatically by `processAssets()` — CSS is injected into
215
+ the document or shadow scope, HTML is set as `target.innerHTML` / `shadowRoot.innerHTML`,
216
+ and native event handlers in the template (`<button click="this|go">`) are wired.
217
+
218
+ **Plain `.html` is NOT auto-attached.** It is a template held in {@link DC.assets} for
219
+ components created programmatically with a `data` parameter: in `oneInit()` you compile
220
+ the target markup from template + data with `parse()`.
170
221
 
171
222
  **One-time global styles**: Assets named `'css'` and `'targetCss'` inject CSS into the
172
223
  global document scope via `injectCSS(document, ...)`. Because these are idempotent
173
224
  global side effects, they are processed only once — after the first instance loads them,
174
- the entries are removed from both `static assets` and `static _assets`. Subsequent
175
- instances skip loading and re-processing them entirely.
225
+ the entries are dropped from `static _assets`. Subsequent instances skip re-processing
226
+ them entirely.
176
227
 
177
228
  **CSS file roles**:
178
229
 
@@ -183,7 +234,9 @@ instances skip loading and re-processing them entirely.
183
234
  component's own shadow root, so each instance gets its own copy.
184
235
 
185
236
  Every declared asset — CSS, HTML, JSON — is inlined into `static _assets` at build time by
186
- the load-assets plugin, so a bundled build performs no fetches at all.
237
+ the bundler, which replaces the `static assets` declaration with `static _assets` (the
238
+ `static assets` line is deleted from the bundled `.js`) and collapses each inlined
239
+ `.[shadow/target].css` / `.html` to a single line, so a bundled build performs no fetches.
187
240
 
188
241
  In a bundled build the plain `.css` files are additionally concatenated into a single
189
242
  `bundle.css` by the bundling script. That file is a convenience listing of the available
@@ -195,14 +248,14 @@ The runtime decides whether an asset still needs fetching with `!ctor._assets[ke
195
248
  inlined entry must never be an empty string: that would trigger a re-fetch of a file that
196
249
  does not exist in a bundled build.
197
250
 
198
- @example static assets with autoload
251
+ @example static assets read in oneInit
199
252
 
200
253
  ```ts
201
254
  class CartCheckout extends DC {
202
255
  static assets = ['targetHtml', 'targetCss', 'configJson'];
203
256
 
204
- oneAssets(ev) {
205
- const { configJson } = ev.detail.data;
257
+ oneInit() {
258
+ const { configJson } = this.assets;
206
259
  console.log(configJson);
207
260
  }
208
261
  }
@@ -211,6 +264,26 @@ defineCE('cart-checkout', CartCheckout);
211
264
 
212
265
  `configJson` arrives already parsed into an object.
213
266
 
267
+ @example plain .html template compiled with data
268
+
269
+ ```ts
270
+ class UserCard extends DC {
271
+ static assets = ['html', 'targetCss'];
272
+
273
+ constructor(target: HTMLElement, data: { name: string }) {
274
+ super(target);
275
+ this.data = data;
276
+ }
277
+
278
+ oneInit() {
279
+ this.target.innerHTML = parse(this.assets.html, this.data);
280
+ }
281
+ }
282
+ defineCE('user-card', UserCard);
283
+ ```
284
+
285
+ `user-card.html` holds the `{name}` template; `parse()` fills it from `data`.
286
+
214
287
  ### `static attributes?: object`
215
288
 
216
289
  Sets HTML attributes on every instance automatically.
@@ -264,8 +337,7 @@ internal events that can be caught with handler methods:
264
337
  | `onDisconnected()` | Element was removed from the DOM (`disconnectedCallback`) |
265
338
  | `onAdopted()` | Element was moved to a new document (`adoptedCallback`) |
266
339
  | `onAttributeChanged()` | An observed attribute changed (`attributeChangedCallback`) |
267
- | `oneInit()` | Constructor finished; all synchronous setup complete (microtask) |
268
- | `oneAssets()` | Constructor finished; all assets loaded and available; ev contains assets object |
340
+ | `oneInit()` | Constructor finished and declared assets loaded; read them via `this.assets` |
269
341
 
270
342
  @example Event handlers in action
271
343
 
@@ -379,22 +451,6 @@ declare class DC<T extends HTMLElement = HTMLElement, EM extends Record<string,
379
451
  * Set to `'header'` to swap `<my-element>` for `<header>`, or `''` to self-destruct.
380
452
  */
381
453
  static tag?: string;
382
- /**
383
- * Result container for assets (e.g., `['targetHtml', 'json']`).
384
- * Asset names (keys) are camelCase and translated into file extensions: `'targetHtml'` → `.target.html`.
385
- */
386
- static _assets: Record<string, any>;
387
- /**
388
- * Declares companion files for auto-loading by convention (e.g., `['targetHtml', 'json']`).
389
- * Asset names are camelCase and translated into file extensions: `'targetHtml'` → `.target.html`.
390
- */
391
- static assets: string[];
392
- /**
393
- * In-flight asset request, cached per class so that instances constructed while
394
- * the first fetch is still pending (e.g. in a loop) share a single request
395
- * instead of each triggering their own. Resolves to the freshly loaded assets.
396
- */
397
- static _assetsPromise?: Promise<Record<string, any>>;
398
454
  /**
399
455
  * Sets HTML attributes on every instance automatically.
400
456
  * Example: `{ role: 'listitem', 'aria-label': 'nav' }`.
@@ -407,22 +463,14 @@ declare class DC<T extends HTMLElement = HTMLElement, EM extends Record<string,
407
463
  * 1. Calls {@link McBase} to establish the target reference and auto-attach listeners.
408
464
  * 2. If `static tag` is set and differs from the current element, replaces the target
409
465
  * with a new built-in element (or removes it if `tag === ''`).
410
- * 3. If `static assets` has entries, initiates asynchronous loading, fires an `'assets'` event when complete handled by `oneAssets(ev)`.
411
- * 4. Applies any `static attributes` to the target element.
466
+ * 3. Applies any `static attributes` to the target element.
467
+ * 4. Loads `static assets` (inlined in a bundled build, fetched in dev/autoload),
468
+ * applies the auto-attached ones to the target, then fires the `Init` lifecycle
469
+ * event — so `oneInit()` runs with the assets loaded and readable via {@link DC.assets}.
412
470
  *
413
471
  * @param target - The host DOM element this component operates on.
414
472
  */
415
473
  constructor(target: T);
416
- /**
417
- Returns the loaded assets for this component instance.
418
-
419
- Assets are loaded asynchronously when `static assets` is defined on the class.
420
- This method returns the resolved asset map keyed by filename, or `undefined`
421
- if assets have not yet been loaded.
422
-
423
- @returns A record mapping asset keys to their content strings, or undefined.
424
- */
425
- getAssets(): Record<string, string | Record<string, any>> | {};
426
474
  static add<T extends HTMLElement>(target: T, key: string): McHost<McHostOf<T>, McEntriesOf<T>>;
427
475
  /** @param element - The microcomponent instance or config object to attach. When
428
476
  omitted, a bare `{}` marker is stored and no typed entry is claimed. */
@@ -1 +1 @@
1
- {"version":3,"file":"MC.d.ts","sourceRoot":"","sources":["../../src/core/MC.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,KAAK,EACX,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,cAAc,EACd,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,SAAS,EACT,MAAM,qBAAqB,CAAC;AAG7B,YAAY,EACX,kBAAkB,EAClB,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,OAAO,EACP,cAAc,EACd,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,qBAAqB,EACrB,WAAW,EACX,SAAS,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAgLzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8DE;AACF,cAAM,MAAM,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IAC3C,OAAO,CAAC,OAAO,CAAmB;IAElC;;;;;;;MAOE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