@meistrari/tela-build 1.98.2 → 1.100.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  Latest updates and announcements.
4
4
 
5
+ ## November 5, 2026
6
+
7
+ - [Chat](/templates/chat#plan) adds `TelaChatPlan` and `TelaChatPlanActions`: a plan the assistant proposes before creating something, with one row per item (or numbered steps) that the user clicks to edit inline, an edit mode to reorder, remove and add steps, and a bar with the submit button, "Edit plan" and a hint. Both are controlled; the host keeps the items and decides what submitting does.
8
+ - [Chat](/templates/chat) `TelaChatConversation` clips its overflow instead of hiding it, so focusing an input inside a message can no longer scroll the conversation sideways (editing a plan shifted the whole conversation to the left).
9
+
5
10
  ## November 3, 2026
6
11
 
7
12
  - [Animated Number](/components/animated-number) has a new animation, now handmade instead of `@number-flow/vue`: a changed digit rolls upward while its replacement comes in from below, blurring, fading and scaling down as they cross, over 280ms. Only the digits that changed animate, so adding a trailing digit (`123` to `1,231`) leaves the others in place, while separators and neighboring digits slide to their new positions. Each digit keeps its natural shape but is padded with margins to the width of the widest digit, measured with the digits' own font features such as `tabular-nums`, so changing digits don't push their neighbors around. Props and number formatting are unchanged, and the animation is skipped under `prefers-reduced-motion`.
@@ -126,6 +131,7 @@ Latest updates and announcements.
126
131
 
127
132
  ## October 8, 2026
128
133
 
134
+ - `useSound()` adds `playWhenAway(name, startedAt?, options?)` for long-running work: it plays only when the tab is hidden or when at least `minDurationMs` (default 5s) passed since `startedAt`, so fast results stay silent.
129
135
  - [Tooltip](/components/tooltip#multiline-tooltip) multiline is more compact: the title is `body-12-semibold` (was `body-14-semibold`), the description is `neutral-300` (was white at 90%), and the 2px gap between them is gone.
130
136
 
131
137
  ## October 7, 2026
@@ -147,6 +153,7 @@ Latest updates and announcements.
147
153
 
148
154
  ## October 5, 2026
149
155
 
156
+ - New `useSound()` composable plays UI sounds from the [`@web-kits/audio`](https://audio.raphaelsalaja.com) Minimal patch: 26 short sine-wave tones (`click`, `toggleOn`, `success`, `error`, `copy`, `delete`, and more) synthesized at runtime, with no audio files. `play(name, options?)` is silent during SSR and when sounds are turned off, and browsers drop it until the page's first user gesture. `enabled` and `volume` are shared across the app and persisted in localStorage.
150
157
  - [Floating chat](/templates/chat#floating) adds `position="left" | "right"` (default `right`) to place the launcher and panel in either bottom corner, with matching alignment and mirrored open/close animations.
151
158
  - [Kbd](/components/kbd) icon keys render a 12px icon inside the 16×16 key, and Enter is now `TelaKbd icon="i-ph-arrow-bend-down-left"`. `TelaKbdReturn` is deprecated and logs a warning in development.
152
159
 
@@ -1176,6 +1176,118 @@ Keyboard, while the card is expanded and enabled:
1176
1176
 
1177
1177
  Shortcuts are scoped to the card, and keystrokes typed into inputs are ignored. Changing `step.id` clears the correction input and moves focus to the new step. An option's `description` shows under its label.
1178
1178
 
1179
+ ### Plan
1180
+
1181
+ A plan the assistant proposes before creating something, for the user to review and change inline. `TelaChatPlan` is the card: a header with the resource icon and title, then one row per item with a title and a description. Clicking a row, or the pencil that shows on hover, opens an inline editor for its description (and its title, for steps). With `layout="steps"` the rows are numbered, and `editing` turns on edit mode to drag steps into a new order, edit or remove them and add new ones. `TelaChatPlanActions` is the bar under it: the submit button, "Edit plan" and a hint, or Save plan / Cancel while editing. Both are controlled: the host keeps the items, applies the edits and decides what submitting does.
1182
+
1183
+ ```vue
1184
+ <script setup lang="ts">
1185
+ import type { TelaChatPlanItem } from '@meistrari/tela-build/types'
1186
+
1187
+ const saved = ref<TelaChatPlanItem[]>([
1188
+ { id: 'input', title: 'Take the notice PDF as input', description: 'One file per run: upload it or send it through the API' },
1189
+ { id: 'read', title: 'Read the notice', description: 'Extract case number, court, parties and the deadline date' },
1190
+ { id: 'classify', title: 'Classify the notice', description: 'Urgent deadline, Appeal, Filing or Archive' },
1191
+ ])
1192
+ const items = ref([...saved.value])
1193
+ const editing = ref(false)
1194
+ const editingId = ref<string | null>(null)
1195
+
1196
+ function save(id: string, value: { title: string, description: string }) {
1197
+ items.value = items.value.map(item => item.id === id ? { ...item, ...value } : item)
1198
+ if (!editing.value)
1199
+ saved.value = [...items.value]
1200
+ }
1201
+
1202
+ function move(from: number, to: number) {
1203
+ const next = [...items.value]
1204
+ next.splice(to, 0, ...next.splice(from, 1))
1205
+ items.value = next
1206
+ }
1207
+
1208
+ function add() {
1209
+ const id = crypto.randomUUID()
1210
+ items.value = [...items.value, { id, title: '', description: '' }]
1211
+ editingId.value = id
1212
+ }
1213
+
1214
+ function cancelEdit(id: string) {
1215
+ items.value = items.value.filter(item => item.id !== id || item.title)
1216
+ }
1217
+
1218
+ function finish(keep: boolean) {
1219
+ if (keep)
1220
+ saved.value = [...items.value]
1221
+ items.value = [...saved.value]
1222
+ editing.value = false
1223
+ }
1224
+ </script>
1225
+
1226
+ <template>
1227
+ <div flex="~ col" gap-12px w-full>
1228
+ <TelaChatPlan
1229
+ v-model:editing-id="editingId"
1230
+ kind="workflow"
1231
+ title="Workflow plan"
1232
+ :status="editing ? 'editing' : `${items.length} steps`"
1233
+ layout="steps"
1234
+ :items="items"
1235
+ :editing="editing"
1236
+ @save="save"
1237
+ @cancel="cancelEdit"
1238
+ @remove="id => items = items.filter(item => item.id !== id)"
1239
+ @move="move"
1240
+ @add="add"
1241
+ />
1242
+ <TelaChatPlanActions
1243
+ submit-label="Build workflow"
1244
+ hint="Takes about 1 min · you can change anything later"
1245
+ can-edit
1246
+ :editing="editing"
1247
+ :disabled="!!editingId"
1248
+ @edit="editing = true"
1249
+ @save="finish(true)"
1250
+ @cancel="finish(false)"
1251
+ />
1252
+ </div>
1253
+ </template>
1254
+ ```
1255
+
1256
+ Plans for a single resource use the default `rows` layout with an `icon` per item:
1257
+
1258
+ ```vue
1259
+ <script setup lang="ts">
1260
+ import type { TelaChatPlanItem } from '@meistrari/tela-build/types'
1261
+
1262
+ const items = ref<TelaChatPlanItem[]>([
1263
+ { id: 'input', icon: 'input', title: 'Input: notice (file)', description: 'The PDF of one court notice' },
1264
+ { id: 'instructions', icon: 'instructions', title: 'Instructions', description: 'Read the notice and fill the fields below. Leave a field empty when it isn\'t in the text' },
1265
+ { id: 'output', icon: 'output', title: 'Output format · 6 attributes', description: 'case_number, court, judge_name, parties, deadline_date, category' },
1266
+ { id: 'model', icon: 'model', title: 'Model: Gemini 2.5 Flash', description: 'Good with long PDFs; you can switch it later' },
1267
+ { id: 'test', icon: 'test', title: 'Run a sample', description: 'I\'ll test it on a sample notice so you can check the result', editable: false },
1268
+ ])
1269
+
1270
+ function save(id: string, value: { title: string, description: string }) {
1271
+ items.value = items.value.map(item => item.id === id ? { ...item, ...value } : item)
1272
+ }
1273
+ </script>
1274
+
1275
+ <template>
1276
+ <div flex="~ col" gap-12px w-full>
1277
+ <TelaChatPlan
1278
+ kind="canvas"
1279
+ title="Canvas plan"
1280
+ status="updated"
1281
+ :items="items"
1282
+ @save="save"
1283
+ />
1284
+ <TelaChatPlanActions submit-label="Build canvas" hint="Plan updated · takes about 20 s" />
1285
+ </div>
1286
+ </template>
1287
+ ```
1288
+
1289
+ **`Escape`** in the inline editor cancels it. While an item is open, the other pencils and remove buttons hide and "Add step" is disabled; disable the actions bar too (`:disabled="!!editingId"`), so the plan is never submitted with an unsaved edit.
1290
+
1179
1291
  ### Working Indicator
1180
1292
 
1181
1293
  The running state of an assistant turn: a small `TelaLoadersSquare`, a label (`Working` by default) and an elapsed counter. Show it whenever something is running. A running turn is one `TelaChatMessage`: put the indicator and anything else the wait needs (a shimmering activity line, a reasoning trace) inside it, and the message stacks them 8px apart while the conversation keeps its 16px between turns. Pass `started-at` (epoch ms) and it ticks by itself; pass `elapsed` (seconds) to drive it from the host, for example from a server-reported duration.
@@ -1331,6 +1443,8 @@ import { TelaChatIconsAnthropic, TelaChatIconsGemini, TelaChatIconsOpenai } from
1331
1443
  | `TelaChatSidepanelWindow` | Always-open, in-flow docked column for the sidepanel variant. |
1332
1444
  | `TelaChatAnswer` | Controlled single/multiple-choice question card; emits intent only, the host owns state and submission. |
1333
1445
  | `TelaChatTaskReview` | Controlled field-by-field review card (value, lettered options, correction input, item rows); emits intent only. |
1446
+ | `TelaChatPlan` | Controlled plan card: items or numbered steps with inline editing, and an edit mode to reorder, remove and add steps; emits intent only. |
1447
+ | `TelaChatPlanActions` | Bar under a plan: submit, "Edit plan" and a hint, or Save plan / Cancel while editing. |
1334
1448
  | `TelaChatWorkingIndicator` | Running-turn row: square loader, label, elapsed time. |
1335
1449
  | `TelaChatStopRunButton` | Replaces the prompt input while a turn runs; centered pill that emits `stop`. |
1336
1450
  | `TelaChatAnimateEnter` | Enter/exit preset (fade, slide, slight scale) for a surface that comes and goes; when it wraps the prompt input or stop button the body docks the wrapper. Pair with `AnimatePresence`. |
@@ -1722,6 +1836,52 @@ type TelaChatTaskReviewRow = {
1722
1836
  }
1723
1837
  ```
1724
1838
 
1839
+ ### Plan
1840
+
1841
+ ```typescript
1842
+ type PlanProps = {
1843
+ title: string // "Canvas plan"
1844
+ items: TelaChatPlanItem[]
1845
+ kind?: string // 'canvas' | 'workflow' | 'agent' pick the header icon; anything else gets a neutral one
1846
+ status?: string // appended to the title: "5 steps", "editing", "updated"
1847
+ layout?: 'rows' | 'steps' // default: 'rows'; steps are numbered instead of showing an icon
1848
+ editing?: boolean // edit mode: drag to reorder, remove and add steps
1849
+ editingId?: string | null // v-model:editing-id; the item open in the inline editor
1850
+ loading?: boolean // skeleton rows instead of the items
1851
+ disabled?: boolean // hides the edit and remove actions, locks an open editor, blocks dragging and add
1852
+ labels?: Partial<TelaChatPlanLabels>
1853
+ }
1854
+
1855
+ type PlanEmits = {
1856
+ save: [id: string, value: { title: string, description: string }] // inline editor saved; trimmed
1857
+ cancel: [id: string] // inline editor closed without saving
1858
+ remove: [id: string] // the remove button is hidden on the last remaining step and while an editor is open
1859
+ move: [from: number, to: number] // a step was dropped on another position
1860
+ add: []
1861
+ }
1862
+
1863
+ type PlanActionsProps = {
1864
+ submitLabel: string // "Build canvas"
1865
+ hint?: string // "Takes about 20 s · you can change anything later"
1866
+ canEdit?: boolean // shows "Edit plan"
1867
+ editing?: boolean // Save plan / Cancel and the edit hint instead
1868
+ disabled?: boolean
1869
+ submitting?: boolean // spinner on the submit button and disables both buttons
1870
+ labels?: Partial<TelaChatPlanActionsLabels>
1871
+ }
1872
+
1873
+ type PlanActionsEmits = { submit: [], edit: [], save: [], cancel: [] }
1874
+
1875
+ // import type { ... } from '@meistrari/tela-build/types'
1876
+ type TelaChatPlanItem = {
1877
+ id: string
1878
+ title: string
1879
+ description: string // the text the inline editor changes
1880
+ icon?: TelaChatPlanIcon // 'input' | 'instructions' | 'output' | 'model' | 'test' | 'purpose' | 'skills' | 'rules'
1881
+ editable?: boolean // default: true; false hides the edit and remove actions
1882
+ }
1883
+ ```
1884
+
1725
1885
  ### Working Indicator
1726
1886
 
1727
1887
  ```typescript
@@ -1828,6 +1988,7 @@ Where each primitive lives in `components/tela/chat/`. Component names come from
1828
1988
  | `message/` | `TelaChatMessage` with avatar, content, and feedback controls. |
1829
1989
  | `answer/` | `TelaChatAnswer`, choice questions the assistant asks inline. |
1830
1990
  | `task-review/` | `TelaChatTaskReview`, the card for confirming or correcting extracted values one by one. |
1991
+ | `plan/` | `TelaChatPlan` and `TelaChatPlanActions`, a plan the user can edit before the assistant builds it. |
1831
1992
  | `chat-empty-state.vue` | `TelaChatEmptyState`, shown before the first message. |
1832
1993
  | `chat-suggestions.vue`, `chat-suggestion.vue` | Suggested prompts. |
1833
1994
  | `chat-reasoning-step.vue` | `TelaChatReasoningStep`, collapsible tool or reasoning entry. |
@@ -52,11 +52,12 @@ const { fogClass } = useScrollFog(fogTarget, () => {
52
52
  </script>
53
53
 
54
54
  <template>
55
+ <!-- overflow-clip: an overflow-hidden root can still be scrolled, and focusing an input inside it shifts the conversation sideways -->
55
56
  <TelaScrollArea
56
57
  v-if="useScrollAreaViewport"
57
58
  ref="scrollAreaRef"
58
59
  v-bind="$attrs"
59
- class="flex-1 min-h-0"
60
+ class="flex-1 min-h-0 overflow-clip"
60
61
  :class="[fogClass]"
61
62
  scroll-thumb-class="chat-conversation-scrollbar"
62
63
  data-chat-conversation-viewport
@@ -0,0 +1,53 @@
1
+ <script setup lang="ts">
2
+ import type { TelaChatPlanActionsLabels } from '../../../../types/chat-plan'
3
+
4
+ const props = withDefaults(defineProps<{
5
+ submitLabel: string
6
+ hint?: string
7
+ canEdit?: boolean
8
+ editing?: boolean
9
+ disabled?: boolean
10
+ submitting?: boolean
11
+ labels?: Partial<TelaChatPlanActionsLabels>
12
+ }>(), {
13
+ labels: () => ({}),
14
+ })
15
+
16
+ const emit = defineEmits<{
17
+ submit: []
18
+ edit: []
19
+ save: []
20
+ cancel: []
21
+ }>()
22
+
23
+ const copy = computed<TelaChatPlanActionsLabels>(() => ({
24
+ editPlan: 'Edit plan',
25
+ savePlan: 'Save plan',
26
+ cancel: 'Cancel',
27
+ editHint: 'Drag to reorder · changes apply when you save',
28
+ ...props.labels,
29
+ }))
30
+ </script>
31
+
32
+ <template>
33
+ <div flex items-center flex-wrap gap-8px>
34
+ <template v-if="editing">
35
+ <TelaButton size="sm" :disabled="disabled" @click="emit('save')">
36
+ {{ copy.savePlan }}
37
+ </TelaButton>
38
+ <TelaButton variant="secondary" size="sm" :disabled="disabled" @click="emit('cancel')">
39
+ {{ copy.cancel }}
40
+ </TelaButton>
41
+ <span body-12-regular text-tertiary>{{ copy.editHint }}</span>
42
+ </template>
43
+ <template v-else>
44
+ <TelaButton icon="i-ph-arrow-right" :disabled="disabled || submitting" :loading="submitting" @click="emit('submit')">
45
+ {{ submitLabel }}
46
+ </TelaButton>
47
+ <TelaButton v-if="canEdit" variant="secondary" :disabled="disabled || submitting" @click="emit('edit')">
48
+ {{ copy.editPlan }}
49
+ </TelaButton>
50
+ <span v-if="hint" body-12-regular text-tertiary>{{ hint }}</span>
51
+ </template>
52
+ </div>
53
+ </template>
@@ -0,0 +1,189 @@
1
+ <script setup lang="ts">
2
+ import type { TelaChatPlanItem, TelaChatPlanKind, TelaChatPlanLabels } from '../../../../types/chat-plan'
3
+
4
+ const props = withDefaults(defineProps<{
5
+ title: string
6
+ items: TelaChatPlanItem[]
7
+ kind?: TelaChatPlanKind | (string & {})
8
+ status?: string
9
+ layout?: 'rows' | 'steps'
10
+ editing?: boolean
11
+ loading?: boolean
12
+ disabled?: boolean
13
+ labels?: Partial<TelaChatPlanLabels>
14
+ }>(), {
15
+ layout: 'rows',
16
+ labels: () => ({}),
17
+ })
18
+
19
+ const emit = defineEmits<{
20
+ save: [id: string, value: { title: string, description: string }]
21
+ cancel: [id: string]
22
+ remove: [id: string]
23
+ move: [from: number, to: number]
24
+ add: []
25
+ }>()
26
+
27
+ const editingId = defineModel<string | null>('editingId', { default: null })
28
+
29
+ const copy = computed<TelaChatPlanLabels>(() => ({
30
+ edit: 'Edit',
31
+ remove: 'Remove step',
32
+ reorder: 'Drag to reorder',
33
+ addStep: 'Add step',
34
+ cancel: 'Cancel',
35
+ save: 'Save',
36
+ saveStep: 'Save step',
37
+ titlePlaceholder: 'Step name',
38
+ descriptionPlaceholder: 'Add a description',
39
+ ...props.labels,
40
+ }))
41
+
42
+ const KINDS: Record<string, { icon: string, class: string }> = {
43
+ canvas: { icon: 'i-custom:canvas', class: 'bg-blue-100 text-blue-600 [&>div]:size-12px!' },
44
+ workflow: { icon: 'i-ph-arrows-split-bold', class: 'bg-cyan-100 text-cyan-600 [&>div]:size-14px!' },
45
+ agent: { icon: 'i-ph-navigation-arrow-bold', class: 'bg-purple-100 text-purple-600 [&>div]:size-14px!' },
46
+ }
47
+
48
+ const ICONS: Record<string, string> = {
49
+ input: 'i-ph-paperclip',
50
+ instructions: 'i-ph-file-text',
51
+ output: 'i-ph-at',
52
+ model: 'i-ph-cpu',
53
+ test: 'i-ph-test-tube',
54
+ purpose: 'i-ph-target',
55
+ skills: 'i-ph-lightning',
56
+ rules: 'i-ph-warning',
57
+ }
58
+
59
+ const kindIcon = computed(() => KINDS[props.kind ?? ''] ?? { icon: 'i-ph-list-bullets', class: 'bg-lowered text-icon-secondary [&>div]:size-14px!' })
60
+ const heading = computed(() => [props.title, props.status].filter(Boolean).join(' · '))
61
+ const isSteps = computed(() => props.layout === 'steps')
62
+
63
+ const root = ref<HTMLElement | null>(null)
64
+ const draftTitle = ref('')
65
+ const draftDescription = ref('')
66
+ const dragFrom = ref<number | null>(null)
67
+
68
+ watch(editingId, (id) => {
69
+ const item = props.items.find(item => item.id === id)
70
+ draftTitle.value = item?.title ?? ''
71
+ draftDescription.value = item?.description ?? ''
72
+ if (id && !isSteps.value)
73
+ nextTick(() => root.value?.querySelector('textarea')?.focus())
74
+ }, { immediate: true })
75
+
76
+ function canEdit(item: TelaChatPlanItem) {
77
+ return item.editable !== false && !props.disabled && !editingId.value
78
+ }
79
+
80
+ const canSave = computed(() => !props.disabled && (!isSteps.value || draftTitle.value.trim().length > 0))
81
+
82
+ function save() {
83
+ if (!editingId.value || !canSave.value)
84
+ return
85
+ emit('save', editingId.value, { title: draftTitle.value.trim(), description: draftDescription.value.trim() })
86
+ editingId.value = null
87
+ }
88
+
89
+ function cancel() {
90
+ if (!editingId.value)
91
+ return
92
+ emit('cancel', editingId.value)
93
+ editingId.value = null
94
+ }
95
+
96
+ function drop(to: number) {
97
+ if (dragFrom.value !== null && dragFrom.value !== to)
98
+ emit('move', dragFrom.value, to)
99
+ dragFrom.value = null
100
+ }
101
+ </script>
102
+
103
+ <template>
104
+ <div ref="root" flex="~ col" gap-12px w-full p-12px rounded-12px border-0.5px border bg>
105
+ <div flex items-center gap-8px min-w-0>
106
+ <TelaIcon :name="kindIcon.icon" size="inherit" :background-class="cn('size-24px rounded-7px shrink-0', kindIcon.class)" />
107
+ <span body-14-medium text-primary truncate>{{ heading }}</span>
108
+ </div>
109
+
110
+ <div v-if="loading" flex="~ col" gap-8px>
111
+ <TelaSkeleton h-36px w-full />
112
+ <TelaSkeleton h-36px w-full />
113
+ <TelaSkeleton h-36px w="2/3" />
114
+ </div>
115
+
116
+ <div v-else role="list" flex="~ col" mx--8px>
117
+ <div
118
+ v-for="(item, index) in items"
119
+ :key="item.id"
120
+ flex items-start gap-8px
121
+ :class="editingId === item.id
122
+ ? 'p-8px rounded-10px bg-muted'
123
+ : cn('group px-8px py-10px rounded-8px', { 'hover:bg-muted': !disabled })"
124
+ :draggable="editing && !disabled && editingId !== item.id"
125
+ role="listitem"
126
+ @dragstart="dragFrom = index; $event.dataTransfer?.setData('text/plain', item.id)"
127
+ @dragover.prevent
128
+ @drop="drop(index)"
129
+ @dragend="dragFrom = null"
130
+ >
131
+ <div flex items-center gap-6px shrink-0>
132
+ <TelaIcon v-if="editing" name="i-ph-dots-six-vertical" size="12px" color="icon-tertiary" cursor-grab :title="copy.reorder" />
133
+ <div flex justify-center w-24px>
134
+ <span v-if="isSteps" flex items-center justify-center size-20px rounded-full bg-muted body-12-medium text-secondary>
135
+ {{ index + 1 }}
136
+ </span>
137
+ <TelaIcon v-else :name="ICONS[item.icon ?? ''] ?? 'i-ph-circle'" size="12px" color="icon-secondary" background-class="size-20px rounded-6px bg-muted" />
138
+ </div>
139
+ </div>
140
+
141
+ <div v-if="editingId === item.id" flex="~ col" gap-8px flex-1 min-w-0 @keydown.esc.stop.prevent="cancel">
142
+ <TelaInput v-if="isSteps" v-model="draftTitle" autofocus :disabled="disabled" :placeholder="copy.titlePlaceholder" />
143
+ <span v-else body-14-medium text-primary>{{ item.title }}</span>
144
+ <TelaTextarea v-model="draftDescription" :disabled="disabled" :placeholder="copy.descriptionPlaceholder" />
145
+ <div flex justify-end gap-4px>
146
+ <TelaButton variant="ghost" size="sm" @click="cancel">
147
+ {{ copy.cancel }}
148
+ </TelaButton>
149
+ <TelaButton size="sm" :disabled="!canSave" @click="save">
150
+ {{ isSteps ? copy.saveStep : copy.save }}
151
+ </TelaButton>
152
+ </div>
153
+ </div>
154
+
155
+ <template v-else>
156
+ <div
157
+ flex="~ col" gap-2px flex-1 min-w-0
158
+ :class="{ 'cursor-pointer': canEdit(item) }"
159
+ @click="canEdit(item) && (editingId = item.id)"
160
+ >
161
+ <span body-14-medium text-primary break-words>{{ item.title }}</span>
162
+ <span v-if="item.description" body-12-regular text-secondary break-words line-clamp-2>{{ item.description }}</span>
163
+ </div>
164
+ <TelaIconButton
165
+ v-if="canEdit(item)"
166
+ size="3xs"
167
+ icon="i-ph-pencil-simple"
168
+ color="secondary"
169
+ button-class="opacity-0 group-hover:opacity-100 focus-visible:opacity-100"
170
+ :label="copy.edit"
171
+ @click="editingId = item.id"
172
+ />
173
+ <TelaIconButton
174
+ v-if="editing && canEdit(item) && items.length > 1"
175
+ size="3xs"
176
+ icon="i-ph-trash"
177
+ color="secondary"
178
+ :label="copy.remove"
179
+ @click="emit('remove', item.id)"
180
+ />
181
+ </template>
182
+ </div>
183
+ </div>
184
+
185
+ <TelaButton v-if="editing" variant="ghost" size="sm" icon="i-ph-plus-circle" leading self-start :disabled="disabled || !!editingId" @click="emit('add')">
186
+ {{ copy.addStep }}
187
+ </TelaButton>
188
+ </div>
189
+ </template>
@@ -0,0 +1,65 @@
1
+ import type { PlayOptions, VoiceHandle } from '@web-kits/audio'
2
+ import { createGlobalState, useLocalStorage } from '@vueuse/core'
3
+ import { defineSound } from '@web-kits/audio'
4
+ import * as minimal from '../utils/sounds/minimal'
5
+
6
+ const { _patch, _delete, ...rest } = minimal
7
+ const sounds = { ...rest, delete: _delete }
8
+
9
+ export type TelaSoundName = keyof typeof sounds
10
+
11
+ type Player = (options?: PlayOptions) => VoiceHandle
12
+
13
+ const players = new Map<TelaSoundName, Player>()
14
+
15
+ function getPlayer(name: TelaSoundName) {
16
+ const existing = players.get(name)
17
+
18
+ if (existing)
19
+ return existing
20
+
21
+ const player = defineSound(sounds[name])
22
+
23
+ players.set(name, player)
24
+
25
+ return player
26
+ }
27
+
28
+ const useSoundSettings = createGlobalState(() => ({
29
+ enabled: useLocalStorage('tela-sounds-enabled', true),
30
+ volume: useLocalStorage('tela-sounds-volume', 1),
31
+ }))
32
+
33
+ export function useSound() {
34
+ const { enabled, volume } = useSoundSettings()
35
+
36
+ function play(name: TelaSoundName, options: PlayOptions = {}): VoiceHandle | undefined {
37
+ if (typeof window === 'undefined' || !enabled.value || volume.value <= 0)
38
+ return undefined
39
+
40
+ try {
41
+ return getPlayer(name)({ ...options, volume: (options.volume ?? 1) * volume.value })
42
+ }
43
+ catch {
44
+ return undefined
45
+ }
46
+ }
47
+
48
+ function playWhenAway(name: TelaSoundName, startedAt?: number, options: PlayOptions & { minDurationMs?: number } = {}) {
49
+ const { minDurationMs = 5000, ...playOptions } = options
50
+ const isHidden = typeof document !== 'undefined' && document.hidden
51
+ const tookLong = startedAt !== undefined && Date.now() - startedAt >= minDurationMs
52
+
53
+ if (!isHidden && !tookLong)
54
+ return undefined
55
+
56
+ return play(name, playOptions)
57
+ }
58
+
59
+ return {
60
+ play,
61
+ playWhenAway,
62
+ enabled,
63
+ volume,
64
+ }
65
+ }
package/docs/sounds.md ADDED
@@ -0,0 +1,94 @@
1
+ # Sounds
2
+
3
+ UI sounds come from `useSound()`, which plays short, quiet sine-wave tones synthesized at runtime, with no audio files. Sound is feedback. Treat it like animation: use it rarely and on purpose.
4
+
5
+ ```vue
6
+ <script setup lang="ts">
7
+ const { play } = useSound()
8
+
9
+ async function save() {
10
+ await saveDocument()
11
+ play('success')
12
+ }
13
+ </script>
14
+
15
+ <template>
16
+ <TelaButton @click="save">
17
+ Save
18
+ </TelaButton>
19
+ </template>
20
+ ```
21
+
22
+ ## Only for moments that matter
23
+
24
+ Be careful when adding a sound. Sounds are for unique moments the user would hate to miss: publishing something, a run or long task finishing, an upload completing, someone joining the page. Most actions, including deletes, favorites, toggles and navigation, stay silent.
25
+
26
+ Before adding one, search the app for existing `useSound()` calls. If the new moment isn't as important as the ones already there, don't add it. A few meaningful sounds are worth more than many small ones, so don't add too many.
27
+
28
+ ## Should this make a sound?
29
+
30
+ Answer the same frequency question as for [animations](#animations), but be stricter. A sound reaches everyone in the room.
31
+
32
+ | Frequency | Decision |
33
+ | ------------------------------------------------------- | -------------------------- |
34
+ | 100+ times/day (typing, keyboard shortcuts, hover) | No sound. Ever. |
35
+ | Tens of times/day (tabs, toggles, list selection) | No sound by default |
36
+ | Occasional (send, copy, delete, save) | No sound by default |
37
+ | Rare (publish, a run or upload finishes, someone joins) | Sound helps |
38
+
39
+ - **Pair sound with something visible.** Sound confirms what the screen already shows. It never carries information on its own, because many users run muted.
40
+ - **Play one sound per action.** Don't stack `click` + `success` on the same press.
41
+ - **Play from a user gesture or the result of one.** Browsers keep audio suspended until the first interaction, so a sound triggered on page load is dropped.
42
+ - **Never play on hover or on keyboard-initiated actions**, even though `hover` and `keyPress` exist in the patch.
43
+
44
+ ## Sound names
45
+
46
+ | Name | Use for |
47
+ | ------------------------------------ | ------------------------------------------------ |
48
+ | `tap`, `click` | A primary press that has no other feedback |
49
+ | `toggleOn`, `toggleOff`, `checkbox` | Settings that change state |
50
+ | `select`, `deselect` | Picking items in a multi-select surface |
51
+ | `expand`, `collapse` | Disclosure panels |
52
+ | `tabSwitch`, `pageEnter`, `pageExit` | Navigation (rarely: see the frequency table) |
53
+ | `success`, `error`, `warning`, `info` | Results of async work, alongside a toast or `TelaStatus` |
54
+ | `notification` | Something arrived that the user didn't trigger |
55
+ | `copy`, `send`, `delete`, `undo` | The matching actions |
56
+ | `pop`, `swoosh`, `slide` | Elements entering or leaving |
57
+ | `hover`, `keyPress` | Avoid. They exist in the patch for completeness |
58
+
59
+ ## Long-running work
60
+
61
+ A run that finishes in a second needs no sound: the user is still looking at it. `playWhenAway(name, startedAt?, options?)` plays only when the tab is hidden or when at least `minDurationMs` (default `5000`) passed since `startedAt`, a `Date.now()` timestamp:
62
+
63
+ ```ts
64
+ const { playWhenAway } = useSound()
65
+
66
+ const startedAt = Date.now()
67
+ const result = await runWorkflow()
68
+ playWhenAway(result.ok ? 'success' : 'error', startedAt)
69
+ ```
70
+
71
+ Without `startedAt`, it plays only when the tab is hidden.
72
+
73
+ ## Settings
74
+
75
+ `enabled` and `volume` are shared refs. They are global across the app and persisted in localStorage (`tela-sounds-enabled`, `tela-sounds-volume`). Bind them to a user preference instead of creating your own flag:
76
+
77
+ ```vue
78
+ <script setup lang="ts">
79
+ const { enabled } = useSound()
80
+ </script>
81
+
82
+ <template>
83
+ <label flex items-center justify-between gap-12px>
84
+ <span body-14-medium text-primary>Interface sounds</span>
85
+ <TelaSwitch v-model="enabled" />
86
+ </label>
87
+ </template>
88
+ ```
89
+
90
+ `play(name, options)` accepts `@web-kits/audio` `PlayOptions`. `volume` multiplies the global volume, and `jitter` adds small random variation to a sound that repeats:
91
+
92
+ ```ts
93
+ play('copy', { jitter: { detune: 40, volume: 0.1 } })
94
+ ```
@@ -1013,6 +1013,7 @@ spacing, border radius, optical alignment. Triggers on UI polish, "feels off", d
1013
1013
  | Surfaces | Border radius, depth strategy, elevation, outlines, hit areas |
1014
1014
  | Typography | Heading tokens, body font sizes, font weights |
1015
1015
  | Animations | Deciding when to animate, easing, duration, springs, and staggered enter animations |
1016
+ | Sounds | Deciding when an action plays a UI sound, picking the sound, and wiring \`useSound()\` |
1016
1017
 
1017
1018
  ## Common Mistakes
1018
1019
 
package/nuxt.config.ts CHANGED
@@ -108,6 +108,7 @@ export default defineNuxtConfig({
108
108
  // components makes Vite discover the dep mid-session, re-optimize, and
109
109
  // hard-reload the browser. Prebundling them up front keeps dev stable.
110
110
  include: [
111
+ '@web-kits/audio',
111
112
  'clsx',
112
113
  'date-fns',
113
114
  'radix-vue',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/tela-build",
3
- "version": "1.98.2",
3
+ "version": "1.100.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "app.config.ts",
@@ -39,6 +39,7 @@
39
39
  "@vueuse/components": "12.8.2",
40
40
  "@vueuse/core": "12.8.2",
41
41
  "@vueuse/nuxt": "12.8.2",
42
+ "@web-kits/audio": "0.2.0",
42
43
  "beautiful-mermaid": "1.1.3",
43
44
  "class-variance-authority": "0.7.0",
44
45
  "clsx": "2.1.1",
@@ -0,0 +1,30 @@
1
+ export type TelaChatPlanKind = 'canvas' | 'workflow' | 'agent'
2
+
3
+ export type TelaChatPlanIcon = 'input' | 'instructions' | 'output' | 'model' | 'test' | 'purpose' | 'skills' | 'rules'
4
+
5
+ export interface TelaChatPlanItem {
6
+ id: string
7
+ title: string
8
+ description: string
9
+ icon?: TelaChatPlanIcon | (string & {})
10
+ editable?: boolean
11
+ }
12
+
13
+ export interface TelaChatPlanLabels {
14
+ edit: string
15
+ remove: string
16
+ reorder: string
17
+ addStep: string
18
+ cancel: string
19
+ save: string
20
+ saveStep: string
21
+ titlePlaceholder: string
22
+ descriptionPlaceholder: string
23
+ }
24
+
25
+ export interface TelaChatPlanActionsLabels {
26
+ editPlan: string
27
+ savePlan: string
28
+ cancel: string
29
+ editHint: string
30
+ }
package/types/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './chat-answer'
2
+ export * from './chat-plan'
2
3
  export * from './chat-task-review'
3
4
  export * from './combobox'
4
5
  export * from './custom-icon'
@@ -0,0 +1,35 @@
1
+ // Minimal — generated by @web-kits/audio, lint-formatted. Do not tune by hand.
2
+ // Source: `npx @web-kits/audio add raphaelsalaja/audio --patch minimal`
3
+ import type { SoundDefinition, SoundPatch } from '@web-kits/audio'
4
+
5
+ export const tap: SoundDefinition = { source: { type: 'sine', frequency: 1200 }, envelope: { attack: 0, decay: 0.012, sustain: 0, release: 0.004 }, gain: 0.08 }
6
+ export const click: SoundDefinition = { source: { type: 'sine', frequency: 800 }, envelope: { attack: 0, decay: 0.015, sustain: 0, release: 0.005 }, gain: 0.1 }
7
+ export const keyPress: SoundDefinition = { source: { type: 'sine', frequency: 1100 }, envelope: { attack: 0, decay: 0.01, sustain: 0, release: 0.003 }, gain: 0.06 }
8
+ export const toggleOn: SoundDefinition = { layers: [{ source: { type: 'sine', frequency: 880 }, envelope: { attack: 0, decay: 0.02, sustain: 0, release: 0.006 }, gain: 0.08 }, { source: { type: 'sine', frequency: 1320 }, envelope: { attack: 0, decay: 0.02, sustain: 0, release: 0.006 }, delay: 0.03, gain: 0.07 }] }
9
+ export const toggleOff: SoundDefinition = { layers: [{ source: { type: 'sine', frequency: 1320 }, envelope: { attack: 0, decay: 0.02, sustain: 0, release: 0.006 }, gain: 0.08 }, { source: { type: 'sine', frequency: 880 }, envelope: { attack: 0, decay: 0.02, sustain: 0, release: 0.006 }, delay: 0.03, gain: 0.07 }] }
10
+ export const checkbox: SoundDefinition = { source: { type: 'sine', frequency: 1000 }, envelope: { attack: 0, decay: 0.018, sustain: 0, release: 0.005 }, gain: 0.09 }
11
+ export const select: SoundDefinition = { source: { type: 'sine', frequency: 1100 }, envelope: { attack: 0, decay: 0.02, sustain: 0, release: 0.006 }, gain: 0.08 }
12
+ export const deselect: SoundDefinition = { source: { type: 'sine', frequency: 900 }, envelope: { attack: 0, decay: 0.018, sustain: 0, release: 0.005 }, gain: 0.06 }
13
+ export const hover: SoundDefinition = { source: { type: 'sine', frequency: 1300 }, envelope: { attack: 0, decay: 0.01, sustain: 0, release: 0.004 }, gain: 0.04 }
14
+ export const tabSwitch: SoundDefinition = { source: { type: 'sine', frequency: 1050 }, envelope: { attack: 0, decay: 0.015, sustain: 0, release: 0.005 }, gain: 0.07 }
15
+ export const expand: SoundDefinition = { source: { type: 'sine', frequency: { start: 800, end: 1000 } }, envelope: { attack: 0, decay: 0.04, sustain: 0, release: 0.012 }, gain: 0.06 }
16
+ export const collapse: SoundDefinition = { source: { type: 'sine', frequency: { start: 1000, end: 800 } }, envelope: { attack: 0, decay: 0.04, sustain: 0, release: 0.012 }, gain: 0.06 }
17
+ export const pageEnter: SoundDefinition = { source: { type: 'sine', frequency: { start: 700, end: 900 } }, envelope: { attack: 0.003, decay: 0.04, sustain: 0, release: 0.015 }, gain: 0.05 }
18
+ export const pageExit: SoundDefinition = { source: { type: 'sine', frequency: { start: 900, end: 700 } }, envelope: { attack: 0, decay: 0.04, sustain: 0, release: 0.015 }, gain: 0.04 }
19
+ export const success: SoundDefinition = { layers: [{ source: { type: 'sine', frequency: 523 }, envelope: { attack: 0, decay: 0.05, sustain: 0, release: 0.015 }, gain: 0.1 }, { source: { type: 'sine', frequency: 784 }, envelope: { attack: 0, decay: 0.05, sustain: 0, release: 0.015 }, delay: 0.06, gain: 0.08 }] }
20
+ export const error: SoundDefinition = { layers: [{ source: { type: 'sine', frequency: 300 }, envelope: { attack: 0, decay: 0.04, sustain: 0, release: 0.012 }, gain: 0.12 }, { source: { type: 'sine', frequency: 280 }, envelope: { attack: 0, decay: 0.04, sustain: 0, release: 0.012 }, delay: 0.01, gain: 0.1 }] }
21
+ export const warning: SoundDefinition = { layers: [{ source: { type: 'sine', frequency: 440 }, envelope: { attack: 0, decay: 0.03, sustain: 0, release: 0.01 }, gain: 0.1 }, { source: { type: 'sine', frequency: 466 }, envelope: { attack: 0, decay: 0.03, sustain: 0, release: 0.01 }, delay: 0.008, gain: 0.08 }] }
22
+ export const notification: SoundDefinition = { layers: [{ source: { type: 'sine', frequency: 660 }, envelope: { attack: 0, decay: 0.05, sustain: 0, release: 0.02 }, gain: 0.1 }, { source: { type: 'sine', frequency: 880 }, envelope: { attack: 0, decay: 0.04, sustain: 0, release: 0.015 }, delay: 0.08, gain: 0.08 }] }
23
+ export const info: SoundDefinition = { source: { type: 'sine', frequency: 880 }, envelope: { attack: 0, decay: 0.04, sustain: 0, release: 0.015 }, gain: 0.08 }
24
+ export const copy: SoundDefinition = { layers: [{ source: { type: 'sine', frequency: 1000 }, envelope: { attack: 0, decay: 0.012, sustain: 0, release: 0.004 }, gain: 0.08 }, { source: { type: 'sine', frequency: 1200 }, envelope: { attack: 0, decay: 0.012, sustain: 0, release: 0.004 }, delay: 0.035, gain: 0.07 }] }
25
+ export const send: SoundDefinition = { source: { type: 'sine', frequency: { start: 600, end: 1000 } }, envelope: { attack: 0, decay: 0.04, sustain: 0, release: 0.012 }, gain: 0.08 }
26
+ export const _delete: SoundDefinition = { source: { type: 'sine', frequency: { start: 500, end: 250 } }, envelope: { attack: 0, decay: 0.05, sustain: 0, release: 0.015 }, gain: 0.1 }
27
+ export const undo: SoundDefinition = { source: { type: 'sine', frequency: { start: 800, end: 600 } }, envelope: { attack: 0, decay: 0.035, sustain: 0, release: 0.01 }, gain: 0.07 }
28
+ export const pop: SoundDefinition = { source: { type: 'sine', frequency: { start: 400, end: 200 } }, envelope: { attack: 0, decay: 0.04, sustain: 0, release: 0.012 }, gain: 0.1 }
29
+ export const swoosh: SoundDefinition = { source: { type: 'sine', frequency: { start: 600, end: 1400 } }, envelope: { attack: 0.005, decay: 0.04, sustain: 0, release: 0.015 }, gain: 0.05 }
30
+ export const slide: SoundDefinition = { source: { type: 'sine', frequency: { start: 800, end: 1100 } }, envelope: { attack: 0.003, decay: 0.035, sustain: 0, release: 0.012 }, gain: 0.05 }
31
+
32
+ export const _patch: SoundPatch = {
33
+ ...{ name: 'Minimal', author: 'Raphael Salaja', version: '1.0.0', description: 'Pure sine waves, ultra-clean feedback — the quietest, most transparent UI sounds', tags: ['ui', 'minimal', 'clean', 'sine'] },
34
+ sounds: { tap, click, 'key-press': keyPress, 'toggle-on': toggleOn, 'toggle-off': toggleOff, checkbox, select, deselect, hover, 'tab-switch': tabSwitch, expand, collapse, 'page-enter': pageEnter, 'page-exit': pageExit, success, error, warning, notification, info, copy, send, 'delete': _delete, undo, pop, swoosh, slide },
35
+ }