ekms 8.9.0-beta.0 → 8.9.0-beta.10

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/ui.js CHANGED
@@ -2,6 +2,7 @@ const { knowledgeModule, where, Digraph } = require('./runtime').theprogrammable
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const dialogues = require('./dialogues')
4
4
  const ordinals = require('./ordinals')
5
+ const countable = require('./countable')
5
6
  const ui_tests = require('./ui.test.json')
6
7
  const ui_instance = require('./ui.instance.json')
7
8
 
@@ -10,8 +11,8 @@ class API {
10
11
  this._objects = objects
11
12
  }
12
13
 
13
- move(direction, steps = 1) {
14
- this._objects.move = { direction, steps }
14
+ move(direction, steps = 1, units = undefined) {
15
+ this._objects.move = { direction, steps, units }
15
16
  }
16
17
 
17
18
  select(item) {
@@ -52,7 +53,7 @@ const config = {
52
53
  "([right])",
53
54
  "([stop] ([action]))",
54
55
  "([listening])",
55
- "(([direction]) [moveAmount|] ([number]))"
56
+ "(([direction]) [moveAmount|] (number/* || context.quantity != null))"
56
57
  ],
57
58
  semantics: [
58
59
  {
@@ -96,6 +97,7 @@ const config = {
96
97
  where: where(),
97
98
  id: "moveAmount",
98
99
  isA: ['preposition'],
100
+ after: ['counting'],
99
101
  convolution: true,
100
102
  level: 0,
101
103
  bridge: "{ ...before[0], postModifiers: ['steps'], steps: after[0] }",
@@ -131,7 +133,12 @@ const config = {
131
133
  optional: { 1: "{ marker: 'moveable', pullFromContext: true, default: true, skipDefault: true }" },
132
134
  bridge: "{ ...next(operator), operator: operator, moveable: after[0], direction: after[1], generate: ['operator', 'moveable', 'direction' ] }",
133
135
  semantic: ({api, context}) => {
134
- api.move(context.direction.value, context.direction.steps ? context.direction.steps.value : 1)
136
+ if (context.direction?.steps?.quantity) {
137
+ debugger
138
+ api.move(context.direction.value, context.direction.steps.quantity.value, context.direction.steps.marker)
139
+ } else {
140
+ api.move(context.direction.value, context.direction.steps ? context.direction.steps.value : 1)
141
+ }
135
142
  }
136
143
  },
137
144
  { id: "moveable", },
@@ -183,7 +190,7 @@ const template = {
183
190
 
184
191
  knowledgeModule({
185
192
  config,
186
- includes: [dialogues, ordinals],
193
+ includes: [dialogues, ordinals, countable],
187
194
  api: () => new API(),
188
195
 
189
196
  module,