memi-board 0.10.1 → 0.11.1
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/dist/composables/useMemiBoardLikes.d.ts +12 -0
- package/dist/composables/useMemiBoardPosts.d.ts +29 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +449 -325
- package/dist/index.js.map +1 -1
- package/dist/runtime/components/Detail.vue +25 -27
- package/dist/runtime/components/LikeButton.vue +35 -0
- package/dist/runtime/components/List.vue +87 -56
- package/dist/runtime/components/ListDefault.vue +1 -0
- package/dist/types.d.ts +2 -0
- package/docs/firestore.rules.example +23 -1
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 게시글 좋아요 상태 구독 + 토글.
|
|
3
|
+
* `{prefix}Posts/{postId}/likes/{uid}` 문서 존재 여부가 "좋아요함"의 기준이고,
|
|
4
|
+
* `likeCount`는 그 문서 수를 반영하는 클라이언트 편의 카운터일 뿐이다(commentCount와 동일한 성격).
|
|
5
|
+
* 토글은 배치가 아니라 트랜잭션으로 처리한다 — "있으면 취소, 없으면 추가"라는 read-then-branch라
|
|
6
|
+
* 다중 탭 경합 시에도 likeCount가 실제 likes 문서 수와 어긋나지 않게 하기 위함이다.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useMemiBoardLikes(postId: string): {
|
|
9
|
+
isLiked: import('vue').Ref<boolean, boolean>;
|
|
10
|
+
likePending: import('vue').Ref<boolean, boolean>;
|
|
11
|
+
toggleLike: () => Promise<boolean>;
|
|
12
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
1
2
|
import { DocumentData, QueryDocumentSnapshot } from 'firebase/firestore';
|
|
2
3
|
import { Attachment, PostDetail, PostModel } from '../types';
|
|
3
4
|
export interface CreatePostInput {
|
|
@@ -43,3 +44,31 @@ export declare function useMemiBoardPosts(): {
|
|
|
43
44
|
updatePost: (id: string, input: UpdatePostInput) => Promise<void>;
|
|
44
45
|
deletePost: (id: string) => Promise<void>;
|
|
45
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* 최신 {pageSize}건은 onSnapshot으로 실시간 구독해 목록에 보이는 동안 좋아요·댓글 수가
|
|
49
|
+
* 바로 갱신되게 하고, 그 이전 글은 "더보기" 클릭 시 1회성 getDocs로 이어서 불러온다.
|
|
50
|
+
* 두 구간이 살짝 겹쳐도 id 기준으로 합쳐 중복 없이 렌더한다.
|
|
51
|
+
*
|
|
52
|
+
* 알려진 한계: "더보기"로 이전 글을 불러온 뒤 새 글이 pageSize개 이상 연달아 올라오면
|
|
53
|
+
* 실시간 구간과 페이지 구간 사이에 짧은 공백이 생길 수 있다 — 새로고침하면 바로 채워지고,
|
|
54
|
+
* 이 정도 트래픽 폭이면 실사용에서 발생 가능성이 낮아 별도 보정 로직은 두지 않았다.
|
|
55
|
+
*/
|
|
56
|
+
export declare function useMemiBoardPostList(category?: string | Ref<string | undefined>, options?: {
|
|
57
|
+
pageSize?: number;
|
|
58
|
+
}): {
|
|
59
|
+
posts: import('vue').ComputedRef<PostModel[]>;
|
|
60
|
+
postsPending: Ref<boolean, boolean>;
|
|
61
|
+
hasMore: Ref<boolean, boolean>;
|
|
62
|
+
loadingMore: Ref<boolean, boolean>;
|
|
63
|
+
loadError: Ref<string, string>;
|
|
64
|
+
loadMore: () => Promise<void>;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* 게시글 상세를 VueFire useDocument로 실시간 구독한다 (메타 + 본문).
|
|
68
|
+
* 좋아요·댓글 수 등 다른 사람의 변경이 화면에 바로 반영된다 — 좋아요 토글도
|
|
69
|
+
* 별도 로컬 낙관적 갱신 없이 이 구독이 그대로 반영해 준다.
|
|
70
|
+
*/
|
|
71
|
+
export declare function useMemiBoardPost(postId: string | Ref<string>): {
|
|
72
|
+
post: import('vue').ComputedRef<PostDetail | null>;
|
|
73
|
+
pending: import('vue').ComputedRef<boolean>;
|
|
74
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
export { configureMemiBoard, useMemiBoardConfig } from './config';
|
|
3
3
|
export type { MemiBoardConfig, MemiBoardAuthOptions, MemiBoardModerationOptions } from './config';
|
|
4
4
|
export { useMemiBoardAuth } from './composables/useMemiBoardAuth';
|
|
5
|
-
export { useMemiBoardPosts } from './composables/useMemiBoardPosts';
|
|
5
|
+
export { useMemiBoardPosts, useMemiBoardPostList, useMemiBoardPost } from './composables/useMemiBoardPosts';
|
|
6
6
|
export type { CreatePostInput, UpdatePostInput } from './composables/useMemiBoardPosts';
|
|
7
7
|
export { COMMENT_BODY_MAX_LENGTH, useMemiBoardComments, useMemiBoardReplies } from './composables/useMemiBoardComments';
|
|
8
8
|
export type { AddCommentInput, AddReplyInput } from './composables/useMemiBoardComments';
|
|
9
|
+
export { useMemiBoardLikes } from './composables/useMemiBoardLikes';
|
|
9
10
|
export { useMemiBoardModeration } from './composables/useMemiBoardModeration';
|
|
10
11
|
export { useMemiBoardStorage } from './composables/useMemiBoardStorage';
|
|
11
12
|
export { useMemiBoardSettings, DEFAULT_CATEGORIES } from './composables/useMemiBoardSettings';
|