Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
199 commits
Select commit Hold shift + click to select a range
282e8fc
Fix incorrect doc tags
leeyi45 Dec 23, 2025
1f12e20
Add validation for example tags and hide type guards in generated docs
leeyi45 Dec 23, 2025
3370426
Update docs about documentation
leeyi45 Dec 23, 2025
175ab4e
Continue updating docs
leeyi45 Dec 25, 2025
1dd8cde
Add linting for code examples
leeyi45 Dec 25, 2025
bbc6970
Add compile command
leeyi45 Dec 25, 2025
5754a29
Fix bug where markdown directory trees weren't being aligned properly
leeyi45 Dec 28, 2025
54c4eed
Add tests for the markdown tree transformer
leeyi45 Dec 28, 2025
49cbc9a
Run format
leeyi45 Dec 28, 2025
44d5dc3
Move buildtools to use tsc compile and typecheck separately
leeyi45 Jan 10, 2026
ddcd384
Add tests for ensuring that typedoc paths are processed correctly
leeyi45 Jan 10, 2026
5a8b123
Add tests to ensure that typeguards are properly rendered
leeyi45 Jan 10, 2026
e87456f
Add the compile command to bundles
leeyi45 Jan 10, 2026
8a1f40c
Update eslint-plugin-json version
leeyi45 Jan 10, 2026
68dee49
Update code examples to comply with linting
leeyi45 Jan 10, 2026
989eba9
Fix code example from plotly
leeyi45 Jan 10, 2026
f44cfba
Update vitest eslint plugin
leeyi45 Jan 10, 2026
d0b1422
Change reference to tsc command to instead refer to compile command
leeyi45 Jan 10, 2026
7bca240
Fix incorrect eslint rules
leeyi45 Jan 15, 2026
875adf5
Merge remote-tracking branch 'origin/master' into plugins
leeyi45 Jan 21, 2026
7afa0fd
Update typescript-eslint versions
leeyi45 Jan 21, 2026
7d3a5b4
Fix spelling
leeyi45 Jan 21, 2026
5794b53
Update blueprintjs versions and add it to packages that didn't specif…
leeyi45 Jan 23, 2026
6947174
Fix eslint import paths
leeyi45 Jan 23, 2026
915d8e8
Add lodash and @types/lodash to packages that were missing them
leeyi45 Jan 23, 2026
22e2127
Disable import/no-unresolved when running in CI
leeyi45 Jan 23, 2026
4b2ef02
Update vitest packages
leeyi45 Jan 23, 2026
6f5c1f4
Fix incorrect classname in test
leeyi45 Jan 23, 2026
88298ee
Fix omit call
leeyi45 Jan 24, 2026
cb7973f
Merge from master
leeyi45 Feb 5, 2026
b56d392
Update lodash packages
leeyi45 Feb 5, 2026
4d8d168
Add callback parameter checking for curve bundle
leeyi45 Feb 5, 2026
55a111e
Update incorrect curve function implementations
leeyi45 Feb 6, 2026
5957436
Merge remote-tracking branch 'origin/master' into plugins
leeyi45 Feb 7, 2026
4e64fab
Merge branch 'master' of https://github.com/source-academy/modules in…
RichDom2185 Feb 7, 2026
70ffeb3
Fix bp6 namespace
RichDom2185 Feb 7, 2026
23dab3c
Fix lockfile post-merge
RichDom2185 Feb 7, 2026
acffe64
Merge branch 'master' of https://github.com/source-academy/modules in…
RichDom2185 Feb 7, 2026
ce99536
Format markdown files
RichDom2185 Feb 7, 2026
bb3f681
Merge branch 'master' of https://github.com/source-academy/modules in…
RichDom2185 Feb 8, 2026
f05933a
Update lockfile post-merge
RichDom2185 Feb 8, 2026
4bfd69f
Merge branch 'plugins' of github.com:source-academy/modules into plugins
leeyi45 Feb 10, 2026
b639551
Fix incorrect curve drawer implementations and add tests
leeyi45 Feb 11, 2026
ef9a367
Add a documentation section regarding checking callback parameters
leeyi45 Feb 11, 2026
7af0cc1
Add overloads to the isFunctionOfLength callback
leeyi45 Feb 11, 2026
03c2867
Move type checking into its own section for docs
leeyi45 Feb 14, 2026
af5966b
Add isFunctionOfLength utility function
leeyi45 Feb 14, 2026
8a8db52
Update constraints file and node version
leeyi45 Feb 14, 2026
9a35743
Bump dependencies
RichDom2185 Feb 14, 2026
f4293d2
Fix format
RichDom2185 Feb 14, 2026
5443917
Revert js-slang due to breaking changes
RichDom2185 Feb 14, 2026
b3e0d77
Fix lint issues
RichDom2185 Feb 14, 2026
f646686
Update lib/buildtools/src/build/modules/__tests__/building.test.ts
RichDom2185 Feb 14, 2026
f3b9bf8
Add yarn checksum
RichDom2185 Feb 14, 2026
6d1fafd
Use a new error type to unify errors thrown by type guards
leeyi45 Feb 14, 2026
7afaec2
Merge remote-tracking branch 'origin/plugins' into better-type-guards
leeyi45 Feb 14, 2026
039f3b5
Merge branch 'master' into better-type-guards
leeyi45 Feb 14, 2026
ec87a3b
Add the callback type checks to sound bundle
leeyi45 Feb 14, 2026
a952439
Linting fixes
leeyi45 Feb 15, 2026
7db632c
General documentation updates
leeyi45 Feb 26, 2026
4efc5a5
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 Feb 26, 2026
c43178b
Update linting and documentation
leeyi45 Feb 28, 2026
d39bb8f
Bump fast-xml-parser from 5.3.6 to 5.4.1
dependabot[bot] Feb 28, 2026
6f0ec17
Merge remote-tracking branch 'origin/dependabot/npm_and_yarn/fast-xml…
leeyi45 Mar 2, 2026
47cb851
Remove extraneous line
leeyi45 Mar 2, 2026
463784a
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 Mar 3, 2026
4bc2449
Fix missing lodash package in Unittest tab
leeyi45 Mar 3, 2026
45557b9
Add missing dependencies to vitest optimizeDeps for modules-lib
leeyi45 Mar 3, 2026
eeefeb3
Change some errors to use InvalidTypeParameterError
leeyi45 Mar 3, 2026
7ddda5c
Add InvalidCallbackError to Rune animations
leeyi45 Mar 3, 2026
884a8a9
Add some missing functionality to midi
leeyi45 Mar 3, 2026
0e87bc0
Add type checks to repeat
leeyi45 Mar 7, 2026
595b52c
Add type checking to repeat bundle
leeyi45 Mar 7, 2026
8d7328c
Add more type guard checks to unittest and fix broken tests
leeyi45 Mar 7, 2026
494826f
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 Mar 7, 2026
0f28aea
Update some documentation
leeyi45 Mar 8, 2026
2f178b7
Add documentation about bp css styles
leeyi45 Mar 8, 2026
580da06
Update modules-lib to use blueprint/core iconnames
leeyi45 Mar 9, 2026
eb0d025
Update devserver to use blueprint core icons
leeyi45 Mar 9, 2026
bd69a3a
Change which iconname modules-lib refers to
leeyi45 Mar 9, 2026
f9b7ebb
Remove blueprint icons where unnecessary
leeyi45 Mar 9, 2026
88379d9
Update some documentation
leeyi45 Mar 9, 2026
200cef7
Update documentation config for modules-lib for better organization
leeyi45 Mar 9, 2026
20902e4
Add direct nav link to modules-lib docs
leeyi45 Mar 9, 2026
724a0e5
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 Mar 10, 2026
8e7dcb1
Add a linting rule to refer to es-toolkit
leeyi45 Mar 10, 2026
e1615c3
Add checks for number range and change to assertion style guards
leeyi45 Mar 15, 2026
44db249
Pin Vitest and upgrade to Vite v8
RichDom2185 Mar 16, 2026
2301e42
Rollback Vite to v7
RichDom2185 Mar 16, 2026
778c788
Revert "Rollback Vite to v7"
RichDom2185 Mar 16, 2026
8af4479
Ignore Vitest attachments
RichDom2185 Mar 16, 2026
9781d00
Migrate Vitest config
RichDom2185 Mar 16, 2026
9b44933
Run Vitest non-interactively
RichDom2185 Mar 16, 2026
4d7362c
Skip failing tests for now
RichDom2185 Mar 16, 2026
9000797
Rollback vitest-browser-react
RichDom2185 Mar 16, 2026
a8c066f
Update plotly to use new type guards
leeyi45 Mar 17, 2026
48972cc
Fix some naming issues
leeyi45 Mar 17, 2026
bfebf40
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 Mar 17, 2026
b4e79f8
Update documentations
leeyi45 Mar 17, 2026
3d85d09
Minor changes
leeyi45 Mar 18, 2026
00f7061
Update docs
leeyi45 Mar 18, 2026
dc3bd2f
Update sound docs
leeyi45 Mar 18, 2026
a20e2bb
General documentation updates
leeyi45 Mar 20, 2026
0a0a720
Merge remote-tracking branch 'origin/master' into vite-8
leeyi45 Mar 20, 2026
d3ed1df
Add the legacy.inconsistentCjsInterop flag to vitest configuration
leeyi45 Mar 20, 2026
8ec125d
Restore playground tests
RichDom2185 Mar 20, 2026
937824c
Update vite config resolution to remove type error
leeyi45 Mar 20, 2026
f2c820c
Merge branch 'vite-8' of github.com:source-academy/modules into vite-8
leeyi45 Mar 20, 2026
0f0f0a9
Fix tests being skipped
leeyi45 Mar 20, 2026
e53b037
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 Mar 20, 2026
5d19c43
Update vitest-browser-react
leeyi45 Mar 22, 2026
c90d0f0
Merge branch 'vite-8' into better-type-guards
leeyi45 Mar 22, 2026
da30cdb
Fix sound documentation again
leeyi45 Mar 22, 2026
2048de5
Add some more type guards to sound
leeyi45 Mar 24, 2026
b6683c9
Change get_arg_list to return list of lists
leeyi45 Mar 24, 2026
33b3dcb
Fix binary_tree to work with new list type definitions
leeyi45 Mar 27, 2026
721e5eb
Fix csg to use new list type definitions
leeyi45 Mar 27, 2026
e07b0b5
Fix stereo_sound and sound to work with new list type definitions
leeyi45 Mar 27, 2026
b84d358
Fix unittest to work with new list type definitions
leeyi45 Mar 27, 2026
032e349
Fix game and curve to work with new list definitions
leeyi45 Mar 27, 2026
f727a63
Tidy up repl bundle implementation
leeyi45 Mar 28, 2026
40c8b57
Make devserver work with new js-slang imports
leeyi45 Mar 28, 2026
856ef6f
Fix Repl tab
leeyi45 Mar 28, 2026
5539616
Update pix_n_flix to use new module utilities
leeyi45 Mar 28, 2026
92c7cd8
Update devserver to allow direct importing
leeyi45 Mar 28, 2026
8a07b20
Update imports from js-slang errors
leeyi45 Mar 28, 2026
165b15d
Update robot_simulation for new js-slang types
leeyi45 Mar 28, 2026
c31ade3
Update compilation scripts
leeyi45 Mar 28, 2026
66dc398
Update more robot_simulation imports
leeyi45 Mar 28, 2026
a95b74c
Make repl tab work with new repl bundle
leeyi45 Mar 30, 2026
072eac8
Add intellisense support for vue files
leeyi45 Mar 30, 2026
c562699
Revert "Add intellisense support for vue files"
leeyi45 Mar 30, 2026
82d094f
Add twoslash support to docs
leeyi45 Apr 2, 2026
50933bd
Add a docs section about typescript
leeyi45 Apr 2, 2026
3f70061
Add twoslash to docs
leeyi45 Apr 2, 2026
e9191e6
Allow devserver to use custom importers
leeyi45 Apr 2, 2026
a5b10df
Update tests to work with new js-slang list lib
leeyi45 Apr 2, 2026
d812bfb
Update modules-lib docs
leeyi45 Apr 2, 2026
135c9b1
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 Apr 2, 2026
4caf6e2
Update eslint config to work for docs and twoslash
leeyi45 Apr 2, 2026
650eb57
Fix twoslash popovers not having styling
leeyi45 Apr 2, 2026
ce1243c
Update markdown-tree packages
leeyi45 Apr 6, 2026
974d216
Add clean command
leeyi45 Apr 6, 2026
41979c6
Update bundles to work with Typescript 6
leeyi45 Apr 6, 2026
c6e6024
Update tabs to work with typescript 6
leeyi45 Apr 6, 2026
372a933
Update github actions to work with Typescript 6
leeyi45 Apr 6, 2026
1b88ee4
Update libs to work with Typescript 6
leeyi45 Apr 6, 2026
467d090
Update ESLint packages
leeyi45 Apr 6, 2026
77150eb
Needed to revert back to ESLint 9
leeyi45 Apr 6, 2026
3a2ac5a
Update typedoc
leeyi45 Apr 6, 2026
8f6a3d3
Fix dependencies for lintplugin
leeyi45 Apr 6, 2026
e938d2b
Fix broken test
leeyi45 Apr 7, 2026
fbdee21
Test a potential broken action
leeyi45 Apr 7, 2026
6ba6b6c
Try another fix
leeyi45 Apr 7, 2026
3c1ad58
More testing
leeyi45 Apr 7, 2026
99e6f1e
Try adding silent to exec option
leeyi45 Apr 7, 2026
268c945
Augment code to see where execution stopped
leeyi45 Apr 7, 2026
19c176d
Try with more logging
leeyi45 Apr 7, 2026
4c3cf5b
Redo the implementation for getRawPackages to use yarn workspaces list
leeyi45 Apr 7, 2026
0c44216
Fix broken tests
leeyi45 Apr 7, 2026
280f242
Investigate using a try block
leeyi45 Apr 7, 2026
9aa9dd6
Try without memoization
leeyi45 Apr 7, 2026
55fe824
Try testing the yarn why command without silent
leeyi45 Apr 7, 2026
1849e5a
Fix package name extractor
leeyi45 Apr 7, 2026
2a1d7b9
Make package type information available too
leeyi45 Apr 7, 2026
948a6dd
Fix incorrect lib typing in tests
leeyi45 Apr 7, 2026
fea050e
Fix sound test using global
leeyi45 Apr 7, 2026
c105e43
Fix CurveAnimations crashing the frontend
leeyi45 Apr 7, 2026
962e428
Fix types and documentation
leeyi45 Apr 7, 2026
fc4fde8
Add result handling for the clean command
leeyi45 Apr 7, 2026
30447a8
Added documentation about the instanceof issue
leeyi45 Apr 7, 2026
d56aed5
Add Typescript to docs
leeyi45 Apr 7, 2026
5161209
Fix linting config to always require json extension
leeyi45 Apr 7, 2026
d9aec50
Fix toSpawn checks for tabs that weren't working
leeyi45 Apr 8, 2026
ab9ff8a
Fix broken tests
leeyi45 Apr 8, 2026
de6f6ae
Update tab test snapshots
leeyi45 Apr 9, 2026
c37d245
Update the docs about the ModuleTab type
leeyi45 Apr 9, 2026
ab21f78
Fix missing export and incorrect css layout
leeyi45 Apr 9, 2026
99e9d49
Merge branch 'ts-6' into better-type-guards
leeyi45 Apr 9, 2026
38babe0
Update docs
leeyi45 Apr 11, 2026
d24df04
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 Apr 15, 2026
702d4af
Fix incorrect typescript-eslint packages causing lintplugin type errors
leeyi45 Apr 15, 2026
30cde0d
change modules-lib utils to use the ones exported by js-slang
leeyi45 Apr 15, 2026
9bfb52f
Fix eslint issues
leeyi45 Apr 15, 2026
5e1075f
Update unittest bundle errors
leeyi45 Apr 16, 2026
ea4c683
Fix repl tab
leeyi45 Apr 16, 2026
d41c6bb
Fix modules-lib exports
leeyi45 Apr 16, 2026
54e4186
Add docs about error throwing
leeyi45 Apr 16, 2026
eee61c1
Merge remote-tracking branch 'origin/master' into better-type-guards
leeyi45 Apr 16, 2026
e1f6bce
Update pix_n_flix
leeyi45 Apr 16, 2026
ebddbe5
Downgrade shikijs version to the one actually used by vitepress
leeyi45 Apr 16, 2026
5488374
Fix unittest bundle test
leeyi45 Apr 16, 2026
5dc3ac8
Fix docs tsc not working properly
leeyi45 Apr 16, 2026
444cc49
Fix broken markdown-plugin test
leeyi45 Apr 16, 2026
a23ffb2
Fix stereo_sound type checks, errors and tests
leeyi45 Apr 17, 2026
9ef6c21
Fix buildtools testing command ui option not working
leeyi45 Apr 17, 2026
a0c3aca
Unittest bundle: Make mocked functions have all the same toString
leeyi45 Apr 17, 2026
5184365
Tidy up some code
leeyi45 Apr 17, 2026
fce6f40
Update docs
leeyi45 Apr 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@
"typescriptreact",
"yml",
"yaml"
]
],
"vue.server.includeLanguages": ["vue", "markdown"]
}
5 changes: 1 addition & 4 deletions devserver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
},
"dependencies": {
"@blueprintjs/core": "^6.0.0",
"@blueprintjs/icons": "^6.0.0",
"@commander-js/extra-typings": "^14.0.0",
"@sourceacademy/modules-lib": "workspace:^",
"@vitejs/plugin-react": "^6.0.1",
"ace-builds": "^1.25.1",
"classnames": "^2.3.1",
"commander": "^14.0.0",
"es-toolkit": "^1.44.0",
"js-slang": "^1.0.85",
"re-resizable": "^6.9.11",
"react": "^19.0.0",
Expand All @@ -37,9 +37,6 @@
"vitest": "4.1.4",
"vitest-browser-react": "^2.1.0"
},
"peerDependencies": {
"es-toolkit": "^1.44.0"
},
"scripts": {
"dev": "vite",
"lint": "eslint src",
Expand Down
164 changes: 84 additions & 80 deletions devserver/src/components/Playground.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Button, Classes, Intent, OverlayToaster, Popover, Tooltip, type ToastProps } from '@blueprintjs/core';
import { Settings } from '@blueprintjs/icons';
import classNames from 'classnames';
import { throttle } from 'es-toolkit';
import { SourceDocumentation, getNames, runInContext, type Context } from 'js-slang';
// Importing this straight from js-slang doesn't work for whatever reason
import createContext from 'js-slang/dist/createContext';
import { Chapter, Variant } from 'js-slang/dist/langs';
import { ModuleInternalError } from 'js-slang/dist/modules/errors';
import { setModulesStaticURL } from 'js-slang/dist/modules/loader';
import { Chapter, Variant } from 'js-slang/dist/types';
import { stringify } from 'js-slang/dist/utils/stringify';
import React from 'react';
import mockModuleContext from '../mockModuleContext';
Expand All @@ -18,6 +18,7 @@ import { ControlBarRefreshButton } from './controlBar/ControlBarRefreshButton';
import { ControlBarRunButton } from './controlBar/ControlBarRunButton';
import testTabContent from './sideContent/TestTab';
import loadDynamicTabs from './sideContent/importers';
import { getBundleDocsUsingVite, getBundleUsingVite, getModulesManifest } from './sideContent/importers/importers';
import type { SideContentTab } from './sideContent/types';

