lycheedev 1.1.1 → 2.0.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.
Files changed (115) hide show
  1. package/LICENSE +49 -0
  2. package/README.md +45 -0
  3. package/THIRD_PARTY_NOTICES +812 -0
  4. package/bin/lycheedev.mjs +56 -0
  5. package/native/windows-amd64/lycheedev.exe +0 -0
  6. package/package.json +12 -33
  7. package/payload/addon/Bridge/CaptureWriter.lua +154 -0
  8. package/payload/addon/Bridge/Definitions.lua +3 -0
  9. package/payload/addon/Bridge/Identity.lua +127 -0
  10. package/{vendor/addon/Libs/AutomationQR.lua → payload/addon/Bridge/MatrixSymbol.lua} +23 -30
  11. package/payload/addon/Bridge/ProbeQueue.lua +136 -0
  12. package/payload/addon/Bridge/ProbeRunner.lua +128 -0
  13. package/payload/addon/Bridge/ReceiptView.lua +160 -0
  14. package/payload/addon/Bridge/Reentry.lua +192 -0
  15. package/payload/addon/Bridge/ReportStore.lua +153 -0
  16. package/payload/addon/Bridge/Session.lua +163 -0
  17. package/payload/addon/Clients/Evergreen.lua +2 -0
  18. package/payload/addon/Clients/Live.lua +2 -0
  19. package/payload/addon/Clients/Pandaria.lua +2 -0
  20. package/payload/addon/Clients/Titan.lua +2 -0
  21. package/payload/addon/Core/Compat.lua +59 -0
  22. package/payload/addon/Core/Controls.lua +168 -0
  23. package/{vendor/addon/Core/Bootstrap.lua → payload/addon/Core/Execute.lua} +12 -23
  24. package/{vendor → payload}/addon/Core/Inspector.lua +19 -235
  25. package/{vendor → payload}/addon/Core/Locale.lua +129 -94
  26. package/{vendor → payload}/addon/Core/Locale_enUS.lua +129 -96
  27. package/payload/addon/Core/Persistence.lua +58 -0
  28. package/payload/addon/Core/Platform.lua +58 -0
  29. package/payload/addon/Core/Runtime.lua +25 -0
  30. package/payload/addon/Core/Safety.lua +56 -0
  31. package/{vendor → payload}/addon/Core/Serializer.lua +18 -6
  32. package/payload/addon/Core/Stores.lua +611 -0
  33. package/payload/addon/Lychee Dev_Forever.toc +52 -0
  34. package/payload/addon/Lychee Dev_Mainline.toc +52 -0
  35. package/payload/addon/Lychee Dev_Mists.toc +52 -0
  36. package/payload/addon/Lychee Dev_Wrath.toc +52 -0
  37. package/payload/addon/Modules/AutomationView.lua +393 -0
  38. package/{vendor → payload}/addon/Modules/Diagnostics.lua +92 -36
  39. package/{vendor → payload}/addon/Modules/Events/Catalog.lua +9 -0
  40. package/{vendor → payload}/addon/Modules/Events/Monitor.lua +45 -5
  41. package/payload/addon/Modules/FunctionTrace.lua +150 -0
  42. package/{vendor → payload}/addon/Modules/ObjectInspector.lua +105 -31
  43. package/{vendor → payload}/addon/UI/Export.lua +64 -34
  44. package/{vendor → payload}/addon/UI/Pages/About.lua +26 -14
  45. package/payload/addon/UI/Pages/Automation.lua +446 -0
  46. package/payload/addon/UI/Pages/Diagnostics.lua +402 -0
  47. package/{vendor/addon/UI/Features.lua → payload/addon/UI/Pages/Events.lua} +192 -302
  48. package/{vendor → payload}/addon/UI/Pages/ExportRecords.lua +213 -132
  49. package/{vendor → payload}/addon/UI/Pages/Object.lua +229 -121
  50. package/payload/addon/UI/Pages/Run.lua +423 -0
  51. package/payload/addon/UI/Pages/Trace.lua +314 -0
  52. package/payload/addon/UI/TreeView.lua +246 -0
  53. package/{vendor/addon/UI/MainWindow.lua → payload/addon/UI/Widgets.lua} +89 -529
  54. package/payload/addon/UI/Window.lua +425 -0
  55. package/payload/skill/SKILL.md +87 -0
  56. package/payload/skill/agents/openai.yaml +7 -0
  57. package/payload/skill/references/addon-validation.md +42 -0
  58. package/payload/skill/references/asset-export.md +109 -0
  59. package/payload/skill/references/commands.md +169 -0
  60. package/payload/skill/references/data-investigation.md +242 -0
  61. package/payload/skill/references/error-diagnosis.md +41 -0
  62. package/payload/skill/references/installation.md +18 -0
  63. package/payload/skill/references/live-investigation.md +129 -0
  64. package/payload/skill/references/source-research.md +82 -0
  65. package/payload/skill/scripts/lycheedev.mjs +59 -0
  66. package/release.json +346 -0
  67. package/bin/lycheedev.js +0 -742
  68. package/src/addon.js +0 -95
  69. package/src/config.js +0 -68
  70. package/src/doctor.js +0 -126
  71. package/src/install.js +0 -145
  72. package/src/paths.js +0 -93
  73. package/src/py/instances.py +0 -165
  74. package/src/python.js +0 -111
  75. package/src/skill.js +0 -48
  76. package/src/wow.js +0 -541
  77. package/vendor/addon/Core/Clients/Forever.lua +0 -9
  78. package/vendor/addon/Core/Clients/Mainline.lua +0 -9
  79. package/vendor/addon/Core/Clients/Mists.lua +0 -9
  80. package/vendor/addon/Core/Clients/Titan.lua +0 -9
  81. package/vendor/addon/Core/Compatibility.lua +0 -43
  82. package/vendor/addon/Core/Database.lua +0 -859
  83. package/vendor/addon/Core/Safety.lua +0 -42
  84. package/vendor/addon/Lychee Dev_Forever.toc +0 -43
  85. package/vendor/addon/Lychee Dev_Mainline.toc +0 -43
  86. package/vendor/addon/Lychee Dev_Mists.toc +0 -43
  87. package/vendor/addon/Lychee Dev_Wrath.toc +0 -43
  88. package/vendor/addon/Modules/Automation/Controller.lua +0 -884
  89. package/vendor/addon/Modules/Automation/Report.lua +0 -409
  90. package/vendor/addon/Modules/Automation/auto/auto.lua +0 -12
  91. package/vendor/addon/Modules/FunctionTrace.lua +0 -85
  92. package/vendor/addon/UI/AutomationOverlay.lua +0 -253
  93. package/vendor/addon/UI/Pages/Automation.lua +0 -417
  94. package/vendor/addon/UI/Pages/Diagnostics.lua +0 -289
  95. package/vendor/addon/UI/Pages/Trace.lua +0 -165
  96. package/vendor/skill/SKILL.md +0 -42
  97. package/vendor/skill/agents/openai.yaml +0 -4
  98. package/vendor/skill/references/automation.md +0 -128
  99. package/vendor/skill/references/clients.md +0 -51
  100. package/vendor/skill/references/runtime-investigations.md +0 -104
  101. package/vendor/skill/scripts/automation/__init__.py +0 -1
  102. package/vendor/skill/scripts/automation/registry.py +0 -516
  103. package/vendor/skill/scripts/automation/saved_variables.py +0 -438
  104. package/vendor/skill/scripts/automation/session.py +0 -207
  105. package/vendor/skill/scripts/automation/windows.py +0 -792
  106. package/vendor/skill/scripts/automation.py +0 -1034
  107. package/vendor/skill/scripts/requirements.txt +0 -13
  108. package/vendor/skill/scripts/selftest_offline.py +0 -1061
  109. package/vendor/skill/scripts/test_input_safety.py +0 -132
  110. /package/{vendor → payload}/addon/Media/GitHub.png +0 -0
  111. /package/{vendor → payload}/addon/Media/Logo.png +0 -0
  112. /package/{vendor → payload}/addon/Modules/Events/CatalogData_Forever.lua +0 -0
  113. /package/{vendor → payload}/addon/Modules/Events/CatalogData_Mainline.lua +0 -0
  114. /package/{vendor → payload}/addon/Modules/Events/CatalogData_Mists.lua +0 -0
  115. /package/{vendor → payload}/addon/Modules/Events/CatalogData_Titan.lua +0 -0
