pleasenobugs 0.1.1

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.
@@ -0,0 +1,343 @@
1
+ /**
2
+ * Every word the widget says, in every language it speaks, side by side so a
3
+ * string added in one language and not the others is a type error.
4
+ *
5
+ * Taken from Shitti's board, where the copy was written for the same two jobs
6
+ * a feedback board has that the rest of an app does not: saying out loud that
7
+ * this is public, and being honest about what "anonymous" does and does not
8
+ * mean. "Shitti" became `{app}`, the project's own name.
9
+ *
10
+ * A developer can override any string, or speak a language this file does not,
11
+ * through the element's `strings` property (see {@link translator}).
12
+ */
13
+ export declare const LANGS: readonly ["en", "nl", "de"];
14
+ export type Lang = (typeof LANGS)[number];
15
+ declare const COPY: {
16
+ 'board.title': {
17
+ en: string;
18
+ nl: string;
19
+ de: string;
20
+ };
21
+ 'board.open': {
22
+ en: string;
23
+ nl: string;
24
+ de: string;
25
+ };
26
+ 'board.close': {
27
+ en: string;
28
+ nl: string;
29
+ de: string;
30
+ };
31
+ 'board.back': {
32
+ en: string;
33
+ nl: string;
34
+ de: string;
35
+ };
36
+ 'board.top': {
37
+ en: string;
38
+ nl: string;
39
+ de: string;
40
+ };
41
+ 'board.new': {
42
+ en: string;
43
+ nl: string;
44
+ de: string;
45
+ };
46
+ 'board.order': {
47
+ en: string;
48
+ nl: string;
49
+ de: string;
50
+ };
51
+ 'board.all': {
52
+ en: string;
53
+ nl: string;
54
+ de: string;
55
+ };
56
+ 'board.bugs': {
57
+ en: string;
58
+ nl: string;
59
+ de: string;
60
+ };
61
+ 'board.ideas': {
62
+ en: string;
63
+ nl: string;
64
+ de: string;
65
+ };
66
+ 'board.kindBug': {
67
+ en: string;
68
+ nl: string;
69
+ de: string;
70
+ };
71
+ 'board.kindIdea': {
72
+ en: string;
73
+ nl: string;
74
+ de: string;
75
+ };
76
+ 'board.statusOpen': {
77
+ en: string;
78
+ nl: string;
79
+ de: string;
80
+ };
81
+ 'board.statusPlanned': {
82
+ en: string;
83
+ nl: string;
84
+ de: string;
85
+ };
86
+ 'board.statusDone': {
87
+ en: string;
88
+ nl: string;
89
+ de: string;
90
+ };
91
+ 'board.statusDeclined': {
92
+ en: string;
93
+ nl: string;
94
+ de: string;
95
+ };
96
+ 'board.anon': {
97
+ en: string;
98
+ nl: string;
99
+ de: string;
100
+ };
101
+ 'board.byYou': {
102
+ en: string;
103
+ nl: string;
104
+ de: string;
105
+ };
106
+ 'board.reply': {
107
+ en: string;
108
+ nl: string;
109
+ de: string;
110
+ };
111
+ 'board.upvote': {
112
+ en: string;
113
+ nl: string;
114
+ de: string;
115
+ };
116
+ 'board.emptyTitle': {
117
+ en: string;
118
+ nl: string;
119
+ de: string;
120
+ };
121
+ 'board.emptyFiltered': {
122
+ en: string;
123
+ nl: string;
124
+ de: string;
125
+ };
126
+ 'board.write': {
127
+ en: string;
128
+ nl: string;
129
+ de: string;
130
+ };
131
+ 'board.loadFailed': {
132
+ en: string;
133
+ nl: string;
134
+ de: string;
135
+ };
136
+ 'board.retry': {
137
+ en: string;
138
+ nl: string;
139
+ de: string;
140
+ };
141
+ 'board.page': {
142
+ en: string;
143
+ nl: string;
144
+ de: string;
145
+ };
146
+ 'board.signIn': {
147
+ en: string;
148
+ nl: string;
149
+ de: string;
150
+ };
151
+ 'board.needWallet': {
152
+ en: string;
153
+ nl: string;
154
+ de: string;
155
+ };
156
+ 'board.composeTitle': {
157
+ en: string;
158
+ nl: string;
159
+ de: string;
160
+ };
161
+ 'board.whatKind': {
162
+ en: string;
163
+ nl: string;
164
+ de: string;
165
+ };
166
+ 'board.placeholder': {
167
+ en: string;
168
+ nl: string;
169
+ de: string;
170
+ };
171
+ 'board.public': {
172
+ en: string;
173
+ nl: string;
174
+ de: string;
175
+ };
176
+ 'board.showName': {
177
+ en: string;
178
+ nl: string;
179
+ de: string;
180
+ };
181
+ 'board.namePlaceholder': {
182
+ en: string;
183
+ nl: string;
184
+ de: string;
185
+ };
186
+ 'board.anonNote': {
187
+ en: string;
188
+ nl: string;
189
+ de: string;
190
+ };
191
+ 'board.send': {
192
+ en: string;
193
+ nl: string;
194
+ de: string;
195
+ };
196
+ 'board.left': {
197
+ en: string;
198
+ nl: string;
199
+ de: string;
200
+ };
201
+ 'board.noneLeft': {
202
+ en: string;
203
+ nl: string;
204
+ de: string;
205
+ };
206
+ 'board.likeThis': {
207
+ en: string;
208
+ nl: string;
209
+ de: string;
210
+ };
211
+ 'board.likeThisNote': {
212
+ en: string;
213
+ nl: string;
214
+ de: string;
215
+ };
216
+ 'board.failed': {
217
+ en: string;
218
+ nl: string;
219
+ de: string;
220
+ };
221
+ 'board.failedFull': {
222
+ en: string;
223
+ nl: string;
224
+ de: string;
225
+ };
226
+ 'board.sent': {
227
+ en: string;
228
+ nl: string;
229
+ de: string;
230
+ };
231
+ 'board.delete': {
232
+ en: string;
233
+ nl: string;
234
+ de: string;
235
+ };
236
+ 'board.deleteTitle': {
237
+ en: string;
238
+ nl: string;
239
+ de: string;
240
+ };
241
+ 'board.deleteNote': {
242
+ en: string;
243
+ nl: string;
244
+ de: string;
245
+ };
246
+ 'board.cancel': {
247
+ en: string;
248
+ nl: string;
249
+ de: string;
250
+ };
251
+ 'board.manage': {
252
+ en: string;
253
+ nl: string;
254
+ de: string;
255
+ };
256
+ 'board.setStatus': {
257
+ en: string;
258
+ nl: string;
259
+ de: string;
260
+ };
261
+ 'board.replyLabel': {
262
+ en: string;
263
+ nl: string;
264
+ de: string;
265
+ };
266
+ 'board.replyPlaceholder': {
267
+ en: string;
268
+ nl: string;
269
+ de: string;
270
+ };
271
+ 'board.hide': {
272
+ en: string;
273
+ nl: string;
274
+ de: string;
275
+ };
276
+ 'board.unhide': {
277
+ en: string;
278
+ nl: string;
279
+ de: string;
280
+ };
281
+ 'board.hidden': {
282
+ en: string;
283
+ nl: string;
284
+ de: string;
285
+ };
286
+ 'board.save': {
287
+ en: string;
288
+ nl: string;
289
+ de: string;
290
+ };
291
+ 'board.context': {
292
+ en: string;
293
+ nl: string;
294
+ de: string;
295
+ };
296
+ 'time.now': {
297
+ en: string;
298
+ nl: string;
299
+ de: string;
300
+ };
301
+ 'time.min': {
302
+ en: string;
303
+ nl: string;
304
+ de: string;
305
+ };
306
+ 'time.hour': {
307
+ en: string;
308
+ nl: string;
309
+ de: string;
310
+ };
311
+ 'time.day': {
312
+ en: string;
313
+ nl: string;
314
+ de: string;
315
+ };
316
+ };
317
+ export type CopyKey = keyof typeof COPY;
318
+ export type Strings = Partial<Record<CopyKey, string>>;
319
+ export type Translate = (key: CopyKey, vars?: Record<string, string | number>) => string;
320
+ /**
321
+ * The language to speak, best guess first: what the element was told, then
322
+ * what Nimiq Pay says the user picked, then the page, then the browser.
323
+ * Anything this file does not speak falls back to English, unless the
324
+ * developer supplied `strings` for it, in which case it is kept.
325
+ *
326
+ * @example
327
+ * pickLang('nl-BE') // → 'nl'
328
+ */
329
+ export declare function pickLang(asked?: string | null): string;
330
+ /**
331
+ * A `t()` for one language with one set of overrides.
332
+ *
333
+ * Overrides win, then the language, then English, so a developer adding French
334
+ * may translate half the keys and still never show a hole.
335
+ *
336
+ * @example
337
+ * const t = translator('nl', { 'board.title': 'Ideeënbus' });
338
+ * t('board.title') // → 'Ideeënbus'
339
+ * t('board.reply', { app: 'Shitti' }) // → 'Shitti zegt'
340
+ */
341
+ export declare function translator(lang: string, strings?: Strings): Translate;
342
+ export {};
343
+ //# sourceMappingURL=i18n.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,KAAK,6BAA8B,CAAC;AACjD,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1C,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0IsC,CAAC;AAEjD,MAAM,MAAM,OAAO,GAAG,MAAM,OAAO,IAAI,CAAC;AACxC,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AACvD,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,CAAC;AAEzF;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAWtD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,OAAY,GAAG,SAAS,CAOzE"}
@@ -0,0 +1,32 @@
1
+ import type { AppLogin, PostContext } from '@pleasenobugs/core';
2
+ import type { Strings } from './i18n.js';
3
+ import type { Signer } from './signer.js';
4
+ export * from './client.js';
5
+ export { PleaseNoBugsElement, readableOn } from './element.js';
6
+ export type { Strings, CopyKey } from './i18n.js';
7
+ export interface OpenOptions {
8
+ project: string;
9
+ server: string;
10
+ lang?: string;
11
+ theme?: 'auto' | 'light' | 'dark' | 'shitti';
12
+ accent?: string;
13
+ appName?: string;
14
+ /** A display name to suggest when the user chooses to show theirs. */
15
+ name?: string;
16
+ signer?: Signer;
17
+ /** Your app's own login, reused so nobody signs twice (see `appLogin` on the element). */
18
+ appLogin?: AppLogin | null;
19
+ context?: PostContext;
20
+ noise?: string[];
21
+ strings?: Strings;
22
+ }
23
+ /**
24
+ * Open the board over the whole screen, from a button of your own.
25
+ * Answers a function that closes it again.
26
+ *
27
+ * @example
28
+ * import { open } from 'pleasenobugs';
29
+ * menuItem.onclick = () => open({ project: 'k7q2m9xw4p', server: 'https://feedback.example.com' });
30
+ */
31
+ export declare function open(options: OpenOptions): () => void;
32
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/D,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKlD,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC3B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,IAAI,CAmBrD"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * What the widget needs from a wallet: sign one message, and say which address
3
+ * signed it.
4
+ *
5
+ * That is the whole of the interface, on purpose. Inside Nimiq Pay the widget
6
+ * fills it by itself ({@link nimiqPaySigner}). Anywhere else the app hands one
7
+ * in, because the app already has its own wallet integration and the widget
8
+ * shipping a second one (the Hub, its popups, its redirects) would be bigger
9
+ * and worse at it.
10
+ *
11
+ * The signature must be the Keyguard's: Ed25519 over
12
+ * `SHA256("\x16Nimiq Signed Message:\n" + length + message)`. Nimiq Pay's
13
+ * `sign()` and the Hub's `signMessage()` both produce exactly that.
14
+ *
15
+ * @example
16
+ * // A browser app using the Nimiq Hub:
17
+ * import HubApi from '@nimiq/hub-api';
18
+ * const hub = new HubApi('https://hub.nimiq.com');
19
+ * const signer: Signer = async (message) => {
20
+ * const r = await hub.signMessage({ appName: 'My app', message });
21
+ * return { address: r.signer, publicKey: toHex(r.signerPublicKey), signature: toHex(r.signature) };
22
+ * };
23
+ */
24
+ export type Signer = (message: string) => Promise<SignedMessage>;
25
+ export interface SignedMessage {
26
+ /** The address that signed, in any spelling. */
27
+ address: string;
28
+ /** Hex. */
29
+ publicKey: string;
30
+ /** Hex. */
31
+ signature: string;
32
+ }
33
+ /**
34
+ * Why signing did not happen. `declined` is the user saying no, which is an
35
+ * answer and not a failure: the widget says nothing about it.
36
+ */
37
+ export declare class SignerError extends Error {
38
+ readonly reason: 'no_wallet' | 'no_account' | 'declined';
39
+ constructor(reason: 'no_wallet' | 'no_account' | 'declined', message?: string);
40
+ }
41
+ /** The bits of Nimiq Pay's injected provider this file touches. */
42
+ interface NimiqProvider {
43
+ listAccounts(): Promise<string[] | {
44
+ error: {
45
+ message: string;
46
+ };
47
+ }>;
48
+ sign(message: string): Promise<{
49
+ publicKey: string;
50
+ signature: string;
51
+ } | {
52
+ error: {
53
+ message: string;
54
+ };
55
+ }>;
56
+ }
57
+ declare global {
58
+ interface Window {
59
+ nimiq?: NimiqProvider;
60
+ nimiqPay?: {
61
+ language?: string;
62
+ };
63
+ }
64
+ }
65
+ /**
66
+ * Whether the page is running inside Nimiq Pay, right now. Synchronous, so it
67
+ * can decide what to draw; {@link nimiqPaySigner} waits a little longer.
68
+ */
69
+ export declare function insideNimiqPay(): boolean;
70
+ /**
71
+ * Signs with the wallet Nimiq Pay is logged in with.
72
+ *
73
+ * Two calls because the provider splits them: `listAccounts()` says which
74
+ * address, `sign()` proves it. The address is sent as the wallet said it rather
75
+ * than derived from the public key, which would mean shipping Nimiq's WASM to a
76
+ * phone to do one hash; the server derives it anyway and refuses a mismatch.
77
+ */
78
+ export declare function nimiqPaySigner(timeout?: number): Signer;
79
+ export {};
80
+ //# sourceMappingURL=signer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../src/signer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;AAEjE,MAAM,WAAW,aAAa;IAC5B,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW;IACX,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,qBAAa,WAAY,SAAQ,KAAK;aAElB,MAAM,EAAE,WAAW,GAAG,YAAY,GAAG,UAAU;gBAA/C,MAAM,EAAE,WAAW,GAAG,YAAY,GAAG,UAAU,EAC/D,OAAO,CAAC,EAAE,MAAM;CAKnB;AAED,mEAAmE;AACnE,UAAU,aAAa;IACrB,YAAY,IAAI,OAAO,CAAC,MAAM,EAAE,GAAG;QAAE,KAAK,EAAE;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC,CAAC;IACnE,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,KAAK,EAAE;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC,CAAC;CAC3G;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,KAAK,CAAC,EAAE,aAAa,CAAC;QACtB,QAAQ,CAAC,EAAE;YAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAClC;CACF;AAMD;;;GAGG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAkBD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAE,MAAgB,GAAG,MAAM,CAWhE"}
@@ -0,0 +1,35 @@
1
+ import { type PostContext, type PostKind } from '@pleasenobugs/core';
2
+ import type { Client } from '../client.js';
3
+ import type { Translate } from '../i18n.js';
4
+ export interface AppProps {
5
+ client: Client;
6
+ t: Translate;
7
+ locale: string;
8
+ /** What the board calls the app ("{app} says"). Defaults to the project's name. */
9
+ appName?: string;
10
+ /** A display name the host app already knows, offered when the user shows theirs. */
11
+ suggestName?: string;
12
+ /** Sent with every bug, to owners only: a version, a screen. */
13
+ context?: PostContext;
14
+ /** Words common in this app, so the lookalike matcher ignores them. */
15
+ noise?: string[];
16
+ /** Present when the board is an overlay: draws the X. */
17
+ onClose?: () => void;
18
+ onPosted?: (post: {
19
+ id: string;
20
+ kind: PostKind;
21
+ }) => void;
22
+ }
23
+ /**
24
+ * The whole board: the list, writing one, and the two sheets.
25
+ *
26
+ * **It owns its data and fetches it when it opens**, then again after anything
27
+ * it did. A feedback board is a page people open now and then; polling it
28
+ * would be traffic for nobody.
29
+ *
30
+ * Voting is optimistic and corrected from what the server answers, because a
31
+ * tap that waits a round trip before the number moves reads as a tap that
32
+ * missed. Posting is the opposite and waits (see {@link Compose}).
33
+ */
34
+ export declare function App({ client, t, locale, appName, suggestName, context, noise, onClose, onPosted }: AppProps): import("preact").JSX.Element;
35
+ //# sourceMappingURL=App.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../src/ui/App.tsx"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,QAAQ,EAEd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAW,SAAS,EAAE,MAAM,YAAY,CAAC;AAUrD,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,EAAE,SAAS,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qFAAqF;IACrF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,QAAQ,CAAA;KAAE,KAAK,IAAI,CAAC;CAC3D;AAKD;;;;;;;;;;GAUG;AACH,wBAAgB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,QAAQ,gCA0V3G"}
@@ -0,0 +1,55 @@
1
+ import { type Post, type PostKind } from '@pleasenobugs/core';
2
+ import type { CopyKey, Translate } from '../i18n.js';
3
+ /**
4
+ * Writing one.
5
+ *
6
+ * Three of the four things on this screen exist to stop somebody regretting
7
+ * the tap afterwards:
8
+ *
9
+ * - **The kind is asked first**, because a bug and a wish want different words
10
+ * and picking after typing means rewriting.
11
+ * - **"Everybody can read this" sits above the field**, so it arrives before
12
+ * the typing rather than after.
13
+ * - **Lookalikes appear while you type** and can be seconded from here. That is
14
+ * the only thing on the board that reduces its own input; the alternative is
15
+ * five copies of the best idea with one vote each.
16
+ *
17
+ * **One column that scrolls, with the button at the end of it.** Shitti pinned
18
+ * a footer and then spent a page of notes on what a phone keyboard does to a
19
+ * pinned footer. A widget lives in apps whose keyboards it has never met, so it
20
+ * takes the arrangement that has nothing to get wrong.
21
+ *
22
+ * **Sending waits for the server**, the opposite of voting: a refused vote
23
+ * costs nothing, a refused post costs what somebody typed. So a refusal leaves
24
+ * this screen standing with the words in it and says why on the line under the
25
+ * button.
26
+ */
27
+ export declare function Compose({ t, kinds, posts, likeThis, left, perDay, textMax, name: knownName, appName, onVote, onSend, }: {
28
+ t: Translate;
29
+ kinds: PostKind[];
30
+ posts: Post[];
31
+ likeThis: (posts: Post[], text: string) => Post[];
32
+ /** Posts left today; null before the reader has signed in. */
33
+ left: number | null;
34
+ perDay: number;
35
+ textMax: number;
36
+ /** The name the server has for this wallet, or the app's suggestion. */
37
+ name: string;
38
+ appName: string;
39
+ onVote: (id: string, up: boolean) => void;
40
+ /**
41
+ * Resolves null once it has landed, or what to say about a refusal. A
42
+ * refusal with no key (the user declining the signature) keeps the screen
43
+ * and says nothing: "not now" is an answer, not an error.
44
+ */
45
+ onSend: (post: {
46
+ kind: PostKind;
47
+ text: string;
48
+ anon: boolean;
49
+ name: string;
50
+ }) => Promise<{
51
+ key: CopyKey | null;
52
+ vars?: Record<string, string | number>;
53
+ } | null>;
54
+ }): import("preact").JSX.Element;
55
+ //# sourceMappingURL=Compose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Compose.d.ts","sourceRoot":"","sources":["../../../src/ui/Compose.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,IAAI,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} from '../i18n.js';
3
+ /** The glyph and the words for each kind. Exported because the compose screen
4
+ * draws the same two, and a kind that looked one way while you chose it and
5
+ * another once it landed would be two kinds. */
6
+ export declare const KIND: Record<PostKind, {
7
+ icon: () => preact.JSX.Element;
8
+ label: CopyKey;
9
+ }>;
10
+ export declare function Badge({ tone, icon, label }: {
11
+ tone: string;
12
+ icon: () => preact.JSX.Element;
13
+ label: string;
14
+ }): import("preact").JSX.Element;
15
+ /**
16
+ * Seconding something, wherever it is offered: on a card, and on a lookalike
17
+ * the compose screen turned up. One component so the two can never come to
18
+ * look like two different actions.
19
+ */
20
+ export declare function VoteButton({ votes, voted, onVote, t, }: {
21
+ votes: number;
22
+ voted: boolean;
23
+ onVote: (up: boolean) => void;
24
+ t: Translate;
25
+ }): import("preact").JSX.Element;
26
+ /**
27
+ * One post.
28
+ *
29
+ * Three things share the card and only one of them is the text: what kind of
30
+ * thing it is, whether anything has happened to it, and how many want it. The
31
+ * vote is the one control everybody gets.
32
+ *
33
+ * **Who wrote it is a label and never an address**, and an anonymous post says
34
+ * so where the name would be, because a blank reads as a name that failed to
35
+ * load.
36
+ *
37
+ * The card is a target only for an owner, whose tap opens the sheet that
38
+ * answers it. Shitti hid the bin behind a swipe; here it is a visible button,
39
+ * because a gesture nobody can discover is a feature nobody has, and a widget
40
+ * in somebody else's app cannot teach its own gestures.
41
+ */
42
+ export declare function PostCard({ post, appName, t, locale, onVote, onDelete, onManage, }: {
43
+ post: Post;
44
+ appName: string;
45
+ t: Translate;
46
+ locale: string;
47
+ onVote: (up: boolean) => void;
48
+ /** Your own post, or any post for an owner. */
49
+ onDelete?: () => void;
50
+ /** Owners only. Absent → the card is not a target. */
51
+ onManage?: () => void;
52
+ }): import("preact").JSX.Element;
53
+ //# sourceMappingURL=PostCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PostCard.d.ts","sourceRoot":"","sources":["../../../src/ui/PostCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE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@@
1
+ import type { Post, PostStatus } from '@pleasenobugs/core';
2
+ import type { Translate } from '../i18n.js';
3
+ export declare function DeleteSheet({ t, onConfirm, onClose }: {
4
+ t: Translate;
5
+ onConfirm: () => void;
6
+ onClose: () => void;
7
+ }): import("preact").JSX.Element;
8
+ /**
9
+ * An owner answering a post: where it stands, what to say, and whether it
10
+ * stays on the board. **One save for all three**, because three separate
11
+ * confirmations are three chances to leave halfway.
12
+ *
13
+ * On a post that carries context it also shows what the app sent along (a
14
+ * version, the host), which nobody but owners ever sees.
15
+ */
16
+ export declare function ManageSheet({ t, post, replyMax, onSave, onClose, }: {
17
+ t: Translate;
18
+ post: Post;
19
+ replyMax: number;
20
+ onSave: (change: {
21
+ status: PostStatus;
22
+ reply: string;
23
+ hidden: boolean;
24
+ }) => void;
25
+ onClose: () => void;
26
+ }): import("preact").JSX.Element;
27
+ //# sourceMappingURL=Sheets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sheets.d.ts","sourceRoot":"","sources":["../../../src/ui/Sheets.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAW,SAAS,EAAE,MAAM,YAAY,CAAC;AAkCrD,wBAAgB,WAAW,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;IAAE,CAAC,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,MAAM,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,gCAelH;AAUD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAC1B,CAAC,EACD,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,OAAO,GACR,EAAE;IACD,CAAC,EAAE,SAAS,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,UAAU,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IACjF,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,gCAgEA"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Every glyph the widget draws, inline. Assets would mean a URL to resolve
3
+ * from inside somebody else's app, which is one more thing to break; these
4
+ * take `currentColor` and need nothing.
5
+ */
6
+ type P = {
7
+ size?: number;
8
+ };
9
+ export declare const Back: ({ size }: P) => import("preact").JSX.Element;
10
+ export declare const Close: ({ size }: P) => import("preact").JSX.Element;
11
+ export declare const Plus: ({ size }: P) => import("preact").JSX.Element;
12
+ export declare const Trash: ({ size }: P) => import("preact").JSX.Element;
13
+ /** The upvote caret: six points, and it takes the button's colour in both states. */
14
+ export declare const Caret: ({ size }: P) => import("preact").JSX.Element;
15
+ /** A speech bubble with a beetle's worth of meaning: the floating button. */
16
+ export declare const Bubble: ({ size }: P) => import("preact").JSX.Element;
17
+ export declare const Bug: ({ size }: P) => import("preact").JSX.Element;
18
+ export declare const Idea: ({ size }: P) => import("preact").JSX.Element;
19
+ export declare const Planned: ({ size }: P) => import("preact").JSX.Element;
20
+ export declare const Done: ({ size }: P) => import("preact").JSX.Element;
21
+ export declare const Declined: ({ size }: P) => import("preact").JSX.Element;
22
+ export {};
23
+ //# sourceMappingURL=icons.d.ts.map