const refreshSuccessToast: ToastProps = {
Expand Down Expand Up @@ -49,6 +50,10 @@ const createContextHelper = (onConsoleLog: (arg: string) => void) => {
return tempContext;
};

const updateEditorLocalStorageValue = throttle((newValue: string) => {
localStorage.setItem('editorValue', newValue);
}, 100);

const Playground: React.FC = () => {
const consoleLogs = React.useRef<string[]>([]);
const [moduleBackend, setModuleBackend] = React.useState<string | null>(null);
Expand All @@ -61,8 +66,7 @@ const Playground: React.FC = () => {
}
}, []);

const [useCompiledTabs, setUseCompiledTabs] = React.useState(!!localStorage.getItem('compiledTabs'));

const [useCompiled, setUseCompiled] = React.useState(!!localStorage.getItem('useCompiled'));
const [dynamicTabs, setDynamicTabs] = React.useState<SideContentTab[]>([]);
const [selectedTabId, setSelectedTab] = React.useState(testTabContent.id);
const [codeContext, setCodeContext] = React.useState<Context>(createContextHelper(str => consoleLogs.current.push(str)));
Expand All @@ -72,6 +76,9 @@ const Playground: React.FC = () => {

const toaster = React.useRef<OverlayToaster>(null);

const manifestImporter = useCompiled ? undefined : getModulesManifest;
const docsImporter = useCompiled ? undefined : getBundleDocsUsingVite;

const showToast = (props: ToastProps) => {
if (toaster.current) {
toaster.current.show({
Expand All @@ -81,43 +88,41 @@ const Playground: React.FC = () => {
}
};

const getAutoComplete = React.useCallback((row: number, col: number, callback: any) => {
getNames(editorValue, row, col, codeContext)
.then(([editorNames, displaySuggestions]) => {
if (!displaySuggestions) {
callback();
return;
}
const getAutoComplete = async (row: number, col: number, callback: any) => {
const [editorNames, displaySuggestions] = await getNames(editorValue, row, col, codeContext, { manifestImporter, docsImporter });
if (!displaySuggestions) {
callback();
return;
}

const editorSuggestions = editorNames.map((editorName: any) => ({
...editorName,
caption: editorName.name,
value: editorName.name,
score: editorName.score ? editorName.score + 1000 : 1000,
name: undefined
}));
const editorSuggestions = editorNames.map((editorName: any) => ({
...editorName,
caption: editorName.name,
value: editorName.name,
score: editorName.score ? editorName.score + 1000 : 1000,
name: undefined
}));

const builtins: Record<string, any> = SourceDocumentation.builtins[Chapter.SOURCE_4];
const builtinSuggestions = Object.entries(builtins)
.map(([builtin, thing]) => ({
...thing,
caption: builtin,
value: builtin,
score: 100,
name: builtin,
docHTML: thing.description
}));
const builtins: Record<string, any> = SourceDocumentation.builtins[Chapter.SOURCE_4];
const builtinSuggestions = Object.entries(builtins)
.map(([builtin, thing]) => ({
...thing,
caption: builtin,
value: builtin,
score: 100,
name: builtin,
docHTML: thing.description
}));

callback(null, [
...builtinSuggestions,
...editorSuggestions
]);
});
}, [editorValue, codeContext]);
callback(null, [
...builtinSuggestions,
...editorSuggestions
]);
};

const loadTabs = async () => {
try {
const tabs = await loadDynamicTabs(codeContext, useCompiledTabs);
const tabs = await loadDynamicTabs(codeContext, useCompiled);
setDynamicTabs(tabs);

const newIds = tabs.map(({ id }) => id);
Expand All @@ -127,52 +132,55 @@ const Playground: React.FC = () => {
setSelectedTab(testTabContent.id);
}
setAlerts(newIds);

} catch (error) {
showToast(errorToast);
console.log(error);
}
};

const evalCode = () => {
const evalCode = async () => {
codeContext.errors = [];
codeContext.moduleContexts = mockModuleContext.moduleContexts = {};
consoleLogs.current = [];

runInContext(editorValue, codeContext, {
const result = await runInContext(editorValue, codeContext, {
importOptions: {
loadTabs: useCompiledTabs
}
})
.then((result) => {
if (codeContext.errors.length > 0) {
showToast(errorToast);
} else {
loadTabs()
.then(() => showToast(evalSuccessToast));
loadTabs: useCompiled,
sourceBundleImporter: useCompiled ? undefined : getBundleUsingVite,
docsImporter,
resolverOptions: {
manifestImporter,
}
}
});

if (result.status === 'finished') {
setReplOutput({
type: 'result',
// code: editorValue,
consoleLogs: consoleLogs.current,
value: stringify(result.value)
});
} else if (result.status === 'error') {
codeContext.errors.forEach(error => {
if (error instanceof ModuleInternalError) {
console.error(error.error);
}
});
if (codeContext.errors.length > 0) {
showToast(errorToast);
} else {
loadTabs()
.then(() => showToast(evalSuccessToast));
}

setReplOutput({
type: 'errors',
errors: codeContext.errors,
consoleLogs: consoleLogs.current
});
if (result.status === 'finished') {
setReplOutput({
type: 'result',
// code: editorValue,
consoleLogs: consoleLogs.current,
value: stringify(result.value)
});
} else if (result.status === 'error') {
codeContext.errors.forEach(error => {
if (error instanceof ModuleInternalError) {
console.error(error.error);
}
});

setReplOutput({
type: 'errors',
errors: codeContext.errors,
consoleLogs: consoleLogs.current
});
}
};

const resetEditor = () => {
Expand Down Expand Up @@ -206,22 +214,19 @@ const Playground: React.FC = () => {
setModulesStaticURL(value);
localStorage.setItem('backend', value);
}}
useCompiledForTabs={useCompiledTabs}
useCompiled={useCompiled}
onUseCompiledChange={value => {
setUseCompiledTabs(value);
localStorage.setItem('compiledTabs', value ? 'true' : '');
setUseCompiled(value);
localStorage.setItem('useCompiled', value ? 'true' : '');
}}
/>}
renderTarget={({ isOpen: _isOpen, ...targetProps }) => {
return (
<Tooltip content="Settings">
<Button
{...targetProps}
icon={<Settings />}
/>
</Tooltip>
);
}}
renderTarget={({ isOpen: _isOpen, ...targetProps }) => (
<Tooltip content="Settings">
<Button
{...targetProps}
icon='settings' />
</Tooltip>
)}
/>,
<ControlBarRunButton handleEditorEval={evalCode} key="eval" />,
<ControlBarClearButton onClick={resetEditor}
Expand All @@ -231,7 +236,6 @@ const Playground: React.FC = () => {
onClick={onRefresh}
key="refresh"
/>

]
},
replProps: {
Expand All @@ -241,7 +245,7 @@ const Playground: React.FC = () => {
handleEditorEval: evalCode,
handleEditorValueChange(newValue) {
setEditorValue(newValue);
localStorage.setItem('editorValue', newValue);
updateEditorLocalStorageValue(newValue);
},
editorValue,
sideContentProps: {
Expand Down
10 changes: 5 additions & 5 deletions devserver/src/components/SettingsPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useState } from 'react';

type SettingsPopupProps = {
backend: string;
useCompiledForTabs: boolean;
useCompiled: boolean;
onUseCompiledChange?: (newValue: boolean) => void;
onBackendChange?: (newValue: string) => void;
};
Expand Down Expand Up @@ -34,15 +34,15 @@ export default function SettingsPopup(props: SettingsPopupProps) {
/>
</div>
<br/>
<Tooltip content="Load compiled tabs instead of the raw Typescript">
<Tooltip content="Load compiled assets instead of the raw Typescript">
<Switch
checked={props.useCompiledForTabs}
checked={props.useCompiled}
onChange={() => {
if (props.onUseCompiledChange) {
props.onUseCompiledChange(!props.useCompiledForTabs);
props.onUseCompiledChange(!props.useCompiled);
}
}}
label="Use compiled tabs"
label="Use compiled"
/>
</Tooltip>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Tooltip } from '@blueprintjs/core';
import { Trash } from '@blueprintjs/icons';
import ControlButton from '../ControlButton';

type Props = {
Expand All @@ -9,7 +8,7 @@ type Props = {
export const ControlBarClearButton = (props: Props) => <Tooltip content="Clear the editor and context">
<ControlButton
label="Clear"
icon={<Trash />}
icon='trash'
onClick={props.onClick}
/>
</Tooltip>;
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Tooltip } from '@blueprintjs/core';
import { Refresh } from '@blueprintjs/icons';
import ControlButton from '../ControlButton';

type Props = {
Expand All @@ -9,7 +8,7 @@ type Props = {
export const ControlBarRefreshButton = (props: Props) => <Tooltip content="Manually refresh the side content">
<ControlButton
onClick={props.onClick}
icon={<Refresh />}
icon='refresh'
label="Refresh"
/>
</Tooltip>;
7 changes: 3 additions & 4 deletions devserver/src/components/controlBar/ControlBarRunButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Position, Tooltip } from '@blueprintjs/core';
import { Play } from '@blueprintjs/icons';
import React from 'react';
import type { FC } from 'react';

import ControlButton from '../ControlButton';

Expand All @@ -16,13 +15,13 @@ type StateProps = {

type ControlButtonRunButtonProps = DispatchProps & StateProps;

export const ControlBarRunButton: React.FC<ControlButtonRunButtonProps> = (props) => {
export const ControlBarRunButton: FC<ControlButtonRunButtonProps> = (props) => {
const tooltipContent = 'Evaluate the program';
return (
<Tooltip content={tooltipContent} placement={Position.TOP}>
<ControlButton
label="Run"
icon={<Play />}
icon='play'
onClick={props.handleEditorEval}
options={{
iconColor: props.color,
Expand Down
Loading
Loading