ekms 8.9.0-beta.1 → 8.9.0-beta.11
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/colors.instance.json +1 -0
- package/common/conjunction.js +27 -18
- package/common/countable.js +8 -2
- package/common/countable.test.json +586 -0
- package/common/crew.instance.json +0 -176
- package/common/dimension.instance.json +5 -0
- package/common/edible.instance.json +216 -0
- package/common/emotions.instance.json +63 -0
- package/common/fastfood.instance.json +508 -160
- package/common/formulas.instance.json +5 -0
- package/common/helpers/dialogues.js +8 -2
- package/common/helpers/properties.js +2 -2
- package/common/helpers.js +29 -0
- package/common/hierarchy.js +5 -5
- package/common/hierarchy.test.json +1491 -0
- package/common/length.instance.json +75 -0
- package/common/math.instance.json +5 -0
- package/common/people.instance.json +40 -4
- package/common/pipboy.instance.json +113 -28
- package/common/pipboy.js +0 -1
- package/common/pressure.instance.json +20 -0
- package/common/reports.instance.json +11 -1
- package/common/temperature.instance.json +72 -0
- package/common/ui.instance.json +5 -0
- package/common/ui.js +0 -1
- package/common/weight.instance.json +60 -0
- package/common/wp.instance.json +13911 -842
- package/common/wp.js +78 -8
- package/common/wp.test.json +10179 -350
- package/package.json +2 -2
package/common/wp.js
CHANGED
@@ -3,28 +3,95 @@ 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
|
|
11
|
+
/*
|
12
|
+
start inserting text until I say banana
|
13
|
+
...
|
14
|
+
or
|
15
|
+
stop inserting text
|
16
|
+
|
17
|
+
make the text of the 1st to 3rd paragraphs blue
|
18
|
+
|
19
|
+
|
20
|
+
make every word bold and underlines and blue -> weirdly "bold underlined and blue" works
|
21
|
+
*/
|
22
|
+
|
23
|
+
class API {
|
24
|
+
initialize({ objects }) {
|
25
|
+
this._objects = objects
|
26
|
+
}
|
27
|
+
|
28
|
+
changeState(value) {
|
29
|
+
this._objects.changeState = value
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
const api = new API()
|
34
|
+
|
9
35
|
let config = {
|
10
36
|
name: 'wp',
|
11
|
-
operators: [
|
12
|
-
],
|
13
|
-
bridges: [
|
14
|
-
]
|
15
37
|
};
|
16
38
|
|
17
39
|
template = {
|
18
40
|
configs: [
|
19
|
-
'
|
41
|
+
'setidsuffix _wp',
|
42
|
+
'words are countable and statefulElements',
|
20
43
|
'characters are countable',
|
21
44
|
'paragraphs are countable',
|
22
|
-
|
45
|
+
'bold, italic and underlined are styles',
|
46
|
+
"resetIdSuffix",
|
47
|
+
{
|
48
|
+
operators: [
|
49
|
+
// TODO write a parser for this so I can use statefulElement as the id
|
50
|
+
"([changeState_wp|make] ([statefulElement_wp]) ([stateValue_wp|]))",
|
51
|
+
],
|
52
|
+
bridges: [
|
53
|
+
{
|
54
|
+
id: 'changeState_wp',
|
55
|
+
parents: ['verb'],
|
56
|
+
bridge: "{ ...next(operator), element: after[0], state: after[1], operator: operator, generate: ['operator', 'element', 'state'] }",
|
57
|
+
localHierarchy: [
|
58
|
+
['thisitthat', 'statefulElement'],
|
59
|
+
],
|
60
|
+
semantic: ({api, isA, context, toArray}) => {
|
61
|
+
const unit = context.element.marker
|
62
|
+
const scope = context.element.quantity.quantity
|
63
|
+
let color;
|
64
|
+
const styles = []
|
65
|
+
const update = { unit, scope }
|
66
|
+
for (const state of toArray(context.state)) {
|
67
|
+
if (isA(state, 'style_wp')) {
|
68
|
+
if (!update.styles) {
|
69
|
+
update.styles = []
|
70
|
+
}
|
71
|
+
update.styles.push(state.value.split('_')[0])
|
72
|
+
} else {
|
73
|
+
update.color = state.value.split('_')[0]
|
74
|
+
}
|
75
|
+
}
|
76
|
+
api.changeState(update)
|
77
|
+
}
|
78
|
+
},
|
79
|
+
{
|
80
|
+
id: 'stateValue_wp',
|
81
|
+
children: ['color_colors', 'style_wp'],
|
82
|
+
},
|
83
|
+
],
|
84
|
+
priorities: [
|
85
|
+
{ "context": [['changeState_wp',0], ['statefulElement_wp', 0], ['list', 0]], ordered: true, choose: [0] },
|
86
|
+
],
|
87
|
+
},
|
88
|
+
]
|
23
89
|
}
|
24
90
|
|
25
91
|
knowledgeModule({
|
26
92
|
config,
|
27
|
-
includes: [ui, countable],
|
93
|
+
includes: [ui, countable, colors, errors],
|
94
|
+
api: () => new API(),
|
28
95
|
|
29
96
|
module,
|
30
97
|
description: 'Word processor',
|
@@ -35,7 +102,10 @@ knowledgeModule({
|
|
35
102
|
context: [
|
36
103
|
...defaultContextCheck(),
|
37
104
|
],
|
38
|
-
objects: [
|
105
|
+
objects: [
|
106
|
+
'changeState',
|
107
|
+
{ km: 'ui' },
|
108
|
+
],
|
39
109
|
},
|
40
110
|
},
|
41
111
|
template: {
|