tecitheme 1.2.3 → 1.2.4
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/StyleUtils.js
CHANGED
|
@@ -12,8 +12,8 @@ export function humanizeProduct(product) {
|
|
|
12
12
|
return "License Manager";
|
|
13
13
|
case "usage":
|
|
14
14
|
return "Usage (Internal)"
|
|
15
|
-
case "
|
|
16
|
-
return "
|
|
15
|
+
case "purchasing-licensing":
|
|
16
|
+
return "Purchasing, Licensing, & Support";
|
|
17
17
|
default:
|
|
18
18
|
return product;
|
|
19
19
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { getModalStore } from "@skeletonlabs/skeleton";
|
|
3
3
|
|
|
4
|
-
export let id, placeholder, placeholderShort, filters, title, indices;
|
|
4
|
+
export let id, placeholder, placeholderShort, filters, title, indices, keyCombo;
|
|
5
5
|
export let showRefinements = undefined;
|
|
6
6
|
|
|
7
|
+
// Let users specify a key combo using Javascript key names, or default to Ctrl+K
|
|
8
|
+
keyCombo = keyCombo ? keyCombo : ["Control", "k"]
|
|
9
|
+
|
|
7
10
|
const modalStore = getModalStore();
|
|
8
11
|
|
|
9
12
|
const modal = {
|
|
@@ -35,28 +38,48 @@
|
|
|
35
38
|
modalStore.trigger(modal)
|
|
36
39
|
};
|
|
37
40
|
|
|
38
|
-
|
|
39
|
-
let
|
|
40
|
-
|
|
41
|
+
// Fill an array to track which keys of the assigned combo have been pressed
|
|
42
|
+
let keysPressed = Array(keyCombo.length).fill(false);
|
|
41
43
|
function onKeyMove(e, value)
|
|
42
44
|
{
|
|
43
|
-
|
|
45
|
+
// If a combo key is pressed or released, track that state
|
|
46
|
+
if (keyCombo.includes(e.key))
|
|
44
47
|
{
|
|
45
|
-
|
|
46
|
-
isCtrlDown = value;
|
|
47
|
-
break;
|
|
48
|
-
case "k":
|
|
49
|
-
isKDown = value;
|
|
50
|
-
break;
|
|
48
|
+
keysPressed[keyCombo.indexOf(e.key)] = value;
|
|
51
49
|
}
|
|
50
|
+
|
|
51
|
+
// Check that every combo key is currently pressed
|
|
52
|
+
const comboMatch = keysPressed.every(v => v === true);
|
|
52
53
|
|
|
53
|
-
|
|
54
|
+
// If combo is pressed and modal isn't open, open the modal
|
|
55
|
+
if (comboMatch && !isModalOpen)
|
|
54
56
|
{
|
|
55
57
|
triggerSearch()
|
|
56
58
|
e.preventDefault();
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
|
|
62
|
+
// Clean up the key combo names for display in the UI.
|
|
63
|
+
// This isn't exhaustive, and may need updated in the future to account for other keys
|
|
64
|
+
let keyComboDisplayValues = []
|
|
65
|
+
function createKeyDisplayValue(key)
|
|
66
|
+
{
|
|
67
|
+
switch (key)
|
|
68
|
+
{
|
|
69
|
+
case "Control":
|
|
70
|
+
return "Ctrl";
|
|
71
|
+
case "Escape":
|
|
72
|
+
return "Esc";
|
|
73
|
+
case "LShift":
|
|
74
|
+
return "LShift";
|
|
75
|
+
case "RShift":
|
|
76
|
+
return "RShift";
|
|
77
|
+
default:
|
|
78
|
+
return key.toUpperCase();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
keyComboDisplayValues = keyCombo.map(key => createKeyDisplayValue(key));
|
|
82
|
+
|
|
60
83
|
</script>
|
|
61
84
|
|
|
62
85
|
<svelte:window
|
|
@@ -71,5 +94,5 @@
|
|
|
71
94
|
<span class="hidden md:flex">{placeholder}</span>
|
|
72
95
|
<span class="flex md:hidden">{placeholderShort}</span>
|
|
73
96
|
<div class="hidden md:flex flex-grow"></div>
|
|
74
|
-
<span class="hidden md:flex">
|
|
97
|
+
<span class="hidden md:flex">{keyComboDisplayValues.join("+")}</span>
|
|
75
98
|
</button>
|
|
@@ -8,6 +8,7 @@ export default class SearchBar extends SvelteComponent<{
|
|
|
8
8
|
placeholderShort: any;
|
|
9
9
|
filters: any;
|
|
10
10
|
indices: any;
|
|
11
|
+
keyCombo: any;
|
|
11
12
|
showRefinements?: any;
|
|
12
13
|
}, {
|
|
13
14
|
[evt: string]: CustomEvent<any>;
|
|
@@ -25,6 +26,7 @@ declare const __propDef: {
|
|
|
25
26
|
placeholderShort: any;
|
|
26
27
|
filters: any;
|
|
27
28
|
indices: any;
|
|
29
|
+
keyCombo: any;
|
|
28
30
|
showRefinements?: any;
|
|
29
31
|
};
|
|
30
32
|
events: {
|
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import { debounce } from "instantsearch.js/es/lib/utils";
|
|
2
3
|
import { SearchBox } from "svelte-algolia-instantsearch";
|
|
3
4
|
|
|
4
5
|
export let placeholder;
|
|
5
6
|
export let placeholderShort;
|
|
7
|
+
|
|
8
|
+
// Just debounces searches by 300ms. Almost not noticeable to users, but should clean up our query analytics
|
|
9
|
+
const debouncedRefine = debounce((refine, query) =>
|
|
10
|
+
{
|
|
11
|
+
refine(query);
|
|
12
|
+
}, 300);
|
|
13
|
+
|
|
14
|
+
// Hook to use the debounced refinement
|
|
15
|
+
function queryHook(query, refine)
|
|
16
|
+
{
|
|
17
|
+
debouncedRefine(refine, query);
|
|
18
|
+
}
|
|
6
19
|
</script>
|
|
7
20
|
|
|
8
21
|
<SearchBox
|
|
22
|
+
{queryHook}
|
|
23
|
+
{placeholder}
|
|
9
24
|
classes={{
|
|
10
25
|
root: "hidden md:flex w-full",
|
|
11
26
|
form: "w-full relative",
|
|
@@ -14,10 +29,11 @@
|
|
|
14
29
|
submitIcon: "w-3 h-3",
|
|
15
30
|
reset: "absolute hidden right-0 top-0 w-0 h-0"
|
|
16
31
|
}}
|
|
17
|
-
placeholder={placeholder}
|
|
18
32
|
/>
|
|
19
33
|
|
|
20
34
|
<SearchBox
|
|
35
|
+
{queryHook}
|
|
36
|
+
placeholder={placeholderShort}
|
|
21
37
|
classes={{
|
|
22
38
|
root: "flex md:hidden w-full",
|
|
23
39
|
form: "w-full relative",
|
|
@@ -25,5 +41,4 @@
|
|
|
25
41
|
submit: "absolute left-0 top-1/2 w-6 h-6 -translate-y-1/2 translate-x-1/2",
|
|
26
42
|
reset: "absolute hidden right-0 top-0 w-0 h-0"
|
|
27
43
|
}}
|
|
28
|
-
placeholder={placeholderShort}
|
|
29
44
|
/>
|