@wyxos/vibe 3.0.5 → 3.0.7

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
@@ -305,6 +305,12 @@ const vibe = ref<VibeHandle | null>(null)
305
305
 
306
306
  Available methods:
307
307
 
308
+ - `lockPageLoading()`
309
+ - `unlockPageLoading()`
310
+ - `loadNext()`
311
+ - `loadPrevious()`
312
+ - `retry()`
313
+ - `cancel()`
308
314
  - `remove(ids)`
309
315
  - `restore(ids)`
310
316
  - `undo()`
@@ -327,6 +333,7 @@ type VibeStatus = {
327
333
  loadState: 'failed' | 'loaded' | 'loading'
328
334
  mode: 'dynamic' | 'static'
329
335
  nextCursor: string | null
336
+ pageLoadingLocked: boolean
330
337
  phase: 'failed' | 'filling' | 'idle' | 'initializing' | 'loading' | 'refreshing'
331
338
  previousCursor: string | null
332
339
  removedCount: number
@@ -338,9 +345,12 @@ type VibeStatus = {
338
345
  Example:
339
346
 
340
347
  ```ts
348
+ vibe.value?.lockPageLoading()
341
349
  vibe.value?.remove(['item-2', 'item-5'])
342
350
  vibe.value?.undo()
351
+ vibe.value?.unlockPageLoading()
343
352
  console.log(vibe.value?.status.itemCount)
353
+ console.log(vibe.value?.status.pageLoadingLocked)
344
354
  console.log(vibe.value?.status.removedIds)
345
355
  ```
346
356
 
@@ -1,12 +1,13 @@
1
1
  import type { Component } from 'vue';
2
2
  import type { VibeViewerItem } from './viewer';
3
3
  import type { VibeAssetErrorReporter, VibeAssetLoadReporter } from './viewer-core/assetErrors';
4
- import type { VibeFullscreenStatusSlotProps, VibeSurfaceSlotProps } from './viewer-core/surfaceSlots';
4
+ import type { VibeEmptyStateMode, VibeEmptyStateSlotProps, VibeFullscreenStatusSlotProps, VibeSurfaceSlotProps } from './viewer-core/surfaceSlots';
5
5
  import type { VibeLoadPhase } from './viewer-core/useViewer';
6
6
  import './viewer-core/fullscreenMediaBar.css';
7
7
  interface FullscreenSurfaceProps {
8
8
  active?: boolean;
9
9
  activeIndex?: number;
10
+ emptyStateMode?: VibeEmptyStateMode;
10
11
  errorMessage?: string | null;
11
12
  hasNextPage?: boolean;
12
13
  items: VibeViewerItem[];
@@ -20,6 +21,7 @@ interface FullscreenSurfaceProps {
20
21
  showStatusBadges?: boolean;
21
22
  }
22
23
  type __VLS_Slots = {
24
+ 'empty-state'?: (props: VibeEmptyStateSlotProps) => unknown;
23
25
  'fullscreen-aside'?: (props: VibeSurfaceSlotProps) => unknown;
24
26
  'fullscreen-header-actions'?: (props: VibeSurfaceSlotProps) => unknown;
25
27
  'fullscreen-overlay'?: (props: VibeSurfaceSlotProps) => unknown;
@@ -37,6 +39,7 @@ declare const __VLS_base: import("vue").DefineComponent<FullscreenSurfaceProps,
37
39
  "onBack-to-list"?: (() => any) | undefined;
38
40
  }>, {
39
41
  loading: boolean;
42
+ emptyStateMode: VibeEmptyStateMode;
40
43
  paginationDetail: string | null;
41
44
  showEndBadge: boolean;
42
45
  showStatusBadges: boolean;
@@ -1,9 +1,10 @@
1
1
  import { type Component } from 'vue';
2
2
  import type { VibeViewerItem } from './viewer';
3
3
  import { type VibeAssetErrorEvent, type VibeAssetLoadEvent } from './viewer-core/assetErrors';
4
- import type { VibeFullscreenStatusSlotProps, VibeGridStatusSlotProps, VibeSurfaceSlotProps } from './viewer-core/surfaceSlots';
4
+ import type { VibeEmptyStateSlotProps, VibeFullscreenStatusSlotProps, VibeGridStatusSlotProps, VibeSurfaceSlotProps } from './viewer-core/surfaceSlots';
5
5
  import type { VibeHandle, VibeProps } from './viewer-core/useViewer';
6
6
  type __VLS_Slots = {
7
+ 'empty-state'?: (props: VibeEmptyStateSlotProps) => unknown;
7
8
  'fullscreen-aside'?: (props: VibeSurfaceSlotProps) => unknown;
8
9
  'fullscreen-header-actions'?: (props: VibeSurfaceSlotProps) => unknown;
9
10
  'fullscreen-overlay'?: (props: VibeSurfaceSlotProps) => unknown;
@@ -1,13 +1,14 @@
1
1
  import type { Component } from 'vue';
2
2
  import type { VibeViewerItem } from './viewer';
3
3
  import type { VibeAssetErrorReporter, VibeAssetLoadReporter } from './viewer-core/assetErrors';
4
- import type { VibeGridStatusSlotProps } from './viewer-core/surfaceSlots';
4
+ import type { VibeEmptyStateMode, VibeEmptyStateSlotProps, VibeGridStatusSlotProps } from './viewer-core/surfaceSlots';
5
5
  import type { VibeLoadPhase } from './viewer-core/useViewer';
6
6
  type __VLS_Props = {
7
7
  active?: boolean;
8
8
  activeIndex?: number;
9
9
  allowExhaustedNextPageRefresh?: boolean;
10
10
  commitPendingAppend?: (() => void | Promise<void>) | null;
11
+ emptyStateMode?: VibeEmptyStateMode;
11
12
  errorMessage?: string | null;
12
13
  hasNextPage?: boolean;
13
14
  hasPreviousPage?: boolean;
@@ -23,6 +24,7 @@ type __VLS_Props = {
23
24
  showStatusBadges?: boolean;
24
25
  };
25
26
  type __VLS_Slots = {
27
+ 'empty-state'?: (props: VibeEmptyStateSlotProps) => unknown;
26
28
  'grid-footer'?: () => unknown;
27
29
  'grid-item-overlay'?: (props: {
28
30
  active: boolean;
@@ -46,6 +48,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
46
48
  "onOpen-fullscreen"?: ((index: number) => any) | undefined;
47
49
  }>, {
48
50
  loading: boolean;
51
+ emptyStateMode: VibeEmptyStateMode;
49
52
  paginationDetail: string | null;
50
53
  showStatusBadges: boolean;
51
54
  activeIndex: number;
@@ -0,0 +1,21 @@
1
+ import type { VibeEmptyStateSlotProps } from './viewer-core/surfaceSlots';
2
+ type __VLS_Props = {
3
+ message: string;
4
+ mode: VibeEmptyStateSlotProps['mode'];
5
+ surface: VibeEmptyStateSlotProps['surface'];
6
+ };
7
+ declare var __VLS_1: {}, __VLS_3: {};
8
+ type __VLS_Slots = {} & {
9
+ default?: (props: typeof __VLS_1) => any;
10
+ } & {
11
+ default?: (props: typeof __VLS_3) => any;
12
+ };
13
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
15
+ declare const _default: typeof __VLS_export;
16
+ export default _default;
17
+ type __VLS_WithSlots<T, S> = T & {
18
+ new (): {
19
+ $slots: S;
20
+ };
21
+ };
@@ -17,6 +17,7 @@ export interface VibeStatus {
17
17
  loadState: 'failed' | 'loaded' | 'loading';
18
18
  mode: VibeFeedMode;
19
19
  nextCursor: string | null;
20
+ pageLoadingLocked: boolean;
20
21
  phase: VibeLoadPhase;
21
22
  previousCursor: string | null;
22
23
  removedCount: number;
@@ -27,6 +28,7 @@ export interface VibeHandle {
27
28
  cancel: () => void;
28
29
  clearRemoved: () => void;
29
30
  getRemovedIds: () => string[];
31
+ lockPageLoading: () => void;
30
32
  loadNext: () => Promise<void>;
31
33
  loadPrevious: () => Promise<void>;
32
34
  remove: (ids: string | string[]) => VibeRemoveResult;
@@ -34,6 +36,7 @@ export interface VibeHandle {
34
36
  retry: () => Promise<void>;
35
37
  status: Readonly<VibeStatus>;
36
38
  undo: () => VibeRemoveResult | null;
39
+ unlockPageLoading: () => void;
37
40
  }
38
41
  export declare function useVibeRemovalState(): {
39
42
  clearRemoved: () => void;
@@ -7,6 +7,14 @@ export type VibeSurfaceSlotProps = {
7
7
  paginationDetail: string | null;
8
8
  total: number;
9
9
  };
10
+ export type VibeEmptyStateMode = 'inline' | 'badge' | 'hidden';
11
+ export type VibeEmptyStateSlotProps = {
12
+ loading: boolean;
13
+ message: string;
14
+ mode: Exclude<VibeEmptyStateMode, 'hidden'>;
15
+ surface: 'fullscreen' | 'grid';
16
+ total: number;
17
+ };
10
18
  export type VibeSurfaceStatusKind = 'end' | 'failed' | 'filling' | 'initializing' | 'loading-more' | 'refreshing';
11
19
  export type VibeFullscreenStatusSlotProps = VibeSurfaceSlotProps & {
12
20
  kind: VibeSurfaceStatusKind;
@@ -32,7 +32,9 @@ export declare function useAutoResolveSource(options: {
32
32
  fillTargetCount: Ref<number | null, number | null>;
33
33
  hasNextPage: import("vue").ComputedRef<boolean>;
34
34
  hasPreviousPage: import("vue").ComputedRef<boolean>;
35
+ isPageLoadingLocked: Ref<boolean, boolean>;
35
36
  items: import("vue").ComputedRef<VibeViewerItem[]>;
37
+ lockPageLoading: () => void;
36
38
  loading: import("vue").ComputedRef<boolean>;
37
39
  mode: import("vue").ComputedRef<VibeFeedMode>;
38
40
  nextCursor: import("vue").ComputedRef<string | null>;
@@ -46,6 +48,7 @@ export declare function useAutoResolveSource(options: {
46
48
  setActiveIndex: (nextIndex: number) => void;
47
49
  setAutoPrefetchEnabled: (nextValue: boolean) => void;
48
50
  syncActiveIndexAfterVisibilityChange: (anchorOccurrenceKey?: string | null) => void;
51
+ unlockPageLoading: () => void;
49
52
  getActiveOccurrenceKey: () => string | null;
50
53
  maybeCommitPendingAppendWhenFilteredOut: () => void;
51
54
  };
@@ -4,6 +4,7 @@ export declare const DESKTOP_BREAKPOINT_PX = 1024;
4
4
  export declare function useController(props: Readonly<VibeProps>, emit: VibeEmit): {
5
5
  cancel: () => void;
6
6
  isDesktop: import("vue").ComputedRef<boolean>;
7
+ lockPageLoading: () => void;
7
8
  loadNext: () => Promise<void>;
8
9
  loadPrevious: () => Promise<void>;
9
10
  openFullscreen: (index: number) => void;
@@ -23,6 +24,7 @@ export declare function useController(props: Readonly<VibeProps>, emit: VibeEmit
23
24
  readonly loadState: "failed" | "loaded" | "loading";
24
25
  readonly mode: import("./removalState").VibeFeedMode;
25
26
  readonly nextCursor: string | null;
27
+ readonly pageLoadingLocked: boolean;
26
28
  readonly phase: import("./removalState").VibeLoadPhase;
27
29
  readonly previousCursor: string | null;
28
30
  readonly removedCount: number;
@@ -30,6 +32,7 @@ export declare function useController(props: Readonly<VibeProps>, emit: VibeEmit
30
32
  readonly surfaceMode: VibeSurfaceMode;
31
33
  };
32
34
  surfaceMode: import("vue").ComputedRef<VibeSurfaceMode>;
35
+ unlockPageLoading: () => void;
33
36
  activeIndex: import("vue").ComputedRef<number>;
34
37
  canRefreshExhaustedNextPage: import("vue").ComputedRef<boolean>;
35
38
  canRetryInitialLoad: import("vue").ComputedRef<boolean>;
@@ -43,6 +46,7 @@ export declare function useController(props: Readonly<VibeProps>, emit: VibeEmit
43
46
  getRemovedIds: () => string[];
44
47
  hasNextPage: import("vue").ComputedRef<boolean>;
45
48
  hasPreviousPage: import("vue").ComputedRef<boolean>;
49
+ isPageLoadingLocked: import("vue").Ref<boolean, boolean>;
46
50
  items: import("vue").ComputedRef<import("../viewer").VibeViewerItem[]>;
47
51
  loading: import("vue").ComputedRef<boolean>;
48
52
  mode: import("vue").ComputedRef<import("./removalState").VibeFeedMode>;
@@ -1,4 +1,5 @@
1
1
  import type { VibeViewerItem } from '../viewer';
2
+ import type { VibeEmptyStateMode } from './surfaceSlots';
2
3
  export type { VibeHandle, VibeRemoveResult } from './removalState';
3
4
  export type { VibeFeedMode, VibeLoadPhase, VibeSurfaceMode } from './removalState';
4
5
  export interface VibeResolveParams {
@@ -19,6 +20,7 @@ export interface VibeInitialState {
19
20
  activeIndex?: number;
20
21
  }
21
22
  export interface VibeProps {
23
+ emptyStateMode?: VibeEmptyStateMode;
22
24
  fillDelayMs?: number;
23
25
  fillDelayStepMs?: number;
24
26
  initialCursor?: string | null;
@@ -50,7 +52,9 @@ export declare function useDataSource(props: Readonly<VibeProps>, emit: VibeEmit
50
52
  getRemovedIds: () => string[];
51
53
  hasNextPage: import("vue").ComputedRef<boolean>;
52
54
  hasPreviousPage: import("vue").ComputedRef<boolean>;
55
+ isPageLoadingLocked: import("vue").Ref<boolean, boolean>;
53
56
  items: import("vue").ComputedRef<VibeViewerItem[]>;
57
+ lockPageLoading: () => void;
54
58
  loading: import("vue").ComputedRef<boolean>;
55
59
  loadNext: () => Promise<void>;
56
60
  loadPrevious: () => Promise<void>;
@@ -76,4 +80,5 @@ export declare function useDataSource(props: Readonly<VibeProps>, emit: VibeEmit
76
80
  undo: () => {
77
81
  ids: string[];
78
82
  } | null;
83
+ unlockPageLoading: () => void;
79
84
  };
@@ -2,6 +2,7 @@ import { type Ref } from 'vue';
2
2
  export type VibeMasonryEdgeDirection = 'bottom' | 'top';
3
3
  export declare function useEdgeBoundary(options: {
4
4
  direction: VibeMasonryEdgeDirection;
5
+ interactionLocked?: Ref<boolean>;
5
6
  hasPage: Ref<boolean>;
6
7
  isAtBoundary: () => boolean;
7
8
  loading: Ref<boolean>;
@@ -0,0 +1,23 @@
1
+ import type { Ref } from 'vue';
2
+ import type { VibeViewerItem } from '../viewer';
3
+ export declare function useFullscreenSurfaceMedia(options: {
4
+ active: Ref<boolean | undefined>;
5
+ resolvedActiveIndex: Ref<number>;
6
+ viewer: {
7
+ getAssetErrorKind: (id: string) => unknown;
8
+ getAssetErrorLabel: (id: string) => string | null | undefined;
9
+ getImageSource: (item: VibeViewerItem) => string | undefined;
10
+ isImageReady: (id: string) => boolean;
11
+ isMediaReady: (id: string) => boolean;
12
+ };
13
+ }): {
14
+ getAssetErrorKind: (item: VibeViewerItem) => unknown;
15
+ getAssetErrorLabel: (item: VibeViewerItem) => string;
16
+ getFullscreenImageSource: (index: number, item: VibeViewerItem) => string | undefined;
17
+ getFullscreenMediaSource: (index: number, item: VibeViewerItem) => string | undefined;
18
+ getItemKey: (item: VibeViewerItem) => string;
19
+ getMediaActionLabel: (action: "Play" | "Pause", item: VibeViewerItem) => string;
20
+ isAssetErrored: (index: number, item: VibeViewerItem) => boolean;
21
+ isAssetLoading: (index: number, item: VibeViewerItem) => boolean;
22
+ shouldPreloadSlideAsset: (index: number) => boolean;
23
+ };
@@ -24,10 +24,44 @@ export declare function useVibeMasonryList(options: {
24
24
  transitionDelay: string | undefined;
25
25
  transform: string;
26
26
  };
27
+ getLeavingCardStyle: (item: VibeViewerItem) => {
28
+ opacity: string;
29
+ transform: string;
30
+ transition: string;
31
+ height?: undefined;
32
+ width?: undefined;
33
+ } | {
34
+ height: string;
35
+ opacity: string;
36
+ transform: string;
37
+ transition: string;
38
+ width: string;
39
+ };
27
40
  getScrollbarThumbStyle: () => {
28
41
  height: string;
29
42
  transform: string;
30
43
  };
44
+ leavingItems: import("vue").ComputedRef<{
45
+ height: number;
46
+ item: {
47
+ [x: string]: unknown;
48
+ id: string;
49
+ type: import("../viewer").VibeViewerType;
50
+ title?: string | undefined;
51
+ url: string;
52
+ preview?: {
53
+ url: string;
54
+ width?: number | undefined;
55
+ height?: number | undefined;
56
+ } | undefined;
57
+ width?: number | undefined;
58
+ height?: number | undefined;
59
+ };
60
+ position: {
61
+ x: number;
62
+ y: number;
63
+ };
64
+ }[]>;
31
65
  onScroll: () => void;
32
66
  onWheel: (event: WheelEvent) => void;
33
67
  paginationLabel: import("vue").ComputedRef<string>;
@@ -2,8 +2,14 @@ import { type ComputedRef, type Ref } from 'vue';
2
2
  import type { VibeViewerItem } from '../viewer';
3
3
  import type { LayoutPosition } from './masonryLayout';
4
4
  export type VibeMasonryEnterDirection = 'bottom' | 'top';
5
+ export interface VibeMasonryLeavingItem {
6
+ height: number;
7
+ item: VibeViewerItem;
8
+ position: LayoutPosition;
9
+ }
5
10
  export declare function getVibeMasonryEnterOrder(itemIds: string[], direction: VibeMasonryEnterDirection): string[];
6
11
  export declare function getVibeMasonryEnterDuration(itemCount: number): number;
12
+ export declare function getVibeMasonryLeaveDuration(): number;
7
13
  export declare function getVibeMasonryEnterStartY(options: {
8
14
  direction: VibeMasonryEnterDirection;
9
15
  itemHeight: number;
@@ -24,6 +30,41 @@ export declare function useMasonryMotion(options: {
24
30
  getCardTransform: (index: number) => string;
25
31
  getCardTransition: (itemId: string) => string | undefined;
26
32
  getCardTransitionDelay: (itemId: string) => string | undefined;
33
+ getLeavingCardStyle: (item: VibeViewerItem) => {
34
+ opacity: string;
35
+ transform: string;
36
+ transition: string;
37
+ height?: undefined;
38
+ width?: undefined;
39
+ } | {
40
+ height: string;
41
+ opacity: string;
42
+ transform: string;
43
+ transition: string;
44
+ width: string;
45
+ };
46
+ leavingItems: ComputedRef<{
47
+ height: number;
48
+ item: {
49
+ [x: string]: unknown;
50
+ id: string;
51
+ type: import("../viewer").VibeViewerType;
52
+ title?: string | undefined;
53
+ url: string;
54
+ preview?: {
55
+ url: string;
56
+ width?: number | undefined;
57
+ height?: number | undefined;
58
+ } | undefined;
59
+ width?: number | undefined;
60
+ height?: number | undefined;
61
+ };
62
+ position: {
63
+ x: number;
64
+ y: number;
65
+ };
66
+ }[]>;
27
67
  markEnter: (items: VibeViewerItem[], direction?: VibeMasonryEnterDirection) => void;
68
+ markLeave: (items: VibeMasonryLeavingItem[]) => void;
28
69
  playFlipMoveAnimation: (oldPositionsById: Map<string, LayoutPosition>, skipIds?: Set<string>, durationMs?: number) => void;
29
70
  };
@@ -0,0 +1,15 @@
1
+ import { type Ref } from 'vue';
2
+ import type { VibeEmptyStateMode, VibeEmptyStateSlotProps } from './surfaceSlots';
3
+ export declare const DEFAULT_VIBE_EMPTY_STATE_MESSAGE = "no items available";
4
+ export declare function useSurfaceEmptyState(options: {
5
+ emptyStateMode: Ref<VibeEmptyStateMode | undefined>;
6
+ itemCount: Ref<number>;
7
+ loading: Ref<boolean | undefined>;
8
+ renderSlot?: ((props: VibeEmptyStateSlotProps) => unknown) | undefined;
9
+ surface: VibeEmptyStateSlotProps['surface'];
10
+ }): {
11
+ emptyStateProps: import("vue").ComputedRef<VibeEmptyStateSlotProps | null>;
12
+ showBadgeEmptyState: import("vue").ComputedRef<boolean>;
13
+ showCustomEmptyState: import("vue").ComputedRef<boolean>;
14
+ showInlineEmptyState: import("vue").ComputedRef<boolean>;
15
+ };
@@ -7,6 +7,7 @@ export type { VibeResolveParams, VibeResolveResult, VibeEmit, VibeFeedMode, Vibe
7
7
  export type { VibeAssetErrorKind } from './loadError';
8
8
  export type { VibeStatus } from './removalState';
9
9
  export type { VibeAssetErrorEvent, VibeAssetErrorReporter, VibeAssetErrorSurface, VibeAssetLoadEvent, VibeAssetLoadReporter, VibeAssetLoadSurface } from './assetErrors';
10
+ export type { VibeEmptyStateMode, VibeEmptyStateSlotProps } from './surfaceSlots';
10
11
  export interface VibeViewerProps {
11
12
  activeIndex?: number;
12
13
  errorMessage?: string | null;