@wildwinter/toolkit 0.2.6 → 0.2.7
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 +7 -0
- package/conformance/extensions/manifest.json +75 -0
- package/dist/extensions.cjs +9 -3
- package/dist/extensions.cjs.map +1 -1
- package/dist/extensions.js +9 -3
- package/dist/extensions.js.map +1 -1
- package/extensions.md +4 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @wildwinter/toolkit
|
|
2
2
|
|
|
3
|
+
## 0.2.7
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **Value help on a pick** (`./extensions`): a pick's `valueHelp` describes its fixed `words`, a sentence each; the
|
|
8
|
+
manifest check holds each key to one of them, since the project's lists and nodes are the project's to describe.
|
|
9
|
+
|
|
3
10
|
## 0.2.6
|
|
4
11
|
|
|
5
12
|
### Added
|
|
@@ -571,6 +571,81 @@
|
|
|
571
571
|
}
|
|
572
572
|
]
|
|
573
573
|
},
|
|
574
|
+
{
|
|
575
|
+
"name": "a pick's value help describes its fixed words, never its lists or nodes",
|
|
576
|
+
"manifest": {
|
|
577
|
+
"schema": "wildwinter/extension@0",
|
|
578
|
+
"id": "probe",
|
|
579
|
+
"name": "Probe",
|
|
580
|
+
"version": "1.0.0",
|
|
581
|
+
"targets": {
|
|
582
|
+
"patter": {
|
|
583
|
+
"project": {
|
|
584
|
+
"fields": [
|
|
585
|
+
{
|
|
586
|
+
"name": "types",
|
|
587
|
+
"type": "list",
|
|
588
|
+
"of": {
|
|
589
|
+
"type": "text"
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
]
|
|
593
|
+
},
|
|
594
|
+
"scene": {
|
|
595
|
+
"fields": [
|
|
596
|
+
{
|
|
597
|
+
"name": "type",
|
|
598
|
+
"type": "pick",
|
|
599
|
+
"from": [
|
|
600
|
+
{
|
|
601
|
+
"words": [
|
|
602
|
+
"ambient",
|
|
603
|
+
"cinematic"
|
|
604
|
+
]
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
"list": "types"
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
"words": [
|
|
611
|
+
"bark"
|
|
612
|
+
]
|
|
613
|
+
}
|
|
614
|
+
],
|
|
615
|
+
"valueHelp": {
|
|
616
|
+
"ambient": "Voices from sources.",
|
|
617
|
+
"bark": "A one-off line.",
|
|
618
|
+
"duel": "One of the project's types: not the manifest's to describe."
|
|
619
|
+
}
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
"name": "to",
|
|
623
|
+
"type": "pick",
|
|
624
|
+
"from": [
|
|
625
|
+
{
|
|
626
|
+
"to": "cast"
|
|
627
|
+
}
|
|
628
|
+
],
|
|
629
|
+
"valueHelp": {
|
|
630
|
+
"WREN": "A cast member."
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
]
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
},
|
|
638
|
+
"problems": [
|
|
639
|
+
{
|
|
640
|
+
"path": "targets.patter.scene.fields[0].valueHelp.duel",
|
|
641
|
+
"code": "value-help"
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
"path": "targets.patter.scene.fields[1].valueHelp.WREN",
|
|
645
|
+
"code": "value-help"
|
|
646
|
+
}
|
|
647
|
+
]
|
|
648
|
+
},
|
|
574
649
|
{
|
|
575
650
|
"name": "a reference names a kind its host can point at",
|
|
576
651
|
"manifest": {
|
package/dist/extensions.cjs
CHANGED
|
@@ -424,6 +424,10 @@ function manifestProblems(manifest) {
|
|
|
424
424
|
}
|
|
425
425
|
return out;
|
|
426
426
|
}
|
|
427
|
+
function pickWords(from) {
|
|
428
|
+
if (!Array.isArray(from)) return [];
|
|
429
|
+
return from.flatMap((s) => isObject(s) && Array.isArray(s["words"]) ? s["words"].filter((w) => typeof w === "string") : []);
|
|
430
|
+
}
|
|
427
431
|
function pickSourcesSound(host, from, path, out) {
|
|
428
432
|
if (!Array.isArray(from) || from.length === 0) {
|
|
429
433
|
out.push(err2("pick-from", path, 'a pick lists its sources in "from": { "words": [...] }, { "to": a node kind }, or { "list": a project list }'));
|
|
@@ -771,12 +775,14 @@ function typeProblems(host, decl, path, named, out, claim = false) {
|
|
|
771
775
|
out.push(err2("value-help", at("valueHelp"), "value help describes the values of an enum or flags field, or a quality's stages"));
|
|
772
776
|
}
|
|
773
777
|
} else if (decl.valueHelp !== void 0) {
|
|
774
|
-
const vocabulary = decl.type === "quality" ? decl.stages : decl.type === "enum" || decl.type === "flags" ? decl.values : void 0;
|
|
778
|
+
const vocabulary = decl.type === "quality" ? decl.stages : decl.type === "enum" || decl.type === "flags" ? decl.values : decl.type === "pick" ? pickWords(decl.from) : void 0;
|
|
775
779
|
if (vocabulary === void 0 || !isObject(decl.valueHelp)) {
|
|
776
|
-
out.push(err2("value-help", at("valueHelp"), "value help describes the values of an enum or flags field, or a
|
|
780
|
+
out.push(err2("value-help", at("valueHelp"), "value help describes the values of an enum or flags field, a quality's stages, or a pick's words"));
|
|
777
781
|
} else {
|
|
778
782
|
for (const k of Object.keys(decl.valueHelp)) {
|
|
779
|
-
if (!vocabulary.includes(k))
|
|
783
|
+
if (!vocabulary.includes(k)) {
|
|
784
|
+
out.push(err2("value-help", atKey(at("valueHelp"), k), decl.type === "pick" ? `"${k}" is not one of its words: value help describes a pick's fixed words, never the project's lists or nodes` : `"${k}" is not one of its values`));
|
|
785
|
+
}
|
|
780
786
|
}
|
|
781
787
|
}
|
|
782
788
|
}
|