@@ -1,6 +1,17 @@
1
1
  local ADDON_NAME, ns = ...
2
2
  local L = ns.L
3
3
 
4
+ -- Saved Records workbench page (key "exports"). Ports
5
+ -- add-on/UI/Pages/ExportRecords.lua: a newest-first record list with
6
+ -- pending/saved badges, storage stats, a detail pane with a rewrite-guarded
7
+ -- pre-selected ticket box (copy = select + Ctrl+C) and delete / reload /
8
+ -- cache-clear actions over the shared export store. Constructed lazily on the
9
+ -- first workbench open.
10
+
11
+ local Workbench = ns.Workbench
12
+ local Widgets = ns.Widgets
13
+ local Layout = Workbench.Layout
14
+
4
15
  local ROW_HEIGHT = 58
5
16
  local LIST_WIDTH = 354
6
17
 
@@ -11,7 +22,9 @@ local KIND_LABELS = {
11
22
  event_log = L.EXPORT_KIND_EVENT_LOG,
12
23
  function_trace = L.EXPORT_KIND_FUNCTION_TRACE,
13
24
  error_log = L.EXPORT_KIND_ERROR_LOG,
14
- -- Historical evidence remains readable after removal of the performance tools.
25
+ automation_result = L.EXPORT_KIND_AUTOMATION_RESULT,
26
+ -- Historical evidence remains readable after the tool that produced it is
27
+ -- gone; unknown legacy kinds fall back to the generic label below.
15
28
  performance_snapshot = L.EXPORT_KIND_PERFORMANCE,
16
29
  performance_health = L.EXPORT_KIND_PERFORMANCE,
17
30
  performance_capture = L.EXPORT_KIND_PERFORMANCE,
@@ -19,7 +32,32 @@ local KIND_LABELS = {
19
32
  performance_storage = L.EXPORT_KIND_PERFORMANCE,
20
33
  }
21
34
 
35
+ local function IsSecret(value)
36
+ return issecretvalue and issecretvalue(value)
37
+ end
38
+
39
+ -- Displayed values coming from stored records fail open to a visible marker
40
+ -- instead of throwing on secret data.
41
+ local function SafeText(value, fallback)
42
+ if value == nil or IsSecret(value) then
43
+ return fallback
44
+ end
45
+ return tostring(value)
46
+ end
47
+
48
+ -- Combat refusal at every action entry.
49
+ local function RefuseInCombat()
50
+ if ns.Safety.IsCombatBlocked() then
51
+ ns.Safety.PrintBlocked()
52
+ return true
53
+ end
54
+ return false
55
+ end
56
+
22
57
  local function FormatBytes(bytes)
58
+ if IsSecret(bytes) then
59
+ return L.UNKNOWN
60
+ end
23
61
  bytes = math.max(0, tonumber(bytes) or 0)
24
62
  if bytes >= 1024 * 1024 then
25
63
  return string.format("%.2f MB", bytes / 1024 / 1024)
@@ -30,6 +68,9 @@ local function FormatBytes(bytes)
30
68
  end
31
69
 
32
70
  local function FormatTime(timestamp)
71
+ if IsSecret(timestamp) then
72
+ return L.UNKNOWN
73
+ end
33
74
  timestamp = tonumber(timestamp) or 0
34
75
  if timestamp <= 0 then
35
76
  return L.UNKNOWN
@@ -38,6 +79,9 @@ local function FormatTime(timestamp)
38
79
  end
39
80
 
40
81
  local function GetKindLabel(kind)
82
+ if IsSecret(kind) then
83
+ return L.EXPORT_KIND_UNKNOWN
84
+ end
41
85
  return KIND_LABELS[kind] or L.EXPORT_KIND_UNKNOWN
42
86
  end
43
87
 
@@ -56,17 +100,25 @@ local function CreateField(parent, labelText, x, y, width)
56
100
  return value
57
101
  end
58
102
 
59
- function ns.CreateExportRecordsPage(parent, ui)
103
+ local function BuildExportRecordsPage(parent)
104
+ local colors = Widgets.Colors
60
105
  local page = CreateFrame("Frame", nil, parent)
61
106
  page:SetAllPoints(parent)
62
107
 
63
108
  local selectedTicket
64
109
  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)
