@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,45 +1,45 @@
1
- import React, { FC, PropsWithChildren, useContext } from 'react';
2
-
3
- export type Customizable<TComponent extends React.ComponentType<any>, TKey extends string> = TComponent & {
4
- Component: TComponent;
5
- key: TKey;
6
- };
7
-
8
- const CustomizeContext = React.createContext<CustomizeProviderValue>(null!);
9
-
10
- export interface CustomizeProviderValue {
11
- [key: string]: React.ComponentType<any> | null;
12
- }
13
-
14
- export function CustomizeProvider(props: PropsWithChildren<{ value: CustomizeProviderValue }>) {
15
- const { children, value } = props;
16
- return <CustomizeContext.Provider value={value}>{children}</CustomizeContext.Provider>;
17
- }
18
-
19
- function useCustom<TComponent extends React.ComponentType>(key: string): TComponent | undefined | null {
20
- const value = useContext(CustomizeContext);
21
- return value[key] as TComponent | null | undefined;
22
- }
23
-
24
- export function customize<TComponent extends React.ComponentType<any>, TKey extends string>(
25
- key: TKey,
26
- Component: TComponent,
27
- ): Customizable<TComponent, TKey> {
28
- const Result: FC<any> = React.forwardRef<TComponent, any>((props: any, forwardRef) => {
29
- const Custom = useCustom(key);
30
-
31
- if (Custom === null) {
32
- return null;
33
- }
34
-
35
- if (Custom) {
36
- return <Custom {...props} ref={forwardRef} />;
37
- }
38
-
39
- return <Component {...props} ref={forwardRef} />;
40
- });
41
-
42
- Result.displayName = 'Customizable.' + Component.displayName;
43
-
44
- return Object.assign(Result, { key, Component }) as any;
45
- }
1
+ import React, { FC, PropsWithChildren, useContext } from 'react';
2
+
3
+ export type Customizable<TComponent extends React.ComponentType<any>, TKey extends string> = TComponent & {
4
+ Component: TComponent;
5
+ key: TKey;
6
+ };
7
+
8
+ const CustomizeContext = React.createContext<CustomizeProviderValue>(null!);
9
+
10
+ export interface CustomizeProviderValue {
11
+ [key: string]: React.ComponentType<any> | null;
12
+ }
13
+
14
+ export function CustomizeProvider(props: PropsWithChildren<{ value: CustomizeProviderValue }>) {
15
+ const { children, value } = props;
16
+ return <CustomizeContext.Provider value={value}>{children}</CustomizeContext.Provider>;
17
+ }
18
+
19
+ function useCustom<TComponent extends React.ComponentType>(key: string): TComponent | undefined | null {
20
+ const value = useContext(CustomizeContext);
21
+ return value[key] as TComponent | null | undefined;
22
+ }
23
+
24
+ export function customize<TComponent extends React.ComponentType<any>, TKey extends string>(
25
+ key: TKey,
26
+ Component: TComponent,
27
+ ): Customizable<TComponent, TKey> {
28
+ const Result: FC<any> = React.forwardRef<TComponent, any>((props: any, forwardRef) => {
29
+ const Custom = useCustom(key);
30
+
31
+ if (Custom === null) {
32
+ return null;
33
+ }
34
+
35
+ if (Custom) {
36
+ return <Custom {...props} ref={forwardRef} />;
37
+ }
38
+
39
+ return <Component {...props} ref={forwardRef} />;
40
+ });
41
+
42
+ Result.displayName = 'Customizable.' + Component.displayName;
43
+
44
+ return Object.assign(Result, { key, Component }) as any;
45
+ }
package/src/util/index.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './uniqBy';
2
- export * from './uniqId';
3
- export * from './customize';
1
+ export * from './uniqBy';
2
+ export * from './uniqId';
3
+ export * from './customize';
@@ -1,17 +1,17 @@
1
- export function uniqBy<T, TKey extends string | number | symbol>(items: T[], selector: (x: T) => TKey) {
2
- const keys = {} as Record<TKey, null>;
3
- const result: T[] = [];
4
-
5
- items.forEach((x) => {
6
- const key = selector(x);
7
-
8
- if (keys.hasOwnProperty(key)) {
9
- return;
10
- }
11
-
12
- keys[key] = null;
13
- result.push(x);
14
- });
15
-
16
- return result;
17
- }
1
+ export function uniqBy<T, TKey extends string | number | symbol>(items: T[], selector: (x: T) => TKey) {
2
+ const keys = {} as Record<TKey, null>;
3
+ const result: T[] = [];
4
+
5
+ items.forEach((x) => {
6
+ const key = selector(x);
7
+
8
+ if (keys.hasOwnProperty(key)) {
9
+ return;
10
+ }
11
+
12
+ keys[key] = null;
13
+ result.push(x);
14
+ });
15
+
16
+ return result;
17
+ }
@@ -1,3 +1,3 @@
1
- export function uniqId() {
2
- return Date.now().toString(36) + Math.random().toString(36).substring(2);
3
- }
1
+ export function uniqId() {
2
+ return Date.now().toString(36) + Math.random().toString(36).substring(2);
3
+ }