@wildwinter/toolkit 0.2.4 → 0.2.5
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 +12 -0
- package/conformance/extensions/defaults.json +1 -0
- package/conformance/extensions/manifest.json +314 -0
- package/conformance/extensions/values.json +527 -1
- package/dist/extensions.cjs +158 -2
- package/dist/extensions.cjs.map +1 -1
- package/dist/extensions.d.cts +54 -3
- package/dist/extensions.d.ts +54 -3
- package/dist/extensions.js +155 -3
- package/dist/extensions.js.map +1 -1
- package/extensions.md +28 -1
- package/package.json +1 -1
package/extensions.md
CHANGED
|
@@ -98,6 +98,7 @@ whose field has a type other than the claim's is an error naming where (the host
|
|
|
98
98
|
| `flags` | A set of `values` | `[]` | As a set, value by value |
|
|
99
99
|
| `quality` | One stage of `stages` (at least two, none empty, none twice) | The first stage | Three-way |
|
|
100
100
|
| `reference` | The id of a node of the kind named by `to` | `""` | Three-way; validated to exist |
|
|
101
|
+
| `pick` | One choice from the sources in `from` (below), as text, or `""` (automatic) | `""` | Three-way; validated against its sources |
|
|
101
102
|
| `record` | Named `fields`, each a field declaration | Each field's default | Field by field |
|
|
102
103
|
| `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
104
|
| `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 +114,32 @@ A value that does not fit is reported by `valueProblems`, through the kernel's `
|
|
|
113
114
|
names no stage carries the stages either side of it as `options` (the kernel's `stagesEitherSide`, the whole
|
|
114
115
|
ladder for a stage that is gone).
|
|
115
116
|
|
|
117
|
+
### Picks
|
|
118
|
+
|
|
119
|
+
A pick is a single choice whose choices come from sources the manifest names, in the order they're shown:
|
|
120
|
+
|
|
121
|
+
```json5
|
|
122
|
+
{ name: "to", type: "pick", from: [{ words: ["all"] }, { to: "cast" }, { list: "pointsOfInterest" }] }
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
- `words`: fixed words, named once each.
|
|
126
|
+
- `to`: the nodes of a reference kind (the table above), held by id as a reference holds them.
|
|
127
|
+
- `list`: a list of text (`{ type: "list", of: { type: "text" } }`, no `id`) on the extension's own `project`
|
|
128
|
+
target, by that field's name; the project node's value, else the field's default (`pickLists`).
|
|
129
|
+
|
|
130
|
+
Empty is automatic: no word for it is stored, and an editor shows it as "auto". A pick isn't an `enum` whose values
|
|
131
|
+
change: an enum's values are fixed and checked against the manifest, a pick's are the project's.
|
|
132
|
+
|
|
133
|
+
`valueProblems` reports a value no source holds (`not-a-choice`, an error), given the host's nodes (`exists`) and
|
|
134
|
+
lists (`list`) in its context; a source it can't see is not checked, so a value is reported missing only when every
|
|
135
|
+
source can say. A value two sources hold is ambiguous (`pick-ambiguous`, a warning), and `pickClashes` reports each
|
|
136
|
+
such name once for the project (`pick-clash`). `pickChoices` lists the choices, source by source, for an editor to
|
|
137
|
+
draw.
|
|
138
|
+
|
|
139
|
+
A host that renames a node of a `to` source rewrites the values naming it, as it rewrites references. A renamed
|
|
140
|
+
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
|
|
141
|
+
naming the old entry is reported missing.
|
|
142
|
+
|
|
116
143
|
### Stage renames
|
|
117
144
|
|
|
118
145
|
An extension's ladder belongs to its manifest. A version that renames a stage says so on the field:
|
|
@@ -189,7 +216,7 @@ This covers every shard of a format, not only extension shards.
|
|
|
189
216
|
## Conformance
|
|
190
217
|
|
|
191
218
|
`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
|
|
219
|
+
defaults, stage renames, picks and the merge, with their expectations. `test/extensions.test.ts` runs them. A host that
|
|
193
220
|
reimplements any part runs the same files.
|
|
194
221
|
|
|
195
222
|
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.5",
|
|
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",
|