@cossistant/react 0.0.32 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/hooks/index.d.ts +2 -2
- package/hooks/index.js +2 -2
- package/hooks/private/store/use-store-selector.d.ts.map +1 -1
- package/hooks/private/store/use-store-selector.js +8 -4
- package/hooks/private/store/use-store-selector.js.map +1 -1
- package/hooks/private/use-client-query.js +5 -2
- package/hooks/private/use-client-query.js.map +1 -1
- package/hooks/private/use-grouped-messages.d.ts +27 -2
- package/hooks/private/use-grouped-messages.d.ts.map +1 -1
- package/hooks/private/use-grouped-messages.js +154 -106
- package/hooks/private/use-grouped-messages.js.map +1 -1
- package/hooks/private/use-rest-client.js +2 -1
- package/hooks/private/use-rest-client.js.map +1 -1
- package/hooks/use-conversation-auto-seen.d.ts.map +1 -1
- package/hooks/use-conversation-auto-seen.js +9 -3
- package/hooks/use-conversation-auto-seen.js.map +1 -1
- package/hooks/use-conversation-page.d.ts.map +1 -1
- package/hooks/use-conversation-page.js +13 -3
- package/hooks/use-conversation-page.js.map +1 -1
- package/hooks/use-new-message-sound.d.ts.map +1 -1
- package/hooks/use-new-message-sound.js +2 -2
- package/hooks/use-new-message-sound.js.map +1 -1
- package/hooks/use-typing-sound.d.ts.map +1 -1
- package/hooks/use-typing-sound.js +2 -2
- package/hooks/use-typing-sound.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +3 -3
- package/package.json +6 -12
- package/packages/tiny-markdown/src/context/index.d.ts +1 -0
- package/packages/tiny-markdown/src/context/tiny-markdown-context.d.ts +3 -0
- package/packages/tiny-markdown/src/hooks/index.d.ts +4 -0
- package/packages/tiny-markdown/src/hooks/use-caret-position.d.ts +1 -0
- package/packages/tiny-markdown/src/hooks/use-tiny-markdown.d.ts +1 -0
- package/packages/tiny-markdown/src/hooks/use-tiny-mention.d.ts +1 -0
- package/packages/tiny-markdown/src/hooks/use-tiny-shortcuts.d.ts +1 -0
- package/packages/tiny-markdown/src/index.d.ts +4 -0
- package/packages/tiny-markdown/src/types.d.ts +75 -0
- package/packages/tiny-markdown/src/types.d.ts.map +1 -0
- package/packages/tiny-markdown/src/utils/index.d.ts +3 -0
- package/packages/tiny-markdown/src/utils/markdown-parser.d.ts +1 -0
- package/packages/tiny-markdown/src/utils/mention-parser.d.ts +1 -0
- package/packages/tiny-markdown/src/utils/merge-refs.d.ts +1 -0
- package/packages/types/src/api/conversation.d.ts +300 -0
- package/packages/types/src/api/conversation.d.ts.map +1 -1
- package/packages/types/src/api/timeline-item.d.ts +225 -0
- package/packages/types/src/api/timeline-item.d.ts.map +1 -1
- package/packages/types/src/realtime-events.d.ts +228 -3
- package/packages/types/src/realtime-events.d.ts.map +1 -1
- package/packages/types/src/schemas.d.ts +75 -0
- package/packages/types/src/schemas.d.ts.map +1 -1
- package/primitives/avatar/image.d.ts +1 -1
- package/primitives/command-block-utils.d.ts +26 -0
- package/primitives/command-block-utils.d.ts.map +1 -0
- package/primitives/command-block-utils.js +310 -0
- package/primitives/command-block-utils.js.map +1 -0
- package/primitives/index.d.ts +7 -3
- package/primitives/index.js +11 -2
- package/primitives/index.parts.d.ts +6 -2
- package/primitives/index.parts.js +5 -1
- package/primitives/timeline-code-block.d.ts +32 -0
- package/primitives/timeline-code-block.d.ts.map +1 -0
- package/primitives/timeline-code-block.js +66 -0
- package/primitives/timeline-code-block.js.map +1 -0
- package/primitives/timeline-command-block.d.ts +29 -0
- package/primitives/timeline-command-block.d.ts.map +1 -0
- package/primitives/timeline-command-block.js +97 -0
- package/primitives/timeline-command-block.js.map +1 -0
- package/primitives/timeline-item-group.d.ts.map +1 -1
- package/primitives/timeline-item-group.js +5 -15
- package/primitives/timeline-item-group.js.map +1 -1
- package/primitives/timeline-item.d.ts +21 -1
- package/primitives/timeline-item.d.ts.map +1 -1
- package/primitives/timeline-item.js +148 -83
- package/primitives/timeline-item.js.map +1 -1
- package/primitives/timeline-message-layout.d.ts +9 -0
- package/primitives/timeline-message-layout.d.ts.map +1 -0
- package/primitives/timeline-message-layout.js +20 -0
- package/primitives/timeline-message-layout.js.map +1 -0
- package/provider.d.ts.map +1 -1
- package/provider.js +1 -7
- package/provider.js.map +1 -1
- package/realtime/event-filter.js +4 -3
- package/realtime/event-filter.js.map +1 -1
- package/realtime/provider.d.ts +0 -1
- package/realtime/provider.d.ts.map +1 -1
- package/realtime/provider.js +29 -34
- package/realtime/provider.js.map +1 -1
- package/sounds/sound-data.d.ts +6 -0
- package/sounds/sound-data.d.ts.map +1 -0
- package/sounds/sound-data.js +7 -0
- package/sounds/sound-data.js.map +1 -0
- package/styles.css +2 -0
- package/support/components/avatar.js +3 -3
- package/support/components/avatar.js.map +1 -1
- package/support/components/button.d.ts +2 -2
- package/support/components/button.d.ts.map +1 -1
- package/support/components/button.js +1 -0
- package/support/components/button.js.map +1 -1
- package/support/components/conversation-event.d.ts +3 -0
- package/support/components/conversation-event.d.ts.map +1 -1
- package/support/components/conversation-event.js +47 -16
- package/support/components/conversation-event.js.map +1 -1
- package/support/components/conversation-timeline.d.ts.map +1 -1
- package/support/components/conversation-timeline.js +12 -0
- package/support/components/conversation-timeline.js.map +1 -1
- package/support/components/index.d.ts +2 -1
- package/support/components/index.js +2 -1
- package/support/components/timeline-activity-group.d.ts +25 -0
- package/support/components/timeline-activity-group.d.ts.map +1 -0
- package/support/components/timeline-activity-group.js +104 -0
- package/support/components/timeline-activity-group.js.map +1 -0
- package/support/components/timeline-code-block.d.ts +14 -0
- package/support/components/timeline-code-block.d.ts.map +1 -0
- package/support/components/timeline-code-block.js +44 -0
- package/support/components/timeline-code-block.js.map +1 -0
- package/support/components/timeline-command-block.d.ts +12 -0
- package/support/components/timeline-command-block.d.ts.map +1 -0
- package/support/components/timeline-command-block.js +42 -0
- package/support/components/timeline-command-block.js.map +1 -0
- package/support/components/timeline-message-item.d.ts +2 -1
- package/support/components/timeline-message-item.d.ts.map +1 -1
- package/support/components/timeline-message-item.js +23 -3
- package/support/components/timeline-message-item.js.map +1 -1
- package/support/pages/home.js +1 -1
- package/support/pages/home.js.map +1 -1
- package/support/store/support-store.d.ts.map +1 -1
- package/support/store/support-store.js +4 -4
- package/support/store/support-store.js.map +1 -1
- package/support/{support-DmViRaga.css → support-Dc5L__HC.css} +15 -15
- package/support/{support-DmViRaga.css.map → support-Dc5L__HC.css.map} +1 -1
- package/{tailwind.css → support/support.css} +14 -14
- package/support-config.d.ts +31 -4
- package/support-config.d.ts.map +1 -1
- package/support-config.js +52 -4
- package/support-config.js.map +1 -1
- package/support.css +1 -2
- package/utils/metadata-hash.d.ts +1 -1
- package/utils/metadata-hash.js +9 -4
- package/utils/metadata-hash.js.map +1 -1
- package/utils/timeline-item-sender.d.ts +17 -0
- package/utils/timeline-item-sender.d.ts.map +1 -0
- package/utils/timeline-item-sender.js +43 -0
- package/utils/timeline-item-sender.js.map +1 -0
- package/utils/use-render-element.d.ts.map +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/primitives/timeline-code-block.d.ts
|
|
4
|
+
type TimelineCodeBlockRenderState = {
|
|
5
|
+
code: string;
|
|
6
|
+
language?: string;
|
|
7
|
+
languageLabel: string;
|
|
8
|
+
codeClassName?: string;
|
|
9
|
+
fileName?: string;
|
|
10
|
+
hasCopied: boolean;
|
|
11
|
+
onCopy: () => Promise<boolean>;
|
|
12
|
+
};
|
|
13
|
+
type TimelineCodeBlockProps = {
|
|
14
|
+
code: string;
|
|
15
|
+
language?: string;
|
|
16
|
+
fileName?: string;
|
|
17
|
+
className?: string;
|
|
18
|
+
children?: (state: TimelineCodeBlockRenderState) => React$1.ReactNode;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Shared timeline code block UI with filename/language metadata and copy action.
|
|
22
|
+
*/
|
|
23
|
+
declare function TimelineCodeBlock({
|
|
24
|
+
code,
|
|
25
|
+
language,
|
|
26
|
+
fileName,
|
|
27
|
+
className,
|
|
28
|
+
children
|
|
29
|
+
}: TimelineCodeBlockProps): React$1.ReactElement;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { TimelineCodeBlock, TimelineCodeBlockProps, TimelineCodeBlockRenderState };
|
|
32
|
+
//# sourceMappingURL=timeline-code-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline-code-block.d.ts","names":[],"sources":["../../src/primitives/timeline-code-block.tsx"],"sourcesContent":[],"mappings":";;;KAEY,4BAAA;;EAAA,QAAA,CAAA,EAAA,MAAA;EAUA,aAAA,EAAA,MAAA;EAgCI,aAAA,CAAA,EAAA,MAAiB;EAChC,QAAA,CAAA,EAAA,MAAA;EACA,SAAA,EAAA,OAAA;EACA,MAAA,EAAA,GAAA,GAtCc,OAsCd,CAAA,OAAA,CAAA;CACA;AACA,KArCW,sBAAA,GAqCX;EACE,IAAA,EAAA,MAAA;EAAyB,QAAM,CAAA,EAAA,MAAA;EAAY,QAAA,CAAA,EAAA,MAAA;;qBAjC1B,iCAAiC,OAAA,CAAM;;;;;iBA2B3C,iBAAA;;;;;;GAMb,yBAAyB,OAAA,CAAM"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/primitives/timeline-code-block.tsx
|
|
5
|
+
function getLanguageLabel(language) {
|
|
6
|
+
if (!language) return "TEXT";
|
|
7
|
+
return language.toUpperCase();
|
|
8
|
+
}
|
|
9
|
+
async function copyToClipboard(value) {
|
|
10
|
+
if (typeof navigator === "undefined" || !navigator.clipboard) return false;
|
|
11
|
+
try {
|
|
12
|
+
await navigator.clipboard.writeText(value);
|
|
13
|
+
return true;
|
|
14
|
+
} catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Shared timeline code block UI with filename/language metadata and copy action.
|
|
20
|
+
*/
|
|
21
|
+
function TimelineCodeBlock({ code, language, fileName, className, children }) {
|
|
22
|
+
const [hasCopied, setHasCopied] = React$1.useState(false);
|
|
23
|
+
React$1.useEffect(() => {
|
|
24
|
+
if (!hasCopied) return;
|
|
25
|
+
const timer = window.setTimeout(() => {
|
|
26
|
+
setHasCopied(false);
|
|
27
|
+
}, 1800);
|
|
28
|
+
return () => {
|
|
29
|
+
window.clearTimeout(timer);
|
|
30
|
+
};
|
|
31
|
+
}, [hasCopied]);
|
|
32
|
+
const codeClassName = language ? `language-${language}` : void 0;
|
|
33
|
+
const languageLabel = getLanguageLabel(language);
|
|
34
|
+
const onCopy = React$1.useCallback(async () => {
|
|
35
|
+
const didCopy = await copyToClipboard(code);
|
|
36
|
+
if (didCopy) setHasCopied(true);
|
|
37
|
+
return didCopy;
|
|
38
|
+
}, [code]);
|
|
39
|
+
const renderState = {
|
|
40
|
+
code,
|
|
41
|
+
language,
|
|
42
|
+
languageLabel,
|
|
43
|
+
codeClassName,
|
|
44
|
+
fileName,
|
|
45
|
+
hasCopied,
|
|
46
|
+
onCopy
|
|
47
|
+
};
|
|
48
|
+
return /* @__PURE__ */ jsx("div", {
|
|
49
|
+
className,
|
|
50
|
+
"data-co-code-block": "",
|
|
51
|
+
children: typeof children === "function" ? children(renderState) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", { children: [fileName ? /* @__PURE__ */ jsx("span", { children: fileName }) : null, /* @__PURE__ */ jsx("span", { children: languageLabel })] }), /* @__PURE__ */ jsx("button", {
|
|
52
|
+
onClick: () => {
|
|
53
|
+
onCopy();
|
|
54
|
+
},
|
|
55
|
+
type: "button",
|
|
56
|
+
children: hasCopied ? "Copied" : "Copy"
|
|
57
|
+
})] }), /* @__PURE__ */ jsx("pre", { children: /* @__PURE__ */ jsx("code", {
|
|
58
|
+
className: codeClassName,
|
|
59
|
+
children: code
|
|
60
|
+
}) })] })
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
export { TimelineCodeBlock };
|
|
66
|
+
//# sourceMappingURL=timeline-code-block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline-code-block.js","names":["React","renderState: TimelineCodeBlockRenderState"],"sources":["../../src/primitives/timeline-code-block.tsx"],"sourcesContent":["import * as React from \"react\";\n\nexport type TimelineCodeBlockRenderState = {\n\tcode: string;\n\tlanguage?: string;\n\tlanguageLabel: string;\n\tcodeClassName?: string;\n\tfileName?: string;\n\thasCopied: boolean;\n\tonCopy: () => Promise<boolean>;\n};\n\nexport type TimelineCodeBlockProps = {\n\tcode: string;\n\tlanguage?: string;\n\tfileName?: string;\n\tclassName?: string;\n\tchildren?: (state: TimelineCodeBlockRenderState) => React.ReactNode;\n};\n\nfunction getLanguageLabel(language?: string): string {\n\tif (!language) {\n\t\treturn \"TEXT\";\n\t}\n\n\treturn language.toUpperCase();\n}\n\nasync function copyToClipboard(value: string): Promise<boolean> {\n\tif (typeof navigator === \"undefined\" || !navigator.clipboard) {\n\t\treturn false;\n\t}\n\n\ttry {\n\t\tawait navigator.clipboard.writeText(value);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Shared timeline code block UI with filename/language metadata and copy action.\n */\nexport function TimelineCodeBlock({\n\tcode,\n\tlanguage,\n\tfileName,\n\tclassName,\n\tchildren,\n}: TimelineCodeBlockProps): React.ReactElement {\n\tconst [hasCopied, setHasCopied] = React.useState(false);\n\n\tReact.useEffect(() => {\n\t\tif (!hasCopied) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst timer = window.setTimeout(() => {\n\t\t\tsetHasCopied(false);\n\t\t}, 1800);\n\n\t\treturn () => {\n\t\t\twindow.clearTimeout(timer);\n\t\t};\n\t}, [hasCopied]);\n\n\tconst codeClassName = language ? `language-${language}` : undefined;\n\tconst languageLabel = getLanguageLabel(language);\n\n\tconst onCopy = React.useCallback(async () => {\n\t\tconst didCopy = await copyToClipboard(code);\n\t\tif (didCopy) {\n\t\t\tsetHasCopied(true);\n\t\t}\n\n\t\treturn didCopy;\n\t}, [code]);\n\n\tconst renderState: TimelineCodeBlockRenderState = {\n\t\tcode,\n\t\tlanguage,\n\t\tlanguageLabel,\n\t\tcodeClassName,\n\t\tfileName,\n\t\thasCopied,\n\t\tonCopy,\n\t};\n\n\treturn (\n\t\t<div className={className} data-co-code-block=\"\">\n\t\t\t{typeof children === \"function\" ? (\n\t\t\t\tchildren(renderState)\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t{fileName ? <span>{fileName}</span> : null}\n\t\t\t\t\t\t\t<span>{languageLabel}</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\tvoid onCopy();\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{hasCopied ? \"Copied\" : \"Copy\"}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<pre>\n\t\t\t\t\t\t<code className={codeClassName}>{code}</code>\n\t\t\t\t\t</pre>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;AAoBA,SAAS,iBAAiB,UAA2B;AACpD,KAAI,CAAC,SACJ,QAAO;AAGR,QAAO,SAAS,aAAa;;AAG9B,eAAe,gBAAgB,OAAiC;AAC/D,KAAI,OAAO,cAAc,eAAe,CAAC,UAAU,UAClD,QAAO;AAGR,KAAI;AACH,QAAM,UAAU,UAAU,UAAU,MAAM;AAC1C,SAAO;SACA;AACP,SAAO;;;;;;AAOT,SAAgB,kBAAkB,EACjC,MACA,UACA,UACA,WACA,YAC8C;CAC9C,MAAM,CAAC,WAAW,gBAAgBA,QAAM,SAAS,MAAM;AAEvD,SAAM,gBAAgB;AACrB,MAAI,CAAC,UACJ;EAGD,MAAM,QAAQ,OAAO,iBAAiB;AACrC,gBAAa,MAAM;KACjB,KAAK;AAER,eAAa;AACZ,UAAO,aAAa,MAAM;;IAEzB,CAAC,UAAU,CAAC;CAEf,MAAM,gBAAgB,WAAW,YAAY,aAAa;CAC1D,MAAM,gBAAgB,iBAAiB,SAAS;CAEhD,MAAM,SAASA,QAAM,YAAY,YAAY;EAC5C,MAAM,UAAU,MAAM,gBAAgB,KAAK;AAC3C,MAAI,QACH,cAAa,KAAK;AAGnB,SAAO;IACL,CAAC,KAAK,CAAC;CAEV,MAAMC,cAA4C;EACjD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAED,QACC,oBAAC;EAAe;EAAW,sBAAmB;YAC5C,OAAO,aAAa,aACpB,SAAS,YAAY,GAErB,4CACC,qBAAC,oBACA,qBAAC,oBACC,WAAW,oBAAC,oBAAM,WAAgB,GAAG,MACtC,oBAAC,oBAAM,gBAAqB,IACvB,EACN,oBAAC;GACA,eAAe;AACd,IAAK,QAAQ;;GAEd,MAAK;aAEJ,YAAY,WAAW;IAChB,IACJ,EAEN,oBAAC,mBACA,oBAAC;GAAK,WAAW;aAAgB;IAAY,GACxC,IACJ;GAEC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CommandPackageManager, CommandVariants } from "./command-block-utils.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/primitives/timeline-command-block.d.ts
|
|
5
|
+
type TimelineCommandBlockRenderState = {
|
|
6
|
+
commands: CommandVariants;
|
|
7
|
+
packageManagers: readonly CommandPackageManager[];
|
|
8
|
+
activePackageManager: CommandPackageManager;
|
|
9
|
+
activeCommand: string;
|
|
10
|
+
setPackageManager: (packageManager: CommandPackageManager) => void;
|
|
11
|
+
hasCopied: boolean;
|
|
12
|
+
onCopy: () => Promise<boolean>;
|
|
13
|
+
};
|
|
14
|
+
type TimelineCommandBlockProps = {
|
|
15
|
+
commands: CommandVariants;
|
|
16
|
+
className?: string;
|
|
17
|
+
children?: (state: TimelineCommandBlockRenderState) => React$1.ReactNode;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Shared command block UI with package-manager tabs and copy action.
|
|
21
|
+
*/
|
|
22
|
+
declare function TimelineCommandBlock({
|
|
23
|
+
commands,
|
|
24
|
+
className,
|
|
25
|
+
children
|
|
26
|
+
}: TimelineCommandBlockProps): React$1.ReactElement;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { TimelineCommandBlock, TimelineCommandBlockProps, TimelineCommandBlockRenderState };
|
|
29
|
+
//# sourceMappingURL=timeline-command-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline-command-block.d.ts","names":[],"sources":["../../src/primitives/timeline-command-block.tsx"],"sourcesContent":[],"mappings":";;;;KAWY,+BAAA;YACD;EADC,eAAA,EAAA,SAEe,qBAFgB,EAAA;EAChC,oBAAA,EAEY,qBAFZ;EACgB,aAAA,EAAA,MAAA;EACJ,iBAAA,EAAA,CAAA,cAAA,EAEc,qBAFd,EAAA,GAAA,IAAA;EAEc,SAAA,EAAA,OAAA;EAEtB,MAAA,EAAA,GAAA,GAAA,OAAA,CAAA,OAAA,CAAA;CAAO;AAGV,KAAA,yBAAA,GAAyB;EAC1B,QAAA,EAAA,eAAA;EAES,SAAA,CAAA,EAAA,MAAA;EAAoC,QAAM,CAAA,EAAA,CAAA,KAAA,EAA1C,+BAA0C,EAAA,GAAN,OAAA,CAAM,SAAA;CAAS;AAkCvE;;;AAGC,iBAHe,oBAAA,CAGf;EAAA,QAAA;EAAA,SAAA;EAAA;AAAA,CAAA,EACE,yBADF,CAAA,EAC8B,OAAA,CAAM,YADpC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { COMMAND_PACKAGE_MANAGERS, COMMAND_PREFERENCE_EVENT, COMMAND_PREFERENCE_STORAGE_KEY, DEFAULT_PACKAGE_MANAGER, isCommandPackageManager } from "./command-block-utils.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/primitives/timeline-command-block.tsx
|
|
6
|
+
function readStoredPackageManager() {
|
|
7
|
+
if (typeof window === "undefined") return DEFAULT_PACKAGE_MANAGER;
|
|
8
|
+
const storedValue = window.localStorage.getItem(COMMAND_PREFERENCE_STORAGE_KEY);
|
|
9
|
+
if (storedValue && isCommandPackageManager(storedValue)) return storedValue;
|
|
10
|
+
return DEFAULT_PACKAGE_MANAGER;
|
|
11
|
+
}
|
|
12
|
+
async function copyToClipboard(value) {
|
|
13
|
+
if (typeof navigator === "undefined" || !navigator.clipboard) return false;
|
|
14
|
+
try {
|
|
15
|
+
await navigator.clipboard.writeText(value);
|
|
16
|
+
return true;
|
|
17
|
+
} catch {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Shared command block UI with package-manager tabs and copy action.
|
|
23
|
+
*/
|
|
24
|
+
function TimelineCommandBlock({ commands, className, children }) {
|
|
25
|
+
const [packageManager, setPackageManager] = React$1.useState(() => readStoredPackageManager());
|
|
26
|
+
const [hasCopied, setHasCopied] = React$1.useState(false);
|
|
27
|
+
React$1.useEffect(() => {
|
|
28
|
+
if (typeof window === "undefined") return;
|
|
29
|
+
setPackageManager(readStoredPackageManager());
|
|
30
|
+
const onStorageChange = (event) => {
|
|
31
|
+
if (event.key !== COMMAND_PREFERENCE_STORAGE_KEY) return;
|
|
32
|
+
if (event.newValue && isCommandPackageManager(event.newValue)) setPackageManager(event.newValue);
|
|
33
|
+
};
|
|
34
|
+
const onPreferenceEvent = (event) => {
|
|
35
|
+
const nextValue = event.detail;
|
|
36
|
+
if (nextValue && isCommandPackageManager(nextValue)) setPackageManager(nextValue);
|
|
37
|
+
};
|
|
38
|
+
window.addEventListener("storage", onStorageChange);
|
|
39
|
+
window.addEventListener(COMMAND_PREFERENCE_EVENT, onPreferenceEvent);
|
|
40
|
+
return () => {
|
|
41
|
+
window.removeEventListener("storage", onStorageChange);
|
|
42
|
+
window.removeEventListener(COMMAND_PREFERENCE_EVENT, onPreferenceEvent);
|
|
43
|
+
};
|
|
44
|
+
}, []);
|
|
45
|
+
React$1.useEffect(() => {
|
|
46
|
+
if (!hasCopied) return;
|
|
47
|
+
const timer = window.setTimeout(() => {
|
|
48
|
+
setHasCopied(false);
|
|
49
|
+
}, 1800);
|
|
50
|
+
return () => {
|
|
51
|
+
window.clearTimeout(timer);
|
|
52
|
+
};
|
|
53
|
+
}, [hasCopied]);
|
|
54
|
+
const setPackageManagerPreference = React$1.useCallback((nextValue) => {
|
|
55
|
+
setPackageManager(nextValue);
|
|
56
|
+
if (typeof window === "undefined") return;
|
|
57
|
+
window.localStorage.setItem(COMMAND_PREFERENCE_STORAGE_KEY, nextValue);
|
|
58
|
+
window.dispatchEvent(new CustomEvent(COMMAND_PREFERENCE_EVENT, { detail: nextValue }));
|
|
59
|
+
}, []);
|
|
60
|
+
const activeCommand = commands[packageManager];
|
|
61
|
+
const onCopy = React$1.useCallback(async () => {
|
|
62
|
+
const didCopy = await copyToClipboard(activeCommand);
|
|
63
|
+
if (didCopy) setHasCopied(true);
|
|
64
|
+
return didCopy;
|
|
65
|
+
}, [activeCommand]);
|
|
66
|
+
const renderState = {
|
|
67
|
+
commands,
|
|
68
|
+
packageManagers: COMMAND_PACKAGE_MANAGERS,
|
|
69
|
+
activePackageManager: packageManager,
|
|
70
|
+
activeCommand,
|
|
71
|
+
setPackageManager: setPackageManagerPreference,
|
|
72
|
+
hasCopied,
|
|
73
|
+
onCopy
|
|
74
|
+
};
|
|
75
|
+
return /* @__PURE__ */ jsx("div", {
|
|
76
|
+
className,
|
|
77
|
+
"data-co-command-block": "",
|
|
78
|
+
children: typeof children === "function" ? children(renderState) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", { children: COMMAND_PACKAGE_MANAGERS.map((manager) => /* @__PURE__ */ jsx("button", {
|
|
79
|
+
onClick: () => setPackageManagerPreference(manager),
|
|
80
|
+
type: "button",
|
|
81
|
+
children: manager
|
|
82
|
+
}, manager)) }), /* @__PURE__ */ jsx("button", {
|
|
83
|
+
onClick: () => {
|
|
84
|
+
onCopy();
|
|
85
|
+
},
|
|
86
|
+
type: "button",
|
|
87
|
+
children: hasCopied ? "Copied" : "Copy"
|
|
88
|
+
})] }), /* @__PURE__ */ jsx("pre", { children: /* @__PURE__ */ jsx("code", {
|
|
89
|
+
className: "language-bash",
|
|
90
|
+
children: activeCommand
|
|
91
|
+
}) })] })
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
export { TimelineCommandBlock };
|
|
97
|
+
//# sourceMappingURL=timeline-command-block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline-command-block.js","names":["React","renderState: TimelineCommandBlockRenderState"],"sources":["../../src/primitives/timeline-command-block.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n\tCOMMAND_PACKAGE_MANAGERS,\n\tCOMMAND_PREFERENCE_EVENT,\n\tCOMMAND_PREFERENCE_STORAGE_KEY,\n\ttype CommandPackageManager,\n\ttype CommandVariants,\n\tDEFAULT_PACKAGE_MANAGER,\n\tisCommandPackageManager,\n} from \"./command-block-utils\";\n\nexport type TimelineCommandBlockRenderState = {\n\tcommands: CommandVariants;\n\tpackageManagers: readonly CommandPackageManager[];\n\tactivePackageManager: CommandPackageManager;\n\tactiveCommand: string;\n\tsetPackageManager: (packageManager: CommandPackageManager) => void;\n\thasCopied: boolean;\n\tonCopy: () => Promise<boolean>;\n};\n\nexport type TimelineCommandBlockProps = {\n\tcommands: CommandVariants;\n\tclassName?: string;\n\tchildren?: (state: TimelineCommandBlockRenderState) => React.ReactNode;\n};\n\nfunction readStoredPackageManager(): CommandPackageManager {\n\tif (typeof window === \"undefined\") {\n\t\treturn DEFAULT_PACKAGE_MANAGER;\n\t}\n\n\tconst storedValue = window.localStorage.getItem(\n\t\tCOMMAND_PREFERENCE_STORAGE_KEY\n\t);\n\tif (storedValue && isCommandPackageManager(storedValue)) {\n\t\treturn storedValue;\n\t}\n\n\treturn DEFAULT_PACKAGE_MANAGER;\n}\n\nasync function copyToClipboard(value: string): Promise<boolean> {\n\tif (typeof navigator === \"undefined\" || !navigator.clipboard) {\n\t\treturn false;\n\t}\n\n\ttry {\n\t\tawait navigator.clipboard.writeText(value);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Shared command block UI with package-manager tabs and copy action.\n */\nexport function TimelineCommandBlock({\n\tcommands,\n\tclassName,\n\tchildren,\n}: TimelineCommandBlockProps): React.ReactElement {\n\tconst [packageManager, setPackageManager] =\n\t\tReact.useState<CommandPackageManager>(() => readStoredPackageManager());\n\tconst [hasCopied, setHasCopied] = React.useState(false);\n\n\tReact.useEffect(() => {\n\t\tif (typeof window === \"undefined\") {\n\t\t\treturn;\n\t\t}\n\n\t\tsetPackageManager(readStoredPackageManager());\n\n\t\tconst onStorageChange = (event: StorageEvent) => {\n\t\t\tif (event.key !== COMMAND_PREFERENCE_STORAGE_KEY) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (event.newValue && isCommandPackageManager(event.newValue)) {\n\t\t\t\tsetPackageManager(event.newValue);\n\t\t\t}\n\t\t};\n\n\t\tconst onPreferenceEvent = (event: Event) => {\n\t\t\tconst nextValue = (event as CustomEvent<CommandPackageManager>).detail;\n\t\t\tif (nextValue && isCommandPackageManager(nextValue)) {\n\t\t\t\tsetPackageManager(nextValue);\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener(\"storage\", onStorageChange);\n\t\twindow.addEventListener(\n\t\t\tCOMMAND_PREFERENCE_EVENT,\n\t\t\tonPreferenceEvent as EventListener\n\t\t);\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"storage\", onStorageChange);\n\t\t\twindow.removeEventListener(\n\t\t\t\tCOMMAND_PREFERENCE_EVENT,\n\t\t\t\tonPreferenceEvent as EventListener\n\t\t\t);\n\t\t};\n\t}, []);\n\n\tReact.useEffect(() => {\n\t\tif (!hasCopied) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst timer = window.setTimeout(() => {\n\t\t\tsetHasCopied(false);\n\t\t}, 1800);\n\n\t\treturn () => {\n\t\t\twindow.clearTimeout(timer);\n\t\t};\n\t}, [hasCopied]);\n\n\tconst setPackageManagerPreference = React.useCallback(\n\t\t(nextValue: CommandPackageManager) => {\n\t\t\tsetPackageManager(nextValue);\n\n\t\t\tif (typeof window === \"undefined\") {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\twindow.localStorage.setItem(COMMAND_PREFERENCE_STORAGE_KEY, nextValue);\n\t\t\twindow.dispatchEvent(\n\t\t\t\tnew CustomEvent<CommandPackageManager>(COMMAND_PREFERENCE_EVENT, {\n\t\t\t\t\tdetail: nextValue,\n\t\t\t\t})\n\t\t\t);\n\t\t},\n\t\t[]\n\t);\n\n\tconst activeCommand = commands[packageManager];\n\n\tconst onCopy = React.useCallback(async () => {\n\t\tconst didCopy = await copyToClipboard(activeCommand);\n\t\tif (didCopy) {\n\t\t\tsetHasCopied(true);\n\t\t}\n\n\t\treturn didCopy;\n\t}, [activeCommand]);\n\n\tconst renderState: TimelineCommandBlockRenderState = {\n\t\tcommands,\n\t\tpackageManagers: COMMAND_PACKAGE_MANAGERS,\n\t\tactivePackageManager: packageManager,\n\t\tactiveCommand,\n\t\tsetPackageManager: setPackageManagerPreference,\n\t\thasCopied,\n\t\tonCopy,\n\t};\n\n\treturn (\n\t\t<div className={className} data-co-command-block=\"\">\n\t\t\t{typeof children === \"function\" ? (\n\t\t\t\tchildren(renderState)\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t{COMMAND_PACKAGE_MANAGERS.map((manager) => (\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tkey={manager}\n\t\t\t\t\t\t\t\t\tonClick={() => setPackageManagerPreference(manager)}\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{manager}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\tvoid onCopy();\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{hasCopied ? \"Copied\" : \"Copy\"}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<pre>\n\t\t\t\t\t\t<code className=\"language-bash\">{activeCommand}</code>\n\t\t\t\t\t</pre>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;AA2BA,SAAS,2BAAkD;AAC1D,KAAI,OAAO,WAAW,YACrB,QAAO;CAGR,MAAM,cAAc,OAAO,aAAa,QACvC,+BACA;AACD,KAAI,eAAe,wBAAwB,YAAY,CACtD,QAAO;AAGR,QAAO;;AAGR,eAAe,gBAAgB,OAAiC;AAC/D,KAAI,OAAO,cAAc,eAAe,CAAC,UAAU,UAClD,QAAO;AAGR,KAAI;AACH,QAAM,UAAU,UAAU,UAAU,MAAM;AAC1C,SAAO;SACA;AACP,SAAO;;;;;;AAOT,SAAgB,qBAAqB,EACpC,UACA,WACA,YACiD;CACjD,MAAM,CAAC,gBAAgB,qBACtBA,QAAM,eAAsC,0BAA0B,CAAC;CACxE,MAAM,CAAC,WAAW,gBAAgBA,QAAM,SAAS,MAAM;AAEvD,SAAM,gBAAgB;AACrB,MAAI,OAAO,WAAW,YACrB;AAGD,oBAAk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Q;GACnD,MAAK;aAEJ;KAJI,QAKG,CACR,GACG,EAEN,oBAAC;GACA,eAAe;AACd,IAAK,QAAQ;;GAEd,MAAK;aAEJ,YAAY,WAAW;IAChB,IACJ,EAEN,oBAAC,mBACA,oBAAC;GAAK,WAAU;aAAiB;IAAqB,GACjD,IACJ;GAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline-item-group.d.ts","names":[],"sources":["../../src/primitives/timeline-item-group.tsx"],"sourcesContent":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"timeline-item-group.d.ts","names":[],"sources":["../../src/primitives/timeline-item-group.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAUA;AAyBA;AACsB,KA1BV,4BAAA,GA0BU;EAArB,UAAM,EAxBM,UAwBN;EAD8B,QAAA,EAAA,MAAA;EAKjC,UAAM,CAAA,EA1BI,UA0BJ;EACG,cAAA,EAAA,OAAA;EAAiC,kBAAM,EAAA,OAAA;EAG5C,SAAA,EAAA,OAAA;EAIM,IAAA,EAAA,OAAA;EAIK,YAAA,EAAA,OAAA;EAAG,SAAA,EAAA,MAAA;EAST,WAAA,EAAA,MAAA,GAwFT,SAAA;EAxF0B,UAAA,EAAA,MAAA,GAAA,SAAA;EAAA,mBAAA,CAAA,EAAA,OAAA;EAAA,SAAA,CAAA,EAAA,SAAA,MAAA,EAAA;CArB1B;AACS,KAND,sBAAA,GAAyB,IAMxB,CALZ,OAAA,CAAM,cAKM,CALS,cAKT,CAAA,EAAA,UAAA,CAAA,GAAA;EAAiC,QAAM,CAAA,EADhD,OAAA,CAAM,SAC0C,GAAA,CAAA,CAAA,KAAA,EAAvC,4BAAuC,EAAA,GAAN,OAAA,CAAM,SAAA,CAAA;EAG5C,OAAA,CAAA,EAAA,OAAA;EAIM,SAAA,CAAA,EAAA,MAAA;EAIK,KAAA,EARX,YAQW,EAAA;;eAJL;EAagB,SAAA,CAAA,EAAA,SAAA,MAAA,EAAA;EAAA,eAAA,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H,wBAAM,eAAA,CAAA,CAAA;AAIG,KA3EP,mCAAA,GAAsC,IA2E/B,CA1ElB,OAAA,CAAM,cA0EY,CA1EG,cA0EH,CAAA,EAAA,UAAA,CAAA,GAAA;EAAG,QAAA,CAAA,EAtElB,OAAA,CAAM,SAsEY,GAAA,CAAA,CAAA,KAAA,EAAA;IAQT,SAAA,EAAA,SAAA,MAAA,EAAA;IAA8B,WAAA,EAAA,OAAA;EAAA,CAAA,EAAA,GA1EjC,OAAA,CAAM,SA0E2B,CAAA;EAAA,OAAA,CAAA,EAAA,OAAA;EAhBvC,SAAM,CAAA,EAAA,MAAA;EAEG,SAAA,CAAA,EAAA,SAAA,MAAA,EAAA;CAEH;;;;;;cAnDG,gCAA8B,OAAA,CAAA,0BAAA,KAAA,OAAA,CAAA,eAAA;aAfvC,OAAA,CAAM;;;QAIA,OAAA,CAAM;;;;;KAqDJ,mCAAA,GAAsC,KACjD,OAAA,CAAM,eAAe;aAIlB,OAAA,CAAM;aAEG;;;;;QAEH,OAAA,CAAM;;;;oBAIG;;;;;;;cAQN,gCAA8B,OAAA,CAAA,0BAAA,KAAA,OAAA,CAAA,eAAA;aAhBvC,OAAA,CAAM;aAEG;;;;;QAEH,OAAA,CAAM;;;;oBAIG"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useRenderElement } from "../utils/use-render-element.js";
|
|
2
|
+
import { getTimelineItemSender } from "../utils/timeline-item-sender.js";
|
|
2
3
|
import * as React$1 from "react";
|
|
3
4
|
|
|
4
5
|
//#region src/primitives/timeline-item-group.tsx
|
|
@@ -13,21 +14,10 @@ const TimelineItemGroup = (() => {
|
|
|
13
14
|
const { viewerType, ...elementProps } = restProps;
|
|
14
15
|
const firstItem = items[0];
|
|
15
16
|
const lastItem = items.at(-1);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
senderType = "visitor";
|
|
21
|
-
} else if (firstItem?.aiAgentId) {
|
|
22
|
-
senderId = firstItem.aiAgentId;
|
|
23
|
-
senderType = "ai";
|
|
24
|
-
} else if (firstItem?.userId) {
|
|
25
|
-
senderId = firstItem.userId;
|
|
26
|
-
senderType = "team_member";
|
|
27
|
-
} else {
|
|
28
|
-
senderId = firstItem?.id || "unknown";
|
|
29
|
-
senderType = "team_member";
|
|
30
|
-
}
|
|
17
|
+
const { senderId, senderType } = firstItem ? getTimelineItemSender(firstItem) : {
|
|
18
|
+
senderId: "unknown",
|
|
19
|
+
senderType: "team_member"
|
|
20
|
+
};
|
|
31
21
|
const isSentByViewer = viewerId ? senderId === viewerId : viewerType ? senderType === viewerType : false;
|
|
32
22
|
const isReceivedByViewer = viewerId ? senderId !== viewerId : viewerType ? senderType !== viewerType : true;
|
|
33
23
|
const isVisitor = senderType === "visitor";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline-item-group.js","names":["React","senderType: SenderType","renderProps: TimelineItemGroupRenderProps","_lastReaderIds: string[]","_readers: Array<{ userId: string; isLastRead: boolean }>"],"sources":["../../src/primitives/timeline-item-group.tsx"],"sourcesContent":["import type { SenderType } from \"@cossistant/types\";\nimport type { TimelineItem as TimelineItemType } from \"@cossistant/types/api/timeline-item\";\nimport * as React from \"react\";\nimport { useRenderElement } from \"../utils/use-render-element\";\n\n/**\n * Shape returned to render-prop children describing the grouped timeline items state\n * and viewer specific flags.\n */\nexport type TimelineItemGroupRenderProps = {\n\t// Sender information\n\tsenderType: SenderType;\n\tsenderId: string;\n\tviewerType?: SenderType;\n\n\t// POV flags - who is viewing\n\tisSentByViewer: boolean; // True if the current viewer sent these items\n\tisReceivedByViewer: boolean; // True if the current viewer received these items\n\n\t// Sender type flags for convenience\n\tisVisitor: boolean;\n\tisAI: boolean;\n\tisTeamMember: boolean;\n\n\t// Item info\n\titemCount: number;\n\tfirstItemId: string | undefined;\n\tlastItemId: string | undefined;\n\n\t// Seen status\n\thasBeenSeenByViewer?: boolean;\n\tseenByIds?: readonly string[]; // IDs of users who have seen the last item in group\n};\n\nexport type TimelineItemGroupProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: TimelineItemGroupRenderProps) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\titems: TimelineItemType[];\n\n\t// POV context - who is viewing these timeline items\n\tviewerId?: string; // ID of the current viewer\n\tviewerType?: SenderType; // Type of the current viewer\n\n\t// Seen data\n\tseenByIds?: readonly string[]; // IDs of users who have seen these timeline items\n\tlastReadItemIds?: Map<string, string>; // Map of userId -> lastItemId they read\n};\n\n/**\n * Groups sequential timeline items from the same sender and exposes render helpers\n * that describe who sent the batch and whether the active viewer has seen it.\n * Consumers can either render their own layout via a render prop or rely on\n * slotted children. Typically used for MESSAGE-type items; EVENT items are usually rendered separately.\n */\nexport const TimelineItemGroup = (() => {\n\tconst Component = React.forwardRef<HTMLDivElement, TimelineItemGroupProps>(\n\t\t(\n\t\t\t{\n\t\t\t\tchildren,\n\t\t\t\tclassName,\n\t\t\t\tasChild = false,\n\t\t\t\titems = [],\n\t\t\t\tviewerId,\n\t\t\t\tseenByIds = [] as readonly string[],\n\t\t\t\tlastReadItemIds,\n\t\t\t\t...restProps\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst { viewerType, ...elementProps } = restProps;\n\n\t\t\t// Determine sender type from first timeline item in group\n\t\t\tconst firstItem = items[0];\n\t\t\tconst lastItem = items.at(-1);\n\n\t\t\t// Determine sender info\n\t\t\tlet senderId = \"\";\n\t\t\tlet senderType: SenderType;\n\n\t\t\tif (firstItem?.visitorId) {\n\t\t\t\tsenderId = firstItem.visitorId;\n\t\t\t\tsenderType = \"visitor\" as SenderType;\n\t\t\t} else if (firstItem?.aiAgentId) {\n\t\t\t\tsenderId = firstItem.aiAgentId;\n\t\t\t\tsenderType = \"ai\" as SenderType;\n\t\t\t} else if (firstItem?.userId) {\n\t\t\t\tsenderId = firstItem.userId;\n\t\t\t\tsenderType = \"team_member\" as SenderType;\n\t\t\t} else {\n\t\t\t\t// Fallback\n\t\t\t\tsenderId = firstItem?.id || \"unknown\";\n\t\t\t\tsenderType = \"team_member\" as SenderType;\n\t\t\t}\n\n\t\t\t// Determine POV\n\t\t\tconst isSentByViewer = viewerId\n\t\t\t\t? senderId === viewerId\n\t\t\t\t: viewerType\n\t\t\t\t\t? senderType === viewerType\n\t\t\t\t\t: false;\n\t\t\tconst isReceivedByViewer = viewerId\n\t\t\t\t? senderId !== viewerId\n\t\t\t\t: viewerType\n\t\t\t\t\t? senderType !== viewerType\n\t\t\t\t\t: true;\n\n\t\t\t// Convenience flags\n\t\t\tconst isVisitor = senderType === \"visitor\";\n\t\t\tconst isAI = senderType === \"ai\";\n\t\t\tconst isTeamMember = senderType === \"team_member\";\n\n\t\t\t// Check if viewer has seen these timeline items\n\t\t\tconst hasBeenSeenByViewer = viewerId\n\t\t\t\t? seenByIds.includes(viewerId)\n\t\t\t\t: undefined;\n\n\t\t\tconst renderProps: TimelineItemGroupRenderProps = {\n\t\t\t\tsenderType,\n\t\t\t\tsenderId,\n\t\t\t\tviewerType,\n\t\t\t\tisSentByViewer,\n\t\t\t\tisReceivedByViewer,\n\t\t\t\tisVisitor,\n\t\t\t\tisAI,\n\t\t\t\tisTeamMember,\n\t\t\t\titemCount: items.length,\n\t\t\t\tfirstItemId: firstItem?.id,\n\t\t\t\tlastItemId: lastItem?.id,\n\t\t\t\thasBeenSeenByViewer,\n\t\t\t\tseenByIds,\n\t\t\t};\n\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\" ? children(renderProps) : children;\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"div\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref,\n\t\t\t\t\tstate: renderProps,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\trole: \"group\",\n\t\t\t\t\t\t\"aria-label\": `Timeline item group from ${senderType}`,\n\t\t\t\t\t\t...elementProps,\n\t\t\t\t\t\tchildren: content,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"TimelineItemGroup\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupAvatarProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Optional slot rendered next to a grouped batch to display an avatar, agent\n * badge or any other sender metadata supplied by the consumer UI.\n */\nexport const TimelineItemGroupAvatar = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupAvatarProps\n\t>(({ children, className, asChild = false, ...props }, ref) =>\n\t\tuseRenderElement(\n\t\t\t\"div\",\n\t\t\t{\n\t\t\t\tclassName,\n\t\t\t\tasChild,\n\t\t\t},\n\t\t\t{\n\t\t\t\tref,\n\t\t\t\tprops: {\n\t\t\t\t\t...props,\n\t\t\t\t\tchildren,\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\t);\n\n\tComponent.displayName = \"TimelineItemGroupAvatar\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupHeaderProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: {\n\t\t\t\tname?: string;\n\t\t\t\tsenderId?: string;\n\t\t\t\tsenderType?: SenderType;\n\t\t }) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\tname?: string;\n\tsenderId?: string;\n\tsenderType?: SenderType;\n};\n\n/**\n * Decorative or semantic wrapper rendered above a timeline item batch. Useful for\n * injecting agent names, timestamps or custom status labels tied to the sender\n * metadata supplied by `TimelineItemGroup`.\n */\nexport const TimelineItemGroupHeader = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupHeaderProps\n\t>(\n\t\t(\n\t\t\t{\n\t\t\t\tchildren,\n\t\t\t\tclassName,\n\t\t\t\tasChild = false,\n\t\t\t\tname,\n\t\t\t\tsenderId,\n\t\t\t\tsenderType,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\"\n\t\t\t\t\t? children({ name, senderId, senderType })\n\t\t\t\t\t: children;\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"div\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tchildren: content,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"TimelineItemGroupHeader\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupContentProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Container for the actual timeline items within a batch. Consumers can\n * override the structure while inheriting layout props passed down from the\n * parent group.\n */\nexport const TimelineItemGroupContent = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupContentProps\n\t>(({ children, className, asChild = false, ...props }, ref) =>\n\t\tuseRenderElement(\n\t\t\t\"div\",\n\t\t\t{\n\t\t\t\tclassName,\n\t\t\t\tasChild,\n\t\t\t},\n\t\t\t{\n\t\t\t\tref,\n\t\t\t\tprops: {\n\t\t\t\t\t...props,\n\t\t\t\t\tchildren,\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\t);\n\n\tComponent.displayName = \"TimelineItemGroupContent\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupSeenIndicatorProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: {\n\t\t\t\tseenByIds: readonly string[];\n\t\t\t\thasBeenSeen: boolean;\n\t\t }) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\tseenByIds?: readonly string[];\n};\n\n/**\n * Utility slot for showing who has viewed the most recent timeline item in the\n * group. Works with simple text children or a render prop for advanced\n * displays.\n */\nexport const TimelineItemGroupSeenIndicator = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupSeenIndicatorProps\n\t>(\n\t\t(\n\t\t\t{\n\t\t\t\tchildren,\n\t\t\t\tclassName,\n\t\t\t\tasChild = false,\n\t\t\t\tseenByIds = [] as readonly string[],\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst hasBeenSeen = seenByIds.length > 0;\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\"\n\t\t\t\t\t? children({ seenByIds, hasBeenSeen })\n\t\t\t\t\t: children;\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"div\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tchildren: content,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"TimelineItemGroupSeenIndicator\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupReadIndicatorProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: {\n\t\t\t\treaders: Array<{ userId: string; isLastRead: boolean }>;\n\t\t\t\tlastReaderIds: string[];\n\t\t }) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\titemId: string;\n\tlastReadItemIds?: Map<string, string>;\n};\n\n/**\n * Renders read receipts for the tail timeline item in a group. It surfaces the list\n * of readers and callers can decide whether to render avatars, tooltips or a\n * basic label.\n */\nexport const TimelineItemGroupReadIndicator = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupReadIndicatorProps\n\t>(\n\t\t(\n\t\t\t{\n\t\t\t\tchildren,\n\t\t\t\tclassName,\n\t\t\t\tasChild = false,\n\t\t\t\titemId,\n\t\t\t\tlastReadItemIds,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\t// Find all users who stopped reading at this timeline item\n\t\t\tconst { lastReaderIds, readers } = React.useMemo(() => {\n\t\t\t\tconst _lastReaderIds: string[] = [];\n\t\t\t\tconst _readers: Array<{ userId: string; isLastRead: boolean }> = [];\n\n\t\t\t\tif (lastReadItemIds) {\n\t\t\t\t\tlastReadItemIds.forEach((lastItemId, userId) => {\n\t\t\t\t\t\tif (lastItemId === itemId) {\n\t\t\t\t\t\t\t_lastReaderIds.push(userId);\n\t\t\t\t\t\t\t_readers.push({ userId, isLastRead: true });\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\treturn { lastReaderIds: _lastReaderIds, readers: _readers };\n\t\t\t}, [itemId, lastReadItemIds]);\n\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\"\n\t\t\t\t\t? children({ readers, lastReaderIds })\n\t\t\t\t\t: children;\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"div\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tchildren: content,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"TimelineItemGroupReadIndicator\";\n\treturn Component;\n})();\n"],"mappings":";;;;;;;;;;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AW;AAC/C,QAAI,eAAe,QAAQ;AAC1B,oBAAe,KAAK,OAAO;AAC3B,cAAS,KAAK;MAAE;MAAQ,YAAY;MAAM,CAAC;;KAE3C;AAGH,UAAO;IAAE,eAAe;IAAgB,SAAS;IAAU;KACzD,CAAC,QAAQ,gBAAgB,CAAC;EAE7B,MAAM,UACL,OAAO,aAAa,aACjB,SAAS;GAAE;GAAS;GAAe,CAAC,GACpC;AAEJ,SAAO,iBACN,OACA;GACC;GACA;GACA,EACD;GACC;GACA,OAAO;IACN,GAAG;IACH,UAAU;IACV;GACD,CACD;GAEF;AAED,WAAU,cAAc;AACxB,QAAO;IACJ"}
|
|
1
|
+
{"version":3,"file":"timeline-item-group.js","names":["React","renderProps: TimelineItemGroupRenderProps","_lastReaderIds: string[]","_readers: Array<{ userId: string; isLastRead: boolean }>"],"sources":["../../src/primitives/timeline-item-group.tsx"],"sourcesContent":["import type { SenderType } from \"@cossistant/types\";\nimport type { TimelineItem as TimelineItemType } from \"@cossistant/types/api/timeline-item\";\nimport * as React from \"react\";\nimport { getTimelineItemSender } from \"../utils/timeline-item-sender\";\nimport { useRenderElement } from \"../utils/use-render-element\";\n\n/**\n * Shape returned to render-prop children describing the grouped timeline items state\n * and viewer specific flags.\n */\nexport type TimelineItemGroupRenderProps = {\n\t// Sender information\n\tsenderType: SenderType;\n\tsenderId: string;\n\tviewerType?: SenderType;\n\n\t// POV flags - who is viewing\n\tisSentByViewer: boolean; // True if the current viewer sent these items\n\tisReceivedByViewer: boolean; // True if the current viewer received these items\n\n\t// Sender type flags for convenience\n\tisVisitor: boolean;\n\tisAI: boolean;\n\tisTeamMember: boolean;\n\n\t// Item info\n\titemCount: number;\n\tfirstItemId: string | undefined;\n\tlastItemId: string | undefined;\n\n\t// Seen status\n\thasBeenSeenByViewer?: boolean;\n\tseenByIds?: readonly string[]; // IDs of users who have seen the last item in group\n};\n\nexport type TimelineItemGroupProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: TimelineItemGroupRenderProps) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\titems: TimelineItemType[];\n\n\t// POV context - who is viewing these timeline items\n\tviewerId?: string; // ID of the current viewer\n\tviewerType?: SenderType; // Type of the current viewer\n\n\t// Seen data\n\tseenByIds?: readonly string[]; // IDs of users who have seen these timeline items\n\tlastReadItemIds?: Map<string, string>; // Map of userId -> lastItemId they read\n};\n\n/**\n * Groups sequential timeline items from the same sender and exposes render helpers\n * that describe who sent the batch and whether the active viewer has seen it.\n * Consumers can either render their own layout via a render prop or rely on\n * slotted children. Typically used for MESSAGE-type items; EVENT items are usually rendered separately.\n */\nexport const TimelineItemGroup = (() => {\n\tconst Component = React.forwardRef<HTMLDivElement, TimelineItemGroupProps>(\n\t\t(\n\t\t\t{\n\t\t\t\tchildren,\n\t\t\t\tclassName,\n\t\t\t\tasChild = false,\n\t\t\t\titems = [],\n\t\t\t\tviewerId,\n\t\t\t\tseenByIds = [] as readonly string[],\n\t\t\t\tlastReadItemIds,\n\t\t\t\t...restProps\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst { viewerType, ...elementProps } = restProps;\n\n\t\t\t// Determine sender type from first timeline item in group\n\t\t\tconst firstItem = items[0];\n\t\t\tconst lastItem = items.at(-1);\n\n\t\t\tconst { senderId, senderType } = firstItem\n\t\t\t\t? getTimelineItemSender(firstItem)\n\t\t\t\t: { senderId: \"unknown\", senderType: \"team_member\" as SenderType };\n\n\t\t\t// Determine POV\n\t\t\tconst isSentByViewer = viewerId\n\t\t\t\t? senderId === viewerId\n\t\t\t\t: viewerType\n\t\t\t\t\t? senderType === viewerType\n\t\t\t\t\t: false;\n\t\t\tconst isReceivedByViewer = viewerId\n\t\t\t\t? senderId !== viewerId\n\t\t\t\t: viewerType\n\t\t\t\t\t? senderType !== viewerType\n\t\t\t\t\t: true;\n\n\t\t\t// Convenience flags\n\t\t\tconst isVisitor = senderType === \"visitor\";\n\t\t\tconst isAI = senderType === \"ai\";\n\t\t\tconst isTeamMember = senderType === \"team_member\";\n\n\t\t\t// Check if viewer has seen these timeline items\n\t\t\tconst hasBeenSeenByViewer = viewerId\n\t\t\t\t? seenByIds.includes(viewerId)\n\t\t\t\t: undefined;\n\n\t\t\tconst renderProps: TimelineItemGroupRenderProps = {\n\t\t\t\tsenderType,\n\t\t\t\tsenderId,\n\t\t\t\tviewerType,\n\t\t\t\tisSentByViewer,\n\t\t\t\tisReceivedByViewer,\n\t\t\t\tisVisitor,\n\t\t\t\tisAI,\n\t\t\t\tisTeamMember,\n\t\t\t\titemCount: items.length,\n\t\t\t\tfirstItemId: firstItem?.id,\n\t\t\t\tlastItemId: lastItem?.id,\n\t\t\t\thasBeenSeenByViewer,\n\t\t\t\tseenByIds,\n\t\t\t};\n\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\" ? children(renderProps) : children;\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"div\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref,\n\t\t\t\t\tstate: renderProps,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\trole: \"group\",\n\t\t\t\t\t\t\"aria-label\": `Timeline item group from ${senderType}`,\n\t\t\t\t\t\t...elementProps,\n\t\t\t\t\t\tchildren: content,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"TimelineItemGroup\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupAvatarProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Optional slot rendered next to a grouped batch to display an avatar, agent\n * badge or any other sender metadata supplied by the consumer UI.\n */\nexport const TimelineItemGroupAvatar = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupAvatarProps\n\t>(({ children, className, asChild = false, ...props }, ref) =>\n\t\tuseRenderElement(\n\t\t\t\"div\",\n\t\t\t{\n\t\t\t\tclassName,\n\t\t\t\tasChild,\n\t\t\t},\n\t\t\t{\n\t\t\t\tref,\n\t\t\t\tprops: {\n\t\t\t\t\t...props,\n\t\t\t\t\tchildren,\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\t);\n\n\tComponent.displayName = \"TimelineItemGroupAvatar\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupHeaderProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: {\n\t\t\t\tname?: string;\n\t\t\t\tsenderId?: string;\n\t\t\t\tsenderType?: SenderType;\n\t\t }) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\tname?: string;\n\tsenderId?: string;\n\tsenderType?: SenderType;\n};\n\n/**\n * Decorative or semantic wrapper rendered above a timeline item batch. Useful for\n * injecting agent names, timestamps or custom status labels tied to the sender\n * metadata supplied by `TimelineItemGroup`.\n */\nexport const TimelineItemGroupHeader = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupHeaderProps\n\t>(\n\t\t(\n\t\t\t{\n\t\t\t\tchildren,\n\t\t\t\tclassName,\n\t\t\t\tasChild = false,\n\t\t\t\tname,\n\t\t\t\tsenderId,\n\t\t\t\tsenderType,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\"\n\t\t\t\t\t? children({ name, senderId, senderType })\n\t\t\t\t\t: children;\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"div\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tchildren: content,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"TimelineItemGroupHeader\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupContentProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?: React.ReactNode;\n\tasChild?: boolean;\n\tclassName?: string;\n};\n\n/**\n * Container for the actual timeline items within a batch. Consumers can\n * override the structure while inheriting layout props passed down from the\n * parent group.\n */\nexport const TimelineItemGroupContent = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupContentProps\n\t>(({ children, className, asChild = false, ...props }, ref) =>\n\t\tuseRenderElement(\n\t\t\t\"div\",\n\t\t\t{\n\t\t\t\tclassName,\n\t\t\t\tasChild,\n\t\t\t},\n\t\t\t{\n\t\t\t\tref,\n\t\t\t\tprops: {\n\t\t\t\t\t...props,\n\t\t\t\t\tchildren,\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\t);\n\n\tComponent.displayName = \"TimelineItemGroupContent\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupSeenIndicatorProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: {\n\t\t\t\tseenByIds: readonly string[];\n\t\t\t\thasBeenSeen: boolean;\n\t\t }) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\tseenByIds?: readonly string[];\n};\n\n/**\n * Utility slot for showing who has viewed the most recent timeline item in the\n * group. Works with simple text children or a render prop for advanced\n * displays.\n */\nexport const TimelineItemGroupSeenIndicator = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupSeenIndicatorProps\n\t>(\n\t\t(\n\t\t\t{\n\t\t\t\tchildren,\n\t\t\t\tclassName,\n\t\t\t\tasChild = false,\n\t\t\t\tseenByIds = [] as readonly string[],\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\tconst hasBeenSeen = seenByIds.length > 0;\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\"\n\t\t\t\t\t? children({ seenByIds, hasBeenSeen })\n\t\t\t\t\t: children;\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"div\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tchildren: content,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"TimelineItemGroupSeenIndicator\";\n\treturn Component;\n})();\n\nexport type TimelineItemGroupReadIndicatorProps = Omit<\n\tReact.HTMLAttributes<HTMLDivElement>,\n\t\"children\"\n> & {\n\tchildren?:\n\t\t| React.ReactNode\n\t\t| ((props: {\n\t\t\t\treaders: Array<{ userId: string; isLastRead: boolean }>;\n\t\t\t\tlastReaderIds: string[];\n\t\t }) => React.ReactNode);\n\tasChild?: boolean;\n\tclassName?: string;\n\titemId: string;\n\tlastReadItemIds?: Map<string, string>;\n};\n\n/**\n * Renders read receipts for the tail timeline item in a group. It surfaces the list\n * of readers and callers can decide whether to render avatars, tooltips or a\n * basic label.\n */\nexport const TimelineItemGroupReadIndicator = (() => {\n\tconst Component = React.forwardRef<\n\t\tHTMLDivElement,\n\t\tTimelineItemGroupReadIndicatorProps\n\t>(\n\t\t(\n\t\t\t{\n\t\t\t\tchildren,\n\t\t\t\tclassName,\n\t\t\t\tasChild = false,\n\t\t\t\titemId,\n\t\t\t\tlastReadItemIds,\n\t\t\t\t...props\n\t\t\t},\n\t\t\tref\n\t\t) => {\n\t\t\t// Find all users who stopped reading at this timeline item\n\t\t\tconst { lastReaderIds, readers } = React.useMemo(() => {\n\t\t\t\tconst _lastReaderIds: string[] = [];\n\t\t\t\tconst _readers: Array<{ userId: string; isLastRead: boolean }> = [];\n\n\t\t\t\tif (lastReadItemIds) {\n\t\t\t\t\tlastReadItemIds.forEach((lastItemId, userId) => {\n\t\t\t\t\t\tif (lastItemId === itemId) {\n\t\t\t\t\t\t\t_lastReaderIds.push(userId);\n\t\t\t\t\t\t\t_readers.push({ userId, isLastRead: true });\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\treturn { lastReaderIds: _lastReaderIds, readers: _readers };\n\t\t\t}, [itemId, lastReadItemIds]);\n\n\t\t\tconst content =\n\t\t\t\ttypeof children === \"function\"\n\t\t\t\t\t? children({ readers, lastReaderIds })\n\t\t\t\t\t: children;\n\n\t\t\treturn useRenderElement(\n\t\t\t\t\"div\",\n\t\t\t\t{\n\t\t\t\t\tclassName,\n\t\t\t\t\tasChild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tref,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tchildren: content,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\tComponent.displayName = \"TimelineItemGroupReadIndicator\";\n\treturn Component;\n})();\n"],"mappings":";;;;;;;;;;;AA6DA,MAAa,2BAA2B;CACvC,MAAM,YAAYA,QAAM,YAEtB,EACC,UACA,WACA,UAAU,OACV,QAAQ,EAAE,EACV,UACA,YAAY,EAAE,EACd,iBACA,GAAG,aAEJ,QACI;EACJ,MAAM,EAAE,YAAY,GAAG,iBAAiB;EAGxC,MAAM,YAAY,MAAM;EACxB,MAAM,WAAW,MAAM,GAAG,GAAG;EAE7B,MAAM,EAAE,UAAU,eAAe,YAC9B,sBAAsB,UAAU,GAChC;GAAE,UAAU;GAAW,YAAY;GAA6B;EAGnE,MAAM,iBAAiB,WACpB,aAAa,WACb,aACC,eAAe,aACf;EACJ,MAAM,qBAAqB,WACxB,aAAa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;GACH;GACA;EACD,CACD,CACD;AAED,WAAU,cAAc;AACxB,QAAO;IACJ;;;;;;AAsBJ,MAAa,wCAAwC;CACpD,MAAM,YAAYA,QAAM,YAKtB,EACC,UACA,WACA,UAAU,OACV,YAAY,EAAE,EACd,GAAG,SAEJ,QACI;EACJ,MAAM,cAAc,UAAU,SAAS;EACvC,MAAM,UACL,OAAO,aAAa,aACjB,SAAS;GAAE;GAAW;GAAa,CAAC,GACpC;AAEJ,SAAO,iBACN,OACA;GACC;GACA;GACA,EACD;GACC;GACA,OAAO;IACN,GAAG;IACH,UAAU;IACV;GACD,CACD;GAEF;AAED,WAAU,cAAc;AACxB,QAAO;IACJ;;;;;;AAuBJ,MAAa,wCAAwC;CACpD,MAAM,YAAYA,QAAM,YAKtB,EACC,UACA,WACA,UAAU,OACV,QACA,iBACA,GAAG,SAEJ,QACI;EAEJ,MAAM,EAAE,eAAe,YAAYA,QAAM,cAAc;GACtD,MAAME,iBAA2B,EAAE;GACnC,MAAMC,WAA2D,EAAE;AAEnE,OAAI,gBACH,iBAAgB,SAAS,YAAY,WAAW;AAC/C,QAAI,eAAe,QAAQ;AAC1B,oBAAe,KAAK,OAAO;AAC3B,cAAS,KAAK;MAAE;MAAQ,YAAY;MAAM,CAAC;;KAE3C;AAGH,UAAO;IAAE,eAAe;IAAgB,SAAS;IAAU;KACzD,CAAC,QAAQ,gBAAgB,CAAC;EAE7B,MAAM,UACL,OAAO,aAAa,aACjB,SAAS;GAAE;GAAS;GAAe,CAAC,GACpC;AAEJ,SAAO,iBACN,OACA;GACC;GACA;GACA,EACD;GACC;GACA,OAAO;IACN,GAAG;IACH,UAAU;IACV;GACD,CACD;GAEF;AAED,WAAU,cAAc;AACxB,QAAO;IACJ"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TimelineItem as TimelineItem$1 } from "../packages/types/src/api/timeline-item.js";
|
|
2
|
+
import { CommandVariants } from "./command-block-utils.js";
|
|
2
3
|
import * as React$1 from "react";
|
|
3
4
|
|
|
4
5
|
//#region src/primitives/timeline-item.d.ts
|
|
@@ -33,12 +34,30 @@ declare const TimelineItem: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLA
|
|
|
33
34
|
className?: string;
|
|
34
35
|
item: TimelineItem$1;
|
|
35
36
|
} & React$1.RefAttributes<HTMLDivElement>>;
|
|
37
|
+
type TimelineInlineCodeRendererProps = {
|
|
38
|
+
code: string;
|
|
39
|
+
};
|
|
40
|
+
type TimelineCodeBlockRendererProps = {
|
|
41
|
+
code: string;
|
|
42
|
+
language?: string;
|
|
43
|
+
fileName?: string;
|
|
44
|
+
};
|
|
45
|
+
type TimelineCommandBlockRendererProps = {
|
|
46
|
+
command: string;
|
|
47
|
+
commands: CommandVariants;
|
|
48
|
+
};
|
|
49
|
+
type TimelineItemContentMarkdownRenderers = {
|
|
50
|
+
inlineCode?: (props: TimelineInlineCodeRendererProps) => React$1.ReactNode;
|
|
51
|
+
codeBlock?: (props: TimelineCodeBlockRendererProps) => React$1.ReactNode;
|
|
52
|
+
commandBlock?: (props: TimelineCommandBlockRendererProps) => React$1.ReactNode;
|
|
53
|
+
};
|
|
36
54
|
type TimelineItemContentProps = Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
37
55
|
children?: React$1.ReactNode | ((content: string) => React$1.ReactNode);
|
|
38
56
|
asChild?: boolean;
|
|
39
57
|
className?: string;
|
|
40
58
|
text?: string | null;
|
|
41
59
|
renderMarkdown?: boolean;
|
|
60
|
+
markdownRenderers?: TimelineItemContentMarkdownRenderers;
|
|
42
61
|
};
|
|
43
62
|
/**
|
|
44
63
|
* Renders the content of a timeline item, optionally piping Markdown content through a
|
|
@@ -51,6 +70,7 @@ declare const TimelineItemContent: React$1.ForwardRefExoticComponent<Omit<React$
|
|
|
51
70
|
className?: string;
|
|
52
71
|
text?: string | null;
|
|
53
72
|
renderMarkdown?: boolean;
|
|
73
|
+
markdownRenderers?: TimelineItemContentMarkdownRenderers;
|
|
54
74
|
} & React$1.RefAttributes<HTMLDivElement>>;
|
|
55
75
|
type TimelineItemTimestampProps = Omit<React$1.HTMLAttributes<HTMLSpanElement>, "children"> & {
|
|
56
76
|
children?: React$1.ReactNode | ((timestamp: Date) => React$1.ReactNode);
|
|
@@ -71,5 +91,5 @@ declare const TimelineItemTimestamp: React$1.ForwardRefExoticComponent<Omit<Reac
|
|
|
71
91
|
format?: (date: Date) => string;
|
|
72
92
|
} & React$1.RefAttributes<HTMLSpanElement>>;
|
|
73
93
|
//#endregion
|
|
74
|
-
export { TimelineItem, TimelineItemContent, TimelineItemContentProps, TimelineItemProps, TimelineItemRenderProps, TimelineItemTimestamp, TimelineItemTimestampProps };
|
|
94
|
+
export { TimelineCodeBlockRendererProps, TimelineCommandBlockRendererProps, TimelineInlineCodeRendererProps, TimelineItem, TimelineItemContent, TimelineItemContentMarkdownRenderers, TimelineItemContentProps, TimelineItemProps, TimelineItemRenderProps, TimelineItemTimestamp, TimelineItemTimestampProps };
|
|
75
95
|
//# sourceMappingURL=timeline-item.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline-item.d.ts","names":[],"sources":["../../src/primitives/timeline-item.tsx"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"timeline-item.d.ts","names":[],"sources":["../../src/primitives/timeline-item.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAoBA;AAUA;AACsB,KAXV,uBAAA,GAWU;EAArB,SAAM,EAAA,OAAA;EADyB,IAAA,EAAA,OAAA;EAK5B,OAAM,EAAA,OAAA;EACG,SAAA,EAZD,IAYC;EAA4B,IAAA,EAAM,MAAA,GAAA,IAAA;EAGxC,UAAA,EAAA,SAAA,GAAA,IAAA,GAAA,OAAA;EAAgB,QAAA,EAAA,SAAA,GAAA,OAAA,GAAA,gBAAA,GAAA,MAAA;AAQvB,CAAA;AAAyB,KAjBb,iBAAA,GAAoB,IAiBP,CAhBxB,OAAA,CAAM,cAgBkB,CAhBH,cAgBG,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