@creopse/vue 0.0.9 → 0.0.10
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.js +1 -1
- package/dist/index.mjs +197 -34
- package/package.json +2 -2
- package/types/components/widgets/MountedTeleport.vue.d.ts +15 -0
- package/types/components/widgets/ReadMore.vue.d.ts +14 -0
- package/types/components/widgets/StickyBottom.vue.d.ts +21 -0
- package/types/components/widgets/StickyTop.vue.d.ts +21 -0
- package/types/index.d.ts +5 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),k=["src","alt","title","width","height","loading"],h=e.defineComponent({__name:"AsyncImg",props:{load:{type:Function},alt:{},width:{},height:{},title:{},loading:{},style:{}},setup(o){const t=o,n=e.ref("");return(async()=>{n.value=await t.load()})(),(s,r)=>(e.openBlock(),e.createElementBlock("img",{src:e.unref(n),alt:t.alt,title:t.title,style:e.normalizeStyle(t.style),width:t.width,height:t.height,loading:t.loading},null,12,k))}}),S=e.defineComponent({__name:"CustomTransition",props:{name:{default:"fade"},mode:{default:"out-in"},appear:{type:Boolean,default:!1}},setup(o){const t=o;return(n,l)=>(e.openBlock(),e.createBlock(e.Transition,{name:t.name,mode:t.mode,appear:t.appear},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default",{},void 0,!0)]),_:3},8,["name","mode","appear"]))}}),C=(o,t)=>{const n=o.__vccOpts||o;for(const[l,s]of t)n[l]=s;return n},g=C(S,[["__scopeId","data-v-30b5e62e"]]),_=e.defineComponent({__name:"MountedTeleport",props:{to:{}},setup(o){const t=o,n=e.ref(!1);return e.onMounted(()=>{n.value=!0}),e.onUnmounted(()=>{n.value=!1}),(l,s)=>e.unref(n)?(e.openBlock(),e.createBlock(e.Teleport,{key:0,to:t.to},[e.renderSlot(l.$slots,"default")],8,["to"])):e.createCommentVNode("",!0)}}),B=["innerHTML"],z=["href"],E=["href"],w=e.defineComponent({__name:"ReadMore",props:{moreStr:{default:"Read more"},lessStr:{default:""},text:{},link:{default:"#"},maxChars:{default:100}},setup(o){const t=o,n=e.ref(!1),l=e.computed(()=>!n.value&&t.text.length>t.maxChars?t.text.substring(0,t.maxChars)+"...":t.text),s=(r,i)=>{t.link=="#"&&r.preventDefault(),t.lessStr&&(n.value=i)};return(r,i)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("span",{innerHTML:e.unref(l)},null,8,B),e.withDirectives(e.createElementVNode("span",null,[e.withDirectives(e.createElementVNode("a",{id:"readmore",href:t.link,onClick:i[0]||(i[0]=a=>s(a,!0))},e.toDisplayString(t.moreStr),9,z),[[e.vShow,!e.unref(n)]]),e.withDirectives(e.createElementVNode("a",{id:"readmore",href:t.link,onClick:i[1]||(i[1]=a=>s(a,!1))},e.toDisplayString(t.lessStr),9,E),[[e.vShow,e.unref(n)]])],512),[[e.vShow,t.text.length>t.maxChars]])]))}}),y=e.defineComponent({__name:"StickyBottom",props:{bottom:{default:0},zIndex:{default:1},className:{default:""}},setup(o){const t=o,n=e.ref(null),l=e.ref(!1),s=e.ref(""),r=e.ref(void 0),i=e.ref(void 0),a=e.ref(!1);e.onMounted(()=>{i.value=n.value?.getBoundingClientRect().height,window.addEventListener("scroll",u),window.addEventListener("resize",f),u()}),e.onActivated(()=>{u()}),e.onUnmounted(()=>{window.removeEventListener("scroll",u),window.removeEventListener("resize",f)});const m=()=>{l.value||(s.value="fixed",l.value=!0,r.value=r.value+"px",a.value=!0)},p=()=>{l.value&&v()},v=()=>{s.value="",r.value="auto",l.value=!1,a.value=!1},u=()=>{const d=n.value?.getBoundingClientRect().width;if(r.value=d||"auto",(n.value?.getBoundingClientRect().bottom||0)>t.bottom){m();return}p()},f=()=>{a.value&&(r.value=n.value?.getBoundingClientRect().width+"px")};return(d,c)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"el",ref:n,style:e.normalizeStyle({height:e.unref(i)+"px",zIndex:t.zIndex})},[e.createElementVNode("div",{class:e.normalizeClass(t.className),style:e.normalizeStyle({bottom:e.unref(a)?t.bottom+"px":"",zIndex:t.zIndex,position:e.unref(s),width:e.unref(r),height:e.unref(i)+"px"})},[e.renderSlot(d.$slots,"default",{},()=>[c[0]||(c[0]=e.createElementVNode("div",null,"Sticky Bottom",-1))])],6)],4))}}),x=e.defineComponent({__name:"StickyTop",props:{top:{default:0},zIndex:{default:1},className:{default:""}},setup(o){const t=o,n=e.ref(null),l=e.ref(!1),s=e.ref(""),r=e.ref(void 0),i=e.ref(void 0),a=e.ref(!1);e.onMounted(()=>{i.value=n.value?.getBoundingClientRect().height,window.addEventListener("scroll",u),window.addEventListener("resize",f)}),e.onActivated(()=>{u()}),e.onUnmounted(()=>{window.removeEventListener("scroll",u),window.removeEventListener("resize",f)});const m=()=>{l.value||(s.value="fixed",l.value=!0,r.value=r.value+"px",a.value=!0)},p=()=>{l.value&&v()},v=()=>{s.value="",r.value="auto",l.value=!1,a.value=!1},u=()=>{const d=n.value?.getBoundingClientRect().width;if(r.value=d||"auto",(n.value?.getBoundingClientRect().top||0)<t.top){m();return}p()},f=()=>{a.value&&(r.value=n.value?.getBoundingClientRect().width+"px")};return(d,c)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"el",ref:n,style:e.normalizeStyle({height:e.unref(i)+"px",zIndex:t.zIndex})},[e.createElementVNode("div",{class:e.normalizeClass(t.className),style:e.normalizeStyle({top:e.unref(a)?t.top+"px":"",zIndex:t.zIndex,position:e.unref(s),width:e.unref(r),height:e.unref(i)+"px"})},[e.renderSlot(d.$slots,"default",{},()=>[c[0]||(c[0]=e.createElementVNode("div",null,"Sticky Top",-1))])],6)],4))}}),R={install(o){o.component("CustomTransition",g),o.component("MountedTeleport",_),o.component("StickyBottom",y),o.component("StickyTop",x),o.component("ReadMore",w),o.component("AsyncImg",h)}};exports.AsyncImg=h;exports.CustomTransition=g;exports.MountedTeleport=_;exports.ReadMore=w;exports.StickyBottom=y;exports.StickyTop=x;exports.default=R;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var CreopseVueToolkit=function(
|
|
1
|
+
var CreopseVueToolkit=function(d,e){"use strict";const x=["src","alt","title","width","height","loading"],_=e.defineComponent({__name:"AsyncImg",props:{load:{type:Function},alt:{},width:{},height:{},title:{},loading:{},style:{}},setup(o){const t=o,n=e.ref("");return(async()=>{n.value=await t.load()})(),(i,r)=>(e.openBlock(),e.createElementBlock("img",{src:e.unref(n),alt:t.alt,title:t.title,style:e.normalizeStyle(t.style),width:t.width,height:t.height,loading:t.loading},null,12,x))}}),w=((o,t)=>{const n=o.__vccOpts||o;for(const[l,i]of t)n[l]=i;return n})(e.defineComponent({__name:"CustomTransition",props:{name:{default:"fade"},mode:{default:"out-in"},appear:{type:Boolean,default:!1}},setup(o){const t=o;return(n,l)=>(e.openBlock(),e.createBlock(e.Transition,{name:t.name,mode:t.mode,appear:t.appear},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default",{},void 0,!0)]),_:3},8,["name","mode","appear"]))}}),[["__scopeId","data-v-30b5e62e"]]),y=e.defineComponent({__name:"MountedTeleport",props:{to:{}},setup(o){const t=o,n=e.ref(!1);return e.onMounted(()=>{n.value=!0}),e.onUnmounted(()=>{n.value=!1}),(l,i)=>e.unref(n)?(e.openBlock(),e.createBlock(e.Teleport,{key:0,to:t.to},[e.renderSlot(l.$slots,"default")],8,["to"])):e.createCommentVNode("",!0)}}),B=["innerHTML"],z=["href"],E=["href"],k=e.defineComponent({__name:"ReadMore",props:{moreStr:{default:"Read more"},lessStr:{default:""},text:{},link:{default:"#"},maxChars:{default:100}},setup(o){const t=o,n=e.ref(!1),l=e.computed(()=>!n.value&&t.text.length>t.maxChars?t.text.substring(0,t.maxChars)+"...":t.text),i=(r,a)=>{t.link=="#"&&r.preventDefault(),t.lessStr&&(n.value=a)};return(r,a)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("span",{innerHTML:e.unref(l)},null,8,B),e.withDirectives(e.createElementVNode("span",null,[e.withDirectives(e.createElementVNode("a",{id:"readmore",href:t.link,onClick:a[0]||(a[0]=s=>i(s,!0))},e.toDisplayString(t.moreStr),9,z),[[e.vShow,!e.unref(n)]]),e.withDirectives(e.createElementVNode("a",{id:"readmore",href:t.link,onClick:a[1]||(a[1]=s=>i(s,!1))},e.toDisplayString(t.lessStr),9,E),[[e.vShow,e.unref(n)]])],512),[[e.vShow,t.text.length>t.maxChars]])]))}}),S=e.defineComponent({__name:"StickyBottom",props:{bottom:{default:0},zIndex:{default:1},className:{default:""}},setup(o){const t=o,n=e.ref(null),l=e.ref(!1),i=e.ref(""),r=e.ref(void 0),a=e.ref(void 0),s=e.ref(!1);e.onMounted(()=>{a.value=n.value?.getBoundingClientRect().height,window.addEventListener("scroll",c),window.addEventListener("resize",p),c()}),e.onActivated(()=>{c()}),e.onUnmounted(()=>{window.removeEventListener("scroll",c),window.removeEventListener("resize",p)});const u=()=>{l.value||(i.value="fixed",l.value=!0,r.value=r.value+"px",s.value=!0)},h=()=>{l.value&&g()},g=()=>{i.value="",r.value="auto",l.value=!1,s.value=!1},c=()=>{const f=n.value?.getBoundingClientRect().width;if(r.value=f||"auto",(n.value?.getBoundingClientRect().bottom||0)>t.bottom){u();return}h()},p=()=>{s.value&&(r.value=n.value?.getBoundingClientRect().width+"px")};return(f,m)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"el",ref:n,style:e.normalizeStyle({height:e.unref(a)+"px",zIndex:t.zIndex})},[e.createElementVNode("div",{class:e.normalizeClass(t.className),style:e.normalizeStyle({bottom:e.unref(s)?t.bottom+"px":"",zIndex:t.zIndex,position:e.unref(i),width:e.unref(r),height:e.unref(a)+"px"})},[e.renderSlot(f.$slots,"default",{},()=>[m[0]||(m[0]=e.createElementVNode("div",null,"Sticky Bottom",-1))])],6)],4))}}),C=e.defineComponent({__name:"StickyTop",props:{top:{default:0},zIndex:{default:1},className:{default:""}},setup(o){const t=o,n=e.ref(null),l=e.ref(!1),i=e.ref(""),r=e.ref(void 0),a=e.ref(void 0),s=e.ref(!1);e.onMounted(()=>{a.value=n.value?.getBoundingClientRect().height,window.addEventListener("scroll",c),window.addEventListener("resize",p)}),e.onActivated(()=>{c()}),e.onUnmounted(()=>{window.removeEventListener("scroll",c),window.removeEventListener("resize",p)});const u=()=>{l.value||(i.value="fixed",l.value=!0,r.value=r.value+"px",s.value=!0)},h=()=>{l.value&&g()},g=()=>{i.value="",r.value="auto",l.value=!1,s.value=!1},c=()=>{const f=n.value?.getBoundingClientRect().width;if(r.value=f||"auto",(n.value?.getBoundingClientRect().top||0)<t.top){u();return}h()},p=()=>{s.value&&(r.value=n.value?.getBoundingClientRect().width+"px")};return(f,m)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"el",ref:n,style:e.normalizeStyle({height:e.unref(a)+"px",zIndex:t.zIndex})},[e.createElementVNode("div",{class:e.normalizeClass(t.className),style:e.normalizeStyle({top:e.unref(s)?t.top+"px":"",zIndex:t.zIndex,position:e.unref(i),width:e.unref(r),height:e.unref(a)+"px"})},[e.renderSlot(f.$slots,"default",{},()=>[m[0]||(m[0]=e.createElementVNode("div",null,"Sticky Top",-1))])],6)],4))}}),T={install(o){o.component("CustomTransition",w),o.component("MountedTeleport",y),o.component("StickyBottom",S),o.component("StickyTop",C),o.component("ReadMore",k),o.component("AsyncImg",_)}};return d.AsyncImg=_,d.CustomTransition=w,d.MountedTeleport=y,d.ReadMore=k,d.StickyBottom=S,d.StickyTop=C,d.default=T,Object.defineProperties(d,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),d}({},Vue);
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as v, ref as l, createElementBlock as _, openBlock as m, normalizeStyle as g, unref as a, createBlock as T, Transition as E, withCtx as L, renderSlot as x, onMounted as z, onUnmounted as B, createCommentVNode as $, Teleport as b, computed as N, createElementVNode as c, withDirectives as S, toDisplayString as R, vShow as C, onActivated as I, normalizeClass as M } from "vue";
|
|
2
|
+
const A = ["src", "alt", "title", "width", "height", "loading"], D = /* @__PURE__ */ v({
|
|
3
3
|
__name: "AsyncImg",
|
|
4
4
|
props: {
|
|
5
5
|
load: { type: Function },
|
|
@@ -10,52 +10,215 @@ const f = ["src", "alt", "title", "width", "height", "loading"], h = /* @__PURE_
|
|
|
10
10
|
loading: {},
|
|
11
11
|
style: {}
|
|
12
12
|
},
|
|
13
|
-
setup(
|
|
14
|
-
const
|
|
13
|
+
setup(n) {
|
|
14
|
+
const e = n, t = l("");
|
|
15
15
|
return (async () => {
|
|
16
|
-
|
|
17
|
-
})(), (
|
|
18
|
-
src:
|
|
19
|
-
alt:
|
|
20
|
-
title:
|
|
21
|
-
style:
|
|
22
|
-
width:
|
|
23
|
-
height:
|
|
24
|
-
loading:
|
|
25
|
-
}, null, 12,
|
|
16
|
+
t.value = await e.load();
|
|
17
|
+
})(), (i, s) => (m(), _("img", {
|
|
18
|
+
src: a(t),
|
|
19
|
+
alt: e.alt,
|
|
20
|
+
title: e.title,
|
|
21
|
+
style: g(e.style),
|
|
22
|
+
width: e.width,
|
|
23
|
+
height: e.height,
|
|
24
|
+
loading: e.loading
|
|
25
|
+
}, null, 12, A));
|
|
26
26
|
}
|
|
27
|
-
}),
|
|
27
|
+
}), H = /* @__PURE__ */ v({
|
|
28
28
|
__name: "CustomTransition",
|
|
29
29
|
props: {
|
|
30
30
|
name: { default: "fade" },
|
|
31
31
|
mode: { default: "out-in" },
|
|
32
32
|
appear: { type: Boolean, default: !1 }
|
|
33
33
|
},
|
|
34
|
-
setup(
|
|
35
|
-
const
|
|
36
|
-
return (
|
|
37
|
-
name:
|
|
38
|
-
mode:
|
|
39
|
-
appear:
|
|
34
|
+
setup(n) {
|
|
35
|
+
const e = n;
|
|
36
|
+
return (t, o) => (m(), T(E, {
|
|
37
|
+
name: e.name,
|
|
38
|
+
mode: e.mode,
|
|
39
|
+
appear: e.appear
|
|
40
40
|
}, {
|
|
41
|
-
default:
|
|
42
|
-
|
|
41
|
+
default: L(() => [
|
|
42
|
+
x(t.$slots, "default", {}, void 0, !0)
|
|
43
43
|
]),
|
|
44
44
|
_: 3
|
|
45
45
|
}, 8, ["name", "mode", "appear"]));
|
|
46
46
|
}
|
|
47
|
-
}),
|
|
48
|
-
const
|
|
49
|
-
for (const [o,
|
|
50
|
-
|
|
51
|
-
return
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
}), V = (n, e) => {
|
|
48
|
+
const t = n.__vccOpts || n;
|
|
49
|
+
for (const [o, i] of e)
|
|
50
|
+
t[o] = i;
|
|
51
|
+
return t;
|
|
52
|
+
}, F = /* @__PURE__ */ V(H, [["__scopeId", "data-v-30b5e62e"]]), O = /* @__PURE__ */ v({
|
|
53
|
+
__name: "MountedTeleport",
|
|
54
|
+
props: {
|
|
55
|
+
to: {}
|
|
56
|
+
},
|
|
57
|
+
setup(n) {
|
|
58
|
+
const e = n, t = l(!1);
|
|
59
|
+
return z(() => {
|
|
60
|
+
t.value = !0;
|
|
61
|
+
}), B(() => {
|
|
62
|
+
t.value = !1;
|
|
63
|
+
}), (o, i) => a(t) ? (m(), T(b, {
|
|
64
|
+
key: 0,
|
|
65
|
+
to: e.to
|
|
66
|
+
}, [
|
|
67
|
+
x(o.$slots, "default")
|
|
68
|
+
], 8, ["to"])) : $("", !0);
|
|
69
|
+
}
|
|
70
|
+
}), U = ["innerHTML"], j = ["href"], q = ["href"], G = /* @__PURE__ */ v({
|
|
71
|
+
__name: "ReadMore",
|
|
72
|
+
props: {
|
|
73
|
+
moreStr: { default: "Read more" },
|
|
74
|
+
lessStr: { default: "" },
|
|
75
|
+
text: {},
|
|
76
|
+
link: { default: "#" },
|
|
77
|
+
maxChars: { default: 100 }
|
|
78
|
+
},
|
|
79
|
+
setup(n) {
|
|
80
|
+
const e = n, t = l(!1), o = N(() => !t.value && e.text.length > e.maxChars ? e.text.substring(0, e.maxChars) + "..." : e.text), i = (s, r) => {
|
|
81
|
+
e.link == "#" && s.preventDefault(), e.lessStr && (t.value = r);
|
|
82
|
+
};
|
|
83
|
+
return (s, r) => (m(), _("div", null, [
|
|
84
|
+
c("span", { innerHTML: a(o) }, null, 8, U),
|
|
85
|
+
S(c("span", null, [
|
|
86
|
+
S(c("a", {
|
|
87
|
+
id: "readmore",
|
|
88
|
+
href: e.link,
|
|
89
|
+
onClick: r[0] || (r[0] = (u) => i(u, !0))
|
|
90
|
+
}, R(e.moreStr), 9, j), [
|
|
91
|
+
[C, !a(t)]
|
|
92
|
+
]),
|
|
93
|
+
S(c("a", {
|
|
94
|
+
id: "readmore",
|
|
95
|
+
href: e.link,
|
|
96
|
+
onClick: r[1] || (r[1] = (u) => i(u, !1))
|
|
97
|
+
}, R(e.lessStr), 9, q), [
|
|
98
|
+
[C, a(t)]
|
|
99
|
+
])
|
|
100
|
+
], 512), [
|
|
101
|
+
[C, e.text.length > e.maxChars]
|
|
102
|
+
])
|
|
103
|
+
]));
|
|
104
|
+
}
|
|
105
|
+
}), J = /* @__PURE__ */ v({
|
|
106
|
+
__name: "StickyBottom",
|
|
107
|
+
props: {
|
|
108
|
+
bottom: { default: 0 },
|
|
109
|
+
zIndex: { default: 1 },
|
|
110
|
+
className: { default: "" }
|
|
111
|
+
},
|
|
112
|
+
setup(n) {
|
|
113
|
+
const e = n, t = l(null), o = l(!1), i = l(""), s = l(void 0), r = l(void 0), u = l(!1);
|
|
114
|
+
z(() => {
|
|
115
|
+
r.value = t.value?.getBoundingClientRect().height, window.addEventListener("scroll", d), window.addEventListener("resize", h), d();
|
|
116
|
+
}), I(() => {
|
|
117
|
+
d();
|
|
118
|
+
}), B(() => {
|
|
119
|
+
window.removeEventListener("scroll", d), window.removeEventListener("resize", h);
|
|
120
|
+
});
|
|
121
|
+
const w = () => {
|
|
122
|
+
o.value || (i.value = "fixed", o.value = !0, s.value = s.value + "px", u.value = !0);
|
|
123
|
+
}, y = () => {
|
|
124
|
+
o.value && k();
|
|
125
|
+
}, k = () => {
|
|
126
|
+
i.value = "", s.value = "auto", o.value = !1, u.value = !1;
|
|
127
|
+
}, d = () => {
|
|
128
|
+
const p = t.value?.getBoundingClientRect().width;
|
|
129
|
+
if (s.value = p || "auto", (t.value?.getBoundingClientRect().bottom || 0) > e.bottom) {
|
|
130
|
+
w();
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
y();
|
|
134
|
+
}, h = () => {
|
|
135
|
+
u.value && (s.value = t.value?.getBoundingClientRect().width + "px");
|
|
136
|
+
};
|
|
137
|
+
return (p, f) => (m(), _("div", {
|
|
138
|
+
ref_key: "el",
|
|
139
|
+
ref: t,
|
|
140
|
+
style: g({ height: a(r) + "px", zIndex: e.zIndex })
|
|
141
|
+
}, [
|
|
142
|
+
c("div", {
|
|
143
|
+
class: M(e.className),
|
|
144
|
+
style: g({
|
|
145
|
+
bottom: a(u) ? e.bottom + "px" : "",
|
|
146
|
+
zIndex: e.zIndex,
|
|
147
|
+
position: a(i),
|
|
148
|
+
width: a(s),
|
|
149
|
+
height: a(r) + "px"
|
|
150
|
+
})
|
|
151
|
+
}, [
|
|
152
|
+
x(p.$slots, "default", {}, () => [
|
|
153
|
+
f[0] || (f[0] = c("div", null, "Sticky Bottom", -1))
|
|
154
|
+
])
|
|
155
|
+
], 6)
|
|
156
|
+
], 4));
|
|
157
|
+
}
|
|
158
|
+
}), K = /* @__PURE__ */ v({
|
|
159
|
+
__name: "StickyTop",
|
|
160
|
+
props: {
|
|
161
|
+
top: { default: 0 },
|
|
162
|
+
zIndex: { default: 1 },
|
|
163
|
+
className: { default: "" }
|
|
164
|
+
},
|
|
165
|
+
setup(n) {
|
|
166
|
+
const e = n, t = l(null), o = l(!1), i = l(""), s = l(void 0), r = l(void 0), u = l(!1);
|
|
167
|
+
z(() => {
|
|
168
|
+
r.value = t.value?.getBoundingClientRect().height, window.addEventListener("scroll", d), window.addEventListener("resize", h);
|
|
169
|
+
}), I(() => {
|
|
170
|
+
d();
|
|
171
|
+
}), B(() => {
|
|
172
|
+
window.removeEventListener("scroll", d), window.removeEventListener("resize", h);
|
|
173
|
+
});
|
|
174
|
+
const w = () => {
|
|
175
|
+
o.value || (i.value = "fixed", o.value = !0, s.value = s.value + "px", u.value = !0);
|
|
176
|
+
}, y = () => {
|
|
177
|
+
o.value && k();
|
|
178
|
+
}, k = () => {
|
|
179
|
+
i.value = "", s.value = "auto", o.value = !1, u.value = !1;
|
|
180
|
+
}, d = () => {
|
|
181
|
+
const p = t.value?.getBoundingClientRect().width;
|
|
182
|
+
if (s.value = p || "auto", (t.value?.getBoundingClientRect().top || 0) < e.top) {
|
|
183
|
+
w();
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
y();
|
|
187
|
+
}, h = () => {
|
|
188
|
+
u.value && (s.value = t.value?.getBoundingClientRect().width + "px");
|
|
189
|
+
};
|
|
190
|
+
return (p, f) => (m(), _("div", {
|
|
191
|
+
ref_key: "el",
|
|
192
|
+
ref: t,
|
|
193
|
+
style: g({ height: a(r) + "px", zIndex: e.zIndex })
|
|
194
|
+
}, [
|
|
195
|
+
c("div", {
|
|
196
|
+
class: M(e.className),
|
|
197
|
+
style: g({
|
|
198
|
+
top: a(u) ? e.top + "px" : "",
|
|
199
|
+
zIndex: e.zIndex,
|
|
200
|
+
position: a(i),
|
|
201
|
+
width: a(s),
|
|
202
|
+
height: a(r) + "px"
|
|
203
|
+
})
|
|
204
|
+
}, [
|
|
205
|
+
x(p.$slots, "default", {}, () => [
|
|
206
|
+
f[0] || (f[0] = c("div", null, "Sticky Top", -1))
|
|
207
|
+
])
|
|
208
|
+
], 6)
|
|
209
|
+
], 4));
|
|
210
|
+
}
|
|
211
|
+
}), Q = {
|
|
212
|
+
install(n) {
|
|
213
|
+
n.component("CustomTransition", F), n.component("MountedTeleport", O), n.component("StickyBottom", J), n.component("StickyTop", K), n.component("ReadMore", G), n.component("AsyncImg", D);
|
|
55
214
|
}
|
|
56
215
|
};
|
|
57
216
|
export {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
217
|
+
D as AsyncImg,
|
|
218
|
+
F as CustomTransition,
|
|
219
|
+
O as MountedTeleport,
|
|
220
|
+
G as ReadMore,
|
|
221
|
+
J as StickyBottom,
|
|
222
|
+
K as StickyTop,
|
|
223
|
+
Q as default
|
|
61
224
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@creopse/vue",
|
|
3
3
|
"description": "Creopse Vue Toolkit",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.10",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Noé Gnanih <noegnanih@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -64,4 +64,4 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
66
66
|
}
|
|
67
|
-
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
to: string;
|
|
3
|
+
}
|
|
4
|
+
declare var __VLS_5: {};
|
|
5
|
+
type __VLS_Slots = {} & {
|
|
6
|
+
default?: (props: typeof __VLS_5) => any;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
10
|
+
export default _default;
|
|
11
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
12
|
+
new (): {
|
|
13
|
+
$slots: S;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
moreStr?: string;
|
|
3
|
+
lessStr?: string;
|
|
4
|
+
text: string;
|
|
5
|
+
link?: string;
|
|
6
|
+
maxChars?: number;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
9
|
+
link: string;
|
|
10
|
+
moreStr: string;
|
|
11
|
+
lessStr: string;
|
|
12
|
+
maxChars: number;
|
|
13
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
bottom?: number;
|
|
3
|
+
zIndex?: number;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
declare var __VLS_1: {};
|
|
7
|
+
type __VLS_Slots = {} & {
|
|
8
|
+
default?: (props: typeof __VLS_1) => any;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
11
|
+
bottom: number;
|
|
12
|
+
zIndex: number;
|
|
13
|
+
className: string;
|
|
14
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
16
|
+
export default _default;
|
|
17
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
18
|
+
new (): {
|
|
19
|
+
$slots: S;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
top?: number;
|
|
3
|
+
zIndex?: number;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
declare var __VLS_1: {};
|
|
7
|
+
type __VLS_Slots = {} & {
|
|
8
|
+
default?: (props: typeof __VLS_1) => any;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
11
|
+
zIndex: number;
|
|
12
|
+
className: string;
|
|
13
|
+
top: number;
|
|
14
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
16
|
+
export default _default;
|
|
17
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
18
|
+
new (): {
|
|
19
|
+
$slots: S;
|
|
20
|
+
};
|
|
21
|
+
};
|
package/types/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type { App } from 'vue';
|
|
2
2
|
import AsyncImg from './components/widgets/AsyncImg.vue';
|
|
3
3
|
import CustomTransition from './components/widgets/CustomTransition.vue';
|
|
4
|
+
import MountedTeleport from './components/widgets/MountedTeleport.vue';
|
|
5
|
+
import ReadMore from './components/widgets/ReadMore.vue';
|
|
6
|
+
import StickyBottom from './components/widgets/StickyBottom.vue';
|
|
7
|
+
import StickyTop from './components/widgets/StickyTop.vue';
|
|
4
8
|
declare const plugin: {
|
|
5
9
|
install(app: App): void;
|
|
6
10
|
};
|
|
7
|
-
export { CustomTransition, AsyncImg };
|
|
11
|
+
export { CustomTransition, MountedTeleport, StickyBottom, StickyTop, ReadMore, AsyncImg, };
|
|
8
12
|
export default plugin;
|