tpmkms_4wp 8.9.0-beta.13 → 8.9.0-beta.14
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.instance.json +203 -24
- package/common/wp.js +50 -17
- package/common/wp.test.json +3698 -161
- package/package.json +2 -2
package/common/wp.instance.json
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
"words are countable and statefulElements",
|
5
5
|
"characters are countable",
|
6
6
|
"paragraphs are countable",
|
7
|
-
"bold, italic and underlined are styles",
|
7
|
+
"bold, italic, code and underlined are styles",
|
8
8
|
"resetIdSuffix",
|
9
9
|
{
|
10
10
|
"operators": [
|
@@ -23,7 +23,7 @@
|
|
23
23
|
"statefulElement"
|
24
24
|
]
|
25
25
|
],
|
26
|
-
"semantic": "({api, context}) => {\n const unit = context.element.marker\n const scope = context.element.quantity.quantity\n
|
26
|
+
"semantic": "({api, isA, context, toArray}) => {\n const root = (id) => {\n return id.split('_')[0]\n }\n const unit = root(context.element.marker)\n const scope = context.element.quantity.quantity\n let color;\n const styles = []\n const update = { unit, scope }\n for (const state of toArray(context.state)) {\n if (isA(state, 'style_wp')) {\n if (!update.styles) {\n update.styles = []\n }\n let style = root(state.value)\n if (style == 'underlined') {\n style = 'underline'\n }\n update.styles.push(root(state.value))\n } else {\n update.color = root(state.value)\n }\n }\n api.changeState(update)\n }"
|
27
27
|
},
|
28
28
|
{
|
29
29
|
"id": "stateValue_wp",
|
@@ -2244,7 +2244,8 @@
|
|
2244
2244
|
"level": 1,
|
2245
2245
|
"topLevel": true,
|
2246
2246
|
"touchedBy": [
|
2247
|
-
"wp#call2"
|
2247
|
+
"wp#call2",
|
2248
|
+
"instance0#wp#call2"
|
2248
2249
|
]
|
2249
2250
|
}
|
2250
2251
|
],
|
@@ -4620,7 +4621,8 @@
|
|
4620
4621
|
"level": 2,
|
4621
4622
|
"topLevel": true,
|
4622
4623
|
"touchedBy": [
|
4623
|
-
"wp#call2"
|
4624
|
+
"wp#call2",
|
4625
|
+
"instance0#wp#call2"
|
4624
4626
|
]
|
4625
4627
|
}
|
4626
4628
|
],
|
@@ -7049,7 +7051,8 @@
|
|
7049
7051
|
"level": 2,
|
7050
7052
|
"topLevel": true,
|
7051
7053
|
"touchedBy": [
|
7052
|
-
"wp#call2"
|
7054
|
+
"wp#call2",
|
7055
|
+
"instance0#wp#call2"
|
7053
7056
|
]
|
7054
7057
|
}
|
7055
7058
|
],
|
@@ -9470,7 +9473,8 @@
|
|
9470
9473
|
"level": 2,
|
9471
9474
|
"topLevel": true,
|
9472
9475
|
"touchedBy": [
|
9473
|
-
"wp#call2"
|
9476
|
+
"wp#call2",
|
9477
|
+
"instance0#wp#call2"
|
9474
9478
|
]
|
9475
9479
|
}
|
9476
9480
|
],
|
@@ -11822,6 +11826,10 @@
|
|
11822
11826
|
0
|
11823
11827
|
],
|
11824
11828
|
"ops": [
|
11829
|
+
[
|
11830
|
+
"comma",
|
11831
|
+
0
|
11832
|
+
],
|
11825
11833
|
[
|
11826
11834
|
"comma",
|
11827
11835
|
0
|
@@ -11846,6 +11854,10 @@
|
|
11846
11854
|
"unknown",
|
11847
11855
|
0
|
11848
11856
|
],
|
11857
|
+
[
|
11858
|
+
"unknown",
|
11859
|
+
0
|
11860
|
+
],
|
11849
11861
|
[
|
11850
11862
|
"unknown",
|
11851
11863
|
0
|
@@ -11859,6 +11871,10 @@
|
|
11859
11871
|
0
|
11860
11872
|
],
|
11861
11873
|
"ops": [
|
11874
|
+
[
|
11875
|
+
"comma",
|
11876
|
+
0
|
11877
|
+
],
|
11862
11878
|
[
|
11863
11879
|
"comma",
|
11864
11880
|
0
|
@@ -11879,6 +11895,10 @@
|
|
11879
11895
|
"unknown",
|
11880
11896
|
0
|
11881
11897
|
],
|
11898
|
+
[
|
11899
|
+
"unknown",
|
11900
|
+
0
|
11901
|
+
],
|
11882
11902
|
[
|
11883
11903
|
"unknown",
|
11884
11904
|
0
|
@@ -11892,6 +11912,10 @@
|
|
11892
11912
|
0
|
11893
11913
|
],
|
11894
11914
|
"ops": [
|
11915
|
+
[
|
11916
|
+
"comma",
|
11917
|
+
0
|
11918
|
+
],
|
11895
11919
|
[
|
11896
11920
|
"comma",
|
11897
11921
|
0
|
@@ -11908,6 +11932,10 @@
|
|
11908
11932
|
"unknown",
|
11909
11933
|
0
|
11910
11934
|
],
|
11935
|
+
[
|
11936
|
+
"unknown",
|
11937
|
+
0
|
11938
|
+
],
|
11911
11939
|
[
|
11912
11940
|
"unknown",
|
11913
11941
|
0
|
@@ -11921,6 +11949,10 @@
|
|
11921
11949
|
0
|
11922
11950
|
],
|
11923
11951
|
"ops": [
|
11952
|
+
[
|
11953
|
+
"comma",
|
11954
|
+
0
|
11955
|
+
],
|
11924
11956
|
[
|
11925
11957
|
"comma",
|
11926
11958
|
0
|
@@ -11933,6 +11965,10 @@
|
|
11933
11965
|
"list",
|
11934
11966
|
0
|
11935
11967
|
],
|
11968
|
+
[
|
11969
|
+
"unknown",
|
11970
|
+
0
|
11971
|
+
],
|
11936
11972
|
[
|
11937
11973
|
"unknown",
|
11938
11974
|
0
|
@@ -11942,10 +11978,14 @@
|
|
11942
11978
|
},
|
11943
11979
|
{
|
11944
11980
|
"op": [
|
11945
|
-
"
|
11981
|
+
"unknown",
|
11946
11982
|
0
|
11947
11983
|
],
|
11948
11984
|
"ops": [
|
11985
|
+
[
|
11986
|
+
"comma",
|
11987
|
+
0
|
11988
|
+
],
|
11949
11989
|
[
|
11950
11990
|
"comma",
|
11951
11991
|
0
|
@@ -11957,16 +11997,24 @@
|
|
11957
11997
|
[
|
11958
11998
|
"list",
|
11959
11999
|
0
|
12000
|
+
],
|
12001
|
+
[
|
12002
|
+
"unknown",
|
12003
|
+
0
|
11960
12004
|
]
|
11961
12005
|
],
|
11962
12006
|
"counter": 5
|
11963
12007
|
},
|
11964
12008
|
{
|
11965
12009
|
"op": [
|
11966
|
-
"
|
12010
|
+
"list",
|
11967
12011
|
0
|
11968
12012
|
],
|
11969
12013
|
"ops": [
|
12014
|
+
[
|
12015
|
+
"comma",
|
12016
|
+
0
|
12017
|
+
],
|
11970
12018
|
[
|
11971
12019
|
"comma",
|
11972
12020
|
0
|
@@ -11974,10 +12022,52 @@
|
|
11974
12022
|
[
|
11975
12023
|
"is",
|
11976
12024
|
0
|
12025
|
+
],
|
12026
|
+
[
|
12027
|
+
"list",
|
12028
|
+
0
|
11977
12029
|
]
|
11978
12030
|
],
|
11979
12031
|
"counter": 6
|
11980
12032
|
},
|
12033
|
+
{
|
12034
|
+
"op": [
|
12035
|
+
"comma",
|
12036
|
+
0
|
12037
|
+
],
|
12038
|
+
"ops": [
|
12039
|
+
[
|
12040
|
+
"comma",
|
12041
|
+
0
|
12042
|
+
],
|
12043
|
+
[
|
12044
|
+
"comma",
|
12045
|
+
0
|
12046
|
+
],
|
12047
|
+
[
|
12048
|
+
"is",
|
12049
|
+
0
|
12050
|
+
]
|
12051
|
+
],
|
12052
|
+
"counter": 7
|
12053
|
+
},
|
12054
|
+
{
|
12055
|
+
"op": [
|
12056
|
+
"comma",
|
12057
|
+
0
|
12058
|
+
],
|
12059
|
+
"ops": [
|
12060
|
+
[
|
12061
|
+
"comma",
|
12062
|
+
0
|
12063
|
+
],
|
12064
|
+
[
|
12065
|
+
"is",
|
12066
|
+
0
|
12067
|
+
]
|
12068
|
+
],
|
12069
|
+
"counter": 8
|
12070
|
+
},
|
11981
12071
|
{
|
11982
12072
|
"op": [
|
11983
12073
|
"list",
|
@@ -11993,7 +12083,24 @@
|
|
11993
12083
|
1
|
11994
12084
|
]
|
11995
12085
|
],
|
11996
|
-
"counter":
|
12086
|
+
"counter": 9
|
12087
|
+
},
|
12088
|
+
{
|
12089
|
+
"op": [
|
12090
|
+
"list",
|
12091
|
+
1
|
12092
|
+
],
|
12093
|
+
"ops": [
|
12094
|
+
[
|
12095
|
+
"is",
|
12096
|
+
0
|
12097
|
+
],
|
12098
|
+
[
|
12099
|
+
"list",
|
12100
|
+
1
|
12101
|
+
]
|
12102
|
+
],
|
12103
|
+
"counter": 10
|
11997
12104
|
},
|
11998
12105
|
{
|
11999
12106
|
"op": [
|
@@ -12006,7 +12113,7 @@
|
|
12006
12113
|
0
|
12007
12114
|
]
|
12008
12115
|
],
|
12009
|
-
"counter":
|
12116
|
+
"counter": 11
|
12010
12117
|
},
|
12011
12118
|
{
|
12012
12119
|
"op": [
|
@@ -12019,7 +12126,7 @@
|
|
12019
12126
|
1
|
12020
12127
|
]
|
12021
12128
|
],
|
12022
|
-
"counter":
|
12129
|
+
"counter": 12
|
12023
12130
|
}
|
12024
12131
|
]
|
12025
12132
|
},
|
@@ -12027,22 +12134,22 @@
|
|
12027
12134
|
"contexts": [
|
12028
12135
|
{
|
12029
12136
|
"number": "many",
|
12030
|
-
"text": "bold, italic and underlined are styles",
|
12137
|
+
"text": "bold, italic, code and underlined are styles",
|
12031
12138
|
"marker": "is",
|
12032
12139
|
"word": "are",
|
12033
12140
|
"range": {
|
12034
12141
|
"start": 0,
|
12035
|
-
"end":
|
12142
|
+
"end": 43
|
12036
12143
|
},
|
12037
12144
|
"one": {
|
12038
12145
|
"number": "many",
|
12039
12146
|
"marker": "list",
|
12040
12147
|
"default": true,
|
12041
12148
|
"word": "and",
|
12042
|
-
"text": "bold, italic and underlined",
|
12149
|
+
"text": "bold, italic, code and underlined",
|
12043
12150
|
"range": {
|
12044
12151
|
"start": 0,
|
12045
|
-
"end":
|
12152
|
+
"end": 43
|
12046
12153
|
},
|
12047
12154
|
"types": [
|
12048
12155
|
"list",
|
@@ -12087,12 +12194,44 @@
|
|
12087
12194
|
{
|
12088
12195
|
"value": "italic",
|
12089
12196
|
"unknown": true,
|
12090
|
-
"text": "italic",
|
12197
|
+
"text": "italic,",
|
12091
12198
|
"marker": "unknown",
|
12092
12199
|
"word": "italic",
|
12093
12200
|
"range": {
|
12094
12201
|
"start": 6,
|
12095
|
-
"end":
|
12202
|
+
"end": 12
|
12203
|
+
},
|
12204
|
+
"dead": true,
|
12205
|
+
"decorators": {
|
12206
|
+
"after": {
|
12207
|
+
"word": ",",
|
12208
|
+
"value": ",",
|
12209
|
+
"depth": "+",
|
12210
|
+
"text": ",",
|
12211
|
+
"marker": "comma",
|
12212
|
+
"range": {
|
12213
|
+
"start": 12,
|
12214
|
+
"end": 12
|
12215
|
+
},
|
12216
|
+
"level": 0
|
12217
|
+
}
|
12218
|
+
},
|
12219
|
+
"no_convolutions": true,
|
12220
|
+
"types": [
|
12221
|
+
"queryable",
|
12222
|
+
"unknown"
|
12223
|
+
],
|
12224
|
+
"level": 1
|
12225
|
+
},
|
12226
|
+
{
|
12227
|
+
"value": "code",
|
12228
|
+
"unknown": true,
|
12229
|
+
"text": "code",
|
12230
|
+
"marker": "unknown",
|
12231
|
+
"word": "code",
|
12232
|
+
"range": {
|
12233
|
+
"start": 14,
|
12234
|
+
"end": 17
|
12096
12235
|
},
|
12097
12236
|
"types": [
|
12098
12237
|
"queryable",
|
@@ -12108,8 +12247,8 @@
|
|
12108
12247
|
"marker": "unknown",
|
12109
12248
|
"word": "underlined",
|
12110
12249
|
"range": {
|
12111
|
-
"start":
|
12112
|
-
"end":
|
12250
|
+
"start": 23,
|
12251
|
+
"end": 32
|
12113
12252
|
},
|
12114
12253
|
"types": [
|
12115
12254
|
"queryable",
|
@@ -12128,8 +12267,8 @@
|
|
12128
12267
|
"marker": "unknown",
|
12129
12268
|
"word": "styles",
|
12130
12269
|
"range": {
|
12131
|
-
"start":
|
12132
|
-
"end":
|
12270
|
+
"start": 38,
|
12271
|
+
"end": 43
|
12133
12272
|
},
|
12134
12273
|
"dead": true,
|
12135
12274
|
"types": [
|
@@ -12150,7 +12289,7 @@
|
|
12150
12289
|
""
|
12151
12290
|
],
|
12152
12291
|
"paraphrases": [
|
12153
|
-
"bold, italic and underlined are styles"
|
12292
|
+
"bold, italic, code and underlined are styles"
|
12154
12293
|
],
|
12155
12294
|
"paraphrasesParenthesized": [],
|
12156
12295
|
"generatedParenthesized": [],
|
@@ -12250,9 +12389,9 @@
|
|
12250
12389
|
]
|
12251
12390
|
],
|
12252
12391
|
"learned_contextual_priorities": [],
|
12253
|
-
"query": "bold, italic and underlined are styles",
|
12392
|
+
"query": "bold, italic, code and underlined are styles",
|
12254
12393
|
"key": {
|
12255
|
-
"query": "bold, italic and underlined are styles"
|
12394
|
+
"query": "bold, italic, code and underlined are styles"
|
12256
12395
|
}
|
12257
12396
|
},
|
12258
12397
|
{
|
@@ -12792,6 +12931,46 @@
|
|
12792
12931
|
"theAble",
|
12793
12932
|
false
|
12794
12933
|
],
|
12934
|
+
[
|
12935
|
+
"code_wp",
|
12936
|
+
"hierarchyAble",
|
12937
|
+
false
|
12938
|
+
],
|
12939
|
+
[
|
12940
|
+
"code_wp",
|
12941
|
+
"isEdee",
|
12942
|
+
false
|
12943
|
+
],
|
12944
|
+
[
|
12945
|
+
"code_wp",
|
12946
|
+
"isEder",
|
12947
|
+
false
|
12948
|
+
],
|
12949
|
+
[
|
12950
|
+
"code_wp",
|
12951
|
+
"object",
|
12952
|
+
false
|
12953
|
+
],
|
12954
|
+
[
|
12955
|
+
"code_wp",
|
12956
|
+
"property",
|
12957
|
+
false
|
12958
|
+
],
|
12959
|
+
[
|
12960
|
+
"code_wp",
|
12961
|
+
"queryable",
|
12962
|
+
false
|
12963
|
+
],
|
12964
|
+
[
|
12965
|
+
"code_wp",
|
12966
|
+
"style_wp",
|
12967
|
+
false
|
12968
|
+
],
|
12969
|
+
[
|
12970
|
+
"code_wp",
|
12971
|
+
"theAble",
|
12972
|
+
false
|
12973
|
+
],
|
12795
12974
|
[
|
12796
12975
|
"color_colors",
|
12797
12976
|
"concept",
|
package/common/wp.js
CHANGED
@@ -23,10 +23,34 @@ const instance = require('./wp.instance.json')
|
|
23
23
|
class API {
|
24
24
|
initialize({ objects }) {
|
25
25
|
this._objects = objects
|
26
|
+
this._objects.changeState = []
|
26
27
|
}
|
27
28
|
|
28
29
|
changeState(value) {
|
29
|
-
this._objects.changeState
|
30
|
+
this._objects.changeState.push(value)
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
const root = (id) => {
|
35
|
+
return id.split('_')[0]
|
36
|
+
}
|
37
|
+
|
38
|
+
const setUpdate = (isA, update, states) => {
|
39
|
+
let color;
|
40
|
+
const styles = []
|
41
|
+
for (const state of states) {
|
42
|
+
if (isA(state, 'style_wp')) {
|
43
|
+
if (!update.styles) {
|
44
|
+
update.styles = []
|
45
|
+
}
|
46
|
+
let style = root(state.value)
|
47
|
+
if (style == 'underlined') {
|
48
|
+
style = 'underline'
|
49
|
+
}
|
50
|
+
update.styles.push(style)
|
51
|
+
} else {
|
52
|
+
update.color = root(state.value)
|
53
|
+
}
|
30
54
|
}
|
31
55
|
}
|
32
56
|
|
@@ -42,7 +66,7 @@ template = {
|
|
42
66
|
'words are countable and statefulElements',
|
43
67
|
'characters are countable',
|
44
68
|
'paragraphs are countable',
|
45
|
-
'bold, italic and underlined are styles',
|
69
|
+
'bold, italic, code and underlined are styles',
|
46
70
|
"resetIdSuffix",
|
47
71
|
{
|
48
72
|
operators: [
|
@@ -58,24 +82,10 @@ template = {
|
|
58
82
|
['thisitthat', 'statefulElement'],
|
59
83
|
],
|
60
84
|
semantic: ({api, isA, context, toArray}) => {
|
61
|
-
const root = (id) => {
|
62
|
-
return id.split('_')[0]
|
63
|
-
}
|
64
85
|
const unit = root(context.element.marker)
|
65
86
|
const scope = context.element.quantity.quantity
|
66
|
-
let color;
|
67
|
-
const styles = []
|
68
87
|
const update = { unit, scope }
|
69
|
-
|
70
|
-
if (isA(state, 'style_wp')) {
|
71
|
-
if (!update.styles) {
|
72
|
-
update.styles = []
|
73
|
-
}
|
74
|
-
update.styles.push(root(state.value))
|
75
|
-
} else {
|
76
|
-
update.color = root(state.value)
|
77
|
-
}
|
78
|
-
}
|
88
|
+
setUpdate(isA, update, toArray(context.state))
|
79
89
|
api.changeState(update)
|
80
90
|
}
|
81
91
|
},
|
@@ -84,6 +94,29 @@ template = {
|
|
84
94
|
children: ['color_colors', 'style_wp'],
|
85
95
|
},
|
86
96
|
],
|
97
|
+
semantics: [
|
98
|
+
{
|
99
|
+
where: where(),
|
100
|
+
match: ({context, isA}) => isA(context, 'style_wp') && !context.same && !context.isResponse && !context.evaluate,
|
101
|
+
apply: ({context, api, isA, toArray}) => {
|
102
|
+
const update = { scope: 'selection' }
|
103
|
+
setUpdate(isA, update, toArray(context))
|
104
|
+
api.changeState(update)
|
105
|
+
}
|
106
|
+
},
|
107
|
+
{
|
108
|
+
where: where(),
|
109
|
+
match: ({context, isA}) => isA(context, 'statefulElement_wp') && !context.same && !context.isResponse && !context.evaluate,
|
110
|
+
apply: ({context, api, isA, toArray}) => {
|
111
|
+
const unit = root(context.marker)
|
112
|
+
let scope
|
113
|
+
if (context.quantity) {
|
114
|
+
scope = context.quantity.quantity
|
115
|
+
}
|
116
|
+
// TODO set default scope for "every word bold underlined etc"
|
117
|
+
}
|
118
|
+
},
|
119
|
+
],
|
87
120
|
priorities: [
|
88
121
|
{ "context": [['changeState_wp',0], ['statefulElement_wp', 0], ['list', 0]], ordered: true, choose: [0] },
|
89
122
|
],
|