ttpg-darrell 1.0.39 → 1.0.40

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 (230) hide show
  1. package/build/cjs/lib/event/throttle-click-handler.d.ts +1 -1
  2. package/build/cjs/lib/event/throttle-click-handler.js +1 -1
  3. package/build/cjs/lib/find/find.d.ts +3 -0
  4. package/build/cjs/lib/find/find.js +31 -0
  5. package/build/cjs/lib/find/find.js.map +1 -1
  6. package/build/cjs/test.js +12 -0
  7. package/build/cjs/test.js.map +1 -0
  8. package/build/esm/lib/find/find.d.ts +3 -0
  9. package/build/esm/lib/find/find.js +31 -0
  10. package/build/esm/lib/find/find.js.map +1 -1
  11. package/package.json +1 -1
  12. package/build/cjs/lib/game-object/dice-snap-rotation/dice-snap-rotation-obj.js +0 -6
  13. package/build/cjs/lib/game-object/dice-snap-rotation/dice-snap-rotation-obj.js.map +0 -1
  14. package/build/cjs/lib/game-object/dice-snap-rotation/dice-snap-rotation.d.ts +0 -7
  15. package/build/cjs/lib/game-object/dice-snap-rotation/dice-snap-rotation.js +0 -27
  16. package/build/cjs/lib/game-object/dice-snap-rotation/dice-snap-rotation.js.map +0 -1
  17. package/build/esm/lib/game-object/dice-snap-rotation/dice-snap-rotation-obj.d.ts +0 -1
  18. package/build/esm/lib/game-object/dice-snap-rotation/dice-snap-rotation-obj.js +0 -4
  19. package/build/esm/lib/game-object/dice-snap-rotation/dice-snap-rotation-obj.js.map +0 -1
  20. package/build/esm/lib/game-object/dice-snap-rotation/dice-snap-rotation.d.ts +0 -4
  21. package/build/esm/lib/game-object/dice-snap-rotation/dice-snap-rotation.js +0 -20
  22. package/build/esm/lib/game-object/dice-snap-rotation/dice-snap-rotation.js.map +0 -1
  23. package/build/module_type_should_override_this/index.d.ts +0 -54
  24. package/build/module_type_should_override_this/index.js +0 -55
  25. package/build/module_type_should_override_this/index.js.map +0 -1
  26. package/build/module_type_should_override_this/lib/adjacency/adjacency.d.ts +0 -61
  27. package/build/module_type_should_override_this/lib/adjacency/adjacency.js +0 -212
  28. package/build/module_type_should_override_this/lib/adjacency/adjacency.js.map +0 -1
  29. package/build/module_type_should_override_this/lib/broadcast/broadcast.d.ts +0 -9
  30. package/build/module_type_should_override_this/lib/broadcast/broadcast.js +0 -42
  31. package/build/module_type_should_override_this/lib/broadcast/broadcast.js.map +0 -1
  32. package/build/module_type_should_override_this/lib/bug-workarounds/bug-card-holder-assignment.d.ts +0 -8
  33. package/build/module_type_should_override_this/lib/bug-workarounds/bug-card-holder-assignment.js +0 -10
  34. package/build/module_type_should_override_this/lib/bug-workarounds/bug-card-holder-assignment.js.map +0 -1
  35. package/build/module_type_should_override_this/lib/bug-workarounds/bug-unique-cards.d.ts +0 -8
  36. package/build/module_type_should_override_this/lib/bug-workarounds/bug-unique-cards.js +0 -10
  37. package/build/module_type_should_override_this/lib/bug-workarounds/bug-unique-cards.js.map +0 -1
  38. package/build/module_type_should_override_this/lib/card-util/card-util.d.ts +0 -45
  39. package/build/module_type_should_override_this/lib/card-util/card-util.js +0 -173
  40. package/build/module_type_should_override_this/lib/card-util/card-util.js.map +0 -1
  41. package/build/module_type_should_override_this/lib/context-menu/abstract-right-click-card.d.ts +0 -17
  42. package/build/module_type_should_override_this/lib/context-menu/abstract-right-click-card.js +0 -36
  43. package/build/module_type_should_override_this/lib/context-menu/abstract-right-click-card.js.map +0 -1
  44. package/build/module_type_should_override_this/lib/context-menu/abstract-right-click-deck.d.ts +0 -19
  45. package/build/module_type_should_override_this/lib/context-menu/abstract-right-click-deck.js +0 -42
  46. package/build/module_type_should_override_this/lib/context-menu/abstract-right-click-deck.js.map +0 -1
  47. package/build/module_type_should_override_this/lib/context-menu/leave-seat.d.ts +0 -19
  48. package/build/module_type_should_override_this/lib/context-menu/leave-seat.js +0 -47
  49. package/build/module_type_should_override_this/lib/context-menu/leave-seat.js.map +0 -1
  50. package/build/module_type_should_override_this/lib/data-store/data-store.d.ts +0 -104
  51. package/build/module_type_should_override_this/lib/data-store/data-store.js +0 -392
  52. package/build/module_type_should_override_this/lib/data-store/data-store.js.map +0 -1
  53. package/build/module_type_should_override_this/lib/dice-group/dice-group-testp.d.ts +0 -1
  54. package/build/module_type_should_override_this/lib/dice-group/dice-group-testp.js +0 -37
  55. package/build/module_type_should_override_this/lib/dice-group/dice-group-testp.js.map +0 -1
  56. package/build/module_type_should_override_this/lib/dice-group/dice-group.d.ts +0 -83
  57. package/build/module_type_should_override_this/lib/dice-group/dice-group.js +0 -247
  58. package/build/module_type_should_override_this/lib/dice-group/dice-group.js.map +0 -1
  59. package/build/module_type_should_override_this/lib/error-handler/bugsplat-remote-reporter.d.ts +0 -21
  60. package/build/module_type_should_override_this/lib/error-handler/bugsplat-remote-reporter.js +0 -54
  61. package/build/module_type_should_override_this/lib/error-handler/bugsplat-remote-reporter.js.map +0 -1
  62. package/build/module_type_should_override_this/lib/error-handler/error-batcher.d.ts +0 -11
  63. package/build/module_type_should_override_this/lib/error-handler/error-batcher.js +0 -50
  64. package/build/module_type_should_override_this/lib/error-handler/error-batcher.js.map +0 -1
  65. package/build/module_type_should_override_this/lib/error-handler/error-handler.d.ts +0 -43
  66. package/build/module_type_should_override_this/lib/error-handler/error-handler.js +0 -234
  67. package/build/module_type_should_override_this/lib/error-handler/error-handler.js.map +0 -1
  68. package/build/module_type_should_override_this/lib/error-handler/error-handler.testp.d.ts +0 -4
  69. package/build/module_type_should_override_this/lib/error-handler/error-handler.testp.js +0 -13
  70. package/build/module_type_should_override_this/lib/error-handler/error-handler.testp.js.map +0 -1
  71. package/build/module_type_should_override_this/lib/event/on-card-became-singleton-or-deck.d.ts +0 -30
  72. package/build/module_type_should_override_this/lib/event/on-card-became-singleton-or-deck.js +0 -99
  73. package/build/module_type_should_override_this/lib/event/on-card-became-singleton-or-deck.js.map +0 -1
  74. package/build/module_type_should_override_this/lib/event/on-card-became-singleton-or-deck.testp.d.ts +0 -1
  75. package/build/module_type_should_override_this/lib/event/on-card-became-singleton-or-deck.testp.js +0 -13
  76. package/build/module_type_should_override_this/lib/event/on-card-became-singleton-or-deck.testp.js.map +0 -1
  77. package/build/module_type_should_override_this/lib/event/throttle-click-handler.d.ts +0 -9
  78. package/build/module_type_should_override_this/lib/event/throttle-click-handler.js +0 -24
  79. package/build/module_type_should_override_this/lib/event/throttle-click-handler.js.map +0 -1
  80. package/build/module_type_should_override_this/lib/event/triggerable-multicast-delegate.d.ts +0 -30
  81. package/build/module_type_should_override_this/lib/event/triggerable-multicast-delegate.js +0 -53
  82. package/build/module_type_should_override_this/lib/event/triggerable-multicast-delegate.js.map +0 -1
  83. package/build/module_type_should_override_this/lib/facing/facing.d.ts +0 -4
  84. package/build/module_type_should_override_this/lib/facing/facing.js +0 -15
  85. package/build/module_type_should_override_this/lib/facing/facing.js.map +0 -1
  86. package/build/module_type_should_override_this/lib/find/find.d.ts +0 -19
  87. package/build/module_type_should_override_this/lib/find/find.js +0 -152
  88. package/build/module_type_should_override_this/lib/find/find.js.map +0 -1
  89. package/build/module_type_should_override_this/lib/game-object/cardholder-player-name/cardholder-player-name-obj.d.ts +0 -1
  90. package/build/module_type_should_override_this/lib/game-object/cardholder-player-name/cardholder-player-name-obj.js +0 -10
  91. package/build/module_type_should_override_this/lib/game-object/cardholder-player-name/cardholder-player-name-obj.js.map +0 -1
  92. package/build/module_type_should_override_this/lib/game-object/cardholder-player-name/cardholder-player-name.d.ts +0 -19
  93. package/build/module_type_should_override_this/lib/game-object/cardholder-player-name/cardholder-player-name.js +0 -101
  94. package/build/module_type_should_override_this/lib/game-object/cardholder-player-name/cardholder-player-name.js.map +0 -1
  95. package/build/module_type_should_override_this/lib/game-object/deleted-items-container/deleted-items-container-obj.d.ts +0 -1
  96. package/build/module_type_should_override_this/lib/game-object/deleted-items-container/deleted-items-container-obj.js +0 -5
  97. package/build/module_type_should_override_this/lib/game-object/deleted-items-container/deleted-items-container-obj.js.map +0 -1
  98. package/build/module_type_should_override_this/lib/game-object/deleted-items-container/deleted-items-container.d.ts +0 -24
  99. package/build/module_type_should_override_this/lib/game-object/deleted-items-container/deleted-items-container.js +0 -91
  100. package/build/module_type_should_override_this/lib/game-object/deleted-items-container/deleted-items-container.js.map +0 -1
  101. package/build/module_type_should_override_this/lib/game-object/garbage/garbage-container-obj.d.ts +0 -1
  102. package/build/module_type_should_override_this/lib/game-object/garbage/garbage-container-obj.js +0 -4
  103. package/build/module_type_should_override_this/lib/game-object/garbage/garbage-container-obj.js.map +0 -1
  104. package/build/module_type_should_override_this/lib/game-object/garbage/garbage-container.d.ts +0 -43
  105. package/build/module_type_should_override_this/lib/game-object/garbage/garbage-container.js +0 -116
  106. package/build/module_type_should_override_this/lib/game-object/garbage/garbage-container.js.map +0 -1
  107. package/build/module_type_should_override_this/lib/game-object/garbage/simple-card-garbage-handler.d.ts +0 -20
  108. package/build/module_type_should_override_this/lib/game-object/garbage/simple-card-garbage-handler.js +0 -100
  109. package/build/module_type_should_override_this/lib/game-object/garbage/simple-card-garbage-handler.js.map +0 -1
  110. package/build/module_type_should_override_this/lib/game-object/garbage/simple-to-container-handler.d.ts +0 -16
  111. package/build/module_type_should_override_this/lib/game-object/garbage/simple-to-container-handler.js +0 -44
  112. package/build/module_type_should_override_this/lib/game-object/garbage/simple-to-container-handler.js.map +0 -1
  113. package/build/module_type_should_override_this/lib/game-object/garbage/simple-to-snap-point-handler.d.ts +0 -19
  114. package/build/module_type_should_override_this/lib/game-object/garbage/simple-to-snap-point-handler.js +0 -50
  115. package/build/module_type_should_override_this/lib/game-object/garbage/simple-to-snap-point-handler.js.map +0 -1
  116. package/build/module_type_should_override_this/lib/global/global-init.d.ts +0 -10
  117. package/build/module_type_should_override_this/lib/global/global-init.js +0 -20
  118. package/build/module_type_should_override_this/lib/global/global-init.js.map +0 -1
  119. package/build/module_type_should_override_this/lib/global/i-global.d.ts +0 -3
  120. package/build/module_type_should_override_this/lib/global/i-global.js +0 -2
  121. package/build/module_type_should_override_this/lib/global/i-global.js.map +0 -1
  122. package/build/module_type_should_override_this/lib/heap/heap.d.ts +0 -8
  123. package/build/module_type_should_override_this/lib/heap/heap.js +0 -109
  124. package/build/module_type_should_override_this/lib/heap/heap.js.map +0 -1
  125. package/build/module_type_should_override_this/lib/layout-objects/layout-objects.d.ts +0 -49
  126. package/build/module_type_should_override_this/lib/layout-objects/layout-objects.js +0 -257
  127. package/build/module_type_should_override_this/lib/layout-objects/layout-objects.js.map +0 -1
  128. package/build/module_type_should_override_this/lib/locale/locale.d.ts +0 -8
  129. package/build/module_type_should_override_this/lib/locale/locale.js +0 -48
  130. package/build/module_type_should_override_this/lib/locale/locale.js.map +0 -1
  131. package/build/module_type_should_override_this/lib/namespace-id/namespace-id.d.ts +0 -1
  132. package/build/module_type_should_override_this/lib/namespace-id/namespace-id.js +0 -2
  133. package/build/module_type_should_override_this/lib/namespace-id/namespace-id.js.map +0 -1
  134. package/build/module_type_should_override_this/lib/nsid/nsid.d.ts +0 -54
  135. package/build/module_type_should_override_this/lib/nsid/nsid.js +0 -86
  136. package/build/module_type_should_override_this/lib/nsid/nsid.js.map +0 -1
  137. package/build/module_type_should_override_this/lib/parse/parse-color.d.ts +0 -7
  138. package/build/module_type_should_override_this/lib/parse/parse-color.js +0 -43
  139. package/build/module_type_should_override_this/lib/parse/parse-color.js.map +0 -1
  140. package/build/module_type_should_override_this/lib/perf/perf.d.ts +0 -29
  141. package/build/module_type_should_override_this/lib/perf/perf.js +0 -93
  142. package/build/module_type_should_override_this/lib/perf/perf.js.map +0 -1
  143. package/build/module_type_should_override_this/lib/setup/abstract-setup.d.ts +0 -18
  144. package/build/module_type_should_override_this/lib/setup/abstract-setup.js +0 -22
  145. package/build/module_type_should_override_this/lib/setup/abstract-setup.js.map +0 -1
  146. package/build/module_type_should_override_this/lib/shuffle/shuffle.d.ts +0 -7
  147. package/build/module_type_should_override_this/lib/shuffle/shuffle.js +0 -26
  148. package/build/module_type_should_override_this/lib/shuffle/shuffle.js.map +0 -1
  149. package/build/module_type_should_override_this/lib/spawn/spawn.d.ts +0 -21
  150. package/build/module_type_should_override_this/lib/spawn/spawn.js +0 -116
  151. package/build/module_type_should_override_this/lib/spawn/spawn.js.map +0 -1
  152. package/build/module_type_should_override_this/lib/svg/svg-sparkline.d.ts +0 -12
  153. package/build/module_type_should_override_this/lib/svg/svg-sparkline.js +0 -40
  154. package/build/module_type_should_override_this/lib/svg/svg-sparkline.js.map +0 -1
  155. package/build/module_type_should_override_this/lib/turn-order/turn-order.d.ts +0 -51
  156. package/build/module_type_should_override_this/lib/turn-order/turn-order.js +0 -200
  157. package/build/module_type_should_override_this/lib/turn-order/turn-order.js.map +0 -1
  158. package/build/module_type_should_override_this/lib/ui/screen-test.d.ts +0 -1
  159. package/build/module_type_should_override_this/lib/ui/screen-test.js +0 -20
  160. package/build/module_type_should_override_this/lib/ui/screen-test.js.map +0 -1
  161. package/build/module_type_should_override_this/lib/ui-visibility/ui-visibility.d.ts +0 -17
  162. package/build/module_type_should_override_this/lib/ui-visibility/ui-visibility.js +0 -65
  163. package/build/module_type_should_override_this/lib/ui-visibility/ui-visibility.js.map +0 -1
  164. package/build/module_type_should_override_this/lib/whisper-reporter/whisper-reporter-locale.data.d.ts +0 -3
  165. package/build/module_type_should_override_this/lib/whisper-reporter/whisper-reporter-locale.data.js +0 -4
  166. package/build/module_type_should_override_this/lib/whisper-reporter/whisper-reporter-locale.data.js.map +0 -1
  167. package/build/module_type_should_override_this/lib/whisper-reporter/whisper-reporter.d.ts +0 -5
  168. package/build/module_type_should_override_this/lib/whisper-reporter/whisper-reporter.js +0 -25
  169. package/build/module_type_should_override_this/lib/whisper-reporter/whisper-reporter.js.map +0 -1
  170. package/build/module_type_should_override_this/lib/widget/confirm-button/confirm-button.d.ts +0 -2
  171. package/build/module_type_should_override_this/lib/widget/confirm-button/confirm-button.js +0 -3
  172. package/build/module_type_should_override_this/lib/widget/confirm-button/confirm-button.js.map +0 -1
  173. package/build/module_type_should_override_this/lib/widget/d6widget/d6widget.d.ts +0 -48
  174. package/build/module_type_should_override_this/lib/widget/d6widget/d6widget.js +0 -84
  175. package/build/module_type_should_override_this/lib/widget/d6widget/d6widget.js.map +0 -1
  176. package/build/module_type_should_override_this/lib/widget/end-turn-button/end-turn-button.d.ts +0 -35
  177. package/build/module_type_should_override_this/lib/widget/end-turn-button/end-turn-button.js +0 -109
  178. package/build/module_type_should_override_this/lib/widget/end-turn-button/end-turn-button.js.map +0 -1
  179. package/build/module_type_should_override_this/lib/widget/end-turn-button/end-turn-button.testp.d.ts +0 -1
  180. package/build/module_type_should_override_this/lib/widget/end-turn-button/end-turn-button.testp.js +0 -10
  181. package/build/module_type_should_override_this/lib/widget/end-turn-button/end-turn-button.testp.js.map +0 -1
  182. package/build/module_type_should_override_this/lib/widget/end-turn-button/end-turn-locale.data.d.ts +0 -3
  183. package/build/module_type_should_override_this/lib/widget/end-turn-button/end-turn-locale.data.js +0 -4
  184. package/build/module_type_should_override_this/lib/widget/end-turn-button/end-turn-locale.data.js.map +0 -1
  185. package/build/module_type_should_override_this/lib/widget/hot-seat-button/hot-seat-button.d.ts +0 -28
  186. package/build/module_type_should_override_this/lib/widget/hot-seat-button/hot-seat-button.js +0 -99
  187. package/build/module_type_should_override_this/lib/widget/hot-seat-button/hot-seat-button.js.map +0 -1
  188. package/build/module_type_should_override_this/lib/widget/hot-seat-button/hot-seat-button.testp.d.ts +0 -1
  189. package/build/module_type_should_override_this/lib/widget/hot-seat-button/hot-seat-button.testp.js +0 -10
  190. package/build/module_type_should_override_this/lib/widget/hot-seat-button/hot-seat-button.testp.js.map +0 -1
  191. package/build/module_type_should_override_this/lib/widget/hot-seat-button/hot-seat-locale.data.d.ts +0 -3
  192. package/build/module_type_should_override_this/lib/widget/hot-seat-button/hot-seat-locale.data.js +0 -5
  193. package/build/module_type_should_override_this/lib/widget/hot-seat-button/hot-seat-locale.data.js.map +0 -1
  194. package/build/module_type_should_override_this/lib/widget/perf-widget/perf-widget-locale.data.d.ts +0 -3
  195. package/build/module_type_should_override_this/lib/widget/perf-widget/perf-widget-locale.data.js +0 -4
  196. package/build/module_type_should_override_this/lib/widget/perf-widget/perf-widget-locale.data.js.map +0 -1
  197. package/build/module_type_should_override_this/lib/widget/perf-widget/perf-widget.d.ts +0 -19
  198. package/build/module_type_should_override_this/lib/widget/perf-widget/perf-widget.js +0 -74
  199. package/build/module_type_should_override_this/lib/widget/perf-widget/perf-widget.js.map +0 -1
  200. package/build/module_type_should_override_this/lib/widget/perf-widget/perf-widget.testp.d.ts +0 -1
  201. package/build/module_type_should_override_this/lib/widget/perf-widget/perf-widget.testp.js +0 -5
  202. package/build/module_type_should_override_this/lib/widget/perf-widget/perf-widget.testp.js.map +0 -1
  203. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-clicked-widget.d.ts +0 -22
  204. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-clicked-widget.js +0 -136
  205. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-clicked-widget.js.map +0 -1
  206. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-entry-wart.d.ts +0 -16
  207. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-entry-wart.js +0 -7
  208. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-entry-wart.js.map +0 -1
  209. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-entry-widget.d.ts +0 -29
  210. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-entry-widget.js +0 -131
  211. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-entry-widget.js.map +0 -1
  212. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-order-locale.data.d.ts +0 -3
  213. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-order-locale.data.js +0 -13
  214. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-order-locale.data.js.map +0 -1
  215. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-order-widget-params.d.ts +0 -33
  216. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-order-widget-params.js +0 -6
  217. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-order-widget-params.js.map +0 -1
  218. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-order-widget.d.ts +0 -25
  219. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-order-widget.js +0 -99
  220. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-order-widget.js.map +0 -1
  221. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-order-widget.testp.d.ts +0 -1
  222. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-order-widget.testp.js +0 -58
  223. package/build/module_type_should_override_this/lib/widget/turn-order-widget/turn-order-widget.testp.js.map +0 -1
  224. package/build/module_type_should_override_this/lib-ext/image-table.d.ts +0 -1
  225. package/build/module_type_should_override_this/lib-ext/image-table.js +0 -9
  226. package/build/module_type_should_override_this/lib-ext/image-table.js.map +0 -1
  227. package/build/module_type_should_override_this/locale.data.d.ts +0 -4
  228. package/build/module_type_should_override_this/locale.data.js +0 -5
  229. package/build/module_type_should_override_this/locale.data.js.map +0 -1
  230. /package/build/cjs/{lib/game-object/dice-snap-rotation/dice-snap-rotation-obj.d.ts → test.d.ts} +0 -0
