@vertexvis/ui 0.1.0-canary.7 → 0.1.0-canary.9
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/dist/cjs/components.cjs.js +1 -1
- package/dist/cjs/{icon-460fd0f5.js → icon-21deee4d.js} +1 -1
- package/dist/cjs/{icon-button-786427d6.js → icon-button-b7ed3b48.js} +1 -1
- package/dist/cjs/{icon-helper-ba408f49.js → icon-helper-31ee6ce0.js} +5 -0
- package/dist/cjs/index.cjs.js +5 -5
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{result-list-1e592c3c.js → result-list-241ffe8d.js} +46 -2
- package/dist/cjs/search-bar-91cbcd07.js +421 -0
- package/dist/cjs/vertex-icon-button.cjs.entry.js +2 -2
- package/dist/cjs/vertex-icon.cjs.entry.js +2 -2
- package/dist/cjs/vertex-result-list.cjs.entry.js +1 -1
- package/dist/cjs/vertex-search-bar.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/icon/icon-helper.js +3 -0
- package/dist/collection/components/icon/icon.js +1 -1
- package/dist/collection/components/icon/icons/compare.js +2 -0
- package/dist/collection/components/icon-button/icon-button.js +1 -1
- package/dist/collection/components/result-list/result-list.js +52 -5
- package/dist/collection/components/result-list/types.js +1 -0
- package/dist/collection/components/search-bar/dom.js +12 -0
- package/dist/collection/components/search-bar/lib.js +35 -15
- package/dist/collection/components/search-bar/search-bar.css +0 -16
- package/dist/collection/components/search-bar/search-bar.js +380 -324
- package/dist/collection/types/icon.js +1 -0
- package/dist/collection/util/templates/element-pool.js +19 -1
- package/dist/components/components.esm.js +1 -1
- package/dist/components/index.esm.js +1 -1
- package/dist/components/p-1c7dc57e.js +1 -0
- package/dist/components/p-646ac7e7.entry.js +1 -0
- package/dist/components/p-6b862967.js +1 -0
- package/dist/components/p-cfe369bf.entry.js +1 -0
- package/dist/components/{p-103249b4.js → p-daabd39c.js} +1 -1
- package/dist/components/p-db34f10c.js +1 -0
- package/dist/components/p-ee496965.entry.js +1 -0
- package/dist/components/p-f03fe304.entry.js +1 -0
- package/dist/components/{p-ca52a423.js → p-fe0f0f64.js} +1 -1
- package/dist/esm/components.js +1 -1
- package/dist/esm/{icon-d37150b4.js → icon-8b8d7617.js} +1 -1
- package/dist/esm/{icon-button-aad3c0e7.js → icon-button-192f2555.js} +1 -1
- package/dist/esm/{icon-helper-83f10f73.js → icon-helper-a6be8de9.js} +5 -0
- package/dist/esm/index.js +5 -5
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{result-list-36cfb08a.js → result-list-16c6afbd.js} +46 -2
- package/dist/esm/search-bar-f12a3599.js +419 -0
- package/dist/esm/vertex-icon-button.entry.js +2 -2
- package/dist/esm/vertex-icon.entry.js +2 -2
- package/dist/esm/vertex-result-list.entry.js +1 -1
- package/dist/esm/vertex-search-bar.entry.js +1 -1
- package/dist/types/components/icon/icons/compare.d.ts +3 -0
- package/dist/types/components/result-list/result-list.d.ts +6 -1
- package/dist/types/components/result-list/types.d.ts +4 -0
- package/dist/types/components/search-bar/dom.d.ts +3 -0
- package/dist/types/components/search-bar/lib.d.ts +24 -6
- package/dist/types/components/search-bar/search-bar.d.ts +124 -42
- package/dist/types/components.d.ts +81 -20
- package/dist/types/types/icon.d.ts +1 -0
- package/dist/types/util/templates/element-pool.d.ts +10 -1
- package/package.json +4 -3
- package/dist/cjs/search-bar-bb40cfa7.js +0 -290
- package/dist/components/p-03dbb28c.js +0 -1
- package/dist/components/p-19318fee.entry.js +0 -1
- package/dist/components/p-4224c2ad.js +0 -1
- package/dist/components/p-52739247.js +0 -1
- package/dist/components/p-7dba2574.entry.js +0 -1
- package/dist/components/p-ae6a3c46.entry.js +0 -1
- package/dist/components/p-f71fc166.entry.js +0 -1
- package/dist/esm/search-bar-59cc151d.js +0 -288
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const getWindowSelection = () => {
|
|
2
|
+
if (typeof window !== 'undefined') {
|
|
3
|
+
return window.getSelection();
|
|
4
|
+
}
|
|
5
|
+
return undefined;
|
|
6
|
+
};
|
|
7
|
+
export const createDocumentRange = () => {
|
|
8
|
+
return document.createRange();
|
|
9
|
+
};
|
|
10
|
+
export const createTextNode = (text) => {
|
|
11
|
+
return new Text(text);
|
|
12
|
+
};
|
|
@@ -1,21 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
return undefined;
|
|
1
|
+
import { createTextNode } from './dom';
|
|
2
|
+
export const createResultUri = (result) => {
|
|
3
|
+
return `${result.type}:${result.id}`;
|
|
6
4
|
};
|
|
7
|
-
export const
|
|
8
|
-
|
|
5
|
+
export const createSearchResultReplacement = (result, before, after) => {
|
|
6
|
+
const urn = createResultUri(result);
|
|
7
|
+
return {
|
|
8
|
+
before: createTextNode(before),
|
|
9
|
+
beforeSpace: createTextNode(createHairSpace()),
|
|
10
|
+
result: createTextNode(urn),
|
|
11
|
+
afterSpace: after != null ? createTextNode(createNoBreakSpace()) : undefined,
|
|
12
|
+
after: after != null ? createTextNode(after) : undefined,
|
|
13
|
+
};
|
|
9
14
|
};
|
|
10
|
-
export const
|
|
11
|
-
|
|
15
|
+
export const getNodesForSearchResultReplacement = (replacement) => {
|
|
16
|
+
const keys = Object.keys(replacement);
|
|
17
|
+
return keys
|
|
18
|
+
.map((key) => replacement[key])
|
|
19
|
+
.filter((node) => node != null);
|
|
12
20
|
};
|
|
13
|
-
|
|
14
|
-
|
|
21
|
+
/**
|
|
22
|
+
* We leverage a couple unique spaces to represent mentions, allowing for
|
|
23
|
+
* correct cursor movement when using arrow keys. As these characters are
|
|
24
|
+
* purely for functional behavior of the input, `trimNonstandardSpaces`
|
|
25
|
+
* will remove them so the input is suitable for emitting.
|
|
26
|
+
*
|
|
27
|
+
* U+200A is a "Hair Space" which acts as a space, but is not visually
|
|
28
|
+
* represented as one.
|
|
29
|
+
*
|
|
30
|
+
* U+00A0 is a "No-Break Space" which is commonly added by browsers
|
|
31
|
+
* when interacting with a contenteditable element.
|
|
32
|
+
*/
|
|
33
|
+
export const trimNonstandardSpaces = (text) => {
|
|
34
|
+
return text.replace(/[\u200A]/g, '').replace(/[\u00A0]/g, ' ');
|
|
15
35
|
};
|
|
16
|
-
|
|
17
|
-
return
|
|
36
|
+
const createHairSpace = () => {
|
|
37
|
+
return String.fromCharCode(8202);
|
|
18
38
|
};
|
|
19
|
-
|
|
20
|
-
return
|
|
39
|
+
const createNoBreakSpace = () => {
|
|
40
|
+
return String.fromCharCode(160);
|
|
21
41
|
};
|
|
@@ -11,15 +11,6 @@
|
|
|
11
11
|
line-height: 1.4;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
.test-mention {
|
|
15
|
-
display: inline-block;
|
|
16
|
-
color: blue;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.hidden {
|
|
20
|
-
visibility: hidden;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
14
|
.content-input {
|
|
24
15
|
width: 100%;
|
|
25
16
|
box-sizing: border-box;
|
|
@@ -33,13 +24,6 @@
|
|
|
33
24
|
white-space: pre-line;
|
|
34
25
|
}
|
|
35
26
|
|
|
36
|
-
.textarea {
|
|
37
|
-
overflow: hidden;
|
|
38
|
-
outline: none;
|
|
39
|
-
box-shadow: none;
|
|
40
|
-
resize: none;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
27
|
.content-input:focus {
|
|
44
28
|
outline: none;
|
|
45
29
|
}
|