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,20 +1,33 @@
1
1
  local ADDON_NAME, ns = ...
2
2
 
3
+ -- Read-only object inspection over _G paths and captured values. Every read of
4
+ -- an inspected object is bounded and passive: tables are read with rawget,
5
+ -- non-tables are indexed under pcall, and nothing is ever written back to an
6
+ -- inspected or Blizzard-owned object.
3
7
  local inspector = {}
4
8
  local MAX_SEARCH_RESULTS = 200
5
9
  local MAX_SEARCH_SCANS = 10000
6
10
  local MAX_SEARCH_NODES = 2000
7
11
  local MAX_SEARCH_DEPTH = 6
8
12
  local MAX_PREVIEW_BYTES = 120
13
+ local MAX_TEXT_CHUNK_BYTES = 44000
9
14
 
10
15
  local function IsSecret(value)
11
16
  return issecretvalue and issecretvalue(value)
12
17
  end
13
18
 
19
+ local function IsCombatBlocked()
20
+ return ns.Safety.IsCombatBlocked()
21
+ end
22
+
14
23
  local function Trim(text)
24
+ if IsSecret(text) then
25
+ return ""
26
+ end
15
27
  return tostring(text or ""):match("^%s*(.-)%s*$")
16
28
  end
17
29
 
30
+ -- Path grammar: identifier | .identifier | [int] | ["str"] | ['str'] over _G.
18
31
  local function ParsePath(path)
19
32
  path = Trim(path)
20
33
  if path == "" then
@@ -89,7 +102,9 @@ local function ResolveTokens(tokens, count)
89
102
  end
90
103
 
91
104
  local function SafePreview(value)
92
- if IsSecret(value) then return "<secret>" end
105
+ if IsSecret(value) then
106
+ return "<secret>"
107
+ end
93
108
  local valueType = type(value)
94
109
  local text
95
110
  if valueType == "string" then
@@ -106,20 +121,32 @@ local function SafePreview(value)
106
121
  end
107
122
 
108
123
  local function SafeMethod(value, methodName)
109
- if IsSecret(value) then return nil end
124
+ if IsSecret(value) then
125
+ return nil
126
+ end
110
127
  local methodSucceeded, method = pcall(function() return value[methodName] end)
111
- if not methodSucceeded or type(method) ~= "function" then return nil end
128
+ if not methodSucceeded or type(method) ~= "function" then
129
+ return nil
130
+ end
112
131
  local succeeded, result = pcall(method, value)
113
- if not succeeded or IsSecret(result) then return nil end
132
+ if not succeeded or IsSecret(result) then
133
+ return nil
134
+ end
114
135
  return result
115
136
  end
116
137
 
117
138
  local function SafeMethodResults(value, methodName)
118
- if IsSecret(value) then return nil end
139
+ if IsSecret(value) then
140
+ return nil
141
+ end
119
142
  local methodSucceeded, method = pcall(function() return value[methodName] end)
120
- if not methodSucceeded or type(method) ~= "function" then return nil end
143
+ if not methodSucceeded or type(method) ~= "function" then
144
+ return nil
145
+ end
121
146
  local packed = { pcall(method, value) }
122
- if not packed[1] then return nil end
147
+ if not packed[1] then
148
+ return nil
149
+ end
123
150
  local results = {}
124
151
  for index = 2, #packed do
125
152
  if packed[index] ~= nil and not IsSecret(packed[index]) then
@@ -130,16 +157,23 @@ local function SafeMethodResults(value, methodName)
130
157
  end
131
158
 
132
159
  local function IsScriptRegion(value)
133
- if IsSecret(value) then return false end
160
+ if IsSecret(value) then
161
+ return false
162
+ end
134
163
  local succeeded, method = pcall(function() return value.GetObjectType end)
135
164
  return succeeded and type(method) == "function"
136
165
  end
137
166
 
167
+ -- One inspection = label + type + bounded preview + bounded text snapshot with
168
+ -- its incremental stream + a live value tree. Frame targets gain the UI object
169
+ -- overview/children/regions nodes through the tree builder.
138
170
  local function BuildInspection(value, label)
