@flyo/nitro-vue3 2.2.0 → 2.2.1
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/dist/index.cjs +1 -1
- package/dist/index.mjs +136 -156
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const x=require("@flyo/nitro-typescript"),o=require("vue");let ee=null;const de=({apiToken:t,apiBasePath:n,defaultHeaders:s})=>{ee=new x.Configuration({apiKey:t,...n&&{basePath:n},headers:s||{}})},M=()=>ee,ce={name:"FlyoBlock"},q=Object.assign(ce,{props:{item:{type:Object,default:()=>{}}},setup(t){return(n,s)=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(t.item.component),{block:t.item,config:t.item.config,content:t.item.content,items:t.item.items,slots:t.item.slots},null,8,["block","config","content","items","slots"]))}}),fe={name:"FlyoPage"},H=Object.assign(fe,{props:{page:{type:[Object,Boolean],default:!1}},setup(t){return(n,s)=>{const r=o.resolveComponent("FlyoBlock");return o.openBlock(),o.createElementBlock("div",null,[t.page?o.renderSlot(n.$slots,"default",o.normalizeProps(o.mergeProps({key:0},t.page)),()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(t.page.json,e=>(o.openBlock(),o.createBlock(r,{key:e.uid,item:e},null,8,["item"]))),128))]):o.createCommentVNode("",!0)])}}}),d=o.reactive({isLoading:null,response:null,error:null}),ye=()=>{const t=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:t}},pe=t=>{const n=o.ref(!1),s=o.ref(null),r=o.ref(null);return{isLoading:n,response:s,error:r,fetch:async()=>{try{r.value=null,n.value=!0,s.value=JSON.parse(JSON.stringify(await new x.EntitiesApi(M()).entityByUniqueid({uniqueid:t}))),n.value=!1}catch(l){n.value=!1,s.value=null,r.value=JSON.parse(JSON.stringify(l))}return{response:o.unref(s),error:o.unref(r)}}}};function J(){return typeof window>"u"?!1:window!==window.top}function me(){return typeof window>"u"?!1:J()?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 he(){typeof window>"u"||J()&&window.addEventListener("message",t=>{var n;((n=t.data)==null?void 0:n.action)==="pageRefresh"&&window.location.reload()})}function ge(){typeof window>"u"||J()&&window.addEventListener("message",t=>{var n,s,r,e;if(((n=t.data)==null?void 0:n.action)==="scrollTo"){const l=(e=(r=(s=t.data)==null?void 0:s.data)==null?void 0:r.item)==null?void 0:e.uid;if(!l)return;const a=document.querySelector(`[data-flyo-uid="${CSS.escape(l)}"]`);a&&a.scrollIntoView({behavior:"smooth",block:"start"})}})}function we(t,n){const s=()=>ve(t);if(!J()||!n)return s;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 l=document.createElement("div");l.style.position="fixed",l.style.top="0px",l.style.left="0px",l.style.zIndex="9998",l.style.display="none",l.style.pointerEvents="none",l.style.background="transparent",l.style.border="none",e.addEventListener("click",s),document.body.appendChild(l),document.body.appendChild(e);const a=44,y=6,S=6,u=6,O=10,ne=180,N=()=>window.innerWidth||document.documentElement.clientWidth,F=()=>window.innerHeight||document.documentElement.clientHeight,oe=i=>!(i.bottom<0||i.right<0||i.top>F()||i.left>N()||i.width===0&&i.height===0),B=(i,f)=>i>=u&&f>=u&&i+a<=N()-u&&f+a<=F()-u,I=(i,f)=>({x:Math.max(u,Math.min(i,N()-a-u)),y:Math.max(u,Math.min(f,F()-a-u))});function A(){const i=r.getBoundingClientRect(),f=i.width<a||i.height<a,w=Math.round(i.left),E=Math.round(i.top)-a-S,j=Math.round(i.left)+y,P=Math.round(i.top)+y;let b,L;if(f&&B(w,E))b=w,L=E;else if(B(j,P))b=j,L=P;else if(B(w,E))b=w,L=E;else{const R=I(w,E),_=I(j,P),ae=Math.abs(R.x-i.left)+Math.abs(R.y-i.top),ue=Math.abs(_.x-i.left)+Math.abs(_.y-i.top);({x:b,y:L}=ae<=ue?R:_)}e.style.left=`${b}px`,e.style.top=`${L}px`;const Y=Math.max(u,Math.round(i.left)-O),Z=Math.max(u,Math.round(i.top)-O),ie=Math.min(N()-u,Math.round(i.right)+O),re=Math.min(F()-u,Math.round(i.bottom)+O);l.style.left=`${Y}px`,l.style.top=`${Z}px`,l.style.width=`${Math.max(0,ie-Y)}px`,l.style.height=`${Math.max(0,re-Z)}px`}let p=!1,m=!1,v=!1,C=!1,h=null;const k=()=>{h!==null&&(clearTimeout(h),h=null)},$=()=>{k();try{const i=r.getBoundingClientRect();if(!oe(i)){g(!0);return}A(),e.style.display="flex",l.style.display="block",le()}catch{g(!0)}},g=(i=!1)=>{if(i){k(),e.style.display="none",l.style.display="none",T();return}k(),h=window.setTimeout(()=>{!p&&!m&&!v&&(e.style.display="none",l.style.display="none",T()),h=null},ne)},z=()=>{e.style.display!=="none"&&A()},D=z;let c=null;const V=window.ResizeObserver,le=()=>{C||(C=!0,window.addEventListener("scroll",z,!0),window.addEventListener("resize",D),typeof V=="function"&&(c=new V(()=>{e.style.display!=="none"&&A()}),c==null||c.observe(r)))},T=()=>{if(C){C=!1,window.removeEventListener("scroll",z,!0),window.removeEventListener("resize",D);try{c==null||c.disconnect()}catch{}c=null}},U=()=>{p=!0,$()},W=()=>{p=!1,!m&&!v&&g()},K=()=>{m=!0,$()},G=()=>{m=!1,!p&&!v&&g()},Q=()=>{v=!0,$()},X=()=>{v=!1,!p&&!m&&g()};r.addEventListener("mouseenter",U),r.addEventListener("mouseleave",W),e.addEventListener("mouseenter",K),e.addEventListener("mouseleave",G),l.addEventListener("mouseenter",Q),l.addEventListener("mouseleave",X),e.addEventListener("click",s);function se(){k(),T(),e.removeEventListener("click",s),r.removeEventListener("mouseenter",U),r.removeEventListener("mouseleave",W),e.removeEventListener("mouseenter",K),e.removeEventListener("mouseleave",G),l.removeEventListener("mouseenter",Q),l.removeEventListener("mouseleave",X),e.parentElement===document.body&&document.body.removeChild(e),l.parentElement===document.body&&document.body.removeChild(l)}return se}const Ee=t=>typeof(t==null?void 0:t.uid)=="string"&&t.uid.trim()!==""?{"data-flyo-uid":t.uid}:{},be=()=>{const{liveEdit:t}=o.inject("flyo");if(!t)return;let n=null;const s=[],r=()=>{s.forEach(e=>e()),s.length=0,document.querySelectorAll("[data-flyo-uid]").forEach(e=>{const l=e.getAttribute("data-flyo-uid");if(l&&e instanceof HTMLElement){const a=we(l,e);typeof a=="function"&&s.push(a)}})};o.onMounted(()=>{he(),ge(),r(),n=new MutationObserver(e=>{e.some(a=>Array.from(a.addedNodes).some(y=>{if(y.nodeType===Node.ELEMENT_NODE){const S=y;return S.hasAttribute("data-flyo-uid")||S.querySelector("[data-flyo-uid]")}return!1}))&&r()}),n.observe(document.body,{childList:!0,subtree:!0})}),o.onUnmounted(()=>{n&&n.disconnect(),s.forEach(e=>e()),s.length=0})},Le=t=>{const n=o.ref(!1),s=o.ref(null),r=o.ref(null);return{isLoading:n,response:s,error:r,fetch:async()=>{try{r.value=null,n.value=!0,s.value=JSON.parse(JSON.stringify(await new x.PagesApi(M()).page({slug:t}))),n.value=!1}catch(l){n.value=!1,s.value=null,r.value=JSON.parse(JSON.stringify(l))}return{response:o.unref(s),error:o.unref(r)}}}},xe=()=>{const t=o.ref(!1),n=o.ref(null),s=o.ref(null);return{isLoading:t,response:n,error:s,fetch:async()=>{try{s.value=null,t.value=!0,n.value=JSON.parse(JSON.stringify(await new x.SitemapApi(M()).sitemap())),t.value=!1}catch(e){t.value=!1,n.value=null,s.value=JSON.parse(JSON.stringify(e))}return{response:o.unref(n),error:o.unref(s)}}}},te={install(t,n){de(n),t.component(q.name,q),t.component(H.name,H),t.provide("flyo",{liveEdit:n.liveEdit,liveEditOrigin:n.liveEditOrigin})}};exports.Block=q;exports.FlyoVue=te;exports.Page=H;exports.default=te;exports.editable=Ee;exports.getFlyoConfig=M;exports.useFlyoConfig=ye;exports.useFlyoEntity=pe;exports.useFlyoLiveEdit=be;exports.useFlyoPage=Le;exports.useFlyoSitemap=xe;
|
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Configuration as
|
|
2
|
-
import { openBlock as
|
|
3
|
-
let
|
|
4
|
-
const Fe = ({ apiToken: t, apiBasePath: n, defaultHeaders:
|
|
5
|
-
|
|
1
|
+
import { Configuration as fe, ConfigApi as ye, EntitiesApi as me, PagesApi as pe, SitemapApi as ve } from "@flyo/nitro-typescript";
|
|
2
|
+
import { openBlock as F, createBlock as ne, resolveDynamicComponent as he, resolveComponent as ge, createElementBlock as Z, renderSlot as we, normalizeProps as Ee, mergeProps as be, Fragment as Le, renderList as xe, createCommentVNode as Me, reactive as Se, toRefs as Oe, ref as d, unref as y, inject as Ne, onMounted as Ce, onUnmounted as Je } from "vue";
|
|
3
|
+
let oe = null;
|
|
4
|
+
const Fe = ({ apiToken: t, apiBasePath: n, defaultHeaders: l }) => {
|
|
5
|
+
oe = new fe({
|
|
6
6
|
apiKey: t,
|
|
7
7
|
...n && { basePath: n },
|
|
8
|
-
headers:
|
|
8
|
+
headers: l || {}
|
|
9
9
|
});
|
|
10
|
-
},
|
|
10
|
+
}, k = () => oe, ke = {
|
|
11
11
|
name: "FlyoBlock"
|
|
12
|
-
},
|
|
12
|
+
}, ee = /* @__PURE__ */ Object.assign(ke, {
|
|
13
13
|
props: {
|
|
14
14
|
item: {
|
|
15
15
|
type: Object,
|
|
@@ -18,91 +18,71 @@ const Fe = ({ apiToken: t, apiBasePath: n, defaultHeaders: s }) => {
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
setup(t) {
|
|
21
|
-
return (n,
|
|
21
|
+
return (n, l) => (F(), ne(he(t.item.component), {
|
|
22
|
+
block: t.item,
|
|
22
23
|
config: t.item.config,
|
|
23
24
|
content: t.item.content,
|
|
24
25
|
items: t.item.items,
|
|
25
26
|
slots: t.item.slots
|
|
26
|
-
}, null, 8, ["config", "content", "items", "slots"]));
|
|
27
|
+
}, null, 8, ["block", "config", "content", "items", "slots"]));
|
|
27
28
|
}
|
|
28
|
-
}),
|
|
29
|
+
}), Ae = {
|
|
29
30
|
name: "FlyoPage"
|
|
30
|
-
},
|
|
31
|
+
}, te = /* @__PURE__ */ Object.assign(Ae, {
|
|
31
32
|
props: {
|
|
32
33
|
page: {
|
|
33
34
|
type: [Object, Boolean],
|
|
34
35
|
default: !1
|
|
35
36
|
}
|
|
36
37
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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)
|
|
38
|
+
setup(t) {
|
|
39
|
+
return (n, l) => {
|
|
40
|
+
const i = ge("FlyoBlock");
|
|
41
|
+
return F(), Z("div", null, [
|
|
42
|
+
t.page ? we(n.$slots, "default", Ee(be({ key: 0 }, t.page)), () => [
|
|
43
|
+
(F(!0), Z(Le, null, xe(t.page.json, (e) => (F(), ne(i, {
|
|
44
|
+
key: e.uid,
|
|
45
|
+
item: e
|
|
46
|
+
}, null, 8, ["item"]))), 128))
|
|
47
|
+
]) : Me("", !0)
|
|
68
48
|
]);
|
|
69
49
|
};
|
|
70
50
|
}
|
|
71
|
-
}),
|
|
51
|
+
}), u = Se({
|
|
72
52
|
isLoading: null,
|
|
73
53
|
response: null,
|
|
74
54
|
error: null
|
|
75
55
|
}), _e = () => {
|
|
76
56
|
const t = async () => {
|
|
77
57
|
try {
|
|
78
|
-
|
|
58
|
+
u.error = null, u.isLoading = !0, u.response = JSON.parse(JSON.stringify(await new ye(k()).config())), u.isLoading = !1;
|
|
79
59
|
} catch (n) {
|
|
80
|
-
|
|
60
|
+
u.isLoading = !1, u.response = null, u.error = JSON.parse(JSON.stringify(n));
|
|
81
61
|
}
|
|
82
62
|
return {
|
|
83
|
-
response:
|
|
84
|
-
error:
|
|
63
|
+
response: u.response,
|
|
64
|
+
error: u.error
|
|
85
65
|
};
|
|
86
66
|
};
|
|
87
67
|
return {
|
|
88
|
-
...
|
|
68
|
+
...Oe(u),
|
|
89
69
|
fetch: t
|
|
90
70
|
};
|
|
91
71
|
}, qe = (t) => {
|
|
92
|
-
const n =
|
|
72
|
+
const n = d(!1), l = d(null), i = d(null);
|
|
93
73
|
return {
|
|
94
74
|
isLoading: n,
|
|
95
|
-
response:
|
|
96
|
-
error:
|
|
75
|
+
response: l,
|
|
76
|
+
error: i,
|
|
97
77
|
fetch: async () => {
|
|
98
78
|
try {
|
|
99
|
-
|
|
79
|
+
i.value = null, n.value = !0, l.value = JSON.parse(JSON.stringify(await new me(k()).entityByUniqueid({ uniqueid: t }))), n.value = !1;
|
|
100
80
|
} catch (o) {
|
|
101
|
-
n.value = !1,
|
|
81
|
+
n.value = !1, l.value = null, i.value = JSON.parse(JSON.stringify(o));
|
|
102
82
|
}
|
|
103
83
|
return {
|
|
104
|
-
response:
|
|
105
|
-
error:
|
|
84
|
+
response: y(l),
|
|
85
|
+
error: y(i)
|
|
106
86
|
};
|
|
107
87
|
}
|
|
108
88
|
};
|
|
@@ -110,11 +90,11 @@ const Fe = ({ apiToken: t, apiBasePath: n, defaultHeaders: s }) => {
|
|
|
110
90
|
function A() {
|
|
111
91
|
return typeof window > "u" ? !1 : window !== window.top;
|
|
112
92
|
}
|
|
113
|
-
function
|
|
93
|
+
function Be() {
|
|
114
94
|
return typeof window > "u" ? !1 : A() ? window.parent : window;
|
|
115
95
|
}
|
|
116
|
-
function
|
|
117
|
-
var n =
|
|
96
|
+
function $e(t) {
|
|
97
|
+
var n = Be();
|
|
118
98
|
n && n.postMessage({
|
|
119
99
|
action: "openEdit",
|
|
120
100
|
data: JSON.parse(JSON.stringify({ item: { uid: t } }))
|
|
@@ -128,9 +108,9 @@ function ze() {
|
|
|
128
108
|
}
|
|
129
109
|
function Re() {
|
|
130
110
|
typeof window > "u" || A() && window.addEventListener("message", (t) => {
|
|
131
|
-
var n,
|
|
111
|
+
var n, l, i, e;
|
|
132
112
|
if (((n = t.data) == null ? void 0 : n.action) === "scrollTo") {
|
|
133
|
-
const o = (e = (
|
|
113
|
+
const o = (e = (i = (l = t.data) == null ? void 0 : l.data) == null ? void 0 : i.item) == null ? void 0 : e.uid;
|
|
134
114
|
if (!o)
|
|
135
115
|
return;
|
|
136
116
|
const r = document.querySelector(`[data-flyo-uid="${CSS.escape(o)}"]`);
|
|
@@ -139,179 +119,179 @@ function Re() {
|
|
|
139
119
|
});
|
|
140
120
|
}
|
|
141
121
|
function je(t, n) {
|
|
142
|
-
const
|
|
122
|
+
const l = () => $e(t);
|
|
143
123
|
if (!A() || !n)
|
|
144
|
-
return
|
|
145
|
-
const
|
|
124
|
+
return l;
|
|
125
|
+
const i = n, e = document.createElement("button");
|
|
146
126
|
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
127
|
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",
|
|
149
|
-
const r = 44,
|
|
150
|
-
x: Math.max(
|
|
151
|
-
y: Math.max(
|
|
128
|
+
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", l), document.body.appendChild(o), document.body.appendChild(e);
|
|
129
|
+
const r = 44, m = 6, M = 6, a = 6, S = 10, le = 180, O = () => window.innerWidth || document.documentElement.clientWidth, N = () => window.innerHeight || document.documentElement.clientHeight, se = (s) => !(s.bottom < 0 || s.right < 0 || s.top > N() || s.left > O() || s.width === 0 && s.height === 0), B = (s, f) => s >= a && f >= a && s + r <= O() - a && f + r <= N() - a, H = (s, f) => ({
|
|
130
|
+
x: Math.max(a, Math.min(s, O() - r - a)),
|
|
131
|
+
y: Math.max(a, Math.min(f, N() - r - a))
|
|
152
132
|
});
|
|
153
|
-
function
|
|
154
|
-
const
|
|
155
|
-
let
|
|
156
|
-
if (
|
|
157
|
-
|
|
158
|
-
else if (B(
|
|
159
|
-
|
|
160
|
-
else if (B(
|
|
161
|
-
|
|
133
|
+
function $() {
|
|
134
|
+
const s = i.getBoundingClientRect(), f = s.width < r || s.height < r, E = Math.round(s.left), b = Math.round(s.top) - r - M, T = Math.round(s.left) + m, P = Math.round(s.top) + m;
|
|
135
|
+
let L, x;
|
|
136
|
+
if (f && B(E, b))
|
|
137
|
+
L = E, x = b;
|
|
138
|
+
else if (B(T, P))
|
|
139
|
+
L = T, x = P;
|
|
140
|
+
else if (B(E, b))
|
|
141
|
+
L = E, x = b;
|
|
162
142
|
else {
|
|
163
|
-
const
|
|
164
|
-
({ x:
|
|
143
|
+
const _ = H(E, b), q = H(T, P), de = Math.abs(_.x - s.left) + Math.abs(_.y - s.top), ce = Math.abs(q.x - s.left) + Math.abs(q.y - s.top);
|
|
144
|
+
({ x: L, y: x } = de <= ce ? _ : q);
|
|
165
145
|
}
|
|
166
|
-
e.style.left = `${
|
|
167
|
-
const
|
|
168
|
-
o.style.left = `${
|
|
146
|
+
e.style.left = `${L}px`, e.style.top = `${x}px`;
|
|
147
|
+
const X = Math.max(a, Math.round(s.left) - S), Y = Math.max(a, Math.round(s.top) - S), ae = Math.min(O() - a, Math.round(s.right) + S), ue = Math.min(N() - a, Math.round(s.bottom) + S);
|
|
148
|
+
o.style.left = `${X}px`, o.style.top = `${Y}px`, o.style.width = `${Math.max(0, ae - X)}px`, o.style.height = `${Math.max(0, ue - Y)}px`;
|
|
169
149
|
}
|
|
170
|
-
let
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
},
|
|
174
|
-
|
|
150
|
+
let p = !1, v = !1, h = !1, C = !1, g = null;
|
|
151
|
+
const J = () => {
|
|
152
|
+
g !== null && (clearTimeout(g), g = null);
|
|
153
|
+
}, z = () => {
|
|
154
|
+
J();
|
|
175
155
|
try {
|
|
176
|
-
const
|
|
177
|
-
if (!
|
|
178
|
-
|
|
156
|
+
const s = i.getBoundingClientRect();
|
|
157
|
+
if (!se(s)) {
|
|
158
|
+
w(!0);
|
|
179
159
|
return;
|
|
180
160
|
}
|
|
181
|
-
|
|
161
|
+
$(), e.style.display = "flex", o.style.display = "block", ie();
|
|
182
162
|
} catch {
|
|
183
|
-
|
|
163
|
+
w(!0);
|
|
184
164
|
}
|
|
185
|
-
},
|
|
186
|
-
if (
|
|
187
|
-
|
|
165
|
+
}, w = (s = !1) => {
|
|
166
|
+
if (s) {
|
|
167
|
+
J(), e.style.display = "none", o.style.display = "none", j();
|
|
188
168
|
return;
|
|
189
169
|
}
|
|
190
|
-
|
|
191
|
-
!
|
|
192
|
-
},
|
|
170
|
+
J(), g = window.setTimeout(() => {
|
|
171
|
+
!p && !v && !h && (e.style.display = "none", o.style.display = "none", j()), g = null;
|
|
172
|
+
}, le);
|
|
173
|
+
}, R = () => {
|
|
174
|
+
e.style.display !== "none" && $();
|
|
175
|
+
}, I = R;
|
|
176
|
+
let c = null;
|
|
177
|
+
const D = window.ResizeObserver, ie = () => {
|
|
178
|
+
C || (C = !0, window.addEventListener("scroll", R, !0), window.addEventListener("resize", I), typeof D == "function" && (c = new D(() => {
|
|
179
|
+
e.style.display !== "none" && $();
|
|
180
|
+
}), c == null || c.observe(i)));
|
|
193
181
|
}, j = () => {
|
|
194
|
-
|
|
195
|
-
|
|
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)));
|
|
201
|
-
}, T = () => {
|
|
202
|
-
if (J) {
|
|
203
|
-
J = !1, window.removeEventListener("scroll", j, !0), window.removeEventListener("resize", W);
|
|
182
|
+
if (C) {
|
|
183
|
+
C = !1, window.removeEventListener("scroll", R, !0), window.removeEventListener("resize", I);
|
|
204
184
|
try {
|
|
205
|
-
|
|
185
|
+
c == null || c.disconnect();
|
|
206
186
|
} catch {
|
|
207
187
|
}
|
|
208
|
-
|
|
188
|
+
c = null;
|
|
209
189
|
}
|
|
210
190
|
}, U = () => {
|
|
211
|
-
|
|
191
|
+
p = !0, z();
|
|
212
192
|
}, V = () => {
|
|
213
|
-
|
|
193
|
+
p = !1, !v && !h && w();
|
|
194
|
+
}, W = () => {
|
|
195
|
+
v = !0, z();
|
|
214
196
|
}, K = () => {
|
|
215
|
-
|
|
197
|
+
v = !1, !p && !h && w();
|
|
216
198
|
}, G = () => {
|
|
217
|
-
|
|
199
|
+
h = !0, z();
|
|
218
200
|
}, Q = () => {
|
|
219
|
-
|
|
220
|
-
}, X = () => {
|
|
221
|
-
E = !1, !h && !w && L();
|
|
201
|
+
h = !1, !p && !v && w();
|
|
222
202
|
};
|
|
223
|
-
|
|
224
|
-
function
|
|
225
|
-
|
|
203
|
+
i.addEventListener("mouseenter", U), i.addEventListener("mouseleave", V), e.addEventListener("mouseenter", W), e.addEventListener("mouseleave", K), o.addEventListener("mouseenter", G), o.addEventListener("mouseleave", Q), e.addEventListener("click", l);
|
|
204
|
+
function re() {
|
|
205
|
+
J(), j(), e.removeEventListener("click", l), i.removeEventListener("mouseenter", U), i.removeEventListener("mouseleave", V), e.removeEventListener("mouseenter", W), e.removeEventListener("mouseleave", K), o.removeEventListener("mouseenter", G), o.removeEventListener("mouseleave", Q), e.parentElement === document.body && document.body.removeChild(e), o.parentElement === document.body && document.body.removeChild(o);
|
|
226
206
|
}
|
|
227
|
-
return
|
|
207
|
+
return re;
|
|
228
208
|
}
|
|
229
209
|
const He = (t) => typeof (t == null ? void 0 : t.uid) == "string" && t.uid.trim() !== "" ? { "data-flyo-uid": t.uid } : {}, Ie = () => {
|
|
230
|
-
const { liveEdit: t } =
|
|
210
|
+
const { liveEdit: t } = Ne("flyo");
|
|
231
211
|
if (!t)
|
|
232
212
|
return;
|
|
233
213
|
let n = null;
|
|
234
|
-
const
|
|
235
|
-
|
|
214
|
+
const l = [], i = () => {
|
|
215
|
+
l.forEach((e) => e()), l.length = 0, document.querySelectorAll("[data-flyo-uid]").forEach((e) => {
|
|
236
216
|
const o = e.getAttribute("data-flyo-uid");
|
|
237
217
|
if (o && e instanceof HTMLElement) {
|
|
238
218
|
const r = je(o, e);
|
|
239
|
-
typeof r == "function" &&
|
|
219
|
+
typeof r == "function" && l.push(r);
|
|
240
220
|
}
|
|
241
221
|
});
|
|
242
222
|
};
|
|
243
223
|
Ce(() => {
|
|
244
|
-
ze(), Re(),
|
|
224
|
+
ze(), Re(), i(), n = new MutationObserver((e) => {
|
|
245
225
|
e.some(
|
|
246
|
-
(r) => Array.from(r.addedNodes).some((
|
|
247
|
-
if (
|
|
248
|
-
const
|
|
249
|
-
return
|
|
226
|
+
(r) => Array.from(r.addedNodes).some((m) => {
|
|
227
|
+
if (m.nodeType === Node.ELEMENT_NODE) {
|
|
228
|
+
const M = m;
|
|
229
|
+
return M.hasAttribute("data-flyo-uid") || M.querySelector("[data-flyo-uid]");
|
|
250
230
|
}
|
|
251
231
|
return !1;
|
|
252
232
|
})
|
|
253
|
-
) &&
|
|
233
|
+
) && i();
|
|
254
234
|
}), n.observe(document.body, {
|
|
255
235
|
childList: !0,
|
|
256
236
|
subtree: !0
|
|
257
237
|
});
|
|
258
238
|
}), Je(() => {
|
|
259
|
-
n && n.disconnect(),
|
|
239
|
+
n && n.disconnect(), l.forEach((e) => e()), l.length = 0;
|
|
260
240
|
});
|
|
261
|
-
},
|
|
262
|
-
const n =
|
|
241
|
+
}, De = (t) => {
|
|
242
|
+
const n = d(!1), l = d(null), i = d(null);
|
|
263
243
|
return {
|
|
264
244
|
isLoading: n,
|
|
265
|
-
response:
|
|
266
|
-
error:
|
|
245
|
+
response: l,
|
|
246
|
+
error: i,
|
|
267
247
|
fetch: async () => {
|
|
268
248
|
try {
|
|
269
|
-
|
|
249
|
+
i.value = null, n.value = !0, l.value = JSON.parse(JSON.stringify(await new pe(k()).page({ slug: t }))), n.value = !1;
|
|
270
250
|
} catch (o) {
|
|
271
|
-
n.value = !1,
|
|
251
|
+
n.value = !1, l.value = null, i.value = JSON.parse(JSON.stringify(o));
|
|
272
252
|
}
|
|
273
253
|
return {
|
|
274
|
-
response:
|
|
275
|
-
error:
|
|
254
|
+
response: y(l),
|
|
255
|
+
error: y(i)
|
|
276
256
|
};
|
|
277
257
|
}
|
|
278
258
|
};
|
|
279
|
-
},
|
|
280
|
-
const t =
|
|
259
|
+
}, Ue = () => {
|
|
260
|
+
const t = d(!1), n = d(null), l = d(null);
|
|
281
261
|
return {
|
|
282
262
|
isLoading: t,
|
|
283
263
|
response: n,
|
|
284
|
-
error:
|
|
264
|
+
error: l,
|
|
285
265
|
fetch: async () => {
|
|
286
266
|
try {
|
|
287
|
-
|
|
267
|
+
l.value = null, t.value = !0, n.value = JSON.parse(JSON.stringify(await new ve(k()).sitemap())), t.value = !1;
|
|
288
268
|
} catch (e) {
|
|
289
|
-
t.value = !1, n.value = null,
|
|
269
|
+
t.value = !1, n.value = null, l.value = JSON.parse(JSON.stringify(e));
|
|
290
270
|
}
|
|
291
271
|
return {
|
|
292
|
-
response:
|
|
293
|
-
error:
|
|
272
|
+
response: y(n),
|
|
273
|
+
error: y(l)
|
|
294
274
|
};
|
|
295
275
|
}
|
|
296
276
|
};
|
|
297
|
-
},
|
|
277
|
+
}, Ve = {
|
|
298
278
|
install(t, n) {
|
|
299
|
-
Fe(n), t.component(
|
|
279
|
+
Fe(n), t.component(ee.name, ee), t.component(te.name, te), t.provide("flyo", {
|
|
300
280
|
liveEdit: n.liveEdit,
|
|
301
281
|
liveEditOrigin: n.liveEditOrigin
|
|
302
282
|
});
|
|
303
283
|
}
|
|
304
284
|
};
|
|
305
285
|
export {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
286
|
+
ee as Block,
|
|
287
|
+
Ve as FlyoVue,
|
|
288
|
+
te as Page,
|
|
289
|
+
Ve as default,
|
|
310
290
|
He as editable,
|
|
311
|
-
|
|
291
|
+
k as getFlyoConfig,
|
|
312
292
|
_e as useFlyoConfig,
|
|
313
293
|
qe as useFlyoEntity,
|
|
314
294
|
Ie as useFlyoLiveEdit,
|
|
315
|
-
|
|
316
|
-
|
|
295
|
+
De as useFlyoPage,
|
|
296
|
+
Ue as useFlyoSitemap
|
|
317
297
|
};
|