@molecule/app-chatbot-tester-svelte 0.0.0-stage → 0.0.1-stage

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,217 @@
1
- # Temporary Holding Version
1
+ <!--
2
+ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
+ Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
+ Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
+ To change this document, edit the module-level JSDoc in src/index.ts.
6
+ Generated: 2026-11-18T20:20:12.981Z
7
+ -->
2
8
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
9
+ # @molecule/app-chatbot-tester-svelte
10
+
11
+ `@molecule/app-chatbot-tester-svelte` — Svelte sandbox UI shell for
12
+ live-testing conversational AI: optional bot picker, message transcript,
13
+ input row, error display.
14
+
15
+ Stateless about transport. The consumer owns the message array, send
16
+ handler, and bot list; the package handles the layout and composition.
17
+
18
+ Extracted from the ai-chatbot-builder TestChat page; usable for any
19
+ "preview your bot live" UI. This is the Svelte counterpart of
20
+ `@molecule/app-chatbot-tester-react`: the same props (React names) and the
21
+ same DOM for the same input, so an app swaps framework by changing only the
22
+ package name in its imports. React's node props are Svelte snippets (or
23
+ plain strings).
24
+
25
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
26
+ > It is written to be read by coding agents as much as by people, and is generated from this
27
+ > package's source — edit `src/index.ts` JSDoc, not this file.
28
+
29
+ ## Quick Start
30
+
31
+ ```svelte
32
+ <script lang="ts">
33
+ import { ChatbotTester, type TesterMessage } from '@molecule/app-chatbot-tester-svelte'
34
+
35
+ let messages: TesterMessage[] = []
36
+ let sending = false
37
+
38
+ async function handleSend(text: string): Promise<void> {
39
+ messages = [...messages, { id: Date.now(), role: 'user', content: text }]
40
+ const reply = await http.post(`/api/conversations/${conversationId}/messages`, {
41
+ content: text,
42
+ })
43
+ messages = [...messages, { id: reply.id, role: 'assistant', content: reply.content }]
44
+ }
45
+ </script>
46
+
47
+ <ChatbotTester
48
+ {messages}
49
+ onSend={handleSend}
50
+ loading={sending}
51
+ {bots}
52
+ {botId}
53
+ onBotChange={(id) => (botId = id)}
54
+ {error}
55
+ />
56
+ ```
57
+
58
+ ## Type
59
+
60
+ `feature`
61
+
62
+ ## Installation
63
+
64
+ ```bash
65
+ npm install @molecule/app-chatbot-tester-svelte @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte
66
+ ```
67
+
68
+ ## API
69
+
70
+ ### Interfaces
71
+
72
+ #### `TesterMessage`
73
+
74
+ A single chat message displayed in the chatbot tester sandbox UI.
75
+
76
+ ```typescript
77
+ interface TesterMessage {
78
+ id: string | number
79
+ role: 'user' | 'assistant' | 'system'
80
+ content: string
81
+ timestamp?: string
82
+ }
83
+ ```
84
+
85
+ #### `TesterBotOption`
86
+
87
+ A selectable bot/agent option shown in the chatbot tester sandbox UI.
88
+
89
+ ```typescript
90
+ interface TesterBotOption {
91
+ id: string
92
+ name?: string
93
+ }
94
+ ```
95
+
96
+ #### `ChatbotTesterProps`
97
+
98
+ Props accepted by the {@link ChatbotTester} component.
99
+
100
+ ```typescript
101
+ interface ChatbotTesterProps {
102
+ /** The transcript, in display order. */
103
+ messages: TesterMessage[]
104
+ /** A reply is in flight: the composer and its send action are disabled. */
105
+ loading?: boolean
106
+ /** Called with the trimmed composer text when the user sends. */
107
+ onSend: (text: string) => void | Promise<void>
108
+ /** Optional bot list — when length >= 2, a picker is rendered. */
109
+ bots?: TesterBotOption[]
110
+ /** The selected bot id (controlled). */
111
+ botId?: string
112
+ /** Called with the newly selected bot id. */
113
+ onBotChange?: (id: string) => void
114
+ /** Last error message — rendered in a `role="alert"` paragraph. A snippet or a plain string. */
115
+ error?: Snippet | string
116
+ /** Empty-state slot when there are no messages yet. A snippet or a plain string. */
117
+ emptyState?: Snippet | string
118
+ /** The bot picker's label — an explicit value overrides `t('chatbotTester.label.testBot')` (`'Test bot'`). A snippet or a plain string. */
119
+ botPickerLabel?: Snippet | string
120
+ /** Composer placeholder — an explicit value overrides `t('chatbotTester.placeholder.message')` (`'Type a message…'`). */
121
+ inputPlaceholder?: string
122
+ /** Send button label — an explicit value overrides `t('chatbotTester.label.send')` (`'Send'`). */
123
+ sendLabel?: string
124
+ /** Extra classes on the outer wrapper. */
125
+ className?: string
126
+ }
127
+ ```
128
+
129
+ #### `ChatbotTesterInputProps`
130
+
131
+ Props accepted by the {@link ChatbotTesterInput} component.
132
+
133
+ ```typescript
134
+ interface ChatbotTesterInputProps {
135
+ /** The composer's current text (controlled). */
136
+ value: string
137
+ /** Called with the field's new text on every edit. */
138
+ onChange: (next: string) => void
139
+ /** Called when the user presses Enter (without Shift) or clicks send. */
140
+ onSend: () => void
141
+ /** A reply is in flight: the field and the send button are disabled. */
142
+ loading?: boolean
143
+ /** Placeholder text — an explicit value overrides `t('chatbotTester.placeholder.message')` (`'Type a message…'`). */
144
+ placeholder?: string
145
+ /** Send button label — an explicit value overrides `t('chatbotTester.label.send')` (`'Send'`). */
146
+ sendLabel?: string
147
+ }
148
+ ```
149
+
150
+ #### `ChatbotTesterMessagesProps`
151
+
152
+ Props accepted by the {@link ChatbotTesterMessages} component.
153
+
154
+ ```typescript
155
+ interface ChatbotTesterMessagesProps {
156
+ /** The transcript, in display order. */
157
+ messages: TesterMessage[]
158
+ /** A reply is in flight: the typing indicator is appended. */
159
+ loading?: boolean
160
+ /** Rendered instead of the transcript when there are no messages. A snippet or a plain string. */
161
+ emptyState?: Snippet | string
162
+ }
163
+ ```
164
+
165
+ ### Constants
166
+
167
+ #### `ChatbotTester`
168
+
169
+ ```typescript
170
+ const ChatbotTester: LegacyComponentType
171
+ ```
172
+
173
+ #### `ChatbotTesterInput`
174
+
175
+ ```typescript
176
+ const ChatbotTesterInput: LegacyComponentType
177
+ ```
178
+
179
+ #### `ChatbotTesterMessages`
180
+
181
+ ```typescript
182
+ const ChatbotTesterMessages: LegacyComponentType
183
+ ```
184
+
185
+ ## Injection Notes
186
+
187
+ ### Requirements
188
+
189
+ Peer dependencies:
190
+
191
+ - `@molecule/app-svelte` ^3.5.0
192
+ - `@molecule/app-ui` ^1.3.11
193
+ - `@molecule/app-ui-svelte` ^1.1.0
194
+ - `svelte` ^5.0.0
195
+
196
+ ### Runtime Dependencies
197
+
198
+ - `@molecule/app-svelte`
199
+ - `@molecule/app-ui`
200
+ - `@molecule/app-ui-svelte`
201
+ - `svelte`
202
+
203
+ Built-in labels (`botPickerLabel` "Test bot", `inputPlaceholder`
204
+ "Type a message…", `sendLabel` "Send") go through `t()` with the
205
+ `chatbotTester.*` keys of the companion locale bond
206
+ `@molecule/app-locales-chatbot-tester`; an explicit prop still overrides
207
+ them.
208
+ Enter sends; Shift+Enter inserts a newline. The bot picker renders only
209
+ when `bots` has 2+ entries. Styling includes Tailwind classes with
210
+ Material-3 tokens (`bg-surface-container-high`, `border-outline-variant`,
211
+ `text-on-primary`, …) — the app's Tailwind theme must define those tokens
212
+ (the default molecule Tailwind ClassMap bond does); with a non-Tailwind
213
+ ClassMap the bubbles/borders lose their styling.
214
+
215
+ ## Translations
216
+
217
+ Translation strings are provided by `@molecule/app-locales-chatbot-tester`.
@@ -0,0 +1,116 @@
1
+ <!--
2
+ ChatbotTester: the Svelte counterpart of
3
+ `@molecule/app-chatbot-tester-react`'s `ChatbotTester` — optional bot picker +
4
+ messages thread + composer row + error region. Same props (React names), same
5
+ DOM for the same input; the composer text is this component's own state,
6
+ exactly as in React. Node props are snippets (or plain strings).
7
+ -->
8
+ <script lang="ts">
9
+ import { useTranslation } from '@molecule/app-svelte'
10
+ import { getClassMap } from '@molecule/app-ui'
11
+
12
+ import ChatbotTesterInput from './ChatbotTesterInput.svelte'
13
+ import ChatbotTesterMessages from './ChatbotTesterMessages.svelte'
14
+ import { applyReactSelectSelection } from './dom.js'
15
+ import type { ChatbotTesterProps, TesterBotOption } from './types.js'
16
+
17
+ let {
18
+ messages,
19
+ loading,
20
+ onSend,
21
+ bots,
22
+ botId,
23
+ onBotChange,
24
+ error,
25
+ emptyState,
26
+ botPickerLabel,
27
+ inputPlaceholder,
28
+ sendLabel,
29
+ className,
30
+ }: ChatbotTesterProps = $props()
31
+
32
+ const { t } = useTranslation()
33
+ const cm = $derived(getClassMap())
34
+ let input = $state('')
35
+ let selectEl = $state<HTMLSelectElement | null>(null)
36
+
37
+ /** React's `bots ?? []`. */
38
+ const shownBots = $derived<TesterBotOption[]>(bots ?? [])
39
+ /** React's `botPickerLabel` default (undefined only): `t()`'s `'Test bot'`. */
40
+ const label = $derived(
41
+ botPickerLabel === undefined
42
+ ? t('chatbotTester.label.testBot', undefined, { defaultValue: 'Test bot' })
43
+ : botPickerLabel,
44
+ )
45
+
46
+ // Runs after the picker's options are patched, on mount and on every prop
47
+ // change, as react-dom's controlled `<select>` update does.
48
+ $effect(() => {
49
+ void shownBots
50
+ void botId
51
+ applyReactSelectSelection(selectEl, botId ?? '')
52
+ })
53
+
54
+ /** Sends the trimmed composer text and clears the field. */
55
+ async function handleSend(): Promise<void> {
56
+ const text = input.trim()
57
+ if (!text) return
58
+ input = ''
59
+ await onSend(text)
60
+ }
61
+
62
+ /**
63
+ * Reports the selected bot, then restores the controlled selection the way
64
+ * react-dom does after a controlled select's change event.
65
+ *
66
+ * @param event - The native change event.
67
+ */
68
+ function handleBotChange(event: Event): void {
69
+ onBotChange?.((event.target as HTMLSelectElement).value)
70
+ applyReactSelectSelection(selectEl, botId ?? '')
71
+ }
72
+ </script>
73
+
74
+ <div class={cm.cn(cm.flex({ direction: 'col' }), cm.flex1, cm.minW(0), className)}>
75
+ {#if shownBots.length > 1}
76
+ <div
77
+ class={cm.cn(
78
+ cm.flex({ align: 'center' }),
79
+ cm.sp('px', 6),
80
+ cm.sp('py', 3),
81
+ cm.chatbotTesterBotBar,
82
+ )}
83
+ >
84
+ <label
85
+ for="chatbot-tester-bot-select"
86
+ class={cm.cn(cm.textSize('xs'), cm.fontWeight('bold'))}
87
+ >
88
+ {#if typeof label === 'function'}{@render label()}{:else}{label}{/if}
89
+ </label>
90
+ <select
91
+ bind:this={selectEl}
92
+ id="chatbot-tester-bot-select"
93
+ onchange={handleBotChange}
94
+ class={cm.cn(cm.textSize('sm'), cm.chatbotTesterBotSelect)}
95
+ >
96
+ {#each shownBots as bot (bot.id)}
97
+ <option value={bot.id}>{bot.name || bot.id}</option>
98
+ {/each}
99
+ </select>
100
+ </div>
101
+ {/if}
102
+ <ChatbotTesterMessages {messages} {loading} {emptyState} />
103
+ {#if error}
104
+ <p role="alert" class={cm.cn(cm.textSize('sm'), cm.sp('px', 6), cm.sp('py', 2), cm.textError)}>
105
+ {#if typeof error === 'function'}{@render error()}{:else}{error}{/if}
106
+ </p>
107
+ {/if}
108
+ <ChatbotTesterInput
109
+ value={input}
110
+ onChange={(next: string) => (input = next)}
111
+ onSend={handleSend}
112
+ {loading}
113
+ placeholder={inputPlaceholder}
114
+ {sendLabel}
115
+ />
116
+ </div>
@@ -0,0 +1,5 @@
1
+ import type { ChatbotTesterProps } from './types.js';
2
+ declare const ChatbotTester: import("svelte").Component<ChatbotTesterProps, {}, "">;
3
+ type ChatbotTester = ReturnType<typeof ChatbotTester>;
4
+ export default ChatbotTester;
5
+ //# sourceMappingURL=ChatbotTester.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatbotTester.svelte.d.ts","sourceRoot":"","sources":["../src/ChatbotTester.svelte"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,kBAAkB,EAAmB,MAAM,YAAY,CAAC;AAkGtE,QAAA,MAAM,aAAa,wDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
@@ -0,0 +1,101 @@
1
+ <!--
2
+ ChatbotTesterInput: the Svelte counterpart of
3
+ `@molecule/app-chatbot-tester-react`'s `ChatbotTesterInput` — composer row with
4
+ a send button. Same props (React names), same DOM for the same input: Enter
5
+ sends, Shift+Enter inserts a newline, and a controlled textarea keeps its
6
+ prop value after an edit, as react-dom restores it.
7
+ -->
8
+ <script lang="ts">
9
+ import { useTranslation } from '@molecule/app-svelte'
10
+ import { getClassMap } from '@molecule/app-ui'
11
+
12
+ import type { ChatbotTesterInputProps } from './types.js'
13
+
14
+ let { value, onChange, onSend, loading, placeholder, sendLabel }: ChatbotTesterInputProps =
15
+ $props()
16
+
17
+ const { t } = useTranslation()
18
+ const cm = $derived(getClassMap())
19
+ /** React's `placeholder` default (undefined only): `t()`'s `'Type a message…'`. */
20
+ const placeholderText = $derived(
21
+ placeholder === undefined
22
+ ? t('chatbotTester.placeholder.message', undefined, { defaultValue: 'Type a message…' })
23
+ : placeholder,
24
+ )
25
+ /** React's `sendLabel` default (undefined only): `t()`'s `'Send'`. */
26
+ const sendText = $derived(
27
+ sendLabel === undefined
28
+ ? t('chatbotTester.label.send', undefined, { defaultValue: 'Send' })
29
+ : sendLabel,
30
+ )
31
+
32
+ /**
33
+ * Reports the edit, then restores the controlled value exactly as react-dom
34
+ * does after a controlled input's change event.
35
+ *
36
+ * @param event - The native input event.
37
+ */
38
+ function handleInput(event: Event): void {
39
+ const field = event.target as HTMLTextAreaElement
40
+ onChange(field.value)
41
+ if (field.value !== value) field.value = value
42
+ }
43
+
44
+ /**
45
+ * Enter sends; Shift+Enter is left to the browser (a newline).
46
+ *
47
+ * @param event - The native keydown event.
48
+ */
49
+ function handleKeydown(event: KeyboardEvent): void {
50
+ if (event.key === 'Enter' && !event.shiftKey) {
51
+ event.preventDefault()
52
+ onSend()
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Passes the click event to the callback, as React's DOM handler does.
58
+ *
59
+ * @param event - The native click event.
60
+ */
61
+ function handleClick(event: MouseEvent): void {
62
+ ;(onSend as (event?: MouseEvent) => void)(event)
63
+ }
64
+ </script>
65
+
66
+ <div
67
+ class={cm.cn(
68
+ cm.flex({ align: 'end', gap: 2 }),
69
+ cm.sp('px', 6),
70
+ cm.sp('py', 4),
71
+ cm.chatbotTesterInputRow,
72
+ )}
73
+ >
74
+ <textarea
75
+ {value}
76
+ oninput={handleInput}
77
+ onkeydown={handleKeydown}
78
+ rows={1}
79
+ placeholder={placeholderText}
80
+ disabled={loading}
81
+ class={cm.cn(
82
+ cm.flex1,
83
+ cm.sp('px', 4),
84
+ cm.sp('py', 2),
85
+ cm.textSize('sm'),
86
+ cm.surface,
87
+ cm.chatbotTesterInputField,
88
+ )}></textarea>
89
+ <button
90
+ type="button"
91
+ data-mol-id="chatbot-tester-send"
92
+ onclick={handleClick}
93
+ disabled={Boolean(loading) || !value.trim()}
94
+ class={cm.cn(
95
+ cm.button({ variant: 'solid', color: 'primary', size: 'sm' }),
96
+ cm.touchTargetCompact,
97
+ )}
98
+ >
99
+ {sendText}
100
+ </button>
101
+ </div>
@@ -0,0 +1,5 @@
1
+ import type { ChatbotTesterInputProps } from './types.js';
2
+ declare const ChatbotTesterInput: import("svelte").Component<ChatbotTesterInputProps, {}, "">;
3
+ type ChatbotTesterInput = ReturnType<typeof ChatbotTesterInput>;
4
+ export default ChatbotTesterInput;
5
+ //# sourceMappingURL=ChatbotTesterInput.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatbotTesterInput.svelte.d.ts","sourceRoot":"","sources":["../src/ChatbotTesterInput.svelte"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAqF1D,QAAA,MAAM,kBAAkB,6DAAwC,CAAC;AACjE,KAAK,kBAAkB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAChE,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,53 @@
1
+ <!--
2
+ ChatbotTesterMessages: the Svelte counterpart of
3
+ `@molecule/app-chatbot-tester-react`'s `ChatbotTesterMessages` — scrollable
4
+ transcript with left-aligned (assistant) and right-aligned (user) bubbles, the
5
+ typing indicator while a reply is pending, and React's empty-state branch.
6
+ Same props (React names), same DOM for the same input.
7
+ -->
8
+ <script lang="ts">
9
+ import { getClassMap } from '@molecule/app-ui'
10
+
11
+ import type { ChatbotTesterMessagesProps } from './types.js'
12
+
13
+ let { messages, loading, emptyState }: ChatbotTesterMessagesProps = $props()
14
+
15
+ const cm = $derived(getClassMap())
16
+
17
+ /** React's branch: no messages, not loading, and an empty state was given. */
18
+ const showsEmptyState = $derived(!loading && messages.length === 0 && Boolean(emptyState))
19
+ </script>
20
+
21
+ {#if showsEmptyState}
22
+ <div class={cm.cn(cm.flex1, cm.flex({ align: 'center', justify: 'center' }))}>
23
+ {#if typeof emptyState === 'function'}{@render emptyState()}{:else}{emptyState}{/if}
24
+ </div>
25
+ {:else}
26
+ <div class={cm.cn(cm.flex1, cm.sp('px', 6), cm.sp('py', 4), cm.chatbotTesterMessageList)}>
27
+ <div class={cm.stack(3)}>
28
+ {#each messages as msg (msg.id)}
29
+ {@const isUser = msg.role === 'user'}
30
+ <div class={cm.cn(cm.flex({ justify: isUser ? 'end' : 'start' }))}>
31
+ <!-- prettier-ignore -->
32
+ <div
33
+ class={cm.cn(
34
+ cm.sp('px', 4),
35
+ cm.sp('py', 2),
36
+ cm.textSize('sm'),
37
+ cm.chatbotTesterMessageBubble,
38
+ isUser ? cm.chatbotTesterMessageBubbleUser : cm.chatbotTesterMessageBubbleBot,
39
+ )}
40
+ >{msg.content}{#if msg.timestamp}<div class={cm.cn(
41
+ cm.textSize('xs'),
42
+ cm.sp('mt', 1),
43
+ isUser ? cm.chatbotTesterMessageTimeUser : cm.chatbotTesterMessageTimeBot,
44
+ )}>{msg.timestamp}</div>{/if}</div>
45
+ </div>
46
+ {/each}
47
+ {#if loading}
48
+ <div class={cm.cn(cm.textSize('xs'), cm.chatbotTesterTypingIndicator)}>...</div>
49
+ {/if}
50
+ <div></div>
51
+ </div>
52
+ </div>
53
+ {/if}
@@ -0,0 +1,5 @@
1
+ import type { ChatbotTesterMessagesProps } from './types.js';
2
+ declare const ChatbotTesterMessages: import("svelte").Component<ChatbotTesterMessagesProps, {}, "">;
3
+ type ChatbotTesterMessages = ReturnType<typeof ChatbotTesterMessages>;
4
+ export default ChatbotTesterMessages;
5
+ //# sourceMappingURL=ChatbotTesterMessages.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatbotTesterMessages.svelte.d.ts","sourceRoot":"","sources":["../src/ChatbotTesterMessages.svelte"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAkD7D,QAAA,MAAM,qBAAqB,gEAAwC,CAAC;AACpE,KAAK,qBAAqB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACtE,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The package's components: one Svelte 5 component per React component in
3
+ * `@molecule/app-chatbot-tester-react`, under the same React name.
4
+ *
5
+ * @module
6
+ */
7
+ export { default as ChatbotTester } from './ChatbotTester.svelte';
8
+ export { default as ChatbotTesterInput } from './ChatbotTesterInput.svelte';
9
+ export { default as ChatbotTesterMessages } from './ChatbotTesterMessages.svelte';
10
+ //# sourceMappingURL=components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAC3E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,gCAAgC,CAAA"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The package's components: one Svelte 5 component per React component in
3
+ * `@molecule/app-chatbot-tester-react`, under the same React name.
4
+ *
5
+ * @module
6
+ */
7
+ export { default as ChatbotTester } from './ChatbotTester.svelte';
8
+ export { default as ChatbotTesterInput } from './ChatbotTesterInput.svelte';
9
+ export { default as ChatbotTesterMessages } from './ChatbotTesterMessages.svelte';
package/dist/dom.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * DOM helpers shared by the Svelte chatbot-tester components.
3
+ *
4
+ * @module
5
+ */
6
+ /**
7
+ * Reproduces react-dom's controlled-`<select>` selection: the option whose
8
+ * value matches is selected, and when nothing matches the first non-disabled
9
+ * option is. React never assigns `select.value`, so assigning it here would
10
+ * deselect everything for a value no option carries.
11
+ *
12
+ * @param select - The `<select>` element.
13
+ * @param value - The controlled value (React's `value ?? ''`).
14
+ */
15
+ export declare const applyReactSelectSelection: (select: HTMLSelectElement | null | undefined, value: string) => void;
16
+ //# sourceMappingURL=dom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;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,29 @@
1
+ /**
2
+ * DOM helpers shared by the Svelte chatbot-tester components.
3
+ *
4
+ * @module
5
+ */
6
+ /**
7
+ * Reproduces react-dom's controlled-`<select>` selection: the option whose
8
+ * value matches is selected, and when nothing matches the first non-disabled
9
+ * option is. React never assigns `select.value`, so assigning it here would
10
+ * deselect everything for a value no option carries.
11
+ *
12
+ * @param select - The `<select>` element.
13
+ * @param value - The controlled value (React's `value ?? ''`).
14
+ */
15
+ export const applyReactSelectSelection = (select, value) => {
16
+ if (!select)
17
+ return;
18
+ let fallback = null;
19
+ for (const option of Array.from(select.options)) {
20
+ if (option.value === value) {
21
+ option.selected = true;
22
+ return;
23
+ }
24
+ if (fallback === null && !option.disabled)
25
+ fallback = option;
26
+ }
27
+ if (fallback)
28
+ fallback.selected = true;
29
+ };
@@ -0,0 +1,59 @@
1
+ /**
2
+ * `@molecule/app-chatbot-tester-svelte` — Svelte sandbox UI shell for
3
+ * live-testing conversational AI: optional bot picker, message transcript,
4
+ * input row, 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 Svelte 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. React's node props are Svelte snippets (or
14
+ * plain strings).
15
+ *
16
+ * @example
17
+ * ```svelte
18
+ * <script lang="ts">
19
+ * import { ChatbotTester, type TesterMessage } from '@molecule/app-chatbot-tester-svelte'
20
+ *
21
+ * let messages: TesterMessage[] = []
22
+ * let sending = false
23
+ *
24
+ * async function handleSend(text: string): Promise<void> {
25
+ * messages = [...messages, { id: Date.now(), role: 'user', content: text }]
26
+ * const reply = await http.post(`/api/conversations/${conversationId}/messages`, { content: text })
27
+ * messages = [...messages, { id: reply.id, role: 'assistant', content: reply.content }]
28
+ * }
29
+ * </script>
30
+ *
31
+ * <ChatbotTester
32
+ * {messages}
33
+ * onSend={handleSend}
34
+ * loading={sending}
35
+ * {bots}
36
+ * {botId}
37
+ * onBotChange={(id) => (botId = id)}
38
+ * {error}
39
+ * />
40
+ * ```
41
+ *
42
+ * @remarks
43
+ * Built-in labels (`botPickerLabel` "Test bot", `inputPlaceholder`
44
+ * "Type a message…", `sendLabel` "Send") go through `t()` with the
45
+ * `chatbotTester.*` keys of the companion locale bond
46
+ * `@molecule/app-locales-chatbot-tester`; an explicit prop still overrides
47
+ * them.
48
+ * Enter sends; Shift+Enter inserts a newline. The bot picker renders only
49
+ * when `bots` has 2+ entries. Styling includes Tailwind classes with
50
+ * Material-3 tokens (`bg-surface-container-high`, `border-outline-variant`,
51
+ * `text-on-primary`, …) — the app's Tailwind theme must define those tokens
52
+ * (the default molecule Tailwind ClassMap bond does); with a non-Tailwind
53
+ * ClassMap the bubbles/borders lose their styling.
54
+ *
55
+ * @module
56
+ */
57
+ export * from './components.js';
58
+ export * from './types.js';
59
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,58 @@
1
+ /**
2
+ * `@molecule/app-chatbot-tester-svelte` — Svelte sandbox UI shell for
3
+ * live-testing conversational AI: optional bot picker, message transcript,
4
+ * input row, 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 Svelte 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. React's node props are Svelte snippets (or
14
+ * plain strings).
15
+ *
16
+ * @example
17
+ * ```svelte
18
+ * <script lang="ts">
19
+ * import { ChatbotTester, type TesterMessage } from '@molecule/app-chatbot-tester-svelte'
20
+ *
21
+ * let messages: TesterMessage[] = []
22
+ * let sending = false
23
+ *
24
+ * async function handleSend(text: string): Promise<void> {
25
+ * messages = [...messages, { id: Date.now(), role: 'user', content: text }]
26
+ * const reply = await http.post(`/api/conversations/${conversationId}/messages`, { content: text })
27
+ * messages = [...messages, { id: reply.id, role: 'assistant', content: reply.content }]
28
+ * }
29
+ * </script>
30
+ *
31
+ * <ChatbotTester
32
+ * {messages}
33
+ * onSend={handleSend}
34
+ * loading={sending}
35
+ * {bots}
36
+ * {botId}
37
+ * onBotChange={(id) => (botId = id)}
38
+ * {error}
39
+ * />
40
+ * ```
41
+ *
42
+ * @remarks
43
+ * Built-in labels (`botPickerLabel` "Test bot", `inputPlaceholder`
44
+ * "Type a message…", `sendLabel` "Send") go through `t()` with the
45
+ * `chatbotTester.*` keys of the companion locale bond
46
+ * `@molecule/app-locales-chatbot-tester`; an explicit prop still overrides
47
+ * them.
48
+ * Enter sends; Shift+Enter inserts a newline. The bot picker renders only
49
+ * when `bots` has 2+ entries. Styling includes Tailwind classes with
50
+ * Material-3 tokens (`bg-surface-container-high`, `border-outline-variant`,
51
+ * `text-on-primary`, …) — the app's Tailwind theme must define those tokens
52
+ * (the default molecule Tailwind ClassMap bond does); with a non-Tailwind
53
+ * ClassMap the bubbles/borders lose their styling.
54
+ *
55
+ * @module
56
+ */
57
+ export * from './components.js';
58
+ export * from './types.js';
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Types for the Svelte chatbot-tester sandbox UI — the same props (React
3
+ * names) as `@molecule/app-chatbot-tester-react`. React's node props are
4
+ * Svelte snippets here (or plain strings).
5
+ *
6
+ * @module
7
+ */
8
+ import type { Snippet } from 'svelte';
9
+ /** A single chat message displayed in the chatbot tester sandbox UI. */
10
+ export interface TesterMessage {
11
+ id: string | number;
12
+ role: 'user' | 'assistant' | 'system';
13
+ content: string;
14
+ timestamp?: string;
15
+ }
16
+ /** A selectable bot/agent option shown in the chatbot tester sandbox UI. */
17
+ export interface TesterBotOption {
18
+ id: string;
19
+ name?: string;
20
+ }
21
+ /** Props accepted by the {@link ChatbotTester} component. */
22
+ export interface ChatbotTesterProps {
23
+ /** The transcript, in display order. */
24
+ messages: TesterMessage[];
25
+ /** A reply is in flight: the composer and its send action are disabled. */
26
+ loading?: boolean;
27
+ /** Called with the trimmed composer text when the user sends. */
28
+ onSend: (text: string) => void | Promise<void>;
29
+ /** Optional bot list — when length >= 2, a picker is rendered. */
30
+ bots?: TesterBotOption[];
31
+ /** The selected bot id (controlled). */
32
+ botId?: string;
33
+ /** Called with the newly selected bot id. */
34
+ onBotChange?: (id: string) => void;
35
+ /** Last error message — rendered in a `role="alert"` paragraph. A snippet or a plain string. */
36
+ error?: Snippet | string;
37
+ /** Empty-state slot when there are no messages yet. A snippet or a plain string. */
38
+ emptyState?: Snippet | string;
39
+ /** The bot picker's label — an explicit value overrides `t('chatbotTester.label.testBot')` (`'Test bot'`). A snippet or a plain string. */
40
+ botPickerLabel?: Snippet | string;
41
+ /** Composer placeholder — an explicit value overrides `t('chatbotTester.placeholder.message')` (`'Type a message…'`). */
42
+ inputPlaceholder?: string;
43
+ /** Send button label — an explicit value overrides `t('chatbotTester.label.send')` (`'Send'`). */
44
+ sendLabel?: string;
45
+ /** Extra classes on the outer wrapper. */
46
+ className?: string;
47
+ }
48
+ /** Props accepted by the {@link ChatbotTesterInput} component. */
49
+ export interface ChatbotTesterInputProps {
50
+ /** The composer's current text (controlled). */
51
+ value: string;
52
+ /** Called with the field's new text on every edit. */
53
+ onChange: (next: string) => void;
54
+ /** Called when the user presses Enter (without Shift) or clicks send. */
55
+ onSend: () => void;
56
+ /** A reply is in flight: the field and the send button are disabled. */
57
+ loading?: boolean;
58
+ /** Placeholder text — an explicit value overrides `t('chatbotTester.placeholder.message')` (`'Type a message…'`). */
59
+ placeholder?: string;
60
+ /** Send button label — an explicit value overrides `t('chatbotTester.label.send')` (`'Send'`). */
61
+ sendLabel?: string;
62
+ }
63
+ /** Props accepted by the {@link ChatbotTesterMessages} component. */
64
+ export interface ChatbotTesterMessagesProps {
65
+ /** The transcript, in display order. */
66
+ messages: TesterMessage[];
67
+ /** A reply is in flight: the typing indicator is appended. */
68
+ loading?: boolean;
69
+ /** Rendered instead of the transcript when there are no messages. A snippet or a plain string. */
70
+ emptyState?: Snippet | string;
71
+ }
72
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC,wEAAwE;AACxE,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;IACrC,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,6DAA6D;AAC7D,MAAM,WAAW,kBAAkB;IACjC,wCAAwC;IACxC,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,iEAAiE;IACjE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9C,kEAAkE;IAClE,IAAI,CAAC,EAAE,eAAe,EAAE,CAAA;IACxB,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6CAA6C;IAC7C,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,gGAAgG;IAChG,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACxB,oFAAoF;IACpF,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IAC7B,2IAA2I;IAC3I,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACjC,yHAAyH;IACzH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,kGAAkG;IAClG,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,kEAAkE;AAClE,MAAM,WAAW,uBAAuB;IACtC,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAA;IACb,sDAAsD;IACtD,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,yEAAyE;IACzE,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,wEAAwE;IACxE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,qHAAqH;IACrH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kGAAkG;IAClG,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,qEAAqE;AACrE,MAAM,WAAW,0BAA0B;IACzC,wCAAwC;IACxC,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kGAAkG;IAClG,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CAC9B"}
package/dist/types.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Types for the Svelte chatbot-tester sandbox UI — the same props (React
3
+ * names) as `@molecule/app-chatbot-tester-react`. React's node props are
4
+ * Svelte snippets here (or plain strings).
5
+ *
6
+ * @module
7
+ */
8
+ export {};
package/package.json CHANGED
@@ -1,6 +1,76 @@
1
1
  {
2
2
  "name": "@molecule/app-chatbot-tester-svelte",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.1-stage",
4
+ "description": "Bot-picker + transcript + composer sandbox UI",
5
+ "homepage": "https://www.molecule.dev/packages/app-chatbot-tester-svelte",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "svelte": "./dist/index.js",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "./package.json": "./package.json"
16
+ },
17
+ "svelte": "./dist/index.js",
18
+ "files": [
19
+ "dist",
20
+ "!dist/**/__tests__",
21
+ "!dist/**/*.test.*",
22
+ "!dist/**/*.spec.*",
23
+ "README.md"
24
+ ],
25
+ "scripts": {
26
+ "build": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings && svelte-package --input src --output dist --tsconfig ./tsconfig.json",
27
+ "dev": "svelte-package --input src --output dist --tsconfig ./tsconfig.json --watch",
28
+ "test": "vitest run",
29
+ "test:watch": "vitest"
30
+ },
31
+ "keywords": [
32
+ "molecule",
33
+ "chatbot",
34
+ "playground",
35
+ "tester",
36
+ "ai",
37
+ "svelte"
38
+ ],
39
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
40
+ "license": "Apache-2.0",
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "https://github.com/molecule-dev/molecule.git",
44
+ "directory": "packages/app/features/chatbot-tester-svelte"
45
+ },
46
+ "engines": {
47
+ "node": ">=20"
48
+ },
49
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
50
+ "publishConfig": {
51
+ "access": "public"
52
+ },
53
+ "peerDependencies": {
54
+ "@molecule/app-svelte": "^3.5.0",
55
+ "@molecule/app-ui": "^1.3.11",
56
+ "@molecule/app-ui-svelte": "^1.1.0",
57
+ "svelte": "^5.0.0"
58
+ },
59
+ "devDependencies": {
60
+ "@molecule/app-framework-conformance": "0.0.0",
61
+ "@molecule/app-i18n": "1.2.2",
62
+ "@molecule/app-icons": "1.0.4",
63
+ "@molecule/app-svelte": "3.7.1",
64
+ "@molecule/app-ui": "1.4.0",
65
+ "@molecule/app-ui-svelte": "1.1.6",
66
+ "@sveltejs/package": "3.0.2",
67
+ "@sveltejs/vite-plugin-svelte": "7.1.2",
68
+ "@types/node": "26.6.5",
69
+ "jsdom": "30.1.3",
70
+ "svelte": "5.57.2",
71
+ "svelte-check": "4.7.7",
72
+ "typescript": "6.0.3",
73
+ "vite": "8.3.5",
74
+ "vitest": "4.1.12"
75
+ }
76
+ }