@cometchat/card-builder 2.0.1 → 2.0.2
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/assets/index-C8MCucSQ.js +20 -0
- package/dist/{card-builder.css → assets/index-D9-G0mBH.css} +0 -1
- package/dist/index.html +19 -0
- package/package.json +1 -1
- package/dist/App.d.ts +0 -1
- package/dist/bridge/api.d.ts +0 -79
- package/dist/card-builder.es.js +0 -24017
- package/dist/card-builder.umd.js +0 -20
- package/dist/components/Canvas.d.ts +0 -2
- package/dist/components/CanvasViewToggle.d.ts +0 -6
- package/dist/components/CredentialsModal.d.ts +0 -11
- package/dist/components/EditorLayout.d.ts +0 -2
- package/dist/components/ElementTree.d.ts +0 -2
- package/dist/components/LeftPanel.d.ts +0 -2
- package/dist/components/NotificationPreview.d.ts +0 -3
- package/dist/components/RightPanel.d.ts +0 -2
- package/dist/components/ShortcutsPanel.d.ts +0 -2
- package/dist/components/TemplateLibrary.d.ts +0 -2
- package/dist/components/TopBar.d.ts +0 -2
- package/dist/components/properties/ActionEditor.d.ts +0 -7
- package/dist/components/properties/CardStyleEditor.d.ts +0 -2
- package/dist/components/properties/ElementPropertyEditor.d.ts +0 -8
- package/dist/components/properties/IconPicker.d.ts +0 -7
- package/dist/components/properties/NotificationEditor.d.ts +0 -2
- package/dist/components/properties/VariableEditor.d.ts +0 -2
- package/dist/components/properties/VariableInput.d.ts +0 -10
- package/dist/components/renderers/ElementRenderer.d.ts +0 -20
- package/dist/components/ui/Button.d.ts +0 -8
- package/dist/components/ui/ColorPicker.d.ts +0 -30
- package/dist/components/ui/EmptyState.d.ts +0 -7
- package/dist/components/ui/MaterialIcon.d.ts +0 -9
- package/dist/components/ui/Modal.d.ts +0 -11
- package/dist/config/app-credentials.d.ts +0 -44
- package/dist/config/builder-config.d.ts +0 -56
- package/dist/config/component-templates.d.ts +0 -11
- package/dist/config/element-defaults.d.ts +0 -8
- package/dist/config/icon-library.d.ts +0 -11
- package/dist/config/theme.d.ts +0 -11
- package/dist/config/uikit-theme.d.ts +0 -73
- package/dist/hooks/useKeyboardShortcuts.d.ts +0 -1
- package/dist/lib.d.ts +0 -81
- package/dist/store/builder-store.d.ts +0 -128
- package/dist/types/schema.d.ts +0 -338
- package/dist/utils/element-errors.d.ts +0 -9
- package/dist/utils/id.d.ts +0 -4
- package/dist/utils/portal-root.d.ts +0 -2
- package/dist/utils/validate.d.ts +0 -6
package/dist/types/schema.d.ts
DELETED
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
export type Padding = number | {
|
|
2
|
-
top?: number;
|
|
3
|
-
right?: number;
|
|
4
|
-
bottom?: number;
|
|
5
|
-
left?: number;
|
|
6
|
-
};
|
|
7
|
-
export type SizeOrPercentage = number | string;
|
|
8
|
-
export type ColorValue = {
|
|
9
|
-
light: string;
|
|
10
|
-
dark: string;
|
|
11
|
-
} | 'transparent';
|
|
12
|
-
/** Resolve a ColorValue to a hex string for the given mode. Returns 'transparent' for "transparent". */
|
|
13
|
-
export declare function resolveColor(cv: ColorValue | undefined, mode?: 'light' | 'dark'): string | undefined;
|
|
14
|
-
/** Create a ColorValue from a single hex (same for both modes). */
|
|
15
|
-
export declare function colorVal(hex: string): ColorValue;
|
|
16
|
-
/** Create a ColorValue with distinct light/dark values. */
|
|
17
|
-
export declare function colorValLD(light?: string, dark?: string): ColorValue;
|
|
18
|
-
export interface OpenUrlAction {
|
|
19
|
-
type: 'openUrl';
|
|
20
|
-
url: string;
|
|
21
|
-
openIn?: 'browser' | 'webview';
|
|
22
|
-
}
|
|
23
|
-
export interface ChatWithUserAction {
|
|
24
|
-
type: 'chatWithUser';
|
|
25
|
-
uid: string;
|
|
26
|
-
}
|
|
27
|
-
export interface ChatWithGroupAction {
|
|
28
|
-
type: 'chatWithGroup';
|
|
29
|
-
guid: string;
|
|
30
|
-
}
|
|
31
|
-
export interface SendMessageAction {
|
|
32
|
-
type: 'sendMessage';
|
|
33
|
-
text: string;
|
|
34
|
-
receiverUid?: string;
|
|
35
|
-
receiverGuid?: string;
|
|
36
|
-
}
|
|
37
|
-
export interface CopyToClipboardAction {
|
|
38
|
-
type: 'copyToClipboard';
|
|
39
|
-
value: string;
|
|
40
|
-
}
|
|
41
|
-
export interface DownloadFileAction {
|
|
42
|
-
type: 'downloadFile';
|
|
43
|
-
url: string;
|
|
44
|
-
filename?: string;
|
|
45
|
-
}
|
|
46
|
-
export interface InitiateCallAction {
|
|
47
|
-
type: 'initiateCall';
|
|
48
|
-
uid?: string;
|
|
49
|
-
guid?: string;
|
|
50
|
-
callType: 'audio' | 'video';
|
|
51
|
-
}
|
|
52
|
-
export interface ApiCallAction {
|
|
53
|
-
type: 'apiCall';
|
|
54
|
-
url: string;
|
|
55
|
-
method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
56
|
-
headers?: Record<string, string>;
|
|
57
|
-
body?: Record<string, unknown>;
|
|
58
|
-
}
|
|
59
|
-
export interface CustomCallbackAction {
|
|
60
|
-
type: 'customCallback';
|
|
61
|
-
}
|
|
62
|
-
export type CardAction = OpenUrlAction | ChatWithUserAction | ChatWithGroupAction | SendMessageAction | CopyToClipboardAction | DownloadFileAction | InitiateCallAction | ApiCallAction | CustomCallbackAction;
|
|
63
|
-
export declare const ACTION_TYPES: readonly ["openUrl", "chatWithUser", "chatWithGroup", "sendMessage", "copyToClipboard", "downloadFile", "initiateCall", "apiCall", "customCallback"];
|
|
64
|
-
export type ActionType = typeof ACTION_TYPES[number];
|
|
65
|
-
/** Reference to an icon. Use 'name' for built-in icons, 'url' for custom icon URLs. If both present, url takes precedence. */
|
|
66
|
-
export interface IconRef {
|
|
67
|
-
name?: string;
|
|
68
|
-
url?: string;
|
|
69
|
-
}
|
|
70
|
-
export interface TextElement {
|
|
71
|
-
id: string;
|
|
72
|
-
type: 'text';
|
|
73
|
-
content: string;
|
|
74
|
-
variant?: 'title' | 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'body' | 'caption1' | 'caption2';
|
|
75
|
-
color?: ColorValue;
|
|
76
|
-
align?: 'left' | 'center' | 'right' | 'justify';
|
|
77
|
-
fontWeight?: 'regular' | 'medium' | 'bold';
|
|
78
|
-
maxLines?: number;
|
|
79
|
-
padding?: Padding;
|
|
80
|
-
}
|
|
81
|
-
export interface ImageElement {
|
|
82
|
-
id: string;
|
|
83
|
-
type: 'image';
|
|
84
|
-
url: string;
|
|
85
|
-
altText?: string;
|
|
86
|
-
fit?: 'cover' | 'contain' | 'fill';
|
|
87
|
-
width?: SizeOrPercentage;
|
|
88
|
-
height?: SizeOrPercentage;
|
|
89
|
-
borderRadius?: number;
|
|
90
|
-
padding?: Padding;
|
|
91
|
-
}
|
|
92
|
-
export interface IconElement {
|
|
93
|
-
id: string;
|
|
94
|
-
type: 'icon';
|
|
95
|
-
name?: string;
|
|
96
|
-
url?: string;
|
|
97
|
-
size?: number;
|
|
98
|
-
color?: ColorValue;
|
|
99
|
-
backgroundColor?: ColorValue;
|
|
100
|
-
borderRadius?: number;
|
|
101
|
-
padding?: number;
|
|
102
|
-
}
|
|
103
|
-
export interface AvatarElement {
|
|
104
|
-
id: string;
|
|
105
|
-
type: 'avatar';
|
|
106
|
-
imageUrl?: string;
|
|
107
|
-
fallbackInitials?: string;
|
|
108
|
-
size?: number;
|
|
109
|
-
borderRadius?: number;
|
|
110
|
-
backgroundColor?: ColorValue;
|
|
111
|
-
fontSize?: number;
|
|
112
|
-
fontWeight?: 'regular' | 'medium' | 'bold';
|
|
113
|
-
}
|
|
114
|
-
export interface BadgeElement {
|
|
115
|
-
id: string;
|
|
116
|
-
type: 'badge';
|
|
117
|
-
text: string;
|
|
118
|
-
color?: ColorValue;
|
|
119
|
-
size?: number;
|
|
120
|
-
backgroundColor?: ColorValue;
|
|
121
|
-
borderColor?: ColorValue;
|
|
122
|
-
borderWidth?: number;
|
|
123
|
-
borderRadius?: number;
|
|
124
|
-
padding?: Padding;
|
|
125
|
-
fontSize?: number;
|
|
126
|
-
}
|
|
127
|
-
export interface DividerElement {
|
|
128
|
-
id: string;
|
|
129
|
-
type: 'divider';
|
|
130
|
-
color?: ColorValue;
|
|
131
|
-
thickness?: number;
|
|
132
|
-
margin?: number;
|
|
133
|
-
}
|
|
134
|
-
export interface SpacerElement {
|
|
135
|
-
id: string;
|
|
136
|
-
type: 'spacer';
|
|
137
|
-
height: number;
|
|
138
|
-
}
|
|
139
|
-
export interface ChipElement {
|
|
140
|
-
id: string;
|
|
141
|
-
type: 'chip';
|
|
142
|
-
text: string;
|
|
143
|
-
color?: ColorValue;
|
|
144
|
-
icon?: IconRef;
|
|
145
|
-
backgroundColor?: ColorValue;
|
|
146
|
-
borderColor?: ColorValue;
|
|
147
|
-
borderWidth?: number;
|
|
148
|
-
borderRadius?: number;
|
|
149
|
-
padding?: Padding;
|
|
150
|
-
fontSize?: number;
|
|
151
|
-
}
|
|
152
|
-
export interface ProgressBarElement {
|
|
153
|
-
id: string;
|
|
154
|
-
type: 'progressBar';
|
|
155
|
-
value: number;
|
|
156
|
-
color?: ColorValue;
|
|
157
|
-
trackColor?: ColorValue;
|
|
158
|
-
height?: number;
|
|
159
|
-
label?: string;
|
|
160
|
-
borderRadius?: number;
|
|
161
|
-
labelFontSize?: number;
|
|
162
|
-
labelColor?: ColorValue;
|
|
163
|
-
}
|
|
164
|
-
export interface CodeBlockElement {
|
|
165
|
-
id: string;
|
|
166
|
-
type: 'codeBlock';
|
|
167
|
-
content: string;
|
|
168
|
-
language?: string;
|
|
169
|
-
backgroundColor?: ColorValue;
|
|
170
|
-
textColor?: ColorValue;
|
|
171
|
-
padding?: Padding;
|
|
172
|
-
borderRadius?: number;
|
|
173
|
-
fontSize?: number;
|
|
174
|
-
languageLabelFontSize?: number;
|
|
175
|
-
languageLabelColor?: ColorValue;
|
|
176
|
-
}
|
|
177
|
-
export interface MarkdownElement {
|
|
178
|
-
id: string;
|
|
179
|
-
type: 'markdown';
|
|
180
|
-
content: string;
|
|
181
|
-
baseFontSize?: number;
|
|
182
|
-
linkColor?: ColorValue;
|
|
183
|
-
color?: ColorValue;
|
|
184
|
-
lineHeight?: number;
|
|
185
|
-
}
|
|
186
|
-
export interface RowElement {
|
|
187
|
-
id: string;
|
|
188
|
-
type: 'row';
|
|
189
|
-
items: CardElement[];
|
|
190
|
-
gap?: number;
|
|
191
|
-
align?: 'start' | 'center' | 'end' | 'spaceBetween' | 'spaceAround';
|
|
192
|
-
crossAlign?: 'start' | 'center' | 'end';
|
|
193
|
-
wrap?: boolean;
|
|
194
|
-
scrollable?: boolean;
|
|
195
|
-
peek?: number;
|
|
196
|
-
snap?: 'item' | 'free';
|
|
197
|
-
padding?: Padding;
|
|
198
|
-
backgroundColor?: ColorValue;
|
|
199
|
-
borderRadius?: number;
|
|
200
|
-
borderColor?: ColorValue;
|
|
201
|
-
borderWidth?: number;
|
|
202
|
-
}
|
|
203
|
-
export interface ColumnElement {
|
|
204
|
-
id: string;
|
|
205
|
-
type: 'column';
|
|
206
|
-
items: CardElement[];
|
|
207
|
-
gap?: number;
|
|
208
|
-
align?: 'start' | 'center' | 'end' | 'stretch';
|
|
209
|
-
crossAlign?: 'start' | 'center' | 'end';
|
|
210
|
-
padding?: Padding;
|
|
211
|
-
backgroundColor?: ColorValue;
|
|
212
|
-
borderRadius?: number;
|
|
213
|
-
borderColor?: ColorValue;
|
|
214
|
-
borderWidth?: number;
|
|
215
|
-
}
|
|
216
|
-
export interface GridElement {
|
|
217
|
-
id: string;
|
|
218
|
-
type: 'grid';
|
|
219
|
-
items: CardElement[];
|
|
220
|
-
columns?: 2 | 3 | 4;
|
|
221
|
-
gap?: number;
|
|
222
|
-
padding?: Padding;
|
|
223
|
-
backgroundColor?: ColorValue;
|
|
224
|
-
borderRadius?: number;
|
|
225
|
-
borderColor?: ColorValue;
|
|
226
|
-
borderWidth?: number;
|
|
227
|
-
}
|
|
228
|
-
export interface AccordionElement {
|
|
229
|
-
id: string;
|
|
230
|
-
type: 'accordion';
|
|
231
|
-
header: string;
|
|
232
|
-
headerIcon?: IconRef;
|
|
233
|
-
body: CardElement[];
|
|
234
|
-
expandedByDefault?: boolean;
|
|
235
|
-
border?: boolean;
|
|
236
|
-
padding?: Padding;
|
|
237
|
-
fontSize?: number;
|
|
238
|
-
fontWeight?: 'regular' | 'medium' | 'bold';
|
|
239
|
-
borderRadius?: number;
|
|
240
|
-
}
|
|
241
|
-
export interface TabsElement {
|
|
242
|
-
id: string;
|
|
243
|
-
type: 'tabs';
|
|
244
|
-
tabs: {
|
|
245
|
-
label: string;
|
|
246
|
-
content: CardElement[];
|
|
247
|
-
}[];
|
|
248
|
-
defaultActiveTab?: number;
|
|
249
|
-
tabAlign?: 'start' | 'center' | 'stretch';
|
|
250
|
-
tabPadding?: Padding;
|
|
251
|
-
contentPadding?: Padding;
|
|
252
|
-
fontSize?: number;
|
|
253
|
-
}
|
|
254
|
-
export interface ButtonElement {
|
|
255
|
-
id: string;
|
|
256
|
-
type: 'button';
|
|
257
|
-
label: string;
|
|
258
|
-
action: CardAction;
|
|
259
|
-
backgroundColor?: ColorValue;
|
|
260
|
-
textColor?: ColorValue;
|
|
261
|
-
borderColor?: ColorValue;
|
|
262
|
-
borderWidth?: number;
|
|
263
|
-
borderRadius?: number;
|
|
264
|
-
icon?: IconRef;
|
|
265
|
-
iconPosition?: 'left' | 'right';
|
|
266
|
-
size?: number;
|
|
267
|
-
fullWidth?: boolean;
|
|
268
|
-
padding?: Padding;
|
|
269
|
-
fontSize?: number;
|
|
270
|
-
}
|
|
271
|
-
export interface IconButtonElement {
|
|
272
|
-
id: string;
|
|
273
|
-
type: 'iconButton';
|
|
274
|
-
icon: IconRef;
|
|
275
|
-
action: CardAction;
|
|
276
|
-
size?: number;
|
|
277
|
-
color?: ColorValue;
|
|
278
|
-
backgroundColor?: ColorValue;
|
|
279
|
-
borderRadius?: number;
|
|
280
|
-
}
|
|
281
|
-
export interface LinkElement {
|
|
282
|
-
id: string;
|
|
283
|
-
type: 'link';
|
|
284
|
-
text: string;
|
|
285
|
-
action: CardAction;
|
|
286
|
-
color?: ColorValue;
|
|
287
|
-
underline?: boolean;
|
|
288
|
-
fontSize?: number;
|
|
289
|
-
}
|
|
290
|
-
export interface TableElement {
|
|
291
|
-
id: string;
|
|
292
|
-
type: 'table';
|
|
293
|
-
columns: string[];
|
|
294
|
-
rows: string[][];
|
|
295
|
-
headerBackgroundColor?: ColorValue;
|
|
296
|
-
border?: boolean;
|
|
297
|
-
stripedRows?: boolean;
|
|
298
|
-
cellPadding?: number;
|
|
299
|
-
fontSize?: number;
|
|
300
|
-
stripedRowColor?: ColorValue;
|
|
301
|
-
borderColor?: ColorValue;
|
|
302
|
-
}
|
|
303
|
-
export type CardElement = TextElement | ImageElement | IconElement | AvatarElement | BadgeElement | DividerElement | SpacerElement | ChipElement | ProgressBarElement | CodeBlockElement | MarkdownElement | RowElement | ColumnElement | GridElement | AccordionElement | TabsElement | ButtonElement | IconButtonElement | LinkElement | TableElement;
|
|
304
|
-
export type ElementType = CardElement['type'];
|
|
305
|
-
export interface CardStyle {
|
|
306
|
-
background: ColorValue;
|
|
307
|
-
borderRadius?: number;
|
|
308
|
-
borderColor?: ColorValue;
|
|
309
|
-
borderWidth?: number;
|
|
310
|
-
padding?: Padding;
|
|
311
|
-
}
|
|
312
|
-
export interface CardMessage {
|
|
313
|
-
version: '1.0';
|
|
314
|
-
body: CardElement[];
|
|
315
|
-
style: CardStyle;
|
|
316
|
-
fallbackText: string;
|
|
317
|
-
}
|
|
318
|
-
export interface MessageData {
|
|
319
|
-
category: string;
|
|
320
|
-
type: string;
|
|
321
|
-
data: {
|
|
322
|
-
text: string;
|
|
323
|
-
card: CardMessage;
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
export interface Template {
|
|
327
|
-
id: string;
|
|
328
|
-
name: string;
|
|
329
|
-
description?: string;
|
|
330
|
-
schemaVersion?: string;
|
|
331
|
-
messageData: MessageData;
|
|
332
|
-
thumbnail?: string;
|
|
333
|
-
createdBy?: string;
|
|
334
|
-
createdAt: number;
|
|
335
|
-
updatedAt: number;
|
|
336
|
-
}
|
|
337
|
-
export declare function isContainerElement(el: CardElement): el is RowElement | ColumnElement | GridElement | AccordionElement;
|
|
338
|
-
export declare function getContainerChildren(el: CardElement): CardElement[] | null;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { CardElement } from '../types/schema';
|
|
2
|
-
export interface FieldError {
|
|
3
|
-
field: string;
|
|
4
|
-
message: string;
|
|
5
|
-
}
|
|
6
|
-
/** Returns field-level validation errors for a single element. */
|
|
7
|
-
export declare function getElementErrors(el: CardElement): FieldError[];
|
|
8
|
-
/** Quick check: does this element have any errors? Useful for tree indicators. */
|
|
9
|
-
export declare function hasElementErrors(el: CardElement): boolean;
|
package/dist/utils/id.d.ts
DELETED