lycheedev 1.0.0 → 1.0.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.
Files changed (50) hide show
  1. package/bin/lycheedev.js +58 -8
  2. package/package.json +1 -1
  3. package/vendor/addon/Core/Bootstrap.lua +131 -131
  4. package/vendor/addon/Core/Clients/Mainline.lua +9 -9
  5. package/vendor/addon/Core/Clients/Mists.lua +9 -9
  6. package/vendor/addon/Core/Clients/Titan.lua +9 -9
  7. package/vendor/addon/Core/Compatibility.lua +43 -43
  8. package/vendor/addon/Core/Database.lua +859 -859
  9. package/vendor/addon/Core/Inspector.lua +647 -647
  10. package/vendor/addon/Core/Locale.lua +307 -307
  11. package/vendor/addon/Core/Locale_enUS.lua +318 -318
  12. package/vendor/addon/Core/Safety.lua +42 -42
  13. package/vendor/addon/Core/Serializer.lua +324 -324
  14. package/vendor/addon/Libs/AutomationQR.lua +1176 -1176
  15. package/vendor/addon/Lychee Dev_Mainline.toc +43 -43
  16. package/vendor/addon/Lychee Dev_Mists.toc +43 -43
  17. package/vendor/addon/Lychee Dev_Wrath.toc +43 -43
  18. package/vendor/addon/Modules/Automation/Controller.lua +757 -757
  19. package/vendor/addon/Modules/Automation/Report.lua +409 -409
  20. package/vendor/addon/Modules/Automation/auto/auto.lua +12 -12
  21. package/vendor/addon/Modules/Diagnostics.lua +238 -238
  22. package/vendor/addon/Modules/Events/Catalog.lua +184 -184
  23. package/vendor/addon/Modules/Events/CatalogData_Mainline.lua +1788 -1788
  24. package/vendor/addon/Modules/Events/CatalogData_Mists.lua +1489 -1489
  25. package/vendor/addon/Modules/Events/CatalogData_Titan.lua +1492 -1492
  26. package/vendor/addon/Modules/Events/Monitor.lua +181 -181
  27. package/vendor/addon/Modules/FunctionTrace.lua +85 -85
  28. package/vendor/addon/Modules/ObjectInspector.lua +329 -329
  29. package/vendor/addon/UI/AutomationOverlay.lua +183 -183
  30. package/vendor/addon/UI/Export.lua +140 -140
  31. package/vendor/addon/UI/Features.lua +890 -890
  32. package/vendor/addon/UI/MainWindow.lua +1145 -1145
  33. package/vendor/addon/UI/Pages/About.lua +223 -223
  34. package/vendor/addon/UI/Pages/Automation.lua +417 -417
  35. package/vendor/addon/UI/Pages/Diagnostics.lua +289 -289
  36. package/vendor/addon/UI/Pages/ExportRecords.lua +387 -387
  37. package/vendor/addon/UI/Pages/Object.lua +573 -573
  38. package/vendor/addon/UI/Pages/Trace.lua +165 -165
  39. package/vendor/skill/SKILL.md +94 -94
  40. package/vendor/skill/agents/openai.yaml +4 -4
  41. package/vendor/skill/references/automation.md +327 -327
  42. package/vendor/skill/references/runtime-investigations.md +97 -97
  43. package/vendor/skill/scripts/automation/__init__.py +1 -1
  44. package/vendor/skill/scripts/automation/registry.py +516 -516
  45. package/vendor/skill/scripts/automation/saved_variables.py +438 -438
  46. package/vendor/skill/scripts/automation/session.py +207 -207
  47. package/vendor/skill/scripts/automation/windows.py +573 -573
  48. package/vendor/skill/scripts/automation.py +865 -865
  49. package/vendor/skill/scripts/requirements.txt +13 -13
  50. package/vendor/skill/scripts/selftest_offline.py +981 -981
