@northgraindata/dsui 0.4.2 → 0.5.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.
- package/bin/dsui.mjs +1 -1
- package/dist/plugin-sdk.mjs +1 -1
- package/dist/runtime/plugins/code-repository.browser.mjs +60 -0
- package/dist/runtime/plugins/code-repository.mjs +2 -2
- package/dist/runtime/plugins/example-plugin.mjs +1 -1
- package/dist/runtime/plugins/health.browser.mjs +202 -68
- package/dist/runtime/plugins/health.mjs +97 -6
- package/dist/runtime/plugins/monitoring.mjs +11 -1
- package/dist/runtime/plugins/status-pages.browser.mjs +5033 -0
- package/dist/runtime/plugins/status-pages.mjs +52 -0
- package/dist/server.mjs +185 -187
- package/package.json +1 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@northgraindata/dsui-ui/src/components/input.tsx +2 -5
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@northgraindata/dsui-ui/src/components/suggest-input.tsx +197 -0
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@northgraindata/dsui-ui/src/index.tsx +5 -0
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@northgraindata/dsui-ui/src/styles.css +54 -0
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/dist/cjs/index.cjs +3 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/dist/cjs/index.cjs.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/dist/esm/index.js +3 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/dist/esm/index.js.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/package.json +2 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/src/index.tsx +11 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/index.cjs +79 -26
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/index.cjs.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/index.d.cts +12 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/scroll-classifier.cjs +14 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/scroll-classifier.cjs.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/scroll-classifier.d.cts +3 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/index.d.ts +12 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/index.js +79 -26
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/index.js.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/scroll-classifier.d.ts +3 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/scroll-classifier.js +14 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/scroll-classifier.js.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/package.json +1 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/src/index.ts +135 -24
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/src/scroll-classifier.ts +31 -3
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/define.ts +22 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/index.ts +1 -0
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/presentation.test.ts +73 -0
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/presentation.ts +34 -0
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/types.ts +23 -0
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/layout/gauge.tsx +14 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/dataset/dataset.test.ts +134 -0
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/dataset/index.ts +141 -0
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/index.ts +23 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/dist/cjs/index.cjs +3 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/dist/cjs/index.cjs.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/dist/esm/index.js +3 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/dist/esm/index.js.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/package.json +2 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/src/index.tsx +11 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/index.cjs +79 -26
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/index.cjs.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/index.d.cts +12 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/scroll-classifier.cjs +14 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/scroll-classifier.cjs.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/scroll-classifier.d.cts +3 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/index.d.ts +12 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/index.js +79 -26
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/index.js.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/scroll-classifier.d.ts +3 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/scroll-classifier.js +14 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/scroll-classifier.js.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/package.json +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/src/index.ts +135 -24
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/src/scroll-classifier.ts +31 -3
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/define.ts +22 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/index.ts +1 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/presentation.test.ts +73 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/presentation.ts +34 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/types.ts +23 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/layout/gauge.tsx +14 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/dataset/dataset.test.ts +134 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/dataset/index.ts +141 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/index.ts +23 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/react-virtual/dist/cjs/index.cjs +3 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/react-virtual/dist/cjs/index.cjs.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/react-virtual/dist/esm/index.js +3 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/react-virtual/dist/esm/index.js.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/react-virtual/package.json +2 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/react-virtual/src/index.tsx +11 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/cjs/index.cjs +79 -26
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/cjs/index.cjs.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/cjs/index.d.cts +12 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/cjs/scroll-classifier.cjs +14 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/cjs/scroll-classifier.cjs.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/cjs/scroll-classifier.d.cts +3 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/esm/index.d.ts +12 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/esm/index.js +79 -26
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/esm/index.js.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/esm/scroll-classifier.d.ts +3 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/esm/scroll-classifier.js +14 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/esm/scroll-classifier.js.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/package.json +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/src/index.ts +135 -24
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/src/scroll-classifier.ts +31 -3
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/package.json +2 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/src/diagnostics.ts +24 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/src/events.ts +6 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/src/index.ts +162 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/src/modal.test.ts +76 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/src/modal.ts +200 -0
- package/sdk/node_modules/@northgraindata/dsui-ui/src/components/input.tsx +2 -5
- package/sdk/node_modules/@northgraindata/dsui-ui/src/components/suggest-input.tsx +197 -0
- package/sdk/node_modules/@northgraindata/dsui-ui/src/index.tsx +5 -0
- package/sdk/node_modules/@northgraindata/dsui-ui/src/styles.css +54 -0
- package/web/assets/index-DQkPkPN7.css +1 -0
- package/web/assets/index-w07fgRf1.js +218 -0
- package/web/index.html +2 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/keyed-items.test.ts +0 -23
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/query-editor/column-profile.test.ts +0 -109
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/query-editor/query-explorer.test.ts +0 -29
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/table-data.test.ts +0 -65
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/keyed-items.test.ts +0 -23
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/query-editor/column-profile.test.ts +0 -109
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/query-editor/query-explorer.test.ts +0 -29
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/table-data.test.ts +0 -65
- package/web/assets/index-D-ALFhle.css +0 -1
- package/web/assets/index-DfLcPXiR.js +0 -98
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
DiagnosticOperation,
|
|
3
|
+
DiagnosticProcess,
|
|
4
|
+
DiagnosticSnapshot,
|
|
5
|
+
} from "./diagnostics";
|
|
6
|
+
|
|
7
|
+
import type { DiagnosticSnapshot } from "./diagnostics";
|
|
1
8
|
import type { PluginEventPage, PluginEventReadOptions } from "./events";
|
|
2
9
|
|
|
3
10
|
export {
|
|
@@ -7,9 +14,26 @@ export {
|
|
|
7
14
|
signalEventSchema,
|
|
8
15
|
} from "./events";
|
|
9
16
|
|
|
10
|
-
import type {
|
|
17
|
+
import type {
|
|
18
|
+
DatasetObservation,
|
|
19
|
+
DatasetPage,
|
|
20
|
+
DatasetRef,
|
|
21
|
+
PageNode,
|
|
22
|
+
SignalType,
|
|
23
|
+
} from "@northgraindata/dsui-adapter-sdk";
|
|
11
24
|
|
|
12
|
-
export type {
|
|
25
|
+
export type {
|
|
26
|
+
ComponentProps,
|
|
27
|
+
DatasetColumn,
|
|
28
|
+
DatasetInfo,
|
|
29
|
+
DatasetObservation,
|
|
30
|
+
DatasetPage,
|
|
31
|
+
DatasetRef,
|
|
32
|
+
} from "@northgraindata/dsui-adapter-sdk";
|
|
33
|
+
export {
|
|
34
|
+
DATASET_LIST_MAX_LIMIT,
|
|
35
|
+
DATASET_OBSERVE_MAX_REFS,
|
|
36
|
+
} from "@northgraindata/dsui-adapter-sdk";
|
|
13
37
|
|
|
14
38
|
import { serializeNodes } from "@northgraindata/dsui-adapter-sdk";
|
|
15
39
|
import { z } from "zod";
|
|
@@ -139,6 +163,10 @@ export type PluginMetadata = {
|
|
|
139
163
|
readonly version: string;
|
|
140
164
|
readonly apiVersion: typeof PLUGIN_API_VERSION;
|
|
141
165
|
readonly security?: boolean;
|
|
166
|
+
/** Sidebar group label. Plugins without a category appear in Extensions. */
|
|
167
|
+
readonly category?: string;
|
|
168
|
+
/** Image URL or self-contained data URL, following adapter metadata. */
|
|
169
|
+
readonly iconUrl?: string;
|
|
142
170
|
};
|
|
143
171
|
|
|
144
172
|
/** Explicit opt-in to the host's dynamically composed Settings navigation. */
|
|
@@ -187,6 +215,8 @@ export type PluginNavigationItem = {
|
|
|
187
215
|
readonly label: string;
|
|
188
216
|
readonly pageId: string;
|
|
189
217
|
readonly order?: number;
|
|
218
|
+
/** An icon for this entry alone, when a plugin has several; otherwise the plugin's `iconUrl`. */
|
|
219
|
+
readonly iconUrl?: string;
|
|
190
220
|
};
|
|
191
221
|
|
|
192
222
|
export type PluginUiSlot = {
|
|
@@ -226,6 +256,12 @@ export type PluginServiceSummary = {
|
|
|
226
256
|
readonly adapterName?: string;
|
|
227
257
|
readonly managedBy: "configuration" | "ui";
|
|
228
258
|
readonly iconUrl?: string;
|
|
259
|
+
/**
|
|
260
|
+
* Optional abilities the service's adapter declares, such as `datasets`.
|
|
261
|
+
* Open strings: check for the one you need and ignore the rest. Absent on a
|
|
262
|
+
* host that predates the field, which a plugin must read as "none declared".
|
|
263
|
+
*/
|
|
264
|
+
readonly capabilities?: readonly string[];
|
|
229
265
|
};
|
|
230
266
|
|
|
231
267
|
export type PluginServiceHealth =
|
|
@@ -245,6 +281,8 @@ export type PluginServiceHealthCheck = {
|
|
|
245
281
|
readonly label: string;
|
|
246
282
|
readonly ok: boolean;
|
|
247
283
|
readonly detail?: string;
|
|
284
|
+
/** Path inside the service workspace where this signal can be investigated. */
|
|
285
|
+
readonly href?: string;
|
|
248
286
|
};
|
|
249
287
|
|
|
250
288
|
export type PluginServiceProbe = {
|
|
@@ -272,6 +310,11 @@ export type PluginServiceAction = {
|
|
|
272
310
|
readonly description?: string;
|
|
273
311
|
readonly inputSchema?: Record<string, unknown>;
|
|
274
312
|
};
|
|
313
|
+
export type PluginDatasetOptions = {
|
|
314
|
+
readonly signal?: AbortSignal;
|
|
315
|
+
/** Upper bound for one call; the host applies its own ceiling. */
|
|
316
|
+
readonly timeoutMs?: number;
|
|
317
|
+
};
|
|
275
318
|
export type PluginInvocationOptions = {
|
|
276
319
|
signal?: AbortSignal;
|
|
277
320
|
origin?: { pluginId: string; runId?: string };
|
|
@@ -299,6 +342,33 @@ export interface PluginServiceCatalog {
|
|
|
299
342
|
signals?(
|
|
300
343
|
id: string,
|
|
301
344
|
): Promise<readonly { id: string; type: SignalType }[] | null>;
|
|
345
|
+
/**
|
|
346
|
+
* Reads what a service's adapter says about the data it holds.
|
|
347
|
+
*
|
|
348
|
+
* Only services whose `capabilities` include `datasets` answer; asking any
|
|
349
|
+
* other fails with a request error, so check first. Both reads come from the
|
|
350
|
+
* system's own catalog or statistics and never change anything. The host
|
|
351
|
+
* owns the connection, so a plugin never sees credentials. `null` means the
|
|
352
|
+
* service is unknown to the host or not visible to the caller.
|
|
353
|
+
*
|
|
354
|
+
* Absent on a host that predates the capability.
|
|
355
|
+
*/
|
|
356
|
+
datasets?: {
|
|
357
|
+
list(
|
|
358
|
+
id: string,
|
|
359
|
+
input?: { readonly cursor?: string; readonly limit?: number },
|
|
360
|
+
options?: PluginDatasetOptions,
|
|
361
|
+
): Promise<DatasetPage | null>;
|
|
362
|
+
/**
|
|
363
|
+
* Measures up to `DATASET_OBSERVE_MAX_REFS` datasets in one call. A
|
|
364
|
+
* dataset that no longer exists is missing from the result.
|
|
365
|
+
*/
|
|
366
|
+
observe(
|
|
367
|
+
id: string,
|
|
368
|
+
refs: readonly DatasetRef[],
|
|
369
|
+
options?: PluginDatasetOptions,
|
|
370
|
+
): Promise<DatasetObservation[] | null>;
|
|
371
|
+
};
|
|
302
372
|
/**
|
|
303
373
|
* Asks the host to probe a service connection and report its health.
|
|
304
374
|
*
|
|
@@ -319,6 +389,8 @@ export type PluginCapabilitySummary = {
|
|
|
319
389
|
readonly name: string;
|
|
320
390
|
readonly version: string;
|
|
321
391
|
readonly status: PluginReadinessStatus;
|
|
392
|
+
/** The plugin's icon, so another plugin can show where something it embeds comes from. */
|
|
393
|
+
readonly iconUrl?: string;
|
|
322
394
|
};
|
|
323
395
|
export type PluginActionSummary = {
|
|
324
396
|
readonly id: string;
|
|
@@ -354,6 +426,8 @@ export type PluginCatalog = {
|
|
|
354
426
|
id: string;
|
|
355
427
|
name: string;
|
|
356
428
|
version: string;
|
|
429
|
+
category?: string;
|
|
430
|
+
iconUrl?: string;
|
|
357
431
|
status: PluginReadinessStatus;
|
|
358
432
|
detail?: string;
|
|
359
433
|
}>;
|
|
@@ -433,6 +507,59 @@ export interface PluginAuthenticationProvider {
|
|
|
433
507
|
routes?(request: Request): Promise<Response> | Response;
|
|
434
508
|
}
|
|
435
509
|
|
|
510
|
+
/**
|
|
511
|
+
* A source of credentials that lives outside DSUI, such as a cloud secret
|
|
512
|
+
* manager.
|
|
513
|
+
*
|
|
514
|
+
* A connection field may hold a reference instead of a value. The host asks the
|
|
515
|
+
* provider for the value just before it calls the adapter, so DSUI stores the
|
|
516
|
+
* reference and never the credential. A reference is opaque to the host: only
|
|
517
|
+
* the provider that issued the format parses it.
|
|
518
|
+
*/
|
|
519
|
+
/** A secret a person can pick instead of typing its reference. */
|
|
520
|
+
export type PluginSecretSuggestion = {
|
|
521
|
+
/** What goes into the field. */
|
|
522
|
+
reference: string;
|
|
523
|
+
/** Shown instead of the reference when it reads better. */
|
|
524
|
+
label?: string;
|
|
525
|
+
description?: string;
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
export interface PluginSecretProvider {
|
|
529
|
+
/** Kebab-case and unique across plugins; it is what a stored reference names. */
|
|
530
|
+
id: string;
|
|
531
|
+
/** Shown in the connection form, e.g. "AWS Secrets Manager". */
|
|
532
|
+
label: string;
|
|
533
|
+
description?: string;
|
|
534
|
+
/** Describes the input a person fills in to point at a secret. */
|
|
535
|
+
reference: { label: string; placeholder?: string; hint?: string };
|
|
536
|
+
/**
|
|
537
|
+
* Returns the secret's current value.
|
|
538
|
+
*
|
|
539
|
+
* Throw with a message that names what was asked for and why it failed. The
|
|
540
|
+
* host never logs or returns the resolved value, and an error that contains
|
|
541
|
+
* one would defeat that.
|
|
542
|
+
*/
|
|
543
|
+
resolve(
|
|
544
|
+
reference: string,
|
|
545
|
+
options: { signal?: AbortSignal },
|
|
546
|
+
): Promise<string>;
|
|
547
|
+
/**
|
|
548
|
+
* Lists secrets whose reference starts with, or matches, `query`.
|
|
549
|
+
*
|
|
550
|
+
* Optional, because listing usually needs a broader permission than reading
|
|
551
|
+
* one secret. The form offers suggestions only when this exists and works.
|
|
552
|
+
* Throw when the caller may not list: the host remembers that and falls back
|
|
553
|
+
* to a plain input without asking again for a few minutes. Return at most a
|
|
554
|
+
* few dozen entries, never a secret's value, and treat an empty query as
|
|
555
|
+
* "show the first ones".
|
|
556
|
+
*/
|
|
557
|
+
search?(
|
|
558
|
+
query: string,
|
|
559
|
+
options: { signal?: AbortSignal },
|
|
560
|
+
): Promise<PluginSecretSuggestion[]>;
|
|
561
|
+
}
|
|
562
|
+
|
|
436
563
|
export interface PluginAuthorizationProvider {
|
|
437
564
|
/**
|
|
438
565
|
* Narrows what the principal's role already allows.
|
|
@@ -481,6 +608,8 @@ export type RuntimePluginResource = {
|
|
|
481
608
|
};
|
|
482
609
|
|
|
483
610
|
export interface RuntimePluginRegistry {
|
|
611
|
+
/** Optional so a plugin still loads on a host that does not publish signals. */
|
|
612
|
+
signal?(signal: RuntimePluginSignal): void;
|
|
484
613
|
page(page: RuntimePluginPage): void;
|
|
485
614
|
navigation(item: PluginNavigationItem): void;
|
|
486
615
|
slot(slot: RuntimePluginSlot): void;
|
|
@@ -490,6 +619,7 @@ export interface RuntimePluginRegistry {
|
|
|
490
619
|
job(job: RuntimePluginJob): void;
|
|
491
620
|
authentication(provider: PluginAuthenticationProvider): void;
|
|
492
621
|
authorization(provider: PluginAuthorizationProvider): void;
|
|
622
|
+
secrets(provider: PluginSecretProvider): void;
|
|
493
623
|
}
|
|
494
624
|
|
|
495
625
|
/** A declared job as the host publishes it. */
|
|
@@ -574,9 +704,17 @@ export interface PluginRegistry<TConfig = unknown> {
|
|
|
574
704
|
job(job: JobDefinition): void;
|
|
575
705
|
authentication(provider: PluginAuthenticationProvider): void;
|
|
576
706
|
authorization(provider: PluginAuthorizationProvider): void;
|
|
707
|
+
/**
|
|
708
|
+
* Offers a secret manager that connection fields can point at.
|
|
709
|
+
*
|
|
710
|
+
* Unlike authentication, several providers may coexist; each id must be
|
|
711
|
+
* unique across plugins.
|
|
712
|
+
*/
|
|
713
|
+
secrets(provider: PluginSecretProvider): void;
|
|
577
714
|
}
|
|
578
715
|
|
|
579
716
|
export interface PluginCapabilities {
|
|
717
|
+
readonly diagnostics?: { read(): Promise<DiagnosticSnapshot> };
|
|
580
718
|
readonly access: {
|
|
581
719
|
/** Identity of the authenticated request; absent in background work. */
|
|
582
720
|
principal?(): PluginPrincipal | null;
|
|
@@ -613,6 +751,20 @@ export type PluginSignalDefinition = {
|
|
|
613
751
|
id: string;
|
|
614
752
|
payload: z.ZodTypeAny;
|
|
615
753
|
type?: SignalType;
|
|
754
|
+
/**
|
|
755
|
+
* `"service"` when the plugin emits this signal about individual services,
|
|
756
|
+
* as Service health does for an outage. The host then lists it among every
|
|
757
|
+
* service's signals, so pickers such as workflow editors can offer it.
|
|
758
|
+
* Defaults to `"global"`.
|
|
759
|
+
*/
|
|
760
|
+
scope?: "service" | "global";
|
|
761
|
+
};
|
|
762
|
+
|
|
763
|
+
/** A declared plugin signal as the host publishes it. */
|
|
764
|
+
export type RuntimePluginSignal = {
|
|
765
|
+
readonly id: string;
|
|
766
|
+
readonly type: SignalType;
|
|
767
|
+
readonly scope: "service" | "global";
|
|
616
768
|
};
|
|
617
769
|
|
|
618
770
|
function unavailableCapability(): never {
|
|
@@ -764,6 +916,7 @@ export function definePlugin<TConfig>(
|
|
|
764
916
|
},
|
|
765
917
|
logger: host.logger,
|
|
766
918
|
access: host.access ?? { require: async () => unavailableCapability() },
|
|
919
|
+
diagnostics: host.diagnostics,
|
|
767
920
|
jobs: host.jobs ?? { enqueue: async () => unavailableCapability() },
|
|
768
921
|
events: {
|
|
769
922
|
read: async (options) => {
|
|
@@ -795,6 +948,11 @@ export function definePlugin<TConfig>(
|
|
|
795
948
|
"Invalid or duplicate plugin signal",
|
|
796
949
|
);
|
|
797
950
|
signals.set(signal.id, signal);
|
|
951
|
+
runtimeRegistry.signal?.({
|
|
952
|
+
id: signal.id,
|
|
953
|
+
type: signal.type ?? "info",
|
|
954
|
+
scope: signal.scope ?? "global",
|
|
955
|
+
});
|
|
798
956
|
},
|
|
799
957
|
page: (page, presentation) => {
|
|
800
958
|
if (presentation.public && !definition.metadata.security)
|
|
@@ -881,6 +1039,7 @@ export function definePlugin<TConfig>(
|
|
|
881
1039
|
storage: context.storage,
|
|
882
1040
|
stores: context.stores,
|
|
883
1041
|
access: context.access,
|
|
1042
|
+
diagnostics: context.diagnostics,
|
|
884
1043
|
jobs: context.jobs,
|
|
885
1044
|
events: context.events,
|
|
886
1045
|
signal: runContext.signal,
|
|
@@ -935,6 +1094,7 @@ export function definePlugin<TConfig>(
|
|
|
935
1094
|
);
|
|
936
1095
|
runtimeRegistry.authorization(provider);
|
|
937
1096
|
},
|
|
1097
|
+
secrets: (provider) => runtimeRegistry.secrets(provider),
|
|
938
1098
|
};
|
|
939
1099
|
definition.setup(registry, config);
|
|
940
1100
|
},
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
4
|
+
import { createModal, MODAL_STYLES } from "./modal";
|
|
5
|
+
|
|
6
|
+
const Modal = createModal(React);
|
|
7
|
+
|
|
8
|
+
const render = (props: Partial<Parameters<typeof Modal>[0]> = {}) =>
|
|
9
|
+
renderToStaticMarkup(
|
|
10
|
+
React.createElement(
|
|
11
|
+
Modal,
|
|
12
|
+
{ title: "New rule", onClose: () => undefined, ...props },
|
|
13
|
+
React.createElement("input", { name: "name" }),
|
|
14
|
+
),
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
describe("createModal", () => {
|
|
18
|
+
test("renders a labelled native dialog with the content in a scrolling body", () => {
|
|
19
|
+
const html = render({ subtitle: "Routes a signal" });
|
|
20
|
+
expect(html).toContain("<dialog");
|
|
21
|
+
expect(html).toMatch(/aria-labelledby="([^"]+)"/);
|
|
22
|
+
const id = /aria-labelledby="([^"]+)"/.exec(html)?.[1];
|
|
23
|
+
expect(html).toContain(`<h2 id="${id}">New rule</h2>`);
|
|
24
|
+
expect(html).toContain("Routes a signal");
|
|
25
|
+
expect(html).toContain(
|
|
26
|
+
'<div class="dsui-modal-body"><input name="name"/></div>',
|
|
27
|
+
);
|
|
28
|
+
expect(html).toContain('aria-label="Close"');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("shows a footer only when it is given", () => {
|
|
32
|
+
// The stylesheet names the class, so look for the element itself.
|
|
33
|
+
expect(render()).not.toContain("<footer");
|
|
34
|
+
expect(render({ footer: "Save" })).toContain(
|
|
35
|
+
'<footer class="dsui-modal-footer">Save</footer>',
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test("content and footer may be functions of close", () => {
|
|
40
|
+
const html = renderToStaticMarkup(
|
|
41
|
+
React.createElement(Modal, {
|
|
42
|
+
title: "Edit",
|
|
43
|
+
onClose: () => undefined,
|
|
44
|
+
// JSX writes this as a child; createElement only types it as a prop.
|
|
45
|
+
// biome-ignore lint/correctness/noChildrenProp: function children
|
|
46
|
+
children: (close: () => void) =>
|
|
47
|
+
React.createElement("p", null, typeof close),
|
|
48
|
+
footer: (close: () => void) =>
|
|
49
|
+
React.createElement("span", null, typeof close),
|
|
50
|
+
}),
|
|
51
|
+
);
|
|
52
|
+
expect(html).toContain("<p>function</p>");
|
|
53
|
+
expect(html).toContain("<span>function</span>");
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test("the close button is disabled while the dialog is not dismissible", () => {
|
|
57
|
+
expect(render({ dismissible: false })).toMatch(
|
|
58
|
+
/<button[^>]*aria-label="Close"[^>]*disabled/,
|
|
59
|
+
);
|
|
60
|
+
expect(render()).not.toMatch(/<button[^>]*aria-label="Close"[^>]*disabled/);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test("the width follows the size", () => {
|
|
64
|
+
expect(render()).toContain("--dsui-modal-width:600px");
|
|
65
|
+
expect(render({ size: "small" })).toContain("--dsui-modal-width:440px");
|
|
66
|
+
expect(render({ size: "large" })).toContain("--dsui-modal-width:820px");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test("ships the styles that center it despite a host reset", () => {
|
|
70
|
+
expect(render()).toContain(
|
|
71
|
+
".dsui-modal{position:fixed;inset:0;margin:auto",
|
|
72
|
+
);
|
|
73
|
+
expect(MODAL_STYLES).toContain("prefers-reduced-motion");
|
|
74
|
+
expect(MODAL_STYLES).toContain("backdrop-filter:blur");
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import type * as ReactTypes from "react";
|
|
2
|
+
|
|
3
|
+
/** The part of React a modal needs. Plugins receive React from the host, so the SDK never imports it. */
|
|
4
|
+
export type ModalReact = Pick<
|
|
5
|
+
typeof ReactTypes,
|
|
6
|
+
"createElement" | "useCallback" | "useEffect" | "useId" | "useRef"
|
|
7
|
+
>;
|
|
8
|
+
|
|
9
|
+
export interface ModalProps {
|
|
10
|
+
title: string;
|
|
11
|
+
/** A muted line under the title, such as what the dialog is about. */
|
|
12
|
+
subtitle?: string;
|
|
13
|
+
/** Called after the exit animation, for every way of closing the dialog. */
|
|
14
|
+
onClose: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* Whether a click on the dimmed page closes the dialog. Turn it off while the
|
|
17
|
+
* dialog holds input that a stray click would lose.
|
|
18
|
+
*/
|
|
19
|
+
closeOnOutsideClick?: boolean;
|
|
20
|
+
size?: "small" | "medium" | "large";
|
|
21
|
+
/**
|
|
22
|
+
* Whether Esc, the close button and a click outside may close the dialog. Turn
|
|
23
|
+
* it off while a save is in flight; the dialog's own buttons still work.
|
|
24
|
+
*/
|
|
25
|
+
dismissible?: boolean;
|
|
26
|
+
/** The content. A function receives `close`, which closes with the exit animation. */
|
|
27
|
+
children?: ModalContent;
|
|
28
|
+
/**
|
|
29
|
+
* Buttons that stay visible below the scrolling content. A submit button here
|
|
30
|
+
* reaches a form in the content through its `form` attribute.
|
|
31
|
+
*/
|
|
32
|
+
footer?: ModalContent;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Content, or a function of `close` for the places that dismiss the dialog themselves. */
|
|
36
|
+
export type ModalContent =
|
|
37
|
+
| ReactTypes.ReactNode
|
|
38
|
+
| ((close: () => void) => ReactTypes.ReactNode);
|
|
39
|
+
|
|
40
|
+
const EXIT_MS = 180;
|
|
41
|
+
|
|
42
|
+
const resolve = (content: ModalContent, close: () => void) =>
|
|
43
|
+
typeof content === "function" ? content(close) : content;
|
|
44
|
+
const WIDTH = { small: 440, medium: 600, large: 820 } as const;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Colors come from the host's theme variables, so light and dark both work. The
|
|
48
|
+
* host resets element margins, which is how a native dialog centers itself, so
|
|
49
|
+
* the dialog is positioned explicitly.
|
|
50
|
+
*/
|
|
51
|
+
export const MODAL_STYLES = `
|
|
52
|
+
.dsui-modal{position:fixed;inset:0;margin:auto;height:fit-content;padding:0;box-sizing:border-box;width:min(var(--dsui-modal-width,600px),calc(100vw - 32px));max-height:min(88vh,760px);overflow:hidden;border:1px solid var(--color-border-strong);border-radius:14px;background:var(--color-surface-raised,var(--color-surface));color:var(--color-primary);box-shadow:0 24px 64px rgb(0 0 0 / .45);font:inherit;line-height:1.5;
|
|
53
|
+
opacity:0;transform:translateY(10px) scale(.98);transition:opacity 180ms ease,transform 180ms cubic-bezier(.2,.8,.2,1),overlay 180ms allow-discrete,display 180ms allow-discrete}
|
|
54
|
+
.dsui-modal[open]{opacity:1;transform:none}
|
|
55
|
+
@starting-style{.dsui-modal[open]{opacity:0;transform:translateY(10px) scale(.98)}}
|
|
56
|
+
.dsui-modal::backdrop{background:rgb(2 5 13 / .55);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);opacity:0;transition:opacity 180ms ease,overlay 180ms allow-discrete,display 180ms allow-discrete}
|
|
57
|
+
.dsui-modal[open]::backdrop{opacity:1}
|
|
58
|
+
@starting-style{.dsui-modal[open]::backdrop{opacity:0}}
|
|
59
|
+
.dsui-modal-panel{display:grid;grid-template-rows:auto minmax(0,1fr) auto;max-height:inherit;min-height:0;outline:0}
|
|
60
|
+
.dsui-modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:16px 20px;border-bottom:1px solid var(--color-border)}
|
|
61
|
+
.dsui-modal-head h2{margin:0;font-size:15px;font-weight:600;line-height:1.35}
|
|
62
|
+
.dsui-modal-head p{margin:2px 0 0;font-size:12px;color:var(--color-muted)}
|
|
63
|
+
.dsui-modal-close{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:32px;height:32px;margin:-4px -6px 0 0;padding:0;border:0;border-radius:8px;background:transparent;color:var(--color-secondary);cursor:pointer;transition:background-color 140ms}
|
|
64
|
+
.dsui-modal-close:hover:not(:disabled){background:var(--color-surface-hover)}
|
|
65
|
+
.dsui-modal-close:disabled{opacity:.4;cursor:default}
|
|
66
|
+
.dsui-modal-close:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}
|
|
67
|
+
.dsui-modal-body{padding:20px;overflow:auto;min-height:0}
|
|
68
|
+
.dsui-modal-footer{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;padding:12px 20px;border-top:1px solid var(--color-border)}
|
|
69
|
+
@media (prefers-reduced-motion:reduce){.dsui-modal,.dsui-modal::backdrop{transition:none}}
|
|
70
|
+
`;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Builds the shared modal dialog with the React a plugin received from the host.
|
|
74
|
+
* Call it once, where the plugin stores that React:
|
|
75
|
+
*
|
|
76
|
+
* ```ts
|
|
77
|
+
* export let Modal: ReturnType<typeof createModal>;
|
|
78
|
+
* export function initializeReact(react: typeof ReactTypes) {
|
|
79
|
+
* Modal = createModal(react);
|
|
80
|
+
* }
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* It is a native `<dialog>`: the browser traps focus, closes it on Esc and keeps
|
|
84
|
+
* it above the page, so it needs no portal and the plugin's own styles still
|
|
85
|
+
* reach its content. The page behind is dimmed and blurred, and the panel fades
|
|
86
|
+
* and slides in and out. Render it only while it should be open.
|
|
87
|
+
*/
|
|
88
|
+
export function createModal(react: ModalReact) {
|
|
89
|
+
const h = react.createElement;
|
|
90
|
+
return function Modal(props: ModalProps): ReactTypes.ReactElement {
|
|
91
|
+
const {
|
|
92
|
+
title,
|
|
93
|
+
subtitle,
|
|
94
|
+
onClose,
|
|
95
|
+
closeOnOutsideClick = true,
|
|
96
|
+
size = "medium",
|
|
97
|
+
dismissible = true,
|
|
98
|
+
children,
|
|
99
|
+
footer,
|
|
100
|
+
} = props;
|
|
101
|
+
const dialog = react.useRef<HTMLDialogElement>(null);
|
|
102
|
+
const closing = react.useRef(false);
|
|
103
|
+
const titleId = react.useId();
|
|
104
|
+
|
|
105
|
+
react.useEffect(() => {
|
|
106
|
+
const element = dialog.current;
|
|
107
|
+
if (!element || element.open) return;
|
|
108
|
+
element.showModal();
|
|
109
|
+
// The browser focuses the first control, which would be the close button.
|
|
110
|
+
// Start in the content, or on the panel when there is nothing to type into.
|
|
111
|
+
const first = element.querySelector<HTMLElement>(
|
|
112
|
+
".dsui-modal-body :is(input, select, textarea)",
|
|
113
|
+
);
|
|
114
|
+
(first ?? element.querySelector<HTMLElement>(".dsui-modal-panel"))?.focus(
|
|
115
|
+
{ preventScroll: true },
|
|
116
|
+
);
|
|
117
|
+
}, []);
|
|
118
|
+
|
|
119
|
+
// Closing plays the exit animation first, then tells the owner to unmount.
|
|
120
|
+
const requestClose = react.useCallback(() => {
|
|
121
|
+
if (closing.current) return;
|
|
122
|
+
closing.current = true;
|
|
123
|
+
dialog.current?.close();
|
|
124
|
+
window.setTimeout(onClose, EXIT_MS);
|
|
125
|
+
}, [onClose]);
|
|
126
|
+
|
|
127
|
+
return h(
|
|
128
|
+
"dialog",
|
|
129
|
+
{
|
|
130
|
+
ref: dialog,
|
|
131
|
+
className: "dsui-modal",
|
|
132
|
+
style: { "--dsui-modal-width": `${WIDTH[size]}px` },
|
|
133
|
+
"aria-labelledby": titleId,
|
|
134
|
+
onCancel: (event: ReactTypes.SyntheticEvent) => {
|
|
135
|
+
event.preventDefault();
|
|
136
|
+
if (dismissible) requestClose();
|
|
137
|
+
},
|
|
138
|
+
onMouseDown: (event: ReactTypes.MouseEvent) => {
|
|
139
|
+
if (
|
|
140
|
+
dismissible &&
|
|
141
|
+
closeOnOutsideClick &&
|
|
142
|
+
event.target === dialog.current
|
|
143
|
+
)
|
|
144
|
+
requestClose();
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
h("style", null, MODAL_STYLES),
|
|
148
|
+
h(
|
|
149
|
+
"div",
|
|
150
|
+
{ className: "dsui-modal-panel", tabIndex: -1 },
|
|
151
|
+
h(
|
|
152
|
+
"header",
|
|
153
|
+
{ className: "dsui-modal-head" },
|
|
154
|
+
h(
|
|
155
|
+
"div",
|
|
156
|
+
null,
|
|
157
|
+
h("h2", { id: titleId }, title),
|
|
158
|
+
subtitle ? h("p", null, subtitle) : null,
|
|
159
|
+
),
|
|
160
|
+
h(
|
|
161
|
+
"button",
|
|
162
|
+
{
|
|
163
|
+
type: "button",
|
|
164
|
+
className: "dsui-modal-close",
|
|
165
|
+
"aria-label": "Close",
|
|
166
|
+
disabled: !dismissible,
|
|
167
|
+
onClick: requestClose,
|
|
168
|
+
},
|
|
169
|
+
h(
|
|
170
|
+
"svg",
|
|
171
|
+
{
|
|
172
|
+
width: 16,
|
|
173
|
+
height: 16,
|
|
174
|
+
viewBox: "0 0 24 24",
|
|
175
|
+
fill: "none",
|
|
176
|
+
stroke: "currentColor",
|
|
177
|
+
strokeWidth: 2,
|
|
178
|
+
strokeLinecap: "round",
|
|
179
|
+
"aria-hidden": true,
|
|
180
|
+
},
|
|
181
|
+
h("path", { d: "M18 6 6 18M6 6l12 12" }),
|
|
182
|
+
),
|
|
183
|
+
),
|
|
184
|
+
),
|
|
185
|
+
h(
|
|
186
|
+
"div",
|
|
187
|
+
{ className: "dsui-modal-body" },
|
|
188
|
+
resolve(children, requestClose),
|
|
189
|
+
),
|
|
190
|
+
footer
|
|
191
|
+
? h(
|
|
192
|
+
"footer",
|
|
193
|
+
{ className: "dsui-modal-footer" },
|
|
194
|
+
resolve(footer, requestClose),
|
|
195
|
+
)
|
|
196
|
+
: null,
|
|
197
|
+
),
|
|
198
|
+
);
|
|
199
|
+
};
|
|
200
|
+
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
2
|
import { cn } from "./cn";
|
|
3
3
|
|
|
4
|
-
export function Input({
|
|
5
|
-
className,
|
|
6
|
-
...props
|
|
7
|
-
}: InputHTMLAttributes<HTMLInputElement>) {
|
|
4
|
+
export function Input({ className, ...props }: ComponentProps<"input">) {
|
|
8
5
|
return (
|
|
9
6
|
<input
|
|
10
7
|
className={cn(
|