wuira 0.1.4 → 0.1.6

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 (79) hide show
  1. package/CHANGELOG.md +102 -1
  2. package/README.md +347 -0
  3. package/lib/Spells.d.ts +21 -0
  4. package/lib/Spells.lua +41 -0
  5. package/lib/datasources/AuraTimer.d.ts +21 -0
  6. package/lib/datasources/AuraTimer.lua +322 -0
  7. package/lib/datasources/CastTimer.d.ts +9 -0
  8. package/lib/datasources/CastTimer.lua +240 -0
  9. package/lib/datasources/DataSource.d.ts +4 -0
  10. package/lib/datasources/DataSource.lua +24 -0
  11. package/lib/datasources/KnownSpells.d.ts +21 -0
  12. package/lib/datasources/KnownSpells.lua +794 -0
  13. package/lib/datasources/ManaRegenTimer.d.ts +29 -0
  14. package/lib/datasources/ManaRegenTimer.lua +674 -0
  15. package/lib/datasources/ProgressSource.d.ts +6 -2
  16. package/lib/datasources/ProgressSource.lua +34 -3
  17. package/lib/datasources/Resources.d.ts +33 -2
  18. package/lib/datasources/Resources.lua +562 -10
  19. package/lib/datasources/SpellCooldown.d.ts +12 -0
  20. package/lib/datasources/SpellCooldown.lua +218 -0
  21. package/lib/datasources/SpellSource.d.ts +14 -0
  22. package/lib/datasources/SpellSource.lua +224 -0
  23. package/lib/datasources/SwingTimer.d.ts +31 -0
  24. package/lib/datasources/SwingTimer.lua +641 -0
  25. package/lib/datasources/TextureSource.d.ts +10 -0
  26. package/lib/datasources/TextureSource.lua +83 -0
  27. package/lib/datasources/TimerSource.d.ts +20 -0
  28. package/lib/datasources/TimerSource.lua +338 -0
  29. package/lib/datasources/TotemTimer.d.ts +10 -0
  30. package/lib/datasources/TotemTimer.lua +260 -0
  31. package/lib/datasources/index.d.ts +16 -1
  32. package/lib/datasources/index.lua +43 -0
  33. package/lib/index.d.ts +11 -0
  34. package/lib/index.lua +24 -0
  35. package/lib/platform/ActionBars.d.ts +27 -0
  36. package/lib/platform/ActionBars.lua +726 -0
  37. package/lib/platform/AddonSettings.d.ts +9 -0
  38. package/lib/platform/AddonSettings.lua +36 -0
  39. package/lib/platform/BlizzardUI.d.ts +17 -0
  40. package/lib/platform/BlizzardUI.lua +689 -0
  41. package/lib/platform/MicroMenu.d.ts +15 -0
  42. package/lib/platform/MicroMenu.lua +219 -0
  43. package/lib/platform/SecureButton.d.ts +5 -0
  44. package/lib/platform/SecureButton.lua +196 -0
  45. package/lib/platform/SlashCommands.d.ts +3 -0
  46. package/lib/platform/SlashCommands.lua +309 -0
  47. package/lib/platform/forever.d.ts +115 -2
  48. package/lib/skins/MicroBar.d.ts +8 -0
  49. package/lib/skins/MicroBar.lua +65 -0
  50. package/lib/skins/NativeSkin.d.ts +26 -0
  51. package/lib/skins/NativeSkin.lua +601 -0
  52. package/lib/skins/index.d.ts +3 -0
  53. package/lib/skins/index.lua +11 -0
  54. package/lib/store/index.lua +13 -0
  55. package/lib/ui/Button.d.ts +10 -0
  56. package/lib/ui/Button.lua +9 -0
  57. package/lib/ui/Cell.d.ts +7 -1
  58. package/lib/ui/FrameMover.d.ts +21 -0
  59. package/lib/ui/FrameMover.lua +123 -0
  60. package/lib/ui/HoverTracker.d.ts +20 -0
  61. package/lib/ui/HoverTracker.lua +88 -0
  62. package/lib/ui/Icon.d.ts +8 -0
  63. package/lib/ui/Icon.lua +8 -0
  64. package/lib/ui/KeybindCapture.d.ts +20 -0
  65. package/lib/ui/KeybindCapture.lua +488 -0
  66. package/lib/ui/Label.d.ts +10 -0
  67. package/lib/ui/Label.lua +8 -0
  68. package/lib/ui/ProgressBar.d.ts +5 -1
  69. package/lib/ui/SecureButton.d.ts +44 -0
  70. package/lib/ui/SecureButton.lua +9 -0
  71. package/lib/ui/index.d.ts +13 -0
  72. package/lib/ui/index.lua +28 -0
  73. package/lib/ui/layout/measureLayout.lua +11 -2
  74. package/lib/ui/mount.lua +679 -74
  75. package/lib/ui/primitives/jsx.d.ts +15 -2
  76. package/lib/wuira.d.ts +3 -0
  77. package/lib/wuira.lua +5 -0
  78. package/package.json +8 -1
  79. package/tools/build-library.mjs +1 -1
@@ -3,18 +3,23 @@ import type { FlowLayoutProps } from "../FlowLayout";
3
3
  import type { GridLayoutProps } from "../GridLayout";
4
4
  import type { ProgressBarProps } from "../ProgressBar";
5
5
  import type { ProgressSource } from "../../datasources/ProgressSource";
