react-reason-editor-sidebar 0.1.0 → 0.1.2
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/dist/SidebarToolbar.d.ts +7 -1
- package/dist/file-tree/index.d.ts +2 -0
- package/dist/file-tree/useExpandCycle.d.ts +30 -0
- package/dist/index.cjs +15 -15
- package/dist/index.mjs +3695 -3672
- package/package.json +2 -2
package/dist/SidebarToolbar.d.ts
CHANGED
|
@@ -44,6 +44,12 @@ interface SidebarToolbarProps {
|
|
|
44
44
|
allExpanded: boolean;
|
|
45
45
|
/** Tooltip label describing what the expand-all toggle will do next (cycles by folder level). */
|
|
46
46
|
expandToggleLabel: string;
|
|
47
|
+
/**
|
|
48
|
+
* Disables the expand-all toggle when there is no file tree behind it —
|
|
49
|
+
* the Files panel is turned off for this sidebar or lives in the other
|
|
50
|
+
* one — so the button doesn't advertise a cycle it cannot run.
|
|
51
|
+
*/
|
|
52
|
+
expandToggleDisabled?: boolean;
|
|
47
53
|
/** Whether all outline entries are currently expanded. */
|
|
48
54
|
outlineExpanded: boolean;
|
|
49
55
|
/** Steps the tree to its next expansion level (wraps to fully collapsed). */
|
|
@@ -85,5 +91,5 @@ interface SidebarToolbarProps {
|
|
|
85
91
|
* file-source, search, file-manager, new-file/folder, and collapse-all
|
|
86
92
|
* buttons; the outline panel additionally shows an expand/collapse toggle.
|
|
87
93
|
*/
|
|
88
|
-
export declare const SidebarToolbar: ({ leftPanels, onLeftPanelsChange, rightPanels, onRightPanelsChange, activeId, onAdd, onSearchFocus, onFileManagerOpen, sources, activeSource, activeFileSourceId, onFileSourceChange, onSourceSelect, allExpanded, expandToggleLabel, outlineExpanded, onToggleAllExpanded, onToggleOutlineExpanded, treeRef, outlineRef, deletedDocs, onRestore, showDynamicIsland, onToggleDynamicIsland, onSettingsClick, isMobile, openTabs, activeTab, onTabChange, onTabClose, documents, tabItems, }: SidebarToolbarProps) => import("react").JSX.Element;
|
|
94
|
+
export declare const SidebarToolbar: ({ leftPanels, onLeftPanelsChange, rightPanels, onRightPanelsChange, activeId, onAdd, onSearchFocus, onFileManagerOpen, sources, activeSource, activeFileSourceId, onFileSourceChange, onSourceSelect, allExpanded, expandToggleLabel, expandToggleDisabled, outlineExpanded, onToggleAllExpanded, onToggleOutlineExpanded, treeRef, outlineRef, deletedDocs, onRestore, showDynamicIsland, onToggleDynamicIsland, onSettingsClick, isMobile, openTabs, activeTab, onTabChange, onTabClose, documents, tabItems, }: SidebarToolbarProps) => import("react").JSX.Element;
|
|
89
95
|
export {};
|
|
@@ -7,3 +7,5 @@ export { FileTreeContextMenu } from "./FileTreeContextMenu";
|
|
|
7
7
|
export { useFileTreeOperations } from "./useFileTreeOperations";
|
|
8
8
|
export * from "./expandLevels";
|
|
9
9
|
export * from "./documentUtils";
|
|
10
|
+
export { useExpandCycle } from "./useExpandCycle";
|
|
11
|
+
export type { ExpandCycle, ExpandState } from "./useExpandCycle";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import type { DocumentTreeHandle } from './filetree';
|
|
3
|
+
/** Expansion depth of a file tree: `level` of `maxLevel` folder levels shown. */
|
|
4
|
+
export interface ExpandState {
|
|
5
|
+
level: number;
|
|
6
|
+
maxLevel: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ExpandCycle {
|
|
9
|
+
/** True while there is a mounted tree with at least one folder to cycle. */
|
|
10
|
+
canCycle: boolean;
|
|
11
|
+
/** True once every folder level is showing, so the next click collapses. */
|
|
12
|
+
isFullyExpanded: boolean;
|
|
13
|
+
/** Describes the action the next click performs, for tooltip and label. */
|
|
14
|
+
label: string;
|
|
15
|
+
/** Hand this to the tree's `onExpandStateChange`. */
|
|
16
|
+
onExpandStateChange: (next: ExpandState) => void;
|
|
17
|
+
/** The depth the tree last reported. */
|
|
18
|
+
state: ExpandState;
|
|
19
|
+
/** Steps one folder level deeper, wrapping back to fully collapsed. */
|
|
20
|
+
toggle: () => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Drives the expand/collapse cycle of the tree behind `treeRef`.
|
|
24
|
+
*
|
|
25
|
+
* @param treeRef - Ref to the file tree being cycled. May be empty; the
|
|
26
|
+
* returned `canCycle` is false until a tree with folders reports in.
|
|
27
|
+
* @param onStateChange - Optional passthrough, so a host that renders the
|
|
28
|
+
* control somewhere else (the sidebar toolbar) can mirror the same depth.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useExpandCycle(treeRef: RefObject<DocumentTreeHandle | null>, onStateChange?: (next: ExpandState) => void): ExpandCycle;
|