@@ -1,387 +1,387 @@
1
- local ADDON_NAME, ns = ...
2
- local L = ns.L
3
-
4
- local ROW_HEIGHT = 58
5
- local LIST_WIDTH = 354
6
-
7
- local KIND_LABELS = {
8
- run_result = L.EXPORT_KIND_RUN_RESULT,
9
- object_snapshot = L.EXPORT_KIND_OBJECT_SNAPSHOT,
10
- object_node = L.EXPORT_KIND_OBJECT_NODE,
11
- event_log = L.EXPORT_KIND_EVENT_LOG,
12
- function_trace = L.EXPORT_KIND_FUNCTION_TRACE,
13
- error_log = L.EXPORT_KIND_ERROR_LOG,
14
- -- Historical evidence remains readable after removal of the performance tools.
15
- performance_snapshot = L.EXPORT_KIND_PERFORMANCE,
16
- performance_health = L.EXPORT_KIND_PERFORMANCE,
17
- performance_capture = L.EXPORT_KIND_PERFORMANCE,
18
- performance_benchmark = L.EXPORT_KIND_PERFORMANCE,
19
- performance_storage = L.EXPORT_KIND_PERFORMANCE,
20
- }
21
-
22
- local function FormatBytes(bytes)
23
- bytes = math.max(0, tonumber(bytes) or 0)
24
- if bytes >= 1024 * 1024 then
25
- return string.format("%.2f MB", bytes / 1024 / 1024)
26
- elseif bytes >= 1024 then
27
- return string.format("%.1f KB", bytes / 1024)
28
- end
29
- return string.format("%d B", bytes)
30
- end
31
-
32
- local function FormatTime(timestamp)
33
- timestamp = tonumber(timestamp) or 0
34
- if timestamp <= 0 then
35
- return L.UNKNOWN
36
- end
37
- return date("%Y-%m-%d %H:%M:%S", timestamp)
38
- end
39
-
40
- local function GetKindLabel(kind)
41
- return KIND_LABELS[kind] or L.EXPORT_KIND_UNKNOWN
42
- end
43
-
44
- local function CreateField(parent, labelText, x, y, width)
45
- local label = parent:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
46
- label:SetPoint("TOPLEFT", x, y)
47
- label:SetText(labelText)
48
- label:SetTextColor(1, 1, 1, 0.34)
49
-
50
- local value = parent:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
51
- value:SetPoint("TOPLEFT", x, y - 20)
52
- value:SetWidth(width)
53
- value:SetJustifyH("LEFT")
54
- value:SetWordWrap(false)
55
- value:SetTextColor(0.91, 0.93, 0.95, 0.92)
56
- return value
57
- end
58
-
59
- function ns.CreateExportRecordsPage(parent, ui)
60
- local page = CreateFrame("Frame", nil, parent)
61
- page:SetAllPoints(parent)
62
-
63
- local selectedTicket
64
- local rows = {}
65
- local deleteConfirmed = false
66
- local clearConfirmed = false
67
-
68
- local heading = ui.CreateSectionLabel(page, L.EXPORT_RECORDS)
69
- heading:SetPoint("TOPLEFT", 17, -84)
70
-
71
- local countText = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
72
- countText:SetPoint("LEFT", heading, "RIGHT", 12, 0)
73
- countText:SetTextColor(1, 1, 1, 0.36)
74
-
75
- local pendingText = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
76
- pendingText:SetPoint("LEFT", countText, "RIGHT", 12, 0)
77
- pendingText:SetTextColor(ui.accentR, ui.accentG, ui.accentB, 0.92)
78
-
79
- local clearButton = ui.CreateButton(page, 120, L.CLEAR_EXPORT_CACHE, false)
80
- clearButton:SetPoint("TOPRIGHT", -14, -77)
81
-
82
- local usageText = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
83
- usageText:SetPoint("RIGHT", clearButton, "LEFT", -12, 0)
84
- usageText:SetTextColor(1, 1, 1, 0.34)
85
-
86
- local listPanel = ui.CreatePanel(page, ui.editorR, ui.editorG, ui.editorB, 0.78)
87
- listPanel:SetPoint("TOPLEFT", 14, -108)
88
- listPanel:SetPoint("BOTTOMLEFT", 14, 54)
89
- listPanel:SetWidth(LIST_WIDTH)
90
-
91
- local listScroll = ui.CreateScrollArea(listPanel, 8, 8, 7, 8)
92
- local listContent = CreateFrame("Frame", nil, listScroll)
93
- listContent:SetWidth(LIST_WIDTH - 26)
94
- listContent:SetHeight(1)
95
- listScroll:SetScrollChild(listContent)
96
-
97
- local emptyTitle = listPanel:CreateFontString(nil, "OVERLAY", "GameFontNormal")
98
- emptyTitle:SetPoint("CENTER", listPanel, "CENTER", 0, 14)
99
- emptyTitle:SetText(L.EXPORT_RECORDS_EMPTY)
100
- emptyTitle:SetTextColor(1, 1, 1, 0.58)
101
-
102
- local emptyHelp = listPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
103
- emptyHelp:SetPoint("TOP", emptyTitle, "BOTTOM", 0, -9)
104
- emptyHelp:SetWidth(270)
105
- emptyHelp:SetJustifyH("CENTER")
106
- emptyHelp:SetText(L.EXPORT_RECORDS_EMPTY_HELP)
107
- emptyHelp:SetTextColor(1, 1, 1, 0.32)
108
-
109
- local detailPanel = CreateFrame("Frame", nil, page)
110
- detailPanel:SetPoint("TOPLEFT", listPanel, "TOPRIGHT", 12, 0)
111
- detailPanel:SetPoint("BOTTOMRIGHT", -14, 54)
112
-
113
- local detailHeading = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontNormal")
114
- detailHeading:SetPoint("TOPLEFT", 4, -4)
115
- detailHeading:SetText(L.EXPORT_RECORD_DETAIL)
116
-
117
- local detailStatus = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
118
- detailStatus:SetPoint("TOPRIGHT", -4, -4)
119
-
120
- local nameValue = CreateField(detailPanel, L.EXPORT_RECORD_NAME, 4, -48, 282)
121
- local kindValue = CreateField(detailPanel, L.EXPORT_RECORD_KIND, 314, -48, 272)
122
- local timeValue = CreateField(detailPanel, L.EXPORT_RECORD_TIME, 4, -106, 282)
123
- local sizeValue = CreateField(detailPanel, L.EXPORT_RECORD_SIZE, 314, -106, 272)
124
- local clientValue = CreateField(detailPanel, L.EXPORT_RECORD_CLIENT, 4, -164, 282)
125
- local pathValue = CreateField(detailPanel, L.EXPORT_RECORD_PATH, 314, -164, 272)
126
-
127
- local ticketLabel = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
128
- ticketLabel:SetPoint("TOPLEFT", 4, -226)
129
- ticketLabel:SetText(L.EXPORT_TICKET)
130
- ticketLabel:SetTextColor(1, 1, 1, 0.34)
131
-
132
- local ticketPanel = ui.CreatePanel(detailPanel, ui.editorR, ui.editorG, ui.editorB, 1)
133
- ticketPanel:SetPoint("TOPLEFT", 4, -247)
134
- ticketPanel:SetPoint("TOPRIGHT", -4, -247)
135
- ticketPanel:SetHeight(40)
136
-
137
- local ticketBox = CreateFrame("EditBox", nil, ticketPanel)
138
- ticketBox:SetPoint("TOPLEFT", 10, -1)
139
- ticketBox:SetPoint("BOTTOMRIGHT", -10, 1)
140
- ticketBox:SetAutoFocus(false)
141
- ticketBox:SetFontObject(ChatFontNormal)
142
- ticketBox:SetTextColor(0.94, 0.95, 0.96)
143
- ticketBox:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
144
-
145
- local ticketHint = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
146
- ticketHint:SetPoint("TOPLEFT", ticketPanel, "BOTTOMLEFT", 1, -10)
147
- ticketHint:SetPoint("RIGHT", -4, 0)
148
- ticketHint:SetJustifyH("LEFT")
149
- ticketHint:SetText(L.EXPORT_TICKET_HELP)
150
- ticketHint:SetTextColor(1, 1, 1, 0.36)
151
-
152
- local deleteButton = ui.CreateButton(detailPanel, 128, L.EXPORT_RECORD_DELETE, false)
153
- deleteButton:SetPoint("BOTTOMLEFT", 4, 4)
154
-
155
- local reloadButton = ui.CreateButton(detailPanel, 110, L.RELOAD_NOW, true)
156
- reloadButton:SetPoint("BOTTOMRIGHT", -4, 4)
157
-
158
- local function ApplyRowState(row)
159
- local selected = row.ticket == selectedTicket
160
- ui.SetListRowState(row, selected, row.hovered)
161
- if selected then
162
- row.title:SetTextColor(1, 1, 1, 0.96)
163
- elseif row.hovered then
164
- row.title:SetTextColor(1, 1, 1, 0.90)
165
- else
166
- row.title:SetTextColor(1, 1, 1, 0.76)
167
- end
168
- end
169
-
170
- local function RefreshDetail()
171
- local entry = selectedTicket and ns.GetExport(selectedTicket) or nil
172
- local hasEntry = entry ~= nil
173
- local source = hasEntry and entry.source or nil
174
- local payload = hasEntry and entry.payload or nil
175
- local environment = hasEntry and entry.environment or nil
176
- local title = source and source.title or ""
177
- local kind = source and source.kind or "unknown"
178
- detailHeading:SetText(hasEntry and (title ~= "" and title or L.EXPORT_RECORD_DETAIL)
179
- or L.EXPORT_RECORD_DETAIL)
180
- local pending = hasEntry and ns.IsExportPending(selectedTicket)
181
- detailStatus:SetText(hasEntry and (pending and L.EXPORT_STATUS_PENDING or L.EXPORT_STATUS_SAVED) or "")
182
- if pending then
183
- detailStatus:SetTextColor(ui.accentR, ui.accentG, ui.accentB, 0.94)
184
- else
185
- detailStatus:SetTextColor(1, 1, 1, 0.36)
186
- end
187
- nameValue:SetText(hasEntry and (title ~= "" and title or L.UNKNOWN) or "")
188
- kindValue:SetText(hasEntry and GetKindLabel(kind) or "")
189
- timeValue:SetText(hasEntry and FormatTime(entry.createdAt) or "")
190
- sizeValue:SetText(hasEntry and FormatBytes(payload and payload.byteCount) or "")
191
- if hasEntry and environment then
192
- local version = environment.version or L.UNKNOWN
193
- local build = environment.build and (" (" .. tostring(environment.build) .. ")") or ""
194
- clientValue:SetText(version .. build)
195
- else
196
- clientValue:SetText("")
197
- end
198
- local path = hasEntry and source and source.path
199
- pathValue:SetText(path and tostring(path) or L.NOT_AVAILABLE)
200
- ticketBox.savedText = hasEntry and selectedTicket or ""
201
- ticketBox.updatingText = true
202
- ticketBox:SetText(ticketBox.savedText)
203
- ticketBox.updatingText = nil
204
- ticketHint:SetText(L.EXPORT_TICKET_HELP)
205
- if hasEntry then
206
- ui.SelectAllText(ticketBox)
207
- else
208
- ticketBox:ClearFocus()
209
- end
210
- ui.SetButtonEnabled(deleteButton, hasEntry)
211
- deleteConfirmed = false
212
- ui.SetButtonText(deleteButton, L.EXPORT_RECORD_DELETE)
213
- ui.SetButtonVariant(deleteButton, "secondary")
214
- end
215
-
216
- local function SelectRecord(ticket)
217
- selectedTicket = ns.GetExport(ticket) and ticket or nil
218
- for index = 1, #rows do
219
- ApplyRowState(rows[index])
220
- end
221
- RefreshDetail()
222
- end
223
-
224
- local function AcquireRow(index)
225
- local row = rows[index]
226
- if row then
227
- return row
228
- end
229
-
230
- row = ui.CreateListRow(listContent, ROW_HEIGHT)
231
- row:SetPoint("TOPLEFT", 0, -(index - 1) * ROW_HEIGHT)
232
- row:SetPoint("TOPRIGHT", 0, -(index - 1) * ROW_HEIGHT)
233
- row:EnableMouseWheel(true)
234
-
235
- local title = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
236
- title:SetPoint("TOPLEFT", 12, -10)
237
- title:SetPoint("TOPRIGHT", -76, -10)
238
- title:SetJustifyH("LEFT")
239
- title:SetWordWrap(false)
240
- row.title = title
241
-
242
- local status = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
243
- status:SetPoint("TOPRIGHT", -10, -10)
244
- status:SetJustifyH("RIGHT")
245
- row.status = status
246
-
247
- local meta = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
248
- meta:SetPoint("BOTTOMLEFT", 12, 9)
249
- meta:SetPoint("BOTTOMRIGHT", -10, 9)
250
- meta:SetJustifyH("LEFT")
251
- meta:SetWordWrap(false)
252
- meta:SetTextColor(1, 1, 1, 0.34)
253
- row.meta = meta
254
-
255
- row:SetScript("OnEnter", function(self)
256
- self.hovered = true
257
- ApplyRowState(self)
258
- end)
259
- row:SetScript("OnLeave", function(self)
260
- self.hovered = nil
261
- ApplyRowState(self)
262
- end)
263
- row:SetScript("OnClick", function(self)
264
- SelectRecord(self.ticket)
265
- end)
266
- row:SetScript("OnMouseWheel", listScroll.onMouseWheel)
267
- rows[index] = row
268
- return row
269
- end
270
-
271
- local function Refresh()
272
- local exports = ns.GetExports()
273
- local order = exports and exports.order or {}
274
- local count, bytes, maximum = ns.GetExportStats()
275
- local pendingCount = ns.GetPendingExportCount()
276
- countText:SetText(string.format(L.EXPORT_RECORD_COUNT, count))
277
- pendingText:SetText(pendingCount > 0 and string.format(L.EXPORT_PENDING_COUNT, pendingCount) or "")
278
- usageText:SetText(string.format(L.EXPORT_STORAGE_USAGE,
279
- bytes / 1024, maximum / 1024 / 1024))
280
- emptyTitle:SetShown(count == 0)
281
- emptyHelp:SetShown(count == 0)
282
- ui.SetButtonEnabled(clearButton, count > 0)
283
-
284
- if clearConfirmed then
285
- clearConfirmed = false
286
- ui.SetButtonText(clearButton, L.CLEAR_EXPORT_CACHE)
287
- ui.SetButtonVariant(clearButton, "secondary")
288
- end
289
-
290
- for index = 1, #order do
291
- local ticket = order[index]
292
- local entry = ns.GetExport(ticket)
293
- local source = entry.source
294
- local payload = entry.payload
295
- local row = AcquireRow(index)
296
- row.ticket = ticket
297
- row.title:SetText(source.title ~= "" and source.title or ticket)
298
- local pending = ns.IsExportPending(ticket)
299
- row.status:SetText(pending and L.EXPORT_STATUS_PENDING or L.EXPORT_STATUS_SAVED)
300
- if pending then
301
- row.status:SetTextColor(ui.accentR, ui.accentG, ui.accentB, 0.92)
302
- else
303
- row.status:SetTextColor(1, 1, 1, 0.30)
304
- end
305
- row.meta:SetText(FormatTime(entry.createdAt) .. " | " .. GetKindLabel(source.kind)
306
- .. " | " .. FormatBytes(payload.byteCount))
307
- row:Show()
308
- end
309
- for index = #order + 1, #rows do
310
- rows[index]:Hide()
311
- end
312
-
313
- listContent:SetHeight(math.max(1, #order * ROW_HEIGHT))
314
- listScroll:UpdateScrollChildRect()
315
- ui.SetButtonEnabled(reloadButton, pendingCount > 0)
316
- if not selectedTicket or not ns.GetExport(selectedTicket) then
317
- selectedTicket = order[1]
318
- end
319
- for index = 1, #rows do
320
- ApplyRowState(rows[index])
321
- end
322
- RefreshDetail()
323
- end
324
-
325
- ticketBox:SetScript("OnTextChanged", function(self)
326
- if not self.updatingText and self:GetText() ~= self.savedText then
327
- self.updatingText = true
328
- self:SetText(self.savedText or "")
329
- self.updatingText = nil
330
- self:HighlightText()
331
- end
332
- end)
333
- ticketBox:SetScript("OnMouseUp", function()
334
- if selectedTicket then
335
- ui.SelectAllText(ticketBox)
336
- end
337
- end)
338
- reloadButton:SetScript("OnClick", function()
339
- if ns.IsCombatBlocked() then
340
- ns.PrintCombatBlocked()
341
- return
342
- end
343
- ReloadUI()
344
- end)
345
- deleteButton:SetScript("OnClick", function()
346
- if not selectedTicket then
347
- return
348
- end
349
- if not deleteConfirmed then
350
- deleteConfirmed = true
351
- ui.SetButtonText(deleteButton, L.EXPORT_RECORD_DELETE_CONFIRM)
352
- ui.SetButtonVariant(deleteButton, "danger")
353
- return
354
- end
355
- ns.DeleteExport(selectedTicket)
356
- selectedTicket = nil
357
- Refresh()
358
- end)
359
- clearButton:SetScript("OnClick", function()
360
- if not clearConfirmed then
361
- clearConfirmed = true
362
- ui.SetButtonText(clearButton, L.CONFIRM_CLEAR_CACHE)
363
- ui.SetButtonVariant(clearButton, "danger")
364
- return
365
- end
366
- ns.ClearExports()
367
- selectedTicket = nil
368
- Refresh()
369
- end)
370
-
371
- page.listScroll = listScroll
372
- page.rows = rows
373
- page.ticketBox = ticketBox
374
- page.ticketHint = ticketHint
375
- page.pendingText = pendingText
376
- page.detailStatus = detailStatus
377
- page.deleteButton = deleteButton
378
- page.clearButton = clearButton
379
- page.reloadButton = reloadButton
380
- page.Refresh = Refresh
381
- page.SelectRecord = SelectRecord
382
- function page:Activate()
383
- Refresh()
384
- end
385
- Refresh()
386
- return page
387
- end
1
+ local ADDON_NAME, ns = ...
2
+ local L = ns.L
3
+
4
+ local ROW_HEIGHT = 58
5
+ local LIST_WIDTH = 354
6
+
7
+ local KIND_LABELS = {
8
+ run_result = L.EXPORT_KIND_RUN_RESULT,
9
+ object_snapshot = L.EXPORT_KIND_OBJECT_SNAPSHOT,
10
+ object_node = L.EXPORT_KIND_OBJECT_NODE,
11
+ event_log = L.EXPORT_KIND_EVENT_LOG,
12
+ function_trace = L.EXPORT_KIND_FUNCTION_TRACE,
13
+ error_log = L.EXPORT_KIND_ERROR_LOG,
14
+ -- Historical evidence remains readable after removal of the performance tools.
15
+ performance_snapshot = L.EXPORT_KIND_PERFORMANCE,
16
+ performance_health = L.EXPORT_KIND_PERFORMANCE,
17
+ performance_capture = L.EXPORT_KIND_PERFORMANCE,
18
+ performance_benchmark = L.EXPORT_KIND_PERFORMANCE,
19
+ performance_storage = L.EXPORT_KIND_PERFORMANCE,
20
+ }
21
+
22
+ local function FormatBytes(bytes)
23
+ bytes = math.max(0, tonumber(bytes) or 0)
24
+ if bytes >= 1024 * 1024 then
25
+ return string.format("%.2f MB", bytes / 1024 / 1024)
26
+ elseif bytes >= 1024 then
27
+ return string.format("%.1f KB", bytes / 1024)
28
+ end
29
+ return string.format("%d B", bytes)
30
+ end
31
+
32
+ local function FormatTime(timestamp)
33
+ timestamp = tonumber(timestamp) or 0
34
+ if timestamp <= 0 then
35
+ return L.UNKNOWN
36
+ end
37
+ return date("%Y-%m-%d %H:%M:%S", timestamp)
38
+ end
39
+
40
+ local function GetKindLabel(kind)
41
+ return KIND_LABELS[kind] or L.EXPORT_KIND_UNKNOWN
42
+ end
43
+
44
+ local function CreateField(parent, labelText, x, y, width)
45
+ local label = parent:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
46
+ label:SetPoint("TOPLEFT", x, y)
47
+ label:SetText(labelText)
48
+ label:SetTextColor(1, 1, 1, 0.34)
49
+
50
+ local value = parent:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
51
+ value:SetPoint("TOPLEFT", x, y - 20)
52
+ value:SetWidth(width)
53
+ value:SetJustifyH("LEFT")
54
+ value:SetWordWrap(false)
55
+ value:SetTextColor(0.91, 0.93, 0.95, 0.92)
56
+ return value
57
+ end
58
+
59
+ function ns.CreateExportRecordsPage(parent, ui)
60
+ local page = CreateFrame("Frame", nil, parent)
61
+ page:SetAllPoints(parent)
62
+
63
+ local selectedTicket
64
+ local rows = {}
65
+ local deleteConfirmed = false
66
+ local clearConfirmed = false
67
+
68
+ local heading = ui.CreateSectionLabel(page, L.EXPORT_RECORDS)
69
+ heading:SetPoint("TOPLEFT", 17, -84)
70
+
71
+ local countText = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
72
+ countText:SetPoint("LEFT", heading, "RIGHT", 12, 0)
73
+ countText:SetTextColor(1, 1, 1, 0.36)
74
+
75
+ local pendingText = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
76
+ pendingText:SetPoint("LEFT", countText, "RIGHT", 12, 0)
77
+ pendingText:SetTextColor(ui.accentR, ui.accentG, ui.accentB, 0.92)
78
+
79
+ local clearButton = ui.CreateButton(page, 120, L.CLEAR_EXPORT_CACHE, false)
80
+ clearButton:SetPoint("TOPRIGHT", -14, -77)
81
+
82
+ local usageText = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
83
+ usageText:SetPoint("RIGHT", clearButton, "LEFT", -12, 0)
84
+ usageText:SetTextColor(1, 1, 1, 0.34)
85
+
86
+ local listPanel = ui.CreatePanel(page, ui.editorR, ui.editorG, ui.editorB, 0.78)
87
+ listPanel:SetPoint("TOPLEFT", 14, -108)
88
+ listPanel:SetPoint("BOTTOMLEFT", 14, 54)
89
+ listPanel:SetWidth(LIST_WIDTH)
90
+
91
+ local listScroll = ui.CreateScrollArea(listPanel, 8, 8, 7, 8)
92
+ local listContent = CreateFrame("Frame", nil, listScroll)
93
+ listContent:SetWidth(LIST_WIDTH - 26)
94
+ listContent:SetHeight(1)
95
+ listScroll:SetScrollChild(listContent)
96
+
97
+ local emptyTitle = listPanel:CreateFontString(nil, "OVERLAY", "GameFontNormal")
98
+ emptyTitle:SetPoint("CENTER", listPanel, "CENTER", 0, 14)
99
+ emptyTitle:SetText(L.EXPORT_RECORDS_EMPTY)
100
+ emptyTitle:SetTextColor(1, 1, 1, 0.58)
101
+
102
+ local emptyHelp = listPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
103
+ emptyHelp:SetPoint("TOP", emptyTitle, "BOTTOM", 0, -9)
104
+ emptyHelp:SetWidth(270)
105
+ emptyHelp:SetJustifyH("CENTER")
106
+ emptyHelp:SetText(L.EXPORT_RECORDS_EMPTY_HELP)
107
+ emptyHelp:SetTextColor(1, 1, 1, 0.32)
108
+
109
+ local detailPanel = CreateFrame("Frame", nil, page)
110
+ detailPanel:SetPoint("TOPLEFT", listPanel, "TOPRIGHT", 12, 0)
111
+ detailPanel:SetPoint("BOTTOMRIGHT", -14, 54)
112
+
113
+ local detailHeading = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontNormal")
114
+ detailHeading:SetPoint("TOPLEFT", 4, -4)
115
+ detailHeading:SetText(L.EXPORT_RECORD_DETAIL)
116
+
117
+ local detailStatus = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
118
+ detailStatus:SetPoint("TOPRIGHT", -4, -4)
119
+
120
+ local nameValue = CreateField(detailPanel, L.EXPORT_RECORD_NAME, 4, -48, 282)
121
+ local kindValue = CreateField(detailPanel, L.EXPORT_RECORD_KIND, 314, -48, 272)
122
+ local timeValue = CreateField(detailPanel, L.EXPORT_RECORD_TIME, 4, -106, 282)
123
+ local sizeValue = CreateField(detailPanel, L.EXPORT_RECORD_SIZE, 314, -106, 272)
124
+ local clientValue = CreateField(detailPanel, L.EXPORT_RECORD_CLIENT, 4, -164, 282)
125
+ local pathValue = CreateField(detailPanel, L.EXPORT_RECORD_PATH, 314, -164, 272)
126
+
127
+ local ticketLabel = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
128
+ ticketLabel:SetPoint("TOPLEFT", 4, -226)
129
+ ticketLabel:SetText(L.EXPORT_TICKET)
130
+ ticketLabel:SetTextColor(1, 1, 1, 0.34)
131
+
132
+ local ticketPanel = ui.CreatePanel(detailPanel, ui.editorR, ui.editorG, ui.editorB, 1)
133
+ ticketPanel:SetPoint("TOPLEFT", 4, -247)
134
+ ticketPanel:SetPoint("TOPRIGHT", -4, -247)
135
+ ticketPanel:SetHeight(40)
136
+
137
+ local ticketBox = CreateFrame("EditBox", nil, ticketPanel)
138
+ ticketBox:SetPoint("TOPLEFT", 10, -1)
139
+ ticketBox:SetPoint("BOTTOMRIGHT", -10, 1)
140
+ ticketBox:SetAutoFocus(false)
141
+ ticketBox:SetFontObject(ChatFontNormal)
142
+ ticketBox:SetTextColor(0.94, 0.95, 0.96)
143
+ ticketBox:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
144
+
145
+ local ticketHint = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
146
+ ticketHint:SetPoint("TOPLEFT", ticketPanel, "BOTTOMLEFT", 1, -10)
147
+ ticketHint:SetPoint("RIGHT", -4, 0)
148
+ ticketHint:SetJustifyH("LEFT")
149
+ ticketHint:SetText(L.EXPORT_TICKET_HELP)
150
+ ticketHint:SetTextColor(1, 1, 1, 0.36)
151
+
152
+ local deleteButton = ui.CreateButton(detailPanel, 128, L.EXPORT_RECORD_DELETE, false)
153
+ deleteButton:SetPoint("BOTTOMLEFT", 4, 4)
154
+
155
+ local reloadButton = ui.CreateButton(detailPanel, 110, L.RELOAD_NOW, true)
156
+ reloadButton:SetPoint("BOTTOMRIGHT", -4, 4)
157
+
158
+ local function ApplyRowState(row)
159
+ local selected = row.ticket == selectedTicket
160
+ ui.SetListRowState(row, selected, row.hovered)
161
+ if selected then
162
+ row.title:SetTextColor(1, 1, 1, 0.96)
163
+ elseif row.hovered then
164
+ row.title:SetTextColor(1, 1, 1, 0.90)
165
+ else
166
+ row.title:SetTextColor(1, 1, 1, 0.76)
167
+ end
168
+ end
169
+
170
+ local function RefreshDetail()
171
+ local entry = selectedTicket and ns.GetExport(selectedTicket) or nil
172
+ local hasEntry = entry ~= nil
173
+ local source = hasEntry and entry.source or nil
174
+ local payload = hasEntry and entry.payload or nil
175
+ local environment = hasEntry and entry.environment or nil
176
+ local title = source and source.title or ""
177
+ local kind = source and source.kind or "unknown"
178
+ detailHeading:SetText(hasEntry and (title ~= "" and title or L.EXPORT_RECORD_DETAIL)
179
+ or L.EXPORT_RECORD_DETAIL)
180
+ local pending = hasEntry and ns.IsExportPending(selectedTicket)
181
+ detailStatus:SetText(hasEntry and (pending and L.EXPORT_STATUS_PENDING or L.EXPORT_STATUS_SAVED) or "")
182
+ if pending then
183
+ detailStatus:SetTextColor(ui.accentR, ui.accentG, ui.accentB, 0.94)
184
+ else
185
+ detailStatus:SetTextColor(1, 1, 1, 0.36)
186
+ end
187
+ nameValue:SetText(hasEntry and (title ~= "" and title or L.UNKNOWN) or "")
188
+ kindValue:SetText(hasEntry and GetKindLabel(kind) or "")
189
+ timeValue:SetText(hasEntry and FormatTime(entry.createdAt) or "")
190
+ sizeValue:SetText(hasEntry and FormatBytes(payload and payload.byteCount) or "")
191
+ if hasEntry and environment then
192
+ local version = environment.version or L.UNKNOWN
193
+ local build = environment.build and (" (" .. tostring(environment.build) .. ")") or ""
194
+ clientValue:SetText(version .. build)
195
+ else
196
+ clientValue:SetText("")
197
+ end
198
+ local path = hasEntry and source and source.path
199
+ pathValue:SetText(path and tostring(path) or L.NOT_AVAILABLE)
200
+ ticketBox.savedText = hasEntry and selectedTicket or ""
201
+ ticketBox.updatingText = true
202
+ ticketBox:SetText(ticketBox.savedText)
203
+ ticketBox.updatingText = nil
204
+ ticketHint:SetText(L.EXPORT_TICKET_HELP)
205
+ if hasEntry then
206
+ ui.SelectAllText(ticketBox)
207
+ else
208
+ ticketBox:ClearFocus()
209
+ end
210
+ ui.SetButtonEnabled(deleteButton, hasEntry)
211
+ deleteConfirmed = false
212
+ ui.SetButtonText(deleteButton, L.EXPORT_RECORD_DELETE)
213
+ ui.SetButtonVariant(deleteButton, "secondary")
214
+ end
215
+
216
+ local function SelectRecord(ticket)
217
+ selectedTicket = ns.GetExport(ticket) and ticket or nil
218
+ for index = 1, #rows do
219
+ ApplyRowState(rows[index])
220
+ end
221
+ RefreshDetail()
222
+ end
223
+
224
+ local function AcquireRow(index)
225
+ local row = rows[index]
226
+ if row then
227
+ return row
228
+ end
229
+
230
+ row = ui.CreateListRow(listContent, ROW_HEIGHT)
231
+ row:SetPoint("TOPLEFT", 0, -(index - 1) * ROW_HEIGHT)
232
+ row:SetPoint("TOPRIGHT", 0, -(index - 1) * ROW_HEIGHT)
233
+ row:EnableMouseWheel(true)
234
+
235
+ local title = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
236
+ title:SetPoint("TOPLEFT", 12, -10)
237
+ title:SetPoint("TOPRIGHT", -76, -10)
238
+ title:SetJustifyH("LEFT")
239
+ title:SetWordWrap(false)
240
+ row.title = title
241
+
242
+ local status = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
243
+ status:SetPoint("TOPRIGHT", -10, -10)
244
+ status:SetJustifyH("RIGHT")
245
+ row.status = status
246
+
247
+ local meta = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
248
+ meta:SetPoint("BOTTOMLEFT", 12, 9)
249
+ meta:SetPoint("BOTTOMRIGHT", -10, 9)
250
+ meta:SetJustifyH("LEFT")
251
+ meta:SetWordWrap(false)
252
+ meta:SetTextColor(1, 1, 1, 0.34)
253
+ row.meta = meta
254
+
255
+ row:SetScript("OnEnter", function(self)
256
+ self.hovered = true
257
+ ApplyRowState(self)
258
+ end)
259
+ row:SetScript("OnLeave", function(self)
260
+ self.hovered = nil
261
+ ApplyRowState(self)
262
+ end)
263
+ row:SetScript("OnClick", function(self)
264
+ SelectRecord(self.ticket)
265
+ end)
266
+ row:SetScript("OnMouseWheel", listScroll.onMouseWheel)
267
+ rows[index] = row
268
+ return row
269
+ end
270
+
271
+ local function Refresh()
272
+ local exports = ns.GetExports()
273
+ local order = exports and exports.order or {}
274
+ local count, bytes, maximum = ns.GetExportStats()
275
+ local pendingCount = ns.GetPendingExportCount()
276
+ countText:SetText(string.format(L.EXPORT_RECORD_COUNT, count))
277
+ pendingText:SetText(pendingCount > 0 and string.format(L.EXPORT_PENDING_COUNT, pendingCount) or "")
278
+ usageText:SetText(string.format(L.EXPORT_STORAGE_USAGE,
279
+ bytes / 1024, maximum / 1024 / 1024))
280
+ emptyTitle:SetShown(count == 0)
281
+ emptyHelp:SetShown(count == 0)
282
+ ui.SetButtonEnabled(clearButton, count > 0)
283
+
284
+ if clearConfirmed then
285
+ clearConfirmed = false
286
+ ui.SetButtonText(clearButton, L.CLEAR_EXPORT_CACHE)
287
+ ui.SetButtonVariant(clearButton, "secondary")
288
+ end
289
+
290
+ for index = 1, #order do
291
+ local ticket = order[index]
292
+ local entry = ns.GetExport(ticket)
293
+ local source = entry.source
294
+ local payload = entry.payload
295
+ local row = AcquireRow(index)
296
+ row.ticket = ticket
297
+ row.title:SetText(source.title ~= "" and source.title or ticket)
298
+ local pending = ns.IsExportPending(ticket)
299
+ row.status:SetText(pending and L.EXPORT_STATUS_PENDING or L.EXPORT_STATUS_SAVED)
300
+ if pending then
301
+ row.status:SetTextColor(ui.accentR, ui.accentG, ui.accentB, 0.92)
302
+ else
303
+ row.status:SetTextColor(1, 1, 1, 0.30)
304
+ end
305
+ row.meta:SetText(FormatTime(entry.createdAt) .. " | " .. GetKindLabel(source.kind)
306
+ .. " | " .. FormatBytes(payload.byteCount))
307
+ row:Show()
308
+ end
309
+ for index = #order + 1, #rows do
310
+ rows[index]:Hide()
311
+ end
312
+
313
+ listContent:SetHeight(math.max(1, #order * ROW_HEIGHT))
314
+ listScroll:UpdateScrollChildRect()
315
+ ui.SetButtonEnabled(reloadButton, pendingCount > 0)
316
+ if not selectedTicket or not ns.GetExport(selectedTicket) then
317
+ selectedTicket = order[1]
318
+ end
319
+ for index = 1, #rows do
320
+ ApplyRowState(rows[index])
321
+ end
322
+ RefreshDetail()
323
+ end
324
+
325
+ ticketBox:SetScript("OnTextChanged", function(self)
326
+ if not self.updatingText and self:GetText() ~= self.savedText then
327
+ self.updatingText = true
328
+ self:SetText(self.savedText or "")
329
+ self.updatingText = nil
330
+ self:HighlightText()
331
+ end
332
+ end)
333
+ ticketBox:SetScript("OnMouseUp", function()
334
+ if selectedTicket then
335
+ ui.SelectAllText(ticketBox)
336
+ end
337
+ end)
338
+ reloadButton:SetScript("OnClick", function()
339
+ if ns.IsCombatBlocked() then
340
+ ns.PrintCombatBlocked()
341
+ return
342
+ end
343
+ ReloadUI()
344
+ end)
345
+ deleteButton:SetScript("OnClick", function()
346
+ if not selectedTicket then
347
+ return
348
+ end
349
+ if not deleteConfirmed then
350
+ deleteConfirmed = true
351
+ ui.SetButtonText(deleteButton, L.EXPORT_RECORD_DELETE_CONFIRM)
352
+ ui.SetButtonVariant(deleteButton, "danger")
353
+ return
354
+ end
355
+ ns.DeleteExport(selectedTicket)
356
+ selectedTicket = nil
357
+ Refresh()
358
+ end)
359
+ clearButton:SetScript("OnClick", function()
360
+ if not clearConfirmed then
361
+ clearConfirmed = true
362
+ ui.SetButtonText(clearButton, L.CONFIRM_CLEAR_CACHE)
363
+ ui.SetButtonVariant(clearButton, "danger")
364
+ return
365
+ end
366
+ ns.ClearExports()
367
+ selectedTicket = nil
368
+ Refresh()
369
+ end)
370
+
371
+ page.listScroll = listScroll
372
+ page.rows = rows
373
+ page.ticketBox = ticketBox
374
+ page.ticketHint = ticketHint
375
+ page.pendingText = pendingText
376
+ page.detailStatus = detailStatus
377
+ page.deleteButton = deleteButton
378
+ page.clearButton = clearButton
379
+ page.reloadButton = reloadButton
380
+ page.Refresh = Refresh
381
+ page.SelectRecord = SelectRecord
382
+ function page:Activate()
383
+ Refresh()
384
+ end
385
+ Refresh()
386
+ return page
387
+ end