@nbt-dev/devtools 0.0.8 → 0.0.10

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 CHANGED
@@ -9,6 +9,10 @@ console](https://github.com/nbt-dev). It gives you, against the live daemon:
9
9
  detail
10
10
  - **Diagram** — an entity-relationship graph with live row counts
11
11
  - **Sources** — a dev-mode NBT source editor with diagnostics and apply support
12
+ - **Settings** — General (devtools panel font), Editor (theme, font size, line
13
+ wrapping, tab size) and Integrations (mirror a cartridge into a Google Sheet).
14
+ Preferences persist per operator on the console (server-side), with a
15
+ localStorage fallback for unauthenticated/dev use.
12
16
 
13
17
  It assumes your app uses NBT auth: the data socket reads the current session
14
18
  bearer from `POST /api/auth/session/current` (sent with `credentials:
@@ -41,12 +45,12 @@ export default function App() {
41
45
  }
42
46
  ```
43
47
 
44
- The panel renders nothing until toggled. Open/close it from anywhere:
48
+ The panel renders nothing until toggled. It owns the built-in shortcuts
49
+ **Ctrl+F12** and **Ctrl/Cmd+Shift+D**. You can also toggle it from anywhere:
45
50
 
46
51
  ```ts
47
52
  import { toggleDevTools } from "@nbt-dev/devtools";
48
53
 
49
- // e.g. bind to Ctrl+F12
50
54
  toggleDevTools();
51
55
  // or, with no import: window.dispatchEvent(new CustomEvent("devtools-toggle"))
52
56
  ```
@@ -69,6 +73,7 @@ with or without Tailwind in the host.
69
73
  | --- | --- |
70
74
  | `NimbitDevTools` | The panel. Props: `apiBaseUrl?`, `defaultActiveTab?`. |
71
75
  | `toggleDevTools()` | Dispatches the `devtools-toggle` window event. |
76
+ | `useDevToolsOpen()` | Reactive open/closed state for your own toolbar button — works outside the panel, no provider needed. |
72
77
  | `DevToolsProvider`, `useDevTools` | Lower-level state if you compose `DevTools` yourself. |
73
78
  | `DevToolsConfigProvider`, `useDevToolsConfig` | The `apiBaseUrl` config context. |
74
79
  | `DevTools` | The bare panel (expects the providers above). |
@@ -33,6 +33,8 @@ type DevToolsCtx = {
33
33
  setView: React.Dispatch<React.SetStateAction<DevToolsView>>;
34
34
  graphCarts: Set<string> | null;
35
35
  setGraphCarts: React.Dispatch<React.SetStateAction<Set<string> | null>>;
36
+ revealedCarts: Set<string>;
37
+ setRevealedCarts: React.Dispatch<React.SetStateAction<Set<string>>>;
36
38
  hiddenEntities: Set<string>;
37
39
  setHiddenEntities: React.Dispatch<React.SetStateAction<Set<string>>>;
38
40
  graphLeftW: number;
@@ -49,6 +51,18 @@ type DevToolsCtx = {
49
51
  setSourcesFile: (v: string | null) => void;
50
52
  sourcesTreeW: number;
51
53
  setSourcesTreeW: React.Dispatch<React.SetStateAction<number>>;
54
+ settingsCategory: string;
55
+ setSettingsCategory: (v: string) => void;
56
+ editorTheme: string;
57
+ setEditorTheme: (v: string) => void;
58
+ editorFontSize: number;
59
+ setEditorFontSize: (v: number) => void;
60
+ editorLineWrap: boolean;
61
+ setEditorLineWrap: (v: boolean) => void;
62
+ editorTabSize: number;
63
+ setEditorTabSize: (v: number) => void;
64
+ devtoolsFont: string;
65
+ setDevtoolsFont: (v: string) => void;
52
66
  };
53
67
  export declare const DevToolsProvider: React.FC<{
54
68
  children: React.ReactNode;
@@ -0,0 +1,7 @@
1
+ export type DevtoolsFont = {
2
+ id: string;
3
+ label: string;
4
+ stack: string;
5
+ };
6
+ export declare const DEVTOOLS_FONTS: DevtoolsFont[];
7
+ export declare function fontStack(id: string): string;
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { type VariantProps } from "class-variance-authority";
3
3
  declare const buttonVariants: (props?: ({
4
- variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
4
+ variant?: "default" | "link" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
5
5
  size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export type NimbitDevToolsProps = {
6
6
  export declare const NimbitDevTools: React.FC<NimbitDevToolsProps>;
7
7
  export default NimbitDevTools;
8
8
  export declare function toggleDevTools(): void;
9
+ export declare function useDevToolsOpen(): boolean;
9
10
  export { DevToolsProvider, useDevTools, } from "./components/devtools/devtools-context";
10
11
  export { default as DevTools } from "./components/devtools/dev-tools";
11
12
  export type { DevToolsDock, DevToolsTab, DevToolsSize, } from "./components/devtools/devtools-context";