@djangocfg/ui-tools 2.1.355 → 2.1.357
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/dist/ChatRoot-6U7633X3.mjs +5 -0
- package/dist/{ChatRoot-2KT32NFJ.cjs.map → ChatRoot-6U7633X3.mjs.map} +1 -1
- package/dist/ChatRoot-HARTIAJ5.cjs +14 -0
- package/dist/{ChatRoot-VSIBJLE2.mjs.map → ChatRoot-HARTIAJ5.cjs.map} +1 -1
- package/dist/{DocsLayout-VFPPNKSQ.mjs → DocsLayout-HGYIJTF3.mjs} +4 -4
- package/dist/{DocsLayout-VFPPNKSQ.mjs.map → DocsLayout-HGYIJTF3.mjs.map} +1 -1
- package/dist/{DocsLayout-N5ZJZPBY.cjs → DocsLayout-OQHDNKZE.cjs} +11 -11
- package/dist/{DocsLayout-N5ZJZPBY.cjs.map → DocsLayout-OQHDNKZE.cjs.map} +1 -1
- package/dist/JsonTree-43PQAJKY.mjs +5 -0
- package/dist/{JsonTree-55625VVH.mjs.map → JsonTree-43PQAJKY.mjs.map} +1 -1
- package/dist/JsonTree-X6W5YEVY.cjs +11 -0
- package/dist/{JsonTree-DCM5QGWF.cjs.map → JsonTree-X6W5YEVY.cjs.map} +1 -1
- package/dist/TreeRoot-5COOOSWG.mjs +4 -0
- package/dist/{TreeRoot-N72OYKXU.cjs.map → TreeRoot-5COOOSWG.mjs.map} +1 -1
- package/dist/TreeRoot-AABP2J6Y.cjs +19 -0
- package/dist/{TreeRoot-VGAIXCUA.mjs.map → TreeRoot-AABP2J6Y.cjs.map} +1 -1
- package/dist/{chunk-5G5YBFS6.mjs → chunk-ECONRHIG.mjs} +7 -7
- package/dist/chunk-ECONRHIG.mjs.map +1 -0
- package/dist/{chunk-IEEAENLX.cjs → chunk-FVVF7VCD.cjs} +14 -10
- package/dist/chunk-FVVF7VCD.cjs.map +1 -0
- package/dist/{chunk-2ZLKZ5VR.mjs → chunk-NWUT327A.mjs} +110 -32
- package/dist/chunk-NWUT327A.mjs.map +1 -0
- package/dist/{chunk-2SXDCXLK.cjs → chunk-OPKFKTIN.cjs} +17 -15
- package/dist/chunk-OPKFKTIN.cjs.map +1 -0
- package/dist/{chunk-SGP7V2UW.cjs → chunk-T3MWM23F.cjs} +6 -6
- package/dist/chunk-T3MWM23F.cjs.map +1 -0
- package/dist/{chunk-XJ7CXHSU.mjs → chunk-WGU5BEZX.mjs} +16 -14
- package/dist/chunk-WGU5BEZX.mjs.map +1 -0
- package/dist/{chunk-B5AWZOHJ.cjs → chunk-XACCHZH2.cjs} +119 -41
- package/dist/chunk-XACCHZH2.cjs.map +1 -0
- package/dist/{chunk-G5IEC7SR.mjs → chunk-ZL7FH4NW.mjs} +15 -11
- package/dist/chunk-ZL7FH4NW.mjs.map +1 -0
- package/dist/index.cjs +93 -93
- package/dist/index.d.cts +39 -4
- package/dist/index.d.ts +39 -4
- package/dist/index.mjs +10 -10
- package/dist/tree/index.cjs +33 -33
- package/dist/tree/index.d.cts +34 -4
- package/dist/tree/index.d.ts +34 -4
- package/dist/tree/index.mjs +1 -1
- package/package.json +6 -6
- package/src/components/markdown/MarkdownMessage/ActionRow.tsx +8 -3
- package/src/components/markdown/MarkdownMessage/ChatMessageRow.tsx +10 -4
- package/src/components/markdown/MarkdownMessage/CodeBlock.tsx +18 -6
- package/src/components/markdown/MarkdownMessage/CollapseToggle.tsx +13 -6
- package/src/components/markdown/MarkdownMessage/MarkdownMessage.tsx +10 -3
- package/src/tools/Chat/components/ChatRoot.tsx +12 -4
- package/src/tools/Chat/components/MessageActions.tsx +13 -3
- package/src/tools/Chat/components/StreamingIndicator.tsx +11 -1
- package/src/tools/JsonTree/components/JsonContent.tsx +13 -4
- package/src/tools/JsonTree/components/JsonToolbar.tsx +10 -3
- package/src/tools/JsonTree/index.tsx +10 -3
- package/src/tools/Tree/components/TreeChevron.tsx +10 -1
- package/src/tools/Tree/components/TreeIcon.tsx +11 -1
- package/src/tools/Tree/components/TreeLabel.tsx +10 -1
- package/src/tools/Tree/components/TreeRow.tsx +11 -1
- package/dist/ChatRoot-2KT32NFJ.cjs +0 -14
- package/dist/ChatRoot-VSIBJLE2.mjs +0 -5
- package/dist/JsonTree-55625VVH.mjs +0 -5
- package/dist/JsonTree-DCM5QGWF.cjs +0 -11
- package/dist/TreeRoot-N72OYKXU.cjs +0 -19
- package/dist/TreeRoot-VGAIXCUA.mjs +0 -4
- package/dist/chunk-2SXDCXLK.cjs.map +0 -1
- package/dist/chunk-2ZLKZ5VR.mjs.map +0 -1
- package/dist/chunk-5G5YBFS6.mjs.map +0 -1
- package/dist/chunk-B5AWZOHJ.cjs.map +0 -1
- package/dist/chunk-G5IEC7SR.mjs.map +0 -1
- package/dist/chunk-IEEAENLX.cjs.map +0 -1
- package/dist/chunk-SGP7V2UW.cjs.map +0 -1
- package/dist/chunk-XJ7CXHSU.mjs.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { memo } from 'react';
|
|
3
4
|
import { Copy, Pencil, RefreshCw, Trash } from 'lucide-react';
|
|
4
5
|
|
|
5
6
|
import { cn } from '@djangocfg/ui-core/lib';
|
|
@@ -16,7 +17,14 @@ export interface MessageActionsProps {
|
|
|
16
17
|
className?: string;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
/**
|
|
21
|
+
* MessageActions — copy/regenerate/edit/delete buttons for a chat bubble.
|
|
22
|
+
*
|
|
23
|
+
* Memoised: re-renders only when `role`, `hideOn`, `className` or
|
|
24
|
+
* any handler reference changes. Event handlers are compared by
|
|
25
|
+
* reference — callers should stabilise them with useCallback.
|
|
26
|
+
*/
|
|
27
|
+
function MessageActionsRaw({
|
|
20
28
|
role,
|
|
21
29
|
onCopy,
|
|
22
30
|
onRegenerate,
|
|
@@ -45,7 +53,7 @@ export function MessageActions({
|
|
|
45
53
|
);
|
|
46
54
|
}
|
|
47
55
|
|
|
48
|
-
function ActionButton({
|
|
56
|
+
const ActionButton = memo(function ActionButton({
|
|
49
57
|
onClick,
|
|
50
58
|
label,
|
|
51
59
|
icon: Icon,
|
|
@@ -69,4 +77,6 @@ function ActionButton({
|
|
|
69
77
|
<Icon aria-hidden className="size-3" />
|
|
70
78
|
</button>
|
|
71
79
|
);
|
|
72
|
-
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export const MessageActions = memo(MessageActionsRaw);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { memo } from 'react';
|
|
3
4
|
import { cn } from '@djangocfg/ui-core/lib';
|
|
4
5
|
|
|
5
6
|
export interface StreamingIndicatorProps {
|
|
@@ -8,7 +9,14 @@ export interface StreamingIndicatorProps {
|
|
|
8
9
|
className?: string;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
/**
|
|
13
|
+
* StreamingIndicator — animated dots or pulse for streaming state.
|
|
14
|
+
*
|
|
15
|
+
* Memoised: re-renders only when `variant`, `label` or `className`
|
|
16
|
+
* change. All props are primitives, so default shallow comparison is
|
|
17
|
+
* sufficient.
|
|
18
|
+
*/
|
|
19
|
+
function StreamingIndicatorRaw({ variant = 'dots', label, className }: StreamingIndicatorProps) {
|
|
12
20
|
return (
|
|
13
21
|
<span
|
|
14
22
|
className={cn('inline-flex items-center gap-1.5 text-xs text-muted-foreground', className)}
|
|
@@ -27,3 +35,5 @@ export function StreamingIndicator({ variant = 'dots', label, className }: Strea
|
|
|
27
35
|
</span>
|
|
28
36
|
);
|
|
29
37
|
}
|
|
38
|
+
|
|
39
|
+
export const StreamingIndicator = memo(StreamingIndicatorRaw);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { memo } from 'react';
|
|
4
4
|
import { CommonExternalProps, JSONTree } from 'react-json-tree';
|
|
5
5
|
|
|
6
6
|
const JSON_TREE_THEME = {
|
|
@@ -38,7 +38,13 @@ interface JsonContentProps {
|
|
|
38
38
|
jsonTreeProps?: Partial<CommonExternalProps>;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
/**
|
|
42
|
+
* JsonContent — react-json-tree wrapper with theming.
|
|
43
|
+
*
|
|
44
|
+
* Memoised: re-renders only when any prop changes. `data` is compared
|
|
45
|
+
* by reference — the parent should not mutate the object in place.
|
|
46
|
+
*/
|
|
47
|
+
const JsonContent = memo(({
|
|
42
48
|
data,
|
|
43
49
|
renderKey,
|
|
44
50
|
title,
|
|
@@ -51,7 +57,7 @@ export const JsonContent: React.FC<JsonContentProps> = ({
|
|
|
51
57
|
fontSize,
|
|
52
58
|
shouldExpandNodeInitially,
|
|
53
59
|
jsonTreeProps = {},
|
|
54
|
-
}) => {
|
|
60
|
+
}: JsonContentProps) => {
|
|
55
61
|
const getItemString = showCollectionInfo
|
|
56
62
|
? (nodeType: string, nodeData: unknown) => {
|
|
57
63
|
if (nodeType === 'Array') {
|
|
@@ -97,4 +103,7 @@ export const JsonContent: React.FC<JsonContentProps> = ({
|
|
|
97
103
|
/>
|
|
98
104
|
</div>
|
|
99
105
|
);
|
|
100
|
-
};
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
export { JsonContent };
|
|
109
|
+
export default JsonContent;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { ChevronDown, ChevronUp, Download } from 'lucide-react';
|
|
4
|
-
import React from 'react';
|
|
4
|
+
import React, { memo } from 'react';
|
|
5
5
|
|
|
6
6
|
import { Button, CopyButton } from '@djangocfg/ui-core/components';
|
|
7
7
|
|
|
@@ -24,7 +24,14 @@ const BUTTON_CLASS = 'h-6 w-6 rounded-sm bg-muted/80 hover:bg-muted border borde
|
|
|
24
24
|
const TOOLBAR_H = 24 + 8 + 8;
|
|
25
25
|
const OFFSET = 8;
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* JsonToolbar — floating toolbar for JsonTree.
|
|
29
|
+
*
|
|
30
|
+
* Memoised: re-renders only when any prop changes. Position props
|
|
31
|
+
* (`top`, `right`, `bottom`) are primitives, so default shallow
|
|
32
|
+
* comparison is sufficient.
|
|
33
|
+
*/
|
|
34
|
+
const JsonToolbar = memo(function JsonToolbar({
|
|
28
35
|
top,
|
|
29
36
|
right,
|
|
30
37
|
bottom,
|
|
@@ -34,7 +41,7 @@ export const JsonToolbar: React.FC<JsonToolbarProps> = ({
|
|
|
34
41
|
onDownload,
|
|
35
42
|
showExpandControls,
|
|
36
43
|
showActionButtons,
|
|
37
|
-
})
|
|
44
|
+
}: JsonToolbarProps) {
|
|
38
45
|
const viewportHeight = window.visualViewport?.height ?? document.documentElement.clientHeight;
|
|
39
46
|
|
|
40
47
|
// Hide when block is fully above or below viewport
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import React, { useMemo, useRef } from 'react';
|
|
3
|
+
import React, { memo, useMemo, useRef } from 'react';
|
|
4
4
|
|
|
5
5
|
import { FloatingToolbar } from '../../components/FloatingToolbar';
|
|
6
6
|
import { CopyAction, DownloadAction, ExpandAction } from '../../components/FloatingToolbar/actions';
|
|
@@ -11,7 +11,14 @@ import { JsonTreeComponentProps, MODE_PRESETS } from './types';
|
|
|
11
11
|
export type { Language } from 'prism-react-renderer';
|
|
12
12
|
export type { JsonTreeConfig, JsonTreeComponentProps, JsonTreeMode } from './types';
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* JsonTreeComponent — JSON viewer with expand/collapse, copy, download.
|
|
16
|
+
*
|
|
17
|
+
* Memoised: re-renders only when `title`, `data`, `mode`, `config` or
|
|
18
|
+
* `jsonTreeProps` change. `data` is compared by reference — the parent
|
|
19
|
+
* should not mutate the object in place.
|
|
20
|
+
*/
|
|
21
|
+
const JsonTreeComponent = memo(({
|
|
15
22
|
title,
|
|
16
23
|
data,
|
|
17
24
|
mode = 'full',
|
|
@@ -86,6 +93,6 @@ const JsonTreeComponent = ({
|
|
|
86
93
|
/>
|
|
87
94
|
</div>
|
|
88
95
|
);
|
|
89
|
-
};
|
|
96
|
+
});
|
|
90
97
|
|
|
91
98
|
export default JsonTreeComponent;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { ChevronDown, ChevronRight } from 'lucide-react';
|
|
4
|
+
import { memo } from 'react';
|
|
4
5
|
import { cn } from '@djangocfg/ui-core/lib';
|
|
5
6
|
|
|
6
7
|
import { useTreeContext } from '../context/TreeContext';
|
|
@@ -11,7 +12,13 @@ export interface TreeChevronProps {
|
|
|
11
12
|
className?: string;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
/**
|
|
16
|
+
* TreeChevron — expand/collapse chevron for a tree row.
|
|
17
|
+
*
|
|
18
|
+
* Memoised: re-renders only when `isExpanded`, `isFolder` or `className`
|
|
19
|
+
* change. Reads appearance from context.
|
|
20
|
+
*/
|
|
21
|
+
function TreeChevronRaw({ isExpanded, isFolder, className }: TreeChevronProps) {
|
|
15
22
|
const { appearance } = useTreeContext();
|
|
16
23
|
const size = { width: 'var(--tree-icon-size)', height: 'var(--tree-icon-size)' };
|
|
17
24
|
|
|
@@ -37,3 +44,5 @@ export function TreeChevron({ isExpanded, isFolder, className }: TreeChevronProp
|
|
|
37
44
|
/>
|
|
38
45
|
);
|
|
39
46
|
}
|
|
47
|
+
|
|
48
|
+
export const TreeChevron = memo(TreeChevronRaw);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { File, Folder, FolderOpen } from 'lucide-react';
|
|
4
|
+
import { memo } from 'react';
|
|
4
5
|
import { cn } from '@djangocfg/ui-core/lib';
|
|
5
6
|
|
|
6
7
|
import { useTreeContext } from '../context/TreeContext';
|
|
@@ -11,7 +12,14 @@ export interface TreeIconProps {
|
|
|
11
12
|
className?: string;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
/**
|
|
16
|
+
* TreeIcon — file/folder icon for a tree row.
|
|
17
|
+
*
|
|
18
|
+
* Memoised: re-renders only when `isFolder`, `isExpanded` or `className`
|
|
19
|
+
* change. Reads appearance from context — context updates will still
|
|
20
|
+
* trigger re-render as expected.
|
|
21
|
+
*/
|
|
22
|
+
function TreeIconRaw({ isFolder, isExpanded, className }: TreeIconProps) {
|
|
15
23
|
const { appearance } = useTreeContext();
|
|
16
24
|
const Icon = isFolder ? (isExpanded ? FolderOpen : Folder) : File;
|
|
17
25
|
return (
|
|
@@ -27,3 +35,5 @@ export function TreeIcon({ isFolder, isExpanded, className }: TreeIconProps) {
|
|
|
27
35
|
/>
|
|
28
36
|
);
|
|
29
37
|
}
|
|
38
|
+
|
|
39
|
+
export const TreeIcon = memo(TreeIconRaw);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { memo } from 'react';
|
|
3
4
|
import { cn } from '@djangocfg/ui-core/lib';
|
|
4
5
|
|
|
5
6
|
export interface TreeLabelProps {
|
|
@@ -8,7 +9,13 @@ export interface TreeLabelProps {
|
|
|
8
9
|
className?: string;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
/**
|
|
13
|
+
* TreeLabel — truncated label for a tree row.
|
|
14
|
+
*
|
|
15
|
+
* Memoised: re-renders only when `children`, `isMatchingSearch` or
|
|
16
|
+
* `className` change. `children` is compared by reference.
|
|
17
|
+
*/
|
|
18
|
+
function TreeLabelRaw({ children, isMatchingSearch, className }: TreeLabelProps) {
|
|
12
19
|
return (
|
|
13
20
|
<span
|
|
14
21
|
style={{ fontSize: 'var(--tree-font-size)' }}
|
|
@@ -22,3 +29,5 @@ export function TreeLabel({ children, isMatchingSearch, className }: TreeLabelPr
|
|
|
22
29
|
</span>
|
|
23
30
|
);
|
|
24
31
|
}
|
|
32
|
+
|
|
33
|
+
export const TreeLabel = memo(TreeLabelRaw);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { Loader2 } from 'lucide-react';
|
|
4
|
+
import { memo } from 'react';
|
|
4
5
|
import { cn } from '@djangocfg/ui-core/lib';
|
|
5
6
|
|
|
6
7
|
import { useTreeContext } from '../context/TreeContext';
|
|
@@ -16,7 +17,14 @@ export interface TreeRowProps<T> {
|
|
|
16
17
|
className?: string;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
/**
|
|
21
|
+
* TreeRow — single row in a virtualised tree.
|
|
22
|
+
*
|
|
23
|
+
* Memoised: re-renders only when `row` reference or `className` change.
|
|
24
|
+
* `row` is treated as immutable — the parent should not mutate node
|
|
25
|
+
* objects in place.
|
|
26
|
+
*/
|
|
27
|
+
function TreeRowRaw<T>({ row, className }: TreeRowProps<T>) {
|
|
20
28
|
const ctx = useTreeContext<T>();
|
|
21
29
|
const {
|
|
22
30
|
appearance,
|
|
@@ -170,3 +178,5 @@ export function TreeRow<T>({ row, className }: TreeRowProps<T>) {
|
|
|
170
178
|
}
|
|
171
179
|
return trigger;
|
|
172
180
|
}
|
|
181
|
+
|
|
182
|
+
export const TreeRow = memo(TreeRowRaw) as typeof TreeRowRaw;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunk2SXDCXLK_cjs = require('./chunk-2SXDCXLK.cjs');
|
|
4
|
-
require('./chunk-B5AWZOHJ.cjs');
|
|
5
|
-
require('./chunk-OLISEQHS.cjs');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "ChatRoot", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function () { return chunk2SXDCXLK_cjs.ChatRoot; }
|
|
12
|
-
});
|
|
13
|
-
//# sourceMappingURL=ChatRoot-2KT32NFJ.cjs.map
|
|
14
|
-
//# sourceMappingURL=ChatRoot-2KT32NFJ.cjs.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkSGP7V2UW_cjs = require('./chunk-SGP7V2UW.cjs');
|
|
4
|
-
require('./chunk-FP2RLYQZ.cjs');
|
|
5
|
-
require('./chunk-OLISEQHS.cjs');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
module.exports = chunkSGP7V2UW_cjs.JsonTree_default;
|
|
10
|
-
//# sourceMappingURL=JsonTree-DCM5QGWF.cjs.map
|
|
11
|
-
//# sourceMappingURL=JsonTree-DCM5QGWF.cjs.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var chunkIEEAENLX_cjs = require('./chunk-IEEAENLX.cjs');
|
|
6
|
-
require('./chunk-OLISEQHS.cjs');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(exports, "TreeRoot", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () { return chunkIEEAENLX_cjs.TreeRoot; }
|
|
13
|
-
});
|
|
14
|
-
Object.defineProperty(exports, "default", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () { return chunkIEEAENLX_cjs.TreeRoot_default; }
|
|
17
|
-
});
|
|
18
|
-
//# sourceMappingURL=TreeRoot-N72OYKXU.cjs.map
|
|
19
|
-
//# sourceMappingURL=TreeRoot-N72OYKXU.cjs.map
|