@flyo/nitro-vue3 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -182,30 +182,17 @@ Every composable returns the same reactive shape:
182
182
 
183
183
  ## Live-edit support
184
184
 
185
- When your site is embedded in the Flyo preview iframe, you can enable a full live-editing experience by passing `liveEdit: true` to the plugin options and using the `useFlyoLiveEdit` composable together with the `editable` helper.
185
+ When your site is embedded in the Flyo preview iframe, you can enable a full live-editing experience by passing `liveEdit: true` to the plugin options. `FlyoPage` now initializes `useFlyoLiveEdit()` automatically in component setup, so users no longer need to call it manually in `App.vue` or a root layout.
186
186
 
187
187
  ### `useFlyoLiveEdit()`
188
188
 
189
- Call this composable **once** in your root layout or `App.vue`. It activates the bridge features from `@flyo/nitro-js-bridge` when `liveEdit` is enabled:
189
+ This composable is automatically called by `FlyoPage` when `liveEdit` is enabled. It activates the bridge features from `@flyo/nitro-js-bridge`:
190
190
 
191
191
  - **`reload()`** — reloads the page when Flyo sends a `pageRefresh` message.
192
192
  - **`scrollTo()`** — scrolls to a specific block when Flyo sends a `scrollTo` message.
193
193
  - **`highlightAndClick()`** — adds hover highlight and click-to-edit on every element with a `data-flyo-uid` attribute. A `MutationObserver` automatically wires up elements that are added after the initial render.
194
194
 
195
- The composable is a no-op when `liveEdit` is `false`, so it is safe to include unconditionally.
196
-
197
- ```vue
198
- <!-- App.vue or your root layout component -->
199
- <script setup>
200
- import { useFlyoLiveEdit } from '@flyo/nitro-vue3'
201
-
202
- useFlyoLiveEdit()
203
- </script>
204
-
205
- <template>
206
- <router-view />
207
- </template>
208
- ```
195
+ The composable remains exported for advanced use-cases, and it is a no-op when `liveEdit` is `false`.
209
196
 
210
197
  ### `editable(block)`
