vft 0.0.476 → 0.0.478
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.css +1 -1
- package/es/components/config-provider/hooks/use-global-config.js +3 -3
- package/es/components/icon-text/icon-text.vue2.js +13 -13
- package/es/components/iframe-layout/iframe-page.vue2.js +17 -17
- package/es/components/md-container/index.d.ts +9 -0
- package/es/components/md-container/md-container.vue.d.ts +2 -0
- package/es/components/md-container/md-container.vue2.js +75 -74
- package/es/components/md-container/toc.js +5 -5
- package/es/hooks/use-z-index/index.js +3 -3
- package/es/package.json.d.ts +1 -1
- package/es/package.json.js +1 -1
- package/lib/components/icon-text/icon-text.vue2.cjs +1 -1
- package/lib/components/iframe-layout/iframe-page.vue2.cjs +1 -1
- package/lib/components/md-container/index.d.ts +9 -0
- package/lib/components/md-container/md-container.vue.d.ts +2 -0
- package/lib/components/md-container/md-container.vue2.cjs +1 -1
- package/lib/components/md-container/toc.cjs +1 -1
- package/lib/package.json.cjs +1 -1
- package/lib/package.json.d.ts +1 -1
- package/package.json +4 -4
- package/theme-style/index.css +1 -1
- package/theme-style/src/md-comment.scss +2 -0
- package/theme-style/src/md-container.scss +2 -2
- package/theme-style/vft-md-comment.css +1 -1
- package/theme-style/vft-md-container.css +1 -1
- package/web-types.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { keysOf as f } from "@vft/utils";
|
|
2
2
|
import "@vueuse/core";
|
|
3
3
|
import { debugWarn as v } from "../../../utils/error.js";
|
|
4
|
-
import {
|
|
4
|
+
import { getCurrentInstance as l, computed as i, unref as p, provide as g, ref as C, inject as x } from "vue";
|
|
5
5
|
import "lodash-es";
|
|
6
6
|
import "../../form/index.js";
|
|
7
7
|
import { namespaceContextKey as I, useNamespace as b, defaultNamespace as y } from "../../../hooks/use-namespace/index.js";
|
|
@@ -9,7 +9,7 @@ import "../../../hooks/use-model-toggle/index.js";
|
|
|
9
9
|
import "@popperjs/core";
|
|
10
10
|
import { zIndexContextKey as G, useZIndex as z, defaultInitialZIndex as K } from "../../../hooks/use-z-index/index.js";
|
|
11
11
|
import { configProviderContextKey as m } from "../constants.js";
|
|
12
|
-
const a =
|
|
12
|
+
const a = C();
|
|
13
13
|
function d(o, e = void 0) {
|
|
14
14
|
const n = l() ? x(m, a) : a;
|
|
15
15
|
return o ? i(() => n?.value?.[o] ?? e) : n;
|
|
@@ -27,7 +27,7 @@ function B(o) {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
const S = (o, e, n = !1) => {
|
|
30
|
-
const t = !!l(), r = t ? d() : void 0, u = e?.provide ?? (t ?
|
|
30
|
+
const t = !!l(), r = t ? d() : void 0, u = e?.provide ?? (t ? g : void 0);
|
|
31
31
|
if (!u) {
|
|
32
32
|
v(
|
|
33
33
|
"provideGlobalConfig",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as C, computed as o, createElementBlock as f, openBlock as l, normalizeStyle as k, normalizeClass as S, unref as r, createBlock as
|
|
1
|
+
import { defineComponent as C, computed as o, createElementBlock as f, openBlock as l, normalizeStyle as k, normalizeClass as S, unref as r, createBlock as c, createCommentVNode as y, mergeProps as s, normalizeProps as b, toDisplayString as I } from "vue";
|
|
2
2
|
import { VftClampTooltip as w } from "../clamp-tooltip/index.js";
|
|
3
3
|
import { VftIcon as h } from "../icon/index.js";
|
|
4
4
|
import "@vueuse/core";
|
|
@@ -33,21 +33,21 @@ const j = { key: 2 }, N = C({
|
|
|
33
33
|
useClamp: { type: Boolean }
|
|
34
34
|
},
|
|
35
35
|
setup(e) {
|
|
36
|
-
const
|
|
36
|
+
const u = V("icon-text"), i = o(() => e.hoverColor || e.color), n = o(() => H(e.icon, "icon", { size: e.size, color: e.color })), m = o(() => e.direction === "col"), v = o(() => {
|
|
37
37
|
const t = g(e.distance);
|
|
38
|
-
return
|
|
39
|
-
}), a = o(() => L(e.size)),
|
|
38
|
+
return m.value ? e.reverse ? { marginTop: t } : { marginBottom: t } : e.reverse ? { marginLeft: t } : { marginRight: t };
|
|
39
|
+
}), a = o(() => L(e.size)), d = o(() => a.value < 12), x = o(() => a.value && d.value ? { transform: `scale(${a.value / 12})` } : {}), z = o(() => {
|
|
40
40
|
const t = O(
|
|
41
41
|
{
|
|
42
42
|
cursor: e.pointer ? "pointer" : void 0,
|
|
43
43
|
color: e.color,
|
|
44
44
|
"hover-color": e.hoverColor ? i.value : void 0,
|
|
45
|
-
fontSize:
|
|
45
|
+
fontSize: g(e.size)
|
|
46
46
|
},
|
|
47
47
|
"icon-text"
|
|
48
48
|
);
|
|
49
49
|
return {
|
|
50
|
-
...
|
|
50
|
+
...d.value && e.adjustOrigin ? { transformOrigin: "left top" } : {},
|
|
51
51
|
...t,
|
|
52
52
|
...x.value
|
|
53
53
|
};
|
|
@@ -59,19 +59,19 @@ const j = { key: 2 }, N = C({
|
|
|
59
59
|
}));
|
|
60
60
|
return (t, T) => (l(), f("span", {
|
|
61
61
|
class: S([
|
|
62
|
-
r(
|
|
63
|
-
r(
|
|
62
|
+
r(u).b(),
|
|
63
|
+
r(u).is("col", m.value),
|
|
64
64
|
{ "disable-icon-hover": e.disableIconHover }
|
|
65
65
|
]),
|
|
66
66
|
style: k(z.value)
|
|
67
67
|
}, [
|
|
68
|
-
!e.reverse && n.value?.icon ? (l(),
|
|
68
|
+
!e.reverse && n.value?.icon ? (l(), c(r(h), s({ key: 0 }, n.value, {
|
|
69
69
|
"hover-color": e.hoverColor && !e.disableIconHover ? i.value : void 0,
|
|
70
|
-
style:
|
|
70
|
+
style: v.value
|
|
71
71
|
}), null, 16, ["hover-color", "style"])) : y("", !0),
|
|
72
|
-
e.useClamp ? (l(),
|
|
73
|
-
e.reverse && n.value?.icon ? (l(),
|
|
74
|
-
style:
|
|
72
|
+
e.useClamp ? (l(), c(r(w), b(s({ key: 1 }, B.value)), null, 16)) : (l(), f("span", j, I(e.text), 1)),
|
|
73
|
+
e.reverse && n.value?.icon ? (l(), c(r(h), s({ key: 3 }, n.value, {
|
|
74
|
+
style: v.value,
|
|
75
75
|
"hover-color": e.hoverColor && !e.disableIconHover ? i.value : void 0
|
|
76
76
|
}), null, 16, ["style", "hover-color"])) : y("", !0)
|
|
77
77
|
], 6));
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as n, ref as
|
|
1
|
+
import { defineComponent as n, ref as a, onMounted as u, nextTick as t, createElementBlock as w, openBlock as _, normalizeClass as v, unref as g } from "vue";
|
|
2
2
|
import "@vueuse/core";
|
|
3
3
|
import "@vft/utils";
|
|
4
4
|
import "../config-provider/hooks/use-global-config.js";
|
|
5
5
|
import "lodash-es";
|
|
6
6
|
import "../form/index.js";
|
|
7
|
-
import { useNamespace as
|
|
7
|
+
import { useNamespace as b } from "../../hooks/use-namespace/index.js";
|
|
8
8
|
import "../../hooks/use-model-toggle/index.js";
|
|
9
9
|
import "@popperjs/core";
|
|
10
10
|
import "../../hooks/use-z-index/index.js";
|
|
11
|
-
const
|
|
11
|
+
const h = ["src"], k = n({
|
|
12
12
|
name: "vft-iframe-page"
|
|
13
13
|
}), I = /* @__PURE__ */ n({
|
|
14
14
|
...k,
|
|
@@ -16,37 +16,37 @@ const b = ["src"], k = n({
|
|
|
16
16
|
frameSrc: {}
|
|
17
17
|
},
|
|
18
18
|
emits: ["loaded"],
|
|
19
|
-
setup(
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
o.value = !1,
|
|
19
|
+
setup(l, { expose: s, emit: i }) {
|
|
20
|
+
const c = i, m = b("iframe-page"), e = a(), o = a(!0), r = () => {
|
|
21
|
+
t(() => {
|
|
22
|
+
o.value = !1, c("loaded");
|
|
23
23
|
});
|
|
24
|
-
}, f = () => {
|
|
25
|
-
r();
|
|
26
24
|
}, p = () => {
|
|
25
|
+
r();
|
|
26
|
+
}, f = () => {
|
|
27
27
|
if (!e.value) return;
|
|
28
28
|
e.value?.contentDocument?.readyState === "complete" && setTimeout(() => {
|
|
29
29
|
r();
|
|
30
30
|
}, 1e3);
|
|
31
31
|
};
|
|
32
32
|
return u(() => {
|
|
33
|
-
o.value = !0,
|
|
34
|
-
|
|
33
|
+
o.value = !0, t(() => {
|
|
34
|
+
f();
|
|
35
35
|
});
|
|
36
36
|
}), s({
|
|
37
37
|
isLoading: o
|
|
38
|
-
}), (d, x) => (
|
|
38
|
+
}), (d, x) => (_(), w("iframe", {
|
|
39
39
|
ref_key: "iframeRef",
|
|
40
40
|
ref: e,
|
|
41
|
-
sandbox: "allow-scripts allow-popups allow-same-origin allow-top-navigation allow-modals allow-forms allow-top-navigation-by-user-activation",
|
|
41
|
+
sandbox: "allow-scripts allow-storage-access-by-user-activation allow-presentation allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-downloads allow-top-navigation allow-modals allow-forms allow-top-navigation-by-user-activation",
|
|
42
42
|
referrerPolicy: "no-referrer-when-downgrade",
|
|
43
43
|
frameborder: "0",
|
|
44
44
|
style: { border: "none", outline: "none" },
|
|
45
|
-
class: v(g(
|
|
46
|
-
src:
|
|
45
|
+
class: v(g(m).b()),
|
|
46
|
+
src: l.frameSrc,
|
|
47
47
|
onLoad: r,
|
|
48
|
-
onError:
|
|
49
|
-
}, null, 42,
|
|
48
|
+
onError: p
|
|
49
|
+
}, null, 42, h));
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
export {
|
|
@@ -6,6 +6,9 @@ export declare const VftMdContainer: import("vft/es/utils").SFCWithInstall<{
|
|
|
6
6
|
scrollDom: {
|
|
7
7
|
type: import("vue").PropType<string>;
|
|
8
8
|
};
|
|
9
|
+
showComment: {
|
|
10
|
+
type: import("vue").PropType<boolean>;
|
|
11
|
+
};
|
|
9
12
|
}>> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
10
13
|
P: {};
|
|
11
14
|
B: {};
|
|
@@ -20,6 +23,9 @@ export declare const VftMdContainer: import("vft/es/utils").SFCWithInstall<{
|
|
|
20
23
|
scrollDom: {
|
|
21
24
|
type: import("vue").PropType<string>;
|
|
22
25
|
};
|
|
26
|
+
showComment: {
|
|
27
|
+
type: import("vue").PropType<boolean>;
|
|
28
|
+
};
|
|
23
29
|
}>> & Readonly<{}>, {}, {}, {}, {}, {}>;
|
|
24
30
|
__isFragment?: never;
|
|
25
31
|
__isTeleport?: never;
|
|
@@ -31,6 +37,9 @@ export declare const VftMdContainer: import("vft/es/utils").SFCWithInstall<{
|
|
|
31
37
|
scrollDom: {
|
|
32
38
|
type: import("vue").PropType<string>;
|
|
33
39
|
};
|
|
40
|
+
showComment: {
|
|
41
|
+
type: import("vue").PropType<boolean>;
|
|
42
|
+
};
|
|
34
43
|
}>> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
35
44
|
$slots: {
|
|
36
45
|
default?(_: {}): any;
|
|
@@ -1,90 +1,91 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as S, getCurrentInstance as $, ref as N, computed as x, onMounted as A, nextTick as P, onDeactivated as q, onBeforeMount as z, createElementBlock as u, openBlock as r, normalizeClass as c, unref as e, createBlock as f, createCommentVNode as p, createElementVNode as l, toDisplayString as k, createVNode as g, Fragment as B, renderList as I, withCtx as O, createTextVNode as F, renderSlot as H } from "vue";
|
|
2
2
|
import { VftIcon as b } from "../icon/index.js";
|
|
3
|
-
import { VftIconText as
|
|
3
|
+
import { VftIconText as J } from "../icon-text/index.js";
|
|
4
4
|
import { VftMdComment as j } from "../md-comment/index.js";
|
|
5
5
|
import { VftSideMenu as U } from "../side-menu/index.js";
|
|
6
6
|
import { VftTag as Y } from "../tag/index.js";
|
|
7
7
|
import "@vueuse/core";
|
|
8
|
-
import { handleScrollPosition as G, jumpElement as
|
|
8
|
+
import { handleScrollPosition as G, getAdaptiveOffset as K, jumpElement as D, getRandomElementForArr as Q, isClient as W } from "@vft/utils";
|
|
9
9
|
import "../config-provider/hooks/use-global-config.js";
|
|
10
|
-
import { primaryColor as
|
|
11
|
-
import { debounce as
|
|
10
|
+
import { primaryColor as X } from "../../utils/ns-cover.js";
|
|
11
|
+
import { debounce as Z } from "lodash-es";
|
|
12
12
|
import "../form/index.js";
|
|
13
|
-
import { useNamespace as
|
|
13
|
+
import { useNamespace as ee } from "../../hooks/use-namespace/index.js";
|
|
14
14
|
import "../../hooks/use-model-toggle/index.js";
|
|
15
15
|
import "@popperjs/core";
|
|
16
16
|
import "../../hooks/use-z-index/index.js";
|
|
17
|
-
import { useRouterHelper as
|
|
18
|
-
import { useEventListener as
|
|
19
|
-
import { usePhotoSwipe as
|
|
20
|
-
import { formatToDateTime as
|
|
17
|
+
import { useRouterHelper as te } from "@vft/router";
|
|
18
|
+
import { useEventListener as oe } from "@vft/use";
|
|
19
|
+
import { usePhotoSwipe as ne } from "@vft/use/photoswipe";
|
|
20
|
+
import { formatToDateTime as ie, getDayTimestamp as le } from "@vft/utils/date";
|
|
21
21
|
import { useCopyCode as ae } from "./use/useCopyCode.js";
|
|
22
|
-
import { COMP_TYPE as
|
|
23
|
-
const re = { class: "info-container" },
|
|
22
|
+
import { COMP_TYPE as se } from "./utils.js";
|
|
23
|
+
const re = { class: "info-container" }, ce = {
|
|
24
24
|
key: 0,
|
|
25
25
|
class: "left"
|
|
26
|
-
},
|
|
26
|
+
}, me = { class: "infos" }, de = {
|
|
27
27
|
class: "reading",
|
|
28
28
|
title: "阅读量"
|
|
29
|
-
}, ue = ["data-path"],
|
|
29
|
+
}, ue = ["data-path"], fe = S({
|
|
30
30
|
name: "vft-md-container"
|
|
31
|
-
}), qe = /* @__PURE__ */
|
|
32
|
-
...
|
|
31
|
+
}), qe = /* @__PURE__ */ S({
|
|
32
|
+
...fe,
|
|
33
33
|
props: {
|
|
34
34
|
tocList: {},
|
|
35
|
-
scrollDom: { default: ".layout-content" }
|
|
35
|
+
scrollDom: { default: ".layout-content" },
|
|
36
|
+
showComment: { type: Boolean, default: !0 }
|
|
36
37
|
},
|
|
37
|
-
setup(
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
const
|
|
38
|
+
setup(a) {
|
|
39
|
+
const s = ee("md-container"), T = $(), m = N(), d = x(() => a.tocList && a.tocList !== "undefined" ? JSON.parse(a.tocList) : ""), { initPhotoSwipe: w } = ne(`.${s.e("content")} img`);
|
|
40
|
+
w(), ae();
|
|
41
|
+
const h = T.appContext.config.globalProperties.$router, n = h.currentRoute.value, L = X(), V = W ? location.pathname : "", { go: _ } = te(h);
|
|
41
42
|
function E(o) {
|
|
42
|
-
|
|
43
|
+
_(`/?classify=${o}`);
|
|
43
44
|
}
|
|
44
|
-
const M =
|
|
45
|
+
const M = x(() => n.meta.category?.includes("api")), v = Z(
|
|
45
46
|
() => G({
|
|
46
|
-
scrollDom:
|
|
47
|
+
scrollDom: a.scrollDom,
|
|
47
48
|
contentDom: ".header-anchor",
|
|
48
49
|
selectAttrName: "href",
|
|
49
|
-
offset:
|
|
50
|
+
offset: K(210, 1920, 1500, 1920),
|
|
50
51
|
callback: (o) => {
|
|
51
|
-
|
|
52
|
+
m.value?.menuRef && (m.value.menuRef.activeIndex = o.slice(1));
|
|
52
53
|
}
|
|
53
54
|
}),
|
|
54
55
|
100
|
|
55
|
-
),
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
const o = document.querySelector(
|
|
59
|
-
o && o.removeEventListener("scroll",
|
|
56
|
+
), y = (o) => {
|
|
57
|
+
D(`[id="${o.index}"]`, a.scrollDom, 120);
|
|
58
|
+
}, C = () => {
|
|
59
|
+
const o = document.querySelector(a.scrollDom);
|
|
60
|
+
o && o.removeEventListener("scroll", v);
|
|
60
61
|
};
|
|
61
|
-
return
|
|
62
|
-
|
|
62
|
+
return A(() => {
|
|
63
|
+
P(() => {
|
|
63
64
|
setTimeout(() => {
|
|
64
|
-
|
|
65
|
+
n.hash && D(`[id="${encodeURI(n.hash).slice(1)}"]`);
|
|
65
66
|
}), setTimeout(() => {
|
|
66
67
|
const t = document.querySelector(".layout-content");
|
|
67
|
-
t && t.addEventListener("scroll",
|
|
68
|
+
t && t.addEventListener("scroll", v);
|
|
68
69
|
}, 1500);
|
|
69
|
-
const o = document.querySelectorAll(".item.expand"),
|
|
70
|
+
const o = document.querySelectorAll(".item.expand"), i = document.querySelectorAll(
|
|
70
71
|
"div.language-vue"
|
|
71
72
|
);
|
|
72
73
|
for (let t = 0; t < o.length; t++)
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
oe(o[t], "click", () => {
|
|
75
|
+
i[t].offsetHeight === 0 ? (i[t].style.height = "auto", i[t].style.visibility = "visible") : (i[t].style.height = "0px", i[t].style.visibility = "hidden");
|
|
75
76
|
});
|
|
76
77
|
});
|
|
78
|
+
}), q(() => {
|
|
79
|
+
C();
|
|
77
80
|
}), z(() => {
|
|
78
|
-
|
|
79
|
-
}),
|
|
80
|
-
|
|
81
|
-
}), (o, n) => (s(), f("div", {
|
|
82
|
-
class: c([e(l).b(), e(l).is("api", M.value)])
|
|
81
|
+
C();
|
|
82
|
+
}), (o, i) => (r(), u("div", {
|
|
83
|
+
class: c([e(s).b(), e(s).is("api", M.value)])
|
|
83
84
|
}, [
|
|
84
|
-
d.value?.length ? (
|
|
85
|
+
d.value?.length ? (r(), f(e(U), {
|
|
85
86
|
key: 0,
|
|
86
87
|
ref_key: "sideMenuRef",
|
|
87
|
-
ref:
|
|
88
|
+
ref: m,
|
|
88
89
|
"default-active": d.value[0].slug,
|
|
89
90
|
class: "toc-side-menu",
|
|
90
91
|
menus: d.value,
|
|
@@ -95,53 +96,53 @@ const re = { class: "info-container" }, se = {
|
|
|
95
96
|
"attr-mapping": {
|
|
96
97
|
index: "slug"
|
|
97
98
|
},
|
|
98
|
-
onSelect:
|
|
99
|
-
onSubMenuClick:
|
|
100
|
-
}, null, 8, ["default-active", "menus"])) :
|
|
101
|
-
|
|
102
|
-
class: c(e(
|
|
99
|
+
onSelect: y,
|
|
100
|
+
onSubMenuClick: y
|
|
101
|
+
}, null, 8, ["default-active", "menus"])) : p("", !0),
|
|
102
|
+
l("div", {
|
|
103
|
+
class: c(e(s).e("header"))
|
|
103
104
|
}, [
|
|
104
|
-
|
|
105
|
-
class: c(e(
|
|
106
|
-
}, k(e(
|
|
107
|
-
|
|
108
|
-
e(
|
|
109
|
-
|
|
105
|
+
l("h1", {
|
|
106
|
+
class: c(e(s).e("title"))
|
|
107
|
+
}, k(e(n).meta?.title), 3),
|
|
108
|
+
l("div", re, [
|
|
109
|
+
e(n).meta?.category?.length ? (r(), u("div", ce, [
|
|
110
|
+
g(e(b), {
|
|
110
111
|
size: 14,
|
|
111
112
|
color: e(L),
|
|
112
113
|
icon: "icon-category"
|
|
113
114
|
}, null, 8, ["color"]),
|
|
114
|
-
(
|
|
115
|
+
(r(!0), u(B, null, I(e(n).meta?.category, (t, R) => (r(), f(e(Y), {
|
|
115
116
|
size: "small",
|
|
116
117
|
class: "tag",
|
|
117
|
-
type: e(
|
|
118
|
+
type: e(Q)(e(se), 1)[0],
|
|
118
119
|
key: R,
|
|
119
|
-
onClick: (
|
|
120
|
+
onClick: (pe) => E(t)
|
|
120
121
|
}, {
|
|
121
|
-
default:
|
|
122
|
-
|
|
122
|
+
default: O(() => [
|
|
123
|
+
F(k(t), 1)
|
|
123
124
|
]),
|
|
124
125
|
_: 2
|
|
125
126
|
}, 1032, ["type", "onClick"]))), 128))
|
|
126
|
-
])) :
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
])) : p("", !0),
|
|
128
|
+
l("div", me, [
|
|
129
|
+
g(e(J), {
|
|
129
130
|
title: "发布时间",
|
|
130
131
|
icon: "icon-date",
|
|
131
132
|
size: 12,
|
|
132
133
|
class: "mr-10px",
|
|
133
134
|
distance: 5,
|
|
134
|
-
text: e(
|
|
135
|
-
(e(
|
|
135
|
+
text: e(ie)(
|
|
136
|
+
(e(n).meta?.date ? new Date(e(n).meta.date).getTime() : (/* @__PURE__ */ new Date()).getTime()) - e(le)()
|
|
136
137
|
)
|
|
137
138
|
}, null, 8, ["text"]),
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
l("div", de, [
|
|
140
|
+
g(e(b), {
|
|
140
141
|
icon: "icon-reading",
|
|
141
142
|
size: 14,
|
|
142
143
|
class: "mr-5px"
|
|
143
144
|
}),
|
|
144
|
-
|
|
145
|
+
l("div", {
|
|
145
146
|
class: "waline-pageview-count lh-1",
|
|
146
147
|
"data-path": e(V)
|
|
147
148
|
}, "0", 8, ue)
|
|
@@ -149,13 +150,13 @@ const re = { class: "info-container" }, se = {
|
|
|
149
150
|
])
|
|
150
151
|
])
|
|
151
152
|
], 2),
|
|
152
|
-
|
|
153
|
-
class: c(e(
|
|
153
|
+
l("div", {
|
|
154
|
+
class: c(e(s).e("content"))
|
|
154
155
|
}, [
|
|
155
|
-
|
|
156
|
+
H(o.$slots, "default")
|
|
156
157
|
], 2),
|
|
157
|
-
|
|
158
|
-
|
|
158
|
+
a.showComment ? (r(), f(e(j), { key: 1 })) : p("", !0),
|
|
159
|
+
i[0] || (i[0] = l("ins", {
|
|
159
160
|
class: "adsbygoogle",
|
|
160
161
|
style: { display: "block", "text-align": "center" },
|
|
161
162
|
"data-ad-layout": "in-article",
|
|
@@ -32,7 +32,7 @@ const k = ({ title: t, level: e, slug: l }) => o(
|
|
|
32
32
|
])
|
|
33
33
|
) : null;
|
|
34
34
|
function y(t, e) {
|
|
35
|
-
t.preventDefault(), h("
|
|
35
|
+
t.preventDefault(), h(`[id="${e}"]`);
|
|
36
36
|
}
|
|
37
37
|
const A = v({
|
|
38
38
|
props: {
|
|
@@ -68,15 +68,15 @@ const A = v({
|
|
|
68
68
|
`#toc a.toc-link[href$="${n}"]`
|
|
69
69
|
);
|
|
70
70
|
if (!p) return;
|
|
71
|
-
const { top: i, height:
|
|
72
|
-
s < i ? u(e.value.scrollTop + s - i) : s +
|
|
73
|
-
e.value.scrollTop + s +
|
|
71
|
+
const { top: i, height: d } = e.value.getBoundingClientRect(), { top: s, height: m } = p.getBoundingClientRect();
|
|
72
|
+
s < i ? u(e.value.scrollTop + s - i) : s + m > i + d && u(
|
|
73
|
+
e.value.scrollTop + s + m - i - d
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
);
|
|
78
78
|
}), () => {
|
|
79
|
-
const n = t.items.length ? a(t.items, t.headerDepth, r.value) : a([], t.headerDepth, r.value);
|
|
79
|
+
const n = t.items.length ? a(t.items, t.headerDepth, r.value) || [] : a([], t.headerDepth, r.value) || null;
|
|
80
80
|
return n ? o("div", { class: "toc-place-holder" }, [
|
|
81
81
|
o("aside", { id: "toc" }, [
|
|
82
82
|
o("div", { class: "toc-header" }, ["此页内容"]),
|
|
@@ -2,14 +2,14 @@ import "@vueuse/core";
|
|
|
2
2
|
import { isNumber as m, isClient as p } from "@vft/utils";
|
|
3
3
|
import { debugWarn as l } from "../../utils/error.js";
|
|
4
4
|
import "../../components/config-provider/hooks/use-global-config.js";
|
|
5
|
-
import {
|
|
5
|
+
import { getCurrentInstance as i, inject as e, computed as c, unref as v, ref as Z } from "vue";
|
|
6
6
|
import "lodash-es";
|
|
7
7
|
import "../../components/form/index.js";
|
|
8
8
|
const s = {
|
|
9
9
|
current: 0
|
|
10
|
-
}, u =
|
|
10
|
+
}, u = Z(0), f = 2e3, d = Symbol("vftZIndexContextKey"), y = Symbol("zIndexContextKey"), K = (I) => {
|
|
11
11
|
const n = i() ? e(d, s) : s, x = I || (i() ? e(y, void 0) : void 0), t = c(() => {
|
|
12
|
-
const r =
|
|
12
|
+
const r = v(x);
|
|
13
13
|
return m(r) ? r : f;
|
|
14
14
|
}), o = c(() => t.value + u.value), a = () => (n.current++, u.value = n.current, o.value);
|
|
15
15
|
return !p && !e(d) && l(
|
package/es/package.json.d.ts
CHANGED
package/es/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),h=require("../clamp-tooltip/index.cjs"),s=require("../icon/index.cjs");require("@vueuse/core");const v=require("@vft/utils"),d=require("../../utils/helper.cjs"),C=require("../../utils/ns-cover.cjs");require("lodash-es");require("../form/index.cjs");const B=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),h=require("../clamp-tooltip/index.cjs"),s=require("../icon/index.cjs");require("@vueuse/core");const v=require("@vft/utils"),d=require("../../utils/helper.cjs"),C=require("../../utils/ns-cover.cjs");require("lodash-es");require("../form/index.cjs");const B=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const k={key:2},x=e.defineComponent({name:"vft-icon-text"}),q=e.defineComponent({...x,props:{text:{},icon:{},color:{},hoverColor:{},disableIconHover:{type:Boolean},distance:{default:3},reverse:{type:Boolean},size:{},direction:{default:"row"},pointer:{type:Boolean},adjustOrigin:{type:Boolean,default:!0},maxLines:{},showTooltip:{type:Boolean},clampTooltipCfg:{},useClamp:{type:Boolean}},setup(o){const i=B.useNamespace("icon-text"),r=e.computed(()=>o.hoverColor||o.color),n=e.computed(()=>v.singleAttrToObj(o.icon,"icon",{size:o.size,color:o.color})),c=e.computed(()=>o.direction==="col"),a=e.computed(()=>{const t=d.addUnit(o.distance);return c.value?o.reverse?{marginTop:t}:{marginBottom:t}:o.reverse?{marginLeft:t}:{marginRight:t}}),l=e.computed(()=>v.removeUnit(o.size)),u=e.computed(()=>l.value<12),m=e.computed(()=>l.value&&u.value?{transform:`scale(${l.value/12})`}:{}),f=e.computed(()=>{const t=C.generateCssVars({cursor:o.pointer?"pointer":void 0,color:o.color,"hover-color":o.hoverColor?r.value:void 0,fontSize:d.addUnit(o.size)},"icon-text");return{...u.value&&o.adjustOrigin?{transformOrigin:"left top"}:{},...t,...m.value}}),y=e.computed(()=>({text:o.text,maxLines:o.maxLines,showTooltip:o.showTooltip,...o.clampTooltipCfg}));return(t,g)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass([e.unref(i).b(),e.unref(i).is("col",c.value),{"disable-icon-hover":o.disableIconHover}]),style:e.normalizeStyle(f.value)},[!o.reverse&&n.value?.icon?(e.openBlock(),e.createBlock(e.unref(s.VftIcon),e.mergeProps({key:0},n.value,{"hover-color":o.hoverColor&&!o.disableIconHover?r.value:void 0,style:a.value}),null,16,["hover-color","style"])):e.createCommentVNode("",!0),o.useClamp?(e.openBlock(),e.createBlock(e.unref(h.VftClampTooltip),e.normalizeProps(e.mergeProps({key:1},y.value)),null,16)):(e.openBlock(),e.createElementBlock("span",k,e.toDisplayString(o.text),1)),o.reverse&&n.value?.icon?(e.openBlock(),e.createBlock(e.unref(s.VftIcon),e.mergeProps({key:3},n.value,{style:a.value,"hover-color":o.hoverColor&&!o.disableIconHover?r.value:void 0}),null,16,["style","hover-color"])):e.createCommentVNode("",!0)],6))}});exports.default=q;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("@vueuse/core");require("@vft/utils");require("../config-provider/hooks/use-global-config.cjs");require("lodash-es");require("../form/index.cjs");const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("@vueuse/core");require("@vft/utils");require("../config-provider/hooks/use-global-config.cjs");require("lodash-es");require("../form/index.cjs");const f=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const m=["src"],p=e.defineComponent({name:"vft-iframe-page"}),w=e.defineComponent({...p,props:{frameSrc:{}},emits:["loaded"],setup(n,{expose:t,emit:l}){const s=l,i=f.useNamespace("iframe-page"),o=e.ref(),r=e.ref(!0),a=()=>{e.nextTick(()=>{r.value=!1,s("loaded")})},c=()=>{a()},u=()=>{if(!o.value)return;o.value?.contentDocument?.readyState==="complete"&&setTimeout(()=>{a()},1e3)};return e.onMounted(()=>{r.value=!0,e.nextTick(()=>{u()})}),t({isLoading:r}),(d,_)=>(e.openBlock(),e.createElementBlock("iframe",{ref_key:"iframeRef",ref:o,sandbox:"allow-scripts allow-storage-access-by-user-activation allow-presentation allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-downloads allow-top-navigation allow-modals allow-forms allow-top-navigation-by-user-activation",referrerPolicy:"no-referrer-when-downgrade",frameborder:"0",style:{border:"none",outline:"none"},class:e.normalizeClass(e.unref(i).b()),src:n.frameSrc,onLoad:a,onError:c},null,42,m))}});exports.default=w;
|
|
@@ -6,6 +6,9 @@ export declare const VftMdContainer: import("vft/es/utils").SFCWithInstall<{
|
|
|
6
6
|
scrollDom: {
|
|
7
7
|
type: import("vue").PropType<string>;
|
|
8
8
|
};
|
|
9
|
+
showComment: {
|
|
10
|
+
type: import("vue").PropType<boolean>;
|
|
11
|
+
};
|
|
9
12
|
}>> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
10
13
|
P: {};
|
|
11
14
|
B: {};
|
|
@@ -20,6 +23,9 @@ export declare const VftMdContainer: import("vft/es/utils").SFCWithInstall<{
|
|
|
20
23
|
scrollDom: {
|
|
21
24
|
type: import("vue").PropType<string>;
|
|
22
25
|
};
|
|
26
|
+
showComment: {
|
|
27
|
+
type: import("vue").PropType<boolean>;
|
|
28
|
+
};
|
|
23
29
|
}>> & Readonly<{}>, {}, {}, {}, {}, {}>;
|
|
24
30
|
__isFragment?: never;
|
|
25
31
|
__isTeleport?: never;
|
|
@@ -31,6 +37,9 @@ export declare const VftMdContainer: import("vft/es/utils").SFCWithInstall<{
|
|
|
31
37
|
scrollDom: {
|
|
32
38
|
type: import("vue").PropType<string>;
|
|
33
39
|
};
|
|
40
|
+
showComment: {
|
|
41
|
+
type: import("vue").PropType<boolean>;
|
|
42
|
+
};
|
|
34
43
|
}>> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
35
44
|
$slots: {
|
|
36
45
|
default?(_: {}): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),p=require("../icon/index.cjs"),E=require("../icon-text/index.cjs"),N=require("../md-comment/index.cjs"),S=require("../side-menu/index.cjs"),b=require("../tag/index.cjs");require("@vueuse/core");const s=require("@vft/utils");require("../config-provider/hooks/use-global-config.cjs");const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),p=require("../icon/index.cjs"),E=require("../icon-text/index.cjs"),N=require("../md-comment/index.cjs"),S=require("../side-menu/index.cjs"),b=require("../tag/index.cjs");require("@vueuse/core");const s=require("@vft/utils");require("../config-provider/hooks/use-global-config.cjs");const D=require("../../utils/ns-cover.cjs"),T=require("lodash-es");require("../form/index.cjs");const B=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const $=require("@vft/router"),_=require("@vft/use"),w=require("@vft/use/photoswipe"),g=require("@vft/utils/date"),L=require("./use/useCopyCode.cjs"),M=require("./utils.cjs"),z={class:"info-container"},R={key:0,class:"left"},P={class:"infos"},A={class:"reading",title:"阅读量"},I=["data-path"],O=e.defineComponent({name:"vft-md-container"}),j=e.defineComponent({...O,props:{tocList:{},scrollDom:{default:".layout-content"},showComment:{type:Boolean,default:!0}},setup(l){const i=B.useNamespace("md-container"),h=e.getCurrentInstance(),a=e.ref(),c=e.computed(()=>l.tocList&&l.tocList!=="undefined"?JSON.parse(l.tocList):""),{initPhotoSwipe:v}=w.usePhotoSwipe(`.${i.e("content")} img`);v(),L.useCopyCode();const u=h.appContext.config.globalProperties.$router,o=u.currentRoute.value,y=D.primaryColor(),C=s.isClient?location.pathname:"",{go:q}=$.useRouterHelper(u);function k(n){q(`/?classify=${n}`)}const x=e.computed(()=>o.meta.category?.includes("api")),d=T.debounce(()=>s.handleScrollPosition({scrollDom:l.scrollDom,contentDom:".header-anchor",selectAttrName:"href",offset:s.getAdaptiveOffset(210,1920,1500,1920),callback:n=>{a.value?.menuRef&&(a.value.menuRef.activeIndex=n.slice(1))}}),100),m=n=>{s.jumpElement(`[id="${n.index}"]`,l.scrollDom,120)},f=()=>{const n=document.querySelector(l.scrollDom);n&&n.removeEventListener("scroll",d)};return e.onMounted(()=>{e.nextTick(()=>{setTimeout(()=>{o.hash&&s.jumpElement(`[id="${encodeURI(o.hash).slice(1)}"]`)}),setTimeout(()=>{const t=document.querySelector(".layout-content");t&&t.addEventListener("scroll",d)},1500);const n=document.querySelectorAll(".item.expand"),r=document.querySelectorAll("div.language-vue");for(let t=0;t<n.length;t++)_.useEventListener(n[t],"click",()=>{r[t].offsetHeight===0?(r[t].style.height="auto",r[t].style.visibility="visible"):(r[t].style.height="0px",r[t].style.visibility="hidden")})})}),e.onDeactivated(()=>{f()}),e.onBeforeMount(()=>{f()}),(n,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(i).b(),e.unref(i).is("api",x.value)])},[c.value?.length?(e.openBlock(),e.createBlock(e.unref(S.VftSideMenu),{key:0,ref_key:"sideMenuRef",ref:a,"default-active":c.value[0].slug,class:"toc-side-menu",menus:c.value,"is-fixed-left":!1,"default-openeds-level":"","unique-opened":!1,"disable-sub-menu-action":"","attr-mapping":{index:"slug"},onSelect:m,onSubMenuClick:m},null,8,["default-active","menus"])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(e.unref(i).e("header"))},[e.createElementVNode("h1",{class:e.normalizeClass(e.unref(i).e("title"))},e.toDisplayString(e.unref(o).meta?.title),3),e.createElementVNode("div",z,[e.unref(o).meta?.category?.length?(e.openBlock(),e.createElementBlock("div",R,[e.createVNode(e.unref(p.VftIcon),{size:14,color:e.unref(y),icon:"icon-category"},null,8,["color"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o).meta?.category,(t,V)=>(e.openBlock(),e.createBlock(e.unref(b.VftTag),{size:"small",class:"tag",type:e.unref(s.getRandomElementForArr)(e.unref(M.COMP_TYPE),1)[0],key:V,onClick:F=>k(t)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t),1)]),_:2},1032,["type","onClick"]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",P,[e.createVNode(e.unref(E.VftIconText),{title:"发布时间",icon:"icon-date",size:12,class:"mr-10px",distance:5,text:e.unref(g.formatToDateTime)((e.unref(o).meta?.date?new Date(e.unref(o).meta.date).getTime():new Date().getTime())-e.unref(g.getDayTimestamp)())},null,8,["text"]),e.createElementVNode("div",A,[e.createVNode(e.unref(p.VftIcon),{icon:"icon-reading",size:14,class:"mr-5px"}),e.createElementVNode("div",{class:"waline-pageview-count lh-1","data-path":e.unref(C)},"0",8,I)])])])],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(i).e("content"))},[e.renderSlot(n.$slots,"default")],2),l.showComment?(e.openBlock(),e.createBlock(e.unref(N.VftMdComment),{key:1})):e.createCommentVNode("",!0),r[0]||(r[0]=e.createElementVNode("ins",{class:"adsbygoogle",style:{display:"block","text-align":"center"},"data-ad-layout":"in-article","data-ad-format":"fluid","data-ad-client":"ca-pub-4046301015031382","data-ad-slot":"6525439078"},null,-1))],2))}});exports.default=j;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@vft/utils"),t=require("vue"),m=require("./utils.cjs"),g=({title:o,level:e,slug:l})=>t.h("a",{href:`#${l}`,class:["toc-link",`level${e}`]},o),s=(o,e,l)=>o.length&&e>0?t.h("ul",{class:"toc-list"},o.map(c=>[t.h("li",{class:["toc-item",{active:m.isActiveLink(l,`#${decodeURIComponent(c.slug)}`)}],onClick:r=>f(r,c.slug)},g(c)),s(c.children,e-1,l)])):null;function f(o,e){o.preventDefault(),p.jumpElement("
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@vft/utils"),t=require("vue"),m=require("./utils.cjs"),g=({title:o,level:e,slug:l})=>t.h("a",{href:`#${l}`,class:["toc-link",`level${e}`]},o),s=(o,e,l)=>o.length&&e>0?t.h("ul",{class:"toc-list"},o.map(c=>[t.h("li",{class:["toc-item",{active:m.isActiveLink(l,`#${decodeURIComponent(c.slug)}`)}],onClick:r=>f(r,c.slug)},g(c)),s(c.children,e-1,l)])):null;function f(o,e){o.preventDefault(),p.jumpElement(`[id="${e}"]`)}const T=t.defineComponent({props:{items:{type:Array,default:()=>[]},headerDepth:{type:Number,default:2}},setup(o){const e=t.ref(),c=t.getCurrentInstance().appContext.config.globalProperties.$router,r=t.computed(()=>c.currentRoute.value),a=n=>{e.value?.scrollTo({top:n,behavior:"smooth"})};return t.onMounted(()=>{t.watch(()=>r.value.hash,n=>{if(e.value){const h=document.querySelector(`#toc a.toc-link[href$="${n}"]`);if(!h)return;const{top:i,height:d}=e.value.getBoundingClientRect(),{top:u,height:v}=h.getBoundingClientRect();u<i?a(e.value.scrollTop+u-i):u+v>i+d&&a(e.value.scrollTop+u+v-i-d)}})}),()=>{const n=o.items.length?s(o.items,o.headerDepth,r.value)||[]:s([],o.headerDepth,r.value)||null;return n?t.h("div",{class:"toc-place-holder"},[t.h("aside",{id:"toc"},[t.h("div",{class:"toc-header"},["此页内容"]),t.h("div",{class:"toc-wrapper",ref:e},[n])])]):null}}});exports.default=T;
|
package/lib/package.json.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.0.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.0.478";exports.version=e;
|