tpmkms_4wp 8.9.0-beta.11 → 8.9.0-beta.13
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/helpers/conjunction.js +75 -0
- package/common/wp.js +6 -3
- package/common/wp.test.json +5 -9
- package/package.json +3 -2
@@ -0,0 +1,75 @@
|
|
1
|
+
const { propertyToArray } = require('../helpers.js')
|
2
|
+
|
3
|
+
const asList = (context) => {
|
4
|
+
if (context.marker === 'list') {
|
5
|
+
return context
|
6
|
+
}
|
7
|
+
return {
|
8
|
+
marker: 'list',
|
9
|
+
types: [context.marker],
|
10
|
+
value: [context]
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
const listable = (hierarchy) => (c, type) => {
|
15
|
+
if (!c) {
|
16
|
+
return false
|
17
|
+
}
|
18
|
+
if (hierarchy.isA(c.marker, type)) {
|
19
|
+
return true
|
20
|
+
}
|
21
|
+
if (c.marker === 'list') {
|
22
|
+
for (const t of c.types) {
|
23
|
+
if (hierarchy.isA(t, type)) {
|
24
|
+
return true
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
return false
|
29
|
+
}
|
30
|
+
|
31
|
+
const isA = (hierarchy) => (child, parent, { strict=false } = {}) => {
|
32
|
+
if (!child || !parent) {
|
33
|
+
return false
|
34
|
+
}
|
35
|
+
|
36
|
+
if (strict) {
|
37
|
+
if (child.marker) {
|
38
|
+
child = child.marker
|
39
|
+
}
|
40
|
+
if (parent.marker) {
|
41
|
+
parent = parent.marker
|
42
|
+
}
|
43
|
+
return hierarchy.isA(child, parent)
|
44
|
+
} else {
|
45
|
+
const children = propertyToArray(child)
|
46
|
+
for (let child of children) {
|
47
|
+
let okay = false
|
48
|
+
if (hierarchy.isA(child.marker || child, parent.marker || parent)) {
|
49
|
+
okay = true
|
50
|
+
} else {
|
51
|
+
for (const childT of child.types || [child]) {
|
52
|
+
if (okay) {
|
53
|
+
break
|
54
|
+
}
|
55
|
+
for (const parentT of parent.types || [parent]) {
|
56
|
+
if (hierarchy.isA(childT, parentT)) {
|
57
|
+
okay = true
|
58
|
+
break
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
if (!okay) {
|
64
|
+
return false
|
65
|
+
}
|
66
|
+
}
|
67
|
+
return true
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
module.exports = {
|
72
|
+
asList,
|
73
|
+
isA,
|
74
|
+
listable,
|
75
|
+
}
|
package/common/wp.js
CHANGED
@@ -58,7 +58,10 @@ template = {
|
|
58
58
|
['thisitthat', 'statefulElement'],
|
59
59
|
],
|
60
60
|
semantic: ({api, isA, context, toArray}) => {
|
61
|
-
const
|
61
|
+
const root = (id) => {
|
62
|
+
return id.split('_')[0]
|
63
|
+
}
|
64
|
+
const unit = root(context.element.marker)
|
62
65
|
const scope = context.element.quantity.quantity
|
63
66
|
let color;
|
64
67
|
const styles = []
|
@@ -68,9 +71,9 @@ template = {
|
|
68
71
|
if (!update.styles) {
|
69
72
|
update.styles = []
|
70
73
|
}
|
71
|
-
update.styles.push(state.value
|
74
|
+
update.styles.push(root(state.value))
|
72
75
|
} else {
|
73
|
-
update.color = state.value
|
76
|
+
update.color = root(state.value)
|
74
77
|
}
|
75
78
|
}
|
76
79
|
api.changeState(update)
|
package/common/wp.test.json
CHANGED
@@ -7647,7 +7647,7 @@
|
|
7647
7647
|
"changeState": {
|
7648
7648
|
"color": "blue",
|
7649
7649
|
"scope": "every",
|
7650
|
-
"unit": "
|
7650
|
+
"unit": "word"
|
7651
7651
|
}
|
7652
7652
|
}
|
7653
7653
|
},
|
@@ -8276,7 +8276,6 @@
|
|
8276
8276
|
"word": "make"
|
8277
8277
|
}
|
8278
8278
|
],
|
8279
|
-
"developerTest": false,
|
8280
8279
|
"generatedParenthesized": [
|
8281
8280
|
""
|
8282
8281
|
],
|
@@ -8868,7 +8867,7 @@
|
|
8868
8867
|
"styles": [
|
8869
8868
|
"bold"
|
8870
8869
|
],
|
8871
|
-
"unit": "
|
8870
|
+
"unit": "word"
|
8872
8871
|
}
|
8873
8872
|
}
|
8874
8873
|
},
|
@@ -9573,7 +9572,6 @@
|
|
9573
9572
|
"word": "make"
|
9574
9573
|
}
|
9575
9574
|
],
|
9576
|
-
"developerTest": false,
|
9577
9575
|
"generatedParenthesized": [
|
9578
9576
|
""
|
9579
9577
|
],
|
@@ -10219,7 +10217,7 @@
|
|
10219
10217
|
"bold",
|
10220
10218
|
"underlined"
|
10221
10219
|
],
|
10222
|
-
"unit": "
|
10220
|
+
"unit": "word"
|
10223
10221
|
}
|
10224
10222
|
}
|
10225
10223
|
},
|
@@ -10952,7 +10950,6 @@
|
|
10952
10950
|
"word": "make"
|
10953
10951
|
}
|
10954
10952
|
],
|
10955
|
-
"developerTest": false,
|
10956
10953
|
"generatedParenthesized": [
|
10957
10954
|
""
|
10958
10955
|
],
|
@@ -11598,7 +11595,7 @@
|
|
11598
11595
|
"styles": [
|
11599
11596
|
"bold"
|
11600
11597
|
],
|
11601
|
-
"unit": "
|
11598
|
+
"unit": "word"
|
11602
11599
|
}
|
11603
11600
|
}
|
11604
11601
|
},
|
@@ -12374,7 +12371,6 @@
|
|
12374
12371
|
"word": "make"
|
12375
12372
|
}
|
12376
12373
|
],
|
12377
|
-
"developerTest": false,
|
12378
12374
|
"generatedParenthesized": [
|
12379
12375
|
""
|
12380
12376
|
],
|
@@ -13079,7 +13075,7 @@
|
|
13079
13075
|
"bold",
|
13080
13076
|
"underlined"
|
13081
13077
|
],
|
13082
|
-
"unit": "
|
13078
|
+
"unit": "word"
|
13083
13079
|
}
|
13084
13080
|
}
|
13085
13081
|
},
|
package/package.json
CHANGED
@@ -196,6 +196,7 @@
|
|
196
196
|
"common/help.test.json",
|
197
197
|
"common/helpers.js",
|
198
198
|
"common/helpers/concept.js",
|
199
|
+
"common/helpers/conjunction.js",
|
199
200
|
"common/helpers/dialogues.js",
|
200
201
|
"common/helpers/formulas.js",
|
201
202
|
"common/helpers/frankenhash.js",
|
@@ -314,8 +315,8 @@
|
|
314
315
|
"table": "^6.7.1",
|
315
316
|
"base-64": "^1.0.0",
|
316
317
|
"argparse": "^2.0.1",
|
317
|
-
"theprogrammablemind_4wp": "8.9.0-beta.
|
318
|
+
"theprogrammablemind_4wp": "8.9.0-beta.13"
|
318
319
|
},
|
319
|
-
"version": "8.9.0-beta.
|
320
|
+
"version": "8.9.0-beta.13",
|
320
321
|
"license": "UNLICENSED"
|
321
322
|
}
|