@agentscope-ai/dumi-theme-spark 0.0.98 → 0.0.100

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.
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export default function AntdAPIRef(props: {
2
3
  url: string;
3
- }): import("react/jsx-runtime").JSX.Element;
4
+ }): JSX.Element;
@@ -1 +1,2 @@
1
- export default function DemoTitle(props: any): import("react/jsx-runtime").JSX.Element;
1
+ /// <reference types="react" />
2
+ export default function DemoTitle(props: any): JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export default function Install(props: {
2
3
  children: string;
3
- }): import("react/jsx-runtime").JSX.Element;
4
+ }): JSX.Element;
@@ -18,6 +18,7 @@ import { useMemo, useRef, useState } from 'react';
18
18
  import PreviewerActions from "./PreviewerActions";
19
19
  import { IconButton, Tabs } from '@agentscope-ai/design';
20
20
  import { jsx as _jsx } from "react/jsx-runtime";
21
+ import { Fragment as _Fragment } from "react/jsx-runtime";
21
22
  import { jsxs as _jsxs } from "react/jsx-runtime";
22
23
  export default function (props) {
23
24
  var _demoContainer$curren;
@@ -71,25 +72,27 @@ export default function (props) {
71
72
  className: styles.title,
72
73
  id: props.asset.id,
73
74
  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
- })
75
+ }), !props.noaction && /*#__PURE__*/_jsxs(_Fragment, {
76
+ children: [/*#__PURE__*/_jsx("div", {
77
+ children: /*#__PURE__*/_jsx(IconButton, {
78
+ onClick: function onClick() {
79
+ window.open(demoUrl);
80
+ },
81
+ bordered: false,
82
+ iconType: "spark-enlarge-line"
83
+ })
84
+ }), /*#__PURE__*/_jsx("div", {
85
+ className: styles.action,
86
+ children: /*#__PURE__*/_jsx(Tabs, {
87
+ className: styles.tabs,
88
+ activeKey: mode,
89
+ items: options
90
+ // @ts-ignore
91
+ ,
92
+ onChange: setMode,
93
+ type: "segmented"
94
+ })
95
+ })]
93
96
  })]
94
97
  }), /*#__PURE__*/_jsx("div", {
95
98
  ref: demoContainer,
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
- export default function Nav(): import("react/jsx-runtime").JSX.Element;
3
+ export default function Nav(): JSX.Element;
@@ -1,4 +1,5 @@
1
- import { PropsWithChildren } from "react";
2
- declare const _default: import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<unknown>>;
3
- export default _default;
1
+ import React, { PropsWithChildren } from "react";
2
+ type ScrollProps = React.HTMLAttributes<HTMLDivElement>;
3
+ declare const Scroll: React.ForwardRefExoticComponent<ScrollProps & React.RefAttributes<HTMLDivElement>>;
4
+ export default Scroll;
4
5
  export declare function ScrollGradient(props: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
@@ -11,9 +11,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
11
11
  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; } }
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import { createStyles, cx } from "antd-style";
14
- import { forwardRef, useState } from "react";
14
+ import React, { forwardRef, useState } from "react";
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
16
- export default /*#__PURE__*/forwardRef(function (props, ref) {
16
+ var Scroll = /*#__PURE__*/forwardRef(function Scroll(props, ref) {
17
17
  var _useState = useState(false),
18
18
  _useState2 = _slicedToArray(_useState, 2),
19
19
  isHover = _useState2[0],
@@ -30,6 +30,7 @@ export default /*#__PURE__*/forwardRef(function (props, ref) {
30
30
  }
31
31
  }));
32
32
  });
33
+ export default Scroll;
33
34
  export function ScrollGradient(props) {
34
35
  var _useStyles = useStyles(),
35
36
  styles = _useStyles.styles;
@@ -10,14 +10,14 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
10
10
  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; }
11
11
  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; } }
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
- import { FloatButton, Flex } from "antd";
13
+ import { FloatButton, Input, Flex } from "antd";
14
14
  import { useState } from "react";
15
15
  import { Drawer, Select, IconButton, message } from '@agentscope-ai/design';
16
16
  import { EditOutlined } from "@agentscope-ai/icons-override-antd";
17
17
  import { useIntl } from "dumi";
18
18
  import useTheme from "./useTheme";
19
19
  import { ColorPicker } from 'antd';
