@talismn/orb 0.4.2 → 1.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/dist/index.js CHANGED
@@ -1,241 +1,369 @@
1
- "use strict";
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region \0rolldown/runtime.js
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __getProtoOf = Object.getPrototypeOf;
7
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
9
  var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ }
17
+ return to;
19
18
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var index_exports = {};
32
- __export(index_exports, {
33
- TalismanOrb: () => TalismanOrb,
34
- TalismanOrbRectangle: () => TalismanOrbRectangle,
35
- computeTalismanOrb: () => computeTalismanOrb,
36
- getTalismanOrbDataUrl: () => getTalismanOrbDataUrl,
37
- useTalismanOrb: () => useTalismanOrb
38
- });
39
- module.exports = __toCommonJS(index_exports);
40
-
41
- // src/components/TalismanOrbLogo.tsx
42
- var import_jsx_runtime = require("react/jsx-runtime");
43
- var TalismanOrbLogo = ({ platform }) => {
44
- switch (platform) {
45
- case "ethereum":
46
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { opacity: "0.75", transform: "scale(0.7) translate(14 14)", className: "orb-type", children: [
47
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
48
- "path",
49
- {
50
- d: "M12.8101 32.76L32.0001 44.62L51.1901 32.76L32.0001 -0.0699997L12.8101 32.76Z",
51
- fill: "white"
52
- }
53
- ),
54
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
55
- "path",
56
- {
57
- d: "M12.8101 36.48L32.0001 48.43L51.1901 36.48L32.0001 63.93L12.8101 36.48Z",
58
- fill: "white"
59
- }
60
- )
61
- ] });
62
- case "polkadot":
63
- return null;
64
- case "solana":
65
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { opacity: "0.75", className: "orb-type", transform: "scale(0.45) translate(37.5, 37.5)", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
66
- "path",
67
- {
68
- d: "M70.6648 50.1769L58.9393 62.775C58.6844 63.0486 58.376 63.2668 58.0332 63.4159C57.6905 63.5651 57.3208 63.6419 56.9472 63.6417H1.36128C1.09605 63.6417 0.836598 63.5641 0.614804 63.4184C0.393011 63.2727 0.218536 63.0652 0.112817 62.8215C0.00709765 62.5779 -0.0252603 62.3085 0.0197186 62.0467C0.0646974 61.7848 0.185054 61.5418 0.366 61.3476L12.1006 48.7496C12.3548 48.4766 12.6623 48.2589 13.0039 48.1098C13.3455 47.9607 13.714 47.8834 14.0866 47.8828H69.6695C69.9348 47.8828 70.1942 47.9604 70.416 48.1062C70.6378 48.2519 70.8123 48.4593 70.918 48.703C71.0237 48.9467 71.0561 49.216 71.0111 49.4778C70.9661 49.7397 70.8458 49.9827 70.6648 50.1769V50.1769ZM58.9393 24.8081C58.6844 24.5345 58.376 24.3163 58.0332 24.1672C57.6905 24.0181 57.3208 23.9412 56.9472 23.9414H1.36128C1.09605 23.9414 0.836598 24.019 0.614804 24.1647C0.393011 24.3105 0.218536 24.5179 0.112817 24.7616C0.00709765 25.0053 -0.0252603 25.2746 0.0197186 25.5364C0.0646974 25.7983 0.185054 26.0413 0.366 26.2355L12.1006 38.8336C12.3548 39.1065 12.6623 39.3242 13.0039 39.4733C13.3455 39.6224 13.714 39.6997 14.0866 39.7003H69.6695C69.9348 39.7003 70.1942 39.6227 70.416 39.477C70.6378 39.3313 70.8123 39.1238 70.918 38.8801C71.0237 38.6365 71.0561 38.3671 71.0111 38.1053C70.9661 37.8434 70.8458 37.6004 70.6648 37.4062L58.9393 24.8081ZM1.36128 15.7589H56.9472C57.3208 15.7591 57.6905 15.6822 58.0332 15.5331C58.376 15.384 58.6844 15.1658 58.9393 14.8922L70.6648 2.29413C70.8458 2.09986 70.9661 1.85688 71.0111 1.59502C71.0561 1.33317 71.0237 1.06385 70.918 0.820169C70.8123 0.576485 70.6378 0.369047 70.416 0.223341C70.1942 0.0776352 69.9348 8.97308e-06 69.6695 0L14.0866 0C13.714 0.000635258 13.3455 0.077888 13.0039 0.226975C12.6623 0.376063 12.3548 0.593811 12.1006 0.866739L0.369025 13.4648C0.188254 13.6588 0.0679503 13.9016 0.0228694 14.1631C-0.0222115 14.4247 0.00988974 14.6938 0.115236 14.9373C0.220583 15.1809 0.394595 15.3884 0.615931 15.5343C0.837268 15.6802 1.09631 15.7583 1.36128 15.7589V15.7589Z",
69
- fill: "white"
70
- }
71
- ) });
72
- default:
73
- return null;
74
- }
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ value: mod,
21
+ enumerable: true
22
+ }) : target, mod));
23
+ //#endregion
24
+ let react_jsx_runtime = require("react/jsx-runtime");
25
+ let react = require("react");
26
+ let _talismn_crypto = require("@talismn/crypto");
27
+ let blueimp_md5 = require("blueimp-md5");
28
+ blueimp_md5 = __toESM(blueimp_md5);
29
+ let color = require("color");
30
+ color = __toESM(color);
31
+ //#region src/components/TalismanOrbLogo.tsx
32
+ const TalismanOrbLogo = ({ platform }) => {
33
+ switch (platform) {
34
+ case "ethereum": return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("g", {
35
+ opacity: "0.75",
36
+ transform: "scale(0.7) translate(14 14)",
37
+ className: "orb-type",
38
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
39
+ d: "M12.8101 32.76L32.0001 44.62L51.1901 32.76L32.0001 -0.0699997L12.8101 32.76Z",
40
+ fill: "white"
41
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
42
+ d: "M12.8101 36.48L32.0001 48.43L51.1901 36.48L32.0001 63.93L12.8101 36.48Z",
43
+ fill: "white"
44
+ })]
45
+ });
46
+ case "polkadot": return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("g", {
47
+ opacity: "0.75",
48
+ transform: "scale(1.0323) translate(14 12)",
49
+ fill: "white",
50
+ className: "orb-type",
51
+ children: [
52
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
53
+ cx: "16.9926",
54
+ cy: "2.83173",
55
+ r: "2.83173"
56
+ }),
57
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
58
+ cx: "9.91302",
59
+ cy: "7.47004",
60
+ r: "2.83173"
61
+ }),
62
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
63
+ cx: "24.0705",
64
+ cy: "7.47004",
65
+ r: "2.83173"
66
+ }),
67
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
68
+ cx: "16.9926",
69
+ cy: "10.8874",
70
+ r: "2.83173"
71
+ }),
72
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
73
+ cx: "2.83173",
74
+ cy: "11.1316",
75
+ r: "2.83173"
76
+ }),
77
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
78
+ cx: "31.1501",
79
+ cy: "11.1316",
80
+ r: "2.83173"
81
+ }),
82
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
83
+ cx: "9.91302",
84
+ cy: "15.2815",
85
+ r: "2.83173"
86
+ }),
87
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
88
+ cx: "24.0705",
89
+ cy: "15.2815",
90
+ r: "2.83173"
91
+ }),
92
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
93
+ cx: "2.83173",
94
+ cy: "18.6993",
95
+ r: "2.83173"
96
+ }),
97
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
98
+ cx: "16.9926",
99
+ cy: "18.9433",
100
+ r: "2.83173"
101
+ }),
102
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
103
+ cx: "31.1501",
104
+ cy: "18.6993",
105
+ r: "2.83173"
106
+ }),
107
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
108
+ cx: "9.91302",
109
+ cy: "23.0931",
110
+ r: "2.83173"
111
+ }),
112
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
113
+ cx: "24.0705",
114
+ cy: "23.0931",
115
+ r: "2.83173"
116
+ }),
117
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
118
+ cx: "2.83173",
119
+ cy: "26.2667",
120
+ r: "2.83173"
121
+ }),
122
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
123
+ cx: "16.9926",
124
+ cy: "26.999",
125
+ r: "2.83173"
126
+ }),
127
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
128
+ cx: "31.1501",
129
+ cy: "26.2667",
130
+ r: "2.83173"
131
+ }),
132
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
133
+ cx: "9.91302",
134
+ cy: "30.905",
135
+ r: "2.83173"
136
+ }),
137
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
138
+ cx: "24.0705",
139
+ cy: "30.905",
140
+ r: "2.83173"
141
+ }),
142
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
143
+ cx: "16.9926",
144
+ cy: "35.0548",
145
+ r: "2.83173"
146
+ })
147
+ ]
148
+ });
149
+ case "solana": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("g", {
150
+ opacity: "0.75",
151
+ className: "orb-type",
152
+ transform: "scale(0.45) translate(37.5, 37.5)",
153
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
154
+ d: "M70.6648 50.1769L58.9393 62.775C58.6844 63.0486 58.376 63.2668 58.0332 63.4159C57.6905 63.5651 57.3208 63.6419 56.9472 63.6417H1.36128C1.09605 63.6417 0.836598 63.5641 0.614804 63.4184C0.393011 63.2727 0.218536 63.0652 0.112817 62.8215C0.00709765 62.5779 -0.0252603 62.3085 0.0197186 62.0467C0.0646974 61.7848 0.185054 61.5418 0.366 61.3476L12.1006 48.7496C12.3548 48.4766 12.6623 48.2589 13.0039 48.1098C13.3455 47.9607 13.714 47.8834 14.0866 47.8828H69.6695C69.9348 47.8828 70.1942 47.9604 70.416 48.1062C70.6378 48.2519 70.8123 48.4593 70.918 48.703C71.0237 48.9467 71.0561 49.216 71.0111 49.4778C70.9661 49.7397 70.8458 49.9827 70.6648 50.1769V50.1769ZM58.9393 24.8081C58.6844 24.5345 58.376 24.3163 58.0332 24.1672C57.6905 24.0181 57.3208 23.9412 56.9472 23.9414H1.36128C1.09605 23.9414 0.836598 24.019 0.614804 24.1647C0.393011 24.3105 0.218536 24.5179 0.112817 24.7616C0.00709765 25.0053 -0.0252603 25.2746 0.0197186 25.5364C0.0646974 25.7983 0.185054 26.0413 0.366 26.2355L12.1006 38.8336C12.3548 39.1065 12.6623 39.3242 13.0039 39.4733C13.3455 39.6224 13.714 39.6997 14.0866 39.7003H69.6695C69.9348 39.7003 70.1942 39.6227 70.416 39.477C70.6378 39.3313 70.8123 39.1238 70.918 38.8801C71.0237 38.6365 71.0561 38.3671 71.0111 38.1053C70.9661 37.8434 70.8458 37.6004 70.6648 37.4062L58.9393 24.8081ZM1.36128 15.7589H56.9472C57.3208 15.7591 57.6905 15.6822 58.0332 15.5331C58.376 15.384 58.6844 15.1658 58.9393 14.8922L70.6648 2.29413C70.8458 2.09986 70.9661 1.85688 71.0111 1.59502C71.0561 1.33317 71.0237 1.06385 70.918 0.820169C70.8123 0.576485 70.6378 0.369047 70.416 0.223341C70.1942 0.0776352 69.9348 8.97308e-06 69.6695 0L14.0866 0C13.714 0.000635258 13.3455 0.077888 13.0039 0.226975C12.6623 0.376063 12.3548 0.593811 12.1006 0.866739L0.369025 13.4648C0.188254 13.6588 0.0679503 13.9016 0.0228694 14.1631C-0.0222115 14.4247 0.00988974 14.6938 0.115236 14.9373C0.220583 15.1809 0.394595 15.3884 0.615931 15.5343C0.837268 15.6802 1.09631 15.7583 1.36128 15.7589V15.7589Z",
155
+ fill: "white"
156
+ })
157
+ });
158
+ default: return null;
159
+ }
75
160
  };
