@wyxos/vibe 5.0.1 → 5.0.3

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/README.md CHANGED
@@ -112,9 +112,12 @@ zero-based `mediaIndex`, its inclusive `mediaCount`, and the optional remote
112
112
  `total`. Import the `VibeCardRegionProps` type for typed Vue props. Interacting
113
113
  with these regions does not activate the underlying media.
114
114
 
115
- Masonry videos start muted, while reel videos start unmuted. Set
116
- `mediaCard.videoMuted` to explicitly override the initial state in either
117
- layout. Users can still change mute and volume through the timed-media controls.
115
+ Masonry videos start muted, while the active reel video starts unmuted. Inactive
116
+ reel videos are always paused and muted while they remain mounted for nearby
117
+ virtualization; their user-selected mute state is restored when they become
118
+ active again. Set `mediaCard.videoMuted` to explicitly override the initial
119
+ state in either layout. Users can still change mute and volume through the
120
+ timed-media controls.
118
121
 
119
122
  When a feed item has entries in `item.items`, Vibe treats the parent media as
120
123
  position one and the nested entries as the remaining positions. Masonry cards
@@ -122,6 +125,8 @@ show looping previous/next controls on hover or keyboard focus. Reel layout
122
125
  keeps those controls visible and supports native horizontal-wheel or touch-swipe
123
126
  navigation through grouped media. Media changes use a directional horizontal
124
127
  transition, while vertical reel scrolling continues to move between posts.
128
+ Media assets may include a stable `mediaId` (`string | number`) when consumers
129
+ need to select exact grouped media independently of its array position.
125
130
 
126
131
  ## Reel URLs with Vue Router
127
132
 
@@ -501,6 +506,9 @@ vibe.previousReelMediaItem()
501
506
  // Posts within the reel (vertical reel navigation).
502
507
  vibe.nextReelPost()
503
508
  vibe.previousReelPost()
