From 77607fac1e2bc25b8a831c6d3bb4bbfe635382f7 Mon Sep 17 00:00:00 2001 From: pedrozc90 Date: Fri, 23 Oct 2026 20:25:03 -0300 Subject: [PATCH 01/15] remove unused LibClassicDurations and CallbackHandler-1.0 --- .gitmodules | 8 -- CHANGELOG.md | 4 + CLAUDE.md | 1 + docs/compatibility.md | 1 - docs/restructure.md | 286 +++++++++++++++++++++++++++++++++++++++ libs/CallbackHandler-1.0 | 1 - libs/LibClassicDurations | 1 - libs/init.xml | 2 - 8 files changed, 291 insertions(+), 13 deletions(-) create mode 100644 docs/restructure.md delete mode 160000 libs/CallbackHandler-1.0 delete mode 160000 libs/LibClassicDurations diff --git a/.gitmodules b/.gitmodules index 1d046a4..bc96733 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,14 +2,6 @@ path = libs/LibStub url = https://github.com/lua-wow/LibStub.git branch = master -[submodule "libs/CallbackHandler-1.0"] - path = libs/CallbackHandler-1.0 - url = https://github.com/lua-wow/CallbackHandler-1.0.git - branch = master -[submodule "libs/LibClassicDurations"] - path = libs/LibClassicDurations - url = https://github.com/rgd87/LibClassicDurations.git - branch = master [submodule "libs/LibDispel"] path = libs/LibDispel url = https://github.com/lua-wow/LibDispel.git diff --git a/CHANGELOG.md b/CHANGELOG.md index 3974105..d2202e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Removed + +- Unused libraries LibClassicDurations and CallbackHandler-1.0 + ## [5.3.0] - 2026-10-19 ### Added diff --git a/CLAUDE.md b/CLAUDE.md index b2dca78..713d196 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -65,6 +65,7 @@ I review and test changes in-game, then group them into commits myself. - Don't create, edit or comment on GitHub issues/PRs unless I explicitly ask. - Issue workflow: read the issue → inspect code → propose a plan → implement → leave uncommitted. - Never add `Co-authored by Claude Code` on commits, PRs or issues. +- Do not mention documentations, plans, any claude code md file in commits or PR. ## Verifying diff --git a/docs/compatibility.md b/docs/compatibility.md index 1478dee..ac6b28d 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -37,7 +37,6 @@ One `Filger.toc` serves every client (`## Interface: 11509, 20506, 38002, 50504, ## Libraries Git submodules in `libs/`, loaded by `libs/init.xml`: `LibStub`, `LibDispel`. -`CallbackHandler-1.0` and `LibClassicDurations` are present but commented out. ## Runtime client checks diff --git a/docs/restructure.md b/docs/restructure.md new file mode 100644 index 0000000..d63280f --- /dev/null +++ b/docs/restructure.md @@ -0,0 +1,286 @@ +# Restructure + +Analysis of the current file layout and the migration plan toward a clearer one. Constraints: keep +`FilgerData` compatible, keep the single `Filger.toc` load order (no build step), stay lightweight. +Client and TOC rules: [compatibility.md](compatibility.md). + +## Current structure + +Load order (`Filger.toc`): + +| # | File | What it does | +|---|------|--------------| +| 1 | `libs/init.xml` | LibStub, LibDispel (LibDispel only used by Classic auras) | +| 2 | `core/data.lua` | `ns.data`: row constructors (`CreateSpellPriority`, `CreateSpellCooldown`, `CreateSlotCooldown`), source collectors (`AddSpells/AddBlacklist/AddCooldowns`), `Finalize()` that validates and writes `Filger.blacklist/spells/cooldowns/all` | +| 3 | `data/[Game]/*.lua`, `data/shared/*.lua` | Pure data, pushed into `ns.data` | +| 4 | `core/init.xml` → `init.lua` | Global frame `Filger` (= `ns.Filger`), client flags, player class, pixel scale | +| | `colors.lua` | `Filger:CreateColor`, `Filger.colors` (dispel colors, Classic only) | +| | `medias.lua` | Font/texture paths | +| | `utils.lua` | print/warn/error, `FormatTime`, `GetSpellInfo`/`GetSpellCooldown` shims | +| | `api.lua` | Tukui-style `MergeAPI` (patches widget metatables with `SetOutside/SetInside/CreateBackdrop`); skipped if Tukui/Tainted is loaded | +| | `commands.lua` | `/filger` dispatcher, `auras` command | +| | `development.lua` | `exp4..exp10` experiments (ships to users; not in `exclude.lst`) | +| 5 | `config.lua` | Calls `ns.data.Finalize()`, then builds `Filger.config` = `general` + `layout` + the `PLAYER_COOLDOWNS` frame | +| 6 | `core/[Family]/auras.lua` | Mainline: `container_proto` + 7 frame defs. Classic: `aura_proto` + 7 frame defs. Both `Mixin` their frames into `Filger.config.frames` | +| 7 | `Filger.lua` | Button widget (`button_proto`, `StyleButton`, `CreateButton`, Mainline time formatter/curve), cooldown element (`cooldown_proto`), `element_proto:SetPosition`, `Filger:Spawn`, bootstrap (`ADDON_LOADED`, `PLAYER_LOGIN`) | + +Mixed responsibilities: +- The `Filger` frame is at once the global, event dispatcher, config holder, data store + (`blacklist/spells/cooldowns/all`), utility library, cross-file channel (`timeTextOptions`) and the + list of spawned elements (`table.insert(self, element)`). +- Config lives in three places: `config.lua`, both `core/[Family]/auras.lua`, and `data/`. +- Element implementations live in two places: cooldowns in `Filger.lua`, auras in `core/[Family]/`. + +`ns` (`local _, ns = ...`) is a private table WoW passes only to Filger's own files; it is not global. +Everything stored on `Filger` is global (`_G.Filger`), readable by any addon or `/run`. + +## Problems, ranked by maintenance cost + +1. **`Filger.lua` is a grab bag.** Button widget, a complete feature (cooldowns), generic layout + (`SetPosition`), type dispatch (`Spawn`) and bootstrap in one file. Cooldowns is a peer of auras but + lives in the "main" file. +2. **Frame definitions duplicated per family.** `core/Mainline/auras.lua` and `core/Classic/auras.lua` + define the same 7 frames with identical anchor/limit/size/spacing/growth; only the filter part + differs. Moving one frame means editing 2 files; the cooldown frame is in a 3rd. +3. **Hidden load-order side effects.** `config.lua` runs data validation (`Finalize`); config must load + after `core/init.xml` (needs `warn`, `GetSpellInfo`) and before `auras.lua` (mutates + `config.frames`), which must load before `Filger.lua` (reads `ns.aura_proto`/`ns.container_proto`). + None of this is visible in the TOC. +4. **Duplicated render pipeline with dead bookkeeping.** `aura_proto:UpdateAuras` (Classic) and + `cooldown_proto:UpdateCooldowns` share the same sort → update → hide → position block, and both + `Update` methods share button acquisition and cooldown/icon setup. `visibleChanged` and (in + cooldowns) `changed` are always `true`, so `createdButtons/anchoredButtons/visibleButtons` do nothing. +5. **Family code in shared files.** `Filger.lua` builds the Mainline formatter/curve on every client and + publishes `Filger.timeTextOptions` for `core/Mainline/auras.lua`. `Filger.colors`, `Filger.all` and + LibDispel load everywhere but are Classic only. +6. **Prototype tables shared across instances.** `cooldown_proto.casted`/`.spells` are proto tables; + `Mixin` copies references, so every cooldown element would share one `casted`. Latent (one frame today). +7. **Magic-string dispatch.** `Spawn` picks the element type by `filter == "COOLDOWN"`, then + `data.groups`, else aura. +8. **Unused surface.** `SetOutside/SetInside` (never called), `general.well_fed`, `caster`, + `hidePlayer` (set, never read), the stale field doc in `config.lua`, commented blocks, + `development.lua` shipped to players. +9. **`core/` is not the core.** It holds bootstrap, assets, utils, dev tools, data plumbing and family + elements; the actual core (`Filger.lua`) sits outside it. + +## Options + +All options keep the Tukui/Tainted integration and add ElvUI (see [Skin integration](#skin-integration)). + +### A. Reshuffle only +``` +Filger/ +├── Filger.toc +├── Filger.lua bootstrap only +├── config.lua unchanged +├── core/ +│ ├── init.xml + button.lua, element.lua +│ ├── init.lua, colors.lua, medias.lua, utils.lua, api.lua +│ ├── button.lua NEW button_proto, StyleButton, CreateButton +│ ├── element.lua NEW element_proto:SetPosition, Spawn +│ ├── cooldowns.lua NEW cooldown_proto +│ ├── commands.lua, development.lua, data.lua +│ ├── Mainline/auras.lua unchanged +│ └── Classic/auras.lua unchanged +├── data/ libs/ medias/ +``` +- Cost: ~4 cut/paste commits. Fixes #1, part of #9. +- Leaves duplication, config sprawl and hidden ordering. + +### B. Split "what to show" from "how to show it" +``` +Filger/ +├── Filger.toc # comments state the load order +├── Filger.lua bootstrap only +├── config.lua general + anchor/size/limit/growth for all 8 frames +├── config/ +│ ├── Mainline/frames.lua groups per frame +│ └── Classic/frames.lua filter/spells/FilterAura/SortAuras per frame +├── core/ +│ ├── init.lua, colors.lua, medias.lua, utils.lua, api.lua +│ ├── button.lua NEW button widget, AcquireButton +│ ├── element.lua NEW SetPosition, Render (shared), Spawn on def.type +│ ├── commands.lua, development.lua, data.lua +├── elements/ +│ ├── cooldowns.lua cooldown_proto +│ ├── Mainline/auras.lua container_proto +│ └── Classic/auras.lua aura_proto +├── data/ libs/ medias/ +``` +- Cost: ~8–10 commits, touches every Lua file except data. Fixes #1–#7, #9. +- Risk: Classic aura and cooldown render path (shared `Render`), load order of new files. + +### C. Real modules +``` +Filger/ +├── Filger.lua bootstrap: Finalize → BuildConfig → spawn from ns.elements +├── config.lua ns.BuildConfig(), called at PLAYER_LOGIN +├── core/ +│ ├── init.lua global frame (title/version only), ns.client flags +│ ├── util.lua ns.util: print/warn, FormatTime, spell shims, skin adapter (replaces MergeAPI) +│ ├── media.lua ns.media: fonts, textures, CreateColor +│ ├── button.lua ns.button +│ ├── element.lua ns.element: SetPosition, Render, Spawn via ns.elements[def.type] +│ ├── commands.lua, data.lua +├── elements/ +│ ├── cooldowns.lua ns.elements.cooldowns +│ ├── Mainline/auras.lua ns.elements.auras = container proto + filter spec +│ └── Classic/auras.lua ns.elements.auras = aura proto + filter spec + dispel colors +├── dev/development.lua own TOC line, easy to leave out of releases +├── data/ libs/ LibDispel on its own TOC line, classic only +``` +- Cost: rewrite of every core file, ~15 commits. Fixes everything including #8. +- Risk: external code reading `_G.Filger.*`, LibDispel TOC tagging, Filger's own backdrop when no UI is + loaded (no longer a metatable method). + +### Skin integration + +When Tukui, Tainted or ElvUI is loaded, Filger buttons use that UI's backdrop. + +Today: +- **Tukui/Tainted:** `core/api.lua` returns early, so `button:CreateBackdrop()` resolves to Tukui's + (`Tukui/Core/Toolkit.lua`, `Toolkit.API.CreateBackdrop`). The field matches (`self.Backdrop`), but Tukui + draws borders with textures and colors them with `Backdrop:SetBorderColor`. Classic dispel coloring + calls `SetBackdropBorderColor`, so it most likely has no visible effect under Tukui (**unverified**). + Tainted is not in `../refs` (**unverified**, assumed Tukui-like). +- **ElvUI (accidental):** ElvUI patches `CreateBackdrop` onto widget metatables at load + (`ElvUI/Game/Shared/General/Toolkit.lua`). `MergeAPI` only fills missing methods, so if ElvUI loads + first Filger uses ElvUI's. Load order is not guaranteed (ElvUI is not in `OptionalDeps`), and ElvUI + stores the backdrop as `frame.backdrop`, so Filger's `button.Backdrop` checks miss it. + +Target (~20 lines in `core/api.lua`, or `core/util.lua` in C): +- `## OptionalDeps: Tainted, Tukui, ElvUI` so those UIs load first. +- `api.lua` early return also covers ElvUI. +- `StyleButton` calls `button:CreateBackdrop()`, then `button.Backdrop = button.Backdrop or button.backdrop`. +- Border color helper: `Backdrop.SetBorderColor` when present (Tukui), else `SetBackdropBorderColor`. +- Only the backdrop defers; fonts and timer text stay Filger's. + +## Decision: B, trimmed + +Context: mostly maintenance (the potion cooldown in [future-plan.md](future-plan.md) is the one planned +feature), Classic fully supported, skin integration kept and extended to ElvUI. C is too much for a +maintenance project; A leaves the duplication that makes Classic expensive. Trimmed B: +- **No `config/[Family]` folder.** Each family's filter spec stays next to the code that reads it + (`groups` only means something to `container_proto`, `FilterAura` only to `aura_proto`). Only the + repeated layout moves to `config.lua`. +- **`Finalize()` stays at the top of `config.lua`.** The TOC gets `#` comments stating the order instead. +- `api.lua`/`MergeAPI` stay, plus the skin adapter. + +Target tree (sketch, not final): +``` +Filger/ +├── Filger.toc one TOC, # comments state the load order +├── Filger.lua bootstrap: ADDON_LOADED, PLAYER_LOGIN → Spawn each frame +├── config.lua Finalize(), general style, all 8 frames' anchor/size/limit/growth +├── core/ +│ ├── init.xml loads the files below, in this order +│ ├── init.lua global frame, client flags, player class +│ ├── colors.lua CreateColor (+ dispel colors) +│ ├── medias.lua font/texture paths +│ ├── utils.lua print/warn, FormatTime, GetSpellInfo/GetSpellCooldown shims +│ ├── api.lua MergeAPI (skipped under Tukui/Tainted/ElvUI) + skin adapter +│ ├── button.lua button_proto, StyleButton, CreateButton, time formatter +│ ├── element.lua element_proto (SetPosition, AcquireButton, Render), Spawn +│ ├── commands.lua /filger +│ ├── development.lua exp* experiments +│ └── data.lua row constructors, source collectors, Finalize +├── elements/ +│ ├── cooldowns.lua cooldown_proto (potion cooldown goes here) +│ ├── Mainline/auras.lua container_proto + Retail/Forever filter spec per frame +│ └── Classic/auras.lua aura_proto + Classic filter spec per frame +├── data/ unchanged +├── libs/ unchanged +└── medias/ unchanged +``` + +TOC load block (sketch): +``` +libs\init.xml +# data plumbing, then data files push rows into ns.data +core\data.lua +data\[Game]\blacklist.lua +data\[Game]\cooldowns.lua +data\[Game]\spells.lua +data\shared\blacklist.lua +data\shared\cooldowns.lua +# Filger frame, utils, button/element prototypes +core\init.xml +# validates data, defines frame layout (needs core + data) +config.lua +# element types; aura files add their filter spec to config.frames +elements\cooldowns.lua +elements\[Family]\auras.lua +# spawns frames at PLAYER_LOGIN +Filger.lua +``` + +Where to look: + +| I want to… | File | +|---|---| +| move/resize a frame | `config.lua` | +| change what a frame shows on Retail / Classic | `elements/Mainline/auras.lua` / `elements/Classic/auras.lua` | +| change cooldown behavior | `elements/cooldowns.lua` | +| change button look, timer text, tooltip | `core/button.lua` | +| change icon placement/growth | `core/element.lua` (`SetPosition`) | +| add a spell | `data//` | + +## Migration + +Each step is one commit that leaves the addon working. + +Progress: +- [x] 0. Drop `LibClassicDurations` +- [ ] 1. Skin integration +- [ ] 2. Document load order +- [ ] 3. Extract `core/button.lua` +- [ ] 4. Extract `core/element.lua` +- [ ] 5. Extract `elements/cooldowns.lua` +- [ ] 6. Move the family auras +- [ ] 7. Per-instance state +- [ ] 8. Explicit element type +- [ ] 9. Share the render path +- [ ] 10. Layout once +- [ ] 11. Remove unused code + +0. **Done: removed `LibClassicDurations` and `CallbackHandler-1.0`.** The library was added because Era + reported `duration = 0` for auras from other casters. Era now reports real durations (another + player's Arcane Intellect on a target: `duration = 1800`). Neither library was loaded, so no behavior change. +1. **Skin integration** ([above](#skin-integration)). Behavior change (ElvUI deferral becomes deliberate, + dispel borders show under Tukui/ElvUI), independent of the restructure. +2. **Document load order** with `#` comments in `Filger.toc`. +3. **Extract `core/button.lua`**: `button_proto`, formatter/curve, `timeTextOptions`, `StyleButton`, + `CreateButton`, unchanged. Add to `core/init.xml` after `api.lua`. +4. **Extract `core/element.lua`**: `element_proto:SetPosition` and `Filger:Spawn`, unchanged. +5. **Extract `elements/cooldowns.lua`**: `cooldown_proto`, exposed as `ns.cooldown_proto` like the aura + protos. `Filger.lua` is now bootstrap only. +6. **Move the family auras** to `elements/[Family]/auras.lua` and update the TOC line. +7. **Per-instance state**: create `casted`/`spells`/`active` per element instead of on the proto. +8. **Explicit element type**: frame defs get `type = "cooldowns" | "container" | "auras"`; `Spawn` + dispatches on it. +9. **Share the render path**: `element_proto:AcquireButton(index)` and `element_proto:Render(unit, sorted)` + (sort, update 1..n, hide the rest, `SetPosition(1, n)`), used by `aura_proto` and `cooldown_proto`. + Drop the dead bookkeeping. Same behavior: `SetPosition(1, n)` already runs on every update. +10. **Layout once**: `config.lua` defines all 8 frames' anchor/limit/size/spacing/growth with small + `left`/`right` default tables; family files add `type`, `groups` or `filter/spells/FilterAura/SortAuras`, + and per-family overrides (`BOSS_DEBUFFS.enabled = false` on Classic, `desaturated`). +11. **Remove unused code**: `SetOutside`/`SetInside`, `caster`, `hidePlayer`, `well_fed`, the stale field + doc in `config.lua`, commented blocks in `Spawn`. + +Later, optional: +- Stop shipping `development.lua`. Excluding a file `init.xml` still references may log a missing-file + error (**unverified**), so it needs its own TOC line. +- Move the Classic-only `Filger.colors` into `elements/Classic/auras.lua`. + +## Verification + +Every step: +- `mise exec -- make check`. +- `/reload` on Retail, Forever, Era and MoP (TBC/WotLK at least after steps 6, 9 and 10): frames in the + same positions, player/target/focus auras shown, cooldowns after a cast, trinket slot cooldowns, + tooltips, no Lua errors. + +After steps 1 and 3, once each with no UI addon, Tukui (or Tainted) and ElvUI: buttons use that UI's +backdrop, Classic debuff borders take the dispel color, no Lua errors. + +Steps 9–10 are the risky ones (Classic aura and cooldown paths); compare against a screenshot taken before. diff --git a/libs/CallbackHandler-1.0 b/libs/CallbackHandler-1.0 deleted file mode 160000 index 5a22407..0000000 --- a/libs/CallbackHandler-1.0 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5a224077d0c9f7e904c4993e35e9396b159cb7f1 diff --git a/libs/LibClassicDurations b/libs/LibClassicDurations deleted file mode 160000 index 4775838..0000000 --- a/libs/LibClassicDurations +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4775838d442532e866c8ef045eea0f1b0cf879df diff --git a/libs/init.xml b/libs/init.xml index 8c64340..9bee6a9 100644 --- a/libs/init.xml +++ b/libs/init.xml @@ -1,6 +1,4 @@