@stonecrop/stonecrop 0.3.5 → 0.3.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.
@@ -8,7 +8,7 @@ Only state can be modified.`);i[0]="$state",me=!1,r.set(s,i,r.state.value),me=!0
8
8
  state: () => new MyClass()
9
9
  Found in store "${S.$id}".`),b&&s&&n.hydrate&&n.hydrate(S.$state,b),l=!0,f=!0,S}/*! #__NO_SIDE_EFFECTS__ */function $r(e,t,n){let r,o;const s=typeof t=="function";r=e,o=s?n:t;function i(a,c){const l=m.hasInjectionContext();if(a=(process.env.NODE_ENV==="test"&&Oe&&Oe._testing?null:a)||(l?m.inject(kt,null):null),a&&Ne(a),process.env.NODE_ENV!=="production"&&!Oe)throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
10
10
  See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
11
- This will fail in production.`);a=Oe,a._s.has(r)||(s?Ze(r,t,o,a):Ft(r,o,a),process.env.NODE_ENV!=="production"&&(i._pinia=a));const f=a._s.get(r);if(process.env.NODE_ENV!=="production"&&c){const u="__hot:"+r,d=s?Ze(u,t,o,a,!0):Ft(u,z({},o),a,!0);c._hotUpdate(d),delete a.state.value[u],a._s.delete(u)}if(process.env.NODE_ENV!=="production"&&re){const u=m.getCurrentInstance();if(u&&u.proxy&&!c){const d=u.proxy,h="_pStores"in d?d._pStores:d._pStores={};h[r]=f}}return f}return i.$id=r,i}const Ir=$r("data",()=>{const e=m.ref([]),t=m.ref({});return{records:e,record:t}});function Cr(e){e||(e=m.inject("$registry"));let t;try{t=Ir()}catch{throw new Error("Please enable the Stonecrop plugin before using the Stonecrop composable")}const n=m.ref(new Ge(e,t)),r=m.ref(!1);return m.onBeforeMount(async()=>{var c,l;const o=e.router.currentRoute.value,s=(c=o.params.records)==null?void 0:c.toString().toLowerCase(),i=(l=o.params.record)==null?void 0:l.toString().toLowerCase();if(!s&&!i)return;const a=await e.getMeta(s);e.addDoctype(a),n.value.setup(a),s&&(i?await n.value.getRecord(a,i):await n.value.getRecords(a)),n.value.runAction(a,"LOAD",i?[i]:void 0),r.value=!0}),{stonecrop:n,isReady:r}}class Tr{constructor(t,n,r,o,s){L(this,"doctype");L(this,"schema");L(this,"workflow");L(this,"actions");L(this,"component");this.doctype=t,this.schema=n,this.workflow=r,this.actions=o,this.component=s}get slug(){return this.doctype.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}get __typename(){return this.doctype}}const we=class we{constructor(t,n){L(this,"name");L(this,"router");L(this,"registry");L(this,"getMeta");if(we._root)return we._root;we._root=this,this.name="Registry",this.router=t,this.registry={},this.getMeta=n}addDoctype(t){t.doctype in Object.keys(this.registry)||(this.registry[t.slug]=t),this.router.hasRoute(t.doctype)||this.router.addRoute({path:`/${t.slug}`,name:t.slug,component:t.component})}};L(we,"_root");let je=we;/*!
11
+ This will fail in production.`);a=Oe,a._s.has(r)||(s?Ze(r,t,o,a):Ft(r,o,a),process.env.NODE_ENV!=="production"&&(i._pinia=a));const f=a._s.get(r);if(process.env.NODE_ENV!=="production"&&c){const u="__hot:"+r,d=s?Ze(u,t,o,a,!0):Ft(u,z({},o),a,!0);c._hotUpdate(d),delete a.state.value[u],a._s.delete(u)}if(process.env.NODE_ENV!=="production"&&re){const u=m.getCurrentInstance();if(u&&u.proxy&&!c){const d=u.proxy,h="_pStores"in d?d._pStores:d._pStores={};h[r]=f}}return f}return i.$id=r,i}const Ir=$r("data",()=>{const e=m.ref([]),t=m.ref({});return{records:e,record:t}});function Cr(e){e||(e=m.inject("$registry"));let t;try{t=Ir()}catch{throw new Error("Please enable the Stonecrop plugin before using the Stonecrop composable")}const n=m.ref(new Ge(e,t)),r=m.ref(!1);return m.onBeforeMount(async()=>{var c,l;const o=e.router.currentRoute.value,s=(c=o.params.records)==null?void 0:c.toString().toLowerCase(),i=(l=o.params.record)==null?void 0:l.toString().toLowerCase();if(!s&&!i)return;const a=await e.getMeta(s);e.addDoctype(a),n.value.setup(a),s&&(i?await n.value.getRecord(a,i):await n.value.getRecords(a)),n.value.runAction(a,"LOAD",i?[i]:void 0),r.value=!0}),{stonecrop:n,isReady:r}}class Tr{constructor(t,n,r,o,s){L(this,"doctype");L(this,"schema");L(this,"workflow");L(this,"actions");L(this,"component");this.doctype=t,this.schema=n,this.workflow=r,this.actions=o,this.component=s}get slug(){return this.doctype.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}}const we=class we{constructor(t,n){L(this,"name");L(this,"router");L(this,"registry");L(this,"getMeta");if(we._root)return we._root;we._root=this,this.name="Registry",this.router=t,this.registry={},this.getMeta=n}addDoctype(t){t.doctype in Object.keys(this.registry)||(this.registry[t.slug]=t),this.router.hasRoute(t.doctype)||this.router.addRoute({path:`/${t.slug}`,name:t.slug,component:t.component})}};L(we,"_root");let je=we;/*!
12
12
  * vue-router v4.5.0
13
13
  * (c) 2024 Eduardo San Martin Morote
14
14
  * @license MIT