@brett_lamy/ui 3.1.0 → 5.0.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/README.md +4 -4
- package/dist/components/animated-height.d.ts +3 -1
- package/dist/components/animated-height.d.ts.map +1 -1
- package/dist/components/animated-height.js +11 -11
- package/dist/components/artifact-chat-container.d.ts.map +1 -1
- package/dist/components/artifact-chat-container.js +81 -82
- package/dist/components/button.d.ts +4 -3
- package/dist/components/button.d.ts.map +1 -1
- package/dist/components/button.js +22 -9
- package/dist/components/canvas.d.ts +91 -0
- package/dist/components/canvas.d.ts.map +1 -0
- package/dist/components/canvas.js +296 -0
- package/dist/components/composer/composer-cards.d.ts +55 -0
- package/dist/components/composer/composer-cards.d.ts.map +1 -0
- package/dist/components/composer/composer-cards.js +351 -0
- package/dist/components/composer/composer.d.ts +9 -1
- package/dist/components/composer/composer.d.ts.map +1 -1
- package/dist/components/composer/composer.js +179 -154
- package/dist/components/context-menu.d.ts +25 -0
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu.js +127 -0
- package/dist/components/credenza.d.ts.map +1 -1
- package/dist/components/credenza.js +52 -92
- package/dist/components/cron-editor.d.ts +47 -0
- package/dist/components/cron-editor.d.ts.map +1 -0
- package/dist/components/cron-editor.js +297 -0
- package/dist/components/dropdown-menu.d.ts +3 -1
- package/dist/components/dropdown-menu.d.ts.map +1 -1
- package/dist/components/dropdown-menu.js +5 -5
- package/dist/components/edge-drawer.d.ts.map +1 -1
- package/dist/components/edge-drawer.js +1 -0
- package/dist/components/file-upload.d.ts +121 -0
- package/dist/components/file-upload.d.ts.map +1 -0
- package/dist/components/file-upload.js +405 -0
- package/dist/components/filter-input.d.ts +22 -0
- package/dist/components/filter-input.d.ts.map +1 -0
- package/dist/components/filter-input.js +126 -0
- package/dist/components/filter.d.ts +154 -0
- package/dist/components/filter.d.ts.map +1 -0
- package/dist/components/filter.js +815 -0
- package/dist/components/floating-chat.d.ts.map +1 -1
- package/dist/components/floating-chat.js +71 -88
- package/dist/components/floating-sheet.d.ts +21 -5
- package/dist/components/floating-sheet.d.ts.map +1 -1
- package/dist/components/floating-sheet.js +113 -116
- package/dist/components/markdown-editor.d.ts +2 -0
- package/dist/components/markdown-editor.d.ts.map +1 -1
- package/dist/components/markdown-editor.js +46 -45
- package/dist/components/markdown-view.d.ts +6 -1
- package/dist/components/markdown-view.d.ts.map +1 -1
- package/dist/components/markdown-view.js +13 -11
- package/dist/components/navigation-stack.d.ts +3 -5
- package/dist/components/navigation-stack.d.ts.map +1 -1
- package/dist/components/navigation-stack.js +212 -382
- package/dist/components/passkey-enroll-dialog.d.ts +36 -0
- package/dist/components/passkey-enroll-dialog.d.ts.map +1 -0
- package/dist/components/passkey-enroll-dialog.js +234 -0
- package/dist/components/result-table.d.ts +38 -0
- package/dist/components/result-table.d.ts.map +1 -0
- package/dist/components/result-table.js +161 -0
- package/dist/components/schema-tree.d.ts +19 -0
- package/dist/components/schema-tree.d.ts.map +1 -0
- package/dist/components/schema-tree.js +172 -0
- package/dist/components/side-drawer.d.ts.map +1 -1
- package/dist/components/side-drawer.js +117 -143
- package/dist/components/slider.d.ts.map +1 -1
- package/dist/components/slider.js +4 -1
- package/dist/components/spinner-shapes.d.ts +263 -0
- package/dist/components/spinner-shapes.d.ts.map +1 -0
- package/dist/components/spinner-shapes.js +771 -0
- package/dist/components/spinner.d.ts +133 -3
- package/dist/components/spinner.d.ts.map +1 -1
- package/dist/components/spinner.js +445 -29
- package/dist/components/sql-console.d.ts +28 -0
- package/dist/components/sql-console.d.ts.map +1 -0
- package/dist/components/sql-console.js +348 -0
- package/dist/components/sql-editor.d.ts +47 -0
- package/dist/components/sql-editor.d.ts.map +1 -0
- package/dist/components/sql-editor.js +170 -0
- package/dist/components/tab-view.d.ts +2 -2
- package/dist/components/tab-view.d.ts.map +1 -1
- package/dist/components/tab-view.js +63 -49
- package/dist/components/tailscale-login-button.d.ts +53 -0
- package/dist/components/tailscale-login-button.d.ts.map +1 -0
- package/dist/components/tailscale-login-button.js +197 -0
- package/dist/components/time-input.d.ts +46 -0
- package/dist/components/time-input.d.ts.map +1 -0
- package/dist/components/time-input.js +258 -0
- package/dist/components/toast.d.ts +5 -2
- package/dist/components/toast.d.ts.map +1 -1
- package/dist/components/toast.js +249 -125
- package/dist/components/vault-gate.d.ts +60 -0
- package/dist/components/vault-gate.d.ts.map +1 -0
- package/dist/components/vault-gate.js +382 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +86 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +129 -85
- package/dist/lib/back-history.d.ts +5 -0
- package/dist/lib/back-history.d.ts.map +1 -0
- package/dist/lib/back-history.js +44 -0
- package/dist/lib/canvas-math.d.ts +82 -0
- package/dist/lib/canvas-math.d.ts.map +1 -0
- package/dist/lib/canvas-math.js +226 -0
- package/dist/lib/controllable-state.d.ts +4 -0
- package/dist/lib/controllable-state.d.ts.map +1 -0
- package/dist/lib/controllable-state.js +11 -0
- package/dist/lib/cron.d.ts +55 -0
- package/dist/lib/cron.d.ts.map +1 -0
- package/dist/lib/cron.js +269 -0
- package/dist/lib/edge-swipe.d.ts +36 -0
- package/dist/lib/edge-swipe.d.ts.map +1 -0
- package/dist/lib/edge-swipe.js +73 -0
- package/dist/lib/file-upload.d.ts +187 -0
- package/dist/lib/file-upload.d.ts.map +1 -0
- package/dist/lib/file-upload.js +349 -0
- package/dist/lib/filter-query.d.ts +90 -0
- package/dist/lib/filter-query.d.ts.map +1 -0
- package/dist/lib/filter-query.js +459 -0
- package/dist/lib/filter.d.ts +120 -0
- package/dist/lib/filter.d.ts.map +1 -0
- package/dist/lib/filter.js +399 -0
- package/dist/lib/format-bytes.d.ts +3 -0
- package/dist/lib/format-bytes.d.ts.map +1 -0
- package/dist/lib/format-bytes.js +16 -0
- package/dist/lib/gpu-cron.d.ts +51 -0
- package/dist/lib/gpu-cron.d.ts.map +1 -0
- package/dist/lib/gpu-cron.js +81 -0
- package/dist/lib/gpu-query/featurize.d.ts +19 -0
- package/dist/lib/gpu-query/featurize.d.ts.map +1 -0
- package/dist/lib/gpu-query/featurize.js +88 -0
- package/dist/lib/gpu-query/index.d.ts +73 -0
- package/dist/lib/gpu-query/index.d.ts.map +1 -0
- package/dist/lib/gpu-query/index.js +117 -0
- package/dist/lib/gpu-query/kernel.wgsl.d.ts +30 -0
- package/dist/lib/gpu-query/kernel.wgsl.d.ts.map +1 -0
- package/dist/lib/gpu-query/model.d.ts +8 -0
- package/dist/lib/gpu-query/model.d.ts.map +1 -0
- package/dist/lib/gpu-query/model.js +91 -0
- package/dist/lib/gpu-query/schema.d.ts +40 -0
- package/dist/lib/gpu-query/schema.d.ts.map +1 -0
- package/dist/lib/gpu-query/schema.js +0 -0
- package/dist/lib/gpu-query/webgpu.d.ts +12 -0
- package/dist/lib/gpu-query/webgpu.d.ts.map +1 -0
- package/dist/lib/gpu-query/weights.d.ts +17 -0
- package/dist/lib/gpu-query/weights.d.ts.map +1 -0
- package/dist/lib/gpu-query/weights.js +40 -0
- package/dist/lib/gpu-query/weights.json.d.ts +3 -0
- package/dist/lib/gpu-query/weights2.js +25 -0
- package/dist/lib/gpu-time.d.ts +77 -0
- package/dist/lib/gpu-time.d.ts.map +1 -0
- package/dist/lib/gpu-time.js +260 -0
- package/dist/lib/morph-path.d.ts +22 -0
- package/dist/lib/morph-path.d.ts.map +1 -0
- package/dist/lib/morph-path.js +42 -0
- package/dist/lib/passkey.d.ts +120 -0
- package/dist/lib/passkey.d.ts.map +1 -0
- package/dist/lib/passkey.js +186 -0
- package/dist/lib/persistent-state.d.ts +9 -0
- package/dist/lib/persistent-state.d.ts.map +1 -0
- package/dist/lib/persistent-state.js +37 -0
- package/dist/lib/pglite-core.d.ts +219 -0
- package/dist/lib/pglite-core.d.ts.map +1 -0
- package/dist/lib/pglite-core.js +273 -0
- package/dist/lib/pglite-files.d.ts +7 -0
- package/dist/lib/pglite-files.d.ts.map +1 -0
- package/dist/lib/pglite-files.js +17 -0
- package/dist/lib/pglite-schema.d.ts +58 -0
- package/dist/lib/pglite-schema.d.ts.map +1 -0
- package/dist/lib/pglite-schema.js +105 -0
- package/dist/lib/pglite-storage.d.ts +33 -0
- package/dist/lib/pglite-storage.d.ts.map +1 -0
- package/dist/lib/pglite-storage.js +55 -0
- package/dist/lib/pglite-transfer.d.ts +53 -0
- package/dist/lib/pglite-transfer.d.ts.map +1 -0
- package/dist/lib/pglite-transfer.js +126 -0
- package/dist/lib/pglite.d.ts +106 -0
- package/dist/lib/pglite.d.ts.map +1 -0
- package/dist/lib/pglite.js +298 -0
- package/dist/lib/pull-to-refresh.d.ts +24 -0
- package/dist/lib/pull-to-refresh.d.ts.map +1 -0
- package/dist/lib/pull-to-refresh.js +74 -0
- package/dist/lib/scroll-hidden.d.ts +6 -0
- package/dist/lib/scroll-hidden.d.ts.map +1 -0
- package/dist/lib/scroll-hidden.js +21 -0
- package/dist/lib/sheet-drag.d.ts +10 -2
- package/dist/lib/sheet-drag.d.ts.map +1 -1
- package/dist/lib/sheet-drag.js +72 -69
- package/dist/lib/sql-format.d.ts +62 -0
- package/dist/lib/sql-format.d.ts.map +1 -0
- package/dist/lib/sql-format.js +175 -0
- package/dist/lib/sql-lex.d.ts +25 -0
- package/dist/lib/sql-lex.d.ts.map +1 -0
- package/dist/lib/sql-lex.js +135 -0
- package/dist/lib/tab-lock.d.ts +28 -0
- package/dist/lib/tab-lock.d.ts.map +1 -0
- package/dist/lib/tab-lock.js +80 -0
- package/dist/lib/tailscale-connect.d.ts +56 -0
- package/dist/lib/tailscale-connect.d.ts.map +1 -0
- package/dist/lib/tailscale-connect.js +99 -0
- package/dist/lib/tailscale-fake.d.ts +33 -0
- package/dist/lib/tailscale-fake.d.ts.map +1 -0
- package/dist/lib/tailscale-fake.js +80 -0
- package/dist/lib/tailscale-policy.d.ts +71 -0
- package/dist/lib/tailscale-policy.d.ts.map +1 -0
- package/dist/lib/tailscale-policy.js +244 -0
- package/dist/lib/tailscale-react.d.ts +20 -0
- package/dist/lib/tailscale-react.d.ts.map +1 -0
- package/dist/lib/tailscale-react.js +37 -0
- package/dist/lib/tailscale-router/bridge.d.ts +60 -0
- package/dist/lib/tailscale-router/bridge.d.ts.map +1 -0
- package/dist/lib/tailscale-router/bridge.js +198 -0
- package/dist/lib/tailscale-router/react.d.ts +19 -0
- package/dist/lib/tailscale-router/react.d.ts.map +1 -0
- package/dist/lib/tailscale-router/react.js +52 -0
- package/dist/lib/tailscale.d.ts +204 -0
- package/dist/lib/tailscale.d.ts.map +1 -0
- package/dist/lib/tailscale.js +443 -0
- package/dist/lib/title-flight.d.ts +34 -0
- package/dist/lib/title-flight.d.ts.map +1 -0
- package/dist/lib/title-flight.js +123 -0
- package/dist/lib/vault-react.d.ts +49 -0
- package/dist/lib/vault-react.d.ts.map +1 -0
- package/dist/lib/vault-react.js +196 -0
- package/dist/lib/vault-storage.d.ts +30 -0
- package/dist/lib/vault-storage.d.ts.map +1 -0
- package/dist/lib/vault-storage.js +105 -0
- package/dist/lib/vault.d.ts +200 -0
- package/dist/lib/vault.d.ts.map +1 -0
- package/dist/lib/vault.js +641 -0
- package/dist/tailscale-sw.js +332 -0
- package/package.json +35 -5
- package/dist/components/icon-button.d.ts +0 -19
- package/dist/components/icon-button.d.ts.map +0 -1
- package/dist/components/icon-button.js +0 -31
- package/dist/components/measure-h.d.ts +0 -7
- package/dist/components/measure-h.d.ts.map +0 -1
- package/dist/components/measure-h.js +0 -20
- package/dist/components/snap-sheet.d.ts +0 -13
- package/dist/components/snap-sheet.d.ts.map +0 -1
- package/dist/components/snap-sheet.js +0 -100
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { Vault } from '../lib/vault';
|
|
4
|
+
export declare const vaultActionClass = "bg-[color-mix(in_oklab,var(--primary)_78%,black)]";
|
|
5
|
+
export declare const vaultLinkClass = "text-[color-mix(in_oklab,var(--primary)_78%,black)] dark:text-primary";
|
|
6
|
+
export declare const vaultErrorClass = "text-[color-mix(in_oklab,var(--destructive)_72%,black)] dark:text-destructive";
|
|
7
|
+
export declare const vaultMutedClass = "text-foreground/70";
|
|
8
|
+
export interface PasskeyEnrollDialogProps {
|
|
9
|
+
isOpen: boolean;
|
|
10
|
+
onOpenChange: (open: boolean) => void;
|
|
11
|
+
/** Defaults to the nearest `VaultProvider`'s vault. */
|
|
12
|
+
vault?: Vault;
|
|
13
|
+
/** `enroll` creates the passkey and the first recovery key; `regenerate` replaces the recovery key of an existing vault. */
|
|
14
|
+
mode?: 'enroll' | 'regenerate';
|
|
15
|
+
/** Used in the copy ("Protect Notes with a passkey"). */
|
|
16
|
+
appName?: string;
|
|
17
|
+
/** What the vault protects, as a sentence fragment. Default: "what this app saves in this browser". */
|
|
18
|
+
protects?: ReactNode;
|
|
19
|
+
/** Make the person type the recovery key back before finishing (proves they saved it). Default false. */
|
|
20
|
+
requireVerification?: boolean;
|
|
21
|
+
/** Called after the recovery key is confirmed, just before the dialog closes. */
|
|
22
|
+
onDone?: () => void;
|
|
23
|
+
className?: string;
|
|
24
|
+
style?: ComponentProps<'div'>['style'];
|
|
25
|
+
}
|
|
26
|
+
export declare const recoveryKeyVariants: (props?: ({
|
|
27
|
+
layout?: "row" | "grid" | null | undefined;
|
|
28
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
29
|
+
export interface RecoveryKeyProps extends Omit<ComponentProps<'div'>, 'children'>, VariantProps<typeof recoveryKeyVariants> {
|
|
30
|
+
/** `XXXX-XXXX-…`, as returned by `vault.enroll()`. */
|
|
31
|
+
value: string;
|
|
32
|
+
}
|
|
33
|
+
/** The recovery key in groups of four. A labelled group so a screen reader reads it as one thing; not a live region. */
|
|
34
|
+
export declare function RecoveryKey({ value, layout, className, ...props }: RecoveryKeyProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export declare function PasskeyEnrollDialog({ isOpen, onOpenChange, vault, mode, appName, protects, requireVerification, onDone, className, style, }: PasskeyEnrollDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
//# sourceMappingURL=passkey-enroll-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passkey-enroll-dialog.d.ts","sourceRoot":"","sources":["../../src/components/passkey-enroll-dialog.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsC,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhG,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAUlE,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAkBzC,eAAO,MAAM,gBAAgB,sDAAsD,CAAC;AACpF,eAAO,MAAM,cAAc,0EAA0E,CAAC;AACtG,eAAO,MAAM,eAAe,kFAAkF,CAAC;AAC/G,eAAO,MAAM,eAAe,uBAAuB,CAAC;AAEpD,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,uDAAuD;IACvD,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,4HAA4H;IAC5H,IAAI,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;IAC/B,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uGAAuG;IACvG,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,yGAAyG;IACzG,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC;CACxC;AAID,eAAO,MAAM,mBAAmB;;8EAM/B,CAAC;AAEF,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,EAAE,YAAY,CAAC,OAAO,mBAAmB,CAAC;IACzH,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wHAAwH;AACxH,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAUnF;AAaD,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,IAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,mBAA2B,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,GACvH,EAAE,wBAAwB,2CAsK1B"}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../lib/utils.js";
|
|
3
|
+
import { Icon as t } from "../lib/icon.js";
|
|
4
|
+
import { Spinner as n } from "./spinner.js";
|
|
5
|
+
import { Button as r } from "./button.js";
|
|
6
|
+
import { Label as i } from "./label.js";
|
|
7
|
+
import { Input as a } from "./input.js";
|
|
8
|
+
import { FieldError as o, TextField as s } from "./text-field.js";
|
|
9
|
+
import { Checkbox as c } from "./checkbox.js";
|
|
10
|
+
import { DialogBody as l, DialogContent as u, DialogDescription as ee, DialogFooter as te, DialogHeader as d, DialogTitle as f } from "./dialog.js";
|
|
11
|
+
import { useVault as p, vaultErrorMessage as m } from "../lib/vault-react.js";
|
|
12
|
+
import { useEffect as h, useId as ne, useRef as re, useState as g } from "react";
|
|
13
|
+
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
14
|
+
import { cva as b } from "class-variance-authority";
|
|
15
|
+
import { VisuallyHidden as ie } from "react-aria";
|
|
16
|
+
//#region src/components/passkey-enroll-dialog.tsx
|
|
17
|
+
var x = "bg-[color-mix(in_oklab,var(--primary)_78%,black)]", S = "text-[color-mix(in_oklab,var(--primary)_78%,black)] dark:text-primary", C = "text-[color-mix(in_oklab,var(--destructive)_72%,black)] dark:text-destructive", w = "text-foreground/70", T = b("grid gap-x-3 gap-y-1 rounded-ctl bg-secondary px-3 py-3 font-mono text-callout font-semibold tracking-wide text-foreground tabular-nums select-text [-webkit-user-select:text]", {
|
|
18
|
+
variants: { layout: {
|
|
19
|
+
grid: "grid-cols-2",
|
|
20
|
+
row: "grid-cols-4"
|
|
21
|
+
} },
|
|
22
|
+
defaultVariants: { layout: "grid" }
|
|
23
|
+
});
|
|
24
|
+
function E({ value: t, layout: n, className: r, ...i }) {
|
|
25
|
+
return /* @__PURE__ */ y("div", {
|
|
26
|
+
"data-slot": "recovery-key",
|
|
27
|
+
role: "group",
|
|
28
|
+
"aria-label": "Recovery key",
|
|
29
|
+
className: e(T({ layout: n }), r),
|
|
30
|
+
...i,
|
|
31
|
+
children: [/* @__PURE__ */ v("span", {
|
|
32
|
+
className: "sr-only select-none",
|
|
33
|
+
children: t.split("-").map((e) => e.split("").join(" ")).join(", ")
|
|
34
|
+
}), t.split("-").map((e, t) => /* @__PURE__ */ v("span", {
|
|
35
|
+
"aria-hidden": "true",
|
|
36
|
+
children: e
|
|
37
|
+
}, t))]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function ae(e, t) {
|
|
41
|
+
let n = URL.createObjectURL(new Blob([t], { type: "text/plain" })), r = document.createElement("a");
|
|
42
|
+
r.href = n, r.download = e, document.body.appendChild(r), r.click(), r.remove(), setTimeout(() => URL.revokeObjectURL(n), 1e3);
|
|
43
|
+
}
|
|
44
|
+
function D({ isOpen: b, onOpenChange: S, vault: T, mode: D = "enroll", appName: k, protects: oe, requireVerification: A = !1, onDone: j, className: M, style: N }) {
|
|
45
|
+
let P = p(T), [F, I] = g("intro"), [L, R] = g(null), [z, B] = g(null), [V, H] = g(!1), [U, W] = g(""), [G, K] = g("idle"), [se, q] = g(""), J = re(null), Y = ne(), X = D === "regenerate", Z = k ?? "this app";
|
|
46
|
+
h(() => {
|
|
47
|
+
b || (J.current?.abort(), I("intro"), R(null), B(null), H(!1), W(""), K("idle"), q(""));
|
|
48
|
+
}, [b]), h(() => () => J.current?.abort(), []);
|
|
49
|
+
let Q = !A || z !== null && U.replace(/[\s-]/g, "").toUpperCase() === z.replace(/-/g, "");
|
|
50
|
+
async function ce() {
|
|
51
|
+
let e = new AbortController();
|
|
52
|
+
J.current = e, R(null), I("working"), q("Waiting for your passkey. Follow your browser's prompt.");
|
|
53
|
+
try {
|
|
54
|
+
let t = X ? await P.regenerateRecoveryKey({ signal: e.signal }) : (await P.enroll({ signal: e.signal })).recoveryKey;
|
|
55
|
+
B(t), I("recovery"), q("Your recovery key is ready. It is shown only once.");
|
|
56
|
+
} catch (t) {
|
|
57
|
+
if (e.signal.aborted) return;
|
|
58
|
+
R(m(t)), I("intro"), q("");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function le() {
|
|
62
|
+
J.current?.abort(), I("intro"), q("");
|
|
63
|
+
}
|
|
64
|
+
async function ue() {
|
|
65
|
+
try {
|
|
66
|
+
await navigator.clipboard.writeText(z ?? ""), K("copied");
|
|
67
|
+
} catch {
|
|
68
|
+
K("failed");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async function de() {
|
|
72
|
+
try {
|
|
73
|
+
await P.confirmRecoveryKey(), j?.(), S(!1);
|
|
74
|
+
} catch (e) {
|
|
75
|
+
R(m(e));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
let $ = F === "recovery";
|
|
79
|
+
return /* @__PURE__ */ v(u, {
|
|
80
|
+
isOpen: b,
|
|
81
|
+
onOpenChange: S,
|
|
82
|
+
isDismissable: !$,
|
|
83
|
+
isKeyboardDismissDisabled: $,
|
|
84
|
+
className: M,
|
|
85
|
+
children: ({ close: u }) => /* @__PURE__ */ y("div", {
|
|
86
|
+
"data-slot": "passkey-enroll-dialog",
|
|
87
|
+
className: "flex min-h-0 flex-1 flex-col",
|
|
88
|
+
style: N,
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ y(d, { children: [/* @__PURE__ */ v(f, { children: $ ? "Save your recovery key" : X ? "Replace your recovery key" : `Protect ${Z} with a passkey` }), /* @__PURE__ */ v(ee, {
|
|
91
|
+
className: w,
|
|
92
|
+
children: $ ? "This is the only way back in if you lose your passkey. It is shown once and not stored anywhere." : X ? "You will confirm with your passkey. The old recovery key stops working as soon as the new one exists." : /* @__PURE__ */ y(_, { children: [
|
|
93
|
+
"A passkey will lock ",
|
|
94
|
+
oe ?? "what this app saves in this browser",
|
|
95
|
+
". Only you can unlock it, with your fingerprint, face or device PIN."
|
|
96
|
+
] })
|
|
97
|
+
})] }),
|
|
98
|
+
/* @__PURE__ */ v(l, {
|
|
99
|
+
className: "grid gap-3 pb-3",
|
|
100
|
+
children: $ ? /* @__PURE__ */ y(_, { children: [
|
|
101
|
+
/* @__PURE__ */ v(E, { value: z ?? "" }),
|
|
102
|
+
/* @__PURE__ */ y("div", {
|
|
103
|
+
className: "flex flex-wrap gap-2",
|
|
104
|
+
children: [/* @__PURE__ */ y(r, {
|
|
105
|
+
variant: "secondary",
|
|
106
|
+
size: "sm",
|
|
107
|
+
autoFocus: !0,
|
|
108
|
+
onPress: () => void ue(),
|
|
109
|
+
children: [/* @__PURE__ */ v(t, {
|
|
110
|
+
name: G === "copied" ? "check" : "copy",
|
|
111
|
+
size: 15
|
|
112
|
+
}), G === "copied" ? "Copied" : "Copy"]
|
|
113
|
+
}), /* @__PURE__ */ y(r, {
|
|
114
|
+
variant: "secondary",
|
|
115
|
+
size: "sm",
|
|
116
|
+
onPress: () => ae(`${(k ?? "vault").toLowerCase().replace(/\s+/g, "-")}-recovery-key.txt`, `${Z} recovery key\n\n${z}\n\nAnyone with this key can read the data it protects. Keep it somewhere safe and private.\n`),
|
|
117
|
+
children: [/* @__PURE__ */ v(t, {
|
|
118
|
+
name: "download",
|
|
119
|
+
size: 15
|
|
120
|
+
}), "Save as file"]
|
|
121
|
+
})]
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ v("p", {
|
|
124
|
+
className: e("m-0 text-footnote", w),
|
|
125
|
+
children: "Keep it in a password manager or print it. Anyone who has it can open your data, and nobody can reissue it."
|
|
126
|
+
}),
|
|
127
|
+
G === "failed" ? /* @__PURE__ */ v("p", {
|
|
128
|
+
role: "alert",
|
|
129
|
+
className: e("m-0 text-footnote", C),
|
|
130
|
+
children: "Copying was blocked. Select the key and copy it by hand."
|
|
131
|
+
}) : null,
|
|
132
|
+
A ? /* @__PURE__ */ y(s, {
|
|
133
|
+
value: U,
|
|
134
|
+
onChange: W,
|
|
135
|
+
isInvalid: U.length > 0 && !Q && U.replace(/[\s-]/g, "").length >= 32,
|
|
136
|
+
autoComplete: "off",
|
|
137
|
+
children: [
|
|
138
|
+
/* @__PURE__ */ v(i, {
|
|
139
|
+
variant: "field",
|
|
140
|
+
className: w,
|
|
141
|
+
children: "Type the key to confirm you saved it"
|
|
142
|
+
}),
|
|
143
|
+
/* @__PURE__ */ v(a, {
|
|
144
|
+
className: "font-mono",
|
|
145
|
+
spellCheck: !1,
|
|
146
|
+
autoCapitalize: "characters",
|
|
147
|
+
autoCorrect: "off"
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ v(o, { children: "That does not match the recovery key above." })
|
|
150
|
+
]
|
|
151
|
+
}) : null,
|
|
152
|
+
/* @__PURE__ */ v(c, {
|
|
153
|
+
isSelected: V,
|
|
154
|
+
onChange: H,
|
|
155
|
+
shape: "square",
|
|
156
|
+
className: "text-subhead",
|
|
157
|
+
children: "I saved my recovery key somewhere safe"
|
|
158
|
+
}),
|
|
159
|
+
L ? /* @__PURE__ */ v("p", {
|
|
160
|
+
role: "alert",
|
|
161
|
+
className: e("m-0 text-footnote", C),
|
|
162
|
+
children: L
|
|
163
|
+
}) : null
|
|
164
|
+
] }) : /* @__PURE__ */ y(_, { children: [
|
|
165
|
+
X ? null : /* @__PURE__ */ y("ul", {
|
|
166
|
+
className: e("m-0 grid list-none gap-2 p-0 text-subhead", w),
|
|
167
|
+
children: [
|
|
168
|
+
/* @__PURE__ */ v(O, {
|
|
169
|
+
icon: "shield-check",
|
|
170
|
+
children: "The data is encrypted on this device with a key your passkey unlocks."
|
|
171
|
+
}),
|
|
172
|
+
/* @__PURE__ */ v(O, {
|
|
173
|
+
icon: "key",
|
|
174
|
+
children: "You also get a recovery key. If you lose the passkey and the key, the data cannot be recovered by anyone."
|
|
175
|
+
}),
|
|
176
|
+
/* @__PURE__ */ v(O, {
|
|
177
|
+
icon: "info",
|
|
178
|
+
children: "It protects stored data from someone reading the browser's files. It does not protect against malicious scripts running on this page."
|
|
179
|
+
})
|
|
180
|
+
]
|
|
181
|
+
}),
|
|
182
|
+
F === "working" ? /* @__PURE__ */ y("div", {
|
|
183
|
+
className: e("flex items-center gap-2 text-subhead", w),
|
|
184
|
+
children: [/* @__PURE__ */ v(n, {
|
|
185
|
+
spin: !0,
|
|
186
|
+
size: 18
|
|
187
|
+
}), /* @__PURE__ */ v("span", { children: "Waiting for your passkey…" })]
|
|
188
|
+
}) : null,
|
|
189
|
+
L ? /* @__PURE__ */ v("p", {
|
|
190
|
+
id: Y,
|
|
191
|
+
role: "alert",
|
|
192
|
+
className: e("m-0 rounded-ctl bg-destructive/10 px-3 py-2 text-footnote", C),
|
|
193
|
+
children: L
|
|
194
|
+
}) : null
|
|
195
|
+
] })
|
|
196
|
+
}),
|
|
197
|
+
/* @__PURE__ */ v(te, { children: $ ? /* @__PURE__ */ v(r, {
|
|
198
|
+
className: x,
|
|
199
|
+
isDisabled: !V || !Q,
|
|
200
|
+
onPress: () => void de(),
|
|
201
|
+
children: "Done"
|
|
202
|
+
}) : /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(r, {
|
|
203
|
+
variant: "ghost",
|
|
204
|
+
onPress: F === "working" ? le : u,
|
|
205
|
+
children: "Cancel"
|
|
206
|
+
}), /* @__PURE__ */ v(r, {
|
|
207
|
+
className: x,
|
|
208
|
+
autoFocus: !0,
|
|
209
|
+
isPending: F === "working",
|
|
210
|
+
onPress: () => void ce(),
|
|
211
|
+
"aria-describedby": L ? Y : void 0,
|
|
212
|
+
children: X ? "Continue with passkey" : "Create passkey"
|
|
213
|
+
})] }) }),
|
|
214
|
+
/* @__PURE__ */ v(ie, { children: /* @__PURE__ */ v("span", {
|
|
215
|
+
role: "status",
|
|
216
|
+
"aria-live": "polite",
|
|
217
|
+
children: se
|
|
218
|
+
}) })
|
|
219
|
+
]
|
|
220
|
+
})
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
function O({ icon: e, children: n }) {
|
|
224
|
+
return /* @__PURE__ */ y("li", {
|
|
225
|
+
className: "flex items-start gap-2",
|
|
226
|
+
children: [/* @__PURE__ */ v(t, {
|
|
227
|
+
name: e,
|
|
228
|
+
size: 18,
|
|
229
|
+
className: "mt-0.5 text-primary"
|
|
230
|
+
}), /* @__PURE__ */ v("span", { children: n })]
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
//#endregion
|
|
234
|
+
export { D as PasskeyEnrollDialog, E as RecoveryKey, T as recoveryKeyVariants, x as vaultActionClass, C as vaultErrorClass, S as vaultLinkClass, w as vaultMutedClass };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
export declare const resultTableVariants: (props?: ({
|
|
4
|
+
density?: "compact" | "comfortable" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
export interface ResultField {
|
|
7
|
+
name: string;
|
|
8
|
+
/** The column's type OID (PGlite's `dataTypeID`): refines dates and numbers, and labels the header. */
|
|
9
|
+
dataTypeID?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface ResultSet {
|
|
12
|
+
fields: readonly ResultField[];
|
|
13
|
+
rows: readonly Record<string, unknown>[];
|
|
14
|
+
/** `SELECT`, `INSERT`, … — shown when the statement returned no columns. */
|
|
15
|
+
command?: string;
|
|
16
|
+
/** Rows changed by a write. */
|
|
17
|
+
rowCount?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface ResultTableProps extends Omit<ComponentProps<'div'>, 'children' | 'onCopy'>, VariantProps<typeof resultTableVariants> {
|
|
20
|
+
result: ResultSet;
|
|
21
|
+
/** How long the statement took, in ms. */
|
|
22
|
+
durationMs?: number;
|
|
23
|
+
/** Rows drawn before "Show more" (default 200). */
|
|
24
|
+
maxRows?: number;
|
|
25
|
+
/** Let people drag the column edges. */
|
|
26
|
+
resizable?: boolean;
|
|
27
|
+
/** Show the summary and copy buttons (default true). */
|
|
28
|
+
toolbar?: boolean;
|
|
29
|
+
/** Height cap of the scrolling grid, as a CSS length (default `24rem`). */
|
|
30
|
+
maxHeight?: string;
|
|
31
|
+
/** Shown instead of the grid when there are no rows. */
|
|
32
|
+
emptyMessage?: ReactNode;
|
|
33
|
+
/** Called after Copy CSV / Copy JSON with what was copied. */
|
|
34
|
+
onCopy?: (format: 'csv' | 'json', text: string) => void;
|
|
35
|
+
'aria-label'?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function ResultTable({ result, durationMs, maxRows, resizable, toolbar, maxHeight, emptyMessage, onCopy, density, className, style, 'aria-label': ariaLabel, ...props }: ResultTableProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
//# sourceMappingURL=result-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result-table.d.ts","sourceRoot":"","sources":["../../src/components/result-table.tsx"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,cAAc,EAAsB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKnG,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAgBlE,eAAO,MAAM,mBAAmB;;8EAY/B,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,uGAAuG;IACvG,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC;IAC/B,IAAI,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACzC,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC,EAAE,YAAY,CAAC,OAAO,mBAAmB,CAAC;IACpI,MAAM,EAAE,SAAS,CAAC;IAClB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wDAAwD;IACxD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAgDD,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EAAE,UAAU,EAAE,OAAa,EAAE,SAAiB,EAAE,OAAc,EAAE,SAAmB,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EACxH,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,SAA2B,EAAE,GAAG,KAAK,EACtE,EAAE,gBAAgB,2CA6FlB"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../lib/utils.js";
|
|
3
|
+
import { Icon as t } from "../lib/icon.js";
|
|
4
|
+
import { Button as n } from "./button.js";
|
|
5
|
+
import { selectableText as r } from "../lib/primitives.js";
|
|
6
|
+
import { formatCell as i, formatDuration as a, pgTypeName as o, pluralRows as s, toCsv as c, toJson as l } from "../lib/sql-format.js";
|
|
7
|
+
import { useMemo as u, useState as d } from "react";
|
|
8
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
9
|
+
import { Cell as h, Column as g, ColumnResizer as _, ResizableTableContainer as v, Row as y, Table as b, TableBody as x, TableHeader as S } from "react-aria-components";
|
|
10
|
+
import { cva as C } from "class-variance-authority";
|
|
11
|
+
//#region src/components/result-table.tsx
|
|
12
|
+
var w = C("flex min-h-0 min-w-0 flex-col overflow-hidden rounded-panel bg-card text-card-foreground shadow-hairline", {
|
|
13
|
+
variants: { density: {
|
|
14
|
+
compact: "[--result-pad:calc(var(--spacing)*1.5)]",
|
|
15
|
+
comfortable: "[--result-pad:calc(var(--spacing)*2.5)]"
|
|
16
|
+
} },
|
|
17
|
+
defaultVariants: { density: "compact" }
|
|
18
|
+
}), T = 80;
|
|
19
|
+
function E({ cell: i, oid: a }) {
|
|
20
|
+
let [o, s] = d(!1), c = i.kind !== "null" && (i.full.length > T || i.full.includes("\n") || i.kind === "json" && i.full !== i.text);
|
|
21
|
+
return /* @__PURE__ */ m("div", {
|
|
22
|
+
className: "flex min-w-0 items-start gap-1",
|
|
23
|
+
"data-kind": i.kind,
|
|
24
|
+
"data-oid": a,
|
|
25
|
+
children: [o ? /* @__PURE__ */ p("pre", {
|
|
26
|
+
className: e("max-h-64 min-w-0 flex-1 overflow-auto font-mono text-caption leading-snug break-all whitespace-pre-wrap", r),
|
|
27
|
+
children: i.full
|
|
28
|
+
}) : /* @__PURE__ */ p("span", {
|
|
29
|
+
title: c ? i.full : void 0,
|
|
30
|
+
className: e("min-w-0 flex-1 truncate", i.align === "end" && "text-end tabular-nums", i.kind === "null" && "text-foreground/65 italic", (i.kind === "json" || i.kind === "bytea") && "font-mono text-caption", i.kind === "boolean" && "font-medium", r),
|
|
31
|
+
children: i.text
|
|
32
|
+
}), c ? /* @__PURE__ */ p(n, {
|
|
33
|
+
variant: "ghost",
|
|
34
|
+
size: "icon",
|
|
35
|
+
"aria-label": o ? "Collapse value" : "Expand value",
|
|
36
|
+
"aria-expanded": o,
|
|
37
|
+
onPress: () => s((e) => !e),
|
|
38
|
+
className: "size-5 shrink-0 text-foreground/65",
|
|
39
|
+
children: /* @__PURE__ */ p(t, {
|
|
40
|
+
name: o ? "chevron-up" : "chevron-down",
|
|
41
|
+
size: 12,
|
|
42
|
+
sw: 2.2
|
|
43
|
+
})
|
|
44
|
+
}) : null]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
var D = "sticky top-0 z-1 max-w-80 min-w-24 bg-secondary px-3 py-1.5 text-start text-caption font-semibold whitespace-nowrap text-foreground/65 shadow-hairline-b outline-none data-focus-visible:ring-2 data-focus-visible:ring-ring data-focus-visible:ring-inset", O = "max-w-80 px-3 py-(--result-pad) align-top shadow-hairline-b outline-none data-focus-visible:ring-2 data-focus-visible:ring-ring data-focus-visible:ring-inset";
|
|
48
|
+
function k({ result: t, durationMs: r, maxRows: C = 200, resizable: T = !1, toolbar: k = !0, maxHeight: A = "24rem", emptyMessage: j, onCopy: M, density: N, className: P, style: F, "aria-label": I = "Query results", ...L }) {
|
|
49
|
+
let [R, z] = d(C), [B, V] = d(null), { fields: H, rows: U } = t, W = u(() => U.slice(0, R).map((e, t) => ({
|
|
50
|
+
id: t,
|
|
51
|
+
row: e
|
|
52
|
+
})), [U, R]), G = u(() => H.map((e, t) => ({
|
|
53
|
+
id: `c${t}`,
|
|
54
|
+
name: e.name,
|
|
55
|
+
oid: e.dataTypeID
|
|
56
|
+
})), [H]), K = (e) => {
|
|
57
|
+
let n = e === "csv" ? c(t) : l(t);
|
|
58
|
+
navigator.clipboard?.writeText(n).then(() => {
|
|
59
|
+
V(e), setTimeout(() => V(null), 1500);
|
|
60
|
+
}), M?.(e, n);
|
|
61
|
+
}, q = H.length === 0 ? `${t.command ?? "OK"}${t.rowCount === void 0 ? "" : ` · ${s(t.rowCount)} affected`}` : s(U.length), J = /* @__PURE__ */ m(b, {
|
|
62
|
+
"aria-label": I,
|
|
63
|
+
className: "w-max min-w-full border-separate border-spacing-0 text-footnote",
|
|
64
|
+
children: [/* @__PURE__ */ p(S, {
|
|
65
|
+
columns: G,
|
|
66
|
+
children: (e) => /* @__PURE__ */ p(g, {
|
|
67
|
+
id: e.id,
|
|
68
|
+
isRowHeader: e.id === "c0",
|
|
69
|
+
className: D,
|
|
70
|
+
children: /* @__PURE__ */ m("div", {
|
|
71
|
+
className: "flex items-baseline gap-1.5",
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ p("span", {
|
|
74
|
+
className: "truncate",
|
|
75
|
+
children: e.name
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ p("span", {
|
|
78
|
+
className: "text-caption2 font-normal text-foreground/65",
|
|
79
|
+
children: o(e.oid)
|
|
80
|
+
}),
|
|
81
|
+
T ? /* @__PURE__ */ p(_, { className: "absolute inset-y-0 end-0 w-1.5 cursor-col-resize touch-none data-resizing:bg-primary/40" }) : null
|
|
82
|
+
]
|
|
83
|
+
})
|
|
84
|
+
})
|
|
85
|
+
}), /* @__PURE__ */ p(x, {
|
|
86
|
+
items: W,
|
|
87
|
+
children: (e) => /* @__PURE__ */ p(y, {
|
|
88
|
+
id: e.id,
|
|
89
|
+
columns: G,
|
|
90
|
+
className: "outline-none data-hovered:bg-accent/50",
|
|
91
|
+
children: (t) => /* @__PURE__ */ p(h, {
|
|
92
|
+
className: O,
|
|
93
|
+
children: /* @__PURE__ */ p(E, {
|
|
94
|
+
cell: i(e.row[t.name], t.oid),
|
|
95
|
+
oid: t.oid
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
})]
|
|
100
|
+
});
|
|
101
|
+
return /* @__PURE__ */ m("div", {
|
|
102
|
+
"data-slot": "result-table",
|
|
103
|
+
"data-rows": U.length,
|
|
104
|
+
className: e(w({ density: N }), P),
|
|
105
|
+
style: {
|
|
106
|
+
"--result-max-h": A,
|
|
107
|
+
...F
|
|
108
|
+
},
|
|
109
|
+
...L,
|
|
110
|
+
children: [
|
|
111
|
+
k ? /* @__PURE__ */ m("div", {
|
|
112
|
+
"data-slot": "result-table-toolbar",
|
|
113
|
+
className: "flex min-h-9 shrink-0 items-center gap-2 px-3 py-1 shadow-hairline-b",
|
|
114
|
+
children: [/* @__PURE__ */ m("span", {
|
|
115
|
+
"data-slot": "result-table-summary",
|
|
116
|
+
role: "status",
|
|
117
|
+
className: "min-w-0 flex-1 truncate text-footnote text-foreground/65 tabular-nums",
|
|
118
|
+
children: [
|
|
119
|
+
q,
|
|
120
|
+
r === void 0 ? "" : ` · ${a(r)}`,
|
|
121
|
+
U.length > R ? ` · showing ${R.toLocaleString("en-US")}` : ""
|
|
122
|
+
]
|
|
123
|
+
}), H.length > 0 && U.length > 0 ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(n, {
|
|
124
|
+
variant: "ghost",
|
|
125
|
+
size: "sm",
|
|
126
|
+
onPress: () => K("csv"),
|
|
127
|
+
children: B === "csv" ? "Copied" : "Copy CSV"
|
|
128
|
+
}), /* @__PURE__ */ p(n, {
|
|
129
|
+
variant: "ghost",
|
|
130
|
+
size: "sm",
|
|
131
|
+
onPress: () => K("json"),
|
|
132
|
+
children: B === "json" ? "Copied" : "Copy JSON"
|
|
133
|
+
})] }) : null]
|
|
134
|
+
}) : null,
|
|
135
|
+
H.length === 0 ? null : U.length === 0 ? /* @__PURE__ */ p("div", {
|
|
136
|
+
className: "px-3 py-6 text-center text-footnote text-foreground/65",
|
|
137
|
+
children: j ?? "No rows"
|
|
138
|
+
}) : p(T ? v : "div", {
|
|
139
|
+
className: "bl-scroll max-h-(--result-max-h) min-h-0 overflow-auto",
|
|
140
|
+
children: J
|
|
141
|
+
}),
|
|
142
|
+
U.length > R ? /* @__PURE__ */ p("div", {
|
|
143
|
+
className: "flex shrink-0 justify-center px-3 py-1.5 shadow-hairline-t",
|
|
144
|
+
children: /* @__PURE__ */ m(n, {
|
|
145
|
+
variant: "ghost",
|
|
146
|
+
size: "sm",
|
|
147
|
+
onPress: () => z((e) => e + C),
|
|
148
|
+
children: [
|
|
149
|
+
"Show ",
|
|
150
|
+
Math.min(C, U.length - R).toLocaleString("en-US"),
|
|
151
|
+
" more of ",
|
|
152
|
+
(U.length - R).toLocaleString("en-US"),
|
|
153
|
+
" remaining"
|
|
154
|
+
]
|
|
155
|
+
})
|
|
156
|
+
}) : null
|
|
157
|
+
]
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
//#endregion
|
|
161
|
+
export { k as ResultTable, w as resultTableVariants };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { SchemaColumn, SchemaInfo, SchemaTable } from '../lib/pglite-schema';
|
|
4
|
+
export declare const schemaTreeVariants: (props?: ({
|
|
5
|
+
variant?: "card" | "default" | null | undefined;
|
|
6
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
|
+
export interface SchemaTreeProps extends Omit<ComponentProps<'div'>, 'children' | 'onSelect'>, VariantProps<typeof schemaTreeVariants> {
|
|
8
|
+
/** From `useSchema()`. `null` while it loads. */
|
|
9
|
+
schema: SchemaInfo | null;
|
|
10
|
+
isLoading?: boolean;
|
|
11
|
+
/** A table (or view) was chosen: Enter, or a click. */
|
|
12
|
+
onSelectTable?: (table: SchemaTable) => void;
|
|
13
|
+
onSelectColumn?: (table: SchemaTable, column: SchemaColumn) => void;
|
|
14
|
+
/** Expand every table's columns at first (default: only schemas are open). */
|
|
15
|
+
defaultExpandAll?: boolean;
|
|
16
|
+
'aria-label'?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function SchemaTree({ schema, isLoading, onSelectTable, onSelectColumn, defaultExpandAll, variant, className, style, 'aria-label': ariaLabel, ...props }: SchemaTreeProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=schema-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-tree.d.ts","sourceRoot":"","sources":["../../src/components/schema-tree.tsx"],"names":[],"mappings":"AACA,OAAO,EAAwC,KAAK,cAAc,EAAsB,MAAM,OAAO,CAAC;AAKtG,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKlE,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOjF,eAAO,MAAM,kBAAkB;;8EAU7B,CAAC;AA2BH,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC,EAAE,YAAY,CAAC,OAAO,kBAAkB,CAAC;IACpI,iDAAiD;IACjD,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uDAAuD;IACvD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IAC7C,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IACpE,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AA6DD,wBAAgB,UAAU,CAAC,EACzB,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,SAA6B,EAAE,GAAG,KAAK,EACrJ,EAAE,eAAe,2CAgDjB"}
|