tpmkms_4wp 8.9.0-beta.19 → 8.9.0-beta.3

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.
Files changed (40) hide show
  1. package/common/animals.instance.json +0 -65
  2. package/common/articles.js +0 -4
  3. package/common/colors.instance.json +0 -71
  4. package/common/comparable.instance.json +0 -15
  5. package/common/conjunction.js +18 -27
  6. package/common/countable.js +2 -8
  7. package/common/countable.test.json +0 -586
  8. package/common/crew.instance.json +176 -130
  9. package/common/dialogues.js +11 -7
  10. package/common/dimension.instance.json +0 -10
  11. package/common/edible.instance.json +0 -376
  12. package/common/emotions.instance.json +0 -8
  13. package/common/fastfood.instance.json +924 -1437
  14. package/common/formulas.instance.json +0 -10
  15. package/common/helpers/dialogues.js +8 -14
  16. package/common/helpers/properties.js +2 -2
  17. package/common/helpers.js +0 -29
  18. package/common/hierarchy.js +5 -5
  19. package/common/hierarchy.test.json +0 -1491
  20. package/common/kirk.instance.json +0 -5
  21. package/common/length.instance.json +0 -150
  22. package/common/math.instance.json +0 -10
  23. package/common/meta.js +3 -5
  24. package/common/ordering.instance.json +0 -10
  25. package/common/people.instance.json +4 -169
  26. package/common/pipboy.instance.json +28 -198
  27. package/common/pokemon.instance.json +0 -65
  28. package/common/pressure.instance.json +0 -40
  29. package/common/properties.instance.json +0 -5
  30. package/common/reports.instance.json +1 -21
  31. package/common/spock.instance.json +0 -5
  32. package/common/temperature.instance.json +0 -40
  33. package/common/ui.instance.json +0 -10
  34. package/common/ui.js +1 -0
  35. package/common/weight.instance.json +0 -120
  36. package/common/wp.instance.json +954 -28870
  37. package/common/wp.js +10 -147
  38. package/common/wp.test.json +698 -28243
  39. package/package.json +2 -3
  40. 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,108 +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
- 'setidsuffix _wp',
98
- 'words are countable and statefulElements',
39
+ 'words are countable',
99
40
  'characters are countable',
100
41
  'paragraphs are countable',
101
- 'bold, italic, code, capitalize, lowercase and underline are styles',
102
- 'underlined means underline',
103
- 'capitalized means capitalize',
104
- 'uppercase means capitalize',
105
- 'italicize means italic',
106
- 'italicized means italic',
107
- // 'styles are negatable',
108
- "resetIdSuffix",
109
- {
110
- operators: [
111
- // TODO write a parser for this so I can use statefulElement as the id
112
- "([changeState_wp|make] ([statefulElement_wp]) ([stateValue_wp|]))",
113
- "((style_wp/*) [applyStyle_wp] ([statefulElement_wp|]))",
114
- ],
115
- bridges: [
116
- {
117
- id: 'applyStyle_wp',
118
- parents: ['verb'],
119
- convolution: true,
120
- bridge: "{ ...next(operator), element: after[0], state: before[0], operator: operator, generate: ['state', 'element'] }",
121
- localHierarchy: [
122
- ['thisitthat', 'statefulElement_wp'],
123
- ['everything', 'statefulElement_wp'],
124
- ],
125
- semantic: (args) => {
126
- changeState({...args, element: args.context.element, state: args.context.state})
127
- }
128
- },
129
- {
130
- id: 'changeState_wp',
131
- parents: ['verb'],
132
- bridge: "{ ...next(operator), element: after[0], state: after[1], operator: operator, generate: ['operator', 'element', 'state'] }",
133
- localHierarchy: [
134
- ['thisitthat', 'statefulElement_wp'],
135
- ['everything', 'statefulElement_wp'],
136
- ],
137
- semantic: (args) => {
138
- changeState({...args, element: args.context.element, state: args.context.state})
139
- }
140
- },
141
- {
142
- id: 'stateValue_wp',
143
- children: ['color_colors', 'style_wp'],
144
- },
145
- ],
146
- semantics: [
147
- {
148
- where: where(),
149
- match: ({context, isA}) => isA(context, 'style_wp') && !context.same && !context.isResponse && !context.evaluate,
150
- apply: ({context, api, isA, toArray}) => {
151
- const update = { scope: 'selection' }
152
- setUpdate(isA, update, toArray(context))
153
- api.changeState(update)
154
- }
155
- },
156
- {
157
- where: where(),
158
- match: ({context, isA}) => isA(context, 'statefulElement_wp') && !context.same && !context.isResponse && !context.evaluate,
159
- apply: ({context, api, isA, toArray}) => {
160
- const unit = root(context.marker)
161
- let scope
162
- if (context.quantity) {
163
- scope = context.quantity.quantity
164
- }
165
- // TODO set default scope for "every word bold underlined etc"
166
- }
167
- },
168
- ],
169
- priorities: [
170
- { "context": [['changeState_wp',0], ['statefulElement_wp', 0], ['list', 0]], ordered: true, choose: [0] },
171
- ],
172
- },
173
- // "([changeState_wp|make] ([statefulElement_wp]) ([stateValue_wp|]))",
174
- // "((style_wp/*) [applyStyle_wp] ([statefulElement_wp|]))",
175
- // "x statefulElement_wp y means y changeState_wp x",
176
- ]
42
+ ],
177
43
  }
178
44
 
179
45
  knowledgeModule({
180
46
  config,
181
- includes: [ui, countable, colors, errors],
47
+ includes: [ui, countable],
182
48
  api: () => new API(),
183
49
 
184
50
  module,
@@ -190,10 +56,7 @@ knowledgeModule({
190
56
  context: [
191
57
  ...defaultContextCheck(),
192
58
  ],
193
- objects: [
194
- 'changeState',
195
- { km: 'ui' },
196
- ],
59
+ objects: [{ km: 'ui' }],
197
60
  },
198
61
  },
199
62
  template: {