@pstdio/ui 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/dist/{MermaidComponent-D7Baqkwx.js → MermaidComponent-Cz_Iob5U.js} +56 -53
  2. package/dist/MermaidComponent-Cz_Iob5U.js.map +1 -0
  3. package/dist/chat-ui.js +117 -117
  4. package/dist/chat-ui.js.map +1 -1
  5. package/dist/components/data-renderer/data-renderer-board.d.ts +1 -0
  6. package/dist/components/data-renderer/data-renderer-card.d.ts +5 -20
  7. package/dist/components/data-renderer/data-renderer-content.d.ts +20 -0
  8. package/dist/components/data-renderer/data-renderer-grouping.d.ts +11 -10
  9. package/dist/components/data-renderer/data-renderer-helpers.d.ts +63 -15
  10. package/dist/components/data-renderer/data-renderer-list.d.ts +13 -8
  11. package/dist/components/data-renderer/data-renderer-story-fixtures.d.ts +13 -0
  12. package/dist/components/data-renderer/data-renderer-toolbar.d.ts +12 -0
  13. package/dist/components/data-renderer/data-renderer.d.ts +15 -23
  14. package/dist/components/data-renderer/display-menu.d.ts +9 -8
  15. package/dist/components/data-renderer/filter-menu.d.ts +5 -4
  16. package/dist/components/data-renderer/types.d.ts +83 -49
  17. package/dist/components/data-renderer/use-data-renderer-store.d.ts +15 -11
  18. package/dist/components/data-renderer/use-resolved-attributes.d.ts +14 -0
  19. package/dist/components/diff-viewer/diff-card-body.d.ts +10 -0
  20. package/dist/components/diff-viewer/diff-card-content.d.ts +1 -0
  21. package/dist/components/diff-viewer/diff-card.d.ts +1 -0
  22. package/dist/components/diff-viewer/diff-drawer-empty-state.d.ts +1 -0
  23. package/dist/components/diff-viewer/diff-drawer-height.d.ts +10 -0
  24. package/dist/components/diff-viewer/diff-drawer-scroll.d.ts +47 -0
  25. package/dist/components/diff-viewer/diff-drawer.d.ts +2 -7
  26. package/dist/components/diff-viewer/diff-size.d.ts +2 -0
  27. package/dist/components/diff-viewer/use-selected-diff-scroll.d.ts +19 -0
  28. package/dist/components/icon-color-picker.d.ts +29 -0
  29. package/dist/components/list-row/list-row-content.d.ts +9 -0
  30. package/dist/components/list-row/list-row.types.d.ts +3 -0
  31. package/dist/components/palette.d.ts +1 -0
  32. package/dist/components/param-editor/index.d.ts +2 -0
  33. package/dist/components/rich-text/shared/lexical-code.d.ts +2 -0
  34. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeBlockPlugin.d.ts +1 -1
  35. package/dist/components/rich-text/shared/prism-global.d.ts +2 -0
  36. package/dist/components/tab-strip/tab-visibility-filter.d.ts +19 -0
  37. package/dist/components/tab-strip/tab-visibility.store.d.ts +41 -0
  38. package/dist/components/tag-editor/index.d.ts +4 -0
  39. package/dist/components/tag-editor/tag-editor-row.d.ts +19 -0
  40. package/dist/components/tag-editor/tag-editor.d.ts +2 -0
  41. package/dist/components/tag-editor/tag-editor.types.d.ts +44 -0
  42. package/dist/components/tag-editor/tag-settings-panel.d.ts +24 -0
  43. package/dist/components/tree-list/tree-list-model.d.ts +58 -0
  44. package/dist/components/tree-list/tree-list-node-row.d.ts +20 -0
  45. package/dist/components/tree-list/tree-list-order-filter.d.ts +3 -0
  46. package/dist/components/tree-list/tree-list-order.store.d.ts +42 -0
  47. package/dist/components/tree-list/tree-list-reorder.d.ts +13 -0
  48. package/dist/components/tree-list/tree-list-section-header.d.ts +14 -0
  49. package/dist/components/tree-list/tree-list-sortable.d.ts +22 -0
  50. package/dist/components/tree-list/tree-list-visibility-filter.d.ts +17 -0
  51. package/dist/components/tree-list/tree-list-visibility.store.d.ts +45 -0
  52. package/dist/components/tree-list/tree-list.d.ts +7 -27
  53. package/dist/components/tree-list/tree-list.types.d.ts +2 -0
  54. package/dist/components/tree-list/use-tree-list-keyboard-navigation.d.ts +15 -0
  55. package/dist/get-file-type-icon-ufFb0IkR.js +102 -0
  56. package/dist/get-file-type-icon-ufFb0IkR.js.map +1 -0
  57. package/dist/index.d.ts +22 -3
  58. package/dist/index.js +5840 -4141
  59. package/dist/index.js.map +1 -1
  60. package/dist/{rich-message-33DPxuWJ.js → rich-message-CEOSsdR2.js} +428 -421
  61. package/dist/rich-message-CEOSsdR2.js.map +1 -0
  62. package/dist/rich-text.js +26 -26
  63. package/dist/rich-text.js.map +1 -1
  64. package/dist/theme/custom/index.d.ts +0 -3
  65. package/dist/theme/index.d.ts +1 -1
  66. package/dist/theme/recipes/editable.d.ts +46 -1
  67. package/dist/theme/recipes/tabs.d.ts +30 -0
  68. package/dist/theme/tokens/colors.d.ts +6 -0
  69. package/dist/{theme-D-aCJqTf.js → theme-DOFdi_Ir.js} +244 -149
  70. package/dist/theme-DOFdi_Ir.js.map +1 -0
  71. package/dist/theme.js +2 -4
  72. package/dist/utils/browser-storage.d.ts +7 -0
  73. package/dist/utils/prism.d.ts +1 -0
  74. package/package.json +9 -4
  75. package/dist/MermaidComponent-D7Baqkwx.js.map +0 -1
  76. package/dist/components/data-renderer/tag-badge.d.ts +0 -10
  77. package/dist/components/data-renderer/tag-option-icon.d.ts +0 -2
  78. package/dist/get-file-type-icon-Bwqf1WXA.js +0 -101
  79. package/dist/get-file-type-icon-Bwqf1WXA.js.map +0 -1
  80. package/dist/rich-message-33DPxuWJ.js.map +0 -1
  81. package/dist/theme/custom/monokai.json.d.ts +0 -80
  82. package/dist/theme-D-aCJqTf.js.map +0 -1
  83. /package/dist/components/{param-editor-color-input.d.ts → param-editor/color-input.d.ts} +0 -0
  84. /package/dist/components/{param-editor-date-input.d.ts → param-editor/date-input.d.ts} +0 -0
  85. /package/dist/components/{param-editor-horizontal-text-input.d.ts → param-editor/horizontal-text-input.d.ts} +0 -0
  86. /package/dist/components/{param-editor-input-group.d.ts → param-editor/input-group.d.ts} +0 -0
  87. /package/dist/components/{param-editor-number-input.d.ts → param-editor/number-input.d.ts} +0 -0
  88. /package/dist/components/{param-editor-horizontal.d.ts → param-editor/param-editor-horizontal.d.ts} +0 -0
  89. /package/dist/components/{param-editor-label.d.ts → param-editor/param-editor-label.d.ts} +0 -0
  90. /package/dist/components/{param-editor.d.ts → param-editor/param-editor.d.ts} +0 -0
  91. /package/dist/components/{param-editor.types.d.ts → param-editor/param-editor.types.d.ts} +0 -0
  92. /package/dist/components/{param-editor-selection-input.d.ts → param-editor/selection-input.d.ts} +0 -0
  93. /package/dist/components/{param-editor-text-input.d.ts → param-editor/text-input.d.ts} +0 -0
