@molecule/app-chatbot-tester-vue 0.0.0-stage → 1.1.0

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.
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Vue composed chatbot-tester sandbox UI: optional bot picker + messages
3
+ * thread + input row + error region.
4
+ *
5
+ * Stateless about transport: the consumer owns the message array, the send
6
+ * handler and (optionally) the bot list + current bot id. The composer text is
7
+ * this component's own state, exactly as in React.
8
+ *
9
+ * Vue counterpart of `@molecule/app-chatbot-tester-react`'s `ChatbotTester` —
10
+ * the same props (React names) and the same DOM for the same input.
11
+ *
12
+ * @module
13
+ */
14
+ import { defineComponent, h, ref, watchEffect, } from 'vue';
15
+ import { getClassMap } from '@molecule/app-ui';
16
+ import { useTranslation } from '@molecule/app-vue';
17
+ import { ChatbotTesterInput } from './ChatbotTesterInput.js';
18
+ import { ChatbotTesterMessages } from './ChatbotTesterMessages.js';
19
+ import { applyReactSelectSelection, hasNodeValue, nodeChildren } from './dom.js';
20
+ /** Full chatbot tester sandbox. */
21
+ export const ChatbotTester = defineComponent({
22
+ name: 'ChatbotTester',
23
+ inheritAttrs: false,
24
+ props: {
25
+ messages: {
26
+ type: Array,
27
+ required: true,
28
+ },
29
+ loading: Boolean,
30
+ onSend: {
31
+ type: Function,
32
+ default: undefined,
33
+ },
34
+ bots: {
35
+ type: Array,
36
+ default: undefined,
37
+ },
38
+ botId: String,
39
+ onBotChange: {
40
+ type: Function,
41
+ default: undefined,
42
+ },
43
+ error: null,
44
+ emptyState: null,
45
+ botPickerLabel: null,
46
+ inputPlaceholder: String,
47
+ sendLabel: String,
48
+ className: String,
49
+ },
50
+ setup(props, { slots }) {
51
+ const cm = getClassMap();
52
+ const { t } = useTranslation();
53
+ const input = ref('');
54
+ const selectEl = ref(null);
55
+ /**
56
+ * The bot list React renders (its `bots ?? []`).
57
+ *
58
+ * @returns The bot options.
59
+ */
60
+ const bots = () => props.bots ?? [];
61
+ /** Re-applies react-dom's controlled-select selection. */
62
+ const applySelection = () => {
63
+ applyReactSelectSelection(selectEl.value, props.botId ?? '');
64
+ };
65
+ // Runs after the picker's options are patched, on mount and on every
66
+ // prop change, as react-dom's controlled `<select>` update does.
67
+ watchEffect(() => {
68
+ void props.bots;
69
+ void props.botId;
70
+ void bots().length;
71
+ applySelection();
72
+ }, { flush: 'post' });
73
+ /** Sends the trimmed composer text and clears the field. */
74
+ const handleSend = async () => {
75
+ const text = input.value.trim();
76
+ if (!text)
77
+ return;
78
+ input.value = '';
79
+ await props.onSend?.(text);
80
+ };
81
+ /**
82
+ * Reports the selected bot, then restores the controlled selection the way
83
+ * react-dom does after a controlled select's change event.
84
+ *
85
+ * @param event - The native change event.
86
+ */
87
+ const handleBotChange = (event) => {
88
+ props.onBotChange?.(event.target.value);
89
+ applySelection();
90
+ };
91
+ /**
92
+ * The picker label: the slot wins, then the prop, then `t()`'s default.
93
+ *
94
+ * @returns The label's children.
95
+ */
96
+ const labelChildren = () => hasNodeValue(slots.botPickerLabel, props.botPickerLabel)
97
+ ? nodeChildren(slots.botPickerLabel, props.botPickerLabel)
98
+ : [t('chatbotTester.label.testBot', undefined, { defaultValue: 'Test bot' })];
99
+ return () => {
100
+ const children = [];
101
+ if (bots().length > 1) {
102
+ children.push(h('div', {
103
+ class: cm.cn(cm.flex({ align: 'center' }), cm.sp('px', 6), cm.sp('py', 3), cm.chatbotTesterBotBar),
104
+ }, [
105
+ h('label', {
106
+ for: 'chatbot-tester-bot-select',
107
+ class: cm.cn(cm.textSize('xs'), cm.fontWeight('bold')),
108
+ }, labelChildren()),
109
+ h('select', {
110
+ ref: (el) => {
111
+ selectEl.value = el instanceof HTMLSelectElement ? el : null;
112
+ },
113
+ id: 'chatbot-tester-bot-select',
114
+ onChange: handleBotChange,
115
+ class: cm.cn(cm.textSize('sm'), cm.chatbotTesterBotSelect),
116
+ }, bots().map((bot) => h('option', { key: bot.id, value: bot.id }, bot.name || bot.id))),
117
+ ]));
118
+ }
119
+ children.push(h(ChatbotTesterMessages, {
120
+ messages: props.messages,
121
+ loading: props.loading,
122
+ emptyState: hasNodeValue(slots.emptyState, props.emptyState)
123
+ ? nodeChildren(slots.emptyState, props.emptyState)
124
+ : undefined,
125
+ }));
126
+ if (hasNodeValue(slots.error, props.error)) {
127
+ children.push(h('p', {
128
+ role: 'alert',
129
+ class: cm.cn(cm.textSize('sm'), cm.sp('px', 6), cm.sp('py', 2), cm.textError),
130
+ }, nodeChildren(slots.error, props.error)));
131
+ }
132
+ children.push(h(ChatbotTesterInput, {
133
+ value: input.value,
134
+ onChange: (next) => {
135
+ input.value = next;
136
+ },
137
+ onSend: handleSend,
138
+ loading: props.loading,
139
+ placeholder: props.inputPlaceholder,
140
+ sendLabel: props.sendLabel,
141
+ }));
142
+ return h('div', {
143
+ class: cm.cn(cm.flex({ direction: 'col' }), cm.flex1, cm.minW(0), props.className),
144
+ }, children);
145
+ };
146
+ },
147
+ });
148
+ //# sourceMappingURL=ChatbotTester.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatbotTester.js","sourceRoot":"","sources":["../src/ChatbotTester.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,eAAe,EACf,CAAC,EAED,GAAG,EAGH,WAAW,GACZ,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,yBAAyB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAGhF,mCAAmC;AACnC,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC;IAC3C,IAAI,EAAE,eAAe;IACrB,YAAY,EAAE,KAAK;IACnB,KA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E,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3C,QAAQ,CAAC,IAAI,CACX,CAAC,CACC,GAAG,EACH;oBACE,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC;iBAC9E,EACD,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CACvC,CACF,CAAA;YACH,CAAC;YAED,QAAQ,CAAC,IAAI,CACX,CAAC,CAAC,kBAAkB,EAAE;gBACpB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,QAAQ,EAAE,CAAC,IAAY,EAAE,EAAE;oBACzB,KAAK,CAAC,KAAK,GAAG,IAAI,CAAA;gBACpB,CAAC;gBACD,MAAM,EAAE,UAAU;gBAClB,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,WAAW,EAAE,KAAK,CAAC,gBAAgB;gBACnC,SAAS,EAAE,KAAK,CAAC,SAAS;aAC3B,CAAC,CACH,CAAA;YAED,OAAO,CAAC,CACN,KAAK,EACL;gBACE,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;aACnF,EACD,QAAQ,CACT,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Vue composer input row with a send button: Enter sends, Shift+Enter inserts
3
+ * a newline, and the field follows the controlled `value` prop the way
4
+ * react-dom restores it after every edit.
5
+ *
6
+ * Vue counterpart of `@molecule/app-chatbot-tester-react`'s
7
+ * `ChatbotTesterInput` — the same props (React names) and the same DOM for the
8
+ * same input.
9
+ *
10
+ * @module
11
+ */
12
+ import { type PropType, type VNode } from 'vue';
13
+ /** Message composer + send button. */
14
+ export declare const ChatbotTesterInput: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
15
+ value: {
16
+ type: StringConstructor;
17
+ required: true;
18
+ };
19
+ onChange: {
20
+ type: PropType<(next: string) => void>;
21
+ default: undefined;
22
+ };
23
+ onSend: {
24
+ type: PropType<() => void>;
25
+ default: undefined;
26
+ };
27
+ loading: BooleanConstructor;
28
+ placeholder: StringConstructor;
29
+ sendLabel: StringConstructor;
30
+ }>, () => VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
31
+ value: {
32
+ type: StringConstructor;
33
+ required: true;
34
+ };
35
+ onChange: {
36
+ type: PropType<(next: string) => void>;
37
+ default: undefined;
38
+ };
39
+ onSend: {
40
+ type: PropType<() => void>;
41
+ default: undefined;
42
+ };
43
+ loading: BooleanConstructor;
44
+ placeholder: StringConstructor;
45
+ sendLabel: StringConstructor;
46
+ }>> & Readonly<{}>, {
47
+ loading: boolean;
48
+ onChange: (next: string) => void;
49
+ onSend: () => void;
50
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
51
+ //# sourceMappingURL=ChatbotTesterInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatbotTesterInput.d.ts","sourceRoot":"","sources":["../src/ChatbotTesterInput.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAsB,KAAK,QAAQ,EAAO,KAAK,KAAK,EAAe,MAAM,KAAK,CAAA;AAKrF,sCAAsC;AACtC,eAAO,MAAM,kBAAkB;;;;;;cASP,QAAQ,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;;;;cAIhC,QAAQ,CAAC,MAAM,IAAI,CAAC;;;;;;UA+C7B,KAAK;;;;;;cAnDI,QAAQ,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;;;;cAIhC,QAAQ,CAAC,MAAM,IAAI,CAAC;;;;;;;;qBAJJ,MAAM,KAAK,IAAI;kBAIhB,IAAI;4EAwGzC,CAAA"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Vue composer input row with a send button: Enter sends, Shift+Enter inserts
3
+ * a newline, and the field follows the controlled `value` prop the way
4
+ * react-dom restores it after every edit.
5
+ *
6
+ * Vue counterpart of `@molecule/app-chatbot-tester-react`'s
7
+ * `ChatbotTesterInput` — the same props (React names) and the same DOM for the
8
+ * same input.
9
+ *
10
+ * @module
11
+ */
12
+ import { defineComponent, h, ref, watchEffect } from 'vue';
13
+ import { getClassMap } from '@molecule/app-ui';
14
+ import { useTranslation } from '@molecule/app-vue';
15
+ /** Message composer + send button. */
16
+ export const ChatbotTesterInput = defineComponent({
17
+ name: 'ChatbotTesterInput',
18
+ inheritAttrs: false,
19
+ props: {
20
+ value: {
21
+ type: String,
22
+ required: true,
23
+ },
24
+ onChange: {
25
+ type: Function,
26
+ default: undefined,
27
+ },
28
+ onSend: {
29
+ type: Function,
30
+ default: undefined,
31
+ },
32
+ loading: Boolean,
33
+ placeholder: String,
34
+ sendLabel: String,
35
+ },
36
+ setup(props) {
37
+ const cm = getClassMap();
38
+ const { t } = useTranslation();
39
+ const field = ref(null);
40
+ // A controlled textarea's value is applied through the live property only
41
+ // (react-dom writes no `value` attribute on a textarea), so a plain
42
+ // `value` binding — which Vue also reflects to the attribute — is wrong here.
43
+ watchEffect(() => {
44
+ const el = field.value;
45
+ if (el && el.value !== props.value)
46
+ el.value = props.value;
47
+ }, { flush: 'post' });
48
+ /**
49
+ * Reports the edit, then restores the controlled value exactly as
50
+ * react-dom does after a controlled input's change event.
51
+ *
52
+ * @param event - The native input event.
53
+ */
54
+ const handleInput = (event) => {
55
+ const field = event.target;
56
+ props.onChange?.(field.value);
57
+ if (field.value !== props.value)
58
+ field.value = props.value;
59
+ };
60
+ /**
61
+ * Enter sends; Shift+Enter is left to the browser (a newline).
62
+ *
63
+ * @param event - The native keydown event.
64
+ */
65
+ const handleKeydown = (event) => {
66
+ if (event.key === 'Enter' && !event.shiftKey) {
67
+ event.preventDefault();
68
+ props.onSend?.();
69
+ }
70
+ };
71
+ return () => h('div', {
72
+ class: cm.cn(cm.flex({ align: 'end', gap: 2 }), cm.sp('px', 6), cm.sp('py', 4), cm.chatbotTesterInputRow),
73
+ }, [
74
+ h('textarea', {
75
+ ref: (el) => {
76
+ field.value = el instanceof HTMLTextAreaElement ? el : null;
77
+ },
78
+ onInput: handleInput,
79
+ onKeydown: handleKeydown,
80
+ rows: 1,
81
+ placeholder: props.placeholder === undefined
82
+ ? t('chatbotTester.placeholder.message', undefined, {
83
+ defaultValue: 'Type a message…',
84
+ })
85
+ : props.placeholder,
86
+ disabled: props.loading,
87
+ class: cm.cn(cm.flex1, cm.sp('px', 4), cm.sp('py', 2), cm.textSize('sm'), cm.surface, cm.chatbotTesterInputField),
88
+ }),
89
+ h('button', {
90
+ type: 'button',
91
+ 'data-mol-id': 'chatbot-tester-send',
92
+ onClick: (event) => {
93
+ // React's DOM handler passes the click event, as `onClick={onSend}` does.
94
+ ;
95
+ props.onSend?.(event);
96
+ },
97
+ disabled: Boolean(props.loading) || !props.value.trim(),
98
+ class: cm.cn(cm.button({ variant: 'solid', color: 'primary', size: 'sm' }), cm.touchTargetCompact),
99
+ }, props.sendLabel === undefined
100
+ ? t('chatbotTester.label.send', undefined, { defaultValue: 'Send' })
101
+ : props.sendLabel),
102
+ ]);
103
+ },
104
+ });
105
+ //# sourceMappingURL=ChatbotTesterInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatbotTesterInput.js","sourceRoot":"","sources":["../src/ChatbotTesterInput.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH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AO;gBACvB,KAAK,EAAE,EAAE,CAAC,EAAE,CACV,EAAE,CAAC,KAAK,EACR,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,EACd,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,EACd,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EACjB,EAAE,CAAC,OAAO,EACV,EAAE,CAAC,uBAAuB,CAC3B;aACF,CAAC;YACF,CAAC,CACC,QAAQ,EACR;gBACE,IAAI,EAAE,QAAQ;gBACd,aAAa,EAAE,qBAAqB;gBACpC,OAAO,EAAE,CAAC,KAAiB,EAAE,EAAE;oBAC7B,0EAA0E;oBAC1E,CAAC;oBAAC,KAAK,CAAC,MAAqD,EAAE,CAAC,KAAK,CAAC,CAAA;gBACxE,CAAC;gBACD,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE;gBACvD,KAAK,EAAE,EAAE,CAAC,EAAE,CACV,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAC7D,EAAE,CAAC,kBAAkB,CACtB;aACF,EACD,KAAK,CAAC,SAAS,KAAK,SAAS;gBAC3B,CAAC,CAAC,CAAC,CAAC,0BAA0B,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;gBACpE,CAAC,CAAC,KAAK,CAAC,SAAS,CACpB;SACF,CACF,CAAA;IACL,CAAC;CACF,CAAC,CAAA"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Vue scrollable message list for the chatbot sandbox: one left-aligned
3
+ * (assistant) or right-aligned (user) bubble per message, with the typing
4
+ * indicator appended while a reply is in flight.
5
+ *
6
+ * Vue counterpart of `@molecule/app-chatbot-tester-react`'s
7
+ * `ChatbotTesterMessages` — the same props (React names) and the same DOM for
8
+ * the same input.
9
+ *
10
+ * @module
11
+ */
12
+ import { type PropType, type VNode } from 'vue';
13
+ import type { TesterMessage } from './types.js';
14
+ /**
15
+ * Scrollable transcript pane. Renders the empty-state slot instead of the list
16
+ * when there are no messages, nothing is loading and an empty state was given
17
+ * (React's branch).
18
+ */
19
+ export declare const ChatbotTesterMessages: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
20
+ messages: {
21
+ type: PropType<TesterMessage[]>;
22
+ required: true;
23
+ };
24
+ loading: BooleanConstructor;
25
+ emptyState: null;
26
+ }>, () => VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
27
+ messages: {
28
+ type: PropType<TesterMessage[]>;
29
+ required: true;
30
+ };
31
+ loading: BooleanConstructor;
32
+ emptyState: null;
33
+ }>> & Readonly<{}>, {
34
+ loading: boolean;
35
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
36
+ //# sourceMappingURL=ChatbotTesterMessages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatbotTesterMessages.d.ts","sourceRoot":"","sources":["../src/ChatbotTesterMessages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAsB,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAmB,MAAM,KAAK,CAAA;AAKpF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;cAKb,QAAQ,CAAC,aAAa,EAAE,CAAC;;;;;UAmB/B,KAAK;;cAnBC,QAAQ,CAAC,aAAa,EAAE,CAAC;;;;;;;4EAmF5C,CAAA"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Vue scrollable message list for the chatbot sandbox: one left-aligned
3
+ * (assistant) or right-aligned (user) bubble per message, with the typing
4
+ * indicator appended while a reply is in flight.
5
+ *
6
+ * Vue counterpart of `@molecule/app-chatbot-tester-react`'s
7
+ * `ChatbotTesterMessages` — the same props (React names) and the same DOM for
8
+ * the same input.
9
+ *
10
+ * @module
11
+ */
12
+ import { defineComponent, h } from 'vue';
13
+ import { getClassMap } from '@molecule/app-ui';
14
+ import { hasNodeValue, nodeChildren } from './dom.js';
15
+ /**
16
+ * Scrollable transcript pane. Renders the empty-state slot instead of the list
17
+ * when there are no messages, nothing is loading and an empty state was given
18
+ * (React's branch).
19
+ */
20
+ export const ChatbotTesterMessages = defineComponent({
21
+ name: 'ChatbotTesterMessages',
22
+ inheritAttrs: false,
23
+ props: {
24
+ messages: {
25
+ type: Array,
26
+ required: true,
27
+ },
28
+ loading: Boolean,
29
+ emptyState: null,
30
+ },
31
+ setup(props, { slots }) {
32
+ const cm = getClassMap();
33
+ /**
34
+ * Whether React takes the empty-state branch.
35
+ *
36
+ * @returns True when the empty state renders instead of the list.
37
+ */
38
+ const showsEmptyState = () => !props.loading &&
39
+ props.messages.length === 0 &&
40
+ hasNodeValue(slots.emptyState, props.emptyState);
41
+ return () => {
42
+ if (showsEmptyState()) {
43
+ return h('div', { class: cm.cn(cm.flex1, cm.flex({ align: 'center', justify: 'center' })) }, nodeChildren(slots.emptyState, props.emptyState));
44
+ }
45
+ const rows = props.messages.map((msg) => {
46
+ const isUser = msg.role === 'user';
47
+ return h('div', { key: msg.id, class: cm.cn(cm.flex({ justify: isUser ? 'end' : 'start' })) }, [
48
+ h('div', {
49
+ class: cm.cn(cm.sp('px', 4), cm.sp('py', 2), cm.textSize('sm'), cm.chatbotTesterMessageBubble, isUser ? cm.chatbotTesterMessageBubbleUser : cm.chatbotTesterMessageBubbleBot),
50
+ }, [
51
+ msg.content,
52
+ msg.timestamp
53
+ ? h('div', {
54
+ class: cm.cn(cm.textSize('xs'), cm.sp('mt', 1), isUser ? cm.chatbotTesterMessageTimeUser : cm.chatbotTesterMessageTimeBot),
55
+ }, msg.timestamp)
56
+ : null,
57
+ ]),
58
+ ]);
59
+ });
60
+ return h('div', { class: cm.cn(cm.flex1, cm.sp('px', 6), cm.sp('py', 4), cm.chatbotTesterMessageList) }, [
61
+ h('div', { class: cm.stack(3) }, [
62
+ ...rows,
63
+ props.loading
64
+ ? h('div', { class: cm.cn(cm.textSize('xs'), cm.chatbotTesterTypingIndicator) }, '...')
65
+ : null,
66
+ h('div'),
67
+ ]),
68
+ ]);
69
+ };
70
+ },
71
+ });
72
+ //# sourceMappingURL=ChatbotTesterMessages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatbotTesterMessages.js","sourceRoot":"","sources":["../src/ChatbotTesterMessages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,eAAe,EAAE,CAAC,EAA8C,MAAM,KAAK,CAAA;AAEpF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAGrD;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC;IACnD,IAAI,EAAE,uBAAuB;IAC7B,YAAY,EAAE,KAAK;IACnB,KAAK,EAAE;QACL,QAAQ,EAAE;YACR,IAAI,EAAE,KAAkC;YACxC,QAAQ,EAAE,IAAI;SACf;QACD,OAAO,EAAE,OAAO;QAChB,UAAU,EAAE,IAAI;KACjB;IACD,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE;QACpB,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;QAExB;;;;WAIG;QACH,MAAM,eAAe,GAAG,GAAY,EAAE,CACpC,CAAC,KAAK,CAAC,OAAO;YACd,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;YAC3B,YAAY,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAA;QAElD,OAAO,GAAU,EAAE;YACjB,IAAI,eAAe,EAAE,EAAE,CAAC;gBACtB,OAAO,CAAC,C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M,CAAC,CAAC,CAAC,EAAE,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,CAAC,2BAA2B,CAC1E;6BACF,EACD,GAAG,CAAC,SAAS,CACd;4BACH,CAAC,CAAC,IAAI;qBACT,CACF;iBACF,CACF,CAAA;YACH,CAAC,CAAC,CAAA;YACF,OAAO,CAAC,CACN,KAAK,EACL,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,wBAAwB,CAAC,EAAE,EACvF;gBACE,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;oBAC/B,GAAG,IAAI;oBACP,KAAK,CAAC,OAAO;wBACX,CAAC,CAAC,CAAC,CACC,KAAK,EACL,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,4BAA4B,CAAC,EAAE,EACpE,KAAK,CACN;wBACH,CAAC,CAAC,IAAI;oBACR,CAAC,CAAC,KAAK,CAAC;iBACT,CAAC;aACH,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
package/dist/dom.d.ts ADDED
@@ -0,0 +1,38 @@
1
+ /**
2
+ * DOM helpers shared by the Vue chatbot-tester components: rendering a
3
+ * node-valued prop that may also arrive as a same-named slot, and reproducing
4
+ * react-dom's controlled-`<select>` selection.
5
+ *
6
+ * @module
7
+ */
8
+ import type { VNodeChild } from 'vue';
9
+ /**
10
+ * The children a node-valued prop contributes: the same-named slot wins over
11
+ * the prop, and an absent pair contributes nothing.
12
+ *
13
+ * @param slot - The slot render function, when the caller passed the slot.
14
+ * @param prop - The prop value, when the caller passed the prop.
15
+ * @returns The children to render.
16
+ */
17
+ export declare const nodeChildren: (slot: (() => VNodeChild[]) | undefined, prop: VNodeChild | null | undefined) => VNodeChild[];
18
+ /**
19
+ * Whether React would treat the node-valued prop as present: the slot exists
20
+ * (React receives a node array, which is always truthy), or the prop value is
21
+ * truthy (React's `{value ? … : null}`).
22
+ *
23
+ * @param slot - The slot render function, when the caller passed the slot.
24
+ * @param prop - The prop value, when the caller passed the prop.
25
+ * @returns True when the value renders.
26
+ */
27
+ export declare const hasNodeValue: (slot: (() => unknown) | undefined, prop: unknown) => boolean;
28
+ /**
29
+ * Reproduces react-dom's controlled-`<select>` selection: the option whose
30
+ * value matches is selected, and when nothing matches the first non-disabled
31
+ * option is. React never assigns `select.value`, so assigning it here would
32
+ * deselect everything for a value no option carries.
33
+ *
34
+ * @param select - The `<select>` element.
35
+ * @param value - The controlled value (React's `value ?? ''`).
36
+ */
37
+ export declare const applyReactSelectSelection: (select: HTMLSelectElement | null | undefined, value: string) => void;
38
+ //# sourceMappingURL=dom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAErC;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GACvB,MAAM,CAAC,MAAM,UAAU,EAAE,CAAC,GAAG,SAAS,EACtC,MAAM,UAAU,GAAG,IAAI,GAAG,SAAS,KAClC,UAAU,EAIZ,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS,EAAE,MAAM,OAAO,KAAG,OAC3C,CAAA;AAErC;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,GACpC,QAAQ,iBAAiB,GAAG,IAAI,GAAG,SAAS,EAC5C,OAAO,MAAM,KACZ,IAWF,CAAA"}
package/dist/dom.js ADDED
@@ -0,0 +1,57 @@
1
+ /**
2
+ * DOM helpers shared by the Vue chatbot-tester components: rendering a
3
+ * node-valued prop that may also arrive as a same-named slot, and reproducing
4
+ * react-dom's controlled-`<select>` selection.
5
+ *
6
+ * @module
7
+ */
8
+ /**
9
+ * The children a node-valued prop contributes: the same-named slot wins over
10
+ * the prop, and an absent pair contributes nothing.
11
+ *
12
+ * @param slot - The slot render function, when the caller passed the slot.
13
+ * @param prop - The prop value, when the caller passed the prop.
14
+ * @returns The children to render.
15
+ */
16
+ export const nodeChildren = (slot, prop) => {
17
+ if (slot)
18
+ return slot();
19
+ if (prop === null || prop === undefined)
20
+ return [];
21
+ return Array.isArray(prop) ? prop : [prop];
22
+ };
23
+ /**
24
+ * Whether React would treat the node-valued prop as present: the slot exists
25
+ * (React receives a node array, which is always truthy), or the prop value is
26
+ * truthy (React's `{value ? … : null}`).
27
+ *
28
+ * @param slot - The slot render function, when the caller passed the slot.
29
+ * @param prop - The prop value, when the caller passed the prop.
30
+ * @returns True when the value renders.
31
+ */
32
+ export const hasNodeValue = (slot, prop) => slot !== undefined || Boolean(prop);
33
+ /**
34
+ * Reproduces react-dom's controlled-`<select>` selection: the option whose
35
+ * value matches is selected, and when nothing matches the first non-disabled
36
+ * option is. React never assigns `select.value`, so assigning it here would
37
+ * deselect everything for a value no option carries.
38
+ *
39
+ * @param select - The `<select>` element.
40
+ * @param value - The controlled value (React's `value ?? ''`).
41
+ */
42
+ export const applyReactSelectSelection = (select, value) => {
43
+ if (!select)
44
+ return;
45
+ let fallback = null;
46
+ for (const option of Array.from(select.options)) {
47
+ if (option.value === value) {
48
+ option.selected = true;
49
+ return;
50
+ }
51
+ if (fallback === null && !option.disabled)
52
+ fallback = option;
53
+ }
54
+ if (fallback)
55
+ fallback.selected = true;
56
+ };
57
+ //# sourceMappingURL=dom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom.js","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,IAAsC,EACtC,IAAmC,EACrB,EAAE;IAChB,IAAI,IAAI;QAAE,OAAO,IAAI,EAAE,CAAA;IACvB,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,CAAA;IAClD,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AAC5C,CAAC,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAiC,EAAE,IAAa,EAAW,EAAE,CACxF,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;AAErC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,MAA4C,EAC5C,KAAa,EACP,EAAE;IACR,IAAI,CAAC,MAAM;QAAE,OAAM;IACnB,IAAI,QAAQ,GAA6B,IAAI,CAAA;IAC7C,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QAChD,IAAI,MAAM,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;YAC3B,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAA;YACtB,OAAM;QACR,CAAC;QACD,IAAI,QAAQ,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ;YAAE,QAAQ,GAAG,MAAM,CAAA;IAC9D,CAAC;IACD,IAAI,QAAQ;QAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAA;AACxC,CAAC,CAAA"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * `@molecule/app-chatbot-tester-vue` — Vue sandbox UI shell for live-testing
3
+ * conversational AI: optional bot picker, message transcript, input row,
4
+ * error display.
5
+ *
6
+ * Stateless about transport. The consumer owns the message array, send
7
+ * handler, and bot list; the package handles the layout and composition.
8
+ *
9
+ * Extracted from the ai-chatbot-builder TestChat page; usable for any
10
+ * "preview your bot live" UI. This is the Vue counterpart of
11
+ * `@molecule/app-chatbot-tester-react`: the same props (React names) and the
12
+ * same DOM for the same input, so an app swaps framework by changing only the
13
+ * package name in its imports.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * import { defineComponent, h, ref } from 'vue'
18
+ * import { ChatbotTester, type TesterMessage } from '@molecule/app-chatbot-tester-vue'
19
+ *
20
+ * export default defineComponent({
21
+ * setup() {
22
+ * const messages = ref<TesterMessage[]>([])
23
+ * const sending = ref(false)
24
+ * const send = async (text: string) => {
25
+ * messages.value = [...messages.value, { id: Date.now(), role: 'user', content: text }]
26
+ * const reply = await http.post(`/api/conversations/${conversationId}/messages`, { content: text })
27
+ * messages.value = [...messages.value, { id: reply.id, role: 'assistant', content: reply.content }]
28
+ * }
29
+ * return () =>
30
+ * h(ChatbotTester, {
31
+ * messages: messages.value,
32
+ * onSend: send,
33
+ * loading: sending.value,
34
+ * bots,
35
+ * botId: botId.value,
36
+ * onBotChange: (id: string) => (botId.value = id),
37
+ * error: error.value,
38
+ * })
39
+ * },
40
+ * })
41
+ * ```
42
+ *
43
+ * @remarks
44
+ * Built-in labels (`botPickerLabel` "Test bot", `inputPlaceholder`
45
+ * "Type a message…", `sendLabel` "Send") go through `t()` with the
46
+ * `chatbotTester.*` keys of the companion locale bond
47
+ * `@molecule/app-locales-chatbot-tester`; an explicit prop still overrides
48
+ * them.
49
+ * Enter sends; Shift+Enter inserts a newline. The bot picker renders only
50
+ * when `bots` has 2+ entries. Node-valued props (`error`, `emptyState`,
51
+ * `botPickerLabel`) arrive as a prop or as the same-named slot; components
52
+ * accept either. Styling includes Tailwind classes with Material-3 tokens
53
+ * (`bg-surface-container-high`, `border-outline-variant`, `text-on-primary`,
54
+ * …) — the app's Tailwind theme must define those tokens (the default
55
+ * molecule Tailwind ClassMap bond does); with a non-Tailwind ClassMap the
56
+ * bubbles/borders lose their styling.
57
+ *
58
+ * @module
59
+ */
60
+ export * from './ChatbotTester.js';
61
+ export * from './ChatbotTesterInput.js';
62
+ export * from './ChatbotTesterMessages.js';
63
+ export * from './types.js';
64
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,YAAY,CAAA"}