@openviking/react 0.1.4 → 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/README.md +3 -1
- package/dist/28~0.js +15 -0
- package/dist/2~0.js +6 -3
- package/dist/3c~0.js +3 -1
- package/dist/3~0.js +3 -1
- package/dist/ae~0.js +6 -2
- package/dist/a~0.js +77 -70
- package/dist/client/provider.d.ts +10 -6
- package/dist/components/agent-connect/agent-connect-code-block.d.ts +14 -0
- package/dist/components/agent-connect/agent-connect-copy.d.ts +3 -0
- package/dist/components/agent-connect/agent-connect-design.d.ts +1 -1
- package/dist/components/agent-connect/agent-connect-installer.d.ts +1 -0
- package/dist/components/agent-connect/agent-connect-instructions-view.d.ts +4 -6
- package/dist/components/agent-connect/agent-connect-instructions.d.ts +13 -0
- package/dist/components/agent-connect/agent-connect-markdown.d.ts +8 -2
- package/dist/components/agent-connect/agent-connect-mask.d.ts +10 -0
- package/dist/components/agent-connect/agent-connect.d.ts +1 -1
- package/dist/components/agent-connect/locales/en-US.d.ts +3 -0
- package/dist/components/agent-connect/style.css +115 -1
- package/dist/components/agent-connect/types.d.ts +5 -3
- package/dist/components/agent-connect/use-agent-connect-copy.d.ts +6 -0
- package/dist/components/directory-tour/types.d.ts +2 -1
- package/dist/components/file-browser-entries/file-browser-entries.d.ts +1 -1
- package/dist/components/file-browser-entries/style.css +115 -1
- package/dist/components/file-browser-entries/types.d.ts +2 -2
- package/dist/components/file-preview/types.d.ts +2 -2
- package/dist/components/file-tree/types.d.ts +2 -2
- package/dist/components/scope-switcher/scope-switcher.d.ts +2 -2
- package/dist/components/scope-switcher/types.d.ts +5 -5
- package/dist/components/style.css +230 -2
- package/dist/components/tui/tui.d.ts +1 -1
- package/dist/components/tui/types.d.ts +2 -2
- package/dist/components/viking-bot/ark-message-list-view.d.ts +4 -1
- package/dist/components/viking-bot/interaction/types.d.ts +2 -2
- package/dist/components/viking-bot/interaction/viking-bot-interaction.d.ts +1 -1
- package/dist/components/viking-bot/session-actions.d.ts +2 -2
- package/dist/components/viking-bot/types.d.ts +7 -7
- package/dist/components/viking-bot/viking-bot.d.ts +1 -1
- package/dist/c~0.js +168 -154
- package/dist/e~0.js +3 -1
- package/dist/f~0.js +13 -7
- package/dist/lk~0.js +4 -1
- package/dist/l~0.js +77 -71
- package/dist/modules/console/console.d.ts +1 -1
- package/dist/modules/console/types.d.ts +2 -2
- package/dist/modules/console/use-console.d.ts +1 -1
- package/dist/modules/file-browser/file-browser.d.ts +1 -1
- package/dist/modules/file-browser/style.css +115 -1
- package/dist/modules/file-browser/types.d.ts +2 -2
- package/dist/modules/file-browser/use-file-browser.d.ts +3 -3
- package/dist/modules/scope-cascade/scope-cascade.d.ts +2 -2
- package/dist/modules/scope-cascade/types.d.ts +2 -2
- package/dist/modules/style.css +115 -1
- package/dist/n~0.js +3 -1
- package/dist/shared/locale-context.d.ts +8 -0
- package/dist/style.css +345 -3
- package/dist/u~0.js +324 -96
- package/dist/viking-bot-composer~0.js +3 -1
- package/dist/viking-bot-interaction~0.js +3 -1
- package/package.json +3 -1
package/dist/c~0.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Suspense, createContext, forwardRef, lazy, useContext, useEffect, useId
|
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
4
|
import { resolveLocale } from "./nx~0.js";
|
|
5
5
|
import { useOverlayPosition } from "./o~0.js";
|
|
6
|
+
import { useLocale, LocaleProvider } from "./28~0.js";
|
|
6
7
|
import { Tooltip } from "./r~0.js";
|
|
7
8
|
import { VikingBotIcon } from "./lg~0.js";
|
|
8
9
|
import { VikingBotInteraction } from "./w~0.js";
|
|
@@ -186,98 +187,102 @@ function BotPopover({ label, trigger: renderTrigger, children, placement = 'bott
|
|
|
186
187
|
]
|
|
187
188
|
});
|
|
188
189
|
}
|
|
189
|
-
function VikingBotSessionActions({ sessions, extra, labels: overrides, locale }) {
|
|
190
|
+
function VikingBotSessionActions({ sessions, extra, labels: overrides, locale: localeProp }) {
|
|
191
|
+
const locale = useLocale(localeProp);
|
|
190
192
|
const labels = resolveVikingBotLabels(locale, overrides);
|
|
191
|
-
return /*#__PURE__*/
|
|
192
|
-
|
|
193
|
-
children:
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
193
|
+
return /*#__PURE__*/ jsx(LocaleProvider, {
|
|
194
|
+
locale: locale,
|
|
195
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
196
|
+
className: "ov-viking-bot__session-actions",
|
|
197
|
+
children: [
|
|
198
|
+
extra,
|
|
199
|
+
sessions ? /*#__PURE__*/ jsxs(Fragment, {
|
|
200
|
+
children: [
|
|
201
|
+
/*#__PURE__*/ jsx(BotPopover, {
|
|
202
|
+
label: labels.sessionHistory,
|
|
203
|
+
onOpen: sessions.onOpenHistory,
|
|
204
|
+
trigger: (props)=>/*#__PURE__*/ jsx(Tooltip, {
|
|
205
|
+
content: labels.sessionHistory,
|
|
206
|
+
disabled: true === props['aria-expanded'],
|
|
207
|
+
children: /*#__PURE__*/ jsx("button", {
|
|
208
|
+
...props,
|
|
209
|
+
type: "button",
|
|
210
|
+
className: "ov-viking-bot__header-action",
|
|
211
|
+
"aria-label": labels.sessionHistory,
|
|
212
|
+
children: /*#__PURE__*/ jsx(VikingBotIcon, {
|
|
213
|
+
name: "history"
|
|
214
|
+
})
|
|
210
215
|
})
|
|
216
|
+
}),
|
|
217
|
+
children: (close)=>/*#__PURE__*/ jsxs("div", {
|
|
218
|
+
className: "ov-viking-bot__session-history",
|
|
219
|
+
"aria-busy": sessions.isLoading,
|
|
220
|
+
children: [
|
|
221
|
+
sessions.isLoading ? /*#__PURE__*/ jsx("p", {
|
|
222
|
+
role: "status",
|
|
223
|
+
children: labels.loading
|
|
224
|
+
}) : null,
|
|
225
|
+
sessions.error ? /*#__PURE__*/ jsx("p", {
|
|
226
|
+
role: "alert",
|
|
227
|
+
children: sessions.error
|
|
228
|
+
}) : null,
|
|
229
|
+
sessions.isLoading || sessions.error || sessions.items.length ? null : /*#__PURE__*/ jsx("p", {
|
|
230
|
+
className: "ov-viking-bot__empty-history",
|
|
231
|
+
children: labels.emptySessions
|
|
232
|
+
}),
|
|
233
|
+
/*#__PURE__*/ jsx("ul", {
|
|
234
|
+
children: sessions.items.map((item)=>{
|
|
235
|
+
const date = new Date(item.updatedAt ?? '');
|
|
236
|
+
const validDate = Number.isFinite(date.getTime());
|
|
237
|
+
return /*#__PURE__*/ jsx("li", {
|
|
238
|
+
children: /*#__PURE__*/ jsxs("button", {
|
|
239
|
+
type: "button",
|
|
240
|
+
"aria-current": sessions.currentId === item.id || void 0,
|
|
241
|
+
onClick: ()=>{
|
|
242
|
+
close();
|
|
243
|
+
sessions.onSelect(item.id);
|
|
244
|
+
},
|
|
245
|
+
children: [
|
|
246
|
+
/*#__PURE__*/ jsx("span", {
|
|
247
|
+
children: item.title
|
|
248
|
+
}),
|
|
249
|
+
validDate ? /*#__PURE__*/ jsx("time", {
|
|
250
|
+
dateTime: item.updatedAt,
|
|
251
|
+
children: new Intl.DateTimeFormat(locale, {
|
|
252
|
+
dateStyle: 'short',
|
|
253
|
+
timeStyle: 'short'
|
|
254
|
+
}).format(date)
|
|
255
|
+
}) : null
|
|
256
|
+
]
|
|
257
|
+
})
|
|
258
|
+
}, item.id);
|
|
259
|
+
})
|
|
260
|
+
}),
|
|
261
|
+
sessions.hasMore && sessions.onLoadMore ? /*#__PURE__*/ jsx("button", {
|
|
262
|
+
type: "button",
|
|
263
|
+
disabled: sessions.isLoading,
|
|
264
|
+
onClick: sessions.onLoadMore,
|
|
265
|
+
children: labels.loadMore
|
|
266
|
+
}) : null
|
|
267
|
+
]
|
|
268
|
+
})
|
|
269
|
+
}),
|
|
270
|
+
/*#__PURE__*/ jsx(Tooltip, {
|
|
271
|
+
content: labels.newSession,
|
|
272
|
+
children: /*#__PURE__*/ jsx("button", {
|
|
273
|
+
type: "button",
|
|
274
|
+
className: "ov-viking-bot__header-action",
|
|
275
|
+
"aria-label": labels.newSession,
|
|
276
|
+
onClick: sessions.onNew,
|
|
277
|
+
children: /*#__PURE__*/ jsx(VikingBotIcon, {
|
|
278
|
+
name: "newSession"
|
|
211
279
|
})
|
|
212
|
-
}),
|
|
213
|
-
children: (close)=>/*#__PURE__*/ jsxs("div", {
|
|
214
|
-
className: "ov-viking-bot__session-history",
|
|
215
|
-
"aria-busy": sessions.isLoading,
|
|
216
|
-
children: [
|
|
217
|
-
sessions.isLoading ? /*#__PURE__*/ jsx("p", {
|
|
218
|
-
role: "status",
|
|
219
|
-
children: labels.loading
|
|
220
|
-
}) : null,
|
|
221
|
-
sessions.error ? /*#__PURE__*/ jsx("p", {
|
|
222
|
-
role: "alert",
|
|
223
|
-
children: sessions.error
|
|
224
|
-
}) : null,
|
|
225
|
-
sessions.isLoading || sessions.error || sessions.items.length ? null : /*#__PURE__*/ jsx("p", {
|
|
226
|
-
className: "ov-viking-bot__empty-history",
|
|
227
|
-
children: labels.emptySessions
|
|
228
|
-
}),
|
|
229
|
-
/*#__PURE__*/ jsx("ul", {
|
|
230
|
-
children: sessions.items.map((item)=>{
|
|
231
|
-
const date = new Date(item.updatedAt ?? '');
|
|
232
|
-
const validDate = Number.isFinite(date.getTime());
|
|
233
|
-
return /*#__PURE__*/ jsx("li", {
|
|
234
|
-
children: /*#__PURE__*/ jsxs("button", {
|
|
235
|
-
type: "button",
|
|
236
|
-
"aria-current": sessions.currentId === item.id || void 0,
|
|
237
|
-
onClick: ()=>{
|
|
238
|
-
close();
|
|
239
|
-
sessions.onSelect(item.id);
|
|
240
|
-
},
|
|
241
|
-
children: [
|
|
242
|
-
/*#__PURE__*/ jsx("span", {
|
|
243
|
-
children: item.title
|
|
244
|
-
}),
|
|
245
|
-
validDate ? /*#__PURE__*/ jsx("time", {
|
|
246
|
-
dateTime: item.updatedAt,
|
|
247
|
-
children: new Intl.DateTimeFormat(locale, {
|
|
248
|
-
dateStyle: 'short',
|
|
249
|
-
timeStyle: 'short'
|
|
250
|
-
}).format(date)
|
|
251
|
-
}) : null
|
|
252
|
-
]
|
|
253
|
-
})
|
|
254
|
-
}, item.id);
|
|
255
|
-
})
|
|
256
|
-
}),
|
|
257
|
-
sessions.hasMore && sessions.onLoadMore ? /*#__PURE__*/ jsx("button", {
|
|
258
|
-
type: "button",
|
|
259
|
-
disabled: sessions.isLoading,
|
|
260
|
-
onClick: sessions.onLoadMore,
|
|
261
|
-
children: labels.loadMore
|
|
262
|
-
}) : null
|
|
263
|
-
]
|
|
264
|
-
})
|
|
265
|
-
}),
|
|
266
|
-
/*#__PURE__*/ jsx(Tooltip, {
|
|
267
|
-
content: labels.newSession,
|
|
268
|
-
children: /*#__PURE__*/ jsx("button", {
|
|
269
|
-
type: "button",
|
|
270
|
-
className: "ov-viking-bot__header-action",
|
|
271
|
-
"aria-label": labels.newSession,
|
|
272
|
-
onClick: sessions.onNew,
|
|
273
|
-
children: /*#__PURE__*/ jsx(VikingBotIcon, {
|
|
274
|
-
name: "newSession"
|
|
275
280
|
})
|
|
276
281
|
})
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
282
|
+
]
|
|
283
|
+
}) : null
|
|
284
|
+
]
|
|
285
|
+
})
|
|
281
286
|
});
|
|
282
287
|
}
|
|
283
288
|
function QuickInputs({ items, onSelect, disabled }) {
|
|
@@ -555,7 +560,8 @@ function ListSkeleton() {
|
|
|
555
560
|
});
|
|
556
561
|
}
|
|
557
562
|
function VikingBotMessageList(props) {
|
|
558
|
-
const
|
|
563
|
+
const locale = useLocale(props.locale);
|
|
564
|
+
const labels = resolveVikingBotLabels(locale, props.labels);
|
|
559
565
|
const items = toRenderItems(props.messages, props.streaming);
|
|
560
566
|
if (0 === items.length) return /*#__PURE__*/ jsx("div", {
|
|
561
567
|
className: "ov-viking-bot__empty",
|
|
@@ -564,11 +570,13 @@ function VikingBotMessageList(props) {
|
|
|
564
570
|
return /*#__PURE__*/ jsx(Suspense, {
|
|
565
571
|
fallback: /*#__PURE__*/ jsx(ListSkeleton, {}),
|
|
566
572
|
children: /*#__PURE__*/ jsx(List, {
|
|
567
|
-
...props
|
|
573
|
+
...props,
|
|
574
|
+
locale: locale
|
|
568
575
|
})
|
|
569
576
|
});
|
|
570
577
|
}
|
|
571
|
-
function VikingBot({ messages, className, streaming, draft, attachments, isSending, isAvailable = true, unavailableMessage, emptyState, header, sessions, headerActions, locale, quickInputs, onQuickInputSelect, references, footer, children, messageList, composer, interaction, interactionSlot, listKey, composerRef, onDraftChange, onFilesAdded, onAttachmentRemove, onSend, onCancel, onOpenUri, onCopy, onMessageAction, labels: overrides, ...rest }) {
|
|
578
|
+
function VikingBot({ messages, className, streaming, draft, attachments, isSending, isAvailable = true, unavailableMessage, emptyState, header, sessions, headerActions, locale: localeProp, quickInputs, onQuickInputSelect, references, footer, children, messageList, composer, interaction, interactionSlot, listKey, composerRef, onDraftChange, onFilesAdded, onAttachmentRemove, onSend, onCancel, onOpenUri, onCopy, onMessageAction, labels: overrides, ...rest }) {
|
|
579
|
+
const locale = useLocale(localeProp);
|
|
572
580
|
const labels = resolveVikingBotLabels(locale, overrides);
|
|
573
581
|
const hasMessages = messages.length > 0;
|
|
574
582
|
const localComposer = useRef(null);
|
|
@@ -593,75 +601,81 @@ function VikingBot({ messages, className, streaming, draft, attachments, isSendi
|
|
|
593
601
|
className
|
|
594
602
|
].filter(Boolean).join(' '),
|
|
595
603
|
...rest,
|
|
596
|
-
children:
|
|
604
|
+
children: /*#__PURE__*/ jsx(LocaleProvider, {
|
|
605
|
+
locale: locale,
|
|
606
|
+
children: children
|
|
607
|
+
})
|
|
597
608
|
});
|
|
598
609
|
return /*#__PURE__*/ jsx(QuickInputScope.Provider, {
|
|
599
610
|
value: shortcuts.tracker,
|
|
600
|
-
children: /*#__PURE__*/
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
className
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
611
|
+
children: /*#__PURE__*/ jsx(LocaleProvider, {
|
|
612
|
+
locale: locale,
|
|
613
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
614
|
+
className: [
|
|
615
|
+
'ov-viking-bot',
|
|
616
|
+
className
|
|
617
|
+
].filter(Boolean).join(' '),
|
|
618
|
+
...rest,
|
|
619
|
+
children: [
|
|
620
|
+
renderedHeader ? /*#__PURE__*/ jsx("div", {
|
|
621
|
+
className: "ov-viking-bot__header",
|
|
622
|
+
children: renderedHeader
|
|
623
|
+
}) : null,
|
|
624
|
+
isAvailable ? null : /*#__PURE__*/ jsx("p", {
|
|
625
|
+
className: "ov-viking-bot__unavailable",
|
|
626
|
+
role: "status",
|
|
627
|
+
children: unavailableMessage ?? labels.unavailable
|
|
628
|
+
}),
|
|
629
|
+
/*#__PURE__*/ jsx("div", {
|
|
630
|
+
className: "ov-viking-bot__body",
|
|
631
|
+
children: void 0 !== messageList ? messageList : hasMessages || streaming ? /*#__PURE__*/ jsx(VikingBotMessageList, {
|
|
632
|
+
locale: locale,
|
|
633
|
+
messages: messages,
|
|
634
|
+
streaming: streaming,
|
|
635
|
+
listKey: listKey,
|
|
636
|
+
onOpenUri: onOpenUri,
|
|
637
|
+
onCopy: onCopy,
|
|
638
|
+
onMessageAction: onMessageAction,
|
|
639
|
+
labels: overrides
|
|
640
|
+
}) : /*#__PURE__*/ jsx("div", {
|
|
641
|
+
className: `ov-viking-bot__empty${void 0 === emptyState ? ' ov-viking-bot__empty--welcome' : ''}`,
|
|
642
|
+
children: void 0 === emptyState ? /*#__PURE__*/ jsx(VikingBotWelcome, {
|
|
643
|
+
labels: labels,
|
|
644
|
+
quickInputs: quickInputs,
|
|
645
|
+
onSelect: selectQuickInput,
|
|
646
|
+
disabled: isSending || !isAvailable || !onDraftChange && !onQuickInputSelect
|
|
647
|
+
}) : emptyState
|
|
648
|
+
})
|
|
649
|
+
}),
|
|
650
|
+
footer ? /*#__PURE__*/ jsx("div", {
|
|
651
|
+
className: "ov-viking-bot__footer",
|
|
652
|
+
children: footer
|
|
653
|
+
}) : null,
|
|
654
|
+
interaction ? interactionSlot ?? /*#__PURE__*/ jsx(VikingBotInteraction, {
|
|
655
|
+
...interaction,
|
|
656
|
+
locale: interaction.locale ?? locale
|
|
657
|
+
}) : composer ?? (void 0 !== draft ? /*#__PURE__*/ jsx(lazy_composer_VikingBotComposer, {
|
|
619
658
|
locale: locale,
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
659
|
+
ref: inputRef,
|
|
660
|
+
value: draft,
|
|
661
|
+
attachments: attachments,
|
|
662
|
+
disabled: !isAvailable,
|
|
663
|
+
isSending: isSending,
|
|
664
|
+
references: references,
|
|
665
|
+
quickInputs: hasMessages || streaming || void 0 !== emptyState ? quickInputs : void 0,
|
|
666
|
+
onQuickInputSelect: selectQuickInput,
|
|
667
|
+
onValueChange: onDraftChange ? (next)=>{
|
|
668
|
+
shortcuts.tracker.edit(next);
|
|
669
|
+
onDraftChange(next);
|
|
670
|
+
} : void 0,
|
|
671
|
+
onFilesAdded: onFilesAdded,
|
|
672
|
+
onAttachmentRemove: onAttachmentRemove,
|
|
673
|
+
onSend: onSend,
|
|
674
|
+
onCancel: onCancel,
|
|
626
675
|
labels: overrides
|
|
627
|
-
}) :
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
labels: labels,
|
|
631
|
-
quickInputs: quickInputs,
|
|
632
|
-
onSelect: selectQuickInput,
|
|
633
|
-
disabled: isSending || !isAvailable || !onDraftChange && !onQuickInputSelect
|
|
634
|
-
}) : emptyState
|
|
635
|
-
})
|
|
636
|
-
}),
|
|
637
|
-
footer ? /*#__PURE__*/ jsx("div", {
|
|
638
|
-
className: "ov-viking-bot__footer",
|
|
639
|
-
children: footer
|
|
640
|
-
}) : null,
|
|
641
|
-
interaction ? interactionSlot ?? /*#__PURE__*/ jsx(VikingBotInteraction, {
|
|
642
|
-
...interaction,
|
|
643
|
-
locale: locale
|
|
644
|
-
}) : composer ?? (void 0 !== draft ? /*#__PURE__*/ jsx(lazy_composer_VikingBotComposer, {
|
|
645
|
-
locale: locale,
|
|
646
|
-
ref: inputRef,
|
|
647
|
-
value: draft,
|
|
648
|
-
attachments: attachments,
|
|
649
|
-
disabled: !isAvailable,
|
|
650
|
-
isSending: isSending,
|
|
651
|
-
references: references,
|
|
652
|
-
quickInputs: hasMessages || streaming || void 0 !== emptyState ? quickInputs : void 0,
|
|
653
|
-
onQuickInputSelect: selectQuickInput,
|
|
654
|
-
onValueChange: onDraftChange ? (next)=>{
|
|
655
|
-
shortcuts.tracker.edit(next);
|
|
656
|
-
onDraftChange(next);
|
|
657
|
-
} : void 0,
|
|
658
|
-
onFilesAdded: onFilesAdded,
|
|
659
|
-
onAttachmentRemove: onAttachmentRemove,
|
|
660
|
-
onSend: onSend,
|
|
661
|
-
onCancel: onCancel,
|
|
662
|
-
labels: overrides
|
|
663
|
-
}) : null)
|
|
664
|
-
]
|
|
676
|
+
}) : null)
|
|
677
|
+
]
|
|
678
|
+
})
|
|
665
679
|
})
|
|
666
680
|
});
|
|
667
681
|
}
|
package/dist/e~0.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useId, useRef, useState } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
|
+
import { useLocale } from "./28~0.js";
|
|
4
5
|
import { resolveLocale } from "./nx~0.js";
|
|
5
6
|
function useTourAnchor(target, locateTarget, timeout, attempt) {
|
|
6
7
|
const [state, setState] = useState({
|
|
@@ -197,7 +198,8 @@ function TourSession(props) {
|
|
|
197
198
|
advance: advance
|
|
198
199
|
}, step.id);
|
|
199
200
|
}
|
|
200
|
-
function TourStep({ step, index, advance, steps, locateTarget, locateTimeout = 10000, placement = 'right', onClose, labels, locale, className, style }) {
|
|
201
|
+
function TourStep({ step, index, advance, steps, locateTarget, locateTimeout = 10000, placement = 'right', onClose, labels, locale: localeProp, className, style }) {
|
|
202
|
+
const locale = useLocale(localeProp);
|
|
201
203
|
const text = resolveLocale({
|
|
202
204
|
'en-US': en_US,
|
|
203
205
|
'zh-CN': zh_CN
|
package/dist/f~0.js
CHANGED
|
@@ -3,6 +3,7 @@ import { useCallback, useEffect, useId, useRef, useState } from "react";
|
|
|
3
3
|
import { resolveLocale } from "./nx~0.js";
|
|
4
4
|
import { checkreact } from "./0~0.js";
|
|
5
5
|
import { searchreact } from "./p~0.js";
|
|
6
|
+
import { useLocale, LocaleProvider } from "./28~0.js";
|
|
6
7
|
const SvgChevronDown = (props)=>/*#__PURE__*/ jsx("svg", {
|
|
7
8
|
xmlns: "http://www.w3.org/2000/svg",
|
|
8
9
|
width: 14,
|
|
@@ -206,7 +207,8 @@ function ScopePanel({ label, data, state, slots, actions, onSelect, labels }) {
|
|
|
206
207
|
});
|
|
207
208
|
}
|
|
208
209
|
function ScopeSelector(props) {
|
|
209
|
-
const { identity, trigger: triggerContent
|
|
210
|
+
const { identity, trigger: triggerContent } = props;
|
|
211
|
+
const locale = useLocale(props.locale);
|
|
210
212
|
const labels = resolveScopeLabels(locale, props.labels);
|
|
211
213
|
const selectable = 'selectable' === props.kind ? props : void 0;
|
|
212
214
|
const data = selectable?.data;
|
|
@@ -337,12 +339,16 @@ function ScopeSelector(props) {
|
|
|
337
339
|
]
|
|
338
340
|
});
|
|
339
341
|
}
|
|
340
|
-
function ScopeSwitcher({ locale, children, className = '', ...props }) {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
342
|
+
function ScopeSwitcher({ locale: localeProp, children, className = '', ...props }) {
|
|
343
|
+
const locale = useLocale(localeProp);
|
|
344
|
+
return /*#__PURE__*/ jsx(LocaleProvider, {
|
|
345
|
+
locale: locale,
|
|
346
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
347
|
+
lang: locale,
|
|
348
|
+
...props,
|
|
349
|
+
className: `ov-scope-switcher ${className}`,
|
|
350
|
+
children: children
|
|
351
|
+
})
|
|
346
352
|
});
|
|
347
353
|
}
|
|
348
354
|
export { ScopeSelector, ScopeSwitcher };
|
package/dist/lk~0.js
CHANGED
|
@@ -2,6 +2,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useState, useSyncExternalStore } from "react";
|
|
3
3
|
import { resolveLocale } from "./nx~0.js";
|
|
4
4
|
import { ScopeSelector, ScopeSwitcher } from "./f~0.js";
|
|
5
|
+
import { useLocale } from "./28~0.js";
|
|
5
6
|
const messages = {
|
|
6
7
|
levelNames: [
|
|
7
8
|
'Library',
|
|
@@ -230,7 +231,9 @@ function LevelView({ level, locale, state, name, labels, retryLabel }) {
|
|
|
230
231
|
}
|
|
231
232
|
});
|
|
232
233
|
}
|
|
233
|
-
function ScopeCascade({ controller, locale, labels, levelNames
|
|
234
|
+
function ScopeCascade({ controller, locale: localeProp, labels, levelNames: names, retryLabel, ...props }) {
|
|
235
|
+
const locale = useLocale(localeProp);
|
|
236
|
+
const levelNames = names ?? resolveScopeCascadeLabels(locale).levelNames;
|
|
234
237
|
return /*#__PURE__*/ jsxs(ScopeSwitcher, {
|
|
235
238
|
...props,
|
|
236
239
|
locale: locale,
|
package/dist/l~0.js
CHANGED
|
@@ -7,6 +7,7 @@ import { FileBrowserEntries } from "./2~0.js";
|
|
|
7
7
|
import { FileTree as file_tree_FileTree } from "./n~0.js";
|
|
8
8
|
import { resolveLocale } from "./nx~0.js";
|
|
9
9
|
import { OV_PATHS } from "./ck~0.js";
|
|
10
|
+
import { useLocale, LocaleProvider } from "./28~0.js";
|
|
10
11
|
import { useOvClient } from "./ae~0.js";
|
|
11
12
|
function clampResizableWidth(width, min, max) {
|
|
12
13
|
const rounded = Math.round(width);
|
|
@@ -1239,7 +1240,8 @@ function useFsTree({ client, rootUri, defaultExpandedUri, requestOptions }) {
|
|
|
1239
1240
|
...state
|
|
1240
1241
|
};
|
|
1241
1242
|
}
|
|
1242
|
-
function useFileBrowser({ rootUri, locale
|
|
1243
|
+
function useFileBrowser({ rootUri, locale: localeProp, controlled = false, summaryLabels, formatCharacterCount, defaultExpandedUri, currentUri, requestOptions, onUriChange }) {
|
|
1244
|
+
const locale = useLocale(localeProp);
|
|
1243
1245
|
const client = useOvClient();
|
|
1244
1246
|
const [query, setQuery] = useState('');
|
|
1245
1247
|
const [pendingUri, setPendingUri] = useState(currentUri);
|
|
@@ -1349,7 +1351,8 @@ function useFileBrowser({ rootUri, locale = 'en-US', controlled = false, summary
|
|
|
1349
1351
|
actions
|
|
1350
1352
|
};
|
|
1351
1353
|
}
|
|
1352
|
-
function FileBrowser({ uri, defaultUri, rootUri = 'viking://', defaultExpandedUri, locale, agentConnect, onUriChange, onImportResources, renderImportResources, labels, requestOptions, className, style, ...rest }) {
|
|
1354
|
+
function FileBrowser({ uri, defaultUri, rootUri = 'viking://', defaultExpandedUri, locale: localeProp, agentConnect, onUriChange, onImportResources, renderImportResources, labels, requestOptions, className, style, ...rest }) {
|
|
1355
|
+
const locale = useLocale(localeProp);
|
|
1353
1356
|
const [internalUri, setInternalUri] = useState(()=>defaultUri ?? null);
|
|
1354
1357
|
const [preferredTreeWidth, setPreferredTreeWidth] = useState(352);
|
|
1355
1358
|
const searchId = useId();
|
|
@@ -1390,77 +1393,80 @@ function FileBrowser({ uri, defaultUri, rootUri = 'viking://', defaultExpandedUr
|
|
|
1390
1393
|
requestOptions,
|
|
1391
1394
|
onUriChange: changeUri
|
|
1392
1395
|
});
|
|
1393
|
-
return /*#__PURE__*/
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
className
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1396
|
+
return /*#__PURE__*/ jsx(LocaleProvider, {
|
|
1397
|
+
locale: locale,
|
|
1398
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
1399
|
+
...rest,
|
|
1400
|
+
ref: layoutRef,
|
|
1401
|
+
className: [
|
|
1402
|
+
'ov-file-browser',
|
|
1403
|
+
className
|
|
1404
|
+
].filter(Boolean).join(' '),
|
|
1405
|
+
style: {
|
|
1406
|
+
...style,
|
|
1407
|
+
'--ov-file-browser-tree-width': `${treeWidth}px`
|
|
1408
|
+
},
|
|
1409
|
+
children: [
|
|
1410
|
+
/*#__PURE__*/ jsx("div", {
|
|
1411
|
+
className: "ov-file-browser__tree",
|
|
1412
|
+
children: /*#__PURE__*/ jsx(FileBrowserTreePane, {
|
|
1413
|
+
entries: {
|
|
1414
|
+
agentConnect,
|
|
1415
|
+
onImportResources,
|
|
1416
|
+
renderImportResources,
|
|
1417
|
+
labels: labels?.entries
|
|
1418
|
+
},
|
|
1419
|
+
searchId: searchId,
|
|
1420
|
+
browser: browser,
|
|
1421
|
+
treeLabels: text.tree,
|
|
1422
|
+
locale: locale,
|
|
1423
|
+
searchPlaceholder: text.searchPlaceholder,
|
|
1424
|
+
refreshLabel: text.refresh,
|
|
1425
|
+
searchLoading: text.searchLoading,
|
|
1426
|
+
searchEmpty: text.searchEmpty,
|
|
1427
|
+
searchErrorLabel: text.searchFailed,
|
|
1428
|
+
retryLabel: text.retry
|
|
1429
|
+
})
|
|
1430
|
+
}),
|
|
1431
|
+
/*#__PURE__*/ jsx(ResizableHandle, {
|
|
1432
|
+
label: text.resizeTree,
|
|
1433
|
+
min: 200,
|
|
1434
|
+
max: treeMaxWidth,
|
|
1435
|
+
value: treeWidth,
|
|
1436
|
+
onResize: setPreferredTreeWidth,
|
|
1437
|
+
className: "ov-file-browser__resizer"
|
|
1438
|
+
}),
|
|
1439
|
+
browser.previewTabs && browser.previewTabs.length > 0 ? /*#__PURE__*/ jsx(FileBrowserDetail, {
|
|
1440
|
+
tabs: browser.previewTabs,
|
|
1441
|
+
activeKey: browser.previewKey,
|
|
1417
1442
|
locale: locale,
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
source: text.sourceMode,
|
|
1443
|
-
copyPath: text.copyPath,
|
|
1444
|
-
copyContent: text.copyContent,
|
|
1445
|
-
download: text.download,
|
|
1446
|
-
viewSwitch: text.viewSwitch
|
|
1447
|
-
},
|
|
1448
|
-
onActiveKeyChange: browser.actions.setPreviewKey
|
|
1449
|
-
}) : browser.currentUri && browser.previewError ? /*#__PURE__*/ jsx("div", {
|
|
1450
|
-
className: "ov-file-browser__detail",
|
|
1451
|
-
children: /*#__PURE__*/ jsx(FileBrowserFailure, {
|
|
1452
|
-
message: text.error,
|
|
1453
|
-
detail: browser.previewError.message,
|
|
1454
|
-
retryLabel: text.retry,
|
|
1455
|
-
onRetry: ()=>void browser.actions.refresh()
|
|
1456
|
-
})
|
|
1457
|
-
}) : /*#__PURE__*/ jsx("div", {
|
|
1458
|
-
className: "ov-file-browser__detail",
|
|
1459
|
-
children: /*#__PURE__*/ jsx(FileBrowserEmpty, {
|
|
1460
|
-
label: text.empty
|
|
1443
|
+
labels: previewLabels,
|
|
1444
|
+
footer: browser.previewFooter,
|
|
1445
|
+
viewLabels: {
|
|
1446
|
+
preview: text.previewMode,
|
|
1447
|
+
source: text.sourceMode,
|
|
1448
|
+
copyPath: text.copyPath,
|
|
1449
|
+
copyContent: text.copyContent,
|
|
1450
|
+
download: text.download,
|
|
1451
|
+
viewSwitch: text.viewSwitch
|
|
1452
|
+
},
|
|
1453
|
+
onActiveKeyChange: browser.actions.setPreviewKey
|
|
1454
|
+
}) : browser.currentUri && browser.previewError ? /*#__PURE__*/ jsx("div", {
|
|
1455
|
+
className: "ov-file-browser__detail",
|
|
1456
|
+
children: /*#__PURE__*/ jsx(FileBrowserFailure, {
|
|
1457
|
+
message: text.error,
|
|
1458
|
+
detail: browser.previewError.message,
|
|
1459
|
+
retryLabel: text.retry,
|
|
1460
|
+
onRetry: ()=>void browser.actions.refresh()
|
|
1461
|
+
})
|
|
1462
|
+
}) : /*#__PURE__*/ jsx("div", {
|
|
1463
|
+
className: "ov-file-browser__detail",
|
|
1464
|
+
children: /*#__PURE__*/ jsx(FileBrowserEmpty, {
|
|
1465
|
+
label: text.empty
|
|
1466
|
+
})
|
|
1461
1467
|
})
|
|
1462
|
-
|
|
1463
|
-
|
|
1468
|
+
]
|
|
1469
|
+
})
|
|
1464
1470
|
});
|
|
1465
1471
|
}
|
|
1466
1472
|
export { FileBrowser, useFileBrowser };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ConsoleProps } from './types.js';
|
|
2
|
-
export declare function Console({ mode, defaultMode, locale, quickCommands, scopeKey, requestOptions, onModeChange, onOpenUri, conversation, slots, labels: overrides, className, ...rest }: ConsoleProps): import("react").JSX.Element;
|
|
2
|
+
export declare function Console({ mode, defaultMode, locale: localeProp, quickCommands, scopeKey, requestOptions, onModeChange, onOpenUri, conversation, slots, labels: overrides, className, ...rest }: ConsoleProps): import("react").JSX.Element;
|
|
@@ -39,8 +39,8 @@ export interface ConsoleOptions {
|
|
|
39
39
|
requestOptions?: OvRequestOptions;
|
|
40
40
|
}
|
|
41
41
|
export interface ConsoleProps extends ConsoleOptions, Omit<HTMLAttributes<HTMLDivElement>, 'onSelect' | 'children'> {
|
|
42
|
-
/**
|
|
43
|
-
locale
|
|
42
|
+
/** 可选文案语言;继承上层,最终默认英文。Optional locale; inherits or defaults to en-US. */
|
|
43
|
+
locale?: Locale;
|
|
44
44
|
/**
|
|
45
45
|
* 终端空态展示的快捷命令名称,按数组顺序取自命令目录,未命中的名称跳过,
|
|
46
46
|
* 重复名称只保留首次出现。
|