@spotpatch/runtime 1.1.0 → 1.1.2
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/index.cjs +58 -120
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +58 -121
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -259,9 +259,6 @@ function readSuccessData(value) {
|
|
|
259
259
|
function isCodeContext(value) {
|
|
260
260
|
return isRecord2(value) && typeof value.relativePath === "string" && (value.language === "tsx" || value.language === "jsx") && typeof value.startLine === "number" && typeof value.endLine === "number" && typeof value.excerpt === "string" && (value.boundary === "component" || value.boundary === "nearby-lines");
|
|
261
261
|
}
|
|
262
|
-
function isEditorOpenResult(value) {
|
|
263
|
-
return isRecord2(value) && typeof value.editor === "string" && import_shared3.SPOTPATCH_EDITOR_PREFERENCES.includes(value.editor);
|
|
264
|
-
}
|
|
265
262
|
function deepFreezeUnknown(value) {
|
|
266
263
|
if (!isRecord2(value) && !Array.isArray(value)) {
|
|
267
264
|
return;
|
|
@@ -489,7 +486,7 @@ function createRuntimeApi(options) {
|
|
|
489
486
|
},
|
|
490
487
|
async openEditor(request) {
|
|
491
488
|
const data = await requestJson(import_shared3.SPOTPATCH_ENDPOINTS.openEditor, "POST", request);
|
|
492
|
-
if (!
|
|
489
|
+
if (!isRecord2(data) || data.editor !== "auto" && data.editor !== "vscode" && data.editor !== "cursor") {
|
|
493
490
|
throw new RuntimeApiError();
|
|
494
491
|
}
|
|
495
492
|
return Object.freeze({ editor: data.editor });
|
|
@@ -1573,10 +1570,12 @@ var AGENT_PANEL_STYLES = `
|
|
|
1573
1570
|
border-radius: 10px;
|
|
1574
1571
|
padding: 8px 30px 8px 10px;
|
|
1575
1572
|
color: #e8ebf2;
|
|
1573
|
+
color-scheme: dark;
|
|
1576
1574
|
background: var(--spotpatch-bg-raised);
|
|
1577
1575
|
font-size: 15px;
|
|
1578
1576
|
outline: none;
|
|
1579
1577
|
}
|
|
1578
|
+
.spotpatch-agent select option { color: #e8ebf2; background: #10151e; }
|
|
1580
1579
|
.spotpatch-agent select:focus-visible,
|
|
1581
1580
|
.spotpatch-consent input:focus-visible {
|
|
1582
1581
|
outline: 2px solid #8b7cf7;
|
|
@@ -1799,8 +1798,7 @@ function createAgentPanel(document, ai, localizer) {
|
|
|
1799
1798
|
resetButton.hidden = true;
|
|
1800
1799
|
}
|
|
1801
1800
|
};
|
|
1802
|
-
|
|
1803
|
-
providerSelect.addEventListener("change", () => {
|
|
1801
|
+
function handleProviderChange() {
|
|
1804
1802
|
populateModels();
|
|
1805
1803
|
consentCheckbox.checked = false;
|
|
1806
1804
|
capability.dataset.state = "idle";
|
|
@@ -1810,8 +1808,8 @@ function createAgentPanel(document, ai, localizer) {
|
|
|
1810
1808
|
latestCapabilityErrorCode = void 0;
|
|
1811
1809
|
capabilityReady = false;
|
|
1812
1810
|
refreshActions();
|
|
1813
|
-
}
|
|
1814
|
-
|
|
1811
|
+
}
|
|
1812
|
+
function handleModelChange() {
|
|
1815
1813
|
capability.dataset.state = "idle";
|
|
1816
1814
|
capability.textContent = messages.agent.connectionNotTested;
|
|
1817
1815
|
latestCapabilityState = "idle";
|
|
@@ -1819,7 +1817,10 @@ function createAgentPanel(document, ai, localizer) {
|
|
|
1819
1817
|
latestCapabilityErrorCode = void 0;
|
|
1820
1818
|
capabilityReady = false;
|
|
1821
1819
|
refreshActions();
|
|
1822
|
-
}
|
|
1820
|
+
}
|
|
1821
|
+
populateModels();
|
|
1822
|
+
providerSelect.addEventListener("change", handleProviderChange);
|
|
1823
|
+
modelSelect.addEventListener("change", handleModelChange);
|
|
1823
1824
|
consentCheckbox.addEventListener("change", refreshActions);
|
|
1824
1825
|
function renderCurrentJob() {
|
|
1825
1826
|
if (latestSnapshot === void 0) {
|
|
@@ -1993,6 +1994,9 @@ function createAgentPanel(document, ai, localizer) {
|
|
|
1993
1994
|
},
|
|
1994
1995
|
dispose() {
|
|
1995
1996
|
unsubscribeLocale();
|
|
1997
|
+
providerSelect.removeEventListener("change", handleProviderChange);
|
|
1998
|
+
modelSelect.removeEventListener("change", handleModelChange);
|
|
1999
|
+
consentCheckbox.removeEventListener("change", refreshActions);
|
|
1996
2000
|
}
|
|
1997
2001
|
});
|
|
1998
2002
|
}
|
|
@@ -2142,15 +2146,6 @@ var STATUS_ZH = Object.freeze({
|
|
|
2142
2146
|
reverted: "\u5DF2\u64A4\u9500",
|
|
2143
2147
|
failed: "\u5931\u8D25"
|
|
2144
2148
|
});
|
|
2145
|
-
function editorName(editor, automatic) {
|
|
2146
|
-
if (editor === "vscode") {
|
|
2147
|
-
return "VS Code";
|
|
2148
|
-
}
|
|
2149
|
-
if (editor === "cursor") {
|
|
2150
|
-
return "Cursor";
|
|
2151
|
-
}
|
|
2152
|
-
return automatic;
|
|
2153
|
-
}
|
|
2154
2149
|
var ERROR_MESSAGES_EN = Object.freeze({
|
|
2155
2150
|
[import_shared6.ERROR_CODES.INVALID_REQUEST]: "The Agent request was rejected as invalid.",
|
|
2156
2151
|
[import_shared6.ERROR_CODES.INVALID_TOKEN]: "The local SpotPatch session expired.",
|
|
@@ -2289,7 +2284,7 @@ var UI_MESSAGES = Object.freeze({
|
|
|
2289
2284
|
brand: Object.freeze({
|
|
2290
2285
|
name: "SpotPatch",
|
|
2291
2286
|
context: "Live context",
|
|
2292
|
-
repository: "GitHub",
|
|
2287
|
+
repository: "GitHub \u2197",
|
|
2293
2288
|
repositoryTitle: "Star SpotPatch on GitHub"
|
|
2294
2289
|
}),
|
|
2295
2290
|
trigger: Object.freeze({
|
|
@@ -2343,8 +2338,8 @@ var UI_MESSAGES = Object.freeze({
|
|
|
2343
2338
|
actions: Object.freeze({
|
|
2344
2339
|
addElement: "Add element",
|
|
2345
2340
|
reselect: "Start over",
|
|
2346
|
-
openEditor:
|
|
2347
|
-
openTarget: (index
|
|
2341
|
+
openEditor: "Open source",
|
|
2342
|
+
openTarget: (index) => `Open source for target ${String(index)}`,
|
|
2348
2343
|
preview: "Preview prompt",
|
|
2349
2344
|
copy: "Copy prompt",
|
|
2350
2345
|
back: "Back to edit"
|
|
@@ -2400,9 +2395,9 @@ var UI_MESSAGES = Object.freeze({
|
|
|
2400
2395
|
detachedTargetRemoved: "A removed page element was dropped from the selection.",
|
|
2401
2396
|
contextWarning: "Browser context collection completed with a warning.",
|
|
2402
2397
|
contextCollected: "Browser context collected.",
|
|
2403
|
-
editorOpening:
|
|
2404
|
-
editorOpened:
|
|
2405
|
-
editorFailed:
|
|
2398
|
+
editorOpening: "Opening source\u2026",
|
|
2399
|
+
editorOpened: "Source opened in the editor.",
|
|
2400
|
+
editorFailed: "Could not open the editor. Start it or configure editor.",
|
|
2406
2401
|
completeInstructions: "Add an instruction for every target and wait for context collection to finish.",
|
|
2407
2402
|
promptCopied: "Prompt copied to the clipboard.",
|
|
2408
2403
|
clipboardUnavailable: "Clipboard access is unavailable. Select the prompt manually.",
|
|
@@ -2418,7 +2413,7 @@ var UI_MESSAGES = Object.freeze({
|
|
|
2418
2413
|
brand: Object.freeze({
|
|
2419
2414
|
name: "SpotPatch",
|
|
2420
2415
|
context: "\u5B9E\u65F6\u4E0A\u4E0B\u6587",
|
|
2421
|
-
repository: "GitHub",
|
|
2416
|
+
repository: "GitHub \u2197",
|
|
2422
2417
|
repositoryTitle: "\u5728 GitHub \u4E0A Star SpotPatch"
|
|
2423
2418
|
}),
|
|
2424
2419
|
trigger: Object.freeze({
|
|
@@ -2472,8 +2467,8 @@ var UI_MESSAGES = Object.freeze({
|
|
|
2472
2467
|
actions: Object.freeze({
|
|
2473
2468
|
addElement: "\u6DFB\u52A0\u5143\u7D20",
|
|
2474
2469
|
reselect: "\u91CD\u65B0\u5F00\u59CB",
|
|
2475
|
-
openEditor:
|
|
2476
|
-
openTarget: (index
|
|
2470
|
+
openEditor: "\u6253\u5F00\u6E90\u7801",
|
|
2471
|
+
openTarget: (index) => `\u6253\u5F00\u76EE\u6807 ${String(index)} \u7684\u6E90\u7801`,
|
|
2477
2472
|
preview: "\u9884\u89C8 Prompt",
|
|
2478
2473
|
copy: "\u590D\u5236 Prompt",
|
|
2479
2474
|
back: "\u8FD4\u56DE\u7F16\u8F91"
|
|
@@ -2529,9 +2524,9 @@ var UI_MESSAGES = Object.freeze({
|
|
|
2529
2524
|
detachedTargetRemoved: "\u9875\u9762\u4E2D\u7684\u76EE\u6807\u5DF2\u5378\u8F7D\uFF0C\u5DF2\u4ECE\u5F53\u524D\u9009\u62E9\u4E2D\u79FB\u9664\u3002",
|
|
2530
2525
|
contextWarning: "\u6D4F\u89C8\u5668\u4E0A\u4E0B\u6587\u91C7\u96C6\u5B8C\u6210\uFF0C\u4F46\u5B58\u5728\u8B66\u544A\u3002",
|
|
2531
2526
|
contextCollected: "\u6D4F\u89C8\u5668\u4E0A\u4E0B\u6587\u91C7\u96C6\u5B8C\u6210\u3002",
|
|
2532
|
-
editorOpening:
|
|
2533
|
-
editorOpened:
|
|
2534
|
-
editorFailed:
|
|
2527
|
+
editorOpening: "\u6B63\u5728\u6253\u5F00\u6E90\u7801\u2026\u2026",
|
|
2528
|
+
editorOpened: "\u6E90\u7801\u5DF2\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00\u3002",
|
|
2529
|
+
editorFailed: "\u65E0\u6CD5\u6253\u5F00\u7F16\u8F91\u5668\u3002\u8BF7\u5148\u542F\u52A8\u7F16\u8F91\u5668\u6216\u68C0\u67E5 editor \u914D\u7F6E\u3002",
|
|
2535
2530
|
completeInstructions: "\u8BF7\u4E3A\u6BCF\u4E2A\u76EE\u6807\u586B\u5199\u4FEE\u6539\u8BF4\u660E\uFF0C\u5E76\u7B49\u5F85\u4E0A\u4E0B\u6587\u91C7\u96C6\u5B8C\u6210\u3002",
|
|
2536
2531
|
promptCopied: "Prompt \u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F\u3002",
|
|
2537
2532
|
clipboardUnavailable: "\u65E0\u6CD5\u8BBF\u95EE\u526A\u8D34\u677F\uFF0C\u8BF7\u624B\u52A8\u9009\u62E9\u5E76\u590D\u5236 Prompt\u3002",
|
|
@@ -2826,36 +2821,27 @@ function createStyles(document) {
|
|
|
2826
2821
|
gap: 8px;
|
|
2827
2822
|
flex: none;
|
|
2828
2823
|
}
|
|
2824
|
+
.spotpatch-repository,
|
|
2825
|
+
.spotpatch-locale,
|
|
2826
|
+
.spotpatch-close {
|
|
2827
|
+
height: 30px;
|
|
2828
|
+
border: 1px solid rgb(255 255 255 / 11%);
|
|
2829
|
+
border-radius: 9px;
|
|
2830
|
+
background: rgb(255 255 255 / 4%);
|
|
2831
|
+
}
|
|
2829
2832
|
.spotpatch-repository {
|
|
2830
2833
|
display: inline-flex;
|
|
2831
|
-
height: 30px;
|
|
2832
2834
|
align-items: center;
|
|
2833
|
-
gap: 5px;
|
|
2834
|
-
border: 1px solid rgb(68 202 224 / 20%);
|
|
2835
|
-
border-radius: 9px;
|
|
2836
2835
|
padding: 0 10px;
|
|
2837
2836
|
color: #bcecf2;
|
|
2838
|
-
background: rgb(8 145 178 / 7%);
|
|
2839
2837
|
font-size: 11px;
|
|
2840
2838
|
font-weight: 680;
|
|
2841
2839
|
text-decoration: none;
|
|
2842
|
-
transition: border-color 150ms ease, color 150ms ease, background 150ms ease, transform 150ms ease;
|
|
2843
|
-
}
|
|
2844
|
-
.spotpatch-repository::after { content: "\u2197"; font-size: 10px; }
|
|
2845
|
-
.spotpatch-repository:hover {
|
|
2846
|
-
border-color: rgb(68 202 224 / 42%);
|
|
2847
|
-
color: #e6fbff;
|
|
2848
|
-
background: rgb(8 145 178 / 12%);
|
|
2849
|
-
transform: translateY(-1px);
|
|
2850
2840
|
}
|
|
2851
2841
|
.spotpatch-locale {
|
|
2852
2842
|
min-width: 38px;
|
|
2853
|
-
height: 30px;
|
|
2854
|
-
border: 1px solid rgb(255 255 255 / 11%);
|
|
2855
|
-
border-radius: 9px;
|
|
2856
2843
|
padding: 0 9px;
|
|
2857
2844
|
color: #c5cad5;
|
|
2858
|
-
background: rgb(255 255 255 / 4%);
|
|
2859
2845
|
cursor: pointer;
|
|
2860
2846
|
font-size: 12px;
|
|
2861
2847
|
font-weight: 650;
|
|
@@ -2863,20 +2849,17 @@ function createStyles(document) {
|
|
|
2863
2849
|
.spotpatch-close {
|
|
2864
2850
|
display: inline-grid;
|
|
2865
2851
|
width: 30px;
|
|
2866
|
-
height: 30px;
|
|
2867
2852
|
padding: 0;
|
|
2868
2853
|
place-items: center;
|
|
2869
|
-
border: 1px solid rgb(255 255 255 / 11%);
|
|
2870
|
-
border-radius: 9px;
|
|
2871
2854
|
color: #9da5b4;
|
|
2872
|
-
background: rgb(255 255 255 / 4%);
|
|
2873
2855
|
cursor: pointer;
|
|
2874
2856
|
font-size: 17px;
|
|
2875
2857
|
line-height: 1;
|
|
2876
2858
|
transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
|
|
2877
2859
|
}
|
|
2878
2860
|
.spotpatch-close:hover,
|
|
2879
|
-
.spotpatch-locale:hover
|
|
2861
|
+
.spotpatch-locale:hover,
|
|
2862
|
+
.spotpatch-repository:hover { border-color: rgb(129 112 247 / 45%); color: #fff; background: rgb(109 93 246 / 10%); }
|
|
2880
2863
|
.spotpatch-title {
|
|
2881
2864
|
margin: 0;
|
|
2882
2865
|
color: #fff;
|
|
@@ -2926,10 +2909,14 @@ function createStyles(document) {
|
|
|
2926
2909
|
background: #f59e0b;
|
|
2927
2910
|
content: "";
|
|
2928
2911
|
}
|
|
2929
|
-
.spotpatch-context-state[data-state="ready"]
|
|
2930
|
-
.spotpatch-
|
|
2931
|
-
.spotpatch-context-state[data-state="
|
|
2932
|
-
.spotpatch-
|
|
2912
|
+
.spotpatch-context-state[data-state="ready"],
|
|
2913
|
+
.spotpatch-editor-feedback[data-state="success"] { color: #9fe3c4; }
|
|
2914
|
+
.spotpatch-context-state[data-state="ready"]::before,
|
|
2915
|
+
.spotpatch-editor-feedback[data-state="success"]::before { background: #34d399; }
|
|
2916
|
+
.spotpatch-context-state[data-state="warning"],
|
|
2917
|
+
.spotpatch-editor-feedback[data-state="error"] { color: #fecaca; }
|
|
2918
|
+
.spotpatch-context-state[data-state="warning"]::before,
|
|
2919
|
+
.spotpatch-editor-feedback[data-state="error"]::before { background: #fb7185; }
|
|
2933
2920
|
.spotpatch-body {
|
|
2934
2921
|
min-height: 0;
|
|
2935
2922
|
overflow: auto;
|
|
@@ -3168,29 +3155,9 @@ function createStyles(document) {
|
|
|
3168
3155
|
background: rgb(8 12 22 / 82%);
|
|
3169
3156
|
}
|
|
3170
3157
|
.spotpatch-editor-feedback {
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
align-items: center;
|
|
3174
|
-
gap: 7px;
|
|
3175
|
-
margin-bottom: 1px;
|
|
3176
|
-
color: #9ca5b5;
|
|
3177
|
-
font-size: 11px;
|
|
3178
|
-
line-height: 1.45;
|
|
3158
|
+
flex-basis: 100%;
|
|
3159
|
+
white-space: normal;
|
|
3179
3160
|
}
|
|
3180
|
-
.spotpatch-editor-feedback[hidden] { display: none; }
|
|
3181
|
-
.spotpatch-editor-feedback::before {
|
|
3182
|
-
width: 6px;
|
|
3183
|
-
height: 6px;
|
|
3184
|
-
flex: none;
|
|
3185
|
-
border-radius: 999px;
|
|
3186
|
-
background: #94a3b8;
|
|
3187
|
-
content: "";
|
|
3188
|
-
}
|
|
3189
|
-
.spotpatch-editor-feedback[data-state="opening"]::before { background: #38bdf8; }
|
|
3190
|
-
.spotpatch-editor-feedback[data-state="success"] { color: #9fe3c4; }
|
|
3191
|
-
.spotpatch-editor-feedback[data-state="success"]::before { background: #34d399; }
|
|
3192
|
-
.spotpatch-editor-feedback[data-state="error"] { color: #fecaca; }
|
|
3193
|
-
.spotpatch-editor-feedback[data-state="error"]::before { background: #fb7185; }
|
|
3194
3161
|
.spotpatch-actions button {
|
|
3195
3162
|
display: inline-flex;
|
|
3196
3163
|
min-height: 40px;
|
|
@@ -3256,8 +3223,6 @@ function createStyles(document) {
|
|
|
3256
3223
|
.spotpatch-actions { padding-left: 16px; padding-right: 16px; }
|
|
3257
3224
|
.spotpatch-target-select { grid-template-columns: 32px minmax(0, 1fr); }
|
|
3258
3225
|
.spotpatch-target-state { display: none; }
|
|
3259
|
-
.spotpatch-repository { width: 30px; overflow: hidden; padding: 0; justify-content: center; color: transparent; }
|
|
3260
|
-
.spotpatch-repository::after { color: #bcecf2; content: "\u2197"; }
|
|
3261
3226
|
}
|
|
3262
3227
|
${AGENT_PANEL_STYLES}
|
|
3263
3228
|
`;
|
|
@@ -3267,7 +3232,7 @@ function summaryLine(summary, prefix) {
|
|
|
3267
3232
|
const line = summary.split("\n").find((candidate) => candidate.startsWith(`${prefix}: `));
|
|
3268
3233
|
return line?.slice(prefix.length + 2).trim();
|
|
3269
3234
|
}
|
|
3270
|
-
function createRuntimeView(document, shortcut, ai = Object.freeze({ enabled: false }), localePreference = "auto"
|
|
3235
|
+
function createRuntimeView(document, shortcut, ai = Object.freeze({ enabled: false }), localePreference = "auto") {
|
|
3271
3236
|
const localizer = createUiLocalizer(document, localePreference);
|
|
3272
3237
|
let messages = localizer.messages();
|
|
3273
3238
|
const host = document.createElement("spotpatch-root");
|
|
@@ -3389,17 +3354,14 @@ function createRuntimeView(document, shortcut, ai = Object.freeze({ enabled: fal
|
|
|
3389
3354
|
const actions = createMarkedElement(document, "footer");
|
|
3390
3355
|
actions.className = "spotpatch-actions";
|
|
3391
3356
|
const editorFeedback = createMarkedElement(document, "div");
|
|
3392
|
-
editorFeedback.className = "spotpatch-editor-feedback";
|
|
3357
|
+
editorFeedback.className = "spotpatch-context-state spotpatch-editor-feedback";
|
|
3393
3358
|
editorFeedback.dataset.state = "idle";
|
|
3394
3359
|
editorFeedback.setAttribute("role", "status");
|
|
3395
3360
|
editorFeedback.setAttribute("aria-live", "polite");
|
|
3396
3361
|
editorFeedback.hidden = true;
|
|
3397
3362
|
const addTargetButton = createButton(document, messages.actions.addElement);
|
|
3398
3363
|
const reselectButton = createButton(document, messages.actions.reselect);
|
|
3399
|
-
const openEditorButton = createButton(
|
|
3400
|
-
document,
|
|
3401
|
-
messages.actions.openEditor(editorPreference)
|
|
3402
|
-
);
|
|
3364
|
+
const openEditorButton = createButton(document, messages.actions.openEditor);
|
|
3403
3365
|
const previewButton = createButton(
|
|
3404
3366
|
document,
|
|
3405
3367
|
messages.actions.preview,
|
|
@@ -3447,20 +3409,11 @@ function createRuntimeView(document, shortcut, ai = Object.freeze({ enabled: fal
|
|
|
3447
3409
|
let currentTargets = [];
|
|
3448
3410
|
let currentMaximum = 0;
|
|
3449
3411
|
let currentEditorFeedbackState = "idle";
|
|
3450
|
-
function
|
|
3451
|
-
if (state === "opening") {
|
|
3452
|
-
return messages.announcements.editorOpening(editorPreference);
|
|
3453
|
-
}
|
|
3454
|
-
if (state === "success") {
|
|
3455
|
-
return messages.announcements.editorOpened(editorPreference);
|
|
3456
|
-
}
|
|
3457
|
-
return state === "error" ? messages.announcements.editorFailed(editorPreference) : "";
|
|
3458
|
-
}
|
|
3459
|
-
function renderEditorStatus(state, message = defaultEditorFeedback(state)) {
|
|
3412
|
+
function renderEditorStatus(state) {
|
|
3460
3413
|
currentEditorFeedbackState = state;
|
|
3461
3414
|
editorFeedback.dataset.state = state;
|
|
3462
3415
|
editorFeedback.hidden = state === "idle";
|
|
3463
|
-
editorFeedback.textContent =
|
|
3416
|
+
editorFeedback.textContent = state === "opening" ? messages.announcements.editorOpening : state === "success" ? messages.announcements.editorOpened : state === "error" ? messages.announcements.editorFailed : "";
|
|
3464
3417
|
placeDialog();
|
|
3465
3418
|
}
|
|
3466
3419
|
function statusText(target) {
|
|
@@ -3544,11 +3497,8 @@ function createRuntimeView(document, shortcut, ai = Object.freeze({ enabled: fal
|
|
|
3544
3497
|
const open = createButton(document, "\u2197", "spotpatch-target-open");
|
|
3545
3498
|
open.dataset.openTargetId = target.id;
|
|
3546
3499
|
open.disabled = !target.canOpenEditor;
|
|
3547
|
-
open.setAttribute(
|
|
3548
|
-
|
|
3549
|
-
messages.actions.openTarget(index + 1, editorPreference)
|
|
3550
|
-
);
|
|
3551
|
-
open.title = messages.actions.openTarget(index + 1, editorPreference);
|
|
3500
|
+
open.setAttribute("aria-label", messages.actions.openTarget(index + 1));
|
|
3501
|
+
open.title = messages.actions.openTarget(index + 1);
|
|
3552
3502
|
const remove = createButton(document, "\xD7", "spotpatch-target-remove");
|
|
3553
3503
|
remove.dataset.removeTargetId = target.id;
|
|
3554
3504
|
remove.disabled = !editingEnabled;
|
|
@@ -3746,7 +3696,7 @@ function createRuntimeView(document, shortcut, ai = Object.freeze({ enabled: fal
|
|
|
3746
3696
|
promptOutput.setAttribute("aria-label", messages.diagnostics.promptAriaLabel);
|
|
3747
3697
|
addTargetButton.textContent = messages.actions.addElement;
|
|
3748
3698
|
reselectButton.textContent = messages.actions.reselect;
|
|
3749
|
-
openEditorButton.textContent = messages.actions.openEditor
|
|
3699
|
+
openEditorButton.textContent = messages.actions.openEditor;
|
|
3750
3700
|
previewButton.textContent = messages.actions.preview;
|
|
3751
3701
|
copyButton.textContent = messages.actions.copy;
|
|
3752
3702
|
backButton.textContent = messages.actions.back;
|
|
@@ -4380,13 +4330,7 @@ function resolveBrowserDependencies(dependencies) {
|
|
|
4380
4330
|
}
|
|
4381
4331
|
function createController(config, dependencies = {}) {
|
|
4382
4332
|
const browser = resolveBrowserDependencies(dependencies);
|
|
4383
|
-
const view = dependencies.view ?? createRuntimeView(
|
|
4384
|
-
browser.document,
|
|
4385
|
-
config.shortcut,
|
|
4386
|
-
config.ai,
|
|
4387
|
-
config.locale,
|
|
4388
|
-
config.editor
|
|
4389
|
-
);
|
|
4333
|
+
const view = dependencies.view ?? createRuntimeView(browser.document, config.shortcut, config.ai, config.locale);
|
|
4390
4334
|
const api = dependencies.api ?? createRuntimeApi({
|
|
4391
4335
|
apiBase: config.apiBase,
|
|
4392
4336
|
fetch: browser.window.fetch.bind(browser.window),
|
|
@@ -4925,24 +4869,18 @@ ${summary}`;
|
|
|
4925
4869
|
const selectionRevision = sessionRevision;
|
|
4926
4870
|
const requestRevision = ++editorRequestRevision;
|
|
4927
4871
|
transition({ type: "OPEN_EDITOR" });
|
|
4928
|
-
|
|
4929
|
-
view.renderEditorStatus("opening", openingMessage);
|
|
4930
|
-
view.announce(openingMessage);
|
|
4872
|
+
view.renderEditorStatus("opening");
|
|
4931
4873
|
void api.openEditor({
|
|
4932
4874
|
fileId: marker.fileId,
|
|
4933
4875
|
line: marker.line,
|
|
4934
4876
|
column: marker.column
|
|
4935
|
-
}).then((
|
|
4877
|
+
}).then(() => {
|
|
4936
4878
|
if (mounted && state.status === "selected" && selectionRevision === sessionRevision && requestRevision === editorRequestRevision && activeTargetId === current.id && targets.includes(current)) {
|
|
4937
|
-
|
|
4938
|
-
view.renderEditorStatus("success", message);
|
|
4939
|
-
view.announce(message);
|
|
4879
|
+
view.renderEditorStatus("success");
|
|
4940
4880
|
}
|
|
4941
4881
|
}).catch(() => {
|
|
4942
4882
|
if (mounted && state.status === "selected" && selectionRevision === sessionRevision && requestRevision === editorRequestRevision && activeTargetId === current.id && targets.includes(current)) {
|
|
4943
|
-
|
|
4944
|
-
view.renderEditorStatus("error", message);
|
|
4945
|
-
view.announce(message);
|
|
4883
|
+
view.renderEditorStatus("error");
|
|
4946
4884
|
}
|
|
4947
4885
|
});
|
|
4948
4886
|
}
|