@empathyco/x-components 6.0.0-alpha.36 → 6.0.0-alpha.37
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 +9 -0
- package/design-system/deprecated-full-theme.css +366 -366
- package/docs/API-reference/api/x-components.md +3 -2
- package/docs/API-reference/api/x-components.relatedprompt.md +4 -25
- package/docs/API-reference/api/x-components.relatedpromptstaglist.md +39 -6
- package/docs/API-reference/api/x-components.typingoptions.md +22 -0
- package/docs/API-reference/api/x-components.typingoptions.speed.md +13 -0
- package/docs/API-reference/api/x-components.typingoptions.targetattr.md +18 -0
- package/docs/API-reference/api/x-components.typingoptions.text.md +13 -0
- package/docs/API-reference/components/related-prompts/x-components.related-prompt.md +4 -14
- package/docs/API-reference/components/related-prompts/x-components.related-prompts-tag-list.md +16 -10
- package/js/directives/typing.js +52 -0
- package/js/directives/typing.js.map +1 -0
- package/js/x-modules/related-prompts/components/related-prompt.vue.js +16 -43
- 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 +5 -36
- package/js/x-modules/related-prompts/components/related-prompt.vue2.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompt.vue3.js +7 -0
- package/js/x-modules/related-prompts/components/related-prompt.vue3.js.map +1 -0
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue.js +62 -68
- 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 +174 -21
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue3.js +1 -1
- package/package.json +2 -2
- package/report/x-components.api.json +342 -54
- package/report/x-components.api.md +48 -31
- package/types/directives/index.d.ts +1 -0
- package/types/directives/index.d.ts.map +1 -1
- package/types/directives/typing.d.ts +30 -0
- package/types/directives/typing.d.ts.map +1 -0
- package/types/views/adapter.d.ts.map +1 -1
- package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts +4 -27
- package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts.map +1 -1
- package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts +86 -6
- package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts.map +1 -1
|
@@ -250,6 +250,7 @@ X-Components is a library usable everywhere not only for search experiences.
|
|
|
250
250
|
| [TaggingXEvents](./x-components.taggingxevents.md) | Dictionary of the events of Tagging XModule, where each key is the event name, and the value is the event payload type or <code>void</code> if it has no payload. |
|
|
251
251
|
| [ThrottleFunction](./x-components.throttlefunction.md) | The type returned by the [throttle()](./x-components.throttle.md) function. Basically is the function the [throttle()](./x-components.throttle.md) receives but throttled. |
|
|
252
252
|
| [TimedWireOperatorOptions](./x-components.timedwireoperatoroptions.md) | Options for wire operators that delay subscribers. |
|
|
253
|
+
| [TypingOptions](./x-components.typingoptions.md) | TypingOptions interface. |
|
|
253
254
|
| [UrlActions](./x-components.urlactions.md) | URL store actions. |
|
|
254
255
|
| [UrlGetters](./x-components.urlgetters.md) | URL store getters. |
|
|
255
256
|
| [UrlMutations](./x-components.urlmutations.md) | URL store mutations. |
|
|
@@ -485,10 +486,10 @@ X-Components is a library usable everywhere not only for search experiences.
|
|
|
485
486
|
| [Redirection](./x-components.redirection.md) | A redirection is a component that sends the user to a link in the website. It is helpful when there are queries like <code>help</code>, <code>shipping costs</code>, <code>my account</code>, where a link to a section in the website will be more helpful than the set of results returned. |
|
|
486
487
|
| [refreshHistoryQueriesSession](./x-components.refreshhistoryqueriessession.md) | Triggers a session refresh, extending its validity for the time configured in the [HistoryQueriesConfig.sessionTTLInMs](./x-components.historyqueriesconfig.sessionttlinms.md)<!-- -->. |
|
|
487
488
|
| [refreshSession](./x-components.refreshsession.md) | Default implementation for the [HistoryQueriesActions.refreshSession()](./x-components.historyqueriesactions.refreshsession.md)<!-- -->. |
|
|
488
|
-
| [RelatedPrompt](./x-components.relatedprompt.md) |
|
|
489
|
+
| [RelatedPrompt](./x-components.relatedprompt.md) | This component shows a suggested related prompt. |
|
|
489
490
|
| [relatedPromptRequest](./x-components.relatedpromptrequest.md) | Default implementation for the [RelatedPromptsGetters.request](./x-components.relatedpromptsgetters.request.md) getter. |
|
|
490
491
|
| [RelatedPromptsList](./x-components.relatedpromptslist.md) | Component that inserts groups of related prompts in different positions of the injected search items list, based on the provided configuration. |
|
|
491
|
-
| [RelatedPromptsTagList](./x-components.relatedpromptstaglist.md) |
|
|
492
|
+
| [RelatedPromptsTagList](./x-components.relatedpromptstaglist.md) | <p>This component shows the list of <code>RelatedPrompts</code> components.</p><p>If the default slot is reimplemented in the consumer, <code>onSelect</code> function will be necessary to handle the selection of the related prompt and to trigger the stagger-fade-slide animation.</p> |
|
|
492
493
|
| [relatedPromptsXModule](./x-components.relatedpromptsxmodule.md) | Related Prompts [XModule](./x-components.xmodule.md) implementation. This module is auto-registered as soon as you import any component from the <code>related-prompts</code> entry point. |
|
|
493
494
|
| [RelatedTag](./x-components.relatedtag.md) | This component renders a related tag for a query. A related tag is a descriptive keyword related to the current query to fine-tune the search. For example, if you are searching for \*lego\*, a related tag could be \*city\*, refining the search with \*lego city\*. |
|
|
494
495
|
| [relatedTags](./x-components.relatedtags.md) | Default implementation for the [RelatedTagsGetters.relatedTags](./x-components.relatedtagsgetters.relatedtags.md) getter. |
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
This component shows a suggested related prompt.
|
|
8
8
|
|
|
9
|
-
It provides a slot to customize the related prompt button information.
|
|
10
|
-
|
|
11
9
|
**Signature:**
|
|
12
10
|
|
|
13
11
|
```typescript
|
|
@@ -16,39 +14,20 @@ _default: import("vue").DefineComponent<{
|
|
|
16
14
|
type: PropType<RelatedPrompt>;
|
|
17
15
|
required: true;
|
|
18
16
|
};
|
|
19
|
-
|
|
20
|
-
type: BooleanConstructor;
|
|
21
|
-
default: boolean;
|
|
22
|
-
};
|
|
23
|
-
isSelected: {
|
|
17
|
+
selected: {
|
|
24
18
|
type: BooleanConstructor;
|
|
25
19
|
default: boolean;
|
|
26
20
|
};
|
|
27
|
-
|
|
28
|
-
type: NumberConstructor;
|
|
29
|
-
required: true;
|
|
30
|
-
};
|
|
31
|
-
}, {
|
|
32
|
-
toggleSuggestion: (index: number) => void;
|
|
33
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
21
|
+
}, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
34
22
|
relatedPrompt: {
|
|
35
23
|
type: PropType<RelatedPrompt>;
|
|
36
24
|
required: true;
|
|
37
25
|
};
|
|
38
|
-
|
|
26
|
+
selected: {
|
|
39
27
|
type: BooleanConstructor;
|
|
40
28
|
default: boolean;
|
|
41
29
|
};
|
|
42
|
-
isSelected: {
|
|
43
|
-
type: BooleanConstructor;
|
|
44
|
-
default: boolean;
|
|
45
|
-
};
|
|
46
|
-
index: {
|
|
47
|
-
type: NumberConstructor;
|
|
48
|
-
required: true;
|
|
49
|
-
};
|
|
50
30
|
}>>, {
|
|
51
|
-
|
|
52
|
-
isSelected: boolean;
|
|
31
|
+
selected: boolean;
|
|
53
32
|
}, {}>
|
|
54
33
|
```
|
|
@@ -4,19 +4,52 @@
|
|
|
4
4
|
|
|
5
5
|
## RelatedPromptsTagList variable
|
|
6
6
|
|
|
7
|
+
This component shows the list of `RelatedPrompts` components.
|
|
8
|
+
|
|
9
|
+
If the default slot is reimplemented in the consumer, `onSelect` function will be necessary to handle the selection of the related prompt and to trigger the stagger-fade-slide animation.
|
|
10
|
+
|
|
7
11
|
**Signature:**
|
|
8
12
|
|
|
9
13
|
```typescript
|
|
10
14
|
_default: import("vue").DefineComponent<{
|
|
11
15
|
buttonClass: StringConstructor;
|
|
16
|
+
tagClass: StringConstructor;
|
|
17
|
+
tagColors: PropType<string[]>;
|
|
18
|
+
animationDurationInMs: {
|
|
19
|
+
type: NumberConstructor;
|
|
20
|
+
default: number;
|
|
21
|
+
};
|
|
12
22
|
}, {
|
|
13
|
-
arePromptsVisible: import("vue").Ref<boolean>;
|
|
14
|
-
hidePrompt: (index: number) => boolean;
|
|
15
23
|
isSelected: (index: number) => boolean;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
onSelect: (selectedIndex: number) => void;
|
|
25
|
+
onBeforeEnter: (el: Element) => void;
|
|
26
|
+
onEnter: (el: Element, done: () => void) => void;
|
|
27
|
+
onLeave: (el: Element, done: () => void) => void;
|
|
28
|
+
selectedPromptIndex: import("vue").ComputedRef<any>;
|
|
29
|
+
visibleRelatedPrompts: import("vue").ComputedRef<{
|
|
30
|
+
index: number;
|
|
31
|
+
nextQueries: string[];
|
|
32
|
+
suggestionText: string;
|
|
33
|
+
type: string;
|
|
34
|
+
modelName: "RelatedPrompt";
|
|
35
|
+
}[]>;
|
|
36
|
+
listItems: import("vue").Ref<HTMLElement[]>;
|
|
37
|
+
isAnimating: import("vue").Ref<boolean>;
|
|
38
|
+
x: import("../../../composables").UseAliasAPI & {
|
|
39
|
+
on: <Event_1 extends keyof import("../../..").XEventsTypes, Metadata extends boolean>(event: Event_1, withMetadata: Metadata) => {
|
|
40
|
+
subscribe: (callback: (payload: Metadata extends true ? import("@empathyco/x-bus").SubjectPayload<import("@empathyco/x-bus").EventPayload<import("../../..").XEventsTypes, Event_1>, import("../../..").WireMetadata> : import("@empathyco/x-bus").EventPayload<import("../../..").XEventsTypes, Event_1>) => void) => void;
|
|
41
|
+
};
|
|
42
|
+
emit: <Event_2 extends keyof import("../../..").XEventsTypes>(event: Event_2, payload?: import("../../..").XEventPayload<Event_2> | undefined, metadata?: Omit<import("../../..").WireMetadata, "moduleName">) => Promise<import("@empathyco/x-bus").EmittedData<import("../../..").XEventsTypes, Event_2, import("../../..").WireMetadata>>;
|
|
43
|
+
};
|
|
19
44
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
20
45
|
buttonClass: StringConstructor;
|
|
21
|
-
|
|
46
|
+
tagClass: StringConstructor;
|
|
47
|
+
tagColors: PropType<string[]>;
|
|
48
|
+
animationDurationInMs: {
|
|
49
|
+
type: NumberConstructor;
|
|
50
|
+
default: number;
|
|
51
|
+
};
|
|
52
|
+
}>>, {
|
|
53
|
+
animationDurationInMs: number;
|
|
54
|
+
}, {}>
|
|
22
55
|
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [TypingOptions](./x-components.typingoptions.md)
|
|
4
|
+
|
|
5
|
+
## TypingOptions interface
|
|
6
|
+
|
|
7
|
+
TypingOptions interface.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export interface TypingOptions
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
| Property | Modifiers | Type | Description |
|
|
18
|
+
| --- | --- | --- | --- |
|
|
19
|
+
| [speed?](./x-components.typingoptions.speed.md) | | number | _(Optional)_ The typing speed in milliseconds per character. |
|
|
20
|
+
| [targetAttr?](./x-components.typingoptions.targetattr.md) | | string | _(Optional)_ The attribute of the HTML element where the typed text will be placed. If not specified, the text will be set as content (innerHTML). |
|
|
21
|
+
| [text](./x-components.typingoptions.text.md) | | string | The text (plain or html) that will be typed into the target element. |
|
|
22
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [TypingOptions](./x-components.typingoptions.md) > [speed](./x-components.typingoptions.speed.md)
|
|
4
|
+
|
|
5
|
+
## TypingOptions.speed property
|
|
6
|
+
|
|
7
|
+
The typing speed in milliseconds per character.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
speed?: number;
|
|
13
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [TypingOptions](./x-components.typingoptions.md) > [targetAttr](./x-components.typingoptions.targetattr.md)
|
|
4
|
+
|
|
5
|
+
## TypingOptions.targetAttr property
|
|
6
|
+
|
|
7
|
+
The attribute of the HTML element where the typed text will be placed. If not specified, the text will be set as content (innerHTML).
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
targetAttr?: string;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
|
|
17
|
+
'placeholder'
|
|
18
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [TypingOptions](./x-components.typingoptions.md) > [text](./x-components.typingoptions.text.md)
|
|
4
|
+
|
|
5
|
+
## TypingOptions.text property
|
|
6
|
+
|
|
7
|
+
The text (plain or html) that will be typed into the target element.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
text: string;
|
|
13
|
+
```
|
|
@@ -8,19 +8,9 @@ title: RelatedPrompt
|
|
|
8
8
|
|
|
9
9
|
This component shows a suggested related prompt.
|
|
10
10
|
|
|
11
|
-
It provides a slot to customize the related prompt button information.
|
|
12
|
-
|
|
13
11
|
## Props
|
|
14
12
|
|
|
15
|
-
| Name
|
|
16
|
-
|
|
|
17
|
-
| <code>relatedPrompt</code>
|
|
18
|
-
| <code>
|
|
19
|
-
| <code>isSelected</code> | | <code>boolean</code> | <code>false</code> |
|
|
20
|
-
| <code>index</code> | | <code>number</code> | <code></code> |
|
|
21
|
-
|
|
22
|
-
## Slots
|
|
23
|
-
|
|
24
|
-
| Name | Description | Bindings<br />(name - type - description) |
|
|
25
|
-
| --------------------------------------- | ----------- | ----------------------------------------- |
|
|
26
|
-
| <code>related-prompt-button-info</code> | | None |
|
|
13
|
+
| Name | Description | Type | Default |
|
|
14
|
+
| -------------------------- | ----------- | -------------------------- | ------------------ |
|
|
15
|
+
| <code>relatedPrompt</code> | | <code>RelatedPrompt</code> | <code></code> |
|
|
16
|
+
| <code>selected</code> | | <code>boolean</code> | <code>false</code> |
|
package/docs/API-reference/components/related-prompts/x-components.related-prompts-tag-list.md
CHANGED
|
@@ -6,18 +6,24 @@ title: RelatedPromptsTagList
|
|
|
6
6
|
|
|
7
7
|
# RelatedPromptsTagList
|
|
8
8
|
|
|
9
|
+
This component shows the list of `RelatedPrompts` components.
|
|
10
|
+
|
|
11
|
+
If the default slot is reimplemented in the consumer, `onSelect` function will be necessary to
|
|
12
|
+
handle the selection of the related prompt and to trigger the stagger-fade-slide animation.
|
|
13
|
+
|
|
9
14
|
## Props
|
|
10
15
|
|
|
11
|
-
| Name
|
|
12
|
-
|
|
|
13
|
-
| <code>buttonClass</code> |
|
|
16
|
+
| Name | Description | Type | Default |
|
|
17
|
+
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ---------------- |
|
|
18
|
+
| <code>buttonClass</code> | The CSS class for the left and right button of the sliding panel. | <code>string</code> | <code></code> |
|
|
19
|
+
| <code>tagClass</code> | The CSS class for all the related prompt wrapper elements. | <code>string</code> | <code></code> |
|
|
20
|
+
| <code>tagColors</code> | Array of colors to apply to the related prompts. It will be applied to tag<br />elements cyclically according to their index in the nex way: `tagColors[index % tagColors.length]`. | <code>string[]</code> | <code></code> |
|
|
21
|
+
| <code>animationDurationInMs</code> | The duration of the total animation in milliseconds. | <code>number</code> | <code>700</code> |
|
|
14
22
|
|
|
15
23
|
## Slots
|
|
16
24
|
|
|
17
|
-
| Name | Description
|
|
18
|
-
| --------------------------------------- |
|
|
19
|
-
| <code>
|
|
20
|
-
| <code>
|
|
21
|
-
| <code>sliding-panel-
|
|
22
|
-
| <code>related-prompt-button</code> | | <br /><br /><br /> |
|
|
23
|
-
| <code>sliding-panel-right-button</code> | | None |
|
|
25
|
+
| Name | Description | Bindings<br />(name - type - description) |
|
|
26
|
+
| --------------------------------------- | ------------------------------------------------------------------ | ----------------------------------------- |
|
|
27
|
+
| <code>sliding-panel-left-button</code> | The button to be displayed on the left side of the sliding panel. | None |
|
|
28
|
+
| <code>default</code> | - The slot to render related prompt information. | <br /><br /> |
|
|
29
|
+
| <code>sliding-panel-right-button</code> | The button to be displayed on the right side of the sliding panel. | None |
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const typingDirective = {
|
|
2
|
+
mounted(el, binding) {
|
|
3
|
+
execute(el, binding.value);
|
|
4
|
+
},
|
|
5
|
+
updated(el, binding) {
|
|
6
|
+
if (binding.value.text !== binding.oldValue?.text) {
|
|
7
|
+
clearTimeout(el.__timeoutId);
|
|
8
|
+
execute(el, binding.value);
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
unmounted(el) {
|
|
12
|
+
clearTimeout(el.__timeoutId);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Execute a typing animation in an HTML element.
|
|
17
|
+
*
|
|
18
|
+
* @param el - The HTML element where the typing animation will be displayed.
|
|
19
|
+
* @param options - Options for the behavior of the animation.
|
|
20
|
+
*/
|
|
21
|
+
function execute(el, options) {
|
|
22
|
+
const { text, speed = 1, targetAttr = '' } = options;
|
|
23
|
+
if (!text) {
|
|
24
|
+
console.error('v-typing: "text" is required.');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
let index = 0;
|
|
28
|
+
const updateContent = (value) => {
|
|
29
|
+
if (targetAttr) {
|
|
30
|
+
el.setAttribute(targetAttr, value);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
el.innerHTML = value;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const type = () => {
|
|
37
|
+
if (index < text.length) {
|
|
38
|
+
updateContent(text.slice(0, index + 1));
|
|
39
|
+
index++;
|
|
40
|
+
el.__timeoutId = setTimeout(type, speed);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
updateContent(text);
|
|
44
|
+
clearTimeout(el.__timeoutId);
|
|
45
|
+
el.__timeoutId = undefined;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
type();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { typingDirective as default };
|
|
52
|
+
//# sourceMappingURL=typing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typing.js","sources":["../../../src/directives/typing.ts"],"sourcesContent":["import type { Directive } from 'vue';\n\n/**\n * TypingOptions interface.\n *\n * @public\n */\nexport interface TypingOptions {\n /**\n * The text (plain or html) that will be typed into the target element.\n */\n text: string;\n /**\n * The typing speed in milliseconds per character.\n *\n */\n speed?: number;\n /**\n * The attribute of the HTML element where the typed text will be placed.\n * If not specified, the text will be set as content (innerHTML).\n *\n * @example 'placeholder'\n */\n targetAttr?: string;\n}\n\ninterface TypingHTMLElement extends HTMLElement {\n __timeoutId?: number;\n}\n\nconst typingDirective: Directive<TypingHTMLElement, TypingOptions> = {\n mounted(el, binding) {\n execute(el, binding.value);\n },\n\n updated(el, binding) {\n if (binding.value.text !== binding.oldValue?.text) {\n clearTimeout(el.__timeoutId);\n execute(el, binding.value);\n }\n },\n\n unmounted(el) {\n clearTimeout(el.__timeoutId);\n }\n};\n\n/**\n * Execute a typing animation in an HTML element.\n *\n * @param el - The HTML element where the typing animation will be displayed.\n * @param options - Options for the behavior of the animation.\n */\nfunction execute(el: TypingHTMLElement, options: TypingOptions) {\n const { text, speed = 1, targetAttr = '' } = options;\n\n if (!text) {\n console.error('v-typing: \"text\" is required.');\n return;\n }\n\n let index = 0;\n\n const updateContent = (value: string) => {\n if (targetAttr) {\n el.setAttribute(targetAttr, value);\n } else {\n el.innerHTML = value;\n }\n };\n\n const type = () => {\n if (index < text.length) {\n updateContent(text.slice(0, index + 1));\n index++;\n el.__timeoutId = setTimeout(type, speed) as unknown as number;\n } else {\n updateContent(text);\n clearTimeout(el.__timeoutId);\n el.__timeoutId = undefined;\n }\n };\n\n type();\n}\n\nexport default typingDirective;\n"],"names":[],"mappings":"AA8BA,MAAM,eAAe,GAAgD;IACnE,OAAO,CAAC,EAAE,EAAE,OAAO,EAAA;AACjB,QAAA,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;KAC5B;IAED,OAAO,CAAC,EAAE,EAAE,OAAO,EAAA;QACjB,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE;AACjD,YAAA,YAAY,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC;AAC7B,YAAA,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;AAC5B,SAAA;KACF;AAED,IAAA,SAAS,CAAC,EAAE,EAAA;AACV,QAAA,YAAY,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC;KAC9B;EACD;AAEF;;;;;AAKG;AACH,SAAS,OAAO,CAAC,EAAqB,EAAE,OAAsB,EAAA;AAC5D,IAAA,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;IAErD,IAAI,CAAC,IAAI,EAAE;AACT,QAAA,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAC/C,OAAO;AACR,KAAA;IAED,IAAI,KAAK,GAAG,CAAC,CAAC;AAEd,IAAA,MAAM,aAAa,GAAG,CAAC,KAAa,KAAI;AACtC,QAAA,IAAI,UAAU,EAAE;AACd,YAAA,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AACpC,SAAA;AAAM,aAAA;AACL,YAAA,EAAE,CAAC,SAAS,GAAG,KAAK,CAAC;AACtB,SAAA;AACH,KAAC,CAAC;IAEF,MAAM,IAAI,GAAG,MAAK;AAChB,QAAA,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE;AACvB,YAAA,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;AACxC,YAAA,KAAK,EAAE,CAAC;YACR,EAAE,CAAC,WAAW,GAAG,UAAU,CAAC,IAAI,EAAE,KAAK,CAAsB,CAAC;AAC/D,SAAA;AAAM,aAAA;YACL,aAAa,CAAC,IAAI,CAAC,CAAC;AACpB,YAAA,YAAY,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC;AAC7B,YAAA,EAAE,CAAC,WAAW,GAAG,SAAS,CAAC;AAC5B,SAAA;AACH,KAAC,CAAC;AAEF,IAAA,IAAI,EAAE,CAAC;AACT;;;;"}
|
|
@@ -1,50 +1,23 @@
|
|
|
1
1
|
import _sfc_main from './related-prompt.vue2.js';
|
|
2
|
-
import {
|
|
2
|
+
import { resolveDirective, openBlock, createElementBlock, withDirectives, createElementVNode, createBlock, resolveDynamicComponent } from 'vue';
|
|
3
|
+
import './related-prompt.vue3.js';
|
|
3
4
|
import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.js';
|
|
4
5
|
|
|
5
|
-
const _hoisted_1 = { class: "x-related-
|
|
6
|
+
const _hoisted_1 = { class: "x-related-prompt" };
|
|
6
7
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
renderSlot(_ctx.$slots, "related-prompt-button-info", {}, () => [
|
|
21
|
-
createElementVNode("div", _hoisted_1, [
|
|
22
|
-
createElementVNode(
|
|
23
|
-
"span",
|
|
24
|
-
{
|
|
25
|
-
class: normalizeClass(["x-typewritter-initial", [{ "x-typewritter-animation": _ctx.isPromptVisible }]]),
|
|
26
|
-
style: normalizeStyle({
|
|
27
|
-
animationDelay: `${_ctx.index * 0.4 + 0.05}s`,
|
|
28
|
-
"--suggestion-text-length": _ctx.relatedPrompt.suggestionText.length
|
|
29
|
-
})
|
|
30
|
-
},
|
|
31
|
-
toDisplayString(_ctx.relatedPrompt.suggestionText),
|
|
32
|
-
7
|
|
33
|
-
/* TEXT, CLASS, STYLE */
|
|
34
|
-
)
|
|
35
|
-
]),
|
|
36
|
-
_ctx.isSelected ? (openBlock(), createBlock(_component_CrossTinyIcon, {
|
|
37
|
-
key: 0,
|
|
38
|
-
class: "x-icon-lg"
|
|
39
|
-
})) : (openBlock(), createBlock(_component_PlusIcon, {
|
|
40
|
-
key: 1,
|
|
41
|
-
class: "x-icon-lg"
|
|
42
|
-
}))
|
|
43
|
-
])
|
|
44
|
-
],
|
|
45
|
-
34
|
|
46
|
-
/* CLASS, NEED_HYDRATION */
|
|
47
|
-
);
|
|
8
|
+
const _directive_typing = resolveDirective("typing");
|
|
9
|
+
return openBlock(), createElementBlock("button", _hoisted_1, [
|
|
10
|
+
withDirectives(createElementVNode(
|
|
11
|
+
"span",
|
|
12
|
+
null,
|
|
13
|
+
null,
|
|
14
|
+
512
|
|
15
|
+
/* NEED_PATCH */
|
|
16
|
+
), [
|
|
17
|
+
[_directive_typing, { text: _ctx.relatedPrompt.suggestionText, speed: 50 }]
|
|
18
|
+
]),
|
|
19
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.selected ? "CrossTinyIcon" : "PlusIcon"), { class: "x-icon-lg x-related-prompt-icon" }))
|
|
20
|
+
]);
|
|
48
21
|
}
|
|
49
22
|
var RelatedPrompt = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
50
23
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"related-prompt.vue.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompt.vue"],"sourcesContent":["<template>\n <
|
|
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 <span v-typing=\"{ text: relatedPrompt.suggestionText, speed: 50 }\" />\n <component\n :is=\"selected ? 'CrossTinyIcon' : 'PlusIcon'\"\n class=\"x-icon-lg x-related-prompt-icon\"\n />\n </button>\n</template>\n<script lang=\"ts\">\n import { defineComponent, PropType } from 'vue';\n import { RelatedPrompt } from '@empathyco/x-types';\n import CrossTinyIcon from '../../../components/icons/cross-tiny.vue';\n import PlusIcon from '../../../components/icons/plus.vue';\n import vTyping from '../../../directives/typing';\n\n /**\n * This component shows a suggested related prompt.\n */\n export default defineComponent({\n name: 'RelatedPrompt',\n directives: {\n typing: vTyping\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<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 height: 100%;\n width: 100%;\n }\n .x-related-prompt-icon {\n align-self: start;\n }\n</style>\n"],"names":["_resolveDirective","relatedPrompt","_withDirectives","_createElementVNode","selected"],"mappings":";;;;;;;AACE,EAAA,MAAA,iBAAA,GAAAA,gBAAA,CAMS,QANT,CAAA,CAAA;yCAC0BC,QAAc,EAAA,UAAA,EAAA;AAAA,IAAAC,cAAA,CAAAC,kBAAA;;;;;;;AACtC,MAAA,CAAA,iBAAA,EAAA,EAAA,IAAA,EAHJ,mCAIWC,KAAQ,EAAA,EAAA,EAAA,CAAA;AAAA,KAAA,CAAA;;;;;;;;"}
|
|
@@ -1,60 +1,29 @@
|
|
|
1
1
|
import { defineComponent } from 'vue';
|
|
2
|
-
import { relatedPromptsXModule } from '../x-module.js';
|
|
3
2
|
import CrossTinyIcon from '../../../components/icons/cross-tiny.vue.js';
|
|
4
3
|
import PlusIcon from '../../../components/icons/plus.vue.js';
|
|
5
|
-
import '../../../
|
|
6
|
-
import { use$x } from '../../../composables/use-_x.js';
|
|
7
|
-
import '@vue/devtools-api';
|
|
8
|
-
import '../../../plugins/devtools/timeline.devtools.js';
|
|
9
|
-
import '@empathyco/x-utils';
|
|
10
|
-
import 'rxjs/operators';
|
|
11
|
-
import 'rxjs';
|
|
12
|
-
import '../../../plugins/devtools/colors.utils.js';
|
|
13
|
-
import '../../../plugins/x-bus.js';
|
|
14
|
-
import '../../../plugins/x-plugin.js';
|
|
15
|
-
import 'vuex';
|
|
16
|
-
import '@vueuse/core';
|
|
4
|
+
import typingDirective from '../../../directives/typing.js';
|
|
17
5
|
|
|
18
6
|
/**
|
|
19
7
|
* This component shows a suggested related prompt.
|
|
20
|
-
*
|
|
21
|
-
* It provides a slot to customize the related prompt button information.
|
|
22
|
-
*
|
|
23
|
-
* @public
|
|
24
8
|
*/
|
|
25
9
|
var _sfc_main = defineComponent({
|
|
26
10
|
name: 'RelatedPrompt',
|
|
11
|
+
directives: {
|
|
12
|
+
typing: typingDirective
|
|
13
|
+
},
|
|
27
14
|
components: {
|
|
28
15
|
CrossTinyIcon,
|
|
29
16
|
PlusIcon
|
|
30
17
|
},
|
|
31
|
-
xModule: relatedPromptsXModule.name,
|
|
32
18
|
props: {
|
|
33
19
|
relatedPrompt: {
|
|
34
20
|
type: Object,
|
|
35
21
|
required: true
|
|
36
22
|
},
|
|
37
|
-
|
|
38
|
-
type: Boolean,
|
|
39
|
-
default: false
|
|
40
|
-
},
|
|
41
|
-
isSelected: {
|
|
23
|
+
selected: {
|
|
42
24
|
type: Boolean,
|
|
43
25
|
default: false
|
|
44
|
-
},
|
|
45
|
-
index: {
|
|
46
|
-
type: Number,
|
|
47
|
-
required: true
|
|
48
26
|
}
|
|
49
|
-
},
|
|
50
|
-
setup() {
|
|
51
|
-
const x = use$x();
|
|
52
|
-
const toggleSuggestion = (index) => {
|
|
53
|
-
x.emit('UserSelectedARelatedPrompt', index);
|
|
54
|
-
};
|
|
55
|
-
return {
|
|
56
|
-
toggleSuggestion
|
|
57
|
-
};
|
|
58
27
|
}
|
|
59
28
|
});
|
|
60
29
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"related-prompt.vue2.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompt.vue"],"sourcesContent":["<template>\n <
|
|
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 <span v-typing=\"{ text: relatedPrompt.suggestionText, speed: 50 }\" />\n <component\n :is=\"selected ? 'CrossTinyIcon' : 'PlusIcon'\"\n class=\"x-icon-lg x-related-prompt-icon\"\n />\n </button>\n</template>\n<script lang=\"ts\">\n import { defineComponent, PropType } from 'vue';\n import { RelatedPrompt } from '@empathyco/x-types';\n import CrossTinyIcon from '../../../components/icons/cross-tiny.vue';\n import PlusIcon from '../../../components/icons/plus.vue';\n import vTyping from '../../../directives/typing';\n\n /**\n * This component shows a suggested related prompt.\n */\n export default defineComponent({\n name: 'RelatedPrompt',\n directives: {\n typing: vTyping\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<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 height: 100%;\n width: 100%;\n }\n .x-related-prompt-icon {\n align-self: start;\n }\n</style>\n"],"names":["vTyping"],"mappings":";;;;;AAgBE;;AAEE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,eAAe;AACrB,IAAA,UAAU,EAAE;AACV,QAAA,MAAM,EAAEA,eAAM;AACf,KAAA;AACD,IAAA,UAAU,EAAE;QACV,aAAa;QACb,QAAO;AACR,KAAA;AACD,IAAA,KAAK,EAAE;AACL,QAAA,aAAa,EAAE;AACb,YAAA,IAAI,EAAE,MAAiC;AACvC,YAAA,QAAQ,EAAE,IAAG;AACd,SAAA;AACD,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,KAAI;AACf,SAAA;AACF,KAAA;AACD,CAAA,CAAC;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import injectCss from '../../../../tools/inject-css.js';
|
|
2
|
+
|
|
3
|
+
var css = "[dir=ltr] .x-related-prompt{text-align:left}[dir=rtl] .x-related-prompt{text-align:right}.x-related-prompt{align-items:center;display:flex;height:100%;justify-content:space-between;padding:8px;width:100%}.x-related-prompt-icon{align-self:start}";
|
|
4
|
+
injectCss(css);
|
|
5
|
+
|
|
6
|
+
export { css, css as default };
|
|
7
|
+
//# sourceMappingURL=related-prompt.vue3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-prompt.vue3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|