@directcryptopay/sdk 0.2.4 → 0.3.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.
Files changed (127) hide show
  1. package/README.md +51 -87
  2. package/dist/core/config.d.ts +9 -46
  3. package/dist/core/iframe.d.ts +16 -0
  4. package/dist/dcp-sdk.umd.js +1 -12811
  5. package/dist/dcp.d.ts +12 -5
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.js +219 -2
  8. package/dist/types.d.ts +26 -164
  9. package/package.json +3 -13
  10. package/dist/ExchangeController-CbO41bcH.js +0 -217
  11. package/dist/HelpersUtil-DHm6EVSE.js +0 -120
  12. package/dist/NavigationUtil-kj9LEOOd.js +0 -8
  13. package/dist/PhArrowCircleDown-lsK25DCk.js +0 -73
  14. package/dist/PhArrowClockwise-NeKHZ1co.js +0 -73
  15. package/dist/PhArrowDown-C9AkNvLs.js +0 -73
  16. package/dist/PhArrowLeft-RNfIQP1X.js +0 -73
  17. package/dist/PhArrowRight-DM1tna0G.js +0 -73
  18. package/dist/PhArrowSquareOut-S5XYbAZj.js +0 -73
  19. package/dist/PhArrowUp-DmktzOWy.js +0 -73
  20. package/dist/PhArrowUpRight-BkNeW_5i.js +0 -73
  21. package/dist/PhArrowsClockwise-CQ4pG76b.js +0 -73
  22. package/dist/PhArrowsDownUp-H6gxaNM6.js +0 -73
  23. package/dist/PhArrowsLeftRight-DZSsfMR6.js +0 -73
  24. package/dist/PhBank-4_9QzqIB.js +0 -73
  25. package/dist/PhBrowser-B-JSznId.js +0 -73
  26. package/dist/PhCaretDown-vV5oHMNi.js +0 -73
  27. package/dist/PhCaretLeft-BLo6Y_f4.js +0 -73
  28. package/dist/PhCaretRight-CqQN4TT3.js +0 -73
  29. package/dist/PhCaretUp-Df7UCAHy.js +0 -73
  30. package/dist/PhCheck-gtpfK4ed.js +0 -73
  31. package/dist/PhCircleHalf-Uq7dwDYw.js +0 -73
  32. package/dist/PhClock-SDCW-NmF.js +0 -73
  33. package/dist/PhCompass-B7hgtdx-.js +0 -73
  34. package/dist/PhCopy-BcnhyXCy.js +0 -73
  35. package/dist/PhCreditCard-BJjByVgu.js +0 -73
  36. package/dist/PhCurrencyDollar-B7ZXqXBy.js +0 -73
  37. package/dist/PhDesktop-B3VKPuJx.js +0 -73
  38. package/dist/PhDeviceMobile-Bnd0TYEH.js +0 -73
  39. package/dist/PhDotsThree-yyMWyZ-R.js +0 -73
  40. package/dist/PhEnvelope-67uzHbI9.js +0 -73
  41. package/dist/PhFunnelSimple-B-DCsloI.js +0 -73
  42. package/dist/PhGlobe-TMm_6qGk.js +0 -73
  43. package/dist/PhIdentificationCard-CePPD2xc.js +0 -73
  44. package/dist/PhImage-gY96WtHR.js +0 -73
  45. package/dist/PhInfo-DRQM_ZDP.js +0 -73
  46. package/dist/PhLightbulb-B0TxPfZ1.js +0 -73
  47. package/dist/PhMagnifyingGlass-B8si5_6W.js +0 -73
  48. package/dist/PhPaperPlaneRight-DVu5PLYd.js +0 -73
  49. package/dist/PhPlus-BfTsQnUz.js +0 -73
  50. package/dist/PhPower-CxYUGOWn.js +0 -73
  51. package/dist/PhPuzzlePiece-CQ4wh0gV.js +0 -73
  52. package/dist/PhQrCode-BuJ97NYJ.js +0 -73
  53. package/dist/PhQuestion-kJoP8Mja.js +0 -73
  54. package/dist/PhQuestionMark-C46ZkFpu.js +0 -73
  55. package/dist/PhSealCheck-Eh8jVqSN.js +0 -73
  56. package/dist/PhSignOut-jk97OSVt.js +0 -73
  57. package/dist/PhSpinner-CiYOhwMg.js +0 -73
  58. package/dist/PhTrash-pxerMqzd.js +0 -73
  59. package/dist/PhUser-BMg0VV4A.js +0 -73
  60. package/dist/PhVault-DYQvx5A-.js +0 -73
  61. package/dist/PhWarning-NLC5Mj87.js +0 -73
  62. package/dist/PhWarningCircle-Ch2jU9fA.js +0 -73
  63. package/dist/PhX-Bx4wpwm3.js +0 -73
  64. package/dist/SwapController-Ch0FFTEt.js +0 -457
  65. package/dist/ccip-BrGhNXIM.js +0 -150
  66. package/dist/core/api.d.ts +0 -39
  67. package/dist/core/logic.d.ts +0 -2
  68. package/dist/core/wallet.d.ts +0 -55
  69. package/dist/data-capture-CpafmuCb.js +0 -490
  70. package/dist/email-Dcg4jlai.js +0 -344
  71. package/dist/embedded-wallet-DeoRdAPw.js +0 -820
  72. package/dist/features-B9Nde43h.js +0 -274
  73. package/dist/hashTypedData-a7b8tdkO.js +0 -197
  74. package/dist/if-defined-k21LutCn.js +0 -10
  75. package/dist/index-9vLw53Xl.js +0 -228
  76. package/dist/index-B5wUyynz.js +0 -107
  77. package/dist/index-B8LkUrww.js +0 -86
  78. package/dist/index-BA0VwKg0.js +0 -8189
  79. package/dist/index-BB9JJ24N.js +0 -125
  80. package/dist/index-BCkEvPQ6.js +0 -172
  81. package/dist/index-BDeO_csr.js +0 -171
  82. package/dist/index-Bb7babLF.js +0 -1281
  83. package/dist/index-BjOhprVS.js +0 -199
  84. package/dist/index-BjyMgZsf.js +0 -218
  85. package/dist/index-BkThIDLX.js +0 -159
  86. package/dist/index-BmFs6nb7.js +0 -209
  87. package/dist/index-C1QEJL-2.js +0 -572
  88. package/dist/index-C4qc4PdD.js +0 -387
  89. package/dist/index-CAPvUh14.js +0 -1750
  90. package/dist/index-CBMU3PTE.js +0 -65
  91. package/dist/index-CGwPkJLF.js +0 -355
  92. package/dist/index-CNGEqX3D.js +0 -153
  93. package/dist/index-CRlCq6IB.js +0 -7981
  94. package/dist/index-Cg_o-i9X.js +0 -118
  95. package/dist/index-D1BvhCbI.js +0 -62
  96. package/dist/index-DFi8TiHc.js +0 -128
  97. package/dist/index-DLwuveL9.js +0 -555
  98. package/dist/index-DMn7ktUQ.js +0 -56
  99. package/dist/index-DOXwtuwa.js +0 -117
  100. package/dist/index-DPPOW_Tp.js +0 -118
  101. package/dist/index-DQpzHpW-.js +0 -517
  102. package/dist/index-DXHg5C-W.js +0 -276
  103. package/dist/index-DcYjZV4H.js +0 -110
  104. package/dist/index-DeL88Lwc.js +0 -41655
  105. package/dist/index-DrWVlf8b.js +0 -46
  106. package/dist/index-Dsfuc4rB.js +0 -123
  107. package/dist/index-DuTny38n.js +0 -1175
  108. package/dist/index-Nfjb6bV0.js +0 -21991
  109. package/dist/index-WwwdQSN2.js +0 -85
  110. package/dist/index-Yha9Afch.js +0 -174
  111. package/dist/index-cbQHN7GC.js +0 -100
  112. package/dist/index-hyG3cYsv.js +0 -1083
  113. package/dist/index-qLxmmPaL.js +0 -257
  114. package/dist/localBatchGatewayRequest-vfcvRH0G.js +0 -91
  115. package/dist/onramp-BSiyOX4L.js +0 -855
  116. package/dist/parseSignature-CdCMAPZN.js +0 -3304
  117. package/dist/pay-with-exchange-CduNoMEz.js +0 -525
  118. package/dist/property-Bd8U3_QP.js +0 -618
  119. package/dist/receive-CrmptJlq.js +0 -232
  120. package/dist/ref-SOwYtCZb.js +0 -107
  121. package/dist/send-oMcHMEr6.js +0 -1166
  122. package/dist/socials-C0A4-FbY.js +0 -620
  123. package/dist/swaps-CbJJ9Ciu.js +0 -1760
  124. package/dist/transactions-BDfCoBS5.js +0 -37
  125. package/dist/ui/Modal.d.ts +0 -9
  126. package/dist/ui/index.d.ts +0 -6
  127. package/dist/w3m-modal-BjsTkny7.js +0 -1706
