@nexxtmove/ui 2.3.0 → 2.4.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.
@@ -49,9 +49,16 @@ export interface NexxtVideoControlsProps {
49
49
  fullscreenTarget?: HTMLElement | null;
50
50
  /**
51
51
  * `full`: the bar; `toggle`: a 32px play/pause button in the corner, with mute to its left on
52
- * hover, focus or a tap. Both hide while playing by the same rules. Defaults to `full`.
52
+ * hover, focus or a tap (see `showMute`). Both hide while playing by the same rules. Defaults
53
+ * to `full`.
53
54
  */
54
55
  variant?: NexxtVideoControlsVariant;
56
+ /**
57
+ * Toggle only: the mute button left of play/pause. Off leaves play/pause alone in the corner,
58
+ * e.g. for a background video that is always muted and may only be paused. The `full` bar
59
+ * ignores it. Defaults to `true`.
60
+ */
61
+ showMute?: boolean;
55
62
  /** The video's name, for the name of the bar (or of the toggle's buttons). */
56
63
  name?: string;
57
64
  /** Hide the bar (or the toggle) after inactivity while the video plays. Off keeps it on show. Defaults to `true`. */
package/dist/index.js CHANGED
@@ -13096,6 +13096,10 @@ var eh = { render: $m }, th = { class: "flex items-center justify-end self-stret
13096
13096
  target: {},
13097
13097
  fullscreenTarget: { default: null },
13098
13098
  variant: { default: "full" },
13099
+ showMute: {
13100
+ type: Boolean,
13101
+ default: !0
13102
+ },
13099
13103
  name: { default: "" },
13100
13104
  autoHide: {
13101
13105
  type: Boolean,
@@ -13278,7 +13282,9 @@ var eh = { render: $m }, th = { class: "flex items-center justify-end self-stret
13278
13282
  e.variant === "full" && Oe();
13279
13283
  return;
13280
13284
  }
13281
- clearTimeout(Ee), z.value = !(e.variant === "toggle" ? me.value : ue.value), z.value && (Ee = setTimeout(() => {
13285
+ clearTimeout(Ee);
13286
+ let t = e.variant === "toggle" && e.showMute;
13287
+ z.value = !(t ? me.value : ue.value), z.value && (Ee = setTimeout(() => {
13282
13288
  z.value = !1;
13283
13289
  }, e.hideDelay));
13284
13290
  });
@@ -13328,7 +13334,8 @@ var eh = { render: $m }, th = { class: "flex items-center justify-end self-stret
13328
13334
  onFocusin: Ze,
13329
13335
  onFocusout: Qe,
13330
13336
  onKeydown: et
13331
- }, [c("button", {
13337
+ }, [e.showMute ? (D(), s("button", {
13338
+ key: 0,
13332
13339
  type: "button",
13333
13340
  "aria-label": ge.value,
13334
13341
  class: x(["group/mute flex cursor-pointer rounded-full bg-black/50 small-normal text-white ring-1 ring-white/30 backdrop-blur-xs transition-opacity focus-visible:ring-2 focus-visible:ring-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600 motion-reduce:transition-none", he.value]),
@@ -13337,7 +13344,7 @@ var eh = { render: $m }, th = { class: "flex items-center justify-end self-stret
13337
13344
  name: ae.value,
13338
13345
  type: "solid",
13339
13346
  class: "[--fa-width:auto]"
13340
- }, null, 8, ["name"])])])], 10, t_), c("button", {
13347
+ }, null, 8, ["name"])])])], 10, t_)) : o("", !0), c("button", {
13341
13348
  ref_key: "playButton",
13342
13349
  ref: d,
13343
13350
  type: "button",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nexxtmove/ui",
3
3
  "type": "module",
4
- "version": "2.3.0",
4
+ "version": "2.4.0",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -54,9 +54,16 @@ export interface NexxtVideoControlsProps {
54
54
  fullscreenTarget?: HTMLElement | null
55
55
  /**
56
56
  * `full`: the bar; `toggle`: a 32px play/pause button in the corner, with mute to its left on
57
- * hover, focus or a tap. Both hide while playing by the same rules. Defaults to `full`.
57
+ * hover, focus or a tap (see `showMute`). Both hide while playing by the same rules. Defaults
58
+ * to `full`.
58
59
  */
59
60
  variant?: NexxtVideoControlsVariant
61
+ /**
62
+ * Toggle only: the mute button left of play/pause. Off leaves play/pause alone in the corner,
63
+ * e.g. for a background video that is always muted and may only be paused. The `full` bar
64
+ * ignores it. Defaults to `true`.
65
+ */
66
+ showMute?: boolean
60
67
  /** The video's name, for the name of the bar (or of the toggle's buttons). */
61
68
  name?: string
62
69
  /** Hide the bar (or the toggle) after inactivity while the video plays. Off keeps it on show. Defaults to `true`. */
@@ -81,6 +88,7 @@ const {
81
88
  target,
82
89
  fullscreenTarget = null,
83
90
  variant = 'full',
91
+ showMute = true,
84
92
  name = '',
85
93
  autoHide = true,
86
94
  hideDelay = 2500,
@@ -583,9 +591,11 @@ const onVideoClick = () => {
583
591
  return
584
592
  }
585
593
 
586
- // A tap toggles what touch cannot hover for: the bar, or the toggle's mute button
594
+ // A tap toggles what touch cannot hover for: the bar, or the toggle's mute button. A toggle
595
+ // without one is a bar of one button: the tap toggles the toggle itself
587
596
  clearTimeout(touchTimer)
588
- touchShown.value = !(variant === 'toggle' ? toggleMuteShown.value : visible.value)
597
+ const tapRevealsMute = variant === 'toggle' && showMute
598
+ touchShown.value = !(tapRevealsMute ? toggleMuteShown.value : visible.value)
589
599
  if (touchShown.value) {
590
600
  touchTimer = setTimeout(() => {
591
601
  touchShown.value = false
@@ -747,7 +757,7 @@ onBeforeUnmount(() => {
747
757
  The corner buttons: play/pause in the corner, and mute to its left on hover, focus or a tap
748
758
  (DOM and tab order follow what is seen: mute, then play). Mute is transparent when hidden,
749
759
  never removed, so play keeps its place and both stay in the tab order. Both fade with the
750
- same rules as the bar.
760
+ same rules as the bar. Without `showMute` there is no mute at all; play stays in the corner.
751
761
  -->
752
762
  <div
753
763
  ref="capsule"
@@ -762,6 +772,7 @@ onBeforeUnmount(() => {
762
772
  @keydown="onKeyInside"
763
773
  >
764
774
  <button
775
+ v-if="showMute"
765
776
  type="button"
766
777
  :aria-label="toggleMuteLabel"
767
778
  class="group/mute flex cursor-pointer rounded-full bg-black/50 small-normal text-white ring-1 ring-white/30 backdrop-blur-xs transition-opacity focus-visible:ring-2 focus-visible:ring-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600 motion-reduce:transition-none"