lycheedev 1.2.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,14 +1,24 @@
1
1
  local ADDON_NAME, ns = ...
2
2
  local L = ns.L
3
3
 
4
+ -- Objects workbench page: bounded path inspection over _G with incremental
5
+ -- text streaming, a live value tree, ranked field search and the mouse picker.
6
+ -- Everything here is read-only toward inspected and Blizzard-owned objects.
4
7
  local ROW_HEIGHT = 38
5
8
  local VISIBLE_ROWS = 16
6
9
  local LIST_WIDTH = 420
7
10
  local TEXT_CHUNK_BYTES = 44000
8
11
  local TEXT_LOAD_THRESHOLD = 80
12
+ local NODE_POPUP_WIDTH = 760
13
+ local NODE_POPUP_HEIGHT = 520
9
14
 
10
- local function CreateLineInput(parent, ui)
11
- local panel = ui.CreatePanel(parent, ui.editorR, ui.editorG, ui.editorB, 1)
15
+ -- The single built page instance; only read by the shell export hook.
16
+ local builtPage
17
+
18
+ local function CreateLineInput(parent)
19
+ local W = ns.Widgets
20
+ local colors = W.Colors
21
+ local panel = W.CreatePanel(parent, colors.editor[1], colors.editor[2], colors.editor[3], 1)
12
22
  local editBox = CreateFrame("EditBox", nil, panel)
13
23
  editBox:SetAutoFocus(false)
14
24
  editBox:SetFontObject(ChatFontNormal)
@@ -16,25 +26,68 @@ local function CreateLineInput(parent, ui)
16
26
  editBox:SetTextInsets(9, 9, 0, 0)
17
27
  editBox:SetPoint("TOPLEFT", 1, -1)
18
28
  editBox:SetPoint("BOTTOMRIGHT", -1, 1)
19
- editBox:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
20
- editBox:SetScript("OnEditFocusGained", function() ui.SetBorderColor(panel, true, 0.75) end)
21
- editBox:SetScript("OnEditFocusLost", function() ui.SetBorderColor(panel, false) end)
29
+ editBox:SetScript("OnEscapePressed", function(self)
30
+ self:ClearFocus()
31
+ end)
32
+ editBox:SetScript("OnEditFocusGained", function()
33
+ W.SetBorderColor(panel, true, 0.75)
34
+ end)
35
+ editBox:SetScript("OnEditFocusLost", function()
36
+ W.SetBorderColor(panel, false)
37
+ end)
22
38
  panel.editBox = editBox
23
39
  return panel
24
40
  end
25
41
 
