pi-sdk-web 0.4.6 → 0.4.7
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/dist/static/app.js +25 -3
- package/dist/static/style.css +20 -5
- package/package.json +1 -1
package/dist/static/app.js
CHANGED
|
@@ -786,7 +786,9 @@ class PiWebClient {
|
|
|
786
786
|
body.className = 'special-body body-text';
|
|
787
787
|
div.appendChild(labelEl);
|
|
788
788
|
div.appendChild(body);
|
|
789
|
-
|
|
789
|
+
// Click to expand/collapse, but NOT when the pointer was dragged (see
|
|
790
|
+
// bindExpandToggle - same drag-vs-click logic as tool blocks).
|
|
791
|
+
this.bindExpandToggle(div, (d) => this.toggleSpecial(d));
|
|
790
792
|
this.contentEl.appendChild(div);
|
|
791
793
|
return div;
|
|
792
794
|
}
|
|
@@ -1151,6 +1153,25 @@ class PiWebClient {
|
|
|
1151
1153
|
}
|
|
1152
1154
|
}
|
|
1153
1155
|
|
|
1156
|
+
/**
|
|
1157
|
+
* Add expand/collapse-on-click to a block, while preserving text selection.
|
|
1158
|
+
*
|
|
1159
|
+
* A drag that selects text ends with mouseup -> click; toggling then would
|
|
1160
|
+
* re-render the block and wipe the selection. Record the mousedown
|
|
1161
|
+
* position and skip the toggle when the pointer moved more than 3px
|
|
1162
|
+
* (anything beyond that is a drag, not a click - 3px tolerates hand tremor
|
|
1163
|
+
* on a plain click).
|
|
1164
|
+
*/
|
|
1165
|
+
bindExpandToggle(div, toggleFn) {
|
|
1166
|
+
let downX = 0, downY = 0;
|
|
1167
|
+
div.addEventListener('mousedown', (e) => { downX = e.clientX; downY = e.clientY; });
|
|
1168
|
+
div.addEventListener('click', (e) => {
|
|
1169
|
+
const dx = e.clientX - downX, dy = e.clientY - downY;
|
|
1170
|
+
if (dx * dx + dy * dy > 9) return; // dragged: preserve selection
|
|
1171
|
+
toggleFn(div);
|
|
1172
|
+
});
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1154
1175
|
createToolBlock(toolName, args, toolCallId) {
|
|
1155
1176
|
const div = document.createElement('div');
|
|
1156
1177
|
div.className = 'tool-block pending';
|
|
@@ -1203,8 +1224,9 @@ class PiWebClient {
|
|
|
1203
1224
|
div.appendChild(content);
|
|
1204
1225
|
div.appendChild(bottom);
|
|
1205
1226
|
|
|
1206
|
-
// Click to expand/collapse
|
|
1207
|
-
|
|
1227
|
+
// Click to expand/collapse, but NOT when the pointer was dragged (see
|
|
1228
|
+
// bindExpandToggle - a drag that selected text must preserve selection).
|
|
1229
|
+
this.bindExpandToggle(div, (d) => this.toggleToolExpand(d));
|
|
1208
1230
|
|
|
1209
1231
|
this.contentEl.appendChild(div);
|
|
1210
1232
|
return div;
|
package/dist/static/style.css
CHANGED
|
@@ -63,6 +63,8 @@ body.theme-light {
|
|
|
63
63
|
box-sizing: border-box;
|
|
64
64
|
margin: 0;
|
|
65
65
|
padding: 0;
|
|
66
|
+
user-select: text;
|
|
67
|
+
-webkit-user-select: text;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
html, body {
|
|
@@ -162,8 +164,7 @@ body {
|
|
|
162
164
|
border: 1px solid var(--border);
|
|
163
165
|
border-radius: 6px;
|
|
164
166
|
padding: 6px 10px;
|
|
165
|
-
cursor:
|
|
166
|
-
user-select: none;
|
|
167
|
+
cursor: text;
|
|
167
168
|
font-size: 12px;
|
|
168
169
|
}
|
|
169
170
|
|
|
@@ -268,8 +269,20 @@ body {
|
|
|
268
269
|
background: var(--tool-pending-bg);
|
|
269
270
|
margin: 4px 0;
|
|
270
271
|
font-size: 13px;
|
|
271
|
-
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.tool-block .tool-title,
|
|
275
|
+
.tool-block .tool-meta {
|
|
272
276
|
user-select: none;
|
|
277
|
+
cursor: pointer;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/* Tool args (the JSON parameter summary) and output are informative
|
|
281
|
+
content: selectable/copyable with a text cursor. */
|
|
282
|
+
.tool-block .tool-args,
|
|
283
|
+
.tool-block .tool-output {
|
|
284
|
+
user-select: text;
|
|
285
|
+
cursor: text;
|
|
273
286
|
}
|
|
274
287
|
|
|
275
288
|
.tool-block.success {
|
|
@@ -337,8 +350,6 @@ body {
|
|
|
337
350
|
margin: 4px 0;
|
|
338
351
|
padding: 6px 12px;
|
|
339
352
|
border-radius: 6px;
|
|
340
|
-
cursor: pointer;
|
|
341
|
-
user-select: none;
|
|
342
353
|
}
|
|
343
354
|
|
|
344
355
|
.special-block .special-label {
|
|
@@ -346,11 +357,15 @@ body {
|
|
|
346
357
|
font-weight: bold;
|
|
347
358
|
font-size: 12px;
|
|
348
359
|
margin-bottom: 4px;
|
|
360
|
+
user-select: none;
|
|
361
|
+
cursor: pointer;
|
|
349
362
|
}
|
|
350
363
|
|
|
351
364
|
.special-block .special-body {
|
|
352
365
|
color: var(--text);
|
|
353
366
|
font-size: 13px;
|
|
367
|
+
user-select: text;
|
|
368
|
+
cursor: text;
|
|
354
369
|
}
|
|
355
370
|
|
|
356
371
|
.special-block .special-body > *:first-child {
|