@kermodes/react 0.5.1-dev.8.g3e518a2 → 0.5.1-dev.9.g78d5e93
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/{chunk-c8fqw0ed.js → chunk-zjdfj5h0.js} +109 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +13 -1
- package/dist/layout.d.ts +43 -0
- package/dist/table.js +1 -1
- package/package.json +5 -4
|
@@ -163,9 +163,115 @@ function columnsOf(rows) {
|
|
|
163
163
|
type: typeof value === "number" ? "float64" : typeof value === "bigint" ? "int64" : typeof value === "boolean" ? "bool" : value instanceof Date ? "timestamp" : "utf8"
|
|
164
164
|
}));
|
|
165
165
|
}
|
|
166
|
+
// react/src/layout.tsx
|
|
167
|
+
import { Children, Fragment } from "react";
|
|
168
|
+
import {
|
|
169
|
+
Group,
|
|
170
|
+
Panel as Pane,
|
|
171
|
+
Separator,
|
|
172
|
+
useDefaultLayout
|
|
173
|
+
} from "react-resizable-panels";
|
|
174
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
175
|
+
function Dashboard2({ children }) {
|
|
176
|
+
return /* @__PURE__ */ jsx("div", {
|
|
177
|
+
className: "km-dashboard",
|
|
178
|
+
children
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function Panel2({ title, actions, children }) {
|
|
182
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
183
|
+
className: "km-panel",
|
|
184
|
+
children: [
|
|
185
|
+
/* @__PURE__ */ jsxs("header", {
|
|
186
|
+
className: "km-panel-header",
|
|
187
|
+
children: [
|
|
188
|
+
/* @__PURE__ */ jsx("span", {
|
|
189
|
+
className: "km-panel-title",
|
|
190
|
+
children: title
|
|
191
|
+
}),
|
|
192
|
+
actions != null && /* @__PURE__ */ jsx("div", {
|
|
193
|
+
className: "km-panel-actions",
|
|
194
|
+
children: actions
|
|
195
|
+
})
|
|
196
|
+
]
|
|
197
|
+
}),
|
|
198
|
+
/* @__PURE__ */ jsx("div", {
|
|
199
|
+
className: "km-panel-body",
|
|
200
|
+
children
|
|
201
|
+
})
|
|
202
|
+
]
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
var forgotten = { getItem: () => null, setItem: () => {
|
|
206
|
+
return;
|
|
207
|
+
} };
|
|
208
|
+
function Split2({
|
|
209
|
+
id,
|
|
210
|
+
direction = "horizontal",
|
|
211
|
+
sizes,
|
|
212
|
+
children
|
|
213
|
+
}) {
|
|
214
|
+
const parts = Children.toArray(children);
|
|
215
|
+
const kept = useDefaultLayout({
|
|
216
|
+
id: `kermodes-split-${id ?? "unnamed"}`,
|
|
217
|
+
storage: id == null ? forgotten : localStorage
|
|
218
|
+
});
|
|
219
|
+
return /* @__PURE__ */ jsx(Group, {
|
|
220
|
+
orientation: direction,
|
|
221
|
+
className: `km-split km-split-${direction}`,
|
|
222
|
+
defaultLayout: kept.defaultLayout,
|
|
223
|
+
onLayoutChanged: kept.onLayoutChanged,
|
|
224
|
+
children: parts.map((part, i) => /* @__PURE__ */ jsxs(Fragment, {
|
|
225
|
+
children: [
|
|
226
|
+
i > 0 && /* @__PURE__ */ jsx(Separator, {
|
|
227
|
+
className: "km-separator"
|
|
228
|
+
}),
|
|
229
|
+
/* @__PURE__ */ jsx(Pane, {
|
|
230
|
+
id: String(i),
|
|
231
|
+
defaultSize: sizes?.[i] == null ? undefined : `${sizes[i]}%`,
|
|
232
|
+
minSize: "5%",
|
|
233
|
+
children: part
|
|
234
|
+
})
|
|
235
|
+
]
|
|
236
|
+
}, i))
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
function Stats2({ children }) {
|
|
240
|
+
return /* @__PURE__ */ jsx("div", {
|
|
241
|
+
className: "km-stats",
|
|
242
|
+
children
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
function Stat2({ label, value, sign }) {
|
|
246
|
+
const tone = sign == null || sign === 0 || Number.isNaN(sign) ? undefined : sign > 0 ? "positive" : "negative";
|
|
247
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
248
|
+
className: "km-stat",
|
|
249
|
+
children: [
|
|
250
|
+
/* @__PURE__ */ jsx("span", {
|
|
251
|
+
className: "km-stat-label",
|
|
252
|
+
children: label
|
|
253
|
+
}),
|
|
254
|
+
/* @__PURE__ */ jsx("span", {
|
|
255
|
+
className: "km-stat-value",
|
|
256
|
+
"data-sign": tone,
|
|
257
|
+
children: value
|
|
258
|
+
})
|
|
259
|
+
]
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
function Status2({ status }) {
|
|
263
|
+
if (status === "live" || status === "static") {
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
return /* @__PURE__ */ jsx("span", {
|
|
267
|
+
className: "km-status",
|
|
268
|
+
"data-status": status,
|
|
269
|
+
children: status === "failed" ? "Unavailable" : status === "reconnecting" ? "Reconnecting" : "Connecting"
|
|
270
|
+
});
|
|
271
|
+
}
|
|
166
272
|
|
|
167
273
|
// react/src/index.tsx
|
|
168
|
-
import { jsx } from "react/jsx-runtime";
|
|
274
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
169
275
|
var ConnectionContext = createContext(null);
|
|
170
276
|
function pageServer2(location) {
|
|
171
277
|
const app = /^\/apps\/[^/]+\/[^/]+\//.exec(location.pathname)?.[0] ?? "/";
|
|
@@ -178,7 +284,7 @@ function KermodesProvider2({
|
|
|
178
284
|
}) {
|
|
179
285
|
const connection = useMemo(() => given ?? new KermodesConnection(url ?? pageServer2(window.location)), [given, url]);
|
|
180
286
|
useEffect(() => given == null ? () => connection.close() : undefined, [connection, given]);
|
|
181
|
-
return /* @__PURE__ */
|
|
287
|
+
return /* @__PURE__ */ jsx2(ConnectionContext.Provider, {
|
|
182
288
|
value: connection,
|
|
183
289
|
children
|
|
184
290
|
});
|
|
@@ -278,4 +384,4 @@ function useTable2(name, { sort = [], filters = {}, offset = 0, limit = 100, las
|
|
|
278
384
|
return state;
|
|
279
385
|
}
|
|
280
386
|
|
|
281
|
-
export { windowRows2, rowRange2, sortKeys2, tableStatus2, fakeKermodes2, pageServer2, KermodesProvider2, useKermodes2, useTables2, useTable2 };
|
|
387
|
+
export { windowRows2, rowRange2, sortKeys2, tableStatus2, fakeKermodes2, Dashboard2, Panel2, Split2, Stats2, Stat2, Status2, pageServer2, KermodesProvider2, useKermodes2, useTables2, useTable2 };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { Connection } from './connection';
|
|
|
4
4
|
import { type TableRow, type TableStatus } from './rows';
|
|
5
5
|
export type { Connection } from './connection';
|
|
6
6
|
export { fakeKermodes, type FakeKermodes } from './fake';
|
|
7
|
+
export { Dashboard, Panel, Split, Stat, Stats, Status } from './layout';
|
|
7
8
|
export { rowRange, sortKeys, tableStatus, windowRows, type TableRow, type TableStatus, } from './rows';
|
|
8
9
|
/**
|
|
9
10
|
* The page's own server: an app's at `<its path>ws`, as Kermodes serves every app under
|
package/dist/index.js
CHANGED
|
@@ -4,14 +4,26 @@ import {
|
|
|
4
4
|
sortKeys2,
|
|
5
5
|
tableStatus2,
|
|
6
6
|
fakeKermodes2,
|
|
7
|
+
Dashboard2,
|
|
8
|
+
Panel2,
|
|
9
|
+
Split2,
|
|
10
|
+
Stats2,
|
|
11
|
+
Stat2,
|
|
12
|
+
Status2,
|
|
7
13
|
pageServer2,
|
|
8
14
|
KermodesProvider2,
|
|
9
15
|
useKermodes2,
|
|
10
16
|
useTables2,
|
|
11
17
|
useTable2
|
|
12
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-zjdfj5h0.js";
|
|
13
19
|
export {
|
|
20
|
+
Dashboard2 as Dashboard,
|
|
14
21
|
KermodesProvider2 as KermodesProvider,
|
|
22
|
+
Panel2 as Panel,
|
|
23
|
+
Split2 as Split,
|
|
24
|
+
Stat2 as Stat,
|
|
25
|
+
Stats2 as Stats,
|
|
26
|
+
Status2 as Status,
|
|
15
27
|
fakeKermodes2 as fakeKermodes,
|
|
16
28
|
pageServer2 as pageServer,
|
|
17
29
|
rowRange2 as rowRange,
|
package/dist/layout.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { TableStatus } from './rows';
|
|
3
|
+
/** The whole page: its children stacked, a strip of figures or a split filling the rest */
|
|
4
|
+
export declare function Dashboard({ children }: {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
/** A titled pane: a thin header (its title, and `actions` at the right) over `children`, which fill it */
|
|
8
|
+
export declare function Panel({ title, actions, children }: {
|
|
9
|
+
title: ReactNode;
|
|
10
|
+
actions?: ReactNode;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
/**
|
|
14
|
+
* Its children side by side (`horizontal`) or stacked (`vertical`), a hairline between each that
|
|
15
|
+
* a person drags to resize. `sizes` are percentages; with an `id`, the sizes a person chooses
|
|
16
|
+
* are kept in the browser and come back on the next load.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Split({ id, direction, sizes, children, }: {
|
|
19
|
+
id?: string;
|
|
20
|
+
direction?: 'horizontal' | 'vertical';
|
|
21
|
+
sizes?: number[];
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
24
|
+
/** A strip of figures across the page or a panel */
|
|
25
|
+
export declare function Stats({ children }: {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
}): import("react").JSX.Element;
|
|
28
|
+
/**
|
|
29
|
+
* A figure: its label over its value, in the mono. With `sign`, the value is coloured by it, as
|
|
30
|
+
* the grid colours numbers (a change, a P&L).
|
|
31
|
+
*/
|
|
32
|
+
export declare function Stat({ label, value, sign }: {
|
|
33
|
+
label: ReactNode;
|
|
34
|
+
value: ReactNode;
|
|
35
|
+
sign?: number;
|
|
36
|
+
}): import("react").JSX.Element;
|
|
37
|
+
/**
|
|
38
|
+
* Nothing while a table is live (docs/theme.md: normal looks normal); says so when it is not,
|
|
39
|
+
* as a panel's action or beside a figure.
|
|
40
|
+
*/
|
|
41
|
+
export declare function Status({ status }: {
|
|
42
|
+
status: TableStatus;
|
|
43
|
+
}): import("react").JSX.Element | null;
|
package/dist/table.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kermodes/react",
|
|
3
|
-
"version": "0.5.1-dev.
|
|
3
|
+
"version": "0.5.1-dev.9.g78d5e93",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,9 +24,10 @@
|
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@kermodes/client": "0.5.1-dev.
|
|
28
|
-
"@kermodes/grid": "0.5.1-dev.
|
|
29
|
-
"apache-arrow": "^21.0.0"
|
|
27
|
+
"@kermodes/client": "0.5.1-dev.9.g78d5e93",
|
|
28
|
+
"@kermodes/grid": "0.5.1-dev.9.g78d5e93",
|
|
29
|
+
"apache-arrow": "^21.0.0",
|
|
30
|
+
"react-resizable-panels": "^4.24.0"
|
|
30
31
|
},
|
|
31
32
|
"peerDependencies": {
|
|
32
33
|
"react": "^19.0.0"
|