tpmkms_4wp 8.9.0-beta.3 → 8.9.0-beta.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/common/countable.js +8 -2
- package/common/countable.test.json +586 -0
- package/common/hierarchy.js +5 -5
- package/common/hierarchy.test.json +1491 -0
- package/common/pipboy.instance.json +28 -28
- package/common/wp.instance.json +5986 -618
- package/common/wp.js +32 -3
- package/common/wp.test.json +3732 -81
- package/package.json +2 -2
package/common/wp.js
CHANGED
@@ -3,6 +3,8 @@ const { defaultContextCheck } = require('./helpers')
|
|
3
3
|
const helpers = require("./helpers")
|
4
4
|
const ui = require("./ui")
|
5
5
|
const countable = require("./countable")
|
6
|
+
const colors = require("./colors")
|
7
|
+
const errors = require("./errors")
|
6
8
|
const wp_tests = require('./wp.test.json')
|
7
9
|
const instance = require('./wp.instance.json')
|
8
10
|
|
@@ -20,6 +22,10 @@ class API {
|
|
20
22
|
initialize({ objects }) {
|
21
23
|
this._objects = objects
|
22
24
|
}
|
25
|
+
|
26
|
+
changeColor(unit, scope, color) {
|
27
|
+
this._objects.changeColor = { unit, scope, color }
|
28
|
+
}
|
23
29
|
}
|
24
30
|
|
25
31
|
const api = new API()
|
@@ -27,8 +33,28 @@ const api = new API()
|
|
27
33
|
let config = {
|
28
34
|
name: 'wp',
|
29
35
|
operators: [
|
36
|
+
// TODO write a parser for this so I can use statefulElement as the id
|
37
|
+
"([changeState|make] ([statefulelement]) ([stateValue|]))",
|
30
38
|
],
|
31
39
|
bridges: [
|
40
|
+
{
|
41
|
+
id: 'changeState',
|
42
|
+
parents: ['verb'],
|
43
|
+
bridge: "{ ...next(operator), element: after[0], state: after[1], operator: operator, generate: ['operator', 'element', 'state'] }",
|
44
|
+
semantic: ({api, context}) => {
|
45
|
+
const unit = context.element.marker
|
46
|
+
const scope = context.element.quantity.quantity
|
47
|
+
const color = context.state.value.split('_')[0]
|
48
|
+
api.changeColor({ unit, scope, color })
|
49
|
+
}
|
50
|
+
},
|
51
|
+
{
|
52
|
+
id: 'statefulelement',
|
53
|
+
},
|
54
|
+
{
|
55
|
+
id: 'stateValue',
|
56
|
+
children: ['color_colors'],
|
57
|
+
},
|
32
58
|
],
|
33
59
|
semantics: [
|
34
60
|
]
|
@@ -36,7 +62,7 @@ let config = {
|
|
36
62
|
|
37
63
|
template = {
|
38
64
|
configs: [
|
39
|
-
'words are countable',
|
65
|
+
'words are countable and statefulElements',
|
40
66
|
'characters are countable',
|
41
67
|
'paragraphs are countable',
|
42
68
|
],
|
@@ -44,7 +70,7 @@ template = {
|
|
44
70
|
|
45
71
|
knowledgeModule({
|
46
72
|
config,
|
47
|
-
includes: [ui, countable],
|
73
|
+
includes: [ui, countable, colors, errors],
|
48
74
|
api: () => new API(),
|
49
75
|
|
50
76
|
module,
|
@@ -56,7 +82,10 @@ knowledgeModule({
|
|
56
82
|
context: [
|
57
83
|
...defaultContextCheck(),
|
58
84
|
],
|
59
|
-
objects: [
|
85
|
+
objects: [
|
86
|
+
'changeColor',
|
87
|
+
{ km: 'ui' },
|
88
|
+
],
|
60
89
|
},
|
61
90
|
},
|
62
91
|
template: {
|