docusaurus-live-brython 3.0.0-beta.9 → 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.
Files changed (175) hide show
  1. package/.devcontainer/devcontainer.json +38 -0
  2. package/.prettierignore +17 -0
  3. package/.prettierrc +9 -8
  4. package/CHANGELOG.md +5 -0
  5. package/README.md +7 -4
  6. package/lib/assets/py_back_trace.py +2 -1
  7. package/lib/index.d.ts +1 -7
  8. package/lib/index.d.ts.map +1 -0
  9. package/lib/index.js +94 -16
  10. package/lib/options.d.ts +1 -0
  11. package/lib/options.d.ts.map +1 -0
  12. package/lib/options.js +2 -2
  13. package/lib/theme/CodeBlock/index.d.ts +3 -3
  14. package/lib/theme/CodeBlock/index.d.ts.map +1 -0
  15. package/lib/theme/CodeBlock/index.jsx +24 -14
  16. package/lib/theme/CodeEditor/Actions/DownloadCode.d.ts +1 -0
  17. package/lib/theme/CodeEditor/Actions/DownloadCode.d.ts.map +1 -0
  18. package/lib/theme/CodeEditor/Actions/DownloadCode.jsx +8 -8
  19. package/lib/theme/CodeEditor/Actions/Reset.d.ts +1 -0
  20. package/lib/theme/CodeEditor/Actions/Reset.d.ts.map +1 -0
  21. package/lib/theme/CodeEditor/Actions/Reset.jsx +5 -5
  22. package/lib/theme/CodeEditor/Actions/RunCode.d.ts +2 -1
  23. package/lib/theme/CodeEditor/Actions/RunCode.d.ts.map +1 -0
  24. package/lib/theme/CodeEditor/Actions/RunCode.jsx +4 -4
  25. package/lib/theme/CodeEditor/Actions/ShowRaw.d.ts +1 -0
  26. package/lib/theme/CodeEditor/Actions/ShowRaw.d.ts.map +1 -0
  27. package/lib/theme/CodeEditor/Actions/ShowRaw.jsx +13 -7
  28. package/lib/theme/CodeEditor/Actions/ShowSyncStatus.d.ts +1 -0
  29. package/lib/theme/CodeEditor/Actions/ShowSyncStatus.d.ts.map +1 -0
  30. package/lib/theme/CodeEditor/Actions/ShowSyncStatus.jsx +21 -16
  31. package/lib/theme/CodeEditor/Actions/styles.module.css +2 -3
  32. package/lib/theme/CodeEditor/BrythonCommunicator.d.ts +2 -1
  33. package/lib/theme/CodeEditor/BrythonCommunicator.d.ts.map +1 -0
  34. package/lib/theme/CodeEditor/BrythonCommunicator.jsx +13 -9
  35. package/lib/theme/CodeEditor/Button/index.d.ts +3 -2
  36. package/lib/theme/CodeEditor/Button/index.d.ts.map +1 -0
  37. package/lib/theme/CodeEditor/Button/index.jsx +1 -1
  38. package/lib/theme/CodeEditor/Button/styles.module.css +1 -1
  39. package/lib/theme/CodeEditor/CodeHistory/index.d.ts +1 -0
  40. package/lib/theme/CodeEditor/CodeHistory/index.d.ts.map +1 -0
  41. package/lib/theme/CodeEditor/CodeHistory/index.jsx +26 -15
  42. package/lib/theme/CodeEditor/CodeHistory/styles.module.css +31 -31
  43. package/lib/theme/CodeEditor/ContextEditor/index.d.ts +22 -0
  44. package/lib/theme/CodeEditor/ContextEditor/index.d.ts.map +1 -0
  45. package/lib/theme/CodeEditor/ContextEditor/index.jsx +36 -0
  46. package/lib/theme/CodeEditor/Editor/EditorAce.d.ts +2 -1
  47. package/lib/theme/CodeEditor/Editor/EditorAce.d.ts.map +1 -0
  48. package/lib/theme/CodeEditor/Editor/EditorAce.jsx +17 -14
  49. package/lib/theme/CodeEditor/Editor/Header/index.d.ts +2 -1
  50. package/lib/theme/CodeEditor/Editor/Header/index.d.ts.map +1 -0
  51. package/lib/theme/CodeEditor/Editor/Header/index.jsx +12 -12
  52. package/lib/theme/CodeEditor/Editor/Header/styles.module.css +7 -7
  53. package/lib/theme/CodeEditor/Editor/HiddenCode/index.d.ts +8 -0
  54. package/lib/theme/CodeEditor/Editor/HiddenCode/index.d.ts.map +1 -0
  55. package/lib/theme/CodeEditor/Editor/HiddenCode/index.jsx +27 -0
  56. package/lib/theme/CodeEditor/Editor/HiddenCode/styles.module.css +52 -0
  57. package/lib/theme/CodeEditor/Editor/Result/Graphics/Canvas.d.ts +1 -0
  58. package/lib/theme/CodeEditor/Editor/Result/Graphics/Canvas.d.ts.map +1 -0
  59. package/lib/theme/CodeEditor/Editor/Result/Graphics/Canvas.jsx +8 -9
  60. package/lib/theme/CodeEditor/Editor/Result/Graphics/Turtle.d.ts +1 -0
  61. package/lib/theme/CodeEditor/Editor/Result/Graphics/Turtle.d.ts.map +1 -0
  62. package/lib/theme/CodeEditor/Editor/Result/Graphics/Turtle.jsx +11 -11
  63. package/lib/theme/CodeEditor/Editor/Result/Graphics/index.d.ts +4 -3
  64. package/lib/theme/CodeEditor/Editor/Result/Graphics/index.d.ts.map +1 -0
  65. package/lib/theme/CodeEditor/Editor/Result/Graphics/index.jsx +12 -10
  66. package/lib/theme/CodeEditor/Editor/Result/Graphics/styles.module.css +2 -2
  67. package/lib/theme/CodeEditor/Editor/Result/index.d.ts +2 -3
  68. package/lib/theme/CodeEditor/Editor/Result/index.d.ts.map +1 -0
  69. package/lib/theme/CodeEditor/Editor/Result/index.jsx +6 -9
  70. package/lib/theme/CodeEditor/Editor/Result/styles.module.css +15 -10
  71. package/lib/theme/CodeEditor/Editor/index.d.ts +6 -3
  72. package/lib/theme/CodeEditor/Editor/index.d.ts.map +1 -0
  73. package/lib/theme/CodeEditor/Editor/index.jsx +34 -28
  74. package/lib/theme/CodeEditor/Editor/styles.module.css +15 -7
  75. package/lib/theme/CodeEditor/Editor/utils/checkForButtonClick.d.ts +1 -0
  76. package/lib/theme/CodeEditor/Editor/utils/checkForButtonClick.d.ts.map +1 -0
  77. package/lib/theme/CodeEditor/Editor/utils/saveSvg.d.ts +1 -0
  78. package/lib/theme/CodeEditor/Editor/utils/saveSvg.d.ts.map +1 -0
  79. package/lib/theme/CodeEditor/Editor/utils/saveSvg.js +19 -8
  80. package/lib/theme/CodeEditor/Editor/utils/svgWithoutAnimations.d.ts +1 -0
  81. package/lib/theme/CodeEditor/Editor/utils/svgWithoutAnimations.d.ts.map +1 -0
  82. package/lib/theme/CodeEditor/Editor/utils/svgWithoutAnimations.js +43 -49
  83. package/lib/theme/CodeEditor/Icon/icons.d.ts +4 -1
  84. package/lib/theme/CodeEditor/Icon/icons.d.ts.map +1 -0
  85. package/lib/theme/CodeEditor/Icon/icons.js +3 -1
  86. package/lib/theme/CodeEditor/Icon/index.d.ts +4 -2
  87. package/lib/theme/CodeEditor/Icon/index.d.ts.map +1 -0
  88. package/lib/theme/CodeEditor/Icon/index.jsx +10 -3
  89. package/lib/theme/CodeEditor/Icon/styles.module.css +1 -1
  90. package/lib/theme/CodeEditor/WithScript/ScriptContext.d.ts +8 -0
  91. package/lib/theme/CodeEditor/WithScript/ScriptContext.d.ts.map +1 -0
  92. package/lib/theme/CodeEditor/WithScript/ScriptContext.jsx +27 -0
  93. package/lib/theme/CodeEditor/WithScript/Storage.d.ts +2 -1
  94. package/lib/theme/CodeEditor/WithScript/Storage.d.ts.map +1 -0
  95. package/lib/theme/CodeEditor/WithScript/Types.d.ts +12 -4
  96. package/lib/theme/CodeEditor/WithScript/Types.d.ts.map +1 -0
  97. package/lib/theme/CodeEditor/WithScript/bryRunner.d.ts +3 -0
  98. package/lib/theme/CodeEditor/WithScript/bryRunner.d.ts.map +1 -0
  99. package/lib/theme/CodeEditor/WithScript/bryRunner.js +29 -0
  100. package/lib/theme/CodeEditor/WithScript/createStore.d.ts +4 -0
  101. package/lib/theme/CodeEditor/WithScript/createStore.d.ts.map +1 -0
  102. package/lib/theme/CodeEditor/WithScript/{Store.jsx → createStore.js} +62 -74
  103. package/lib/theme/CodeEditor/WithScript/helpers.d.ts +1 -4
  104. package/lib/theme/CodeEditor/WithScript/helpers.d.ts.map +1 -0
  105. package/lib/theme/CodeEditor/WithScript/helpers.js +4 -14
  106. package/lib/theme/CodeEditor/constants.d.ts +1 -0
  107. package/lib/theme/CodeEditor/constants.d.ts.map +1 -0
  108. package/lib/theme/CodeEditor/hooks/index.d.ts +3 -0
  109. package/lib/theme/CodeEditor/hooks/index.d.ts.map +1 -0
  110. package/lib/theme/CodeEditor/hooks/index.js +2 -0
  111. package/lib/theme/CodeEditor/hooks/useScript.d.ts +3 -0
  112. package/lib/theme/CodeEditor/hooks/useScript.d.ts.map +1 -0
  113. package/lib/theme/CodeEditor/hooks/useScript.js +4 -0
  114. package/lib/theme/CodeEditor/hooks/useStore.d.ts +3 -0
  115. package/lib/theme/CodeEditor/hooks/useStore.d.ts.map +1 -0
  116. package/lib/theme/CodeEditor/hooks/useStore.js +10 -0
  117. package/lib/theme/CodeEditor/index.d.ts +24 -5
  118. package/lib/theme/CodeEditor/index.d.ts.map +1 -0
  119. package/lib/theme/CodeEditor/index.jsx +17 -16
  120. package/lib/theme/CodeEditor/styles.module.css +28 -30
  121. package/og-image.md +23 -0
  122. package/package.json +35 -20
  123. package/src/assets/py_back_trace.py +2 -1
  124. package/src/index.ts +96 -25
  125. package/src/options.ts +12 -12
  126. package/src/theme/CodeBlock/index.tsx +44 -68
  127. package/src/theme/CodeEditor/Actions/DownloadCode.tsx +23 -22
  128. package/src/theme/CodeEditor/Actions/Reset.tsx +14 -12
  129. package/src/theme/CodeEditor/Actions/RunCode.tsx +14 -11
  130. package/src/theme/CodeEditor/Actions/ShowRaw.tsx +17 -11
  131. package/src/theme/CodeEditor/Actions/ShowSyncStatus.tsx +32 -27
  132. package/src/theme/CodeEditor/Actions/styles.module.css +2 -3
  133. package/src/theme/CodeEditor/BrythonCommunicator.tsx +16 -19
  134. package/src/theme/CodeEditor/Button/index.tsx +17 -13
  135. package/src/theme/CodeEditor/Button/styles.module.css +1 -1
  136. package/src/theme/CodeEditor/CodeHistory/index.tsx +32 -20
  137. package/src/theme/CodeEditor/CodeHistory/styles.module.css +31 -31
  138. package/src/theme/CodeEditor/ContextEditor/index.tsx +74 -0
  139. package/src/theme/CodeEditor/Editor/EditorAce.tsx +20 -16
  140. package/src/theme/CodeEditor/Editor/Header/index.tsx +13 -19
  141. package/src/theme/CodeEditor/Editor/Header/styles.module.css +7 -7
  142. package/src/theme/CodeEditor/Editor/HiddenCode/index.tsx +49 -0
  143. package/src/theme/CodeEditor/Editor/HiddenCode/styles.module.css +52 -0
  144. package/src/theme/CodeEditor/Editor/Result/Graphics/Canvas.tsx +25 -22
  145. package/src/theme/CodeEditor/Editor/Result/Graphics/Turtle.tsx +23 -19
  146. package/src/theme/CodeEditor/Editor/Result/Graphics/index.tsx +16 -16
  147. package/src/theme/CodeEditor/Editor/Result/Graphics/styles.module.css +2 -2
  148. package/src/theme/CodeEditor/Editor/Result/index.tsx +7 -13
  149. package/src/theme/CodeEditor/Editor/Result/styles.module.css +15 -10
  150. package/src/theme/CodeEditor/Editor/index.tsx +67 -65
  151. package/src/theme/CodeEditor/Editor/styles.module.css +15 -7
  152. package/src/theme/CodeEditor/Editor/utils/checkForButtonClick.ts +5 -5
  153. package/src/theme/CodeEditor/Editor/utils/saveSvg.ts +63 -53
  154. package/src/theme/CodeEditor/Editor/utils/svgWithoutAnimations.ts +182 -201
  155. package/src/theme/CodeEditor/Icon/icons.ts +27 -13
  156. package/src/theme/CodeEditor/Icon/index.tsx +31 -11
  157. package/src/theme/CodeEditor/Icon/styles.module.css +1 -1
  158. package/src/theme/CodeEditor/WithScript/ScriptContext.tsx +36 -0
  159. package/src/theme/CodeEditor/WithScript/Storage.ts +3 -3
  160. package/src/theme/CodeEditor/WithScript/Types.ts +17 -11
  161. package/src/theme/CodeEditor/WithScript/bryRunner.ts +39 -0
  162. package/src/theme/CodeEditor/WithScript/createStore.ts +276 -0
  163. package/src/theme/CodeEditor/WithScript/helpers.ts +16 -26
  164. package/src/theme/CodeEditor/constants.ts +9 -11
  165. package/src/theme/CodeEditor/hooks/index.ts +2 -0
  166. package/src/theme/CodeEditor/hooks/useScript.ts +9 -0
  167. package/src/theme/CodeEditor/hooks/useStore.ts +15 -0
  168. package/src/theme/CodeEditor/index.tsx +45 -31
  169. package/src/theme/CodeEditor/styles.module.css +28 -30
  170. package/src/typings.d.ts +11 -0
  171. package/lib/theme/CodeEditor/WithScript/Store.d.ts +0 -15
  172. package/lib/types.d.ts +0 -28
  173. package/lib/types.js +0 -1
  174. package/src/theme/CodeEditor/WithScript/Store.tsx +0 -294
  175. 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
