@ant-design/agentic-ui 2.0.28 → 2.2.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/dist/Hooks/useIntersectionOnce.d.ts +5 -0
- package/dist/Hooks/useIntersectionOnce.js +79 -0
- package/dist/MarkdownEditor/editor/store.d.ts +4 -0
- package/dist/MarkdownEditor/editor/store.js +110 -1
- package/dist/Plugins/chart/AreaChart/index.js +20 -9
- package/dist/Plugins/chart/BarChart/index.js +12 -1
- package/dist/Plugins/chart/ChartMark/Area.js +21 -10
- package/dist/Plugins/chart/ChartMark/Bar.js +19 -8
- package/dist/Plugins/chart/ChartMark/Column.js +19 -8
- package/dist/Plugins/chart/ChartMark/Line.js +20 -9
- package/dist/Plugins/chart/ChartMark/Pie.js +12 -1
- package/dist/Plugins/chart/ChartRender.js +182 -48
- package/dist/Plugins/chart/DonutChart/index.js +12 -1
- package/dist/Plugins/chart/FunnelChart/index.d.ts +2 -0
- package/dist/Plugins/chart/FunnelChart/index.js +69 -18
- package/dist/Plugins/chart/LineChart/index.js +20 -9
- package/dist/Plugins/chart/RadarChart/index.js +19 -8
- package/dist/Plugins/chart/ScatterChart/index.js +12 -1
- package/dist/Plugins/chart/loadChartRuntime.d.ts +18 -0
- package/dist/Plugins/chart/loadChartRuntime.js +91 -0
- package/dist/Plugins/defaultPlugins.d.ts +3 -0
- package/dist/Plugins/defaultPlugins.js +2 -0
- package/dist/Plugins/mermaid/Mermaid.d.ts +5 -2
- package/dist/Plugins/mermaid/Mermaid.js +131 -38
- package/dist/Plugins/mermaid/index.js +1 -1
- package/dist/TaskList/index.js +2 -8
- package/dist/TaskList/style.js +1 -7
- package/dist/ToolUseBar/ToolUseBarItem.js +43 -30
- package/dist/ToolUseBar/ToolUseBarItemComponents.js +53 -8
- package/dist/ToolUseBar/style.js +3 -1
- package/dist/ToolUseBar/thinkStyle.js +9 -1
- package/package.json +2 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export interface UseIntersectionOnceOptions extends Omit<IntersectionObserverInit, 'root'> {
|
|
3
|
+
root?: RefObject<Element | null> | Element | null;
|
|
4
|
+
}
|
|
5
|
+
export declare const useIntersectionOnce: <T extends Element>(targetRef: RefObject<T>, options?: UseIntersectionOnceOptions) => boolean;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// src/Hooks/useIntersectionOnce.ts
|
|
34
|
+
import { useEffect, useRef, useState } from "react";
|
|
35
|
+
var useIntersectionOnce = (targetRef, options = {}) => {
|
|
36
|
+
const _a = options, { root } = _a, restOptions = __objRest(_a, ["root"]);
|
|
37
|
+
const [isIntersecting, setIntersecting] = useState(false);
|
|
38
|
+
const observerRef = useRef(null);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (isIntersecting)
|
|
41
|
+
return;
|
|
42
|
+
const element = targetRef.current;
|
|
43
|
+
if (!element)
|
|
44
|
+
return;
|
|
45
|
+
if (typeof IntersectionObserver === "undefined") {
|
|
46
|
+
setIntersecting(true);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const resolvedRoot = root && "current" in root ? root.current : root;
|
|
50
|
+
observerRef.current = new IntersectionObserver(
|
|
51
|
+
(entries) => {
|
|
52
|
+
entries.forEach((entry) => {
|
|
53
|
+
var _a2;
|
|
54
|
+
if (entry.isIntersecting || entry.intersectionRatio > 0) {
|
|
55
|
+
setIntersecting(true);
|
|
56
|
+
(_a2 = observerRef.current) == null ? void 0 : _a2.disconnect();
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
__spreadProps(__spreadValues({}, restOptions), { root: resolvedRoot != null ? resolvedRoot : null })
|
|
61
|
+
);
|
|
62
|
+
observerRef.current.observe(element);
|
|
63
|
+
return () => {
|
|
64
|
+
var _a2;
|
|
65
|
+
(_a2 = observerRef.current) == null ? void 0 : _a2.disconnect();
|
|
66
|
+
observerRef.current = null;
|
|
67
|
+
};
|
|
68
|
+
}, [
|
|
69
|
+
targetRef,
|
|
70
|
+
restOptions.rootMargin,
|
|
71
|
+
restOptions.threshold,
|
|
72
|
+
root,
|
|
73
|
+
isIntersecting
|
|
74
|
+
]);
|
|
75
|
+
return isIntersecting;
|
|
76
|
+
};
|
|
77
|
+
export {
|
|
78
|
+
useIntersectionOnce
|
|
79
|
+
};
|
|
@@ -488,7 +488,116 @@ var EditorStore = class {
|
|
|
488
488
|
* @private
|
|
489
489
|
*/
|
|
490
490
|
_splitMarkdown(md, separator) {
|
|
491
|
-
|
|
491
|
+
if (!md) {
|
|
492
|
+
return [];
|
|
493
|
+
}
|
|
494
|
+
const separatorMatches = this._collectSeparatorMatches(md, separator);
|
|
495
|
+
if (separatorMatches.length === 0) {
|
|
496
|
+
return [md];
|
|
497
|
+
}
|
|
498
|
+
const chunks = [];
|
|
499
|
+
let start = 0;
|
|
500
|
+
let currentMatchIndex = 0;
|
|
501
|
+
let insideFence = false;
|
|
502
|
+
let activeFence = null;
|
|
503
|
+
let index = 0;
|
|
504
|
+
while (index < md.length) {
|
|
505
|
+
if (this._isLineStart(md, index)) {
|
|
506
|
+
const fence = this._matchFence(md, index);
|
|
507
|
+
if (fence) {
|
|
508
|
+
if (!insideFence) {
|
|
509
|
+
insideFence = true;
|
|
510
|
+
activeFence = fence.marker;
|
|
511
|
+
} else if (activeFence === fence.marker) {
|
|
512
|
+
insideFence = false;
|
|
513
|
+
activeFence = null;
|
|
514
|
+
}
|
|
515
|
+
index = fence.end;
|
|
516
|
+
continue;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
const match = separatorMatches[currentMatchIndex];
|
|
520
|
+
if (!insideFence && match && index === match.index) {
|
|
521
|
+
const chunk = md.slice(start, index);
|
|
522
|
+
if (chunk.length > 0) {
|
|
523
|
+
chunks.push(chunk);
|
|
524
|
+
}
|
|
525
|
+
start = index + match.length;
|
|
526
|
+
currentMatchIndex += 1;
|
|
527
|
+
index = start;
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
530
|
+
index += 1;
|
|
531
|
+
}
|
|
532
|
+
const tail = md.slice(start);
|
|
533
|
+
if (tail.length > 0) {
|
|
534
|
+
chunks.push(tail);
|
|
535
|
+
}
|
|
536
|
+
return chunks.length > 0 ? chunks : [md];
|
|
537
|
+
}
|
|
538
|
+
_collectSeparatorMatches(md, separator) {
|
|
539
|
+
if (typeof separator === "string") {
|
|
540
|
+
const matches2 = [];
|
|
541
|
+
let searchIndex = md.indexOf(separator);
|
|
542
|
+
while (searchIndex !== -1) {
|
|
543
|
+
matches2.push({ index: searchIndex, length: separator.length });
|
|
544
|
+
searchIndex = md.indexOf(separator, searchIndex + separator.length);
|
|
545
|
+
}
|
|
546
|
+
return matches2;
|
|
547
|
+
}
|
|
548
|
+
const flags = separator.flags.includes("g") ? separator.flags : `${separator.flags}g`;
|
|
549
|
+
const globalRegex = new RegExp(separator.source, flags);
|
|
550
|
+
const matches = [];
|
|
551
|
+
let match;
|
|
552
|
+
while ((match = globalRegex.exec(md)) !== null) {
|
|
553
|
+
const matchedText = match[0];
|
|
554
|
+
matches.push({ index: match.index, length: matchedText.length });
|
|
555
|
+
if (matchedText.length === 0) {
|
|
556
|
+
globalRegex.lastIndex += 1;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
return matches;
|
|
560
|
+
}
|
|
561
|
+
_isLineStart(content, position) {
|
|
562
|
+
if (position === 0) {
|
|
563
|
+
return true;
|
|
564
|
+
}
|
|
565
|
+
return content[position - 1] === "\n";
|
|
566
|
+
}
|
|
567
|
+
_matchFence(content, position) {
|
|
568
|
+
let cursor = position;
|
|
569
|
+
let spaces = 0;
|
|
570
|
+
while (cursor < content.length && content[cursor] === " " && spaces < 3) {
|
|
571
|
+
cursor += 1;
|
|
572
|
+
spaces += 1;
|
|
573
|
+
}
|
|
574
|
+
if (cursor >= content.length) {
|
|
575
|
+
return null;
|
|
576
|
+
}
|
|
577
|
+
const char = content[cursor];
|
|
578
|
+
if (char !== "`" && char !== "~") {
|
|
579
|
+
return null;
|
|
580
|
+
}
|
|
581
|
+
let fenceLength = 0;
|
|
582
|
+
while (cursor < content.length && content[cursor] === char) {
|
|
583
|
+
cursor += 1;
|
|
584
|
+
fenceLength += 1;
|
|
585
|
+
}
|
|
586
|
+
if (fenceLength < 3) {
|
|
587
|
+
return null;
|
|
588
|
+
}
|
|
589
|
+
const lineEnd = this._findLineEnd(content, cursor);
|
|
590
|
+
return { marker: char, end: lineEnd };
|
|
591
|
+
}
|
|
592
|
+
_findLineEnd(content, position) {
|
|
593
|
+
let cursor = position;
|
|
594
|
+
while (cursor < content.length && content[cursor] !== "\n") {
|
|
595
|
+
cursor += 1;
|
|
596
|
+
}
|
|
597
|
+
if (cursor < content.length && content[cursor] === "\n") {
|
|
598
|
+
return cursor + 1;
|
|
599
|
+
}
|
|
600
|
+
return cursor;
|
|
492
601
|
}
|
|
493
602
|
/**
|
|
494
603
|
* 获取当前编辑器内容作为节点列表
|
|
@@ -46,15 +46,7 @@ import {
|
|
|
46
46
|
findDataPointByXValue
|
|
47
47
|
} from "../utils";
|
|
48
48
|
import { useStyle } from "./style";
|
|
49
|
-
|
|
50
|
-
CategoryScale,
|
|
51
|
-
LinearScale,
|
|
52
|
-
PointElement,
|
|
53
|
-
LineElement,
|
|
54
|
-
Filler,
|
|
55
|
-
Tooltip,
|
|
56
|
-
Legend
|
|
57
|
-
);
|
|
49
|
+
var areaChartComponentsRegistered = false;
|
|
58
50
|
var hexToRgba = (hex, alpha) => {
|
|
59
51
|
const sanitized = hex.replace("#", "");
|
|
60
52
|
const isShort = sanitized.length === 3;
|
|
@@ -95,6 +87,25 @@ var AreaChart = ({
|
|
|
95
87
|
statistic: statisticConfig,
|
|
96
88
|
variant
|
|
97
89
|
}) => {
|
|
90
|
+
useMemo(() => {
|
|
91
|
+
if (areaChartComponentsRegistered) {
|
|
92
|
+
return void 0;
|
|
93
|
+
}
|
|
94
|
+
if (typeof window === "undefined") {
|
|
95
|
+
return void 0;
|
|
96
|
+
}
|
|
97
|
+
ChartJS.register(
|
|
98
|
+
CategoryScale,
|
|
99
|
+
LinearScale,
|
|
100
|
+
PointElement,
|
|
101
|
+
LineElement,
|
|
102
|
+
Filler,
|
|
103
|
+
Tooltip,
|
|
104
|
+
Legend
|
|
105
|
+
);
|
|
106
|
+
areaChartComponentsRegistered = true;
|
|
107
|
+
return void 0;
|
|
108
|
+
}, []);
|
|
98
109
|
const safeData = Array.isArray(data) ? data : [];
|
|
99
110
|
const [windowWidth, setWindowWidth] = useState(
|
|
100
111
|
typeof window !== "undefined" ? window.innerWidth : 768
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
findDataPointByXValue
|
|
46
46
|
} from "../utils";
|
|
47
47
|
import { useStyle } from "./style";
|
|
48
|
-
|
|
48
|
+
var barChartComponentsRegistered = false;
|
|
49
49
|
var hexToRgba = (hex, alpha) => {
|
|
50
50
|
const sanitized = hex.replace("#", "");
|
|
51
51
|
const isShort = sanitized.length === 3;
|
|
@@ -93,6 +93,17 @@ var BarChart = ({
|
|
|
93
93
|
dataLabelFormatter,
|
|
94
94
|
chartOptions
|
|
95
95
|
}) => {
|
|
96
|
+
useMemo(() => {
|
|
97
|
+
if (barChartComponentsRegistered) {
|
|
98
|
+
return void 0;
|
|
99
|
+
}
|
|
100
|
+
if (typeof window === "undefined") {
|
|
101
|
+
return void 0;
|
|
102
|
+
}
|
|
103
|
+
ChartJS.register(CategoryScale, LinearScale, BarElement, Tooltip, Legend);
|
|
104
|
+
barChartComponentsRegistered = true;
|
|
105
|
+
return void 0;
|
|
106
|
+
}, []);
|
|
96
107
|
const safeData = Array.isArray(data) ? data : [];
|
|
97
108
|
const [windowWidth, setWindowWidth] = useState(
|
|
98
109
|
typeof window !== "undefined" ? window.innerWidth : 768
|
|
@@ -13,17 +13,28 @@ import {
|
|
|
13
13
|
import React, { useImperativeHandle, useRef } from "react";
|
|
14
14
|
import { Line } from "react-chartjs-2";
|
|
15
15
|
import { Container } from "./Container";
|
|
16
|
-
|
|
17
|
-
CategoryScale,
|
|
18
|
-
LinearScale,
|
|
19
|
-
PointElement,
|
|
20
|
-
LineElement,
|
|
21
|
-
Filler,
|
|
22
|
-
Title,
|
|
23
|
-
Tooltip,
|
|
24
|
-
Legend
|
|
25
|
-
);
|
|
16
|
+
var chartMarkAreaRegistered = false;
|
|
26
17
|
var Area = (props) => {
|
|
18
|
+
React.useMemo(() => {
|
|
19
|
+
if (chartMarkAreaRegistered) {
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
if (typeof window === "undefined") {
|
|
23
|
+
return void 0;
|
|
24
|
+
}
|
|
25
|
+
ChartJS.register(
|
|
26
|
+
CategoryScale,
|
|
27
|
+
LinearScale,
|
|
28
|
+
PointElement,
|
|
29
|
+
LineElement,
|
|
30
|
+
Filler,
|
|
31
|
+
Title,
|
|
32
|
+
Tooltip,
|
|
33
|
+
Legend
|
|
34
|
+
);
|
|
35
|
+
chartMarkAreaRegistered = true;
|
|
36
|
+
return void 0;
|
|
37
|
+
}, []);
|
|
27
38
|
const chartRef = React.useRef(void 0);
|
|
28
39
|
const htmlRef = useRef(null);
|
|
29
40
|
const lineChartRef = useRef(null);
|
|
@@ -12,15 +12,26 @@ import React, { useImperativeHandle, useRef } from "react";
|
|
|
12
12
|
import { Bar as ChartBar } from "react-chartjs-2";
|
|
13
13
|
import { stringFormatNumber } from "../utils";
|
|
14
14
|
import { Container } from "./Container";
|
|
15
|
-
|
|
16
|
-
CategoryScale,
|
|
17
|
-
LinearScale,
|
|
18
|
-
BarElement,
|
|
19
|
-
Title,
|
|
20
|
-
Tooltip,
|
|
21
|
-
Legend
|
|
22
|
-
);
|
|
15
|
+
var chartMarkBarRegistered = false;
|
|
23
16
|
var Bar = (props) => {
|
|
17
|
+
React.useMemo(() => {
|
|
18
|
+
if (chartMarkBarRegistered) {
|
|
19
|
+
return void 0;
|
|
20
|
+
}
|
|
21
|
+
if (typeof window === "undefined") {
|
|
22
|
+
return void 0;
|
|
23
|
+
}
|
|
24
|
+
ChartJS.register(
|
|
25
|
+
CategoryScale,
|
|
26
|
+
LinearScale,
|
|
27
|
+
BarElement,
|
|
28
|
+
Title,
|
|
29
|
+
Tooltip,
|
|
30
|
+
Legend
|
|
31
|
+
);
|
|
32
|
+
chartMarkBarRegistered = true;
|
|
33
|
+
return void 0;
|
|
34
|
+
}, []);
|
|
24
35
|
const chartRef = React.useRef(void 0);
|
|
25
36
|
const htmlRef = useRef(null);
|
|
26
37
|
const barChartRef = useRef(null);
|
|
@@ -12,15 +12,26 @@ import React, { useImperativeHandle, useRef } from "react";
|
|
|
12
12
|
import { Bar as ChartBar } from "react-chartjs-2";
|
|
13
13
|
import { stringFormatNumber } from "../utils";
|
|
14
14
|
import { Container } from "./Container";
|
|
15
|
-
|
|
16
|
-
CategoryScale,
|
|
17
|
-
LinearScale,
|
|
18
|
-
BarElement,
|
|
19
|
-
Title,
|
|
20
|
-
Tooltip,
|
|
21
|
-
Legend
|
|
22
|
-
);
|
|
15
|
+
var chartMarkColumnRegistered = false;
|
|
23
16
|
var Column = (props) => {
|
|
17
|
+
React.useMemo(() => {
|
|
18
|
+
if (chartMarkColumnRegistered) {
|
|
19
|
+
return void 0;
|
|
20
|
+
}
|
|
21
|
+
if (typeof window === "undefined") {
|
|
22
|
+
return void 0;
|
|
23
|
+
}
|
|
24
|
+
ChartJS.register(
|
|
25
|
+
CategoryScale,
|
|
26
|
+
LinearScale,
|
|
27
|
+
BarElement,
|
|
28
|
+
Title,
|
|
29
|
+
Tooltip,
|
|
30
|
+
Legend
|
|
31
|
+
);
|
|
32
|
+
chartMarkColumnRegistered = true;
|
|
33
|
+
return void 0;
|
|
34
|
+
}, []);
|
|
24
35
|
const chartRef = React.useRef(void 0);
|
|
25
36
|
const htmlRef = useRef(null);
|
|
26
37
|
const barChartRef = useRef(null);
|
|
@@ -13,16 +13,27 @@ import React, { useImperativeHandle, useRef } from "react";
|
|
|
13
13
|
import { Line as ChartLine } from "react-chartjs-2";
|
|
14
14
|
import { stringFormatNumber } from "../utils";
|
|
15
15
|
import { Container } from "./Container";
|
|
16
|
-
|
|
17
|
-
CategoryScale,
|
|
18
|
-
LinearScale,
|
|
19
|
-
PointElement,
|
|
20
|
-
LineElement,
|
|
21
|
-
Title,
|
|
22
|
-
Tooltip,
|
|
23
|
-
Legend
|
|
24
|
-
);
|
|
16
|
+
var chartMarkLineRegistered = false;
|
|
25
17
|
var Line = (props) => {
|
|
18
|
+
React.useMemo(() => {
|
|
19
|
+
if (chartMarkLineRegistered) {
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
if (typeof window === "undefined") {
|
|
23
|
+
return void 0;
|
|
24
|
+
}
|
|
25
|
+
ChartJS.register(
|
|
26
|
+
CategoryScale,
|
|
27
|
+
LinearScale,
|
|
28
|
+
PointElement,
|
|
29
|
+
LineElement,
|
|
30
|
+
Title,
|
|
31
|
+
Tooltip,
|
|
32
|
+
Legend
|
|
33
|
+
);
|
|
34
|
+
chartMarkLineRegistered = true;
|
|
35
|
+
return void 0;
|
|
36
|
+
}, []);
|
|
26
37
|
const chartRef = React.useRef(void 0);
|
|
27
38
|
const htmlRef = useRef(null);
|
|
28
39
|
const lineChartRef = useRef(null);
|
|
@@ -4,8 +4,19 @@ import React, { useImperativeHandle, useRef } from "react";
|
|
|
4
4
|
import { Doughnut } from "react-chartjs-2";
|
|
5
5
|
import { defaultColorList } from "../const";
|
|
6
6
|
import { Container } from "./Container";
|
|
7
|
-
|
|
7
|
+
var chartMarkPieRegistered = false;
|
|
8
8
|
var Pie = (props) => {
|
|
9
|
+
React.useMemo(() => {
|
|
10
|
+
if (chartMarkPieRegistered) {
|
|
11
|
+
return void 0;
|
|
12
|
+
}
|
|
13
|
+
if (typeof window === "undefined") {
|
|
14
|
+
return void 0;
|
|
15
|
+
}
|
|
16
|
+
ChartJS.register(ArcElement, Tooltip, Legend);
|
|
17
|
+
chartMarkPieRegistered = true;
|
|
18
|
+
return void 0;
|
|
19
|
+
}, []);
|
|
9
20
|
const chartRef = React.useRef(void 0);
|
|
10
21
|
const htmlRef = useRef(null);
|
|
11
22
|
const pieChartRef = useRef(null);
|