@@ -1,199 +0,0 @@
1
- import { cU as u, cV as g, cW as m, cX as p, cY as n } from "./index-DeL88Lwc.js";
2
- import { n as r, c as x } from "./index-DuTny38n.js";
3
- import "./index-DFi8TiHc.js";
4
- import "./index-D1BvhCbI.js";
5
- const b = u`
6
- button {
7
- display: block;
8
- display: flex;
9
- align-items: center;
10
- padding: ${({ spacing: e }) => e[1]};
11
- transition: background-color ${({ durations: e }) => e.lg}
12
- ${({ easings: e }) => e["ease-out-power-2"]};
13
- will-change: background-color;
14
- background-color: ${({ tokens: e }) => e.theme.foregroundPrimary};
15
- border-radius: ${({ borderRadius: e }) => e[32]};
16
- }
17
-
18
- wui-image {
19
- border-radius: ${({ borderRadius: e }) => e[32]};
20
- }
21
-
22
- wui-text {
23
- padding-left: ${({ spacing: e }) => e[1]};
24
- padding-right: ${({ spacing: e }) => e[1]};
25
- }
26
-
27
- .left-icon-container {
28
- width: 24px;
29
- height: 24px;
30
- justify-content: center;
31
- align-items: center;
32
- }
33
-
34
- .left-image-container {
35
- position: relative;
36
- justify-content: center;
37
- align-items: center;
38
- }
39
-
40
- .chain-image {
41
- position: absolute;
42
- border: 1px solid ${({ tokens: e }) => e.theme.foregroundPrimary};
43
- }
44
-
45
- /* -- Sizes --------------------------------------------------- */
46
- button[data-size='lg'] {
47
- height: 32px;
48
- }
49
-
50
- button[data-size='md'] {
51
- height: 28px;
52
- }
53
-
54
- button[data-size='sm'] {
55
- height: 24px;
56
- }
57
-
58
- button[data-size='lg'] .token-image {
59
- width: 24px;
60
- height: 24px;
61
- }
62
-
63
- button[data-size='md'] .token-image {
64
- width: 20px;
65
- height: 20px;
66
- }
67
-
68
- button[data-size='sm'] .token-image {
69
- width: 16px;
70
- height: 16px;
71
- }
72
-
73
- button[data-size='lg'] .left-icon-container {
74
- width: 24px;
75
- height: 24px;
76
- }
77
-
78
- button[data-size='md'] .left-icon-container {
79
- width: 20px;
80
- height: 20px;
81
- }
82
-
83
- button[data-size='sm'] .left-icon-container {
84
- width: 16px;
85
- height: 16px;
86
- }
87
-
88
- button[data-size='lg'] .chain-image {
89
- width: 12px;
90
- height: 12px;
91
- bottom: 2px;
92
- right: -4px;
93
- }
94
-
95
- button[data-size='md'] .chain-image {
96
- width: 10px;
97
- height: 10px;
98
- bottom: 2px;
99
- right: -4px;
100
- }
101
-
102
- button[data-size='sm'] .chain-image {
103
- width: 8px;
104
- height: 8px;
105
- bottom: 2px;
106
- right: -3px;
107
- }
108
-
109
- /* -- Focus states --------------------------------------------------- */
110
- button:focus-visible:enabled {
111
- background-color: ${({ tokens: e }) => e.theme.foregroundSecondary};
112
- box-shadow: 0 0 0 4px ${({ tokens: e }) => e.core.foregroundAccent040};
113
- }
114
-
115
- /* -- Hover & Active states ----------------------------------------------------------- */
116
- @media (hover: hover) {
117
- button:hover:enabled,
118
- button:active:enabled {
119
- background-color: ${({ tokens: e }) => e.theme.foregroundSecondary};
120
- }
121
- }
122
-
123
- /* -- Disabled states --------------------------------------------------- */
124
- button:disabled {
125
- background-color: ${({ tokens: e }) => e.theme.foregroundSecondary};
126
- opacity: 0.5;
127
- }
128
- `;
129
- var a = function(e, t, s, d) {
130
- var c = arguments.length, o = c < 3 ? t : d === null ? d = Object.getOwnPropertyDescriptor(t, s) : d, l;
131
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, t, s, d);
132
- else for (var h = e.length - 1; h >= 0; h--) (l = e[h]) && (o = (c < 3 ? l(o) : c > 3 ? l(t, s, o) : l(t, s)) || o);
133
- return c > 3 && o && Object.defineProperty(t, s, o), o;
134
- };
135
- const f = {
136
- lg: "lg-regular",
137
- md: "lg-regular",
138
- sm: "md-regular"
139
- }, w = {
140
- lg: "lg",
141
- md: "md",
142
- sm: "sm"
143
- };
144
- let i = class extends p {
145
- constructor() {
146
- super(...arguments), this.size = "md", this.disabled = !1, this.text = "", this.loading = !1;
147
- }
148
- render() {
149
- return this.loading ? n` <wui-flex alignItems="center" gap="01" padding="01">
150
- <wui-shimmer width="20px" height="20px"></wui-shimmer>
151
- <wui-shimmer width="32px" height="18px" borderRadius="4xs"></wui-shimmer>
152
- </wui-flex>` : n`
153
- <button ?disabled=${this.disabled} data-size=${this.size}>
154
- ${this.imageTemplate()} ${this.textTemplate()}
155
- </button>
156
- `;
157
- }
158
- imageTemplate() {
159
- if (this.imageSrc && this.chainImageSrc)
160
- return n`<wui-flex class="left-image-container">
161
- <wui-image src=${this.imageSrc} class="token-image"></wui-image>
162
- <wui-image src=${this.chainImageSrc} class="chain-image"></wui-image>
163
- </wui-flex>`;
164
- if (this.imageSrc)
165
- return n`<wui-image src=${this.imageSrc} class="token-image"></wui-image>`;
166
- const t = w[this.size];
167
- return n`<wui-flex class="left-icon-container">
168
- <wui-icon size=${t} name="networkPlaceholder"></wui-icon>
169
- </wui-flex>`;
170
- }
171
- textTemplate() {
172
- const t = f[this.size];
173
- return n`<wui-text color="primary" variant=${t}
174
- >${this.text}</wui-text
175
- >`;
176
- }
177
- };
178
- i.styles = [g, m, b];
179
- a([
180
- r()
181
- ], i.prototype, "size", void 0);
182
- a([
183
- r()
184
- ], i.prototype, "imageSrc", void 0);
185
- a([
186
- r()
187
- ], i.prototype, "chainImageSrc", void 0);
188
- a([
189
- r({ type: Boolean })
190
- ], i.prototype, "disabled", void 0);
191
- a([
192
- r()
193
- ], i.prototype, "text", void 0);
194
- a([
195
- r({ type: Boolean })
196
- ], i.prototype, "loading", void 0);
197
- i = a([
198
- x("wui-token-button")
199
- ], i);
@@ -1,218 +0,0 @@
1
- import { d9 as D, bp as b, aW as I, da as C, c0 as g, b2 as A, db as y, cn as _ } from "./index-DeL88Lwc.js";
2
- import { dc as m } from "./index-DeL88Lwc.js";
3
- function q(u = {}) {
4
- let l, d, s, a;
5
- return D((n) => ({
6
- id: "baseAccount",
7
- name: "Base Account",
8
- rdns: "app.base.account",
9
- type: "baseAccount",
10
- async connect({ chainId: t, withCapabilities: e, ...i } = {}) {
11
- var r;
12
- try {
13
- const c = await this.getProvider(), p = t ?? ((r = n.chains[0]) == null ? void 0 : r.id);
14
- if (!p)
15
- throw new C();
16
- const h = await c.request({
17
- method: "wallet_connect",
18
- params: [
19
- {
20
- capabilities: "capabilities" in i && i.capabilities ? i.capabilities : {},
21
- chainIds: [
22
- g(p),
23
- ...n.chains.filter((o) => o.id !== p).map((o) => g(o.id))
24
- ]
25
- }
26
- ]
27
- }), v = h.accounts.map((o) => ({
28
- address: b(o.address),
29
- capabilities: o.capabilities ?? {}
30
- }));
31
- let f = Number(h.chainIds[0]);
32
- if (d || (d = this.onAccountsChanged.bind(this), c.on("accountsChanged", d)), s || (s = this.onChainChanged.bind(this), c.on("chainChanged", s)), a || (a = this.onDisconnect.bind(this), c.on("disconnect", a)), t && f !== t) {
33
- const o = await this.switchChain({ chainId: t }).catch((w) => {
34
- if (w.code === A.code)
35
- throw w;
36
- return { id: f };
37
- });
38
- f = (o == null ? void 0 : o.id) ?? f;
39
- }
40
- return {
41
- // TODO(v3): Make `withCapabilities: true` default behavior
42
- accounts: e ? v : v.map((o) => o.address),
43
- chainId: f
44
- };
45
- } catch (c) {
46
- throw /(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(c.message) ? new A(c) : c;
47
- }
48
- },
49
- async disconnect() {
50
- const t = await this.getProvider();
51
- d && (t.removeListener("accountsChanged", d), d = void 0), s && (t.removeListener("chainChanged", s), s = void 0), a && (t.removeListener("disconnect", a), a = void 0), t.disconnect();
52
- },
53
- async getAccounts() {
54
- return (await (await this.getProvider()).request({
55
- method: "eth_accounts"
56
- })).map((e) => b(e));
57
- },
58
- async getChainId() {
59
- const e = await (await this.getProvider()).request({
60
- method: "eth_chainId"
61
- });
62
- return Number(e);
63
- },
64
- async getProvider() {
65
- if (!l) {
66
- const t = (() => {
67
- var r;
68
- return typeof u.preference == "string" ? { options: u.preference } : {
69
- ...u.preference,
70
- options: ((r = u.preference) == null ? void 0 : r.options) ?? "all"
71
- };
72
- })(), { createBaseAccountSDK: e } = await import("./index-BA0VwKg0.js");
73
- l = e({
74
- ...u,
75
- appChainIds: n.chains.map((r) => r.id),
76
- preference: t
77
- }).getProvider();
78
- }
79
- return l;
80
- },
81
- async isAuthorized() {
82
- try {
83
- return !!(await this.getAccounts()).length;
84
- } catch {
85
- return !1;
86
- }
87
- },
88
- async switchChain({ addEthereumChainParameter: t, chainId: e }) {
89
- var c, p, h, v;
90
- const i = n.chains.find((f) => f.id === e);
91
- if (!i)
92
- throw new I(new C());
93
- const r = await this.getProvider();
94
- try {
95
- return await r.request({
96
- method: "wallet_switchEthereumChain",
97
- params: [{ chainId: g(i.id) }]
98
- }), i;
99
- } catch (f) {
100
- if (f.code === 4902)
101
- try {
102
- let o;
103
- t != null && t.blockExplorerUrls ? o = t.blockExplorerUrls : o = (c = i.blockExplorers) != null && c.default.url ? [(p = i.blockExplorers) == null ? void 0 : p.default.url] : [];
104
- let w;
105
- (h = t == null ? void 0 : t.rpcUrls) != null && h.length ? w = t.rpcUrls : w = [((v = i.rpcUrls.default) == null ? void 0 : v.http[0]) ?? ""];
106
- const U = {
107
- blockExplorerUrls: o,
108
- chainId: g(e),
109
- chainName: (t == null ? void 0 : t.chainName) ?? i.name,
110
- iconUrls: t == null ? void 0 : t.iconUrls,
111
- nativeCurrency: (t == null ? void 0 : t.nativeCurrency) ?? i.nativeCurrency,
112
- rpcUrls: w
113
- };
114
- return await r.request({
115
- method: "wallet_addEthereumChain",
116
- params: [U]
117
- }), i;
118
- } catch (o) {
119
- throw new A(o);
120
- }
121
- throw new I(f);
122
- }
123
- },
124
- onAccountsChanged(t) {
125
- t.length === 0 ? this.onDisconnect() : n.emitter.emit("change", {
126
- accounts: t.map((e) => b(e))
127
- });
128
- },
129
- onChainChanged(t) {
130
- const e = Number(t);
131
- n.emitter.emit("change", { chainId: e });
132
- },
133
- async onDisconnect(t) {
134
- n.emitter.emit("disconnect");
135
- const e = await this.getProvider();
136
- d && (e.removeListener("accountsChanged", d), d = void 0), s && (e.removeListener("chainChanged", s), s = void 0), a && (e.removeListener("disconnect", a), a = void 0);
137
- }
138
- }));
139
- }
140
- S.type = "safe";
141
- function S(u = {}) {
142
- const { shimDisconnect: l = !1 } = u;
143
- let d, s;
144
- return D((a) => ({
145
- id: "safe",
146
- name: "Safe",
147
- type: S.type,
148
- async connect({ withCapabilities: n } = {}) {
149
- var r;
150
- const t = await this.getProvider();
151
- if (!t)
152
- throw new y();
153
- const e = await this.getAccounts(), i = await this.getChainId();
154
- return s || (s = this.onDisconnect.bind(this), t.on("disconnect", s)), l && await ((r = a.storage) == null ? void 0 : r.removeItem("safe.disconnected")), {
155
- // TODO(v3): Make `withCapabilities: true` default behavior
156
- accounts: n ? e.map((c) => ({ address: c, capabilities: {} })) : e,
157
- chainId: i
158
- };
159
- },
160
- async disconnect() {
161
- var t;
162
- const n = await this.getProvider();
163
- if (!n)
164
- throw new y();
165
- s && (n.removeListener("disconnect", s), s = void 0), l && await ((t = a.storage) == null ? void 0 : t.setItem("safe.disconnected", !0));
166
- },
167
- async getAccounts() {
168
- const n = await this.getProvider();
169
- if (!n)
170
- throw new y();
171
- return (await n.request({ method: "eth_accounts" })).map(b);
172
- },
173
- async getProvider() {
174
- if (typeof window < "u" && (window == null ? void 0 : window.parent) !== window) {
175
- if (!d) {
176
- const { default: t } = await import("./index-C4qc4PdD.js"), e = new t(u), i = await _(() => e.safe.getInfo(), {
177
- timeout: u.unstable_getInfoTimeout ?? 10
178
- });
179
- if (!i)
180
- throw new Error("Could not load Safe information");
181
- const r = await (async () => {
182
- const c = await import("./index-Nfjb6bV0.js").then((p) => p.i);
183
- return typeof c.SafeAppProvider != "function" && typeof c.default.SafeAppProvider == "function" ? c.default.SafeAppProvider : c.SafeAppProvider;
184
- })();
185
- d = new r(i, e);
186
- }
187
- return d;
188
- }
189
- },
190
- async getChainId() {
191
- const n = await this.getProvider();
192
- if (!n)
193
- throw new y();
194
- return Number(n.chainId);
195
- },
196
- async isAuthorized() {
197
- var n;
198
- try {
199
- return l && // If shim exists in storage, connector is disconnected
200
- await ((n = a.storage) == null ? void 0 : n.getItem("safe.disconnected")) ? !1 : !!(await this.getAccounts()).length;
201
- } catch {
202
- return !1;
203
- }
204
- },
205
- onAccountsChanged() {
206
- },
207
- onChainChanged() {
208
- },
209
- onDisconnect() {
210
- a.emitter.emit("disconnect");
211
- }
212
- }));
213
- }
214
- export {
215
- q as baseAccount,
216
- m as injected,
217
- S as safe
218
- };
@@ -1,159 +0,0 @@
1
- import { c$ as d, cC as h, cR as f, cS as g, cU as w, cX as b, cY as y } from "./index-DeL88Lwc.js";
2
- import { r as m, c as x } from "./index-DuTny38n.js";
3
- const o = h({
4
- message: "",
5
- open: !1,
6
- triggerRect: {
7
- width: 0,
8
- height: 0,
9
- top: 0,
10
- left: 0
11
- },
12
- variant: "shade"
13
- }), v = {
14
- state: o,
15
- subscribe(t) {
16
- return g(o, () => t(o));
17
- },
18
- subscribeKey(t, e) {
19
- return f(o, t, e);
20
- },
21
- showTooltip({ message: t, triggerRect: e, variant: i }) {
22
- o.open = !0, o.message = t, o.triggerRect = e, o.variant = i;
23
- },
24
- hide() {
25
- o.open = !1, o.message = "", o.triggerRect = {
26
- width: 0,
27
- height: 0,
28
- top: 0,
29
- left: 0
30
- };
31
- }
32
- }, s = d(v), $ = w`
33
- :host {
34
- pointer-events: none;
35
- }
36
-
37
- :host > wui-flex {
38
- display: var(--w3m-tooltip-display);
39
- opacity: var(--w3m-tooltip-opacity);
40
- padding: 9px ${({ spacing: t }) => t[3]} 10px ${({ spacing: t }) => t[3]};
41
- border-radius: ${({ borderRadius: t }) => t[3]};
42
- color: ${({ tokens: t }) => t.theme.backgroundPrimary};
43
- position: absolute;
44
- top: var(--w3m-tooltip-top);
45
- left: var(--w3m-tooltip-left);
46
- transform: translate(calc(-50% + var(--w3m-tooltip-parent-width)), calc(-100% - 8px));
47
- max-width: calc(var(--apkt-modal-width) - ${({ spacing: t }) => t[5]});
48
- transition: opacity ${({ durations: t }) => t.lg}
49
- ${({ easings: t }) => t["ease-out-power-2"]};
50
- will-change: opacity;
51
- opacity: 0;
52
- animation-duration: ${({ durations: t }) => t.xl};
53
- animation-timing-function: ${({ easings: t }) => t["ease-out-power-2"]};
54
- animation-name: fade-in;
55
- animation-fill-mode: forwards;
56
- }
57
-
58
- :host([data-variant='shade']) > wui-flex {
59
- background-color: ${({ tokens: t }) => t.theme.foregroundPrimary};
60
- }
61
-
62
- :host([data-variant='shade']) > wui-flex > wui-text {
63
- color: ${({ tokens: t }) => t.theme.textSecondary};
64
- }
65
-
66
- :host([data-variant='fill']) > wui-flex {
67
- background-color: ${({ tokens: t }) => t.theme.textPrimary};
68
- border: none;
69
- }
70
-
71
- wui-icon {
72
- position: absolute;
73
- width: 12px !important;
74
- height: 4px !important;
75
- color: ${({ tokens: t }) => t.theme.foregroundPrimary};
76
- }
77
-
78
- wui-icon[data-placement='top'] {
79
- bottom: 0px;
80
- left: 50%;
81
- transform: translate(-50%, 95%);
82
- }
83
-
84
- wui-icon[data-placement='bottom'] {
85
- top: 0;
86
- left: 50%;
87
- transform: translate(-50%, -95%) rotate(180deg);
88
- }
89
-
90
- wui-icon[data-placement='right'] {
91
- top: 50%;
92
- left: 0;
93
- transform: translate(-65%, -50%) rotate(90deg);
94
- }
95
-
96
- wui-icon[data-placement='left'] {
97
- top: 50%;
98
- right: 0%;
99
- transform: translate(65%, -50%) rotate(270deg);
100
- }
101
-
102
- @keyframes fade-in {
103
- from {
104
- opacity: 0;
105
- }
106
- to {
107
- opacity: 1;
108
- }
109
- }
110
- `;
111
- var n = function(t, e, i, p) {
112
- var c = arguments.length, a = c < 3 ? e : p === null ? p = Object.getOwnPropertyDescriptor(e, i) : p, l;
113
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(t, e, i, p);
114
- else for (var u = t.length - 1; u >= 0; u--) (l = t[u]) && (a = (c < 3 ? l(a) : c > 3 ? l(e, i, a) : l(e, i)) || a);
115
- return c > 3 && a && Object.defineProperty(e, i, a), a;
116
- };
117
- let r = class extends b {
118
- constructor() {
119
- super(), this.unsubscribe = [], this.open = s.state.open, this.message = s.state.message, this.triggerRect = s.state.triggerRect, this.variant = s.state.variant, this.unsubscribe.push(s.subscribe((e) => {
120
- this.open = e.open, this.message = e.message, this.triggerRect = e.triggerRect, this.variant = e.variant;
121
- }));
122
- }
123
- disconnectedCallback() {
124
- this.unsubscribe.forEach((e) => e());
125
- }
126
- render() {
127
- this.dataset.variant = this.variant;
128
- const e = this.triggerRect.top, i = this.triggerRect.left;
129
- return this.style.cssText = `
130
- --w3m-tooltip-top: ${e}px;
131
- --w3m-tooltip-left: ${i}px;
132
- --w3m-tooltip-parent-width: ${this.triggerRect.width / 2}px;
133
- --w3m-tooltip-display: ${this.open ? "flex" : "none"};
134
- --w3m-tooltip-opacity: ${this.open ? 1 : 0};
135
- `, y`<wui-flex>
136
- <wui-icon data-placement="top" size="inherit" name="cursor"></wui-icon>
137
- <wui-text color="primary" variant="sm-regular">${this.message}</wui-text>
138
- </wui-flex>`;
139
- }
140
- };
141
- r.styles = [$];
142
- n([
143
- m()
144
- ], r.prototype, "open", void 0);
145
- n([
146
- m()
147
- ], r.prototype, "message", void 0);
148
- n([
149
- m()
150
- ], r.prototype, "triggerRect", void 0);
151
- n([
152
- m()
153
- ], r.prototype, "variant", void 0);
154
- r = n([
155
- x("w3m-tooltip")
156
- ], r);
157
- export {
158
- s as T
159
- };