@twick/core 0.14.21 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (376) hide show
  1. package/dist/index.cjs +6465 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +3919 -0
  4. package/dist/index.d.ts +3919 -0
  5. package/dist/index.js +6225 -0
  6. package/dist/index.js.map +1 -0
  7. package/package.json +28 -18
  8. package/tsconfig.project.json +1 -0
  9. package/lib/app/Logger.d.ts +0 -105
  10. package/lib/app/Logger.d.ts.map +0 -1
  11. package/lib/app/Logger.js +0 -77
  12. package/lib/app/PlaybackManager.d.ts +0 -55
  13. package/lib/app/PlaybackManager.d.ts.map +0 -1
  14. package/lib/app/PlaybackManager.js +0 -179
  15. package/lib/app/PlaybackStatus.d.ts +0 -30
  16. package/lib/app/PlaybackStatus.d.ts.map +0 -1
  17. package/lib/app/PlaybackStatus.js +0 -46
  18. package/lib/app/Player.d.ts +0 -130
  19. package/lib/app/Player.d.ts.map +0 -1
  20. package/lib/app/Player.js +0 -375
  21. package/lib/app/Project.d.ts +0 -145
  22. package/lib/app/Project.d.ts.map +0 -1
  23. package/lib/app/Project.js +0 -10
  24. package/lib/app/Renderer.d.ts +0 -90
  25. package/lib/app/Renderer.d.ts.map +0 -1
  26. package/lib/app/Renderer.js +0 -318
  27. package/lib/app/SharedWebGLContext.d.ts +0 -24
  28. package/lib/app/SharedWebGLContext.d.ts.map +0 -1
  29. package/lib/app/SharedWebGLContext.js +0 -200
  30. package/lib/app/Stage.d.ts +0 -30
  31. package/lib/app/Stage.d.ts.map +0 -1
  32. package/lib/app/Stage.js +0 -75
  33. package/lib/app/TimeEstimator.d.ts +0 -53
  34. package/lib/app/TimeEstimator.d.ts.map +0 -1
  35. package/lib/app/TimeEstimator.js +0 -70
  36. package/lib/app/index.d.ts +0 -16
  37. package/lib/app/index.d.ts.map +0 -1
  38. package/lib/app/index.js +0 -16
  39. package/lib/app/makeProject.d.ts +0 -15
  40. package/lib/app/makeProject.d.ts.map +0 -1
  41. package/lib/app/makeProject.js +0 -72
  42. package/lib/app/project-settings.d.ts +0 -8
  43. package/lib/app/project-settings.d.ts.map +0 -1
  44. package/lib/app/project-settings.js +0 -13
  45. package/lib/decorators/decorate.d.ts +0 -2
  46. package/lib/decorators/decorate.d.ts.map +0 -1
  47. package/lib/decorators/decorate.js +0 -10
  48. package/lib/decorators/deprecated.d.ts +0 -5
  49. package/lib/decorators/deprecated.d.ts.map +0 -1
  50. package/lib/decorators/deprecated.js +0 -23
  51. package/lib/decorators/index.d.ts +0 -9
  52. package/lib/decorators/index.d.ts.map +0 -1
  53. package/lib/decorators/index.js +0 -9
  54. package/lib/decorators/lazy.d.ts +0 -14
  55. package/lib/decorators/lazy.d.ts.map +0 -1
  56. package/lib/decorators/lazy.js +0 -27
  57. package/lib/decorators/threadable.d.ts +0 -2
  58. package/lib/decorators/threadable.d.ts.map +0 -1
  59. package/lib/decorators/threadable.js +0 -9
  60. package/lib/events/AsyncEventDispatcher.d.ts +0 -45
  61. package/lib/events/AsyncEventDispatcher.d.ts.map +0 -1
  62. package/lib/events/AsyncEventDispatcher.js +0 -33
  63. package/lib/events/EventDispatcher.d.ts +0 -38
  64. package/lib/events/EventDispatcher.d.ts.map +0 -1
  65. package/lib/events/EventDispatcher.js +0 -29
  66. package/lib/events/EventDispatcherBase.d.ts +0 -55
  67. package/lib/events/EventDispatcherBase.d.ts.map +0 -1
  68. package/lib/events/EventDispatcherBase.js +0 -68
  69. package/lib/events/FlagDispatcher.d.ts +0 -54
  70. package/lib/events/FlagDispatcher.d.ts.map +0 -1
  71. package/lib/events/FlagDispatcher.js +0 -63
  72. package/lib/events/ValueDispatcher.d.ts +0 -81
  73. package/lib/events/ValueDispatcher.d.ts.map +0 -1
  74. package/lib/events/ValueDispatcher.js +0 -97
  75. package/lib/events/index.d.ts +0 -11
  76. package/lib/events/index.d.ts.map +0 -1
  77. package/lib/events/index.js +0 -11
  78. package/lib/exporter/Exporter.d.ts +0 -101
  79. package/lib/exporter/Exporter.d.ts.map +0 -1
  80. package/lib/exporter/Exporter.js +0 -2
  81. package/lib/exporter/FFmpegExporter.d.ts +0 -50
  82. package/lib/exporter/FFmpegExporter.d.ts.map +0 -1
  83. package/lib/exporter/FFmpegExporter.js +0 -140
  84. package/lib/exporter/ImageExporter.d.ts +0 -34
  85. package/lib/exporter/ImageExporter.d.ts.map +0 -1
  86. package/lib/exporter/ImageExporter.js +0 -80
  87. package/lib/exporter/WasmExporter.d.ts +0 -19
  88. package/lib/exporter/WasmExporter.d.ts.map +0 -1
  89. package/lib/exporter/WasmExporter.js +0 -78
  90. package/lib/exporter/download-videos.d.ts +0 -3
  91. package/lib/exporter/download-videos.d.ts.map +0 -1
  92. package/lib/exporter/download-videos.js +0 -45
  93. package/lib/exporter/index.d.ts +0 -5
  94. package/lib/exporter/index.d.ts.map +0 -1
  95. package/lib/exporter/index.js +0 -5
  96. package/lib/flow/all.d.ts +0 -18
  97. package/lib/flow/all.d.ts.map +0 -1
  98. package/lib/flow/all.js +0 -25
  99. package/lib/flow/any.d.ts +0 -18
  100. package/lib/flow/any.d.ts.map +0 -1
  101. package/lib/flow/any.js +0 -25
  102. package/lib/flow/chain.d.ts +0 -36
  103. package/lib/flow/chain.d.ts.map +0 -1
  104. package/lib/flow/chain.js +0 -46
  105. package/lib/flow/delay.d.ts +0 -29
  106. package/lib/flow/delay.d.ts.map +0 -1
  107. package/lib/flow/delay.js +0 -39
  108. package/lib/flow/every.d.ts +0 -41
  109. package/lib/flow/every.d.ts.map +0 -1
  110. package/lib/flow/every.js +0 -61
  111. package/lib/flow/index.d.ts +0 -17
  112. package/lib/flow/index.d.ts.map +0 -1
  113. package/lib/flow/index.js +0 -17
  114. package/lib/flow/join.d.ts +0 -35
  115. package/lib/flow/join.d.ts.map +0 -1
  116. package/lib/flow/join.js +0 -33
  117. package/lib/flow/loop.d.ts +0 -58
  118. package/lib/flow/loop.d.ts.map +0 -1
  119. package/lib/flow/loop.js +0 -51
  120. package/lib/flow/loopFor.d.ts +0 -25
  121. package/lib/flow/loopFor.d.ts.map +0 -1
  122. package/lib/flow/loopFor.js +0 -42
  123. package/lib/flow/names.d.ts +0 -3
  124. package/lib/flow/names.d.ts.map +0 -1
  125. package/lib/flow/names.js +0 -11
  126. package/lib/flow/run.d.ts +0 -45
  127. package/lib/flow/run.d.ts.map +0 -1
  128. package/lib/flow/run.js +0 -14
  129. package/lib/flow/scheduling.d.ts +0 -18
  130. package/lib/flow/scheduling.d.ts.map +0 -1
  131. package/lib/flow/scheduling.js +0 -33
  132. package/lib/flow/sequence.d.ts +0 -22
  133. package/lib/flow/sequence.d.ts.map +0 -1
  134. package/lib/flow/sequence.js +0 -31
  135. package/lib/index.d.ts +0 -16
  136. package/lib/index.d.ts.map +0 -1
  137. package/lib/index.js +0 -16
  138. package/lib/media/index.d.ts +0 -7
  139. package/lib/media/index.d.ts.map +0 -1
  140. package/lib/media/index.js +0 -7
  141. package/lib/media/loadImage.d.ts +0 -8
  142. package/lib/media/loadImage.d.ts.map +0 -1
  143. package/lib/media/loadImage.js +0 -29
  144. package/lib/plugin/DefaultPlugin.d.ts +0 -10
  145. package/lib/plugin/DefaultPlugin.d.ts.map +0 -1
  146. package/lib/plugin/DefaultPlugin.js +0 -17
  147. package/lib/plugin/Plugin.d.ts +0 -53
  148. package/lib/plugin/Plugin.d.ts.map +0 -1
  149. package/lib/plugin/Plugin.js +0 -2
  150. package/lib/plugin/index.d.ts +0 -3
  151. package/lib/plugin/index.d.ts.map +0 -1
  152. package/lib/plugin/index.js +0 -3
  153. package/lib/plugin/makePlugin.d.ts +0 -15
  154. package/lib/plugin/makePlugin.d.ts.map +0 -1
  155. package/lib/plugin/makePlugin.js +0 -16
  156. package/lib/scenes/GeneratorScene.d.ts +0 -95
  157. package/lib/scenes/GeneratorScene.d.ts.map +0 -1
  158. package/lib/scenes/GeneratorScene.js +0 -273
  159. package/lib/scenes/Inspectable.d.ts +0 -71
  160. package/lib/scenes/Inspectable.d.ts.map +0 -1
  161. package/lib/scenes/Inspectable.js +0 -4
  162. package/lib/scenes/LifecycleEvents.d.ts +0 -18
  163. package/lib/scenes/LifecycleEvents.d.ts.map +0 -1
  164. package/lib/scenes/LifecycleEvents.js +0 -45
  165. package/lib/scenes/Random.d.ts +0 -66
  166. package/lib/scenes/Random.d.ts.map +0 -1
  167. package/lib/scenes/Random.js +0 -101
  168. package/lib/scenes/Scene.d.ts +0 -298
  169. package/lib/scenes/Scene.d.ts.map +0 -1
  170. package/lib/scenes/Scene.js +0 -25
  171. package/lib/scenes/SceneState.d.ts +0 -34
  172. package/lib/scenes/SceneState.d.ts.map +0 -1
  173. package/lib/scenes/SceneState.js +0 -35
  174. package/lib/scenes/Shaders.d.ts +0 -63
  175. package/lib/scenes/Shaders.d.ts.map +0 -1
  176. package/lib/scenes/Shaders.js +0 -158
  177. package/lib/scenes/Slides.d.ts +0 -33
  178. package/lib/scenes/Slides.d.ts.map +0 -1
  179. package/lib/scenes/Slides.js +0 -115
  180. package/lib/scenes/Threadable.d.ts +0 -19
  181. package/lib/scenes/Threadable.d.ts.map +0 -1
  182. package/lib/scenes/Threadable.js +0 -4
  183. package/lib/scenes/Variables.d.ts +0 -24
  184. package/lib/scenes/Variables.d.ts.map +0 -1
  185. package/lib/scenes/Variables.js +0 -39
  186. package/lib/scenes/index.d.ts +0 -16
  187. package/lib/scenes/index.d.ts.map +0 -1
  188. package/lib/scenes/index.js +0 -16
  189. package/lib/signals/CompoundSignalContext.d.ts +0 -21
  190. package/lib/signals/CompoundSignalContext.d.ts.map +0 -1
  191. package/lib/signals/CompoundSignalContext.js +0 -73
  192. package/lib/signals/ComputedContext.d.ts +0 -14
  193. package/lib/signals/ComputedContext.d.ts.map +0 -1
  194. package/lib/signals/ComputedContext.js +0 -36
  195. package/lib/signals/DependencyContext.d.ts +0 -32
  196. package/lib/signals/DependencyContext.d.ts.map +0 -1
  197. package/lib/signals/DependencyContext.js +0 -87
  198. package/lib/signals/SignalContext.d.ts +0 -120
  199. package/lib/signals/SignalContext.d.ts.map +0 -1
  200. package/lib/signals/SignalContext.js +0 -245
  201. package/lib/signals/createComputed.d.ts +0 -3
  202. package/lib/signals/createComputed.d.ts.map +0 -1
  203. package/lib/signals/createComputed.js +0 -5
  204. package/lib/signals/createComputedAsync.d.ts +0 -4
  205. package/lib/signals/createComputedAsync.d.ts.map +0 -1
  206. package/lib/signals/createComputedAsync.js +0 -15
  207. package/lib/signals/createSignal.d.ts +0 -5
  208. package/lib/signals/createSignal.d.ts.map +0 -1
  209. package/lib/signals/createSignal.js +0 -6
  210. package/lib/signals/index.d.ts +0 -16
  211. package/lib/signals/index.d.ts.map +0 -1
  212. package/lib/signals/index.js +0 -16
  213. package/lib/signals/symbols.d.ts +0 -2
  214. package/lib/signals/symbols.d.ts.map +0 -1
  215. package/lib/signals/symbols.js +0 -2
  216. package/lib/signals/types.d.ts +0 -51
  217. package/lib/signals/types.d.ts.map +0 -1
  218. package/lib/signals/types.js +0 -2
  219. package/lib/signals/utils.d.ts +0 -5
  220. package/lib/signals/utils.d.ts.map +0 -1
  221. package/lib/signals/utils.js +0 -10
  222. package/lib/threading/Thread.d.ts +0 -77
  223. package/lib/threading/Thread.d.ts.map +0 -1
  224. package/lib/threading/Thread.js +0 -169
  225. package/lib/threading/ThreadGenerator.d.ts +0 -39
  226. package/lib/threading/ThreadGenerator.d.ts.map +0 -1
  227. package/lib/threading/ThreadGenerator.js +0 -17
  228. package/lib/threading/cancel.d.ts +0 -17
  229. package/lib/threading/cancel.d.ts.map +0 -1
  230. package/lib/threading/cancel.js +0 -26
  231. package/lib/threading/index.d.ts +0 -11
  232. package/lib/threading/index.d.ts.map +0 -1
  233. package/lib/threading/index.js +0 -11
  234. package/lib/threading/spawn.d.ts +0 -28
  235. package/lib/threading/spawn.d.ts.map +0 -1
  236. package/lib/threading/spawn.js +0 -30
  237. package/lib/threading/threads.d.ts +0 -46
  238. package/lib/threading/threads.d.ts.map +0 -1
  239. package/lib/threading/threads.js +0 -89
  240. package/lib/transitions/fadeTransition.d.ts +0 -8
  241. package/lib/transitions/fadeTransition.d.ts.map +0 -1
  242. package/lib/transitions/fadeTransition.js +0 -16
  243. package/lib/transitions/index.d.ts +0 -11
  244. package/lib/transitions/index.d.ts.map +0 -1
  245. package/lib/transitions/index.js +0 -11
  246. package/lib/transitions/slideTransition.d.ts +0 -18
  247. package/lib/transitions/slideTransition.d.ts.map +0 -1
  248. package/lib/transitions/slideTransition.js +0 -14
  249. package/lib/transitions/useTransition.d.ts +0 -10
  250. package/lib/transitions/useTransition.d.ts.map +0 -1
  251. package/lib/transitions/useTransition.js +0 -27
  252. package/lib/transitions/zoomInTransition.d.ts +0 -10
  253. package/lib/transitions/zoomInTransition.d.ts.map +0 -1
  254. package/lib/transitions/zoomInTransition.js +0 -33
  255. package/lib/transitions/zoomOutTransition.d.ts +0 -10
  256. package/lib/transitions/zoomOutTransition.d.ts.map +0 -1
  257. package/lib/transitions/zoomOutTransition.js +0 -33
  258. package/lib/tsconfig.build.tsbuildinfo +0 -1
  259. package/lib/tweening/helpers.d.ts +0 -5
  260. package/lib/tweening/helpers.d.ts.map +0 -1
  261. package/lib/tweening/helpers.js +0 -16
  262. package/lib/tweening/index.d.ts +0 -11
  263. package/lib/tweening/index.d.ts.map +0 -1
  264. package/lib/tweening/index.js +0 -11
  265. package/lib/tweening/interpolationFunctions.d.ts +0 -38
  266. package/lib/tweening/interpolationFunctions.d.ts.map +0 -1
  267. package/lib/tweening/interpolationFunctions.js +0 -107
  268. package/lib/tweening/spring.d.ts +0 -20
  269. package/lib/tweening/spring.d.ts.map +0 -1
  270. package/lib/tweening/spring.js +0 -103
  271. package/lib/tweening/timingFunctions.d.ts +0 -46
  272. package/lib/tweening/timingFunctions.d.ts.map +0 -1
  273. package/lib/tweening/timingFunctions.js +0 -233
  274. package/lib/tweening/tween.d.ts +0 -3
  275. package/lib/tweening/tween.d.ts.map +0 -1
  276. package/lib/tweening/tween.js +0 -21
  277. package/lib/types/BBox.d.ts +0 -73
  278. package/lib/types/BBox.d.ts.map +0 -1
  279. package/lib/types/BBox.js +0 -249
  280. package/lib/types/Canvas.d.ts +0 -3
  281. package/lib/types/Canvas.d.ts.map +0 -1
  282. package/lib/types/Canvas.js +0 -2
  283. package/lib/types/Color.d.ts +0 -65
  284. package/lib/types/Color.d.ts.map +0 -1
  285. package/lib/types/Color.js +0 -185
  286. package/lib/types/Matrix.d.ts +0 -3
  287. package/lib/types/Matrix.d.ts.map +0 -1
  288. package/lib/types/Matrix.js +0 -10
  289. package/lib/types/Matrix2D.d.ts +0 -363
  290. package/lib/types/Matrix2D.d.ts.map +0 -1
  291. package/lib/types/Matrix2D.js +0 -554
  292. package/lib/types/Origin.d.ts +0 -17
  293. package/lib/types/Origin.d.ts.map +0 -1
  294. package/lib/types/Origin.js +0 -53
  295. package/lib/types/Spacing.d.ts +0 -36
  296. package/lib/types/Spacing.d.ts.map +0 -1
  297. package/lib/types/Spacing.js +0 -70
  298. package/lib/types/Type.d.ts +0 -9
  299. package/lib/types/Type.d.ts.map +0 -1
  300. package/lib/types/Type.js +0 -5
  301. package/lib/types/Vector.d.ts +0 -203
  302. package/lib/types/Vector.d.ts.map +0 -1
  303. package/lib/types/Vector.js +0 -355
  304. package/lib/types/alignment-enums.d.ts +0 -22
  305. package/lib/types/alignment-enums.d.ts.map +0 -1
  306. package/lib/types/alignment-enums.js +0 -25
  307. package/lib/types/index.d.ts +0 -17
  308. package/lib/types/index.d.ts.map +0 -1
  309. package/lib/types/index.js +0 -17
  310. package/lib/types/vector-transformations.d.ts +0 -20
  311. package/lib/types/vector-transformations.d.ts.map +0 -1
  312. package/lib/types/vector-transformations.js +0 -31
  313. package/lib/utils/DetailedError.d.ts +0 -24
  314. package/lib/utils/DetailedError.d.ts.map +0 -1
  315. package/lib/utils/DetailedError.js +0 -16
  316. package/lib/utils/ExperimentalError.d.ts +0 -10
  317. package/lib/utils/ExperimentalError.d.ts.map +0 -1
  318. package/lib/utils/ExperimentalError.js +0 -32
  319. package/lib/utils/Semaphore.d.ts +0 -12
  320. package/lib/utils/Semaphore.d.ts.map +0 -1
  321. package/lib/utils/Semaphore.js +0 -25
  322. package/lib/utils/beginSlide.d.ts +0 -3
  323. package/lib/utils/beginSlide.d.ts.map +0 -1
  324. package/lib/utils/beginSlide.js +0 -12
  325. package/lib/utils/capitalize.d.ts +0 -2
  326. package/lib/utils/capitalize.d.ts.map +0 -1
  327. package/lib/utils/capitalize.js +0 -4
  328. package/lib/utils/createRef.d.ts +0 -15
  329. package/lib/utils/createRef.d.ts.map +0 -1
  330. package/lib/utils/createRef.js +0 -21
  331. package/lib/utils/createRefArray.d.ts +0 -27
  332. package/lib/utils/createRefArray.d.ts.map +0 -1
  333. package/lib/utils/createRefArray.js +0 -49
  334. package/lib/utils/createRefMap.d.ts +0 -50
  335. package/lib/utils/createRefMap.d.ts.map +0 -1
  336. package/lib/utils/createRefMap.js +0 -77
  337. package/lib/utils/debug.d.ts +0 -24
  338. package/lib/utils/debug.d.ts.map +0 -1
  339. package/lib/utils/debug.js +0 -47
  340. package/lib/utils/deprecate.d.ts +0 -9
  341. package/lib/utils/deprecate.d.ts.map +0 -1
  342. package/lib/utils/deprecate.js +0 -15
  343. package/lib/utils/errorToLog.d.ts +0 -3
  344. package/lib/utils/errorToLog.d.ts.map +0 -1
  345. package/lib/utils/errorToLog.js +0 -8
  346. package/lib/utils/experimentalLog.d.ts +0 -3
  347. package/lib/utils/experimentalLog.d.ts.map +0 -1
  348. package/lib/utils/experimentalLog.js +0 -10
  349. package/lib/utils/getContext.d.ts +0 -2
  350. package/lib/utils/getContext.d.ts.map +0 -1
  351. package/lib/utils/getContext.js +0 -8
  352. package/lib/utils/index.d.ts +0 -26
  353. package/lib/utils/index.d.ts.map +0 -1
  354. package/lib/utils/index.js +0 -26
  355. package/lib/utils/math.d.ts +0 -15
  356. package/lib/utils/math.d.ts.map +0 -1
  357. package/lib/utils/math.js +0 -15
  358. package/lib/utils/range.d.ts +0 -40
  359. package/lib/utils/range.d.ts.map +0 -1
  360. package/lib/utils/range.js +0 -18
  361. package/lib/utils/useContext.d.ts +0 -13
  362. package/lib/utils/useContext.d.ts.map +0 -1
  363. package/lib/utils/useContext.js +0 -18
  364. package/lib/utils/usePlayback.d.ts +0 -8
  365. package/lib/utils/usePlayback.d.ts.map +0 -1
  366. package/lib/utils/usePlayback.js +0 -20
  367. package/lib/utils/useScene.d.ts +0 -17
  368. package/lib/utils/useScene.d.ts.map +0 -1
  369. package/lib/utils/useScene.js +0 -33
  370. package/lib/utils/useThread.d.ts +0 -8
  371. package/lib/utils/useThread.d.ts.map +0 -1
  372. package/lib/utils/useThread.js +0 -24
  373. package/lib/utils/useTime.d.ts +0 -19
  374. package/lib/utils/useTime.d.ts.map +0 -1
  375. package/lib/utils/useTime.js +0 -22
  376. package/project.d.ts +0 -24
