@kurot/ui 1.1.7

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 (326) hide show
  1. package/README.md +258 -0
  2. package/dist/index.d.ts +8 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +8 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/kurot/binding/Binding.d.ts +38 -0
  7. package/dist/kurot/binding/Binding.d.ts.map +1 -0
  8. package/dist/kurot/binding/Binding.js +88 -0
  9. package/dist/kurot/binding/Binding.js.map +1 -0
  10. package/dist/kurot/binding/Watcher.d.ts +57 -0
  11. package/dist/kurot/binding/Watcher.d.ts.map +1 -0
  12. package/dist/kurot/binding/Watcher.js +119 -0
  13. package/dist/kurot/binding/Watcher.js.map +1 -0
  14. package/dist/kurot/binding/index.d.ts +3 -0
  15. package/dist/kurot/binding/index.d.ts.map +1 -0
  16. package/dist/kurot/binding/index.js +3 -0
  17. package/dist/kurot/binding/index.js.map +1 -0
  18. package/dist/kurot/collections/ArrayCollection.d.ts +56 -0
  19. package/dist/kurot/collections/ArrayCollection.d.ts.map +1 -0
  20. package/dist/kurot/collections/ArrayCollection.js +143 -0
  21. package/dist/kurot/collections/ArrayCollection.js.map +1 -0
  22. package/dist/kurot/collections/ICollection.d.ts +24 -0
  23. package/dist/kurot/collections/ICollection.d.ts.map +1 -0
  24. package/dist/kurot/collections/ICollection.js +2 -0
  25. package/dist/kurot/collections/ICollection.js.map +1 -0
  26. package/dist/kurot/collections/index.d.ts +3 -0
  27. package/dist/kurot/collections/index.d.ts.map +1 -0
  28. package/dist/kurot/collections/index.js +2 -0
  29. package/dist/kurot/collections/index.js.map +1 -0
  30. package/dist/kurot/components/Animation.d.ts +34 -0
  31. package/dist/kurot/components/Animation.d.ts.map +1 -0
  32. package/dist/kurot/components/Animation.js +100 -0
  33. package/dist/kurot/components/Animation.js.map +1 -0
  34. package/dist/kurot/components/Button.d.ts +61 -0
  35. package/dist/kurot/components/Button.d.ts.map +1 -0
  36. package/dist/kurot/components/Button.js +176 -0
  37. package/dist/kurot/components/Button.js.map +1 -0
  38. package/dist/kurot/components/CheckBox.d.ts +11 -0
  39. package/dist/kurot/components/CheckBox.d.ts.map +1 -0
  40. package/dist/kurot/components/CheckBox.js +13 -0
  41. package/dist/kurot/components/CheckBox.js.map +1 -0
  42. package/dist/kurot/components/ComboBox.d.ts +93 -0
  43. package/dist/kurot/components/ComboBox.d.ts.map +1 -0
  44. package/dist/kurot/components/ComboBox.js +307 -0
  45. package/dist/kurot/components/ComboBox.js.map +1 -0
  46. package/dist/kurot/components/Component.d.ts +203 -0
  47. package/dist/kurot/components/Component.d.ts.map +1 -0
  48. package/dist/kurot/components/Component.js +522 -0
  49. package/dist/kurot/components/Component.js.map +1 -0
  50. package/dist/kurot/components/DataGroup.d.ts +90 -0
  51. package/dist/kurot/components/DataGroup.d.ts.map +1 -0
  52. package/dist/kurot/components/DataGroup.js +483 -0
  53. package/dist/kurot/components/DataGroup.js.map +1 -0
  54. package/dist/kurot/components/EditableText.d.ts +44 -0
  55. package/dist/kurot/components/EditableText.d.ts.map +1 -0
  56. package/dist/kurot/components/EditableText.js +126 -0
  57. package/dist/kurot/components/EditableText.js.map +1 -0
  58. package/dist/kurot/components/Group.d.ts +133 -0
  59. package/dist/kurot/components/Group.d.ts.map +1 -0
  60. package/dist/kurot/components/Group.js +454 -0
  61. package/dist/kurot/components/Group.js.map +1 -0
  62. package/dist/kurot/components/HScrollBar.d.ts +13 -0
  63. package/dist/kurot/components/HScrollBar.d.ts.map +1 -0
  64. package/dist/kurot/components/HScrollBar.js +55 -0
  65. package/dist/kurot/components/HScrollBar.js.map +1 -0
  66. package/dist/kurot/components/HSlider.d.ts +17 -0
  67. package/dist/kurot/components/HSlider.d.ts.map +1 -0
  68. package/dist/kurot/components/HSlider.js +48 -0
  69. package/dist/kurot/components/HSlider.js.map +1 -0
  70. package/dist/kurot/components/Image.d.ts +35 -0
  71. package/dist/kurot/components/Image.d.ts.map +1 -0
  72. package/dist/kurot/components/Image.js +141 -0
  73. package/dist/kurot/components/Image.js.map +1 -0
  74. package/dist/kurot/components/ItemRenderer.d.ts +42 -0
  75. package/dist/kurot/components/ItemRenderer.d.ts.map +1 -0
  76. package/dist/kurot/components/ItemRenderer.js +117 -0
  77. package/dist/kurot/components/ItemRenderer.js.map +1 -0
  78. package/dist/kurot/components/Label.d.ts +49 -0
  79. package/dist/kurot/components/Label.d.ts.map +1 -0
  80. package/dist/kurot/components/Label.js +193 -0
  81. package/dist/kurot/components/Label.js.map +1 -0
  82. package/dist/kurot/components/List.d.ts +16 -0
  83. package/dist/kurot/components/List.d.ts.map +1 -0
  84. package/dist/kurot/components/List.js +34 -0
  85. package/dist/kurot/components/List.js.map +1 -0
  86. package/dist/kurot/components/ListBase.d.ts +61 -0
  87. package/dist/kurot/components/ListBase.d.ts.map +1 -0
  88. package/dist/kurot/components/ListBase.js +202 -0
  89. package/dist/kurot/components/ListBase.js.map +1 -0
  90. package/dist/kurot/components/Panel.d.ts +53 -0
  91. package/dist/kurot/components/Panel.d.ts.map +1 -0
  92. package/dist/kurot/components/Panel.js +145 -0
  93. package/dist/kurot/components/Panel.js.map +1 -0
  94. package/dist/kurot/components/ProgressBar.d.ts +48 -0
  95. package/dist/kurot/components/ProgressBar.d.ts.map +1 -0
  96. package/dist/kurot/components/ProgressBar.js +180 -0
  97. package/dist/kurot/components/ProgressBar.js.map +1 -0
  98. package/dist/kurot/components/RadioButton.d.ts +86 -0
  99. package/dist/kurot/components/RadioButton.d.ts.map +1 -0
  100. package/dist/kurot/components/RadioButton.js +246 -0
  101. package/dist/kurot/components/RadioButton.js.map +1 -0
  102. package/dist/kurot/components/Range.d.ts +41 -0
  103. package/dist/kurot/components/Range.d.ts.map +1 -0
  104. package/dist/kurot/components/Range.js +144 -0
  105. package/dist/kurot/components/Range.js.map +1 -0
  106. package/dist/kurot/components/Rect.d.ts +33 -0
  107. package/dist/kurot/components/Rect.d.ts.map +1 -0
  108. package/dist/kurot/components/Rect.js +125 -0
  109. package/dist/kurot/components/Rect.js.map +1 -0
  110. package/dist/kurot/components/ScrollBarBase.d.ts +27 -0
  111. package/dist/kurot/components/ScrollBarBase.d.ts.map +1 -0
  112. package/dist/kurot/components/ScrollBarBase.js +50 -0
  113. package/dist/kurot/components/ScrollBarBase.js.map +1 -0
  114. package/dist/kurot/components/Scroller.d.ts +82 -0
  115. package/dist/kurot/components/Scroller.d.ts.map +1 -0
  116. package/dist/kurot/components/Scroller.js +416 -0
  117. package/dist/kurot/components/Scroller.js.map +1 -0
  118. package/dist/kurot/components/Skin.d.ts +64 -0
  119. package/dist/kurot/components/Skin.d.ts.map +1 -0
  120. package/dist/kurot/components/Skin.js +136 -0
  121. package/dist/kurot/components/Skin.js.map +1 -0
  122. package/dist/kurot/components/SliderBase.d.ts +60 -0
  123. package/dist/kurot/components/SliderBase.d.ts.map +1 -0
  124. package/dist/kurot/components/SliderBase.js +197 -0
  125. package/dist/kurot/components/SliderBase.js.map +1 -0
  126. package/dist/kurot/components/TabBar.d.ts +29 -0
  127. package/dist/kurot/components/TabBar.d.ts.map +1 -0
  128. package/dist/kurot/components/TabBar.js +92 -0
  129. package/dist/kurot/components/TabBar.js.map +1 -0
  130. package/dist/kurot/components/TextInput.d.ts +49 -0
  131. package/dist/kurot/components/TextInput.d.ts.map +1 -0
  132. package/dist/kurot/components/TextInput.js +157 -0
  133. package/dist/kurot/components/TextInput.js.map +1 -0
  134. package/dist/kurot/components/ToggleButton.d.ts +11 -0
  135. package/dist/kurot/components/ToggleButton.d.ts.map +1 -0
  136. package/dist/kurot/components/ToggleButton.js +14 -0
  137. package/dist/kurot/components/ToggleButton.js.map +1 -0
  138. package/dist/kurot/components/ToggleSwitch.d.ts +10 -0
  139. package/dist/kurot/components/ToggleSwitch.d.ts.map +1 -0
  140. package/dist/kurot/components/ToggleSwitch.js +10 -0
  141. package/dist/kurot/components/ToggleSwitch.js.map +1 -0
  142. package/dist/kurot/components/TouchScroll.d.ts +38 -0
  143. package/dist/kurot/components/TouchScroll.d.ts.map +1 -0
  144. package/dist/kurot/components/TouchScroll.js +133 -0
  145. package/dist/kurot/components/TouchScroll.js.map +1 -0
  146. package/dist/kurot/components/UILayer.d.ts +14 -0
  147. package/dist/kurot/components/UILayer.d.ts.map +1 -0
  148. package/dist/kurot/components/UILayer.js +38 -0
  149. package/dist/kurot/components/UILayer.js.map +1 -0
  150. package/dist/kurot/components/VScrollBar.d.ts +13 -0
  151. package/dist/kurot/components/VScrollBar.d.ts.map +1 -0
  152. package/dist/kurot/components/VScrollBar.js +55 -0
  153. package/dist/kurot/components/VScrollBar.js.map +1 -0
  154. package/dist/kurot/components/VSlider.d.ts +17 -0
  155. package/dist/kurot/components/VSlider.d.ts.map +1 -0
  156. package/dist/kurot/components/VSlider.js +49 -0
  157. package/dist/kurot/components/VSlider.js.map +1 -0
  158. package/dist/kurot/components/ViewStack.d.ts +42 -0
  159. package/dist/kurot/components/ViewStack.d.ts.map +1 -0
  160. package/dist/kurot/components/ViewStack.js +160 -0
  161. package/dist/kurot/components/ViewStack.js.map +1 -0
  162. package/dist/kurot/components/index.d.ts +34 -0
  163. package/dist/kurot/components/index.d.ts.map +1 -0
  164. package/dist/kurot/components/index.js +34 -0
  165. package/dist/kurot/components/index.js.map +1 -0
  166. package/dist/kurot/core/AssetAdapterRegistry.d.ts +4 -0
  167. package/dist/kurot/core/AssetAdapterRegistry.d.ts.map +1 -0
  168. package/dist/kurot/core/AssetAdapterRegistry.js +9 -0
  169. package/dist/kurot/core/AssetAdapterRegistry.js.map +1 -0
  170. package/dist/kurot/core/DefaultAssetAdapter.d.ts +10 -0
  171. package/dist/kurot/core/DefaultAssetAdapter.d.ts.map +1 -0
  172. package/dist/kurot/core/DefaultAssetAdapter.js +22 -0
  173. package/dist/kurot/core/DefaultAssetAdapter.js.map +1 -0
  174. package/dist/kurot/core/DefaultThemeAdapter.d.ts +8 -0
  175. package/dist/kurot/core/DefaultThemeAdapter.d.ts.map +1 -0
  176. package/dist/kurot/core/DefaultThemeAdapter.js +27 -0
  177. package/dist/kurot/core/DefaultThemeAdapter.js.map +1 -0
  178. package/dist/kurot/core/Direction.d.ts +10 -0
  179. package/dist/kurot/core/Direction.d.ts.map +1 -0
  180. package/dist/kurot/core/Direction.js +10 -0
  181. package/dist/kurot/core/Direction.js.map +1 -0
  182. package/dist/kurot/core/IAssetAdapter.d.ts +15 -0
  183. package/dist/kurot/core/IAssetAdapter.d.ts.map +1 -0
  184. package/dist/kurot/core/IAssetAdapter.js +2 -0
  185. package/dist/kurot/core/IAssetAdapter.js.map +1 -0
  186. package/dist/kurot/core/IDisplayText.d.ts +12 -0
  187. package/dist/kurot/core/IDisplayText.d.ts.map +1 -0
  188. package/dist/kurot/core/IDisplayText.js +2 -0
  189. package/dist/kurot/core/IDisplayText.js.map +1 -0
  190. package/dist/kurot/core/IItemRenderer.d.ts +19 -0
  191. package/dist/kurot/core/IItemRenderer.d.ts.map +1 -0
  192. package/dist/kurot/core/IItemRenderer.js +2 -0
  193. package/dist/kurot/core/IItemRenderer.js.map +1 -0
  194. package/dist/kurot/core/IThemeAdapter.d.ts +14 -0
  195. package/dist/kurot/core/IThemeAdapter.d.ts.map +1 -0
  196. package/dist/kurot/core/IThemeAdapter.js +2 -0
  197. package/dist/kurot/core/IThemeAdapter.js.map +1 -0
  198. package/dist/kurot/core/IUIComponent.d.ts +63 -0
  199. package/dist/kurot/core/IUIComponent.d.ts.map +1 -0
  200. package/dist/kurot/core/IUIComponent.js +2 -0
  201. package/dist/kurot/core/IUIComponent.js.map +1 -0
  202. package/dist/kurot/core/IViewport.d.ts +12 -0
  203. package/dist/kurot/core/IViewport.d.ts.map +1 -0
  204. package/dist/kurot/core/IViewport.js +2 -0
  205. package/dist/kurot/core/IViewport.js.map +1 -0
  206. package/dist/kurot/core/ScrollPolicy.d.ts +9 -0
  207. package/dist/kurot/core/ScrollPolicy.d.ts.map +1 -0
  208. package/dist/kurot/core/ScrollPolicy.js +9 -0
  209. package/dist/kurot/core/ScrollPolicy.js.map +1 -0
  210. package/dist/kurot/core/Theme.d.ts +53 -0
  211. package/dist/kurot/core/Theme.d.ts.map +1 -0
  212. package/dist/kurot/core/Theme.js +169 -0
  213. package/dist/kurot/core/Theme.js.map +1 -0
  214. package/dist/kurot/core/UIComponent.d.ts +2 -0
  215. package/dist/kurot/core/UIComponent.d.ts.map +1 -0
  216. package/dist/kurot/core/UIComponent.js +4 -0
  217. package/dist/kurot/core/UIComponent.js.map +1 -0
  218. package/dist/kurot/core/UIState.d.ts +84 -0
  219. package/dist/kurot/core/UIState.d.ts.map +1 -0
  220. package/dist/kurot/core/UIState.js +512 -0
  221. package/dist/kurot/core/UIState.js.map +1 -0
  222. package/dist/kurot/core/Validator.d.ts +46 -0
  223. package/dist/kurot/core/Validator.d.ts.map +1 -0
  224. package/dist/kurot/core/Validator.js +368 -0
  225. package/dist/kurot/core/Validator.js.map +1 -0
  226. package/dist/kurot/core/index.d.ts +17 -0
  227. package/dist/kurot/core/index.d.ts.map +1 -0
  228. package/dist/kurot/core/index.js +10 -0
  229. package/dist/kurot/core/index.js.map +1 -0
  230. package/dist/kurot/events/CollectionEvent.d.ts +22 -0
  231. package/dist/kurot/events/CollectionEvent.d.ts.map +1 -0
  232. package/dist/kurot/events/CollectionEvent.js +37 -0
  233. package/dist/kurot/events/CollectionEvent.js.map +1 -0
  234. package/dist/kurot/events/ItemTapEvent.d.ts +11 -0
  235. package/dist/kurot/events/ItemTapEvent.d.ts.map +1 -0
  236. package/dist/kurot/events/ItemTapEvent.js +24 -0
  237. package/dist/kurot/events/ItemTapEvent.js.map +1 -0
  238. package/dist/kurot/events/PropertyEvent.d.ts +8 -0
  239. package/dist/kurot/events/PropertyEvent.d.ts.map +1 -0
  240. package/dist/kurot/events/PropertyEvent.js +20 -0
  241. package/dist/kurot/events/PropertyEvent.js.map +1 -0
  242. package/dist/kurot/events/ScrollerThrowEvent.d.ts +17 -0
  243. package/dist/kurot/events/ScrollerThrowEvent.d.ts.map +1 -0
  244. package/dist/kurot/events/ScrollerThrowEvent.js +22 -0
  245. package/dist/kurot/events/ScrollerThrowEvent.js.map +1 -0
  246. package/dist/kurot/events/UIEvent.d.ts +29 -0
  247. package/dist/kurot/events/UIEvent.d.ts.map +1 -0
  248. package/dist/kurot/events/UIEvent.js +39 -0
  249. package/dist/kurot/events/UIEvent.js.map +1 -0
  250. package/dist/kurot/events/index.d.ts +6 -0
  251. package/dist/kurot/events/index.d.ts.map +1 -0
  252. package/dist/kurot/events/index.js +6 -0
  253. package/dist/kurot/events/index.js.map +1 -0
  254. package/dist/kurot/layouts/BasicLayout.d.ts +13 -0
  255. package/dist/kurot/layouts/BasicLayout.d.ts.map +1 -0
  256. package/dist/kurot/layouts/BasicLayout.js +146 -0
  257. package/dist/kurot/layouts/BasicLayout.js.map +1 -0
  258. package/dist/kurot/layouts/ColumnAlign.d.ts +9 -0
  259. package/dist/kurot/layouts/ColumnAlign.d.ts.map +1 -0
  260. package/dist/kurot/layouts/ColumnAlign.js +9 -0
  261. package/dist/kurot/layouts/ColumnAlign.js.map +1 -0
  262. package/dist/kurot/layouts/HorizontalLayout.d.ts +23 -0
  263. package/dist/kurot/layouts/HorizontalLayout.d.ts.map +1 -0
  264. package/dist/kurot/layouts/HorizontalLayout.js +405 -0
  265. package/dist/kurot/layouts/HorizontalLayout.js.map +1 -0
  266. package/dist/kurot/layouts/ILayoutTarget.d.ts +25 -0
  267. package/dist/kurot/layouts/ILayoutTarget.d.ts.map +1 -0
  268. package/dist/kurot/layouts/ILayoutTarget.js +2 -0
  269. package/dist/kurot/layouts/ILayoutTarget.js.map +1 -0
  270. package/dist/kurot/layouts/JustifyAlign.d.ts +8 -0
  271. package/dist/kurot/layouts/JustifyAlign.d.ts.map +1 -0
  272. package/dist/kurot/layouts/JustifyAlign.js +8 -0
  273. package/dist/kurot/layouts/JustifyAlign.js.map +1 -0
  274. package/dist/kurot/layouts/LayoutBase.d.ts +23 -0
  275. package/dist/kurot/layouts/LayoutBase.d.ts.map +1 -0
  276. package/dist/kurot/layouts/LayoutBase.js +45 -0
  277. package/dist/kurot/layouts/LayoutBase.js.map +1 -0
  278. package/dist/kurot/layouts/LinearLayoutBase.d.ts +70 -0
  279. package/dist/kurot/layouts/LinearLayoutBase.d.ts.map +1 -0
  280. package/dist/kurot/layouts/LinearLayoutBase.js +246 -0
  281. package/dist/kurot/layouts/LinearLayoutBase.js.map +1 -0
  282. package/dist/kurot/layouts/RowAlign.d.ts +9 -0
  283. package/dist/kurot/layouts/RowAlign.d.ts.map +1 -0
  284. package/dist/kurot/layouts/RowAlign.js +9 -0
  285. package/dist/kurot/layouts/RowAlign.js.map +1 -0
  286. package/dist/kurot/layouts/TileLayout.d.ts +79 -0
  287. package/dist/kurot/layouts/TileLayout.d.ts.map +1 -0
  288. package/dist/kurot/layouts/TileLayout.js +577 -0
  289. package/dist/kurot/layouts/TileLayout.js.map +1 -0
  290. package/dist/kurot/layouts/TileOrientation.d.ts +8 -0
  291. package/dist/kurot/layouts/TileOrientation.d.ts.map +1 -0
  292. package/dist/kurot/layouts/TileOrientation.js +8 -0
  293. package/dist/kurot/layouts/TileOrientation.js.map +1 -0
  294. package/dist/kurot/layouts/VerticalLayout.d.ts +23 -0
  295. package/dist/kurot/layouts/VerticalLayout.d.ts.map +1 -0
  296. package/dist/kurot/layouts/VerticalLayout.js +406 -0
  297. package/dist/kurot/layouts/VerticalLayout.js.map +1 -0
  298. package/dist/kurot/layouts/index.d.ts +12 -0
  299. package/dist/kurot/layouts/index.d.ts.map +1 -0
  300. package/dist/kurot/layouts/index.js +11 -0
  301. package/dist/kurot/layouts/index.js.map +1 -0
  302. package/dist/kurot/states/AddItems.d.ts +17 -0
  303. package/dist/kurot/states/AddItems.d.ts.map +1 -0
  304. package/dist/kurot/states/AddItems.js +42 -0
  305. package/dist/kurot/states/AddItems.js.map +1 -0
  306. package/dist/kurot/states/IOverride.d.ts +12 -0
  307. package/dist/kurot/states/IOverride.d.ts.map +1 -0
  308. package/dist/kurot/states/IOverride.js +2 -0
  309. package/dist/kurot/states/IOverride.js.map +1 -0
  310. package/dist/kurot/states/SetProperty.d.ts +19 -0
  311. package/dist/kurot/states/SetProperty.d.ts.map +1 -0
  312. package/dist/kurot/states/SetProperty.js +50 -0
  313. package/dist/kurot/states/SetProperty.js.map +1 -0
  314. package/dist/kurot/states/SetStateProperty.d.ts +17 -0
  315. package/dist/kurot/states/SetStateProperty.d.ts.map +1 -0
  316. package/dist/kurot/states/SetStateProperty.js +35 -0
  317. package/dist/kurot/states/SetStateProperty.js.map +1 -0
  318. package/dist/kurot/states/State.d.ts +14 -0
  319. package/dist/kurot/states/State.d.ts.map +1 -0
  320. package/dist/kurot/states/State.js +18 -0
  321. package/dist/kurot/states/State.js.map +1 -0
  322. package/dist/kurot/states/index.d.ts +6 -0
  323. package/dist/kurot/states/index.d.ts.map +1 -0
  324. package/dist/kurot/states/index.js +5 -0
  325. package/dist/kurot/states/index.js.map +1 -0
  326. package/package.json +55 -0