@@ -0,0 +1,47 @@
1
+ import { Diff } from './diff-card';
2
+ import { DiffViewMode } from './types';
3
+ interface EstimateDiffRangeHeightInput {
4
+ diffs: Diff[];
5
+ collapsedPaths: Set<string>;
6
+ largeDiffOptInPaths: Set<string>;
7
+ diffViewMode: DiffViewMode;
8
+ startIndex: number;
9
+ endIndex: number;
10
+ }
11
+ interface SelectedExpansionCommand {
12
+ action: string;
13
+ id: number;
14
+ path?: string;
15
+ direction?: "up" | "down";
16
+ }
17
+ interface ResolveSelectedScrollStateInput {
18
+ diffs: Diff[];
19
+ selectedDiffPath: string | null;
20
+ collapsedPaths: Set<string>;
21
+ expansionCommand: SelectedExpansionCommand | null;
22
+ completedScrollCommandId: number | null;
23
+ }
24
+ export interface RenderedDiffItem {
25
+ element: HTMLElement;
26
+ index: number;
27
+ }
28
+ export declare const estimateDiffRangeHeight: (input: EstimateDiffRangeHeightInput) => number;
29
+ export declare const resolveSelectedScrollState: (input: ResolveSelectedScrollStateInput) => {
30
+ selectedScrollPath: string | null;
31
+ selectedScrollKey: string | null;
32
+ selectedScrollCommandId: number | null;
33
+ selectedScrollIndex: number;
34
+ shouldPinSelectedScrollIndex: boolean;
35
+ hasCompletedSelectedScroll: boolean;
36
+ };
37
+ export declare const includePinnedDiffIndexes: (input: {
38
+ indexes: number[];
39
+ selectedScrollIndex: number;
40
+ shouldPinSelectedScrollIndex: boolean;
41
+ }) => number[];
42
+ export declare const getRenderedDiffItems: (scrollElement: HTMLElement | null) => RenderedDiffItem[];
43
+ export declare const getElementScrollOffset: (input: {
44
+ element: HTMLElement;
45
+ scrollElement: HTMLElement | null;
46
+ }) => number;
47
+ export {};
@@ -13,19 +13,14 @@ export interface DiffExpansionCommand {
13
13
  action: "expand" | "collapse" | "expand-selected";
14
14
  id: number;
15
15
  path?: string;
16
+ direction?: "up" | "down";
16
17
  }
17
18
  export interface DiffDrawerExpansionState {
18
19
  allExpanded: boolean;
19
20
  allCollapsed: boolean;
20
21
  }
22
+ export { estimateDiffCardHeight } from './diff-drawer-height';
21
23
  export type { Diff };
22
- interface EstimateDiffCardHeightInput {
23
- diff: Diff;
24
- isCollapsed: boolean;
25
- hasOptedIntoLargeDiff?: boolean;
26
- diffViewMode?: DiffViewMode;
27
- }
28
- export declare const estimateDiffCardHeight: (input: EstimateDiffCardHeightInput) => number;
29
24
  export declare const buildInitialCollapsedPaths: (diffs: Diff[]) => Set<string>;
30
25
  export declare const buildAllCollapsedPaths: (diffs: Diff[]) => Set<string>;