+ }
@@ -0,0 +1,17 @@
1
+ dist
2
+ node_modules
3
+ .yarn
4
+ build
5
+ coverage
6
+ .docusaurus
7
+ .github
8
+ .drone.yml
9
+
10
+ docs
11
+ static
12
+
13
+ *.md
14
+ *.json
15
+ *.js
16
+ *.compose.yml
17
+ i18n
package/.prettierrc CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
- "arrowParens": "always",
3
- "bracketSpacing": false,
4
- "bracketSameLine": true,
5
- "printWidth": 80,
6
- "proseWrap": "never",
7
- "singleQuote": true,
8
- "trailingComma": "all"
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
- ![NPM Version](https://img.shields.io/npm/v/docusaurus-live-brython)
3
+ [![NPM Version](https://img.shields.io/npm/v/docusaurus-live-brython)](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
- + brython_src: 'https://cdn.jsdelivr.net/npm/brython@3.12.4/brython.min.js', // default
45
- + brython_stdlib_src: 'https://cdn.jsdelivr.net/npm/brython@3.12.4/brython_stdlib.js' // default
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
- if (!options.skipCopyAssetsToLibDir) {
22
- const staticDir = path.join(context.siteDir, context.siteConfig.staticDirectories[0], libDir);
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
- const assets = fs.readdirSync(path.join(__dirname, 'assets'));
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 libDir = (options.libDir || DEFAULT_LIB_DIR).replace(/(\/|\\)/g, '');
39
- setGlobalData({ libDir: `${context.baseUrl}${libDir}/`, syncMaxOnceEvery: options.syncMaxOnceEvery || DEFAULT_OPTIONS.syncMaxOnceEvery });
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: "anonymous",
67
- referrerpolicy: "no-referrer",
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: "anonymous",
76
- referrerpolicy: "no-referrer",
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://raw.githack.com/brython-dev/brython/master/www/src/brython.js',
10
- brythonStdlibSrc: 'https://raw.githack.com/brython-dev/brython/master/www/src/brython_stdlib.js',
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
- /// <reference types="react" />
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): JSX.Element;
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 ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
4
- import CodeEditor from 'docusaurus-live-brython/theme/CodeEditor';
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.replace(/--/g, '<<HYPHEN>>').replace(/__/g, '<<UNDERSCORE>>').replace(/[-_]/g, ' ').replace(/<<UNDERSCORE>>/g, '_').replace(/<<HYPHEN>>/g, '-');
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' ? true
21
- : value === 'false' ? false
22
- : !Number.isNaN(Number(value)) ? Number(value)
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 && ExecutionEnvironment.canUseDOM) {
45
+ if (metaProps.live_py) {
39
46
  const title = props.title || metaProps.title;
40
- const rawcode = (props.children || '').replace(/\s*\n$/, '');
41
- let code = rawcode;
42
- return (<ScriptContext id={metaProps.id} lang={lang} title={title} raw={rawcode} readonly={!!metaProps.readonly} versioned={!!metaProps.versioned}>
43
- <CodeEditor {...props} {...metaProps} maxLines={metaProps.maxLines && Number.parseInt(metaProps.maxLines, 10)} readonly={!!metaProps.readonly} resettable={!metaProps.noReset} download={!metaProps.versioned && !metaProps.noDownload} slim={!!metaProps.slim} showLineNumbers={!(!!metaProps.slim && !/\n/.test(code))} versioned={!!metaProps.versioned} noHistory={!!metaProps.noHistory} noCompare={!!metaProps.noCompare} title={sanitizedTitle(title) || lang}/>
44
- </ScriptContext>);
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 (<CodeBlock {...props}/>);
56
+ return <CodeBlock {...props}/>;
47
57
  }
@@ -3,3 +3,4 @@ declare const DownloadCode: (props: {
3
3
  title: string;
4
4
  }) => React.JSX.Element;
5
5
  export default DownloadCode;
6
+ //# sourceMappingURL=DownloadCode.d.ts.map
@@ -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 { useScript, useStore } from 'docusaurus-live-brython/theme/CodeEditor/WithScript/Store';
3
- import Button from 'docusaurus-live-brython/theme/CodeEditor/Button';
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 { store } = useScript();
7
- const code = useStore(store, (state) => state.code);
8
- const lang = useStore(store, (state) => state.lang);
9
- const id = useStore(store, (state) => state.id);
10
- return (<Button icon='Download' onClick={() => {
11
- const downloadLink = document.createElement("a");
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}`;
@@ -1,3 +1,4 @@
1
1
  import * as React from 'react';
2
2
  declare const Reset: () => React.JSX.Element;
3
3
  export default Reset;
4
+ //# sourceMappingURL=Reset.d.ts.map
@@ -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 { useScript, useStore } from 'docusaurus-live-brython/theme/CodeEditor/WithScript/Store';
3
- import Button from 'docusaurus-live-brython/theme/CodeEditor/Button';
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 { store } = useScript();
7
- const pristine = useStore(store, (state) => state.pristineCode);
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;
@@ -1,7 +1,8 @@
1
1
  import * as React from 'react';
2
- interface Props {
2
+ export interface Props {
3
3
  title: string;
4
4
  slim: boolean;
5
5
  }
6
6
  declare const RunCode: (props: Props) => React.JSX.Element;
7
7
  export default RunCode;
8
+ //# sourceMappingURL=RunCode.d.ts.map
@@ -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 { useScript, useStore } from 'docusaurus-live-brython/theme/CodeEditor/WithScript/Store';
3
- import Button, { Color } from 'docusaurus-live-brython/theme/CodeEditor/Button';
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 { store } = useScript();
9
- const isExecuting = useStore(store, (state) => state.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({
@@ -1,3 +1,4 @@
1
1
  import * as React from 'react';
2
2
  declare const ShowRaw: () => React.JSX.Element;
3
3
  export default ShowRaw;
4
+ //# sourceMappingURL=ShowRaw.d.ts.map
@@ -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 { useScript, useStore } from 'docusaurus-live-brython/theme/CodeEditor/WithScript/Store';
3
- import Button, { Color } from 'docusaurus-live-brython/theme/CodeEditor/Button';
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 { store } = useScript();
7
- const showRaw = useStore(store, (state) => state.showRaw);
8
- return (<Button icon={showRaw ? 'EditCode' : 'Code'} onClick={() => store.setState((state) => ({ ...state, showRaw: !showRaw }))} color={showRaw ? Color.Primary : Color.Secondary} title={showRaw
9
- ? translate({ message: 'Show edited Code', id: 'theme.CodeEditor.Actions.ShowCode.showEdited' })
10
- : translate({ message: 'Show initial code', id: 'theme.CodeEditor.Actions.ShowCode.showRaw' })}/>);
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;
@@ -1,3 +1,4 @@
1
1
  import * as React from 'react';
2
2
  declare const ShowSyncStatus: () => React.JSX.Element;
3
3
  export default ShowSyncStatus;
4
+ //# sourceMappingURL=ShowSyncStatus.d.ts.map
@@ -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 { useScript, useStore } from 'docusaurus-live-brython/theme/CodeEditor/WithScript/Store';
3
- import Icon, { Color } from 'docusaurus-live-brython/theme/CodeEditor/Icon';
4
- import { Status } from 'docusaurus-live-brython/theme/CodeEditor/WithScript/Types';
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 { store } = useScript();
7
- const isLoaded = useStore(store, (state) => state.isLoaded);
8
- const status = useStore(store, (state) => state.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.setState((state) => ({ ...state, status: Status.IDLE }));
13
+ store.setStatus(Status.IDLE);
13
14
  }, 1200);
14
15
  return () => clearTimeout(disposer);
15
16
  }
16
17
  }, [status, store]);
17
- return (<>
18
- {!isLoaded && (<Icon icon='Sync' spin size={'1.2em'} color={Color.Primary}/>)}
19
- <div style={{ flexGrow: 1, flexShrink: 1, flexBasis: 0 }}></div>
20
- <span style={{ minWidth: '1em' }}>
21
- {status === Status.SYNCING && (<Icon icon='Sync' spin size={'1.2em'} color={Color.Primary}/>)}
22
- {status === Status.SUCCESS && (<Icon icon='Check' size={'1.2em'} color={Color.Success}/>)}
23
- {status === Status.ERROR && (<Icon icon='Close' size={'1.2em'} color={Color.Danger}/>)}
24
- </span>
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;