110
+ -- Forward declarations: the actions, refreshers and row factory reference
111
+ -- each other through closures.
112
+ local ConfirmDelete
113
+ local ConfirmClear
114
+ local ApplyRowState
115
+ local RefreshDetail
116
+ local Refresh
117
+ local SelectRecord
118
+ local AcquireRow
119
+
120
+ local heading = Widgets.CreateSectionLabel(page, L.EXPORT_RECORDS)
121
+ heading:SetPoint("TOPLEFT", Layout.PAGE_LEFT, Layout.HEADING_TOP)
70
122
 
71
123
  local countText = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
72
124
  countText:SetPoint("LEFT", heading, "RIGHT", 12, 0)
@@ -74,21 +126,18 @@ function ns.CreateExportRecordsPage(parent, ui)
74
126
 
75
127
  local pendingText = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
76
128
  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)
129
+ pendingText:SetTextColor(colors.accent[1], colors.accent[2], colors.accent[3], 0.92)
81
130
 
82
131
  local usageText = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
83
- usageText:SetPoint("RIGHT", clearButton, "LEFT", -12, 0)
132
+ usageText:SetPoint("TOPRIGHT", Layout.CONTENT_RIGHT - 132, Layout.HEADING_TOP + 3)
84
133
  usageText:SetTextColor(1, 1, 1, 0.34)
