@empathyco/x-components 6.0.0-alpha.95 → 6.0.0-alpha.97
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 +17 -0
- package/core/index.js +0 -1
- package/core/index.js.map +1 -1
- package/docs/API-reference/components/related-prompts/x-components.related-prompt.md +7 -7
- package/docs/API-reference/components/related-prompts/x-components.related-prompts-list.md +15 -22
- package/docs/API-reference/components/related-prompts/x-components.related-prompts-tag-list.md +1 -1
- package/js/components/base-keyboard-navigation.vue2.js +1 -1
- package/js/components/display-click-provider.vue.js +1 -1
- package/js/components/modals/base-id-modal-close.vue2.js +1 -1
- package/js/components/modals/base-id-modal-open.vue2.js +1 -1
- package/js/components/modals/base-id-modal.vue2.js +1 -1
- package/js/components/modals/base-modal.vue2.js +1 -1
- package/js/components/page-loader-button.vue2.js +1 -1
- package/js/components/page-selector.vue2.js +1 -1
- package/js/components/panels/base-id-toggle-panel-button.vue2.js +1 -1
- package/js/components/panels/base-id-toggle-panel.vue2.js +1 -1
- package/js/components/result/base-result-link.vue2.js +1 -1
- package/js/components/result/base-result-rating.vue2.js +1 -1
- package/js/components/suggestions/base-suggestion.vue2.js +1 -1
- package/js/composables/use-alias-api.js +1 -1
- package/js/composables/use-alias-api.js.map +1 -1
- package/js/index.js +0 -1
- package/js/index.js.map +1 -1
- package/js/x-modules/empathize/components/empathize.vue2.js +1 -1
- package/js/x-modules/facets/components/filters/editable-number-range-filter.vue2.js +1 -1
- package/js/x-modules/queries-preview/components/query-preview-button.vue2.js +1 -1
- package/js/x-modules/queries-preview/components/query-preview-list.vue2.js +1 -1
- package/js/x-modules/queries-preview/components/query-preview.vue2.js +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestion.vue2.js +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestions.vue2.js +1 -1
- package/js/x-modules/recommendations/components/recommendations.vue2.js +1 -1
- package/js/x-modules/related-prompts/components/related-prompt.vue.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompt.vue2.js +10 -0
- package/js/x-modules/related-prompts/components/related-prompt.vue2.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompts-list.vue.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js +1 -1
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js.map +1 -1
- package/js/x-modules/scroll/components/scroll-to-top.vue2.js +1 -1
- package/js/x-modules/semantic-queries/components/semantic-queries.vue2.js +1 -1
- package/package.json +3 -3
- package/report/x-components.api.md +0 -3
- package/types/composables/index.d.ts +0 -1
- package/types/composables/index.d.ts.map +1 -1
- package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts +20 -0
- package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts.map +1 -1
- package/types/composables/use-store.d.ts +0 -10
- package/types/composables/use-store.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 6.0.0-alpha.97 (2025-06-17)
|
|
7
|
+
|
|
8
|
+
* fix(docs): fix related prompts documentation (#1801) ([7f9ee87](https://github.com/empathyco/x/commit/7f9ee87)), closes [#1801](https://github.com/empathyco/x/issues/1801)
|
|
9
|
+
* feat(use-store): remove use-store ([752d70f](https://github.com/empathyco/x/commit/752d70f))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## 6.0.0-alpha.96 (2025-06-13)
|
|
16
|
+
|
|
17
|
+
**Note:** Version bump only for package @empathyco/x-components
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## 6.0.0-alpha.95 (2025-06-06)
|
|
7
24
|
|
|
8
25
|
* feat(logger): remove x-logger (#1800) ([70d210a](https://github.com/empathyco/x/commit/70d210a)), closes [#1800](https://github.com/empathyco/x/issues/1800)
|
package/core/index.js
CHANGED
|
@@ -151,7 +151,6 @@ export { useDebounce } from '../js/composables/use-debounce.js';
|
|
|
151
151
|
export { useGetter } from '../js/composables/use-getter.js';
|
|
152
152
|
export { useEmitDisplayEvent, useOnDisplay } from '../js/composables/use-on-display.js';
|
|
153
153
|
export { useState } from '../js/composables/use-state.js';
|
|
154
|
-
export { useStore } from 'vuex';
|
|
155
154
|
export { useXBus } from '../js/composables/use-x-bus.js';
|
|
156
155
|
export { infiniteScroll } from '../js/directives/infinite-scroll.js';
|
|
157
156
|
export { typing } from '../js/directives/typing.js';
|
package/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -10,13 +10,13 @@ This component shows a suggested related prompt.
|
|
|
10
10
|
|
|
11
11
|
## Props
|
|
12
12
|
|
|
13
|
-
| Name | Description
|
|
14
|
-
| -------------------------- |
|
|
15
|
-
| <code>relatedPrompt</code> |
|
|
16
|
-
| <code>selected</code> |
|
|
13
|
+
| Name | Description | Type | Default |
|
|
14
|
+
| -------------------------- | -------------------------------------------- | -------------------------- | ------------------ |
|
|
15
|
+
| <code>relatedPrompt</code> | The related prompt to render. | <code>RelatedPrompt</code> | <code></code> |
|
|
16
|
+
| <code>selected</code> | Indicates if the related prompt is selected. | <code>boolean</code> | <code>false</code> |
|
|
17
17
|
|
|
18
18
|
## Slots
|
|
19
19
|
|
|
20
|
-
| Name | Description
|
|
21
|
-
| ----------------------------------------- |
|
|
22
|
-
| <code>related-prompt-extra-content</code> |
|
|
20
|
+
| Name | Description | Bindings<br />(name - type - description) |
|
|
21
|
+
| ----------------------------------------- | ---------------------------------------------------- | ----------------------------------------- |
|
|
22
|
+
| <code>related-prompt-extra-content</code> | The slot to render related prompt extra information. | |
|
|
@@ -26,13 +26,6 @@ This component emits no events.
|
|
|
26
26
|
|
|
27
27
|
## See it in action
|
|
28
28
|
|
|
29
|
-
<!-- prettier-ignore-start -->
|
|
30
|
-
|
|
31
|
-
:::warning Backend microservice required To use this component, the <b>QuerySignals</b> microservice
|
|
32
|
-
must be implemented. :::
|
|
33
|
-
|
|
34
|
-
<!-- prettier-ignore-end -->
|
|
35
|
-
|
|
36
29
|
Usually, this component is going to be used together with the `ResultsList` one. Related prompts
|
|
37
30
|
groups will be inserted between the results, guiding users to discover new searches directly from
|
|
38
31
|
the results list.
|
|
@@ -63,14 +56,13 @@ export default {
|
|
|
63
56
|
</script>
|
|
64
57
|
```
|
|
65
58
|
|
|
66
|
-
### Play with the
|
|
59
|
+
### Play with the position in the index
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
example
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
(`maxRelatedPromptsPerGroup`).
|
|
61
|
+
Play with the `offset` and `frequency` props, indicating the indices for inserting groups of related prompts.
|
|
62
|
+
The following example shows that only three groups of related prompts can be added, as the `maxGroups` prop
|
|
63
|
+
is set to `3`. The first group of related prompts is inserted at index `48` using the `offset` prop. Since the
|
|
64
|
+
`frequency` prop is set to `72`, the second and third groups are inserted at indices `120` and `192`, respectively.
|
|
65
|
+
Each group can contain up to `6` related prompts (`maxRelatedPromptsPerGroup`).
|
|
74
66
|
|
|
75
67
|
```vue live
|
|
76
68
|
<template>
|
|
@@ -103,11 +95,12 @@ export default {
|
|
|
103
95
|
</script>
|
|
104
96
|
```
|
|
105
97
|
|
|
106
|
-
### Showing/hiding first related prompts
|
|
98
|
+
### Showing/hiding the first related prompts
|
|
99
|
+
|
|
100
|
+
By default, the first group of related prompts is inserted when the total number of results is
|
|
101
|
+
smaller than the offset. You can deactivate this behavior by setting the `showOnlyAfterOffset` prop to `true`.
|
|
107
102
|
|
|
108
|
-
|
|
109
|
-
smaller than the offset, but this behavior can be deactivated by setting the `showOnlyAfterOffset`
|
|
110
|
-
to `true`.
|
|
103
|
+
In the following example, related prompts will be displayed regardless of the number of results being over `48`.
|
|
111
104
|
|
|
112
105
|
```vue live
|
|
113
106
|
<template>
|
|
@@ -140,11 +133,11 @@ export default {
|
|
|
140
133
|
</script>
|
|
141
134
|
```
|
|
142
135
|
|
|
143
|
-
###
|
|
136
|
+
### Customize the component layout
|
|
144
137
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
138
|
+
By default, this component shows the `id` of each search item, both the injected and the groups of
|
|
139
|
+
related prompts generated. However, it's common to customize it using a layout component such as
|
|
140
|
+
the `BaseGrid` component. To do so, you can use the `default` slot as follows:
|
|
148
141
|
|
|
149
142
|
```vue
|
|
150
143
|
<template>
|
package/docs/API-reference/components/related-prompts/x-components.related-prompts-tag-list.md
CHANGED
|
@@ -28,5 +28,5 @@ necessary to handle the selection of the related prompt and to trigger the stagg
|
|
|
28
28
|
| ----------------------------------------- | ------------------------------------------------------------------ | ----------------------------------------- |
|
|
29
29
|
| <code>sliding-panel-left-button</code> | The button to be displayed on the left side of the sliding panel. | None |
|
|
30
30
|
| <code>default</code> | - The slot to render related prompt information. | <br /><br /> |
|
|
31
|
-
| <code>related-prompt-extra-content</code> |
|
|
31
|
+
| <code>related-prompt-extra-content</code> | The slot to render related prompt extra information. | |
|
|
32
32
|
| <code>sliding-panel-right-button</code> | The button to be displayed on the right side of the sliding panel. | None |
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, ref, computed, onMounted } from 'vue';
|
|
2
2
|
import '../composables/create-use-device.js';
|
|
3
|
+
import 'vuex';
|
|
3
4
|
import '@vue/devtools-api';
|
|
4
5
|
import '../plugins/devtools/timeline.devtools.js';
|
|
5
6
|
import '@empathyco/x-utils';
|
|
@@ -8,7 +9,6 @@ import 'rxjs';
|
|
|
8
9
|
import '../plugins/devtools/colors.utils.js';
|
|
9
10
|
import '../plugins/x-bus.js';
|
|
10
11
|
import '../plugins/x-plugin.js';
|
|
11
|
-
import 'vuex';
|
|
12
12
|
import { useXBus } from '../composables/use-x-bus.js';
|
|
13
13
|
import '@vueuse/core';
|
|
14
14
|
import { DirectionalFocusNavigationService } from '../services/directional-focus-navigation.service.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineComponent, computed, provide } from 'vue';
|
|
2
2
|
import '../composables/create-use-device.js';
|
|
3
3
|
import { use$x } from '../composables/use-_x.js';
|
|
4
|
+
import 'vuex';
|
|
4
5
|
import '@vue/devtools-api';
|
|
5
6
|
import '../plugins/devtools/timeline.devtools.js';
|
|
6
7
|
import '@empathyco/x-utils';
|
|
@@ -9,7 +10,6 @@ import 'rxjs';
|
|
|
9
10
|
import '../plugins/devtools/colors.utils.js';
|
|
10
11
|
import '../plugins/x-bus.js';
|
|
11
12
|
import '../plugins/x-plugin.js';
|
|
12
|
-
import 'vuex';
|
|
13
13
|
import '@vueuse/core';
|
|
14
14
|
|
|
15
15
|
var _sfc_main = defineComponent({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineComponent } from 'vue';
|
|
2
2
|
import '../../composables/create-use-device.js';
|
|
3
3
|
import { use$x } from '../../composables/use-_x.js';
|
|
4
|
+
import 'vuex';
|
|
4
5
|
import '@vue/devtools-api';
|
|
5
6
|
import '../../plugins/devtools/timeline.devtools.js';
|
|
6
7
|
import '@empathyco/x-utils';
|
|
@@ -9,7 +10,6 @@ import 'rxjs';
|
|
|
9
10
|
import '../../plugins/devtools/colors.utils.js';
|
|
10
11
|
import '../../plugins/x-bus.js';
|
|
11
12
|
import '../../plugins/x-plugin.js';
|
|
12
|
-
import 'vuex';
|
|
13
13
|
import '@vueuse/core';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineComponent } from 'vue';
|
|
2
2
|
import '../../composables/create-use-device.js';
|
|
3
3
|
import { use$x } from '../../composables/use-_x.js';
|
|
4
|
+
import 'vuex';
|
|
4
5
|
import '@vue/devtools-api';
|
|
5
6
|
import '../../plugins/devtools/timeline.devtools.js';
|
|
6
7
|
import '@empathyco/x-utils';
|
|
@@ -9,7 +10,6 @@ import 'rxjs';
|
|
|
9
10
|
import '../../plugins/devtools/colors.utils.js';
|
|
10
11
|
import '../../plugins/x-bus.js';
|
|
11
12
|
import '../../plugins/x-plugin.js';
|
|
12
|
-
import 'vuex';
|
|
13
13
|
import '@vueuse/core';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, ref } from 'vue';
|
|
2
2
|
import '../../composables/create-use-device.js';
|
|
3
|
+
import 'vuex';
|
|
3
4
|
import '@vue/devtools-api';
|
|
4
5
|
import '../../plugins/devtools/timeline.devtools.js';
|
|
5
6
|
import '@empathyco/x-utils';
|
|
@@ -8,7 +9,6 @@ import 'rxjs';
|
|
|
8
9
|
import '../../plugins/devtools/colors.utils.js';
|
|
9
10
|
import '../../plugins/x-bus.js';
|
|
10
11
|
import '../../plugins/x-plugin.js';
|
|
11
|
-
import 'vuex';
|
|
12
12
|
import { useXBus } from '../../composables/use-x-bus.js';
|
|
13
13
|
import '@vueuse/core';
|
|
14
14
|
import { AnimationProp } from '../../types/animation-prop.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, ref, onMounted, watch, onBeforeUnmount, nextTick } from 'vue';
|
|
2
2
|
import '../../composables/create-use-device.js';
|
|
3
|
+
import 'vuex';
|
|
3
4
|
import '@vue/devtools-api';
|
|
4
5
|
import '../../plugins/devtools/timeline.devtools.js';
|
|
5
6
|
import '@empathyco/x-utils';
|
|
@@ -8,7 +9,6 @@ import 'rxjs';
|
|
|
8
9
|
import '../../plugins/devtools/colors.utils.js';
|
|
9
10
|
import '../../plugins/x-bus.js';
|
|
10
11
|
import '../../plugins/x-plugin.js';
|
|
11
|
-
import 'vuex';
|
|
12
12
|
import { useDebounce } from '../../composables/use-debounce.js';
|
|
13
13
|
import '@vueuse/core';
|
|
14
14
|
import { AnimationProp } from '../../types/animation-prop.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineComponent, computed } from 'vue';
|
|
2
2
|
import '../composables/create-use-device.js';
|
|
3
3
|
import { use$x } from '../composables/use-_x.js';
|
|
4
|
+
import 'vuex';
|
|
4
5
|
import '@vue/devtools-api';
|
|
5
6
|
import '../plugins/devtools/timeline.devtools.js';
|
|
6
7
|
import '@empathyco/x-utils';
|
|
@@ -9,7 +10,6 @@ import 'rxjs';
|
|
|
9
10
|
import '../plugins/devtools/colors.utils.js';
|
|
10
11
|
import '../plugins/x-bus.js';
|
|
11
12
|
import '../plugins/x-plugin.js';
|
|
12
|
-
import 'vuex';
|
|
13
13
|
import '@vueuse/core';
|
|
14
14
|
import BaseEventButton from './base-event-button.vue.js';
|
|
15
15
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, computed } from 'vue';
|
|
2
2
|
import '../composables/create-use-device.js';
|
|
3
|
+
import 'vuex';
|
|
3
4
|
import '@vue/devtools-api';
|
|
4
5
|
import '../plugins/devtools/timeline.devtools.js';
|
|
5
6
|
import '@empathyco/x-utils';
|
|
@@ -8,7 +9,6 @@ import 'rxjs';
|
|
|
8
9
|
import '../plugins/devtools/colors.utils.js';
|
|
9
10
|
import '../plugins/x-bus.js';
|
|
10
11
|
import '../plugins/x-plugin.js';
|
|
11
|
-
import 'vuex';
|
|
12
12
|
import { useXBus } from '../composables/use-x-bus.js';
|
|
13
13
|
import '@vueuse/core';
|
|
14
14
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, ref, computed } from 'vue';
|
|
2
2
|
import '../../composables/create-use-device.js';
|
|
3
|
+
import 'vuex';
|
|
3
4
|
import '@vue/devtools-api';
|
|
4
5
|
import '../../plugins/devtools/timeline.devtools.js';
|
|
5
6
|
import '@empathyco/x-utils';
|
|
@@ -8,7 +9,6 @@ import 'rxjs';
|
|
|
8
9
|
import '../../plugins/devtools/colors.utils.js';
|
|
9
10
|
import '../../plugins/x-bus.js';
|
|
10
11
|
import '../../plugins/x-plugin.js';
|
|
11
|
-
import 'vuex';
|
|
12
12
|
import { useXBus } from '../../composables/use-x-bus.js';
|
|
13
13
|
import '@vueuse/core';
|
|
14
14
|
import BaseEventButton from '../base-event-button.vue.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineComponent, ref, watch } from 'vue';
|
|
2
2
|
import '../../composables/create-use-device.js';
|
|
3
3
|
import { use$x } from '../../composables/use-_x.js';
|
|
4
|
+
import 'vuex';
|
|
4
5
|
import '@vue/devtools-api';
|
|
5
6
|
import '../../plugins/devtools/timeline.devtools.js';
|
|
6
7
|
import '@empathyco/x-utils';
|
|
@@ -9,7 +10,6 @@ import 'rxjs';
|
|
|
9
10
|
import '../../plugins/devtools/colors.utils.js';
|
|
10
11
|
import '../../plugins/x-bus.js';
|
|
11
12
|
import '../../plugins/x-plugin.js';
|
|
12
|
-
import 'vuex';
|
|
13
13
|
import '@vueuse/core';
|
|
14
14
|
import { AnimationProp } from '../../types/animation-prop.js';
|
|
15
15
|
import '../animations/animate-clip-path/animate-clip-path.style.scss.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineComponent, ref, inject } from 'vue';
|
|
2
2
|
import '../../composables/create-use-device.js';
|
|
3
3
|
import { use$x } from '../../composables/use-_x.js';
|
|
4
|
+
import 'vuex';
|
|
4
5
|
import '@vue/devtools-api';
|
|
5
6
|
import '../../plugins/devtools/timeline.devtools.js';
|
|
6
7
|
import '@empathyco/x-utils';
|
|
@@ -9,7 +10,6 @@ import 'rxjs';
|
|
|
9
10
|
import '../../plugins/devtools/colors.utils.js';
|
|
10
11
|
import '../../plugins/x-bus.js';
|
|
11
12
|
import '../../plugins/x-plugin.js';
|
|
12
|
-
import 'vuex';
|
|
13
13
|
import '@vueuse/core';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineComponent, ref } from 'vue';
|
|
2
2
|
import '../../composables/create-use-device.js';
|
|
3
3
|
import { use$x } from '../../composables/use-_x.js';
|
|
4
|
+
import 'vuex';
|
|
4
5
|
import '@vue/devtools-api';
|
|
5
6
|
import '../../plugins/devtools/timeline.devtools.js';
|
|
6
7
|
import '@empathyco/x-utils';
|
|
@@ -9,7 +10,6 @@ import 'rxjs';
|
|
|
9
10
|
import '../../plugins/devtools/colors.utils.js';
|
|
10
11
|
import '../../plugins/x-bus.js';
|
|
11
12
|
import '../../plugins/x-plugin.js';
|
|
12
|
-
import 'vuex';
|
|
13
13
|
import '@vueuse/core';
|
|
14
14
|
import BaseRating from '../base-rating.vue.js';
|
|
15
15
|
|
|
@@ -2,6 +2,7 @@ import { forEach } from '@empathyco/x-utils';
|
|
|
2
2
|
import { defineComponent, ref, computed } from 'vue';
|
|
3
3
|
import '../../composables/create-use-device.js';
|
|
4
4
|
import { use$x } from '../../composables/use-_x.js';
|
|
5
|
+
import 'vuex';
|
|
5
6
|
import '@vue/devtools-api';
|
|
6
7
|
import '../../plugins/devtools/timeline.devtools.js';
|
|
7
8
|
import 'rxjs/operators';
|
|
@@ -9,7 +10,6 @@ import 'rxjs';
|
|
|
9
10
|
import '../../plugins/devtools/colors.utils.js';
|
|
10
11
|
import '../../plugins/x-bus.js';
|
|
11
12
|
import '../../plugins/x-plugin.js';
|
|
12
|
-
import 'vuex';
|
|
13
13
|
import '@vueuse/core';
|
|
14
14
|
import Highlight from '../highlight.vue.js';
|
|
15
15
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useStore } from 'vuex';
|
|
1
2
|
import '@vue/devtools-api';
|
|
2
3
|
import '../plugins/devtools/timeline.devtools.js';
|
|
3
4
|
import '@empathyco/x-utils';
|
|
@@ -7,7 +8,6 @@ import '../plugins/devtools/colors.utils.js';
|
|
|
7
8
|
import '../plugins/x-bus.js';
|
|
8
9
|
import '../plugins/x-plugin.js';
|
|
9
10
|
import { getGetterPath } from '../plugins/x-plugin.utils.js';
|
|
10
|
-
import { useStore } from 'vuex';
|
|
11
11
|
|
|
12
12
|
/* eslint-disable ts/no-unsafe-return,ts/no-unsafe-member-access,ts/no-unsafe-assignment */
|
|
13
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-alias-api.js","sources":["../../../src/composables/use-alias-api.ts"],"sourcesContent":["import type {\n Facet,\n Filter,\n HistoryQuery,\n NextQuery,\n PartialResult,\n Redirection,\n RelatedTag,\n Result,\n SemanticQuery,\n Suggestion,\n} from '@empathyco/x-types'\nimport type { RequestStatus } from '../store/utils/status-store.utils'\nimport type { ScrollComponentState } from '../x-modules/scroll/store/types'\nimport type { InputStatus } from '../x-modules/search-box/store/types'\nimport { getGetterPath } from '../plugins/index'\nimport { useStore } from './use-store'\n\n/* eslint-disable ts/no-unsafe-return,ts/no-unsafe-member-access,ts/no-unsafe-assignment */\n\n/**\n * Creates an object containing the alias part of {@link XComponentAPI}.\n *\n * @returns An object containing the alias part of the {@link XComponentAPI}.\n *\n * @internal\n */\nexport function useAliasApi(): UseAliasAPI {\n const queryModules = [\n 'facets',\n 'searchBox',\n 'nextQueries',\n 'querySuggestions',\n 'relatedTags',\n 'search',\n ] as const\n const statusModules = [\n 'identifierResults',\n 'nextQueries',\n 'popularSearches',\n 'querySuggestions',\n 'recommendations',\n 'relatedTags',\n 'search',\n ] as const\n\n const store = useStore()\n\n const query = queryModules.reduce((acc, moduleName) => {\n return Object.defineProperty(acc, moduleName, {\n get(): string {\n return store.state.x[moduleName]?.query ?? ''\n },\n enumerable: true,\n })\n }, {} as UseAliasQueryAPI)\n\n const status = statusModules.reduce((acc, moduleName) => {\n return Object.defineProperty(acc, moduleName, {\n get(): RequestStatus | undefined {\n return store.state.x[moduleName]?.status\n },\n enumerable: true,\n })\n }, {} as UseAliasStatusAPI)\n\n return {\n query,\n status,\n get device() {\n return store.state.x.device?.name ?? null\n },\n get facets() {\n return store.getters[getGetterPath('facets', 'facets')] ?? {}\n },\n get historyQueries() {\n return store.getters[getGetterPath('historyQueries', 'historyQueries')] ?? []\n },\n get historyQueriesWithResults() {\n return store.getters[getGetterPath('historyQueries', 'historyQueriesWithResults')] ?? []\n },\n get fullHistoryQueries() {\n return store.state.x.historyQueries?.historyQueries ?? []\n },\n get isHistoryQueriesEnabled() {\n return store.state.x.historyQueries?.isEnabled ?? false\n },\n get fromNoResultsWithFilters() {\n return store.state.x.search?.fromNoResultsWithFilters ?? false\n },\n get identifierResults() {\n return store.state.x.identifierResults?.identifierResults ?? []\n },\n get searchBoxStatus() {\n return store.state.x.searchBox?.inputStatus ?? undefined\n },\n get isEmpathizeOpen() {\n return store.state.x.empathize?.isOpen ?? false\n },\n get nextQueries() {\n return store.getters[getGetterPath('nextQueries', 'nextQueries')] ?? []\n },\n get noResults() {\n return store.state.x.search?.isNoResults ?? false\n },\n get partialResults() {\n return store.state.x.search?.partialResults ?? []\n },\n get popularSearches() {\n return store.state.x.popularSearches?.popularSearches ?? []\n },\n get querySuggestions() {\n return store.getters[getGetterPath('querySuggestions', 'querySuggestions')] ?? []\n },\n get fullQuerySuggestions() {\n return store.state.x.querySuggestions?.suggestions ?? []\n },\n get recommendations() {\n return store.state.x.recommendations?.recommendations ?? []\n },\n get redirections() {\n return store.state.x.search?.redirections ?? []\n },\n get relatedTags() {\n return store.getters[getGetterPath('relatedTags', 'relatedTags')] ?? []\n },\n get results() {\n return store.state.x.search?.results ?? []\n },\n get scroll() {\n return store.state.x.scroll?.data ?? {}\n },\n get selectedFilters() {\n return store.getters[getGetterPath('facets', 'selectedFilters')] ?? []\n },\n get selectedRelatedTags() {\n return store.state.x.relatedTags?.selectedRelatedTags ?? []\n },\n get semanticQueries() {\n return store.state.x.semanticQueries?.semanticQueries ?? []\n },\n get spellcheckedQuery() {\n return store.state.x.search?.spellcheckedQuery ?? null\n },\n get totalResults() {\n return store.state.x.search?.totalResults ?? 0\n },\n get selectedSort() {\n return store.state.x.search?.sort ?? ''\n },\n get priceStats() {\n return store.state.x.search?.stats?.price ?? {}\n },\n }\n}\n\n/**\n * Alias to facilitate retrieving values from the store.\n *\n * @public\n */\nexport interface UseAliasAPI {\n /** The {@link DeviceXModule} detected device. */\n readonly device: string | null\n /** The {@link FacetsXModule} facets. */\n readonly facets: Record<Facet['id'], Facet>\n /** The {@link HistoryQueriesXModule} history queries matching the query. */\n readonly historyQueries: ReadonlyArray<HistoryQuery>\n /** The {@link HistoryQueriesXModule} history queries with 1 or more results. */\n readonly historyQueriesWithResults: ReadonlyArray<HistoryQuery>\n /** The {@link HistoryQueriesXModule} history queries. */\n readonly fullHistoryQueries: ReadonlyArray<HistoryQuery>\n /** The {@link HistoryQueriesXModule} history queries enabled flag. */\n readonly isHistoryQueriesEnabled: Readonly<boolean>\n /** The {@link SearchXModule} no results with filters flag. */\n readonly fromNoResultsWithFilters: Readonly<boolean>\n /** The {@link IdentifierResultsXModule} results. */\n readonly identifierResults: ReadonlyArray<Result>\n /** The {@link SearchBoxXModule } input status. */\n readonly searchBoxStatus: InputStatus | undefined\n /** The {@link Empathize} is open state. */\n readonly isEmpathizeOpen: boolean\n /** The {@link NextQueriesXModule} next queries. */\n readonly nextQueries: ReadonlyArray<NextQuery>\n /** The {@link SearchXModule} no results situation. */\n readonly noResults: boolean\n /** The {@link SearchXModule} partial results. */\n readonly partialResults: ReadonlyArray<PartialResult>\n /** The {@link PopularSearchesXModule} popular searches. */\n readonly popularSearches: ReadonlyArray<Suggestion>\n /** The query value of the different modules. */\n readonly query: UseAliasQueryAPI\n /** The {@link QuerySuggestionsXModule} query suggestions that should be displayed. */\n readonly querySuggestions: ReadonlyArray<Suggestion>\n /** The {@link QuerySuggestionsXModule} query suggestions. */\n readonly fullQuerySuggestions: ReadonlyArray<Suggestion>\n /** The {@link RecommendationsXModule} recommendations. */\n readonly recommendations: ReadonlyArray<Result>\n /** The {@link SearchXModule} redirections. */\n readonly redirections: ReadonlyArray<Redirection>\n /** The {@link RelatedTagsXModule} related tags (Both selected and deselected). */\n readonly relatedTags: ReadonlyArray<RelatedTag>\n /** The {@link SearchXModule} search results. */\n readonly results: ReadonlyArray<Result>\n /** The {@link ScrollXModule} data state. */\n readonly scroll: Record<string, ScrollComponentState>\n /** The {@link FacetsXModule} selected filters. */\n readonly selectedFilters: Filter[]\n /** The {@link RelatedTagsXModule} selected related tags. */\n readonly selectedRelatedTags: ReadonlyArray<RelatedTag>\n /** The {@link SemanticQueriesXModule} queries. */\n readonly semanticQueries: ReadonlyArray<SemanticQuery>\n /** The {@link SearchXModule} spellchecked query. */\n readonly spellcheckedQuery: string | null\n /** The status value of the different modules. */\n readonly status: UseAliasStatusAPI\n /** The {@link SearchXModule} total results. */\n readonly totalResults: number\n /** The {@link SearchXModule} selected sort. */\n readonly selectedSort: string\n /** The {@link SearchXModule} price specific stats. */\n readonly priceStats: { min: number; max: number }\n}\n\n/**\n * Alias to facilitate retrieving the modules with query.\n *\n * @public\n */\nexport interface UseAliasQueryAPI {\n /** The {@link FacetsXModule} query. */\n readonly facets: string\n /** The {@link SearchBoxXModule} query. */\n readonly searchBox: string\n /** The {@link NextQueriesXModule} query. */\n readonly nextQueries: string\n /** The {@link QuerySuggestionsXModule} query. */\n readonly querySuggestions: string\n /** The {@link RelatedTagsXModule} query. */\n readonly relatedTags: string\n /** The {@link SearchXModule} query. */\n readonly search: string\n}\n\n/**\n * Alias to facilitate retrieving the modules with status.\n *\n * @public\n */\nexport interface UseAliasStatusAPI {\n /** The {@link IdentifierResultsXModule} status. */\n readonly identifierResults: RequestStatus | undefined\n /** The {@link NextQueriesXModule} status. */\n readonly nextQueries: RequestStatus | undefined\n /** The {@link PopularSearchesXModule} status. */\n readonly popularSearches: RequestStatus | undefined\n /** The {@link QuerySuggestionsXModule} status. */\n readonly querySuggestions: RequestStatus | undefined\n /** The {@link RecommendationsXModule} status. */\n readonly recommendations: RequestStatus | undefined\n /** The {@link RelatedTagsXModule} status. */\n readonly relatedTags: RequestStatus | undefined\n /** The {@link SearchXModule} status. */\n readonly search: RequestStatus | undefined\n}\n\n/* eslint-enable ts/no-unsafe-return,ts/no-unsafe-member-access,ts/no-unsafe-assignment */\n"],"names":[],"mappings":";;;;;;;;;;;AAkBA;AAEA;;;;;;AAMG;SACa,WAAW,GAAA;AACzB,IAAA,MAAM,YAAY,GAAG;QACnB,QAAQ;QACR,WAAW;QACX,aAAa;QACb,kBAAkB;QAClB,aAAa;QACb,QAAQ;KACA,CAAA;AACV,IAAA,MAAM,aAAa,GAAG;QACpB,mBAAmB;QACnB,aAAa;QACb,iBAAiB;QACjB,kBAAkB;QAClB,iBAAiB;QACjB,aAAa;QACb,QAAQ;KACA,CAAA;AAEV,IAAA,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IAExB,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,UAAU,KAAI;AACpD,QAAA,OAAO,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,UAAU,EAAE;YAC5C,GAAG,GAAA;AACD,gBAAA,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,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AA;YACd,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,YAAY,IAAI,CAAC,CAAA;SAC/C;AACD,QAAA,IAAI,YAAY,GAAA;YACd,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,IAAI,EAAE,CAAA;SACxC;AACD,QAAA,IAAI,UAAU,GAAA;AACZ,YAAA,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,IAAI,EAAE,CAAA;SAChD;KACF,CAAA;AACH,CAAC;AAgHD;;;;"}
|
|
1
|
+
{"version":3,"file":"use-alias-api.js","sources":["../../../src/composables/use-alias-api.ts"],"sourcesContent":["import type {\n Facet,\n Filter,\n HistoryQuery,\n NextQuery,\n PartialResult,\n Redirection,\n RelatedTag,\n Result,\n SemanticQuery,\n Suggestion,\n} from '@empathyco/x-types'\nimport type { RequestStatus } from '../store/utils/status-store.utils'\nimport type { ScrollComponentState } from '../x-modules/scroll/store/types'\nimport type { InputStatus } from '../x-modules/search-box/store/types'\nimport { useStore } from 'vuex'\nimport { getGetterPath } from '../plugins/index'\n\n/* eslint-disable ts/no-unsafe-return,ts/no-unsafe-member-access,ts/no-unsafe-assignment */\n\n/**\n * Creates an object containing the alias part of {@link XComponentAPI}.\n *\n * @returns An object containing the alias part of the {@link XComponentAPI}.\n *\n * @internal\n */\nexport function useAliasApi(): UseAliasAPI {\n const queryModules = [\n 'facets',\n 'searchBox',\n 'nextQueries',\n 'querySuggestions',\n 'relatedTags',\n 'search',\n ] as const\n const statusModules = [\n 'identifierResults',\n 'nextQueries',\n 'popularSearches',\n 'querySuggestions',\n 'recommendations',\n 'relatedTags',\n 'search',\n ] as const\n\n const store = useStore()\n\n const query = queryModules.reduce((acc, moduleName) => {\n return Object.defineProperty(acc, moduleName, {\n get(): string {\n return store.state.x[moduleName]?.query ?? ''\n },\n enumerable: true,\n })\n }, {} as UseAliasQueryAPI)\n\n const status = statusModules.reduce((acc, moduleName) => {\n return Object.defineProperty(acc, moduleName, {\n get(): RequestStatus | undefined {\n return store.state.x[moduleName]?.status\n },\n enumerable: true,\n })\n }, {} as UseAliasStatusAPI)\n\n return {\n query,\n status,\n get device() {\n return store.state.x.device?.name ?? null\n },\n get facets() {\n return store.getters[getGetterPath('facets', 'facets')] ?? {}\n },\n get historyQueries() {\n return store.getters[getGetterPath('historyQueries', 'historyQueries')] ?? []\n },\n get historyQueriesWithResults() {\n return store.getters[getGetterPath('historyQueries', 'historyQueriesWithResults')] ?? []\n },\n get fullHistoryQueries() {\n return store.state.x.historyQueries?.historyQueries ?? []\n },\n get isHistoryQueriesEnabled() {\n return store.state.x.historyQueries?.isEnabled ?? false\n },\n get fromNoResultsWithFilters() {\n return store.state.x.search?.fromNoResultsWithFilters ?? false\n },\n get identifierResults() {\n return store.state.x.identifierResults?.identifierResults ?? []\n },\n get searchBoxStatus() {\n return store.state.x.searchBox?.inputStatus ?? undefined\n },\n get isEmpathizeOpen() {\n return store.state.x.empathize?.isOpen ?? false\n },\n get nextQueries() {\n return store.getters[getGetterPath('nextQueries', 'nextQueries')] ?? []\n },\n get noResults() {\n return store.state.x.search?.isNoResults ?? false\n },\n get partialResults() {\n return store.state.x.search?.partialResults ?? []\n },\n get popularSearches() {\n return store.state.x.popularSearches?.popularSearches ?? []\n },\n get querySuggestions() {\n return store.getters[getGetterPath('querySuggestions', 'querySuggestions')] ?? []\n },\n get fullQuerySuggestions() {\n return store.state.x.querySuggestions?.suggestions ?? []\n },\n get recommendations() {\n return store.state.x.recommendations?.recommendations ?? []\n },\n get redirections() {\n return store.state.x.search?.redirections ?? []\n },\n get relatedTags() {\n return store.getters[getGetterPath('relatedTags', 'relatedTags')] ?? []\n },\n get results() {\n return store.state.x.search?.results ?? []\n },\n get scroll() {\n return store.state.x.scroll?.data ?? {}\n },\n get selectedFilters() {\n return store.getters[getGetterPath('facets', 'selectedFilters')] ?? []\n },\n get selectedRelatedTags() {\n return store.state.x.relatedTags?.selectedRelatedTags ?? []\n },\n get semanticQueries() {\n return store.state.x.semanticQueries?.semanticQueries ?? []\n },\n get spellcheckedQuery() {\n return store.state.x.search?.spellcheckedQuery ?? null\n },\n get totalResults() {\n return store.state.x.search?.totalResults ?? 0\n },\n get selectedSort() {\n return store.state.x.search?.sort ?? ''\n },\n get priceStats() {\n return store.state.x.search?.stats?.price ?? {}\n },\n }\n}\n\n/**\n * Alias to facilitate retrieving values from the store.\n *\n * @public\n */\nexport interface UseAliasAPI {\n /** The {@link DeviceXModule} detected device. */\n readonly device: string | null\n /** The {@link FacetsXModule} facets. */\n readonly facets: Record<Facet['id'], Facet>\n /** The {@link HistoryQueriesXModule} history queries matching the query. */\n readonly historyQueries: ReadonlyArray<HistoryQuery>\n /** The {@link HistoryQueriesXModule} history queries with 1 or more results. */\n readonly historyQueriesWithResults: ReadonlyArray<HistoryQuery>\n /** The {@link HistoryQueriesXModule} history queries. */\n readonly fullHistoryQueries: ReadonlyArray<HistoryQuery>\n /** The {@link HistoryQueriesXModule} history queries enabled flag. */\n readonly isHistoryQueriesEnabled: Readonly<boolean>\n /** The {@link SearchXModule} no results with filters flag. */\n readonly fromNoResultsWithFilters: Readonly<boolean>\n /** The {@link IdentifierResultsXModule} results. */\n readonly identifierResults: ReadonlyArray<Result>\n /** The {@link SearchBoxXModule } input status. */\n readonly searchBoxStatus: InputStatus | undefined\n /** The {@link Empathize} is open state. */\n readonly isEmpathizeOpen: boolean\n /** The {@link NextQueriesXModule} next queries. */\n readonly nextQueries: ReadonlyArray<NextQuery>\n /** The {@link SearchXModule} no results situation. */\n readonly noResults: boolean\n /** The {@link SearchXModule} partial results. */\n readonly partialResults: ReadonlyArray<PartialResult>\n /** The {@link PopularSearchesXModule} popular searches. */\n readonly popularSearches: ReadonlyArray<Suggestion>\n /** The query value of the different modules. */\n readonly query: UseAliasQueryAPI\n /** The {@link QuerySuggestionsXModule} query suggestions that should be displayed. */\n readonly querySuggestions: ReadonlyArray<Suggestion>\n /** The {@link QuerySuggestionsXModule} query suggestions. */\n readonly fullQuerySuggestions: ReadonlyArray<Suggestion>\n /** The {@link RecommendationsXModule} recommendations. */\n readonly recommendations: ReadonlyArray<Result>\n /** The {@link SearchXModule} redirections. */\n readonly redirections: ReadonlyArray<Redirection>\n /** The {@link RelatedTagsXModule} related tags (Both selected and deselected). */\n readonly relatedTags: ReadonlyArray<RelatedTag>\n /** The {@link SearchXModule} search results. */\n readonly results: ReadonlyArray<Result>\n /** The {@link ScrollXModule} data state. */\n readonly scroll: Record<string, ScrollComponentState>\n /** The {@link FacetsXModule} selected filters. */\n readonly selectedFilters: Filter[]\n /** The {@link RelatedTagsXModule} selected related tags. */\n readonly selectedRelatedTags: ReadonlyArray<RelatedTag>\n /** The {@link SemanticQueriesXModule} queries. */\n readonly semanticQueries: ReadonlyArray<SemanticQuery>\n /** The {@link SearchXModule} spellchecked query. */\n readonly spellcheckedQuery: string | null\n /** The status value of the different modules. */\n readonly status: UseAliasStatusAPI\n /** The {@link SearchXModule} total results. */\n readonly totalResults: number\n /** The {@link SearchXModule} selected sort. */\n readonly selectedSort: string\n /** The {@link SearchXModule} price specific stats. */\n readonly priceStats: { min: number; max: number }\n}\n\n/**\n * Alias to facilitate retrieving the modules with query.\n *\n * @public\n */\nexport interface UseAliasQueryAPI {\n /** The {@link FacetsXModule} query. */\n readonly facets: string\n /** The {@link SearchBoxXModule} query. */\n readonly searchBox: string\n /** The {@link NextQueriesXModule} query. */\n readonly nextQueries: string\n /** The {@link QuerySuggestionsXModule} query. */\n readonly querySuggestions: string\n /** The {@link RelatedTagsXModule} query. */\n readonly relatedTags: string\n /** The {@link SearchXModule} query. */\n readonly search: string\n}\n\n/**\n * Alias to facilitate retrieving the modules with status.\n *\n * @public\n */\nexport interface UseAliasStatusAPI {\n /** The {@link IdentifierResultsXModule} status. */\n readonly identifierResults: RequestStatus | undefined\n /** The {@link NextQueriesXModule} status. */\n readonly nextQueries: RequestStatus | undefined\n /** The {@link PopularSearchesXModule} status. */\n readonly popularSearches: RequestStatus | undefined\n /** The {@link QuerySuggestionsXModule} status. */\n readonly querySuggestions: RequestStatus | undefined\n /** The {@link RecommendationsXModule} status. */\n readonly recommendations: RequestStatus | undefined\n /** The {@link RelatedTagsXModule} status. */\n readonly relatedTags: RequestStatus | undefined\n /** The {@link SearchXModule} status. */\n readonly search: RequestStatus | undefined\n}\n\n/* eslint-enable ts/no-unsafe-return,ts/no-unsafe-member-access,ts/no-unsafe-assignment */\n"],"names":[],"mappings":";;;;;;;;;;;AAkBA;AAEA;;;;;;AAMG;SACa,WAAW,GAAA;AACzB,IAAA,MAAM,YAAY,GAAG;QACnB,QAAQ;QACR,WAAW;QACX,aAAa;QACb,kBAAkB;QAClB,aAAa;QACb,QAAQ;KACA,CAAA;AACV,IAAA,MAAM,aAAa,GAAG;QACpB,mBAAmB;QACnB,aAAa;QACb,iBAAiB;QACjB,kBAAkB;QAClB,iBAAiB;QACjB,aAAa;QACb,QAAQ;KACA,CAAA;AAEV,IAAA,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IAExB,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,UAAU,KAAI;AACpD,QAAA,OAAO,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,UAAU,EAAE;YAC5C,GAAG,GAAA;AACD,gBAAA,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,KAAK,IAAI,EAAE,CAAA;aAC9C;AACD,YAAA,UAAU,EAAE,IAAI;AACjB,SAAA,CAAC,CAAA;KACH,EAAE,EAAsB,CAAC,CAAA;IAE1B,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,UAAU,KAAI;AACtD,QAAA,OAAO,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,UAAU,EAAE;YAC5C,GAAG,GAAA;gBACD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC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ACF,CAAA;AACH,CAAC;AAgHD;;;;"}
|
package/js/index.js
CHANGED
|
@@ -151,7 +151,6 @@ export { useDebounce } from './composables/use-debounce.js';
|
|
|
151
151
|
export { useGetter } from './composables/use-getter.js';
|
|
152
152
|
export { useEmitDisplayEvent, useOnDisplay } from './composables/use-on-display.js';
|
|
153
153
|
export { useState } from './composables/use-state.js';
|
|
154
|
-
export { useStore } from 'vuex';
|
|
155
154
|
export { useXBus } from './composables/use-x-bus.js';
|
|
156
155
|
export { infiniteScroll } from './directives/infinite-scroll.js';
|
|
157
156
|
export { typing } from './directives/typing.js';
|
package/js/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -95,6 +95,7 @@ import '../../../components/suggestions/base-suggestion.vue2.js';
|
|
|
95
95
|
import '../../../components/suggestions/base-suggestions.vue2.js';
|
|
96
96
|
import '../../../components/suggestions/base-suggestions.vue3.js';
|
|
97
97
|
import '../../../composables/create-use-device.js';
|
|
98
|
+
import 'vuex';
|
|
98
99
|
import '@vue/devtools-api';
|
|
99
100
|
import '../../../plugins/devtools/timeline.devtools.js';
|
|
100
101
|
import 'rxjs/operators';
|
|
@@ -102,7 +103,6 @@ import 'rxjs';
|
|
|
102
103
|
import '../../../plugins/devtools/colors.utils.js';
|
|
103
104
|
import '../../../plugins/x-bus.js';
|
|
104
105
|
import '../../../plugins/x-plugin.js';
|
|
105
|
-
import 'vuex';
|
|
106
106
|
import { useDebounce } from '../../../composables/use-debounce.js';
|
|
107
107
|
import '@vueuse/core';
|
|
108
108
|
import { AnimationProp } from '../../../types/animation-prop.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineComponent, ref, computed, watch } from 'vue';
|
|
2
2
|
import '../../../../composables/create-use-device.js';
|
|
3
3
|
import { use$x } from '../../../../composables/use-_x.js';
|
|
4
|
+
import 'vuex';
|
|
4
5
|
import '@vue/devtools-api';
|
|
5
6
|
import '../../../../plugins/devtools/timeline.devtools.js';
|
|
6
7
|
import '@empathyco/x-utils';
|
|
@@ -9,7 +10,6 @@ import 'rxjs';
|
|
|
9
10
|
import '../../../../plugins/devtools/colors.utils.js';
|
|
10
11
|
import '../../../../plugins/x-bus.js';
|
|
11
12
|
import '../../../../plugins/x-plugin.js';
|
|
12
|
-
import 'vuex';
|
|
13
13
|
import '@vueuse/core';
|
|
14
14
|
import { facetsXModule } from '../../x-module.js';
|
|
15
15
|
|
|
@@ -87,6 +87,7 @@ import '../../../components/result/result-variant-selector.vue3.js';
|
|
|
87
87
|
import '../../../components/result/result-variants-provider.vue.js';
|
|
88
88
|
import '../../../components/scroll/base-scroll.vue2.js';
|
|
89
89
|
import '@empathyco/x-utils';
|
|
90
|
+
import 'vuex';
|
|
90
91
|
import '@vue/devtools-api';
|
|
91
92
|
import '../../../plugins/devtools/timeline.devtools.js';
|
|
92
93
|
import 'rxjs/operators';
|
|
@@ -94,7 +95,6 @@ import 'rxjs';
|
|
|
94
95
|
import '../../../plugins/devtools/colors.utils.js';
|
|
95
96
|
import '../../../plugins/x-bus.js';
|
|
96
97
|
import '../../../plugins/x-plugin.js';
|
|
97
|
-
import 'vuex';
|
|
98
98
|
import '../../../components/sliding-panel.vue2.js';
|
|
99
99
|
import '../../../components/sliding-panel.vue3.js';
|
|
100
100
|
import '../../../components/snippet-callbacks.vue2.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, ref, computed, watch } from 'vue';
|
|
2
2
|
import '../../../composables/create-use-device.js';
|
|
3
|
+
import 'vuex';
|
|
3
4
|
import '@vue/devtools-api';
|
|
4
5
|
import '../../../plugins/devtools/timeline.devtools.js';
|
|
5
6
|
import '@empathyco/x-utils';
|
|
@@ -8,7 +9,6 @@ import 'rxjs';
|
|
|
8
9
|
import '../../../plugins/devtools/colors.utils.js';
|
|
9
10
|
import '../../../plugins/x-bus.js';
|
|
10
11
|
import '../../../plugins/x-plugin.js';
|
|
11
|
-
import 'vuex';
|
|
12
12
|
import '@vueuse/core';
|
|
13
13
|
import { useState } from '../../../composables/use-state.js';
|
|
14
14
|
import { AnimationProp } from '../../../types/animation-prop.js';
|
|
@@ -88,6 +88,7 @@ import '../../../components/result/result-variant-selector.vue2.js';
|
|
|
88
88
|
import '../../../components/result/result-variant-selector.vue3.js';
|
|
89
89
|
import '../../../components/result/result-variants-provider.vue.js';
|
|
90
90
|
import '../../../components/scroll/base-scroll.vue2.js';
|
|
91
|
+
import 'vuex';
|
|
91
92
|
import '@vue/devtools-api';
|
|
92
93
|
import '../../../plugins/devtools/timeline.devtools.js';
|
|
93
94
|
import 'rxjs/operators';
|
|
@@ -95,7 +96,6 @@ import 'rxjs';
|
|
|
95
96
|
import '../../../plugins/devtools/colors.utils.js';
|
|
96
97
|
import '../../../plugins/x-bus.js';
|
|
97
98
|
import '../../../plugins/x-plugin.js';
|
|
98
|
-
import 'vuex';
|
|
99
99
|
import { useXBus } from '../../../composables/use-x-bus.js';
|
|
100
100
|
import '../../../components/sliding-panel.vue2.js';
|
|
101
101
|
import '../../../components/sliding-panel.vue3.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineComponent } from 'vue';
|
|
2
2
|
import BaseSuggestion from '../../../components/suggestions/base-suggestion.vue.js';
|
|
3
3
|
import '../../../composables/create-use-device.js';
|
|
4
|
+
import 'vuex';
|
|
4
5
|
import '@vue/devtools-api';
|
|
5
6
|
import '../../../plugins/devtools/timeline.devtools.js';
|
|
6
7
|
import '@empathyco/x-utils';
|
|
@@ -9,7 +10,6 @@ import 'rxjs';
|
|
|
9
10
|
import '../../../plugins/devtools/colors.utils.js';
|
|
10
11
|
import '../../../plugins/x-bus.js';
|
|
11
12
|
import '../../../plugins/x-plugin.js';
|
|
12
|
-
import 'vuex';
|
|
13
13
|
import { useGetter } from '../../../composables/use-getter.js';
|
|
14
14
|
import '@vueuse/core';
|
|
15
15
|
import { querySuggestionsXModule } from '../x-module.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineComponent } from 'vue';
|
|
2
2
|
import BaseSuggestions from '../../../components/suggestions/base-suggestions.vue.js';
|
|
3
3
|
import '../../../composables/create-use-device.js';
|
|
4
|
+
import 'vuex';
|
|
4
5
|
import '@vue/devtools-api';
|
|
5
6
|
import '../../../plugins/devtools/timeline.devtools.js';
|
|
6
7
|
import '@empathyco/x-utils';
|
|
@@ -9,7 +10,6 @@ import 'rxjs';
|
|
|
9
10
|
import '../../../plugins/devtools/colors.utils.js';
|
|
10
11
|
import '../../../plugins/x-bus.js';
|
|
11
12
|
import '../../../plugins/x-plugin.js';
|
|
12
|
-
import 'vuex';
|
|
13
13
|
import { useGetter } from '../../../composables/use-getter.js';
|
|
14
14
|
import '@vueuse/core';
|
|
15
15
|
import { querySuggestionsXModule } from '../x-module.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, provide, computed } from 'vue';
|
|
2
2
|
import '../../../composables/create-use-device.js';
|
|
3
|
+
import 'vuex';
|
|
3
4
|
import '@vue/devtools-api';
|
|
4
5
|
import '../../../plugins/devtools/timeline.devtools.js';
|
|
5
6
|
import '@empathyco/x-utils';
|
|
@@ -8,7 +9,6 @@ import 'rxjs';
|
|
|
8
9
|
import '../../../plugins/devtools/colors.utils.js';
|
|
9
10
|
import '../../../plugins/x-bus.js';
|
|
10
11
|
import '../../../plugins/x-plugin.js';
|
|
11
|
-
import 'vuex';
|
|
12
12
|
import '@vueuse/core';
|
|
13
13
|
import { useState } from '../../../composables/use-state.js';
|
|
14
14
|
import { AnimationProp } from '../../../types/animation-prop.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"related-prompt.vue.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompt.vue"],"sourcesContent":["<template>\n <button class=\"x-related-prompt\">\n <slot name=\"related-prompt-extra-content\" :related-prompt=\"relatedPrompt\" />\n <span\n v-typing=\"{ text: relatedPrompt.suggestionText, speed: 50 }\"\n class=\"x-related-prompt-text\"\n :class=\"{ 'x-related-prompt-text--selected': selected }\"\n />\n <component :is=\"selected ? 'CrossTinyIcon' : 'PlusIcon'\" class=\"x-related-prompt-icon\" />\n </button>\n</template>\n\n<script lang=\"ts\">\nimport type { RelatedPrompt } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport CrossTinyIcon from '../../../components/icons/cross-tiny.vue'\nimport PlusIcon from '../../../components/icons/plus.vue'\nimport { typing } from '../../../directives/typing'\n\n/**\n * This component shows a suggested related prompt.\n */\nexport default defineComponent({\n name: 'RelatedPrompt',\n directives: {\n typing,\n },\n components: {\n CrossTinyIcon,\n PlusIcon,\n },\n props: {\n relatedPrompt: {\n type: Object as PropType<RelatedPrompt>,\n required: true,\n },\n selected: {\n type: Boolean,\n default: false,\n },\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-related-prompt {\n display: flex;\n align-items: center;\n justify-content: space-between;\n text-align: start;\n padding: 8px;\n gap: 8px;\n height: 100%;\n width: 100%;\n}\n\n.x-related-prompt-text {\n text-align: left;\n flex-grow: 1;\n}\n\n.x-related-prompt-text.x-related-prompt-text--selected {\n text-align: center;\n}\n\n.x-related-prompt-icon {\n height: 24px;\n flex-shrink: 0;\n align-self: start;\n}\n</style>\n"],"names":["_resolveDirective","_createElementBlock","_renderSlot","selected"],"mappings":";;;;;;;AACE,EAAA,MAAA,iBAAA,GAAAA,gBAAA,
|
|
1
|
+
{"version":3,"file":"related-prompt.vue.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompt.vue"],"sourcesContent":["<template>\n <button class=\"x-related-prompt\">\n <!--\n @slot related-prompt-extra-content - The slot to render related prompt extra information.\n @prop {Object} relatedPrompt - The related prompt object.\n -->\n <slot name=\"related-prompt-extra-content\" :related-prompt=\"relatedPrompt\" />\n <span\n v-typing=\"{ text: relatedPrompt.suggestionText, speed: 50 }\"\n class=\"x-related-prompt-text\"\n :class=\"{ 'x-related-prompt-text--selected': selected }\"\n />\n <component :is=\"selected ? 'CrossTinyIcon' : 'PlusIcon'\" class=\"x-related-prompt-icon\" />\n </button>\n</template>\n\n<script lang=\"ts\">\nimport type { RelatedPrompt } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport CrossTinyIcon from '../../../components/icons/cross-tiny.vue'\nimport PlusIcon from '../../../components/icons/plus.vue'\nimport { typing } from '../../../directives/typing'\n\n/**\n * This component shows a suggested related prompt.\n */\nexport default defineComponent({\n name: 'RelatedPrompt',\n directives: {\n typing,\n },\n components: {\n CrossTinyIcon,\n PlusIcon,\n },\n props: {\n /**\n * The related prompt to render.\n *\n * @public\n */\n relatedPrompt: {\n type: Object as PropType<RelatedPrompt>,\n required: true,\n },\n /**\n * Indicates if the related prompt is selected.\n *\n * @public\n */\n selected: {\n type: Boolean,\n default: false,\n },\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-related-prompt {\n display: flex;\n align-items: center;\n justify-content: space-between;\n text-align: start;\n padding: 8px;\n gap: 8px;\n height: 100%;\n width: 100%;\n}\n\n.x-related-prompt-text {\n text-align: left;\n flex-grow: 1;\n}\n\n.x-related-prompt-text.x-related-prompt-text--selected {\n text-align: center;\n}\n\n.x-related-prompt-icon {\n height: 24px;\n flex-shrink: 0;\n align-self: start;\n}\n</style>\n"],"names":["_resolveDirective","_createElementBlock","_renderSlot","selected"],"mappings":";;;;;;;AACE,EAAA,MAAA,iBAAA,GAAAA,gBAAA,CAYS,QAZT,CAAA,CAAA;oBAUI,EAAAC,kBAAA,CAAA,QAAA,EAAA,UAAA,EAAA;AAAA,IAAAC,UAAA,CAXN,6CASmC,EACgBC,aAAAA,EAAAA,IAAAA,CAAAA,aAAAA,EAAAA,CAAAA;AAAAA,IAAAA,cAAAA,CAAAA,kBAAAA;;;wDAFb,EAAc,iCAAA,EAAA,IAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAA,OAAA;;;;;AAIhD,MAAA,CAAA,iBAAA,EAAA,EAAA,IAAA,EAZJ,mCAYoBA,KAAQ,EAAA,EAAA,EAAA,CAAA;AAAA,KAAA,CAAA;;;;;;;;"}
|
|
@@ -16,10 +16,20 @@ var _sfc_main = defineComponent({
|
|
|
16
16
|
PlusIcon,
|
|
17
17
|
},
|
|
18
18
|
props: {
|
|
19
|
+
/**
|
|
20
|
+
* The related prompt to render.
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
19
24
|
relatedPrompt: {
|
|
20
25
|
type: Object,
|
|
21
26
|
required: true,
|
|
22
27
|
},
|
|
28
|
+
/**
|
|
29
|
+
* Indicates if the related prompt is selected.
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
23
33
|
selected: {
|
|
24
34
|
type: Boolean,
|
|
25
35
|
default: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"related-prompt.vue2.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompt.vue"],"sourcesContent":["<template>\n <button class=\"x-related-prompt\">\n <slot name=\"related-prompt-extra-content\" :related-prompt=\"relatedPrompt\" />\n <span\n v-typing=\"{ text: relatedPrompt.suggestionText, speed: 50 }\"\n class=\"x-related-prompt-text\"\n :class=\"{ 'x-related-prompt-text--selected': selected }\"\n />\n <component :is=\"selected ? 'CrossTinyIcon' : 'PlusIcon'\" class=\"x-related-prompt-icon\" />\n </button>\n</template>\n\n<script lang=\"ts\">\nimport type { RelatedPrompt } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport CrossTinyIcon from '../../../components/icons/cross-tiny.vue'\nimport PlusIcon from '../../../components/icons/plus.vue'\nimport { typing } from '../../../directives/typing'\n\n/**\n * This component shows a suggested related prompt.\n */\nexport default defineComponent({\n name: 'RelatedPrompt',\n directives: {\n typing,\n },\n components: {\n CrossTinyIcon,\n PlusIcon,\n },\n props: {\n relatedPrompt: {\n type: Object as PropType<RelatedPrompt>,\n required: true,\n },\n selected: {\n type: Boolean,\n default: false,\n },\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-related-prompt {\n display: flex;\n align-items: center;\n justify-content: space-between;\n text-align: start;\n padding: 8px;\n gap: 8px;\n height: 100%;\n width: 100%;\n}\n\n.x-related-prompt-text {\n text-align: left;\n flex-grow: 1;\n}\n\n.x-related-prompt-text.x-related-prompt-text--selected {\n text-align: center;\n}\n\n.x-related-prompt-icon {\n height: 24px;\n flex-shrink: 0;\n align-self: start;\n}\n</style>\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"related-prompt.vue2.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompt.vue"],"sourcesContent":["<template>\n <button class=\"x-related-prompt\">\n <!--\n @slot related-prompt-extra-content - The slot to render related prompt extra information.\n @prop {Object} relatedPrompt - The related prompt object.\n -->\n <slot name=\"related-prompt-extra-content\" :related-prompt=\"relatedPrompt\" />\n <span\n v-typing=\"{ text: relatedPrompt.suggestionText, speed: 50 }\"\n class=\"x-related-prompt-text\"\n :class=\"{ 'x-related-prompt-text--selected': selected }\"\n />\n <component :is=\"selected ? 'CrossTinyIcon' : 'PlusIcon'\" class=\"x-related-prompt-icon\" />\n </button>\n</template>\n\n<script lang=\"ts\">\nimport type { RelatedPrompt } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport CrossTinyIcon from '../../../components/icons/cross-tiny.vue'\nimport PlusIcon from '../../../components/icons/plus.vue'\nimport { typing } from '../../../directives/typing'\n\n/**\n * This component shows a suggested related prompt.\n */\nexport default defineComponent({\n name: 'RelatedPrompt',\n directives: {\n typing,\n },\n components: {\n CrossTinyIcon,\n PlusIcon,\n },\n props: {\n /**\n * The related prompt to render.\n *\n * @public\n */\n relatedPrompt: {\n type: Object as PropType<RelatedPrompt>,\n required: true,\n },\n /**\n * Indicates if the related prompt is selected.\n *\n * @public\n */\n selected: {\n type: Boolean,\n default: false,\n },\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-related-prompt {\n display: flex;\n align-items: center;\n justify-content: space-between;\n text-align: start;\n padding: 8px;\n gap: 8px;\n height: 100%;\n width: 100%;\n}\n\n.x-related-prompt-text {\n text-align: left;\n flex-grow: 1;\n}\n\n.x-related-prompt-text.x-related-prompt-text--selected {\n text-align: center;\n}\n\n.x-related-prompt-icon {\n height: 24px;\n flex-shrink: 0;\n align-self: start;\n}\n</style>\n"],"names":[],"mappings":";;;;;AAwBA;;AAEE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,eAAe;AACrB,IAAA,UAAU,EAAE;QACV,MAAM;AACP,KAAA;AACD,IAAA,UAAU,EAAE;QACV,aAAa;QACb,QAAQ;AACT,KAAA;AACD,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,aAAa,EAAE;AACb,YAAA,IAAI,EAAE,MAAiC;AACvC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,KAAK;AACf,SAAA;AACF,KAAA;AACF,CAAA,CAAA;;;;"}
|
|
@@ -1 +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\">\nimport type { Ref } from 'vue'\nimport type { ListItem } from '../../../utils/types'\nimport type { RelatedPromptsGroup } from '../types'\nimport { computed, defineComponent, h, inject, provide } from 'vue'\nimport {\n HAS_MORE_ITEMS_KEY,\n LIST_ITEMS_KEY,\n QUERY_KEY,\n} from '../../../components/decorators/injection.consts'\nimport ItemsList from '../../../components/items-list.vue'\nimport { useState } from '../../../composables/use-state'\nimport { AnimationProp } from '../../../types/animation-prop'\nimport { groupItemsBy } from '../../../utils/array'\nimport { relatedPromptsXModule } from '../x-module'\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 */\nexport 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 /**\n * The state related prompts.\n */\n const { query, status, relatedPrompts } = useState('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>\nimport { RelatedPromptsList } from '@empathyco/x-components/related-prompts'\nimport { ResultsList } from '@empathyco/x-components/search'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n\nexport 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>\nimport { RelatedPromptsList } from '@empathyco/x-components/related-prompts'\nimport { ResultsList } from '@empathyco/x-components/search'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n\nexport 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>\nimport { RelatedPromptsList } from '@empathyco/x-components/related-prompts'\nimport { ResultsList } from '@empathyco/x-components/search'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n\nexport 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>\nimport { RelatedPromptsList } from '@empathyco/x-components/related-prompts'\nimport { ResultsList } from '@empathyco/x-components/search'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { BaseGrid } from '@empathyco/x-components'\n\nexport default {\n name: 'RelatedPromptsListDemo',\n components: {\n RelatedPromptsLis,\n ResultsList,\n BaseGrid,\n SearchInput,\n },\n}\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;AAgBA;;;;;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,IAAI;AACd,SAAA;AACD;;AAEE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,EAAE;AACZ,SAAA;AACD;;AAEE;AACF,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,EAAE;AACZ,SAAA;AACD;;AAEE;AACF,QAAA,yBAAyB,EAAE;AACzB,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,CAAC;AACX,SAAA;AACD;;AAEE;AACF,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AACD;;;AAGE;AACF,QAAA,mBAAmB,EAAE;AACnB,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,KAAK;AACf,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAI,EAAG,EAAA;AACpB;;AAEE;AACF,QAAA,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,cAAa,EAAI,GAAE,QAAQ,CAAC,gBAAg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list.vue.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompts-list.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Ref } from 'vue'\nimport type { ListItem } from '../../../utils/types'\nimport type { RelatedPromptsGroup } from '../types'\nimport { computed, defineComponent, h, inject, provide } from 'vue'\nimport {\n HAS_MORE_ITEMS_KEY,\n LIST_ITEMS_KEY,\n QUERY_KEY,\n} from '../../../components/decorators/injection.consts'\nimport ItemsList from '../../../components/items-list.vue'\nimport { useState } from '../../../composables/use-state'\nimport { AnimationProp } from '../../../types/animation-prop'\nimport { groupItemsBy } from '../../../utils/array'\nimport { relatedPromptsXModule } from '../x-module'\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 */\nexport 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 /**\n * The state related prompts.\n */\n const { query, status, relatedPrompts } = useState('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\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>\nimport { RelatedPromptsList } from '@empathyco/x-components/related-prompts'\nimport { ResultsList } from '@empathyco/x-components/search'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n\nexport default {\n name: 'RelatedPromptsListDemo',\n components: {\n RelatedPromptsList,\n ResultsList,\n SearchInput,\n },\n}\n</script>\n```\n\n### Play with the position in the index\n\nPlay with the `offset` and `frequency` props, indicating the indices for inserting groups of related prompts.\nThe following example shows that only three groups of related prompts can be added, as the `maxGroups` prop\nis set to `3`. The first group of related prompts is inserted at index `48` using the `offset` prop. Since the\n`frequency` prop is set to `72`, the second and third groups are inserted at indices `120` and `192`, respectively.\nEach group can contain up to `6` related prompts (`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>\nimport { RelatedPromptsList } from '@empathyco/x-components/related-prompts'\nimport { ResultsList } from '@empathyco/x-components/search'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n\nexport default {\n name: 'RelatedPromptsListDemo',\n components: {\n RelatedPromptsList,\n ResultsList,\n SearchInput,\n },\n}\n</script>\n```\n\n### Showing/hiding the first related prompts\n\nBy default, the first group of related prompts is inserted when the total number of results is\nsmaller than the offset. You can deactivate this behavior by setting the `showOnlyAfterOffset` prop to `true`.\n\nIn the following example, related prompts will be displayed regardless of the number of results being over `48`.\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>\nimport { RelatedPromptsList } from '@empathyco/x-components/related-prompts'\nimport { ResultsList } from '@empathyco/x-components/search'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n\nexport default {\n name: 'RelatedPromptsListDemo',\n components: {\n RelatedPromptsList,\n ResultsList,\n SearchInput,\n },\n}\n</script>\n```\n\n### Customize the component layout\n\nBy default, this component shows the `id` of each search item, both the injected and the groups of\nrelated prompts generated. However, it's common to customize it using a layout component such as\nthe `BaseGrid` component. To do so, you can use the `default` slot as follows:\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>\nimport { RelatedPromptsList } from '@empathyco/x-components/related-prompts'\nimport { ResultsList } from '@empathyco/x-components/search'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { BaseGrid } from '@empathyco/x-components'\n\nexport default {\n name: 'RelatedPromptsListDemo',\n components: {\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AA;AAC/B,aAAA;YACA,IAAI,qBAAqB,CAAC,KAAK,EAAE;AAC/B,gBAAA,OAAO,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAA,IAAK,EAAE,CAAA,CAAA;AAC3E,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,YAAY,KAAI,CAAA;AACzD,gBAAA,IAAI,WAAU,IAAK,KAAK,CAAC,MAAM,EAAE;oBAC/B,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,mBAAmB,CAAA,CAAA;AAClD,iBAAA;AACA,gBAAA,OAAO,KAAI,CAAA;aACZ,EACD,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAC9B,CAAA;AACF,SAAC,CAAA,CAAA;AAED;;;;;;;AAOE;AACF,QAAA,OAAO,CAAC,cAAwB,EAAE,KAAK,CAAA,CAAA;AAEvC,QAAA,OAAO,MAAM;AACX,YAAA,MAAM,UAAW,GAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAAU,EAAA,CAAA;;AAEpE,YAAA,OAAO,KAAK,CAAC,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,CAAE,IAAG,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAA,CAAA;AACzE,SAAA,CAAA;KACD;AACF,CAAA,CAAA;;;;"}
|
|
@@ -1 +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 <SlidingPanel\n :key=\"x.query.search\"\n :reset-on-content-change=\"false\"\n :button-class=\"buttonClass\"\n :show-buttons=\"showButtons && selectedPromptIndex === -1\"\n :scroll-container-class=\"[\n 'x-related-prompts-tag-list-scroll-container',\n scrollContainerClass || '',\n ]\"\n >\n <template #sliding-panel-left-button>\n <!--\n @slot sliding-panel-left-button - The button to be displayed on the left side of the sliding panel.\n -->\n <slot name=\"sliding-panel-left-button\" />\n </template>\n <transition-group\n class=\"x-related-prompts-tag-list\"\n :css=\"false\"\n tag=\"ul\"\n appear\n @before-enter=\"onBeforeEnter\"\n @enter=\"onEnter\"\n @leave=\"onLeave\"\n >\n <li\n v-for=\"{ index, ...relatedPrompt } in visibleRelatedPrompts\"\n ref=\"listItems\"\n :key=\"relatedPrompt.suggestionText\"\n class=\"x-related-prompts-tag-list-item\"\n :class=\"[tagClass, tagColors && tagColors[index % tagColors.length]]\"\n :data-index=\"index\"\n :style=\"{\n ...(selectedPromptIndex === index && { width: '100%' }),\n ...(isAnimating && { pointerEvents: 'none' }),\n }\"\n data-test=\"related-prompts-tag-list-item\"\n >\n <!--\n @slot - The slot to render related prompt information.\n @prop {Object} relatedPrompt - The related prompt object.\n @prop {Function} onSelect - The function to select the related prompt.\n @prop {Boolean} isSelected - Indicates if the related prompt is currently selected.\n -->\n <slot\n :related-prompt=\"relatedPrompt\"\n :on-select=\"() => onSelect(index)\"\n :is-selected=\"selectedPromptIndex === index\"\n >\n <DisplayEmitter\n :payload=\"relatedPrompt.tagging?.toolingDisplayTagging\"\n :event-metadata=\"{\n feature: 'related-prompts',\n displayOriginalQuery: x.query.searchBox,\n replaceable: false,\n }\"\n >\n <RelatedPrompt\n :related-prompt=\"relatedPrompt\"\n :selected=\"selectedPromptIndex === index\"\n @click=\"onSelect(index)\"\n >\n <template #related-prompt-extra-content>\n <slot name=\"related-prompt-extra-content\" :related-prompt=\"relatedPrompt\" />\n </template>\n </RelatedPrompt>\n </DisplayEmitter>\n </slot>\n </li>\n </transition-group>\n <template #sliding-panel-right-button>\n <!--\n @slot sliding-panel-right-button - The button to be displayed on the right side of the sliding panel.\n -->\n <slot name=\"sliding-panel-right-button\" />\n </template>\n </SlidingPanel>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, onBeforeUnmount, ref } from 'vue'\nimport DisplayEmitter from '../../../components/display-emitter.vue'\nimport SlidingPanel from '../../../components/sliding-panel.vue'\nimport { use$x, useState } from '../../../composables'\nimport { relatedPromptsXModule } from '../x-module'\nimport RelatedPrompt from './related-prompt.vue'\n\n/**\n * This component shows the list of `RelatedPrompts` components.\n *\n * If the default slot is reimplemented in the consumer, `onSelect` function will be\n * necessary to handle the selection of the related prompt and to trigger the stagger-fade-slide animation.\n *\n * @public\n */\nexport default defineComponent({\n name: 'RelatedPromptsTagList',\n xModule: relatedPromptsXModule.name,\n components: { DisplayEmitter, RelatedPrompt, SlidingPanel },\n props: {\n /**\n * The CSS class for the left and right button of the sliding panel.\n *\n * @public\n */\n buttonClass: String,\n /**\n * The boolean prop to handle the visiblity of sliding pannel buttons.\n *\n * @public\n */\n showButtons: { type: Boolean, default: true },\n /**\n * The CSS class for the wrapper of all the related prompt wrapper elements.\n *\n * @public\n */\n scrollContainerClass: String,\n /**\n * The CSS class for all the related prompt wrapper elements.\n *\n * @public\n */\n tagClass: String,\n /**\n * Array of colors to apply to the related prompts. It will be applied to tag\n * elements cyclically according to their index in the nex way: `tagColors[index % tagColors.length]`.\n *\n * @public\n */\n tagColors: Array as PropType<string[]>,\n /**\n * The duration of the total animation in milliseconds.\n *\n * @public\n */\n animationDurationInMs: {\n type: Number,\n default: 700,\n },\n },\n setup(props) {\n const x = use$x()\n const { relatedPrompts, selectedPrompt: selectedPromptIndex } = useState('relatedPrompts')\n\n const clickedListItemIndex = ref<number | null>(null)\n const initialOffsetLefts: Record<number, number> = {}\n const isAnimating = ref(false)\n const listItems = ref<HTMLElement[]>([])\n\n const sortedListItems = computed<HTMLElement[]>(() =>\n [...listItems.value].sort(\n (a: HTMLElement, b: HTMLElement) =>\n Number.parseInt(b.getAttribute('data-index')!) -\n Number.parseInt(a.getAttribute('data-index')!),\n ),\n )\n\n // The duration of a single animation (enter or leave) in milliseconds\n // if a related prompt is clicked (clickedListItemIndex.value !== null), the duration is divided by the number of related\n // prompts -1 (the clicked one is synchronized with the last one to leave or the first one to enter)\n const singleAnimationDurationInMs = computed(\n () =>\n props.animationDurationInMs /\n (clickedListItemIndex.value !== null\n ? relatedPrompts.value.length - 1\n : relatedPrompts.value.length),\n )\n\n const indexRelatedPrompts = computed(() =>\n relatedPrompts.value.map((relatedPrompt, index) => ({ ...relatedPrompt, index })),\n )\n\n const visibleRelatedPrompts = computed(() =>\n selectedPromptIndex.value !== -1\n ? [indexRelatedPrompts.value[selectedPromptIndex.value]]\n : indexRelatedPrompts.value,\n )\n\n let timeOutId: number\n const resetTransitionStyle = (excludedProperties: Array<string> = ['width']) => {\n if (timeOutId) {\n clearTimeout(timeOutId)\n }\n\n isAnimating.value = true\n timeOutId = +setTimeout(() => {\n isAnimating.value = false\n clickedListItemIndex.value = null\n\n sortedListItems.value.forEach(element => {\n element.style.cssText\n .split(';')\n .map(rule => rule.split(':')[0]?.trim())\n .forEach(property => {\n if (!excludedProperties.includes(property)) {\n element.style.removeProperty(property)\n }\n })\n })\n }, props.animationDurationInMs)\n }\n\n const onSelect = (selectedIndex: number): void => {\n resetTransitionStyle()\n\n clickedListItemIndex.value = selectedIndex\n const selected: HTMLElement = sortedListItems.value.find(\n element => Number.parseInt(element.getAttribute('data-index')!) === selectedIndex,\n )!\n\n // selectedPromptIndex.value === -1 ? 'SELECTING' : 'DESELECTING'\n if (selectedPromptIndex.value === -1) {\n // Prepare all the elements for the leave animation (~ 'beforeLeave' hook). Remember the elements are\n // sorted in descending order by index.\n sortedListItems.value.forEach(element => {\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n initialOffsetLefts[index] = element.offsetLeft\n element.style.left = `${element.offsetLeft}px`\n element.style.position = 'absolute'\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n\n if (index !== selectedIndex) {\n element.style.opacity = '1'\n element.style.transitionDelay = `${\n (index < selectedIndex ? index : index - 1) * singleAnimationDurationInMs.value\n }ms`\n }\n })\n\n // Synchronize the transition delay of the selected element with the last\n // element to leave\n selected.style.transitionDelay = `${\n (relatedPrompts.value.length > 1 ? relatedPrompts.value.length - 2 : 0) *\n singleAnimationDurationInMs.value\n }ms`\n\n // Trigger the animation (selecting) for the selected element\n requestAnimationFrame(() => {\n const maxWidth = getComputedStyle(selected).maxWidth\n\n selected.style.left = '0px'\n selected.style.setProperty(\n 'width',\n `${maxWidth !== 'none' ? maxWidth : '100%'}`,\n 'important',\n )\n })\n } else {\n // Prepare the selected element for the deselecting animation\n selected.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n selected.style.left = '0px'\n selected.style.position = 'absolute'\n\n // Trigger the animation (deselecting) for the selected element\n selected.style.removeProperty('width')\n requestAnimationFrame(() => {\n selected.style.left = `${initialOffsetLefts[selectedIndex]}px`\n })\n }\n\n x.emit('UserSelectedARelatedPrompt', selectedIndex, {\n relatedPrompt: relatedPrompts.value[selectedIndex],\n selectedPrompt: selectedPromptIndex.value,\n })\n }\n\n const onBeforeEnter = (el: Element) => {\n const element = el as HTMLElement\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n // Prepare the element for the enter animation\n element.style.opacity = '0'\n element.style.transform = 'translateY(5px)'\n element.style.transitionDelay = `${\n (clickedListItemIndex.value !== null && index > clickedListItemIndex.value\n ? index - 1\n : index) * singleAnimationDurationInMs.value\n }ms`\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n }\n\n const onEnter = (el: Element, done: () => void) => {\n const element = el as HTMLElement\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n // Also part of the preparation for the enter animation, but it needs to be done\n // once the element is inserted in DOM (if not the offsetLeft will be always 0)\n element.style.left = `${initialOffsetLefts[index] ?? element.offsetLeft}px`\n\n // trigger enter animation\n requestAnimationFrame(() => {\n element.style.opacity = '1'\n element.style.position = 'absolute'\n element.style.transform = 'translateY(0)'\n })\n\n done()\n }\n\n const onLeave = (el: Element, done: () => void) => {\n const element = el as HTMLElement\n\n // trigger leave animation\n requestAnimationFrame(() => {\n element.style.opacity = '0'\n element.style.transform = 'translateY(5px)'\n })\n\n // Wait for the animation to finish (done() exectution extracts the element from the DOM)\n setTimeout(done, props.animationDurationInMs)\n }\n\n // Changing the request will trigger the appear animation, so we need to reset the\n // style after it finishes\n x.on('SearchRequestChanged', false).subscribe(() => {\n resetTransitionStyle([])\n })\n\n onBeforeUnmount(() => {\n x.emit('RelatedPromptsUnmounted')\n })\n\n return {\n onSelect,\n onBeforeEnter,\n onEnter,\n onLeave,\n selectedPromptIndex,\n visibleRelatedPrompts,\n listItems,\n isAnimating,\n x,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-related-prompts-tag-list-scroll-container {\n height: 100%;\n position: relative;\n}\n.x-related-prompts-tag-list {\n display: flex;\n gap: 16px;\n min-width: 100%;\n width: 100%;\n}\n.x-related-prompts-tag-list-item {\n height: 100%;\n flex-shrink: 0;\n}\n</style>\n"],"names":["_resolveComponent","_openBlock","_createBlock","buttonClass","showButtons","scrollContainerClass","_renderSlot","_withCtx","_createVNode","_TransitionGroup","onLeave","_createElementBlock","_Fragment","_renderList","_normalizeClass","selectedPromptIndex","isAnimating","_normalizeStyle","onSelect","x"],"mappings":";;;;;;;;;kCACEA,gBA4Ee,CAAA,cAAA,CAAA,CAAA;SA1EZC,SAA8B,EAAA,EAAAC,WAAA,CAAA,uBAAA,EAAA;AAAA,IAC9B,GAAcC,EAAAA,IAAAA,CAAAA,CAAAA,CAAAA,KAAAA,CAAAA,MAAAA;AAAAA,IACd,yBAAcC,EAAAA,KAAAA;AAAAA,IACd,cAAA,EAAA,IAAA,CAAA,WAAA;AAAA,IAAA,cAAA,EAAA,IAAA,CAAA,WAAA,IAAA,IAAA,CAAA,mBAAA,KAAA,CAAA,CAAA;AAAqFC,IAAAA,wBAAAA,EAAAA;AAAAA,MAAAA,6CAAAA;;AAK3E,KAAA;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EAAA,SAAA,EAAA,SAAA,CAAA,CAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
|
|
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 <SlidingPanel\n :key=\"x.query.search\"\n :reset-on-content-change=\"false\"\n :button-class=\"buttonClass\"\n :show-buttons=\"showButtons && selectedPromptIndex === -1\"\n :scroll-container-class=\"[\n 'x-related-prompts-tag-list-scroll-container',\n scrollContainerClass || '',\n ]\"\n >\n <template #sliding-panel-left-button>\n <!--\n @slot sliding-panel-left-button - The button to be displayed on the left side of the sliding panel.\n -->\n <slot name=\"sliding-panel-left-button\" />\n </template>\n <transition-group\n class=\"x-related-prompts-tag-list\"\n :css=\"false\"\n tag=\"ul\"\n appear\n @before-enter=\"onBeforeEnter\"\n @enter=\"onEnter\"\n @leave=\"onLeave\"\n >\n <li\n v-for=\"{ index, ...relatedPrompt } in visibleRelatedPrompts\"\n ref=\"listItems\"\n :key=\"relatedPrompt.suggestionText\"\n class=\"x-related-prompts-tag-list-item\"\n :class=\"[tagClass, tagColors && tagColors[index % tagColors.length]]\"\n :data-index=\"index\"\n :style=\"{\n ...(selectedPromptIndex === index && { width: '100%' }),\n ...(isAnimating && { pointerEvents: 'none' }),\n }\"\n data-test=\"related-prompts-tag-list-item\"\n >\n <!--\n @slot - The slot to render related prompt information.\n @prop {Object} relatedPrompt - The related prompt object.\n @prop {Function} onSelect - The function to select the related prompt.\n @prop {Boolean} isSelected - Indicates if the related prompt is currently selected.\n -->\n <slot\n :related-prompt=\"relatedPrompt\"\n :on-select=\"() => onSelect(index)\"\n :is-selected=\"selectedPromptIndex === index\"\n >\n <DisplayEmitter\n :payload=\"relatedPrompt.tagging?.toolingDisplayTagging\"\n :event-metadata=\"{\n feature: 'related-prompts',\n displayOriginalQuery: x.query.searchBox,\n replaceable: false,\n }\"\n >\n <RelatedPrompt\n :related-prompt=\"relatedPrompt\"\n :selected=\"selectedPromptIndex === index\"\n @click=\"onSelect(index)\"\n >\n <template #related-prompt-extra-content>\n <!--\n @slot related-prompt-extra-content - The slot to render related prompt extra information.\n @prop {Object} relatedPrompt - The related prompt object.\n -->\n <slot name=\"related-prompt-extra-content\" :related-prompt=\"relatedPrompt\" />\n </template>\n </RelatedPrompt>\n </DisplayEmitter>\n </slot>\n </li>\n </transition-group>\n <template #sliding-panel-right-button>\n <!--\n @slot sliding-panel-right-button - The button to be displayed on the right side of the sliding panel.\n -->\n <slot name=\"sliding-panel-right-button\" />\n </template>\n </SlidingPanel>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, onBeforeUnmount, ref } from 'vue'\nimport DisplayEmitter from '../../../components/display-emitter.vue'\nimport SlidingPanel from '../../../components/sliding-panel.vue'\nimport { use$x, useState } from '../../../composables'\nimport { relatedPromptsXModule } from '../x-module'\nimport RelatedPrompt from './related-prompt.vue'\n\n/**\n * This component shows the list of `RelatedPrompts` components.\n *\n * If the default slot is reimplemented in the consumer, `onSelect` function will be\n * necessary to handle the selection of the related prompt and to trigger the stagger-fade-slide animation.\n *\n * @public\n */\nexport default defineComponent({\n name: 'RelatedPromptsTagList',\n xModule: relatedPromptsXModule.name,\n components: { DisplayEmitter, RelatedPrompt, SlidingPanel },\n props: {\n /**\n * The CSS class for the left and right button of the sliding panel.\n *\n * @public\n */\n buttonClass: String,\n /**\n * The boolean prop to handle the visiblity of sliding pannel buttons.\n *\n * @public\n */\n showButtons: { type: Boolean, default: true },\n /**\n * The CSS class for the wrapper of all the related prompt wrapper elements.\n *\n * @public\n */\n scrollContainerClass: String,\n /**\n * The CSS class for all the related prompt wrapper elements.\n *\n * @public\n */\n tagClass: String,\n /**\n * Array of colors to apply to the related prompts. It will be applied to tag\n * elements cyclically according to their index in the nex way: `tagColors[index % tagColors.length]`.\n *\n * @public\n */\n tagColors: Array as PropType<string[]>,\n /**\n * The duration of the total animation in milliseconds.\n *\n * @public\n */\n animationDurationInMs: {\n type: Number,\n default: 700,\n },\n },\n setup(props) {\n const x = use$x()\n const { relatedPrompts, selectedPrompt: selectedPromptIndex } = useState('relatedPrompts')\n\n const clickedListItemIndex = ref<number | null>(null)\n const initialOffsetLefts: Record<number, number> = {}\n const isAnimating = ref(false)\n const listItems = ref<HTMLElement[]>([])\n\n const sortedListItems = computed<HTMLElement[]>(() =>\n [...listItems.value].sort(\n (a: HTMLElement, b: HTMLElement) =>\n Number.parseInt(b.getAttribute('data-index')!) -\n Number.parseInt(a.getAttribute('data-index')!),\n ),\n )\n\n // The duration of a single animation (enter or leave) in milliseconds\n // if a related prompt is clicked (clickedListItemIndex.value !== null), the duration is divided by the number of related\n // prompts -1 (the clicked one is synchronized with the last one to leave or the first one to enter)\n const singleAnimationDurationInMs = computed(\n () =>\n props.animationDurationInMs /\n (clickedListItemIndex.value !== null\n ? relatedPrompts.value.length - 1\n : relatedPrompts.value.length),\n )\n\n const indexRelatedPrompts = computed(() =>\n relatedPrompts.value.map((relatedPrompt, index) => ({ ...relatedPrompt, index })),\n )\n\n const visibleRelatedPrompts = computed(() =>\n selectedPromptIndex.value !== -1\n ? [indexRelatedPrompts.value[selectedPromptIndex.value]]\n : indexRelatedPrompts.value,\n )\n\n let timeOutId: number\n const resetTransitionStyle = (excludedProperties: Array<string> = ['width']) => {\n if (timeOutId) {\n clearTimeout(timeOutId)\n }\n\n isAnimating.value = true\n timeOutId = +setTimeout(() => {\n isAnimating.value = false\n clickedListItemIndex.value = null\n\n sortedListItems.value.forEach(element => {\n element.style.cssText\n .split(';')\n .map(rule => rule.split(':')[0]?.trim())\n .forEach(property => {\n if (!excludedProperties.includes(property)) {\n element.style.removeProperty(property)\n }\n })\n })\n }, props.animationDurationInMs)\n }\n\n const onSelect = (selectedIndex: number): void => {\n resetTransitionStyle()\n\n clickedListItemIndex.value = selectedIndex\n const selected: HTMLElement = sortedListItems.value.find(\n element => Number.parseInt(element.getAttribute('data-index')!) === selectedIndex,\n )!\n\n // selectedPromptIndex.value === -1 ? 'SELECTING' : 'DESELECTING'\n if (selectedPromptIndex.value === -1) {\n // Prepare all the elements for the leave animation (~ 'beforeLeave' hook). Remember the elements are\n // sorted in descending order by index.\n sortedListItems.value.forEach(element => {\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n initialOffsetLefts[index] = element.offsetLeft\n element.style.left = `${element.offsetLeft}px`\n element.style.position = 'absolute'\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n\n if (index !== selectedIndex) {\n element.style.opacity = '1'\n element.style.transitionDelay = `${\n (index < selectedIndex ? index : index - 1) * singleAnimationDurationInMs.value\n }ms`\n }\n })\n\n // Synchronize the transition delay of the selected element with the last\n // element to leave\n selected.style.transitionDelay = `${\n (relatedPrompts.value.length > 1 ? relatedPrompts.value.length - 2 : 0) *\n singleAnimationDurationInMs.value\n }ms`\n\n // Trigger the animation (selecting) for the selected element\n requestAnimationFrame(() => {\n const maxWidth = getComputedStyle(selected).maxWidth\n\n selected.style.left = '0px'\n selected.style.setProperty(\n 'width',\n `${maxWidth !== 'none' ? maxWidth : '100%'}`,\n 'important',\n )\n })\n } else {\n // Prepare the selected element for the deselecting animation\n selected.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n selected.style.left = '0px'\n selected.style.position = 'absolute'\n\n // Trigger the animation (deselecting) for the selected element\n selected.style.removeProperty('width')\n requestAnimationFrame(() => {\n selected.style.left = `${initialOffsetLefts[selectedIndex]}px`\n })\n }\n\n x.emit('UserSelectedARelatedPrompt', selectedIndex, {\n relatedPrompt: relatedPrompts.value[selectedIndex],\n selectedPrompt: selectedPromptIndex.value,\n })\n }\n\n const onBeforeEnter = (el: Element) => {\n const element = el as HTMLElement\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n // Prepare the element for the enter animation\n element.style.opacity = '0'\n element.style.transform = 'translateY(5px)'\n element.style.transitionDelay = `${\n (clickedListItemIndex.value !== null && index > clickedListItemIndex.value\n ? index - 1\n : index) * singleAnimationDurationInMs.value\n }ms`\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n }\n\n const onEnter = (el: Element, done: () => void) => {\n const element = el as HTMLElement\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n // Also part of the preparation for the enter animation, but it needs to be done\n // once the element is inserted in DOM (if not the offsetLeft will be always 0)\n element.style.left = `${initialOffsetLefts[index] ?? element.offsetLeft}px`\n\n // trigger enter animation\n requestAnimationFrame(() => {\n element.style.opacity = '1'\n element.style.position = 'absolute'\n element.style.transform = 'translateY(0)'\n })\n\n done()\n }\n\n const onLeave = (el: Element, done: () => void) => {\n const element = el as HTMLElement\n\n // trigger leave animation\n requestAnimationFrame(() => {\n element.style.opacity = '0'\n element.style.transform = 'translateY(5px)'\n })\n\n // Wait for the animation to finish (done() exectution extracts the element from the DOM)\n setTimeout(done, props.animationDurationInMs)\n }\n\n // Changing the request will trigger the appear animation, so we need to reset the\n // style after it finishes\n x.on('SearchRequestChanged', false).subscribe(() => {\n resetTransitionStyle([])\n })\n\n onBeforeUnmount(() => {\n x.emit('RelatedPromptsUnmounted')\n })\n\n return {\n onSelect,\n onBeforeEnter,\n onEnter,\n onLeave,\n selectedPromptIndex,\n visibleRelatedPrompts,\n listItems,\n isAnimating,\n x,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-related-prompts-tag-list-scroll-container {\n height: 100%;\n position: relative;\n}\n.x-related-prompts-tag-list {\n display: flex;\n gap: 16px;\n min-width: 100%;\n width: 100%;\n}\n.x-related-prompts-tag-list-item {\n height: 100%;\n flex-shrink: 0;\n}\n</style>\n"],"names":["_resolveComponent","_openBlock","_createBlock","buttonClass","showButtons","scrollContainerClass","_renderSlot","_withCtx","_createVNode","_TransitionGroup","onLeave","_createElementBlock","_Fragment","_renderList","_normalizeClass","selectedPromptIndex","isAnimating","_normalizeStyle","onSelect","x"],"mappings":";;;;;;;;;kCACEA,gBAgFe,CAAA,cAAA,CAAA,CAAA;SA9EZC,SAA8B,EAAA,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,EAAA,CAAA;AAAA,yBAAA,CAAA;;;AAAA,uBAAA,EAAA,IAAA,EAAA,CAAA,gBAAA,EAAA,UAAA,EAAA,SAAA,CAAA,CAAA;AAAA,qBAAA,CAAA;;;AAAA,mBAAA,EAAA,IAAA,EAAA,CAAA,SAAA,EAAA,gBAAA,CAAA,CAAA;AAAA,iBAAA,CAAA;;AAAA,aAAA,CAAA;AAAA,YAAA,GAAA;AAAA;AAAA,WAAA;AAAA,SAAA,CAAA;;;AAAA,OAAA,EAAA,CAAA,EAAA,CAAA,eAAA,EAAA,SAAA,EAAA,SAAA,CAAA,CAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
|
|
@@ -3,6 +3,7 @@ import _sfc_main$1 from '../../../components/display-emitter.vue.js';
|
|
|
3
3
|
import SlidingPanel from '../../../components/sliding-panel.vue.js';
|
|
4
4
|
import '../../../composables/create-use-device.js';
|
|
5
5
|
import { use$x } from '../../../composables/use-_x.js';
|
|
6
|
+
import 'vuex';
|
|
6
7
|
import '@vue/devtools-api';
|
|
7
8
|
import '../../../plugins/devtools/timeline.devtools.js';
|
|
8
9
|
import '@empathyco/x-utils';
|
|
@@ -11,7 +12,6 @@ import 'rxjs';
|
|
|
11
12
|
import '../../../plugins/devtools/colors.utils.js';
|
|
12
13
|
import '../../../plugins/x-bus.js';
|
|
13
14
|
import '../../../plugins/x-plugin.js';
|
|
14
|
-
import 'vuex';
|
|
15
15
|
import '@vueuse/core';
|
|
16
16
|
import { useState } from '../../../composables/use-state.js';
|
|
17
17
|
import { relatedPromptsXModule } from '../x-module.js';
|
|
@@ -1 +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 <SlidingPanel\n :key=\"x.query.search\"\n :reset-on-content-change=\"false\"\n :button-class=\"buttonClass\"\n :show-buttons=\"showButtons && selectedPromptIndex === -1\"\n :scroll-container-class=\"[\n 'x-related-prompts-tag-list-scroll-container',\n scrollContainerClass || '',\n ]\"\n >\n <template #sliding-panel-left-button>\n <!--\n @slot sliding-panel-left-button - The button to be displayed on the left side of the sliding panel.\n -->\n <slot name=\"sliding-panel-left-button\" />\n </template>\n <transition-group\n class=\"x-related-prompts-tag-list\"\n :css=\"false\"\n tag=\"ul\"\n appear\n @before-enter=\"onBeforeEnter\"\n @enter=\"onEnter\"\n @leave=\"onLeave\"\n >\n <li\n v-for=\"{ index, ...relatedPrompt } in visibleRelatedPrompts\"\n ref=\"listItems\"\n :key=\"relatedPrompt.suggestionText\"\n class=\"x-related-prompts-tag-list-item\"\n :class=\"[tagClass, tagColors && tagColors[index % tagColors.length]]\"\n :data-index=\"index\"\n :style=\"{\n ...(selectedPromptIndex === index && { width: '100%' }),\n ...(isAnimating && { pointerEvents: 'none' }),\n }\"\n data-test=\"related-prompts-tag-list-item\"\n >\n <!--\n @slot - The slot to render related prompt information.\n @prop {Object} relatedPrompt - The related prompt object.\n @prop {Function} onSelect - The function to select the related prompt.\n @prop {Boolean} isSelected - Indicates if the related prompt is currently selected.\n -->\n <slot\n :related-prompt=\"relatedPrompt\"\n :on-select=\"() => onSelect(index)\"\n :is-selected=\"selectedPromptIndex === index\"\n >\n <DisplayEmitter\n :payload=\"relatedPrompt.tagging?.toolingDisplayTagging\"\n :event-metadata=\"{\n feature: 'related-prompts',\n displayOriginalQuery: x.query.searchBox,\n replaceable: false,\n }\"\n >\n <RelatedPrompt\n :related-prompt=\"relatedPrompt\"\n :selected=\"selectedPromptIndex === index\"\n @click=\"onSelect(index)\"\n >\n <template #related-prompt-extra-content>\n <slot name=\"related-prompt-extra-content\" :related-prompt=\"relatedPrompt\" />\n </template>\n </RelatedPrompt>\n </DisplayEmitter>\n </slot>\n </li>\n </transition-group>\n <template #sliding-panel-right-button>\n <!--\n @slot sliding-panel-right-button - The button to be displayed on the right side of the sliding panel.\n -->\n <slot name=\"sliding-panel-right-button\" />\n </template>\n </SlidingPanel>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, onBeforeUnmount, ref } from 'vue'\nimport DisplayEmitter from '../../../components/display-emitter.vue'\nimport SlidingPanel from '../../../components/sliding-panel.vue'\nimport { use$x, useState } from '../../../composables'\nimport { relatedPromptsXModule } from '../x-module'\nimport RelatedPrompt from './related-prompt.vue'\n\n/**\n * This component shows the list of `RelatedPrompts` components.\n *\n * If the default slot is reimplemented in the consumer, `onSelect` function will be\n * necessary to handle the selection of the related prompt and to trigger the stagger-fade-slide animation.\n *\n * @public\n */\nexport default defineComponent({\n name: 'RelatedPromptsTagList',\n xModule: relatedPromptsXModule.name,\n components: { DisplayEmitter, RelatedPrompt, SlidingPanel },\n props: {\n /**\n * The CSS class for the left and right button of the sliding panel.\n *\n * @public\n */\n buttonClass: String,\n /**\n * The boolean prop to handle the visiblity of sliding pannel buttons.\n *\n * @public\n */\n showButtons: { type: Boolean, default: true },\n /**\n * The CSS class for the wrapper of all the related prompt wrapper elements.\n *\n * @public\n */\n scrollContainerClass: String,\n /**\n * The CSS class for all the related prompt wrapper elements.\n *\n * @public\n */\n tagClass: String,\n /**\n * Array of colors to apply to the related prompts. It will be applied to tag\n * elements cyclically according to their index in the nex way: `tagColors[index % tagColors.length]`.\n *\n * @public\n */\n tagColors: Array as PropType<string[]>,\n /**\n * The duration of the total animation in milliseconds.\n *\n * @public\n */\n animationDurationInMs: {\n type: Number,\n default: 700,\n },\n },\n setup(props) {\n const x = use$x()\n const { relatedPrompts, selectedPrompt: selectedPromptIndex } = useState('relatedPrompts')\n\n const clickedListItemIndex = ref<number | null>(null)\n const initialOffsetLefts: Record<number, number> = {}\n const isAnimating = ref(false)\n const listItems = ref<HTMLElement[]>([])\n\n const sortedListItems = computed<HTMLElement[]>(() =>\n [...listItems.value].sort(\n (a: HTMLElement, b: HTMLElement) =>\n Number.parseInt(b.getAttribute('data-index')!) -\n Number.parseInt(a.getAttribute('data-index')!),\n ),\n )\n\n // The duration of a single animation (enter or leave) in milliseconds\n // if a related prompt is clicked (clickedListItemIndex.value !== null), the duration is divided by the number of related\n // prompts -1 (the clicked one is synchronized with the last one to leave or the first one to enter)\n const singleAnimationDurationInMs = computed(\n () =>\n props.animationDurationInMs /\n (clickedListItemIndex.value !== null\n ? relatedPrompts.value.length - 1\n : relatedPrompts.value.length),\n )\n\n const indexRelatedPrompts = computed(() =>\n relatedPrompts.value.map((relatedPrompt, index) => ({ ...relatedPrompt, index })),\n )\n\n const visibleRelatedPrompts = computed(() =>\n selectedPromptIndex.value !== -1\n ? [indexRelatedPrompts.value[selectedPromptIndex.value]]\n : indexRelatedPrompts.value,\n )\n\n let timeOutId: number\n const resetTransitionStyle = (excludedProperties: Array<string> = ['width']) => {\n if (timeOutId) {\n clearTimeout(timeOutId)\n }\n\n isAnimating.value = true\n timeOutId = +setTimeout(() => {\n isAnimating.value = false\n clickedListItemIndex.value = null\n\n sortedListItems.value.forEach(element => {\n element.style.cssText\n .split(';')\n .map(rule => rule.split(':')[0]?.trim())\n .forEach(property => {\n if (!excludedProperties.includes(property)) {\n element.style.removeProperty(property)\n }\n })\n })\n }, props.animationDurationInMs)\n }\n\n const onSelect = (selectedIndex: number): void => {\n resetTransitionStyle()\n\n clickedListItemIndex.value = selectedIndex\n const selected: HTMLElement = sortedListItems.value.find(\n element => Number.parseInt(element.getAttribute('data-index')!) === selectedIndex,\n )!\n\n // selectedPromptIndex.value === -1 ? 'SELECTING' : 'DESELECTING'\n if (selectedPromptIndex.value === -1) {\n // Prepare all the elements for the leave animation (~ 'beforeLeave' hook). Remember the elements are\n // sorted in descending order by index.\n sortedListItems.value.forEach(element => {\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n initialOffsetLefts[index] = element.offsetLeft\n element.style.left = `${element.offsetLeft}px`\n element.style.position = 'absolute'\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n\n if (index !== selectedIndex) {\n element.style.opacity = '1'\n element.style.transitionDelay = `${\n (index < selectedIndex ? index : index - 1) * singleAnimationDurationInMs.value\n }ms`\n }\n })\n\n // Synchronize the transition delay of the selected element with the last\n // element to leave\n selected.style.transitionDelay = `${\n (relatedPrompts.value.length > 1 ? relatedPrompts.value.length - 2 : 0) *\n singleAnimationDurationInMs.value\n }ms`\n\n // Trigger the animation (selecting) for the selected element\n requestAnimationFrame(() => {\n const maxWidth = getComputedStyle(selected).maxWidth\n\n selected.style.left = '0px'\n selected.style.setProperty(\n 'width',\n `${maxWidth !== 'none' ? maxWidth : '100%'}`,\n 'important',\n )\n })\n } else {\n // Prepare the selected element for the deselecting animation\n selected.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n selected.style.left = '0px'\n selected.style.position = 'absolute'\n\n // Trigger the animation (deselecting) for the selected element\n selected.style.removeProperty('width')\n requestAnimationFrame(() => {\n selected.style.left = `${initialOffsetLefts[selectedIndex]}px`\n })\n }\n\n x.emit('UserSelectedARelatedPrompt', selectedIndex, {\n relatedPrompt: relatedPrompts.value[selectedIndex],\n selectedPrompt: selectedPromptIndex.value,\n })\n }\n\n const onBeforeEnter = (el: Element) => {\n const element = el as HTMLElement\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n // Prepare the element for the enter animation\n element.style.opacity = '0'\n element.style.transform = 'translateY(5px)'\n element.style.transitionDelay = `${\n (clickedListItemIndex.value !== null && index > clickedListItemIndex.value\n ? index - 1\n : index) * singleAnimationDurationInMs.value\n }ms`\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n }\n\n const onEnter = (el: Element, done: () => void) => {\n const element = el as HTMLElement\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n // Also part of the preparation for the enter animation, but it needs to be done\n // once the element is inserted in DOM (if not the offsetLeft will be always 0)\n element.style.left = `${initialOffsetLefts[index] ?? element.offsetLeft}px`\n\n // trigger enter animation\n requestAnimationFrame(() => {\n element.style.opacity = '1'\n element.style.position = 'absolute'\n element.style.transform = 'translateY(0)'\n })\n\n done()\n }\n\n const onLeave = (el: Element, done: () => void) => {\n const element = el as HTMLElement\n\n // trigger leave animation\n requestAnimationFrame(() => {\n element.style.opacity = '0'\n element.style.transform = 'translateY(5px)'\n })\n\n // Wait for the animation to finish (done() exectution extracts the element from the DOM)\n setTimeout(done, props.animationDurationInMs)\n }\n\n // Changing the request will trigger the appear animation, so we need to reset the\n // style after it finishes\n x.on('SearchRequestChanged', false).subscribe(() => {\n resetTransitionStyle([])\n })\n\n onBeforeUnmount(() => {\n x.emit('RelatedPromptsUnmounted')\n })\n\n return {\n onSelect,\n onBeforeEnter,\n onEnter,\n onLeave,\n selectedPromptIndex,\n visibleRelatedPrompts,\n listItems,\n isAnimating,\n x,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-related-prompts-tag-list-scroll-container {\n height: 100%;\n position: relative;\n}\n.x-related-prompts-tag-list {\n display: flex;\n gap: 16px;\n min-width: 100%;\n width: 100%;\n}\n.x-related-prompts-tag-list-item {\n height: 100%;\n flex-shrink: 0;\n}\n</style>\n"],"names":["DisplayEmitter"],"mappings":";;;;;;;;;;;;;;;;;;;AAyFA;;;;;;;AAOE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,uBAAuB;IAC7B,OAAO,EAAE,qBAAqB,CAAC,IAAI;AACnC,IAAA,UAAU,EAAE,kBAAEA,WAAc,EAAE,aAAa,EAAE,YAAW,EAAG;AAC3D,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,WAAW,EAAE,MAAM;AACnB;;;;AAIE;QACF,WAAW,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM;AAC7C;;;;AAIE;AACF,QAAA,oBAAoB,EAAE,MAAM;AAC5B;;;;AAIE;AACF,QAAA,QAAQ,EAAE,MAAM;AAChB;;;;;AAKE;AACF,QAAA,SAAS,EAAE,KAA2B;AACtC;;;;AAIE;AACF,QAAA,qBAAqB,EAAE;AACrB,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,GAA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aAAC,CAAA,CAAA;;AAGD,YAAA,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,qBAAqB,CAAA,CAAA;AAC9C,SAAA,CAAA;;;QAIA,CAAC,CAAC,EAAE,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC,SAAS,CAAC,MAAM;YAClD,oBAAoB,CAAC,EAAE,CAAA,CAAA;AACzB,SAAC,CAAA,CAAA;QAED,eAAe,CAAC,MAAM;AACpB,YAAA,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAA,CAAA;AAClC,SAAC,CAAA,CAAA;QAED,OAAO;YACL,QAAQ;YACR,aAAa;YACb,OAAO;YACP,OAAO;YACP,mBAAmB;YACnB,qBAAqB;YACrB,SAAS;YACT,WAAW;YACX,CAAC;SACH,CAAA;KACD;AACF,CAAA,CAAA;;;;"}
|
|
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 <SlidingPanel\n :key=\"x.query.search\"\n :reset-on-content-change=\"false\"\n :button-class=\"buttonClass\"\n :show-buttons=\"showButtons && selectedPromptIndex === -1\"\n :scroll-container-class=\"[\n 'x-related-prompts-tag-list-scroll-container',\n scrollContainerClass || '',\n ]\"\n >\n <template #sliding-panel-left-button>\n <!--\n @slot sliding-panel-left-button - The button to be displayed on the left side of the sliding panel.\n -->\n <slot name=\"sliding-panel-left-button\" />\n </template>\n <transition-group\n class=\"x-related-prompts-tag-list\"\n :css=\"false\"\n tag=\"ul\"\n appear\n @before-enter=\"onBeforeEnter\"\n @enter=\"onEnter\"\n @leave=\"onLeave\"\n >\n <li\n v-for=\"{ index, ...relatedPrompt } in visibleRelatedPrompts\"\n ref=\"listItems\"\n :key=\"relatedPrompt.suggestionText\"\n class=\"x-related-prompts-tag-list-item\"\n :class=\"[tagClass, tagColors && tagColors[index % tagColors.length]]\"\n :data-index=\"index\"\n :style=\"{\n ...(selectedPromptIndex === index && { width: '100%' }),\n ...(isAnimating && { pointerEvents: 'none' }),\n }\"\n data-test=\"related-prompts-tag-list-item\"\n >\n <!--\n @slot - The slot to render related prompt information.\n @prop {Object} relatedPrompt - The related prompt object.\n @prop {Function} onSelect - The function to select the related prompt.\n @prop {Boolean} isSelected - Indicates if the related prompt is currently selected.\n -->\n <slot\n :related-prompt=\"relatedPrompt\"\n :on-select=\"() => onSelect(index)\"\n :is-selected=\"selectedPromptIndex === index\"\n >\n <DisplayEmitter\n :payload=\"relatedPrompt.tagging?.toolingDisplayTagging\"\n :event-metadata=\"{\n feature: 'related-prompts',\n displayOriginalQuery: x.query.searchBox,\n replaceable: false,\n }\"\n >\n <RelatedPrompt\n :related-prompt=\"relatedPrompt\"\n :selected=\"selectedPromptIndex === index\"\n @click=\"onSelect(index)\"\n >\n <template #related-prompt-extra-content>\n <!--\n @slot related-prompt-extra-content - The slot to render related prompt extra information.\n @prop {Object} relatedPrompt - The related prompt object.\n -->\n <slot name=\"related-prompt-extra-content\" :related-prompt=\"relatedPrompt\" />\n </template>\n </RelatedPrompt>\n </DisplayEmitter>\n </slot>\n </li>\n </transition-group>\n <template #sliding-panel-right-button>\n <!--\n @slot sliding-panel-right-button - The button to be displayed on the right side of the sliding panel.\n -->\n <slot name=\"sliding-panel-right-button\" />\n </template>\n </SlidingPanel>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, onBeforeUnmount, ref } from 'vue'\nimport DisplayEmitter from '../../../components/display-emitter.vue'\nimport SlidingPanel from '../../../components/sliding-panel.vue'\nimport { use$x, useState } from '../../../composables'\nimport { relatedPromptsXModule } from '../x-module'\nimport RelatedPrompt from './related-prompt.vue'\n\n/**\n * This component shows the list of `RelatedPrompts` components.\n *\n * If the default slot is reimplemented in the consumer, `onSelect` function will be\n * necessary to handle the selection of the related prompt and to trigger the stagger-fade-slide animation.\n *\n * @public\n */\nexport default defineComponent({\n name: 'RelatedPromptsTagList',\n xModule: relatedPromptsXModule.name,\n components: { DisplayEmitter, RelatedPrompt, SlidingPanel },\n props: {\n /**\n * The CSS class for the left and right button of the sliding panel.\n *\n * @public\n */\n buttonClass: String,\n /**\n * The boolean prop to handle the visiblity of sliding pannel buttons.\n *\n * @public\n */\n showButtons: { type: Boolean, default: true },\n /**\n * The CSS class for the wrapper of all the related prompt wrapper elements.\n *\n * @public\n */\n scrollContainerClass: String,\n /**\n * The CSS class for all the related prompt wrapper elements.\n *\n * @public\n */\n tagClass: String,\n /**\n * Array of colors to apply to the related prompts. It will be applied to tag\n * elements cyclically according to their index in the nex way: `tagColors[index % tagColors.length]`.\n *\n * @public\n */\n tagColors: Array as PropType<string[]>,\n /**\n * The duration of the total animation in milliseconds.\n *\n * @public\n */\n animationDurationInMs: {\n type: Number,\n default: 700,\n },\n },\n setup(props) {\n const x = use$x()\n const { relatedPrompts, selectedPrompt: selectedPromptIndex } = useState('relatedPrompts')\n\n const clickedListItemIndex = ref<number | null>(null)\n const initialOffsetLefts: Record<number, number> = {}\n const isAnimating = ref(false)\n const listItems = ref<HTMLElement[]>([])\n\n const sortedListItems = computed<HTMLElement[]>(() =>\n [...listItems.value].sort(\n (a: HTMLElement, b: HTMLElement) =>\n Number.parseInt(b.getAttribute('data-index')!) -\n Number.parseInt(a.getAttribute('data-index')!),\n ),\n )\n\n // The duration of a single animation (enter or leave) in milliseconds\n // if a related prompt is clicked (clickedListItemIndex.value !== null), the duration is divided by the number of related\n // prompts -1 (the clicked one is synchronized with the last one to leave or the first one to enter)\n const singleAnimationDurationInMs = computed(\n () =>\n props.animationDurationInMs /\n (clickedListItemIndex.value !== null\n ? relatedPrompts.value.length - 1\n : relatedPrompts.value.length),\n )\n\n const indexRelatedPrompts = computed(() =>\n relatedPrompts.value.map((relatedPrompt, index) => ({ ...relatedPrompt, index })),\n )\n\n const visibleRelatedPrompts = computed(() =>\n selectedPromptIndex.value !== -1\n ? [indexRelatedPrompts.value[selectedPromptIndex.value]]\n : indexRelatedPrompts.value,\n )\n\n let timeOutId: number\n const resetTransitionStyle = (excludedProperties: Array<string> = ['width']) => {\n if (timeOutId) {\n clearTimeout(timeOutId)\n }\n\n isAnimating.value = true\n timeOutId = +setTimeout(() => {\n isAnimating.value = false\n clickedListItemIndex.value = null\n\n sortedListItems.value.forEach(element => {\n element.style.cssText\n .split(';')\n .map(rule => rule.split(':')[0]?.trim())\n .forEach(property => {\n if (!excludedProperties.includes(property)) {\n element.style.removeProperty(property)\n }\n })\n })\n }, props.animationDurationInMs)\n }\n\n const onSelect = (selectedIndex: number): void => {\n resetTransitionStyle()\n\n clickedListItemIndex.value = selectedIndex\n const selected: HTMLElement = sortedListItems.value.find(\n element => Number.parseInt(element.getAttribute('data-index')!) === selectedIndex,\n )!\n\n // selectedPromptIndex.value === -1 ? 'SELECTING' : 'DESELECTING'\n if (selectedPromptIndex.value === -1) {\n // Prepare all the elements for the leave animation (~ 'beforeLeave' hook). Remember the elements are\n // sorted in descending order by index.\n sortedListItems.value.forEach(element => {\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n initialOffsetLefts[index] = element.offsetLeft\n element.style.left = `${element.offsetLeft}px`\n element.style.position = 'absolute'\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n\n if (index !== selectedIndex) {\n element.style.opacity = '1'\n element.style.transitionDelay = `${\n (index < selectedIndex ? index : index - 1) * singleAnimationDurationInMs.value\n }ms`\n }\n })\n\n // Synchronize the transition delay of the selected element with the last\n // element to leave\n selected.style.transitionDelay = `${\n (relatedPrompts.value.length > 1 ? relatedPrompts.value.length - 2 : 0) *\n singleAnimationDurationInMs.value\n }ms`\n\n // Trigger the animation (selecting) for the selected element\n requestAnimationFrame(() => {\n const maxWidth = getComputedStyle(selected).maxWidth\n\n selected.style.left = '0px'\n selected.style.setProperty(\n 'width',\n `${maxWidth !== 'none' ? maxWidth : '100%'}`,\n 'important',\n )\n })\n } else {\n // Prepare the selected element for the deselecting animation\n selected.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n selected.style.left = '0px'\n selected.style.position = 'absolute'\n\n // Trigger the animation (deselecting) for the selected element\n selected.style.removeProperty('width')\n requestAnimationFrame(() => {\n selected.style.left = `${initialOffsetLefts[selectedIndex]}px`\n })\n }\n\n x.emit('UserSelectedARelatedPrompt', selectedIndex, {\n relatedPrompt: relatedPrompts.value[selectedIndex],\n selectedPrompt: selectedPromptIndex.value,\n })\n }\n\n const onBeforeEnter = (el: Element) => {\n const element = el as HTMLElement\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n // Prepare the element for the enter animation\n element.style.opacity = '0'\n element.style.transform = 'translateY(5px)'\n element.style.transitionDelay = `${\n (clickedListItemIndex.value !== null && index > clickedListItemIndex.value\n ? index - 1\n : index) * singleAnimationDurationInMs.value\n }ms`\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n }\n\n const onEnter = (el: Element, done: () => void) => {\n const element = el as HTMLElement\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n // Also part of the preparation for the enter animation, but it needs to be done\n // once the element is inserted in DOM (if not the offsetLeft will be always 0)\n element.style.left = `${initialOffsetLefts[index] ?? element.offsetLeft}px`\n\n // trigger enter animation\n requestAnimationFrame(() => {\n element.style.opacity = '1'\n element.style.position = 'absolute'\n element.style.transform = 'translateY(0)'\n })\n\n done()\n }\n\n const onLeave = (el: Element, done: () => void) => {\n const element = el as HTMLElement\n\n // trigger leave animation\n requestAnimationFrame(() => {\n element.style.opacity = '0'\n element.style.transform = 'translateY(5px)'\n })\n\n // Wait for the animation to finish (done() exectution extracts the element from the DOM)\n setTimeout(done, props.animationDurationInMs)\n }\n\n // Changing the request will trigger the appear animation, so we need to reset the\n // style after it finishes\n x.on('SearchRequestChanged', false).subscribe(() => {\n resetTransitionStyle([])\n })\n\n onBeforeUnmount(() => {\n x.emit('RelatedPromptsUnmounted')\n })\n\n return {\n onSelect,\n onBeforeEnter,\n onEnter,\n onLeave,\n selectedPromptIndex,\n visibleRelatedPrompts,\n listItems,\n isAnimating,\n x,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-related-prompts-tag-list-scroll-container {\n height: 100%;\n position: relative;\n}\n.x-related-prompts-tag-list {\n display: flex;\n gap: 16px;\n min-width: 100%;\n width: 100%;\n}\n.x-related-prompts-tag-list-item {\n height: 100%;\n flex-shrink: 0;\n}\n</style>\n"],"names":["DisplayEmitter"],"mappings":";;;;;;;;;;;;;;;;;;;AA6FA;;;;;;;AAOE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,uBAAuB;IAC7B,OAAO,EAAE,qBAAqB,CAAC,IAAI;AACnC,IAAA,UAAU,EAAE,kBAAEA,WAAc,EAAE,aAAa,EAAE,YAAW,EAAG;AAC3D,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,WAAW,EAAE,MAAM;AACnB;;;;AAIE;QACF,WAAW,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM;AAC7C;;;;AAIE;AACF,QAAA,oBAAoB,EAAE,MAAM;AAC5B;;;;AAIE;AACF,QAAA,QAAQ,EAAE,MAAM;AAChB;;;;;AAKE;AACF,QAAA,SAAS,EAAE,KAA2B;AACtC;;;;AAIE;AACF,QAAA,qBAAqB,EAAE;AACrB,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,GAAG;AACb,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,CAAA,GAAI,KAAK,EAAC,CAAA;AAChB,QAAA,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,mBAAoB,EAAA,GAAI,QAAQ,CAAC,gBAAgB,CAAA,CAAA;AAEzF,QAAA,MAAM,oBAAqB,GAAE,GAAG,CAAgB,IAAI,CAAA,CAAA;QACpD,MAAM,kBAAkB,GAA2B,EAAC,CAAA;AACpD,QAAA,MAAM,WAAU,GAAI,GAAG,CAAC,KAAK,CAAA,CAAA;AAC7B,QAAA,MAAM,SAAU,GAAE,GA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AAO;YACP,mBAAmB;YACnB,qBAAqB;YACrB,SAAS;YACT,WAAW;YACX,CAAC;SACH,CAAA;KACD;AACF,CAAA,CAAA;;;;"}
|
|
@@ -87,6 +87,7 @@ import '../../../components/result/result-variant-selector.vue3.js';
|
|
|
87
87
|
import '../../../components/result/result-variants-provider.vue.js';
|
|
88
88
|
import '../../../components/scroll/base-scroll.vue2.js';
|
|
89
89
|
import '@empathyco/x-utils';
|
|
90
|
+
import 'vuex';
|
|
90
91
|
import '@vue/devtools-api';
|
|
91
92
|
import '../../../plugins/devtools/timeline.devtools.js';
|
|
92
93
|
import 'rxjs/operators';
|
|
@@ -94,7 +95,6 @@ import 'rxjs';
|
|
|
94
95
|
import '../../../plugins/devtools/colors.utils.js';
|
|
95
96
|
import '../../../plugins/x-bus.js';
|
|
96
97
|
import '../../../plugins/x-plugin.js';
|
|
97
|
-
import 'vuex';
|
|
98
98
|
import '../../../components/sliding-panel.vue2.js';
|
|
99
99
|
import '../../../components/sliding-panel.vue3.js';
|
|
100
100
|
import '../../../components/snippet-callbacks.vue2.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineComponent, computed } from 'vue';
|
|
2
2
|
import BaseSuggestions from '../../../components/suggestions/base-suggestions.vue.js';
|
|
3
3
|
import '../../../composables/create-use-device.js';
|
|
4
|
+
import 'vuex';
|
|
4
5
|
import '@vue/devtools-api';
|
|
5
6
|
import '../../../plugins/devtools/timeline.devtools.js';
|
|
6
7
|
import '@empathyco/x-utils';
|
|
@@ -9,7 +10,6 @@ import 'rxjs';
|
|
|
9
10
|
import '../../../plugins/devtools/colors.utils.js';
|
|
10
11
|
import '../../../plugins/x-bus.js';
|
|
11
12
|
import '../../../plugins/x-plugin.js';
|
|
12
|
-
import 'vuex';
|
|
13
13
|
import '@vueuse/core';
|
|
14
14
|
import { useState } from '../../../composables/use-state.js';
|
|
15
15
|
import { semanticQueriesXModule } from '../x-module.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empathyco/x-components",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.97",
|
|
4
4
|
"description": "Empathy X Components",
|
|
5
5
|
"author": "Empathy Systems Corporation S.L.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"@badeball/cypress-cucumber-preprocessor": "22.0.1",
|
|
97
97
|
"@bahmutov/cypress-esbuild-preprocessor": "2.2.0",
|
|
98
98
|
"@cucumber/messages": "27.2.0",
|
|
99
|
-
"@empathyco/x-tailwindcss": "^2.0.0-alpha.
|
|
99
|
+
"@empathyco/x-tailwindcss": "^2.0.0-alpha.10",
|
|
100
100
|
"@microsoft/api-documenter": "7.23.0",
|
|
101
101
|
"@microsoft/api-extractor": "7.39.0",
|
|
102
102
|
"@testing-library/jest-dom": "5.17.0",
|
|
@@ -142,5 +142,5 @@
|
|
|
142
142
|
"access": "public",
|
|
143
143
|
"directory": "dist"
|
|
144
144
|
},
|
|
145
|
-
"gitHead": "
|
|
145
|
+
"gitHead": "4254d8abf010b2b3c96486ce878bef0fea885510"
|
|
146
146
|
}
|
|
@@ -115,7 +115,6 @@ import { default as TrendingIcon } from './trending.vue';
|
|
|
115
115
|
import { default as TrendingTinyIcon } from './trending-tiny.vue';
|
|
116
116
|
import { default as UserFilledIcon } from './user-filled.vue';
|
|
117
117
|
import { default as UserIcon } from './user.vue';
|
|
118
|
-
import { useStore } from 'vuex';
|
|
119
118
|
import { VNode } from 'vue';
|
|
120
119
|
import type Vue from 'vue';
|
|
121
120
|
import type { WatchOptions } from 'vue';
|
|
@@ -8833,8 +8832,6 @@ export function useState<Module extends XModuleName, State = ExtractState<Module
|
|
|
8833
8832
|
[P in keyof State]: ComputedRef<State[P]>;
|
|
8834
8833
|
};
|
|
8835
8834
|
|
|
8836
|
-
export { useStore }
|
|
8837
|
-
|
|
8838
8835
|
// @public
|
|
8839
8836
|
export function useXBus(): {
|
|
8840
8837
|
on: <Event_1 extends keyof XEventsTypes, Metadata extends boolean>(event: Event_1, withMetadata: Metadata) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
|
|
@@ -4,19 +4,39 @@ import type { PropType } from 'vue';
|
|
|
4
4
|
* This component shows a suggested related prompt.
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: import("vue").DefineComponent<{
|
|
7
|
+
/**
|
|
8
|
+
* The related prompt to render.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
7
12
|
relatedPrompt: {
|
|
8
13
|
type: PropType<RelatedPrompt>;
|
|
9
14
|
required: true;
|
|
10
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Indicates if the related prompt is selected.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
11
21
|
selected: {
|
|
12
22
|
type: BooleanConstructor;
|
|
13
23
|
default: boolean;
|
|
14
24
|
};
|
|
15
25
|
}, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
26
|
+
/**
|
|
27
|
+
* The related prompt to render.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
16
31
|
relatedPrompt: {
|
|
17
32
|
type: PropType<RelatedPrompt>;
|
|
18
33
|
required: true;
|
|
19
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Indicates if the related prompt is selected.
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
20
40
|
selected: {
|
|
21
41
|
type: BooleanConstructor;
|
|
22
42
|
default: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"related-prompt.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../../../src/x-modules/related-prompts/components/related-prompt.vue?vue&type=script&lang.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAMnC;;GAEG
|
|
1
|
+
{"version":3,"file":"related-prompt.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../../../src/x-modules/related-prompts/components/related-prompt.vue?vue&type=script&lang.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAMnC;;GAEG;;IAWC;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;;IAbH;;;;OAIG;;;;;IAKH;;;;OAIG;;;;;;;;AAvBP,wBA6BE"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Function which returns the `$store` object from the current component instance.
|
|
3
|
-
*
|
|
4
|
-
* @returns The `$store` object from the current component instance.
|
|
5
|
-
* @deprecated Use `useStore` from `vuex` instead.
|
|
6
|
-
*
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
export { useStore } from 'vuex';
|
|
10
|
-
//# sourceMappingURL=use-store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-store.d.ts","sourceRoot":"","sources":["../../../src/composables/use-store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA"}
|