@fluid-topics/ft-search-result-abstract 1.3.49 → 1.3.51

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.
@@ -6,6 +6,5 @@ export declare class FtSearchResultAbstract extends FtSearchResultComponent impl
6
6
  static elementDefinitions: ElementDefinitionsMap;
7
7
  static styles: import("lit").CSSResult;
8
8
  protected render(): import("lit-html").TemplateResult<1>;
9
- private selectAbstract;
10
9
  protected contentAvailableCallback(props: PropertyValues): void;
11
10
  }
@@ -1,11 +1,13 @@
1
1
  import { html } from "lit";
2
+ import { accessResult } from "@fluid-topics/ft-wc-utils";
2
3
  import { FtSearchResultComponent } from "@fluid-topics/ft-search-result-context/build/registration";
3
4
  import { styles } from "./ft-search-result-abstract.styles";
4
5
  import { unsafeHTML } from "lit/directives/unsafe-html.js";
5
- import { FtTypography } from "@fluid-topics/ft-typography";
6
+ import { FtTypography, FtTypographyVariants } from "@fluid-topics/ft-typography";
6
7
  class FtSearchResultAbstract extends FtSearchResultComponent {
7
8
  render() {
8
- let abstract = this.result ? this.selectAbstract(this.result) : undefined;
9
+ var _a;
10
+ const abstract = (_a = accessResult(this.result)) === null || _a === void 0 ? void 0 : _a.htmlExcerpt;
9
11
  if (!abstract) {
10
12
  return html `
11
13
  <style>
@@ -16,23 +18,12 @@ class FtSearchResultAbstract extends FtSearchResultComponent {
16
18
  `;
17
19
  }
18
20
  return html `
19
- <ft-typography variant="body1" part="text">${unsafeHTML(abstract)}</ft-typography>
21
+ <ft-typography variant="${FtTypographyVariants.body1}" part="text">${unsafeHTML(abstract)}</ft-typography>
20
22
  `;
21
23
  }
22
- selectAbstract(result) {
23
- switch (result.type) {
24
- case "MAP":
25
- return result.map.htmlExcerpt;
26
- case "DOCUMENT":
27
- return result.document.htmlExcerpt;
28
- case "TOPIC":
29
- return result.topic.htmlExcerpt;
30
- }
31
- return "";
32
- }
33
24
  contentAvailableCallback(props) {
34
25
  super.contentAvailableCallback(props);
35
- this.shadowRoot.querySelectorAll(".kwicmatch").forEach(match => match.setAttribute("part", "kwicmatch"));
26
+ this.shadowRoot.querySelectorAll(".kwicmatch").forEach((match) => match.setAttribute("part", "kwicmatch"));
36
27
  }
37
28
  }
38
29
  FtSearchResultAbstract.elementDefinitions = {