@webinex/chatify 1.0.0-alpha07 → 1.0.0-rc1

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.
Files changed (78) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/core/action.d.ts +4 -1
  4. package/dist/cjs/types/core/models.d.ts +2 -2
  5. package/dist/cjs/types/ui/Chatify.d.ts +6 -4
  6. package/dist/cjs/types/ui/Icon.d.ts +7 -0
  7. package/dist/cjs/types/ui/Message.d.ts +1 -1
  8. package/dist/cjs/types/ui/SendingMessage.d.ts +1 -1
  9. package/dist/cjs/types/ui/index.d.ts +1 -0
  10. package/dist/cjs/types/ui/localizer.d.ts +4 -0
  11. package/dist/css/chatify.css +56 -60
  12. package/dist/esm/index.js +1 -1
  13. package/dist/esm/index.js.map +1 -1
  14. package/dist/esm/types/core/action.d.ts +4 -1
  15. package/dist/esm/types/core/models.d.ts +2 -2
  16. package/dist/esm/types/ui/Chatify.d.ts +6 -4
  17. package/dist/esm/types/ui/Icon.d.ts +7 -0
  18. package/dist/esm/types/ui/Message.d.ts +1 -1
  19. package/dist/esm/types/ui/SendingMessage.d.ts +1 -1
  20. package/dist/esm/types/ui/index.d.ts +1 -0
  21. package/dist/esm/types/ui/localizer.d.ts +4 -0
  22. package/dist/index.d.ts +23 -8
  23. package/package.json +90 -90
  24. package/src/ChatifyContext.tsx +41 -41
  25. package/src/core/action.tsx +319 -282
  26. package/src/core/client.ts +137 -137
  27. package/src/core/index.ts +14 -14
  28. package/src/core/models.tsx +75 -75
  29. package/src/core/reducer.tsx +86 -86
  30. package/src/core/state.ts +38 -38
  31. package/src/core/useAccounts.tsx +11 -11
  32. package/src/core/useAddChat.tsx +12 -12
  33. package/src/core/useAddMember.tsx +12 -12
  34. package/src/core/useAddMessage.tsx +40 -40
  35. package/src/core/useChat.tsx +12 -12
  36. package/src/core/useChatList.tsx +10 -10
  37. package/src/core/useLoadMore.tsx +42 -42
  38. package/src/core/useMessages.tsx +23 -23
  39. package/src/core/useMutation.tsx +48 -48
  40. package/src/core/useQuery.tsx +45 -45
  41. package/src/core/useReadMonitor.tsx +31 -31
  42. package/src/core/useRemoveMember.tsx +12 -12
  43. package/src/core/useSignalRMonitor.tsx +52 -49
  44. package/src/index.ts +3 -3
  45. package/src/ui/AddChat.tsx +55 -55
  46. package/src/ui/AddChatButton.tsx +19 -19
  47. package/src/ui/Aside.tsx +41 -41
  48. package/src/ui/Avatar.tsx +18 -18
  49. package/src/ui/Chat.tsx +26 -26
  50. package/src/ui/ChatBody.tsx +43 -43
  51. package/src/ui/ChatHeader.tsx +33 -33
  52. package/src/ui/ChatHeaderMembers.tsx +30 -30
  53. package/src/ui/ChatHeaderSettingsButton.tsx +26 -26
  54. package/src/ui/ChatListItem.tsx +101 -101
  55. package/src/ui/ChatName.tsx +15 -15
  56. package/src/ui/ChatSettings.tsx +59 -59
  57. package/src/ui/Chatify.tsx +104 -102
  58. package/src/ui/Footer.tsx +7 -7
  59. package/src/ui/Header.tsx +14 -14
  60. package/src/ui/Icon.tsx +21 -0
  61. package/src/ui/InputForm.tsx +51 -48
  62. package/src/ui/LoadMore.tsx +40 -40
  63. package/src/ui/Main.tsx +16 -16
  64. package/src/ui/Message.tsx +118 -118
  65. package/src/ui/MessageSkeleton.tsx +19 -19
  66. package/src/ui/SendingMessage.tsx +50 -50
  67. package/src/ui/SystemMessage.tsx +30 -26
  68. package/src/ui/index.ts +11 -10
  69. package/src/ui/localizer.tsx +68 -58
  70. package/src/ui/styles/aside.scss +94 -94
  71. package/src/ui/styles/index.scss +248 -252
  72. package/src/ui/styles/keyframes.scss +14 -14
  73. package/src/ui/styles/mixins.scss +20 -20
  74. package/src/ui/styles/variables.scss +10 -10
  75. package/src/util/customize.tsx +45 -45
  76. package/src/util/index.ts +3 -3
  77. package/src/util/uniqBy.tsx +17 -17
  78. package/src/util/uniqId.tsx +3 -3
