wuira 0.2.3 → 0.2.5

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 (38) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +62 -792
  3. package/data/icons/forever.json +90051 -0
  4. package/docs/icons.md +28 -0
  5. package/docs/source-converters.md +34 -0
  6. package/lib/datasources/DataSource.d.ts +8 -0
  7. package/lib/datasources/DataSource.lua +7 -0
  8. package/lib/datasources/GroupMembers.d.ts +6 -0
  9. package/lib/datasources/GroupMembers.lua +332 -0
  10. package/lib/datasources/GroupRoster.d.ts +28 -0
  11. package/lib/datasources/GroupRoster.lua +611 -0
  12. package/lib/datasources/MathConverter.d.ts +6 -0
  13. package/lib/datasources/MathConverter.lua +61 -0
  14. package/lib/datasources/MathExpression.d.ts +16 -0
  15. package/lib/datasources/MathExpression.lua +281 -0
  16. package/lib/datasources/Resources.d.ts +3 -2
  17. package/lib/datasources/Resources.lua +57 -48
  18. package/lib/datasources/SourceConverter.d.ts +39 -0
  19. package/lib/datasources/SourceConverter.lua +568 -0
  20. package/lib/datasources/UnitInfo.d.ts +6 -0
  21. package/lib/datasources/UnitInfo.lua +347 -15
  22. package/lib/datasources/UnitSource.d.ts +8 -3
  23. package/lib/datasources/UnitSource.lua +318 -5
  24. package/lib/datasources/index.d.ts +7 -1
  25. package/lib/datasources/index.lua +15 -0
  26. package/lib/icons/index.d.ts +45634 -0
  27. package/lib/icons/index.lua +3 -0
  28. package/lib/index.d.ts +1 -0
  29. package/lib/store/index.lua +20 -18
  30. package/lib/ui/Cell.d.ts +2 -0
  31. package/lib/ui/ForEach.d.ts +18 -4
  32. package/lib/ui/ForEach.lua +763 -13
  33. package/lib/ui/index.d.ts +1 -1
  34. package/package.json +20 -4
  35. package/tools/build-library.mjs +1 -1
  36. package/tools/generate-icons.mjs +10 -0
  37. package/tools/icon-data.mjs +59 -0
  38. package/tools/update-icons.mjs +36 -0
@@ -0,0 +1,3 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ return ____exports
package/lib/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export type { CommandCallback } from "./platform/SlashCommands";
6
6
  export { AddonSettings } from "./platform/AddonSettings";
7
7
  export { Encoding } from "./platform/Encoding";
8
8
  export { DruidSpells, GeneralSpells, HunterSpells, MageSpells, PaladinSpells, PetSpells, PriestSpells, ProfessionSpells, RacialSpells, RogueSpells, ShamanSpells, WarlockSpells, WarriorSpells, WorldSpells, BindingActions, } from "./spells/index";
9
+ export { Icons } from "./icons/index";
9
10
  export { BlizzardUI } from "./platform/BlizzardUI";
10
11
  export { ActionBars } from "./platform/ActionBars";
11
12
  export type { ActionSlot, EmptyActionBarsOptions } from "./platform/ActionBars";
@@ -739,10 +739,12 @@ function StoreRegistry.prototype.____constructor(self, options)
739
739
  if string.match(options.variable, "^[%a_][%w_]*$") == nil then
740
740
  error("Invalid SavedVariables name", 0)
741
741
  end
742
- local ____opt_1 = C_AddOns and C_AddOns.IsAddOnLoaded
743
- if ____opt_1 and ____opt_1(options.addon) then
744
- self:Load()
745
- return
742
+ if (C_AddOns and C_AddOns.IsAddOnLoaded) ~= nil then
743
+ local ____, loaded = C_AddOns.IsAddOnLoaded(options.addon)
744
+ if loaded then
745
+ self:Load()
746
+ return
747
+ end
746
748
  end
747
749
  self.listener = CreateFrame("Frame", nil, UIParent)
748
750
  self.listener:RegisterEvent("ADDON_LOADED")
@@ -753,17 +755,17 @@ function StoreRegistry.prototype.____constructor(self, options)
753
755
  return
754
756
  end
755
757
  self:Load()
