@fw-components/formula-editor 2.0.3-formula-editor.2 → 2.0.7-cline-formulaeditor.0

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.
@@ -0,0 +1,198 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { css, html, LitElement } from "lit";
8
+ import { customElement, property } from "lit/decorators.js";
9
+ let SuggestionMenu = class SuggestionMenu extends LitElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.recommendations = [];
13
+ this.onClickRecommendation = (recommendation) => { };
14
+ this.currentSelection = "";
15
+ this.isLoading = false;
16
+ this.variables = new Map();
17
+ this.constants = new Map();
18
+ }
19
+ static { this.styles = css `
20
+ .container {
21
+ position: relative;
22
+ }
23
+
24
+ .loading {
25
+ position: absolute;
26
+ top: 0;
27
+ left: 0;
28
+ right: 0;
29
+ bottom: 0;
30
+ background: rgba(255, 255, 255, 0.8);
31
+ display: flex;
32
+ align-items: center;
33
+ justify-content: center;
34
+ z-index: 100000;
35
+ }
36
+
37
+ .empty-state {
38
+ padding: 1rem;
39
+ text-align: center;
40
+ color: var(--fe-suggestion-color, #bab6c0);
41
+ }
42
+
43
+ .group-label {
44
+ padding: 0.5em 1rem;
45
+ font-size: 0.8em;
46
+ color: var(--fe-suggestion-group-color, #69676c);
47
+ background-color: var(--fe-suggestion-group-background, #f5f5f5);
48
+ font-weight: bold;
49
+ }
50
+
51
+ ul {
52
+ position: relative;
53
+ border: 1px solid var(--fe-suggestion-color, white);
54
+ color: var(--fe-suggestion-color, #bab6c0);
55
+ background-color: var(--fe-suggestion-background-color, white);
56
+ box-sizing: border-box;
57
+ width: var(--fe-suggestion-width, 20vw);
58
+ max-height: 25vh;
59
+ overflow-x: auto;
60
+ overflow-y: auto;
61
+ list-style-type: none;
62
+ padding: 0;
63
+ margin: 0;
64
+ box-shadow: 1px 2px 5px rgba(0, 0, 0, 0.13);
65
+ border-radius: 5px;
66
+ z-index: 99999
67
+ }
68
+
69
+ li {
70
+ margin: 0;
71
+ padding: 0.5em 1rem;
72
+ cursor: pointer;
73
+ font-family: var(--theme-font);
74
+ font-size: var(--secondary-font-size, 16px);
75
+ color: var(--secondary-color, #bab6c0);
76
+ }
77
+
78
+ li:hover,
79
+ li:focus-visible {
80
+ font-weight: bold;
81
+ color: var(--fe-suggestion-focus-color, #69676c);
82
+ }
83
+
84
+ li.selected {
85
+ color: var(--fe-suggestion-focus-color, #69676c);
86
+ font-weight: bold;
87
+ }
88
+
89
+ li[focused] {
90
+ font-weight: bold;
91
+ }
92
+
93
+ /* Scrollbar styling */
94
+ ::-webkit-scrollbar {
95
+ width: 10px;
96
+ }
97
+
98
+ ::-webkit-scrollbar-track {
99
+ background: transparent;
100
+ }
101
+
102
+ ::-webkit-scrollbar-thumb {
103
+ background: #ccc;
104
+ border-radius: 5px;
105
+ }
106
+
107
+ ::-webkit-scrollbar-thumb:hover {
108
+ background: #aaa;
109
+ }
110
+
111
+ /* Optional shadow for the dropdown */
112
+ .content {
113
+ box-shadow: 1px 2px 5px rgba(0, 0, 0, 0.13);
114
+ }
115
+ `; }
116
+ handleKeydown(event, recommendation) {
117
+ if (event.code == "Enter") {
118
+ event.preventDefault();
119
+ event.stopPropagation();
120
+ this.onClickRecommendation(recommendation);
121
+ }
122
+ }
123
+ render() {
124
+ return html `
125
+ <div class="container" role="combobox" aria-expanded="true" aria-haspopup="listbox">
126
+ ${this.isLoading ? html `
127
+ <div class="loading" role="status" aria-label="Loading suggestions">
128
+ <span class="loading-spinner"></span>
129
+ </div>
130
+ ` : ''}
131
+
132
+ ${this.recommendations.length === 0 ? html `
133
+ <div class="empty-state" role="status">
134
+ No suggestions available
135
+ </div>
136
+ ` : html `
137
+ <ul class="wysiwyg-suggestion-menu" role="listbox" aria-label="Suggestions">
138
+ ${this.recommendations.some(r => this.variables.has(r)) ? html `
139
+ <li class="group-label" role="presentation">Variables</li>
140
+ ${this.recommendations.filter(r => this.variables.has(r)).map((recommendation) => html `
141
+ <li
142
+ role="option"
143
+ aria-selected="${this.currentSelection === recommendation}"
144
+ class="${this.currentSelection === recommendation ? 'selected' : ''}"
145
+ tabindex="0"
146
+ @click=${() => this.onClickRecommendation(recommendation)}
147
+ @keydown=${(e) => this.handleKeydown(e, recommendation)}
148
+ >
149
+ ${recommendation}
150
+ <span class="value">${this.variables.get(recommendation)}</span>
151
+ </li>
152
+ `)}
153
+ ` : ''}
154
+
155
+ ${this.recommendations.some(r => this.constants.has(r)) ? html `
156
+ <li class="group-label" role="presentation">Constants</li>
157
+ ${this.recommendations.filter(r => this.constants.has(r)).map((recommendation) => html `
158
+ <li
159
+ role="option"
160
+ aria-selected="${this.currentSelection === recommendation}"
161
+ class="${this.currentSelection === recommendation ? 'selected' : ''}"
162
+ tabindex="0"
163
+ @click=${() => this.onClickRecommendation(recommendation)}
164
+ @keydown=${(e) => this.handleKeydown(e, recommendation)}
165
+ >
166
+ ${recommendation}
167
+ <span class="value">${this.constants.get(recommendation)}</span>
168
+ </li>
169
+ `)}
170
+ ` : ''}
171
+ </ul>
172
+ `}
173
+ </div>
174
+ `;
175
+ }
176
+ };
177
+ __decorate([
178
+ property()
179
+ ], SuggestionMenu.prototype, "recommendations", void 0);
180
+ __decorate([
181
+ property()
182
+ ], SuggestionMenu.prototype, "onClickRecommendation", void 0);
183
+ __decorate([
184
+ property()
185
+ ], SuggestionMenu.prototype, "currentSelection", void 0);
186
+ __decorate([
187
+ property()
188
+ ], SuggestionMenu.prototype, "isLoading", void 0);
189
+ __decorate([
190
+ property()
191
+ ], SuggestionMenu.prototype, "variables", void 0);
192
+ __decorate([
193
+ property()
194
+ ], SuggestionMenu.prototype, "constants", void 0);
195
+ SuggestionMenu = __decorate([
196
+ customElement("suggestion-menu")
197
+ ], SuggestionMenu);
198
+ export { SuggestionMenu };
@@ -0,0 +1,419 @@
1
+ import { html } from 'lit';
2
+ export const UnderlinedButtonStyles = html `
3
+ <style>
4
+ .primary-text-underlined {
5
+ font-family: var(--theme-font);
6
+ border: none;
7
+ font-size: var(--secondary-font-size, 16px);
8
+ color: var(--primary-color, #205081);
9
+ padding: 0;
10
+ margin: 0;
11
+ border-radius: 0;
12
+ min-width: max-content;
13
+ text-transform: none;
14
+ border-bottom: 1px solid rgba(var(--secondary-color-rgb), 0.3);
15
+ }
16
+
17
+ .secondary-text-underlined {
18
+ font-family: var(--theme-font);
19
+ border: none;
20
+ font-size: var(--secondary-font-size, 16px);
21
+ color: var(--secondary-color, #515151);
22
+ margin: 0;
23
+ padding: 0;
24
+ border-radius: 0;
25
+ min-width: max-content;
26
+ text-transform: none;
27
+ border-bottom: 1px solid rgba(var(--secondary-color-rgb), 0.3);
28
+ }
29
+ </style>
30
+ `;
31
+ export const TextButtonStyles = html `
32
+ <style>
33
+ .primary-text-button {
34
+ font-family: var(--theme-font);
35
+ border: none;
36
+ font-size: var(--secondary-font-size, 16px);
37
+ color: var(--primary-color, #205081);
38
+ padding: 0 8px;
39
+ min-width: 64px;
40
+ height: var(--button-height, 36px);
41
+ margin: 0;
42
+ text-transform: none;
43
+ }
44
+
45
+ .secondary-text-button {
46
+ font-family: var(--theme-font);
47
+ border: none;
48
+ font-size: var(--secondary-font-size, 16px);
49
+ color: var(--secondary-color, #515151);
50
+ padding: 0 8px;
51
+ min-width: 64px;
52
+ margin: 0;
53
+ height: var(--button-height, 36px);
54
+ text-transform: none;
55
+ }
56
+
57
+ .primary-text-button:hover {
58
+ font-weight: bold;
59
+ }
60
+
61
+ .secondary-text-button:hover {
62
+ font-weight: bold;
63
+ }
64
+
65
+ .primary-text-button[disabled], .secondary-text-button[disabled] {
66
+ opacity: 0.5;
67
+ }
68
+ </style>
69
+ `;
70
+ export const PrimaryButtonStyles = html `
71
+ <style>
72
+ .primary-outlined {
73
+ font-family: var(--theme-font);
74
+ border: 1px solid var(--primary-color, #205081);
75
+ border-radius: 5px;
76
+ font-size: var(--secondary-font-size, 16px);
77
+ color: var(--secondary-color, #515151);
78
+ padding: 0 var(--button-padding, 16px);
79
+ min-width: 64px;
80
+ margin: 0;
81
+ height: var(--button-height, 36px);
82
+ text-transform: none;
83
+ }
84
+ .primary-outlined:hover {
85
+ background-color: var(--primary-color, #205081);
86
+ color: var(--light-color, #fff);
87
+ }
88
+ .primary-colored {
89
+ font-family: var(--theme-font);
90
+ background-color: var(--primary-color, #205081);
91
+ border-radius: 5px;
92
+ font-size: var(--secondary-font-size, 16px);
93
+ color: var(--light-color, #fff);
94
+ margin: 0;
95
+ padding: 0 var(--button-padding, 16px);
96
+ min-width: 64px;
97
+ height: var(--button-height, 36px);
98
+ text-transform: none;
99
+ }
100
+ .primary-colored:hover {
101
+ box-shadow: 0 1px 2px 1px var(--primary-color, #205081);
102
+ }
103
+ .primary-outlined[disabled], .primary-colored[disabled] {
104
+ opacity: 0.5;
105
+ }
106
+ </style>
107
+ `;
108
+ export const SecondaryButtonStyles = html `
109
+ <style>
110
+ .secondary-outlined {
111
+ font-family: var(--theme-font);
112
+ border: 1px solid rgba(var(--secondary-color-rgb), 0.3);
113
+ border-radius: 5px;
114
+ font-size: var(--secondary-font-size, 16px);
115
+ color: var(--secondary-color, #515151);
116
+ padding: 0 var(--button-padding, 16px);
117
+ margin: 0;
118
+ min-width: 64px;
119
+ height: var(--button-height, 36px);
120
+ text-transform: none;
121
+ }
122
+
123
+ .secondary-outlined:hover {
124
+ background-color: var(--secondary-color, #515151);
125
+ color: var(--light-color, #fff);
126
+ }
127
+
128
+ .secondary-colored {
129
+ font-family: var(--theme-font);
130
+ background-color: var(--secondary-color, #515151);
131
+ border-radius: 5px;
132
+ font-size: var(--secondary-font-size, 16px);
133
+ color: var(--light-color, #fff);
134
+ padding: 0 var(--button-padding, 16px);
135
+ margin: 0;
136
+ min-width: 64px;
137
+ height: var(--button-height, 36px);
138
+ text-transform: none;
139
+ }
140
+
141
+ .secondary-colored:hover {
142
+ box-shadow: 0 1px 2px 1px var(--secondary-color, #515151);
143
+ }
144
+
145
+ .secondary-outlined[disabled], .secondary-colored[disabled] {
146
+ opacity: 0.5;
147
+ }
148
+ </style>
149
+ `;
150
+ export const AlertButtonStyles = html `
151
+ <style>
152
+ .alert-outlined {
153
+ font-family: var(--theme-font);
154
+ border: 1px solid var(--error-color);
155
+ border-radius: 5px;
156
+ font-size: var(--secondary-font-size, 16px);
157
+ color: var(--error-color, #d50000);
158
+ padding: 0 var(--button-padding, 16px);
159
+ margin: 0;
160
+ min-width: 64px;
161
+ height: var(--button-height, 36px);
162
+ text-transform: none;
163
+ }
164
+
165
+ .alert-outlined:hover {
166
+ background-color: var(--error-color-l1, #db4437);
167
+ color: var(--light-color, #fff);
168
+ }
169
+
170
+ .alert-colored {
171
+ font-family: var(--theme-font);
172
+ background-color: var(--error-color, #d50000);
173
+ border-radius: 5px;
174
+ font-size: var(--secondary-font-size, 16px);
175
+ color: var(--light-color, #fff);
176
+ padding: 0 var(--button-padding, 16px);
177
+ margin: 0;
178
+ min-width: 64px;
179
+ height: var(--button-height, 36px);
180
+ text-transform: none;
181
+ }
182
+
183
+ .alert-colored:hover {
184
+ box-shadow: 0 1px 2px 1px var(--error-color, #d50000);
185
+ }
186
+
187
+ .alert-outlined[disabled], .alert-colored[disabled] {
188
+ opacity: 0.5;
189
+ }
190
+ </style>
191
+ `;
192
+ export const ToggleButtonStyles = html `
193
+ <style>
194
+ .toggle-group {
195
+ display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap;
196
+ }
197
+
198
+ .toggle-group .toggle:first-child{
199
+ border-top-left-radius: 5px; border-bottom-left-radius: 5px;
200
+ }
201
+ .toggle-group .toggle:last-child{
202
+ border-top-right-radius: 5px; border-bottom-right-radius: 5px;
203
+ }
204
+
205
+ .toggle {
206
+ text-transform: none;
207
+ margin: 0px;
208
+ border-radius: 0px;
209
+ background-color: transparent;
210
+ border: 1px solid var(--secondary-color-l3);
211
+ color: var(--secondary-color);
212
+ font-size: var(--secondary-font-size, 16px);
213
+ font-family: var(--theme-font);
214
+ display: flex;
215
+ justify-content: space-around;
216
+ min-width: 64px;
217
+ align-items: center;
218
+ }
219
+
220
+ .toggle.small {
221
+ height: 30px;
222
+ font-size: var(--tertiary-font-size, 14px);
223
+ }
224
+
225
+ .toggle:hover {
226
+ box-shadow: 0 1px 2px 1px rgba(var(--secondary-color-rgb), 0.1);
227
+ }
228
+
229
+ .selected-toggle {
230
+ background-color: var(--secondary-color);
231
+ color: var(--light-color, #fff);
232
+ }
233
+
234
+ .toggle iron-icon{
235
+ --iron-icon-height: var(--body-font-size, 16px);
236
+ margin-right: 5px;
237
+ }
238
+
239
+ .toggle mwc-icon{
240
+ --mdc-icon-size: var(--body-font-size, 16px);
241
+ margin-right: 5px;
242
+ }
243
+ </style>
244
+ `;
245
+ export const FabStyles = html `
246
+ <style>
247
+ paper-fab {
248
+ position: fixed;
249
+ display: flex;
250
+ flex-direction: column;
251
+ justify-content: center;
252
+ align-items: center;
253
+ bottom: 3%;
254
+ right: 2%;
255
+ }
256
+
257
+ paper-fab[disabled], .fab[disabled] {
258
+ opacity: 0.5;
259
+ }
260
+
261
+ .fab {
262
+ font-size: var(--secondary-font-size, 16px);
263
+ position: fixed;
264
+ display: flex;
265
+ justify-content: center;
266
+ align-items: center;
267
+ bottom: 3%;
268
+ right: 2%;
269
+ box-shadow: var(--paper-material-elevation-2_-_box-shadow);
270
+ font-family: var(--theme-font);
271
+ }
272
+
273
+ .colored-fab {
274
+ background-color: var(--secondary-color, #515151);
275
+ --iron-icon-height: var(--h2-font-size, 26px);
276
+ --iron-icon-width: var(--h2-font-size, 26px);
277
+ color: var(--light-color, #fff);
278
+ }
279
+
280
+ .light-colored-fab {
281
+ background-color: var(--light-color, #fff);
282
+ --iron-icon-height: var(--h2-font-size, 20px);
283
+ --iron-icon-width: var(--h2-font-size, 20px);
284
+ color: var(--secondary-color);
285
+ /* --iron-icon-stroke-color: var(--secondary-color); */
286
+ }
287
+
288
+ .light-colored-fab:hover,
289
+ .colored-fab:hover {
290
+ box-shadow: var(--paper-material-elevation-3_-_box-shadow);
291
+ font-weight: bold;
292
+ }
293
+
294
+ .rectangular-fab {
295
+ height: var(--rectangular-fab-height, 50px);
296
+ width: var(--rectangular-fab-width, 120px);
297
+ border-radius: var(--rectangular-fab-height, 50px);
298
+ padding: var(--rectangular-fab-padding, 0px);
299
+ max-height: var(--rectangular-fab-max-height, 50px);
300
+ z-index: var(--rectangular-fab-z-index, 1);
301
+ }
302
+ .small-fab {
303
+ height: 50px;
304
+ width: 50px;
305
+ padding: 5px;
306
+ }
307
+ @media all and (max-width: 767px) {
308
+ .rectangular-fab {
309
+ height: var(--rectangular-fab-height, 40px);
310
+ width: var(--rectangular-fab-width, 120px);
311
+ border-radius: 50px;
312
+ padding: 0;
313
+ --fab-icon-height: 40px;
314
+ }
315
+ }
316
+ </style>
317
+ `;
318
+ export const ButtonSpinnerStyles = html `
319
+ <style>
320
+ .colored-bt-spinner {
321
+ width: 18px;
322
+ height: 18px;
323
+ --paper-spinner-color: var(--light-color, #fff);
324
+ --paper-spinner-stroke-width: 3px;
325
+ margin-right: 8px;
326
+ }
327
+
328
+ .secondary-outlined-bt-spinner {
329
+ width: 18px;
330
+ height: 18px;
331
+ --paper-spinner-color: var(--secondary-color, #fff);
332
+ --paper-spinner-stroke-width: 3px;
333
+ margin-right: 8px;
334
+ }
335
+
336
+ .primary-outlined-bt-spinner {
337
+ width: 18px;
338
+ height: 18px;
339
+ --paper-spinner-color: var(--primary-color, #fff);
340
+ --paper-spinner-stroke-width: 3px;
341
+ margin-right: 8px;
342
+ }
343
+
344
+ .button-prefix-icon {
345
+ --iron-icon-height: var(--body-font-size, 16px);
346
+ --mdc-icon-size: var(--body-font-size, 16px);
347
+ margin-right: 5px;
348
+ }
349
+ </style>
350
+ `;
351
+ export const SmallButtonStyles = html `
352
+ <style>
353
+ .small-button {
354
+ height: 25px !important;
355
+ width: auto !important;
356
+ padding: 0px !important;
357
+ font-size: var(--tertiary-font-size) !important;
358
+ }
359
+ @media all and (max-width: 767px) {
360
+ .small-button{
361
+ height: 20px !important;
362
+ }
363
+ }
364
+ </style>
365
+ `;
366
+ export const PaperToggleButtonStyles = html `
367
+ <custom-style>
368
+ <style>
369
+ paper-toggle-button {
370
+ font-family: var(--theme-font);
371
+ cursor: pointer;
372
+ --paper-toggle-button-checked-button: {
373
+ height: 15px;
374
+ width: 50%;
375
+ border-radius: 0;
376
+ bottom: 2px;
377
+ box-shadow: none;
378
+ border-bottom-right-radius : 8px;
379
+ border-top-right-radius: 8px;
380
+ }
381
+ --paper-toggle-button-unchecked-button: {
382
+ height: 15px;
383
+ width: 50%;
384
+ border-radius: 0;
385
+ bottom: 2px;
386
+ box-shadow: none;
387
+ border-bottom-left-radius : 8px;
388
+ border-top-left-radius: 8px;
389
+ }
390
+ --paper-toggle-button-unchecked-bar: {
391
+ height: 15px;
392
+ bottom: 2px;
393
+ box-shadow: none;
394
+ }
395
+ --paper-toggle-button-checked-bar: {
396
+ height: 15px;
397
+ bottom: 2px;
398
+ box-shadow: none;
399
+ }
400
+ --paper-toggle-button-label-color: var(--secondary-color);
401
+ align-items: flex-start;
402
+ }
403
+
404
+ paper-toggle-button.primary-colored {
405
+ --paper-toggle-button-unchecked-bar-color: var(--secondary-color-l1);
406
+ --paper-toggle-button-unchecked-button-color: var(--secondary-color-l1);
407
+ --paper-toggle-button-checked-bar-color: var(--primary-color-l1);
408
+ --paper-toggle-button-checked-button-color: var(--primary-color);
409
+ }
410
+
411
+ paper-toggle-button.secondary-colored {
412
+ --paper-toggle-button-unchecked-bar-color: var(--secondary-color-l2);
413
+ --paper-toggle-button-unchecked-button-color: var(--secondary-color-l2);
414
+ --paper-toggle-button-checked-bar-color: var(--secondary-color-l1);
415
+ --paper-toggle-button-checked-button-color: var(--secondary-color);
416
+ }
417
+ </style>
418
+ </custom-style>
419
+ `;
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@fw-components/formula-editor",
3
- "version": "2.0.3-formula-editor.2",
4
- "type": "module",
3
+ "version": "2.0.7-cline-formulaeditor.0",
5
4
  "description": "A WYSIWYG type formula editor",
