@meistrari/tela-build 1.87.3 → 1.88.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,11 +2,26 @@
2
2
 
3
3
  Latest updates and announcements.
4
4
 
5
+ ## October 16, 2026
6
+
7
+ - [Video Player](/components/video-player#exposed-methods) exposes `seekTo(seconds)` and `play()` through a template ref, so outside controls like a chapter list can jump to a moment and start playback. It also emits `timeupdate` with the current time in seconds, so those controls can follow along as the video plays.
8
+ - [Video Player](/components/video-player) corners no longer show a dark fringe: the black backdrop only appears in fullscreen, and the border is a softer 0.5px `black/8` instead of `rgba(0, 0, 0, 0.65)`.
9
+ - [Video Player](/components/video-player) playback speed always shows a decimal: `1.0×` and `2.0×` instead of `1×` and `2×`, matching `1.25×` and `1.5×`.
10
+ - [Video Player](/components/video-player) without a `poster` shows a frame from the start of the video as its thumbnail instead of an empty surface. A `poster` still takes precedence.
11
+ - [Video Player](/components/video-player) opens on a centered play button and a duration badge instead of the full control bar; the controls take over once playback starts.
12
+ - [Video Player](/components/video-player) accepts a `preview` clip that loops muted as the cover until playback starts. It holds still when the user prefers reduced motion.
13
+
5
14
  ## October 15, 2026
6
15
 
7
16
  - [Preview](/components/preview) displays failed processed-file loads as errors and skips original file URL resolution and PDF loading when showing processed text.
8
17
  - [Preview](/patterns/preview) reserves space for the file selector and Original/Processed tabs so document content stays visible below them, including while scrolling.
18
+ - [Tooltip](/components/tooltip) with `open` set ignores hover and focus on its trigger. A forced-open tooltip no longer replays its fade-in when the pointer enters the trigger, which flipped it from `instant-open` to `delayed-open`.
9
19
  - [Preview](/components/preview) wraps preformatted text within the document width, keeping long indented email paragraphs readable while preserving indentation and line breaks.
20
+ - [Sidebar](/patterns/sidebar#telasidebaruser) `TelaSidebarUser` can be opened programmatically with `v-model:open`, and each action accepts an optional `tooltip` (`{ title, description, open }`) that pins a multiline tooltip to the right of that item, e.g. to point users at a menu entry after an action elsewhere.
21
+ - [Dropdown Menu](/components/dropdown-menu) item `tooltip` objects accept `open` to force the tooltip open or closed instead of showing it on hover.
22
+ - [Dropdown Menu](/components/dropdown-menu) items with a `tooltip` now span the full menu width and receive `@click`/`@select`; both were dropped before because the tooltip wrapped the item.
23
+ - [Video Player](/components/video-player) adapts its controls to its own width: below 400px the volume and picture-in-picture buttons hide and the bar uses the compact padding, so the time labels no longer overlap the playback speed in small players.
24
+ - [Video Player](/components/video-player) has a 0.5px `rgba(0, 0, 0, 0.65)` border, so its edge stays crisp against light pages and bright frames.
10
25
 
11
26
  ## October 14, 2026
12
27
 
@@ -5,6 +5,9 @@ import type { DropdownMenuItemProps } from 'radix-vue'
5
5
  import Tooltip from '../tooltip/tooltip.vue'
6
6
  import type { TooltipProps } from '../tooltip/tooltip.vue'
7
7
 
8
+ // The tooltip branch's root is the tooltip, so listeners must be forwarded to the item itself
9
+ defineOptions({ inheritAttrs: false })
10
+
8
11
  const props = defineProps<DropdownMenuItemProps & {
9
12
  class?: HTMLAttributes['class']
10
13
  labelClass?: HTMLAttributes['class']
@@ -57,6 +60,7 @@ const tooltipConfig = computed(() => {
57
60
  alignOffset: undefined,
58
61
  arrowOffset: undefined,
59
62
  delayDuration: undefined,
63
+ open: undefined,
60
64
  }
61
65
  }
62
66
  if (typeof props.tooltip === 'object' && props.tooltip) {
@@ -70,6 +74,7 @@ const tooltipConfig = computed(() => {
70
74
  alignOffset: props.tooltip.alignOffset,
71
75
  arrowOffset: props.tooltip.arrowOffset,
72
76
  delayDuration: props.tooltip.delayDuration,
77
+ open: props.tooltip.open,
73
78
  }
74
79
  }
75
80
  return null
@@ -96,9 +101,11 @@ const isIconImage = computed(() => {
96
101
  :title="tooltipConfig?.title"
97
102
  :description="tooltipConfig?.description"
98
103
  :delay-duration="tooltipConfig?.delayDuration ?? 100"
104
+ :open="tooltipConfig?.open"
105
+ trigger-class="w-full"
99
106
  >
100
107
  <DropdownMenuItem
101
- v-bind="props"
108
+ v-bind="{ ...props, ...$attrs }"
102
109
  :class="cn(
103
110
  'group outline-none',
104
111
  'relative flex gap-10px cursor-pointer select-none items-center rounded-xl px-3 py-1.5',
@@ -119,7 +126,7 @@ const isIconImage = computed(() => {
119
126
 
120
127
  <DropdownMenuItem
121
128
  v-else
122
- v-bind="props"
129
+ v-bind="{ ...props, ...$attrs }"
123
130
  :class="cn(
124
131
  'group outline-none',
125
132
  'relative flex gap-10px cursor-pointer select-none items-center rounded-xl px-3 py-1.5',
@@ -239,6 +239,7 @@ type DropdownMenuItem = {
239
239
  align?: 'start' | 'center' | 'end'
240
240
  alignOffset?: number
241
241
  arrowOffset?: number
242
+ open?: boolean // Forces the tooltip open or closed instead of showing it on hover
242
243
  }
243
244
  }
244
245
 
@@ -7,15 +7,22 @@ defineProps<{
7
7
  label: string
8
8
  icon: string
9
9
  color?: 'caution' | 'negative'
10
+ tooltip?: {
11
+ title: string
12
+ description: string
13
+ open: boolean
14
+ }
10
15
  onClick: () => void
11
16
  }[]
12
17
  }>()
13
18
 
19
+ const open = defineModel<boolean>('open', { default: false })
20
+
14
21
  const labels = useTelaLabels()
15
22
  </script>
16
23
 
17
24
  <template>
18
- <TelaDropdownMenuRoot>
25
+ <TelaDropdownMenuRoot v-model:open="open">
19
26
  <TelaDropdownMenuTrigger as-child>
20
27
  <button
21
28
  :aria-label="labels.userMenu"
@@ -41,6 +48,7 @@ const labels = useTelaLabels()
41
48
  :key="action.label"
42
49
  :icon="action.icon"
43
50
  :color="action.color"
51
+ :tooltip="action.tooltip && { variant: 'multiline', side: 'right', align: 'start', ...action.tooltip }"
44
52
  @click="action.onClick"
45
53
  >
46
54
  {{ action.label }}
@@ -189,15 +189,39 @@ interface TelaSidebarUserProps {
189
189
  image?: string // Optional — falls back to a placeholder if not provided
190
190
  name: string
191
191
  email: string
192
+ open?: boolean // Bind with v-model:open to open the menu programmatically
192
193
  actions: {
193
194
  label: string
194
195
  icon: string
195
196
  color?: 'caution' | 'negative' // Omit for the default style
197
+ tooltip?: { // Multiline tooltip pinned to the right of the item while `open` is true
198
+ title: string
199
+ description: string
200
+ open: boolean
201
+ }
196
202
  onClick: () => void
197
203
  }[]
198
204
  }
199
205
  ```
200
206
 
207
+ To point users at an action, open the menu with `v-model:open` and set that action's `tooltip.open`:
208
+
209
+ ```vue
210
+ <TelaSidebarUser
211
+ v-model:open="isMenuOpen"
212
+ name="Jane Doe"
213
+ email="jane@example.com"
214
+ :actions="[
215
+ {
216
+ label: 'Onboarding',
217
+ icon: 'i-ph-hand-waving-bold',
218
+ tooltip: { title: 'If you change your mind', description: 'Click here to view the onboarding again', open: isMenuOpen },
219
+ onClick: openOnboarding,
220
+ },
221
+ ]"
222
+ />
223
+ ```
224
+
201
225
  Example:
202
226
 
203
227
  ```vue
@@ -24,11 +24,13 @@ defineEmits<{
24
24
 
25
25
  // `open` forces the state when set; otherwise hover/focus drive it. The root is
26
26
  // always controlled so an `open` that arrives after mount is still forwarded.
27
+ // While forced, hover is switched off too: it can't change what's shown, but its
28
+ // delayed open would flip `instant-open` to `delayed-open` and replay the fade-in.
27
29
  const interactionOpen = ref(false)
28
30
  </script>
29
31
 
30
32
  <template>
31
- <TelaTooltipProvider :disabled="disabled" :delay-duration="delayDuration">
33
+ <TelaTooltipProvider :disabled="disabled || open !== undefined" :delay-duration="delayDuration">
32
34
  <TelaTooltipRoot :open="open ?? interactionOpen" @update:open="interactionOpen = $event">
33
35
  <TelaTooltipTrigger :class="triggerClass" :as-child="asChild" :reference="reference" :tabindex="asChild ? undefined : -1">
34
36
  <slot />
@@ -6,7 +6,7 @@ import { Meta, ArgTypes } from '@storybook/blocks';
6
6
 
7
7
  A video player with custom controls: play/pause, a hover volume slider, a scrubbable progress bar with buffered range and hover time, playback speed, captions, picture-in-picture and fullscreen. Controls fade out after a short idle while playing and come back on pointer movement or focus.
8
8
 
9
- The player is a 16:9 black surface in both themes, so its controls are always white.
9
+ The player is a 16:9 surface with always-white controls; it turns black only in fullscreen, to letterbox the video. Without a `poster`, the player shows a frame from the start of the video as its thumbnail. A `preview` clip (short, muted) loops as the cover instead until playback starts, and holds still for users who prefer reduced motion. Until playback starts, the player shows a centered play button and the video duration instead of the full controls.
10
10
 
11
11
  ## Props
12
12
 
@@ -14,6 +14,7 @@ The player is a 16:9 black surface in both themes, so its controls are always wh
14
14
  type VideoPlayerProps = {
15
15
  src: string
16
16
  poster?: string
17
+ preview?: string
17
18
  tracks?: VideoPlayerTrack[]
18
19
  crossorigin?: 'anonymous' | 'use-credentials'
19
20
  labels?: Partial<VideoPlayerLabels>
@@ -34,6 +35,28 @@ type VideoPlayerTrack = {
34
35
  - `play` — playback started
35
36
  - `pause` — playback paused
36
37
  - `ended` — playback reached the end
38
+ - `timeupdate` — the playback position changed, with the current time in seconds
39
+
40
+ ## Exposed Methods
41
+
42
+ - `seekTo(seconds)` — jump to a time; clamped to the duration once it's known
43
+ - `play()` — start playback
44
+
45
+ ```vue
46
+ <script setup lang="ts">
47
+ const player = useTemplateRef('player')
48
+
49
+ function playFrom(seconds: number) {
50
+ player.value?.seekTo(seconds)
51
+ player.value?.play()
52
+ }
53
+ </script>
54
+
55
+ <template>
56
+ <TelaVideoPlayer ref="player" src="https://tela.com/videos/hero-showcase.mp4" />
57
+ <button @click="playFrom(26)">Canvas</button>
58
+ </template>
59
+ ```
37
60
 
38
61
  ## Examples
39
62
 
@@ -84,6 +107,7 @@ const labels = { play: t('video.play'), pause: t('video.pause') }
84
107
  - The speed button cycles `1×`, `1.25×`, `1.5×`, `2×`.
85
108
  - Fullscreen uses the container, so the custom controls stay visible. iPhone Safari has no element fullscreen and falls back to the native video fullscreen.
86
109
  - Below the `sm` breakpoint the speed and picture-in-picture buttons are hidden.
110
+ - When the player itself is narrower than 400px, the volume and picture-in-picture buttons are hidden so the time labels keep their room.
87
111
 
88
112
  ## Keyboard
89
113
 
@@ -28,6 +28,8 @@ export type VideoPlayerLabels = {
28
28
  const props = withDefaults(defineProps<{
29
29
  src: string
30
30
  poster?: string
31
+ /** A short muted clip that loops as the cover until playback starts */
32
+ preview?: string
31
33
  tracks?: VideoPlayerTrack[]
32
34
  crossorigin?: 'anonymous' | 'use-credentials'
33
35
  labels?: Partial<VideoPlayerLabels>
@@ -41,6 +43,7 @@ const emit = defineEmits<{
41
43
  play: []
42
44
  pause: []
43
45
  ended: []
46
+ timeupdate: [seconds: number]
44
47
  }>()
45
48
 
46
49
  const DEFAULT_LABELS: VideoPlayerLabels = {
@@ -66,6 +69,10 @@ const video = ref<HTMLVideoElement>()
66
69
 
67
70
  const isMounted = useMounted()
68
71
 
72
+ const POSTER_FRAME_TIME = 0.1
73
+
74
+ const source = computed(() => (props.poster || props.preview || props.src.includes('#') ? props.src : `${props.src}#t=${POSTER_FRAME_TIME}`))
75
+
69
76
  const {
70
77
  playing,
71
78
  currentTime,
@@ -80,10 +87,12 @@ const {
80
87
  supportsPictureInPicture,
81
88
  togglePictureInPicture,
82
89
  } = useMediaControls(video, {
83
- src: toRef(props, 'src'),
90
+ src: source,
84
91
  tracks: toRef(props, 'tracks'),
85
92
  })
86
93
 
94
+ watch(currentTime, time => emit('timeupdate', time))
95
+
87
96
  const {
88
97
  isFullscreen,
89
98
  isSupported: isFullscreenSupported,
@@ -94,7 +103,13 @@ function togglePlay() {
94
103
  playing.value = !playing.value
95
104
  }
96
105
 
97
- /* The play toggle waits out the double-click window so a double click only toggles fullscreen. */
106
+ function playFromCover(event: MouseEvent) {
107
+ if (event.currentTarget === document.activeElement)
108
+ container.value?.focus({ preventScroll: true })
109
+
110
+ togglePlay()
111
+ }
112
+
98
113
  const DOUBLE_CLICK_DELAY = 250
99
114
 
100
115
  let surfaceClickTimer: ReturnType<typeof setTimeout> | undefined
@@ -229,7 +244,12 @@ function onBarPointerLeave() {
229
244
  }
230
245
 
231
246
  function seekTo(time: number) {
232
- currentTime.value = Math.min(Math.max(time, 0), duration.value)
247
+ /* Before metadata loads the duration is 0, so only clamp once it's known */
248
+ currentTime.value = Math.max(duration.value ? Math.min(time, duration.value) : time, 0)
249
+ }
250
+
251
+ function play() {
252
+ playing.value = true
233
253
  }
234
254
 
235
255
  function seekBy(delta: number) {
@@ -263,7 +283,7 @@ function onBarKeydown(event: KeyboardEvent) {
263
283
 
264
284
  const RATES = [1, 1.25, 1.5, 2]
265
285
 
266
- const rateLabel = computed(() => `${rate.value}×`)
286
+ const rateLabel = computed(() => `${Number.isInteger(rate.value) ? rate.value.toFixed(1) : rate.value}x`)
267
287
 
268
288
  function cycleRate() {
269
289
  const index = RATES.indexOf(rate.value)
@@ -385,6 +405,20 @@ const volumeIcon = computed(() => {
385
405
  return volume.value < 0.5 ? 'i-ph-speaker-low' : 'i-ph-speaker-high'
386
406
  })
387
407
 
408
+ const { width: playerWidth } = useElementSize(container)
409
+ const isNarrow = computed(() => playerWidth.value > 0 && playerWidth.value < 400)
410
+
411
+ const hasStarted = ref(false)
412
+
413
+ watch(playing, (isPlaying) => {
414
+ if (isPlaying)
415
+ hasStarted.value = true
416
+ })
417
+
418
+ const reducedMotion = usePreferredReducedMotion()
419
+
420
+ const isCoverVisible = computed(() => !hasStarted.value)
421
+
388
422
  const buttonClass = 'flex items-center justify-center shrink-0 size-28px rounded-8px text-white/90 transition-[color,background-color,transform] duration-150 ease-out hover:text-white hover:bg-white/15 active:scale-95 outline-none focus-visible:ring-1 focus-visible:ring-white/60'
389
423
 
390
424
  const timeClass = 'shrink-0 body-12-medium tabular-nums text-white'
@@ -400,17 +434,23 @@ const iconTransition = {
400
434
  duration: 0.3,
401
435
  bounce: 0,
402
436
  } as const
437
+
438
+ defineExpose({
439
+ seekTo,
440
+ play,
441
+ })
403
442
  </script>
404
443
 
405
444
  <template>
406
445
  <div
407
446
  ref="container"
408
- tabindex="0"
447
+ :tabindex="isCoverVisible ? -1 : 0"
409
448
  role="region"
410
449
  :aria-label="text.region"
411
450
  :class="cn(
412
- 'group/player relative w-full aspect-video bg-black rounded-16px overflow-hidden outline-none select-none focus-visible:ring-2 focus-visible:ring-white/60',
413
- isFullscreen && 'rounded-none',
451
+ 'group/player relative isolate w-full aspect-video rounded-16px overflow-hidden outline-none select-none focus-visible:ring-2 focus-visible:ring-white/60',
452
+ 'after:content-empty after:absolute after:inset-0 after:rounded-[inherit] after:border-[0.5px] after:border-black/12 after:pointer-events-none',
453
+ isFullscreen && 'rounded-none bg-black',
414
454
  !areControlsVisible && 'cursor-none',
415
455
  props.class,
416
456
  )"
@@ -428,7 +468,7 @@ const iconTransition = {
428
468
  preload="metadata"
429
469
  playsinline
430
470
  :class="cn(
431
- 'absolute inset-0 size-full object-contain [&::cue]:bg-black/65 [&::cue]:text-white [&::cue]:text-16px',
471
+ 'absolute inset-0 size-full rounded-[inherit] object-contain [&::cue]:bg-black/65 [&::cue]:text-white [&::cue]:text-16px',
432
472
  areControlsVisible ? 'cursor-pointer' : 'cursor-none',
433
473
  )"
434
474
  @click="onSurfaceClick"
@@ -438,18 +478,61 @@ const iconTransition = {
438
478
  @ended="emit('ended')"
439
479
  />
440
480
 
481
+ <video
482
+ v-if="preview && !hasStarted"
483
+ :src="preview"
484
+ :autoplay="reducedMotion !== 'reduce'"
485
+ aria-hidden="true"
486
+ muted
487
+ loop
488
+ playsinline
489
+ preload="auto"
490
+ class="pointer-events-none absolute inset-0 size-full rounded-[inherit] object-cover"
491
+ />
492
+
493
+ <Transition
494
+ enter-active-class="transition-opacity duration-200 ease-out"
495
+ leave-active-class="transition-opacity duration-200 ease-out"
496
+ enter-from-class="opacity-0"
497
+ leave-to-class="opacity-0"
498
+ >
499
+ <button
500
+ v-if="isCoverVisible"
501
+ type="button"
502
+ :aria-label="text.play"
503
+ class="group/cover absolute inset-0 rounded-[inherit] cursor-pointer outline-none"
504
+ @click="playFromCover"
505
+ >
506
+ <span
507
+ aria-hidden="true"
508
+ class="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 flex items-center justify-center size-36px rounded-10px bg-black/40 backdrop-blur-sm text-white transition-colors duration-100 ease-out group-hover/player:bg-black/50 group-focus-visible/cover:bg-black/60 group-focus-visible/cover:ring-1 group-focus-visible/cover:ring-cyan-600"
509
+ >
510
+ <TelaIcon name="i-ph-play-fill" size="18px" class="ml--1px" />
511
+ </span>
512
+
513
+ <span
514
+ v-if="duration"
515
+ class="absolute bottom-10px right-10px px-8px py-3px rounded-6px text-white/90 bg-black/40 backdrop-blur-sm body-12-semibold tabular-nums"
516
+ >
517
+ {{ durationLabel }}
518
+ </span>
519
+ </button>
520
+ </Transition>
521
+
441
522
  <div
442
523
  aria-hidden="true"
443
524
  :class="cn(
444
525
  'pointer-events-none absolute inset-x-0 bottom-0 h-120px bg-gradient-to-t from-black/60 to-transparent transition-opacity duration-300 ease-out',
445
- areControlsVisible ? 'opacity-100' : 'opacity-0',
526
+ areControlsVisible && !isCoverVisible ? 'opacity-100' : 'opacity-0',
446
527
  )"
447
528
  />
448
529
 
449
530
  <div
450
531
  :class="cn(
451
- 'absolute inset-x-0 bottom-0 flex items-center gap-12px px-24px pb-20px pt-32px text-white transition-opacity duration-300 ease-out max-sm:px-16px max-sm:pb-14px',
452
- areControlsVisible ? 'opacity-100' : 'opacity-0 pointer-events-none',
532
+ 'absolute inset-x-0 bottom-0 flex items-center max-w-1012px mx-auto gap-12px px-24px pb-20px pt-32px text-white transition-opacity duration-300 ease-out max-sm:px-16px max-sm:pb-14px',
533
+ isNarrow && 'px-16px pb-14px',
534
+ isCoverVisible && 'invisible',
535
+ areControlsVisible && !isCoverVisible ? 'opacity-100' : 'opacity-0 pointer-events-none',
453
536
  )"
454
537
  >
455
538
  <div class="flex items-center gap-8px">
@@ -476,7 +559,7 @@ const iconTransition = {
476
559
  </AnimatePresence>
477
560
  </button>
478
561
 
479
- <div class="group/volume relative flex items-center">
562
+ <div v-if="!isNarrow" class="group/volume relative flex items-center">
480
563
  <button
481
564
  type="button"
482
565
  :aria-label="muted ? text.unmute : text.mute"
@@ -562,7 +645,7 @@ const iconTransition = {
562
645
  <button
563
646
  type="button"
564
647
  :aria-label="text.playbackSpeed"
565
- :class="cn(buttonClass, 'min-w-52px body-12-medium tabular-nums max-sm:hidden')"
648
+ :class="cn(buttonClass, 'min-w-48px body-12-medium tabular-nums max-sm:hidden')"
566
649
  @click="cycleRate"
567
650
  >
568
651
  {{ rateLabel }}
@@ -580,7 +663,7 @@ const iconTransition = {
580
663
  </button>
581
664
 
582
665
  <button
583
- v-if="isMounted && supportsPictureInPicture"
666
+ v-if="isMounted && supportsPictureInPicture && !isNarrow"
584
667
  type="button"
585
668
  :aria-label="text.pictureInPicture"
586
669
  :class="cn(buttonClass, 'max-sm:hidden')"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/tela-build",
3
- "version": "1.87.3",
3
+ "version": "1.88.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "app.config.ts",