@roadtrip/components 2.24.1 → 2.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (481) hide show
  1. package/dist/cjs/{app-04553107.js → app-79994847.js} +1 -1
  2. package/dist/cjs/{css-shim-cf2d8057.js → css-shim-9a05bb86.js} +1 -1
  3. package/dist/cjs/{dom-ba87b185.js → dom-417ccd20.js} +1 -1
  4. package/dist/cjs/{index-d47fa3c0.js → index-9b63596c.js} +1 -1
  5. package/dist/cjs/index.cjs.js +2 -2
  6. package/dist/cjs/loader.cjs.js +5 -5
  7. package/dist/cjs/road-accordion.cjs.entry.js +3 -3
  8. package/dist/cjs/road-alert.cjs.entry.js +1 -1
  9. package/dist/cjs/road-autocomplete.cjs.entry.js +7 -2
  10. package/dist/cjs/road-avatar.cjs.entry.js +2 -2
  11. package/dist/cjs/road-badge_11.cjs.entry.js +19 -7
  12. package/dist/cjs/road-card.cjs.entry.js +9 -4
  13. package/dist/cjs/road-carousel-item.cjs.entry.js +1 -1
  14. package/dist/cjs/road-carousel.cjs.entry.js +33 -33
  15. package/dist/cjs/road-checkbox.cjs.entry.js +11 -2
  16. package/dist/cjs/road-chip.cjs.entry.js +4 -4
  17. package/dist/cjs/road-collapse.cjs.entry.js +4 -4
  18. package/dist/cjs/road-counter.cjs.entry.js +8 -4
  19. package/dist/cjs/road-dialog.cjs.entry.js +1 -1
  20. package/dist/cjs/road-dropdown.cjs.entry.js +2 -2
  21. package/dist/cjs/road-duration.cjs.entry.js +60 -0
  22. package/dist/cjs/road-flap.cjs.entry.js +1 -1
  23. package/dist/cjs/road-img.cjs.entry.js +7 -1
  24. package/dist/cjs/road-input-group.cjs.entry.js +1 -1
  25. package/dist/cjs/road-input.cjs.entry.js +12 -3
  26. package/dist/cjs/road-modal.cjs.entry.js +1 -1
  27. package/dist/cjs/road-navbar-item.cjs.entry.js +7 -1
  28. package/dist/cjs/road-navbar.cjs.entry.js +5 -1
  29. package/dist/cjs/road-plate-number.cjs.entry.js +11 -3
  30. package/dist/cjs/road-progress.cjs.entry.js +1 -1
  31. package/dist/cjs/road-radio-group.cjs.entry.js +3 -1
  32. package/dist/cjs/road-radio.cjs.entry.js +5 -1
  33. package/dist/cjs/road-range.cjs.entry.js +4 -2
  34. package/dist/cjs/road-rating.cjs.entry.js +1 -1
  35. package/dist/cjs/road-select-filter.cjs.entry.js +1798 -3
  36. package/dist/cjs/road-select.cjs.entry.js +9 -1
  37. package/dist/cjs/road-skeleton.cjs.entry.js +2 -2
  38. package/dist/cjs/road-spinner.cjs.entry.js +2 -2
  39. package/dist/cjs/road-switch.cjs.entry.js +13 -4
  40. package/dist/cjs/road-tab-bar.cjs.entry.js +5 -1
  41. package/dist/cjs/road-tab-button.cjs.entry.js +7 -1
  42. package/dist/cjs/road-tab.cjs.entry.js +1 -1
  43. package/dist/cjs/road-table.cjs.entry.js +2 -2
  44. package/dist/cjs/road-tabs.cjs.entry.js +3 -1
  45. package/dist/cjs/road-text.cjs.entry.js +1 -1
  46. package/dist/cjs/road-textarea.cjs.entry.js +14 -6
  47. package/dist/cjs/road-toast.cjs.entry.js +3 -3
  48. package/dist/cjs/road-toolbar-title.cjs.entry.js +2 -2
  49. package/dist/cjs/road-tooltip.cjs.entry.js +3 -3
  50. package/dist/cjs/roadtrip.cjs.js +5 -5
  51. package/dist/cjs/{shadow-css-7fb0b43f.js → shadow-css-432b27e3.js} +1 -1
  52. package/dist/cjs/{utils-ade59127.js → utils-90171b88.js} +1 -1
  53. package/dist/collection/collection-manifest.json +2 -1
  54. package/dist/collection/components/accordion/accordion.css +6 -6
  55. package/dist/collection/components/accordion/accordion.js +2 -2
  56. package/dist/collection/components/accordion/accordion.stories.js +81 -37
  57. package/dist/collection/components/alert/alert.stories.js +51 -45
  58. package/dist/collection/components/autocomplete/autocomplete.js +31 -3
  59. package/dist/collection/components/autocomplete/autocomplete.stories.js +51 -21
  60. package/dist/collection/components/avatar/avatar.js +2 -3
  61. package/dist/collection/components/avatar/avatar.stories.js +39 -14
  62. package/dist/collection/components/badge/badge.stories.js +33 -35
  63. package/dist/collection/components/button/button.css +4 -4
  64. package/dist/collection/components/button/button.js +57 -9
  65. package/dist/collection/components/button/button.stories.js +162 -71
  66. package/dist/collection/components/card/card.js +28 -6
  67. package/dist/collection/components/card/card.stories.js +3 -3
  68. package/dist/collection/components/carousel/carousel.css +2 -2
  69. package/dist/collection/components/carousel/carousel.js +48 -48
  70. package/dist/collection/components/carousel/carousel.stories.js +332 -88
  71. package/dist/collection/components/checkbox/checkbox.js +67 -7
  72. package/dist/collection/components/checkbox/checkbox.stories.js +89 -64
  73. package/dist/collection/components/chip/chip.js +6 -6
  74. package/dist/collection/components/chip/chip.stories.js +58 -82
  75. package/dist/collection/components/col/col.js +2 -3
  76. package/dist/collection/components/collapse/collapse.js +7 -7
  77. package/dist/collection/components/collapse/collapse.stories.js +141 -126
  78. package/dist/collection/components/counter/counter.js +50 -13
  79. package/dist/collection/components/counter/counter.stories.js +65 -31
  80. package/dist/collection/components/dialog/dialog.stories.js +81 -37
  81. package/dist/collection/components/drawer/drawer.stories.js +187 -79
  82. package/dist/collection/components/dropdown/dropdown.js +2 -2
  83. package/dist/collection/components/dropdown/dropdown.stories.js +41 -20
  84. package/dist/collection/components/duration/duration.css +31 -0
  85. package/dist/collection/components/duration/duration.js +212 -0
  86. package/dist/collection/components/duration/duration.stories.js +108 -0
  87. package/dist/collection/components/flap/flap.stories.js +35 -31
  88. package/dist/collection/components/grid/grid.js +2 -3
  89. package/dist/collection/components/grid/grid.stories.js +5 -5
  90. package/dist/collection/components/icon/icon.stories.js +88 -62
  91. package/dist/collection/components/icon/svg/attachment.svg +1 -0
  92. package/dist/collection/components/icon/svg/check-list-color.svg +1 -0
  93. package/dist/collection/components/icon/svg/check-list.svg +1 -0
  94. package/dist/collection/components/icon/svg/device-smartphone-music-color.svg +1 -0
  95. package/dist/collection/components/icon/svg/device-smartphone-music.svg +1 -0
  96. package/dist/collection/components/icon/svg/mic-off-outline-color.svg +1 -0
  97. package/dist/collection/components/icon/svg/mic-off-outline.svg +1 -0
  98. package/dist/collection/components/icon/svg/mic-off.svg +1 -0
  99. package/dist/collection/components/icon/svg/people-community-outline-color.svg +1 -0
  100. package/dist/collection/components/icon/svg/people-community-outline.svg +1 -0
  101. package/dist/collection/components/icon/svg/people-community.svg +1 -0
  102. package/dist/collection/components/icon/svg/people-coworker-color.svg +1 -1
  103. package/dist/collection/components/icon/svg/people-coworker.svg +1 -1
  104. package/dist/collection/components/icon/svg/player-radio-music-outline-color.svg +1 -0
  105. package/dist/collection/components/icon/svg/player-radio-music-outline.svg +1 -0
  106. package/dist/collection/components/icon/svg/station-electric-outline-color.svg +1 -0
  107. package/dist/collection/components/icon/svg/station-electric-outline.svg +1 -0
  108. package/dist/collection/components/icon/svg/vehicle-car-all-authorize-outline-color.svg +1 -0
  109. package/dist/collection/components/icon/svg/vehicle-car-all-authorize-outline.svg +1 -0
  110. package/dist/collection/components/icon/svg/vehicle-car-all-unauthorize-outline-color.svg +1 -0
  111. package/dist/collection/components/icon/svg/vehicle-car-all-unauthorize-outline.svg +1 -0
  112. package/dist/collection/components/icon/svg/{vehicle-car-bodyworkoutline-color.svg → vehicle-car-bodywork-outline-color.svg} +0 -0
  113. package/dist/collection/components/img/img.js +61 -4
  114. package/dist/collection/components/img/img.stories.js +1 -1
  115. package/dist/collection/components/input/input.css +4 -4
  116. package/dist/collection/components/input/input.js +89 -8
  117. package/dist/collection/components/input/input.stories.js +195 -129
  118. package/dist/collection/components/input-group/input-group.stories.js +44 -35
  119. package/dist/collection/components/item/item.css +2 -2
  120. package/dist/collection/components/item/item.stories.js +118 -24
  121. package/dist/collection/components/label/label.js +2 -3
  122. package/dist/collection/components/list/list.stories.js +48 -46
  123. package/dist/collection/components/modal/modal.stories.js +46 -30
  124. package/dist/collection/components/navbar/navbar.js +27 -0
  125. package/dist/collection/components/navbar/navbar.stories.js +41 -24
  126. package/dist/collection/components/navbar-item/navbar-item.js +30 -1
  127. package/dist/collection/components/plate-number/plate-number.js +99 -20
  128. package/dist/collection/components/plate-number/plate-number.stories.js +36 -17
  129. package/dist/collection/components/progress/progress.stories.js +3 -3
  130. package/dist/collection/components/radio/radio.js +47 -3
  131. package/dist/collection/components/radio/radio.stories.js +50 -33
  132. package/dist/collection/components/radio-group/radio-group.js +21 -2
  133. package/dist/collection/components/range/range.js +26 -8
  134. package/dist/collection/components/range/range.stories.js +40 -33
  135. package/dist/collection/components/rating/rating.stories.js +40 -31
  136. package/dist/collection/components/select/select.js +64 -5
  137. package/dist/collection/components/select/select.stories.js +82 -90
  138. package/dist/collection/components/select-filter/select-filter.js +69 -4
  139. package/dist/collection/components/select-filter/select-filter.stories.js +82 -106
  140. package/dist/collection/components/skeleton/skeleton.js +2 -3
  141. package/dist/collection/components/spinner/spinner.js +3 -4
  142. package/dist/collection/components/switch/switch.js +71 -11
  143. package/dist/collection/components/switch/switch.stories.js +96 -84
  144. package/dist/collection/components/tab-bar/tab-bar.js +21 -0
  145. package/dist/collection/components/tab-button/tab-button.js +30 -1
  146. package/dist/collection/components/table/table.js +2 -3
  147. package/dist/collection/components/table/table.stories.js +15 -6
  148. package/dist/collection/components/tabs/tabs.js +39 -3
  149. package/dist/collection/components/tabs/tabs.stories.js +107 -58
  150. package/dist/collection/components/text/text.stories.js +8 -4
  151. package/dist/collection/components/textarea/textarea.js +97 -17
  152. package/dist/collection/components/textarea/textarea.stories.js +135 -113
  153. package/dist/collection/components/toast/toast.js +4 -4
  154. package/dist/collection/components/toast/toast.stories.js +60 -46
  155. package/dist/collection/components/toolbar/toolbar.stories.js +50 -13
  156. package/dist/collection/components/toolbar-title/toolbar-title.js +3 -4
  157. package/dist/collection/components/tooltip/tooltip.js +4 -4
  158. package/dist/collection/components/tooltip/tooltip.stories.js +78 -11
  159. package/dist/esm/{app-6a43d362.js → app-a32f9d74.js} +1 -1
  160. package/dist/esm/{css-shim-aea0f6cc.js → css-shim-17041dc7.js} +1 -1
  161. package/dist/esm/{dom-c7604576.js → dom-ba83fb9d.js} +1 -1
  162. package/dist/esm/{index-4e5ea092.js → index-0c8a0e04.js} +1 -1
  163. package/dist/esm/index.js +2 -2
  164. package/dist/esm/loader.js +5 -5
  165. package/dist/esm/road-accordion.entry.js +3 -3
  166. package/dist/esm/road-alert.entry.js +1 -1
  167. package/dist/esm/road-autocomplete.entry.js +7 -2
  168. package/dist/esm/road-avatar.entry.js +2 -2
  169. package/dist/esm/road-badge_11.entry.js +19 -7
  170. package/dist/esm/road-card.entry.js +9 -4
  171. package/dist/esm/road-carousel-item.entry.js +1 -1
  172. package/dist/esm/road-carousel.entry.js +33 -33
  173. package/dist/esm/road-checkbox.entry.js +11 -2
  174. package/dist/esm/road-chip.entry.js +4 -4
  175. package/dist/esm/road-collapse.entry.js +4 -4
  176. package/dist/esm/road-counter.entry.js +8 -4
  177. package/dist/esm/road-dialog.entry.js +1 -1
  178. package/dist/esm/road-dropdown.entry.js +2 -2
  179. package/dist/esm/road-duration.entry.js +56 -0
  180. package/dist/esm/road-flap.entry.js +1 -1
  181. package/dist/esm/road-img.entry.js +7 -1
  182. package/dist/esm/road-input-group.entry.js +1 -1
  183. package/dist/esm/road-input.entry.js +12 -3
  184. package/dist/esm/road-modal.entry.js +1 -1
  185. package/dist/esm/road-navbar-item.entry.js +7 -1
  186. package/dist/esm/road-navbar.entry.js +5 -1
  187. package/dist/esm/road-plate-number.entry.js +11 -3
  188. package/dist/esm/road-progress.entry.js +1 -1
  189. package/dist/esm/road-radio-group.entry.js +3 -1
  190. package/dist/esm/road-radio.entry.js +5 -1
  191. package/dist/esm/road-range.entry.js +4 -2
  192. package/dist/esm/road-rating.entry.js +1 -1
  193. package/dist/esm/road-select-filter.entry.js +1798 -3
  194. package/dist/esm/road-select.entry.js +9 -1
  195. package/dist/esm/road-skeleton.entry.js +2 -2
  196. package/dist/esm/road-spinner.entry.js +2 -2
  197. package/dist/esm/road-switch.entry.js +13 -4
  198. package/dist/esm/road-tab-bar.entry.js +5 -1
  199. package/dist/esm/road-tab-button.entry.js +7 -1
  200. package/dist/esm/road-tab.entry.js +1 -1
  201. package/dist/esm/road-table.entry.js +2 -2
  202. package/dist/esm/road-tabs.entry.js +3 -1
  203. package/dist/esm/road-text.entry.js +1 -1
  204. package/dist/esm/road-textarea.entry.js +14 -6
  205. package/dist/esm/road-toast.entry.js +3 -3
  206. package/dist/esm/road-toolbar-title.entry.js +2 -2
  207. package/dist/esm/road-tooltip.entry.js +3 -3
  208. package/dist/esm/roadtrip.js +5 -5
  209. package/dist/esm/{shadow-css-83bb1d14.js → shadow-css-bfd5796e.js} +1 -1
  210. package/dist/esm/{utils-23aa19c1.js → utils-39de47f7.js} +1 -1
  211. package/dist/esm-es5/app-a32f9d74.js +1 -0
  212. package/dist/esm-es5/{css-shim-aea0f6cc.js → css-shim-17041dc7.js} +0 -0
  213. package/dist/esm-es5/{dom-c7604576.js → dom-ba83fb9d.js} +0 -0
  214. package/dist/esm-es5/{index-4e5ea092.js → index-0c8a0e04.js} +1 -1
  215. package/dist/esm-es5/index.js +1 -1
  216. package/dist/esm-es5/loader.js +1 -1
  217. package/dist/esm-es5/road-accordion.entry.js +1 -1
  218. package/dist/esm-es5/road-alert.entry.js +1 -1
  219. package/dist/esm-es5/road-autocomplete.entry.js +1 -1
  220. package/dist/esm-es5/road-avatar.entry.js +1 -1
  221. package/dist/esm-es5/road-badge_11.entry.js +1 -1
  222. package/dist/esm-es5/road-card.entry.js +1 -1
  223. package/dist/esm-es5/road-carousel-item.entry.js +1 -1
  224. package/dist/esm-es5/road-carousel.entry.js +1 -1
  225. package/dist/esm-es5/road-checkbox.entry.js +1 -1
  226. package/dist/esm-es5/road-chip.entry.js +1 -1
  227. package/dist/esm-es5/road-collapse.entry.js +1 -1
  228. package/dist/esm-es5/road-counter.entry.js +1 -1
  229. package/dist/esm-es5/road-dialog.entry.js +1 -1
  230. package/dist/esm-es5/road-dropdown.entry.js +1 -1
  231. package/dist/esm-es5/road-duration.entry.js +1 -0
  232. package/dist/esm-es5/road-flap.entry.js +1 -1
  233. package/dist/esm-es5/road-img.entry.js +1 -1
  234. package/dist/esm-es5/road-input-group.entry.js +1 -1
  235. package/dist/esm-es5/road-input.entry.js +1 -1
  236. package/dist/esm-es5/road-modal.entry.js +1 -1
  237. package/dist/esm-es5/road-navbar-item.entry.js +1 -1
  238. package/dist/esm-es5/road-navbar.entry.js +1 -1
  239. package/dist/esm-es5/road-plate-number.entry.js +1 -1
  240. package/dist/esm-es5/road-progress.entry.js +1 -1
  241. package/dist/esm-es5/road-radio-group.entry.js +1 -1
  242. package/dist/esm-es5/road-radio.entry.js +1 -1
  243. package/dist/esm-es5/road-range.entry.js +1 -1
  244. package/dist/esm-es5/road-rating.entry.js +1 -1
  245. package/dist/esm-es5/road-select-filter.entry.js +1 -1
  246. package/dist/esm-es5/road-select.entry.js +1 -1
  247. package/dist/esm-es5/road-skeleton.entry.js +1 -1
  248. package/dist/esm-es5/road-spinner.entry.js +1 -1
  249. package/dist/esm-es5/road-switch.entry.js +1 -1
  250. package/dist/esm-es5/road-tab-bar.entry.js +1 -1
  251. package/dist/esm-es5/road-tab-button.entry.js +1 -1
  252. package/dist/esm-es5/road-tab.entry.js +1 -1
  253. package/dist/esm-es5/road-table.entry.js +1 -1
  254. package/dist/esm-es5/road-tabs.entry.js +1 -1
  255. package/dist/esm-es5/road-text.entry.js +1 -1
  256. package/dist/esm-es5/road-textarea.entry.js +1 -1
  257. package/dist/esm-es5/road-toast.entry.js +1 -1
  258. package/dist/esm-es5/road-toolbar-title.entry.js +1 -1
  259. package/dist/esm-es5/road-tooltip.entry.js +1 -1
  260. package/dist/esm-es5/roadtrip.js +1 -1
  261. package/dist/esm-es5/{shadow-css-83bb1d14.js → shadow-css-bfd5796e.js} +0 -0
  262. package/dist/esm-es5/{utils-23aa19c1.js → utils-39de47f7.js} +1 -1
  263. package/dist/html.html-data.json +63 -21
  264. package/dist/icons/icons.svg +1 -1
  265. package/dist/icons/index.d.ts +20 -1
  266. package/dist/icons/index.js +22 -3
  267. package/dist/roadtrip/index.esm.js +1 -1
  268. package/dist/roadtrip/p-01cebe6a.entry.js +1 -0
  269. package/dist/roadtrip/p-04deac86.system.entry.js +1 -0
  270. package/dist/roadtrip/{p-05373846.system.js → p-05961c88.system.js} +1 -1
  271. package/dist/roadtrip/{p-2cf6206e.system.entry.js → p-06921946.system.entry.js} +1 -1
  272. package/dist/roadtrip/p-0ada8d41.entry.js +1 -0
  273. package/dist/roadtrip/{p-13b46f63.system.entry.js → p-0be273e0.system.entry.js} +1 -1
  274. package/dist/roadtrip/{p-cedaf396.system.entry.js → p-0cfc0efd.system.entry.js} +1 -1
  275. package/dist/roadtrip/{p-9bbeb646.entry.js → p-0e5cecff.entry.js} +1 -1
  276. package/dist/roadtrip/p-0e645dfb.system.entry.js +1 -0
  277. package/dist/roadtrip/p-0f532f30.system.entry.js +1 -0
  278. package/dist/roadtrip/p-102d3882.system.js +1 -0
  279. package/dist/roadtrip/{p-79a745a7.entry.js → p-1347a27e.entry.js} +1 -1
  280. package/dist/roadtrip/{p-f62ebe3f.system.entry.js → p-13c18cec.system.entry.js} +1 -1
  281. package/dist/roadtrip/p-1481edc3.entry.js +1 -0
  282. package/dist/roadtrip/p-1c0851b0.entry.js +1 -0
  283. package/dist/roadtrip/p-20a7a848.system.entry.js +1 -0
  284. package/dist/roadtrip/{p-1d83535a.entry.js → p-24234448.entry.js} +1 -1
  285. package/dist/roadtrip/{p-45b87537.system.entry.js → p-26b3aa33.system.entry.js} +1 -1
  286. package/dist/roadtrip/{p-e5eda362.system.entry.js → p-2740d308.system.entry.js} +1 -1
  287. package/dist/roadtrip/p-287f1612.system.entry.js +1 -0
  288. package/dist/roadtrip/p-299ecdd3.entry.js +1 -0
  289. package/dist/roadtrip/{p-b1a05290.system.entry.js → p-2f2dc4a0.system.entry.js} +1 -1
  290. package/dist/roadtrip/{p-8cb74e64.js → p-33e38a04.js} +1 -1
  291. package/dist/roadtrip/p-354107fa.entry.js +1 -0
  292. package/dist/roadtrip/{p-c7895d95.system.js → p-3683fe49.system.js} +0 -0
  293. package/dist/roadtrip/p-3ee7ff2a.system.entry.js +1 -0
  294. package/dist/roadtrip/{p-388a7f61.system.entry.js → p-42ccd4a2.system.entry.js} +1 -1
  295. package/dist/roadtrip/{p-8374797d.entry.js → p-44576eac.entry.js} +1 -1
  296. package/dist/roadtrip/p-46c22946.js +1 -0
  297. package/dist/roadtrip/{p-41bcd21c.system.entry.js → p-4742a822.system.entry.js} +1 -1
  298. package/dist/roadtrip/p-5bcd3e1f.entry.js +1 -0
  299. package/dist/roadtrip/p-6195c41f.system.entry.js +1 -0
  300. package/dist/roadtrip/{p-9b04e0cb.system.entry.js → p-646e75cf.system.entry.js} +1 -1
  301. package/dist/roadtrip/p-6a123e72.system.entry.js +1 -0
  302. package/dist/roadtrip/p-6bc4c517.system.entry.js +1 -0
  303. package/dist/roadtrip/p-6deb1943.system.entry.js +1 -0
  304. package/dist/roadtrip/p-6def92c3.entry.js +1 -0
  305. package/dist/roadtrip/p-6f248970.entry.js +1 -0
  306. package/dist/roadtrip/p-7070c8b5.system.entry.js +1 -0
  307. package/dist/roadtrip/p-7130ff47.entry.js +1 -0
  308. package/dist/roadtrip/{p-8649dccc.system.js → p-7154119b.system.js} +0 -0
  309. package/dist/roadtrip/p-7304b650.system.entry.js +1 -0
  310. package/dist/roadtrip/{p-a1f59f11.system.entry.js → p-74218654.system.entry.js} +1 -1
  311. package/dist/roadtrip/{p-085aad0a.system.entry.js → p-766f8a2a.system.entry.js} +1 -1
  312. package/dist/roadtrip/{p-628f5836.system.entry.js → p-76885294.system.entry.js} +1 -1
  313. package/dist/roadtrip/p-7765931a.system.entry.js +1 -0
  314. package/dist/roadtrip/{p-923c9893.entry.js → p-78315356.entry.js} +1 -1
  315. package/dist/roadtrip/p-7a07a70f.entry.js +1 -0
  316. package/dist/roadtrip/p-7b733694.js +1 -0
  317. package/dist/roadtrip/{p-ad3b839e.entry.js → p-7fe4f8f3.entry.js} +1 -1
  318. package/dist/roadtrip/{p-6688d8f8.system.entry.js → p-835d550a.system.entry.js} +1 -1
  319. package/dist/roadtrip/p-83f8960f.entry.js +1 -0
  320. package/dist/roadtrip/p-87eb24ee.entry.js +1 -0
  321. package/dist/roadtrip/p-8e21df57.system.entry.js +1 -0
  322. package/dist/roadtrip/{p-356163fb.js → p-93dab753.js} +0 -0
  323. package/dist/roadtrip/{p-39dd9c7f.entry.js → p-9567d161.entry.js} +1 -1
  324. package/dist/roadtrip/{p-a671df87.entry.js → p-9a1a293c.entry.js} +1 -1
  325. package/dist/roadtrip/{p-ffd2a5c1.system.entry.js → p-9afcfc7c.system.entry.js} +1 -1
  326. package/dist/roadtrip/{p-be0b7289.entry.js → p-9dd72bfa.entry.js} +1 -1
  327. package/dist/roadtrip/p-a1168bd5.system.entry.js +1 -0
  328. package/dist/roadtrip/p-a61e04a1.entry.js +1 -0
  329. package/dist/roadtrip/p-a7ddae1b.system.entry.js +1 -0
  330. package/dist/roadtrip/{p-8fc0f477.system.entry.js → p-a87e8b19.system.entry.js} +1 -1
  331. package/dist/roadtrip/{p-0626f8a2.system.entry.js → p-a8db6630.system.entry.js} +1 -1
  332. package/dist/roadtrip/{p-ad4a83f1.js → p-ac0761c3.js} +0 -0
  333. package/dist/roadtrip/{p-b862fe1a.system.js → p-ad92df4f.system.js} +1 -1
  334. package/dist/roadtrip/p-b0e17e68.entry.js +1 -0
  335. package/dist/roadtrip/{p-84578822.system.entry.js → p-b0ec7122.system.entry.js} +1 -1
  336. package/dist/roadtrip/{p-17ed8237.entry.js → p-b0ed748a.entry.js} +1 -1
  337. package/dist/roadtrip/p-b205281e.system.js +1 -0
  338. package/dist/roadtrip/{p-b6ea7ba9.system.entry.js → p-b591a3f7.system.entry.js} +1 -1
  339. package/dist/roadtrip/p-b6e60fca.system.entry.js +1 -0
  340. package/dist/roadtrip/p-bcf74e54.system.entry.js +1 -0
  341. package/dist/roadtrip/{p-d3e3af9e.system.entry.js → p-bd2a89d4.system.entry.js} +1 -1
  342. package/dist/roadtrip/p-bd4a114b.entry.js +1 -0
  343. package/dist/roadtrip/p-bebdee1e.entry.js +1 -0
  344. package/dist/roadtrip/{p-f907849c.system.entry.js → p-c0429d42.system.entry.js} +1 -1
  345. package/dist/roadtrip/p-c637a847.entry.js +1 -0
  346. package/dist/roadtrip/{p-f10872aa.entry.js → p-ced4c451.entry.js} +1 -1
  347. package/dist/roadtrip/{p-cb2bebde.entry.js → p-d06202e7.entry.js} +1 -1
  348. package/dist/roadtrip/p-d5607a82.system.entry.js +1 -0
  349. package/dist/roadtrip/{p-790067ad.system.entry.js → p-d861032d.system.entry.js} +1 -1
  350. package/dist/roadtrip/{p-f6d6d227.entry.js → p-dcfc236e.entry.js} +1 -1
  351. package/dist/roadtrip/p-e4f0f0d7.entry.js +1 -0
  352. package/dist/roadtrip/p-e5756d79.entry.js +1 -0
  353. package/dist/roadtrip/p-e6664bbe.entry.js +1 -0
  354. package/dist/roadtrip/{p-82d3347b.entry.js → p-e70b2a21.entry.js} +1 -1
  355. package/dist/roadtrip/{p-2d8ba6be.entry.js → p-e9a6f1fb.entry.js} +1 -1
  356. package/dist/roadtrip/p-ea45d823.entry.js +1 -0
  357. package/dist/roadtrip/p-ed2dbf57.entry.js +1 -0
  358. package/dist/roadtrip/{p-72b3db6d.system.js → p-efa19d38.system.js} +0 -0
  359. package/dist/roadtrip/{p-9233dfbe.entry.js → p-f0ec3a64.entry.js} +1 -1
  360. package/dist/roadtrip/p-f20a3658.entry.js +1 -0
  361. package/dist/roadtrip/p-f22c63b7.entry.js +1 -0
  362. package/dist/roadtrip/p-f233746c.system.entry.js +1 -0
  363. package/dist/roadtrip/{p-2b0d3888.system.js → p-f33e4ac5.system.js} +1 -1
  364. package/dist/roadtrip/{p-41aa7a41.system.entry.js → p-f4f42d5c.system.entry.js} +1 -1
  365. package/dist/roadtrip/{p-112e8d3f.js → p-f6631560.js} +0 -0
  366. package/dist/roadtrip/p-fa68c113.entry.js +1 -0
  367. package/dist/roadtrip/p-fce355f6.entry.js +1 -0
  368. package/dist/roadtrip/roadtrip.esm.js +1 -1
  369. package/dist/roadtrip/roadtrip.js +1 -1
  370. package/dist/roadtrip/svg/attachment.svg +1 -0
  371. package/dist/roadtrip/svg/check-list-color.svg +1 -0
  372. package/dist/roadtrip/svg/check-list.svg +1 -0
  373. package/dist/roadtrip/svg/device-smartphone-music-color.svg +1 -0
  374. package/dist/roadtrip/svg/device-smartphone-music.svg +1 -0
  375. package/dist/roadtrip/svg/mic-off-outline-color.svg +1 -0
  376. package/dist/roadtrip/svg/mic-off-outline.svg +1 -0
  377. package/dist/roadtrip/svg/mic-off.svg +1 -0
  378. package/dist/roadtrip/svg/people-community-outline-color.svg +1 -0
  379. package/dist/roadtrip/svg/people-community-outline.svg +1 -0
  380. package/dist/roadtrip/svg/people-community.svg +1 -0
  381. package/dist/roadtrip/svg/people-coworker-color.svg +1 -1
  382. package/dist/roadtrip/svg/people-coworker.svg +1 -1
  383. package/dist/roadtrip/svg/player-radio-music-outline-color.svg +1 -0
  384. package/dist/roadtrip/svg/player-radio-music-outline.svg +1 -0
  385. package/dist/roadtrip/svg/station-electric-outline-color.svg +1 -0
  386. package/dist/roadtrip/svg/station-electric-outline.svg +1 -0
  387. package/dist/roadtrip/svg/vehicle-car-all-authorize-outline-color.svg +1 -0
  388. package/dist/roadtrip/svg/vehicle-car-all-authorize-outline.svg +1 -0
  389. package/dist/roadtrip/svg/vehicle-car-all-unauthorize-outline-color.svg +1 -0
  390. package/dist/roadtrip/svg/vehicle-car-all-unauthorize-outline.svg +1 -0
  391. package/dist/roadtrip/svg/{vehicle-car-bodyworkoutline-color.svg → vehicle-car-bodywork-outline-color.svg} +0 -0
  392. package/dist/types/components/accordion/accordion.d.ts +1 -1
  393. package/dist/types/components/autocomplete/autocomplete.d.ts +5 -0
  394. package/dist/types/components/button/button.d.ts +6 -2
  395. package/dist/types/components/card/card.d.ts +5 -0
  396. package/dist/types/components/carousel/carousel.d.ts +16 -16
  397. package/dist/types/components/checkbox/checkbox.d.ts +12 -3
  398. package/dist/types/components/chip/chip.d.ts +3 -3
  399. package/dist/types/components/collapse/collapse.d.ts +4 -4
  400. package/dist/types/components/counter/counter.d.ts +8 -4
  401. package/dist/types/components/dropdown/dropdown.d.ts +1 -1
  402. package/dist/types/components/duration/duration.d.ts +44 -0
  403. package/dist/types/components/img/img.d.ts +15 -3
  404. package/dist/types/components/input/input.d.ts +10 -0
  405. package/dist/types/components/navbar/navbar.d.ts +2 -0
  406. package/dist/types/components/navbar-item/navbar-item.d.ts +2 -0
  407. package/dist/types/components/plate-number/plate-number.d.ts +10 -0
  408. package/dist/types/components/radio/radio.d.ts +4 -0
  409. package/dist/types/components/radio-group/radio-group.d.ts +4 -0
  410. package/dist/types/components/range/range.d.ts +4 -0
  411. package/dist/types/components/select/select.d.ts +8 -0
  412. package/dist/types/components/select-filter/select-filter.d.ts +10 -0
  413. package/dist/types/components/switch/switch.d.ts +14 -5
  414. package/dist/types/components/tab-bar/tab-bar.d.ts +2 -0
  415. package/dist/types/components/tab-button/tab-button.d.ts +2 -0
  416. package/dist/types/components/tabs/tabs.d.ts +8 -0
  417. package/dist/types/components/textarea/textarea.d.ts +18 -8
  418. package/dist/types/components/toast/toast.d.ts +2 -2
  419. package/dist/types/components/tooltip/tooltip.d.ts +2 -2
  420. package/dist/types/components.d.ts +185 -109
  421. package/dist/types/stencil-public-runtime.d.ts +6 -4
  422. package/icons/icons.svg +1 -1
  423. package/icons/index.d.ts +20 -1
  424. package/icons/index.js +22 -3
  425. package/loader/cdn.js +3 -0
  426. package/loader/index.cjs.js +3 -0
  427. package/loader/index.d.ts +12 -0
  428. package/loader/index.es2017.js +3 -0
  429. package/loader/index.js +4 -0
  430. package/loader/package.json +10 -0
  431. package/package.json +10 -7
  432. package/dist/esm-es5/app-6a43d362.js +0 -1
  433. package/dist/roadtrip/p-0205d149.entry.js +0 -1
  434. package/dist/roadtrip/p-0245b436.system.entry.js +0 -1
  435. package/dist/roadtrip/p-06049c44.entry.js +0 -1
  436. package/dist/roadtrip/p-0de3a4c8.system.entry.js +0 -1
  437. package/dist/roadtrip/p-10cc8504.system.entry.js +0 -1
  438. package/dist/roadtrip/p-16bce6f9.system.entry.js +0 -1
  439. package/dist/roadtrip/p-2965ce57.entry.js +0 -1
  440. package/dist/roadtrip/p-36a7c233.system.js +0 -1
  441. package/dist/roadtrip/p-3c7147c6.system.entry.js +0 -1
  442. package/dist/roadtrip/p-3d2cf159.entry.js +0 -1
  443. package/dist/roadtrip/p-3e56faf1.entry.js +0 -1
  444. package/dist/roadtrip/p-404509c1.entry.js +0 -1
  445. package/dist/roadtrip/p-464814f7.system.entry.js +0 -1
  446. package/dist/roadtrip/p-48a0df03.system.entry.js +0 -1
  447. package/dist/roadtrip/p-55c19c46.system.entry.js +0 -1
  448. package/dist/roadtrip/p-57e9b50d.entry.js +0 -1
  449. package/dist/roadtrip/p-5cfcbccd.system.entry.js +0 -1
  450. package/dist/roadtrip/p-674922e2.system.entry.js +0 -1
  451. package/dist/roadtrip/p-694eee8e.system.entry.js +0 -1
  452. package/dist/roadtrip/p-70b2bc5a.entry.js +0 -1
  453. package/dist/roadtrip/p-70d0fb28.entry.js +0 -1
  454. package/dist/roadtrip/p-726b0209.system.entry.js +0 -1
  455. package/dist/roadtrip/p-78143a79.system.entry.js +0 -1
  456. package/dist/roadtrip/p-89fb8799.entry.js +0 -1
  457. package/dist/roadtrip/p-96f5d0f6.entry.js +0 -1
  458. package/dist/roadtrip/p-9846103f.entry.js +0 -1
  459. package/dist/roadtrip/p-9d3921a8.system.js +0 -1
  460. package/dist/roadtrip/p-9faa50e1.system.entry.js +0 -1
  461. package/dist/roadtrip/p-a082797b.entry.js +0 -1
  462. package/dist/roadtrip/p-a0cbd965.system.entry.js +0 -1
  463. package/dist/roadtrip/p-a6827ec2.entry.js +0 -1
  464. package/dist/roadtrip/p-aa63d5e9.system.entry.js +0 -1
  465. package/dist/roadtrip/p-acc76968.entry.js +0 -1
  466. package/dist/roadtrip/p-af6faf9b.system.entry.js +0 -1
  467. package/dist/roadtrip/p-b0c6bcbf.entry.js +0 -1
  468. package/dist/roadtrip/p-bf18c600.system.entry.js +0 -1
  469. package/dist/roadtrip/p-c6b70e6f.js +0 -1
  470. package/dist/roadtrip/p-c9b37cd7.entry.js +0 -1
  471. package/dist/roadtrip/p-cd0efcac.system.entry.js +0 -1
  472. package/dist/roadtrip/p-d11931f0.js +0 -1
  473. package/dist/roadtrip/p-d39f805b.entry.js +0 -1
  474. package/dist/roadtrip/p-dad9d770.entry.js +0 -1
  475. package/dist/roadtrip/p-dd6c27c5.entry.js +0 -1
  476. package/dist/roadtrip/p-ded9cf97.entry.js +0 -1
  477. package/dist/roadtrip/p-eadfbbbb.entry.js +0 -1
  478. package/dist/roadtrip/p-f7547337.entry.js +0 -1
  479. package/dist/roadtrip/p-f80248b1.entry.js +0 -1
  480. package/dist/roadtrip/p-fe45a922.entry.js +0 -1
  481. package/dist/roadtrip/p-ffacdd19.entry.js +0 -1