26
- function ns.CreateObjectPage(parent, ui)
42
+ -- Bounded incremental text: one 44 KB chunk is appended whenever the viewport
43
+ -- scrolls within 80 px of the bottom. Close/teardown releases the stream.
44
+ local function BindIncrementalText(panel, textStream, onProgress)
45
+ local W = ns.Widgets
46
+ panel.serializationStream = textStream
47
+ panel.loadingSerialization = false
48
+
49
+ local function LoadNextChunk()
50
+ local stream = panel.serializationStream
51
+ if panel.loadingSerialization or not stream or stream:IsFinished() then
52
+ return
53
+ end
54
+ panel.loadingSerialization = true
55
+ local chunk, finished = stream:ReadChunk(TEXT_CHUNK_BYTES)
56
+ if chunk ~= "" then
57
+ W.AppendReadOnlyText(panel, chunk)
58
+ end
59
+ panel.loadingSerialization = false
60
+ if onProgress then
61
+ onProgress(#panel.editBox.savedText, finished, stream:WasLimited())
62
+ end
63
+ end
64
+
65
+ panel.scroll.onVerticalScrollChanged = function(offset)
66
+ local range = panel.scroll.verticalRange or 0
67
+ if range - (tonumber(offset) or 0) <= TEXT_LOAD_THRESHOLD then
68
+ LoadNextChunk()
69
+ end
70
+ end
71
+ panel.LoadNextChunk = LoadNextChunk
72
+ end
73
+
74
+ local function BuildObjectPage(parent)
75
+ local W = ns.Widgets
76
+ local colors = W.Colors
77
+ local layout = ns.Workbench.Layout
78
+ local accent = colors.accent
79
+
27
80
  local page = CreateFrame("Frame", nil, parent)
28
81
  page:SetAllPoints(parent)
29
82
 
30
- local mouseButton = ui.CreateButton(page, 118, L.CAPTURE_MOUSE)
83
+ local mouseButton = W.CreateButton(page, 118, L.CAPTURE_MOUSE)
31
84
  mouseButton:SetPoint("TOPRIGHT", -14, -84)
32
- local searchButton = ui.CreateButton(page, 82, L.SEARCH)
85
+ local searchButton = W.CreateButton(page, 82, L.SEARCH)
33
86
  searchButton:SetPoint("RIGHT", mouseButton, "LEFT", -8, 0)
34
- local inspectButton = ui.CreateButton(page, 82, L.INSPECT, true)
87
+ local inspectButton = W.CreateButton(page, 82, L.INSPECT, "primary")
35
88
  inspectButton:SetPoint("RIGHT", searchButton, "LEFT", -8, 0)
36
89
 
37
- local pathPanel = CreateLineInput(page, ui)
90
+ local pathPanel = CreateLineInput(page)
38
91
  pathPanel:SetPoint("TOPLEFT", 14, -84)
39
92
  pathPanel:SetPoint("TOPRIGHT", inspectButton, "TOPLEFT", -8, 0)
40
93
  pathPanel:SetHeight(30)
@@ -59,38 +112,9 @@ function ns.CreateObjectPage(parent, ui)
59
112
  statusDot:SetColorTexture(r, g, b, 0.92)
60
113
  end
61
114
 
62
- local function BindIncrementalText(panel, textStream, onProgress)
63
- panel.serializationStream = textStream
64
- panel.loadingSerialization = false
65
-
66
- local function LoadNextChunk()
67
- local stream = panel.serializationStream
68
- if panel.loadingSerialization or not stream or stream:IsFinished() then
69
- return
70
- end
71
- panel.loadingSerialization = true
72
- local chunk, finished = stream:ReadChunk(TEXT_CHUNK_BYTES)
73
- if chunk ~= "" then
74
- ui.AppendReadOnlyText(panel, chunk)
75
- end
76
- panel.loadingSerialization = false
77
- if onProgress then
78
- onProgress(#panel.editBox.savedText, finished, stream:WasLimited())
79
- end
80
- end
81
-
82
- panel.scroll.onVerticalScrollChanged = function(offset)
83
- local range = panel.scroll.verticalRange or 0
84
- if range - (tonumber(offset) or 0) <= TEXT_LOAD_THRESHOLD then
85
- LoadNextChunk()
86
- end
87
- end
88
- panel.LoadNextChunk = LoadNextChunk
89
- end
90
-
91
- local listLabel = ui.CreateSectionLabel(page, L.SEARCH_RESULTS)
115
+ local listLabel = W.CreateSectionLabel(page, L.SEARCH_RESULTS)
92
116
  listLabel:SetPoint("TOPLEFT", 17, -161)
93
- local detailLabel = ui.CreateSectionLabel(page, L.OBJECT_SNAPSHOT)
117
+ local detailLabel = W.CreateSectionLabel(page, L.OBJECT_SNAPSHOT)
94
118
  detailLabel:SetPoint("TOPLEFT", LIST_WIDTH + 29, -161)
95
119
 
96
120
  local treeHint = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
@@ -98,11 +122,11 @@ function ns.CreateObjectPage(parent, ui)
98
122
  treeHint:SetText(L.TREE_CONTEXT_HINT)
99
123
  treeHint:SetTextColor(1, 1, 1, 0.32)
100
124
 
101
- local listPanel = ui.CreatePanel(page, ui.editorR, ui.editorG, ui.editorB, 0.78)
125
+ local listPanel = W.CreatePanel(page, colors.editor[1], colors.editor[2], colors.editor[3], 0.78)
102
126
  listPanel:SetPoint("TOPLEFT", 14, -181)
103
127
  listPanel:SetPoint("BOTTOMLEFT", 14, 54)
104
128
  listPanel:SetWidth(LIST_WIDTH)
105
- local listScroll = ui.CreateScrollArea(listPanel, 8, 8, 7, 8)
129
+ local listScroll = W.CreateScrollArea(listPanel, 8, 8, 7, 8)
106
130
  local listContent = CreateFrame("Frame", nil, listScroll)
107
131
  listContent:SetWidth(LIST_WIDTH - 26)
108
132
  listContent:SetHeight(1)
@@ -112,28 +136,25 @@ function ns.CreateObjectPage(parent, ui)
112
136
  empty:SetText(L.NO_SEARCH_RESULTS)
113
137
  empty:SetTextColor(1, 1, 1, 0.32)
114
138
 
115
- local treeView = ns.CreateTreeView(page, {
116
- CreatePanel = ui.CreatePanel,
117
- CreateScrollArea = ui.CreateScrollArea,
118
- editorR = ui.editorR, editorG = ui.editorG, editorB = ui.editorB,
119
- surfaceR = ui.surfaceR, surfaceG = ui.surfaceG, surfaceB = ui.surfaceB,
120
- accentR = ui.accentR, accentG = ui.accentG, accentB = ui.accentB,
121
- contentWidth = ui.windowWidth - LIST_WIDTH - 54,
139
+ local treeView = ns.TreeView.Create(page, {
140
+ contentWidth = layout.WINDOW_WIDTH - LIST_WIDTH - 54,
122
141
  })
123
142
  treeView.panel:SetPoint("TOPLEFT", LIST_WIDTH + 26, -181)
124
143
  treeView.panel:SetPoint("BOTTOMRIGHT", -14, 54)
125
144
 
126
- local textView = ui.CreateTextArea(page, true)
145
+ local textView = W.CreateTextArea(page, true)
127
146
  textView:SetPoint("TOPLEFT", LIST_WIDTH + 26, -181)
128
147
  textView:SetPoint("BOTTOMRIGHT", -14, 54)
129
- textView.editBox:SetWidth(ui.windowWidth - LIST_WIDTH - 78)
130
- textView.editBox:SetScript("OnMouseUp", function(self) self:SetFocus() end)
148
+ textView.editBox:SetWidth(layout.WINDOW_WIDTH - LIST_WIDTH - 78)
149
+ textView.editBox:SetScript("OnMouseUp", function(self)
150
+ self:SetFocus()
151
+ end)
131
152
 
132
- local textModeButton = ui.CreateViewTab(page, L.TEXT)
133
- ui.FitViewTab(textModeButton, 58, 28)
153
+ local textModeButton = W.CreateNavTab(page, L.TEXT)
154
+ W.FitNavTab(textModeButton, 58, 28)
134
155
  textModeButton:SetPoint("TOPRIGHT", -14, -150)
135
- local treeModeButton = ui.CreateViewTab(page, L.TREE)
136
- ui.FitViewTab(treeModeButton, 58, 28)
156
+ local treeModeButton = W.CreateNavTab(page, L.TREE)
157
+ W.FitNavTab(treeModeButton, 58, 28)
137
158
  treeModeButton:SetPoint("RIGHT", textModeButton, "LEFT", -2, 0)
138
159
  local snapshotMode = "tree"
139
160
  local function SetSnapshotMode(mode)
@@ -147,14 +168,14 @@ function ns.CreateObjectPage(parent, ui)
147
168
  treeModeButton:SetScript("OnClick", function() SetSnapshotMode("tree") end)
148
169
  textModeButton:SetScript("OnClick", function() SetSnapshotMode("text") end)
149
170
 
150
- local selectSnapshot = ui.CreateButton(page, 132, L.SELECT_LOADED_TEXT, false)
171
+ local selectSnapshot = W.CreateButton(page, 132, L.SELECT_LOADED_TEXT, false)
151
172
  selectSnapshot:SetPoint("BOTTOMRIGHT", -14, 14)
152
173
  selectSnapshot:SetScript("OnClick", function()
153
174
  SetSnapshotMode("text")
154
- textView:SelectAll()
175
+ W.SelectAllText(textView)
155
176
  end)
156
177
 
157
- local exportSnapshot = ui.CreateButton(page, 92, L.SAVE_TO_DISK, false)
178
+ local exportSnapshot = W.CreateButton(page, 92, L.SAVE_TO_DISK, false)
158
179
  exportSnapshot:SetPoint("RIGHT", selectSnapshot, "LEFT", -8, 0)
159
180
  page.inspectButton = inspectButton
160
181
  page.searchButton = searchButton
@@ -163,6 +184,8 @@ function ns.CreateObjectPage(parent, ui)
163
184
  page.exportSnapshot = exportSnapshot
164
185
  page.treeView = treeView
165
186
  page.textView = textView
187
+ page.pathPanel = pathPanel
188
+ page.listPanel = listPanel
166
189
 
167
190
  local pickerDock
168
191
  local pickerPrompt
@@ -192,13 +215,13 @@ function ns.CreateObjectPage(parent, ui)
192
215
  return nodePopup
193
216
  end
194
217
 
195
- local overlay = ui.CreatePanel(page, 0, 0, 0, 0.76)
218
+ local overlay = W.CreatePanel(page, 0, 0, 0, 0.76)
196
219
  overlay:SetAllPoints(page)
197
220
  overlay:SetFrameLevel(page:GetFrameLevel() + 40)
198
221
  overlay:EnableMouse(true)
199
222
 
200
- local panel = ui.CreatePanel(overlay, ui.surfaceR, ui.surfaceG, ui.surfaceB, 1)
201
- panel:SetSize(760, 520)
223
+ local panel = W.CreatePanel(overlay, colors.surface[1], colors.surface[2], colors.surface[3], 1)
224
+ panel:SetSize(NODE_POPUP_WIDTH, NODE_POPUP_HEIGHT)
202
225
  panel:SetPoint("CENTER")
203
226
  panel:SetFrameLevel(overlay:GetFrameLevel() + 1)
204
227
 
@@ -213,34 +236,42 @@ function ns.CreateObjectPage(parent, ui)
213
236
  path:SetWordWrap(false)
214
237
  path:SetTextColor(1, 1, 1, 0.42)
215
238
 
216
- local textPanel = ui.CreateTextArea(panel, true)
239
+ local textPanel = W.CreateTextArea(panel, true)
217
240
  textPanel:SetPoint("TOPLEFT", 14, -66)
218
241
  textPanel:SetPoint("BOTTOMRIGHT", -14, 56)
219
- textPanel.editBox:SetWidth(712)
242
+ textPanel.editBox:SetWidth(NODE_POPUP_WIDTH - 48)
220
243
 
221
244
  local progress = panel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
222
245
  progress:SetPoint("BOTTOMLEFT", 18, 21)
223
246
  progress:SetTextColor(1, 1, 1, 0.36)
224
247
 
225
- local closeButton = ui.CreateButton(panel, 82, L.CLOSE, false)
248
+ local closeButton = W.CreateButton(panel, 82, L.CLOSE, false)
226
249
  closeButton:SetPoint("BOTTOMRIGHT", -14, 14)
227
250
  closeButton:SetScript("OnClick", function()
228
251
  overlay:Hide()
252
+ -- Closing releases the incremental stream immediately.
229
253
  BindIncrementalText(textPanel, nil)
230
254
  end)
231
255
 
232
- local selectButton = ui.CreateButton(panel, 118, L.SELECT_LOADED_TEXT, false)
256
+ local selectButton = W.CreateButton(panel, 118, L.SELECT_LOADED_TEXT, false)
233
257
  selectButton:SetPoint("RIGHT", closeButton, "LEFT", -8, 0)
234
- selectButton:SetScript("OnClick", function() textPanel:SelectAll() end)
258
+ selectButton:SetScript("OnClick", function()
259
+ W.SelectAllText(textPanel)
260
+ end)
235
261
 
236
- local exportButton = ui.CreateButton(panel, 92, L.SAVE_TO_DISK, false)
262
+ local exportButton = W.CreateButton(panel, 92, L.SAVE_TO_DISK, false)
237
263
  exportButton:SetPoint("RIGHT", selectButton, "LEFT", -8, 0)
238
264
  exportButton:SetScript("OnClick", function()
265
+ if ns.Safety.IsCombatBlocked() then
266
+ ns.Safety.PrintBlocked()
267
+ return
268
+ end
239
269
  local nodePath = path:GetText()
240
- ui.ExportText("object_node", nodePath, function()
241
- return ns.SerializeForExport(nodePopup.source)
270
+ ns.Workbench.SaveToDisk("object_node", nodePath, function()
271
+ local text = ns.Serializer.SerializeForExport(nodePopup.source)
272
+ return text
242
273
  end, {
243
- path = path:GetText(),
274
+ path = nodePath,
244
275
  valueType = type(nodePopup.source),
245
276
  })
246
277
  end)
@@ -259,16 +290,20 @@ function ns.CreateObjectPage(parent, ui)
259
290
  end
260
291
 
261
292
  local function OpenNodePopup(node)
293
+ if ns.Safety.IsCombatBlocked() then
294
+ ns.Safety.PrintBlocked()
295
+ return
296
+ end
262
297
  if not node or not node.exportable then
263
298
  return
264
299
  end
265
300
  local popup = EnsureNodePopup()
266
301
  local nodePath = GetNodePath(node)
267
302
  popup.source = node.source
268
- local stream = ns.CreateSerializationStream(node.source)
303
+ local stream = ns.Serializer.CreateStream(node.source)
269
304
  local serialized, finished = stream:ReadChunk(TEXT_CHUNK_BYTES)
270
305
  popup.path:SetText(nodePath)
271
- ui.SetReadOnlyText(popup.textPanel,
306
+ W.SetReadOnlyText(popup.textPanel,
272
307
  string.format(L.OBJECT_TEXT_HEADER, nodePath, type(node.source)) .. "\n" .. serialized)
273
308
  local function UpdateProgress(bytes, isFinished, limited)
274
309
  popup.progress:SetText(string.format(isFinished and L.TEXT_LOADED_COMPLETE or L.TEXT_LOADED_MORE,
@@ -285,24 +320,29 @@ function ns.CreateObjectPage(parent, ui)
285
320
  treeView:SetOnNodeContext(OpenNodePopup)
286
321
 
287
322
  exportSnapshot:SetScript("OnClick", function()
288
- local label = currentLabel or L.OBJECT_SNAPSHOT
289
- ui.ExportText("object_snapshot", label, function()
290
- return ns.SerializeForExport(currentValue)
291
- end, { path = currentLabel or "", valueType = type(currentValue) })
323
+ if ns.Safety.IsCombatBlocked() then
324
+ ns.Safety.PrintBlocked()
325
+ return
326
+ end
327
+ local kind, title, content, metadata = page.GetSnapshotPayload()
328
+ if not kind then
329
+ return
330
+ end
331
+ ns.Workbench.SaveToDisk(kind, title, content, metadata)
292
332
  end)
293
333
 
294
334
  local function CompletePicker()
295
335
  local succeeded, inspection, errorMessage = ns.ObjectInspector.CaptureMouseFocus()
296
336
  StopPicker(false)
297
- if ns.IsCombatBlocked() then
337
+ if ns.Safety.IsCombatBlocked() then
298
338
  return
299
339
  end
300
- parent:Show()
340
+ ns.Workbench.Open()
301
341
  if succeeded then
302
342
  pathPanel.editBox:SetText("")
303
343
  ShowInspection(inspection)
304
344
  else
305
- SetStatus(errorMessage or L.NO_MOUSE_FOCUS, ui.accentR, ui.accentG, ui.accentB)
345
+ SetStatus(errorMessage or L.NO_MOUSE_FOCUS, accent[1], accent[2], accent[3])
306
346
  end
307
347
  end
308
348
 
@@ -311,19 +351,19 @@ function ns.CreateObjectPage(parent, ui)
311
351
  return
312
352
  end
313
353
 
314
- pickerDock = CreateFrame("Button", "LycheeDevPickerDock", UIParent, "BackdropTemplate")
354
+ pickerDock = CreateFrame("Button", "LycheeToolkitPickerDock", UIParent, "BackdropTemplate")
315
355
  pickerDock:SetSize(48, 48)
316
356
  pickerDock:SetPoint("TOP", UIParent, "TOP", 0, -36)
317
357
  pickerDock:SetFrameStrata("TOOLTIP")
318
358
  pickerDock:SetClampedToScreen(true)
319
359
 
320
360
  local logo = pickerDock:CreateTexture(nil, "ARTWORK")
321
- logo:SetTexture("Interface\\AddOns\\" .. ADDON_NAME .. "\\Media\\Logo.png")
361
+ logo:SetTexture(W.LOGO_TEXTURE)
322
362
  logo:SetTexCoord(0.18, 0.79, 0.17, 0.80)
323
363
  logo:SetPoint("TOPLEFT", 5, -5)
324
364
  logo:SetPoint("BOTTOMRIGHT", -5, 5)
325
365
 
326
- pickerPrompt = ui.CreatePanel(pickerDock, ui.editorR, ui.editorG, ui.editorB, 0.98)
366
+ pickerPrompt = W.CreatePanel(pickerDock, colors.editor[1], colors.editor[2], colors.editor[3], 0.98)
327
367
  pickerPrompt:SetPoint("TOP", pickerDock, "BOTTOM", 0, -7)
328
368
  pickerPrompt:SetSize(220, 28)
329
369
  pickerPrompt:SetFrameLevel(pickerDock:GetFrameLevel() + 1)
@@ -343,26 +383,29 @@ function ns.CreateObjectPage(parent, ui)
343
383
  pickerActive = false
344
384
  if pickerDock then
345
385
  pickerDock:SetScript("OnKeyDown", nil)
346
- if not ns.IsCombatBlocked() then
386
+ if not ns.Safety.IsCombatBlocked() then
347
387
  pickerDock:EnableKeyboard(false)
348
388
  end
349
389
  pickerDock:Hide()
350
390
  pickerPrompt:Hide()
351
391
  end
352
- if restoreWindow and not ns.IsCombatBlocked() then
353
- parent:Show()
392
+ if restoreWindow and not ns.Safety.IsCombatBlocked() then
393
+ ns.Workbench.Open()
354
394
  SetStatus(statusText or L.PICKER_CANCELLED, 0.55, 0.60, 0.65)
355
395
  end
356
396
  end
357
397
 
358
398
  local function StartPicker()
359
- if ns.IsCombatBlocked() then
360
- SetStatus(L.COMBAT_BLOCKED, ui.accentR, ui.accentG, ui.accentB)
399
+ if ns.Safety.IsCombatBlocked() then
400
+ SetStatus(L.COMBAT_BLOCKED, accent[1], accent[2], accent[3])
361
401
  return
362
402
  end
363
403
  EnsurePickerDock()
364
404
  SetStatus(L.PICKER_ACTIVE, 0.42, 0.76, 0.43)
365
- parent:Hide()
405
+ -- Hiding the window runs the shared teardown first (see the picker
406
+ -- restart below); the picker itself is set up afterwards so it
407
+ -- survives that teardown exactly like the legacy picker did.
408
+ ns.Workbench.Close()
366
409
  pickerActive = true
367
410
  pickerDock:EnableKeyboard(true)
368
411
  pickerDock:SetScript("OnKeyDown", function(self, key)
@@ -383,15 +426,16 @@ function ns.CreateObjectPage(parent, ui)
383
426
 
384
427
  local results = {}
385
428
  local rows = {}
429
+ page.resultRows = rows
386
430
  ShowInspection = function(inspection)
387
431
  currentValue = inspection.value
388
432
  currentLabel = inspection.label
389
433
  treeView:SetTree(inspection.tree)
390
- ui.SetReadOnlyText(textView, inspection.text)
434
+ W.SetReadOnlyText(textView, inspection.text)
391
435
  if inspection.textStream then
392
436
  BindIncrementalText(textView, inspection.textStream, function(bytes, finished, limited)
393
437
  if finished and limited then
394
- SetStatus(L.TEXT_LIMIT_REACHED, ui.accentR, ui.accentG, ui.accentB)
438
+ SetStatus(L.TEXT_LIMIT_REACHED, accent[1], accent[2], accent[3])
395
439
  elseif finished then
396
440
  SetStatus(string.format(L.OBJECT_READY, inspection.label, inspection.valueType),
397
441
  0.42, 0.76, 0.43)
@@ -404,8 +448,8 @@ function ns.CreateObjectPage(parent, ui)
404
448
  BindIncrementalText(textView, nil)
405
449
  end
406
450
  SetSnapshotMode("tree")
407
- ui.SetButtonEnabled(selectSnapshot, true)
408
- ui.SetButtonEnabled(exportSnapshot, true)
451
+ W.SetButtonEnabled(selectSnapshot, true)
452
+ W.SetButtonEnabled(exportSnapshot, true)
409
453
  local readyText = L.OBJECT_READY
410
454
  if inspection.textStream and not inspection.textStream:IsFinished() then
411
455
  readyText = L.OBJECT_READY_MORE
@@ -419,23 +463,20 @@ function ns.CreateObjectPage(parent, ui)
419
463
  pathPanel.editBox:SetText(path)
420
464
  ShowInspection(inspection)
421
465
  else
422
- SetStatus(errorMessage or L.OBJECT_NOT_FOUND, ui.accentR, ui.accentG, ui.accentB)
466
+ SetStatus(errorMessage or L.OBJECT_NOT_FOUND, accent[1], accent[2], accent[3])
423
467
  end
424
468
  end
425
469
 
426
- local function ChildPath(root, key)
427
- if key:match("^[_%a][_%w]*$") then return root .. "." .. key end
428
- return root .. "[" .. string.format("%q", key) .. "]"
429
- end
430
-
431
470
  local function ResultPath(root, result)
432
471
  local path = result.path or result.key
433
- if path:sub(1, 1) == "[" then return root .. path end
472
+ if path:sub(1, 1) == "[" then
473
+ return root .. path
474
+ end
434
475
  return root .. "." .. path
435
476
  end
436
477
 
437
478
  local function CreateRow(index)
438
- local row = ui.CreateListRow(listContent, ROW_HEIGHT)
479
+ local row = W.CreateListRow(listContent, ROW_HEIGHT)
439
480
  row:SetWidth(LIST_WIDTH - 26)
440
481
  local name = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
441
482
  name:SetPoint("TOPLEFT", 9, -6)
@@ -452,21 +493,27 @@ function ns.CreateObjectPage(parent, ui)
452
493
  row.preview = preview
453
494
  row:SetScript("OnEnter", function(self)
454
495
  self.isHovered = true
455
- ui.SetListRowState(self, false, true)
496
+ W.SetListRowState(self, false, true)
456
497
  end)
457
498
  row:SetScript("OnLeave", function(self)
458
499
  self.isHovered = nil
459
- ui.SetListRowState(self, false, false)
500
+ W.SetListRowState(self, false, false)
460
501
  end)
461
502
  row:SetScript("OnClick", function(self)
462
- if not self.result then return end
503
+ if ns.Safety.IsCombatBlocked() then
504
+ ns.Safety.PrintBlocked()
505
+ return
506
+ end
507
+ if not self.result then
508
+ return
509
+ end
463
510
  local label = ResultPath(searchRootLabel or currentLabel or "_G", self.result)
464
511
  local succeeded, inspection, errorMessage = ns.ObjectInspector.InspectValue(self.result.value, label)
465
512
  if succeeded then
466
513
  pathPanel.editBox:SetText("")
467
514
  ShowInspection(inspection)
468
515
  else
469
- SetStatus(errorMessage or L.OBJECT_NOT_FOUND, ui.accentR, ui.accentG, ui.accentB)
516
+ SetStatus(errorMessage or L.OBJECT_NOT_FOUND, accent[1], accent[2], accent[3])
470
517
  end
471
518
  end)
472
519
  rows[index] = row
@@ -474,9 +521,13 @@ function ns.CreateObjectPage(parent, ui)
474
521
  end
475
522
 
476
523
  local function RefreshResults()
477
- for index = 1, #rows do rows[index]:Hide() end
524
+ for index = 1, #rows do
525
+ rows[index]:Hide()
526
+ end
478
527
  local offset = listScroll:GetVerticalScroll()
479
- if issecretvalue and issecretvalue(offset) then offset = 0 end
528
+ if issecretvalue and issecretvalue(offset) then
529
+ offset = 0
530
+ end
480
531
  local first = math.floor((offset or 0) / ROW_HEIGHT) + 1
481
532
  local last = math.min(#results, first + VISIBLE_ROWS - 1)
482
533
  local pool = 0
@@ -489,7 +540,7 @@ function ns.CreateObjectPage(parent, ui)
489
540
  row:SetPoint("TOPLEFT", 0, -((resultIndex - 1) * ROW_HEIGHT))
490
541
  row.name:SetText(result.path or result.key)
491
542
  row.preview:SetText(result.valueType .. " " .. result.preview)
492
- ui.SetListRowState(row, false, row.isHovered)
543
+ W.SetListRowState(row, false, row.isHovered)
493
544
  row:Show()
494
545
  end
495
546
  listContent:SetHeight(math.max(1, #results * ROW_HEIGHT))
@@ -498,9 +549,20 @@ function ns.CreateObjectPage(parent, ui)
498
549
  end
499
550
  listScroll.onVerticalScrollChanged = RefreshResults
500
551
 
501
- inspectButton:SetScript("OnClick", function() InspectPath(pathPanel.editBox:GetText()) end)
552
+ inspectButton:SetScript("OnClick", function()
553
+ if ns.Safety.IsCombatBlocked() then
554
+ SetStatus(L.COMBAT_BLOCKED, accent[1], accent[2], accent[3])
555
+ return
556
+ end
557
+ InspectPath(pathPanel.editBox:GetText())
558
+ end)
502
559
  mouseButton:SetScript("OnClick", StartPicker)
560
+
503
561
  local function Search()
562
+ if ns.Safety.IsCombatBlocked() then
563
+ SetStatus(L.COMBAT_BLOCKED, accent[1], accent[2], accent[3])
564
+ return
565
+ end
504
566
  local query = pathPanel.editBox:GetText()
505
567
  local succeeded, searchResult, errorMessage
506
568
  local searchedGlobal = currentValue == nil
@@ -522,7 +584,7 @@ function ns.CreateObjectPage(parent, ui)
522
584
  or string.format(L.MATCH_COUNT, searchResult.totalMatches)
523
585
  SetStatus(message, 0.55, 0.60, 0.65)
524
586
  else
525
- SetStatus(errorMessage, ui.accentR, ui.accentG, ui.accentB)
587
+ SetStatus(errorMessage, accent[1], accent[2], accent[3])
526
588
  end
527
589
  end
528
590
  searchButton:SetScript("OnClick", Search)
@@ -538,20 +600,39 @@ function ns.CreateObjectPage(parent, ui)
538
600
  end)
539
601
  pathPanel.editBox:SetScript("OnEditFocusGained", function()
540
602
  inputHint:Hide()
541
- ui.SetBorderColor(pathPanel, true, 0.75)
603
+ W.SetBorderColor(pathPanel, true, 0.75)
542
604
  end)
543
605
  pathPanel.editBox:SetScript("OnEditFocusLost", function(self)
544
606
  inputHint:SetShown(self:GetText() == "")
545
- ui.SetBorderColor(pathPanel, false)
607
+ W.SetBorderColor(pathPanel, false)
546
608
  end)
547
609
 
548
- function page:Activate()
610
+ function page:GetSelection()
611
+ return currentValue, currentLabel
612
+ end
613
+
614
+ -- One payload builder shared by the page Save button and the shell export
615
+ -- hook; both funnel into the single export UI. The serialized payload is
616
+ -- the full captured value, not the visible text.
617
+ function page.GetSnapshotPayload()
618
+ if currentValue == nil then
619
+ return nil
620
+ end
621
+ local value, label = currentValue, currentLabel or ""
622
+ return "object_snapshot", currentLabel or L.OBJECT_SNAPSHOT, function()
623
+ local text = ns.Serializer.SerializeForExport(value)
624
+ return text
625
+ end, { path = label, valueType = type(value) }
626
+ end
627
+
628
+ function page.HandleActivate()
549
629
  if pickerActive then
550
630
  StopPicker(false)
551
631
  end
552
632
  pathPanel.editBox:SetFocus()
553
633
  end
554
- function page:Stop()
634
+
635
+ function page.HandleShutdown()
555
636
  StopPicker(false)
556
637
  BindIncrementalText(textView, nil)
557
638
  if nodePopup then
@@ -559,15 +640,42 @@ function ns.CreateObjectPage(parent, ui)
559
640
  BindIncrementalText(nodePopup.textPanel, nil)
560
641
  end
561
642
  end
562
- function page:GetSelection()
563
- return currentValue, currentLabel
564
- end
643
+
565
644
  SetStatus(L.READY, 0.55, 0.60, 0.65)
566
645
  treeView:SetTree(nil)
567
- ui.SetReadOnlyText(textView, "")
568
- ui.SetButtonEnabled(selectSnapshot, false)
569
- ui.SetButtonEnabled(exportSnapshot, false)
646
+ W.SetReadOnlyText(textView, "")
647
+ W.SetButtonEnabled(selectSnapshot, false)
648
+ W.SetButtonEnabled(exportSnapshot, false)
570
649
  SetSnapshotMode("tree")
571
650
  RefreshResults()
651
+ builtPage = page
572
652
  return page
573
653
  end
654
+
655
+ ns.Workbench.RegisterPage({
656
+ key = "objects",
657
+ titleKey = "TAB_OBJECTS",
658
+ build = BuildObjectPage,
659
+ activate = function(page)
660
+ if page and page.HandleActivate then
661
+ page:HandleActivate()
662
+ end
663
+ end,
664
+ shutdown = function(page)
665
+ if page and page.HandleShutdown then
666
+ page:HandleShutdown()
667
+ end
668
+ end,
669
+ })
670
+
671
+ -- Shell-level Save provider: the captured snapshot. The node text popup owns
672
+ -- its own object_node Save. Every Save funnels through the one export UI.
673
+ ns.Workbench.RegisterExportHook({
674
+ key = "objects",
675
+ GetPayload = function()
676
+ if not builtPage then
677
+ return nil
678
+ end
679
+ return builtPage.GetSnapshotPayload()
680
+ end,
681
+ })