85
134
 
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)
135
+ local listPanel = Widgets.CreatePanel(page, colors.editor[1], colors.editor[2], colors.editor[3], 0.78)
136
+ listPanel:SetPoint("TOPLEFT", Layout.RAIL_LEFT, Layout.CONTENT_TOP - 4)
137
+ listPanel:SetPoint("BOTTOMLEFT", Layout.RAIL_LEFT, Layout.CONTENT_BOTTOM)
89
138
  listPanel:SetWidth(LIST_WIDTH)
90
139
 
91
- local listScroll = ui.CreateScrollArea(listPanel, 8, 8, 7, 8)
140
+ local listScroll = Widgets.CreateScrollArea(listPanel, 8, 8, 7, 8)
92
141
  local listContent = CreateFrame("Frame", nil, listScroll)
93
142
  listContent:SetWidth(LIST_WIDTH - 26)
94
143
  listContent:SetHeight(1)
@@ -108,7 +157,7 @@ function ns.CreateExportRecordsPage(parent, ui)
108
157
 
109
158
  local detailPanel = CreateFrame("Frame", nil, page)
110
159
  detailPanel:SetPoint("TOPLEFT", listPanel, "TOPRIGHT", 12, 0)
111
- detailPanel:SetPoint("BOTTOMRIGHT", -14, 54)
160
+ detailPanel:SetPoint("BOTTOMRIGHT", Layout.CONTENT_RIGHT, Layout.CONTENT_BOTTOM)
112
161
 
113
162
  local detailHeading = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontNormal")
114
163
  detailHeading:SetPoint("TOPLEFT", 4, -4)
@@ -129,7 +178,7 @@ function ns.CreateExportRecordsPage(parent, ui)
129
178
  ticketLabel:SetText(L.EXPORT_TICKET)
130
179
  ticketLabel:SetTextColor(1, 1, 1, 0.34)
131
180
 
132
- local ticketPanel = ui.CreatePanel(detailPanel, ui.editorR, ui.editorG, ui.editorB, 1)
181
+ local ticketPanel = Widgets.CreatePanel(detailPanel, colors.editor[1], colors.editor[2], colors.editor[3], 1)
133
182
  ticketPanel:SetPoint("TOPLEFT", 4, -247)
134
183
  ticketPanel:SetPoint("TOPRIGHT", -4, -247)
135
184
  ticketPanel:SetHeight(40)
@@ -140,7 +189,11 @@ function ns.CreateExportRecordsPage(parent, ui)
140
189
  ticketBox:SetAutoFocus(false)
141
190
  ticketBox:SetFontObject(ChatFontNormal)
142
191
  ticketBox:SetTextColor(0.94, 0.95, 0.96)
143
- ticketBox:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
192
+ ticketBox.savedText = ""
193
+ ticketBox.updatingText = false
194
+ ticketBox:SetScript("OnEscapePressed", function(self)
195
+ self:ClearFocus()
196
+ end)
144
197
 
145
198
  local ticketHint = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
146
199
  ticketHint:SetPoint("TOPLEFT", ticketPanel, "BOTTOMLEFT", 1, -10)
@@ -149,15 +202,43 @@ function ns.CreateExportRecordsPage(parent, ui)
149
202
  ticketHint:SetText(L.EXPORT_TICKET_HELP)
