symbiote-ui 0.3.0-alpha.4
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 +46 -0
- package/LICENSE +21 -0
- package/README.md +76 -0
- package/canvas/AutoLayout.js +731 -0
- package/canvas/Breadcrumb/Breadcrumb.css.js +75 -0
- package/canvas/Breadcrumb/Breadcrumb.js +96 -0
- package/canvas/Breadcrumb/Breadcrumb.tpl.js +7 -0
- package/canvas/CanvasConnectionRenderer.js +971 -0
- package/canvas/CanvasGraph/CanvasGraph.css.js +29 -0
- package/canvas/CanvasGraph/CanvasGraph.js +1697 -0
- package/canvas/CanvasGraph/CanvasGraphDrawState.js +280 -0
- package/canvas/CanvasGraph/CanvasGraphGeometry.js +194 -0
- package/canvas/CanvasViewport.js +550 -0
- package/canvas/ConnectionRenderer.js +1283 -0
- package/canvas/FlowSimulator.js +326 -0
- package/canvas/ForceLayout.js +226 -0
- package/canvas/ForceWorker.js +1303 -0
- package/canvas/FrameManager.js +223 -0
- package/canvas/GraphExplorerShell/GraphExplorerShell.css.js +136 -0
- package/canvas/GraphExplorerShell/GraphExplorerShell.js +129 -0
- package/canvas/GraphExplorerShell/GraphExplorerShell.tpl.js +12 -0
- package/canvas/GraphTabs/GraphTabs.css.js +101 -0
- package/canvas/GraphTabs/GraphTabs.js +189 -0
- package/canvas/GraphTabs/GraphTabs.tpl.js +12 -0
- package/canvas/LODManager.js +88 -0
- package/canvas/Minimap/Minimap.css.js +73 -0
- package/canvas/Minimap/Minimap.js +210 -0
- package/canvas/Minimap/Minimap.tpl.js +7 -0
- package/canvas/NodeCanvas/NodeCanvas.css.js +398 -0
- package/canvas/NodeCanvas/NodeCanvas.js +1499 -0
- package/canvas/NodeCanvas/NodeCanvas.tpl.js +22 -0
- package/canvas/NodeSearch/NodeSearch.css.js +97 -0
- package/canvas/NodeSearch/NodeSearch.js +140 -0
- package/canvas/NodeSearch/NodeSearch.tpl.js +25 -0
- package/canvas/NodeViewManager.js +748 -0
- package/canvas/PcbRouteDiagnostics.js +463 -0
- package/canvas/PcbRouter.js +1127 -0
- package/canvas/PinExpansion.js +134 -0
- package/canvas/PseudoConnection.js +84 -0
- package/canvas/SelectionSync.js +163 -0
- package/canvas/SubgraphManager.js +203 -0
- package/canvas/SubgraphRouter.js +452 -0
- package/canvas/ViewportActions.js +473 -0
- package/canvas/graph-explorer.js +339 -0
- package/canvas/graph-layout.js +148 -0
- package/canvas/graph-model.js +68 -0
- package/canvas/html-in-canvas.js +202 -0
- package/canvas/project-graph-builder.js +440 -0
- package/canvas/project-graph-model.js +183 -0
- package/chat/ChatComposer/ChatComposer.css.js +652 -0
- package/chat/ChatComposer/ChatComposer.js +304 -0
- package/chat/ChatList/ChatList.css.js +102 -0
- package/chat/ChatList/ChatList.js +99 -0
- package/chat/ChatList/ChatList.tpl.js +20 -0
- package/chat/ChatListItem/ChatListItem.css.js +117 -0
- package/chat/ChatListItem/ChatListItem.js +32 -0
- package/chat/ChatListItem/ChatListItem.tpl.js +17 -0
- package/chat/ChatMessageItem/ChatMessageItem.css.js +628 -0
- package/chat/ChatMessageItem/ChatMessageItem.js +156 -0
- package/chat/ChatSidebar/ChatSidebar.css.js +150 -0
- package/chat/ChatSidebar/ChatSidebar.js +230 -0
- package/chat/ChatSidebar/ChatSidebar.tpl.js +18 -0
- package/chat/ChatSidebar/constants.js +11 -0
- package/chat/ChatSidebarItem/ChatSidebarItem.css.js +445 -0
- package/chat/ChatSidebarItem/ChatSidebarItem.js +304 -0
- package/chat/ChatTranscript/ChatTranscript.css.js +90 -0
- package/chat/ChatTranscript/ChatTranscript.js +244 -0
- package/chat/chat-context.js +123 -0
- package/chat/message-model.js +156 -0
- package/cli.js +20 -0
- package/control/Button/Button.css.js +93 -0
- package/control/Button/Button.js +78 -0
- package/control/Button/Button.tpl.js +3 -0
- package/control/Field/Field.css.js +91 -0
- package/control/Field/Field.js +17 -0
- package/control/Field/Field.tpl.js +3 -0
- package/core/Connection.js +47 -0
- package/core/Editor.js +449 -0
- package/core/Frame.js +33 -0
- package/core/GraphMermaid.js +348 -0
- package/core/GraphText.js +228 -0
- package/core/Node.js +145 -0
- package/core/Portal.js +106 -0
- package/core/Socket.js +187 -0
- package/core/SubgraphNode.js +121 -0
- package/core/base-path.js +55 -0
- package/core/dom-utils.js +14 -0
- package/core/index.js +18 -0
- package/core/local-cache.js +26 -0
- package/core/state-sync.js +227 -0
- package/custom-elements.json +6380 -0
- package/discover.js +240 -0
- package/display/Badge/Badge.css.js +44 -0
- package/display/Badge/Badge.js +17 -0
- package/display/Badge/Badge.tpl.js +3 -0
- package/display/Banner/Banner.css.js +61 -0
- package/display/Banner/Banner.js +17 -0
- package/display/Banner/Banner.tpl.js +3 -0
- package/display/CodeBlock/CodeBlock.css.js +194 -0
- package/display/CodeBlock/CodeBlock.js +220 -0
- package/display/CodeBlock/CodeBlock.tpl.js +11 -0
- package/display/DataTable/DataTable.css.js +101 -0
- package/display/DataTable/DataTable.js +136 -0
- package/display/DataTable/DataTable.tpl.js +13 -0
- package/display/EmptyState/EmptyState.css.js +33 -0
- package/display/EmptyState/EmptyState.js +17 -0
- package/display/EmptyState/EmptyState.tpl.js +3 -0
- package/display/EventFeed/EventFeed.css.js +145 -0
- package/display/EventFeed/EventFeed.js +64 -0
- package/display/EventFeed/EventFeed.tpl.js +14 -0
- package/display/EventFeed/EventFeedItem.js +116 -0
- package/display/EventFeed/EventFeedItem.tpl.js +22 -0
- package/display/LoadingOverlay/LoadingOverlay.css.js +91 -0
- package/display/LoadingOverlay/LoadingOverlay.js +48 -0
- package/display/LoadingOverlay/LoadingOverlay.tpl.js +12 -0
- package/display/Metric/Metric.css.js +60 -0
- package/display/Metric/Metric.js +17 -0
- package/display/Metric/Metric.tpl.js +6 -0
- package/display/OutputGraphPreview/OutputGraphPreview.css.js +122 -0
- package/display/OutputGraphPreview/OutputGraphPreview.js +89 -0
- package/display/OutputGraphPreview/OutputGraphPreview.tpl.js +13 -0
- package/display/OutputListPreview/OutputListPreview.css.js +109 -0
- package/display/OutputListPreview/OutputListPreview.js +77 -0
- package/display/OutputListPreview/OutputListPreview.tpl.js +13 -0
- package/display/SourceEditor/SourceEditor.css.js +39 -0
- package/display/SourceEditor/SourceEditor.js +129 -0
- package/display/SourceEditor/SourceEditor.tpl.js +10 -0
- package/display/SourceViewer/SourceViewer.css.js +80 -0
- package/display/SourceViewer/SourceViewer.js +418 -0
- package/display/SourceViewer/SourceViewer.tpl.js +17 -0
- package/display/StatusRibbon/StatusRibbon.css.js +73 -0
- package/display/StatusRibbon/StatusRibbon.js +87 -0
- package/display/StatusRibbon/StatusRibbon.tpl.js +7 -0
- package/display/event-feed-adapter.js +72 -0
- package/display/format-utils.js +29 -0
- package/display/highlight.js +659 -0
- package/display/icons.js +37 -0
- package/display/markdown-formatter.js +60 -0
- package/display/network-approval-page.js +487 -0
- package/display/output-preview.js +261 -0
- package/effects/CellBg/CellBg.css.js +33 -0
- package/effects/CellBg/CellBg.js +410 -0
- package/effects/CellBg/CellBg.tpl.js +5 -0
- package/graph/canvas-adapter.js +223 -0
- package/graph/graph-algorithms.js +31 -0
- package/graph/index.js +46 -0
- package/graph/model.js +176 -0
- package/graph/project-graph-build.js +66 -0
- package/graph/project-graph-metadata.js +253 -0
- package/graph/project-package.js +128 -0
- package/graph/project-runtime.js +116 -0
- package/graph/project-transaction.js +284 -0
- package/graph/skeleton-utils.js +84 -0
- package/graph/theme-contract.js +36 -0
- package/graph/transaction-parser.js +56 -0
- package/icons/MaterialSymbols.js +69 -0
- package/icons/material-symbols-outlined-400.ttf +0 -0
- package/icons/material-symbols.css +24 -0
- package/index.js +95 -0
- package/inspector/InspectorPanel/InspectorPanel.css.js +375 -0
- package/inspector/InspectorPanel/InspectorPanel.js +368 -0
- package/inspector/InspectorPanel/InspectorPanel.tpl.js +96 -0
- package/inspector/TemplatePreview/TemplatePreview.css.js +104 -0
- package/inspector/TemplatePreview/TemplatePreview.js +145 -0
- package/inspector/TemplatePreview/TemplatePreview.tpl.js +33 -0
- package/interactions/ConnectFlow.js +304 -0
- package/interactions/Drag.js +104 -0
- package/interactions/Selector.js +133 -0
- package/interactions/SnapGrid.js +66 -0
- package/interactions/Zoom.js +139 -0
- package/layout/ActionZone/ActionZone.css.js +88 -0
- package/layout/ActionZone/ActionZone.js +261 -0
- package/layout/ActionZone/ActionZone.tpl.js +11 -0
- package/layout/CrossLayoutPortalBridge/CrossLayoutPortalBridge.js +255 -0
- package/layout/Layout/Layout.css.js +91 -0
- package/layout/Layout/Layout.js +637 -0
- package/layout/Layout/Layout.tpl.js +27 -0
- package/layout/LayoutNode/LayoutNode.css.js +302 -0
- package/layout/LayoutNode/LayoutNode.js +509 -0
- package/layout/LayoutNode/LayoutNode.tpl.js +39 -0
- package/layout/LayoutPreview/LayoutPreview.css.js +46 -0
- package/layout/LayoutPreview/LayoutPreview.js +102 -0
- package/layout/LayoutPreview/LayoutPreview.tpl.js +6 -0
- package/layout/LayoutRouter/LayoutRouter.js +274 -0
- package/layout/LayoutRouter/SectionRegistry.js +135 -0
- package/layout/LayoutRouter/routerSync.js +250 -0
- package/layout/LayoutSidebar/LayoutSidebar.css.js +411 -0
- package/layout/LayoutSidebar/LayoutSidebar.js +368 -0
- package/layout/LayoutSidebar/LayoutSidebar.tpl.js +26 -0
- package/layout/LayoutSidebar/SidebarSection.css.js +20 -0
- package/layout/LayoutSidebar/SidebarSection.js +184 -0
- package/layout/LayoutSidebar/SidebarSection.tpl.js +22 -0
- package/layout/LayoutTree.js +373 -0
- package/layout/PanelMenu/PanelMenu.css.js +43 -0
- package/layout/PanelMenu/PanelMenu.js +95 -0
- package/layout/PanelMenu/PanelMenu.tpl.js +17 -0
- package/layout/ProjectTabs/ProjectTabs.css.js +188 -0
- package/layout/ProjectTabs/ProjectTabs.js +77 -0
- package/layout/ProjectTabs/ProjectTabs.tpl.js +15 -0
- package/layout/index.js +40 -0
- package/list/ListDetailShell/ListDetailShell.css.js +128 -0
- package/list/ListDetailShell/ListDetailShell.js +72 -0
- package/list/ListDetailShell/ListDetailShell.tpl.js +36 -0
- package/list/ListItem/ListItem.css.js +111 -0
- package/list/ListItem/ListItem.js +66 -0
- package/list/ListItem/ListItem.tpl.js +18 -0
- package/locale/index.js +503 -0
- package/manifest/component-registry.js +2446 -0
- package/manifest/graph-schema.js +285 -0
- package/manifest/index.js +6 -0
- package/manifest/project-schema-catalog.js +246 -0
- package/manifest/rule-catalog.js +201 -0
- package/manifest/theme-catalog.js +2149 -0
- package/manifest/ui-schema-catalog.js +334 -0
- package/menu/ContextMenu/ContextMenu.css.js +61 -0
- package/menu/ContextMenu/ContextMenu.js +82 -0
- package/menu/ContextMenu/ContextMenu.tpl.js +19 -0
- package/navigation/QuickOpen/QuickOpen.css.js +92 -0
- package/navigation/QuickOpen/QuickOpen.js +185 -0
- package/navigation/QuickOpen/QuickOpen.tpl.js +15 -0
- package/navigation/quick-open-utils.js +101 -0
- package/node/CtrlItem/CtrlItem.css.js +41 -0
- package/node/CtrlItem/CtrlItem.js +24 -0
- package/node/CtrlItem/CtrlItem.tpl.js +17 -0
- package/node/GraphFrame/GraphFrame.css.js +66 -0
- package/node/GraphFrame/GraphFrame.js +32 -0
- package/node/GraphFrame/GraphFrame.tpl.js +13 -0
- package/node/GraphNode/GraphNode.css.js +815 -0
- package/node/GraphNode/GraphNode.js +173 -0
- package/node/GraphNode/GraphNode.tpl.js +33 -0
- package/node/NodeCallout/NodeCallout.css.js +91 -0
- package/node/NodeCallout/NodeCallout.js +281 -0
- package/node/NodeCallout/NodeCallout.tpl.js +8 -0
- package/node/NodeSocket/NodeSocket.css.js +68 -0
- package/node/NodeSocket/NodeSocket.js +26 -0
- package/node/NodeSocket/NodeSocket.tpl.js +7 -0
- package/node/PortItem/PortItem.css.js +93 -0
- package/node/PortItem/PortItem.js +87 -0
- package/node/PortItem/PortItem.tpl.js +10 -0
- package/package.json +165 -0
- package/palette/PaletteBrowser/PaletteBrowser.css.js +143 -0
- package/palette/PaletteBrowser/PaletteBrowser.js +152 -0
- package/palette/PaletteBrowser/PaletteBrowser.tpl.js +23 -0
- package/plugins/History.js +408 -0
- package/plugins/Readonly.js +60 -0
- package/rules/symbiote-3x.json +170 -0
- package/schemas/component-descriptor-v1.json +91 -0
- package/schemas/component-descriptor-v2.json +145 -0
- package/schemas/graph-model-v1.json +179 -0
- package/schemas/graph-v1.json +91 -0
- package/schemas/project-package-v1.json +102 -0
- package/schemas/project-transaction-v1.json +114 -0
- package/schemas/runtime-ui-v1.json +80 -0
- package/schemas/theme-rule-block-v1.json +73 -0
- package/shapes/CircleShape.js +79 -0
- package/shapes/CommentShape.js +35 -0
- package/shapes/DiamondShape.js +130 -0
- package/shapes/NodeShape.js +79 -0
- package/shapes/PillShape.js +91 -0
- package/shapes/RectShape.js +84 -0
- package/shapes/SVGShape.js +525 -0
- package/shapes/index.js +63 -0
- package/surface/Card/Card.css.js +57 -0
- package/surface/Card/Card.js +17 -0
- package/surface/Card/Card.tpl.js +3 -0
- package/themes/Palette.js +30 -0
- package/themes/Skin.js +113 -0
- package/themes/Theme.js +82 -0
- package/themes/carbon.js +135 -0
- package/themes/dark.js +140 -0
- package/themes/default-dark.js +714 -0
- package/themes/default-provider.css +635 -0
- package/themes/default-provider.js +718 -0
- package/themes/ebook.js +136 -0
- package/themes/grey.js +137 -0
- package/themes/light.js +139 -0
- package/themes/neon.js +138 -0
- package/themes/pcb.js +273 -0
- package/themes/synthwave.js +138 -0
- package/tokens/base.json +29 -0
- package/tokens/themes/carbon.json +11 -0
- package/tokens/themes/dark.json +12 -0
- package/tokens/themes/default-dark.json +1543 -0
- package/tokens/themes/default-provider.json +1543 -0
- package/tokens/themes/ebook.json +11 -0
- package/tokens/themes/grey.json +11 -0
- package/tokens/themes/light.json +12 -0
- package/tokens/themes/neon.json +11 -0
- package/tokens/themes/pcb.json +11 -0
- package/tokens/themes/synthwave.json +11 -0
- package/toolbar/QuickToolbar/QuickToolbar.css.js +152 -0
- package/toolbar/QuickToolbar/QuickToolbar.js +529 -0
- package/toolbar/QuickToolbar/QuickToolbar.tpl.js +34 -0
- package/tree/TreePanel/TreePanel.css.js +112 -0
- package/tree/TreePanel/TreePanel.js +147 -0
- package/tree/TreePanel/TreePanel.tpl.js +18 -0
- package/tree/TreeView/TreeView.css.js +122 -0
- package/tree/TreeView/TreeView.js +365 -0
- package/tree/TreeView/TreeView.tpl.js +10 -0
- package/ui/dialogs.js +221 -0
- package/ui/host-adapters.js +114 -0
- package/ui/index.js +660 -0
- package/ui/locale.js +50 -0
- package/ui/overlay-stack.js +89 -0
- package/ui/shared-styles.js +26 -0
- package/webmcp.js +37 -0
- package/xr/deep-graph.js +646 -0
- package/xr/emulation.js +198 -0
- package/xr/gesture.js +228 -0
- package/xr/html-canvas-renderer.js +472 -0
- package/xr/index.js +15 -0
- package/xr/layout-projection.js +1046 -0
- package/xr/panel-frame.js +128 -0
- package/xr/panel-host.js +267 -0
- package/xr/pointer.js +258 -0
- package/xr/scene-controller.js +242 -0
- package/xr/spatial-scene.js +212 -0
- package/xr/theme-bridge.js +105 -0
- package/xr/three-webxr-adapter.js +3439 -0
- package/xr/webgl-layer-renderer.js +419 -0
- package/xr/webxr.js +679 -0
- package/xr/workbench.js +516 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import Symbiote, { html } from '@symbiotejs/symbiote';
|
|
2
|
+
import '../../control/Button/Button.js';
|
|
3
|
+
import { translate } from '../../locale/index.js';
|
|
4
|
+
import css from './ChatComposer.css.js';
|
|
5
|
+
|
|
6
|
+
function emit(el, type, detail = {}) {
|
|
7
|
+
el.dispatchEvent(new CustomEvent(type, { bubbles: true, composed: true, detail }));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export class ChatComposer extends Symbiote {
|
|
11
|
+
init$ = {
|
|
12
|
+
value: '',
|
|
13
|
+
disabled: false,
|
|
14
|
+
placeholder: translate('chat.composer.placeholder'),
|
|
15
|
+
voiceCommandToggleOffTitle: translate('chat.composer.voiceCommandToggleOff', { command: translate('chat.composer.voiceCommandDefault') }),
|
|
16
|
+
voiceCommandToggleOnTitle: translate('chat.composer.voiceCommandToggleOn', { command: translate('chat.composer.voiceCommandDefault') }),
|
|
17
|
+
voiceCommandToggleLabel: translate('chat.composer.voiceCommandToggleLabel', { command: translate('chat.composer.voiceCommandDefault') }),
|
|
18
|
+
attachedContext: [],
|
|
19
|
+
footerHtml: '',
|
|
20
|
+
isSending: false,
|
|
21
|
+
|
|
22
|
+
onInput: (event) => {
|
|
23
|
+
let input = event.target;
|
|
24
|
+
this.$.value = input.value;
|
|
25
|
+
this.resizeInput();
|
|
26
|
+
emit(this, 'chat-composer-input', {
|
|
27
|
+
value: input.value,
|
|
28
|
+
selectionStart: input.selectionStart,
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
onKeyDown: (event) => {
|
|
33
|
+
if (event.key === 'Enter' && !event.shiftKey) {
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
emit(this, 'chat-composer-submit');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (event.key === 'Escape' || event.key === 'ArrowDown' || event.key === 'ArrowUp' || event.key === 'Tab') {
|
|
39
|
+
emit(this, 'chat-composer-key', { key: event.key, event });
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
onSend: () => {
|
|
44
|
+
emit(this, 'chat-composer-send');
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
onVoiceApprove: () => {
|
|
48
|
+
emit(this, 'chat-composer-voice-approve');
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
onVoiceCancel: () => {
|
|
52
|
+
emit(this, 'chat-composer-voice-cancel');
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
onVoiceSend: () => {
|
|
56
|
+
emit(this, 'chat-composer-voice-send');
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
onVoiceCommandToggle: () => {
|
|
60
|
+
emit(this, 'chat-composer-voice-command-toggle');
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
onParamChange: (event) => {
|
|
64
|
+
let el = event.target;
|
|
65
|
+
if (!el || (!el.classList.contains('composer-footer-select') && !el.classList.contains('composer-footer-checkbox'))) return;
|
|
66
|
+
emit(this, 'chat-composer-param-change', {
|
|
67
|
+
id: el.dataset.param,
|
|
68
|
+
value: el.type === 'checkbox' ? el.checked : el.value,
|
|
69
|
+
inputType: el.type,
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
onRemoveContext: (event) => {
|
|
74
|
+
emit(this, 'chat-composer-context-remove', {
|
|
75
|
+
key: event.currentTarget?.dataset?.key,
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
onDragOver: (event) => {
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
this.classList.add('drag-over');
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
onDragLeave: () => {
|
|
85
|
+
this.classList.remove('drag-over');
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
onDrop: (event) => {
|
|
89
|
+
event.preventDefault();
|
|
90
|
+
this.classList.remove('drag-over');
|
|
91
|
+
let path = event.dataTransfer?.getData('text/plain');
|
|
92
|
+
if (path && path.trim()) {
|
|
93
|
+
emit(this, 'chat-composer-context-drop', { path: path.trim() });
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
renderCallback() {
|
|
99
|
+
this.sub('value', (value) => {
|
|
100
|
+
let input = this.getInputElement();
|
|
101
|
+
if (input && input.value !== value) {
|
|
102
|
+
input.value = value || '';
|
|
103
|
+
this.resizeInput();
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
this.sub('isSending', () => this._syncSendingState());
|
|
107
|
+
this.sub('disabled', () => this._syncDisabledState());
|
|
108
|
+
queueMicrotask(() => {
|
|
109
|
+
this._syncSendingState();
|
|
110
|
+
this._syncDisabledState();
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
getInputElement() {
|
|
115
|
+
return this.ref.chatInput || null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
getAutocompleteElement() {
|
|
119
|
+
return this.ref.autocompletePopup || null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
getParamControls() {
|
|
123
|
+
return [...(this.ref.footer?.querySelectorAll('.composer-footer-select, .composer-footer-checkbox') || [])];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
getVoicePreviewElement() {
|
|
127
|
+
return this.ref.voicePreview || null;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
getVoicePreviewBody() {
|
|
131
|
+
return this.ref.voicePreviewBody || null;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
setValue(value) {
|
|
135
|
+
this.$.value = value || '';
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
setAttachedContext(items) {
|
|
139
|
+
this.$.attachedContext = Array.isArray(items) ? items : [];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
setFooterHtml(htmlStr) {
|
|
143
|
+
this.$.footerHtml = htmlStr || '';
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
setDisabled(disabled) {
|
|
147
|
+
this.$.disabled = Boolean(disabled);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
setPlaceholder(placeholder) {
|
|
151
|
+
this.$.placeholder = placeholder || '';
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
setSending(active) {
|
|
155
|
+
this.$.isSending = Boolean(active);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
setVoicePreview({ mode = 'recording', text = '', status = '', elapsed = false, editable = false, commandMode = false, commandPhrase = '' } = {}) {
|
|
159
|
+
let preview = this.ref.voicePreview;
|
|
160
|
+
let statusEl = this.ref.voicePreviewStatus;
|
|
161
|
+
let body = this.ref.voicePreviewBody;
|
|
162
|
+
if (!preview || !body || !statusEl) return;
|
|
163
|
+
|
|
164
|
+
preview.hidden = false;
|
|
165
|
+
preview.className = `composer-body voice-preview ${mode}`;
|
|
166
|
+
statusEl.textContent = status || '';
|
|
167
|
+
statusEl.hidden = !status;
|
|
168
|
+
statusEl.classList.toggle('voice-preview-elapsed', Boolean(elapsed));
|
|
169
|
+
body.textContent = text || '';
|
|
170
|
+
body.hidden = !text && mode === 'recording';
|
|
171
|
+
if (editable) {
|
|
172
|
+
body.contentEditable = 'true';
|
|
173
|
+
body.spellcheck = false;
|
|
174
|
+
} else {
|
|
175
|
+
body.removeAttribute('contenteditable');
|
|
176
|
+
body.removeAttribute('spellcheck');
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (this.ref.voiceApproveBtn) this.ref.voiceApproveBtn.hidden = mode !== 'recording';
|
|
180
|
+
if (this.ref.voiceCancelBtn) this.ref.voiceCancelBtn.hidden = false;
|
|
181
|
+
if (this.ref.voiceSendBtn) this.ref.voiceSendBtn.hidden = mode !== 'result';
|
|
182
|
+
if (this.ref.voiceCommandToggleBtn) {
|
|
183
|
+
let active = Boolean(commandMode);
|
|
184
|
+
let command = commandPhrase || translate('chat.composer.voiceCommandDefault');
|
|
185
|
+
let title = active
|
|
186
|
+
? translate('chat.composer.voiceCommandToggleOn', { command })
|
|
187
|
+
: translate('chat.composer.voiceCommandToggleOff', { command });
|
|
188
|
+
let label = translate('chat.composer.voiceCommandToggleLabel', { command });
|
|
189
|
+
this.ref.voiceCommandToggleBtn.hidden = mode !== 'recording';
|
|
190
|
+
this.ref.voiceCommandToggleBtn.classList.toggle('active', active);
|
|
191
|
+
this.ref.voiceCommandToggleBtn.setAttribute('aria-pressed', active ? 'true' : 'false');
|
|
192
|
+
this.ref.voiceCommandToggleBtn.setAttribute('aria-label', title);
|
|
193
|
+
this.ref.voiceCommandToggleBtn.title = title;
|
|
194
|
+
let icon = this.ref.voiceCommandToggleBtn.querySelector('.material-symbols-outlined');
|
|
195
|
+
if (icon) icon.textContent = active ? 'toggle_on' : 'toggle_off';
|
|
196
|
+
if (this.ref.voiceCommandToggleText) this.ref.voiceCommandToggleText.textContent = label;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
clearVoicePreview() {
|
|
201
|
+
let preview = this.ref.voicePreview;
|
|
202
|
+
let statusEl = this.ref.voicePreviewStatus;
|
|
203
|
+
let body = this.ref.voicePreviewBody;
|
|
204
|
+
if (!preview || !body || !statusEl) return;
|
|
205
|
+
preview.hidden = true;
|
|
206
|
+
preview.className = 'composer-body voice-preview';
|
|
207
|
+
statusEl.textContent = '';
|
|
208
|
+
statusEl.hidden = true;
|
|
209
|
+
statusEl.classList.remove('voice-preview-elapsed');
|
|
210
|
+
body.textContent = '';
|
|
211
|
+
body.hidden = false;
|
|
212
|
+
body.removeAttribute('contenteditable');
|
|
213
|
+
body.removeAttribute('spellcheck');
|
|
214
|
+
if (this.ref.voiceCommandToggleBtn) {
|
|
215
|
+
this.ref.voiceCommandToggleBtn.hidden = true;
|
|
216
|
+
this.ref.voiceCommandToggleBtn.classList.remove('active');
|
|
217
|
+
this.ref.voiceCommandToggleBtn.setAttribute('aria-pressed', 'false');
|
|
218
|
+
this.ref.voiceCommandToggleBtn.setAttribute('aria-label', this.$.voiceCommandToggleOffTitle);
|
|
219
|
+
this.ref.voiceCommandToggleBtn.title = this.$.voiceCommandToggleOffTitle;
|
|
220
|
+
let icon = this.ref.voiceCommandToggleBtn.querySelector('.material-symbols-outlined');
|
|
221
|
+
if (icon) icon.textContent = 'toggle_off';
|
|
222
|
+
if (this.ref.voiceCommandToggleText) this.ref.voiceCommandToggleText.textContent = this.$.voiceCommandToggleLabel;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
resizeInput() {
|
|
227
|
+
let input = this.getInputElement();
|
|
228
|
+
if (!input) return;
|
|
229
|
+
input.style.height = 'auto';
|
|
230
|
+
input.style.height = `${Math.min(input.scrollHeight, 200)}px`;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
resetInputHeight() {
|
|
234
|
+
let input = this.getInputElement();
|
|
235
|
+
if (input) input.style.height = 'auto';
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
_syncSendingState() {
|
|
239
|
+
let btn = this.ref.btnSend;
|
|
240
|
+
let icon = this.ref.sendIcon;
|
|
241
|
+
if (!btn || !icon) return;
|
|
242
|
+
if (this.$.isSending) {
|
|
243
|
+
btn.classList.add('btn-stop');
|
|
244
|
+
icon.textContent = 'stop';
|
|
245
|
+
} else {
|
|
246
|
+
btn.classList.remove('btn-stop');
|
|
247
|
+
icon.textContent = 'arrow_upward';
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
_syncDisabledState() {
|
|
252
|
+
let input = this.getInputElement();
|
|
253
|
+
if (input) input.disabled = Boolean(this.$.disabled);
|
|
254
|
+
if (this.ref.btnSend) this.ref.btnSend.disabled = Boolean(this.$.disabled);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
ChatComposer.template = html`
|
|
259
|
+
<div ${{ ondragover: 'onDragOver', ondragleave: 'onDragLeave', ondrop: 'onDrop' }}>
|
|
260
|
+
<div class="chat-context-bar" itemize="attachedContext">
|
|
261
|
+
<div class="context-chip" title="{{title}}">
|
|
262
|
+
<span class="material-symbols-outlined icon-sm">{{icon}}</span>
|
|
263
|
+
<span class="context-path">{{name}}</span>
|
|
264
|
+
<sn-button class="context-remove" variant="icon" ${{ '@data-key': 'key', onclick: '^onRemoveContext' }}>
|
|
265
|
+
<span class="material-symbols-outlined">close</span>
|
|
266
|
+
</sn-button>
|
|
267
|
+
</div>
|
|
268
|
+
</div>
|
|
269
|
+
<div class="composer-body voice-preview" ref="voicePreview" hidden>
|
|
270
|
+
<div class="voice-preview-content">
|
|
271
|
+
<div class="voice-preview-status voice-preview-elapsed" ref="voicePreviewStatus" hidden></div>
|
|
272
|
+
<div class="voice-preview-body" ref="voicePreviewBody"></div>
|
|
273
|
+
</div>
|
|
274
|
+
<div class="voice-preview-actions">
|
|
275
|
+
<sn-button class="voice-preview-btn command-toggle" ref="voiceCommandToggleBtn" aria-pressed="false" ${{ title: 'voiceCommandToggleOffTitle', '@aria-label': 'voiceCommandToggleOffTitle', onclick: 'onVoiceCommandToggle' }}>
|
|
276
|
+
<span class="material-symbols-outlined">toggle_off</span>
|
|
277
|
+
<span class="voice-command-toggle-text" ref="voiceCommandToggleText" ${{ textContent: 'voiceCommandToggleLabel' }}></span>
|
|
278
|
+
</sn-button>
|
|
279
|
+
<sn-button class="voice-preview-btn cancel" ref="voiceCancelBtn" variant="danger" title="Cancel" ${{ onclick: 'onVoiceCancel' }}>
|
|
280
|
+
<span class="material-symbols-outlined">close</span>
|
|
281
|
+
</sn-button>
|
|
282
|
+
<sn-button class="voice-preview-btn approve" ref="voiceApproveBtn" variant="success" title="Approve and send" ${{ onclick: 'onVoiceApprove' }}>
|
|
283
|
+
<span class="material-symbols-outlined">check</span>
|
|
284
|
+
</sn-button>
|
|
285
|
+
<sn-button class="voice-preview-btn send" ref="voiceSendBtn" variant="success" title="Send" ${{ onclick: 'onVoiceSend' }}>
|
|
286
|
+
<span class="material-symbols-outlined">send</span>
|
|
287
|
+
</sn-button>
|
|
288
|
+
</div>
|
|
289
|
+
</div>
|
|
290
|
+
<div class="composer-body">
|
|
291
|
+
<textarea ref="chatInput" rows="1"
|
|
292
|
+
${{ value: 'value', disabled: 'disabled', placeholder: 'placeholder',
|
|
293
|
+
oninput: 'onInput', onkeydown: 'onKeyDown' }}></textarea>
|
|
294
|
+
<sn-button class="btn-send" ref="btnSend" variant="icon" ${{ onclick: 'onSend' }}>
|
|
295
|
+
<span class="material-symbols-outlined" ref="sendIcon">arrow_upward</span>
|
|
296
|
+
</sn-button>
|
|
297
|
+
</div>
|
|
298
|
+
<div class="composer-footer" ref="footer" ${{ innerHTML: 'footerHtml', onchange: 'onParamChange' }}></div>
|
|
299
|
+
<div class="autocomplete-popup" ref="autocompletePopup"></div>
|
|
300
|
+
</div>
|
|
301
|
+
`;
|
|
302
|
+
|
|
303
|
+
ChatComposer.rootStyles = css;
|
|
304
|
+
ChatComposer.reg('chat-composer');
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export default /*css*/ `
|
|
2
|
+
:host,
|
|
3
|
+
chat-list {
|
|
4
|
+
display: block;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.chat-list {
|
|
8
|
+
width: 100%;
|
|
9
|
+
border-right: none;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
height: 100%;
|
|
13
|
+
background: var(--sn-node-bg);
|
|
14
|
+
color: var(--sn-text);
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.chat-list-header {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: 8px;
|
|
22
|
+
min-height: 36px;
|
|
23
|
+
padding: 6px 12px;
|
|
24
|
+
border-bottom: 1px solid var(--sn-node-border);
|
|
25
|
+
flex-shrink: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.chat-list-title {
|
|
29
|
+
min-width: 0;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
text-overflow: ellipsis;
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
font-size: 13px;
|
|
34
|
+
font-weight: 600;
|
|
35
|
+
color: var(--sn-text);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.chat-list-content {
|
|
39
|
+
min-height: 0;
|
|
40
|
+
overflow: auto;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.chat-list-icon {
|
|
44
|
+
font-size: 16px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.chat-list-empty-icon {
|
|
48
|
+
display: block;
|
|
49
|
+
margin-block-end: 8px;
|
|
50
|
+
font-size: 32px;
|
|
51
|
+
opacity: 0.3;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.chat-list-title {
|
|
55
|
+
flex: none;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.chat-list-new-btn {
|
|
59
|
+
margin-left: auto;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.chat-list-new-btn-icon {
|
|
63
|
+
font-size: 14px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.chat-list-items {
|
|
67
|
+
padding: 4px 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.chat-list-filter-bar {
|
|
71
|
+
display: flex;
|
|
72
|
+
gap: 4px;
|
|
73
|
+
padding: 6px 12px;
|
|
74
|
+
border-bottom: 1px solid var(--sn-node-border);
|
|
75
|
+
flex-shrink: 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.chat-list-filter-btn {
|
|
79
|
+
--sn-button-bg: transparent;
|
|
80
|
+
--sn-button-border: transparent;
|
|
81
|
+
--sn-button-color: var(--sn-text-dim);
|
|
82
|
+
--sn-button-hover-bg: transparent;
|
|
83
|
+
--sn-button-hover-border: transparent;
|
|
84
|
+
--sn-button-padding: 3px 8px;
|
|
85
|
+
--sn-button-radius: 4px;
|
|
86
|
+
--sn-button-min-height: 24px;
|
|
87
|
+
--sn-button-font-size: 11px;
|
|
88
|
+
--sn-button-font-weight: 500;
|
|
89
|
+
color: var(--sn-text-dim);
|
|
90
|
+
transition: color 0.15s, background 0.15s, border-color 0.15s;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.chat-list-filter-btn:hover {
|
|
94
|
+
color: var(--sn-text);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.chat-list-filter-btn[active] {
|
|
98
|
+
--sn-button-bg: var(--sn-node-bg);
|
|
99
|
+
--sn-button-border: var(--sn-node-border);
|
|
100
|
+
color: var(--sn-text);
|
|
101
|
+
}
|
|
102
|
+
`;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import Symbiote from '@symbiotejs/symbiote';
|
|
2
|
+
import '../ChatListItem/ChatListItem.js';
|
|
3
|
+
import '../../control/Button/Button.js';
|
|
4
|
+
import '../../display/EmptyState/EmptyState.js';
|
|
5
|
+
import template from './ChatList.tpl.js';
|
|
6
|
+
import css from './ChatList.css.js';
|
|
7
|
+
import { translate } from '../../locale/index.js';
|
|
8
|
+
|
|
9
|
+
export class ChatList extends Symbiote {
|
|
10
|
+
init$ = {
|
|
11
|
+
filter: 'all',
|
|
12
|
+
chatItems: [],
|
|
13
|
+
title: translate('chat.list.title'),
|
|
14
|
+
newLabel: translate('chat.list.new'),
|
|
15
|
+
emptyMessage: translate('chat.list.empty'),
|
|
16
|
+
filterAllLabel: translate('chat.list.filter.all'),
|
|
17
|
+
filterProjectLabel: translate('chat.list.filter.project'),
|
|
18
|
+
filterActiveLabel: translate('chat.list.filter.active'),
|
|
19
|
+
onFilterClick: (event) => {
|
|
20
|
+
this.setFilter(event.currentTarget?.dataset?.filter || 'all');
|
|
21
|
+
},
|
|
22
|
+
onNewChat: () => {
|
|
23
|
+
this.dispatchEvent(new CustomEvent('chat-list-new', { bubbles: true, composed: true }));
|
|
24
|
+
},
|
|
25
|
+
onChatSelect: (event) => {
|
|
26
|
+
let item = this.getChatItemHost(event);
|
|
27
|
+
if (!item?.$.id) return;
|
|
28
|
+
this.dispatchEvent(new CustomEvent('chat-list-select', {
|
|
29
|
+
bubbles: true,
|
|
30
|
+
composed: true,
|
|
31
|
+
detail: { id: item.$.id, item },
|
|
32
|
+
}));
|
|
33
|
+
},
|
|
34
|
+
onChatDelete: (event) => {
|
|
35
|
+
event.stopPropagation();
|
|
36
|
+
let item = this.getChatItemHost(event);
|
|
37
|
+
if (!item?.$.id) return;
|
|
38
|
+
this.dispatchEvent(new CustomEvent('chat-list-delete', {
|
|
39
|
+
bubbles: true,
|
|
40
|
+
composed: true,
|
|
41
|
+
detail: { id: item.$.id, item },
|
|
42
|
+
}));
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
renderCallback() {
|
|
47
|
+
this.sub('filter', () => this.syncFilterButtons());
|
|
48
|
+
this.syncFilterButtons();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
setItems(items = []) {
|
|
52
|
+
this.$.chatItems = Array.isArray(items) ? items : [];
|
|
53
|
+
this.renderEmptyState();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
setEmptyMessage(message) {
|
|
57
|
+
this.$.emptyMessage = message || '';
|
|
58
|
+
this.renderEmptyState();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
setFilter(filter = 'all') {
|
|
62
|
+
this.$.filter = filter || 'all';
|
|
63
|
+
this.dispatchEvent(new CustomEvent('chat-list-filter', {
|
|
64
|
+
bubbles: true,
|
|
65
|
+
composed: true,
|
|
66
|
+
detail: { filter: this.$.filter },
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
getChatItemHost(event) {
|
|
71
|
+
return event.composedPath?.().find((el) => el?.tagName?.toLowerCase() === 'chat-list-item')
|
|
72
|
+
|| event.target?.closest?.('chat-list-item')
|
|
73
|
+
|| event.target?.getRootNode?.().host;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
renderEmptyState() {
|
|
77
|
+
let container = this.ref.items;
|
|
78
|
+
if (!container || this.$.chatItems.length > 0) return;
|
|
79
|
+
let empty = document.createElement('sn-empty-state');
|
|
80
|
+
let icon = document.createElement('span');
|
|
81
|
+
icon.className = 'material-symbols-outlined chat-list-empty-icon';
|
|
82
|
+
icon.textContent = 'chat_bubble_outline';
|
|
83
|
+
empty.appendChild(icon);
|
|
84
|
+
empty.append(this.$.emptyMessage);
|
|
85
|
+
container.replaceChildren(empty);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
syncFilterButtons() {
|
|
89
|
+
this.querySelectorAll('.chat-list-filter-btn').forEach((button) => {
|
|
90
|
+
button.toggleAttribute('active', button.dataset.filter === this.$.filter);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
ChatList.template = template;
|
|
96
|
+
ChatList.rootStyles = css;
|
|
97
|
+
ChatList.reg('chat-list');
|
|
98
|
+
|
|
99
|
+
export default ChatList;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { html } from '@symbiotejs/symbiote';
|
|
2
|
+
|
|
3
|
+
export default html`
|
|
4
|
+
<div class="chat-list-shell chat-list">
|
|
5
|
+
<div class="chat-list-header">
|
|
6
|
+
<span class="material-symbols-outlined chat-list-icon">forum</span>
|
|
7
|
+
<span class="chat-list-title" ${{ textContent: 'title' }}></span>
|
|
8
|
+
<sn-button class="chat-list-new-btn" ${{ onclick: 'onNewChat' }}>
|
|
9
|
+
<span class="material-symbols-outlined chat-list-new-btn-icon">add</span>
|
|
10
|
+
<span ${{ textContent: 'newLabel' }}></span>
|
|
11
|
+
</sn-button>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="chat-list-filter-bar">
|
|
14
|
+
<sn-button class="chat-list-filter-btn" active data-filter="all" ${{ onclick: 'onFilterClick', textContent: 'filterAllLabel' }}></sn-button>
|
|
15
|
+
<sn-button class="chat-list-filter-btn" data-filter="project" ${{ onclick: 'onFilterClick', textContent: 'filterProjectLabel' }}></sn-button>
|
|
16
|
+
<sn-button class="chat-list-filter-btn" data-filter="active" ${{ onclick: 'onFilterClick', textContent: 'filterActiveLabel' }}></sn-button>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="chat-list-content chat-list-items" ref="items" ${{ itemize: 'chatItems', 'item-tag': 'chat-list-item' }}></div>
|
|
19
|
+
</div>
|
|
20
|
+
`;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export default /*css*/ `
|
|
2
|
+
:host,
|
|
3
|
+
chat-list-item {
|
|
4
|
+
display: block;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.chat-list-item {
|
|
8
|
+
padding: 10px 14px;
|
|
9
|
+
background: transparent;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
gap: 4px;
|
|
14
|
+
border-bottom: 1px solid var(--sn-node-hover);
|
|
15
|
+
transition: background 0.15s;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.chat-list-item:hover {
|
|
19
|
+
background: var(--sn-node-hover);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:host([active]) .chat-list-item,
|
|
23
|
+
chat-list-item[active] .chat-list-item {
|
|
24
|
+
background: var(--sn-node-bg);
|
|
25
|
+
border-left: 3px solid var(--sn-node-selected);
|
|
26
|
+
padding-left: 11px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.chat-item-top {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
gap: 6px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:host([nested]) .chat-list-item,
|
|
36
|
+
chat-list-item[nested] .chat-list-item {
|
|
37
|
+
margin-left: 16px;
|
|
38
|
+
border-left: 2px solid var(--sn-node-border);
|
|
39
|
+
position: relative;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:host([nested]) .chat-list-item::before,
|
|
43
|
+
chat-list-item[nested] .chat-list-item::before {
|
|
44
|
+
content: '';
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 14px;
|
|
47
|
+
left: -2px;
|
|
48
|
+
width: 10px;
|
|
49
|
+
height: 2px;
|
|
50
|
+
background: var(--sn-node-border);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.chat-project-badge {
|
|
54
|
+
font-size: 9px;
|
|
55
|
+
font-weight: 600;
|
|
56
|
+
padding: 1px 5px;
|
|
57
|
+
border-radius: 3px;
|
|
58
|
+
background: color-mix(in srgb, var(--sn-node-selected) 18%, transparent);
|
|
59
|
+
color: var(--sn-node-selected);
|
|
60
|
+
text-transform: uppercase;
|
|
61
|
+
letter-spacing: 0;
|
|
62
|
+
white-space: nowrap;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.chat-name {
|
|
66
|
+
font-size: 12px;
|
|
67
|
+
font-weight: 500;
|
|
68
|
+
color: var(--sn-text);
|
|
69
|
+
flex: 1;
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
text-overflow: ellipsis;
|
|
72
|
+
white-space: nowrap;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.chat-adapter {
|
|
76
|
+
font-size: 10px;
|
|
77
|
+
color: var(--sn-text-dim);
|
|
78
|
+
font-family: var(--sn-font-mono, monospace);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.chat-preview {
|
|
82
|
+
font-size: 11px;
|
|
83
|
+
color: var(--sn-text-dim);
|
|
84
|
+
overflow: hidden;
|
|
85
|
+
text-overflow: ellipsis;
|
|
86
|
+
white-space: nowrap;
|
|
87
|
+
max-width: 100%;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.chat-meta {
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
gap: 6px;
|
|
94
|
+
font-size: 10px;
|
|
95
|
+
color: var(--sn-text-dim);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.chat-delete {
|
|
99
|
+
display: none;
|
|
100
|
+
background: none;
|
|
101
|
+
border: none;
|
|
102
|
+
color: var(--sn-text-dim);
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
font-size: 14px;
|
|
105
|
+
padding: 0 2px;
|
|
106
|
+
margin-left: auto;
|
|
107
|
+
transition: color 0.15s;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.chat-list-item:hover .chat-delete {
|
|
111
|
+
display: inline;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.chat-delete:hover {
|
|
115
|
+
color: var(--sn-danger-color);
|
|
116
|
+
}
|
|
117
|
+
`;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import Symbiote from '@symbiotejs/symbiote';
|
|
2
|
+
import template from './ChatListItem.tpl.js';
|
|
3
|
+
import css from './ChatListItem.css.js';
|
|
4
|
+
|
|
5
|
+
export class ChatListItem extends Symbiote {
|
|
6
|
+
init$ = {
|
|
7
|
+
id: '',
|
|
8
|
+
name: '',
|
|
9
|
+
project: '',
|
|
10
|
+
adapter: '',
|
|
11
|
+
status: '',
|
|
12
|
+
time: '',
|
|
13
|
+
lastMessage: '',
|
|
14
|
+
depth: 0,
|
|
15
|
+
isActive: false,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
renderCallback() {
|
|
19
|
+
this.sub('isActive', (isActive) => {
|
|
20
|
+
this.toggleAttribute('active', Boolean(isActive));
|
|
21
|
+
});
|
|
22
|
+
this.sub('depth', (depth) => {
|
|
23
|
+
this.toggleAttribute('nested', Number(depth) > 0);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
ChatListItem.template = template;
|
|
29
|
+
ChatListItem.rootStyles = css;
|
|
30
|
+
ChatListItem.reg('chat-list-item');
|
|
31
|
+
|
|
32
|
+
export default ChatListItem;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { html } from '@symbiotejs/symbiote';
|
|
2
|
+
|
|
3
|
+
export default html`
|
|
4
|
+
<div class="chat-list-item" ref="item" ${{ onclick: '^onChatSelect' }}>
|
|
5
|
+
<div class="chat-item-top">
|
|
6
|
+
<span class="chat-project-badge" ${{ textContent: 'project', hidden: '!project' }}></span>
|
|
7
|
+
<span class="chat-name" ${{ textContent: 'name' }}></span>
|
|
8
|
+
<span class="chat-adapter" ${{ textContent: 'adapter' }}></span>
|
|
9
|
+
<button class="chat-delete" title="Delete" ${{ onclick: '^onChatDelete' }}>×</button>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="chat-preview" ${{ textContent: 'lastMessage', hidden: '!lastMessage' }}></div>
|
|
12
|
+
<div class="chat-meta">
|
|
13
|
+
<span ${{ textContent: 'status' }}></span>
|
|
14
|
+
<span ${{ textContent: 'time' }}></span>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
`;
|