76
-
77
- // src/components/useTalismanOrb.ts
78
- var import_react = require("react");
79
-
80
- // src/computeTalismanOrb.ts
81
- var import_crypto = require("@talismn/crypto");
82
- var import_blueimp_md5 = __toESM(require("blueimp-md5"));
83
- var import_color = __toESM(require("color"));
84
- var djb2 = (str) => {
85
- let hash = 5381;
86
- for (let i = 0; i < str.length; i++) hash = (hash << 5) + hash + str.charCodeAt(i);
87
- return hash;
161
+ //#endregion
162
+ //#region src/computeTalismanOrb.ts
163
+ const djb2 = (str) => {
164
+ let hash = 5381;
165
+ for (let i = 0; i < str.length; i++) hash = (hash << 5) + hash + str.charCodeAt(i);
166
+ return hash;
88
167
  };
89
- var valueFromHash = (hash, max) => {
90
- return (max + djb2(hash)) % max;
168
+ const valueFromHash = (hash, max) => {
169
+ return (max + djb2(hash)) % max;
91
170
  };
92
- var colorFromHash = (hash) => {
93
- const hue = valueFromHash(hash, 360);
94
- return import_color.default.hsv(hue, 100, 100);
171
+ const colorFromHash = (hash) => {
172
+ const hue = valueFromHash(hash, 360);
173
+ return color.default.hsv(hue, 100, 100);
95
174
  };
96
- var rotateText = (text, nbChars = 0) => text.slice(nbChars) + text.slice(0, nbChars);
97
- var computeTalismanOrb = (seed) => {
98
- let platform;
99
- let address;
100
- try {
101
- platform = (0, import_crypto.getAccountPlatformFromAddress)(seed);
102
- address = (0, import_crypto.normalizeAddress)(seed);
103
- } catch {
104
- platform = "polkadot";
105
- address = seed;
106
- }
107
- const hash1 = (0, import_blueimp_md5.default)(address);
108
- const hash2 = rotateText(hash1, 1);
109
- const hash3 = rotateText(hash1, 2);
110
- const colors = [colorFromHash(hash1), colorFromHash(hash2), colorFromHash(hash3)].sort(
111
- (c1, c2) => c1.lightness() - c2.lightness()
112
- );
113
- const dotX = 10 + valueFromHash(hash1, 10);
114
- const dotY = 10 + valueFromHash(hash2, 10);
115
- const rotation = valueFromHash(hash1, 360);
116
- return {
117
- bgColor1: colors[0].hex(),
118
- bgColor2: colors[1].hex(),
119
- glowColor: colors[2].hex(),
120
- transform: `rotate(${rotation} 32 32)`,
121
- cx: dotX,
122
- cy: dotY,
123
- platform
124
- };
175
+ const rotateText = (text, nbChars = 0) => text.slice(nbChars) + text.slice(0, nbChars);
176
+ /** Pure computation of orb visual data from a seed (address). No React dependency. */
177
+ const computeTalismanOrb = (seed) => {
178
+ let platform;
179
+ let address;
180
+ try {
181
+ platform = (0, _talismn_crypto.getAccountPlatformFromAddress)(seed);
182
+ address = (0, _talismn_crypto.normalizeAddress)(seed);
183
+ } catch {
184
+ platform = "polkadot";
185
+ address = seed;
186
+ }
187
+ const hash1 = (0, blueimp_md5.default)(address);
188
+ const hash2 = rotateText(hash1, 1);
189
+ const hash3 = rotateText(hash1, 2);
190
+ const colors = [
191
+ colorFromHash(hash1),
192
+ colorFromHash(hash2),
193
+ colorFromHash(hash3)
194
+ ].sort((c1, c2) => c1.lightness() - c2.lightness());
195
+ const dotX = 10 + valueFromHash(hash1, 10);
196
+ const dotY = 10 + valueFromHash(hash2, 10);
197
+ const rotation = valueFromHash(hash1, 360);
198
+ return {
199
+ bgColor1: colors[0].hex(),
200
+ bgColor2: colors[1].hex(),
201
+ glowColor: colors[2].hex(),
202
+ transform: `rotate(${rotation} 32 32)`,
203
+ cx: dotX,
204
+ cy: dotY,
205
+ platform
206
+ };
125
207
  };
126
-
127
- // src/components/useTalismanOrb.ts
128
- var useTalismanOrb = (seed) => {
129
- const id = (0, import_react.useId)();
130
- return (0, import_react.useMemo)(() => {
131
- return {
132
- id,
133
- // multiple avatars should cohabit on the same page
134
- ...computeTalismanOrb(seed)
135
- };
136
- }, [id, seed]);
208
+ //#endregion
209
+ //#region src/components/useTalismanOrb.ts
210
+ const useTalismanOrb = (seed) => {
211
+ const id = (0, react.useId)();
212
+ return (0, react.useMemo)(() => {
213
+ return {
214
+ id,
215
+ ...computeTalismanOrb(seed)
216
+ };
217
+ }, [id, seed]);
137
218
  };
138
-
139
- // src/components/TalismanOrb.tsx
140
- var import_jsx_runtime2 = require("react/jsx-runtime");
141
- var TalismanOrb = ({
142
- seed,
143
- width = "1em",
144
- height = "1em",
145
- className
146
- }) => {
147
- const { id, bgColor1, bgColor2, transform, glowColor, cx, cy, platform } = useTalismanOrb(seed);
148
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
149
- "svg",
150
- {
151
- width,
152
- height,
153
- viewBox: `0 0 64 64`,
154
- className,
155
- version: "1.1",
156
- xmlns: "http://www.w3.org/2000/svg",
157
- children: [
158
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("defs", { children: [
159
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("linearGradient", { id: `${id}-bg`, children: [
160
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("stop", { offset: "20%", stopColor: bgColor1 }),
161
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("stop", { offset: "100%", stopColor: bgColor2 })
162
- ] }),
163
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("radialGradient", { id: `${id}-circle`, children: [
164
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("stop", { offset: "10%", stopColor: glowColor }),
165
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("stop", { offset: "100%", stopColor: "transparent" })
166
- ] }),
167
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("clipPath", { id: `${id}-clip`, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "32", cy: "32", r: "32" }) })
168
- ] }),
169
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("g", { clipPath: `url(#${id}-clip)`, children: [
170
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("g", { transform, children: [
171
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { fill: `url(#${id}-bg)`, x: 0, y: 0, width: 64, height: 64 }),
172
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { fill: `url(#${id}-circle)`, cx, cy, r: 45, opacity: 0.7 })
173
- ] }),
174
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TalismanOrbLogo, { platform })
175
- ] })
176
- ]
177
- }
178
- );
219
+ //#endregion
220
+ //#region src/components/TalismanOrb.tsx
221
+ const TalismanOrb = ({ seed, width = "1em", height = "1em", className }) => {
222
+ const { id, bgColor1, bgColor2, transform, glowColor, cx, cy, platform } = useTalismanOrb(seed);
223
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
224
+ width,
225
+ height,
226
+ viewBox: `0 0 64 64`,
227
+ className,
228
+ version: "1.1",
229
+ xmlns: "http://www.w3.org/2000/svg",
230
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("defs", { children: [
231
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
232
+ id: `${id}-bg`,
233
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
234
+ offset: "20%",
235
+ stopColor: bgColor1
236
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
237
+ offset: "100%",
238
+ stopColor: bgColor2
239
+ })]
240
+ }),
241
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("radialGradient", {
242
+ id: `${id}-circle`,
243
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
244
+ offset: "10%",
245
+ stopColor: glowColor
246
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
247
+ offset: "100%",
248
+ stopColor: "transparent"
249
+ })]
250
+ }),
251
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("clipPath", {
252
+ id: `${id}-clip`,
253
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
254
+ cx: "32",
255
+ cy: "32",
256
+ r: "32"
257
+ })
258
+ })
259
+ ] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("g", {
260
+ clipPath: `url(#${id}-clip)`,
261
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("g", {
262
+ transform,
263
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
264
+ fill: `url(#${id}-bg)`,
265
+ x: 0,
266
+ y: 0,
267
+ width: 64,
268
+ height: 64
269
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
270
+ fill: `url(#${id}-circle)`,
271
+ cx,
272
+ cy,
273
+ r: 45,
274
+ opacity: .7
275
+ })]
276
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TalismanOrbLogo, { platform })]
277
+ })]
278
+ });
179
279
  };
