@jointhedots/core 2.1.4 → 2.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  {
2
- "$id": "@jointhedots.core",
2
+ "$id": "jointhedots.core",
3
3
  "type": "bundle",
4
4
  "name": "@jointhedots/core",
5
5
  "icon": "",
6
6
  "title": "@jointhedots/core",
7
7
  "data": {
8
- "baseline": "@jointhedots.core-v0",
8
+ "baseline": "jointhedots.core-v0",
9
9
  "components": [],
10
10
  "namespaces": [],
11
11
  "exports": {
@@ -1 +1 @@
1
- import{A as d,R as p,x as u}from"./chunk.FZNTVWPG.js";var y=(i=>(i[i.Default=0]="Default",i[i.Reset=1]="Reset",i[i.Temporary=2]="Temporary",i))(y||{}),l=class{constructor(e){this.name=e;this.key=`settings://${this.name}`;try{let t=localStorage.getItem(this.key);this.restore(JSON.parse(t).stores)}catch{}try{window.addEventListener("storage",t=>{let{key:i,newValue:s}=t;if(i===this.key)try{this.restore(JSON.parse(s).stores)}catch{}})}catch(t){console.error(t.message)}}key=null;stores=S();temporaries=S();settings=S();get(e,t){let i=this.settings[e][t];if(!i){let s=this.temporaries[e][t]||this.stores[e][t];s&&(i=JSON.parse(s),this.settings[e][t]=i)}return i}set(e,t,i,s=0){let n=JSON.stringify(i);return this.write(e,t,n,s)?(this.settings[e][t]=i,m(this,e,t),!0):!1}list(e){return Object.keys(this.temporaries[e]).length>0?Object.keys(Object.assign({},this.stores[e],this.temporaries[e])):Object.keys(this.stores[e])}read(e){return this.stores[e]}write(e,t,i,s){if(s!==1&&this.temporaries[e][t]!==void 0&&(s=2),s===2){if(this.temporaries[e][t]!==i)return this.temporaries[e][t]=i,this.settings[e][t]=null,!0}else if(this.stores[e][t]!==i)return this.stores[e][t]=i,this.settings[e][t]=null,s===0&&localStorage.setItem(this.key,JSON.stringify({stores:this.stores})),!0;return!1}restore(e){for(let t in e)for(let i in e[t])this.write(t,i,e[t][i],1)&&m(this,t,i)}},h=new Set,P=new l("default");function c(){return P}function I(r){return h.add(r),r}function b(r){h.delete(r)}function m(r,e,t){if(r===P&&r.settings[e][t]!==void 0)for(let i of h)i(e,t)}function S(){return{service_points:{},components:{},shareds:{}}}var a=new Map,g=new Set,v=class{constructor(e){this.descriptor=e;let[t,i]=e.id.split("/");this.service=t,this.name=i}service="";name="";services=[];loading=null;ready=!1;failure=null;get id(){return this.descriptor.id}get multiple(){return this.descriptor?.properties?.multiple||!1}async fetch(){return this.ready?this.services:(this.loading||(this.loading=new Promise(async e=>{let{descriptor:t}=this,{providers:i}=this.descriptor,s=await x(i,this.service,this.id,this);t===this.descriptor?(this.services=s,this.ready=!0,this.loading=null,e(this.services)):e(this.fetch())})),this.loading)}async reset(e){return this.descriptor!==e&&(this.descriptor=e,(this.loading||this.ready||this.failure)&&(this.failure=null,this.loading=null,this.ready=!1,g.forEach(t=>t(this)),await this.fetch()),g.forEach(t=>t(this))),this}override(e){let t=c(),i=t.get("service_points",this.id);t.set("service_points",this.id,{...i,providers:e},2)}notifyError(e){this.failure=e,p.error(e)}notifyObject(e){p.send(e)}};function G(r){return g.add(r),r}function H(r){g.delete(r)}u.listen(r=>{for(let e of a.values())e.descriptor.providers?.includes(r.id)&&g.forEach(t=>t(e))});async function x(r,e,t,i){let s=[];if(Array.isArray(r)&&r.length>0)for(let n of r){let o=d(n);if(await o.fetch()){let f=await o.acquireResource(e).fetch();f?s.push(f):i.notifyError(new Error(`ServicePoint '${t}': component '${n}' not implement service '${e}'`))}else i.notifyError(new Error(`ServicePoint '${t}': component '${n}' not found`))}return s}function C(r){let t=c().get("service_points",r);return t||(t={id:r,providers:[],properties:{}}),t}function w(r,e){let t=c(),i=t.get("service_points",r);if(i){let s=!1;for(let n in e){let o=e[n];o!==void 0&&i[n]!=o&&(i[n]=o,s=!0)}s&&t.set("service_points",r,i)}else i={id:r,providers:[],properties:e},t.set("service_points",r,i);return i}I((r,e)=>{if(r==="service_points"){let t=a.get(e);if(t){let i=c().get("service_points",e);t.reset(i),console.log("[Update Service Point]",e)}}});function L(r){return a.get(r)}function D(r){let e=a.get(r);return e||(e=new v(C(r)),a.set(e.id,e)),e}function j(r,e,t){let i=r.resource+"/"+e;return w(i,t),D(i)}export{y as a,l as b,c,I as d,b as e,a as f,v as g,G as h,H as i,C as j,w as k,L as l,D as m,j as n};
1
+ import{A as d,R as S,x as u}from"./chunk.FZNTVWPG.js";var y=(i=>(i[i.Default=0]="Default",i[i.Reset=1]="Reset",i[i.Temporary=2]="Temporary",i))(y||{}),l=class{constructor(e){this.name=e;this.key=`settings://${this.name}`;try{let t=localStorage.getItem(this.key);this.restore(JSON.parse(t).stores)}catch{}try{window.addEventListener("storage",t=>{let{key:i,newValue:s}=t;if(i===this.key)try{this.restore(JSON.parse(s).stores)}catch{}})}catch(t){console.error(t.message)}}key=null;stores=p();temporaries=p();settings=p();get(e,t){let i=this.settings[e][t];if(!i){let s=this.temporaries[e][t]||this.stores[e][t];s&&(i=JSON.parse(s),this.settings[e][t]=i)}return i}set(e,t,i,s=0){let n=JSON.stringify(i);return this.write(e,t,n,s)?(this.settings[e][t]=i,m(this,e,t),!0):!1}list(e){return Object.keys(this.temporaries[e]).length>0?Object.keys(Object.assign({},this.stores[e],this.temporaries[e])):Object.keys(this.stores[e])}read(e){return this.stores[e]}write(e,t,i,s){if(s!==1&&this.temporaries[e][t]!==void 0&&(s=2),s===2){if(this.temporaries[e][t]!==i)return this.temporaries[e][t]=i,this.settings[e][t]=null,!0}else if(this.stores[e][t]!==i)return this.stores[e][t]=i,this.settings[e][t]=null,s===0&&localStorage.setItem(this.key,JSON.stringify({stores:this.stores})),!0;return!1}restore(e){for(let t in e)for(let i in e[t])this.write(t,i,e[t][i],1)&&m(this,t,i)}},h=new Set,P=new l("default");function c(){return P}function I(r){return h.add(r),r}function b(r){h.delete(r)}function m(r,e,t){if(r===P&&r.settings[e][t]!==void 0)for(let i of h)i(e,t)}function p(){return{service_points:{},components:{},shareds:{}}}var a=new Map,g=new Set,v=class{constructor(e){this.descriptor=e;let[t,i]=e.id.split("/");this.service=t,this.name=i}service="";name="";services=[];loading=null;ready=!1;failure=null;get id(){return this.descriptor.id}get multiple(){return this.descriptor?.properties?.multiple||!1}async fetch(){return this.ready?this.services:(this.loading||(this.loading=new Promise(async e=>{let{descriptor:t}=this,{providers:i}=this.descriptor,s=await x(i,this.service,this.id,this);t===this.descriptor?(this.services=s,this.ready=!0,this.loading=null,e(this.services)):e(this.fetch())})),this.loading)}async reset(e){return this.descriptor!==e&&(this.descriptor=e,(this.loading||this.ready||this.failure)&&(this.failure=null,this.loading=null,this.ready=!1,g.forEach(t=>t(this)),await this.fetch()),g.forEach(t=>t(this))),this}override(e){let t=c(),i=t.get("service_points",this.id);t.set("service_points",this.id,{...i,providers:e},2)}notifyError(e){this.failure=e,S.error(e)}notifyObject(e){S.send(e)}};function G(r){return g.add(r),r}function H(r){g.delete(r)}u.listen(r=>{for(let e of a.values())e.descriptor.providers?.includes(r.id)&&g.forEach(t=>t(e))});async function x(r,e,t,i){let s=[];if(Array.isArray(r)&&r.length>0)for(let n of r){let o=d(n);if(await o.fetch()){let f=await o.acquireResource(e).fetch();f?s.push(f):i.notifyError(new Error(`ServicePoint '${t}': component '${n}' not implement service '${e}'`))}else i.notifyError(new Error(`ServicePoint '${t}': component '${n}' not found`))}return s}function C(r){let t=c().get("service_points",r);return t||(t={id:r,providers:[],properties:{}}),t}function w(r,e){let t=c(),i=t.get("service_points",r);if(i){let s=!1;for(let n in e){let o=e[n];o!==void 0&&i[n]!=o&&(i[n]=o,s=!0)}s&&t.set("service_points",r,i)}else i={id:r,providers:[],properties:e},t.set("service_points",r,i);return i}I((r,e)=>{if(r==="service_points"){let t=a.get(e);if(t){let i=c().get("service_points",e);t.reset(i),console.log("[Update Service Point]",e)}}});function j(r){return a.get(r)}function D(r){let e=a.get(r);return e||(e=new v(C(r)),a.set(e.id,e)),e}function L(r,e,t){let i=r.resource+"/"+e;return w(i,t),D(i)}export{y as a,l as b,c,I as d,b as e,a as f,v as g,G as h,H as i,C as j,w as k,j as l,D as m,L as n};
package/export.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as Ae,b as Ee,c as we,d as $e,e as Ce,f as Re,g as Fe,h as _e,i as De,j as Ke,k as qe,l as Ie,m as Me,n as Be}from"./chunk.LFHCE3KB.js";import{a as Ge,b as He,c as Ze,d as Ve,e as Qe,f as Ue,g as We,h as Xe,i as Ye,j as et,k as tt,l as rt,m as nt,n as ot}from"./chunk.I3IQPWRL.js";import{A as ye,B as he,C as fe,D as Se,E as ge,F as de,G as be,H as xe,I as ve,J as Oe,K as Ne,L as N,M as Te,N as Je,O as ze,P as Pe,Q as je,R as Le,S as ke,a as B,b as G,c as H,d as Z,e as V,f as Q,g as U,h as W,i as X,j as Y,k as ee,l as te,m as re,n as ne,o as oe,p as ie,q as se,u as ae,v as le,w as pe,x as ce,y as ue,z as me}from"./chunk.FZNTVWPG.js";function it(n,t){for(let r in n)if(n[r]!==t[r])return!1;for(let r in t)if(n[r]!==t[r])return!1;return!0}function*st(n){if(Array.isArray(n))for(let t of n)yield t;else n&&(yield n)}var T=Symbol("__observable__"),J=Symbol("__status__");var f=class{observers;state;image;constructor(){this.observers=null,this.state={},this.image=new Proxy(this.state,this)}subscribe(t,r){this.observers===null&&(this.observers=[]),this.observers.push(t,r)}unsubscribe(t){}notify(t){if(this.observers)for(let r=0;r<this.observers.length;r+=2){let o=this.observers[r];o(this.image,t)}}async use(t){return this.image}get(t,r){return r===T?this:Reflect.get(this.state,r)}set(t,r,o){return this.state[r]!==o&&(this.state[r]=o,this.notify(r)),!0}ownKeys(t){return Reflect.ownKeys(this.state)}has(t,r){return Reflect.has(this.state,r)}};var c=null,S=class{".events";".listeners";addEventListener(){let t=this[".listeners"];if(t?c===t&&(this[".listeners"]=t=t.slice()):this[".listeners"]=t=[],arguments.length===1)return arguments[0]?(t.push(arguments[0]),t.push(null),!0):!1;if(arguments.length===2)return arguments[1]?(t.push(arguments[1]),t.push(arguments[0]),!0):!1}removeEventListener(){let t=this[".listeners"];if(t)c===t&&(this[".listeners"]=t=t.slice());else return!1;if(arguments.length===1){let r=arguments[0],o=0;for(;;)if(o=t.indexOf(r,o),o>=0)t.splice(o,2),o++;else return!0}else if(arguments.length===2){let r=arguments[0],o=arguments[1],i=0;for(;;)if(i=t.indexOf(o,i),i>=0){if(t[i+1]===r)return t.splice(i,2),!0;i++}else return console.warn(`removeEventListener(${r}) failed on:`,this),!1}return!1}synchronizeStateInContext(t,r,o,i){return this}addStateListener(t,r){return this.addEventListener("change",t)}removeStateListener(t){return this.removeEventListener("change",t)}setState(){if(arguments.length===0)this[".events"]?this[".events"][0]||(this[".events"][0]={}):(this[".events"]=[{}],setTimeout(b.bind(this)));else if(arguments.length===1)for(let t in arguments[0])z.call(this,t,arguments[0][t]);else arguments.length===2&&z.call(this,arguments[0],arguments[1])}dispatchEvent(t,r){this[".events"]||(this[".events"]=[null],setTimeout(b.bind(this))),t==="change"?this[".events"][0]=Object.assign(this[".events"][0]||{},r):(this[".events"].push(t),this[".events"].push(r))}executeEvent(t,r){let o=this[".listeners"],i=o?o.length:0;if(!i)return;c===null?c=o:o=o.slice();let a=[];for(let p=1;p<i;p+=2)try{let l,m=o[p];m?m===t&&(l=o[p-1](r,this)):l=o[p-1](t,r,this),l instanceof Promise&&a.push(l)}catch(l){console.error(l)}return c===o&&(c=null),Promise.all(a)}static setState(){}};S.setState=S.prototype.setState;function z(n,t){if(this[n]!==t){this[".events"]||(this[".events"]=[null],setTimeout(b.bind(this)));let r=this[".events"][0];r?r.hasOwnProperty(n)||(r[n]=this[n]):this[".events"][0]={[n]:t},this[n]=t}}function b(){let n=this[".listeners"],t=this[".events"],r=n?n.length:0;if(this[".events"]=null,!r)return;c===null?c=n:n=n.slice();let o=t[0];if(o)for(let i=1;i<r;i+=2)try{let a=n[i];if(!a)n[i-1]("change",this,o);else if(a==="change")n[i-1](this,o);else if(Array.isArray(a)){for(let p of a)if(o.hasOwnProperty(p)){n[i-1](this,o);break}}}catch(a){console.error(a)}for(let i=2;i<t.length;i+=2){let a=t[i-1],p=t[i];for(let l=1;l<r;l+=2)try{let m=n[l];m?m===a&&n[l-1](p,this):n[l-1](a,p,this)}catch(m){console.error(m)}}c===n&&(c=null)}var P=class extends f{constructor(r){super();this.url=r}loaded=!1;query=null;status=0;async use(){return this.loaded===!1?(this.query===null&&(this.query=fetch(this.url).then(async r=>{let o=await r.json();return Object.assign(this.state,o),this.status=r.status,this.query=null,this.loaded=!0,this.notify(),this.image},r=>(N.error(r),this.loaded=!0,this.image))),this.query):this.image}get(r,o){if(typeof o=="string"){if(this.loaded===!1)return this.use().then(()=>this.state[o])}else if(o===J)return this.status;return super.get(r,o)}set(r,o,i){return this.loaded===!1?(console.error(`Resource '${this.url}' not ready for assignement`),!0):super.set(this.state,o,i)}};var u={boolean:{type:"boolean"},string:{type:"string"},number:{type:"number"},object:{type:"object"},view:{type:"view"},display:{type:"display"},function:{type:"function"},null:{type:"null"},unknown:{type:"null"},any:{}},vt={enums(n,...t){return{...n,enum:t}},array(n){return{type:"array",items:n}},record(n){return{type:"object",properties:n}},collection(n){return{type:"object",additionalProperties:n}},event_fn(n){return{type:"function",args:[n||u.any]}}},y={invalid:{$error:"Cannot determine the type"}};function j(n,t){if(!t)return y.invalid;let r=t.properties?.[n];if(r)return r;let{patternProperties:o}=t;for(let i in o)if(n.match(i))return o[i];return t.$error?y.invalid:t.additionalProperties||u.any}function L(n,t){return t?Array.isArray(t.items)?t.items?.[n]||y.invalid:t.items?t.items:t.type==="element"?t:t.$error?y.invalid:t.additionalProperties||u.any:y.invalid}function x(n){switch(typeof n){case"undefined":return u.null;case"boolean":return u.boolean;case"symbol":case"string":return u.string;case"bigint":case"number":return u.number;case"function":return u.function;case"object":{if(Array.isArray(n))return{type:"array",items:n.map(x)};if(n!==null){let t={};for(let r in t)t[r]=x(t[r]);return{type:"array",properties:t}}return u.null}default:return y.invalid}}function k(n,t){let{type:r}=n;return Array.isArray(r)?r.includes(t):r===t}function A(n){return Array.isArray(n)?n.join(","):n}function g(n){if(n.type==="object"){let t=[];for(let r in n.properties)t.push(`${r}: ${g(n.properties[r])}`);for(let r in n.additionalProperties)t.push(`${r}?: ${g(n.additionalProperties[r])}`);for(let r in n.patternProperties)t.push(`[${r}: ${g(n.patternProperties[r])}]`);return t.join(`
1
+ import{a as Ae,b as Ee,c as we,d as $e,e as Ce,f as Re,g as Fe,h as _e,i as De,j as Ke,k as qe,l as Ie,m as Me,n as Be}from"./chunk.LFHCE3KB.js";import{a as Ge,b as He,c as Ze,d as Ve,e as Qe,f as Ue,g as We,h as Xe,i as Ye,j as et,k as tt,l as rt,m as nt,n as ot}from"./chunk.7V6KPYF2.js";import{A as ye,B as he,C as fe,D as Se,E as ge,F as de,G as be,H as xe,I as ve,J as Oe,K as Ne,L as N,M as Te,N as Je,O as ze,P as Pe,Q as je,R as Le,S as ke,a as B,b as G,c as H,d as Z,e as V,f as Q,g as U,h as W,i as X,j as Y,k as ee,l as te,m as re,n as ne,o as oe,p as ie,q as se,u as ae,v as le,w as pe,x as ce,y as ue,z as me}from"./chunk.FZNTVWPG.js";function it(n,t){for(let r in n)if(n[r]!==t[r])return!1;for(let r in t)if(n[r]!==t[r])return!1;return!0}function*st(n){if(Array.isArray(n))for(let t of n)yield t;else n&&(yield n)}var T=Symbol("__observable__"),J=Symbol("__status__");var f=class{observers;state;image;constructor(){this.observers=null,this.state={},this.image=new Proxy(this.state,this)}subscribe(t,r){this.observers===null&&(this.observers=[]),this.observers.push(t,r)}unsubscribe(t){}notify(t){if(this.observers)for(let r=0;r<this.observers.length;r+=2){let o=this.observers[r];o(this.image,t)}}async use(t){return this.image}get(t,r){return r===T?this:Reflect.get(this.state,r)}set(t,r,o){return this.state[r]!==o&&(this.state[r]=o,this.notify(r)),!0}ownKeys(t){return Reflect.ownKeys(this.state)}has(t,r){return Reflect.has(this.state,r)}};var c=null,S=class{".events";".listeners";addEventListener(){let t=this[".listeners"];if(t?c===t&&(this[".listeners"]=t=t.slice()):this[".listeners"]=t=[],arguments.length===1)return arguments[0]?(t.push(arguments[0]),t.push(null),!0):!1;if(arguments.length===2)return arguments[1]?(t.push(arguments[1]),t.push(arguments[0]),!0):!1}removeEventListener(){let t=this[".listeners"];if(t)c===t&&(this[".listeners"]=t=t.slice());else return!1;if(arguments.length===1){let r=arguments[0],o=0;for(;;)if(o=t.indexOf(r,o),o>=0)t.splice(o,2),o++;else return!0}else if(arguments.length===2){let r=arguments[0],o=arguments[1],i=0;for(;;)if(i=t.indexOf(o,i),i>=0){if(t[i+1]===r)return t.splice(i,2),!0;i++}else return console.warn(`removeEventListener(${r}) failed on:`,this),!1}return!1}synchronizeStateInContext(t,r,o,i){return this}addStateListener(t,r){return this.addEventListener("change",t)}removeStateListener(t){return this.removeEventListener("change",t)}setState(){if(arguments.length===0)this[".events"]?this[".events"][0]||(this[".events"][0]={}):(this[".events"]=[{}],setTimeout(b.bind(this)));else if(arguments.length===1)for(let t in arguments[0])z.call(this,t,arguments[0][t]);else arguments.length===2&&z.call(this,arguments[0],arguments[1])}dispatchEvent(t,r){this[".events"]||(this[".events"]=[null],setTimeout(b.bind(this))),t==="change"?this[".events"][0]=Object.assign(this[".events"][0]||{},r):(this[".events"].push(t),this[".events"].push(r))}executeEvent(t,r){let o=this[".listeners"],i=o?o.length:0;if(!i)return;c===null?c=o:o=o.slice();let a=[];for(let p=1;p<i;p+=2)try{let l,m=o[p];m?m===t&&(l=o[p-1](r,this)):l=o[p-1](t,r,this),l instanceof Promise&&a.push(l)}catch(l){console.error(l)}return c===o&&(c=null),Promise.all(a)}static setState(){}};S.setState=S.prototype.setState;function z(n,t){if(this[n]!==t){this[".events"]||(this[".events"]=[null],setTimeout(b.bind(this)));let r=this[".events"][0];r?r.hasOwnProperty(n)||(r[n]=this[n]):this[".events"][0]={[n]:t},this[n]=t}}function b(){let n=this[".listeners"],t=this[".events"],r=n?n.length:0;if(this[".events"]=null,!r)return;c===null?c=n:n=n.slice();let o=t[0];if(o)for(let i=1;i<r;i+=2)try{let a=n[i];if(!a)n[i-1]("change",this,o);else if(a==="change")n[i-1](this,o);else if(Array.isArray(a)){for(let p of a)if(o.hasOwnProperty(p)){n[i-1](this,o);break}}}catch(a){console.error(a)}for(let i=2;i<t.length;i+=2){let a=t[i-1],p=t[i];for(let l=1;l<r;l+=2)try{let m=n[l];m?m===a&&n[l-1](p,this):n[l-1](a,p,this)}catch(m){console.error(m)}}c===n&&(c=null)}var P=class extends f{constructor(r){super();this.url=r}loaded=!1;query=null;status=0;async use(){return this.loaded===!1?(this.query===null&&(this.query=fetch(this.url).then(async r=>{let o=await r.json();return Object.assign(this.state,o),this.status=r.status,this.query=null,this.loaded=!0,this.notify(),this.image},r=>(N.error(r),this.loaded=!0,this.image))),this.query):this.image}get(r,o){if(typeof o=="string"){if(this.loaded===!1)return this.use().then(()=>this.state[o])}else if(o===J)return this.status;return super.get(r,o)}set(r,o,i){return this.loaded===!1?(console.error(`Resource '${this.url}' not ready for assignement`),!0):super.set(this.state,o,i)}};var u={boolean:{type:"boolean"},string:{type:"string"},number:{type:"number"},object:{type:"object"},view:{type:"view"},display:{type:"display"},function:{type:"function"},null:{type:"null"},unknown:{type:"null"},any:{}},vt={enums(n,...t){return{...n,enum:t}},array(n){return{type:"array",items:n}},record(n){return{type:"object",properties:n}},collection(n){return{type:"object",additionalProperties:n}},event_fn(n){return{type:"function",args:[n||u.any]}}},y={invalid:{$error:"Cannot determine the type"}};function j(n,t){if(!t)return y.invalid;let r=t.properties?.[n];if(r)return r;let{patternProperties:o}=t;for(let i in o)if(n.match(i))return o[i];return t.$error?y.invalid:t.additionalProperties||u.any}function L(n,t){return t?Array.isArray(t.items)?t.items?.[n]||y.invalid:t.items?t.items:t.type==="element"?t:t.$error?y.invalid:t.additionalProperties||u.any:y.invalid}function x(n){switch(typeof n){case"undefined":return u.null;case"boolean":return u.boolean;case"symbol":case"string":return u.string;case"bigint":case"number":return u.number;case"function":return u.function;case"object":{if(Array.isArray(n))return{type:"array",items:n.map(x)};if(n!==null){let t={};for(let r in t)t[r]=x(t[r]);return{type:"array",properties:t}}return u.null}default:return y.invalid}}function k(n,t){let{type:r}=n;return Array.isArray(r)?r.includes(t):r===t}function A(n){return Array.isArray(n)?n.join(","):n}function g(n){if(n.type==="object"){let t=[];for(let r in n.properties)t.push(`${r}: ${g(n.properties[r])}`);for(let r in n.additionalProperties)t.push(`${r}?: ${g(n.additionalProperties[r])}`);for(let r in n.patternProperties)t.push(`[${r}: ${g(n.patternProperties[r])}]`);return t.join(`
2
2
  `)}else if(n.type)return n.type;return"any"}var Ot={getPropertyTyping:j,getItemTyping:L,getValueTyping:x,isType:k,typeAsString:A,generateTypescript:g};import{z as e}from"zod";var E=e.enum(["string","number","integer","boolean","object","array","null"]),w=e.enum(["module","function","service"]),d=e.union([e.string(),e.number(),e.boolean(),e.null(),e.record(e.string(),e.any()),e.array(e.any())]),$=e.object({title:e.string().optional(),properties:e.array(e.string()).optional(),secondaryProperties:e.array(e.string()).optional(),patternProperties:e.array(e.string()).optional(),additionalProperties:e.boolean().optional()}),C=e.object({description:e.string().optional(),chapters:e.array($).optional(),additionalChapter:e.boolean().optional()}),R=e.object({source:e.string()}),F=e.object({type:e.string()}).passthrough(),s=e.lazy(()=>h),_=e.object({title:e.string().optional(),icon:e.string().optional(),description:e.string().optional(),args:e.array(s).optional(),content:F}),D=e.object({view:e.string(),properties:e.record(e.string(),s).optional()}),Jt=e.object({check:e.any()}),K=e.union([e.literal("safe"),e.string(),e.object({rule:e.string()}).passthrough()]),q=e.string(),I=e.union([q,e.object({type:e.string(),data:e.any().optional()})]),v=e.object({$id:e.string().optional(),$ref:e.string().optional(),$schema:e.string().optional(),$comment:e.string().optional(),$defs:e.record(e.string(),e.lazy(()=>s)).optional(),type:e.union([E,w]).optional(),enum:e.array(d).optional(),const:d.optional(),multipleOf:e.number().optional(),maximum:e.number().optional(),exclusiveMaximum:e.number().optional(),minimum:e.number().optional(),exclusiveMinimum:e.number().optional(),maxLength:e.number().optional(),minLength:e.number().optional(),pattern:e.string().optional(),items:e.union([e.lazy(()=>s),e.array(e.lazy(()=>s))]).optional(),additionalItems:e.lazy(()=>s).optional(),maxItems:e.number().optional(),minItems:e.number().optional(),uniqueItems:e.boolean().optional(),contains:e.lazy(()=>s).optional(),maxProperties:e.number().optional(),minProperties:e.number().optional(),required:e.array(e.string()).optional(),properties:e.record(e.string(),e.lazy(()=>s)).optional(),patternProperties:e.record(e.string(),e.lazy(()=>s)).optional(),additionalProperties:e.lazy(()=>s).optional(),dependencies:e.record(e.string(),e.union([e.lazy(()=>s),e.array(e.string())])).optional(),propertyNames:e.lazy(()=>s).optional(),if:e.lazy(()=>s).optional(),then:e.lazy(()=>s).optional(),else:e.lazy(()=>s).optional(),allOf:e.array(e.lazy(()=>s)).optional(),anyOf:e.array(e.lazy(()=>s)).optional(),oneOf:e.array(e.lazy(()=>s)).optional(),not:e.lazy(()=>s).optional(),format:e.string().optional(),contentMediaType:e.string().optional(),contentEncoding:e.string().optional(),definitions:e.record(e.string(),e.lazy(()=>s)).optional(),title:e.string().optional(),description:e.string().optional(),default:d.optional(),readOnly:e.boolean().optional(),writeOnly:e.boolean().optional(),examples:d.optional()}),O=e.object({title:e.string().optional(),icon:e.string().optional(),doc:C.optional(),$error:e.union([e.string(),e.instanceof(Error)]).optional(),args:e.array(e.lazy(()=>h)).optional(),placeholder:e.boolean().optional(),resources:e.record(e.string(),I).optional(),security:K.optional(),"allow-origin":e.string().optional(),docking:D.optional(),templates:e.array(_).optional(),binding:R.optional(),aliases:e.record(e.string(),e.string()).optional()}),M=v.merge(O).extend({type:e.literal("service"),$spec:e.string(),version:e.string().optional()}),zt=v.merge(O).extend({type:e.literal("function"),input:e.union([e.lazy(()=>h),e.array(e.lazy(()=>h))]).optional(),output:e.union([e.lazy(()=>h),e.array(e.lazy(()=>h))]).optional()}),h=e.lazy(()=>e.union([v.merge(O),M]));export{He as AccountSettings,R as BindingSchema,$ as ChapterSchema,ie as CombinedComponentProvider,vt as CommonMakers,Y as CommonResourceProvider,u as CommonTypes,G as ComponentControllerKey,ae as ComponentEntry,le as ComponentResource,pe as ComponentsManifold,ce as ComponentsRegistry,D as DockingSchema,C as DocumentationSchema,H as EditorKey,y as ErrorTypes,F as ExpressionSchema,zt as FunctionSchemaSchema,J as HttpStatusAttribute,ne as InMemComponentProvider,re as InMemComponentPublisher,s as JSONSchema7DefinitionSchema,w as JSONSchema7TypeNameCustomSchema,E as JSONSchema7TypeNameSchema,d as JSONSchema7TypeSchema,O as JSONSchemaCustomSchema,h as JSONSchemaSchema,v as JSONSchemaStandardSchema,S as Listenable,Le as Log,f as Observable,T as ObservableAttribute,I as ResourceEntrySchema,q as ResourceLinkSchema,P as RestResource,Ot as Schema,K as SecurityGuardSchema,Jt as SecurityRuleSchema,B as ServiceAccessor,We as ServicePoint,Ue as ServicePoints,M as ServiceSchemaSchema,oe as StaticComponentProvider,ee as StaticContentProvider,_ as TemplateSchema,Ge as WriteMode,Ee as ZodService,ye as acquireComponent,he as acquireFutureComponent,fe as acquireResource,nt as acquireServicePoint,et as acquireServicePointDescriptor,it as areSimilarObjects,De as checkVersionCompatibility,te as contentLocalURI,U as createComponentFilter,Q as createComponentPublication,se as createLocalComponentProvider,ke as createLogFromError,ot as createServicePoint,Ke as defineServiceSpec,be as deleteComponent,Ne as failedComponentPublication,Oe as fetchComponentsPublications,_e as generateTypeScript,me as getComponentFromData,V as getComponentServicesList,ue as getDefaultComponent,rt as getServicePoint,Ie as getServiceSchema,Me as getServiceSchemaFromSpec,qe as getServiceZod,Ze as getSettings,Ce as jsonSchemaToZod,st as listOneOrMany,Xe as listenServicePoints,Ve as listenSettings,W as matchComponentFilter,Be as matchesSpecification,Z as parseComponentURI,X as parseResourceEntry,N as print,ze as queryLogCount,je as queryLogInfos,Pe as queryLogObjects,Te as registerLogCollector,Se as resolveRelativeComponent,de as saveComponent,ge as saveComponentManifest,ve as searchComponentsPublications,Ye as unlistenServicePoints,Qe as unlistenSettings,xe as unregisterComponent,Je as unregisterLogCollector,tt as updateServicePointDescriptor,Re as validate,Fe as validateOrThrow,Ae as z,we as zService,$e as zodToJSONSchema};
package/export.react.js CHANGED
@@ -1,4 +1,4 @@
1
- import{h as y,i as U,m as L}from"./chunk.I3IQPWRL.js";import{a as v,c as w,d as q}from"./chunk.IAUN77LU.js";import"./chunk.FZNTVWPG.js";import{z as a}from"zod";function Ve(t){let e=t||a.record(a.string(),a.any());return{$spec:"spec://jointhedots.org/view.react",version:"0.0",properties:a.object({props:e,requirements:a.object({servicePoints:a.record(a.string(),a.object({service:a.string().optional(),cardinality:a.number().optional()})).optional()}).optional()}),isAssignable(r){return r.$spec=this.$spec}}}var N=v.subservice("react"),ke=v.subservice("webc");import{useEffect as K,useState as z}from"react";function qe(t,e,r){let[o,i]=z(e);return K(()=>{t().then(i,console.error)},r),o}import T from"react";import{jsx as f}from"react/jsx-runtime";var x=class{constructor(e,r){this.value=e;this.updateTimeout=r}promise=null;dispatch=null;updateTimer=null;shallUpdate=!0;updater;deps;use(e,r){if(this.updater=e,r!==this.deps){let o=this.deps;if(this.deps=r,r?.length===o?.length){if(r){for(let i=0;i<r.length;i++)if(r[i]!==o[i])return this.update()}}else return this.update()}}initiate(e){this.dispatch=e,this.dispatch(this.value)}cancelAutoUpdate(){this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}scheduleAutoUpdate(){this.cancelAutoUpdate(),this.shallUpdate?this.update():this.updateTimeout>0&&(this.updateTimer=setTimeout(()=>{this.updateTimer=null,this.update()},this.updateTimeout))}get isWaiting(){return this.promise!==null}get hasState(){return this.value!==void 0}get autoUpdate(){return this.updateTimeout}set autoUpdate(e){this.updateTimeout=e,this.cancelAutoUpdate(),this.update()}set(e){this.value!==e&&(this.value=e,this.dispatch&&this.dispatch(e))}get(){return this.value}update(){try{if(this.promise)this.shallUpdate=!0,this.cancelAutoUpdate();else{let e=this.updater();this.shallUpdate=!1,e instanceof Promise?(this.promise=e,e.then(r=>{this.promise=null,this.set(r),this.scheduleAutoUpdate()},r=>{this.promise=null,this.scheduleAutoUpdate(),console.log(r)})):this.scheduleAutoUpdate()}}catch(e){this.scheduleAutoUpdate(),console.log(e)}}cancel(){this.dispatch=null,this.promise=null,this.updateTimeout=0,this.cancelAutoUpdate()}waiting(e){return this.isWaiting==!0?f(m,{}):e(this.value)}using(e){return this.hasState==!1?f(m,{}):e(this.value)}};function Me(t,e,r,o){let[i]=T.useState(()=>new x(r,o)),[s,n]=T.useState(r);return i.use(t,e),T.useEffect(()=>(i.initiate(n),()=>i.cancel()),null),i}function Ae(t,...e){for(let r of e)if(r.isWaiting==!0)return f(m,{});return t()}function _e(t,...e){for(let r of e)if(r.hasState==!1)return f(m,{});return t()}function m(){return f("div",{children:"..."})}import D,{useContext as ie,useEffect as A,useMemo as oe,useState as ne}from"react";import G,{createContext as X,useContext as Y,useMemo as ee}from"react";var Q=`.JDT-ErrorBoundary {
1
+ import{h as y,i as U,m as L}from"./chunk.7V6KPYF2.js";import{a as v,c as w,d as q}from"./chunk.IAUN77LU.js";import"./chunk.FZNTVWPG.js";import{z as a}from"zod";function Ve(t){let e=t||a.record(a.string(),a.any());return{$spec:"spec://jointhedots.org/view.react",version:"0.0",properties:a.object({props:e,requirements:a.object({servicePoints:a.record(a.string(),a.object({service:a.string().optional(),cardinality:a.number().optional()})).optional()}).optional()}),isAssignable(r){return r.$spec=this.$spec}}}var N=v.subservice("react"),ke=v.subservice("webc");import{useEffect as K,useState as z}from"react";function qe(t,e,r){let[o,i]=z(e);return K(()=>{t().then(i,console.error)},r),o}import T from"react";import{jsx as f}from"react/jsx-runtime";var x=class{constructor(e,r){this.value=e;this.updateTimeout=r}promise=null;dispatch=null;updateTimer=null;shallUpdate=!0;updater;deps;use(e,r){if(this.updater=e,r!==this.deps){let o=this.deps;if(this.deps=r,r?.length===o?.length){if(r){for(let i=0;i<r.length;i++)if(r[i]!==o[i])return this.update()}}else return this.update()}}initiate(e){this.dispatch=e,this.dispatch(this.value)}cancelAutoUpdate(){this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}scheduleAutoUpdate(){this.cancelAutoUpdate(),this.shallUpdate?this.update():this.updateTimeout>0&&(this.updateTimer=setTimeout(()=>{this.updateTimer=null,this.update()},this.updateTimeout))}get isWaiting(){return this.promise!==null}get hasState(){return this.value!==void 0}get autoUpdate(){return this.updateTimeout}set autoUpdate(e){this.updateTimeout=e,this.cancelAutoUpdate(),this.update()}set(e){this.value!==e&&(this.value=e,this.dispatch&&this.dispatch(e))}get(){return this.value}update(){try{if(this.promise)this.shallUpdate=!0,this.cancelAutoUpdate();else{let e=this.updater();this.shallUpdate=!1,e instanceof Promise?(this.promise=e,e.then(r=>{this.promise=null,this.set(r),this.scheduleAutoUpdate()},r=>{this.promise=null,this.scheduleAutoUpdate(),console.log(r)})):this.scheduleAutoUpdate()}}catch(e){this.scheduleAutoUpdate(),console.log(e)}}cancel(){this.dispatch=null,this.promise=null,this.updateTimeout=0,this.cancelAutoUpdate()}waiting(e){return this.isWaiting==!0?f(m,{}):e(this.value)}using(e){return this.hasState==!1?f(m,{}):e(this.value)}};function Ae(t,e,r,o){let[i]=T.useState(()=>new x(r,o)),[s,n]=T.useState(r);return i.use(t,e),T.useEffect(()=>(i.initiate(n),()=>i.cancel()),null),i}function Me(t,...e){for(let r of e)if(r.isWaiting==!0)return f(m,{});return t()}function _e(t,...e){for(let r of e)if(r.hasState==!1)return f(m,{});return t()}function m(){return f("div",{children:"..."})}import D,{useContext as ie,useEffect as M,useMemo as oe,useState as ne}from"react";import G,{createContext as X,useContext as Y,useMemo as ee}from"react";var Q=`.JDT-ErrorBoundary {
2
2
  background-color: rgb(216, 59, 59);
3
3
  padding: 5px;
4
4
  overflow: hidden;
@@ -49,4 +49,4 @@ import{h as y,i as U,m as L}from"./chunk.I3IQPWRL.js";import{a as v,c as w,d as
49
49
  transform: scale(1);
50
50
  opacity: 1;
51
51
  }
52
- }`;document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(Q));import{jsx as S,jsxs as re}from"react/jsx-runtime";function h({error:t,onRetry:e}){let r=`${t.name}: ${t.message}`;return re("div",{className:"JDT-ErrorBoundary",title:r,children:[S("pre",{className:"msg",children:r}),e&&S("button",{className:"btn",onClick:e,children:"Retry"})]})}var P=X(null),R=class extends G.Component{},J=class extends R{static contextType=P;state={};componentDidCatch(e){let{context:r}=this,o=r?.getErrorDisplayer(e)||te(e);this.setState({error:e,displayer:o})}render(){let{error:e}=this.state;if(e){let r=this.state.displayer;return S(r,{error:e,onRetry:()=>this.setState({error:void 0})})}return this.props.children||null}};function Ze({errorClass:t,errorDisplayer:e,children:r}){let o=Y(P),i=ee(()=>({getErrorDisplayer(s){for(let n=s;n;n=Object.getPrototypeOf(n))if(n.constructor===t)return e;return o?.getErrorDisplayer(s)??null}}),[o,t,e]);return S(P.Provider,{value:i,children:r})}function te(t){for(let e=t;e;e=Object.getPrototypeOf(e)){let r=e.constructor,o=b.get(r);if(o)return o}return null}var b=new Map;b.set(Error,h);function $e(t,e){b.set(t,e)}import{jsx as p,jsxs as H}from"react/jsx-runtime";function M(){return H("div",{className:"JDT-Spinner",children:[p("div",{className:"JDT-Spinner__dot"}),p("div",{className:"JDT-Spinner__dot"}),p("div",{className:"JDT-Spinner__dot"})]})}var se=(i=>(i[i.NotReady=0]="NotReady",i[i.Loading=1]="Loading",i[i.Ready=2]="Ready",i[i.Failed=3]="Failed",i))(se||{}),d=class extends Error{constructor(r,o){super(`Missing service point: ${r.map(i=>i.id).join(", ")}`);this.missings=r;this.requireds=o}},C=class{consumers=new Set;getService(e){return e.services}addController(e){this.consumers.add(e)}removeController(e){return this.consumers.delete(e)}onServiceChangeHandler=e=>{for(let r of this.consumers)r.notifyChange(e)}},E=class{constructor(e){this.controller=e}getService(e){return this.controller.getService(e)}},I=class{constructor(e,r,o,i){this.support=e;this.requireds=r;this.requirements=o;this.onUpdate=i;e.addController(this)}services=new Map;provider=null;state=null;get status(){return this.state instanceof Promise?1:this.state instanceof d?3:this.state===null?0:2}get error(){if(this.state instanceof d)return this.state}getService(e){let r=this.services.get(e);return!r&&this.support&&(r=this.support.getService(e),this.services.set(e,this.support.getService(e))),e.services}notifyChange(e){this.services.has(e)&&this.update()}updateState(e){let r=this.state;r!==e&&(this.state=e,this.onUpdate?.(e,r,this))}update(){let{requireds:e,requirements:r}=this,o=[],i=null;function s(n){i||(i=new d([])),i.missings.includes(n)||i.missings.push(n)}if(e)for(let n of e)if(n.ready){let c=n.services;c&&this.services.set(n,c)}else o.push(n.fetch());if(r){let{servicePoints:n}=r;for(let c in n){let u=L(c);if(u.ready){let k=u.services,g=n[c];g.service&&u.service!==g.service||k.length<(g.cardinality||1)?s(u):this.services.set(u,k)}else o.push(u.fetch())}}if(o.length>0){let n=Promise.all(o).then(()=>this.update());return this.updateState(n),n}else i?this.updateState(i):(this.provider=new E(this),this.updateState(this.provider));return null}dispose(){this.support&&(this.support.removeController(this),this.support=null)}},V=new C;y(V.onServiceChangeHandler);var ce=D.createContext(V),_=D.createContext(V);function Ye(t){A(()=>{let e=y(t);return()=>U(e)},[t])}function ae(t,e){let r=D.useContext(_);if(!r)return console.error("Wrap in <MountServicePoints> before using service point:",t.id),null;let o=r.getService(t);if(o.length<(e===void 0?1:e))throw new d([t],[t]);return o}function et(t,e){return ae(t,e?0:1)[0]}function le(t,e){let r=ie(ce),[,o]=ne(null),i=oe(()=>new I(r,t,e,o),[t,e]);return A(()=>(i.update(),()=>i?.dispose()),[i]),i}function O(t){let{requireds:e,requirements:r,children:o}=t,i=le(e,r),{provider:s,error:n}=i;if(n){let c=t.configurator;return c?p(c,{services:n.missings}):p(h,{error:n})}else return s?H(_.Provider,{value:s,children:[o,i.status===1&&p(M,{})]}):p(M,{})}import{useState as W,useEffect as j}from"react";function ot(){let[t,e]=W(window.location);return j(()=>{let r=()=>{e(window.location)};return window.addEventListener("popstate",r),window.addEventListener("hashchange",r),()=>{window.removeEventListener("popstate",r),window.removeEventListener("hashchange",r)}},[]),t}function F(){let[t,e]=W(window.location.hash);return j(()=>{let r=()=>{e(window.location.hash)};return window.addEventListener("hashchange",r),()=>{window.removeEventListener("hashchange",r)}},[]),t}function nt(){let{search:t}=window.location,e={};if(t.startsWith("?"))for(let r of t.slice(1).split("&")){let o=r.split("=");e[o[0]]=decodeURIComponent(o[1])}return e}import{useCallback as ue,useState as pe}from"react";function de(t,e){try{let r=window.localStorage.getItem(t);if(typeof r=="string")return JSON.parse(r)}catch{}return e instanceof Function?e():e}function ve(t,e){return e===void 0?window.localStorage.removeItem(t):window.localStorage.setItem(t,JSON.stringify(e)),e}function at(t,e){let[r,o]=pe(de(t,e)),i=ue(s=>o(ve(t,s)),[t]);return[r,i]}import{useCallback as fe,useState as he}from"react";function me(t,e){try{let r=window.sessionStorage.getItem(t);if(typeof r=="string")return JSON.parse(r)}catch{}return e instanceof Function?e():e}function Se(t,e){return e===void 0?window.sessionStorage.removeItem(t):window.sessionStorage.setItem(t,JSON.stringify(e)),e}function pt(t,e){let[r,o]=he(me(t,e)),i=fe(s=>o(Se(t,s)),[t]);return[r,i]}import{useState as ge,useCallback as ye}from"react";function ft(){let[,t]=ge(0);return ye(()=>{t(r=>r+1)},[])}import we,{useContext as Te,useEffect as xe,useMemo as Z,useState as Pe}from"react";import{jsx as l}from"react/jsx-runtime";var $=we.createContext(null);async function Re(t,e,r){if(t)try{let{component:o,properties:i}=await q(t,e),s=v.spec(o),n=await N.fetch(o);if(!n)throw new Error(`Component '${t.name}' has no 'view.react' service`);let c=l($.Provider,{value:t,children:l(n,{...i})});return s?.requirements&&(c=l(O,{requirements:s?.requirements,configurator:null,children:c})),c}catch(o){return l(h,{error:o})}return r}function be(){return Te($)}function B(t){let{view:e,origin:r,fallback:o}=t,[i,s]=Pe(null),n=Z(()=>typeof e!="string"?e:w(e),[e]);return xe(()=>{Re(n,r,o).then(s)},[n]),i||null}function Ce(t){let{hash:e,fallback:r}=t,o=Z(()=>w(e),[e]);return l(B,{view:o,origin:"url",fallback:r})}function Ee(t){let e=F();return l(Ce,{hash:e,fallback:t.fallback})}function xt(t){let e=be();return e?e?.nested?l(B,{view:e?.nested,origin:"url",fallback:t.fallback}):t.fallback||null:l(Ee,{fallback:t.fallback})}export{x as AsyncState,J as ErrorBoundary,h as ErrorDisplayer,Ze as ErrorReconcilier,xt as InvokeNestedView,Ee as InvokeURLView,Ce as InvokeUrlHashView,B as InvokeView,d as MissingServiceError,Ve as ReactComponentSchema,_ as ServicePointsProviderContext,ce as ServicePointsSupportContext,se as ServiceStatus,O as UseServicePoints,N as ViewReactKey,ke as ViewWebComponentKey,nt as getLocationQuery,$e as registerErrorDisplayer,qe as useAsyncMemo,Me as useAsyncState,be as useCurrentView,ft as useForceUpdate,at as useLocalStorage,ot as useLocation,F as useLocationHash,et as useService,ae as useServices,le as useServicesController,Ye as useServicesListener,pt as useSessionStorage,_e as using,Ae as waiting};
52
+ }`;document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(Q));import{jsx as S,jsxs as re}from"react/jsx-runtime";function h({error:t,onRetry:e}){let r=`${t.name}: ${t.message}`;return re("div",{className:"JDT-ErrorBoundary",title:r,children:[S("pre",{className:"msg",children:r}),e&&S("button",{className:"btn",onClick:e,children:"Retry"})]})}var P=X(null),R=class extends G.Component{},J=class extends R{static contextType=P;state={};componentDidCatch(e){let{context:r}=this,o=r?.getErrorDisplayer(e)||te(e);this.setState({error:e,displayer:o})}render(){let{error:e}=this.state;if(e){let r=this.state.displayer;return S(r,{error:e,onRetry:()=>this.setState({error:void 0})})}return this.props.children||null}};function Ze({errorClass:t,errorDisplayer:e,children:r}){let o=Y(P),i=ee(()=>({getErrorDisplayer(s){for(let n=s;n;n=Object.getPrototypeOf(n))if(n.constructor===t)return e;return o?.getErrorDisplayer(s)??null}}),[o,t,e]);return S(P.Provider,{value:i,children:r})}function te(t){for(let e=t;e;e=Object.getPrototypeOf(e)){let r=e.constructor,o=b.get(r);if(o)return o}return null}var b=new Map;b.set(Error,h);function $e(t,e){b.set(t,e)}import{jsx as p,jsxs as H}from"react/jsx-runtime";function A(){return H("div",{className:"JDT-Spinner",children:[p("div",{className:"JDT-Spinner__dot"}),p("div",{className:"JDT-Spinner__dot"}),p("div",{className:"JDT-Spinner__dot"})]})}var se=(i=>(i[i.NotReady=0]="NotReady",i[i.Loading=1]="Loading",i[i.Ready=2]="Ready",i[i.Failed=3]="Failed",i))(se||{}),d=class extends Error{constructor(r,o){super(`Missing service point: ${r.map(i=>i.id).join(", ")}`);this.missings=r;this.requireds=o}},C=class{consumers=new Set;getService(e){return e.services}addController(e){this.consumers.add(e)}removeController(e){return this.consumers.delete(e)}onServiceChangeHandler=e=>{for(let r of this.consumers)r.notifyChange(e)}},E=class{constructor(e){this.controller=e}getService(e){return this.controller.getService(e)}},I=class{constructor(e,r,o,i){this.support=e;this.requireds=r;this.requirements=o;this.onUpdate=i;e.addController(this)}services=new Map;provider=null;state=null;get status(){return this.state instanceof Promise?1:this.state instanceof d?3:this.state===null?0:2}get error(){if(this.state instanceof d)return this.state}getService(e){let r=this.services.get(e);return!r&&this.support&&(r=this.support.getService(e),this.services.set(e,this.support.getService(e))),e.services}notifyChange(e){this.services.has(e)&&this.update()}updateState(e){let r=this.state;r!==e&&(this.state=e,this.onUpdate?.(e,r,this))}update(){let{requireds:e,requirements:r}=this,o=[],i=null;function s(n){i||(i=new d([])),i.missings.includes(n)||i.missings.push(n)}if(e)for(let n of e)if(n.ready){let c=n.services;c&&this.services.set(n,c)}else o.push(n.fetch());if(r){let{servicePoints:n}=r;for(let c in n){let u=L(c);if(u.ready){let k=u.services,g=n[c];g.service&&u.service!==g.service||k.length<(g.cardinality||1)?s(u):this.services.set(u,k)}else o.push(u.fetch())}}if(o.length>0){let n=Promise.all(o).then(()=>this.update());return this.updateState(n),n}else i?this.updateState(i):(this.provider=new E(this),this.updateState(this.provider));return null}dispose(){this.support&&(this.support.removeController(this),this.support=null)}},V=new C;y(V.onServiceChangeHandler);var ce=D.createContext(V),_=D.createContext(V);function Ye(t){M(()=>{let e=y(t);return()=>U(e)},[t])}function ae(t,e){let r=D.useContext(_);if(!r)return console.error("Wrap in <MountServicePoints> before using service point:",t.id),null;let o=r.getService(t);if(o.length<(e===void 0?1:e))throw new d([t],[t]);return o}function et(t,e){return ae(t,e?0:1)[0]}function le(t,e){let r=ie(ce),[,o]=ne(null),i=oe(()=>new I(r,t,e,o),[t,e]);return M(()=>(i.update(),()=>i?.dispose()),[i]),i}function O(t){let{requireds:e,requirements:r,children:o}=t,i=le(e,r),{provider:s,error:n}=i;if(n){let c=t.configurator;return c?p(c,{services:n.missings}):p(h,{error:n})}else return s?H(_.Provider,{value:s,children:[o,i.status===1&&p(A,{})]}):p(A,{})}import{useState as W,useEffect as j}from"react";function ot(){let[t,e]=W(window.location);return j(()=>{let r=()=>{e(window.location)};return window.addEventListener("popstate",r),window.addEventListener("hashchange",r),()=>{window.removeEventListener("popstate",r),window.removeEventListener("hashchange",r)}},[]),t}function F(){let[t,e]=W(window.location.hash);return j(()=>{let r=()=>{e(window.location.hash)};return window.addEventListener("hashchange",r),()=>{window.removeEventListener("hashchange",r)}},[]),t}function nt(){let{search:t}=window.location,e={};if(t.startsWith("?"))for(let r of t.slice(1).split("&")){let o=r.split("=");e[o[0]]=decodeURIComponent(o[1])}return e}import{useCallback as ue,useState as pe}from"react";function de(t,e){try{let r=window.localStorage.getItem(t);if(typeof r=="string")return JSON.parse(r)}catch{}return e instanceof Function?e():e}function ve(t,e){return e===void 0?window.localStorage.removeItem(t):window.localStorage.setItem(t,JSON.stringify(e)),e}function at(t,e){let[r,o]=pe(de(t,e)),i=ue(s=>o(ve(t,s)),[t]);return[r,i]}import{useCallback as fe,useState as he}from"react";function me(t,e){try{let r=window.sessionStorage.getItem(t);if(typeof r=="string")return JSON.parse(r)}catch{}return e instanceof Function?e():e}function Se(t,e){return e===void 0?window.sessionStorage.removeItem(t):window.sessionStorage.setItem(t,JSON.stringify(e)),e}function pt(t,e){let[r,o]=he(me(t,e)),i=fe(s=>o(Se(t,s)),[t]);return[r,i]}import{useState as ge,useCallback as ye}from"react";function ft(){let[,t]=ge(0);return ye(()=>{t(r=>r+1)},[])}import we,{useContext as Te,useEffect as xe,useMemo as Z,useState as Pe}from"react";import{jsx as l}from"react/jsx-runtime";var $=we.createContext(null);async function Re(t,e,r){if(t)try{let{component:o,properties:i}=await q(t,e),s=v.spec(o),n=await N.fetch(o);if(!n)throw new Error(`Component '${t.name}' has no 'view.react' service`);let c=l($.Provider,{value:t,children:l(n,{...i})});return s?.requirements&&(c=l(O,{requirements:s?.requirements,configurator:null,children:c})),c}catch(o){return l(h,{error:o})}return r}function be(){return Te($)}function B(t){let{view:e,origin:r,fallback:o}=t,[i,s]=Pe(null),n=Z(()=>typeof e!="string"?e:w(e),[e]);return xe(()=>{Re(n,r,o).then(s)},[n]),i||null}function Ce(t){let{hash:e,fallback:r}=t,o=Z(()=>w(e),[e]);return l(B,{view:o,origin:"url",fallback:r})}function Ee(t){let e=F();return l(Ce,{hash:e,fallback:t.fallback})}function xt(t){let e=be();return e?e?.nested?l(B,{view:e?.nested,origin:"url",fallback:t.fallback}):t.fallback||null:l(Ee,{fallback:t.fallback})}export{x as AsyncState,J as ErrorBoundary,h as ErrorDisplayer,Ze as ErrorReconcilier,xt as InvokeNestedView,Ee as InvokeURLView,Ce as InvokeUrlHashView,B as InvokeView,d as MissingServiceError,Ve as ReactComponentSchema,_ as ServicePointsProviderContext,ce as ServicePointsSupportContext,se as ServiceStatus,O as UseServicePoints,N as ViewReactKey,ke as ViewWebComponentKey,nt as getLocationQuery,$e as registerErrorDisplayer,qe as useAsyncMemo,Ae as useAsyncState,be as useCurrentView,ft as useForceUpdate,at as useLocalStorage,ot as useLocation,F as useLocationHash,et as useService,ae as useServices,le as useServicesController,Ye as useServicesListener,pt as useSessionStorage,_e as using,Me as waiting};
package/export.storage.js CHANGED
@@ -1 +1 @@
1
- import"./chunk.LFHCE3KB.js";import"./chunk.I3IQPWRL.js";import{a as e}from"./chunk.FZNTVWPG.js";var r=e.About("storage");export{r as StorageServiceKey};
1
+ import"./chunk.LFHCE3KB.js";import"./chunk.7V6KPYF2.js";import{a as e}from"./chunk.FZNTVWPG.js";var r=e.About("storage");export{r as StorageServiceKey};
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@jointhedots/core",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "type": "module",
5
5
  "singleton": true,
6
+ "packageManager": "pnpm@10.30.3",
6
7
  "dependencies": {
7
8
  "json-schema": "^0.4.0",
8
9
  "vscode-uri": "^3.1.0",
package/types.d.ts CHANGED
@@ -25,11 +25,11 @@ declare module '@jointhedots/core:src/common/types' {
25
25
  }
26
26
 
27
27
  declare module '@jointhedots/core:src/components/components' {
28
- import { URI } from '@jointhedots/core:src/components/vscode-uri';
28
+ import { URI } from 'vscode-uri';
29
29
  import type { DocumentationSchema, JSONSchema, ResourceEntry } from '@jointhedots/core:src/schema/schema';
30
30
  import type { ComponentEntry } from '@jointhedots/core:src/components/manifold';
31
31
  import { ServiceAccessor, type ServiceType } from '@jointhedots/core:src/services/service-accessor';
32
- import React from '@jointhedots/core:src/components/react';
32
+ import React from "react";
33
33
  export type ComponentID = string;
34
34
  export interface ComponentPublication {
35
35
  id: ComponentID;
@@ -147,7 +147,7 @@ declare module '@jointhedots/core:src/components/components' {
147
147
  }
148
148
 
149
149
  declare module '@jointhedots/core:src/components/helpers' {
150
- import { URI } from '@jointhedots/core:src/components/vscode-uri';
150
+ import { URI } from 'vscode-uri';
151
151
  import { type ComponentFilter, type ComponentManifest, type ComponentPublication } from '@jointhedots/core:src/components/components';
152
152
  import type { ResourceEntry, ResourceImport } from '@jointhedots/core:src/schema/schema';
153
153
  export function parseComponentURI(ref: string): URI;
@@ -289,7 +289,7 @@ declare module '@jointhedots/core:src/interfaces/commands/interface' {
289
289
  }
290
290
 
291
291
  declare module '@jointhedots/core:src/interfaces/react/ErrorBoundary' {
292
- import React from '@jointhedots/core:src/components/react';
292
+ import React from 'react';
293
293
  export type ErrorDisplayerType<E extends Error = Error> = React.ComponentType<{
294
294
  error: E;
295
295
  onRetry?: () => void;
@@ -345,9 +345,9 @@ declare module '@jointhedots/core:src/interfaces/react' {
345
345
  }
346
346
 
347
347
  declare module '@jointhedots/core:src/interfaces/react/interface' {
348
- import { z, type ZodObject, type ZodRawShape } from '@jointhedots/core:src/interfaces/react/zod';
348
+ import { z, type ZodObject, type ZodRawShape } from "zod";
349
349
  import { type ServiceDefinition, type ServiceInterface } from '@jointhedots/core:src/services';
350
- import React from '@jointhedots/core:src/components/react';
350
+ import React from "react";
351
351
  export type ViewServicePoint = {
352
352
  service?: string;
353
353
  cardinality?: number;
@@ -456,7 +456,7 @@ declare module '@jointhedots/core:src/interfaces/react/useAsyncMemo' {
456
456
  }
457
457
 
458
458
  declare module '@jointhedots/core:src/interfaces/react/useAsyncState' {
459
- import React from '@jointhedots/core:src/components/react';
459
+ import React from "react";
460
460
  export class AsyncState<T> {
461
461
  private value;
462
462
  private updateTimeout;
@@ -504,7 +504,7 @@ declare module '@jointhedots/core:src/interfaces/react/useLocation' {
504
504
  }
505
505
 
506
506
  declare module '@jointhedots/core:src/interfaces/react/useServices' {
507
- import React from '@jointhedots/core:src/components/react';
507
+ import React from "react";
508
508
  import { ServicePoint, type ServiceChangeHandler } from '@jointhedots/core:src/services/service-points';
509
509
  import type { ViewRequirements } from '@jointhedots/core:src/interfaces/react/interface';
510
510
  export type IService = unknown;
@@ -558,7 +558,7 @@ declare module '@jointhedots/core:src/interfaces/react/useSessionStorage' {
558
558
  }
559
559
 
560
560
  declare module '@jointhedots/core:src/interfaces/react/ViewUrl' {
561
- import { type ReactElement } from '@jointhedots/core:src/components/react';
561
+ import { type ReactElement } from "react";
562
562
  import { type ViewInfos } from '@jointhedots/core:src/interfaces/view/interface';
563
563
  export function useCurrentView(): any;
564
564
  export function InvokeView(props: {
@@ -579,7 +579,7 @@ declare module '@jointhedots/core:src/interfaces/react/ViewUrl' {
579
579
  }
580
580
 
581
581
  declare module '@jointhedots/core:src/interfaces/rest/decorators' {
582
- import type { Handler } from '@jointhedots/core:src/interfaces/rest/hono';
582
+ import type { Handler } from 'hono';
583
583
  export type RESTClass<T extends Object = any> = new (...args: any[]) => T;
584
584
  export type RESTResourceInfos = {
585
585
  path?: string;
@@ -613,7 +613,7 @@ declare module '@jointhedots/core:src/interfaces/rest/decorators' {
613
613
  }
614
614
 
615
615
  declare module '@jointhedots/core:src/interfaces/rest/interface' {
616
- import { URI } from '@jointhedots/core:src/components/vscode-uri';
616
+ import { URI } from "vscode-uri";
617
617
  import { ComponentEntry } from '@jointhedots/core:src/components/manifold';
618
618
  import { ServiceAccessor } from '@jointhedots/core:src/services/service-accessor';
619
619
  export interface RESTService {
@@ -943,7 +943,7 @@ declare module '@jointhedots/core:src/providers/components/StaticComponentProvid
943
943
  }
944
944
 
945
945
  declare module '@jointhedots/core:src/providers/resources/CommonResourceProvider' {
946
- import { URI } from '@jointhedots/core:src/components/vscode-uri';
946
+ import { URI } from "vscode-uri";
947
947
  import { type IContentProvider, type IResourceLoader } from '@jointhedots/core:src/components/components';
948
948
  export class CommonResourceProvider implements IResourceLoader {
949
949
  readonly storage: IContentProvider;
@@ -957,7 +957,7 @@ declare module '@jointhedots/core:src/providers/resources/CommonResourceProvider
957
957
  }
958
958
 
959
959
  declare module '@jointhedots/core:src/providers/resources/StaticContentProvider' {
960
- import { URI } from '@jointhedots/core:src/components/vscode-uri';
960
+ import { URI } from "vscode-uri";
961
961
  import type { IContentProvider } from '@jointhedots/core:src/components/components';
962
962
  export class StaticContentProvider implements IContentProvider {
963
963
  check_url_content(ref: string): Promise<string>;
@@ -1009,7 +1009,7 @@ declare module '@jointhedots/core:src/schema' {
1009
1009
  }
1010
1010
 
1011
1011
  declare module '@jointhedots/core:src/schema/schema' {
1012
- import { z } from '@jointhedots/core:src/interfaces/react/zod';
1012
+ import { z } from "zod";
1013
1013
  export const JSONSchema7TypeNameSchema: z.ZodEnum<{
1014
1014
  array: "array";
1015
1015
  boolean: "boolean";
@@ -1388,7 +1388,7 @@ declare module '@jointhedots/core:src/schema/schema' {
1388
1388
  }
1389
1389
 
1390
1390
  declare module '@jointhedots/core:src/schema/zod' {
1391
- import { z, type ZodType } from '@jointhedots/core:src/interfaces/react/zod';
1391
+ import { z, type ZodType } from "zod";
1392
1392
  import { type JSONSchema, type ServiceSchema } from '@jointhedots/core:src/schema/schema';
1393
1393
  export class ZodService<T = unknown> {
1394
1394
  readonly $spec: string;
@@ -1465,7 +1465,7 @@ declare module '@jointhedots/core:src/services/service-accessor' {
1465
1465
  declare module '@jointhedots/core:src/services/service-definitions' {
1466
1466
  import type { ServiceSchema } from '@jointhedots/core:src/schema/schema';
1467
1467
  import { ZodService } from '@jointhedots/core:src/schema/zod';
1468
- import type { ZodType } from '@jointhedots/core:src/interfaces/react/zod';
1468
+ import type { ZodType } from "zod";
1469
1469
  import { type ServiceSpecification, type ServiceCompatibility } from '@jointhedots/core:src/services/service-specification';
1470
1470
  /**
1471
1471
  * ServiceDefinition is a concrete definition linking a specification to implementation.
@@ -1547,7 +1547,7 @@ declare module '@jointhedots/core:src/services/service-points' {
1547
1547
 
1548
1548
  declare module '@jointhedots/core:src/services/service-specification' {
1549
1549
  import type { JSONSchema } from '@jointhedots/core:src/schema/schema';
1550
- import type { ZodType } from '@jointhedots/core:src/interfaces/react/zod';
1550
+ import type { ZodType } from "zod";
1551
1551
  /**
1552
1552
  * ServiceSpecification defines the metadata and schema for a service interface.
1553
1553
  * It describes the contract that providers must implement and consumers can rely on.