@humandialog/forms.svelte 1.3.11 → 1.3.12

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.
Files changed (135) hide show
  1. package/README.md +0 -0
  2. package/components/Fab.svelte +103 -31
  3. package/components/Fab.svelte.d.ts +17 -17
  4. package/components/Floating_container.svelte.d.ts +21 -21
  5. package/components/Grid.menu.svelte.d.ts +25 -25
  6. package/components/button.svelte.d.ts +26 -26
  7. package/components/checkbox.svelte.d.ts +26 -26
  8. package/components/combo/combo.d.ts +19 -19
  9. package/components/combo/combo.item.svelte.d.ts +20 -20
  10. package/components/combo/combo.js +19 -19
  11. package/components/combo/combo.source.svelte.d.ts +23 -23
  12. package/components/combo/combo.svelte +25 -22
  13. package/components/combo/combo.svelte.d.ts +44 -44
  14. package/components/contextmenu.svelte.d.ts +26 -26
  15. package/components/date.svelte +40 -30
  16. package/components/date.svelte.d.ts +33 -33
  17. package/components/delayed.spinner.svelte.d.ts +19 -19
  18. package/components/document/editor.svelte +10 -4
  19. package/components/document/editor.svelte.d.ts +35 -35
  20. package/components/document/internal/Document_command.d.ts +12 -11
  21. package/components/document/internal/Document_command.js +12 -11
  22. package/components/document/internal/Selection_helper.d.ts +7 -7
  23. package/components/document/internal/Selection_helper.js +133 -133
  24. package/components/document/internal/Selection_range.d.ts +26 -26
  25. package/components/document/internal/Selection_range.js +58 -58
  26. package/components/document/internal/findSuggestionMatch.d.ts +16 -16
  27. package/components/document/internal/findSuggestionMatch.js +51 -51
  28. package/components/document/internal/h1.icon.svelte.d.ts +23 -23
  29. package/components/document/internal/h2.icon.svelte.d.ts +23 -23
  30. package/components/document/internal/h3.icon.svelte.d.ts +23 -23
  31. package/components/document/internal/h4.icon.svelte.d.ts +23 -23
  32. package/components/document/internal/palette.row.big.svelte.d.ts +46 -46
  33. package/components/document/internal/palette.row.svelte.d.ts +46 -46
  34. package/components/document/internal/palette.svelte +16 -10
  35. package/components/document/internal/palette.svelte.d.ts +82 -82
  36. package/components/document/internal/suggestion.d.ts +158 -158
  37. package/components/document/internal/suggestion.js +194 -194
  38. package/components/document/rich.edit.svelte.d.ts +34 -34
  39. package/components/edit.field.svelte.d.ts +31 -31
  40. package/components/file.loader.svelte.d.ts +25 -25
  41. package/components/icon.ex.svelte.d.ts +62 -62
  42. package/components/icon.svelte.d.ts +62 -62
  43. package/components/input.text.svelte.d.ts +29 -29
  44. package/components/inputbox.ltop.svelte.d.ts +59 -59
  45. package/components/kanban/Kanban.d.ts +47 -47
  46. package/components/kanban/Kanban.js +105 -105
  47. package/components/kanban/internal/kanban.card.svelte +5 -3
  48. package/components/kanban/internal/kanban.card.svelte.d.ts +32 -32
  49. package/components/kanban/internal/kanban.column.svelte.d.ts +53 -53
  50. package/components/kanban/internal/kanban.inserter.svelte.d.ts +18 -18
  51. package/components/kanban/internal/kanban.move.menu.svelte +135 -135
  52. package/components/kanban/internal/kanban.move.menu.svelte.d.ts +22 -22
  53. package/components/kanban/internal/kanban.props.svelte.d.ts +19 -19
  54. package/components/kanban/kanban.callbacks.svelte +1 -1
  55. package/components/kanban/kanban.callbacks.svelte.d.ts +18 -18
  56. package/components/kanban/kanban.column.svelte.d.ts +21 -21
  57. package/components/kanban/kanban.combo.svelte.d.ts +25 -25
  58. package/components/kanban/kanban.date.svelte +1 -1
  59. package/components/kanban/kanban.date.svelte.d.ts +21 -21
  60. package/components/kanban/kanban.source.svelte.d.ts +23 -23
  61. package/components/kanban/kanban.static.svelte.d.ts +20 -20
  62. package/components/kanban/kanban.summary.svelte.d.ts +18 -18
  63. package/components/kanban/kanban.svelte.d.ts +65 -65
  64. package/components/kanban/kanban.tags.svelte.d.ts +24 -24
  65. package/components/kanban/kanban.title.svelte.d.ts +21 -21
  66. package/components/list/List.d.ts +46 -46
  67. package/components/list/List.js +54 -54
  68. package/components/list/internal/list.element.props.svelte +2 -2
  69. package/components/list/internal/list.element.props.svelte.d.ts +21 -21
  70. package/components/list/internal/list.element.summary.svelte +46 -46
  71. package/components/list/internal/list.element.summary.svelte.d.ts +24 -24
  72. package/components/list/internal/list.element.svelte +8 -6
  73. package/components/list/internal/list.element.svelte.d.ts +31 -31
  74. package/components/list/internal/list.inserter.svelte.d.ts +19 -19
  75. package/components/list/list.combo.svelte.d.ts +22 -22
  76. package/components/list/list.date.svelte.d.ts +18 -18
  77. package/components/list/list.inserter.svelte.d.ts +17 -17
  78. package/components/list/list.static.svelte.d.ts +17 -17
  79. package/components/list/list.summary.svelte.d.ts +19 -19
  80. package/components/list/list.svelte.d.ts +59 -59
  81. package/components/list/list.title.svelte.d.ts +22 -22
  82. package/components/menu.d.ts +5 -5
  83. package/components/menu.js +57 -57
  84. package/components/radio.svelte.d.ts +26 -26
  85. package/components/sidebar/sidebar.brand.svelte.d.ts +33 -33
  86. package/components/sidebar/sidebar.group.svelte +2 -2
  87. package/components/sidebar/sidebar.group.svelte.d.ts +33 -33
  88. package/components/sidebar/sidebar.item.svelte +52 -29
  89. package/components/sidebar/sidebar.item.svelte.d.ts +32 -32
  90. package/components/sidebar/sidebar.list.svelte +4 -2
  91. package/components/sidebar/sidebar.list.svelte.d.ts +38 -38
  92. package/components/sidebar/sidebar.svelte.d.ts +27 -27
  93. package/components/simple.table.svelte.d.ts +41 -41
  94. package/components/table/_template.table.svelte.d.ts +57 -57
  95. package/components/table/column.svelte.d.ts +19 -19
  96. package/components/table/item.svelte.d.ts +17 -17
  97. package/components/table/table.d.ts +11 -11
  98. package/components/table/table.js +11 -11
  99. package/components/table/table.svelte +6 -3
  100. package/components/table/table.svelte.d.ts +75 -75
  101. package/components/tag.colors.svelte.d.ts +17 -17
  102. package/components/tag.svelte +12 -9
  103. package/components/tag.svelte.d.ts +20 -20
  104. package/components/tags.svelte +13 -11
  105. package/components/tags.svelte.d.ts +32 -32
  106. package/components/textarea.ltop.svelte.d.ts +35 -35
  107. package/components/tile.title.svelte.d.ts +29 -29
  108. package/console.svelte.d.ts +23 -23
  109. package/desk.svelte +58 -26
  110. package/desk.svelte.d.ts +23 -23
  111. package/form.box.svelte.d.ts +35 -35
  112. package/horizontal.toolbar.svelte +3 -3
  113. package/horizontal.toolbar.svelte.d.ts +25 -25
  114. package/index.d.ts +63 -63
  115. package/index.js +69 -69
  116. package/internal/configurable.content.svelte.d.ts +29 -29
  117. package/internal/loading.svelte.d.ts +23 -23
  118. package/modal.svelte.d.ts +39 -39
  119. package/operations.svelte +37 -8
  120. package/operations.svelte.d.ts +16 -16
  121. package/package.json +8 -8
  122. package/page.row.svelte.d.ts +31 -31
  123. package/page.svelte +7 -2
  124. package/page.svelte.d.ts +47 -47
  125. package/stores.d.ts +44 -44
  126. package/tenant.members.svelte +69 -39
  127. package/tenant.members.svelte.d.ts +33 -33
  128. package/tile.svelte.d.ts +33 -33
  129. package/tiles.row.svelte.d.ts +31 -31
  130. package/tiles.vertical.row.svelte.d.ts +29 -29
  131. package/updates.d.ts +4 -4
  132. package/utils.d.ts +50 -50
  133. package/utils.js +36 -7
  134. package/vertical.toolbar.svelte +1 -1
  135. package/vertical.toolbar.svelte.d.ts +27 -27
