@meistrari/tela-build 1.93.3 → 1.94.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
+ ## October 23, 2026
6
+
7
+ - [Chat → Sidepanel](/templates/chat#sidepanel) can be swapped with the floating window: provide `{ toggleExpanded, close }` under `chatShellControlsKey` (from `components/tela/chat/chat-shell-context`) above the shell. The widget header's expand toggle then calls `toggleExpanded` instead of growing the floating window. Inside the sidepanel the header shows it as collapse, adds a minimize button that calls `close`, and Escape pressed inside the panel calls `close` once no menu or overlay is open.
8
+ - [Chat → Sidepanel](/templates/chat#sidepanel) can be resized by dragging its left edge, from its 440px default up to 45% of the viewport. The width resets to 440px when the panel unmounts.
9
+
5
10
  ## October 22, 2026
6
11
 
7
12
  - `TelaAnimatedValue` now animates the incoming value: vertical slides in from 10px above with a fade over 100ms, horizontal from `enterOffset` (default 20px) over 200ms. The enter styles used the Vue 2 `.slide-fade-enter` class, which Vue 3 never applies, so the new value used to appear instantly after the old one left. This also reaches the letter change in the [Avatar](/components/avatar#with-initials-fallback) initials fallback (`TelaInitials`) and `TelaAnimatedCalculatingNumber`.
@@ -4,3 +4,11 @@ export type ChatShell = 'floating' | 'sidepanel'
4
4
 
5
5
  /** Provided by `TelaChatFloatingWindow` and `TelaChatSidepanelWindow` so nested primitives can adapt to the shell. */
6
6
  export const chatShellContextKey: InjectionKey<ChatShell> = Symbol('tela-chat-shell')
7
+
8
+ export type ChatShellControls = {
9
+ toggleExpanded: () => void
10
+ close: () => void
11
+ }
12
+
13
+ /** Provide above a widget shell to let the widget header switch between the floating and sidepanel shells, and close the sidepanel. */
14
+ export const chatShellControlsKey: InjectionKey<ChatShellControls> = Symbol('tela-chat-shell-controls')
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { chatShellContextKey, chatShellControlsKey } from './chat-shell-context'
2
3
  import { floatingWindowContextKey } from './floating/floating-window-context'
3
4
 
4
5
  const props = withDefaults(defineProps<{
@@ -30,22 +31,30 @@ const emit = defineEmits<{
30
31
  }>()
31
32
 
32
33
  const floatingWindow = inject(floatingWindowContextKey, null)
34
+ const shell = inject(chatShellContextKey, null)
35
+ const shellControls = shell ? inject(chatShellControlsKey, null) : null
33
36
 
34
- const showExpand = computed(() => Boolean(floatingWindow) || props.expandable)
35
- const showClose = computed(() => Boolean(floatingWindow) || props.closable)
36
- const isExpanded = computed(() => floatingWindow ? floatingWindow.expanded.value : props.expanded)
37
+ const showExpand = computed(() => Boolean(floatingWindow || shellControls) || props.expandable)
38
+ const showClose = computed(() => Boolean(floatingWindow || shellControls) || props.closable)
39
+ const isExpanded = computed(() => (Boolean(shellControls) && shell === 'sidepanel') || (floatingWindow ? floatingWindow.expanded.value : props.expanded))
37
40
 
38
41
  const historyOpen = ref(false)
39
42
  const historySelection = ref('')
40
43
 
41
44
  function close() {
42
45
  emit('close')
43
- floatingWindow?.close()
46
+ if (floatingWindow)
47
+ floatingWindow.close()
48
+ else
49
+ shellControls?.close()
44
50
  }
45
51
 
46
52
  function toggleExpanded() {
47
53
  emit('toggleExpanded')
48
- floatingWindow?.toggleExpanded()
54
+ if (shellControls)
55
+ shellControls.toggleExpanded()
56
+ else
57
+ floatingWindow?.toggleExpanded()
49
58
  }
50
59
 
51
60
  function selectConversation(id: unknown) {
@@ -256,7 +256,9 @@ const conversations = [
256
256
 
257
257
  An always-open, docked chat column. It has no launcher and no `open` state: render it when the panel should exist.
258
258
 
259
- `TelaChatSidepanelWindow` is **in-flow** (`position: sticky`, full viewport height, fixed width of `min(440px, 100vw)`), so the page layout reserves its width instead of being overlapped. Place it as the **last item of a flex row**:
259
+ To let users move between the floating window and the sidepanel, provide `{ toggleExpanded, close }` under `chatShellControlsKey` (exported from `chat-shell-context`) above the shell and swap the shell when they are called. The widget header shows its expand toggle in both shells and calls `toggleExpanded` instead of growing the floating window. Inside the sidepanel it also shows a minimize button that calls `close`, and Escape pressed inside the panel calls `close` once no menu or overlay is open.
260
+
261
+ `TelaChatSidepanelWindow` is **in-flow** (`position: sticky`, full viewport height, 440px wide by default), so the page layout reserves its width instead of being overlapped. Users can drag its left edge to widen it up to 45% of the viewport; the width resets when the panel unmounts. Place it as the **last item of a flex row**:
260
262
 
261
263
  ```vue
262
264
  <script setup lang="ts">
@@ -1,11 +1,55 @@
1
1
  <script setup lang="ts">
2
- import { chatShellContextKey } from '../chat-shell-context'
2
+ import { chatShellContextKey, chatShellControlsKey } from '../chat-shell-context'
3
+ import { hasOpenEscapeLayer } from '../floating/escape-layer'
3
4
 
4
5
  provide(chatShellContextKey, 'sidepanel')
6
+
7
+ const shellControls = inject(chatShellControlsKey, null)
8
+
9
+ function closeOnEscape() {
10
+ if (shellControls && !hasOpenEscapeLayer() && !document.querySelector('[data-dismissable-layer]'))
11
+ shellControls.close()
12
+ }
13
+
14
+ const minWidth = 440
15
+ const maxViewportShare = 0.45
16
+
17
+ const panel = ref<HTMLElement | null>(null)
18
+
19
+ // Writes the width straight to the element: re-rendering this shell re-renders the whole chat inside it.
20
+ function startResize(event: PointerEvent) {
21
+ const aside = panel.value
22
+ if (!aside || event.button !== 0)
23
+ return
24
+
25
+ const startX = event.clientX
26
+ const startWidth = aside.getBoundingClientRect().width
27
+ const maxWidth = Math.max(minWidth, window.innerWidth * maxViewportShare)
28
+ const drag = new AbortController()
29
+
30
+ aside.setPointerCapture(event.pointerId)
31
+ aside.addEventListener('pointermove', (moveEvent) => {
32
+ const width = Math.min(maxWidth, Math.max(minWidth, startWidth + startX - moveEvent.clientX))
33
+ aside.style.width = `clamp(min(${minWidth}px, 100vw), ${width}px, ${maxViewportShare * 100}vw)`
34
+ }, { signal: drag.signal })
35
+ aside.addEventListener('lostpointercapture', () => drag.abort(), { signal: drag.signal })
36
+ }
5
37
  </script>
6
38
 
7
39
  <template>
8
- <aside class="sticky top-0 w-[min(440px,100vw)] flex flex-col h-100dvh overflow-hidden shrink-0 border-l-0.5px border bg-muted p-8px">
40
+ <aside
41
+ ref="panel"
42
+ sticky top-0 flex flex-col h-100dvh overflow-hidden shrink-0 border-l-0.5px border bg-muted p-8px
43
+ class="w-[min(440px,100vw)]"
44
+ @keydown.esc="closeOnEscape"
45
+ >
46
+ <div
47
+ absolute inset-y-0 left-0 z-1 w-8px cursor-col-resize touch-none
48
+ class="group"
49
+ @pointerdown.prevent="startResize"
50
+ >
51
+ <div h-full w-2px transition-colors class="group-hover:bg-black/12 group-active:bg-black/12" />
52
+ </div>
9
53
  <div data-widget-frame class="flex-1 min-h-0 flex flex-col border-0.5px rounded-12px overflow-hidden bg">
10
54
  <slot />
11
55
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/tela-build",
3
- "version": "1.93.3",
3
+ "version": "1.94.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "app.config.ts",