@talkjs/web-components 0.1.0 → 0.1.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.
Files changed (4) hide show
  1. package/default.cjs +292 -290
  2. package/default.d.ts +60 -52
  3. package/default.js +10493 -10856
  4. package/package.json +3 -2
package/default.d.ts CHANGED
@@ -6,10 +6,12 @@ import { FileBlock } from '@talkjs/core';
6
6
  import { FileToken } from '@talkjs/core';
7
7
  import { GenericFileBlock } from '@talkjs/core';
8
8
  import { ImageBlock } from '@talkjs/core';
9
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
9
10
  import { LocationBlock } from '@talkjs/core';
10
11
  import { MessageSnapshot } from '@talkjs/core';
11
12
  import { ParticipantSnapshot } from '@talkjs/core';
12
- import * as React from 'react';
13
+ import * as Preact from 'preact/compat';
14
+ import * as React_2 from 'react';
13
15
  import { ReferencedMessageSnapshot } from '@talkjs/core';
14
16
  import { SendMessageParams } from '@talkjs/core';
15
17
  import { SendTextMessageParams } from '@talkjs/core';
@@ -108,7 +110,7 @@ export declare interface AudioBlockProps {
108
110
  * into a series of nice rounded bars. Less signal, but also less distraction. I
109
111
  * kinda like it!
110
112
  */
111
- export declare function AudioPlayer({ src, onError, filename, className, }: AudioPlayerProps): JSX.Element;
113
+ export declare function AudioPlayer({ src, onError, filename, className, }: AudioPlayerProps): JSX_2.Element;
112
114
 
113
115
  /**
114
116
  * @public
@@ -322,7 +324,7 @@ export declare interface ChatboxProps {
322
324
  /**
323
325
  * @hidden
324
326
  */
325
- style?: React.CSSProperties;
327
+ style?: React_2.CSSProperties;
326
328
  /**
327
329
  * Your app's unique TalkJS ID. You can find it on the Settings page of the
328
330
  * {@link https://talkjs.com/dashboard | TalkJS dashboard.}
@@ -535,11 +537,6 @@ export declare interface CommonChatboxProps {
535
537
  * The conversation displayed in the chatbox.
536
538
  */
537
539
  conversation: ConversationSnapshot;
538
- /**
539
- * A list of participants that are part of the conversation that's currently
540
- * being shown.
541
- */
542
- participants: ParticipantSnapshot[];
543
540
  /**
544
541
  * Tells you which participants are currently typing
545
542
  */
@@ -683,10 +680,6 @@ export declare interface ConversationListItemProps {
683
680
  * The conversation that's being displayed.
684
681
  */
685
682
  conversation: ConversationSnapshot;
686
- /**
687
- * The list of participants that are part of the given conversation.
688
- */
689
- participants: ParticipantSnapshot[];
690
683
  /**
691
684
  * If `true`, this conversation is the currently selected one in the
692
685
  * conversation list.
@@ -705,7 +698,7 @@ export declare interface ConversationListProps {
705
698
  /**
706
699
  * @hidden
707
700
  */
708
- style?: React.CSSProperties;
701
+ style?: React_2.CSSProperties;
709
702
  /**
710
703
  * Your app's unique TalkJS ID. You can find it on the Settings page of the
711
704
  * {@link https://talkjs.com/dashboard | TalkJS dashboard.}
@@ -845,7 +838,7 @@ export declare interface DeviceFeatures {
845
838
  isMobile: boolean;
846
839
  }
847
840
 
848
- export declare function Editor({ placeholder, disabled, className, characterLimit, spellcheck, }: EditorProps): JSX.Element;
841
+ export declare function Editor({ placeholder, disabled, className, characterLimit, spellcheck, }: EditorProps): JSX_2.Element;
849
842
 
850
843
  export declare interface EditorController {
851
844
  isTyping: boolean;
@@ -894,7 +887,7 @@ export declare interface EditorProps {
894
887
  className?: string;
895
888
  }
896
889
 
897
- export declare function EmojiPicker(props: EmojiPickerProps): JSX.Element;
890
+ export declare function EmojiPicker(props: EmojiPickerProps): JSX_2.Element;
898
891
 
899
892
  /**
900
893
  * @public
@@ -911,7 +904,7 @@ export declare interface EmojiPickerProps {
911
904
  *
912
905
  * Uses the IndexedDB-backed emoji database from "emoji-picker-element".
913
906
  */
914
- export declare function EmojiSuggestBar(props: EmojiSuggestBarProps): JSX.Element;
907
+ export declare function EmojiSuggestBar(props: EmojiSuggestBarProps): JSX_2.Element;
915
908
 
916
909
  /**
917
910
  * @public
@@ -1030,7 +1023,7 @@ export declare interface GroupChatImageProps {
1030
1023
  * Adapted from:
1031
1024
  * https://github.com/developit/htm/issues/175#issuecomment-773755560
1032
1025
  */
1033
- export declare function html(strings: TemplateStringsArray, ...args: any[]): React.ReactElement;
1026
+ export declare function html(strings: TemplateStringsArray, ...args: any[]): React_2.ReactElement;
1034
1027
 
1035
1028
  /**
1036
1029
  * @public
@@ -1110,7 +1103,7 @@ export declare interface LocationBlockProps {
1110
1103
  block: LocationBlock;
1111
1104
  }
1112
1105
 
1113
- export declare function MentionSuggestList(props: MentionSuggestListProps): JSX.Element | null;
1106
+ export declare function MentionSuggestList(props: MentionSuggestListProps): JSX_2.Element | null;
1114
1107
 
1115
1108
  export declare interface MentionSuggestList {
1116
1109
  keydown(key: string): boolean;
@@ -1122,12 +1115,12 @@ export declare interface MentionSuggestList {
1122
1115
  export declare interface MentionSuggestListProps {
1123
1116
  }
1124
1117
 
1125
- export declare function MenuItem(props: MenuItemProps): JSX.Element;
1118
+ export declare function MenuItem(props: MenuItemProps): JSX_2.Element;
1126
1119
 
1127
1120
  /**
1128
1121
  * @public
1129
1122
  */
1130
- export declare interface MenuItemProps extends React.HTMLAttributes<HTMLDivElement> {
1123
+ export declare interface MenuItemProps extends React_2.HTMLAttributes<HTMLDivElement> {
1131
1124
  /**
1132
1125
  * When a callback is passed, it will be called when the menu item is selected.
1133
1126
  */
@@ -1176,7 +1169,7 @@ export declare interface MessageActionMenuProps {
1176
1169
  permissions: MessagePermissions;
1177
1170
  }
1178
1171
 
1179
- export declare function MessageContent(props: MessageContentProps): JSX.Element;
1172
+ export declare function MessageContent(props: MessageContentProps): JSX_2.Element;
1180
1173
 
1181
1174
  /**
1182
1175
  * @public
@@ -1386,12 +1379,12 @@ export { ParticipantSnapshot }
1386
1379
  *
1387
1380
  * the popoverComponent will also receive a closePopover prop. It's a function you can call to close the popover.
1388
1381
  */
1389
- export declare function PopoverButton<T extends object>(props: PopoverButtonProps<T>): JSX.Element;
1382
+ export declare function PopoverButton<T extends object>(props: PopoverButtonProps<T>): JSX_2.Element;
1390
1383
 
1391
1384
  /**
1392
1385
  * @public
1393
1386
  */
1394
- export declare interface PopoverButtonProps<T extends object> extends React.HTMLAttributes<HTMLButtonElement> {
1387
+ export declare interface PopoverButtonProps<T extends object> extends React_2.HTMLAttributes<HTMLButtonElement> {
1395
1388
  /**
1396
1389
  * Whether to display a menu or a popover when the button is clicked.
1397
1390
  *
@@ -1402,7 +1395,7 @@ export declare interface PopoverButtonProps<T extends object> extends React.HTML
1402
1395
  /**
1403
1396
  * The popover component to render in response to the button click.
1404
1397
  */
1405
- popoverComponent: React.ComponentType<T>;
1398
+ popoverComponent: React_2.ComponentType<T>;
1406
1399
  /**
1407
1400
  * Props passed to the popover component.
1408
1401
  */
@@ -1410,14 +1403,16 @@ export declare interface PopoverButtonProps<T extends object> extends React.HTML
1410
1403
  /**
1411
1404
  * Children nodes rendered inside the button.
1412
1405
  */
1413
- children: React.ReactNode;
1406
+ children: React_2.ReactNode;
1414
1407
  /**
1415
1408
  * The element to focus when the popover is opened. Can be an element or a selector. Ignored if type is "menu".
1416
1409
  */
1417
1410
  initialFocus?: string | HTMLElement;
1418
1411
  }
1419
1412
 
1420
- export declare function ReactionPicker({ messageId, colorScheme, }: ReactionPickerProps): JSX.Element;
1413
+ export { Preact }
1414
+
1415
+ export declare function ReactionPicker({ messageId, colorScheme, }: ReactionPickerProps): JSX_2.Element;
1421
1416
 
1422
1417
  /**
1423
1418
  * @public
@@ -1499,7 +1494,7 @@ export { TalkSession }
1499
1494
  *
1500
1495
  * @public
1501
1496
  */
1502
- declare function Text_2({ block, nonInteractive, message, className, }: TextProps): React.ReactElement;
1497
+ declare function Text_2({ block, nonInteractive, message, className, }: TextProps): React_2.ReactElement;
1503
1498
  export { Text_2 as Text }
1504
1499
 
1505
1500
  export { TextBlock }
@@ -1558,31 +1553,31 @@ export declare interface TextProps {
1558
1553
  * @public
1559
1554
  */
1560
1555
  export declare interface Theme {
1561
- Avatar: React.ComponentType<AvatarProps>;
1562
- ConversationImage: React.ComponentType<ConversationImageProps>;
1563
- GroupChatImage: React.ComponentType<GroupChatImageProps>;
1564
- ReferencedMessage: React.ComponentType<ReferencedMessageProps>;
1565
- ReplyBar: React.ComponentType<ReplyBarProps>;
1566
- TimeAgo: React.ComponentType<TimeAgoProps>;
1567
- MessageActionMenu: React.ComponentType<MessageActionMenuProps>;
1568
- CompactMessageContent: React.ComponentType<CompactMessageContentProps>;
1569
- ChatHeader: React.ComponentType<ChatHeaderProps>;
1570
- MessageListHeader: React.ComponentType<MessageListHeaderProps>;
1571
- Message: React.ComponentType<MessageProps>;
1572
- MessageField: React.ComponentType<MessageFieldProps>;
1573
- Icon: React.ComponentType<IconProps>;
1574
- MessageDivider: React.ComponentType<MessageDividerProps>;
1575
- MessageListFooter: React.ComponentType<MessageListFooterProps>;
1576
- BeforeMessages: React.ComponentType<BeforeMessagesProps>;
1577
- AfterMessages: React.ComponentType<AfterMessagesProps>;
1578
- TextBlock: React.ComponentType<TextBlockProps>;
1579
- FileBlock: React.ComponentType<FileBlockProps>;
1580
- LocationBlock: React.ComponentType<LocationBlockProps>;
1581
- ImageBlock: React.ComponentType<ImageBlockProps>;
1582
- AudioBlock: React.ComponentType<AudioBlockProps>;
1583
- VoiceBlock: React.ComponentType<VoiceBlockProps>;
1584
- VideoBlock: React.ComponentType<VideoBlockProps>;
1585
- ConversationListItem: React.ComponentType<ConversationListItemProps>;
1556
+ Avatar: React_2.ComponentType<AvatarProps>;
1557
+ ConversationImage: React_2.ComponentType<ConversationImageProps>;
1558
+ GroupChatImage: React_2.ComponentType<GroupChatImageProps>;
1559
+ ReferencedMessage: React_2.ComponentType<ReferencedMessageProps>;
1560
+ ReplyBar: React_2.ComponentType<ReplyBarProps>;
1561
+ TimeAgo: React_2.ComponentType<TimeAgoProps>;
1562
+ MessageActionMenu: React_2.ComponentType<MessageActionMenuProps>;
1563
+ CompactMessageContent: React_2.ComponentType<CompactMessageContentProps>;
1564
+ ChatHeader: React_2.ComponentType<ChatHeaderProps>;
1565
+ MessageListHeader: React_2.ComponentType<MessageListHeaderProps>;
1566
+ Message: React_2.ComponentType<MessageProps>;
1567
+ MessageField: React_2.ComponentType<MessageFieldProps>;
1568
+ Icon: React_2.ComponentType<IconProps>;
1569
+ MessageDivider: React_2.ComponentType<MessageDividerProps>;
1570
+ MessageListFooter: React_2.ComponentType<MessageListFooterProps>;
1571
+ BeforeMessages: React_2.ComponentType<BeforeMessagesProps>;
1572
+ AfterMessages: React_2.ComponentType<AfterMessagesProps>;
1573
+ TextBlock: React_2.ComponentType<TextBlockProps>;
1574
+ FileBlock: React_2.ComponentType<FileBlockProps>;
1575
+ LocationBlock: React_2.ComponentType<LocationBlockProps>;
1576
+ ImageBlock: React_2.ComponentType<ImageBlockProps>;
1577
+ AudioBlock: React_2.ComponentType<AudioBlockProps>;
1578
+ VoiceBlock: React_2.ComponentType<VoiceBlockProps>;
1579
+ VideoBlock: React_2.ComponentType<VideoBlockProps>;
1580
+ ConversationListItem: React_2.ComponentType<ConversationListItemProps>;
1586
1581
  }
1587
1582
 
1588
1583
  /**
@@ -1707,6 +1702,19 @@ declare interface TranslationStrings {
1707
1702
 
1708
1703
  export { TypingSnapshot }
1709
1704
 
1705
+ /**
1706
+ * Returns a list of participants in the conversation with the given ID.
1707
+ * It'll initially return an empty list, and re-render the calling component as data participants are loaded.
1708
+ * It'll also cause a re-render when any of those participants change, such as when a user's name or photoUrl changes.
1709
+ *
1710
+ * @param conversationId ID of the conversation
1711
+ * @param limit Maximum number of participants to subscribe to. Defaults to 10. The maximum is 100.
1712
+ * @returns List of participant snapshots.
1713
+ *
1714
+ * @public
1715
+ */
1716
+ export declare function useParticipants(conversationId: string, limit?: number): ParticipantSnapshot[];
1717
+
1710
1718
  /**
1711
1719
  * Returns "Yesterday", "Last Monday", "Tuesday, March 31" or "Monday, March 31
1712
1720
  * 2014", depending on which is most appropriate.