tpmkms_4wp 8.9.1-beta.1 → 8.9.1-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.
package/common/wp.js CHANGED
@@ -9,6 +9,8 @@ const wp_tests = require('./wp.test.json')
9
9
  const instance = require('./wp.instance.json')
10
10
 
11
11
  /*
12
+ the bolded words that start with t
13
+
12
14
  start inserting text until I say banana
13
15
  ...
14
16
  or
@@ -17,12 +19,16 @@ const instance = require('./wp.instance.json')
17
19
  make the text of the 1st to 3rd paragraphs blue
18
20
 
19
21
 
22
+ make the words that start with a bold
23
+
20
24
  make every word bold and underlines and blue -> weirdly "bold underlined and blue" works
21
25
 
22
26
  make the font ...
23
27
  make the color blue
24
28
  make the color of the first paragraph blue
25
29
 
30
+ undeline the bolded text / the text that is bolded
31
+
26
32
  words that start with a
27
33
  make all the bold text uppercase
28
34
  underline all the bold text
@@ -34,10 +40,17 @@ const instance = require('./wp.instance.json')
34
40
  words containing a
35
41
  every 5th word
36
42
 
43
+ the words that are capitalized
44
+
37
45
  in the first paragraph make the words that start with abc bold
38
46
  bold the first three words that start with t
39
47
  bold much and many
40
48
  make the words that start with t bold and underlined
49
+ make all the capital letters|punctuation bold
50
+
51
+ move this paragraph up 2
52
+ move the next paragraph up 1
53
+ move the last paragraph before this one
41
54
  */
42
55
 
43
56
  class API {
@@ -90,16 +103,21 @@ const changeState = ({api, isA, context, toArray, element, state}) => {
90
103
  let conditions = []
91
104
  if (isA(context.element, 'everything')) {
92
105
  scope = 'all'
93
- } else if (context.element.condition) {
94
- const condition = context.element.condition
95
- if (condition.marker == 'wordComparisonWith_wp') {
96
- // with or not with that is the question
97
- const letters = condition.letters.letters.text
98
- conditions.push({ comparison: condition.comparison, letters })
99
- } else if (condition.marker == 'wordComparison_wp') {
100
- // with or not with that is the question
101
- const letters = condition.letters.text
102
- conditions.push({ comparison: condition.comparison, letters })
106
+ } else if (context.element.conditions) {
107
+ for (const condition of context.element.conditions) {
108
+ if (condition.marker == 'wordComparisonWith_wp') {
109
+ // with or not with that is the question
110
+ const letters = condition.letters.letters.text
111
+ conditions.push({ comparison: condition.comparison, letters })
112
+ } else if (condition.marker == 'wordComparison_wp') {
113
+ // with or not with that is the question
114
+ const letters = condition.letters.text
115
+ conditions.push({ comparison: condition.comparison, letters })
116
+ } else if (isA(condition, 'styleModifier_wp')) {
117
+ for (const style of toArray(condition)) {
118
+ conditions.push({ hasStyle: style.marker })
119
+ }
120
+ }
103
121
  }
104
122
  } else {
105
123
  scope = context.element.quantity.quantity
@@ -114,13 +132,16 @@ template = {
114
132
  'setidsuffix _wp',
115
133
  'words are countable and statefulElements',
116
134
  'characters are countable',
117
- 'paragraphs are countable',
135
+ 'paragraphs are countable and statefulElement',
136
+ 'text is a statefulElement',
118
137
  'bold, italic, code, capitalize, lowercase and underline are styles',
119
138
  'underlined means underline',
120
139
  'capitalized means capitalize',
121
140
  'uppercase means capitalize',
122
141
  'italicize means italic',
123
142
  'italicized means italic',
143
+ // TODO have a mode where I can stay this is a definition sentence then just say style modifies and it will do it right
144
+ 'capitalized, bolded, italicized and underlined are styleModifiers',
124
145
  // 'start end and contain are wordComparisonWiths',
125
146
  // 'styles are negatable',
126
147
  "resetIdSuffix",
@@ -130,8 +151,17 @@ template = {
130
151
  "((style_wp/*) [applyStyle_wp] ([statefulElement_wp|]))",
131
152
  "((word_wp/*) [wordComparisonWith_wp] ([comparisonWith_wp|with] (a/0)? (letters)))",
132
153
  "((word_wp/*) [wordComparison_wp] (a/0)? (letters))",
154
+ // this one is "the bolded/underlined/italized/... word"
155
+ "((styleModifier_wp/*) [modifiedByStyle_wp] (statefulElement_wp/* && context.determiner == undefined))",
133
156
  ],
134
157
  bridges: [
158
+ {
159
+ id: 'modifiedByStyle_wp',
160
+ // parents: ['verb'],
161
+ parents: ['adjective'],
162
+ convolution: true,
163
+ bridge: "{ ...after[0], style: before[0], target: after[0], generate: ['style', 'target'], conditions: append(after[0].conditions, [before[0]]) }",
164
+ },
135
165
  {
136
166
  id: 'wordComparisonWith_wp',
137
167
  parents: ['verb'],
@@ -219,6 +249,7 @@ template = {
219
249
  },
220
250
  ],
221
251
  priorities: [
252
+ // { "context": [['underline_wp',0], ['statefulElement_wp', 1], ['thatVerb', 0]], ordered: true, choose: [2] },
222
253
  { "context": [['changeState_wp',0], ['statefulElement_wp', 0], ['list', 0]], ordered: true, choose: [0] },
223
254
  { "context": [['comparisonWith_wp',0], ['unknown', 0], ['list', 1]], ordered: true, choose: [0] },
224
255
  ],