@overmvp/kumi 0.0.0-stage → 0.3.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 (319) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -2
  3. package/animation/color-transition.ts +196 -0
  4. package/animation/cycle.ts +151 -0
  5. package/animation/ease.ts +29 -0
  6. package/animation/index.ts +13 -0
  7. package/animation/package.json +12 -0
  8. package/animation/presets.ts +376 -0
  9. package/animation/spec.ts +197 -0
  10. package/builder/Cargo.lock +192 -0
  11. package/builder/Cargo.toml +7 -0
  12. package/builder/css-v1.mjs +387 -0
  13. package/builder/css-v1.test.mjs +361 -0
  14. package/builder/generated-output.mjs +61 -0
  15. package/builder/generated-output.test.mjs +132 -0
  16. package/builder/jsx-form.mjs +93 -0
  17. package/builder/jsx-form.test.mjs +48 -0
  18. package/builder/jsx-lists.mjs +209 -0
  19. package/builder/link-addon-package.mjs +127 -0
  20. package/builder/lua-assets.mjs +74 -0
  21. package/builder/lua-builtin-values.mjs +57 -0
  22. package/builder/lua-builtin-values.test.mjs +155 -0
  23. package/builder/lua-loop-closures.mjs +183 -0
  24. package/builder/lua-loop-closures.test.mjs +89 -0
  25. package/builder/lua-truthiness.mjs +61 -0
  26. package/builder/lua-truthiness.test.mjs +113 -0
  27. package/builder/module-declarations.mjs +594 -0
  28. package/builder/module-declarations.test.mjs +435 -0
  29. package/builder/native-kernels.mjs +60 -0
  30. package/builder/native-lua.d.ts +57 -0
  31. package/builder/native-routes.mjs +51 -0
  32. package/builder/no-static-ref-read.mjs +93 -0
  33. package/builder/no-static-ref-read.test.mjs +181 -0
  34. package/builder/secure-snippet.mjs +317 -0
  35. package/builder/secure-snippet.test.mjs +101 -0
  36. package/builder/shared-lua-runtime.mjs +150 -0
  37. package/builder/src/addon-link.lua +29 -0
  38. package/builder/src/arrays.lua +260 -0
  39. package/builder/src/assets.rs +177 -0
  40. package/builder/src/classes.lua +75 -0
  41. package/builder/src/collections.lua +190 -0
  42. package/builder/src/compiler.rs +2336 -0
  43. package/builder/src/config.rs +42 -0
  44. package/builder/src/entries.rs +166 -0
  45. package/builder/src/errors.lua +15 -0
  46. package/builder/src/lua_data.rs +231 -0
  47. package/builder/src/main.rs +381 -0
  48. package/builder/src/native_ir.rs +65 -0
  49. package/builder/src/native_signal.rs +83 -0
  50. package/builder/src/numbers.lua +76 -0
  51. package/builder/src/project-front.mjs +3682 -0
  52. package/builder/src/records.lua +75 -0
  53. package/builder/src/routes.rs +124 -0
  54. package/builder/src/setup-store.lua +18 -0
  55. package/builder/src/signal-kernel.fingerprint +1 -0
  56. package/builder/src/strings.lua +103 -0
  57. package/builder/src/ts-lower.mjs +68 -0
  58. package/builder/src/wow-reads.lua +22 -0
  59. package/builder/src/wow_client.rs +253 -0
  60. package/builder/src/wow_types.rs +564 -0
  61. package/builder/style-modules.mjs +93 -0
  62. package/builder/style-states.mjs +100 -0
  63. package/builder/style-states.test.mjs +103 -0
  64. package/builder/vite-assets.mjs +53 -0
  65. package/builder/vite-project.mjs +10 -0
  66. package/config.ts +59 -0
  67. package/eslint.mjs +74 -0
  68. package/form/index.ts +526 -0
  69. package/form/package.json +13 -0
  70. package/motion/index.ts +2 -0
  71. package/motion/package.json +10 -0
  72. package/package.json +26 -4
  73. package/router/index.ts +50 -0
  74. package/router/navigation.ts +22 -0
  75. package/router/package.json +12 -0
  76. package/router/router-view.ts +134 -0
  77. package/router/routes.ts +64 -0
  78. package/scripts/addon-build.mjs +364 -0
  79. package/scripts/addon-project.mjs +78 -0
  80. package/scripts/kumi-cli.mjs +105 -0
  81. package/scripts/link-addons.mjs +61 -0
  82. package/src/bindings.ts +35 -0
  83. package/src/context.ts +15 -0
  84. package/src/css-tokens.ts +239 -0
  85. package/src/css-v1.ts +68 -0
  86. package/src/cvars.ts +91 -0
  87. package/src/element-node.ts +32 -0
  88. package/src/elements.ts +505 -0
  89. package/src/feature-scope.ts +82 -0
  90. package/src/flex-layout.ts +807 -0
  91. package/src/frame-scheduler.ts +336 -0
  92. package/src/grid-tracks.ts +165 -0
  93. package/src/image-imports.d.ts +24 -0
  94. package/src/images.ts +79 -0
  95. package/src/index.ts +29 -0
  96. package/src/jsx-dev-runtime.ts +2 -0
  97. package/src/jsx-runtime.ts +29 -0
  98. package/src/jsx.d.ts +12 -0
  99. package/src/keyed-list.ts +366 -0
  100. package/src/media-query.ts +144 -0
  101. package/src/module-ui.ts +147 -0
  102. package/src/module.ts +311 -0
  103. package/src/node-selectors.ts +114 -0
  104. package/src/owned-collections.ts +52 -0
  105. package/src/providers.ts +241 -0
  106. package/src/reactive-scope.ts +34 -0
  107. package/src/reactivity.ts +275 -0
  108. package/src/result.ts +64 -0
  109. package/src/runtime.ts +52 -0
  110. package/src/scheduler.ts +185 -0
  111. package/src/signal-kernel.ts +63 -0
  112. package/src/style-classes.ts +51 -0
  113. package/src/style-states.ts +134 -0
  114. package/src/style-variables.ts +53 -0
  115. package/src/text-children.ts +42 -0
  116. package/src/theme.ts +50 -0
  117. package/src/transition.ts +18 -0
  118. package/state/index.ts +9 -0
  119. package/state/package.json +12 -0
  120. package/state/setup-store-persistence.ts +206 -0
  121. package/state/setup-store-view.ts +10 -0
  122. package/state/setup-store.ts +342 -0
  123. package/state/store-bindings.ts +25 -0
  124. package/state/store.ts +84 -0
  125. package/styles/_layers.scss +14 -0
  126. package/templates/addon/.agents/skills/kumi-build-debug/SKILL.md +36 -0
  127. package/templates/addon/.agents/skills/kumi-feature/SKILL.md +50 -0
  128. package/templates/addon/.agents/skills/kumi-plugin/SKILL.md +36 -0
  129. package/templates/addon/.agents/skills/kumi-store/SKILL.md +47 -0
  130. package/templates/addon/.agents/skills/kumi-ui/SKILL.md +73 -0
  131. package/templates/addon/.agents/skills/kumi-wow-api/SKILL.md +30 -0
  132. package/templates/addon/.claude/skills/kumi-build-debug/SKILL.md +36 -0
  133. package/templates/addon/.claude/skills/kumi-feature/SKILL.md +50 -0
  134. package/templates/addon/.claude/skills/kumi-plugin/SKILL.md +36 -0
  135. package/templates/addon/.claude/skills/kumi-store/SKILL.md +47 -0
  136. package/templates/addon/.claude/skills/kumi-ui/SKILL.md +73 -0
  137. package/templates/addon/.claude/skills/kumi-wow-api/SKILL.md +30 -0
  138. package/templates/addon/AGENTS.md +34 -0
  139. package/templates/addon/Assets/Art/Corner10.tga +0 -0
  140. package/templates/addon/Assets/Art/Corner11.tga +0 -0
  141. package/templates/addon/Assets/Art/Corner12.tga +0 -0
  142. package/templates/addon/Assets/Art/Corner13.tga +0 -0
  143. package/templates/addon/Assets/Art/Corner14.tga +0 -0
  144. package/templates/addon/Assets/Art/Corner15.tga +0 -0
  145. package/templates/addon/Assets/Art/Corner16.tga +0 -0
  146. package/templates/addon/Assets/Art/Corner2.tga +0 -0
  147. package/templates/addon/Assets/Art/Corner3.tga +0 -0
  148. package/templates/addon/Assets/Art/Corner4.tga +0 -0
  149. package/templates/addon/Assets/Art/Corner5.tga +0 -0
  150. package/templates/addon/Assets/Art/Corner6.tga +0 -0
  151. package/templates/addon/Assets/Art/Corner7.tga +0 -0
  152. package/templates/addon/Assets/Art/Corner8.tga +0 -0
  153. package/templates/addon/Assets/Art/Corner9.tga +0 -0
  154. package/templates/addon/Assets/Art/Dot.tga +0 -0
  155. package/templates/addon/Assets/Art/Gear.tga +0 -0
  156. package/templates/addon/Assets/Art/Grip.tga +0 -0
  157. package/templates/addon/Assets/Art/Outline10.tga +0 -0
  158. package/templates/addon/Assets/Art/Outline12.tga +0 -0
  159. package/templates/addon/Assets/Art/Outline13.tga +0 -0
  160. package/templates/addon/Assets/Art/Outline14.tga +0 -0
  161. package/templates/addon/Assets/Art/Outline15.tga +0 -0
  162. package/templates/addon/Assets/Art/Outline2.tga +0 -0
  163. package/templates/addon/Assets/Art/Outline3.tga +0 -0
  164. package/templates/addon/Assets/Art/Outline5.tga +0 -0
  165. package/templates/addon/Assets/Art/Outline7.tga +0 -0
  166. package/templates/addon/Assets/Art/Outline9.tga +0 -0
  167. package/templates/addon/Assets/Art/Round11.tga +0 -0
  168. package/templates/addon/Assets/Art/Round11Border.tga +0 -0
  169. package/templates/addon/Assets/Art/Round4.tga +0 -0
  170. package/templates/addon/Assets/Art/Round4Border.tga +0 -0
  171. package/templates/addon/Assets/Art/Round6.tga +0 -0
  172. package/templates/addon/Assets/Art/Round6Border.tga +0 -0
  173. package/templates/addon/Assets/Art/Round8.tga +0 -0
  174. package/templates/addon/Assets/Art/Round8Border.tga +0 -0
  175. package/templates/addon/Assets/Art/Search.tga +0 -0
  176. package/templates/addon/CLAUDE.md +1 -0
  177. package/templates/addon/README.md +49 -0
  178. package/templates/addon/eslint.config.mjs +6 -0
  179. package/templates/addon/gitignore +9 -0
  180. package/templates/addon/kumi.config.ts +17 -0
  181. package/templates/addon/package.json +20 -0
  182. package/templates/addon/src/app/app.module.ts +18 -0
  183. package/templates/addon/src/app/commands.store.ts +11 -0
  184. package/templates/addon/src/app/layout/AppWindow.module.scss +92 -0
  185. package/templates/addon/src/app/layout/AppWindow.tsx +32 -0
  186. package/templates/addon/src/app/main.ts +5 -0
  187. package/templates/addon/src/app/routes/(window)/home/page.tsx +8 -0
  188. package/templates/addon/src/app/routes/(window)/plugins/page.tsx +38 -0
  189. package/templates/addon/src/app/routes/(window)/settings/page.tsx +8 -0
  190. package/templates/addon/src/app/theme.ts +6 -0
  191. package/templates/addon/src/modules/greeting/api/player.api.ts +29 -0
  192. package/templates/addon/src/modules/greeting/greeting.module.ts +18 -0
  193. package/templates/addon/src/modules/greeting/model/greeting.store.ts +81 -0
  194. package/templates/addon/src/modules/greeting/services/greeting.service.ts +38 -0
  195. package/templates/addon/src/modules/greeting/ui/Greeting.module.scss +105 -0
  196. package/templates/addon/src/modules/greeting/ui/GreetingCard.tsx +29 -0
  197. package/templates/addon/src/modules/greeting/widgets/GreetingHud.tsx +54 -0
  198. package/templates/addon/src/modules/greeting/widgets/GreetingOverview.tsx +18 -0
  199. package/templates/addon/src/modules/greeting/widgets/GreetingSettings.tsx +56 -0
  200. package/templates/addon/src/modules/playtime/api/clock.api.ts +6 -0
  201. package/templates/addon/src/modules/playtime/model/playtime.store.ts +19 -0
  202. package/templates/addon/src/modules/playtime/playtime.module.ts +18 -0
  203. package/templates/addon/src/modules/playtime/services/playtime.service.ts +18 -0
  204. package/templates/addon/src/modules/playtime/ui/Playtime.module.scss +25 -0
  205. package/templates/addon/src/modules/playtime/ui/PlaytimeBadge.tsx +10 -0
  206. package/templates/addon/src/modules/playtime/widgets/PlaytimePage.tsx +16 -0
  207. package/templates/addon/src/shared/api/native-art.ts +28 -0
  208. package/templates/addon/src/shared/assets/close.png +0 -0
  209. package/templates/addon/src/shared/lib/format.ts +20 -0
  210. package/templates/addon/src/shared/styles/_tokens.scss +12 -0
  211. package/templates/addon/src/shared/ui/Button.tsx +29 -0
  212. package/templates/addon/src/shared/ui/Choice.tsx +34 -0
  213. package/templates/addon/src/shared/ui/Controls.module.scss +93 -0
  214. package/templates/addon/src/shared/ui/Glyph.tsx +18 -0
  215. package/templates/addon/src/shared/ui/Slider.tsx +25 -0
  216. package/templates/addon/src/shared/ui/Toggle.tsx +29 -0
  217. package/templates/addon/src/shared/ui/focus-ref.ts +7 -0
  218. package/templates/addon/src/shared/ui/range-skin.tsx +15 -0
  219. package/templates/addon/tsconfig.json +63 -0
  220. package/translate/index.ts +14 -0
  221. package/translate/package.json +9 -0
  222. package/utils/colors.ts +76 -0
  223. package/utils/format.ts +37 -0
  224. package/utils/index.ts +4 -0
  225. package/utils/number.ts +17 -0
  226. package/utils/package.json +7 -0
  227. package/utils/text.ts +6 -0
  228. package/validate/index.ts +119 -0
  229. package/validate/package.json +9 -0
  230. package/wow/absolute-position.ts +142 -0
  231. package/wow/action-bar-layout.ts +108 -0
  232. package/wow/action-button.ts +219 -0
  233. package/wow/action-catalog.ts +98 -0
  234. package/wow/addon-manifest.ts +36 -0
  235. package/wow/animation.ts +428 -0
  236. package/wow/app-ui.ts +221 -0
  237. package/wow/aura-button.ts +76 -0
  238. package/wow/aura-container.ts +591 -0
  239. package/wow/aura-countdown.ts +201 -0
  240. package/wow/aura-slot.ts +153 -0
  241. package/wow/bar-shade.ts +93 -0
  242. package/wow/borrowed-slot.ts +216 -0
  243. package/wow/button-drag.ts +48 -0
  244. package/wow/cast-clock.ts +153 -0
  245. package/wow/cast-text.ts +83 -0
  246. package/wow/class-colors.ts +126 -0
  247. package/wow/clock.ts +7 -0
  248. package/wow/color-picker.ts +128 -0
  249. package/wow/commands.ts +17 -0
  250. package/wow/contained-frame.ts +128 -0
  251. package/wow/contract.ts +42 -0
  252. package/wow/cooldown-timing.ts +24 -0
  253. package/wow/css-box.ts +144 -0
  254. package/wow/css-color.ts +12 -0
  255. package/wow/css-style.ts +109 -0
  256. package/wow/css-surfaces.ts +603 -0
  257. package/wow/css-text.ts +399 -0
  258. package/wow/cursor.ts +45 -0
  259. package/wow/cvar-schema.ts +32 -0
  260. package/wow/cvars.ts +98 -0
  261. package/wow/dropdown-art.ts +39 -0
  262. package/wow/element-click.ts +20 -0
  263. package/wow/element-event-coordinator.ts +219 -0
  264. package/wow/element-events.ts +317 -0
  265. package/wow/event-dispatcher.ts +151 -0
  266. package/wow/events.ts +50 -0
  267. package/wow/font-cache.ts +92 -0
  268. package/wow/frame-access.ts +53 -0
  269. package/wow/frame-layer.ts +5 -0
  270. package/wow/frame-timing.ts +13 -0
  271. package/wow/frames.ts +236 -0
  272. package/wow/heal-prediction.ts +305 -0
  273. package/wow/hooks.ts +133 -0
  274. package/wow/image-layers.ts +55 -0
  275. package/wow/index.ts +111 -0
  276. package/wow/layout-view.ts +663 -0
  277. package/wow/locale-font.ts +15 -0
  278. package/wow/lua-string.ts +18 -0
  279. package/wow/lua-table.ts +18 -0
  280. package/wow/macro-book.ts +84 -0
  281. package/wow/map-position.ts +27 -0
  282. package/wow/media-query.ts +65 -0
  283. package/wow/module-events.ts +11 -0
  284. package/wow/native-hooks.ts +168 -0
  285. package/wow/native-placement.ts +88 -0
  286. package/wow/native.ts +153 -0
  287. package/wow/number-format.ts +8 -0
  288. package/wow/number-input.ts +10 -0
  289. package/wow/panel-host.ts +97 -0
  290. package/wow/pixel.ts +35 -0
  291. package/wow/plugins.ts +246 -0
  292. package/wow/protect.ts +48 -0
  293. package/wow/protected-layout.ts +133 -0
  294. package/wow/protected-view.ts +103 -0
  295. package/wow/range-art.ts +81 -0
  296. package/wow/readable-api.ts +120 -0
  297. package/wow/reparent-frame.ts +99 -0
  298. package/wow/rounded-texture.ts +183 -0
  299. package/wow/saved-variables.ts +109 -0
  300. package/wow/scroll-view.ts +64 -0
  301. package/wow/secret-ref.ts +14 -0
  302. package/wow/secure-bindings.ts +89 -0
  303. package/wow/secure-clicks.ts +432 -0
  304. package/wow/secure-snippet.ts +235 -0
  305. package/wow/secure-state.ts +130 -0
  306. package/wow/secure-target-visibility.ts +89 -0
  307. package/wow/secure-transaction.ts +331 -0
  308. package/wow/special-window.ts +269 -0
  309. package/wow/spell-cooldown.ts +36 -0
  310. package/wow/start-addon.ts +122 -0
  311. package/wow/state-paint.ts +256 -0
  312. package/wow/transition.ts +86 -0
  313. package/wow/unit-button.ts +39 -0
  314. package/wow/unit-cast.ts +92 -0
  315. package/wow/unit-health-text.ts +47 -0
  316. package/wow/view-nodes.ts +304 -0
  317. package/wow/view.ts +1864 -0
  318. package/wow/visible-frame-job.ts +34 -0
  319. package/wow/width-reserve.ts +108 -0
