code-playpad 0.10.0 → 0.11.0
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 +218 -17
- package/dist/THIRD-PARTY-NOTICES.txt +223 -0
- package/dist/cdn.js +2 -2
- package/dist/compiler-B408qd3N.js +151 -0
- package/dist/{config-CT3H6Oum.js → config-DB58UVsk.js} +1 -1
- package/dist/{cpp-CO2abWii.js → cpp-C77X5wRk.js} +1 -1
- package/dist/{cpp-Cs32J8JC.js → cpp-DuOQ_23Z.js} +1 -1
- package/dist/{dist-DXjodKfp.js → dist-B4dyQ4mN.js} +1 -1
- package/dist/{dist-BkpKCrXQ.js → dist-BFlbXnjn.js} +1 -1
- package/dist/dist-BoJapv5W.js +28 -0
- package/dist/dist-BqLa1O1y.js +6 -0
- package/dist/dist-CJRlQ049.js +6 -0
- package/dist/{dist-CJxiVI4a.js → dist-DBpvb9b1.js} +1 -1
- package/dist/{dist-BIgiGgKu.js → dist-DRocX-cv.js} +1 -1
- package/dist/dist-DfjaG4Ra.js +6 -0
- package/dist/{dist-D2igTc4m.js → dist-DviSDQoT.js} +1 -1
- package/dist/dist-F28mE6nM.js +8 -0
- package/dist/{dist-CNOK8CHE.js → dist-TxeNlzAy.js} +1 -1
- package/dist/dist-y6lcdYKh.js +14 -0
- package/dist/element-COcjM0hI.js +521 -0
- package/dist/element.d.ts +26 -0
- package/dist/element.js +1 -1
- package/dist/hints-DpBIeoeG.js +6 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/{java-DeBiVPXO.js → java-Df5HdXMz.js} +1 -1
- package/dist/{java-8qjVCjsN.js → java-DyH3mSiH.js} +1 -1
- package/dist/{javascript-DLPaJJzf.js → javascript-BtHVyxzg.js} +2 -2
- package/dist/{javascript-B1tVx7AD.js → javascript-CWolHiSP.js} +1 -1
- package/dist/languages.d.ts +1 -1
- package/dist/{pyodide-BOoYEfX1.js → pyodide-3MPS4ySA.js} +2 -2
- package/dist/{pyodide-C8ImkXdD.js → pyodide-EUDn__Gx.js} +1 -1
- package/dist/react-CL1KABFm.js +9 -0
- package/dist/react-Db_rGDYu.js +4 -0
- package/dist/react-runtime-19.2.8.js +240 -0
- package/dist/react-vendor.generated-DMxIoCMn.js +6 -0
- package/dist/react-version.generated-BNNJmf7J.js +6 -0
- package/dist/react.d.ts +5 -1
- package/dist/react.js +1 -1
- package/dist/runtime/config.d.ts +15 -1
- package/dist/runtime/react/boot.d.ts +9 -0
- package/dist/runtime/react/compiler.d.ts +30 -0
- package/dist/runtime/react-vendor.generated.d.ts +5 -0
- package/dist/runtime/react-version.generated.d.ts +3 -0
- package/dist/runtime/react.d.ts +2 -0
- package/dist/standalone.js +214 -17
- package/dist/{hints-CCMgezw9.js → types-CfcYqU2K.js} +1 -1
- package/dist/types.d.ts +23 -0
- package/dist/worker-runtime-DvpugeXD.js +9 -0
- package/dist/{worker-runtime-sUPz1J56.js → worker-runtime-PykJQLB7.js} +1 -1
- package/package.json +21 -6
- package/dist/dist--J_vhCIU.js +0 -14
- package/dist/dist-BNvM_BAY.js +0 -6
- package/dist/dist-D7jBL3Ib.js +0 -28
- package/dist/dist-DfFrsBkU.js +0 -8
- package/dist/element-CQGYVEF7.js +0 -324
- package/dist/worker-runtime-DfYet3xy.js +0 -9
package/README.md
CHANGED
|
@@ -3,21 +3,21 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/code-playpad) [](./LICENSE)
|
|
4
4
|
|
|
5
5
|
Runnable code in any web page. A CodeMirror editor that **executes what it
|
|
6
|
-
shows** — Python, JavaScript, TypeScript
|
|
7
|
-
entirely in the reader's browser. No backend, no iframe, no sign-up.
|
|
6
|
+
shows** — Python, JavaScript, TypeScript, a documented subset of Java, and
|
|
7
|
+
experimental C and C++ — entirely in the reader's browser. No backend, no iframe, no sign-up.
|
|
8
8
|
|
|
9
9
|
**[Live demo →](https://code-playpad.swengr.com)**
|
|
10
10
|
|
|
11
11
|
```html
|
|
12
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/code-playpad@0.
|
|
12
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/code-playpad@0.11.0/dist/standalone.js"></script>
|
|
13
13
|
|
|
14
14
|
<code-playpad height="auto">
|
|
15
15
|
print("hello from a static page")
|
|
16
16
|
</code-playpad>
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
**Contents** — [Languages](#languages) · [
|
|
20
|
-
· [Sizing](#sizing) · [Several files](#several-files) · [Input](#input)
|
|
19
|
+
**Contents** — [Languages](#languages) · [Experimental C/C++](#experimental-cc) · [React](#react)
|
|
20
|
+
· [Install](#install) · [Attributes](#attributes) · [Sizing](#sizing) · [Several files](#several-files) · [Input](#input)
|
|
21
21
|
· [Controlling it from JavaScript](#controlling-it-from-javascript)
|
|
22
22
|
· [Events and grading](#events-and-grading) · [Saving work](#saving-work)
|
|
23
23
|
· [Light and dark](#light-and-dark) · [Styling](#styling) · [Framework recipes](#framework-recipes)
|
|
@@ -31,6 +31,8 @@ entirely in the reader's browser. No backend, no iframe, no sign-up.
|
|
|
31
31
|
| `javascript` | The browser's own engine, in a Worker | nothing |
|
|
32
32
|
| `typescript` | Same engine, types stripped before running | nothing from another service: a ~47 KB (gzipped) transform chunk of this package, loaded the first time a widget needs it |
|
|
33
33
|
| `java` | A documented subset of Java 25, compiled and interpreted in a Worker by an engine built for this package — see [Java](#java) | nothing: the engine is a ~105 KB (gzipped) chunk of this package, loaded with the first Java widget, and its library a ~75 KB chunk loaded the first time a program uses it |
|
|
34
|
+
| `c`, `cpp` | Experimental: C17 and C++20, compiled by a real Clang compiler in a Worker — see [Experimental C/C++](#experimental-cc) | ~30 MB on the first C/C++ Run, then cached |
|
|
35
|
+
| `react` | A multi-file React project, rendered in a sandboxed preview with a console — see [React](#react) | nothing from another service: ~208 KB (gzipped) of this package's chunks, loaded with the first React widget |
|
|
34
36
|
|
|
35
37
|
```html
|
|
36
38
|
<code-playpad height="auto">print("python is the default")</code-playpad>
|
|
@@ -162,17 +164,158 @@ the evidence behind it and every known difference from the JDK, is in
|
|
|
162
164
|
## Experimental C/C++
|
|
163
165
|
|
|
164
166
|
`language="c"` (C17) and `language="cpp"` (C++20) compile and run in a worker
|
|
165
|
-
with a real Clang compiler, prefilled stdin and Stop.
|
|
167
|
+
with a real Clang compiler, prefilled stdin and Stop. No setup is needed:
|
|
168
|
+
|
|
169
|
+
```html
|
|
170
|
+
<code-playpad language="cpp" height="auto">
|
|
171
|
+
#include <algorithm>
|
|
172
|
+
#include <iostream>
|
|
173
|
+
#include <vector>
|
|
174
|
+
|
|
175
|
+
int main() {
|
|
176
|
+
std::vector<int> v{3, 1, 2};
|
|
177
|
+
std::sort(v.begin(), v.end());
|
|
178
|
+
for (int n : v) std::cout << n << " ";
|
|
179
|
+
}
|
|
180
|
+
</code-playpad>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Inside HTML, write `<` as `<`. They are experimental:
|
|
166
184
|
|
|
167
185
|
- **The compiler loads on the first C/C++ Run.** It is a separate package,
|
|
168
186
|
[`@code-playpad/cpp-toolchain`](https://www.npmjs.com/package/@code-playpad/cpp-toolchain),
|
|
169
|
-
fetched from jsDelivr and checked by SHA-256.
|
|
170
|
-
|
|
187
|
+
fetched from jsDelivr and checked by SHA-256. You don't install it, and
|
|
188
|
+
installing `code-playpad` doesn't download it. A page with a strict
|
|
189
|
+
Content-Security-Policy must allow the host in `connect-src`, `blob:` in
|
|
190
|
+
`script-src` and `worker-src`, and `'wasm-unsafe-eval'`. To host it yourself, see
|
|
191
|
+
[Production](#production).
|
|
192
|
+
- **Not everything works.** Exceptions and threads don't compile, input must be
|
|
193
|
+
prefilled (it can't wait for typing), and programs only get stdin, stdout and
|
|
194
|
+
stderr. A run stops after 120 seconds; change that with
|
|
195
|
+
`configureCpp({ timeoutMs })`.
|
|
171
196
|
- **Lightly tested on phones.** Desktop Chromium, WebKit and Firefox pass the
|
|
172
197
|
browser suite. One physical phone was checked by hand; memory on phones has
|
|
173
198
|
not been measured.
|
|
174
199
|
|
|
175
|
-
|
|
200
|
+
## React
|
|
201
|
+
|
|
202
|
+
`language="react"` renders a React project next to the editor, in a sandboxed
|
|
203
|
+
frame the reader can click and type into, with a console under it. The layout
|
|
204
|
+
matches `npm create vite`.
|
|
205
|
+
|
|
206
|
+
```html
|
|
207
|
+
<code-playpad language="react" height="auto" preview-height="320" autorun>
|
|
208
|
+
<playpad-file name="src/main.jsx">
|
|
209
|
+
<script type="text/plain">
|
|
210
|
+
import { createRoot } from "react-dom/client";
|
|
211
|
+
import App from "./App.jsx";
|
|
212
|
+
import "./styles.css";
|
|
213
|
+
createRoot(document.getElementById("root")).render(<App />);
|
|
214
|
+
</script>
|
|
215
|
+
</playpad-file>
|
|
216
|
+
<playpad-file name="src/App.jsx">
|
|
217
|
+
<script type="text/plain">
|
|
218
|
+
import { useState } from "react";
|
|
219
|
+
export default function App() {
|
|
220
|
+
const [count, setCount] = useState(0);
|
|
221
|
+
return <button onClick={() => setCount(count + 1)}>Clicked {count} times</button>;
|
|
222
|
+
}
|
|
223
|
+
</script>
|
|
224
|
+
</playpad-file>
|
|
225
|
+
<playpad-file name="src/styles.css">
|
|
226
|
+
button { font-size: 1.2rem; }
|
|
227
|
+
</playpad-file>
|
|
228
|
+
</code-playpad>
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Add `file-view="tree"` to list the files as a folder tree beside the editor instead
|
|
232
|
+
of as tabs. It works for every language.
|
|
233
|
+
|
|
234
|
+
**Writing files in a page.** HTML reads JSX as tags, so `<App />` would vanish.
|
|
235
|
+
Use one of these:
|
|
236
|
+
|
|
237
|
+
- Put the code in `<script type="text/plain">`, as above: it stays exact and never
|
|
238
|
+
runs. It can't hold `</script>`.
|
|
239
|
+
- Write `<` as `<`, the way every other language does.
|
|
240
|
+
- Set `pad.files = { ... }` from JavaScript, the easiest for generated lessons.
|
|
241
|
+
|
|
242
|
+
An unescaped `<script>` inside `<playpad-file>` **runs on your page**, outside the
|
|
243
|
+
sandbox. The widget warns about tags it finds in a file's markup, but by then that
|
|
244
|
+
script has already run.
|
|
245
|
+
|
|
246
|
+
**The project.**
|
|
247
|
+
|
|
248
|
+
- `index.html` is optional. Without it, the preview uses `<div id="root"></div>` and
|
|
249
|
+
runs `src/main.jsx`. With it, its `<script src="/src/main.jsx">` and project
|
|
250
|
+
stylesheet links name the entry files, and nothing fetches them.
|
|
251
|
+
- Files can be in folders. Imports resolve as in Vite: `./` and `../`, and a missing
|
|
252
|
+
extension tries `.jsx`, `.js`, `/index.jsx` and `/index.js`.
|
|
253
|
+
- `import "./styles.css"` adds a `<style>`, and `.json` imports as data.
|
|
254
|
+
- The packages are `react`, `react-dom/client`, `react/jsx-runtime` and
|
|
255
|
+
`react/jsx-dev-runtime`. Any other import is an error naming the package and file.
|
|
256
|
+
`.tsx` and CSS Modules aren't supported.
|
|
257
|
+
- React is **19.2.8, the development build**, pinned so quoted warnings stay the same.
|
|
258
|
+
|
|
259
|
+
**Attributes and layout.** `preview-height` sets the preview's height (default 320
|
|
260
|
+
pixels). The preview sits beside the editor when the widget is at least 760px wide,
|
|
261
|
+
and under it otherwise; that depends on the widget's width, not the screen's. It runs
|
|
262
|
+
on Run or Ctrl/⌘+Enter, and when it nears the viewport if you set `autorun`.
|
|
263
|
+
|
|
264
|
+
**Resizing.** Drag the dividers between the file tree, the code, the preview and the
|
|
265
|
+
console, or focus one and use the arrow keys. Double-click a divider to undo. **Open in
|
|
266
|
+
window** moves the project to a separate window that fills with the sections, and
|
|
267
|
+
**Bring back here** or closing that window returns it with its edits. The page keeps
|
|
268
|
+
getting the widget's events. `pad.openWindow()` and `pad.closeWindow()` do the same; call
|
|
269
|
+
`openWindow()` from a click, or the browser blocks it. To hide the button, use
|
|
270
|
+
`code-playpad::part(window-button) { display: none; }`.
|
|
271
|
+
|
|
272
|
+
**Errors.** Compile errors name the file, line and column, with a hint for common JSX
|
|
273
|
+
mistakes. Console output goes to the console pane, with React's warnings formatted,
|
|
274
|
+
and any error also shows as a banner over the preview. A warning doesn't fail a run.
|
|
275
|
+
Runtime errors name the file and line, except in Safari, which keeps that from the
|
|
276
|
+
page. An error from a listener added with `addEventListener` reaches Safari's preview
|
|
277
|
+
only as a note to open the developer console.
|
|
278
|
+
|
|
279
|
+
**The sandbox.** Code runs in `<iframe sandbox="allow-scripts allow-forms">`, with an
|
|
280
|
+
opaque origin and its own Content-Security-Policy, so it can't reach your page's DOM,
|
|
281
|
+
cookies or storage, or use the network.
|
|
282
|
+
|
|
283
|
+
- `alert()` shows a notice instead of a dialog, because an open dialog freezes your
|
|
284
|
+
page. `confirm()` returns `true` and `prompt()` returns `null`, each with a console
|
|
285
|
+
note.
|
|
286
|
+
- **Infinite loops.** A loop in a project's `.js` or `.jsx` file throws after running
|
|
287
|
+
for 1 second without a break: *This loop ran for more than 1 second. Is it infinite?*
|
|
288
|
+
A loop that awaits a timer between steps never trips this. Inline `<script>` in
|
|
289
|
+
`index.html` isn't guarded, and neither is one very long call. If those hang, Stop
|
|
290
|
+
ends them only where the browser gives the frame its own process, as desktop Chrome
|
|
291
|
+
does; elsewhere the whole page can freeze.
|
|
292
|
+
- Each live preview costs about 6–17 MB.
|
|
293
|
+
|
|
294
|
+
### Host pages with a CSP
|
|
295
|
+
|
|
296
|
+
Your page's Content-Security-Policy also applies inside the frame. Without
|
|
297
|
+
`'unsafe-inline'`, the frame needs a nonce: the widget uses the first
|
|
298
|
+
`<script nonce>` on the page, or `configureReact({ nonce })`. It puts the nonce on its
|
|
299
|
+
scripts and on the styles from CSS imports. A blocked preview shows an error after 5
|
|
300
|
+
seconds rather than staying blank.
|
|
301
|
+
|
|
302
|
+
| Your page's policy | Works? |
|
|
303
|
+
| --- | --- |
|
|
304
|
+
| None, or `'unsafe-inline'` in `script-src` and `style-src` | Yes |
|
|
305
|
+
| `script-src 'self' 'nonce-…'; style-src 'self' 'nonce-…'` | Yes, with the nonce. A `<style>` or inline script written in `index.html` is blocked |
|
|
306
|
+
| `script-src 'nonce-…' 'strict-dynamic'` | Yes, with the nonce, but not with `runtimeURL` |
|
|
307
|
+
|
|
308
|
+
This package's tests cover the first two rows, except inline `<style>` and scripts in `index.html`. The rest were checked in Chromium only.
|
|
309
|
+
|
|
310
|
+
### Serving the runtime yourself
|
|
311
|
+
|
|
312
|
+
By default the page sends React to the frame. To have frames load it from a URL, which
|
|
313
|
+
starts many widgets a little faster, serve `dist/react-runtime-19.2.8.js` and:
|
|
314
|
+
|
|
315
|
+
```js
|
|
316
|
+
import { configureReact } from 'code-playpad';
|
|
317
|
+
configureReact({ runtimeURL: 'https://your-site.example/react-runtime-19.2.8.js' }); // before any widget runs
|
|
318
|
+
```
|
|
176
319
|
|
|
177
320
|
## Download size
|
|
178
321
|
|
|
@@ -245,7 +388,7 @@ actually sent.
|
|
|
245
388
|
### From a CDN — nothing to install
|
|
246
389
|
|
|
247
390
|
```html
|
|
248
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/code-playpad@0.
|
|
391
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/code-playpad@0.11.0/dist/standalone.js"></script>
|
|
249
392
|
```
|
|
250
393
|
|
|
251
394
|
This is the `standalone` build: CodeMirror is bundled in, so a static blog post
|
|
@@ -267,7 +410,8 @@ npm install code-playpad @codemirror/state @codemirror/view @codemirror/commands
|
|
|
267
410
|
CodeMirror is a peer dependency so you never end up with two copies of
|
|
268
411
|
`@codemirror/state`. Language grammars are **optional** — install only what you
|
|
269
412
|
use (`@codemirror/lang-python`, `@codemirror/lang-javascript`,
|
|
270
|
-
`@codemirror/lang-json`, `@codemirror/lang-java
|
|
413
|
+
`@codemirror/lang-json`, `@codemirror/lang-java`, `@codemirror/lang-cpp`, and for React
|
|
414
|
+
`@codemirror/lang-css` and `@codemirror/lang-html`); a missing one degrades to
|
|
271
415
|
plain text rather than throwing.
|
|
272
416
|
|
|
273
417
|
```js
|
|
@@ -298,9 +442,12 @@ Next.js, Astro and SvelteKit need no dynamic import or `client:only` guard.
|
|
|
298
442
|
|
|
299
443
|
| | |
|
|
300
444
|
| --- | --- |
|
|
301
|
-
| `language` | `python` (default), `javascript`, `typescript`, `java` |
|
|
445
|
+
| `language` | `python` (default), `javascript`, `typescript`, `java`, `c`, `cpp`, `react` |
|
|
302
446
|
| `height` | number (px), any CSS length, or `auto` |
|
|
303
447
|
| `min-height` / `max-height` | bounds for `auto` |
|
|
448
|
+
| `preview-height` | `react` only: the preview's height |
|
|
449
|
+
| `file-view` | how a widget with several files lists them: `tabs` (default) or `tree` |
|
|
450
|
+
| `open-file` | which file is on screen to begin with, when not the entry |
|
|
304
451
|
| `theme` | `light`, `dark`, or `auto` (default — follows the OS) |
|
|
305
452
|
| `readonly` | editor cannot be typed into; Run still works |
|
|
306
453
|
| `autorun` | runs once, on its own, when scrolled into view |
|
|
@@ -412,9 +559,8 @@ JavaScript and TypeScript work the same way, including `.json` imported as data:
|
|
|
412
559
|
Java compiles the other files as `java Main.java` does (JDK 25's source
|
|
413
560
|
launcher): `Main.java` runs, and `Session.java` is compiled when `Main` first
|
|
414
561
|
uses `Session`. Each file is named after its class and has its own imports, and
|
|
415
|
-
errors and stack traces name the file.
|
|
416
|
-
|
|
417
|
-
not supported yet. Write `<` as `<` inside the markup (`List<String>`),
|
|
562
|
+
errors and stack traces name the file. A `.java` file in a folder belongs to that
|
|
563
|
+
folder's package (`util/Tool.java` declares `package util;`). Write `<` as `<` inside the markup (`List<String>`),
|
|
418
564
|
since it is HTML:
|
|
419
565
|
|
|
420
566
|
```html
|
|
@@ -567,6 +713,20 @@ the run's own status decides: an exception, a compile error or a non-zero
|
|
|
567
713
|
from a program that finished normally do not. That is how a terminal reads it;
|
|
568
714
|
the warnings are still printed, and still in `stderr`.
|
|
569
715
|
|
|
716
|
+
React differs, because an app keeps running after its run:
|
|
717
|
+
|
|
718
|
+
- `playpad-run` fires when the run starts, and `playpad-output` when the entry module
|
|
719
|
+
has loaded. `failed` is true only if loading threw. The output holds the console lines
|
|
720
|
+
so far.
|
|
721
|
+
- `playpad-error` also fires for later errors, such as one in a click handler, and adds
|
|
722
|
+
`file`, `line` and `column` when known.
|
|
723
|
+
- `playpad-console` fires per line, with `{ level, text, language }`.
|
|
724
|
+
- `playpad-render` fires after `#root` changes, at most every 100 ms, with
|
|
725
|
+
`{ rootText, language }`. Learner code can forge it, so use it to check a lesson, not
|
|
726
|
+
as proof of completion.
|
|
727
|
+
|
|
728
|
+
These two new events have no `py-*` name.
|
|
729
|
+
|
|
570
730
|
A complete exercise check:
|
|
571
731
|
|
|
572
732
|
```html
|
|
@@ -854,6 +1014,19 @@ self-contained ES module exporting `transform`), set before the first
|
|
|
854
1014
|
JavaScript or TypeScript widget starts its runtime. Give those files a long `Cache-Control`: one page's download then
|
|
855
1015
|
warms every other page on the site.
|
|
856
1016
|
|
|
1017
|
+
C and C++ load their compiler from jsDelivr unless you host it. To host it, unpack
|
|
1018
|
+
[`@code-playpad/cpp-toolchain`](https://www.npmjs.com/package/@code-playpad/cpp-toolchain),
|
|
1019
|
+
keep its version and notices together, and serve its `dist` folder:
|
|
1020
|
+
|
|
1021
|
+
```js
|
|
1022
|
+
import { configureCpp } from 'code-playpad';
|
|
1023
|
+
|
|
1024
|
+
configureCpp({ indexURL: 'https://your-site.example/cpp-toolchain/dist/' }); // before any widget runs
|
|
1025
|
+
```
|
|
1026
|
+
|
|
1027
|
+
Use the toolchain version that your `code-playpad` version pins: every file is
|
|
1028
|
+
checked by SHA-256, so another version fails. A different origin must allow CORS.
|
|
1029
|
+
|
|
857
1030
|
## Worth knowing
|
|
858
1031
|
|
|
859
1032
|
- **One runtime per page.** Every widget shares a single Worker per language, so
|
|
@@ -876,6 +1049,34 @@ warms every other page on the site.
|
|
|
876
1049
|
|
|
877
1050
|
## Version history
|
|
878
1051
|
|
|
1052
|
+
### 0.11.0
|
|
1053
|
+
|
|
1054
|
+
**React.** `language="react"` renders a multi-file React project in a sandboxed preview
|
|
1055
|
+
with a console. See [React](#react). The other languages run as before.
|
|
1056
|
+
|
|
1057
|
+
- **New:** the `preview-height` attribute, `previewHeight` on the React wrapper,
|
|
1058
|
+
`configureReact({ runtimeURL, nonce })`, `REACT_VERSION`, and the `playpad-console` and
|
|
1059
|
+
`playpad-render` events.
|
|
1060
|
+
- **Pinned:** React 19.2.8, development build.
|
|
1061
|
+
- **For every language:** code in `<playpad-file>` can be written in
|
|
1062
|
+
`<script type="text/plain">`, `.css` and `.html` files are highlighted, and tabs show a
|
|
1063
|
+
file's folder in a muted colour.
|
|
1064
|
+
- **New `file-view="tree"` attribute, for every language,** with `fileView` on the React wrapper: list files in a folder tree instead of tabs.
|
|
1065
|
+
- **Resizing:** draggable dividers between sections, and an Open in window button for React, with `pad.openWindow()` and `pad.closeWindow()`. The tree's divider works for every language.
|
|
1066
|
+
- **New `open-file` attribute, for every language:** which file a widget shows first.
|
|
1067
|
+
- **New optional peer dependencies:** `@codemirror/lang-css` and `@codemirror/lang-html`.
|
|
1068
|
+
- **Corrected:** the README still said Java files can't be in folders, which stopped
|
|
1069
|
+
being true in 0.8.0.
|
|
1070
|
+
|
|
1071
|
+
### 0.10.1
|
|
1072
|
+
|
|
1073
|
+
Documentation only: nothing changes in how the widget runs.
|
|
1074
|
+
|
|
1075
|
+
- **The README's opening** now mentions C and C++, in the intro, the Languages table
|
|
1076
|
+
and the contents, and its snippets pin the current version.
|
|
1077
|
+
- **The C/C++ section** has an example, its limits, CSP needs and self-hosting steps.
|
|
1078
|
+
- **Removed links to private files,** which readers couldn't open.
|
|
1079
|
+
|
|
879
1080
|
### 0.10.0
|
|
880
1081
|
|
|
881
1082
|
C and C++ now work with no setup. Nothing else changed.
|
|
@@ -1247,8 +1448,8 @@ this package.
|
|
|
1247
1448
|
Experimental C/C++ downloads separate compiler assets with additional
|
|
1248
1449
|
third-party terms; those assets are not MIT-only. Their notices ship in
|
|
1249
1450
|
`dist/COMPILER-NOTICES.txt`. The pinned C/C++ rebuild passes its scoped license
|
|
1250
|
-
inventory gate; see
|
|
1251
|
-
|
|
1451
|
+
inventory gate; see `dist/COMPILER-LICENSE-AUDIT.md`. Programs compiled here
|
|
1452
|
+
include parts of the C and C++ libraries, which have their own terms.
|
|
1252
1453
|
|
|
1253
1454
|
The Java engine is original code under the same MIT licence. Java is a trademark
|
|
1254
1455
|
of Oracle and/or its affiliates; code-playpad is not affiliated with, endorsed
|
|
@@ -105,6 +105,56 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
105
105
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
106
106
|
THE SOFTWARE.
|
|
107
107
|
|
|
108
|
+
==============================================================================
|
|
109
|
+
@codemirror/lang-css 6.3.1 — MIT
|
|
110
|
+
|
|
111
|
+
MIT License
|
|
112
|
+
|
|
113
|
+
Copyright (C) 2018-2021 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
|
|
114
|
+
|
|
115
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
116
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
117
|
+
in the Software without restriction, including without limitation the rights
|
|
118
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
119
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
120
|
+
furnished to do so, subject to the following conditions:
|
|
121
|
+
|
|
122
|
+
The above copyright notice and this permission notice shall be included in
|
|
123
|
+
all copies or substantial portions of the Software.
|
|
124
|
+
|
|
125
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
126
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
127
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
128
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
129
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
130
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
131
|
+
THE SOFTWARE.
|
|
132
|
+
|
|
133
|
+
==============================================================================
|
|
134
|
+
@codemirror/lang-html 6.4.12 — MIT
|
|
135
|
+
|
|
136
|
+
MIT License
|
|
137
|
+
|
|
138
|
+
Copyright (C) 2018-2021 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
|
|
139
|
+
|
|
140
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
141
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
142
|
+
in the Software without restriction, including without limitation the rights
|
|
143
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
144
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
145
|
+
furnished to do so, subject to the following conditions:
|
|
146
|
+
|
|
147
|
+
The above copyright notice and this permission notice shall be included in
|
|
148
|
+
all copies or substantial portions of the Software.
|
|
149
|
+
|
|
150
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
151
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
152
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
153
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
154
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
155
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
156
|
+
THE SOFTWARE.
|
|
157
|
+
|
|
108
158
|
==============================================================================
|
|
109
159
|
@codemirror/lang-java 6.0.2 — MIT
|
|
110
160
|
|
|
@@ -447,6 +497,31 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
447
497
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
448
498
|
THE SOFTWARE.
|
|
449
499
|
|
|
500
|
+
==============================================================================
|
|
501
|
+
@lezer/css 1.3.9 — MIT
|
|
502
|
+
|
|
503
|
+
MIT License
|
|
504
|
+
|
|
505
|
+
Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
|
|
506
|
+
|
|
507
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
508
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
509
|
+
in the Software without restriction, including without limitation the rights
|
|
510
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
511
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
512
|
+
furnished to do so, subject to the following conditions:
|
|
513
|
+
|
|
514
|
+
The above copyright notice and this permission notice shall be included in
|
|
515
|
+
all copies or substantial portions of the Software.
|
|
516
|
+
|
|
517
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
518
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
519
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
520
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
521
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
522
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
523
|
+
THE SOFTWARE.
|
|
524
|
+
|
|
450
525
|
==============================================================================
|
|
451
526
|
@lezer/highlight 1.2.3 — MIT
|
|
452
527
|
|
|
@@ -472,6 +547,31 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
472
547
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
473
548
|
THE SOFTWARE.
|
|
474
549
|
|
|
550
|
+
==============================================================================
|
|
551
|
+
@lezer/html 1.3.13 — MIT
|
|
552
|
+
|
|
553
|
+
MIT License
|
|
554
|
+
|
|
555
|
+
Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
|
|
556
|
+
|
|
557
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
558
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
559
|
+
in the Software without restriction, including without limitation the rights
|
|
560
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
561
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
562
|
+
furnished to do so, subject to the following conditions:
|
|
563
|
+
|
|
564
|
+
The above copyright notice and this permission notice shall be included in
|
|
565
|
+
all copies or substantial portions of the Software.
|
|
566
|
+
|
|
567
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
568
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
569
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
570
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
571
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
572
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
573
|
+
THE SOFTWARE.
|
|
574
|
+
|
|
475
575
|
==============================================================================
|
|
476
576
|
@lezer/java 1.1.5 — MIT
|
|
477
577
|
|
|
@@ -622,6 +722,54 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
622
722
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
623
723
|
THE SOFTWARE.
|
|
624
724
|
|
|
725
|
+
==============================================================================
|
|
726
|
+
acorn 8.15.0 — MIT
|
|
727
|
+
|
|
728
|
+
MIT License
|
|
729
|
+
|
|
730
|
+
Copyright (C) 2012-2022 by various contributors (see AUTHORS)
|
|
731
|
+
|
|
732
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
733
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
734
|
+
in the Software without restriction, including without limitation the rights
|
|
735
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
736
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
737
|
+
furnished to do so, subject to the following conditions:
|
|
738
|
+
|
|
739
|
+
The above copyright notice and this permission notice shall be included in
|
|
740
|
+
all copies or substantial portions of the Software.
|
|
741
|
+
|
|
742
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
743
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
744
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
745
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
746
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
747
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
748
|
+
THE SOFTWARE.
|
|
749
|
+
|
|
750
|
+
==============================================================================
|
|
751
|
+
acorn-jsx 5.3.2 — MIT
|
|
752
|
+
|
|
753
|
+
Copyright (C) 2012-2017 by Ingvar Stepanyan
|
|
754
|
+
|
|
755
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
756
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
757
|
+
in the Software without restriction, including without limitation the rights
|
|
758
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
759
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
760
|
+
furnished to do so, subject to the following conditions:
|
|
761
|
+
|
|
762
|
+
The above copyright notice and this permission notice shall be included in
|
|
763
|
+
all copies or substantial portions of the Software.
|
|
764
|
+
|
|
765
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
766
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
767
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
768
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
769
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
770
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
771
|
+
THE SOFTWARE.
|
|
772
|
+
|
|
625
773
|
==============================================================================
|
|
626
774
|
crelt 1.0.7 — MIT
|
|
627
775
|
|
|
@@ -670,6 +818,81 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
670
818
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
671
819
|
THE SOFTWARE.
|
|
672
820
|
|
|
821
|
+
==============================================================================
|
|
822
|
+
react 19.2.8 — MIT
|
|
823
|
+
|
|
824
|
+
MIT License
|
|
825
|
+
|
|
826
|
+
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
827
|
+
|
|
828
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
829
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
830
|
+
in the Software without restriction, including without limitation the rights
|
|
831
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
832
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
833
|
+
furnished to do so, subject to the following conditions:
|
|
834
|
+
|
|
835
|
+
The above copyright notice and this permission notice shall be included in all
|
|
836
|
+
copies or substantial portions of the Software.
|
|
837
|
+
|
|
838
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
839
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
840
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
841
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
842
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
843
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
844
|
+
SOFTWARE.
|
|
845
|
+
|
|
846
|
+
==============================================================================
|
|
847
|
+
react-dom 19.2.8 — MIT
|
|
848
|
+
|
|
849
|
+
MIT License
|
|
850
|
+
|
|
851
|
+
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
852
|
+
|
|
853
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
854
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
855
|
+
in the Software without restriction, including without limitation the rights
|
|
856
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
857
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
858
|
+
furnished to do so, subject to the following conditions:
|
|
859
|
+
|
|
860
|
+
The above copyright notice and this permission notice shall be included in all
|
|
861
|
+
copies or substantial portions of the Software.
|
|
862
|
+
|
|
863
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
864
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
865
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
866
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
867
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
868
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
869
|
+
SOFTWARE.
|
|
870
|
+
|
|
871
|
+
==============================================================================
|
|
872
|
+
scheduler 0.27.0 — MIT
|
|
873
|
+
|
|
874
|
+
MIT License
|
|
875
|
+
|
|
876
|
+
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
877
|
+
|
|
878
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
879
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
880
|
+
in the Software without restriction, including without limitation the rights
|
|
881
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
882
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
883
|
+
furnished to do so, subject to the following conditions:
|
|
884
|
+
|
|
885
|
+
The above copyright notice and this permission notice shall be included in all
|
|
886
|
+
copies or substantial portions of the Software.
|
|
887
|
+
|
|
888
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
889
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
890
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
891
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
892
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
893
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
894
|
+
SOFTWARE.
|
|
895
|
+
|
|
673
896
|
==============================================================================
|
|
674
897
|
style-mod 4.1.3 — MIT
|
|
675
898
|
|
package/dist/cdn.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! code-playpad 0.
|
|
2
|
-
export * from "https://cdn.jsdelivr.net/npm/code-playpad@0.
|
|
1
|
+
/*! code-playpad 0.11.0: CDN entry, loads dist/standalone.js of this exact version */
|
|
2
|
+
export * from "https://cdn.jsdelivr.net/npm/code-playpad@0.11.0/dist/standalone.js";
|