tpmkms_4wp 8.9.0-beta.18 → 8.9.0-beta.2
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/animals.instance.json +0 -65
- package/common/articles.js +0 -4
- package/common/colors.instance.json +0 -71
- package/common/comparable.instance.json +0 -15
- package/common/conjunction.js +18 -27
- package/common/countable.js +2 -8
- package/common/countable.test.json +0 -586
- package/common/crew.instance.json +176 -130
- package/common/dialogues.js +11 -7
- package/common/dimension.instance.json +0 -10
- package/common/edible.instance.json +0 -376
- package/common/emotions.instance.json +0 -8
- package/common/fastfood.instance.json +924 -1437
- package/common/formulas.instance.json +0 -10
- package/common/helpers/dialogues.js +8 -14
- package/common/helpers/properties.js +2 -2
- package/common/helpers.js +0 -29
- package/common/hierarchy.js +5 -5
- package/common/hierarchy.test.json +0 -1491
- package/common/kirk.instance.json +0 -5
- package/common/length.instance.json +0 -150
- package/common/math.instance.json +0 -10
- package/common/meta.js +3 -5
- package/common/ordering.instance.json +0 -10
- package/common/people.instance.json +4 -169
- package/common/pipboy.instance.json +28 -198
- package/common/pokemon.instance.json +0 -65
- package/common/pressure.instance.json +0 -40
- package/common/properties.instance.json +0 -5
- package/common/reports.instance.json +1 -21
- package/common/spock.instance.json +0 -5
- package/common/temperature.instance.json +0 -40
- package/common/ui.instance.json +0 -10
- package/common/ui.js +1 -0
- package/common/weight.instance.json +0 -120
- package/common/wp.instance.json +957 -25624
- package/common/wp.js +10 -146
- package/common/wp.test.json +698 -26348
- package/package.json +2 -3
- package/common/helpers/conjunction.js +0 -75
package/common/wp.js
CHANGED
@@ -3,8 +3,6 @@ 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")
|
8
6
|
const wp_tests = require('./wp.test.json')
|
9
7
|
const instance = require('./wp.instance.json')
|
10
8
|
|
@@ -16,60 +14,11 @@ const instance = require('./wp.instance.json')
|
|
16
14
|
|
17
15
|
make the text of the 1st to 3rd paragraphs blue
|
18
16
|
|
19
|
-
|
20
|
-
make every word bold and underlines and blue -> weirdly "bold underlined and blue" works
|
21
|
-
|
22
|
-
make the font ...
|
23
|
-
make the color blue
|
24
|
-
make the color of the first paragraph blue
|
25
|
-
|
26
|
-
words that start with a
|
27
|
-
make all the bold text uppercase
|
28
|
-
underline all the bold text
|
29
|
-
underline all the text
|
30
|
-
underline everything
|
31
|
-
4 letter word
|
32
|
-
4 to 6 letter word
|
33
|
-
word with 'a' in it
|
34
|
-
words containing a
|
35
|
-
every 5th word
|
36
17
|
*/
|
37
18
|
|
38
19
|
class API {
|
39
20
|
initialize({ objects }) {
|
40
21
|
this._objects = objects
|
41
|
-
this._objects.changeState = []
|
42
|
-
}
|
43
|
-
|
44
|
-
changeState(value) {
|
45
|
-
this._objects.changeState.push(value)
|
46
|
-
}
|
47
|
-
}
|
48
|
-
|
49
|
-
const root = (id) => {
|
50
|
-
return id.split('_')[0]
|
51
|
-
}
|
52
|
-
|
53
|
-
const setUpdate = (isA, update, states) => {
|
54
|
-
let color;
|
55
|
-
const styles = []
|
56
|
-
for (const state of states) {
|
57
|
-
if (isA(state, 'style_wp')) {
|
58
|
-
if (!update.styles) {
|
59
|
-
update.styles = []
|
60
|
-
}
|
61
|
-
let style = root(state.value)
|
62
|
-
/*
|
63
|
-
if (style == 'underlined') {
|
64
|
-
style = 'underline'
|
65
|
-
} else if (style == 'italicize') {
|
66
|
-
style = 'italic'
|
67
|
-
}
|
68
|
-
*/
|
69
|
-
update.styles.push(style)
|
70
|
-
} else {
|
71
|
-
update.color = root(state.value)
|
72
|
-
}
|
73
22
|
}
|
74
23
|
}
|
75
24
|
|
@@ -77,107 +26,25 @@ const api = new API()
|
|
77
26
|
|
78
27
|
let config = {
|
79
28
|
name: 'wp',
|
29
|
+
operators: [
|
30
|
+
],
|
31
|
+
bridges: [
|
32
|
+
],
|
33
|
+
semantics: [
|
34
|
+
]
|
80
35
|
};
|
81
36
|
|
82
|
-
const changeState = ({api, isA, context, toArray, element, state}) => {
|
83
|
-
let unit = root(context.element.marker)
|
84
|
-
let scope
|
85
|
-
if (isA(context.element, 'everything')) {
|
86
|
-
scope = 'all'
|
87
|
-
} else {
|
88
|
-
scope = context.element.quantity.quantity
|
89
|
-
}
|
90
|
-
const update = { unit, scope }
|
91
|
-
setUpdate(isA, update, toArray(context.state))
|
92
|
-
api.changeState(update)
|
93
|
-
}
|
94
|
-
|
95
37
|
template = {
|
96
38
|
configs: [
|
97
|
-
'
|
98
|
-
'words are countable and statefulElements',
|
39
|
+
'words are countable',
|
99
40
|
'characters are countable',
|
100
41
|
'paragraphs are countable',
|
101
|
-
|
102
|
-
'underlined means underline',
|
103
|
-
'capitalized means capitalize',
|
104
|
-
'italicize means italic',
|
105
|
-
'italicized means italic',
|
106
|
-
// 'styles are negatable',
|
107
|
-
"resetIdSuffix",
|
108
|
-
{
|
109
|
-
operators: [
|
110
|
-
// TODO write a parser for this so I can use statefulElement as the id
|
111
|
-
"([changeState_wp|make] ([statefulElement_wp]) ([stateValue_wp|]))",
|
112
|
-
"((style_wp/*) [applyStyle_wp] ([statefulElement_wp|]))",
|
113
|
-
],
|
114
|
-
bridges: [
|
115
|
-
{
|
116
|
-
id: 'applyStyle_wp',
|
117
|
-
parents: ['verb'],
|
118
|
-
convolution: true,
|
119
|
-
bridge: "{ ...next(operator), element: after[0], state: before[0], operator: operator, generate: ['state', 'element'] }",
|
120
|
-
localHierarchy: [
|
121
|
-
['thisitthat', 'statefulElement_wp'],
|
122
|
-
['everything', 'statefulElement_wp'],
|
123
|
-
],
|
124
|
-
semantic: (args) => {
|
125
|
-
changeState({...args, element: args.context.element, state: args.context.state})
|
126
|
-
}
|
127
|
-
},
|
128
|
-
{
|
129
|
-
id: 'changeState_wp',
|
130
|
-
parents: ['verb'],
|
131
|
-
bridge: "{ ...next(operator), element: after[0], state: after[1], operator: operator, generate: ['operator', 'element', 'state'] }",
|
132
|
-
localHierarchy: [
|
133
|
-
['thisitthat', 'statefulElement_wp'],
|
134
|
-
['everything', 'statefulElement_wp'],
|
135
|
-
],
|
136
|
-
semantic: (args) => {
|
137
|
-
changeState({...args, element: args.context.element, state: args.context.state})
|
138
|
-
}
|
139
|
-
},
|
140
|
-
{
|
141
|
-
id: 'stateValue_wp',
|
142
|
-
children: ['color_colors', 'style_wp'],
|
143
|
-
},
|
144
|
-
],
|
145
|
-
semantics: [
|
146
|
-
{
|
147
|
-
where: where(),
|
148
|
-
match: ({context, isA}) => isA(context, 'style_wp') && !context.same && !context.isResponse && !context.evaluate,
|
149
|
-
apply: ({context, api, isA, toArray}) => {
|
150
|
-
const update = { scope: 'selection' }
|
151
|
-
setUpdate(isA, update, toArray(context))
|
152
|
-
api.changeState(update)
|
153
|
-
}
|
154
|
-
},
|
155
|
-
{
|
156
|
-
where: where(),
|
157
|
-
match: ({context, isA}) => isA(context, 'statefulElement_wp') && !context.same && !context.isResponse && !context.evaluate,
|
158
|
-
apply: ({context, api, isA, toArray}) => {
|
159
|
-
const unit = root(context.marker)
|
160
|
-
let scope
|
161
|
-
if (context.quantity) {
|
162
|
-
scope = context.quantity.quantity
|
163
|
-
}
|
164
|
-
// TODO set default scope for "every word bold underlined etc"
|
165
|
-
}
|
166
|
-
},
|
167
|
-
],
|
168
|
-
priorities: [
|
169
|
-
{ "context": [['changeState_wp',0], ['statefulElement_wp', 0], ['list', 0]], ordered: true, choose: [0] },
|
170
|
-
],
|
171
|
-
},
|
172
|
-
// "([changeState_wp|make] ([statefulElement_wp]) ([stateValue_wp|]))",
|
173
|
-
// "((style_wp/*) [applyStyle_wp] ([statefulElement_wp|]))",
|
174
|
-
// "x statefulElement_wp y means y changeState_wp x",
|
175
|
-
]
|
42
|
+
],
|
176
43
|
}
|
177
44
|
|
178
45
|
knowledgeModule({
|
179
46
|
config,
|
180
|
-
includes: [ui, countable
|
47
|
+
includes: [ui, countable],
|
181
48
|
api: () => new API(),
|
182
49
|
|
183
50
|
module,
|
@@ -189,10 +56,7 @@ knowledgeModule({
|
|
189
56
|
context: [
|
190
57
|
...defaultContextCheck(),
|
191
58
|
],
|
192
|
-
objects: [
|
193
|
-
'changeState',
|
194
|
-
{ km: 'ui' },
|
195
|
-
],
|
59
|
+
objects: [{ km: 'ui' }],
|
196
60
|
},
|
197
61
|
},
|
198
62
|
template: {
|