@meistrari/tela-build 1.98.2 → 1.99.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 +5 -0
- package/components/tela/chat/chat.mdx +161 -0
- package/components/tela/chat/conversation/conversation.vue +2 -1
- package/components/tela/chat/plan/plan-actions.vue +53 -0
- package/components/tela/chat/plan/plan.vue +189 -0
- package/package.json +1 -1
- package/types/chat-plan.ts +30 -0
- package/types/index.ts +1 -0
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`.
|
|
@@ -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>
|
package/package.json
CHANGED
|
@@ -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
|
+
}
|