@wildwinter/toolkit 0.2.4 → 0.2.6
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/CHANGELOG.md +22 -0
- package/conformance/extensions/defaults.json +1 -0
- package/conformance/extensions/manifest.json +546 -0
- package/conformance/extensions/values.json +527 -1
- package/dist/extensions.cjs +231 -3
- package/dist/extensions.cjs.map +1 -1
- package/dist/extensions.d.cts +76 -3
- package/dist/extensions.d.ts +76 -3
- package/dist/extensions.js +226 -4
- package/dist/extensions.js.map +1 -1
- package/extensions.md +50 -1
- package/package.json +1 -1
package/extensions.md
CHANGED
|
@@ -48,6 +48,28 @@ read the same one. It is JSON (JSON5 is read too), and is called `<id>.extension
|
|
|
48
48
|
- **Fields** per target, in the order the editor shows them.
|
|
49
49
|
- **Claims** on host fields, named through a project setting.
|
|
50
50
|
|
|
51
|
+
### Views and reads
|
|
52
|
+
|
|
53
|
+
A manifest can declare views: web components in the extension's installed package, each opened by a host in a
|
|
54
|
+
floating window of its own, sandboxed, talking to the host only through the host API (`@wildwinter/app-shell`'s
|
|
55
|
+
`view-client`). The project's copy of the manifest declares them; the code comes from the package installed on the
|
|
56
|
+
machine, never from the project folder.
|
|
57
|
+
|
|
58
|
+
```json5
|
|
59
|
+
views: [
|
|
60
|
+
{ id: "sheet", name: "Performance sheet", entry: "view/sheet.js", element: "pattershot-sheet", hosts: ["patter"] },
|
|
61
|
+
],
|
|
62
|
+
reads: ["patterstage"],
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
- `id`: lower case, digits and hyphens, unique among the views; `name`: the window's title and the menu item.
|
|
66
|
+
- `entry`: the component's script, a relative `.js` path inside the package, with no `.` or `..` segment
|
|
67
|
+
(`isViewEntry`). `element`: the custom element it defines, lower case with a hyphen, unique among the views.
|
|
68
|
+
- `hosts`: the hosts that offer the view. When absent, every host the manifest targets does; naming a host the
|
|
69
|
+
manifest targets nothing in is a warning. `viewsFor(manifest, host)` lists what a host offers.
|
|
70
|
+
- `reads`: other extensions whose data the views read, by id. An extension always reads its own; naming itself is a
|
|
71
|
+
warning.
|
|
72
|
+
|
|
51
73
|
### Field declarations
|
|
52
74
|
|
|
53
75
|
```json5
|
|
@@ -98,6 +120,7 @@ whose field has a type other than the claim's is an error naming where (the host
|
|
|
98
120
|
| `flags` | A set of `values` | `[]` | As a set, value by value |
|
|
99
121
|
| `quality` | One stage of `stages` (at least two, none empty, none twice) | The first stage | Three-way |
|
|
100
122
|
| `reference` | The id of a node of the kind named by `to` | `""` | Three-way; validated to exist |
|
|
123
|
+
| `pick` | One choice from the sources in `from` (below), as text, or `""` (automatic) | `""` | Three-way; validated against its sources |
|
|
101
124
|
| `record` | Named `fields`, each a field declaration | Each field's default | Field by field |
|
|
102
125
|
| `map` | Entries keyed by `key` (`{ type: "text" }` or `{ type: "reference", to }`), each of type `of` | `{}` | Key by key, then by the value's own type |
|
|
103
126
|
| `list` with `id` | Records, each carrying the text field named by `id`, unique in the list | `[]` | Union by id, each item by its own type; order kept |
|
|
@@ -113,6 +136,32 @@ A value that does not fit is reported by `valueProblems`, through the kernel's `
|
|
|
113
136
|
names no stage carries the stages either side of it as `options` (the kernel's `stagesEitherSide`, the whole
|
|
114
137
|
ladder for a stage that is gone).
|
|
115
138
|
|
|
139
|
+
### Picks
|
|
140
|
+
|
|
141
|
+
A pick is a single choice whose choices come from sources the manifest names, in the order they're shown:
|
|
142
|
+
|
|
143
|
+
```json5
|
|
144
|
+
{ name: "to", type: "pick", from: [{ words: ["all"] }, { to: "cast" }, { list: "pointsOfInterest" }] }
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
- `words`: fixed words, named once each.
|
|
148
|
+
- `to`: the nodes of a reference kind (the table above), held by id as a reference holds them.
|
|
149
|
+
- `list`: a list of text (`{ type: "list", of: { type: "text" } }`, no `id`) on the extension's own `project`
|
|
150
|
+
target, by that field's name; the project node's value, else the field's default (`pickLists`).
|
|
151
|
+
|
|
152
|
+
Empty is automatic: no word for it is stored, and an editor shows it as "auto". A pick isn't an `enum` whose values
|
|
153
|
+
change: an enum's values are fixed and checked against the manifest, a pick's are the project's.
|
|
154
|
+
|
|
155
|
+
`valueProblems` reports a value no source holds (`not-a-choice`, an error), given the host's nodes (`exists`) and
|
|
156
|
+
lists (`list`) in its context; a source it can't see is not checked, so a value is reported missing only when every
|
|
157
|
+
source can say. A value two sources hold is ambiguous (`pick-ambiguous`, a warning), and `pickClashes` reports each
|
|
158
|
+
such name once for the project (`pick-clash`). `pickChoices` lists the choices, source by source, for an editor to
|
|
159
|
+
draw.
|
|
160
|
+
|
|
161
|
+
A host that renames a node of a `to` source rewrites the values naming it, as it rewrites references. A renamed
|
|
162
|
+
entry of a project list isn't followed: a list of text can't tell a rename from a removal and an addition, so a value
|
|
163
|
+
naming the old entry is reported missing.
|
|
164
|
+
|
|
116
165
|
### Stage renames
|
|
117
166
|
|
|
118
167
|
An extension's ladder belongs to its manifest. A version that renames a stage says so on the field:
|
|
@@ -189,7 +238,7 @@ This covers every shard of a format, not only extension shards.
|
|
|
189
238
|
## Conformance
|
|
190
239
|
|
|
191
240
|
`conformance/extensions/*.json` are the contract: hand-written cases for manifest validation, value validation,
|
|
192
|
-
defaults, stage renames and the merge, with their expectations. `test/extensions.test.ts` runs them. A host that
|
|
241
|
+
defaults, stage renames, picks and the merge, with their expectations. `test/extensions.test.ts` runs them. A host that
|
|
193
242
|
reimplements any part runs the same files.
|
|
194
243
|
|
|
195
244
|
This entry needs `@wildwinter/expr` and `@wildwinter/scoperegistry` (the kernel's value and ladder rules, and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildwinter/toolkit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Small shared pieces of the authoring tooling: opaque ids, a stable hash, JSON5 source parsing, find/replace matching, the archive guards, and (in ./extensions) the spec and merge for Patter extensions and Storylet extensions. Nothing here runs in a game.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|