@hubstr/kit 0.1.3 → 0.1.5
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/editor/src/codemirror/index.ts +1 -1
- package/editor/src/plugins/code/plugin/index.ts +2 -1
- package/editor/src/plugins/codeblock/plugin/index.ts +2 -1
- package/editor/src/plugins/codemirror-block/plugin/index.ts +2 -1
- package/editor/src/plugins/common/plugin/index.ts +5 -4
- package/editor/src/plugins/common/utils/index.ts +2 -1
- package/editor/src/plugins/file/plugin/index.ts +2 -1
- package/editor/src/plugins/litexml/index.ts +1 -0
- package/editor/src/plugins/litexml/service/litexml-service.ts +11 -1
- package/editor/src/plugins/table/plugin/index.ts +2 -1
- package/icons/es/components/AgentGuideCard/index.js +107 -107
- package/icons/es/components/ColorPreview/index.js +34 -34
- package/icons/es/components/Dashboard/IconItem.js +140 -140
- package/icons/es/components/Dashboard/Text.js +65 -65
- package/icons/es/components/Dashboard/index.js +102 -102
- package/icons/es/components/DownloadButton/index.js +27 -27
- package/icons/es/components/Editor/Color.js +46 -46
- package/icons/es/components/Editor/Mono.js +44 -44
- package/icons/es/components/Editor/Preview.js +53 -53
- package/icons/es/components/Editor/Text.js +44 -44
- package/icons/es/components/Editor/index.js +135 -135
- package/icons/es/components/IconPreview/ColorPreview.js +37 -37
- package/icons/es/components/IconPreview/index.js +66 -66
- package/icons/es/features/index.d.ts +1 -5
- package/icons/es/features/index.js +1 -1
- package/icons/es/features/ui-runtime.js +1 -5
- package/package.json +329 -310
- package/ui/src/Markdown/SyntaxMarkdown/CachedMarkdown.tsx +1 -3
|
@@ -3,6 +3,7 @@ import { $setSelection, LexicalEditor, TextNode } from 'lexical';
|
|
|
3
3
|
import { INodeHelper } from '../../../editor-kernel/inode/helper';
|
|
4
4
|
import { KernelPlugin } from '../../../editor-kernel/plugin';
|
|
5
5
|
import { $createCursorNode, cursorNodeSerialized } from '../../common';
|
|
6
|
+
import type { LitexmlXmlElement } from '../../litexml';
|
|
6
7
|
import { ILitexmlService } from '../../litexml';
|
|
7
8
|
import { IMarkdownShortCutService } from '../../markdown/service/shortcut';
|
|
8
9
|
import type { IEditorKernel, IEditorPlugin, IEditorPluginConstructor } from '../../../types';
|
|
@@ -61,7 +62,7 @@ export const CodePlugin: IEditorPluginConstructor<CodePluginOptions> = class
|
|
|
61
62
|
litexmlService.registerXMLWriter(CodeNode.getType(), (node, ctx) => {
|
|
62
63
|
return ctx.createXmlNode('codeInline', {});
|
|
63
64
|
});
|
|
64
|
-
litexmlService.registerXMLReader('codeInline', (xmlElement:
|
|
65
|
+
litexmlService.registerXMLReader('codeInline', (xmlElement: LitexmlXmlElement, children: any[]) => {
|
|
65
66
|
return INodeHelper.createElementNode(CodeNode.getType(), {
|
|
66
67
|
children,
|
|
67
68
|
});
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
import { INodeHelper } from '../../../editor-kernel/inode/helper';
|
|
23
23
|
import { KernelPlugin } from '../../../editor-kernel/plugin';
|
|
24
24
|
import { IBlockMenuService } from '../../block/service';
|
|
25
|
+
import type { LitexmlXmlElement } from '../../litexml';
|
|
25
26
|
import { ILitexmlService } from '../../litexml';
|
|
26
27
|
import { IMarkdownShortCutService } from '../../markdown/service/shortcut';
|
|
27
28
|
import { IEditorKernel, IEditorPlugin, IEditorPluginConstructor } from '../../../types';
|
|
@@ -218,7 +219,7 @@ export const CodeblockPlugin: IEditorPluginConstructor<CodeblockPluginOptions> =
|
|
|
218
219
|
return xmlNode;
|
|
219
220
|
});
|
|
220
221
|
|
|
221
|
-
litexmlService.registerXMLReader('code', (xmlElment:
|
|
222
|
+
litexmlService.registerXMLReader('code', (xmlElment: LitexmlXmlElement, children: any[]) => {
|
|
222
223
|
const text = children.map((v) => v.text || '').join('');
|
|
223
224
|
return INodeHelper.createElementNode(CodeNode.getType(), {
|
|
224
225
|
children: text
|
|
@@ -2,6 +2,7 @@ import { $createNodeSelection, $setSelection, DecoratorNode, LexicalEditor } fro
|
|
|
2
2
|
|
|
3
3
|
import { INodeHelper } from '../../../editor-kernel/inode/helper';
|
|
4
4
|
import { KernelPlugin } from '../../../editor-kernel/plugin';
|
|
5
|
+
import type { LitexmlXmlElement } from '../../litexml/service/litexml-service';
|
|
5
6
|
import { ILitexmlService } from '../../litexml/service/litexml-service';
|
|
6
7
|
import { IMarkdownShortCutService } from '../../markdown/service/shortcut';
|
|
7
8
|
import { IEditorKernel, IEditorPlugin, IEditorPluginConstructor } from '../../../types';
|
|
@@ -66,7 +67,7 @@ export const CodemirrorPlugin: IEditorPluginConstructor<CodemirrorPluginOptions>
|
|
|
66
67
|
return xmlNode;
|
|
67
68
|
});
|
|
68
69
|
|
|
69
|
-
litexmlService.registerXMLReader('code', (xmlElement:
|
|
70
|
+
litexmlService.registerXMLReader('code', (xmlElement: LitexmlXmlElement, children: any[]) => {
|
|
70
71
|
const text = children.map((v) => v.text || '').join('');
|
|
71
72
|
const language = xmlElement.getAttribute('lang') || 'plain';
|
|
72
73
|
return INodeHelper.createTypeNode('code', {
|
|
@@ -31,6 +31,7 @@ import type { LexicalEditor } from 'lexical';
|
|
|
31
31
|
import { noop } from '../../../editor-kernel';
|
|
32
32
|
import { INodeHelper } from '../../../editor-kernel/inode/helper';
|
|
33
33
|
import { KernelPlugin } from '../../../editor-kernel/plugin';
|
|
34
|
+
import type { LitexmlXmlElement } from '../../litexml';
|
|
34
35
|
import { ILitexmlService } from '../../litexml';
|
|
35
36
|
import { IMarkdownShortCutService } from '../../markdown/service/shortcut';
|
|
36
37
|
import { isPunctuationChar } from '../../markdown/utils';
|
|
@@ -568,7 +569,7 @@ export const CommonPlugin: IEditorPluginConstructor<CommonPluginOptions> = class
|
|
|
568
569
|
sampleReader.bind(this, TEXT_TYPE_TO_FORMAT['underline']),
|
|
569
570
|
);
|
|
570
571
|
|
|
571
|
-
litexmlService.registerXMLReader('span', (xmlElement:
|
|
572
|
+
litexmlService.registerXMLReader('span', (xmlElement: LitexmlXmlElement, children: any[]) => {
|
|
572
573
|
const bold = xmlElement.getAttribute('bold');
|
|
573
574
|
const italic = xmlElement.getAttribute('italic');
|
|
574
575
|
const underline = xmlElement.getAttribute('underline');
|
|
@@ -615,7 +616,7 @@ export const CommonPlugin: IEditorPluginConstructor<CommonPluginOptions> = class
|
|
|
615
616
|
return false;
|
|
616
617
|
});
|
|
617
618
|
|
|
618
|
-
litexmlService.registerXMLReader('quote', (xmlElement:
|
|
619
|
+
litexmlService.registerXMLReader('quote', (xmlElement: LitexmlXmlElement, children: any[]) => {
|
|
619
620
|
return INodeHelper.createElementNode(QuoteNode.getType(), {
|
|
620
621
|
children,
|
|
621
622
|
});
|
|
@@ -633,7 +634,7 @@ export const CommonPlugin: IEditorPluginConstructor<CommonPluginOptions> = class
|
|
|
633
634
|
|
|
634
635
|
const headingTags: HeadingTagType[] = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
635
636
|
headingTags.forEach((tag) => {
|
|
636
|
-
litexmlService.registerXMLReader(tag, (xmlElement:
|
|
637
|
+
litexmlService.registerXMLReader(tag, (xmlElement: LitexmlXmlElement, children: any[]) => {
|
|
637
638
|
return INodeHelper.createElementNode(HeadingNode.getType(), {
|
|
638
639
|
children,
|
|
639
640
|
tag,
|
|
@@ -646,7 +647,7 @@ export const CommonPlugin: IEditorPluginConstructor<CommonPluginOptions> = class
|
|
|
646
647
|
return ctx.createXmlNode('p', {});
|
|
647
648
|
});
|
|
648
649
|
|
|
649
|
-
litexmlService.registerXMLReader('p', (xmlElement:
|
|
650
|
+
litexmlService.registerXMLReader('p', (xmlElement: LitexmlXmlElement, children: any[]) => {
|
|
650
651
|
return INodeHelper.createElementNode(ParagraphNode.getType(), {
|
|
651
652
|
children,
|
|
652
653
|
});
|
|
@@ -16,9 +16,10 @@ import {
|
|
|
16
16
|
} from 'lexical';
|
|
17
17
|
|
|
18
18
|
import { INodeHelper } from '../../../editor-kernel/inode/helper';
|
|
19
|
+
import type { LitexmlXmlElement } from '../../litexml/service/litexml-service';
|
|
19
20
|
import type { ElementTransformer } from '../../markdown/service/transformers';
|
|
20
21
|
|
|
21
|
-
export const sampleReader = (format: number,
|
|
22
|
+
export const sampleReader = (format: number, _xmlElement: LitexmlXmlElement, children: any[]) => {
|
|
22
23
|
children.forEach((child) => {
|
|
23
24
|
if (INodeHelper.isTextNode(child)) {
|
|
24
25
|
child.format = (child.format || 0) | format;
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
|
|
12
12
|
import { INodeHelper } from '../../../editor-kernel/inode/helper';
|
|
13
13
|
import { KernelPlugin } from '../../../editor-kernel/plugin';
|
|
14
|
+
import type { LitexmlXmlElement } from '../../litexml';
|
|
14
15
|
import { ILitexmlService } from '../../litexml';
|
|
15
16
|
import { IMarkdownShortCutService } from '../../markdown/service/shortcut';
|
|
16
17
|
import { IUploadService } from '../../upload';
|
|
@@ -123,7 +124,7 @@ export const FilePlugin: IEditorPluginConstructor<FilePluginOptions> = class
|
|
|
123
124
|
return false;
|
|
124
125
|
});
|
|
125
126
|
|
|
126
|
-
litexmlService.registerXMLReader('file', (xmlElement:
|
|
127
|
+
litexmlService.registerXMLReader('file', (xmlElement: LitexmlXmlElement) => {
|
|
127
128
|
const name = xmlElement.getAttribute('name') || 'unknown';
|
|
128
129
|
const fileUrl = xmlElement.getAttribute('fileUrl') || '';
|
|
129
130
|
const status = xmlElement.getAttribute('status') as
|
|
@@ -2,10 +2,20 @@ import type { LexicalNode } from 'lexical';
|
|
|
2
2
|
|
|
3
3
|
import { genServiceId } from '../../../editor-kernel';
|
|
4
4
|
|
|
5
|
+
export interface LitexmlXmlElement {
|
|
6
|
+
childNodes: ArrayLike<{ nodeType: number; tagName?: string; textContent: string | null }>;
|
|
7
|
+
getAttribute(name: string): string | null;
|
|
8
|
+
tagName: string;
|
|
9
|
+
textContent: string | null;
|
|
10
|
+
}
|
|
11
|
+
|
|
5
12
|
/**
|
|
6
13
|
* XML Reader function type - converts XML element to Lexical node
|
|
7
14
|
*/
|
|
8
|
-
export type XMLReaderFunc = (
|
|
15
|
+
export type XMLReaderFunc = (
|
|
16
|
+
xmlElement: LitexmlXmlElement,
|
|
17
|
+
children: any[],
|
|
18
|
+
) => any | any[] | false;
|
|
9
19
|
|
|
10
20
|
/**
|
|
11
21
|
* XML Writer function type - converts Lexical node to XML string
|
|
@@ -17,6 +17,7 @@ import type { ReactNode } from 'react';
|
|
|
17
17
|
import { INodeHelper } from '../../../editor-kernel/inode/helper';
|
|
18
18
|
import { KernelPlugin } from '../../../editor-kernel/plugin';
|
|
19
19
|
import { IBlockMenuService } from '../../block/service';
|
|
20
|
+
import type { LitexmlXmlElement } from '../../litexml';
|
|
20
21
|
import { ILitexmlService } from '../../litexml';
|
|
21
22
|
import { IMarkdownShortCutService } from '../../markdown/service/shortcut';
|
|
22
23
|
import type { IDecorator, IEditorKernel, IEditorPlugin, IEditorPluginConstructor } from '../../../types';
|
|
@@ -384,7 +385,7 @@ export const TablePlugin: IEditorPluginConstructor<TablePluginOptions> = class
|
|
|
384
385
|
});
|
|
385
386
|
});
|
|
386
387
|
|
|
387
|
-
const tdReader = (xmlNode:
|
|
388
|
+
const tdReader = (xmlNode: LitexmlXmlElement, children: any[]) => {
|
|
388
389
|
return INodeHelper.createElementNode(TableCellNode.getType(), {
|
|
389
390
|
backgroundColor: xmlNode.getAttribute('backgroundColor') || null,
|
|
390
391
|
children,
|
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
-
var _excluded = ["className", "initialMode", "labels", "mode", "onModeChange", "sections"];
|
|
5
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
17
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
|
-
import { Block, Flexbox, Icon, Segmented, Snippet, Text } from '@hubstr/kit/ui';
|
|
19
|
-
import { BotIcon, UserRoundIcon } from 'lucide-react';
|
|
20
|
-
import { memo, useMemo, useState } from 'react';
|
|
21
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
-
var AgentGuideCard = /*#__PURE__*/memo(function (_ref) {
|
|
24
|
-
var className = _ref.className,
|
|
25
|
-
_ref$initialMode = _ref.initialMode,
|
|
26
|
-
initialMode = _ref$initialMode === void 0 ? 'agent' : _ref$initialMode,
|
|
27
|
-
labels = _ref.labels,
|
|
28
|
-
mode = _ref.mode,
|
|
29
|
-
onModeChange = _ref.onModeChange,
|
|
30
|
-
sections = _ref.sections,
|
|
31
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
-
var _useState = useState(initialMode),
|
|
33
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
-
innerMode = _useState2[0],
|
|
35
|
-
setInnerMode = _useState2[1];
|
|
36
|
-
var currentMode = mode !== null && mode !== void 0 ? mode : innerMode;
|
|
37
|
-
var handleModeChange = function handleModeChange(value) {
|
|
38
|
-
if (!mode) setInnerMode(value);
|
|
39
|
-
onModeChange === null || onModeChange === void 0 || onModeChange(value);
|
|
40
|
-
};
|
|
41
|
-
var content = useMemo(function () {
|
|
42
|
-
return sections[currentMode];
|
|
43
|
-
}, [currentMode, sections]);
|
|
44
|
-
return /*#__PURE__*/_jsxs(Block, _objectSpread(_objectSpread({
|
|
45
|
-
className: className,
|
|
46
|
-
flex: 'none',
|
|
47
|
-
shadow: true,
|
|
48
|
-
style: {
|
|
49
|
-
maxWidth: 960
|
|
50
|
-
},
|
|
51
|
-
variant: 'outlined',
|
|
52
|
-
width: '100%'
|
|
53
|
-
}, rest), {}, {
|
|
54
|
-
children: [/*#__PURE__*/_jsx(Flexbox, {
|
|
55
|
-
flex: 1,
|
|
56
|
-
padding: 8,
|
|
57
|
-
children: /*#__PURE__*/_jsx(Segmented, {
|
|
58
|
-
block: true,
|
|
59
|
-
onChange: function onChange(value) {
|
|
60
|
-
return handleModeChange(value);
|
|
61
|
-
},
|
|
62
|
-
options: [{
|
|
63
|
-
icon: /*#__PURE__*/_jsx(Icon, {
|
|
64
|
-
icon: BotIcon
|
|
65
|
-
}),
|
|
66
|
-
label: labels.agent,
|
|
67
|
-
value: 'agent'
|
|
68
|
-
}, {
|
|
69
|
-
icon: /*#__PURE__*/_jsx(Icon, {
|
|
70
|
-
icon: UserRoundIcon
|
|
71
|
-
}),
|
|
72
|
-
label: labels.human,
|
|
73
|
-
value: 'human'
|
|
74
|
-
}],
|
|
75
|
-
value: currentMode,
|
|
76
|
-
variant: 'filled'
|
|
77
|
-
})
|
|
78
|
-
}), /*#__PURE__*/_jsxs(Flexbox, {
|
|
79
|
-
gap: 8,
|
|
80
|
-
paddingBlock: '8px 16px',
|
|
81
|
-
paddingInline: 16,
|
|
82
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
83
|
-
align: 'center',
|
|
84
|
-
weight: 500,
|
|
85
|
-
children: content.description
|
|
86
|
-
}), content.linkHref && content.linkLabel && /*#__PURE__*/_jsx(Flexbox, {
|
|
87
|
-
align: 'center',
|
|
88
|
-
children: /*#__PURE__*/_jsx("a", {
|
|
89
|
-
href: content.linkHref,
|
|
90
|
-
rel: 'noreferrer',
|
|
91
|
-
style: {
|
|
92
|
-
fontSize: 13
|
|
93
|
-
},
|
|
94
|
-
target: '_blank',
|
|
95
|
-
children: content.linkLabel
|
|
96
|
-
})
|
|
97
|
-
}), /*#__PURE__*/_jsx(Snippet, {
|
|
98
|
-
language: content.commandLanguage || 'shell',
|
|
99
|
-
style: {
|
|
100
|
-
fontSize: 12,
|
|
101
|
-
width: '100%'
|
|
102
|
-
},
|
|
103
|
-
children: content.command
|
|
104
|
-
})]
|
|
105
|
-
})]
|
|
106
|
-
}));
|
|
107
|
-
});
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
var _excluded = ["className", "initialMode", "labels", "mode", "onModeChange", "sections"];
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
17
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
|
+
import { Block, Flexbox, Icon, Segmented, Snippet, Text } from '@hubstr/kit/ui';
|
|
19
|
+
import { BotIcon, UserRoundIcon } from 'lucide-react';
|
|
20
|
+
import { memo, useMemo, useState } from 'react';
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
+
var AgentGuideCard = /*#__PURE__*/memo(function (_ref) {
|
|
24
|
+
var className = _ref.className,
|
|
25
|
+
_ref$initialMode = _ref.initialMode,
|
|
26
|
+
initialMode = _ref$initialMode === void 0 ? 'agent' : _ref$initialMode,
|
|
27
|
+
labels = _ref.labels,
|
|
28
|
+
mode = _ref.mode,
|
|
29
|
+
onModeChange = _ref.onModeChange,
|
|
30
|
+
sections = _ref.sections,
|
|
31
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
var _useState = useState(initialMode),
|
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
+
innerMode = _useState2[0],
|
|
35
|
+
setInnerMode = _useState2[1];
|
|
36
|
+
var currentMode = mode !== null && mode !== void 0 ? mode : innerMode;
|
|
37
|
+
var handleModeChange = function handleModeChange(value) {
|
|
38
|
+
if (!mode) setInnerMode(value);
|
|
39
|
+
onModeChange === null || onModeChange === void 0 || onModeChange(value);
|
|
40
|
+
};
|
|
41
|
+
var content = useMemo(function () {
|
|
42
|
+
return sections[currentMode];
|
|
43
|
+
}, [currentMode, sections]);
|
|
44
|
+
return /*#__PURE__*/_jsxs(Block, _objectSpread(_objectSpread({
|
|
45
|
+
className: className,
|
|
46
|
+
flex: 'none',
|
|
47
|
+
shadow: true,
|
|
48
|
+
style: {
|
|
49
|
+
maxWidth: 960
|
|
50
|
+
},
|
|
51
|
+
variant: 'outlined',
|
|
52
|
+
width: '100%'
|
|
53
|
+
}, rest), {}, {
|
|
54
|
+
children: [/*#__PURE__*/_jsx(Flexbox, {
|
|
55
|
+
flex: 1,
|
|
56
|
+
padding: 8,
|
|
57
|
+
children: /*#__PURE__*/_jsx(Segmented, {
|
|
58
|
+
block: true,
|
|
59
|
+
onChange: function onChange(value) {
|
|
60
|
+
return handleModeChange(value);
|
|
61
|
+
},
|
|
62
|
+
options: [{
|
|
63
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
|
64
|
+
icon: BotIcon
|
|
65
|
+
}),
|
|
66
|
+
label: labels.agent,
|
|
67
|
+
value: 'agent'
|
|
68
|
+
}, {
|
|
69
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
|
70
|
+
icon: UserRoundIcon
|
|
71
|
+
}),
|
|
72
|
+
label: labels.human,
|
|
73
|
+
value: 'human'
|
|
74
|
+
}],
|
|
75
|
+
value: currentMode,
|
|
76
|
+
variant: 'filled'
|
|
77
|
+
})
|
|
78
|
+
}), /*#__PURE__*/_jsxs(Flexbox, {
|
|
79
|
+
gap: 8,
|
|
80
|
+
paddingBlock: '8px 16px',
|
|
81
|
+
paddingInline: 16,
|
|
82
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
83
|
+
align: 'center',
|
|
84
|
+
weight: 500,
|
|
85
|
+
children: content.description
|
|
86
|
+
}), content.linkHref && content.linkLabel && /*#__PURE__*/_jsx(Flexbox, {
|
|
87
|
+
align: 'center',
|
|
88
|
+
children: /*#__PURE__*/_jsx("a", {
|
|
89
|
+
href: content.linkHref,
|
|
90
|
+
rel: 'noreferrer',
|
|
91
|
+
style: {
|
|
92
|
+
fontSize: 13
|
|
93
|
+
},
|
|
94
|
+
target: '_blank',
|
|
95
|
+
children: content.linkLabel
|
|
96
|
+
})
|
|
97
|
+
}), /*#__PURE__*/_jsx(Snippet, {
|
|
98
|
+
language: content.commandLanguage || 'shell',
|
|
99
|
+
style: {
|
|
100
|
+
fontSize: 12,
|
|
101
|
+
width: '100%'
|
|
102
|
+
},
|
|
103
|
+
children: content.command
|
|
104
|
+
})]
|
|
105
|
+
})]
|
|
106
|
+
}));
|
|
107
|
+
});
|
|
108
108
|
export default AgentGuideCard;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
var _templateObject, _templateObject2;
|
|
4
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
5
|
-
import { CopyButton, Flexbox, Tooltip } from '@hubstr/kit/ui';
|
|
6
|
-
import { createStaticStyles, cx } from 'antd-style';
|
|
7
|
-
import { memo } from 'react';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
var styles = createStaticStyles(function (_ref) {
|
|
10
|
-
var css = _ref.css,
|
|
11
|
-
cssVar = _ref.cssVar;
|
|
12
|
-
return {
|
|
13
|
-
btn: cx('copy-button', css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n opacity: 0;\n "])))),
|
|
14
|
-
container: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n\n flex: none;\n\n width: 98px;\n height: 98px;\n border: 1px solid ", ";\n border-radius: ", ";\n\n background: ", ";\n\n &:hover {\n .copy-button {\n opacity: 1;\n }\n }\n "])), cssVar.colorBorder, cssVar.borderRadius, cssVar.colorBgContainer)
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
var IconPreview = /*#__PURE__*/memo(function (_ref2) {
|
|
18
|
-
var color = _ref2.color;
|
|
19
|
-
return /*#__PURE__*/_jsx(Tooltip, {
|
|
20
|
-
title: color,
|
|
21
|
-
children: /*#__PURE__*/_jsx(Flexbox, {
|
|
22
|
-
align: 'center',
|
|
23
|
-
className: styles.container,
|
|
24
|
-
justify: 'center',
|
|
25
|
-
style: {
|
|
26
|
-
background: color
|
|
27
|
-
},
|
|
28
|
-
children: /*#__PURE__*/_jsx(CopyButton, {
|
|
29
|
-
className: styles.btn,
|
|
30
|
-
content: color
|
|
31
|
-
})
|
|
32
|
-
})
|
|
33
|
-
});
|
|
34
|
-
});
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
var _templateObject, _templateObject2;
|
|
4
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
5
|
+
import { CopyButton, Flexbox, Tooltip } from '@hubstr/kit/ui';
|
|
6
|
+
import { createStaticStyles, cx } from 'antd-style';
|
|
7
|
+
import { memo } from 'react';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
var styles = createStaticStyles(function (_ref) {
|
|
10
|
+
var css = _ref.css,
|
|
11
|
+
cssVar = _ref.cssVar;
|
|
12
|
+
return {
|
|
13
|
+
btn: cx('copy-button', css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n opacity: 0;\n "])))),
|
|
14
|
+
container: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n\n flex: none;\n\n width: 98px;\n height: 98px;\n border: 1px solid ", ";\n border-radius: ", ";\n\n background: ", ";\n\n &:hover {\n .copy-button {\n opacity: 1;\n }\n }\n "])), cssVar.colorBorder, cssVar.borderRadius, cssVar.colorBgContainer)
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
var IconPreview = /*#__PURE__*/memo(function (_ref2) {
|
|
18
|
+
var color = _ref2.color;
|
|
19
|
+
return /*#__PURE__*/_jsx(Tooltip, {
|
|
20
|
+
title: color,
|
|
21
|
+
children: /*#__PURE__*/_jsx(Flexbox, {
|
|
22
|
+
align: 'center',
|
|
23
|
+
className: styles.container,
|
|
24
|
+
justify: 'center',
|
|
25
|
+
style: {
|
|
26
|
+
background: color
|
|
27
|
+
},
|
|
28
|
+
children: /*#__PURE__*/_jsx(CopyButton, {
|
|
29
|
+
className: styles.btn,
|
|
30
|
+
content: color
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
35
|
export default IconPreview;
|