lycheedev 1.2.0 → 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 (118) 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 +128 -93
  26. package/{vendor → payload}/addon/Core/Locale_enUS.lua +128 -95
  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 -746
  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 -44
  85. package/vendor/addon/Lychee Dev_Mainline.toc +0 -44
  86. package/vendor/addon/Lychee Dev_Mists.toc +0 -44
  87. package/vendor/addon/Lychee Dev_Wrath.toc +0 -44
  88. package/vendor/addon/Modules/Automation/Controller.lua +0 -896
  89. package/vendor/addon/Modules/Automation/Reload.lua +0 -101
  90. package/vendor/addon/Modules/Automation/Report.lua +0 -409
  91. package/vendor/addon/Modules/Automation/auto/auto.lua +0 -12
  92. package/vendor/addon/Modules/FunctionTrace.lua +0 -85
  93. package/vendor/addon/UI/AutomationOverlay.lua +0 -253
  94. package/vendor/addon/UI/Pages/Automation.lua +0 -417
  95. package/vendor/addon/UI/Pages/Diagnostics.lua +0 -289
  96. package/vendor/addon/UI/Pages/Trace.lua +0 -165
  97. package/vendor/skill/SKILL.md +0 -44
  98. package/vendor/skill/agents/openai.yaml +0 -4
  99. package/vendor/skill/references/automation.md +0 -130
  100. package/vendor/skill/references/clients.md +0 -51
  101. package/vendor/skill/references/runtime-investigations.md +0 -104
  102. package/vendor/skill/scripts/automation/__init__.py +0 -1
  103. package/vendor/skill/scripts/automation/registry.py +0 -516
  104. package/vendor/skill/scripts/automation/reload.py +0 -121
  105. package/vendor/skill/scripts/automation/saved_variables.py +0 -438
  106. package/vendor/skill/scripts/automation/session.py +0 -207
  107. package/vendor/skill/scripts/automation/windows.py +0 -792
  108. package/vendor/skill/scripts/automation.py +0 -1067
  109. package/vendor/skill/scripts/requirements.txt +0 -13
  110. package/vendor/skill/scripts/selftest_offline.py +0 -1061
  111. package/vendor/skill/scripts/test_input_safety.py +0 -132
  112. package/vendor/skill/scripts/test_reload.py +0 -120
  113. /package/{vendor → payload}/addon/Media/GitHub.png +0 -0
  114. /package/{vendor → payload}/addon/Media/Logo.png +0 -0
  115. /package/{vendor → payload}/addon/Modules/Events/CatalogData_Forever.lua +0 -0
  116. /package/{vendor → payload}/addon/Modules/Events/CatalogData_Mainline.lua +0 -0
  117. /package/{vendor → payload}/addon/Modules/Events/CatalogData_Mists.lua +0 -0
  118. /package/{vendor → payload}/addon/Modules/Events/CatalogData_Titan.lua +0 -0
@@ -1,8 +1,12 @@
1
1
  local ADDON_NAME, ns = ...
2
+
3
+ -- Events workbench page: catalog search and selection over the per-client
4
+ -- event catalog (Modules/Events/Catalog.lua) plus the bounded event monitor
5
+ -- (Modules/Events/Monitor.lua). All visuals come from ns.Widgets; the Save
6
+ -- action goes through the one export hook (ns.ExportUI).
2
7
  local L = ns.L
8
+ local W = ns.Widgets
3
9
 
4
- local TREE_ROW_HEIGHT = 22
5
- local TREE_ROW_POOL_SIZE = 32
6
10
  local EVENT_ROW_HEIGHT = 36
7
11
  local EVENT_LIST_WIDTH = 540
8
12
  local EVENT_VISIBLE_ROWS = 18
@@ -10,248 +14,36 @@ local SEARCH_RESULT_LIMIT = 8
10
14
  local SEARCH_ROW_HEIGHT = 38
11
15
  local SELECTED_ROW_HEIGHT = 28
12
16
  local SELECTED_VISIBLE_ROWS = 3
17
+ -- Matches the workbench window content width; rows and the detail edit box
18
+ -- size against it so dynamic text never resizes the layout.
19
+ local PAGE_WIDTH = 1040
13
20
 
14
- local function SetReadOnlyText(panel, text)
15
- text = text or ""
16
- local editBox = panel.editBox
17
- editBox.savedText = text
18
- editBox.updatingText = true
19
- editBox:SetText(text)
20
- editBox.updatingText = nil
21
- editBox:SetCursorPosition(0)
22
- panel.scroll:SetVerticalScroll(0)
21
+ local function Restricted(value)
22
+ return issecretvalue and issecretvalue(value)
23
23
  end
24
24
 
25
- local function ValueColor(kind)
26
- if kind == "string" then
27
- return 0.62, 0.78, 0.64
28
- elseif kind == "number" then
29
- return 0.65, 0.74, 0.91
30
- elseif kind == "boolean" then
31
- return 0.90, 0.63, 0.42
32
- elseif kind == "table" then
33
- return 0.62, 0.67, 0.72
34
- elseif kind == "load_more" then
35
- return 0.86, 0.47, 0.55
36
- elseif kind == "marker" then
37
- return 0.85, 0.42, 0.48
25
+ -- Display boundary guard: a restricted value degrades to a harmless visible
26
+ -- token instead of leaking or throwing on format.
27
+ local function ShownText(value, fallback)
28
+ if Restricted(value) then
29
+ return "<secret>"
38
30
  end
