@leaders-tech/schemio-playground 0.1.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 +69 -0
- package/embed-dist/chunks/SchemioPlaygroundMount-DdNsPNrS.js +28212 -0
- package/embed-dist/schemio-playground.js +58 -0
- package/package.json +79 -0
- package/schemio-playground.d.ts +18 -0
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Schemio playground web component
|
|
2
|
+
|
|
3
|
+
This package registers a lazy-loaded `<schemio-playground>` custom element. It
|
|
4
|
+
contains a Schemio editor, helpful diagnostics, a live input/output debugger,
|
|
5
|
+
and optional browser-local saving.
|
|
6
|
+
|
|
7
|
+
Edit this file when the package API, installation command, or release process
|
|
8
|
+
changes. Copy it when another standalone web component needs a short package
|
|
9
|
+
guide.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
After the package is published to npm, add it to a TypeScript or JavaScript
|
|
14
|
+
project with:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pnpm add @leaders-tech/schemio-playground
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Before the first npm publication, or to use the latest repository version,
|
|
21
|
+
install it directly from GitHub:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add github:leaders-tech/scheme#path:/frontend
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The repository includes the ready-built component, so the GitHub form does not
|
|
28
|
+
run installation scripts. Use a versioned npm release for production course
|
|
29
|
+
sites.
|
|
30
|
+
|
|
31
|
+
## Use it
|
|
32
|
+
|
|
33
|
+
Import the package once in the application's browser entry point:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import "@leaders-tech/schemio-playground";
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Then put the element in a page or a framework template:
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<schemio-playground storage-key="cs0040-prob-a-xor">
|
|
43
|
+
<script type="text/plain">
|
|
44
|
+
scheme (a b) xor (out):
|
|
45
|
+
local either both not_both
|
|
46
|
+
(a b) or (either)
|
|
47
|
+
(a b) and (both)
|
|
48
|
+
(both) not (not_both)
|
|
49
|
+
(either not_both) and (out)
|
|
50
|
+
end
|
|
51
|
+
</script>
|
|
52
|
+
</schemio-playground>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`storage-key` is strongly recommended: the user's code is saved under that
|
|
56
|
+
key in `localStorage`. Add `storage="off"` to disable saving, or `readonly` to
|
|
57
|
+
show a non-editable program.
|
|
58
|
+
|
|
59
|
+
The element dispatches a bubbling `schemio-change` event after every edit. Its
|
|
60
|
+
`event.detail` contains `{ source, isValid }`.
|
|
61
|
+
|
|
62
|
+
## Release the package
|
|
63
|
+
|
|
64
|
+
The GitHub Actions workflow publishes the package after a tag named
|
|
65
|
+
`schemio-playground-v<package version>` is pushed, for example
|
|
66
|
+
`schemio-playground-v0.1.0`. It first runs the tests, builds the package, and
|
|
67
|
+
installs the resulting tarball with pnpm. Publishing needs an `NPM_TOKEN`
|
|
68
|
+
repository secret that may publish the `@leaders-tech` npm scope. Without that
|
|
69
|
+
secret the verification job still runs, while publishing is skipped.
|