@antv/dumi-theme-antv 0.3.0-beta.3 → 0.3.0-beta.5
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/layouts/DocLayout.js +13 -9
- package/dist/pages/Example/index.js +8 -49
- package/dist/pages/Example/index.module.less +50 -8
- package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.js +1 -1
- package/dist/pages/Examples/index.js +13 -2
- package/dist/pages/Examples/index.module.less +2 -0
- package/dist/plugin/examples.d.ts +10 -5
- package/dist/plugin/examples.js +6 -3
- package/dist/plugin/index.js +4 -0
- package/dist/slots/Cases/index.d.ts +1 -0
- package/dist/slots/CodeEditor/Toolbar.js +4 -16
- package/dist/slots/CodeEditor/index.js +8 -2
- package/dist/slots/CodePreview/CodeHeader.js +2 -2
- package/dist/slots/CodePreview/index.module.less +3 -5
- package/dist/slots/CodeRunner/index.d.ts +2 -2
- package/dist/slots/CodeRunner/index.js +4 -2
- package/dist/slots/CodeRunner/utils.d.ts +3 -2
- package/dist/slots/CodeRunner/utils.js +1 -1
- package/dist/slots/Detail/News.d.ts +1 -0
- package/dist/slots/Detail/index.d.ts +1 -0
- package/dist/slots/Detail/index.js +1 -1
- package/dist/slots/ExampleSider/index.d.ts +0 -35
- package/dist/slots/ExampleSider/index.js +20 -42
- package/dist/slots/ExampleSider/index.module.less +1 -1
- package/dist/slots/Features/FeatureCard.d.ts +1 -0
- package/dist/slots/Features/index.js +2 -1
- package/dist/slots/Header/Navs.js +3 -1
- package/dist/slots/Header/index.js +8 -7
- package/dist/slots/Loading/index.d.ts +6 -1
- package/dist/slots/Loading/index.js +24 -10
- package/dist/slots/Loading/index.module.less +276 -9
- package/dist/slots/ManualContent/index.js +19 -9
- package/dist/slots/hooks.d.ts +3 -3
- package/dist/slots/utils.d.ts +4 -19
- package/dist/slots/utils.js +77 -119
- package/dist/types.d.ts +84 -0
- package/dist/typings.d.ts +0 -116
- package/package.json +4 -4
- package/dist/slots/Loading.d.ts +0 -5
- package/dist/slots/Loading.js +0 -8
package/dist/slots/utils.js
CHANGED
|
@@ -1,30 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
export var ping = function ping(callback) {
|
|
3
|
-
var url = 'https://private-a' + 'lipay' + 'objects.alip' + 'ay.com/alip' + 'ay-rmsdeploy-image/rmsportal/RKuAiriJqrUhyqW.png';
|
|
4
|
-
var img = new Image();
|
|
5
|
-
var done = false;
|
|
6
|
-
|
|
7
|
-
var finish = function finish(status) {
|
|
8
|
-
if (!done) {
|
|
9
|
-
done = true;
|
|
10
|
-
img.src = '';
|
|
11
|
-
callback(status);
|
|
12
|
-
}
|
|
13
|
-
};
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
14
2
|
|
|
15
|
-
img.onload = function () {
|
|
16
|
-
return finish('responded');
|
|
17
|
-
};
|
|
3
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
18
4
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
5
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
|
+
|
|
7
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
|
|
11
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
|
+
|
|
13
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
14
|
+
|
|
15
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
16
|
+
|
|
17
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
18
|
+
|
|
19
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
20
|
+
|
|
21
|
+
export function ping() {
|
|
22
|
+
return _ping.apply(this, arguments);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function _ping() {
|
|
26
|
+
_ping = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
27
|
+
var timeout, network;
|
|
28
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
29
|
+
while (1) {
|
|
30
|
+
switch (_context.prev = _context.next) {
|
|
31
|
+
case 0:
|
|
32
|
+
timeout = new Promise(function (resolve) {
|
|
33
|
+
setTimeout(function () {
|
|
34
|
+
resolve('timeout');
|
|
35
|
+
}, 1500);
|
|
36
|
+
});
|
|
37
|
+
network = new Promise(function (resolve) {
|
|
38
|
+
var url = 'https://private-a' + 'lipay' + 'objects.alip' + 'ay.com/alip' + 'ay-rmsdeploy-image/rmsportal/RKuAiriJqrUhyqW.png';
|
|
39
|
+
var img = new Image();
|
|
40
|
+
|
|
41
|
+
img.onload = function () {
|
|
42
|
+
img.src = '';
|
|
43
|
+
resolve('responded');
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
img.onerror = function () {
|
|
47
|
+
img.src = '';
|
|
48
|
+
resolve('error');
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
img.src = url;
|
|
52
|
+
});
|
|
53
|
+
return _context.abrupt("return", Promise.race([timeout, network]));
|
|
54
|
+
|
|
55
|
+
case 3:
|
|
56
|
+
case "end":
|
|
57
|
+
return _context.stop();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}, _callee);
|
|
61
|
+
}));
|
|
62
|
+
return _ping.apply(this, arguments);
|
|
63
|
+
}
|
|
22
64
|
|
|
23
|
-
img.src = url;
|
|
24
|
-
return setTimeout(function () {
|
|
25
|
-
return finish('timeout');
|
|
26
|
-
}, 1500);
|
|
27
|
-
};
|
|
28
65
|
export var getChinaMirrorHost = function getChinaMirrorHost(host) {
|
|
29
66
|
var hostString = typeof host === 'undefined' ? window.location.host : host; // antv.vision => antv.gitee.io
|
|
30
67
|
|
|
@@ -41,7 +78,7 @@ export var getChinaMirrorHost = function getChinaMirrorHost(host) {
|
|
|
41
78
|
|
|
42
79
|
return hostString;
|
|
43
80
|
};
|
|
44
|
-
export function
|
|
81
|
+
export function getGithubSourceURL(githubUrl, relativePath) {
|
|
45
82
|
var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'examples';
|
|
46
83
|
|
|
47
84
|
// https://github.com/antvis/x6/tree/master/packages/x6-sites
|
|
@@ -51,104 +88,25 @@ export function getGithubSourceUrl(githubUrl, relativePath) {
|
|
|
51
88
|
|
|
52
89
|
return "".concat(githubUrl, "/edit/master/").concat(prefix, "/").concat(relativePath);
|
|
53
90
|
}
|
|
54
|
-
export var
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
export var getSortedCategories = function getSortedCategories(allDemosInCategory, locale) {
|
|
64
|
-
return Object.keys(allDemosInCategory).sort(function (a, b) {
|
|
65
|
-
if (a === 'OTHER') {
|
|
66
|
-
return -1;
|
|
67
|
-
}
|
|
91
|
+
export var filterTreeNode = function filterTreeNode(treeNode, keyValue, locale) {
|
|
92
|
+
if (treeNode.childrenKey && Array.isArray(treeNode[treeNode.childrenKey])) {
|
|
93
|
+
var children = treeNode[treeNode.childrenKey];
|
|
94
|
+
var filteredChildren = children.filter(function (child) {
|
|
95
|
+
var c = filterTreeNode(child, keyValue, locale);
|
|
96
|
+
return c !== null;
|
|
97
|
+
});
|
|
68
98
|
|
|
69
|
-
if (
|
|
70
|
-
|
|
99
|
+
if (filteredChildren.length > 0) {
|
|
100
|
+
treeNode[treeNode.childrenKey] = _toConsumableArray(filteredChildren);
|
|
101
|
+
return treeNode;
|
|
71
102
|
}
|
|
72
|
-
|
|
73
|
-
return allDemosInCategory[a][0].postFrontmatter[locale].order - allDemosInCategory[b][0].postFrontmatter[locale].order;
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
var getMenuItemLocaleKey = function getMenuItemLocaleKey() {
|
|
78
|
-
var slug = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
79
|
-
var slugPieces = slug.split('/');
|
|
80
|
-
return slugPieces.slice(slugPieces.indexOf('examples') + 1).filter(function (key) {
|
|
81
|
-
return key;
|
|
82
|
-
}).join('/');
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
var getExampleOrder = function getExampleOrder(options) {
|
|
86
|
-
var groupedEdgeKey = options.groupedEdgeKey,
|
|
87
|
-
groupedEdges = options.groupedEdges,
|
|
88
|
-
examples = options.examples;
|
|
89
|
-
var key = getMenuItemLocaleKey(groupedEdgeKey);
|
|
90
|
-
|
|
91
|
-
if (examples.find(function (item) {
|
|
92
|
-
return item.slug === key;
|
|
93
|
-
})) {
|
|
94
|
-
return (examples.findIndex(function (item) {
|
|
95
|
-
return item.slug === key;
|
|
96
|
-
}) || 0) + 100;
|
|
97
103
|
}
|
|
98
104
|
|
|
99
|
-
|
|
100
|
-
return 0;
|
|
101
|
-
}
|
|
105
|
+
var isCurrentTreeNodeMatched = treeNode.title[locale].toLowerCase().includes(keyValue.toLowerCase()); // 当前节点自身匹配,那么其孩子直接匹配,可以直接返回当前节点
|
|
102
106
|
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
if (isCurrentTreeNodeMatched) {
|
|
108
|
+
return treeNode;
|
|
109
|
+
}
|
|
105
110
|
|
|
106
|
-
|
|
107
|
-
return groupBy(edges, function (_ref) {
|
|
108
|
-
var slugString = _ref.node.fields.slug;
|
|
109
|
-
|
|
110
|
-
// API.md and design.md
|
|
111
|
-
if (slugString.endsWith('/API') || slugString.endsWith('/design')) {
|
|
112
|
-
return slugString.split('/').slice(0, -2).join('/');
|
|
113
|
-
} // index.md
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return slugString.split('/').slice(0, -1).join('/');
|
|
117
|
-
});
|
|
118
|
-
}; // 提取出筛选 和 排序的方法 好在获取treeData 的时候使用
|
|
119
|
-
|
|
120
|
-
export var getGroupedEdgesDataEdit = function getGroupedEdgesDataEdit(examples, edges, local) {
|
|
121
|
-
var groupedEdges = getGroupedEdges(edges);
|
|
122
|
-
return Object.keys(groupedEdges).filter(function (key) {
|
|
123
|
-
return key.startsWith("/".concat(local, "/"));
|
|
124
|
-
}).sort(function (a, b) {
|
|
125
|
-
var aOrder = getExampleOrder({
|
|
126
|
-
groupedEdgeKey: a,
|
|
127
|
-
examples: examples,
|
|
128
|
-
groupedEdges: groupedEdges
|
|
129
|
-
});
|
|
130
|
-
var bOrder = getExampleOrder({
|
|
131
|
-
groupedEdgeKey: b,
|
|
132
|
-
examples: examples,
|
|
133
|
-
groupedEdges: groupedEdges
|
|
134
|
-
});
|
|
135
|
-
return aOrder - bOrder;
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
|
-
export var getTreeDataByExamplesAndEdges = function getTreeDataByExamplesAndEdges(examples, edges, locale) {
|
|
139
|
-
return getGroupedEdgesDataEdit(examples, edges, locale).map(function (slugString) {
|
|
140
|
-
var menuItemLocaleKey = getMenuItemLocaleKey(slugString);
|
|
141
|
-
var doc = examples.find(function (item) {
|
|
142
|
-
return item.slug === menuItemLocaleKey;
|
|
143
|
-
}) || {};
|
|
144
|
-
return {
|
|
145
|
-
title: doc && doc.title ? doc.title[locale] : menuItemLocaleKey,
|
|
146
|
-
value: slugString,
|
|
147
|
-
icon: doc.icon,
|
|
148
|
-
children: getGroupedEdges(edges)[slugString].filter(function (edge) {
|
|
149
|
-
var slug = edge.node.fields.slug;
|
|
150
|
-
return !(slug.endsWith('/API') || slug.endsWith('/design') || slug.endsWith('/gallery'));
|
|
151
|
-
})
|
|
152
|
-
};
|
|
153
|
-
});
|
|
111
|
+
return null;
|
|
154
112
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,87 @@
|
|
|
1
1
|
export interface IThemeConfig {
|
|
2
2
|
[key: string]: any;
|
|
3
3
|
}
|
|
4
|
+
export declare type Status = 'responded' | 'error' | 'timeout';
|
|
5
|
+
/**
|
|
6
|
+
* 配置文件中的国际化配置
|
|
7
|
+
*/
|
|
8
|
+
export declare type IC = string | {
|
|
9
|
+
zh: string;
|
|
10
|
+
en: string;
|
|
11
|
+
};
|
|
12
|
+
interface TreeNode {
|
|
13
|
+
/**
|
|
14
|
+
* id
|
|
15
|
+
*/
|
|
16
|
+
id: string;
|
|
17
|
+
/**
|
|
18
|
+
* 孩子节点 key
|
|
19
|
+
*/
|
|
20
|
+
childrenKey?: string;
|
|
21
|
+
/**
|
|
22
|
+
* 标题(支持国际化)
|
|
23
|
+
*/
|
|
24
|
+
title: {
|
|
25
|
+
zh: string;
|
|
26
|
+
en: string;
|
|
27
|
+
};
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}
|
|
30
|
+
/** 案例 DEMO */
|
|
31
|
+
export interface Demo extends TreeNode {
|
|
32
|
+
/**
|
|
33
|
+
* 截图
|
|
34
|
+
*/
|
|
35
|
+
screenshot: string;
|
|
36
|
+
/**
|
|
37
|
+
* TypeScript 源码文件
|
|
38
|
+
*/
|
|
39
|
+
source: string;
|
|
40
|
+
/**
|
|
41
|
+
* DEMO 代码文件名称
|
|
42
|
+
*/
|
|
43
|
+
filename: string;
|
|
44
|
+
/**
|
|
45
|
+
* 衍生属性,通过 topic.id + example.id + demo.id 可以计算获取
|
|
46
|
+
*/
|
|
47
|
+
relativePath?: string;
|
|
48
|
+
/**
|
|
49
|
+
* 是否为新品
|
|
50
|
+
*/
|
|
51
|
+
isNew?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* 目标 example
|
|
54
|
+
*/
|
|
55
|
+
targetExample?: Example;
|
|
56
|
+
/**
|
|
57
|
+
* 目标主题
|
|
58
|
+
*/
|
|
59
|
+
targetTopic?: ExampleTopic;
|
|
60
|
+
}
|
|
61
|
+
/** 示例 */
|
|
62
|
+
export interface Example extends TreeNode {
|
|
63
|
+
/**
|
|
64
|
+
* 图标
|
|
65
|
+
*/
|
|
66
|
+
icon: string;
|
|
67
|
+
/**
|
|
68
|
+
* DEMO
|
|
69
|
+
*/
|
|
70
|
+
demos: Demo[];
|
|
71
|
+
}
|
|
72
|
+
/** 案例主题 */
|
|
73
|
+
export interface ExampleTopic extends TreeNode {
|
|
74
|
+
/**
|
|
75
|
+
* 图标
|
|
76
|
+
*/
|
|
77
|
+
icon: string;
|
|
78
|
+
/**
|
|
79
|
+
* slug 和 id 一样,兼容旧配置
|
|
80
|
+
*/
|
|
81
|
+
slug?: string;
|
|
82
|
+
/**
|
|
83
|
+
* 所有案例
|
|
84
|
+
*/
|
|
85
|
+
examples: Example[];
|
|
86
|
+
}
|
|
87
|
+
export {};
|
package/dist/typings.d.ts
CHANGED
|
@@ -22,119 +22,3 @@ declare module '\*.svg' {
|
|
|
22
22
|
const content: any;
|
|
23
23
|
export default content;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
declare namespace ExamplesPage {
|
|
27
|
-
/** 案例 DEMO */
|
|
28
|
-
export interface Demo {
|
|
29
|
-
/**
|
|
30
|
-
* id
|
|
31
|
-
*/
|
|
32
|
-
id: string;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* 标题(支持国际化)
|
|
36
|
-
*/
|
|
37
|
-
title: {
|
|
38
|
-
zh: string;
|
|
39
|
-
en: string;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* 截图
|
|
44
|
-
*/
|
|
45
|
-
screenshot: string;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* TypeScript 源码文件
|
|
49
|
-
*/
|
|
50
|
-
source: string;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* DEMO 代码文件名称
|
|
54
|
-
*/
|
|
55
|
-
filename: string;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* 衍生属性,通过 topic.id + example.id + demo.id 可以计算获取
|
|
59
|
-
*/
|
|
60
|
-
relativePath?: string;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* 是否为新品
|
|
64
|
-
*/
|
|
65
|
-
isNew?: boolean;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* 目标 example
|
|
69
|
-
*/
|
|
70
|
-
targetExample?: ExamplesPage.Example;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* 目标主题
|
|
74
|
-
*/
|
|
75
|
-
targetTopic?: ExamplesPage.ExampleTopic;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** 示例 */
|
|
79
|
-
export interface Example {
|
|
80
|
-
/**
|
|
81
|
-
* id
|
|
82
|
-
*/
|
|
83
|
-
id: string;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* 标题(支持国际化)
|
|
87
|
-
*/
|
|
88
|
-
title: {
|
|
89
|
-
zh: string;
|
|
90
|
-
en: string;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* 图标
|
|
95
|
-
*/
|
|
96
|
-
icon: string;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* DEMO
|
|
100
|
-
*/
|
|
101
|
-
demos: Demo[];
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/** 案例主题 */
|
|
105
|
-
export interface ExampleTopic {
|
|
106
|
-
/**
|
|
107
|
-
* id 和文件夹目录名保持一致
|
|
108
|
-
*/
|
|
109
|
-
id: string;
|
|
110
|
-
/**
|
|
111
|
-
* slug 和 id 一样,兼容旧配置
|
|
112
|
-
*/
|
|
113
|
-
slug?: string;
|
|
114
|
-
/**
|
|
115
|
-
* 标题
|
|
116
|
-
*/
|
|
117
|
-
title: {
|
|
118
|
-
zh: string;
|
|
119
|
-
en: string;
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* 图标
|
|
124
|
-
*/
|
|
125
|
-
icon: string;
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* 所有案例
|
|
129
|
-
*/
|
|
130
|
-
examples: Example[];
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* 配置文件中的国际化配置
|
|
136
|
-
*/
|
|
137
|
-
declare type IC = string | {
|
|
138
|
-
zh: string;
|
|
139
|
-
en: string;
|
|
140
|
-
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/dumi-theme-antv",
|
|
3
|
-
"version": "0.3.0-beta.
|
|
3
|
+
"version": "0.3.0-beta.5",
|
|
4
4
|
"description": "AntV website theme based on dumi2.",
|
|
5
5
|
"types": "dist/types.d.ts",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "father dev",
|
|
8
|
+
"dev:example-site": "cd example && npm run start",
|
|
8
9
|
"build": "father build",
|
|
9
10
|
"prepare": "father link-dev-theme",
|
|
10
11
|
"lint": "npm run lint:es && npm run lint:css",
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
"classnames": "^2.3.2",
|
|
62
63
|
"codesandbox": "^2.2.3",
|
|
63
64
|
"docsearch.js": "^2.6.3",
|
|
64
|
-
"dumi": "^2.0.0-beta.
|
|
65
|
+
"dumi": "^2.0.0-beta.15",
|
|
65
66
|
"front-matter": "^4.0.2",
|
|
66
67
|
"fs-extra": "^10.1.0",
|
|
67
68
|
"glob": "^8.0.3",
|
|
@@ -84,7 +85,7 @@
|
|
|
84
85
|
"uri-parse": "^1.0.0"
|
|
85
86
|
},
|
|
86
87
|
"peerDependencies": {
|
|
87
|
-
"dumi": "^2.0.0-beta.
|
|
88
|
+
"dumi": "^2.0.0-beta.15",
|
|
88
89
|
"react": ">=16.9.0",
|
|
89
90
|
"react-dom": ">=16.9.0"
|
|
90
91
|
},
|
|
@@ -100,7 +101,6 @@
|
|
|
100
101
|
"@types/react-router-dom": "^5.3.3",
|
|
101
102
|
"@types/react-slick": "^0.23.10",
|
|
102
103
|
"@umijs/lint": "^4.0.0",
|
|
103
|
-
"dumi": "^2.0.0-beta.14",
|
|
104
104
|
"eslint": "^8.23.0",
|
|
105
105
|
"father": "^4.1.0",
|
|
106
106
|
"father-plugin-dumi-theme": "^1.0.0-beta.1",
|
package/dist/slots/Loading.d.ts
DELETED