@meistrari/tela-build 1.96.0 → 1.98.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 30, 2026
6
+
7
+ - [Switch](/components/switch) Toggling animates the thumb as a stretching pill: it slides at a near-constant speed while stretching from its trailing edge, squashes as it lands, then springs back to a circle with a slight overshoot over 500ms. The track color crossfades over 300ms. The thumb's small stretch toward the other side (16 → 18px on `sm`, 18 → 20px on `md`) now shows on hover instead of while pressed. Toggling drops it, and it comes back the next time the pointer leaves and hovers the switch again. Toggling again mid-animation reverses from wherever the thumb is instead of jumping to the far end. Switches don't animate on mount, and the animation is skipped under `prefers-reduced-motion`.
8
+ - [Checkbox](/components/checkbox) scales down to 93% while pressed, easing over 200ms. Disabled checkboxes don't scale, and neither do any under `prefers-reduced-motion`.
9
+
5
10
  ## October 29, 2026
6
11
 
7
12
  - [Tooltip Group](/components/tooltip-group) `TelaTooltipGroupTrigger` honors `disabled`: a disabled trigger doesn't open its tooltip, and one that's open closes as soon as it's disabled.
@@ -12,6 +17,8 @@ Latest updates and announcements.
12
17
 
13
18
  ## October 28, 2026
14
19
 