@@ -0,0 +1,305 @@
1
+ import { ownedArray, type OwnedArray } from "../src/owned-collections";
2
+ import { fail, ok, type Result } from "../src/result";
3
+ import { createFrame, type Frame, type FrameParent, type StatusBar, type Texture } from "./frames";
4
+ import { api, isSecret, reveal, type SecretValue } from "./native";
5
+ import { protectNative } from "./protect";
6
+
7
+ type Amount = number | SecretValue<number>;
8
+ type Mask = Parameters<Texture["AddMaskTexture"]>[0];
9
+ type Color = readonly [red: number, green: number, blue: number, alpha: number];
10
+ type Clip = Pick<Frame, "GetObjectType" | "SetClipsChildren">;
11
+ type AlphaRegion = Pick<StatusBar, "SetAlpha"> & {
12
+ SetAlphaFromBoolean?(this: object, value: boolean | SecretValue<boolean>, alphaIfTrue: number, alphaIfFalse: number): void;
13
+ };
14
+
15
+ export interface HealPredictionStyle {
16
+ readonly color?: Color;
17
+ readonly texture?: string | number;
18
+ }
19
+
20
+ export interface HealPredictionLook {
21
+ readonly incoming?: HealPredictionStyle;
22
+ readonly absorb?: HealPredictionStyle;
23
+ readonly healAbsorb?: HealPredictionStyle;
24
+ }
25
+
26
+ export interface HealPredictionOptions {
27
+ readonly instant?: boolean;
28
+ readonly sublevel?: number;
29
+ readonly mask?: (this: void, bar: StatusBar) => Mask | undefined;
30
+ readonly look?: HealPredictionLook;
31
+ }
32
+
33
+ export interface HealPrediction {
34
+ readonly incoming: StatusBar;
35
+ readonly absorb: StatusBar;
36
+ readonly healAbsorb: StatusBar;
37
+ readonly over: StatusBar;
38
+ readonly overEdge: Texture;
39
+ Update(this: void, unit: string, withMax?: boolean): void;
40
+ SetSample(this: void, incoming?: number, absorb?: number, healAbsorb?: number, over?: number): void;
41
+ Clear(this: void): void;
42
+ SetLook(this: void, look: HealPredictionLook): void;
43
+ SetShape(this: void, mask?: Mask): void;
44
+ }
45
+
46
+ interface Overlay {
47
+ readonly bar: StatusBar;
48
+ readonly fill: Texture;
49
+ mask?: Mask;
50
+ asset?: string | number;
51
+ color?: Color;
52
+ }
53
+
54
+ const white = "Interface\\Buttons\\WHITE8X8";
55
+ const incomingColor: Color = [0.35, 0.95, 0.5, 0.45];
56
+ const absorbColor: Color = [1, 1, 1, 0.55];
57
+ const healAbsorbColor: Color = [0.95, 0.15, 0.2, 0.9];
58
+
59
+ function paint(overlay: Overlay, fallback: Color, style?: HealPredictionStyle): void {
60
+ const asset = style?.texture;
61
+ const [r, g, b, a] = style?.color ?? fallback;
62
+ const color = overlay.color;
63
+ const assetChanged = color === undefined || overlay.asset !== asset;
64
+ if (assetChanged) {
65
+ const tiled = asset !== undefined;
66
+ if (tiled) overlay.fill.SetTexture(asset, "REPEAT", "REPEAT");
67
+ else overlay.fill.SetTexture(white);
68
+ overlay.fill.SetHorizTile(tiled);
69
+ overlay.fill.SetVertTile(tiled);
70
+ overlay.asset = asset;
71
+ }
72
+ if (assetChanged || color === undefined || color[0] !== r || color[1] !== g || color[2] !== b || color[3] !== a) {
73
+ overlay.fill.SetVertexColor(r, g, b, a);
74
+ overlay.color = [r, g, b, a];
75
+ }
76
+ }
77
+
78
+ function hasAmount(value: Amount | undefined): value is Amount {
79
+ return isSecret(value) || value !== undefined;
80
+ }
81
+
82
+ function readableOverflow(unit: string, maximum: Amount, incoming: Amount, absorb: Amount): number {
83
+ const current = reveal(api.UnitHealth(unit));
84
+ const max = reveal(maximum);
85
+ const heals = reveal(incoming);
86
+ const shield = reveal(absorb);
87
+ if (current === undefined || max === undefined || heals === undefined || shield === undefined || shield <= 0) return 0;
88
+ return Math.min(shield, Math.max(0, current + heals + shield - max));
89
+ }
90
+
91
+ function setOverflowAlpha(bar: AlphaRegion, clamped: boolean | SecretValue<boolean>): void {
92
+ const readable = reveal(clamped);
93
+ if (readable !== undefined) {
94
+ bar.SetAlpha(readable ? 1 : 0);
95
+ return;
96
+ }
97
+ if (bar.SetAlphaFromBoolean !== undefined) {
98
+ const [applied] = protectNative(bar.SetAlphaFromBoolean, bar, clamped, 1, 0);
99
+ if (applied) return;
100
+ }
101
+ bar.SetAlpha(0);
102
+ }
103
+
104
+ function replaceMask(texture: Texture, previous: Mask | undefined, next: Mask | undefined): Mask | undefined {
105
+ if (previous === next) return previous;
106
+ if (previous !== undefined) {
107
+ const [removed] = protectNative(texture.RemoveMaskTexture, texture, previous);
108
+ if (!removed) return previous;
109
+ }
110
+ if (next === undefined) return undefined;
111
+ const [added] = protectNative(texture.AddMaskTexture, texture, next);
112
+ return added ? next : undefined;
113
+ }
114
+
115
+ function initialize(
116
+ this: void, clip: Clip, health: StatusBar, options: HealPredictionOptions, allocatedBars: OwnedArray<StatusBar>,
117
+ ): Result<HealPrediction> {
118
+ const healthFill = health.GetStatusBarTexture();
119
+ if (healthFill === undefined) return fail("Heal prediction requires a health bar texture");
120
+ const level = reveal(health.GetFrameLevel());
121
+ if (level === undefined) return fail("Health bar frame level is unreadable");
122
+ const healthLevel = level;
123
+
124
+ const interpolations = options.instant ? undefined : api.Enum?.StatusBarInterpolation;
125
+ const interpolation = interpolations?.ExponentialEaseOut;
126
+ const look = options.look;
127
+
128
+ function createOverlay(anchor: FrameParent, reverse: boolean, color: Color, style?: HealPredictionStyle): Overlay {
129
+ const bar = createFrame("StatusBar", undefined, clip);
130
+ allocatedBars.push(bar);
131
+ bar.SetFrameLevel(healthLevel + (reverse ? 2 : 1));
132
+ const sublevel = options.sublevel === undefined ? undefined : options.sublevel + (reverse ? 1 : 0);
133
+ const fill = bar.CreateTexture(undefined, "ARTWORK", undefined, sublevel);
134
+ const mask = options.mask?.(bar);
135
+ // The client needs the initial mask before it takes ownership of the fill.
136
+ if (mask !== undefined) fill.AddMaskTexture(mask);
137
+ const overlay: Overlay = { bar, fill, mask };
138
+ paint(overlay, color, style);
139
+ bar.SetStatusBarTexture(fill);
140
+ bar.SetMinMaxValues(0, 1);
141
+ bar.SetValue(0);
142
+ if (reverse) {
143
+ bar.SetReverseFill(true);
144
+ bar.SetPoint("TOPRIGHT", anchor, "TOPRIGHT");
145
+ bar.SetPoint("BOTTOMRIGHT", anchor, "BOTTOMRIGHT");
146
+ } else {
147
+ bar.SetPoint("TOPLEFT", anchor, "TOPRIGHT");
148
+ bar.SetPoint("BOTTOMLEFT", anchor, "BOTTOMRIGHT");
149
+ }
150
+ return overlay;
151
+ }
152
+
153
+ const incoming = createOverlay(healthFill, false, incomingColor, look?.incoming);
154
+ const absorb = createOverlay(incoming.fill, false, absorbColor, look?.absorb);
155
+ const healAbsorb = createOverlay(healthFill, true, healAbsorbColor, look?.healAbsorb);
156
+ const over = createOverlay(health, true, absorbColor, look?.absorb);
157
+ const overlays = [incoming, absorb, healAbsorb, over];
158
+
159
+ const edge = over.bar.CreateTexture(undefined, "OVERLAY");
160
+ edge.Hide();
161
+ edge.SetTexture(white);
162
+ edge.SetVertexColor(1, 1, 1, 0.9);
163
+ edge.SetPoint("TOPRIGHT", health, "TOPRIGHT");
164
+ edge.SetPoint("BOTTOMRIGHT", health, "BOTTOMRIGHT");
165
+ edge.SetWidth(2);
166
+ if (over.mask !== undefined) edge.AddMaskTexture(over.mask);
167
+ let edgeMask = over.mask;
168
+
169
+ function syncWidth(this: void, value: Amount): void {
170
+ const width = reveal(value);
171
+ if (width === undefined || width <= 0) return;
172
+ for (const overlay of overlays) overlay.bar.SetWidth(width);
173
+ }
174
+
175
+ const calculate = api.UnitGetDetailedHealPrediction;
176
+ function createCalculators(this: void) {
177
+ const makeCalculator = api.CreateUnitHealPredictionCalculator;
178
+ const modes = api.Enum?.UnitDamageAbsorbClampMode;
179
+ if (!calculate || !makeCalculator || !modes) return undefined;
180
+ const fits = makeCalculator();
181
+ const all = makeCalculator();
182
+ fits.SetDamageAbsorbClampMode(modes.MissingHealth);
183
+ all.SetDamageAbsorbClampMode(modes.MaximumHealth);
184
+ return { fits, all };
185
+ }
186
+ const [hasCalculators, created] = protectNative(createCalculators);
187
+ const calculators = hasCalculators ? created : undefined;
188
+
189
+ let cachedMax: number | undefined = 1;
190
+ let liveRange = false;
191
+ let cleared = true;
192
+
193
+ function setMaximum(value: Amount): boolean {
194
+ const readable = reveal(value);
195
+ if (readable !== undefined && readable === cachedMax) return true;
196
+ let applied = true;
197
+ for (const { bar } of overlays) {
198
+ const [success] = protectNative(bar.SetMinMaxValues, bar, 0, value);
199
+ if (!success) applied = false;
200
+ }
201
+ cachedMax = applied ? readable : undefined;
202
+ return applied;
203
+ }
204
+
205
+ function setValue(bar: StatusBar, value: Amount): void {
206
+ const [applied] = protectNative(bar.SetValue, bar, value, interpolation);
207
+ if (!applied) bar.SetValue(0);
208
+ }
209
+
210
+ function updateDetailed(unit: string): boolean {
211
+ if (calculators === undefined) return false;
212
+ const { fits, all } = calculators;
213
+ const [fitsUpdated] = protectNative(calculate, unit, "player", fits);
214
+ if (!fitsUpdated) return false;
215
+ const [allUpdated] = protectNative(calculate, unit, "player", all);
216
+ if (!allUpdated) return false;
217
+ // These native returns can contain restricted health data.
218
+ const [fitsRead, fit, clamped] = protectNative(fits.GetDamageAbsorbs, fits);
219
+ if (!fitsRead) return false;
220
+ const [allRead, shield] = protectNative(all.GetDamageAbsorbs, all);
221
+ if (!allRead) return false;
222
+ setValue(absorb.bar, fit);
223
+ setValue(over.bar, shield);
224
+ setOverflowAlpha(over.bar, clamped);
225
+ edge.Show();
226
+ return true;
227
+ }
228
+
229
+ function Update(this: void, unit: string, withMax = true): void {
230
+ cleared = false;
231
+ const maximum = api.UnitHealthMax(unit);
232
+ if (withMax || !liveRange) liveRange = setMaximum(maximum);
233
+
234
+ const incomingValue = api.UnitGetIncomingHeals?.(unit);
235
+ const healAbsorbValue = api.UnitGetTotalHealAbsorbs?.(unit);
236
+ const heals = hasAmount(incomingValue) ? incomingValue : 0;
237
+ setValue(incoming.bar, heals);
238
+ setValue(healAbsorb.bar, hasAmount(healAbsorbValue) ? healAbsorbValue : 0);
239
+ if (updateDetailed(unit)) return;
240
+
241
+ const absorbValue = api.UnitGetTotalAbsorbs?.(unit);
242
+ const shield = hasAmount(absorbValue) ? absorbValue : 0;
243
+ setValue(absorb.bar, shield);
244
+ const overflow = readableOverflow(unit, maximum, heals, shield);
245
+ setValue(over.bar, overflow);
246
+ over.bar.SetAlpha(1);
247
+ edge.SetShown(overflow > 0);
248
+ }
249
+
250
+ function SetSample(this: void, heals = 0, shield = 0, healingAbsorb = 0, overflow = 0): void {
251
+ cleared = false;
252
+ liveRange = false;
253
+ setMaximum(1);
254
+ incoming.bar.SetValue(heals);
255
+ absorb.bar.SetValue(shield);
256
+ healAbsorb.bar.SetValue(healingAbsorb);
257
+ over.bar.SetValue(overflow);
258
+ over.bar.SetAlpha(1);
259
+ edge.SetShown(overflow > 0);
260
+ }
261
+
262
+ function Clear(this: void): void {
263
+ if (cleared) return;
264
+ SetSample();
265
+ cleared = true;
266
+ }
267
+
268
+ function SetLook(this: void, next: HealPredictionLook): void {
269
+ paint(incoming, incomingColor, next.incoming);
270
+ paint(absorb, absorbColor, next.absorb);
271
+ paint(healAbsorb, healAbsorbColor, next.healAbsorb);
272
+ paint(over, absorbColor, next.absorb);
273
+ }
274
+
275
+ function SetShape(this: void, mask?: Mask): void {
276
+ for (const overlay of overlays) {
277
+ overlay.mask = replaceMask(overlay.fill, overlay.mask, mask);
278
+ }
279
+ edgeMask = replaceMask(edge, edgeMask, mask);
280
+ }
281
+
282
+ syncWidth(health.GetWidth());
283
+ let onSizeChanged: typeof syncWidth | undefined;
284
+ health.HookScript("OnSizeChanged", (_health, width) => onSizeChanged?.(width));
285
+ clip.SetClipsChildren(true);
286
+ onSizeChanged = syncWidth;
287
+
288
+ return ok({
289
+ incoming: incoming.bar,
290
+ absorb: absorb.bar,
291
+ healAbsorb: healAbsorb.bar,
292
+ over: over.bar,
293
+ overEdge: edge,
294
+ Update, SetSample, Clear, SetLook, SetShape,
295
+ });
296
+ }
297
+
298
+ /** Attach prediction overlays to a clipping frame that covers an initialized health bar. */
299
+ export function createHealPrediction(clip: Clip, health: StatusBar, options: HealPredictionOptions = {}): Result<HealPrediction> {
300
+ const allocatedBars = ownedArray<StatusBar>();
301
+ const [success, prediction] = protectNative(initialize, clip, health, options, allocatedBars);
302
+ if (success) return prediction;
303
+ for (const bar of allocatedBars) protectNative(bar.Hide, bar);
304
+ return fail("The client could not create heal prediction");
305
+ }
package/wow/hooks.ts ADDED
@@ -0,0 +1,133 @@
1
+ import { currentScope } from "../src/reactive-scope";
2
+ import { ref, type ReadonlyRef, type SignalRef } from "../src/reactivity";
3
+ import type { OwnedReadonlyArray } from "../src/owned-collections";
4
+ import type { RuntimeScope } from "../src/runtime";
5
+ import { appContext } from "./app-ui";
6
+ import type { EventOptions, WoWEvent, WoWEventMap } from "./contract";
7
+ import { setRawField } from "./lua-table";
8
+ import { api, reveal } from "./native";
9
+
10
+ function owner(name: string): RuntimeScope {
11
+ const scope = currentScope();
12
+ if (scope === undefined) throw new Error(name + " works during the setup of a component or store");
13
+ return scope;
14
+ }
15
+
16
+ /**
17
+ * Run `handler` for a WoW event while the calling component or store is alive.
18
+ *
19
+ * ```ts
20
+ * useEvent("PLAYER_MONEY", () => { money.value = readMoney(); });
21
+ * ```
22
+ */
23
+ export function useEvent<Event extends WoWEvent>(this: void, event: Event,
24
+ handler: (this: void, ...payload: WoWEventMap[Event]) => void, options?: EventOptions): void {
25
+ const scope = owner("useEvent");
26
+ const context = appContext();
27
+ if (context === undefined) throw new Error("useEvent needs a running addon");
28
+ const subscribed = context.events.on(scope, event, handler, options);
29
+ if (!subscribed.ok) throw new Error(subscribed.reason);
30
+ }
31
+
32
+ /** Run `cleanup` when the calling component or store goes away. */
33
+ export function onCleanup(this: void, cleanup: (this: void) => void): void {
34
+ const registered = owner("onCleanup").onDispose(cleanup);
35
+ if (!registered.ok) throw new Error(registered.reason);
36
+ }
37
+
38
+ interface Clock {
39
+ readonly time: SignalRef<number>;
40
+ users: number;
41
+ cancel?: (this: void) => void;
42
+ }
43
+
44
+ const clocks: Record<number, Clock | undefined> = {};
45
+
46
+ function gameTime() {
47
+ const time = reveal(api.GetTime());
48
+ return typeof time === "number" ? time : 0;
49
+ }
50
+
51
+ /**
52
+ * The game time in seconds, updated every `interval` seconds while the caller is alive.
53
+ * Components that use the same interval share one timer.
54
+ */
55
+ export function useNow(this: void, interval = 1): ReadonlyRef<number> {
56
+ const scope = owner("useNow");
57
+ if (!(interval > 0)) throw new Error("useNow needs a positive interval");
58
+ let clock = clocks[interval];
59
+ if (clock === undefined) {
60
+ clock = { time: ref(gameTime()), users: 0 };
61
+ clocks[interval] = clock;
62
+ }
63
+ const shared = clock;
64
+ if (shared.users === 0) {
65
+ shared.time.value = gameTime();
66
+ const ticker = api.C_Timer.NewTicker(interval, () => { shared.time.value = gameTime(); });
67
+ shared.cancel = () => { (ticker as unknown as { Cancel(this: object): void }).Cancel(); };
68
+ }
69
+ shared.users++;
70
+ scope.onDispose(() => {
71
+ shared.users--;
72
+ if (shared.users > 0) return;
73
+ shared.cancel?.();
74
+ shared.cancel = undefined;
75
+ });
76
+ return shared.time;
77
+ }
78
+
79
+ let combat: SignalRef<boolean> | undefined;
80
+ let combatUsers = 0;
81
+
82
+ /** Whether the player is in combat. Protected changes, such as secure buttons or loading plugins, wait for false. */
83
+ export function useCombat(this: void): ReadonlyRef<boolean> {
84
+ const scope = owner("useCombat");
85
+ const context = appContext();
86
+ if (context === undefined) throw new Error("useCombat needs a running addon");
87
+ const state = combat ??= ref(reveal(api.InCombatLockdown()) === true);
88
+ if (combatUsers === 0) state.value = reveal(api.InCombatLockdown()) === true;
89
+ combatUsers++;
90
+ const started = context.events.on(scope, "PLAYER_REGEN_DISABLED", () => { state.value = true; });
91
+ if (!started.ok) throw new Error(started.reason);
92
+ const ended = context.events.on(scope, "PLAYER_REGEN_ENABLED", () => { state.value = false; });
93
+ if (!ended.ok) throw new Error(ended.reason);
94
+ scope.onDispose(() => { combatUsers--; });
95
+ return state;
96
+ }
97
+
98
+ function commandName(name: string): boolean {
99
+ if (name.length < 2 || name.charCodeAt(0) !== 47) return false;
100
+ for (let index = 1; index < name.length; index++) {
101
+ const code = name.charCodeAt(index);
102
+ const letter = code >= 65 && code <= 90 || code >= 97 && code <= 122;
103
+ const digit = code >= 48 && code <= 57;
104
+ if (!letter && !digit && code !== 95 && code !== 45) return false;
105
+ }
106
+ return true;
107
+ }
108
+
109
+ /**
110
+ * Register a slash command while the caller is alive. The first name is the command's ID.
111
+ *
112
+ * ```ts
113
+ * useSlashCommand(["/sessions", "/st"], input => { useWindow().toggle(); });
114
+ * ```
115
+ */
116
+ export function useSlashCommand(this: void, commands: readonly string[], handler: (this: void, input: string) => void): void {
117
+ const scope = owner("useSlashCommand");
118
+ const names = commands as OwnedReadonlyArray<string>;
119
+ if (names.length === 0 || names.some(name => !commandName(name))) {
120
+ throw new Error("useSlashCommand needs names such as /myaddon: a slash, then letters, digits, _ or -");
121
+ }
122
+ const key = "KUMI_" + names[0].slice(1).toUpperCase().split("-").join("_");
123
+ const globals = api as unknown as object;
124
+ const list = api.SlashCmdList;
125
+ if (list === undefined) throw new Error("This client has no slash commands");
126
+ if (list[key] !== undefined) throw new Error("Slash command " + names[0] + " is already registered");
127
+ for (let index = 0; index < names.length; index++) setRawField(globals, "SLASH_" + key + String(index + 1), names[index]);
128
+ list[key] = input => { handler(input.trim()); };
129
+ scope.onDispose(() => {
130
+ list[key] = undefined as never;
131
+ for (let index = 0; index < names.length; index++) setRawField(globals, "SLASH_" + key + String(index + 1), undefined);
132
+ });
133
+ }
@@ -0,0 +1,55 @@
1
+ import type { Binding } from "../src/elements";
2
+ import type { NativeImageLayer } from "../src/images";
3
+ import { ownedArray, type OwnedReadonlyArray } from "../src/owned-collections";
4
+ import type { RuntimeScope } from "../src/runtime";
5
+ import type { Frame, Texture } from "./frames";
6
+ import { readLayoutValue, validateLayoutParent } from "./layout-view";
7
+ import { anchorNativeRegion } from "./native-placement";
8
+
9
+ interface MountedLayer {
10
+ texture: Texture;
11
+ layout?: NativeImageLayer;
12
+ }
13
+
14
+ export function mountImageLayers(frame: Frame, scope: RuntimeScope, source: Binding<readonly NativeImageLayer[]>) {
15
+ const mounted = ownedArray<MountedLayer>();
16
+ let visible = 0;
17
+ scope.onDispose(() => {
18
+ for (const { texture } of mounted) texture.Hide();
19
+ });
20
+ const observed = scope.watchEffect(() => {
21
+ const next = readLayoutValue(source);
22
+ if (!next.ok) return next;
23
+ const layers = next.value as OwnedReadonlyArray<NativeImageLayer> | undefined;
24
+ if (layers === undefined || visible === 0 && layers.length === 0) return;
25
+ const anchor = validateLayoutParent(frame, frame, "absolute");
26
+ if (!anchor.ok) return anchor;
27
+ for (let index = 0; index < layers.length; index++) {
28
+ const layout = layers[index];
29
+ let layer = mounted[index];
30
+ if (layer === undefined) {
31
+ const texture = frame.CreateTexture(undefined, "ARTWORK");
32
+ layer = mounted[index] = { texture };
33
+ texture.Hide();
34
+ texture.SetSnapToPixelGrid?.(false);
35
+ texture.SetTexelSnappingBias?.(0);
36
+ }
37
+ const { texture, layout: before } = layer;
38
+ if (before !== layout) {
39
+ if (before?.source !== layout.source) texture.SetTexture(layout.source);
40
+ if (before?.width !== layout.width || before.height !== layout.height) {
41
+ texture.SetSize(Math.max(0.01, layout.width), Math.max(0.01, layout.height));
42
+ }
43
+ if (before?.x !== layout.x || before.y !== layout.y) {
44
+ if (before !== undefined) texture.ClearAllPoints();
45
+ anchorNativeRegion(texture, "TOPLEFT", frame, "TOPLEFT", layout.x, -layout.y);
46
+ }
47
+ layer.layout = layout;
48
+ }
49
+ if (index >= visible) texture.Show();
50
+ }
51
+ for (let index = layers.length; index < visible; index++) mounted[index].texture.Hide();
52
+ visible = layers.length;
53
+ });
54
+ return observed.ok ? undefined : observed;
55
+ }
package/wow/index.ts ADDED
@@ -0,0 +1,111 @@
1
+ import type { WoWApi } from "./contract";
2
+ import { api, isSecret, reveal } from "./native";
3
+ import { cvars } from "./cvars";
4
+ import { frameTiming } from "./frame-timing";
5
+ export { api, isSecret, reveal } from "./native";
6
+ export { readableApi } from "./readable-api";
7
+ export { hasCursorAction, readCursorAction, readCursorKind, type CursorAction } from "./cursor";
8
+ export type { ReadableSpellCooldown } from "./spell-cooldown";
9
+ export { nativeRef, secretSafeEquals } from "./secret-ref";
10
+ export type { LuaMultiReturn, SecretValue, UnitToken, WoWGlobals } from "./native";
11
+ export { createFrame, smoothStatusBarValue } from "./frames";
12
+ export { createFontCache, type FontCache, type FontCacheOptions, type FontObject, type FontOutline } from "./font-cache";
13
+ export { createLocaleFont } from "./locale-font";
14
+ export { createRoundedTextures, type MaskedStatusBarFill, type RoundedBorderCorner, type RoundedTextureOptions, type RoundedTextureResolverOptions, type RoundedTextures, type RoundedTextureSide } from "./rounded-texture";
15
+ export { createBarShade, type BarShade, type BarShadeOptions, type BarShadeStyle } from "./bar-shade";
16
+ export { reparentFrame } from "./reparent-frame";
17
+ export { bindContainedFrame, createContainedFrame } from "./contained-frame";
18
+ export { bindAbsolutePosition } from "./absolute-position";
19
+ export { anchorNativeRegion, captureNativeAnchors, centerNativeFrameWithBaseMethods, readNativeAnchor, restoreNativeAnchors,
20
+ type NativeAnchor, type NativeAnchorPoint, type NativeAnchorRegion } from "./native-placement";
21
+ export { mountNativeWidthReserve, setNativeRightInset } from "./width-reserve";
22
+ export { createSecureUnitButton, type SecureUnitButtonOptions } from "./unit-button";
23
+ export { secureClickPassthrough, secureFlyout, secureKeyPress, secureToggle } from "./secure-clicks";
24
+ export type { SecureClickPassthroughOptions, SecureFlyoutAction, SecureFlyoutAttributes, SecureFlyoutInstallation, SecureFlyoutOptions,
25
+ SecureFlyoutSide, SecureKeyPressInstallation, SecureKeyPressOptions, SecureKeyPressSettings, SecureToggleOptions } from "./secure-clicks";
26
+ export { secureActionPaging, stateDriver, type SecureActionPagingOptions, type StateDriverInstallation } from "./secure-state";
27
+ export { secureOverrideBindings, type SecureOverrideBindingInstallation, type SecureOverrideClick } from "./secure-bindings";
28
+ export { secureChildUpdateSnippet, secureSnippet, secureStateSnippet, wrapSecureSnippet } from "./secure-snippet";
29
+ export type { SecureFrameHandle, SecureSnippet, SecureSnippetEvent, SecureSnippetOptions, SecureSnippetValue, WrapSecureSnippetOptions } from "./secure-snippet";
30
+ export type { SecureButton, SecureFrame, SecureInstallation, SecureOptions } from "./secure-transaction";
31
+ export { createProtectedLayoutUpdate, type ProtectedLayoutOptions, type ProtectedLayoutUpdate } from "./protected-layout";
32
+ export { mountProtectedView } from "./protected-view";
33
+ export { useActionBarLayout, type ActionBarLayoutOptions, type ActionBarPosition } from "./action-bar-layout";
34
+ export { createNativePanel } from "./panel-host";
35
+ export { scheduleVisibleFrameUpdate } from "./visible-frame-job";
36
+ export { castInterrupter, castNotInterruptible, getUnitCastDuration, readUnitCast } from "./unit-cast";
37
+ export type { UnitCast, UnitCastDuration, UnitCastEvent, UnitCastInterrupter } from "./unit-cast";
38
+ export { createCastClock, type CastClockOptions } from "./cast-clock";
39
+ export { readCooldownTiming, type CooldownTiming } from "./cooldown-timing";
40
+ export { paintCastInterruption, paintCastSpell, type CastSpellDisplay } from "./cast-text";
41
+ export { renderUnitHealthText, type UnitHealthTextMode, type UnitHealthTextOptions } from "./unit-health-text";
42
+ export type { AnimationGroup, NativeAnimationKind, NativeAnimationOf, BackdropFrame, BackdropInfo, Button, FontString, Frame, FrameEventRegistration, FrameMap, MaskTexture, FrameType, FrameParent, MinimapFrame,
43
+ Region, StatusBar, Texture } from "./frames";
44
+ export { asTexture, canAccessRegion, readFontPath, readFrameHeight, readFrameScale, readFrameShown, readFrameWidth,
45
+ setFrameEventListening } from "./frame-access";
46
+ export { readItemId, visitBagItems, visitCollectedToys, visitPlayerSpells } from "./action-catalog";
47
+ export { createEvents } from "./events";
48
+ export { createEventDispatcher, type EventDispatcherFrame } from "./event-dispatcher";
49
+ export { addonRuntime, frameDriver, frameTiming, startAddon, type AddonContext, type AddonStart, type AddonStartOptions } from "./start-addon";
50
+ export { moduleEvents, OnEvent } from "./module-events";
51
+ export { hookScript, hookSecureMethod } from "./native-hooks";
52
+ export { createSpecialWindowProxy, type SpecialWindowProxy } from "./special-window";
53
+ export { createElementEventCoordinator, type ElementEventCoordinator } from "./element-event-coordinator";
54
+ export type { ElementTooltipPort, NativeElementEventHost } from "./element-events";
55
+ export { createClassColorLookup, readClassColor, type ClassColorLookup } from "./class-colors";
56
+ export { bindAuraDispelTexture, configureAuraMouse } from "./aura-button";
57
+ export type { AuraDispelColorMap, AuraDispelTextureOptions, AuraTooltipMode } from "./aura-button";
58
+ export { createAuraContainer } from "./aura-container";
59
+ export { bindAuraDurationText, bindAuraStackText, setAuraCountdownFormat, type AuraDurationTextOptions, type AuraStackTextOptions } from "./aura-countdown";
60
+ export { createAuraSlot, type AuraSlot, type AuraSlotOptions } from "./aura-slot";
61
+ export { createHealPrediction, type HealPrediction, type HealPredictionLook, type HealPredictionOptions, type HealPredictionStyle } from "./heal-prediction";
62
+ export { openColorPicker, type ColorPickerOptions } from "./color-picker";
63
+ export type { AuraButton, AuraCandidateFilters, AuraContainer, AuraContainerGroup, AuraContainerOptions, AuraContainerSlot, AuraGroupFilter } from "./aura-container";
64
+ export { findSlashCommand } from "./commands";
65
+ export { macroBook } from "./macro-book";
66
+ export { createWoWCVars, cvars, rawCVars } from "./cvars";
67
+ export type { WoWCVarEntry, WoWCVarInfo, WoWRawCVars } from "./cvars";
68
+ export { wowCVarSchema } from "./cvar-schema";
69
+ export type { WoWCVarName, WoWCVarSchema, WoWCVarValue } from "./cvar-schema";
70
+ export { configureAnimations, createAnimation, createTicker, playWhileVisible, useAnimation } from "./animation";
71
+ export type { AnimationControl, AnimationDefaults, AnimationPlayback, AnimationRef, AnimationRefOptions, AnimationTarget, MotionMode,
72
+ NativeAnimationOptions, PlayOptions, StepPatch, TargetOf, Ticker } from "./animation";
73
+ export { applyFrameScale, mountNative, mountNativeRangeArt, statusBarValue } from "./view";
74
+ export type { NativeRootLayer, NativeViewOptions } from "./view";
75
+ export type { NativeLayoutDiagnostics } from "./layout-view";
76
+ export type { FrameStrata } from "./frame-layer";
77
+ export type { CreateScrollArea, ScrollArea } from "./scroll-view";
78
+ export { protect } from "./protect";
79
+ export { luaString } from "./lua-string";
80
+ export { physicalPixel, snapPixel, watchDisplayMetrics } from "./pixel";
81
+ export { formatWoWNumber } from "./number-format";
82
+ export { clampWoWNumber } from "./number-input";
83
+ export { formatMapCoordinates, readPlayerMapPosition } from "./map-position";
84
+ export { rawField, setRawField, weakKeys } from "./lua-table";
85
+ export { savedVariablesStorage, type SavedRecord, type SavedValue, type SavedVariablesOptions } from "./saved-variables";
86
+ export { usePlugins, type KumiPlugins, type PluginId, type PluginInfo, type PluginServices, type PluginStatus } from "./plugins";
87
+ export { useViewHost, useWindow, type AppTheme } from "./app-ui";
88
+ export { onCleanup, useCombat, useEvent, useNow, useSlashCommand } from "./hooks";
89
+ export type { EventApi, EventOptions, EventScope, WoWEvent, WoWEventMap } from "./contract";
90
+
91
+ declare const DoReadyCheck: ((this: void) => void) | undefined;
92
+
93
+ export { clock } from "./clock";
94
+
95
+ export const wow: WoWApi = {
96
+ cvars,
97
+ now: () => api.GetTime(),
98
+ inCombat: frameTiming.inCombat,
99
+ spellIcon: spellId => {
100
+ if (isSecret(spellId) || !api.C_Spell) return undefined;
101
+ const [icon] = api.C_Spell.GetSpellTexture(spellId);
102
+ return reveal(icon);
103
+ },
104
+ party: {
105
+ inGroup: category => api.IsInGroup(category) === true,
106
+ isLeader: () => api.UnitIsGroupLeader("player") === true,
107
+ isAssistant: () => api.UnitIsGroupAssistant?.("player") === true,
108
+ readyCheck: () => { (api.C_PartyInfo?.DoReadyCheck ?? DoReadyCheck)?.(); },
109
+ countdown: seconds => api.C_PartyInfo?.DoCountdown?.(seconds) === true,
110
+ },
111
+ };