@agentscope-ai/dumi-theme-spark 0.0.98 → 0.0.99
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.
|
@@ -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.
|
|
3
|
+
"version": "0.0.99",
|
|
4
4
|
"description": "A spark site theme package for dumi",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dumi",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"lodash-es": "^4.17.21"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@agentscope-ai/design": "^1",
|
|
61
|
+
"@agentscope-ai/design": "^1.0.20",
|
|
62
62
|
"@commitlint/cli": "^17.1.2",
|
|
63
63
|
"@commitlint/config-conventional": "^17.1.0",
|
|
64
64
|
"@types/lodash-es": "^4.17.12",
|