180
-
181
- // src/components/TalismanOrbRectangle.tsx
182
- var import_jsx_runtime3 = require("react/jsx-runtime");
183
- var TalismanOrbRectangle = ({ width, height, seed, className }) => {
184
- const { id, bgColor1, bgColor2, transform, glowColor, cx, cy } = useTalismanOrb(seed);
185
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
186
- "svg",
187
- {
188
- width,
189
- height,
190
- viewBox: `0 0 64 64`,
191
- preserveAspectRatio: "none",
192
- className,
193
- version: "1.1",
194
- xmlns: "http://www.w3.org/2000/svg",
195
- children: [
196
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("defs", { children: [
197
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("linearGradient", { id: `${id}-bg`, children: [
198
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("stop", { offset: "20%", stopColor: bgColor1 }),
199
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("stop", { offset: "100%", stopColor: bgColor2 })
200
- ] }),
201
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("radialGradient", { id: `${id}-circle`, children: [
202
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("stop", { offset: "10%", stopColor: glowColor }),
203
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("stop", { offset: "100%", stopColor: "transparent" })
204
- ] }),
205
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("clipPath", { id: `${id}-clip`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "32", cy: "32", r: "48" }) })
206
- ] }),
207
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { clipPath: `url(#${id}-clip)`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("g", { transform, children: [
208
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { fill: `url(#${id}-bg)`, x: -16, y: -16, width: 96, height: 96 }),
209
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { fill: `url(#${id}-circle)`, cx, cy, r: 45, opacity: 0.7 })
210
- ] }) })
211
- ]
212
- }
213
- );
280
+ //#endregion
281
+ //#region src/components/TalismanOrbRectangle.tsx
282
+ const TalismanOrbRectangle = ({ width, height, seed, className }) => {
283
+ const { id, bgColor1, bgColor2, transform, glowColor, cx, cy } = useTalismanOrb(seed);
284
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
285
+ width,
286
+ height,
287
+ viewBox: `0 0 64 64`,
288
+ preserveAspectRatio: "none",
289
+ className,
290
+ version: "1.1",
291
+ xmlns: "http://www.w3.org/2000/svg",
292
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("defs", { children: [
293
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
294
+ id: `${id}-bg`,
295
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
296
+ offset: "20%",
297
+ stopColor: bgColor1
298
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
299
+ offset: "100%",
300
+ stopColor: bgColor2
301
+ })]
302
+ }),
303
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("radialGradient", {
304
+ id: `${id}-circle`,
305
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
306
+ offset: "10%",
307
+ stopColor: glowColor
308
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
309
+ offset: "100%",
310
+ stopColor: "transparent"
311
+ })]
312
+ }),
313
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("clipPath", {
314
+ id: `${id}-clip`,
315
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
316
+ cx: "32",
317
+ cy: "32",
318
+ r: "48"
319
+ })
320
+ })
321
+ ] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("g", {
322
+ clipPath: `url(#${id}-clip)`,
323
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("g", {
324
+ transform,
325
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
326
+ fill: `url(#${id}-bg)`,
327
+ x: -16,
328
+ y: -16,
329
+ width: 96,
330
+ height: 96
331
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
332
+ fill: `url(#${id}-circle)`,
333
+ cx,
334
+ cy,
335
+ r: 45,
336
+ opacity: .7
337
+ })]
338
+ })
339
+ })]
340
+ });
214
341
  };
