@forge-kit/plugin-json-viewer 0.0.1 → 0.0.2
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/app.js +2 -2
- package/package.json +2 -2
- package/src/App.less +1 -0
- package/src/App.tsx +8 -3
- package/src/main.tsx +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge-kit/plugin-json-viewer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"entry": "./dist/app.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@forge-kit/component": "workspace:*",
|
|
23
|
-
"@forge-kit/
|
|
23
|
+
"@forge-kit/types": "workspace:*",
|
|
24
24
|
"@forge-kit/icons": "workspace:*",
|
|
25
25
|
"classnames": "^2.5.1",
|
|
26
26
|
"jsonc-parser": "^3.3.1",
|
package/src/App.less
CHANGED
package/src/App.tsx
CHANGED
|
@@ -179,7 +179,13 @@ const colorConfig: ColorConfig = {
|
|
|
179
179
|
null: "orange",
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
|
|
182
|
+
interface AppProps {
|
|
183
|
+
themeProps?: React.ComponentProps<typeof Theme>
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export const App: React.FC<AppProps> = (props) => {
|
|
187
|
+
|
|
188
|
+
const {themeProps} = props
|
|
183
189
|
|
|
184
190
|
const [json, setJson] = useState("");
|
|
185
191
|
|
|
@@ -223,8 +229,7 @@ export const App: React.FC = () => {
|
|
|
223
229
|
)
|
|
224
230
|
|
|
225
231
|
return (
|
|
226
|
-
<Theme className="forge-kit-plugin-json-viewer" accentColor="gray" appearance="dark" radius="full"
|
|
227
|
-
apply={import.meta.env.DEV}>
|
|
232
|
+
<Theme className="forge-kit-plugin-json-viewer" accentColor="gray" appearance="dark" radius="full" {...themeProps}>
|
|
228
233
|
<Flex className="forge-kit-plugin-json-viewer-content" gap="4">
|
|
229
234
|
<CardLayout className="text-area-card" title="SOURCE INPUT" extra={sourceInputExtra}>
|
|
230
235
|
<TextArea className="text-area" size="3" value={json} onChange={handleTextAreaChange}/>
|
package/src/main.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {StrictMode} from 'react'
|
|
2
2
|
import ReactDOM from "react-dom/client";
|
|
3
|
-
import {definePlugin} from '@forge-kit/
|
|
3
|
+
import {definePlugin} from '@forge-kit/types'
|
|
4
4
|
import {App} from './App.tsx'
|
|
5
5
|
|
|
6
6
|
let rootInstance: ReturnType<typeof ReactDOM.createRoot> | null = null;
|
|
@@ -10,11 +10,11 @@ const plugin = definePlugin({
|
|
|
10
10
|
name: 'JSON 解析工具',
|
|
11
11
|
icon: `${import.meta.env.BASE_URL}icon.svg`,
|
|
12
12
|
description: "JSON 解析工具",
|
|
13
|
-
mount: (container: any) => {
|
|
13
|
+
mount: (container: any, props: Record<string, any> = {}) => {
|
|
14
14
|
rootInstance = ReactDOM.createRoot(container);
|
|
15
15
|
rootInstance.render(
|
|
16
16
|
<StrictMode>
|
|
17
|
-
<App/>
|
|
17
|
+
<App {...props}/>
|
|
18
18
|
</StrictMode>,
|
|
19
19
|
)
|
|
20
20
|
},
|