@voltro/devtools 0.1.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.
@@ -0,0 +1,174 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ export declare type Anchor = 'topLeft' | 'topMid' | 'topRight' | 'midLeft' | 'midRight' | 'bottomLeft' | 'bottomMid' | 'bottomRight';
4
+
5
+ /** The English defaults. A consumer overrides any subtree via
6
+ * {@link DevtoolsStringsProvider} or the `strings` prop; unspecified keys fall
7
+ * through to these. */
8
+ export declare const defaultDevtoolsStrings: DevtoolsStrings;
9
+
10
+ /** Every user-facing string the devtools overlay renders. Scalars are literals;
11
+ * anything that interpolates a value (count, name) is a function so a locale
12
+ * can reorder/pluralize. English defaults live in {@link defaultDevtoolsStrings}. */
13
+ export declare interface DevtoolsStrings {
14
+ /** The shell: brand chrome, the FAB open control, close, keyboard hint. */
15
+ readonly shell: {
16
+ /** aria-label on the open (dialog) surface (the full product name). */
17
+ readonly brand: string;
18
+ /** The bold brand word in the panel header. */
19
+ readonly brandWord: string;
20
+ /** The uppercase kicker beside the brand word in the header. */
21
+ readonly kicker: string;
22
+ /** FAB button `aria-label` (screen-reader). */
23
+ readonly openLabel: string;
24
+ /** FAB button `title` tooltip — includes the shortcut hint. */
25
+ readonly openTitle: string;
26
+ /** Close IconButton `title` tooltip. */
27
+ readonly closeTitle: string;
28
+ };
29
+ /** The tab-strip labels. */
30
+ readonly tabs: {
31
+ readonly subscriptions: string;
32
+ readonly mutations: string;
33
+ readonly indexes: string;
34
+ readonly webhooks: string;
35
+ readonly traces: string;
36
+ readonly routes: string;
37
+ readonly runtimes: string;
38
+ readonly logs: string;
39
+ };
40
+ /** <SubscriptionsPanel> empty/section copy. */
41
+ readonly subscriptions: {
42
+ readonly emptyTitle: string;
43
+ readonly emptyHint: string;
44
+ };
45
+ /** <IndexesPanel> empty/section copy. */
46
+ readonly indexes: {
47
+ readonly noApis: string;
48
+ readonly unreachableTitle: string;
49
+ readonly unreachableHint: string;
50
+ readonly offline: string;
51
+ readonly tables: string;
52
+ readonly subscriptionsSection: string;
53
+ readonly subsBadge: (count: number) => string;
54
+ readonly live: string;
55
+ readonly poll: string;
56
+ readonly via: string;
57
+ readonly clients: (count: number) => string;
58
+ };
59
+ /** <WebhooksPanel> section headers + the delivery/target labels. */
60
+ readonly webhooks: {
61
+ readonly empty: string;
62
+ readonly outgoing: (count: number) => string;
63
+ readonly incoming: (count: number) => string;
64
+ readonly targets: (count: number) => string;
65
+ readonly deliveries: (count: number) => string;
66
+ readonly signed: string;
67
+ readonly unsigned: string;
68
+ readonly active: string;
69
+ readonly paused: string;
70
+ readonly attempt: (n: number) => string;
71
+ };
72
+ /** <MutationsPanel> empty state + section chrome. */
73
+ readonly mutations: {
74
+ readonly emptyTitle: string;
75
+ readonly emptyHint: string;
76
+ readonly clearTitle: string;
77
+ readonly clear: string;
78
+ readonly recent: (count: number) => string;
79
+ };
80
+ /** <LogsPanel> filter chrome + empty states + the tail section. */
81
+ readonly logs: {
82
+ readonly filters: string;
83
+ readonly clearTitle: string;
84
+ readonly clear: string;
85
+ readonly searchPlaceholder: string;
86
+ readonly emptyNone: string;
87
+ readonly emptyNoMatch: string;
88
+ readonly emptyHint: string;
89
+ readonly tail: string;
90
+ };
91
+ /** <RoutesPanel> section headers + loader empty state. */
92
+ readonly routes: {
93
+ readonly currentRoute: string;
94
+ readonly loaderData: string;
95
+ readonly collapse: string;
96
+ readonly expand: string;
97
+ readonly noLoaderTitle: string;
98
+ readonly noLoaderHint: (routerTag: ReactNode) => ReactNode;
99
+ };
100
+ /** <RuntimesPanel> empty state + the per-api status badge. */
101
+ readonly runtimes: {
102
+ readonly emptyTitle: string;
103
+ readonly emptyHint: string;
104
+ readonly live: string;
105
+ };
106
+ /** <TracesPanel> empty states + the trace-row labels. */
107
+ readonly traces: {
108
+ readonly noApi: string;
109
+ readonly noneCaptured: (apiName: string) => string;
110
+ readonly proxiedTitle: string;
111
+ readonly proxiedHint: (command: ReactNode) => ReactNode;
112
+ readonly ok: string;
113
+ readonly error: string;
114
+ readonly sub: string;
115
+ readonly delivery: (count: number) => string;
116
+ readonly spans: (count: number) => string;
117
+ };
118
+ }
119
+
120
+ /** Provide localized (or otherwise overridden) devtools strings to every panel
121
+ * below. Overrides are deep-merged onto the English defaults — supply only the
122
+ * sections/keys you change. Nesting providers merges onto the parent. */
123
+ export declare function DevtoolsStringsProvider(props: {
124
+ readonly strings: PartialDevtoolsStrings;
125
+ readonly children: ReactNode;
126
+ }): ReactNode;
127
+
128
+ /** A caller may override any subtree, not the whole object — deep-partial per
129
+ * section (each section is a flat bag of literals/functions, so a shallow
130
+ * per-section merge is exact). */
131
+ export declare type PartialDevtoolsStrings = {
132
+ readonly [K in keyof DevtoolsStrings]?: Partial<DevtoolsStrings[K]>;
133
+ };
134
+
135
+ /** Read the active devtools strings. Returns the English defaults when no
136
+ * provider is mounted, so every panel works with zero setup. A per-call
137
+ * `override` is deep-merged on top of whatever this returns. */
138
+ export declare const useDevtoolsStrings: (override?: PartialDevtoolsStrings) => DevtoolsStrings;
139
+
140
+ /**
141
+ * Main devtools overlay component. Mount once near the root of the
142
+ * app — typically by the framework's `mount()` auto-injection.
143
+ *
144
+ * Both props are FIRST-RUN defaults for a foreign-host mount — once the
145
+ * user toggles/moves the overlay, the persisted localStorage state wins.
146
+ *
147
+ * The host page's CSS is unaffected: every Tailwind utility under
148
+ * `.vdt-scope` is prefixed `vdt:` and every token override is scoped
149
+ * to the wrapper class.
150
+ */
151
+ export declare const VoltroDevtools: ({ initialIsOpen, initialAnchor, strings, inspectToken, }?: VoltroDevtoolsProps) => ReactNode;
152
+
153
+ export declare interface VoltroDevtoolsProps {
154
+ /** Start with the panel open when nothing is persisted yet. A persisted
155
+ * open/closed choice (localStorage) always wins. Default `false`. */
156
+ readonly initialIsOpen?: boolean;
157
+ /** Dock position used when nothing is persisted yet. A persisted anchor
158
+ * always wins. Default `'bottomLeft'`. */
159
+ readonly initialAnchor?: Anchor;
160
+ /** Override any user-facing label the overlay renders (tab labels, empty
161
+ * states, the FAB tooltip, …). Deep-merged onto the English defaults —
162
+ * supply only the sections/keys you change. Nesting a
163
+ * `<DevtoolsStringsProvider>` above the overlay works too. */
164
+ readonly strings?: PartialDevtoolsStrings;
165
+ /** Bearer token for the `/_voltro/inspect/*` endpoints the webhooks / traces
166
+ * / indexes panels poll. Needed only against a token-gated deploy (`voltro
167
+ * start` with `VOLTRO_INSPECT_TOKEN` set) — `voltro dev` leaves the surface
168
+ * open. When omitted, the overlay reads `VITE_VOLTRO_INSPECT_TOKEN` from the
169
+ * Vite env; when neither is set, no `Authorization` header is sent (today's
170
+ * behavior). */
171
+ readonly inspectToken?: string;
172
+ }
173
+
174
+ export { }