@jaw.id/ui 0.1.8 → 0.1.10
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 +1 -1
- package/cjs-error.cjs +1 -3
- package/dist/{ccip-B7vT8GlK.js → ccip-DyQ0l5E2.js} +1 -1
- package/dist/components/ConnectDialog/index.d.ts.map +1 -1
- package/dist/components/DefaultDialog/index.d.ts.map +1 -1
- package/dist/components/Eip712Dialog/index.d.ts.map +1 -1
- package/dist/components/FeeTokenSelector/index.d.ts.map +1 -1
- package/dist/components/OnboardingDialog/index.d.ts.map +1 -1
- package/dist/components/OrSeparator/index.d.ts.map +1 -1
- package/dist/components/PermissionDialog/index.d.ts.map +1 -1
- package/dist/components/SignatureDialog/index.d.ts.map +1 -1
- package/dist/components/SiweDialog/index.d.ts.map +1 -1
- package/dist/components/TransactionDialog/DecodedCalldata.d.ts +1 -1
- package/dist/components/TransactionDialog/DecodedCalldata.d.ts.map +1 -1
- package/dist/components/TransactionDialog/index.d.ts.map +1 -1
- package/dist/components/ui/accordion.d.ts +2 -2
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/avatar.d.ts +2 -2
- package/dist/components/ui/avatar.d.ts.map +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/card.d.ts +9 -9
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/checkbox.d.ts +2 -2
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/dialog.d.ts +4 -4
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts +4 -4
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/form.d.ts +6 -6
- package/dist/components/ui/form.d.ts.map +1 -1
- package/dist/components/ui/input.d.ts +2 -2
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/label.d.ts +2 -2
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/popover.d.ts +2 -2
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.d.ts +2 -2
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/select.d.ts +2 -2
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/separator.d.ts +2 -2
- package/dist/components/ui/separator.d.ts.map +1 -1
- package/dist/components/ui/sheet.d.ts +6 -6
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/spinner.d.ts +1 -1
- package/dist/components/ui/spinner.d.ts.map +1 -1
- package/dist/components/ui/tabs.d.ts +2 -2
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/ui/tooltip.d.ts +2 -2
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/hooks/useChainIconURI.d.ts.map +1 -1
- package/dist/hooks/useDecodedCalldata.d.ts.map +1 -1
- package/dist/hooks/useGasEstimation.d.ts.map +1 -1
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/{index-DLQkJ623.js → index-DYd0y78X.js} +16142 -16285
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -34
- package/dist/react/ReactUIHandler.d.ts +29 -1
- package/dist/react/ReactUIHandler.d.ts.map +1 -1
- package/dist/theme/apply-theme.d.ts +12 -0
- package/dist/theme/apply-theme.d.ts.map +1 -0
- package/dist/theme/constants.d.ts +6 -0
- package/dist/theme/constants.d.ts.map +1 -0
- package/dist/theme/index.d.ts +13 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/palette.d.ts +27 -0
- package/dist/theme/palette.d.ts.map +1 -0
- package/dist/theme/resolve-theme.d.ts +17 -0
- package/dist/theme/resolve-theme.d.ts.map +1 -0
- package/dist/theme/use-color-scheme.d.ts +39 -0
- package/dist/theme/use-color-scheme.d.ts.map +1 -0
- package/dist/utils/tokenBalance.d.ts.map +1 -1
- package/dist/utils/tokenPrice.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,39 +1,50 @@
|
|
|
1
|
-
import { h as
|
|
1
|
+
import { h as s, j as o, C as n, k as c, m as t, n as i, D as l, o as r, p as T, E as I, q as D, r as g, F as d, t as C, G as h, L as A, O as E, u as k, P as m, v as P, R as S, S as u, w as p, T as _, U, x as L, W as R, y, z as F, A as O, I as f, J as v, K as x, M as G, N as M, Q as N, V as B, X as K, Y as b, Z as w, _ as H, $ as J, a0 as W, a1 as j, a2 as q, a3 as z, a4 as Q } from "./index-DYd0y78X.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
o as
|
|
5
|
-
n as
|
|
6
|
-
c as
|
|
3
|
+
s as BORDER_RADIUS_MAP,
|
|
4
|
+
o as BadgeDollarIcon,
|
|
5
|
+
n as CloseIcon,
|
|
6
|
+
c as ConnectDialog,
|
|
7
|
+
t as CopiedIcon,
|
|
7
8
|
i as CopyIcon,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
I as
|
|
12
|
-
|
|
13
|
-
g as
|
|
14
|
-
|
|
15
|
-
C as
|
|
9
|
+
l as DEFAULT_DARK_PALETTE,
|
|
10
|
+
r as DEFAULT_LIGHT_PALETTE,
|
|
11
|
+
T as DefaultDialog,
|
|
12
|
+
I as Eip712Dialog,
|
|
13
|
+
D as EthIcon,
|
|
14
|
+
g as EyeIcon,
|
|
15
|
+
d as FONT_STACK_MAP,
|
|
16
|
+
C as FeeTokenSelector,
|
|
17
|
+
h as GenericTokenIcon,
|
|
18
|
+
A as LockIcon,
|
|
19
|
+
E as OnboardingDialog,
|
|
16
20
|
k as OrSeparator,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
m as PermissionDialog,
|
|
22
|
+
P as PortalContainerContext,
|
|
23
|
+
S as ReactUIHandler,
|
|
24
|
+
u as SignatureDialog,
|
|
25
|
+
p as SiweDialog,
|
|
26
|
+
_ as TransactionDialog,
|
|
27
|
+
U as UsdcIcon,
|
|
28
|
+
L as UsdtIcon,
|
|
29
|
+
R as WalletIcon,
|
|
30
|
+
y as applyThemeToContainer,
|
|
31
|
+
F as clearTokenPriceCache,
|
|
32
|
+
O as cn,
|
|
33
|
+
f as deriveAccentPalette,
|
|
34
|
+
v as fetchTokenBalance,
|
|
35
|
+
x as fetchTokenPrice,
|
|
36
|
+
G as formatAddress,
|
|
37
|
+
M as getDisplayAddress,
|
|
32
38
|
N as getJustaNameInstance,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
b as
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
B as getSystemColorScheme,
|
|
40
|
+
K as hexToOklch,
|
|
41
|
+
b as isNativeToken,
|
|
42
|
+
w as oklchToString,
|
|
43
|
+
H as resolveTheme,
|
|
44
|
+
J as useChainIconURI,
|
|
45
|
+
W as useColorScheme,
|
|
46
|
+
j as useDecodedCalldata,
|
|
47
|
+
q as useFeeTokenPrice,
|
|
48
|
+
z as useGasEstimation,
|
|
49
|
+
Q as useIsMobile
|
|
39
50
|
};
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import { UIHandler, UIHandlerConfig, UIRequest, UIResponse } from '../../../core/src/index.ts';
|
|
1
|
+
import { UIHandler, UIHandlerConfig, UIRequest, UIResponse, JawTheme } from '../../../core/src/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Options for ReactUIHandler constructor.
|
|
4
|
+
*/
|
|
5
|
+
export interface ReactUIHandlerOptions {
|
|
6
|
+
/** Theme configuration. Takes precedence over theme provided via JAW.create(). */
|
|
7
|
+
readonly theme?: JawTheme;
|
|
8
|
+
}
|
|
2
9
|
/**
|
|
3
10
|
* React UI handler for app-specific mode
|
|
4
11
|
*
|
|
@@ -18,15 +25,36 @@ import { UIHandler, UIHandlerConfig, UIRequest, UIResponse } from '../../../core
|
|
|
18
25
|
* uiHandler: new ReactUIHandler(),
|
|
19
26
|
* },
|
|
20
27
|
* });
|
|
28
|
+
*
|
|
29
|
+
* // With theme:
|
|
30
|
+
* const jaw2 = JAW.create({
|
|
31
|
+
* apiKey: 'your-api-key',
|
|
32
|
+
* theme: { mode: 'dark', accentColor: '#6366f1' },
|
|
33
|
+
* preference: {
|
|
34
|
+
* mode: Mode.AppSpecific,
|
|
35
|
+
* uiHandler: new ReactUIHandler({
|
|
36
|
+
* theme: { accentColor: '#7b3fe4', borderRadius: 'lg' },
|
|
37
|
+
* }),
|
|
38
|
+
* },
|
|
39
|
+
* });
|
|
21
40
|
* ```
|
|
22
41
|
*/
|
|
23
42
|
export declare class ReactUIHandler implements UIHandler {
|
|
24
43
|
private config;
|
|
44
|
+
private localTheme?;
|
|
45
|
+
constructor(options?: ReactUIHandlerOptions);
|
|
25
46
|
/**
|
|
26
47
|
* Initialize the handler with SDK configuration
|
|
27
48
|
* Called automatically by the SDK - do not call directly
|
|
28
49
|
*/
|
|
29
50
|
init(config: UIHandlerConfig): void;
|
|
51
|
+
/**
|
|
52
|
+
* Update the theme without recreating the SDK or disconnecting.
|
|
53
|
+
* Takes effect on the next dialog that opens.
|
|
54
|
+
*/
|
|
55
|
+
setTheme(theme: JawTheme): void;
|
|
56
|
+
/** Merged theme: local theme wins over init-provided theme */
|
|
57
|
+
private get effectiveTheme();
|
|
30
58
|
request<T = unknown>(request: UIRequest): Promise<UIResponse<T>>;
|
|
31
59
|
canHandle(request: UIRequest): boolean;
|
|
32
60
|
cleanup(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactUIHandler.d.ts","sourceRoot":"","sources":["../../src/react/ReactUIHandler.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,SAAS,EACT,eAAe,EACf,SAAS,EACT,UAAU,EA0BX,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ReactUIHandler.d.ts","sourceRoot":"","sources":["../../src/react/ReactUIHandler.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,SAAS,EACT,eAAe,EACf,SAAS,EACT,UAAU,EA0BX,MAAM,cAAc,CAAC;AAqBtB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AA2G7C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,kFAAkF;IAClF,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qBAAa,cAAe,YAAW,SAAS;IAC9C,OAAO,CAAC,MAAM,CAA0C;IACxD,OAAO,CAAC,UAAU,CAAC,CAAW;gBAElB,OAAO,CAAC,EAAE,qBAAqB;IAI3C;;;OAGG;IACH,IAAI,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IAInC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAI/B,8DAA8D;IAC9D,OAAO,KAAK,cAAc,GAIzB;IAEK,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IA6FtE,SAAS,CAAC,OAAO,EAAE,SAAS,GAAG,OAAO;IAahC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAU9B,OAAO,CAAC,YAAY;CAmMrB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ResolvedTheme } from './resolve-theme.js';
|
|
2
|
+
/**
|
|
3
|
+
* Apply resolved theme variables to an HTML element.
|
|
4
|
+
*
|
|
5
|
+
* - Sets every `--jaw-*` variable via `style.setProperty`
|
|
6
|
+
* - Also sets the short backwards-compat aliases (--primary, --background, etc.)
|
|
7
|
+
* so Tailwind utilities like `bg-primary` resolve correctly on this container
|
|
8
|
+
* - Toggles the `dark` class based on `colorScheme`
|
|
9
|
+
* - Sets `color-scheme` CSS property for native form controls
|
|
10
|
+
*/
|
|
11
|
+
export declare function applyThemeToContainer(container: HTMLElement, resolved: ResolvedTheme): void;
|
|
12
|
+
//# sourceMappingURL=apply-theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-theme.d.ts","sourceRoot":"","sources":["../../src/theme/apply-theme.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAmCnD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAkC3F"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { JawBorderRadius, JawFontStack } from '../../../core/src/index.ts';
|
|
2
|
+
export declare const DEFAULT_LIGHT_PALETTE: Readonly<Record<string, string>>;
|
|
3
|
+
export declare const DEFAULT_DARK_PALETTE: Readonly<Record<string, string>>;
|
|
4
|
+
export declare const BORDER_RADIUS_MAP: Readonly<Record<JawBorderRadius, string>>;
|
|
5
|
+
export declare const FONT_STACK_MAP: Readonly<Record<JawFontStack, string>>;
|
|
6
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/theme/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAM7D,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA0BjE,CAAC;AAMH,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA0BhE,CAAC;AAMH,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAItE,CAAC;AAMH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAKhE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme resolution engine for @jaw.id/ui.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all public APIs from the theme module.
|
|
5
|
+
*/
|
|
6
|
+
export { hexToOklch, oklchToString, deriveAccentPalette } from './palette.js';
|
|
7
|
+
export type { Oklch } from './palette.js';
|
|
8
|
+
export { DEFAULT_LIGHT_PALETTE, DEFAULT_DARK_PALETTE, BORDER_RADIUS_MAP, FONT_STACK_MAP } from './constants.js';
|
|
9
|
+
export { resolveTheme } from './resolve-theme.js';
|
|
10
|
+
export type { ResolvedTheme } from './resolve-theme.js';
|
|
11
|
+
export { applyThemeToContainer } from './apply-theme.js';
|
|
12
|
+
export { useColorScheme, getSystemColorScheme } from './use-color-scheme.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC9E,YAAY,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OKLCH palette generation from hex colors.
|
|
3
|
+
*
|
|
4
|
+
* Conversion chain: Hex -> sRGB -> Linear RGB -> XYZ D65 -> OKLab -> OKLCH
|
|
5
|
+
*/
|
|
6
|
+
export interface Oklch {
|
|
7
|
+
readonly l: number;
|
|
8
|
+
readonly c: number;
|
|
9
|
+
readonly h: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Convert a hex color string to OKLCH color space.
|
|
13
|
+
*/
|
|
14
|
+
export declare function hexToOklch(hex: string): Oklch;
|
|
15
|
+
/**
|
|
16
|
+
* Format an OKLCH value as a CSS `oklch(L C H)` string.
|
|
17
|
+
* L and C use 3 decimal places; H uses 1 decimal place.
|
|
18
|
+
*/
|
|
19
|
+
export declare function oklchToString(oklch: Oklch): string;
|
|
20
|
+
/**
|
|
21
|
+
* Derive accent palette CSS variables from a single hex accent color.
|
|
22
|
+
*
|
|
23
|
+
* Sets `--jaw-color-primary` (buttons, key actions) and related tokens.
|
|
24
|
+
* In dark mode, slightly lightens the accent for better visibility on dark backgrounds.
|
|
25
|
+
*/
|
|
26
|
+
export declare function deriveAccentPalette(accentHex: string, effectiveMode: 'light' | 'dark', accentColorForeground?: string): Readonly<Record<string, string>>;
|
|
27
|
+
//# sourceMappingURL=palette.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../src/theme/palette.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AAgED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAQ7C;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAKlD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,OAAO,GAAG,MAAM,EAC/B,qBAAqB,CAAC,EAAE,MAAM,GAC7B,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAwClC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { JawTheme } from '../../../core/src/index.ts';
|
|
2
|
+
export interface ResolvedTheme {
|
|
3
|
+
readonly variables: Readonly<Record<string, string>>;
|
|
4
|
+
readonly colorScheme: 'light' | 'dark';
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Resolve a `JawTheme` configuration into a flat set of CSS variables.
|
|
8
|
+
*
|
|
9
|
+
* Resolution order (later wins):
|
|
10
|
+
* 1. Default palette (light or dark)
|
|
11
|
+
* 2. Accent color overrides (derived from `accentColor`)
|
|
12
|
+
* 3. Explicit `accentColorForeground` override
|
|
13
|
+
* 4. Border radius & font stack presets
|
|
14
|
+
* 5. Raw `cssVariables` (Layer 2 user overrides)
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveTheme(theme: JawTheme, systemMode: 'light' | 'dark'): ResolvedTheme;
|
|
17
|
+
//# sourceMappingURL=resolve-theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-theme.d.ts","sourceRoot":"","sources":["../../src/theme/resolve-theme.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAKxC,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,CAAC;CACxC;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,GAAG,MAAM,GAAG,aAAa,CA+CzF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color scheme detection utilities.
|
|
3
|
+
*
|
|
4
|
+
* Provides both a React hook and a plain function for detecting the
|
|
5
|
+
* effective color scheme for SDK dialogs.
|
|
6
|
+
*
|
|
7
|
+
* Resolution order (host app's class wins):
|
|
8
|
+
* 1. `<html class="dark">` → dark (explicit, overrides OS)
|
|
9
|
+
* 2. `<html class="light">` → light (explicit, overrides OS)
|
|
10
|
+
* 3. `matchMedia('(prefers-color-scheme: dark)')` → OS preference
|
|
11
|
+
*
|
|
12
|
+
* The dual-class check is critical: if a host app uses next-themes
|
|
13
|
+
* with `value={{ light: 'light', dark: 'dark' }}`, an "absent dark
|
|
14
|
+
* class" doesn't unambiguously mean "light" — it could mean "system".
|
|
15
|
+
* Reading both classes lets the SDK distinguish explicit user choice
|
|
16
|
+
* from system fallback.
|
|
17
|
+
*
|
|
18
|
+
* The hook reactively updates when EITHER signal changes:
|
|
19
|
+
* - matchMedia change event (OS preference)
|
|
20
|
+
* - MutationObserver on <html class> (host app toggles theme class)
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Get the current effective color scheme (SSR-safe).
|
|
24
|
+
*
|
|
25
|
+
* Checks the host app's `dark`/`light` class on `<html>` first; if neither
|
|
26
|
+
* is present, falls back to the OS `prefers-color-scheme`. Returns `'light'`
|
|
27
|
+
* when `window` is undefined.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getSystemColorScheme(): 'light' | 'dark';
|
|
30
|
+
/**
|
|
31
|
+
* React hook that tracks the effective color scheme.
|
|
32
|
+
*
|
|
33
|
+
* - SSR-safe: defaults to `'light'` during server rendering
|
|
34
|
+
* - Subscribes to BOTH `matchMedia` change events (OS) and a
|
|
35
|
+
* MutationObserver on `<html>` (host app's theme class)
|
|
36
|
+
* - Cleans up both listeners on unmount
|
|
37
|
+
*/
|
|
38
|
+
export declare function useColorScheme(): 'light' | 'dark';
|
|
39
|
+
//# sourceMappingURL=use-color-scheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-color-scheme.d.ts","sourceRoot":"","sources":["../../src/theme/use-color-scheme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAMH;;;;;;GAMG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,GAAG,MAAM,CAQvD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,IAAI,OAAO,GAAG,MAAM,CA+BjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenBalance.d.ts","sourceRoot":"","sources":["../../src/utils/tokenBalance.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"tokenBalance.d.ts","sourceRoot":"","sources":["../../src/utils/tokenBalance.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBpH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenPrice.d.ts","sourceRoot":"","sources":["../../src/utils/tokenPrice.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"tokenPrice.d.ts","sourceRoot":"","sources":["../../src/utils/tokenPrice.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkCrE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jaw.id/ui",
|
|
3
3
|
"description": "Pre-built React dialogs for JAW.id",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.10",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"**/*.css",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"react-dom": ">=18.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@jaw.id/core": "0.2.
|
|
42
|
+
"@jaw.id/core": "0.2.2",
|
|
43
43
|
"@hookform/resolvers": "^5.2.2",
|
|
44
44
|
"@justaname.id/sdk": "^0.2.204",
|
|
45
45
|
"@radix-ui/react-accordion": "^1.2.12",
|