@james-wu/tokenguard-ui 0.1.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/LICENSE ADDED
@@ -0,0 +1,184 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
13
+ owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities
16
+ that control, are controlled by, or are under common control with that entity.
17
+ For the purposes of this definition, "control" means (i) the power, direct or
18
+ indirect, to cause the direction or management of such entity, whether by
19
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
23
+ permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications, including
26
+ but not limited to software source code, documentation source, and configuration
27
+ files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical transformation or
30
+ translation of a Source form, including but not limited to compiled object code,
31
+ generated documentation, and conversions to other media types.
32
+
33
+ "Work" shall mean the work of authorship, whether in Source or Object form,
34
+ made available under the License, as indicated by a copyright notice that is
35
+ included in or attached to the work (an example is provided in the Appendix
36
+ below).
37
+
38
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
39
+ is based on (or derived from) the Work and for which the editorial revisions,
40
+ annotations, elaborations, or other modifications represent, as a whole, an
41
+ original work of authorship. For the purposes of this License, Derivative Works
42
+ shall not include works that remain separable from, or merely link (or bind by
43
+ name) to the interfaces of, the Work and Derivative Works thereof.
44
+
45
+ "Contribution" shall mean any work of authorship, including the original
46
+ version of the Work and any modifications or additions to that Work or
47
+ Derivative Works thereof, that is intentionally submitted to Licensor for
48
+ inclusion in the Work by the copyright owner or by an individual or Legal
49
+ Entity authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submitted" means any form of electronic, verbal, or
51
+ written communication sent to the Licensor or its representatives, including
52
+ but not limited to communication on electronic mailing lists, source code
53
+ control systems, and issue tracking systems that are managed by, or on behalf
54
+ of, the Licensor for the purpose of discussing and improving the Work, but
55
+ excluding communication that is conspicuously marked or otherwise designated in
56
+ writing by the copyright owner as "Not a Contribution."
57
+
58
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
59
+ of whom a Contribution has been received by Licensor and subsequently
60
+ incorporated within the Work.
61
+
62
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
63
+ License, each Contributor hereby grants to You a perpetual, worldwide,
64
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
65
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
66
+ sublicense, and distribute the Work and such Derivative Works in Source or
67
+ Object form.
68
+
69
+ 3. Grant of Patent License. Subject to the terms and conditions of this
70
+ License, each Contributor hereby grants to You a perpetual, worldwide,
71
+ non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
72
+ section) patent license to make, have made, use, offer to sell, sell, import,
73
+ and otherwise transfer the Work, where such license applies only to those
74
+ patent claims licensable by such Contributor that are necessarily infringed by
75
+ their Contribution(s) alone or by combination of their Contribution(s) with the
76
+ Work to which such Contribution(s) was submitted. If You institute patent
77
+ litigation against any entity (including a cross-claim or counterclaim in a
78
+ lawsuit) alleging that the Work or a Contribution incorporated within the Work
79
+ constitutes direct or contributory patent infringement, then any patent
80
+ licenses granted to You under this License for that Work shall terminate as of
81
+ the date such litigation is filed.
82
+
83
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
84
+ Derivative Works thereof in any medium, with or without modifications, and in
85
+ Source or Object form, provided that You meet the following conditions:
86
+
87
+ (a) You must give any other recipients of the Work or Derivative Works a copy
88
+ of this License; and
89
+
90
+ (b) You must cause any modified files to carry prominent notices stating that
91
+ You changed the files; and
92
+
93
+ (c) You must retain, in the Source form of any Derivative Works that You
94
+ distribute, all copyright, patent, trademark, and attribution notices from the
95
+ Source form of the Work, excluding those notices that do not pertain to any
96
+ part of the Derivative Works; and
97
+
98
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then
99
+ any Derivative Works that You distribute must include a readable copy of the
100
+ attribution notices contained within such NOTICE file, excluding those notices
101
+ that do not pertain to any part of the Derivative Works, in at least one of the
102
+ following places: within a NOTICE text file distributed as part of the
103
+ Derivative Works; within the Source form or documentation, if provided along
104
+ with the Derivative Works; or, within a display generated by the Derivative
105
+ Works, if and wherever such third-party notices normally appear. The contents
106
+ of the NOTICE file are for informational purposes only and do not modify the
107
+ License. You may add Your own attribution notices within Derivative Works that
108
+ You distribute, alongside or as an addendum to the NOTICE text from the Work,
109
+ provided that such additional attribution notices cannot be construed as
110
+ modifying the License.
111
+
112
+ You may add Your own copyright statement to Your modifications and may provide
113
+ additional or different license terms and conditions for use, reproduction, or
114
+ distribution of Your modifications, or for any such Derivative Works as a
115
+ whole, provided Your use, reproduction, and distribution of the Work otherwise
116
+ complies with the conditions stated in this License.
117
+
118
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
119
+ Contribution intentionally submitted for inclusion in the Work by You to the
120
+ Licensor shall be under the terms and conditions of this License, without any
121
+ additional terms or conditions. Notwithstanding the above, nothing herein shall
122
+ supersede or modify the terms of any separate license agreement you may have
123
+ executed with Licensor regarding such Contributions.
124
+
125
+ 6. Trademarks. This License does not grant permission to use the trade names,
126
+ trademarks, service marks, or product names of the Licensor, except as required
127
+ for reasonable and customary use in describing the origin of the Work and
128
+ reproducing the content of the NOTICE file.
129
+
130
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
131
+ writing, Licensor provides the Work (and each Contributor provides its
132
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
133
+ KIND, either express or implied, including, without limitation, any warranties
134
+ or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
135
+ PARTICULAR PURPOSE. You are solely responsible for determining the
136
+ appropriateness of using or redistributing the Work and assume any risks
137
+ associated with Your exercise of permissions under this License.
138
+
139
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
140
+ tort (including negligence), contract, or otherwise, unless required by
141
+ applicable law (such as deliberate and grossly negligent acts) or agreed to in
142
+ writing, shall any Contributor be liable to You for damages, including any
143
+ direct, indirect, special, incidental, or consequential damages of any
144
+ character arising as a result of this License or out of the use or inability to
145
+ use the Work (including but not limited to damages for loss of goodwill, work
146
+ stoppage, computer failure or malfunction, or any and all other commercial
147
+ damages or losses), even if such Contributor has been advised of the
148
+ possibility of such damages.
149
+
150
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
151
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
152
+ acceptance of support, warranty, indemnity, or other liability obligations
153
+ and/or rights consistent with this License. However, in accepting such
154
+ obligations, You may act only on Your own behalf and on Your sole
155
+ responsibility, not on behalf of any other Contributor, and only if You agree
156
+ to indemnify, defend, and hold each Contributor harmless for any liability
157
+ incurred by, or claims asserted against, such Contributor by reason of your
158
+ accepting any such warranty or additional liability.
159
+
160
+ END OF TERMS AND CONDITIONS
161
+
162
+ APPENDIX: How to apply the Apache License to your work.
163
+
164
+ To apply the Apache License to your work, attach the following boilerplate
165
+ notice, with the fields enclosed by brackets "[]" replaced with your own
166
+ identifying information. (Don't include the brackets.) The text should be
167
+ enclosed in the appropriate comment syntax for the file format. We also
168
+ recommend that a file or class name and description of purpose be included on
169
+ the same "printed page" as the copyright notice for easier identification
170
+ within third-party archives.
171
+
172
+ Copyright [yyyy] [name of copyright owner]
173
+
174
+ Licensed under the Apache License, Version 2.0 (the "License");
175
+ you may not use this file except in compliance with the License.
176
+ You may obtain a copy of the License at
177
+
178
+ http://www.apache.org/licenses/LICENSE-2.0
179
+
180
+ Unless required by applicable law or agreed to in writing, software
181
+ distributed under the License is distributed on an "AS IS" BASIS,
182
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
183
+ See the License for the specific language governing permissions and
184
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,87 @@
1
+ # `@james-wu/tokenguard-ui`
2
+
3
+ Embeddable UI components for rendering TokenGuard risk alerts, phishing banners, and AI explanation panels inside wallets, browser extensions, exchanges, and security dashboards.
4
+
5
+ Best for:
6
+
7
+ - wallet popups and confirmation dialogs
8
+ - extension pages and side panels
9
+ - exchange or analyst dashboards
10
+ - lightweight framework-agnostic embeds
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @james-wu/tokenguard-ui
16
+ ```
17
+
18
+ ## Links
19
+
20
+ - Repository: [James-Wuguoqing/tokenguard-ai](https://github.com/James-Wuguoqing/tokenguard-ai)
21
+ - Package: [npmjs.com/package/@james-wu/tokenguard-ui](https://www.npmjs.com/package/@james-wu/tokenguard-ui)
22
+ - SDK package: [npmjs.com/package/@james-wu/tokenguard-sdk](https://www.npmjs.com/package/@james-wu/tokenguard-sdk)
23
+ - Embedded widget example: [examples/embedded-widget](https://github.com/James-Wuguoqing/tokenguard-ai/tree/main/examples/embedded-widget)
24
+ - Local demo console: [demo/index.html](https://github.com/James-Wuguoqing/tokenguard-ai/blob/main/demo/index.html)
25
+
26
+ ## Included
27
+
28
+ - `RiskAlertCard()`
29
+ - `DomainWarningBanner()`
30
+ - `AIExplainPanel()`
31
+ - `clearNode()`
32
+ - `injectTokenGuardStyles()`
33
+ - `tokenGuardBaseStyles`
34
+
35
+ ## Quick Start
36
+
37
+ ```ts
38
+ import {
39
+ AIExplainPanel,
40
+ RiskAlertCard,
41
+ injectTokenGuardStyles
42
+ } from "@james-wu/tokenguard-ui";
43
+
44
+ injectTokenGuardStyles();
45
+
46
+ const riskCard = RiskAlertCard({
47
+ riskLevel: "high",
48
+ title: "High-risk approval detected",
49
+ summary: "This action would allow a third party to spend your tokens.",
50
+ score: 92,
51
+ reasons: ["infinite_approval_detected", "suspicious_origin_domain"],
52
+ actions: ["Cancel the signature", "Switch to an exact approval amount"]
53
+ });
54
+
55
+ const explainPanel = AIExplainPanel({
56
+ title: "Why this matters",
57
+ explanation: "This is not a wallet login request. It is a token approval with long-lived permissions.",
58
+ bullets: ["The spender can move assets later.", "The page origin looks suspicious."],
59
+ caution: "Verify the site and contract before signing."
60
+ });
61
+
62
+ document.body.append(riskCard, explainPanel);
63
+ ```
64
+
65
+ ## Usage Model
66
+
67
+ This package renders UI only. It does not fetch risk data by itself.
68
+
69
+ Typical integration flow:
70
+
71
+ 1. call the TokenGuard API directly or via `@james-wu/tokenguard-sdk`
72
+ 2. map the returned risk result into UI props
73
+ 3. render the corresponding card, banner, or explanation panel
74
+
75
+ ## Styling
76
+
77
+ - Components return plain DOM nodes, which makes the package friendly for lightweight or framework-agnostic embeds.
78
+ - Styles are not injected automatically. Call `injectTokenGuardStyles()` before rendering if you want the default look.
79
+ - If you already have a design system, you can reuse the generated structure and replace the styling layer.
80
+
81
+ ## Pairing With The SDK
82
+
83
+ The usual production flow is:
84
+
85
+ 1. fetch a structured risk result with `@james-wu/tokenguard-sdk` or the HTTP API
86
+ 2. map that result into UI props
87
+ 3. render the corresponding card, warning banner, or explanation panel
@@ -0,0 +1,9 @@
1
+ import type { AIExplainSourceBarProps, AIExplainPanelProps, DomainWarningBannerProps, RiskAlertCardProps } from "./types.js";
2
+ export { injectTokenGuardStyles, tokenGuardBaseStyles } from "./styles.js";
3
+ export declare function clearNode(target: Element): void;
4
+ export declare function RiskAlertCard(props: RiskAlertCardProps): HTMLElement;
5
+ export declare function DomainWarningBanner(props: DomainWarningBannerProps): HTMLElement;
6
+ export declare function AIExplainPanel(props: AIExplainPanelProps): HTMLElement;
7
+ export declare function AIExplainSourceBar(props: AIExplainSourceBarProps): HTMLElement;
8
+ export type { AIExplainPanelProps, AIExplainSourceBarProps, AIExplainSourceMeta, AIExplainSourceStatus, DomainWarningBannerProps, RiskAlertCardProps, RiskLevel, UserLevel } from "./types.js";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,kBAAkB,EAGnB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAgC3E,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAE/C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,WAAW,CAiCpE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,WAAW,CAQhF;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,WAAW,CA+BtE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,WAAW,CAqC9E;AAED,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EAClB,SAAS,EACT,SAAS,EACV,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,116 @@
1
+ export { injectTokenGuardStyles, tokenGuardBaseStyles } from "./styles.js";
2
+ function createElement(tag, className, textContent) {
3
+ const element = document.createElement(tag);
4
+ if (className) {
5
+ element.className = className;
6
+ }
7
+ if (textContent) {
8
+ element.textContent = textContent;
9
+ }
10
+ return element;
11
+ }
12
+ function levelLabel(riskLevel) {
13
+ if (riskLevel === "high") {
14
+ return "高风险";
15
+ }
16
+ if (riskLevel === "medium") {
17
+ return "中风险";
18
+ }
19
+ return "低风险";
20
+ }
21
+ export function clearNode(target) {
22
+ target.replaceChildren();
23
+ }
24
+ export function RiskAlertCard(props) {
25
+ const card = createElement("article", `tg-card tg-card--${props.riskLevel}`);
26
+ const header = createElement("div", "tg-card__header");
27
+ const badge = createElement("span", "tg-badge", levelLabel(props.riskLevel));
28
+ const title = createElement("h3", "tg-card__title", props.title);
29
+ const summary = createElement("p", "tg-card__summary", props.summary);
30
+ const meta = createElement("div", "tg-card__meta");
31
+ const actions = createElement("ul", "tg-card__list");
32
+ header.append(badge, title);
33
+ if (typeof props.score === "number") {
34
+ meta.append(createElement("span", "tg-card__score", `Risk Score ${props.score}`));
35
+ }
36
+ if (props.reasons?.length) {
37
+ const reasons = createElement("div", "tg-pill-row");
38
+ for (const reason of props.reasons) {
39
+ reasons.append(createElement("span", "tg-pill", reason));
40
+ }
41
+ meta.append(reasons);
42
+ }
43
+ for (const action of props.actions) {
44
+ const item = createElement("li", "tg-card__list-item", action);
45
+ actions.append(item);
46
+ }
47
+ card.append(header, summary, meta, actions);
48
+ return card;
49
+ }
50
+ export function DomainWarningBanner(props) {
51
+ const banner = createElement("section", `tg-banner ${props.visible ? "is-visible" : ""}`);
52
+ const label = createElement("strong", "tg-banner__label", "Domain Guard");
53
+ const message = createElement("p", "tg-banner__message", props.message);
54
+ banner.append(label, message);
55
+ return banner;
56
+ }
57
+ export function AIExplainPanel(props) {
58
+ const panel = createElement("section", "tg-ai-panel");
59
+ const head = createElement("div", "tg-ai-panel__head");
60
+ const title = createElement("h4", "tg-ai-panel__title", props.title ?? "AI 风险解释");
61
+ const eyebrow = createElement("span", "tg-ai-panel__eyebrow", props.level === "advanced" ? "Advanced Lens" : "AI Explain");
62
+ const body = createElement("p", "tg-ai-panel__body", props.explanation);
63
+ const badge = props.badge ? createElement("span", "tg-ai-panel__badge", props.badge) : null;
64
+ const list = props.bullets?.length ? createElement("ul", "tg-ai-panel__list") : null;
65
+ const caution = props.caution ? createElement("p", "tg-ai-panel__caution", props.caution) : null;
66
+ if (badge) {
67
+ head.append(title, badge);
68
+ }
69
+ else {
70
+ head.append(title);
71
+ }
72
+ panel.append(eyebrow, head, body);
73
+ if (list) {
74
+ for (const item of props.bullets ?? []) {
75
+ list.append(createElement("li", "", item));
76
+ }
77
+ panel.append(list);
78
+ }
79
+ if (caution) {
80
+ panel.append(caution);
81
+ }
82
+ return panel;
83
+ }
84
+ export function AIExplainSourceBar(props) {
85
+ const bar = createElement("section", `tg-source-bar tg-source-bar--${props.status}`);
86
+ const eyebrow = createElement("span", "tg-source-bar__eyebrow", "Explain Source");
87
+ const head = createElement("div", "tg-source-bar__head");
88
+ const title = createElement("h4", "tg-source-bar__title", props.title);
89
+ const summary = createElement("p", "tg-source-bar__summary", props.summary);
90
+ const badge = props.badge ? createElement("span", "tg-source-bar__badge", props.badge) : null;
91
+ const meta = props.meta?.length ? createElement("div", "tg-source-bar__meta") : null;
92
+ const actions = props.actions?.length ? createElement("ul", "tg-source-bar__actions") : null;
93
+ if (badge) {
94
+ head.append(title, badge);
95
+ }
96
+ else {
97
+ head.append(title);
98
+ }
99
+ bar.append(eyebrow, head, summary);
100
+ if (meta) {
101
+ for (const item of props.meta ?? []) {
102
+ const row = createElement("div", "tg-source-bar__meta-item");
103
+ row.append(createElement("span", "tg-source-bar__meta-label", item.label), createElement("strong", "tg-source-bar__meta-value", item.value));
104
+ meta.append(row);
105
+ }
106
+ bar.append(meta);
107
+ }
108
+ if (actions) {
109
+ for (const item of props.actions ?? []) {
110
+ actions.append(createElement("li", "tg-source-bar__actions-item", item));
111
+ }
112
+ bar.append(actions);
113
+ }
114
+ return bar;
115
+ }
116
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE3E,SAAS,aAAa,CACpB,GAAM,EACN,SAAkB,EAClB,WAAoB;IAEpB,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAE5C,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IACh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;IAE7F,IAAI,KAAK,EAAE,CAAC;QACV,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IAED,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAEnC,IAAI,IAAI,EAAE,CAAC;QACT,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;YACpC,MAAM,GAAG,GAAG,aAAa,CAAC,KAAK,EAAE,0BAA0B,CAAC,CAAC;YAC7D,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,2BAA2B,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,QAAQ,EAAE,2BAA2B,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YAC7I,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;QAED,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IAED,IAAI,OAAO,EAAE,CAAC;QACZ,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC;YACvC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,6BAA6B,EAAE,IAAI,CAAC,CAAC,CAAC;QAC3E,CAAC;QAED,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const tokenGuardBaseStyles = "\n.tg-card,\n.tg-banner,\n.tg-ai-panel,\n.tg-source-bar {\n border: 1px solid rgba(120, 166, 255, 0.18);\n border-radius: 18px;\n background: rgba(8, 18, 33, 0.96);\n color: #eef5ff;\n font-family: \"Trebuchet MS\", \"Segoe UI\", sans-serif;\n box-sizing: border-box;\n}\n\n.tg-card {\n padding: 18px;\n}\n\n.tg-card--high {\n border-color: rgba(255, 111, 97, 0.42);\n}\n\n.tg-card--medium {\n border-color: rgba(244, 184, 96, 0.42);\n}\n\n.tg-card--low {\n border-color: rgba(79, 209, 162, 0.38);\n}\n\n.tg-card__header {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-bottom: 14px;\n}\n\n.tg-card__title {\n margin: 0;\n font-size: 1.12rem;\n}\n\n.tg-card__summary,\n.tg-banner__message,\n.tg-ai-panel__body {\n margin: 0;\n color: #aac0dd;\n line-height: 1.55;\n}\n\n.tg-card__meta {\n display: grid;\n gap: 12px;\n margin: 16px 0 12px;\n}\n\n.tg-card__list {\n margin: 0;\n padding-left: 20px;\n}\n\n.tg-card__list-item + .tg-card__list-item {\n margin-top: 8px;\n}\n\n.tg-badge,\n.tg-pill {\n display: inline-flex;\n align-items: center;\n border-radius: 999px;\n font-size: 0.82rem;\n}\n\n.tg-badge {\n padding: 6px 10px;\n background: rgba(120, 166, 255, 0.18);\n color: #d7e6ff;\n}\n\n.tg-pill-row {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n\n.tg-pill {\n padding: 6px 10px;\n background: rgba(255, 255, 255, 0.06);\n color: #cde0fb;\n}\n\n.tg-banner,\n.tg-ai-panel,\n.tg-source-bar {\n padding: 16px 18px;\n}\n\n.tg-banner__label,\n.tg-ai-panel__eyebrow,\n.tg-source-bar__eyebrow {\n display: block;\n margin-bottom: 8px;\n color: #8fc6ff;\n font-size: 0.76rem;\n text-transform: uppercase;\n letter-spacing: 0.16em;\n}\n\n.tg-ai-panel__head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n margin-bottom: 10px;\n}\n\n.tg-ai-panel__title {\n margin: 0;\n font-size: 1rem;\n}\n\n.tg-ai-panel__badge {\n display: inline-flex;\n align-items: center;\n padding: 6px 10px;\n border-radius: 999px;\n background: rgba(120, 166, 255, 0.16);\n color: #d7e6ff;\n font-size: 0.78rem;\n}\n\n.tg-ai-panel__list {\n margin: 12px 0 0;\n padding-left: 20px;\n color: #e7f1ff;\n}\n\n.tg-ai-panel__list li + li {\n margin-top: 8px;\n}\n\n.tg-ai-panel__caution {\n margin-top: 12px;\n color: #f4b860;\n font-size: 0.88rem;\n}\n\n.tg-source-bar--live {\n border-color: rgba(79, 209, 162, 0.3);\n}\n\n.tg-source-bar--fallback {\n border-color: rgba(244, 184, 96, 0.34);\n}\n\n.tg-source-bar--template {\n border-color: rgba(120, 166, 255, 0.26);\n}\n\n.tg-source-bar__head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n margin-bottom: 10px;\n}\n\n.tg-source-bar__title {\n margin: 0;\n font-size: 1rem;\n}\n\n.tg-source-bar__badge {\n display: inline-flex;\n align-items: center;\n padding: 6px 10px;\n border-radius: 999px;\n background: rgba(120, 166, 255, 0.16);\n color: #d7e6ff;\n font-size: 0.78rem;\n}\n\n.tg-source-bar__summary {\n margin: 0;\n color: #aac0dd;\n line-height: 1.55;\n}\n\n.tg-source-bar__meta {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));\n gap: 10px;\n margin-top: 14px;\n}\n\n.tg-source-bar__meta-item {\n display: grid;\n gap: 6px;\n padding: 10px 12px;\n border-radius: 14px;\n background: rgba(255, 255, 255, 0.04);\n}\n\n.tg-source-bar__meta-label {\n color: #9bb5d7;\n font-size: 0.76rem;\n text-transform: uppercase;\n letter-spacing: 0.08em;\n}\n\n.tg-source-bar__meta-value {\n font-size: 0.92rem;\n}\n\n.tg-source-bar__actions {\n margin: 14px 0 0;\n padding-left: 20px;\n color: #e7f1ff;\n}\n\n.tg-source-bar__actions-item + .tg-source-bar__actions-item {\n margin-top: 8px;\n}\n";
2
+ export declare function injectTokenGuardStyles(doc?: Document): HTMLStyleElement;
3
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,grHA8NhC,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,GAAG,GAAE,QAAmB,GAAG,gBAAgB,CAajF"}
package/dist/styles.js ADDED
@@ -0,0 +1,235 @@
1
+ export const tokenGuardBaseStyles = `
2
+ .tg-card,
3
+ .tg-banner,
4
+ .tg-ai-panel,
5
+ .tg-source-bar {
6
+ border: 1px solid rgba(120, 166, 255, 0.18);
7
+ border-radius: 18px;
8
+ background: rgba(8, 18, 33, 0.96);
9
+ color: #eef5ff;
10
+ font-family: "Trebuchet MS", "Segoe UI", sans-serif;
11
+ box-sizing: border-box;
12
+ }
13
+
14
+ .tg-card {
15
+ padding: 18px;
16
+ }
17
+
18
+ .tg-card--high {
19
+ border-color: rgba(255, 111, 97, 0.42);
20
+ }
21
+
22
+ .tg-card--medium {
23
+ border-color: rgba(244, 184, 96, 0.42);
24
+ }
25
+
26
+ .tg-card--low {
27
+ border-color: rgba(79, 209, 162, 0.38);
28
+ }
29
+
30
+ .tg-card__header {
31
+ display: flex;
32
+ align-items: center;
33
+ gap: 12px;
34
+ margin-bottom: 14px;
35
+ }
36
+
37
+ .tg-card__title {
38
+ margin: 0;
39
+ font-size: 1.12rem;
40
+ }
41
+
42
+ .tg-card__summary,
43
+ .tg-banner__message,
44
+ .tg-ai-panel__body {
45
+ margin: 0;
46
+ color: #aac0dd;
47
+ line-height: 1.55;
48
+ }
49
+
50
+ .tg-card__meta {
51
+ display: grid;
52
+ gap: 12px;
53
+ margin: 16px 0 12px;
54
+ }
55
+
56
+ .tg-card__list {
57
+ margin: 0;
58
+ padding-left: 20px;
59
+ }
60
+
61
+ .tg-card__list-item + .tg-card__list-item {
62
+ margin-top: 8px;
63
+ }
64
+
65
+ .tg-badge,
66
+ .tg-pill {
67
+ display: inline-flex;
68
+ align-items: center;
69
+ border-radius: 999px;
70
+ font-size: 0.82rem;
71
+ }
72
+
73
+ .tg-badge {
74
+ padding: 6px 10px;
75
+ background: rgba(120, 166, 255, 0.18);
76
+ color: #d7e6ff;
77
+ }
78
+
79
+ .tg-pill-row {
80
+ display: flex;
81
+ flex-wrap: wrap;
82
+ gap: 8px;
83
+ }
84
+
85
+ .tg-pill {
86
+ padding: 6px 10px;
87
+ background: rgba(255, 255, 255, 0.06);
88
+ color: #cde0fb;
89
+ }
90
+
91
+ .tg-banner,
92
+ .tg-ai-panel,
93
+ .tg-source-bar {
94
+ padding: 16px 18px;
95
+ }
96
+
97
+ .tg-banner__label,
98
+ .tg-ai-panel__eyebrow,
99
+ .tg-source-bar__eyebrow {
100
+ display: block;
101
+ margin-bottom: 8px;
102
+ color: #8fc6ff;
103
+ font-size: 0.76rem;
104
+ text-transform: uppercase;
105
+ letter-spacing: 0.16em;
106
+ }
107
+
108
+ .tg-ai-panel__head {
109
+ display: flex;
110
+ align-items: center;
111
+ justify-content: space-between;
112
+ gap: 12px;
113
+ margin-bottom: 10px;
114
+ }
115
+
116
+ .tg-ai-panel__title {
117
+ margin: 0;
118
+ font-size: 1rem;
119
+ }
120
+
121
+ .tg-ai-panel__badge {
122
+ display: inline-flex;
123
+ align-items: center;
124
+ padding: 6px 10px;
125
+ border-radius: 999px;
126
+ background: rgba(120, 166, 255, 0.16);
127
+ color: #d7e6ff;
128
+ font-size: 0.78rem;
129
+ }
130
+
131
+ .tg-ai-panel__list {
132
+ margin: 12px 0 0;
133
+ padding-left: 20px;
134
+ color: #e7f1ff;
135
+ }
136
+
137
+ .tg-ai-panel__list li + li {
138
+ margin-top: 8px;
139
+ }
140
+
141
+ .tg-ai-panel__caution {
142
+ margin-top: 12px;
143
+ color: #f4b860;
144
+ font-size: 0.88rem;
145
+ }
146
+
147
+ .tg-source-bar--live {
148
+ border-color: rgba(79, 209, 162, 0.3);
149
+ }
150
+
151
+ .tg-source-bar--fallback {
152
+ border-color: rgba(244, 184, 96, 0.34);
153
+ }
154
+
155
+ .tg-source-bar--template {
156
+ border-color: rgba(120, 166, 255, 0.26);
157
+ }
158
+
159
+ .tg-source-bar__head {
160
+ display: flex;
161
+ align-items: center;
162
+ justify-content: space-between;
163
+ gap: 12px;
164
+ margin-bottom: 10px;
165
+ }
166
+
167
+ .tg-source-bar__title {
168
+ margin: 0;
169
+ font-size: 1rem;
170
+ }
171
+
172
+ .tg-source-bar__badge {
173
+ display: inline-flex;
174
+ align-items: center;
175
+ padding: 6px 10px;
176
+ border-radius: 999px;
177
+ background: rgba(120, 166, 255, 0.16);
178
+ color: #d7e6ff;
179
+ font-size: 0.78rem;
180
+ }
181
+
182
+ .tg-source-bar__summary {
183
+ margin: 0;
184
+ color: #aac0dd;
185
+ line-height: 1.55;
186
+ }
187
+
188
+ .tg-source-bar__meta {
189
+ display: grid;
190
+ grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
191
+ gap: 10px;
192
+ margin-top: 14px;
193
+ }
194
+
195
+ .tg-source-bar__meta-item {
196
+ display: grid;
197
+ gap: 6px;
198
+ padding: 10px 12px;
199
+ border-radius: 14px;
200
+ background: rgba(255, 255, 255, 0.04);
201
+ }
202
+
203
+ .tg-source-bar__meta-label {
204
+ color: #9bb5d7;
205
+ font-size: 0.76rem;
206
+ text-transform: uppercase;
207
+ letter-spacing: 0.08em;
208
+ }
209
+
210
+ .tg-source-bar__meta-value {
211
+ font-size: 0.92rem;
212
+ }
213
+
214
+ .tg-source-bar__actions {
215
+ margin: 14px 0 0;
216
+ padding-left: 20px;
217
+ color: #e7f1ff;
218
+ }
219
+
220
+ .tg-source-bar__actions-item + .tg-source-bar__actions-item {
221
+ margin-top: 8px;
222
+ }
223
+ `;
224
+ export function injectTokenGuardStyles(doc = document) {
225
+ const existing = doc.querySelector("style[data-tokenguard-ui='true']");
226
+ if (existing) {
227
+ return existing;
228
+ }
229
+ const style = doc.createElement("style");
230
+ style.dataset.tokenguardUi = "true";
231
+ style.textContent = tokenGuardBaseStyles;
232
+ doc.head.append(style);
233
+ return style;
234
+ }
235
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8NnC,CAAC;AAEF,MAAM,UAAU,sBAAsB,CAAC,MAAgB,QAAQ;IAC7D,MAAM,QAAQ,GAAG,GAAG,CAAC,aAAa,CAAmB,kCAAkC,CAAC,CAAC;IAEzF,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,KAAK,GAAG,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACzC,KAAK,CAAC,OAAO,CAAC,YAAY,GAAG,MAAM,CAAC;IACpC,KAAK,CAAC,WAAW,GAAG,oBAAoB,CAAC;IACzC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEvB,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,36 @@
1
+ export type RiskLevel = "low" | "medium" | "high";
2
+ export type UserLevel = "beginner" | "advanced";
3
+ export type RiskAlertCardProps = {
4
+ riskLevel: RiskLevel;
5
+ title: string;
6
+ summary: string;
7
+ actions: string[];
8
+ reasons?: string[];
9
+ score?: number;
10
+ };
11
+ export type DomainWarningBannerProps = {
12
+ visible: boolean;
13
+ message: string;
14
+ };
15
+ export type AIExplainPanelProps = {
16
+ title?: string;
17
+ explanation: string;
18
+ level?: UserLevel;
19
+ badge?: string;
20
+ bullets?: string[];
21
+ caution?: string;
22
+ };
23
+ export type AIExplainSourceStatus = "live" | "fallback" | "template";
24
+ export type AIExplainSourceMeta = {
25
+ label: string;
26
+ value: string;
27
+ };
28
+ export type AIExplainSourceBarProps = {
29
+ status: AIExplainSourceStatus;
30
+ title: string;
31
+ summary: string;
32
+ badge?: string;
33
+ meta?: AIExplainSourceMeta[];
34
+ actions?: string[];
35
+ };
36
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAClD,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAEhD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;AAErE,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,qBAAqB,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@james-wu/tokenguard-ui",
3
+ "version": "0.1.0",
4
+ "description": "Embeddable UI components for TokenGuard risk alerts, phishing warnings, and AI explanations in wallets and Web3 apps.",
5
+ "type": "module",
6
+ "license": "Apache-2.0",
7
+ "sideEffects": false,
8
+ "main": "./dist/index.js",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js",
15
+ "default": "./dist/index.js"
16
+ },
17
+ "./package.json": "./package.json"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "README.md"
22
+ ],
23
+ "engines": {
24
+ "node": ">=18.0.0"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/James-Wuguoqing/tokenguard-ai.git",
32
+ "directory": "packages/ui"
33
+ },
34
+ "homepage": "https://github.com/James-Wuguoqing/tokenguard-ai/tree/main/packages/ui#readme",
35
+ "bugs": {
36
+ "url": "https://github.com/James-Wuguoqing/tokenguard-ai/issues"
37
+ },
38
+ "keywords": [
39
+ "tokenguard",
40
+ "ui",
41
+ "web3",
42
+ "wallet-security",
43
+ "risk-alerts",
44
+ "phishing-warning",
45
+ "wallet-ui",
46
+ "alert-components"
47
+ ],
48
+ "scripts": {
49
+ "build": "tsc -p tsconfig.json",
50
+ "prepack": "npm run build"
51
+ }
52
+ }