39
- return 0.70, 0.73, 0.76
40
- end
41
-
42
- function ns.CreateTreeView(parent, ui)
43
- local panel = ui.CreatePanel(parent, ui.editorR, ui.editorG, ui.editorB, 1)
44
- local scroll = ui.CreateScrollArea(panel, 8, 8, 7, 8)
45
- local content = CreateFrame("Frame", nil, scroll)
46
- content:SetWidth(ui.contentWidth)
47
- content:SetHeight(1)
48
- scroll:SetScrollChild(content)
49
-
50
- local empty = panel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
51
- empty:SetPoint("TOP", 0, -24)
52
- empty:SetText(L.TREE_EMPTY)
53
- empty:SetTextColor(1, 1, 1, 0.32)
54
-
55
- local rows = {}
56
- local visibleNodes = {}
57
- local tree
58
- local selectedNode
59
- local selectionChanged
60
- local nodeContext
61
- local view = { panel = panel }
62
-
63
- local function FlattenNodes(nodes, depth, visible)
64
- for index = 1, #nodes do
65
- local node = nodes[index]
66
- visible[#visible + 1] = { node = node, depth = depth }
67
- if node.kind == "table" and node.expanded and node.children then
68
- FlattenNodes(node.children, depth + 1, visible)
69
- end
70
- end
71
- end
72
-
73
- local function ApplyRowStyle(row)
74
- if row.node == selectedNode then
75
- row.hover:SetColorTexture(ui.accentR, ui.accentG, ui.accentB, 0.16)
76
- elseif row.isHovered then
77
- row.hover:SetColorTexture(ui.surfaceR, ui.surfaceG, ui.surfaceB, 0.72)
78
- else
79
- row.hover:SetColorTexture(0, 0, 0, 0)
80
- end
81
- end
82
-
83
- local function CreateRow(index)
84
- local row = CreateFrame("Button", nil, content)
85
- row:SetSize(ui.contentWidth, TREE_ROW_HEIGHT)
86
- row:RegisterForClicks("LeftButtonUp", "RightButtonUp")
87
-
88
- local hover = row:CreateTexture(nil, "BACKGROUND")
89
- hover:SetAllPoints()
90
- hover:SetColorTexture(0, 0, 0, 0)
91
- row.hover = hover
92
-
93
- local toggle = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
94
- toggle:SetJustifyH("CENTER")
95
- toggle:SetTextColor(ui.accentR, ui.accentG, ui.accentB, 0.95)
96
- row.toggle = toggle
97
-
98
- local key = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
99
- key:SetJustifyH("LEFT")
100
- key:SetTextColor(0.91, 0.93, 0.95, 0.92)
101
- row.key = key
102
-
103
- local value = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
104
- value:SetPoint("LEFT", 250, 0)
105
- value:SetPoint("RIGHT", -8, 0)
106
- value:SetJustifyH("LEFT")
107
- value:SetWordWrap(false)
108
- row.value = value
109
-
110
- row:SetScript("OnEnter", function(self)
111
- self.isHovered = true
112
- ApplyRowStyle(self)
113
- end)
114
- row:SetScript("OnLeave", function(self)
115
- self.isHovered = nil
116
- ApplyRowStyle(self)
117
- end)
118
- row:SetScript("OnClick", function(self, mouseButton)
119
- local node = self.node
120
- if not node then
121
- return
122
- elseif mouseButton ~= "RightButton" and node.kind == "load_more" and node.owner then
123
- ns.LoadMoreValueTreeNode(node.owner)
124
- view:Refresh()
125
- return
126
- end
127
-
128
- if node.exportable then
129
- selectedNode = node
130
- if selectionChanged then
131
- selectionChanged(node)
132
- end
133
- end
134
- if mouseButton == "RightButton" then
135
- if node.exportable and nodeContext then
136
- nodeContext(node)
137
- end
138
- view:Refresh()
139
- return
140
- end
141
- if node.kind == "table" then
142
- if node.expanded then
143
- node.expanded = false
144
- else
145
- if not node.loaded then
146
- ns.LoadMoreValueTreeNode(node)
147
- end
148
- node.expanded = true
149
- end
150
- end
151
- view:Refresh()
152
- end)
153
-
154
- rows[index] = row
155
- return row
156
- end
157
-
158
- function view:HasTree()
159
- return tree and tree.roots and #tree.roots > 0
160
- end
161
-
162
- function view:GetSelectedNode()
163
- return selectedNode
164
- end
165
-
166
- function view:SetOnSelectionChanged(callback)
167
- selectionChanged = type(callback) == "function" and callback or nil
168
- end
169
-
170
- function view:SetOnNodeContext(callback)
171
- nodeContext = type(callback) == "function" and callback or nil
172
- end
173
-
174
- function view:SetTree(newTree)
175
- tree = newTree
176
- selectedNode = tree and tree.roots and tree.roots[1] and tree.roots[1].exportable
177
- and tree.roots[1] or nil
178
- scroll:SetVerticalScroll(0)
179
- self:Refresh()
180
- if selectionChanged then
181
- selectionChanged(selectedNode)
182
- end
183
- end
184
-
185
- function view:RenderRows()
186
- for index = 1, #rows do
187
- rows[index]:Hide()
188
- end
189
-
190
- local offset = scroll:GetVerticalScroll() or 0
191
- if issecretvalue and issecretvalue(offset) then
192
- return
193
- end
194
- local firstIndex = math.floor(math.max(0, offset) / TREE_ROW_HEIGHT) + 1
195
- local lastIndex = math.min(#visibleNodes, firstIndex + TREE_ROW_POOL_SIZE - 1)
196
-
197
- for visibleIndex = firstIndex, lastIndex do
198
- local poolIndex = visibleIndex - firstIndex + 1
199
- local item = visibleNodes[visibleIndex]
200
- local node = item.node
201
- local row = rows[poolIndex] or CreateRow(poolIndex)
202
- local indent = item.depth * 15
203
- row.node = node
204
- row:ClearAllPoints()
205
- row:SetPoint("TOPLEFT", 0, -((visibleIndex - 1) * TREE_ROW_HEIGHT))
206
-
207
- row.toggle:ClearAllPoints()
208
- row.toggle:SetPoint("LEFT", 6 + indent, 0)
209
- row.toggle:SetSize(14, TREE_ROW_HEIGHT)
210
- if node.kind == "table" and (not node.loaded or #node.children > 0) then
211
- row.toggle:SetText(node.expanded and "-" or "+")
212
- elseif node.kind == "load_more" then
213
- row.toggle:SetText("+")
214
- else
215
- row.toggle:SetText("")
216
- end
217
-
218
- row.key:ClearAllPoints()
219
- row.key:SetPoint("LEFT", 24 + indent, 0)
220
- row.key:SetWidth(math.max(70, 218 - indent))
221
- row.key:SetText(node.label or "")
222
-
223
- local r, g, b = ValueColor(node.kind)
224
- row.value:SetTextColor(r, g, b, 0.92)
225
- row.value:SetText(node.value or "")
226
- ApplyRowStyle(row)
227
- row:Show()
228
- end
229
- end
230
-
231
- function view:Refresh()
232
- wipe(visibleNodes)
233
- if tree and tree.roots then
234
- FlattenNodes(tree.roots, 0, visibleNodes)
235
- end
236
-
237
- content:SetHeight(math.max(1, #visibleNodes * TREE_ROW_HEIGHT))
238
- scroll:UpdateScrollChildRect()
239
- empty:SetShown(#visibleNodes == 0)
240
- self:RenderRows()
31
+ if value == nil then
32
+ return fallback or ""
241
33
  end
34
+ return tostring(value)
35
+ end
242
36
 
243
- scroll.onVerticalScrollChanged = function()
244
- view:RenderRows()
37
+ local function ShownNumber(value, format, fallback)
38
+ if Restricted(value) or type(value) ~= "number" then
39
+ return fallback or "<secret>"
245
40
  end
246
-
247
- view.content = content
248
- view.rows = rows
249
- view.scroll = scroll
250
- return view
41
+ return string.format(format, value)
251
42
  end
252
43
 
253
- local function CreateLineInput(parent, ui)
254
- local panel = ui.CreatePanel(parent, ui.editorR, ui.editorG, ui.editorB, 1)
44
+ local function CreateLineInput(parent)
45
+ local colors = W.Colors
46
+ local panel = W.CreatePanel(parent, colors.editor[1], colors.editor[2], colors.editor[3], 1)
255
47
  local editBox = CreateFrame("EditBox", nil, panel)
256
48
  editBox:SetAutoFocus(false)
257
49
  editBox:SetFontObject(ChatFontNormal)
@@ -263,19 +55,19 @@ local function CreateLineInput(parent, ui)
263
55
  self:ClearFocus()
264
56
  end)
265
57
  editBox:SetScript("OnEditFocusGained", function()
266
- ui.SetBorderColor(panel, true, 0.75)
58
+ W.SetBorderColor(panel, true, 0.75)
267
59
  end)
268
60
  editBox:SetScript("OnEditFocusLost", function()
269
- ui.SetBorderColor(panel, false)
61
+ W.SetBorderColor(panel, false)
270
62
  end)
271
63
  panel.editBox = editBox
272
64
  return panel
273
65
  end
274
66
 
275
- local function CreateRemoveButton(parent, ui)
67
+ local function CreateRemoveButton(parent)
276
68
  local button = CreateFrame("Button", nil, parent, "BackdropTemplate")
277
69
  button:SetSize(22, 22)
278
- button:SetBackdrop(ui.backdrop)
70
+ button:SetBackdrop(W.Backdrop)
279
71
 
280
72
  local firstLine = button:CreateTexture(nil, "ARTWORK")
281
73
  firstLine:SetSize(9, 1)
@@ -287,16 +79,17 @@ local function CreateRemoveButton(parent, ui)
287
79
  secondLine:SetPoint("CENTER")
288
80
  secondLine:SetRotation(-0.785398)
289
81
 
82
+ local colors = W.Colors
290
83
  local function ApplyState(hovered, pressed)
291
84
  if pressed then
292
- button:SetBackdropColor(ui.accentR * 0.72, ui.accentG * 0.72, ui.accentB * 0.72, 0.92)
293
- button:SetBackdropBorderColor(ui.accentR, ui.accentG, ui.accentB, 0.9)
85
+ button:SetBackdropColor(colors.accent[1] * 0.72, colors.accent[2] * 0.72, colors.accent[3] * 0.72, 0.92)
86
+ button:SetBackdropBorderColor(colors.accent[1], colors.accent[2], colors.accent[3], 0.9)
294
87
  elseif hovered then
295
- button:SetBackdropColor(ui.accentR, ui.accentG, ui.accentB, 0.74)
296
- button:SetBackdropBorderColor(ui.accentR, ui.accentG, ui.accentB, 0.92)
88
+ button:SetBackdropColor(colors.accent[1], colors.accent[2], colors.accent[3], 0.74)
89
+ button:SetBackdropBorderColor(colors.accent[1], colors.accent[2], colors.accent[3], 0.92)
297
90
  else
298
- button:SetBackdropColor(ui.surfaceR, ui.surfaceG, ui.surfaceB, 0.58)
299
- ui.SetBorderColor(button, false, 0.24)
91
+ button:SetBackdropColor(colors.surface[1], colors.surface[2], colors.surface[3], 0.58)
92
+ W.SetBorderColor(button, false, 0.24)
300
93
  end
301
94
  local alpha = hovered and 0.95 or 0.48
302
95
  firstLine:SetColorTexture(1, 1, 1, alpha)
@@ -321,11 +114,53 @@ local function CreateRemoveButton(parent, ui)
321
114
  return button
322
115
  end
323
116
 
324
- function ns.CreateEventsPage(parent, ui)
117
+ -- The one export hook shared by every page. The window shell owns the shared
118
+ -- controller (ns.Workbench.SaveToDisk / GetExportController); the fallback
119
+ -- keeps standalone builds working without forking the export UI.
120
+ local sharedExportUI
121
+ local function ObtainExportUI(parent)
122
+ if ns.Workbench and type(ns.Workbench.GetExportController) == "function" then
123
+ local shared = ns.Workbench.GetExportController()
124
+ if shared then
125
+ return shared
126
+ end
127
+ end
128
+ if not sharedExportUI then
129
+ sharedExportUI = ns.SharedExportUI or ns.ExportUI.Create(parent)
130
+ ns.SharedExportUI = sharedExportUI
131
+ end
132
+ return sharedExportUI
133
+ end
134
+
135
+ -- Save payload for the captured event log: SerializeForExport over at most
136
+ -- MAX_RECORDS records of {elapsed, event, arguments, summary}.
137
+ local function BuildEventLogPayload()
138
+ local recordCount = ns.EventMonitor.GetCount()
139
+ if recordCount == 0 then
140
+ return nil
141
+ end
142
+ return "event_log", L.CAPTURED_EVENTS, function()
143
+ local exportRecords = {}
144
+ for index = 1, recordCount do
145
+ local record = ns.EventMonitor.GetRecord(index)
146
+ exportRecords[index] = {
147
+ elapsed = record.elapsed,
148
+ event = record.event,
149
+ arguments = record.arguments,
150
+ summary = record.summary,
151
+ }
152
+ end
153
+ local text = ns.Serializer.SerializeForExport(exportRecords)
154
+ return text
155
+ end, { recordCount = recordCount }
156
+ end
157
+
158
+ function ns.CreateEventsPage(parent)
159
+ local colors = W.Colors
325
160
  local page = CreateFrame("Frame", nil, parent)
326
161
  page:SetAllPoints(parent)
327
162
 
328
- local inputLabel = ui.CreateSectionLabel(page, L.FIND_EVENT)
163
+ local inputLabel = W.CreateSectionLabel(page, L.FIND_EVENT)
329
164
  inputLabel:SetPoint("TOPLEFT", 17, -84)
330
165
 
331
166
  local catalogCount = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
@@ -333,7 +168,7 @@ function ns.CreateEventsPage(parent, ui)
333
168
  catalogCount:SetText(string.format(L.CATALOG_COUNT, ns.EventCatalog.GetCount()))
334
169
  catalogCount:SetTextColor(1, 1, 1, 0.34)
335
170
 
336
- local inputPanel = CreateLineInput(page, ui)
171
+ local inputPanel = CreateLineInput(page)
337
172
  inputPanel:SetPoint("TOPLEFT", 14, -104)
338
173
  inputPanel:SetPoint("TOPRIGHT", -278, -104)
339
174
  inputPanel:SetHeight(30)
@@ -345,10 +180,10 @@ function ns.CreateEventsPage(parent, ui)
345
180
  inputHint:SetTextColor(1, 1, 1, 0.30)
346
181
  page.inputHint = inputHint
347
182
 
348
- local monitorButton = ui.CreateButton(page, 140, L.START_MONITORING, true)
183
+ local monitorButton = W.CreateButton(page, 140, L.START_MONITORING, "primary")
349
184
  monitorButton:SetPoint("TOPRIGHT", -14, -104)
350
185
 
351
- local clearButton = ui.CreateButton(page, 100, L.CLEAR_LOG, false)
186
+ local clearButton = W.CreateButton(page, 100, L.CLEAR_LOG, "secondary")
352
187
  clearButton:SetPoint("RIGHT", monitorButton, "LEFT", -8, 0)
353
188
  page.monitorButton = monitorButton
354
189
  page.clearButton = clearButton
@@ -377,22 +212,22 @@ function ns.CreateEventsPage(parent, ui)
377
212
  end
378
213
  end
379
214
 
380
- local selectedLabel = ui.CreateSectionLabel(page, L.SELECTED_EVENTS)
215
+ local selectedLabel = W.CreateSectionLabel(page, L.SELECTED_EVENTS)
381
216
  selectedLabel:SetPoint("TOPLEFT", 17, -169)
382
217
 
383
218
  local selectedCount = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
384
219
  selectedCount:SetPoint("LEFT", selectedLabel, "RIGHT", 9, 0)
385
220
  selectedCount:SetTextColor(1, 1, 1, 0.34)
386
221
 
387
- local selectedPanel = ui.CreatePanel(page, ui.editorR, ui.editorG, ui.editorB, 0.78)
222
+ local selectedPanel = W.CreatePanel(page, colors.editor[1], colors.editor[2], colors.editor[3], 0.78)
388
223
  selectedPanel:SetPoint("TOPLEFT", 14, -189)
389
224
  selectedPanel:SetPoint("TOPRIGHT", -14, -189)
390
225
  selectedPanel:SetHeight(42)
391
226
  page.selectedPanel = selectedPanel
392
227
 
393
- local selectedScroll = ui.CreateScrollArea(selectedPanel, 7, 7, 7, 7)
228
+ local selectedScroll = W.CreateScrollArea(selectedPanel, 7, 7, 7, 7)
394
229
  local selectedContent = CreateFrame("Frame", nil, selectedScroll)
395
- selectedContent:SetWidth(ui.windowWidth - 56)
230
+ selectedContent:SetWidth(PAGE_WIDTH - 56)
396
231
  selectedContent:SetHeight(1)
397
232
  selectedScroll:SetScrollChild(selectedContent)
398
233
 
@@ -401,18 +236,18 @@ function ns.CreateEventsPage(parent, ui)
401
236
  selectedEmpty:SetText(L.NO_EVENTS_SELECTED)
402
237
  selectedEmpty:SetTextColor(1, 1, 1, 0.32)
403
238
 
404
- local logLabel = ui.CreateSectionLabel(page, L.CAPTURED_EVENTS)
239
+ local logLabel = W.CreateSectionLabel(page, L.CAPTURED_EVENTS)
405
240
  logLabel:SetPoint("TOPLEFT", selectedPanel, "BOTTOMLEFT", 3, -22)
406
241
 
407
- local detailLabel = ui.CreateSectionLabel(page, L.PAYLOAD)
242
+ local detailLabel = W.CreateSectionLabel(page, L.PAYLOAD)
408
243
  detailLabel:SetPoint("TOPLEFT", selectedPanel, "BOTTOMLEFT", EVENT_LIST_WIDTH + 15, -22)
409
244
 
410
- local logPanel = ui.CreatePanel(page, ui.editorR, ui.editorG, ui.editorB, 0.78)
245
+ local logPanel = W.CreatePanel(page, colors.editor[1], colors.editor[2], colors.editor[3], 0.78)
411
246
  logPanel:SetPoint("TOPLEFT", selectedPanel, "BOTTOMLEFT", 0, -42)
412
247
  logPanel:SetPoint("BOTTOMLEFT", 14, 54)
413
248
  logPanel:SetWidth(EVENT_LIST_WIDTH)
414
249
 
415
- local logScroll = ui.CreateScrollArea(logPanel, 8, 8, 7, 8)
250
+ local logScroll = W.CreateScrollArea(logPanel, 8, 8, 7, 8)
416
251
  local logContent = CreateFrame("Frame", nil, logScroll)
417
252
  logContent:SetWidth(EVENT_LIST_WIDTH - 26)
418
253
  logContent:SetHeight(1)
@@ -425,24 +260,27 @@ function ns.CreateEventsPage(parent, ui)
425
260
 
426
261
  local selectedRecord
427
262
  local FormatDetails
428
- local detailPanel = ui.CreateTextArea(page, true)
263
+ local detailPanel = W.CreateTextArea(page, true)
429
264
  detailPanel:SetPoint("TOPLEFT", selectedPanel, "BOTTOMLEFT", EVENT_LIST_WIDTH + 12, -42)
430
265
  detailPanel:SetPoint("BOTTOMRIGHT", -14, 54)
431
- detailPanel.editBox:SetWidth(ui.windowWidth - EVENT_LIST_WIDTH - 78)
432
- SetReadOnlyText(detailPanel, L.SELECT_EVENT_DETAIL)
266
+ detailPanel.editBox:SetWidth(PAGE_WIDTH - EVENT_LIST_WIDTH - 78)
267
+ W.SetReadOnlyText(detailPanel, L.SELECT_EVENT_DETAIL)
433
268
 
434
- local exportDetail = ui.CreateButton(page, 92, L.SAVE_TO_DISK, false)
269
+ local exportDetail = W.CreateButton(page, 92, L.SAVE_TO_DISK, "secondary")
435
270
  exportDetail:SetPoint("BOTTOMRIGHT", -14, 14)
436
271
  exportDetail:SetScript("OnClick", function()
437
- local recordCount = ns.EventMonitor.GetCount()
438
- if recordCount > 0 then
439
- ui.ExportText("event_log", L.CAPTURED_EVENTS, function()
440
- local records = {}
441
- for index = 1, recordCount do
442
- records[index] = ns.EventMonitor.GetRecord(index)
443
- end
444
- return ns.SerializeForExport(records)
445
- end, { recordCount = recordCount })
272
+ if ns.Safety.IsCombatBlocked() then
273
+ ns.Safety.PrintBlocked()
274
+ return
275
+ end
276
+ local kind, title, content, metadata = BuildEventLogPayload()
277
+ if not kind then
278
+ return
279
+ end
280
+ if ns.Workbench and type(ns.Workbench.SaveToDisk) == "function" then
281
+ ns.Workbench.SaveToDisk(kind, title, content, metadata)
282
+ else
283
+ ObtainExportUI(parent):Save(kind, title, content, metadata)
446
284
  end
447
285
  end)
448
286
  page.exportDetail = exportDetail
@@ -455,17 +293,19 @@ function ns.CreateEventsPage(parent, ui)
455
293
  local refreshQueued
456
294
  local dirty
457
295
 
458
- local searchPanel = ui.CreatePanel(page, ui.editorR, ui.editorG, ui.editorB, 0.99)
296
+ local searchPanel = W.CreatePanel(page, colors.editor[1], colors.editor[2], colors.editor[3], 0.99)
459
297
  searchPanel:SetPoint("TOPLEFT", inputPanel, "BOTTOMLEFT", 0, -4)
460
298
  searchPanel:SetPoint("TOPRIGHT", inputPanel, "BOTTOMRIGHT", 0, -4)
461
299
  searchPanel:SetFrameLevel(page:GetFrameLevel() + 30)
462
300
  searchPanel:Hide()
463
301
 
302
+ -- While monitoring runs, the selection surface is frozen: input disabled
303
+ -- and unfocused, the dropdown hidden and every remove button disabled.
464
304
  SyncMonitorControls = function()
465
305
  local running = ns.EventMonitor.IsRunning()
466
- ui.SetButtonText(monitorButton, running and L.STOP_MONITORING or L.START_MONITORING)
467
- ui.SetButtonVariant(monitorButton, running and "danger" or "primary")
468
- ui.SetButtonEnabled(monitorButton, running or selection:GetCount() > 0)
306
+ W.SetButtonText(monitorButton, running and L.STOP_MONITORING or L.START_MONITORING)
307
+ W.SetButtonVariant(monitorButton, running and "danger" or "primary")
308
+ W.SetButtonEnabled(monitorButton, running or selection:GetCount() > 0)
469
309
  inputPanel.editBox:SetEnabled(not running)
470
310
  inputPanel.editBox:SetTextColor(0.94, 0.95, 0.96, running and 0.38 or 1)
471
311
  inputHint:SetAlpha(running and 0.22 or 1)
@@ -488,7 +328,7 @@ function ns.CreateEventsPage(parent, ui)
488
328
  end
489
329
 
490
330
  local function ApplySearchRowStyle(row)
491
- ui.SetListRowState(row, row.resultIndex == highlightedSearchIndex, row.isHovered)
331
+ W.SetListRowState(row, row.resultIndex == highlightedSearchIndex, row.isHovered)
492
332
  if row.resultIndex == highlightedSearchIndex then
493
333
  row.name:SetTextColor(1, 1, 1, 0.96)
494
334
  elseif row.isHovered then
@@ -516,15 +356,16 @@ function ns.CreateEventsPage(parent, ui)
516
356
  RefreshSelected()
517
357
  SetSelectionStatus()
518
358
  else
519
- SetStatus(errorMessage or L.COULD_NOT_SELECT_EVENT, ui.accentR, ui.accentG, ui.accentB)
359
+ SetStatus(errorMessage or L.COULD_NOT_SELECT_EVENT, colors.accent[1], colors.accent[2], colors.accent[3])
520
360
  end
521
361
  end
522
362
 
523
363
  local function CreateSearchRow(index)
524
- local row = ui.CreateListRow(searchPanel, SEARCH_ROW_HEIGHT)
364
+ local row = W.CreateListRow(searchPanel, SEARCH_ROW_HEIGHT)
525
365
  row:SetPoint("TOPLEFT", 3, -3 - ((index - 1) * SEARCH_ROW_HEIGHT))
526
366
  row:SetPoint("TOPRIGHT", -3, -3 - ((index - 1) * SEARCH_ROW_HEIGHT))
527
367
  row.resultIndex = index
368
+ row.isHovered = false
528
369
 
529
370
  local name = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
530
371
  name:SetPoint("TOPLEFT", 9, -5)
@@ -576,7 +417,7 @@ function ns.CreateEventsPage(parent, ui)
576
417
  for index = 1, #searchResults do
577
418
  local row = searchRows[index] or CreateSearchRow(index)
578
419
  local eventName, signature = ns.EventCatalog.Get(searchResults[index])
579
- row.name:SetText(eventName)
420
+ row.name:SetText(ShownText(eventName))
580
421
  row.payload:SetText(FormatCatalogPayload(eventName, signature))
581
422
  ApplySearchRowStyle(row)
582
423
  row:Show()
@@ -587,13 +428,14 @@ function ns.CreateEventsPage(parent, ui)
587
428
  end
588
429
 
589
430
  local function ApplySelectedRowStyle(row)
590
- ui.SetListRowState(row, false, row.isHovered)
431
+ W.SetListRowState(row, false, row.isHovered)
591
432
  end
592
433
 
593
434
  local function CreateSelectedRow(index)
594
- local row = ui.CreateListRow(selectedContent, SELECTED_ROW_HEIGHT)
595
- row:SetWidth(ui.windowWidth - 56)
435
+ local row = W.CreateListRow(selectedContent, SELECTED_ROW_HEIGHT)
436
+ row:SetWidth(PAGE_WIDTH - 56)
596
437
  row:EnableMouse(true)
438
+ row.isHovered = false
597
439
 
598
440
  local name = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
599
441
  name:SetPoint("LEFT", 9, 0)
@@ -611,7 +453,7 @@ function ns.CreateEventsPage(parent, ui)
611
453
  payload:SetTextColor(1, 1, 1, 0.36)
612
454
  row.payload = payload
613
455
 
614
- local removeButton = CreateRemoveButton(row, ui)
456
+ local removeButton = CreateRemoveButton(row)
615
457
  removeButton:SetPoint("RIGHT", -3, 0)
616
458
  removeButton:SetScript("OnClick", function()
617
459
  if not ns.EventMonitor.IsRunning() and row.eventName and selection:Remove(row.eventName) then
@@ -641,7 +483,7 @@ function ns.CreateEventsPage(parent, ui)
641
483
 
642
484
  local selectionCount = selection:GetCount()
643
485
  local scrollOffset = selectedScroll:GetVerticalScroll()
644
- if issecretvalue and issecretvalue(scrollOffset) then
486
+ if Restricted(scrollOffset) then
645
487
  scrollOffset = 0
646
488
  end
647
489
  local firstIndex = math.floor((scrollOffset or 0) / SELECTED_ROW_HEIGHT) + 1
@@ -654,7 +496,7 @@ function ns.CreateEventsPage(parent, ui)
654
496
  row.eventName = eventName
655
497
  row:ClearAllPoints()
656
498
  row:SetPoint("TOPLEFT", 0, -((selectionIndex - 1) * SELECTED_ROW_HEIGHT))
657
- row.name:SetText(eventName)
499
+ row.name:SetText(ShownText(eventName))
658
500
  row.payload:SetText(FormatCatalogPayload(eventName, signature))
659
501
  ApplySelectedRowStyle(row)
660
502
  row:Show()
@@ -677,11 +519,11 @@ function ns.CreateEventsPage(parent, ui)
677
519
  RefreshSearch()
678
520
  end)
679
521
  inputPanel.editBox:SetScript("OnEditFocusGained", function()
680
- ui.SetBorderColor(inputPanel, true, 0.75)
522
+ W.SetBorderColor(inputPanel, true, 0.75)
681
523
  RefreshSearch()
682
524
  end)
683
525
  inputPanel.editBox:SetScript("OnEditFocusLost", function()
684
- ui.SetBorderColor(inputPanel, false)
526
+ W.SetBorderColor(inputPanel, false)
685
527
  if not searchPanel.isHovered then
686
528
  searchPanel:Hide()
687
529
  end
@@ -716,27 +558,28 @@ function ns.CreateEventsPage(parent, ui)
716
558
  end
717
559
 
718
560
  local lines = {
719
- string.format(L.EVENT_DETAIL, record.event),
720
- string.format(L.ELAPSED_DETAIL, record.elapsed),
561
+ string.format(L.EVENT_DETAIL, ShownText(record.event)),
562
+ ShownNumber(record.elapsed, L.ELAPSED_DETAIL, L.UNKNOWN_TIME),
721
563
  "",
722
564
  }
723
565
  if #record.arguments == 0 then
724
566
  lines[#lines + 1] = L.EVENT_HAS_NO_PAYLOAD
725
567
  else
726
568
  for index = 1, #record.arguments do
727
- lines[#lines + 1] = "[" .. index .. "] = " .. record.arguments[index]
569
+ lines[#lines + 1] = "[" .. index .. "] = " .. ShownText(record.arguments[index])
728
570
  end
729
571
  end
730
572
  return table.concat(lines, "\n")
731
573
  end
732
574
 
733
575
  local function ApplyEventRowStyle(row)
734
- ui.SetListRowState(row, row.record == selectedRecord, row.isHovered)
576
+ W.SetListRowState(row, row.record == selectedRecord, row.isHovered)
735
577
  end
736
578
 
737
579
  local function CreateEventRow(index)
738
- local row = ui.CreateListRow(logContent, EVENT_ROW_HEIGHT)
580
+ local row = W.CreateListRow(logContent, EVENT_ROW_HEIGHT)
739
581
  row:SetWidth(EVENT_LIST_WIDTH - 26)
582
+ row.isHovered = false
740
583
 
741
584
  local timeLabel = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
742
585
  timeLabel:SetPoint("LEFT", 8, 0)
@@ -771,7 +614,7 @@ function ns.CreateEventsPage(parent, ui)
771
614
  end)
772
615
  row:SetScript("OnClick", function(self)
773
616
  selectedRecord = self.record
774
- SetReadOnlyText(detailPanel, FormatDetails(selectedRecord))
617
+ W.SetReadOnlyText(detailPanel, FormatDetails(selectedRecord))
775
618
  page:Refresh()
776
619
  end)
777
620
 
@@ -782,14 +625,14 @@ function ns.CreateEventsPage(parent, ui)
782
625
  function page:Refresh()
783
626
  dirty = nil
784
627
  local recordCount = ns.EventMonitor.GetCount()
785
- ui.SetButtonEnabled(clearButton, recordCount > 0)
786
- ui.SetButtonEnabled(exportDetail, recordCount > 0)
628
+ W.SetButtonEnabled(clearButton, recordCount > 0)
629
+ W.SetButtonEnabled(exportDetail, recordCount > 0)
787
630
  for index = 1, #rows do
788
631
  rows[index]:Hide()
789
632
  end
790
633
 
791
634
  local scrollOffset = logScroll:GetVerticalScroll()
792
- if issecretvalue and issecretvalue(scrollOffset) then
635
+ if Restricted(scrollOffset) then
793
636
  scrollOffset = 0
794
637
  end
795
638
  local firstIndex = math.floor((scrollOffset or 0) / EVENT_ROW_HEIGHT) + 1
@@ -802,9 +645,9 @@ function ns.CreateEventsPage(parent, ui)
802
645
  row.record = record
803
646
  row:ClearAllPoints()
804
647
  row:SetPoint("TOPLEFT", 0, -((recordIndex - 1) * EVENT_ROW_HEIGHT))
805
- row.timeLabel:SetText(string.format("+%.2fs", record.elapsed))
806
- row.eventLabel:SetText(record.event)
807
- row.summary:SetText(record.summary ~= "" and record.summary or L.NO_PAYLOAD)
648
+ row.timeLabel:SetText(ShownNumber(record.elapsed, "+%.2fs", "<secret>"))
649
+ row.eventLabel:SetText(ShownText(record.event))
650
+ row.summary:SetText(record.summary ~= "" and ShownText(record.summary) or L.NO_PAYLOAD)
808
651
  ApplyEventRowStyle(row)
809
652
  row:Show()
810
653
  end
@@ -813,7 +656,7 @@ function ns.CreateEventsPage(parent, ui)
813
656
  logScroll:UpdateScrollChildRect()
814
657
  empty:SetShown(recordCount == 0)
815
658
  if selectedRecord then
816
- SetReadOnlyText(detailPanel, FormatDetails(selectedRecord))
659
+ W.SetReadOnlyText(detailPanel, FormatDetails(selectedRecord))
817
660
  end
818
661
  end
819
662
 
@@ -837,8 +680,13 @@ function ns.CreateEventsPage(parent, ui)
837
680
  refreshQueued = true
838
681
  C_Timer.After(0, FlushRefresh)
839
682
  end
683
+ page.QueueRefresh = QueueRefresh
840
684
 
841
685
  monitorButton:SetScript("OnClick", function()
686
+ if ns.Safety.IsCombatBlocked() then
687
+ ns.Safety.PrintBlocked()
688
+ return
689
+ end
842
690
  if ns.EventMonitor.IsRunning() then
843
691
  ns.EventMonitor.Stop()
844
692
  SetStatus(L.STOPPED, 0.55, 0.60, 0.65)
@@ -855,15 +703,19 @@ function ns.CreateEventsPage(parent, ui)
855
703
  inputPanel.editBox:ClearFocus()
856
704
  searchPanel:Hide()
857
705
  else
858
- SetStatus(errorMessage or L.COULD_NOT_START, ui.accentR, ui.accentG, ui.accentB)
706
+ SetStatus(errorMessage or L.COULD_NOT_START, colors.accent[1], colors.accent[2], colors.accent[3])
859
707
  end
860
708
  SyncMonitorControls()
861
709
  end)
862
710
 
863
711
  clearButton:SetScript("OnClick", function()
712
+ if ns.Safety.IsCombatBlocked() then
713
+ ns.Safety.PrintBlocked()
714
+ return
715
+ end
864
716
  ns.EventMonitor.Clear()
865
717
  selectedRecord = nil
866
- SetReadOnlyText(detailPanel, L.SELECT_EVENT_DETAIL)
718
+ W.SetReadOnlyText(detailPanel, L.SELECT_EVENT_DETAIL)
867
719
  page:Refresh()
868
720
  end)
869
721
 
@@ -888,3 +740,41 @@ function ns.CreateEventsPage(parent, ui)
888
740
  page:Refresh()
889
741
  return page
890
742
  end
743
+
744
+ -- Workbench registration: zero cost before the first /dev (build runs lazily);
745
+ -- shutdown stops the monitor so a hidden window or combat entry never leaves
746
+ -- events registered.
747
+ local pageInstance
748
+ local definition = {
749
+ key = "events",
750
+ titleKey = "TAB_EVENTS",
751
+ build = function(parent)
752
+ pageInstance = ns.CreateEventsPage(parent)
753
+ return pageInstance
754
+ end,
755
+ activate = function()
756
+ if pageInstance then
757
+ pageInstance:RefreshIfDirty()
758
+ end
759
+ end,
760
+ suspend = function()
761
+ end,
762
+ shutdown = function()
763
+ if pageInstance then
764
+ pageInstance:StopMonitor()
765
+ elseif ns.EventMonitor then
766
+ ns.EventMonitor.Stop()
767
+ end
768
+ end,
769
+ }
770
+
771
+ if ns.Workbench and type(ns.Workbench.RegisterPage) == "function" then
772
+ ns.Workbench.RegisterPage(definition)
773
+ if type(ns.Workbench.RegisterShutdown) == "function" then
774
+ ns.Workbench.RegisterShutdown(definition.shutdown)
775
+ end
776
+ if type(ns.Workbench.RegisterExportHook) == "function" then
777
+ ns.Workbench.RegisterExportHook({ key = "events", GetPayload = BuildEventLogPayload })
778
+ end
779
+ end
780
+ ns.EventsPageDefinition = definition