@vertexvis/ui 0.1.0-testing.4 → 0.1.0-testing.5

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 (82) hide show
  1. package/dist/cjs/components.cjs.js +1 -1
  2. package/dist/cjs/index.cjs.js +6 -6
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/{popover-d9ec8e10.js → popover-942209b8.js} +23 -1
  5. package/dist/cjs/{result-list-1e592c3c.js → result-list-241ffe8d.js} +46 -2
  6. package/dist/cjs/search-bar-a321b3e1.js +353 -0
  7. package/dist/cjs/{select-0eb7203f.js → select-5f8aecfe.js} +27 -4
  8. package/dist/cjs/{text-field-0397fb34.js → text-field-bccbde1f.js} +1 -0
  9. package/dist/cjs/{tooltip-02e24a48.js → tooltip-e9f63631.js} +58 -19
  10. package/dist/cjs/vertex-popover.cjs.entry.js +1 -1
  11. package/dist/cjs/vertex-result-list.cjs.entry.js +1 -1
  12. package/dist/cjs/vertex-search-bar.cjs.entry.js +1 -1
  13. package/dist/cjs/vertex-select.cjs.entry.js +1 -1
  14. package/dist/cjs/vertex-textfield.cjs.entry.js +1 -1
  15. package/dist/cjs/vertex-tooltip.cjs.entry.js +1 -1
  16. package/dist/collection/components/menu/menu.js +1 -1
  17. package/dist/collection/components/popover/popover.js +51 -0
  18. package/dist/collection/components/result-list/result-list.js +47 -3
  19. package/dist/collection/components/search-bar/dom.js +12 -0
  20. package/dist/collection/components/search-bar/lib.js +23 -15
  21. package/dist/collection/components/search-bar/search-bar.css +2 -29
  22. package/dist/collection/components/search-bar/search-bar.js +352 -326
  23. package/dist/collection/components/select/select.css +16 -0
  24. package/dist/collection/components/select/select.js +49 -2
  25. package/dist/collection/components/text-field/text-field.js +1 -0
  26. package/dist/collection/components/tooltip/tooltip.css +0 -4
  27. package/dist/collection/components/tooltip/tooltip.js +62 -18
  28. package/dist/collection/util/templates/element-pool.js +19 -1
  29. package/dist/components/components.css +1 -1
  30. package/dist/components/components.esm.js +1 -1
  31. package/dist/components/index.esm.js +1 -1
  32. package/dist/components/p-0b1cdc8a.entry.js +1 -0
  33. package/dist/components/p-406e73da.entry.js +1 -0
  34. package/dist/components/p-43b1b3f9.js +1 -0
  35. package/dist/components/p-606596de.entry.js +1 -0
  36. package/dist/components/p-6b862967.js +1 -0
  37. package/dist/components/p-7cfb3736.entry.js +1 -0
  38. package/dist/components/p-912f6e24.js +1 -0
  39. package/dist/components/p-92930f2a.js +1 -0
  40. package/dist/components/p-c2706288.js +1 -0
  41. package/dist/components/p-c4518377.entry.js +1 -0
  42. package/dist/components/p-ee496965.entry.js +1 -0
  43. package/dist/components/p-f064f911.js +1 -0
  44. package/dist/esm/components.js +1 -1
  45. package/dist/esm/index.js +6 -6
  46. package/dist/esm/loader.js +1 -1
  47. package/dist/esm/{popover-67c88e4b.js → popover-6e806354.js} +23 -1
  48. package/dist/esm/{result-list-36cfb08a.js → result-list-16c6afbd.js} +46 -2
  49. package/dist/esm/search-bar-6fad2f2e.js +351 -0
  50. package/dist/esm/{select-75ed5653.js → select-d4e135b7.js} +27 -4
  51. package/dist/esm/{text-field-e542da25.js → text-field-32ac877e.js} +1 -0
  52. package/dist/esm/{tooltip-b4d2a889.js → tooltip-933da261.js} +58 -19
  53. package/dist/esm/vertex-popover.entry.js +1 -1
  54. package/dist/esm/vertex-result-list.entry.js +1 -1
  55. package/dist/esm/vertex-search-bar.entry.js +1 -1
  56. package/dist/esm/vertex-select.entry.js +1 -1
  57. package/dist/esm/vertex-textfield.entry.js +1 -1
  58. package/dist/esm/vertex-tooltip.entry.js +1 -1
  59. package/dist/types/components/popover/popover.d.ts +7 -0
  60. package/dist/types/components/result-list/result-list.d.ts +9 -1
  61. package/dist/types/components/search-bar/dom.d.ts +3 -0
  62. package/dist/types/components/search-bar/lib.d.ts +12 -6
  63. package/dist/types/components/search-bar/search-bar.d.ts +98 -41
  64. package/dist/types/components/select/select.d.ts +8 -0
  65. package/dist/types/components/tooltip/tooltip.d.ts +7 -0
  66. package/dist/types/components.d.ts +81 -16
  67. package/dist/types/util/templates/element-pool.d.ts +10 -1
  68. package/package.json +2 -2
  69. package/dist/cjs/search-bar-bb40cfa7.js +0 -290
  70. package/dist/components/p-19318fee.entry.js +0 -1
  71. package/dist/components/p-209db2ba.entry.js +0 -1
  72. package/dist/components/p-2bb3b235.js +0 -1
  73. package/dist/components/p-4224c2ad.js +0 -1
  74. package/dist/components/p-52739247.js +0 -1
  75. package/dist/components/p-552c128f.js +0 -1
  76. package/dist/components/p-6505cdb3.js +0 -1
  77. package/dist/components/p-ae6a3c46.entry.js +0 -1
  78. package/dist/components/p-bd11e7d1.js +0 -1
  79. package/dist/components/p-c8dd68a1.entry.js +0 -1
  80. package/dist/components/p-e576818b.entry.js +0 -1
  81. package/dist/components/p-ebabee40.entry.js +0 -1
  82. package/dist/esm/search-bar-59cc151d.js +0 -288