@@ -1,252 +1,248 @@
1
- @import './variables.scss';
2
- @import './mixins.scss';
3
- @import './keyframes.scss';
4
- @import './aside.scss';
5
-
6
- .wxchtf-chatify {
7
- border: $border;
8
- display: flex;
9
- flex-flow: column nowrap;
10
- background: $background;
11
- border-radius: $radius;
12
-
13
- .wxchtf-header {
14
- min-height: 2rem;
15
- border-bottom: $border;
16
- }
17
-
18
- .wxchtf-body {
19
- flex: 1 0;
20
- display: flex;
21
- flex-flow: row nowrap;
22
- }
23
-
24
- .wxchtf-footer {
25
- min-height: 2rem;
26
- border-top: $border;
27
- }
28
- }
29
-
30
- .wxchtf-main {
31
- flex: auto;
32
- display: flex;
33
- flex-flow: column nowrap;
34
-
35
- .wxchtf-chat {
36
- flex: auto;
37
- display: flex;
38
- flex-flow: column nowrap;
39
-
40
- .wxchtf-chat-header {
41
- border-bottom: $border;
42
- padding: 0.5rem 1rem;
43
-
44
- .wxchtf-chat-name {
45
- font-weight: 600;
46
- flex: none;
47
- }
48
- }
49
-
50
- .wxchtf-chat-body {
51
- flex: 1 1 auto;
52
- height: 100px;
53
- overflow-y: auto;
54
- background: $chatBodyBackground;
55
- padding: 2rem 1rem;
56
- display: flex;
57
- flex-flow: column-reverse nowrap;
58
-
59
- @include scrollbar();
60
-
61
- @media only screen and (min-width: 1120px) {
62
- padding-right: 30%;
63
- }
64
-
65
- .wxchtf-message,
66
- .wxchtf-sending-message {
67
- display: flex;
68
- flex-flow: row nowrap;
69
- width: 100%;
70
- align-items: flex-end;
71
-
72
- &.--sending {
73
- animation: fadeInFromNone 0.5s ease-out;
74
- }
75
-
76
- &.--my {
77
- direction: rtl;
78
- justify-content: flex-start;
79
-
80
- .wxchtf-message-author {
81
- margin-right: 0;
82
- margin-left: 15px;
83
- }
84
-
85
- .wxchtf-message-body,
86
- .wxchtf-sending-message-body {
87
- direction: ltr;
88
- border-bottom-left-radius: 10px;
89
- border-bottom-right-radius: 0;
90
- background-color: $myMessageBackground;
91
- }
92
- }
93
-
94
- .wxchtf-message-author {
95
- margin-right: 15px;
96
-
97
- .ant-avatar {
98
- @include avatarSize($avatarSize);
99
- box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
100
- }
101
- }
102
-
103
- .wxchtf-message-body,
104
- .wxchtf-sending-message-body {
105
- min-width: 300px;
106
- max-width: 70%;
107
- border-radius: $messageBorderRadius;
108
- padding: 0.75rem 1rem;
109
- background: white;
110
- border-bottom-left-radius: 0;
111
- background-color: $messageBackground;
112
- box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
113
- display: block;
114
- white-space: pre-wrap;
115
- overflow-wrap: break-word;
116
-
117
- .wxchtf-message-info-box,
118
- .wxchtf-sending-message-info-box {
119
- text-align: right;
120
-
121
- .wxchtf-message-sent-at,
122
- .wxchtf-message-read-box,
123
- .wxchtf-sending-message-sending-box {
124
- display: inline-block;
125
- font-style: italic;
126
- font-size: 0.75em;
127
- margin-top: 0.5rem;
128
- opacity: 0.5;
129
- }
130
-
131
- .wxchtf-message-read-box,
132
- .wxchtf-sending-message-sending-box {
133
- margin-left: 5px;
134
- }
135
- }
136
- }
137
- }
138
-
139
- .wxchtf-system-message {
140
- font-style: italic;
141
- position: relative;
142
- text-align: center;
143
-
144
- .wxchtf-text,
145
- .wxchtf-timestamp {
146
- display: inline-block;
147
- opacity: 0.9;
148
- font-size: 0.85em;
149
- }
150
-
151
- .wxchtf-timestamp {
152
- margin-left: 1rem;
153
- }
154
- }
155
-
156
- .wxchtf-message,
157
- .wxchtf-sending-message,
158
- .wxchtf-system-message,
159
- .wxchtf-message-skeleton {
160
- margin-bottom: 2rem;
161
-
162
- &:first-child {
163
- margin-bottom: 0;
164
- }
165
- }
166
-
167
- .wxchtf-message-skeleton {
168
- display: flex;
169
- flex-flow: row nowrap;
170
- align-items: flex-end;
171
-
172
- .wxchtf-avatar {
173
- margin-right: 15px;
174
- }
175
-
176
- .wxchtf-avatar .ant-skeleton-avatar {
177
- width: $avatarSize;
178
- height: $avatarSize;
179
- line-height: $avatarSize;
180
- }
181
-
182
- .wxchtf-content {
183
- width: 300px;
184
- height: 100px;
185
- border-radius: $messageBorderRadius;
186
- border-bottom-left-radius: 0;
187
- }
188
- }
189
- }
190
- }
191
-
192
- .wxchtf-input-form {
193
- flex: none;
194
- max-height: 300px;
195
- display: flex;
196
- flex-flow: column nowrap;
197
-
198
- .wxchtf-input-box {
199
- flex: none;
200
- display: flex;
201
- flex-flow: row nowrap;
202
- padding: 1rem 0;
203
- border-top: $border;
204
-
205
- @mixin iconBtn {
206
- flex: none;
207
- display: flex;
208
- padding: 0 1rem;
209
- align-items: flex-end;
210
-
211
- .ant-btn.ant-btn-icon-only .anticon {
212
- font-size: 1.5rem;
213
- }
214
- }
215
-
216
- .wxchtf-add-files-box {
217
- @include iconBtn();
218
- }
219
-
220
- .wxchtf-text-input-box {
221
- flex: auto;
222
-
223
- textarea {
224
- resize: none;
225
- border: none;
226
- outline: none;
227
- box-shadow: none;
228
-
229
- @include scrollbar();
230
- }
231
- }
232
-
233
- .wxchtf-submit-btn-box {
234
- @include iconBtn();
235
- }
236
- }
237
- }
238
-
239
- .wxchtf-add-chat {
240
- display: flex;
241
- flex-flow: column nowrap;
242
- justify-content: center;
243
- align-items: center;
244
- height: 100%;
245
-
246
- form {
247
- padding: 2rem;
248
- max-width: 700px;
249
- width: 100%;
250
- }
251
- }
252
- }
1
+ @import './variables.scss';
2
+ @import './mixins.scss';
3
+ @import './keyframes.scss';
4
+ @import './aside.scss';
5
+
6
+ .wxchtf-chatify {
7
+ border: $border;
8
+ display: flex;
9
+ flex-flow: column nowrap;
10
+ background: $background;
11
+ border-radius: $radius;
12
+
13
+ .wxchtf-header {
14
+ min-height: 2rem;
15
+ border-bottom: $border;
16
+ }
17
+
18
+ .wxchtf-body {
19
+ flex: 1 0;
20
+ display: flex;
21
+ flex-flow: row nowrap;
22
+ }
23
+
24
+ .wxchtf-footer {
25
+ min-height: 2rem;
26
+ border-top: $border;
27
+ }
28
+ }
29
+
30
+ .wxchtf-main {
31
+ flex: auto;
32
+ display: flex;
33
+ flex-flow: column nowrap;
34
+
35
+ .wxchtf-chat {
36
+ flex: auto;
37
+ display: flex;
38
+ flex-flow: column nowrap;
39
+
40
+ .wxchtf-chat-header {
41
+ border-bottom: $border;
42
+ padding: 0.5rem 1rem;
43
+
44
+ .wxchtf-chat-name {
45
+ font-weight: 600;
46
+ flex: none;
47
+ }
48
+ }
49
+
50
+ .wxchtf-chat-body {
51
+ flex: 1 1 auto;
52
+ height: 100px;
53
+ overflow-y: auto;
54
+ background: $chatBodyBackground;
55
+ padding: 2rem 1rem;
56
+ display: flex;
57
+ flex-flow: column-reverse nowrap;
58
+
59
+ @include scrollbar();
60
+
61
+ @media only screen and (min-width: 1120px) {
62
+ padding-right: 30%;
63
+ }
64
+
65
+ .wxchtf-message,
66
+ .wxchtf-sending-message {
67
+ display: flex;
68
+ flex-flow: row nowrap;
69
+ width: 100%;
70
+ align-items: flex-end;
71
+
72
+ &.--my {
73
+ direction: rtl;
74
+ justify-content: flex-start;
75
+
76
+ .wxchtf-message-author {
77
+ margin-right: 0;
78
+ margin-left: 15px;
79
+ }
80
+
81
+ .wxchtf-message-content,
82
+ .wxchtf-sending-message-content {
83
+ direction: ltr;
84
+ border-bottom-left-radius: 10px;
85
+ border-bottom-right-radius: 0;
86
+ background-color: $myMessageBackground;
87
+ }
88
+ }
89
+
90
+ .wxchtf-message-author {
91
+ margin-right: 15px;
92
+
93
+ .ant-avatar {
94
+ @include avatarSize($avatarSize);
95
+ box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
96
+ }
97
+ }
98
+
99
+ .wxchtf-message-content,
100
+ .wxchtf-sending-message-content {
101
+ min-width: 300px;
102
+ max-width: 70%;
103
+ border-radius: $messageBorderRadius;
104
+ padding: 0.75rem 1rem;
105
+ background: white;
106
+ border-bottom-left-radius: 0;
107
+ background-color: $messageBackground;
108
+ box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
109
+ display: block;
110
+ white-space: pre-wrap;
111
+ overflow-wrap: break-word;
112
+
113
+ .wxchtf-message-info-box,
114
+ .wxchtf-sending-message-info-box {
115
+ text-align: right;
116
+
117
+ .wxchtf-message-sent-at,
118
+ .wxchtf-message-read-box,
119
+ .wxchtf-sending-message-sending-box {
120
+ display: inline-block;
121
+ font-style: italic;
122
+ font-size: 0.75em;
123
+ margin-top: 0.5rem;
124
+ opacity: 0.5;
125
+ }
126
+
127
+ .wxchtf-message-read-box,
128
+ .wxchtf-sending-message-sending-box {
129
+ margin-left: 5px;
130
+ }
131
+ }
132
+ }
133
+ }
134
+
135
+ .wxchtf-system-message {
136
+ font-style: italic;
137
+ position: relative;
138
+ text-align: center;
139
+
140
+ .wxchtf-text,
141
+ .wxchtf-timestamp {
142
+ display: inline-block;
143
+ opacity: 0.9;
144
+ font-size: 0.85em;
145
+ }
146
+
147
+ .wxchtf-timestamp {
148
+ margin-left: 1rem;
149
+ }
150
+ }
151
+
152
+ .wxchtf-message,
153
+ .wxchtf-sending-message,
154
+ .wxchtf-system-message,
155
+ .wxchtf-message-skeleton {
156
+ margin-bottom: 2rem;
157
+
158
+ &:first-child {
159
+ margin-bottom: 0;
160
+ }
161
+ }
162
+
163
+ .wxchtf-message-skeleton {
164
+ display: flex;
165
+ flex-flow: row nowrap;
166
+ align-items: flex-end;
167
+
168
+ .wxchtf-avatar {
169
+ margin-right: 15px;
170
+ }
171
+
172
+ .wxchtf-avatar .ant-skeleton-avatar {
173
+ width: $avatarSize;
174
+ height: $avatarSize;
175
+ line-height: $avatarSize;
176
+ }
177
+
178
+ .wxchtf-content {
179
+ width: 300px;
180
+ height: 100px;
181
+ border-radius: $messageBorderRadius;
182
+ border-bottom-left-radius: 0;
183
+ }
184
+ }
185
+ }
186
+ }
187
+
188
+ .wxchtf-input-form {
189
+ flex: none;
190
+ max-height: 300px;
191
+ display: flex;
192
+ flex-flow: column nowrap;
193
+
194
+ .wxchtf-input-box {
195
+ flex: none;
196
+ display: flex;
197
+ flex-flow: row nowrap;
198
+ padding: 1rem 0;
199
+ border-top: $border;
200
+
201
+ @mixin iconBtn {
202
+ flex: none;
203
+ display: flex;
204
+ padding: 0 1rem;
205
+ align-items: flex-end;
206
+
207
+ .ant-btn.ant-btn-icon-only .anticon {
208
+ font-size: 1.5rem;
209
+ }
210
+ }
211
+
212
+ .wxchtf-add-files-box {
213
+ @include iconBtn();
214
+ }
215
+
216
+ .wxchtf-text-input-box {
217
+ flex: auto;
218
+
219
+ textarea {
220
+ resize: none;
221
+ border: none;
222
+ outline: none;
223
+ box-shadow: none;
224
+
225
+ @include scrollbar();
226
+ }
227
+ }
228
+
229
+ .wxchtf-submit-btn-box {
230
+ @include iconBtn();
231
+ }
232
+ }
233
+ }
234
+
235
+ .wxchtf-add-chat {
236
+ display: flex;
237
+ flex-flow: column nowrap;
238
+ justify-content: center;
239
+ align-items: center;
240
+ height: 100%;
241
+
242
+ form {
243
+ padding: 2rem;
244
+ max-width: 700px;
245
+ width: 100%;
246
+ }
247
+ }
248
+ }
@@ -1,14 +1,14 @@
1
- @keyframes fadeInFromNone {
2
- 0% {
3
- display: none;
4
- opacity: 0;
5
- }
6
-
7
- 1% {
8
- opacity: 0;
9
- }
10
-
11
- 100% {
12
- opacity: 1;
13
- }
14
- }
1
+ @keyframes fadeInFromNone {
2
+ 0% {
3
+ display: none;
4
+ opacity: 0;
5
+ }
6
+
7
+ 1% {
8
+ opacity: 0;
9
+ }
10
+
11
+ 100% {
12
+ opacity: 1;
13
+ }
14
+ }
@@ -1,20 +1,20 @@
1
- @mixin scrollbar() {
2
- &::-webkit-scrollbar {
3
- width: 8px;
4
- height: 8px;
5
- }
6
-
7
- &::-webkit-scrollbar-track {
8
- background-color: #f1f1f1;
9
- }
10
-
11
- &::-webkit-scrollbar-thumb {
12
- background-color: #dfdfdf;
13
- }
14
- }
15
-
16
- @mixin avatarSize($size) {
17
- width: $size;
18
- height: $size;
19
- line-height: $size - 2px;
20
- }
1
+ @mixin scrollbar() {
2
+ &::-webkit-scrollbar {
3
+ width: 8px;
4
+ height: 8px;
5
+ }
6
+
7
+ &::-webkit-scrollbar-track {
8
+ background-color: #f1f1f1;
9
+ }
10
+
11
+ &::-webkit-scrollbar-thumb {
12
+ background-color: #dfdfdf;
13
+ }
14
+ }
15
+
16
+ @mixin avatarSize($size) {
17
+ width: $size;
18
+ height: $size;
19
+ line-height: $size - 2px;
20
+ }
@@ -1,10 +1,10 @@
1
- $borderColor: #ddd;
2
- $border: 1px solid #ddd;
3
- $background: white;
4
- $radius: 4px;
5
- $chatBodyBackground: #f5f5f5;
6
- $messageBackground: #e1f5fe;
7
- $myMessageBackground: #b9f6ca;
8
- $unreadCountBackground: #ffa726;
9
- $avatarSize: 40px;
10
- $messageBorderRadius: 10px;
1
+ $borderColor: #ddd;
2
+ $border: 1px solid #ddd;
3
+ $background: white;
4
+ $radius: 4px;
5
+ $chatBodyBackground: #f5f5f5;
6
+ $messageBackground: #e1f5fe;
7
+ $myMessageBackground: #b9f6ca;
8
+ $unreadCountBackground: #ffa726;
9
+ $avatarSize: 40px;
10
+ $messageBorderRadius: 10px;