@meistrari/tela-build 1.81.0 → 1.81.1
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,10 @@
|
|
|
2
2
|
|
|
3
3
|
Latest updates and announcements.
|
|
4
4
|
|
|
5
|
+
## October 7, 2026
|
|
6
|
+
|
|
7
|
+
- [Chat](/templates/chat) bodies and conversations no longer use `:has()` selectors to detect the docked prompt input and to place the scroll fog. `TelaChatBody` sets `data-has-prompt-input` on itself, and `TelaChatConversation` marks its scroll-area viewport with `data-chat-conversation-viewport` and `data-scroll-fog`. Every DOM change inside a long conversation re-tested those selectors; in a 3,000-event transcript this cuts style recalculation per streamed text delta from about 17ms to 4ms. Padding, scrollbar insets, and the fog look the same.
|
|
8
|
+
|
|
5
9
|
## October 6, 2026
|
|
6
10
|
|
|
7
11
|
- [Dropdown Menu](/components/dropdown-menu), [Multiple Select](/components/multiple-select) and Date Range Picker content scale in from their trigger again. They are built on `radix-vue`, which sets `--radix-*-content-transform-origin`, but read the `--reka-*` variable instead and animated from their center.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// @vitest-environment happy-dom
|
|
2
|
+
import { defineComponent, h, nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
|
|
3
|
+
import { mount } from '@vue/test-utils'
|
|
4
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
5
|
+
import ChatBody from './chat-body.vue'
|
|
6
|
+
|
|
7
|
+
vi.stubGlobal('ref', ref)
|
|
8
|
+
vi.stubGlobal('onMounted', onMounted)
|
|
9
|
+
vi.stubGlobal('onBeforeUnmount', onBeforeUnmount)
|
|
10
|
+
vi.stubGlobal('ResizeObserver', class {
|
|
11
|
+
observe() {}
|
|
12
|
+
unobserve() {}
|
|
13
|
+
disconnect() {}
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
async function flushMutations() {
|
|
17
|
+
await nextTick()
|
|
18
|
+
await new Promise(resolve => setTimeout(resolve, 0))
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function mountChatBody(dock: () => ReturnType<typeof h> | null) {
|
|
22
|
+
const Host = defineComponent({
|
|
23
|
+
setup: () => () => h(ChatBody, null, {
|
|
24
|
+
default: () => [h('div', { 'data-chat-conversation': '' }), dock()],
|
|
25
|
+
}),
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
return mount(Host, { attachTo: document.body })
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
describe('chat body', () => {
|
|
32
|
+
afterEach(() => {
|
|
33
|
+
document.body.innerHTML = ''
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it('marks the body when it docks a prompt input', async () => {
|
|
37
|
+
// Arrange
|
|
38
|
+
const wrapper = mountChatBody(() => h('div', { 'data-chat-prompt-input': '' }))
|
|
39
|
+
|
|
40
|
+
// Act
|
|
41
|
+
await flushMutations()
|
|
42
|
+
|
|
43
|
+
// Assert
|
|
44
|
+
expect(wrapper.get('[data-chat-body]').attributes()).toHaveProperty('data-has-prompt-input')
|
|
45
|
+
wrapper.unmount()
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it('marks the body when the prompt input sits inside a composer stack', async () => {
|
|
49
|
+
// Arrange
|
|
50
|
+
const wrapper = mountChatBody(() => h('div', { 'data-chat-composer': '' }, [h('div', { 'data-chat-prompt-input': '' })]))
|
|
51
|
+
|
|
52
|
+
// Act
|
|
53
|
+
await flushMutations()
|
|
54
|
+
|
|
55
|
+
// Assert
|
|
56
|
+
expect(wrapper.get('[data-chat-body]').attributes()).toHaveProperty('data-has-prompt-input')
|
|
57
|
+
wrapper.unmount()
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
it('follows the prompt input as it is added and removed', async () => {
|
|
61
|
+
// Arrange
|
|
62
|
+
const showInput = ref(false)
|
|
63
|
+
const wrapper = mountChatBody(() => showInput.value ? h('div', { 'data-chat-prompt-input': '' }) : null)
|
|
64
|
+
await flushMutations()
|
|
65
|
+
expect(wrapper.get('[data-chat-body]').attributes()).not.toHaveProperty('data-has-prompt-input')
|
|
66
|
+
|
|
67
|
+
// Act
|
|
68
|
+
showInput.value = true
|
|
69
|
+
await flushMutations()
|
|
70
|
+
|
|
71
|
+
// Assert
|
|
72
|
+
expect(wrapper.get('[data-chat-body]').attributes()).toHaveProperty('data-has-prompt-input')
|
|
73
|
+
|
|
74
|
+
// Act
|
|
75
|
+
showInput.value = false
|
|
76
|
+
await flushMutations()
|
|
77
|
+
|
|
78
|
+
// Assert
|
|
79
|
+
expect(wrapper.get('[data-chat-body]').attributes()).not.toHaveProperty('data-has-prompt-input')
|
|
80
|
+
wrapper.unmount()
|
|
81
|
+
})
|
|
82
|
+
})
|
|
@@ -17,6 +17,10 @@ let observedInput: HTMLElement | null = null
|
|
|
17
17
|
|
|
18
18
|
function bindInputObserver() {
|
|
19
19
|
const input = rootRef.value?.querySelector<HTMLElement>(DOCK_SELECTOR) ?? null
|
|
20
|
+
// Replaces `[data-chat-body]:has([data-chat-prompt-input])`: every DOM change in a long conversation
|
|
21
|
+
// re-tested that selector, which dominated style recalculation. The dock is or wraps the input.
|
|
22
|
+
const hasPromptInput = !!input && (input.matches('[data-chat-prompt-input]') || !!input.querySelector('[data-chat-prompt-input]'))
|
|
23
|
+
rootRef.value?.toggleAttribute('data-has-prompt-input', hasPromptInput)
|
|
20
24
|
|
|
21
25
|
if (input === observedInput)
|
|
22
26
|
return
|
|
@@ -68,7 +72,7 @@ onBeforeUnmount(() => {
|
|
|
68
72
|
--at-apply: 'pl-18px pr-12px py-16px';
|
|
69
73
|
}
|
|
70
74
|
|
|
71
|
-
[data-chat-body]
|
|
75
|
+
[data-chat-body][data-has-prompt-input] [data-chat-conversation] {
|
|
72
76
|
padding-bottom: calc(var(--chat-input-height, 64px) + 24px);
|
|
73
77
|
}
|
|
74
78
|
|
|
@@ -90,7 +94,7 @@ onBeforeUnmount(() => {
|
|
|
90
94
|
margin: 0 !important;
|
|
91
95
|
}
|
|
92
96
|
|
|
93
|
-
[data-chat-body]
|
|
97
|
+
[data-chat-body][data-has-prompt-input] .chat-conversation-scrollbar {
|
|
94
98
|
top: 8px !important;
|
|
95
99
|
bottom: calc(var(--chat-input-height, 64px) + 16px) !important;
|
|
96
100
|
height: auto !important;
|
|
@@ -100,7 +104,7 @@ onBeforeUnmount(() => {
|
|
|
100
104
|
--at-apply: 'pl-24px pr-16px py-16px';
|
|
101
105
|
}
|
|
102
106
|
|
|
103
|
-
[data-chat-body][data-variant='page']
|
|
107
|
+
[data-chat-body][data-variant='page'][data-has-prompt-input] [data-chat-conversation] {
|
|
104
108
|
padding-bottom: calc(var(--chat-input-height, 64px) + 32px);
|
|
105
109
|
}
|
|
106
110
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// @vitest-environment happy-dom
|
|
2
|
+
import { computed, nextTick, onMounted, ref } from 'vue'
|
|
3
|
+
import { mount } from '@vue/test-utils'
|
|
4
|
+
import { describe, expect, it, vi } from 'vitest'
|
|
5
|
+
import { cn } from '../../../../lib/utils'
|
|
6
|
+
import ScrollArea from '../../scroll-area/scroll-area.vue'
|
|
7
|
+
import Conversation from './conversation.vue'
|
|
8
|
+
|
|
9
|
+
vi.stubGlobal('ref', ref)
|
|
10
|
+
vi.stubGlobal('computed', computed)
|
|
11
|
+
vi.stubGlobal('onMounted', onMounted)
|
|
12
|
+
vi.stubGlobal('nextTick', nextTick)
|
|
13
|
+
|
|
14
|
+
const scrollable = ref(false)
|
|
15
|
+
vi.stubGlobal('useScrollFog', () => ({ fogClass: computed(() => scrollable.value ? 'scroll-fog' : '') }))
|
|
16
|
+
|
|
17
|
+
describe('chat conversation', () => {
|
|
18
|
+
it('marks its scroll-area viewport directly, so the fog needs no `:has()` lookup', async () => {
|
|
19
|
+
// Arrange
|
|
20
|
+
const wrapper = mount(Conversation, {
|
|
21
|
+
props: { scrollArea: true },
|
|
22
|
+
slots: { default: () => 'Messages' },
|
|
23
|
+
global: { components: { TelaScrollArea: ScrollArea }, mocks: { cn } },
|
|
24
|
+
})
|
|
25
|
+
const viewport = () => wrapper.get('[data-reka-scroll-area-viewport]')
|
|
26
|
+
expect(viewport().attributes()).toHaveProperty('data-chat-conversation-viewport')
|
|
27
|
+
expect(viewport().attributes()).not.toHaveProperty('data-scroll-fog')
|
|
28
|
+
|
|
29
|
+
// Act
|
|
30
|
+
scrollable.value = true
|
|
31
|
+
await nextTick()
|
|
32
|
+
|
|
33
|
+
// Assert
|
|
34
|
+
expect(viewport().attributes()).toHaveProperty('data-scroll-fog')
|
|
35
|
+
expect(viewport().find('[data-chat-conversation]').text()).toBe('Messages')
|
|
36
|
+
wrapper.unmount()
|
|
37
|
+
})
|
|
38
|
+
})
|
|
@@ -59,6 +59,8 @@ const { fogClass } = useScrollFog(fogTarget, () => {
|
|
|
59
59
|
class="flex-1 min-h-0"
|
|
60
60
|
:class="[fogClass]"
|
|
61
61
|
scroll-thumb-class="chat-conversation-scrollbar"
|
|
62
|
+
data-chat-conversation-viewport
|
|
63
|
+
:data-scroll-fog="fogClass ? '' : undefined"
|
|
62
64
|
>
|
|
63
65
|
<div ref="contentRef" data-chat-conversation>
|
|
64
66
|
<slot />
|
|
@@ -78,7 +80,7 @@ const { fogClass } = useScrollFog(fogTarget, () => {
|
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
.scroll-fog[data-chat-conversation],
|
|
81
|
-
|
|
83
|
+
[data-chat-conversation-viewport][data-scroll-fog] {
|
|
82
84
|
--chat-fog-size: 28px;
|
|
83
85
|
mask: linear-gradient(
|
|
84
86
|
to bottom,
|
|
@@ -90,7 +92,7 @@ const { fogClass } = useScrollFog(fogTarget, () => {
|
|
|
90
92
|
/* Where scroll-driven animations exist, the fog retracts over the last 28px of scroll. */
|
|
91
93
|
@supports (animation-timeline: scroll()) {
|
|
92
94
|
.scroll-fog[data-chat-conversation],
|
|
93
|
-
|
|
95
|
+
[data-chat-conversation-viewport][data-scroll-fog] {
|
|
94
96
|
animation: fog-retract both linear;
|
|
95
97
|
animation-timeline: scroll(self);
|
|
96
98
|
animation-range: calc(100% - 28px) 100%;
|