@@ -1,7 +1,10 @@
1
1
  import { EventEmitter, h } from '../../stencil-public-runtime';
2
2
  import { Point } from '../../types/point';
3
3
  import { PopoverPlacement } from '../popover/popover';
4
- export type Result = Record<string, unknown>;
4
+ export type Result = {
5
+ id: string;
6
+ type: string;
7
+ } & Record<string, unknown>;
5
8
  export declare class ResultList {
6
9
  items: Result[];
7
10
  itemsJson?: string;
@@ -20,9 +23,11 @@ export declare class ResultList {
20
23
  private lastFocusedIndex;
21
24
  private stateMap;
22
25
  private hostEl;
26
+ private resultClick;
23
27
  private resizeObserver;
24
28
  private computedResultHeight?;
25
29
  private resultsScrollEl?;
30
+ constructor();
26
31
  handleResultsChanged(results: Array<Result> | string | undefined): void;
27
32
  handleOpenChanged(): void;
28
33
  protected componentWillLoad(): void;
@@ -35,7 +40,10 @@ export declare class ResultList {
35
40
  private ensureTemplateDefined;
36
41
  private createResultPool;
37
42
  private createResultInstance;
43
+ private createResultHandlers;
38
44
  private layoutResults;
45
+ private handlePointerDown;
46
+ private handleResultClick;
39
47
  private computeViewportResults;
40
48
  private getListHeight;
41
49
  private handleScroll;
@@ -0,0 +1,3 @@
1
+ export declare const getWindowSelection: () => Selection | undefined | null;
2
+ export declare const createDocumentRange: () => Range;
3
+ export declare const createTextNode: (text?: string) => Text;
@@ -1,6 +1,12 @@
1
- export declare const getWindowSelection: () => Selection | undefined | null;
2
- export declare const createDocumentRange: () => Range;
3
- export declare const isTextNode: (node: Node) => node is Text;
4
- export declare const isHtmlElement: (target: EventTarget) => target is HTMLElement;
5
- export declare const isReplacedElement: (el?: HTMLElement | null) => el is HTMLElement;
6
- export declare const createTextNode: (text?: string) => Text;
1
+ import { Result } from '../result-list/result-list';
2
+ export interface SearchResultReplacement {
3
+ before: Text;
4
+ beforeSpace: Text;
5
+ result: Text;
6
+ afterSpace?: Text;
7
+ after?: Text;
8
+ }
9
+ export declare const createResultUrn: (result: Result) => string;
10
+ export declare const createSearchResultReplacement: (result: Result, before: string, after?: string) => SearchResultReplacement;
11
+ export declare const getNodesForSearchResultReplacement: (replacement: SearchResultReplacement) => Text[];
12
+ export declare const trimNonstandardSpaces: (text: string) => string;
@@ -3,65 +3,122 @@ import { PopoverPlacement } from '../popover/popover';
3
3
  import { Result } from '../result-list/result-list';
4
4
  export type SearchBarVariant = 'standard' | 'filled' | 'underlined' | 'blank';
5
5
  export declare class SearchBar {
6
+ /**
7
+ * The search bar variant to display.
8
+ *
9
+ * Possible options are:
10
+ * - 'standard' (default)
11
+ * - 'filled'
12
+ * - 'underlined'
13
+ * - 'blank
14
+ */
6
15
  variant: SearchBarVariant;
7
- resultItems?: Result[];
8
- triggerCharacters: string[];
9
- triggerCharacter?: string;
16
+ /**
17
+ * Whether this search bar is disabled.
18
+ */
19
+ disabled: boolean;
20
+ /**
21
+ * The character indicating that we should trigger a search.
22
+ *
23
+ * When this character is encountered, the text following it
24
+ * (omitting `breakCharacters`) will be emitted as a `searchChanged`
25
+ * event.
26
+ */
27
+ triggerCharacter: string;
28
+ /**
29
+ * Characters that should trigger a "break" of the search. If
30
+ * a value in this list is encountered when trying to parse back
31
+ * to the `triggerCharacter`, this will hide the result list.
32
+ */
10
33
  breakCharacters: string[];
11
- debounce: number;
12
34
  /**
13
- * Placeholder for text input.
35
+ * The items to display in this search bar's `<vertex-result-list>`.
36
+ *
37
+ * This can be used alongside the `searchChanged` event to query for
38
+ * results to display.
39
+ */
40
+ resultItems?: Result[];
41
+ /**
42
+ * The placement of the result list for this search bar.
43
+ *
44
+ * Corresponds to the value for the underlying <vertex-popover>
45
+ * placement value.
46
+ * @see(PopoverPlacement)
14
47
  */
15
- placeholder?: string;
16
48
  placement: PopoverPlacement;
17
- triggerCharacterPressed: EventEmitter<string>;
18
- private cursorPosition?;
19
- private open;
20
- private triggerKey?;
21
- private triggerRange?;
22
- private hostEl;
23
49
  /**
24
- * Emitted when the value has changed.
50
+ * The initial value of this search bar. This will be used in
51
+ * combination with the value of `replacements` to display existing
52
+ * replaced values.
25
53
  */
26
- valueChanged: EventEmitter<void>;
54
+ value?: string;
27
55
  /**
28
- * Emitted when input focused
56
+ * A placeholder to display when no text has been entered.
29
57
  */
30
- inputFocus: EventEmitter<FocusEvent>;
58
+ placeholder?: string;
31
59
  /**
32
- * Emitted when input blurred
60
+ * Replaced result values. This will be used in combination with the
61
+ * value of `value` to display existing replaced values.
62
+ *
63
+ * This value will be automatically updated as `Result`s are clicked
64
+ * within this search bar's `<vertex-result-list>`.
33
65
  */
34
- inputBlur: EventEmitter<FocusEvent>;
66
+ replacements: Result[];
67
+ /**
68
+ * Emitted when the value of the current search triggered by
69
+ * the specified `triggerCharacter` has changed.
70
+ */
71
+ searchChanged: EventEmitter<string>;
72
+ /**
73
+ * Emitted when the value of the input has changed.
74
+ */
75
+ inputChanged: EventEmitter<string>;
76
+ /**
77
+ * Emitted when a result has been selected to replace the trigger text.
78
+ *
79
+ * Includes the ID of the `Result` selected.
80
+ */
81
+ resultReplaced: EventEmitter<Result>;
82
+ /**
83
+ * Emitted when the input is focused.
84
+ */
85
+ inputFocus: EventEmitter<FocusEvent>;
35
86
  /**
36
- * Emitted when enter is pressed an a result is highlighted.
87
+ * Emitted when the input is blurred.
37
88
  */
38
- resultsEnterPressed: EventEmitter<Result>;
89
+ inputBlur: EventEmitter<FocusEvent>;
90
+ private hostEl;
91
+ private cursorPosition;
92
+ private displayedElements;
93
+ private hasTriggered;
39
94
  private contentEl?;
40
- private triggerTimeout?;
41
- protected componentWillLoad(): void;
95
+ private triggeredElement?;
96
+ private triggeredRange?;
97
+ private rawElements;
98
+ private lastReplacedSpace?;
99
+ constructor();
100
+ protected componentDidLoad(): void;
101
+ protected connectedCallback(): void;
42
102
  protected disconnectedCallback(): void;
43
- replaceTriggeredValue(data: Record<string, unknown>): Promise<void>;
44
- getEditableContent(): Promise<NodeListOf<ChildNode> | undefined>;
103
+ protected replaceContent(newValue?: string, oldValue?: string): void;
104
+ protected updateContent(): void;
45
105
  render(): h.JSX.IntrinsicElements;
46
106
  private handleKeyDown;
47
107
  private handleKeyUp;
48
- private updateTriggerValue;
49
- private triggerText;
50
- private restartTriggerInput;
51
- private clearTriggerTimeout;
52
- private updateCursorPosition;
53
- private moveCursorToNodeEnd;
54
- private updateInputCursorPosition;
55
- private createReplacedElement;
56
- private handleSelectionChange;
57
- private getSelectionSubstring;
58
- private insertAdjacentTextNode;
59
- private updateTriggerState;
60
- private updateTriggerRange;
61
- private clearTriggerState;
62
- private lastIndexOfBreakCharacter;
108
+ private handleInput;
109
+ private handleClick;
110
+ private handleWindowClick;
63
111
  private handleFocus;
64
112
  private handleBlur;
65
- private handleInputPointerEvent;
66
- private handleResultPointerDown;
113
+ private handleResultClick;
114
+ private isIdenticalElement;
115
+ private getTextContent;
116
+ private getCursorPosition;
117
+ private handleCursorPositionUpdate;
118
+ private readTriggerValue;
119
+ private includesBreakCharacter;
120
+ private firstIndexOfBreakCharacter;
121
+ private moveCursorToNodeEnd;
122
+ private getContentAsString;
123
+ private createReplacedElement;
67
124
  }
@@ -24,6 +24,11 @@ export declare class Select {
24
24
  * or closing.
25
25
  */
26
26
  animated: boolean;
27
+ /**
28
+ * Whether this select will omit the currently selected
29
+ * value in the dropdown list.
30
+ */
31
+ hideSelected: boolean;
27
32
  /**
28
33
  * Emitted when the selected option of this element
29
34
  * changes, and contains the value that it has been
@@ -51,10 +56,13 @@ export declare class Select {
51
56
  connectedCallback(): void;
52
57
  disconnectedCallback(): void;
53
58
  handleUpdateValue(value?: string): void;
59
+ protected handleUpdateDisplayValue(): void;
54
60
  render(): h.JSX.IntrinsicElements;
55
61
  private handleOpen;
56
62
  private handleDismiss;
57
63
  private updateDisplayValue;
58
64
  private removeOptionListeners;
65
+ private clearSelectedOptionFlag;
66
+ private getSelectedOption;
59
67
  private getBounds;
60
68
  }
@@ -40,18 +40,25 @@ export declare class Tooltip {
40
40
  hostElement: HTMLElement;
41
41
  private open;
42
42
  private tooltipId;
43
+ private pointerEntered;
43
44
  private openTimeout?;
44
45
  private targetElement?;
45
46
  private contentElement?;
46
47
  private displayedSlottedContent?;
48
+ private internalContentElement?;
47
49
  constructor();
48
50
  disconnectedCallback(): void;
51
+ protected handleContentChange(): void;
52
+ protected handleDisabledChange(): void;
49
53
  render(): h.JSX.IntrinsicElements;
50
54
  private addElement;
51
55
  private removeElement;
52
56
  private createPopoverElement;
53
57
  private createContentElement;
58
+ private updateContentElementClass;
59
+ private updateContentElementChildren;
54
60
  private handlePointerEnter;
55
61
  private handlePointerLeave;
62
+ private createOpenTimeout;
56
63
  private clearOpenTimeout;
57
64
  }
@@ -470,6 +470,9 @@ export namespace Components {
470
470
  * The behavior that this popover will have when the window is resized. Can be either 'dynamic' or 'fixed', and defaults to 'dynamic'. 'dynamic' will cause a position-based popover to adjust its position relative to the window resize to keep it in the same relative position. 'fixed' will keep the popover in the same position even if that means it would disappear off-screen.
471
471
  */
472
472
  "resizeBehavior": PopoverResizeBehavior;
473
+ "resizeObserverFactory": (
474
+ cb: (entries: ResizeObserverEntry[]) => void
475
+ ) => ResizeObserver;
473
476
  /**
474
477
  * Indicates if the position of the popover should be updated when the popover's content size changes.
475
478
  */
@@ -569,18 +572,42 @@ export namespace Components {
569
572
  "viewportStartIndex": number;
570
573
  }
571
574
  interface VertexSearchBar {
575
+ /**
576
+ * Characters that should trigger a "break" of the search. If a value in this list is encountered when trying to parse back to the `triggerCharacter`, this will hide the result list.
577
+ */
572
578
  "breakCharacters": string[];
573
- "debounce": number;
574
- "getEditableContent": () => Promise<NodeListOf<ChildNode> | undefined>;
575
579
  /**
576
- * Placeholder for text input.
580
+ * Whether this search bar is disabled.
581
+ */
582
+ "disabled": boolean;
583
+ /**
584
+ * A placeholder to display when no text has been entered.
577
585
  */
578
586
  "placeholder"?: string;
587
+ /**
588
+ * The placement of the result list for this search bar. Corresponds to the value for the underlying <vertex-popover> placement value.
589
+ * @see (PopoverPlacement)
590
+ */
579
591
  "placement": PopoverPlacement;
580
- "replaceTriggeredValue": (data: Record<string, unknown>) => Promise<void>;
592
+ /**
593
+ * Replaced result values. This will be used in combination with the value of `value` to display existing replaced values. This value will be automatically updated as `Result`s are clicked within this search bar's `<vertex-result-list>`.
594
+ */
595
+ "replacements": Result1[];
596
+ /**
597
+ * The items to display in this search bar's `<vertex-result-list>`. This can be used alongside the `searchChanged` event to query for results to display.
598
+ */
581
599
  "resultItems"?: Result1[];
582
- "triggerCharacter"?: string;
583
- "triggerCharacters": string[];
600
+ /**
601
+ * The character indicating that we should trigger a search. When this character is encountered, the text following it (omitting `breakCharacters`) will be emitted as a `searchChanged` event.
602
+ */
603
+ "triggerCharacter": string;
604
+ /**
605
+ * The initial value of this search bar. This will be used in combination with the value of `replacements` to display existing replaced values.
606
+ */
607
+ "value"?: string;
608
+ /**
609
+ * The search bar variant to display. Possible options are: - 'standard' (default) - 'filled' - 'underlined' - 'blank
610
+ */
584
611
  "variant": SearchBarVariant;
585
612
  }
586
613
  interface VertexSelect {
@@ -592,6 +619,10 @@ export namespace Components {
592
619
  * Whether this select is disabled.
593
620
  */
594
621
  "disabled": boolean;
622
+ /**
623
+ * Whether this select will omit the currently selected value in the dropdown list.
624
+ */
625
+ "hideSelected": boolean;
595
626
  /**
596
627
  * A placeholder to use when no option has been selected. Defaults to "Select an option...".
597
628
  */
@@ -1760,6 +1791,7 @@ declare namespace LocalJSX {
1760
1791
  "items"?: Result[];
1761
1792
  "itemsJson"?: string;
1762
1793
  "onEnterPressed"?: (event: VertexResultListCustomEvent<Result>) => void;
1794
+ "onResultClick"?: (event: VertexResultListCustomEvent<Result>) => void;
1763
1795
  "open"?: boolean;
1764
1796
  "overScanCount"?: number;
1765
1797
  "placement"?: PopoverPlacement;
@@ -1769,33 +1801,62 @@ declare namespace LocalJSX {
1769
1801
  "viewportStartIndex"?: number;
1770
1802
  }
1771
1803
  interface VertexSearchBar {
1804
+ /**
1805
+ * Characters that should trigger a "break" of the search. If a value in this list is encountered when trying to parse back to the `triggerCharacter`, this will hide the result list.
1806
+ */
1772
1807
  "breakCharacters"?: string[];
1773
- "debounce"?: number;
1774
1808
  /**
1775
- * Emitted when input blurred
1809
+ * Whether this search bar is disabled.
1810
+ */
1811
+ "disabled"?: boolean;
1812
+ /**
1813
+ * Emitted when the input is blurred.
1776
1814
  */
1777
1815
  "onInputBlur"?: (event: VertexSearchBarCustomEvent<FocusEvent>) => void;
1778
1816
  /**
1779
- * Emitted when input focused
1817
+ * Emitted when the value of the input has changed.
1818
+ */
1819
+ "onInputChanged"?: (event: VertexSearchBarCustomEvent<string>) => void;
1820
+ /**
1821
+ * Emitted when the input is focused.
1780
1822
  */
1781
1823
  "onInputFocus"?: (event: VertexSearchBarCustomEvent<FocusEvent>) => void;
1782
1824
  /**
1783
- * Emitted when enter is pressed an a result is highlighted.
1825
+ * Emitted when a result has been selected to replace the trigger text. Includes the ID of the `Result` selected.
1784
1826
  */
1785
- "onResultsEnterPressed"?: (event: VertexSearchBarCustomEvent<Result1>) => void;
1786
- "onTriggerCharacterPressed"?: (event: VertexSearchBarCustomEvent<string>) => void;
1827
+ "onResultReplaced"?: (event: VertexSearchBarCustomEvent<Result1>) => void;
1787
1828
  /**
1788
- * Emitted when the value has changed.
1829
+ * Emitted when the value of the current search triggered by the specified `triggerCharacter` has changed.
1789
1830
  */
1790
- "onValueChanged"?: (event: VertexSearchBarCustomEvent<void>) => void;
1831
+ "onSearchChanged"?: (event: VertexSearchBarCustomEvent<string>) => void;
1791
1832
  /**
1792
- * Placeholder for text input.
1833
+ * A placeholder to display when no text has been entered.
1793
1834
  */
1794
1835
  "placeholder"?: string;
1836
+ /**
1837
+ * The placement of the result list for this search bar. Corresponds to the value for the underlying <vertex-popover> placement value.
1838
+ * @see (PopoverPlacement)
1839
+ */
1795
1840
  "placement"?: PopoverPlacement;
1841
+ /**
1842
+ * Replaced result values. This will be used in combination with the value of `value` to display existing replaced values. This value will be automatically updated as `Result`s are clicked within this search bar's `<vertex-result-list>`.
1843
+ */
1844
+ "replacements"?: Result1[];
1845
+ /**
1846
+ * The items to display in this search bar's `<vertex-result-list>`. This can be used alongside the `searchChanged` event to query for results to display.
1847
+ */
1796
1848
  "resultItems"?: Result1[];
1849
+ /**
1850
+ * The character indicating that we should trigger a search. When this character is encountered, the text following it (omitting `breakCharacters`) will be emitted as a `searchChanged` event.
1851
+ */
1797
1852
  "triggerCharacter"?: string;
1798
- "triggerCharacters"?: string[];
1853
+ /**
1854
+ * The initial value of this search bar. This will be used in combination with the value of `replacements` to display existing replaced values.
1855
+ */
1856
+ "value"?: string;
1857
+ /**
1858
+ * The search bar variant to display. Possible options are: - 'standard' (default) - 'filled' - 'underlined' - 'blank
1859
+ */
1799
1860
  "variant"?: SearchBarVariant;
1800
1861
  }
1801
1862
  interface VertexSelect {
@@ -1807,6 +1868,10 @@ declare namespace LocalJSX {
1807
1868
  * Whether this select is disabled.
1808
1869
  */
1809
1870
  "disabled"?: boolean;
1871
+ /**
1872
+ * Whether this select will omit the currently selected value in the dropdown list.
1873
+ */
1874
+ "hideSelected"?: boolean;
1810
1875
  /**
1811
1876
  * Emitted when the selected option of this element changes, and contains the value that it has been changed to.
1812
1877
  */
@@ -1,12 +1,19 @@
1
1
  import { Binding } from './binding';
2
2
  import { InstancedTemplate } from './templates';
3
3
  export type ElementFactory = () => InstancedTemplate<HTMLElement>;
4
+ export interface EventHandlerDescriptor {
5
+ type: string;
6
+ handler: (event: any) => void;
7
+ }
8
+ export type EventHandlerFactory = (element: HTMLElement) => EventHandlerDescriptor[];
4
9
  export declare class ElementPool {
5
10
  private container;
6
11
  private elementFactory;
12
+ private eventHandlerFactory?;
7
13
  private readonly elements;
8
14
  private instanceMap;
9
- constructor(container: Element, elementFactory: ElementFactory);
15
+ private handlerMap;
16
+ constructor(container: Element, elementFactory: ElementFactory, eventHandlerFactory?: EventHandlerFactory | undefined);
10
17
  swapHeadToTail(count: number): HTMLElement[];
11
18
  swapTailToHead(count: number): HTMLElement[];
12
19
  updateElements(count: number): HTMLElement[];
@@ -14,5 +21,7 @@ export declare class ElementPool {
14
21
  updateElementFactory(elementFactory: ElementFactory): void;
15
22
  iterateElements(f: (element: HTMLElement, binding: Binding, index: number) => void): void;
16
23
  private createElement;
24
+ private addEventListeners;
17
25
  private deleteElement;
26
+ private removeEventListeners;
18
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertexvis/ui",
3
- "version": "0.1.0-testing.4",
3
+ "version": "0.1.0-testing.5",
4
4
  "description": "The Vertex UI component library.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -86,5 +86,5 @@
86
86
  "@floating-ui/dom": "^1.6.5",
87
87
  "@vertexvis/utils": "^0.21.0"
88
88
  },
89
- "gitHead": "4805247439f97482ac5ea8d7ca04b567a4581ed9"
89
+ "gitHead": "8013122df0b6a3d4a6def2e30f5084b12e520ea7"
90
90
  }