Solid-compatible source code editor for solid-panes system
Extracted from the solid-panes monolithic repository.
The source code allows one to mint a new source code file and display and edit an existing one.
If the user edits a data file (such as turtle format) then the syntax is checked before they save it back.
Once selected this pane as a view of a file, then the pen icon allows to switch to editing mode, and the check mark button allows the file to be saved back.
Editing can be aborted by the cancel(X) button.
The pane returns a headless source-pane-source-provider and loads
SourceEditorCard only when Source is selected. Mount the returned pane beneath
solid-ui-file-explorer-provider (using composeExplorer) so the provider and
card receive the shared store, resource URI and editor registration contract.
The editor waits for both the subscribed explorer context and fetched content;
either may arrive after its first render. Context accessors used by Lit lifecycle
change checks must also be reactive properties.
JavaScript files (.js, .mjs, .cjs) offer and prefer Source even when a
server omits MIME metadata or erroneously types the file as an LDP container.
If the lazy-loaded editor fails to start, the source pane shows
solid-ui-error-state with a user-triggered Try again action and expandable
technical details. The original error (including its stack when available) and
resource URI are logged to the console. The error belongs to the pane that
requested the editor; late failures from detached panes do not replace another
pane's status.
Retry may recover a temporary download failure. A module evaluation failure may remain cached by the browser and require a page refresh. The pane never reloads automatically, because other panes may contain unsaved work. A startup failure does not change the file.
For intermittent reports such as Cannot read properties of undefined (reading 'call'), collect the console stack and failed JavaScript requests in the
Network panel. This wording alone does not identify the cause: generated
decorator code and the host bundler's module runtime both contain .call().
Check missing/blocked chunks, responses that contain HTML instead of
JavaScript, and mixed bundle versions before concluding it is an authentication
or caching problem. Deploy related bundles together and keep assets needed by
already-open pages available during updates.
- JavaScript
- Vite
- Eslint
- SolidOS
To run all tests:
npm testStart a dev server:
npm startVisit http://localhost:5173/ to render the pane in a local sandbox. Adjust the settings in vite.config.mts to provide different defaults.
npm run build
The SolidOS team is using GitHub Copilot integrated in Visual Studio Code. We have added comments in the code to make it explicit which parts are 100% written by AI. Example:
- Some code was generated by the GPT-5.3-Codex model in GitHub Copilot based on the following prompt:
- Can you refactor this code setUnedited () to use CSS instead of inline js styles