@fluid-topics/ft-search-result-context 1.1.28 → 1.1.30

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.
@@ -1,11 +1,12 @@
1
1
  import { PropertyValues } from "lit";
2
- import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
2
+ import { ElementDefinitionsMap, FtLitElement, FtRegistrationContext } from "@fluid-topics/ft-wc-utils";
3
3
  import { FtSearchResultContextProperties } from "./ft-search-result-context.properties";
4
4
  import { FtSearchResultCluster, FtSearchResultClusterEntry } from "@fluid-topics/public-api";
5
+ import { FtSearchResultComponentInterface } from "./registration";
5
6
  export declare class SearchResultClusterChangeEvent extends CustomEvent<FtSearchResultClusterEntry> {
6
7
  constructor(result: FtSearchResultClusterEntry);
7
8
  }
8
- export declare class FtSearchResultContext extends FtLitElement implements FtSearchResultContextProperties {
9
+ export declare class FtSearchResultContext extends FtLitElement implements FtSearchResultContextProperties, FtRegistrationContext<FtSearchResultComponentInterface> {
9
10
  static elementDefinitions: ElementDefinitionsMap;
10
11
  static styles: import("lit").CSSResult;
11
12
  cluster?: FtSearchResultCluster;
@@ -15,6 +16,7 @@ export declare class FtSearchResultContext extends FtLitElement implements FtSea
15
16
  protected render(): import("lit").TemplateResult<1>;
16
17
  private onResultSelected;
17
18
  private registerComponent;
19
+ register(component: FtSearchResultComponentInterface): void;
18
20
  protected update(changedProperties: PropertyValues): void;
19
21
  disconnectedCallback(): void;
20
22
  }
@@ -32,6 +32,9 @@ class FtSearchResultContext extends FtLitElement {
32
32
  registerComponent(e) {
33
33
  e.stopPropagation();
34
34
  const component = e.composedPath()[0];
35
+ this.register(component);
36
+ }
37
+ register(component) {
35
38
  this.stateManager.registerComponent(component);
36
39
  }
37
40
  update(changedProperties) {
@@ -3,6 +3,6 @@
3
3
  color: inherit;
4
4
  text-decoration: inherit;
5
5
  }
6
- `;class o{constructor(t){this.registeredComponents=[],this.registeredMetadata=new Set,this.onResultSelected=t}registerComponent(t){t.setResultStateManager(this),this.registeredComponents.push(t),this.bindComponent(t)}unregisterComponent(t){this.registeredComponents.splice(this.registeredComponents.indexOf(t),1),t.cluster=void 0,t.result=void 0,t.rank=void 0}registerMetadata(t){this.registeredMetadata.add(t)}unregisterMetadata(t){this.registeredMetadata.delete(t)}updateCluster(t,s){this.cluster=t,this.rank=s,this.selectResult(this.cluster.entries[0])}selectResult(t){this.result=t,this.onResultSelected(t),this.registeredComponents.forEach((t=>this.bindComponent(t)))}clear(){this.registeredComponents=[]}bindComponent(t){t.cluster=this.cluster,t.result=this.result,t.rank=this.rank}}var h=function(t,s,e,i){for(var r,o=arguments.length,h=o<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,n=t.length-1;n>=0;n--)(r=t[n])&&(h=(o<3?r(h):o>3?r(s,e,h):r(s,e))||h);return o>3&&h&&Object.defineProperty(s,e,h),h};class n extends CustomEvent{constructor(t){super("ft-search-result-cluster-change",{detail:t,bubbles:!0,composed:!0})}}class c extends s.FtLitElement{constructor(){super(...arguments),this.index=0,this.stateManager=new o((t=>this.onResultSelected(t)))}render(){return e.html`
6
+ `;class h{constructor(t){this.registeredComponents=[],this.registeredMetadata=new Set,this.onResultSelected=t}registerComponent(t){t.setResultStateManager(this),this.registeredComponents.push(t),this.bindComponent(t)}unregisterComponent(t){this.registeredComponents.splice(this.registeredComponents.indexOf(t),1),t.cluster=void 0,t.result=void 0,t.rank=void 0}registerMetadata(t){this.registeredMetadata.add(t)}unregisterMetadata(t){this.registeredMetadata.delete(t)}updateCluster(t,s){this.cluster=t,this.rank=s,this.selectResult(this.cluster.entries[0])}selectResult(t){this.result=t,this.onResultSelected(t),this.registeredComponents.forEach((t=>this.bindComponent(t)))}clear(){this.registeredComponents=[]}bindComponent(t){t.cluster=this.cluster,t.result=this.result,t.rank=this.rank}}var o=function(t,s,e,i){for(var r,h=arguments.length,o=h<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(h<3?r(o):h>3?r(s,e,o):r(s,e))||o);return h>3&&o&&Object.defineProperty(s,e,o),o};class n extends CustomEvent{constructor(t){super("ft-search-result-cluster-change",{detail:t,bubbles:!0,composed:!0})}}class c extends s.FtLitElement{constructor(){super(...arguments),this.index=0,this.stateManager=new h((t=>this.onResultSelected(t)))}render(){return e.html`
7
7
  <slot @register-ft-search-result-component=${this.registerComponent}></slot>
8
- `}onResultSelected(t){this.result=t,this.dispatchEvent(new n(this.result))}registerComponent(t){t.stopPropagation();const s=t.composedPath()[0];this.stateManager.registerComponent(s)}update(t){super.update(t),t.has("cluster")&&this.cluster&&this.stateManager.updateCluster(this.cluster,this.index+1)}disconnectedCallback(){super.disconnectedCallback(),this.stateManager.clear()}}c.elementDefinitions={},c.styles=r,h([i.property({attribute:!1})],c.prototype,"cluster",void 0),h([i.state()],c.prototype,"result",void 0),h([i.property()],c.prototype,"index",void 0),s.customElement("ft-search-result-context")(c),t.FtSearchResultContext=c,t.FtSearchResultContextCssVariables={},t.SearchResultClusterChangeEvent=n,t.styles=r}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators);
8
+ `}onResultSelected(t){this.result=t,this.dispatchEvent(new n(this.result))}registerComponent(t){t.stopPropagation();const s=t.composedPath()[0];this.register(s)}register(t){this.stateManager.registerComponent(t)}update(t){super.update(t),t.has("cluster")&&this.cluster&&this.stateManager.updateCluster(this.cluster,this.index+1)}disconnectedCallback(){super.disconnectedCallback(),this.stateManager.clear()}}c.elementDefinitions={},c.styles=r,o([i.property({attribute:!1})],c.prototype,"cluster",void 0),o([i.state()],c.prototype,"result",void 0),o([i.property()],c.prototype,"index",void 0),s.customElement("ft-search-result-context")(c),t.FtSearchResultContext=c,t.FtSearchResultContextCssVariables={},t.SearchResultClusterChangeEvent=n,t.styles=r}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators);
@@ -111,4 +111,4 @@ const bo=window,mo=bo.ShadowRoot&&(void 0===bo.ShadyCSS||bo.ShadyCSS.nativeShado
111
111
  }
