lycheedev 1.2.0 → 2.0.1
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/LICENSE +49 -0
- package/README.md +45 -0
- package/THIRD_PARTY_NOTICES +812 -0
- package/bin/lycheedev.mjs +56 -0
- package/native/windows-amd64/lycheedev.exe +0 -0
- package/package.json +12 -33
- package/payload/addon/Bridge/CaptureWriter.lua +154 -0
- package/payload/addon/Bridge/Definitions.lua +3 -0
- package/payload/addon/Bridge/Identity.lua +127 -0
- package/{vendor/addon/Libs/AutomationQR.lua → payload/addon/Bridge/MatrixSymbol.lua} +23 -30
- package/payload/addon/Bridge/ProbeQueue.lua +136 -0
- package/payload/addon/Bridge/ProbeRunner.lua +128 -0
- package/payload/addon/Bridge/ReceiptView.lua +160 -0
- package/payload/addon/Bridge/Reentry.lua +192 -0
- package/payload/addon/Bridge/ReportStore.lua +153 -0
- package/payload/addon/Bridge/Session.lua +163 -0
- package/payload/addon/Clients/Evergreen.lua +2 -0
- package/payload/addon/Clients/Live.lua +2 -0
- package/payload/addon/Clients/Pandaria.lua +2 -0
- package/payload/addon/Clients/Titan.lua +2 -0
- package/payload/addon/Core/Compat.lua +59 -0
- package/payload/addon/Core/Controls.lua +168 -0
- package/{vendor/addon/Core/Bootstrap.lua → payload/addon/Core/Execute.lua} +12 -23
- package/{vendor → payload}/addon/Core/Inspector.lua +19 -235
- package/{vendor → payload}/addon/Core/Locale.lua +128 -93
- package/{vendor → payload}/addon/Core/Locale_enUS.lua +128 -95
- package/payload/addon/Core/Persistence.lua +58 -0
- package/payload/addon/Core/Platform.lua +58 -0
- package/payload/addon/Core/Runtime.lua +25 -0
- package/payload/addon/Core/Safety.lua +56 -0
- package/{vendor → payload}/addon/Core/Serializer.lua +18 -6
- package/payload/addon/Core/Stores.lua +611 -0
- package/payload/addon/Lychee Dev_Forever.toc +52 -0
- package/payload/addon/Lychee Dev_Mainline.toc +52 -0
- package/payload/addon/Lychee Dev_Mists.toc +52 -0
- package/payload/addon/Lychee Dev_Wrath.toc +52 -0
- package/payload/addon/Modules/AutomationView.lua +393 -0
- package/{vendor → payload}/addon/Modules/Diagnostics.lua +92 -36
- package/{vendor → payload}/addon/Modules/Events/Catalog.lua +9 -0
- package/{vendor → payload}/addon/Modules/Events/Monitor.lua +45 -5
- package/payload/addon/Modules/FunctionTrace.lua +150 -0
- package/{vendor → payload}/addon/Modules/ObjectInspector.lua +105 -31
- package/{vendor → payload}/addon/UI/Export.lua +64 -34
- package/{vendor → payload}/addon/UI/Pages/About.lua +26 -14
- package/payload/addon/UI/Pages/Automation.lua +446 -0
- package/payload/addon/UI/Pages/Diagnostics.lua +402 -0
- package/{vendor/addon/UI/Features.lua → payload/addon/UI/Pages/Events.lua} +192 -302
- package/{vendor → payload}/addon/UI/Pages/ExportRecords.lua +213 -132
- package/{vendor → payload}/addon/UI/Pages/Object.lua +229 -121
- package/payload/addon/UI/Pages/Run.lua +423 -0
- package/payload/addon/UI/Pages/Trace.lua +314 -0
- package/payload/addon/UI/TreeView.lua +246 -0
- package/{vendor/addon/UI/MainWindow.lua → payload/addon/UI/Widgets.lua} +89 -529
- package/payload/addon/UI/Window.lua +425 -0
- package/payload/skill/SKILL.md +87 -0
- package/payload/skill/agents/openai.yaml +7 -0
- package/payload/skill/references/addon-validation.md +42 -0
- package/payload/skill/references/asset-export.md +109 -0
- package/payload/skill/references/commands.md +169 -0
- package/payload/skill/references/data-investigation.md +242 -0
- package/payload/skill/references/error-diagnosis.md +41 -0
- package/payload/skill/references/installation.md +18 -0
- package/payload/skill/references/live-investigation.md +129 -0
- package/payload/skill/references/source-research.md +82 -0
- package/payload/skill/scripts/lycheedev.mjs +59 -0
- package/release.json +346 -0
- package/bin/lycheedev.js +0 -746
- package/src/addon.js +0 -95
- package/src/config.js +0 -68
- package/src/doctor.js +0 -126
- package/src/install.js +0 -145
- package/src/paths.js +0 -93
- package/src/py/instances.py +0 -165
- package/src/python.js +0 -111
- package/src/skill.js +0 -48
- package/src/wow.js +0 -541
- package/vendor/addon/Core/Clients/Forever.lua +0 -9
- package/vendor/addon/Core/Clients/Mainline.lua +0 -9
- package/vendor/addon/Core/Clients/Mists.lua +0 -9
- package/vendor/addon/Core/Clients/Titan.lua +0 -9
- package/vendor/addon/Core/Compatibility.lua +0 -43
- package/vendor/addon/Core/Database.lua +0 -859
- package/vendor/addon/Core/Safety.lua +0 -42
- package/vendor/addon/Lychee Dev_Forever.toc +0 -44
- package/vendor/addon/Lychee Dev_Mainline.toc +0 -44
- package/vendor/addon/Lychee Dev_Mists.toc +0 -44
- package/vendor/addon/Lychee Dev_Wrath.toc +0 -44
- package/vendor/addon/Modules/Automation/Controller.lua +0 -896
- package/vendor/addon/Modules/Automation/Reload.lua +0 -101
- package/vendor/addon/Modules/Automation/Report.lua +0 -409
- package/vendor/addon/Modules/Automation/auto/auto.lua +0 -12
- package/vendor/addon/Modules/FunctionTrace.lua +0 -85
- package/vendor/addon/UI/AutomationOverlay.lua +0 -253
- package/vendor/addon/UI/Pages/Automation.lua +0 -417
- package/vendor/addon/UI/Pages/Diagnostics.lua +0 -289
- package/vendor/addon/UI/Pages/Trace.lua +0 -165
- package/vendor/skill/SKILL.md +0 -44
- package/vendor/skill/agents/openai.yaml +0 -4
- package/vendor/skill/references/automation.md +0 -130
- package/vendor/skill/references/clients.md +0 -51
- package/vendor/skill/references/runtime-investigations.md +0 -104
- package/vendor/skill/scripts/automation/__init__.py +0 -1
- package/vendor/skill/scripts/automation/registry.py +0 -516
- package/vendor/skill/scripts/automation/reload.py +0 -121
- package/vendor/skill/scripts/automation/saved_variables.py +0 -438
- package/vendor/skill/scripts/automation/session.py +0 -207
- package/vendor/skill/scripts/automation/windows.py +0 -792
- package/vendor/skill/scripts/automation.py +0 -1067
- package/vendor/skill/scripts/requirements.txt +0 -13
- package/vendor/skill/scripts/selftest_offline.py +0 -1061
- package/vendor/skill/scripts/test_input_safety.py +0 -132
- package/vendor/skill/scripts/test_reload.py +0 -120
- /package/{vendor → payload}/addon/Media/GitHub.png +0 -0
- /package/{vendor → payload}/addon/Media/Logo.png +0 -0
- /package/{vendor → payload}/addon/Modules/Events/CatalogData_Forever.lua +0 -0
- /package/{vendor → payload}/addon/Modules/Events/CatalogData_Mainline.lua +0 -0
- /package/{vendor → payload}/addon/Modules/Events/CatalogData_Mists.lua +0 -0
- /package/{vendor → payload}/addon/Modules/Events/CatalogData_Titan.lua +0 -0
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
local ADDON_NAME, ns = ...
|
|
2
|
+
local L = ns.L
|
|
3
|
+
|
|
4
|
+
-- Run workbench page (key "runner"). Ports the legacy runner sections
|
|
5
|
+
-- (add-on/UI/MainWindow.lua runner paths, Core/Bootstrap.lua semantics) onto
|
|
6
|
+
-- the 2.0 workbench: Lua editor with explicit execution, bounded text/tree
|
|
7
|
+
-- result views, newest-first history rows in the shell-owned rail and a
|
|
8
|
+
-- run_result export through the single shared export hook. Everything is
|
|
9
|
+
-- constructed lazily on the first workbench open: no frames, events, hooks or
|
|
10
|
+
-- timers exist before the first /dev.
|
|
11
|
+
|
|
12
|
+
local Workbench = ns.Workbench
|
|
13
|
+
local Widgets = ns.Widgets
|
|
14
|
+
local TreeView = ns.TreeView
|
|
15
|
+
local Layout = Workbench.Layout
|
|
16
|
+
|
|
17
|
+
-- Layout constants (legacy geometry; the shell owns the 232 px rail).
|
|
18
|
+
local PREVIEW_MAX_CHARS = 22
|
|
19
|
+
local EDITOR_WIDTH = Layout.WINDOW_WIDTH - Layout.CONTENT_LEFT - 58
|
|
20
|
+
local TAB_INDENT = " " -- Tab inserts 4 spaces
|
|
21
|
+
|
|
22
|
+
local READY_R, READY_G, READY_B = 0.55, 0.60, 0.65
|
|
23
|
+
local DONE_R, DONE_G, DONE_B = 0.42, 0.76, 0.43
|
|
24
|
+
local ACCENT_R, ACCENT_G, ACCENT_B = 0.847, 0.231, 0.306
|
|
25
|
+
|
|
26
|
+
local function IsSecret(value)
|
|
27
|
+
return issecretvalue and issecretvalue(value)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
-- Combat refusal at every action entry.
|
|
31
|
+
local function RefuseInCombat()
|
|
32
|
+
if ns.Safety.IsCombatBlocked() then
|
|
33
|
+
ns.Safety.PrintBlocked()
|
|
34
|
+
return true
|
|
35
|
+
end
|
|
36
|
+
return false
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
local function BuildRunPage(parent)
|
|
40
|
+
local colors = Widgets.Colors
|
|
41
|
+
local page = CreateFrame("Frame", nil, parent)
|
|
42
|
+
page:SetAllPoints(parent)
|
|
43
|
+
|
|
44
|
+
-- Session-only live tree cache. Weak keys: restored rows fall back to the
|
|
45
|
+
-- persisted stored tree once the live tree is gone.
|
|
46
|
+
local historyTrees = setmetatable({}, { __mode = "k" })
|
|
47
|
+
local historyButtons = {}
|
|
48
|
+
local selectedHistoryIndex
|
|
49
|
+
local resultMode = "text"
|
|
50
|
+
local currentResultText = ""
|
|
51
|
+
|
|
52
|
+
-- The shell owns the rail panel/scroll/empty label; the page renders rows.
|
|
53
|
+
local rail = Workbench.GetHistoryRail()
|
|
54
|
+
|
|
55
|
+
local inputLabel = Widgets.CreateSectionLabel(page, L.LUA_INPUT)
|
|
56
|
+
inputLabel:SetPoint("TOPLEFT", Layout.CONTENT_LEFT, Layout.HEADING_TOP)
|
|
57
|
+
|
|
58
|
+
local inputPanel = Widgets.CreateTextArea(page, false)
|
|
59
|
+
inputPanel:SetPoint("TOPLEFT", Layout.CONTENT_LEFT, Layout.CONTENT_TOP)
|
|
60
|
+
inputPanel:SetPoint("TOPRIGHT", Layout.CONTENT_RIGHT, Layout.CONTENT_TOP)
|
|
61
|
+
inputPanel:SetHeight(210)
|
|
62
|
+
inputPanel.editBox:SetWidth(EDITOR_WIDTH)
|
|
63
|
+
inputPanel.editBox:SetScript("OnTabPressed", function(self)
|
|
64
|
+
self:Insert(TAB_INDENT)
|
|
65
|
+
end)
|
|
66
|
+
|
|
67
|
+
local actionRow = CreateFrame("Frame", nil, page)
|
|
68
|
+
actionRow:SetPoint("TOPLEFT", inputPanel, "BOTTOMLEFT", 0, -8)
|
|
69
|
+
actionRow:SetPoint("TOPRIGHT", inputPanel, "BOTTOMRIGHT", 0, -8)
|
|
70
|
+
actionRow:SetHeight(30)
|
|
71
|
+
|
|
72
|
+
local runButton = Widgets.CreateButton(actionRow, 96, L.RUN, "primary")
|
|
73
|
+
runButton:SetPoint("RIGHT", actionRow, "RIGHT", 0, 0)
|
|
74
|
+
|
|
75
|
+
local clearInputButton = Widgets.CreateButton(actionRow, 108, L.CLEAR_INPUT, "secondary")
|
|
76
|
+
clearInputButton:SetPoint("RIGHT", runButton, "LEFT", -8, 0)
|
|
77
|
+
|
|
78
|
+
local statusDot = actionRow:CreateTexture(nil, "ARTWORK")
|
|
79
|
+
statusDot:SetSize(5, 5)
|
|
80
|
+
statusDot:SetPoint("LEFT", actionRow, "LEFT", 2, 0)
|
|
81
|
+
|
|
82
|
+
local status = actionRow:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
83
|
+
status:SetPoint("LEFT", statusDot, "RIGHT", 7, 0)
|
|
84
|
+
|
|
85
|
+
local resultLabel = Widgets.CreateSectionLabel(page, L.RESULT)
|
|
86
|
+
resultLabel:SetPoint("TOPLEFT", actionRow, "BOTTOMLEFT", 0, -13)
|
|
87
|
+
|
|
88
|
+
local resultTextTab = Widgets.CreateNavTab(page, L.TEXT)
|
|
89
|
+
Widgets.FitNavTab(resultTextTab, 58, 28)
|
|
90
|
+
resultTextTab:SetPoint("TOPRIGHT", actionRow, "BOTTOMRIGHT", 0, -4)
|
|
91
|
+
|
|
92
|
+
local resultTreeTab = Widgets.CreateNavTab(page, L.TREE)
|
|
93
|
+
Widgets.FitNavTab(resultTreeTab, 58, 28)
|
|
94
|
+
resultTreeTab:SetPoint("RIGHT", resultTextTab, "LEFT", -2, 0)
|
|
95
|
+
|
|
96
|
+
local resultPanel = Widgets.CreateTextArea(page, true)
|
|
97
|
+
resultPanel:SetPoint("TOPLEFT", actionRow, "BOTTOMLEFT", 0, -35)
|
|
98
|
+
resultPanel:SetPoint("BOTTOMRIGHT", Layout.CONTENT_RIGHT, Layout.CONTENT_BOTTOM)
|
|
99
|
+
resultPanel.editBox:SetWidth(EDITOR_WIDTH)
|
|
100
|
+
resultPanel.editBox:SetScript("OnMouseUp", function(self)
|
|
101
|
+
self:SetFocus()
|
|
102
|
+
end)
|
|
103
|
+
|
|
104
|
+
local treeView = TreeView.Create(page, { contentWidth = EDITOR_WIDTH + 30 })
|
|
105
|
+
treeView.panel:SetPoint("TOPLEFT", actionRow, "BOTTOMLEFT", 0, -35)
|
|
106
|
+
treeView.panel:SetPoint("BOTTOMRIGHT", Layout.CONTENT_RIGHT, Layout.CONTENT_BOTTOM)
|
|
107
|
+
|
|
108
|
+
local selectButton = Widgets.CreateButton(page, 118, L.SELECT_RESULT, "secondary")
|
|
109
|
+
selectButton:SetPoint("BOTTOMRIGHT", Layout.CONTENT_RIGHT, 14)
|
|
110
|
+
|
|
111
|
+
local saveButton = Widgets.CreateButton(page, 92, L.SAVE_TO_DISK, "secondary")
|
|
112
|
+
saveButton:SetPoint("RIGHT", selectButton, "LEFT", -8, 0)
|
|
113
|
+
Widgets.SetButtonEnabled(saveButton, false)
|
|
114
|
+
|
|
115
|
+
local clearHistoryButton = Widgets.CreateButton(page, Layout.RAIL_WIDTH, L.CLEAR_HISTORY, "secondary")
|
|
116
|
+
clearHistoryButton:SetPoint("BOTTOMLEFT", Layout.RAIL_LEFT, 14)
|
|
117
|
+
|
|
118
|
+
local function SetStatus(text, red, green, blue)
|
|
119
|
+
status:SetText(text)
|
|
120
|
+
status:SetTextColor(red, green, blue, 0.92)
|
|
121
|
+
statusDot:SetColorTexture(red, green, blue, 0.92)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
local function SetResult(text)
|
|
125
|
+
if IsSecret(text) then
|
|
126
|
+
text = L.TREE_SECRET
|
|
127
|
+
end
|
|
128
|
+
currentResultText = text or ""
|
|
129
|
+
page.currentResultText = currentResultText
|
|
130
|
+
Widgets.SetReadOnlyText(resultPanel, currentResultText)
|
|
131
|
+
Widgets.SetButtonEnabled(saveButton, currentResultText ~= "")
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
local function SetResultMode(mode)
|
|
135
|
+
resultMode = mode
|
|
136
|
+
resultPanel:SetShown(mode == "text")
|
|
137
|
+
treeView.panel:SetShown(mode == "tree")
|
|
138
|
+
selectButton:Show()
|
|
139
|
+
resultTextTab:SetActive(mode == "text")
|
|
140
|
+
resultTreeTab:SetActive(mode == "tree")
|
|
141
|
+
resultTreeTab:SetEnabled(true)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
-- Displayed store values fail open to a visible marker instead of
|
|
145
|
+
-- throwing on secret data.
|
|
146
|
+
local function FormatHistoryEntry(entry)
|
|
147
|
+
local stamp
|
|
148
|
+
if IsSecret(entry.timestamp) then
|
|
149
|
+
stamp = L.UNKNOWN_TIME
|
|
150
|
+
else
|
|
151
|
+
stamp = entry.timestamp and date("%m-%d %H:%M", entry.timestamp) or L.UNKNOWN_TIME
|
|
152
|
+
end
|
|
153
|
+
local firstLine
|
|
154
|
+
if IsSecret(entry.code) then
|
|
155
|
+
firstLine = L.TREE_SECRET
|
|
156
|
+
else
|
|
157
|
+
firstLine = (entry.code or ""):match("([^\r\n]+)") or L.EMPTY_INPUT
|
|
158
|
+
if #firstLine > PREVIEW_MAX_CHARS then
|
|
159
|
+
firstLine = firstLine:sub(1, PREVIEW_MAX_CHARS) .. "..."
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
return stamp, firstLine
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
local function ApplyHistoryButtonStyle(button)
|
|
166
|
+
local selected = button.entryIndex == selectedHistoryIndex
|
|
167
|
+
Widgets.SetListRowState(button, selected, button.isHovered)
|
|
168
|
+
if selected then
|
|
169
|
+
button.time:SetTextColor(1, 1, 1, 0.96)
|
|
170
|
+
button.preview:SetTextColor(1, 1, 1, 0.68)
|
|
171
|
+
elseif button.isHovered then
|
|
172
|
+
button.time:SetTextColor(1, 1, 1, 0.90)
|
|
173
|
+
button.preview:SetTextColor(1, 1, 1, 0.58)
|
|
174
|
+
else
|
|
175
|
+
button.time:SetTextColor(1, 1, 1, 0.68)
|
|
176
|
+
button.preview:SetTextColor(1, 1, 1, 0.42)
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
local function RestoreHistory(index)
|
|
181
|
+
local entry = (ns.Stores.History.Get() or {})[index]
|
|
182
|
+
if not entry then
|
|
183
|
+
return
|
|
184
|
+
end
|
|
185
|
+
selectedHistoryIndex = index
|
|
186
|
+
local code = IsSecret(entry.code) and "" or (entry.code or "")
|
|
187
|
+
inputPanel.editBox:SetText(code)
|
|
188
|
+
SetResult(entry.result or "")
|
|
189
|
+
local valueTree = historyTrees[entry] or entry.tree
|
|
190
|
+
if IsSecret(valueTree) then
|
|
191
|
+
valueTree = nil
|
|
192
|
+
end
|
|
193
|
+
treeView:SetTree(valueTree)
|
|
194
|
+
SetResultMode(valueTree and "tree" or "text")
|
|
195
|
+
local succeeded = not IsSecret(entry.succeeded) and entry.succeeded
|
|
196
|
+
if succeeded then
|
|
197
|
+
SetStatus(L.COMPLETED, DONE_R, DONE_G, DONE_B)
|
|
198
|
+
else
|
|
199
|
+
SetStatus(L.FAILED, ACCENT_R, ACCENT_G, ACCENT_B)
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
local function CreateHistoryButton(index)
|
|
204
|
+
local button = Widgets.CreateListRow(rail.content, rail.rowHeight)
|
|
205
|
+
button:SetWidth(rail.rowWidth)
|
|
206
|
+
button.entryIndex = index
|
|
207
|
+
|
|
208
|
+
local timeLabel = button:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
209
|
+
timeLabel:SetPoint("TOPLEFT", 12, -9)
|
|
210
|
+
timeLabel:SetPoint("TOPRIGHT", -9, -9)
|
|
211
|
+
timeLabel:SetJustifyH("LEFT")
|
|
212
|
+
timeLabel:SetWordWrap(false)
|
|
213
|
+
button.time = timeLabel
|
|
214
|
+
|
|
215
|
+
local preview = button:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
216
|
+
preview:SetPoint("BOTTOMLEFT", 12, 8)
|
|
217
|
+
preview:SetPoint("BOTTOMRIGHT", -9, 8)
|
|
218
|
+
preview:SetJustifyH("LEFT")
|
|
219
|
+
preview:SetWordWrap(false)
|
|
220
|
+
button.preview = preview
|
|
221
|
+
|
|
222
|
+
button:SetScript("OnEnter", function(self)
|
|
223
|
+
self.isHovered = true
|
|
224
|
+
ApplyHistoryButtonStyle(self)
|
|
225
|
+
end)
|
|
226
|
+
button:SetScript("OnLeave", function(self)
|
|
227
|
+
self.isHovered = nil
|
|
228
|
+
ApplyHistoryButtonStyle(self)
|
|
229
|
+
end)
|
|
230
|
+
button:SetScript("OnClick", function(self)
|
|
231
|
+
RestoreHistory(self.entryIndex)
|
|
232
|
+
for historyIndex = 1, #historyButtons do
|
|
233
|
+
ApplyHistoryButtonStyle(historyButtons[historyIndex])
|
|
234
|
+
end
|
|
235
|
+
end)
|
|
236
|
+
button:SetScript("OnMouseWheel", rail.scroll.onMouseWheel)
|
|
237
|
+
|
|
238
|
+
historyButtons[index] = button
|
|
239
|
+
return button
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
local function RefreshHistory()
|
|
243
|
+
local history = ns.Stores.History.Get() or {}
|
|
244
|
+
|
|
245
|
+
for index = 1, #historyButtons do
|
|
246
|
+
historyButtons[index]:Hide()
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
for index = 1, #history do
|
|
250
|
+
local button = historyButtons[index] or CreateHistoryButton(index)
|
|
251
|
+
button.entryIndex = index
|
|
252
|
+
button:ClearAllPoints()
|
|
253
|
+
button:SetPoint("TOPLEFT", 0, -((index - 1) * rail.rowHeight))
|
|
254
|
+
local stamp, preview = FormatHistoryEntry(history[index])
|
|
255
|
+
button.time:SetText(stamp)
|
|
256
|
+
button.preview:SetText(preview)
|
|
257
|
+
ApplyHistoryButtonStyle(button)
|
|
258
|
+
button:Show()
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
rail.content:SetHeight(math.max(1, #history * rail.rowHeight))
|
|
262
|
+
rail.scroll:UpdateScrollChildRect()
|
|
263
|
+
rail.empty:SetShown(#history == 0)
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
local function ApplyRunOutcome(succeeded, resultText, normalizedCode, valueTree, storedTree)
|
|
267
|
+
SetResult(resultText)
|
|
268
|
+
treeView:SetTree(valueTree)
|
|
269
|
+
SetResultMode(valueTree and "tree" or "text")
|
|
270
|
+
local entry = ns.Stores.History.Add(normalizedCode, resultText, succeeded and true or false, storedTree)
|
|
271
|
+
if entry and valueTree then
|
|
272
|
+
historyTrees[entry] = valueTree
|
|
273
|
+
end
|
|
274
|
+
selectedHistoryIndex = 1
|
|
275
|
+
RefreshHistory()
|
|
276
|
+
|
|
277
|
+
if succeeded then
|
|
278
|
+
SetStatus(L.COMPLETED, DONE_R, DONE_G, DONE_B)
|
|
279
|
+
else
|
|
280
|
+
SetStatus(L.FAILED, ACCENT_R, ACCENT_G, ACCENT_B)
|
|
281
|
+
end
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
local function RunInput()
|
|
285
|
+
if RefuseInCombat() then
|
|
286
|
+
return
|
|
287
|
+
end
|
|
288
|
+
local code = inputPanel.editBox:GetText() or ""
|
|
289
|
+
if IsSecret(code) then
|
|
290
|
+
return
|
|
291
|
+
end
|
|
292
|
+
if code:match("^%s*$") then
|
|
293
|
+
-- Empty input is an error presented as data, never a thrown error.
|
|
294
|
+
ApplyRunOutcome(false, L.EMPTY_INPUT, "", nil, nil)
|
|
295
|
+
return
|
|
296
|
+
end
|
|
297
|
+
local succeeded, result, normalizedCode, valueTree, storedTree = ns.Execute(code)
|
|
298
|
+
ApplyRunOutcome(succeeded, result, normalizedCode, valueTree, storedTree)
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
local function ClearInput()
|
|
302
|
+
if RefuseInCombat() then
|
|
303
|
+
return
|
|
304
|
+
end
|
|
305
|
+
inputPanel.editBox:SetText("")
|
|
306
|
+
inputPanel.editBox:SetFocus()
|
|
307
|
+
SetStatus(L.READY, READY_R, READY_G, READY_B)
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
local function SelectResult()
|
|
311
|
+
SetResultMode("text")
|
|
312
|
+
Widgets.SelectAllText(resultPanel)
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
-- Every Save goes through the single shared export hook (SaveFromHook
|
|
316
|
+
-- resolves this page's payload provider and opens the ticket popup).
|
|
317
|
+
local function SaveResult()
|
|
318
|
+
if RefuseInCombat() then
|
|
319
|
+
return
|
|
320
|
+
end
|
|
321
|
+
if currentResultText == "" then
|
|
322
|
+
return
|
|
323
|
+
end
|
|
324
|
+
Workbench.SaveFromHook()
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
local function ClearHistory()
|
|
328
|
+
if RefuseInCombat() then
|
|
329
|
+
return
|
|
330
|
+
end
|
|
331
|
+
ns.Stores.History.Clear()
|
|
332
|
+
wipe(historyTrees)
|
|
333
|
+
selectedHistoryIndex = nil
|
|
334
|
+
SetResult("")
|
|
335
|
+
treeView:SetTree(nil)
|
|
336
|
+
SetResultMode("text")
|
|
337
|
+
SetStatus(L.READY, READY_R, READY_G, READY_B)
|
|
338
|
+
RefreshHistory()
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
runButton:SetScript("OnClick", RunInput)
|
|
342
|
+
clearInputButton:SetScript("OnClick", ClearInput)
|
|
343
|
+
selectButton:SetScript("OnClick", SelectResult)
|
|
344
|
+
saveButton:SetScript("OnClick", SaveResult)
|
|
345
|
+
clearHistoryButton:SetScript("OnClick", ClearHistory)
|
|
346
|
+
resultTextTab:SetScript("OnClick", function()
|
|
347
|
+
SetResultMode("text")
|
|
348
|
+
end)
|
|
349
|
+
resultTreeTab:SetScript("OnClick", function()
|
|
350
|
+
SetResultMode("tree")
|
|
351
|
+
end)
|
|
352
|
+
|
|
353
|
+
SetResult("")
|
|
354
|
+
treeView:SetTree(nil)
|
|
355
|
+
SetStatus(L.READY, READY_R, READY_G, READY_B)
|
|
356
|
+
RefreshHistory()
|
|
357
|
+
SetResultMode("text")
|
|
358
|
+
|
|
359
|
+
page.inputPanel = inputPanel
|
|
360
|
+
page.runButton = runButton
|
|
361
|
+
page.clearInputButton = clearInputButton
|
|
362
|
+
page.statusDot = statusDot
|
|
363
|
+
page.status = status
|
|
364
|
+
page.resultLabel = resultLabel
|
|
365
|
+
page.resultTextTab = resultTextTab
|
|
366
|
+
page.resultTreeTab = resultTreeTab
|
|
367
|
+
page.resultPanel = resultPanel
|
|
368
|
+
page.treeView = treeView
|
|
369
|
+
page.selectButton = selectButton
|
|
370
|
+
page.saveButton = saveButton
|
|
371
|
+
page.exportResultButton = saveButton
|
|
372
|
+
page.clearHistoryButton = clearHistoryButton
|
|
373
|
+
page.historyButtons = historyButtons
|
|
374
|
+
page.rail = rail
|
|
375
|
+
page.RefreshHistory = RefreshHistory
|
|
376
|
+
page.RunInput = RunInput
|
|
377
|
+
page.SetResultMode = SetResultMode
|
|
378
|
+
page.RestoreHistory = RestoreHistory
|
|
379
|
+
function page:GetResultMode()
|
|
380
|
+
return resultMode
|
|
381
|
+
end
|
|
382
|
+
function page:GetResultText()
|
|
383
|
+
return currentResultText
|
|
384
|
+
end
|
|
385
|
+
function page:GetSelectedHistoryIndex()
|
|
386
|
+
return selectedHistoryIndex
|
|
387
|
+
end
|
|
388
|
+
return page
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
-- The run_result payload provider for the one shared export hook.
|
|
392
|
+
Workbench.RegisterExportHook{
|
|
393
|
+
key = "runner",
|
|
394
|
+
GetPayload = function()
|
|
395
|
+
local page = Workbench.GetPage("runner")
|
|
396
|
+
if not page or page:GetResultText() == "" then
|
|
397
|
+
return nil
|
|
398
|
+
end
|
|
399
|
+
return "run_result", L.RESULT, page:GetResultText(), {
|
|
400
|
+
code = page.inputPanel.editBox:GetText(),
|
|
401
|
+
}
|
|
402
|
+
end,
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
Workbench.RegisterPage{
|
|
406
|
+
key = "runner",
|
|
407
|
+
titleKey = "TAB_RUNNER",
|
|
408
|
+
rail = true,
|
|
409
|
+
build = BuildRunPage,
|
|
410
|
+
activate = function(page)
|
|
411
|
+
page.RefreshHistory()
|
|
412
|
+
page.inputPanel.editBox:SetFocus()
|
|
413
|
+
end,
|
|
414
|
+
suspend = function(page)
|
|
415
|
+
page.inputPanel.editBox:ClearFocus()
|
|
416
|
+
end,
|
|
417
|
+
-- Window hide / combat teardown: release focus and transient presentation
|
|
418
|
+
-- state. The page owns no events or timers.
|
|
419
|
+
shutdown = function(page)
|
|
420
|
+
page.inputPanel.editBox:ClearFocus()
|
|
421
|
+
page.resultPanel.editBox:ClearFocus()
|
|
422
|
+
end,
|
|
423
|
+
}
|