dumi 2.4.28 → 2.4.30
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/compiled/@umijs/plugins/index.js +1 -1
- package/compiled/@umijs/plugins/package.json +1 -1
- package/dist/client/misc/reactDemoCompiler.js +2 -2
- package/dist/client/theme-api/AtomRenderer.js +6 -6
- package/dist/client/theme-api/DumiDemo/index.js +1 -1
- package/dist/client/theme-api/DumiDemoGrid.js +1 -1
- package/dist/client/theme-api/DumiPage.js +1 -1
- package/dist/client/theme-api/openCodeSandbox.d.ts +1 -0
- package/dist/client/theme-api/openCodeSandbox.js +1 -1
- package/dist/client/theme-api/openStackBlitz.d.ts +1 -0
- package/dist/client/theme-api/openStackBlitz.js +1 -1
- package/dist/client/theme-api/types.d.ts +1 -1
- package/dist/client/theme-api/useLiveDemo.js +4 -4
- package/dist/client/theme-api/useLocale.js +1 -1
- package/dist/client/theme-api/useNavData.js +6 -6
- package/dist/client/theme-api/usePrefersColor.js +4 -4
- package/dist/client/theme-api/useRenderer.js +6 -6
- package/dist/client/theme-api/useRouteMeta.js +2 -2
- package/dist/client/theme-api/useSidebarData.js +7 -7
- package/dist/client/theme-api/useSiteSearch/index.js +1 -1
- package/dist/client/theme-api/useSiteSearch/useSearchData.js +7 -7
- package/dist/client/theme-api/useTabMeta.js +2 -2
- package/dist/client/theme-api/utils.d.ts +2 -2
- package/dist/client/theme-api/utils.js +4 -4
- package/dist/constants.d.ts +2 -2
- package/dist/features/assets.js +2 -1
- package/dist/features/compile/makoHooks.d.ts +2 -1
- package/dist/features/sitemap.js +5 -2
- package/dist/features/tabs.js +7 -4
- package/dist/features/theme/index.js +6 -4
- package/dist/loaders/markdown/index.js +19 -11
- package/dist/templates/meta/index.ts.tpl +4 -2
- package/dumi-types.d.ts +115 -0
- package/index.d.ts +64 -5
- package/package.json +11 -8
- package/theme-api.d.ts +319 -0
- package/theme-default/builtins/API/index.js +8 -8
- package/theme-default/builtins/CodeGroup/index.js +1 -1
- package/theme-default/builtins/Container/index.js +1 -1
- package/theme-default/builtins/Previewer/index.js +1 -1
- package/theme-default/builtins/SourceCode/index.js +1 -1
- package/theme-default/builtins/Table/index.js +1 -1
- package/theme-default/builtins/Tree/index.js +17 -17
- package/theme-default/layouts/DocLayout/index.js +1 -1
- package/theme-default/slots/ColorSwitch/index.js +1 -1
- package/theme-default/slots/ContentFooter/index.js +1 -1
- package/theme-default/slots/Header/index.js +6 -3
- package/theme-default/slots/LangSwitch/index.js +1 -1
- package/theme-default/slots/Navbar/index.js +1 -1
- package/theme-default/slots/PreviewerActions/index.js +6 -6
- package/theme-default/slots/RtlSwitch/index.js +1 -1
- package/theme-default/slots/SearchBar/Input.d.ts +1 -1
- package/theme-default/slots/SearchBar/Mask.js +1 -1
- package/theme-default/slots/SearchBar/index.js +2 -2
- package/theme-default/slots/SearchResult/index.js +3 -3
- package/theme-default/slots/SocialIcon/index.d.ts +4 -2
- package/theme-default/slots/SourceCodeEditor/index.d.ts +1 -0
- package/theme-default/slots/SourceCodeEditor/index.js +3 -3
- package/theme-default/slots/Toc/index.js +1 -1
- package/theme-modules.d.ts +62 -0
|
@@ -2,7 +2,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
2
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
3
|
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); }
|
|
4
4
|
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; }
|
|
5
|
-
function _iterableToArrayLimit(
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { ReactComponent as IconDown } from '@ant-design/icons-svg/inline-svg/outlined/down.svg';
|
|
8
8
|
import { history, Link, useIntl, useLocale, useLocation, useSiteData } from 'dumi';
|
|
@@ -3,7 +3,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
3
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
4
|
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); }
|
|
5
5
|
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; }
|
|
6
|
-
function _iterableToArrayLimit(
|
|
6
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
8
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
9
9
|
import { ReactComponent as IconDown } from '@ant-design/icons-svg/inline-svg/outlined/down.svg';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
function _typeof(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
var _excluded = ["title", "placement"];
|
|
3
3
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
function _toPropertyKey(
|
|
5
|
-
function _toPrimitive(
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
6
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
7
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
8
|
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); }
|
|
9
9
|
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; }
|
|
10
|
-
function _iterableToArrayLimit(
|
|
10
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
12
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
13
13
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
@@ -197,9 +197,9 @@ var PreviewerActions = function PreviewerActions(props) {
|
|
|
197
197
|
initialValue: files[i][1].value.trim(),
|
|
198
198
|
onChange: function onChange(code) {
|
|
199
199
|
var _props$onSourceChange, _props$onSourceTransp;
|
|
200
|
-
(_props$onSourceChange = props.onSourceChange) === null || _props$onSourceChange === void 0
|
|
200
|
+
(_props$onSourceChange = props.onSourceChange) === null || _props$onSourceChange === void 0 || _props$onSourceChange.call(props, _defineProperty({}, files[i][0], code));
|
|
201
201
|
// FIXME: remove before publish
|
|
202
|
-
(_props$onSourceTransp = props.onSourceTranspile) === null || _props$onSourceTransp === void 0
|
|
202
|
+
(_props$onSourceTransp = props.onSourceTranspile) === null || _props$onSourceTransp === void 0 || _props$onSourceTransp.call(props, {
|
|
203
203
|
source: _defineProperty({}, files[i][0], code)
|
|
204
204
|
});
|
|
205
205
|
},
|
|
@@ -2,7 +2,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
2
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
3
|
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); }
|
|
4
4
|
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; }
|
|
5
|
-
function _iterableToArrayLimit(
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { useSiteData } from 'dumi';
|
|
8
8
|
import React, { useEffect, useState } from 'react';
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
type NativeInputProps = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
3
3
|
export declare const Input: React.ForwardRefExoticComponent<{
|
|
4
4
|
onChange: (keywords: string) => void;
|
|
5
|
-
} & Pick<NativeInputProps, "
|
|
5
|
+
} & Pick<NativeInputProps, "onMouseEnter" | "onFocus" | "onBlur"> & React.RefAttributes<HTMLInputElement>>;
|
|
6
6
|
export {};
|
|
@@ -6,7 +6,7 @@ export var Mask = function Mask(props) {
|
|
|
6
6
|
} else if (document.body.style.overflow) {
|
|
7
7
|
var _props$onClose;
|
|
8
8
|
document.body.style.overflow = '';
|
|
9
|
-
(_props$onClose = props.onClose) === null || _props$onClose === void 0
|
|
9
|
+
(_props$onClose = props.onClose) === null || _props$onClose === void 0 || _props$onClose.call(props);
|
|
10
10
|
}
|
|
11
11
|
}, [props.visible]);
|
|
12
12
|
return props.visible ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -3,7 +3,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
3
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
4
|
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); }
|
|
5
5
|
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; }
|
|
6
|
-
function _iterableToArrayLimit(
|
|
6
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
8
|
import { ReactComponent as IconArrowDown } from '@ant-design/icons-svg/inline-svg/outlined/arrow-down.svg';
|
|
9
9
|
import { ReactComponent as IconArrowUp } from '@ant-design/icons-svg/inline-svg/outlined/arrow-up.svg';
|
|
@@ -66,7 +66,7 @@ var SearchBar = function SearchBar() {
|
|
|
66
66
|
setModalVisible(true);
|
|
67
67
|
setTimeout(function () {
|
|
68
68
|
var _modalInputRef$curren;
|
|
69
|
-
(_modalInputRef$curren = modalInputRef.current) === null || _modalInputRef$curren === void 0
|
|
69
|
+
(_modalInputRef$curren = modalInputRef.current) === null || _modalInputRef$curren === void 0 || _modalInputRef$curren.focus();
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -2,7 +2,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
2
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
3
|
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); }
|
|
4
4
|
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; }
|
|
5
|
-
function _iterableToArrayLimit(
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { ReactComponent as IconInbox } from '@ant-design/icons-svg/inline-svg/outlined/inbox.svg';
|
|
8
8
|
import animateScrollTo from 'animated-scroll-to';
|
|
@@ -103,7 +103,7 @@ var SearchResult = function SearchResult(props) {
|
|
|
103
103
|
pathname = _useLocation.pathname;
|
|
104
104
|
var onItemSelect = function onItemSelect(item) {
|
|
105
105
|
var _props$onItemSelect;
|
|
106
|
-
(_props$onItemSelect = props.onItemSelect) === null || _props$onItemSelect === void 0
|
|
106
|
+
(_props$onItemSelect = props.onItemSelect) === null || _props$onItemSelect === void 0 || _props$onItemSelect.call(props, item);
|
|
107
107
|
var url = new URL(item === null || item === void 0 ? void 0 : item.link, location.origin);
|
|
108
108
|
if ((url === null || url === void 0 ? void 0 : url.pathname) === pathname && !url.hash) {
|
|
109
109
|
setTimeout(function () {
|
|
@@ -125,7 +125,7 @@ var SearchResult = function SearchResult(props) {
|
|
|
125
125
|
return item.type === 'hint' && item.activeIndex === activeIndex;
|
|
126
126
|
}).value;
|
|
127
127
|
history.push(_item.link);
|
|
128
|
-
onItemSelect === null || onItemSelect === void 0
|
|
128
|
+
onItemSelect === null || onItemSelect === void 0 || onItemSelect(_item);
|
|
129
129
|
document.activeElement.blur();
|
|
130
130
|
}
|
|
131
131
|
if (['Escape', 'Enter'].includes(ev.key)) {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { SocialTypes } from "../../../theme-api/types";
|
|
2
|
-
import { FunctionComponent, type FC } from 'react';
|
|
2
|
+
import { FunctionComponent, SVGProps, type FC } from 'react';
|
|
3
3
|
import './index.less';
|
|
4
4
|
export type SocialIconProps = {
|
|
5
5
|
icon: SocialTypes;
|
|
6
6
|
link: string;
|
|
7
7
|
};
|
|
8
8
|
export type PresetSocialIcon = {
|
|
9
|
-
Icon: FunctionComponent
|
|
9
|
+
Icon: FunctionComponent<SVGProps<SVGSVGElement> & {
|
|
10
|
+
title?: string;
|
|
11
|
+
}>;
|
|
10
12
|
titleIntlId: string;
|
|
11
13
|
};
|
|
12
14
|
declare const SocialIcon: FC<SocialIconProps>;
|
|
@@ -3,7 +3,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
3
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
4
|
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); }
|
|
5
5
|
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; }
|
|
6
|
-
function _iterableToArrayLimit(
|
|
6
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
8
|
import SourceCode from 'dumi/theme/builtins/SourceCode';
|
|
9
9
|
import React, { useEffect, useRef, useState } from 'react';
|
|
@@ -55,9 +55,9 @@ var SourceCodeEditor = function SourceCodeEditor(props) {
|
|
|
55
55
|
onChange: function onChange(ev) {
|
|
56
56
|
var _props$onChange, _props$onTranspile;
|
|
57
57
|
setCode(ev.target.value);
|
|
58
|
-
(_props$onChange = props.onChange) === null || _props$onChange === void 0
|
|
58
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, ev.target.value);
|
|
59
59
|
// FIXME: remove before publish
|
|
60
|
-
(_props$onTranspile = props.onTranspile) === null || _props$onTranspile === void 0
|
|
60
|
+
(_props$onTranspile = props.onTranspile) === null || _props$onTranspile === void 0 || _props$onTranspile.call(props, {
|
|
61
61
|
err: null,
|
|
62
62
|
code: ev.target.value
|
|
63
63
|
});
|
|
@@ -3,7 +3,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
3
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
4
|
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); }
|
|
5
5
|
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; }
|
|
6
|
-
function _iterableToArrayLimit(
|
|
6
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
8
|
import { Scrollspy as ScrollSpy } from '@makotot/ghostui';
|
|
9
9
|
import { history, Link, useLocation, useRouteMeta, useSiteData, useTabMeta } from 'dumi';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
declare module 'dumi/theme/slots/*' {
|
|
2
|
+
import type { ComponentType } from 'react';
|
|
3
|
+
|
|
4
|
+
const component: ComponentType<any>;
|
|
5
|
+
export default component;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
declare module 'dumi/theme/builtins/*' {
|
|
9
|
+
import type { ComponentType } from 'react';
|
|
10
|
+
|
|
11
|
+
const component: ComponentType<any>;
|
|
12
|
+
export default component;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare module 'dumi/theme/builtins/SourceCode' {
|
|
16
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
17
|
+
|
|
18
|
+
export interface ISourceCodeProps {
|
|
19
|
+
children?: string;
|
|
20
|
+
lang?: string;
|
|
21
|
+
textarea?: ReactNode;
|
|
22
|
+
extra?: ReactNode;
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const SourceCode: ComponentType<ISourceCodeProps>;
|
|
27
|
+
export default SourceCode;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare module 'dumi/theme/slots/ContentTabs' {
|
|
31
|
+
import type { IRouteMeta } from 'dumi';
|
|
32
|
+
import type { ComponentType } from 'react';
|
|
33
|
+
|
|
34
|
+
type IContentTabs = IRouteMeta['tabs'];
|
|
35
|
+
|
|
36
|
+
export interface IContentTabsProps {
|
|
37
|
+
tabs: IContentTabs;
|
|
38
|
+
tabKey: string | null;
|
|
39
|
+
onChange: (tab?: NonNullable<IContentTabs>[0]) => void;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const ContentTabs: ComponentType<IContentTabsProps>;
|
|
43
|
+
export default ContentTabs;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
declare module 'dumi/theme/slots/SourceCodeEditor' {
|
|
47
|
+
import type { ISourceCodeProps } from 'dumi/theme/builtins/SourceCode';
|
|
48
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
49
|
+
|
|
50
|
+
export interface ISourceCodeEditorProps
|
|
51
|
+
extends Omit<ISourceCodeProps, 'children'> {
|
|
52
|
+
initialValue: string;
|
|
53
|
+
onTranspile?: (
|
|
54
|
+
args: { err: Error; code?: null } | { err?: null; code: string },
|
|
55
|
+
) => void;
|
|
56
|
+
onChange?: (code: string) => void;
|
|
57
|
+
extra?: ReactNode;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const SourceCodeEditor: ComponentType<ISourceCodeEditorProps>;
|
|
61
|
+
export default SourceCodeEditor;
|
|
62
|
+
}
|