@bchconnect/ui 0.0.0-stage → 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 +21 -0
- package/README.md +269 -2
- package/custom-elements.json +1771 -0
- package/dist/assets.generated.js +28 -0
- package/dist/assets.generated.js.map +1 -0
- package/dist/bchconnect-modal.d.ts +69 -0
- package/dist/bchconnect-modal.js +96 -0
- package/dist/bchconnect-modal.js.map +1 -0
- package/dist/code.js +130 -0
- package/dist/code.js.map +1 -0
- package/dist/defaults.d.ts +50 -0
- package/dist/defaults.js +139 -0
- package/dist/defaults.js.map +1 -0
- package/dist/define.d.ts +17 -0
- package/dist/define.js +23 -0
- package/dist/define.js.map +1 -0
- package/dist/directory.js +37 -0
- package/dist/directory.js.map +1 -0
- package/dist/faces.js +80 -0
- package/dist/faces.js.map +1 -0
- package/dist/gesture.js +78 -0
- package/dist/gesture.js.map +1 -0
- package/dist/headless.d.ts +99 -0
- package/dist/headless.js +190 -0
- package/dist/headless.js.map +1 -0
- package/dist/html.js +17 -0
- package/dist/html.js.map +1 -0
- package/dist/icons.js +21 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +8 -0
- package/dist/locales/es.d.ts +12 -0
- package/dist/locales/es.js +50 -0
- package/dist/locales/es.js.map +1 -0
- package/dist/messages.d.ts +95 -0
- package/dist/messages.js +63 -0
- package/dist/messages.js.map +1 -0
- package/dist/modal.d.ts +112 -0
- package/dist/modal.js +694 -0
- package/dist/modal.js.map +1 -0
- package/dist/motion.js +160 -0
- package/dist/motion.js.map +1 -0
- package/dist/page-scroll.js +28 -0
- package/dist/page-scroll.js.map +1 -0
- package/dist/register.js +14 -0
- package/dist/register.js.map +1 -0
- package/dist/sheet-query.js +8 -0
- package/dist/sheet-query.js.map +1 -0
- package/dist/sheet.js +329 -0
- package/dist/sheet.js.map +1 -0
- package/dist/state.d.ts +175 -0
- package/dist/state.js +11 -0
- package/dist/state.js.map +1 -0
- package/dist/styles/modal.css.sheet.js +13 -0
- package/dist/styles/modal.css.sheet.js.map +1 -0
- package/dist/styles/theme.generated.css.sheet.js +13 -0
- package/dist/styles/theme.generated.css.sheet.js.map +1 -0
- package/dist/styles/toast.css.sheet.js +13 -0
- package/dist/styles/toast.css.sheet.js.map +1 -0
- package/dist/styles/tokens.css.sheet.js +13 -0
- package/dist/styles/tokens.css.sheet.js.map +1 -0
- package/dist/theme.generated.d.ts +105 -0
- package/dist/theme.generated.js +96 -0
- package/dist/theme.generated.js.map +1 -0
- package/dist/toast.d.ts +96 -0
- package/dist/toast.js +180 -0
- package/dist/toast.js.map +1 -0
- package/package.json +87 -3
package/dist/headless.js
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
|
|
2
|
+
import { BCHC_DIRECTORY, BCHC_PROTOCOLS, BCHC_WALLETS } from "./defaults.js";
|
|
3
|
+
import { AbortedError, ConfigError, isBchConnectError } from "@bchconnect/core";
|
|
4
|
+
//#region src/headless.ts
|
|
5
|
+
function reasonOf(error) {
|
|
6
|
+
if (!isBchConnectError(error)) return "transport";
|
|
7
|
+
switch (error.code) {
|
|
8
|
+
case "REJECTED": return "rejected";
|
|
9
|
+
case "TIMEOUT": return "timeout";
|
|
10
|
+
case "ABORTED": return "aborted";
|
|
11
|
+
case "NETWORK_MISMATCH": return "network-mismatch";
|
|
12
|
+
default: return "transport";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function isProtocolId(id) {
|
|
16
|
+
return BCHC_PROTOCOLS.some((entry) => entry.id === id);
|
|
17
|
+
}
|
|
18
|
+
function enabledProtocols(context, order) {
|
|
19
|
+
const offered = context.protocols.filter(isProtocolId);
|
|
20
|
+
return order.filter((id) => offered.includes(id) && (context.protocol === null || id === context.protocol)).flatMap((id) => BCHC_PROTOCOLS.filter((entry) => entry.id === id));
|
|
21
|
+
}
|
|
22
|
+
function run(renderer, options, context) {
|
|
23
|
+
const protocols = enabledProtocols(context, options.protocols ?? BCHC_PROTOCOLS.map((entry) => entry.id));
|
|
24
|
+
const enabled = protocols.map((entry) => entry.id);
|
|
25
|
+
const listed = (options.wallets ?? BCHC_WALLETS).filter((wallet) => wallet.protocols.some((id) => enabled.includes(id)));
|
|
26
|
+
const preferred = listed.find((entry) => entry.id === options.defaults?.wallet);
|
|
27
|
+
const initial = enabled.find((id) => id === options.defaults?.protocol) ?? enabled.find((id) => preferred?.protocols.includes(id)) ?? enabled[0];
|
|
28
|
+
if (initial === void 0) return Promise.reject(new ConfigError("No enabled protocol has a session type the modal shows"));
|
|
29
|
+
const walletFor = (protocol, current) => current?.protocols.includes(protocol) ? current.id : listed.find((entry) => entry.protocols.includes(protocol))?.id ?? null;
|
|
30
|
+
const openWallet = walletFor(initial, preferred);
|
|
31
|
+
const wallets = [...listed.filter((entry) => entry.id === openWallet), ...listed.filter((entry) => entry.id !== openWallet)];
|
|
32
|
+
return new Promise((resolve, reject) => {
|
|
33
|
+
let view = {
|
|
34
|
+
screen: "connect",
|
|
35
|
+
protocol: initial,
|
|
36
|
+
protocols,
|
|
37
|
+
wallets,
|
|
38
|
+
wallet: openWallet,
|
|
39
|
+
directory: BCHC_DIRECTORY,
|
|
40
|
+
network: context.network,
|
|
41
|
+
phase: { kind: "initiating" }
|
|
42
|
+
};
|
|
43
|
+
let attempt = null;
|
|
44
|
+
let queue = Promise.resolve();
|
|
45
|
+
let done = false;
|
|
46
|
+
function update(patch) {
|
|
47
|
+
view = {
|
|
48
|
+
...view,
|
|
49
|
+
...patch
|
|
50
|
+
};
|
|
51
|
+
renderer.update(view);
|
|
52
|
+
}
|
|
53
|
+
function selected() {
|
|
54
|
+
if (renderer.showsWallets?.() === false) return void 0;
|
|
55
|
+
const wallet = wallets.find((entry) => entry.id === view.wallet);
|
|
56
|
+
return wallet === void 0 ? void 0 : {
|
|
57
|
+
id: wallet.id,
|
|
58
|
+
name: wallet.name
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
let wanted = 0;
|
|
62
|
+
async function begin(protocol, generation) {
|
|
63
|
+
const previous = attempt;
|
|
64
|
+
previous?.controller.abort();
|
|
65
|
+
await previous?.settled;
|
|
66
|
+
if (done || generation !== wanted) return;
|
|
67
|
+
const controller = new AbortController();
|
|
68
|
+
const current = {
|
|
69
|
+
controller,
|
|
70
|
+
settled: Promise.resolve()
|
|
71
|
+
};
|
|
72
|
+
attempt = current;
|
|
73
|
+
const isCurrent = () => attempt === current && !done;
|
|
74
|
+
const connecting = context.connect(protocol, {
|
|
75
|
+
signal: controller.signal,
|
|
76
|
+
onPairing(pairing) {
|
|
77
|
+
if (isCurrent() && pairing.kind === "uri") update({ phase: {
|
|
78
|
+
kind: "awaiting-approval",
|
|
79
|
+
link: pairing.uri
|
|
80
|
+
} });
|
|
81
|
+
},
|
|
82
|
+
wallet: selected
|
|
83
|
+
});
|
|
84
|
+
current.settled = connecting.then(() => {}, () => {});
|
|
85
|
+
connecting.then((session) => {
|
|
86
|
+
if (isCurrent()) succeed(session);
|
|
87
|
+
}, (error) => {
|
|
88
|
+
if (isCurrent() && !controller.signal.aborted) update({ phase: {
|
|
89
|
+
kind: "failed",
|
|
90
|
+
reason: reasonOf(error)
|
|
91
|
+
} });
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function start(protocol) {
|
|
95
|
+
wanted += 1;
|
|
96
|
+
const generation = wanted;
|
|
97
|
+
if (view.protocol !== protocol || view.phase.kind !== "initiating") {
|
|
98
|
+
const current = wallets.find((entry) => entry.id === view.wallet);
|
|
99
|
+
update({
|
|
100
|
+
protocol,
|
|
101
|
+
wallet: walletFor(protocol, current),
|
|
102
|
+
phase: { kind: "initiating" }
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
queue = queue.then(() => begin(protocol, generation));
|
|
106
|
+
}
|
|
107
|
+
async function succeed(session) {
|
|
108
|
+
done = true;
|
|
109
|
+
const listed = wallets.find((entry) => entry.id === session.wallet.id);
|
|
110
|
+
update({ phase: {
|
|
111
|
+
kind: "connected",
|
|
112
|
+
walletName: session.wallet.name ?? listed?.name ?? null,
|
|
113
|
+
walletLogo: listed?.logo ?? session.wallet.icon ?? null
|
|
114
|
+
} });
|
|
115
|
+
await renderer.close().catch(() => {});
|
|
116
|
+
resolve(session);
|
|
117
|
+
}
|
|
118
|
+
async function end(reason) {
|
|
119
|
+
if (done) return;
|
|
120
|
+
done = true;
|
|
121
|
+
attempt?.controller.abort();
|
|
122
|
+
await renderer.close().catch(() => {});
|
|
123
|
+
reject(reason);
|
|
124
|
+
}
|
|
125
|
+
const actions = {
|
|
126
|
+
selectWallet(id) {
|
|
127
|
+
const wallet = wallets.find((entry) => entry.id === id);
|
|
128
|
+
if (done || wallet === void 0 || id === view.wallet) return;
|
|
129
|
+
update({ wallet: id });
|
|
130
|
+
if (wallet.protocols.includes(view.protocol)) return;
|
|
131
|
+
const fallback = enabled.find((entry) => wallet.protocols.includes(entry));
|
|
132
|
+
if (fallback !== void 0) start(fallback);
|
|
133
|
+
},
|
|
134
|
+
selectProtocol(protocol) {
|
|
135
|
+
if (done || protocol === view.protocol || !enabled.includes(protocol)) return;
|
|
136
|
+
start(protocol);
|
|
137
|
+
},
|
|
138
|
+
showScreen(screen) {
|
|
139
|
+
if (!done && screen !== view.screen) update({ screen });
|
|
140
|
+
},
|
|
141
|
+
retry() {
|
|
142
|
+
if (!done && view.phase.kind === "failed") start(view.protocol);
|
|
143
|
+
},
|
|
144
|
+
dismiss() {
|
|
145
|
+
end(new AbortedError("The person closed the connection modal"));
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
if (context.signal.aborted) {
|
|
149
|
+
reject(new AbortedError("The connection was aborted"));
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
context.signal.addEventListener("abort", () => void end(new AbortedError("The connection was aborted")), { once: true });
|
|
153
|
+
renderer.open(view, actions);
|
|
154
|
+
start(initial);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* The modal's connection logic as a `ConnectUi`, drawn by any renderer. Pass
|
|
159
|
+
* the result as the client's `ui`.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```ts
|
|
163
|
+
* import { createClient } from "@bchconnect/core";
|
|
164
|
+
* import { headlessModal } from "@bchconnect/ui/headless";
|
|
165
|
+
*
|
|
166
|
+
* const client = createClient({
|
|
167
|
+
* connectors,
|
|
168
|
+
* network: "mainnet",
|
|
169
|
+
* appMetadata,
|
|
170
|
+
* ui: headlessModal({
|
|
171
|
+
* open(view, actions) { myModal.show(view, actions); },
|
|
172
|
+
* update(view) { myModal.render(view); },
|
|
173
|
+
* close() { return myModal.hide(); },
|
|
174
|
+
* }),
|
|
175
|
+
* });
|
|
176
|
+
* await client.init();
|
|
177
|
+
* const session = await client.connect();
|
|
178
|
+
* ```
|
|
179
|
+
*
|
|
180
|
+
* @beta
|
|
181
|
+
*/
|
|
182
|
+
function headlessModal(renderer, options = {}) {
|
|
183
|
+
return { connect(context) {
|
|
184
|
+
return run(renderer, options, context);
|
|
185
|
+
} };
|
|
186
|
+
}
|
|
187
|
+
//#endregion
|
|
188
|
+
export { headlessModal };
|
|
189
|
+
|
|
190
|
+
//# sourceMappingURL=headless.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headless.js","names":[],"sources":["../src/headless.ts"],"sourcesContent":["import {\n\tAbortedError,\n\tConfigError,\n\ttype ConnectUi,\n\ttype ConnectUiContext,\n\tisBchConnectError,\n\ttype Pairing,\n\ttype Session,\n\ttype WalletSelection,\n} from \"@bchconnect/core\";\nimport { BCHC_DIRECTORY, BCHC_PROTOCOLS, BCHC_WALLETS } from \"./defaults.ts\";\nimport type {\n\tConnectPhase,\n\tFailureReason,\n\tModalScreen,\n\tModalView,\n\tProtocolId,\n\tProtocolOption,\n\tWalletOption,\n} from \"./state.ts\";\n\n// Everything a renderer draws, so a custom one imports this entry alone.\nexport type {\n\tConnectPhase,\n\tFailureReason,\n\tMarkShape,\n\tModalScreen,\n\tModalView,\n\tNetwork,\n\tProtocolId,\n\tProtocolMark,\n\tProtocolOption,\n\tWalletDirectoryEntry,\n\tWalletOption,\n} from \"./state.ts\";\n\n/**\n * What the person did in the modal, reported by a {@link ModalRenderer}.\n *\n * @beta\n */\nexport interface ModalActions {\n\t/** The person selected a wallet, by id. */\n\tselectWallet(wallet: string): void;\n\t/** The person picked a session type. */\n\tselectProtocol(protocol: ProtocolId): void;\n\t/** The person moved between the connect and wallets screens. */\n\tshowScreen(screen: ModalScreen): void;\n\t/** The person pressed Try again after a failure. */\n\tretry(): void;\n\t/** The person dismissed the modal: close button, Escape, backdrop or drag. */\n\tdismiss(): void;\n}\n\n/**\n * Draws the modal for {@link headlessModal}. It keeps no connection state:\n * it draws each view and reports what the person does.\n *\n * @beta\n */\nexport interface ModalRenderer {\n\t/** Shows the modal with its first view. */\n\topen(view: ModalView, actions: ModalActions): void;\n\t/** Replaces the view, each time with a new object. */\n\tupdate(view: ModalView): void;\n\t/** Plays the exit and removes the modal; resolves once it is gone. */\n\tclose(): Promise<void>;\n\t/**\n\t * Whether the person can see the wallet list now. When `false`, the\n\t * selection is not reported as the session's wallet. Defaults to `true`.\n\t */\n\tshowsWallets?(): boolean;\n}\n\n/**\n * The protocol and wallet a {@link headlessModal} opens on.\n *\n * @beta\n */\nexport interface ModalDefaults {\n\t/** The initial protocol. Defaults to the first enabled one the default wallet speaks. */\n\tprotocol?: ProtocolId;\n\t/** The initially selected wallet, by id. Defaults to the first listed wallet that speaks the initial protocol. */\n\twallet?: string;\n}\n\n/**\n * Options for {@link headlessModal}.\n *\n * @beta\n */\nexport interface HeadlessModalOptions {\n\t/**\n\t * Wallets to list, in order, with the one selected on open moved first.\n\t * Defaults to the curated wallets that speak an enabled protocol.\n\t */\n\twallets?: readonly WalletOption[];\n\t/** Session type order. */\n\tprotocols?: readonly ProtocolId[];\n\t/**\n\t * What the modal opens on. An explicit protocol wins over a wallet that\n\t * lacks it; a default that is not enabled or not listed falls back.\n\t */\n\tdefaults?: ModalDefaults;\n}\n\nfunction reasonOf(error: unknown): FailureReason {\n\tif (!isBchConnectError(error)) return \"transport\";\n\tswitch (error.code) {\n\t\tcase \"REJECTED\":\n\t\t\treturn \"rejected\";\n\t\tcase \"TIMEOUT\":\n\t\t\treturn \"timeout\";\n\t\tcase \"ABORTED\":\n\t\t\treturn \"aborted\";\n\t\tcase \"NETWORK_MISMATCH\":\n\t\t\treturn \"network-mismatch\";\n\t\tdefault:\n\t\t\treturn \"transport\";\n\t}\n}\n\nfunction isProtocolId(id: string): id is ProtocolId {\n\treturn BCHC_PROTOCOLS.some((entry) => entry.id === id);\n}\n\nfunction enabledProtocols(\n\tcontext: ConnectUiContext,\n\torder: readonly ProtocolId[],\n): readonly ProtocolOption[] {\n\tconst offered = context.protocols.filter(isProtocolId);\n\treturn order\n\t\t.filter(\n\t\t\t(id) =>\n\t\t\t\toffered.includes(id) &&\n\t\t\t\t(context.protocol === null || id === context.protocol),\n\t\t)\n\t\t.flatMap((id) => BCHC_PROTOCOLS.filter((entry) => entry.id === id));\n}\n\ninterface Attempt {\n\treadonly controller: AbortController;\n\tsettled: Promise<void>;\n}\n\nfunction run(\n\trenderer: ModalRenderer,\n\toptions: HeadlessModalOptions,\n\tcontext: ConnectUiContext,\n): Promise<Session> {\n\tconst protocols = enabledProtocols(\n\t\tcontext,\n\t\toptions.protocols ?? BCHC_PROTOCOLS.map((entry) => entry.id),\n\t);\n\tconst enabled = protocols.map((entry) => entry.id);\n\tconst listed = (options.wallets ?? BCHC_WALLETS).filter((wallet) =>\n\t\twallet.protocols.some((id) => enabled.includes(id)),\n\t);\n\tconst preferred = listed.find(\n\t\t(entry) => entry.id === options.defaults?.wallet,\n\t);\n\tconst initial =\n\t\tenabled.find((id) => id === options.defaults?.protocol) ??\n\t\tenabled.find((id) => preferred?.protocols.includes(id)) ??\n\t\tenabled[0];\n\tif (initial === undefined) {\n\t\treturn Promise.reject(\n\t\t\tnew ConfigError(\"No enabled protocol has a session type the modal shows\"),\n\t\t);\n\t}\n\tconst walletFor = (protocol: ProtocolId, current?: WalletOption) =>\n\t\tcurrent?.protocols.includes(protocol)\n\t\t\t? current.id\n\t\t\t: (listed.find((entry) => entry.protocols.includes(protocol))?.id ??\n\t\t\t\tnull);\n\t// The wallet selected on open leads the list; the rest keep the given order.\n\tconst openWallet = walletFor(initial, preferred);\n\tconst wallets = [\n\t\t...listed.filter((entry) => entry.id === openWallet),\n\t\t...listed.filter((entry) => entry.id !== openWallet),\n\t];\n\n\treturn new Promise<Session>((resolve, reject) => {\n\t\tlet view: ModalView = {\n\t\t\tscreen: \"connect\",\n\t\t\tprotocol: initial,\n\t\t\tprotocols,\n\t\t\twallets,\n\t\t\twallet: openWallet,\n\t\t\tdirectory: BCHC_DIRECTORY,\n\t\t\tnetwork: context.network,\n\t\t\tphase: { kind: \"initiating\" },\n\t\t};\n\t\tlet attempt: Attempt | null = null;\n\t\t// Attempts start one after another, so a switch back never finds its protocol still pending.\n\t\tlet queue = Promise.resolve();\n\t\tlet done = false;\n\n\t\tfunction update(patch: Partial<ModalView>) {\n\t\t\tview = { ...view, ...patch };\n\t\t\trenderer.update(view);\n\t\t}\n\n\t\tfunction selected(): WalletSelection | undefined {\n\t\t\tif (renderer.showsWallets?.() === false) return undefined;\n\t\t\tconst wallet = wallets.find((entry) => entry.id === view.wallet);\n\t\t\t// No logo: the selection is saved with the session, and a data URI would overflow cookie storage.\n\t\t\treturn wallet === undefined\n\t\t\t\t? undefined\n\t\t\t\t: { id: wallet.id, name: wallet.name };\n\t\t}\n\n\t\t// Each start bumps this, so a start superseded while it waited is skipped.\n\t\tlet wanted = 0;\n\n\t\tasync function begin(protocol: ProtocolId, generation: number) {\n\t\t\tconst previous = attempt;\n\t\t\tprevious?.controller.abort();\n\t\t\tawait previous?.settled;\n\t\t\tif (done || generation !== wanted) return;\n\n\t\t\tconst controller = new AbortController();\n\t\t\tconst current: Attempt = { controller, settled: Promise.resolve() };\n\t\t\tattempt = current;\n\t\t\tconst isCurrent = () => attempt === current && !done;\n\t\t\tconst connecting = context.connect(protocol, {\n\t\t\t\tsignal: controller.signal,\n\t\t\t\tonPairing(pairing: Pairing) {\n\t\t\t\t\tif (isCurrent() && pairing.kind === \"uri\") {\n\t\t\t\t\t\tupdate({ phase: { kind: \"awaiting-approval\", link: pairing.uri } });\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\twallet: selected,\n\t\t\t});\n\t\t\tcurrent.settled = connecting.then(\n\t\t\t\t() => {},\n\t\t\t\t() => {},\n\t\t\t);\n\t\t\tconnecting.then(\n\t\t\t\t(session) => {\n\t\t\t\t\tif (isCurrent()) void succeed(session);\n\t\t\t\t},\n\t\t\t\t(error: unknown) => {\n\t\t\t\t\tif (isCurrent() && !controller.signal.aborted) {\n\t\t\t\t\t\tupdate({ phase: { kind: \"failed\", reason: reasonOf(error) } });\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\t// The view switches at once; the attempt follows once the previous one settles.\n\t\tfunction start(protocol: ProtocolId) {\n\t\t\twanted += 1;\n\t\t\tconst generation = wanted;\n\t\t\tif (view.protocol !== protocol || view.phase.kind !== \"initiating\") {\n\t\t\t\tconst current = wallets.find((entry) => entry.id === view.wallet);\n\t\t\t\tupdate({\n\t\t\t\t\tprotocol,\n\t\t\t\t\twallet: walletFor(protocol, current),\n\t\t\t\t\tphase: { kind: \"initiating\" },\n\t\t\t\t});\n\t\t\t}\n\t\t\tqueue = queue.then(() => begin(protocol, generation));\n\t\t}\n\n\t\tasync function succeed(session: Session) {\n\t\t\tdone = true;\n\t\t\t// A listed wallet is shown with its bundled logo, not the one on the wire.\n\t\t\tconst listed = wallets.find((entry) => entry.id === session.wallet.id);\n\t\t\tconst phase: ConnectPhase = {\n\t\t\t\tkind: \"connected\",\n\t\t\t\twalletName: session.wallet.name ?? listed?.name ?? null,\n\t\t\t\twalletLogo: listed?.logo ?? session.wallet.icon ?? null,\n\t\t\t};\n\t\t\tupdate({ phase });\n\t\t\tawait renderer.close().catch(() => {});\n\t\t\tresolve(session);\n\t\t}\n\n\t\tasync function end(reason: unknown) {\n\t\t\tif (done) return;\n\t\t\tdone = true;\n\t\t\tattempt?.controller.abort();\n\t\t\tawait renderer.close().catch(() => {});\n\t\t\treject(reason);\n\t\t}\n\n\t\tconst actions: ModalActions = {\n\t\t\tselectWallet(id) {\n\t\t\t\tconst wallet = wallets.find((entry) => entry.id === id);\n\t\t\t\tif (done || wallet === undefined || id === view.wallet) return;\n\t\t\t\tupdate({ wallet: id });\n\t\t\t\tif (wallet.protocols.includes(view.protocol)) return;\n\t\t\t\tconst fallback = enabled.find((entry) =>\n\t\t\t\t\twallet.protocols.includes(entry),\n\t\t\t\t);\n\t\t\t\tif (fallback !== undefined) start(fallback);\n\t\t\t},\n\t\t\tselectProtocol(protocol) {\n\t\t\t\tif (done || protocol === view.protocol || !enabled.includes(protocol))\n\t\t\t\t\treturn;\n\t\t\t\tstart(protocol);\n\t\t\t},\n\t\t\tshowScreen(screen) {\n\t\t\t\tif (!done && screen !== view.screen) update({ screen });\n\t\t\t},\n\t\t\tretry() {\n\t\t\t\tif (!done && view.phase.kind === \"failed\") start(view.protocol);\n\t\t\t},\n\t\t\tdismiss() {\n\t\t\t\tvoid end(new AbortedError(\"The person closed the connection modal\"));\n\t\t\t},\n\t\t};\n\n\t\tif (context.signal.aborted) {\n\t\t\treject(new AbortedError(\"The connection was aborted\"));\n\t\t\treturn;\n\t\t}\n\t\tcontext.signal.addEventListener(\n\t\t\t\"abort\",\n\t\t\t() => void end(new AbortedError(\"The connection was aborted\")),\n\t\t\t{ once: true },\n\t\t);\n\t\trenderer.open(view, actions);\n\t\tstart(initial);\n\t});\n}\n\n/**\n * The modal's connection logic as a `ConnectUi`, drawn by any renderer. Pass\n * the result as the client's `ui`.\n *\n * @example\n * ```ts\n * import { createClient } from \"@bchconnect/core\";\n * import { headlessModal } from \"@bchconnect/ui/headless\";\n *\n * const client = createClient({\n * connectors,\n * network: \"mainnet\",\n * appMetadata,\n * ui: headlessModal({\n * open(view, actions) { myModal.show(view, actions); },\n * update(view) { myModal.render(view); },\n * close() { return myModal.hide(); },\n * }),\n * });\n * await client.init();\n * const session = await client.connect();\n * ```\n *\n * @beta\n */\nexport function headlessModal(\n\trenderer: ModalRenderer,\n\toptions: HeadlessModalOptions = {},\n): ConnectUi {\n\treturn {\n\t\tconnect(context) {\n\t\t\treturn run(renderer, options, context);\n\t\t},\n\t};\n}\n"],"mappings":"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"}
|
package/dist/html.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/html.ts
|
|
3
|
+
const SCRIPT_SCHEMES = /* @__PURE__ */ new Set([
|
|
4
|
+
"javascript",
|
|
5
|
+
"data",
|
|
6
|
+
"vbscript"
|
|
7
|
+
]);
|
|
8
|
+
function safeHref(url) {
|
|
9
|
+
const trimmed = url.trim();
|
|
10
|
+
if (trimmed === "") return null;
|
|
11
|
+
const scheme = /^([a-z][a-z\d+.-]*):/i.exec(trimmed.replace(/[\s\p{Cc}]/gu, ""))?.[1];
|
|
12
|
+
return scheme !== void 0 && SCRIPT_SCHEMES.has(scheme.toLowerCase()) ? null : trimmed;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { safeHref };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=html.js.map
|
package/dist/html.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.js","names":[],"sources":["../src/html.ts"],"sourcesContent":["const SCRIPT_SCHEMES = new Set([\"javascript\", \"data\", \"vbscript\"]);\n\n// Denylist, not an allowlist: pairing links use custom schemes (wc:, WIZ://,\n// bch-cc-v1:), so only script-capable schemes are refused. A blank link is no link.\n// Lit binds URLs as given, so every bound href goes through here first.\nexport function safeHref(url: string): string | null {\n\tconst trimmed = url.trim();\n\tif (trimmed === \"\") return null;\n\tconst scheme = /^([a-z][a-z\\d+.-]*):/i.exec(\n\t\ttrimmed.replace(/[\\s\\p{Cc}]/gu, \"\"),\n\t)?.[1];\n\treturn scheme !== undefined && SCRIPT_SCHEMES.has(scheme.toLowerCase())\n\t\t? null\n\t\t: trimmed;\n}\n"],"mappings":";;AAAA,MAAM,iCAAiB,IAAI,IAAI;CAAC;CAAc;CAAQ;AAAU,CAAC;AAKjE,SAAgB,SAAS,KAA4B;CACpD,MAAM,UAAU,IAAI,KAAK;CACzB,IAAI,YAAY,IAAI,OAAO;CAC3B,MAAM,SAAS,wBAAwB,KACtC,QAAQ,QAAQ,gBAAgB,EAAE,CACnC,CAAC,GAAG;CACJ,OAAO,WAAW,KAAA,KAAa,eAAe,IAAI,OAAO,YAAY,CAAC,IACnE,OACA;AACJ"}
|
package/dist/icons.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
import { html, svg } from "lit";
|
|
3
|
+
//#region src/icons.ts
|
|
4
|
+
const PATHS = {
|
|
5
|
+
x: svg`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`,
|
|
6
|
+
chevronLeft: svg`<path d="m15 18-6-6 6-6"/>`,
|
|
7
|
+
check: svg`<path d="M20 6 9 17l-5-5"/>`,
|
|
8
|
+
arrowUpRight: svg`<path d="M7 7h10v10"/><path d="M7 17 17 7"/>`,
|
|
9
|
+
rotateCcw: svg`<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/>`,
|
|
10
|
+
info: svg`<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>`,
|
|
11
|
+
link: svg`<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>`,
|
|
12
|
+
scanLine: svg`<path d="M3 7V5a2 2 0 0 1 2-2h2"/><path d="M17 3h2a2 2 0 0 1 2 2v2"/><path d="M21 17v2a2 2 0 0 1-2 2h-2"/><path d="M7 21H5a2 2 0 0 1-2-2v-2"/><path d="M7 12h10"/>`,
|
|
13
|
+
wallet: svg`<path d="M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"/><path d="M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"/>`
|
|
14
|
+
};
|
|
15
|
+
function icon(name, size = 16) {
|
|
16
|
+
return html`<svg width=${size} height=${size} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${PATHS[name]}</svg>`;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { icon };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.js","names":[],"sources":["../src/icons.ts"],"sourcesContent":["// Inlined: a shadow-rooted component can't load an icon font or sprite from\n// the host page.\n//\n// Path data from lucide-static 1.47.0 (ISC licensed: https://lucide.dev/license)\n\nimport { html, type SVGTemplateResult, svg, type TemplateResult } from \"lit\";\n\nexport type IconName =\n\t| \"x\"\n\t| \"chevronLeft\"\n\t| \"check\"\n\t| \"arrowUpRight\"\n\t| \"rotateCcw\"\n\t| \"info\"\n\t| \"link\"\n\t| \"scanLine\"\n\t| \"wallet\";\n\nconst PATHS: Readonly<Record<IconName, SVGTemplateResult>> = {\n\tx: svg`<path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/>`,\n\tchevronLeft: svg`<path d=\"m15 18-6-6 6-6\"/>`,\n\tcheck: svg`<path d=\"M20 6 9 17l-5-5\"/>`,\n\tarrowUpRight: svg`<path d=\"M7 7h10v10\"/><path d=\"M7 17 17 7\"/>`,\n\trotateCcw: svg`<path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\"/><path d=\"M3 3v5h5\"/>`,\n\tinfo: svg`<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 16v-4\"/><path d=\"M12 8h.01\"/>`,\n\tlink: svg`<path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/>`,\n\tscanLine: svg`<path d=\"M3 7V5a2 2 0 0 1 2-2h2\"/><path d=\"M17 3h2a2 2 0 0 1 2 2v2\"/><path d=\"M21 17v2a2 2 0 0 1-2 2h-2\"/><path d=\"M7 21H5a2 2 0 0 1-2-2v-2\"/><path d=\"M7 12h10\"/>`,\n\twallet: svg`<path d=\"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1\"/><path d=\"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4\"/>`,\n};\n\n// Lucide's 24-unit grid at stroke 2; 16px default matches the modal's other hairlines.\nexport function icon(name: IconName, size = 16): TemplateResult {\n\treturn html`<svg width=${size} height=${size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${PATHS[name]}</svg>`;\n}\n"],"mappings":";;;AAkBA,MAAM,QAAuD;CAC5D,GAAG,GAAG;CACN,aAAa,GAAG;CAChB,OAAO,GAAG;CACV,cAAc,GAAG;CACjB,WAAW,GAAG;CACd,MAAM,GAAG;CACT,MAAM,GAAG;CACT,UAAU,GAAG;CACb,QAAQ,GAAG;AACZ;AAGA,SAAgB,KAAK,MAAgB,OAAO,IAAoB;CAC/D,OAAO,IAAI,cAAc,KAAK,UAAU,KAAK,4IAA4I,MAAM,MAAM;AACtM"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Custom elements for the BCH Connect connect modal and success toast.
|
|
4
|
+
* Register them once with {@link defineElements} before creating
|
|
5
|
+
* `<bchc-modal>` or `<bchc-toast>`. Theme an element with `data-bchc-*`
|
|
6
|
+
* attributes on the element itself: `data-bchc-accent`, `data-bchc-neutral`,
|
|
7
|
+
* `data-bchc-radius`, `data-bchc-font`, `data-bchc-blur` and
|
|
8
|
+
* `data-bchc-mode`, each taking the values of the exported `Bchc*` types.
|
|
9
|
+
* Reword or translate an element's strings with its `messages` property,
|
|
10
|
+
* typed by {@link BchcMessages}
|
|
11
|
+
* The elements render with Lit: a page that enforces Trusted Types
|
|
12
|
+
* (`require-trusted-types-for 'script'`) must allow the `lit-html` policy in
|
|
13
|
+
* its `trusted-types` directive.
|
|
14
|
+
*/
|
|
15
|
+
import { ConnectPhase, FailureReason, MarkShape, ModalScreen, ModalView, Network, ProtocolId, ProtocolMark, ProtocolOption, WalletDirectoryEntry, WalletOption, WalletSupport } from "./state.js";
|
|
16
|
+
import { BCHC_MESSAGES_EN, BchcMessages } from "./messages.js";
|
|
17
|
+
import { BCHC_ACCENTS, BCHC_ACCENT_DEFAULT_NEUTRAL, BCHC_BLURS, BCHC_DEFAULT_ACCENT, BCHC_DEFAULT_NEUTRAL, BCHC_FONTS, BCHC_NEUTRALS, BCHC_RADII, BchcAccent, BchcBlur, BchcFont, BchcMode, BchcNeutral, BchcRadius } from "./theme.generated.js";
|
|
18
|
+
import { BchcModal, BchcModalEvents } from "./modal.js";
|
|
19
|
+
import { BchcToast, BchcToastEvents, ToastView } from "./toast.js";
|
|
20
|
+
import { BCHC_DIRECTORY, BCHC_PROTOCOLS, BCHC_WALLETS } from "./defaults.js";
|
|
21
|
+
import { defineElements } from "./define.js";
|
|
22
|
+
//#region src/index.d.ts
|
|
23
|
+
declare global {
|
|
24
|
+
interface HTMLElementTagNameMap {
|
|
25
|
+
"bchc-modal": BchcModal;
|
|
26
|
+
"bchc-toast": BchcToast;
|
|
27
|
+
}
|
|
28
|
+
interface GlobalEventHandlersEventMap extends BchcModalEvents, BchcToastEvents {}
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { BCHC_ACCENTS, BCHC_ACCENT_DEFAULT_NEUTRAL, BCHC_BLURS, BCHC_DEFAULT_ACCENT, BCHC_DEFAULT_NEUTRAL, BCHC_DIRECTORY, BCHC_FONTS, BCHC_MESSAGES_EN, BCHC_NEUTRALS, BCHC_PROTOCOLS, BCHC_RADII, BCHC_WALLETS, type BchcAccent, type BchcBlur, type BchcFont, type BchcMessages, BchcModal, type BchcModalEvents, type BchcMode, type BchcNeutral, type BchcRadius, BchcToast, type BchcToastEvents, type ConnectPhase, type FailureReason, type MarkShape, type ModalScreen, type ModalView, type Network, type ProtocolId, type ProtocolMark, type ProtocolOption, type ToastView, type WalletDirectoryEntry, type WalletOption, type WalletSupport, defineElements };
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
import { BCHC_DIRECTORY, BCHC_PROTOCOLS, BCHC_WALLETS } from "./defaults.js";
|
|
3
|
+
import { BCHC_MESSAGES_EN } from "./messages.js";
|
|
4
|
+
import { BchcModal } from "./modal.js";
|
|
5
|
+
import { BchcToast } from "./toast.js";
|
|
6
|
+
import { defineElements } from "./define.js";
|
|
7
|
+
import { BCHC_ACCENTS, BCHC_ACCENT_DEFAULT_NEUTRAL, BCHC_BLURS, BCHC_DEFAULT_ACCENT, BCHC_DEFAULT_NEUTRAL, BCHC_FONTS, BCHC_NEUTRALS, BCHC_RADII } from "./theme.generated.js";
|
|
8
|
+
export { BCHC_ACCENTS, BCHC_ACCENT_DEFAULT_NEUTRAL, BCHC_BLURS, BCHC_DEFAULT_ACCENT, BCHC_DEFAULT_NEUTRAL, BCHC_DIRECTORY, BCHC_FONTS, BCHC_MESSAGES_EN, BCHC_NEUTRALS, BCHC_PROTOCOLS, BCHC_RADII, BCHC_WALLETS, BchcModal, BchcToast, defineElements };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
import { BchcMessages } from "../messages.js";
|
|
3
|
+
//#region src/locales/es.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The Spanish catalogue, for the `messages` property of `bchc-modal` and
|
|
6
|
+
* `bchc-toast`.
|
|
7
|
+
*
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
export declare const BCHC_MESSAGES_ES: BchcMessages;
|
|
11
|
+
//#endregion
|
|
12
|
+
//# sourceMappingURL=es.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/locales/es.ts
|
|
3
|
+
/**
|
|
4
|
+
* The Spanish catalogue, for the `messages` property of `bchc-modal` and
|
|
5
|
+
* `bchc-toast`.
|
|
6
|
+
*
|
|
7
|
+
* @beta
|
|
8
|
+
*/
|
|
9
|
+
const BCHC_MESSAGES_ES = {
|
|
10
|
+
lang: "es",
|
|
11
|
+
connectTitle: "Conecta una billetera",
|
|
12
|
+
getWalletTitle: "Consigue una billetera",
|
|
13
|
+
sessionType: "Tipo de sesión",
|
|
14
|
+
scan: "Escanea con tu billetera",
|
|
15
|
+
scanWith: (wallet) => `Escanea con ${wallet}`,
|
|
16
|
+
initiating: "Obteniendo enlace de conexión",
|
|
17
|
+
linkFailed: "¿No se abrió? Copia el enlace.",
|
|
18
|
+
copyLink: "Copiar enlace",
|
|
19
|
+
linkCopied: "Enlace copiado",
|
|
20
|
+
copyLinkLabel: "Copiar enlace de conexión",
|
|
21
|
+
openInWallet: "Abrir en tu billetera",
|
|
22
|
+
walletsHeading: "Elige tu billetera",
|
|
23
|
+
open: "Abrir",
|
|
24
|
+
openWalletLabel: (wallet) => `Abrir ${wallet}`,
|
|
25
|
+
noWallet: "¿No tienes una billetera?",
|
|
26
|
+
directoryHeading: "Billeteras de Bitcoin Cash que funcionan aquí",
|
|
27
|
+
getWallet: (name) => `Obtener ${name}`,
|
|
28
|
+
tryAgain: "Reintentar",
|
|
29
|
+
back: "Atrás",
|
|
30
|
+
close: "Cerrar",
|
|
31
|
+
walletConnected: "Billetera conectada",
|
|
32
|
+
connectedTo: (wallet) => `Conectado a ${wallet}`,
|
|
33
|
+
dismiss: "Descartar",
|
|
34
|
+
rejectedTitle: "La solicitud de conexión fue rechazada",
|
|
35
|
+
rejectedDetail: "Puedes reintentarlo si no fue intencional",
|
|
36
|
+
timeoutTitle: "Tu billetera no respondió",
|
|
37
|
+
timeoutDetail: "Puede que se haya cerrado antes de aprobar",
|
|
38
|
+
abortedTitle: "Conexión detenida",
|
|
39
|
+
abortedDetail: "La solicitud terminó antes de que tu billetera respondiera.",
|
|
40
|
+
transportTitle: "No se pudo contactar con tu billetera",
|
|
41
|
+
transportDetail: "Inténtalo de nuevo en un momento.",
|
|
42
|
+
networkMismatchTitle: "Tu billetera está en otra red",
|
|
43
|
+
networkMismatchDetail: "Cambia de red en tu billetera y vuelve a conectar.",
|
|
44
|
+
unsupportedTitle: "Esa billetera no admite este tipo de sesión",
|
|
45
|
+
unsupportedDetail: "Elige otro tipo de sesión u otra billetera."
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
export { BCHC_MESSAGES_ES };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"es.js","names":[],"sources":["../../src/locales/es.ts"],"sourcesContent":["import type { BchcMessages } from \"../messages.ts\";\n\n/**\n * The Spanish catalogue, for the `messages` property of `bchc-modal` and\n * `bchc-toast`.\n *\n * @beta\n */\nexport const BCHC_MESSAGES_ES: BchcMessages = {\n\tlang: \"es\",\n\tconnectTitle: \"Conecta una billetera\",\n\tgetWalletTitle: \"Consigue una billetera\",\n\tsessionType: \"Tipo de sesión\",\n\tscan: \"Escanea con tu billetera\",\n\tscanWith: (wallet) => `Escanea con ${wallet}`,\n\tinitiating: \"Obteniendo enlace de conexión\",\n\tlinkFailed: \"¿No se abrió? Copia el enlace.\",\n\tcopyLink: \"Copiar enlace\",\n\tlinkCopied: \"Enlace copiado\",\n\tcopyLinkLabel: \"Copiar enlace de conexión\",\n\topenInWallet: \"Abrir en tu billetera\",\n\twalletsHeading: \"Elige tu billetera\",\n\topen: \"Abrir\",\n\topenWalletLabel: (wallet) => `Abrir ${wallet}`,\n\tnoWallet: \"¿No tienes una billetera?\",\n\tdirectoryHeading: \"Billeteras de Bitcoin Cash que funcionan aquí\",\n\tgetWallet: (name) => `Obtener ${name}`,\n\ttryAgain: \"Reintentar\",\n\tback: \"Atrás\",\n\tclose: \"Cerrar\",\n\twalletConnected: \"Billetera conectada\",\n\tconnectedTo: (wallet) => `Conectado a ${wallet}`,\n\tdismiss: \"Descartar\",\n\trejectedTitle: \"La solicitud de conexión fue rechazada\",\n\trejectedDetail: \"Puedes reintentarlo si no fue intencional\",\n\ttimeoutTitle: \"Tu billetera no respondió\",\n\ttimeoutDetail: \"Puede que se haya cerrado antes de aprobar\",\n\tabortedTitle: \"Conexión detenida\",\n\tabortedDetail: \"La solicitud terminó antes de que tu billetera respondiera.\",\n\ttransportTitle: \"No se pudo contactar con tu billetera\",\n\ttransportDetail: \"Inténtalo de nuevo en un momento.\",\n\tnetworkMismatchTitle: \"Tu billetera está en otra red\",\n\tnetworkMismatchDetail: \"Cambia de red en tu billetera y vuelve a conectar.\",\n\tunsupportedTitle: \"Esa billetera no admite este tipo de sesión\",\n\tunsupportedDetail: \"Elige otro tipo de sesión u otra billetera.\",\n};\n"],"mappings":";;;;;;;;AAQA,MAAa,mBAAiC;CAC7C,MAAM;CACN,cAAc;CACd,gBAAgB;CAChB,aAAa;CACb,MAAM;CACN,WAAW,WAAW,eAAe;CACrC,YAAY;CACZ,YAAY;CACZ,UAAU;CACV,YAAY;CACZ,eAAe;CACf,cAAc;CACd,gBAAgB;CAChB,MAAM;CACN,kBAAkB,WAAW,SAAS;CACtC,UAAU;CACV,kBAAkB;CAClB,YAAY,SAAS,WAAW;CAChC,UAAU;CACV,MAAM;CACN,OAAO;CACP,iBAAiB;CACjB,cAAc,WAAW,eAAe;CACxC,SAAS;CACT,eAAe;CACf,gBAAgB;CAChB,cAAc;CACd,eAAe;CACf,cAAc;CACd,eAAe;CACf,gBAAgB;CAChB,iBAAiB;CACjB,sBAAsB;CACtB,uBAAuB;CACvB,kBAAkB;CAClB,mBAAmB;AACpB"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/messages.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* One key per string shown or announced by `bchc-modal` and `bchc-toast`. A
|
|
5
|
+
* key that takes a value is a function of that value, so each language
|
|
6
|
+
* orders its own words.
|
|
7
|
+
*
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
export interface BchcMessages {
|
|
11
|
+
/** The catalogue's language, as a BCP 47 tag. The element sets it on its shadow content. */
|
|
12
|
+
readonly lang: string;
|
|
13
|
+
/** Dialog title on the connect screen. */
|
|
14
|
+
readonly connectTitle: string;
|
|
15
|
+
/** Dialog title on the "Get a wallet" screen. */
|
|
16
|
+
readonly getWalletTitle: string;
|
|
17
|
+
/** Accessible name of the session-type tabs, and the label beside a single session type. */
|
|
18
|
+
readonly sessionType: string;
|
|
19
|
+
/** Caption shown while awaiting the scan when no wallet is named, as on the drawer layout. */
|
|
20
|
+
readonly scan: string;
|
|
21
|
+
/**
|
|
22
|
+
* Caption shown while awaiting the scan on the split layout, naming the selected
|
|
23
|
+
* wallet. Include `wallet` exactly once for its mark to show beside it.
|
|
24
|
+
*/
|
|
25
|
+
readonly scanWith: (wallet: string) => string;
|
|
26
|
+
/** Caption shown while the connection link is still being fetched. */
|
|
27
|
+
readonly initiating: string;
|
|
28
|
+
/** Hint shown once a deep link appears not to have opened anything. */
|
|
29
|
+
readonly linkFailed: string;
|
|
30
|
+
/** Copy-link button, idle. */
|
|
31
|
+
readonly copyLink: string;
|
|
32
|
+
/** Copy-link button, just after copying. */
|
|
33
|
+
readonly linkCopied: string;
|
|
34
|
+
/** Accessible name for the connection code, which doubles as the copy-link control. */
|
|
35
|
+
readonly copyLinkLabel: string;
|
|
36
|
+
/** Primary call to action on the sheet layout: opens the wallet's deep link. */
|
|
37
|
+
readonly openInWallet: string;
|
|
38
|
+
/** Section label above the wallet list on the split layout. */
|
|
39
|
+
readonly walletsHeading: string;
|
|
40
|
+
/** Label of the selected wallet's desktop link. */
|
|
41
|
+
readonly open: string;
|
|
42
|
+
/** Accessible name of the selected wallet's desktop link. */
|
|
43
|
+
readonly openWalletLabel: (wallet: string) => string;
|
|
44
|
+
/** Link to the wallet directory, shown under the wallet list. */
|
|
45
|
+
readonly noWallet: string;
|
|
46
|
+
/** Section label on the "Get a wallet" screen. */
|
|
47
|
+
readonly directoryHeading: string;
|
|
48
|
+
/** Link label for a directory entry that carries no label of its own. */
|
|
49
|
+
readonly getWallet: (name: string) => string;
|
|
50
|
+
/** Retry button after a failed connection attempt. */
|
|
51
|
+
readonly tryAgain: string;
|
|
52
|
+
/** Back button on the "Get a wallet" screen. */
|
|
53
|
+
readonly back: string;
|
|
54
|
+
/** Close button. */
|
|
55
|
+
readonly close: string;
|
|
56
|
+
/** Toast heading when the wallet didn't identify itself. */
|
|
57
|
+
readonly walletConnected: string;
|
|
58
|
+
/** Toast heading naming the wallet that connected. */
|
|
59
|
+
readonly connectedTo: (wallet: string) => string;
|
|
60
|
+
/** Accessible name for the toast's dismiss button. */
|
|
61
|
+
readonly dismiss: string;
|
|
62
|
+
/** Failure title: the wallet declined the request. */
|
|
63
|
+
readonly rejectedTitle: string;
|
|
64
|
+
/** Failure detail: the wallet declined the request. */
|
|
65
|
+
readonly rejectedDetail: string;
|
|
66
|
+
/** Failure title: the wallet never answered. */
|
|
67
|
+
readonly timeoutTitle: string;
|
|
68
|
+
/** Failure detail: the wallet never answered. */
|
|
69
|
+
readonly timeoutDetail: string;
|
|
70
|
+
/** Failure title: the attempt was stopped before the wallet answered. */
|
|
71
|
+
readonly abortedTitle: string;
|
|
72
|
+
/** Failure detail: the attempt was stopped before the wallet answered. */
|
|
73
|
+
readonly abortedDetail: string;
|
|
74
|
+
/** Failure title: the wallet could not be reached. */
|
|
75
|
+
readonly transportTitle: string;
|
|
76
|
+
/** Failure detail: the wallet could not be reached. */
|
|
77
|
+
readonly transportDetail: string;
|
|
78
|
+
/** Failure title: the wallet is on a different network than the attempt. */
|
|
79
|
+
readonly networkMismatchTitle: string;
|
|
80
|
+
/** Failure detail: the wallet is on a different network than the attempt. */
|
|
81
|
+
readonly networkMismatchDetail: string;
|
|
82
|
+
/** Failure title: the wallet does not support the chosen session type. */
|
|
83
|
+
readonly unsupportedTitle: string;
|
|
84
|
+
/** Failure detail: the wallet does not support the chosen session type. */
|
|
85
|
+
readonly unsupportedDetail: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The English catalogue. It ships in the main entry and is what both
|
|
89
|
+
* elements show when no `messages` override or locale is set.
|
|
90
|
+
*
|
|
91
|
+
* @beta
|
|
92
|
+
*/
|
|
93
|
+
export declare const BCHC_MESSAGES_EN: BchcMessages;
|
|
94
|
+
//#endregion
|
|
95
|
+
//# sourceMappingURL=messages.d.ts.map
|
package/dist/messages.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/messages.ts
|
|
3
|
+
/**
|
|
4
|
+
* The English catalogue. It ships in the main entry and is what both
|
|
5
|
+
* elements show when no `messages` override or locale is set.
|
|
6
|
+
*
|
|
7
|
+
* @beta
|
|
8
|
+
*/
|
|
9
|
+
const BCHC_MESSAGES_EN = {
|
|
10
|
+
lang: "en",
|
|
11
|
+
connectTitle: "Connect a wallet",
|
|
12
|
+
getWalletTitle: "Get a wallet",
|
|
13
|
+
sessionType: "Session type",
|
|
14
|
+
scan: "Scan with your wallet",
|
|
15
|
+
scanWith: (wallet) => `Scan with ${wallet}`,
|
|
16
|
+
initiating: "Getting your connection link",
|
|
17
|
+
linkFailed: "Didn't open? Copy the link.",
|
|
18
|
+
copyLink: "Copy link",
|
|
19
|
+
linkCopied: "Link copied",
|
|
20
|
+
copyLinkLabel: "Copy connection link",
|
|
21
|
+
openInWallet: "Open in your wallet",
|
|
22
|
+
walletsHeading: "Choose your wallet",
|
|
23
|
+
open: "Open",
|
|
24
|
+
openWalletLabel: (wallet) => `Open ${wallet}`,
|
|
25
|
+
noWallet: "Don't have a wallet?",
|
|
26
|
+
directoryHeading: "Bitcoin Cash wallets that work here",
|
|
27
|
+
getWallet: (name) => `Get ${name}`,
|
|
28
|
+
tryAgain: "Try again",
|
|
29
|
+
back: "Back",
|
|
30
|
+
close: "Close",
|
|
31
|
+
walletConnected: "Wallet connected",
|
|
32
|
+
connectedTo: (wallet) => `Connected to ${wallet}`,
|
|
33
|
+
dismiss: "Dismiss",
|
|
34
|
+
rejectedTitle: "Your wallet declined",
|
|
35
|
+
rejectedDetail: "Nothing was shared and nothing was sent.",
|
|
36
|
+
timeoutTitle: "No answer from your wallet",
|
|
37
|
+
timeoutDetail: "It may have closed before approving. You can try again.",
|
|
38
|
+
abortedTitle: "Connection stopped",
|
|
39
|
+
abortedDetail: "The request ended before your wallet answered.",
|
|
40
|
+
transportTitle: "Couldn't reach your wallet",
|
|
41
|
+
transportDetail: "Try again in a moment.",
|
|
42
|
+
networkMismatchTitle: "Your wallet is on a different network",
|
|
43
|
+
networkMismatchDetail: "Switch networks in your wallet, then connect again.",
|
|
44
|
+
unsupportedTitle: "That wallet can't use this session type",
|
|
45
|
+
unsupportedDetail: "Choose another session type, or another wallet."
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The English catalogue with `overrides` applied key by key.
|
|
49
|
+
*
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
function mergeMessages(overrides) {
|
|
53
|
+
if (overrides == null) return BCHC_MESSAGES_EN;
|
|
54
|
+
const defined = Object.entries(overrides).filter(([, value]) => value != null);
|
|
55
|
+
return {
|
|
56
|
+
...BCHC_MESSAGES_EN,
|
|
57
|
+
...Object.fromEntries(defined)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { BCHC_MESSAGES_EN, mergeMessages };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","names":[],"sources":["../src/messages.ts"],"sourcesContent":["// Network, protocol and wallet names are data, not copy, and stay out of the catalogue.\n\n/**\n * One key per string shown or announced by `bchc-modal` and `bchc-toast`. A\n * key that takes a value is a function of that value, so each language\n * orders its own words.\n *\n * @beta\n */\nexport interface BchcMessages {\n\t/** The catalogue's language, as a BCP 47 tag. The element sets it on its shadow content. */\n\treadonly lang: string;\n\t/** Dialog title on the connect screen. */\n\treadonly connectTitle: string;\n\t/** Dialog title on the \"Get a wallet\" screen. */\n\treadonly getWalletTitle: string;\n\t/** Accessible name of the session-type tabs, and the label beside a single session type. */\n\treadonly sessionType: string;\n\t/** Caption shown while awaiting the scan when no wallet is named, as on the drawer layout. */\n\treadonly scan: string;\n\t/**\n\t * Caption shown while awaiting the scan on the split layout, naming the selected\n\t * wallet. Include `wallet` exactly once for its mark to show beside it.\n\t */\n\treadonly scanWith: (wallet: string) => string;\n\t/** Caption shown while the connection link is still being fetched. */\n\treadonly initiating: string;\n\t/** Hint shown once a deep link appears not to have opened anything. */\n\treadonly linkFailed: string;\n\t/** Copy-link button, idle. */\n\treadonly copyLink: string;\n\t/** Copy-link button, just after copying. */\n\treadonly linkCopied: string;\n\t/** Accessible name for the connection code, which doubles as the copy-link control. */\n\treadonly copyLinkLabel: string;\n\t/** Primary call to action on the sheet layout: opens the wallet's deep link. */\n\treadonly openInWallet: string;\n\t/** Section label above the wallet list on the split layout. */\n\treadonly walletsHeading: string;\n\t/** Label of the selected wallet's desktop link. */\n\treadonly open: string;\n\t/** Accessible name of the selected wallet's desktop link. */\n\treadonly openWalletLabel: (wallet: string) => string;\n\t/** Link to the wallet directory, shown under the wallet list. */\n\treadonly noWallet: string;\n\t/** Section label on the \"Get a wallet\" screen. */\n\treadonly directoryHeading: string;\n\t/** Link label for a directory entry that carries no label of its own. */\n\treadonly getWallet: (name: string) => string;\n\t/** Retry button after a failed connection attempt. */\n\treadonly tryAgain: string;\n\t/** Back button on the \"Get a wallet\" screen. */\n\treadonly back: string;\n\t/** Close button. */\n\treadonly close: string;\n\t/** Toast heading when the wallet didn't identify itself. */\n\treadonly walletConnected: string;\n\t/** Toast heading naming the wallet that connected. */\n\treadonly connectedTo: (wallet: string) => string;\n\t/** Accessible name for the toast's dismiss button. */\n\treadonly dismiss: string;\n\t/** Failure title: the wallet declined the request. */\n\treadonly rejectedTitle: string;\n\t/** Failure detail: the wallet declined the request. */\n\treadonly rejectedDetail: string;\n\t/** Failure title: the wallet never answered. */\n\treadonly timeoutTitle: string;\n\t/** Failure detail: the wallet never answered. */\n\treadonly timeoutDetail: string;\n\t/** Failure title: the attempt was stopped before the wallet answered. */\n\treadonly abortedTitle: string;\n\t/** Failure detail: the attempt was stopped before the wallet answered. */\n\treadonly abortedDetail: string;\n\t/** Failure title: the wallet could not be reached. */\n\treadonly transportTitle: string;\n\t/** Failure detail: the wallet could not be reached. */\n\treadonly transportDetail: string;\n\t/** Failure title: the wallet is on a different network than the attempt. */\n\treadonly networkMismatchTitle: string;\n\t/** Failure detail: the wallet is on a different network than the attempt. */\n\treadonly networkMismatchDetail: string;\n\t/** Failure title: the wallet does not support the chosen session type. */\n\treadonly unsupportedTitle: string;\n\t/** Failure detail: the wallet does not support the chosen session type. */\n\treadonly unsupportedDetail: string;\n}\n\n/**\n * The English catalogue. It ships in the main entry and is what both\n * elements show when no `messages` override or locale is set.\n *\n * @beta\n */\nexport const BCHC_MESSAGES_EN: BchcMessages = {\n\tlang: \"en\",\n\tconnectTitle: \"Connect a wallet\",\n\tgetWalletTitle: \"Get a wallet\",\n\tsessionType: \"Session type\",\n\tscan: \"Scan with your wallet\",\n\tscanWith: (wallet) => `Scan with ${wallet}`,\n\tinitiating: \"Getting your connection link\",\n\tlinkFailed: \"Didn't open? Copy the link.\",\n\tcopyLink: \"Copy link\",\n\tlinkCopied: \"Link copied\",\n\tcopyLinkLabel: \"Copy connection link\",\n\topenInWallet: \"Open in your wallet\",\n\twalletsHeading: \"Choose your wallet\",\n\topen: \"Open\",\n\topenWalletLabel: (wallet) => `Open ${wallet}`,\n\tnoWallet: \"Don't have a wallet?\",\n\tdirectoryHeading: \"Bitcoin Cash wallets that work here\",\n\tgetWallet: (name) => `Get ${name}`,\n\ttryAgain: \"Try again\",\n\tback: \"Back\",\n\tclose: \"Close\",\n\twalletConnected: \"Wallet connected\",\n\tconnectedTo: (wallet) => `Connected to ${wallet}`,\n\tdismiss: \"Dismiss\",\n\t// Second person, plain, no exclamation marks; never a code, URI, or transport name.\n\trejectedTitle: \"Your wallet declined\",\n\trejectedDetail: \"Nothing was shared and nothing was sent.\",\n\ttimeoutTitle: \"No answer from your wallet\",\n\ttimeoutDetail: \"It may have closed before approving. You can try again.\",\n\tabortedTitle: \"Connection stopped\",\n\tabortedDetail: \"The request ended before your wallet answered.\",\n\ttransportTitle: \"Couldn't reach your wallet\",\n\ttransportDetail: \"Try again in a moment.\",\n\tnetworkMismatchTitle: \"Your wallet is on a different network\",\n\tnetworkMismatchDetail: \"Switch networks in your wallet, then connect again.\",\n\tunsupportedTitle: \"That wallet can't use this session type\",\n\tunsupportedDetail: \"Choose another session type, or another wallet.\",\n};\n\n/**\n * The English catalogue with `overrides` applied key by key.\n *\n * @internal\n */\nexport function mergeMessages(\n\toverrides: Partial<BchcMessages> | null,\n): BchcMessages {\n\t// JavaScript callers can pass `undefined` or `null` despite the type, for the whole\n\t// catalogue or a key; either keeps English instead of throwing or blanking a string.\n\tif (overrides == null) return BCHC_MESSAGES_EN;\n\tconst defined = Object.entries(overrides).filter(\n\t\t([, value]) => value != null,\n\t);\n\treturn { ...BCHC_MESSAGES_EN, ...Object.fromEntries(defined) };\n}\n"],"mappings":";;;;;;;;AA6FA,MAAa,mBAAiC;CAC7C,MAAM;CACN,cAAc;CACd,gBAAgB;CAChB,aAAa;CACb,MAAM;CACN,WAAW,WAAW,aAAa;CACnC,YAAY;CACZ,YAAY;CACZ,UAAU;CACV,YAAY;CACZ,eAAe;CACf,cAAc;CACd,gBAAgB;CAChB,MAAM;CACN,kBAAkB,WAAW,QAAQ;CACrC,UAAU;CACV,kBAAkB;CAClB,YAAY,SAAS,OAAO;CAC5B,UAAU;CACV,MAAM;CACN,OAAO;CACP,iBAAiB;CACjB,cAAc,WAAW,gBAAgB;CACzC,SAAS;CAET,eAAe;CACf,gBAAgB;CAChB,cAAc;CACd,eAAe;CACf,cAAc;CACd,eAAe;CACf,gBAAgB;CAChB,iBAAiB;CACjB,sBAAsB;CACtB,uBAAuB;CACvB,kBAAkB;CAClB,mBAAmB;AACpB;;;;;;AAOA,SAAgB,cACf,WACe;CAGf,IAAI,aAAa,MAAM,OAAO;CAC9B,MAAM,UAAU,OAAO,QAAQ,SAAS,CAAC,CAAC,QACxC,GAAG,WAAW,SAAS,IACzB;CACA,OAAO;EAAE,GAAG;EAAkB,GAAG,OAAO,YAAY,OAAO;CAAE;AAC9D"}
|