@@ -1,133 +1,133 @@
1
- import { Selection_edge, Selection_edge_info, Selection_range } from "./Selection_range";
2
- export class Selection_helper {
3
- static nodewalk(node, func) {
4
- let result = func(node);
5
- for (node = node.firstChild; result !== false && node; node = node.nextSibling)
6
- result = this.nodewalk(node, func);
7
- return result;
8
- }
9
- static create_cursor_range(elem, nrOfChars) {
10
- let result = [elem, 0];
11
- this.nodewalk(elem, (node) => {
12
- /* if (nrOfChars === 0) {
13
- result = [node, 0]
14
- return false;
15
- }
16
- */
17
- if (node.textContent && !node.firstChild && node.nodeType !== node.COMMENT_NODE && node.nodeType === node.TEXT_NODE) {
18
- if (node.textContent.length < nrOfChars) {
19
- nrOfChars -= node.textContent.length;
20
- }
21
- else {
22
- result = [node, nrOfChars];
23
- return false;
24
- }
25
- }
26
- ;
27
- result = [node, nrOfChars];
28
- });
29
- const range = document.createRange();
30
- range.setStart(result[0], result[1]);
31
- range.setEnd(result[0], result[1]);
32
- return [range, result[0]];
33
- }
34
- static create_range(elem, start, end) {
35
- const nodesToFind = [null, null];
36
- const selPoints = [0, 0];
37
- let nrOfChars = start;
38
- let nrOfCharsEnd = end;
39
- this.nodewalk(elem, (node) => {
40
- if (nodesToFind.every(v => v)) {
41
- return false;
42
- }
43
- if (start <= 0) {
44
- nodesToFind[0] = node;
45
- selPoints[0] = 0;
46
- }
47
- else if (node.textContent && !node.firstChild && node.nodeType !== node.COMMENT_NODE && node.nodeType === node.TEXT_NODE) {
48
- const nodeLength = node.textContent.length;
49
- const nrToCompare = (nodesToFind[0] === null) ? nrOfChars : nrOfCharsEnd;
50
- if (nrToCompare > nodeLength) {
51
- nrOfChars -= nodeLength;
52
- nrOfCharsEnd -= nodeLength;
53
- }
54
- else {
55
- if (nodesToFind[0] !== null) {
56
- nodesToFind[1] = node;
57
- selPoints[1] = nrOfCharsEnd;
58
- }
59
- else {
60
- nodesToFind[0] = node;
61
- selPoints[0] = nrOfChars;
62
- if (nrOfCharsEnd <= nodeLength) {
63
- nodesToFind[1] = node;
64
- selPoints[1] = nrOfCharsEnd;
65
- }
66
- else {
67
- nrOfCharsEnd -= nodeLength;
68
- }
69
- }
70
- }
71
- }
72
- ;
73
- });
74
- if (!nodesToFind[0]) {
75
- nodesToFind[0] = elem;
76
- }
77
- if (!nodesToFind[1]) {
78
- nodesToFind[1] = nodesToFind[0];
79
- }
80
- const range = document.createRange();
81
- range.setStart(nodesToFind[0], selPoints[0]);
82
- range.setEnd(nodesToFind[1], selPoints[1]);
83
- return range;
84
- }
85
- static get_selection(elem) {
86
- const sel = window.getSelection();
87
- if (sel.anchorNode === elem) {
88
- return new Selection_range(new Selection_edge(sel.anchorOffset, sel.anchorOffset), new Selection_edge(sel.focusOffset, sel.focusOffset));
89
- }
90
- else {
91
- const nodesToFind = [sel.anchorNode, sel.focusNode];
92
- if (!elem.contains(sel.anchorNode) || !elem.contains(sel.focusNode))
93
- return undefined;
94
- const found = [false, false];
95
- let i;
96
- let edges_positons = [0, 0];
97
- this.nodewalk(elem, (node) => {
98
- for (i = 0; i < 2; i++) {
99
- if (node === nodesToFind[i]) {
100
- found[i] = true;
101
- if (found[i === 0 ? 1 : 0])
102
- return false; // all done
103
- }
104
- }
105
- if (node.textContent && !node.firstChild && node.nodeType !== node.COMMENT_NODE) {
106
- for (i = 0; i < 2; i++) {
107
- if (!found[i]) {
108
- edges_positons[i] += node.textContent.length;
109
- }
110
- }
111
- }
112
- });
113
- edges_positons[0] += sel.anchorOffset;
114
- edges_positons[1] += sel.focusOffset;
115
- let begin = new Selection_edge(edges_positons[0], sel.anchorOffset);
116
- let end = new Selection_edge(edges_positons[1], sel.focusOffset);
117
- if (sel.anchorOffset == sel.anchorNode.textContent.length)
118
- begin.info = Selection_edge_info.Node_end;
119
- else if (sel.anchorOffset == 0)
120
- begin.info = Selection_edge_info.Node_start;
121
- if (sel.focusOffset == sel.focusNode.textContent.length)
122
- end.info = Selection_edge_info.Node_end;
123
- else if (sel.focusOffset == 0)
124
- end.info = Selection_edge_info.Node_start;
125
- if (begin.absolute_index > end.absolute_index) {
126
- return new Selection_range(new Selection_edge(end.absolute_index, end.node_index, end.info), new Selection_edge(begin.absolute_index, begin.node_index, begin.info));
127
- }
128
- else {
129
- return new Selection_range(new Selection_edge(begin.absolute_index, begin.node_index, begin.info), new Selection_edge(end.absolute_index, end.node_index, end.info));
130
- }
131
- }
132
- }
133
- }
1
+ import { Selection_edge, Selection_edge_info, Selection_range } from "./Selection_range";
2
+ export class Selection_helper {
3
+ static nodewalk(node, func) {
4
+ let result = func(node);
5
+ for (node = node.firstChild; result !== false && node; node = node.nextSibling)
6
+ result = this.nodewalk(node, func);
7
+ return result;
8
+ }
9
+ static create_cursor_range(elem, nrOfChars) {
10
+ let result = [elem, 0];
11
+ this.nodewalk(elem, (node) => {
12
+ /* if (nrOfChars === 0) {
13
+ result = [node, 0]
14
+ return false;
15
+ }
16
+ */
17
+ if (node.textContent && !node.firstChild && node.nodeType !== node.COMMENT_NODE && node.nodeType === node.TEXT_NODE) {
18
+ if (node.textContent.length < nrOfChars) {
19
+ nrOfChars -= node.textContent.length;
20
+ }
21
+ else {
22
+ result = [node, nrOfChars];
23
+ return false;
24
+ }
25
+ }
26
+ ;
27
+ result = [node, nrOfChars];
28
+ });
29
+ const range = document.createRange();
30
+ range.setStart(result[0], result[1]);
31
+ range.setEnd(result[0], result[1]);
32
+ return [range, result[0]];
33
+ }
34
+ static create_range(elem, start, end) {
35
+ const nodesToFind = [null, null];
36
+ const selPoints = [0, 0];
37
+ let nrOfChars = start;
38
+ let nrOfCharsEnd = end;
39
+ this.nodewalk(elem, (node) => {
40
+ if (nodesToFind.every(v => v)) {
41
+ return false;
42
+ }
43
+ if (start <= 0) {
44
+ nodesToFind[0] = node;
45
+ selPoints[0] = 0;
46
+ }
47
+ else if (node.textContent && !node.firstChild && node.nodeType !== node.COMMENT_NODE && node.nodeType === node.TEXT_NODE) {
48
+ const nodeLength = node.textContent.length;
49
+ const nrToCompare = (nodesToFind[0] === null) ? nrOfChars : nrOfCharsEnd;
50
+ if (nrToCompare > nodeLength) {
51
+ nrOfChars -= nodeLength;
52
+ nrOfCharsEnd -= nodeLength;
53
+ }
54
+ else {
55
+ if (nodesToFind[0] !== null) {
56
+ nodesToFind[1] = node;
57
+ selPoints[1] = nrOfCharsEnd;
58
+ }
59
+ else {
60
+ nodesToFind[0] = node;
61
+ selPoints[0] = nrOfChars;
62
+ if (nrOfCharsEnd <= nodeLength) {
63
+ nodesToFind[1] = node;
64
+ selPoints[1] = nrOfCharsEnd;
65
+ }
66
+ else {
67
+ nrOfCharsEnd -= nodeLength;
68
+ }
69
+ }
70
+ }
71
+ }
72
+ ;
73
+ });
74
+ if (!nodesToFind[0]) {
75
+ nodesToFind[0] = elem;
76
+ }
77
+ if (!nodesToFind[1]) {
78
+ nodesToFind[1] = nodesToFind[0];
79
+ }
80
+ const range = document.createRange();
81
+ range.setStart(nodesToFind[0], selPoints[0]);
82
+ range.setEnd(nodesToFind[1], selPoints[1]);
83
+ return range;
84
+ }
85
+ static get_selection(elem) {
86
+ const sel = window.getSelection();
87
+ if (sel.anchorNode === elem) {
88
+ return new Selection_range(new Selection_edge(sel.anchorOffset, sel.anchorOffset), new Selection_edge(sel.focusOffset, sel.focusOffset));
89
+ }
90
+ else {
91
+ const nodesToFind = [sel.anchorNode, sel.focusNode];
92
+ if (!elem.contains(sel.anchorNode) || !elem.contains(sel.focusNode))
93
+ return undefined;
94
+ const found = [false, false];
95
+ let i;
96
+ let edges_positons = [0, 0];
97
+ this.nodewalk(elem, (node) => {
98
+ for (i = 0; i < 2; i++) {
99
+ if (node === nodesToFind[i]) {
100
+ found[i] = true;
101
+ if (found[i === 0 ? 1 : 0])
102
+ return false; // all done
103
+ }
104
+ }
105
+ if (node.textContent && !node.firstChild && node.nodeType !== node.COMMENT_NODE) {
106
+ for (i = 0; i < 2; i++) {
107
+ if (!found[i]) {
108
+ edges_positons[i] += node.textContent.length;
109
+ }
110
+ }
111
+ }
112
+ });
113
+ edges_positons[0] += sel.anchorOffset;
114
+ edges_positons[1] += sel.focusOffset;
115
+ let begin = new Selection_edge(edges_positons[0], sel.anchorOffset);
116
+ let end = new Selection_edge(edges_positons[1], sel.focusOffset);
117
+ if (sel.anchorOffset == sel.anchorNode.textContent.length)
118
+ begin.info = Selection_edge_info.Node_end;
119
+ else if (sel.anchorOffset == 0)
120
+ begin.info = Selection_edge_info.Node_start;
121
+ if (sel.focusOffset == sel.focusNode.textContent.length)
122
+ end.info = Selection_edge_info.Node_end;
123
+ else if (sel.focusOffset == 0)
124
+ end.info = Selection_edge_info.Node_start;
125
+ if (begin.absolute_index > end.absolute_index) {
126
+ return new Selection_range(new Selection_edge(end.absolute_index, end.node_index, end.info), new Selection_edge(begin.absolute_index, begin.node_index, begin.info));
127
+ }
128
+ else {
129
+ return new Selection_range(new Selection_edge(begin.absolute_index, begin.node_index, begin.info), new Selection_edge(end.absolute_index, end.node_index, end.info));
130
+ }
131
+ }
132
+ }
133
+ }
@@ -1,26 +1,26 @@
1
- export declare enum Selection_edge_info {
2
- None = 0,
3
- Node_start = 1,
4
- Node_end = 2
5
- }
6
- export declare class Selection_edge {
7
- absolute_index: number;
8
- node_index: number;
9
- info: Selection_edge_info;
10
- node_left: number;
11
- node_top: number;
12
- node_right: number;
13
- node_bottom: number;
14
- constructor(abs_index: number, node_index: number, info?: Selection_edge_info);
15
- is_equal(c: Selection_edge): boolean;
16
- clone(): Selection_edge;
17
- }
18
- export declare class Selection_range {
19
- begin: Selection_edge;
20
- end: Selection_edge;
21
- is_multi: () => void;
22
- constructor(b: Selection_edge, e: Selection_edge);
23
- clone(): Selection_range;
24
- is_equal(c: Selection_range): boolean;
25
- static unknown: Selection_range;
26
- }
1
+ export declare enum Selection_edge_info {
2
+ None = 0,
3
+ Node_start = 1,
4
+ Node_end = 2
5
+ }
6
+ export declare class Selection_edge {
7
+ absolute_index: number;
8
+ node_index: number;
9
+ info: Selection_edge_info;
10
+ node_left: number;
11
+ node_top: number;
12
+ node_right: number;
13
+ node_bottom: number;
14
+ constructor(abs_index: number, node_index: number, info?: Selection_edge_info);
15
+ is_equal(c: Selection_edge): boolean;
16
+ clone(): Selection_edge;
17
+ }
18
+ export declare class Selection_range {
19
+ begin: Selection_edge;
20
+ end: Selection_edge;
21
+ is_multi: () => void;
22
+ constructor(b: Selection_edge, e: Selection_edge);
23
+ clone(): Selection_range;
24
+ is_equal(c: Selection_range): boolean;
25
+ static unknown: Selection_range;
26
+ }
@@ -1,58 +1,58 @@
1
- export var Selection_edge_info;
2
- (function (Selection_edge_info) {
3
- Selection_edge_info[Selection_edge_info["None"] = 0] = "None";
4
- Selection_edge_info[Selection_edge_info["Node_start"] = 1] = "Node_start";
5
- Selection_edge_info[Selection_edge_info["Node_end"] = 2] = "Node_end";
6
- })(Selection_edge_info || (Selection_edge_info = {}));
7
- export class Selection_edge {
8
- absolute_index;
9
- node_index;
10
- info;
11
- node_left;
12
- node_top;
13
- node_right;
14
- node_bottom;
15
- constructor(abs_index, node_index, info = Selection_edge_info.None) {
16
- this.absolute_index = abs_index;
17
- this.node_index = node_index;
18
- this.info = info;
19
- this.node_left = 0;
20
- this.node_top = 0;
21
- this.node_right = 0;
22
- this.node_bottom = 0;
23
- }
24
- is_equal(c) {
25
- if (!c)
26
- return false;
27
- return (c.absolute_index == this.absolute_index &&
28
- c.node_index == this.node_index &&
29
- c.info == this.info);
30
- }
31
- clone() {
32
- let r = new Selection_edge(this.absolute_index, this.node_index, this.info);
33
- r.node_left = this.node_left;
34
- r.node_top = this.node_top;
35
- r.node_right = this.node_right;
36
- r.node_bottom = this.node_bottom;
37
- return r;
38
- }
39
- }
40
- export class Selection_range {
41
- begin;
42
- end;
43
- is_multi = () => { this.begin == this.end || this.end.absolute_index <= 0; };
44
- constructor(b, e) {
45
- this.begin = b;
46
- this.end = e;
47
- }
48
- clone() {
49
- return new Selection_range(this.begin.clone(), this.end.clone());
50
- }
51
- is_equal(c) {
52
- if (!c)
53
- return false;
54
- return (c.begin.is_equal(this.begin) &&
55
- c.end.is_equal(this.end));
56
- }
57
- static unknown = new Selection_range(new Selection_edge(-1, -1), new Selection_edge(-1, -1));
58
- }
1
+ export var Selection_edge_info;
2
+ (function (Selection_edge_info) {
3
+ Selection_edge_info[Selection_edge_info["None"] = 0] = "None";
4
+ Selection_edge_info[Selection_edge_info["Node_start"] = 1] = "Node_start";
5
+ Selection_edge_info[Selection_edge_info["Node_end"] = 2] = "Node_end";
6
+ })(Selection_edge_info || (Selection_edge_info = {}));
7
+ export class Selection_edge {
8
+ absolute_index;
9
+ node_index;
10
+ info;
11
+ node_left;
12
+ node_top;
13
+ node_right;
14
+ node_bottom;
15
+ constructor(abs_index, node_index, info = Selection_edge_info.None) {
16
+ this.absolute_index = abs_index;
17
+ this.node_index = node_index;
18
+ this.info = info;
19
+ this.node_left = 0;
20
+ this.node_top = 0;
21
+ this.node_right = 0;
22
+ this.node_bottom = 0;
23
+ }
24
+ is_equal(c) {
25
+ if (!c)
26
+ return false;
27
+ return (c.absolute_index == this.absolute_index &&
28
+ c.node_index == this.node_index &&
29
+ c.info == this.info);
30
+ }
31
+ clone() {
32
+ let r = new Selection_edge(this.absolute_index, this.node_index, this.info);
33
+ r.node_left = this.node_left;
34
+ r.node_top = this.node_top;
35
+ r.node_right = this.node_right;
36
+ r.node_bottom = this.node_bottom;
37
+ return r;
38
+ }
39
+ }
40
+ export class Selection_range {
41
+ begin;
42
+ end;
43
+ is_multi = () => { this.begin == this.end || this.end.absolute_index <= 0; };
44
+ constructor(b, e) {
45
+ this.begin = b;
46
+ this.end = e;
47
+ }
48
+ clone() {
49
+ return new Selection_range(this.begin.clone(), this.end.clone());
50
+ }
51
+ is_equal(c) {
52
+ if (!c)
53
+ return false;
54
+ return (c.begin.is_equal(this.begin) &&
55
+ c.end.is_equal(this.end));
56
+ }
57
+ static unknown = new Selection_range(new Selection_edge(-1, -1), new Selection_edge(-1, -1));
58
+ }
@@ -1,16 +1,16 @@
1
- import { type Range } from '@tiptap/core';
2
- import { ResolvedPos } from '@tiptap/pm/model';
3
- export interface Trigger {
4
- char: string;
5
- allowSpaces: boolean;
6
- allowToIncludeChar: boolean;
7
- allowedPrefixes: string[] | null;
8
- startOfLine: boolean;
9
- $position: ResolvedPos;
10
- }
11
- export type SuggestionMatch = {
12
- range: Range;
13
- query: string;
14
- text: string;
15
- } | null;
16
- export declare function findSuggestionMatch(config: Trigger): SuggestionMatch;
1
+ import { type Range } from '@tiptap/core';
2
+ import { ResolvedPos } from '@tiptap/pm/model';
3
+ export interface Trigger {
4
+ char: string;
5
+ allowSpaces: boolean;
6
+ allowToIncludeChar: boolean;
7
+ allowedPrefixes: string[] | null;
8
+ startOfLine: boolean;
9
+ $position: ResolvedPos;
10
+ }
11
+ export type SuggestionMatch = {
12
+ range: Range;
13
+ query: string;
14
+ text: string;
15
+ } | null;
16
+ export declare function findSuggestionMatch(config: Trigger): SuggestionMatch;
@@ -1,51 +1,51 @@
1
- import { escapeForRegEx } from '@tiptap/core';
2
- import {} from '@tiptap/core';
3
- import { ResolvedPos } from '@tiptap/pm/model';
4
- export function findSuggestionMatch(config) {
5
- const { char, allowSpaces: allowSpacesOption, allowToIncludeChar, allowedPrefixes, startOfLine, $position, } = config;
6
- const allowSpaces = allowSpacesOption && !allowToIncludeChar;
7
- const escapedChar = escapeForRegEx(char);
8
- const suffix = new RegExp(`\\s${escapedChar}$`);
9
- const prefix = startOfLine ? '^' : '';
10
- const finalEscapedChar = allowToIncludeChar ? '' : escapedChar;
11
- const regexp = allowSpaces
12
- ? new RegExp(`${prefix}${escapedChar}.*?(?=\\s${finalEscapedChar}|$)`, 'gm')
13
- : new RegExp(`${prefix}(?:^)?${escapedChar}[^\\s${finalEscapedChar}]*`, 'gm');
14
- const text = $position.nodeBefore?.isText && $position.nodeBefore.text;
15
- if (!text) {
16
- return null;
17
- }
18
- const textFrom = $position.pos - text.length;
19
- const match = Array.from(text.matchAll(regexp)).pop();
20
- if (!match || match.input === undefined || match.index === undefined) {
21
- return null;
22
- }
23
- // JavaScript doesn't have lookbehinds. This hacks a check that first character
24
- // is a space or the start of the line
25
- const matchPrefix = match.input.slice(Math.max(0, match.index - 1), match.index);
26
- const matchPrefixIsAllowed = new RegExp(`^[${allowedPrefixes?.join('')}\0]?$`).test(matchPrefix);
27
- if (allowedPrefixes !== null && !matchPrefixIsAllowed) {
28
- return null;
29
- }
30
- // The absolute position of the match in the document
31
- const from = textFrom + match.index;
32
- let to = from + match[0].length;
33
- // Edge case handling; if spaces are allowed and we're directly in between
34
- // two triggers
35
- if (allowSpaces && suffix.test(text.slice(to - 1, to + 1))) {
36
- match[0] += ' ';
37
- to += 1;
38
- }
39
- // If the $position is located within the matched substring, return that range
40
- if (from < $position.pos && to >= $position.pos) {
41
- return {
42
- range: {
43
- from,
44
- to,
45
- },
46
- query: match[0].slice(char.length),
47
- text: match[0],
48
- };
49
- }
50
- return null;
51
- }
1
+ import { escapeForRegEx } from '@tiptap/core';
2
+ import {} from '@tiptap/core';
3
+ import { ResolvedPos } from '@tiptap/pm/model';
4
+ export function findSuggestionMatch(config) {
5
+ const { char, allowSpaces: allowSpacesOption, allowToIncludeChar, allowedPrefixes, startOfLine, $position, } = config;
6
+ const allowSpaces = allowSpacesOption && !allowToIncludeChar;
7
+ const escapedChar = escapeForRegEx(char);
8
+ const suffix = new RegExp(`\\s${escapedChar}$`);
9
+ const prefix = startOfLine ? '^' : '';
10
+ const finalEscapedChar = allowToIncludeChar ? '' : escapedChar;
11
+ const regexp = allowSpaces
12
+ ? new RegExp(`${prefix}${escapedChar}.*?(?=\\s${finalEscapedChar}|$)`, 'gm')
13
+ : new RegExp(`${prefix}(?:^)?${escapedChar}[^\\s${finalEscapedChar}]*`, 'gm');
14
+ const text = $position.nodeBefore?.isText && $position.nodeBefore.text;
15
+ if (!text) {
16
+ return null;
17
+ }
18
+ const textFrom = $position.pos - text.length;
19
+ const match = Array.from(text.matchAll(regexp)).pop();
20
+ if (!match || match.input === undefined || match.index === undefined) {
21
+ return null;
22
+ }
23
+ // JavaScript doesn't have lookbehinds. This hacks a check that first character
24
+ // is a space or the start of the line
25
+ const matchPrefix = match.input.slice(Math.max(0, match.index - 1), match.index);
26
+ const matchPrefixIsAllowed = new RegExp(`^[${allowedPrefixes?.join('')}\0]?$`).test(matchPrefix);
27
+ if (allowedPrefixes !== null && !matchPrefixIsAllowed) {
28
+ return null;
29
+ }
30
+ // The absolute position of the match in the document
31
+ const from = textFrom + match.index;
32
+ let to = from + match[0].length;
33
+ // Edge case handling; if spaces are allowed and we're directly in between
34
+ // two triggers
35
+ if (allowSpaces && suffix.test(text.slice(to - 1, to + 1))) {
36
+ match[0] += ' ';
37
+ to += 1;
38
+ }
39
+ // If the $position is located within the matched substring, return that range
40
+ if (from < $position.pos && to >= $position.pos) {
41
+ return {
42
+ range: {
43
+ from,
44
+ to,
45
+ },
46
+ query: match[0].slice(char.length),
47
+ text: match[0],
48
+ };
49
+ }
50
+ return null;
51
+ }
@@ -1,23 +1,23 @@
1
- /** @typedef {typeof __propDef.props} H1Props */
2
- /** @typedef {typeof __propDef.events} H1Events */
3
- /** @typedef {typeof __propDef.slots} H1Slots */
4
- export default class H1 extends SvelteComponentTyped<{
5
- [x: string]: any;
6
- }, {
7
- [evt: string]: CustomEvent<any>;
8
- }, {}> {
9
- }
10
- export type H1Props = typeof __propDef.props;
11
- export type H1Events = typeof __propDef.events;
12
- export type H1Slots = typeof __propDef.slots;
13
- import { SvelteComponentTyped } from "svelte";
14
- declare const __propDef: {
15
- props: {
16
- [x: string]: any;
17
- };
18
- events: {
19
- [evt: string]: CustomEvent<any>;
20
- };
21
- slots: {};
22
- };
23
- export {};
1
+ /** @typedef {typeof __propDef.props} H1Props */
2
+ /** @typedef {typeof __propDef.events} H1Events */
3
+ /** @typedef {typeof __propDef.slots} H1Slots */
4
+ export default class H1 extends SvelteComponentTyped<{
5
+ [x: string]: any;
6
+ }, {
7
+ [evt: string]: CustomEvent<any>;
8
+ }, {}> {
9
+ }
10
+ export type H1Props = typeof __propDef.props;
11
+ export type H1Events = typeof __propDef.events;
12
+ export type H1Slots = typeof __propDef.slots;
13
+ import { SvelteComponentTyped } from "svelte";
14
+ declare const __propDef: {
15
+ props: {
16
+ [x: string]: any;
17
+ };
18
+ events: {
19
+ [evt: string]: CustomEvent<any>;
20
+ };
21
+ slots: {};
22
+ };
23
+ export {};