@dudousxd/nestjs-telescope-ui 2.0.0 → 2.0.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.
- package/CHANGELOG.md +748 -0
- package/README.md +31 -0
- package/dist/client/console-url.d.ts +11 -0
- package/dist/client/console-url.d.ts.map +1 -0
- package/dist/client/console-url.js +21 -0
- package/dist/client/console-url.js.map +1 -0
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +3 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/telescope-client.d.ts +64 -11
- package/dist/client/telescope-client.d.ts.map +1 -1
- package/dist/client/telescope-client.js +59 -54
- package/dist/client/telescope-client.js.map +1 -1
- package/dist/client/types.d.ts +431 -30
- package/dist/client/types.d.ts.map +1 -1
- package/dist/react/components/batch-timeline.js +2 -2
- package/dist/react/components/batch-timeline.js.map +1 -1
- package/dist/react/components/cache-badge.d.ts +14 -6
- package/dist/react/components/cache-badge.d.ts.map +1 -1
- package/dist/react/components/cache-badge.js +26 -12
- package/dist/react/components/cache-badge.js.map +1 -1
- package/dist/react/components/charts/area-chart-card.d.ts +11 -3
- package/dist/react/components/charts/area-chart-card.d.ts.map +1 -1
- package/dist/react/components/charts/area-chart-card.js +33 -6
- package/dist/react/components/charts/area-chart-card.js.map +1 -1
- package/dist/react/components/charts/bar-chart-card.d.ts +18 -7
- package/dist/react/components/charts/bar-chart-card.d.ts.map +1 -1
- package/dist/react/components/charts/bar-chart-card.js +18 -9
- package/dist/react/components/charts/bar-chart-card.js.map +1 -1
- package/dist/react/components/charts/breakdown-card.d.ts +17 -0
- package/dist/react/components/charts/breakdown-card.d.ts.map +1 -0
- package/dist/react/components/charts/breakdown-card.js +43 -0
- package/dist/react/components/charts/breakdown-card.js.map +1 -0
- package/dist/react/components/charts/chart-card.d.ts +7 -0
- package/dist/react/components/charts/chart-card.d.ts.map +1 -1
- package/dist/react/components/charts/chart-card.js +10 -3
- package/dist/react/components/charts/chart-card.js.map +1 -1
- package/dist/react/components/charts/chart-selection.d.ts +44 -0
- package/dist/react/components/charts/chart-selection.d.ts.map +1 -0
- package/dist/react/components/charts/chart-selection.js +36 -0
- package/dist/react/components/charts/chart-selection.js.map +1 -0
- package/dist/react/components/charts/chart-theme.d.ts +62 -19
- package/dist/react/components/charts/chart-theme.d.ts.map +1 -1
- package/dist/react/components/charts/chart-theme.js +72 -13
- package/dist/react/components/charts/chart-theme.js.map +1 -1
- package/dist/react/components/charts/distribution-chart-card.d.ts +17 -0
- package/dist/react/components/charts/distribution-chart-card.d.ts.map +1 -0
- package/dist/react/components/charts/distribution-chart-card.js +46 -0
- package/dist/react/components/charts/distribution-chart-card.js.map +1 -0
- package/dist/react/components/charts/gauge-card.d.ts +12 -0
- package/dist/react/components/charts/gauge-card.d.ts.map +1 -0
- package/dist/react/components/charts/gauge-card.js +17 -0
- package/dist/react/components/charts/gauge-card.js.map +1 -0
- package/dist/react/components/charts/index.d.ts +1 -0
- package/dist/react/components/charts/index.d.ts.map +1 -1
- package/dist/react/components/charts/index.js +1 -0
- package/dist/react/components/charts/index.js.map +1 -1
- package/dist/react/components/charts/stacked-area-chart-card.d.ts +17 -3
- package/dist/react/components/charts/stacked-area-chart-card.d.ts.map +1 -1
- package/dist/react/components/charts/stacked-area-chart-card.js +31 -8
- package/dist/react/components/charts/stacked-area-chart-card.js.map +1 -1
- package/dist/react/components/entries-table.d.ts.map +1 -1
- package/dist/react/components/entries-table.js +17 -3
- package/dist/react/components/entries-table.js.map +1 -1
- package/dist/react/components/entry-detail.d.ts +2 -0
- package/dist/react/components/entry-detail.d.ts.map +1 -1
- package/dist/react/components/entry-detail.js +186 -20
- package/dist/react/components/entry-detail.js.map +1 -1
- package/dist/react/components/entry-insights.d.ts.map +1 -1
- package/dist/react/components/entry-insights.js +28 -17
- package/dist/react/components/entry-insights.js.map +1 -1
- package/dist/react/components/entry-types.d.ts +29 -0
- package/dist/react/components/entry-types.d.ts.map +1 -1
- package/dist/react/components/entry-types.js +60 -0
- package/dist/react/components/entry-types.js.map +1 -1
- package/dist/react/components/export-json-toolbar.js +2 -2
- package/dist/react/components/export-json-toolbar.js.map +1 -1
- package/dist/react/components/extensions/panel-column-menu.d.ts +19 -0
- package/dist/react/components/extensions/panel-column-menu.d.ts.map +1 -0
- package/dist/react/components/extensions/panel-column-menu.js +47 -0
- package/dist/react/components/extensions/panel-column-menu.js.map +1 -0
- package/dist/react/components/extensions/panel-renderer.d.ts +46 -0
- package/dist/react/components/extensions/panel-renderer.d.ts.map +1 -0
- package/dist/react/components/extensions/panel-renderer.js +122 -0
- package/dist/react/components/extensions/panel-renderer.js.map +1 -0
- package/dist/react/components/extensions/panel-table-header.d.ts +18 -0
- package/dist/react/components/extensions/panel-table-header.d.ts.map +1 -0
- package/dist/react/components/extensions/panel-table-header.js +82 -0
- package/dist/react/components/extensions/panel-table-header.js.map +1 -0
- package/dist/react/components/extensions/panel-table.d.ts +27 -0
- package/dist/react/components/extensions/panel-table.d.ts.map +1 -0
- package/dist/react/components/extensions/panel-table.js +87 -0
- package/dist/react/components/extensions/panel-table.js.map +1 -0
- package/dist/react/components/extensions/stat-card.d.ts +18 -0
- package/dist/react/components/extensions/stat-card.d.ts.map +1 -0
- package/dist/react/components/extensions/stat-card.js +44 -0
- package/dist/react/components/extensions/stat-card.js.map +1 -0
- package/dist/react/components/extensions/table-columns.d.ts +32 -0
- package/dist/react/components/extensions/table-columns.d.ts.map +1 -0
- package/dist/react/components/extensions/table-columns.js +51 -0
- package/dist/react/components/extensions/table-columns.js.map +1 -0
- package/dist/react/components/extensions/table-features.d.ts +47 -0
- package/dist/react/components/extensions/table-features.d.ts.map +1 -0
- package/dist/react/components/extensions/table-features.js +45 -0
- package/dist/react/components/extensions/table-features.js.map +1 -0
- package/dist/react/components/extensions/table-query.d.ts +53 -0
- package/dist/react/components/extensions/table-query.d.ts.map +1 -0
- package/dist/react/components/extensions/table-query.js +51 -0
- package/dist/react/components/extensions/table-query.js.map +1 -0
- package/dist/react/components/flamegraph-view.d.ts +18 -0
- package/dist/react/components/flamegraph-view.d.ts.map +1 -0
- package/dist/react/components/flamegraph-view.js +48 -0
- package/dist/react/components/flamegraph-view.js.map +1 -0
- package/dist/react/components/flamegraph.d.ts +34 -0
- package/dist/react/components/flamegraph.d.ts.map +1 -0
- package/dist/react/components/flamegraph.js +54 -0
- package/dist/react/components/flamegraph.js.map +1 -0
- package/dist/react/components/inertia-badge.d.ts +33 -0
- package/dist/react/components/inertia-badge.d.ts.map +1 -0
- package/dist/react/components/inertia-badge.js +72 -0
- package/dist/react/components/inertia-badge.js.map +1 -0
- package/dist/react/components/inertia-body.d.ts +11 -0
- package/dist/react/components/inertia-body.d.ts.map +1 -0
- package/dist/react/components/inertia-body.js +127 -0
- package/dist/react/components/inertia-body.js.map +1 -0
- package/dist/react/components/official-event.d.ts +16 -0
- package/dist/react/components/official-event.d.ts.map +1 -0
- package/dist/react/components/official-event.js +88 -0
- package/dist/react/components/official-event.js.map +1 -0
- package/dist/react/components/pulse-panel.d.ts.map +1 -1
- package/dist/react/components/pulse-panel.js +6 -6
- package/dist/react/components/pulse-panel.js.map +1 -1
- package/dist/react/components/queues/EnqueueJobForm.d.ts.map +1 -1
- package/dist/react/components/queues/EnqueueJobForm.js +2 -1
- package/dist/react/components/queues/EnqueueJobForm.js.map +1 -1
- package/dist/react/components/queues/JobActions.d.ts.map +1 -1
- package/dist/react/components/queues/JobActions.js +11 -9
- package/dist/react/components/queues/JobActions.js.map +1 -1
- package/dist/react/components/queues/JobDetailDrawer.d.ts.map +1 -1
- package/dist/react/components/queues/JobDetailDrawer.js +8 -13
- package/dist/react/components/queues/JobDetailDrawer.js.map +1 -1
- package/dist/react/components/queues/JobTable.d.ts.map +1 -1
- package/dist/react/components/queues/JobTable.js +0 -0
- package/dist/react/components/queues/JobTable.js.map +1 -1
- package/dist/react/components/queues/QueueList.d.ts.map +1 -1
- package/dist/react/components/queues/QueueList.js +6 -6
- package/dist/react/components/queues/QueueList.js.map +1 -1
- package/dist/react/components/queues/QueueStateTabs.d.ts.map +1 -1
- package/dist/react/components/queues/QueueStateTabs.js +9 -7
- package/dist/react/components/queues/QueueStateTabs.js.map +1 -1
- package/dist/react/components/queues/queue-format.d.ts +5 -1
- package/dist/react/components/queues/queue-format.d.ts.map +1 -1
- package/dist/react/components/queues/queue-format.js +11 -7
- package/dist/react/components/queues/queue-format.js.map +1 -1
- package/dist/react/components/queues-panel.js +1 -1
- package/dist/react/components/queues-panel.js.map +1 -1
- package/dist/react/components/request-timeline.d.ts.map +1 -1
- package/dist/react/components/request-timeline.js +2 -2
- package/dist/react/components/request-timeline.js.map +1 -1
- package/dist/react/components/retention-indicator.d.ts.map +1 -1
- package/dist/react/components/retention-indicator.js +1 -1
- package/dist/react/components/retention-indicator.js.map +1 -1
- package/dist/react/components/sparkline.d.ts.map +1 -1
- package/dist/react/components/sparkline.js +1 -1
- package/dist/react/components/sparkline.js.map +1 -1
- package/dist/react/components/tag-autocomplete.d.ts +21 -4
- package/dist/react/components/tag-autocomplete.d.ts.map +1 -1
- package/dist/react/components/tag-autocomplete.js +57 -29
- package/dist/react/components/tag-autocomplete.js.map +1 -1
- package/dist/react/components/to-csv.d.ts +25 -0
- package/dist/react/components/to-csv.d.ts.map +1 -0
- package/dist/react/components/to-csv.js +78 -0
- package/dist/react/components/to-csv.js.map +1 -0
- package/dist/react/components/user-tag.d.ts +15 -0
- package/dist/react/components/user-tag.d.ts.map +1 -1
- package/dist/react/components/user-tag.js +19 -0
- package/dist/react/components/user-tag.js.map +1 -1
- package/dist/react/components/waterfall-view.d.ts +13 -0
- package/dist/react/components/waterfall-view.d.ts.map +1 -0
- package/dist/react/components/waterfall-view.js +58 -0
- package/dist/react/components/waterfall-view.js.map +1 -0
- package/dist/react/components/window-select.d.ts.map +1 -1
- package/dist/react/components/window-select.js +6 -2
- package/dist/react/components/window-select.js.map +1 -1
- package/dist/react/index.d.ts +7 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +11 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/ui/badge.d.ts +16 -0
- package/dist/react/ui/badge.d.ts.map +1 -0
- package/dist/react/ui/badge.js +28 -0
- package/dist/react/ui/badge.js.map +1 -0
- package/dist/react/ui/button.d.ts +17 -0
- package/dist/react/ui/button.d.ts.map +1 -0
- package/dist/react/ui/button.js +35 -0
- package/dist/react/ui/button.js.map +1 -0
- package/dist/react/ui/chart.d.ts +116 -0
- package/dist/react/ui/chart.d.ts.map +1 -0
- package/dist/react/ui/chart.js +191 -0
- package/dist/react/ui/chart.js.map +1 -0
- package/dist/react/ui/cn.d.ts +8 -0
- package/dist/react/ui/cn.d.ts.map +1 -0
- package/dist/react/ui/cn.js +11 -0
- package/dist/react/ui/cn.js.map +1 -0
- package/dist/react/ui/dialog.d.ts +26 -0
- package/dist/react/ui/dialog.d.ts.map +1 -0
- package/dist/react/ui/dialog.js +40 -0
- package/dist/react/ui/dialog.js.map +1 -0
- package/dist/react/ui/index.d.ts +24 -0
- package/dist/react/ui/index.d.ts.map +1 -0
- package/dist/react/ui/index.js +24 -0
- package/dist/react/ui/index.js.map +1 -0
- package/dist/react/ui/input.d.ts +3 -0
- package/dist/react/ui/input.d.ts.map +1 -0
- package/dist/react/ui/input.js +8 -0
- package/dist/react/ui/input.js.map +1 -0
- package/dist/react/ui/select.d.ts +20 -0
- package/dist/react/ui/select.d.ts.map +1 -0
- package/dist/react/ui/select.js +27 -0
- package/dist/react/ui/select.js.map +1 -0
- package/dist/react/ui/table.d.ts +27 -0
- package/dist/react/ui/table.d.ts.map +1 -0
- package/dist/react/ui/table.js +22 -0
- package/dist/react/ui/table.js.map +1 -0
- package/dist/react/ui/tabs.d.ts +12 -0
- package/dist/react/ui/tabs.d.ts.map +1 -0
- package/dist/react/ui/tabs.js +20 -0
- package/dist/react/ui/tabs.js.map +1 -0
- package/dist/react/ui/tooltip.d.ts +10 -0
- package/dist/react/ui/tooltip.d.ts.map +1 -0
- package/dist/react/ui/tooltip.js +12 -0
- package/dist/react/ui/tooltip.js.map +1 -0
- package/dist/react/use-telescope-queries.d.ts +129 -130
- package/dist/react/use-telescope-queries.d.ts.map +1 -1
- package/dist/react/use-telescope-queries.js +146 -1
- package/dist/react/use-telescope-queries.js.map +1 -1
- package/dist/react/use-telescope-stream.d.ts +10 -0
- package/dist/react/use-telescope-stream.d.ts.map +1 -0
- package/dist/react/use-telescope-stream.js +40 -0
- package/dist/react/use-telescope-stream.js.map +1 -0
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/telescope-ui.module.d.ts +28 -1
- package/dist/server/telescope-ui.module.d.ts.map +1 -1
- package/dist/server/telescope-ui.module.js +42 -4
- package/dist/server/telescope-ui.module.js.map +1 -1
- package/dist/server/telescope-ui.options.d.ts +47 -0
- package/dist/server/telescope-ui.options.d.ts.map +1 -1
- package/dist/server/telescope-ui.options.js.map +1 -1
- package/dist/spa/assets/index-BPSlup7m.js +159 -0
- package/dist/spa/assets/index-DmsmJrlA.css +1 -0
- package/dist/spa/index.html +2 -2
- package/package.json +75 -36
- package/skills/telescope-ui-dashboard/SKILL.md +198 -0
- package/dist/react/components/type-tabs.d.ts +0 -5
- package/dist/react/components/type-tabs.d.ts.map +0 -1
- package/dist/react/components/type-tabs.js +0 -8
- package/dist/react/components/type-tabs.js.map +0 -1
- package/dist/spa/assets/index-CCzTpxj3.css +0 -1
- package/dist/spa/assets/index-w0XTI5OM.js +0 -135
|
@@ -37,4 +37,33 @@ export declare function resolveEntryQuery(typeId: string): {
|
|
|
37
37
|
type?: string;
|
|
38
38
|
tag?: string;
|
|
39
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Which nav/tab type ids to show given the server's registered watcher list.
|
|
42
|
+
*
|
|
43
|
+
* `/api/meta.watchers` carries EntryType strings (e.g. `['request',
|
|
44
|
+
* 'exception', 'query', 'job', 'redis']`) — the `type` field of each
|
|
45
|
+
* registered watcher, see the core registrar. We hide a type only when meta
|
|
46
|
+
* POSITIVELY says its watcher is absent:
|
|
47
|
+
* - `watchers === undefined` → meta hasn't loaded or is from an older server
|
|
48
|
+
* that predates the field; show everything (no flash-of-hidden-nav, and old
|
|
49
|
+
* servers keep working).
|
|
50
|
+
* - otherwise → show a type when it's always-visible, its id is in the watcher
|
|
51
|
+
* set, or its backing query type is (so `schedule` follows `job`).
|
|
52
|
+
*
|
|
53
|
+
* Pure and order-preserving (keeps the canonical `ENTRY_TYPES` order) so it's
|
|
54
|
+
* trivially unit-testable.
|
|
55
|
+
*/
|
|
56
|
+
/**
|
|
57
|
+
* Built-in types plus extension-contributed ones (from `/api/meta.entryTypes`).
|
|
58
|
+
* Built-ins win on id collision so an extension can't shadow a core type's
|
|
59
|
+
* label/dot. Extension types lack the optional `query` override (that's only
|
|
60
|
+
* for the few built-ins like `schedule`), which is fine — `EntryTypeDef.query`
|
|
61
|
+
* is optional. Keeps built-ins first, then extras, so the nav order is stable.
|
|
62
|
+
*/
|
|
63
|
+
export declare function allEntryTypes(extension: readonly {
|
|
64
|
+
id: string;
|
|
65
|
+
label: string;
|
|
66
|
+
dot: string;
|
|
67
|
+
}[] | undefined): EntryTypeDef[];
|
|
68
|
+
export declare function visibleEntryTypes(types: readonly EntryTypeDef[], watchers: readonly string[] | undefined): EntryTypeDef[];
|
|
40
69
|
//# sourceMappingURL=entry-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-types.d.ts","sourceRoot":"","sources":["../../../src/react/components/entry-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,gEAAgE;IAChE,EAAE,EAAE,MAAM,CAAC;IACX,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,KAAK,CAAC,EAAE;QAAE,IA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C9B,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACtC,YAAY,EAAE,CAUhB"}
|
|
@@ -2,7 +2,9 @@ export const ENTRY_TYPES = [
|
|
|
2
2
|
{ id: 'request', label: 'Requests', dot: 'bg-emerald-400' },
|
|
3
3
|
{ id: 'query', label: 'Queries', dot: 'bg-sky-400' },
|
|
4
4
|
{ id: 'exception', label: 'Exceptions', dot: 'bg-red-400' },
|
|
5
|
+
{ id: 'client_exception', label: 'Client errors', dot: 'bg-orange-500' },
|
|
5
6
|
{ id: 'job', label: 'Jobs', dot: 'bg-violet-400' },
|
|
7
|
+
{ id: 'durable', label: 'Workflows', dot: 'bg-purple-400' },
|
|
6
8
|
{ id: 'mail', label: 'Mail', dot: 'bg-pink-400' },
|
|
7
9
|
{ id: 'cache', label: 'Cache', dot: 'bg-teal-400' },
|
|
8
10
|
{
|
|
@@ -17,6 +19,11 @@ export const ENTRY_TYPES = [
|
|
|
17
19
|
{ id: 'log', label: 'Logs', dot: 'bg-zinc-400' },
|
|
18
20
|
{ id: 'model', label: 'Models', dot: 'bg-lime-400' },
|
|
19
21
|
{ id: 'redis', label: 'Redis', dot: 'bg-rose-400' },
|
|
22
|
+
{ id: 'inertia', label: 'Inertia', dot: 'bg-cyan-400' },
|
|
23
|
+
// NestJS first-party channels, recorded by @dudousxd/nestjs-telescope-official.
|
|
24
|
+
{ id: 'resilience', label: 'Resilience', dot: 'bg-yellow-400' },
|
|
25
|
+
{ id: 'workflow', label: 'Nest workflows', dot: 'bg-purple-300' },
|
|
26
|
+
{ id: 'auth', label: 'Auth', dot: 'bg-red-300' },
|
|
20
27
|
];
|
|
21
28
|
const FALLBACK_DOT = 'bg-zinc-500';
|
|
22
29
|
const BY_ID = Object.fromEntries(ENTRY_TYPES.map((type) => [type.id, type]));
|
|
@@ -41,4 +48,57 @@ export function isKnownType(typeId) {
|
|
|
41
48
|
export function resolveEntryQuery(typeId) {
|
|
42
49
|
return BY_ID[typeId]?.query ?? { type: typeId };
|
|
43
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Entry types that are ALWAYS captured regardless of which watchers a host
|
|
53
|
+
* registers, so their nav items must always show. `request` and `exception`
|
|
54
|
+
* are wired unconditionally by the core registrar (see
|
|
55
|
+
* `telescope-watcher-registrar.service.ts`, which seeds `[Request, Exception]`
|
|
56
|
+
* before appending registered watchers), so `/api/meta.watchers` always lists
|
|
57
|
+
* them — but we hard-code them here too so the nav stays correct even if a
|
|
58
|
+
* future server drops them from the list. `schedule` rides on the `job`
|
|
59
|
+
* watcher (scheduled runs are tagged `job` entries), so it's visible whenever
|
|
60
|
+
* `job` is.
|
|
61
|
+
*/
|
|
62
|
+
const ALWAYS_VISIBLE_TYPE_IDS = new Set(['request', 'exception']);
|
|
63
|
+
/**
|
|
64
|
+
* Which nav/tab type ids to show given the server's registered watcher list.
|
|
65
|
+
*
|
|
66
|
+
* `/api/meta.watchers` carries EntryType strings (e.g. `['request',
|
|
67
|
+
* 'exception', 'query', 'job', 'redis']`) — the `type` field of each
|
|
68
|
+
* registered watcher, see the core registrar. We hide a type only when meta
|
|
69
|
+
* POSITIVELY says its watcher is absent:
|
|
70
|
+
* - `watchers === undefined` → meta hasn't loaded or is from an older server
|
|
71
|
+
* that predates the field; show everything (no flash-of-hidden-nav, and old
|
|
72
|
+
* servers keep working).
|
|
73
|
+
* - otherwise → show a type when it's always-visible, its id is in the watcher
|
|
74
|
+
* set, or its backing query type is (so `schedule` follows `job`).
|
|
75
|
+
*
|
|
76
|
+
* Pure and order-preserving (keeps the canonical `ENTRY_TYPES` order) so it's
|
|
77
|
+
* trivially unit-testable.
|
|
78
|
+
*/
|
|
79
|
+
/**
|
|
80
|
+
* Built-in types plus extension-contributed ones (from `/api/meta.entryTypes`).
|
|
81
|
+
* Built-ins win on id collision so an extension can't shadow a core type's
|
|
82
|
+
* label/dot. Extension types lack the optional `query` override (that's only
|
|
83
|
+
* for the few built-ins like `schedule`), which is fine — `EntryTypeDef.query`
|
|
84
|
+
* is optional. Keeps built-ins first, then extras, so the nav order is stable.
|
|
85
|
+
*/
|
|
86
|
+
export function allEntryTypes(extension) {
|
|
87
|
+
const extras = (extension ?? []).map((e) => ({ id: e.id, label: e.label, dot: e.dot }));
|
|
88
|
+
const builtinIds = new Set(ENTRY_TYPES.map((t) => t.id));
|
|
89
|
+
return [...ENTRY_TYPES, ...extras.filter((e) => !builtinIds.has(e.id))];
|
|
90
|
+
}
|
|
91
|
+
export function visibleEntryTypes(types, watchers) {
|
|
92
|
+
if (watchers === undefined)
|
|
93
|
+
return [...types];
|
|
94
|
+
const registered = new Set(watchers);
|
|
95
|
+
return types.filter((type) => {
|
|
96
|
+
if (ALWAYS_VISIBLE_TYPE_IDS.has(type.id))
|
|
97
|
+
return true;
|
|
98
|
+
// A type with a `query` override (e.g. schedule → job) is backed by that
|
|
99
|
+
// query type's watcher, not its own id.
|
|
100
|
+
const backingType = type.query?.type ?? type.id;
|
|
101
|
+
return registered.has(type.id) || registered.has(backingType);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
44
104
|
//# sourceMappingURL=entry-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-types.js","sourceRoot":"","sources":["../../../src/react/components/entry-types.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,MAAM,WAAW,GAAmB;IACzC,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,gBAAgB,EAAE;IAC3D,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,YAAY,EAAE;IACpD,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY,EAAE;IAC3D,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,eAAe,EAAE;IAClD,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GA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,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACxF,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACzD,OAAO,CAAC,GAAG,WAAW,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,KAA8B,EAC9B,QAAuC;IAEvC,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;IAC9C,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;IACrC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3B,IAAI,uBAAuB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;QACtD,yEAAyE;QACzE,wCAAwC;QACxC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;QAChD,OAAO,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { copyJson, downloadJson } from './export-json.js';
|
|
4
|
-
const BUTTON_CLASS = 'rounded border border-
|
|
5
|
-
'transition-colors hover:border-
|
|
4
|
+
const BUTTON_CLASS = 'rounded border border-line bg-panel px-2.5 py-1 text-[11px] text-foreground ' +
|
|
5
|
+
'transition-colors hover:border-line hover:bg-panel-2 hover:text-foreground';
|
|
6
6
|
/**
|
|
7
7
|
* A small toolbar exposing "Copy JSON" / "Download JSON" actions for a value.
|
|
8
8
|
* Used on the entry-detail page to export the full `EntryWithBatch`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-json-toolbar.js","sourceRoot":"","sources":["../../../src/react/components/export-json-toolbar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE1D,MAAM,YAAY,GAChB,
|
|
1
|
+
{"version":3,"file":"export-json-toolbar.js","sourceRoot":"","sources":["../../../src/react/components/export-json-toolbar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE1D,MAAM,YAAY,GAChB,8EAA8E;IAC9E,4EAA4E,CAAC;AAE/E;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,KAAK,EACL,QAAQ,GAC6B;IACrC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5C,KAAK,UAAU,UAAU;QACvB,MAAM,EAAE,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC;QACjC,IAAI,EAAE,EAAE,CAAC;YACP,SAAS,CAAC,IAAI,CAAC,CAAC;YAChB,UAAU,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAED,OAAO,CACL,eAAK,SAAS,EAAC,yBAAyB,aACtC,iBAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,YAC/D,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,GACzB,EACT,iBAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,SAAS,EAAE,YAAY,8BAElF,IACL,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type JSX } from 'react';
|
|
2
|
+
import type { PanelColumn } from './table-features.js';
|
|
3
|
+
/**
|
|
4
|
+
* The "Columns" menu on a table panel: one toggle per column that declared
|
|
5
|
+
* `hideable`, driven by v9's `columnVisibilityFeature`.
|
|
6
|
+
*
|
|
7
|
+
* Built from the vendored `Button` inside a plain positioned `div` rather than a
|
|
8
|
+
* vendored menu primitive, because there isn't one — `src/react/ui/` vendors
|
|
9
|
+
* Table, Button, Input, Select, Dialog, Tabs, Tooltip and Badge, and a menu is a
|
|
10
|
+
* large Base UI surface to vendor for a list of checkboxes. Every *control* here
|
|
11
|
+
* is still the vendored Button; only the container is bare markup.
|
|
12
|
+
*
|
|
13
|
+
* Renders nothing at all when no column opted in, which is what keeps every
|
|
14
|
+
* dashboard that predates this feature rendering exactly as it did.
|
|
15
|
+
*/
|
|
16
|
+
export declare function PanelColumnMenu({ columns }: {
|
|
17
|
+
columns: PanelColumn[];
|
|
18
|
+
}): JSX.Element | null;
|
|
19
|
+
//# sourceMappingURL=panel-column-menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel-column-menu.d.ts","sourceRoot":"","sources":["../../../../src/react/components/extensions/panel-column-menu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAA+B,MAAM,OAAO,CAAC;AAE9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,WAAW,EAAE,CAAA;CAAE,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAiE3F"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { Button } from '../../ui/button.js';
|
|
4
|
+
/**
|
|
5
|
+
* The "Columns" menu on a table panel: one toggle per column that declared
|
|
6
|
+
* `hideable`, driven by v9's `columnVisibilityFeature`.
|
|
7
|
+
*
|
|
8
|
+
* Built from the vendored `Button` inside a plain positioned `div` rather than a
|
|
9
|
+
* vendored menu primitive, because there isn't one — `src/react/ui/` vendors
|
|
10
|
+
* Table, Button, Input, Select, Dialog, Tabs, Tooltip and Badge, and a menu is a
|
|
11
|
+
* large Base UI surface to vendor for a list of checkboxes. Every *control* here
|
|
12
|
+
* is still the vendored Button; only the container is bare markup.
|
|
13
|
+
*
|
|
14
|
+
* Renders nothing at all when no column opted in, which is what keeps every
|
|
15
|
+
* dashboard that predates this feature rendering exactly as it did.
|
|
16
|
+
*/
|
|
17
|
+
export function PanelColumnMenu({ columns }) {
|
|
18
|
+
const [open, setOpen] = useState(false);
|
|
19
|
+
const root = useRef(null);
|
|
20
|
+
const hideable = columns.filter((column) => column.getCanHide());
|
|
21
|
+
// Click-away and Escape. Without these the menu is a trap: it sits over the
|
|
22
|
+
// panel below it and the only way to dismiss it is to find the trigger again.
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!open)
|
|
25
|
+
return;
|
|
26
|
+
function onPointerDown(event) {
|
|
27
|
+
if (event.target instanceof Node && root.current?.contains(event.target))
|
|
28
|
+
return;
|
|
29
|
+
setOpen(false);
|
|
30
|
+
}
|
|
31
|
+
function onKeyDown(event) {
|
|
32
|
+
if (event.key === 'Escape')
|
|
33
|
+
setOpen(false);
|
|
34
|
+
}
|
|
35
|
+
document.addEventListener('mousedown', onPointerDown);
|
|
36
|
+
document.addEventListener('keydown', onKeyDown);
|
|
37
|
+
return () => {
|
|
38
|
+
document.removeEventListener('mousedown', onPointerDown);
|
|
39
|
+
document.removeEventListener('keydown', onKeyDown);
|
|
40
|
+
};
|
|
41
|
+
}, [open]);
|
|
42
|
+
if (hideable.length === 0)
|
|
43
|
+
return null;
|
|
44
|
+
const hiddenCount = hideable.filter((column) => !column.getIsVisible()).length;
|
|
45
|
+
return (_jsxs("div", { className: "relative", ref: root, children: [_jsxs(Button, { variant: "ghost", size: "xs", "aria-haspopup": "menu", "aria-expanded": open, onClick: () => setOpen((previous) => !previous), className: "px-1.5 text-muted-foreground", children: ["Columns", hiddenCount > 0 ? ` (${hideable.length - hiddenCount}/${hideable.length})` : ''] }), open && (_jsx("div", { role: "menu", className: "absolute right-0 z-20 mt-1 min-w-[10rem] rounded border border-line bg-popover p-1 shadow-lg", children: hideable.map((column) => (_jsxs(Button, { role: "menuitemcheckbox", "aria-checked": column.getIsVisible(), variant: "ghost", size: "xs", onClick: () => column.toggleVisibility(), className: "w-full justify-start gap-2 normal-case tracking-normal", children: [_jsx("span", { "aria-hidden": "true", className: column.getIsVisible() ? '' : 'opacity-30', children: column.getIsVisible() ? '☑' : '☐' }), typeof column.columnDef.header === 'string' ? column.columnDef.header : column.id] }, column.id))) }))] }));
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=panel-column-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel-column-menu.js","sourceRoot":"","sources":["../../../../src/react/components/extensions/panel-column-menu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAY,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5C;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,eAAe,CAAC,EAAE,OAAO,EAA8B;IACrE,MAAM,CAAC,IAAI,EAAE,OAAO,CAA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import type { ChartSelection } from '../charts/chart-selection.js';
|
|
4
|
+
import type { TableFilterState, TableSortState } from './table-query.js';
|
|
5
|
+
/** Pure view: render a panel from already-resolved data. */
|
|
6
|
+
export declare function PanelView({ panel, data, onPageChange, requestedPage, sort, onSortChange, filters, onFiltersChange, onSelect, }: {
|
|
7
|
+
panel: Panel;
|
|
8
|
+
data: unknown;
|
|
9
|
+
/** Paged tables only: called with the requested 1-based page on prev/next. */
|
|
10
|
+
onPageChange?: (page: number) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Paged tables only: the page the caller has ASKED for, which takes precedence over the page the
|
|
13
|
+
* response reports.
|
|
14
|
+
*
|
|
15
|
+
* The two are normally the same, and when they are this changes nothing. They diverge when a
|
|
16
|
+
* provider ignores `query.page` — and driving the control off the response there does not merely
|
|
17
|
+
* show a stale number, it wedges the pager permanently: the handler computes `page + 1` from the
|
|
18
|
+
* pinned page, so the second click re-requests the page the caller is already on, the state does
|
|
19
|
+
* not change, nothing re-renders, and neither button ever does anything again short of a reload.
|
|
20
|
+
* That is a real incident (`@dudousxd/nestjs-agent-telescope`'s providers read `?page=2` as a
|
|
21
|
+
* string and answered page 1 for every request).
|
|
22
|
+
*
|
|
23
|
+
* Preferring the requested page keeps every click moving, so the worst a broken provider can do
|
|
24
|
+
* is fail to change the rows — visible, and recoverable with Prev.
|
|
25
|
+
*/
|
|
26
|
+
requestedPage?: number | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Tables only. Sort and filter state live with the caller for the same reason
|
|
29
|
+
* `page` does: changing either has to re-resolve the provider, which is the
|
|
30
|
+
* caller's query, not this view's. Absent means "unsorted / unfiltered", which
|
|
31
|
+
* is exactly what a panel declaring no `sortable` or `filterable` column
|
|
32
|
+
* renders with.
|
|
33
|
+
*/
|
|
34
|
+
sort?: TableSortState | undefined;
|
|
35
|
+
onSortChange?: (sort: TableSortState | undefined) => void;
|
|
36
|
+
filters?: TableFilterState | undefined;
|
|
37
|
+
onFiltersChange?: (filters: TableFilterState) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Drill-down: called when a chart-shaped panel is clicked. The view stays pure —
|
|
40
|
+
* it reports what was clicked and the caller decides what that filters. Omit it
|
|
41
|
+
* and no chart gets a click handler, which is the behaviour of every panel that
|
|
42
|
+
* does not declare `drilldown`.
|
|
43
|
+
*/
|
|
44
|
+
onSelect?: (selection: ChartSelection) => void;
|
|
45
|
+
}): JSX.Element | null;
|
|
46
|
+
//# sourceMappingURL=panel-renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel-renderer.d.ts","sourceRoot":"","sources":["../../../../src/react/components/extensions/panel-renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAKtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAOnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAuGzE,4DAA4D;AAC5D,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,aAAa,EACb,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,eAAe,EACf,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,8EAA8E;IAC9E,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC;;;;;;;;;;;;;;OAcG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IAClC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,KAAK,IAAI,CAAC;IAC1D,OAAO,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACvC,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACtD;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,KAAK,IAAI,CAAC;CAChD,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAkJrB"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from '../../ui/button.js';
|
|
3
|
+
import { AreaChartCard } from '../charts/area-chart-card.js';
|
|
4
|
+
import { BarChartCard } from '../charts/bar-chart-card.js';
|
|
5
|
+
import { BreakdownCard } from '../charts/breakdown-card.js';
|
|
6
|
+
import { DistributionChartCard } from '../charts/distribution-chart-card.js';
|
|
7
|
+
import { GaugeCard } from '../charts/gauge-card.js';
|
|
8
|
+
import { StackedAreaChartCard } from '../charts/stacked-area-chart-card.js';
|
|
9
|
+
import { PanelTable } from './panel-table.js';
|
|
10
|
+
import { StatCard } from './stat-card.js';
|
|
11
|
+
function formatStat(value, format) {
|
|
12
|
+
if (format === 'percent')
|
|
13
|
+
return `${Math.round(value * 100)}%`;
|
|
14
|
+
if (format === 'duration')
|
|
15
|
+
return value >= 1000 ? `${(value / 1000).toFixed(1)}s` : `${Math.round(value)}ms`;
|
|
16
|
+
if (format === 'rate')
|
|
17
|
+
return `${new Intl.NumberFormat().format(Math.round(value))}/hr`;
|
|
18
|
+
return new Intl.NumberFormat().format(value);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Narrows a table provider's resolved payload to its rows.
|
|
22
|
+
*
|
|
23
|
+
* A guard rather than a cast: `data` is literally whatever came back over HTTP
|
|
24
|
+
* from an extension nobody in this package controls, and every field has a safe
|
|
25
|
+
* absent behaviour — a provider that returns `null`, or `{ rows: 'soon' }` while
|
|
26
|
+
* it is being written, renders the empty state instead of throwing inside the
|
|
27
|
+
* table instance where the stack says nothing about which panel is at fault.
|
|
28
|
+
*/
|
|
29
|
+
function readPanelRows(data) {
|
|
30
|
+
if (typeof data !== 'object' || data === null || !('rows' in data))
|
|
31
|
+
return [];
|
|
32
|
+
const rows = data.rows;
|
|
33
|
+
if (!Array.isArray(rows))
|
|
34
|
+
return [];
|
|
35
|
+
return rows.filter((row) => typeof row === 'object' && row !== null);
|
|
36
|
+
}
|
|
37
|
+
/** Reads a number off a resolved payload, or `undefined` when it is missing or
|
|
38
|
+
* isn't one — `NaN` reaching `Math.ceil` is a "Page 1 of NaN" indicator. */
|
|
39
|
+
function readNumber(data, key) {
|
|
40
|
+
if (typeof data !== 'object' || data === null || !(key in data))
|
|
41
|
+
return undefined;
|
|
42
|
+
const value = Reflect.get(data, key);
|
|
43
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
|
|
44
|
+
}
|
|
45
|
+
/** The paged-table payload — `{ rows, total, page, limit }` — with each field
|
|
46
|
+
* falling back to what a bare `{ rows }` implies. */
|
|
47
|
+
function readPagedTable(data) {
|
|
48
|
+
const rows = readPanelRows(data);
|
|
49
|
+
return {
|
|
50
|
+
rows,
|
|
51
|
+
total: readNumber(data, 'total') ?? rows.length,
|
|
52
|
+
page: readNumber(data, 'page') ?? 1,
|
|
53
|
+
limit: readNumber(data, 'limit') ?? 0,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** Shared empty-state card so a provider that resolves with no rows reads as
|
|
57
|
+
* "nothing happened in this window" rather than a blank/broken panel. */
|
|
58
|
+
function EmptyPanel({ title }) {
|
|
59
|
+
return (_jsxs("div", { className: "rounded-lg border border-line bg-panel/40", children: [_jsx("p", { className: "border-b border-line px-4 py-2 text-xs font-medium text-foreground", children: title }), _jsx("p", { className: "px-4 py-8 text-center text-xs text-muted-foreground", children: "No data in this window." })] }));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Prev/next + "page X of Y" controls for a paged table panel. Purely
|
|
63
|
+
* presentational — the caller (the dashboard's `BoundPanel`) owns the actual
|
|
64
|
+
* page state and re-resolves the provider; this just reports intent.
|
|
65
|
+
*/
|
|
66
|
+
function PagerControls({ page, totalPages, onPageChange, }) {
|
|
67
|
+
return (_jsxs("div", { className: "flex items-center gap-2 text-[10px] text-muted-foreground", children: [_jsx(Button, { variant: "outline", size: "xs", disabled: page <= 1, onClick: () => onPageChange?.(page - 1), className: "px-1.5 text-muted-foreground", children: "Prev" }), _jsxs("span", { children: ["Page ", page, " of ", totalPages] }), _jsx(Button, { variant: "outline", size: "xs", disabled: page >= totalPages, onClick: () => onPageChange?.(page + 1), className: "px-1.5 text-muted-foreground", children: "Next" })] }));
|
|
68
|
+
}
|
|
69
|
+
/** Pure view: render a panel from already-resolved data. */
|
|
70
|
+
export function PanelView({ panel, data, onPageChange, requestedPage, sort, onSortChange, filters, onFiltersChange, onSelect, }) {
|
|
71
|
+
// Spread rather than passed: under `exactOptionalPropertyTypes` an explicit
|
|
72
|
+
// `undefined` is not assignable to the cards' optional handlers.
|
|
73
|
+
const selectProps = onSelect ? { onSelect } : {};
|
|
74
|
+
switch (panel.kind) {
|
|
75
|
+
case 'stat': {
|
|
76
|
+
const d = (data ?? {});
|
|
77
|
+
return (_jsx(StatCard, { label: panel.title, value: formatStat(d.value ?? 0, panel.format), ...(d.value !== undefined ? { currentValue: d.value } : {}), ...(d.delta !== undefined ? { delta: d.delta } : {}), ...(d.deltaLabel ? { deltaLabel: d.deltaLabel } : {}), ...(panel.spark && d.spark ? { spark: d.spark } : {}), ...(panel.thresholds ? { thresholds: panel.thresholds } : {}), ...(panel.accent ? { accent: panel.accent } : {}) }));
|
|
78
|
+
}
|
|
79
|
+
case 'distribution': {
|
|
80
|
+
const d = (data ?? {});
|
|
81
|
+
return (_jsx(DistributionChartCard, { title: panel.title, buckets: d.buckets ?? [], ...(d.p50 !== undefined ? { p50: d.p50 } : {}), ...(d.p95 !== undefined ? { p95: d.p95 } : {}), ...(d.p99 !== undefined ? { p99: d.p99 } : {}), ...selectProps }));
|
|
82
|
+
}
|
|
83
|
+
case 'gauge': {
|
|
84
|
+
const d = (data ?? {});
|
|
85
|
+
return (_jsx(GaugeCard, { title: panel.title, value: d.value ?? 0, ...(panel.min !== undefined ? { min: panel.min } : {}), ...(panel.max !== undefined ? { max: panel.max } : {}) }));
|
|
86
|
+
}
|
|
87
|
+
case 'breakdown': {
|
|
88
|
+
const d = (data ?? {});
|
|
89
|
+
return (_jsx(BreakdownCard, { title: panel.title, segments: d.segments ?? [], ...(panel.style ? { style: panel.style } : {}), ...selectProps }));
|
|
90
|
+
}
|
|
91
|
+
case 'timeseries': {
|
|
92
|
+
const rows = data?.rows ?? [];
|
|
93
|
+
const primary = panel.series[0];
|
|
94
|
+
return panel.style === 'stacked' ? (_jsx(StackedAreaChartCard, { title: panel.title, data: rows, series: panel.series, ...selectProps })) : (_jsx(AreaChartCard, { title: panel.title, data: rows.map((r) => ({
|
|
95
|
+
label: r.label,
|
|
96
|
+
value: primary ? Number(r[primary] ?? 0) : 0,
|
|
97
|
+
})), ...selectProps }));
|
|
98
|
+
}
|
|
99
|
+
case 'topN': {
|
|
100
|
+
const items = data?.items ?? [];
|
|
101
|
+
const limited = panel.limit ? items.slice(0, panel.limit) : items;
|
|
102
|
+
if (limited.length === 0)
|
|
103
|
+
return _jsx(EmptyPanel, { title: panel.title });
|
|
104
|
+
return (_jsx(BarChartCard, { title: panel.title, data: limited, horizontal: true, truncateLabel: 32, ...selectProps }));
|
|
105
|
+
}
|
|
106
|
+
case 'table': {
|
|
107
|
+
// One `<PanelTable>` for both variants — the paged one only adds the pager
|
|
108
|
+
// to the card header and lets the rows scroll under a pinned header, since
|
|
109
|
+
// it is the variant whose row count is unbounded from the panel's side.
|
|
110
|
+
const table = (_jsx(PanelTable, { columns: panel.columns, rows: readPanelRows(data), scrolls: panel.paged === true, sort: sort, ...(onSortChange ? { onSortChange } : {}), filters: filters, ...(onFiltersChange ? { onFiltersChange } : {}) }));
|
|
111
|
+
if (panel.paged) {
|
|
112
|
+
const { rows, total, page, limit } = readPagedTable(data);
|
|
113
|
+
const totalPages = Math.max(1, Math.ceil(total / (limit || rows.length || 1)));
|
|
114
|
+
return (_jsxs("div", { className: "rounded-lg border border-line bg-panel/40", children: [_jsxs("div", { className: "flex items-center justify-between border-b border-line px-4 py-2", children: [_jsx("p", { className: "text-xs font-medium text-foreground", children: panel.title }), _jsx(PagerControls, { page: requestedPage ?? page, totalPages: totalPages, ...(onPageChange ? { onPageChange } : {}) })] }), table] }));
|
|
115
|
+
}
|
|
116
|
+
return (_jsxs("div", { className: "rounded-lg border border-line bg-panel/40", children: [_jsx("p", { className: "border-b border-line px-4 py-2 text-xs font-medium text-foreground", children: panel.title }), table] }));
|
|
117
|
+
}
|
|
118
|
+
default:
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=panel-renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel-renderer.js","sourceRoot":"","sources":["../../../../src/react/components/extensions/panel-renderer.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI1C,SAAS,UAAU,CAAC,KAAa,EAAE,MAAmD;IACpF,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,GAAG,IAAI,C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CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC/E,OAAO,CACL,eAAK,SAAS,EAAC,2CAA2C,aACxD,eAAK,SAAS,EAAC,kEAAkE,aAC/E,YAAG,SAAS,EAAC,qCAAqC,YAAE,KAAK,CAAC,KAAK,GAAK,EACpE,KAAC,aAAa,IACZ,IAAI,EAAE,aAAa,IAAI,IAAI,EAC3B,UAAU,EAAE,UAAU,KAClB,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAC1C,IACE,EACL,KAAK,IACF,CACP,CAAC;YACJ,CAAC;YACD,OAAO,CACL,eAAK,SAAS,EAAC,2CAA2C,aACxD,YAAG,SAAS,EAAC,oEAAoE,YAC9E,KAAK,CAAC,KAAK,GACV,EACH,KAAK,IACF,CACP,CAAC;QACJ,CAAC;QACD;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type JSX } from 'react';
|
|
2
|
+
import { type PanelTableInstance } from './table-features.js';
|
|
3
|
+
/**
|
|
4
|
+
* A table panel's `<thead>`: the label row, plus a filter row when at least one
|
|
5
|
+
* column declared `filterable`.
|
|
6
|
+
*
|
|
7
|
+
* `sticky` is passed only for paged tables, whose body is height-capped and
|
|
8
|
+
* scrolls; the classes go on the `<th>`s rather than the `<thead>` because a
|
|
9
|
+
* `border-collapse: collapse` table (which the vendored `Table` is) does not
|
|
10
|
+
* honour `position: sticky` on a section element in every browser.
|
|
11
|
+
*/
|
|
12
|
+
export declare function PanelTableHeader({ table, sticky, menu, }: {
|
|
13
|
+
table: PanelTableInstance;
|
|
14
|
+
sticky: boolean;
|
|
15
|
+
/** The column-visibility menu, rendered in its own trailing cell when present. */
|
|
16
|
+
menu?: JSX.Element | null;
|
|
17
|
+
}): JSX.Element;
|
|
18
|
+
//# sourceMappingURL=panel-table-header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel-table-header.d.ts","sourceRoot":"","sources":["../../../../src/react/components/extensions/panel-table-header.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAuB,MAAM,OAAO,CAAC;AAItD,OAAO,EAAoB,KAAK,kBAAkB,EAAc,MAAM,qBAAqB,CAAC;AA4F5F;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,MAAM,EACN,IAAI,GACL,EAAE;IACD,KAAK,EAAE,kBAAkB,CAAC;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,kFAAkF;IAClF,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;CAC3B,GAAG,GAAG,CAAC,OAAO,CAyCd"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Button } from '../../ui/button.js';
|
|
4
|
+
import { Input } from '../../ui/input.js';
|
|
5
|
+
import { TableHead, TableHeader, TableRow } from '../../ui/table.js';
|
|
6
|
+
import { flexRender } from './table-features.js';
|
|
7
|
+
/** The three sort states a header can be in, as a glyph. `↕` is the "you can
|
|
8
|
+
* sort by this" affordance, dimmed so it reads as available rather than active. */
|
|
9
|
+
function SortIndicator({ direction }) {
|
|
10
|
+
if (direction === 'asc')
|
|
11
|
+
return _jsx("span", { "aria-hidden": "true", children: "\u2191" });
|
|
12
|
+
if (direction === 'desc')
|
|
13
|
+
return _jsx("span", { "aria-hidden": "true", children: "\u2193" });
|
|
14
|
+
return (_jsx("span", { "aria-hidden": "true", className: "opacity-30", children: "\u2195" }));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A sortable column's header: the vendored ghost `Button` plus a direction
|
|
18
|
+
* glyph, wired to TanStack's own `getToggleSortingHandler()` so the
|
|
19
|
+
* ascending → descending → unsorted cycle is the library's and not a
|
|
20
|
+
* hand-rolled one that drifts from it.
|
|
21
|
+
*
|
|
22
|
+
* `aria-sort` goes on the `<th>` rather than the button — that is where assistive
|
|
23
|
+
* tech looks for it, and it is the only thing that tells a screen-reader user
|
|
24
|
+
* the table is sorted at all, since the direction itself is a decorative glyph.
|
|
25
|
+
*/
|
|
26
|
+
function SortableHead({ header, className, }) {
|
|
27
|
+
const direction = header.column.getIsSorted();
|
|
28
|
+
const label = flexRender(header.column.columnDef.header, header.getContext());
|
|
29
|
+
return (_jsx(TableHead, { className: `whitespace-nowrap p-0 ${className}`, "aria-sort": direction === 'asc' ? 'ascending' : direction === 'desc' ? 'descending' : 'none', children: _jsxs(Button, { variant: "ghost", size: "xs", onClick: header.column.getToggleSortingHandler(), className: "w-full justify-start gap-1 px-3 py-2 font-normal", children: [label, _jsx(SortIndicator, { direction: direction })] }) }));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A filter box for one column.
|
|
33
|
+
*
|
|
34
|
+
* Draft state is local and only committed on Enter or blur. A live-as-you-type
|
|
35
|
+
* filter looks nicer and is the wrong shape here: every keystroke would be a
|
|
36
|
+
* fresh provider resolve, i.e. a query against whatever store the extension
|
|
37
|
+
* sits on, for a string the user has not finished typing. Committing is also
|
|
38
|
+
* what makes "clear the box" mean "drop the filter" rather than "match the
|
|
39
|
+
* empty string".
|
|
40
|
+
*/
|
|
41
|
+
function ColumnFilterInput({ header }) {
|
|
42
|
+
const applied = header.column.getFilterValue();
|
|
43
|
+
const appliedText = typeof applied === 'string' ? applied : '';
|
|
44
|
+
const [draft, setDraft] = useState(appliedText);
|
|
45
|
+
// The applied value can change underneath the box — another panel control
|
|
46
|
+
// resets it, or the dashboard remounts with a different filter. Re-seed the
|
|
47
|
+
// draft from it, or the box would keep showing a filter that is no longer on.
|
|
48
|
+
useEffect(() => setDraft(appliedText), [appliedText]);
|
|
49
|
+
const commit = () => {
|
|
50
|
+
if (draft === appliedText)
|
|
51
|
+
return;
|
|
52
|
+
header.column.setFilterValue(draft);
|
|
53
|
+
};
|
|
54
|
+
return (_jsx(Input, { value: draft, "aria-label": `Filter by ${header.column.id}`, placeholder: "Filter\u2026", className: "w-full py-0.5", onChange: (event) => setDraft(event.target.value), onBlur: commit, onKeyDown: (event) => {
|
|
55
|
+
if (event.key === 'Enter')
|
|
56
|
+
commit();
|
|
57
|
+
if (event.key === 'Escape')
|
|
58
|
+
setDraft(appliedText);
|
|
59
|
+
} }));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A table panel's `<thead>`: the label row, plus a filter row when at least one
|
|
63
|
+
* column declared `filterable`.
|
|
64
|
+
*
|
|
65
|
+
* `sticky` is passed only for paged tables, whose body is height-capped and
|
|
66
|
+
* scrolls; the classes go on the `<th>`s rather than the `<thead>` because a
|
|
67
|
+
* `border-collapse: collapse` table (which the vendored `Table` is) does not
|
|
68
|
+
* honour `position: sticky` on a section element in every browser.
|
|
69
|
+
*/
|
|
70
|
+
export function PanelTableHeader({ table, sticky, menu, }) {
|
|
71
|
+
const headers = table.getHeaderGroups().at(-1)?.headers ?? [];
|
|
72
|
+
const anyFilterable = headers.some((header) => header.column.getCanFilter());
|
|
73
|
+
// The filter row sticks BELOW the label row, hence the second offset — both
|
|
74
|
+
// rows have to stay put or the one that scrolls away takes its controls with it.
|
|
75
|
+
//
|
|
76
|
+
// `bg-panel` and not the card's own `bg-panel/40`: a pinned header has rows
|
|
77
|
+
// passing underneath it, and a translucent one shows them through.
|
|
78
|
+
const stickyClass = sticky ? 'sticky top-0 z-10 bg-panel' : '';
|
|
79
|
+
const stickyFilterClass = sticky ? 'sticky top-8 z-10 bg-panel' : '';
|
|
80
|
+
return (_jsxs(TableHeader, { children: [_jsxs(TableRow, { children: [headers.map((header) => header.column.getCanSort() ? (_jsx(SortableHead, { header: header, className: stickyClass }, header.id)) : (_jsx(TableHead, { className: `whitespace-nowrap ${stickyClass}`, children: flexRender(header.column.columnDef.header, header.getContext()) }, header.id))), menu ? (_jsx(TableHead, { className: `w-px whitespace-nowrap text-right ${stickyClass}`, children: menu })) : null] }), anyFilterable && (_jsxs(TableRow, { children: [headers.map((header) => (_jsx(TableHead, { className: `py-1 ${stickyFilterClass}`, children: header.column.getCanFilter() ? _jsx(ColumnFilterInput, { header: header }) : null }, header.id))), menu ? _jsx(TableHead, { className: stickyFilterClass }) : null] }))] }));
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=panel-table-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel-table-header.js","sourceRoot":"","sources":["../../../../src/react/components/extensions/panel-table-header.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAY,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAA6C,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE5F;oFACoF;AACpF,SAAS,aAAa,CAAC,EAAE,SAAS,EAAyC;IACzE,IAAI,SAAS,KAAK,KAAK;QAAE,OAAO,8BAAkB,MAAM,uBAAS,CAAC;IAClE,IAAI,SAAS,KAAK,MAAM;QAAE,OAAO,8BAAkB,MAAM,uBAAS,CAAC;IACnE,OAAO,CACL,8BAAkB,MAAM,EAAC,SAAS,EAAC,YAAY,uBAExC,CACR,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,YAAY,CAAC,EACpB,MAAM,EACN,SAAS,GAIV;IACC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;IAC9C,MAAM,KAAK,GAAG,UAAU,CAAC,MAA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M,CAAC,EAAE,CAA4C,CACzE,CAAC,CAAC,CAAC,CACF,KAAC,SAAS,IAAiB,SAAS,EAAE,qBAAqB,WAAW,EAAE,YACrE,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,IADlD,MAAM,CAAC,EAAE,CAEb,CACb,CACF,EACA,IAAI,CAAC,CAAC,CAAC,CACN,KAAC,SAAS,IAAC,SAAS,EAAE,qCAAqC,WAAW,EAAE,YACrE,IAAI,GACK,CACb,CAAC,CAAC,CAAC,IAAI,IACC,EACV,aAAa,IAAI,CAChB,MAAC,QAAQ,eACN,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACvB,KAAC,SAAS,IAAiB,SAAS,EAAE,QAAQ,iBAAiB,EAAE,YAC9D,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,KAAC,iBAAiB,IAAC,MAAM,EAAE,MAAM,GAAI,CAAC,CAAC,CAAC,IAAI,IAD9D,MAAM,CAAC,EAAE,CAEb,CACb,CAAC,EACD,IAAI,CAAC,CAAC,CAAC,KAAC,SAAS,IAAC,SAAS,EAAE,iBAAiB,GAAI,CAAC,CAAC,CAAC,IAAI,IACjD,CACZ,IACW,CACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type JSX } from 'react';
|
|
2
|
+
import { type TableColumnSpec } from './table-columns.js';
|
|
3
|
+
import { type PanelRow } from './table-features.js';
|
|
4
|
+
import type { TableFilterState, TableSortState } from './table-query.js';
|
|
5
|
+
/**
|
|
6
|
+
* A `table` panel, rendered through a TanStack Table v9 instance.
|
|
7
|
+
*
|
|
8
|
+
* The instance is what earns its place: sorting cycles, filter values, and
|
|
9
|
+
* column visibility are all state machines this file would otherwise hand-roll.
|
|
10
|
+
* What it deliberately does NOT do is transform rows — `manualSorting` and
|
|
11
|
+
* `manualFiltering` are on and no row model is registered, so the rows render in
|
|
12
|
+
* exactly the order the provider returned them, and the sort/filter state is
|
|
13
|
+
* handed straight back up to the dashboard page to re-resolve that provider.
|
|
14
|
+
* See `table-features.ts` for why.
|
|
15
|
+
*/
|
|
16
|
+
export declare function PanelTable({ columns, rows, sort, onSortChange, filters, onFiltersChange, scrolls, }: {
|
|
17
|
+
columns: TableColumnSpec[];
|
|
18
|
+
rows: PanelRow[];
|
|
19
|
+
sort?: TableSortState | undefined;
|
|
20
|
+
onSortChange?: ((sort: TableSortState | undefined) => void) | undefined;
|
|
21
|
+
filters?: TableFilterState | undefined;
|
|
22
|
+
onFiltersChange?: ((filters: TableFilterState) => void) | undefined;
|
|
23
|
+
/** Cap the body height and pin the header — used for paged tables, which are
|
|
24
|
+
* the ones whose row count is unbounded from the panel's point of view. */
|
|
25
|
+
scrolls?: boolean;
|
|
26
|
+
}): JSX.Element;
|
|
27
|
+
//# sourceMappingURL=panel-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel-table.d.ts","sourceRoot":"","sources":["../../../../src/react/components/extensions/panel-table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAqB,MAAM,OAAO,CAAC;AAIpD,OAAO,EAAE,KAAK,eAAe,EAAqB,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAGL,KAAK,QAAQ,EAKd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAkBzE;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,eAAe,EACf,OAAO,GACR,EAAE;IACD,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,IAAI,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IAClC,YAAY,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACxE,OAAO,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACvC,eAAe,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACpE;gFAC4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,GAAG,CAAC,OAAO,CAmFd"}
|