@@ -2,13 +2,1792 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-d47fa3c0.js');
5
+ const index = require('./index-9b63596c.js');
6
+
7
+ /**
8
+ * Fuse.js v6.5.3 - Lightweight fuzzy-search (http://fusejs.io)
9
+ *
10
+ * Copyright (c) 2021 Kiro Risk (http://kiro.me)
11
+ * All Rights Reserved. Apache Software License 2.0
12
+ *
13
+ * http://www.apache.org/licenses/LICENSE-2.0
14
+ */
15
+
16
+ function isArray(value) {
17
+ return !Array.isArray
18
+ ? getTag(value) === '[object Array]'
19
+ : Array.isArray(value)
20
+ }
21
+
22
+ // Adapted from: https://github.com/lodash/lodash/blob/master/.internal/baseToString.js
23
+ const INFINITY = 1 / 0;
24
+ function baseToString(value) {
25
+ // Exit early for strings to avoid a performance hit in some environments.
26
+ if (typeof value == 'string') {
27
+ return value
28
+ }
29
+ let result = value + '';
30
+ return result == '0' && 1 / value == -INFINITY ? '-0' : result
31
+ }
32
+
33
+ function toString(value) {
34
+ return value == null ? '' : baseToString(value)
35
+ }
36
+
37
+ function isString(value) {
38
+ return typeof value === 'string'
39
+ }
40
+
41
+ function isNumber(value) {
42
+ return typeof value === 'number'
43
+ }
44
+
45
+ // Adapted from: https://github.com/lodash/lodash/blob/master/isBoolean.js
46
+ function isBoolean(value) {
47
+ return (
48
+ value === true ||
49
+ value === false ||
50
+ (isObjectLike(value) && getTag(value) == '[object Boolean]')
51
+ )
52
+ }
53
+
54
+ function isObject(value) {
55
+ return typeof value === 'object'
56
+ }
57
+
58
+ // Checks if `value` is object-like.
59
+ function isObjectLike(value) {
60
+ return isObject(value) && value !== null
61
+ }
62
+
63
+ function isDefined(value) {
64
+ return value !== undefined && value !== null
65
+ }
66
+
67
+ function isBlank(value) {
68
+ return !value.trim().length
69
+ }
70
+
71
+ // Gets the `toStringTag` of `value`.
72
+ // Adapted from: https://github.com/lodash/lodash/blob/master/.internal/getTag.js
73
+ function getTag(value) {
74
+ return value == null
75
+ ? value === undefined
76
+ ? '[object Undefined]'
77
+ : '[object Null]'
78
+ : Object.prototype.toString.call(value)
79
+ }
80
+
81
+ const EXTENDED_SEARCH_UNAVAILABLE = 'Extended search is not available';
82
+
83
+ const INCORRECT_INDEX_TYPE = "Incorrect 'index' type";
84
+
85
+ const LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = (key) =>
86
+ `Invalid value for key ${key}`;
87
+
88
+ const PATTERN_LENGTH_TOO_LARGE = (max) =>
89
+ `Pattern length exceeds max of ${max}.`;
90
+
91
+ const MISSING_KEY_PROPERTY = (name) => `Missing ${name} property in key`;
92
+
93
+ const INVALID_KEY_WEIGHT_VALUE = (key) =>
94
+ `Property 'weight' in key '${key}' must be a positive integer`;
95
+
96
+ const hasOwn = Object.prototype.hasOwnProperty;
97
+
98
+ class KeyStore {
99
+ constructor(keys) {
100
+ this._keys = [];
101
+ this._keyMap = {};
102
+
103
+ let totalWeight = 0;
104
+
105
+ keys.forEach((key) => {
106
+ let obj = createKey(key);
107
+
108
+ totalWeight += obj.weight;
109
+
110
+ this._keys.push(obj);
111
+ this._keyMap[obj.id] = obj;
112
+
113
+ totalWeight += obj.weight;
114
+ });
115
+
116
+ // Normalize weights so that their sum is equal to 1
117
+ this._keys.forEach((key) => {
118
+ key.weight /= totalWeight;
119
+ });
120
+ }
121
+ get(keyId) {
122
+ return this._keyMap[keyId]
123
+ }
124
+ keys() {
125
+ return this._keys
126
+ }
127
+ toJSON() {
128
+ return JSON.stringify(this._keys)
129
+ }
130
+ }
131
+
132
+ function createKey(key) {
133
+ let path = null;
134
+ let id = null;
135
+ let src = null;
136
+ let weight = 1;
137
+
138
+ if (isString(key) || isArray(key)) {
139
+ src = key;
140
+ path = createKeyPath(key);
141
+ id = createKeyId(key);
142
+ } else {
143
+ if (!hasOwn.call(key, 'name')) {
144
+ throw new Error(MISSING_KEY_PROPERTY('name'))
145
+ }
146
+
147
+ const name = key.name;
148
+ src = name;
149
+
150
+ if (hasOwn.call(key, 'weight')) {
151
+ weight = key.weight;
152
+
153
+ if (weight <= 0) {
154
+ throw new Error(INVALID_KEY_WEIGHT_VALUE(name))
155
+ }
156
+ }
157
+
158
+ path = createKeyPath(name);
159
+ id = createKeyId(name);
160
+ }
161
+
162
+ return { path, id, weight, src }
163
+ }
164
+
165
+ function createKeyPath(key) {
166
+ return isArray(key) ? key : key.split('.')
167
+ }
168
+
169
+ function createKeyId(key) {
170
+ return isArray(key) ? key.join('.') : key
171
+ }
172
+
173
+ function get(obj, path) {
174
+ let list = [];
175
+ let arr = false;
176
+
177
+ const deepGet = (obj, path, index) => {
178
+ if (!isDefined(obj)) {
179
+ return
180
+ }
181
+ if (!path[index]) {
182
+ // If there's no path left, we've arrived at the object we care about.
183
+ list.push(obj);
184
+ } else {
185
+ let key = path[index];
186
+
187
+ const value = obj[key];
188
+
189
+ if (!isDefined(value)) {
190
+ return
191
+ }
192
+
193
+ // If we're at the last value in the path, and if it's a string/number/bool,
194
+ // add it to the list
195
+ if (
196
+ index === path.length - 1 &&
197
+ (isString(value) || isNumber(value) || isBoolean(value))
198
+ ) {
199
+ list.push(toString(value));
200
+ } else if (isArray(value)) {
201
+ arr = true;
202
+ // Search each item in the array.
203
+ for (let i = 0, len = value.length; i < len; i += 1) {
204
+ deepGet(value[i], path, index + 1);
205
+ }
206
+ } else if (path.length) {
207
+ // An object. Recurse further.
208
+ deepGet(value, path, index + 1);
209
+ }
210
+ }
211
+ };
212
+
213
+ // Backwards compatibility (since path used to be a string)
214
+ deepGet(obj, isString(path) ? path.split('.') : path, 0);
215
+
216
+ return arr ? list : list[0]
217
+ }
218
+
219
+ const MatchOptions = {
220
+ // Whether the matches should be included in the result set. When `true`, each record in the result
221
+ // set will include the indices of the matched characters.
222
+ // These can consequently be used for highlighting purposes.
223
+ includeMatches: false,
224
+ // When `true`, the matching function will continue to the end of a search pattern even if
225
+ // a perfect match has already been located in the string.
226
+ findAllMatches: false,
227
+ // Minimum number of characters that must be matched before a result is considered a match
228
+ minMatchCharLength: 1
229
+ };
230
+
231
+ const BasicOptions = {
232
+ // When `true`, the algorithm continues searching to the end of the input even if a perfect
233
+ // match is found before the end of the same input.
234
+ isCaseSensitive: false,
235
+ // When true, the matching function will continue to the end of a search pattern even if
236
+ includeScore: false,
237
+ // List of properties that will be searched. This also supports nested properties.
238
+ keys: [],
239
+ // Whether to sort the result list, by score
240
+ shouldSort: true,
241
+ // Default sort function: sort by ascending score, ascending index
242
+ sortFn: (a, b) =>
243
+ a.score === b.score ? (a.idx < b.idx ? -1 : 1) : a.score < b.score ? -1 : 1
244
+ };
245
+
246
+ const FuzzyOptions = {
247
+ // Approximately where in the text is the pattern expected to be found?
248
+ location: 0,
249
+ // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match
250
+ // (of both letters and location), a threshold of '1.0' would match anything.
251
+ threshold: 0.6,
252
+ // Determines how close the match must be to the fuzzy location (specified above).
253
+ // An exact letter match which is 'distance' characters away from the fuzzy location
254
+ // would score as a complete mismatch. A distance of '0' requires the match be at
255
+ // the exact location specified, a threshold of '1000' would require a perfect match
256
+ // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.
257
+ distance: 100
258
+ };
259
+
260
+ const AdvancedOptions = {
261
+ // When `true`, it enables the use of unix-like search commands
262
+ useExtendedSearch: false,
263
+ // The get function to use when fetching an object's properties.
264
+ // The default will search nested paths *ie foo.bar.baz*
265
+ getFn: get,
266
+ // When `true`, search will ignore `location` and `distance`, so it won't matter
267
+ // where in the string the pattern appears.
268
+ // More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score
269
+ ignoreLocation: false,
270
+ // When `true`, the calculation for the relevance score (used for sorting) will
271
+ // ignore the field-length norm.
272
+ // More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm
273
+ ignoreFieldNorm: false,
274
+ // The weight to determine how much field length norm effects scoring.
275
+ fieldNormWeight: 1
276
+ };
277
+
278
+ var Config = {
279
+ ...BasicOptions,
280
+ ...MatchOptions,
281
+ ...FuzzyOptions,
282
+ ...AdvancedOptions
283
+ };
284
+
285
+ const SPACE = /[^ ]+/g;
286
+
287
+ // Field-length norm: the shorter the field, the higher the weight.
288
+ // Set to 3 decimals to reduce index size.
289
+ function norm(weight = 1, mantissa = 3) {
290
+ const cache = new Map();
291
+ const m = Math.pow(10, mantissa);
292
+
293
+ return {
294
+ get(value) {
295
+ const numTokens = value.match(SPACE).length;
296
+
297
+ if (cache.has(numTokens)) {
298
+ return cache.get(numTokens)
299
+ }
300
+
301
+ // Default function is 1/sqrt(x), weight makes that variable
302
+ const norm = 1 / Math.pow(numTokens, 0.5 * weight);
303
+
304
+ // In place of `toFixed(mantissa)`, for faster computation
305
+ const n = parseFloat(Math.round(norm * m) / m);
306
+
307
+ cache.set(numTokens, n);
308
+
309
+ return n
310
+ },
311
+ clear() {
312
+ cache.clear();
313
+ }
314
+ }
315
+ }
316
+
317
+ class FuseIndex {
318
+ constructor({
319
+ getFn = Config.getFn,
320
+ fieldNormWeight = Config.fieldNormWeight
321
+ } = {}) {
322
+ this.norm = norm(fieldNormWeight, 3);
323
+ this.getFn = getFn;
324
+ this.isCreated = false;
325
+
326
+ this.setIndexRecords();
327
+ }
328
+ setSources(docs = []) {
329
+ this.docs = docs;
330
+ }
331
+ setIndexRecords(records = []) {
332
+ this.records = records;
333
+ }
334
+ setKeys(keys = []) {
335
+ this.keys = keys;
336
+ this._keysMap = {};
337
+ keys.forEach((key, idx) => {
338
+ this._keysMap[key.id] = idx;
339
+ });
340
+ }
341
+ create() {
342
+ if (this.isCreated || !this.docs.length) {
343
+ return
344
+ }
345
+
346
+ this.isCreated = true;
347
+
348
+ // List is Array<String>
349
+ if (isString(this.docs[0])) {
350
+ this.docs.forEach((doc, docIndex) => {
351
+ this._addString(doc, docIndex);
352
+ });
353
+ } else {
354
+ // List is Array<Object>
355
+ this.docs.forEach((doc, docIndex) => {
356
+ this._addObject(doc, docIndex);
357
+ });
358
+ }
359
+
360
+ this.norm.clear();
361
+ }
362
+ // Adds a doc to the end of the index
363
+ add(doc) {
364
+ const idx = this.size();
365
+
366
+ if (isString(doc)) {
367
+ this._addString(doc, idx);
368
+ } else {
369
+ this._addObject(doc, idx);
370
+ }
371
+ }
372
+ // Removes the doc at the specified index of the index
373
+ removeAt(idx) {
374
+ this.records.splice(idx, 1);
375
+
376
+ // Change ref index of every subsquent doc
377
+ for (let i = idx, len = this.size(); i < len; i += 1) {
378
+ this.records[i].i -= 1;
379
+ }
380
+ }
381
+ getValueForItemAtKeyId(item, keyId) {
382
+ return item[this._keysMap[keyId]]
383
+ }
384
+ size() {
385
+ return this.records.length
386
+ }
387
+ _addString(doc, docIndex) {
388
+ if (!isDefined(doc) || isBlank(doc)) {
389
+ return
390
+ }
391
+
392
+ let record = {
393
+ v: doc,
394
+ i: docIndex,
395
+ n: this.norm.get(doc)
396
+ };
397
+
398
+ this.records.push(record);
399
+ }
400
+ _addObject(doc, docIndex) {
401
+ let record = { i: docIndex, $: {} };
402
+
403
+ // Iterate over every key (i.e, path), and fetch the value at that key
404
+ this.keys.forEach((key, keyIndex) => {
405
+ // console.log(key)
406
+ let value = this.getFn(doc, key.path);
407
+
408
+ if (!isDefined(value)) {
409
+ return
410
+ }
411
+
412
+ if (isArray(value)) {
413
+ let subRecords = [];
414
+ const stack = [{ nestedArrIndex: -1, value }];
415
+
416
+ while (stack.length) {
417
+ const { nestedArrIndex, value } = stack.pop();
418
+
419
+ if (!isDefined(value)) {
420
+ continue
421
+ }
422
+
423
+ if (isString(value) && !isBlank(value)) {
424
+ let subRecord = {
425
+ v: value,
426
+ i: nestedArrIndex,
427
+ n: this.norm.get(value)
428
+ };
429
+
430
+ subRecords.push(subRecord);
431
+ } else if (isArray(value)) {
432
+ value.forEach((item, k) => {
433
+ stack.push({
434
+ nestedArrIndex: k,
435
+ value: item
436
+ });
437
+ });
438
+ } else ;
439
+ }
440
+ record.$[keyIndex] = subRecords;
441
+ } else if (!isBlank(value)) {
442
+ let subRecord = {
443
+ v: value,
444
+ n: this.norm.get(value)
445
+ };
446
+
447
+ record.$[keyIndex] = subRecord;
448
+ }
449
+ });
450
+
451
+ this.records.push(record);
452
+ }
453
+ toJSON() {
454
+ return {
455
+ keys: this.keys,
456
+ records: this.records
457
+ }
458
+ }
459
+ }
460
+
461
+ function createIndex(
462
+ keys,
463
+ docs,
464
+ { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}
465
+ ) {
466
+ const myIndex = new FuseIndex({ getFn, fieldNormWeight });
467
+ myIndex.setKeys(keys.map(createKey));
468
+ myIndex.setSources(docs);
469
+ myIndex.create();
470
+ return myIndex
471
+ }
472
+
473
+ function parseIndex(
474
+ data,
475
+ { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}
476
+ ) {
477
+ const { keys, records } = data;
478
+ const myIndex = new FuseIndex({ getFn, fieldNormWeight });
479
+ myIndex.setKeys(keys);
480
+ myIndex.setIndexRecords(records);
481
+ return myIndex
482
+ }
483
+
484
+ function computeScore$1(
485
+ pattern,
486
+ {
487
+ errors = 0,
488
+ currentLocation = 0,
489
+ expectedLocation = 0,
490
+ distance = Config.distance,
491
+ ignoreLocation = Config.ignoreLocation
492
+ } = {}
493
+ ) {
494
+ const accuracy = errors / pattern.length;
495
+
496
+ if (ignoreLocation) {
497
+ return accuracy
498
+ }
499
+
500
+ const proximity = Math.abs(expectedLocation - currentLocation);
501
+
502
+ if (!distance) {
503
+ // Dodge divide by zero error.
504
+ return proximity ? 1.0 : accuracy
505
+ }
506
+
507
+ return accuracy + proximity / distance
508
+ }
509
+
510
+ function convertMaskToIndices(
511
+ matchmask = [],
512
+ minMatchCharLength = Config.minMatchCharLength
513
+ ) {
514
+ let indices = [];
515
+ let start = -1;
516
+ let end = -1;
517
+ let i = 0;
518
+
519
+ for (let len = matchmask.length; i < len; i += 1) {
520
+ let match = matchmask[i];
521
+ if (match && start === -1) {
522
+ start = i;
523
+ } else if (!match && start !== -1) {
524
+ end = i - 1;
525
+ if (end - start + 1 >= minMatchCharLength) {
526
+ indices.push([start, end]);
527
+ }
528
+ start = -1;
529
+ }
530
+ }
531
+
532
+ // (i-1 - start) + 1 => i - start
533
+ if (matchmask[i - 1] && i - start >= minMatchCharLength) {
534
+ indices.push([start, i - 1]);
535
+ }
536
+
537
+ return indices
538
+ }
539
+
540
+ // Machine word size
541
+ const MAX_BITS = 32;
542
+
543
+ function search(
544
+ text,
545
+ pattern,
546
+ patternAlphabet,
547
+ {
548
+ location = Config.location,
549
+ distance = Config.distance,
550
+ threshold = Config.threshold,
551
+ findAllMatches = Config.findAllMatches,
552
+ minMatchCharLength = Config.minMatchCharLength,
553
+ includeMatches = Config.includeMatches,
554
+ ignoreLocation = Config.ignoreLocation
555
+ } = {}
556
+ ) {
557
+ if (pattern.length > MAX_BITS) {
558
+ throw new Error(PATTERN_LENGTH_TOO_LARGE(MAX_BITS))
559
+ }
560
+
561
+ const patternLen = pattern.length;
562
+ // Set starting location at beginning text and initialize the alphabet.
563
+ const textLen = text.length;
564
+ // Handle the case when location > text.length
565
+ const expectedLocation = Math.max(0, Math.min(location, textLen));
566
+ // Highest score beyond which we give up.
567
+ let currentThreshold = threshold;
568
+ // Is there a nearby exact match? (speedup)
569
+ let bestLocation = expectedLocation;
570
+
571
+ // Performance: only computer matches when the minMatchCharLength > 1
572
+ // OR if `includeMatches` is true.
573
+ const computeMatches = minMatchCharLength > 1 || includeMatches;
574
+ // A mask of the matches, used for building the indices
575
+ const matchMask = computeMatches ? Array(textLen) : [];
576
+
577
+ let index;
578
+
579
+ // Get all exact matches, here for speed up
580
+ while ((index = text.indexOf(pattern, bestLocation)) > -1) {
581
+ let score = computeScore$1(pattern, {
582
+ currentLocation: index,
583
+ expectedLocation,
584
+ distance,
585
+ ignoreLocation
586
+ });
587
+
588
+ currentThreshold = Math.min(score, currentThreshold);
589
+ bestLocation = index + patternLen;
590
+
591
+ if (computeMatches) {
592
+ let i = 0;
593
+ while (i < patternLen) {
594
+ matchMask[index + i] = 1;
595
+ i += 1;
596
+ }
597
+ }
598
+ }
599
+
600
+ // Reset the best location
601
+ bestLocation = -1;
602
+
603
+ let lastBitArr = [];
604
+ let finalScore = 1;
605
+ let binMax = patternLen + textLen;
606
+
607
+ const mask = 1 << (patternLen - 1);
608
+
609
+ for (let i = 0; i < patternLen; i += 1) {
610
+ // Scan for the best match; each iteration allows for one more error.
611
+ // Run a binary search to determine how far from the match location we can stray
612
+ // at this error level.
613
+ let binMin = 0;
614
+ let binMid = binMax;
615
+
616
+ while (binMin < binMid) {
617
+ const score = computeScore$1(pattern, {
618
+ errors: i,
619
+ currentLocation: expectedLocation + binMid,
620
+ expectedLocation,
621
+ distance,
622
+ ignoreLocation
623
+ });
624
+
625
+ if (score <= currentThreshold) {
626
+ binMin = binMid;
627
+ } else {
628
+ binMax = binMid;
629
+ }
630
+
631
+ binMid = Math.floor((binMax - binMin) / 2 + binMin);
632
+ }
633
+
634
+ // Use the result from this iteration as the maximum for the next.
635
+ binMax = binMid;
636
+
637
+ let start = Math.max(1, expectedLocation - binMid + 1);
638
+ let finish = findAllMatches
639
+ ? textLen
640
+ : Math.min(expectedLocation + binMid, textLen) + patternLen;
641
+
642
+ // Initialize the bit array
643
+ let bitArr = Array(finish + 2);
644
+
645
+ bitArr[finish + 1] = (1 << i) - 1;
646
+
647
+ for (let j = finish; j >= start; j -= 1) {
648
+ let currentLocation = j - 1;
649
+ let charMatch = patternAlphabet[text.charAt(currentLocation)];
650
+
651
+ if (computeMatches) {
652
+ // Speed up: quick bool to int conversion (i.e, `charMatch ? 1 : 0`)
653
+ matchMask[currentLocation] = +!!charMatch;
654
+ }
655
+
656
+ // First pass: exact match
657
+ bitArr[j] = ((bitArr[j + 1] << 1) | 1) & charMatch;
658
+
659
+ // Subsequent passes: fuzzy match
660
+ if (i) {
661
+ bitArr[j] |=
662
+ ((lastBitArr[j + 1] | lastBitArr[j]) << 1) | 1 | lastBitArr[j + 1];
663
+ }
664
+
665
+ if (bitArr[j] & mask) {
666
+ finalScore = computeScore$1(pattern, {
667
+ errors: i,
668
+ currentLocation,
669
+ expectedLocation,
670
+ distance,
671
+ ignoreLocation
672
+ });
673
+
674
+ // This match will almost certainly be better than any existing match.
675
+ // But check anyway.
676
+ if (finalScore <= currentThreshold) {
677
+ // Indeed it is
678
+ currentThreshold = finalScore;
679
+ bestLocation = currentLocation;
680
+
681
+ // Already passed `loc`, downhill from here on in.
682
+ if (bestLocation <= expectedLocation) {
683
+ break
684
+ }
685
+
686
+ // When passing `bestLocation`, don't exceed our current distance from `expectedLocation`.
687
+ start = Math.max(1, 2 * expectedLocation - bestLocation);
688
+ }
689
+ }
690
+ }
691
+
692
+ // No hope for a (better) match at greater error levels.
693
+ const score = computeScore$1(pattern, {
694
+ errors: i + 1,
695
+ currentLocation: expectedLocation,
696
+ expectedLocation,
697
+ distance,
698
+ ignoreLocation
699
+ });
700
+
701
+ if (score > currentThreshold) {
702
+ break
703
+ }
704
+
705
+ lastBitArr = bitArr;
706
+ }
707
+
708
+ const result = {
709
+ isMatch: bestLocation >= 0,
710
+ // Count exact matches (those with a score of 0) to be "almost" exact
711
+ score: Math.max(0.001, finalScore)
712
+ };
713
+
714
+ if (computeMatches) {
715
+ const indices = convertMaskToIndices(matchMask, minMatchCharLength);
716
+ if (!indices.length) {
717
+ result.isMatch = false;
718
+ } else if (includeMatches) {
719
+ result.indices = indices;
720
+ }
721
+ }
722
+
723
+ return result
724
+ }
725
+
726
+ function createPatternAlphabet(pattern) {
727
+ let mask = {};
728
+
729
+ for (let i = 0, len = pattern.length; i < len; i += 1) {
730
+ const char = pattern.charAt(i);
731
+ mask[char] = (mask[char] || 0) | (1 << (len - i - 1));
732
+ }
733
+
734
+ return mask
735
+ }
736
+
737
+ class BitapSearch {
738
+ constructor(
739
+ pattern,
740
+ {
741
+ location = Config.location,
742
+ threshold = Config.threshold,
743
+ distance = Config.distance,
744
+ includeMatches = Config.includeMatches,
745
+ findAllMatches = Config.findAllMatches,
746
+ minMatchCharLength = Config.minMatchCharLength,
747
+ isCaseSensitive = Config.isCaseSensitive,
748
+ ignoreLocation = Config.ignoreLocation
749
+ } = {}
750
+ ) {
751
+ this.options = {
752
+ location,
753
+ threshold,
754
+ distance,
755
+ includeMatches,
756
+ findAllMatches,
757
+ minMatchCharLength,
758
+ isCaseSensitive,
759
+ ignoreLocation
760
+ };
761
+
762
+ this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase();
763
+
764
+ this.chunks = [];
765
+
766
+ if (!this.pattern.length) {
767
+ return
768
+ }
769
+
770
+ const addChunk = (pattern, startIndex) => {
771
+ this.chunks.push({
772
+ pattern,
773
+ alphabet: createPatternAlphabet(pattern),
774
+ startIndex
775
+ });
776
+ };
777
+
778
+ const len = this.pattern.length;
779
+
780
+ if (len > MAX_BITS) {
781
+ let i = 0;
782
+ const remainder = len % MAX_BITS;
783
+ const end = len - remainder;
784
+
785
+ while (i < end) {
786
+ addChunk(this.pattern.substr(i, MAX_BITS), i);
787
+ i += MAX_BITS;
788
+ }
789
+
790
+ if (remainder) {
791
+ const startIndex = len - MAX_BITS;
792
+ addChunk(this.pattern.substr(startIndex), startIndex);
793
+ }
794
+ } else {
795
+ addChunk(this.pattern, 0);
796
+ }
797
+ }
798
+
799
+ searchIn(text) {
800
+ const { isCaseSensitive, includeMatches } = this.options;
801
+
802
+ if (!isCaseSensitive) {
803
+ text = text.toLowerCase();
804
+ }
805
+
806
+ // Exact match
807
+ if (this.pattern === text) {
808
+ let result = {
809
+ isMatch: true,
810
+ score: 0
811
+ };
812
+
813
+ if (includeMatches) {
814
+ result.indices = [[0, text.length - 1]];
815
+ }
816
+
817
+ return result
818
+ }
819
+
820
+ // Otherwise, use Bitap algorithm
821
+ const {
822
+ location,
823
+ distance,
824
+ threshold,
825
+ findAllMatches,
826
+ minMatchCharLength,
827
+ ignoreLocation
828
+ } = this.options;
829
+
830
+ let allIndices = [];
831
+ let totalScore = 0;
832
+ let hasMatches = false;
833
+
834
+ this.chunks.forEach(({ pattern, alphabet, startIndex }) => {
835
+ const { isMatch, score, indices } = search(text, pattern, alphabet, {
836
+ location: location + startIndex,
837
+ distance,
838
+ threshold,
839
+ findAllMatches,
840
+ minMatchCharLength,
841
+ includeMatches,
842
+ ignoreLocation
843
+ });
844
+
845
+ if (isMatch) {
846
+ hasMatches = true;
847
+ }
848
+
849
+ totalScore += score;
850
+
851
+ if (isMatch && indices) {
852
+ allIndices = [...allIndices, ...indices];
853
+ }
854
+ });
855
+
856
+ let result = {
857
+ isMatch: hasMatches,
858
+ score: hasMatches ? totalScore / this.chunks.length : 1
859
+ };
860
+
861
+ if (hasMatches && includeMatches) {
862
+ result.indices = allIndices;
863
+ }
864
+
865
+ return result
866
+ }
867
+ }
868
+
869
+ class BaseMatch {
870
+ constructor(pattern) {
871
+ this.pattern = pattern;
872
+ }
873
+ static isMultiMatch(pattern) {
874
+ return getMatch(pattern, this.multiRegex)
875
+ }
876
+ static isSingleMatch(pattern) {
877
+ return getMatch(pattern, this.singleRegex)
878
+ }
879
+ search(/*text*/) {}
880
+ }
881
+
882
+ function getMatch(pattern, exp) {
883
+ const matches = pattern.match(exp);
884
+ return matches ? matches[1] : null
885
+ }
886
+
887
+ // Token: 'file
888
+
889
+ class ExactMatch extends BaseMatch {
890
+ constructor(pattern) {
891
+ super(pattern);
892
+ }
893
+ static get type() {
894
+ return 'exact'
895
+ }
896
+ static get multiRegex() {
897
+ return /^="(.*)"$/
898
+ }
899
+ static get singleRegex() {
900
+ return /^=(.*)$/
901
+ }
902
+ search(text) {
903
+ const isMatch = text === this.pattern;
904
+
905
+ return {
906
+ isMatch,
907
+ score: isMatch ? 0 : 1,
908
+ indices: [0, this.pattern.length - 1]
909
+ }
910
+ }
911
+ }
912
+
913
+ // Token: !fire
914
+
915
+ class InverseExactMatch extends BaseMatch {
916
+ constructor(pattern) {
917
+ super(pattern);
918
+ }
919
+ static get type() {
920
+ return 'inverse-exact'
921
+ }
922
+ static get multiRegex() {
923
+ return /^!"(.*)"$/
924
+ }
925
+ static get singleRegex() {
926
+ return /^!(.*)$/
927
+ }
928
+ search(text) {
929
+ const index = text.indexOf(this.pattern);
930
+ const isMatch = index === -1;
931
+
932
+ return {
933
+ isMatch,
934
+ score: isMatch ? 0 : 1,
935
+ indices: [0, text.length - 1]
936
+ }
937
+ }
938
+ }
939
+
940
+ // Token: ^file
941
+
942
+ class PrefixExactMatch extends BaseMatch {
943
+ constructor(pattern) {
944
+ super(pattern);
945
+ }
946
+ static get type() {
947
+ return 'prefix-exact'
948
+ }
949
+ static get multiRegex() {
950
+ return /^\^"(.*)"$/
951
+ }
952
+ static get singleRegex() {
953
+ return /^\^(.*)$/
954
+ }
955
+ search(text) {
956
+ const isMatch = text.startsWith(this.pattern);
957
+
958
+ return {
959
+ isMatch,
960
+ score: isMatch ? 0 : 1,
961
+ indices: [0, this.pattern.length - 1]
962
+ }
963
+ }
964
+ }
965
+
966
+ // Token: !^fire
967
+
968
+ class InversePrefixExactMatch extends BaseMatch {
969
+ constructor(pattern) {
970
+ super(pattern);
971
+ }
972
+ static get type() {
973
+ return 'inverse-prefix-exact'
974
+ }
975
+ static get multiRegex() {
976
+ return /^!\^"(.*)"$/
977
+ }
978
+ static get singleRegex() {
979
+ return /^!\^(.*)$/
980
+ }
981
+ search(text) {
982
+ const isMatch = !text.startsWith(this.pattern);
983
+
984
+ return {
985
+ isMatch,
986
+ score: isMatch ? 0 : 1,
987
+ indices: [0, text.length - 1]
988
+ }
989
+ }
990
+ }
991
+
992
+ // Token: .file$
993
+
994
+ class SuffixExactMatch extends BaseMatch {
995
+ constructor(pattern) {
996
+ super(pattern);
997
+ }
998
+ static get type() {
999
+ return 'suffix-exact'
1000
+ }
1001
+ static get multiRegex() {
1002
+ return /^"(.*)"\$$/
1003
+ }
1004
+ static get singleRegex() {
1005
+ return /^(.*)\$$/
1006
+ }
1007
+ search(text) {
1008
+ const isMatch = text.endsWith(this.pattern);
1009
+
1010
+ return {
1011
+ isMatch,
1012
+ score: isMatch ? 0 : 1,
1013
+ indices: [text.length - this.pattern.length, text.length - 1]
1014
+ }
1015
+ }
1016
+ }
1017
+
1018
+ // Token: !.file$
1019
+
1020
+ class InverseSuffixExactMatch extends BaseMatch {
1021
+ constructor(pattern) {
1022
+ super(pattern);
1023
+ }
1024
+ static get type() {
1025
+ return 'inverse-suffix-exact'
1026
+ }
1027
+ static get multiRegex() {
1028
+ return /^!"(.*)"\$$/
1029
+ }
1030
+ static get singleRegex() {
1031
+ return /^!(.*)\$$/
1032
+ }
1033
+ search(text) {
1034
+ const isMatch = !text.endsWith(this.pattern);
1035
+ return {
1036
+ isMatch,
1037
+ score: isMatch ? 0 : 1,
1038
+ indices: [0, text.length - 1]
1039
+ }
1040
+ }
1041
+ }
1042
+
1043
+ class FuzzyMatch extends BaseMatch {
1044
+ constructor(
1045
+ pattern,
1046
+ {
1047
+ location = Config.location,
1048
+ threshold = Config.threshold,
1049
+ distance = Config.distance,
1050
+ includeMatches = Config.includeMatches,
1051
+ findAllMatches = Config.findAllMatches,
1052
+ minMatchCharLength = Config.minMatchCharLength,
1053
+ isCaseSensitive = Config.isCaseSensitive,
1054
+ ignoreLocation = Config.ignoreLocation
1055
+ } = {}
1056
+ ) {
1057
+ super(pattern);
1058
+ this._bitapSearch = new BitapSearch(pattern, {
1059
+ location,
1060
+ threshold,
1061
+ distance,
1062
+ includeMatches,
1063
+ findAllMatches,
1064
+ minMatchCharLength,
1065
+ isCaseSensitive,
1066
+ ignoreLocation
1067
+ });
1068
+ }
1069
+ static get type() {
1070
+ return 'fuzzy'
1071
+ }
1072
+ static get multiRegex() {
1073
+ return /^"(.*)"$/
1074
+ }
1075
+ static get singleRegex() {
1076
+ return /^(.*)$/
1077
+ }
1078
+ search(text) {
1079
+ return this._bitapSearch.searchIn(text)
1080
+ }
1081
+ }
1082
+
1083
+ // Token: 'file
1084
+
1085
+ class IncludeMatch extends BaseMatch {
1086
+ constructor(pattern) {
1087
+ super(pattern);
1088
+ }
1089
+ static get type() {
1090
+ return 'include'
1091
+ }
1092
+ static get multiRegex() {
1093
+ return /^'"(.*)"$/
1094
+ }
1095
+ static get singleRegex() {
1096
+ return /^'(.*)$/
1097
+ }
1098
+ search(text) {
1099
+ let location = 0;
1100
+ let index;
1101
+
1102
+ const indices = [];
1103
+ const patternLen = this.pattern.length;
1104
+
1105
+ // Get all exact matches
1106
+ while ((index = text.indexOf(this.pattern, location)) > -1) {
1107
+ location = index + patternLen;
1108
+ indices.push([index, location - 1]);
1109
+ }
1110
+
1111
+ const isMatch = !!indices.length;
1112
+
1113
+ return {
1114
+ isMatch,
1115
+ score: isMatch ? 0 : 1,
1116
+ indices
1117
+ }
1118
+ }
1119
+ }
1120
+
1121
+ // ❗Order is important. DO NOT CHANGE.
1122
+ const searchers = [
1123
+ ExactMatch,
1124
+ IncludeMatch,
1125
+ PrefixExactMatch,
1126
+ InversePrefixExactMatch,
1127
+ InverseSuffixExactMatch,
1128
+ SuffixExactMatch,
1129
+ InverseExactMatch,
1130
+ FuzzyMatch
1131
+ ];
1132
+
1133
+ const searchersLen = searchers.length;
1134
+
1135
+ // Regex to split by spaces, but keep anything in quotes together
1136
+ const SPACE_RE = / +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;
1137
+ const OR_TOKEN = '|';
1138
+
1139
+ // Return a 2D array representation of the query, for simpler parsing.
1140
+ // Example:
1141
+ // "^core go$ | rb$ | py$ xy$" => [["^core", "go$"], ["rb$"], ["py$", "xy$"]]
1142
+ function parseQuery(pattern, options = {}) {
1143
+ return pattern.split(OR_TOKEN).map((item) => {
1144
+ let query = item
1145
+ .trim()
1146
+ .split(SPACE_RE)
1147
+ .filter((item) => item && !!item.trim());
1148
+
1149
+ let results = [];
1150
+ for (let i = 0, len = query.length; i < len; i += 1) {
1151
+ const queryItem = query[i];
1152
+
1153
+ // 1. Handle multiple query match (i.e, once that are quoted, like `"hello world"`)
1154
+ let found = false;
1155
+ let idx = -1;
1156
+ while (!found && ++idx < searchersLen) {
1157
+ const searcher = searchers[idx];
1158
+ let token = searcher.isMultiMatch(queryItem);
1159
+ if (token) {
1160
+ results.push(new searcher(token, options));
1161
+ found = true;
1162
+ }
1163
+ }
1164
+
1165
+ if (found) {
1166
+ continue
1167
+ }
1168
+
1169
+ // 2. Handle single query matches (i.e, once that are *not* quoted)
1170
+ idx = -1;
1171
+ while (++idx < searchersLen) {
1172
+ const searcher = searchers[idx];
1173
+ let token = searcher.isSingleMatch(queryItem);
1174
+ if (token) {
1175
+ results.push(new searcher(token, options));
1176
+ break
1177
+ }
1178
+ }
1179
+ }
1180
+
1181
+ return results
1182
+ })
1183
+ }
1184
+
1185
+ // These extended matchers can return an array of matches, as opposed
1186
+ // to a singl match
1187
+ const MultiMatchSet = new Set([FuzzyMatch.type, IncludeMatch.type]);
1188
+
1189
+ /**
1190
+ * Command-like searching
1191
+ * ======================
1192
+ *
1193
+ * Given multiple search terms delimited by spaces.e.g. `^jscript .python$ ruby !java`,
1194
+ * search in a given text.
1195
+ *
1196
+ * Search syntax:
1197
+ *
1198
+ * | Token | Match type | Description |
1199
+ * | ----------- | -------------------------- | -------------------------------------- |
1200
+ * | `jscript` | fuzzy-match | Items that fuzzy match `jscript` |
1201
+ * | `=scheme` | exact-match | Items that are `scheme` |
1202
+ * | `'python` | include-match | Items that include `python` |
1203
+ * | `!ruby` | inverse-exact-match | Items that do not include `ruby` |
1204
+ * | `^java` | prefix-exact-match | Items that start with `java` |
1205
+ * | `!^earlang` | inverse-prefix-exact-match | Items that do not start with `earlang` |
1206
+ * | `.js$` | suffix-exact-match | Items that end with `.js` |
1207
+ * | `!.go$` | inverse-suffix-exact-match | Items that do not end with `.go` |
1208
+ *
1209
+ * A single pipe character acts as an OR operator. For example, the following
1210
+ * query matches entries that start with `core` and end with either`go`, `rb`,
1211
+ * or`py`.
1212
+ *
1213
+ * ```
1214
+ * ^core go$ | rb$ | py$
1215
+ * ```
1216
+ */
1217
+ class ExtendedSearch {
1218
+ constructor(
1219
+ pattern,
1220
+ {
1221
+ isCaseSensitive = Config.isCaseSensitive,
1222
+ includeMatches = Config.includeMatches,
1223
+ minMatchCharLength = Config.minMatchCharLength,
1224
+ ignoreLocation = Config.ignoreLocation,
1225
+ findAllMatches = Config.findAllMatches,
1226
+ location = Config.location,
1227
+ threshold = Config.threshold,
1228
+ distance = Config.distance
1229
+ } = {}
1230
+ ) {
1231
+ this.query = null;
1232
+ this.options = {
1233
+ isCaseSensitive,
1234
+ includeMatches,
1235
+ minMatchCharLength,
1236
+ findAllMatches,
1237
+ ignoreLocation,
1238
+ location,
1239
+ threshold,
1240
+ distance
1241
+ };
1242
+
1243
+ this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase();
1244
+ this.query = parseQuery(this.pattern, this.options);
1245
+ }
1246
+
1247
+ static condition(_, options) {
1248
+ return options.useExtendedSearch
1249
+ }
1250
+
1251
+ searchIn(text) {
1252
+ const query = this.query;
1253
+
1254
+ if (!query) {
1255
+ return {
1256
+ isMatch: false,
1257
+ score: 1
1258
+ }
1259
+ }
1260
+
1261
+ const { includeMatches, isCaseSensitive } = this.options;
1262
+
1263
+ text = isCaseSensitive ? text : text.toLowerCase();
1264
+
1265
+ let numMatches = 0;
1266
+ let allIndices = [];
1267
+ let totalScore = 0;
1268
+
1269
+ // ORs
1270
+ for (let i = 0, qLen = query.length; i < qLen; i += 1) {
1271
+ const searchers = query[i];
1272
+
1273
+ // Reset indices
1274
+ allIndices.length = 0;
1275
+ numMatches = 0;
1276
+
1277
+ // ANDs
1278
+ for (let j = 0, pLen = searchers.length; j < pLen; j += 1) {
1279
+ const searcher = searchers[j];
1280
+ const { isMatch, indices, score } = searcher.search(text);
1281
+
1282
+ if (isMatch) {
1283
+ numMatches += 1;
1284
+ totalScore += score;
1285
+ if (includeMatches) {
1286
+ const type = searcher.constructor.type;
1287
+ if (MultiMatchSet.has(type)) {
1288
+ allIndices = [...allIndices, ...indices];
1289
+ } else {
1290
+ allIndices.push(indices);
1291
+ }
1292
+ }
1293
+ } else {
1294
+ totalScore = 0;
1295
+ numMatches = 0;
1296
+ allIndices.length = 0;
1297
+ break
1298
+ }
1299
+ }
1300
+
1301
+ // OR condition, so if TRUE, return
1302
+ if (numMatches) {
1303
+ let result = {
1304
+ isMatch: true,
1305
+ score: totalScore / numMatches
1306
+ };
1307
+
1308
+ if (includeMatches) {
1309
+ result.indices = allIndices;
1310
+ }
1311
+
1312
+ return result
1313
+ }
1314
+ }
1315
+
1316
+ // Nothing was matched
1317
+ return {
1318
+ isMatch: false,
1319
+ score: 1
1320
+ }
1321
+ }
1322
+ }
1323
+
1324
+ const registeredSearchers = [];
1325
+
1326
+ function register(...args) {
1327
+ registeredSearchers.push(...args);
1328
+ }
1329
+
1330
+ function createSearcher(pattern, options) {
1331
+ for (let i = 0, len = registeredSearchers.length; i < len; i += 1) {
1332
+ let searcherClass = registeredSearchers[i];
1333
+ if (searcherClass.condition(pattern, options)) {
1334
+ return new searcherClass(pattern, options)
1335
+ }
1336
+ }
1337
+
1338
+ return new BitapSearch(pattern, options)
1339
+ }
1340
+
1341
+ const LogicalOperator = {
1342
+ AND: '$and',
1343
+ OR: '$or'
1344
+ };
1345
+
1346
+ const KeyType = {
1347
+ PATH: '$path',
1348
+ PATTERN: '$val'
1349
+ };
1350
+
1351
+ const isExpression = (query) =>
1352
+ !!(query[LogicalOperator.AND] || query[LogicalOperator.OR]);
1353
+
1354
+ const isPath = (query) => !!query[KeyType.PATH];
1355
+
1356
+ const isLeaf = (query) =>
1357
+ !isArray(query) && isObject(query) && !isExpression(query);
1358
+
1359
+ const convertToExplicit = (query) => ({
1360
+ [LogicalOperator.AND]: Object.keys(query).map((key) => ({
1361
+ [key]: query[key]
1362
+ }))
1363
+ });
1364
+
1365
+ // When `auto` is `true`, the parse function will infer and initialize and add
1366
+ // the appropriate `Searcher` instance
1367
+ function parse(query, options, { auto = true } = {}) {
1368
+ const next = (query) => {
1369
+ let keys = Object.keys(query);
1370
+
1371
+ const isQueryPath = isPath(query);
1372
+
1373
+ if (!isQueryPath && keys.length > 1 && !isExpression(query)) {
1374
+ return next(convertToExplicit(query))
1375
+ }
1376
+
1377
+ if (isLeaf(query)) {
1378
+ const key = isQueryPath ? query[KeyType.PATH] : keys[0];
1379
+
1380
+ const pattern = isQueryPath ? query[KeyType.PATTERN] : query[key];
1381
+
1382
+ if (!isString(pattern)) {
1383
+ throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key))
1384
+ }
1385
+
1386
+ const obj = {
1387
+ keyId: createKeyId(key),
1388
+ pattern
1389
+ };
1390
+
1391
+ if (auto) {
1392
+ obj.searcher = createSearcher(pattern, options);
1393
+ }
1394
+
1395
+ return obj
1396
+ }
1397
+
1398
+ let node = {
1399
+ children: [],
1400
+ operator: keys[0]
1401
+ };
1402
+
1403
+ keys.forEach((key) => {
1404
+ const value = query[key];
1405
+
1406
+ if (isArray(value)) {
1407
+ value.forEach((item) => {
1408
+ node.children.push(next(item));
1409
+ });
1410
+ }
1411
+ });
1412
+
1413
+ return node
1414
+ };
1415
+
1416
+ if (!isExpression(query)) {
1417
+ query = convertToExplicit(query);
1418
+ }
1419
+
1420
+ return next(query)
1421
+ }
1422
+
1423
+ // Practical scoring function
1424
+ function computeScore(
1425
+ results,
1426
+ { ignoreFieldNorm = Config.ignoreFieldNorm }
1427
+ ) {
1428
+ results.forEach((result) => {
1429
+ let totalScore = 1;
1430
+
1431
+ result.matches.forEach(({ key, norm, score }) => {
1432
+ const weight = key ? key.weight : null;
1433
+
1434
+ totalScore *= Math.pow(
1435
+ score === 0 && weight ? Number.EPSILON : score,
1436
+ (weight || 1) * (ignoreFieldNorm ? 1 : norm)
1437
+ );
1438
+ });
1439
+
1440
+ result.score = totalScore;
1441
+ });
1442
+ }
1443
+
1444
+ function transformMatches(result, data) {
1445
+ const matches = result.matches;
1446
+ data.matches = [];
1447
+
1448
+ if (!isDefined(matches)) {
1449
+ return
1450
+ }
1451
+
1452
+ matches.forEach((match) => {
1453
+ if (!isDefined(match.indices) || !match.indices.length) {
1454
+ return
1455
+ }
1456
+
1457
+ const { indices, value } = match;
1458
+
1459
+ let obj = {
1460
+ indices,
1461
+ value
1462
+ };
1463
+
1464
+ if (match.key) {
1465
+ obj.key = match.key.src;
1466
+ }
1467
+
1468
+ if (match.idx > -1) {
1469
+ obj.refIndex = match.idx;
1470
+ }
1471
+
1472
+ data.matches.push(obj);
1473
+ });
1474
+ }
1475
+
1476
+ function transformScore(result, data) {
1477
+ data.score = result.score;
1478
+ }
1479
+
1480
+ function format(
1481
+ results,
1482
+ docs,
1483
+ {
1484
+ includeMatches = Config.includeMatches,
1485
+ includeScore = Config.includeScore
1486
+ } = {}
1487
+ ) {
1488
+ const transformers = [];
1489
+
1490
+ if (includeMatches) transformers.push(transformMatches);
1491
+ if (includeScore) transformers.push(transformScore);
1492
+
1493
+ return results.map((result) => {
1494
+ const { idx } = result;
1495
+
1496
+ const data = {
1497
+ item: docs[idx],
1498
+ refIndex: idx
1499
+ };
1500
+
1501
+ if (transformers.length) {
1502
+ transformers.forEach((transformer) => {
1503
+ transformer(result, data);
1504
+ });
1505
+ }
1506
+
1507
+ return data
1508
+ })
1509
+ }
1510
+
1511
+ class Fuse {
1512
+ constructor(docs, options = {}, index) {
1513
+ this.options = { ...Config, ...options };
1514
+
1515
+ if (
1516
+ this.options.useExtendedSearch &&
1517
+ !true
1518
+ ) {
1519
+ throw new Error(EXTENDED_SEARCH_UNAVAILABLE)
1520
+ }
1521
+
1522
+ this._keyStore = new KeyStore(this.options.keys);
1523
+
1524
+ this.setCollection(docs, index);
1525
+ }
1526
+
1527
+ setCollection(docs, index) {
1528
+ this._docs = docs;
1529
+
1530
+ if (index && !(index instanceof FuseIndex)) {
1531
+ throw new Error(INCORRECT_INDEX_TYPE)
1532
+ }
1533
+
1534
+ this._myIndex =
1535
+ index ||
1536
+ createIndex(this.options.keys, this._docs, {
1537
+ getFn: this.options.getFn,
1538
+ fieldNormWeight: this.options.fieldNormWeight
1539
+ });
1540
+ }
1541
+
1542
+ add(doc) {
1543
+ if (!isDefined(doc)) {
1544
+ return
1545
+ }
1546
+
1547
+ this._docs.push(doc);
1548
+ this._myIndex.add(doc);
1549
+ }
1550
+
1551
+ remove(predicate = (/* doc, idx */) => false) {
1552
+ const results = [];
1553
+
1554
+ for (let i = 0, len = this._docs.length; i < len; i += 1) {
1555
+ const doc = this._docs[i];
1556
+ if (predicate(doc, i)) {
1557
+ this.removeAt(i);
1558
+ i -= 1;
1559
+ len -= 1;
1560
+
1561
+ results.push(doc);
1562
+ }
1563
+ }
1564
+
1565
+ return results
1566
+ }
1567
+
1568
+ removeAt(idx) {
1569
+ this._docs.splice(idx, 1);
1570
+ this._myIndex.removeAt(idx);
1571
+ }
1572
+
1573
+ getIndex() {
1574
+ return this._myIndex
1575
+ }
1576
+
1577
+ search(query, { limit = -1 } = {}) {
1578
+ const {
1579
+ includeMatches,
1580
+ includeScore,
1581
+ shouldSort,
1582
+ sortFn,
1583
+ ignoreFieldNorm
1584
+ } = this.options;
1585
+
1586
+ let results = isString(query)
1587
+ ? isString(this._docs[0])
1588
+ ? this._searchStringList(query)
1589
+ : this._searchObjectList(query)
1590
+ : this._searchLogical(query);
1591
+
1592
+ computeScore(results, { ignoreFieldNorm });
1593
+
1594
+ if (shouldSort) {
1595
+ results.sort(sortFn);
1596
+ }
1597
+
1598
+ if (isNumber(limit) && limit > -1) {
1599
+ results = results.slice(0, limit);
1600
+ }
1601
+
1602
+ return format(results, this._docs, {
1603
+ includeMatches,
1604
+ includeScore
1605
+ })
1606
+ }
1607
+
1608
+ _searchStringList(query) {
1609
+ const searcher = createSearcher(query, this.options);
1610
+ const { records } = this._myIndex;
1611
+ const results = [];
1612
+
1613
+ // Iterate over every string in the index
1614
+ records.forEach(({ v: text, i: idx, n: norm }) => {
1615
+ if (!isDefined(text)) {
1616
+ return
1617
+ }
1618
+
1619
+ const { isMatch, score, indices } = searcher.searchIn(text);
1620
+
1621
+ if (isMatch) {
1622
+ results.push({
1623
+ item: text,
1624
+ idx,
1625
+ matches: [{ score, value: text, norm, indices }]
1626
+ });
1627
+ }
1628
+ });
1629
+
1630
+ return results
1631
+ }
1632
+
1633
+ _searchLogical(query) {
1634
+
1635
+ const expression = parse(query, this.options);
1636
+
1637
+ const evaluate = (node, item, idx) => {
1638
+ if (!node.children) {
1639
+ const { keyId, searcher } = node;
1640
+
1641
+ const matches = this._findMatches({
1642
+ key: this._keyStore.get(keyId),
1643
+ value: this._myIndex.getValueForItemAtKeyId(item, keyId),
1644
+ searcher
1645
+ });
1646
+
1647
+ if (matches && matches.length) {
1648
+ return [
1649
+ {
1650
+ idx,
1651
+ item,
1652
+ matches
1653
+ }
1654
+ ]
1655
+ }
1656
+
1657
+ return []
1658
+ }
1659
+
1660
+ const res = [];
1661
+ for (let i = 0, len = node.children.length; i < len; i += 1) {
1662
+ const child = node.children[i];
1663
+ const result = evaluate(child, item, idx);
1664
+ if (result.length) {
1665
+ res.push(...result);
1666
+ } else if (node.operator === LogicalOperator.AND) {
1667
+ return []
1668
+ }
1669
+ }
1670
+ return res
1671
+ };
1672
+
1673
+ const records = this._myIndex.records;
1674
+ const resultMap = {};
1675
+ const results = [];
1676
+
1677
+ records.forEach(({ $: item, i: idx }) => {
1678
+ if (isDefined(item)) {
1679
+ let expResults = evaluate(expression, item, idx);
1680
+
1681
+ if (expResults.length) {
1682
+ // Dedupe when adding
1683
+ if (!resultMap[idx]) {
1684
+ resultMap[idx] = { idx, item, matches: [] };
1685
+ results.push(resultMap[idx]);
1686
+ }
1687
+ expResults.forEach(({ matches }) => {
1688
+ resultMap[idx].matches.push(...matches);
1689
+ });
1690
+ }
1691
+ }
1692
+ });
1693
+
1694
+ return results
1695
+ }
1696
+
1697
+ _searchObjectList(query) {
1698
+ const searcher = createSearcher(query, this.options);
1699
+ const { keys, records } = this._myIndex;
1700
+ const results = [];
1701
+
1702
+ // List is Array<Object>
1703
+ records.forEach(({ $: item, i: idx }) => {
1704
+ if (!isDefined(item)) {
1705
+ return
1706
+ }
1707
+
1708
+ let matches = [];
1709
+
1710
+ // Iterate over every key (i.e, path), and fetch the value at that key
1711
+ keys.forEach((key, keyIndex) => {
1712
+ matches.push(
1713
+ ...this._findMatches({
1714
+ key,
1715
+ value: item[keyIndex],
1716
+ searcher
1717
+ })
1718
+ );
1719
+ });
1720
+
1721
+ if (matches.length) {
1722
+ results.push({
1723
+ idx,
1724
+ item,
1725
+ matches
1726
+ });
1727
+ }
1728
+ });
1729
+
1730
+ return results
1731
+ }
1732
+ _findMatches({ key, value, searcher }) {
1733
+ if (!isDefined(value)) {
1734
+ return []
1735
+ }
1736
+
1737
+ let matches = [];
1738
+
1739
+ if (isArray(value)) {
1740
+ value.forEach(({ v: text, i: idx, n: norm }) => {
1741
+ if (!isDefined(text)) {
1742
+ return
1743
+ }
1744
+
1745
+ const { isMatch, score, indices } = searcher.searchIn(text);
1746
+
1747
+ if (isMatch) {
1748
+ matches.push({
1749
+ score,
1750
+ key,
1751
+ value: text,
1752
+ idx,
1753
+ norm,
1754
+ indices
1755
+ });
1756
+ }
1757
+ });
1758
+ } else {
1759
+ const { v: text, n: norm } = value;
1760
+
1761
+ const { isMatch, score, indices } = searcher.searchIn(text);
1762
+
1763
+ if (isMatch) {
1764
+ matches.push({ score, key, value: text, norm, indices });
1765
+ }
1766
+ }
1767
+
1768
+ return matches
1769
+ }
1770
+ }
1771
+
1772
+ Fuse.version = '6.5.3';
1773
+ Fuse.createIndex = createIndex;
1774
+ Fuse.parseIndex = parseIndex;
1775
+ Fuse.config = Config;
1776
+
1777
+ {
1778
+ Fuse.parseQuery = parse;
1779
+ }
1780
+
1781
+ {
1782
+ register(ExtendedSearch);
1783
+ }
6
1784
 
