tecitheme 1.2.2 → 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.
@@ -12,8 +12,8 @@ export function humanizeProduct(product) {
12
12
  return "License Manager";
13
13
  case "usage":
14
14
  return "Usage (Internal)"
15
- case "sales-licensing":
16
- return "Sales & Licensing";
15
+ case "purchasing-licensing":
16
+ return "Purchasing, Licensing, & Support";
17
17
  default:
18
18
  return product;
19
19
  }
@@ -489,6 +489,7 @@
489
489
  placeholderShort="Search"
490
490
  indices={[searchIndex]}
491
491
  title=""
492
+ keyCombo={["Control", "y"]}
492
493
  />
493
494
  </div>
494
495
  </div>
@@ -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
- let isCtrlDown = false;
39
- let isKDown = false;
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
- switch(e.key)
45
+ // If a combo key is pressed or released, track that state
46
+ if (keyCombo.includes(e.key))
44
47
  {
45
- case "Control":
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
- if (isCtrlDown && isKDown && !isModalOpen)
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">Ctrl+K</span>
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
  />
package/dist/utils.d.ts CHANGED
@@ -46,6 +46,7 @@ export function makeIdString(text: any): string;
46
46
  * Converts a simplified image source string in to the proper TECi Image src. If imageSrc is an absolute url (starts with http) it is returned unchanged
47
47
  * @param {*} imageSrc The image source string
48
48
  * @param {*} site ('www' or 'support') TECi image folder to pull from
49
+ * @param {*} params A list of image transformation parameters to pass to the image CDN (https://developers.cloudflare.com/images/transform-images/transform-via-url/)
49
50
  */
50
51
  export function getTeciImageURL(imageSrc: any, site: any, params: any): any;
51
52
  /**
package/dist/utils.js CHANGED
@@ -526,12 +526,18 @@ export function makeIdString(text) {
526
526
  * Converts a simplified image source string in to the proper TECi Image src. If imageSrc is an absolute url (starts with http) it is returned unchanged
527
527
  * @param {*} imageSrc The image source string
528
528
  * @param {*} site ('www' or 'support') TECi image folder to pull from
529
+ * @param {*} params A list of image transformation parameters to pass to the image CDN (https://developers.cloudflare.com/images/transform-images/transform-via-url/)
529
530
  */
530
531
  export function getTeciImageURL(imageSrc, site = "www", params) {
531
- return imageSrc.startsWith("http") ? imageSrc : `https://media.thunderheadeng.net/cdn-cgi/image/${params??''}/${site}/images/${imageSrc}`
532
+ if (imageSrc.startsWith("http")) {
533
+ return imageSrc
534
+ } else if (imageSrc.includes('.gif')) {
535
+ return imageSrc.startsWith("http") ? imageSrc : `https://media.thunderheadeng.net/${site}/images/${imageSrc}`
536
+ } else {
537
+ return imageSrc.startsWith("http") ? imageSrc : `https://media.thunderheadeng.net/cdn-cgi/image/${params??''}/${site}/images/${imageSrc}`
538
+ }
532
539
  }
533
540
 
534
-
535
541
  /**
536
542
  * Convenience function that sets the state of a Svelte Store to true when an element is visible on the screen. Useful for triggering animations.
537
543
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tecitheme",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "dev": "vite dev",