20
- import { SparkClearLine, SparkCopyLine, SparkMoonLine, SparkSunLine } from "@agentscope-ai/icons";
20
+ import { SparkClearLine, SparkCopyLine, SparkFileCodeLine, SparkMoonLine, SparkSunLine } from "@agentscope-ai/icons";
21
21
  import copy from "copy-to-clipboard";
22
22
  import { jsx as _jsx } from "react/jsx-runtime";
23
23
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -32,6 +32,14 @@ export default function () {
32
32
  _useState2 = _slicedToArray(_useState, 2),
33
33
  open = _useState2[0],
34
34
  setOpen = _useState2[1];
35
+ var _useState3 = useState(false),
36
+ _useState4 = _slicedToArray(_useState3, 2),
37
+ jsonMode = _useState4[0],
38
+ setJsonMode = _useState4[1];
39
+ var _useState5 = useState(''),
40
+ _useState6 = _slicedToArray(_useState5, 2),
41
+ json = _useState6[0],
42
+ setJson = _useState6[1];
35
43
  var intl = useIntl();
36
44
  if (parent !== window) return null;
37
45
  return /*#__PURE__*/_jsxs(_Fragment, {
@@ -74,6 +82,12 @@ export default function () {
74
82
  }));
75
83
  },
76
84
  icon: theme.darkMode ? /*#__PURE__*/_jsx(SparkMoonLine, {}) : /*#__PURE__*/_jsx(SparkSunLine, {})
85
+ }), /*#__PURE__*/_jsx(IconButton, {
86
+ type: jsonMode ? 'primary' : 'default',
87
+ onClick: function onClick() {
88
+ setJsonMode(!jsonMode);
89
+ },
90
+ icon: /*#__PURE__*/_jsx(SparkFileCodeLine, {})
77
91
  }), /*#__PURE__*/_jsx("div", {
78
92
  style: {
79
93
  flex: 1
@@ -97,7 +111,7 @@ export default function () {
97
111
  }));
98
112
  }
99
113
  })]
100
- }), /*#__PURE__*/_jsx("div", {
114
+ }), !jsonMode && /*#__PURE__*/_jsx("div", {
101
115
  style: {
102
116
  marginTop: 16,
103
117
  display: 'flex',
@@ -128,6 +142,29 @@ export default function () {
128
142
  })]
129
143
  }, key);
130
144
  })
145
+ }), jsonMode && /*#__PURE__*/_jsx("div", {
146
+ style: {
147
+ marginTop: 16
148
+ },
149
+ children: /*#__PURE__*/_jsx(Input.TextArea, {
150
+ value: json,
151
+ autoSize: {
152
+ minRows: 10
153
+ },
154
+ onChange: function onChange(e) {
155
+ setJson(e.target.value);
156
+ try {
157
+ var _json = JSON.parse(e.target.value);
158
+ setTheme(_objectSpread(_objectSpread({}, theme), {}, {
159
+ customToken: _json
160
+ }));
161
+ } catch (error) {
162
+ message.error(intl.formatMessage({
163
+ id: 'jsonInvalid'
164
+ }));
165
+ }
166
+ }
167
+ })
131
168
  })]
132
169
  })]
133
170
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentscope-ai/dumi-theme-spark",
3
- "version": "0.0.98",
3
+ "version": "0.0.100",
4
4
  "description": "A spark site theme package for dumi",
5
5
  "keywords": [
6
6
  "dumi",
@@ -46,6 +46,7 @@
46
46
  "dependencies": {
47
47
  "@agentscope-ai/icons": "^1.0.1",
48
48
  "@agentscope-ai/icons-override-antd": "^6.0.0",
49
+ "@agentscope-ai/icons-svg-override-antd": "^4.4.2",
49
50
  "@alibot/dumi-plugin-api-parser": "1.0.3",
50
51
  "@fingerprintjs/fingerprintjs": "^4.6.2",
51
52
  "@makotot/ghostui": "^2.0.0",
@@ -58,9 +59,11 @@
58
59
  "lodash-es": "^4.17.21"
59
60
  },
60
61
  "devDependencies": {
61
- "@agentscope-ai/design": "^1",
62
+ "@agentscope-ai/design": "^1.0.20",
62
63
  "@commitlint/cli": "^17.1.2",
63
64
  "@commitlint/config-conventional": "^17.1.0",
65
+ "@types/react": "^18.2.0",
66
+ "@types/react-dom": "^18.2.0",
64
67
  "@types/lodash-es": "^4.17.12",
65
68
  "@umijs/lint": "^4.0.0",
66
69
  "antd": "^5.26.6",