@flapsdk/vault-runtime 0.1.12 → 0.1.14
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/host.d.mts +4 -4
- package/{hostRuntimeConfig-CRN6UD01.d.mts → hostRuntimeConfig-Cx40vaeY.d.mts} +1 -1
- package/package.json +1 -1
- package/runtime-contract.json +1 -1
- package/sdk.d.mts +3 -3
- package/sdk.js +20 -20
- package/sdk.js.map +1 -1
- package/server.d.mts +3 -3
- package/{txError-DqwE18bn.d.mts → txError-DXZZ1ePk.d.mts} +1 -1
- package/{types-BjoYmdSG.d.mts → types-CYLlNk2J.d.mts} +3 -1
- package/ui.d.mts +30 -1
- package/ui.js +191 -58
- package/ui.js.map +1 -1
|
@@ -167,12 +167,14 @@ interface ManifestExternalContract {
|
|
|
167
167
|
label: string;
|
|
168
168
|
}
|
|
169
169
|
type VaultManifestLayout = "fullscreen";
|
|
170
|
+
type VaultManifestMode = "mini-app";
|
|
170
171
|
interface VaultManifest {
|
|
171
172
|
artifactId: string;
|
|
172
173
|
name: string;
|
|
173
174
|
match: {
|
|
174
175
|
bindings: ManifestBindingEntry[];
|
|
175
176
|
};
|
|
177
|
+
mode?: VaultManifestMode;
|
|
176
178
|
layout?: VaultManifestLayout;
|
|
177
179
|
endpoints?: EndpointPolicy;
|
|
178
180
|
i18n: string[];
|
|
@@ -295,4 +297,4 @@ interface VaultComponentProps {
|
|
|
295
297
|
context?: VaultRuntimeContext;
|
|
296
298
|
}
|
|
297
299
|
|
|
298
|
-
export type { ActionAvailabilityStage as A, TokenRuntimeSnapshot as B, ContractReadRequest as C, TxReceipt as D, EndpointPolicy as E, FeeMode as F, VaultHostContext as G, HostRuntimeAddresses as H, VaultManifest as I, VaultManifestLayout as J,
|
|
300
|
+
export type { ActionAvailabilityStage as A, TokenRuntimeSnapshot as B, ContractReadRequest as C, TxReceipt as D, EndpointPolicy as E, FeeMode as F, VaultHostContext as G, HostRuntimeAddresses as H, VaultManifest as I, VaultManifestLayout as J, VaultManifestMode as K, VaultRenderSurface as L, ManifestBindingEntry as M, VaultRuntimeContext as N, OracleProvision as O, PaymentToken as P, VaultRuntimeContextOverrides as Q, RuntimeOracleRegistry as R, SimulateResult as S, TokenMarketPhase as T, VaultRuntimeExtraConfig as U, VaultComponentProps as V, Address as a, ContractWriteRequest as b, CreateVaultRuntimeContextInput as c, FlapFeeVaultInfo as d, FlapI18n as e, FlapNotify as f, FlapTaxInfo as g, FlapTokenInfo as h, FlapVaultPortalInfo as i, FlapVaultSdk as j, FlapWallet as k, HostRuntimeDataSource as l, HostRuntimeDegradeReason as m, HostRuntimeInput as n, HostRuntimePolicy as o, HostRuntimePresentationFetcher as p, HostRuntimePresentationRequest as q, HostRuntimeResult as r, HostRuntimeSources as s, HostRuntimeStatus as t, HostRuntimeWarning as u, HostTokenPresentation as v, ManifestExternalContract as w, OracleReadRequest as x, OracleReader as y, TokenMetadataSnapshot as z };
|
package/ui.d.mts
CHANGED
|
@@ -58,6 +58,35 @@ interface DetailTileProps {
|
|
|
58
58
|
}
|
|
59
59
|
declare function DetailTile({ label, value, detail, icon, tone, className, valueClassName }: DetailTileProps): React.JSX.Element;
|
|
60
60
|
|
|
61
|
+
interface ExternalLinkCopy {
|
|
62
|
+
title: string;
|
|
63
|
+
heading: string;
|
|
64
|
+
description: string;
|
|
65
|
+
destinationLabel: string;
|
|
66
|
+
acknowledge: string;
|
|
67
|
+
cancel: string;
|
|
68
|
+
proceed: string;
|
|
69
|
+
}
|
|
70
|
+
interface ExternalLinkProps {
|
|
71
|
+
/** Absolute HTTPS destination. Shown to the user and opened only after explicit consent. */
|
|
72
|
+
url: string;
|
|
73
|
+
/** Trigger content (the visible link text or element). */
|
|
74
|
+
children: React.ReactNode;
|
|
75
|
+
/** Active locale for the built-in warning copy. Defaults to "en". */
|
|
76
|
+
locale?: string;
|
|
77
|
+
/** Class applied to the inline trigger button. */
|
|
78
|
+
className?: string;
|
|
79
|
+
/** Optional per-field copy overrides for the warning dialog. */
|
|
80
|
+
copy?: Partial<ExternalLinkCopy>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* ExternalLink is the sanctioned way to send a user to a non-allowlisted external
|
|
84
|
+
* site. It intercepts navigation, shows a third-party risk warning, and only opens
|
|
85
|
+
* the destination (in a new tab, with noopener/noreferrer) after the user checks the
|
|
86
|
+
* risk-acknowledgement box and confirms.
|
|
87
|
+
*/
|
|
88
|
+
declare function ExternalLink({ url, children, locale, className, copy }: ExternalLinkProps): React.JSX.Element;
|
|
89
|
+
|
|
61
90
|
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
62
91
|
}
|
|
63
92
|
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -118,4 +147,4 @@ interface VaultBannerProps {
|
|
|
118
147
|
}
|
|
119
148
|
declare function VaultBanner({ title, description, badges, meta, action, icon, className }: VaultBannerProps): React.JSX.Element;
|
|
120
149
|
|
|
121
|
-
export { AddressLink, Alert, Button, type ButtonProps, Card, CardContent, CardDescription, CardHeader, CardTitle, Countdown, DataRow, DetailTile, Input, type InputProps, IpfsBackground, type IpfsBackgroundProps, IpfsImage, type IpfsImageProps, Metric, ReviewedFrame, type ReviewedFrameProps, type ReviewedFrameProvider, StatusBadge, type StatusTone, TxButton, type TxButtonState, VaultBanner, buttonVariants };
|
|
150
|
+
export { AddressLink, Alert, Button, type ButtonProps, Card, CardContent, CardDescription, CardHeader, CardTitle, Countdown, DataRow, DetailTile, ExternalLink, type ExternalLinkProps, Input, type InputProps, IpfsBackground, type IpfsBackgroundProps, IpfsImage, type IpfsImageProps, Metric, ReviewedFrame, type ReviewedFrameProps, type ReviewedFrameProvider, StatusBadge, type StatusTone, TxButton, type TxButtonState, VaultBanner, buttonVariants };
|
package/ui.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Loader2, ExternalLink, AlertTriangle, CheckCircle2, Info, ShieldCheck } from 'lucide-react';
|
|
2
|
+
import { Loader2, ExternalLink, AlertTriangle, CheckCircle2, Info, X, ShieldCheck } from 'lucide-react';
|
|
3
3
|
import 'decimal.js';
|
|
4
4
|
import 'viem';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
|
-
import * as
|
|
7
|
+
import * as React4 from 'react';
|
|
8
8
|
import { useState, useEffect, useMemo } from 'react';
|
|
9
9
|
import { Slot } from '@radix-ui/react-slot';
|
|
10
10
|
import { cva } from 'class-variance-authority';
|
|
@@ -28,10 +28,10 @@ function cn(...inputs) {
|
|
|
28
28
|
|
|
29
29
|
// src/ui/Alert.tsx
|
|
30
30
|
var toneClass = {
|
|
31
|
-
info: "border-[#
|
|
32
|
-
success: "border-[#
|
|
33
|
-
warning: "border-[#
|
|
34
|
-
danger: "border-[#
|
|
31
|
+
info: "border-[#303236] bg-black text-[#D4D4D4]",
|
|
32
|
+
success: "border-[#D0FF00]/45 bg-[#101400] text-[#D0FF00]",
|
|
33
|
+
warning: "border-[#FFD166]/45 bg-[#1A1305] text-[#FFD166]",
|
|
34
|
+
danger: "border-[#FF4A55]/55 bg-[#1D0709] text-[#FF8A91]"
|
|
35
35
|
};
|
|
36
36
|
var iconMap = {
|
|
37
37
|
info: Info,
|
|
@@ -41,24 +41,24 @@ var iconMap = {
|
|
|
41
41
|
};
|
|
42
42
|
function Alert({ children, tone = "info", className }) {
|
|
43
43
|
const Icon = iconMap[tone];
|
|
44
|
-
return /* @__PURE__ */ React.createElement("div", { "data-flap-ui": "alert", className: cn("flex gap-3 rounded-
|
|
44
|
+
return /* @__PURE__ */ React.createElement("div", { "data-flap-ui": "alert", className: cn("flex gap-3 rounded-[6px] border p-3 text-sm font-medium leading-6", toneClass[tone], className) }, /* @__PURE__ */ React.createElement(Icon, { className: "mt-0.5 h-4 w-4 shrink-0 opacity-90" }), /* @__PURE__ */ React.createElement("div", { className: "min-w-0 break-words" }, children));
|
|
45
45
|
}
|
|
46
46
|
var buttonVariants = cva(
|
|
47
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap
|
|
47
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-semibold uppercase leading-[1.4] tracking-normal duration-0 hover:transition-colors hover:duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#D0FF00]/45 disabled:pointer-events-none disabled:opacity-50",
|
|
48
48
|
{
|
|
49
49
|
variants: {
|
|
50
50
|
variant: {
|
|
51
|
-
default: "
|
|
52
|
-
secondary: "
|
|
53
|
-
outline: "
|
|
54
|
-
ghost: "text-[#
|
|
55
|
-
destructive: "
|
|
51
|
+
default: "ui20-connect-chamfer text-[#070808] [--ui20-chamfer-bg:#D0FF00] [--ui20-chamfer-border:#D0FF00] hover:[--ui20-chamfer-bg:#BDE800] hover:[--ui20-chamfer-border:#BDE800]",
|
|
52
|
+
secondary: "ui20-connect-chamfer text-white [--ui20-chamfer-bg:#262626] [--ui20-chamfer-border:#262626] hover:text-[#D0FF00] hover:[--ui20-chamfer-bg:#303030] hover:[--ui20-chamfer-border:#303030]",
|
|
53
|
+
outline: "ui20-connect-chamfer text-[#D4D4D4] [--ui20-chamfer-bg:#000000] [--ui20-chamfer-border:#303236] hover:text-[#D0FF00] hover:[--ui20-chamfer-border:#D0FF00]",
|
|
54
|
+
ghost: "rounded-[6px] text-[#D4D4D4] hover:bg-[#131516] hover:text-[#D0FF00]",
|
|
55
|
+
destructive: "ui20-connect-chamfer text-[#FF4A55] [--ui20-chamfer-bg:#000000] [--ui20-chamfer-border:#FF4A55] hover:text-black hover:[--ui20-chamfer-bg:#FF4A55]"
|
|
56
56
|
},
|
|
57
57
|
size: {
|
|
58
58
|
default: "h-10 px-4",
|
|
59
59
|
sm: "h-8 px-3 text-xs",
|
|
60
60
|
lg: "h-12 px-5",
|
|
61
|
-
icon: "h-10 w-10"
|
|
61
|
+
icon: "h-10 w-10 px-0"
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
defaultVariants: {
|
|
@@ -67,13 +67,13 @@ var buttonVariants = cva(
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
);
|
|
70
|
-
var Button =
|
|
70
|
+
var Button = React4.forwardRef(
|
|
71
71
|
({ className, variant, size, asChild = false, loading = false, disabled, children, ...props }, ref) => {
|
|
72
72
|
const Comp = asChild ? Slot : "button";
|
|
73
73
|
if (asChild) {
|
|
74
|
-
return /* @__PURE__ */
|
|
74
|
+
return /* @__PURE__ */ React4.createElement(Comp, { "data-flap-ui": "button", className: cn(buttonVariants({ variant, size, className })), ref, ...props }, children);
|
|
75
75
|
}
|
|
76
|
-
return /* @__PURE__ */
|
|
76
|
+
return /* @__PURE__ */ React4.createElement(
|
|
77
77
|
Comp,
|
|
78
78
|
{
|
|
79
79
|
"data-flap-ui": "button",
|
|
@@ -82,39 +82,39 @@ var Button = React3.forwardRef(
|
|
|
82
82
|
disabled: disabled || loading,
|
|
83
83
|
...props
|
|
84
84
|
},
|
|
85
|
-
loading ? /* @__PURE__ */
|
|
86
|
-
children
|
|
85
|
+
loading ? /* @__PURE__ */ React4.createElement(Loader2, { className: "relative z-10 h-4 w-4 animate-spin" }) : null,
|
|
86
|
+
/* @__PURE__ */ React4.createElement("span", { className: "relative z-10 inline-flex min-w-0 items-center justify-center gap-2" }, children)
|
|
87
87
|
);
|
|
88
88
|
}
|
|
89
89
|
);
|
|
90
90
|
Button.displayName = "Button";
|
|
91
|
-
var Card =
|
|
91
|
+
var Card = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React4.createElement(
|
|
92
92
|
"div",
|
|
93
93
|
{
|
|
94
94
|
"data-flap-ui": "card",
|
|
95
95
|
ref,
|
|
96
96
|
className: cn(
|
|
97
|
-
"rounded-
|
|
97
|
+
"rounded-[8px] border border-[#303236] bg-[#070808] text-white shadow-[0_18px_60px_-42px_rgba(208,255,0,0.45)]",
|
|
98
98
|
className
|
|
99
99
|
),
|
|
100
100
|
...props
|
|
101
101
|
}
|
|
102
102
|
));
|
|
103
103
|
Card.displayName = "Card";
|
|
104
|
-
var CardHeader =
|
|
105
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
104
|
+
var CardHeader = React4.forwardRef(
|
|
105
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React4.createElement("div", { "data-flap-ui": "card-header", ref, className: cn("flex flex-col gap-1.5 p-4 sm:p-5", className), ...props })
|
|
106
106
|
);
|
|
107
107
|
CardHeader.displayName = "CardHeader";
|
|
108
|
-
var CardTitle =
|
|
109
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
108
|
+
var CardTitle = React4.forwardRef(
|
|
109
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React4.createElement("h3", { "data-flap-ui": "card-title", ref, className: cn("text-base font-semibold uppercase leading-tight tracking-normal text-white sm:text-lg", className), ...props })
|
|
110
110
|
);
|
|
111
111
|
CardTitle.displayName = "CardTitle";
|
|
112
|
-
var CardDescription =
|
|
113
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
112
|
+
var CardDescription = React4.forwardRef(
|
|
113
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React4.createElement("p", { "data-flap-ui": "card-description", ref, className: cn("text-sm leading-6 text-[#84888C]", className), ...props })
|
|
114
114
|
);
|
|
115
115
|
CardDescription.displayName = "CardDescription";
|
|
116
|
-
var CardContent =
|
|
117
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
116
|
+
var CardContent = React4.forwardRef(
|
|
117
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React4.createElement("div", { "data-flap-ui": "card-content", ref, className: cn("p-4 pt-0 sm:p-5 sm:pt-0", className), ...props })
|
|
118
118
|
);
|
|
119
119
|
CardContent.displayName = "CardContent";
|
|
120
120
|
function formatMs(ms) {
|
|
@@ -148,22 +148,155 @@ function DataRow({ label, value, detail, className }) {
|
|
|
148
148
|
|
|
149
149
|
// src/ui/DetailTile.tsx
|
|
150
150
|
var toneClass2 = {
|
|
151
|
-
default: "border-[#
|
|
152
|
-
primary: "border-[#
|
|
153
|
-
success: "border-[#
|
|
154
|
-
warning: "border-[#
|
|
155
|
-
muted: "border-[#
|
|
151
|
+
default: "border-[#303236] bg-[#0B0D0E]",
|
|
152
|
+
primary: "border-[#D0FF00]/70 bg-[#101400]",
|
|
153
|
+
success: "border-[#2EDEDB]/45 bg-[#061615]",
|
|
154
|
+
warning: "border-[#FFD166]/45 bg-[#1A1305]",
|
|
155
|
+
muted: "border-[#303236] bg-black"
|
|
156
156
|
};
|
|
157
157
|
function DetailTile({ label, value, detail, icon, tone = "default", className, valueClassName }) {
|
|
158
|
-
return /* @__PURE__ */ React.createElement("div", { "data-flap-ui": "detail-tile", className: cn("min-w-0 rounded-
|
|
158
|
+
return /* @__PURE__ */ React.createElement("div", { "data-flap-ui": "detail-tile", className: cn("min-w-0 rounded-[6px] border p-3", toneClass2[tone], className) }, /* @__PURE__ */ React.createElement("div", { className: "flex min-w-0 items-center gap-2 text-xs font-medium uppercase leading-[1.4] text-[#84888C]" }, icon ? /* @__PURE__ */ React.createElement("span", { className: "shrink-0 text-[#D0FF00]" }, icon) : null, /* @__PURE__ */ React.createElement("span", { className: "min-w-0 truncate" }, label)), /* @__PURE__ */ React.createElement("div", { className: cn("mt-2 min-w-0 break-words text-base font-semibold leading-snug text-white", valueClassName) }, value), detail ? /* @__PURE__ */ React.createElement("div", { className: "mt-1 min-w-0 break-words text-xs leading-5 text-[#84888C]" }, detail) : null);
|
|
159
159
|
}
|
|
160
|
-
var
|
|
160
|
+
var COPY = {
|
|
161
|
+
en: {
|
|
162
|
+
title: "THIRD-PARTY WARNING",
|
|
163
|
+
heading: "YOU ARE LEAVING FLAP",
|
|
164
|
+
description: "You are about to visit a third-party page maintained by an external developer. This site is not operated by FLAP and may contain unknown security or privacy risks.",
|
|
165
|
+
destinationLabel: "Destination",
|
|
166
|
+
acknowledge: "I understand the risks and want to proceed",
|
|
167
|
+
cancel: "CLOSE",
|
|
168
|
+
proceed: "CONTINUE"
|
|
169
|
+
},
|
|
170
|
+
zh: {
|
|
171
|
+
title: "\u7B2C\u4E09\u65B9\u98CE\u9669\u63D0\u793A",
|
|
172
|
+
heading: "\u60A8\u5373\u5C06\u79BB\u5F00 FLAP",
|
|
173
|
+
description: "\u60A8\u5373\u5C06\u8BBF\u95EE\u7531\u5916\u90E8\u5F00\u53D1\u8005\u7EF4\u62A4\u7684\u7B2C\u4E09\u65B9\u9875\u9762\u3002\u8BE5\u7AD9\u70B9\u4E0D\u7531 FLAP \u8FD0\u8425\uFF0C\u53EF\u80FD\u5B58\u5728\u672A\u77E5\u7684\u5B89\u5168\u6216\u9690\u79C1\u98CE\u9669\u3002",
|
|
174
|
+
destinationLabel: "\u76EE\u6807\u5730\u5740",
|
|
175
|
+
acknowledge: "\u6211\u5DF2\u4E86\u89E3\u98CE\u9669\u5E76\u5E0C\u671B\u7EE7\u7EED",
|
|
176
|
+
cancel: "\u5173\u95ED",
|
|
177
|
+
proceed: "\u7EE7\u7EED"
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
function resolveLocale(locale) {
|
|
181
|
+
return locale && locale.toLowerCase().startsWith("zh") ? "zh" : "en";
|
|
182
|
+
}
|
|
183
|
+
function safeHost(url) {
|
|
184
|
+
try {
|
|
185
|
+
return new URL(url).host;
|
|
186
|
+
} catch {
|
|
187
|
+
return url;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function WarningIcon({ className }) {
|
|
191
|
+
return /* @__PURE__ */ React4.createElement(
|
|
192
|
+
"svg",
|
|
193
|
+
{
|
|
194
|
+
viewBox: "0 0 48 44",
|
|
195
|
+
role: "img",
|
|
196
|
+
"aria-hidden": "true",
|
|
197
|
+
className,
|
|
198
|
+
fill: "none",
|
|
199
|
+
stroke: "#FF7A1A",
|
|
200
|
+
strokeWidth: 3,
|
|
201
|
+
strokeLinejoin: "miter",
|
|
202
|
+
strokeLinecap: "square",
|
|
203
|
+
shapeRendering: "crispEdges"
|
|
204
|
+
},
|
|
205
|
+
/* @__PURE__ */ React4.createElement("path", { d: "M24 4 L46 42 L2 42 Z" }),
|
|
206
|
+
/* @__PURE__ */ React4.createElement("rect", { x: "22", y: "17", width: "4", height: "12", fill: "#FF7A1A", stroke: "none" }),
|
|
207
|
+
/* @__PURE__ */ React4.createElement("rect", { x: "22", y: "33", width: "4", height: "4", fill: "#FF7A1A", stroke: "none" })
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
function ExternalLink2({ url, children, locale, className, copy }) {
|
|
211
|
+
const [open, setOpen] = React4.useState(false);
|
|
212
|
+
const [acknowledged, setAcknowledged] = React4.useState(false);
|
|
213
|
+
const text = { ...COPY[resolveLocale(locale)], ...copy };
|
|
214
|
+
const close = React4.useCallback(() => {
|
|
215
|
+
setOpen(false);
|
|
216
|
+
setAcknowledged(false);
|
|
217
|
+
}, []);
|
|
218
|
+
React4.useEffect(() => {
|
|
219
|
+
if (!open) return;
|
|
220
|
+
const onKey = (event) => {
|
|
221
|
+
if (event.key === "Escape") close();
|
|
222
|
+
};
|
|
223
|
+
document.addEventListener("keydown", onKey);
|
|
224
|
+
const previousOverflow = document.body.style.overflow;
|
|
225
|
+
document.body.style.overflow = "hidden";
|
|
226
|
+
return () => {
|
|
227
|
+
document.removeEventListener("keydown", onKey);
|
|
228
|
+
document.body.style.overflow = previousOverflow;
|
|
229
|
+
};
|
|
230
|
+
}, [open, close]);
|
|
231
|
+
const proceed = () => {
|
|
232
|
+
if (!acknowledged) return;
|
|
233
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
234
|
+
close();
|
|
235
|
+
};
|
|
236
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(
|
|
237
|
+
"button",
|
|
238
|
+
{
|
|
239
|
+
type: "button",
|
|
240
|
+
"data-flap-ui": "external-link",
|
|
241
|
+
onClick: () => setOpen(true),
|
|
242
|
+
className: cn("inline-flex min-w-0 items-center gap-1 text-primary hover:underline", className)
|
|
243
|
+
},
|
|
244
|
+
/* @__PURE__ */ React4.createElement("span", { className: "truncate" }, children),
|
|
245
|
+
/* @__PURE__ */ React4.createElement(ExternalLink, { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": "true" })
|
|
246
|
+
), open ? /* @__PURE__ */ React4.createElement(
|
|
247
|
+
"div",
|
|
248
|
+
{
|
|
249
|
+
className: "fixed inset-0 z-[100] flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",
|
|
250
|
+
onClick: close
|
|
251
|
+
},
|
|
252
|
+
/* @__PURE__ */ React4.createElement(
|
|
253
|
+
"div",
|
|
254
|
+
{
|
|
255
|
+
role: "dialog",
|
|
256
|
+
"aria-modal": "true",
|
|
257
|
+
"aria-label": text.title,
|
|
258
|
+
onClick: (event) => event.stopPropagation(),
|
|
259
|
+
className: "flex max-h-[calc(100vh-2rem)] w-[min(520px,100%)] flex-col overflow-hidden rounded-sm border border-primary bg-black font-mono text-white shadow-panel"
|
|
260
|
+
},
|
|
261
|
+
/* @__PURE__ */ React4.createElement("div", { className: "flex items-center justify-between border-b border-primary/60 px-4 py-3 sm:px-5" }, /* @__PURE__ */ React4.createElement("span", { className: "truncate text-sm font-semibold uppercase tracking-wider sm:text-base" }, /* @__PURE__ */ React4.createElement("span", { className: "text-[#D0FF00]" }, "//"), text.title), /* @__PURE__ */ React4.createElement(
|
|
262
|
+
"button",
|
|
263
|
+
{
|
|
264
|
+
type: "button",
|
|
265
|
+
onClick: close,
|
|
266
|
+
"aria-label": text.cancel,
|
|
267
|
+
className: "flex h-7 w-7 shrink-0 items-center justify-center border border-[#303236] text-[#D4D4D4] hover:border-primary hover:text-primary"
|
|
268
|
+
},
|
|
269
|
+
/* @__PURE__ */ React4.createElement(X, { className: "h-4 w-4" })
|
|
270
|
+
)),
|
|
271
|
+
/* @__PURE__ */ React4.createElement("div", { className: "flex flex-col gap-5 overflow-y-auto px-5 py-6 sm:px-7 sm:py-8" }, /* @__PURE__ */ React4.createElement(WarningIcon, { className: "mx-auto h-16 w-16 sm:h-20 sm:w-20" }), /* @__PURE__ */ React4.createElement("h2", { className: "text-center text-lg font-semibold uppercase tracking-wide sm:text-xl" }, text.heading), /* @__PURE__ */ React4.createElement("p", { className: "text-xs leading-6 text-[#A3A3A3] sm:text-sm" }, text.description), /* @__PURE__ */ React4.createElement("div", { className: "min-w-0 border border-[#262626] bg-[#0A0A0A] px-3 py-2 text-[11px] sm:text-xs" }, /* @__PURE__ */ React4.createElement("div", { className: "mb-1 uppercase tracking-wider text-[#6B7280]" }, text.destinationLabel), /* @__PURE__ */ React4.createElement("div", { className: "truncate text-[#D4D4D4]", title: url }, safeHost(url))), /* @__PURE__ */ React4.createElement("label", { className: "flex cursor-pointer items-start gap-3 text-xs text-[#D4D4D4] sm:text-sm" }, /* @__PURE__ */ React4.createElement(
|
|
272
|
+
"input",
|
|
273
|
+
{
|
|
274
|
+
type: "checkbox",
|
|
275
|
+
checked: acknowledged,
|
|
276
|
+
onChange: (event) => setAcknowledged(event.target.checked),
|
|
277
|
+
className: "sr-only"
|
|
278
|
+
}
|
|
279
|
+
), /* @__PURE__ */ React4.createElement(
|
|
280
|
+
"span",
|
|
281
|
+
{
|
|
282
|
+
"aria-hidden": "true",
|
|
283
|
+
className: cn(
|
|
284
|
+
"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center border",
|
|
285
|
+
acknowledged ? "border-[#D0FF00] bg-[#D0FF00] text-black" : "border-[#4B5563] bg-transparent"
|
|
286
|
+
)
|
|
287
|
+
},
|
|
288
|
+
acknowledged ? /* @__PURE__ */ React4.createElement("svg", { viewBox: "0 0 12 12", className: "h-3 w-3", fill: "none", stroke: "currentColor", strokeWidth: 2 }, /* @__PURE__ */ React4.createElement("path", { d: "M2 6.5 L5 9 L10 3", strokeLinecap: "square" })) : null
|
|
289
|
+
), /* @__PURE__ */ React4.createElement("span", { className: "min-w-0" }, text.acknowledge)), /* @__PURE__ */ React4.createElement("div", { className: "flex flex-col gap-3 pt-1 sm:flex-row" }, /* @__PURE__ */ React4.createElement(Button, { variant: "outline", size: "lg", className: "w-full sm:flex-1", onClick: close }, text.cancel), /* @__PURE__ */ React4.createElement(Button, { variant: "default", size: "lg", className: "w-full sm:flex-1", disabled: !acknowledged, onClick: proceed }, text.proceed)))
|
|
290
|
+
)
|
|
291
|
+
) : null);
|
|
292
|
+
}
|
|
293
|
+
var Input = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React4.createElement(
|
|
161
294
|
"input",
|
|
162
295
|
{
|
|
163
296
|
"data-flap-ui": "input",
|
|
164
297
|
ref,
|
|
165
298
|
className: cn(
|
|
166
|
-
"flex h-11 w-full rounded-
|
|
299
|
+
"flex h-11 w-full rounded-[6px] border border-[#303236] bg-black px-3 py-2 text-sm font-semibold text-white caret-[#D0FF00] shadow-[inset_0_1px_0_rgba(255,255,255,0.04)] outline-none duration-0 selection:bg-[#D0FF00]/35 selection:text-white placeholder:text-[#84888C] focus:border-[#D0FF00] focus:ring-2 focus:ring-[#D0FF00]/25 disabled:cursor-not-allowed disabled:bg-[#131516] disabled:text-[#84888C] disabled:opacity-80",
|
|
167
300
|
className
|
|
168
301
|
),
|
|
169
302
|
...props
|
|
@@ -212,16 +345,16 @@ function resolveIpfsImageUrls(cid, chainId = 56) {
|
|
|
212
345
|
|
|
213
346
|
// src/ui/IpfsImage.tsx
|
|
214
347
|
function IpfsImage({ alt, cid, className, decoding = "async", loading = "lazy", onError, ...props }) {
|
|
215
|
-
const urls =
|
|
216
|
-
const [urlIndex, setUrlIndex] =
|
|
348
|
+
const urls = React4.useMemo(() => resolveIpfsImageUrls(cid), [cid]);
|
|
349
|
+
const [urlIndex, setUrlIndex] = React4.useState(0);
|
|
217
350
|
const src = urls[urlIndex];
|
|
218
|
-
|
|
351
|
+
React4.useEffect(() => {
|
|
219
352
|
setUrlIndex(0);
|
|
220
353
|
}, [cid]);
|
|
221
354
|
if (!src) return null;
|
|
222
355
|
return (
|
|
223
356
|
// eslint-disable-next-line @next/next/no-img-element -- IpfsImage owns CID-to-gateway fallback; next/image cannot represent this boundary.
|
|
224
|
-
/* @__PURE__ */
|
|
357
|
+
/* @__PURE__ */ React4.createElement(
|
|
225
358
|
"img",
|
|
226
359
|
{
|
|
227
360
|
...props,
|
|
@@ -244,26 +377,26 @@ function IpfsImage({ alt, cid, className, decoding = "async", loading = "lazy",
|
|
|
244
377
|
|
|
245
378
|
// src/ui/IpfsBackground.tsx
|
|
246
379
|
function IpfsBackground({ cid, className, imageClassName, overlayClassName, ...props }) {
|
|
247
|
-
return /* @__PURE__ */
|
|
380
|
+
return /* @__PURE__ */ React4.createElement("div", { ...props, "aria-hidden": "true", className: cn("pointer-events-none absolute inset-0 overflow-hidden", className) }, /* @__PURE__ */ React4.createElement(IpfsImage, { alt: "", cid, className: cn("h-full w-full object-cover", imageClassName), loading: "eager" }), overlayClassName ? /* @__PURE__ */ React4.createElement("div", { className: cn("absolute inset-0", overlayClassName) }) : null);
|
|
248
381
|
}
|
|
249
382
|
|
|
250
383
|
// src/ui/Metric.tsx
|
|
251
384
|
var toneClass3 = {
|
|
252
|
-
default: "border-[#
|
|
253
|
-
primary: "border-[#
|
|
254
|
-
success: "border-[#
|
|
255
|
-
warning: "border-[#
|
|
256
|
-
muted: "border-[#
|
|
385
|
+
default: "border-[#303236] bg-[#0B0D0E]",
|
|
386
|
+
primary: "border-[#D0FF00]/70 bg-[#101400]",
|
|
387
|
+
success: "border-[#2EDEDB]/45 bg-[#061615]",
|
|
388
|
+
warning: "border-[#FFD166]/45 bg-[#1A1305]",
|
|
389
|
+
muted: "border-[#303236] bg-black"
|
|
257
390
|
};
|
|
258
391
|
var valueToneClass = {
|
|
259
392
|
default: "text-white",
|
|
260
|
-
primary: "text-[#
|
|
261
|
-
success: "text-[#
|
|
262
|
-
warning: "text-[#
|
|
393
|
+
primary: "text-[#D0FF00]",
|
|
394
|
+
success: "text-[#2EDEDB]",
|
|
395
|
+
warning: "text-[#FFD166]",
|
|
263
396
|
muted: "text-white"
|
|
264
397
|
};
|
|
265
398
|
function Metric({ label, value, hint, tone = "default", className }) {
|
|
266
|
-
return /* @__PURE__ */ React.createElement("div", { "data-flap-ui": "metric", className: cn("rounded-
|
|
399
|
+
return /* @__PURE__ */ React.createElement("div", { "data-flap-ui": "metric", className: cn("rounded-[6px] border p-3", toneClass3[tone], className) }, /* @__PURE__ */ React.createElement("div", { className: "truncate text-xs font-medium uppercase leading-[1.4] text-[#84888C]" }, label), /* @__PURE__ */ React.createElement("div", { className: cn("mt-2 break-words text-xl font-semibold tracking-normal", valueToneClass[tone]) }, value), hint ? /* @__PURE__ */ React.createElement("div", { className: "mt-1 truncate text-xs text-[#D4D4D4]" }, hint) : null);
|
|
267
400
|
}
|
|
268
401
|
function ReviewedFrame({ className, frameId, provider, src, title, ...props }) {
|
|
269
402
|
const {
|
|
@@ -275,7 +408,7 @@ function ReviewedFrame({ className, frameId, provider, src, title, ...props }) {
|
|
|
275
408
|
title: _title,
|
|
276
409
|
...safeProps
|
|
277
410
|
} = props;
|
|
278
|
-
return /* @__PURE__ */
|
|
411
|
+
return /* @__PURE__ */ React4.createElement(
|
|
279
412
|
"iframe",
|
|
280
413
|
{
|
|
281
414
|
...safeProps,
|
|
@@ -293,13 +426,13 @@ function ReviewedFrame({ className, frameId, provider, src, title, ...props }) {
|
|
|
293
426
|
|
|
294
427
|
// src/ui/StatusBadge.tsx
|
|
295
428
|
var toneClass4 = {
|
|
296
|
-
neutral: "border-[#
|
|
297
|
-
success: "border-[#
|
|
298
|
-
warning: "border-[#
|
|
299
|
-
danger: "border-[#
|
|
429
|
+
neutral: "border-[#303236] bg-black text-[#D4D4D4]",
|
|
430
|
+
success: "border-[#D0FF00]/65 bg-[#101400] text-[#D0FF00]",
|
|
431
|
+
warning: "border-[#FFD166]/55 bg-[#1A1305] text-[#FFD166]",
|
|
432
|
+
danger: "border-[#FF4A55]/65 bg-[#1D0709] text-[#FF8A91]"
|
|
300
433
|
};
|
|
301
434
|
function StatusBadge({ children, tone = "neutral" }) {
|
|
302
|
-
return /* @__PURE__ */ React.createElement("span", { "data-flap-ui": "status-badge", className: cn("inline-flex items-center rounded-
|
|
435
|
+
return /* @__PURE__ */ React.createElement("span", { "data-flap-ui": "status-badge", className: cn("inline-flex items-center rounded-[6px] border px-2.5 py-1 text-xs font-semibold uppercase leading-none", toneClass4[tone]) }, children);
|
|
303
436
|
}
|
|
304
437
|
|
|
305
438
|
// src/ui/TxButton.tsx
|
|
@@ -331,6 +464,6 @@ function VaultBanner({ title, description, badges, meta, action, icon, className
|
|
|
331
464
|
);
|
|
332
465
|
}
|
|
333
466
|
|
|
334
|
-
export { AddressLink, Alert, Button, Card, CardContent, CardDescription, CardHeader, CardTitle, Countdown, DataRow, DetailTile, Input, IpfsBackground, IpfsImage, Metric, ReviewedFrame, StatusBadge, TxButton, VaultBanner, buttonVariants };
|
|
467
|
+
export { AddressLink, Alert, Button, Card, CardContent, CardDescription, CardHeader, CardTitle, Countdown, DataRow, DetailTile, ExternalLink2 as ExternalLink, Input, IpfsBackground, IpfsImage, Metric, ReviewedFrame, StatusBadge, TxButton, VaultBanner, buttonVariants };
|
|
335
468
|
//# sourceMappingURL=ui.js.map
|
|
336
469
|
//# sourceMappingURL=ui.js.map
|