@empathyco/x-components 6.0.0-alpha.3 → 6.0.0-alpha.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.
- package/CHANGELOG.md +283 -1
- package/core/index.js +5 -1
- package/core/index.js.map +1 -1
- package/design-system/deprecated-full-theme.css +1339 -1339
- package/docs/API-reference/api/x-adapter-platform.md +9 -0
- package/docs/API-reference/api/x-adapter-platform.platformadapter.relatedprompts.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.md +22 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.nextqueries.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.suggestiontext.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.type.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsrequest.md +15 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsresponse.data.md +13 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsresponse.md +21 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsresponse.status.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformsearchresponse.catalog.md +6 -0
- package/docs/API-reference/api/x-adapter-platform.platformsearchresponse.md +1 -1
- package/docs/API-reference/api/x-adapter-platform.relatedpromptschema.md +13 -0
- package/docs/API-reference/api/x-adapter-platform.relatedpromptsendpointadapter.md +13 -0
- package/docs/API-reference/api/x-adapter-platform.relatedpromptsrequestmapper.md +13 -0
- package/docs/API-reference/api/x-adapter-platform.relatedpromptsrequestschema.md +13 -0
- package/docs/API-reference/api/x-adapter-platform.relatedpromptsresponsemapper.md +13 -0
- package/docs/API-reference/api/x-adapter-platform.relatedpromptsresponseschema.md +13 -0
- package/docs/API-reference/api/x-components.animationprop.md +6 -1
- package/docs/API-reference/api/x-components.bannerslist.md +3 -3
- package/docs/API-reference/api/x-components.basedropdown.md +5 -5
- package/docs/API-reference/api/x-components.baseeventsmodal.md +2 -2
- package/docs/API-reference/api/x-components.basegrid.md +3 -3
- package/docs/API-reference/api/x-components.baseheadertogglepanel.md +5 -5
- package/docs/API-reference/api/x-components.baseidmodal.md +2 -2
- package/docs/API-reference/api/x-components.baseidtogglepanel.md +5 -5
- package/docs/API-reference/api/x-components.basemodal.md +10 -10
- package/docs/API-reference/api/x-components.baseresultimage.md +9 -9
- package/docs/API-reference/api/x-components.baseslider.md +70 -0
- package/docs/API-reference/api/x-components.basesuggestions.md +3 -3
- package/docs/API-reference/api/x-components.basetabspanel.md +8 -8
- package/docs/API-reference/api/x-components.basetogglepanel.md +3 -3
- package/docs/API-reference/api/x-components.basevariablecolumngrid.md +3 -3
- package/docs/API-reference/api/x-components.cancelfetchandsaverelatedprompts.md +13 -0
- package/docs/API-reference/api/x-components.configmutations.config.md +11 -0
- package/docs/API-reference/api/x-components.configmutations.md +29 -0
- package/docs/API-reference/api/x-components.configmutations.mergeconfig.md +24 -0
- package/docs/API-reference/api/x-components.configmutations.setconfig.md +24 -0
- package/docs/API-reference/api/x-components.createrelatedtagsquerygetter.md +26 -0
- package/docs/API-reference/api/x-components.createrelatedtagsquerygetteroptions.getrelatedtags.md +13 -0
- package/docs/API-reference/api/x-components.createrelatedtagsquerygetteroptions.md +20 -0
- package/docs/API-reference/api/x-components.empathize.md +5 -5
- package/docs/API-reference/api/x-components.empathizemutations.md +1 -1
- package/docs/API-reference/api/x-components.facets.md +3 -3
- package/docs/API-reference/api/x-components.facetsmutations.md +1 -1
- package/docs/API-reference/api/x-components.fetchandsaverelatedprompts.md +13 -0
- package/docs/API-reference/api/x-components.fetchrelatedprompts.md +13 -0
- package/docs/API-reference/api/x-components.filterslist.md +3 -3
- package/docs/API-reference/api/x-components.globalxbus.md +6 -0
- package/docs/API-reference/api/x-components.hierarchicalfilter.md +5 -2
- package/docs/API-reference/api/x-components.historyqueriesmutations.md +1 -1
- package/docs/API-reference/api/x-components.historyqueriesstate.md +1 -1
- package/docs/API-reference/api/x-components.identifierresults.md +3 -3
- package/docs/API-reference/api/x-components.identifierresultsmutations.md +1 -1
- package/docs/API-reference/api/x-components.identifierresultsstate.md +1 -1
- package/docs/API-reference/api/x-components.installxoptions.domelement.md +1 -1
- package/docs/API-reference/api/x-components.installxoptions.installextraplugins.md +2 -2
- package/docs/API-reference/api/x-components.installxoptions.md +1 -1
- package/docs/API-reference/api/x-components.itemslist.md +3 -3
- package/docs/API-reference/api/x-components.mainmodal.md +2 -2
- package/docs/API-reference/api/x-components.md +26 -1
- package/docs/API-reference/api/x-components.mergeconfig.md +27 -0
- package/docs/API-reference/api/x-components.multicolumnmaxwidthlayout.md +5 -5
- package/docs/API-reference/api/x-components.myhistory.md +3 -3
- package/docs/API-reference/api/x-components.nextqueriesgroup.md +22 -0
- package/docs/API-reference/api/x-components.nextqueriesgroup.modelname.md +11 -0
- package/docs/API-reference/api/x-components.nextqueriesgroup.nextqueries.md +11 -0
- package/docs/API-reference/api/x-components.nextquerieslist.md +3 -3
- package/docs/API-reference/api/x-components.nextqueriesmutations.md +1 -1
- package/docs/API-reference/api/x-components.nextqueriesstate.md +1 -1
- package/docs/API-reference/api/x-components.partialresultslist.md +3 -3
- package/docs/API-reference/api/x-components.popularsearchesmutations.md +1 -1
- package/docs/API-reference/api/x-components.promotedslist.md +3 -3
- package/docs/API-reference/api/x-components.queriespreviewmutations.md +1 -1
- package/docs/API-reference/api/x-components.querymutations.md +20 -0
- package/docs/API-reference/api/x-components.querymutations.setquery.md +24 -0
- package/docs/API-reference/api/x-components.querypreviewlist.md +3 -3
- package/docs/API-reference/api/x-components.querystate.md +20 -0
- package/docs/API-reference/api/x-components.querystate.query.md +13 -0
- package/docs/API-reference/api/x-components.querysuggestionsmutations.md +1 -1
- package/docs/API-reference/api/x-components.querysuggestionsstate.md +1 -1
- package/docs/API-reference/api/x-components.recommendations.md +3 -3
- package/docs/API-reference/api/x-components.recommendationsmutations.md +1 -1
- package/docs/API-reference/api/x-components.relatedprompt.md +54 -0
- package/docs/API-reference/api/x-components.relatedpromptrequest.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsactioncontext.md +15 -0
- package/docs/API-reference/api/x-components.relatedpromptsactions.cancelfetchandsaverelatedprompts.md +17 -0
- package/docs/API-reference/api/x-components.relatedpromptsactions.fetchandsaverelatedprompts.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsactions.fetchrelatedprompts.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsactions.md +22 -0
- package/docs/API-reference/api/x-components.relatedpromptsgetters.md +20 -0
- package/docs/API-reference/api/x-components.relatedpromptsgetters.request.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptslist.md +72 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.md +26 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.resetrelatedpromptsstate.md +17 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.resetselectedprompt.md +17 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.setparams.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.setrelatedpromptsproducts.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.setselectedprompt.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.setselectedquery.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsstate.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsstate.params.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsstate.relatedprompts.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsstate.selectedprompt.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsstate.selectedquery.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptstaglist.md +22 -0
- package/docs/API-reference/api/x-components.relatedpromptsxevents.md +22 -0
- package/docs/API-reference/api/x-components.relatedpromptsxevents.relatedpromptsrequestupdated.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsxevents.userselectedarelatedprompt.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsxevents.userselectedarelatedpromptquery.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsxmodule.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsxstoremodule.md +15 -0
- package/docs/API-reference/api/x-components.relatedtags.md +3 -3
- package/docs/API-reference/api/x-components.relatedtagsmutations.md +1 -1
- package/docs/API-reference/api/x-components.relatedtagsstate.md +1 -1
- package/docs/API-reference/api/x-components.resultslist.md +3 -3
- package/docs/API-reference/api/x-components.scrolltotop.md +5 -5
- package/docs/API-reference/api/x-components.searchboxmutations.md +1 -1
- package/docs/API-reference/api/x-components.searchboxstate.md +1 -1
- package/docs/API-reference/api/x-components.searchinputplaceholder.md +3 -3
- package/docs/API-reference/api/x-components.searchmutations.md +2 -1
- package/docs/API-reference/api/x-components.searchmutations.setstats.md +24 -0
- package/docs/API-reference/api/x-components.searchstate.md +2 -1
- package/docs/API-reference/api/x-components.searchstate.stats.md +13 -0
- package/docs/API-reference/api/x-components.selectedfilterslist.md +3 -3
- package/docs/API-reference/api/x-components.semanticqueriesmutations.md +1 -1
- package/docs/API-reference/api/x-components.semanticqueriesstate.md +1 -1
- package/docs/API-reference/api/x-components.setconfig.md +27 -0
- package/docs/API-reference/api/x-components.setquery.md +25 -0
- package/docs/API-reference/api/x-components.simplefilter.md +3 -0
- package/docs/API-reference/api/x-components.singlecolumnlayout.md +3 -3
- package/docs/API-reference/api/x-components.snippetcallbacks.md +3 -0
- package/docs/API-reference/api/x-components.snippetconfigextraparams.md +1 -1
- package/docs/API-reference/api/x-components.sortdropdown.md +1 -1
- package/docs/API-reference/api/x-components.tagging.md +17 -4
- package/docs/API-reference/api/x-components.taggingmutations.md +1 -1
- package/docs/API-reference/api/x-components.urlmutations.md +1 -1
- package/docs/API-reference/api/x-components.urlstate.md +1 -1
- package/docs/API-reference/api/x-components.usealiasapi.md +1 -0
- package/docs/API-reference/api/x-components.usealiasapi.pricestats.md +16 -0
- package/docs/API-reference/api/x-components.xeventstypes.md +3 -3
- package/docs/API-reference/api/x-components.xmodulestree.md +1 -0
- package/docs/API-reference/api/x-components.xmodulestree.relatedprompts.md +11 -0
- package/docs/API-reference/api/x-types.md +4 -0
- package/docs/API-reference/api/x-types.relatedprompt.md +23 -0
- package/docs/API-reference/api/x-types.relatedprompt.nextqueries.md +13 -0
- package/docs/API-reference/api/x-types.relatedprompt.suggestiontext.md +13 -0
- package/docs/API-reference/api/x-types.relatedprompt.type.md +13 -0
- package/docs/API-reference/api/x-types.relatedpromptsrequest.md +15 -0
- package/docs/API-reference/api/x-types.relatedpromptsresponse.md +20 -0
- package/docs/API-reference/api/x-types.relatedpromptsresponse.relatedprompts.md +11 -0
- package/docs/API-reference/api/x-types.searchresponse.md +1 -0
- package/docs/API-reference/api/x-types.searchresponse.stats.md +11 -0
- package/docs/API-reference/api/x-types.stats.md +22 -0
- package/docs/API-reference/api/x-types.stats.price.md +14 -0
- package/docs/API-reference/api/x-types.xcomponentsadapter.md +1 -0
- package/docs/API-reference/api/x-types.xcomponentsadapter.relatedprompts.md +11 -0
- package/docs/API-reference/components/common/result/x-components.base-result-image.md +2 -2
- package/docs/API-reference/components/common/x-components.base-slider.md +189 -0
- package/docs/API-reference/components/common/x-components.items-list.md +1 -1
- package/docs/API-reference/components/facets/x-components.facets/facets.md +1 -1
- package/docs/API-reference/components/facets/x-components.lists/selected-filters-list.md +1 -1
- package/docs/API-reference/components/related-prompts/x-components.related-prompt.md +26 -0
- package/docs/API-reference/components/related-prompts/x-components.related-prompts-list.md +196 -0
- package/docs/API-reference/components/related-prompts/x-components.related-prompts-tag-list.md +23 -0
- package/docs/API-reference/components/search/x-components.results-list.md +1 -1
- package/docs/API-reference/components/tagging/x-components.tagging.md +2 -2
- package/js/components/animations/fade-and-slide.vue.js +1 -2
- package/js/components/animations/fade-and-slide.vue.js.map +1 -1
- package/js/components/base-dropdown.vue.js +1 -3
- package/js/components/base-dropdown.vue.js.map +1 -1
- package/js/components/base-dropdown.vue2.js +1 -7
- package/js/components/base-dropdown.vue2.js.map +1 -1
- package/js/components/base-event-button.vue.js +1 -2
- package/js/components/base-event-button.vue.js.map +1 -1
- package/js/components/base-grid.vue.js +11 -18
- package/js/components/base-grid.vue.js.map +1 -1
- package/js/components/base-grid.vue2.js.map +1 -1
- package/js/components/base-grid.vue3.js +1 -1
- package/js/components/base-keyboard-navigation.vue.js +1 -2
- package/js/components/base-keyboard-navigation.vue.js.map +1 -1
- package/js/components/base-rating.vue.js +1 -3
- package/js/components/base-rating.vue.js.map +1 -1
- package/js/components/base-slider.vue.js +65 -0
- package/js/components/base-slider.vue.js.map +1 -0
- package/js/components/base-slider.vue2.js +109 -0
- package/js/components/base-slider.vue2.js.map +1 -0
- package/js/components/base-slider.vue3.js +7 -0
- package/js/components/base-slider.vue3.js.map +1 -0
- package/js/components/base-variable-column-grid.vue.js +1 -2
- package/js/components/base-variable-column-grid.vue.js.map +1 -1
- package/js/components/column-picker/base-column-picker-dropdown.vue.js +1 -3
- package/js/components/column-picker/base-column-picker-dropdown.vue.js.map +1 -1
- package/js/components/column-picker/base-column-picker-list.vue.js +1 -3
- package/js/components/column-picker/base-column-picker-list.vue.js.map +1 -1
- package/js/components/filters/labels/base-rating-filter-label.vue.js +1 -3
- package/js/components/filters/labels/base-rating-filter-label.vue.js.map +1 -1
- package/js/components/icons/cross-tiny.vue.js +2 -2
- package/js/components/icons/plus.vue.js +2 -2
- package/js/components/items-list.vue.js +1 -2
- package/js/components/items-list.vue.js.map +1 -1
- package/js/components/items-list.vue2.js +2 -2
- package/js/components/items-list.vue2.js.map +1 -1
- package/js/components/layouts/fixed-header-and-asides-layout.vue.js +1 -7
- package/js/components/layouts/fixed-header-and-asides-layout.vue.js.map +1 -1
- package/js/components/layouts/multi-column-max-width-layout.vue.js +1 -9
- package/js/components/layouts/multi-column-max-width-layout.vue.js.map +1 -1
- package/js/components/layouts/single-column-layout.vue.js +1 -9
- package/js/components/layouts/single-column-layout.vue.js.map +1 -1
- package/js/components/modals/base-events-modal-close.vue.js +1 -2
- package/js/components/modals/base-events-modal-close.vue.js.map +1 -1
- package/js/components/modals/base-events-modal-open.vue.js +1 -2
- package/js/components/modals/base-events-modal-open.vue.js.map +1 -1
- package/js/components/modals/base-id-modal-close.vue.js +1 -2
- package/js/components/modals/base-id-modal-close.vue.js.map +1 -1
- package/js/components/modals/base-id-modal-open.vue.js +1 -2
- package/js/components/modals/base-id-modal-open.vue.js.map +1 -1
- package/js/components/modals/base-modal.vue.js +1 -2
- package/js/components/modals/base-modal.vue.js.map +1 -1
- package/js/components/modals/base-modal.vue2.js +13 -6
- package/js/components/modals/base-modal.vue2.js.map +1 -1
- package/js/components/page-loader-button.vue.js +1 -4
- package/js/components/page-loader-button.vue.js.map +1 -1
- package/js/components/panels/base-header-toggle-panel.vue.js +1 -5
- package/js/components/panels/base-header-toggle-panel.vue.js.map +1 -1
- package/js/components/panels/base-id-toggle-panel-button.vue.js +1 -2
- package/js/components/panels/base-id-toggle-panel-button.vue.js.map +1 -1
- package/js/components/panels/base-id-toggle-panel.vue.js +1 -2
- package/js/components/panels/base-id-toggle-panel.vue.js.map +1 -1
- package/js/components/panels/base-tabs-panel.vue.js +1 -4
- package/js/components/panels/base-tabs-panel.vue.js.map +1 -1
- package/js/components/panels/base-toggle-panel.vue.js +1 -2
- package/js/components/panels/base-toggle-panel.vue.js.map +1 -1
- package/js/components/result/base-result-add-to-cart.vue.js +1 -2
- package/js/components/result/base-result-add-to-cart.vue.js.map +1 -1
- package/js/components/result/base-result-current-price.vue.js +1 -2
- package/js/components/result/base-result-current-price.vue.js.map +1 -1
- package/js/components/result/base-result-image.vue.js +39 -59
- package/js/components/result/base-result-image.vue.js.map +1 -1
- package/js/components/result/base-result-image.vue2.js +5 -5
- package/js/components/result/base-result-image.vue2.js.map +1 -1
- package/js/components/result/base-result-link.vue.js +1 -2
- package/js/components/result/base-result-link.vue.js.map +1 -1
- package/js/components/result/base-result-previous-price.vue.js +1 -2
- package/js/components/result/base-result-previous-price.vue.js.map +1 -1
- package/js/components/result/base-result-rating.vue.js +1 -4
- package/js/components/result/base-result-rating.vue.js.map +1 -1
- package/js/components/result/result-variant-selector.vue.js +1 -3
- package/js/components/result/result-variant-selector.vue.js.map +1 -1
- package/js/components/sliding-panel.vue.js +3 -6
- package/js/components/sliding-panel.vue.js.map +1 -1
- package/js/components/suggestions/base-suggestion.vue.js +1 -2
- package/js/components/suggestions/base-suggestion.vue.js.map +1 -1
- package/js/components/suggestions/base-suggestions.vue.js +1 -2
- package/js/components/suggestions/base-suggestions.vue.js.map +1 -1
- package/js/composables/use-alias-api.js +4 -1
- package/js/composables/use-alias-api.js.map +1 -1
- package/js/composables/use-getter.js +1 -1
- package/js/composables/use-state.js +1 -1
- package/js/index.js +15 -1
- package/js/index.js.map +1 -1
- package/js/types/animation-prop.js +5 -0
- package/js/types/animation-prop.js.map +1 -1
- package/js/x-installer/x-installer/x-installer.js +3 -3
- package/js/x-installer/x-installer/x-installer.js.map +1 -1
- package/js/x-modules/device/store/emitters.js +1 -0
- package/js/x-modules/device/store/emitters.js.map +1 -1
- package/js/x-modules/empathize/components/empathize.vue.js +1 -2
- package/js/x-modules/empathize/components/empathize.vue.js.map +1 -1
- package/js/x-modules/empathize/components/empathize.vue2.js +2 -0
- package/js/x-modules/empathize/components/empathize.vue2.js.map +1 -1
- package/js/x-modules/empathize/store/emitters.js +1 -0
- package/js/x-modules/empathize/store/emitters.js.map +1 -1
- package/js/x-modules/experience-controls/store/emitters.js +1 -0
- package/js/x-modules/experience-controls/store/emitters.js.map +1 -1
- package/js/x-modules/extra-params/components/snippet-config-extra-params.vue.js.map +1 -1
- package/js/x-modules/extra-params/components/snippet-config-extra-params.vue2.js +1 -1
- package/js/x-modules/extra-params/components/snippet-config-extra-params.vue2.js.map +1 -1
- package/js/x-modules/extra-params/store/emitters.js +1 -0
- package/js/x-modules/extra-params/store/emitters.js.map +1 -1
- package/js/x-modules/facets/components/facets/facets.vue.js +20 -33
- package/js/x-modules/facets/components/facets/facets.vue.js.map +1 -1
- package/js/x-modules/facets/components/facets/facets.vue2.js +2 -2
- package/js/x-modules/facets/components/facets/facets.vue2.js.map +1 -1
- package/js/x-modules/facets/components/filters/all-filter.vue.js +1 -2
- package/js/x-modules/facets/components/filters/all-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/editable-number-range-filter.vue.js +1 -6
- package/js/x-modules/facets/components/filters/editable-number-range-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/hierarchical-filter.vue.js +1 -3
- package/js/x-modules/facets/components/filters/hierarchical-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/number-range-filter.vue.js +1 -3
- package/js/x-modules/facets/components/filters/number-range-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/simple-filter.vue.js +1 -3
- package/js/x-modules/facets/components/filters/simple-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/lists/filters-list.vue.js +1 -2
- package/js/x-modules/facets/components/lists/filters-list.vue.js.map +1 -1
- package/js/x-modules/facets/components/lists/filters-search.vue.js +1 -3
- package/js/x-modules/facets/components/lists/filters-search.vue.js.map +1 -1
- package/js/x-modules/facets/components/lists/selected-filters-list.vue.js +11 -18
- package/js/x-modules/facets/components/lists/selected-filters-list.vue.js.map +1 -1
- package/js/x-modules/facets/components/lists/selected-filters-list.vue2.js +2 -2
- package/js/x-modules/facets/components/lists/selected-filters-list.vue2.js.map +1 -1
- package/js/x-modules/facets/components/lists/sliced-filters.vue.js +1 -4
- package/js/x-modules/facets/components/lists/sliced-filters.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/clear-history-queries.vue.js +1 -2
- package/js/x-modules/history-queries/components/clear-history-queries.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/history-queries.vue.js +1 -10
- package/js/x-modules/history-queries/components/history-queries.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/history-query.vue.js +1 -6
- package/js/x-modules/history-queries/components/history-query.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/my-history.vue.js +1 -4
- package/js/x-modules/history-queries/components/my-history.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/remove-history-query.vue.js +1 -2
- package/js/x-modules/history-queries/components/remove-history-query.vue.js.map +1 -1
- package/js/x-modules/history-queries/store/emitters.js +1 -0
- package/js/x-modules/history-queries/store/emitters.js.map +1 -1
- package/js/x-modules/identifier-results/components/identifier-results.vue.js +1 -2
- package/js/x-modules/identifier-results/components/identifier-results.vue.js.map +1 -1
- package/js/x-modules/identifier-results/store/emitters.js +1 -0
- package/js/x-modules/identifier-results/store/emitters.js.map +1 -1
- package/js/x-modules/next-queries/components/next-queries.vue.js +1 -7
- package/js/x-modules/next-queries/components/next-queries.vue.js.map +1 -1
- package/js/x-modules/next-queries/components/next-query-preview.vue.js +1 -3
- package/js/x-modules/next-queries/components/next-query-preview.vue.js.map +1 -1
- package/js/x-modules/next-queries/components/next-query.vue.js +1 -4
- package/js/x-modules/next-queries/components/next-query.vue.js.map +1 -1
- package/js/x-modules/next-queries/store/emitters.js +1 -0
- package/js/x-modules/next-queries/store/emitters.js.map +1 -1
- package/js/x-modules/popular-searches/components/popular-search.vue.js +1 -4
- package/js/x-modules/popular-searches/components/popular-search.vue.js.map +1 -1
- package/js/x-modules/popular-searches/components/popular-searches.vue.js +1 -7
- package/js/x-modules/popular-searches/components/popular-searches.vue.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview-button.vue.js +1 -2
- package/js/x-modules/queries-preview/components/query-preview-button.vue.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview-button.vue2.js +2 -0
- package/js/x-modules/queries-preview/components/query-preview-button.vue2.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview-list.vue.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview-list.vue2.js +15 -2
- package/js/x-modules/queries-preview/components/query-preview-list.vue2.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview.vue.js +1 -2
- package/js/x-modules/queries-preview/components/query-preview.vue.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview.vue2.js +3 -1
- package/js/x-modules/queries-preview/components/query-preview.vue2.js.map +1 -1
- package/js/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.js +2 -1
- package/js/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.js.map +1 -1
- package/js/x-modules/queries-preview/store/emitters.js +1 -0
- package/js/x-modules/queries-preview/store/emitters.js.map +1 -1
- package/js/x-modules/queries-preview/store/module.js +1 -1
- package/js/x-modules/queries-preview/store/module.js.map +1 -1
- package/js/x-modules/queries-preview/utils/get-hash-from-query-preview.js +6 -4
- package/js/x-modules/queries-preview/utils/get-hash-from-query-preview.js.map +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestion.vue.js +1 -4
- package/js/x-modules/query-suggestions/components/query-suggestion.vue.js.map +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestions.vue.js +1 -7
- package/js/x-modules/query-suggestions/components/query-suggestions.vue.js.map +1 -1
- package/js/x-modules/query-suggestions/store/emitters.js +1 -0
- package/js/x-modules/query-suggestions/store/emitters.js.map +1 -1
- package/js/x-modules/recommendations/components/recommendations.vue.js +1 -2
- package/js/x-modules/recommendations/components/recommendations.vue.js.map +1 -1
- package/js/x-modules/recommendations/store/emitters.js +1 -0
- package/js/x-modules/recommendations/store/emitters.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompt.vue.js +52 -0
- package/js/x-modules/related-prompts/components/related-prompt.vue.js.map +1 -0
- package/js/x-modules/related-prompts/components/related-prompt.vue2.js +62 -0
- package/js/x-modules/related-prompts/components/related-prompt.vue2.js.map +1 -0
- package/js/x-modules/related-prompts/components/related-prompts-list.vue.js +154 -0
- package/js/x-modules/related-prompts/components/related-prompts-list.vue.js.map +1 -0
- package/js/x-modules/related-prompts/components/related-prompts-list.vue2.js +6 -0
- package/js/x-modules/related-prompts/components/related-prompts-list.vue2.js.map +1 -0
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue.js +80 -0
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue.js.map +1 -0
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js +55 -0
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js.map +1 -0
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue3.js +7 -0
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue3.js.map +1 -0
- package/js/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.js +29 -0
- package/js/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.js.map +1 -0
- package/js/x-modules/related-prompts/store/actions/fetch-related-prompts.action.js +20 -0
- package/js/x-modules/related-prompts/store/actions/fetch-related-prompts.action.js.map +1 -0
- package/js/x-modules/related-prompts/store/emitters.js +15 -0
- package/js/x-modules/related-prompts/store/emitters.js.map +1 -0
- package/js/x-modules/related-prompts/store/getters/request.getter.js +16 -0
- package/js/x-modules/related-prompts/store/getters/request.getter.js.map +1 -0
- package/js/x-modules/related-prompts/store/module.js +61 -0
- package/js/x-modules/related-prompts/store/module.js.map +1 -0
- package/js/x-modules/related-prompts/wiring.js +98 -0
- package/js/x-modules/related-prompts/wiring.js.map +1 -0
- package/js/x-modules/related-prompts/x-module.js +21 -0
- package/js/x-modules/related-prompts/x-module.js.map +1 -0
- package/js/x-modules/related-tags/components/related-tag.vue.js +1 -2
- package/js/x-modules/related-tags/components/related-tag.vue.js.map +1 -1
- package/js/x-modules/related-tags/components/related-tags.vue.js +1 -4
- package/js/x-modules/related-tags/components/related-tags.vue.js.map +1 -1
- package/js/x-modules/related-tags/store/emitters.js +1 -0
- package/js/x-modules/related-tags/store/emitters.js.map +1 -1
- package/js/x-modules/scroll/components/scroll-to-top.vue.js +1 -2
- package/js/x-modules/scroll/components/scroll-to-top.vue.js.map +1 -1
- package/js/x-modules/scroll/components/scroll-to-top.vue2.js +2 -0
- package/js/x-modules/scroll/components/scroll-to-top.vue2.js.map +1 -1
- package/js/x-modules/scroll/store/emitters.js +1 -0
- package/js/x-modules/scroll/store/emitters.js.map +1 -1
- package/js/x-modules/search/components/partial-results-list.vue.js +1 -2
- package/js/x-modules/search/components/partial-results-list.vue.js.map +1 -1
- package/js/x-modules/search/components/results-list.vue.js +2 -2
- package/js/x-modules/search/components/results-list.vue.js.map +1 -1
- package/js/x-modules/search/components/sort-dropdown.vue.js +1 -3
- package/js/x-modules/search/components/sort-dropdown.vue.js.map +1 -1
- package/js/x-modules/search/store/actions/save-search-response.action.js +2 -1
- package/js/x-modules/search/store/actions/save-search-response.action.js.map +1 -1
- package/js/x-modules/search/store/emitters.js +1 -0
- package/js/x-modules/search/store/emitters.js.map +1 -1
- package/js/x-modules/search/store/module.js +7 -2
- package/js/x-modules/search/store/module.js.map +1 -1
- package/js/x-modules/search-box/components/clear-search-input.vue.js +1 -2
- package/js/x-modules/search-box/components/clear-search-input.vue.js.map +1 -1
- package/js/x-modules/search-box/components/search-button.vue.js +1 -2
- package/js/x-modules/search-box/components/search-button.vue.js.map +1 -1
- package/js/x-modules/search-box/store/emitters.js +1 -0
- package/js/x-modules/search-box/store/emitters.js.map +1 -1
- package/js/x-modules/semantic-queries/components/semantic-queries.vue.js +1 -3
- package/js/x-modules/semantic-queries/components/semantic-queries.vue.js.map +1 -1
- package/js/x-modules/semantic-queries/components/semantic-query.vue.js +1 -4
- package/js/x-modules/semantic-queries/components/semantic-query.vue.js.map +1 -1
- package/js/x-modules/tagging/components/tagging.vue.js +8 -2
- package/js/x-modules/tagging/components/tagging.vue.js.map +1 -1
- package/js/x-modules/url/store/emitters.js +1 -0
- package/js/x-modules/url/store/emitters.js.map +1 -1
- package/package.json +7 -6
- package/related-prompts/index.d.ts +1 -0
- package/related-prompts/index.js +10 -0
- package/report/x-adapter-platform.api.json +575 -1
- package/report/x-components.api.json +4962 -7798
- package/report/x-components.api.md +536 -167
- package/report/x-types.api.json +334 -0
- package/tools/inject-css.js +5 -3
- package/types/adapter/e2e-adapter.d.ts.map +1 -1
- package/types/adapter/mocked-responses.d.ts +3 -0
- package/types/adapter/mocked-responses.d.ts.map +1 -1
- package/types/components/base-dropdown.vue.d.ts +5 -5
- package/types/components/base-dropdown.vue.d.ts.map +1 -1
- package/types/components/base-grid.vue.d.ts +3 -3
- package/types/components/base-slider.vue.d.ts +74 -0
- package/types/components/base-slider.vue.d.ts.map +1 -0
- package/types/components/base-variable-column-grid.vue.d.ts +3 -3
- package/types/components/global-x-bus.vue.d.ts +6 -0
- package/types/components/global-x-bus.vue.d.ts.map +1 -1
- package/types/components/index.d.ts +1 -0
- package/types/components/index.d.ts.map +1 -1
- package/types/components/items-list.vue.d.ts +3 -3
- package/types/components/layouts/multi-column-max-width-layout.vue.d.ts +5 -5
- package/types/components/layouts/single-column-layout.vue.d.ts +3 -3
- package/types/components/modals/base-events-modal.vue.d.ts +2 -2
- package/types/components/modals/base-id-modal.vue.d.ts +2 -2
- package/types/components/modals/base-modal.vue.d.ts +10 -10
- package/types/components/modals/base-modal.vue.d.ts.map +1 -1
- package/types/components/modals/main-modal.vue.d.ts +2 -2
- package/types/components/panels/base-header-toggle-panel.vue.d.ts +5 -5
- package/types/components/panels/base-id-toggle-panel.vue.d.ts +5 -5
- package/types/components/panels/base-tabs-panel.vue.d.ts +8 -8
- package/types/components/panels/base-toggle-panel.vue.d.ts +3 -3
- package/types/components/result/base-result-image.vue.d.ts +10 -10
- package/types/components/result/base-result-image.vue.d.ts.map +1 -1
- package/types/components/snippet-callbacks.vue.d.ts +3 -0
- package/types/components/snippet-callbacks.vue.d.ts.map +1 -1
- package/types/components/suggestions/base-suggestions.vue.d.ts +3 -3
- package/types/composables/use-alias-api.d.ts +5 -0
- package/types/composables/use-alias-api.d.ts.map +1 -1
- package/types/composables/use-store.d.ts +2 -2
- package/types/composables/use-store.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/store/index.d.ts +4 -1
- package/types/store/index.d.ts.map +1 -1
- package/types/tailwind/plugin-options.d.ts +1 -2
- package/types/tailwind/plugin-options.d.ts.map +1 -1
- package/types/types/animation-prop.d.ts +6 -2
- package/types/types/animation-prop.d.ts.map +1 -1
- package/types/views/home/types.d.ts +3 -0
- package/types/views/home/types.d.ts.map +1 -1
- package/types/wiring/events.types.d.ts +3 -1
- package/types/wiring/events.types.d.ts.map +1 -1
- package/types/x-installer/x-installer/types.d.ts +2 -2
- package/types/x-installer/x-installer/types.d.ts.map +1 -1
- package/types/x-installer/x-installer/x-installer.d.ts +4 -4
- package/types/x-installer/x-installer/x-installer.d.ts.map +1 -1
- package/types/x-modules/empathize/components/empathize.vue.d.ts +5 -5
- package/types/x-modules/extra-params/components/snippet-config-extra-params.vue.d.ts +1 -1
- package/types/x-modules/facets/components/facets/facets.vue.d.ts +3 -3
- package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts +5 -2
- package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts +3 -0
- package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/lists/filters-list.vue.d.ts +3 -3
- package/types/x-modules/facets/components/lists/selected-filters-list.vue.d.ts +3 -3
- package/types/x-modules/history-queries/components/my-history.vue.d.ts +3 -3
- package/types/x-modules/identifier-results/components/identifier-results.vue.d.ts +3 -3
- package/types/x-modules/next-queries/components/next-queries-list.vue.d.ts +3 -3
- package/types/x-modules/next-queries/index.d.ts +1 -0
- package/types/x-modules/next-queries/index.d.ts.map +1 -1
- package/types/x-modules/queries-preview/components/query-preview-list.vue.d.ts +3 -3
- package/types/x-modules/queries-preview/components/query-preview-list.vue.d.ts.map +1 -1
- package/types/x-modules/queries-preview/components/query-preview.vue.d.ts.map +1 -1
- package/types/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.d.ts.map +1 -1
- package/types/x-modules/queries-preview/store/module.d.ts.map +1 -1
- package/types/x-modules/queries-preview/utils/get-hash-from-query-preview.d.ts +4 -2
- package/types/x-modules/queries-preview/utils/get-hash-from-query-preview.d.ts.map +1 -1
- package/types/x-modules/recommendations/components/recommendations.vue.d.ts +3 -3
- package/types/x-modules/related-prompts/components/index.d.ts +4 -0
- package/types/x-modules/related-prompts/components/index.d.ts.map +1 -0
- package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts +51 -0
- package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts.map +1 -0
- package/types/x-modules/related-prompts/components/related-prompts-list.vue.d.ts +106 -0
- package/types/x-modules/related-prompts/components/related-prompts-list.vue.d.ts.map +1 -0
- package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts +14 -0
- package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts.map +1 -0
- package/types/x-modules/related-prompts/events.types.d.ts +26 -0
- package/types/x-modules/related-prompts/events.types.d.ts.map +1 -0
- package/types/x-modules/related-prompts/index.d.ts +6 -0
- package/types/x-modules/related-prompts/index.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.d.ts +17 -0
- package/types/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/actions/fetch-related-prompts.action.d.ts +13 -0
- package/types/x-modules/related-prompts/store/actions/fetch-related-prompts.action.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/emitters.d.ts +9 -0
- package/types/x-modules/related-prompts/store/emitters.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/getters/request.getter.d.ts +13 -0
- package/types/x-modules/related-prompts/store/getters/request.getter.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/index.d.ts +7 -0
- package/types/x-modules/related-prompts/store/index.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/module.d.ts +8 -0
- package/types/x-modules/related-prompts/store/module.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/types.d.ts +108 -0
- package/types/x-modules/related-prompts/store/types.d.ts.map +1 -0
- package/types/x-modules/related-prompts/types.d.ts +10 -0
- package/types/x-modules/related-prompts/types.d.ts.map +1 -0
- package/types/x-modules/related-prompts/wiring.d.ts +37 -0
- package/types/x-modules/related-prompts/wiring.d.ts.map +1 -0
- package/types/x-modules/related-prompts/x-module.d.ts +16 -0
- package/types/x-modules/related-prompts/x-module.d.ts.map +1 -0
- package/types/x-modules/related-tags/components/related-tags.vue.d.ts +3 -3
- package/types/x-modules/scroll/components/scroll-to-top.vue.d.ts +5 -5
- package/types/x-modules/search/components/banners-list.vue.d.ts +3 -3
- package/types/x-modules/search/components/partial-results-list.vue.d.ts +3 -3
- package/types/x-modules/search/components/promoteds-list.vue.d.ts +3 -3
- package/types/x-modules/search/components/results-list.vue.d.ts +3 -3
- package/types/x-modules/search/components/sort-dropdown.vue.d.ts +1 -1
- package/types/x-modules/search/store/actions/save-search-response.action.d.ts.map +1 -1
- package/types/x-modules/search/store/module.d.ts +2 -0
- package/types/x-modules/search/store/module.d.ts.map +1 -1
- package/types/x-modules/search/store/types.d.ts +9 -1
- package/types/x-modules/search/store/types.d.ts.map +1 -1
- package/types/x-modules/search-box/components/search-input-placeholder.vue.d.ts +3 -3
- package/types/x-modules/tagging/components/tagging.vue.d.ts +17 -4
- package/types/x-modules/tagging/components/tagging.vue.d.ts.map +1 -1
- package/types/x-modules/x-modules.types.d.ts +2 -0
- package/types/x-modules/x-modules.types.d.ts.map +1 -1
- package/docs/API-reference/api/x-components.usestore.md +0 -19
- package/js/composables/use-store.js +0 -15
- package/js/composables/use-store.js.map +0 -1
- package/js/utils/options-api.js +0 -4
- package/js/utils/options-api.js.map +0 -1
- package/types/utils/options-api.d.ts +0 -3
- package/types/utils/options-api.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recommendations.vue.js","sources":["../../../../../src/x-modules/recommendations/components/recommendations.vue"],"sourcesContent":["<template>\n <component\n :is=\"animation\"\n v-if=\"recommendations.length\"\n tag=\"ul\"\n data-test=\"recommendations\"\n class=\"x-recommendations\"\n >\n <li\n v-for=\"recommendation in recommendations\"\n :key=\"recommendation.id\"\n class=\"x-recommendations__item\"\n data-test=\"recommendation-item\"\n >\n <!--\n @slot (Required) Recommendation content.\n @binding {recommendation} recommendation - Recommendation data.\n -->\n <slot :recommendation=\"recommendation\" />\n </li>\n </component>\n</template>\n\n<script lang=\"ts\">\n import { Result } from '@empathyco/x-types';\n import { computed, defineComponent, provide, ComputedRef } from 'vue';\n import { useState } from '../../../composables';\n import { PropsWithType } from '../../../utils';\n import { XEventsTypes } from '../../../wiring';\n import { recommendationsXModule } from '../x-module';\n import { AnimationProp } from '../../../types';\n\n /**\n * It renders a list of recommendations from the\n * {@link RecommendationsState.recommendations} state by default.\n * The component provides the slot layout which wraps the whole component with the\n * recommendations bounded. It also provides the default slot to customize the item, which is\n * within the layout slot, with the recommendation bounded. Each recommendation should be\n * represented by a {@link BaseResultLink} component besides any other component.\n *\n * @public\n */\n export default defineComponent({\n name: 'Recommendations',\n xModule: recommendationsXModule.name,\n props: {\n /** Animation component that will be used to animate the recommendations. */\n animation: {\n type: AnimationProp,\n default: 'ul'\n },\n /** Number of recommendations to be rendered. */\n maxItemsToRender: Number\n },\n setup(props, { slots }) {\n /** The module's list of recommendations. */\n const storedRecommendations: ComputedRef<Result[]> = useState('recommendations', [\n 'recommendations'\n ]).recommendations;\n\n /** The additional events to be emitted by the mandatory {@link BaseResultLink} component. */\n provide<PropsWithType<XEventsTypes, Result>[]>('resultClickExtraEvents', [\n 'UserClickedARecommendation'\n ]);\n\n /**\n * Slices the recommendations from the state.\n *\n * @returns - The list of recommendations slice by the number of items to render.\n */\n const recommendations = computed<Result[]>(() =>\n storedRecommendations.value.slice(0, props.maxItemsToRender)\n );\n\n /**\n * Render function to execute the `layout` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n * If there are no recommendations, nothing is rendered.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `layout` slot or empty string if there are\n * no recommendations.\n */\n function renderLayoutSlot() {\n const slotProps = {\n animation: props.animation,\n recommendations: recommendations.value\n };\n return recommendations.value.length ? slots.layout?.(slotProps)[0] : '';\n }\n\n /* Hack to render through a render-function, the `layout` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { recommendations };\n return (slots.layout ? renderLayoutSlot : componentProps) as typeof componentProps;\n }\n });\n</script>\n\n<style lang=\"css\" scoped>\n .x-recommendations {\n display: flex;\n list-style-type: none;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events, but it makes components such as `BaseResultLink` emit additional\nevents:\n\n- [`UserClickedARecommendation`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the link of a recommendation.\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend service required\nTo use this component, the Topclicked service must be implemented.\n:::\n<!-- prettier-ignore-end -->\n\nHere you have a basic example on how the recommendations are rendered. You can customize how each\nresult is rendered by using the `default` slot. It is highly recommended to use base components such\nas the `BaseResultLink` or the `BaseResultAddToCart`, as they provides integration with other\nmodules such like the `tagging` one.\n\n```vue live\n<template>\n <Recommendations #default=\"{ recommendation }\">\n <BaseResultLink :result=\"recommendation\" class=\"x-recommendations__link\">\n <img :src=\"recommendation.images[0]\" class=\"x-recommendations__image\" />\n <span class=\"x-recommendations__title\">{{ recommendation.name }}</span>\n </BaseResultLink>\n <BaseResultAddToCart>Add to cart</BaseResultAddToCart>\n </Recommendations>\n</template>\n<script>\n import { Recommendations } from '@empathyco/x-components/recommendations';\n import { BaseResultLink, BaseResultAddToCart } from '@empathyco/x-components';\n\n export default {\n name: 'RecommendationsDemo',\n components: {\n Recommendations,\n BaseResultLink,\n BaseResultAddToCart\n }\n };\n</script>\n```\n\n### Play with props\n\nIn this example, the component will render a maximum of 4 result recommendations, and will use the\n`StaggeredFadeAndSlide` animation for the results, smoothing the entrance.\n\n```vue live\n<template>\n <Recommendations\n #default=\"{ recommendation }\"\n :maxItemsToRender=\"4\"\n animation=\"StaggeredFadeAndSlide\"\n >\n <BaseResultLink :result=\"recommendation\" class=\"x-recommendations__link\">\n <img :src=\"recommendation.images[0]\" class=\"x-recommendations__image\" />\n <span class=\"x-recommendations__title\">{{ recommendation.name }}</span>\n </BaseResultLink>\n <BaseResultAddToCart>Add to cart</BaseResultAddToCart>\n </Recommendations>\n</template>\n<script>\n import Vue from 'vue';\n import { Recommendations } from '@empathyco/x-components/recommendations';\n import { BaseResultLink, BaseResultAddToCart } from '@empathyco/x-components';\n\n Vue.component('StaggeredFadeAndSlide', StaggeredFadeAndSlide);\n export default {\n name: 'RecommendationsDemo',\n components: {\n Recommendations,\n BaseResultLink,\n BaseResultAddToCart\n }\n };\n</script>\n```\n\n### Play with the layout\n\nIn this example you can build your own layout, and the `Recommendations` component will just act as\na provider of the result recommendations data. Using the component this way, and due to Vue 2\nlimitations you will only be allowed to render a single element inside the `layout` slot.\n\n```vue live\n<template>\n <Recommendations #layout=\"{ recommendations }\">\n <div class=\"x-recommendations\">\n <article\n class=\"x-recommendations-list\"\n v-for=\"recommendation in recommendations\"\n :key=\"recommendation.id\"\n >\n <BaseResultLink :result=\"recommendation\" class=\"x-recommendations__link\">\n <img :src=\"recommendation.images[0]\" class=\"x-recommendations__image\" />\n <span class=\"x-recommendations__title\">{{ recommendation.name }}</span>\n </BaseResultLink>\n <BaseResultAddToCart>Add to cart</BaseResultAddToCart>\n </article>\n </div>\n </Recommendations>\n</template>\n<script>\n import { Recommendations } from '@empathyco/x-components/recommendations';\n import { BaseResultLink, BaseResultAddToCart } from '@empathyco/x-components';\n\n export default {\n name: 'RecommendationsDemo',\n components: {\n Recommendations,\n BaseResultLink,\n BaseResultAddToCart\n }\n };\n</script>\n```\n</docs>\n"],"names":["animation","_openBlock","_createBlock","_resolveDynamicComponent","_createElementBlock","_Fragment","_renderList","_createCommentVNode"],"mappings":";;;;;AACE,SAAA,WAAA,CAAA,IAAA,EAAA,MAAA,EADF,MAESA,EAAAA,MAAAA,EAAAA,KAAAA,EAAAA,QAAAA,EAAAA;SAFT,IAIY,CAAA,eAAA,CAAA,MAAA,IAAAC,SAAA,EAAA,EAAAC,WAAA,CAAAC,uBAAA,CAAA,IAAA,CAAA,SAAA,CAAA,EAAA;AAAA,IACR,GAAA,EAAA,CAAA;AAAA,IACA,GAAK,EAAA,IAAA;AAAA,IAAA,WAAA,EAAA,iBAAA;AANT,IAAA,KAAA,EAAA,mBAAA;AAAA,GAAA,EAAA;;AAUY,OAAAF,SAAA,CAAA,IAAA,CAAA,EAAAG,kBAAA;AAAA,QAAiBC,QAAA;AAAA,QAAA,IAAA;AAAA,QAAAC,UAAA,CAAA,IAAA,CAAA,eAAA,EAAA,CAAA,cAAA,KAAA;AAClB,UAAA,OAAAL,SAAA,EAA0B,EAAAG,kBAAA,CAAA,IAAA,EAAA;AAAA,YAC/B,GAAU,EAAA,cAAA,CAAA,EAAA;AAAA,YAAA,KAAA,EAAA,yBAAA;
|
|
1
|
+
{"version":3,"file":"recommendations.vue.js","sources":["../../../../../src/x-modules/recommendations/components/recommendations.vue"],"sourcesContent":["<template>\n <component\n :is=\"animation\"\n v-if=\"recommendations.length\"\n tag=\"ul\"\n data-test=\"recommendations\"\n class=\"x-recommendations\"\n >\n <li\n v-for=\"recommendation in recommendations\"\n :key=\"recommendation.id\"\n class=\"x-recommendations__item\"\n data-test=\"recommendation-item\"\n >\n <!--\n @slot (Required) Recommendation content.\n @binding {recommendation} recommendation - Recommendation data.\n -->\n <slot :recommendation=\"recommendation\" />\n </li>\n </component>\n</template>\n\n<script lang=\"ts\">\n import { Result } from '@empathyco/x-types';\n import { computed, defineComponent, provide, ComputedRef } from 'vue';\n import { useState } from '../../../composables';\n import { PropsWithType } from '../../../utils';\n import { XEventsTypes } from '../../../wiring';\n import { recommendationsXModule } from '../x-module';\n import { AnimationProp } from '../../../types';\n\n /**\n * It renders a list of recommendations from the\n * {@link RecommendationsState.recommendations} state by default.\n * The component provides the slot layout which wraps the whole component with the\n * recommendations bounded. It also provides the default slot to customize the item, which is\n * within the layout slot, with the recommendation bounded. Each recommendation should be\n * represented by a {@link BaseResultLink} component besides any other component.\n *\n * @public\n */\n export default defineComponent({\n name: 'Recommendations',\n xModule: recommendationsXModule.name,\n props: {\n /** Animation component that will be used to animate the recommendations. */\n animation: {\n type: AnimationProp,\n default: 'ul'\n },\n /** Number of recommendations to be rendered. */\n maxItemsToRender: Number\n },\n setup(props, { slots }) {\n /** The module's list of recommendations. */\n const storedRecommendations: ComputedRef<Result[]> = useState('recommendations', [\n 'recommendations'\n ]).recommendations;\n\n /** The additional events to be emitted by the mandatory {@link BaseResultLink} component. */\n provide<PropsWithType<XEventsTypes, Result>[]>('resultClickExtraEvents', [\n 'UserClickedARecommendation'\n ]);\n\n /**\n * Slices the recommendations from the state.\n *\n * @returns - The list of recommendations slice by the number of items to render.\n */\n const recommendations = computed<Result[]>(() =>\n storedRecommendations.value.slice(0, props.maxItemsToRender)\n );\n\n /**\n * Render function to execute the `layout` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n * If there are no recommendations, nothing is rendered.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `layout` slot or empty string if there are\n * no recommendations.\n */\n function renderLayoutSlot() {\n const slotProps = {\n animation: props.animation,\n recommendations: recommendations.value\n };\n return recommendations.value.length ? slots.layout?.(slotProps)[0] : '';\n }\n\n /* Hack to render through a render-function, the `layout` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { recommendations };\n return (slots.layout ? renderLayoutSlot : componentProps) as typeof componentProps;\n }\n });\n</script>\n\n<style lang=\"css\" scoped>\n .x-recommendations {\n display: flex;\n list-style-type: none;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events, but it makes components such as `BaseResultLink` emit additional\nevents:\n\n- [`UserClickedARecommendation`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the link of a recommendation.\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend service required\nTo use this component, the Topclicked service must be implemented.\n:::\n<!-- prettier-ignore-end -->\n\nHere you have a basic example on how the recommendations are rendered. You can customize how each\nresult is rendered by using the `default` slot. It is highly recommended to use base components such\nas the `BaseResultLink` or the `BaseResultAddToCart`, as they provides integration with other\nmodules such like the `tagging` one.\n\n```vue live\n<template>\n <Recommendations #default=\"{ recommendation }\">\n <BaseResultLink :result=\"recommendation\" class=\"x-recommendations__link\">\n <img :src=\"recommendation.images[0]\" class=\"x-recommendations__image\" />\n <span class=\"x-recommendations__title\">{{ recommendation.name }}</span>\n </BaseResultLink>\n <BaseResultAddToCart>Add to cart</BaseResultAddToCart>\n </Recommendations>\n</template>\n<script>\n import { Recommendations } from '@empathyco/x-components/recommendations';\n import { BaseResultLink, BaseResultAddToCart } from '@empathyco/x-components';\n\n export default {\n name: 'RecommendationsDemo',\n components: {\n Recommendations,\n BaseResultLink,\n BaseResultAddToCart\n }\n };\n</script>\n```\n\n### Play with props\n\nIn this example, the component will render a maximum of 4 result recommendations, and will use the\n`StaggeredFadeAndSlide` animation for the results, smoothing the entrance.\n\n```vue live\n<template>\n <Recommendations\n #default=\"{ recommendation }\"\n :maxItemsToRender=\"4\"\n animation=\"StaggeredFadeAndSlide\"\n >\n <BaseResultLink :result=\"recommendation\" class=\"x-recommendations__link\">\n <img :src=\"recommendation.images[0]\" class=\"x-recommendations__image\" />\n <span class=\"x-recommendations__title\">{{ recommendation.name }}</span>\n </BaseResultLink>\n <BaseResultAddToCart>Add to cart</BaseResultAddToCart>\n </Recommendations>\n</template>\n<script>\n import Vue from 'vue';\n import { Recommendations } from '@empathyco/x-components/recommendations';\n import { BaseResultLink, BaseResultAddToCart } from '@empathyco/x-components';\n\n Vue.component('StaggeredFadeAndSlide', StaggeredFadeAndSlide);\n export default {\n name: 'RecommendationsDemo',\n components: {\n Recommendations,\n BaseResultLink,\n BaseResultAddToCart\n }\n };\n</script>\n```\n\n### Play with the layout\n\nIn this example you can build your own layout, and the `Recommendations` component will just act as\na provider of the result recommendations data. Using the component this way, and due to Vue 2\nlimitations you will only be allowed to render a single element inside the `layout` slot.\n\n```vue live\n<template>\n <Recommendations #layout=\"{ recommendations }\">\n <div class=\"x-recommendations\">\n <article\n class=\"x-recommendations-list\"\n v-for=\"recommendation in recommendations\"\n :key=\"recommendation.id\"\n >\n <BaseResultLink :result=\"recommendation\" class=\"x-recommendations__link\">\n <img :src=\"recommendation.images[0]\" class=\"x-recommendations__image\" />\n <span class=\"x-recommendations__title\">{{ recommendation.name }}</span>\n </BaseResultLink>\n <BaseResultAddToCart>Add to cart</BaseResultAddToCart>\n </article>\n </div>\n </Recommendations>\n</template>\n<script>\n import { Recommendations } from '@empathyco/x-components/recommendations';\n import { BaseResultLink, BaseResultAddToCart } from '@empathyco/x-components';\n\n export default {\n name: 'RecommendationsDemo',\n components: {\n Recommendations,\n BaseResultLink,\n BaseResultAddToCart\n }\n };\n</script>\n```\n</docs>\n"],"names":["animation","_openBlock","_createBlock","_resolveDynamicComponent","_createElementBlock","_Fragment","_renderList","_createCommentVNode"],"mappings":";;;;;AACE,SAAA,WAAA,CAAA,IAAA,EAAA,MAAA,EADF,MAESA,EAAAA,MAAAA,EAAAA,KAAAA,EAAAA,QAAAA,EAAAA;SAFT,IAIY,CAAA,eAAA,CAAA,MAAA,IAAAC,SAAA,EAAA,EAAAC,WAAA,CAAAC,uBAAA,CAAA,IAAA,CAAA,SAAA,CAAA,EAAA;AAAA,IACR,GAAA,EAAA,CAAA;AAAA,IACA,GAAK,EAAA,IAAA;AAAA,IAAA,WAAA,EAAA,iBAAA;AANT,IAAA,KAAA,EAAA,mBAAA;AAAA,GAAA,EAAA;;AAUY,OAAAF,SAAA,CAAA,IAAA,CAAA,EAAAG,kBAAA;AAAA,QAAiBC,QAAA;AAAA,QAAA,IAAA;AAAA,QAAAC,UAAA,CAAA,IAAA,CAAA,eAAA,EAAA,CAAA,cAAA,KAAA;AAClB,UAAA,OAAAL,SAAA,EAA0B,EAAAG,kBAAA,CAAA,IAAA,EAAA;AAAA,YAC/B,GAAU,EAAA,cAAA,CAAA,EAAA;AAAA,YAAA,KAAA,EAAA,yBAAA;YAMV,WAAyC,EAAA,qBAAA;AAAA,WAAA,EAAA;;;AAlB/C,SAAA,CAAA;AAAA,QAAA,GAAA;AAAA;AAAA,OAAA;AAAA,KAAA,CAAA;AAAA,IAAA,CAAA,EAAA,CAAA;AAAA;AAAA,GAAA,CAAA,IAAAG,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA,CAAA;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitters.js","sources":["../../../../../src/x-modules/recommendations/store/emitters.ts"],"sourcesContent":["import { createStoreEmitters } from '../../../store';\nimport { recommendationsXStoreModule } from './module';\n/**\n * {@link StoreEmitters} For the recommendations module.\n *\n * @internal\n */\nexport const recommendationsEmitters = createStoreEmitters(recommendationsXStoreModule, {\n RecommendationsChanged: state => state.recommendations,\n RecommendationsRequestUpdated: {\n selector: (_, getters) => getters.request\n }\n});\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"emitters.js","sources":["../../../../../src/x-modules/recommendations/store/emitters.ts"],"sourcesContent":["import { createStoreEmitters } from '../../../store';\nimport { recommendationsXStoreModule } from './module';\n/**\n * {@link StoreEmitters} For the recommendations module.\n *\n * @internal\n */\nexport const recommendationsEmitters = createStoreEmitters(recommendationsXStoreModule, {\n RecommendationsChanged: state => state.recommendations,\n RecommendationsRequestUpdated: {\n selector: (_, getters) => getters.request\n }\n});\n"],"names":[],"mappings":";;;;AAEA;;;;AAIG;AACU,MAAA,uBAAuB,GAAG,mBAAmB,CAAC,2BAA2B,EAAE;AACtF,IAAA,sBAAsB,EAAE,KAAK,IAAI,KAAK,CAAC,eAAe;AACtD,IAAA,6BAA6B,EAAE;QAC7B,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO;AAC1C,KAAA;AACF,CAAA;;;;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import _sfc_main from './related-prompt.vue2.js';
|
|
2
|
+
import { resolveComponent, openBlock, createElementBlock, normalizeClass, renderSlot, createElementVNode, normalizeStyle, toDisplayString, createBlock } from 'vue';
|
|
3
|
+
import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.js';
|
|
4
|
+
|
|
5
|
+
const _hoisted_1 = { class: "x-related-prompt__button-info" };
|
|
6
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
7
|
+
const _component_CrossTinyIcon = resolveComponent("CrossTinyIcon");
|
|
8
|
+
const _component_PlusIcon = resolveComponent("PlusIcon");
|
|
9
|
+
return openBlock(), createElementBlock(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.toggleSuggestion(_ctx.index)),
|
|
13
|
+
onKeydown: _cache[1] || (_cache[1] = ($event) => _ctx.toggleSuggestion(_ctx.index)),
|
|
14
|
+
class: normalizeClass(["x-related-prompt__button", [{ "x-related-prompt-selected__button": _ctx.isSelected }]]),
|
|
15
|
+
role: "button",
|
|
16
|
+
"aria-pressed": "true",
|
|
17
|
+
tabindex: "0"
|
|
18
|
+
},
|
|
19
|
+
[
|
|
20
|
+
renderSlot(_ctx.$slots, "related-prompt-button-info", {}, () => [
|
|
21
|
+
createElementVNode("div", _hoisted_1, [
|
|
22
|
+
createElementVNode(
|
|
23
|
+
"span",
|
|
24
|
+
{
|
|
25
|
+
class: normalizeClass(["x-typewritter-initial", [{ "x-typewritter-animation": _ctx.isPromptVisible }]]),
|
|
26
|
+
style: normalizeStyle({
|
|
27
|
+
animationDelay: `${_ctx.index * 0.4 + 0.05}s`,
|
|
28
|
+
"--suggestion-text-length": _ctx.relatedPrompt.suggestionText.length
|
|
29
|
+
})
|
|
30
|
+
},
|
|
31
|
+
toDisplayString(_ctx.relatedPrompt.suggestionText),
|
|
32
|
+
7
|
|
33
|
+
/* TEXT, CLASS, STYLE */
|
|
34
|
+
)
|
|
35
|
+
]),
|
|
36
|
+
_ctx.isSelected ? (openBlock(), createBlock(_component_CrossTinyIcon, {
|
|
37
|
+
key: 0,
|
|
38
|
+
class: "x-icon-lg"
|
|
39
|
+
})) : (openBlock(), createBlock(_component_PlusIcon, {
|
|
40
|
+
key: 1,
|
|
41
|
+
class: "x-icon-lg"
|
|
42
|
+
}))
|
|
43
|
+
])
|
|
44
|
+
],
|
|
45
|
+
34
|
|
46
|
+
/* CLASS, NEED_HYDRATION */
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
var RelatedPrompt = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
50
|
+
|
|
51
|
+
export { RelatedPrompt as default };
|
|
52
|
+
//# sourceMappingURL=related-prompt.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-prompt.vue.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompt.vue"],"sourcesContent":["<template>\n <div\n @click=\"toggleSuggestion(index)\"\n @keydown=\"toggleSuggestion(index)\"\n class=\"x-related-prompt__button\"\n :class=\"[{ 'x-related-prompt-selected__button': isSelected }]\"\n role=\"button\"\n aria-pressed=\"true\"\n tabindex=\"0\"\n >\n <slot name=\"related-prompt-button-info\">\n <div class=\"x-related-prompt__button-info\">\n <span\n class=\"x-typewritter-initial\"\n :class=\"[{ 'x-typewritter-animation': isPromptVisible }]\"\n :style=\"{\n animationDelay: `${index * 0.4 + 0.05}s`,\n '--suggestion-text-length': relatedPrompt.suggestionText.length\n }\"\n >\n {{ relatedPrompt.suggestionText }}\n </span>\n </div>\n <CrossTinyIcon v-if=\"isSelected\" class=\"x-icon-lg\" />\n <PlusIcon v-else class=\"x-icon-lg\" />\n </slot>\n </div>\n</template>\n<script lang=\"ts\">\n import { defineComponent, PropType } from 'vue';\n import { RelatedPrompt } from '@empathyco/x-types';\n import { relatedPromptsXModule } from '../x-module';\n import CrossTinyIcon from '../../../components/icons/cross-tiny.vue';\n import PlusIcon from '../../../components/icons/plus.vue';\n import { use$x } from '../../../composables/index';\n\n /**\n * This component shows a suggested related prompt.\n *\n * It provides a slot to customize the related prompt button information.\n *\n * @public\n */\n export default defineComponent({\n name: 'RelatedPrompt',\n components: {\n CrossTinyIcon,\n PlusIcon\n },\n xModule: relatedPromptsXModule.name,\n props: {\n relatedPrompt: {\n type: Object as PropType<RelatedPrompt>,\n required: true\n },\n isPromptVisible: {\n type: Boolean,\n default: false\n },\n isSelected: {\n type: Boolean,\n default: false\n },\n index: {\n type: Number,\n required: true\n }\n },\n setup() {\n const x = use$x();\n\n const toggleSuggestion = (index: number): void => {\n x.emit('UserSelectedARelatedPrompt', index);\n };\n\n return {\n toggleSuggestion\n };\n }\n });\n</script>\n"],"names":["_resolveComponent","_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","index","_normalizeStyle","relatedPrompt","isSelected","_toDisplayString","_createBlock"],"mappings":";;;;;;;8BACEA,gBAyBM,CAAA,UAAA,CAAA,CAAA;SAvBHC,SAAO,EAAA,EAAAC,kBAAA;AAAA,IAAA,KAAA;AAAA,IAAA;AAAA,MACR,OAAA,EAJJ,qBAIU,CAA0B,CAAA,GAAA,CAAA,MAAA,KAAA,IAAA,CAAA,gBAAA,CAAA,IAAA,CAAA,KAAA,CAAA,CAAA;AAAA,MAEhC,WAAK,MAAQ,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAA,IAAA,CAAA,gBAAA,CAAA,IAAA,CAAA,KAAA,CAAA,CAAA;AAAA,MACb,KAAmB,EAAAC,cAAA,CAAA,CAAA,0BAAA,EAAA,CAAA,EAAA,mCAAA,EAAA,IAAA,CAAA,UAAA,EAAA,CAAA,CAAA,CAAA;AAAA,MACnB,IAAA,EAAA,QAAA;AAAA,MAAA,cAAA,EAAA,MAAA;AAEA,MAAA,QAAA,EAAA,GAAA;AAAA,KAAA;;iBAEI,IASO,CAAA,MAAA,EAAA,4BAAA,EAAA,EAAA,EAAA,MAAA;AAAA,QAAAC,kBAAA,CArBf,KAagB,EAAA,UAAA,EAAA;AAAA,UAAAA,kBAAA;AAbhB,YAAA,MAAA;AAAA,YAAA;AAAA,cAAA,KAAA,EAAAD,cAAA,CAemDE,CAAK,uBAAA,EAAA,CAAA,EAAA,yBAAA,EAAA,IAAA,CAAA,eAAA,EAAA,CAAA,CAAA,CAAA;AAAA,cAAA,KAAA,EAAAC,cAAA,CAAA;;AAK3CC,gBAAAA,0BAAAA,EAAAA,IAAAA,CAAAA,aAAAA,CAAc,cAAc,CAAA,MAAA;AAAA,eAAA,CAAA;AAGdC,aAAAA;AAAAA,YAAUC,eAAA,CAAA,IAAA,CAAA,aAAA,CAAA,cAAA,CAAA;AAAA,YAAA,CAAA;AAAA;AAAA,WAAA;AAAA,SAAA,CAAA;AAvBrC,QAAA,IAAA,CAAA,UAAA,IAAAR,SAAA,EAuBwD,EAAAS,WAAA,CAAA,wBAAA,EAAA;AAAA,UAAA,GAAA,EAAA,CAAA;;0BAChB,EAAAA,WAAA,CAAA,mBAAA,EAAA;AAAA,UAAA,GAAA,EAAA,CAAA;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { defineComponent } from 'vue';
|
|
2
|
+
import { relatedPromptsXModule } from '../x-module.js';
|
|
3
|
+
import CrossTinyIcon from '../../../components/icons/cross-tiny.vue.js';
|
|
4
|
+
import PlusIcon from '../../../components/icons/plus.vue.js';
|
|
5
|
+
import '../../../composables/create-use-device.js';
|
|
6
|
+
import { use$x } from '../../../composables/use-_x.js';
|
|
7
|
+
import '@vue/devtools-api';
|
|
8
|
+
import '../../../plugins/devtools/timeline.devtools.js';
|
|
9
|
+
import '@empathyco/x-utils';
|
|
10
|
+
import 'rxjs/operators';
|
|
11
|
+
import 'rxjs';
|
|
12
|
+
import '../../../plugins/devtools/colors.utils.js';
|
|
13
|
+
import '../../../plugins/x-bus.js';
|
|
14
|
+
import '../../../plugins/x-plugin.js';
|
|
15
|
+
import 'vuex';
|
|
16
|
+
import '@vueuse/core';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* This component shows a suggested related prompt.
|
|
20
|
+
*
|
|
21
|
+
* It provides a slot to customize the related prompt button information.
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
var _sfc_main = defineComponent({
|
|
26
|
+
name: 'RelatedPrompt',
|
|
27
|
+
components: {
|
|
28
|
+
CrossTinyIcon,
|
|
29
|
+
PlusIcon
|
|
30
|
+
},
|
|
31
|
+
xModule: relatedPromptsXModule.name,
|
|
32
|
+
props: {
|
|
33
|
+
relatedPrompt: {
|
|
34
|
+
type: Object,
|
|
35
|
+
required: true
|
|
36
|
+
},
|
|
37
|
+
isPromptVisible: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false
|
|
40
|
+
},
|
|
41
|
+
isSelected: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false
|
|
44
|
+
},
|
|
45
|
+
index: {
|
|
46
|
+
type: Number,
|
|
47
|
+
required: true
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
setup() {
|
|
51
|
+
const x = use$x();
|
|
52
|
+
const toggleSuggestion = (index) => {
|
|
53
|
+
x.emit('UserSelectedARelatedPrompt', index);
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
toggleSuggestion
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export { _sfc_main as default };
|
|
62
|
+
//# sourceMappingURL=related-prompt.vue2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-prompt.vue2.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompt.vue"],"sourcesContent":["<template>\n <div\n @click=\"toggleSuggestion(index)\"\n @keydown=\"toggleSuggestion(index)\"\n class=\"x-related-prompt__button\"\n :class=\"[{ 'x-related-prompt-selected__button': isSelected }]\"\n role=\"button\"\n aria-pressed=\"true\"\n tabindex=\"0\"\n >\n <slot name=\"related-prompt-button-info\">\n <div class=\"x-related-prompt__button-info\">\n <span\n class=\"x-typewritter-initial\"\n :class=\"[{ 'x-typewritter-animation': isPromptVisible }]\"\n :style=\"{\n animationDelay: `${index * 0.4 + 0.05}s`,\n '--suggestion-text-length': relatedPrompt.suggestionText.length\n }\"\n >\n {{ relatedPrompt.suggestionText }}\n </span>\n </div>\n <CrossTinyIcon v-if=\"isSelected\" class=\"x-icon-lg\" />\n <PlusIcon v-else class=\"x-icon-lg\" />\n </slot>\n </div>\n</template>\n<script lang=\"ts\">\n import { defineComponent, PropType } from 'vue';\n import { RelatedPrompt } from '@empathyco/x-types';\n import { relatedPromptsXModule } from '../x-module';\n import CrossTinyIcon from '../../../components/icons/cross-tiny.vue';\n import PlusIcon from '../../../components/icons/plus.vue';\n import { use$x } from '../../../composables/index';\n\n /**\n * This component shows a suggested related prompt.\n *\n * It provides a slot to customize the related prompt button information.\n *\n * @public\n */\n export default defineComponent({\n name: 'RelatedPrompt',\n components: {\n CrossTinyIcon,\n PlusIcon\n },\n xModule: relatedPromptsXModule.name,\n props: {\n relatedPrompt: {\n type: Object as PropType<RelatedPrompt>,\n required: true\n },\n isPromptVisible: {\n type: Boolean,\n default: false\n },\n isSelected: {\n type: Boolean,\n default: false\n },\n index: {\n type: Number,\n required: true\n }\n },\n setup() {\n const x = use$x();\n\n const toggleSuggestion = (index: number): void => {\n x.emit('UserSelectedARelatedPrompt', index);\n };\n\n return {\n toggleSuggestion\n };\n }\n });\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAoCE;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,eAAe;AACrB,IAAA,UAAU,EAAE;QACV,aAAa;QACb,QAAO;AACR,KAAA;IACD,OAAO,EAAE,qBAAqB,CAAC,IAAI;AACnC,IAAA,KAAK,EAAE;AACL,QAAA,aAAa,EAAE;AACb,YAAA,IAAI,EAAE,MAAiC;AACvC,YAAA,QAAQ,EAAE,IAAG;AACd,SAAA;AACD,QAAA,eAAe,EAAE;AACf,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,KAAI;AACd,SAAA;AACD,QAAA,UAAU,EAAE;AACV,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,KAAI;AACd,SAAA;AACD,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAG;AACf,SAAA;AACD,KAAA;IACD,KAAK,GAAA;AACH,QAAA,MAAM,CAAE,GAAE,KAAK,EAAE,CAAA;AAEjB,QAAA,MAAM,gBAAe,GAAI,CAAC,KAAa,KAAW;AAChD,YAAA,CAAC,CAAC,IAAI,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAA;AAC7C,SAAC,CAAA;QAED,OAAO;YACL,gBAAe;SAChB,CAAA;KACH;AACD,CAAA,CAAC;;;;"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { defineComponent, inject, computed, provide, h } from 'vue';
|
|
2
|
+
import { AnimationProp } from '../../../types/animation-prop.js';
|
|
3
|
+
import { groupItemsBy } from '../../../utils/array.js';
|
|
4
|
+
import ItemsList from '../../../components/items-list.vue.js';
|
|
5
|
+
import { QUERY_KEY, HAS_MORE_ITEMS_KEY, LIST_ITEMS_KEY } from '../../../components/decorators/injection.consts.js';
|
|
6
|
+
import { relatedPromptsXModule } from '../x-module.js';
|
|
7
|
+
import { useState } from '../../../composables/use-state.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Component that inserts groups of related prompts in different positions of the injected search
|
|
11
|
+
* items list, based on the provided configuration.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
var _sfc_main = defineComponent({
|
|
16
|
+
name: 'RelatedPromptsList',
|
|
17
|
+
xModule: relatedPromptsXModule.name,
|
|
18
|
+
props: {
|
|
19
|
+
/**
|
|
20
|
+
* Animation component that will be used to animate the related prompts groups.
|
|
21
|
+
*/
|
|
22
|
+
animation: {
|
|
23
|
+
type: AnimationProp,
|
|
24
|
+
default: 'ul'
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* The first index to insert a group of related prompts at.
|
|
28
|
+
*/
|
|
29
|
+
offset: {
|
|
30
|
+
type: Number,
|
|
31
|
+
default: 24
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* The items cycle size to keep inserting related prompts groups at.
|
|
35
|
+
*/
|
|
36
|
+
frequency: {
|
|
37
|
+
type: Number,
|
|
38
|
+
default: 24
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* The maximum amount of related prompts to add in a single group.
|
|
42
|
+
*/
|
|
43
|
+
maxRelatedPromptsPerGroup: {
|
|
44
|
+
type: Number,
|
|
45
|
+
default: 4
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* The maximum number of groups to insert into the injected list items list.
|
|
49
|
+
*/
|
|
50
|
+
maxGroups: {
|
|
51
|
+
type: Number,
|
|
52
|
+
default: undefined
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* Determines if a group is added to the injected items list in case the number
|
|
56
|
+
* of items is smaller than the offset.
|
|
57
|
+
*/
|
|
58
|
+
showOnlyAfterOffset: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: false
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
setup(props, { slots }) {
|
|
64
|
+
const { query, status } = useState('relatedPrompts', ['query', 'status']);
|
|
65
|
+
/**
|
|
66
|
+
* The state related prompts.
|
|
67
|
+
*/
|
|
68
|
+
const relatedPrompts = useState('relatedPrompts', [
|
|
69
|
+
'relatedPrompts'
|
|
70
|
+
]).relatedPrompts;
|
|
71
|
+
/**
|
|
72
|
+
* Injected query, updated when the related request(s) have succeeded.
|
|
73
|
+
*/
|
|
74
|
+
const injectedQuery = inject(QUERY_KEY);
|
|
75
|
+
/**
|
|
76
|
+
* Indicates if there are more available results than the injected.
|
|
77
|
+
*/
|
|
78
|
+
const hasMoreItems = inject(HAS_MORE_ITEMS_KEY);
|
|
79
|
+
/**
|
|
80
|
+
* The grouped related prompts based on the given config.
|
|
81
|
+
*
|
|
82
|
+
* @returns A list of related prompts groups.
|
|
83
|
+
*/
|
|
84
|
+
const relatedPromptsGroups = computed(() => Object.values(groupItemsBy(relatedPrompts.value, (_, index) => Math.floor(index / props.maxRelatedPromptsPerGroup)))
|
|
85
|
+
.slice(0, props.maxGroups)
|
|
86
|
+
.map((relatedPrompts, index) => ({
|
|
87
|
+
modelName: 'RelatedPromptsGroup',
|
|
88
|
+
id: `related-prompts-group-${index}`,
|
|
89
|
+
relatedPrompts
|
|
90
|
+
})));
|
|
91
|
+
/**
|
|
92
|
+
* It injects {@link ListItem} provided by an ancestor as injectedListItems.
|
|
93
|
+
*/
|
|
94
|
+
const injectedListItems = inject(LIST_ITEMS_KEY);
|
|
95
|
+
/**
|
|
96
|
+
* Checks if the related prompts are outdated taking into account the injected query.
|
|
97
|
+
*
|
|
98
|
+
* @returns True if the related prompts are outdated, false if not.
|
|
99
|
+
*/
|
|
100
|
+
const relatedPromptsAreOutdated = computed(() => !!injectedQuery?.value &&
|
|
101
|
+
(query.value !== injectedQuery.value || status.value !== 'success'));
|
|
102
|
+
/**
|
|
103
|
+
* Checks if the number of items is smaller than the offset so a group
|
|
104
|
+
* should be added to the injected items list.
|
|
105
|
+
*
|
|
106
|
+
* @returns True if a group should be added, false if not.
|
|
107
|
+
*/
|
|
108
|
+
const hasNotEnoughListItems = computed(() => !props.showOnlyAfterOffset &&
|
|
109
|
+
!hasMoreItems?.value &&
|
|
110
|
+
injectedListItems !== undefined &&
|
|
111
|
+
injectedListItems.value.length > 0 &&
|
|
112
|
+
props.offset > injectedListItems.value.length);
|
|
113
|
+
/**
|
|
114
|
+
* New list of {@link ListItem}s to render.
|
|
115
|
+
*
|
|
116
|
+
* @returns The new list of {@link ListItem}s with the related prompts groups inserted.
|
|
117
|
+
*/
|
|
118
|
+
const items = computed(() => {
|
|
119
|
+
if (!injectedListItems?.value) {
|
|
120
|
+
return relatedPromptsGroups.value;
|
|
121
|
+
}
|
|
122
|
+
if (relatedPromptsAreOutdated.value) {
|
|
123
|
+
return injectedListItems.value;
|
|
124
|
+
}
|
|
125
|
+
if (hasNotEnoughListItems.value) {
|
|
126
|
+
return injectedListItems.value.concat(relatedPromptsGroups.value[0] ?? []);
|
|
127
|
+
}
|
|
128
|
+
return relatedPromptsGroups?.value.reduce((items, relatedPromptsGroup, index) => {
|
|
129
|
+
const targetIndex = props.offset + props.frequency * index;
|
|
130
|
+
if (targetIndex <= items.length) {
|
|
131
|
+
items.splice(targetIndex, 0, relatedPromptsGroup);
|
|
132
|
+
}
|
|
133
|
+
return items;
|
|
134
|
+
}, [...injectedListItems.value]);
|
|
135
|
+
});
|
|
136
|
+
/**
|
|
137
|
+
* The computed list items of the entity that uses the mixin.
|
|
138
|
+
*
|
|
139
|
+
* @remarks It should be overridden in the component that uses the mixin and
|
|
140
|
+
* it's intended to be filled with items from the state. Vue doesn't allow
|
|
141
|
+
* mixins as abstract classes.
|
|
142
|
+
* @returns An empty array as fallback in case it is not overridden.
|
|
143
|
+
*/
|
|
144
|
+
provide(LIST_ITEMS_KEY, items);
|
|
145
|
+
return () => {
|
|
146
|
+
const innerProps = { items: items.value, animation: props.animation };
|
|
147
|
+
// https://vue-land.github.io/faq/forwarding-slots#passing-all-slots
|
|
148
|
+
return slots.default?.(innerProps)[0] ?? h(ItemsList, innerProps, slots);
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
export { _sfc_main as default };
|
|
154
|
+
//# sourceMappingURL=related-prompts-list.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-prompts-list.vue.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompts-list.vue"],"sourcesContent":["<script lang=\"ts\">\n import { computed, ComputedRef, defineComponent, h, inject, provide, Ref } from 'vue';\n import { RelatedPrompt } from '@empathyco/x-types';\n import { AnimationProp } from '../../../types/animation-prop';\n import { groupItemsBy } from '../../../utils/array';\n import ItemsList from '../../../components/items-list.vue';\n import { ListItem } from '../../../utils/types';\n import {\n HAS_MORE_ITEMS_KEY,\n LIST_ITEMS_KEY,\n QUERY_KEY\n } from '../../../components/decorators/injection.consts';\n import { relatedPromptsXModule } from '../x-module';\n import { useState } from '../../../composables/use-state';\n import { RelatedPromptsGroup } from '../types';\n\n /**\n * Component that inserts groups of related prompts in different positions of the injected search\n * items list, based on the provided configuration.\n *\n * @public\n */\n export default defineComponent({\n name: 'RelatedPromptsList',\n xModule: relatedPromptsXModule.name,\n props: {\n /**\n * Animation component that will be used to animate the related prompts groups.\n */\n animation: {\n type: AnimationProp,\n default: 'ul'\n },\n /**\n * The first index to insert a group of related prompts at.\n */\n offset: {\n type: Number,\n default: 24\n },\n /**\n * The items cycle size to keep inserting related prompts groups at.\n */\n frequency: {\n type: Number,\n default: 24\n },\n /**\n * The maximum amount of related prompts to add in a single group.\n */\n maxRelatedPromptsPerGroup: {\n type: Number,\n default: 4\n },\n /**\n * The maximum number of groups to insert into the injected list items list.\n */\n maxGroups: {\n type: Number,\n default: undefined\n },\n /**\n * Determines if a group is added to the injected items list in case the number\n * of items is smaller than the offset.\n */\n showOnlyAfterOffset: {\n type: Boolean,\n default: false\n }\n },\n setup(props, { slots }) {\n const { query, status } = useState('relatedPrompts', ['query', 'status']);\n\n /**\n * The state related prompts.\n */\n const relatedPrompts: ComputedRef<RelatedPrompt[]> = useState('relatedPrompts', [\n 'relatedPrompts'\n ]).relatedPrompts;\n\n /**\n * Injected query, updated when the related request(s) have succeeded.\n */\n const injectedQuery = inject<Ref<string | undefined>>(QUERY_KEY as string);\n\n /**\n * Indicates if there are more available results than the injected.\n */\n const hasMoreItems = inject<Ref<boolean | undefined>>(HAS_MORE_ITEMS_KEY as string);\n\n /**\n * The grouped related prompts based on the given config.\n *\n * @returns A list of related prompts groups.\n */\n const relatedPromptsGroups = computed<RelatedPromptsGroup[]>(() =>\n Object.values(\n groupItemsBy(relatedPrompts.value, (_, index) =>\n Math.floor(index / props.maxRelatedPromptsPerGroup)\n )\n )\n .slice(0, props.maxGroups)\n .map((relatedPrompts, index) => ({\n modelName: 'RelatedPromptsGroup' as const,\n id: `related-prompts-group-${index}`,\n relatedPrompts\n }))\n );\n\n /**\n * It injects {@link ListItem} provided by an ancestor as injectedListItems.\n */\n const injectedListItems = inject<Ref<ListItem[]>>(LIST_ITEMS_KEY as string);\n\n /**\n * Checks if the related prompts are outdated taking into account the injected query.\n *\n * @returns True if the related prompts are outdated, false if not.\n */\n const relatedPromptsAreOutdated = computed(\n () =>\n !!injectedQuery?.value &&\n (query.value !== injectedQuery.value || status.value !== 'success')\n );\n\n /**\n * Checks if the number of items is smaller than the offset so a group\n * should be added to the injected items list.\n *\n * @returns True if a group should be added, false if not.\n */\n const hasNotEnoughListItems = computed(\n () =>\n !props.showOnlyAfterOffset &&\n !hasMoreItems?.value &&\n injectedListItems !== undefined &&\n injectedListItems.value.length > 0 &&\n props.offset > injectedListItems.value.length\n );\n\n /**\n * New list of {@link ListItem}s to render.\n *\n * @returns The new list of {@link ListItem}s with the related prompts groups inserted.\n */\n const items = computed((): ListItem[] => {\n if (!injectedListItems?.value) {\n return relatedPromptsGroups.value;\n }\n if (relatedPromptsAreOutdated.value) {\n return injectedListItems.value;\n }\n if (hasNotEnoughListItems.value) {\n return injectedListItems.value.concat(relatedPromptsGroups.value[0] ?? []);\n }\n return relatedPromptsGroups?.value.reduce(\n (items, relatedPromptsGroup, index) => {\n const targetIndex = props.offset + props.frequency * index;\n if (targetIndex <= items.length) {\n items.splice(targetIndex, 0, relatedPromptsGroup);\n }\n return items;\n },\n [...injectedListItems.value]\n );\n });\n\n /**\n * The computed list items of the entity that uses the mixin.\n *\n * @remarks It should be overridden in the component that uses the mixin and\n * it's intended to be filled with items from the state. Vue doesn't allow\n * mixins as abstract classes.\n * @returns An empty array as fallback in case it is not overridden.\n */\n provide(LIST_ITEMS_KEY as string, items);\n\n return () => {\n const innerProps = { items: items.value, animation: props.animation };\n // https://vue-land.github.io/faq/forwarding-slots#passing-all-slots\n return slots.default?.(innerProps)[0] ?? h(ItemsList, innerProps, slots);\n };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events.\n\n## See it in action\n\n <!-- prettier-ignore-start -->\n\n:::warning Backend microservice required To use this component, the <b>QuerySignals</b> microservice\nmust be implemented. :::\n\n <!-- prettier-ignore-end -->\n\nUsually, this component is going to be used together with the `ResultsList` one. Related prompts\ngroups will be inserted between the results, guiding users to discover new searches directly from\nthe results list.\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <ResultsList>\n <RelatedPromptsList />\n </ResultsList>\n </div>\n</template>\n\n<script>\n import { RelatedPromptsList } from '@empathyco/x-components/related-prompts';\n import { ResultsList } from '@empathyco/x-components/search';\n import { SearchInput } from '@empathyco/x-components/search-box';\n\n export default {\n name: 'RelatedPromptsListDemo',\n components: {\n RelatedPromptsList,\n ResultsList,\n SearchInput\n }\n };\n</script>\n```\n\n### Play with the index that related prompts groups are inserted at\n\nThe component allows to customise where are the related prompts groups inserted. In the following\nexample, the first group of related prompts will be inserted at the index `48` (`offset`), and then\na second group will be inserted at index `120` because of the `frequency` prop configured to `72`.\nFinally, a third group will be inserted at index `192`. Because `maxGroups` is configured to `3`, no\nmore groups will be inserted. Each one of this groups will have up to `6` related prompts\n(`maxRelatedPromptsPerGroup`).\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <ResultsList>\n <RelatedPromptsList\n :offset=\"48\"\n :frequency=\"72\"\n :maxRelatedPromptsPerGroup=\"6\"\n :maxGroups=\"3\"\n />\n </ResultsList>\n </div>\n</template>\n\n<script>\n import { RelatedPromptsList } from '@empathyco/x-components/related-prompts';\n import { ResultsList } from '@empathyco/x-components/search';\n import { SearchInput } from '@empathyco/x-components/search-box';\n\n export default {\n name: 'RelatedPromptsListDemo',\n components: {\n RelatedPromptsList,\n ResultsList,\n SearchInput\n }\n };\n</script>\n```\n\n### Showing/hiding first related prompts group when no more items\n\nBy default, the first related prompts group will be inserted when the total number of results is\nsmaller than the offset, but this behavior can be deactivated by setting the `showOnlyAfterOffset`\nto `true`.\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <ResultsList>\n <RelatedPromptsList\n :offset=\"48\"\n :frequency=\"72\"\n :maxRelatedPromptsPerGroup=\"1\"\n :showOnlyAfterOffset=\"true\"\n />\n </ResultsList>\n </div>\n</template>\n\n<script>\n import { RelatedPromptsList } from '@empathyco/x-components/related-prompts';\n import { ResultsList } from '@empathyco/x-components/search';\n import { SearchInput } from '@empathyco/x-components/search-box';\n\n export default {\n name: 'RelatedPromptsListDemo',\n components: {\n RelatedPromptsList,\n ResultsList,\n SearchInput\n }\n };\n</script>\n```\n\n### Customise the layout of the component\n\nThis component will render by default the `id` of each search item, both the injected, and for the\ngroups of related prompts generated, but the common case is to integrate it with another layout\ncomponent, for example the `BaseGrid`. To do so, you can use the `default` slot\n\n```vue\n<template>\n <div>\n <SearchInput />\n <ResultsList>\n <RelatedPromptsList\n :offset=\"48\"\n :frequency=\"72\"\n :maxRelatedPromptsPerGroup=\"6\"\n :maxGroups=\"3\"\n #default=\"{ items }\"\n >\n <BaseGrid :items=\"items\" :animation=\"animation\">\n <template #related-prompts-group=\"{ item }\">\n <span v-for=\"const prompt of items.relatedPrompts\">\n RelatedPromptsGroup:\n <pre>{{ prompt }}</pre>\n </span>\n </template>\n <template #result=\"{ item }\">\n <span>Result: {{ item.name }}</span>\n </template>\n <template #default=\"{ item }\">\n <span>Default: {{ item }}</span>\n </template>\n </BaseGrid>\n </RelatedPromptsList>\n </ResultsList>\n </div>\n</template>\n\n<script>\n import { RelatedPromptsList } from '@empathyco/x-components/related-prompts';\n import { ResultsList } from '@empathyco/x-components/search';\n import { SearchInput } from '@empathyco/x-components/search-box';\n import { BaseGrid } from '@empathyco/x-components';\n\n export default {\n name: 'RelatedPromptsListDemo',\n components: {\n RelatedPromptsLis,\n ResultsList,\n BaseGrid,\n SearchInput\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;AAgBE;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,oBAAoB;IAC1B,OAAO,EAAE,qBAAqB,CAAC,IAAI;AACnC,IAAA,KAAK,EAAE;AACL;;AAEE;AACF,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,aAAa;AACnB,YAAA,OAAO,EAAE,IAAG;AACb,SAAA;AACD;;AAEE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,EAAC;AACX,SAAA;AACD;;AAEE;AACF,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,EAAC;AACX,SAAA;AACD;;AAEE;AACF,QAAA,yBAAyB,EAAE;AACzB,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,CAAA;AACV,SAAA;AACD;;AAEE;AACF,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,SAAQ;AAClB,SAAA;AACD;;;AAGE;AACF,QAAA,mBAAmB,EAAE;AACnB,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,KAAI;AACf,SAAA;AACD,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAI,EAAG,EAAA;AACpB,QAAA,MAAM,EAAE,KAAK,EAAE,MAAO,EAAA,GAAI,QAAQ,CAAC,gBAAgB,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAA;AAEzE;;AAEE;AACF,QAAA,MAAM,cAAc,GAAiC,QAAQ,CAAC,gBAAgB,EAAE;YAC9E,gBAAe;SAChB,CAAC,CAAC,cAAc,CAAA;AAEjB;;AAEE;AACF,QAAA,MAAM,aAAY,GAAI,MAAM,CAA0B,SAAmB,CAAC,CAAA;AAE1E;;AAEE;AACF,QAAA,MAAM,YAAa,GAAE,MAAM,CAA2B,kBAA4B,CAAC,CAAA;AAEnF;;;;AAIE;AACF,QAAA,MAAM,oBAAqB,GAAE,QAAQ,CAAwB,MAC3D,MAAM,CAAC,MAAM,CACX,YAAY,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,KAAK,KAC1C,IAAI,CAAC,KAAK,CAAC,KAAM,GAAE,KAAK,CAAC,yBAAyB,CAAA,CACpD,CACF;AACG,aAAA,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;aACxB,GAAG,CAAC,CAAC,cAAc,EAAE,KAAK,MAAM;AAC/B,YAAA,SAAS,EAAE,qBAA8B;YACzC,EAAE,EAAE,CAAyB,sBAAA,EAAA,KAAK,CAAE,CAAA;YACpC,cAAa;SACd,CAAC,CAAA,CACL,CAAA;AAED;;AAEE;AACF,QAAA,MAAM,iBAAkB,GAAE,MAAM,CAAkB,cAAwB,CAAC,CAAA;AAE3E;;;;AAIE;QACF,MAAM,yBAA0B,GAAE,QAAQ,CACxC,MACE,CAAC,CAAC,aAAa,EAAE,KAAI;AACrB,aAAC,KAAK,CAAC,KAAI,KAAM,aAAa,CAAC,KAAM,IAAG,MAAM,CAAC,KAAM,KAAI,SAAS,CAAA,CACrE,CAAA;AAED;;;;;AAKE;QACF,MAAM,qBAAoB,GAAI,QAAQ,CACpC,MACE,CAAC,KAAK,CAAC,mBAAkB;YACzB,CAAC,YAAY,EAAE;AACf,YAAA,iBAAgB,KAAM,SAAQ;AAC9B,YAAA,iBAAiB,CAAC,KAAK,CAAC,MAAO,GAAE;YACjC,KAAK,CAAC,MAAK,GAAI,iBAAiB,CAAC,KAAK,CAAC,MAAK,CAC/C,CAAA;AAED;;;;AAIE;AACF,QAAA,MAAM,KAAI,GAAI,QAAQ,CAAC,MAAkB;AACvC,YAAA,IAAI,CAAC,iBAAiB,EAAE,KAAK,EAAE;gBAC7B,OAAO,oBAAoB,CAAC,KAAK,CAAA;AACnC,aAAA;YACA,IAAI,yBAAyB,CAAC,KAAK,EAAE;gBACnC,OAAO,iBAAiB,CAAC,KAAK,CAAA;AAChC,aAAA;YACA,IAAI,qBAAqB,CAAC,KAAK,EAAE;AAC/B,gBAAA,OAAO,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAE,IAAG,EAAE,CAAC,CAAA;AAC5E,aAAA;AACA,YAAA,OAAO,oBAAoB,EAAE,KAAK,CAAC,MAAM,CACvC,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,KAAK;gBACrC,MAAM,cAAc,KAAK,CAAC,SAAS,KAAK,CAAC,SAAQ,GAAI,KAAK,CAAA;AAC1D,gBAAA,IAAI,WAAU,IAAK,KAAK,CAAC,MAAM,EAAE;oBAC/B,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,mBAAmB,CAAC,CAAA;AACnD,iBAAA;AACA,gBAAA,OAAO,KAAK,CAAA;aACb,EACD,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAA,CAC5B,CAAA;AACH,SAAC,CAAC,CAAA;AAEF;;;;;;;AAOE;AACF,QAAA,OAAO,CAAC,cAAwB,EAAE,KAAK,CAAC,CAAA;AAExC,QAAA,OAAO,MAAM;AACX,YAAA,MAAM,UAAW,GAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAAQ,EAAG,CAAA;;AAErE,YAAA,OAAO,KAAK,CAAC,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,CAAE,IAAG,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,CAAA;AAC1E,SAAC,CAAA;KACH;AACD,CAAA,CAAC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-prompts-list.vue2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import _sfc_main from './related-prompts-tag-list.vue2.js';
|
|
2
|
+
import { resolveComponent, openBlock, createElementBlock, renderSlot, createCommentVNode, createVNode, withCtx, createElementVNode, normalizeClass, Fragment, renderList, normalizeStyle, mergeProps } from 'vue';
|
|
3
|
+
import './related-prompts-tag-list.vue3.js';
|
|
4
|
+
import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.js';
|
|
5
|
+
|
|
6
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
7
|
+
const _component_RelatedPrompt = resolveComponent("RelatedPrompt");
|
|
8
|
+
const _component_SlidingPanel = resolveComponent("SlidingPanel");
|
|
9
|
+
return openBlock(), createElementBlock("div", null, [
|
|
10
|
+
_ctx.$slots.header ? renderSlot(_ctx.$slots, "header", { key: 0 }) : createCommentVNode("v-if", true),
|
|
11
|
+
createVNode(_component_SlidingPanel, {
|
|
12
|
+
"reset-on-content-change": true,
|
|
13
|
+
"button-class": _ctx.buttonClass,
|
|
14
|
+
"scroll-container-class": _ctx.selectedPrompt === -1 ? "desktop:x-sliding-panel-fade desktop:x-sliding-panel-fade-sm" : ""
|
|
15
|
+
}, {
|
|
16
|
+
"sliding-panel-left-button": withCtx(() => [
|
|
17
|
+
renderSlot(_ctx.$slots, "sliding-panel-left-button")
|
|
18
|
+
]),
|
|
19
|
+
"sliding-panel-right-button": withCtx(() => [
|
|
20
|
+
renderSlot(_ctx.$slots, "sliding-panel-right-button")
|
|
21
|
+
]),
|
|
22
|
+
default: withCtx(() => [
|
|
23
|
+
renderSlot(_ctx.$slots, "sliding-panel-content", {}, () => [
|
|
24
|
+
createElementVNode(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
ref: "slidingPanelContent",
|
|
28
|
+
class: normalizeClass(["x-related-prompt__sliding-panel-content", { "x-related-prompt__sliding-panel-content-selected": _ctx.selectedPrompt !== -1 }])
|
|
29
|
+
},
|
|
30
|
+
[
|
|
31
|
+
(openBlock(true), createElementBlock(
|
|
32
|
+
Fragment,
|
|
33
|
+
null,
|
|
34
|
+
renderList(_ctx.relatedPrompts, (suggestion, index) => {
|
|
35
|
+
return openBlock(), createElementBlock(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
key: index,
|
|
39
|
+
style: normalizeStyle({
|
|
40
|
+
animationDelay: `${index * 0.4 + 0.05}s`
|
|
41
|
+
}),
|
|
42
|
+
class: normalizeClass(["x-related-prompt x-staggered-initial", [
|
|
43
|
+
{ "x-staggered-animation": _ctx.arePromptsVisible },
|
|
44
|
+
{ "x-hidden": _ctx.hidePrompt(index) },
|
|
45
|
+
{ "x-related-prompt-selected": _ctx.isSelected(index) }
|
|
46
|
+
]]),
|
|
47
|
+
"data-test": "related-prompt-item"
|
|
48
|
+
},
|
|
49
|
+
[
|
|
50
|
+
renderSlot(_ctx.$slots, "related-prompt-button", mergeProps({ ref_for: true }, { suggestion, index, arePromptsVisible: _ctx.arePromptsVisible, isSelected: _ctx.isSelected }), () => [
|
|
51
|
+
createVNode(_component_RelatedPrompt, {
|
|
52
|
+
"related-prompt": suggestion,
|
|
53
|
+
index,
|
|
54
|
+
"is-prompt-visible": _ctx.arePromptsVisible,
|
|
55
|
+
"is-selected": _ctx.isSelected(index)
|
|
56
|
+
}, null, 8, ["related-prompt", "index", "is-prompt-visible", "is-selected"])
|
|
57
|
+
])
|
|
58
|
+
],
|
|
59
|
+
6
|
|
60
|
+
/* CLASS, STYLE */
|
|
61
|
+
);
|
|
62
|
+
}),
|
|
63
|
+
128
|
|
64
|
+
/* KEYED_FRAGMENT */
|
|
65
|
+
))
|
|
66
|
+
],
|
|
67
|
+
2
|
|
68
|
+
/* CLASS */
|
|
69
|
+
)
|
|
70
|
+
])
|
|
71
|
+
]),
|
|
72
|
+
_: 3
|
|
73
|
+
/* FORWARDED */
|
|
74
|
+
}, 8, ["button-class", "scroll-container-class"])
|
|
75
|
+
]);
|
|
76
|
+
}
|
|
77
|
+
var relatedPromptsTagList = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
78
|
+
|
|
79
|
+
export { relatedPromptsTagList as default };
|
|
80
|
+
//# sourceMappingURL=related-prompts-tag-list.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-prompts-tag-list.vue.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompts-tag-list.vue"],"sourcesContent":["<template>\n <div>\n <template v-if=\"$slots.header\">\n <slot name=\"header\" />\n </template>\n <SlidingPanel\n :reset-on-content-change=\"true\"\n :button-class=\"buttonClass\"\n :scroll-container-class=\"\n selectedPrompt === -1 ? 'desktop:x-sliding-panel-fade desktop:x-sliding-panel-fade-sm' : ''\n \"\n >\n <template #sliding-panel-left-button>\n <slot name=\"sliding-panel-left-button\" />\n </template>\n\n <slot name=\"sliding-panel-content\">\n <div\n ref=\"slidingPanelContent\"\n class=\"x-related-prompt__sliding-panel-content\"\n :class=\"{ 'x-related-prompt__sliding-panel-content-selected': selectedPrompt !== -1 }\"\n >\n <div\n v-for=\"(suggestion, index) in relatedPrompts\"\n :key=\"index\"\n :style=\"{\n animationDelay: `${index * 0.4 + 0.05}s`\n }\"\n class=\"x-related-prompt x-staggered-initial\"\n :class=\"[\n { 'x-staggered-animation': arePromptsVisible },\n { 'x-hidden': hidePrompt(index) },\n { 'x-related-prompt-selected': isSelected(index) }\n ]\"\n data-test=\"related-prompt-item\"\n >\n <slot\n name=\"related-prompt-button\"\n v-bind=\"{ suggestion, index, arePromptsVisible, isSelected }\"\n >\n <RelatedPrompt\n :related-prompt=\"suggestion\"\n :index=\"index\"\n :is-prompt-visible=\"arePromptsVisible\"\n :is-selected=\"isSelected(index)\"\n />\n </slot>\n </div>\n </div>\n </slot>\n\n <template #sliding-panel-right-button>\n <slot name=\"sliding-panel-right-button\" />\n </template>\n </SlidingPanel>\n </div>\n</template>\n<script lang=\"ts\">\n import { defineComponent, onMounted, onUnmounted, ref } from 'vue';\n import SlidingPanel from '../../../components/sliding-panel.vue';\n import { relatedPromptsXModule } from '../x-module';\n import { useState } from '../../../composables/index';\n import RelatedPrompt from './related-prompt.vue';\n\n export default defineComponent({\n name: 'RelatedPromptsTagList',\n xModule: relatedPromptsXModule.name,\n components: { RelatedPrompt, SlidingPanel },\n props: {\n buttonClass: String\n },\n setup() {\n const { relatedPrompts, selectedPrompt } = useState('relatedPrompts', [\n 'relatedPrompts',\n 'selectedPrompt'\n ]);\n\n const slidingPanelContent = ref<Element>();\n const arePromptsVisible = ref(false);\n\n const observer = new IntersectionObserver(([entry]) => {\n arePromptsVisible.value = entry.isIntersecting;\n });\n\n onMounted(() => {\n observer.observe(slidingPanelContent.value as Element);\n });\n\n onUnmounted(() => {\n observer.disconnect();\n });\n\n const isSelected = (index: number): boolean => selectedPrompt.value === index;\n\n const hidePrompt = (index: number): boolean =>\n selectedPrompt.value !== -1 && selectedPrompt.value !== index;\n\n return {\n arePromptsVisible,\n hidePrompt,\n isSelected,\n relatedPrompts,\n selectedPrompt,\n slidingPanelContent\n };\n }\n });\n</script>\n\n<style lang=\"css\">\n .x-related-prompt__sliding-panel-content {\n display: flex;\n gap: 8px;\n }\n\n .x-related-prompt__sliding-panel-content-selected {\n width: calc(100%);\n }\n\n .x-related-prompt {\n display: flex;\n flex-direction: column;\n border-radius: 12px;\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 500ms;\n min-height: 112px;\n height: 100%;\n width: 303px;\n }\n\n .x-related-prompt-selected {\n width: 100% !important;\n min-height: 0;\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n\n &__button {\n width: 100% !important;\n }\n }\n\n .x-related-prompt__button {\n display: flex;\n flex-direction: row;\n gap: 12px;\n justify-content: space-between;\n align-items: start;\n text-align: start;\n padding: 16px;\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 500ms;\n flex-grow: 1;\n width: 303px;\n }\n\n .x-related-prompt__button-info {\n display: flex;\n min-height: 32px;\n }\n\n @media (max-width: 743px) {\n .x-related-prompt {\n width: 204px;\n &__button {\n width: 204px;\n }\n }\n }\n\n .x-no-scrollbar::-webkit-scrollbar {\n display: none;\n }\n\n .x-no-scrollbar {\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n }\n\n .x-typewritter-initial {\n color: #0000;\n background: linear-gradient(-90deg, transparent 5px, #0000 0) 10px 0,\n linear-gradient(#575757 0 0) 0 0;\n background-size: 0 200%;\n -webkit-background-clip: padding-box, text;\n background-clip: padding-box, text;\n background-repeat: no-repeat;\n }\n\n .x-typewritter-animation {\n animation: typewritter calc(var(--suggestion-text-length) * 0.05s)\n steps(var(--suggestion-text-length)) forwards;\n }\n\n @keyframes typewritter {\n from {\n background-size: 0 200%;\n }\n to {\n background-size: calc(var(--suggestion-text-length) * 1ch) 200%;\n }\n }\n\n .x-staggered-initial {\n opacity: 0;\n transform: translateY(20px);\n }\n\n .x-staggered-animation {\n animation: fadeInUp 0.6s forwards;\n }\n\n @keyframes fadeInUp {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n</style>\n"],"names":["_resolveComponent","_openBlock","_createElementBlock","_renderSlot","_createCommentVNode","_createVNode","selectedPrompt","_withCtx","_createElementVNode","_normalizeClass","relatedPrompts","_Fragment","_renderList","hidePrompt","isSelected","_mergeProps"],"mappings":";;;;;;;kCACEA,gBAsDM,CAAA,cAAA,CAAA,CAAA;AApDF,EAAA,OAAAC,SAAA,EAHN,EAAAC,kBAAA,CAAA,KAAA,EAAA,IAAA,EAAA;AAAA,IAKI,IAAA,CAAA,MAAA,CAAA,MAAA,GAAAC,UAAA,CAiDe,IAhDZ,CAAA,MAAA,EAAA,QAAA,EAAA,EAAA,GAAA,EAAA,CAAA,EAAA,CAAA,GAAAC,kBAAA,CAAA,MAAA,EAAyB,IAAI,CAAA;AAAA,IAAAC,WAAA,CAC7B,uBAAyB,EAAA;AAAA,MACzB,yBAAsB,EAAA,IAAA;AAAA,MAAA,cAAA,EAAWC,IAAc,CAAA,WAAA;AAAA,MAAA,wBAAA,EAAA,IAAA,CAAA,cAAA,KAAA,CAAA,CAAA,GAAA,8DAAA,GAAA,EAAA;;;QA2CrCH,UACiC,CAAA,IAAA,CAAA,MAAA,EAAA,2BAAA,CAAA;AAAA,OAAA,CAAA;;QApDlDA,UAiDa,CAAA,IAAA,CAAA,MAAA,EAAA,4BAAA,CAAA;AAAA,OAAA,CAAA;eAhCLI,OA+BM,CAAA,MAAA;AAAA,QAAAJ,UAAA,CA9BA,IAAqB,CAAA,MAAA,EAAA,uBAAA,EAAA,EAAA,EAAA,MAAA;AAAA,UAAAK,kBAAA;AAlBnC,YAAA,KAAA;AAAA,YAmBgB;AAAA,cAAA,GAAA,EAAA,qBAAA;AAGN,cAAA,KAAA,EAAAC,cAAA,CAAA,CAAA,yCAAA,EAtBV,EAuB0CC,kDAAL,EAAA,IAAA,CAAA,cAAA,KAAA,CAAA,CAAA,EAAA,CAAA,CAAA;AAAA,aAAA;;yBACnB,IAAK,CAAA,EAAAR,kBAAA;AAAA,gBAAAS,QAAA;AAAA,gBAAA,IAAA;AAAA,gBAAAC,UAAA,CAAA,IAAA,CAAA,cAAA,EAAA,CAAA,UAAA,EAAA,KAAA,KAAA;yBACLX,SAzBlB,EAAA,EAAAC,kBAAA;AAAA,oBAAA,KAAA;AAAA,oBAAA;AAAA,sBAAA,GAAA,EAAA,KAAA;;wCAAA,CA4BkB,EAAA,KAAA,GAAA,GAAA,GAAA,IAAA,CAAA,CAAA,CAAA;AAAA,uBAAA,CAAA;4CAC8FW,CAAgB,sCAAA,EAAA;AAAA,wBAAA,EAAA,uBAAA,EAAA,IAAA,CAAkDC,iBAAW,EAAA;AAAA,wBAAA,EAAA,UAAA,EAAA,IAAA,CAAA,UAAA,CAAA,KAAA,CAAA,EAAA;AAKjL,wBAAA,EAAA,2BAAA,EAAU,IAAqB,CAAA,UAAA,CAAA,KAAA,CAAA,EAAA;AAAA,uBAAA,CAAA,CAAA;sBAE/B,WAUO,EAAA,qBAAA;AAAA,qBAAA;;AALF,sBAAAX,UAAA,CAAA,IAAA,CAAA,MAAA,EAAgB,uBAAU,EAAAY,UAAA,CAAA,EAAA,OAAA,EAAA,IAAA,EAAA,EAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,CAAA,iBAAA,EAAA,UAAA,EAAA,IAAA,CAAA,UAAA,EAAA,CAAA,EAAA,MAAA;AAAA,wBAAAV,WAAA,CACnB,wBAAK,EAAA;AAAA,0BACZ,gBAAA,EAAA,UAAA;AAAA,0BACA,KAAA;AAAA,0BAAA,mBAAA,EAAA,IAAA,CAAA,iBAAA;;;;;;;;;;;;;;;;AA5CjB,SAAA,CAAA;AAAA,OAAA,CAAA;;;;;;;;;;"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineComponent, ref, onMounted, onUnmounted } from 'vue';
|
|
2
|
+
import SlidingPanel from '../../../components/sliding-panel.vue.js';
|
|
3
|
+
import { relatedPromptsXModule } from '../x-module.js';
|
|
4
|
+
import '../../../composables/create-use-device.js';
|
|
5
|
+
import '@vue/devtools-api';
|
|
6
|
+
import '../../../plugins/devtools/timeline.devtools.js';
|
|
7
|
+
import '@empathyco/x-utils';
|
|
8
|
+
import 'rxjs/operators';
|
|
9
|
+
import 'rxjs';
|
|
10
|
+
import '../../../plugins/devtools/colors.utils.js';
|
|
11
|
+
import '../../../plugins/x-bus.js';
|
|
12
|
+
import '../../../plugins/x-plugin.js';
|
|
13
|
+
import 'vuex';
|
|
14
|
+
import '@vueuse/core';
|
|
15
|
+
import { useState } from '../../../composables/use-state.js';
|
|
16
|
+
import RelatedPrompt from './related-prompt.vue.js';
|
|
17
|
+
|
|
18
|
+
var _sfc_main = defineComponent({
|
|
19
|
+
name: 'RelatedPromptsTagList',
|
|
20
|
+
xModule: relatedPromptsXModule.name,
|
|
21
|
+
components: { RelatedPrompt, SlidingPanel },
|
|
22
|
+
props: {
|
|
23
|
+
buttonClass: String
|
|
24
|
+
},
|
|
25
|
+
setup() {
|
|
26
|
+
const { relatedPrompts, selectedPrompt } = useState('relatedPrompts', [
|
|
27
|
+
'relatedPrompts',
|
|
28
|
+
'selectedPrompt'
|
|
29
|
+
]);
|
|
30
|
+
const slidingPanelContent = ref();
|
|
31
|
+
const arePromptsVisible = ref(false);
|
|
32
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
33
|
+
arePromptsVisible.value = entry.isIntersecting;
|
|
34
|
+
});
|
|
35
|
+
onMounted(() => {
|
|
36
|
+
observer.observe(slidingPanelContent.value);
|
|
37
|
+
});
|
|
38
|
+
onUnmounted(() => {
|
|
39
|
+
observer.disconnect();
|
|
40
|
+
});
|
|
41
|
+
const isSelected = (index) => selectedPrompt.value === index;
|
|
42
|
+
const hidePrompt = (index) => selectedPrompt.value !== -1 && selectedPrompt.value !== index;
|
|
43
|
+
return {
|
|
44
|
+
arePromptsVisible,
|
|
45
|
+
hidePrompt,
|
|
46
|
+
isSelected,
|
|
47
|
+
relatedPrompts,
|
|
48
|
+
selectedPrompt,
|
|
49
|
+
slidingPanelContent
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export { _sfc_main as default };
|
|
55
|
+
//# sourceMappingURL=related-prompts-tag-list.vue2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-prompts-tag-list.vue2.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompts-tag-list.vue"],"sourcesContent":["<template>\n <div>\n <template v-if=\"$slots.header\">\n <slot name=\"header\" />\n </template>\n <SlidingPanel\n :reset-on-content-change=\"true\"\n :button-class=\"buttonClass\"\n :scroll-container-class=\"\n selectedPrompt === -1 ? 'desktop:x-sliding-panel-fade desktop:x-sliding-panel-fade-sm' : ''\n \"\n >\n <template #sliding-panel-left-button>\n <slot name=\"sliding-panel-left-button\" />\n </template>\n\n <slot name=\"sliding-panel-content\">\n <div\n ref=\"slidingPanelContent\"\n class=\"x-related-prompt__sliding-panel-content\"\n :class=\"{ 'x-related-prompt__sliding-panel-content-selected': selectedPrompt !== -1 }\"\n >\n <div\n v-for=\"(suggestion, index) in relatedPrompts\"\n :key=\"index\"\n :style=\"{\n animationDelay: `${index * 0.4 + 0.05}s`\n }\"\n class=\"x-related-prompt x-staggered-initial\"\n :class=\"[\n { 'x-staggered-animation': arePromptsVisible },\n { 'x-hidden': hidePrompt(index) },\n { 'x-related-prompt-selected': isSelected(index) }\n ]\"\n data-test=\"related-prompt-item\"\n >\n <slot\n name=\"related-prompt-button\"\n v-bind=\"{ suggestion, index, arePromptsVisible, isSelected }\"\n >\n <RelatedPrompt\n :related-prompt=\"suggestion\"\n :index=\"index\"\n :is-prompt-visible=\"arePromptsVisible\"\n :is-selected=\"isSelected(index)\"\n />\n </slot>\n </div>\n </div>\n </slot>\n\n <template #sliding-panel-right-button>\n <slot name=\"sliding-panel-right-button\" />\n </template>\n </SlidingPanel>\n </div>\n</template>\n<script lang=\"ts\">\n import { defineComponent, onMounted, onUnmounted, ref } from 'vue';\n import SlidingPanel from '../../../components/sliding-panel.vue';\n import { relatedPromptsXModule } from '../x-module';\n import { useState } from '../../../composables/index';\n import RelatedPrompt from './related-prompt.vue';\n\n export default defineComponent({\n name: 'RelatedPromptsTagList',\n xModule: relatedPromptsXModule.name,\n components: { RelatedPrompt, SlidingPanel },\n props: {\n buttonClass: String\n },\n setup() {\n const { relatedPrompts, selectedPrompt } = useState('relatedPrompts', [\n 'relatedPrompts',\n 'selectedPrompt'\n ]);\n\n const slidingPanelContent = ref<Element>();\n const arePromptsVisible = ref(false);\n\n const observer = new IntersectionObserver(([entry]) => {\n arePromptsVisible.value = entry.isIntersecting;\n });\n\n onMounted(() => {\n observer.observe(slidingPanelContent.value as Element);\n });\n\n onUnmounted(() => {\n observer.disconnect();\n });\n\n const isSelected = (index: number): boolean => selectedPrompt.value === index;\n\n const hidePrompt = (index: number): boolean =>\n selectedPrompt.value !== -1 && selectedPrompt.value !== index;\n\n return {\n arePromptsVisible,\n hidePrompt,\n isSelected,\n relatedPrompts,\n selectedPrompt,\n slidingPanelContent\n };\n }\n });\n</script>\n\n<style lang=\"css\">\n .x-related-prompt__sliding-panel-content {\n display: flex;\n gap: 8px;\n }\n\n .x-related-prompt__sliding-panel-content-selected {\n width: calc(100%);\n }\n\n .x-related-prompt {\n display: flex;\n flex-direction: column;\n border-radius: 12px;\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 500ms;\n min-height: 112px;\n height: 100%;\n width: 303px;\n }\n\n .x-related-prompt-selected {\n width: 100% !important;\n min-height: 0;\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n\n &__button {\n width: 100% !important;\n }\n }\n\n .x-related-prompt__button {\n display: flex;\n flex-direction: row;\n gap: 12px;\n justify-content: space-between;\n align-items: start;\n text-align: start;\n padding: 16px;\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 500ms;\n flex-grow: 1;\n width: 303px;\n }\n\n .x-related-prompt__button-info {\n display: flex;\n min-height: 32px;\n }\n\n @media (max-width: 743px) {\n .x-related-prompt {\n width: 204px;\n &__button {\n width: 204px;\n }\n }\n }\n\n .x-no-scrollbar::-webkit-scrollbar {\n display: none;\n }\n\n .x-no-scrollbar {\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n }\n\n .x-typewritter-initial {\n color: #0000;\n background: linear-gradient(-90deg, transparent 5px, #0000 0) 10px 0,\n linear-gradient(#575757 0 0) 0 0;\n background-size: 0 200%;\n -webkit-background-clip: padding-box, text;\n background-clip: padding-box, text;\n background-repeat: no-repeat;\n }\n\n .x-typewritter-animation {\n animation: typewritter calc(var(--suggestion-text-length) * 0.05s)\n steps(var(--suggestion-text-length)) forwards;\n }\n\n @keyframes typewritter {\n from {\n background-size: 0 200%;\n }\n to {\n background-size: calc(var(--suggestion-text-length) * 1ch) 200%;\n }\n }\n\n .x-staggered-initial {\n opacity: 0;\n transform: translateY(20px);\n }\n\n .x-staggered-animation {\n animation: fadeInUp 0.6s forwards;\n }\n\n @keyframes fadeInUp {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n</style>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAgEE,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,uBAAuB;IAC7B,OAAO,EAAE,qBAAqB,CAAC,IAAI;AACnC,IAAA,UAAU,EAAE,EAAE,aAAa,EAAE,cAAc;AAC3C,IAAA,KAAK,EAAE;AACL,QAAA,WAAW,EAAE,MAAK;AACnB,KAAA;IACD,KAAK,GAAA;QACH,MAAM,EAAE,cAAc,EAAE,cAAa,EAAI,GAAE,QAAQ,CAAC,gBAAgB,EAAE;YACpE,gBAAgB;YAChB,gBAAe;AAChB,SAAA,CAAC,CAAA;AAEF,QAAA,MAAM,mBAAkB,GAAI,GAAG,EAAW,CAAA;AAC1C,QAAA,MAAM,iBAAgB,GAAI,GAAG,CAAC,KAAK,CAAC,CAAA;QAEpC,MAAM,QAAS,GAAE,IAAI,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK;AACrD,YAAA,iBAAiB,CAAC,KAAM,GAAE,KAAK,CAAC,cAAc,CAAA;AAChD,SAAC,CAAC,CAAA;QAEF,SAAS,CAAC,MAAM;AACd,YAAA,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,KAAgB,CAAC,CAAA;AACxD,SAAC,CAAC,CAAA;QAEF,WAAW,CAAC,MAAM;YAChB,QAAQ,CAAC,UAAU,EAAE,CAAA;AACvB,SAAC,CAAC,CAAA;AAEF,QAAA,MAAM,UAAW,GAAE,CAAC,KAAa,KAAc,cAAc,CAAC,KAAI,KAAM,KAAK,CAAA;AAE7E,QAAA,MAAM,UAAW,GAAE,CAAC,KAAa,KAC/B,cAAc,CAAC,KAAI,KAAM,CAAC,CAAA,IAAK,cAAc,CAAC,KAAM,KAAI,KAAK,CAAA;QAE/D,OAAO;YACL,iBAAiB;YACjB,UAAU;YACV,UAAU;YACV,cAAc;YACd,cAAc;YACd,mBAAkB;SACnB,CAAA;KACH;AACD,CAAA,CAAC;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import injectCss from '../../../../tools/inject-css.js';
|
|
2
|
+
|
|
3
|
+
var css = ".x-related-prompt__sliding-panel-content{display:flex;gap:8px}.x-related-prompt__sliding-panel-content-selected{width:100%}.x-related-prompt{border-radius:12px;display:flex;flex-direction:column;height:100%;min-height:112px;transition-duration:.5s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);width:303px}.x-related-prompt-selected{border-bottom-left-radius:0;border-bottom-right-radius:0;min-height:0;width:100%!important}.x-related-prompt-selected__button{width:100%!important}[dir=ltr] .x-related-prompt__button{text-align:left}[dir=rtl] .x-related-prompt__button{text-align:right}.x-related-prompt__button{align-items:start;display:flex;flex-direction:row;flex-grow:1;gap:12px;justify-content:space-between;padding:16px;transition-duration:.5s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);width:303px}.x-related-prompt__button-info{display:flex;min-height:32px}@media (max-width:743px){.x-related-prompt,.x-related-prompt__button{width:204px}}.x-no-scrollbar::-webkit-scrollbar{display:none}.x-no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}.x-typewritter-initial{background:linear-gradient(-90deg,transparent 5px,#0000 0) 10px 0,linear-gradient(#575757 0 0) 0 0;background-clip:padding-box,text;background-repeat:no-repeat;background-size:0 200%;color:#0000}.x-typewritter-animation{animation:typewritter calc(var(--suggestion-text-length)*.05s) steps(var(--suggestion-text-length)) forwards}@keyframes typewritter{0%{background-size:0 200%}to{background-size:calc(var(--suggestion-text-length)*1ch) 200%}}.x-staggered-initial{opacity:0;transform:translateY(20px)}.x-staggered-animation{animation:fadeInUp .6s forwards}@keyframes fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}";
|
|
4
|
+
injectCss(css);
|
|
5
|
+
|
|
6
|
+
export { css, css as default };
|
|
7
|
+
//# sourceMappingURL=related-prompts-tag-list.vue3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-prompts-tag-list.vue3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createFetchAndSaveActions } from '../../../../store/utils/fetch-and-save-action.utils.js';
|
|
2
|
+
|
|
3
|
+
const { fetchAndSave, cancelPrevious } = createFetchAndSaveActions({
|
|
4
|
+
fetch({ dispatch }, request) {
|
|
5
|
+
return dispatch('fetchRelatedPrompts', request);
|
|
6
|
+
},
|
|
7
|
+
onSuccess({ commit }, relatedPrompts) {
|
|
8
|
+
if (relatedPrompts) {
|
|
9
|
+
commit('setRelatedPromptsProducts', relatedPrompts);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Default implementation for
|
|
15
|
+
* {@link RelatedPromptsActions.fetchAndSaveRelatedPrompts} action.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
const fetchAndSaveRelatedPrompts = fetchAndSave;
|
|
20
|
+
/**
|
|
21
|
+
* Default implementation for
|
|
22
|
+
* {@link RelatedPromptsActions.cancelFetchAndSaveRelatedPrompts} action.
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
const cancelFetchAndSaveRelatedPrompts = cancelPrevious;
|
|
27
|
+
|
|
28
|
+
export { cancelFetchAndSaveRelatedPrompts, fetchAndSaveRelatedPrompts };
|
|
29
|
+
//# sourceMappingURL=fetch-and-save-related-prompts.action.js.map
|