@splendidlabz/svelte 4.0.0-alpha.2 → 4.0.0-beta.4

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 (380) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/components/Breadcrumbs/Breadcrumbs.svelte +37 -14
  3. package/components/Breadcrumbs/Crumb.svelte +31 -17
  4. package/components/Breadcrumbs/CrumbCustom.svelte +12 -8
  5. package/components/BrowserFrame/BrowserFrame.svelte +13 -6
  6. package/components/Callout/Callout.svelte +3 -3
  7. package/components/ContentList/ContentList.svelte +3 -3
  8. package/components/Disclosure/DrawerNew/DrawerClose.svelte +0 -2
  9. package/components/Form/Form.svelte +32 -40
  10. package/components/Form/HiddenInput.svelte +2 -2
  11. package/components/Form/TextInput.svelte +8 -8
  12. package/components/Form/Textarea.svelte +7 -7
  13. package/components/Resizer/Resizer.svelte +19 -13
  14. package/components/Resizer/resizer.js +1 -0
  15. package/components/Scrambler/Scrambler.svelte +5 -12
  16. package/components/Status.svelte +20 -20
  17. package/components/Tabs/Tab.svelte +4 -2
  18. package/components/Tabs/Tabpanel.svelte +5 -3
  19. package/components/Tabs/Tabpanels.svelte +4 -2
  20. package/components/Tabs/tabs.js +5 -5
  21. package/components/_Shared/Snippet.svelte +10 -0
  22. package/dist/actions/breakpoint-observer.d.ts +3 -0
  23. package/dist/actions/breakpoint-observer.js +71 -0
  24. package/dist/actions/index.d.ts +5 -0
  25. package/dist/actions/index.js +5 -0
  26. package/dist/actions/portal.d.ts +3 -0
  27. package/dist/actions/portal.js +20 -0
  28. package/dist/actions/resize-observer.d.ts +7 -0
  29. package/dist/actions/resize-observer.js +43 -0
  30. package/dist/actions/scroll-observer.d.ts +8 -0
  31. package/dist/actions/scroll-observer.js +47 -0
  32. package/dist/actions/sync.svelte.d.ts +5 -0
  33. package/dist/actions/sync.svelte.js +21 -0
  34. package/dist/actions/use-actions.d.ts +4 -0
  35. package/dist/actions/use-actions.js +27 -0
  36. package/dist/actions/use-transition.d.ts +4 -0
  37. package/dist/actions/use-transition.js +32 -0
  38. package/dist/common.d.ts +17 -0
  39. package/dist/common.js +21 -0
  40. package/dist/components/Accordion/Accordion.svelte +111 -0
  41. package/dist/components/Accordion/Accordion.svelte.d.ts +23 -0
  42. package/dist/components/Accordion/index.d.ts +2 -0
  43. package/dist/components/Accordion/index.js +3 -0
  44. package/dist/components/Breadcrumbs/Breadcrumbs.svelte +92 -0
  45. package/dist/components/Breadcrumbs/Breadcrumbs.svelte.d.ts +23 -0
  46. package/dist/components/Breadcrumbs/Crumb.svelte +51 -0
  47. package/dist/components/Breadcrumbs/Crumb.svelte.d.ts +23 -0
  48. package/dist/components/Breadcrumbs/CrumbCustom.svelte +18 -0
  49. package/dist/components/Breadcrumbs/CrumbCustom.svelte.d.ts +23 -0
  50. package/dist/components/Breadcrumbs/index.d.ts +4 -0
  51. package/dist/components/Breadcrumbs/index.js +5 -0
  52. package/dist/components/BrowserFrame/BrowserFrame.svelte +101 -0
  53. package/dist/components/BrowserFrame/BrowserFrame.svelte.d.ts +23 -0
  54. package/dist/components/BrowserFrame/BrowserWithTabs.svelte +37 -0
  55. package/dist/components/BrowserFrame/BrowserWithTabs.svelte.d.ts +41 -0
  56. package/dist/components/BrowserFrame/index.d.ts +3 -0
  57. package/dist/components/BrowserFrame/index.js +3 -0
  58. package/dist/components/CQChecker/CQChecker.astro +20 -0
  59. package/dist/components/CQChecker/CQChecker.svelte +89 -0
  60. package/dist/components/CQChecker/CQChecker.svelte.d.ts +35 -0
  61. package/dist/components/Callout/Callout.svelte +17 -0
  62. package/dist/components/Callout/Callout.svelte.d.ts +29 -0
  63. package/dist/components/Callout/index.d.ts +2 -0
  64. package/dist/components/Callout/index.js +3 -0
  65. package/dist/components/Codepen/Codepen.astro +29 -0
  66. package/dist/components/Codepen/Codepen.svelte +24 -0
  67. package/dist/components/Codepen/Codepen.svelte.d.ts +35 -0
  68. package/dist/components/Codepen/index.d.ts +2 -0
  69. package/dist/components/Codepen/index.js +3 -0
  70. package/dist/components/ContentList/ContentList-old.svelte +117 -0
  71. package/dist/components/ContentList/ContentList-old.svelte.d.ts +31 -0
  72. package/dist/components/ContentList/ContentList.svelte +68 -0
  73. package/dist/components/ContentList/ContentList.svelte.d.ts +45 -0
  74. package/dist/components/ContentList/index.d.ts +2 -0
  75. package/dist/components/ContentList/index.js +3 -0
  76. package/dist/components/Copyright.svelte +19 -0
  77. package/dist/components/Copyright.svelte.d.ts +23 -0
  78. package/dist/components/Disclosure/Disclosure/DisclosureCloseButton.svelte +37 -0
  79. package/dist/components/Disclosure/Disclosure/DisclosureCloseButton.svelte.d.ts +23 -0
  80. package/dist/components/Disclosure/Disclosure/DisclosureContent.svelte +97 -0
  81. package/dist/components/Disclosure/Disclosure/DisclosureContent.svelte.d.ts +23 -0
  82. package/dist/components/Disclosure/Disclosure/DisclosureTrigger.svelte +51 -0
  83. package/dist/components/Disclosure/Disclosure/DisclosureTrigger.svelte.d.ts +23 -0
  84. package/dist/components/Disclosure/Disclosure/disclosure-popover.svelte.d.ts +2 -0
  85. package/dist/components/Disclosure/Disclosure/disclosure-popover.svelte.js +7 -0
  86. package/dist/components/Disclosure/Disclosure/disclosure.svelte.d.ts +81 -0
  87. package/dist/components/Disclosure/Disclosure/disclosure.svelte.js +461 -0
  88. package/dist/components/Disclosure/Disclosure/index.d.ts +3 -0
  89. package/dist/components/Disclosure/Disclosure/index.js +4 -0
  90. package/dist/components/Disclosure/DisclosureNew/DisclosureCloseButton.svelte +38 -0
  91. package/dist/components/Disclosure/DisclosureNew/DisclosureCloseButton.svelte.d.ts +23 -0
  92. package/dist/components/Disclosure/DisclosureNew/DisclosureContent.svelte +53 -0
  93. package/dist/components/Disclosure/DisclosureNew/DisclosureContent.svelte.d.ts +23 -0
  94. package/dist/components/Disclosure/DisclosureNew/DisclosureTrigger.svelte +79 -0
  95. package/dist/components/Disclosure/DisclosureNew/DisclosureTrigger.svelte.d.ts +23 -0
  96. package/dist/components/Disclosure/DisclosureNew/disclosures.svelte.d.ts +3 -0
  97. package/dist/components/Disclosure/DisclosureNew/disclosures.svelte.js +55 -0
  98. package/dist/components/Disclosure/DisclosureNew/index.d.ts +4 -0
  99. package/dist/components/Disclosure/DisclosureNew/index.js +5 -0
  100. package/dist/components/Disclosure/Drawer/Drawer.svelte +31 -0
  101. package/dist/components/Disclosure/Drawer/Drawer.svelte.d.ts +23 -0
  102. package/dist/components/Disclosure/Drawer/DrawerCloseButton.svelte +37 -0
  103. package/dist/components/Disclosure/Drawer/DrawerCloseButton.svelte.d.ts +23 -0
  104. package/dist/components/Disclosure/Drawer/DrawerContent.svelte +92 -0
  105. package/dist/components/Disclosure/Drawer/DrawerContent.svelte.d.ts +23 -0
  106. package/dist/components/Disclosure/Drawer/DrawerNew.svelte +0 -0
  107. package/dist/components/Disclosure/Drawer/DrawerNew.svelte.d.ts +23 -0
  108. package/dist/components/Disclosure/Drawer/DrawerTrigger.svelte +11 -0
  109. package/dist/components/Disclosure/Drawer/DrawerTrigger.svelte.d.ts +23 -0
  110. package/dist/components/Disclosure/Drawer/drawer.d.ts +35 -0
  111. package/dist/components/Disclosure/Drawer/drawer.js +44 -0
  112. package/dist/components/Disclosure/Drawer/index.d.ts +5 -0
  113. package/dist/components/Disclosure/Drawer/index.js +6 -0
  114. package/dist/components/Disclosure/DrawerNew/Drawer.svelte +43 -0
  115. package/dist/components/Disclosure/DrawerNew/Drawer.svelte.d.ts +23 -0
  116. package/dist/components/Disclosure/DrawerNew/DrawerClose.svelte +17 -0
  117. package/dist/components/Disclosure/DrawerNew/DrawerClose.svelte.d.ts +23 -0
  118. package/dist/components/Disclosure/DrawerNew/DrawerTrigger.svelte +15 -0
  119. package/dist/components/Disclosure/DrawerNew/DrawerTrigger.svelte.d.ts +23 -0
  120. package/dist/components/Disclosure/DrawerNew/drawer.d.ts +35 -0
  121. package/dist/components/Disclosure/DrawerNew/drawer.js +44 -0
  122. package/dist/components/Disclosure/DrawerNew/index.d.ts +4 -0
  123. package/dist/components/Disclosure/DrawerNew/index.js +5 -0
  124. package/dist/components/Disclosure/Dropdown/DropdownContent.svelte +15 -0
  125. package/dist/components/Disclosure/Dropdown/DropdownContent.svelte.d.ts +29 -0
  126. package/dist/components/Disclosure/Dropdown/DropdownTrigger.svelte +14 -0
  127. package/dist/components/Disclosure/Dropdown/DropdownTrigger.svelte.d.ts +31 -0
  128. package/dist/components/Disclosure/Dropdown/dropdown.d.ts +4 -0
  129. package/dist/components/Disclosure/Dropdown/dropdown.js +4 -0
  130. package/dist/components/Disclosure/Dropdown/index.d.ts +3 -0
  131. package/dist/components/Disclosure/Dropdown/index.js +4 -0
  132. package/dist/components/Disclosure/Modal/Modal.svelte +30 -0
  133. package/dist/components/Disclosure/Modal/Modal.svelte.d.ts +23 -0
  134. package/dist/components/Disclosure/Modal/ModalCloseButton.svelte +7 -0
  135. package/dist/components/Disclosure/Modal/ModalCloseButton.svelte.d.ts +23 -0
  136. package/dist/components/Disclosure/Modal/ModalContent.svelte +42 -0
  137. package/dist/components/Disclosure/Modal/ModalContent.svelte.d.ts +23 -0
  138. package/dist/components/Disclosure/Modal/ModalTrigger.svelte +11 -0
  139. package/dist/components/Disclosure/Modal/ModalTrigger.svelte.d.ts +23 -0
  140. package/dist/components/Disclosure/Modal/exit-intent.d.ts +3 -0
  141. package/dist/components/Disclosure/Modal/exit-intent.js +17 -0
  142. package/dist/components/Disclosure/Modal/index.d.ts +4 -0
  143. package/dist/components/Disclosure/Modal/index.js +5 -0
  144. package/dist/components/Disclosure/Modal/modal.d.ts +4 -0
  145. package/dist/components/Disclosure/Modal/modal.js +4 -0
  146. package/dist/components/Disclosure/ModalNew/Modal.svelte +116 -0
  147. package/dist/components/Disclosure/ModalNew/Modal.svelte.d.ts +23 -0
  148. package/dist/components/Disclosure/ModalNew/ModalClose.svelte +42 -0
  149. package/dist/components/Disclosure/ModalNew/ModalClose.svelte.d.ts +23 -0
  150. package/dist/components/Disclosure/ModalNew/ModalTrigger.svelte +68 -0
  151. package/dist/components/Disclosure/ModalNew/ModalTrigger.svelte.d.ts +23 -0
  152. package/dist/components/Disclosure/ModalNew/index.d.ts +4 -0
  153. package/dist/components/Disclosure/ModalNew/index.js +5 -0
  154. package/dist/components/Disclosure/Popover/PopoverCloseButton.svelte +29 -0
  155. package/dist/components/Disclosure/Popover/PopoverCloseButton.svelte.d.ts +35 -0
  156. package/dist/components/Disclosure/Popover/PopoverContent.svelte +107 -0
  157. package/dist/components/Disclosure/Popover/PopoverContent.svelte.d.ts +47 -0
  158. package/dist/components/Disclosure/Popover/PopoverTrigger.svelte +33 -0
  159. package/dist/components/Disclosure/Popover/PopoverTrigger.svelte.d.ts +41 -0
  160. package/dist/components/Disclosure/Popover/floating.d.ts +11 -0
  161. package/dist/components/Disclosure/Popover/floating.js +171 -0
  162. package/dist/components/Disclosure/Popover/index.d.ts +4 -0
  163. package/dist/components/Disclosure/Popover/index.js +5 -0
  164. package/dist/components/Disclosure/Popover/popover.d.ts +16 -0
  165. package/dist/components/Disclosure/Popover/popover.js +18 -0
  166. package/dist/components/Disclosure/Popover/references/FollowTheMouse.svelte +45 -0
  167. package/dist/components/Disclosure/Popover/references/FollowTheMouse.svelte.d.ts +14 -0
  168. package/dist/components/Disclosure/PopoverNew/Popover.svelte +119 -0
  169. package/dist/components/Disclosure/PopoverNew/Popover.svelte.d.ts +23 -0
  170. package/dist/components/Disclosure/PopoverNew/PopoverClose.svelte +38 -0
  171. package/dist/components/Disclosure/PopoverNew/PopoverClose.svelte.d.ts +23 -0
  172. package/dist/components/Disclosure/PopoverNew/PopoverTrigger.svelte +67 -0
  173. package/dist/components/Disclosure/PopoverNew/PopoverTrigger.svelte.d.ts +23 -0
  174. package/dist/components/Disclosure/PopoverNew/floating.d.ts +15 -0
  175. package/dist/components/Disclosure/PopoverNew/floating.js +329 -0
  176. package/dist/components/Disclosure/PopoverNew/index.d.ts +4 -0
  177. package/dist/components/Disclosure/PopoverNew/index.js +5 -0
  178. package/dist/components/Disclosure/Tooltip/Tooltip.svelte +14 -0
  179. package/dist/components/Disclosure/Tooltip/Tooltip.svelte.d.ts +23 -0
  180. package/dist/components/Disclosure/Tooltip/TooltipContent.svelte +7 -0
  181. package/dist/components/Disclosure/Tooltip/TooltipContent.svelte.d.ts +23 -0
  182. package/dist/components/Disclosure/Tooltip/TooltipTrigger.svelte +33 -0
  183. package/dist/components/Disclosure/Tooltip/TooltipTrigger.svelte.d.ts +35 -0
  184. package/dist/components/Disclosure/Tooltip/index.d.ts +4 -0
  185. package/dist/components/Disclosure/Tooltip/index.js +5 -0
  186. package/dist/components/Disclosure/Tooltip/tooltip.d.ts +19 -0
  187. package/dist/components/Disclosure/Tooltip/tooltip.js +22 -0
  188. package/dist/components/Disclosure/disclosure-store.d.ts +21 -0
  189. package/dist/components/Disclosure/disclosure-store.js +48 -0
  190. package/dist/components/Disclosure/disclosure.d.ts +81 -0
  191. package/dist/components/Disclosure/disclosure.js +439 -0
  192. package/dist/components/Disclosure/disclosure.svelte.d.ts +83 -0
  193. package/dist/components/Disclosure/disclosure.svelte.js +432 -0
  194. package/dist/components/Disclosure/index.d.ts +3 -0
  195. package/dist/components/Disclosure/index.js +7 -0
  196. package/dist/components/Disclosure/shared.d.ts +2 -0
  197. package/dist/components/Disclosure/shared.js +9 -0
  198. package/dist/components/Disclosure/state.svelte.d.ts +0 -0
  199. package/dist/components/Disclosure/state.svelte.js +138 -0
  200. package/dist/components/FancyList/FancyList.svelte +49 -0
  201. package/dist/components/FancyList/FancyList.svelte.d.ts +42 -0
  202. package/dist/components/FancyList/index.d.ts +2 -0
  203. package/dist/components/FancyList/index.js +3 -0
  204. package/dist/components/Form/Button.svelte +24 -0
  205. package/dist/components/Form/Button.svelte.d.ts +35 -0
  206. package/dist/components/Form/Checkbox.svelte +95 -0
  207. package/dist/components/Form/Checkbox.svelte.d.ts +23 -0
  208. package/dist/components/Form/Checkboxes.svelte +66 -0
  209. package/dist/components/Form/Checkboxes.svelte.d.ts +23 -0
  210. package/dist/components/Form/Combobox/AutocompleteInput.svelte +63 -0
  211. package/dist/components/Form/Combobox/AutocompleteInput.svelte.d.ts +31 -0
  212. package/dist/components/Form/Combobox/AutocompleteOptions.svelte +74 -0
  213. package/dist/components/Form/Combobox/AutocompleteOptions.svelte.d.ts +35 -0
  214. package/dist/components/Form/Combobox/TimepickerInput.svelte +81 -0
  215. package/dist/components/Form/Combobox/TimepickerInput.svelte.d.ts +31 -0
  216. package/dist/components/Form/Combobox/TimepickerOptions.svelte +100 -0
  217. package/dist/components/Form/Combobox/TimepickerOptions.svelte.d.ts +27 -0
  218. package/dist/components/Form/Combobox/autocomplete-matching.d.ts +13 -0
  219. package/dist/components/Form/Combobox/autocomplete-matching.js +114 -0
  220. package/dist/components/Form/Combobox/autocomplete.d.ts +38 -0
  221. package/dist/components/Form/Combobox/autocomplete.js +393 -0
  222. package/dist/components/Form/Combobox/combobox-store.d.ts +24 -0
  223. package/dist/components/Form/Combobox/combobox-store.js +65 -0
  224. package/dist/components/Form/Combobox/combobox.d.ts +46 -0
  225. package/dist/components/Form/Combobox/combobox.js +360 -0
  226. package/dist/components/Form/Combobox/index.d.ts +5 -0
  227. package/dist/components/Form/Combobox/index.js +14 -0
  228. package/dist/components/Form/Combobox/timepicker.d.ts +22 -0
  229. package/dist/components/Form/Combobox/timepicker.js +119 -0
  230. package/dist/components/Form/Form.svelte +54 -0
  231. package/dist/components/Form/Form.svelte.d.ts +23 -0
  232. package/dist/components/Form/Hidden.svelte +6 -0
  233. package/dist/components/Form/Hidden.svelte.d.ts +23 -0
  234. package/dist/components/Form/HiddenInput.svelte +16 -0
  235. package/dist/components/Form/HiddenInput.svelte.d.ts +31 -0
  236. package/dist/components/Form/Radio.svelte +86 -0
  237. package/dist/components/Form/Radio.svelte.d.ts +23 -0
  238. package/dist/components/Form/Radios.svelte +68 -0
  239. package/dist/components/Form/Radios.svelte.d.ts +23 -0
  240. package/dist/components/Form/Select.svelte +175 -0
  241. package/dist/components/Form/Select.svelte.d.ts +23 -0
  242. package/dist/components/Form/SelectOld2.svelte +127 -0
  243. package/dist/components/Form/SelectOld2.svelte.d.ts +55 -0
  244. package/dist/components/Form/Switch.svelte +50 -0
  245. package/dist/components/Form/Switch.svelte.d.ts +39 -0
  246. package/dist/components/Form/TextInput.svelte +110 -0
  247. package/dist/components/Form/TextInput.svelte.d.ts +23 -0
  248. package/dist/components/Form/Textarea.svelte +126 -0
  249. package/dist/components/Form/Textarea.svelte.d.ts +23 -0
  250. package/dist/components/Form/check.svg +3 -0
  251. package/dist/components/Form/index.d.ts +13 -0
  252. package/dist/components/Form/index.js +13 -0
  253. package/dist/components/Highlight/Highlight.svelte +27 -0
  254. package/dist/components/Highlight/Highlight.svelte.d.ts +31 -0
  255. package/dist/components/Highlight/_Highlight.scss +19 -0
  256. package/dist/components/Highlight/index.d.ts +2 -0
  257. package/dist/components/Highlight/index.js +2 -0
  258. package/dist/components/Highlight.svelte +46 -0
  259. package/dist/components/Highlight.svelte.d.ts +27 -0
  260. package/dist/components/Icon/Icon.svelte +44 -0
  261. package/dist/components/Icon/Icon.svelte.d.ts +27 -0
  262. package/dist/components/Icon/IconSnippet.svelte +14 -0
  263. package/dist/components/Icon/IconSnippet.svelte.d.ts +30 -0
  264. package/dist/components/Icon/index.d.ts +3 -0
  265. package/dist/components/Icon/index.js +3 -0
  266. package/dist/components/Image.svelte +24 -0
  267. package/dist/components/Image.svelte.d.ts +33 -0
  268. package/dist/components/InteractiveRegion/InteractiveRegion.svelte +47 -0
  269. package/dist/components/InteractiveRegion/InteractiveRegion.svelte.d.ts +27 -0
  270. package/dist/components/InteractiveRegion/index.d.ts +2 -0
  271. package/dist/components/InteractiveRegion/index.js +3 -0
  272. package/dist/components/List/Lia.svelte +12 -0
  273. package/dist/components/List/Lia.svelte.d.ts +37 -0
  274. package/dist/components/List/NestedListItem.svelte +50 -0
  275. package/dist/components/List/NestedListItem.svelte.d.ts +27 -0
  276. package/dist/components/List/index.d.ts +3 -0
  277. package/dist/components/List/index.js +3 -0
  278. package/dist/components/Markdown/Markdown.svelte +25 -0
  279. package/dist/components/Markdown/Markdown.svelte.d.ts +28 -0
  280. package/dist/components/Markdown/MarkdownSnippet.svelte +27 -0
  281. package/dist/components/Markdown/MarkdownSnippet.svelte.d.ts +29 -0
  282. package/dist/components/Masonry/Masonry.svelte +79 -0
  283. package/dist/components/Masonry/Masonry.svelte.d.ts +29 -0
  284. package/dist/components/Masonry/index.d.ts +2 -0
  285. package/dist/components/Masonry/index.js +3 -0
  286. package/dist/components/PerspectiveHover/PerspectiveHover.svelte +10 -0
  287. package/dist/components/PerspectiveHover/PerspectiveHover.svelte.d.ts +27 -0
  288. package/dist/components/PerspectiveHover/perspective-hover.d.ts +3 -0
  289. package/dist/components/PerspectiveHover/perspective-hover.js +46 -0
  290. package/dist/components/Populate/ConditionalPopulate.svelte +33 -0
  291. package/dist/components/Populate/ConditionalPopulate.svelte.d.ts +27 -0
  292. package/dist/components/Populate/Populate.svelte +45 -0
  293. package/dist/components/Populate/Populate.svelte.d.ts +24 -0
  294. package/dist/components/Populate/actions.d.ts +2 -0
  295. package/dist/components/Populate/actions.js +29 -0
  296. package/dist/components/Populate/get-value.d.ts +5 -0
  297. package/dist/components/Populate/get-value.js +17 -0
  298. package/dist/components/Populate/index.d.ts +3 -0
  299. package/dist/components/Populate/index.js +4 -0
  300. package/dist/components/Portal.svelte +30 -0
  301. package/dist/components/Portal.svelte.d.ts +23 -0
  302. package/dist/components/PushToLocalStorage.svelte +30 -0
  303. package/dist/components/PushToLocalStorage.svelte.d.ts +23 -0
  304. package/dist/components/Resizer/Resizer.svelte +38 -0
  305. package/dist/components/Resizer/Resizer.svelte.d.ts +23 -0
  306. package/dist/components/Resizer/index.d.ts +2 -0
  307. package/dist/components/Resizer/index.js +3 -0
  308. package/dist/components/Resizer/resizer.d.ts +3 -0
  309. package/dist/components/Resizer/resizer.js +134 -0
  310. package/dist/components/Scrambler/Scrambler.svelte +20 -0
  311. package/dist/components/Scrambler/Scrambler.svelte.d.ts +23 -0
  312. package/dist/components/Scrambler/index.d.ts +2 -0
  313. package/dist/components/Scrambler/index.js +3 -0
  314. package/dist/components/Spotlight/PointerPosition.d.ts +3 -0
  315. package/dist/components/Spotlight/PointerPosition.js +32 -0
  316. package/dist/components/Spotlight/Spotlight.svelte +9 -0
  317. package/dist/components/Spotlight/Spotlight.svelte.d.ts +27 -0
  318. package/dist/components/Status.svelte +27 -0
  319. package/dist/components/Status.svelte.d.ts +23 -0
  320. package/dist/components/Switcheroo/Switcheroo.svelte +70 -0
  321. package/dist/components/Switcheroo/Switcheroo.svelte.d.ts +34 -0
  322. package/dist/components/Switcheroo/index.d.ts +2 -0
  323. package/dist/components/Switcheroo/index.js +3 -0
  324. package/dist/components/Table/RowGroup.svelte +8 -0
  325. package/dist/components/Table/RowGroup.svelte.d.ts +27 -0
  326. package/dist/components/Table/Table.svelte +23 -0
  327. package/dist/components/Table/Table.svelte.d.ts +33 -0
  328. package/dist/components/Table/Td.svelte +20 -0
  329. package/dist/components/Table/Td.svelte.d.ts +35 -0
  330. package/dist/components/Table/Th.svelte +27 -0
  331. package/dist/components/Table/Th.svelte.d.ts +35 -0
  332. package/dist/components/Table/Thead.svelte +8 -0
  333. package/dist/components/Table/Thead.svelte.d.ts +27 -0
  334. package/dist/components/Table/Tr.svelte +8 -0
  335. package/dist/components/Table/Tr.svelte.d.ts +29 -0
  336. package/dist/components/Table/index.d.ts +6 -0
  337. package/dist/components/Table/index.js +17 -0
  338. package/dist/components/Table/table.d.ts +2 -0
  339. package/dist/components/Table/table.js +35 -0
  340. package/dist/components/Tabs/Tab.svelte +9 -0
  341. package/dist/components/Tabs/Tab.svelte.d.ts +23 -0
  342. package/dist/components/Tabs/Tablist.svelte +79 -0
  343. package/dist/components/Tabs/Tablist.svelte.d.ts +39 -0
  344. package/dist/components/Tabs/Tabpanel.svelte +9 -0
  345. package/dist/components/Tabs/Tabpanel.svelte.d.ts +23 -0
  346. package/dist/components/Tabs/Tabpanels.svelte +11 -0
  347. package/dist/components/Tabs/Tabpanels.svelte.d.ts +23 -0
  348. package/dist/components/Tabs/Tabs.svelte +46 -0
  349. package/dist/components/Tabs/Tabs.svelte.d.ts +23 -0
  350. package/dist/components/Tabs/index.d.ts +6 -0
  351. package/dist/components/Tabs/index.js +7 -0
  352. package/dist/components/Tabs/tab-store.d.ts +21 -0
  353. package/dist/components/Tabs/tab-store.js +59 -0
  354. package/dist/components/Tabs/tabs.d.ts +32 -0
  355. package/dist/components/Tabs/tabs.js +364 -0
  356. package/dist/components/Textwall/Repeat.svelte +10 -0
  357. package/dist/components/Textwall/Repeat.svelte.d.ts +29 -0
  358. package/dist/components/Textwall/Textwall.svelte +29 -0
  359. package/dist/components/Textwall/Textwall.svelte.d.ts +37 -0
  360. package/dist/components/Textwall/index.d.ts +3 -0
  361. package/dist/components/Textwall/index.js +4 -0
  362. package/dist/components/Typewriter/Typewriter.svelte +70 -0
  363. package/dist/components/Typewriter/Typewriter.svelte.d.ts +27 -0
  364. package/dist/components/Typewriter/index.d.ts +2 -0
  365. package/dist/components/Typewriter/index.js +3 -0
  366. package/dist/components/Video.svelte +46 -0
  367. package/dist/components/Video.svelte.d.ts +33 -0
  368. package/dist/components/Vimeo.svelte +18 -0
  369. package/dist/components/Vimeo.svelte.d.ts +29 -0
  370. package/dist/components/Wrapper.svelte +22 -0
  371. package/dist/components/Wrapper.svelte.d.ts +33 -0
  372. package/dist/components/Youtube.svelte +15 -0
  373. package/dist/components/Youtube.svelte.d.ts +25 -0
  374. package/dist/components/_Shared/Snippet.svelte +10 -0
  375. package/dist/components/_Shared/Snippet.svelte.d.ts +27 -0
  376. package/dist/components/effects/index.d.ts +0 -0
  377. package/dist/components/effects/index.js +0 -0
  378. package/dist/index.d.ts +34 -0
  379. package/dist/index.js +41 -0
  380. package/package.json +3 -3