139
- if IsSecret(value) then return nil, ns.L.SECRET_VALUE_BLOCKED end
171
+ if IsSecret(value) then
172
+ return nil, ns.L.SECRET_VALUE_BLOCKED
173
+ end
140
174
  local isFrame = IsScriptRegion(value)
141
- local textStream = ns.CreateSerializationStream(value)
142
- local serialized = textStream:ReadChunk()
175
+ local textStream = ns.Serializer.CreateStream(value)
176
+ local serialized = textStream:ReadChunk(MAX_TEXT_CHUNK_BYTES)
143
177
  return {
144
178
  label = label,
145
179
  valueType = type(value),
@@ -148,45 +182,61 @@ local function BuildInspection(value, label)
148
182
  isFrame = isFrame,
149
183
  text = string.format(ns.L.OBJECT_TEXT_HEADER, label or "", type(value)) .. "\n" .. serialized,
150
184
  textStream = textStream,
151
- tree = ns.CreateValueTree({ n = 1, value }),
185
+ tree = ns.Inspector.CreateLiveTree({ n = 1, value }),
152
186
  }
153
187
  end
154
188
 
155
189
  function inspector.ResolvePath(path)
156
190
  local tokens, errorMessage = ParsePath(path)
157
- if not tokens then return false, nil, errorMessage end
191
+ if not tokens then
192
+ return false, nil, errorMessage
193
+ end
158
194
  return ResolveTokens(tokens)
159
195
  end
160
196
 
197
+ -- Function targets must end in a string key: the key names the hooked method
198
+ -- and the rest of the path resolves to its owner table.
161
199
  function inspector.ResolveFunctionTarget(path)
162
200
  local tokens, errorMessage = ParsePath(path)
163
- if not tokens then return false, nil, nil, errorMessage end
201
+ if not tokens then
202
+ return false, nil, nil, errorMessage
203
+ end
164
204
  if #tokens == 0 or type(tokens[#tokens]) ~= "string" then
165
205
  return false, nil, nil, ns.L.FUNCTION_PATH_INVALID
166
206
  end
