notjs-react 0.1.4
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/README.md +59 -0
- package/dist/NotJS.d.ts +17 -0
- package/dist/NotJS.d.ts.map +1 -0
- package/dist/index.cjs +114 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9500 -0
- package/dist/index.js.map +1 -0
- package/dist/notjs-react.css +32 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# notjs-react
|
|
2
|
+
|
|
3
|
+
A React component for interactive code execution with real-time WebSocket terminal support. Built with Monaco Editor and xterm.js.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
**NotJS Server Required**: This component requires a NotJS server to handle code execution. You can self-host the server by following the instructions at [https://github.com/cholnhial/notjs](https://github.com/cholnhial/notjs)
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install notjs-react
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { NotJS } from 'notjs-react'
|
|
19
|
+
import 'notjs-react/styles.css'
|
|
20
|
+
|
|
21
|
+
function App() {
|
|
22
|
+
return (
|
|
23
|
+
<NotJS
|
|
24
|
+
apiBaseUrl="http://localhost:8080/api"
|
|
25
|
+
websocketUrl="ws://localhost:8080/terminal"
|
|
26
|
+
initialLanguage="java"
|
|
27
|
+
initialVersion="25"
|
|
28
|
+
initialDarkMode={true}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Props
|
|
35
|
+
|
|
36
|
+
| Prop | Type | Default | Description |
|
|
37
|
+
|------|------|---------|-------------|
|
|
38
|
+
| `apiBaseUrl` | `string` | `"http://localhost:8080/api"` | Base URL for the API |
|
|
39
|
+
| `websocketUrl` | `string` | `"ws://localhost:8080/terminal"` | WebSocket endpoint URL |
|
|
40
|
+
| `initialLanguage` | `string` | `"java"` | Initial programming language |
|
|
41
|
+
| `initialVersion` | `string` | `"25"` | Initial language version |
|
|
42
|
+
| `initialDarkMode` | `boolean` | `true` | Enable dark mode by default |
|
|
43
|
+
| `initialCode` | `string` | (language default) | Custom starting code |
|
|
44
|
+
| `hideHeader` | `boolean` | `false` | Hide header for embedding |
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
- 🎨 Monaco Editor integration for code editing
|
|
49
|
+
- 💻 Real-time terminal with xterm.js
|
|
50
|
+
- 🌓 Dark/Light mode support
|
|
51
|
+
- 📋 Copy code and console output
|
|
52
|
+
- ↔️ Resizable editor/console panels
|
|
53
|
+
- 🔌 WebSocket-based code execution
|
|
54
|
+
- 🎯 TypeScript support
|
|
55
|
+
- 📦 Zero configuration required
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
MIT
|
package/dist/NotJS.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ExecutionRequest {
|
|
2
|
+
language: string;
|
|
3
|
+
code: string;
|
|
4
|
+
version: string | null;
|
|
5
|
+
arguments: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface NotJSProps {
|
|
8
|
+
websocketUrl?: string;
|
|
9
|
+
apiBaseUrl?: string;
|
|
10
|
+
initialCode?: string;
|
|
11
|
+
initialLanguage?: string;
|
|
12
|
+
initialVersion?: string;
|
|
13
|
+
initialDarkMode?: boolean;
|
|
14
|
+
hideHeader?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export default function NotJS({ websocketUrl, apiBaseUrl, initialCode, initialLanguage, initialVersion, initialDarkMode, hideHeader }: NotJSProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=NotJS.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotJS.d.ts","sourceRoot":"","sources":["../src/NotJS.tsx"],"names":[],"mappings":"AAGA,OAAO,4BAA4B,CAAA;AAwCnC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,SAAS,EAAE,MAAM,EAAE,CAAA;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,YAA6C,EAC7C,UAAwC,EACxC,WAAW,EACX,eAAwB,EACxB,cAAqB,EACrB,eAAsB,EACtB,UAAkB,EACnB,EAAE,UAAU,2CA8lBZ"}
|