6
+ import type { TimerSource } from "../../datasources/TimerSource";
7
+ import type { LabelProps } from "../Label";
8
+ import type { IconProps } from "../Icon";
9
+ import type { SecureButtonProps } from "../SecureButton";
10
+ import type { ButtonProps } from "../Button";
6
11
  /** Declarative UI description; native frames are created by mount. */
7
12
  export interface Element {
8
13
  kind: string;
9
14
  props: object;
10
15
  child?: Element;
11
16
  children?: Element[];
12
- source?: ProgressSource;
17
+ source?: ProgressSource | TimerSource;
13
18
  }
14
19
  export type Component<P extends object> = (props: P, child?: Element) => Element;
15
20
  export declare namespace UI {
16
21
  function Fragment(): Element;
17
- function createElement<P extends object>(component: Component<P> | "cell" | "flow" | "grid" | "progress", props: P | undefined, ...children: (Element | Element[])[]): Element;
22
+ function createElement<P extends object>(component: Component<P> | "cell" | "flow" | "grid" | "progress" | "label" | "icon" | "button" | "secureButton", props: P | undefined, ...children: (Element | Element[])[]): Element;
18
23
  namespace JSX {
19
24
  type Element = import("./jsx").Element;
20
25
  interface ElementChildrenAttribute {
@@ -33,6 +38,14 @@ export declare namespace UI {
33
38
  progress: Partial<ProgressBarProps> & {
34
39
  child?: Element;
35
40
  };
41
+ label: Partial<LabelProps>;
42
+ icon: Partial<IconProps>;
43
+ secureButton: Partial<SecureButtonProps> & {
44
+ child?: Element;
45
+ };
46
+ button: Partial<ButtonProps> & {
47
+ child?: Element;
48
+ };
36
49
  }
37
50
  }
38
51
  }
package/lib/wuira.d.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  import type { Cell } from "./ui/Cell";
2
2
  import type { Anchor } from "./types/Position";
3
+ import type { CommandCallback } from "./platform/SlashCommands";
3
4
  /** Public entry point for mounting JSX UI trees. */
4
5
  export declare class wuira {
5
6
  private constructor();
7
+ /** Registers a slash command; the returned function removes this registration. */
8
+ static registerCommand(command: string, callback: CommandCallback): () => void;
6
9
  static Mount(frame: Cell | void | (() => Cell | void), anchor?: Anchor, parent?: wuiraNativeFrame): wuiraNativeFrame | undefined;
7
10
  static Unmount(frame: wuiraNativeFrame): void;
8
11
  }
package/lib/wuira.lua CHANGED
@@ -11,12 +11,17 @@ local ____exports = {}
11
11
  local ____mount = require("ui.mount")
12
12
  local mount = ____mount.mount
13
13
  local unmount = ____mount.unmount
14
+ local ____SlashCommands = require("platform.SlashCommands")
15
+ local registerCommand = ____SlashCommands.registerCommand
14
16
  --- Public entry point for mounting JSX UI trees.
15
17
  ____exports.wuira = __TS__Class()
16
18
  local wuira = ____exports.wuira
17
19
  wuira.name = "wuira"
18
20
  function wuira.prototype.____constructor(self)
19
21
  end
22
+ function wuira.registerCommand(self, command, callback)
23
+ return registerCommand(nil, command, callback)
24
+ end
20
25
  function wuira.Mount(self, frame, anchor, parent)
21
26
  local ____temp_0
22
27
  if type(frame) == "function" then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wuira",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "author": {
5
5
  "name": "Kerim Cetinbas",
6
6
  "email": "a.cetinbas@icloud.com"
@@ -24,6 +24,10 @@
24
24
  "types": "./lib/store/index.d.ts",
25
25
  "default": "./lib/store/index.lua"
26
26
  },
27
+ "./skins": {
28
+ "types": "./lib/skins/index.d.ts",
29
+ "default": "./lib/skins/index.lua"
30
+ },
27
31
  "./console-polyfill": {
28
32
  "types": "./lib/console-polyfill.d.ts",
29
33
  "default": "./lib/console-polyfill.lua"
@@ -43,6 +47,9 @@
43
47
  "store": [
44
48
  "lib/store/index.d.ts"
45
49
  ],
50
+ "skins": [
51
+ "lib/skins/index.d.ts"
52
+ ],
46
53
  "console-polyfill": [
47
54
  "lib/console-polyfill.d.ts"
48
55
  ]
@@ -8,7 +8,7 @@ const result = spawnSync(process.execPath, [require.resolve("typescript-to-lua/d
8
8
  if (result.status !== 0) process.exit(result.status || 1);
9
9
  fs.mkdirSync(path.join(root, "lib/platform"), { recursive: true });
10
10
  fs.copyFileSync(path.join(root, "src/platform/forever.d.ts"), path.join(root, "lib/platform/forever.d.ts"));
11
- for (const file of ["index.d.ts", "ui/index.d.ts", "datasources/index.d.ts", "store/index.d.ts"]) {
11
+ for (const file of ["index.d.ts", "ui/index.d.ts", "datasources/index.d.ts", "store/index.d.ts", "skins/index.d.ts"]) {
12
12
  const target = path.join(root, "lib", file);
13
13
  const reference = file === "index.d.ts" ? "./platform/forever.d.ts" : "../platform/forever.d.ts";
14
14
  fs.writeFileSync(target, `/// <reference path="${reference}" />\n` + fs.readFileSync(target, "utf8"));