7
1785
  const selectFilterCss = ".sc-road-select-filter-h{position:relative;display:block}.select-filter-list.sc-road-select-filter{position:absolute;top:3rem;z-index:1;width:100%;max-height:16rem;padding:0.5rem 0;margin:0;overflow-y:scroll;font-family:var(--font, sans-serif);font-size:0.875rem;color:var(--text);list-style-type:none;background:var(--white);border-radius:0 0 0.25rem 0.25rem;-webkit-box-shadow:0 3px 6px rgba(0, 0, 0, 0.16);box-shadow:0 3px 6px rgba(0, 0, 0, 0.16)}.select-filter-item.sc-road-select-filter{padding:0.75rem 1rem;cursor:pointer}.select-filter-item.sc-road-select-filter:hover,.select-filter-item.highlight.sc-road-select-filter{color:var(--secondary-contrast);background:var(--secondary)}";
8
1786
 
9
1787
  let SelectFilter = class {
10
1788
  constructor(hostRef) {
11
1789
  index.registerInstance(this, hostRef);
1790
+ this.roadselected = index.createEvent(this, "roadselected", 7);
12
1791
  this.roadSelected = index.createEvent(this, "roadSelected", 7);
13
1792
  this.isOpen = false;
14
1793
  this.currentValue = '';
@@ -16,6 +1795,15 @@ let SelectFilter = class {
16
1795
  * List of options of the select
17
1796
  */
18
1797
  this.options = [];
1798
+ /**
1799
+ * Options to pass to the fuse.js instance.
1800
+ * See https://fusejs.io/api/options.html for valid options
1801
+ */
1802
+ this.parameters = {
1803
+ keys: ["value", "label"],
1804
+ threshold: 0.3,
1805
+ ignoreLocation: true,
1806
+ };
19
1807
  /**
20
1808
  * If `false`, the user can submit custom value
21
1809
  */
@@ -23,6 +1811,10 @@ let SelectFilter = class {
23
1811
  this.onClick = (value, label) => {
24
1812
  this.el.querySelector('road-input').value = label;
25
1813
  this.isOpen = false;
1814
+ this.roadselected.emit({
1815
+ value: value.toString(),
1816
+ label: label,
1817
+ });
26
1818
  this.roadSelected.emit({
27
1819
  value: value.toString(),
28
1820
  label: label,
@@ -38,14 +1830,17 @@ let SelectFilter = class {
38
1830
  onClickOutside(event) {
39
1831
  if (this.isOpen && !this.el.contains(event.target)) {
40
1832
  this.isOpen = false;
41
- if (this.onlySelect) {
1833
+ const value = this.el.querySelector('road-input').value;
1834
+ if (this.onlySelect && !this.options.some(option => option['label'] === value)) {
42
1835
  this.el.querySelector('road-input').value = '';
43
1836
  }
44
1837
  }
45
1838
  }
46
1839
  render() {
1840
+ const fuseSearch = new Fuse(this.options, this.parameters);
1841
+ const options = this.currentValue === '' ? this.options.map((doc, idx) => ({ item: doc, score: 1, refIndex: idx })) : fuseSearch.search(this.currentValue);
47
1842
  return (index.h(index.Host, null, index.h("slot", null), this.isOpen &&
48
- index.h("ul", { class: "select-filter-list", role: "listbox" }, this.options && this.options.filter(element => element.label.replace(/(<([^>]+)>)/gi, "").toLowerCase().indexOf(this.currentValue) > -1).map(option => (index.h("li", { class: "select-filter-item", role: "option", onClick: () => this.onClick(option.value, option.label.replace(/(<([^>]+)>)/gi, "")), innerHTML: option.label }))))));
1843
+ index.h("ul", { class: "select-filter-list", role: "listbox" }, options.map(option => (index.h("li", { class: "select-filter-item", role: "option", onClick: () => this.onClick(option.item.value, option.item.label.replace(/(<([^>]+)>)/gi, "")), innerHTML: option.item.label }))))));
49
1844
  }
50
1845
  get el() { return index.getElement(this); }
51
1846
  };