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.
- package/LICENSE +49 -0
- package/README.md +45 -0
- package/THIRD_PARTY_NOTICES +812 -0
- package/bin/lycheedev.mjs +56 -0
- package/native/windows-amd64/lycheedev.exe +0 -0
- package/package.json +12 -33
- package/payload/addon/Bridge/CaptureWriter.lua +154 -0
- package/payload/addon/Bridge/Definitions.lua +3 -0
- package/payload/addon/Bridge/Identity.lua +127 -0
- package/{vendor/addon/Libs/AutomationQR.lua → payload/addon/Bridge/MatrixSymbol.lua} +23 -30
- package/payload/addon/Bridge/ProbeQueue.lua +136 -0
- package/payload/addon/Bridge/ProbeRunner.lua +128 -0
- package/payload/addon/Bridge/ReceiptView.lua +160 -0
- package/payload/addon/Bridge/Reentry.lua +192 -0
- package/payload/addon/Bridge/ReportStore.lua +153 -0
- package/payload/addon/Bridge/Session.lua +163 -0
- package/payload/addon/Clients/Evergreen.lua +2 -0
- package/payload/addon/Clients/Live.lua +2 -0
- package/payload/addon/Clients/Pandaria.lua +2 -0
- package/payload/addon/Clients/Titan.lua +2 -0
- package/payload/addon/Core/Compat.lua +59 -0
- package/payload/addon/Core/Controls.lua +168 -0
- package/{vendor/addon/Core/Bootstrap.lua → payload/addon/Core/Execute.lua} +12 -23
- package/{vendor → payload}/addon/Core/Inspector.lua +19 -235
- package/{vendor → payload}/addon/Core/Locale.lua +129 -94
- package/{vendor → payload}/addon/Core/Locale_enUS.lua +129 -96
- package/payload/addon/Core/Persistence.lua +58 -0
- package/payload/addon/Core/Platform.lua +58 -0
- package/payload/addon/Core/Runtime.lua +25 -0
- package/payload/addon/Core/Safety.lua +56 -0
- package/{vendor → payload}/addon/Core/Serializer.lua +18 -6
- package/payload/addon/Core/Stores.lua +611 -0
- package/payload/addon/Lychee Dev_Forever.toc +52 -0
- package/payload/addon/Lychee Dev_Mainline.toc +52 -0
- package/payload/addon/Lychee Dev_Mists.toc +52 -0
- package/payload/addon/Lychee Dev_Wrath.toc +52 -0
- package/payload/addon/Modules/AutomationView.lua +393 -0
- package/{vendor → payload}/addon/Modules/Diagnostics.lua +92 -36
- package/{vendor → payload}/addon/Modules/Events/Catalog.lua +9 -0
- package/{vendor → payload}/addon/Modules/Events/Monitor.lua +45 -5
- package/payload/addon/Modules/FunctionTrace.lua +150 -0
- package/{vendor → payload}/addon/Modules/ObjectInspector.lua +105 -31
- package/{vendor → payload}/addon/UI/Export.lua +64 -34
- package/{vendor → payload}/addon/UI/Pages/About.lua +26 -14
- package/payload/addon/UI/Pages/Automation.lua +446 -0
- package/payload/addon/UI/Pages/Diagnostics.lua +402 -0
- package/{vendor/addon/UI/Features.lua → payload/addon/UI/Pages/Events.lua} +192 -302
- package/{vendor → payload}/addon/UI/Pages/ExportRecords.lua +213 -132
- package/{vendor → payload}/addon/UI/Pages/Object.lua +229 -121
- package/payload/addon/UI/Pages/Run.lua +423 -0
- package/payload/addon/UI/Pages/Trace.lua +314 -0
- package/payload/addon/UI/TreeView.lua +246 -0
- package/{vendor/addon/UI/MainWindow.lua → payload/addon/UI/Widgets.lua} +89 -529
- package/payload/addon/UI/Window.lua +425 -0
- package/payload/skill/SKILL.md +87 -0
- package/payload/skill/agents/openai.yaml +7 -0
- package/payload/skill/references/addon-validation.md +42 -0
- package/payload/skill/references/asset-export.md +109 -0
- package/payload/skill/references/commands.md +169 -0
- package/payload/skill/references/data-investigation.md +242 -0
- package/payload/skill/references/error-diagnosis.md +41 -0
- package/payload/skill/references/installation.md +18 -0
- package/payload/skill/references/live-investigation.md +129 -0
- package/payload/skill/references/source-research.md +82 -0
- package/payload/skill/scripts/lycheedev.mjs +59 -0
- package/release.json +346 -0
- package/bin/lycheedev.js +0 -742
- package/src/addon.js +0 -95
- package/src/config.js +0 -68
- package/src/doctor.js +0 -126
- package/src/install.js +0 -145
- package/src/paths.js +0 -93
- package/src/py/instances.py +0 -165
- package/src/python.js +0 -111
- package/src/skill.js +0 -48
- package/src/wow.js +0 -541
- package/vendor/addon/Core/Clients/Forever.lua +0 -9
- package/vendor/addon/Core/Clients/Mainline.lua +0 -9
- package/vendor/addon/Core/Clients/Mists.lua +0 -9
- package/vendor/addon/Core/Clients/Titan.lua +0 -9
- package/vendor/addon/Core/Compatibility.lua +0 -43
- package/vendor/addon/Core/Database.lua +0 -859
- package/vendor/addon/Core/Safety.lua +0 -42
- package/vendor/addon/Lychee Dev_Forever.toc +0 -43
- package/vendor/addon/Lychee Dev_Mainline.toc +0 -43
- package/vendor/addon/Lychee Dev_Mists.toc +0 -43
- package/vendor/addon/Lychee Dev_Wrath.toc +0 -43
- package/vendor/addon/Modules/Automation/Controller.lua +0 -884
- package/vendor/addon/Modules/Automation/Report.lua +0 -409
- package/vendor/addon/Modules/Automation/auto/auto.lua +0 -12
- package/vendor/addon/Modules/FunctionTrace.lua +0 -85
- package/vendor/addon/UI/AutomationOverlay.lua +0 -253
- package/vendor/addon/UI/Pages/Automation.lua +0 -417
- package/vendor/addon/UI/Pages/Diagnostics.lua +0 -289
- package/vendor/addon/UI/Pages/Trace.lua +0 -165
- package/vendor/skill/SKILL.md +0 -42
- package/vendor/skill/agents/openai.yaml +0 -4
- package/vendor/skill/references/automation.md +0 -128
- package/vendor/skill/references/clients.md +0 -51
- package/vendor/skill/references/runtime-investigations.md +0 -104
- package/vendor/skill/scripts/automation/__init__.py +0 -1
- package/vendor/skill/scripts/automation/registry.py +0 -516
- package/vendor/skill/scripts/automation/saved_variables.py +0 -438
- package/vendor/skill/scripts/automation/session.py +0 -207
- package/vendor/skill/scripts/automation/windows.py +0 -792
- package/vendor/skill/scripts/automation.py +0 -1034
- package/vendor/skill/scripts/requirements.txt +0 -13
- package/vendor/skill/scripts/selftest_offline.py +0 -1061
- package/vendor/skill/scripts/test_input_safety.py +0 -132
- /package/{vendor → payload}/addon/Media/GitHub.png +0 -0
- /package/{vendor → payload}/addon/Media/Logo.png +0 -0
- /package/{vendor → payload}/addon/Modules/Events/CatalogData_Forever.lua +0 -0
- /package/{vendor → payload}/addon/Modules/Events/CatalogData_Mainline.lua +0 -0
- /package/{vendor → payload}/addon/Modules/Events/CatalogData_Mists.lua +0 -0
- /package/{vendor → payload}/addon/Modules/Events/CatalogData_Titan.lua +0 -0
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
local ADDON_NAME, ns = ...
|
|
2
|
-
local L = ns.L
|
|
3
|
-
|
|
4
|
-
local WINDOW_WIDTH = 1040
|
|
5
|
-
local WINDOW_HEIGHT = 720
|
|
6
|
-
local HISTORY_WIDTH = 232
|
|
7
|
-
local MAIN_LEFT = HISTORY_WIDTH + 36
|
|
8
2
|
|
|
3
|
+
-- The one shared visual system for the workbench: spacing, typography, colors,
|
|
4
|
+
-- borders and control sizes ported from the existing UI. Do not create a
|
|
5
|
+
-- second visual system; extend this kit instead.
|
|
9
6
|
local ACCENT_R, ACCENT_G, ACCENT_B = 0.847, 0.231, 0.306
|
|
10
7
|
local PANEL_R, PANEL_G, PANEL_B = 0.050, 0.070, 0.090
|
|
11
8
|
local SURFACE_R, SURFACE_G, SURFACE_B = 0.061, 0.095, 0.120
|
|
12
9
|
local EDITOR_R, EDITOR_G, EDITOR_B = 0.027, 0.035, 0.043
|
|
13
10
|
local BORDER_R, BORDER_G, BORDER_B = 0.34, 0.39, 0.44
|
|
14
|
-
local LOGO_TEXTURE = "Interface\\AddOns\\" .. ADDON_NAME .. "\\Media\\Logo.png"
|
|
15
11
|
|
|
16
12
|
local BACKDROP = {
|
|
17
13
|
bgFile = "Interface\\Buttons\\WHITE8X8",
|
|
@@ -19,23 +15,9 @@ local BACKDROP = {
|
|
|
19
15
|
edgeSize = 1,
|
|
20
16
|
}
|
|
21
17
|
|
|
22
|
-
local
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
local activePage = "runner"
|
|
26
|
-
local resultMode = "text"
|
|
27
|
-
local historyTrees = setmetatable({}, { __mode = "k" })
|
|
28
|
-
|
|
29
|
-
local PAGE_DEFINITIONS = {
|
|
30
|
-
{ key = "runner", label = L.TAB_RUNNER },
|
|
31
|
-
{ key = "objects", label = L.TAB_OBJECTS },
|
|
32
|
-
{ key = "events", label = L.TAB_EVENTS },
|
|
33
|
-
{ key = "trace", label = L.TAB_TRACE },
|
|
34
|
-
{ key = "diagnostics", label = L.TAB_DIAGNOSTICS },
|
|
35
|
-
{ key = "exports", label = L.TAB_EXPORTS },
|
|
36
|
-
{ key = "automation", label = L.TAB_AUTOMATION },
|
|
37
|
-
{ key = "about", label = L.TAB_ABOUT },
|
|
38
|
-
}
|
|
18
|
+
local function Clamp(value, minimum, maximum)
|
|
19
|
+
return math.max(minimum, math.min(maximum, value))
|
|
20
|
+
end
|
|
39
21
|
|
|
40
22
|
local function SetBorderColor(frame, accent, alpha)
|
|
41
23
|
if accent then
|
|
@@ -59,10 +41,8 @@ local function CreatePanel(parent, r, g, b, a)
|
|
|
59
41
|
return panel
|
|
60
42
|
end
|
|
61
43
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
end
|
|
65
|
-
|
|
44
|
+
-- Custom scrollbar synced to the viewport; with useNativeScrollFrame the
|
|
45
|
+
-- viewport is a real ScrollFrame and stays the edit box's native scroll child.
|
|
66
46
|
local function CreateScrollArea(parent, leftInset, topInset, rightInset, bottomInset, useNativeScrollFrame)
|
|
67
47
|
local scroll = CreateFrame(useNativeScrollFrame and "ScrollFrame" or "Frame", nil, parent)
|
|
68
48
|
scroll:SetPoint("TOPLEFT", leftInset, -topInset)
|
|
@@ -356,10 +336,12 @@ local function ApplyButtonState(button, state)
|
|
|
356
336
|
button.label:SetTextColor(1, 1, 1, labelAlpha)
|
|
357
337
|
end
|
|
358
338
|
|
|
359
|
-
|
|
339
|
+
-- variant: "primary" / "danger" / "secondary" / "ghost" / "selected", or a
|
|
340
|
+
-- boolean for the historical primary=true shorthand.
|
|
341
|
+
local function CreateButton(parent, width, text, variant)
|
|
360
342
|
local button = CreateFrame("Button", nil, parent, "BackdropTemplate")
|
|
361
343
|
button:SetBackdrop(BACKDROP)
|
|
362
|
-
button.variant = type(
|
|
344
|
+
button.variant = type(variant) == "string" and variant or (variant and "primary" or "secondary")
|
|
363
345
|
button.primary = button.variant == "primary"
|
|
364
346
|
|
|
365
347
|
local label = button:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
@@ -416,6 +398,47 @@ local function SetButtonText(button, text)
|
|
|
416
398
|
button.label:SetText(text or "")
|
|
417
399
|
end
|
|
418
400
|
|
|
401
|
+
-- Two-click confirmation: the first click arms the button (label switches to
|
|
402
|
+
-- confirmText, variant to danger), the second click runs onConfirm and resets.
|
|
403
|
+
-- No timers; callers can force a reset with button:ResetConfirm().
|
|
404
|
+
local function CreateConfirmButton(parent, width, text, confirmText, onConfirm, variant)
|
|
405
|
+
local restVariant = variant or "secondary"
|
|
406
|
+
local button = CreateButton(parent, width, text, restVariant)
|
|
407
|
+
-- Size once for the longer of the two labels so the arm/disarm state
|
|
408
|
+
-- change never resizes or shifts the control.
|
|
409
|
+
local measure = button.label:GetStringWidth()
|
|
410
|
+
button.label:SetText(confirmText)
|
|
411
|
+
local confirmWidth = button.label:GetStringWidth()
|
|
412
|
+
button.label:SetText(text)
|
|
413
|
+
button:SetSize(math.max(width, math.ceil(math.max(measure, confirmWidth)) + 24), 30)
|
|
414
|
+
|
|
415
|
+
local armed = false
|
|
416
|
+
|
|
417
|
+
local function Reset()
|
|
418
|
+
armed = false
|
|
419
|
+
SetButtonText(button, text)
|
|
420
|
+
SetButtonVariant(button, restVariant)
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
button.ResetConfirm = Reset
|
|
424
|
+
button.IsConfirmArmed = function()
|
|
425
|
+
return armed
|
|
426
|
+
end
|
|
427
|
+
button:SetScript("OnClick", function(self)
|
|
428
|
+
if not armed then
|
|
429
|
+
armed = true
|
|
430
|
+
SetButtonText(self, confirmText)
|
|
431
|
+
SetButtonVariant(self, "danger")
|
|
432
|
+
return
|
|
433
|
+
end
|
|
434
|
+
Reset()
|
|
435
|
+
if onConfirm then
|
|
436
|
+
onConfirm(self)
|
|
437
|
+
end
|
|
438
|
+
end)
|
|
439
|
+
return button
|
|
440
|
+
end
|
|
441
|
+
|
|
419
442
|
local function CreateSectionLabel(parent, text)
|
|
420
443
|
local label = parent:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
421
444
|
label:SetText(text)
|
|
@@ -513,6 +536,7 @@ local function CreateNavTab(parent, text)
|
|
|
513
536
|
return button
|
|
514
537
|
end
|
|
515
538
|
|
|
539
|
+
-- Label-fit sizing: rendered label width + 22 px, never below the minimum.
|
|
516
540
|
local function FitNavTab(button, minimumWidth, height)
|
|
517
541
|
button:SetSize(math.max(minimumWidth or 48,
|
|
518
542
|
math.ceil(button.label:GetStringWidth()) + 22), height or 30)
|
|
@@ -551,6 +575,8 @@ local function CreateTextArea(parent, readOnly)
|
|
|
551
575
|
editBox:SetScript("OnEditFocusLost", function()
|
|
552
576
|
SetBorderColor(panel, false)
|
|
553
577
|
end)
|
|
578
|
+
-- Rewrite-on-change guard keeps read-only text areas immutable while still
|
|
579
|
+
-- letting users select and copy their content.
|
|
554
580
|
editBox:SetScript("OnTextChanged", function(self)
|
|
555
581
|
if readOnly and not self.updatingText and self:GetText() ~= self.savedText then
|
|
556
582
|
self.updatingText = true
|
|
@@ -635,6 +661,7 @@ local function AppendReadOnlyText(panel, text)
|
|
|
635
661
|
panel.scroll:SetVerticalScroll(offset)
|
|
636
662
|
end
|
|
637
663
|
|
|
664
|
+
-- Copy support is always "select + Ctrl+C"; no clipboard API is used.
|
|
638
665
|
local function SelectAllText(target)
|
|
639
666
|
if target.SelectAll then
|
|
640
667
|
target:SelectAll()
|
|
@@ -644,502 +671,35 @@ local function SelectAllText(target)
|
|
|
644
671
|
target:HighlightText()
|
|
645
672
|
end
|
|
646
673
|
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
end
|
|
680
|
-
if not window.pages[pageName] then
|
|
681
|
-
pageName = "runner"
|
|
682
|
-
end
|
|
683
|
-
activePage = pageName
|
|
684
|
-
|
|
685
|
-
for key, page in pairs(window.pages) do
|
|
686
|
-
page:SetShown(key == pageName)
|
|
687
|
-
window.pageTabs[key]:SetActive(key == pageName)
|
|
688
|
-
end
|
|
689
|
-
|
|
690
|
-
local page = window.pages[pageName]
|
|
691
|
-
if pageName == "runner" then
|
|
692
|
-
window.inputPanel.editBox:SetFocus()
|
|
693
|
-
elseif pageName == "events" then
|
|
694
|
-
page:RefreshIfDirty()
|
|
695
|
-
page:FocusInput()
|
|
696
|
-
elseif page.Activate then
|
|
697
|
-
page:Activate()
|
|
698
|
-
end
|
|
699
|
-
end
|
|
700
|
-
|
|
701
|
-
local function StopRuntimeTools()
|
|
702
|
-
if window and window.objectPage then
|
|
703
|
-
window.objectPage:Stop()
|
|
704
|
-
end
|
|
705
|
-
|
|
706
|
-
if window and window.eventsPage then
|
|
707
|
-
window.eventsPage:StopMonitor()
|
|
708
|
-
elseif ns.EventMonitor then
|
|
709
|
-
ns.EventMonitor.Stop()
|
|
710
|
-
end
|
|
711
|
-
|
|
712
|
-
if window and window.tracePage then
|
|
713
|
-
window.tracePage:Stop()
|
|
714
|
-
elseif ns.FunctionTrace then
|
|
715
|
-
ns.FunctionTrace.Stop()
|
|
716
|
-
end
|
|
717
|
-
end
|
|
718
|
-
|
|
719
|
-
local function FormatHistoryEntry(entry)
|
|
720
|
-
local stamp = entry.timestamp and date("%m-%d %H:%M", entry.timestamp) or L.UNKNOWN_TIME
|
|
721
|
-
local firstLine = (entry.code or ""):match("([^\r\n]+)") or L.EMPTY_INPUT
|
|
722
|
-
if #firstLine > 22 then
|
|
723
|
-
firstLine = firstLine:sub(1, 22) .. "..."
|
|
724
|
-
end
|
|
725
|
-
return stamp, firstLine
|
|
726
|
-
end
|
|
727
|
-
|
|
728
|
-
local function ApplyHistoryButtonStyle(button)
|
|
729
|
-
local selected = button.entryIndex == selectedHistoryIndex
|
|
730
|
-
SetListRowState(button, selected, button.isHovered)
|
|
731
|
-
if selected then
|
|
732
|
-
button.time:SetTextColor(1, 1, 1, 0.96)
|
|
733
|
-
button.preview:SetTextColor(1, 1, 1, 0.68)
|
|
734
|
-
elseif button.isHovered then
|
|
735
|
-
button.time:SetTextColor(1, 1, 1, 0.90)
|
|
736
|
-
button.preview:SetTextColor(1, 1, 1, 0.58)
|
|
737
|
-
else
|
|
738
|
-
button.time:SetTextColor(1, 1, 1, 0.68)
|
|
739
|
-
button.preview:SetTextColor(1, 1, 1, 0.42)
|
|
740
|
-
end
|
|
741
|
-
end
|
|
742
|
-
|
|
743
|
-
local function CreateHistoryButton(index)
|
|
744
|
-
local button = CreateListRow(window.historyContent, 52)
|
|
745
|
-
button:SetWidth(HISTORY_WIDTH - 26)
|
|
746
|
-
button.entryIndex = index
|
|
747
|
-
|
|
748
|
-
local timeLabel = button:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
749
|
-
timeLabel:SetPoint("TOPLEFT", 12, -9)
|
|
750
|
-
timeLabel:SetPoint("TOPRIGHT", -9, -9)
|
|
751
|
-
timeLabel:SetJustifyH("LEFT")
|
|
752
|
-
timeLabel:SetWordWrap(false)
|
|
753
|
-
button.time = timeLabel
|
|
754
|
-
|
|
755
|
-
local preview = button:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
756
|
-
preview:SetPoint("BOTTOMLEFT", 12, 8)
|
|
757
|
-
preview:SetPoint("BOTTOMRIGHT", -9, 8)
|
|
758
|
-
preview:SetJustifyH("LEFT")
|
|
759
|
-
preview:SetWordWrap(false)
|
|
760
|
-
button.preview = preview
|
|
761
|
-
|
|
762
|
-
button:SetScript("OnEnter", function(self)
|
|
763
|
-
self.isHovered = true
|
|
764
|
-
ApplyHistoryButtonStyle(self)
|
|
765
|
-
end)
|
|
766
|
-
button:SetScript("OnLeave", function(self)
|
|
767
|
-
self.isHovered = nil
|
|
768
|
-
ApplyHistoryButtonStyle(self)
|
|
769
|
-
end)
|
|
770
|
-
button:SetScript("OnClick", function(self)
|
|
771
|
-
selectedHistoryIndex = self.entryIndex
|
|
772
|
-
local entry = (ns.GetHistory() or {})[selectedHistoryIndex]
|
|
773
|
-
if entry then
|
|
774
|
-
window.inputPanel.editBox:SetText(entry.code or "")
|
|
775
|
-
SetResult(entry.result or "")
|
|
776
|
-
local valueTree = historyTrees[entry] or entry.tree
|
|
777
|
-
window.treeView:SetTree(valueTree)
|
|
778
|
-
SetResultMode(valueTree and "tree" or "text")
|
|
779
|
-
SetStatus(entry.succeeded and L.COMPLETED or L.FAILED,
|
|
780
|
-
entry.succeeded and 0.42 or ACCENT_R,
|
|
781
|
-
entry.succeeded and 0.76 or ACCENT_G,
|
|
782
|
-
entry.succeeded and 0.43 or ACCENT_B)
|
|
783
|
-
end
|
|
784
|
-
for historyIndex = 1, #historyButtons do
|
|
785
|
-
ApplyHistoryButtonStyle(historyButtons[historyIndex])
|
|
786
|
-
end
|
|
787
|
-
end)
|
|
788
|
-
|
|
789
|
-
historyButtons[index] = button
|
|
790
|
-
return button
|
|
791
|
-
end
|
|
792
|
-
|
|
793
|
-
local function RefreshHistory()
|
|
794
|
-
local history = ns.GetHistory() or {}
|
|
795
|
-
|
|
796
|
-
for index = 1, #historyButtons do
|
|
797
|
-
historyButtons[index]:Hide()
|
|
798
|
-
end
|
|
799
|
-
|
|
800
|
-
for index = 1, #history do
|
|
801
|
-
local button = historyButtons[index] or CreateHistoryButton(index)
|
|
802
|
-
button.entryIndex = index
|
|
803
|
-
button:ClearAllPoints()
|
|
804
|
-
button:SetPoint("TOPLEFT", 0, -((index - 1) * 52))
|
|
805
|
-
local stamp, preview = FormatHistoryEntry(history[index])
|
|
806
|
-
button.time:SetText(stamp)
|
|
807
|
-
button.preview:SetText(preview)
|
|
808
|
-
ApplyHistoryButtonStyle(button)
|
|
809
|
-
button:Show()
|
|
810
|
-
end
|
|
811
|
-
|
|
812
|
-
window.historyContent:SetHeight(math.max(1, #history * 52))
|
|
813
|
-
window.historyScroll:UpdateScrollChildRect()
|
|
814
|
-
window.historyEmpty:SetShown(#history == 0)
|
|
815
|
-
end
|
|
816
|
-
|
|
817
|
-
local function RunInput()
|
|
818
|
-
local succeeded, result, normalizedCode, valueTree, storedTree = ns.Execute(window.inputPanel.editBox:GetText())
|
|
819
|
-
SetResult(result)
|
|
820
|
-
window.treeView:SetTree(valueTree)
|
|
821
|
-
SetResultMode(valueTree and "tree" or "text")
|
|
822
|
-
local historyEntry = ns.AddHistory(normalizedCode, result, succeeded, storedTree)
|
|
823
|
-
if historyEntry and valueTree then
|
|
824
|
-
historyTrees[historyEntry] = valueTree
|
|
825
|
-
end
|
|
826
|
-
selectedHistoryIndex = 1
|
|
827
|
-
RefreshHistory()
|
|
828
|
-
|
|
829
|
-
if succeeded then
|
|
830
|
-
SetStatus(L.COMPLETED, 0.42, 0.76, 0.43)
|
|
831
|
-
else
|
|
832
|
-
SetStatus(L.FAILED, ACCENT_R, ACCENT_G, ACCENT_B)
|
|
833
|
-
end
|
|
834
|
-
end
|
|
835
|
-
|
|
836
|
-
local function CreateWindow()
|
|
837
|
-
local frame = CreateFrame("Frame", "LycheeDevWindow", UIParent, "BackdropTemplate")
|
|
838
|
-
frame:SetSize(WINDOW_WIDTH, WINDOW_HEIGHT)
|
|
839
|
-
frame:SetPoint("CENTER")
|
|
840
|
-
frame:SetFrameStrata("DIALOG")
|
|
841
|
-
frame:SetClampedToScreen(true)
|
|
842
|
-
frame:SetMovable(true)
|
|
843
|
-
frame:EnableMouse(true)
|
|
844
|
-
frame:RegisterForDrag("LeftButton")
|
|
845
|
-
frame:SetScript("OnDragStart", function(self)
|
|
846
|
-
self:StartMoving()
|
|
847
|
-
end)
|
|
848
|
-
frame:SetScript("OnDragStop", function(self)
|
|
849
|
-
self:StopMovingOrSizing()
|
|
850
|
-
end)
|
|
851
|
-
frame:SetBackdrop(BACKDROP)
|
|
852
|
-
frame:SetBackdropColor(PANEL_R, PANEL_G, PANEL_B, 0.985)
|
|
853
|
-
frame:SetBackdropBorderColor(0.46, 0.51, 0.56, 0.48)
|
|
854
|
-
frame:Hide()
|
|
855
|
-
tinsert(UISpecialFrames, frame:GetName())
|
|
856
|
-
|
|
857
|
-
local header = frame:CreateTexture(nil, "BACKGROUND")
|
|
858
|
-
header:SetColorTexture(SURFACE_R, SURFACE_G, SURFACE_B, 0.52)
|
|
859
|
-
header:SetPoint("TOPLEFT", 1, -1)
|
|
860
|
-
header:SetPoint("TOPRIGHT", -1, -1)
|
|
861
|
-
header:SetHeight(66)
|
|
862
|
-
|
|
863
|
-
local logo = frame:CreateTexture(nil, "ARTWORK")
|
|
864
|
-
logo:SetTexture(LOGO_TEXTURE)
|
|
865
|
-
logo:SetTexCoord(0.18, 0.79, 0.17, 0.80)
|
|
866
|
-
logo:SetSize(46, 46)
|
|
867
|
-
logo:SetPoint("TOPLEFT", 14, -10)
|
|
868
|
-
|
|
869
|
-
local title = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
|
|
870
|
-
title:SetPoint("LEFT", logo, "RIGHT", 10, 0)
|
|
871
|
-
title:SetText(L.ADDON_TITLE)
|
|
872
|
-
title:SetTextColor(1, 1, 1, 1)
|
|
873
|
-
|
|
874
|
-
local closeButton = CreateCloseButton(frame)
|
|
875
|
-
closeButton:SetPoint("TOPRIGHT", -14, -14)
|
|
876
|
-
closeButton:SetScript("OnClick", function()
|
|
877
|
-
frame:Hide()
|
|
878
|
-
end)
|
|
879
|
-
|
|
880
|
-
frame.pageTabs = {}
|
|
881
|
-
local previousTab
|
|
882
|
-
for index = 1, #PAGE_DEFINITIONS do
|
|
883
|
-
local definition = PAGE_DEFINITIONS[index]
|
|
884
|
-
local tab = CreateNavTab(frame, definition.label)
|
|
885
|
-
FitNavTab(tab, 48, 32)
|
|
886
|
-
if previousTab then
|
|
887
|
-
tab:SetPoint("LEFT", previousTab, "RIGHT", 8, 0)
|
|
888
|
-
else
|
|
889
|
-
tab:SetPoint("BOTTOMLEFT", header, "BOTTOMLEFT", 300, 8)
|
|
890
|
-
end
|
|
891
|
-
tab:SetScript("OnClick", function()
|
|
892
|
-
SetActivePage(definition.key)
|
|
893
|
-
end)
|
|
894
|
-
frame.pageTabs[definition.key] = tab
|
|
895
|
-
previousTab = tab
|
|
896
|
-
end
|
|
897
|
-
|
|
898
|
-
local runnerPage = CreateFrame("Frame", nil, frame)
|
|
899
|
-
runnerPage:SetAllPoints(frame)
|
|
900
|
-
frame.runnerPage = runnerPage
|
|
901
|
-
|
|
902
|
-
local historyLabel = CreateSectionLabel(runnerPage, L.HISTORY)
|
|
903
|
-
historyLabel:SetPoint("TOPLEFT", 17, -84)
|
|
904
|
-
|
|
905
|
-
local historyPanel = CreatePanel(runnerPage, EDITOR_R, EDITOR_G, EDITOR_B, 0.78)
|
|
906
|
-
historyPanel:SetPoint("TOPLEFT", 14, -104)
|
|
907
|
-
historyPanel:SetPoint("BOTTOMLEFT", 14, 54)
|
|
908
|
-
historyPanel:SetWidth(HISTORY_WIDTH)
|
|
909
|
-
|
|
910
|
-
local historyScroll = CreateScrollArea(historyPanel, 8, 8, 7, 8)
|
|
911
|
-
|
|
912
|
-
local historyContent = CreateFrame("Frame", nil, historyScroll)
|
|
913
|
-
historyContent:SetWidth(HISTORY_WIDTH - 26)
|
|
914
|
-
historyContent:SetHeight(1)
|
|
915
|
-
historyScroll:SetScrollChild(historyContent)
|
|
916
|
-
frame.historyContent = historyContent
|
|
917
|
-
frame.historyScroll = historyScroll
|
|
918
|
-
|
|
919
|
-
local historyEmpty = historyPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
920
|
-
historyEmpty:SetPoint("TOP", 0, -24)
|
|
921
|
-
historyEmpty:SetText(L.NO_HISTORY)
|
|
922
|
-
historyEmpty:SetTextColor(1, 1, 1, 0.32)
|
|
923
|
-
frame.historyEmpty = historyEmpty
|
|
924
|
-
|
|
925
|
-
local inputLabel = CreateSectionLabel(runnerPage, L.LUA_INPUT)
|
|
926
|
-
inputLabel:SetPoint("TOPLEFT", MAIN_LEFT, -84)
|
|
927
|
-
|
|
928
|
-
local inputPanel = CreateTextArea(runnerPage, false)
|
|
929
|
-
inputPanel:SetPoint("TOPLEFT", MAIN_LEFT, -104)
|
|
930
|
-
inputPanel:SetPoint("TOPRIGHT", -14, -104)
|
|
931
|
-
inputPanel:SetHeight(210)
|
|
932
|
-
inputPanel.editBox:SetWidth(WINDOW_WIDTH - MAIN_LEFT - 58)
|
|
933
|
-
frame.inputPanel = inputPanel
|
|
934
|
-
|
|
935
|
-
local actionRow = CreateFrame("Frame", nil, runnerPage)
|
|
936
|
-
actionRow:SetPoint("TOPLEFT", inputPanel, "BOTTOMLEFT", 0, -8)
|
|
937
|
-
actionRow:SetPoint("TOPRIGHT", inputPanel, "BOTTOMRIGHT", 0, -8)
|
|
938
|
-
actionRow:SetHeight(30)
|
|
939
|
-
|
|
940
|
-
local runButton = CreateButton(actionRow, 96, L.RUN, true)
|
|
941
|
-
runButton:SetPoint("RIGHT", actionRow, "RIGHT", 0, 0)
|
|
942
|
-
runButton:SetScript("OnClick", RunInput)
|
|
943
|
-
frame.runButton = runButton
|
|
944
|
-
|
|
945
|
-
local clearInputButton = CreateButton(actionRow, 108, L.CLEAR_INPUT, false)
|
|
946
|
-
clearInputButton:SetPoint("RIGHT", runButton, "LEFT", -8, 0)
|
|
947
|
-
clearInputButton:SetScript("OnClick", function()
|
|
948
|
-
frame.inputPanel.editBox:SetText("")
|
|
949
|
-
frame.inputPanel.editBox:SetFocus()
|
|
950
|
-
SetStatus(L.READY, 0.55, 0.60, 0.65)
|
|
951
|
-
end)
|
|
952
|
-
|
|
953
|
-
local statusDot = actionRow:CreateTexture(nil, "ARTWORK")
|
|
954
|
-
statusDot:SetSize(5, 5)
|
|
955
|
-
statusDot:SetPoint("LEFT", actionRow, "LEFT", 2, 0)
|
|
956
|
-
frame.statusDot = statusDot
|
|
957
|
-
|
|
958
|
-
local status = actionRow:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
959
|
-
status:SetPoint("LEFT", statusDot, "RIGHT", 7, 0)
|
|
960
|
-
frame.status = status
|
|
961
|
-
|
|
962
|
-
local resultLabel = CreateSectionLabel(runnerPage, L.RESULT)
|
|
963
|
-
resultLabel:SetPoint("TOPLEFT", actionRow, "BOTTOMLEFT", 0, -13)
|
|
964
|
-
|
|
965
|
-
local resultTextTab = CreateNavTab(runnerPage, L.TEXT)
|
|
966
|
-
FitNavTab(resultTextTab, 58, 28)
|
|
967
|
-
resultTextTab:SetPoint("TOPRIGHT", actionRow, "BOTTOMRIGHT", 0, -4)
|
|
968
|
-
frame.resultTextTab = resultTextTab
|
|
969
|
-
|
|
970
|
-
local resultTreeTab = CreateNavTab(runnerPage, L.TREE)
|
|
971
|
-
FitNavTab(resultTreeTab, 58, 28)
|
|
972
|
-
resultTreeTab:SetPoint("RIGHT", resultTextTab, "LEFT", -2, 0)
|
|
973
|
-
frame.resultTreeTab = resultTreeTab
|
|
974
|
-
|
|
975
|
-
local resultPanel = CreateTextArea(runnerPage, true)
|
|
976
|
-
resultPanel:SetPoint("TOPLEFT", actionRow, "BOTTOMLEFT", 0, -35)
|
|
977
|
-
resultPanel:SetPoint("BOTTOMRIGHT", -14, 54)
|
|
978
|
-
resultPanel.editBox:SetWidth(WINDOW_WIDTH - MAIN_LEFT - 58)
|
|
979
|
-
resultPanel.editBox:SetScript("OnMouseUp", function(self) self:SetFocus() end)
|
|
980
|
-
frame.resultPanel = resultPanel
|
|
981
|
-
|
|
982
|
-
local treeView = ns.CreateTreeView(runnerPage, {
|
|
983
|
-
CreatePanel = CreatePanel,
|
|
984
|
-
CreateScrollArea = CreateScrollArea,
|
|
985
|
-
editorR = EDITOR_R,
|
|
986
|
-
editorG = EDITOR_G,
|
|
987
|
-
editorB = EDITOR_B,
|
|
988
|
-
surfaceR = SURFACE_R,
|
|
989
|
-
surfaceG = SURFACE_G,
|
|
990
|
-
surfaceB = SURFACE_B,
|
|
991
|
-
accentR = ACCENT_R,
|
|
992
|
-
accentG = ACCENT_G,
|
|
993
|
-
accentB = ACCENT_B,
|
|
994
|
-
contentWidth = WINDOW_WIDTH - MAIN_LEFT - 28,
|
|
995
|
-
})
|
|
996
|
-
treeView.panel:SetPoint("TOPLEFT", actionRow, "BOTTOMLEFT", 0, -35)
|
|
997
|
-
treeView.panel:SetPoint("BOTTOMRIGHT", -14, 54)
|
|
998
|
-
frame.treeView = treeView
|
|
999
|
-
|
|
1000
|
-
local selectButton = CreateButton(runnerPage, 118, L.SELECT_RESULT, false)
|
|
1001
|
-
selectButton:SetPoint("BOTTOMRIGHT", -14, 14)
|
|
1002
|
-
selectButton:SetScript("OnClick", function()
|
|
1003
|
-
SetResultMode("text")
|
|
1004
|
-
SelectAllText(frame.resultPanel)
|
|
1005
|
-
end)
|
|
1006
|
-
frame.selectButton = selectButton
|
|
1007
|
-
|
|
1008
|
-
local clearHistoryButton = CreateButton(runnerPage, HISTORY_WIDTH, L.CLEAR_HISTORY, false)
|
|
1009
|
-
clearHistoryButton:SetPoint("BOTTOMLEFT", 14, 14)
|
|
1010
|
-
clearHistoryButton:SetScript("OnClick", function()
|
|
1011
|
-
ns.ClearHistory()
|
|
1012
|
-
wipe(historyTrees)
|
|
1013
|
-
selectedHistoryIndex = nil
|
|
1014
|
-
SetResult("")
|
|
1015
|
-
frame.treeView:SetTree(nil)
|
|
1016
|
-
SetResultMode("text")
|
|
1017
|
-
SetStatus(L.READY, 0.55, 0.60, 0.65)
|
|
1018
|
-
RefreshHistory()
|
|
1019
|
-
end)
|
|
1020
|
-
frame.clearHistoryButton = clearHistoryButton
|
|
1021
|
-
|
|
1022
|
-
inputPanel.editBox:SetScript("OnTabPressed", function(self)
|
|
1023
|
-
self:Insert(" ")
|
|
1024
|
-
end)
|
|
1025
|
-
|
|
1026
|
-
window = frame
|
|
1027
|
-
local featureUI = {
|
|
1028
|
-
CreatePanel = CreatePanel,
|
|
1029
|
-
CreateScrollArea = CreateScrollArea,
|
|
1030
|
-
CreateTextArea = CreateTextArea,
|
|
1031
|
-
CreateButton = CreateButton,
|
|
1032
|
-
CreateListRow = CreateListRow,
|
|
1033
|
-
CreateViewTab = CreateNavTab,
|
|
1034
|
-
FitViewTab = FitNavTab,
|
|
1035
|
-
CreateSectionLabel = CreateSectionLabel,
|
|
1036
|
-
SetBorderColor = SetBorderColor,
|
|
1037
|
-
SetButtonEnabled = SetButtonEnabled,
|
|
1038
|
-
SetButtonPrimary = SetButtonPrimary,
|
|
1039
|
-
SetButtonText = SetButtonText,
|
|
1040
|
-
SetButtonVariant = SetButtonVariant,
|
|
1041
|
-
SetListRowState = SetListRowState,
|
|
1042
|
-
AppendReadOnlyText = AppendReadOnlyText,
|
|
1043
|
-
SetReadOnlyText = SetReadOnlyText,
|
|
1044
|
-
SelectAllText = SelectAllText,
|
|
1045
|
-
backdrop = BACKDROP,
|
|
1046
|
-
editorR = EDITOR_R,
|
|
1047
|
-
editorG = EDITOR_G,
|
|
1048
|
-
editorB = EDITOR_B,
|
|
1049
|
-
surfaceR = SURFACE_R,
|
|
1050
|
-
surfaceG = SURFACE_G,
|
|
1051
|
-
surfaceB = SURFACE_B,
|
|
1052
|
-
accentR = ACCENT_R,
|
|
1053
|
-
accentG = ACCENT_G,
|
|
1054
|
-
accentB = ACCENT_B,
|
|
1055
|
-
windowWidth = WINDOW_WIDTH,
|
|
1056
|
-
}
|
|
1057
|
-
local exportController = ns.CreateExportController(frame, featureUI)
|
|
1058
|
-
featureUI.ExportText = function(kind, title, content, metadata)
|
|
1059
|
-
return exportController:Save(kind, title, content, metadata)
|
|
1060
|
-
end
|
|
1061
|
-
frame.exportController = exportController
|
|
1062
|
-
|
|
1063
|
-
featureUI.OpenPage = SetActivePage
|
|
1064
|
-
|
|
1065
|
-
local exportResultButton = CreateButton(runnerPage, 92, L.SAVE_TO_DISK, false)
|
|
1066
|
-
exportResultButton:SetPoint("RIGHT", selectButton, "LEFT", -8, 0)
|
|
1067
|
-
exportResultButton:SetScript("OnClick", function()
|
|
1068
|
-
featureUI.ExportText("run_result", L.RESULT, frame.currentResultText, {
|
|
1069
|
-
code = frame.inputPanel.editBox:GetText(),
|
|
1070
|
-
})
|
|
1071
|
-
end)
|
|
1072
|
-
SetButtonEnabled(exportResultButton, false)
|
|
1073
|
-
frame.exportResultButton = exportResultButton
|
|
1074
|
-
|
|
1075
|
-
frame.objectPage = ns.CreateObjectPage(frame, featureUI)
|
|
1076
|
-
featureUI.GetObjectSelection = function()
|
|
1077
|
-
return frame.objectPage:GetSelection()
|
|
1078
|
-
end
|
|
1079
|
-
frame.eventsPage = ns.CreateEventsPage(frame, featureUI)
|
|
1080
|
-
frame.tracePage = ns.CreateTracePage(frame, featureUI)
|
|
1081
|
-
frame.diagnosticsPage = ns.CreateDiagnosticsPage(frame, featureUI)
|
|
1082
|
-
frame.exportRecordsPage = ns.CreateExportRecordsPage(frame, featureUI)
|
|
1083
|
-
frame.automationPage = ns.CreateAutomationPage(frame, featureUI)
|
|
1084
|
-
frame.aboutPage = ns.CreateAboutPage(frame, featureUI)
|
|
1085
|
-
frame.historyButtons = historyButtons
|
|
1086
|
-
frame.pages = {
|
|
1087
|
-
runner = runnerPage,
|
|
1088
|
-
objects = frame.objectPage,
|
|
1089
|
-
events = frame.eventsPage,
|
|
1090
|
-
trace = frame.tracePage,
|
|
1091
|
-
diagnostics = frame.diagnosticsPage,
|
|
1092
|
-
exports = frame.exportRecordsPage,
|
|
1093
|
-
automation = frame.automationPage,
|
|
1094
|
-
about = frame.aboutPage,
|
|
1095
|
-
}
|
|
1096
|
-
for key, page in pairs(frame.pages) do
|
|
1097
|
-
if key ~= "runner" then
|
|
1098
|
-
page:Hide()
|
|
1099
|
-
end
|
|
1100
|
-
end
|
|
1101
|
-
|
|
1102
|
-
frame:SetScript("OnHide", function()
|
|
1103
|
-
StopRuntimeTools()
|
|
1104
|
-
end)
|
|
1105
|
-
frame:HookScript("OnHide", function() exportController:Hide() end)
|
|
1106
|
-
resultTextTab:SetScript("OnClick", function()
|
|
1107
|
-
SetResultMode("text")
|
|
1108
|
-
end)
|
|
1109
|
-
resultTreeTab:SetScript("OnClick", function()
|
|
1110
|
-
SetResultMode("tree")
|
|
1111
|
-
end)
|
|
1112
|
-
|
|
1113
|
-
SetResult("")
|
|
1114
|
-
treeView:SetTree(nil)
|
|
1115
|
-
SetStatus(L.READY, 0.55, 0.60, 0.65)
|
|
1116
|
-
RefreshHistory()
|
|
1117
|
-
SetResultMode("text")
|
|
1118
|
-
SetActivePage("runner")
|
|
1119
|
-
return frame
|
|
1120
|
-
end
|
|
1121
|
-
|
|
1122
|
-
function ns.ToggleWindow()
|
|
1123
|
-
if ns.IsCombatBlocked() then
|
|
1124
|
-
ns.PrintCombatBlocked()
|
|
1125
|
-
return
|
|
1126
|
-
end
|
|
1127
|
-
local frame = window or CreateWindow()
|
|
1128
|
-
if not frame or not frame.pages then
|
|
1129
|
-
return
|
|
1130
|
-
end
|
|
1131
|
-
if frame:IsShown() then
|
|
1132
|
-
frame:Hide()
|
|
1133
|
-
else
|
|
1134
|
-
frame:Show()
|
|
1135
|
-
SetActivePage(activePage)
|
|
1136
|
-
end
|
|
1137
|
-
end
|
|
1138
|
-
|
|
1139
|
-
ns.RegisterCombatShutdown(function()
|
|
1140
|
-
if window and window:IsShown() then
|
|
1141
|
-
window:Hide()
|
|
1142
|
-
else
|
|
1143
|
-
StopRuntimeTools()
|
|
1144
|
-
end
|
|
1145
|
-
end)
|
|
674
|
+
ns.Widgets = {
|
|
675
|
+
Colors = {
|
|
676
|
+
accent = { ACCENT_R, ACCENT_G, ACCENT_B },
|
|
677
|
+
panel = { PANEL_R, PANEL_G, PANEL_B },
|
|
678
|
+
surface = { SURFACE_R, SURFACE_G, SURFACE_B },
|
|
679
|
+
editor = { EDITOR_R, EDITOR_G, EDITOR_B },
|
|
680
|
+
border = { BORDER_R, BORDER_G, BORDER_B },
|
|
681
|
+
},
|
|
682
|
+
Backdrop = BACKDROP,
|
|
683
|
+
LOGO_TEXTURE = "Interface\\AddOns\\" .. ADDON_NAME .. "\\Media\\Logo.png",
|
|
684
|
+
GITHUB_TEXTURE = "Interface\\AddOns\\" .. ADDON_NAME .. "\\Media\\GitHub.png",
|
|
685
|
+
|
|
686
|
+
SetBorderColor = SetBorderColor,
|
|
687
|
+
CreatePanel = CreatePanel,
|
|
688
|
+
CreateScrollArea = CreateScrollArea,
|
|
689
|
+
CreateCloseButton = CreateCloseButton,
|
|
690
|
+
CreateButton = CreateButton,
|
|
691
|
+
CreateConfirmButton = CreateConfirmButton,
|
|
692
|
+
SetButtonVariant = SetButtonVariant,
|
|
693
|
+
SetButtonPrimary = SetButtonPrimary,
|
|
694
|
+
SetButtonEnabled = SetButtonEnabled,
|
|
695
|
+
SetButtonText = SetButtonText,
|
|
696
|
+
CreateSectionLabel = CreateSectionLabel,
|
|
697
|
+
CreateListRow = CreateListRow,
|
|
698
|
+
SetListRowState = SetListRowState,
|
|
699
|
+
CreateNavTab = CreateNavTab,
|
|
700
|
+
FitNavTab = FitNavTab,
|
|
701
|
+
CreateTextArea = CreateTextArea,
|
|
702
|
+
SetReadOnlyText = SetReadOnlyText,
|
|
703
|
+
AppendReadOnlyText = AppendReadOnlyText,
|
|
704
|
+
SelectAllText = SelectAllText,
|
|
705
|
+
}
|