150
203
  ticketHint:SetTextColor(1, 1, 1, 0.36)
151
204
 
152
- local deleteButton = ui.CreateButton(detailPanel, 128, L.EXPORT_RECORD_DELETE, false)
205
+ ConfirmDelete = function()
206
+ if RefuseInCombat() then
207
+ return
208
+ end
209
+ if not selectedTicket or IsSecret(selectedTicket) then
210
+ return
211
+ end
212
+ ns.Stores.Exports.Delete(selectedTicket)
213
+ selectedTicket = nil
214
+ Refresh()
215
+ end
216
+
217
+ ConfirmClear = function()
218
+ if RefuseInCombat() then
219
+ return
220
+ end
221
+ ns.Stores.Exports.Clear()
222
+ selectedTicket = nil
223
+ Refresh()
224
+ end
225
+
226
+ -- Two-click confirmation widgets: the first click arms (confirm label +
227
+ -- danger variant), the second runs the destructive action.
228
+ local deleteButton = Widgets.CreateConfirmButton(detailPanel, 128,
229
+ L.EXPORT_RECORD_DELETE, L.EXPORT_RECORD_DELETE_CONFIRM, ConfirmDelete, "secondary")
153
230
  deleteButton:SetPoint("BOTTOMLEFT", 4, 4)
154
231
 
155
- local reloadButton = ui.CreateButton(detailPanel, 110, L.RELOAD_NOW, true)
232
+ local clearButton = Widgets.CreateConfirmButton(page, 120,
233
+ L.CLEAR_EXPORT_CACHE, L.CONFIRM_CLEAR_CACHE, ConfirmClear, "secondary")
234
+ clearButton:SetPoint("TOPRIGHT", Layout.CONTENT_RIGHT, Layout.HEADING_TOP + 7)
235
+
236
+ local reloadButton = Widgets.CreateButton(detailPanel, 110, L.RELOAD_NOW, "primary")
156
237
  reloadButton:SetPoint("BOTTOMRIGHT", -4, 4)
157
238
 
158
- local function ApplyRowState(row)
159
- local selected = row.ticket == selectedTicket
160
- ui.SetListRowState(row, selected, row.hovered)
239
+ ApplyRowState = function(row)
240
+ local selected = not IsSecret(row.ticket) and row.ticket == selectedTicket
241
+ Widgets.SetListRowState(row, selected, row.hovered)
161
242
  if selected then
162
243
  row.title:SetTextColor(1, 1, 1, 0.96)
163
244
  elseif row.hovered then
@@ -167,20 +248,74 @@ function ns.CreateExportRecordsPage(parent, ui)
167
248
  end
168
249
  end
169
250
 
