@stefan.inc/feedback-engine 1.2.4 → 1.4.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/README.md +7 -1
- package/package.json +1 -1
- package/src/core/index.ts +1 -0
- package/src/core/savedWebhooks.ts +118 -0
- package/src/dom/savedWebhooks.ts +18 -0
- package/src/dom/share.ts +15 -8
- package/src/dom/webhook.ts +51 -6
- package/src/editor/Editor.svelte +107 -71
- package/src/editor/ProcrastimateSheet.svelte +39 -140
- package/src/editor/Sheet.svelte +120 -0
- package/src/editor/WebhookDialog.svelte +247 -0
- package/src/editor/WebhookSheet.svelte +8 -12
- package/src/editor/destinations.ts +29 -8
- package/src/editor/engine.ts +7 -1
- package/src/react/public.d.ts +7 -1
- package/src/editor/ItemsSheet.svelte +0 -233
package/README.md
CHANGED
|
@@ -266,7 +266,7 @@ The token is the switch. With `PROCRASTIMATE_TOKEN` set, **ProcrastiMate** shows
|
|
|
266
266
|
|
|
267
267
|
## Webhooks
|
|
268
268
|
|
|
269
|
-
A webhook is a Share entry of your own. Choosing it posts the image export and the JSON export to your server in one request, with nothing to fill in, and a toast links to whatever the server made. List any number of them when you set Feedback up:
|
|
269
|
+
A webhook is a Share entry of your own. Choosing it posts the image export and the JSON export to your server in one request, with nothing to fill in, and a toast links to whatever the server made. Someone using the page can also add one from **New Webhook**, last in the Share menu, and the browser keeps it for the site ([docs/webhooks.md](https://github.com/smirea/feedback-engine/blob/master/docs/webhooks.md#add-one-in-the-editor)). List any number of them when you set Feedback up:
|
|
270
270
|
|
|
271
271
|
```ts
|
|
272
272
|
import { githubIcon, setupFeedbackEngine } from '@stefan.inc/feedback-engine/svelte'; // or '/react'
|
|
@@ -278,6 +278,12 @@ setupFeedbackEngine({
|
|
|
278
278
|
|
|
279
279
|
Each webhook also takes `headers` and `query`, as fixed values or as a function that runs when the post is made, for a token the user only has once signed in. [docs/webhooks.md](https://github.com/smirea/feedback-engine/blob/master/docs/webhooks.md) has the request, the answer a server gives, and a server that files every post as a GitHub issue.
|
|
280
280
|
|
|
281
|
+
The first two of ProcrastiMate and the webhooks also get a button beside Share. To choose them yourself, list their names in `pinned`, and the rest stay in the Share menu:
|
|
282
|
+
|
|
283
|
+
```ts
|
|
284
|
+
setupFeedbackEngine({ webhooks, pinned: ['ProcrastiMate'] });
|
|
285
|
+
```
|
|
286
|
+
|
|
281
287
|
## Releases
|
|
282
288
|
|
|
283
289
|
Every change is a release, versioned by [semver](https://semver.org). [CHANGELOG.md](https://github.com/smirea/feedback-engine/blob/master/packages/web/CHANGELOG.md) lists them. A major version is only for a change that breaks an app that upgrades without editing its code.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stefan.inc/feedback-engine",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "In-app feedback for Svelte and React: point at a component, write what should change, and export its name, file:line, and data for an agent.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
package/src/core/index.ts
CHANGED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { ContextEntry } from './model.ts';
|
|
2
|
+
|
|
3
|
+
export type Compression = 'low' | 'medium' | 'high';
|
|
4
|
+
|
|
5
|
+
/** Neither a browser's canvas nor UIKit sets a PNG's compression, so only a JPEG has a level. */
|
|
6
|
+
export type ImageEncoding = { format: 'png' } | { format: 'jpeg'; compression: Compression };
|
|
7
|
+
|
|
8
|
+
/** The JPEG quality of each level, the same on iOS. */
|
|
9
|
+
export const jpegQuality: Record<Compression, number> = { low: 0.9, medium: 0.7, high: 0.5 };
|
|
10
|
+
|
|
11
|
+
/** A webhook someone added in the editor. The device keeps it, and the Share menu lists it after the app's own. */
|
|
12
|
+
export type SavedWebhook = {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
url: string;
|
|
16
|
+
header?: { name: string; value: string };
|
|
17
|
+
image?: ImageEncoding;
|
|
18
|
+
feedback: boolean;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type WebhookDraft = {
|
|
22
|
+
name: string;
|
|
23
|
+
url: string;
|
|
24
|
+
header: string;
|
|
25
|
+
image: boolean;
|
|
26
|
+
format: ImageEncoding['format'];
|
|
27
|
+
compression: Compression;
|
|
28
|
+
feedback: boolean;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type DraftErrors = Partial<Record<'name' | 'url' | 'header', string>>;
|
|
32
|
+
|
|
33
|
+
export function draftOf(webhook?: SavedWebhook): WebhookDraft {
|
|
34
|
+
return {
|
|
35
|
+
name: webhook?.name ?? '',
|
|
36
|
+
url: webhook?.url ?? '',
|
|
37
|
+
header: webhook?.header ? `${webhook.header.name}: ${webhook.header.value}` : '',
|
|
38
|
+
image: webhook ? !!webhook.image : true,
|
|
39
|
+
format: webhook?.image?.format ?? 'png',
|
|
40
|
+
compression: webhook?.image?.format === 'jpeg' ? webhook.image.compression : 'medium',
|
|
41
|
+
feedback: webhook?.feedback ?? true,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const headerPattern = /^([!#$%&'*+.^_`|~0-9A-Za-z-]+)\s*:\s*(\S.*)$/;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The webhook a draft describes, or what is wrong with it. `taken` holds the names of the Share menu's other entries,
|
|
49
|
+
* since a name is what `pinned` picks an entry by.
|
|
50
|
+
*/
|
|
51
|
+
export function readDraft(
|
|
52
|
+
draft: WebhookDraft,
|
|
53
|
+
{ id, taken }: { id: string; taken: string[] },
|
|
54
|
+
): { webhook: SavedWebhook } | { errors: DraftErrors } {
|
|
55
|
+
const errors: DraftErrors = {};
|
|
56
|
+
const name = draft.name.trim();
|
|
57
|
+
if (!name) errors.name = 'Give the webhook a name.';
|
|
58
|
+
else if (taken.some(other => other.toLowerCase() === name.toLowerCase()))
|
|
59
|
+
errors.name = `The Share menu already has ${name}.`;
|
|
60
|
+
const url = draft.url.trim();
|
|
61
|
+
if (!URL.canParse(url) || !/^https?:$/.test(new URL(url).protocol))
|
|
62
|
+
errors.url = 'Enter an address that starts with http:// or https://.';
|
|
63
|
+
const header = draft.header.trim();
|
|
64
|
+
const match = headerPattern.exec(header);
|
|
65
|
+
if (header && !match) errors.header = 'Write the header as Name: value, such as Authorization: Bearer key.';
|
|
66
|
+
if (Object.keys(errors).length) return { errors };
|
|
67
|
+
return {
|
|
68
|
+
webhook: {
|
|
69
|
+
id,
|
|
70
|
+
name,
|
|
71
|
+
url,
|
|
72
|
+
...(match ? { header: { name: match[1]!, value: match[2]!.trim() } } : {}),
|
|
73
|
+
...(draft.image
|
|
74
|
+
? {
|
|
75
|
+
image:
|
|
76
|
+
draft.format === 'jpeg'
|
|
77
|
+
? { format: 'jpeg' as const, compression: draft.compression }
|
|
78
|
+
: { format: 'png' as const },
|
|
79
|
+
}
|
|
80
|
+
: {}),
|
|
81
|
+
feedback: draft.feedback,
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** The saved webhooks in what the device kept. An entry it cannot read is left out, so one bad entry hides no other. */
|
|
87
|
+
export function parseSavedWebhooks(text: string | null): SavedWebhook[] {
|
|
88
|
+
let parsed: unknown;
|
|
89
|
+
try {
|
|
90
|
+
parsed = JSON.parse(text ?? '[]');
|
|
91
|
+
} catch {
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
if (!Array.isArray(parsed)) return [];
|
|
95
|
+
return parsed.flatMap((entry: Partial<SavedWebhook>) => {
|
|
96
|
+
if (typeof entry?.id !== 'string' || typeof entry.feedback !== 'boolean') return [];
|
|
97
|
+
const image = entry.image;
|
|
98
|
+
const read = readDraft(
|
|
99
|
+
{
|
|
100
|
+
name: String(entry.name ?? ''),
|
|
101
|
+
url: String(entry.url ?? ''),
|
|
102
|
+
header: entry.header ? `${entry.header.name}: ${entry.header.value}` : '',
|
|
103
|
+
image: !!image,
|
|
104
|
+
format: image?.format === 'jpeg' ? 'jpeg' : 'png',
|
|
105
|
+
compression: image?.format === 'jpeg' && image.compression in jpegQuality ? image.compression : 'medium',
|
|
106
|
+
feedback: entry.feedback,
|
|
107
|
+
},
|
|
108
|
+
{ id: entry.id, taken: [] },
|
|
109
|
+
);
|
|
110
|
+
return 'webhook' in read ? [read.webhook] : [];
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** The `device` part of a saved webhook's post: the environment as one object, with sorted keys as on iOS. */
|
|
115
|
+
export function deviceJSON(environment: ContextEntry[]) {
|
|
116
|
+
const sorted = environment.toSorted((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
117
|
+
return JSON.stringify(Object.fromEntries(sorted.map(entry => [entry.name, entry.value])));
|
|
118
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { parseSavedWebhooks, type SavedWebhook } from '../core/savedWebhooks.ts';
|
|
2
|
+
|
|
3
|
+
/** The page's origin keeps them, so every page of the app lists them, and another app on another origin does not. */
|
|
4
|
+
const key = 'feedback-engine.webhooks';
|
|
5
|
+
|
|
6
|
+
/** A browser that blocks storage, such as one with cookies off, lists none. */
|
|
7
|
+
export function loadSavedWebhooks(): SavedWebhook[] {
|
|
8
|
+
try {
|
|
9
|
+
return parseSavedWebhooks(localStorage.getItem(key));
|
|
10
|
+
} catch {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Throws where the browser keeps nothing, so the dialog can say so. */
|
|
16
|
+
export function storeSavedWebhooks(webhooks: SavedWebhook[]) {
|
|
17
|
+
localStorage.setItem(key, JSON.stringify(webhooks));
|
|
18
|
+
}
|
package/src/dom/share.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Annotations } from '../core/index.ts';
|
|
2
|
-
import { reportJSON } from '../core/index.ts';
|
|
1
|
+
import type { Annotations, ImageEncoding } from '../core/index.ts';
|
|
2
|
+
import { jpegQuality, reportJSON } from '../core/index.ts';
|
|
3
3
|
import type { Screen } from './capture.ts';
|
|
4
4
|
import { annotatedImage } from './image.ts';
|
|
5
5
|
import { zip } from './zip.ts';
|
|
@@ -15,16 +15,23 @@ export const exportTitles: Record<ExportFormat, string> = {
|
|
|
15
15
|
/** One export: the file to save or share, and the parts the clipboard takes. */
|
|
16
16
|
export type Export = { file: File; image?: Blob; json?: string };
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
'image/
|
|
18
|
+
export function encodeImage(screen: Screen, annotations: Annotations, encoding: ImageEncoding) {
|
|
19
|
+
const [type, name, quality] =
|
|
20
|
+
encoding.format === 'png'
|
|
21
|
+
? ['image/png', 'feedback.png', undefined]
|
|
22
|
+
: ['image/jpeg', 'feedback.jpg', jpegQuality[encoding.compression]];
|
|
23
|
+
return new Promise<File>((resolve, reject) =>
|
|
24
|
+
annotatedImage(screen, annotations).toBlob(
|
|
25
|
+
blob =>
|
|
26
|
+
blob ? resolve(new File([blob], name, { type })) : reject(new Error('The browser could not encode the image')),
|
|
27
|
+
type,
|
|
28
|
+
quality,
|
|
23
29
|
),
|
|
24
30
|
);
|
|
31
|
+
}
|
|
25
32
|
|
|
26
33
|
export async function buildExport(screen: Screen, annotations: Annotations, format: ExportFormat): Promise<Export> {
|
|
27
|
-
const image = format === 'json' ? undefined : await
|
|
34
|
+
const image = format === 'json' ? undefined : await encodeImage(screen, annotations, { format: 'png' });
|
|
28
35
|
const json = format === 'image' ? undefined : reportJSON(screen.capture, annotations);
|
|
29
36
|
if (format === 'image') return { file: new File([image!], 'feedback.png', { type: 'image/png' }), image };
|
|
30
37
|
if (format === 'json') return { file: new File([json!], 'feedback.json', { type: 'application/json' }), json };
|
package/src/dom/webhook.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import type { Annotations } from '../core/annotations.ts';
|
|
1
2
|
import { Problem } from '../core/problem.ts';
|
|
3
|
+
import { reportJSON } from '../core/report.ts';
|
|
4
|
+
import { deviceJSON, type ImageEncoding, type SavedWebhook } from '../core/savedWebhooks.ts';
|
|
5
|
+
import type { Screen } from './capture.ts';
|
|
6
|
+
import { encodeImage } from './share.ts';
|
|
2
7
|
|
|
3
8
|
/** One entry of the Share menu that posts the feedback to a server of the app's own. `docs/webhooks.md` has the request. */
|
|
4
9
|
export type Webhook = {
|
|
@@ -24,12 +29,53 @@ export type WebhookPost = {
|
|
|
24
29
|
/** Made once per post and sent again on a retry, so a server can tell a retry from a second post. */
|
|
25
30
|
id: string;
|
|
26
31
|
title: string;
|
|
27
|
-
|
|
28
|
-
image: Blob;
|
|
29
|
-
/** The JSON export. */
|
|
30
|
-
report: string;
|
|
32
|
+
files: { name: string; file: File }[];
|
|
31
33
|
};
|
|
32
34
|
|
|
35
|
+
/**
|
|
36
|
+
* What a post carries beside its `id` and `title`. An app's webhook sends the image export as PNG and the JSON export,
|
|
37
|
+
* as `image` and `report`. A saved webhook sends the image and the JSON export if it was saved with them, as `image`
|
|
38
|
+
* and `feedback`, and the environment as `device`.
|
|
39
|
+
*/
|
|
40
|
+
export type WebhookContents = { kind: 'report' } | { kind: 'saved'; image?: ImageEncoding; feedback: boolean };
|
|
41
|
+
|
|
42
|
+
/** A webhook with what its posts carry. */
|
|
43
|
+
export type Delivery = { webhook: Webhook; contents: WebhookContents };
|
|
44
|
+
|
|
45
|
+
export function savedDelivery(saved: SavedWebhook): Delivery {
|
|
46
|
+
return {
|
|
47
|
+
webhook: {
|
|
48
|
+
name: saved.name,
|
|
49
|
+
url: saved.url,
|
|
50
|
+
...(saved.header ? { headers: { [saved.header.name]: saved.header.value } } : {}),
|
|
51
|
+
},
|
|
52
|
+
contents: { kind: 'saved', image: saved.image, feedback: saved.feedback },
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const json = (name: string, text: string) => new File([text], name, { type: 'application/json' });
|
|
57
|
+
|
|
58
|
+
/** The file parts of a post, drawn from the editor's capture and annotations. */
|
|
59
|
+
export async function postFiles(
|
|
60
|
+
contents: WebhookContents,
|
|
61
|
+
screen: Screen,
|
|
62
|
+
annotations: Annotations,
|
|
63
|
+
): Promise<WebhookPost['files']> {
|
|
64
|
+
const report = () => reportJSON(screen.capture, annotations, false);
|
|
65
|
+
if (contents.kind === 'report') {
|
|
66
|
+
const image = await encodeImage(screen, annotations, { format: 'png' });
|
|
67
|
+
return [
|
|
68
|
+
{ name: 'image', file: image },
|
|
69
|
+
{ name: 'report', file: json('feedback.json', report()) },
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
return [
|
|
73
|
+
...(contents.image ? [{ name: 'image', file: await encodeImage(screen, annotations, contents.image) }] : []),
|
|
74
|
+
...(contents.feedback ? [{ name: 'feedback', file: json('feedback.json', report()) }] : []),
|
|
75
|
+
{ name: 'device', file: json('device.json', deviceJSON(screen.capture.environment)) },
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
|
|
33
79
|
/**
|
|
34
80
|
* GitHub's mark, 16 points square. The iOS package draws the same path (`GitHubIcon.swift`), which has only absolute
|
|
35
81
|
* `M`, `L`, `C`, and `Z` commands so that a few lines can read it.
|
|
@@ -65,8 +111,7 @@ export async function postWebhook(webhook: Webhook, post: WebhookPost): Promise<
|
|
|
65
111
|
const form = new FormData();
|
|
66
112
|
form.set('id', post.id);
|
|
67
113
|
form.set('title', post.title);
|
|
68
|
-
|
|
69
|
-
form.set('report', new File([post.report], 'feedback.json', { type: 'application/json' }));
|
|
114
|
+
for (const { name, file } of post.files) form.set(name, file);
|
|
70
115
|
let response: Response;
|
|
71
116
|
try {
|
|
72
117
|
response = await fetch(url, { method: 'POST', headers, body: form });
|
package/src/editor/Editor.svelte
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
tag,
|
|
11
11
|
title,
|
|
12
12
|
type Frame,
|
|
13
|
+
type SavedWebhook,
|
|
13
14
|
} from '../core/index.ts';
|
|
14
15
|
import type { Screen } from '../dom/capture.ts';
|
|
15
16
|
import {
|
|
@@ -22,11 +23,12 @@
|
|
|
22
23
|
type Export,
|
|
23
24
|
type ExportFormat,
|
|
24
25
|
} from '../dom/share.ts';
|
|
25
|
-
import
|
|
26
|
-
import {
|
|
26
|
+
import { loadSavedWebhooks, storeSavedWebhooks } from '../dom/savedWebhooks.ts';
|
|
27
|
+
import { savedDelivery, type Delivery } from '../dom/webhook.ts';
|
|
28
|
+
import { destinations, pinnedDestinations, type Destination } from './destinations.ts';
|
|
27
29
|
import type { Engine } from './engine.ts';
|
|
28
|
-
import ItemsSheet from './ItemsSheet.svelte';
|
|
29
30
|
import ProcrastimateSheet from './ProcrastimateSheet.svelte';
|
|
31
|
+
import WebhookDialog from './WebhookDialog.svelte';
|
|
30
32
|
import WebhookSheet from './WebhookSheet.svelte';
|
|
31
33
|
|
|
32
34
|
let { engine, screen }: { engine: Engine; screen: Screen } = $props();
|
|
@@ -88,12 +90,14 @@
|
|
|
88
90
|
let zoom = $state(1);
|
|
89
91
|
let hover = $state<number>();
|
|
90
92
|
let showsInfo = $state(false);
|
|
91
|
-
let showsList = $state(false);
|
|
92
93
|
let showsShare = $state(false);
|
|
93
94
|
let showsProcrastimate = $state(false);
|
|
94
|
-
let posting = $state<
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
let posting = $state<Delivery>();
|
|
96
|
+
let saved = $state(loadSavedWebhooks());
|
|
97
|
+
/** The dialog for a saved webhook, `webhook` unset for a new one. */
|
|
98
|
+
let editing = $state<{ webhook?: SavedWebhook }>();
|
|
99
|
+
const targets = $derived(destinations({ ...engine.options, saved }));
|
|
100
|
+
const pinned = $derived(pinnedDestinations(targets, engine.options.pinned));
|
|
97
101
|
let confirmsClose = $state(false);
|
|
98
102
|
let pending = $state<{ format: ExportFormat; ready: Export }>();
|
|
99
103
|
let busy = $state(false);
|
|
@@ -202,9 +206,9 @@
|
|
|
202
206
|
}
|
|
203
207
|
|
|
204
208
|
function requestClose() {
|
|
205
|
-
if (showsInfo ||
|
|
206
|
-
showsInfo =
|
|
207
|
-
posting = pending = undefined;
|
|
209
|
+
if (showsInfo || showsShare || showsProcrastimate || posting || pending || editing) {
|
|
210
|
+
showsInfo = showsShare = showsProcrastimate = false;
|
|
211
|
+
posting = pending = editing = undefined;
|
|
208
212
|
} else if (session.isTyping || session.unshared.length) {
|
|
209
213
|
confirmsClose = true;
|
|
210
214
|
} else {
|
|
@@ -215,7 +219,32 @@
|
|
|
215
219
|
function send(destination: Destination) {
|
|
216
220
|
showsShare = false;
|
|
217
221
|
if (destination.kind === 'procrastimate') showsProcrastimate = true;
|
|
218
|
-
else
|
|
222
|
+
else if (destination.kind === 'saved') edit(destination.saved);
|
|
223
|
+
else posting = destination.delivery;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function edit(webhook?: SavedWebhook) {
|
|
227
|
+
showsShare = false;
|
|
228
|
+
editing = { webhook };
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** Stores the list and returns why it could not, for the dialog to show. */
|
|
232
|
+
function keep(list: SavedWebhook[]) {
|
|
233
|
+
try {
|
|
234
|
+
storeSavedWebhooks(list);
|
|
235
|
+
} catch (error) {
|
|
236
|
+
return `This browser did not keep the webhook: ${(error as Error).message}`;
|
|
237
|
+
}
|
|
238
|
+
saved = list;
|
|
239
|
+
editing = undefined;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** A new webhook is only saved. An edited one is saved and the feedback goes to it, since choosing it opened the form. */
|
|
243
|
+
function submitWebhook(webhook: SavedWebhook) {
|
|
244
|
+
const isNew = !saved.some(other => other.id === webhook.id);
|
|
245
|
+
const failure = keep(isNew ? [...saved, webhook] : saved.map(other => (other.id === webhook.id ? webhook : other)));
|
|
246
|
+
if (!failure && !isNew) posting = savedDelivery(webhook);
|
|
247
|
+
return failure;
|
|
219
248
|
}
|
|
220
249
|
|
|
221
250
|
async function choose(format: ExportFormat) {
|
|
@@ -267,39 +296,14 @@
|
|
|
267
296
|
}}
|
|
268
297
|
>
|
|
269
298
|
<header>
|
|
270
|
-
<button type="button" class="
|
|
299
|
+
<button type="button" class="nav" aria-label="Close" onclick={requestClose}>
|
|
271
300
|
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18" /></svg>
|
|
272
301
|
</button>
|
|
273
302
|
<h1>Feedback</h1>
|
|
274
|
-
<button
|
|
275
|
-
type="button"
|
|
276
|
-
class="round"
|
|
277
|
-
aria-label="Feedback list, {count(view.items.length)}"
|
|
278
|
-
onclick={() => (showsList = true)}
|
|
279
|
-
>
|
|
280
|
-
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 6h11M9 12h11M9 18h11M4 6h.01M4 12h.01M4 18h.01" /></svg>
|
|
281
|
-
{#if view.items.length}<span class="count" aria-hidden="true">{view.items.length}</span>{/if}
|
|
282
|
-
</button>
|
|
283
|
-
{#each targets.slice(0, shortcutCount) as destination, index (index)}
|
|
284
|
-
<button
|
|
285
|
-
type="button"
|
|
286
|
-
class="round"
|
|
287
|
-
aria-label={destination.name}
|
|
288
|
-
title={destination.name}
|
|
289
|
-
disabled={!view.items.length || busy}
|
|
290
|
-
onclick={() => send(destination)}
|
|
291
|
-
>
|
|
292
|
-
{#if destination.image}
|
|
293
|
-
<img src={destination.image} alt="" />
|
|
294
|
-
{:else}
|
|
295
|
-
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z" /></svg>
|
|
296
|
-
{/if}
|
|
297
|
-
</button>
|
|
298
|
-
{/each}
|
|
299
303
|
<div class="menu">
|
|
300
304
|
<button
|
|
301
305
|
type="button"
|
|
302
|
-
class="
|
|
306
|
+
class="nav"
|
|
303
307
|
aria-label="Share"
|
|
304
308
|
aria-haspopup="menu"
|
|
305
309
|
aria-expanded={showsShare}
|
|
@@ -319,9 +323,29 @@
|
|
|
319
323
|
{destination.name}
|
|
320
324
|
</button>
|
|
321
325
|
{/each}
|
|
326
|
+
<button type="button" role="menuitem" class="destination" onclick={() => edit()}>
|
|
327
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14" /></svg>
|
|
328
|
+
New Webhook
|
|
329
|
+
</button>
|
|
322
330
|
</div>
|
|
323
331
|
{/if}
|
|
324
332
|
</div>
|
|
333
|
+
{#each pinned as destination, index (index)}
|
|
334
|
+
<button
|
|
335
|
+
type="button"
|
|
336
|
+
class="nav"
|
|
337
|
+
aria-label={destination.name}
|
|
338
|
+
title={destination.name}
|
|
339
|
+
disabled={!view.items.length || busy}
|
|
340
|
+
onclick={() => send(destination)}
|
|
341
|
+
>
|
|
342
|
+
{#if destination.image}
|
|
343
|
+
<img src={destination.image} alt="" />
|
|
344
|
+
{:else}
|
|
345
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z" /></svg>
|
|
346
|
+
{/if}
|
|
347
|
+
</button>
|
|
348
|
+
{/each}
|
|
325
349
|
</header>
|
|
326
350
|
|
|
327
351
|
<div class="body">
|
|
@@ -500,19 +524,6 @@
|
|
|
500
524
|
</div>
|
|
501
525
|
{/if}
|
|
502
526
|
|
|
503
|
-
{#if showsList}
|
|
504
|
-
<ItemsSheet
|
|
505
|
-
{session}
|
|
506
|
-
{version}
|
|
507
|
-
onclose={() => (showsList = false)}
|
|
508
|
-
onselect={id => {
|
|
509
|
-
act(() => session.select(id));
|
|
510
|
-
showsList = false;
|
|
511
|
-
}}
|
|
512
|
-
onremove={id => act(() => session.remove(id))}
|
|
513
|
-
/>
|
|
514
|
-
{/if}
|
|
515
|
-
|
|
516
527
|
{#if showsProcrastimate && engine.options.procrastimate}
|
|
517
528
|
<ProcrastimateSheet
|
|
518
529
|
{screen}
|
|
@@ -529,11 +540,24 @@
|
|
|
529
540
|
/>
|
|
530
541
|
{/if}
|
|
531
542
|
|
|
543
|
+
{#if editing}
|
|
544
|
+
{@const webhook = editing.webhook}
|
|
545
|
+
<WebhookDialog
|
|
546
|
+
{webhook}
|
|
547
|
+
taken={targets
|
|
548
|
+
.filter(target => target.kind !== 'saved' || target.saved.id !== webhook?.id)
|
|
549
|
+
.map(target => target.name)}
|
|
550
|
+
onsubmit={submitWebhook}
|
|
551
|
+
ondelete={() => keep(saved.filter(other => other.id !== webhook?.id))}
|
|
552
|
+
onclose={() => (editing = undefined)}
|
|
553
|
+
/>
|
|
554
|
+
{/if}
|
|
555
|
+
|
|
532
556
|
{#if posting}
|
|
533
557
|
<WebhookSheet
|
|
534
558
|
{screen}
|
|
535
559
|
{session}
|
|
536
|
-
|
|
560
|
+
delivery={posting}
|
|
537
561
|
onclose={() => (posting = undefined)}
|
|
538
562
|
onposted={(items, toast) => {
|
|
539
563
|
posting = undefined;
|
|
@@ -626,8 +650,8 @@
|
|
|
626
650
|
header {
|
|
627
651
|
display: flex;
|
|
628
652
|
align-items: center;
|
|
629
|
-
gap:
|
|
630
|
-
padding: 8px
|
|
653
|
+
gap: 4px;
|
|
654
|
+
padding: 4px 8px;
|
|
631
655
|
}
|
|
632
656
|
|
|
633
657
|
h1 {
|
|
@@ -643,7 +667,6 @@
|
|
|
643
667
|
}
|
|
644
668
|
|
|
645
669
|
.round {
|
|
646
|
-
position: relative;
|
|
647
670
|
display: grid;
|
|
648
671
|
place-items: center;
|
|
649
672
|
width: 36px;
|
|
@@ -653,12 +676,27 @@
|
|
|
653
676
|
background: #2c2c2e;
|
|
654
677
|
}
|
|
655
678
|
|
|
656
|
-
.
|
|
657
|
-
|
|
658
|
-
|
|
679
|
+
.nav {
|
|
680
|
+
display: grid;
|
|
681
|
+
place-items: center;
|
|
682
|
+
width: 44px;
|
|
683
|
+
height: 44px;
|
|
684
|
+
border: 0;
|
|
685
|
+
padding: 0;
|
|
686
|
+
background: none;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
.nav img {
|
|
690
|
+
width: 30px;
|
|
691
|
+
height: 30px;
|
|
659
692
|
object-fit: contain;
|
|
660
693
|
}
|
|
661
694
|
|
|
695
|
+
.nav svg {
|
|
696
|
+
width: 26px;
|
|
697
|
+
height: 26px;
|
|
698
|
+
}
|
|
699
|
+
|
|
662
700
|
.round.small {
|
|
663
701
|
width: 30px;
|
|
664
702
|
height: 30px;
|
|
@@ -674,19 +712,6 @@
|
|
|
674
712
|
stroke-linejoin: round;
|
|
675
713
|
}
|
|
676
714
|
|
|
677
|
-
.count {
|
|
678
|
-
position: absolute;
|
|
679
|
-
top: -4px;
|
|
680
|
-
right: -4px;
|
|
681
|
-
min-width: 18px;
|
|
682
|
-
border-radius: 9px;
|
|
683
|
-
padding: 0 4px;
|
|
684
|
-
background: #ff3b30;
|
|
685
|
-
font-size: 11px;
|
|
686
|
-
font-weight: 700;
|
|
687
|
-
line-height: 18px;
|
|
688
|
-
}
|
|
689
|
-
|
|
690
715
|
.menu {
|
|
691
716
|
position: relative;
|
|
692
717
|
}
|
|
@@ -734,6 +759,17 @@
|
|
|
734
759
|
object-fit: contain;
|
|
735
760
|
}
|
|
736
761
|
|
|
762
|
+
.popup svg {
|
|
763
|
+
flex: none;
|
|
764
|
+
width: 18px;
|
|
765
|
+
height: 18px;
|
|
766
|
+
fill: none;
|
|
767
|
+
stroke: currentColor;
|
|
768
|
+
stroke-width: 2;
|
|
769
|
+
stroke-linecap: round;
|
|
770
|
+
stroke-linejoin: round;
|
|
771
|
+
}
|
|
772
|
+
|
|
737
773
|
.body {
|
|
738
774
|
display: flex;
|
|
739
775
|
flex: 1;
|