211
198
 
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const O=require("@flyo/nitro-typescript"),s=require("vue");let te=null;const de=({apiToken:t,apiBasePath:n,defaultHeaders:i})=>{te=new O.Configuration({apiKey:t,...n&&{basePath:n},headers:i||{}})},N=()=>te,ce={name:"FlyoBlock"},H=Object.assign(ce,{props:{item:{type:Object,default:()=>{}}},setup(t){return(n,i)=>(s.openBlock(),s.createBlock(s.resolveDynamicComponent(t.item.component),{config:t.item.config,content:t.item.content,items:t.item.items,slots:t.item.slots},null,8,["config","content","items","slots"]))}}),fe={name:"FlyoPage"},I=Object.assign(fe,{props:{page:{type:[Object,Boolean],default:!1}},emits:["update:page"],setup(t,{emit:n}){const i=t,r=n,{liveEdit:e,liveEditOrigin:o}=s.inject("flyo"),a=u=>{const d=u.parent||u.opener;return u.self===d?!1:u.parent||u.opener},f=u=>{e&&process.client&&a(window)&&a(window).postMessage({action:"openEdit",data:JSON.parse(JSON.stringify({page:i.page,item:u}))},o)};return process.client&&a(window)&&window.addEventListener("message",u=>{if(u.origin!==o){console.log(`Message from ${u.origin} blocked. Expected ${o}.`);return}const d=u.data;d.action==="pageRefresh"&&r("update:page",d.data)}),(u,d)=>{const y=s.resolveComponent("FlyoBlock");return s.openBlock(),s.createElementBlock("div",null,[t.page?s.renderSlot(u.$slots,"default",s.normalizeProps(s.mergeProps({key:0},t.page)),()=>[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(t.page.json,v=>(s.openBlock(),s.createBlock(y,{key:v.uid,item:v,onClick:()=>f(v)},null,8,["item","onClick"]))),128))]):s.createCommentVNode("",!0)])}}}),c=s.reactive({isLoading:null,response:null,error:null}),ye=()=>{const t=async()=>{try{c.error=null,c.isLoading=!0,c.response=JSON.parse(JSON.stringify(await new O.ConfigApi(N()).config())),c.isLoading=!1}catch(n){c.isLoading=!1,c.response=null,c.error=JSON.parse(JSON.stringify(n))}return{response:c.response,error:c.error}};return{...s.toRefs(c),fetch:t}},pe=t=>{const n=s.ref(!1),i=s.ref(null),r=s.ref(null);return{isLoading:n,response:i,error:r,fetch:async()=>{try{r.value=null,n.value=!0,i.value=JSON.parse(JSON.stringify(await new O.EntitiesApi(N()).entityByUniqueid({uniqueid:t}))),n.value=!1}catch(o){n.value=!1,i.value=null,r.value=JSON.parse(JSON.stringify(o))}return{response:s.unref(i),error:s.unref(r)}}}};function B(){return typeof window>"u"?!1:window!==window.top}function me(){return typeof window>"u"?!1:B()?window.parent:window}function ve(t){var n=me();n&&n.postMessage({action:"openEdit",data:JSON.parse(JSON.stringify({item:{uid:t}}))},"https://flyo.cloud")}function ge(){typeof window>"u"||B()&&window.addEventListener("message",t=>{var n;((n=t.data)==null?void 0:n.action)==="pageRefresh"&&window.location.reload()})}function he(){typeof window>"u"||B()&&window.addEventListener("message",t=>{var n,i,r,e;if(((n=t.data)==null?void 0:n.action)==="scrollTo"){const o=(e=(r=(i=t.data)==null?void 0:i.data)==null?void 0:r.item)==null?void 0:e.uid;if(!o)return;const a=document.querySelector(`[data-flyo-uid="${CSS.escape(o)}"]`);a&&a.scrollIntoView({behavior:"smooth",block:"start"})}})}function we(t,n){const i=()=>ve(t);if(!B()||!n)return i;const r=n,e=document.createElement("button");e.type="button",e.setAttribute("aria-label","Edit block"),e.style.position="fixed",e.style.top="0px",e.style.left="0px",e.style.zIndex="9999",e.style.width="44px",e.style.height="44px",e.style.display="none",e.style.alignItems="center",e.style.justifyContent="center",e.style.border="0px solid #000",e.style.borderRadius="9999px",e.style.boxSizing="border-box",e.style.cursor="pointer",e.style.background="#FFD466",e.innerHTML='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25z" fill="#111"/><path d="M20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" fill="#111"/></svg>';const o=document.createElement("div");o.style.position="fixed",o.style.top="0px",o.style.left="0px",o.style.zIndex="9998",o.style.display="none",o.style.pointerEvents="none",o.style.background="transparent",o.style.border="none",e.addEventListener("click",i),document.body.appendChild(o),document.body.appendChild(e);const a=44,f=6,u=6,d=6,y=10,v=180,F=()=>window.innerWidth||document.documentElement.clientWidth,C=()=>window.innerHeight||document.documentElement.clientHeight,oe=l=>!(l.bottom<0||l.right<0||l.top>C()||l.left>F()||l.width===0&&l.height===0),$=(l,m)=>l>=d&&m>=d&&l+a<=F()-d&&m+a<=C()-d,W=(l,m)=>({x:Math.max(d,Math.min(l,F()-a-d)),y:Math.max(d,Math.min(m,C()-a-d))});function A(){const l=r.getBoundingClientRect(),m=l.width<a||l.height<a,L=Math.round(l.left),x=Math.round(l.top)-a-u,T=Math.round(l.left)+f,P=Math.round(l.top)+f;let M,S;if(m&&$(L,x))M=L,S=x;else if($(T,P))M=T,S=P;else if($(L,x))M=L,S=x;else{const _=W(L,x),q=W(T,P),ae=Math.abs(_.x-l.left)+Math.abs(_.y-l.top),ue=Math.abs(q.x-l.left)+Math.abs(q.y-l.top);({x:M,y:S}=ae<=ue?_:q)}e.style.left=`${M}px`,e.style.top=`${S}px`;const Z=Math.max(d,Math.round(l.left)-y),ee=Math.max(d,Math.round(l.top)-y),le=Math.min(F()-d,Math.round(l.right)+y),re=Math.min(C()-d,Math.round(l.bottom)+y);o.style.left=`${Z}px`,o.style.top=`${ee}px`,o.style.width=`${Math.max(0,le-Z)}px`,o.style.height=`${Math.max(0,re-ee)}px`}let g=!1,h=!1,w=!1,J=!1,E=null;const k=()=>{E!==null&&(clearTimeout(E),E=null)},j=()=>{k();try{const l=r.getBoundingClientRect();if(!oe(l)){b(!0);return}A(),e.style.display="flex",o.style.display="block",se()}catch{b(!0)}},b=(l=!1)=>{if(l){k(),e.style.display="none",o.style.display="none",R();return}k(),E=window.setTimeout(()=>{!g&&!h&&!w&&(e.style.display="none",o.style.display="none",R()),E=null},v)},z=()=>{e.style.display!=="none"&&A()},D=z;let p=null;const V=window.ResizeObserver,se=()=>{J||(J=!0,window.addEventListener("scroll",z,!0),window.addEventListener("resize",D),typeof V=="function"&&(p=new V(()=>{e.style.display!=="none"&&A()}),p==null||p.observe(r)))},R=()=>{if(J){J=!1,window.removeEventListener("scroll",z,!0),window.removeEventListener("resize",D);try{p==null||p.disconnect()}catch{}p=null}},U=()=>{g=!0,j()},K=()=>{g=!1,!h&&!w&&b()},G=()=>{h=!0,j()},Q=()=>{h=!1,!g&&!w&&b()},X=()=>{w=!0,j()},Y=()=>{w=!1,!g&&!h&&b()};r.addEventListener("mouseenter",U),r.addEventListener("mouseleave",K),e.addEventListener("mouseenter",G),e.addEventListener("mouseleave",Q),o.addEventListener("mouseenter",X),o.addEventListener("mouseleave",Y),e.addEventListener("click",i);function ie(){k(),R(),e.removeEventListener("click",i),r.removeEventListener("mouseenter",U),r.removeEventListener("mouseleave",K),e.removeEventListener("mouseenter",G),e.removeEventListener("mouseleave",Q),o.removeEventListener("mouseenter",X),o.removeEventListener("mouseleave",Y),e.parentElement===document.body&&document.body.removeChild(e),o.parentElement===document.body&&document.body.removeChild(o)}return ie}const Ee=t=>typeof(t==null?void 0:t.uid)=="string"&&t.uid.trim()!==""?{"data-flyo-uid":t.uid}:{},be=()=>{const{liveEdit:t}=s.inject("flyo");if(!t)return;let n=null;const i=[],r=()=>{i.forEach(e=>e()),i.length=0,document.querySelectorAll("[data-flyo-uid]").forEach(e=>{const o=e.getAttribute("data-flyo-uid");if(o&&e instanceof HTMLElement){const a=we(o,e);typeof a=="function"&&i.push(a)}})};s.onMounted(()=>{ge(),he(),r(),n=new MutationObserver(e=>{e.some(a=>Array.from(a.addedNodes).some(f=>{if(f.nodeType===Node.ELEMENT_NODE){const u=f;return u.hasAttribute("data-flyo-uid")||u.querySelector("[data-flyo-uid]")}return!1}))&&r()}),n.observe(document.body,{childList:!0,subtree:!0})}),s.onUnmounted(()=>{n&&n.disconnect(),i.forEach(e=>e()),i.length=0})},Le=t=>{const n=s.ref(!1),i=s.ref(null),r=s.ref(null);return{isLoading:n,response:i,error:r,fetch:async()=>{try{r.value=null,n.value=!0,i.value=JSON.parse(JSON.stringify(await new O.PagesApi(N()).page({slug:t}))),n.value=!1}catch(o){n.value=!1,i.value=null,r.value=JSON.parse(JSON.stringify(o))}return{response:s.unref(i),error:s.unref(r)}}}},xe=()=>{const t=s.ref(!1),n=s.ref(null),i=s.ref(null);return{isLoading:t,response:n,error:i,fetch:async()=>{try{i.value=null,t.value=!0,n.value=JSON.parse(JSON.stringify(await new O.SitemapApi(N()).sitemap())),t.value=!1}catch(e){t.value=!1,n.value=null,i.value=JSON.parse(JSON.stringify(e))}return{response:s.unref(n),error:s.unref(i)}}}},ne={install(t,n){de(n),t.component(H.name,H),t.component(I.name,I),t.provide("flyo",{liveEdit:n.liveEdit,liveEditOrigin:n.liveEditOrigin})}};exports.Block=H;exports.FlyoVue=ne;exports.Page=I;exports.default=ne;exports.editable=Ee;exports.getFlyoConfig=N;exports.useFlyoConfig=ye;exports.useFlyoEntity=pe;exports.useFlyoLiveEdit=be;exports.useFlyoPage=Le;exports.useFlyoSitemap=xe;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const x=require("@flyo/nitro-typescript"),o=require("vue");let le=null;const he=({apiToken:e,apiBasePath:n,defaultHeaders:l})=>{le=new x.Configuration({apiKey:e,...n&&{basePath:n},headers:l||{}})},M=()=>le,ge={name:"FlyoBlock"},I=Object.assign(ge,{props:{item:{type:Object,default:()=>{}}},setup(e){return(n,l)=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(e.item.component),{block:e.item,config:e.item.config,content:e.item.content,items:e.item.items,slots:e.item.slots},null,8,["block","config","content","items","slots"]))}});function B(){return typeof window>"u"?!1:window!==window.top}function we(){return typeof window>"u"?!1:B()?window.parent:window}function Ee(e){var n=we();n&&n.postMessage({action:"openEdit",data:JSON.parse(JSON.stringify({item:{uid:e}}))},"https://flyo.cloud")}function be(){typeof window>"u"||B()&&window.addEventListener("message",e=>{var n;((n=e.data)==null?void 0:n.action)==="pageRefresh"&&window.location.reload()})}function Le(){typeof window>"u"||B()&&window.addEventListener("message",e=>{var n,l,r,t;if(((n=e.data)==null?void 0:n.action)==="scrollTo"){const s=(t=(r=(l=e.data)==null?void 0:l.data)==null?void 0:r.item)==null?void 0:t.uid;if(!s)return;const u=document.querySelector(`[data-flyo-uid="${CSS.escape(s)}"]`);u&&u.scrollIntoView({behavior:"smooth",block:"start"})}})}function xe(e,n){const l=()=>Ee(e);if(!B()||!n)return l;const r=n,t=document.createElement("button");t.type="button",t.setAttribute("aria-label","Edit block"),t.style.position="fixed",t.style.top="0px",t.style.left="0px",t.style.zIndex="9999",t.style.width="44px",t.style.height="44px",t.style.display="none",t.style.alignItems="center",t.style.justifyContent="center",t.style.border="0px solid #000",t.style.borderRadius="9999px",t.style.boxSizing="border-box",t.style.cursor="pointer",t.style.background="#FFD466",t.innerHTML='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25z" fill="#111"/><path d="M20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" fill="#111"/></svg>';const s=document.createElement("div");s.style.position="fixed",s.style.top="0px",s.style.left="0px",s.style.zIndex="9998",s.style.display="none",s.style.pointerEvents="none",s.style.background="transparent",s.style.border="none",t.addEventListener("click",l),document.body.appendChild(s),document.body.appendChild(t);const u=44,V=6,ae=6,a=6,S=10,ue=180,O=()=>window.innerWidth||document.documentElement.clientWidth,N=()=>window.innerHeight||document.documentElement.clientHeight,de=i=>!(i.bottom<0||i.right<0||i.top>N()||i.left>O()||i.width===0&&i.height===0),z=(i,f)=>i>=a&&f>=a&&i+u<=O()-a&&f+u<=N()-a,U=(i,f)=>({x:Math.max(a,Math.min(i,O()-u-a)),y:Math.max(a,Math.min(f,N()-u-a))});function A(){const i=r.getBoundingClientRect(),f=i.width<u||i.height<u,g=Math.round(i.left),w=Math.round(i.top)-u-ae,P=Math.round(i.left)+V,R=Math.round(i.top)+V;let E,b;if(f&&z(g,w))E=g,b=w;else if(z(P,R))E=P,b=R;else if(z(g,w))E=g,b=w;else{const _=U(g,w),q=U(P,R),me=Math.abs(_.x-i.left)+Math.abs(_.y-i.top),ve=Math.abs(q.x-i.left)+Math.abs(q.y-i.top);({x:E,y:b}=me<=ve?_:q)}t.style.left=`${E}px`,t.style.top=`${b}px`;const te=Math.max(a,Math.round(i.left)-S),ne=Math.max(a,Math.round(i.top)-S),ye=Math.min(O()-a,Math.round(i.right)+S),pe=Math.min(N()-a,Math.round(i.bottom)+S);s.style.left=`${te}px`,s.style.top=`${ne}px`,s.style.width=`${Math.max(0,ye-te)}px`,s.style.height=`${Math.max(0,pe-ne)}px`}let y=!1,p=!1,m=!1,F=!1,v=null;const C=()=>{v!==null&&(clearTimeout(v),v=null)},$=()=>{C();try{const i=r.getBoundingClientRect();if(!de(i)){h(!0);return}A(),t.style.display="flex",s.style.display="block",ce()}catch{h(!0)}},h=(i=!1)=>{if(i){C(),t.style.display="none",s.style.display="none",j();return}C(),v=window.setTimeout(()=>{!y&&!p&&!m&&(t.style.display="none",s.style.display="none",j()),v=null},ue)},T=()=>{t.style.display!=="none"&&A()},W=T;let c=null;const K=window.ResizeObserver,ce=()=>{F||(F=!0,window.addEventListener("scroll",T,!0),window.addEventListener("resize",W),typeof K=="function"&&(c=new K(()=>{t.style.display!=="none"&&A()}),c==null||c.observe(r)))},j=()=>{if(F){F=!1,window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",W);try{c==null||c.disconnect()}catch{}c=null}},G=()=>{y=!0,$()},Q=()=>{y=!1,!p&&!m&&h()},X=()=>{p=!0,$()},Y=()=>{p=!1,!y&&!m&&h()},Z=()=>{m=!0,$()},ee=()=>{m=!1,!y&&!p&&h()};r.addEventListener("mouseenter",G),r.addEventListener("mouseleave",Q),t.addEventListener("mouseenter",X),t.addEventListener("mouseleave",Y),s.addEventListener("mouseenter",Z),s.addEventListener("mouseleave",ee),t.addEventListener("click",l);function fe(){C(),j(),t.removeEventListener("click",l),r.removeEventListener("mouseenter",G),r.removeEventListener("mouseleave",Q),t.removeEventListener("mouseenter",X),t.removeEventListener("mouseleave",Y),s.removeEventListener("mouseenter",Z),s.removeEventListener("mouseleave",ee),t.parentElement===document.body&&document.body.removeChild(t),s.parentElement===document.body&&document.body.removeChild(s)}return fe}let L=null,k=0,J=!1;const H=[],ie=()=>{H.forEach(e=>e()),H.length=0},oe=()=>{ie(),document.querySelectorAll("[data-flyo-uid]").forEach(e=>{const n=e.getAttribute("data-flyo-uid");if(n&&e instanceof HTMLElement){const l=xe(n,e);typeof l=="function"&&H.push(l)}})},Me=()=>{J||(be(),Le(),oe(),L=new MutationObserver(e=>{e.some(l=>Array.from(l.addedNodes).some(r=>{if(r.nodeType!==Node.ELEMENT_NODE)return!1;const t=r;return t.hasAttribute("data-flyo-uid")||t.querySelector("[data-flyo-uid]")}))&&oe()}),L.observe(document.body,{childList:!0,subtree:!0}),J=!0)},Se=()=>{J&&(L&&(L.disconnect(),L=null),ie(),J=!1)},Oe=e=>typeof(e==null?void 0:e.uid)=="string"&&e.uid.trim()!==""?{"data-flyo-uid":e.uid}:{},se=()=>{const e=o.inject("flyo");e!=null&&e.liveEdit&&(o.onMounted(()=>{k+=1,Me()}),o.onUnmounted(()=>{k=Math.max(0,k-1),k===0&&Se()}))},Ne={name:"FlyoPage"},D=Object.assign(Ne,{props:{page:{type:[Object,Boolean],default:!1}},setup(e){return se(),(n,l)=>{const r=o.resolveComponent("FlyoBlock");return o.openBlock(),o.createElementBlock("div",null,[e.page?o.renderSlot(n.$slots,"default",o.normalizeProps(o.mergeProps({key:0},e.page)),()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.page.json,t=>(o.openBlock(),o.createBlock(r,{key:t.uid,item:t},null,8,["item"]))),128))]):o.createCommentVNode("",!0)])}}}),d=o.reactive({isLoading:null,response:null,error:null}),Fe=()=>{const e=async()=>{try{d.error=null,d.isLoading=!0,d.response=JSON.parse(JSON.stringify(await new x.ConfigApi(M()).config())),d.isLoading=!1}catch(n){d.isLoading=!1,d.response=null,d.error=JSON.parse(JSON.stringify(n))}return{response:d.response,error:d.error}};return{...o.toRefs(d),fetch:e}},Ce=e=>{const n=o.ref(!1),l=o.ref(null),r=o.ref(null);return{isLoading:n,response:l,error:r,fetch:async()=>{try{r.value=null,n.value=!0,l.value=JSON.parse(JSON.stringify(await new x.EntitiesApi(M()).entityByUniqueid({uniqueid:e}))),n.value=!1}catch(s){n.value=!1,l.value=null,r.value=JSON.parse(JSON.stringify(s))}return{response:o.unref(l),error:o.unref(r)}}}},ke=e=>{const n=o.ref(!1),l=o.ref(null),r=o.ref(null);return{isLoading:n,response:l,error:r,fetch:async()=>{try{r.value=null,n.value=!0,l.value=JSON.parse(JSON.stringify(await new x.PagesApi(M()).page({slug:e}))),n.value=!1}catch(s){n.value=!1,l.value=null,r.value=JSON.parse(JSON.stringify(s))}return{response:o.unref(l),error:o.unref(r)}}}},Je=()=>{const e=o.ref(!1),n=o.ref(null),l=o.ref(null);return{isLoading:e,response:n,error:l,fetch:async()=>{try{l.value=null,e.value=!0,n.value=JSON.parse(JSON.stringify(await new x.SitemapApi(M()).sitemap())),e.value=!1}catch(t){e.value=!1,n.value=null,l.value=JSON.parse(JSON.stringify(t))}return{response:o.unref(n),error:o.unref(l)}}}},re={install(e,n){he(n),e.component(I.name,I),e.component(D.name,D),e.provide("flyo",{liveEdit:n.liveEdit,liveEditOrigin:n.liveEditOrigin})}};exports.Block=I;exports.FlyoVue=re;exports.Page=D;exports.default=re;exports.editable=Oe;exports.getFlyoConfig=M;exports.useFlyoConfig=Fe;exports.useFlyoEntity=Ce;exports.useFlyoLiveEdit=se;exports.useFlyoPage=ke;exports.useFlyoSitemap=Je;
package/dist/index.mjs CHANGED
@@ -1,15 +1,15 @@
1
- import { Configuration as pe, ConfigApi as ye, EntitiesApi as me, PagesApi as ve, SitemapApi as ge } from "@flyo/nitro-typescript";
2
- import { openBlock as k, createBlock as oe, resolveDynamicComponent as he, inject as se, resolveComponent as we, createElementBlock as ee, renderSlot as Ee, normalizeProps as be, mergeProps as Le, Fragment as xe, renderList as Me, createCommentVNode as Oe, reactive as Se, toRefs as Ne, ref as c, unref as v, onMounted as Ce, onUnmounted as Je } from "vue";
3
- let ie = null;
4
- const Fe = ({ apiToken: t, apiBasePath: n, defaultHeaders: s }) => {
5
- ie = new pe({
6
- apiKey: t,
1
+ import { Configuration as ge, ConfigApi as we, EntitiesApi as Ee, PagesApi as be, SitemapApi as Le } from "@flyo/nitro-typescript";
2
+ import { openBlock as F, createBlock as ie, resolveDynamicComponent as xe, inject as Me, onMounted as Se, onUnmounted as Oe, resolveComponent as Ne, createElementBlock as ne, renderSlot as Ce, normalizeProps as Je, mergeProps as Fe, Fragment as ke, renderList as Be, createCommentVNode as ze, reactive as Ae, toRefs as $e, ref as d, unref as y } from "vue";
3
+ let re = null;
4
+ const Re = ({ apiToken: e, apiBasePath: n, defaultHeaders: o }) => {
5
+ re = new ge({
6
+ apiKey: e,
7
7
  ...n && { basePath: n },
8
- headers: s || {}
8
+ headers: o || {}
9
9
  });
10
- }, $ = () => ie, ke = {
10
+ }, B = () => re, je = {
11
11
  name: "FlyoBlock"
12
- }, te = /* @__PURE__ */ Object.assign(ke, {
12
+ }, oe = /* @__PURE__ */ Object.assign(je, {
13
13
  props: {
14
14
  item: {
15
15
  type: Object,
@@ -17,301 +17,283 @@ const Fe = ({ apiToken: t, apiBasePath: n, defaultHeaders: s }) => {
17
17
  }
18
18
  }
19
19
  },
20
- setup(t) {
21
- return (n, s) => (k(), oe(he(t.item.component), {
22
- config: t.item.config,
23
- content: t.item.content,
24
- items: t.item.items,
25
- slots: t.item.slots
26
- }, null, 8, ["config", "content", "items", "slots"]));
20
+ setup(e) {
21
+ return (n, o) => (F(), ie(xe(e.item.component), {
22
+ block: e.item,
23
+ config: e.item.config,
24
+ content: e.item.content,
25
+ items: e.item.items,
26
+ slots: e.item.slots
27
+ }, null, 8, ["block", "config", "content", "items", "slots"]));
27
28
  }
28
- }), $e = {
29
- name: "FlyoPage"
30
- }, ne = /* @__PURE__ */ Object.assign($e, {
31
- props: {
32
- page: {
33
- type: [Object, Boolean],
34
- default: !1
35
- }
36
- },
37
- emits: ["update:page"],
38
- setup(t, { emit: n }) {
39
- const s = t, l = n, { liveEdit: e, liveEditOrigin: o } = se("flyo"), r = (a) => {
40
- const u = a.parent || a.opener;
41
- return a.self === u ? !1 : a.parent || a.opener;
42
- }, f = (a) => {
43
- e && process.client && r(window) && r(window).postMessage({
44
- action: "openEdit",
45
- data: JSON.parse(JSON.stringify({
46
- page: s.page,
47
- item: a
48
- }))
49
- }, o);
50
- };
51
- return process.client && r(window) && window.addEventListener("message", (a) => {
52
- if (a.origin !== o) {
53
- console.log(`Message from ${a.origin} blocked. Expected ${o}.`);
54
- return;
55
- }
56
- const u = a.data;
57
- u.action === "pageRefresh" && l("update:page", u.data);
58
- }), (a, u) => {
59
- const p = we("FlyoBlock");
60
- return k(), ee("div", null, [
61
- t.page ? Ee(a.$slots, "default", be(Le({ key: 0 }, t.page)), () => [
62
- (k(!0), ee(xe, null, Me(t.page.json, (g) => (k(), oe(p, {
63
- key: g.uid,
64
- item: g,
65
- onClick: () => f(g)
66
- }, null, 8, ["item", "onClick"]))), 128))
67
- ]) : Oe("", !0)
68
- ]);
69
- };
70
- }
71
- }), d = Se({
72
- isLoading: null,
73
- response: null,
74
- error: null
75
- }), _e = () => {
76
- const t = async () => {
77
- try {
78
- d.error = null, d.isLoading = !0, d.response = JSON.parse(JSON.stringify(await new ye($()).config())), d.isLoading = !1;
79
- } catch (n) {
80
- d.isLoading = !1, d.response = null, d.error = JSON.parse(JSON.stringify(n));
81
- }
82
- return {
83
- response: d.response,
84
- error: d.error
85
- };
86
- };
87
- return {
88
- ...Ne(d),
89
- fetch: t
90
- };
91
- }, qe = (t) => {
92
- const n = c(!1), s = c(null), l = c(null);
93
- return {
94
- isLoading: n,
95
- response: s,
96
- error: l,
97
- fetch: async () => {
98
- try {
99
- l.value = null, n.value = !0, s.value = JSON.parse(JSON.stringify(await new me($()).entityByUniqueid({ uniqueid: t }))), n.value = !1;
100
- } catch (o) {
101
- n.value = !1, s.value = null, l.value = JSON.parse(JSON.stringify(o));
102
- }
103
- return {
104
- response: v(s),
105
- error: v(l)
106
- };
107
- }
108
- };
109
- };
110
- function A() {
29
+ });
30
+ function z() {
111
31
  return typeof window > "u" ? !1 : window !== window.top;
112
32
  }
113
- function Ae() {
114
- return typeof window > "u" ? !1 : A() ? window.parent : window;
33
+ function Te() {
34
+ return typeof window > "u" ? !1 : z() ? window.parent : window;
115
35
  }
116
- function Be(t) {
117
- var n = Ae();
36
+ function Ie(e) {
37
+ var n = Te();
118
38
  n && n.postMessage({
119
39
  action: "openEdit",
120
- data: JSON.parse(JSON.stringify({ item: { uid: t } }))
40
+ data: JSON.parse(JSON.stringify({ item: { uid: e } }))
121
41
  }, "https://flyo.cloud");
122
42
  }
123
- function ze() {
124
- typeof window > "u" || A() && window.addEventListener("message", (t) => {
43
+ function Pe() {
44
+ typeof window > "u" || z() && window.addEventListener("message", (e) => {
125
45
  var n;
126
- ((n = t.data) == null ? void 0 : n.action) === "pageRefresh" && window.location.reload();
46
+ ((n = e.data) == null ? void 0 : n.action) === "pageRefresh" && window.location.reload();
127
47
  });
128
48
  }
129
- function Re() {
130
- typeof window > "u" || A() && window.addEventListener("message", (t) => {
131
- var n, s, l, e;
132
- if (((n = t.data) == null ? void 0 : n.action) === "scrollTo") {
133
- const o = (e = (l = (s = t.data) == null ? void 0 : s.data) == null ? void 0 : l.item) == null ? void 0 : e.uid;
134
- if (!o)
49
+ function _e() {
50
+ typeof window > "u" || z() && window.addEventListener("message", (e) => {
51
+ var n, o, i, t;
52
+ if (((n = e.data) == null ? void 0 : n.action) === "scrollTo") {
53
+ const s = (t = (i = (o = e.data) == null ? void 0 : o.data) == null ? void 0 : i.item) == null ? void 0 : t.uid;
54
+ if (!s)
135
55
  return;
136
- const r = document.querySelector(`[data-flyo-uid="${CSS.escape(o)}"]`);
137
- r && r.scrollIntoView({ behavior: "smooth", block: "start" });
56
+ const a = document.querySelector(`[data-flyo-uid="${CSS.escape(s)}"]`);
57
+ a && a.scrollIntoView({ behavior: "smooth", block: "start" });
138
58
  }
139
59
  });
140
60
  }
141
- function je(t, n) {
142
- const s = () => Be(t);
143
- if (!A() || !n)
144
- return s;
145
- const l = n, e = document.createElement("button");
146
- e.type = "button", e.setAttribute("aria-label", "Edit block"), e.style.position = "fixed", e.style.top = "0px", e.style.left = "0px", e.style.zIndex = "9999", e.style.width = "44px", e.style.height = "44px", e.style.display = "none", e.style.alignItems = "center", e.style.justifyContent = "center", e.style.border = "0px solid #000", e.style.borderRadius = "9999px", e.style.boxSizing = "border-box", e.style.cursor = "pointer", e.style.background = "#FFD466", e.innerHTML = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25z" fill="#111"/><path d="M20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" fill="#111"/></svg>';
147
- const o = document.createElement("div");
148
- o.style.position = "fixed", o.style.top = "0px", o.style.left = "0px", o.style.zIndex = "9998", o.style.display = "none", o.style.pointerEvents = "none", o.style.background = "transparent", o.style.border = "none", e.addEventListener("click", s), document.body.appendChild(o), document.body.appendChild(e);
149
- const r = 44, f = 6, a = 6, u = 6, p = 10, g = 180, N = () => window.innerWidth || document.documentElement.clientWidth, C = () => window.innerHeight || document.documentElement.clientHeight, le = (i) => !(i.bottom < 0 || i.right < 0 || i.top > C() || i.left > N() || i.width === 0 && i.height === 0), B = (i, m) => i >= u && m >= u && i + r <= N() - u && m + r <= C() - u, I = (i, m) => ({
150
- x: Math.max(u, Math.min(i, N() - r - u)),
151
- y: Math.max(u, Math.min(m, C() - r - u))
61
+ function qe(e, n) {
62
+ const o = () => Ie(e);
63
+ if (!z() || !n)
64
+ return o;
65
+ const i = n, t = document.createElement("button");
66
+ t.type = "button", t.setAttribute("aria-label", "Edit block"), t.style.position = "fixed", t.style.top = "0px", t.style.left = "0px", t.style.zIndex = "9999", t.style.width = "44px", t.style.height = "44px", t.style.display = "none", t.style.alignItems = "center", t.style.justifyContent = "center", t.style.border = "0px solid #000", t.style.borderRadius = "9999px", t.style.boxSizing = "border-box", t.style.cursor = "pointer", t.style.background = "#FFD466", t.innerHTML = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25z" fill="#111"/><path d="M20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" fill="#111"/></svg>';
67
+ const s = document.createElement("div");
68
+ s.style.position = "fixed", s.style.top = "0px", s.style.left = "0px", s.style.zIndex = "9998", s.style.display = "none", s.style.pointerEvents = "none", s.style.background = "transparent", s.style.border = "none", t.addEventListener("click", o), document.body.appendChild(s), document.body.appendChild(t);
69
+ const a = 44, D = 6, ue = 6, r = 6, M = 10, de = 180, S = () => window.innerWidth || document.documentElement.clientWidth, O = () => window.innerHeight || document.documentElement.clientHeight, ce = (l) => !(l.bottom < 0 || l.right < 0 || l.top > O() || l.left > S() || l.width === 0 && l.height === 0), A = (l, f) => l >= r && f >= r && l + a <= S() - r && f + a <= O() - r, U = (l, f) => ({
70
+ x: Math.max(r, Math.min(l, S() - a - r)),
71
+ y: Math.max(r, Math.min(f, O() - a - r))
152
72
  });
153
- function z() {
154
- const i = l.getBoundingClientRect(), m = i.width < r || i.height < r, x = Math.round(i.left), M = Math.round(i.top) - r - a, P = Math.round(i.left) + f, _ = Math.round(i.top) + f;
155
- let O, S;
156
- if (m && B(x, M))
157
- O = x, S = M;
158
- else if (B(P, _))
159
- O = P, S = _;
160
- else if (B(x, M))
161
- O = x, S = M;
73
+ function $() {
74
+ const l = i.getBoundingClientRect(), f = l.width < a || l.height < a, w = Math.round(l.left), E = Math.round(l.top) - a - ue, I = Math.round(l.left) + D, P = Math.round(l.top) + D;
75
+ let b, L;
76
+ if (f && A(w, E))
77
+ b = w, L = E;
78
+ else if (A(I, P))
79
+ b = I, L = P;
80
+ else if (A(w, E))
81
+ b = w, L = E;
162
82
  else {
163
- const q = I(x, M), H = I(P, _), ce = Math.abs(q.x - i.left) + Math.abs(q.y - i.top), fe = Math.abs(H.x - i.left) + Math.abs(H.y - i.top);
164
- ({ x: O, y: S } = ce <= fe ? q : H);
83
+ const _ = U(w, E), q = U(I, P), ve = Math.abs(_.x - l.left) + Math.abs(_.y - l.top), he = Math.abs(q.x - l.left) + Math.abs(q.y - l.top);
84
+ ({ x: b, y: L } = ve <= he ? _ : q);
165
85
  }
166
- e.style.left = `${O}px`, e.style.top = `${S}px`;
167
- const Y = Math.max(u, Math.round(i.left) - p), Z = Math.max(u, Math.round(i.top) - p), ue = Math.min(N() - u, Math.round(i.right) + p), de = Math.min(C() - u, Math.round(i.bottom) + p);
168
- o.style.left = `${Y}px`, o.style.top = `${Z}px`, o.style.width = `${Math.max(0, ue - Y)}px`, o.style.height = `${Math.max(0, de - Z)}px`;
86
+ t.style.left = `${b}px`, t.style.top = `${L}px`;
87
+ const ee = Math.max(r, Math.round(l.left) - M), te = Math.max(r, Math.round(l.top) - M), me = Math.min(S() - r, Math.round(l.right) + M), pe = Math.min(O() - r, Math.round(l.bottom) + M);
88
+ s.style.left = `${ee}px`, s.style.top = `${te}px`, s.style.width = `${Math.max(0, me - ee)}px`, s.style.height = `${Math.max(0, pe - te)}px`;
169
89
  }
170
- let h = !1, w = !1, E = !1, J = !1, b = null;
171
- const F = () => {
172
- b !== null && (clearTimeout(b), b = null);
90
+ let m = !1, p = !1, v = !1, N = !1, h = null;
91
+ const C = () => {
92
+ h !== null && (clearTimeout(h), h = null);
173
93
  }, R = () => {
174
- F();
94
+ C();
175
95
  try {
176
- const i = l.getBoundingClientRect();
177
- if (!le(i)) {
178
- L(!0);
96
+ const l = i.getBoundingClientRect();
97
+ if (!ce(l)) {
98
+ g(!0);
179
99
  return;
180
100
  }
181
- z(), e.style.display = "flex", o.style.display = "block", re();
101
+ $(), t.style.display = "flex", s.style.display = "block", fe();
182
102
  } catch {
183
- L(!0);
103
+ g(!0);
184
104
  }
185
- }, L = (i = !1) => {
186
- if (i) {
187
- F(), e.style.display = "none", o.style.display = "none", T();
105
+ }, g = (l = !1) => {
106
+ if (l) {
107
+ C(), t.style.display = "none", s.style.display = "none", T();
188
108
  return;
189
109
  }
190
- F(), b = window.setTimeout(() => {
191
- !h && !w && !E && (e.style.display = "none", o.style.display = "none", T()), b = null;
192
- }, g);
110
+ C(), h = window.setTimeout(() => {
111
+ !m && !p && !v && (t.style.display = "none", s.style.display = "none", T()), h = null;
112
+ }, de);
193
113
  }, j = () => {
194
- e.style.display !== "none" && z();
195
- }, W = j;
196
- let y = null;
197
- const D = window.ResizeObserver, re = () => {
198
- J || (J = !0, window.addEventListener("scroll", j, !0), window.addEventListener("resize", W), typeof D == "function" && (y = new D(() => {
199
- e.style.display !== "none" && z();
200
- }), y == null || y.observe(l)));
114
+ t.style.display !== "none" && $();
115
+ }, V = j;
116
+ let c = null;
117
+ const W = window.ResizeObserver, fe = () => {
118
+ N || (N = !0, window.addEventListener("scroll", j, !0), window.addEventListener("resize", V), typeof W == "function" && (c = new W(() => {
119
+ t.style.display !== "none" && $();
120
+ }), c == null || c.observe(i)));
201
121
  }, T = () => {
202
- if (J) {
203
- J = !1, window.removeEventListener("scroll", j, !0), window.removeEventListener("resize", W);
122
+ if (N) {
123
+ N = !1, window.removeEventListener("scroll", j, !0), window.removeEventListener("resize", V);
204
124
  try {
205
- y == null || y.disconnect();
125
+ c == null || c.disconnect();
206
126
  } catch {
207
127
  }
208
- y = null;
128
+ c = null;
209
129
  }
210
- }, U = () => {
211
- h = !0, R();
212
- }, V = () => {
213
- h = !1, !w && !E && L();
214
130
  }, K = () => {
215
- w = !0, R();
131
+ m = !0, R();
216
132
  }, G = () => {
217
- w = !1, !h && !E && L();
133
+ m = !1, !p && !v && g();
218
134
  }, Q = () => {
219
- E = !0, R();
135
+ p = !0, R();
220
136
  }, X = () => {
221
- E = !1, !h && !w && L();
137
+ p = !1, !m && !v && g();
138
+ }, Y = () => {
139
+ v = !0, R();
140
+ }, Z = () => {
141
+ v = !1, !m && !p && g();
222
142
  };
223
- l.addEventListener("mouseenter", U), l.addEventListener("mouseleave", V), e.addEventListener("mouseenter", K), e.addEventListener("mouseleave", G), o.addEventListener("mouseenter", Q), o.addEventListener("mouseleave", X), e.addEventListener("click", s);
224
- function ae() {
225
- F(), T(), e.removeEventListener("click", s), l.removeEventListener("mouseenter", U), l.removeEventListener("mouseleave", V), e.removeEventListener("mouseenter", K), e.removeEventListener("mouseleave", G), o.removeEventListener("mouseenter", Q), o.removeEventListener("mouseleave", X), e.parentElement === document.body && document.body.removeChild(e), o.parentElement === document.body && document.body.removeChild(o);
143
+ i.addEventListener("mouseenter", K), i.addEventListener("mouseleave", G), t.addEventListener("mouseenter", Q), t.addEventListener("mouseleave", X), s.addEventListener("mouseenter", Y), s.addEventListener("mouseleave", Z), t.addEventListener("click", o);
144
+ function ye() {
145
+ C(), T(), t.removeEventListener("click", o), i.removeEventListener("mouseenter", K), i.removeEventListener("mouseleave", G), t.removeEventListener("mouseenter", Q), t.removeEventListener("mouseleave", X), s.removeEventListener("mouseenter", Y), s.removeEventListener("mouseleave", Z), t.parentElement === document.body && document.body.removeChild(t), s.parentElement === document.body && document.body.removeChild(s);
226
146
  }
227
- return ae;
147
+ return ye;
228
148
  }
229
- const He = (t) => typeof (t == null ? void 0 : t.uid) == "string" && t.uid.trim() !== "" ? { "data-flyo-uid": t.uid } : {}, Ie = () => {
230
- const { liveEdit: t } = se("flyo");
231
- if (!t)
232
- return;
233
- let n = null;
234
- const s = [], l = () => {
235
- s.forEach((e) => e()), s.length = 0, document.querySelectorAll("[data-flyo-uid]").forEach((e) => {
236
- const o = e.getAttribute("data-flyo-uid");
237
- if (o && e instanceof HTMLElement) {
238
- const r = je(o, e);
239
- typeof r == "function" && s.push(r);
149
+ let x = null, J = 0, k = !1;
150
+ const H = [], ae = () => {
151
+ H.forEach((e) => e()), H.length = 0;
152
+ }, le = () => {
153
+ ae(), document.querySelectorAll("[data-flyo-uid]").forEach((e) => {
154
+ const n = e.getAttribute("data-flyo-uid");
155
+ if (n && e instanceof HTMLElement) {
156
+ const o = qe(n, e);
157
+ typeof o == "function" && H.push(o);
158
+ }
159
+ });
160
+ }, He = () => {
161
+ k || (Pe(), _e(), le(), x = new MutationObserver((e) => {
162
+ e.some(
163
+ (o) => Array.from(o.addedNodes).some((i) => {
164
+ if (i.nodeType !== Node.ELEMENT_NODE)
165
+ return !1;
166
+ const t = i;
167
+ return t.hasAttribute("data-flyo-uid") || t.querySelector("[data-flyo-uid]");
168
+ })
169
+ ) && le();
170
+ }), x.observe(document.body, {
171
+ childList: !0,
172
+ subtree: !0
173
+ }), k = !0);
174
+ }, De = () => {
175
+ k && (x && (x.disconnect(), x = null), ae(), k = !1);
176
+ }, Ge = (e) => typeof (e == null ? void 0 : e.uid) == "string" && e.uid.trim() !== "" ? { "data-flyo-uid": e.uid } : {}, Ue = () => {
177
+ const e = Me("flyo");
178
+ e != null && e.liveEdit && (Se(() => {
179
+ J += 1, He();
180
+ }), Oe(() => {
181
+ J = Math.max(0, J - 1), J === 0 && De();
182
+ }));
183
+ }, Ve = {
184
+ name: "FlyoPage"
185
+ }, se = /* @__PURE__ */ Object.assign(Ve, {
186
+ props: {
187
+ page: {
188
+ type: [Object, Boolean],
189
+ default: !1
190
+ }
191
+ },
192
+ setup(e) {
193
+ return Ue(), (n, o) => {
194
+ const i = Ne("FlyoBlock");
195
+ return F(), ne("div", null, [
196
+ e.page ? Ce(n.$slots, "default", Je(Fe({ key: 0 }, e.page)), () => [
197
+ (F(!0), ne(ke, null, Be(e.page.json, (t) => (F(), ie(i, {
198
+ key: t.uid,
199
+ item: t
200
+ }, null, 8, ["item"]))), 128))
201
+ ]) : ze("", !0)
202
+ ]);
203
+ };
204
+ }
205
+ }), u = Ae({
206
+ isLoading: null,
207
+ response: null,
208
+ error: null
209
+ }), Qe = () => {
210
+ const e = async () => {
211
+ try {
212
+ u.error = null, u.isLoading = !0, u.response = JSON.parse(JSON.stringify(await new we(B()).config())), u.isLoading = !1;
213
+ } catch (n) {
214
+ u.isLoading = !1, u.response = null, u.error = JSON.parse(JSON.stringify(n));
215
+ }
216
+ return {
217
+ response: u.response,
218
+ error: u.error
219
+ };
220
+ };
221
+ return {
222
+ ...$e(u),
223
+ fetch: e
224
+ };
225
+ }, Xe = (e) => {
226
+ const n = d(!1), o = d(null), i = d(null);
227
+ return {
228
+ isLoading: n,
229
+ response: o,
230
+ error: i,
231
+ fetch: async () => {
232
+ try {
233
+ i.value = null, n.value = !0, o.value = JSON.parse(JSON.stringify(await new Ee(B()).entityByUniqueid({ uniqueid: e }))), n.value = !1;
234
+ } catch (s) {
235
+ n.value = !1, o.value = null, i.value = JSON.parse(JSON.stringify(s));
240
236
  }
241
- });
237
+ return {
238
+ response: y(o),
239
+ error: y(i)
240
+ };
241
+ }
242
242
  };
243
- Ce(() => {
244
- ze(), Re(), l(), n = new MutationObserver((e) => {
245
- e.some(
246
- (r) => Array.from(r.addedNodes).some((f) => {
247
- if (f.nodeType === Node.ELEMENT_NODE) {
248
- const a = f;
249
- return a.hasAttribute("data-flyo-uid") || a.querySelector("[data-flyo-uid]");
250
- }
251
- return !1;
252
- })
253
- ) && l();
254
- }), n.observe(document.body, {
255
- childList: !0,
256
- subtree: !0
257
- });
258
- }), Je(() => {
259
- n && n.disconnect(), s.forEach((e) => e()), s.length = 0;
260
- });
261
- }, We = (t) => {
262
- const n = c(!1), s = c(null), l = c(null);
243
+ }, Ye = (e) => {
244
+ const n = d(!1), o = d(null), i = d(null);
263
245
  return {
264
246
  isLoading: n,
265
- response: s,
266
- error: l,
247
+ response: o,
248
+ error: i,
267
249
  fetch: async () => {
268
250
  try {
269
- l.value = null, n.value = !0, s.value = JSON.parse(JSON.stringify(await new ve($()).page({ slug: t }))), n.value = !1;
270
- } catch (o) {
271
- n.value = !1, s.value = null, l.value = JSON.parse(JSON.stringify(o));
251
+ i.value = null, n.value = !0, o.value = JSON.parse(JSON.stringify(await new be(B()).page({ slug: e }))), n.value = !1;
252
+ } catch (s) {
253
+ n.value = !1, o.value = null, i.value = JSON.parse(JSON.stringify(s));
272
254
  }
273
255
  return {
274
- response: v(s),
275
- error: v(l)
256
+ response: y(o),
257
+ error: y(i)
276
258
  };
277
259
  }
278
260
  };
279
- }, De = () => {
280
- const t = c(!1), n = c(null), s = c(null);
261
+ }, Ze = () => {
262
+ const e = d(!1), n = d(null), o = d(null);
281
263
  return {
282
- isLoading: t,
264
+ isLoading: e,
283
265
  response: n,
284
- error: s,
266
+ error: o,
285
267
  fetch: async () => {
286
268
  try {
287
- s.value = null, t.value = !0, n.value = JSON.parse(JSON.stringify(await new ge($()).sitemap())), t.value = !1;
288
- } catch (e) {
289
- t.value = !1, n.value = null, s.value = JSON.parse(JSON.stringify(e));
269
+ o.value = null, e.value = !0, n.value = JSON.parse(JSON.stringify(await new Le(B()).sitemap())), e.value = !1;
270
+ } catch (t) {
271
+ e.value = !1, n.value = null, o.value = JSON.parse(JSON.stringify(t));
290
272
  }
291
273
  return {
292
- response: v(n),
293
- error: v(s)
274
+ response: y(n),
275
+ error: y(o)
294
276
  };
295
277
  }
296
278
  };
297
- }, Ue = {
298
- install(t, n) {
299
- Fe(n), t.component(te.name, te), t.component(ne.name, ne), t.provide("flyo", {
279
+ }, et = {
280
+ install(e, n) {
281
+ Re(n), e.component(oe.name, oe), e.component(se.name, se), e.provide("flyo", {
300
282
  liveEdit: n.liveEdit,
301
283
  liveEditOrigin: n.liveEditOrigin
302
284
  });
303
285
  }
304
286
  };
305
287
  export {
306
- te as Block,
307
- Ue as FlyoVue,
308
- ne as Page,
309
- Ue as default,
310
- He as editable,
311
- $ as getFlyoConfig,
312
- _e as useFlyoConfig,
313
- qe as useFlyoEntity,
314
- Ie as useFlyoLiveEdit,
315
- We as useFlyoPage,
316
- De as useFlyoSitemap
288
+ oe as Block,
289
+ et as FlyoVue,
290
+ se as Page,
291
+ et as default,
292
+ Ge as editable,
293
+ B as getFlyoConfig,
294
+ Qe as useFlyoConfig,
295
+ Xe as useFlyoEntity,
296
+ Ue as useFlyoLiveEdit,
297
+ Ye as useFlyoPage,
298
+ Ze as useFlyoSitemap
317
299
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flyo/nitro-vue3",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Vue3 Components for Flyo Nitro",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",