215
-
216
- // src/util/getTalismanOrbDataUrl.ts
217
- var platformLogoSvg = (platform) => {
218
- switch (platform) {
219
- case "ethereum":
220
- return '<g opacity="0.75" transform="scale(0.7) translate(14 14)" class="orb-type"><path d="M12.8101 32.76L32.0001 44.62L51.1901 32.76L32.0001 -0.0699997L12.8101 32.76Z" fill="white"/><path d="M12.8101 36.48L32.0001 48.43L51.1901 36.48L32.0001 63.93L12.8101 36.48Z" fill="white"/></g>';
221
- case "solana":
222
- return '<g opacity="0.75" class="orb-type" transform="scale(0.45) translate(37.5, 37.5)"><path d="M70.6648 50.1769L58.9393 62.775C58.6844 63.0486 58.376 63.2668 58.0332 63.4159C57.6905 63.5651 57.3208 63.6419 56.9472 63.6417H1.36128C1.09605 63.6417 0.836598 63.5641 0.614804 63.4184C0.393011 63.2727 0.218536 63.0652 0.112817 62.8215C0.00709765 62.5779 -0.0252603 62.3085 0.0197186 62.0467C0.0646974 61.7848 0.185054 61.5418 0.366 61.3476L12.1006 48.7496C12.3548 48.4766 12.6623 48.2589 13.0039 48.1098C13.3455 47.9607 13.714 47.8834 14.0866 47.8828H69.6695C69.9348 47.8828 70.1942 47.9604 70.416 48.1062C70.6378 48.2519 70.8123 48.4593 70.918 48.703C71.0237 48.9467 71.0561 49.216 71.0111 49.4778C70.9661 49.7397 70.8458 49.9827 70.6648 50.1769V50.1769ZM58.9393 24.8081C58.6844 24.5345 58.376 24.3163 58.0332 24.1672C57.6905 24.0181 57.3208 23.9412 56.9472 23.9414H1.36128C1.09605 23.9414 0.836598 24.019 0.614804 24.1647C0.393011 24.3105 0.218536 24.5179 0.112817 24.7616C0.00709765 25.0053 -0.0252603 25.2746 0.0197186 25.5364C0.0646974 25.7983 0.185054 26.0413 0.366 26.2355L12.1006 38.8336C12.3548 39.1065 12.6623 39.3242 13.0039 39.4733C13.3455 39.6224 13.714 39.6997 14.0866 39.7003H69.6695C69.9348 39.7003 70.1942 39.6227 70.416 39.477C70.6378 39.3313 70.8123 39.1238 70.918 38.8801C71.0237 38.6365 71.0561 38.3671 71.0111 38.1053C70.9661 37.8434 70.8458 37.6004 70.6648 37.4062L58.9393 24.8081ZM1.36128 15.7589H56.9472C57.3208 15.7591 57.6905 15.6822 58.0332 15.5331C58.376 15.384 58.6844 15.1658 58.9393 14.8922L70.6648 2.29413C70.8458 2.09986 70.9661 1.85688 71.0111 1.59502C71.0561 1.33317 71.0237 1.06385 70.918 0.820169C70.8123 0.576485 70.6378 0.369047 70.416 0.223341C70.1942 0.0776352 69.9348 8.97308e-06 69.6695 0L14.0866 0C13.714 0.000635258 13.3455 0.077888 13.0039 0.226975C12.6623 0.376063 12.3548 0.593811 12.1006 0.866739L0.369025 13.4648C0.188254 13.6588 0.0679503 13.9016 0.0228694 14.1631C-0.0222115 14.4247 0.00988974 14.6938 0.115236 14.9373C0.220583 15.1809 0.394595 15.3884 0.615931 15.5343C0.837268 15.6802 1.09631 15.7583 1.36128 15.7589V15.7589Z" fill="white"/></g>';
223
- default:
224
- return "";
225
- }
342
+ //#endregion
343
+ //#region src/util/getTalismanOrbDataUrl.ts
344
+ const platformLogoSvg = (platform) => {
345
+ switch (platform) {
346
+ case "polkadot": return "<g opacity=\"0.75\" transform=\"scale(1.0323) translate(14 12)\" fill=\"white\" class=\"orb-type\"><circle cx=\"16.9926\" cy=\"2.83173\" r=\"2.83173\"/><circle cx=\"9.91302\" cy=\"7.47004\" r=\"2.83173\"/><circle cx=\"24.0705\" cy=\"7.47004\" r=\"2.83173\"/><circle cx=\"16.9926\" cy=\"10.8874\" r=\"2.83173\"/><circle cx=\"2.83173\" cy=\"11.1316\" r=\"2.83173\"/><circle cx=\"31.1501\" cy=\"11.1316\" r=\"2.83173\"/><circle cx=\"9.91302\" cy=\"15.2815\" r=\"2.83173\"/><circle cx=\"24.0705\" cy=\"15.2815\" r=\"2.83173\"/><circle cx=\"2.83173\" cy=\"18.6993\" r=\"2.83173\"/><circle cx=\"16.9926\" cy=\"18.9433\" r=\"2.83173\"/><circle cx=\"31.1501\" cy=\"18.6993\" r=\"2.83173\"/><circle cx=\"9.91302\" cy=\"23.0931\" r=\"2.83173\"/><circle cx=\"24.0705\" cy=\"23.0931\" r=\"2.83173\"/><circle cx=\"2.83173\" cy=\"26.2667\" r=\"2.83173\"/><circle cx=\"16.9926\" cy=\"26.999\" r=\"2.83173\"/><circle cx=\"31.1501\" cy=\"26.2667\" r=\"2.83173\"/><circle cx=\"9.91302\" cy=\"30.905\" r=\"2.83173\"/><circle cx=\"24.0705\" cy=\"30.905\" r=\"2.83173\"/><circle cx=\"16.9926\" cy=\"35.0548\" r=\"2.83173\"/></g>";
347
+ case "ethereum": return "<g opacity=\"0.75\" transform=\"scale(0.7) translate(14 14)\" class=\"orb-type\"><path d=\"M12.8101 32.76L32.0001 44.62L51.1901 32.76L32.0001 -0.0699997L12.8101 32.76Z\" fill=\"white\"/><path d=\"M12.8101 36.48L32.0001 48.43L51.1901 36.48L32.0001 63.93L12.8101 36.48Z\" fill=\"white\"/></g>";
348
+ case "solana": return "<g opacity=\"0.75\" class=\"orb-type\" transform=\"scale(0.45) translate(37.5, 37.5)\"><path d=\"M70.6648 50.1769L58.9393 62.775C58.6844 63.0486 58.376 63.2668 58.0332 63.4159C57.6905 63.5651 57.3208 63.6419 56.9472 63.6417H1.36128C1.09605 63.6417 0.836598 63.5641 0.614804 63.4184C0.393011 63.2727 0.218536 63.0652 0.112817 62.8215C0.00709765 62.5779 -0.0252603 62.3085 0.0197186 62.0467C0.0646974 61.7848 0.185054 61.5418 0.366 61.3476L12.1006 48.7496C12.3548 48.4766 12.6623 48.2589 13.0039 48.1098C13.3455 47.9607 13.714 47.8834 14.0866 47.8828H69.6695C69.9348 47.8828 70.1942 47.9604 70.416 48.1062C70.6378 48.2519 70.8123 48.4593 70.918 48.703C71.0237 48.9467 71.0561 49.216 71.0111 49.4778C70.9661 49.7397 70.8458 49.9827 70.6648 50.1769V50.1769ZM58.9393 24.8081C58.6844 24.5345 58.376 24.3163 58.0332 24.1672C57.6905 24.0181 57.3208 23.9412 56.9472 23.9414H1.36128C1.09605 23.9414 0.836598 24.019 0.614804 24.1647C0.393011 24.3105 0.218536 24.5179 0.112817 24.7616C0.00709765 25.0053 -0.0252603 25.2746 0.0197186 25.5364C0.0646974 25.7983 0.185054 26.0413 0.366 26.2355L12.1006 38.8336C12.3548 39.1065 12.6623 39.3242 13.0039 39.4733C13.3455 39.6224 13.714 39.6997 14.0866 39.7003H69.6695C69.9348 39.7003 70.1942 39.6227 70.416 39.477C70.6378 39.3313 70.8123 39.1238 70.918 38.8801C71.0237 38.6365 71.0561 38.3671 71.0111 38.1053C70.9661 37.8434 70.8458 37.6004 70.6648 37.4062L58.9393 24.8081ZM1.36128 15.7589H56.9472C57.3208 15.7591 57.6905 15.6822 58.0332 15.5331C58.376 15.384 58.6844 15.1658 58.9393 14.8922L70.6648 2.29413C70.8458 2.09986 70.9661 1.85688 71.0111 1.59502C71.0561 1.33317 71.0237 1.06385 70.918 0.820169C70.8123 0.576485 70.6378 0.369047 70.416 0.223341C70.1942 0.0776352 69.9348 8.97308e-06 69.6695 0L14.0866 0C13.714 0.000635258 13.3455 0.077888 13.0039 0.226975C12.6623 0.376063 12.3548 0.593811 12.1006 0.866739L0.369025 13.4648C0.188254 13.6588 0.0679503 13.9016 0.0228694 14.1631C-0.0222115 14.4247 0.00988974 14.6938 0.115236 14.9373C0.220583 15.1809 0.394595 15.3884 0.615931 15.5343C0.837268 15.6802 1.09631 15.7583 1.36128 15.7589V15.7589Z\" fill=\"white\"/></g>";
349
+ default: return "";
350
+ }
226
351
  };
227
- var getTalismanOrbDataUrl = (address) => {
228
- const { bgColor1, bgColor2, glowColor, transform, cx, cy, platform } = computeTalismanOrb(address);
229
- const id = "orb";
230
- const svg = `<svg viewBox="0 0 64 64" version="1.1" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="${id}-bg"><stop offset="20%" stop-color="${bgColor1}"/><stop offset="100%" stop-color="${bgColor2}"/></linearGradient><radialGradient id="${id}-circle"><stop offset="10%" stop-color="${glowColor}"/><stop offset="100%" stop-color="transparent"/></radialGradient><clipPath id="${id}-clip"><circle cx="32" cy="32" r="32"/></clipPath></defs><g clip-path="url(#${id}-clip)"><g transform="${transform}"><rect fill="url(#${id}-bg)" x="0" y="0" width="64" height="64"/><circle fill="url(#${id}-circle)" cx="${cx}" cy="${cy}" r="45" opacity="0.7"/></g>${platformLogoSvg(platform)}</g></svg>`;
231
- return `data:image/svg+xml;base64,${btoa(svg)}`;
352
+ /**
353
+ * Returns a base64 encoded data url for the Talisman Orb svg.
354
+ * Pure implementation — no React or react-dom dependency.
355
+ */
356
+ const getTalismanOrbDataUrl = (address) => {
357
+ const { bgColor1, bgColor2, glowColor, transform, cx, cy, platform } = computeTalismanOrb(address);
358
+ const id = "orb";
359
+ const svg = `<svg viewBox="0 0 64 64" version="1.1" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="${id}-bg"><stop offset="20%" stop-color="${bgColor1}"/><stop offset="100%" stop-color="${bgColor2}"/></linearGradient><radialGradient id="${id}-circle"><stop offset="10%" stop-color="${glowColor}"/><stop offset="100%" stop-color="transparent"/></radialGradient><clipPath id="${id}-clip"><circle cx="32" cy="32" r="32"/></clipPath></defs><g clip-path="url(#${id}-clip)"><g transform="${transform}"><rect fill="url(#${id}-bg)" x="0" y="0" width="64" height="64"/><circle fill="url(#${id}-circle)" cx="${cx}" cy="${cy}" r="45" opacity="0.7"/></g>${platformLogoSvg(platform)}</g></svg>`;
360
+ return `data:image/svg+xml;base64,${btoa(svg)}`;
232
361
  };
233
- // Annotate the CommonJS export names for ESM import in node:
234
- 0 && (module.exports = {
235
- TalismanOrb,
236
- TalismanOrbRectangle,
237
- computeTalismanOrb,
238
- getTalismanOrbDataUrl,
239
- useTalismanOrb
240
- });
362
+ //#endregion
363
+ exports.TalismanOrb = TalismanOrb;
364
+ exports.TalismanOrbRectangle = TalismanOrbRectangle;
365
+ exports.computeTalismanOrb = computeTalismanOrb;
366
+ exports.getTalismanOrbDataUrl = getTalismanOrbDataUrl;
367
+ exports.useTalismanOrb = useTalismanOrb;
368
+
241
369
  //# sourceMappingURL=index.js.map