@@ -1,23 +0,0 @@
1
- import { deprecate } from '../utils';
2
- /**
3
- * Create a deprecated decorator that marks methods as deprecated.
4
- */
5
- export function deprecated(remarks) {
6
- return function (target, propertyKey, descriptor) {
7
- const name = target.constructor.name
8
- ? `${target.constructor.name}.${propertyKey}`
9
- : propertyKey;
10
- const message = `${name}() has been deprecated.`;
11
- if (descriptor.value) {
12
- descriptor.value = deprecate(descriptor.value, message, remarks);
13
- }
14
- if (descriptor.get) {
15
- descriptor.get = deprecate(descriptor.get, message, remarks);
16
- }
17
- if (descriptor.set) {
18
- descriptor.set = deprecate(descriptor.set, message, remarks);
19
- }
20
- return descriptor;
21
- };
22
- }
23
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVwcmVjYXRlZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kZWNvcmF0b3JzL2RlcHJlY2F0ZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFDLFNBQVMsRUFBQyxNQUFNLFVBQVUsQ0FBQztBQUVuQzs7R0FFRztBQUNILE1BQU0sVUFBVSxVQUFVLENBQUMsT0FBZ0I7SUFDekMsT0FBTyxVQUNMLE1BQVcsRUFDWCxXQUE0QixFQUM1QixVQUE4QjtRQUU5QixNQUFNLElBQUksR0FBRyxNQUFNLENBQUMsV0FBVyxDQUFDLElBQUk7WUFDbEMsQ0FBQyxDQUFDLEdBQUcsTUFBTSxDQUFDLFdBQVcsQ0FBQyxJQUFJLElBQVksV0FBVyxFQUFFO1lBQ3JELENBQUMsQ0FBUyxXQUFXLENBQUM7UUFDeEIsTUFBTSxPQUFPLEdBQUcsR0FBRyxJQUFJLHlCQUF5QixDQUFDO1FBRWpELElBQUksVUFBVSxDQUFDLEtBQUssRUFBRSxDQUFDO1lBQ3JCLFVBQVUsQ0FBQyxLQUFLLEdBQUcsU0FBUyxDQUFDLFVBQVUsQ0FBQyxLQUFLLEVBQUUsT0FBTyxFQUFFLE9BQU8sQ0FBQyxDQUFDO1FBQ25FLENBQUM7UUFDRCxJQUFJLFVBQVUsQ0FBQyxHQUFHLEVBQUUsQ0FBQztZQUNuQixVQUFVLENBQUMsR0FBRyxHQUFHLFNBQVMsQ0FBQyxVQUFVLENBQUMsR0FBRyxFQUFFLE9BQU8sRUFBRSxPQUFPLENBQUMsQ0FBQztRQUMvRCxDQUFDO1FBQ0QsSUFBSSxVQUFVLENBQUMsR0FBRyxFQUFFLENBQUM7WUFDbkIsVUFBVSxDQUFDLEdBQUcsR0FBRyxTQUFTLENBQUMsVUFBVSxDQUFDLEdBQUcsRUFBRSxPQUFPLEVBQUUsT0FBTyxDQUFDLENBQUM7UUFDL0QsQ0FBQztRQUVELE9BQU8sVUFBVSxDQUFDO0lBQ3BCLENBQUMsQ0FBQztBQUNKLENBQUMifQ==
@@ -1,9 +0,0 @@
1
- /**
2
- * Property decorators.
3
- *
4
- * @packageDocumentation
5
- */
6
- export * from './decorate';
7
- export * from './lazy';
8
- export * from './threadable';
9
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Property decorators.
3
- *
4
- * @packageDocumentation
5
- */
6
- export * from './decorate';
7
- export * from './lazy';
8
- export * from './threadable';
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZGVjb3JhdG9ycy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7OztHQUlHO0FBRUgsY0FBYyxZQUFZLENBQUM7QUFDM0IsY0FBYyxRQUFRLENBQUM7QUFDdkIsY0FBYyxjQUFjLENBQUMifQ==
@@ -1,14 +0,0 @@
1
- /**
2
- * Create a lazy decorator.
3
- *
4
- * @remarks
5
- * A property marked as lazy will not be initialized until it's requested for
6
- * the first time. Lazy properties are read-only.
7
- *
8
- * Must be used for any static properties that require the DOM API to be
9
- * initialized.
10
- *
11
- * @param factory - A function that returns the value of this property.
12
- */
13
- export declare function lazy(factory: () => unknown): PropertyDecorator;
14
- //# sourceMappingURL=lazy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/decorators/lazy.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,OAAO,GAAG,iBAAiB,CAY9D"}
@@ -1,27 +0,0 @@
1
- const UNINITIALIZED = Symbol.for('@twick/core/decorators/UNINITIALIZED');
2
- /**
3
- * Create a lazy decorator.
4
- *
5
- * @remarks
6
- * A property marked as lazy will not be initialized until it's requested for
7
- * the first time. Lazy properties are read-only.
8
- *
9
- * Must be used for any static properties that require the DOM API to be
10
- * initialized.
11
- *
12
- * @param factory - A function that returns the value of this property.
13
- */
14
- export function lazy(factory) {
15
- return (target, propertyKey) => {
16
- let value = UNINITIALIZED;
17
- Object.defineProperty(target, propertyKey, {
18
- get() {
19
- if (value === UNINITIALIZED) {
20
- value = factory.call(this);
21
- }
22
- return value;
23
- },
24
- });
25
- };
26
- }
27
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kZWNvcmF0b3JzL2xhenkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxhQUFhLEdBQUcsTUFBTSxDQUFDLEdBQUcsQ0FBQyxzQ0FBc0MsQ0FBQyxDQUFDO0FBRXpFOzs7Ozs7Ozs7OztHQVdHO0FBQ0gsTUFBTSxVQUFVLElBQUksQ0FBQyxPQUFzQjtJQUN6QyxPQUFPLENBQUMsTUFBTSxFQUFFLFdBQVcsRUFBRSxFQUFFO1FBQzdCLElBQUksS0FBSyxHQUFZLGFBQWEsQ0FBQztRQUNuQyxNQUFNLENBQUMsY0FBYyxDQUFDLE1BQU0sRUFBRSxXQUFXLEVBQUU7WUFDekMsR0FBRztnQkFDRCxJQUFJLEtBQUssS0FBSyxhQUFhLEVBQUUsQ0FBQztvQkFDNUIsS0FBSyxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUM7Z0JBQzdCLENBQUM7Z0JBQ0QsT0FBTyxLQUFLLENBQUM7WUFDZixDQUFDO1NBQ0YsQ0FBQyxDQUFDO0lBQ0wsQ0FBQyxDQUFDO0FBQ0osQ0FBQyJ9
@@ -1,2 +0,0 @@
1
- export declare function threadable(customName?: string): MethodDecorator;
2
- //# sourceMappingURL=threadable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"threadable.d.ts","sourceRoot":"","sources":["../../src/decorators/threadable.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,eAAe,CAW/D"}
@@ -1,9 +0,0 @@
1
- export function threadable(customName) {
2
- return function (_, propertyKey, descriptor) {
3
- if (descriptor?.value?.prototype) {
4
- descriptor.value.prototype.name = customName ?? propertyKey;
5
- descriptor.value.prototype.threadable = true;
6
- }
7
- };
8
- }
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGhyZWFkYWJsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kZWNvcmF0b3JzL3RocmVhZGFibGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxVQUFVLFVBQVUsQ0FBQyxVQUFtQjtJQUM1QyxPQUFPLFVBQ0wsQ0FBVSxFQUNWLFdBQTRCLEVBQzVCLFVBQThCO1FBRTlCLElBQUksVUFBVSxFQUFFLEtBQUssRUFBRSxTQUFTLEVBQUUsQ0FBQztZQUNqQyxVQUFVLENBQUMsS0FBSyxDQUFDLFNBQVMsQ0FBQyxJQUFJLEdBQUcsVUFBVSxJQUFJLFdBQVcsQ0FBQztZQUM1RCxVQUFVLENBQUMsS0FBSyxDQUFDLFNBQVMsQ0FBQyxVQUFVLEdBQUcsSUFBSSxDQUFDO1FBQy9DLENBQUM7SUFDSCxDQUFDLENBQUM7QUFDSixDQUFDIn0=
@@ -1,45 +0,0 @@
1
- import type { Subscribable } from './EventDispatcherBase';
2
- import { EventDispatcherBase } from './EventDispatcherBase';
3
- export interface AsyncEventHandler<T> {
4
- (value: T): Promise<void>;
5
- }
6
- /**
7
- * Dispatches an asynchronous {@link SubscribableEvent}.
8
- *
9
- * @remarks
10
- * The {@link dispatch} method returns a promise that resolves when all the
11
- * handlers resolve.
12
- *
13
- * @example
14
- * ```ts
15
- * class Example {
16
- * // expose the event to external classes
17
- * public get onValueChanged {
18
- * return this.value.subscribable;
19
- * }
20
- * // create a private dispatcher
21
- * private value = new AsyncEventDispatcher<number>();
22
- *
23
- * private async dispatchExample() {
24
- * // dispatching returns a Promise.
25
- * await this.value.dispatch(0);
26
- * }
27
- * }
28
- * ```
29
- *
30
- * @typeParam T - The type of the argument passed to subscribers.
31
- */
32
- export declare class AsyncEventDispatcher<T> extends EventDispatcherBase<T, AsyncEventHandler<T>> {
33
- dispatch(value: T): Promise<void>;
34
- }
35
- /**
36
- * Provides safe access to the public interface of {@link AsyncEventDispatcher}.
37
- *
38
- * @remarks
39
- * External classes can use it to subscribe to an event without being able to
40
- * dispatch it.
41
- *
42
- * @typeParam T - The type of the argument passed to subscribers.
43
- */
44
- export type SubscribableAsyncEvent<T> = Subscribable<T, AsyncEventHandler<T>>;
45
- //# sourceMappingURL=AsyncEventDispatcher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AsyncEventDispatcher.d.ts","sourceRoot":"","sources":["../../src/events/AsyncEventDispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAE1D,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,oBAAoB,CAAC,CAAC,CAAE,SAAQ,mBAAmB,CAC9D,CAAC,EACD,iBAAiB,CAAC,CAAC,CAAC,CACrB;IACc,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/C;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -1,33 +0,0 @@
1
- import { EventDispatcherBase } from './EventDispatcherBase';
2
- /**
3
- * Dispatches an asynchronous {@link SubscribableEvent}.
4
- *
5
- * @remarks
6
- * The {@link dispatch} method returns a promise that resolves when all the
7
- * handlers resolve.
8
- *
9
- * @example
10
- * ```ts
11
- * class Example {
12
- * // expose the event to external classes
13
- * public get onValueChanged {
14
- * return this.value.subscribable;
15
- * }
16
- * // create a private dispatcher
17
- * private value = new AsyncEventDispatcher<number>();
18
- *
19
- * private async dispatchExample() {
20
- * // dispatching returns a Promise.
21
- * await this.value.dispatch(0);
22
- * }
23
- * }
24
- * ```
25
- *
26
- * @typeParam T - The type of the argument passed to subscribers.
27
- */
28
- export class AsyncEventDispatcher extends EventDispatcherBase {
29
- async dispatch(value) {
30
- await Promise.all(this.notifySubscribers(value));
31
- }
32
- }
33
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQXN5bmNFdmVudERpc3BhdGNoZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZXZlbnRzL0FzeW5jRXZlbnREaXNwYXRjaGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBQyxtQkFBbUIsRUFBQyxNQUFNLHVCQUF1QixDQUFDO0FBTTFEOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBeUJHO0FBQ0gsTUFBTSxPQUFPLG9CQUF3QixTQUFRLG1CQUc1QztJQUNRLEtBQUssQ0FBQyxRQUFRLENBQUMsS0FBUTtRQUM1QixNQUFNLE9BQU8sQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLGlCQUFpQixDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUM7SUFDbkQsQ0FBQztDQUNGIn0=
@@ -1,38 +0,0 @@
1
- import type { Subscribable } from './EventDispatcherBase';
2
- import { EventDispatcherBase } from './EventDispatcherBase';
3
- /**
4
- * Dispatches a {@link SubscribableEvent}.
5
- *
6
- * @example
7
- * ```ts
8
- * class Example {
9
- * // expose the event to external classes
10
- * public get onValueChanged {
11
- * return this.value.subscribable;
12
- * }
13
- * // create a private dispatcher
14
- * private value = new EventDispatcher<number>();
15
- *
16
- * private dispatchExample() {
17
- * // dispatching will notify all subscribers.
18
- * this.value.dispatch(0);
19
- * }
20
- * }
21
- * ```
22
- *
23
- * @typeParam T - The type of the value argument to subscribers.
24
- */
25
- export declare class EventDispatcher<T> extends EventDispatcherBase<T> {
26
- dispatch(value: T): void;
27
- }
28
- /**
29
- * Provides safe access to the public interface of {@link EventDispatcher}.
30
- *
31
- * @remarks
32
- * External classes can use it to subscribe to an event without being able to
33
- * dispatch it.
34
- *
35
- * @typeParam T - The type of the argument passed to subscribers.
36
- */
37
- export type SubscribableEvent<T> = Subscribable<T>;
38
- //# sourceMappingURL=EventDispatcher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EventDispatcher.d.ts","sourceRoot":"","sources":["../../src/events/EventDispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,eAAe,CAAC,CAAC,CAAE,SAAQ,mBAAmB,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,KAAK,EAAE,CAAC;CAGzB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC"}
@@ -1,29 +0,0 @@
1
- import { EventDispatcherBase } from './EventDispatcherBase';
2
- /**
3
- * Dispatches a {@link SubscribableEvent}.
4
- *
5
- * @example
6
- * ```ts
7
- * class Example {
8
- * // expose the event to external classes
9
- * public get onValueChanged {
10
- * return this.value.subscribable;
11
- * }
12
- * // create a private dispatcher
13
- * private value = new EventDispatcher<number>();
14
- *
15
- * private dispatchExample() {
16
- * // dispatching will notify all subscribers.
17
- * this.value.dispatch(0);
18
- * }
19
- * }
20
- * ```
21
- *
22
- * @typeParam T - The type of the value argument to subscribers.
23
- */
24
- export class EventDispatcher extends EventDispatcherBase {
25
- dispatch(value) {
26
- this.notifySubscribers(value);
27
- }
28
- }
29
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRXZlbnREaXNwYXRjaGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2V2ZW50cy9FdmVudERpc3BhdGNoZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFDLG1CQUFtQixFQUFDLE1BQU0sdUJBQXVCLENBQUM7QUFFMUQ7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQXFCRztBQUNILE1BQU0sT0FBTyxlQUFtQixTQUFRLG1CQUFzQjtJQUNyRCxRQUFRLENBQUMsS0FBUTtRQUN0QixJQUFJLENBQUMsaUJBQWlCLENBQUMsS0FBSyxDQUFDLENBQUM7SUFDaEMsQ0FBQztDQUNGIn0=
@@ -1,55 +0,0 @@
1
- export interface EventHandler<T> {
2
- (value: T): any;
3
- }
4
- /**
5
- * A base for dispatching {@link Subscribable}s.
6
- *
7
- * @typeParam TValue - The type of the argument passed to subscribers.
8
- * @typeParam THandler - The type of the callback function.
9
- */
10
- export declare abstract class EventDispatcherBase<TValue, THandler extends EventHandler<TValue> = EventHandler<TValue>> {
11
- readonly subscribable: Subscribable<TValue, THandler>;
12
- private subscribers;
13
- /**
14
- * {@inheritDoc Subscribable.subscribe}
15
- */
16
- subscribe(handler: THandler): () => void;
17
- /**
18
- * {@inheritDoc Subscribable.unsubscribe}
19
- */
20
- unsubscribe(handler: THandler): void;
21
- /**
22
- * Unsubscribe all subscribers from the event.
23
- */
24
- clear(): void;
25
- protected notifySubscribers(value: TValue): ReturnType<THandler>[];
26
- }
27
- /**
28
- * Provides safe access to the public interface of {@link EventDispatcherBase}.
29
- *
30
- * @remarks
31
- * External classes can use it to subscribe to an event without being able to
32
- * dispatch it.
33
- *
34
- * @typeParam TValue - The type of the argument passed to subscribers.
35
- * @typeParam THandler - The type of the callback function.
36
- */
37
- export declare class Subscribable<TValue, THandler extends EventHandler<TValue> = EventHandler<TValue>> {
38
- protected dispatcher: EventDispatcherBase<TValue, THandler>;
39
- constructor(dispatcher: EventDispatcherBase<TValue, THandler>);
40
- /**
41
- * Subscribe to the event.
42
- *
43
- * @param handler - The handler to invoke when the event occurs.
44
- *
45
- * @returns A callback function that cancels the subscription.
46
- */
47
- subscribe(handler: THandler): () => void;
48
- /**
49
- * Unsubscribe from the event.
50
- *
51
- * @param handler - The handler to unsubscribe.
52
- */
53
- unsubscribe(handler: THandler): void;
54
- }
55
- //# sourceMappingURL=EventDispatcherBase.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EventDispatcherBase.d.ts","sourceRoot":"","sources":["../../src/events/EventDispatcherBase.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,CAAC,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC;CACjB;AAED;;;;;GAKG;AACH,8BAAsB,mBAAmB,CACvC,MAAM,EACN,QAAQ,SAAS,YAAY,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC;IAE5D,SAAgB,YAAY,EAAE,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CACnC;IAEzB,OAAO,CAAC,WAAW,CAAuB;IAE1C;;OAEG;IACI,SAAS,CAAC,OAAO,EAAE,QAAQ;IAKlC;;OAEG;IACI,WAAW,CAAC,OAAO,EAAE,QAAQ;IAIpC;;OAEG;IACI,KAAK;IAIZ,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,EAAE;CAGnE;AAED;;;;;;;;;GASG;AACH,qBAAa,YAAY,CACvB,MAAM,EACN,QAAQ,SAAS,YAAY,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC;IAG1D,SAAS,CAAC,UAAU,EAAE,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC;gBAAjD,UAAU,EAAE,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC;IAG7D;;;;;;OAMG;IACI,SAAS,CAAC,OAAO,EAAE,QAAQ;IAIlC;;;;OAIG;IACI,WAAW,CAAC,OAAO,EAAE,QAAQ;CAGrC"}
@@ -1,68 +0,0 @@
1
- /**
2
- * A base for dispatching {@link Subscribable}s.
3
- *
4
- * @typeParam TValue - The type of the argument passed to subscribers.
5
- * @typeParam THandler - The type of the callback function.
6
- */
7
- export class EventDispatcherBase {
8
- constructor() {
9
- this.subscribable = new Subscribable(this);
10
- this.subscribers = new Set();
11
- }
12
- /**
13
- * {@inheritDoc Subscribable.subscribe}
14
- */
15
- subscribe(handler) {
16
- this.subscribers.add(handler);
17
- return () => this.unsubscribe(handler);
18
- }
19
- /**
20
- * {@inheritDoc Subscribable.unsubscribe}
21
- */
22
- unsubscribe(handler) {
23
- this.subscribers.delete(handler);
24
- }
25
- /**
26
- * Unsubscribe all subscribers from the event.
27
- */
28
- clear() {
29
- this.subscribers.clear();
30
- }
31
- notifySubscribers(value) {
32
- return [...this.subscribers].map(handler => handler(value));
33
- }
34
- }
35
- /**
36
- * Provides safe access to the public interface of {@link EventDispatcherBase}.
37
- *
38
- * @remarks
39
- * External classes can use it to subscribe to an event without being able to
40
- * dispatch it.
41
- *
42
- * @typeParam TValue - The type of the argument passed to subscribers.
43
- * @typeParam THandler - The type of the callback function.
44
- */
45
- export class Subscribable {
46
- constructor(dispatcher) {
47
- this.dispatcher = dispatcher;
48
- }
49
- /**
50
- * Subscribe to the event.
51
- *
52
- * @param handler - The handler to invoke when the event occurs.
53
- *
54
- * @returns A callback function that cancels the subscription.
55
- */
56
- subscribe(handler) {
57
- return this.dispatcher.subscribe(handler);
58
- }
59
- /**
60
- * Unsubscribe from the event.
61
- *
62
- * @param handler - The handler to unsubscribe.
63
- */
64
- unsubscribe(handler) {
65
- this.dispatcher.unsubscribe(handler);
66
- }
67
- }
68
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRXZlbnREaXNwYXRjaGVyQmFzZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ldmVudHMvRXZlbnREaXNwYXRjaGVyQmFzZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFJQTs7Ozs7R0FLRztBQUNILE1BQU0sT0FBZ0IsbUJBQW1CO0lBQXpDO1FBSWtCLGlCQUFZLEdBQzFCLElBQUksWUFBWSxDQUFDLElBQUksQ0FBQyxDQUFDO1FBRWpCLGdCQUFXLEdBQUcsSUFBSSxHQUFHLEVBQVksQ0FBQztJQTJCNUMsQ0FBQztJQXpCQzs7T0FFRztJQUNJLFNBQVMsQ0FBQyxPQUFpQjtRQUNoQyxJQUFJLENBQUMsV0FBVyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUM5QixPQUFPLEdBQUcsRUFBRSxDQUFDLElBQUksQ0FBQyxXQUFXLENBQUMsT0FBTyxDQUFDLENBQUM7SUFDekMsQ0FBQztJQUVEOztPQUVHO0lBQ0ksV0FBVyxDQUFDLE9BQWlCO1FBQ2xDLElBQUksQ0FBQyxXQUFXLENBQUMsTUFBTSxDQUFDLE9BQU8sQ0FBQyxDQUFDO0lBQ25DLENBQUM7SUFFRDs7T0FFRztJQUNJLEtBQUs7UUFDVixJQUFJLENBQUMsV0FBVyxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQzNCLENBQUM7SUFFUyxpQkFBaUIsQ0FBQyxLQUFhO1FBQ3ZDLE9BQU8sQ0FBQyxHQUFHLElBQUksQ0FBQyxXQUFXLENBQUMsQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLEVBQUUsQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQztJQUM5RCxDQUFDO0NBQ0Y7QUFFRDs7Ozs7Ozs7O0dBU0c7QUFDSCxNQUFNLE9BQU8sWUFBWTtJQUl2QixZQUNZLFVBQWlEO1FBQWpELGVBQVUsR0FBVixVQUFVLENBQXVDO0lBQzFELENBQUM7SUFFSjs7Ozs7O09BTUc7SUFDSSxTQUFTLENBQUMsT0FBaUI7UUFDaEMsT0FBTyxJQUFJLENBQUMsVUFBVSxDQUFDLFNBQVMsQ0FBQyxPQUFPLENBQUMsQ0FBQztJQUM1QyxDQUFDO0lBRUQ7Ozs7T0FJRztJQUNJLFdBQVcsQ0FBQyxPQUFpQjtRQUNsQyxJQUFJLENBQUMsVUFBVSxDQUFDLFdBQVcsQ0FBQyxPQUFPLENBQUMsQ0FBQztJQUN2QyxDQUFDO0NBQ0YifQ==
@@ -1,54 +0,0 @@
1
- import type { EventHandler, Subscribable } from './EventDispatcherBase';
2
- import { EventDispatcherBase } from './EventDispatcherBase';
3
- /**
4
- * Dispatches a {@link SubscribableFlagEvent}.
5
- *
6
- * @remarks
7
- * Subscribers are notified only when the flag is set.
8
- * Subsequent calls to {@link raise} don't trigger anything.
9
- * Any handlers added while the flag is raised are immediately invoked.
10
- *
11
- * Resetting the flag doesn't notify the subscribers, but raising it again does.
12
- *
13
- * @example
14
- * ```ts
15
- * class Example {
16
- * // expose the event to external classes
17
- * public get onChanged {
18
- * return this.flag.subscribable;
19
- * }
20
- * // create a private dispatcher
21
- * private flag = new FlagDispatcher();
22
- *
23
- * private dispatchExample() {
24
- * // setting the flag will notify all subscribers
25
- * this.flag.raise();
26
- * }
27
- * }
28
- * ```
29
- */
30
- export declare class FlagDispatcher extends EventDispatcherBase<void> {
31
- private value;
32
- /**
33
- * Notify all current and future subscribers.
34
- */
35
- raise(): void;
36
- /**
37
- * Stop notifying future subscribers.
38
- */
39
- reset(): void;
40
- /**
41
- * Are subscribers being notified?
42
- */
43
- isRaised(): boolean;
44
- subscribe(handler: EventHandler<void>): () => void;
45
- }
46
- /**
47
- * Provides safe access to the public interface of {@link FlagDispatcher}.
48
- *
49
- * @remarks
50
- * External classes can use it to subscribe to an event without being able to
51
- * dispatch it.
52
- */
53
- export type SubscribableFlagEvent = Subscribable<void>;
54
- //# sourceMappingURL=FlagDispatcher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FlagDispatcher.d.ts","sourceRoot":"","sources":["../../src/events/FlagDispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,cAAe,SAAQ,mBAAmB,CAAC,IAAI,CAAC;IAC3D,OAAO,CAAC,KAAK,CAAS;IAEtB;;OAEG;IACI,KAAK;IAOZ;;OAEG;IACI,KAAK;IAIZ;;OAEG;IACI,QAAQ;IAIR,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC;CAO7C;AAED;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC"}
@@ -1,63 +0,0 @@
1
- import { EventDispatcherBase } from './EventDispatcherBase';
2
- /**
3
- * Dispatches a {@link SubscribableFlagEvent}.
4
- *
5
- * @remarks
6
- * Subscribers are notified only when the flag is set.
7
- * Subsequent calls to {@link raise} don't trigger anything.
8
- * Any handlers added while the flag is raised are immediately invoked.
9
- *
10
- * Resetting the flag doesn't notify the subscribers, but raising it again does.
11
- *
12
- * @example
13
- * ```ts
14
- * class Example {
15
- * // expose the event to external classes
16
- * public get onChanged {
17
- * return this.flag.subscribable;
18
- * }
19
- * // create a private dispatcher
20
- * private flag = new FlagDispatcher();
21
- *
22
- * private dispatchExample() {
23
- * // setting the flag will notify all subscribers
24
- * this.flag.raise();
25
- * }
26
- * }
27
- * ```
28
- */
29
- export class FlagDispatcher extends EventDispatcherBase {
30
- constructor() {
31
- super(...arguments);
32
- this.value = false;
33
- }
34
- /**
35
- * Notify all current and future subscribers.
36
- */
37
- raise() {
38
- if (!this.value) {
39
- this.value = true;
40
- this.notifySubscribers();
41
- }
42
- }
43
- /**
44
- * Stop notifying future subscribers.
45
- */
46
- reset() {
47
- this.value = false;
48
- }
49
- /**
50
- * Are subscribers being notified?
51
- */
52
- isRaised() {
53
- return this.value;
54
- }
55
- subscribe(handler) {
56
- const unsubscribe = super.subscribe(handler);
57
- if (this.value) {
58
- handler();
59
- }
60
- return unsubscribe;
61
- }
62
- }
63
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRmxhZ0Rpc3BhdGNoZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZXZlbnRzL0ZsYWdEaXNwYXRjaGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBQyxtQkFBbUIsRUFBQyxNQUFNLHVCQUF1QixDQUFDO0FBRTFEOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQTBCRztBQUNILE1BQU0sT0FBTyxjQUFlLFNBQVEsbUJBQXlCO0lBQTdEOztRQUNVLFVBQUssR0FBRyxLQUFLLENBQUM7SUFpQ3hCLENBQUM7SUEvQkM7O09BRUc7SUFDSSxLQUFLO1FBQ1YsSUFBSSxDQUFDLElBQUksQ0FBQyxLQUFLLEVBQUUsQ0FBQztZQUNoQixJQUFJLENBQUMsS0FBSyxHQUFHLElBQUksQ0FBQztZQUNsQixJQUFJLENBQUMsaUJBQWlCLEVBQUUsQ0FBQztRQUMzQixDQUFDO0lBQ0gsQ0FBQztJQUVEOztPQUVHO0lBQ0ksS0FBSztRQUNWLElBQUksQ0FBQyxLQUFLLEdBQUcsS0FBSyxDQUFDO0lBQ3JCLENBQUM7SUFFRDs7T0FFRztJQUNJLFFBQVE7UUFDYixPQUFPLElBQUksQ0FBQyxLQUFLLENBQUM7SUFDcEIsQ0FBQztJQUVNLFNBQVMsQ0FBQyxPQUEyQjtRQUMxQyxNQUFNLFdBQVcsR0FBRyxLQUFLLENBQUMsU0FBUyxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBQzdDLElBQUksSUFBSSxDQUFDLEtBQUssRUFBRSxDQUFDO1lBQ2YsT0FBTyxFQUFFLENBQUM7UUFDWixDQUFDO1FBQ0QsT0FBTyxXQUFXLENBQUM7SUFDckIsQ0FBQztDQUNGIn0=
@@ -1,81 +0,0 @@
1
- import type { EventHandler } from './EventDispatcherBase';
2
- import { EventDispatcherBase, Subscribable } from './EventDispatcherBase';
3
- /**
4
- * Dispatches a {@link SubscribableValueEvent}
5
- *
6
- * @remarks
7
- * Changing the value stored by a value dispatcher will immediately notify all
8
- * its subscribers.
9
- *
10
- * @example
11
- * ```ts
12
- * class Example {
13
- * // expose the event to external classes
14
- * public get onValueChanged {
15
- * return this.value.subscribable;
16
- * }
17
- * // create a private dispatcher
18
- * private value = new ValueDispatcher(0);
19
- *
20
- * private changingValueExample() {
21
- * // changing the value will notify all subscribers.
22
- * this.value.current = 7;
23
- * }
24
- * }
25
- * ```
26
- *
27
- * @typeParam T - The type of the value passed to subscribers.
28
- */
29
- export declare class ValueDispatcher<T> extends EventDispatcherBase<T> {
30
- private value;
31
- readonly subscribable: SubscribableValueEvent<T>;
32
- /**
33
- * {@inheritDoc SubscribableValueEvent.current}
34
- */
35
- get current(): T;
36
- /**
37
- * Set the current value of this dispatcher.
38
- *
39
- * @remarks
40
- * Setting the value will immediately notify all subscribers.
41
- *
42
- * @param value - The new value.
43
- */
44
- set current(value: T);
45
- /**
46
- * @param value - The initial value.
47
- */
48
- constructor(value: T);
49
- /**
50
- * {@inheritDoc SubscribableValueEvent.subscribe}
51
- */
52
- subscribe(handler: EventHandler<T>, dispatchImmediately?: boolean): () => void;
53
- }
54
- /**
55
- * Provides safe access to the public interface of {@link ValueDispatcher}.
56
- *
57
- * @remarks
58
- * External classes can use it to subscribe to an event without being able to
59
- * dispatch it.
60
- *
61
- * @typeParam T - The type of the value passed to subscribers.
62
- */
63
- export declare class SubscribableValueEvent<T> extends Subscribable<T, EventHandler<T>> {
64
- /**
65
- * Get the most recent value of this dispatcher.
66
- */
67
- get current(): T;
68
- /**
69
- * Subscribe to the event.
70
- *
71
- * Subscribing will immediately invoke the handler with the most recent value.
72
- *
73
- * @param handler - The handler to invoke when the event occurs.
74
- * @param dispatchImmediately - Whether the handler should be immediately
75
- * invoked with the most recent value.
76
- *
77
- * @returns Callback function that cancels the subscription.
78
- */
79
- subscribe(handler: EventHandler<T>, dispatchImmediately?: boolean): () => void;
80
- }
81
- //# sourceMappingURL=ValueDispatcher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ValueDispatcher.d.ts","sourceRoot":"","sources":["../../src/events/ValueDispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAC,mBAAmB,EAAE,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,eAAe,CAAC,CAAC,CAAE,SAAQ,mBAAmB,CAAC,CAAC,CAAC;IA2BzC,OAAO,CAAC,KAAK;IA1BhC,SAAgB,YAAY,EAAE,sBAAsB,CAAC,CAAC,CAAC,CACpB;IAEnC;;OAEG;IACH,IAAW,OAAO,IAYQ,CAAC,CAV1B;IAED;;;;;;;OAOG;IACH,IAAW,OAAO,CAAC,KAAK,EAAE,CAAC,EAG1B;IAED;;OAEG;gBACwB,KAAK,EAAE,CAAC;IAInC;;OAEG;IACI,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,mBAAmB,UAAO;CAOtE;AAED;;;;;;;;GAQG;AACH,qBAAa,sBAAsB,CAAC,CAAC,CAAE,SAAQ,YAAY,CACzD,CAAC,EACD,YAAY,CAAC,CAAC,CAAC,CAChB;IACC;;OAEG;IACH,IAAW,OAAO,MAEjB;IAED;;;;;;;;;;OAUG;IACI,SAAS,CACd,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EACxB,mBAAmB,UAAO,GACzB,MAAM,IAAI;CAMd"}