tpmkms_4wp 9.1.1-beta.6 → 9.1.1-beta.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/common/colors.instance.json +28 -0
- package/common/dialogues.js +2 -1
- package/common/edible.instance.json +112 -0
- package/common/fastfood.instance.json +1383 -1653
- package/common/formulas.js +3 -1
- package/common/helpers/concept.js +6 -2
- package/common/helpers/dialogues.js +1 -1
- package/common/menus.instance.json +6261 -5
- package/common/menus.js +102 -5
- package/common/menus.test.json +5306 -1
- package/common/people.instance.json +0 -36
- package/common/pipboy.instance.json +56 -0
- package/common/pokemon.instance.json +0 -8
- package/common/reports.instance.json +14 -22
- package/common/wp.instance.json +56 -0
- package/package.json +2 -2
package/common/menus.js
CHANGED
@@ -1,18 +1,23 @@
|
|
1
1
|
const { knowledgeModule, where, Digraph } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const ui = require('./ui')
|
4
|
-
const
|
5
|
-
const
|
4
|
+
const tests = require('./menus.test.json')
|
5
|
+
const instance = require('./menus.instance.json')
|
6
6
|
|
7
7
|
class API {
|
8
8
|
initialize({ objects }) {
|
9
9
|
this._objects = objects
|
10
|
+
this._objects.show = []
|
10
11
|
}
|
11
12
|
|
12
13
|
move(direction, steps = 1, units = undefined) {
|
13
14
|
this._objects.move = { direction, steps, units }
|
14
15
|
}
|
15
16
|
|
17
|
+
show(item) {
|
18
|
+
this._objects.show.push(item)
|
19
|
+
}
|
20
|
+
|
16
21
|
select(item) {
|
17
22
|
this._objects.select = { item }
|
18
23
|
}
|
@@ -28,6 +33,32 @@ class API {
|
|
28
33
|
stop(action) {
|
29
34
|
this._objects.stop = action
|
30
35
|
}
|
36
|
+
|
37
|
+
addMenu(name) {
|
38
|
+
const config = this.args.config
|
39
|
+
const id = name
|
40
|
+
const languageId = `${name}Menu_menus`
|
41
|
+
config.addOperator(`([${languageId}|])`)
|
42
|
+
config.addBridge({
|
43
|
+
id: `${languageId}`,
|
44
|
+
associations: [languageId],
|
45
|
+
isA: ['menu_menus'],
|
46
|
+
words: [{ word: name, value: id, instance: true }],
|
47
|
+
})
|
48
|
+
return { languageId, id }
|
49
|
+
}
|
50
|
+
|
51
|
+
addMenuItem(menuId, id, name) {
|
52
|
+
const config = this.args.config
|
53
|
+
const languageId = `${id}MenuItem_menus`
|
54
|
+
config.addOperator(`([${languageId}|])`)
|
55
|
+
config.addBridge({
|
56
|
+
id: `${languageId}`,
|
57
|
+
associations: [menuId.languageId],
|
58
|
+
isA: ['menu_menus_item_menus'],
|
59
|
+
words: [{ word: name, value: id, path: [menuId.id, id], instance: true }],
|
60
|
+
})
|
61
|
+
}
|
31
62
|
}
|
32
63
|
|
33
64
|
const config = {
|
@@ -35,10 +66,75 @@ const config = {
|
|
35
66
|
};
|
36
67
|
|
37
68
|
const template = {
|
69
|
+
configs: [
|
70
|
+
'setidsuffix _menus',
|
71
|
+
"menu is a concept",
|
72
|
+
"item is a concept",
|
73
|
+
"menu modifies item",
|
74
|
+
"menus and menu items are showable",
|
75
|
+
{
|
76
|
+
operators: [
|
77
|
+
"([show_menus|show] (showable_menus))",
|
78
|
+
"((@<= menu_menus) [typeOfMenu_menus|show] (@== menu_menus))",
|
79
|
+
],
|
80
|
+
bridges: [
|
81
|
+
{
|
82
|
+
id: 'show_menus',
|
83
|
+
isA: ['verb'],
|
84
|
+
bridge: "{ ...next(operator), show: after[0], generate: ['this', 'show'] }",
|
85
|
+
semantic: ({context, api}) => {
|
86
|
+
if (context.show.instance) {
|
87
|
+
api.show(context.show.value)
|
88
|
+
}
|
89
|
+
}
|
90
|
+
},
|
91
|
+
{
|
92
|
+
id: 'typeOfMenu_menus',
|
93
|
+
convolution: true,
|
94
|
+
isA: ['adjective'],
|
95
|
+
bridge: "{ ...after[0], modifiers: ['menus'], menus: before[0] }",
|
96
|
+
},
|
97
|
+
],
|
98
|
+
semantics: [
|
99
|
+
{
|
100
|
+
where: where(),
|
101
|
+
match: ({context, isA}) => isA(context, 'showable_menus'),
|
102
|
+
apply: async ({context, insert, s, fragments}) => {
|
103
|
+
const value = context
|
104
|
+
const fragment = fragments("show showable")
|
105
|
+
const mappings = [{
|
106
|
+
where: where(),
|
107
|
+
match: ({context}) => context.value == 'showable_menus',
|
108
|
+
apply: ({context}) => Object.assign(context, value),
|
109
|
+
}]
|
110
|
+
const instantiation = await fragment.instantiate(mappings)
|
111
|
+
await s(instantiation)
|
112
|
+
}
|
113
|
+
},
|
114
|
+
]
|
115
|
+
},
|
116
|
+
],
|
38
117
|
fragments: [
|
118
|
+
"show showable",
|
39
119
|
],
|
40
120
|
}
|
41
121
|
|
122
|
+
/*
|
123
|
+
show the file menu
|
124
|
+
pick the file open item
|
125
|
+
show file
|
126
|
+
|
127
|
+
file (<- instance of menu) menu (<- concept of menu)
|
128
|
+
*/
|
129
|
+
// called for the non-module load to setup fixtures
|
130
|
+
const fixtures = async ({api, fragment, s, config, objects, kms, isModule}) => {
|
131
|
+
const fileMenuId = api.addMenu('file')
|
132
|
+
const objectMenuId = api.addMenu('object')
|
133
|
+
|
134
|
+
api.addMenuItem(fileMenuId, 'fileOpen', 'open')
|
135
|
+
api.addMenuItem(objectMenuId, 'objectOpen', 'open')
|
136
|
+
}
|
137
|
+
|
42
138
|
knowledgeModule({
|
43
139
|
config,
|
44
140
|
includes: [ui],
|
@@ -48,14 +144,15 @@ knowledgeModule({
|
|
48
144
|
description: 'Control menues with speech',
|
49
145
|
test: {
|
50
146
|
name: './menus.test.json',
|
51
|
-
contents:
|
147
|
+
contents: tests,
|
148
|
+
fixtures,
|
52
149
|
checks: {
|
53
|
-
objects: ['move', 'select', 'unselect', 'cancel', 'stop'],
|
150
|
+
objects: ['move', 'select', 'unselect', 'cancel', 'stop', 'show'],
|
54
151
|
context: defaultContextCheck(['operator', 'direction', 'moveable']),
|
55
152
|
},
|
56
153
|
},
|
57
154
|
template: {
|
58
155
|
template,
|
59
|
-
instance
|
156
|
+
instance,
|
60
157
|
}
|
61
158
|
})
|