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
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import React, { useCallback } from "react";
|
|
2
|
-
import { useSyncExternalStore } from "react";
|
|
3
1
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
2
|
+
import { createStorageSlot } from '@docusaurus/theme-common';
|
|
3
|
+
import { getStorageScript, syncStorageScript } from '@theme/CodeEditor/WithScript/Storage';
|
|
4
|
+
import { checkCanvasOutput, checkGraphicsOutput, checkTurtleOutput } from '@theme/CodeEditor/WithScript/helpers';
|
|
5
|
+
import { Status } from '@theme/CodeEditor/WithScript/Types';
|
|
6
|
+
import { DOM_ELEMENT_IDS } from '@theme/CodeEditor/constants';
|
|
8
7
|
import throttle from 'lodash/throttle';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
export const createStore = (props, libDir, syncMaxOnceEvery) => {
|
|
8
|
+
import { runCode } from '@theme/CodeEditor/WithScript/bryRunner';
|
|
9
|
+
export const createStore = (props, libDir, syncMaxOnceEvery, router) => {
|
|
12
10
|
const canSave = !!props.id;
|
|
13
11
|
const id = props.id || uuidv4();
|
|
14
12
|
const codeId = `code.${props.title || props.lang}.${id}`.replace(/(-|\.)/g, '_');
|
|
@@ -48,27 +46,34 @@ export const createStore = (props, libDir, syncMaxOnceEvery) => {
|
|
|
48
46
|
return Status.SUCCESS;
|
|
49
47
|
}
|
|
50
48
|
if (script) {
|
|
51
|
-
setState((s) => ({
|
|
49
|
+
setState((s) => ({
|
|
50
|
+
...s,
|
|
51
|
+
...script,
|
|
52
|
+
...loadedCode,
|
|
53
|
+
status: canSave ? Status.SUCCESS : s.status,
|
|
54
|
+
versionsLoaded: true
|
|
55
|
+
}));
|
|
52
56
|
return Status.SUCCESS;
|
|
53
57
|
}
|
|
54
58
|
setState((s) => ({ ...s, status: canSave ? Status.ERROR : s.status }));
|
|
55
59
|
return Status.ERROR;
|
|
56
60
|
};
|
|
57
|
-
const prepareCode = (
|
|
58
|
-
const
|
|
59
|
-
? { pre: getPreCode(state.pristineCode).pre, code: raw }
|
|
60
|
-
: getPreCode(raw);
|
|
61
|
-
const hasEdits = code !== (config.stateNotInitialized ? getPreCode(props.raw).code : state.pristineCode);
|
|
61
|
+
const prepareCode = (code, config = {}) => {
|
|
62
|
+
const hasEdits = code !== (config.stateNotInitialized ? code : state.pristineCode);
|
|
62
63
|
const updatedAt = new Date();
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
const
|
|
64
|
+
const allCode = `${props.preCode}\n${code}\n${props.postCode}`;
|
|
65
|
+
const hasCanvasOutput = checkCanvasOutput(allCode);
|
|
66
|
+
const hasTurtleOutput = checkTurtleOutput(allCode);
|
|
67
|
+
const hasGraphicsOutput = checkGraphicsOutput(allCode);
|
|
66
68
|
if (props.versioned && !config.stateNotInitialized) {
|
|
67
|
-
addVersion({
|
|
69
|
+
addVersion({
|
|
70
|
+
code: code,
|
|
71
|
+
createdAt: updatedAt,
|
|
72
|
+
version: state.versions.length + 1
|
|
73
|
+
});
|
|
68
74
|
}
|
|
69
75
|
return {
|
|
70
76
|
code: code,
|
|
71
|
-
preCode: pre,
|
|
72
77
|
hasCanvasOutput: hasCanvasOutput,
|
|
73
78
|
hasTurtleOutput: hasTurtleOutput,
|
|
74
79
|
hasGraphicsOutput: hasGraphicsOutput,
|
|
@@ -86,7 +91,12 @@ export const createStore = (props, libDir, syncMaxOnceEvery) => {
|
|
|
86
91
|
...data
|
|
87
92
|
}));
|
|
88
93
|
if (props.id) {
|
|
89
|
-
const toStore = {
|
|
94
|
+
const toStore = {
|
|
95
|
+
code: data.code,
|
|
96
|
+
createdAt: state.createdAt,
|
|
97
|
+
updatedAt: data.updatedAt,
|
|
98
|
+
versions: state.versions
|
|
99
|
+
};
|
|
90
100
|
if (state.isPasted) {
|
|
91
101
|
addVersion.flush();
|
|
92
102
|
if (toStore.versions.length > 0) {
|
|
@@ -102,27 +112,12 @@ export const createStore = (props, libDir, syncMaxOnceEvery) => {
|
|
|
102
112
|
}
|
|
103
113
|
};
|
|
104
114
|
const execScript = () => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
alert('Brython not loaded');
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
setState((s) => ({ ...s, isExecuting: true, isGraphicsmodalOpen: state.hasGraphicsOutput }));
|
|
115
|
-
const active = document.getElementById(DOM_ELEMENT_IDS.communicator(state.codeId));
|
|
116
|
-
active.setAttribute('data--start-time', `${Date.now()}`);
|
|
117
|
-
/**
|
|
118
|
-
* ensure that the script is executed after the current event loop.
|
|
119
|
-
* Otherwise, the brython script will not be able to access the graphics output.
|
|
120
|
-
*/
|
|
121
|
-
setTimeout(() => {
|
|
122
|
-
window.__BRYTHON__.runPythonSource(src, {
|
|
123
|
-
pythonpath: [libDir]
|
|
124
|
-
});
|
|
125
|
-
}, 0);
|
|
115
|
+
setState((s) => ({
|
|
116
|
+
...s,
|
|
117
|
+
isExecuting: true,
|
|
118
|
+
graphicsModalExecutionNr: state.hasGraphicsOutput ? state.graphicsModalExecutionNr + 1 : 0
|
|
119
|
+
}));
|
|
120
|
+
runCode(state.code, state.preCode, state.postCode, codeId, libDir, router);
|
|
126
121
|
};
|
|
127
122
|
const load = async () => {
|
|
128
123
|
return loadData(storage);
|
|
@@ -136,7 +131,13 @@ run("""${sanitizePyScript(toExec || '')}""", '${codeId}', ${lineShift})
|
|
|
136
131
|
setState((s) => ({ ...s, status: canSave ? Status.ERROR : s.status }));
|
|
137
132
|
return Status.ERROR;
|
|
138
133
|
};
|
|
139
|
-
const
|
|
134
|
+
const setIsPasted = (isPasted) => {
|
|
135
|
+
setState((s) => ({ ...s, isPasted: isPasted }));
|
|
136
|
+
};
|
|
137
|
+
const set = throttle(_set, syncMaxOnceEvery, {
|
|
138
|
+
leading: false,
|
|
139
|
+
trailing: true
|
|
140
|
+
});
|
|
140
141
|
const _addVersion = (version) => {
|
|
141
142
|
if (!props.versioned || !props.id) {
|
|
142
143
|
return;
|
|
@@ -145,7 +146,10 @@ run("""${sanitizePyScript(toExec || '')}""", '${codeId}', ${lineShift})
|
|
|
145
146
|
versions.push(version);
|
|
146
147
|
setState((s) => ({ ...s, versions: versions }));
|
|
147
148
|
};
|
|
148
|
-
const addVersion = throttle(_addVersion, syncMaxOnceEvery, {
|
|
149
|
+
const addVersion = throttle(_addVersion, syncMaxOnceEvery, {
|
|
150
|
+
leading: false,
|
|
151
|
+
trailing: true
|
|
152
|
+
});
|
|
149
153
|
const saveNow = async () => {
|
|
150
154
|
addVersion.flush();
|
|
151
155
|
return set.flush();
|
|
@@ -154,7 +158,7 @@ run("""${sanitizePyScript(toExec || '')}""", '${codeId}', ${lineShift})
|
|
|
154
158
|
storage.del();
|
|
155
159
|
return Status.SUCCESS;
|
|
156
160
|
};
|
|
157
|
-
const codeData = prepareCode(props.
|
|
161
|
+
const codeData = prepareCode(props.code, { stateNotInitialized: true });
|
|
158
162
|
const setExecuting = (isExecuting) => {
|
|
159
163
|
setState((s) => ({ ...s, isExecuting: isExecuting }));
|
|
160
164
|
};
|
|
@@ -165,7 +169,7 @@ run("""${sanitizePyScript(toExec || '')}""", '${codeId}', ${lineShift})
|
|
|
165
169
|
setState((s) => ({ ...s, logs: [] }));
|
|
166
170
|
};
|
|
167
171
|
const closeGraphicsModal = () => {
|
|
168
|
-
setState((s) => ({ ...s,
|
|
172
|
+
setState((s) => ({ ...s, graphicsModalExecutionNr: 0 }));
|
|
169
173
|
};
|
|
170
174
|
const stopScript = () => {
|
|
171
175
|
const code = document.getElementById(DOM_ELEMENT_IDS.communicator(state.codeId));
|
|
@@ -181,7 +185,7 @@ run("""${sanitizePyScript(toExec || '')}""", '${codeId}', ${lineShift})
|
|
|
181
185
|
pristineCode: codeData.code,
|
|
182
186
|
isExecuting: false,
|
|
183
187
|
logs: [],
|
|
184
|
-
|
|
188
|
+
graphicsModalExecutionNr: 0,
|
|
185
189
|
hasEdits: false,
|
|
186
190
|
createdAt: createdAt,
|
|
187
191
|
isLoaded: false,
|
|
@@ -189,6 +193,8 @@ run("""${sanitizePyScript(toExec || '')}""", '${codeId}', ${lineShift})
|
|
|
189
193
|
versions: [],
|
|
190
194
|
versionsLoaded: false,
|
|
191
195
|
isPasted: false,
|
|
196
|
+
preCode: props.preCode,
|
|
197
|
+
postCode: props.postCode,
|
|
192
198
|
...codeData
|
|
193
199
|
};
|
|
194
200
|
const getState = () => state;
|
|
@@ -208,6 +214,12 @@ run("""${sanitizePyScript(toExec || '')}""", '${codeId}', ${lineShift})
|
|
|
208
214
|
setState((s) => ({ ...s, versionsLoaded: true }));
|
|
209
215
|
return Promise.resolve();
|
|
210
216
|
};
|
|
217
|
+
const setShowRaw = (showRaw) => {
|
|
218
|
+
setState((s) => ({ ...s, showRaw: showRaw }));
|
|
219
|
+
};
|
|
220
|
+
const setStatus = (status) => {
|
|
221
|
+
setState((s) => ({ ...s, status: status }));
|
|
222
|
+
};
|
|
211
223
|
return {
|
|
212
224
|
getState,
|
|
213
225
|
setState,
|
|
@@ -221,33 +233,9 @@ run("""${sanitizePyScript(toExec || '')}""", '${codeId}', ${lineShift})
|
|
|
221
233
|
setExecuting,
|
|
222
234
|
stopScript,
|
|
223
235
|
load,
|
|
236
|
+
setIsPasted,
|
|
237
|
+
setShowRaw,
|
|
238
|
+
setStatus,
|
|
224
239
|
loadVersions
|
|
225
240
|
};
|
|
226
241
|
};
|
|
227
|
-
export const useStore = (store, selector) => {
|
|
228
|
-
return useSyncExternalStore(store.subscribe, useCallback(() => selector(store.getState()), [store, selector]));
|
|
229
|
-
};
|
|
230
|
-
export const Context = React.createContext(undefined);
|
|
231
|
-
const ScriptContext = (props) => {
|
|
232
|
-
const { libDir, syncMaxOnceEvery } = usePluginData('docusaurus-live-brython');
|
|
233
|
-
const [store, setStore] = React.useState(null);
|
|
234
|
-
React.useEffect(() => {
|
|
235
|
-
const store = createStore(props, libDir, syncMaxOnceEvery);
|
|
236
|
-
setStore(store);
|
|
237
|
-
store.load();
|
|
238
|
-
}, [props.id, libDir]);
|
|
239
|
-
if (!store) {
|
|
240
|
-
return <div>Load</div>;
|
|
241
|
-
}
|
|
242
|
-
return (<Context.Provider value={{ store: store }}>
|
|
243
|
-
{props.children}
|
|
244
|
-
</Context.Provider>);
|
|
245
|
-
};
|
|
246
|
-
export function useScript() {
|
|
247
|
-
const context = React.useContext(Context);
|
|
248
|
-
if (context === null) {
|
|
249
|
-
throw new ReactContextError('ScriptContextProvider', 'The Component must be a child of the CodeContextProvider component');
|
|
250
|
-
}
|
|
251
|
-
return context;
|
|
252
|
-
}
|
|
253
|
-
export default ScriptContext;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
export declare const checkGraphicsOutput: (raw: string) => boolean;
|
|
2
2
|
export declare const checkTurtleOutput: (raw: string) => boolean;
|
|
3
3
|
export declare const checkCanvasOutput: (raw: string) => boolean;
|
|
4
|
-
export declare const getPreCode: (rawcode: string) => {
|
|
5
|
-
pre: string;
|
|
6
|
-
code: string;
|
|
7
|
-
};
|
|
8
4
|
/**
|
|
9
5
|
* The python script is transformed to a string by embedding it with """ characters.
|
|
10
6
|
* So we must prevent the script itself to contain this sequence of characters.
|
|
11
7
|
* @param {String} script
|
|
12
8
|
*/
|
|
13
9
|
export declare const sanitizePyScript: (script: string) => string;
|
|
10
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/WithScript/helpers.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,mBAAmB,GAAI,KAAK,MAAM,KAAG,OAOjD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,KAAG,OAE/C,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,KAAG,OAE/C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,WAE9C,CAAC"}
|
|
@@ -3,7 +3,10 @@ const GRID_IMPORTS_TESTER = /(^from grid import)|(^import grid)/m;
|
|
|
3
3
|
const GRAPHICS_OUTPUT_TESTER = /^(SETUP_)?GRAPHICS_OUTPUT\s*=\s*(True|1)/m;
|
|
4
4
|
const CANVAS_OUTPUT_TESTER = /^(SETUP_)?CANVAS_OUTPUT\s*=\s*(True|1)/m;
|
|
5
5
|
export const checkGraphicsOutput = (raw) => {
|
|
6
|
-
return CANVAS_OUTPUT_TESTER.test(raw) ||
|
|
6
|
+
return (CANVAS_OUTPUT_TESTER.test(raw) ||
|
|
7
|
+
GRAPHICS_OUTPUT_TESTER.test(raw) ||
|
|
8
|
+
TURTLE_IMPORTS_TESTER.test(raw) ||
|
|
9
|
+
GRID_IMPORTS_TESTER.test(raw));
|
|
7
10
|
};
|
|
8
11
|
export const checkTurtleOutput = (raw) => {
|
|
9
12
|
return TURTLE_IMPORTS_TESTER.test(raw);
|
|
@@ -11,19 +14,6 @@ export const checkTurtleOutput = (raw) => {
|
|
|
11
14
|
export const checkCanvasOutput = (raw) => {
|
|
12
15
|
return CANVAS_OUTPUT_TESTER.test(raw) || GRID_IMPORTS_TESTER.test(raw);
|
|
13
16
|
};
|
|
14
|
-
export const getPreCode = (rawcode) => {
|
|
15
|
-
const match = rawcode.match(/\n###\s*PRE.*?\n/);
|
|
16
|
-
if (match) {
|
|
17
|
-
return {
|
|
18
|
-
pre: rawcode.slice(0, match.index || 0),
|
|
19
|
-
code: rawcode.slice((match.index || 0) + match[0].length)
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
return {
|
|
23
|
-
pre: '',
|
|
24
|
-
code: rawcode
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
17
|
/**
|
|
28
18
|
* The python script is transformed to a string by embedding it with """ characters.
|
|
29
19
|
* So we must prevent the script itself to contain this sequence of characters.
|
|
@@ -14,3 +14,4 @@ declare const GRID_IMPORTS_TESTER: RegExp;
|
|
|
14
14
|
declare const GRAPHICS_OUTPUT_TESTER: RegExp;
|
|
15
15
|
declare const CANVAS_OUTPUT_TESTER: RegExp;
|
|
16
16
|
export { DOM_ELEMENT_IDS, BRYTHON_NOTIFICATION_EVENT, CLOSE_TURTLE_MODAL_EVENT, TURTLE_IMPORTS_TESTER, GRAPHICS_OUTPUT_TESTER, CANVAS_OUTPUT_TESTER, GRID_IMPORTS_TESTER, TURTLE3D_IMPORTS_TESTER };
|
|
17
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/theme/CodeEditor/constants.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,eAAe;2BACM,MAAM;6BACJ,MAAM;wBACX,MAAM;wBACN,MAAM;iCACG,MAAM;8BACT,MAAM;CACnC,CAAC;AAEF,QAAA,MAAM,0BAA0B,eAAe,CAAC;AAChD,QAAA,MAAM,wBAAwB,uBAAuB,CAAC;AACtD,QAAA,MAAM,qBAAqB,QAA4C,CAAC;AACxE,QAAA,MAAM,uBAAuB,QAAgD,CAAC;AAC9E,QAAA,MAAM,mBAAmB,QAAwC,CAAC;AAClE,QAAA,MAAM,sBAAsB,QAA8C,CAAC;AAC3E,QAAA,MAAM,oBAAoB,QAA4C,CAAC;AAEvE,OAAO,EACH,eAAe,EACf,0BAA0B,EAC1B,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,SAAS,IAAI,SAAS,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScript.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/hooks/useScript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAG1F,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,MAAM,EAAE,OAAO,QAAQ,EAAE,UAAU,CAAC,KAAG,MAAM,CAAC,CAAC,CAKxF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStore.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/hooks/useStore.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAInE,wBAAgB,QAAQ,IAAI,QAAQ,CASnC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Context } from '@theme/CodeEditor/WithScript/ScriptContext';
|
|
2
|
+
import { ReactContextError } from '@docusaurus/theme-common';
|
|
3
|
+
import { useContext } from 'react';
|
|
4
|
+
export function useStore() {
|
|
5
|
+
const context = useContext(Context);
|
|
6
|
+
if (context === null) {
|
|
7
|
+
throw new ReactContextError('ScriptContextProvider', 'The Component must be a child of the ScriptContextProvider component');
|
|
8
|
+
}
|
|
9
|
+
return context;
|
|
10
|
+
}
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
interface
|
|
2
|
+
export interface MetaProps {
|
|
3
|
+
reference?: boolean;
|
|
4
|
+
live_jsx?: boolean;
|
|
5
|
+
live_py?: boolean;
|
|
6
|
+
id?: string;
|
|
7
|
+
slim?: boolean;
|
|
8
|
+
readonly?: boolean;
|
|
9
|
+
noReset?: boolean;
|
|
10
|
+
noDownload?: boolean;
|
|
11
|
+
versioned?: boolean;
|
|
12
|
+
noHistory?: boolean;
|
|
13
|
+
noCompare?: boolean;
|
|
14
|
+
maxLines?: string;
|
|
15
|
+
title?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface Props {
|
|
3
18
|
slim: boolean;
|
|
4
19
|
readonly: boolean;
|
|
5
|
-
children: React.ReactNode;
|
|
6
20
|
noCompare: boolean;
|
|
7
21
|
title: string;
|
|
8
22
|
versioned: boolean;
|
|
@@ -10,9 +24,14 @@ interface Props {
|
|
|
10
24
|
download: boolean;
|
|
11
25
|
showLineNumbers: boolean;
|
|
12
26
|
lang: string;
|
|
13
|
-
|
|
27
|
+
preCode: string;
|
|
28
|
+
postCode: string;
|
|
29
|
+
code: string;
|
|
14
30
|
maxLines?: number;
|
|
15
31
|
noHistory: boolean;
|
|
32
|
+
className?: string;
|
|
33
|
+
onChange?: (code: string) => void;
|
|
16
34
|
}
|
|
17
|
-
declare const
|
|
18
|
-
export default
|
|
35
|
+
declare const CodeEditor: (props: Props) => React.JSX.Element;
|
|
36
|
+
export default CodeEditor;
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme/CodeEditor/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,MAAM,WAAW,SAAS;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,KAAK;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,QAAA,MAAM,UAAU,GAAI,OAAO,KAAK,sBAwB/B,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import styles from './styles.module.css';
|
|
3
|
-
import Editor from '
|
|
4
|
-
import BrythonCommunicator from '
|
|
3
|
+
import Editor from '@theme/CodeEditor/Editor';
|
|
4
|
+
import BrythonCommunicator from '@theme/CodeEditor/BrythonCommunicator';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import {
|
|
6
|
+
import { useStore, useScript } from '@theme/CodeEditor/hooks';
|
|
7
7
|
import BrowserOnly from '@docusaurus/BrowserOnly';
|
|
8
|
-
import CodeHistory from '
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
8
|
+
import CodeHistory from '@theme/CodeEditor/CodeHistory';
|
|
9
|
+
import CodeBlock from '@theme/CodeBlock';
|
|
10
|
+
const CodeEditor = (props) => {
|
|
11
|
+
const store = useStore();
|
|
12
|
+
const lang = useScript(store, 'lang');
|
|
13
|
+
return (<BrowserOnly fallback={<CodeBlock language={props.lang}>{props.code}</CodeBlock>}>
|
|
13
14
|
{() => {
|
|
14
|
-
return (<div className={clsx(styles.wrapper, 'notranslate')}>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
return (<div className={clsx(styles.wrapper, 'notranslate', props.className)}>
|
|
16
|
+
<div className={clsx(styles.playgroundContainer, props.slim ? styles.containerSlim : styles.containerBig, 'live_py')}>
|
|
17
|
+
<Editor {...props}/>
|
|
18
|
+
{!props.noHistory && <CodeHistory />}
|
|
19
|
+
</div>
|
|
20
|
+
{lang === 'python' && <BrythonCommunicator />}
|
|
21
|
+
</div>);
|
|
21
22
|
}}
|
|
22
23
|
</BrowserOnly>);
|
|
23
24
|
};
|
|
24
|
-
export default
|
|
25
|
+
export default CodeEditor;
|
|
@@ -1,43 +1,41 @@
|
|
|
1
1
|
.containerBig {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
display: grid;
|
|
3
|
+
flex-grow: 1;
|
|
4
|
+
flex-shrink: 1;
|
|
5
|
+
flex-basis: 250px;
|
|
6
|
+
grid-template-columns: 100%;
|
|
7
|
+
grid-template-rows: min-content 1fr min-content;
|
|
8
|
+
gap: 0px 0px;
|
|
9
|
+
grid-auto-flow: row;
|
|
10
|
+
grid-template-areas: 'controls' 'editor' 'result';
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
.containerSlim {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
display: grid;
|
|
15
|
+
grid-template-columns: 1fr min-content;
|
|
16
|
+
grid-template-rows: 1fr min-content;
|
|
17
|
+
gap: 0px 0px;
|
|
18
|
+
grid-auto-flow: row;
|
|
19
|
+
grid-template-areas: 'editor controls' 'result result';
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
23
22
|
.containerSlim .headerButton {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
z-index: calc(var(--ifm-z-index-fixed) - 2);
|
|
24
|
+
height: 100%;
|
|
25
|
+
border-radius: 0px;
|
|
26
|
+
padding: 2px 6px;
|
|
27
|
+
margin: 0px;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
|
|
32
30
|
.wrapper:last-child .playgroundContainer {
|
|
33
|
-
|
|
31
|
+
margin-bottom: inherit;
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
.playgroundContainer {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
35
|
+
margin-bottom: var(--ifm-leading);
|
|
36
|
+
border-radius: var(--ifm-global-radius);
|
|
37
|
+
box-shadow: var(--ifm-global-shadow-lw);
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
flex-grow: 1;
|
|
40
|
+
flex-shrink: 1;
|
|
41
|
+
}
|
package/og-image.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# How to OG:Image
|
|
2
|
+
|
|
3
|
+
- 👉 [https://og-playground.vercel.app/](https://og-playground.vercel.app/)
|
|
4
|
+
- 👉[image2base64](https://www.base64-image.de/)
|
|
5
|
+
|
|
6
|
+
```tsx
|
|
7
|
+
// Modified based on https://tailwindui.com/components/marketing/sections/cta-sections
|
|
8
|
+
|
|
9
|
+
<div tw="flex flex-col w-full h-full items-center justify-center bg-white">
|
|
10
|
+
<div tw="bg-gray-50 flex w-full">
|
|
11
|
+
<div tw="flex flex-col md:flex-row w-full py-12 px-4 md:items-center justify-between p-8">
|
|
12
|
+
<h2 tw="flex flex-col text-3xl sm:text-8xl font-bold tracking-tight text-gray-900 text-left">
|
|
13
|
+
<span tw="text-blue-500">Live</span>
|
|
14
|
+
<span tw="text-blue-600">Interactive</span>
|
|
15
|
+
<span tw="text-blue-700">Brython!</span>
|
|
16
|
+
</h2>
|
|
17
|
+
<div tw="flex" style={{marginBottom: '1em'}}>
|
|
18
|
+
<img height="560" src="...bas64...." />
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-live-brython",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Docusaurus live code block component for python.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -13,6 +13,14 @@
|
|
|
13
13
|
"types": "./lib/index.d.ts",
|
|
14
14
|
"default": "./lib/index.js"
|
|
15
15
|
},
|
|
16
|
+
"./theme/CodeEditor/hooks": {
|
|
17
|
+
"types": "./lib/theme/CodeEditor/hooks/index.d.ts",
|
|
18
|
+
"default": "./lib/theme/CodeEditor/hooks/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./theme/CodeEditor/ContextEditor": {
|
|
21
|
+
"types": "./lib/theme/CodeEditor/ContextEditor/index.d.ts",
|
|
22
|
+
"default": "./lib/theme/CodeEditor/ContextEditor/index.jsx"
|
|
23
|
+
},
|
|
16
24
|
"./theme/CodeEditor/Editor": {
|
|
17
25
|
"types": "./lib/theme/CodeEditor/Editor/index.d.ts",
|
|
18
26
|
"default": "./lib/theme/CodeEditor/Editor/index.jsx"
|
|
@@ -33,6 +41,10 @@
|
|
|
33
41
|
"types": "./lib/theme/CodeEditor/CodeHistory/index.d.ts",
|
|
34
42
|
"default": "./lib/theme/CodeEditor/CodeHistory/index.jsx"
|
|
35
43
|
},
|
|
44
|
+
"./theme/CodeEditor/HiddenCode": {
|
|
45
|
+
"types": "./lib/theme/CodeEditor/HiddenCode/index.d.ts",
|
|
46
|
+
"default": "./lib/theme/CodeEditor/HiddenCode/index.jsx"
|
|
47
|
+
},
|
|
36
48
|
"./theme/CodeEditor/Icon": {
|
|
37
49
|
"types": "./lib/theme/CodeEditor/Icon/index.d.ts",
|
|
38
50
|
"default": "./lib/theme/CodeEditor/Icon/index.jsx"
|
|
@@ -57,6 +69,10 @@
|
|
|
57
69
|
"types": "./lib/theme/CodeEditor/Editor/utils/*.d.ts",
|
|
58
70
|
"default": "./lib/theme/CodeEditor/Editor/utils/*.js"
|
|
59
71
|
},
|
|
72
|
+
"./theme/CodeEditor/WithScript/Store": {
|
|
73
|
+
"types": "./lib/theme/CodeEditor/WithScript/Store.d.ts",
|
|
74
|
+
"default": "./lib/theme/CodeEditor/WithScript/Store.jsx"
|
|
75
|
+
},
|
|
60
76
|
"./theme/CodeEditor/WithScript/*": {
|
|
61
77
|
"types": "./lib/theme/CodeEditor/WithScript/*.d.ts",
|
|
62
78
|
"default": "./lib/theme/CodeEditor/WithScript/*.js"
|
|
@@ -70,7 +86,9 @@
|
|
|
70
86
|
"build": "tsc --build && node ./bin/copyUntypedFiles.js && prettier --config ./.prettierrc --write \"lib/theme/**/*.js\"",
|
|
71
87
|
"watch": "run-p -c copy:watch build:watch",
|
|
72
88
|
"build:watch": "tsc --build --watch",
|
|
73
|
-
"copy:watch": "node ./bin/copyUntypedFiles.js --watch"
|
|
89
|
+
"copy:watch": "node ./bin/copyUntypedFiles.js --watch",
|
|
90
|
+
"format": "prettier --write .",
|
|
91
|
+
"format:check": "prettier --check ."
|
|
74
92
|
},
|
|
75
93
|
"license": "MIT",
|
|
76
94
|
"repository": {
|
|
@@ -81,23 +99,27 @@
|
|
|
81
99
|
"bugs": "https://github.com/lebalz/docusaurus-live-brython/issues",
|
|
82
100
|
"homepage": "https://lebalz.github.io/docusaurus-live-brython/",
|
|
83
101
|
"dependencies": {
|
|
84
|
-
"
|
|
102
|
+
"@docusaurus/core": "^3.9.2",
|
|
103
|
+
"@docusaurus/preset-classic": "^3.9.2",
|
|
104
|
+
"@docusaurus/theme-classic": "^3.9.2",
|
|
105
|
+
"@docusaurus/theme-common": "^3.9.2",
|
|
106
|
+
"@docusaurus/theme-translations": "^3.9.2",
|
|
107
|
+
"@docusaurus/utils-validation": "^3.9.2",
|
|
108
|
+
"ace-builds": "^1.34.2",
|
|
85
109
|
"clsx": "^2.1.1",
|
|
86
110
|
"lodash": "^4.17.21",
|
|
111
|
+
"prism-react-renderer": "^2.3.1",
|
|
87
112
|
"rc-slider": "^10.6.2",
|
|
88
|
-
"react-ace": "^
|
|
89
|
-
"react-diff-viewer": "^3.
|
|
90
|
-
"react-draggable": "^4.4.
|
|
113
|
+
"react-ace": "^11.0.1",
|
|
114
|
+
"react-diff-viewer-continued": "^3.4.0",
|
|
115
|
+
"react-draggable": "^4.4.6",
|
|
91
116
|
"svg-parser": "^2.0.4",
|
|
92
117
|
"uuid": "^9.0.1"
|
|
93
118
|
},
|
|
94
119
|
"devDependencies": {
|
|
95
|
-
"@docusaurus/
|
|
96
|
-
"@docusaurus/
|
|
97
|
-
"@docusaurus/
|
|
98
|
-
"@docusaurus/theme-common": "^3.3.2",
|
|
99
|
-
"@docusaurus/tsconfig": "^3.3.2",
|
|
100
|
-
"@docusaurus/types": "^3.3.2",
|
|
120
|
+
"@docusaurus/module-type-aliases": "^3.9.2",
|
|
121
|
+
"@docusaurus/tsconfig": "^3.9.2",
|
|
122
|
+
"@docusaurus/types": "^3.9.2",
|
|
101
123
|
"@types/fs-extra": "^11.0.4",
|
|
102
124
|
"@types/lodash": "^4.17.4",
|
|
103
125
|
"@types/svg-parser": "^2.0.6",
|
|
@@ -106,17 +128,14 @@
|
|
|
106
128
|
"concurrently": "^8.2.2",
|
|
107
129
|
"fs-extra": "^11.2.0",
|
|
108
130
|
"npm-run-all": "^4.1.5",
|
|
109
|
-
"prettier": "^3.
|
|
110
|
-
"
|
|
111
|
-
"typescript": "^5.4.2"
|
|
131
|
+
"prettier": "^3.3.3",
|
|
132
|
+
"typescript": "^5.4.5"
|
|
112
133
|
},
|
|
113
134
|
"peerDependencies": {
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"prism-react-renderer": "^2.1",
|
|
117
|
-
"webpack": "^5.0.0"
|
|
135
|
+
"react": ">=18.0.0",
|
|
136
|
+
"react-dom": ">=18.0.0"
|
|
118
137
|
},
|
|
119
138
|
"engines": {
|
|
120
139
|
"node": ">=18"
|
|
121
140
|
}
|
|
122
|
-
}
|
|
141
|
+
}
|