@meistrari/tela-build 1.97.0 → 1.98.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
+ ## November 3, 2026
6
+
7
+ - [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`.
8
+
5
9
  ## October 30, 2026
6
10
 
7
11
  - [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`.
@@ -17,6 +21,8 @@ Latest updates and announcements.
17
21
 
18
22
  ## October 28, 2026
19
23
 
24
+ - [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.
25
+ - [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.
20
26
  - [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.
21
27
  - [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.
22
28
  - [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.
@@ -1,6 +1,4 @@
1
1
  <script lang="ts" setup>
2
- import NumberFlow from '@number-flow/vue'
3
-
4
2
  const props = defineProps<{
5
3
  value: number
6
4
  precision?: number
@@ -9,19 +7,193 @@ const props = defineProps<{
9
7
  prefix?: string
10
8
  suffix?: string
11
9
  }>()
10
+
11
+ const ENTER_ACTIVE = 'transition-[transform,opacity,filter] duration-[280ms] ease-[cubic-bezier(0.33,1,0.68,1)]'
12
+ const ENTER_FROM = 'opacity-0 [filter:blur(0.12em)] [transform:translateY(0.45em)_scale(0.8)]'
13
+ const LEAVE_ACTIVE = '!absolute left-0 top-0 pointer-events-none transition-[transform,opacity,filter] duration-[200ms] ease-[cubic-bezier(0.33,1,0.68,1)]'
14
+ const LEAVE_TO = 'opacity-0 [filter:blur(0.12em)] [transform:translateY(-0.45em)_scale(0.8)]'
15
+ const MOVE = 'transition-[transform,opacity,filter] duration-[280ms] ease-[cubic-bezier(0.22,1,0.36,1)]'
16
+ const WIDTH_ANIMATION = { duration: 280, easing: 'cubic-bezier(0.22, 1, 0.36, 1)' }
17
+ const DIGITS = [...'0123456789']
18
+ const DIGIT_TIGHTENING = 0.01
19
+ const DIGIT_PROBE = 'absolute invisible'
20
+
21
+ const root = ref<HTMLElement | null>(null)
22
+ const reducedMotion = ref(false)
23
+ const digitMargins = ref<Record<string, string>>({})
24
+ let widthAnimation: Animation | undefined
25
+ let integerDigits: { id: number, text: string }[] = []
26
+ let nextDigitId = 0
27
+
28
+ const formatter = computed(() => new Intl.NumberFormat(props.locales, {
29
+ roundingMode: 'expand',
30
+ maximumFractionDigits: props.precision,
31
+ currency: props.currency?.length === 3 ? props.currency : undefined,
32
+ style: props.currency?.length === 3 ? 'currency' : undefined,
33
+ }))
34
+
35
+ const text = computed(() => `${props.prefix ?? ''}${formatter.value.format(props.value)}${props.suffix ?? ''}`)
36
+
37
+ function alignIntegerDigits(next: string) {
38
+ const previous = integerDigits.map(digit => digit.text).join('')
39
+ const offset = next.startsWith(previous) || previous.startsWith(next) ? 0 : previous.length - next.length
40
+
41
+ integerDigits = [...next].map((digit, index) => ({
42
+ id: integerDigits[index + offset]?.id ?? nextDigitId++,
43
+ text: digit,
44
+ }))
45
+
46
+ return integerDigits
47
+ }
48
+
49
+ const cells = computed(() => {
50
+ const parts = formatter.value.formatToParts(props.value)
51
+ const digits = alignIntegerDigits(parts.filter(part => part.type === 'integer').map(part => part.value).join(''))
52
+
53
+ let digitIndex = 0
54
+ let groupIndex = 0
55
+ let fractionIndex = 0
56
+ let before = props.prefix ?? ''
57
+ let after = ''
58
+
59
+ const numberCells: { key: string, text: string, isDigit?: boolean }[] = []
60
+
61
+ for (const part of parts) {
62
+ if (part.type === 'integer') {
63
+ for (const _ of part.value) {
64
+ const digit = digits[digitIndex++]
65
+
66
+ if (digit)
67
+ numberCells.push({ key: `integer-${digit.id}`, text: digit.text, isDigit: true })
68
+ }
69
+ }
70
+ else if (part.type === 'fraction') {
71
+ for (const digit of part.value)
72
+ numberCells.push({ key: `fraction-${fractionIndex++}`, text: digit, isDigit: true })
73
+ }
74
+ else if (part.type === 'group') {
75
+ numberCells.push({ key: `group-${groupIndex++}`, text: part.value })
76
+ }
77
+ else if (part.type === 'decimal') {
78
+ numberCells.push({ key: 'decimal', text: part.value })
79
+ }
80
+ else if (numberCells.length === 0) {
81
+ before += part.value
82
+ }
83
+ else {
84
+ after += part.value
85
+ }
86
+ }
87
+
88
+ after += props.suffix ?? ''
89
+
90
+ return [
91
+ ...(before ? [{ key: 'before', text: before }] : []),
92
+ ...numberCells,
93
+ ...(after ? [{ key: 'after', text: after }] : []),
94
+ ]
95
+ })
96
+
97
+ function measureDigits() {
98
+ const element = root.value
99
+
100
+ if (!element)
101
+ return
102
+
103
+ const probes = DIGITS.map((digit) => {
104
+ const probe = document.createElement('span')
105
+
106
+ probe.className = DIGIT_PROBE
107
+ probe.textContent = digit
108
+
109
+ return probe
110
+ })
111
+
112
+ element.append(...probes)
113
+
114
+ const widths = probes.map(probe => Number.parseFloat(getComputedStyle(probe).width))
115
+
116
+ const fontSize = Number.parseFloat(getComputedStyle(element).fontSize)
117
+
118
+ for (const probe of probes)
119
+ probe.remove()
120
+
121
+ const widest = Math.max(...widths)
122
+
123
+ if (!(widest > 0) || !(fontSize > 0))
124
+ return
125
+
126
+ digitMargins.value = Object.fromEntries(DIGITS.map((digit, index) => [digit, `${(widest - (widths[index] ?? widest)) / 2 / fontSize - DIGIT_TIGHTENING}em`]))
127
+ }
128
+
129
+ onMounted(() => {
130
+ measureDigits()
131
+ document.fonts?.ready.then(measureDigits)
132
+ })
133
+
134
+ watch(text, async () => {
135
+ measureDigits()
136
+
137
+ reducedMotion.value = window.matchMedia('(prefers-reduced-motion: reduce)').matches
138
+
139
+ const element = root.value
140
+
141
+ if (!element || reducedMotion.value)
142
+ return
143
+
144
+ const from = element.getBoundingClientRect().width
145
+
146
+ widthAnimation?.cancel()
147
+ await nextTick()
148
+
149
+ const to = element.getBoundingClientRect().width
150
+
151
+ if (Math.abs(from - to) > 0.5)
152
+ widthAnimation = element.animate({ width: [`${from}px`, `${to}px`] }, WIDTH_ANIMATION)
153
+ })
154
+
155
+ function pinLeavingCell(element: Element) {
156
+ if (!(element instanceof HTMLElement))
157
+ return
158
+
159
+ element.style.left = `${element.offsetLeft}px`
160
+ element.style.top = `${element.offsetTop}px`
161
+ }
12
162
  </script>
13
163
 
14
164
  <template>
15
- <NumberFlow
16
- :value="props.value"
17
- :format="{
18
- roundingMode: 'expand',
19
- maximumFractionDigits: props.precision,
20
- currency: props.currency?.length === 3 ? props.currency : undefined,
21
- style: props.currency?.length === 3 ? 'currency' : undefined,
22
- }"
23
- :prefix="props.prefix"
24
- :suffix="props.suffix"
25
- :locales="props.locales"
26
- />
165
+ <span
166
+ ref="root"
167
+ role="img"
168
+ :aria-label="text"
169
+ class="relative inline-block whitespace-pre"
170
+ >
171
+ <TransitionGroup
172
+ tag="span"
173
+ aria-hidden="true"
174
+ :css="!reducedMotion"
175
+ :enter-active-class="ENTER_ACTIVE"
176
+ :enter-from-class="ENTER_FROM"
177
+ :leave-active-class="LEAVE_ACTIVE"
178
+ :leave-to-class="LEAVE_TO"
179
+ :move-class="reducedMotion ? undefined : MOVE"
180
+ @before-leave="pinLeavingCell"
181
+ >
182
+ <span v-for="cell in cells" :key="cell.key" class="relative inline-block">
183
+ <Transition
184
+ :css="!reducedMotion"
185
+ :enter-active-class="ENTER_ACTIVE"
186
+ :enter-from-class="ENTER_FROM"
187
+ :leave-active-class="LEAVE_ACTIVE"
188
+ :leave-to-class="LEAVE_TO"
189
+ >
190
+ <span
191
+ :key="cell.text"
192
+ class="inline-block"
193
+ :style="cell.isDigit ? { marginInline: digitMargins[cell.text] } : undefined"
194
+ >{{ cell.text }}</span>
195
+ </Transition>
196
+ </span>
197
+ </TransitionGroup>
198
+ </span>
27
199
  </template>
@@ -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
  >
package/nuxt.config.ts CHANGED
@@ -108,7 +108,6 @@ 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
- '@number-flow/vue',
112
111
  'clsx',
113
112
  'date-fns',
114
113
  'radix-vue',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/tela-build",
3
- "version": "1.97.0",
3
+ "version": "1.98.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "app.config.ts",
@@ -33,7 +33,6 @@
33
33
  "@iconify-json/ph": "1.2.2",
34
34
  "@internationalized/date": "3.6.0",
35
35
  "@meistrari/auth-core": "^1.42.0",
36
- "@number-flow/vue": "^0.3.2",
37
36
  "@types/mdast": "4.0.4",
38
37
  "@unocss/nuxt": "66.5.12",
39
38
  "@unocss/transformer-directives": "66.5.12",