@fluid-topics/ft-search-input 1.1.32 → 1.1.34
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/build/ft-search-input.light.js +9 -9
- package/build/ft-search-input.min.js +10 -10
- package/package.json +10 -10
|
@@ -886,11 +886,11 @@ const Zo=Symbol.for(""),zo=t=>{if(t?.r===Zo)return t?._$litStatic$},Do=t=>({_$li
|
|
|
886
886
|
`,ki=o.FtReduxStore.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0}});class Wi{static build(t){const{baseUrl:o,apiIntegrationIdentifier:e}=ki.getState(),i=null!=t?t:e;if(o&&i&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,i,!0)}static get(t){var o;return null!=t?Wi.build(t):null!==(o=Wi.API)&&void 0!==o?o:Wi.API=Wi.build()}static await(t){return new Promise((o=>{let e=Wi.get(t);if(e)o(e);else{const i=ki.subscribe((()=>{e=Wi.get(t),e&&(i(),o(e))}))}}))}}var Li;const Ki=Symbol("clearAfterUnitTest");class Ai{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new o.CacheRegistry,this.listeners={},this.currentUiLocale="",this[Li]=()=>{this.defaultMessages={},this.cache=new o.CacheRegistry,this.listeners={}},this.currentUiLocale=ki.getState().uiLocale,ki.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=ki.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var i;if(t=t.toLowerCase(),Object.keys(e).length>0){const r={...null!==(i=this.defaultMessages[t])&&void 0!==i?i:{},...e};o.deepEqual(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...i){var r,n,a;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(n=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==n?n:{};return new o.ParametrizedLabelResolver(null!==(a=this.defaultMessages[t])&&void 0!==a?a:{},l).resolve(e,...i)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>o.delay(0).then((()=>t())).catch((()=>null)))))}}Li=Ki,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new Ai((async(t,o)=>(await Wi.await()).getFluidTopicsMessageContext(t,o)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new Ai((async(t,o)=>(await Wi.await()).getCustomMessageContext(t,o))));const Zi=window.FluidTopicsI18nService,zi=window.FluidTopicsCustomI18nService;var Di=function(t,o,e,i){for(var r,n=arguments.length,a=n<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,e):i,l=t.length-1;l>=0;l--)(r=t[l])&&(a=(n<3?r(a):n>3?r(o,e,a):r(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class Fi extends o.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>Wi.get(),this.cache=new o.CacheRegistry,this.cleanSessionDebouncer=new o.Debouncer}render(){return e.html`
|
|
887
887
|
<slot></slot>
|
|
888
888
|
`}update(t){super.update(t),t.has("baseUrl")&&(ki.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&ki.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&ki.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&ki.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&ki.actions.noCustom(this.noCustom),t.has("editorMode")&&ki.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&ki.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&ki.actions.session(this.session),t.has("availableUiLocales")&&ki.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Zi.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}Fi.elementDefinitions={},Fi.styles=Ri,Di([i.property()],Fi.prototype,"baseUrl",void 0),Di([i.property()],Fi.prototype,"apiIntegrationIdentifier",void 0),Di([i.property()],Fi.prototype,"uiLocale",void 0),Di([o.jsonProperty(null)],Fi.prototype,"availableUiLocales",void 0),Di([o.jsonProperty(null)],Fi.prototype,"metadataConfiguration",void 0),Di([i.property({type:Boolean})],Fi.prototype,"editorMode",void 0),Di([i.property({type:Boolean})],Fi.prototype,"noCustom",void 0),Di([i.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Fi.prototype,"noCustomComponent",void 0),Di([i.property({type:Boolean})],Fi.prototype,"withManualResources",void 0),Di([o.jsonProperty([])],Fi.prototype,"messageContexts",void 0),Di([o.jsonProperty(void 0)],Fi.prototype,"session",void 0),Di([i.property({type:Object})],Fi.prototype,"apiProvider",void 0);class Bi{async listMySearches(){var t;return(null===(t=ki.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await Wi.await()).listMySearches(ki.getState().session.profile.userId):[]}}const Ti=new o.CacheRegistry;class Hi{async listMyBookmarks(){return Ti.get("bookmarks",(async()=>(await Wi.await()).listMyBookmarks(ki.getState().session.profile.userId)))}clearCache(){Ti.clear("bookmarks")}}const Pi=o.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=ki.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Hi,ki.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=ki.getState();o.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){Pi.actions.savedSearches(void 0)}clearMyBookmarks(){Pi.actions.bookmarks(void 0)}async reloadMySearches(){const t=new Bi,o=await t.listMySearches();Pi.actions.savedSearches(o)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const o=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Pi.actions.bookmarks(o)}}},o.customElement("ft-app-context")(Fi);class Mi extends Event{constructor(){super(Mi.eventName)}}Mi.eventName="search-context-clear-all-filters";var Gi=function(t,o,e,i){for(var r,n=arguments.length,a=n<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,e):i,l=t.length-1;l>=0;l--)(r=t[l])&&(a=(n<3?r(a):n>3?r(o,e,a):r(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class ji extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}}const _i=Symbol("registerInterval");class Yi extends(function(t){var o;class e extends t{constructor(){super(...arguments),this[o]=0}setSearchStateManager(t){this.clearStateManager(),this.stateManager=t,this.addStore(t.store,"search")}clearStateManager(){this.stateManager&&(this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[_i]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[_i]):this.dispatchEvent(new ji)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return o=_i,Gi([i.state()],e.prototype,"stateManager",void 0),e}(o.FtLitElementRedux)){}const Vi=e.css`
|
|
889
|
-
`;var qi=function(t,o,e,i){for(var r,n=arguments.length,a=n<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,e):i,l=t.length-1;l>=0;l--)(r=t[l])&&(a=(n<3?r(a):n>3?r(o,e,a):r(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};const Xi=Symbol("
|
|
889
|
+
`;var qi=function(t,o,e,i){for(var r,n=arguments.length,a=n<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,e):i,l=t.length-1;l>=0;l--)(r=t[l])&&(a=(n<3?r(a):n>3?r(o,e,a):r(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};const Xi=Symbol("i18nAttributes"),Ji=Symbol("i18nProperties"),Qi=Symbol("i18nUnsubs");function tr(t){var o;class e extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[o]=new Map}get i18nService(){return this.useCustomMessageContexts?zi:Zi}i18n(t,o,...e){var i;if("string"==typeof t)return this.i18nService.resolveMessage(t,o,...e);const r=null!==(i=t.args)&&void 0!==i?i:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...r)}onI18nUpdate(t){var o,e;null===(o=this[Xi])||void 0===o||o.forEach(((o,e)=>{var i;const r=this.getI18nAttributeValue(e);(null===(i=null==r?void 0:r.context)||void 0===i?void 0:i.toLowerCase())===t.toLowerCase()&&this.updateI18nAttributeMessage(e,r,o)})),null===(e=this[Ji])||void 0===e||e.forEach(((o,e)=>{o.context.toLowerCase()===t.toLowerCase()&&(this[e]=this.i18n(o))})),setTimeout((()=>this.requestUpdate()),0)}updateI18nAttributeMessage(t,o,e){this[t]={...o,message:this.i18n({context:o.context,key:o.key,...e})}}update(t){var o,e;super.update(t),null===(o=this[Xi])||void 0===o||o.forEach(((o,e)=>{const i=this.getI18nAttributeValue(e);(null==i?void 0:i.context)&&i.key&&(t.has(e)||null!=o.argsProvider)&&(t.has(e)&&this.addI18nContext(i.context),this.updateI18nAttributeMessage(e,i,o))})),null===(e=this[Ji])||void 0===e||e.forEach(((t,o)=>{null!=t.argsProvider&&(this[o]=this.i18n(t))}))}getI18nAttributeValue(t){return this[t]}connectedCallback(){var t,o,e,i;super.connectedCallback(),new Set([...null!==(o=null===(t=this[Ji])||void 0===t?void 0:t.values())&&void 0!==o?o:[],...[...null!==(i=null===(e=this[Xi])||void 0===e?void 0:e.keys())&&void 0!==i?i:[]].map((t=>this.getI18nAttributeValue(t)))].map((t=>null==t?void 0:t.context))).forEach((t=>t&&this.addI18nMessages(t)))}addI18nMessages(t,o){t=t.toLowerCase(),this[Qi].has(t)||this[Qi].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=o?o:{})}addI18nContext(t,o){this.addI18nMessages("string"==typeof t?t:t.name,o)}disconnectedCallback(){super.disconnectedCallback(),this[Qi].forEach((t=>t())),this[Qi].clear()}}return o=Qi,qi([i.property({type:Boolean})],e.prototype,"useCustomMessageContexts",void 0),e}class or extends(tr(o.FtLitElement)){}class er extends(tr(o.FtLitElementRedux)){}var ir=function(t,o,e,i){for(var r,n=arguments.length,a=n<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,e):i,l=t.length-1;l>=0;l--)(r=t[l])&&(a=(n<3?r(a):n>3?r(o,e,a):r(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class rr extends er{constructor(){super(),this.editorMode=!1,this.addStore(ki)}render(){return this.key&&this.context?e.html`
|
|
890
890
|
<span class="ft-i18n">
|
|
891
891
|
${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
|
|
892
892
|
</span>
|
|
893
|
-
`:this.editorMode?"Select a context and a label key.":e.nothing}update(t){var o;super.update(t),this.context&&this.key&&this.addI18nMessages(this.context,{[this.key]:null!==(o=this.defaultMessage)&&void 0!==o?o:""})}}
|
|
893
|
+
`:this.editorMode?"Select a context and a label key.":e.nothing}update(t){var o;super.update(t),["context","key","defaultMessage"].some((o=>t.has(o)))&&this.context&&this.key&&this.addI18nMessages(this.context,{[this.key]:null!==(o=this.defaultMessage)&&void 0!==o?o:""})}}rr.elementDefinitions={},rr.styles=Vi,ir([o.redux()],rr.prototype,"editorMode",void 0),ir([i.property()],rr.prototype,"context",void 0),ir([i.property()],rr.prototype,"key",void 0),ir([o.jsonProperty([])],rr.prototype,"args",void 0),ir([i.property()],rr.prototype,"defaultMessage",void 0);class nr{static build(t){return new nr(t)}static fromGwt(t){return new nr(t)}constructor(t){this.name=t,this.properties=new Proxy({},{get:(t,o)=>{const e=o;return t=>({context:this.name,key:e,args:"function"==typeof t?void 0:t,argsProvider:"function"==typeof t?t:void 0})}}),this.messages=new Proxy({},{get:(t,o)=>(...t)=>Zi.resolveMessage(this.name,o,...t)})}}o.customElement("ft-i18n")(rr);const ar=nr.build("designedSearchInput"),lr=e.css`
|
|
894
894
|
* {
|
|
895
895
|
box-sizing: border-box;
|
|
896
896
|
}
|
|
@@ -932,7 +932,7 @@ const Zo=Symbol.for(""),zo=t=>{if(t?.r===Zo)return t?._$litStatic$},Do=t=>({_$li
|
|
|
932
932
|
flex-grow: 1;
|
|
933
933
|
flex-shrink: 1;
|
|
934
934
|
}
|
|
935
|
-
`;var
|
|
935
|
+
`;var sr=function(t,o,e,i){for(var r,n=arguments.length,a=n<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,e):i,l=t.length-1;l>=0;l--)(r=t[l])&&(a=(n<3?r(a):n>3?r(o,e,a):r(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class cr extends CustomEvent{constructor(t){super("suggestion-selected",{detail:t})}}let pr=class extends Yi{render(){return e.html`
|
|
936
936
|
<div class="ft-search-input-suggestion ft-word-wrap"
|
|
937
937
|
part="container"
|
|
938
938
|
@keydown=${t=>this.onSuggestKeyDown(t)}>
|
|
@@ -948,16 +948,16 @@ const Zo=Symbol.for(""),zo=t=>{if(t?.r===Zo)return t?._$litStatic$},Do=t=>({_$li
|
|
|
948
948
|
</a>
|
|
949
949
|
`))}
|
|
950
950
|
</div>
|
|
951
|
-
`}onSuggestKeyDown(t){var o,e,i,r,n,a;switch(t.key){case"ArrowUp":null===(i=null!==(e=null===(o=this.getFocusedSuggestionElement())||void 0===o?void 0:o.previousElementSibling)&&void 0!==e?e:this.getLastSuggestionElement())||void 0===i||i.focus(),t.preventDefault(),t.stopPropagation();break;case"ArrowDown":null===(a=null!==(n=null===(r=this.getFocusedSuggestionElement())||void 0===r?void 0:r.nextElementSibling)&&void 0!==n?n:this.getFirstSuggestionElement())||void 0===a||a.focus(),t.preventDefault(),t.stopPropagation()}}onSuggestKeyUp(t,o){"Enter"!==t.key&&" "!==t.key||this.onSuggestSelected(t,o)}onSuggestSelected(t,o){t.preventDefault(),this.dispatchEvent(new
|
|
951
|
+
`}onSuggestKeyDown(t){var o,e,i,r,n,a;switch(t.key){case"ArrowUp":null===(i=null!==(e=null===(o=this.getFocusedSuggestionElement())||void 0===o?void 0:o.previousElementSibling)&&void 0!==e?e:this.getLastSuggestionElement())||void 0===i||i.focus(),t.preventDefault(),t.stopPropagation();break;case"ArrowDown":null===(a=null!==(n=null===(r=this.getFocusedSuggestionElement())||void 0===r?void 0:r.nextElementSibling)&&void 0!==n?n:this.getFirstSuggestionElement())||void 0===a||a.focus(),t.preventDefault(),t.stopPropagation()}}onSuggestKeyUp(t,o){"Enter"!==t.key&&" "!==t.key||this.onSuggestSelected(t,o)}onSuggestSelected(t,o){t.preventDefault(),this.dispatchEvent(new cr(o))}getIcon(t){const o="DOCUMENT"===t.type?Qe.file_format:Qe.fluid_topics;let i;switch(t.type){case"MAP":i="BOOK"===t.editorialType?_e.BOOK:_e.ARTICLE;break;case"DOCUMENT":i=function(t,o){var e,i,r,n;t=(null!=t?t:"").toLowerCase(),o=(null!=o?o:"").toLowerCase();const[a,l]=((null!==(e=Je.get(t))&&void 0!==e?e:t)+"/").split("/");return null!==(n=null!==(r=null!==(i=Xe.get(l))&&void 0!==i?i:Xe.get(o))&&void 0!==r?r:Xe.get(a))&&void 0!==n?n:Ye.UNKNOWN}(t.mimeType,t.filenameExtension);break;case"TOPIC":i=_e.TOPICS}return e.html`
|
|
952
952
|
<ft-icon .variant="${o}" .value="${i}" part="suggestion-icon"></ft-icon>
|
|
953
|
-
`}getFocusedSuggestionElement(){return this.shadowRoot.querySelector(".ft-search-input-suggestion--suggestion:focus-within")}getLastSuggestionElement(){let t=this.shadowRoot.querySelectorAll(".ft-search-input-suggestion--suggestion");return t.length>0?t[t.length-1]:null}getFirstSuggestionElement(){return this.shadowRoot.querySelector(".ft-search-input-suggestion--suggestion")}focusFirstSuggestion(){var t;null===(t=this.getFirstSuggestionElement())||void 0===t||t.focus()}};
|
|
953
|
+
`}getFocusedSuggestionElement(){return this.shadowRoot.querySelector(".ft-search-input-suggestion--suggestion:focus-within")}getLastSuggestionElement(){let t=this.shadowRoot.querySelectorAll(".ft-search-input-suggestion--suggestion");return t.length>0?t[t.length-1]:null}getFirstSuggestionElement(){return this.shadowRoot.querySelector(".ft-search-input-suggestion--suggestion")}focusFirstSuggestion(){var t;null===(t=this.getFirstSuggestionElement())||void 0===t||t.focus()}};pr.elementDefinitions={"ft-ripple":Jt,"ft-typography":Po,"ft-icon":oi},pr.styles=[o.wordWrap,lr],sr([o.redux()],pr.prototype,"suggestResults",void 0),pr=sr([i.customElement("ft-search-input-suggestion")],pr);var fr=function(t,o,e,i){for(var r,n=arguments.length,a=n<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,e):i,l=t.length-1;l>=0;l--)(r=t[l])&&(a=(n<3?r(a):n>3?r(o,e,a):r(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class dr extends(tr(Yi)){constructor(){super(),this.liveQuery="",this.forceCloseSuggestion=!1,this.addI18nContext(ar)}render(){var t,o;let i={"ft-search-input":!0,"ft-search-input--with-suggestions":null!==(o=null===(t=this.suggestResults)||void 0===t?void 0:t.length)&&void 0!==o&&o,"ft-search-input--with-suggestions-closed":this.forceCloseSuggestion};return e.html`
|
|
954
954
|
<div class="${r.classMap(i)}" @focusout=${()=>this.forceCloseSuggestion=!1}>
|
|
955
955
|
<div class="ft-search-input--input-container" part="input-container" tabindex="-1">
|
|
956
956
|
<div class="ft-search-input--input-outline" part="input-outline">
|
|
957
957
|
<input class="ft-search-input--input ft-typography--body2"
|
|
958
958
|
part="input"
|
|
959
959
|
type="text"
|
|
960
|
-
placeholder="${
|
|
960
|
+
placeholder="${ar.messages.placeholder()}"
|
|
961
961
|
.value="${this.liveQuery}"
|
|
962
962
|
@keydown=${t=>this.onSearchBarKeyDown(t)}
|
|
963
963
|
@keyup=${t=>this.onSearchBarKeyUp(t)}>
|
|
@@ -973,7 +973,7 @@ const Zo=Symbol.for(""),zo=t=>{if(t?.r===Zo)return t?._$litStatic$},Do=t=>({_$li
|
|
|
973
973
|
part="clear-query"
|
|
974
974
|
icon="close"
|
|
975
975
|
round dense
|
|
976
|
-
label="${
|
|
976
|
+
label="${ar.messages.clearButton()}"
|
|
977
977
|
@click=${()=>this.liveQuery=""}
|
|
978
978
|
></ft-button>
|
|
979
979
|
<div class="ft-search-input--separator"></div>
|
|
@@ -982,9 +982,9 @@ const Zo=Symbol.for(""),zo=t=>{if(t?.r===Zo)return t?._$litStatic$},Do=t=>({_$li
|
|
|
982
982
|
part="launch-search-in-input"
|
|
983
983
|
icon="search"
|
|
984
984
|
round dense
|
|
985
|
-
label="${
|
|
985
|
+
label="${ar.messages.searchButton()}"
|
|
986
986
|
@click=${()=>this.launchSearch()}
|
|
987
987
|
></ft-button>
|
|
988
988
|
</div>
|
|
989
989
|
</div>
|
|
990
|
-
`}onSearchBarKeyDown(t){switch(t.key){case"ArrowDown":t.stopPropagation(),t.preventDefault(),this.suggestion.focusFirstSuggestion();break;case"Backspace":t.stopPropagation()}}onSearchBarKeyUp(t){var o,e;if("Backspace"===t.key&&t.stopPropagation(),"Enter"===t.key)null===(o=this.stateManager)||void 0===o||o.setQuery(this.input.value),this.forceCloseSuggestion=!0;else null===(e=this.stateManager)||void 0===e||e.setLiveQuery(this.input.value),this.forceCloseSuggestion=!1}launchSearch(){var t;null===(t=this.stateManager)||void 0===t||t.setQuery(this.liveQuery),this.forceCloseSuggestion=!0}onSuggestionSelected(t){var o;null===(o=this.stateManager)||void 0===o||o.setQuery(t.detail),this.forceCloseSuggestion=!0}}
|
|
990
|
+
`}onSearchBarKeyDown(t){switch(t.key){case"ArrowDown":t.stopPropagation(),t.preventDefault(),this.suggestion.focusFirstSuggestion();break;case"Backspace":t.stopPropagation()}}onSearchBarKeyUp(t){var o,e;if("Backspace"===t.key&&t.stopPropagation(),"Enter"===t.key)null===(o=this.stateManager)||void 0===o||o.setQuery(this.input.value),this.forceCloseSuggestion=!0;else null===(e=this.stateManager)||void 0===e||e.setLiveQuery(this.input.value),this.forceCloseSuggestion=!1}launchSearch(){var t;null===(t=this.stateManager)||void 0===t||t.setQuery(this.liveQuery),this.forceCloseSuggestion=!0}onSuggestionSelected(t){var o;null===(o=this.stateManager)||void 0===o||o.setQuery(t.detail),this.forceCloseSuggestion=!0}}dr.elementDefinitions={"ft-search-input-suggestion":pr,"ft-button":ai},dr.styles=[kt,fi],fr([o.redux()],dr.prototype,"request",void 0),fr([o.redux()],dr.prototype,"liveQuery",void 0),fr([o.redux()],dr.prototype,"suggestResults",void 0),fr([i.state()],dr.prototype,"forceCloseSuggestion",void 0),fr([i.query(".ft-search-input--input")],dr.prototype,"input",void 0),fr([i.query("ft-search-input-suggestion")],dr.prototype,"suggestion",void 0),o.customElement("ft-search-input")(dr),t.FtSearchInput=dr,t.FtSearchInputCssVariables=pi,t.styles=fi}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litClassMap,ftGlobals.litUnsafeHTML,ftGlobals.litRepeat);
|
|
@@ -1021,11 +1021,11 @@ class os extends Ma{constructor(t){if(super(t),this.et=it,t.type!==Da)throw Erro
|
|
|
1021
1021
|
`,Ms=Hi.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0}});class zs{static build(t){const{baseUrl:e,apiIntegrationIdentifier:o}=Ms.getState(),r=null!=t?t:o;if(e&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,r,!0)}static get(t){var e;return null!=t?zs.build(t):null!==(e=zs.API)&&void 0!==e?e:zs.API=zs.build()}static await(t){return new Promise((e=>{let o=zs.get(t);if(o)e(o);else{const r=Ms.subscribe((()=>{o=zs.get(t),o&&(r(),e(o))}))}}))}}var Bs;const Ts=Symbol("clearAfterUnitTest");class Zs{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new r,this.listeners={},this.currentUiLocale="",this[Bs]=()=>{this.defaultMessages={},this.cache=new r,this.listeners={}},this.currentUiLocale=Ms.getState().uiLocale,Ms.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Ms.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const e=t.name.toLowerCase();this.cache.setFinal(e,t),this.notify(e)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var o;if(t=t.toLowerCase(),Object.keys(e).length>0){const r={...null!==(o=this.defaultMessages[t])&&void 0!==o?o:{},...e};W(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...o){var r,i,n;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(i=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==i?i:{};return new Vo(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},a).resolve(e,...o)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,e){var o;return t=t.toLowerCase(),this.listeners[t]=null!==(o=this.listeners[t])&&void 0!==o?o:new Set,this.listeners[t].add(e),()=>{var o;return null===(o=this.listeners[t])||void 0===o?void 0:o.delete(e)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>{return(e=0,new Promise((t=>setTimeout(t,e)))).then((()=>t())).catch((()=>null));var e})))}}Bs=Ts,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new Zs((async(t,e)=>(await zs.await()).getFluidTopicsMessageContext(t,e)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new Zs((async(t,e)=>(await zs.await()).getCustomMessageContext(t,e))));const _s=window.FluidTopicsI18nService,Hs=window.FluidTopicsCustomI18nService;var Gs=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Vs extends To{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>zs.get(),this.cache=new r,this.cleanSessionDebouncer=new i}render(){return ce`
|
|
1022
1022
|
<slot></slot>
|
|
1023
1023
|
`}update(t){super.update(t),t.has("baseUrl")&&(Ms.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Ms.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Ms.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Ms.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Ms.actions.noCustom(this.noCustom),t.has("editorMode")&&Ms.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Ms.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Ms.actions.session(this.session),t.has("availableUiLocales")&&Ms.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>_s.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}Vs.elementDefinitions={},Vs.styles=Ps,Gs([$()],Vs.prototype,"baseUrl",void 0),Gs([$()],Vs.prototype,"apiIntegrationIdentifier",void 0),Gs([$()],Vs.prototype,"uiLocale",void 0),Gs([K(null)],Vs.prototype,"availableUiLocales",void 0),Gs([K(null)],Vs.prototype,"metadataConfiguration",void 0),Gs([$({type:Boolean})],Vs.prototype,"editorMode",void 0),Gs([$({type:Boolean})],Vs.prototype,"noCustom",void 0),Gs([$({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Vs.prototype,"noCustomComponent",void 0),Gs([$({type:Boolean})],Vs.prototype,"withManualResources",void 0),Gs([K([])],Vs.prototype,"messageContexts",void 0),Gs([K(void 0)],Vs.prototype,"session",void 0),Gs([$({type:Object})],Vs.prototype,"apiProvider",void 0);class qs{async listMySearches(){var t;return(null===(t=Ms.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await zs.await()).listMySearches(Ms.getState().session.profile.userId):[]}}const Ys=new r;class Xs{async listMyBookmarks(){return Ys.get("bookmarks",(async()=>(await zs.await()).listMyBookmarks(Ms.getState().session.profile.userId)))}clearCache(){Ys.clear("bookmarks")}}const Js=Hi.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=Ms.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Xs,Ms.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=Ms.getState();W(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){Js.actions.savedSearches(void 0)}clearMyBookmarks(){Js.actions.bookmarks(void 0)}async reloadMySearches(){const t=new qs,e=await t.listMySearches();Js.actions.savedSearches(e)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Js.actions.bookmarks(e)}}},A("ft-app-context")(Vs);class Qs extends Event{constructor(){super(Qs.eventName)}}Qs.eventName="search-context-clear-all-filters";var tc=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class ec extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}}const oc=Symbol("registerInterval");class rc extends(function(t){var e;class o extends t{constructor(){super(...arguments),this[e]=0}setSearchStateManager(t){this.clearStateManager(),this.stateManager=t,this.addStore(t.store,"search")}clearStateManager(){this.stateManager&&(this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[oc]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[oc]):this.dispatchEvent(new ec)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return e=oc,tc([U()],o.prototype,"stateManager",void 0),o}(ir)){}const ic=Et`
|
|
1024
|
-
`;var nc=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};const ac=Symbol("
|
|
1024
|
+
`;var nc=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};const ac=Symbol("i18nAttributes"),sc=Symbol("i18nProperties"),cc=Symbol("i18nUnsubs");function lc(t){var e;class o extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?Hs:_s}i18n(t,e,...o){var r;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...o);const i=null!==(r=t.args)&&void 0!==r?r:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...i)}onI18nUpdate(t){var e,o;null===(e=this[ac])||void 0===e||e.forEach(((e,o)=>{var r;const i=this.getI18nAttributeValue(o);(null===(r=null==i?void 0:i.context)||void 0===r?void 0:r.toLowerCase())===t.toLowerCase()&&this.updateI18nAttributeMessage(o,i,e)})),null===(o=this[sc])||void 0===o||o.forEach(((e,o)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[o]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}updateI18nAttributeMessage(t,e,o){this[t]={...e,message:this.i18n({context:e.context,key:e.key,...o})}}update(t){var e,o;super.update(t),null===(e=this[ac])||void 0===e||e.forEach(((e,o)=>{const r=this.getI18nAttributeValue(o);(null==r?void 0:r.context)&&r.key&&(t.has(o)||null!=e.argsProvider)&&(t.has(o)&&this.addI18nContext(r.context),this.updateI18nAttributeMessage(o,r,e))})),null===(o=this[sc])||void 0===o||o.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}getI18nAttributeValue(t){return this[t]}connectedCallback(){var t,e,o,r;super.connectedCallback(),new Set([...null!==(e=null===(t=this[sc])||void 0===t?void 0:t.values())&&void 0!==e?e:[],...[...null!==(r=null===(o=this[ac])||void 0===o?void 0:o.keys())&&void 0!==r?r:[]].map((t=>this.getI18nAttributeValue(t)))].map((t=>null==t?void 0:t.context))).forEach((t=>t&&this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[cc].has(t)||this[cc].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages("string"==typeof t?t:t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[cc].forEach((t=>t())),this[cc].clear()}}return e=cc,nc([$({type:Boolean})],o.prototype,"useCustomMessageContexts",void 0),o}class fc extends(lc(To)){}class pc extends(lc(ir)){}var uc=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class hc extends pc{constructor(){super(),this.editorMode=!1,this.addStore(Ms)}render(){return this.key&&this.context?ce`
|
|
1025
1025
|
<span class="ft-i18n">
|
|
1026
1026
|
${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
|
|
1027
1027
|
</span>
|
|
1028
|
-
`:this.editorMode?"Select a context and a label key.":fe}update(t){var e;super.update(t),this.context&&this.key&&this.addI18nMessages(this.context,{[this.key]:null!==(e=this.defaultMessage)&&void 0!==e?e:""})}}
|
|
1028
|
+
`:this.editorMode?"Select a context and a label key.":fe}update(t){var e;super.update(t),["context","key","defaultMessage"].some((e=>t.has(e)))&&this.context&&this.key&&this.addI18nMessages(this.context,{[this.key]:null!==(e=this.defaultMessage)&&void 0!==e?e:""})}}hc.elementDefinitions={},hc.styles=ic,uc([qo()],hc.prototype,"editorMode",void 0),uc([$()],hc.prototype,"context",void 0),uc([$()],hc.prototype,"key",void 0),uc([K([])],hc.prototype,"args",void 0),uc([$()],hc.prototype,"defaultMessage",void 0);class dc{static build(t){return new dc(t)}static fromGwt(t){return new dc(t)}constructor(t){this.name=t,this.properties=new Proxy({},{get:(t,e)=>{const o=e;return t=>({context:this.name,key:o,args:"function"==typeof t?void 0:t,argsProvider:"function"==typeof t?t:void 0})}}),this.messages=new Proxy({},{get:(t,e)=>(...t)=>_s.resolveMessage(this.name,e,...t)})}}A("ft-i18n")(hc);const yc=dc.build("designedSearchInput"),gc=Et`
|
|
1029
1029
|
* {
|
|
1030
1030
|
box-sizing: border-box;
|
|
1031
1031
|
}
|
|
@@ -1072,11 +1072,11 @@ class os extends Ma{constructor(t){if(super(t),this.et=it,t.type!==Da)throw Erro
|
|
|
1072
1072
|
* @license
|
|
1073
1073
|
* Copyright 2020 Google LLC
|
|
1074
1074
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1075
|
-
*/,{D:
|
|
1075
|
+
*/,{D:bc}=mt,mc=()=>document.createComment(""),vc=(t,e,o)=>{const r=t._$AA.parentNode,i=void 0===e?t._$AB:e._$AA;if(void 0===o){const e=r.insertBefore(mc(),i),n=r.insertBefore(mc(),i);o=new bc(e,n,t,t.options)}else{const e=o._$AB.nextSibling,n=o._$AM,a=n!==t;if(a){let e;o._$AQ?.(t),o._$AM=t,void 0!==o._$AP&&(e=t._$AU)!==n._$AU&&o._$AP(e)}if(e!==i||a){let t=o._$AA;for(;t!==e;){const e=t.nextSibling;r.insertBefore(t,i),t=e}}}return o},xc=(t,e,o=t)=>(t._$AI(e,o),t),Oc={},wc=t=>{t._$AP?.(!1,!0);let e=t._$AA;const o=t._$AB.nextSibling;for(;e!==o;){const t=e.nextSibling;e.remove(),e=t}},Sc=(t,e,o)=>{const r=new Map;for(let i=e;i<=o;i++)r.set(t[i],i);return r},Nc=Pa(class extends Ma{constructor(t){if(super(t),t.type!==Da)throw Error("repeat() can only be used in text expressions")}ht(t,e,o){let r;void 0===o?o=e:void 0!==e&&(r=e);const i=[],n=[];let a=0;for(const e of t)i[a]=r?r(e,a):a,n[a]=o(e,a),a++;return{values:n,keys:i}}render(t,e,o){return this.ht(t,e,o).values}update(t,[e,o,r]){const i=(t=>t._$AH)(t),{values:n,keys:a}=this.ht(e,o,r);if(!Array.isArray(i))return this.dt=a,n;const s=this.dt??=[],c=[];let l,f,p=0,u=i.length-1,h=0,d=n.length-1;for(;p<=u&&h<=d;)if(null===i[p])p++;else if(null===i[u])u--;else if(s[p]===a[h])c[h]=xc(i[p],n[h]),p++,h++;else if(s[u]===a[d])c[d]=xc(i[u],n[d]),u--,d--;else if(s[p]===a[d])c[d]=xc(i[p],n[d]),vc(t,c[d+1],i[p]),p++,d--;else if(s[u]===a[h])c[h]=xc(i[u],n[h]),vc(t,i[p],i[u]),u--,h++;else if(void 0===l&&(l=Sc(a,h,d),f=Sc(s,p,u)),l.has(s[p]))if(l.has(s[u])){const e=f.get(a[h]),o=void 0!==e?i[e]:null;if(null===o){const e=vc(t,i[p]);xc(e,n[h]),c[h]=e}else c[h]=xc(o,n[h]),vc(t,i[p],o),i[e]=null;h++}else wc(i[u]),u--;else wc(i[p]),p++;for(;h<=d;){const e=vc(t,c[d+1]);xc(e,n[h]),c[h++]=e}for(;p<=u;){const t=i[p++];null!==t&&wc(t)}return this.dt=a,((t,e=Oc)=>{t._$AH=e})(t,c),rt}});var Cc=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Ec extends CustomEvent{constructor(t){super("suggestion-selected",{detail:t})}}let Rc=class extends rc{render(){return ce`
|
|
1076
1076
|
<div class="ft-search-input-suggestion ft-word-wrap"
|
|
1077
1077
|
part="container"
|
|
1078
1078
|
@keydown=${t=>this.onSuggestKeyDown(t)}>
|
|
1079
|
-
${
|
|
1079
|
+
${Nc(this.suggestResults||[],(t=>t.value),(t=>ce`
|
|
1080
1080
|
<a href="#"
|
|
1081
1081
|
part="suggestion"
|
|
1082
1082
|
class="ft-search-input-suggestion--suggestion"
|
|
@@ -1088,16 +1088,16 @@ class os extends Ma{constructor(t){if(super(t),this.et=it,t.type!==Da)throw Erro
|
|
|
1088
1088
|
</a>
|
|
1089
1089
|
`))}
|
|
1090
1090
|
</div>
|
|
1091
|
-
`}onSuggestKeyDown(t){var e,o,r,i,n,a;switch(t.key){case"ArrowUp":null===(r=null!==(o=null===(e=this.getFocusedSuggestionElement())||void 0===e?void 0:e.previousElementSibling)&&void 0!==o?o:this.getLastSuggestionElement())||void 0===r||r.focus(),t.preventDefault(),t.stopPropagation();break;case"ArrowDown":null===(a=null!==(n=null===(i=this.getFocusedSuggestionElement())||void 0===i?void 0:i.nextElementSibling)&&void 0!==n?n:this.getFirstSuggestionElement())||void 0===a||a.focus(),t.preventDefault(),t.stopPropagation()}}onSuggestKeyUp(t,e){"Enter"!==t.key&&" "!==t.key||this.onSuggestSelected(t,e)}onSuggestSelected(t,e){t.preventDefault(),this.dispatchEvent(new
|
|
1091
|
+
`}onSuggestKeyDown(t){var e,o,r,i,n,a;switch(t.key){case"ArrowUp":null===(r=null!==(o=null===(e=this.getFocusedSuggestionElement())||void 0===e?void 0:e.previousElementSibling)&&void 0!==o?o:this.getLastSuggestionElement())||void 0===r||r.focus(),t.preventDefault(),t.stopPropagation();break;case"ArrowDown":null===(a=null!==(n=null===(i=this.getFocusedSuggestionElement())||void 0===i?void 0:i.nextElementSibling)&&void 0!==n?n:this.getFirstSuggestionElement())||void 0===a||a.focus(),t.preventDefault(),t.stopPropagation()}}onSuggestKeyUp(t,e){"Enter"!==t.key&&" "!==t.key||this.onSuggestSelected(t,e)}onSuggestSelected(t,e){t.preventDefault(),this.dispatchEvent(new Ec(e))}getIcon(t){const e="DOCUMENT"===t.type?cs.file_format:cs.fluid_topics;let o;switch(t.type){case"MAP":o="BOOK"===t.editorialType?is.BOOK:is.ARTICLE;break;case"DOCUMENT":o=function(t,e){var o,r,i,n;t=(null!=t?t:"").toLowerCase(),e=(null!=e?e:"").toLowerCase();const[a,s]=((null!==(o=ss.get(t))&&void 0!==o?o:t)+"/").split("/");return null!==(n=null!==(i=null!==(r=as.get(s))&&void 0!==r?r:as.get(e))&&void 0!==i?i:as.get(a))&&void 0!==n?n:ns.UNKNOWN}(t.mimeType,t.filenameExtension);break;case"TOPIC":o=is.TOPICS}return ce`
|
|
1092
1092
|
<ft-icon .variant="${e}" .value="${o}" part="suggestion-icon"></ft-icon>
|
|
1093
|
-
`}getFocusedSuggestionElement(){return this.shadowRoot.querySelector(".ft-search-input-suggestion--suggestion:focus-within")}getLastSuggestionElement(){let t=this.shadowRoot.querySelectorAll(".ft-search-input-suggestion--suggestion");return t.length>0?t[t.length-1]:null}getFirstSuggestionElement(){return this.shadowRoot.querySelector(".ft-search-input-suggestion--suggestion")}focusFirstSuggestion(){var t;null===(t=this.getFirstSuggestionElement())||void 0===t||t.focus()}};
|
|
1093
|
+
`}getFocusedSuggestionElement(){return this.shadowRoot.querySelector(".ft-search-input-suggestion--suggestion:focus-within")}getLastSuggestionElement(){let t=this.shadowRoot.querySelectorAll(".ft-search-input-suggestion--suggestion");return t.length>0?t[t.length-1]:null}getFirstSuggestionElement(){return this.shadowRoot.querySelector(".ft-search-input-suggestion--suggestion")}focusFirstSuggestion(){var t;null===(t=this.getFirstSuggestionElement())||void 0===t||t.focus()}};Rc.elementDefinitions={"ft-ripple":Ta,"ft-typography":Xa,"ft-icon":fs},Rc.styles=[Ho,gc],Cc([qo()],Rc.prototype,"suggestResults",void 0),Rc=Cc([(t=>(e,o)=>{void 0!==o?o.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)})("ft-search-input-suggestion")],Rc);var $c=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Uc extends(lc(rc)){constructor(){super(),this.liveQuery="",this.forceCloseSuggestion=!1,this.addI18nContext(yc)}render(){var t,e;let o={"ft-search-input":!0,"ft-search-input--with-suggestions":null!==(e=null===(t=this.suggestResults)||void 0===t?void 0:t.length)&&void 0!==e&&e,"ft-search-input--with-suggestions-closed":this.forceCloseSuggestion};return ce`
|
|
1094
1094
|
<div class="${za(o)}" @focusout=${()=>this.forceCloseSuggestion=!1}>
|
|
1095
1095
|
<div class="ft-search-input--input-container" part="input-container" tabindex="-1">
|
|
1096
1096
|
<div class="ft-search-input--input-outline" part="input-outline">
|
|
1097
1097
|
<input class="ft-search-input--input ft-typography--body2"
|
|
1098
1098
|
part="input"
|
|
1099
1099
|
type="text"
|
|
1100
|
-
placeholder="${
|
|
1100
|
+
placeholder="${yc.messages.placeholder()}"
|
|
1101
1101
|
.value="${this.liveQuery}"
|
|
1102
1102
|
@keydown=${t=>this.onSearchBarKeyDown(t)}
|
|
1103
1103
|
@keyup=${t=>this.onSearchBarKeyUp(t)}>
|
|
@@ -1113,7 +1113,7 @@ class os extends Ma{constructor(t){if(super(t),this.et=it,t.type!==Da)throw Erro
|
|
|
1113
1113
|
part="clear-query"
|
|
1114
1114
|
icon="close"
|
|
1115
1115
|
round dense
|
|
1116
|
-
label="${
|
|
1116
|
+
label="${yc.messages.clearButton()}"
|
|
1117
1117
|
@click=${()=>this.liveQuery=""}
|
|
1118
1118
|
></ft-button>
|
|
1119
1119
|
<div class="ft-search-input--separator"></div>
|
|
@@ -1122,9 +1122,9 @@ class os extends Ma{constructor(t){if(super(t),this.et=it,t.type!==Da)throw Erro
|
|
|
1122
1122
|
part="launch-search-in-input"
|
|
1123
1123
|
icon="search"
|
|
1124
1124
|
round dense
|
|
1125
|
-
label="${
|
|
1125
|
+
label="${yc.messages.searchButton()}"
|
|
1126
1126
|
@click=${()=>this.launchSearch()}
|
|
1127
1127
|
></ft-button>
|
|
1128
1128
|
</div>
|
|
1129
1129
|
</div>
|
|
1130
|
-
`}onSearchBarKeyDown(t){switch(t.key){case"ArrowDown":t.stopPropagation(),t.preventDefault(),this.suggestion.focusFirstSuggestion();break;case"Backspace":t.stopPropagation()}}onSearchBarKeyUp(t){var e,o;if("Backspace"===t.key&&t.stopPropagation(),"Enter"===t.key)null===(e=this.stateManager)||void 0===e||e.setQuery(this.input.value),this.forceCloseSuggestion=!0;else null===(o=this.stateManager)||void 0===o||o.setLiveQuery(this.input.value),this.forceCloseSuggestion=!1}launchSearch(){var t;null===(t=this.stateManager)||void 0===t||t.setQuery(this.liveQuery),this.forceCloseSuggestion=!0}onSuggestionSelected(t){var e;null===(e=this.stateManager)||void 0===e||e.setQuery(t.detail),this.forceCloseSuggestion=!0}}
|
|
1130
|
+
`}onSearchBarKeyDown(t){switch(t.key){case"ArrowDown":t.stopPropagation(),t.preventDefault(),this.suggestion.focusFirstSuggestion();break;case"Backspace":t.stopPropagation()}}onSearchBarKeyUp(t){var e,o;if("Backspace"===t.key&&t.stopPropagation(),"Enter"===t.key)null===(e=this.stateManager)||void 0===e||e.setQuery(this.input.value),this.forceCloseSuggestion=!0;else null===(o=this.stateManager)||void 0===o||o.setLiveQuery(this.input.value),this.forceCloseSuggestion=!1}launchSearch(){var t;null===(t=this.stateManager)||void 0===t||t.setQuery(this.liveQuery),this.forceCloseSuggestion=!0}onSuggestionSelected(t){var e;null===(e=this.stateManager)||void 0===e||e.setQuery(t.detail),this.forceCloseSuggestion=!0}}Uc.elementDefinitions={"ft-search-input-suggestion":Rc,"ft-button":ys},Uc.styles=[ba,xs],$c([qo()],Uc.prototype,"request",void 0),$c([qo()],Uc.prototype,"liveQuery",void 0),$c([qo()],Uc.prototype,"suggestResults",void 0),$c([U()],Uc.prototype,"forceCloseSuggestion",void 0),$c([L(".ft-search-input--input")],Uc.prototype,"input",void 0),$c([L("ft-search-input-suggestion")],Uc.prototype,"suggestion",void 0),A("ft-search-input")(Uc),t.FtSearchInput=Uc,t.FtSearchInputCssVariables=vs,t.styles=xs}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-search-input",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.34",
|
|
4
4
|
"description": "Search bar input for integrated search component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,17 +19,17 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-button": "1.1.
|
|
23
|
-
"@fluid-topics/ft-i18n": "1.1.
|
|
24
|
-
"@fluid-topics/ft-icon": "1.1.
|
|
25
|
-
"@fluid-topics/ft-ripple": "1.1.
|
|
26
|
-
"@fluid-topics/ft-search-context": "1.1.
|
|
27
|
-
"@fluid-topics/ft-typography": "1.1.
|
|
28
|
-
"@fluid-topics/ft-wc-utils": "1.1.
|
|
22
|
+
"@fluid-topics/ft-button": "1.1.34",
|
|
23
|
+
"@fluid-topics/ft-i18n": "1.1.34",
|
|
24
|
+
"@fluid-topics/ft-icon": "1.1.34",
|
|
25
|
+
"@fluid-topics/ft-ripple": "1.1.34",
|
|
26
|
+
"@fluid-topics/ft-search-context": "1.1.34",
|
|
27
|
+
"@fluid-topics/ft-typography": "1.1.34",
|
|
28
|
+
"@fluid-topics/ft-wc-utils": "1.1.34",
|
|
29
29
|
"lit": "3.1.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@fluid-topics/public-api": "1.0.
|
|
32
|
+
"@fluid-topics/public-api": "1.0.59"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "1e947e93e937ded84f056955b14b760e9dea7058"
|
|
35
35
|
}
|