@stefan.inc/feedback-engine 1.5.0 → 1.6.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 +2 -2
- package/package.json +1 -1
- package/src/core/session.ts +8 -2
- package/src/editor/Editor.svelte +146 -2
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Alt+Meta+click anything in the browser, click any component on the frozen screen
|
|
|
8
8
|
|
|
9
9
|
| The editor in the browser | The `feedback.png` it exports |
|
|
10
10
|
| :---: | :---: |
|
|
11
|
-
| <img src="https://raw.githubusercontent.com/smirea/feedback-engine/master/docs/web-editor.png" alt="The Feedback editor in Google Chrome over the React example: the page's screenshot on the left with four notes numbered 1 to 4 and an @5 tag on the New List button, and the panel on the right with the Groceries row, a ListRow, selected and its note, Show a progress bar here." width="320"> | <img src="https://raw.githubusercontent.com/smirea/feedback-engine/master/docs/web-export.png" alt="The feedback.png exported from the browser: the page with four numbered boxes and the New List button tagged @5. One column on the left holds the app's details as Name: value lines, a References line naming @5 with its file:line, and a card per note, each joined to its box by a curve with a dot at each end that crosses no other box. Each card has its note, the component or element, and its file:line. The note on Settings reads Move this next to @5_Button. A faint GitHub mark and the repository's URL sit in the top left corner, above the details." width="520"> |
|
|
11
|
+
| <img src="https://raw.githubusercontent.com/smirea/feedback-engine/master/docs/web-editor.png" alt="The Feedback editor in Google Chrome over the React example: the page's screenshot on the left with four notes numbered 1 to 4 and an @5 tag on the New List button, and the panel on the right with the Groceries row, a ListRow, selected and its note, Show a progress bar here, and under the field all four notes, each with its number, target, and text." width="320"> | <img src="https://raw.githubusercontent.com/smirea/feedback-engine/master/docs/web-export.png" alt="The feedback.png exported from the browser: the page with four numbered boxes and the New List button tagged @5. One column on the left holds the app's details as Name: value lines, a References line naming @5 with its file:line, and a card per note, each joined to its box by a curve with a dot at each end that crosses no other box. Each card has its note, the component or element, and its file:line. The note on Settings reads Move this next to @5_Button. A faint GitHub mark and the repository's URL sit in the top left corner, above the details." width="520"> |
|
|
12
12
|
|
|
13
13
|
Four notes on the React example in Google Chrome. The last one points at a second element. Type `@`, click the element, and the note reads `Move this next to @5_Button`. The export draws that element's box and highlights the token in the same color, so an agent knows which button you meant. Each card names its component or element and the `file:line` it comes from, such as `src/components/ListRow.tsx:4`.
|
|
14
14
|
|
|
@@ -238,7 +238,7 @@ export default defineConfig({
|
|
|
238
238
|
|
|
239
239
|
The token is the switch. With `PROCRASTIMATE_TOKEN` set, **ProcrastiMate** shows in the Share menu, with the same picker and task as on iOS. Without it, the entry is not there, and nothing else changes. `setupFeedbackEngine()` needs no option for either case.
|
|
240
240
|
|
|
241
|
-
- The token is a ProcrastiMate
|
|
241
|
+
- The token is a ProcrastiMate personal token, from Settings › Personal token. An AI account's token lists the projects but cannot upload the image, so the post fails with `Not for AI accounts`. `feedbackProcrastimate({ url })` names another ProcrastiMate server.
|
|
242
242
|
- `feedbackProcrastimate({ project })` names the project the picker opens on, by name (ignoring case) or id, so an app's feedback lands in its own project. Without it, the picker opens on the last project posted to. A name ProcrastiMate does not have shows as an error above the list.
|
|
243
243
|
- The proxy runs in `vite dev` and `vite preview`. A build reads the token too. Build a site you deploy without it, because a static host has no proxy.
|
|
244
244
|
- For a proxy of your own, pass its address to the page instead: `setupFeedbackEngine({ procrastimate: { url: '/my-proxy' } })`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stefan.inc/feedback-engine",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.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/session.ts
CHANGED
|
@@ -92,6 +92,13 @@ export class Session {
|
|
|
92
92
|
return this.annotations.colorIndex(node);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
/** What a tap on the screenshot or on an item in the list picks while the text ends in `@`. */
|
|
96
|
+
pickReference(node: number) {
|
|
97
|
+
if (!this.isReferencing) return;
|
|
98
|
+
this.referencePick = node;
|
|
99
|
+
this.referenceLevel = 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
95
102
|
stepReference(level: number) {
|
|
96
103
|
this.referenceLevel = level;
|
|
97
104
|
}
|
|
@@ -124,8 +131,7 @@ export class Session {
|
|
|
124
131
|
pick(point: Point) {
|
|
125
132
|
const id = hitTest(this.capture, point);
|
|
126
133
|
if (this.isReferencing) {
|
|
127
|
-
this.
|
|
128
|
-
this.referenceLevel = 0;
|
|
134
|
+
this.pickReference(id);
|
|
129
135
|
return;
|
|
130
136
|
}
|
|
131
137
|
const flagged = new Set(this.items.map(item => item.target));
|
package/src/editor/Editor.svelte
CHANGED
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
...item,
|
|
68
68
|
number: session.annotations.number(item.target),
|
|
69
69
|
color: paletteColor(session.colorIndex(item.target)),
|
|
70
|
+
title: title(capture.nodes[item.target]!),
|
|
70
71
|
})),
|
|
71
72
|
references: session.visibleReferences.map(reference => ({
|
|
72
73
|
...reference,
|
|
@@ -90,6 +91,8 @@
|
|
|
90
91
|
let zoom = $state(1);
|
|
91
92
|
let hover = $state<number>();
|
|
92
93
|
let showsInfo = $state(false);
|
|
94
|
+
/** The list of items starts open beside the screenshot, and closed under it on a phone, where it would cover the picture. */
|
|
95
|
+
let showsItems = $state(matchMedia('(min-width: 900px)').matches);
|
|
93
96
|
let showsShare = $state(false);
|
|
94
97
|
let showsProcrastimate = $state(false);
|
|
95
98
|
let posting = $state<Delivery>();
|
|
@@ -476,7 +479,7 @@
|
|
|
476
479
|
<strong class="picked">{title(view.referenceTarget)}</strong>
|
|
477
480
|
<button type="button" class="insert" onclick={() => act(() => session.insertReference())}>Insert</button>
|
|
478
481
|
{:else}
|
|
479
|
-
<span class="picked">@ Click an element to reference it</span>
|
|
482
|
+
<span class="picked">@ Click an element{view.items.length ? ' or an item' : ''} to reference it</span>
|
|
480
483
|
{/if}
|
|
481
484
|
</div>
|
|
482
485
|
{/if}
|
|
@@ -507,6 +510,48 @@
|
|
|
507
510
|
</svg>
|
|
508
511
|
</button>
|
|
509
512
|
</div>
|
|
513
|
+
{#if view.items.length}
|
|
514
|
+
<div class="items">
|
|
515
|
+
<button
|
|
516
|
+
type="button"
|
|
517
|
+
class="toggle"
|
|
518
|
+
aria-expanded={showsItems}
|
|
519
|
+
aria-controls="feedback-items"
|
|
520
|
+
onclick={() => (showsItems = !showsItems)}
|
|
521
|
+
>
|
|
522
|
+
{count(view.items.length)}
|
|
523
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 9l6 6 6-6" /></svg>
|
|
524
|
+
</button>
|
|
525
|
+
{#if showsItems}
|
|
526
|
+
<!-- A press keeps the field's focus, so Enter still inserts a reference or saves after picking an item. -->
|
|
527
|
+
<ol id="feedback-items" aria-label="Feedback items">
|
|
528
|
+
{#each view.items as item (item.id)}
|
|
529
|
+
<li>
|
|
530
|
+
<button
|
|
531
|
+
type="button"
|
|
532
|
+
class:current={item.id === view.editing?.id}
|
|
533
|
+
class:referenced={item.target === view.referenceTarget?.id}
|
|
534
|
+
aria-label={view.isReferencing
|
|
535
|
+
? `Reference item ${item.number}, ${item.title}`
|
|
536
|
+
: `Edit item ${item.number}, ${item.title}`}
|
|
537
|
+
onmousedown={event => event.preventDefault()}
|
|
538
|
+
onclick={() =>
|
|
539
|
+
act(() =>
|
|
540
|
+
view.isReferencing ? session.pickReference(item.target) : session.select(item.target),
|
|
541
|
+
)}
|
|
542
|
+
>
|
|
543
|
+
<span class="number static" style="--color:{item.color}">{item.number}</span>
|
|
544
|
+
<span class="summary">
|
|
545
|
+
<strong>{item.title}</strong>
|
|
546
|
+
<span>{item.text}</span>
|
|
547
|
+
</span>
|
|
548
|
+
</button>
|
|
549
|
+
</li>
|
|
550
|
+
{/each}
|
|
551
|
+
</ol>
|
|
552
|
+
{/if}
|
|
553
|
+
</div>
|
|
554
|
+
{/if}
|
|
510
555
|
</section>
|
|
511
556
|
</div>
|
|
512
557
|
|
|
@@ -1033,6 +1078,99 @@
|
|
|
1033
1078
|
background: #0a84ff;
|
|
1034
1079
|
}
|
|
1035
1080
|
|
|
1081
|
+
.items {
|
|
1082
|
+
display: flex;
|
|
1083
|
+
flex-direction: column;
|
|
1084
|
+
gap: 6px;
|
|
1085
|
+
min-height: 0;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
.toggle {
|
|
1089
|
+
display: flex;
|
|
1090
|
+
align-items: center;
|
|
1091
|
+
gap: 4px;
|
|
1092
|
+
align-self: flex-start;
|
|
1093
|
+
border: 0;
|
|
1094
|
+
padding: 2px 0;
|
|
1095
|
+
background: none;
|
|
1096
|
+
color: #aeaeb2;
|
|
1097
|
+
font-size: 13px;
|
|
1098
|
+
font-weight: 600;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
.toggle svg {
|
|
1102
|
+
width: 14px;
|
|
1103
|
+
height: 14px;
|
|
1104
|
+
transition: rotate 0.15s;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
.toggle[aria-expanded='false'] svg {
|
|
1108
|
+
rotate: -90deg;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
ol {
|
|
1112
|
+
display: grid;
|
|
1113
|
+
gap: 4px;
|
|
1114
|
+
min-height: 0;
|
|
1115
|
+
max-height: 30dvh;
|
|
1116
|
+
margin: 0;
|
|
1117
|
+
padding: 0;
|
|
1118
|
+
list-style: none;
|
|
1119
|
+
overflow-y: auto;
|
|
1120
|
+
overscroll-behavior: contain;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
ol button {
|
|
1124
|
+
display: flex;
|
|
1125
|
+
align-items: flex-start;
|
|
1126
|
+
gap: 10px;
|
|
1127
|
+
width: 100%;
|
|
1128
|
+
border: 1.5px solid transparent;
|
|
1129
|
+
border-radius: 12px;
|
|
1130
|
+
padding: 8px 10px;
|
|
1131
|
+
box-sizing: border-box;
|
|
1132
|
+
background: #2a2a2c;
|
|
1133
|
+
text-align: left;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
ol button:hover {
|
|
1137
|
+
background: #323234;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
ol button.current {
|
|
1141
|
+
border-color: #ffd60a;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
ol button.referenced {
|
|
1145
|
+
border-color: #32ade6;
|
|
1146
|
+
background: rgb(50 173 230 / 0.12);
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
ol .number.static {
|
|
1150
|
+
flex: none;
|
|
1151
|
+
margin: 0;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
.summary {
|
|
1155
|
+
display: grid;
|
|
1156
|
+
gap: 2px;
|
|
1157
|
+
min-width: 0;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
.summary strong {
|
|
1161
|
+
font-size: 13px;
|
|
1162
|
+
color: #aeaeb2;
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
.summary span {
|
|
1166
|
+
display: -webkit-box;
|
|
1167
|
+
-webkit-box-orient: vertical;
|
|
1168
|
+
-webkit-line-clamp: 2;
|
|
1169
|
+
line-clamp: 2;
|
|
1170
|
+
overflow: hidden;
|
|
1171
|
+
white-space: pre-line;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1036
1174
|
.toast {
|
|
1037
1175
|
position: absolute;
|
|
1038
1176
|
top: 60px;
|
|
@@ -1108,13 +1246,19 @@
|
|
|
1108
1246
|
flex-direction: row;
|
|
1109
1247
|
}
|
|
1110
1248
|
|
|
1249
|
+
/* A column, so the list takes the height left under the field and scrolls inside it. */
|
|
1111
1250
|
.panel {
|
|
1112
|
-
|
|
1251
|
+
display: flex;
|
|
1252
|
+
flex-direction: column;
|
|
1113
1253
|
width: 380px;
|
|
1114
1254
|
box-sizing: border-box;
|
|
1115
1255
|
border-left: 1px solid rgb(255 255 255 / 0.08);
|
|
1116
1256
|
}
|
|
1117
1257
|
|
|
1258
|
+
ol {
|
|
1259
|
+
max-height: none;
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1118
1262
|
.info {
|
|
1119
1263
|
top: calc(100% + 10px);
|
|
1120
1264
|
bottom: auto;
|