@pie-lib/text-select 1.8.6-next.5 → 1.8.6-next.528
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/CHANGELOG.json +15 -0
- package/CHANGELOG.md +91 -36
- package/lib/index.js +16 -12
- package/lib/index.js.map +1 -1
- package/lib/text-select.js +35 -40
- package/lib/text-select.js.map +1 -1
- package/lib/token-select/index.js +68 -71
- package/lib/token-select/index.js.map +1 -1
- package/lib/token-select/token.js +41 -40
- package/lib/token-select/token.js.map +1 -1
- package/lib/tokenizer/builder.js +10 -16
- package/lib/tokenizer/builder.js.map +1 -1
- package/lib/tokenizer/controls.js +31 -39
- package/lib/tokenizer/controls.js.map +1 -1
- package/lib/tokenizer/index.js +40 -56
- package/lib/tokenizer/index.js.map +1 -1
- package/lib/tokenizer/selection-utils.js +1 -1
- package/lib/tokenizer/selection-utils.js.map +1 -1
- package/lib/tokenizer/token-text.js +47 -51
- package/lib/tokenizer/token-text.js.map +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +3 -3
- package/src/text-select.jsx +5 -1
- package/src/token-select/index.jsx +11 -5
- package/src/token-select/token.jsx +12 -1
- package/src/tokenizer/selection-utils.js +1 -1
- package/src/tokenizer/token-text.jsx +34 -12
package/CHANGELOG.json
CHANGED
|
@@ -613,5 +613,20 @@
|
|
|
613
613
|
"committerDate": "2021-08-09 09:58:13 +0300",
|
|
614
614
|
"isTagged": true,
|
|
615
615
|
"tag": "@pie-lib/text-select@1.8.5"
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
"type": "fix",
|
|
619
|
+
"scope": "select-text",
|
|
620
|
+
"subject": "made sure the new line characters are taken into consideration for offsets [PD-1145]",
|
|
621
|
+
"merge": null,
|
|
622
|
+
"header": "fix(select-text): made sure the new line characters are taken into consideration for offsets [PD-1145]",
|
|
623
|
+
"body": null,
|
|
624
|
+
"footer": null,
|
|
625
|
+
"notes": [],
|
|
626
|
+
"hash": "a7bb44a833e2931177e122010aa160a924982530",
|
|
627
|
+
"gitTags": " (origin/feat/PD-1145-new-line-offset-handling)",
|
|
628
|
+
"committerDate": "2021-09-24 13:15:39 +0300",
|
|
629
|
+
"isTagged": true,
|
|
630
|
+
"tag": "@pie-lib/text-select@1.8.8"
|
|
616
631
|
}
|
|
617
632
|
]
|
package/CHANGELOG.md
CHANGED
|
@@ -3,37 +3,39 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [1.8.
|
|
6
|
+
## [1.8.20](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.19...@pie-lib/text-select@1.8.20) (2022-07-18)
|
|
7
7
|
|
|
8
|
+
**Note:** Version bump only for package @pie-lib/text-select
|
|
8
9
|
|
|
9
|
-
### Bug Fixes
|
|
10
10
|
|
|
11
|
-
* **text-select:** move prepareText function from pie-elements ([0eaee81](https://github.com/pie-framework/pie-lib/commit/0eaee81))
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
|
|
14
|
+
## [1.8.19](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.18...@pie-lib/text-select@1.8.19) (2022-07-18)
|
|
15
15
|
|
|
16
|
+
**Note:** Version bump only for package @pie-lib/text-select
|
|
16
17
|
|
|
17
|
-
## [1.8.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.3...@pie-lib/text-select@1.8.4) (2021-08-04)
|
|
18
18
|
|
|
19
|
-
**Note:** Version bump only for package @pie-lib/text-select
|
|
20
19
|
|
|
21
20
|
|
|
22
21
|
|
|
22
|
+
## [1.8.18](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.17...@pie-lib/text-select@1.8.18) (2022-06-13)
|
|
23
23
|
|
|
24
|
+
**Note:** Version bump only for package @pie-lib/text-select
|
|
24
25
|
|
|
25
|
-
## [1.8.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.2...@pie-lib/text-select@1.8.3) (2021-07-23)
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
### Bug Fixes
|
|
29
28
|
|
|
30
|
-
* **text-select:** Fixed white space collapse PD-477 ([1f9481f](https://github.com/pie-framework/pie-lib/commit/1f9481f))
|
|
31
29
|
|
|
30
|
+
## [1.8.17](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.16...@pie-lib/text-select@1.8.17) (2022-05-30)
|
|
32
31
|
|
|
32
|
+
**Note:** Version bump only for package @pie-lib/text-select
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## [1.8.16](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.15...@pie-lib/text-select@1.8.16) (2022-05-24)
|
|
37
39
|
|
|
38
40
|
**Note:** Version bump only for package @pie-lib/text-select
|
|
39
41
|
|
|
@@ -41,24 +43,23 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
41
43
|
|
|
42
44
|
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
## [1.8.15](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.14...@pie-lib/text-select@1.8.15) (2022-04-28)
|
|
45
47
|
|
|
48
|
+
**Note:** Version bump only for package @pie-lib/text-select
|
|
46
49
|
|
|
47
|
-
### Bug Fixes
|
|
48
50
|
|
|
49
|
-
* **text-select:** fix incorrect indenting PD-1038 ([4d56509](https://github.com/pie-framework/pie-lib/commit/4d56509))
|
|
50
|
-
* **text-select:** select text view mode should use black for text color PD-1154 ([0db5b1e](https://github.com/pie-framework/pie-lib/commit/0db5b1e))
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
### Features
|
|
54
53
|
|
|
55
|
-
|
|
54
|
+
## [1.8.14](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.13...@pie-lib/text-select@1.8.14) (2022-03-21)
|
|
56
55
|
|
|
56
|
+
**Note:** Version bump only for package @pie-lib/text-select
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
|
|
62
|
+
## [1.8.13](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.12...@pie-lib/text-select@1.8.13) (2022-02-21)
|
|
62
63
|
|
|
63
64
|
**Note:** Version bump only for package @pie-lib/text-select
|
|
64
65
|
|
|
@@ -66,20 +67,23 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
66
67
|
|
|
67
68
|
|
|
68
69
|
|
|
69
|
-
## [1.
|
|
70
|
+
## [1.8.12](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.11...@pie-lib/text-select@1.8.12) (2022-02-03)
|
|
70
71
|
|
|
72
|
+
**Note:** Version bump only for package @pie-lib/text-select
|
|
71
73
|
|
|
72
|
-
### Bug Fixes
|
|
73
74
|
|
|
74
|
-
* **text-select:** fix layout for legacy items with line number ([d50865e](https://github.com/pie-framework/pie-lib/commit/d50865e))
|
|
75
|
-
* **text-select:** fix padding for tokens in order to fix PD-860 ([eacb81c](https://github.com/pie-framework/pie-lib/commit/eacb81c))
|
|
76
|
-
* **text-select:** show tokens if they are selected in view mode to fix PD-464 ([7821536](https://github.com/pie-framework/pie-lib/commit/7821536))
|
|
77
75
|
|
|
78
76
|
|
|
79
77
|
|
|
78
|
+
## [1.8.11](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.10...@pie-lib/text-select@1.8.11) (2021-12-13)
|
|
79
|
+
|
|
80
|
+
**Note:** Version bump only for package @pie-lib/text-select
|
|
81
|
+
|
|
82
|
+
|
|
80
83
|
|
|
81
84
|
|
|
82
|
-
|
|
85
|
+
|
|
86
|
+
## [1.8.10](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.9...@pie-lib/text-select@1.8.10) (2021-11-29)
|
|
83
87
|
|
|
84
88
|
**Note:** Version bump only for package @pie-lib/text-select
|
|
85
89
|
|
|
@@ -87,7 +91,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
87
91
|
|
|
88
92
|
|
|
89
93
|
|
|
90
|
-
## [1.
|
|
94
|
+
## [1.8.9](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.8...@pie-lib/text-select@1.8.9) (2021-11-10)
|
|
91
95
|
|
|
92
96
|
**Note:** Version bump only for package @pie-lib/text-select
|
|
93
97
|
|
|
@@ -95,18 +99,18 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
95
99
|
|
|
96
100
|
|
|
97
101
|
|
|
98
|
-
## [1.
|
|
102
|
+
## [1.8.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.7...@pie-lib/text-select@1.8.8) (2021-10-04)
|
|
99
103
|
|
|
100
104
|
|
|
101
105
|
### Bug Fixes
|
|
102
106
|
|
|
103
|
-
* **text
|
|
107
|
+
* **select-text:** made sure the new line characters are taken into consideration for offsets [PD-1145] ([a7bb44a](https://github.com/pie-framework/pie-lib/commit/a7bb44a))
|
|
104
108
|
|
|
105
109
|
|
|
106
110
|
|
|
107
111
|
|
|
108
112
|
|
|
109
|
-
## [1.
|
|
113
|
+
## [1.8.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.6...@pie-lib/text-select@1.8.7) (2021-09-08)
|
|
110
114
|
|
|
111
115
|
**Note:** Version bump only for package @pie-lib/text-select
|
|
112
116
|
|
|
@@ -114,7 +118,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
114
118
|
|
|
115
119
|
|
|
116
120
|
|
|
117
|
-
## [1.
|
|
121
|
+
## [1.8.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.5...@pie-lib/text-select@1.8.6) (2021-09-08)
|
|
118
122
|
|
|
119
123
|
**Note:** Version bump only for package @pie-lib/text-select
|
|
120
124
|
|
|
@@ -122,54 +126,105 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
122
126
|
|
|
123
127
|
|
|
124
128
|
|
|
125
|
-
## [1.
|
|
129
|
+
## [1.8.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.4...@pie-lib/text-select@1.8.5) (2021-08-30)
|
|
126
130
|
|
|
127
|
-
**Note:** Version bump only for package @pie-lib/text-select
|
|
128
131
|
|
|
132
|
+
### Bug Fixes
|
|
129
133
|
|
|
134
|
+
* **text-select:** move prepareText function from pie-elements ([0eaee81](https://github.com/pie-framework/pie-lib/commit/0eaee81))
|
|
130
135
|
|
|
131
136
|
|
|
132
137
|
|
|
133
|
-
## [1.7.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.7.3...@pie-lib/text-select@1.7.4) (2021-01-25)
|
|
134
138
|
|
|
135
139
|
|
|
140
|
+
## [1.8.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.3...@pie-lib/text-select@1.8.4) (2021-08-04)
|
|
141
|
+
|
|
142
|
+
**Note:** Version bump only for package @pie-lib/text-select
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
## [1.8.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.2...@pie-lib/text-select@1.8.3) (2021-07-23)
|
|
149
|
+
|
|
136
150
|
### Bug Fixes
|
|
137
151
|
|
|
138
|
-
|
|
152
|
+
- **text-select:** Fixed white space collapse PD-477 ([1f9481f](https://github.com/pie-framework/pie-lib/commit/1f9481f))
|
|
139
153
|
|
|
154
|
+
## [1.8.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.8.0...@pie-lib/text-select@1.8.2) (2021-06-25)
|
|
140
155
|
|
|
156
|
+
**Note:** Version bump only for package @pie-lib/text-select
|
|
141
157
|
|
|
158
|
+
# [1.8.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.7.13...@pie-lib/text-select@1.8.0) (2021-06-25)
|
|
142
159
|
|
|
160
|
+
### Bug Fixes
|
|
143
161
|
|
|
144
|
-
|
|
162
|
+
- **text-select:** fix incorrect indenting PD-1038 ([4d56509](https://github.com/pie-framework/pie-lib/commit/4d56509))
|
|
163
|
+
- **text-select:** select text view mode should use black for text color PD-1154 ([0db5b1e](https://github.com/pie-framework/pie-lib/commit/0db5b1e))
|
|
164
|
+
|
|
165
|
+
### Features
|
|
166
|
+
|
|
167
|
+
- **text-select:** when select-text item permits only one selection, change behavior of gather PD-958 ([c181314](https://github.com/pie-framework/pie-lib/commit/c181314))
|
|
168
|
+
|
|
169
|
+
## [1.7.13](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.7.12...@pie-lib/text-select@1.7.13) (2021-03-01)
|
|
145
170
|
|
|
171
|
+
**Note:** Version bump only for package @pie-lib/text-select
|
|
172
|
+
|
|
173
|
+
## [1.7.12](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.7.11...@pie-lib/text-select@1.7.12) (2021-03-01)
|
|
146
174
|
|
|
147
175
|
### Bug Fixes
|
|
148
176
|
|
|
149
|
-
|
|
177
|
+
- **text-select:** fix layout for legacy items with line number ([d50865e](https://github.com/pie-framework/pie-lib/commit/d50865e))
|
|
178
|
+
- **text-select:** fix padding for tokens in order to fix PD-860 ([eacb81c](https://github.com/pie-framework/pie-lib/commit/eacb81c))
|
|
179
|
+
- **text-select:** show tokens if they are selected in view mode to fix PD-464 ([7821536](https://github.com/pie-framework/pie-lib/commit/7821536))
|
|
180
|
+
|
|
181
|
+
## [1.7.11](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.7.10...@pie-lib/text-select@1.7.11) (2021-02-15)
|
|
182
|
+
|
|
183
|
+
**Note:** Version bump only for package @pie-lib/text-select
|
|
184
|
+
|
|
185
|
+
## [1.7.10](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.7.8...@pie-lib/text-select@1.7.10) (2021-02-15)
|
|
150
186
|
|
|
187
|
+
**Note:** Version bump only for package @pie-lib/text-select
|
|
151
188
|
|
|
189
|
+
## [1.7.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.7.7...@pie-lib/text-select@1.7.8) (2021-02-15)
|
|
152
190
|
|
|
191
|
+
### Bug Fixes
|
|
153
192
|
|
|
193
|
+
- **text-select:** fix space between lines ([5633537](https://github.com/pie-framework/pie-lib/commit/5633537))
|
|
154
194
|
|
|
155
|
-
## [1.7.
|
|
195
|
+
## [1.7.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.7.6...@pie-lib/text-select@1.7.7) (2021-02-01)
|
|
196
|
+
|
|
197
|
+
**Note:** Version bump only for package @pie-lib/text-select
|
|
198
|
+
|
|
199
|
+
## [1.7.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.7.5...@pie-lib/text-select@1.7.6) (2021-01-28)
|
|
156
200
|
|
|
157
201
|
**Note:** Version bump only for package @pie-lib/text-select
|
|
158
202
|
|
|
203
|
+
## [1.7.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.7.4...@pie-lib/text-select@1.7.5) (2021-01-28)
|
|
159
204
|
|
|
205
|
+
**Note:** Version bump only for package @pie-lib/text-select
|
|
160
206
|
|
|
207
|
+
## [1.7.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.7.3...@pie-lib/text-select@1.7.4) (2021-01-25)
|
|
161
208
|
|
|
209
|
+
### Bug Fixes
|
|
162
210
|
|
|
163
|
-
|
|
211
|
+
- **text-select:** fix token rendering issue - PD-642 ([89f3b70](https://github.com/pie-framework/pie-lib/commit/89f3b70))
|
|
164
212
|
|
|
213
|
+
## [1.7.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.7.2...@pie-lib/text-select@1.7.3) (2021-01-11)
|
|
165
214
|
|
|
166
215
|
### Bug Fixes
|
|
167
216
|
|
|
168
|
-
|
|
217
|
+
- Added fix for style changes after selection of max tokens PD-646 ([30183a9](https://github.com/pie-framework/pie-lib/commit/30183a9))
|
|
169
218
|
|
|
219
|
+
## [1.7.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.7.1...@pie-lib/text-select@1.7.2) (2020-10-29)
|
|
170
220
|
|
|
221
|
+
**Note:** Version bump only for package @pie-lib/text-select
|
|
171
222
|
|
|
223
|
+
## [1.7.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.7.0...@pie-lib/text-select@1.7.1) (2020-10-26)
|
|
224
|
+
|
|
225
|
+
### Bug Fixes
|
|
172
226
|
|
|
227
|
+
- **select-text:** fix text indent styling for tokens ([0d13170](https://github.com/pie-framework/pie-lib/commit/0d13170))
|
|
173
228
|
|
|
174
229
|
# [1.7.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/text-select@1.6.1...@pie-lib/text-select@1.7.0) (2020-10-26)
|
|
175
230
|
|
package/lib/index.js
CHANGED
|
@@ -1,36 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
3
7
|
Object.defineProperty(exports, "__esModule", {
|
|
4
8
|
value: true
|
|
5
9
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
10
|
+
Object.defineProperty(exports, "TextSelect", {
|
|
7
11
|
enumerable: true,
|
|
8
12
|
get: function get() {
|
|
9
|
-
return
|
|
13
|
+
return _textSelect["default"];
|
|
10
14
|
}
|
|
11
15
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
16
|
+
Object.defineProperty(exports, "Token", {
|
|
13
17
|
enumerable: true,
|
|
14
18
|
get: function get() {
|
|
15
|
-
return
|
|
19
|
+
return _token["default"];
|
|
16
20
|
}
|
|
17
21
|
});
|
|
18
|
-
Object.defineProperty(exports, "
|
|
22
|
+
Object.defineProperty(exports, "TokenSelect", {
|
|
19
23
|
enumerable: true,
|
|
20
24
|
get: function get() {
|
|
21
|
-
return _tokenSelect
|
|
25
|
+
return _tokenSelect["default"];
|
|
22
26
|
}
|
|
23
27
|
});
|
|
24
|
-
Object.defineProperty(exports, "
|
|
28
|
+
Object.defineProperty(exports, "TokenTypes", {
|
|
25
29
|
enumerable: true,
|
|
26
30
|
get: function get() {
|
|
27
|
-
return
|
|
31
|
+
return _tokenSelect.TokenTypes;
|
|
28
32
|
}
|
|
29
33
|
});
|
|
30
|
-
Object.defineProperty(exports, "
|
|
34
|
+
Object.defineProperty(exports, "Tokenizer", {
|
|
31
35
|
enumerable: true,
|
|
32
36
|
get: function get() {
|
|
33
|
-
return
|
|
37
|
+
return _tokenizer["default"];
|
|
34
38
|
}
|
|
35
39
|
});
|
|
36
40
|
Object.defineProperty(exports, "prepareText", {
|
|
@@ -50,7 +54,7 @@ var _token = _interopRequireDefault(require("./token-select/token"));
|
|
|
50
54
|
|
|
51
55
|
var _utils = require("./utils");
|
|
52
56
|
|
|
53
|
-
function
|
|
57
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
54
58
|
|
|
55
|
-
function
|
|
59
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
56
60
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.js"],"sourcesContent":["import Tokenizer from './tokenizer';\nimport TokenSelect, { TokenTypes } from './token-select';\nimport TextSelect from './text-select';\nimport Token from './token-select/token';\nimport { prepareText } from './utils';\n\nexport { TextSelect, TokenTypes, Tokenizer, TokenSelect, Token, prepareText };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA"}
|
package/lib/text-select.js
CHANGED
|
@@ -1,72 +1,67 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports["default"] = void 0;
|
|
7
9
|
|
|
8
|
-
var
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
11
|
|
|
10
|
-
var
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
13
|
|
|
12
|
-
var
|
|
14
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
13
15
|
|
|
14
|
-
var
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
17
|
|
|
16
|
-
var
|
|
18
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
19
|
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
-
|
|
22
|
-
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
20
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
var _react = _interopRequireDefault(require("react"));
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
var _tokenSelect = _interopRequireDefault(require("./token-select"));
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
var _builder = require("./tokenizer/builder");
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
var _token = require("./token-select/token");
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
var _debug = _interopRequireDefault(require("debug"));
|
|
37
35
|
|
|
38
|
-
function
|
|
36
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
39
37
|
|
|
40
|
-
function
|
|
38
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
41
39
|
|
|
42
|
-
function
|
|
40
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
43
41
|
|
|
44
|
-
function
|
|
42
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
45
43
|
|
|
46
44
|
var log = (0, _debug["default"])('@pie-lib:text-select');
|
|
47
45
|
/**
|
|
48
46
|
* Built on TokenSelect uses build.normalize to build the token set.
|
|
49
47
|
*/
|
|
50
48
|
|
|
51
|
-
var TextSelect =
|
|
52
|
-
|
|
53
|
-
function (_React$Component) {
|
|
54
|
-
_inherits(TextSelect, _React$Component);
|
|
49
|
+
var TextSelect = /*#__PURE__*/function (_React$Component) {
|
|
50
|
+
(0, _inherits2["default"])(TextSelect, _React$Component);
|
|
55
51
|
|
|
56
|
-
|
|
57
|
-
var _getPrototypeOf2;
|
|
52
|
+
var _super = _createSuper(TextSelect);
|
|
58
53
|
|
|
54
|
+
function TextSelect() {
|
|
59
55
|
var _this;
|
|
60
56
|
|
|
61
|
-
|
|
57
|
+
(0, _classCallCheck2["default"])(this, TextSelect);
|
|
62
58
|
|
|
63
59
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
64
60
|
args[_key] = arguments[_key];
|
|
65
61
|
}
|
|
66
62
|
|
|
67
|
-
_this =
|
|
68
|
-
|
|
69
|
-
_defineProperty(_assertThisInitialized(_this), "change", function (tokens) {
|
|
63
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
64
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "change", function (tokens) {
|
|
70
65
|
var onChange = _this.props.onChange;
|
|
71
66
|
|
|
72
67
|
if (!onChange) {
|
|
@@ -83,11 +78,10 @@ function (_React$Component) {
|
|
|
83
78
|
});
|
|
84
79
|
onChange(out);
|
|
85
80
|
});
|
|
86
|
-
|
|
87
81
|
return _this;
|
|
88
82
|
}
|
|
89
83
|
|
|
90
|
-
|
|
84
|
+
(0, _createClass2["default"])(TextSelect, [{
|
|
91
85
|
key: "render",
|
|
92
86
|
value: function render() {
|
|
93
87
|
var _this$props = this.props,
|
|
@@ -97,7 +91,8 @@ function (_React$Component) {
|
|
|
97
91
|
selectedTokens = _this$props.selectedTokens,
|
|
98
92
|
className = _this$props.className,
|
|
99
93
|
highlightChoices = _this$props.highlightChoices,
|
|
100
|
-
maxNoOfSelections = _this$props.maxNoOfSelections
|
|
94
|
+
maxNoOfSelections = _this$props.maxNoOfSelections,
|
|
95
|
+
animationsDisabled = _this$props.animationsDisabled;
|
|
101
96
|
var normalized = (0, _builder.normalize)(text, tokens);
|
|
102
97
|
log('normalized: ', normalized);
|
|
103
98
|
var prepped = normalized.map(function (t) {
|
|
@@ -106,29 +101,28 @@ function (_React$Component) {
|
|
|
106
101
|
});
|
|
107
102
|
var selected = selectedIndex !== -1;
|
|
108
103
|
var correct = selected ? t.correct : undefined;
|
|
109
|
-
return _objectSpread({}, t, {
|
|
104
|
+
return _objectSpread(_objectSpread({}, t), {}, {
|
|
110
105
|
selectable: !disabled && t.predefined,
|
|
111
106
|
selected: selected,
|
|
112
107
|
correct: correct
|
|
113
108
|
});
|
|
114
109
|
});
|
|
115
|
-
return _react["default"].createElement(_tokenSelect["default"], {
|
|
110
|
+
return /*#__PURE__*/_react["default"].createElement(_tokenSelect["default"], {
|
|
116
111
|
highlightChoices: !disabled && highlightChoices,
|
|
117
112
|
className: className,
|
|
118
113
|
tokens: prepped,
|
|
119
114
|
disabled: disabled,
|
|
120
115
|
onChange: this.change,
|
|
121
|
-
maxNoOfSelections: maxNoOfSelections
|
|
116
|
+
maxNoOfSelections: maxNoOfSelections,
|
|
117
|
+
animationsDisabled: animationsDisabled
|
|
122
118
|
});
|
|
123
119
|
}
|
|
124
120
|
}]);
|
|
125
|
-
|
|
126
121
|
return TextSelect;
|
|
127
122
|
}(_react["default"].Component);
|
|
128
123
|
|
|
129
124
|
exports["default"] = TextSelect;
|
|
130
|
-
|
|
131
|
-
_defineProperty(TextSelect, "propTypes", {
|
|
125
|
+
(0, _defineProperty2["default"])(TextSelect, "propTypes", {
|
|
132
126
|
onChange: _propTypes["default"].func,
|
|
133
127
|
disabled: _propTypes["default"].bool,
|
|
134
128
|
tokens: _propTypes["default"].arrayOf(_propTypes["default"].shape(_token.TokenTypes)).isRequired,
|
|
@@ -136,6 +130,7 @@ _defineProperty(TextSelect, "propTypes", {
|
|
|
136
130
|
text: _propTypes["default"].string.isRequired,
|
|
137
131
|
className: _propTypes["default"].string,
|
|
138
132
|
highlightChoices: _propTypes["default"].bool,
|
|
133
|
+
animationsDisabled: _propTypes["default"].bool,
|
|
139
134
|
maxNoOfSelections: _propTypes["default"].number
|
|
140
135
|
});
|
|
141
136
|
//# sourceMappingURL=text-select.js.map
|
package/lib/text-select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"text-select.js","names":["log","debug","TextSelect","tokens","onChange","props","out","filter","t","selected","map","start","end","text","disabled","selectedTokens","className","highlightChoices","maxNoOfSelections","animationsDisabled","normalized","normalize","prepped","selectedIndex","findIndex","s","correct","undefined","selectable","predefined","change","React","Component","PropTypes","func","bool","arrayOf","shape","TokenTypes","isRequired","string","number"],"sources":["../src/text-select.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport TokenSelect from './token-select';\nimport { normalize } from './tokenizer/builder';\nimport { TokenTypes } from './token-select/token';\nimport debug from 'debug';\n\nconst log = debug('@pie-lib:text-select');\n/**\n * Built on TokenSelect uses build.normalize to build the token set.\n */\nexport default class TextSelect extends React.Component {\n static propTypes = {\n onChange: PropTypes.func,\n disabled: PropTypes.bool,\n tokens: PropTypes.arrayOf(PropTypes.shape(TokenTypes)).isRequired,\n selectedTokens: PropTypes.arrayOf(PropTypes.shape(TokenTypes)).isRequired,\n text: PropTypes.string.isRequired,\n className: PropTypes.string,\n highlightChoices: PropTypes.bool,\n animationsDisabled: PropTypes.bool,\n maxNoOfSelections: PropTypes.number\n };\n\n change = tokens => {\n const { onChange } = this.props;\n\n if (!onChange) {\n return;\n }\n const out = tokens.filter(t => t.selected).map(t => ({ start: t.start, end: t.end }));\n\n onChange(out);\n };\n\n render() {\n const {\n text,\n disabled,\n tokens,\n selectedTokens,\n className,\n highlightChoices,\n maxNoOfSelections,\n animationsDisabled\n } = this.props;\n\n const normalized = normalize(text, tokens);\n log('normalized: ', normalized);\n const prepped = normalized.map(t => {\n const selectedIndex = selectedTokens.findIndex(s => {\n return s.start === t.start && s.end === t.end;\n });\n const selected = selectedIndex !== -1;\n const correct = selected ? t.correct : undefined;\n return {\n ...t,\n selectable: !disabled && t.predefined,\n selected,\n correct\n };\n });\n\n return (\n <TokenSelect\n highlightChoices={!disabled && highlightChoices}\n className={className}\n tokens={prepped}\n disabled={disabled}\n onChange={this.change}\n maxNoOfSelections={maxNoOfSelections}\n animationsDisabled={animationsDisabled}\n />\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,IAAAC,iBAAA,EAAM,sBAAN,CAAZ;AACA;AACA;AACA;;IACqBC,U;;;;;;;;;;;;;;;+FAaV,UAAAC,MAAM,EAAI;MACjB,IAAQC,QAAR,GAAqB,MA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