112
112
  `;class Mo{constructor(t){this.registeredComponents=[],this.registeredMetadata=new Set,this.onResultSelected=t}registerComponent(t){t.setResultStateManager(this),this.registeredComponents.push(t),this.bindComponent(t)}unregisterComponent(t){this.registeredComponents.splice(this.registeredComponents.indexOf(t),1),t.cluster=void 0,t.result=void 0,t.rank=void 0}registerMetadata(t){this.registeredMetadata.add(t)}unregisterMetadata(t){this.registeredMetadata.delete(t)}updateCluster(t,o){this.cluster=t,this.rank=o,this.selectResult(this.cluster.entries[0])}selectResult(t){this.result=t,this.onResultSelected(t),this.registeredComponents.forEach((t=>this.bindComponent(t)))}clear(){this.registeredComponents=[]}bindComponent(t){t.cluster=this.cluster,t.result=this.result,t.rank=this.rank}}var Bo,zo=function(t,o,e,r){for(var i,a=arguments.length,n=a<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(n=(a<3?i(n):a>3?i(o,e,n):i(o,e))||n);return a>3&&n&&Object.defineProperty(o,e,n),n};class Do extends CustomEvent{constructor(t){super("ft-search-result-cluster-change",{detail:t,bubbles:!0,composed:!0})}}class Po extends Co{constructor(){super(...arguments),this.index=0,this.stateManager=new Mo((t=>this.onResultSelected(t)))}render(){return Yt`
113
113
  <slot @register-ft-search-result-component=${this.registerComponent}></slot>
114
- `}onResultSelected(t){this.result=t,this.dispatchEvent(new Do(this.result))}registerComponent(t){t.stopPropagation();const o=t.composedPath()[0];this.stateManager.registerComponent(o)}update(t){super.update(t),t.has("cluster")&&this.cluster&&this.stateManager.updateCluster(this.cluster,this.index+1)}disconnectedCallback(){super.disconnectedCallback(),this.stateManager.clear()}}Po.elementDefinitions={},Po.styles=$o,zo([C({attribute:!1})],Po.prototype,"cluster",void 0),zo([function(t){return C({...t,state:!0,attribute:!1})}()],Po.prototype,"result",void 0),zo([C()],Po.prototype,"index",void 0),(Bo="ft-search-result-context",t=>{window.customElements.get(Bo)||window.customElements.define(Bo,t)})(Po),t.FtSearchResultContext=Po,t.FtSearchResultContextCssVariables={},t.SearchResultClusterChangeEvent=Do,t.styles=$o}({});
114
+ `}onResultSelected(t){this.result=t,this.dispatchEvent(new Do(this.result))}registerComponent(t){t.stopPropagation();const o=t.composedPath()[0];this.register(o)}register(t){this.stateManager.registerComponent(t)}update(t){super.update(t),t.has("cluster")&&this.cluster&&this.stateManager.updateCluster(this.cluster,this.index+1)}disconnectedCallback(){super.disconnectedCallback(),this.stateManager.clear()}}Po.elementDefinitions={},Po.styles=$o,zo([C({attribute:!1})],Po.prototype,"cluster",void 0),zo([function(t){return C({...t,state:!0,attribute:!1})}()],Po.prototype,"result",void 0),zo([C()],Po.prototype,"index",void 0),(Bo="ft-search-result-context",t=>{window.customElements.get(Bo)||window.customElements.define(Bo,t)})(Po),t.FtSearchResultContext=Po,t.FtSearchResultContextCssVariables={},t.SearchResultClusterChangeEvent=Do,t.styles=$o}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-search-result-context",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
4
4
  "description": "Search result context for integrated search component",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,11 +19,11 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-wc-utils": "1.1.28",
22
+ "@fluid-topics/ft-wc-utils": "1.1.30",
23
23
  "lit": "3.1.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@fluid-topics/public-api": "1.0.57"
27
27
  },
28
- "gitHead": "8c1055ddd23e83efa3833f033a507aa1ab32fecc"
28
+ "gitHead": "2eadc3ab5cdc677c1db2564a74d18440cd553d42"
29
29
  }