509
+
510
+ // An exact loaded post/media pair by stable identity.
511
+ vibe.navigateToReelItem({ postId: 'post-42', mediaId: 'asset-101' })
504
512
  ```
505
513
 
506
514
  Each navigation method returns `true` when it accepted a navigation and `false`
@@ -517,6 +525,13 @@ Successful navigation updates `state.activeReelPostId`, the selected media item,
517
525
  card-region props, route synchronization, and an open information sheet's
518
526
  consumer context through the same handlers used by gestures and keyboard input.
519
527
 
528
+ `navigateToReelItem()` returns `navigated` when both identities resolve,
529
+ including when the requested media is already active. It returns `not-found`
530
+ when the loaded post or media is missing, and `reel-inactive` before mount,
531
+ after destroy, during initial loading, or while only masonry is visible. The
532
+ method does not load, insert, or fall back to another item. Every targetable
533
+ parent or nested `VibeMediaAsset` must provide its stable `mediaId`.
534
+
520
535
  ## Reel information sheet
521
536
 
522
537
  Provide an application-owned Vue component when a reel should offer a
@@ -581,6 +596,11 @@ reel still updates this requested state; the sheet becomes visible when a valid
581
596
  reel context exists. This preserves the existing persistent sheet-state
582
597
  behavior across masonry viewer closes.
583
598
 
599
+ When a sheet contains another Vibe instance, Escape is owned by the topmost
600
+ active reel. A nested masonry-origin reel therefore closes back to its nested
601
+ feed without also closing the parent sheet or reel. Single-instance Escape
602
+ behavior is unchanged.
603
+
584
604
  ## Custom feed footer
585
605
 
586
606
  Set `feedFooter.component` to replace the built-in `GalleryFooter`. Consumers
@@ -689,6 +709,7 @@ vibe.nextReelMediaItem()
689
709
  vibe.previousReelMediaItem()
690
710
  vibe.nextReelPost()
691
711
  vibe.previousReelPost()
712
+ vibe.navigateToReelItem({ postId: 'post-42', mediaId: 'asset-101' })
692
713
  vibe.setAutoScroll(true, 80)
693
714
  vibe.pauseAutoScroll()
694
715
  vibe.resumeAutoScroll()
@@ -3,6 +3,7 @@ import type { VibeItemId } from '../types';
3
3
  declare function loadIfNearBottom(): void;
4
4
  declare function changeActiveMedia(direction: -1 | 1): boolean;
5
5
  declare function moveActivePost(direction: -1 | 1): boolean;
6
+ declare function navigateToItem(postId: VibeItemId, mediaIndex: number): boolean;
6
7
  declare function transitionActivePost(postId: VibeItemId): Promise<boolean>;
7
8
  declare function transitionActiveMedia(direction: -1 | 1): Promise<boolean>;
8
9
  declare const __VLS_export: import("vue").DefineComponent<ReelFeedProps, {
@@ -11,6 +12,7 @@ declare const __VLS_export: import("vue").DefineComponent<ReelFeedProps, {
11
12
  changeActiveMedia: typeof changeActiveMedia;
12
13
  loadIfNearBottom: typeof loadIfNearBottom;
13
14
  moveActivePost: typeof moveActivePost;
15
+ navigateToItem: typeof navigateToItem;
14
16
  transitionActiveMedia: typeof transitionActiveMedia;
15
17
  transitionActivePost: typeof transitionActivePost;
16
18
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -3,12 +3,14 @@ import type { VibeItemId } from '../types';
3
3
  declare function changeActiveMedia(direction: -1 | 1): boolean;
4
4
  declare function loadIfNearBottom(): void;
5
5
  declare function moveActivePost(direction: -1 | 1): boolean;
6
+ declare function navigateToItem(postId: VibeItemId, mediaIndex: number): boolean;
6
7
  declare function transitionActiveMedia(direction: -1 | 1): Promise<boolean>;
7
8
  declare function transitionActivePost(postId: VibeItemId): Promise<boolean>;
8
9
  declare const __VLS_export: import("vue").DefineComponent<ReelLayoutProps, {
9
10
  changeActiveMedia: typeof changeActiveMedia;
10
11
  loadIfNearBottom: typeof loadIfNearBottom;
11
12
  moveActivePost: typeof moveActivePost;
13
+ navigateToItem: typeof navigateToItem;
12
14
  transitionActiveMedia: typeof transitionActiveMedia;
13
15
  transitionActivePost: typeof transitionActivePost;
14
16
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -1,5 +1,5 @@
1
1
  import { type VibeRuntimeState } from '../core/runtime';
2
- import type { VibeCardRegion, VibeFeedFooter, VibeFeedFooterActions, VibeItemId, VibeMediaCardOptions, VibeReelInfoSheetOptions } from '../types';
2
+ import type { VibeCardRegion, VibeFeedFooter, VibeFeedFooterActions, VibeItemId, VibeMediaCardOptions, VibeReelInfoSheetOptions, VibeReelItemTarget, VibeReelNavigationResult } from '../types';
3
3
  type __VLS_Props = {
4
4
  canRetryEnd: boolean;
5
5
  cardFooter?: VibeCardRegion;
@@ -13,6 +13,7 @@ type __VLS_Props = {
13
13
  declare function loadIfNearBottom(): Promise<void>;
14
14
  declare function changeActiveReelMedia(direction: -1 | 1): boolean;
15
15
  declare function moveActiveReelPost(direction: -1 | 1): boolean;
16
+ declare function navigateToReelItem(target: VibeReelItemTarget): VibeReelNavigationResult;
16
17
  declare function getAutoScrollElement(): HTMLElement | null;
17
18
  declare function startItemRemoval(postIds: readonly VibeItemId[]): number;
18
19
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
@@ -20,6 +21,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
20
21
  getAutoScrollElement: typeof getAutoScrollElement;
21
22
  loadIfNearBottom: typeof loadIfNearBottom;
22
23
  moveActiveReelPost: typeof moveActiveReelPost;
24
+ navigateToReelItem: typeof navigateToReelItem;
23
25
  startItemRemoval: typeof startItemRemoval;
24
26
  transitionActiveReelMedia: (direction: -1 | 1) => Promise<boolean>;
25
27
  transitionActiveReelPost: (postId: VibeItemId) => Promise<boolean>;
@@ -0,0 +1,12 @@
1
+ import type { FeedRendererExpose } from '../core/feed';
2
+ import type { VibeRuntimeState } from '../core/runtime';
3
+ interface ReelKeyboardOptions {
4
+ closeMasonryReel: () => void;
5
+ element: () => HTMLElement | null;
6
+ isReelLeaving: () => boolean;
7
+ reelRenderer: () => FeedRendererExpose | null;
8
+ setReelInfoSheet: (enabled: boolean) => void;
9
+ state: VibeRuntimeState;
10
+ }
11
+ export declare function useReelKeyboard(options: ReelKeyboardOptions): void;
12
+ export {};
@@ -0,0 +1,15 @@
1
+ import { type Ref } from 'vue';
2
+ import type { VibeLayout } from '../types';
3
+ interface ReelVideoActivityOptions {
4
+ active: () => boolean | undefined;
5
+ layout: () => VibeLayout;
6
+ videoElement: Ref<HTMLVideoElement | null>;
7
+ videoIsMuted: Ref<boolean>;
8
+ videoIsPlaying: Ref<boolean>;
9
+ }
10
+ export declare function useReelVideoActivity(options: ReelVideoActivityOptions): {
11
+ effectiveMuted: import("vue").ComputedRef<boolean>;
12
+ onPlaying: () => void;
13
+ playbackAllowed: import("vue").ComputedRef<boolean>;
14
+ };
15
+ export {};
@@ -1,4 +1,4 @@
1
- import type { VibeCardRegion, VibeFeedFooter, VibeFeedFooterActions, VibeItem, VibeItemId, VibeMediaSource, VibeMediaCardOptions, VibeReelAutoAdvanceState, VibeReelForwardState, VibeReelInfoSheetOptions, VibeReelOrigin, VibeState } from '../types';
1
+ import type { VibeCardRegion, VibeFeedFooter, VibeFeedFooterActions, VibeItem, VibeItemId, VibeMediaSource, VibeMediaCardOptions, VibeReelAutoAdvanceState, VibeReelForwardState, VibeReelInfoSheetOptions, VibeReelItemTarget, VibeReelNavigationResult, VibeReelOrigin, VibeState } from '../types';
2
2
  import type { MediaPreviewState } from './mediaPreview';
3
3
  export interface FeedRendererProps {
4
4
  canRetryEnd: boolean;
@@ -30,6 +30,7 @@ export interface FeedRendererExpose {
30
30
  getScrollElement?: () => HTMLElement | null;
31
31
  loadIfNearBottom: () => void;
32
32
  moveActivePost?: (direction: -1 | 1) => boolean;
33
+ navigateToItem?: (postId: VibeItemId, mediaIndex: number) => boolean;
33
34
  transitionActiveMedia?: (direction: -1 | 1) => Promise<boolean>;
34
35
  transitionActivePost?: (postId: VibeItemId) => Promise<boolean>;
35
36
  }
@@ -52,6 +53,7 @@ export interface VibeSurfaceExpose {
52
53
  getAutoScrollElement: () => HTMLElement | null;
53
54
  loadIfNearBottom: () => Promise<void>;
54
55
  moveActiveReelPost: (direction: -1 | 1) => boolean;
56
+ navigateToReelItem: (target: VibeReelItemTarget) => VibeReelNavigationResult;
55
57
  startItemRemoval: (postIds: readonly VibeItemId[]) => number;
56
58
  transitionActiveReelMedia: (direction: -1 | 1) => Promise<boolean>;
57
59
  transitionActiveReelPost: (postId: VibeItemId) => Promise<boolean>;
@@ -0,0 +1,6 @@
1
+ export interface ReelEscapeParticipant {
2
+ element: () => HTMLElement | null;
3
+ isActive: () => boolean;
4
+ }
5
+ export declare function registerReelEscapeParticipant(participant: ReelEscapeParticipant): () => void;
6
+ export declare function isTopmostActiveReel(participant: ReelEscapeParticipant): boolean;