@memori.ai/memori-react 8.4.0-rc.6 → 8.4.0-rc.7
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/CHANGELOG.md +7 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +7 -4
- package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +8 -5
- package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -1
- package/package.json +1 -1
- package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.tsx +14 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
## [8.4.0-rc.7](https://github.com/memori-ai/memori-react/compare/v8.4.0-rc.6...v8.4.0-rc.7) (2025-09-09)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Changes
|
|
7
|
+
|
|
8
|
+
* update ArtifactHandler to use local state for currentArtifact ([8273c7d](https://github.com/memori-ai/memori-react/commit/8273c7dfb1ba2fcac039c68454b27eac0870f05e))
|
|
9
|
+
|
|
3
10
|
## [8.4.0-rc.6](https://github.com/memori-ai/memori-react/compare/v8.4.0-rc.5...v8.4.0-rc.6) (2025-09-09)
|
|
4
11
|
|
|
5
12
|
|
|
@@ -10,8 +10,9 @@ const ChevronDown_1 = tslib_1.__importDefault(require("../../../icons/ChevronDow
|
|
|
10
10
|
const ChevronLeft_1 = tslib_1.__importDefault(require("../../../icons/ChevronLeft"));
|
|
11
11
|
const ChevronUp_1 = tslib_1.__importDefault(require("../../../icons/ChevronUp"));
|
|
12
12
|
const ArtifactHandler = ({ isChatlogPanel = false, message, }) => {
|
|
13
|
-
var _a, _b, _c
|
|
13
|
+
var _a, _b, _c;
|
|
14
14
|
const { openArtifact, state, closeArtifact } = (0, ArtifactContext_1.useArtifact)();
|
|
15
|
+
const [currentArtifact, setCurrentArtifact] = (0, react_1.useState)(null);
|
|
15
16
|
(0, react_1.useEffect)(() => {
|
|
16
17
|
const messageText = message.translatedText || message.text || '';
|
|
17
18
|
if (!state.isDrawerOpen && messageText.length > 0) {
|
|
@@ -19,6 +20,7 @@ const ArtifactHandler = ({ isChatlogPanel = false, message, }) => {
|
|
|
19
20
|
if (artifacts.length > 0) {
|
|
20
21
|
setTimeout(() => {
|
|
21
22
|
openArtifact(artifacts[0]);
|
|
23
|
+
setCurrentArtifact(artifacts[0]);
|
|
22
24
|
}, 100);
|
|
23
25
|
}
|
|
24
26
|
}
|
|
@@ -52,13 +54,14 @@ const ArtifactHandler = ({ isChatlogPanel = false, message, }) => {
|
|
|
52
54
|
if (artifacts.length === 0)
|
|
53
55
|
return null;
|
|
54
56
|
return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: [(0, jsx_runtime_1.jsxs)("div", { className: "memori-artifact-handler", onClick: () => {
|
|
55
|
-
|
|
57
|
+
var _a;
|
|
58
|
+
if (state.isDrawerOpen && ((_a = state.currentArtifact) === null || _a === void 0 ? void 0 : _a.id) === (currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.id)) {
|
|
56
59
|
closeArtifact();
|
|
57
60
|
}
|
|
58
61
|
else {
|
|
59
|
-
openArtifact(
|
|
62
|
+
openArtifact(currentArtifact);
|
|
60
63
|
}
|
|
61
|
-
}, children: [(0, jsx_runtime_1.jsx)("div", { className: "memori-artifact-handler-icon", children: "\uD83D\uDCC4" }), (0, jsx_runtime_1.jsxs)("div", { className: "memori-artifact-handler-info", children: [(0, jsx_runtime_1.jsx)("div", { className: "memori-artifact-handler-title", children:
|
|
64
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { className: "memori-artifact-handler-icon", children: "\uD83D\uDCC4" }), (0, jsx_runtime_1.jsxs)("div", { className: "memori-artifact-handler-info", children: [(0, jsx_runtime_1.jsx)("div", { className: "memori-artifact-handler-title", children: currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.title }), (0, jsx_runtime_1.jsxs)("div", { className: "memori-artifact-handler-meta", children: [currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.mimeType, " \u2022", ' ', formatBytes((currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.size) || 0)] })] }), (0, jsx_runtime_1.jsx)("div", { className: "memori-artifact-handler-action", children: isChatlogPanel ? (state.isDrawerOpen && ((_a = state.currentArtifact) === null || _a === void 0 ? void 0 : _a.id) === (currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.id) ? ((0, jsx_runtime_1.jsx)(ChevronUp_1.default, { className: "memori-artifact-handler-action-icon" })) : ((0, jsx_runtime_1.jsx)(ChevronDown_1.default, { className: "memori-artifact-handler-action-icon" }))) : state.isDrawerOpen && ((_b = state.currentArtifact) === null || _b === void 0 ? void 0 : _b.id) === (currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.id) ? ((0, jsx_runtime_1.jsx)(ChevronLeft_1.default, { className: "memori-artifact-handler-action-icon" })) : ((0, jsx_runtime_1.jsx)(ChevronRight_1.default, { className: "memori-artifact-handler-action-icon" })) })] }, currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.id), isChatlogPanel && state.isDrawerOpen && ((_c = state.currentArtifact) === null || _c === void 0 ? void 0 : _c.id) === (currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.id) && ((0, jsx_runtime_1.jsx)(ArtifactDrawer_1.default, { isChatLogPanel: isChatlogPanel }))] }));
|
|
62
65
|
};
|
|
63
66
|
const formatBytes = (bytes) => {
|
|
64
67
|
if (bytes === 0)
|
package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArtifactHandler.js","sourceRoot":"","sources":["../../../../../src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.tsx"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"ArtifactHandler.js","sourceRoot":"","sources":["../../../../../src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.tsx"],"names":[],"mappings":";;;;AAAA,iCAAmD;AACnD,mEAA4D;AAE5D,uFAAuD;AACvD,8FAA8D;AAC9D,qFAAqD;AACrD,qFAAqD;AACrD,iFAAiD;AAQjD,MAAM,eAAe,GAAmC,CAAC,EACvD,cAAc,GAAG,KAAK,EACtB,OAAO,GACR,EAAE,EAAE;;IACH,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,IAAA,6BAAW,GAAE,CAAC;IAC7D,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,IAAA,gBAAQ,EAAsB,IAAI,CAAC,CAAC;IAGlF,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,IAAI,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;QACjE,IAAI,CAAC,KAAK,CAAC,YAAY,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;YACjD,MAAM,SAAS,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;YAE/C,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;gBACxB,UAAU,CAAC,GAAG,EAAE;oBACd,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC3B,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;gBACnC,CAAC,EAAE,GAAG,CAAC,CAAC;aACT;SACF;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAGd,MAAM,eAAe,GAAG,CAAC,IAAY,EAAkB,EAAE;QACvD,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,QAAQ;YAAE,OAAO,EAAE,CAAC;QAEzC,MAAM,aAAa,GAC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,EAGL,cAAc,IAAI,KAAK,CAAC,YAAY,IAAI,CAAA,MAAA,KAAK,CAAC,eAAe,0CAAE,EAAE,OAAK,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,EAAE,CAAA,IAAI,CAC5F,uBAAC,wBAAc,IAAC,cAAc,EAAE,cAAc,GAAI,CACnD,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,KAAa,EAAU,EAAE;IAC5C,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAClC,MAAM,CAAC,GAAG,IAAI,CAAC;IACf,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,OAAO,UAAU,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAC1E,CAAC,CAAC;AAEF,kBAAe,eAAe,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect } from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
3
|
import { useArtifact } from '../../context/ArtifactContext';
|
|
4
4
|
import ChevronRight from '../../../icons/ChevronRight';
|
|
5
5
|
import ArtifactDrawer from '../ArtifactDrawer/ArtifactDrawer';
|
|
@@ -7,8 +7,9 @@ import ChevronDown from '../../../icons/ChevronDown';
|
|
|
7
7
|
import ChevronLeft from '../../../icons/ChevronLeft';
|
|
8
8
|
import ChevronUp from '../../../icons/ChevronUp';
|
|
9
9
|
const ArtifactHandler = ({ isChatlogPanel = false, message, }) => {
|
|
10
|
-
var _a, _b, _c
|
|
10
|
+
var _a, _b, _c;
|
|
11
11
|
const { openArtifact, state, closeArtifact } = useArtifact();
|
|
12
|
+
const [currentArtifact, setCurrentArtifact] = useState(null);
|
|
12
13
|
useEffect(() => {
|
|
13
14
|
const messageText = message.translatedText || message.text || '';
|
|
14
15
|
if (!state.isDrawerOpen && messageText.length > 0) {
|
|
@@ -16,6 +17,7 @@ const ArtifactHandler = ({ isChatlogPanel = false, message, }) => {
|
|
|
16
17
|
if (artifacts.length > 0) {
|
|
17
18
|
setTimeout(() => {
|
|
18
19
|
openArtifact(artifacts[0]);
|
|
20
|
+
setCurrentArtifact(artifacts[0]);
|
|
19
21
|
}, 100);
|
|
20
22
|
}
|
|
21
23
|
}
|
|
@@ -49,13 +51,14 @@ const ArtifactHandler = ({ isChatlogPanel = false, message, }) => {
|
|
|
49
51
|
if (artifacts.length === 0)
|
|
50
52
|
return null;
|
|
51
53
|
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: [_jsxs("div", { className: "memori-artifact-handler", onClick: () => {
|
|
52
|
-
|
|
54
|
+
var _a;
|
|
55
|
+
if (state.isDrawerOpen && ((_a = state.currentArtifact) === null || _a === void 0 ? void 0 : _a.id) === (currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.id)) {
|
|
53
56
|
closeArtifact();
|
|
54
57
|
}
|
|
55
58
|
else {
|
|
56
|
-
openArtifact(
|
|
59
|
+
openArtifact(currentArtifact);
|
|
57
60
|
}
|
|
58
|
-
}, children: [_jsx("div", { className: "memori-artifact-handler-icon", children: "\uD83D\uDCC4" }), _jsxs("div", { className: "memori-artifact-handler-info", children: [_jsx("div", { className: "memori-artifact-handler-title", children:
|
|
61
|
+
}, children: [_jsx("div", { className: "memori-artifact-handler-icon", children: "\uD83D\uDCC4" }), _jsxs("div", { className: "memori-artifact-handler-info", children: [_jsx("div", { className: "memori-artifact-handler-title", children: currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.title }), _jsxs("div", { className: "memori-artifact-handler-meta", children: [currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.mimeType, " \u2022", ' ', formatBytes((currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.size) || 0)] })] }), _jsx("div", { className: "memori-artifact-handler-action", children: isChatlogPanel ? (state.isDrawerOpen && ((_a = state.currentArtifact) === null || _a === void 0 ? void 0 : _a.id) === (currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.id) ? (_jsx(ChevronUp, { className: "memori-artifact-handler-action-icon" })) : (_jsx(ChevronDown, { className: "memori-artifact-handler-action-icon" }))) : state.isDrawerOpen && ((_b = state.currentArtifact) === null || _b === void 0 ? void 0 : _b.id) === (currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.id) ? (_jsx(ChevronLeft, { className: "memori-artifact-handler-action-icon" })) : (_jsx(ChevronRight, { className: "memori-artifact-handler-action-icon" })) })] }, currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.id), isChatlogPanel && state.isDrawerOpen && ((_c = state.currentArtifact) === null || _c === void 0 ? void 0 : _c.id) === (currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.id) && (_jsx(ArtifactDrawer, { isChatLogPanel: isChatlogPanel }))] }));
|
|
59
62
|
};
|
|
60
63
|
const formatBytes = (bytes) => {
|
|
61
64
|
if (bytes === 0)
|
package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArtifactHandler.js","sourceRoot":"","sources":["../../../../../src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ArtifactHandler.js","sourceRoot":"","sources":["../../../../../src/components/MemoriArtif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uBAAf,eAAe,CAAE,EAAE,CAiCpB,EAGL,cAAc,IAAI,KAAK,CAAC,YAAY,IAAI,CAAA,MAAA,KAAK,CAAC,eAAe,0CAAE,EAAE,OAAK,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,EAAE,CAAA,IAAI,CAC5F,KAAC,cAAc,IAAC,cAAc,EAAE,cAAc,GAAI,CACnD,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,KAAa,EAAU,EAAE;IAC5C,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAClC,MAAM,CAAC,GAAG,IAAI,CAAC;IACf,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,OAAO,UAAU,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAC1E,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { useArtifact } from '../../context/ArtifactContext';
|
|
3
3
|
import { ArtifactData } from '../../types/artifact.types';
|
|
4
4
|
import ChevronRight from '../../../icons/ChevronRight';
|
|
@@ -18,6 +18,7 @@ const ArtifactHandler: React.FC<ArtifactHandlerProps> = ({
|
|
|
18
18
|
message,
|
|
19
19
|
}) => {
|
|
20
20
|
const { openArtifact, state, closeArtifact } = useArtifact();
|
|
21
|
+
const [currentArtifact, setCurrentArtifact] = useState<ArtifactData | null>(null);
|
|
21
22
|
|
|
22
23
|
// Auto-open artifacts when detected in new messages
|
|
23
24
|
useEffect(() => {
|
|
@@ -28,6 +29,7 @@ const ArtifactHandler: React.FC<ArtifactHandlerProps> = ({
|
|
|
28
29
|
if (artifacts.length > 0) {
|
|
29
30
|
setTimeout(() => {
|
|
30
31
|
openArtifact(artifacts[0]);
|
|
32
|
+
setCurrentArtifact(artifacts[0]);
|
|
31
33
|
}, 100);
|
|
32
34
|
}
|
|
33
35
|
}
|
|
@@ -68,37 +70,39 @@ const ArtifactHandler: React.FC<ArtifactHandlerProps> = ({
|
|
|
68
70
|
const artifacts = detectArtifacts(messageText);
|
|
69
71
|
|
|
70
72
|
if (artifacts.length === 0) return null;
|
|
73
|
+
|
|
74
|
+
|
|
71
75
|
return (
|
|
72
76
|
<div style={{ display: 'flex', flexDirection: 'column', gap: '10px' }}>
|
|
73
77
|
<div
|
|
74
|
-
key={
|
|
78
|
+
key={currentArtifact?.id}
|
|
75
79
|
className="memori-artifact-handler"
|
|
76
80
|
onClick={() => {
|
|
77
|
-
if (state.isDrawerOpen) {
|
|
81
|
+
if (state.isDrawerOpen && state.currentArtifact?.id === currentArtifact?.id) {
|
|
78
82
|
closeArtifact();
|
|
79
83
|
} else {
|
|
80
|
-
openArtifact(
|
|
84
|
+
openArtifact(currentArtifact as ArtifactData);
|
|
81
85
|
}
|
|
82
86
|
}}
|
|
83
87
|
>
|
|
84
88
|
<div className="memori-artifact-handler-icon">📄</div>
|
|
85
89
|
<div className="memori-artifact-handler-info">
|
|
86
90
|
<div className="memori-artifact-handler-title">
|
|
87
|
-
{
|
|
91
|
+
{currentArtifact?.title}
|
|
88
92
|
</div>
|
|
89
93
|
<div className="memori-artifact-handler-meta">
|
|
90
|
-
{
|
|
91
|
-
{formatBytes(
|
|
94
|
+
{currentArtifact?.mimeType} •{' '}
|
|
95
|
+
{formatBytes(currentArtifact?.size || 0)}
|
|
92
96
|
</div>
|
|
93
97
|
</div>
|
|
94
98
|
<div className="memori-artifact-handler-action">
|
|
95
99
|
{isChatlogPanel ? (
|
|
96
|
-
state.isDrawerOpen ? (
|
|
100
|
+
state.isDrawerOpen && state.currentArtifact?.id === currentArtifact?.id ? (
|
|
97
101
|
<ChevronUp className="memori-artifact-handler-action-icon" />
|
|
98
102
|
) : (
|
|
99
103
|
<ChevronDown className="memori-artifact-handler-action-icon" />
|
|
100
104
|
)
|
|
101
|
-
) : state.isDrawerOpen ? (
|
|
105
|
+
) : state.isDrawerOpen && state.currentArtifact?.id === currentArtifact?.id ? (
|
|
102
106
|
<ChevronLeft className="memori-artifact-handler-action-icon" />
|
|
103
107
|
) : (
|
|
104
108
|
<ChevronRight className="memori-artifact-handler-action-icon" />
|
|
@@ -107,7 +111,7 @@ const ArtifactHandler: React.FC<ArtifactHandlerProps> = ({
|
|
|
107
111
|
</div>
|
|
108
112
|
|
|
109
113
|
{/* Render ArtifactDrawer inline when in chatlog panel */}
|
|
110
|
-
{isChatlogPanel && state.isDrawerOpen && (
|
|
114
|
+
{isChatlogPanel && state.isDrawerOpen && state.currentArtifact?.id === currentArtifact?.id && (
|
|
111
115
|
<ArtifactDrawer isChatLogPanel={isChatlogPanel} />
|
|
112
116
|
)}
|
|
113
117
|
</div>
|