@wyxos/vibe 5.8.1 → 5.8.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
@@ -99,7 +99,7 @@ const vibe = createVibe({
99
99
  height: 48,
100
100
  },
101
101
  mediaCard: {
102
- feedPreload: 'replacement',
102
+ feedPreload: 'visible-post',
103
103
  videoMuted: true,
104
104
  },
105
105
  })
@@ -122,9 +122,11 @@ active again. Set `mediaCard.videoMuted` to explicitly override the initial
122
122
  state in either layout. Users can still change mute and volume through the
123
123
  timed-media controls.
124
124
 
125
- Set `mediaCard.feedPreload` to `replacement` to warm the exact preview source
126
- that a grouped masonry card will show after its current media item is removed.
127
- The default is `none`, so consumers opt in to the additional request.
125
+ Set `mediaCard.feedPreload` to `'visible-post'` to warm every other preview in
126
+ a grouped masonry card after its visible media is ready. Only cards in the
127
+ exact viewport qualify: images are fetched at low priority and decoded, while
128
+ video or audio sources load metadata without preloading their full bodies.
129
+ The default is `'none'`, and reel loading is unchanged.
128
130
 
129
131
  Applications that need audio continuity can pass `initialReelAudioState` with
130
132
  `volume`, `muted`, and `lastAudibleVolume`, then persist user changes through
@@ -8,6 +8,7 @@ type __VLS_Props = {
8
8
  cardHeader?: VibeCardRegion;
9
9
  entering: boolean;
10
10
  fetchPriority: 'high' | 'low';
11
+ inViewport?: boolean;
11
12
  index: number;
12
13
  item: VibeItem;
13
14
  itemStyle?: CSSProperties;
@@ -1,5 +1,6 @@
1
1
  import type { VibeItem, VibeLayout, VibeMediaCardOptions, VibeMediaSource } from '../types';
2
- interface FeedReplacementPreloadOptions {
2
+ interface VisiblePostPreloadOptions {
3
+ inViewport: () => boolean;
3
4
  item: () => VibeItem;
4
5
  layout: () => VibeLayout;
5
6
  mediaCard: () => VibeMediaCardOptions | undefined;
@@ -7,5 +8,5 @@ interface FeedReplacementPreloadOptions {
7
8
  mediaReady: () => boolean;
8
9
  mediaSource: () => VibeMediaSource;
9
10
  }
10
- export declare function useFeedReplacementPreload(options: FeedReplacementPreloadOptions): void;
11
+ export declare function useVisiblePostPreload(options: VisiblePostPreloadOptions): void;
11
12
  export {};
@@ -6,7 +6,7 @@ export interface VibeCardChromeStyle {
6
6
  }
7
7
  export interface VibeMediaCardOptions {
8
8
  error?: VibeMediaError;
9
- feedPreload?: 'none' | 'replacement';
9
+ feedPreload?: 'none' | 'visible-post';
10
10
  footer?: VibeCardChromeStyle;
11
11
  header?: VibeCardChromeStyle;
12
12
  videoMuted?: boolean;
@@ -0,0 +1,22 @@
1
+ import type { VibeItem, VibeMediaSource } from '../types';
2
+ export declare const VISIBLE_POST_PRELOAD_CONCURRENCY = 6;
3
+ export declare const VISIBLE_POST_TIMED_PRELOAD_CONCURRENCY = 2;
4
+ export interface VisiblePostPreloadTarget {
5
+ key: string;
6
+ src: string;
7
+ timed: boolean;
8
+ }
9
+ type EntryState = 'queued' | 'loading' | 'ready' | 'failed';
10
+ export declare function visiblePostPreloadTargets(item: VibeItem, mediaIndex: number, mediaSource: VibeMediaSource): VisiblePostPreloadTarget[];
11
+ export declare function acquireVisiblePostPreload(target: VisiblePostPreloadTarget): () => void;
12
+ export declare function visiblePostPreloadSchedulerSnapshot(): {
13
+ active: number;
14
+ activeTimed: number;
15
+ entries: Array<{
16
+ key: string;
17
+ refs: number;
18
+ state: EntryState;
19
+ }>;
20
+ };
21
+ export declare function resetVisiblePostPreloadSchedulerForTests(): void;
22
+ export {};