@benev/tact 0.2.0 → 0.3.0-2

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 (495) hide show
  1. package/README.md +48 -390
  2. package/package.json +25 -27
  3. package/s/_archive/README.md +435 -0
  4. package/s/_archive/deck/deck.ts +69 -0
  5. package/s/_archive/demo/main.bundle.ts +10 -0
  6. package/s/_archive/demo/main.css +85 -0
  7. package/s/_archive/index.html.ts +61 -0
  8. package/s/_archive/index.ts +8 -0
  9. package/s/_archive/tests.test.ts +6 -0
  10. package/s/_archive/utils/circular-clamp.ts +14 -0
  11. package/s/_archive/utils/evergreen.ts +10 -0
  12. package/s/_archive/utils/split-axis.ts +15 -0
  13. package/s/assets/b.png +0 -0
  14. package/s/core/atom/defaults.ts +32 -0
  15. package/s/core/atom/lens-algo.ts +84 -0
  16. package/s/core/atom/types.ts +44 -0
  17. package/s/core/bindings/normalize.ts +27 -0
  18. package/s/core/bindings/shape.ts +15 -0
  19. package/s/core/bindings/table.ts +22 -0
  20. package/s/core/intent/bucket.ts +28 -0
  21. package/s/core/intent/consts.ts +4 -0
  22. package/s/core/intent/decode.ts +23 -0
  23. package/s/core/intent/encode.ts +20 -0
  24. package/s/core/intent/merge.ts +15 -0
  25. package/s/core/parts/action.ts +36 -0
  26. package/s/core/parts/sample-map.ts +24 -0
  27. package/s/core/resolvers/actions.ts +30 -0
  28. package/s/core/resolvers/intents.ts +106 -0
  29. package/s/core/types.ts +40 -0
  30. package/s/deck/controller.ts +35 -0
  31. package/s/deck/deck.ts +76 -53
  32. package/s/deck/parts/profiles.ts +39 -0
  33. package/s/deck/parts/runtime.ts +11 -0
  34. package/s/deck/parts/settings.ts +30 -0
  35. package/s/deck/port.ts +35 -0
  36. package/s/deck/types.ts +16 -0
  37. package/s/demo/demo-app/element.ts +17 -0
  38. package/s/demo/demo-app/style.css.ts +10 -0
  39. package/s/demo/main.bundle.ts +67 -6
  40. package/s/demo/main.css +6 -8
  41. package/s/device/devices.ts +24 -0
  42. package/s/device/gamepad.ts +42 -0
  43. package/s/device/keyboard.ts +33 -0
  44. package/s/device/pad/on-pad.ts +50 -0
  45. package/s/device/pad/pad.ts +10 -0
  46. package/s/device/pointer.ts +97 -0
  47. package/s/device/sampler.ts +25 -0
  48. package/s/device/stick.ts +24 -0
  49. package/s/gamepad/gamepad-app/element.ts +65 -0
  50. package/s/gamepad/gamepad-app/style.css.ts +73 -0
  51. package/s/gamepad/index.html.ts +44 -0
  52. package/s/gamepad/main.bundle.ts +6 -0
  53. package/s/gamepad/main.css +60 -0
  54. package/s/index-ui.ts +3 -0
  55. package/s/index.html.ts +10 -17
  56. package/s/index.ts +28 -5
  57. package/s/test.ts +339 -0
  58. package/s/ui/views/desk/style.css.ts +70 -0
  59. package/s/ui/views/desk/view.ts +122 -0
  60. package/s/utils/circular-clamp.ts +2 -2
  61. package/s/utils/do-async.ts +5 -0
  62. package/s/utils/freeze-clone.ts +7 -0
  63. package/s/utils/identifier.ts +30 -0
  64. package/s/utils/insert.ts +6 -0
  65. package/s/utils/is-down.ts +5 -0
  66. package/s/utils/make-id.ts +7 -0
  67. package/s/utils/remap.ts +7 -0
  68. package/s/utils/shift-limit.ts +9 -0
  69. package/s/utils/sort-by-key.ts +7 -0
  70. package/s/utils/tmax.ts +7 -0
  71. package/s/utils/tmin.ts +7 -0
  72. package/x/_archive/demo/main.css +85 -0
  73. package/x/assets/b.png +0 -0
  74. package/x/core/{bindings/parts → atom}/defaults.d.ts +1 -1
  75. package/x/core/atom/defaults.js.map +1 -0
  76. package/x/core/{bindings/parts → atom}/lens-algo.d.ts +1 -1
  77. package/x/core/{bindings/parts → atom}/lens-algo.js +8 -8
  78. package/x/core/atom/lens-algo.js.map +1 -0
  79. package/x/core/{bindings → atom}/types.d.ts +1 -15
  80. package/x/core/{devices → atom}/types.js.map +1 -1
  81. package/x/core/bindings/normalize.d.ts +2 -0
  82. package/x/core/bindings/normalize.js +17 -0
  83. package/x/core/bindings/normalize.js.map +1 -0
  84. package/x/core/bindings/shape.d.ts +2 -0
  85. package/x/core/bindings/shape.js +10 -0
  86. package/x/core/bindings/shape.js.map +1 -0
  87. package/x/core/bindings/table.d.ts +2 -0
  88. package/x/core/bindings/table.js +15 -0
  89. package/x/core/bindings/table.js.map +1 -0
  90. package/x/core/intent/bucket.d.ts +7 -0
  91. package/x/core/intent/bucket.js +21 -0
  92. package/x/core/intent/bucket.js.map +1 -0
  93. package/x/core/intent/consts.d.ts +2 -0
  94. package/x/core/intent/consts.js +3 -0
  95. package/x/core/intent/consts.js.map +1 -0
  96. package/x/core/intent/decode.d.ts +3 -0
  97. package/x/core/intent/decode.js +18 -0
  98. package/x/core/intent/decode.js.map +1 -0
  99. package/x/core/intent/encode.d.ts +3 -0
  100. package/x/core/intent/encode.js +15 -0
  101. package/x/core/intent/encode.js.map +1 -0
  102. package/x/core/intent/merge.d.ts +3 -0
  103. package/x/core/intent/merge.js +10 -0
  104. package/x/core/intent/merge.js.map +1 -0
  105. package/x/core/{bindings → parts}/action.d.ts +5 -3
  106. package/x/core/parts/action.js +30 -0
  107. package/x/core/parts/action.js.map +1 -0
  108. package/x/core/parts/sample-map.d.ts +6 -0
  109. package/x/core/{bindings → parts}/sample-map.js +2 -3
  110. package/x/core/parts/sample-map.js.map +1 -0
  111. package/x/core/resolvers/actions.d.ts +2 -0
  112. package/x/core/resolvers/actions.js +23 -0
  113. package/x/core/resolvers/actions.js.map +1 -0
  114. package/x/core/resolvers/intents.d.ts +2 -0
  115. package/x/core/{bindings/resolver.js → resolvers/intents.js} +39 -43
  116. package/x/core/resolvers/intents.js.map +1 -0
  117. package/x/core/types.d.ts +43 -0
  118. package/x/core/types.js +2 -0
  119. package/x/core/types.js.map +1 -0
  120. package/x/deck/controller.d.ts +11 -0
  121. package/x/deck/controller.js +28 -0
  122. package/x/deck/controller.js.map +1 -0
  123. package/x/deck/deck.d.ts +30 -26
  124. package/x/deck/deck.js +64 -43
  125. package/x/deck/deck.js.map +1 -1
  126. package/x/deck/parts/profiles.d.ts +12 -0
  127. package/x/deck/parts/profiles.js +31 -0
  128. package/x/deck/parts/profiles.js.map +1 -0
  129. package/x/deck/parts/runtime.d.ts +8 -0
  130. package/x/deck/parts/runtime.js +7 -0
  131. package/x/deck/parts/runtime.js.map +1 -0
  132. package/x/deck/parts/settings.d.ts +11 -0
  133. package/x/deck/parts/settings.js +26 -0
  134. package/x/deck/parts/settings.js.map +1 -0
  135. package/x/deck/port.d.ts +10 -0
  136. package/x/deck/port.js +24 -0
  137. package/x/deck/port.js.map +1 -0
  138. package/x/deck/types.d.ts +11 -0
  139. package/x/deck/types.js +2 -0
  140. package/x/deck/types.js.map +1 -0
  141. package/x/demo/demo-app/element.d.ts +3 -0
  142. package/x/demo/demo-app/element.js +13 -0
  143. package/x/demo/demo-app/element.js.map +1 -0
  144. package/x/demo/demo-app/style.css.js +9 -0
  145. package/x/demo/demo-app/style.css.js.map +1 -0
  146. package/x/demo/main.bundle.js +53 -5
  147. package/x/demo/main.bundle.js.map +1 -1
  148. package/x/demo/main.bundle.min.js +106 -395
  149. package/x/demo/main.bundle.min.js.LEGAL.txt +33 -0
  150. package/x/demo/main.bundle.min.js.map +4 -4
  151. package/x/demo/main.css +6 -8
  152. package/x/device/devices.d.ts +7 -0
  153. package/x/device/devices.js +17 -0
  154. package/x/device/devices.js.map +1 -0
  155. package/x/device/gamepad.d.ts +9 -0
  156. package/x/device/gamepad.js +37 -0
  157. package/x/device/gamepad.js.map +1 -0
  158. package/x/{core/devices/standard → device}/keyboard.d.ts +1 -1
  159. package/x/{core/devices/standard → device}/keyboard.js +4 -2
  160. package/x/device/keyboard.js.map +1 -0
  161. package/x/device/pad/on-pad.d.ts +3 -0
  162. package/x/device/pad/on-pad.js +42 -0
  163. package/x/device/pad/on-pad.js.map +1 -0
  164. package/x/device/pad/pad.d.ts +6 -0
  165. package/x/device/pad/pad.js +11 -0
  166. package/x/device/pad/pad.js.map +1 -0
  167. package/x/{core/devices/standard → device}/pointer.d.ts +2 -2
  168. package/x/{core/devices/standard → device}/pointer.js +4 -4
  169. package/x/device/pointer.js.map +1 -0
  170. package/x/device/sampler.d.ts +9 -0
  171. package/x/device/sampler.js +19 -0
  172. package/x/device/sampler.js.map +1 -0
  173. package/x/{core/devices/standard → device}/stick.d.ts +2 -3
  174. package/x/{core/devices/standard → device}/stick.js +4 -6
  175. package/x/device/stick.js.map +1 -0
  176. package/x/gamepad/gamepad-app/element.d.ts +1 -0
  177. package/x/gamepad/gamepad-app/element.js +54 -0
  178. package/x/gamepad/gamepad-app/element.js.map +1 -0
  179. package/x/gamepad/gamepad-app/style.css.js +72 -0
  180. package/x/gamepad/gamepad-app/style.css.js.map +1 -0
  181. package/x/gamepad/index.html +35 -0
  182. package/x/gamepad/index.html.d.ts +2 -0
  183. package/x/gamepad/index.html.js +41 -0
  184. package/x/gamepad/index.html.js.map +1 -0
  185. package/x/gamepad/main.bundle.js +4 -0
  186. package/x/gamepad/main.bundle.js.map +1 -0
  187. package/x/gamepad/main.bundle.min.js +126 -0
  188. package/x/gamepad/main.bundle.min.js.LEGAL.txt +33 -0
  189. package/x/gamepad/main.bundle.min.js.map +7 -0
  190. package/x/gamepad/main.css +60 -0
  191. package/x/index-ui.d.ts +1 -0
  192. package/x/index-ui.js +2 -0
  193. package/x/index-ui.js.map +1 -0
  194. package/x/index.d.ts +27 -5
  195. package/x/index.html +17 -24
  196. package/x/index.html.js +10 -17
  197. package/x/index.html.js.map +1 -1
  198. package/x/index.js +27 -5
  199. package/x/index.js.map +1 -1
  200. package/x/test.d.ts +9 -0
  201. package/x/test.js +307 -0
  202. package/x/test.js.map +1 -0
  203. package/x/ui/views/desk/style.css.js +69 -0
  204. package/x/ui/views/desk/style.css.js.map +1 -0
  205. package/x/ui/views/desk/view.d.ts +7 -0
  206. package/x/ui/views/desk/view.js +102 -0
  207. package/x/ui/views/desk/view.js.map +1 -0
  208. package/x/utils/circular-clamp.js +2 -2
  209. package/x/utils/circular-clamp.js.map +1 -1
  210. package/x/utils/do-async.d.ts +1 -0
  211. package/x/utils/do-async.js +4 -0
  212. package/x/utils/do-async.js.map +1 -0
  213. package/x/utils/freeze-clone.d.ts +1 -0
  214. package/x/utils/freeze-clone.js +5 -0
  215. package/x/utils/freeze-clone.js.map +1 -0
  216. package/x/utils/identifier.d.ts +6 -0
  217. package/x/utils/identifier.js +25 -0
  218. package/x/utils/identifier.js.map +1 -0
  219. package/x/utils/insert.d.ts +1 -0
  220. package/x/utils/insert.js +5 -0
  221. package/x/utils/insert.js.map +1 -0
  222. package/x/utils/is-down.d.ts +1 -0
  223. package/x/utils/is-down.js +4 -0
  224. package/x/utils/is-down.js.map +1 -0
  225. package/x/utils/make-id.d.ts +1 -0
  226. package/x/utils/make-id.js +5 -0
  227. package/x/utils/make-id.js.map +1 -0
  228. package/x/utils/remap.d.ts +1 -0
  229. package/x/utils/remap.js +6 -0
  230. package/x/utils/remap.js.map +1 -0
  231. package/x/utils/shift-limit.d.ts +2 -0
  232. package/x/utils/shift-limit.js +7 -0
  233. package/x/utils/shift-limit.js.map +1 -0
  234. package/x/utils/sort-by-key.d.ts +1 -0
  235. package/x/utils/sort-by-key.js +6 -0
  236. package/x/utils/sort-by-key.js.map +1 -0
  237. package/x/utils/{quick-math.d.ts → tmax.d.ts} +0 -1
  238. package/x/utils/tmax.js +6 -0
  239. package/x/utils/tmax.js.map +1 -0
  240. package/x/utils/tmin.d.ts +1 -0
  241. package/x/utils/tmin.js +6 -0
  242. package/x/utils/tmin.js.map +1 -0
  243. package/s/tests.test.ts +0 -6
  244. package/x/core/bindings/action.js +0 -24
  245. package/x/core/bindings/action.js.map +0 -1
  246. package/x/core/bindings/parts/defaults.js.map +0 -1
  247. package/x/core/bindings/parts/is-pressed.d.ts +0 -1
  248. package/x/core/bindings/parts/is-pressed.js +0 -4
  249. package/x/core/bindings/parts/is-pressed.js.map +0 -1
  250. package/x/core/bindings/parts/lens-algo.js.map +0 -1
  251. package/x/core/bindings/parts/lookup-proxies.js +0 -19
  252. package/x/core/bindings/parts/lookup-proxies.js.map +0 -1
  253. package/x/core/bindings/resolver.d.ts +0 -9
  254. package/x/core/bindings/resolver.js.map +0 -1
  255. package/x/core/bindings/sample-map.d.ts +0 -7
  256. package/x/core/bindings/sample-map.js.map +0 -1
  257. package/x/core/bindings/types.js +0 -4
  258. package/x/core/bindings/types.js.map +0 -1
  259. package/x/core/core.test.d.ts +0 -13
  260. package/x/core/core.test.js +0 -138
  261. package/x/core/core.test.js.map +0 -1
  262. package/x/core/devices/auto-gamepads.d.ts +0 -2
  263. package/x/core/devices/auto-gamepads.js +0 -6
  264. package/x/core/devices/auto-gamepads.js.map +0 -1
  265. package/x/core/devices/device.d.ts +0 -5
  266. package/x/core/devices/device.js +0 -7
  267. package/x/core/devices/device.js.map +0 -1
  268. package/x/core/devices/infra/group.d.ts +0 -7
  269. package/x/core/devices/infra/group.js +0 -21
  270. package/x/core/devices/infra/group.js.map +0 -1
  271. package/x/core/devices/infra/sampler.d.ts +0 -9
  272. package/x/core/devices/infra/sampler.js +0 -18
  273. package/x/core/devices/infra/sampler.js.map +0 -1
  274. package/x/core/devices/standard/gamepad.d.ts +0 -11
  275. package/x/core/devices/standard/gamepad.js +0 -65
  276. package/x/core/devices/standard/gamepad.js.map +0 -1
  277. package/x/core/devices/standard/index.d.ts +0 -6
  278. package/x/core/devices/standard/index.js +0 -7
  279. package/x/core/devices/standard/index.js.map +0 -1
  280. package/x/core/devices/standard/keyboard.js.map +0 -1
  281. package/x/core/devices/standard/pointer.js.map +0 -1
  282. package/x/core/devices/standard/primary.d.ts +0 -10
  283. package/x/core/devices/standard/primary.js +0 -17
  284. package/x/core/devices/standard/primary.js.map +0 -1
  285. package/x/core/devices/standard/stick.js.map +0 -1
  286. package/x/core/devices/standard/vpad.d.ts +0 -7
  287. package/x/core/devices/standard/vpad.js +0 -20
  288. package/x/core/devices/standard/vpad.js.map +0 -1
  289. package/x/core/devices/types.d.ts +0 -1
  290. package/x/core/hub/hub.d.ts +0 -32
  291. package/x/core/hub/hub.js +0 -101
  292. package/x/core/hub/hub.js.map +0 -1
  293. package/x/core/hub/meta-bindings.d.ts +0 -2
  294. package/x/core/hub/meta-bindings.js +0 -21
  295. package/x/core/hub/meta-bindings.js.map +0 -1
  296. package/x/core/hub/parts/connected.d.ts +0 -14
  297. package/x/core/hub/parts/connected.js +0 -12
  298. package/x/core/hub/parts/connected.js.map +0 -1
  299. package/x/core/hub/port.d.ts +0 -9
  300. package/x/core/hub/port.js +0 -19
  301. package/x/core/hub/port.js.map +0 -1
  302. package/x/core/hub/types.d.ts +0 -9
  303. package/x/core/hub/types.js +0 -2
  304. package/x/core/hub/types.js.map +0 -1
  305. package/x/core/index.d.ts +0 -15
  306. package/x/core/index.js +0 -16
  307. package/x/core/index.js.map +0 -1
  308. package/x/core/testing/testing.d.ts +0 -52
  309. package/x/core/testing/testing.js +0 -45
  310. package/x/core/testing/testing.js.map +0 -1
  311. package/x/deck/index.d.ts +0 -9
  312. package/x/deck/index.js +0 -10
  313. package/x/deck/index.js.map +0 -1
  314. package/x/deck/parts/catalog.d.ts +0 -22
  315. package/x/deck/parts/catalog.js +0 -35
  316. package/x/deck/parts/catalog.js.map +0 -1
  317. package/x/deck/parts/db.d.ts +0 -17
  318. package/x/deck/parts/db.js +0 -52
  319. package/x/deck/parts/db.js.map +0 -1
  320. package/x/deck/parts/device-skins/device-icons.d.ts +0 -12
  321. package/x/deck/parts/device-skins/device-icons.js +0 -27
  322. package/x/deck/parts/device-skins/device-icons.js.map +0 -1
  323. package/x/deck/parts/device-skins/device-skin.d.ts +0 -14
  324. package/x/deck/parts/device-skins/device-skin.js +0 -22
  325. package/x/deck/parts/device-skins/device-skin.js.map +0 -1
  326. package/x/deck/parts/local-storage-kv.d.ts +0 -2
  327. package/x/deck/parts/local-storage-kv.js +0 -6
  328. package/x/deck/parts/local-storage-kv.js.map +0 -1
  329. package/x/deck/parts/merge-bindings.d.ts +0 -2
  330. package/x/deck/parts/merge-bindings.js +0 -15
  331. package/x/deck/parts/merge-bindings.js.map +0 -1
  332. package/x/deck/parts/overlay-visibility.d.ts +0 -18
  333. package/x/deck/parts/overlay-visibility.js +0 -35
  334. package/x/deck/parts/overlay-visibility.js.map +0 -1
  335. package/x/deck/views/bindings/style.css.js +0 -5
  336. package/x/deck/views/bindings/style.css.js.map +0 -1
  337. package/x/deck/views/bindings/view.d.ts +0 -2
  338. package/x/deck/views/bindings/view.js +0 -80
  339. package/x/deck/views/bindings/view.js.map +0 -1
  340. package/x/deck/views/overlay/style.css.js +0 -109
  341. package/x/deck/views/overlay/style.css.js.map +0 -1
  342. package/x/deck/views/overlay/view.d.ts +0 -2
  343. package/x/deck/views/overlay/view.js +0 -40
  344. package/x/deck/views/overlay/view.js.map +0 -1
  345. package/x/demo/game/game.d.ts +0 -17
  346. package/x/demo/game/game.js +0 -63
  347. package/x/demo/game/game.js.map +0 -1
  348. package/x/demo/game/parts/agent.d.ts +0 -7
  349. package/x/demo/game/parts/agent.js +0 -8
  350. package/x/demo/game/parts/agent.js.map +0 -1
  351. package/x/demo/game/parts/game-bindings.d.ts +0 -15
  352. package/x/demo/game/parts/game-bindings.js +0 -10
  353. package/x/demo/game/parts/game-bindings.js.map +0 -1
  354. package/x/demo/game/parts/logic.d.ts +0 -8
  355. package/x/demo/game/parts/logic.js +0 -21
  356. package/x/demo/game/parts/logic.js.map +0 -1
  357. package/x/demo/game/parts/player.d.ts +0 -14
  358. package/x/demo/game/parts/player.js +0 -26
  359. package/x/demo/game/parts/player.js.map +0 -1
  360. package/x/demo/game/parts/renderer.d.ts +0 -13
  361. package/x/demo/game/parts/renderer.js +0 -91
  362. package/x/demo/game/parts/renderer.js.map +0 -1
  363. package/x/demo/game/parts/state.d.ts +0 -8
  364. package/x/demo/game/parts/state.js +0 -20
  365. package/x/demo/game/parts/state.js.map +0 -1
  366. package/x/demo/game/parts/virtual-device.d.ts +0 -8
  367. package/x/demo/game/parts/virtual-device.js +0 -11
  368. package/x/demo/game/parts/virtual-device.js.map +0 -1
  369. package/x/demo/ui/theater/styles.css.d.ts +0 -1
  370. package/x/demo/ui/theater/styles.css.js +0 -57
  371. package/x/demo/ui/theater/styles.css.js.map +0 -1
  372. package/x/demo/ui/theater/view.d.ts +0 -2
  373. package/x/demo/ui/theater/view.js +0 -45
  374. package/x/demo/ui/theater/view.js.map +0 -1
  375. package/x/demo/ui/theater/virtual/style.css.js +0 -42
  376. package/x/demo/ui/theater/virtual/style.css.js.map +0 -1
  377. package/x/demo/ui/theater/virtual/view.d.ts +0 -4
  378. package/x/demo/ui/theater/virtual/view.js +0 -19
  379. package/x/demo/ui/theater/virtual/view.js.map +0 -1
  380. package/x/demo/ui/utils/loader.d.ts +0 -2
  381. package/x/demo/ui/utils/loader.js +0 -3
  382. package/x/demo/ui/utils/loader.js.map +0 -1
  383. package/x/nubs/index.d.ts +0 -3
  384. package/x/nubs/index.js +0 -4
  385. package/x/nubs/index.js.map +0 -1
  386. package/x/nubs/lookpad/styles.d.ts +0 -1
  387. package/x/nubs/lookpad/styles.js +0 -21
  388. package/x/nubs/lookpad/styles.js.map +0 -1
  389. package/x/nubs/lookpad/view.d.ts +0 -1
  390. package/x/nubs/lookpad/view.js +0 -33
  391. package/x/nubs/lookpad/view.js.map +0 -1
  392. package/x/nubs/stick/style.css.d.ts +0 -2
  393. package/x/nubs/stick/style.css.js +0 -69
  394. package/x/nubs/stick/style.css.js.map +0 -1
  395. package/x/nubs/stick/view.d.ts +0 -2
  396. package/x/nubs/stick/view.js +0 -95
  397. package/x/nubs/stick/view.js.map +0 -1
  398. package/x/nubs/vpad/styles.css.d.ts +0 -2
  399. package/x/nubs/vpad/styles.css.js +0 -133
  400. package/x/nubs/vpad/styles.css.js.map +0 -1
  401. package/x/nubs/vpad/utils/gamepad-inputs.d.ts +0 -29
  402. package/x/nubs/vpad/utils/gamepad-inputs.js +0 -31
  403. package/x/nubs/vpad/utils/gamepad-inputs.js.map +0 -1
  404. package/x/nubs/vpad/utils/prevent-default-touch-shenanigans.d.ts +0 -1
  405. package/x/nubs/vpad/utils/prevent-default-touch-shenanigans.js +0 -9
  406. package/x/nubs/vpad/utils/prevent-default-touch-shenanigans.js.map +0 -1
  407. package/x/nubs/vpad/utils/touch-tracking.d.ts +0 -6
  408. package/x/nubs/vpad/utils/touch-tracking.js +0 -55
  409. package/x/nubs/vpad/utils/touch-tracking.js.map +0 -1
  410. package/x/nubs/vpad/view.d.ts +0 -2
  411. package/x/nubs/vpad/view.js +0 -123
  412. package/x/nubs/vpad/view.js.map +0 -1
  413. package/x/tests.test.d.ts +0 -1
  414. package/x/tests.test.js +0 -4
  415. package/x/tests.test.js.map +0 -1
  416. package/x/utils/dispensers.d.ts +0 -7
  417. package/x/utils/dispensers.js +0 -16
  418. package/x/utils/dispensers.js.map +0 -1
  419. package/x/utils/gamepads.d.ts +0 -14
  420. package/x/utils/gamepads.js +0 -40
  421. package/x/utils/gamepads.js.map +0 -1
  422. package/x/utils/quick-math.js +0 -11
  423. package/x/utils/quick-math.js.map +0 -1
  424. /package/s/{core → _archive/core}/bindings/action.ts +0 -0
  425. /package/s/{core → _archive/core}/bindings/parts/defaults.ts +0 -0
  426. /package/s/{core → _archive/core}/bindings/parts/is-pressed.ts +0 -0
  427. /package/s/{core → _archive/core}/bindings/parts/lens-algo.ts +0 -0
  428. /package/s/{core → _archive/core}/bindings/parts/lookup-proxies.ts +0 -0
  429. /package/s/{core → _archive/core}/bindings/resolver.ts +0 -0
  430. /package/s/{core → _archive/core}/bindings/sample-map.ts +0 -0
  431. /package/s/{core → _archive/core}/bindings/types.ts +0 -0
  432. /package/s/{core → _archive/core}/core.test.ts +0 -0
  433. /package/s/{core → _archive/core}/devices/auto-gamepads.ts +0 -0
  434. /package/s/{core → _archive/core}/devices/device.ts +0 -0
  435. /package/s/{core → _archive/core}/devices/infra/group.ts +0 -0
  436. /package/s/{core → _archive/core}/devices/infra/sampler.ts +0 -0
  437. /package/s/{core → _archive/core}/devices/standard/gamepad.ts +0 -0
  438. /package/s/{core → _archive/core}/devices/standard/index.ts +0 -0
  439. /package/s/{core → _archive/core}/devices/standard/keyboard.ts +0 -0
  440. /package/s/{core → _archive/core}/devices/standard/pointer.ts +0 -0
  441. /package/s/{core → _archive/core}/devices/standard/primary.ts +0 -0
  442. /package/s/{core → _archive/core}/devices/standard/stick.ts +0 -0
  443. /package/s/{core → _archive/core}/devices/standard/vpad.ts +0 -0
  444. /package/s/{core → _archive/core}/devices/types.ts +0 -0
  445. /package/s/{core → _archive/core}/hub/hub.ts +0 -0
  446. /package/s/{core → _archive/core}/hub/meta-bindings.ts +0 -0
  447. /package/s/{core → _archive/core}/hub/parts/connected.ts +0 -0
  448. /package/s/{core → _archive/core}/hub/port.ts +0 -0
  449. /package/s/{core → _archive/core}/hub/types.ts +0 -0
  450. /package/s/{core → _archive/core}/index.ts +0 -0
  451. /package/s/{core → _archive/core}/testing/testing.ts +0 -0
  452. /package/s/{deck → _archive/deck}/index.ts +0 -0
  453. /package/s/{deck → _archive/deck}/parts/catalog.ts +0 -0
  454. /package/s/{deck → _archive/deck}/parts/db.ts +0 -0
  455. /package/s/{deck → _archive/deck}/parts/device-skins/device-icons.ts +0 -0
  456. /package/s/{deck → _archive/deck}/parts/device-skins/device-skin.ts +0 -0
  457. /package/s/{deck → _archive/deck}/parts/local-storage-kv.ts +0 -0
  458. /package/s/{deck → _archive/deck}/parts/merge-bindings.ts +0 -0
  459. /package/s/{deck → _archive/deck}/parts/overlay-visibility.ts +0 -0
  460. /package/s/{deck → _archive/deck}/views/bindings/style.css.ts +0 -0
  461. /package/s/{deck → _archive/deck}/views/bindings/view.ts +0 -0
  462. /package/s/{deck → _archive/deck}/views/overlay/style.css.ts +0 -0
  463. /package/s/{deck → _archive/deck}/views/overlay/view.ts +0 -0
  464. /package/s/{demo → _archive/demo}/game/game.ts +0 -0
  465. /package/s/{demo → _archive/demo}/game/parts/agent.ts +0 -0
  466. /package/s/{demo → _archive/demo}/game/parts/game-bindings.ts +0 -0
  467. /package/s/{demo → _archive/demo}/game/parts/logic.ts +0 -0
  468. /package/s/{demo → _archive/demo}/game/parts/player.ts +0 -0
  469. /package/s/{demo → _archive/demo}/game/parts/renderer.ts +0 -0
  470. /package/s/{demo → _archive/demo}/game/parts/state.ts +0 -0
  471. /package/s/{demo → _archive/demo}/game/parts/virtual-device.ts +0 -0
  472. /package/s/{demo → _archive/demo}/ui/theater/styles.css.ts +0 -0
  473. /package/s/{demo → _archive/demo}/ui/theater/view.ts +0 -0
  474. /package/s/{demo → _archive/demo}/ui/theater/virtual/style.css.ts +0 -0
  475. /package/s/{demo → _archive/demo}/ui/theater/virtual/view.ts +0 -0
  476. /package/s/{demo → _archive/demo}/ui/utils/loader.ts +0 -0
  477. /package/s/{nubs → _archive/nubs}/index.ts +0 -0
  478. /package/s/{nubs → _archive/nubs}/lookpad/styles.ts +0 -0
  479. /package/s/{nubs → _archive/nubs}/lookpad/view.ts +0 -0
  480. /package/s/{nubs → _archive/nubs}/stick/style.css.ts +0 -0
  481. /package/s/{nubs → _archive/nubs}/stick/view.ts +0 -0
  482. /package/s/{nubs → _archive/nubs}/vpad/styles.css.ts +0 -0
  483. /package/s/{nubs → _archive/nubs}/vpad/utils/gamepad-inputs.ts +0 -0
  484. /package/s/{nubs → _archive/nubs}/vpad/utils/prevent-default-touch-shenanigans.ts +0 -0
  485. /package/s/{nubs → _archive/nubs}/vpad/utils/touch-tracking.ts +0 -0
  486. /package/s/{nubs → _archive/nubs}/vpad/view.ts +0 -0
  487. /package/s/{utils → _archive/utils}/dispensers.ts +0 -0
  488. /package/s/{utils → _archive/utils}/gamepads.ts +0 -0
  489. /package/s/{utils → _archive/utils}/quick-math.ts +0 -0
  490. /package/x/core/{bindings/parts → atom}/defaults.js +0 -0
  491. /package/x/core/{devices → atom}/types.js +0 -0
  492. /package/x/{deck/views/bindings → demo/demo-app}/style.css.d.ts +0 -0
  493. /package/x/{deck/views/overlay → gamepad/gamepad-app}/style.css.d.ts +0 -0
  494. /package/x/{core/bindings/parts/lookup-proxies.d.ts → gamepad/main.bundle.d.ts} +0 -0
  495. /package/x/{demo/ui/theater/virtual → ui/views/desk}/style.css.d.ts +0 -0