@@ -0,0 +1,56 @@
1
+ import { EventDispatcher, type EventMap } from '@kurot/core';
2
+ import { CollectionEvent } from '../events/CollectionEvent.js';
3
+ import type { ICollection } from './ICollection.js';
4
+ export interface ArrayCollectionEvents extends EventMap {
5
+ [CollectionEvent.COLLECTION_CHANGE]: CollectionEvent;
6
+ }
7
+ /**
8
+ * A wrapper around a plain `unknown[]` that implements {@link ICollection}.
9
+ *
10
+ * Dispatches {@link CollectionEvent.COLLECTION_CHANGE} whenever items are
11
+ * added, removed, replaced, or the entire source is reset — allowing
12
+ * data-driven components (DataGroup, List, TabBar…) to update efficiently.
13
+ *
14
+ * @defaultProperty source
15
+ */
16
+ export declare class ArrayCollection extends EventDispatcher<ArrayCollectionEvents> implements ICollection {
17
+ private _source;
18
+ constructor(source?: unknown[]);
19
+ get source(): unknown[];
20
+ set source(value: unknown[]);
21
+ get length(): number;
22
+ getItemAt(index: number): unknown;
23
+ getItemIndex(item: unknown): number;
24
+ addItem(item: unknown): void;
25
+ addItemAt(item: unknown, index: number): void;
26
+ removeItemAt(index: number): unknown;
27
+ replaceItemAt(item: unknown, index: number): unknown;
28
+ itemUpdated(item: unknown): void;
29
+ removeAll(): void;
30
+ /**
31
+ * Replace all items with a new source. Unlike setting `source`, this does
32
+ * **not** reset scroll position in the view — individual add/remove events
33
+ * are dispatched instead.
34
+ */
35
+ replaceAll(newSource: unknown[]): void;
36
+ refresh(): void;
37
+ /**
38
+ * Sort the collection in place using a comparator function.
39
+ * Dispatches REFRESH after sorting.
40
+ */
41
+ sort(compareFunction: (a: unknown, b: unknown) => number): void;
42
+ /**
43
+ * Sort the collection by a field name (Egret-compatible sortOn).
44
+ * @param fieldName Property name to sort by.
45
+ * @param options Sort options: 0=ascending string, 4=descending, 16=numeric.
46
+ */
47
+ sortOn(fieldName: string, options?: number): void;
48
+ /**
49
+ * Filter the collection in place, keeping only items that pass the test.
50
+ * Dispatches REFRESH after filtering.
51
+ * Note: items that are filtered out are removed from the source array.
52
+ */
53
+ filterFunction(testFn: (item: unknown) => boolean): void;
54
+ private _dispatchCoEvent;
55
+ }
56
+ //# sourceMappingURL=ArrayCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArrayCollection.d.ts","sourceRoot":"","sources":["../../../src/kurot/collections/ArrayCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAuB,MAAM,8BAA8B,CAAC;AACpF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,WAAW,qBAAsB,SAAQ,QAAQ;IACtD,CAAC,eAAe,CAAC,iBAAiB,CAAC,EAAE,eAAe,CAAC;CACrD;AAED;;;;;;;;GAQG;AACH,qBAAa,eAAgB,SAAQ,eAAe,CAAC,qBAAqB,CAAE,YAAW,WAAW;IAGjG,OAAO,CAAC,OAAO,CAAY;gBAIR,MAAM,CAAC,EAAE,OAAO,EAAE;IAOrC,IAAW,MAAM,IAAI,OAAO,EAAE,CAE7B;IAED,IAAW,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAGjC;IAED,IAAW,MAAM,IAAI,MAAM,CAE1B;IAIM,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIjC,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM;IAInC,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAK5B,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAQ7C,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IASpC,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IASpD,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAOhC,SAAS,IAAI,IAAI;IAMxB;;;;OAIG;IACI,UAAU,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI;IActC,OAAO,IAAI,IAAI;IAItB;;;OAGG;IACI,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,KAAK,MAAM,GAAG,IAAI;IAKtE;;;;OAIG;IACI,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,IAAI;IAiBnD;;;;OAIG;IACI,cAAc,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,GAAG,IAAI;IAO/D,OAAO,CAAC,gBAAgB;CASxB"}
@@ -0,0 +1,143 @@
1
+ import { EventDispatcher } from '@kurot/core';
2
+ import { CollectionEvent, CollectionEventKind } from '../events/CollectionEvent.js';
3
+ /**
4
+ * A wrapper around a plain `unknown[]` that implements {@link ICollection}.
5
+ *
6
+ * Dispatches {@link CollectionEvent.COLLECTION_CHANGE} whenever items are
7
+ * added, removed, replaced, or the entire source is reset — allowing
8
+ * data-driven components (DataGroup, List, TabBar…) to update efficiently.
9
+ *
10
+ * @defaultProperty source
11
+ */
12
+ export class ArrayCollection extends EventDispatcher {
13
+ // ── Instance fields ───────────────────────────────────────────────────
14
+ _source;
15
+ // ── Constructor ───────────────────────────────────────────────────────
16
+ constructor(source) {
17
+ super();
18
+ this._source = source ?? [];
19
+ }
20
+ // ── Getters / Setters ─────────────────────────────────────────────────
21
+ get source() {
22
+ return this._source;
23
+ }
24
+ set source(value) {
25
+ this._source = value ?? [];
26
+ this._dispatchCoEvent(CollectionEventKind.RESET);
27
+ }
28
+ get length() {
29
+ return this._source.length;
30
+ }
31
+ // ── Public methods ────────────────────────────────────────────────────
32
+ getItemAt(index) {
33
+ return this._source[index];
34
+ }
35
+ getItemIndex(item) {
36
+ return this._source.indexOf(item);
37
+ }
38
+ addItem(item) {
39
+ this._source.push(item);
40
+ this._dispatchCoEvent(CollectionEventKind.ADD, this._source.length - 1, -1, [item]);
41
+ }
42
+ addItemAt(item, index) {
43
+ if (index < 0 || index > this._source.length) {
44
+ throw new RangeError(`ArrayCollection.addItemAt: index ${index} out of range`);
45
+ }
46
+ this._source.splice(index, 0, item);
47
+ this._dispatchCoEvent(CollectionEventKind.ADD, index, -1, [item]);
48
+ }
49
+ removeItemAt(index) {
50
+ if (index < 0 || index >= this._source.length) {
51
+ throw new RangeError(`ArrayCollection.removeItemAt: index ${index} out of range`);
52
+ }
53
+ const item = this._source.splice(index, 1)[0];
54
+ this._dispatchCoEvent(CollectionEventKind.REMOVE, index, -1, [item]);
55
+ return item;
56
+ }
57
+ replaceItemAt(item, index) {
58
+ if (index < 0 || index >= this._source.length) {
59
+ throw new RangeError(`ArrayCollection.replaceItemAt: index ${index} out of range`);
60
+ }
61
+ const old = this._source.splice(index, 1, item)[0];
62
+ this._dispatchCoEvent(CollectionEventKind.REPLACE, index, -1, [item], [old]);
63
+ return old;
64
+ }
65
+ itemUpdated(item) {
66
+ const index = this.getItemIndex(item);
67
+ if (index !== -1) {
68
+ this._dispatchCoEvent(CollectionEventKind.UPDATE, index, -1, [item]);
69
+ }
70
+ }
71
+ removeAll() {
72
+ const items = this._source.slice();
73
+ this._source.length = 0;
74
+ this._dispatchCoEvent(CollectionEventKind.REMOVE, 0, -1, items);
75
+ }
76
+ /**
77
+ * Replace all items with a new source. Unlike setting `source`, this does
78
+ * **not** reset scroll position in the view — individual add/remove events
79
+ * are dispatched instead.
80
+ */
81
+ replaceAll(newSource) {
82
+ const src = newSource ?? [];
83
+ const newLen = src.length;
84
+ const oldLen = this._source.length;
85
+ for (let i = newLen; i < oldLen; i++) {
86
+ this.removeItemAt(newLen);
87
+ }
88
+ for (let i = 0; i < newLen; i++) {
89
+ if (i >= oldLen)
90
+ this.addItemAt(src[i], i);
91
+ else
92
+ this.replaceItemAt(src[i], i);
93
+ }
94
+ this._source = src;
95
+ }
96
+ refresh() {
97
+ this._dispatchCoEvent(CollectionEventKind.REFRESH);
98
+ }
99
+ /**
100
+ * Sort the collection in place using a comparator function.
101
+ * Dispatches REFRESH after sorting.
102
+ */
103
+ sort(compareFunction) {
104
+ this._source.sort(compareFunction);
105
+ this._dispatchCoEvent(CollectionEventKind.REFRESH);
106
+ }
107
+ /**
108
+ * Sort the collection by a field name (Egret-compatible sortOn).
109
+ * @param fieldName Property name to sort by.
110
+ * @param options Sort options: 0=ascending string, 4=descending, 16=numeric.
111
+ */
112
+ sortOn(fieldName, options = 0) {
113
+ const descending = (options & 4) !== 0;
114
+ const numeric = (options & 16) !== 0;
115
+ this._source.sort((a, b) => {
116
+ const va = a[fieldName];
117
+ const vb = b[fieldName];
118
+ let result;
119
+ if (numeric) {
120
+ result = (Number(va) || 0) - (Number(vb) || 0);
121
+ }
122
+ else {
123
+ result = String(va ?? '').localeCompare(String(vb ?? ''));
124
+ }
125
+ return descending ? -result : result;
126
+ });
127
+ this._dispatchCoEvent(CollectionEventKind.REFRESH);
128
+ }
129
+ /**
130
+ * Filter the collection in place, keeping only items that pass the test.
131
+ * Dispatches REFRESH after filtering.
132
+ * Note: items that are filtered out are removed from the source array.
133
+ */
134
+ filterFunction(testFn) {
135
+ this._source = this._source.filter(testFn);
136
+ this._dispatchCoEvent(CollectionEventKind.REFRESH);
137
+ }
138
+ // ── Private methods ───────────────────────────────────────────────────
139
+ _dispatchCoEvent(kind, location = -1, oldLocation = -1, items = [], oldItems = []) {
140
+ CollectionEvent.dispatchCollectionEvent(this, kind, location, oldLocation, items, oldItems);
141
+ }
142
+ }
143
+ //# sourceMappingURL=ArrayCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArrayCollection.js","sourceRoot":"","sources":["../../../src/kurot/collections/ArrayCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAiB,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAOpF;;;;;;;;GAQG;AACH,MAAM,OAAO,eAAgB,SAAQ,eAAsC;IAC1E,yEAAyE;IAEjE,OAAO,CAAY;IAE3B,yEAAyE;IAEzE,YAAmB,MAAkB;QACpC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED,yEAAyE;IAEzE,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAED,IAAW,MAAM,CAAC,KAAgB;QACjC,IAAI,CAAC,OAAO,GAAG,KAAK,IAAI,EAAE,CAAC;QAC3B,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED,yEAAyE;IAElE,SAAS,CAAC,KAAa;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAEM,YAAY,CAAC,IAAa;QAChC,OAAO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C,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;YAChD,CAAC;iBAAM,CAAC;gBACP,MAAM,GAAG,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YAC3D,CAAC;YACD,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;QACtC,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACpD,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,MAAkC;QACvD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,yEAAyE;IAEjE,gBAAgB,CACvB,IAAyB,EACzB,QAAQ,GAAG,CAAC,CAAC,EACb,WAAW,GAAG,CAAC,CAAC,EAChB,QAAmB,EAAE,EACrB,WAAsB,EAAE;QAExB,eAAe,CAAC,uBAAuB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC7F,CAAC;CACD"}
@@ -0,0 +1,24 @@
1
+ import type { IEventDispatcher } from '@kurot/core';
2
+ /**
3
+ * Interface for collection data sources used by data-driven components
4
+ * (DataGroup, List, TabBar, etc.).
5
+ *
6
+ * Implementations dispatch {@link CollectionEvent.COLLECTION_CHANGE} when
7
+ * the underlying data changes so that views can update accordingly.
8
+ */
9
+ export interface ICollection extends IEventDispatcher {
10
+ /**
11
+ * The number of items in this collection.
12
+ * `0` means empty, `-1` means length is unknown.
13
+ */
14
+ readonly length: number;
15
+ /**
16
+ * Returns the item at the specified index, or `undefined` if none.
17
+ */
18
+ getItemAt(index: number): unknown;
19
+ /**
20
+ * Returns the index of the given item, or `-1` if not found.
21
+ */
22
+ getItemIndex(item: unknown): number;
23
+ }
24
+ //# sourceMappingURL=ICollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ICollection.d.ts","sourceRoot":"","sources":["../../../src/kurot/collections/ICollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACpD;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAElC;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;CACpC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ICollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ICollection.js","sourceRoot":"","sources":["../../../src/kurot/collections/ICollection.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export type { ICollection } from './ICollection.js';
2
+ export { ArrayCollection } from './ArrayCollection.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/kurot/collections/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { ArrayCollection } from './ArrayCollection.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/kurot/collections/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Simple value-tween utility used by TouchScroll for throw animations.
3
+ * Driven by the core ticker (rAF).
4
+ */
5
+ export declare class Animation {
6
+ private _updateFunction;
7
+ private _thisObject;
8
+ private _easerFunction;
9
+ private _isPlaying;
10
+ private _duration;
11
+ private _currentValue;
12
+ private _from;
13
+ private _to;
14
+ private _startTime;
15
+ private _endFunction?;
16
+ constructor(updateFunction: (animation: Animation) => void, thisObject: unknown);
17
+ get isPlaying(): boolean;
18
+ get duration(): number;
19
+ set duration(value: number);
20
+ get currentValue(): number;
21
+ get from(): number;
22
+ set from(value: number);
23
+ get to(): number;
24
+ set to(value: number);
25
+ get endFunction(): ((animation: Animation) => void) | undefined;
26
+ set endFunction(value: ((animation: Animation) => void) | undefined);
27
+ get easerFunction(): ((fraction: number) => number) | undefined;
28
+ set easerFunction(value: ((fraction: number) => number) | undefined);
29
+ play(): void;
30
+ stop(): void;
31
+ private _start;
32
+ private _doInterval;
33
+ }
34
+ //# sourceMappingURL=Animation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Animation.d.ts","sourceRoot":"","sources":["../../../src/kurot/components/Animation.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,qBAAa,SAAS;IAGrB,OAAO,CAAC,eAAe,CAAiC;IACxD,OAAO,CAAC,WAAW,CAAU;IAC7B,OAAO,CAAC,cAAc,CAAuF;IAC7G,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAO;IACxB,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,GAAG,CAAK;IAChB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,YAAY,CAAC,CAAiC;gBAInC,cAAc,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,EAAE,UAAU,EAAE,OAAO;IAOtF,IAAW,SAAS,IAAI,OAAO,CAE9B;IAED,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,IAAW,QAAQ,CAAC,KAAK,EAAE,MAAM,EAEhC;IAED,IAAW,YAAY,IAAI,MAAM,CAEhC;IAED,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,IAAI,CAAC,KAAK,EAAE,MAAM,EAE5B;IAED,IAAW,EAAE,IAAI,MAAM,CAEtB;IAED,IAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAE1B;IAED,IAAW,WAAW,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC,GAAG,SAAS,CAErE;IAED,IAAW,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC,GAAG,SAAS,EAEzE;IAED,IAAW,aAAa,IAAI,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,SAAS,CAErE;IAED,IAAW,aAAa,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,SAAS,EAEzE;IAIM,IAAI,IAAI,IAAI;IAKZ,IAAI,IAAI,IAAI;IAQnB,OAAO,CAAC,MAAM;IAQd,OAAO,CAAC,WAAW,CAoBjB;CACF"}
@@ -0,0 +1,100 @@
1
+ import { ticker, getTimer } from '@kurot/core';
2
+ /**
3
+ * Simple value-tween utility used by TouchScroll for throw animations.
4
+ * Driven by the core ticker (rAF).
5
+ */
6
+ export class Animation {
7
+ // ── Instance fields ───────────────────────────────────────────────────
8
+ _updateFunction;
9
+ _thisObject;
10
+ _easerFunction = f => -(Math.cos(Math.PI * f) - 1) * 0.5;
11
+ _isPlaying = false;
12
+ _duration = 500;
13
+ _currentValue = 0;
14
+ _from = 0;
15
+ _to = 0;
16
+ _startTime = 0;
17
+ _endFunction;
18
+ // ── Constructor ───────────────────────────────────────────────────────
19
+ constructor(updateFunction, thisObject) {
20
+ this._updateFunction = updateFunction;
21
+ this._thisObject = thisObject;
22
+ }
23
+ // ── Getters / Setters ─────────────────────────────────────────────────
24
+ get isPlaying() {
25
+ return this._isPlaying;
26
+ }
27
+ get duration() {
28
+ return this._duration;
29
+ }
30
+ set duration(value) {
31
+ this._duration = value;
32
+ }
33
+ get currentValue() {
34
+ return this._currentValue;
35
+ }
36
+ get from() {
37
+ return this._from;
38
+ }
39
+ set from(value) {
40
+ this._from = value;
41
+ }
42
+ get to() {
43
+ return this._to;
44
+ }
45
+ set to(value) {
46
+ this._to = value;
47
+ }
48
+ get endFunction() {
49
+ return this._endFunction;
50
+ }
51
+ set endFunction(value) {
52
+ this._endFunction = value;
53
+ }
54
+ get easerFunction() {
55
+ return this._easerFunction;
56
+ }
57
+ set easerFunction(value) {
58
+ this._easerFunction = value;
59
+ }
60
+ // ── Public methods ────────────────────────────────────────────────────
61
+ play() {
62
+ this.stop();
63
+ this._start();
64
+ }
65
+ stop() {
66
+ this._isPlaying = false;
67
+ this._startTime = 0;
68
+ ticker.stopTick(this._doInterval, this);
69
+ }
70
+ // ── Private methods ───────────────────────────────────────────────────
71
+ _start() {
72
+ this._isPlaying = false;
73
+ this._currentValue = 0;
74
+ this._startTime = getTimer();
75
+ this._doInterval(this._startTime);
76
+ ticker.startTick(this._doInterval, this);
77
+ }
78
+ _doInterval = (currentTime) => {
79
+ const runningTime = currentTime - this._startTime;
80
+ if (!this._isPlaying) {
81
+ this._isPlaying = true;
82
+ }
83
+ const duration = this._duration;
84
+ let fraction = duration === 0 ? 1 : Math.min(runningTime, duration) / duration;
85
+ if (this._easerFunction) {
86
+ fraction = this._easerFunction(fraction);
87
+ }
88
+ this._currentValue = this._from + (this._to - this._from) * fraction;
89
+ this._updateFunction.call(this._thisObject, this);
90
+ const isEnded = runningTime >= duration;
91
+ if (isEnded) {
92
+ this.stop();
93
+ }
94
+ if (isEnded && this._endFunction) {
95
+ this._endFunction.call(this._thisObject, this);
96
+ }
97
+ return true;
98
+ };
99
+ }
100
+ //# sourceMappingURL=Animation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Animation.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,GAAG,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC;QAC/E,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACzB,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC1C,CAAC;QACD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;QACrE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAClD,MAAM,OAAO,GAAG,WAAW,IAAI,QAAQ,CAAC;QACxC,IAAI,OAAO,EAAE,CAAC;YACb,IAAI,CAAC,IAAI,EAAE,CAAC;QACb,CAAC;QACD,IAAI,OAAO,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YAClC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC,CAAC;CACF"}
@@ -0,0 +1,61 @@
1
+ import { Component } from './Component.js';
2
+ import type { Texture } from '@kurot/core';
3
+ import type { IDisplayText } from '../core/IDisplayText.js';
4
+ import type { Image } from './Image.js';
5
+ import type { Label } from './Label.js';
6
+ /**
7
+ * Button component with label, icon, and state management.
8
+ *
9
+ * States: `up`, `down`, `disabled`, `upAndSelected`, `downAndSelected`, `disabledAndSelected`.
10
+ *
11
+ * When the button is tapped (and enabled), it calls `buttonReleased()` which subclasses
12
+ * can override. If `toggle` is true, the `selected` state is toggled automatically.
13
+ */
14
+ export declare class Button extends Component implements IDisplayText {
15
+ labelDisplay?: Label;
16
+ iconDisplay?: Image;
17
+ private _label;
18
+ private _icon?;
19
+ private _selected;
20
+ private _toggle;
21
+ private _touchCaptured;
22
+ private _touchStage?;
23
+ private _stickyHighlighting;
24
+ constructor();
25
+ get label(): string;
26
+ set label(value: string);
27
+ get text(): string;
28
+ get icon(): string | Texture | undefined;
29
+ set icon(value: string | Texture | undefined);
30
+ get selected(): boolean;
31
+ set selected(value: boolean);
32
+ get toggle(): boolean;
33
+ set toggle(value: boolean);
34
+ get touchCaptured(): boolean;
35
+ get enabled(): boolean;
36
+ set enabled(value: boolean);
37
+ partAdded(partName: string, instance: unknown): void;
38
+ $onRemoveFromStage(): void;
39
+ /**
40
+ * Return the current view state, layering the selected state on top of
41
+ * the base up/down/disabled states.
42
+ *
43
+ * Matches egret `ToggleButton.getCurrentState` (L132-145): if the skin
44
+ * does not export an `AndSelected` variant, the state falls back to `down`
45
+ * (or `disabled`) instead of returning a skin-missing state name that
46
+ * would leave the button visually blank.
47
+ */
48
+ protected getCurrentState(): string;
49
+ /**
50
+ * Called when the user taps the button (touch ends within the button bounds).
51
+ * Subclasses should override this to perform the button action.
52
+ * The base implementation handles toggle behavior.
53
+ */
54
+ protected buttonReleased(): void;
55
+ private _onTouchBegin;
56
+ private _onStageTouchEnd;
57
+ private _onTouchCancel;
58
+ private _removeStageListeners;
59
+ private _cancelTouchCapture;
60
+ }
61
+ //# sourceMappingURL=Button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/kurot/components/Button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,KAAK,EAAS,OAAO,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGxC;;;;;;;GAOG;AACH,qBAAa,MAAO,SAAQ,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@@ -0,0 +1,176 @@
1
+ import { Component } from './Component.js';
2
+ import { Event, TouchEvent, DisplayObject } from '@kurot/core';
3
+ import { PropertyEvent } from '../events/PropertyEvent.js';
4
+ /**
5
+ * Button component with label, icon, and state management.
6
+ *
7
+ * States: `up`, `down`, `disabled`, `upAndSelected`, `downAndSelected`, `disabledAndSelected`.
8
+ *
9
+ * When the button is tapped (and enabled), it calls `buttonReleased()` which subclasses
10
+ * can override. If `toggle` is true, the `selected` state is toggled automatically.
11
+ */
12
+ export class Button extends Component {
13
+ // ── Instance fields ───────────────────────────────────────────────────
14
+ labelDisplay;
15
+ iconDisplay;
16
+ _label = '';
17
+ _icon;
18
+ _selected = false;
19
+ _toggle = false;
20
+ _touchCaptured = false;
21
+ _touchStage;
22
+ _stickyHighlighting = false;
23
+ // ── Constructor ───────────────────────────────────────────────────────
24
+ constructor() {
25
+ super();
26
+ this.touchChildren = false;
27
+ this.addEventListener(TouchEvent.TOUCH_BEGIN, this._onTouchBegin);
28
+ }
29
+ // ── Getters / Setters ─────────────────────────────────────────────────
30
+ get label() {
31
+ return this._label;
32
+ }
33
+ set label(value) {
34
+ this._label = value;
35
+ if (this.labelDisplay) {
36
+ this.labelDisplay.text = value;
37
+ }
38
+ }
39
+ get text() {
40
+ return this._label;
41
+ }
42
+ get icon() {
43
+ return this._icon;
44
+ }
45
+ set icon(value) {
46
+ this._icon = value;
47
+ if (this.iconDisplay) {
48
+ this.iconDisplay.source = value;
49
+ }
50
+ }
51
+ get selected() {
52
+ return this._selected;
53
+ }
54
+ set selected(value) {
55
+ if (this._selected === value)
56
+ return;
57
+ this._selected = value;
58
+ PropertyEvent.dispatchPropertyEvent(this, 'selected');
59
+ this.invalidateState();
60
+ }
61
+ get toggle() {
62
+ return this._toggle;
63
+ }
64
+ set toggle(value) {
65
+ this._toggle = value;
66
+ }
67
+ get touchCaptured() {
68
+ return this._touchCaptured;
69
+ }
70
+ get enabled() {
71
+ return super.enabled;
72
+ }
73
+ set enabled(value) {
74
+ if (this.enabled === value)
75
+ return;
76
+ super.enabled = value;
77
+ this.invalidateState();
78
+ }
79
+ // ── Override methods ──────────────────────────────────────────────────
80
+ partAdded(partName, instance) {
81
+ super.partAdded(partName, instance);
82
+ if (partName === 'labelDisplay' && this.labelDisplay) {
83
+ this.labelDisplay.text = this._label;
84
+ }
85
+ else if (partName === 'iconDisplay' && this.iconDisplay) {
86
+ this.iconDisplay.source = this._icon;
87
+ }
88
+ }
89
+ $onRemoveFromStage() {
90
+ this._cancelTouchCapture();
91
+ super.$onRemoveFromStage();
92
+ }
93
+ /**
94
+ * Return the current view state, layering the selected state on top of
95
+ * the base up/down/disabled states.
96
+ *
97
+ * Matches egret `ToggleButton.getCurrentState` (L132-145): if the skin
98
+ * does not export an `AndSelected` variant, the state falls back to `down`
99
+ * (or `disabled`) instead of returning a skin-missing state name that
100
+ * would leave the button visually blank.
101
+ */
102
+ getCurrentState() {
103
+ // Base state (egret Button.getCurrentState)
104
+ let state;
105
+ if (!this.enabled) {
106
+ state = 'disabled';
107
+ }
108
+ else if (this._touchCaptured || this._stickyHighlighting) {
109
+ state = 'down';
110
+ }
111
+ else {
112
+ state = 'up';
113
+ }
114
+ if (!this._selected)
115
+ return state;
116
+ const selectedState = state + 'AndSelected';
117
+ if (this.skin?.hasState(selectedState))
118
+ return selectedState;
119
+ return state === 'disabled' ? 'disabled' : 'down';
120
+ }
121
+ // ── Protected methods ─────────────────────────────────────────────────
122
+ /**
123
+ * Called when the user taps the button (touch ends within the button bounds).
124
+ * Subclasses should override this to perform the button action.
125
+ * The base implementation handles toggle behavior.
126
+ */
127
+ buttonReleased() {
128
+ if (this._toggle) {
129
+ this.selected = !this.selected;
130
+ this._stickyHighlighting = this._selected;
131
+ }
132
+ else {
133
+ this.invalidateState();
134
+ }
135
+ this.dispatchEventWith(Event.CHANGE);
136
+ }
137
+ // ── Private methods ───────────────────────────────────────────────────
138
+ _onTouchBegin = (_e) => {
139
+ if (!this.enabled)
140
+ return;
141
+ this._touchCaptured = true;
142
+ this.invalidateState();
143
+ const stage = this.stage;
144
+ if (stage) {
145
+ this._touchStage = stage;
146
+ stage.addEventListener(TouchEvent.TOUCH_END, this._onStageTouchEnd);
147
+ stage.addEventListener(TouchEvent.TOUCH_CANCEL, this._onTouchCancel);
148
+ }
149
+ };
150
+ _onStageTouchEnd = (e) => {
151
+ this._removeStageListeners();
152
+ const target = e.target;
153
+ if (target instanceof DisplayObject && this.contains(target)) {
154
+ this.buttonReleased();
155
+ }
156
+ this._touchCaptured = false;
157
+ this.invalidateState();
158
+ };
159
+ _onTouchCancel = (_e) => {
160
+ this._cancelTouchCapture();
161
+ };
162
+ _removeStageListeners() {
163
+ const stage = this._touchStage;
164
+ if (!stage)
165
+ return;
166
+ stage.removeEventListener(TouchEvent.TOUCH_END, this._onStageTouchEnd);
167
+ stage.removeEventListener(TouchEvent.TOUCH_CANCEL, this._onTouchCancel);
168
+ this._touchStage = undefined;
169
+ }
170
+ _cancelTouchCapture() {
171
+ this._removeStageListeners();
172
+ this._touchCaptured = false;
173
+ this.invalidateState();
174
+ }
175
+ }
176
+ //# sourceMappingURL=Button.js.map