docusaurus-live-brython 3.0.0-beta.8 → 3.0.1
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/.devcontainer/devcontainer.json +38 -0
- package/.prettierignore +17 -0
- package/.prettierrc +9 -8
- package/CHANGELOG.md +5 -0
- package/README.md +7 -4
- package/lib/assets/py_back_trace.py +2 -1
- package/lib/index.d.ts +1 -7
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +94 -16
- package/lib/options.d.ts +1 -0
- package/lib/options.d.ts.map +1 -0
- package/lib/options.js +2 -2
- package/lib/theme/CodeBlock/index.d.ts +3 -3
- package/lib/theme/CodeBlock/index.d.ts.map +1 -0
- package/lib/theme/CodeBlock/index.jsx +24 -14
- package/lib/theme/CodeEditor/Actions/DownloadCode.d.ts +1 -0
- package/lib/theme/CodeEditor/Actions/DownloadCode.d.ts.map +1 -0
- package/lib/theme/CodeEditor/Actions/DownloadCode.jsx +8 -8
- package/lib/theme/CodeEditor/Actions/Reset.d.ts +1 -0
- package/lib/theme/CodeEditor/Actions/Reset.d.ts.map +1 -0
- package/lib/theme/CodeEditor/Actions/Reset.jsx +5 -5
- package/lib/theme/CodeEditor/Actions/RunCode.d.ts +2 -1
- package/lib/theme/CodeEditor/Actions/RunCode.d.ts.map +1 -0
- package/lib/theme/CodeEditor/Actions/RunCode.jsx +4 -4
- package/lib/theme/CodeEditor/Actions/ShowRaw.d.ts +1 -0
- package/lib/theme/CodeEditor/Actions/ShowRaw.d.ts.map +1 -0
- package/lib/theme/CodeEditor/Actions/ShowRaw.jsx +13 -7
- package/lib/theme/CodeEditor/Actions/ShowSyncStatus.d.ts +1 -0
- package/lib/theme/CodeEditor/Actions/ShowSyncStatus.d.ts.map +1 -0
- package/lib/theme/CodeEditor/Actions/ShowSyncStatus.jsx +21 -16
- package/lib/theme/CodeEditor/Actions/styles.module.css +2 -3
- package/lib/theme/CodeEditor/BrythonCommunicator.d.ts +2 -1
- package/lib/theme/CodeEditor/BrythonCommunicator.d.ts.map +1 -0
- package/lib/theme/CodeEditor/BrythonCommunicator.jsx +13 -9
- package/lib/theme/CodeEditor/Button/index.d.ts +3 -2
- package/lib/theme/CodeEditor/Button/index.d.ts.map +1 -0
- package/lib/theme/CodeEditor/Button/index.jsx +1 -1
- package/lib/theme/CodeEditor/Button/styles.module.css +1 -1
- package/lib/theme/CodeEditor/CodeHistory/index.d.ts +1 -0
- package/lib/theme/CodeEditor/CodeHistory/index.d.ts.map +1 -0
- package/lib/theme/CodeEditor/CodeHistory/index.jsx +26 -15
- package/lib/theme/CodeEditor/CodeHistory/styles.module.css +31 -31
- package/lib/theme/CodeEditor/ContextEditor/index.d.ts +22 -0
- package/lib/theme/CodeEditor/ContextEditor/index.d.ts.map +1 -0
- package/lib/theme/CodeEditor/ContextEditor/index.jsx +36 -0
- package/lib/theme/CodeEditor/Editor/EditorAce.d.ts +2 -1
- package/lib/theme/CodeEditor/Editor/EditorAce.d.ts.map +1 -0
- package/lib/theme/CodeEditor/Editor/EditorAce.jsx +17 -14
- package/lib/theme/CodeEditor/Editor/Header/index.d.ts +2 -1
- package/lib/theme/CodeEditor/Editor/Header/index.d.ts.map +1 -0
- package/lib/theme/CodeEditor/Editor/Header/index.jsx +12 -12
- package/lib/theme/CodeEditor/Editor/Header/styles.module.css +7 -7
- package/lib/theme/CodeEditor/Editor/HiddenCode/index.d.ts +8 -0
- package/lib/theme/CodeEditor/Editor/HiddenCode/index.d.ts.map +1 -0
- package/lib/theme/CodeEditor/Editor/HiddenCode/index.jsx +27 -0
- package/lib/theme/CodeEditor/Editor/HiddenCode/styles.module.css +52 -0
- package/lib/theme/CodeEditor/Editor/Result/Graphics/Canvas.d.ts +1 -0
- package/lib/theme/CodeEditor/Editor/Result/Graphics/Canvas.d.ts.map +1 -0
- package/lib/theme/CodeEditor/Editor/Result/Graphics/Canvas.jsx +8 -9
- package/lib/theme/CodeEditor/Editor/Result/Graphics/Turtle.d.ts +1 -0
- package/lib/theme/CodeEditor/Editor/Result/Graphics/Turtle.d.ts.map +1 -0
- package/lib/theme/CodeEditor/Editor/Result/Graphics/Turtle.jsx +11 -11
- package/lib/theme/CodeEditor/Editor/Result/Graphics/index.d.ts +4 -3
- package/lib/theme/CodeEditor/Editor/Result/Graphics/index.d.ts.map +1 -0
- package/lib/theme/CodeEditor/Editor/Result/Graphics/index.jsx +12 -10
- package/lib/theme/CodeEditor/Editor/Result/Graphics/styles.module.css +2 -2
- package/lib/theme/CodeEditor/Editor/Result/index.d.ts +2 -3
- package/lib/theme/CodeEditor/Editor/Result/index.d.ts.map +1 -0
- package/lib/theme/CodeEditor/Editor/Result/index.jsx +6 -9
- package/lib/theme/CodeEditor/Editor/Result/styles.module.css +15 -10
- package/lib/theme/CodeEditor/Editor/index.d.ts +6 -3
- package/lib/theme/CodeEditor/Editor/index.d.ts.map +1 -0
- package/lib/theme/CodeEditor/Editor/index.jsx +34 -28
- package/lib/theme/CodeEditor/Editor/styles.module.css +15 -7
- package/lib/theme/CodeEditor/Editor/utils/checkForButtonClick.d.ts +1 -0
- package/lib/theme/CodeEditor/Editor/utils/checkForButtonClick.d.ts.map +1 -0
- package/lib/theme/CodeEditor/Editor/utils/saveSvg.d.ts +1 -0
- package/lib/theme/CodeEditor/Editor/utils/saveSvg.d.ts.map +1 -0
- package/lib/theme/CodeEditor/Editor/utils/saveSvg.js +19 -8
- package/lib/theme/CodeEditor/Editor/utils/svgWithoutAnimations.d.ts +1 -0
- package/lib/theme/CodeEditor/Editor/utils/svgWithoutAnimations.d.ts.map +1 -0
- package/lib/theme/CodeEditor/Editor/utils/svgWithoutAnimations.js +43 -49
- package/lib/theme/CodeEditor/Icon/icons.d.ts +4 -1
- package/lib/theme/CodeEditor/Icon/icons.d.ts.map +1 -0
- package/lib/theme/CodeEditor/Icon/icons.js +3 -1
- package/lib/theme/CodeEditor/Icon/index.d.ts +4 -2
- package/lib/theme/CodeEditor/Icon/index.d.ts.map +1 -0
- package/lib/theme/CodeEditor/Icon/index.jsx +10 -3
- package/lib/theme/CodeEditor/Icon/styles.module.css +1 -1
- package/lib/theme/CodeEditor/WithScript/ScriptContext.d.ts +8 -0
- package/lib/theme/CodeEditor/WithScript/ScriptContext.d.ts.map +1 -0
- package/lib/theme/CodeEditor/WithScript/ScriptContext.jsx +27 -0
- package/lib/theme/CodeEditor/WithScript/Storage.d.ts +2 -1
- package/lib/theme/CodeEditor/WithScript/Storage.d.ts.map +1 -0
- package/lib/theme/CodeEditor/WithScript/Types.d.ts +12 -4
- package/lib/theme/CodeEditor/WithScript/Types.d.ts.map +1 -0
- package/lib/theme/CodeEditor/WithScript/bryRunner.d.ts +3 -0
- package/lib/theme/CodeEditor/WithScript/bryRunner.d.ts.map +1 -0
- package/lib/theme/CodeEditor/WithScript/bryRunner.js +29 -0
- package/lib/theme/CodeEditor/WithScript/createStore.d.ts +4 -0
- package/lib/theme/CodeEditor/WithScript/createStore.d.ts.map +1 -0
- package/lib/theme/CodeEditor/WithScript/{Store.jsx → createStore.js} +62 -74
- package/lib/theme/CodeEditor/WithScript/helpers.d.ts +1 -4
- package/lib/theme/CodeEditor/WithScript/helpers.d.ts.map +1 -0
- package/lib/theme/CodeEditor/WithScript/helpers.js +4 -14
- package/lib/theme/CodeEditor/constants.d.ts +1 -0
- package/lib/theme/CodeEditor/constants.d.ts.map +1 -0
- package/lib/theme/CodeEditor/hooks/index.d.ts +3 -0
- package/lib/theme/CodeEditor/hooks/index.d.ts.map +1 -0
- package/lib/theme/CodeEditor/hooks/index.js +2 -0
- package/lib/theme/CodeEditor/hooks/useScript.d.ts +3 -0
- package/lib/theme/CodeEditor/hooks/useScript.d.ts.map +1 -0
- package/lib/theme/CodeEditor/hooks/useScript.js +4 -0
- package/lib/theme/CodeEditor/hooks/useStore.d.ts +3 -0
- package/lib/theme/CodeEditor/hooks/useStore.d.ts.map +1 -0
- package/lib/theme/CodeEditor/hooks/useStore.js +10 -0
- package/lib/theme/CodeEditor/index.d.ts +24 -5
- package/lib/theme/CodeEditor/index.d.ts.map +1 -0
- package/lib/theme/CodeEditor/index.jsx +17 -16
- package/lib/theme/CodeEditor/styles.module.css +28 -30
- package/og-image.md +23 -0
- package/package.json +39 -20
- package/src/assets/py_back_trace.py +2 -1
- package/src/index.ts +96 -25
- package/src/options.ts +12 -12
- package/src/theme/CodeBlock/index.tsx +44 -68
- package/src/theme/CodeEditor/Actions/DownloadCode.tsx +23 -22
- package/src/theme/CodeEditor/Actions/Reset.tsx +14 -12
- package/src/theme/CodeEditor/Actions/RunCode.tsx +14 -11
- package/src/theme/CodeEditor/Actions/ShowRaw.tsx +17 -11
- package/src/theme/CodeEditor/Actions/ShowSyncStatus.tsx +32 -27
- package/src/theme/CodeEditor/Actions/styles.module.css +2 -3
- package/src/theme/CodeEditor/BrythonCommunicator.tsx +16 -19
- package/src/theme/CodeEditor/Button/index.tsx +17 -13
- package/src/theme/CodeEditor/Button/styles.module.css +1 -1
- package/src/theme/CodeEditor/CodeHistory/index.tsx +32 -20
- package/src/theme/CodeEditor/CodeHistory/styles.module.css +31 -31
- package/src/theme/CodeEditor/ContextEditor/index.tsx +74 -0
- package/src/theme/CodeEditor/Editor/EditorAce.tsx +20 -16
- package/src/theme/CodeEditor/Editor/Header/index.tsx +13 -19
- package/src/theme/CodeEditor/Editor/Header/styles.module.css +7 -7
- package/src/theme/CodeEditor/Editor/HiddenCode/index.tsx +49 -0
- package/src/theme/CodeEditor/Editor/HiddenCode/styles.module.css +52 -0
- package/src/theme/CodeEditor/Editor/Result/Graphics/Canvas.tsx +25 -22
- package/src/theme/CodeEditor/Editor/Result/Graphics/Turtle.tsx +23 -19
- package/src/theme/CodeEditor/Editor/Result/Graphics/index.tsx +16 -16
- package/src/theme/CodeEditor/Editor/Result/Graphics/styles.module.css +2 -2
- package/src/theme/CodeEditor/Editor/Result/index.tsx +7 -13
- package/src/theme/CodeEditor/Editor/Result/styles.module.css +15 -10
- package/src/theme/CodeEditor/Editor/index.tsx +67 -65
- package/src/theme/CodeEditor/Editor/styles.module.css +15 -7
- package/src/theme/CodeEditor/Editor/utils/checkForButtonClick.ts +5 -5
- package/src/theme/CodeEditor/Editor/utils/saveSvg.ts +63 -53
- package/src/theme/CodeEditor/Editor/utils/svgWithoutAnimations.ts +182 -201
- package/src/theme/CodeEditor/Icon/icons.ts +27 -13
- package/src/theme/CodeEditor/Icon/index.tsx +31 -11
- package/src/theme/CodeEditor/Icon/styles.module.css +1 -1
- package/src/theme/CodeEditor/WithScript/ScriptContext.tsx +36 -0
- package/src/theme/CodeEditor/WithScript/Storage.ts +3 -3
- package/src/theme/CodeEditor/WithScript/Types.ts +17 -11
- package/src/theme/CodeEditor/WithScript/bryRunner.ts +39 -0
- package/src/theme/CodeEditor/WithScript/createStore.ts +276 -0
- package/src/theme/CodeEditor/WithScript/helpers.ts +16 -26
- package/src/theme/CodeEditor/constants.ts +9 -11
- package/src/theme/CodeEditor/hooks/index.ts +2 -0
- package/src/theme/CodeEditor/hooks/useScript.ts +9 -0
- package/src/theme/CodeEditor/hooks/useStore.ts +15 -0
- package/src/theme/CodeEditor/index.tsx +45 -31
- package/src/theme/CodeEditor/styles.module.css +28 -30
- package/src/typings.d.ts +11 -0
- package/lib/theme/CodeEditor/WithScript/Store.d.ts +0 -15
- package/lib/types.d.ts +0 -28
- package/lib/types.js +0 -1
- package/src/theme/CodeEditor/WithScript/Store.tsx +0 -294
- package/src/types.ts +0 -29
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "docusaurus-live-brython",
|
|
3
|
+
"image": "mcr.microsoft.com/devcontainers/typescript-node:24-bookworm",
|
|
4
|
+
"customizations": {
|
|
5
|
+
"vscode": {
|
|
6
|
+
"extensions": [
|
|
7
|
+
"pomdtr.excalidraw-editor",
|
|
8
|
+
"zhuangtongfa.Material-theme",
|
|
9
|
+
"mhutchie.git-graph",
|
|
10
|
+
"esbenp.prettier-vscode",
|
|
11
|
+
"dbaeumer.vscode-eslint",
|
|
12
|
+
"unifiedjs.vscode-mdx",
|
|
13
|
+
"motivesoft.vscode-uuid-generator",
|
|
14
|
+
"lukas-tr.materialdesignicons-intellisense"
|
|
15
|
+
],
|
|
16
|
+
"settings": {
|
|
17
|
+
"workbench.colorTheme": "One Dark Pro",
|
|
18
|
+
"extensions.ignoreRecommendations": true,
|
|
19
|
+
"git.autofetch": true,
|
|
20
|
+
"editor.tabSize": 4,
|
|
21
|
+
"[mdx]": {
|
|
22
|
+
"editor.defaultFormatter": "unifiedjs.vscode-mdx"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"remoteEnv": {
|
|
28
|
+
"OFFLINE_API": "true"
|
|
29
|
+
},
|
|
30
|
+
"postStartCommand": "yarn install",
|
|
31
|
+
"forwardPorts": [3000],
|
|
32
|
+
"features": {
|
|
33
|
+
"ghcr.io/devcontainers/features/node:1": {
|
|
34
|
+
"version": "24.12"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"runArgs": ["--network=host"]
|
|
38
|
+
}
|
package/.prettierignore
ADDED
package/.prettierrc
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
"arrowParens": "always",
|
|
3
|
+
"bracketSpacing": true,
|
|
4
|
+
"bracketSameLine": false,
|
|
5
|
+
"printWidth": 110,
|
|
6
|
+
"proseWrap": "never",
|
|
7
|
+
"singleQuote": true,
|
|
8
|
+
"trailingComma": "none",
|
|
9
|
+
"tabWidth": 4
|
|
10
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Version 3.0.0beta.25
|
|
4
|
+
- Breaking: Renamed `isGraphicsmodalOpen` to `graphicsModalExecutionNr` and changing it's type from `boolean` to `number`.
|
|
5
|
+
This fixes an issue that caused the Turtle Output to display the first animation instead of the current created one, when the user kept the graphics modal open while changing the code.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Docusaurus Live Codeblock for Python
|
|
2
2
|
|
|
3
|
-

|
|
3
|
+
[](https://www.npmjs.com/package/docusaurus-live-brython/)
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
> [!NOTE]\
|
|
@@ -41,8 +41,8 @@ module.exports = {
|
|
|
41
41
|
+ themes: [
|
|
42
42
|
+ ['docusaurus-live-brython'],
|
|
43
43
|
+ {
|
|
44
|
-
+
|
|
45
|
-
+
|
|
44
|
+
+ brythonSrc: 'https://cdn.jsdelivr.net/npm/brython@3.12.4/brython.min.js', // default
|
|
45
|
+
+ brythonStdlibSrc: 'https://cdn.jsdelivr.net/npm/brython@3.12.4/brython_stdlib.js' // default
|
|
46
46
|
+ }
|
|
47
47
|
presets: ['@docusaurus/preset-classic']
|
|
48
48
|
...
|
|
@@ -117,6 +117,9 @@ yarn link docusaurus-live-brython
|
|
|
117
117
|
|
|
118
118
|
Then start the website
|
|
119
119
|
```sh
|
|
120
|
+
# in root
|
|
121
|
+
yarn run watch
|
|
122
|
+
# in website/
|
|
120
123
|
yarn run start
|
|
121
124
|
```
|
|
122
125
|
|
|
@@ -127,4 +130,4 @@ yarn run build
|
|
|
127
130
|
# when running inside wsl, use --auth=legacy
|
|
128
131
|
npm login --auth=legacy
|
|
129
132
|
npm publish --auth=legacy
|
|
130
|
-
```
|
|
133
|
+
```
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from browser import document, window # type: ignore
|
|
2
2
|
import sys
|
|
3
|
+
import time
|
|
3
4
|
|
|
4
5
|
# @source https://github.com/brython-dev/brython/blob/master/www/src/Lib/tb.py
|
|
5
6
|
# instead of "print()" to "console.log()" in the original code, we use "notify()" to send the output to the react world
|
|
@@ -23,7 +24,7 @@ class EventOutput:
|
|
|
23
24
|
|
|
24
25
|
def flush(self):
|
|
25
26
|
if len(self.buf) > 0:
|
|
26
|
-
notify(self.node_id, {'type': self.out_type, 'output': self.buf})
|
|
27
|
+
notify(self.node_id, {'type': self.out_type, 'output': self.buf, 'time': time.time()})
|
|
27
28
|
self.buf = ''
|
|
28
29
|
|
|
29
30
|
def __len__(self):
|
package/lib/index.d.ts
CHANGED
|
@@ -4,13 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
/**
|
|
8
|
-
* Notes
|
|
9
|
-
* - how to add static files: https://github.com/facebook/docusaurus/discussions/6907
|
|
10
|
-
* ---> sitemap plugin: https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-plugin-sitemap/src/index.ts
|
|
11
|
-
* - call brython with arguments: https://github.com/brython-dev/brython/issues/2421
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
7
|
import type { HtmlTags, Plugin } from '@docusaurus/types';
|
|
15
8
|
import { type ThemeOptions, type Options } from './options';
|
|
16
9
|
export declare const NAME: "docusaurus-live-brython";
|
|
@@ -21,3 +14,4 @@ declare const theme: Plugin<{
|
|
|
21
14
|
export default theme;
|
|
22
15
|
export { validateThemeConfig } from './options';
|
|
23
16
|
export { ThemeOptions, Options };
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,KAAK,EAAE,QAAQ,EAAe,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAMvE,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,OAAO,EAAmB,MAAM,WAAW,CAAC;AAG7E,eAAO,MAAM,IAAI,EAAG,yBAAkC,CAAC;AACvD,eAAO,MAAM,eAAe,EAAG,UAAmB,CAAC;AAiBnD,QAAA,MAAM,KAAK,EAAE,MAAM,CAAC;IAAE,cAAc,EAAE,QAAQ,EAAE,CAAA;CAAE,CAkIjD,CAAC;AAEF,eAAe,KAAK,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
* Notes
|
|
9
|
+
* - how to add static files: https://github.com/facebook/docusaurus/discussions/6907
|
|
10
|
+
* ---> sitemap plugin: https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-plugin-sitemap/src/index.ts
|
|
11
|
+
* - call brython with arguments: https://github.com/brython-dev/brython/issues/2421
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
import { readDefaultCodeTranslationMessages } from '@docusaurus/theme-translations';
|
|
7
15
|
// eslint-disable-next-line import/no-extraneous-dependencies, import/order
|
|
8
16
|
import logger from '@docusaurus/logger';
|
|
9
17
|
import fs from 'fs-extra';
|
|
@@ -13,30 +21,90 @@ import { DEFAULT_OPTIONS } from './options';
|
|
|
13
21
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
22
|
export const NAME = 'docusaurus-live-brython';
|
|
15
23
|
export const DEFAULT_LIB_DIR = 'bry-libs';
|
|
24
|
+
const extractImports = (script) => {
|
|
25
|
+
const imports = [];
|
|
26
|
+
script.split('\n').forEach((line) => {
|
|
27
|
+
const fromImport = line.match(/from\s+(\w+)\s+import\s+/);
|
|
28
|
+
if (fromImport) {
|
|
29
|
+
return imports.push(fromImport[1]);
|
|
30
|
+
}
|
|
31
|
+
const importImport = line.match(/import\s+(\w+)/);
|
|
32
|
+
if (importImport) {
|
|
33
|
+
return imports.push(importImport[1]);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return imports;
|
|
37
|
+
};
|
|
16
38
|
const theme = (context, options) => {
|
|
39
|
+
const { i18n: { currentLocale } } = context;
|
|
17
40
|
const libDir = options.libDir || DEFAULT_LIB_DIR;
|
|
41
|
+
const isRemote = /https?:\/\//.test(libDir);
|
|
42
|
+
const isHashRouter = context.siteConfig.future?.experimental_router === 'hash';
|
|
18
43
|
return {
|
|
19
44
|
name: NAME,
|
|
20
45
|
async loadContent() {
|
|
21
|
-
|
|
22
|
-
|
|
46
|
+
const staticDir = path.join(context.siteDir, context.siteConfig.staticDirectories[0], libDir);
|
|
47
|
+
let assets = [];
|
|
48
|
+
const bryModules = [];
|
|
49
|
+
if (!options.skipCopyAssetsToLibDir && !isRemote) {
|
|
23
50
|
await fs.ensureDir(staticDir);
|
|
24
51
|
if (process.env.NODE_ENV !== 'production') {
|
|
25
|
-
|
|
52
|
+
assets = fs.readdirSync(path.join(__dirname, 'assets'));
|
|
26
53
|
for (const asset of assets) {
|
|
27
54
|
const assetFile = path.join(__dirname, 'assets', asset);
|
|
28
55
|
const assetOutFile = path.join(staticDir, asset);
|
|
29
56
|
logger.info(`copy "${asset}" to "${assetOutFile}"`);
|
|
30
57
|
await fs.copyFile(assetFile, assetOutFile);
|
|
31
58
|
}
|
|
32
|
-
return assets;
|
|
33
59
|
}
|
|
34
60
|
}
|
|
61
|
+
if (isHashRouter && !isRemote) {
|
|
62
|
+
const libs = await fs.readdir(staticDir);
|
|
63
|
+
const libraries = {};
|
|
64
|
+
for (const lib of libs) {
|
|
65
|
+
const libPath = path.join(staticDir, lib);
|
|
66
|
+
if (libPath.endsWith('.py')) {
|
|
67
|
+
const libContent = await fs.readFile(libPath, 'utf-8');
|
|
68
|
+
libraries[lib.replace(/\.py$/i, '')] = libContent;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const libNames = Object.keys(libraries);
|
|
72
|
+
for (const libName of libNames) {
|
|
73
|
+
const libContent = libraries[libName];
|
|
74
|
+
const imports = extractImports(libContent);
|
|
75
|
+
const injectAt = Math.max(...bryModules.map((lib, idx) => (imports.includes(lib.name) ? idx : -1)), -1);
|
|
76
|
+
if (injectAt < 0) {
|
|
77
|
+
bryModules.splice(0, 0, { name: libName, content: libContent });
|
|
78
|
+
}
|
|
79
|
+
else if (injectAt + 1 < bryModules.length) {
|
|
80
|
+
bryModules.splice(injectAt + 1, 0, {
|
|
81
|
+
name: libName,
|
|
82
|
+
content: libContent
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
bryModules.push({ name: libName, content: libContent });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
assets: assets,
|
|
92
|
+
bryModules: bryModules
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
getDefaultCodeTranslationMessages() {
|
|
96
|
+
return readDefaultCodeTranslationMessages({
|
|
97
|
+
locale: currentLocale,
|
|
98
|
+
name: NAME
|
|
99
|
+
});
|
|
35
100
|
},
|
|
36
101
|
async contentLoaded({ content, actions }) {
|
|
37
102
|
const { setGlobalData } = actions;
|
|
38
|
-
const
|
|
39
|
-
setGlobalData({
|
|
103
|
+
const libUrl = isRemote ? libDir : path.join(context.baseUrl, libDir, '/');
|
|
104
|
+
setGlobalData({
|
|
105
|
+
libDir: libUrl,
|
|
106
|
+
syncMaxOnceEvery: options.syncMaxOnceEvery || DEFAULT_OPTIONS.syncMaxOnceEvery
|
|
107
|
+
});
|
|
40
108
|
},
|
|
41
109
|
configureWebpack() {
|
|
42
110
|
return {
|
|
@@ -45,9 +113,9 @@ const theme = (context, options) => {
|
|
|
45
113
|
{
|
|
46
114
|
test: /\.raw\.*/,
|
|
47
115
|
type: 'asset/source'
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
}
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
51
119
|
};
|
|
52
120
|
},
|
|
53
121
|
getThemePath() {
|
|
@@ -56,28 +124,38 @@ const theme = (context, options) => {
|
|
|
56
124
|
getTypeScriptThemePath() {
|
|
57
125
|
return '../src/theme';
|
|
58
126
|
},
|
|
59
|
-
injectHtmlTags() {
|
|
127
|
+
injectHtmlTags({ content }) {
|
|
60
128
|
return {
|
|
61
129
|
headTags: [
|
|
62
130
|
{
|
|
63
131
|
tagName: 'script',
|
|
64
132
|
attributes: {
|
|
65
133
|
src: options.brythonSrc || DEFAULT_OPTIONS.brythonSrc,
|
|
66
|
-
crossorigin:
|
|
67
|
-
referrerpolicy:
|
|
134
|
+
crossorigin: 'anonymous',
|
|
135
|
+
referrerpolicy: 'no-referrer',
|
|
68
136
|
defer: 'defer'
|
|
69
|
-
}
|
|
137
|
+
}
|
|
70
138
|
},
|
|
71
139
|
{
|
|
72
140
|
tagName: 'script',
|
|
73
141
|
attributes: {
|
|
74
142
|
src: options.brythonStdlibSrc || DEFAULT_OPTIONS.brythonStdlibSrc,
|
|
75
|
-
crossorigin:
|
|
76
|
-
referrerpolicy:
|
|
143
|
+
crossorigin: 'anonymous',
|
|
144
|
+
referrerpolicy: 'no-referrer',
|
|
77
145
|
defer: 'defer'
|
|
78
|
-
}
|
|
146
|
+
}
|
|
79
147
|
}
|
|
80
148
|
],
|
|
149
|
+
postBodyTags: content.bryModules.map((module) => {
|
|
150
|
+
return {
|
|
151
|
+
tagName: 'script',
|
|
152
|
+
attributes: {
|
|
153
|
+
id: module.name,
|
|
154
|
+
type: 'text/python'
|
|
155
|
+
},
|
|
156
|
+
innerHTML: module.content
|
|
157
|
+
};
|
|
158
|
+
})
|
|
81
159
|
};
|
|
82
160
|
},
|
|
83
161
|
getSwizzleComponentList() {
|
package/lib/options.d.ts
CHANGED
|
@@ -42,3 +42,4 @@ export type ThemeOptions = {
|
|
|
42
42
|
export type Options = Partial<ThemeOptions>;
|
|
43
43
|
export declare const DEFAULT_OPTIONS: ThemeOptions;
|
|
44
44
|
export declare function validateThemeConfig({ themeConfig, validate }: ThemeConfigValidationContext<Options, ThemeOptions>): ThemeOptions;
|
|
45
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAEtE,MAAM,MAAM,YAAY,GAAG;IACvB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;;;;;OAOG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,sBAAsB,EAAE,OAAO,CAAC;IAChC;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAE5C,eAAO,MAAM,eAAe,EAAE,YAM7B,CAAC;AAUF,wBAAgB,mBAAmB,CAAC,EAChC,WAAW,EACX,QAAQ,EACX,EAAE,4BAA4B,CAAC,OAAO,EAAE,YAAY,CAAC,GAAG,YAAY,CAGpE"}
|
package/lib/options.js
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { Joi } from '@docusaurus/utils-validation';
|
|
8
8
|
export const DEFAULT_OPTIONS = {
|
|
9
|
-
brythonSrc: 'https://
|
|
10
|
-
brythonStdlibSrc: 'https://
|
|
9
|
+
brythonSrc: 'https://cdn.jsdelivr.net/npm/brython@3.14/brython.min.js',
|
|
10
|
+
brythonStdlibSrc: 'https://cdn.jsdelivr.net/npm/brython@3.14/brython_stdlib.js',
|
|
11
11
|
libDir: '/bry-libs/',
|
|
12
12
|
skipCopyAssetsToLibDir: false,
|
|
13
13
|
syncMaxOnceEvery: 1000
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
/// <reference types="@docusaurus/module-type-aliases" />
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import { type Props as CodeBlockType } from '@theme-init/CodeBlock';
|
|
4
3
|
import type { WrapperProps } from '@docusaurus/types';
|
|
5
4
|
type Props = WrapperProps<typeof CodeBlockType>;
|
|
6
|
-
export default function CodeBlockWrapper(props: Props):
|
|
5
|
+
export default function CodeBlockWrapper(props: Props): React.ReactNode;
|
|
7
6
|
export {};
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme/CodeBlock/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAkB,EAAE,KAAK,KAAK,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOtD,KAAK,KAAK,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC;AAsChD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,SAAS,CA0BtE"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import CodeBlock from '@theme-init/CodeBlock';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import ScriptContext from 'docusaurus-live-brython/theme/CodeEditor/WithScript/Store';
|
|
3
|
+
import ContextEditor, { splitCode } from '@theme/CodeEditor/ContextEditor';
|
|
4
|
+
import BrowserOnly from '@docusaurus/BrowserOnly';
|
|
6
5
|
const sanitizedTitle = (id) => {
|
|
7
6
|
if (!id) {
|
|
8
7
|
return;
|
|
9
8
|
}
|
|
10
|
-
return id
|
|
9
|
+
return id
|
|
10
|
+
.replace(/--/g, '<<HYPHEN>>')
|
|
11
|
+
.replace(/__/g, '<<UNDERSCORE>>')
|
|
12
|
+
.replace(/[-_]/g, ' ')
|
|
13
|
+
.replace(/<<UNDERSCORE>>/g, '_')
|
|
14
|
+
.replace(/<<HYPHEN>>/g, '-');
|
|
11
15
|
};
|
|
12
16
|
const extractMetaProps = (props) => {
|
|
13
17
|
const metaString = (props?.metastring || '').replace(/\s*=\s*/g, '='); // remove spaces around =
|
|
@@ -17,9 +21,12 @@ const extractMetaProps = (props) => {
|
|
|
17
21
|
return acc;
|
|
18
22
|
}
|
|
19
23
|
/** casts to booleans and numbers. When no value was provided, true is used */
|
|
20
|
-
const val = value === 'true'
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
const val = value === 'true'
|
|
25
|
+
? true
|
|
26
|
+
: value === 'false'
|
|
27
|
+
? false
|
|
28
|
+
: !Number.isNaN(Number(value))
|
|
29
|
+
? Number(value)
|
|
23
30
|
: value || true;
|
|
24
31
|
acc[key] = val;
|
|
25
32
|
return acc;
|
|
@@ -35,13 +42,16 @@ export default function CodeBlockWrapper(props) {
|
|
|
35
42
|
// if (metaProps.live_jsx) {
|
|
36
43
|
// return <Playground scope={ReactLiveScope} {...props} />;
|
|
37
44
|
// }
|
|
38
|
-
if (metaProps.live_py
|
|
45
|
+
if (metaProps.live_py) {
|
|
39
46
|
const title = props.title || metaProps.title;
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<
|
|
44
|
-
|
|
47
|
+
const { code } = splitCode(props.children || '');
|
|
48
|
+
return (<BrowserOnly fallback={<CodeBlock language={lang}>{code}</CodeBlock>}>
|
|
49
|
+
{() => {
|
|
50
|
+
return (<ContextEditor {...props} {...metaProps} title={sanitizedTitle(title) || lang}>
|
|
51
|
+
{props.children}
|
|
52
|
+
</ContextEditor>);
|
|
53
|
+
}}
|
|
54
|
+
</BrowserOnly>);
|
|
45
55
|
}
|
|
46
|
-
return
|
|
56
|
+
return <CodeBlock {...props}/>;
|
|
47
57
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DownloadCode.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/Actions/DownloadCode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,QAAA,MAAM,YAAY,GAAI,OAAO;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,sBA+B7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import Button from '
|
|
2
|
+
import { useStore, useScript } from '@theme/CodeEditor/hooks';
|
|
3
|
+
import Button from '@theme/CodeEditor/Button';
|
|
4
4
|
import { translate } from '@docusaurus/Translate';
|
|
5
5
|
const DownloadCode = (props) => {
|
|
6
|
-
const
|
|
7
|
-
const code =
|
|
8
|
-
const lang =
|
|
9
|
-
const id =
|
|
10
|
-
return (<Button icon=
|
|
11
|
-
const downloadLink = document.createElement(
|
|
6
|
+
const store = useStore();
|
|
7
|
+
const code = useScript(store, 'code');
|
|
8
|
+
const lang = useScript(store, 'lang');
|
|
9
|
+
const id = useScript(store, 'id');
|
|
10
|
+
return (<Button icon="Download" onClick={() => {
|
|
11
|
+
const downloadLink = document.createElement('a');
|
|
12
12
|
const file = new Blob([code], { type: 'text/plain;charset=utf-8' });
|
|
13
13
|
downloadLink.href = URL.createObjectURL(file);
|
|
14
14
|
const fExt = lang === 'python' ? '.py' : `.${lang}`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Reset.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/Actions/Reset.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,QAAA,MAAM,KAAK,yBAyBV,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import Button from '
|
|
2
|
+
import { useStore, useScript } from '@theme/CodeEditor/hooks';
|
|
3
|
+
import Button from '@theme/CodeEditor/Button';
|
|
4
4
|
import { translate } from '@docusaurus/Translate';
|
|
5
5
|
const Reset = () => {
|
|
6
|
-
const
|
|
7
|
-
const pristine =
|
|
6
|
+
const store = useStore();
|
|
7
|
+
const pristine = useScript(store, 'pristineCode');
|
|
8
8
|
const onReset = () => {
|
|
9
9
|
const shouldReset = window.confirm(translate({
|
|
10
10
|
message: 'Discard your edits? Your changes will be lost!'
|
|
@@ -16,7 +16,7 @@ const Reset = () => {
|
|
|
16
16
|
return (<Button onClick={onReset} title={translate({
|
|
17
17
|
message: 'Discard Changes',
|
|
18
18
|
description: 'Reset the code to its original state',
|
|
19
|
-
id: 'theme.CodeEditor.Header.reset'
|
|
19
|
+
id: 'theme.CodeEditor.Header.reset'
|
|
20
20
|
})} icon="Reset"/>);
|
|
21
21
|
};
|
|
22
22
|
export default Reset;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RunCode.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/Actions/RunCode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,WAAW,KAAK;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;CACjB;AAED,QAAA,MAAM,OAAO,GAAI,OAAO,KAAK,sBAsB5B,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import Button, { Color } from '
|
|
2
|
+
import { useStore, useScript } from '@theme/CodeEditor/hooks';
|
|
3
|
+
import Button, { Color } from '@theme/CodeEditor/Button';
|
|
4
4
|
import { translate } from '@docusaurus/Translate';
|
|
5
5
|
import styles from './styles.module.css';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
const RunCode = (props) => {
|
|
8
|
-
const
|
|
9
|
-
const isExecuting =
|
|
8
|
+
const store = useStore();
|
|
9
|
+
const isExecuting = useScript(store, 'isExecuting');
|
|
10
10
|
return (<Button icon={isExecuting ? 'Python' : 'Play'} spin={isExecuting} color={Color.Success} className={clsx(styles.runCode, props.slim && styles.slim)} iconSize={props.slim ? '1.2em' : '1.6em'} onClick={() => {
|
|
11
11
|
store.execScript();
|
|
12
12
|
}} title={translate({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShowRaw.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/Actions/ShowRaw.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,QAAA,MAAM,OAAO,yBAsBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import Button, { Color } from '
|
|
2
|
+
import { useStore, useScript } from '@theme/CodeEditor/hooks';
|
|
3
|
+
import Button, { Color } from '@theme/CodeEditor/Button';
|
|
4
4
|
import { translate } from '@docusaurus/Translate';
|
|
5
5
|
const ShowRaw = () => {
|
|
6
|
-
const
|
|
7
|
-
const showRaw =
|
|
8
|
-
return (<Button icon={showRaw ? 'EditCode' : 'Code'} onClick={() => store.
|
|
9
|
-
? translate({
|
|
10
|
-
|
|
6
|
+
const store = useStore();
|
|
7
|
+
const showRaw = useScript(store, 'showRaw');
|
|
8
|
+
return (<Button icon={showRaw ? 'EditCode' : 'Code'} onClick={() => store.setShowRaw(!showRaw)} color={showRaw ? Color.Primary : Color.Secondary} title={showRaw
|
|
9
|
+
? translate({
|
|
10
|
+
message: 'Show edited Code',
|
|
11
|
+
id: 'theme.CodeEditor.Actions.ShowCode.showEdited'
|
|
12
|
+
})
|
|
13
|
+
: translate({
|
|
14
|
+
message: 'Show initial code',
|
|
15
|
+
id: 'theme.CodeEditor.Actions.ShowCode.showRaw'
|
|
16
|
+
})}/>);
|
|
11
17
|
};
|
|
12
18
|
export default ShowRaw;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShowSyncStatus.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/Actions/ShowSyncStatus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,QAAA,MAAM,cAAc,yBAqCnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import Icon, { Color } from '
|
|
4
|
-
import { Status } from '
|
|
2
|
+
import { useStore, useScript } from '@theme/CodeEditor/hooks';
|
|
3
|
+
import Icon, { Color } from '@theme/CodeEditor/Icon';
|
|
4
|
+
import { Status } from '@theme/CodeEditor/WithScript/Types';
|
|
5
|
+
import BrowserOnly from '@docusaurus/BrowserOnly';
|
|
5
6
|
const ShowSyncStatus = () => {
|
|
6
|
-
const
|
|
7
|
-
const isLoaded =
|
|
8
|
-
const status =
|
|
7
|
+
const store = useStore();
|
|
8
|
+
const isLoaded = useScript(store, 'isLoaded');
|
|
9
|
+
const status = useScript(store, 'status');
|
|
9
10
|
React.useEffect(() => {
|
|
10
11
|
if (status !== Status.IDLE) {
|
|
11
12
|
const disposer = setTimeout(() => {
|
|
12
|
-
store.
|
|
13
|
+
store.setStatus(Status.IDLE);
|
|
13
14
|
}, 1200);
|
|
14
15
|
return () => clearTimeout(disposer);
|
|
15
16
|
}
|
|
16
17
|
}, [status, store]);
|
|
17
|
-
return (
|
|
18
|
-
{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
return (<BrowserOnly fallback={null}>
|
|
19
|
+
{() => {
|
|
20
|
+
return (<>
|
|
21
|
+
{!isLoaded && <Icon icon="Sync" spin size={'1.2em'} color={Color.Primary}/>}
|
|
22
|
+
<div style={{ flexGrow: 1, flexShrink: 1, flexBasis: 0 }}></div>
|
|
23
|
+
<span style={{ minWidth: '1em' }}>
|
|
24
|
+
{status === Status.SYNCING && (<Icon icon="Sync" spin size={'1.2em'} color={Color.Primary}/>)}
|
|
25
|
+
{status === Status.SUCCESS && (<Icon icon="Check" size={'1.2em'} color={Color.Success}/>)}
|
|
26
|
+
{status === Status.ERROR && (<Icon icon="Close" size={'1.2em'} color={Color.Danger}/>)}
|
|
27
|
+
</span>
|
|
28
|
+
</>);
|
|
29
|
+
}}
|
|
30
|
+
</BrowserOnly>);
|
|
26
31
|
};
|
|
27
32
|
export default ShowSyncStatus;
|