@@ -1,100 +0,0 @@
1
- import { Card } from "@tabletop-playground/api";
2
- import { NSID } from "../../nsid/nsid";
3
- import { Find } from "../../find/find";
4
- /**
5
- * Recycle cards to a specific snap point on a mat.
6
- * Add to any deck already there, or start a new deck.
7
- * Optionally shuffle after discard.
8
- */
9
- export class SimpleCardGarbageHandler {
10
- constructor() {
11
- this._find = new Find();
12
- this._cardNsidPrefix = "";
13
- this._snapPointTag = "";
14
- this._faceUp = false;
15
- this._shuffleAfterDiscard = false;
16
- }
17
- setCardNsidPrefix(cardNsidPrefix) {
18
- this._cardNsidPrefix = cardNsidPrefix;
19
- return this;
20
- }
21
- setSnapPointTag(tag) {
22
- this._snapPointTag = tag;
23
- return this;
24
- }
25
- setFaceUp(value) {
26
- this._faceUp = value;
27
- return this;
28
- }
29
- setShuffleAfterDiscard(shuffle) {
30
- this._shuffleAfterDiscard = shuffle;
31
- return this;
32
- }
33
- // --------------------------------
34
- canRecycle(obj) {
35
- if (!(obj instanceof Card)) {
36
- return false;
37
- }
38
- if (obj.getStackSize() !== 1) {
39
- return false;
40
- }
41
- const nsid = NSID.get(obj);
42
- return (this._cardNsidPrefix.length > 0 &&
43
- nsid.startsWith(this._cardNsidPrefix));
44
- }
45
- recycle(obj) {
46
- // Verify card.
47
- if (!(obj instanceof Card)) {
48
- throw new Error("not a card");
49
- }
50
- if (obj.getStackSize() !== 1) {
51
- throw new Error("not singleton card");
52
- }
53
- const nsid = NSID.get(obj);
54
- if (!nsid.startsWith(this._cardNsidPrefix)) {
55
- throw new Error("nsid mismatch");
56
- }
57
- // Find snap point.
58
- const snapPoint = this._find.findSnapPointByTag(this._snapPointTag);
59
- if (!snapPoint) {
60
- return false;
61
- }
62
- // Find discard deck.
63
- let deck = snapPoint.getSnappedObject();
64
- if (deck && !(deck instanceof Card)) {
65
- deck = undefined;
66
- }
67
- // Discard.
68
- let success = true;
69
- if (deck) {
70
- let offset = 0;
71
- // "shuffle after discard" is a bit tricky because the card does not
72
- // get added to the deck until after the discard animation finishes.
73
- // Instead of doing it in order, shuffle now and discard to a random
74
- // offset inside that shuffled deck.
75
- if (this._shuffleAfterDiscard) {
76
- deck.shuffle();
77
- offset = Math.floor(Math.random() * deck.getStackSize());
78
- }
79
- const toFront = true;
80
- const animate = true;
81
- const flipped = false;
82
- success = deck.addCards(obj, toFront, offset, animate, flipped);
83
- }
84
- else {
85
- const above = snapPoint.getGlobalPosition().add([0, 0, 10]);
86
- const animationSpeed = 0;
87
- obj.setPosition(above, animationSpeed);
88
- // Orient when starting a new discard pile.
89
- if (obj.isFaceUp() !== this._faceUp) {
90
- // Apply instant rotation, flip method animates.
91
- const rot = obj.getRotation().compose([0, 0, 180]);
92
- obj.setRotation(rot);
93
- }
94
- obj.snapToGround();
95
- obj.snap(); // apply snap point rotation
96
- }
97
- return success;
98
- }
99
- }
100
- //# sourceMappingURL=simple-card-garbage-handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"simple-card-garbage-handler.js","sourceRoot":"","sources":["../../../../../src/lib/game-object/garbage/simple-card-garbage-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,IAAI,EAAa,MAAM,0BAA0B,CAAC;AAEvE,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC;;;;GAIG;AACH,MAAM,OAAO,wBAAwB;IAArC;QACqB,UAAK,GAAS,IAAI,IAAI,EAAE,CAAC;QAClC,oBAAe,GAAW,EAAE,CAAC;QAC7B,kBAAa,GAAW,EAAE,CAAC;QAC3B,YAAO,GAAY,KAAK,CAAC;QACzB,yBAAoB,GAAY,KAAK,CAAC;IAqGlD,CAAC;IAnGU,iBAAiB,CAAC,cAAsB;QAC3C,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,eAAe,CAAC,GAAW;QAC9B,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC;QACzB,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,SAAS,CAAC,KAAc;QAC3B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,sBAAsB,CAAC,OAAgB;QAC1C,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC;QACpC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,mCAAmC;IAE5B,UAAU,CAAC,GAAe;QAC7B,IAAI,CAAC,CAAC,GAAG,YAAY,IAAI,CAAC,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,IAAI,GAAG,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,MAAM,IAAI,GAAG,IAA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AC;gBAC5B,IAAI,CAAC,OAAO,EAAE,CAAC;gBACf,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;YAC7D,CAAC;YAED,MAAM,OAAO,GAAG,IAAI,CAAC;YACrB,MAAM,OAAO,GAAG,IAAI,CAAC;YACrB,MAAM,OAAO,GAAG,KAAK,CAAC;YACtB,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACpE,CAAC;aAAM,CAAC;YACJ,MAAM,KAAK,GAAG,SAAS,CAAC,iBAAiB,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;YAC5D,MAAM,cAAc,GAAW,CAAC,CAAC;YACjC,GAAG,CAAC,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;YAEvC,2CAA2C;YAC3C,IAAI,GAAG,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;gBAClC,gDAAgD;gBAChD,MAAM,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;gBACnD,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;YACzB,CAAC;YAED,GAAG,CAAC,YAAY,EAAE,CAAC;YACnB,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,4BAA4B;QAC5C,CAAC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ"}
@@ -1,16 +0,0 @@
1
- import { GameObject } from "@tabletop-playground/api";
2
- import { GarbageHandler } from "./garbage-container";
3
- /**
4
- * Recycle object(s) to a container, optionally matching owning slot.
5
- */
6
- export declare class SimpleToContainerHandler implements GarbageHandler {
7
- private readonly _recycleObjectNsids;
8
- private readonly _find;
9
- private _requirePlayerSlot;
10
- private _containerNsid;
11
- addRecycleObjectNsid(nsid: string): this;
12
- setContainerNsid(nsid: string): this;
13
- setRequireOwningPlayerSlot(value: boolean): this;
14
- canRecycle(obj: GameObject): boolean;
15
- recycle(obj: GameObject): boolean;
16
- }
@@ -1,44 +0,0 @@
1
- import { NSID } from "../../nsid/nsid";
2
- import { Find } from "../../find/find";
3
- /**
4
- * Recycle object(s) to a container, optionally matching owning slot.
5
- */
6
- export class SimpleToContainerHandler {
7
- constructor() {
8
- this._recycleObjectNsids = new Set();
9
- this._find = new Find();
10
- this._requirePlayerSlot = false;
11
- this._containerNsid = "";
12
- }
13
- addRecycleObjectNsid(nsid) {
14
- this._recycleObjectNsids.add(nsid);
15
- return this;
16
- }
17
- setContainerNsid(nsid) {
18
- this._containerNsid = nsid;
19
- return this;
20
- }
21
- setRequireOwningPlayerSlot(value) {
22
- this._requirePlayerSlot = value;
23
- return this;
24
- }
25
- // --------------------------------
26
- canRecycle(obj) {
27
- const nsid = NSID.get(obj);
28
- return this._recycleObjectNsids.has(nsid);
29
- }
30
- recycle(obj) {
31
- const playerSlot = this._requirePlayerSlot
32
- ? obj.getOwningPlayerSlot()
33
- : undefined;
34
- const container = this._find.findContainer(this._containerNsid, playerSlot);
35
- if (container) {
36
- const index = 0;
37
- const showAnimation = true;
38
- container.addObjects([obj], index, showAnimation);
39
- return true;
40
- }
41
- return false;
42
- }
43
- }
44
- //# sourceMappingURL=simple-to-container-handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"simple-to-container-handler.js","sourceRoot":"","sources":["../../../../../src/lib/game-object/garbage/simple-to-container-handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC;;GAEG;AACH,MAAM,OAAO,wBAAwB;IAArC;QACqB,wBAAmB,GAAgB,IAAI,GAAG,EAA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bageHandler } from "./garbage-container";
3
- import { Rotator } from "ttpg-mock";
4
- /**
5
- * Recycle an object to a specific snap point with the matching tag.
6
- * Requires snap point not already occupied.
7
- * Expects snap point is unique; does not look beyond first match.
8
- */
9
- export declare class SimpleToSnapPointHandler implements GarbageHandler {
10
- private readonly _recycleObjectNsids;
11
- private readonly _find;
12
- private _snapPointTag;
13
- private _preSnapRotation;
14
- addRecycleObjectNsid(nsid: string): this;
15
- setSnapPointTag(tag: string): this;
16
- setPreSnapRotation(rot: Rotator | [pitch: number, yaw: number, roll: number]): this;
17
- canRecycle(obj: GameObject): boolean;
18
- recycle(obj: GameObject): boolean;
19
- }
@@ -1,50 +0,0 @@
1
- import { NSID } from "../../nsid/nsid";
2
- import { Find } from "../../find/find";
3
- /**
4
- * Recycle an object to a specific snap point with the matching tag.
5
- * Requires snap point not already occupied.
6
- * Expects snap point is unique; does not look beyond first match.
7
- */
8
- export class SimpleToSnapPointHandler {
9
- constructor() {
10
- this._recycleObjectNsids = new Set();
11
- this._find = new Find();
12
- this._snapPointTag = "";
13
- }
14
- addRecycleObjectNsid(nsid) {
15
- this._recycleObjectNsids.add(nsid);
16
- return this;
17
- }
18
- setSnapPointTag(tag) {
19
- this._snapPointTag = tag;
20
- return this;
21
- }
22
- setPreSnapRotation(rot) {
23
- this._preSnapRotation = rot;
24
- return this;
25
- }
26
- // --------------------------------
27
- canRecycle(obj) {
28
- const nsid = NSID.get(obj);
29
- return this._recycleObjectNsids.has(nsid);
30
- }
31
- recycle(obj) {
32
- const snapPoint = this._find.findSnapPointByTag(this._snapPointTag);
33
- if (!snapPoint) {
34
- return false;
35
- }
36
- // Reject if something already snapped there.
37
- const otherObj = snapPoint.getSnappedObject();
38
- if (otherObj && otherObj.getSnappedToPoint() === snapPoint) {
39
- return false;
40
- }
41
- obj.setPosition(snapPoint.getGlobalPosition().add([0, 0, 10]), 1);
42
- if (this._preSnapRotation) {
43
- obj.setRotation(this._preSnapRotation);
44
- }
45
- obj.snapToGround(); // get in range
46
- obj.snap();
47
- return true;
48
- }
49
- }
50
- //# sourceMappingURL=simple-to-snap-point-handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"simple-to-snap-point-handler.js","sourceRoot":"","sources":["../../../../../src/lib/game-object/garbage/simple-to-snap-point-handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC;;;;GAIG;AACH,MAAM,OAAO,wBAAwB;IAArC;QACqB,wBAAmB,GAAgB,IAAI,GAAG,EAAU,CAAC;QACrD,UAAK,GAAS,IAAI,IAAI,EAAE,CAAC;QAElC,kBAAa,GAAW,EAAE,CAAC;IAoDvC,CAAC;IA9CU,oBAAoB,CAAC,IAAY;QACpC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,eAAe,CAAC,GAAW;QAC9B,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC;QACzB,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,kBAAkB,CACrB,GAAyD;QAEzD,IAAI,CAAC,gBAAgB,GAAG,GAAG,CAAC;QAC5B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,mCAAmC;IAE5B,UAAU,CAAC,GAAe;QAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC3B,OAAO,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;IAEM,OAAO,CAAC,GAAe;QAC1B,MAAM,SAAS,GAA0B,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAClE,IAAI,CAAC,aAAa,CACrB,CAAC;QACF,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,6CAA6C;QAC7C,MAAM,QAAQ,GAA2B,SAAS,CAAC,gBAAgB,EAAE,CAAC;QACtE,IAAI,QAAQ,IAAI,QAAQ,CAAC,iBAAiB,EAAE,KAAK,SAAS,EAAE,CAAC;YACzD,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,iBAAiB,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClE,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxB,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC3C,CAAC;QACD,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,eAAe;QACnC,GAAG,CAAC,IAAI,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
@@ -1,10 +0,0 @@
1
- import { IGlobal } from "./i-global";
2
- export declare abstract class GlobalInit {
3
- /**
4
- * Run all the init functions (even if one throws).
5
- * Batch together all errors for one throw at the end.
6
- *
7
- * @param abstractGlobals
8
- */
9
- static runGlobalInit(abstractGlobals: IGlobal[]): void;
10
- }
@@ -1,20 +0,0 @@
1
- import { ErrorBatcher } from "../error-handler/error-batcher";
2
- export class GlobalInit {
3
- /**
4
- * Run all the init functions (even if one throws).
5
- * Batch together all errors for one throw at the end.
6
- *
7
- * @param abstractGlobals
8
- */
9
- static runGlobalInit(abstractGlobals) {
10
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
- const runnables = [];
12
- for (const abstractGlobal of abstractGlobals) {
13
- runnables.push(() => {
14
- abstractGlobal.init();
15
- });
16
- }
17
- ErrorBatcher.runMaybeThrowAtEnd(runnables);
18
- }
19
- }
20
- //# sourceMappingURL=global-init.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"global-init.js","sourceRoot":"","sources":["../../../../src/lib/global/global-init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG9D,MAAM,OAAgB,UAAU;IAC5B;;;;;OAKG;IACI,MAAM,CAAC,aAAa,CAAC,eAA0B;QAClD,8DAA8D;QAC9D,MAAM,SAAS,GAAyB,EAAE,CAAC;QAC3C,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;YAC3C,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE;gBAChB,cAAc,CAAC,IAAI,EAAE,CAAC;YAC1B,CAAC,CAAC,CAAC;QACP,CAAC;QACD,YAAY,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;CACJ"}
@@ -1,3 +0,0 @@
1
- export interface IGlobal {
2
- init(): void;
3
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=i-global.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"i-global.js","sourceRoot":"","sources":["../../../../src/lib/global/i-global.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- export declare class Heap<T> {
2
- private readonly _heap;
3
- size(): number;
4
- peekMin(): T | undefined;
5
- private _swap;
6
- add(item: T, value: number): this;
7
- removeMin(): T | undefined;
8
- }
@@ -1,109 +0,0 @@
1
- export class Heap {
2
- constructor() {
3
- this._heap = [];
4
- }
5
- size() {
6
- return this._heap.length;
7
- }
8
- peekMin() {
9
- var _a;
10
- return (_a = this._heap[0]) === null || _a === void 0 ? void 0 : _a.item;
11
- }
12
- _swap(a, b) {
13
- const aHeapEntry = this._heap[a];
14
- const bHeapEntry = this._heap[b];
15
- if (aHeapEntry === undefined || bHeapEntry === undefined) {
16
- throw new Error("missing entry");
17
- }
18
- this._heap[a] = bHeapEntry;
19
- this._heap[b] = aHeapEntry;
20
- }
21
- add(item, value) {
22
- // Add new last entry, bubble up.
23
- this._heap.push({ item, value });
24
- let currentIndex = this._heap.length - 1;
25
- while (currentIndex > 0) {
26
- const upIndex = Math.floor(currentIndex / 2);
27
- const currentHeapEntry = this._heap[currentIndex];
28
- const upHeapEntry = this._heap[upIndex];
29
- // "noUncheckedIndexedAccess" must verify defined.
30
- if (!currentHeapEntry || !upHeapEntry) {
31
- throw new Error("missing entry");
32
- }
33
- if (currentHeapEntry.value > upHeapEntry.value) {
34
- break; // parent smaller, stop
35
- }
36
- this._swap(currentIndex, upIndex);
37
- currentIndex = upIndex;
38
- }
39
- return this;
40
- }
41
- removeMin() {
42
- // Replace first entry with last, bubble down.
43
- const firstHeapEntry = this._heap[0];
44
- if (!firstHeapEntry) {
45
- return undefined;
46
- }
47
- const lastHeapEntry = this._heap.pop();
48
- if (!lastHeapEntry) {
49
- throw new Error("no last heap entry");
50
- }
51
- if (this._heap.length === 0) {
52
- return firstHeapEntry.item;
53
- }
54
- this._heap[0] = lastHeapEntry;
55
- let currentHeapEntry;
56
- let leftHeapEntry;
57
- let rightHeapEntry;
58
- let currentIndex = 0;
59
- do {
60
- const leftIndex = currentIndex * 2 + 1;
61
- const rightIndex = currentIndex * 2 + 2;
62
- currentHeapEntry = this._heap[currentIndex];
63
- leftHeapEntry = this._heap[leftIndex];
64
- rightHeapEntry = this._heap[rightIndex];
65
- // "noUncheckedIndexedAccess" must verify defined.
66
- if (!currentHeapEntry) {
67
- throw new Error("no current heap entry");
68
- }
69
- // no children
70
- if (!leftHeapEntry && !rightHeapEntry) {
71
- break;
72
- }
73
- // 1 child
74
- if (leftHeapEntry && !rightHeapEntry) {
75
- if ((currentHeapEntry === null || currentHeapEntry === void 0 ? void 0 : currentHeapEntry.value) >= leftHeapEntry.value) {
76
- this._swap(currentIndex, leftIndex);
77
- currentIndex = leftIndex;
78
- }
79
- break;
80
- }
81
- // 2 children
82
- if (leftHeapEntry && rightHeapEntry) {
83
- const left = leftHeapEntry.value;
84
- const right = rightHeapEntry.value;
85
- const current = currentHeapEntry.value;
86
- if (left <= right) {
87
- if (current > left) {
88
- this._swap(currentIndex, leftIndex);
89
- currentIndex = leftIndex;
90
- }
91
- else {
92
- break;
93
- }
94
- }
95
- else {
96
- if (current > right) {
97
- this._swap(currentIndex, rightIndex);
98
- currentIndex = rightIndex;
99
- }
100
- else {
101
- break;
102
- }
103
- }
104
- }
105
- } while (leftHeapEntry && rightHeapEntry);
106
- return firstHeapEntry.item;
107
- }
108
- }
109
- //# sourceMappingURL=heap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"heap.js","sourceRoot":"","sources":["../../../../src/lib/heap/heap.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,IAAI;IAAjB;QACqB,UAAK,GAAmB,EAAE,CAAC;IAsHhD,CAAC;IApHU,IAAI;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC7B,CAAC;IAEM,OAAO;;QACV,OAAO,MAAA,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,0CAAE,IAAI,CAAC;IAC/B,CAAC;IAEO,KAAK,CAAC,CAAS,EAAE,CAAS;QAC9B,MAAM,UAAU,GAA6B,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC3D,MAAM,UAAU,GAA6B,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC3D,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YACvD,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;QACrC,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;QAC3B,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;IAC/B,CAAC;IAEM,GAAG,CAAC,IAAO,EAAE,KAAa;QAC7B,iCAAiC;QACjC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACjC,IAAI,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QAEzC,OAAO,YAAY,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,OAAO,GAAW,IAAI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qBAAM,CAAC;oBACJ,IAAI,OAAO,GAAG,KAAK,EAAE,CAAC;wBAClB,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;wBACrC,YAAY,GAAG,UAAU,CAAC;oBAC9B,CAAC;yBAAM,CAAC;wBACJ,MAAM;oBACV,CAAC;gBACL,CAAC;YACL,CAAC;QACL,CAAC,QAAQ,aAAa,IAAI,cAAc,EAAE;QAE1C,OAAO,cAAc,CAAC,IAAI,CAAC;IAC/B,CAAC;CACJ"}
@@ -1,49 +0,0 @@
1
- import { GameObject, Vector } from "@tabletop-playground/api";
2
- import { TriggerableMulticastDelegate } from "../event/triggerable-multicast-delegate";
3
- export type LayoutObjectsSize = {
4
- w: number;
5
- h: number;
6
- };
7
- /**
8
- * Position objects, intended for initial table setup.
9
- */
10
- export declare class LayoutObjects {
11
- private _children;
12
- private _horizontalAlignment;
13
- private _verticalAlignment;
14
- private _childDistance;
15
- private _isVertical;
16
- private _overrideHeight;
17
- private _overrideWidth;
18
- private _layoutCenter;
19
- readonly afterLayout: TriggerableMulticastDelegate<(...args: any[]) => any>;
20
- constructor();
21
- setChildDistance(value: number): this;
22
- setHorizontalAlignment(value: number): this;
23
- setVerticalAlignment(value: number): this;
24
- setIsVertical(value: boolean): this;
25
- setOverrideHeight(value: number): this;
26
- setOverrideWidth(value: number): this;
27
- add(item: GameObject | LayoutObjects): this;
28
- addAfterLayout(f: () => void): this;
29
- flip(flipH: boolean, flipV: boolean): this;
30
- /**
31
- * Get size of self, applying any overrides.
32
- *
33
- * @returns {LayoutObjectsSize}
34
- */
35
- calculateSize(): LayoutObjectsSize;
36
- /**
37
- * Get size from laying out children (ignore override on self).
38
- *
39
- * @returns {LayoutObjectsSize}
40
- */
41
- calculateChildrenSize(): LayoutObjectsSize;
42
- static _calculateChildSize(child: GameObject | LayoutObjects): LayoutObjectsSize;
43
- doLayoutAtPoint(center: Vector, yaw: number): this;
44
- getCenter(): Vector;
45
- layoutLeftOf(peer: GameObject, gap: number): this;
46
- layoutRightOf(peer: GameObject, gap: number): this;
47
- layoutAbove(peer: GameObject, gap: number): this;
48
- layoutBelow(peer: GameObject, gap: number): this;
49
- }