@dxos/react-ui-thread 0.8.4-main.d05673bc65 → 0.8.4-main.dfabb4ec29

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 (32) hide show
  1. package/dist/lib/browser/index.mjs +28 -59
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/browser/translations.mjs +25 -0
  5. package/dist/lib/browser/translations.mjs.map +7 -0
  6. package/dist/types/src/Message/Message.d.ts.map +1 -1
  7. package/dist/types/src/Message/Message.stories.d.ts +10 -10
  8. package/dist/types/src/Message/Message.stories.d.ts.map +1 -1
  9. package/dist/types/src/Thread/Comments.stories.d.ts +12 -12
  10. package/dist/types/src/Thread/Comments.stories.d.ts.map +1 -1
  11. package/dist/types/src/Thread/Thread.d.ts +23 -9
  12. package/dist/types/src/Thread/Thread.d.ts.map +1 -1
  13. package/dist/types/src/Thread/Thread.stories.d.ts +15 -11
  14. package/dist/types/src/Thread/Thread.stories.d.ts.map +1 -1
  15. package/dist/types/src/index.d.ts +0 -2
  16. package/dist/types/src/index.d.ts.map +1 -1
  17. package/dist/types/src/testing.d.ts.map +1 -1
  18. package/dist/types/src/translations.d.ts +10 -10
  19. package/dist/types/src/translations.d.ts.map +1 -1
  20. package/dist/types/src/types.d.ts +1 -0
  21. package/dist/types/src/types.d.ts.map +1 -1
  22. package/dist/types/tsconfig.tsbuildinfo +1 -1
  23. package/package.json +25 -19
  24. package/src/Message/Message.stories.tsx +2 -2
  25. package/src/Message/Message.tsx +10 -13
  26. package/src/Thread/Comments.stories.tsx +13 -14
  27. package/src/Thread/Thread.stories.tsx +5 -5
  28. package/src/Thread/Thread.tsx +13 -8
  29. package/src/index.ts +0 -3
  30. package/src/testing.tsx +1 -4
  31. package/src/translations.ts +10 -10
  32. package/src/types.ts +1 -0
@@ -1,28 +1,8 @@
1
- // src/translations.ts
2
- var translationKey = "@dxos/react-ui-thread";
3
- var translations = [
4
- {
5
- "en-US": {
6
- [translationKey]: {
7
- "plugin name": "Threads",
8
- "thread title placeholder": "New thread",
9
- "thread title label": "Title",
10
- "delete thread label": "Delete",
11
- "create thread label": "Create thread",
12
- "message placeholder": "Enter message...",
13
- "comment placeholder": "Enter comment...",
14
- "settings standalone label": "Enable standalone thread creation",
15
- "anonymous label": "Anonymous",
16
- "enter to send message": "Enter to add \u23CE"
17
- }
18
- }
19
- }
20
- ];
21
-
22
1
  // src/Thread/Thread.tsx
23
2
  import React, { forwardRef } from "react";
24
3
  import { Icon, useTranslation } from "@dxos/react-ui";
25
4
  import { hoverableControlItem, hoverableFocusedWithinControls, mx } from "@dxos/ui-theme";
5
+ import { translationKey } from "#translations";
26
6
  var threadLayout = "w-full place-self-start grid grid-cols-[var(--dx-rail-size)_1fr]";