20
+ - [Chat → Sidepanel](/templates/chat#sidepanel) `chatShellControlsKey` makes `toggleExpanded` optional: provide only `close` and the widget header shows the minimize button without the expand toggle, for hosts that always open the chat as a sidepanel.
21
+ - [Chat → Sidepanel](/templates/chat#sidepanel) `TelaChatSidepanelWindow` uses `bg-subtle` instead of `bg-muted` and drops its left border, so it blends with a `bg-subtle` app shell instead of showing a seam.
15
22
  - [Sidebar](/patterns/sidebar#minimized) `TelaSidebarLogo` no longer has a bottom margin in the `minimized` variant; `TelaSidebarHeader` spaces its first child 8px from the rest instead. A menu trigger wrapping the logo is now the logo's size, so its menu opens 4px below the logo as in the default variant.
16
23
  - [Sidebar](/patterns/sidebar#minimized) sets `data-variant` on its `<aside>` and is a named `sidebar` group, so its parts and your own content can style the minimized rail with `group-data-[variant=minimized]/sidebar:` classes. The built-in parts now size themselves this way, with no visual change.
17
24
  - [Sidebar](/patterns/sidebar) `TelaSidebarContent` fades its top and bottom edges only when items are scrolled past them, so the first and last items are no longer faded at rest.
@@ -6,9 +6,9 @@ export type ChatShell = 'floating' | 'sidepanel'
6
6
  export const chatShellContextKey: InjectionKey<ChatShell> = Symbol('tela-chat-shell')
7
7
 
8
8
  export type ChatShellControls = {
9
- toggleExpanded: () => void
9
+ toggleExpanded?: () => void
10
10
  close: () => void
11
11
  }
12
12
 
13
- /** Provide above a widget shell to let the widget header switch between the floating and sidepanel shells, and close the sidepanel. */
13
+ /** Provide above a widget shell to let the widget header close the sidepanel and, with `toggleExpanded`, switch between the floating and sidepanel shells. */
14
14
  export const chatShellControlsKey: InjectionKey<ChatShellControls> = Symbol('tela-chat-shell-controls')
@@ -34,9 +34,9 @@ const floatingWindow = inject(floatingWindowContextKey, null)
34
34
  const shell = inject(chatShellContextKey, null)
35
35
  const shellControls = shell ? inject(chatShellControlsKey, null) : null
36
36
 
37
- const showExpand = computed(() => Boolean(floatingWindow || shellControls) || props.expandable)
37
+ const showExpand = computed(() => Boolean(floatingWindow || shellControls?.toggleExpanded) || props.expandable)
38
38
  const showClose = computed(() => Boolean(floatingWindow || shellControls) || props.closable)
39
- const isExpanded = computed(() => (Boolean(shellControls) && shell === 'sidepanel') || (floatingWindow ? floatingWindow.expanded.value : props.expanded))
39
+ const isExpanded = computed(() => (Boolean(shellControls?.toggleExpanded) && shell === 'sidepanel') || (floatingWindow ? floatingWindow.expanded.value : props.expanded))
40
40
 
41
41
  const historyOpen = ref(false)
42
42
  const historySelection = ref('')
@@ -51,7 +51,7 @@ function close() {
51
51
 
52
52
  function toggleExpanded() {
53
53
  emit('toggleExpanded')
54
- if (shellControls)
54
+ if (shellControls?.toggleExpanded)
55
55
  shellControls.toggleExpanded()
56
56
  else
57
57
  floatingWindow?.toggleExpanded()
@@ -256,9 +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
- 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.
259
+ To let users close the sidepanel, provide `{ close }` under `chatShellControlsKey` (exported from `chat-shell-context`) above the shell and stop rendering it when `close` is called. The widget header then shows a minimize button that calls `close`, and Escape pressed inside the panel calls `close` once no menu or overlay is open. Add `toggleExpanded` to also move between the floating window and the sidepanel: the header shows its expand toggle in both shells and calls `toggleExpanded` instead of growing the floating window.
260
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**:
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. Its surface is `bg-subtle` with no border of its own, so it reads as part of a `bg-subtle` app shell. 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**:
262
262
 
263
263
  ```vue
264
264
  <script setup lang="ts">
@@ -39,7 +39,7 @@ function startResize(event: PointerEvent) {
39
39
  <template>
40
40
  <aside
41
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
42
+ sticky top-0 flex flex-col h-100dvh overflow-hidden shrink-0 bg-subtle p-8px
43
43
  class="w-[min(440px,100vw)]"
44
44
  @keydown.esc="closeOnEscape"
45
45
  >
@@ -16,9 +16,9 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
16
16
  <CheckboxRoot
17
17
  v-bind="forwarded"
18
18
  :class="cn(
19
- 'checkbox grid place-content-center peer w-16px h-16px shrink-0 rounded-5px border-[1px] border-strong bg focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-cyan-600',
19
+ 'checkbox grid place-content-center peer size-16px shrink-0 rounded-5px border-[1px] border-strong bg focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-cyan-600',
20
20
  'hover:data-[state=unchecked]:bg-muted data-[state=checked]:border-transparent data-[state=checked]:bg-btn-primary hover:data-[state=checked]:bg-btn-primary-active',
21
- 'disabled:cursor-not-allowed disabled:bg-muted disabled:border disabled:data-[state=checked]:bg-neutral-300',
21
+ 'disabled:cursor-not-allowed disabled:bg-muted disabled:border disabled:data-[state=checked]:bg-neutral-300 motion-safe:not-disabled:active:scale-93',
22
22
  props.class,
23
23
  )"
24
24
  >
@@ -55,6 +55,6 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
55
55
  }
56
56
 
57
57
  .checkbox {
58
- transition: background-color 125ms ease-out, border-color 125ms ease-out;
58
+ transition: background-color 125ms ease-out, border-color 125ms ease-out, transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
59
59
  }
60
60
  </style>
@@ -19,6 +19,42 @@ const delegatedProps = reactiveOmit(props, 'class')
19
19
 
20
20
  const forwarded = useForwardPropsEmits(delegatedProps, emits)
21
21
 
22
+ const hasToggled = ref(false)
23
+ const thumbRef = ref<InstanceType<typeof SwitchThumb>>()
24
+
25
+ const start = ref({ x: 0, shift: 0, scale: 1, reach: 1 })
26
+
27
+ function captureStart() {
28
+ hasToggled.value = true
29
+
30
+ const el: HTMLElement | undefined = thumbRef.value?.$el
31
+
32
+ if (!el)
33
+ return
34
+
35
+ const pillStyle = getComputedStyle(el, '::before')
36
+ const pill = new DOMMatrix(pillStyle.transform)
37
+ const originX = Number.parseFloat(pillStyle.transformOrigin)
38
+ const width = el.offsetWidth
39
+ const left = originX + pill.m41 - originX * pill.a
40
+ const isTurningOn = el.dataset.state !== 'checked'
41
+ const x = new DOMMatrix(getComputedStyle(el).transform).m41
42
+ const track = el.parentElement
43
+ const trackStyle = track ? getComputedStyle(track) : undefined
44
+ const travel = track && trackStyle
45
+ ? track.clientWidth - Number.parseFloat(trackStyle.paddingLeft) - Number.parseFloat(trackStyle.paddingRight) - width
46
+ : 0
47
+
48
+ start.value = {
49
+ x,
50
+ shift: isTurningOn ? left : left - width + width * pill.a,
51
+ scale: pill.a,
52
+ reach: travel > 0 ? Math.min(1, Math.max(0, (isTurningOn ? travel - x : x) / travel)) : 1,
53
+ }
54
+ }
55
+
56
+ watch(() => props.modelValue, captureStart, { flush: 'pre' })
57
+
22
58
  const resolvedSize = computed(() => props.size || 'sm')
23
59
 
24
60
  const sizeStyle = computed(() => (({
@@ -27,30 +63,90 @@ const sizeStyle = computed(() => (({
27
63
  }) as Record<SwitchSize, string>)[resolvedSize.value] ?? '')
28
64
 
29
65
  const thumbSizeStyle = computed(() => (({
30
- sm: 'w-16px h-16px data-[state=checked]:translate-x-3 group-enabled:group-active:before:scale-x-[1.125]',
31
- md: 'w-18px h-18px data-[state=checked]:translate-x-4 group-enabled:group-active:before:scale-x-[1.111]',
66
+ sm: 'w-16px h-16px [--switch-width:16px] [--switch-travel:0.75rem] [--switch-stretch:0.75] data-[state=checked]:translate-x-3',
67
+ md: 'w-18px h-18px [--switch-width:18px] [--switch-travel:1rem] [--switch-stretch:0.889] data-[state=checked]:translate-x-4',
32
68
  }) as Record<SwitchSize, string>)[resolvedSize.value] ?? '')
69
+
70
+ const isHovered = ref(false)
71
+ const isStretchArmed = ref(true)
72
+
73
+ function onPointerLeave() {
74
+ isHovered.value = false
75
+ isStretchArmed.value = true
76
+ }
77
+
78
+ function onToggle() {
79
+ captureStart()
80
+ isStretchArmed.value = false
81
+ }
82
+
83
+ const hoverStretch = computed(() => resolvedSize.value === 'md' ? 1.111 : 1.125)
84
+
85
+ const thumbStyle = computed(() => ({
86
+ '--switch-rest': isHovered.value && isStretchArmed.value && !props.disabled ? hoverStretch.value : 1,
87
+ '--switch-start': `${start.value.x}px`,
88
+ '--switch-shift': `${start.value.shift}px`,
89
+ '--switch-from': start.value.scale,
90
+ '--switch-reach': start.value.reach,
91
+ }))
33
92
  </script>
34
93
 
35
94
  <template>
36
95
  <SwitchRoot
37
96
  v-bind="forwarded"
38
97
  :class="cn(
39
- 'group peer inline-flex w-32px h-20px shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-cyan-600 disabled:cursor-not-allowed disabled:opacity-50',
98
+ 'group peer inline-flex w-32px h-20px shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors duration-300 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-cyan-600 disabled:cursor-not-allowed disabled:opacity-50',
40
99
  'data-[state=unchecked]:bg-neutral-200 not-disabled:data-[state=unchecked]:hover:bg-neutral-300 data-[state=checked]:bg-green-500 not-disabled:data-[state=checked]:hover:bg-green-600',
41
100
  sizeStyle,
42
101
  props.class,
43
102
  )"
103
+ @update:model-value="onToggle"
104
+ @pointerenter="isHovered = true"
105
+ @pointerleave="onPointerLeave"
44
106
  >
45
107
  <SwitchThumb
108
+ ref="thumbRef"
46
109
  :class="cn(
47
110
  'relative isolate flex items-center justify-center rounded-full ring-0 transition-[transform,filter] duration-350 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none data-[state=checked]:drop-shadow-md',
48
- 'before:content-empty before:absolute before:inset-0 before:-z-1 before:rounded-full before:bg before:origin-left data-[state=checked]:before:origin-right',
49
- 'before:transition-[transform,background-color] before:duration-350 before:ease-[cubic-bezier(0.22,1,0.36,1)] group-enabled:group-active:before:duration-160 group-enabled:group-active:before:ease-out motion-reduce:before:transition-none hover:before:bg-muted',
111
+ 'before:content-empty before:absolute before:inset-0 before:-z-1 before:rounded-full before:bg before:scale-x-[var(--switch-rest)] before:origin-left data-[state=checked]:before:origin-right',
112
+ 'before:transition-[transform,background-color] before:duration-160 before:ease-out motion-reduce:before:transition-none hover:before:bg-muted',
113
+ hasToggled && [
114
+ 'motion-safe:data-[state=checked]:animate-[switchThumbOn_0.5s_linear] motion-safe:data-[state=checked]:before:animate-[switchPillOn_0.5s_linear]',
115
+ 'motion-safe:data-[state=unchecked]:animate-[switchThumbOff_0.5s_linear] motion-safe:data-[state=unchecked]:before:animate-[switchPillOff_0.5s_linear]',
116
+ ],
50
117
  thumbSizeStyle,
51
118
  )"
119
+ :style="thumbStyle"
52
120
  >
53
121
  <slot name="thumb" />
54
122
  </SwitchThumb>
55
123
  </SwitchRoot>
56
124
  </template>
125
+
126
+ <style>
127
+ @keyframes switchThumbOn {
128
+ 0% { transform: translateX(var(--switch-start)); }
129
+ 51%, 100% { transform: translateX(var(--switch-travel)); }
130
+ }
131
+
132
+ @keyframes switchThumbOff {
133
+ 0% { transform: translateX(var(--switch-start)); }
134
+ 51%, 100% { transform: translateX(0); }
135
+ }
136
+
137
+ @keyframes switchPillOn {
138
+ 0% { transform-origin: left center; transform: translateX(var(--switch-shift)) scaleX(var(--switch-from)); }
139
+ 24% { transform: translateX(0) scaleX(calc(1 + var(--switch-stretch) * var(--switch-reach) * 0.46)); }
140
+ 51% { transform: translateX(calc(var(--switch-width) * (1 - var(--switch-rest)))) scaleX(calc(var(--switch-rest) - var(--switch-stretch) * 0.08)); animation-timing-function: ease-out; }
141
+ 66% { transform: translateX(calc(var(--switch-width) * (1 - var(--switch-rest)))) scaleX(calc(var(--switch-rest) + var(--switch-stretch) * 0.02)); animation-timing-function: ease-in-out; }
142
+ 100% { transform-origin: left center; transform: translateX(calc(var(--switch-width) * (1 - var(--switch-rest)))) scaleX(var(--switch-rest)); }
143
+ }
144
+
145
+ @keyframes switchPillOff {
146
+ 0% { transform-origin: right center; transform: translateX(var(--switch-shift)) scaleX(var(--switch-from)); }
147
+ 24% { transform: translateX(0) scaleX(calc(1 + var(--switch-stretch) * var(--switch-reach) * 0.46)); }
148
+ 51% { transform: translateX(calc(var(--switch-width) * (var(--switch-rest) - 1))) scaleX(calc(var(--switch-rest) - var(--switch-stretch) * 0.08)); animation-timing-function: ease-out; }
149
+ 66% { transform: translateX(calc(var(--switch-width) * (var(--switch-rest) - 1))) scaleX(calc(var(--switch-rest) + var(--switch-stretch) * 0.02)); animation-timing-function: ease-in-out; }
150
+ 100% { transform-origin: right center; transform: translateX(calc(var(--switch-width) * (var(--switch-rest) - 1))) scaleX(var(--switch-rest)); }
151
+ }
152
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/tela-build",
3
- "version": "1.96.0",
3
+ "version": "1.98.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "app.config.ts",