vue-markdown-design 0.3.1 → 0.3.2
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 +5 -1
- package/README.zh-CN.md +4 -0
- package/es/_virtual/_@oxc-project_runtime@0.115.0/helpers/asyncToGenerator.mjs +27 -0
- package/es/_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.mjs +12 -0
- package/es/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.mjs +25 -0
- package/es/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.mjs +13 -0
- package/es/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutPropertiesLoose.mjs +12 -0
- package/es/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPrimitive.mjs +14 -0
- package/es/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPropertyKey.mjs +9 -0
- package/es/_virtual/_@oxc-project_runtime@0.115.0/helpers/typeof.mjs +11 -0
- package/es/hooks/use-element/index.mjs +21 -18
- package/es/hooks/use-scroll-element/index.mjs +44 -45
- package/es/index.mjs +7 -18
- package/es/markdown/Markdown.mjs +221 -316
- package/es/markdown/index.css +3 -0
- package/es/markdown/index2.mjs +6 -0
- package/es/render/Render.mjs +143 -173
- package/es/render/index.css +37 -21
- package/es/render/index2.mjs +6 -0
- package/es/search/Search.mjs +236 -285
- package/es/search/index.css +4 -0
- package/es/search/index2.mjs +6 -0
- package/es/sticky/Sticky.mjs +66 -99
- package/es/sticky/index2.mjs +6 -0
- package/es/toc/Toc.mjs +253 -347
- package/es/toc/index2.mjs +6 -0
- package/es/utils/constant.mjs +4 -4
- package/es/utils/dom.mjs +44 -68
- package/es/utils/format.mjs +33 -39
- package/es/utils/functions.mjs +5 -5
- package/es/utils/vue.mjs +10 -32
- package/lib/_virtual/_@oxc-project_runtime@0.115.0/helpers/asyncToGenerator.js +27 -0
- package/lib/_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.js +12 -0
- package/lib/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.js +25 -0
- package/lib/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.js +13 -0
- package/lib/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutPropertiesLoose.js +12 -0
- package/lib/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPrimitive.js +14 -0
- package/lib/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPropertyKey.js +9 -0
- package/lib/_virtual/_@oxc-project_runtime@0.115.0/helpers/typeof.js +16 -0
- package/lib/_virtual/_rolldown/runtime.js +23 -0
- package/lib/hooks/use-element/index.js +23 -19
- package/lib/hooks/use-scroll-element/index.js +45 -45
- package/lib/index.js +24 -22
- package/lib/markdown/Markdown.js +224 -317
- package/lib/markdown/index.css +3 -0
- package/lib/markdown/index2.js +6 -0
- package/lib/render/Render.js +152 -176
- package/lib/render/index.css +37 -21
- package/lib/render/index2.js +6 -0
- package/lib/search/Search.js +242 -287
- package/lib/search/index.css +4 -0
- package/lib/search/index2.js +6 -0
- package/lib/sticky/Sticky.js +68 -99
- package/lib/sticky/index2.js +6 -0
- package/lib/toc/Toc.js +259 -349
- package/lib/toc/index2.js +6 -0
- package/lib/utils/constant.js +3 -3
- package/lib/utils/dom.js +46 -69
- package/lib/utils/format.js +33 -33
- package/lib/utils/functions.js +4 -4
- package/lib/utils/vue.js +10 -31
- package/package.json +4 -9
- package/es/markdown/index.mjs +0 -9
- package/es/render/index.mjs +0 -9
- package/es/search/index.mjs +0 -9
- package/es/sticky/index.mjs +0 -7
- package/es/toc/index.mjs +0 -9
- package/lib/markdown/index.js +0 -8
- package/lib/render/index.js +0 -8
- package/lib/search/index.js +0 -8
- package/lib/sticky/index.js +0 -7
- package/lib/toc/index.js +0 -8
package/es/utils/dom.mjs
CHANGED
|
@@ -1,76 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
import { compute } from "compute-scroll-into-view";
|
|
1
|
+
import { _objectSpread2 } from "../_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.mjs";
|
|
2
|
+
import { computeOffset } from "./format.mjs";
|
|
3
|
+
import { _objectWithoutProperties } from "../_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.mjs";
|
|
33
4
|
import { omit, pick } from "lodash";
|
|
5
|
+
import { compute } from "compute-scroll-into-view";
|
|
34
6
|
import { animate } from "popmotion";
|
|
35
|
-
|
|
7
|
+
//#region src/utils/dom.ts
|
|
8
|
+
var _excluded = ["onUpdate"], _excluded2 = ["offset", "smooth"];
|
|
36
9
|
function setScrollTop({ el, to }) {
|
|
37
|
-
|
|
10
|
+
el.scrollTop = to;
|
|
38
11
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
12
|
+
var playAnimation = (scroller, options) => {
|
|
13
|
+
const { el, to } = scroller;
|
|
14
|
+
const { onUpdate } = options;
|
|
15
|
+
animate(_objectSpread2(_objectSpread2({}, _objectWithoutProperties(options, _excluded)), {}, {
|
|
16
|
+
from: el.scrollTop,
|
|
17
|
+
to,
|
|
18
|
+
onUpdate: (top) => {
|
|
19
|
+
onUpdate === null || onUpdate === void 0 || onUpdate(top);
|
|
20
|
+
setScrollTop({
|
|
21
|
+
el,
|
|
22
|
+
to: top
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
50
26
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
27
|
+
var computeOptionsKeys = [
|
|
28
|
+
"inline",
|
|
29
|
+
"scrollMode",
|
|
30
|
+
"boundary",
|
|
31
|
+
"skipOverflowHiddenElements"
|
|
56
32
|
];
|
|
57
33
|
function scrollToEl(target, options = {}) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
34
|
+
const { offset, smooth } = options, others = _objectWithoutProperties(options, _excluded2);
|
|
35
|
+
const { block, getOffset } = computeOffset(offset);
|
|
36
|
+
const animationOptions = omit(others, computeOptionsKeys);
|
|
37
|
+
compute(target, _objectSpread2(_objectSpread2({}, pick(others, computeOptionsKeys)), {}, { block })).forEach((scrollAction, index) => {
|
|
38
|
+
const { el, top } = scrollAction;
|
|
39
|
+
let to = el.scrollTop;
|
|
40
|
+
if (!index) {
|
|
41
|
+
const curOffset = getOffset(scrollAction, !index);
|
|
42
|
+
to = el.scrollHeight - top > el.clientHeight ? Math.max(top - curOffset, 0) : top;
|
|
43
|
+
}
|
|
44
|
+
const scroller = {
|
|
45
|
+
el,
|
|
46
|
+
to
|
|
47
|
+
};
|
|
48
|
+
smooth ? playAnimation(scroller, animationOptions) : setTimeout(() => setScrollTop(scroller), 0);
|
|
49
|
+
});
|
|
73
50
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { scrollToEl };
|
package/es/utils/format.mjs
CHANGED
|
@@ -1,53 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { fromPairs, isBoolean, isFunction, isString, mapKeys, upperFirst } from "lodash";
|
|
2
|
+
//#region src/utils/format.ts
|
|
3
|
+
var scrollLogicalPosition = new Set([
|
|
4
|
+
"start",
|
|
5
|
+
"end",
|
|
6
|
+
"center",
|
|
7
|
+
"nearest"
|
|
8
|
+
]);
|
|
3
9
|
function computeOffset(offset = "start") {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
};
|
|
10
|
+
if (isString(offset) && scrollLogicalPosition.has(offset)) return {
|
|
11
|
+
block: offset,
|
|
12
|
+
getOffset: () => 0
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
block: "start",
|
|
16
|
+
getOffset: (scrollAction, isParent) => {
|
|
17
|
+
if (isFunction(offset)) return offset(scrollAction) || 0;
|
|
18
|
+
return isParent ? Number(offset) : 0;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
17
21
|
}
|
|
18
22
|
function keysAddPrefix(props, prefix) {
|
|
19
|
-
|
|
23
|
+
return mapKeys(props, (_, key) => prefix + upperFirst(key));
|
|
20
24
|
}
|
|
21
25
|
function arrToObject(arr, value = true) {
|
|
22
|
-
|
|
26
|
+
return fromPairs(arr.map((key) => [key, value]));
|
|
23
27
|
}
|
|
24
28
|
function allToObject(value, keys) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (Array.isArray(value)) {
|
|
29
|
-
return arrToObject(value);
|
|
30
|
-
}
|
|
31
|
-
return value;
|
|
29
|
+
if (isBoolean(value)) return arrToObject(keys, value);
|
|
30
|
+
if (Array.isArray(value)) return arrToObject(value);
|
|
31
|
+
return value;
|
|
32
32
|
}
|
|
33
33
|
function addUnit(value) {
|
|
34
|
-
|
|
34
|
+
return `${value}px`;
|
|
35
35
|
}
|
|
36
36
|
function createNamespace(str) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
const name = `vmd-${str}`;
|
|
38
|
+
return {
|
|
39
|
+
name,
|
|
40
|
+
addPrefix: (str) => name + str
|
|
41
|
+
};
|
|
42
42
|
}
|
|
43
43
|
function allToArray(value) {
|
|
44
|
-
|
|
44
|
+
return Array.isArray(value) ? value : [value];
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
allToArray,
|
|
49
|
-
allToObject,
|
|
50
|
-
computeOffset,
|
|
51
|
-
createNamespace,
|
|
52
|
-
keysAddPrefix
|
|
53
|
-
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { addUnit, allToArray, allToObject, computeOffset, createNamespace, keysAddPrefix };
|
package/es/utils/functions.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
//#region src/utils/functions.ts
|
|
1
2
|
function runFnWithOptions(options, fn) {
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
if (!options) return;
|
|
4
|
+
options === true ? fn() : fn(options);
|
|
4
5
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
6
|
+
//#endregion
|
|
7
|
+
export { runFnWithOptions };
|
package/es/utils/vue.mjs
CHANGED
|
@@ -1,34 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import { upperFirst, camelCase } from "lodash";
|
|
1
|
+
import { _objectSpread2 } from "../_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.mjs";
|
|
2
|
+
import { camelCase, upperFirst } from "lodash";
|
|
3
|
+
//#region src/utils/vue.ts
|
|
21
4
|
function withInstall(component, aliases = []) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const names = [pascalCaseName, ...aliases].filter(Boolean);
|
|
28
|
-
names.forEach((item) => app.component(item, component));
|
|
29
|
-
}
|
|
30
|
-
});
|
|
5
|
+
return _objectSpread2(_objectSpread2({}, component), {}, { install: (app) => {
|
|
6
|
+
const { name } = component;
|
|
7
|
+
if (!(name || aliases.length)) return;
|
|
8
|
+
[name && upperFirst(camelCase(name)), ...aliases].filter(Boolean).forEach((item) => app.component(item, component));
|
|
9
|
+
} });
|
|
31
10
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { withInstall };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/asyncToGenerator.js
|
|
2
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
3
|
+
try {
|
|
4
|
+
var i = n[a](c), u = i.value;
|
|
5
|
+
} catch (n) {
|
|
6
|
+
e(n);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
10
|
+
}
|
|
11
|
+
function _asyncToGenerator(n) {
|
|
12
|
+
return function() {
|
|
13
|
+
var t = this, e = arguments;
|
|
14
|
+
return new Promise(function(r, o) {
|
|
15
|
+
var a = n.apply(t, e);
|
|
16
|
+
function _next(n) {
|
|
17
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
18
|
+
}
|
|
19
|
+
function _throw(n) {
|
|
20
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
21
|
+
}
|
|
22
|
+
_next(void 0);
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
exports._asyncToGenerator = _asyncToGenerator;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const require_toPropertyKey = require("./toPropertyKey.js");
|
|
2
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/defineProperty.js
|
|
3
|
+
function _defineProperty(e, r, t) {
|
|
4
|
+
return (r = require_toPropertyKey.toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
5
|
+
value: t,
|
|
6
|
+
enumerable: !0,
|
|
7
|
+
configurable: !0,
|
|
8
|
+
writable: !0
|
|
9
|
+
}) : e[r] = t, e;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
exports._defineProperty = _defineProperty;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const require_defineProperty = require("./defineProperty.js");
|
|
2
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/objectSpread2.js
|
|
3
|
+
function ownKeys(e, r) {
|
|
4
|
+
var t = Object.keys(e);
|
|
5
|
+
if (Object.getOwnPropertySymbols) {
|
|
6
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
7
|
+
r && (o = o.filter(function(r) {
|
|
8
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
9
|
+
})), t.push.apply(t, o);
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
}
|
|
13
|
+
function _objectSpread2(e) {
|
|
14
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
15
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
16
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
17
|
+
require_defineProperty._defineProperty(e, r, t[r]);
|
|
18
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
19
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return e;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
exports._objectSpread2 = _objectSpread2;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const require_objectWithoutPropertiesLoose = require("./objectWithoutPropertiesLoose.js");
|
|
2
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/objectWithoutProperties.js
|
|
3
|
+
function _objectWithoutProperties(e, t) {
|
|
4
|
+
if (null == e) return {};
|
|
5
|
+
var o, r, i = require_objectWithoutPropertiesLoose._objectWithoutPropertiesLoose(e, t);
|
|
6
|
+
if (Object.getOwnPropertySymbols) {
|
|
7
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
8
|
+
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
9
|
+
}
|
|
10
|
+
return i;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
exports._objectWithoutProperties = _objectWithoutProperties;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/objectWithoutPropertiesLoose.js
|
|
2
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
3
|
+
if (null == r) return {};
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
6
|
+
if (e.includes(n)) continue;
|
|
7
|
+
t[n] = r[n];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
exports._objectWithoutPropertiesLoose = _objectWithoutPropertiesLoose;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const require_typeof = require("./typeof.js");
|
|
2
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/toPrimitive.js
|
|
3
|
+
function toPrimitive(t, r) {
|
|
4
|
+
if ("object" != require_typeof._typeof(t) || !t) return t;
|
|
5
|
+
var e = t[Symbol.toPrimitive];
|
|
6
|
+
if (void 0 !== e) {
|
|
7
|
+
var i = e.call(t, r || "default");
|
|
8
|
+
if ("object" != require_typeof._typeof(i)) return i;
|
|
9
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
10
|
+
}
|
|
11
|
+
return ("string" === r ? String : Number)(t);
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.toPrimitive = toPrimitive;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const require_typeof = require("./typeof.js");
|
|
2
|
+
const require_toPrimitive = require("./toPrimitive.js");
|
|
3
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/toPropertyKey.js
|
|
4
|
+
function toPropertyKey(t) {
|
|
5
|
+
var i = require_toPrimitive.toPrimitive(t, "string");
|
|
6
|
+
return "symbol" == require_typeof._typeof(i) ? i : i + "";
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
exports.toPropertyKey = toPropertyKey;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/typeof.js
|
|
2
|
+
function _typeof(o) {
|
|
3
|
+
"@babel/helpers - typeof";
|
|
4
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
5
|
+
return typeof o;
|
|
6
|
+
} : function(o) {
|
|
7
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
8
|
+
}, _typeof(o);
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
Object.defineProperty(exports, "_typeof", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function() {
|
|
14
|
+
return _typeof;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.__toESM = __toESM;
|
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
require("../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
let lodash = require("lodash");
|
|
3
|
+
let vue = require("vue");
|
|
4
|
+
let _vueuse_core = require("@vueuse/core");
|
|
5
|
+
//#region src/hooks/use-element/index.ts
|
|
6
6
|
function useElement(target) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
const targetEl = (0, vue.shallowRef)();
|
|
8
|
+
const isMounted = (0, _vueuse_core.useMounted)();
|
|
9
|
+
const update = () => {
|
|
10
|
+
const targetVal = (0, _vueuse_core.toValue)(target);
|
|
11
|
+
if (!(targetVal && isMounted.value)) return;
|
|
12
|
+
if (!(0, lodash.isString)(targetVal)) {
|
|
13
|
+
targetEl.value = (0, _vueuse_core.unrefElement)(targetVal);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
targetEl.value = document.querySelector(targetVal);
|
|
17
|
+
if (!targetEl.value) console.error("[vue-markdown-design] Target does not exist.");
|
|
18
|
+
};
|
|
19
|
+
(0, vue.watchPostEffect)(update);
|
|
20
|
+
return {
|
|
21
|
+
targetEl,
|
|
22
|
+
update
|
|
23
|
+
};
|
|
21
24
|
}
|
|
25
|
+
//#endregion
|
|
22
26
|
exports.useElement = useElement;
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
require("../../_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_format = require("../../utils/format.js");
|
|
3
|
+
let vue = require("vue");
|
|
4
|
+
let _vueuse_core = require("@vueuse/core");
|
|
5
|
+
//#region src/hooks/use-scroll-element/index.ts
|
|
6
|
+
var tagNames = new Set(["HTML", "BODY"]);
|
|
7
|
+
var scrollReg = /scroll|auto|overlay/i;
|
|
8
8
|
function getScrollElement(el, onlyParent) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
let node = el;
|
|
10
|
+
const nodes = [];
|
|
11
|
+
while (node.nodeType === 1 && !tagNames.has(node.tagName)) {
|
|
12
|
+
const { overflowY } = window.getComputedStyle(node);
|
|
13
|
+
if (scrollReg.test(overflowY)) {
|
|
14
|
+
nodes.push(node);
|
|
15
|
+
if (onlyParent) break;
|
|
16
|
+
}
|
|
17
|
+
const { parentNode } = node;
|
|
18
|
+
if (!(parentNode instanceof Element)) break;
|
|
19
|
+
node = parentNode;
|
|
20
|
+
}
|
|
21
|
+
return onlyParent ? nodes[0] : nodes;
|
|
22
22
|
}
|
|
23
23
|
function isElement(el) {
|
|
24
|
-
|
|
24
|
+
return [HTMLElement, SVGElement].some((type) => el instanceof type);
|
|
25
25
|
}
|
|
26
26
|
function useScrollParent(target, options = {}) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return { scrollEl, update };
|
|
27
|
+
const { onlyParent = true } = options;
|
|
28
|
+
const initialValue = onlyParent ? void 0 : [];
|
|
29
|
+
const scrollEl = (0, vue.shallowRef)(initialValue);
|
|
30
|
+
const update = () => {
|
|
31
|
+
const el = (0, _vueuse_core.unrefElement)(target);
|
|
32
|
+
if (!el) {
|
|
33
|
+
scrollEl.value = initialValue;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const scrollElement = getScrollElement(el, onlyParent);
|
|
37
|
+
if (Array.isArray(scrollElement)) {
|
|
38
|
+
scrollEl.value = scrollElement.filter(isElement);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (isElement(scrollElement)) scrollEl.value = scrollElement;
|
|
42
|
+
};
|
|
43
|
+
(0, vue.watch)(() => (0, _vueuse_core.unrefElement)(target), update, { flush: "post" });
|
|
44
|
+
(0, _vueuse_core.useMutationObserver)(() => require_format.allToArray(scrollEl.value), update, { attributeFilter: ["style", "class"] });
|
|
45
|
+
(0, vue.onMounted)(update);
|
|
46
|
+
return {
|
|
47
|
+
scrollEl,
|
|
48
|
+
update
|
|
49
|
+
};
|
|
51
50
|
}
|
|
51
|
+
//#endregion
|
|
52
52
|
exports.useScrollParent = useScrollParent;
|
package/lib/index.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
require('./style/variables.css');;/* empty css */
|
|
6
|
+
const require_Render = require("./render/Render.js");
|
|
7
|
+
const require_index = require("./render/index2.js");
|
|
8
|
+
const require_Search = require("./search/Search.js");
|
|
9
|
+
const require_index$1 = require("./search/index2.js");
|
|
10
|
+
const require_Toc = require("./toc/Toc.js");
|
|
11
|
+
const require_index$2 = require("./toc/index2.js");
|
|
12
|
+
const require_index$3 = require("./sticky/index2.js");
|
|
13
|
+
const require_Markdown = require("./markdown/Markdown.js");
|
|
14
|
+
const require_index$4 = require("./markdown/index2.js");
|
|
15
|
+
exports.VmdRender = require_index;
|
|
16
|
+
exports.VmdSearch = require_index$1;
|
|
17
|
+
exports.VmdSticky = require_index$3;
|
|
18
|
+
exports.VmdToc = require_index$2;
|
|
19
|
+
exports.VueMarkdown = require_index$4;
|
|
20
|
+
exports.default = require_index$4;
|
|
21
|
+
exports.markdownProps = require_Markdown.markdownProps;
|
|
22
|
+
exports.renderProps = require_Render.renderProps;
|
|
23
|
+
exports.searchProps = require_Search.searchProps;
|
|
24
|
+
exports.tocProps = require_Toc.tocProps;
|