@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/src/react/public.d.ts
CHANGED
|
@@ -38,9 +38,15 @@ export type FeedbackOptions = {
|
|
|
38
38
|
/**
|
|
39
39
|
* Adds one entry to the Share menu per webhook. Choosing it posts the image export and the JSON export to the
|
|
40
40
|
* webhook's `url`, with nothing more to fill in. The menu lists ProcrastiMate, then the webhooks with `githubIcon`,
|
|
41
|
-
* then the others
|
|
41
|
+
* then the others.
|
|
42
42
|
*/
|
|
43
43
|
webhooks?: Webhook[];
|
|
44
|
+
/**
|
|
45
|
+
* The Share menu entries that also get a button beside Share, by name, in this order: `'ProcrastiMate'` or a
|
|
46
|
+
* webhook's `name`. A name the menu does not list is skipped. Without it, the first two of ProcrastiMate and the
|
|
47
|
+
* webhooks get one. `[]` gives none.
|
|
48
|
+
*/
|
|
49
|
+
pinned?: string[];
|
|
44
50
|
};
|
|
45
51
|
|
|
46
52
|
/** One entry of the Share menu that posts the feedback to a server of the app's own. `docs/webhooks.md` has the request. */
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
<svelte:options css="injected" />
|
|
2
|
-
|
|
3
|
-
<script lang="ts">
|
|
4
|
-
import { paletteColor, title, type Session } from '../core/index.ts';
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
session,
|
|
8
|
-
version,
|
|
9
|
-
onclose,
|
|
10
|
-
onselect,
|
|
11
|
-
onremove,
|
|
12
|
-
}: {
|
|
13
|
-
session: Session;
|
|
14
|
-
/** Changes whenever the session does, since the session is not reactive by itself. */
|
|
15
|
-
version: number;
|
|
16
|
-
onclose: () => void;
|
|
17
|
-
onselect: (id: number) => void;
|
|
18
|
-
onremove: (id: string) => void;
|
|
19
|
-
} = $props();
|
|
20
|
-
|
|
21
|
-
// svelte-ignore state_referenced_locally
|
|
22
|
-
const { capture } = session;
|
|
23
|
-
const items = $derived.by(() => {
|
|
24
|
-
void version;
|
|
25
|
-
return session.items.map(item => ({
|
|
26
|
-
...item,
|
|
27
|
-
number: session.annotations.number(item.target),
|
|
28
|
-
color: paletteColor(session.colorIndex(item.target)),
|
|
29
|
-
segments: session.annotations.segments(item.text),
|
|
30
|
-
}));
|
|
31
|
-
});
|
|
32
|
-
</script>
|
|
33
|
-
|
|
34
|
-
<div class="scrim" role="presentation" onclick={event => event.target === event.currentTarget && onclose()}>
|
|
35
|
-
<div class="sheet" role="dialog" tabindex="-1" aria-label="Feedback list">
|
|
36
|
-
<header>
|
|
37
|
-
<h2>Feedback</h2>
|
|
38
|
-
<button type="button" class="done" onclick={onclose}>Done</button>
|
|
39
|
-
</header>
|
|
40
|
-
<div class="scroll">
|
|
41
|
-
{#if !items.length}
|
|
42
|
-
<p class="empty">No feedback yet. Click a component, type, and press the arrow.</p>
|
|
43
|
-
{/if}
|
|
44
|
-
<ul>
|
|
45
|
-
{#each items as item (item.id)}
|
|
46
|
-
<li>
|
|
47
|
-
<button type="button" class="row" onclick={() => onselect(item.target)}>
|
|
48
|
-
<span class="number" style="background:{item.color}">{item.number}</span>
|
|
49
|
-
<span class="text">
|
|
50
|
-
<strong>{title(capture.nodes[item.target]!)}</strong>
|
|
51
|
-
<span>
|
|
52
|
-
{#each item.segments as segment, index (index)}
|
|
53
|
-
{#if segment.reference}<span
|
|
54
|
-
class="token"
|
|
55
|
-
style="background:{paletteColor(session.colorIndex(segment.reference.target))}"
|
|
56
|
-
>{segment.text}</span
|
|
57
|
-
>{:else}{segment.text}{/if}
|
|
58
|
-
{/each}
|
|
59
|
-
</span>
|
|
60
|
-
</span>
|
|
61
|
-
</button>
|
|
62
|
-
<button
|
|
63
|
-
type="button"
|
|
64
|
-
class="remove"
|
|
65
|
-
aria-label="Remove item {item.number}"
|
|
66
|
-
onclick={() => onremove(item.id)}
|
|
67
|
-
>
|
|
68
|
-
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 7h14M10 7V4h4v3M7 7l1 13h8l1-13" /></svg>
|
|
69
|
-
</button>
|
|
70
|
-
</li>
|
|
71
|
-
{/each}
|
|
72
|
-
</ul>
|
|
73
|
-
<h3>Attached context</h3>
|
|
74
|
-
{#each [...capture.environment, ...capture.context] as entry, index (index)}
|
|
75
|
-
<details>
|
|
76
|
-
<summary>{entry.name}</summary>
|
|
77
|
-
<pre>{entry.value}</pre>
|
|
78
|
-
</details>
|
|
79
|
-
{/each}
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
|
|
84
|
-
<style>
|
|
85
|
-
.scrim {
|
|
86
|
-
position: absolute;
|
|
87
|
-
inset: 0;
|
|
88
|
-
z-index: 5;
|
|
89
|
-
display: grid;
|
|
90
|
-
place-items: end center;
|
|
91
|
-
background: rgb(0 0 0 / 0.5);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.sheet {
|
|
95
|
-
display: flex;
|
|
96
|
-
flex-direction: column;
|
|
97
|
-
width: min(100%, 560px);
|
|
98
|
-
max-height: 80%;
|
|
99
|
-
border-radius: 16px 16px 0 0;
|
|
100
|
-
box-sizing: border-box;
|
|
101
|
-
background: #1f1f1f;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
header {
|
|
105
|
-
display: flex;
|
|
106
|
-
align-items: center;
|
|
107
|
-
justify-content: space-between;
|
|
108
|
-
padding: 14px 16px 8px;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
h2 {
|
|
112
|
-
margin: 0;
|
|
113
|
-
font-size: 17px;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
h3 {
|
|
117
|
-
margin: 20px 0 6px;
|
|
118
|
-
color: #aeaeb2;
|
|
119
|
-
font-size: 12px;
|
|
120
|
-
font-weight: 600;
|
|
121
|
-
text-transform: uppercase;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
button {
|
|
125
|
-
border: 0;
|
|
126
|
-
background: none;
|
|
127
|
-
color: inherit;
|
|
128
|
-
font: inherit;
|
|
129
|
-
cursor: pointer;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.done {
|
|
133
|
-
color: #0a84ff;
|
|
134
|
-
font-weight: 600;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.scroll {
|
|
138
|
-
padding: 0 16px 16px;
|
|
139
|
-
overflow: auto;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.empty {
|
|
143
|
-
color: #aeaeb2;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
ul {
|
|
147
|
-
margin: 0;
|
|
148
|
-
padding: 0;
|
|
149
|
-
list-style: none;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
li {
|
|
153
|
-
display: flex;
|
|
154
|
-
align-items: flex-start;
|
|
155
|
-
gap: 4px;
|
|
156
|
-
border-bottom: 1px solid rgb(255 255 255 / 0.08);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.row {
|
|
160
|
-
display: flex;
|
|
161
|
-
flex: 1;
|
|
162
|
-
gap: 10px;
|
|
163
|
-
min-width: 0;
|
|
164
|
-
padding: 10px 0;
|
|
165
|
-
text-align: left;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.number {
|
|
169
|
-
display: grid;
|
|
170
|
-
flex: none;
|
|
171
|
-
place-items: center;
|
|
172
|
-
width: 22px;
|
|
173
|
-
height: 22px;
|
|
174
|
-
border-radius: 11px;
|
|
175
|
-
font-size: 12px;
|
|
176
|
-
font-weight: 700;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.text {
|
|
180
|
-
display: grid;
|
|
181
|
-
gap: 2px;
|
|
182
|
-
min-width: 0;
|
|
183
|
-
white-space: pre-wrap;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.token {
|
|
187
|
-
border-radius: 3px;
|
|
188
|
-
padding: 0 4px;
|
|
189
|
-
font-weight: 600;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.remove {
|
|
193
|
-
padding: 10px 4px;
|
|
194
|
-
color: #ff453a;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
svg {
|
|
198
|
-
width: 18px;
|
|
199
|
-
height: 18px;
|
|
200
|
-
fill: none;
|
|
201
|
-
stroke: currentColor;
|
|
202
|
-
stroke-width: 2;
|
|
203
|
-
stroke-linecap: round;
|
|
204
|
-
stroke-linejoin: round;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
summary {
|
|
208
|
-
padding: 8px 0;
|
|
209
|
-
cursor: pointer;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
pre {
|
|
213
|
-
margin: 0 0 8px;
|
|
214
|
-
color: #aeaeb2;
|
|
215
|
-
font:
|
|
216
|
-
12px/1.35 ui-monospace,
|
|
217
|
-
'SF Mono',
|
|
218
|
-
Menlo,
|
|
219
|
-
monospace;
|
|
220
|
-
white-space: pre-wrap;
|
|
221
|
-
overflow-wrap: anywhere;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
@media (min-width: 900px) {
|
|
225
|
-
.scrim {
|
|
226
|
-
place-items: center;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
.sheet {
|
|
230
|
-
border-radius: 16px;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
</style>
|