@startside/swa 1.0.0 → 1.0.1
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/LICENSE +60 -0
- package/README.md +39 -4
- package/bin/swa.mjs +33 -0
- package/package.json +10 -3
- package/swa/1.0/agents.md +638 -0
- package/swa/1.0/quickstart.md +145 -0
- package/swa/1.0/runtime.js +1 -1
- package/swa/1.0/spec.md +2125 -0
package/LICENSE
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
This package holds two kinds of files, under two licences:
|
|
2
|
+
|
|
3
|
+
- The runtime, its types and the command (swa/1.0/runtime.js, swa/1.0/swa.d.ts, bin/swa.mjs): the MIT License,
|
|
4
|
+
below, which covers them only, not the texts. bin/swa.mjs also holds Acorn and acorn-jsx, under their own MIT
|
|
5
|
+
licences, at the end of this file.
|
|
6
|
+
- The texts (swa/1.0/spec.md, swa/1.0/quickstart.md, swa/1.0/agents.md): the Startside Widget API (SWA) 1.0
|
|
7
|
+
specification, SWA in 60 lines and the guide for agents, © 2026 François Hodierne, under the Creative Commons
|
|
8
|
+
Attribution 4.0 International licence (CC BY 4.0): https://creativecommons.org/licenses/by/4.0/
|
|
9
|
+
Their current versions: https://startside.app/swa/1.0/
|
|
10
|
+
|
|
1
11
|
MIT License
|
|
2
12
|
|
|
3
13
|
Copyright (c) 2026 François Hodierne
|
|
@@ -19,3 +29,53 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
19
29
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
30
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
31
|
SOFTWARE.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
bin/swa.mjs holds Acorn (https://github.com/acornjs/acorn) and acorn-jsx (https://github.com/acornjs/acorn-jsx):
|
|
36
|
+
|
|
37
|
+
Acorn: MIT License
|
|
38
|
+
|
|
39
|
+
Copyright (C) 2012-2022 by various contributors (see AUTHORS)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
43
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
44
|
+
in the Software without restriction, including without limitation the rights
|
|
45
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
46
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
47
|
+
furnished to do so, subject to the following conditions:
|
|
48
|
+
|
|
49
|
+
The above copyright notice and this permission notice shall be included in
|
|
50
|
+
all copies or substantial portions of the Software.
|
|
51
|
+
|
|
52
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
53
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
54
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
55
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
56
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
57
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
58
|
+
THE SOFTWARE.
|
|
59
|
+
|
|
60
|
+
acorn-jsx: MIT License
|
|
61
|
+
|
|
62
|
+
Copyright (C) 2012-2017 by Ingvar Stepanyan
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
66
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
67
|
+
in the Software without restriction, including without limitation the rights
|
|
68
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
69
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
70
|
+
furnished to do so, subject to the following conditions:
|
|
71
|
+
|
|
72
|
+
The above copyright notice and this permission notice shall be included in
|
|
73
|
+
all copies or substantial portions of the Software.
|
|
74
|
+
|
|
75
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
76
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
77
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
78
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
79
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
80
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
81
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# @startside/swa
|
|
2
2
|
|
|
3
|
-
The runtime of the **Startside Widget API (SWA) 1.0**,
|
|
3
|
+
The runtime of the **Startside Widget API (SWA) 1.0**, its TypeScript types, its specification in Markdown, and a
|
|
4
|
+
command that checks a widget file and inlines its runtime.
|
|
4
5
|
|
|
5
6
|
An SWA widget is a single HTML file: its head names it and loads this runtime, a hidden form declares its settings, and
|
|
6
7
|
its scripts draw it through one object, `widget`. Opened on its own, the file runs on a standalone page with the
|
|
@@ -11,6 +12,19 @@ runtime, which ignores the file's runtime script.
|
|
|
11
12
|
- SWA in 60 lines, a complete widget and the rules as a table: <https://startside.app/swa/1.0/quickstart.html>
|
|
12
13
|
- For agents: <https://startside.app/swa/1.0/agents.md>
|
|
13
14
|
|
|
15
|
+
## The texts, in the package
|
|
16
|
+
|
|
17
|
+
The same texts as startside.app publishes, as they were at this release, beside the runtime (since 1.0.1), for an author
|
|
18
|
+
or an agent that can reach npm or a CDN but not startside.app:
|
|
19
|
+
|
|
20
|
+
- `swa/1.0/agents.md`: the guide for agents, short enough to read whole: SWA in 60 lines, the tools, the types and an
|
|
21
|
+
index of the specification;
|
|
22
|
+
- `swa/1.0/quickstart.md`: SWA in 60 lines;
|
|
23
|
+
- `swa/1.0/spec.md`: the specification.
|
|
24
|
+
|
|
25
|
+
On a CDN: `https://cdn.jsdelivr.net/npm/@startside/swa@1/swa/1.0/agents.md`. Their links point to startside.app, whose
|
|
26
|
+
copies are the current ones: the specification is a draft and changes between the package's releases.
|
|
27
|
+
|
|
14
28
|
## Loading the runtime
|
|
15
29
|
|
|
16
30
|
A widget file's head loads one runtime script (SWA 1.0, 4.3). In order of preference:
|
|
@@ -39,6 +53,25 @@ startside.app's proxies. Another Startside host is named by `data-host`, an http
|
|
|
39
53
|
`<script data-runtime="swa/1.0">…</script>` with the text of `swa/1.0/runtime.js` unchanged inside. Its requests still
|
|
40
54
|
go to startside.app, or to its `data-host`: where those are refused too, the widget draws but its requests fail.
|
|
41
55
|
|
|
56
|
+
## The command
|
|
57
|
+
|
|
58
|
+
For Node 20 or later, nothing else to install:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
npx @startside/swa validate my-widget.swa.html # check a file, without running it
|
|
62
|
+
npx @startside/swa inline my-widget.swa.html # write my-widget-inline.swa.html, the runtime inside
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**`validate <files…> [--json]`** reads each file with no network: its name and document, its runtime tag, metadata and
|
|
66
|
+
settings form, and its scripts against SWA 1.0's API, UWA's members and globals named with what replaces them. It
|
|
67
|
+
prints `file:line:col: error|warning: message`, each citing the specification's section, and exits 1 on an error.
|
|
68
|
+
`--json` prints the findings as a list of `{ file, line, col, level, message }`, for an agent. A file it passes can
|
|
69
|
+
still fail as it runs: open it in a browser too.
|
|
70
|
+
|
|
71
|
+
**`inline <file> [-o <out>]`** writes a copy with its runtime script replaced by `<script data-runtime="swa/1.0">`
|
|
72
|
+
holding this package's runtime (its `data-host` kept), then checks the copy. It never writes over the file: keep the one
|
|
73
|
+
that loads the runtime by its address as the widget's own, and inline again after a release.
|
|
74
|
+
|
|
42
75
|
## The types
|
|
43
76
|
|
|
44
77
|
`swa/1.0/swa.d.ts` types the global `widget` for an editor. With the package installed (`npm install --save-dev
|
|
@@ -52,9 +85,11 @@ Or next to a widget's code, with the file copied beside it: `/// <reference path
|
|
|
52
85
|
|
|
53
86
|
## Versions
|
|
54
87
|
|
|
55
|
-
The package has its own version. A patch is a runtime fix
|
|
56
|
-
others (`swa/1.1/` beside `swa/1.0/`); a major release would
|
|
88
|
+
The package has its own version. A patch is a runtime fix, the texts brought up to date, or the command's changes; a
|
|
89
|
+
minor release can add a version of the API beside the others (`swa/1.1/` beside `swa/1.0/`); a major release would
|
|
90
|
+
remove one. The API's version is the one in the path.
|
|
57
91
|
|
|
58
92
|
## Licence
|
|
59
93
|
|
|
60
|
-
The runtime and the
|
|
94
|
+
The runtime, the types and the command: MIT; the command holds Acorn and acorn-jsx, MIT too. The texts (`spec.md`,
|
|
95
|
+
`quickstart.md`, `agents.md`): CC BY 4.0, © François Hodierne. `LICENSE` says which is which.
|