@agentscope-ai/dumi-theme-spark 0.0.98

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.
Files changed (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +0 -0
  3. package/dist/builtins/AntdApiRef/index.d.ts +3 -0
  4. package/dist/builtins/AntdApiRef/index.js +36 -0
  5. package/dist/builtins/DemoTitle/index.d.ts +1 -0
  6. package/dist/builtins/DemoTitle/index.js +98 -0
  7. package/dist/builtins/FAQ/index.d.ts +2 -0
  8. package/dist/builtins/FAQ/index.js +51 -0
  9. package/dist/builtins/FAQItem/index.d.ts +2 -0
  10. package/dist/builtins/FAQItem/index.js +72 -0
  11. package/dist/builtins/Install/index.d.ts +3 -0
  12. package/dist/builtins/Install/index.js +77 -0
  13. package/dist/builtins/Previewer/PreviewerActions.d.ts +21 -0
  14. package/dist/builtins/Previewer/PreviewerActions.js +65 -0
  15. package/dist/builtins/Previewer/index.d.ts +2 -0
  16. package/dist/builtins/Previewer/index.js +182 -0
  17. package/dist/layouts/DocLayout/Footer/index.d.ts +3 -0
  18. package/dist/layouts/DocLayout/Footer/index.js +144 -0
  19. package/dist/layouts/DocLayout/Header/DarkModeChanger.d.ts +1 -0
  20. package/dist/layouts/DocLayout/Header/DarkModeChanger.js +43 -0
  21. package/dist/layouts/DocLayout/Header/LangChanger.d.ts +3 -0
  22. package/dist/layouts/DocLayout/Header/LangChanger.js +66 -0
  23. package/dist/layouts/DocLayout/Header/index.d.ts +2 -0
  24. package/dist/layouts/DocLayout/Header/index.js +39 -0
  25. package/dist/layouts/DocLayout/Header/index.less +8 -0
  26. package/dist/layouts/DocLayout/NavSelect/index.d.ts +1 -0
  27. package/dist/layouts/DocLayout/NavSelect/index.js +71 -0
  28. package/dist/layouts/DocLayout/Sidebar/Active.d.ts +3 -0
  29. package/dist/layouts/DocLayout/Sidebar/Active.js +41 -0
  30. package/dist/layouts/DocLayout/Sidebar/Group.d.ts +7 -0
  31. package/dist/layouts/DocLayout/Sidebar/Group.js +35 -0
  32. package/dist/layouts/DocLayout/Sidebar/Item.d.ts +6 -0
  33. package/dist/layouts/DocLayout/Sidebar/Item.js +48 -0
  34. package/dist/layouts/DocLayout/Sidebar/index.d.ts +1 -0
  35. package/dist/layouts/DocLayout/Sidebar/index.js +145 -0
  36. package/dist/layouts/DocLayout/TOC/index.d.ts +3 -0
  37. package/dist/layouts/DocLayout/TOC/index.js +143 -0
  38. package/dist/layouts/DocLayout/index.d.ts +1 -0
  39. package/dist/layouts/DocLayout/index.js +87 -0
  40. package/dist/layouts/GlobalLayout/Scroll.d.ts +4 -0
  41. package/dist/layouts/GlobalLayout/Scroll.js +72 -0
  42. package/dist/layouts/GlobalLayout/ThemeConfig.d.ts +1 -0
  43. package/dist/layouts/GlobalLayout/ThemeConfig.js +134 -0
  44. package/dist/layouts/GlobalLayout/index.d.ts +4 -0
  45. package/dist/layouts/GlobalLayout/index.js +63 -0
  46. package/dist/layouts/GlobalLayout/index.less +331 -0
  47. package/dist/layouts/GlobalLayout/lato.less +11 -0
  48. package/dist/layouts/GlobalLayout/montserrat.less +4 -0
  49. package/dist/layouts/GlobalLayout/useAEM.d.ts +1 -0
  50. package/dist/layouts/GlobalLayout/useAEM.js +32 -0
  51. package/dist/layouts/GlobalLayout/useScrollIntoView.d.ts +1 -0
  52. package/dist/layouts/GlobalLayout/useScrollIntoView.js +21 -0
  53. package/dist/layouts/GlobalLayout/useTheme.d.ts +9 -0
  54. package/dist/layouts/GlobalLayout/useTheme.js +58 -0
  55. package/dist/locales/en-US.json +10 -0
  56. package/dist/locales/zh-CN.json +10 -0
  57. package/dist/plugin/index.d.ts +3 -0
  58. package/dist/plugin/index.js +27 -0
  59. package/dist/slots/HeroTitle/index.d.ts +6 -0
  60. package/dist/slots/HeroTitle/index.js +20 -0
  61. package/dist/slots/Loading/index.d.ts +1 -0
  62. package/dist/slots/Loading/index.js +39 -0
  63. package/dist/slots/PreviewerActions/index.d.ts +1 -0
  64. package/dist/slots/PreviewerActions/index.js +6 -0
  65. package/dist/types.d.ts +0 -0
  66. package/dist/types.js +0 -0
  67. package/dist/utils/autoSpacing.d.ts +2 -0
  68. package/dist/utils/autoSpacing.js +15 -0
  69. package/dist/utils/getTargetLocalePath.d.ts +9 -0
  70. package/dist/utils/getTargetLocalePath.js +21 -0
  71. package/package.json +88 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
File without changes
@@ -0,0 +1,3 @@
1
+ export default function AntdAPIRef(props: {
2
+ url: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,36 @@
1
+ import { createStyles } from "antd-style";
2
+ import { useIntl } from "dumi";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ export default function AntdAPIRef(props) {
6
+ var _useStyles = useStyles(),
7
+ styles = _useStyles.styles,
8
+ cx = _useStyles.cx,
9
+ theme = _useStyles.theme;
10
+ var intl = useIntl();
11
+ return /*#__PURE__*/_jsx("div", {
12
+ className: "markdown",
13
+ children: /*#__PURE__*/_jsxs("p", {
14
+ className: styles.container,
15
+ children: [intl.formatMessage({
16
+ id: 'antdAPIRef'
17
+ }), /*#__PURE__*/_jsx("a", {
18
+ href: props.url,
19
+ target: "_blank",
20
+ rel: "noopener noreferrer",
21
+ className: styles.link,
22
+ children: props.url
23
+ })]
24
+ })
25
+ });
26
+ }
27
+ var useStyles = createStyles(function (_ref) {
28
+ var token = _ref.token;
29
+ return {
30
+ container: {},
31
+ link: {
32
+ padding: '0 4px',
33
+ color: token.colorInfo
34
+ }
35
+ };
36
+ });
@@ -0,0 +1 @@
1
+ export default function DemoTitle(props: any): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,98 @@
1
+ import { createStyles } from 'antd-style';
2
+ import { Button, copy, Dropdown, message } from '@agentscope-ai/design';
3
+ import { SparkCopyLine, SparkDownLine, SparkLinkLine, SparkMagicWandLine } from '@agentscope-ai/icons';
4
+ import { useIntl, useSiteData } from 'dumi';
5
+ import { useCurrentNavByIntl } from "../../utils/getTargetLocalePath";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
+ import { Fragment as _Fragment } from "react/jsx-runtime";
9
+ export default function DemoTitle(props) {
10
+ var _useStyles = useStyles(),
11
+ styles = _useStyles.styles,
12
+ cx = _useStyles.cx,
13
+ theme = _useStyles.theme;
14
+ var name = useCurrentNavByIntl(2);
15
+ var _useSiteData = useSiteData(),
16
+ themeConfig = _useSiteData.themeConfig;
17
+ var llmTxtBase = themeConfig.demoTitle.llmTxtBase;
18
+ var intl = useIntl();
19
+ return /*#__PURE__*/_jsxs(_Fragment, {
20
+ children: [/*#__PURE__*/_jsx("h1", {
21
+ className: styles.h1,
22
+ children: props.title
23
+ }), /*#__PURE__*/_jsx("div", {
24
+ className: "markdown",
25
+ children: /*#__PURE__*/_jsx("p", {
26
+ children: props.desc
27
+ })
28
+ }), /*#__PURE__*/_jsx("div", {
29
+ children: /*#__PURE__*/_jsx(Dropdown, {
30
+ menu: {
31
+ items: [{
32
+ label: /*#__PURE__*/_jsxs("div", {
33
+ children: [/*#__PURE__*/_jsx(SparkMagicWandLine, {
34
+ style: {
35
+ marginRight: '4px',
36
+ fontSize: '16px'
37
+ }
38
+ }), "Copy Prompt"]
39
+ }),
40
+ key: 'Prompt'
41
+ }, {
42
+ label: /*#__PURE__*/_jsxs("div", {
43
+ children: [/*#__PURE__*/_jsx(SparkLinkLine, {
44
+ style: {
45
+ marginRight: '4px',
46
+ fontSize: '16px'
47
+ }
48
+ }), "Copy URL"]
49
+ }),
50
+ key: 'URL'
51
+ }],
52
+ onClick: function onClick(e) {
53
+ var id = props.llmTxtName || props.title || name;
54
+ var url = "".concat(llmTxtBase, "/").concat(id, "/index.zh-CN.llms.txt");
55
+ if (e.key === 'Prompt') {
56
+ fetch(url).then(function (res) {
57
+ return res.text();
58
+ }).then(function (text) {
59
+ copy(text);
60
+ message.success(intl.formatMessage({
61
+ id: 'copySuccess'
62
+ }));
63
+ }).catch(function (err) {
64
+ message.error('something error');
65
+ });
66
+ } else {
67
+ copy(url);
68
+ message.success(intl.formatMessage({
69
+ id: 'copySuccess'
70
+ }));
71
+ }
72
+ }
73
+ },
74
+ children: /*#__PURE__*/_jsxs(Button, {
75
+ className: styles.button,
76
+ children: [/*#__PURE__*/_jsx(SparkCopyLine, {}), /*#__PURE__*/_jsx("span", {
77
+ children: "Copy Prompt"
78
+ }), /*#__PURE__*/_jsx(SparkDownLine, {})]
79
+ })
80
+ })
81
+ })]
82
+ });
83
+ }
84
+ var useStyles = createStyles(function (_ref) {
85
+ var token = _ref.token;
86
+ return {
87
+ button: {
88
+ marginTop: '24px'
89
+ },
90
+ h1: {
91
+ fontSize: '24px',
92
+ lineHeight: '32px',
93
+ fontWeight: 'bold',
94
+ margin: '8px 0',
95
+ color: token.colorTextBase
96
+ }
97
+ };
98
+ });
@@ -0,0 +1,2 @@
1
+ declare function FAQ(props: any): import("react/jsx-runtime").JSX.Element;
2
+ export default FAQ;
@@ -0,0 +1,51 @@
1
+ import { createStyles } from 'antd-style';
2
+ import { FormattedMessage } from 'dumi';
3
+
4
+ // @ts-ignore
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
+ function FAQ(props) {
8
+ var _useStyles = useStyles(),
9
+ styles = _useStyles.styles,
10
+ cx = _useStyles.cx,
11
+ theme = _useStyles.theme;
12
+ return /*#__PURE__*/_jsxs("div", {
13
+ className: "markdown",
14
+ children: [/*#__PURE__*/_jsx("hr", {
15
+ className: styles.hr
16
+ }), /*#__PURE__*/_jsxs("div", {
17
+ className: styles.faq,
18
+ children: [/*#__PURE__*/_jsx("strong", {
19
+ className: styles.title,
20
+ children: "FAQs"
21
+ }), /*#__PURE__*/_jsx("p", {
22
+ className: styles.p,
23
+ children: /*#__PURE__*/_jsx(FormattedMessage, {
24
+ id: "faqDesc"
25
+ })
26
+ })]
27
+ }), props.children]
28
+ });
29
+ }
30
+ var useStyles = createStyles(function (_ref) {
31
+ var token = _ref.token;
32
+ return {
33
+ hr: {
34
+ margin: '40px 0',
35
+ border: 'none',
36
+ borderTop: "1px dashed ".concat(token.colorBorderSecondary)
37
+ },
38
+ title: {
39
+ fontSize: 14
40
+ },
41
+ faq: {
42
+ marginTop: 48,
43
+ marginBottom: 32
44
+ },
45
+ p: {
46
+ fontSize: 14,
47
+ lineHeight: '24px'
48
+ }
49
+ };
50
+ });
51
+ export default FAQ;
@@ -0,0 +1,2 @@
1
+ declare const FAQItem: (props: any) => import("react/jsx-runtime").JSX.Element;
2
+ export default FAQItem;
@@ -0,0 +1,72 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
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
+ 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
+ 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(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
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { SparkJianMinusLine, SparkPlusLine } from '@agentscope-ai/icons';
8
+ import { createStyles } from 'antd-style';
9
+ import { useState } from 'react';
10
+ import { IconButton } from '@agentscope-ai/design';
11
+
12
+ // @ts-ignore
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { jsxs as _jsxs } from "react/jsx-runtime";
15
+ var FAQItem = function FAQItem(props) {
16
+ var _useStyles = useStyles(),
17
+ styles = _useStyles.styles,
18
+ cx = _useStyles.cx,
19
+ theme = _useStyles.theme;
20
+ var _useState = useState(false),
21
+ _useState2 = _slicedToArray(_useState, 2),
22
+ open = _useState2[0],
23
+ setOpen = _useState2[1];
24
+ return /*#__PURE__*/_jsxs("div", {
25
+ className: styles.item,
26
+ children: [/*#__PURE__*/_jsxs("div", {
27
+ className: styles.title,
28
+ onClick: function onClick() {
29
+ return setOpen(!open);
30
+ },
31
+ children: [/*#__PURE__*/_jsx("span", {
32
+ style: {
33
+ flex: 1
34
+ },
35
+ children: props.title
36
+ }), /*#__PURE__*/_jsx(IconButton, {
37
+ bordered: false,
38
+ icon: open ? /*#__PURE__*/_jsx(SparkJianMinusLine, {}) : /*#__PURE__*/_jsx(SparkPlusLine, {})
39
+ })]
40
+ }), open && /*#__PURE__*/_jsx("div", {
41
+ className: styles.content,
42
+ children: props.children
43
+ })]
44
+ });
45
+ };
46
+ var useStyles = createStyles(function (_ref) {
47
+ var token = _ref.token;
48
+ return {
49
+ item: {
50
+ padding: '20px 0',
51
+ borderTop: "1px solid ".concat(token.colorBorderSecondary)
52
+ },
53
+ title: {
54
+ display: 'flex',
55
+ fontSize: 16,
56
+ fontWeight: 500,
57
+ lineHeight: '32px',
58
+ color: token.colorText,
59
+ cursor: 'pointer',
60
+ '&:hover': {
61
+ color: token.colorTextSecondary
62
+ }
63
+ },
64
+ content: {
65
+ padding: '12px 0 20px 0',
66
+ fontSize: 14,
67
+ lineHeight: '24px',
68
+ color: token.colorTextSecondary
69
+ }
70
+ };
71
+ });
72
+ export default FAQItem;
@@ -0,0 +1,3 @@
1
+ export default function Install(props: {
2
+ children: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,77 @@
1
+ import { message } from '@agentscope-ai/design';
2
+ import { createStyles } from "antd-style";
3
+ import copy from "copy-to-clipboard";
4
+ import { FormattedMessage, useIntl } from "dumi";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { Fragment as _Fragment } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
+ export default function Install(props) {
9
+ var _useStyles = useStyles(),
10
+ styles = _useStyles.styles,
11
+ cx = _useStyles.cx,
12
+ theme = _useStyles.theme;
13
+ var intl = useIntl();
14
+ var content = props.children.trim();
15
+ content = content.indexOf('from') !== -1 ? content : "import { ".concat(content, " } from '@agentscope-ai/design'");
16
+ return /*#__PURE__*/_jsxs(_Fragment, {
17
+ children: [/*#__PURE__*/_jsx("hr", {
18
+ className: styles.hr
19
+ }), /*#__PURE__*/_jsx("div", {
20
+ className: "markdown",
21
+ children: /*#__PURE__*/_jsx("h4", {
22
+ className: styles.title,
23
+ children: /*#__PURE__*/_jsx(FormattedMessage, {
24
+ id: "usage"
25
+ })
26
+ })
27
+ }), /*#__PURE__*/_jsx("div", {
28
+ className: styles.outerContainer,
29
+ onClick: function onClick() {
30
+ copy(content);
31
+ message.success(intl.formatMessage({
32
+ id: 'copySuccess'
33
+ }));
34
+ },
35
+ children: /*#__PURE__*/_jsx("div", {
36
+ className: styles.container,
37
+ children: content
38
+ })
39
+ }), /*#__PURE__*/_jsx("hr", {
40
+ className: styles.hr
41
+ }), /*#__PURE__*/_jsx("div", {
42
+ className: styles.placeholder
43
+ })]
44
+ });
45
+ }
46
+ var useStyles = createStyles(function (_ref) {
47
+ var token = _ref.token;
48
+ return {
49
+ placeholder: {
50
+ height: 32
51
+ },
52
+ hr: {
53
+ margin: '40px 0',
54
+ border: 'none',
55
+ borderTop: "1px dashed ".concat(token.colorBorderSecondary)
56
+ },
57
+ title: {},
58
+ outerContainer: {
59
+ marginTop: 12,
60
+ cursor: 'pointer',
61
+ borderRadius: 12,
62
+ backgroundColor: token.colorFillQuaternary,
63
+ padding: 4
64
+ },
65
+ container: {
66
+ background: token.colorBgBase,
67
+ whiteSpace: 'pre-wrap',
68
+ borderRadius: 8,
69
+ border: "1px solid ".concat(token.colorBorderSecondary),
70
+ fontSize: 14,
71
+ lineHeight: '24px',
72
+ padding: '20px 27px 20px 27px',
73
+ color: token.colorText,
74
+ fontFamily: '"SFMono-Regular",consolas,"Liberation Mono",menlo,courier,monospace,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"'
75
+ }
76
+ };
77
+ });
@@ -0,0 +1,21 @@
1
+ import { type IPreviewerProps } from 'dumi';
2
+ import { ReactNode } from 'react';
3
+ interface IPreviewerActionsProps extends IPreviewerProps {
4
+ /**
5
+ * disabled actions
6
+ */
7
+ disabledActions?: ('CSB' | 'STACKBLITZ' | 'EXTERNAL' | 'HTML2SKETCH')[];
8
+ extra?: ReactNode;
9
+ forceShowCode?: boolean;
10
+ demoContainer: HTMLDivElement | HTMLIFrameElement;
11
+ onSourceTranspile?: (args: {
12
+ err: Error;
13
+ source?: null;
14
+ } | {
15
+ err?: null;
16
+ source: Record<string, string>;
17
+ }) => void;
18
+ onSourceChange?: (source: Record<string, string>) => void;
19
+ }
20
+ export default function (props: IPreviewerActionsProps): import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -0,0 +1,65 @@
1
+ var _templateObject;
2
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ 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."); }
5
+ 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); }
6
+ 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; }
7
+ 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; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
+ import { useState } from 'react';
10
+ // @ts-ignore
11
+ import SourceCode from 'dumi/theme/builtins/SourceCode';
12
+ import { Tabs } from 'antd';
13
+ import { createStyles } from 'antd-style';
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
+ import { Fragment as _Fragment } from "react/jsx-runtime";
16
+ export default function (props) {
17
+ var _files$activeKey$0$ma;
18
+ var _useStyles = useStyles(),
19
+ styles = _useStyles.styles,
20
+ cx = _useStyles.cx,
21
+ theme = _useStyles.theme;
22
+ var files = Object.entries(props.asset.dependencies).filter(function (_ref) {
23
+ var _ref2 = _slicedToArray(_ref, 2),
24
+ type = _ref2[1].type;
25
+ return type === 'FILE';
26
+ });
27
+ var _useState = useState(0),
28
+ _useState2 = _slicedToArray(_useState, 2),
29
+ activeKey = _useState2[0],
30
+ setActiveKey = _useState2[1];
31
+ var _useState3 = useState(props.forceShowCode || props.defaultShowCode),
32
+ _useState4 = _slicedToArray(_useState3, 2),
33
+ showCode = _useState4[0],
34
+ setShowCode = _useState4[1];
35
+ var lang = ((_files$activeKey$0$ma = files[activeKey][0].match(/\.([^.]+)$/)) === null || _files$activeKey$0$ma === void 0 ? void 0 : _files$activeKey$0$ma[1]) || 'text';
36
+ return /*#__PURE__*/_jsx(_Fragment, {
37
+ children: /*#__PURE__*/_jsx(Tabs, {
38
+ className: styles.tabs,
39
+ defaultActiveKey: String(activeKey),
40
+ onChange: function onChange(key) {
41
+ return setActiveKey(Number(key));
42
+ },
43
+ items: files.map(function (_ref3, i) {
44
+ var _ref4 = _slicedToArray(_ref3, 1),
45
+ filename = _ref4[0];
46
+ return {
47
+ key: String(i),
48
+ // remove leading ./ prefix
49
+ label: filename.replace(/^\.\//, ''),
50
+ // only support to edit entry file currently
51
+ children: /*#__PURE__*/_jsx(SourceCode, {
52
+ lang: lang,
53
+ children: files[activeKey][1].value.trim()
54
+ })
55
+ };
56
+ })
57
+ })
58
+ });
59
+ }
60
+ var useStyles = createStyles(function (_ref5) {
61
+ var css = _ref5.css;
62
+ return {
63
+ tabs: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .sps-tabs-nav {\n margin: 0\n }\n \n .sps-tabs-nav-wrap {\n padding: 0 24px;\n }\n "])))
64
+ };
65
+ });
@@ -0,0 +1,2 @@
1
+ import { type IPreviewerProps } from 'dumi';
2
+ export default function (props: IPreviewerProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,182 @@
1
+ var _templateObject;
2
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
+ 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); }
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ 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; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
+ 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); }
9
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
+ 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."); }
11
+ 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); }
12
+ 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; }
13
+ 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; } }
14
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
+ import { createStyles } from 'antd-style';
16
+ import { useLiveDemo, FormattedMessage } from 'dumi';
17
+ import { useMemo, useRef, useState } from 'react';
18
+ import PreviewerActions from "./PreviewerActions";
19
+ import { IconButton, Tabs } from '@agentscope-ai/design';
20
+ import { jsx as _jsx } from "react/jsx-runtime";
21
+ import { jsxs as _jsxs } from "react/jsx-runtime";
22
+ export default function (props) {
23
+ var _demoContainer$curren;
24
+ var center = props.center,
25
+ compact = props.compact,
26
+ _props$height = props.height,
27
+ height = _props$height === void 0 ? 320 : _props$height;
28
+ var noConfigProvider = JSON.parse(props.noconfigprovider || "false");
29
+ var _useStyles = useStyles(),
30
+ styles = _useStyles.styles,
31
+ cx = _useStyles.cx,
32
+ theme = _useStyles.theme;
33
+ var demoContainer = useRef(null);
34
+ var _useState = useState('preview'),
35
+ _useState2 = _slicedToArray(_useState, 2),
36
+ mode = _useState2[0],
37
+ setMode = _useState2[1];
38
+ var _useLiveDemo = useLiveDemo(props.asset.id, {
39
+ iframe: Boolean(props.iframe || props._live_in_iframe),
40
+ // @ts-ignore
41
+ containerRef: demoContainer
42
+ }),
43
+ liveDemoNode = _useLiveDemo.node,
44
+ setLiveDemoSource = _useLiveDemo.setSource;
45
+ var options = useMemo(function () {
46
+ return [{
47
+ label: /*#__PURE__*/_jsx(FormattedMessage, {
48
+ id: "preview"
49
+ }),
50
+ key: 'preview',
51
+ children: null
52
+ }, {
53
+ label: /*#__PURE__*/_jsx(FormattedMessage, {
54
+ id: "code"
55
+ }),
56
+ key: 'code',
57
+ children: null
58
+ }].map(function (item) {
59
+ if (item.key === mode) return _objectSpread(_objectSpread({}, item), {}, {
60
+ className: styles.actionSelected
61
+ });
62
+ return item;
63
+ });
64
+ }, [mode]);
65
+ var demoUrl = noConfigProvider ? "".concat(props.demoUrl, "?noConfigProvider=true") : props.demoUrl;
66
+ return /*#__PURE__*/_jsxs("div", {
67
+ className: styles.container,
68
+ children: [/*#__PURE__*/_jsxs("div", {
69
+ className: styles.header,
70
+ children: [/*#__PURE__*/_jsx("h4", {
71
+ className: styles.title,
72
+ id: props.asset.id,
73
+ children: props.title
74
+ }), /*#__PURE__*/_jsx("div", {
75
+ children: /*#__PURE__*/_jsx(IconButton, {
76
+ onClick: function onClick() {
77
+ window.open(demoUrl);
78
+ },
79
+ bordered: false,
80
+ iconType: "spark-enlarge-line"
81
+ })
82
+ }), /*#__PURE__*/_jsx("div", {
83
+ className: styles.action,
84
+ children: /*#__PURE__*/_jsx(Tabs, {
85
+ className: styles.tabs,
86
+ activeKey: mode,
87
+ items: options
88
+ // @ts-ignore
89
+ ,
90
+ onChange: setMode,
91
+ type: "segmented"
92
+ })
93
+ })]
94
+ }), /*#__PURE__*/_jsx("div", {
95
+ ref: demoContainer,
96
+ className: styles.demoContainer,
97
+ style: mode === 'preview' ? {
98
+ display: 'block'
99
+ } : {},
100
+ children: props.iframe ? /*#__PURE__*/_jsx("iframe", {
101
+ className: styles.iframe,
102
+ style: ['string', 'number'].includes(_typeof(props.iframe)) ? {
103
+ height: Number(props.iframe)
104
+ } : {},
105
+ src: demoUrl
106
+ }) : /*#__PURE__*/_jsx("div", {
107
+ style: {
108
+ height: height === 'auto' ? 'auto' : Number(height)
109
+ },
110
+ className: cx(styles.liveDemoNode, _defineProperty(_defineProperty({}, styles.center, center), styles.compact, compact)),
111
+ children: liveDemoNode || props.children
112
+ })
113
+ }), /*#__PURE__*/_jsx("div", {
114
+ className: styles.codeContainer,
115
+ style: mode === 'code' ? {
116
+ display: 'block'
117
+ } : {},
118
+ children: /*#__PURE__*/_jsx(PreviewerActions, _objectSpread(_objectSpread({}, props), {}, {
119
+ onSourceChange: setLiveDemoSource,
120
+ demoContainer: props.iframe ? (_demoContainer$curren = demoContainer.current) === null || _demoContainer$curren === void 0 ? void 0 : _demoContainer$curren.firstElementChild : demoContainer.current
121
+ }))
122
+ })]
123
+ });
124
+ }
125
+ var useStyles = createStyles(function (_ref) {
126
+ var token = _ref.token,
127
+ css = _ref.css;
128
+ return {
129
+ container: {
130
+ margin: '32px 0'
131
+ },
132
+ header: {
133
+ display: 'flex',
134
+ alignItems: 'center',
135
+ height: 40,
136
+ marginBottom: 8,
137
+ gap: 8
138
+ },
139
+ title: {
140
+ flex: 1,
141
+ fontSize: 14,
142
+ fontWeight: 500,
143
+ color: token.colorText,
144
+ margin: 0
145
+ },
146
+ action: {},
147
+ actionSelected: {
148
+ fontWeight: 'bold'
149
+ },
150
+ demoContainer: {
151
+ display: 'none',
152
+ border: "1px solid ".concat(token.colorBorderSecondary),
153
+ borderRadius: 8,
154
+ backgroundColor: token.colorBgBase,
155
+ overflow: 'auto'
156
+ },
157
+ liveDemoNode: {
158
+ padding: 32,
159
+ overflow: 'auto'
160
+ },
161
+ center: {
162
+ display: 'flex',
163
+ alignItems: 'safe center',
164
+ justifyContent: 'safe center'
165
+ },
166
+ compact: {
167
+ padding: 0
168
+ },
169
+ codeContainer: {
170
+ display: 'none',
171
+ border: "1px solid ".concat(token.colorBorderSecondary),
172
+ borderRadius: 8,
173
+ backgroundColor: token.colorBgBase
174
+ },
175
+ iframe: {
176
+ display: 'block',
177
+ width: '100%',
178
+ border: 0
179
+ },
180
+ tabs: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .sps-segmented {\n margin: 0\n }\n "])))
181
+ };
182
+ });
@@ -0,0 +1,3 @@
1
+ import { type FC } from 'react';
2
+ declare const ContentFooter: FC;
3
+ export default ContentFooter;