@hachej/boring-ui-kit 0.2.0 → 0.2.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.
@@ -53,6 +53,8 @@ export interface FileTreeProps {
53
53
  readonly history?: boolean;
54
54
  /** Reload the open folders and the current search whenever this value changes (for example after the agent saves a file). */
55
55
  readonly refreshKey?: unknown;
56
+ /** Reload the open history panel whenever this value changes (for example the seq of the workspace's latest change event). */
57
+ readonly historyKey?: unknown;
56
58
  }
57
59
  /** One borrowed binding powers browsing, search, upload and history. Historical previews never replace an editor's draft. */
58
60
  export declare function FileTree(props: FileTreeProps): import("react").JSX.Element;
@@ -60,5 +62,5 @@ export interface FileTreeViewProps extends Omit<FileTreeProps, 'revisionProvider
60
62
  readonly controller: FileTreeController;
61
63
  }
62
64
  /** Renders a borrowed controller, for a workspace whose chat and tree share upload state. */
63
- export declare function FileTreeView({ controller, onOpen, selectedPath, className, uploadDirectory, locale, labels: given, upload, history, refreshKey }: FileTreeViewProps): import("react").JSX.Element;
65
+ export declare function FileTreeView({ controller, onOpen, selectedPath, className, uploadDirectory, locale, labels: given, upload, history, refreshKey, historyKey }: FileTreeViewProps): import("react").JSX.Element;
64
66
  //# sourceMappingURL=file-tree-view.d.ts.map
@@ -85,7 +85,7 @@ function BoundFileTree(props) {
85
85
  return owned?.provider === props.revisionProvider ? _jsx(FileTreeView, { ...props, controller: owned.controller }) : _jsx("p", { role: "status", children: props.labels?.loading ?? LOCALES[props.locale ?? 'en'].loading });
86
86
  }
87
87
  /** Renders a borrowed controller, for a workspace whose chat and tree share upload state. */
88
- export function FileTreeView({ controller, onOpen, selectedPath, className, uploadDirectory = 'uploads', locale = 'en', labels: given, upload = true, history = true, refreshKey }) {
88
+ export function FileTreeView({ controller, onOpen, selectedPath, className, uploadDirectory = 'uploads', locale = 'en', labels: given, upload = true, history = true, refreshKey, historyKey }) {
89
89
  const labels = { ...LOCALES[locale], ...given };
90
90
  const state = useSyncExternalStore(controller.subscribe, controller.getSnapshot, controller.getSnapshot);
91
91
  const shownKey = useRef(refreshKey);
@@ -210,9 +210,9 @@ export function FileTreeView({ controller, onOpen, selectedPath, className, uplo
210
210
  if (errors.length)
211
211
  setUploadError(errors.join(' '));
212
212
  })();
213
- } })] })] }), uploadError && _jsx("p", { role: "alert", children: uploadError }), _jsx(SidebarMenu, { ref: tree, role: "tree", "aria-label": labels.tree, className: "m-0 list-none p-2", children: state.query ? _jsxs(_Fragment, { children: [state.search.entries.map(entry => renderEntry(entry, 1)), listingStatus(state.search, '', true)] }) : renderEntries('', 1) }), state.uploads.length > 0 && _jsx("ul", { "aria-label": labels.uploads, className: "list-none p-2 text-sm", children: state.uploads.map(upload => _jsxs("li", { "data-operation": upload.operationId, children: [_jsxs("span", { children: [upload.path, ": ", upload.state.kind === 'pending' ? labels.uploading : upload.state.result.kind === 'committed' ? labels.saved : upload.state.result.kind === 'partial' ? labels.unconfirmed : upload.state.result.reason] }), upload.state.kind === 'settled' && upload.state.result.kind === 'unknown' && _jsx("button", { type: "button", onClick: () => { void controller.reconcile(upload.operationId).catch(error => setUploadError(error instanceof Error ? error.message : labels.uploadStatusUnavailable)); }, children: labels.checkUpload })] }, upload.operationId)) }), history && historyPath !== undefined && _jsx(FileHistory, { controller: controller, path: historyPath, labels: labels, onClose: () => setHistoryPath(undefined) }, historyPath)] });
213
+ } })] })] }), uploadError && _jsx("p", { role: "alert", children: uploadError }), _jsx(SidebarMenu, { ref: tree, role: "tree", "aria-label": labels.tree, className: "m-0 list-none p-2", children: state.query ? _jsxs(_Fragment, { children: [state.search.entries.map(entry => renderEntry(entry, 1)), listingStatus(state.search, '', true)] }) : renderEntries('', 1) }), state.uploads.length > 0 && _jsx("ul", { "aria-label": labels.uploads, className: "list-none p-2 text-sm", children: state.uploads.map(upload => _jsxs("li", { "data-operation": upload.operationId, children: [_jsxs("span", { children: [upload.path, ": ", upload.state.kind === 'pending' ? labels.uploading : upload.state.result.kind === 'committed' ? labels.saved : upload.state.result.kind === 'partial' ? labels.unconfirmed : upload.state.result.reason] }), upload.state.kind === 'settled' && upload.state.result.kind === 'unknown' && _jsx("button", { type: "button", onClick: () => { void controller.reconcile(upload.operationId).catch(error => setUploadError(error instanceof Error ? error.message : labels.uploadStatusUnavailable)); }, children: labels.checkUpload })] }, upload.operationId)) }), history && historyPath !== undefined && _jsx(FileHistory, { controller: controller, path: historyPath, labels: labels, reload: historyKey, onClose: () => setHistoryPath(undefined) }, historyPath)] });
214
214
  }
215
- function FileHistory({ controller, path, labels, onClose }) {
215
+ function FileHistory({ controller, path, labels, reload, onClose }) {
216
216
  const [versions, setVersions] = useState();
217
217
  const [failure, setFailure] = useState('');
218
218
  const [selected, setSelected] = useState();
@@ -223,7 +223,7 @@ function FileHistory({ controller, path, labels, onClose }) {
223
223
  setVersions(value); }, error => { if (!abort.signal.aborted)
224
224
  setFailure(error instanceof Error ? error.message : labels.historyUnavailable); });
225
225
  return () => abort.abort();
226
- }, [controller, path]);
226
+ }, [controller, path, reload]);
227
227
  useEffect(() => {
228
228
  if (selected === undefined)
229
229
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hachej/boring-ui-kit",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "type": "module",
@@ -109,7 +109,7 @@
109
109
  "./file-tree.css": "./styles/file-tree.css"
110
110
  },
111
111
  "peerDependencies": {
112
- "@hachej/boring-files": "0.2.0",
112
+ "@hachej/boring-files": "0.2.1",
113
113
  "@earendil-works/pi-durable": "1.1.0",
114
114
  "react": "19.3.0",
115
115
  "react-dom": "19.3.0",