@molecule/app-search-ui-angular 0.0.0-stage → 1.1.0
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/LICENSE +202 -0
- package/README.md +1274 -2
- package/dist/highlight.component.d.ts +33 -0
- package/dist/highlight.component.d.ts.map +1 -0
- package/dist/highlight.component.js +84 -0
- package/dist/highlight.component.js.map +1 -0
- package/dist/index.d.ts +99 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +99 -0
- package/dist/index.js.map +1 -0
- package/dist/kbd.component.d.ts +28 -0
- package/dist/kbd.component.d.ts.map +1 -0
- package/dist/kbd.component.js +58 -0
- package/dist/kbd.component.js.map +1 -0
- package/dist/quick-search-dialog.component.d.ts +131 -0
- package/dist/quick-search-dialog.component.d.ts.map +1 -0
- package/dist/quick-search-dialog.component.js +297 -0
- package/dist/quick-search-dialog.component.js.map +1 -0
- package/dist/search-box.component.d.ts +266 -0
- package/dist/search-box.component.d.ts.map +1 -0
- package/dist/search-box.component.js +654 -0
- package/dist/search-box.component.js.map +1 -0
- package/dist/search-results.component.d.ts +174 -0
- package/dist/search-results.component.d.ts.map +1 -0
- package/dist/search-results.component.js +519 -0
- package/dist/search-results.component.js.map +1 -0
- package/dist/types.d.ts +172 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +77 -4
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { type AfterViewInit, ElementRef, type SimpleChanges, type TemplateRef } from '@angular/core';
|
|
2
|
+
import type { ClientSearchDocument } from '@molecule/app-client-search';
|
|
3
|
+
import type { UIClassMap } from '@molecule/app-ui';
|
|
4
|
+
import type { SearchResultHit, SearchResultLinkProps, SearchResultsProps, SearchResultView } from './types.js';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* The default row link is a plain anchor; the row body renders through the
|
|
8
|
+
* `rowBody` template. React's root is a FRAGMENT of two nodes (the `<ul>` and
|
|
9
|
+
* a visually hidden status `<p>`, or the empty text `<p>` and the status `<p>`),
|
|
10
|
+
* so the host is unwrapped (`data-parity-unwrap`, `display: contents`) and
|
|
11
|
+
* renders exactly React's root.
|
|
12
|
+
*
|
|
13
|
+
* The ranked hits: title and description with the matched terms marked, the
|
|
14
|
+
* meta line, hover making a row active and warming its page. The whole row is
|
|
15
|
+
* the link, so the list is a plain list of links (no listbox roles: an option's
|
|
16
|
+
* children are presentational and would hide the row's link and action); the
|
|
17
|
+
* active row is marked with `aria-current` on its `<li>` and announced through
|
|
18
|
+
* a polite, visually hidden status region after the list.
|
|
19
|
+
*/
|
|
20
|
+
export declare class SearchResults<T extends ClientSearchDocument = ClientSearchDocument> implements SearchResultsProps<T>, AfterViewInit {
|
|
21
|
+
/** The hits to render. */
|
|
22
|
+
hits: SearchResultHit<T>[];
|
|
23
|
+
/** How a hit renders. */
|
|
24
|
+
view: (doc: T) => SearchResultView;
|
|
25
|
+
/** The keyboard- or pointer-active row, or `-1`. */
|
|
26
|
+
activeIndex: number;
|
|
27
|
+
/** The pointer moved onto a row. */
|
|
28
|
+
onActivate?: (index: number) => void;
|
|
29
|
+
/** A row was chosen (a plain click, or Enter elsewhere). Navigation is the caller's. */
|
|
30
|
+
onOpen: (doc: T) => void;
|
|
31
|
+
/** The person is about to open a row (hover, focus, touch): warm its page. */
|
|
32
|
+
onPrefetch?: (doc: T) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Renders the row's link. Defaults to a plain `<a>`; a `TemplateRef` whose
|
|
35
|
+
* context carries the link props as `$implicit`.
|
|
36
|
+
*/
|
|
37
|
+
renderLink?: TemplateRef<{
|
|
38
|
+
$implicit: SearchResultLinkProps;
|
|
39
|
+
}>;
|
|
40
|
+
/** Something at the row's end (an action button); a `TemplateRef` over the hit's document. */
|
|
41
|
+
action?: TemplateRef<{
|
|
42
|
+
$implicit: T;
|
|
43
|
+
}>;
|
|
44
|
+
/** Shown when there are no hits. */
|
|
45
|
+
emptyText: string;
|
|
46
|
+
/** `data-mol-id` prefix: `<molId>-results`, `-hit`, `-link`, `-related`, `-empty`, `-active`. */
|
|
47
|
+
molId?: string;
|
|
48
|
+
/** Extra classes composed onto the list. */
|
|
49
|
+
className?: string;
|
|
50
|
+
/** The list element, read to keep the active row in view. */
|
|
51
|
+
listEl?: ElementRef<HTMLUListElement>;
|
|
52
|
+
/** The row body template, handed to a custom `renderLink` as its children. */
|
|
53
|
+
rowBodyTpl?: TemplateRef<{
|
|
54
|
+
$implicit: SearchResultHit<T>;
|
|
55
|
+
}>;
|
|
56
|
+
/** i18n handle, read in an injection context. */
|
|
57
|
+
readonly t: (key: string, values?: import("@molecule/app-i18n").InterpolationValues, options?: import("@molecule/app-i18n").TranslateOptions) => string;
|
|
58
|
+
/**
|
|
59
|
+
* The current class map.
|
|
60
|
+
* @returns The UIClassMap.
|
|
61
|
+
*/
|
|
62
|
+
cm(): UIClassMap;
|
|
63
|
+
/**
|
|
64
|
+
* The `data-mol-id` prefix (React's default parameter).
|
|
65
|
+
* @returns The prefix.
|
|
66
|
+
*/
|
|
67
|
+
id(): string;
|
|
68
|
+
/**
|
|
69
|
+
* A hit's view (the caller's `view` over the hit's document).
|
|
70
|
+
*
|
|
71
|
+
* @param hit - The hit.
|
|
72
|
+
* @returns The view.
|
|
73
|
+
*/
|
|
74
|
+
viewOf(hit: SearchResultHit<T>): SearchResultView;
|
|
75
|
+
/**
|
|
76
|
+
* A hit's meta facts (a copy, as React makes).
|
|
77
|
+
*
|
|
78
|
+
* @param hit - The hit.
|
|
79
|
+
* @returns The meta list.
|
|
80
|
+
*/
|
|
81
|
+
metaOf(hit: SearchResultHit<T>): string[];
|
|
82
|
+
/**
|
|
83
|
+
* The context a render template reads: the render function's first argument
|
|
84
|
+
* as and , as the kit's adapter templates declare it.
|
|
85
|
+
*
|
|
86
|
+
* @param arg - The render function's first argument.
|
|
87
|
+
* @returns The template context.
|
|
88
|
+
*/
|
|
89
|
+
renderContext(arg: unknown): Record<string, unknown>;
|
|
90
|
+
/**
|
|
91
|
+
* The list's class list (`cm.resultList` + `className`).
|
|
92
|
+
* @returns The class string.
|
|
93
|
+
*/
|
|
94
|
+
listClasses(): string;
|
|
95
|
+
/**
|
|
96
|
+
* A row's class list (`cm.resultItem`, active when the row is).
|
|
97
|
+
*
|
|
98
|
+
* @param index - The row's index.
|
|
99
|
+
* @returns The class string.
|
|
100
|
+
*/
|
|
101
|
+
itemClasses(index: number): string;
|
|
102
|
+
/**
|
|
103
|
+
* The related badge's text, translated like React renders it.
|
|
104
|
+
* @returns The text.
|
|
105
|
+
*/
|
|
106
|
+
relatedText(): string;
|
|
107
|
+
/**
|
|
108
|
+
* The related badge's tooltip, translated like React renders it.
|
|
109
|
+
* @returns The title text.
|
|
110
|
+
*/
|
|
111
|
+
relatedTitle(): string;
|
|
112
|
+
/**
|
|
113
|
+
* The active row's announcement (title, position, count), empty when no row
|
|
114
|
+
* is keyboard-active, translated like React renders it.
|
|
115
|
+
* @returns The status text.
|
|
116
|
+
*/
|
|
117
|
+
activeText(): string;
|
|
118
|
+
/**
|
|
119
|
+
* A row title's class list (`cm.resultTitle`, monospace when the view asks).
|
|
120
|
+
*
|
|
121
|
+
* @param hit - The hit.
|
|
122
|
+
* @returns The class string.
|
|
123
|
+
*/
|
|
124
|
+
titleClasses(hit: SearchResultHit<T>): string;
|
|
125
|
+
/**
|
|
126
|
+
* The link props one row's link gets. `children` is the row body as a
|
|
127
|
+
* `TemplateRef`: render it with the hit as its `$implicit` context (the
|
|
128
|
+
* ready node a React `renderLink` receives has no Angular equivalent).
|
|
129
|
+
*
|
|
130
|
+
* @param hit - The hit.
|
|
131
|
+
* @returns The link props.
|
|
132
|
+
*/
|
|
133
|
+
linkProps(hit: SearchResultHit<T>): SearchResultLinkProps;
|
|
134
|
+
/**
|
|
135
|
+
* Opens a hit for a plain click on the default anchor.
|
|
136
|
+
*
|
|
137
|
+
* @param event - The click event.
|
|
138
|
+
* @param hit - The hit.
|
|
139
|
+
*/
|
|
140
|
+
openFromLink(event: MouseEvent, hit: SearchResultHit<T>): void;
|
|
141
|
+
/**
|
|
142
|
+
* A pointer moving onto a row makes it active and warms its page, as
|
|
143
|
+
* React's `onPointerEnter` does.
|
|
144
|
+
*
|
|
145
|
+
* @param index - The row's index.
|
|
146
|
+
* @param hit - The hit.
|
|
147
|
+
*/
|
|
148
|
+
onPointerOver(index: number, hit: SearchResultHit<T>): void;
|
|
149
|
+
/**
|
|
150
|
+
* Keeps the keyboard-active row in view, the way React's effect keyed on
|
|
151
|
+
* `activeIndex` does.
|
|
152
|
+
*
|
|
153
|
+
* @param changes - The changed inputs.
|
|
154
|
+
*/
|
|
155
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
156
|
+
/** Keeps the active row in view after the list first renders, and adopts the rendered root. */
|
|
157
|
+
ngAfterViewInit(): void;
|
|
158
|
+
/**
|
|
159
|
+
* Adopts the rendered root beside the host on every check (a props step may
|
|
160
|
+
* re-render it), the way the kit's session gate and the UI kit's Tooltip
|
|
161
|
+
* adopt theirs: React's root is a fragment, so the focus path and the real
|
|
162
|
+
* DOM must not carry the host between the app and the list.
|
|
163
|
+
*/
|
|
164
|
+
ngDoCheck(): void;
|
|
165
|
+
/** The host element (the unwrapped wrapper holding React's root). */
|
|
166
|
+
private readonly hostEl;
|
|
167
|
+
/** Moves the rendered root beside the host, so the host stays empty. */
|
|
168
|
+
private adopt;
|
|
169
|
+
/** Scrolls the active row into view when there is one. */
|
|
170
|
+
private keepInView;
|
|
171
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SearchResults<any>, never>;
|
|
172
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SearchResults<any>, "mol-search-results", never, { "hits": { "alias": "hits"; "required": false; }; "view": { "alias": "view"; "required": false; }; "activeIndex": { "alias": "activeIndex"; "required": false; }; "onActivate": { "alias": "onActivate"; "required": false; }; "onOpen": { "alias": "onOpen"; "required": false; }; "onPrefetch": { "alias": "onPrefetch"; "required": false; }; "renderLink": { "alias": "renderLink"; "required": false; }; "action": { "alias": "action"; "required": false; }; "emptyText": { "alias": "emptyText"; "required": false; }; "molId": { "alias": "molId"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, never, true, never>;
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=search-results.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-results.component.d.ts","sourceRoot":"","sources":["../src/search-results.component.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,aAAa,EAElB,UAAU,EAEV,KAAK,aAAa,EAClB,KAAK,WAAW,EAEjB,MAAM,eAAe,CAAA;AAGtB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAIlD,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,YAAY,CAAA;;AAEnB;;;;;;;;;;;;;GAaG;AACH,qBAoGa,aAAa,CAAC,CAAC,SAAS,oBAAoB,GAAG,oBAAoB,CAC9E,YAAW,kBAAkB,CAAC,CAAC,CAAC,EAAE,aAAa;IAE/C,0BAA0B;IAC1B,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAK;IAC/B,yBAAyB;IACzB,IAAI,EAAG,CAAC,GAAG,EAAE,CAAC,KAAK,gBAAgB,CAAA;IACnC,oDAAoD;IACpD,WAAW,SAAK;IAChB,oCAAoC;IACpC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,wFAAwF;IACxF,MAAM,EAAG,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAA;IACzB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAA;IAC7B;;;OAGG;IACH,UAAU,CAAC,EAA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