27
7
  var ThreadRoot = /* @__PURE__ */ forwardRef(({ current, children, classNames, ...props }, forwardedRef) => {
28
8
  return /* @__PURE__ */ React.createElement("div", {
@@ -38,12 +18,10 @@ var ThreadRoot = /* @__PURE__ */ forwardRef(({ current, children, classNames, ..
38
18
  });
39
19
  var ThreadHeader = /* @__PURE__ */ forwardRef(({ children, detached, ...props }, forwardedRef) => {
40
20
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
41
- role: "none",
42
21
  className: "flex items-center justify-center text-description"
43
22
  }, /* @__PURE__ */ React.createElement(Icon, {
44
23
  icon: "ph--caret-double-right--regular"
45
24
  })), /* @__PURE__ */ React.createElement("div", {
46
- role: "none",
47
25
  className: "flex items-center overflow-hidden"
48
26
  }, /* @__PURE__ */ React.createElement("p", {
49
27
  role: "heading",
@@ -68,7 +46,7 @@ var ThreadStatus = /* @__PURE__ */ forwardRef(({ activity, classNames, children,
68
46
  "aria-live": "polite"
69
47
  }, activity ? children : null), /* @__PURE__ */ React.createElement("span", {
70
48
  className: mx("text-end", hoverableControlItem)
71
- }, t("enter to send message")));
49
+ }, t("enter-to-send.message")));
72
50
  });
73
51
  var Thread = {
74
52
  Root: ThreadRoot,
@@ -82,40 +60,33 @@ import React2, { forwardRef as forwardRef2 } from "react";
82
60
  import { Avatar, useTranslation as useTranslation2 } from "@dxos/react-ui";
83
61
  import { useTextEditor } from "@dxos/react-ui-editor";
84
62
  import { keymap, listener } from "@dxos/ui-editor";
85
- import { focusRing, mx as mx2 } from "@dxos/ui-theme";
63
+ import { mx as mx2 } from "@dxos/ui-theme";
86
64
  import { hexToEmoji, hexToHue, isTruthy } from "@dxos/util";
65
+ import { translationKey as translationKey2 } from "#translations";
87
66
  var avatarSize = 7;
88
67
  var MessageRoot = /* @__PURE__ */ forwardRef2(({ authorImgSrc, authorId, authorName, authorAvatarProps, continues = true, children, classNames, ...rootProps }, forwardedRef) => {
89
- return (
90
- // Must wrap the message since Avatar.Label may be used in the content.
91
- /* @__PURE__ */ React2.createElement(Avatar.Root, null, /* @__PURE__ */ React2.createElement("div", {
92
- role: "none",
93
- "data-testid": "thread.message",
94
- ...rootProps,
95
- className: mx2("grid grid-cols-subgrid col-span-2", classNames),
96
- ref: forwardedRef
97
- }, /* @__PURE__ */ React2.createElement("div", {
98
- role: "none",
99
- className: "flex flex-col items-center gap-2 pt-1"
100
- }, /* @__PURE__ */ React2.createElement(Avatar.Content, {
101
- size: avatarSize,
102
- hue: authorAvatarProps?.hue || hexToHue(authorId ?? "0"),
103
- fallback: authorAvatarProps?.emoji || hexToEmoji(authorId ?? "0"),
104
- ...authorImgSrc && {
105
- imgSrc: authorImgSrc
106
- }
107
- }), continues && /* @__PURE__ */ React2.createElement("div", {
108
- role: "none",
109
- className: "w-px grow bg-separator"
110
- })), /* @__PURE__ */ React2.createElement("div", {
111
- role: "none",
112
- className: "py-1 min-w-0"
113
- }, children)))
114
- );
68
+ return /* @__PURE__ */ React2.createElement(Avatar.Root, null, /* @__PURE__ */ React2.createElement("div", {
69
+ "data-testid": "thread.message",
70
+ ...rootProps,
71
+ className: mx2("grid grid-cols-subgrid col-span-2", classNames),
72
+ ref: forwardedRef
73
+ }, /* @__PURE__ */ React2.createElement("div", {
74
+ className: "flex flex-col items-center gap-2 pt-1"
75
+ }, /* @__PURE__ */ React2.createElement(Avatar.Content, {
76
+ size: avatarSize,
77
+ hue: authorAvatarProps?.hue || hexToHue(authorId ?? "0"),
78
+ fallback: authorAvatarProps?.emoji || hexToEmoji(authorId ?? "0"),
79
+ ...authorImgSrc && {
80
+ imgSrc: authorImgSrc
81
+ }
82
+ }), continues && /* @__PURE__ */ React2.createElement("div", {
83
+ className: "w-px grow bg-separator"
84
+ })), /* @__PURE__ */ React2.createElement("div", {
85
+ className: "py-1 min-w-0"
86
+ }, children)));
115
87
  });
116
88
  var MessageHeading = ({ children, classNames, timestamp, authorName, ...props }) => {
117
89
  return /* @__PURE__ */ React2.createElement("div", {
118
- role: "none",
119
90
  ...props,
120
91
  className: mx2("flex gap-2 items-start", classNames)
121
92
  }, /* @__PURE__ */ React2.createElement("p", {
@@ -127,13 +98,13 @@ var MessageHeading = ({ children, classNames, timestamp, authorName, ...props })
127
98
  })), children);
128
99
  };
129
100
  var MessageAuthorName = ({ authorName }) => {
130
- const { t } = useTranslation2(translationKey);
101
+ const { t } = useTranslation2(translationKey2);
131
102
  return /* @__PURE__ */ React2.createElement(Avatar.Label, {
132
103
  classNames: "block truncate text-sm text-subdued"
133
- }, authorName ?? t("anonymous label"));
104
+ }, authorName ?? t("anonymous.label"));
134
105
  };
135
106
  var MessageTime = ({ timestamp }) => {
136
- const { dtLocale } = useTranslation2(translationKey);
107
+ const { dtLocale } = useTranslation2(translationKey2);
137
108
  const dt = timestamp ? new Date(timestamp) : void 0;
138
109
  return /* @__PURE__ */ React2.createElement("time", {
139
110
  className: "block text-subdued text-xs pb-0.5",
@@ -201,9 +172,8 @@ var MessageTextbox = ({ id, authorId, authorName, authorImgSrc, authorAvatarProp
201
172
  authorAvatarProps,
202
173
  continues: false
203
174
  }, /* @__PURE__ */ React2.createElement("div", {
204
- role: "none",
205
175
  ref: parentRef,
206
- className: mx2("py-0.5 me-1 rounded-xs", focusRing, disabled && "opacity-50"),
176
+ className: mx2("py-0.5 me-1 rounded-xs dx-focus-ring", disabled && "opacity-50"),
207
177
  ...focusAttributes
208
178
  }));
209
179
  };
@@ -215,7 +185,6 @@ export {
215
185
  MessageTextbox,
216
186
  MessageTime,
217
187
  Thread,
218
- threadLayout,
219
- translations
188
+ threadLayout
220
189
  };
221
190
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/translations.ts", "../../../src/Thread/Thread.tsx", "../../../src/Message/Message.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\n\nexport const translationKey = '@dxos/react-ui-thread';\n\nexport const translations = [\n {\n 'en-US': {\n [translationKey]: {\n 'plugin name': 'Threads',\n 'thread title placeholder': 'New thread',\n 'thread title label': 'Title',\n 'delete thread label': 'Delete',\n 'create thread label': 'Create thread',\n 'message placeholder': 'Enter message...',\n 'comment placeholder': 'Enter comment...',\n 'settings standalone label': 'Enable standalone thread creation',\n 'anonymous label': 'Anonymous',\n 'enter to send message': 'Enter to add ⏎',\n },\n },\n },\n] as const satisfies Resource[];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type ComponentPropsWithRef, forwardRef } from 'react';\n\nimport { Icon, type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { hoverableControlItem, hoverableFocusedWithinControls, mx } from '@dxos/ui-theme';\n\nimport { translationKey } from '../translations';\nimport type { ThreadEntity } from '../types';\n\n// TODO(burdon): Avoid exporting fragments.\nexport const threadLayout = 'w-full place-self-start grid grid-cols-[var(--dx-rail-size)_1fr]';\n\n//\n// Root\n//\n\ntype ThreadRootProps = ThemedClassName<ComponentPropsWithRef<'div'>> & ThreadEntity & { current?: boolean };\n\nconst ThreadRoot = forwardRef<HTMLDivElement, ThreadRootProps>(\n ({ current, children, classNames, ...props }, forwardedRef) => {\n return (\n <div\n role='group'\n data-testid='thread'\n {...(current && { 'aria-current': typeof current === 'string' ? current : 'location' })}\n {...props}\n className={mx(\n threadLayout,\n hoverableFocusedWithinControls,\n 'bg-[var(--surface-bg)] current-related dx-attention-surface [--controls-opacity:0]',\n classNames,\n )}\n ref={forwardedRef}\n >\n {children}\n </div>\n );\n },\n);\n\n//\n// Heading\n//\n\ntype ThreadHeaderProps = ComponentPropsWithRef<'div'> & { detached?: boolean };\n\nconst ThreadHeader = forwardRef<HTMLParagraphElement, ThreadHeaderProps>(\n ({ children, detached, ...props }, forwardedRef) => {\n return (\n <>\n <div role='none' className='flex items-center justify-center text-description'>\n <Icon icon='ph--caret-double-right--regular' />\n </div>\n <div role='none' className='flex items-center overflow-hidden'>\n <p\n role='heading'\n data-testid='thread.heading'\n {...props}\n className={mx('me-2 text-description font-medium truncate italic', detached && 'line-through decoration-1')}\n ref={forwardedRef}\n >\n {children}\n </p>\n </div>\n </>\n );\n },\n);\n\n//\n// Status\n//\n\ntype ThreadStatusProps = ThemedClassName<ComponentPropsWithRef<'div'>> & {\n activity?: boolean;\n};\n\nconst ThreadStatus = forwardRef<HTMLDivElement, ThreadStatusProps>(\n ({ activity, classNames, children, ...props }, forwardedRef) => {\n const { t } = useTranslation(translationKey);\n return (\n <div\n {...props}\n className={mx(\n 'col-start-2 grid grid-cols-[min-content_1fr_max-content] pb-2 pe-2 text-xs text-description',\n classNames,\n )}\n ref={forwardedRef}\n >\n <Icon\n icon='ph--spinner--bold'\n classNames='w-6 h-4 invisible data-[visible=show]:visible animate-spin-slow'\n data-visible={activity ? 'show' : 'hide'}\n />\n <span className='truncate min-w-0' aria-live='polite'>\n {activity ? children : null}\n </span>\n <span className={mx('text-end', hoverableControlItem)}>{t('enter to send message')}</span>\n </div>\n );\n },\n);\n\nexport const Thread = {\n Root: ThreadRoot,\n Header: ThreadHeader,\n Status: ThreadStatus,\n};\n\nexport type { ThreadRootProps, ThreadHeaderProps, ThreadStatusProps };\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { formatDistanceToNow } from 'date-fns/formatDistanceToNow';\nimport React, { type ComponentPropsWithRef, type ComponentPropsWithoutRef, forwardRef } from 'react';\n\nimport { Avatar, type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { type UseTextEditorProps, useTextEditor } from '@dxos/react-ui-editor';\nimport { keymap, listener } from '@dxos/ui-editor';\nimport { focusRing, mx } from '@dxos/ui-theme';\nimport { hexToEmoji, hexToHue, isTruthy } from '@dxos/util';\n\nimport { translationKey } from '../translations';\nimport { type MessageMetadata } from '../types';\n\nconst avatarSize = 7;\n\nexport type MessageRootProps = ThemedClassName<\n ComponentPropsWithRef<'div'> & MessageMetadata & Partial<{ continues: boolean }>\n>;\n\n// TODO(burdon): Show authorName on tooltip.\nexport const MessageRoot = forwardRef<HTMLDivElement, MessageRootProps>(\n (\n { authorImgSrc, authorId, authorName, authorAvatarProps, continues = true, children, classNames, ...rootProps },\n forwardedRef,\n ) => {\n return (\n // Must wrap the message since Avatar.Label may be used in the content.\n <Avatar.Root>\n <div\n role='none'\n data-testid='thread.message'\n {...rootProps}\n className={mx('grid grid-cols-subgrid col-span-2', classNames)}\n ref={forwardedRef}\n >\n <div role='none' className='flex flex-col items-center gap-2 pt-1'>\n <Avatar.Content\n size={avatarSize}\n hue={authorAvatarProps?.hue || hexToHue(authorId ?? '0')}\n fallback={authorAvatarProps?.emoji || hexToEmoji(authorId ?? '0')}\n {...(authorImgSrc && { imgSrc: authorImgSrc })}\n />\n {continues && <div role='none' className='w-px grow bg-separator' />}\n </div>\n <div role='none' className='py-1 min-w-0'>\n {children}\n </div>\n </div>\n </Avatar.Root>\n );\n },\n);\n\nexport type MessageHeadingProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> &\n Pick<MessageMetadata, 'authorName' | 'timestamp'>;\n\nexport const MessageHeading = ({ children, classNames, timestamp, authorName, ...props }: MessageHeadingProps) => {\n return (\n <div role='none' {...props} className={mx('flex gap-2 items-start', classNames)}>\n <p className='grow'>\n <MessageAuthorName authorName={authorName} />\n {timestamp && <MessageTime timestamp={timestamp} />}\n </p>\n {children}\n </div>\n );\n};\n\nexport type MessageAuthorNameProps = Pick<MessageMetadata, 'authorName'>;\n\nexport const MessageAuthorName = ({ authorName }: MessageAuthorNameProps) => {\n const { t } = useTranslation(translationKey);\n return (\n <Avatar.Label classNames='block truncate text-sm text-subdued'>{authorName ?? t('anonymous label')}</Avatar.Label>\n );\n};\n\nexport type MessageTimeProps = Pick<MessageMetadata, 'timestamp'>;\n\nexport const MessageTime = ({ timestamp }: MessageTimeProps) => {\n const { dtLocale } = useTranslation(translationKey);\n const dt = timestamp ? new Date(timestamp) : undefined;\n return (\n <time className='block text-subdued text-xs pb-0.5' dateTime={dt?.toISOString()}>\n {dt ? formatDistanceToNow(dt, { locale: dtLocale, addSuffix: true }) : ''}\n </time>\n );\n};\n\nexport type MessageBodyProps = ComponentPropsWithoutRef<'p'>;\n\nexport const MessageBody = ({ children, ...props }: MessageBodyProps) => {\n return <p {...props}>{children}</p>;\n};\n\nexport type MessageTextboxProps = {\n disabled?: boolean;\n onSend?: () => void;\n onClear?: () => void;\n onEditorFocus?: () => void;\n} & MessageMetadata &\n UseTextEditorProps;\n\nconst keyBindings = ({ onSend, onClear }: Pick<MessageTextboxProps, 'onSend' | 'onClear'>) => [\n {\n key: 'Enter',\n run: () => {\n if (onSend) {\n onSend();\n return true;\n } else {\n return false;\n }\n },\n },\n {\n // TODO(burdon): Other key bindings.\n key: 'Meta+Backspace',\n run: () => {\n if (onClear) {\n onClear();\n return true;\n } else {\n return false;\n }\n },\n },\n];\n\nexport const MessageTextbox = ({\n id,\n authorId,\n authorName,\n authorImgSrc,\n authorAvatarProps,\n disabled,\n extensions,\n onSend,\n onClear,\n onEditorFocus,\n ...editorProps\n}: MessageTextboxProps) => {\n const { parentRef, focusAttributes } = useTextEditor(\n () => ({\n id,\n extensions: [\n keymap.of(keyBindings({ onSend, onClear })),\n listener({\n onFocus: ({ focusing }) => {\n if (focusing) {\n onEditorFocus?.();\n }\n },\n }),\n extensions,\n ].filter(isTruthy),\n ...editorProps,\n }),\n [id, extensions],\n );\n\n return (\n <MessageRoot {...{ id, authorId, authorName, authorImgSrc, authorAvatarProps }} continues={false}>\n <div\n role='none'\n ref={parentRef}\n className={mx('py-0.5 me-1 rounded-xs', focusRing, disabled && 'opacity-50')}\n {...focusAttributes}\n />\n </MessageRoot>\n );\n};\n"],
5
- "mappings": ";AAMO,IAAMA,iBAAiB;AAEvB,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACD,cAAAA,GAAiB;QAChB,eAAe;QACf,4BAA4B;QAC5B,sBAAsB;QACtB,uBAAuB;QACvB,uBAAuB;QACvB,uBAAuB;QACvB,uBAAuB;QACvB,6BAA6B;QAC7B,mBAAmB;QACnB,yBAAyB;MAC3B;IACF;EACF;;;;ACpBF,OAAOE,SAAqCC,kBAAkB;AAE9D,SAASC,MAA4BC,sBAAsB;AAC3D,SAASC,sBAAsBC,gCAAgCC,UAAU;AAMlE,IAAMC,eAAe;AAQ5B,IAAMC,aAAaC,2BACjB,CAAC,EAAEC,SAASC,UAAUC,YAAY,GAAGC,MAAAA,GAASC,iBAAAA;AAC5C,SACE,sBAAA,cAACC,OAAAA;IACCC,MAAK;IACLC,eAAY;IACX,GAAIP,WAAW;MAAE,gBAAgB,OAAOA,YAAY,WAAWA,UAAU;IAAW;IACpF,GAAGG;IACJK,WAAWC,GACTZ,cACAa,gCACA,sFACAR,UAAAA;IAEFS,KAAKP;KAEJH,QAAAA;AAGP,CAAA;AASF,IAAMW,eAAeb,2BACnB,CAAC,EAAEE,UAAUY,UAAU,GAAGV,MAAAA,GAASC,iBAAAA;AACjC,SACE,sBAAA,cAAA,MAAA,UAAA,MACE,sBAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOE,WAAU;KACzB,sBAAA,cAACM,MAAAA;IAAKC,MAAK;OAEb,sBAAA,cAACV,OAAAA;IAAIC,MAAK;IAAOE,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AAIZ;",
6
- "names": ["translationKey", "translations", "React", "forwardRef", "Icon", "useTranslation", "hoverableControlItem", "hoverableFocusedWithinControls", "mx", "threadLayout", "ThreadRoot", "forwardRef", "current", "children", "classNames", "props", "forwardedRef", "div", "role", "data-testid", "className", "mx", "hoverableFocusedWithinControls", "ref", "ThreadHeader", "detached", "Icon", "icon", "p", "ThreadStatus", "activity", "t", "useTranslation", "translationKey", "data-visible", "span", "aria-live", "hoverableControlItem", "Thread", "Root", "Header", "Status", "formatDistanceToNow", "React", "forwardRef", "Avatar", "useTranslation", "useTextEditor", "keymap", "listener", "focusRing", "mx", "hexToEmoji", "hexToHue", "isTruthy", "avatarSize", "MessageRoot", "forwardRef", "authorImgSrc", "authorId", "authorName", "authorAvatarProps", "continues", "children", "classNames", "rootProps", "forwardedRef", "React", "Avatar", "Root", "div", "role", "data-testid", "className", "mx", "ref", "Content", "size", "hue", "hexToHue", "fallback", "emoji", "hexToEmoji", "imgSrc", "MessageHeading", "timestamp", "props", "p", "MessageAuthorName", "MessageTime", "t", "useTranslation", "translationKey", "Label", "dtLocale", "dt", "Date", "undefined", "time", "dateTime", "toISOString", "formatDistanceToNow", "locale", "addSuffix", "MessageBody", "keyBindings", "onSend", "onClear", "key", "run", "MessageTextbox", "id", "disabled", "extensions", "onEditorFocus", "editorProps", "parentRef", "focusAttributes", "useTextEditor", "keymap", "of", "listener", "onFocus", "focusing", "filter", "isTruthy", "focusRing"]
3
+ "sources": ["../../../src/Thread/Thread.tsx", "../../../src/Message/Message.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { ComponentPropsWithRef, forwardRef, PropsWithChildren } from 'react';\n\nimport { Icon, type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { hoverableControlItem, hoverableFocusedWithinControls, mx } from '@dxos/ui-theme';\n\nimport { translationKey } from '#translations';\n\nimport type { ThreadEntity } from '../types';\n\n// TODO(burdon): Avoid exporting fragments.\nexport const threadLayout = 'w-full place-self-start grid grid-cols-[var(--dx-rail-size)_1fr]';\n\n//\n// Root\n//\n\ntype ThreadRootProps = ThemedClassName<\n PropsWithChildren<\n ThreadEntity & { current?: boolean } & Pick<ComponentPropsWithRef<'div'>, 'onClickCapture' | 'onFocusCapture'>\n >\n>;\n\nconst ThreadRoot = forwardRef<HTMLDivElement, ThreadRootProps>(\n ({ current, children, classNames, ...props }, forwardedRef) => {\n return (\n <div\n role='group'\n data-testid='thread'\n {...(current && { 'aria-current': typeof current === 'string' ? current : 'location' })}\n {...props}\n className={mx(\n threadLayout,\n hoverableFocusedWithinControls,\n 'bg-[var(--surface-bg)] current-related dx-attention-surface [--controls-opacity:0]',\n classNames,\n )}\n ref={forwardedRef}\n >\n {children}\n </div>\n );\n },\n);\n\n//\n// Heading\n//\n\ntype ThreadHeaderProps = PropsWithChildren<{ detached?: boolean }>;\n\nconst ThreadHeader = forwardRef<HTMLParagraphElement, ThreadHeaderProps>(\n ({ children, detached, ...props }, forwardedRef) => {\n return (\n <>\n <div className='flex items-center justify-center text-description'>\n <Icon icon='ph--caret-double-right--regular' />\n </div>\n <div className='flex items-center overflow-hidden'>\n <p\n role='heading'\n data-testid='thread.heading'\n {...props}\n className={mx('me-2 text-description font-medium truncate italic', detached && 'line-through decoration-1')}\n ref={forwardedRef}\n >\n {children}\n </p>\n </div>\n </>\n );\n },\n);\n\n//\n// Status\n//\n\ntype ThreadStatusProps = ThemedClassName<PropsWithChildren> & {\n activity?: boolean;\n};\n\nconst ThreadStatus = forwardRef<HTMLDivElement, ThreadStatusProps>(\n ({ activity, classNames, children, ...props }, forwardedRef) => {\n const { t } = useTranslation(translationKey);\n return (\n <div\n {...props}\n className={mx(\n 'col-start-2 grid grid-cols-[min-content_1fr_max-content] pb-2 pe-2 text-xs text-description',\n classNames,\n )}\n ref={forwardedRef}\n >\n <Icon\n icon='ph--spinner--bold'\n classNames='w-6 h-4 invisible data-[visible=show]:visible animate-spin-slow'\n data-visible={activity ? 'show' : 'hide'}\n />\n <span className='truncate min-w-0' aria-live='polite'>\n {activity ? children : null}\n </span>\n <span className={mx('text-end', hoverableControlItem)}>{t('enter-to-send.message')}</span>\n </div>\n );\n },\n);\n\nexport const Thread = {\n Root: ThreadRoot,\n Header: ThreadHeader,\n Status: ThreadStatus,\n};\n\nexport type { ThreadRootProps, ThreadHeaderProps, ThreadStatusProps };\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { formatDistanceToNow } from 'date-fns/formatDistanceToNow';\nimport React, { type ComponentPropsWithRef, type ComponentPropsWithoutRef, forwardRef } from 'react';\n\nimport { Avatar, type ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { type UseTextEditorProps, useTextEditor } from '@dxos/react-ui-editor';\nimport { keymap, listener } from '@dxos/ui-editor';\nimport { mx } from '@dxos/ui-theme';\nimport { hexToEmoji, hexToHue, isTruthy } from '@dxos/util';\n\nimport { translationKey } from '#translations';\n\nimport { type MessageMetadata } from '../types';\n\nconst avatarSize = 7;\n\nexport type MessageRootProps = ThemedClassName<\n ComponentPropsWithRef<'div'> & MessageMetadata & Partial<{ continues: boolean }>\n>;\n\n// TODO(burdon): Show authorName on tooltip.\nexport const MessageRoot = forwardRef<HTMLDivElement, MessageRootProps>(\n (\n { authorImgSrc, authorId, authorName, authorAvatarProps, continues = true, children, classNames, ...rootProps },\n forwardedRef,\n ) => {\n // Must wrap the message since Avatar.Label may be used in the content.\n return (\n <Avatar.Root>\n <div\n data-testid='thread.message'\n {...rootProps}\n className={mx('grid grid-cols-subgrid col-span-2', classNames)}\n ref={forwardedRef}\n >\n <div className='flex flex-col items-center gap-2 pt-1'>\n <Avatar.Content\n size={avatarSize}\n hue={authorAvatarProps?.hue || hexToHue(authorId ?? '0')}\n fallback={authorAvatarProps?.emoji || hexToEmoji(authorId ?? '0')}\n {...(authorImgSrc && { imgSrc: authorImgSrc })}\n />\n {continues && <div className='w-px grow bg-separator' />}\n </div>\n <div className='py-1 min-w-0'>{children}</div>\n </div>\n </Avatar.Root>\n );\n },\n);\n\nexport type MessageHeadingProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> &\n Pick<MessageMetadata, 'authorName' | 'timestamp'>;\n\nexport const MessageHeading = ({ children, classNames, timestamp, authorName, ...props }: MessageHeadingProps) => {\n return (\n <div {...props} className={mx('flex gap-2 items-start', classNames)}>\n <p className='grow'>\n <MessageAuthorName authorName={authorName} />\n {timestamp && <MessageTime timestamp={timestamp} />}\n </p>\n {children}\n </div>\n );\n};\n\nexport type MessageAuthorNameProps = Pick<MessageMetadata, 'authorName'>;\n\nexport const MessageAuthorName = ({ authorName }: MessageAuthorNameProps) => {\n const { t } = useTranslation(translationKey);\n return (\n <Avatar.Label classNames='block truncate text-sm text-subdued'>{authorName ?? t('anonymous.label')}</Avatar.Label>\n );\n};\n\nexport type MessageTimeProps = Pick<MessageMetadata, 'timestamp'>;\n\nexport const MessageTime = ({ timestamp }: MessageTimeProps) => {\n const { dtLocale } = useTranslation(translationKey);\n const dt = timestamp ? new Date(timestamp) : undefined;\n return (\n <time className='block text-subdued text-xs pb-0.5' dateTime={dt?.toISOString()}>\n {dt ? formatDistanceToNow(dt, { locale: dtLocale, addSuffix: true }) : ''}\n </time>\n );\n};\n\nexport type MessageBodyProps = ComponentPropsWithoutRef<'p'>;\n\nexport const MessageBody = ({ children, ...props }: MessageBodyProps) => {\n return <p {...props}>{children}</p>;\n};\n\nexport type MessageTextboxProps = {\n disabled?: boolean;\n onSend?: () => void;\n onClear?: () => void;\n onEditorFocus?: () => void;\n} & MessageMetadata &\n UseTextEditorProps;\n\nconst keyBindings = ({ onSend, onClear }: Pick<MessageTextboxProps, 'onSend' | 'onClear'>) => [\n {\n key: 'Enter',\n run: () => {\n if (onSend) {\n onSend();\n return true;\n } else {\n return false;\n }\n },\n },\n {\n // TODO(burdon): Other key bindings.\n key: 'Meta+Backspace',\n run: () => {\n if (onClear) {\n onClear();\n return true;\n } else {\n return false;\n }\n },\n },\n];\n\nexport const MessageTextbox = ({\n id,\n authorId,\n authorName,\n authorImgSrc,\n authorAvatarProps,\n disabled,\n extensions,\n onSend,\n onClear,\n onEditorFocus,\n ...editorProps\n}: MessageTextboxProps) => {\n const { parentRef, focusAttributes } = useTextEditor(\n () => ({\n id,\n extensions: [\n keymap.of(keyBindings({ onSend, onClear })),\n listener({\n onFocus: ({ focusing }) => {\n if (focusing) {\n onEditorFocus?.();\n }\n },\n }),\n extensions,\n ].filter(isTruthy),\n ...editorProps,\n }),\n [id, extensions],\n );\n\n return (\n <MessageRoot {...{ id, authorId, authorName, authorImgSrc, authorAvatarProps }} continues={false}>\n <div\n ref={parentRef}\n className={mx('py-0.5 me-1 rounded-xs dx-focus-ring', disabled && 'opacity-50')}\n {...focusAttributes}\n />\n </MessageRoot>\n );\n};\n"],
5
+ "mappings": ";AAIA,OAAOA,SAAgCC,kBAAqC;AAE5E,SAASC,MAA4BC,sBAAsB;AAC3D,SAASC,sBAAsBC,gCAAgCC,UAAU;AAEzE,SAASC,sBAAsB;AAKxB,IAAMC,eAAe;AAY5B,IAAMC,aAAaR,2BACjB,CAAC,EAAES,SAASC,UAAUC,YAAY,GAAGC,MAAAA,GAASC,iBAAAA;AAC5C,SACE,sBAAA,cAACC,OAAAA;IACCC,MAAK;IACLC,eAAY;IACX,GAAIP,WAAW;MAAE,gBAAgB,OAAOA,YAAY,WAAWA,UAAU;IAAW;IACpF,GAAGG;IACJK,WAAWZ,GACTE,cACAH,gCACA,sFACAO,UAAAA;IAEFO,KAAKL;KAEJH,QAAAA;AAGP,CAAA;AASF,IAAMS,eAAenB,2BACnB,CAAC,EAAEU,UAAUU,UAAU,GAAGR,MAAAA,GAASC,iBAAAA;AACjC,SACE,sBAAA,cAAA,MAAA,UAAA,MACE,sBAAA,cAACC,OAAAA;IAAIG,WAAU;KACb,sBAAA,cAAChB,MAAAA;IAAKoB,MAAK;OAEb,sBAAA,cAACP,OAAAA;IAAIG,WAAU;KACb,sBAAA,cAACK,KAAAA;IACCP,MAAK;IACLC,eAAY;IACX,GAAG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,oBAAoB4C,IAAI;IAAEM,QAAQP;IAAUQ,WAAW;EAAK,CAAA,IAAK,EAAA;AAG7E;AAIO,IAAMC,cAAc,CAAC,EAAEhC,UAAU,GAAGiB,MAAAA,MAAyB;AAClE,SAAO,gBAAApC,OAAA,cAACqC,KAAMD,OAAQjB,QAAAA;AACxB;AAUA,IAAMiC,cAAc,CAAC,EAAEC,QAAQC,QAAO,MAAwD;EAC5F;IACEC,KAAK;IACLC,KAAK,MAAA;AACH,UAAIH,QAAQ;AACVA,eAAAA;AACA,eAAO;MACT,OAAO;AACL,eAAO;MACT;IACF;EACF;EACA;;IAEEE,KAAK;IACLC,KAAK,MAAA;AACH,UAAIF,SAAS;AACXA,gBAAAA;AACA,eAAO;MACT,OAAO;AACL,eAAO;MACT;IACF;EACF;;AAGK,IAAMG,iBAAiB,CAAC,EAC7BC,IACA3C,UACAC,YACAF,cACAG,mBACA0C,UACAC,YACAP,QACAC,SACAO,eACA,GAAGC,YAAAA,MACiB;AACpB,QAAM,EAAEC,WAAWC,gBAAe,IAAK5D,cACrC,OAAO;IACLsD;IACAE,YAAY;MACVvD,OAAO4D,GAAGb,YAAY;QAAEC;QAAQC;MAAQ,CAAA,CAAA;MACxChD,SAAS;QACP4D,SAAS,CAAC,EAAEC,SAAQ,MAAE;AACpB,cAAIA,UAAU;AACZN,4BAAAA;UACF;QACF;MACF,CAAA;MACAD;MACAQ,OAAO1D,QAAAA;IACT,GAAGoD;EACL,IACA;IAACJ;IAAIE;GAAW;AAGlB,SACE,gBAAA5D,OAAA,cAACa,aAAAA;IAAkB6C;IAAI3C;IAAUC;IAAYF;IAAcG;IAAqBC,WAAW;KACzF,gBAAAlB,OAAA,cAACwB,OAAAA;IACCG,KAAKoC;IACLrC,WAAWnB,IAAG,wCAAwCoD,YAAY,YAAA;IACjE,GAAGK;;AAIZ;",
6
+ "names": ["React", "forwardRef", "Icon", "useTranslation", "hoverableControlItem", "hoverableFocusedWithinControls", "mx", "translationKey", "threadLayout", "ThreadRoot", "current", "children", "classNames", "props", "forwardedRef", "div", "role", "data-testid", "className", "ref", "ThreadHeader", "detached", "icon", "p", "ThreadStatus", "activity", "t", "data-visible", "span", "aria-live", "Thread", "Root", "Header", "Status", "formatDistanceToNow", "React", "forwardRef", "Avatar", "useTranslation", "useTextEditor", "keymap", "listener", "mx", "hexToEmoji", "hexToHue", "isTruthy", "translationKey", "avatarSize", "MessageRoot", "authorImgSrc", "authorId", "authorName", "authorAvatarProps", "continues", "children", "classNames", "rootProps", "forwardedRef", "Root", "div", "data-testid", "className", "ref", "Content", "size", "hue", "fallback", "emoji", "imgSrc", "MessageHeading", "timestamp", "props", "p", "MessageAuthorName", "MessageTime", "t", "Label", "dtLocale", "dt", "Date", "undefined", "time", "dateTime", "toISOString", "locale", "addSuffix", "MessageBody", "keyBindings", "onSend", "onClear", "key", "run", "MessageTextbox", "id", "disabled", "extensions", "onEditorFocus", "editorProps", "parentRef", "focusAttributes", "of", "onFocus", "focusing", "filter"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/translations.ts":{"bytes":2480,"imports":[],"format":"esm"},"src/Thread/Thread.tsx":{"bytes":9688,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"src/translations.ts","kind":"import-statement","original":"../translations"}],"format":"esm"},"src/Thread/index.ts":{"bytes":459,"imports":[{"path":"src/Thread/Thread.tsx","kind":"import-statement","original":"./Thread"}],"format":"esm"},"src/Message/Message.tsx":{"bytes":16715,"imports":[{"path":"date-fns/formatDistanceToNow","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-editor","kind":"import-statement","external":true},{"path":"@dxos/ui-editor","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/translations.ts","kind":"import-statement","original":"../translations"}],"format":"esm"},"src/Message/index.ts":{"bytes":461,"imports":[{"path":"src/Message/Message.tsx","kind":"import-statement","original":"./Message"}],"format":"esm"},"src/index.ts":{"bytes":839,"imports":[{"path":"src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"src/Thread/index.ts","kind":"import-statement","original":"./Thread"},{"path":"src/Message/index.ts","kind":"import-statement","original":"./Message"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":15208},"dist/lib/browser/index.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"date-fns/formatDistanceToNow","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-editor","kind":"import-statement","external":true},{"path":"@dxos/ui-editor","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["MessageAuthorName","MessageBody","MessageHeading","MessageRoot","MessageTextbox","MessageTime","Thread","threadLayout","translations"],"entryPoint":"src/index.ts","inputs":{"src/translations.ts":{"bytesInOutput":616},"src/Thread/Thread.tsx":{"bytesInOutput":2549},"src/index.ts":{"bytesInOutput":0},"src/Message/Message.tsx":{"bytesInOutput":4253}},"bytes":7685}}}
1
+ {"inputs":{"src/Thread/Thread.tsx":{"bytes":9583,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"#translations","kind":"import-statement","external":true}],"format":"esm"},"src/Thread/index.ts":{"bytes":370,"imports":[{"path":"src/Thread/Thread.tsx","kind":"import-statement","original":"./Thread"}],"format":"esm"},"src/Message/Message.tsx":{"bytes":16171,"imports":[{"path":"date-fns/formatDistanceToNow","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-editor","kind":"import-statement","external":true},{"path":"@dxos/ui-editor","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"#translations","kind":"import-statement","external":true}],"format":"esm"},"src/Message/index.ts":{"bytes":375,"imports":[{"path":"src/Message/Message.tsx","kind":"import-statement","original":"./Message"}],"format":"esm"},"src/index.ts":{"bytes":497,"imports":[{"path":"src/Thread/index.ts","kind":"import-statement","original":"./Thread"},{"path":"src/Message/index.ts","kind":"import-statement","original":"./Message"}],"format":"esm"},"src/translations.ts":{"bytes":2395,"imports":[],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":13727},"dist/lib/browser/index.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"#translations","kind":"import-statement","external":true},{"path":"date-fns/formatDistanceToNow","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-editor","kind":"import-statement","external":true},{"path":"@dxos/ui-editor","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"#translations","kind":"import-statement","external":true}],"exports":["MessageAuthorName","MessageBody","MessageHeading","MessageRoot","MessageTextbox","MessageTime","Thread","threadLayout"],"entryPoint":"src/index.ts","inputs":{"src/Thread/Thread.tsx":{"bytesInOutput":2561},"src/index.ts":{"bytesInOutput":0},"src/Message/Message.tsx":{"bytesInOutput":4076}},"bytes":6864},"dist/lib/browser/translations.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1151},"dist/lib/browser/translations.mjs":{"imports":[],"exports":["translationKey","translations"],"entryPoint":"src/translations.ts","inputs":{"src/translations.ts":{"bytesInOutput":616}},"bytes":726}}}
@@ -0,0 +1,25 @@
1
+ // src/translations.ts
2
+ var translationKey = "@dxos/react-ui-thread";
3
+ var translations = [
4
+ {
5
+ "en-US": {
6
+ [translationKey]: {
7
+ "plugin.name": "Threads",
8
+ "thread-title.placeholder": "New thread",
9
+ "thread-title.label": "Title",
10
+ "delete-thread.label": "Delete",
11
+ "create-thread.label": "Create thread",
12
+ "message.placeholder": "Enter message...",
13
+ "comment.placeholder": "Enter comment...",
14
+ "settings-standalone.label": "Enable standalone thread creation",
15
+ "anonymous.label": "Anonymous",
16
+ "enter-to-send.message": "Enter to add \u23CE"
17
+ }
18
+ }
19
+ }
20
+ ];
21
+ export {
22
+ translationKey,
23
+ translations
24
+ };
25
+ //# sourceMappingURL=translations.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/translations.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\n\nexport const translationKey = '@dxos/react-ui-thread';\n\nexport const translations = [\n {\n 'en-US': {\n [translationKey]: {\n 'plugin.name': 'Threads',\n 'thread-title.placeholder': 'New thread',\n 'thread-title.label': 'Title',\n 'delete-thread.label': 'Delete',\n 'create-thread.label': 'Create thread',\n 'message.placeholder': 'Enter message...',\n 'comment.placeholder': 'Enter comment...',\n 'settings-standalone.label': 'Enable standalone thread creation',\n 'anonymous.label': 'Anonymous',\n 'enter-to-send.message': 'Enter to add ⏎',\n },\n },\n },\n] as const satisfies Resource[];\n"],
5
+ "mappings": ";AAMO,IAAMA,iBAAiB;AAEvB,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACD,cAAAA,GAAiB;QAChB,eAAe;QACf,4BAA4B;QAC5B,sBAAsB;QACtB,uBAAuB;QACvB,uBAAuB;QACvB,uBAAuB;QACvB,uBAAuB;QACvB,6BAA6B;QAC7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CAAC;AAElE,eAAO,MAAM,WAAW,kBAAmB,gBAAgB,sBAQ1D,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,GAAG,CAAC,CAAC;AAE7D,eAAO,MAAM,WAAW,2BAA4B,gBAAgB,sBAEnE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B,GAAG,eAAe,GACjB,kBAAkB,CAAC;AA4BrB,eAAO,MAAM,cAAc,wIAYxB,mBAAmB,sBA6BrB,CAAC"}
@@ -10,16 +10,16 @@ declare const meta: {
10
10
  translations: [{
11
11
  readonly 'en-US': {
12
12
  readonly "@dxos/react-ui-thread": {
13
- readonly 'plugin name': "Threads";
14
- readonly 'thread title placeholder': "New thread";
15
- readonly 'thread title label': "Title";
16
- readonly 'delete thread label': "Delete";
17
- readonly 'create thread label': "Create thread";
18
- readonly 'message placeholder': "Enter message...";
19
- readonly 'comment placeholder': "Enter comment...";
20
- readonly 'settings standalone label': "Enable standalone thread creation";
21
- readonly 'anonymous label': "Anonymous";
22
- readonly 'enter to send message': "Enter to add ⏎";
13
+ readonly 'plugin.name': 'Threads';
14
+ readonly 'thread-title.placeholder': 'New thread';
15
+ readonly 'thread-title.label': 'Title';
16
+ readonly 'delete-thread.label': 'Delete';
17
+ readonly 'create-thread.label': 'Create thread';
18
+ readonly 'message.placeholder': 'Enter message...';
19
+ readonly 'comment.placeholder': 'Enter comment...';
20
+ readonly 'settings-standalone.label': 'Enable standalone thread creation';
21
+ readonly 'anonymous.label': 'Anonymous';
22
+ readonly 'enter-to-send.message': 'Enter to add \u23CE';
23
23
  };
24
24
  };
25
25
  }];
@@ -1 +1 @@
1
- {"version":3,"file":"Message.stories.d.ts","sourceRoot":"","sources":["../../../../src/Message/Message.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAgCxC,QAAA,MAAM,IAAI;;eAEkB,GAAG;;;;;;;;;;;;;;;;;;;;;;CAOM,CAAC;AAEtC,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
1
+ {"version":3,"file":"Message.stories.d.ts","sourceRoot":"","sources":["../../../../src/Message/Message.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAgCxC,QAAA,MAAM,IAAI;;eAEkB,GAAG;;;;;;;;;;;;;;;;;;;;;;CAOM,CAAC;eAEvB,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
@@ -1,28 +1,28 @@
1
1
  import { type StoryObj } from '@storybook/react-vite';
2
2
  import React from 'react';
3
- type StoryProps = {
3
+ type DefaultStoryProps = {
4
4
  text?: string;
5
5
  autoCreate?: boolean;
6
6
  };
7
7
  declare const meta: {
8
8
  title: string;
9
9
  component: any;
10
- render: ({ text, autoCreate }: StoryProps) => React.JSX.Element;
10
+ render: ({ text, autoCreate }: DefaultStoryProps) => React.JSX.Element;
11
11
  decorators: import("@storybook/react").Decorator[];
12
12
  parameters: {
13
13
  translations: [{
14
14
  readonly 'en-US': {
15
15
  readonly "@dxos/react-ui-thread": {
16
- readonly 'plugin name': "Threads";
17
- readonly 'thread title placeholder': "New thread";
18
- readonly 'thread title label': "Title";
19
- readonly 'delete thread label': "Delete";
20
- readonly 'create thread label': "Create thread";
21
- readonly 'message placeholder': "Enter message...";
22
- readonly 'comment placeholder': "Enter comment...";
23
- readonly 'settings standalone label': "Enable standalone thread creation";
24
- readonly 'anonymous label': "Anonymous";
25
- readonly 'enter to send message': "Enter to add ⏎";
16
+ readonly 'plugin.name': 'Threads';
17
+ readonly 'thread-title.placeholder': 'New thread';
18
+ readonly 'thread-title.label': 'Title';
19
+ readonly 'delete-thread.label': 'Delete';
20
+ readonly 'create-thread.label': 'Create thread';
21
+ readonly 'message.placeholder': 'Enter message...';
22
+ readonly 'comment.placeholder': 'Enter comment...';
23
+ readonly 'settings-standalone.label': 'Enable standalone thread creation';
24
+ readonly 'anonymous.label': 'Anonymous';
25
+ readonly 'enter-to-send.message': 'Enter to add \u23CE';
26
26
  };
27
27
  };
28
28
  }];
@@ -1 +1 @@
1
- {"version":3,"file":"Comments.stories.d.ts","sourceRoot":"","sources":["../../../../src/Thread/Comments.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAwD,MAAM,OAAO,CAAC;AAyP7E,KAAK,UAAU,GAAG;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAuHF,QAAA,MAAM,IAAI;;eAEkB,GAAG;mCAvHa,UAAU;;;;;;;;;;;;;;;;;;;;;CA8HjB,CAAC;AAEtC,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAInC,eAAO,MAAM,OAAO,EAAE,KASrB,CAAC"}
1
+ {"version":3,"file":"Comments.stories.d.ts","sourceRoot":"","sources":["../../../../src/Thread/Comments.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAwD,MAAM,OAAO,CAAC;AAwP7E,KAAK,iBAAiB,GAAG;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAuHF,QAAA,MAAM,IAAI;;eAEkB,GAAG;mCAvHa,iBAAiB;;;;;;;;;;;;;;;;;;;;;CA8HxB,CAAC;eAEvB,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAInC,eAAO,MAAM,OAAO,EAAE,KASrB,CAAC"}
@@ -1,20 +1,34 @@
1
- import React, { type ComponentPropsWithRef } from 'react';
1
+ import React, { ComponentPropsWithRef, PropsWithChildren } from 'react';
2
2
  import { type ThemedClassName } from '@dxos/react-ui';
3
3
  import type { ThreadEntity } from '../types';
4
4
  export declare const threadLayout = "w-full place-self-start grid grid-cols-[var(--dx-rail-size)_1fr]";
5
- type ThreadRootProps = ThemedClassName<ComponentPropsWithRef<'div'>> & ThreadEntity & {
5
+ type ThreadRootProps = ThemedClassName<PropsWithChildren<ThreadEntity & {
6
6
  current?: boolean;
7
- };
8
- type ThreadHeaderProps = ComponentPropsWithRef<'div'> & {
7
+ } & Pick<ComponentPropsWithRef<'div'>, 'onClickCapture' | 'onFocusCapture'>>>;
8
+ type ThreadHeaderProps = PropsWithChildren<{
9
9
  detached?: boolean;
10
- };
11
- type ThreadStatusProps = ThemedClassName<ComponentPropsWithRef<'div'>> & {
10
+ }>;
11
+ type ThreadStatusProps = ThemedClassName<PropsWithChildren> & {
12
12
  activity?: boolean;
13
13
  };
14
14
  export declare const Thread: {
15
- Root: React.ForwardRefExoticComponent<Omit<ThreadRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
16
- Header: React.ForwardRefExoticComponent<Omit<ThreadHeaderProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
17
- Status: React.ForwardRefExoticComponent<Omit<ThreadStatusProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
15
+ Root: React.ForwardRefExoticComponent<Omit<PropsWithChildren<ThreadEntity & {
16
+ current?: boolean;
17
+ } & Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "onClickCapture" | "onFocusCapture">>, "className"> & {
18
+ classNames?: import("@dxos/ui-types").ClassNameValue;
19
+ } & React.RefAttributes<HTMLDivElement>>;
20
+ Header: React.ForwardRefExoticComponent<{
21
+ detached?: boolean;
22
+ } & {
23
+ children?: React.ReactNode | undefined;
24
+ } & React.RefAttributes<HTMLParagraphElement>>;
25
+ Status: React.ForwardRefExoticComponent<Omit<{
26
+ children?: React.ReactNode | undefined;
27
+ }, "className"> & {
28
+ classNames?: import("@dxos/ui-types").ClassNameValue;
29
+ } & {
30
+ activity?: boolean;
31
+ } & React.RefAttributes<HTMLDivElement>>;
18
32
  };
19
33
  export type { ThreadRootProps, ThreadHeaderProps, ThreadStatusProps };
20
34
  //# sourceMappingURL=Thread.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Thread.d.ts","sourceRoot":"","sources":["../../../../src/Thread/Thread.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,KAAK,qBAAqB,EAAc,MAAM,OAAO,CAAC;AAEtE,OAAO,EAAQ,KAAK,eAAe,EAAkB,MAAM,gBAAgB,CAAC;AAI5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG7C,eAAO,MAAM,YAAY,qEAAqE,CAAC;AAM/F,KAAK,eAAe,GAAG,eAAe,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,GAAG,YAAY,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AA4B5G,KAAK,iBAAiB,GAAG,qBAAqB,CAAC,KAAK,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AA6B/E,KAAK,iBAAiB,GAAG,eAAe,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,GAAG;IACvE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AA4BF,eAAO,MAAM,MAAM;;;;CAIlB,CAAC;AAEF,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"Thread.d.ts","sourceRoot":"","sources":["../../../../src/Thread/Thread.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,qBAAqB,EAAc,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEpF,OAAO,EAAQ,KAAK,eAAe,EAAkB,MAAM,gBAAgB,CAAC;AAK5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG7C,eAAO,MAAM,YAAY,qEAAqE,CAAC;AAM/F,KAAK,eAAe,GAAG,eAAe,CACpC,iBAAiB,CACf,YAAY,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,CAAC,CAC/G,CACF,CAAC;AA4BF,KAAK,iBAAiB,GAAG,iBAAiB,CAAC;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AA6BnE,KAAK,iBAAiB,GAAG,eAAe,CAAC,iBAAiB,CAAC,GAAG;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AA4BF,eAAO,MAAM,MAAM;IACjB,IAAI;kBA1FyB,OAAO;;;;IA2FpC,MAAM;mBA7DgD,OAAO;;;;IA8D7D,MAAM;;;;;mBAhCK,OAAO;;CAiCnB,CAAC;AAEF,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,CAAC"}
@@ -2,7 +2,11 @@ import { type StoryObj } from '@storybook/react-vite';
2
2
  import React from 'react';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: React.ForwardRefExoticComponent<Omit<import("./Thread").ThreadRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
+ component: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<import("..").ThreadEntity & {
6
+ current?: boolean;
7
+ } & Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "onClickCapture" | "onFocusCapture">>, "className"> & {
8
+ classNames?: import("@dxos/ui-types").ClassNameValue;
9
+ } & React.RefAttributes<HTMLDivElement>>;
6
10
  render: () => React.JSX.Element;
7
11
  decorators: import("@storybook/react").Decorator[];
8
12
  parameters: {
@@ -10,16 +14,16 @@ declare const meta: {
10
14
  translations: [{
11
15
  readonly 'en-US': {
12
16
  readonly "@dxos/react-ui-thread": {
13
- readonly 'plugin name': "Threads";
14
- readonly 'thread title placeholder': "New thread";
15
- readonly 'thread title label': "Title";
16
- readonly 'delete thread label': "Delete";
17
- readonly 'create thread label': "Create thread";
18
- readonly 'message placeholder': "Enter message...";
19
- readonly 'comment placeholder': "Enter comment...";
20
- readonly 'settings standalone label': "Enable standalone thread creation";
21
- readonly 'anonymous label': "Anonymous";
22
- readonly 'enter to send message': "Enter to add ⏎";
17
+ readonly 'plugin.name': 'Threads';
18
+ readonly 'thread-title.placeholder': 'New thread';
19
+ readonly 'thread-title.label': 'Title';
20
+ readonly 'delete-thread.label': 'Delete';
21
+ readonly 'create-thread.label': 'Create thread';
22
+ readonly 'message.placeholder': 'Enter message...';
23
+ readonly 'comment.placeholder': 'Enter comment...';
24
+ readonly 'settings-standalone.label': 'Enable standalone thread creation';
25
+ readonly 'anonymous.label': 'Anonymous';
26
+ readonly 'enter-to-send.message': 'Enter to add \u23CE';
23
27
  };
24
28
  };
25
29
  }];
@@ -1 +1 @@
1
- {"version":3,"file":"Thread.stories.d.ts","sourceRoot":"","sources":["../../../../src/Thread/Thread.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAoC,MAAM,OAAO,CAAC;AA8EzD,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;CAS0B,CAAC;AAErC,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
1
+ {"version":3,"file":"Thread.stories.d.ts","sourceRoot":"","sources":["../../../../src/Thread/Thread.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAoC,MAAM,OAAO,CAAC;AA8EzD,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAS0B,CAAC;eAEtB,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
@@ -1,6 +1,4 @@
1
- import { translations } from './translations';
2
1
  export * from './Thread';
3
2
  export * from './Message';
4
3
  export type * from './types';
5
- export { translations };
6
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,mBAAmB,SAAS,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,mBAAmB,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../src/testing.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,MAAM,aAAa,CAAC,SAAS,GAAG,GAAG,IAAI,eAAe,GAAG;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,2CAA2C,gBAAgB,sBAkB3F,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,SAAS,IAAI;IACxC,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,SAAS,EAAG,UAAU,gBAAgB,CAAC,SAAS,CAAC,sBAWlF,CAAC"}
1
+ {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../src/testing.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,MAAM,aAAa,CAAC,SAAS,GAAG,GAAG,IAAI,eAAe,GAAG;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,8CAA+C,gBAAgB,sBAkB3F,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,SAAS,IAAI;IACxC,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,SAAS,YAAa,gBAAgB,CAAC,SAAS,CAAC,sBAQlF,CAAC"}
@@ -2,16 +2,16 @@ export declare const translationKey = "@dxos/react-ui-thread";
2
2
  export declare const translations: [{
3
3
  readonly 'en-US': {
4
4
  readonly "@dxos/react-ui-thread": {
5
- readonly 'plugin name': "Threads";
6
- readonly 'thread title placeholder': "New thread";
7
- readonly 'thread title label': "Title";
8
- readonly 'delete thread label': "Delete";
9
- readonly 'create thread label': "Create thread";
10
- readonly 'message placeholder': "Enter message...";
11
- readonly 'comment placeholder': "Enter comment...";
12
- readonly 'settings standalone label': "Enable standalone thread creation";
13
- readonly 'anonymous label': "Anonymous";
14
- readonly 'enter to send message': "Enter to add ⏎";
5
+ readonly 'plugin.name': 'Threads';
6
+ readonly 'thread-title.placeholder': 'New thread';
7
+ readonly 'thread-title.label': 'Title';
8
+ readonly 'delete-thread.label': 'Delete';
9
+ readonly 'create-thread.label': 'Create thread';
10
+ readonly 'message.placeholder': 'Enter message...';
11
+ readonly 'comment.placeholder': 'Enter comment...';
12
+ readonly 'settings-standalone.label': 'Enable standalone thread creation';
13
+ readonly 'anonymous.label': 'Anonymous';
14
+ readonly 'enter-to-send.message': 'Enter to add \u23CE';
15
15
  };
16
16
  };
17
17
  }];
@@ -1 +1 @@
1
- {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,0BAA0B,CAAC;AAEtD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;EAiBM,CAAC"}
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,0BAA0B,CAAC;AAEtD,eAAO,MAAM,YAAY;;;qBAIjB,aAAa,EAAE,SAAS;qBACxB,0BAA0B,EAAE,YAAY;qBACxC,oBAAoB,EAAE,OAAO;qBAC7B,qBAAqB,EAAE,QAAQ;qBAC/B,qBAAqB,EAAE,eAAe;qBACtC,qBAAqB,EAAE,kBAAkB;qBACzC,qBAAqB,EAAE,kBAAkB;qBACzC,2BAA2B,EAAE,mCAAmC;qBAChE,iBAAiB,EAAE,WAAW;qBAC9B,uBAAuB,EAAE,qBAAgB;;;EAIlB,CAAC"}
@@ -8,6 +8,7 @@ export type MessageMetadata = {
8
8
  authorAvatarProps?: FallbackValue;
9
9
  };
10
10
  export type ThreadEntity = {
11
+ id?: string;
11
12
  topicId?: string;
12
13
  topicTitle?: string;
13
14
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAIhD,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,aAAa,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAIhD,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,aAAa,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC"}