31
26
  export declare const toggleCollapsedPath: (collapsedPaths: Set<string>, path: string) => Set<string>;
@@ -12,3 +12,5 @@ export declare const isLargeDiffContent: (input: {
12
12
  newContent?: string;
13
13
  }) => boolean;
14
14
  export declare const isGeneratedDiffPath: (path: string) => boolean;
15
+ export declare const isBinaryDiffPath: (path: string) => boolean;
16
+ export declare const isImageDiffPath: (path: string) => boolean;
@@ -0,0 +1,19 @@
1
+ import { Diff } from './diff-card';
2
+ import { DiffExpansionCommand } from './diff-drawer';
3
+ import { DiffViewMode } from './types';
4
+ interface UseSelectedDiffScrollInput {
5
+ diffs: Diff[];
6
+ selectedDiffPath: string | null;
7
+ collapsedPaths: Set<string>;
8
+ largeDiffOptInPaths: Set<string>;
9
+ expansionCommand: DiffExpansionCommand | null;
10
+ diffViewMode: DiffViewMode;
11
+ scrollRef: {
12
+ current: HTMLDivElement | null;
13
+ };
14
+ }
15
+ export declare const useSelectedDiffScroll: (input: UseSelectedDiffScrollInput) => {
16
+ selectedScrollIndex: number;
17
+ shouldPinSelectedScrollIndex: boolean;
18
+ };
19
+ export {};
@@ -0,0 +1,29 @@
1
+ import { ComponentType } from 'react';
2
+ export interface IconColorPickerIconOption {
3
+ value: string | null;
4
+ label: string;
5
+ icon: ComponentType;
6
+ }
7
+ export declare const optionColors: readonly ["gray", "red", "orange", "yellow", "green", "teal", "blue", "cyan", "purple", "pink"];
8
+ export declare const optionIcons: ({
9
+ value: null;
10
+ label: string;
11
+ icon: import('react').ForwardRefExoticComponent<Omit<import('lucide-react').LucideProps, "ref"> & import('react').RefAttributes<SVGSVGElement>>;
12
+ } | {
13
+ value: string;
14
+ label: string;
15
+ icon: import('react').ForwardRefExoticComponent<Omit<import('lucide-react').LucideProps, "ref"> & import('react').RefAttributes<SVGSVGElement>>;
16
+ })[];
17
+ export declare const getIconComponent: (name: string | null | undefined, iconOptions?: readonly IconColorPickerIconOption[]) => ComponentType;
18
+ export interface IconColorPickerProps {
19
+ color: string;
20
+ colorOptions?: readonly string[];
21
+ icon?: string | null;
22
+ iconOptions?: readonly IconColorPickerIconOption[];
23
+ onColorChange: (color: string) => void;
24
+ onIconChange?: (icon: string | null) => void;
25
+ disabled?: boolean;
26
+ showIcons?: boolean;
27
+ "aria-label"?: string;
28
+ }
29
+ export declare const IconColorPicker: (props: IconColorPickerProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { ListRowItem, ListRowProps } from './list-row.types';
2
+ export declare const ListRowContent: (props: {
3
+ item: ListRowItem;
4
+ isExpanded: boolean;
5
+ showChevron: boolean;
6
+ isDisabled: boolean;
7
+ tone: ListRowProps["tone"];
8
+ variant: ListRowProps["variant"];
9
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -16,6 +16,7 @@ export interface ListRowActionMenuItem {
16
16
  size?: number | string;
17
17
  }>;
18
18
  disabled?: boolean;
19
+ readOnly?: boolean;
19
20
  /** Trailing content rendered after the label. Use for Kbd shortcuts, counts, or badges. */
20
21
  endContent?: ReactNode;
21
22
  onAction?: () => void;
@@ -71,6 +72,8 @@ export interface ListRowProps extends ListRowItem, Omit<ListRowRootProps, "as" |
71
72
  showExpandToggle?: boolean;
72
73
  variant?: ListRowVariant;
73
74
  tone?: ListRowTone;
75
+ selectedBg?: ListRowRootProps["bg"];
76
+ hoverBg?: ListRowRootProps["bg"];
74
77
  /** Wrap content into a single child element. Used for `<Menu.Item asChild><ListRow asChild>…</ListRow></Menu.Item>` and link components. */
75
78
  asChild?: boolean;
76
79
  onToggleExpand?: () => void;
@@ -41,6 +41,7 @@ export interface PaletteProps<T extends PaletteEntry = PaletteEntry> {
41
41
  footerEnd?: ReactNode;
42
42
  filterEntries?: (entries: T[], query: string, mode?: string) => T[];
43
43
  onActiveEntryChange?: (entry: T | null, index: number) => void;
44
+ onQueryChange?: (query: string) => void;
44
45
  onClose: () => void;
45
46
  onEscape?: (ctx: PaletteEscapeContext<T>) => boolean | undefined;
46
47
  }
@@ -0,0 +1,2 @@
1
+ export type { ParamEditorProps } from './param-editor';
2
+ export { ParamEditor } from './param-editor';
@@ -0,0 +1,2 @@
1
+ import { $createCodeNode, $isCodeNode, CodeHighlightNode, CodeNode, registerCodeHighlighting } from '@lexical/code';
2
+ export { $createCodeNode, $isCodeNode, CodeHighlightNode, CodeNode, registerCodeHighlighting };
@@ -1,3 +1,3 @@
1
- import { CodeNode } from '@lexical/code';
1
+ import { CodeNode } from '../../lexical-code';
2
2
  export declare function replaceCodeNodeWithMermaidNode(node: CodeNode): boolean;
3
3
  export declare function ImportCodeBlocksPlugin(): null;
@@ -0,0 +1,2 @@
1
+ import { default as Prism } from 'prismjs';
2
+ export { Prism };
@@ -0,0 +1,19 @@
1
+ import { ReactNode } from 'react';
2
+ import { ResourceContextAction } from '../resource-context-menu';
3
+ import { VisibilityOverride } from '../tree-list/tree-list-visibility.store';
4
+ export interface TabVisibilityPlacement {
5
+ closable?: boolean;
6
+ hiddenByDefault?: boolean;
7
+ title?: string;
8
+ contributionId: string;
9
+ }
10
+ export declare const filterVisibleTabs: <T extends TabVisibilityPlacement>(placements: T[], tabOverrides: Record<string, VisibilityOverride>, getKey: (placement: T) => string) => T[];
11
+ export interface TabVisibilityMenuActions {
12
+ onToggleTab: (key: string, hiddenByDefault: boolean) => void;
13
+ onResetAll: () => void;
14
+ }
15
+ interface BuildTabMenuOptions {
16
+ checkmark: ReactNode;
17
+ }
18
+ export declare const buildTabVisibilityMenuActions: <T extends TabVisibilityPlacement>(placements: T[], tabOverrides: Record<string, VisibilityOverride>, actions: TabVisibilityMenuActions, getKey: (placement: T) => string, options: BuildTabMenuOptions) => ResourceContextAction[];
19
+ export {};
@@ -0,0 +1,41 @@
1
+ import { VisibilityOverride } from '../tree-list/tree-list-visibility.store';
2
+ interface TabVisibilitySnapshot {
3
+ tabOverrides: Record<string, VisibilityOverride>;
4
+ }
5
+ interface TabVisibilityState extends TabVisibilitySnapshot {
6
+ setTab: (key: string, value: VisibilityOverride | undefined) => void;
7
+ toggleTab: (key: string, hiddenByDefault: boolean) => void;
8
+ clearTab: (key: string) => void;
9
+ reset: () => void;
10
+ }
11
+ interface CreateTabVisibilityStoreOptions {
12
+ storageKey: string;
13
+ }
14
+ export declare const createTabVisibilityStore: (options: CreateTabVisibilityStoreOptions) => Omit<import('zustand').StoreApi<TabVisibilityState>, "setState" | "persist"> & {
15
+ setState(partial: TabVisibilityState | Partial<TabVisibilityState> | ((state: TabVisibilityState) => TabVisibilityState | Partial<TabVisibilityState>), replace?: false | undefined): unknown;
16
+ setState(state: TabVisibilityState | ((state: TabVisibilityState) => TabVisibilityState), replace: true): unknown;
17
+ persist: {
18
+ setOptions: (options: Partial<import('zustand/middleware').PersistOptions<TabVisibilityState, unknown, unknown>>) => void;
19
+ clearStorage: () => void;
20
+ rehydrate: () => Promise<void> | void;
21
+ hasHydrated: () => boolean;
22
+ onHydrate: (fn: (state: TabVisibilityState) => void) => () => void;
23
+ onFinishHydration: (fn: (state: TabVisibilityState) => void) => () => void;
24
+ getOptions: () => Partial<import('zustand/middleware').PersistOptions<TabVisibilityState, unknown, unknown>>;
25
+ };
26
+ };
27
+ export declare const getTabVisibilityStore: (storageKey: string) => Omit<import('zustand').StoreApi<TabVisibilityState>, "setState" | "persist"> & {
28
+ setState(partial: TabVisibilityState | Partial<TabVisibilityState> | ((state: TabVisibilityState) => TabVisibilityState | Partial<TabVisibilityState>), replace?: false | undefined): unknown;
29
+ setState(state: TabVisibilityState | ((state: TabVisibilityState) => TabVisibilityState), replace: true): unknown;
30
+ persist: {
31
+ setOptions: (options: Partial<import('zustand/middleware').PersistOptions<TabVisibilityState, unknown, unknown>>) => void;
32
+ clearStorage: () => void;
33
+ rehydrate: () => Promise<void> | void;
34
+ hasHydrated: () => boolean;
35
+ onHydrate: (fn: (state: TabVisibilityState) => void) => () => void;
36
+ onFinishHydration: (fn: (state: TabVisibilityState) => void) => () => void;
37
+ getOptions: () => Partial<import('zustand/middleware').PersistOptions<TabVisibilityState, unknown, unknown>>;
38
+ };
39
+ };
40
+ export declare const useTabVisibilityStore: <T>(storageKey: string, selector: (state: TabVisibilityState) => T) => T;
41
+ export type { TabVisibilitySnapshot, TabVisibilityState };
@@ -0,0 +1,4 @@
1
+ export { TagEditor } from './tag-editor';
2
+ export type { TagEditorAction, TagEditorProps, TagEditorValue } from './tag-editor.types';
3
+ export type { SaveTagSettingsInput, TagSettingsPanelProps } from './tag-settings-panel';
4
+ export { TagSettingsPanel } from './tag-settings-panel';
@@ -0,0 +1,19 @@
1
+ import { IconColorPickerIconOption } from '../icon-color-picker';
2
+ import { TagEditorAction, TagEditorValue } from './tag-editor.types';
3
+ interface TagEditorRowProps {
4
+ actionOptions?: TagEditorAction[];
5
+ colorOptions?: readonly string[];
6
+ iconOptions?: readonly IconColorPickerIconOption[];
7
+ value: TagEditorValue;
8
+ isSaving?: boolean;
9
+ showDefault?: boolean;
10
+ showIcons?: boolean;
11
+ onActionsChange: (actions: string[]) => void;
12
+ onColorChange: (color: string) => void;
13
+ onDelete: () => void;
14
+ onIconChange: (icon: string | null) => void;
15
+ onNameChange: (name: string) => void;
16
+ onSetDefault: () => void;
17
+ }
18
+ export declare const TagEditorRow: (props: TagEditorRowProps) => import("react/jsx-runtime").JSX.Element;
19
+ export {};
@@ -0,0 +1,2 @@
1
+ import { TagEditorProps } from './tag-editor.types';
2
+ export declare const TagEditor: (props: TagEditorProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,44 @@
1
+ import { IconColorPickerIconOption } from '../icon-color-picker';
2
+ export interface TagEditorValue {
3
+ id: string;
4
+ name: string;
5
+ color: string;
6
+ sortOrder: number;
7
+ actions?: string[];
8
+ icon?: string | null;
9
+ isDefault?: boolean;
10
+ isNew?: boolean;
11
+ }
12
+ export interface TagEditorAction {
13
+ value: string;
14
+ label: string;
15
+ }
16
+ export interface TagEditorProps {
17
+ title: string;
18
+ description?: string;
19
+ values: TagEditorValue[];
20
+ onValuesChange: (values: TagEditorValue[]) => void;
21
+ onSave: () => void | Promise<void>;
22
+ onCancel: () => void;
23
+ onDeleteValue?: (value: TagEditorValue) => void;
24
+ onSetDefault?: (value: TagEditorValue) => void;
25
+ hasChanges?: boolean;
26
+ isSaving?: boolean;
27
+ addLabel?: string;
28
+ addPlaceholder?: string;
29
+ actionOptions?: TagEditorAction[];
30
+ actionsColumnLabel?: string;
31
+ cancelLabel?: string;
32
+ defaultAddColor?: string;
33
+ defaultAddIcon?: string | null;
34
+ defaultColumnLabel?: string;
35
+ deleteButtonText?: string;
36
+ deleteHeadline?: string;
37
+ deleteNotificationText?: (value: TagEditorValue) => string;
38
+ colorOptions?: readonly string[];
39
+ iconOptions?: readonly IconColorPickerIconOption[];
40
+ saveLabel?: string;
41
+ showDefault?: boolean;
42
+ showIcons?: boolean;
43
+ valueColumnLabel?: string;
44
+ }
@@ -0,0 +1,24 @@
1
+ import { QueryKey } from '@tanstack/react-query';
2
+ import { TagEditorProps, TagEditorValue } from './tag-editor.types';
3
+ export interface SaveTagSettingsInput<TValue> {
4
+ deletedIds: Set<string>;
5
+ drafts: TagEditorValue[];
6
+ values: TValue[];
7
+ }
8
+ type EditorLabels = Pick<TagEditorProps, "actionOptions" | "actionsColumnLabel" | "addLabel" | "addPlaceholder" | "colorOptions" | "deleteButtonText" | "deleteHeadline" | "deleteNotificationText" | "description" | "iconOptions" | "showIcons" | "title" | "valueColumnLabel">;
9
+ type SortableValue = {
10
+ id: string;
11
+ sortOrder: number;
12
+ };
13
+ export interface TagSettingsPanelProps<TValue extends SortableValue, TSource> extends EditorLabels {
14
+ errorTitle: string;
15
+ loadingText?: string;
16
+ queryKey: QueryKey;
17
+ readValues: (source: TSource) => Promise<TValue[]>;
18
+ saveValues: (source: TSource, input: SaveTagSettingsInput<TValue>) => Promise<void>;
19
+ source: TSource;
20
+ toEditorValue: (value: TValue) => TagEditorValue;
21
+ valueNeedsUpdate: (original: TValue, draft: TagEditorValue) => boolean;
22
+ }
23
+ export declare const TagSettingsPanel: <TValue extends SortableValue, TSource>(props: TagSettingsPanelProps<TValue, TSource>) => import("react/jsx-runtime").JSX.Element;
24
+ export {};
@@ -0,0 +1,58 @@
1
+ import { TreeListNode, TreeListSection } from './tree-list.types';
2
+ export declare const isInList: (id: string, values: string[]) => boolean;
3
+ export declare const isActiveNode: (id: string, activeNodeId?: string | string[] | null) => boolean;
4
+ export declare const isNavigableNode: (node: TreeListNode) => boolean;
5
+ export declare const getNodeChildren: (node: TreeListNode) => TreeListNode[];
6
+ export declare const hasExpandableChildren: (node: TreeListNode) => boolean;
7
+ export type VirtualRow = {
8
+ kind: "section-header";
9
+ key: string;
10
+ sectionId: string;
11
+ section: TreeListSection;
12
+ collapsible: boolean;
13
+ expanded: boolean;
14
+ } | {
15
+ kind: "node";
16
+ key: string;
17
+ sectionId: string;
18
+ node: TreeListNode;
19
+ level: number;
20
+ parentNodeId?: string;
21
+ } | {
22
+ kind: "section-empty";
23
+ key: string;
24
+ sectionId: string;
25
+ emptyState: TreeListSection["emptyState"];
26
+ };
27
+ export type VirtualNodeRow = Extract<VirtualRow, {
28
+ kind: "node";
29
+ }>;
30
+ export type VirtualSectionHeaderRow = Extract<VirtualRow, {
31
+ kind: "section-header";
32
+ }>;
33
+ /** Rows the keyboard can land on: enabled nodes and collapsible section headers. */
34
+ export type FocusableRow = VirtualNodeRow | VirtualSectionHeaderRow;
35
+ export declare const buildVirtualRows: (sections: TreeListSection[], expandedSectionIds: string[], expandedNodeIds: string[]) => VirtualRow[];
36
+ /** Stable id used to track keyboard focus across renders. */
37
+ export declare const getRowFocusId: (row: FocusableRow) => string;
38
+ export declare const isFocusableRow: (row: VirtualRow) => row is FocusableRow;
39
+ export declare const getFocusableRows: (rows: VirtualRow[]) => FocusableRow[];
40
+ export declare const resolveTreeListFocusRowId: (focusedRowId: string | undefined, activeNodeId: string | string[] | null | undefined, rows: VirtualRow[]) => string | undefined;
41
+ export declare const resolveTreeListKeyboardNavigation: (input: {
42
+ rows: VirtualRow[];
43
+ focusedRowId: string | undefined;
44
+ activeNodeId?: string | string[] | null;
45
+ expandedNodeIds: string[];
46
+ key: string;
47
+ }) => {
48
+ type: "toggle-section";
49
+ sectionId: string;
50
+ rowId?: undefined;
51
+ } | {
52
+ type: "toggle-node";
53
+ nodeId: string;
54
+ rowId?: undefined;
55
+ } | {
56
+ type: "focus";
57
+ rowId: string;
58
+ } | null;
@@ -0,0 +1,20 @@
1
+ import { StackProps } from '@chakra-ui/react';
2
+ import { FocusEventHandler } from 'react';
3
+ import { TreeListLinkComponent, TreeListNavigateEvent, TreeListNode } from './tree-list.types';
4
+ type TreeListRowVariant = "compact" | "tree";
5
+ interface TreeListNodeRowProps {
6
+ sectionId: string;
7
+ node: TreeListNode;
8
+ level: number;
9
+ expandedNodeIds: string[];
10
+ activeNodeId?: string | string[] | null;
11
+ rowVariant: TreeListRowVariant;
12
+ nodeGap: StackProps["gap"];
13
+ linkComponent?: TreeListLinkComponent;
14
+ tabIndex?: number;
15
+ onFocus?: FocusEventHandler<HTMLElement>;
16
+ onNavigate?: (event: TreeListNavigateEvent) => void;
17
+ onToggleNode?: (nodeId: string) => void;
18
+ }
19
+ export declare const TreeListNodeRow: (props: TreeListNodeRowProps) => import("react/jsx-runtime").JSX.Element;
20
+ export {};
@@ -0,0 +1,3 @@
1
+ import { TreeListNode, TreeListSection } from './tree-list.types';
2
+ export declare const applyTreeListOrder: (sections: TreeListSection[], sectionOrder: string[], nodeOrderBySection: Record<string, string[]>) => TreeListSection[];
3
+ export declare const reorderNodesById: (nodes: TreeListNode[], order: string[]) => TreeListNode[];
@@ -0,0 +1,42 @@
1
+ interface TreeListOrderSnapshot {
2
+ sectionOrder: string[];
3
+ nodeOrderBySection: Record<string, string[]>;
4
+ }
5
+ interface TreeListOrderState extends TreeListOrderSnapshot {
6
+ setSectionOrder: (nextSectionIds: string[]) => void;
7
+ setNodeOrder: (sectionId: string, nextNodeIds: string[]) => void;
8
+ resetSectionOrder: () => void;
9
+ resetNodeOrder: (sectionId: string) => void;
10
+ reset: () => void;
11
+ }
12
+ interface CreateTreeListOrderStoreOptions {
13
+ storageKey: string;
14
+ }
15
+ export declare const createTreeListOrderStore: (options: CreateTreeListOrderStoreOptions) => Omit<import('zustand').StoreApi<TreeListOrderState>, "setState" | "persist"> & {
16
+ setState(partial: TreeListOrderState | Partial<TreeListOrderState> | ((state: TreeListOrderState) => TreeListOrderState | Partial<TreeListOrderState>), replace?: false | undefined): unknown;
17
+ setState(state: TreeListOrderState | ((state: TreeListOrderState) => TreeListOrderState), replace: true): unknown;
18
+ persist: {
19
+ setOptions: (options: Partial<import('zustand/middleware').PersistOptions<TreeListOrderState, unknown, unknown>>) => void;
20
+ clearStorage: () => void;
21
+ rehydrate: () => Promise<void> | void;
22
+ hasHydrated: () => boolean;
23
+ onHydrate: (fn: (state: TreeListOrderState) => void) => () => void;
24
+ onFinishHydration: (fn: (state: TreeListOrderState) => void) => () => void;
25
+ getOptions: () => Partial<import('zustand/middleware').PersistOptions<TreeListOrderState, unknown, unknown>>;
26
+ };
27
+ };
28
+ export declare const getTreeListOrderStore: (storageKey: string) => Omit<import('zustand').StoreApi<TreeListOrderState>, "setState" | "persist"> & {
29
+ setState(partial: TreeListOrderState | Partial<TreeListOrderState> | ((state: TreeListOrderState) => TreeListOrderState | Partial<TreeListOrderState>), replace?: false | undefined): unknown;
30
+ setState(state: TreeListOrderState | ((state: TreeListOrderState) => TreeListOrderState), replace: true): unknown;
31
+ persist: {
32
+ setOptions: (options: Partial<import('zustand/middleware').PersistOptions<TreeListOrderState, unknown, unknown>>) => void;
33
+ clearStorage: () => void;
34
+ rehydrate: () => Promise<void> | void;
35
+ hasHydrated: () => boolean;
36
+ onHydrate: (fn: (state: TreeListOrderState) => void) => () => void;
37
+ onFinishHydration: (fn: (state: TreeListOrderState) => void) => () => void;
38
+ getOptions: () => Partial<import('zustand/middleware').PersistOptions<TreeListOrderState, unknown, unknown>>;
39
+ };
40
+ };
41
+ export declare const useTreeListOrderStore: <T>(storageKey: string, selector: (state: TreeListOrderState) => T) => T;
42
+ export type { TreeListOrderSnapshot, TreeListOrderState };
@@ -0,0 +1,13 @@
1
+ import { TreeListSection } from './tree-list.types';
2
+ export declare const toSectionDragId: (sectionId: string) => string;
3
+ export declare const isSectionDragId: (id: string) => boolean;
4
+ export declare const fromSectionDragId: (id: string) => string;
5
+ export type ReorderResult = {
6
+ kind: "section";
7
+ nextSectionIds: string[];
8
+ } | {
9
+ kind: "node";
10
+ sectionId: string;
11
+ nextNodeIds: string[];
12
+ };
13
+ export declare const computeReorderResult: (sections: TreeListSection[], activeId: string, overId: string) => ReorderResult | null;
@@ -0,0 +1,14 @@
1
+ import { FocusEventHandler, MouseEvent as ReactMouseEvent } from 'react';
2
+ import { TreeListSection } from './tree-list.types';
3
+ interface TreeListSectionHeaderProps {
4
+ section: TreeListSection;
5
+ collapsible: boolean;
6
+ expanded: boolean;
7
+ focusId: string;
8
+ tabIndex: number;
9
+ onFocus: FocusEventHandler<HTMLElement>;
10
+ onToggle: () => void;
11
+ onContextMenu?: (event: ReactMouseEvent<HTMLElement>, sectionId: string) => void;
12
+ }
13
+ export declare const TreeListSectionHeader: (props: TreeListSectionHeaderProps) => import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1,22 @@
1
+ import { StackProps } from '@chakra-ui/react';
2
+ import { MouseEvent as ReactMouseEvent } from 'react';
3
+ import { TreeListLinkComponent, TreeListNavigateEvent, TreeListSection } from './tree-list.types';
4
+ type TreeListRowVariant = "compact" | "tree";
5
+ interface TreeListSortableProps {
6
+ sections: TreeListSection[];
7
+ expandedSectionIds?: string[];
8
+ expandedNodeIds?: string[];
9
+ activeNodeId?: string | string[] | null;
10
+ rowVariant?: TreeListRowVariant;
11
+ sectionGap?: StackProps["gap"];
12
+ nodeGap?: StackProps["gap"];
13
+ linkComponent?: TreeListLinkComponent;
14
+ onNavigate?: (event: TreeListNavigateEvent) => void;
15
+ onToggleSection?: (sectionId: string) => void;
16
+ onToggleNode?: (nodeId: string) => void;
17
+ onSectionContextMenu?: (event: ReactMouseEvent<HTMLElement>, sectionId: string) => void;
18
+ onReorderSections?: (nextSectionIds: string[]) => void;
19
+ onReorderNodes?: (sectionId: string, nextNodeIds: string[]) => void;
20
+ }
21
+ export declare const TreeListSortable: (props: TreeListSortableProps) => import("react/jsx-runtime").JSX.Element;
22
+ export {};
@@ -0,0 +1,17 @@
1
+ import { ReactNode } from 'react';
2
+ import { ResourceContextAction } from '../resource-context-menu';
3
+ import { TreeListSection } from './tree-list.types';
4
+ import { VisibilityOverride } from './tree-list-visibility.store';
5
+ export declare const resolveVisibility: (override: VisibilityOverride | undefined, hiddenByDefault: boolean | undefined) => VisibilityOverride;
6
+ export declare const filterVisibleSections: (sections: TreeListSection[], sectionOverrides: Record<string, VisibilityOverride>, nodeOverrides: Record<string, VisibilityOverride>) => TreeListSection[];
7
+ export interface TreeVisibilityMenuActions {
8
+ onToggleSection: (id: string, hiddenByDefault: boolean) => void;
9
+ onToggleNode: (id: string, hiddenByDefault: boolean) => void;
10
+ onResetAll: () => void;
11
+ onResetOrder?: () => void;
12
+ }
13
+ interface BuildMenuOptions {
14
+ checkmark: ReactNode;
15
+ }
16
+ export declare const buildTreeVisibilityMenuActions: (sections: TreeListSection[], sectionOverrides: Record<string, VisibilityOverride>, nodeOverrides: Record<string, VisibilityOverride>, actions: TreeVisibilityMenuActions, options: BuildMenuOptions) => ResourceContextAction[];
17
+ export {};
@@ -0,0 +1,45 @@
1
+ export type VisibilityOverride = "hidden" | "shown";
2
+ interface TreeListVisibilitySnapshot {
3
+ sectionOverrides: Record<string, VisibilityOverride>;
4
+ nodeOverrides: Record<string, VisibilityOverride>;
5
+ }
6
+ interface TreeListVisibilityState extends TreeListVisibilitySnapshot {
7
+ setSection: (id: string, value: VisibilityOverride | undefined) => void;
8
+ setNode: (id: string, value: VisibilityOverride | undefined) => void;
9
+ toggleSection: (id: string, hiddenByDefault: boolean) => void;
10
+ toggleNode: (id: string, hiddenByDefault: boolean) => void;
11
+ clearSection: (id: string) => void;
12
+ clearNode: (id: string) => void;
13
+ reset: () => void;
14
+ }
15
+ interface CreateTreeListVisibilityStoreOptions {
16
+ storageKey: string;
17
+ }
18
+ export declare const createTreeListVisibilityStore: (options: CreateTreeListVisibilityStoreOptions) => Omit<import('zustand').StoreApi<TreeListVisibilityState>, "setState" | "persist"> & {
19
+ setState(partial: TreeListVisibilityState | Partial<TreeListVisibilityState> | ((state: TreeListVisibilityState) => TreeListVisibilityState | Partial<TreeListVisibilityState>), replace?: false | undefined): unknown;
20
+ setState(state: TreeListVisibilityState | ((state: TreeListVisibilityState) => TreeListVisibilityState), replace: true): unknown;
21
+ persist: {
22
+ setOptions: (options: Partial<import('zustand/middleware').PersistOptions<TreeListVisibilityState, unknown, unknown>>) => void;
23
+ clearStorage: () => void;
24
+ rehydrate: () => Promise<void> | void;
25
+ hasHydrated: () => boolean;
26
+ onHydrate: (fn: (state: TreeListVisibilityState) => void) => () => void;
27
+ onFinishHydration: (fn: (state: TreeListVisibilityState) => void) => () => void;
28
+ getOptions: () => Partial<import('zustand/middleware').PersistOptions<TreeListVisibilityState, unknown, unknown>>;
29
+ };
30
+ };
31
+ export declare const getTreeListVisibilityStore: (storageKey: string) => Omit<import('zustand').StoreApi<TreeListVisibilityState>, "setState" | "persist"> & {
32
+ setState(partial: TreeListVisibilityState | Partial<TreeListVisibilityState> | ((state: TreeListVisibilityState) => TreeListVisibilityState | Partial<TreeListVisibilityState>), replace?: false | undefined): unknown;
33
+ setState(state: TreeListVisibilityState | ((state: TreeListVisibilityState) => TreeListVisibilityState), replace: true): unknown;
34
+ persist: {
35
+ setOptions: (options: Partial<import('zustand/middleware').PersistOptions<TreeListVisibilityState, unknown, unknown>>) => void;
36
+ clearStorage: () => void;
37
+ rehydrate: () => Promise<void> | void;
38
+ hasHydrated: () => boolean;
39
+ onHydrate: (fn: (state: TreeListVisibilityState) => void) => () => void;
40
+ onFinishHydration: (fn: (state: TreeListVisibilityState) => void) => () => void;
41
+ getOptions: () => Partial<import('zustand/middleware').PersistOptions<TreeListVisibilityState, unknown, unknown>>;
42
+ };
43
+ };
44
+ export declare const useTreeListVisibilityStore: <T>(storageKey: string, selector: (state: TreeListVisibilityState) => T) => T;
45
+ export type { TreeListVisibilitySnapshot, TreeListVisibilityState };
@@ -1,6 +1,7 @@
1
1
  import { StackProps } from '@chakra-ui/react';
2
- import { RefObject } from 'react';
3
- import { TreeListLinkComponent, TreeListNavigateEvent, TreeListNode, TreeListSection } from './tree-list.types';
2
+ import { MouseEvent as ReactMouseEvent, RefObject } from 'react';
3
+ import { TreeListLinkComponent, TreeListNavigateEvent, TreeListSection } from './tree-list.types';
4
+ export { buildVirtualRows } from './tree-list-model';
4
5
  type TreeListRowVariant = "compact" | "tree";
5
6
  interface TreeListProps {
6
7
  sections: TreeListSection[];
@@ -14,32 +15,11 @@ interface TreeListProps {
14
15
  onNavigate?: (event: TreeListNavigateEvent) => void;
15
16
  onToggleSection?: (sectionId: string) => void;
16
17
  onToggleNode?: (nodeId: string) => void;
17
- /**
18
- * When set, the tree's rows are virtualized via @tanstack/react-virtual.
19
- * Requires `scrollRef` to point at the ancestor scroll viewport.
20
- */
18
+ onSectionContextMenu?: (event: ReactMouseEvent<HTMLElement>, sectionId: string) => void;
21
19
  virtualize?: boolean;
22
20
  scrollRef?: RefObject<HTMLDivElement | null>;
21
+ draggable?: boolean;
22
+ onReorderSections?: (nextSectionIds: string[]) => void;
23
+ onReorderNodes?: (sectionId: string, nextNodeIds: string[]) => void;
23
24
  }
24
- export type VirtualRow = {
25
- kind: "section-header";
26
- key: string;
27
- sectionId: string;
28
- section: TreeListSection;
29
- collapsible: boolean;
30
- expanded: boolean;
31
- } | {
32
- kind: "node";
33
- key: string;
34
- sectionId: string;
35
- node: TreeListNode;
36
- level: number;
37
- } | {
38
- kind: "section-empty";
39
- key: string;
40
- sectionId: string;
41
- emptyState: TreeListSection["emptyState"];
42
- };
43
- export declare const buildVirtualRows: (sections: TreeListSection[], expandedSectionIds: string[], expandedNodeIds: string[]) => VirtualRow[];
44
25
  export declare const TreeList: (props: TreeListProps) => import("react/jsx-runtime").JSX.Element;
45
- export {};