170
- local function RefreshDetail()
171
- local entry = selectedTicket and ns.GetExport(selectedTicket) or nil
251
+ Refresh = function()
252
+ local order = ns.Stores.Exports.GetOrder() or {}
253
+ local count, bytes, maximum = ns.Stores.Exports.GetStats()
254
+ local pendingCount = ns.Stores.Exports.GetPendingCount()
255
+ countText:SetText(string.format(L.EXPORT_RECORD_COUNT, count))
256
+ pendingText:SetText(pendingCount > 0 and string.format(L.EXPORT_PENDING_COUNT, pendingCount) or "")
257
+ usageText:SetText(string.format(L.EXPORT_STORAGE_USAGE,
258
+ bytes / 1024, maximum / 1024 / 1024))
259
+ emptyTitle:SetShown(count == 0)
260
+ emptyHelp:SetShown(count == 0)
261
+ Widgets.SetButtonEnabled(clearButton, count > 0)
262
+ clearButton:ResetConfirm()
263
+
264
+ for index = 1, #order do
265
+ local ticket = order[index]
266
+ if IsSecret(ticket) then
267
+ ticket = nil
268
+ end
269
+ local entry = ticket and ns.Stores.Exports.Get(ticket) or nil
270
+ local source = entry and entry.source or nil
271
+ local payload = entry and entry.payload or nil
272
+ local row = rows[index] or AcquireRow(index)
273
+ row.ticket = ticket
274
+ local title = source and SafeText(source.title, "") or ""
275
+ row.title:SetText(title ~= "" and title or SafeText(ticket, L.UNKNOWN))
276
+ local pending = ticket ~= nil and ns.Stores.Exports.IsPending(ticket)
277
+ row.status:SetText(pending and L.EXPORT_STATUS_PENDING or L.EXPORT_STATUS_SAVED)
278
+ if pending then
279
+ row.status:SetTextColor(colors.accent[1], colors.accent[2], colors.accent[3], 0.92)
280
+ else
281
+ row.status:SetTextColor(1, 1, 1, 0.30)
282
+ end
283
+ row.meta:SetText(FormatTime(entry and entry.createdAt) .. " | "
284
+ .. GetKindLabel(source and source.kind)
285
+ .. " | " .. FormatBytes(payload and payload.byteCount))
286
+ row:Show()
287
+ end
288
+ for index = #order + 1, #rows do
289
+ rows[index]:Hide()
290
+ end
291
+
292
+ listContent:SetHeight(math.max(1, #order * ROW_HEIGHT))
293
+ listScroll:UpdateScrollChildRect()
294
+ Widgets.SetButtonEnabled(reloadButton, pendingCount > 0)
295
+ local newest = order[1]
296
+ if not selectedTicket or not ns.Stores.Exports.Get(selectedTicket) then
297
+ selectedTicket = not IsSecret(newest) and newest or nil
298
+ end
299
+ for index = 1, #rows do
300
+ ApplyRowState(rows[index])
301
+ end
302
+ RefreshDetail()
303
+ end
304
+
305
+ RefreshDetail = function()
306
+ local entry = selectedTicket and ns.Stores.Exports.Get(selectedTicket) or nil
172
307
  local hasEntry = entry ~= nil
173
308
  local source = hasEntry and entry.source or nil
174
309
  local payload = hasEntry and entry.payload or nil
175
310
  local environment = hasEntry and entry.environment or nil
176
- local title = source and source.title or ""
311
+ local title = SafeText(source and source.title, "")
177
312
  local kind = source and source.kind or "unknown"
178
313
  detailHeading:SetText(hasEntry and (title ~= "" and title or L.EXPORT_RECORD_DETAIL)
179
314
  or L.EXPORT_RECORD_DETAIL)
180
- local pending = hasEntry and ns.IsExportPending(selectedTicket)
315
+ local pending = hasEntry and ns.Stores.Exports.IsPending(selectedTicket)
181
316
  detailStatus:SetText(hasEntry and (pending and L.EXPORT_STATUS_PENDING or L.EXPORT_STATUS_SAVED) or "")
182
317
  if pending then
183
- detailStatus:SetTextColor(ui.accentR, ui.accentG, ui.accentB, 0.94)
318
+ detailStatus:SetTextColor(colors.accent[1], colors.accent[2], colors.accent[3], 0.94)
184
319
  else
185
320
  detailStatus:SetTextColor(1, 1, 1, 0.36)
186
321
  end
@@ -189,45 +324,41 @@ function ns.CreateExportRecordsPage(parent, ui)
189
324
  timeValue:SetText(hasEntry and FormatTime(entry.createdAt) or "")
190
325
  sizeValue:SetText(hasEntry and FormatBytes(payload and payload.byteCount) or "")
191
326
  if hasEntry and environment then
192
- local version = environment.version or L.UNKNOWN
193
- local build = environment.build and (" (" .. tostring(environment.build) .. ")") or ""
327
+ local version = SafeText(environment.version, L.UNKNOWN)
328
+ local build = environment.build and (" (" .. SafeText(environment.build, L.UNKNOWN) .. ")") or ""
194
329
  clientValue:SetText(version .. build)
195
330
  else
196
331
  clientValue:SetText("")
197
332
  end
198
333
  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 ""
334
+ pathValue:SetText(path and not IsSecret(path) and tostring(path) or L.NOT_AVAILABLE)
335
+ ticketBox.savedText = hasEntry and SafeText(selectedTicket, L.TREE_SECRET) or ""
201
336
  ticketBox.updatingText = true
202
337
  ticketBox:SetText(ticketBox.savedText)
203
- ticketBox.updatingText = nil
338
+ ticketBox.updatingText = false
204
339
  ticketHint:SetText(L.EXPORT_TICKET_HELP)
205
340
  if hasEntry then
206
- ui.SelectAllText(ticketBox)
341
+ Widgets.SelectAllText(ticketBox)
207
342
  else
208
343
  ticketBox:ClearFocus()
209
344
  end
210
- ui.SetButtonEnabled(deleteButton, hasEntry)
211
- deleteConfirmed = false
212
- ui.SetButtonText(deleteButton, L.EXPORT_RECORD_DELETE)
213
- ui.SetButtonVariant(deleteButton, "secondary")
345
+ Widgets.SetButtonEnabled(deleteButton, hasEntry)
346
+ deleteButton:ResetConfirm()
214
347
  end
215
348
 
216
- local function SelectRecord(ticket)
217
- selectedTicket = ns.GetExport(ticket) and ticket or nil
349
+ SelectRecord = function(ticket)
350
+ if IsSecret(ticket) then
351
+ return
352
+ end
353
+ selectedTicket = ns.Stores.Exports.Get(ticket) and ticket or nil
218
354
  for index = 1, #rows do
219
355
  ApplyRowState(rows[index])
220
356
  end
221
357
  RefreshDetail()
222
358
  end
223
359
 
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)
360
+ AcquireRow = function(index)
361
+ local row = Widgets.CreateListRow(listContent, ROW_HEIGHT)
231
362
  row:SetPoint("TOPLEFT", 0, -(index - 1) * ROW_HEIGHT)
232
363
  row:SetPoint("TOPRIGHT", 0, -(index - 1) * ROW_HEIGHT)
233
364
  row:EnableMouseWheel(true)
@@ -268,120 +399,70 @@ function ns.CreateExportRecordsPage(parent, ui)
268
399
  return row
269
400
  end
270
401
 
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
402
  ticketBox:SetScript("OnTextChanged", function(self)
326
403
  if not self.updatingText and self:GetText() ~= self.savedText then
327
404
  self.updatingText = true
328
405
  self:SetText(self.savedText or "")
329
- self.updatingText = nil
406
+ self.updatingText = false
330
407
  self:HighlightText()
331
408
  end
332
409
  end)
333
410
  ticketBox:SetScript("OnMouseUp", function()
334
- if selectedTicket then
335
- ui.SelectAllText(ticketBox)
411
+ if selectedTicket and not IsSecret(selectedTicket) then
412
+ Widgets.SelectAllText(ticketBox)
336
413
  end
337
414
  end)
338
415
  reloadButton:SetScript("OnClick", function()
339
- if ns.IsCombatBlocked() then
340
- ns.PrintCombatBlocked()
416
+ if RefuseInCombat() then
341
417
  return
342
418
  end
343
419
  ReloadUI()
344
420
  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
421
 
371
422
  page.listScroll = listScroll
372
423
  page.rows = rows
373
424
  page.ticketBox = ticketBox
374
425
  page.ticketHint = ticketHint
375
426
  page.pendingText = pendingText
427
+ page.countText = countText
428
+ page.usageText = usageText
429
+ page.emptyTitle = emptyTitle
430
+ page.emptyHelp = emptyHelp
431
+ page.detailHeading = detailHeading
376
432
  page.detailStatus = detailStatus
433
+ page.nameValue = nameValue
434
+ page.kindValue = kindValue
435
+ page.timeValue = timeValue
436
+ page.sizeValue = sizeValue
437
+ page.clientValue = clientValue
438
+ page.pathValue = pathValue
377
439
  page.deleteButton = deleteButton
378
440
  page.clearButton = clearButton
379
441
  page.reloadButton = reloadButton
380
442
  page.Refresh = Refresh
381
443
  page.SelectRecord = SelectRecord
444
+ function page:GetSelectedTicket()
445
+ return selectedTicket
446
+ end
382
447
  function page:Activate()
383
448
  Refresh()
384
449
  end
450
+
385
451
  Refresh()
386
452
  return page
387
453
  end
454
+
455
+ Workbench.RegisterPage{
456
+ key = "exports",
457
+ titleKey = "TAB_EXPORTS",
458
+ build = BuildExportRecordsPage,
459
+ activate = function(page)
460
+ page:Activate()
461
+ end,
462
+ -- Window hide / combat teardown: disarm both two-click confirmations so a
463
+ -- later click never lands on an armed destructive action.
464
+ shutdown = function(page)
465
+ page.deleteButton:ResetConfirm()
466
+ page.clearButton:ResetConfirm()
467
+ end,
468
+ }