758
+ local ____opt_3 = self.listener
759
+ if ____opt_3 ~= nil then
760
+ ____opt_3:UnregisterAllEvents()
761
+ end
756
762
  local ____opt_5 = self.listener
757
763
  if ____opt_5 ~= nil then
758
- ____opt_5:UnregisterAllEvents()
764
+ ____opt_5:SetScript("OnEvent", nil)
759
765
  end
760
766
  local ____opt_7 = self.listener
761
767
  if ____opt_7 ~= nil then
762
- ____opt_7:SetScript("OnEvent", nil)
763
- end
764
- local ____opt_9 = self.listener
765
- if ____opt_9 ~= nil then
766
- ____opt_9:Hide()
768
+ ____opt_7:Hide()
767
769
  end
768
770
  self.listener = nil
769
771
  local callbacks = self.readyCallbacks
@@ -784,8 +786,8 @@ function StoreRegistry.prototype.onReady(self, callback)
784
786
  if self.IsReady then
785
787
  callback(nil)
786
788
  else
787
- local ____self_readyCallbacks_11 = self.readyCallbacks
788
- ____self_readyCallbacks_11[#____self_readyCallbacks_11 + 1] = callback
789
+ local ____self_readyCallbacks_9 = self.readyCallbacks
790
+ ____self_readyCallbacks_9[#____self_readyCallbacks_9 + 1] = callback
789
791
  end
790
792
  end
791
793
  function StoreRegistry.prototype.Read(self, schema)
@@ -907,17 +909,17 @@ function StoreRegistry.prototype.subscribe(self, schema, observer)
907
909
  end
908
910
  end
909
911
  function StoreRegistry.prototype.Dispose(self)
912
+ local ____opt_10 = self.listener
913
+ if ____opt_10 ~= nil then
914
+ ____opt_10:UnregisterAllEvents()
915
+ end
910
916
  local ____opt_12 = self.listener
911
917
  if ____opt_12 ~= nil then
912
- ____opt_12:UnregisterAllEvents()
918
+ ____opt_12:SetScript("OnEvent", nil)
913
919
  end
914
920
  local ____opt_14 = self.listener
915
921
  if ____opt_14 ~= nil then
916
- ____opt_14:SetScript("OnEvent", nil)
917
- end
918
- local ____opt_16 = self.listener
919
- if ____opt_16 ~= nil then
920
- ____opt_16:Hide()
922
+ ____opt_14:Hide()
921
923
  end
922
924
  self.listener = nil
923
925
  self.observers:clear()
package/lib/ui/Cell.d.ts CHANGED
@@ -7,6 +7,8 @@ export type Size = number | "inherit";
7
7
  export interface Cell extends Element {
8
8
  }
9
9
  export type CellProps = {
10
+ /** Stable sibling identity for keyed list reconciliation. */
11
+ key?: string | number;
10
12
  width: Size;
11
13
  height: Size;
12
14
  margin?: Spacing;
@@ -1,7 +1,21 @@
1
1
  import type { Element } from "./primitives/jsx";
2
- export interface ForEachProps<T> {
3
- items: readonly T[];
2
+ import type { CellProps } from "./Cell";
3
+ export interface ForEachSource<T> {
4
+ readonly Value: readonly T[];
5
+ onChange(listener: (items: readonly T[]) => void): () => void;
6
+ }
7
+ export interface ForEachProps<T> extends Omit<Partial<CellProps>, "key" | "onMount"> {
8
+ items: readonly T[] | ForEachSource<T>;
9
+ key?: (item: T) => string | number;
4
10
  child: (item: T, index: number) => Element;
11
+ /** Called for an existing key. The view and its native widgets are retained. */
12
+ onUpdate?: (view: Element, item: T, previous: T) => void;
13
+ onDispose?: (view: Element, item: T) => void;
14
+ direction?: "horizontal" | "vertical";
15
+ gap?: number;
16
+ lineGap?: number;
17
+ wrapAfter?: number;
18
+ groupBy?: (item: T) => string | number;
5
19
  }
6
- /** Expands a snapshot into siblings. It creates no native frame or subscription. */
7
- export declare function ForEach<T>({ items, child }: ForEachProps<T>): Element;
20
+ /** Arrays expand once; observable lists keep one mounted tree per stable key. */
21
+ export declare function ForEach<T>(props: ForEachProps<T>): Element;