@@ -0,0 +1,27 @@
1
+ /** @typedef {typeof __propDef.props} TimepickerOptionsProps */
2
+ /** @typedef {typeof __propDef.events} TimepickerOptionsEvents */
3
+ /** @typedef {typeof __propDef.slots} TimepickerOptionsSlots */
4
+ export default class TimepickerOptions extends SvelteComponentTyped<{
5
+ id: any;
6
+ class?: string;
7
+ options?: {};
8
+ }, {
9
+ [evt: string]: CustomEvent<any>;
10
+ }, {}> {
11
+ }
12
+ export type TimepickerOptionsProps = typeof __propDef.props;
13
+ export type TimepickerOptionsEvents = typeof __propDef.events;
14
+ export type TimepickerOptionsSlots = typeof __propDef.slots;
15
+ import { SvelteComponentTyped } from "svelte";
16
+ declare const __propDef: {
17
+ props: {
18
+ id: any;
19
+ class?: string;
20
+ options?: {};
21
+ };
22
+ events: {
23
+ [evt: string]: CustomEvent<any>;
24
+ };
25
+ slots: {};
26
+ };
27
+ export {};
@@ -0,0 +1,13 @@
1
+ export function getMatches(strings: any, query: any, options?: {}): any[];
2
+ export function getPropertyMatches({ items, prop, query, options }: {
3
+ items: any;
4
+ prop: any;
5
+ query: any;
6
+ options?: {};
7
+ }): any[];
8
+ export function hasPerfectMatch(strings: any, query: any): any;
9
+ export function hasPerfectPropertyMatch({ items, prop, query }: {
10
+ items: any;
11
+ prop: any;
12
+ query: any;
13
+ }): any;
@@ -0,0 +1,114 @@
1
+ import { getNestedProperty2, mix } from '@splendidlabz/utils'
2
+
3
+ import aMatch from 'autosuggest-highlight/match'
4
+ import aParse from 'autosuggest-highlight/parse'
5
+
6
+ // Autosuggest highlight options can be found here:
7
+ // https://github.com/moroshko/autosuggest-highlight
8
+ const defaultSuggestOptions = {
9
+ insideWords: true,
10
+ requireMatchAll: true,
11
+ }
12
+
13
+ export function getMatches(strings, query, options = {}) {
14
+ // Two rounds of filtering for best results
15
+ const set = new Set([
16
+ ...strings.filter(str =>
17
+ isMatch(str, query, { ...options, insideWords: false }),
18
+ ),
19
+
20
+ // Filter through the matches
21
+ ...strings.filter(str =>
22
+ isMatch(str, query, { ...options, insideWords: true }),
23
+ ),
24
+ ])
25
+
26
+ const uniques = Array.from(set)
27
+
28
+ return uniques.map(str => {
29
+ const m = _getMatch(str, query, options)
30
+ return _getHighlight(str, m)
31
+ })
32
+ }
33
+
34
+ export function getPropertyMatches({ items, prop, query, options = {} }) {
35
+ // Map objects for easier filtering
36
+ const objs = items.map(obj => {
37
+ const _str = getNestedProperty2(obj, prop)
38
+ if (!_str) throw new Error(`Property "${prop}" not found in object`)
39
+ return {
40
+ ...obj,
41
+ _str: getNestedProperty2(obj, prop),
42
+ }
43
+ })
44
+
45
+ // Two rounds of filtering for best results
46
+ const set = new Set([
47
+ ...objs.filter(obj => {
48
+ return isMatch(obj._str, query, { ...options, insideWords: false })
49
+ }),
50
+ ...objs.filter(obj => {
51
+ return isMatch(obj._str, query, { ...options, insideWords: true })
52
+ }),
53
+ ])
54
+
55
+ const uniques = Array.from(set)
56
+
57
+ return uniques.map(obj => {
58
+ const { _str, ...rest } = obj
59
+ const m = _getMatch(_str, query, options, { insideWords: true })
60
+ return {
61
+ ...rest,
62
+ string: _getHighlight(_str, m),
63
+ }
64
+ })
65
+ }
66
+
67
+ export function hasPerfectMatch(strings, query) {
68
+ return strings.some(str => isPerfectMatch(str, query))
69
+ }
70
+
71
+ export function hasPerfectPropertyMatch({ items, prop, query }) {
72
+ return items.some(obj => {
73
+ const str = getNestedProperty2(obj, prop)
74
+ return isPerfectMatch(str, query)
75
+ })
76
+ }
77
+
78
+ // Returns list of matches
79
+ function _getMatch(string, query, options = {}) {
80
+ const opts = mix({}, defaultSuggestOptions, options)
81
+ return aMatch(string, query, opts)
82
+ }
83
+
84
+ function isMatch(string, query, options) {
85
+ return _getMatch(string, query, options).length > 0
86
+ }
87
+
88
+ // Either query or string my have diatrics
89
+ // So we need to pass them through _getMatch to ensure diatrics are handled in the matching.
90
+ function isPerfectMatch(string, query) {
91
+ const matches = _getMatch(string, query)
92
+ if (matches.length <= 0) return false // No match automatically means no perfect match
93
+
94
+ // Naïve checking for perfect match with a couple of assumptions
95
+ const firstIndex = matches[0][0]
96
+ const lastIndex = matches[matches.length - 1][1]
97
+ return (
98
+ firstIndex === 0 &&
99
+ lastIndex === string.length &&
100
+ string.length === query.length
101
+ )
102
+ }
103
+
104
+ // Parses and highlights the matched string
105
+ function _getHighlight(string, matches) {
106
+ const parts = aParse(string, matches)
107
+ return parts
108
+ .map(part => {
109
+ if (part.highlight)
110
+ return `<span class="ComboboxMatchedString">${part.text}</span>`
111
+ return part.text
112
+ })
113
+ .join('')
114
+ }
@@ -0,0 +1,38 @@
1
+ export function autocompleteInput(node: any, props?: {}): {
2
+ destroy(): void;
3
+ };
4
+ export function autocompleteOptions(node: any, props?: {}): {
5
+ destroy(): void;
6
+ };
7
+ export namespace DEFAULT_AUTOCOMPLETE_INPUT_OPTS {
8
+ namespace disclosure {
9
+ let showOnClick: boolean;
10
+ let focusTriggerOnClose: boolean;
11
+ let shiftTabBackToContent: boolean;
12
+ }
13
+ namespace input {
14
+ let loop: boolean;
15
+ let filterByProp: any;
16
+ let onMatch: any;
17
+ let onSearch: any;
18
+ let searchDebounce: number;
19
+ let cacheSearchResults: boolean;
20
+ let softResetDelay: number;
21
+ }
22
+ }
23
+ export const AUTOCOMPLETE_INPUT_OPT_KEYS: string[];
24
+ export namespace DEFAULT_AUTOCOMPLETE_CONTENT_OPTS {
25
+ export namespace disclosure_1 {
26
+ let useAutoWidth: boolean;
27
+ let focusTarget: any;
28
+ }
29
+ export { disclosure_1 as disclosure };
30
+ export namespace floating {
31
+ let placement: string;
32
+ let offset: number;
33
+ }
34
+ export namespace options {
35
+ let onSelect: any;
36
+ }
37
+ }
38
+ export const AUTOCOMPLETE_CONTENT_KEYS: string[];
@@ -0,0 +1,393 @@
1
+ import { debounce, omitEmpty } from '@splendidlabz/utils'
2
+ import {
3
+ addListeners,
4
+ getSiblingElements,
5
+ isArrowKey,
6
+ isShiftTab,
7
+ isTab,
8
+ randomString,
9
+ removeListeners,
10
+ } from '@splendidlabz/utils/dom'
11
+ import {
12
+ close as closeDisclosure,
13
+ open as openDisclosure,
14
+ } from '../../Disclosure/disclosure.js'
15
+ import {
16
+ getMatches,
17
+ getPropertyMatches,
18
+ hasPerfectMatch,
19
+ hasPerfectPropertyMatch,
20
+ } from './autocomplete-matching.js'
21
+ import { initCombobox, updateCombobox } from './combobox-store.js'
22
+
23
+ import { getDisclosure } from '../../Disclosure/disclosure-store.js'
24
+
25
+ // Shifted focusTriggerOnClose to disclosureContent
26
+ export const DEFAULT_AUTOCOMPLETE_INPUT_OPTS = {
27
+ disclosure: {
28
+ showOnClick: false,
29
+ focusTriggerOnClose: false,
30
+ shiftTabBackToContent: false,
31
+ },
32
+ input: {
33
+ loop: true,
34
+ filterByProp: null, // 'dot.notation.string'
35
+ onMatch: null,
36
+ onSearch: null,
37
+ searchDebounce: 250,
38
+ cacheSearchResults: true,
39
+ softResetDelay: 1000,
40
+ },
41
+ }
42
+
43
+ export const AUTOCOMPLETE_INPUT_OPT_KEYS = [
44
+ ...Object.keys(DEFAULT_AUTOCOMPLETE_INPUT_OPTS.input),
45
+ 'showOnClick',
46
+ ]
47
+
48
+ export const DEFAULT_AUTOCOMPLETE_CONTENT_OPTS = {
49
+ disclosure: {
50
+ useAutoWidth: true,
51
+ focusTarget: null,
52
+ },
53
+ floating: {
54
+ placement: 'bottom-start',
55
+ offset: 0,
56
+ },
57
+ options: {
58
+ onSelect: null,
59
+ },
60
+ }
61
+
62
+ export const AUTOCOMPLETE_CONTENT_KEYS = Object.keys(
63
+ DEFAULT_AUTOCOMPLETE_CONTENT_OPTS.options,
64
+ )
65
+
66
+ export function autocompleteInput(node, props = {}) {
67
+ const listboxId = node.getAttribute('aria-owns')
68
+ const disclosureId = listboxId.split('-')[0]
69
+
70
+ const comboboxInfo = {
71
+ id: listboxId,
72
+ state: {
73
+ matches: [],
74
+ haystack: [],
75
+ searchState: 'idle',
76
+ searchCache: new Map(),
77
+ ...omitEmpty(props.state),
78
+ },
79
+ options: props.options,
80
+ nodes: { input: node },
81
+ stores: { disclosure: getDisclosure(disclosureId) },
82
+ }
83
+
84
+ const Box = initCombobox(comboboxInfo)
85
+
86
+ // This will be where we set most aria attributes.
87
+ // But right now there's only one ComboboxInput, so we added them directly in ComboboxInput.svelte.
88
+ // If we need to use this action for other components in the future, we can shift those aria attributes here.
89
+
90
+ const listeners = [
91
+ {
92
+ event: 'click',
93
+ node,
94
+ handler: handleClick,
95
+ },
96
+ {
97
+ event: 'input',
98
+ node,
99
+ handler: handleInput,
100
+ },
101
+ {
102
+ event: 'input',
103
+ node,
104
+ handler: debounce(handleSearch, 1000),
105
+ },
106
+ {
107
+ event: 'keydown',
108
+ node,
109
+ handler: handleKeydown,
110
+ },
111
+ ]
112
+
113
+ addListeners(listeners)
114
+
115
+ function handleClick(event) {
116
+ const { showOnClick } = Box.options
117
+ if (showOnClick) resolveDisclosureState(Box)
118
+ }
119
+
120
+ function handleInput(event) {
121
+ const text = event.target.value.trim()
122
+ const { searchCache } = Box.state
123
+ const { onSearch } = Box.options
124
+
125
+ if (text === '') {
126
+ Box.state.searchState = 'idle'
127
+ return updateMatches(Box, [])
128
+ }
129
+
130
+ // Basic, standard, haystack matching.
131
+ if (!onSearch) checkForMatches(Box, text)
132
+ else {
133
+ // Draw from cache if user already searched the terms before.
134
+ if (searchCache.has(text)) {
135
+ // This replaces haystack right now.
136
+ // Questioning whether we even need to add to haystack.
137
+ // If need, then build in the future. Just need to crete a new variable to store all the search results.
138
+ const results = searchCache.get(text)
139
+ updateMatches(Box, results)
140
+ } else {
141
+ // Show loading indicator here later because the search function is debounced
142
+ Box.state.searchState = 'searching'
143
+ updateCombobox(Box)
144
+ resolveDisclosureState(Box)
145
+ }
146
+ }
147
+ }
148
+
149
+ async function handleSearch(event) {
150
+ const text = event.target.value.trim()
151
+ const { searchCache } = Box.state
152
+ const { onSearch, softResetDelay } = Box.options
153
+ if (!onSearch) return
154
+
155
+ // Handled in handleInput
156
+ if (searchCache.has(text)) return
157
+
158
+ // Runs onSearch and caches the results
159
+ const results = await onSearch(text)
160
+ const cache = searchCache
161
+ cache.set(text, results)
162
+ Box.state.searchState = 'complete'
163
+ Box.state.searchCache = cache
164
+ updateMatches(Box, results)
165
+ setTimeout(_ => softReset(Box), softResetDelay)
166
+ }
167
+
168
+ function handleKeydown(event) {
169
+ const { key } = event
170
+
171
+ if (isArrowKey(key)) {
172
+ if (key === 'ArrowUp') highlightPrevOption(Box)
173
+ if (key === 'ArrowDown') highlightNextOption(Box)
174
+ }
175
+
176
+ if (key === 'Enter') {
177
+ event.preventDefault()
178
+ selectCurrentOption(Box)
179
+ }
180
+
181
+ if (isTab(event)) selectCurrentOption(Box)
182
+ if (isShiftTab(event)) closeDisclosure(Box.stores.disclosure)
183
+ }
184
+
185
+ return {
186
+ destroy() {
187
+ removeListeners(listeners)
188
+ },
189
+ }
190
+ }
191
+
192
+ // Most of the listbox stuff here can use:listbox.
193
+ // I wanna refactor this to use the listbox action. Just wonder how to combine the custom match and select thingy through another action.
194
+ // And on select, have to update match, probably through a custom select handler.
195
+ export function autocompleteOptions(node, props = {}) {
196
+ const id = node.getAttribute('id')
197
+ const disclosureId = id.split('-')[0]
198
+
199
+ const comboboxInfo = {
200
+ id,
201
+ state: omitEmpty(props.state),
202
+ options: props.options,
203
+ nodes: { options: node },
204
+ stores: { disclosure: getDisclosure(disclosureId) },
205
+ }
206
+
207
+ const Box = initCombobox(comboboxInfo)
208
+
209
+ // Initialize each option with appropriate attributes
210
+ // Custom options require Svelte so there's no need to check for Astro slot nonsense
211
+ const options = getOptions(Box)
212
+ for (const option of options) {
213
+ if (!option.id) option.id = randomString(8)
214
+ option.setAttribute('role', 'option')
215
+ // Need to set aria selected to false here?
216
+ }
217
+
218
+ const listeners = [
219
+ {
220
+ event: 'click',
221
+ node,
222
+ handler: handleClick,
223
+ },
224
+ {
225
+ event: 'pointerover',
226
+ node,
227
+ handler: handlePointerOver,
228
+ },
229
+ ]
230
+
231
+ addListeners(listeners)
232
+
233
+ function handleClick(event) {
234
+ const { target } = event
235
+ if (target.getAttribute('role') !== 'option') return
236
+ selectOption(Box, target)
237
+ }
238
+
239
+ function handlePointerOver(event) {
240
+ const { target } = event
241
+ if (target.getAttribute('role') === 'option') highlightOption(Box, target)
242
+ }
243
+
244
+ return {
245
+ destroy() {
246
+ removeListeners(listeners)
247
+ },
248
+ }
249
+ }
250
+
251
+ // Matching methods
252
+ // ------------------------
253
+ function checkForMatches(Box, text) {
254
+ let matches = []
255
+ text = text.trim()
256
+
257
+ const { filterByProp } = Box.options
258
+ const matchType = filterByProp ? 'object' : 'string'
259
+
260
+ const { haystack } = Box.state
261
+ if (!haystack.length) return
262
+
263
+ // Handle string matching
264
+ if (matchType === 'string') {
265
+ const perfectMatch = hasPerfectMatch(Box.state.haystack, text)
266
+ if (!perfectMatch) matches = getMatches(Box.state.haystack, text)
267
+ }
268
+
269
+ // Handle object prop matching
270
+ if (matchType === 'object') {
271
+ const perfectMatch = hasPerfectPropertyMatch({
272
+ items: Box.state.haystack,
273
+ prop: Box.options.filterByProp,
274
+ query: text,
275
+ })
276
+
277
+ if (!perfectMatch)
278
+ matches = getPropertyMatches({
279
+ items: Box.state.haystack,
280
+ prop: Box.options.filterByProp,
281
+ query: text,
282
+ })
283
+ }
284
+ updateMatches(Box, matches)
285
+ }
286
+
287
+ function updateMatches(Box, matches) {
288
+ Box.state.matches = matches
289
+ updateCombobox(Box)
290
+
291
+ // Custom matches handler
292
+ if (Box.options.onMatch) Box.options.onMatch(matches)
293
+ resolveDisclosureState(Box)
294
+ }
295
+
296
+ // Show or hide disclosure when appropriate
297
+ function resolveDisclosureState(Box) {
298
+ const { matches, searchState } = Box.state
299
+ const { disclosure } = Box.stores
300
+
301
+ if (matches.length) return openDisclosure(disclosure)
302
+ if (searchState === 'searching' || searchState === 'complete')
303
+ return openDisclosure(disclosure)
304
+
305
+ closeDisclosure(disclosure)
306
+ }
307
+
308
+ // Resets to initial state while keeping any caches and haystack changes
309
+ function softReset(Box) {
310
+ if (Box.state.searchState !== 'complete') return
311
+ Box.state.searchState = 'idle'
312
+ updateCombobox(Box)
313
+ resolveDisclosureState(Box)
314
+ }
315
+
316
+ // Highlighting methods
317
+ // ------------------------
318
+ function getOptions(Box) {
319
+ return Array.from(Box.nodes.options.children)
320
+ }
321
+
322
+ function highlightOption(Box, option) {
323
+ const optionId = option.getAttribute('id')
324
+ const siblings = getSiblingElements(option)
325
+
326
+ option.setAttribute('aria-selected', true)
327
+ for (const sibling of siblings) {
328
+ sibling.setAttribute('aria-selected', false)
329
+ }
330
+
331
+ Box.state.highlightedOptionId = optionId
332
+ updateCombobox(Box)
333
+ }
334
+
335
+ function getHighlightedOptionIndex(Box) {
336
+ const options = getOptions(Box)
337
+ return options.findIndex(
338
+ option => option.id === Box.state.highlightedOptionId,
339
+ )
340
+ }
341
+
342
+ function highlightFirstOption(Box) {
343
+ const options = getOptions(Box)
344
+ const firstOption = options[0]
345
+ highlightOption(Box, firstOption)
346
+ }
347
+
348
+ function highlightLastOption(Box) {
349
+ const options = getOptions(Box)
350
+ const lastOption = options[options.length - 1]
351
+ highlightOption(Box, lastOption)
352
+ }
353
+
354
+ function highlightNextOption(Box) {
355
+ const options = getOptions(Box)
356
+ const index = getHighlightedOptionIndex(Box)
357
+
358
+ const nextOption = options[index + 1]
359
+ if (nextOption) highlightOption(Box, nextOption)
360
+ else if (Box.options.loop) highlightFirstOption(Box)
361
+ }
362
+
363
+ function highlightPrevOption(Box) {
364
+ const options = getOptions(Box)
365
+ const index = getHighlightedOptionIndex(Box)
366
+
367
+ const prevOption = options[index - 1]
368
+ if (prevOption) highlightOption(Box, prevOption)
369
+ else if (Box.options.loop) highlightLastOption(Box)
370
+ }
371
+
372
+ // Selecting methods
373
+ // ------------------------
374
+ function selectOption(Box, option) {
375
+ const text = option.textContent.trim()
376
+ const { onSelect } = Box.options
377
+
378
+ // Custom select handler
379
+ if (onSelect) onSelect(option)
380
+ else {
381
+ // Fill input with option text if standard select handler
382
+ Box.nodes.input.value = text
383
+ }
384
+
385
+ updateMatches(Box, [])
386
+ }
387
+
388
+ function selectCurrentOption(Box) {
389
+ const options = getOptions(Box)
390
+ const index = getHighlightedOptionIndex(Box)
391
+ const option = options[index]
392
+ selectOption(Box, option)
393
+ }
@@ -0,0 +1,24 @@
1
+ export function getComboboxes(): any[];
2
+ export function getCombobox(id: any): any;
3
+ export function addCombobox({ id, state, nodes, options, stores, }: {
4
+ id: any;
5
+ state?: {};
6
+ nodes?: {};
7
+ options?: {};
8
+ stores?: any[];
9
+ }): void;
10
+ export function updateCombobox({ id, state, options, nodes, stores, }: {
11
+ id: any;
12
+ state?: {};
13
+ options?: {};
14
+ nodes?: {};
15
+ stores?: any[];
16
+ }): void;
17
+ export function initCombobox({ id, options, state, nodes, stores, }: {
18
+ id: any;
19
+ options?: {};
20
+ state?: {};
21
+ nodes?: {};
22
+ stores?: {};
23
+ }): any;
24
+ export const comboboxes: import("svelte/store").Writable<any[]>;
@@ -0,0 +1,65 @@
1
+ import { get, writable } from 'svelte/store'
2
+
3
+ import { omitEmpty } from '@splendidlabz/utils'
4
+
5
+ export const comboboxes = writable([])
6
+ const { update } = comboboxes
7
+
8
+ export function getComboboxes() {
9
+ return get(comboboxes)
10
+ }
11
+
12
+ export function getCombobox(id) {
13
+ return get(comboboxes).find(combobox => combobox.id === id)
14
+ }
15
+
16
+ export function addCombobox({
17
+ id,
18
+ state = {},
19
+ nodes = {},
20
+ options = {},
21
+ stores = [],
22
+ }) {
23
+ update(boxes => {
24
+ const box = { id, state, options, nodes, stores }
25
+ return [...boxes, box]
26
+ })
27
+ }
28
+
29
+ export function updateCombobox({
30
+ id,
31
+ state = {},
32
+ options = {},
33
+ nodes = {},
34
+ stores = [],
35
+ }) {
36
+ update(boxes => {
37
+ const index = boxes.findIndex(d => d.id === id)
38
+ const box = boxes[index]
39
+
40
+ box.state = { ...box.state, ...omitEmpty(state) }
41
+ box.options = { ...box.options, ...omitEmpty(options) }
42
+ box.nodes = { ...box.nodes, ...omitEmpty(nodes, { shallow: true }) }
43
+ box.stores = { ...box.stores, ...omitEmpty(stores, { shallow: true }) }
44
+
45
+ return boxes.with(index, box)
46
+ })
47
+ }
48
+
49
+ export function initCombobox({
50
+ id,
51
+ options = {},
52
+ state = {},
53
+ nodes = {},
54
+ stores = {},
55
+ }) {
56
+ const d = getCombobox(id)
57
+
58
+ if (!d) {
59
+ addCombobox({ id, options, state, nodes, stores })
60
+ } else {
61
+ updateCombobox({ id, options, state, nodes, stores })
62
+ }
63
+
64
+ return getCombobox(id)
65
+ }