@wildwinter/toolkit 0.2.7 → 0.3.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/extensions.md CHANGED
@@ -23,14 +23,10 @@ read the same one. It is JSON (JSON5 is read too), and is called `<id>.extension
23
23
  name: "Pattershot",
24
24
  version: "1.2.0", // major.minor.patch
25
25
  docs: "https://example.com/pattershot",
26
- settings: [ // project settings, each naming a host field a claim presents
27
- { name: "moodField", label: "Mood field", help: "The card field holding the mood.", default: "mood" },
28
- ],
29
26
  targets: {
30
27
  storylets: { // a host: "patter" or "storylets"
31
28
  card: { // a node kind of that host
32
29
  fields: [ /* field declarations, below */ ],
33
- claims: [ /* claims on host fields, below */ ],
34
30
  },
35
31
  },
36
32
  },
@@ -40,13 +36,13 @@ read the same one. It is JSON (JSON5 is read too), and is called `<id>.extension
40
36
  - **Identity**: `id`, `name`, `version`, and optionally `docs`, a link to the extension's own documentation.
41
37
  - **Targets**, by host and node kind:
42
38
 
43
- | Host | Node kinds | References | Kinds with host fields (claimable) |
44
- |---|---|---|---|
45
- | `patter` | `scene`, `block`, `snippet`, `line`, `text`, `gameEvent`, `option`, `project` | `cast`, `scene`, `block`, `snippet`, `line` | every kind but `project` (game data) |
46
- | `storylets` | `box`, `tagGroup`, `tag`, `deck`, `card`, `outcome`, `handTemplate`, `hand`, `project` | `box`, `deck`, `card`, `outcome`, `tag` | `card`, `outcome` (fields) |
39
+ | Host | Node kinds | References |
40
+ |---|---|---|
41
+ | `patter` | `scene`, `block`, `snippet`, `line`, `text`, `gameEvent`, `option`, `project` | `cast`, `scene`, `block`, `snippet`, `line` |
42
+ | `storylets` | `box`, `tagGroup`, `tag`, `deck`, `card`, `outcome`, `handTemplate`, `hand`, `project` | `box`, `deck`, `card`, `outcome`, `tag` |
47
43
 
48
- - **Fields** per target, in the order the editor shows them.
49
- - **Claims** on host fields, named through a project setting.
44
+ - **Fields** per target, in the order the editor shows them. An extension's data is always its own: it never puts
45
+ its control on a field the host already has. A value the whole project shares is a field on the `project` target.
50
46
 
51
47
  ### Views and reads
52
48
 
@@ -70,6 +66,18 @@ reads: ["patterstage"],
70
66
  - `reads`: other extensions whose data the views read, by id. An extension always reads its own; naming itself is a
71
67
  warning.
72
68
 
69
+ ### Requirements
70
+
71
+ ```json5
72
+ requires: ["patterstage"],
73
+ ```
74
+
75
+ `requires` names other extensions, by id, that a project must take for this one to work: Pattershot's runner
76
+ attaches to Patterstage's Director, so a project with Pattershot and no Patterstage can't play its performances.
77
+ Each id appears once, and never the extension's own. A host refuses to add an extension whose requirements the
78
+ project doesn't take (or offers to add them first), its validation warns of a project that takes one without them,
79
+ and it tells the extension's views which are missing. `missingRequirements(manifest, taken)` lists them.
80
+
73
81
  ### Field declarations
74
82
 
75
83
  ```json5
@@ -84,6 +92,7 @@ reads: ["patterstage"],
84
92
  required: true, // a node of this kind must set it
85
93
  group: "Delivery", // a heading within the extension's group, in field order
86
94
  editorOnly: true, // stripped at compile; editor data, never in the bundle
95
+ editor: "sheet", // a map of records only: one of the manifest's views edits it
87
96
  }
88
97
  ```
89
98
 
@@ -91,23 +100,17 @@ reads: ["patterstage"],
91
100
  `group` are for the editor, and never reach a bundle.
92
101
  - `required`, `min` and `max` (numbers only) are validation.
93
102
  - `editorOnly` is allowed on a target's own fields only, not inside a record.
103
+ - `editor` names one of the manifest's views, by id, that edits the field: the host's inspector opens that view at
104
+ the node instead of its own grid for a map of records. It's allowed on a target's own fields only, the view must
105
+ open in that target's host, and on a field that isn't a map of records it's warned of and ignored, as such a field
106
+ is edited in place.
94
107
 
95
- ### Claims on host fields
96
-
97
- A claim presents a field the host already has, with this manifest's control, help and validation, without moving the
98
- data. It names the field through a setting, so a project whose field has another name says so once:
99
-
100
- ```json5
101
- { setting: "moodField", type: "enum", values: ["calm", "tense"], label: "Mood", help: "..." }
102
- ```
108
+ ### Removed keys
103
109
 
104
- A claim is a scalar. It may leave out an enum's or flags' `values` and a quality's `stages`: the host's
105
- declaration is then the vocabulary, as the host's ladder always is, and the claim adds its label, help and
106
- `valueHelp`, which may describe values the host does not declare (they are simply unused). `effectiveClaim(claim,
107
- hostDecl)` gives the declaration a host draws and checks the field with. The project names the extension's settings when it opts in (each host's project shard says
108
- how); a setting the project leaves out takes the setting's `default`. A claimed field keeps the host's own merge
109
- rule, ladder and renames. Two extensions claiming one field is an error naming both (`claimClashes`); a host
110
- whose field has a type other than the claim's is an error naming where (the host checks: in Storylets, per box).
110
+ Earlier versions of the spec had `settings`, each naming a host field, and `claims` on a target, presenting that
111
+ host field with the manifest's control. Both are gone: a manifest that still carries one is warned of by name
112
+ (`removed-key`) and the key is ignored. Declare a field of the extension's own instead, which the runtimes hand
113
+ the game with every other extension value.
111
114
 
112
115
  ## The types
113
116
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildwinter/toolkit",
3
- "version": "0.2.7",
3
+ "version": "0.3.1",
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",