@@ -0,0 +1,43 @@
1
+ import { Atom } from "./atom/types.js";
2
+ import { Action } from "./parts/action.js";
3
+ /** json-friendly description of how samples are interpreted */
4
+ export type Bindings = {
5
+ [mode: string]: {
6
+ [action: string]: Atom;
7
+ };
8
+ };
9
+ /** describes the shape of how bindings relate to the binds index (useful on serverside) */
10
+ export type BindingsShape<B extends Bindings> = {
11
+ [MK in keyof B]: {
12
+ [AK in keyof B[MK]]: number;
13
+ };
14
+ };
15
+ /** integer-indexed flat map of bindings info (for efficient networking) */
16
+ export type BindingsTable<B extends Bindings> = Map<number, BindingsRow<B>>;
17
+ /** the binding for a single action */
18
+ export type BindingsRow<B extends Bindings> = {
19
+ id: number;
20
+ mode: keyof B;
21
+ action: keyof B[keyof B];
22
+ atom: Atom;
23
+ };
24
+ /** produces user input samples (eg, a keyboard produces samples) */
25
+ export type Device = {
26
+ samples(): Iterable<Sample>;
27
+ };
28
+ /** raw user input, eg, `["KeyW", 1]` */
29
+ export type Sample = [code: string, value: number];
30
+ /** efficiently express resolved values */
31
+ export type Intent = [id: number, value: number];
32
+ /** ergonomic access to user inputs (your app logic should read from this) */
33
+ export type Actions<B extends Bindings> = {
34
+ [M in keyof B]: {
35
+ [A in keyof B[M]]: Action;
36
+ };
37
+ };
38
+ export type AsBindings<B extends Bindings> = {
39
+ [MK in keyof B]: {
40
+ [AK in keyof B[MK]]: Atom;
41
+ };
42
+ };
43
+ export declare const asBindings: <B extends Bindings>(b: B) => AsBindings<B>;
@@ -0,0 +1,2 @@
1
+ export const asBindings = (b) => b;
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../s/core/types.ts"],"names":[],"mappings":"AAsCA,MAAM,CAAC,MAAM,UAAU,GAAG,CAAqB,CAAI,EAAE,EAAE,CAAE,CAAmB,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { Bindings, Device } from "../core/types.js";
2
+ /** associate a device with particular bindings */
3
+ export declare class Controller<B extends Bindings = Bindings, D extends Device = Device> {
4
+ #private;
5
+ readonly handle: string;
6
+ device: D;
7
+ constructor(handle: string, bindings: B, device: D);
8
+ get bindings(): B;
9
+ set bindings(bindings: B);
10
+ resolveIntents(now: number): import("../core/types.js").Intent[];
11
+ }
@@ -0,0 +1,28 @@
1
+ import { deep } from "@e280/stz";
2
+ import { makeIntentsResolver } from "../core/resolvers/intents.js";
3
+ /** associate a device with particular bindings */
4
+ export class Controller {
5
+ handle;
6
+ device;
7
+ #bindings;
8
+ #resolveIntents;
9
+ constructor(handle, bindings, device) {
10
+ this.handle = handle;
11
+ this.device = device;
12
+ this.#bindings = bindings;
13
+ this.#resolveIntents = makeIntentsResolver(bindings);
14
+ }
15
+ get bindings() {
16
+ return this.#bindings;
17
+ }
18
+ set bindings(bindings) {
19
+ if (!deep.equal(this.#bindings, bindings)) {
20
+ this.#bindings = bindings;
21
+ this.#resolveIntents = makeIntentsResolver(bindings);
22
+ }
23
+ }
24
+ resolveIntents(now) {
25
+ return this.#resolveIntents(now, this.device.samples());
26
+ }
27
+ }
28
+ //# sourceMappingURL=controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../s/deck/controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAE9B,OAAO,EAAC,mBAAmB,EAAC,MAAM,8BAA8B,CAAA;AAEhE,kDAAkD;AAClD,MAAM,OAAO,UAAU;IAKX,MAAM;IAER,MAAM;IANf,SAAS,CAAG;IACZ,eAAe,CAAA;IAEf,YACW,MAAc,EACvB,QAAW,EACJ,MAAS;sBAFP,MAAM;sBAER,MAAM;QAEd,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;QACzB,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAA;IACrD,CAAC;IAED,IAAI,QAAQ;QACX,OAAO,IAAI,CAAC,SAAS,CAAA;IACtB,CAAC;IAED,IAAI,QAAQ,CAAC,QAAW;QACvB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC;YAC3C,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;YACzB,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAA;QACrD,CAAC;IACF,CAAC;IAED,cAAc,CAAC,GAAW;QACzB,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;IACxD,CAAC;CACD"}
package/x/deck/deck.d.ts CHANGED
@@ -1,27 +1,31 @@
1
- import { Kv } from "@e280/kv";
2
- import { Db } from "./parts/db.js";
3
- import { Hub } from "../core/hub/hub.js";
4
- import { Bindings } from "../core/bindings/types.js";
5
- import { MetaBindings } from "../core/hub/types.js";
6
- import { DeviceSkins } from "./parts/device-skins/device-skin.js";
7
- import { OverlayVisibility } from "./parts/overlay-visibility.js";
8
- import { PrimaryDevice } from "../core/devices/standard/primary.js";
9
- export type DeckOptions<B extends Bindings, MB extends MetaBindings = any> = {
10
- kv: Kv;
11
- bindings: B;
12
- portCount: number;
13
- metaBindings?: MB;
14
- };
15
- export declare class Deck<B extends Bindings, MB extends MetaBindings = any> {
16
- baseBindings: B;
17
- baseMetaBindings: MB;
18
- hub: Hub<B, MB>;
19
- db: Db;
20
- static load<B extends Bindings, MB extends MetaBindings = any>(options: DeckOptions<B, MB>): Promise<Deck<B, any>>;
21
- dispose: import("@e280/stz").Disposer;
22
- deviceSkins: DeviceSkins;
23
- primaryDevice: PrimaryDevice;
24
- overlayVisibility: OverlayVisibility;
25
- constructor(baseBindings: B, baseMetaBindings: MB, hub: Hub<B, MB>, db: Db);
26
- get catalog(): import("./index.js").Catalog;
1
+ import { Cubby } from "@e280/stz";
2
+ import { Port } from "./port.js";
3
+ import { Device } from "../core/types.js";
4
+ import { Controller } from "./controller.js";
5
+ import { Profiles } from "./parts/profiles.js";
6
+ import { Settings } from "./parts/settings.js";
7
+ import { DeckState, Profile, ProfileKey } from "./types.js";
8
+ export declare class Deck<StockProfileKey extends ProfileKey = ProfileKey> {
9
+ #private;
10
+ profiles: Profiles;
11
+ settings: Settings;
12
+ constructor(options: {
13
+ store: Cubby<DeckState>;
14
+ stockProfiles: Record<StockProfileKey, Profile>;
15
+ });
16
+ load(): Promise<void>;
17
+ get ports(): Port[];
18
+ get controllers(): Controller<import("../core/types.js").Bindings, Device>[];
19
+ get unassignedControllers(): Controller<import("../core/types.js").Bindings, Device>[];
20
+ createPort(): Port;
21
+ deletePort(port: Port): void;
22
+ createController<D extends Device = Device>(handle: string, stockProfileKey: StockProfileKey, device: D): Controller<import("../core/types.js").Bindings, D>;
23
+ deleteController(controller: Controller): void;
24
+ assignControllerProfile(controller: Controller, profileKey: StockProfileKey | ProfileKey): Promise<void>;
25
+ queryController(controller: Controller): {
26
+ controller: Controller<import("../core/types.js").Bindings, Device>;
27
+ port: Port | undefined;
28
+ profileKey: string | undefined;
29
+ profile: Profile;
30
+ };
27
31
  }
package/x/deck/deck.js CHANGED
@@ -1,47 +1,68 @@
1
- import { disposer, range } from "@e280/stz";
2
- import { Db } from "./parts/db.js";
3
- import { Hub } from "../core/hub/hub.js";
4
- import { Port } from "../core/hub/port.js";
5
- import { mergeBindings } from "./parts/merge-bindings.js";
6
- import { metaMode } from "../core/hub/types.js";
7
- import { makeMetaBindings } from "../core/hub/meta-bindings.js";
8
- import { DeviceSkins } from "./parts/device-skins/device-skin.js";
9
- import { OverlayVisibility } from "./parts/overlay-visibility.js";
10
- import { PrimaryDevice } from "../core/devices/standard/primary.js";
1
+ import { debounce, guarantee } from "@e280/stz";
2
+ import { Port } from "./port.js";
3
+ import { Runtime } from "./parts/runtime.js";
4
+ import { Controller } from "./controller.js";
5
+ import { Profiles } from "./parts/profiles.js";
6
+ import { Settings } from "./parts/settings.js";
11
7
  export class Deck {
12
- baseBindings;
13
- baseMetaBindings;
14
- hub;
15
- db;
16
- static async load(options) {
17
- const db = await Db.load(options.kv.store("catalog"));
18
- const ports = range(options.portCount)
19
- .map(index => db.$catalog().getProfileForPort(index))
20
- .map(profile => mergeBindings(options.bindings, profile?.bindings))
21
- .map(bindings => new Port(bindings));
22
- const hub = new Hub(ports, db.$catalog().metaBindings
23
- ?? options.metaBindings
24
- ?? makeMetaBindings());
25
- return new this(options.bindings, options.metaBindings, hub, db);
26
- }
27
- dispose = disposer();
28
- deviceSkins = new DeviceSkins();
29
- primaryDevice = new PrimaryDevice();
30
- overlayVisibility;
31
- constructor(baseBindings, baseMetaBindings, hub, db) {
32
- this.baseBindings = baseBindings;
33
- this.baseMetaBindings = baseMetaBindings;
34
- this.hub = hub;
35
- this.db = db;
36
- this.overlayVisibility = new OverlayVisibility(hub, this.deviceSkins);
37
- // meta reveal overlay
38
- this.dispose.schedule(hub.metaPort.actions[metaMode].revealOverlay.on(action => {
39
- if (action.pressed)
40
- this.overlayVisibility.bump();
41
- }));
42
- }
43
- get catalog() {
44
- return this.db.$catalog();
8
+ profiles;
9
+ settings;
10
+ #runtime = new Runtime();
11
+ constructor(options) {
12
+ this.settings = new Settings(options.store);
13
+ this.profiles = new Profiles(options.stockProfiles, this.settings.customProfiles);
14
+ }
15
+ async load() {
16
+ await this.settings.load();
17
+ for (const controller of this.#runtime.controllers.keys())
18
+ this.#applyControllerProfile(controller);
19
+ }
20
+ #save = debounce(100, () => this.settings.save());
21
+ get ports() {
22
+ return [...this.#runtime.ports];
23
+ }
24
+ get controllers() {
25
+ return [...this.#runtime.controllers];
26
+ }
27
+ get unassignedControllers() {
28
+ return [...this.#runtime.controllers]
29
+ .filter(controller => !this.#runtime.portAssignments.get(controller));
30
+ }
31
+ createPort() {
32
+ const port = new Port(this.#runtime);
33
+ this.#runtime.ports.add(port);
34
+ return port;
35
+ }
36
+ deletePort(port) {
37
+ for (const controller of port.controllers)
38
+ port.unplug(controller);
39
+ this.#runtime.ports.delete(port);
40
+ }
41
+ createController(handle, stockProfileKey, device) {
42
+ const profileKey = guarantee(this.settings.profileAssignments, handle, () => stockProfileKey);
43
+ const profile = this.profiles.get(profileKey);
44
+ const controller = new Controller(handle, profile.bindings, device);
45
+ this.#runtime.controllers.add(controller);
46
+ return controller;
47
+ }
48
+ deleteController(controller) {
49
+ this.#runtime.controllers.delete(controller);
50
+ this.#runtime.portAssignments.delete(controller);
51
+ }
52
+ async assignControllerProfile(controller, profileKey) {
53
+ this.settings.profileAssignments.set(controller.handle, profileKey);
54
+ this.#applyControllerProfile(controller);
55
+ await this.#save();
56
+ }
57
+ queryController(controller) {
58
+ const port = this.#runtime.portAssignments.get(controller);
59
+ const profileKey = this.settings.profileAssignments.get(controller.handle);
60
+ const profile = this.profiles.get(profileKey);
61
+ return { controller, port, profileKey, profile };
62
+ }
63
+ #applyControllerProfile(controller) {
64
+ const profileKey = this.settings.profileAssignments.get(controller.handle);
65
+ controller.bindings = this.profiles.get(profileKey).bindings;
45
66
  }
46
67
  }
47
68
  //# sourceMappingURL=deck.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deck.js","sourceRoot":"","sources":["../../s/deck/deck.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,WAAW,CAAA;AAEzC,OAAO,EAAC,EAAE,EAAC,MAAM,eAAe,CAAA;AAChC,OAAO,EAAC,GAAG,EAAC,MAAM,oBAAoB,CAAA;AACtC,OAAO,EAAC,IAAI,EAAC,MAAM,qBAAqB,CAAA;AAExC,OAAO,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAe,QAAQ,EAAC,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAC,WAAW,EAAC,MA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AAsB;QAC7C,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;QAC1E,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAA;IAC7D,CAAC;CACD"}
@@ -0,0 +1,12 @@
1
+ import { RMap } from "@e280/strata";
2
+ import { Profile, ProfileKey } from "../types.js";
3
+ export declare class Profiles {
4
+ custom: RMap<ProfileKey, Profile>;
5
+ stock: RMap<string, Profile>;
6
+ constructor(stock: Record<ProfileKey, Profile>, custom: RMap<ProfileKey, Profile>);
7
+ get all(): [string, Profile][];
8
+ normalizeKey(key?: ProfileKey): string;
9
+ get defaultId(): string;
10
+ get(key?: ProfileKey): Profile;
11
+ need(key: ProfileKey): Profile;
12
+ }
@@ -0,0 +1,31 @@
1
+ import { RMap } from "@e280/strata";
2
+ import { inserts, need } from "@e280/stz";
3
+ export class Profiles {
4
+ custom;
5
+ stock;
6
+ constructor(stock, custom) {
7
+ this.custom = custom;
8
+ this.stock = new RMap();
9
+ inserts(this.stock, Object.entries(stock));
10
+ if (this.stock.size === 0)
11
+ throw new Error("must be at least one stock profile");
12
+ }
13
+ get all() {
14
+ return [...this.stock, ...this.custom];
15
+ }
16
+ normalizeKey(key) {
17
+ return key && (this.stock.has(key) || this.custom.has(key))
18
+ ? key
19
+ : this.defaultId;
20
+ }
21
+ get defaultId() {
22
+ return [...this.stock.keys()][0];
23
+ }
24
+ get(key) {
25
+ return this.need(this.normalizeKey(key));
26
+ }
27
+ need(key) {
28
+ return this.stock.get(key) ?? need(this.custom, key);
29
+ }
30
+ }
31
+ //# sourceMappingURL=profiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../../s/deck/parts/profiles.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAA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strata";
2
+ import { Port } from "../port.js";
3
+ import { Controller } from "../controller.js";
4
+ export declare class Runtime {
5
+ ports: RSet<Port>;
6
+ controllers: RSet<Controller<import("../../index.js").Bindings, import("../../index.js").Device>>;
7
+ portAssignments: RMap<Controller<import("../../index.js").Bindings, import("../../index.js").Device>, Port | undefined>;
8
+ }
@@ -0,0 +1,7 @@
1
+ import { RMap, RSet } from "@e280/strata";
2
+ export class Runtime {
3
+ ports = new RSet();
4
+ controllers = new RSet();
5
+ portAssignments = new RMap();
6
+ }
7
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../s/deck/parts/runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAE,IAAI,EAAC,MAAM,cAAc,CAAA;AAIvC,MAAM,OAAO,OAAO;IACnB,KAAK,GAAG,IAAI,IAAI,EAAQ,CAAA;IACxB,WAAW,GAAG,IAAI,IAAI,EAAc,CAAA;IACpC,eAAe,GAAG,IAAI,IAAI,EAAgC,CAAA;CAC1D"}
@@ -0,0 +1,11 @@
1
+ import { RMap } from "@e280/strata";
2
+ import { Cubby } from "@e280/stz";
3
+ import { DeckState, Profile } from "../types.js";
4
+ export declare class Settings {
5
+ private store;
6
+ profileAssignments: RMap<string, string>;
7
+ customProfiles: RMap<string, Profile>;
8
+ constructor(store: Cubby<DeckState>);
9
+ save(): Promise<void>;
10
+ load(): Promise<void>;
11
+ }
@@ -0,0 +1,26 @@
1
+ import { RMap } from "@e280/strata";
2
+ import { inserts } from "@e280/stz";
3
+ import { shiftLimit } from "../../utils/shift-limit.js";
4
+ const limit = 256;
5
+ export class Settings {
6
+ store;
7
+ profileAssignments = new RMap();
8
+ customProfiles = new RMap();
9
+ constructor(store) {
10
+ this.store = store;
11
+ }
12
+ async save() {
13
+ await this.store.set({
14
+ customProfiles: shiftLimit(limit, [...this.customProfiles]),
15
+ profileAssignments: shiftLimit(limit, [...this.profileAssignments]),
16
+ });
17
+ }
18
+ async load() {
19
+ const state = await this.store.get();
20
+ this.customProfiles.clear();
21
+ this.profileAssignments.clear();
22
+ inserts(this.customProfiles, state?.customProfiles ?? []);
23
+ inserts(this.profileAssignments, state?.profileAssignments ?? []);
24
+ }
25
+ }
26
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../s/deck/parts/settings.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAA;AACjC,OAAO,EAAQ,OAAO,EAAC,MAAM,WAAW,CAAA;AACxC,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAA;AAGrD,MAAM,KAAK,GAAG,GAAG,CAAA;AAEjB,MAAM,OAAO,QAAQ;IAIA,KAAK;IAHzB,kBAAkB,GAAG,IAAI,IAAI,EAAgC,CAAA;IAC7D,cAAc,GAAG,IAAI,IAAI,EAAuB,CAAA;IAEhD,YAAoB,KAAuB;qBAAvB,KAAK;IAAqB,CAAC;IAE/C,KAAK,CAAC,IAAI;QACT,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;YACpB,cAAc,EAAE,UAAU,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC;YAC3D,kBAAkB,EAAE,UAAU,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,CAAC;SACnE,CAAC,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI;QACT,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAA;QACpC,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAA;QAC3B,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAA;QAC/B,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,cAAc,IAAI,EAAE,CAAC,CAAA;QACzD,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,KAAK,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAA;IAClE,CAAC;CACD"}
@@ -0,0 +1,10 @@
1
+ import { Runtime } from "./parts/runtime.js";
2
+ import { Controller } from "./controller.js";
3
+ export declare class Port {
4
+ #private;
5
+ constructor(runtime: Runtime);
6
+ get controllers(): Controller<import("../index.js").Bindings, import("../index.js").Device>[];
7
+ plug(controller: Controller): void;
8
+ unplug(controller: Controller): void;
9
+ resolveIntents(now: number): import("../index.js").Intent[];
10
+ }
package/x/deck/port.js ADDED
@@ -0,0 +1,24 @@
1
+ import { derived } from "@e280/strata";
2
+ export class Port {
3
+ #runtime;
4
+ #controllers;
5
+ constructor(runtime) {
6
+ this.#runtime = runtime;
7
+ this.#controllers = derived(() => [...this.#runtime.controllers]
8
+ .filter(controller => this.#runtime.portAssignments.get(controller) === this));
9
+ }
10
+ get controllers() {
11
+ return this.#controllers();
12
+ }
13
+ plug(controller) {
14
+ this.#runtime.portAssignments.set(controller, this);
15
+ }
16
+ unplug(controller) {
17
+ this.#runtime.portAssignments.delete(controller);
18
+ }
19
+ resolveIntents(now) {
20
+ return this.controllers
21
+ .flatMap(controller => controller.resolveIntents(now));
22
+ }
23
+ }
24
+ //# sourceMappingURL=port.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"port.js","sourceRoot":"","sources":["../../s/deck/port.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAA;AAIpC,MAAM,OAAO,IAAI;IAChB,QAAQ,CAAA;IACR,YAAY,CAAA;IAEZ,YAAY,OAAgB;QAC3B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACvB,IAAI,CAAC,YAAY,GAAG,OAAO,CAC1B,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;aAClC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,CAC9E,CAAA;IACF,CAAC;IAED,IAAI,WAAW;QACd,OAAO,IAAI,CAAC,YAAY,EAAE,CAAA;IAC3B,CAAC;IAED,IAAI,CAAC,UAAsB;QAC1B,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;IACpD,CAAC;IAED,MAAM,CAAC,UAAsB;QAC5B,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IACjD,CAAC;IAED,cAAc,CAAC,GAAW;QACzB,OAAO,IAAI,CAAC,WAAW;aACrB,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAA;IACxD,CAAC;CACD"}
@@ -0,0 +1,11 @@
1
+ import { Bindings } from "../core/types.js";
2
+ export type ProfileKey = string;
3
+ export type ControllerHandle = string;
4
+ export type Profile = {
5
+ label: string;
6
+ bindings: Bindings;
7
+ };
8
+ export type DeckState = {
9
+ customProfiles: [key: ProfileKey, profile: Profile][];
10
+ profileAssignments: [handle: ControllerHandle, key: ProfileKey][];
11
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../s/deck/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { Deck } from "../../deck/deck.js";
2
+ import { DeskOptions } from "../../ui/views/desk/view.js";
3
+ export declare const setupDemoApp: (deck: Deck, options?: DeskOptions) => new () => HTMLElement;
@@ -0,0 +1,13 @@
1
+ import { html } from "lit";
2
+ import { shadowElement, useCss } from "@e280/sly";
3
+ import styleCss from "./style.css.js";
4
+ import { DeskView } from "../../ui/views/desk/view.js";
5
+ export const setupDemoApp = (deck, options = {}) => shadowElement(() => {
6
+ useCss(styleCss);
7
+ return html `
8
+ <div class=plate>
9
+ ${DeskView(deck, options)}
10
+ </div>
11
+ `;
12
+ });
13
+ //# sourceMappingURL=element.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element.js","sourceRoot":"","sources":["../../../s/demo/demo-app/element.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAC,aAAa,EAAE,MAAM,EAAC,MAAM,WAAW,CAAA;AAC/C,OAAO,QAAQ,MAAM,gBAAgB,CAAA;AAErC,OAAO,EAAc,QAAQ,EAAC,MAAM,6BAA6B,CAAA;AAEjE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAU,EAAE,OAAO,GAAgB,EAAE,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE;IACzF,MAAM,CAAC,QAAQ,CAAC,CAAA;IAEhB,OAAO,IAAI,CAAA;;KAEP,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;;EAE1B,CAAA;AACF,CAAC,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { css } from "lit";
2
+ export default css `
3
+
4
+ .plate {
5
+ background: black;
6
+ }
7
+
8
+ `;
9
+ //# sourceMappingURL=style.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.css.js","sourceRoot":"","sources":["../../../s/demo/demo-app/style.css.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAA;AACvB,eAAe,GAAG,CAAA;;;;;;CAMjB,CAAA"}
@@ -1,7 +1,55 @@
1
1
  import { dom } from "@e280/sly";
2
- import { Game } from "./game/game.js";
3
- import { DemoTheater } from "./ui/theater/view.js";
4
- const game = await Game.load();
5
- dom.render(dom("#demo-theater"), DemoTheater(game));
6
- console.log("🎮 tact");
2
+ import { LocalStore } from "@e280/strata";
3
+ import { Deck } from "../deck/deck.js";
4
+ import { asBindings } from "../core/types.js";
5
+ import { Devices } from "../device/devices.js";
6
+ import { onPad } from "../device/pad/on-pad.js";
7
+ import { PointerDevice } from "../device/pointer.js";
8
+ import { GamepadDevice } from "../device/gamepad.js";
9
+ import { setupDemoApp } from "./demo-app/element.js";
10
+ import { KeyboardDevice } from "../device/keyboard.js";
11
+ const bindings = asBindings({
12
+ play: {
13
+ action: ["or", "Space", "pointer.button.left", "gamepad.button.1"],
14
+ up: ["or", "KeyW", "gamepad.axis.2.pos"],
15
+ down: ["or", "KeyS", "gamepad.axis.2.neg"],
16
+ left: ["or", "KeyA", "gamepad.axis.1.pos"],
17
+ right: ["or", "KeyD", "gamepad.axis.1.neg"],
18
+ },
19
+ });
20
+ const store = new LocalStore("tactDeck");
21
+ const deck = new Deck({
22
+ store,
23
+ stockProfiles: {
24
+ standard: { label: "📜standard", bindings },
25
+ micro: { label: "🦠micro", bindings: asBindings({
26
+ play: {
27
+ action: ["or", "Space", "pointer.button.left", "gamepad.button.1"],
28
+ up: ["or", "KeyW", "gamepad.axis.2.pos"],
29
+ down: ["or", "KeyS", "gamepad.axis.2.neg"],
30
+ left: ["or", "KeyA", "gamepad.axis.1.pos"],
31
+ right: ["or", "KeyD", "gamepad.axis.1.neg"],
32
+ },
33
+ }) },
34
+ },
35
+ });
36
+ await deck.load();
37
+ store.onStorageEvent(() => deck.load());
38
+ const port = deck.createPort();
39
+ const controller = deck.createController("primary", "standard", new Devices(new KeyboardDevice(), new PointerDevice()));
40
+ port.plug(controller);
41
+ const labels = new Map()
42
+ .set(controller, "⌨️🖱keyboard+mouse");
43
+ onPad(pad => {
44
+ const handle = `(${pad.gamepad.index + 1}) ${pad.gamepad.id}`;
45
+ const controller = deck.createController(handle, "standard", new GamepadDevice(pad));
46
+ labels.set(controller, `🎮${handle}`);
47
+ port.plug(controller);
48
+ return () => deck.deleteController(controller);
49
+ });
50
+ dom.register({
51
+ DemoApp: setupDemoApp(deck, {
52
+ getControllerLabel: labels.get.bind(labels),
53
+ }),
54
+ });
7
55
  //# sourceMappingURL=main.bundle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"main.bundle.js","sourceRoot":"","sources":["../../s/demo/main.bundle.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,WAAW,CAAA;AAC7B,OAAO,EAAC,IAAI,EAAC,MAAM,gBAAgB,CAAA;AACnC,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAA;AAEhD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAA;AAE9B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,CAAA;AAEnD,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA"}
1
+ {"version":3,"file":"main.bundle.js","sourceRoot":"","sources":["../../s/demo/main.bundle.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,GAAG,EAAC,MAAM,WAAW,CAAA;AACtC,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AAEvC,OAAO,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAA;AAEpC,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAA;AAC5C,OAAO,EAAC,KAAK,EAAC,MAAM,yBAAyB,CAAA;AAE7C,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAA;AAEpD,MAAM,QAAQ,GAAG,UAAU,CAAC;IAC3B,IAAI,EAAE;QACL,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,CAAC;QAClE,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,oBAAoB,CAAC;QACxC,IAAI,EAAE,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