@spinjs/components 0.0.0-stage → 0.1.0-preview.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (590) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +61 -2
  3. package/dist/angle-slider/angle-slider.events.d.ts +30 -0
  4. package/dist/angle-slider/angle-slider.events.js +1 -0
  5. package/dist/angle-slider/angle-slider.machine.d.ts +9 -0
  6. package/dist/angle-slider/angle-slider.machine.js +56 -0
  7. package/dist/angle-slider/angle-slider.presentation.d.ts +194 -0
  8. package/dist/angle-slider/angle-slider.presentation.js +277 -0
  9. package/dist/angle-slider/angle-slider.state.d.ts +38 -0
  10. package/dist/angle-slider/angle-slider.state.js +71 -0
  11. package/dist/angle-slider/angle-slider.transitions.d.ts +11 -0
  12. package/dist/angle-slider/angle-slider.transitions.js +18 -0
  13. package/dist/angle-slider/examples/basic.html +42 -0
  14. package/dist/angle-slider/examples/knob.html +34 -0
  15. package/dist/angle-slider/examples/labeled.html +63 -0
  16. package/dist/angle-slider/examples/marks.html +42 -0
  17. package/dist/async-list/async-list.events.d.ts +23 -0
  18. package/dist/async-list/async-list.events.js +1 -0
  19. package/dist/async-list/async-list.machine.d.ts +5 -0
  20. package/dist/async-list/async-list.machine.js +96 -0
  21. package/dist/async-list/async-list.presentation.d.ts +294 -0
  22. package/dist/async-list/async-list.presentation.js +380 -0
  23. package/dist/async-list/async-list.state.d.ts +27 -0
  24. package/dist/async-list/async-list.state.js +31 -0
  25. package/dist/async-list/async-list.transitions.d.ts +16 -0
  26. package/dist/async-list/async-list.transitions.js +17 -0
  27. package/dist/async-list/examples/basic.html +88 -0
  28. package/dist/avatar/avatar.events.d.ts +18 -0
  29. package/dist/avatar/avatar.events.js +1 -0
  30. package/dist/avatar/avatar.machine.d.ts +5 -0
  31. package/dist/avatar/avatar.machine.js +47 -0
  32. package/dist/avatar/avatar.presentation.d.ts +75 -0
  33. package/dist/avatar/avatar.presentation.js +68 -0
  34. package/dist/avatar/avatar.state.d.ts +28 -0
  35. package/dist/avatar/avatar.state.js +20 -0
  36. package/dist/avatar/avatar.transitions.d.ts +7 -0
  37. package/dist/avatar/avatar.transitions.js +5 -0
  38. package/dist/avatar/examples/badge.html +24 -0
  39. package/dist/avatar/examples/badgeminimal.html +16 -0
  40. package/dist/avatar/examples/basic.html +24 -0
  41. package/dist/avatar/examples/count.html +29 -0
  42. package/dist/avatar/examples/fallback.html +24 -0
  43. package/dist/avatar/examples/group.html +28 -0
  44. package/dist/avatar/examples/icon.html +15 -0
  45. package/dist/avatar/examples/multiples.html +48 -0
  46. package/dist/avatar/examples/pills.html +58 -0
  47. package/dist/avatar/examples/pillsolid.html +21 -0
  48. package/dist/avatar/examples/rounded.html +13 -0
  49. package/dist/avatar/examples/status.html +24 -0
  50. package/dist/avatar/examples/statusminimal.html +16 -0
  51. package/dist/avatar/examples/trusted.html +33 -0
  52. package/dist/avatar/examples/verification.html +18 -0
  53. package/dist/carousel/carousel.events.d.ts +50 -0
  54. package/dist/carousel/carousel.events.js +1 -0
  55. package/dist/carousel/carousel.machine.d.ts +6 -0
  56. package/dist/carousel/carousel.machine.js +70 -0
  57. package/dist/carousel/carousel.presentation.d.ts +379 -0
  58. package/dist/carousel/carousel.presentation.js +554 -0
  59. package/dist/carousel/carousel.state.d.ts +61 -0
  60. package/dist/carousel/carousel.state.js +93 -0
  61. package/dist/carousel/carousel.transitions.d.ts +20 -0
  62. package/dist/carousel/carousel.transitions.js +49 -0
  63. package/dist/carousel/examples/autoplay.html +69 -0
  64. package/dist/carousel/examples/basic.html +56 -0
  65. package/dist/carousel/examples/cards.html +71 -0
  66. package/dist/carousel/examples/hero.html +54 -0
  67. package/dist/carousel/examples/infinite.html +68 -0
  68. package/dist/carousel/examples/minimal.html +47 -0
  69. package/dist/carousel/examples/testimonials.html +78 -0
  70. package/dist/carousel/examples/thumbnails.html +67 -0
  71. package/dist/carousel/examples/vertical.html +67 -0
  72. package/dist/cascade-select/cascade.events.d.ts +42 -0
  73. package/dist/cascade-select/cascade.events.js +1 -0
  74. package/dist/cascade-select/cascade.machine.d.ts +7 -0
  75. package/dist/cascade-select/cascade.machine.js +118 -0
  76. package/dist/cascade-select/cascade.presentation.d.ts +415 -0
  77. package/dist/cascade-select/cascade.presentation.js +771 -0
  78. package/dist/cascade-select/cascade.state.d.ts +58 -0
  79. package/dist/cascade-select/cascade.state.js +97 -0
  80. package/dist/cascade-select/cascade.transitions.d.ts +21 -0
  81. package/dist/cascade-select/cascade.transitions.js +54 -0
  82. package/dist/cascade-select/examples/basic.html +77 -0
  83. package/dist/color-picker/color-picker.events.d.ts +83 -0
  84. package/dist/color-picker/color-picker.events.js +1 -0
  85. package/dist/color-picker/color-picker.machine.d.ts +5 -0
  86. package/dist/color-picker/color-picker.machine.js +130 -0
  87. package/dist/color-picker/color-picker.presentation.d.ts +402 -0
  88. package/dist/color-picker/color-picker.presentation.js +761 -0
  89. package/dist/color-picker/color-picker.state.d.ts +41 -0
  90. package/dist/color-picker/color-picker.state.js +71 -0
  91. package/dist/color-picker/color-picker.transitions.d.ts +21 -0
  92. package/dist/color-picker/color-picker.transitions.js +99 -0
  93. package/dist/color-picker/examples/basic.html +106 -0
  94. package/dist/color-picker/examples/hue-wheel.html +57 -0
  95. package/dist/color-picker/examples/inline.html +61 -0
  96. package/dist/color-picker/examples/with-presets.html +49 -0
  97. package/dist/combobox/combobox.events.d.ts +61 -0
  98. package/dist/combobox/combobox.events.js +1 -0
  99. package/dist/combobox/combobox.machine.d.ts +7 -0
  100. package/dist/combobox/combobox.machine.js +234 -0
  101. package/dist/combobox/combobox.presentation.d.ts +433 -0
  102. package/dist/combobox/combobox.presentation.js +746 -0
  103. package/dist/combobox/combobox.state.d.ts +80 -0
  104. package/dist/combobox/combobox.state.js +71 -0
  105. package/dist/combobox/combobox.transitions.d.ts +28 -0
  106. package/dist/combobox/combobox.transitions.js +91 -0
  107. package/dist/combobox/examples/basic.html +61 -0
  108. package/dist/combobox/examples/directory.html +71 -0
  109. package/dist/combobox/examples/grouping.html +36 -0
  110. package/dist/combobox/examples/multiple.html +37 -0
  111. package/dist/controller.d.ts +52 -0
  112. package/dist/controller.js +90 -0
  113. package/dist/date-input/date-input.events.d.ts +37 -0
  114. package/dist/date-input/date-input.events.js +1 -0
  115. package/dist/date-input/date-input.machine.d.ts +6 -0
  116. package/dist/date-input/date-input.machine.js +61 -0
  117. package/dist/date-input/date-input.presentation.d.ts +133 -0
  118. package/dist/date-input/date-input.presentation.js +328 -0
  119. package/dist/date-input/date-input.state.d.ts +77 -0
  120. package/dist/date-input/date-input.state.js +260 -0
  121. package/dist/date-input/date-input.transitions.d.ts +22 -0
  122. package/dist/date-input/date-input.transitions.js +166 -0
  123. package/dist/date-input/examples/basic.html +18 -0
  124. package/dist/date-picker/date-picker.events.d.ts +42 -0
  125. package/dist/date-picker/date-picker.events.js +1 -0
  126. package/dist/date-picker/date-picker.machine.d.ts +6 -0
  127. package/dist/date-picker/date-picker.machine.js +102 -0
  128. package/dist/date-picker/date-picker.presentation.d.ts +256 -0
  129. package/dist/date-picker/date-picker.presentation.js +549 -0
  130. package/dist/date-picker/date-picker.state.d.ts +66 -0
  131. package/dist/date-picker/date-picker.state.js +177 -0
  132. package/dist/date-picker/date-picker.transitions.d.ts +23 -0
  133. package/dist/date-picker/date-picker.transitions.js +94 -0
  134. package/dist/date-picker/examples/appointment.html +49 -0
  135. package/dist/date-picker/examples/basic.html +6 -0
  136. package/dist/date-picker/examples/multiple.html +6 -0
  137. package/dist/date-picker/examples/pricing.html +6 -0
  138. package/dist/date-picker/examples/range.html +6 -0
  139. package/dist/date-picker/examples/unavailable.html +6 -0
  140. package/dist/editable/editable.events.d.ts +29 -0
  141. package/dist/editable/editable.events.js +1 -0
  142. package/dist/editable/editable.machine.d.ts +5 -0
  143. package/dist/editable/editable.machine.js +82 -0
  144. package/dist/editable/editable.presentation.d.ts +278 -0
  145. package/dist/editable/editable.presentation.js +388 -0
  146. package/dist/editable/editable.state.d.ts +54 -0
  147. package/dist/editable/editable.state.js +32 -0
  148. package/dist/editable/editable.transitions.d.ts +11 -0
  149. package/dist/editable/editable.transitions.js +9 -0
  150. package/dist/editable/examples/basic.html +43 -0
  151. package/dist/editable/examples/doubleclick.html +19 -0
  152. package/dist/editable/examples/inline-edit.html +13 -0
  153. package/dist/editable/examples/profile-field.html +20 -0
  154. package/dist/editable/examples/resize.html +19 -0
  155. package/dist/editable/examples/task-item.html +19 -0
  156. package/dist/editable/examples/title-editor.html +13 -0
  157. package/dist/editable/examples/with-controls.html +20 -0
  158. package/dist/file-upload/examples/avatar.html +34 -0
  159. package/dist/file-upload/examples/basic.html +34 -0
  160. package/dist/file-upload/examples/directory.html +34 -0
  161. package/dist/file-upload/examples/dragdrop.html +31 -0
  162. package/dist/file-upload/examples/files.html +39 -0
  163. package/dist/file-upload/examples/images.html +40 -0
  164. package/dist/file-upload/examples/paste.html +30 -0
  165. package/dist/file-upload/examples/table.html +39 -0
  166. package/dist/file-upload/file-upload.events.d.ts +27 -0
  167. package/dist/file-upload/file-upload.events.js +1 -0
  168. package/dist/file-upload/file-upload.machine.d.ts +6 -0
  169. package/dist/file-upload/file-upload.machine.js +59 -0
  170. package/dist/file-upload/file-upload.presentation.d.ts +182 -0
  171. package/dist/file-upload/file-upload.presentation.js +256 -0
  172. package/dist/file-upload/file-upload.state.d.ts +52 -0
  173. package/dist/file-upload/file-upload.state.js +72 -0
  174. package/dist/file-upload/file-upload.transitions.d.ts +11 -0
  175. package/dist/file-upload/file-upload.transitions.js +32 -0
  176. package/dist/floating-panel/examples/basic.html +42 -0
  177. package/dist/floating-panel/examples/calculator.html +56 -0
  178. package/dist/floating-panel/examples/chat.html +45 -0
  179. package/dist/floating-panel/examples/media-player.html +54 -0
  180. package/dist/floating-panel/examples/notes.html +60 -0
  181. package/dist/floating-panel/examples/settings.html +73 -0
  182. package/dist/floating-panel/examples/task.html +79 -0
  183. package/dist/floating-panel/examples/video-call.html +47 -0
  184. package/dist/floating-panel/floating-panel.events.d.ts +45 -0
  185. package/dist/floating-panel/floating-panel.events.js +1 -0
  186. package/dist/floating-panel/floating-panel.machine.d.ts +6 -0
  187. package/dist/floating-panel/floating-panel.machine.js +70 -0
  188. package/dist/floating-panel/floating-panel.presentation.d.ts +239 -0
  189. package/dist/floating-panel/floating-panel.presentation.js +271 -0
  190. package/dist/floating-panel/floating-panel.state.d.ts +67 -0
  191. package/dist/floating-panel/floating-panel.state.js +76 -0
  192. package/dist/floating-panel/floating-panel.transitions.d.ts +22 -0
  193. package/dist/floating-panel/floating-panel.transitions.js +114 -0
  194. package/dist/hover-card/examples/basic.html +19 -0
  195. package/dist/hover-card/examples/controlled.html +32 -0
  196. package/dist/hover-card/examples/custom-positioning.html +29 -0
  197. package/dist/hover-card/examples/link.html +10 -0
  198. package/dist/hover-card/examples/product.html +33 -0
  199. package/dist/hover-card/examples/user.html +38 -0
  200. package/dist/hover-card/examples/with-arrow.html +29 -0
  201. package/dist/hover-card/hover-card.controller-def.d.ts +50 -0
  202. package/dist/hover-card/hover-card.controller-def.js +134 -0
  203. package/dist/image-cropper/crop-geometry.d.ts +133 -0
  204. package/dist/image-cropper/crop-geometry.js +453 -0
  205. package/dist/image-cropper/examples/basic.html +44 -0
  206. package/dist/image-cropper/examples/circle.html +44 -0
  207. package/dist/image-cropper/image-cropper.events.d.ts +108 -0
  208. package/dist/image-cropper/image-cropper.events.js +1 -0
  209. package/dist/image-cropper/image-cropper.machine.d.ts +5 -0
  210. package/dist/image-cropper/image-cropper.machine.js +231 -0
  211. package/dist/image-cropper/image-cropper.presentation.d.ts +295 -0
  212. package/dist/image-cropper/image-cropper.presentation.js +536 -0
  213. package/dist/image-cropper/image-cropper.state.d.ts +94 -0
  214. package/dist/image-cropper/image-cropper.state.js +134 -0
  215. package/dist/image-cropper/image-cropper.transitions.d.ts +13 -0
  216. package/dist/image-cropper/image-cropper.transitions.js +11 -0
  217. package/dist/index.d.ts +66 -0
  218. package/dist/index.js +279 -0
  219. package/dist/listbox/examples/basic.html +50 -0
  220. package/dist/listbox/examples/controlled.html +54 -0
  221. package/dist/listbox/examples/countries.html +61 -0
  222. package/dist/listbox/examples/grouped.html +58 -0
  223. package/dist/listbox/examples/icons.html +56 -0
  224. package/dist/listbox/examples/multiple.html +56 -0
  225. package/dist/listbox/examples/priority.html +50 -0
  226. package/dist/listbox/examples/settings.html +64 -0
  227. package/dist/listbox/listbox.events.d.ts +42 -0
  228. package/dist/listbox/listbox.events.js +1 -0
  229. package/dist/listbox/listbox.machine.d.ts +6 -0
  230. package/dist/listbox/listbox.machine.js +51 -0
  231. package/dist/listbox/listbox.presentation.d.ts +294 -0
  232. package/dist/listbox/listbox.presentation.js +493 -0
  233. package/dist/listbox/listbox.state.d.ts +55 -0
  234. package/dist/listbox/listbox.state.js +59 -0
  235. package/dist/listbox/listbox.transitions.d.ts +20 -0
  236. package/dist/listbox/listbox.transitions.js +73 -0
  237. package/dist/menu/examples/basic.html +75 -0
  238. package/dist/menu/examples/context.html +74 -0
  239. package/dist/menu/examples/groups.html +88 -0
  240. package/dist/menu/examples/icons.html +80 -0
  241. package/dist/menu/examples/nested.html +83 -0
  242. package/dist/menu/examples/user.html +87 -0
  243. package/dist/menu/menu.events.d.ts +42 -0
  244. package/dist/menu/menu.events.js +1 -0
  245. package/dist/menu/menu.machine.d.ts +6 -0
  246. package/dist/menu/menu.machine.js +148 -0
  247. package/dist/menu/menu.presentation.d.ts +252 -0
  248. package/dist/menu/menu.presentation.js +709 -0
  249. package/dist/menu/menu.state.d.ts +54 -0
  250. package/dist/menu/menu.state.js +55 -0
  251. package/dist/mode-picker/examples/basic.html +17 -0
  252. package/dist/mode-picker/examples/minimal.html +17 -0
  253. package/dist/mode-picker/examples/pill.html +17 -0
  254. package/dist/mode-picker/mode-picker.events.d.ts +20 -0
  255. package/dist/mode-picker/mode-picker.events.js +1 -0
  256. package/dist/mode-picker/mode-picker.machine.d.ts +5 -0
  257. package/dist/mode-picker/mode-picker.machine.js +29 -0
  258. package/dist/mode-picker/mode-picker.presentation.d.ts +129 -0
  259. package/dist/mode-picker/mode-picker.presentation.js +175 -0
  260. package/dist/mode-picker/mode-picker.state.d.ts +27 -0
  261. package/dist/mode-picker/mode-picker.state.js +56 -0
  262. package/dist/mode-picker/mode-picker.transitions.d.ts +11 -0
  263. package/dist/mode-picker/mode-picker.transitions.js +32 -0
  264. package/dist/navigation-menu/examples/basic.html +72 -0
  265. package/dist/navigation-menu/examples/grouped.html +91 -0
  266. package/dist/navigation-menu/examples/minimal.html +49 -0
  267. package/dist/navigation-menu/navigation-menu.events.d.ts +20 -0
  268. package/dist/navigation-menu/navigation-menu.events.js +1 -0
  269. package/dist/navigation-menu/navigation-menu.machine.d.ts +6 -0
  270. package/dist/navigation-menu/navigation-menu.machine.js +51 -0
  271. package/dist/navigation-menu/navigation-menu.presentation.d.ts +132 -0
  272. package/dist/navigation-menu/navigation-menu.presentation.js +151 -0
  273. package/dist/navigation-menu/navigation-menu.state.d.ts +33 -0
  274. package/dist/navigation-menu/navigation-menu.state.js +49 -0
  275. package/dist/navigation-menu/navigation-menu.transitions.d.ts +11 -0
  276. package/dist/navigation-menu/navigation-menu.transitions.js +32 -0
  277. package/dist/number-input/examples/basic.html +49 -0
  278. package/dist/number-input/examples/currency.html +33 -0
  279. package/dist/number-input/examples/decimal.html +33 -0
  280. package/dist/number-input/examples/limits.html +42 -0
  281. package/dist/number-input/examples/percentage.html +38 -0
  282. package/dist/number-input/examples/quantity.html +35 -0
  283. package/dist/number-input/examples/scrubber.html +46 -0
  284. package/dist/number-input/examples/wheel.html +42 -0
  285. package/dist/number-input/number-input.events.d.ts +66 -0
  286. package/dist/number-input/number-input.events.js +1 -0
  287. package/dist/number-input/number-input.machine.d.ts +5 -0
  288. package/dist/number-input/number-input.machine.js +132 -0
  289. package/dist/number-input/number-input.presentation.d.ts +292 -0
  290. package/dist/number-input/number-input.presentation.js +449 -0
  291. package/dist/number-input/number-input.state.d.ts +71 -0
  292. package/dist/number-input/number-input.state.js +86 -0
  293. package/dist/number-input/number-input.transitions.d.ts +17 -0
  294. package/dist/number-input/number-input.transitions.js +40 -0
  295. package/dist/pagination/examples/basic.html +39 -0
  296. package/dist/pagination/examples/dropdown.html +37 -0
  297. package/dist/pagination/examples/info.html +41 -0
  298. package/dist/pagination/examples/jump.html +38 -0
  299. package/dist/pagination/examples/numbered.html +31 -0
  300. package/dist/pagination/examples/pagesize.html +46 -0
  301. package/dist/pagination/pagination.events.d.ts +36 -0
  302. package/dist/pagination/pagination.events.js +1 -0
  303. package/dist/pagination/pagination.machine.d.ts +6 -0
  304. package/dist/pagination/pagination.machine.js +45 -0
  305. package/dist/pagination/pagination.presentation.d.ts +161 -0
  306. package/dist/pagination/pagination.presentation.js +162 -0
  307. package/dist/pagination/pagination.state.d.ts +44 -0
  308. package/dist/pagination/pagination.state.js +115 -0
  309. package/dist/pagination/pagination.transitions.d.ts +17 -0
  310. package/dist/pagination/pagination.transitions.js +30 -0
  311. package/dist/pin-input/examples/basic.html +23 -0
  312. package/dist/pin-input/examples/field.html +25 -0
  313. package/dist/pin-input/examples/masked.html +23 -0
  314. package/dist/pin-input/examples/placeholder.html +24 -0
  315. package/dist/pin-input/examples/twofactor.html +25 -0
  316. package/dist/pin-input/examples/verification.html +32 -0
  317. package/dist/pin-input/pin-input.events.d.ts +48 -0
  318. package/dist/pin-input/pin-input.events.js +1 -0
  319. package/dist/pin-input/pin-input.machine.d.ts +5 -0
  320. package/dist/pin-input/pin-input.machine.js +99 -0
  321. package/dist/pin-input/pin-input.presentation.d.ts +204 -0
  322. package/dist/pin-input/pin-input.presentation.js +392 -0
  323. package/dist/pin-input/pin-input.state.d.ts +67 -0
  324. package/dist/pin-input/pin-input.state.js +63 -0
  325. package/dist/pin-input/pin-input.transitions.d.ts +10 -0
  326. package/dist/pin-input/pin-input.transitions.js +22 -0
  327. package/dist/popover/examples/basic.html +15 -0
  328. package/dist/popover/examples/feedback.html +17 -0
  329. package/dist/popover/examples/notifications.html +21 -0
  330. package/dist/popover/examples/settings.html +39 -0
  331. package/dist/popover/examples/share.html +18 -0
  332. package/dist/popover/examples/user.html +43 -0
  333. package/dist/popover/popover.controller-def.d.ts +39 -0
  334. package/dist/popover/popover.controller-def.js +74 -0
  335. package/dist/rating-group/examples/basic.html +39 -0
  336. package/dist/rating-group/examples/movie.html +45 -0
  337. package/dist/rating-group/examples/product-review.html +52 -0
  338. package/dist/rating-group/examples/service-evaluation.html +31 -0
  339. package/dist/rating-group/rating-group.events.d.ts +38 -0
  340. package/dist/rating-group/rating-group.events.js +1 -0
  341. package/dist/rating-group/rating-group.machine.d.ts +6 -0
  342. package/dist/rating-group/rating-group.machine.js +70 -0
  343. package/dist/rating-group/rating-group.presentation.d.ts +144 -0
  344. package/dist/rating-group/rating-group.presentation.js +208 -0
  345. package/dist/rating-group/rating-group.state.d.ts +36 -0
  346. package/dist/rating-group/rating-group.state.js +41 -0
  347. package/dist/rating-group/rating-group.transitions.d.ts +16 -0
  348. package/dist/rating-group/rating-group.transitions.js +15 -0
  349. package/dist/react/react.d.ts +29 -0
  350. package/dist/react/react.js +8 -0
  351. package/dist/select/examples/basic.html +72 -0
  352. package/dist/select/examples/category.html +67 -0
  353. package/dist/select/examples/country.html +65 -0
  354. package/dist/select/examples/language.html +19 -0
  355. package/dist/select/examples/multiple.html +20 -0
  356. package/dist/select/examples/profile.html +73 -0
  357. package/dist/select/examples/theme.html +11 -0
  358. package/dist/select/examples/with-overlapping-label.html +57 -0
  359. package/dist/select/select.events.d.ts +59 -0
  360. package/dist/select/select.events.js +1 -0
  361. package/dist/select/select.machine.d.ts +6 -0
  362. package/dist/select/select.machine.js +203 -0
  363. package/dist/select/select.presentation.d.ts +358 -0
  364. package/dist/select/select.presentation.js +509 -0
  365. package/dist/select/select.shared.d.ts +8 -0
  366. package/dist/select/select.shared.js +13 -0
  367. package/dist/select/select.state.d.ts +51 -0
  368. package/dist/select/select.state.js +69 -0
  369. package/dist/select/select.transitions.d.ts +15 -0
  370. package/dist/select/select.transitions.js +27 -0
  371. package/dist/shared/keyboard.d.ts +29 -0
  372. package/dist/shared/keyboard.js +13 -0
  373. package/dist/signature-pad/examples/basic.html +29 -0
  374. package/dist/signature-pad/examples/contract.html +36 -0
  375. package/dist/signature-pad/examples/receipt.html +40 -0
  376. package/dist/signature-pad/examples/with-preview.html +40 -0
  377. package/dist/signature-pad/signature-pad.events.d.ts +26 -0
  378. package/dist/signature-pad/signature-pad.events.js +1 -0
  379. package/dist/signature-pad/signature-pad.machine.d.ts +7 -0
  380. package/dist/signature-pad/signature-pad.machine.js +44 -0
  381. package/dist/signature-pad/signature-pad.presentation.d.ts +184 -0
  382. package/dist/signature-pad/signature-pad.presentation.js +236 -0
  383. package/dist/signature-pad/signature-pad.state.d.ts +40 -0
  384. package/dist/signature-pad/signature-pad.state.js +94 -0
  385. package/dist/signature-pad/signature-pad.transitions.d.ts +12 -0
  386. package/dist/signature-pad/signature-pad.transitions.js +40 -0
  387. package/dist/slider/examples/basic.html +32 -0
  388. package/dist/slider/examples/equalizer.html +119 -0
  389. package/dist/slider/examples/fractional.html +7 -0
  390. package/dist/slider/examples/marks.html +42 -0
  391. package/dist/slider/examples/range.html +31 -0
  392. package/dist/slider/examples/stepped.html +7 -0
  393. package/dist/slider/examples/ticks.html +72 -0
  394. package/dist/slider/examples/vertical.html +30 -0
  395. package/dist/slider/slider.events.d.ts +50 -0
  396. package/dist/slider/slider.events.js +1 -0
  397. package/dist/slider/slider.machine.d.ts +5 -0
  398. package/dist/slider/slider.machine.js +86 -0
  399. package/dist/slider/slider.presentation.d.ts +252 -0
  400. package/dist/slider/slider.presentation.js +322 -0
  401. package/dist/slider/slider.state.d.ts +72 -0
  402. package/dist/slider/slider.state.js +91 -0
  403. package/dist/slider/slider.transitions.d.ts +17 -0
  404. package/dist/slider/slider.transitions.js +62 -0
  405. package/dist/solid/solid.d.ts +36 -0
  406. package/dist/solid/solid.js +10 -0
  407. package/dist/spin-element.d.ts +13 -0
  408. package/dist/spin-element.js +38 -0
  409. package/dist/splitter/examples/basic.html +22 -0
  410. package/dist/splitter/examples/nested.html +41 -0
  411. package/dist/splitter/examples/threepanels.html +23 -0
  412. package/dist/splitter/examples/vertical.html +23 -0
  413. package/dist/splitter/splitter.events.d.ts +52 -0
  414. package/dist/splitter/splitter.events.js +1 -0
  415. package/dist/splitter/splitter.machine.d.ts +6 -0
  416. package/dist/splitter/splitter.machine.js +78 -0
  417. package/dist/splitter/splitter.presentation.d.ts +204 -0
  418. package/dist/splitter/splitter.presentation.js +443 -0
  419. package/dist/splitter/splitter.state.d.ts +48 -0
  420. package/dist/splitter/splitter.state.js +225 -0
  421. package/dist/splitter/splitter.transitions.d.ts +20 -0
  422. package/dist/splitter/splitter.transitions.js +132 -0
  423. package/dist/steps/examples/basic.html +57 -0
  424. package/dist/steps/examples/checkmarks.html +32 -0
  425. package/dist/steps/examples/content.html +45 -0
  426. package/dist/steps/examples/descriptions.html +26 -0
  427. package/dist/steps/examples/icons.html +26 -0
  428. package/dist/steps/examples/lines.html +26 -0
  429. package/dist/steps/examples/navigation.html +41 -0
  430. package/dist/steps/examples/onboarding.html +32 -0
  431. package/dist/steps/examples/progress.html +47 -0
  432. package/dist/steps/examples/segmented.html +40 -0
  433. package/dist/steps/examples/vertical.html +58 -0
  434. package/dist/steps/examples/verticallabels.html +27 -0
  435. package/dist/steps/examples/verticalnavigation.html +36 -0
  436. package/dist/steps/steps.events.d.ts +27 -0
  437. package/dist/steps/steps.events.js +1 -0
  438. package/dist/steps/steps.machine.d.ts +6 -0
  439. package/dist/steps/steps.machine.js +36 -0
  440. package/dist/steps/steps.presentation.d.ts +177 -0
  441. package/dist/steps/steps.presentation.js +248 -0
  442. package/dist/steps/steps.state.d.ts +39 -0
  443. package/dist/steps/steps.state.js +47 -0
  444. package/dist/steps/steps.transitions.d.ts +15 -0
  445. package/dist/steps/steps.transitions.js +39 -0
  446. package/dist/tabs/examples/basic.html +41 -0
  447. package/dist/tabs/examples/dashboard.html +116 -0
  448. package/dist/tabs/examples/ghost.html +28 -0
  449. package/dist/tabs/examples/icon-above.html +50 -0
  450. package/dist/tabs/examples/icon-only.html +37 -0
  451. package/dist/tabs/examples/outline-with-icons.html +50 -0
  452. package/dist/tabs/examples/outline.html +29 -0
  453. package/dist/tabs/examples/pills.html +40 -0
  454. package/dist/tabs/examples/project.html +87 -0
  455. package/dist/tabs/examples/settings.html +100 -0
  456. package/dist/tabs/examples/stack-with-icons.html +51 -0
  457. package/dist/tabs/examples/stack.html +28 -0
  458. package/dist/tabs/examples/underline.html +41 -0
  459. package/dist/tabs/examples/vertical-ghost.html +44 -0
  460. package/dist/tabs/examples/vertical-icons.html +44 -0
  461. package/dist/tabs/examples/vertical-underline.html +45 -0
  462. package/dist/tabs/examples/vertical-with-icons.html +53 -0
  463. package/dist/tabs/examples/vertical.html +42 -0
  464. package/dist/tabs/examples/with-badges.html +43 -0
  465. package/dist/tabs/examples/with-icons.html +42 -0
  466. package/dist/tabs/tabs.events.d.ts +19 -0
  467. package/dist/tabs/tabs.events.js +1 -0
  468. package/dist/tabs/tabs.machine.d.ts +5 -0
  469. package/dist/tabs/tabs.machine.js +54 -0
  470. package/dist/tabs/tabs.presentation.d.ts +83 -0
  471. package/dist/tabs/tabs.presentation.js +94 -0
  472. package/dist/tabs/tabs.state.d.ts +61 -0
  473. package/dist/tabs/tabs.state.js +53 -0
  474. package/dist/tabs/tabs.transitions.d.ts +8 -0
  475. package/dist/tabs/tabs.transitions.js +6 -0
  476. package/dist/tags-input/examples/basic.html +43 -0
  477. package/dist/tags-input/examples/with-combobox.html +64 -0
  478. package/dist/tags-input/tags.events.d.ts +77 -0
  479. package/dist/tags-input/tags.events.js +1 -0
  480. package/dist/tags-input/tags.machine.d.ts +6 -0
  481. package/dist/tags-input/tags.machine.js +311 -0
  482. package/dist/tags-input/tags.presentation.d.ts +376 -0
  483. package/dist/tags-input/tags.presentation.js +782 -0
  484. package/dist/tags-input/tags.state.d.ts +109 -0
  485. package/dist/tags-input/tags.state.js +111 -0
  486. package/dist/tags-input/tags.transitions.d.ts +23 -0
  487. package/dist/tags-input/tags.transitions.js +101 -0
  488. package/dist/theme-picker/examples/basic.html +52 -0
  489. package/dist/theme-picker/examples/cards.html +32 -0
  490. package/dist/theme-picker/examples/compact.html +42 -0
  491. package/dist/theme-picker/examples/swatches.html +31 -0
  492. package/dist/theme-picker/theme-picker.events.d.ts +32 -0
  493. package/dist/theme-picker/theme-picker.events.js +1 -0
  494. package/dist/theme-picker/theme-picker.machine.d.ts +5 -0
  495. package/dist/theme-picker/theme-picker.machine.js +65 -0
  496. package/dist/theme-picker/theme-picker.presentation.d.ts +198 -0
  497. package/dist/theme-picker/theme-picker.presentation.js +306 -0
  498. package/dist/theme-picker/theme-picker.state.d.ts +40 -0
  499. package/dist/theme-picker/theme-picker.state.js +108 -0
  500. package/dist/theme-picker/theme-picker.transitions.d.ts +17 -0
  501. package/dist/theme-picker/theme-picker.transitions.js +62 -0
  502. package/dist/timer/examples/basic.html +36 -0
  503. package/dist/timer/examples/card.html +45 -0
  504. package/dist/timer/examples/compact.html +32 -0
  505. package/dist/timer/examples/countdown.html +45 -0
  506. package/dist/timer/examples/labels.html +43 -0
  507. package/dist/timer/examples/large.html +38 -0
  508. package/dist/timer/examples/minimal.html +21 -0
  509. package/dist/timer/examples/pomodoro.html +45 -0
  510. package/dist/timer/examples/workout.html +47 -0
  511. package/dist/timer/timer.events.d.ts +18 -0
  512. package/dist/timer/timer.events.js +1 -0
  513. package/dist/timer/timer.machine.d.ts +5 -0
  514. package/dist/timer/timer.machine.js +50 -0
  515. package/dist/timer/timer.presentation.d.ts +248 -0
  516. package/dist/timer/timer.presentation.js +265 -0
  517. package/dist/timer/timer.state.d.ts +29 -0
  518. package/dist/timer/timer.state.js +64 -0
  519. package/dist/timer/timer.transitions.d.ts +11 -0
  520. package/dist/timer/timer.transitions.js +35 -0
  521. package/dist/toast/examples/action.html +40 -0
  522. package/dist/toast/examples/basic.html +37 -0
  523. package/dist/toast/examples/bottomcenter.html +37 -0
  524. package/dist/toast/examples/bottomleft.html +37 -0
  525. package/dist/toast/examples/bottomright.html +37 -0
  526. package/dist/toast/examples/duration.html +36 -0
  527. package/dist/toast/examples/promise.html +44 -0
  528. package/dist/toast/examples/topcenter.html +37 -0
  529. package/dist/toast/examples/topleft.html +37 -0
  530. package/dist/toast/examples/topright.html +37 -0
  531. package/dist/toast/examples/types.html +47 -0
  532. package/dist/toast/examples/updatable.html +8 -0
  533. package/dist/toast/toast.events.d.ts +60 -0
  534. package/dist/toast/toast.events.js +1 -0
  535. package/dist/toast/toast.machine.d.ts +6 -0
  536. package/dist/toast/toast.machine.js +97 -0
  537. package/dist/toast/toast.presentation.d.ts +284 -0
  538. package/dist/toast/toast.presentation.js +532 -0
  539. package/dist/toast/toast.state.d.ts +65 -0
  540. package/dist/toast/toast.state.js +88 -0
  541. package/dist/toast/toast.transitions.d.ts +24 -0
  542. package/dist/toast/toast.transitions.js +85 -0
  543. package/dist/toggle-group/examples/basic.html +25 -0
  544. package/dist/toggle-group/examples/ghost.html +22 -0
  545. package/dist/toggle-group/examples/icons.html +25 -0
  546. package/dist/toggle-group/examples/multiple.html +14 -0
  547. package/dist/toggle-group/examples/outline.html +25 -0
  548. package/dist/toggle-group/examples/toolbar.html +25 -0
  549. package/dist/toggle-group/toggle-group.events.d.ts +45 -0
  550. package/dist/toggle-group/toggle-group.events.js +1 -0
  551. package/dist/toggle-group/toggle-group.machine.d.ts +5 -0
  552. package/dist/toggle-group/toggle-group.machine.js +65 -0
  553. package/dist/toggle-group/toggle-group.presentation.d.ts +112 -0
  554. package/dist/toggle-group/toggle-group.presentation.js +217 -0
  555. package/dist/toggle-group/toggle-group.state.d.ts +45 -0
  556. package/dist/toggle-group/toggle-group.state.js +67 -0
  557. package/dist/toggle-group/toggle-group.transitions.d.ts +10 -0
  558. package/dist/toggle-group/toggle-group.transitions.js +9 -0
  559. package/dist/tooltip/examples/basic.html +13 -0
  560. package/dist/tooltip/examples/metrics.html +30 -0
  561. package/dist/tooltip/examples/positioning.html +26 -0
  562. package/dist/tooltip/examples/status.html +33 -0
  563. package/dist/tooltip/examples/video.html +22 -0
  564. package/dist/tooltip/examples/with-arrow.html +14 -0
  565. package/dist/tooltip/tooltip.controller-def.d.ts +42 -0
  566. package/dist/tooltip/tooltip.controller-def.js +110 -0
  567. package/dist/tour/examples/basic.html +67 -0
  568. package/dist/tour/tour.events.d.ts +32 -0
  569. package/dist/tour/tour.events.js +1 -0
  570. package/dist/tour/tour.machine.d.ts +5 -0
  571. package/dist/tour/tour.machine.js +77 -0
  572. package/dist/tour/tour.presentation.d.ts +260 -0
  573. package/dist/tour/tour.presentation.js +272 -0
  574. package/dist/tour/tour.state.d.ts +43 -0
  575. package/dist/tour/tour.state.js +60 -0
  576. package/dist/tour/tour.transitions.d.ts +16 -0
  577. package/dist/tour/tour.transitions.js +32 -0
  578. package/dist/tree-view/examples/basic.html +47 -0
  579. package/dist/tree-view/examples/loading.html +57 -0
  580. package/dist/tree-view/tree-view.events.d.ts +67 -0
  581. package/dist/tree-view/tree-view.events.js +1 -0
  582. package/dist/tree-view/tree-view.machine.d.ts +6 -0
  583. package/dist/tree-view/tree-view.machine.js +86 -0
  584. package/dist/tree-view/tree-view.presentation.d.ts +254 -0
  585. package/dist/tree-view/tree-view.presentation.js +515 -0
  586. package/dist/tree-view/tree-view.state.d.ts +54 -0
  587. package/dist/tree-view/tree-view.state.js +61 -0
  588. package/dist/tree-view/tree-view.transitions.d.ts +30 -0
  589. package/dist/tree-view/tree-view.transitions.js +107 -0
  590. package/package.json +245 -4