167
207
  local key = tokens[#tokens]
168
208
  local succeeded, owner, resolveError = ResolveTokens(tokens, #tokens - 1)
169
- if not succeeded then return false, nil, nil, resolveError end
209
+ if not succeeded then
210
+ return false, nil, nil, resolveError
211
+ end
170
212
  return true, owner, key
171
213
  end
172
214
 
173
215
  function inspector.InspectPath(path)
174
- if ns.IsCombatBlocked() then return false, nil, ns.L.COMBAT_BLOCKED end
216
+ if IsCombatBlocked() then
217
+ return false, nil, ns.L.COMBAT_BLOCKED
218
+ end
175
219
  local succeeded, value, errorMessage = inspector.ResolvePath(path)
176
- if not succeeded then return false, nil, errorMessage end
220
+ if not succeeded then
221
+ return false, nil, errorMessage
222
+ end
177
223
  local inspection, inspectError = BuildInspection(value, Trim(path))
178
224
  return inspection ~= nil, inspection, inspectError
179
225
  end
180
226
 
181
227
  function inspector.InspectValue(value, label)
182
- if ns.IsCombatBlocked() then return false, nil, ns.L.COMBAT_BLOCKED end
228
+ if IsCombatBlocked() then
229
+ return false, nil, ns.L.COMBAT_BLOCKED
230
+ end
183
231
  local inspection, inspectError = BuildInspection(value, Trim(label))
184
232
  return inspection ~= nil, inspection, inspectError
185
233
  end
186
234
 
187
235
  function inspector.CaptureMouseFocus()
188
- if ns.IsCombatBlocked() then return false, nil, ns.L.COMBAT_BLOCKED end
189
- local focus = ns.Client.GetMouseFocus()
236
+ if IsCombatBlocked() then
237
+ return false, nil, ns.L.COMBAT_BLOCKED
238
+ end
239
+ local focus = ns.Compat.GetMouseFocus()
190
240
  if not focus then
191
241
  return false, nil, ns.L.NO_MOUSE_FOCUS
192
242
  end
@@ -195,18 +245,30 @@ function inspector.CaptureMouseFocus()
195
245
  end
196
246
 
197
247
  function inspector.GetMouseFocusLabel()
198
- if ns.IsCombatBlocked() then return false, nil, nil, ns.L.COMBAT_BLOCKED end
199
- local focus = ns.Client.GetMouseFocus()
200
- if not focus then return false, nil, nil, ns.L.NO_MOUSE_FOCUS end
248
+ if IsCombatBlocked() then
249
+ return false, nil, nil, ns.L.COMBAT_BLOCKED
250
+ end
251
+ local focus = ns.Compat.GetMouseFocus()
252
+ if not focus then
253
+ return false, nil, nil, ns.L.NO_MOUSE_FOCUS
254
+ end
201
255
  return true,
202
256
  SafeMethod(focus, "GetName") or SafePreview(focus),
203
257
  SafeMethod(focus, "GetObjectType") or type(focus)
204
258
  end
205
259
 
260
+ -- Case-insensitive key substring search ranked exact -> prefix -> contains,
261
+ -- each bucket key-sorted. Bounds: 200 results / 10000 scans / 2000 visited
262
+ -- nodes / depth 6. Secret keys and values are skipped; the walk descends
263
+ -- tables, GetChildren/GetRegions results and metatable.__index tables.
206
264
  function inspector.SearchValue(value, query, limit, maxDepth)
207
- if ns.IsCombatBlocked() then return false, nil, ns.L.COMBAT_BLOCKED end
265
+ if IsCombatBlocked() then
266
+ return false, nil, ns.L.COMBAT_BLOCKED
267
+ end
208
268
  query = Trim(query):lower()
209
- if query == "" then return false, nil, ns.L.SEARCH_TERM_REQUIRED end
269
+ if query == "" then
270
+ return false, nil, ns.L.SEARCH_TERM_REQUIRED
271
+ end
210
272
  if (type(value) ~= "table" and not IsScriptRegion(value)) or IsSecret(value) then
211
273
  return false, nil, ns.L.SEARCH_REQUIRES_TABLE
212
274
  end
@@ -238,10 +300,14 @@ function inspector.SearchValue(value, query, limit, maxDepth)
238
300
  end
239
301
 
240
302
  local function AddMatch(key, childValue, path)
241
- if type(key) ~= "string" or IsSecret(key) then return end
303
+ if type(key) ~= "string" or IsSecret(key) then
304
+ return
305
+ end
242
306
  local lowerKey = key:lower()
243
307
  local matchStart = lowerKey:find(query, 1, true)
244
- if not matchStart then return end
308
+ if not matchStart then
309
+ return
310
+ end
245
311
  matchCount = matchCount + 1
246
312
  local bucket = lowerKey == query and exact or (matchStart == 1 and prefixes or contains)
247
313
  if #exact + #prefixes + #contains < limit and not IsSecret(childValue) then
@@ -267,7 +333,9 @@ function inspector.SearchValue(value, query, limit, maxDepth)
267
333
  local cursor
268
334
  while scanned < MAX_SEARCH_SCANS do
269
335
  local succeeded, key, childValue = pcall(next, current, cursor)
270
- if not succeeded or key == nil then break end
336
+ if not succeeded or key == nil then
337
+ break
338
+ end
271
339
  cursor = key
272
340
  scanned = scanned + 1
273
341
  if not IsSecret(key) then
@@ -303,7 +371,9 @@ function inspector.SearchValue(value, query, limit, maxDepth)
303
371
  local results = {}
304
372
  local function Append(bucket)
305
373
  for index = 1, #bucket do
306
- if #results >= limit then return end
374
+ if #results >= limit then
375
+ return
376
+ end
307
377
  results[#results + 1] = bucket[index]
308
378
  end
309
379
  end
@@ -320,9 +390,13 @@ function inspector.SearchGlobal(query, limit)
320
390
  end
321
391
 
322
392
  function inspector.SearchPath(path, query, limit)
323
- if ns.IsCombatBlocked() then return false, nil, ns.L.COMBAT_BLOCKED end
393
+ if IsCombatBlocked() then
394
+ return false, nil, ns.L.COMBAT_BLOCKED
395
+ end
324
396
  local succeeded, value, errorMessage = inspector.ResolvePath(path)
325
- if not succeeded then return false, nil, errorMessage end
397
+ if not succeeded then
398
+ return false, nil, errorMessage
399
+ end
326
400
  return inspector.SearchValue(value, query, limit)
327
401
  end
328
402
 
@@ -1,7 +1,16 @@
1
1
  local ADDON_NAME, ns = ...
2
- local L = ns.L
3
2
 
4
- function ns.CreateExportController(parent, ui)
3
+ -- Shared "Save (落盘)" ticket popup: 520x224 modal that reports the committed
4
+ -- record with a pre-selected, rewrite-guarded ticket box (copy = select +
5
+ -- Ctrl+C, never a clipboard API) plus combat-guarded Reload UI / Later actions.
6
+ local POPUP_WIDTH = 520
7
+ local POPUP_HEIGHT = 224
8
+
9
+ ns.ExportUI = {}
10
+
11
+ function ns.ExportUI.Create(parent)
12
+ local W = ns.Widgets
13
+ local colors = W.Colors
5
14
  local controller = {}
6
15
  local popup
7
16
 
@@ -10,30 +19,30 @@ function ns.CreateExportController(parent, ui)
10
19
  return popup
11
20
  end
12
21
 
13
- local overlay = ui.CreatePanel(parent, 0, 0, 0, 0.78)
22
+ local overlay = W.CreatePanel(parent, 0, 0, 0, 0.78)
14
23
  overlay:SetAllPoints(parent)
15
24
  overlay:SetFrameLevel(parent:GetFrameLevel() + 80)
16
25
  overlay:EnableMouse(true)
17
26
 
18
- local panel = ui.CreatePanel(overlay, ui.surfaceR, ui.surfaceG, ui.surfaceB, 1)
19
- panel:SetSize(520, 224)
27
+ local panel = W.CreatePanel(overlay, colors.surface[1], colors.surface[2], colors.surface[3], 1)
28
+ panel:SetSize(POPUP_WIDTH, POPUP_HEIGHT)
20
29
  panel:SetPoint("CENTER")
21
30
  panel:SetFrameLevel(overlay:GetFrameLevel() + 1)
22
31
 
23
32
  local logo = panel:CreateTexture(nil, "ARTWORK")
24
- logo:SetTexture("Interface\\AddOns\\" .. ADDON_NAME .. "\\Media\\Logo.png")
33
+ logo:SetTexture(W.LOGO_TEXTURE)
25
34
  logo:SetTexCoord(0.18, 0.79, 0.17, 0.80)
26
35
  logo:SetSize(34, 34)
27
36
  logo:SetPoint("TOPLEFT", 20, -17)
28
37
 
29
38
  local title = panel:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
30
39
  title:SetPoint("LEFT", logo, "RIGHT", 12, 1)
31
- title:SetText(L.EXPORT_SAVED_TITLE)
40
+ title:SetText(ns.L.EXPORT_SAVED_TITLE)
32
41
 
33
42
  local status = panel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
34
43
  status:SetPoint("TOPRIGHT", -20, -27)
35
- status:SetText(L.EXPORT_STATUS_PENDING)
36
- status:SetTextColor(ui.accentR, ui.accentG, ui.accentB, 0.94)
44
+ status:SetText(ns.L.EXPORT_STATUS_PENDING)
45
+ status:SetTextColor(colors.accent[1], colors.accent[2], colors.accent[3], 0.94)
37
46
 
38
47
  local divider = panel:CreateTexture(nil, "ARTWORK")
39
48
  divider:SetColorTexture(1, 1, 1, 0.07)
@@ -43,10 +52,10 @@ function ns.CreateExportController(parent, ui)
43
52
 
44
53
  local ticketLabel = panel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
45
54
  ticketLabel:SetPoint("TOPLEFT", 20, -86)
46
- ticketLabel:SetText(L.EXPORT_TICKET)
55
+ ticketLabel:SetText(ns.L.EXPORT_TICKET)
47
56
  ticketLabel:SetTextColor(1, 1, 1, 0.38)
48
57
 
49
- local ticketPanel = ui.CreatePanel(panel, ui.editorR, ui.editorG, ui.editorB, 1)
58
+ local ticketPanel = W.CreatePanel(panel, colors.editor[1], colors.editor[2], colors.editor[3], 1)
50
59
  ticketPanel:SetPoint("TOPLEFT", ticketLabel, "BOTTOMLEFT", 0, -7)
51
60
  ticketPanel:SetPoint("TOPRIGHT", panel, "TOPRIGHT", -20, -108)
52
61
  ticketPanel:SetHeight(42)
@@ -57,7 +66,9 @@ function ns.CreateExportController(parent, ui)
57
66
  ticketBox:SetAutoFocus(false)
58
67
  ticketBox:SetFontObject(ChatFontNormal)
59
68
  ticketBox:SetTextColor(0.94, 0.95, 0.96)
60
- ticketBox:SetScript("OnEscapePressed", function() overlay:Hide() end)
69
+ ticketBox:SetScript("OnEscapePressed", function()
70
+ overlay:Hide()
71
+ end)
61
72
  ticketBox:SetScript("OnTextChanged", function(self)
62
73
  if not self.updatingText and self:GetText() ~= self.savedText then
63
74
  self.updatingText = true
@@ -66,35 +77,38 @@ function ns.CreateExportController(parent, ui)
66
77
  self:HighlightText()
67
78
  end
68
79
  end)
80
+ ticketBox:SetScript("OnMouseUp", function()
81
+ W.SelectAllText(ticketBox)
82
+ end)
69
83
 
70
84
  local hint = panel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
71
85
  hint:SetPoint("TOPLEFT", ticketPanel, "BOTTOMLEFT", 1, -9)
72
86
  hint:SetPoint("RIGHT", -20, 0)
73
87
  hint:SetJustifyH("LEFT")
74
- hint:SetText(L.EXPORT_TICKET_HELP)
88
+ hint:SetText(ns.L.EXPORT_TICKET_HELP)
75
89
  hint:SetTextColor(1, 1, 1, 0.48)
76
90
 
77
- local reloadButton = ui.CreateButton(panel, 110, L.RELOAD_NOW, true)
91
+ local reloadButton = W.CreateButton(panel, 110, ns.L.RELOAD_NOW, true)
78
92
  reloadButton:SetPoint("BOTTOMRIGHT", -20, 16)
79
93
  reloadButton:SetScript("OnClick", function()
80
- if ns.IsCombatBlocked() then
81
- ns.PrintCombatBlocked()
94
+ if ns.Safety.IsCombatBlocked() then
95
+ ns.Safety.PrintBlocked()
82
96
  return
83
97
  end
84
98
  ReloadUI()
85
99
  end)
86
100
 
87
- local laterButton = ui.CreateButton(panel, 96, L.RELOAD_LATER, false)
101
+ local laterButton = W.CreateButton(panel, 96, ns.L.RELOAD_LATER, false)
88
102
  laterButton:SetPoint("RIGHT", reloadButton, "LEFT", -8, 0)
89
- laterButton:SetScript("OnClick", function() overlay:Hide() end)
90
-
91
- ticketBox:SetScript("OnMouseUp", function()
92
- ui.SelectAllText(ticketBox)
103
+ laterButton:SetScript("OnClick", function()
104
+ overlay:Hide()
93
105
  end)
94
106
 
95
107
  popup = {
96
108
  overlay = overlay,
109
+ panel = panel,
97
110
  ticketBox = ticketBox,
111
+ status = status,
98
112
  hint = hint,
99
113
  laterButton = laterButton,
100
114
  reloadButton = reloadButton,
@@ -104,30 +118,46 @@ function ns.CreateExportController(parent, ui)
104
118
  return popup
105
119
  end
106
120
 
121
+ local function ShowTicket(id)
122
+ local activePopup = EnsurePopup()
123
+ activePopup.ticketBox.savedText = id
124
+ activePopup.ticketBox.updatingText = true
125
+ activePopup.ticketBox:SetText(id)
126
+ activePopup.ticketBox.updatingText = nil
127
+ local state = ns.Stores.Exports.GetState(id)
128
+ activePopup.status:SetText(state == "saved" and ns.L.EXPORT_STATUS_SAVED or ns.L.EXPORT_STATUS_PENDING)
129
+ activePopup.hint:SetText(ns.L.EXPORT_TICKET_HELP)
130
+ activePopup.overlay:Show()
131
+ W.SelectAllText(activePopup.ticketBox)
132
+ end
133
+
134
+ -- content may be a string or a function producing one (built lazily so a
135
+ -- failing generator never commits a partial record).
107
136
  function controller:Save(kind, title, content, metadata)
108
137
  if type(content) == "function" then
109
138
  local succeeded, generated = pcall(content)
110
139
  if not succeeded then
111
- print("|cffd83b4eLychee Dev:|r " .. L.EXPORT_BUILD_FAILED .. tostring(generated))
140
+ print("|cffd83b4eLychee Dev:|r " .. ns.L.EXPORT_BUILD_FAILED .. tostring(generated))
112
141
  return nil
113
142
  end
114
143
  content = generated
115
144
  end
116
- local ticket, errorMessage = ns.AddExport(kind, title, content, metadata)
117
- if not ticket then
118
- print("|cffd83b4eLychee Dev:|r " .. (errorMessage or L.EXPORT_FAILED))
145
+ local id, errorMessage = ns.Stores.Exports.Add(kind, title, content, metadata)
146
+ if not id then
147
+ print("|cffd83b4eLychee Dev:|r " .. (errorMessage or ns.L.EXPORT_FAILED))
119
148
  return nil
120
149
  end
121
150
 
122
- local activePopup = EnsurePopup()
123
- activePopup.ticketBox.savedText = ticket
124
- activePopup.ticketBox.updatingText = true
125
- activePopup.ticketBox:SetText(ticket)
126
- activePopup.ticketBox.updatingText = nil
127
- activePopup.hint:SetText(L.EXPORT_TICKET_HELP)
128
- activePopup.overlay:Show()
129
- ui.SelectAllText(activePopup.ticketBox)
130
- return ticket
151
+ ShowTicket(id)
152
+ return id
153
+ end
154
+
155
+ function controller:Show(id)
156
+ if type(id) ~= "string" or not ns.Stores.Exports.Get(id) then
157
+ return false
158
+ end
159
+ ShowTicket(id)
160
+ return true
131
161
  end
132
162
 
133
163
  function controller:Hide()
@@ -1,6 +1,9 @@
1
1
  local ADDON_NAME, ns = ...
2
- local L = ns.L
3
2
 
3
+ -- About page. This is the reference example of the page API: it registers
4
+ -- itself at load time (no frames), builds lazily on first activation and keeps
5
+ -- its repository popup lazy, rewrite-guarded and pre-selected (copy = select +
6
+ -- Ctrl+C).
4
7
  local REPOSITORY_URL = "https://github.com/Follen/Lychee-Dev"
5
8
 
6
9
  local function CreateMetaItem(parent, labelText, valueText, x, y, width)
@@ -45,7 +48,11 @@ local function CreateEnvironmentRow(parent, labelText, valueText, detailText, y,
45
48
  detail:SetTextColor(1, 1, 1, 0.34)
46
49
  end
47
50
 
48
- function ns.CreateAboutPage(parent, ui)
51
+ local function BuildAboutPage(parent)
52
+ local W = ns.Widgets
53
+ local colors = W.Colors
54
+ local L = ns.L
55
+
49
56
  local page = CreateFrame("Frame", nil, parent)
50
57
  page:SetAllPoints(parent)
51
58
 
@@ -56,18 +63,16 @@ function ns.CreateAboutPage(parent, ui)
56
63
  description:SetText(L.ABOUT_DESCRIPTION)
57
64
  description:SetTextColor(0.92, 0.94, 0.96, 0.92)
58
65
 
59
- -- Fallback only: the TOC is the source of truth and overrides this on the
60
- -- next line. Keep it aligned with the release version so a metadata failure
61
- -- cannot display an unrelated old number.
62
- local version = "1.0.6"
63
- version = ns.Client.GetAddOnMetadata(ADDON_NAME, "Version") or version
66
+ -- The TOC is the source of truth; ns.Release only backs a metadata read
67
+ -- failure so the page can never show an unrelated old number.
68
+ local version = ns.Compat.GetAddOnMetadata(ADDON_NAME, "Version") or ns.Release
64
69
 
65
70
  local accent = page:CreateTexture(nil, "ARTWORK")
66
- accent:SetColorTexture(ui.accentR, ui.accentG, ui.accentB, 0.92)
71
+ accent:SetColorTexture(colors.accent[1], colors.accent[2], colors.accent[3], 0.92)
67
72
  accent:SetPoint("TOPLEFT", 17, -137)
68
73
  accent:SetSize(32, 2)
69
74
 
70
- local projectLabel = ui.CreateSectionLabel(page, L.ABOUT_PROJECT)
75
+ local projectLabel = W.CreateSectionLabel(page, L.ABOUT_PROJECT)
71
76
  projectLabel:SetPoint("TOPLEFT", 17, -166)
72
77
 
73
78
  local metadata = CreateFrame("Frame", nil, page)
@@ -76,7 +81,7 @@ function ns.CreateAboutPage(parent, ui)
76
81
  metadata:SetHeight(112)
77
82
  local metadataBackground = metadata:CreateTexture(nil, "BACKGROUND")
78
83
  metadataBackground:SetAllPoints()
79
- metadataBackground:SetColorTexture(ui.surfaceR, ui.surfaceG, ui.surfaceB, 0.24)
84
+ metadataBackground:SetColorTexture(colors.surface[1], colors.surface[2], colors.surface[3], 0.24)
80
85
 
81
86
  local metaItems = {
82
87
  version = CreateMetaItem(metadata, L.ABOUT_VERSION, version, 18, -12, 250),
@@ -99,7 +104,7 @@ function ns.CreateAboutPage(parent, ui)
99
104
  metadataDivider:SetPoint("TOPRIGHT", -18, -55)
100
105
  metadataDivider:SetHeight(1)
101
106
 
102
- local environmentLabel = ui.CreateSectionLabel(page, L.ABOUT_ENVIRONMENT)
107
+ local environmentLabel = W.CreateSectionLabel(page, L.ABOUT_ENVIRONMENT)
103
108
  environmentLabel:SetPoint("TOPLEFT", 17, -329)
104
109
 
105
110
  CreateEnvironmentRow(page, L.ABOUT_DEPENDENCY, L.ABOUT_DEPENDENCY_STATUS,
@@ -120,7 +125,7 @@ function ns.CreateAboutPage(parent, ui)
120
125
 
121
126
  local githubIcon = githubButton:CreateTexture(nil, "ARTWORK")
122
127
  githubIcon:SetAllPoints()
123
- githubIcon:SetTexture("Interface\\AddOns\\" .. ADDON_NAME .. "\\Media\\GitHub.png")
128
+ githubIcon:SetTexture(W.GITHUB_TEXTURE)
124
129
  githubIcon:SetAlpha(0.38)
125
130
 
126
131
  githubButton:SetScript("OnEnter", function()
@@ -157,13 +162,13 @@ function ns.CreateAboutPage(parent, ui)
157
162
  shade:SetAllPoints()
158
163
  shade:SetColorTexture(0, 0, 0, 0.24)
159
164
 
160
- linkPopup = ui.CreatePanel(UIParent, ui.surfaceR, ui.surfaceG, ui.surfaceB, 0.98)
165
+ linkPopup = W.CreatePanel(UIParent, colors.surface[1], colors.surface[2], colors.surface[3], 0.98)
161
166
  linkPopup:SetSize(420, 54)
162
167
  linkPopup:SetFrameStrata("DIALOG")
163
168
  linkPopup:SetFrameLevel(500)
164
169
  linkPopup:EnableMouse(true)
165
170
 
166
- local urlPanel = ui.CreatePanel(linkPopup, ui.editorR, ui.editorG, ui.editorB, 1)
171
+ local urlPanel = W.CreatePanel(linkPopup, colors.editor[1], colors.editor[2], colors.editor[3], 1)
167
172
  urlPanel:SetPoint("TOPLEFT", 12, -10)
168
173
  urlPanel:SetPoint("BOTTOMRIGHT", -12, 10)
169
174
 
@@ -222,5 +227,12 @@ function ns.CreateAboutPage(parent, ui)
222
227
  page.githubButton = githubButton
223
228
  page.githubIcon = githubIcon
224
229
  page.metaItems = metaItems
230
+ page.HideLinkPopup = HideLinkPopup
225
231
  return page
226
232
  end
233
+
234
+ ns.Workbench.RegisterPage({
235
+ key = "about",
236
+ titleKey = "TAB_ABOUT",
237
+ build = BuildAboutPage,
238
+ })