@lark-apaas/coding-template-nestjs-react-fullstack 0.1.60-alpha.20261105142153 → 0.1.60-beta.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.
- package/package.json +1 -1
- package/template/client/src/components/business-ui/README.md +0 -2
- package/template/package-lock.json +30 -546
- package/template/package.json +3 -14
- package/template/scripts/build.sh +39 -22
- package/template/scripts/prune-smart.js +20 -1
- package/template/client/src/components/business-ui/comments/README.md +0 -101
- package/template/client/src/components/business-ui/comments/comments.tsx +0 -670
- package/template/client/src/components/business-ui/comments/contracts.ts +0 -256
- package/template/client/src/components/business-ui/comments/index.ts +0 -20
- package/template/client/src/components/business-ui/comments/use-comments.ts +0 -492
- package/template/client/src/components/business-ui/record-comments/README.md +0 -141
- package/template/client/src/components/business-ui/record-comments/app-source.ts +0 -93
- package/template/client/src/components/business-ui/record-comments/assets/reaction-sprite.png +0 -0
- package/template/client/src/components/business-ui/record-comments/comment-panel.contract.ts +0 -240
- package/template/client/src/components/business-ui/record-comments/comment-panel.tsx +0 -231
- package/template/client/src/components/business-ui/record-comments/extensions.ts +0 -130
- package/template/client/src/components/business-ui/record-comments/index.ts +0 -9
- package/template/client/src/components/business-ui/record-comments/internal/composer.tsx +0 -531
- package/template/client/src/components/business-ui/record-comments/internal/content.tsx +0 -213
- package/template/client/src/components/business-ui/record-comments/internal/discussion.tsx +0 -523
- package/template/client/src/components/business-ui/record-comments/internal/editor.tsx +0 -681
- package/template/client/src/components/business-ui/record-comments/internal/icons.tsx +0 -148
- package/template/client/src/components/business-ui/record-comments/internal/images.tsx +0 -155
- package/template/client/src/components/business-ui/record-comments/internal/mentions.tsx +0 -163
- package/template/client/src/components/business-ui/record-comments/internal/model.ts +0 -581
- package/template/client/src/components/business-ui/record-comments/internal/mutations.ts +0 -198
- package/template/client/src/components/business-ui/record-comments/internal/reaction-catalog.ts +0 -196
- package/template/client/src/components/business-ui/record-comments/internal/reactions.tsx +0 -683
- package/template/client/src/components/business-ui/record-comments/internal/styles.css +0 -1109
- package/template/client/src/components/business-ui/record-comments/internal/suggestions.tsx +0 -456
- package/template/client/src/components/business-ui/record-comments/internal/view-types.ts +0 -91
- package/template/client/src/components/business-ui/record-comments/types.ts +0 -121
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import type { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
-
export type EntityRef = {
|
|
3
|
-
kind: 'user' | 'document';
|
|
4
|
-
namespace: string;
|
|
5
|
-
id: string;
|
|
6
|
-
};
|
|
7
|
-
export type UserRef = EntityRef & { kind: 'user' };
|
|
8
|
-
export interface CommentAuthor {
|
|
9
|
-
ref: UserRef;
|
|
10
|
-
name?: string;
|
|
11
|
-
avatarUrl?: string;
|
|
12
|
-
}
|
|
13
|
-
export type CommentNode =
|
|
14
|
-
| { type: 'text'; text: string }
|
|
15
|
-
| { type: 'break' }
|
|
16
|
-
| { type: 'link'; url: string; label?: string }
|
|
17
|
-
| { type: 'mention'; ref: EntityRef; label?: string; href?: string }
|
|
18
|
-
| { type: 'unresolved-mention' }
|
|
19
|
-
| { type: 'unsupported'; label: string };
|
|
20
|
-
export interface CommentContent {
|
|
21
|
-
version: 1;
|
|
22
|
-
nodes: CommentNode[];
|
|
23
|
-
}
|
|
24
|
-
export interface CommentAttachment {
|
|
25
|
-
id: string;
|
|
26
|
-
kind: 'image' | 'file';
|
|
27
|
-
name: string;
|
|
28
|
-
url?: string;
|
|
29
|
-
mimeType?: string;
|
|
30
|
-
width?: number;
|
|
31
|
-
height?: number;
|
|
32
|
-
}
|
|
33
|
-
export type CommentAttachmentInput =
|
|
34
|
-
| { kind: 'existing'; attachment: CommentAttachment }
|
|
35
|
-
| { kind: 'local'; localId: string; file: File };
|
|
36
|
-
export interface CommentReaction {
|
|
37
|
-
key: string;
|
|
38
|
-
count: number;
|
|
39
|
-
mine?: boolean;
|
|
40
|
-
previewUsers?: CommentAuthor[];
|
|
41
|
-
}
|
|
42
|
-
export interface CommentMessage {
|
|
43
|
-
/** Optional server-echoed idempotency correlation; never synthesize from matching text. */
|
|
44
|
-
clientOperationId?: string;
|
|
45
|
-
id: string;
|
|
46
|
-
author: CommentAuthor | null;
|
|
47
|
-
content: CommentContent;
|
|
48
|
-
createdAt: number;
|
|
49
|
-
updatedAt?: number;
|
|
50
|
-
edited?: boolean;
|
|
51
|
-
attachments?: CommentAttachment[];
|
|
52
|
-
reactions?: CommentReaction[];
|
|
53
|
-
permissions?: { edit: boolean; delete: boolean; react?: boolean };
|
|
54
|
-
}
|
|
55
|
-
export interface CommentPagination {
|
|
56
|
-
hasMore: boolean;
|
|
57
|
-
loading?: boolean;
|
|
58
|
-
error?: string;
|
|
59
|
-
onLoadMore(): Promise<void>;
|
|
60
|
-
}
|
|
61
|
-
export interface CommentThread {
|
|
62
|
-
id: string;
|
|
63
|
-
messages: CommentMessage[];
|
|
64
|
-
resolved?: boolean;
|
|
65
|
-
canReply?: boolean;
|
|
66
|
-
repliesPagination?: CommentPagination;
|
|
67
|
-
}
|
|
68
|
-
export interface CommentTarget {
|
|
69
|
-
threadId: string;
|
|
70
|
-
messageId: string;
|
|
71
|
-
}
|
|
72
|
-
export interface CommentDraft {
|
|
73
|
-
content: CommentContent;
|
|
74
|
-
attachments: CommentAttachmentInput[];
|
|
75
|
-
}
|
|
76
|
-
export interface CommentMutationContext {
|
|
77
|
-
operationId: string;
|
|
78
|
-
signal: AbortSignal;
|
|
79
|
-
}
|
|
80
|
-
export interface CommentWriteResult extends CommentTarget {
|
|
81
|
-
message?: CommentMessage;
|
|
82
|
-
}
|
|
83
|
-
export interface CommentActions {
|
|
84
|
-
create?(
|
|
85
|
-
input: CommentDraft & { threadId?: string; replyToMessageId?: string },
|
|
86
|
-
context: CommentMutationContext,
|
|
87
|
-
): Promise<CommentWriteResult>;
|
|
88
|
-
update?(
|
|
89
|
-
input: CommentDraft & CommentTarget,
|
|
90
|
-
context: CommentMutationContext,
|
|
91
|
-
): Promise<CommentWriteResult>;
|
|
92
|
-
remove?(
|
|
93
|
-
target: CommentTarget,
|
|
94
|
-
context: CommentMutationContext,
|
|
95
|
-
): Promise<{ threadId: string; threadDeleted?: boolean }>;
|
|
96
|
-
}
|
|
97
|
-
export interface CommentEntityOption {
|
|
98
|
-
ref: EntityRef;
|
|
99
|
-
label: string;
|
|
100
|
-
avatarUrl?: string;
|
|
101
|
-
description?: string;
|
|
102
|
-
href?: string;
|
|
103
|
-
readable?: boolean;
|
|
104
|
-
}
|
|
105
|
-
export type CommentEntityResult =
|
|
106
|
-
| (CommentEntityOption & { status: 'resolved' })
|
|
107
|
-
| { ref: EntityRef; status: 'forbidden' | 'not-found' | 'error' };
|
|
108
|
-
export interface CommentEntitySource {
|
|
109
|
-
search?(args: {
|
|
110
|
-
query: string;
|
|
111
|
-
cursor?: string;
|
|
112
|
-
signal: AbortSignal;
|
|
113
|
-
}): Promise<{ items: CommentEntityOption[]; nextCursor?: string }>;
|
|
114
|
-
recommend?(args: {
|
|
115
|
-
cursor?: string;
|
|
116
|
-
signal: AbortSignal;
|
|
117
|
-
}): Promise<{ items: CommentEntityOption[]; nextCursor?: string }>;
|
|
118
|
-
resolve(
|
|
119
|
-
refs: EntityRef[],
|
|
120
|
-
signal: AbortSignal,
|
|
121
|
-
): Promise<CommentEntityResult[]>;
|
|
122
|
-
parseUrl?(url: string): EntityRef | undefined;
|
|
123
|
-
}
|
|
124
|
-
export interface CommentEmoji {
|
|
125
|
-
key: string;
|
|
126
|
-
label: string;
|
|
127
|
-
text?: string;
|
|
128
|
-
url?: string;
|
|
129
|
-
group?: string;
|
|
130
|
-
}
|
|
131
|
-
export interface CommentReactionFeature {
|
|
132
|
-
catalog?: readonly CommentEmoji[];
|
|
133
|
-
allowedKeys?: readonly string[];
|
|
134
|
-
onChange?(
|
|
135
|
-
input: CommentTarget & { key: string; action: 'add' | 'remove' },
|
|
136
|
-
context: CommentMutationContext,
|
|
137
|
-
): Promise<{ reactions?: CommentReaction[] }>;
|
|
138
|
-
}
|
|
139
|
-
export type CommentExtension =
|
|
140
|
-
| { type: 'reactions'; options: CommentReactionFeature }
|
|
141
|
-
| { type: 'documents'; source: CommentEntitySource; canInsert: boolean }
|
|
142
|
-
| { type: 'images' };
|
|
143
|
-
export interface CommentsProviderProps {
|
|
144
|
-
scopeKey: string;
|
|
145
|
-
subjectKey: string;
|
|
146
|
-
threads: readonly CommentThread[];
|
|
147
|
-
currentUser?: CommentAuthor;
|
|
148
|
-
actions?: CommentActions;
|
|
149
|
-
loading?: boolean;
|
|
150
|
-
error?: string;
|
|
151
|
-
onRetry?: () => Promise<void>;
|
|
152
|
-
pagination?: CommentPagination;
|
|
153
|
-
actors?: CommentEntitySource;
|
|
154
|
-
input?: { userMentions?: (ref: UserRef) => boolean; links?: boolean };
|
|
155
|
-
extensions?: readonly CommentExtension[];
|
|
156
|
-
onActorClick?: (ref: UserRef, anchor: HTMLElement) => void;
|
|
157
|
-
getMessageLink?: (target: CommentTarget) => string | undefined;
|
|
158
|
-
validateDraft?: (
|
|
159
|
-
draft: CommentDraft,
|
|
160
|
-
target: {
|
|
161
|
-
mode: 'create' | 'update';
|
|
162
|
-
threadId?: string;
|
|
163
|
-
messageId?: string;
|
|
164
|
-
},
|
|
165
|
-
) => string | undefined;
|
|
166
|
-
children: ReactNode;
|
|
167
|
-
}
|
|
168
|
-
export type CommentListProps = Omit<
|
|
169
|
-
ComponentPropsWithoutRef<'div'>,
|
|
170
|
-
'children' | 'dangerouslySetInnerHTML'
|
|
171
|
-
>;
|
|
172
|
-
export type CommentComposerProps = CommentListProps & {
|
|
173
|
-
placeholder?: string;
|
|
174
|
-
disabled?: boolean;
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
/** Adapter reads return data and cursors, never React callbacks or loading state. */
|
|
178
|
-
export type CommentPageThread = Omit<CommentThread, 'repliesPagination'> & {
|
|
179
|
-
nextReplyCursor?: string;
|
|
180
|
-
};
|
|
181
|
-
export interface CommentPage {
|
|
182
|
-
threads: CommentPageThread[];
|
|
183
|
-
nextCursor?: string;
|
|
184
|
-
}
|
|
185
|
-
export interface CommentRepliesPage {
|
|
186
|
-
messages: CommentMessage[];
|
|
187
|
-
nextCursor?: string;
|
|
188
|
-
}
|
|
189
|
-
export interface CommentResource {
|
|
190
|
-
resourceKey: string;
|
|
191
|
-
}
|
|
192
|
-
export interface CommentListRequest extends CommentResource {
|
|
193
|
-
cursor?: string;
|
|
194
|
-
signal: AbortSignal;
|
|
195
|
-
}
|
|
196
|
-
export interface CommentAdapter {
|
|
197
|
-
/** Stable backend/tenant/auth scope. Current-user identity is additionally isolated by the hook. */
|
|
198
|
-
scopeKey: string;
|
|
199
|
-
list(input: CommentListRequest): Promise<CommentPage>;
|
|
200
|
-
listReplies?(
|
|
201
|
-
input: CommentListRequest & { threadId: string },
|
|
202
|
-
): Promise<CommentRepliesPage>;
|
|
203
|
-
create?(
|
|
204
|
-
input: CommentDraft &
|
|
205
|
-
CommentResource & { threadId?: string; replyToMessageId?: string },
|
|
206
|
-
context: CommentMutationContext,
|
|
207
|
-
): Promise<CommentWriteResult>;
|
|
208
|
-
update?(
|
|
209
|
-
input: CommentDraft & CommentTarget & CommentResource,
|
|
210
|
-
context: CommentMutationContext,
|
|
211
|
-
): Promise<CommentWriteResult>;
|
|
212
|
-
remove?(
|
|
213
|
-
input: CommentTarget & CommentResource,
|
|
214
|
-
context: CommentMutationContext,
|
|
215
|
-
): Promise<{ threadId: string; threadDeleted?: boolean }>;
|
|
216
|
-
people?: {
|
|
217
|
-
source: CommentEntitySource;
|
|
218
|
-
canMention?: (ref: UserRef) => boolean;
|
|
219
|
-
onClick?: CommentsProviderProps['onActorClick'];
|
|
220
|
-
};
|
|
221
|
-
documents?: { source: CommentEntitySource; canInsert?: boolean };
|
|
222
|
-
reactions?: Omit<CommentReactionFeature, 'onChange'> & {
|
|
223
|
-
onChange?(
|
|
224
|
-
input: CommentTarget &
|
|
225
|
-
CommentResource & { key: string; action: 'add' | 'remove' },
|
|
226
|
-
context: CommentMutationContext,
|
|
227
|
-
): Promise<{ reactions?: CommentReaction[] }>;
|
|
228
|
-
};
|
|
229
|
-
/** Enable only when create/update can persist the complete image-bearing message. */
|
|
230
|
-
images?: boolean;
|
|
231
|
-
links?: boolean;
|
|
232
|
-
getMessageLink?(target: CommentTarget & CommentResource): string | undefined;
|
|
233
|
-
validateDraft?: CommentsProviderProps['validateDraft'];
|
|
234
|
-
}
|
|
235
|
-
export interface UseCommentsOptions {
|
|
236
|
-
resourceKey: string;
|
|
237
|
-
currentUser?: CommentAuthor;
|
|
238
|
-
adapter: CommentAdapter;
|
|
239
|
-
}
|
|
240
|
-
export interface CommentsController {
|
|
241
|
-
readonly props: Omit<CommentsProviderProps, 'children'>;
|
|
242
|
-
readonly refreshing: boolean;
|
|
243
|
-
refresh(): Promise<void>;
|
|
244
|
-
loadMore(): Promise<void>;
|
|
245
|
-
}
|
|
246
|
-
type ManagedInput<Controlled> = { value: CommentsController } & {
|
|
247
|
-
[K in keyof Controlled]?: never;
|
|
248
|
-
};
|
|
249
|
-
export type CommentsProviderInput =
|
|
250
|
-
| (CommentsProviderProps & { value?: never })
|
|
251
|
-
| (ManagedInput<Omit<CommentsProviderProps, 'children'>> & {
|
|
252
|
-
children: ReactNode;
|
|
253
|
-
});
|
|
254
|
-
export type CommentPanelInput =
|
|
255
|
-
| (Omit<CommentsProviderProps, 'children'> & { value?: never })
|
|
256
|
-
| ManagedInput<Omit<CommentsProviderProps, 'children'>>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export { useComments } from './use-comments';
|
|
2
|
-
export { CommentsProvider, CommentPanel } from './comments';
|
|
3
|
-
export { CommentList, CommentComposer } from '../record-comments/comment-panel';
|
|
4
|
-
export type * from './contracts';
|
|
5
|
-
import type {
|
|
6
|
-
CommentEntitySource,
|
|
7
|
-
CommentExtension,
|
|
8
|
-
CommentReactionFeature,
|
|
9
|
-
} from './contracts';
|
|
10
|
-
export const commentReactions = (
|
|
11
|
-
options: CommentReactionFeature = {},
|
|
12
|
-
): CommentExtension => ({ type: 'reactions', options });
|
|
13
|
-
export const commentDocuments = ({
|
|
14
|
-
source,
|
|
15
|
-
canInsert = false,
|
|
16
|
-
}: {
|
|
17
|
-
source: CommentEntitySource;
|
|
18
|
-
canInsert?: boolean;
|
|
19
|
-
}): CommentExtension => ({ type: 'documents', source, canInsert });
|
|
20
|
-
export const commentImages = (): CommentExtension => ({ type: 'images' });
|