@@ -0,0 +1,80 @@
1
+ export interface ComboboxRow {
2
+ readonly value: string;
3
+ readonly label: string;
4
+ readonly disabled?: boolean;
5
+ readonly group?: string;
6
+ readonly index?: number;
7
+ readonly meta?: Readonly<Record<string, string>> | undefined;
8
+ }
9
+ export type ComboboxState = "idle" | "focused" | "interacting" | "suggesting";
10
+ export interface ComboboxContext {
11
+ value: string[];
12
+ inputValue: string;
13
+ highlightedValue: string | null;
14
+ autofill: string | null;
15
+ order: string[];
16
+ labels: Record<string, string>;
17
+ multiple: boolean;
18
+ closeOnSelect: boolean;
19
+ allowCustomValue: boolean;
20
+ inputBehavior: "none" | "autocomplete" | "autohighlight";
21
+ selectionBehavior: "replace" | "preserve" | "clear";
22
+ openOnChange: boolean;
23
+ openOnKeyPress: boolean;
24
+ alwaysSubmitOnEnter: boolean;
25
+ items: readonly ComboboxRow[];
26
+ disabled: boolean;
27
+ readOnly: boolean;
28
+ invalid: boolean;
29
+ required: boolean;
30
+ composite: boolean;
31
+ placement: string;
32
+ name: string;
33
+ form: string;
34
+ placeholder: string;
35
+ triggerLabel: string;
36
+ clearTriggerLabel: string;
37
+ openOnClick: boolean;
38
+ loopFocus: boolean;
39
+ dir: "ltr" | "rtl";
40
+ }
41
+ export interface ComboboxArgs {
42
+ items?: readonly ComboboxRow[];
43
+ value?: string;
44
+ inputValue?: string;
45
+ highlightedValue?: string;
46
+ multiple?: boolean;
47
+ closeOnSelect?: boolean;
48
+ allowCustomValue?: boolean;
49
+ inputBehavior?: string;
50
+ selectionBehavior?: string;
51
+ openOnChange?: boolean;
52
+ openOnKeyPress?: boolean;
53
+ alwaysSubmitOnEnter?: boolean;
54
+ defaultOpenOnChange?: boolean;
55
+ disabled?: boolean;
56
+ readOnly?: boolean;
57
+ invalid?: boolean;
58
+ required?: boolean;
59
+ composite?: boolean;
60
+ placement?: string;
61
+ name?: string;
62
+ form?: string;
63
+ placeholder?: string;
64
+ triggerLabel?: string;
65
+ clearTriggerLabel?: string;
66
+ openOnClick?: boolean;
67
+ loopFocus?: boolean;
68
+ dir?: "ltr" | "rtl";
69
+ }
70
+ /** Shape raw items the way `initial` does: arrays pass through, anything
71
+ * else becomes empty. Shared by `initial` and the field contract, so a
72
+ * host write parses exactly like the seed. */
73
+ export declare function parseItems(raw: unknown): readonly ComboboxRow[];
74
+ declare const parseKeys: (raw: unknown) => string[];
75
+ export declare function initial(args: ComboboxArgs, authored: (name: string) => boolean): ComboboxContext;
76
+ export declare const stringifyValues: (ctx: ComboboxContext, values: readonly string[]) => string;
77
+ export declare const pickOutcome: (ctx: ComboboxContext, value: string) => string[];
78
+ export declare const isCustomValue: (ctx: ComboboxContext) => boolean;
79
+ export { parseKeys };
80
+ //# sourceMappingURL=combobox.state.d.ts.map
@@ -0,0 +1,71 @@
1
+ import { defaultTwin } from "@spinjs/runtime";
2
+ // src/combobox/combobox.state.ts
3
+ /** Shape raw items the way `initial` does: arrays pass through, anything
4
+ * else becomes empty. Shared by `initial` and the field contract, so a
5
+ * host write parses exactly like the seed. */
6
+ function parseItems(raw) {
7
+ return Array.isArray(raw) ? raw : [];
8
+ }
9
+ const parseKeys = (raw) => {
10
+ if (Array.isArray(raw)) return raw.filter((v) => typeof v === "string");
11
+ if (typeof raw !== "string") return [];
12
+ return raw.length > 0 ? raw.split(",").map((s) => s.trim()).filter(Boolean) : [];
13
+ };
14
+ const textProp = (raw) => typeof raw === "string" ? raw : "";
15
+ const nullableProp = (raw) => typeof raw === "string" && raw.length > 0 ? raw : null;
16
+ function initial(args, authored) {
17
+ const written = (field) => authored(field) || authored(defaultTwin(field)) || args[defaultTwin(field)] !== void 0;
18
+ const multiple = written("multiple") ? args.multiple === true : false;
19
+ const selectionRaw = args.selectionBehavior;
20
+ const selectionBehavior = written("selectionBehavior") ? selectionRaw === "preserve" || selectionRaw === "clear" ? selectionRaw : multiple ? "clear" : "replace" : multiple ? "clear" : "replace";
21
+ const behaviorRaw = args.inputBehavior;
22
+ const inputBehavior = written("inputBehavior") ? behaviorRaw === "autocomplete" || behaviorRaw === "autohighlight" ? behaviorRaw : "none" : "none";
23
+ const rows = parseItems(args.items);
24
+ const order = rows.map((r) => typeof r.value === "string" ? r.value : "").filter(Boolean);
25
+ const labels = Object.fromEntries(rows.map((r) => [String(r.value), typeof r.label === "string" ? r.label : String(r.value)]));
26
+ const value = parseKeys(args.value);
27
+ const seedCtx = {
28
+ value,
29
+ inputValue: "",
30
+ highlightedValue: nullableProp(args.highlightedValue),
31
+ autofill: null,
32
+ order,
33
+ labels,
34
+ multiple,
35
+ closeOnSelect: written("closeOnSelect") ? args.closeOnSelect === true : !multiple,
36
+ allowCustomValue: written("allowCustomValue") ? args.allowCustomValue === true : false,
37
+ inputBehavior,
38
+ selectionBehavior,
39
+ openOnChange: written("openOnChange") ? args.openOnChange !== false : true,
40
+ openOnKeyPress: written("openOnKeyPress") ? args.openOnKeyPress !== false : true,
41
+ alwaysSubmitOnEnter: written("alwaysSubmitOnEnter") ? args.alwaysSubmitOnEnter === true : false,
42
+ items: rows,
43
+ disabled: args.disabled === true,
44
+ readOnly: args.readOnly === true,
45
+ invalid: args.invalid === true,
46
+ required: args.required === true,
47
+ composite: args.composite !== false,
48
+ placement: typeof args.placement === "string" && args.placement.length > 0 ? args.placement : "bottom",
49
+ name: typeof args.name === "string" ? args.name : "",
50
+ form: typeof args.form === "string" ? args.form : "",
51
+ placeholder: typeof args.placeholder === "string" ? args.placeholder : "",
52
+ triggerLabel: typeof args.triggerLabel === "string" ? args.triggerLabel : "",
53
+ clearTriggerLabel: typeof args.clearTriggerLabel === "string" ? args.clearTriggerLabel : "",
54
+ openOnClick: args.openOnClick !== false,
55
+ loopFocus: args.loopFocus === true,
56
+ dir: args.dir === "rtl" ? "rtl" : "ltr"
57
+ };
58
+ const valueAsString = value.map((v) => labels[v] ?? v).join(", ");
59
+ const seeded = textProp(args.inputValue);
60
+ const inputValue = seeded.trim().length > 0 || multiple ? seeded : selectionBehavior === "clear" ? "" : valueAsString;
61
+ return {
62
+ ...seedCtx,
63
+ inputValue
64
+ };
65
+ }
66
+ const stringifyValues = (ctx, values) => values.map((value) => ctx.labels[value]).filter((l) => l !== void 0).join(", ");
67
+ const pickOutcome = (ctx, value) => ctx.multiple ? ctx.value.includes(value) ? ctx.value.filter((v) => v !== value) : [...ctx.value, value] : [value];
68
+ const isCustomValue = (ctx) => ctx.inputValue !== stringifyValues(ctx, ctx.value);
69
+ export { initial, isCustomValue, parseItems, parseKeys, pickOutcome, stringifyValues };
70
+
71
+ //# sourceMappingURL=combobox.state.js.map
@@ -0,0 +1,28 @@
1
+ import { ComboboxEvents } from "./combobox.events.js";
2
+ import { ComboboxContext } from "./combobox.state.js";
3
+ import { AssignFor, GuardFor } from "@spinjs/runtime/fsm";
4
+ type Ctx = ComboboxContext;
5
+ type Ev = ComboboxEvents;
6
+ type ComboboxAssign<K extends keyof Ev = keyof Ev> = AssignFor<Ctx, Ev, K>;
7
+ declare const at: (list: readonly string[], index: number) => string | null;
8
+ declare const completion: (ctx: Ctx, value: string, keypress: boolean) => string | null;
9
+ declare const inlineSingle: (ctx: Ctx) => boolean;
10
+ declare const applySelection: (ctx: Ctx, next: readonly string[]) => Partial<Ctx>;
11
+ export declare const setHighlightedValue: ComboboxAssign<"HIGHLIGHTED_VALUE.SET" | "ITEM.POINTER_MOVE">;
12
+ export declare const clearHighlightedValue: () => Partial<Ctx>;
13
+ export declare const moveHighlight: ComboboxAssign<"INPUT.ARROW_DOWN" | "INPUT.ARROW_UP" | "INPUT.HOME" | "INPUT.END">;
14
+ export declare const highlightFirstItem: (ctx: Ctx) => Partial<Ctx>;
15
+ export declare const highlightFirstOrSelectedItem: (ctx: Ctx) => Partial<Ctx>;
16
+ export declare const selectItem: ComboboxAssign<"ITEM.SELECT" | "ITEM.CLICK">;
17
+ export declare const selectHighlightedItem: ComboboxAssign<"INPUT.ENTER">;
18
+ export declare const clearValue: (ctx: Ctx) => Partial<Ctx>;
19
+ export declare const clearInputValue: () => Partial<Ctx>;
20
+ export declare const setInputValue: ComboboxAssign<"INPUT.CHANGE" | "INPUT_VALUE.SET">;
21
+ export declare const revertInputValue: (ctx: Ctx) => Partial<Ctx>;
22
+ export declare const inlineAutocomplete: (ctx: Ctx) => boolean;
23
+ export declare const closeOnSelect: (ctx: Ctx) => boolean;
24
+ export declare const revertsToValue: (ctx: Ctx) => boolean;
25
+ export declare const isCustomValueGuard: GuardFor<Ctx, Ev>;
26
+ export declare const inlineSingleGuard: GuardFor<Ctx, Ev>;
27
+ export { applySelection, at, completion, inlineSingle };
28
+ //# sourceMappingURL=combobox.transitions.d.ts.map
@@ -0,0 +1,91 @@
1
+ import { isCustomValue, stringifyValues } from "./combobox.state.js";
2
+ // src/combobox/combobox.transitions.ts
3
+ const at = (list, index) => list.at(index) ?? null;
4
+ const completion = (ctx, value, keypress) => {
5
+ if (!keypress || ctx.inputBehavior !== "autocomplete") return null;
6
+ return ctx.labels[value] ?? ctx.inputValue;
7
+ };
8
+ const inlineSingle = (ctx) => ctx.inputBehavior === "autocomplete" && !ctx.multiple;
9
+ const applySelection = (ctx, next) => ({
10
+ value: [...next],
11
+ inputValue: ctx.selectionBehavior === "preserve" ? ctx.inputValue : ctx.selectionBehavior === "clear" ? "" : stringifyValues(ctx, next),
12
+ autofill: null
13
+ });
14
+ const setHighlightedValue = (ctx, e) => {
15
+ if (e.type === "ITEM.POINTER_MOVE") return {
16
+ highlightedValue: e.value,
17
+ autofill: completion(ctx, e.value, false)
18
+ };
19
+ if (e.type !== "HIGHLIGHTED_VALUE.SET" || e.value === null) return {};
20
+ return {
21
+ highlightedValue: e.value,
22
+ autofill: completion(ctx, e.value, e.keypress === true)
23
+ };
24
+ };
25
+ const clearHighlightedValue = () => ({
26
+ highlightedValue: null,
27
+ autofill: null
28
+ });
29
+ const moveHighlight = (ctx, e) => {
30
+ if (e.value === void 0) return {};
31
+ return {
32
+ highlightedValue: e.value,
33
+ autofill: completion(ctx, e.value, e.keypress === true)
34
+ };
35
+ };
36
+ const highlightFirstItem = (ctx) => ctx.order.length === 0 ? {} : {
37
+ highlightedValue: at(ctx.order, 0),
38
+ autofill: null
39
+ };
40
+ const highlightFirstOrSelectedItem = (ctx) => {
41
+ const selected = ctx.order.filter((value) => ctx.value.includes(value));
42
+ const value = selected.length > 0 ? at(selected, 0) : at(ctx.order, 0);
43
+ if (value === null) return {};
44
+ return {
45
+ highlightedValue: value,
46
+ autofill: null
47
+ };
48
+ };
49
+ const selectItem = (ctx, e) => {
50
+ if (e.type !== "ITEM.SELECT" && e.type !== "ITEM.CLICK") return {};
51
+ const value = e.value;
52
+ const next = ctx.multiple ? ctx.value.includes(value) ? ctx.value.filter((v) => v !== value) : [...ctx.value, value] : [value];
53
+ return applySelection(ctx, next);
54
+ };
55
+ const selectHighlightedItem = (ctx) => {
56
+ if (ctx.highlightedValue === null || !ctx.order.includes(ctx.highlightedValue)) return {};
57
+ const value = ctx.highlightedValue;
58
+ const next = ctx.multiple ? ctx.value.includes(value) ? ctx.value.filter((v) => v !== value) : [...ctx.value, value] : [value];
59
+ return applySelection(ctx, next);
60
+ };
61
+ const clearValue = (ctx) => applySelection(ctx, []);
62
+ const clearInputValue = () => ({
63
+ inputValue: "",
64
+ autofill: null
65
+ });
66
+ const setInputValue = (_ctx, e) => {
67
+ if (e.type !== "INPUT.CHANGE" && e.type !== "INPUT_VALUE.SET") return {};
68
+ return {
69
+ inputValue: e.value,
70
+ autofill: null
71
+ };
72
+ };
73
+ const revertInputValue = (ctx) => {
74
+ if (ctx.selectionBehavior === "preserve") return {};
75
+ if (ctx.selectionBehavior === "clear") return {
76
+ inputValue: "",
77
+ autofill: null
78
+ };
79
+ return {
80
+ inputValue: ctx.value.length > 0 ? stringifyValues(ctx, ctx.value) : "",
81
+ autofill: null
82
+ };
83
+ };
84
+ const inlineAutocomplete = (ctx) => ctx.inputBehavior === "autocomplete" && !ctx.multiple;
85
+ const closeOnSelect = (ctx) => ctx.closeOnSelect;
86
+ const revertsToValue = (ctx) => isCustomValue(ctx) && !ctx.allowCustomValue && ctx.highlightedValue === null;
87
+ const isCustomValueGuard = (ctx) => isCustomValue(ctx) && !ctx.allowCustomValue;
88
+ const inlineSingleGuard = (ctx) => inlineAutocomplete(ctx) && ctx.highlightedValue === at(ctx.order, -1) ? true : false;
89
+ export { applySelection, at, clearHighlightedValue, clearInputValue, clearValue, closeOnSelect, completion, highlightFirstItem, highlightFirstOrSelectedItem, inlineAutocomplete, inlineSingle, inlineSingleGuard, isCustomValueGuard, moveHighlight, revertInputValue, revertsToValue, selectHighlightedItem, selectItem, setHighlightedValue, setInputValue };
90
+
91
+ //# sourceMappingURL=combobox.transitions.js.map
@@ -0,0 +1,61 @@
1
+ <script lang="ts">
2
+ import { combobox } from "../combobox.presentation.js";
3
+
4
+ const machine = combobox({items: [{"value":"apple","label":"Apple"},{"value":"apricot","label":"Apricot"},{"value":"banana","label":"Banana"},{"value":"blueberry","label":"Blueberry"}]});
5
+ </script>
6
+
7
+ <div class="relative w-64 max-w-full" {...machine.getRootProps()}>
8
+ <label
9
+ class={["block text-sm font-medium text-text transition-colors duration-fast ease-decelerate", { "opacity-50 cursor-not-allowed": machine.disabled, "text-primary": machine.focused }]}
10
+ {...machine.getLabelProps()}
11
+ >Fruit</label>
12
+
13
+ <div class="relative" {...machine.getControlProps()}>
14
+ <input
15
+ class={["w-full pr-16 transition-colors duration-fast ease-decelerate placeholder:text-text-muted", { "opacity-60 cursor-not-allowed": machine.disabled, "border-border-strong": machine.invalid, "border-primary": machine.open }]}
16
+ {...machine.getInputProps()}
17
+ />
18
+
19
+ <div class="absolute inset-y-0 right-0 flex items-center gap-1 pr-1">
20
+ <button
21
+ class={["ghost icon s-sm"]}
22
+ {...machine.getClearTriggerProps()}
23
+ ><span aria-hidden="true"><span class="inline-block icon-sm i-lucide-x" aria-hidden="true"></span></span></button>
24
+ <button
25
+ class={["ghost icon s-sm", { "cursor-not-allowed": machine.disabled }]}
26
+ {...machine.getTriggerProps()}
27
+ ><span aria-hidden="true" class={["text-xs transition-transform duration-fast ease-decelerate", { "rotate-180": machine.open }]} {...machine.getTriggerIndicatorProps()}><span class="inline-block icon-sm i-lucide-chevron-down" aria-hidden="true"></span></span></button>
28
+ </div>
29
+
30
+ <div
31
+ class={["absolute left-0 top-full z-dropdown mt-1 w-full origin-top transition duration-fast ease-decelerate", { "pointer-events-none invisible scale-95 opacity-0": !machine.open }]}
32
+ {...machine.getPositionerProps()}
33
+ >
34
+ <div
35
+ class={["overflow-hidden rounded-lg border border-solid border-border bg-surface-raised shadow-lg", { "opacity-60": machine.disabled }]}
36
+ {...machine.getContentProps()}
37
+ >
38
+ <div class={["max-h-[15rem] overflow-y-auto p-1 transition-opacity duration-fast ease-decelerate", { "hidden": machine.empty }]} {...machine.getListProps()}>
39
+ <template for={machine.getBlocks()} as={block} key={block.id}>
40
+ <div class="py-1" {...machine.getItemGroupProps(block)}>
41
+ <span class="block px-2 py-1 text-xs font-medium text-text-muted" {...machine.getItemGroupLabelProps(block)}>{block.label}</span>
42
+ <template for={machine.getRows(block)} as={row} key={row.value}>
43
+ <div
44
+ class={["relative flex cursor-default select-none items-center gap-2 rounded-md px-2 py-1 text-sm text-text transition-colors duration-fast ease-decelerate", { "bg-surface": machine.highlightedValue === row.value, "text-primary": machine.value.includes(row.value), "cursor-not-allowed opacity-50": machine.disabled }]}
45
+ {...machine.getItemProps(row)}
46
+ >
47
+ <span class="min-w-0 flex-1 truncate" {...machine.getItemTextProps(row)}>{row.label}</span>
48
+ <span
49
+ aria-hidden="true"
50
+ class={["shrink-0 text-xs text-primary scale-50 opacity-0 transition-all duration-fast ease-decelerate", { "scale-100 opacity-100": machine.value.includes(row.value) }]}
51
+ {...machine.getItemIndicatorProps(row)}
52
+ ><span class="inline-block icon-sm i-lucide-check" aria-hidden="true"></span></span>
53
+ </div>
54
+ </template>
55
+ </div>
56
+ </template>
57
+ </div>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </div>
@@ -0,0 +1,71 @@
1
+ <script lang="ts">
2
+ import { combobox } from "../combobox.presentation.js";
3
+
4
+ const machine = combobox({
5
+ placeholder: "Search directory...",
6
+ items: [
7
+ { value: "ada", label: "Ada Lovelace — Analytical Engine" },
8
+ { value: "grace", label: "Grace Hopper — Compiler Systems" },
9
+ { value: "margaret", label: "Margaret Hamilton — Flight Software" },
10
+ { value: "barbara", label: "Barbara Liskov — Distributed Systems" },
11
+ { value: "radia", label: "Radia Perlman — Network Routing" },
12
+ ],
13
+ });
14
+ </script>
15
+
16
+ <div class="relative w-64 max-w-full" {...machine.getRootProps()}>
17
+ <label
18
+ class={["block text-sm font-medium text-text transition-colors duration-fast ease-decelerate", { "opacity-50 cursor-not-allowed": machine.disabled, "text-primary": machine.focused }]}
19
+ {...machine.getLabelProps()}
20
+ >Assignee</label>
21
+
22
+ <div class="relative" {...machine.getControlProps()}>
23
+ <input
24
+ class={["w-full pr-16 transition-colors duration-fast ease-decelerate placeholder:text-text-muted", { "opacity-60 cursor-not-allowed": machine.disabled, "border-border-strong": machine.invalid, "border-primary": machine.open }]}
25
+ placeholder="Search directory..."
26
+ {...machine.getInputProps()}
27
+ />
28
+
29
+ <div class="absolute inset-y-0 right-0 flex items-center gap-1 pr-1">
30
+ <button
31
+ class={["ghost icon s-sm"]}
32
+ {...machine.getClearTriggerProps()}
33
+ ><span aria-hidden="true"><span class="inline-block icon-sm i-lucide-x" aria-hidden="true"></span></span></button>
34
+ <button
35
+ class={["ghost icon s-sm", { "cursor-not-allowed": machine.disabled }]}
36
+ {...machine.getTriggerProps()}
37
+ ><span aria-hidden="true" class={["text-xs transition-transform duration-fast ease-decelerate", { "rotate-180": machine.open }]} {...machine.getTriggerIndicatorProps()}><span class="inline-block icon-sm i-lucide-chevron-down" aria-hidden="true"></span></span></button>
38
+ </div>
39
+
40
+ <div
41
+ class={["absolute left-0 top-full z-dropdown mt-1 w-full origin-top transition duration-fast ease-decelerate", { "pointer-events-none invisible scale-95 opacity-0": !machine.open }]}
42
+ {...machine.getPositionerProps()}
43
+ >
44
+ <div
45
+ class={["overflow-hidden rounded-lg border border-solid border-border bg-surface-raised shadow-lg", { "opacity-60": machine.disabled }]}
46
+ {...machine.getContentProps()}
47
+ >
48
+ <div class={["max-h-[15rem] overflow-y-auto p-1 transition-opacity duration-fast ease-decelerate", { "hidden": machine.empty }]} {...machine.getListProps()}>
49
+ <template for={machine.getBlocks()} as={block} key={block.id}>
50
+ <div class="py-1" {...machine.getItemGroupProps(block)}>
51
+ <span class="block px-2 py-1 text-xs font-medium text-text-muted" {...machine.getItemGroupLabelProps(block)}>{block.label}</span>
52
+ <template for={machine.getRows(block)} as={row} key={row.value}>
53
+ <div
54
+ class={["relative flex cursor-default select-none items-center gap-2 rounded-md px-2 py-1 text-sm text-text transition-colors duration-fast ease-decelerate", { "bg-surface": machine.highlightedValue === row.value, "text-primary": machine.value.includes(row.value), "cursor-not-allowed opacity-50": machine.disabled }]}
55
+ {...machine.getItemProps(row)}
56
+ >
57
+ <span class="min-w-0 flex-1 truncate" {...machine.getItemTextProps(row)}>{row.label}</span>
58
+ <span
59
+ aria-hidden="true"
60
+ class={["shrink-0 text-xs text-primary scale-50 opacity-0 transition-all duration-fast ease-decelerate", { "scale-100 opacity-100": machine.value.includes(row.value) }]}
61
+ {...machine.getItemIndicatorProps(row)}
62
+ ><span class="inline-block icon-sm i-lucide-check" aria-hidden="true"></span></span>
63
+ </div>
64
+ </template>
65
+ </div>
66
+ </template>
67
+ </div>
68
+ </div>
69
+ </div>
70
+ </div>
71
+ </div>
@@ -0,0 +1,36 @@
1
+ <script lang="ts">
2
+ import { combobox } from "../combobox.presentation.js";
3
+
4
+ const machine = combobox({items: [{"value":"react","label":"React","group":"JS"},{"value":"solid","label":"Solid","group":"JS"},{"value":"vue","label":"Vue","group":"JS"},{"value":"svelte","label":"Svelte","group":"JS"},{"value":"panda","label":"Panda","group":"CSS"},{"value":"tailwind","label":"Tailwind","group":"CSS"}]});
5
+ </script>
6
+
7
+ <div class="relative w-64 max-w-full" {...machine.getRootProps()}>
8
+ <label class={["block text-sm font-medium text-text transition-colors duration-fast ease-decelerate", { "opacity-50 cursor-not-allowed": machine.disabled, "text-primary": machine.focused }]} {...machine.getLabelProps()}>Technology</label>
9
+
10
+ <div class="relative" {...machine.getControlProps()}>
11
+ <input class={["w-full pr-16 transition-colors duration-fast ease-decelerate placeholder:text-text-muted", { "opacity-60 cursor-not-allowed": machine.disabled, "border-border-strong": machine.invalid, "border-primary": machine.open }]} {...machine.getInputProps()} placeholder="Select a technology..." />
12
+
13
+ <div class="absolute inset-y-0 right-0 flex items-center gap-1 pr-1">
14
+ <button class={["ghost icon s-sm"]} {...machine.getClearTriggerProps()}><span aria-hidden="true"><span class="inline-block icon-sm i-lucide-x" aria-hidden="true"></span></span></button>
15
+ <button class={["ghost icon s-sm", { "cursor-not-allowed": machine.disabled }]} {...machine.getTriggerProps()}><span aria-hidden="true" class={["text-xs transition-transform duration-fast ease-decelerate", { "rotate-180": machine.open }]} {...machine.getTriggerIndicatorProps()}><span class="inline-block icon-sm i-lucide-chevron-down" aria-hidden="true"></span></span></button>
16
+ </div>
17
+
18
+ <div class={["absolute left-0 top-full z-dropdown mt-1 w-full origin-top transition duration-fast ease-decelerate", { "pointer-events-none invisible scale-95 opacity-0": !machine.open }]} {...machine.getPositionerProps()}>
19
+ <div class={["overflow-hidden rounded-lg border border-solid border-border bg-surface-raised shadow-lg", { "opacity-60": machine.disabled }]} {...machine.getContentProps()}>
20
+ <div class={["max-h-[15rem] overflow-y-auto p-1 transition-opacity duration-fast ease-decelerate", { "hidden": machine.empty }]} {...machine.getListProps()}>
21
+ <template for={machine.getBlocks()} as={block} key={block.id}>
22
+ <div class="py-1" {...machine.getItemGroupProps(block)}>
23
+ <span class="block px-2 py-1 text-xs font-medium text-text-muted" {...machine.getItemGroupLabelProps(block)}>{block.label}</span>
24
+ <template for={machine.getRows(block)} as={row} key={row.value}>
25
+ <div class={["relative flex cursor-default select-none items-center gap-2 rounded-md px-2 py-1 text-sm text-text transition-colors duration-fast ease-decelerate", { "bg-surface": machine.highlightedValue === row.value, "text-primary": machine.value.includes(row.value), "cursor-not-allowed opacity-50": machine.disabled }]} {...machine.getItemProps(row)}>
26
+ <span class="min-w-0 flex-1 truncate" {...machine.getItemTextProps(row)}>{row.label}</span>
27
+ <span aria-hidden="true" class={["shrink-0 text-xs text-primary scale-50 opacity-0 transition-all duration-fast ease-decelerate", { "scale-100 opacity-100": machine.value.includes(row.value) }]} {...machine.getItemIndicatorProps(row)}><span class="inline-block icon-sm i-lucide-check" aria-hidden="true"></span></span>
28
+ </div>
29
+ </template>
30
+ </div>
31
+ </template>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ </div>
@@ -0,0 +1,37 @@
1
+ <script lang="ts">
2
+ import { combobox } from "../combobox.presentation.js";
3
+
4
+ const machine = combobox({multiple: true, items: [{"value":"javascript","label":"JavaScript"},{"value":"typescript","label":"TypeScript"},{"value":"react","label":"React"},{"value":"vue","label":"Vue"},{"value":"angular","label":"Angular"},{"value":"svelte","label":"Svelte"}]});
5
+ </script>
6
+
7
+ <div class="relative w-64 max-w-full" {...machine.getRootProps()}>
8
+ <label class={["block text-sm font-medium text-text transition-colors duration-fast ease-decelerate", { "opacity-50 cursor-not-allowed": machine.disabled, "text-primary": machine.focused }]} {...machine.getLabelProps()}>Skills</label>
9
+
10
+ <div class="relative" {...machine.getControlProps()}>
11
+ <input class={["w-full pr-16 transition-colors duration-fast ease-decelerate placeholder:text-text-muted", { "opacity-60 cursor-not-allowed": machine.disabled, "border-border-strong": machine.invalid, "border-primary": machine.open }]} {...machine.getInputProps()} placeholder="Add skills..." />
12
+
13
+ <div class="absolute inset-y-0 right-0 flex items-center gap-1 pr-1">
14
+ <button class={["ghost icon s-sm"]} {...machine.getClearTriggerProps()}><span aria-hidden="true"><span class="inline-block icon-sm i-lucide-x" aria-hidden="true"></span></span></button>
15
+ <button class={["ghost icon s-sm", { "cursor-not-allowed": machine.disabled }]} {...machine.getTriggerProps()}><span aria-hidden="true" class={["text-xs transition-transform duration-fast ease-decelerate", { "rotate-180": machine.open }]} {...machine.getTriggerIndicatorProps()}><span class="inline-block icon-sm i-lucide-chevron-down" aria-hidden="true"></span></span></button>
16
+ </div>
17
+
18
+ <div class={["absolute left-0 top-full z-dropdown mt-1 w-full origin-top transition duration-fast ease-decelerate", { "pointer-events-none invisible scale-95 opacity-0": !machine.open }]} {...machine.getPositionerProps()}>
19
+ <div class={["overflow-hidden rounded-lg border border-solid border-border bg-surface-raised shadow-lg", { "opacity-60": machine.disabled }]} {...machine.getContentProps()}>
20
+ <div class={["max-h-[15rem] overflow-y-auto p-1 transition-opacity duration-fast ease-decelerate", { "hidden": machine.empty }]} {...machine.getListProps()}>
21
+ <template for={machine.getBlocks()} as={block} key={block.id}>
22
+ <div class="py-1" {...machine.getItemGroupProps(block)}>
23
+ <span class="block px-2 py-1 text-xs font-medium text-text-muted" {...machine.getItemGroupLabelProps(block)}>{block.label}</span>
24
+ <template for={machine.getRows(block)} as={row} key={row.value}>
25
+ <div class={["relative flex cursor-default select-none items-center gap-2 rounded-md px-2 py-1 text-sm text-text transition-colors duration-fast ease-decelerate", { "bg-surface": machine.highlightedValue === row.value, "text-primary": machine.value.includes(row.value), "cursor-not-allowed opacity-50": machine.disabled }]} {...machine.getItemProps(row)}>
26
+ <span class="min-w-0 flex-1 truncate" {...machine.getItemTextProps(row)}>{row.label}</span>
27
+ <span aria-hidden="true" class={["shrink-0 text-xs text-primary scale-50 opacity-0 transition-all duration-fast ease-decelerate", { "scale-100 opacity-100": machine.value.includes(row.value) }]} {...machine.getItemIndicatorProps(row)}><span class="inline-block icon-sm i-lucide-check" aria-hidden="true"></span></span>
28
+ </div>
29
+ </template>
30
+ </div>
31
+ </template>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ <p class="mt-2 text-xs text-text-muted" show={machine.hasSelectedItems}>Selected: {machine.valueAsString}</p>
37
+ </div>
@@ -0,0 +1,52 @@
1
+ import { DefinedComponent } from "@spinjs/runtime";
2
+ /**
3
+ * The app-controller surface: `{ commands, state, bind, ref }`, for whichever
4
+ * component the host is holding.
5
+ *
6
+ * A component owns its state — a machine does, or the platform does behind a
7
+ * thin adapter. This handle does not care which: it is the instrument the
8
+ * host's app controller uses to reach it, through the same context markup
9
+ * consumes. Nothing here owns state, and nothing here re-implements the
10
+ * element — the host already has the element; this is what you can DO with
11
+ * it.
12
+ *
13
+ * `bind` needs only the element, so it works before the component connects
14
+ * — which matters, because a seed (`defaultValue`, `startMs`) is read during
15
+ * the component's build and a write that arrives after it is too late.
16
+ * `commands` and `state` resolve through the component's registered
17
+ * controller, which exists once it has connected; before then commands are
18
+ * safe no-ops and unknown state keys read `undefined`, and after they are
19
+ * the component's own surface.
20
+ */
21
+ /** Any element locator: the element now, or a read of it on every access. */
22
+ export type ElementTarget = Element | (() => Element | null | undefined) | {
23
+ readonly current?: Element | null | undefined;
24
+ } | {
25
+ readonly value?: Element | null | undefined;
26
+ } | null | undefined;
27
+ /** Prop-getter names never surface as commands. */
28
+ export type PropGetterName = `get${string}Props` | `get${string}Indexes`;
29
+ /** The callable members of an api, minus prop getters. */
30
+ export type CommandsOf<Api extends object> = { readonly [K in keyof Api as K extends PropGetterName ? never : Api[K] extends ((...args: never[]) => unknown) ? K : never]: Api[K]; };
31
+ /** The readable members of an api, as reactive thunks. */
32
+ export type StateOf<Api extends object> = { readonly [K in keyof Api as Api[K] extends ((...args: never[]) => unknown) ? never : K]: () => Api[K]; };
33
+ /** The inferred ctl for a `DefinedComponent`. */
34
+ export type CtlFor<D> = D extends DefinedComponent<infer Api, infer A> ? SpinComponentCtl<CommandsOf<Api>, StateOf<Api>, Partial<A>> : never;
35
+ /** What a host holds when it holds a spin component. */
36
+ export interface SpinComponentCtl<TCommands extends object = object, TState extends object = Record<string, () => unknown>, TProps extends object = Record<string, unknown>> {
37
+ /** Imperative calls the component declares. */
38
+ readonly commands: TCommands;
39
+ /** Reactive reads of the component's observable state. */
40
+ readonly state: TState;
41
+ /** The element setter for JSX `ref={ctl.ref}`; feeds `bind` and resolution. */
42
+ readonly ref: (el: Element | null | undefined) => void;
43
+ /** The controlled channel: props down, events up. */
44
+ bind(props?: TProps, on?: Readonly<Record<string, (event: CustomEvent) => void>>): () => void;
45
+ /** Re-run `listener` on any state move; returns a disposer. */
46
+ subscribe(listener: () => void): () => void;
47
+ }
48
+ /** The ctl for `target` — never nullish; resolution happens at call time. */
49
+ export declare function spinComponentCtl<D extends DefinedComponent<any, any>>(def: D): CtlFor<D>;
50
+ export declare function spinComponentCtl<D extends DefinedComponent<any, any>>(target: ElementTarget, def: D): CtlFor<D>;
51
+ export declare function spinComponentCtl<TCommands extends object = object, TState extends object = Record<string, () => unknown>, TProps extends object = Record<string, unknown>>(target: ElementTarget, handle?: object): SpinComponentCtl<TCommands, TState, TProps>;
52
+ //# sourceMappingURL=controller.d.ts.map
@@ -0,0 +1,90 @@
1
+ import { bindSpinElement } from "./spin-element.js";
2
+ import { controllerOf, effect, scope, signal } from "@spinjs/runtime";
3
+ // src/controller.ts
4
+ function resolveTarget(target) {
5
+ if (target === null || target === void 0) return void 0;
6
+ if (typeof target === "function") return target() ?? void 0;
7
+ if (typeof target !== "object") return void 0;
8
+ if ("current" in target) return target.current ?? void 0;
9
+ if ("value" in target) return target.value ?? void 0;
10
+ return target;
11
+ }
12
+ function spinComponentCtl(target, handleOrDef) {
13
+ const isDef = (value) => typeof value === "function" && "createBridge" in value;
14
+ const targetArg = isDef(target) ? void 0 : target;
15
+ const node = signal(resolveTarget(targetArg));
16
+ const handle = isDef(handleOrDef) ? handleOrDef : handleOrDef;
17
+ const resolveController = () => {
18
+ const el = node() ?? resolveTarget(targetArg);
19
+ return el === void 0 ? void 0 : controllerOf(el, handle);
20
+ };
21
+ return {
22
+ commands: new Proxy({}, {
23
+ get: (_t, key) => {
24
+ const found = resolveController()?.commands[key];
25
+ if (typeof found === "function") return found;
26
+ return (..._args) => {};
27
+ },
28
+ has: (_t, key) => key in (resolveController()?.commands ?? {}),
29
+ ownKeys: () => Reflect.ownKeys(resolveController()?.commands ?? {}),
30
+ getOwnPropertyDescriptor: (_t, key) => {
31
+ const descriptor = Reflect.getOwnPropertyDescriptor(resolveController()?.commands ?? {}, key);
32
+ if (descriptor === void 0) return {
33
+ configurable: true,
34
+ enumerable: true
35
+ };
36
+ return {
37
+ ...descriptor,
38
+ configurable: true
39
+ };
40
+ }
41
+ }),
42
+ state: new Proxy({}, {
43
+ get: (_t, key) => {
44
+ const found = resolveController()?.state[key];
45
+ if (typeof found === "function") return found;
46
+ return () => void 0;
47
+ },
48
+ has: (_t, key) => key in (resolveController()?.state ?? {}),
49
+ ownKeys: () => Reflect.ownKeys(resolveController()?.state ?? {}),
50
+ getOwnPropertyDescriptor: (_t, key) => {
51
+ const descriptor = Reflect.getOwnPropertyDescriptor(resolveController()?.state ?? {}, key);
52
+ if (descriptor === void 0) return {
53
+ configurable: true,
54
+ enumerable: true
55
+ };
56
+ return {
57
+ ...descriptor,
58
+ configurable: true
59
+ };
60
+ }
61
+ }),
62
+ ref: (el) => {
63
+ node(el ?? void 0);
64
+ },
65
+ bind(props, on) {
66
+ const el = node() ?? resolveTarget(targetArg);
67
+ if (el === void 0) return () => {};
68
+ return bindSpinElement(el, {
69
+ props,
70
+ on
71
+ });
72
+ },
73
+ subscribe(listener) {
74
+ const owner = scope();
75
+ let first = true;
76
+ owner.run(() => effect(() => {
77
+ for (const read of Object.values(resolveController()?.state ?? {})) read();
78
+ if (first) {
79
+ first = false;
80
+ return;
81
+ }
82
+ listener();
83
+ }));
84
+ return () => owner.dispose();
85
+ }
86
+ };
87
+ }
88
+ export { spinComponentCtl };
89
+
90
+ //# sourceMappingURL=controller.js.map