@k2b/ui 0.1.0-rc.0 → 0.1.1
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 +77 -312
- package/dist/types/actions/Button.d.ts +38 -0
- package/dist/types/actions/ContextMenu.d.ts +17 -0
- package/dist/types/actions/CopyButton.d.ts +20 -0
- package/dist/types/actions/Disclosure.d.ts +15 -0
- package/dist/types/actions/Dropdown.d.ts +100 -0
- package/dist/types/actions/FilterChip.d.ts +27 -0
- package/dist/types/actions/RemoveButton.d.ts +7 -0
- package/dist/types/actions/SegmentedControl.d.ts +20 -0
- package/dist/types/actions/SplitButton.d.ts +13 -0
- package/dist/types/actions/SpotlightSearch.d.ts +25 -0
- package/dist/types/actions/Tabs.d.ts +27 -0
- package/dist/types/actions/Toolbar.d.ts +23 -0
- package/dist/types/actions/index.d.ts +24 -0
- package/dist/types/chat/ChatComposer.d.ts +57 -0
- package/dist/types/chat/ChatPrimitives.d.ts +48 -0
- package/dist/types/chat/ChatRoot.d.ts +7 -0
- package/dist/types/chat/ChatTimeline.d.ts +52 -0
- package/dist/types/chat/chat-behavior.d.ts +29 -0
- package/dist/types/chat/index.d.ts +21 -0
- package/dist/types/chat/types.d.ts +62 -0
- package/dist/types/content/Calendar.d.ts +115 -0
- package/dist/types/content/Chart.d.ts +90 -0
- package/dist/types/content/CodeDisplay.d.ts +11 -0
- package/dist/types/content/DataTable.d.ts +113 -0
- package/dist/types/content/Docs.d.ts +52 -0
- package/dist/types/content/FileBrowser.d.ts +40 -0
- package/dist/types/content/FileTree.d.ts +29 -0
- package/dist/types/content/FileView.d.ts +59 -0
- package/dist/types/content/Lightbox.d.ts +16 -0
- package/dist/types/content/LogEntriesTable.d.ts +14 -0
- package/dist/types/content/MarkdownView.d.ts +46 -0
- package/dist/types/content/Pagination.d.ts +10 -0
- package/dist/types/content/PdfPreview.d.ts +11 -0
- package/dist/types/content/RangePicker.d.ts +29 -0
- package/dist/types/content/StructuredDataPreview.d.ts +20 -0
- package/dist/types/content/calendar-event-layout.d.ts +16 -0
- package/dist/types/content/calendar-pointer.d.ts +22 -0
- package/dist/types/content/chart-map-viewport.d.ts +5 -0
- package/dist/types/content/chart-state-timeline.d.ts +42 -0
- package/dist/types/content/code-highlight.d.ts +14 -0
- package/dist/types/content/file-tree.d.ts +41 -0
- package/dist/types/content/file-view-preview.d.ts +22 -0
- package/dist/types/content/index.d.ts +26 -0
- package/dist/types/feedback/InlineGuidance.d.ts +10 -0
- package/dist/types/feedback/Tooltip.d.ts +18 -0
- package/dist/types/feedback/dialog-core.d.ts +19 -0
- package/dist/types/feedback/index.d.ts +10 -0
- package/dist/types/feedback/prompts.d.ts +164 -0
- package/dist/types/feedback/toast.d.ts +25 -0
- package/dist/types/feedback/tooltip-position.d.ts +2 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/inputs/AutocompleteEditor.d.ts +21 -0
- package/dist/types/inputs/AutocompleteSelect.d.ts +30 -0
- package/dist/types/inputs/Checkbox.d.ts +9 -0
- package/dist/types/inputs/CheckboxCard.d.ts +9 -0
- package/dist/types/inputs/ChoiceGroups.d.ts +13 -0
- package/dist/types/inputs/ChoiceInputs.d.ts +24 -0
- package/dist/types/inputs/Combobox.d.ts +18 -0
- package/dist/types/inputs/DatePicker.d.ts +31 -0
- package/dist/types/inputs/FileInputs.d.ts +31 -0
- package/dist/types/inputs/MultiSelectInput.d.ts +41 -0
- package/dist/types/inputs/NumberInput.d.ts +24 -0
- package/dist/types/inputs/Select.d.ts +50 -0
- package/dist/types/inputs/SelectChip.d.ts +25 -0
- package/dist/types/inputs/SpecialInputs.d.ts +21 -0
- package/dist/types/inputs/Switch.d.ts +7 -0
- package/dist/types/inputs/TagEditor.d.ts +35 -0
- package/dist/types/inputs/TagsInput.d.ts +11 -0
- package/dist/types/inputs/TemplateEditor.d.ts +28 -0
- package/dist/types/inputs/TextInput.d.ts +26 -0
- package/dist/types/inputs/choice.d.ts +32 -0
- package/dist/types/inputs/completion/behaviors.d.ts +13 -0
- package/dist/types/inputs/completion/engine.d.ts +54 -0
- package/dist/types/inputs/completion/index.d.ts +3 -0
- package/dist/types/inputs/completion/overlay.d.ts +11 -0
- package/dist/types/inputs/date-picker.d.ts +42 -0
- package/dist/types/inputs/editor-dom.d.ts +6 -0
- package/dist/types/inputs/field-contract.d.ts +24 -0
- package/dist/types/inputs/icon-options.d.ts +37 -0
- package/dist/types/inputs/image-crop.d.ts +44 -0
- package/dist/types/inputs/index.d.ts +45 -0
- package/dist/types/inputs/markdown/MarkdownEditor.d.ts +25 -0
- package/dist/types/inputs/markdown/Toolbar.d.ts +9 -0
- package/dist/types/inputs/markdown/actions.d.ts +8 -0
- package/dist/types/inputs/markdown/active-formats.d.ts +1 -0
- package/dist/types/inputs/markdown/behaviors.d.ts +3 -0
- package/dist/types/inputs/markdown/code-zone.d.ts +1 -0
- package/dist/types/internal/color.d.ts +4 -0
- package/dist/types/internal/field.d.ts +27 -0
- package/dist/types/internal/portal.d.ts +1 -0
- package/dist/types/intl/Format.d.ts +84 -0
- package/dist/types/intl/index.d.ts +4 -0
- package/dist/types/intl/locale.d.ts +42 -0
- package/dist/types/intl/messages.d.ts +375 -0
- package/dist/types/layout/AppOverview.d.ts +29 -0
- package/dist/types/layout/AppWorkspace.d.ts +254 -0
- package/dist/types/layout/DataPanel.d.ts +16 -0
- package/dist/types/layout/DetailPanel.d.ts +89 -0
- package/dist/types/layout/Discussion.d.ts +52 -0
- package/dist/types/layout/FloatingWindow.d.ts +19 -0
- package/dist/types/layout/PanelDialog.d.ts +72 -0
- package/dist/types/layout/PanelHeader.d.ts +10 -0
- package/dist/types/layout/Panes.d.ts +48 -0
- package/dist/types/layout/ScrollArea.d.ts +8 -0
- package/dist/types/layout/Settings.d.ts +72 -0
- package/dist/types/layout/SettingsCollection.d.ts +41 -0
- package/dist/types/layout/SettingsModal.d.ts +39 -0
- package/dist/types/layout/app-workspace-controller.d.ts +7 -0
- package/dist/types/layout/app-workspace-state.d.ts +57 -0
- package/dist/types/layout/floating-window-geometry.d.ts +11 -0
- package/dist/types/layout/index.d.ts +32 -0
- package/dist/types/layout/panes-layout.d.ts +63 -0
- package/dist/types/layout/stable-id.d.ts +3 -0
- package/dist/types/semantics.d.ts +4 -0
- package/dist/types/surfaces/Avatar.d.ts +14 -0
- package/dist/types/surfaces/DescriptionList.d.ts +17 -0
- package/dist/types/surfaces/LinkCard.d.ts +11 -0
- package/dist/types/surfaces/NotFoundState.d.ts +15 -0
- package/dist/types/surfaces/NoticeCard.d.ts +39 -0
- package/dist/types/surfaces/Paper.d.ts +13 -0
- package/dist/types/surfaces/Placeholder.d.ts +17 -0
- package/dist/types/surfaces/ProgressBar.d.ts +13 -0
- package/dist/types/surfaces/StatCell.d.ts +22 -0
- package/dist/types/surfaces/StatGrid.d.ts +21 -0
- package/dist/types/surfaces/StatusBadge.d.ts +12 -0
- package/dist/types/surfaces/Tag.d.ts +16 -0
- package/dist/types/surfaces/index.d.ts +24 -0
- package/dist/types/widgets/Widget.d.ts +12 -0
- package/dist/types/widgets/WidgetHero.d.ts +11 -0
- package/dist/types/widgets/WidgetList.d.ts +17 -0
- package/dist/types/widgets/WidgetPills.d.ts +14 -0
- package/dist/types/widgets/WidgetStat.d.ts +17 -0
- package/dist/types/widgets/WidgetStatus.d.ts +12 -0
- package/dist/types/widgets/index.d.ts +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
export type SegmentOption<T extends string = string> = {
|
|
3
|
+
value: T;
|
|
4
|
+
label: JSX.Element;
|
|
5
|
+
icon?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type SegmentedControlProps<T extends string = string> = {
|
|
9
|
+
options: readonly SegmentOption<T>[];
|
|
10
|
+
value: T | (() => T);
|
|
11
|
+
onValueChange: (value: T) => void;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
ariaLabel?: string;
|
|
14
|
+
label?: string;
|
|
15
|
+
size?: "sm" | "md";
|
|
16
|
+
class?: string;
|
|
17
|
+
};
|
|
18
|
+
/** Controlled radio group with automatic selection during arrow-key navigation. */
|
|
19
|
+
export declare function SegmentedControl<T extends string = string>(props: SegmentedControlProps<T>): JSX.Element;
|
|
20
|
+
export default SegmentedControl;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import { type ButtonProps } from "./Button";
|
|
3
|
+
import { type DropdownItem, type DropdownPosition } from "./Dropdown";
|
|
4
|
+
export type SplitButtonProps = ButtonProps & {
|
|
5
|
+
/** Actions shown from the secondary menu trigger. */
|
|
6
|
+
items: readonly DropdownItem[];
|
|
7
|
+
/** Accessible name and title for the icon-only menu trigger. */
|
|
8
|
+
menuLabel: string;
|
|
9
|
+
menuPosition?: DropdownPosition | (() => DropdownPosition);
|
|
10
|
+
menuWidth?: string;
|
|
11
|
+
};
|
|
12
|
+
/** One primary button action with a separate menu of related alternatives. */
|
|
13
|
+
export declare function SplitButton(props: SplitButtonProps): JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
import type { PromptSearchInput, PromptSearchItem, PromptSearchOptions } from "../feedback/prompts";
|
|
3
|
+
export declare const SPOTLIGHT_SHORTCUT = "mod+shift+k";
|
|
4
|
+
export declare const SPOTLIGHT_SHORTCUT_LABEL = "\u21E7\u2318K";
|
|
5
|
+
export declare const SPOTLIGHT_SHORTCUT_TITLE = "Mod+Shift+K";
|
|
6
|
+
export type SpotlightSearchResolver<T = unknown> = (input: PromptSearchInput) => Promise<PromptSearchItem<T>[]> | PromptSearchItem<T>[];
|
|
7
|
+
export type SpotlightSearchOptions<T = unknown> = PromptSearchOptions & {
|
|
8
|
+
resolve: SpotlightSearchResolver<T>;
|
|
9
|
+
};
|
|
10
|
+
export type SpotlightButtonVariant = "default" | "compact" | "chip" | "sidebar" | "sidebar-mobile" | "icon";
|
|
11
|
+
export type SpotlightButtonProps = {
|
|
12
|
+
variant?: SpotlightButtonVariant;
|
|
13
|
+
label?: string;
|
|
14
|
+
title?: string;
|
|
15
|
+
icon?: string;
|
|
16
|
+
shortcutLabel?: string | false;
|
|
17
|
+
ariaLabel?: string;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
class?: string;
|
|
20
|
+
onClick: () => void | Promise<void>;
|
|
21
|
+
};
|
|
22
|
+
export declare const isSpotlightShortcut: (event: KeyboardEvent) => boolean;
|
|
23
|
+
export declare const openSpotlightSearch: <T = unknown>(options: SpotlightSearchOptions<T>) => Promise<PromptSearchItem<T> | undefined>;
|
|
24
|
+
export declare function SpotlightButton(props: SpotlightButtonProps): JSX.Element;
|
|
25
|
+
export default SpotlightButton;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import type { MaybeAccessor } from "../inputs/field-contract";
|
|
3
|
+
export type TabOption<T extends string = string> = {
|
|
4
|
+
value: T;
|
|
5
|
+
label: JSX.Element;
|
|
6
|
+
icon?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
panel?: JSX.Element;
|
|
9
|
+
};
|
|
10
|
+
export type TabsItemProps<T extends string = string> = Omit<TabOption<T>, "panel"> & {
|
|
11
|
+
children?: JSX.Element;
|
|
12
|
+
};
|
|
13
|
+
export type TabsProps<T extends string = string> = {
|
|
14
|
+
value: MaybeAccessor<T>;
|
|
15
|
+
onValueChange: (value: T) => void;
|
|
16
|
+
ariaLabel: string;
|
|
17
|
+
orientation?: "horizontal" | "vertical";
|
|
18
|
+
class?: string;
|
|
19
|
+
/** Data-driven alternative to colocated `Tabs.Item` children. */
|
|
20
|
+
options?: readonly TabOption<T>[];
|
|
21
|
+
children?: JSX.Element;
|
|
22
|
+
};
|
|
23
|
+
type TabsComponent = (<T extends string = string>(props: TabsProps<T>) => JSX.Element) & {
|
|
24
|
+
Item: <T extends string = string>(props: TabsItemProps<T>) => JSX.Element;
|
|
25
|
+
};
|
|
26
|
+
export declare const Tabs: TabsComponent;
|
|
27
|
+
export default Tabs;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
export type ToolbarProps = {
|
|
3
|
+
children: JSX.Element;
|
|
4
|
+
label: string;
|
|
5
|
+
orientation?: "horizontal" | "vertical";
|
|
6
|
+
wrap?: boolean;
|
|
7
|
+
class?: string;
|
|
8
|
+
};
|
|
9
|
+
export type ToolbarGroupProps = {
|
|
10
|
+
children: JSX.Element;
|
|
11
|
+
label?: string;
|
|
12
|
+
class?: string;
|
|
13
|
+
};
|
|
14
|
+
export type ToolbarSeparatorProps = {
|
|
15
|
+
class?: string;
|
|
16
|
+
};
|
|
17
|
+
type ToolbarComponent = ((props: ToolbarProps) => JSX.Element) & {
|
|
18
|
+
Group: (props: ToolbarGroupProps) => JSX.Element;
|
|
19
|
+
Separator: (props: ToolbarSeparatorProps) => JSX.Element;
|
|
20
|
+
Spacer: () => JSX.Element;
|
|
21
|
+
};
|
|
22
|
+
export declare const Toolbar: ToolbarComponent;
|
|
23
|
+
export default Toolbar;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type { ButtonLinkProps, ButtonProps, ButtonSize, ButtonVariant, IconButtonLinkProps, IconButtonProps } from "./Button";
|
|
2
|
+
export { Button, ButtonLink, IconButton, IconButtonLink } from "./Button";
|
|
3
|
+
export type { CopyButtonProps, CopyButtonValue } from "./CopyButton";
|
|
4
|
+
export { CopyButton } from "./CopyButton";
|
|
5
|
+
export type { DisclosureProps } from "./Disclosure";
|
|
6
|
+
export { Disclosure } from "./Disclosure";
|
|
7
|
+
export type { DropdownAction, DropdownActionBase, DropdownChoice, DropdownItemProps, DropdownPosition, DropdownProps, DropdownSection, DropdownTriggerProps, } from "./Dropdown";
|
|
8
|
+
export { Dropdown, DropdownItem, dropdownPosition } from "./Dropdown";
|
|
9
|
+
export type { FilterChipOption, FilterChipProps, FilterChipSection } from "./FilterChip";
|
|
10
|
+
export { FilterChip } from "./FilterChip";
|
|
11
|
+
export type { ContextMenuProps } from "./ContextMenu";
|
|
12
|
+
export { ContextMenu } from "./ContextMenu";
|
|
13
|
+
export type { RemoveButtonProps } from "./RemoveButton";
|
|
14
|
+
export { RemoveButton } from "./RemoveButton";
|
|
15
|
+
export type { SpotlightButtonProps, SpotlightButtonVariant, SpotlightSearchOptions, SpotlightSearchResolver, } from "./SpotlightSearch";
|
|
16
|
+
export { isSpotlightShortcut, openSpotlightSearch, SPOTLIGHT_SHORTCUT, SPOTLIGHT_SHORTCUT_LABEL, SPOTLIGHT_SHORTCUT_TITLE, SpotlightButton, } from "./SpotlightSearch";
|
|
17
|
+
export type { SegmentedControlProps, SegmentOption } from "./SegmentedControl";
|
|
18
|
+
export { SegmentedControl } from "./SegmentedControl";
|
|
19
|
+
export type { SplitButtonProps } from "./SplitButton";
|
|
20
|
+
export { SplitButton } from "./SplitButton";
|
|
21
|
+
export type { TabOption, TabsItemProps, TabsProps } from "./Tabs";
|
|
22
|
+
export { Tabs } from "./Tabs";
|
|
23
|
+
export type { ToolbarGroupProps, ToolbarProps, ToolbarSeparatorProps } from "./Toolbar";
|
|
24
|
+
export { Toolbar } from "./Toolbar";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import type { ChatAction, ChatAttachment, ChatComposerState, ChatContextUsageData, ChatModelOption, ChatSubmitInput } from "./types";
|
|
3
|
+
export type ChatCommandContext = {
|
|
4
|
+
setValue: (value: string) => void;
|
|
5
|
+
submit: () => void;
|
|
6
|
+
focus: () => void;
|
|
7
|
+
};
|
|
8
|
+
export type ChatCommand = {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
icon?: string;
|
|
12
|
+
action: (context: ChatCommandContext) => void | Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
export type ChatFileSelection = {
|
|
15
|
+
onSelect: (files: readonly File[]) => void | Promise<void>;
|
|
16
|
+
onError?: (error: unknown) => void;
|
|
17
|
+
accept?: string;
|
|
18
|
+
multiple?: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
label?: string;
|
|
21
|
+
};
|
|
22
|
+
export type ChatPasteHandler = (event: ClipboardEvent & {
|
|
23
|
+
currentTarget: HTMLTextAreaElement;
|
|
24
|
+
target: Element;
|
|
25
|
+
}) => void;
|
|
26
|
+
export type ChatComposerProps = {
|
|
27
|
+
value: string;
|
|
28
|
+
onValueChange: (value: string) => void;
|
|
29
|
+
onSubmit: (input: ChatSubmitInput) => boolean | void | Promise<boolean | void>;
|
|
30
|
+
/** Submit intent used for drafts entered while a response is running. Defaults to `steer`. */
|
|
31
|
+
runningSubmitIntent?: "steer" | "queue";
|
|
32
|
+
onStop?: () => void | Promise<void>;
|
|
33
|
+
onError?: (error: unknown) => void;
|
|
34
|
+
state?: ChatComposerState;
|
|
35
|
+
attachments?: readonly ChatAttachment[];
|
|
36
|
+
onAttachmentsChange?: (attachments: readonly ChatAttachment[]) => void;
|
|
37
|
+
fileSelection?: ChatFileSelection;
|
|
38
|
+
/** Handle non-file clipboard content. Pasted files already use `fileSelection`. */
|
|
39
|
+
onPaste?: ChatPasteHandler;
|
|
40
|
+
menuActions?: readonly ChatAction[];
|
|
41
|
+
models?: readonly ChatModelOption[];
|
|
42
|
+
selectedModelId?: string | null;
|
|
43
|
+
onModelChange?: (modelId: string) => void;
|
|
44
|
+
commands?: readonly ChatCommand[];
|
|
45
|
+
contextUsage?: ChatContextUsageData;
|
|
46
|
+
contextActions?: readonly ChatAction[];
|
|
47
|
+
/** Additional compact controls rendered with the add/model controls. */
|
|
48
|
+
footerTools?: JSX.Element;
|
|
49
|
+
placeholder?: string;
|
|
50
|
+
label?: string;
|
|
51
|
+
inputLabel?: string;
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
error?: string;
|
|
54
|
+
focusToken?: unknown;
|
|
55
|
+
class?: string;
|
|
56
|
+
};
|
|
57
|
+
export declare function ChatComposer(props: ChatComposerProps): JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import type { ChatAction, ChatActivityTone, ChatAttachment, ChatContextUsageData, ChatMessageStatus, ChatRole } from "./types";
|
|
3
|
+
export type ChatMessageProps = {
|
|
4
|
+
role: ChatRole;
|
|
5
|
+
children?: JSX.Element;
|
|
6
|
+
label?: string;
|
|
7
|
+
createdAt?: string | Date;
|
|
8
|
+
timeLabel?: string;
|
|
9
|
+
status?: ChatMessageStatus;
|
|
10
|
+
attachments?: readonly ChatAttachment[];
|
|
11
|
+
actions?: readonly ChatAction[];
|
|
12
|
+
actionDisplay?: "auto" | "inline" | "menu";
|
|
13
|
+
anchorId?: string | number;
|
|
14
|
+
onActionError?: (error: unknown) => void;
|
|
15
|
+
class?: string;
|
|
16
|
+
};
|
|
17
|
+
export type ChatActivityProps = {
|
|
18
|
+
label: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
icon?: string;
|
|
21
|
+
/** Optional host-owned leading visual rendered instead of the icon. */
|
|
22
|
+
leading?: JSX.Element;
|
|
23
|
+
/** Optional identity accent for the leading visual. Semantic tones still take precedence. */
|
|
24
|
+
accent?: string;
|
|
25
|
+
tone?: ChatActivityTone;
|
|
26
|
+
/** Marks the activity as running with the shared accent sweep. */
|
|
27
|
+
busy?: boolean;
|
|
28
|
+
trailing?: JSX.Element;
|
|
29
|
+
/** Controlled disclosure state. Omit to keep native details behavior. */
|
|
30
|
+
open?: boolean;
|
|
31
|
+
/** Reports disclosure changes when `open` is controlled by the host. */
|
|
32
|
+
onOpenChange?: (open: boolean) => void;
|
|
33
|
+
defaultOpen?: boolean;
|
|
34
|
+
/** Set to false when the body is a peer list that should align with the activity row. */
|
|
35
|
+
bodyInset?: boolean;
|
|
36
|
+
anchorId?: string | number;
|
|
37
|
+
children?: JSX.Element;
|
|
38
|
+
class?: string;
|
|
39
|
+
};
|
|
40
|
+
export type ChatContextUsageProps = ChatContextUsageData & {
|
|
41
|
+
/** Host-owned number formatting. The default is locale-independent and SSR-stable. */
|
|
42
|
+
formatNumber?: (value: number) => string;
|
|
43
|
+
class?: string;
|
|
44
|
+
};
|
|
45
|
+
export declare const formatChatTokens: (tokens: number) => string;
|
|
46
|
+
export declare function ChatMessage(props: ChatMessageProps): JSX.Element;
|
|
47
|
+
export declare function ChatActivity(props: ChatActivityProps): JSX.Element;
|
|
48
|
+
export declare function ChatContextUsage(props: ChatContextUsageProps): JSX.Element;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import type { ChatAction, ChatActivityTone, ChatAttachment, ChatMessageStatus, ChatRole } from "./types";
|
|
3
|
+
export type ChatMessageItem = {
|
|
4
|
+
kind: "message";
|
|
5
|
+
id: string;
|
|
6
|
+
role: ChatRole;
|
|
7
|
+
content?: JSX.Element;
|
|
8
|
+
label?: string;
|
|
9
|
+
createdAt?: string | Date;
|
|
10
|
+
timeLabel?: string;
|
|
11
|
+
status?: ChatMessageStatus;
|
|
12
|
+
attachments?: readonly ChatAttachment[];
|
|
13
|
+
actions?: readonly ChatAction[];
|
|
14
|
+
actionDisplay?: "auto" | "inline" | "menu";
|
|
15
|
+
anchorId?: string | number;
|
|
16
|
+
class?: string;
|
|
17
|
+
};
|
|
18
|
+
export type ChatActivityItem = {
|
|
19
|
+
kind: "activity";
|
|
20
|
+
id: string;
|
|
21
|
+
label: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
icon?: string;
|
|
24
|
+
leading?: JSX.Element;
|
|
25
|
+
accent?: string;
|
|
26
|
+
tone?: ChatActivityTone;
|
|
27
|
+
busy?: boolean;
|
|
28
|
+
trailing?: JSX.Element;
|
|
29
|
+
defaultOpen?: boolean;
|
|
30
|
+
anchorId?: string | number;
|
|
31
|
+
content?: JSX.Element;
|
|
32
|
+
class?: string;
|
|
33
|
+
};
|
|
34
|
+
export type ChatTimelineItem = ChatMessageItem | ChatActivityItem;
|
|
35
|
+
export type ChatTimelineProps = {
|
|
36
|
+
items: readonly ChatTimelineItem[];
|
|
37
|
+
conversationKey?: string | null;
|
|
38
|
+
loading?: boolean;
|
|
39
|
+
hasMore?: boolean;
|
|
40
|
+
loadingOlder?: boolean;
|
|
41
|
+
onLoadOlder?: () => boolean | void | Promise<boolean | void>;
|
|
42
|
+
emptyTitle?: string;
|
|
43
|
+
emptyDescription?: string;
|
|
44
|
+
navigation?: JSX.Element;
|
|
45
|
+
onActionError?: (error: unknown) => void;
|
|
46
|
+
viewportRef?: (element: HTMLDivElement) => void;
|
|
47
|
+
contentRef?: (element: HTMLDivElement) => void;
|
|
48
|
+
label?: string;
|
|
49
|
+
followThreshold?: number;
|
|
50
|
+
class?: string;
|
|
51
|
+
};
|
|
52
|
+
export declare function ChatTimeline(props: ChatTimelineProps): JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ChatAction } from "./types";
|
|
2
|
+
export declare const filterChatCommands: <T extends {
|
|
3
|
+
name: string;
|
|
4
|
+
}>(value: string, commands: readonly T[]) => T[];
|
|
5
|
+
export declare const nextChatCommandIndex: (index: number, length: number, direction: 1 | -1) => number;
|
|
6
|
+
export declare const isChatNearBottom: (scrollHeight: number, scrollTop: number, clientHeight: number, threshold?: number) => boolean;
|
|
7
|
+
export declare const restoredChatScrollTop: (previousScrollTop: number, previousScrollHeight: number, nextScrollHeight: number) => number;
|
|
8
|
+
export type ChatSubmissionRun = {
|
|
9
|
+
/** Clears the controlled draft (and attachments) before the handler runs. */
|
|
10
|
+
clear: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* The application handler. A synchronous throw, a rejected promise, and a
|
|
13
|
+
* `false` result all count as a rejected submission.
|
|
14
|
+
*/
|
|
15
|
+
perform: () => boolean | void | Promise<boolean | void>;
|
|
16
|
+
/** Restores the cleared draft (and attachments) after a rejected submission. */
|
|
17
|
+
restore: () => void;
|
|
18
|
+
onError?: (error: unknown) => void;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Runs one composer submission with optimistic clearing. Resolves to `true`
|
|
22
|
+
* when the handler accepted the submission. A synchronous throw is handled
|
|
23
|
+
* exactly like a rejected promise so a controlled draft is never lost.
|
|
24
|
+
*/
|
|
25
|
+
export declare const runChatSubmission: (run: ChatSubmissionRun) => Promise<boolean>;
|
|
26
|
+
/** Reports a handler failure without letting a synchronous throw escape. */
|
|
27
|
+
export declare const reportChatFailure: (perform: () => unknown, onError?: (error: unknown) => void) => void;
|
|
28
|
+
/** Executes the one behavior guaranteed by the ChatAction contract. */
|
|
29
|
+
export declare const executeChatAction: (action: ChatAction) => Promise<void>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ChatComposer } from "./ChatComposer";
|
|
2
|
+
import { ChatActivity, ChatContextUsage, ChatMessage } from "./ChatPrimitives";
|
|
3
|
+
import { ChatRoot } from "./ChatRoot";
|
|
4
|
+
import { ChatTimeline } from "./ChatTimeline";
|
|
5
|
+
export type { ChatCommand, ChatCommandContext, ChatComposerProps, ChatFileSelection, ChatPasteHandler } from "./ChatComposer";
|
|
6
|
+
export type { ChatActivityProps, ChatContextUsageProps, ChatMessageProps } from "./ChatPrimitives";
|
|
7
|
+
export { formatChatTokens } from "./ChatPrimitives";
|
|
8
|
+
export type { ChatRootProps } from "./ChatRoot";
|
|
9
|
+
export type { ChatActivityItem, ChatMessageItem, ChatTimelineItem, ChatTimelineProps } from "./ChatTimeline";
|
|
10
|
+
export type { ChatAction, ChatActivityTone, ChatAttachment, ChatComposerState, ChatContextUsageData, ChatMessageStatus, ChatModelOption, ChatRole, ChatSubmitInput, ChatSubmitIntent, ChatUsage, } from "./types";
|
|
11
|
+
/**
|
|
12
|
+
* Portable, controlled chat surface. Applications own storage, streaming,
|
|
13
|
+
* authorization, rich message rendering, and domain actions.
|
|
14
|
+
*/
|
|
15
|
+
export declare const Chat: typeof ChatRoot & {
|
|
16
|
+
Timeline: typeof ChatTimeline;
|
|
17
|
+
Message: typeof ChatMessage;
|
|
18
|
+
Activity: typeof ChatActivity;
|
|
19
|
+
Composer: typeof ChatComposer;
|
|
20
|
+
ContextUsage: typeof ChatContextUsage;
|
|
21
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export type ChatRole = "user" | "assistant" | "system" | "tool";
|
|
2
|
+
export type ChatMessageStatus = "pending" | "streaming" | "complete" | "error";
|
|
3
|
+
export type ChatActivityTone = "neutral" | "ai" | "success" | "danger";
|
|
4
|
+
type ChatActionBase = {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
icon?: string;
|
|
8
|
+
variant?: "danger";
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** Toggle state for persistent message actions such as feedback. */
|
|
11
|
+
pressed?: boolean;
|
|
12
|
+
};
|
|
13
|
+
/** Exactly one executable behavior for every chat action. */
|
|
14
|
+
export type ChatAction = ChatActionBase & ({
|
|
15
|
+
onSelect: () => void | Promise<void>;
|
|
16
|
+
copyText?: never;
|
|
17
|
+
} | {
|
|
18
|
+
copyText: string;
|
|
19
|
+
onSelect?: never;
|
|
20
|
+
});
|
|
21
|
+
export type ChatAttachment = {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
size?: number;
|
|
25
|
+
kind?: "file" | "image" | "resource";
|
|
26
|
+
icon?: string;
|
|
27
|
+
previewUrl?: string;
|
|
28
|
+
alt?: string;
|
|
29
|
+
/** Optional destination represented by this attachment. */
|
|
30
|
+
href?: string;
|
|
31
|
+
/** Opaque application-owned payload returned unchanged with ChatSubmitInput. */
|
|
32
|
+
data?: unknown;
|
|
33
|
+
/** Optional application-owned action presented below the attachment label. */
|
|
34
|
+
action?: ChatAction;
|
|
35
|
+
};
|
|
36
|
+
export type ChatUsage = {
|
|
37
|
+
input?: number;
|
|
38
|
+
output?: number;
|
|
39
|
+
total?: number;
|
|
40
|
+
};
|
|
41
|
+
export type ChatContextUsageData = {
|
|
42
|
+
usage?: ChatUsage | null;
|
|
43
|
+
loopUsage?: ChatUsage | null;
|
|
44
|
+
contextWindow?: number;
|
|
45
|
+
modelLabel?: string;
|
|
46
|
+
};
|
|
47
|
+
export type ChatModelOption = {
|
|
48
|
+
id: string;
|
|
49
|
+
label: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
image?: string;
|
|
52
|
+
icon?: string;
|
|
53
|
+
capabilities?: readonly string[];
|
|
54
|
+
};
|
|
55
|
+
export type ChatComposerState = "idle" | "submitting" | "running" | "stopping";
|
|
56
|
+
export type ChatSubmitIntent = "send" | "steer" | "queue";
|
|
57
|
+
export type ChatSubmitInput = {
|
|
58
|
+
intent: ChatSubmitIntent;
|
|
59
|
+
text: string;
|
|
60
|
+
attachments: readonly ChatAttachment[];
|
|
61
|
+
};
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { type LinkNavigateEvent } from "@k2b/ssr/nav";
|
|
2
|
+
import { type DateContext } from "@k2b/stdlib";
|
|
3
|
+
import type { JSX } from "solid-js";
|
|
4
|
+
export type CalendarView = "day" | "week" | "month" | "year" | "mobile-month";
|
|
5
|
+
export type CalendarEventColor = "blue" | "emerald" | "amber" | "red" | "violet" | "cyan" | "zinc";
|
|
6
|
+
export type CalendarEvent = {
|
|
7
|
+
id: string;
|
|
8
|
+
title: string;
|
|
9
|
+
start: Date | string;
|
|
10
|
+
end?: Date | string;
|
|
11
|
+
allDay?: boolean;
|
|
12
|
+
color?: CalendarEventColor;
|
|
13
|
+
colorHex?: string;
|
|
14
|
+
href?: string;
|
|
15
|
+
dataSpaceItemId?: string;
|
|
16
|
+
meta?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
display?: "event" | "background";
|
|
19
|
+
location?: string;
|
|
20
|
+
calendarName?: string;
|
|
21
|
+
attendees?: CalendarAttendee[];
|
|
22
|
+
resources?: CalendarResource[];
|
|
23
|
+
recurrence?: CalendarRecurrence;
|
|
24
|
+
};
|
|
25
|
+
export type CalendarAttendee = {
|
|
26
|
+
name: string;
|
|
27
|
+
status?: "accepted" | "declined" | "tentative" | "needs-action";
|
|
28
|
+
};
|
|
29
|
+
export type CalendarResource = {
|
|
30
|
+
name: string;
|
|
31
|
+
kind?: "room" | "equipment" | "link" | "other";
|
|
32
|
+
};
|
|
33
|
+
export type CalendarRecurrence = {
|
|
34
|
+
rrule: string;
|
|
35
|
+
exdate?: Array<Date | string>;
|
|
36
|
+
recurrenceId?: Date | string;
|
|
37
|
+
};
|
|
38
|
+
export type CalendarLabels = Partial<{
|
|
39
|
+
today: string;
|
|
40
|
+
day: string;
|
|
41
|
+
week: string;
|
|
42
|
+
month: string;
|
|
43
|
+
year: string;
|
|
44
|
+
allDay: string;
|
|
45
|
+
noEvents: string;
|
|
46
|
+
previous: string;
|
|
47
|
+
next: string;
|
|
48
|
+
}>;
|
|
49
|
+
export type CalendarEventRenderContext = {
|
|
50
|
+
compact: boolean;
|
|
51
|
+
fill: boolean;
|
|
52
|
+
start: Date;
|
|
53
|
+
end: Date;
|
|
54
|
+
allDay: boolean;
|
|
55
|
+
durationHours: number;
|
|
56
|
+
timeLabel: string;
|
|
57
|
+
};
|
|
58
|
+
export type CalendarProps = {
|
|
59
|
+
date: Date | string;
|
|
60
|
+
events: CalendarEvent[];
|
|
61
|
+
view?: CalendarView;
|
|
62
|
+
views?: CalendarView[];
|
|
63
|
+
labels?: CalendarLabels;
|
|
64
|
+
/** stdlib date context used for timezone-aware rendering and calendar math. */
|
|
65
|
+
dateConfig?: DateContext;
|
|
66
|
+
/** Convenience override for dateConfig.timeZone. */
|
|
67
|
+
timeZone?: string;
|
|
68
|
+
firstDayOfWeek?: 0 | 1;
|
|
69
|
+
withWeekNumbers?: boolean;
|
|
70
|
+
startHour?: number;
|
|
71
|
+
endHour?: number;
|
|
72
|
+
visibleStartHour?: number;
|
|
73
|
+
visibleEndHour?: number;
|
|
74
|
+
allDayMaxHeightRem?: number;
|
|
75
|
+
hideAllDay?: boolean;
|
|
76
|
+
selectedDate?: Date | string;
|
|
77
|
+
selectedEventId?: string;
|
|
78
|
+
dayBadges?: Record<string, CalendarDayBadge>;
|
|
79
|
+
getViewHref?: (view: CalendarView) => string;
|
|
80
|
+
getDateHref?: (date: Date, view: CalendarView) => string;
|
|
81
|
+
getEventHref?: (event: CalendarEvent) => string | undefined;
|
|
82
|
+
renderEvent?: (event: CalendarEvent, context: CalendarEventRenderContext) => JSX.Element;
|
|
83
|
+
/** Progressively enhance canonical calendar links after the app has loaded their target state. */
|
|
84
|
+
onNavigate?: (event: LinkNavigateEvent) => void | Promise<void>;
|
|
85
|
+
/** Progressively enhance canonical links without a document view transition. */
|
|
86
|
+
onNavigateHref?: (href: string) => void;
|
|
87
|
+
/** Optionally preload the target behind a canonical calendar link. */
|
|
88
|
+
onPrefetch?: (href: string) => void;
|
|
89
|
+
navigationPending?: boolean;
|
|
90
|
+
onViewChange?: (view: CalendarView) => void;
|
|
91
|
+
onDateChange?: (date: Date, view: CalendarView) => void;
|
|
92
|
+
/** One activation contract for pointer and keyboard input. */
|
|
93
|
+
onEventActivate?: (event: CalendarEvent) => void;
|
|
94
|
+
/** Pointer gesture used for activation. Keyboard activation is always immediate. */
|
|
95
|
+
eventActivation?: "single" | "double";
|
|
96
|
+
onEventDrop?: (event: CalendarEvent, next: CalendarEventTimeChange) => void;
|
|
97
|
+
onEventResize?: (event: CalendarEvent, next: CalendarEventTimeChange) => void;
|
|
98
|
+
onSlotActivate?: (slot: CalendarEventTimeChange) => void;
|
|
99
|
+
/** Pointer gesture used for empty slots. Keyboard activation is always immediate. */
|
|
100
|
+
slotActivation?: "single" | "double";
|
|
101
|
+
toolbarActions?: JSX.Element;
|
|
102
|
+
toolbarContent?: JSX.Element;
|
|
103
|
+
class?: string;
|
|
104
|
+
};
|
|
105
|
+
export type CalendarEventTimeChange = {
|
|
106
|
+
start: Date;
|
|
107
|
+
end: Date;
|
|
108
|
+
allDay?: boolean;
|
|
109
|
+
};
|
|
110
|
+
export type CalendarDayBadge = {
|
|
111
|
+
icon?: string;
|
|
112
|
+
label: string;
|
|
113
|
+
};
|
|
114
|
+
declare const Calendar: (props: CalendarProps) => JSX.Element;
|
|
115
|
+
export default Calendar;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { charts } from "@k2b/stdlib";
|
|
2
|
+
import type { JSX } from "solid-js";
|
|
3
|
+
import { type StateTimelineChartOptions } from "./chart-state-timeline";
|
|
4
|
+
/**
|
|
5
|
+
* Chart — minimal Solid wrapper around `stdlib.charts`.
|
|
6
|
+
*
|
|
7
|
+
* **Live-update story.** `charts.<kind>(opts)` returns an SVG string;
|
|
8
|
+
* Solid's `innerHTML` is reactive, so any time a prop (signal, store
|
|
9
|
+
* slice, derived value) changes, the SVG re-renders. No manual
|
|
10
|
+
* subscription, no imperative DOM patching. Trade-off: every change
|
|
11
|
+
* is a full SVG re-build, not a diff — fine for dashboard cadences
|
|
12
|
+
* (poll, websocket, store updates). Don't use this for 60fps streaming.
|
|
13
|
+
*
|
|
14
|
+
* **Sizing.** stdlib emits `<svg viewBox="0 0 W H">` with no width/
|
|
15
|
+
* height attributes, so the SVG would otherwise fall back to the
|
|
16
|
+
* browser's replaced-element default (300×150) and either overflow
|
|
17
|
+
* or look squished. We measure the wrapping `<div>` with a
|
|
18
|
+
* ResizeObserver and pass the actual pixel dimensions to stdlib —
|
|
19
|
+
* the viewBox matches the container, no aspect distortion, no
|
|
20
|
+
* letterboxing. Sizing the wrapper itself is the caller's job
|
|
21
|
+
* (`style={{ height: "14rem" }}`, an app class, a flex child, …).
|
|
22
|
+
* On SSR (no observer)
|
|
23
|
+
* the chart renders at stdlib's default size; the first client-side
|
|
24
|
+
* frame re-measures and re-renders.
|
|
25
|
+
*
|
|
26
|
+
* One documented exception: `kind: "stateTimeline"` derives its own
|
|
27
|
+
* initial height from the row count and legend via
|
|
28
|
+
* `stateTimelineHeight()`, because a timeline's height is a function of
|
|
29
|
+
* how many rows it has rather than of the layout around it. Every other
|
|
30
|
+
* kind starts at 280px until the observer reports the real box. Layout
|
|
31
|
+
* code that sizes charts uniformly must account for this.
|
|
32
|
+
*
|
|
33
|
+
* **Why so thin.** The props are a discriminated union over each
|
|
34
|
+
* stdlib chart function — `kind: "line"` brings in exactly the params
|
|
35
|
+
* `charts.line` expects, `kind: "bar"` brings in `charts.bar`'s, etc.
|
|
36
|
+
* Options stay aligned with stdlib without renaming. Shared interactive
|
|
37
|
+
* layers add bounded pan / zoom controls to maps and state timelines, plus
|
|
38
|
+
* nearest-point hover and keyboard inspection for line charts.
|
|
39
|
+
* If stdlib gains a new option, it's automatically available at every
|
|
40
|
+
* callsite.
|
|
41
|
+
*
|
|
42
|
+
* **Theming.** stdlib charts use `currentColor` for axes / ticks /
|
|
43
|
+
* tick labels — set the wrapping element's `color` and everything
|
|
44
|
+
* inherits. Series colors come from `--stdlib-chart-c1..c8` CSS
|
|
45
|
+
* custom properties; override on the parent for per-chart palettes.
|
|
46
|
+
*
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <Chart kind="line" style={{ height: "12rem" }}
|
|
49
|
+
* series={[{ data: points() }]}
|
|
50
|
+
* yAxis={{ format: v => `€${v}k` }} />
|
|
51
|
+
*
|
|
52
|
+
* <Chart kind="donut" style={{ height: "12rem" }} data={slices()} />
|
|
53
|
+
*
|
|
54
|
+
* <Chart kind="sparkline" style={{ width: "6rem", height: "1.5rem" }} data={trend()} />
|
|
55
|
+
*
|
|
56
|
+
* <Chart kind="map" style={{ height: "16rem" }} series={locations()} interactive />
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
/** All chart kinds shipped by `stdlib.charts`. */
|
|
60
|
+
export type ChartKind = keyof typeof charts;
|
|
61
|
+
export type ChartLabels = Partial<{
|
|
62
|
+
empty: string;
|
|
63
|
+
series: string;
|
|
64
|
+
interactiveMap: string;
|
|
65
|
+
interactiveTimeline: string;
|
|
66
|
+
interactiveLine: string;
|
|
67
|
+
zoomIn: string;
|
|
68
|
+
zoomOut: string;
|
|
69
|
+
resetMap: string;
|
|
70
|
+
resetTimeline: string;
|
|
71
|
+
}>;
|
|
72
|
+
/**
|
|
73
|
+
* Per-kind props: `kind` discriminator + the exact options that
|
|
74
|
+
* `charts.<kind>` accepts, **minus** `width` / `height` (the wrapper
|
|
75
|
+
* owns those — they're derived from container measurement). Solid's
|
|
76
|
+
* component model handles discriminated unions natively, so callsites
|
|
77
|
+
* get full type safety.
|
|
78
|
+
*/
|
|
79
|
+
export type ChartProps = {
|
|
80
|
+
[K in ChartKind]: {
|
|
81
|
+
kind: K;
|
|
82
|
+
class?: string;
|
|
83
|
+
style?: JSX.CSSProperties | string;
|
|
84
|
+
labels?: ChartLabels;
|
|
85
|
+
} & (K extends "stateTimeline" ? StateTimelineChartOptions : Omit<Parameters<(typeof charts)[K]>[0], "width" | "height"> & (K extends "map" | "line" ? {
|
|
86
|
+
interactive?: boolean;
|
|
87
|
+
} : {}));
|
|
88
|
+
}[ChartKind];
|
|
89
|
+
declare const Chart: (props: ChartProps) => JSX.Element;
|
|
90
|
+
export default Chart;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CodeDisplayLanguage } from "./code-highlight";
|
|
2
|
+
export type { CodeDisplayLanguage };
|
|
3
|
+
export type CodeDisplayProps = {
|
|
4
|
+
code: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
language?: CodeDisplayLanguage;
|
|
7
|
+
copy?: boolean;
|
|
8
|
+
lineNumbers?: boolean;
|
|
9
|
+
class?: string;
|
|
10
|
+
};
|
|
11
|
+
export default function CodeDisplay(props: CodeDisplayProps): import("solid-js").JSX.Element;
|