@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,192 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "adler2"
7
+ version = "2.0.1"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
10
+
11
+ [[package]]
12
+ name = "autocfg"
13
+ version = "1.5.1"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
16
+
17
+ [[package]]
18
+ name = "bitflags"
19
+ version = "2.13.2"
20
+ source = "registry+https://github.com/rust-lang/crates.io-index"
21
+ checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
22
+
23
+ [[package]]
24
+ name = "bytemuck"
25
+ version = "1.25.2"
26
+ source = "registry+https://github.com/rust-lang/crates.io-index"
27
+ checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797"
28
+
29
+ [[package]]
30
+ name = "byteorder-lite"
31
+ version = "0.1.0"
32
+ source = "registry+https://github.com/rust-lang/crates.io-index"
33
+ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
34
+
35
+ [[package]]
36
+ name = "cfg-if"
37
+ version = "1.0.5"
38
+ source = "registry+https://github.com/rust-lang/crates.io-index"
39
+ checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
40
+
41
+ [[package]]
42
+ name = "crc32fast"
43
+ version = "1.5.5"
44
+ source = "registry+https://github.com/rust-lang/crates.io-index"
45
+ checksum = "2b929dd2a135771f40afabd1073f85eed59c800b7c61901e5c254270497dad64"
46
+ dependencies = [
47
+ "cfg-if",
48
+ ]
49
+
50
+ [[package]]
51
+ name = "fdeflate"
52
+ version = "0.3.7"
53
+ source = "registry+https://github.com/rust-lang/crates.io-index"
54
+ checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"
55
+ dependencies = [
56
+ "simd-adler32",
57
+ ]
58
+
59
+ [[package]]
60
+ name = "flate2"
61
+ version = "1.1.11"
62
+ source = "registry+https://github.com/rust-lang/crates.io-index"
63
+ checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4"
64
+ dependencies = [
65
+ "crc32fast",
66
+ "miniz_oxide 0.9.1",
67
+ "zlib-rs",
68
+ ]
69
+
70
+ [[package]]
71
+ name = "image"
72
+ version = "0.25.10"
73
+ source = "registry+https://github.com/rust-lang/crates.io-index"
74
+ checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104"
75
+ dependencies = [
76
+ "bytemuck",
77
+ "byteorder-lite",
78
+ "image-webp",
79
+ "moxcms",
80
+ "num-traits",
81
+ "png",
82
+ "zune-core",
83
+ "zune-jpeg",
84
+ ]
85
+
86
+ [[package]]
87
+ name = "image-webp"
88
+ version = "0.2.4"
89
+ source = "registry+https://github.com/rust-lang/crates.io-index"
90
+ checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3"
91
+ dependencies = [
92
+ "byteorder-lite",
93
+ "quick-error",
94
+ ]
95
+
96
+ [[package]]
97
+ name = "kumi-pack"
98
+ version = "0.1.0"
99
+ dependencies = [
100
+ "image",
101
+ ]
102
+
103
+ [[package]]
104
+ name = "miniz_oxide"
105
+ version = "0.8.9"
106
+ source = "registry+https://github.com/rust-lang/crates.io-index"
107
+ checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
108
+ dependencies = [
109
+ "adler2",
110
+ "simd-adler32",
111
+ ]
112
+
113
+ [[package]]
114
+ name = "miniz_oxide"
115
+ version = "0.9.1"
116
+ source = "registry+https://github.com/rust-lang/crates.io-index"
117
+ checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c"
118
+ dependencies = [
119
+ "adler2",
120
+ "simd-adler32",
121
+ ]
122
+
123
+ [[package]]
124
+ name = "moxcms"
125
+ version = "0.8.1"
126
+ source = "registry+https://github.com/rust-lang/crates.io-index"
127
+ checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b"
128
+ dependencies = [
129
+ "num-traits",
130
+ "pxfm",
131
+ ]
132
+
133
+ [[package]]
134
+ name = "num-traits"
135
+ version = "0.2.19"
136
+ source = "registry+https://github.com/rust-lang/crates.io-index"
137
+ checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
138
+ dependencies = [
139
+ "autocfg",
140
+ ]
141
+
142
+ [[package]]
143
+ name = "png"
144
+ version = "0.18.1"
145
+ source = "registry+https://github.com/rust-lang/crates.io-index"
146
+ checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61"
147
+ dependencies = [
148
+ "bitflags",
149
+ "crc32fast",
150
+ "fdeflate",
151
+ "flate2",
152
+ "miniz_oxide 0.8.9",
153
+ ]
154
+
155
+ [[package]]
156
+ name = "pxfm"
157
+ version = "0.1.30"
158
+ source = "registry+https://github.com/rust-lang/crates.io-index"
159
+ checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea"
160
+
161
+ [[package]]
162
+ name = "quick-error"
163
+ version = "2.0.1"
164
+ source = "registry+https://github.com/rust-lang/crates.io-index"
165
+ checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
166
+
167
+ [[package]]
168
+ name = "simd-adler32"
169
+ version = "0.3.10"
170
+ source = "registry+https://github.com/rust-lang/crates.io-index"
171
+ checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"
172
+
173
+ [[package]]
174
+ name = "zlib-rs"
175
+ version = "0.6.8"
176
+ source = "registry+https://github.com/rust-lang/crates.io-index"
177
+ checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112"
178
+
179
+ [[package]]
180
+ name = "zune-core"
181
+ version = "0.5.3"
182
+ source = "registry+https://github.com/rust-lang/crates.io-index"
183
+ checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b"
184
+
185
+ [[package]]
186
+ name = "zune-jpeg"
187
+ version = "0.5.15"
188
+ source = "registry+https://github.com/rust-lang/crates.io-index"
189
+ checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296"
190
+ dependencies = [
191
+ "zune-core",
192
+ ]
@@ -0,0 +1,7 @@
1
+ [package]
2
+ name = "kumi-pack"
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+
6
+ [dependencies]
7
+ image = { version = "0.25", default-features = false, features = ["jpeg", "png", "tga", "webp"] }
@@ -0,0 +1,387 @@
1
+ import { parseStateDeclaration, parseStyleColor, supportsStateProperty } from "./style-states.mjs";
2
+
3
+ // These are the radii with shipped fill and outline textures.
4
+ export const cssRadii = Object.freeze([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12]);
5
+ export const cssFontWeights = Object.freeze([400, 600, 700]);
6
+
7
+ const sides = ["top", "right", "bottom", "left"];
8
+ const sidesByProperty = new Map(sides.flatMap((side, index) => [
9
+ ["margin-" + side, ["margin", index]], [side, [side]], ["border-" + side, ["border", side]],
10
+ ]));
11
+ // Longhand border parts: `border-width`, `border-color` and their per-side forms.
12
+ const borderParts = new Map([["border-width", ["width"]], ["border-color", ["color"]],
13
+ ...sides.flatMap(side => [["border-" + side + "-width", ["width", side]], ["border-" + side + "-color", ["color", side]]])]);
14
+ const ordered = new Set(["margin", "border", "inset", "border-style", ...borderParts.keys(), ...sidesByProperty.keys()]);
15
+ const decimal = String.raw`(?:\d+(?:\.\d+)?|\.\d+)`;
16
+ const unitlessNumber = new RegExp(`^[+-]?${decimal}$`);
17
+ const pixels = new RegExp(`^[+-]?${decimal}px$`);
18
+ const variable = String.raw`var\(\s*(--[a-z][\w-]*)\s*\)`;
19
+ const reference = new RegExp(`^${variable}$`);
20
+ const arithmetic = new RegExp(`^calc\\(\\s*${variable}\\s+([+-])\\s+(${decimal})(px)?\\s*\\)$`);
21
+
22
+ function numberIn(value, unit) {
23
+ const length = unit === "px" && pixels.test(value);
24
+ if (!length && !unitlessNumber.test(value)) return;
25
+ const number = Number(length ? value.slice(0, -2) : value);
26
+ if (Number.isFinite(number) && (unit === "" || length || number === 0)) return number;
27
+ }
28
+
29
+ function numeric(kind, unit, accepts, values, alias) {
30
+ return {
31
+ kind, unit, values, accepts,
32
+ parse(value) {
33
+ const number = alias?.(value) ?? numberIn(value, unit);
34
+ if (number !== undefined && accepts(number)) return number;
35
+ },
36
+ };
37
+ }
38
+
39
+ const length = numeric("length", "px", value => value >= 0);
40
+ const signedLength = numeric("signedLength", "px", () => true);
41
+ const positiveLength = numeric("positiveLength", "px", value => value > 0);
42
+ const percent = new RegExp(`^${decimal}%$`);
43
+ // A size is auto, a length, or a percentage of the parent's content box (kept as "50%" for the layout solver).
44
+ const size = { ...length, kind: "size", parse: value => value === "auto" || percent.test(value) ? value : length.parse(value) };
45
+ const number = numeric("number", "", value => value >= 0);
46
+ const integer = numeric("integer", "", Number.isInteger);
47
+ const opacity = numeric("opacity", "", value => value >= 0 && value <= 1);
48
+ const columns = Array.from({ length: 10 }, (_, index) => index + 1);
49
+ const columnCount = numeric("integer", "", value => columns.includes(value), columns);
50
+ const color = { kind: "color", parse: parseStyleColor };
51
+ const image = {
52
+ kind: "backgroundImage",
53
+ parse(value) {
54
+ try { return parseStateDeclaration("background-image", value)[1]; }
55
+ catch { return undefined; }
56
+ },
57
+ };
58
+
59
+ const keywords = (...values) => ({ kind: "enum", values, parse: value => values.includes(value) ? value : undefined });
60
+ const alignment = ["flex-start", "center", "flex-end", "stretch"];
61
+ const scalarProperties = {
62
+ color: ["color", color],
63
+ "background-color": ["backgroundColor", color],
64
+ "background-image": ["backgroundImage", image],
65
+ opacity: ["opacity", opacity],
66
+ position: ["position", keywords("static", "relative", "absolute")],
67
+ width: ["width", size],
68
+ height: ["height", size],
69
+ "min-width": ["minWidth", length],
70
+ "max-width": ["maxWidth", length],
71
+ "min-height": ["minHeight", length],
72
+ "max-height": ["maxHeight", length],
73
+ "font-size": ["fontSize", positiveLength],
74
+ "text-align": ["textAlign", keywords("left", "center", "right")],
75
+ "text-transform": ["textTransform", keywords("none", "uppercase", "lowercase", "capitalize")],
76
+ "text-overflow": ["textOverflow", keywords("ellipsis")],
77
+ "white-space": ["whiteSpace", keywords("nowrap")],
78
+ display: ["display", keywords("block", "inline", "inline-block", "flex", "grid", "none")],
79
+ overflow: ["overflow", keywords("hidden", "scroll")],
80
+ gap: ["gap", length],
81
+ columns: ["columns", columnCount],
82
+ "max-scale": ["maxScale", number],
83
+ "z-index": ["zIndex", integer],
84
+ "flex-direction": ["flexDirection", keywords("row", "column")],
85
+ "flex-wrap": ["flexWrap", keywords("nowrap", "wrap")],
86
+ "justify-content": ["justifyContent", keywords("flex-start", "center", "flex-end", "space-between")],
87
+ "align-items": ["alignItems", keywords(...alignment, "start", "end")],
88
+ "align-self": ["alignSelf", keywords("auto", ...alignment)],
89
+ "flex-grow": ["flexGrow", number],
90
+ "flex-shrink": ["flexShrink", number],
91
+ "flex-basis": ["flexBasis", size],
92
+ "row-gap": ["rowGap", length],
93
+ "column-gap": ["columnGap", length],
94
+ "justify-items": ["justifyItems", keywords("start", "center", "end", "stretch")],
95
+ };
96
+
97
+ function pieces(source) {
98
+ const words = [];
99
+ let start = 0;
100
+ let quote;
101
+ let depth = 0;
102
+ for (let index = 0; index < source.length; index++) {
103
+ const char = source[index];
104
+ if (quote !== undefined) {
105
+ if (char === quote) quote = undefined;
106
+ } else if (char === '"' || char === "'") quote = char;
107
+ else if (char === "(") depth++;
108
+ else if (char === ")") {
109
+ if (--depth < 0) return [];
110
+ } else if (depth === 0 && /\s/.test(char)) {
111
+ if (index > start) words.push(source.slice(start, index));
112
+ start = index + 1;
113
+ }
114
+ }
115
+ if (depth !== 0 || quote !== undefined) return [];
116
+ if (source.length > start) words.push(source.slice(start));
117
+ return words;
118
+ }
119
+
120
+ function tokenValue(tokens, name) {
121
+ if (!tokens.has(name)) throw new Error(`Unknown token ${name}`);
122
+ return tokens.get(name).trim();
123
+ }
124
+
125
+ function bind(input, spec, tokens) {
126
+ const token = reference.exec(input)?.[1];
127
+ const calc = arithmetic.exec(input);
128
+ if (calc) {
129
+ const [, name, operation, amount, unit = ""] = calc;
130
+ const raw = tokenValue(tokens, name);
131
+ if (spec.unit === undefined || unit !== spec.unit) return;
132
+ const base = numberIn(raw, unit);
133
+ if (base === undefined) return;
134
+ const add = Number(amount) * (operation === "+" ? 1 : -1);
135
+ const value = base + add;
136
+ if (!Number.isFinite(value) || !spec.accepts(value)) return;
137
+ return { value, token: name, kind: spec.kind, add, values: spec.values };
138
+ }
139
+ const value = spec.parse(token === undefined ? input : tokenValue(tokens, token));
140
+ if (value === undefined) return;
141
+ return token === undefined || spec.kind === undefined ? { value } : { value, token, kind: spec.kind, values: spec.values };
142
+ }
143
+
144
+ function rectangle(values) {
145
+ const [top, right = top, bottom = top, left = right] = values;
146
+ return [top, right, bottom, left];
147
+ }
148
+
149
+ function readInsets(source, read) {
150
+ const words = pieces(source);
151
+ if (words.length < 1 || words.length > 4) return;
152
+ const resolved = words.map(read);
153
+ if (resolved.every(value => value !== undefined)) return resolved;
154
+ }
155
+
156
+ function readBorder(source, read) {
157
+ const words = pieces(source);
158
+ if (words.length < 2 || words.length > 3) return;
159
+ let width;
160
+ let paint;
161
+ let solid = false;
162
+ for (const word of words) {
163
+ if (width === undefined && (width = read(word, length)) !== undefined) continue;
164
+ if (paint === undefined && (paint = read(word, color)) !== undefined) continue;
165
+ if (!solid && read(word, solidKeyword) !== undefined) { solid = true; continue; }
166
+ return;
167
+ }
168
+ if (width !== undefined && paint !== undefined) return { width, color: paint };
169
+ }
170
+
171
+ const solidKeyword = keywords("solid");
172
+
173
+ function readShadow(source, read) {
174
+ const words = pieces(source);
175
+ if (words.length !== 3) return;
176
+ const colorLast = read(words[2], color);
177
+ const paint = colorLast ?? read(words[0], color);
178
+ const x = read(words[colorLast === undefined ? 1 : 0], signedLength);
179
+ const y = read(words[colorLast === undefined ? 2 : 1], signedLength);
180
+ if (paint !== undefined && x !== undefined && y !== undefined) return { x, y, color: paint };
181
+ }
182
+
183
+ function compound(source, kind, parse, keys, tokens) {
184
+ const token = reference.exec(source)?.[1];
185
+ if (token === undefined) return parse(source, (input, spec) => bind(input, spec, tokens));
186
+ const value = parse(tokenValue(tokens, token), (input, spec) => spec.parse(input));
187
+ if (value === undefined) return;
188
+ return Object.fromEntries(keys.map(part => [part, { value: value[part], token, kind, part }]));
189
+ }
190
+
191
+ function compileInsets(source, property, spec, tokens) {
192
+ const token = reference.exec(source)?.[1];
193
+ if (token === undefined) return readInsets(source, input => bind(input, spec, tokens));
194
+ const values = readInsets(tokenValue(tokens, token), input => spec.parse(input));
195
+ if (values === undefined) return;
196
+ if (property === "padding" && values.length === 1) return [{ value: values[0], token, kind: "padding" }];
197
+ return rectangle(values).map((value, part) => ({ value, token, kind: property === "padding" ? "padding" : "margin", part }));
198
+ }
199
+
200
+ function declarationError(declaration, message) {
201
+ return typeof declaration.error === "function" ? declaration.error(message) : new Error(message);
202
+ }
203
+
204
+ const weightAlias = value => value === "normal" ? 400 : value === "bold" ? 700 : undefined;
205
+
206
+ /** Compile PostCSS-style ordered {prop, value, error?} records to one native style or state paint. */
207
+ export function compileCssDeclarations(declarations, {
208
+ tokens = new Map(), legacyProperties = {}, radii = cssRadii, fontWeights = cssFontWeights, state = false, reactive = false,
209
+ } = {}) {
210
+ const allowedRadii = [...radii];
211
+ const allowedWeights = [...fontWeights];
212
+ const bounds = new Map();
213
+ const recipes = new Map();
214
+ const seen = new Set();
215
+ const output = {};
216
+
217
+ function write(path, resolved, live = true) {
218
+ let parent = output;
219
+ for (let index = 0; index < path.length - 1; index++) {
220
+ const key = path[index];
221
+ parent = parent[key] ??= typeof path[index + 1] === "number" ? [] : {};
222
+ }
223
+ const { value, token, kind, add, part, values } = resolved;
224
+ parent[path.at(-1)] = value;
225
+ const key = JSON.stringify(path);
226
+ if (live && token !== undefined) {
227
+ recipes.set(key, { path, token, kind, fallback: value, source: tokenValue(tokens, token),
228
+ ...(add === undefined ? {} : { add }), ...(part === undefined ? {} : { part }),
229
+ ...(values === undefined ? {} : { values }) });
230
+ } else recipes.delete(key);
231
+ }
232
+
233
+ function declare(property, source) {
234
+ if (state && property === "border-color") {
235
+ const resolved = bind(source, color, tokens);
236
+ if (resolved === undefined) return false;
237
+ write(["borderColor"], resolved);
238
+ return true;
239
+ }
240
+ const side = sidesByProperty.get(property);
241
+ if ((property === "border" || side?.[0] === "border") && /^(none|0|0px)$/u.test(source)
242
+ || property === "border-style" && source === "none") {
243
+ // No border: zero widths need no color, and they replace a border from an earlier class.
244
+ for (const edge of side ? [side[1]] : sides) {
245
+ write(["border", edge, "width"], { value: 0 }, false);
246
+ if (output.border[edge].color !== undefined) delete output.border[edge].color;
247
+ recipes.delete(JSON.stringify(["border", edge, "color"]));
248
+ }
249
+ return true;
250
+ }
251
+ if (property === "border-style") return source === "solid";
252
+ const part = borderParts.get(property);
253
+ if (part !== undefined) {
254
+ const [field, edge] = part;
255
+ const spec = field === "width" ? length : color;
256
+ const words = edge === undefined ? pieces(source) : [source];
257
+ if (words.length < 1 || words.length > 4) return false;
258
+ const values = words.map(word => bind(word, spec, tokens));
259
+ if (values.some(value => value === undefined)) return false;
260
+ if (edge !== undefined) write(["border", edge, field], values[0]);
261
+ else rectangle(values).forEach((value, index) => write(["border", sides[index], field], value));
262
+ return true;
263
+ }
264
+ if (property === "border" || side?.[0] === "border") {
265
+ const fields = compound(source, "border", readBorder, ["width", "color"], tokens);
266
+ if (fields === undefined) return false;
267
+ for (const edge of side ? [side[1]] : sides) {
268
+ write(["border", edge, "width"], fields.width);
269
+ write(["border", edge, "color"], fields.color);
270
+ }
271
+ return true;
272
+ }
273
+ if (property === "text-shadow") {
274
+ const fields = compound(source, "textShadow", readShadow, ["x", "y", "color"], tokens);
275
+ if (fields === undefined) return false;
276
+ for (const field of ["x", "y", "color"]) write(["textShadow", field], fields[field]);
277
+ return true;
278
+ }
279
+ if ((property === "margin" || side?.[0] === "margin") && /(^|\s)auto(\s|$)/.test(source.trim())) {
280
+ // `auto` margins: the numeric sides stay margins, the auto ones are flags that center an absolute box.
281
+ const words = source.trim().split(/\s+/);
282
+ if (side?.[0] === "margin" ? words.length !== 1 : words.length < 1 || words.length > 4) return false;
283
+ const flags = output.autoMargin ? [...output.autoMargin] : [false, false, false, false];
284
+ const parts = side?.[0] === "margin" ? [[side[1], words[0]]] : rectangle(words).map((word, index) => [index, word]);
285
+ for (const [index, word] of parts) {
286
+ if (word === "auto") {
287
+ flags[index] = true;
288
+ continue;
289
+ }
290
+ const resolved = bind(word, signedLength, tokens);
291
+ if (resolved === undefined) return false;
292
+ flags[index] = false;
293
+ output.margin ??= [0, 0, 0, 0];
294
+ write(["margin", index], resolved);
295
+ }
296
+ write(["autoMargin"], { value: flags }, false);
297
+ return true;
298
+ }
299
+ if (property === "margin" || property === "padding" || property === "inset") {
300
+ const values = compileInsets(source, property, property === "padding" ? length : signedLength, tokens);
301
+ if (values === undefined) return false;
302
+ if (property === "padding") {
303
+ if (values.length === 1) write(["padding"], values[0]);
304
+ else values.forEach((value, index) => write(["padding", index], value));
305
+ } else rectangle(values).forEach((value, index) => write(property === "inset" ? [sides[index]] : ["margin", index], value));
306
+ return true;
307
+ }
308
+ if (side) {
309
+ const resolved = bind(source, signedLength, tokens);
310
+ if (resolved === undefined) return false;
311
+ if (side[0] === "margin") output.margin ??= [0, 0, 0, 0];
312
+ write(side, resolved);
313
+ return true;
314
+ }
315
+
316
+ let entry;
317
+ if (property === "border-radius") {
318
+ entry = ["borderRadius", numeric("radius", "px", value => allowedRadii.includes(value), allowedRadii)];
319
+ } else if (property === "font-weight") {
320
+ entry = ["fontWeight", numeric("fontWeight", "", value => allowedWeights.includes(value), allowedWeights, weightAlias)];
321
+ } else if (Object.hasOwn(scalarProperties, property)) entry = scalarProperties[property];
322
+ else if (Object.hasOwn(legacyProperties, property)) {
323
+ const [key, parse] = legacyProperties[property];
324
+ const kind = property === "grid-column" ? "gridColumn" : property.startsWith("grid-template-") ? "gridTracks" : undefined;
325
+ entry = [key, { kind, parse }];
326
+ }
327
+ if (!entry) throw new Error(`Unsupported property ${property}`);
328
+ const [key, spec] = entry;
329
+ const resolved = bind(source, spec, tokens);
330
+ if (resolved === undefined) return false;
331
+ const { value, token } = resolved;
332
+ if ((key === "color" || key === "backgroundColor") && token !== undefined) write([key], { value: `var(${token}, ${value})` });
333
+ else write([key], resolved, key !== "overflow");
334
+ return true;
335
+ }
336
+
337
+ let borderDeclaration;
338
+ for (const declaration of declarations) {
339
+ const { prop } = declaration;
340
+ if (prop.startsWith("border") && prop !== "border-radius") borderDeclaration = declaration;
341
+ try {
342
+ if (state && !supportsStateProperty(prop)) throw new Error(`Unsupported property ${prop} in a style state`);
343
+ if (reactive && prop === "overflow") throw new Error("Overflow is fixed at mount");
344
+ if (seen.has(prop) && !ordered.has(prop)) throw new Error(`Duplicate property ${prop}`);
345
+ if (!declare(prop, declaration.value.trim())) {
346
+ const hint = prop === "border-radius" ? ` (allowed radii: ${allowedRadii.map(value => `${value}px`).join(", ")})`
347
+ : prop === "font-weight" ? ` (allowed weights: ${allowedWeights.join(", ")})` : "";
348
+ throw new Error(`Invalid value for ${prop}: ${declaration.value}${hint}`);
349
+ }
350
+ } catch (error) { throw declarationError(declaration, error.message); }
351
+ seen.add(prop);
352
+ if (/^(min|max)-(width|height)$/.test(prop)) bounds.set(prop, declaration);
353
+ }
354
+
355
+ for (const [axis, min, max] of [["width", output.minWidth, output.maxWidth], ["height", output.minHeight, output.maxHeight]]) {
356
+ if (min !== undefined && max !== undefined && min > max) {
357
+ throw declarationError(bounds.get(`max-${axis}`), `min-${axis} (${min}px) exceeds max-${axis} (${max}px)`);
358
+ }
359
+ }
360
+ const border = output.border;
361
+ if (border !== undefined && !state) {
362
+ for (const side of sides) {
363
+ const edge = border[side];
364
+ if (edge === undefined) continue;
365
+ if (edge.width === undefined) {
366
+ throw declarationError(borderDeclaration, `border-${side}-color needs a width in the same rule. Use the border shorthand or add border-width`);
367
+ }
368
+ if (edge.width > 0 && edge.color === undefined) {
369
+ throw declarationError(borderDeclaration, `border-${side}-width needs a color in the same rule. Use the border shorthand or add border-color`);
370
+ }
371
+ }
372
+ }
373
+ const top = border?.top;
374
+ if (top?.width > 0 && sides.every(side => {
375
+ const edge = border[side];
376
+ return edge?.width === top.width && edge.color === top.color
377
+ && !recipes.has(JSON.stringify(["border", side, "width"]))
378
+ && !recipes.has(JSON.stringify(["border", side, "color"]));
379
+ })) {
380
+ const { width, color: literal } = top;
381
+ const rgba = [1, 3, 5].map(offset => Number.parseInt(literal.slice(offset, offset + 2), 16) / 255);
382
+ rgba.push(literal.length === 9 ? Number.parseInt(literal.slice(7, 9), 16) / 255 : 1);
383
+ output.borderPaint = { width, literal, rgba };
384
+ }
385
+ if (recipes.size > 0) output.styleTokens = [...recipes.values()];
386
+ return output;
387
+ }