6
- "main": "dist/src/formula-builder.js",
5
+ "main": "dist/formula-editor/src/formula-builder.js",
7
6
  "publishConfig": {
8
7
  "access": "public"
9
8
  },
@@ -14,9 +13,10 @@
14
13
  "prepublishOnly": "npm run build"
15
14
  },
16
15
  "dependencies": {
17
- "@fw-components/styles": "^2.0.3-formula-editor.1",
16
+ "@fw-components/styles": "^2.0.7-formula-editor.0",
18
17
  "big.js": "^6.2.1",
19
18
  "lit": "^2.1.2",
19
+ "match-sorter": "^8.0.0",
20
20
  "typescript": "^5.0.4"
21
21
  },
22
22
  "author": "The Fundwave Authors",
@@ -25,5 +25,5 @@
25
25
  "@types/big.js": "^6.1.6",
26
26
  "es-dev-server": "^2.1.0"
27
27
  },
28
- "gitHead": "41e04736e935bdc1a2b12fe2dd2d5481f0597559"
28
+ "gitHead": "2e58398ceaa5c5689d6399d207be036aee165f0d"
29
29
  }
package/src/cursor.js CHANGED
@@ -10,7 +10,7 @@ export class Cursor {
10
10
  var _b, _c;
11
11
  let selection = window.getSelection(), charCount = -1, node;
12
12
  if (selection === null || selection === void 0 ? void 0 : selection.focusNode) {
13
- if (Cursor._isChildOf(selection.focusNode, parentElement)) {
13
+ if (_a._isChildOf(selection.focusNode, parentElement)) {
14
14
  node = selection.focusNode;
15
15
  charCount = selection.focusOffset;
16
16
  while (node) {
@@ -35,7 +35,7 @@ export class Cursor {
35
35
  static setCurrentCursorPosition(chars, element) {
36
36
  if (chars >= 0) {
37
37
  var selection = window.getSelection();
38
- let range = Cursor._createRange(element, { count: chars }, undefined);
38
+ let range = _a._createRange(element, { count: chars }, undefined);
39
39
  if (range) {
40
40
  range.collapse(false);
41
41
  selection === null || selection === void 0 ? void 0 : selection.removeAllRanges();
@@ -64,7 +64,7 @@ export class Cursor {
64
64
  }
65
65
  else {
66
66
  for (var lp = 0; lp < node.childNodes.length; lp++) {
67
- range = Cursor._createRange(node.childNodes[lp], chars, range);
67
+ range = _a._createRange(node.childNodes[lp], chars, range);
68
68
  if (chars.count === 0) {
69
69
  break;
70
70
  }
package/src/cursor.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cursor.js","sourceRoot":"","sources":["cursor.ts"],"names":[],"mappings":";AAAA,MAAM,OAAO,MAAM;IACjB;;;;;OAKG;IACH,MAAM,CAAC,wBAAwB,CAAC,aAAkB;;QAChD,IAAI,SAAS,GAAG,MAAM,CAAC,YAAY,EAAE,EACnC,SAAS,GAAG,CAAC,CAAC,EACd,IAAI,CAAC;QAEP,IAAI,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,SAAS,EAAE;YACxB,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,SAAS,EAAE,aAAa,CAAC,EAAE;gBACzD,IAAI,GAAG,SAAS,CAAC,SAAS,CAAC;gBAC3B,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC;gBAElC,OAAO,IAAI,EAAE;oBACX,IAAI,IAAI,KAAK,aAAa,EAAE;wBAC1B,MAAM;qBACP;oBAED,IAAI,IAAI,CAAC,eAAe,EAAE;wBACxB,IAAI,GAAG,IAAI,CAAC,eAAe,CAAC;wBAC5B,SAAS,IAAI,MAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,MAAM,mCAAI,CAAC,CAAC;qBAC5C;yBAAM;wBACL,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC;wBACvB,IAAI,IAAI,KAAK,IAAI,EAAE;4BACjB,MAAM;yBACP;qBACF;iBACF;aACF;SACF;QAED,OAAO,SAAS,CAA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