@nikala-ui/docs 0.12.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 (463) hide show
  1. package/README.md +22 -0
  2. package/dist/cli/commands/build.d.ts +5 -0
  3. package/dist/cli/commands/build.d.ts.map +1 -0
  4. package/dist/cli/commands/build.js +27 -0
  5. package/dist/cli/commands/build.js.map +1 -0
  6. package/dist/cli/commands/dev.d.ts +7 -0
  7. package/dist/cli/commands/dev.d.ts.map +1 -0
  8. package/dist/cli/commands/dev.js +32 -0
  9. package/dist/cli/commands/dev.js.map +1 -0
  10. package/dist/cli/commands/init.d.ts +2 -0
  11. package/dist/cli/commands/init.d.ts.map +1 -0
  12. package/dist/cli/commands/init.js +308 -0
  13. package/dist/cli/commands/init.js.map +1 -0
  14. package/dist/cli/commands/preview.d.ts +7 -0
  15. package/dist/cli/commands/preview.d.ts.map +1 -0
  16. package/dist/cli/commands/preview.js +24 -0
  17. package/dist/cli/commands/preview.js.map +1 -0
  18. package/dist/cli/commands/serve.d.ts +7 -0
  19. package/dist/cli/commands/serve.d.ts.map +1 -0
  20. package/dist/cli/commands/serve.js +33 -0
  21. package/dist/cli/commands/serve.js.map +1 -0
  22. package/dist/cli/index.d.ts +3 -0
  23. package/dist/cli/index.d.ts.map +1 -0
  24. package/dist/cli/index.js +53 -0
  25. package/dist/cli/index.js.map +1 -0
  26. package/dist/client/App.d.ts +5 -0
  27. package/dist/client/App.d.ts.map +1 -0
  28. package/dist/client/App.jsx +31 -0
  29. package/dist/client/App.jsx.map +1 -0
  30. package/dist/client/app-types.d.ts +14 -0
  31. package/dist/client/app-types.d.ts.map +1 -0
  32. package/dist/client/app-types.js +2 -0
  33. package/dist/client/app-types.js.map +1 -0
  34. package/dist/client/components/DocsLayoutShell.d.ts +21 -0
  35. package/dist/client/components/DocsLayoutShell.d.ts.map +1 -0
  36. package/dist/client/components/DocsLayoutShell.jsx +14 -0
  37. package/dist/client/components/DocsLayoutShell.jsx.map +1 -0
  38. package/dist/client/components/DocsPageContent.d.ts +9 -0
  39. package/dist/client/components/DocsPageContent.d.ts.map +1 -0
  40. package/dist/client/components/DocsPageContent.jsx +10 -0
  41. package/dist/client/components/DocsPageContent.jsx.map +1 -0
  42. package/dist/client/entry.d.ts +2 -0
  43. package/dist/client/entry.d.ts.map +1 -0
  44. package/dist/client/entry.jsx +28 -0
  45. package/dist/client/entry.jsx.map +1 -0
  46. package/dist/client/index.html +21 -0
  47. package/dist/client/navigation/page-navigation.d.ts +9 -0
  48. package/dist/client/navigation/page-navigation.d.ts.map +1 -0
  49. package/dist/client/navigation/page-navigation.js +51 -0
  50. package/dist/client/navigation/page-navigation.js.map +1 -0
  51. package/dist/client/routing/use-docs-router.d.ts +17 -0
  52. package/dist/client/routing/use-docs-router.d.ts.map +1 -0
  53. package/dist/client/routing/use-docs-router.js +71 -0
  54. package/dist/client/routing/use-docs-router.js.map +1 -0
  55. package/dist/client/ssr-entry.d.ts +3 -0
  56. package/dist/client/ssr-entry.d.ts.map +1 -0
  57. package/dist/client/ssr-entry.jsx +13 -0
  58. package/dist/client/ssr-entry.jsx.map +1 -0
  59. package/dist/client/style.css +183 -0
  60. package/dist/client/utils/sidebar.d.ts +2 -0
  61. package/dist/client/utils/sidebar.d.ts.map +1 -0
  62. package/dist/client/utils/sidebar.js +2 -0
  63. package/dist/client/utils/sidebar.js.map +1 -0
  64. package/dist/components/mdx-components.d.ts +34 -0
  65. package/dist/components/mdx-components.d.ts.map +1 -0
  66. package/dist/components/mdx-components.jsx +131 -0
  67. package/dist/components/mdx-components.jsx.map +1 -0
  68. package/dist/config.d.ts +6 -0
  69. package/dist/config.d.ts.map +1 -0
  70. package/dist/config.js +105 -0
  71. package/dist/config.js.map +1 -0
  72. package/dist/core/content-scanner.d.ts +10 -0
  73. package/dist/core/content-scanner.d.ts.map +1 -0
  74. package/dist/core/content-scanner.js +153 -0
  75. package/dist/core/content-scanner.js.map +1 -0
  76. package/dist/core/route-tree.d.ts +19 -0
  77. package/dist/core/route-tree.d.ts.map +1 -0
  78. package/dist/core/route-tree.js +176 -0
  79. package/dist/core/route-tree.js.map +1 -0
  80. package/dist/index.d.ts +13 -0
  81. package/dist/index.d.ts.map +1 -0
  82. package/dist/index.js +14 -0
  83. package/dist/index.js.map +1 -0
  84. package/dist/lib/cn.d.ts +6 -0
  85. package/dist/lib/cn.d.ts.map +1 -0
  86. package/dist/lib/cn.js +9 -0
  87. package/dist/lib/cn.js.map +1 -0
  88. package/dist/mdx/compiler.d.ts +13 -0
  89. package/dist/mdx/compiler.d.ts.map +1 -0
  90. package/dist/mdx/compiler.js +38 -0
  91. package/dist/mdx/compiler.js.map +1 -0
  92. package/dist/mdx/highlighter.d.ts +22 -0
  93. package/dist/mdx/highlighter.d.ts.map +1 -0
  94. package/dist/mdx/highlighter.js +139 -0
  95. package/dist/mdx/highlighter.js.map +1 -0
  96. package/dist/mdx/rehype-shiki.d.ts +3 -0
  97. package/dist/mdx/rehype-shiki.d.ts.map +1 -0
  98. package/dist/mdx/rehype-shiki.js +83 -0
  99. package/dist/mdx/rehype-shiki.js.map +1 -0
  100. package/dist/navigation/index.d.ts +2 -0
  101. package/dist/navigation/index.d.ts.map +1 -0
  102. package/dist/navigation/index.js +2 -0
  103. package/dist/navigation/index.js.map +1 -0
  104. package/dist/navigation/sidebar-state.d.ts +6 -0
  105. package/dist/navigation/sidebar-state.d.ts.map +1 -0
  106. package/dist/navigation/sidebar-state.js +20 -0
  107. package/dist/navigation/sidebar-state.js.map +1 -0
  108. package/dist/navigation/sidebar-tree.d.ts +7 -0
  109. package/dist/navigation/sidebar-tree.d.ts.map +1 -0
  110. package/dist/navigation/sidebar-tree.js +11 -0
  111. package/dist/navigation/sidebar-tree.js.map +1 -0
  112. package/dist/registry/accordion.json +18 -0
  113. package/dist/registry/alert.json +18 -0
  114. package/dist/registry/api-table.json +21 -0
  115. package/dist/registry/aspect-ratio.json +17 -0
  116. package/dist/registry/avatar.json +17 -0
  117. package/dist/registry/badge.json +18 -0
  118. package/dist/registry/banner.json +19 -0
  119. package/dist/registry/breadcrumb.json +17 -0
  120. package/dist/registry/bubble.json +18 -0
  121. package/dist/registry/button-group.json +20 -0
  122. package/dist/registry/button.json +21 -0
  123. package/dist/registry/callout.json +19 -0
  124. package/dist/registry/card.json +17 -0
  125. package/dist/registry/checkbox.json +20 -0
  126. package/dist/registry/code-block.json +26 -0
  127. package/dist/registry/code-group.json +20 -0
  128. package/dist/registry/collapsible.json +18 -0
  129. package/dist/registry/combobox.json +21 -0
  130. package/dist/registry/command.json +27 -0
  131. package/dist/registry/component-viewer.json +25 -0
  132. package/dist/registry/container.json +18 -0
  133. package/dist/registry/context-menu.json +24 -0
  134. package/dist/registry/create-active-element.json +13 -0
  135. package/dist/registry/create-app-updater.json +13 -0
  136. package/dist/registry/create-audio.json +7 -0
  137. package/dist/registry/create-battery.json +13 -0
  138. package/dist/registry/create-chat-scroll.json +13 -0
  139. package/dist/registry/create-click-outside.json +13 -0
  140. package/dist/registry/create-clipboard.json +13 -0
  141. package/dist/registry/create-color-mode.json +13 -0
  142. package/dist/registry/create-controllable-signal.json +13 -0
  143. package/dist/registry/create-debounce.json +13 -0
  144. package/dist/registry/create-disclosure.json +13 -0
  145. package/dist/registry/create-document-tabs.json +13 -0
  146. package/dist/registry/create-document-title.json +13 -0
  147. package/dist/registry/create-drop-zone.json +13 -0
  148. package/dist/registry/create-event-source.json +13 -0
  149. package/dist/registry/create-favicon.json +13 -0
  150. package/dist/registry/create-fetch.json +13 -0
  151. package/dist/registry/create-focus-trap.json +13 -0
  152. package/dist/registry/create-form.json +13 -0
  153. package/dist/registry/create-fullscreen.json +13 -0
  154. package/dist/registry/create-geolocation.json +13 -0
  155. package/dist/registry/create-global-shortcut.json +13 -0
  156. package/dist/registry/create-hover.json +13 -0
  157. package/dist/registry/create-idle.json +13 -0
  158. package/dist/registry/create-infinite-scroll.json +13 -0
  159. package/dist/registry/create-input-mask.json +13 -0
  160. package/dist/registry/create-intersection-observer.json +13 -0
  161. package/dist/registry/create-keybindings.json +13 -0
  162. package/dist/registry/create-lock-scroll.json +13 -0
  163. package/dist/registry/create-long-press.json +13 -0
  164. package/dist/registry/create-media-query.json +13 -0
  165. package/dist/registry/create-mouse-position.json +13 -0
  166. package/dist/registry/create-network-status.json +13 -0
  167. package/dist/registry/create-orientation.json +13 -0
  168. package/dist/registry/create-pagination.json +13 -0
  169. package/dist/registry/create-permission.json +13 -0
  170. package/dist/registry/create-previous.json +13 -0
  171. package/dist/registry/create-resize-observer.json +13 -0
  172. package/dist/registry/create-scroll-into-view.json +13 -0
  173. package/dist/registry/create-scroll-position.json +13 -0
  174. package/dist/registry/create-storage.json +13 -0
  175. package/dist/registry/create-tauri-window.json +13 -0
  176. package/dist/registry/create-timer.json +13 -0
  177. package/dist/registry/create-tiptap-editor.json +34 -0
  178. package/dist/registry/create-undo-redo.json +13 -0
  179. package/dist/registry/create-web-notification.json +13 -0
  180. package/dist/registry/create-websocket.json +13 -0
  181. package/dist/registry/create-window-size.json +13 -0
  182. package/dist/registry/dialog.json +21 -0
  183. package/dist/registry/dropdown-menu.json +22 -0
  184. package/dist/registry/dropzone.json +21 -0
  185. package/dist/registry/empty.json +17 -0
  186. package/dist/registry/field.json +20 -0
  187. package/dist/registry/file-tree.json +21 -0
  188. package/dist/registry/footer.json +18 -0
  189. package/dist/registry/forgot-password-01.json +28 -0
  190. package/dist/registry/form-message.json +17 -0
  191. package/dist/registry/form.json +17 -0
  192. package/dist/registry/hero-01.json +22 -0
  193. package/dist/registry/hover-card.json +18 -0
  194. package/dist/registry/icon-button.json +20 -0
  195. package/dist/registry/index.json +1489 -0
  196. package/dist/registry/input-group.json +21 -0
  197. package/dist/registry/input.json +17 -0
  198. package/dist/registry/kbd.json +18 -0
  199. package/dist/registry/label.json +18 -0
  200. package/dist/registry/list.json +20 -0
  201. package/dist/registry/login-01.json +28 -0
  202. package/dist/registry/logo.json +17 -0
  203. package/dist/registry/marker.json +17 -0
  204. package/dist/registry/marquee.json +17 -0
  205. package/dist/registry/message.json +17 -0
  206. package/dist/registry/navbar.json +19 -0
  207. package/dist/registry/navigation-menu.json +22 -0
  208. package/dist/registry/number-input.json +24 -0
  209. package/dist/registry/otp-verification-01.json +26 -0
  210. package/dist/registry/package-manager-tabs.json +24 -0
  211. package/dist/registry/pager.json +21 -0
  212. package/dist/registry/pagination.json +22 -0
  213. package/dist/registry/pin-input.json +17 -0
  214. package/dist/registry/popover.json +22 -0
  215. package/dist/registry/progress.json +18 -0
  216. package/dist/registry/radio-group.json +18 -0
  217. package/dist/registry/rating.json +19 -0
  218. package/dist/registry/register-01.json +31 -0
  219. package/dist/registry/resizable.json +21 -0
  220. package/dist/registry/review-card.json +23 -0
  221. package/dist/registry/rich-text-editor.json +95 -0
  222. package/dist/registry/scroll-area.json +21 -0
  223. package/dist/registry/section-heading.json +21 -0
  224. package/dist/registry/select.json +22 -0
  225. package/dist/registry/separator.json +17 -0
  226. package/dist/registry/sheet.json +22 -0
  227. package/dist/registry/sidebar.json +24 -0
  228. package/dist/registry/skeleton.json +17 -0
  229. package/dist/registry/slider.json +18 -0
  230. package/dist/registry/spinner.json +18 -0
  231. package/dist/registry/stat.json +19 -0
  232. package/dist/registry/status.json +18 -0
  233. package/dist/registry/steps.json +20 -0
  234. package/dist/registry/switch.json +20 -0
  235. package/dist/registry/table-of-contents.json +23 -0
  236. package/dist/registry/table.json +17 -0
  237. package/dist/registry/tabs.json +20 -0
  238. package/dist/registry/textarea.json +17 -0
  239. package/dist/registry/theme-manager.json +39 -0
  240. package/dist/registry/timeline.json +18 -0
  241. package/dist/registry/titlebar-tabs.json +24 -0
  242. package/dist/registry/titlebar.json +26 -0
  243. package/dist/registry/toast.json +20 -0
  244. package/dist/registry/toggle-group.json +21 -0
  245. package/dist/registry/toggle.json +18 -0
  246. package/dist/registry/tooltip.json +18 -0
  247. package/dist/registry/updater-modal.json +26 -0
  248. package/dist/server/index.d.ts +18 -0
  249. package/dist/server/index.d.ts.map +1 -0
  250. package/dist/server/index.js +526 -0
  251. package/dist/server/index.js.map +1 -0
  252. package/dist/server/plugin.d.ts +10 -0
  253. package/dist/server/plugin.d.ts.map +1 -0
  254. package/dist/server/plugin.js +271 -0
  255. package/dist/server/plugin.js.map +1 -0
  256. package/dist/themes/default/content/breadcrumbs.d.ts +4 -0
  257. package/dist/themes/default/content/breadcrumbs.d.ts.map +1 -0
  258. package/dist/themes/default/content/breadcrumbs.jsx +31 -0
  259. package/dist/themes/default/content/breadcrumbs.jsx.map +1 -0
  260. package/dist/themes/default/content/pager.d.ts +5 -0
  261. package/dist/themes/default/content/pager.d.ts.map +1 -0
  262. package/dist/themes/default/content/pager.jsx +9 -0
  263. package/dist/themes/default/content/pager.jsx.map +1 -0
  264. package/dist/themes/default/content/table-of-contents.d.ts +4 -0
  265. package/dist/themes/default/content/table-of-contents.d.ts.map +1 -0
  266. package/dist/themes/default/content/table-of-contents.jsx +19 -0
  267. package/dist/themes/default/content/table-of-contents.jsx.map +1 -0
  268. package/dist/themes/default/index.d.ts +11 -0
  269. package/dist/themes/default/index.d.ts.map +1 -0
  270. package/dist/themes/default/index.js +30 -0
  271. package/dist/themes/default/index.js.map +1 -0
  272. package/dist/themes/default/layout.d.ts +4 -0
  273. package/dist/themes/default/layout.d.ts.map +1 -0
  274. package/dist/themes/default/layout.jsx +75 -0
  275. package/dist/themes/default/layout.jsx.map +1 -0
  276. package/dist/themes/default/navbar.d.ts +4 -0
  277. package/dist/themes/default/navbar.d.ts.map +1 -0
  278. package/dist/themes/default/navbar.jsx +74 -0
  279. package/dist/themes/default/navbar.jsx.map +1 -0
  280. package/dist/themes/default/navigation/mobile-table-of-contents.d.ts +4 -0
  281. package/dist/themes/default/navigation/mobile-table-of-contents.d.ts.map +1 -0
  282. package/dist/themes/default/navigation/mobile-table-of-contents.jsx +22 -0
  283. package/dist/themes/default/navigation/mobile-table-of-contents.jsx.map +1 -0
  284. package/dist/themes/default/navigation/sidebar-tree.d.ts +8 -0
  285. package/dist/themes/default/navigation/sidebar-tree.d.ts.map +1 -0
  286. package/dist/themes/default/navigation/sidebar-tree.jsx +100 -0
  287. package/dist/themes/default/navigation/sidebar-tree.jsx.map +1 -0
  288. package/dist/themes/default/overlays/search-dialog.d.ts +4 -0
  289. package/dist/themes/default/overlays/search-dialog.d.ts.map +1 -0
  290. package/dist/themes/default/overlays/search-dialog.jsx +34 -0
  291. package/dist/themes/default/overlays/search-dialog.jsx.map +1 -0
  292. package/dist/themes/default/sidebar.d.ts +4 -0
  293. package/dist/themes/default/sidebar.d.ts.map +1 -0
  294. package/dist/themes/default/sidebar.jsx +60 -0
  295. package/dist/themes/default/sidebar.jsx.map +1 -0
  296. package/dist/themes/index.d.ts +4 -0
  297. package/dist/themes/index.d.ts.map +1 -0
  298. package/dist/themes/index.js +5 -0
  299. package/dist/themes/index.js.map +1 -0
  300. package/dist/themes/types.d.ts +83 -0
  301. package/dist/themes/types.d.ts.map +1 -0
  302. package/dist/themes/types.js +2 -0
  303. package/dist/themes/types.js.map +1 -0
  304. package/dist/types.d.ts +97 -0
  305. package/dist/types.d.ts.map +1 -0
  306. package/dist/types.js +3 -0
  307. package/dist/types.js.map +1 -0
  308. package/dist/vendor/core-src/index.css +11 -0
  309. package/dist/vendor/core-src/index.ts +48 -0
  310. package/dist/vendor/core-src/lib/cn.ts +9 -0
  311. package/dist/vendor/core-src/registry/blocks/forgot-password-01.tsx +141 -0
  312. package/dist/vendor/core-src/registry/blocks/hero-01.tsx +28 -0
  313. package/dist/vendor/core-src/registry/blocks/login-01.tsx +231 -0
  314. package/dist/vendor/core-src/registry/blocks/otp-verification-01.tsx +170 -0
  315. package/dist/vendor/core-src/registry/blocks/register-01.tsx +318 -0
  316. package/dist/vendor/core-src/registry/components/ui/accordion.tsx +128 -0
  317. package/dist/vendor/core-src/registry/components/ui/alert.tsx +155 -0
  318. package/dist/vendor/core-src/registry/components/ui/api-table.tsx +117 -0
  319. package/dist/vendor/core-src/registry/components/ui/aspect-ratio.tsx +31 -0
  320. package/dist/vendor/core-src/registry/components/ui/avatar.tsx +114 -0
  321. package/dist/vendor/core-src/registry/components/ui/badge.tsx +56 -0
  322. package/dist/vendor/core-src/registry/components/ui/banner.tsx +187 -0
  323. package/dist/vendor/core-src/registry/components/ui/breadcrumb.tsx +136 -0
  324. package/dist/vendor/core-src/registry/components/ui/bubble.tsx +142 -0
  325. package/dist/vendor/core-src/registry/components/ui/button-group.tsx +42 -0
  326. package/dist/vendor/core-src/registry/components/ui/button.tsx +82 -0
  327. package/dist/vendor/core-src/registry/components/ui/callout.tsx +137 -0
  328. package/dist/vendor/core-src/registry/components/ui/card.tsx +113 -0
  329. package/dist/vendor/core-src/registry/components/ui/checkbox.tsx +74 -0
  330. package/dist/vendor/core-src/registry/components/ui/code-block.tsx +326 -0
  331. package/dist/vendor/core-src/registry/components/ui/code-group.tsx +105 -0
  332. package/dist/vendor/core-src/registry/components/ui/collapsible.tsx +73 -0
  333. package/dist/vendor/core-src/registry/components/ui/combobox.tsx +299 -0
  334. package/dist/vendor/core-src/registry/components/ui/command.tsx +378 -0
  335. package/dist/vendor/core-src/registry/components/ui/component-viewer.tsx +363 -0
  336. package/dist/vendor/core-src/registry/components/ui/container.tsx +45 -0
  337. package/dist/vendor/core-src/registry/components/ui/context-menu.tsx +237 -0
  338. package/dist/vendor/core-src/registry/components/ui/dialog.tsx +200 -0
  339. package/dist/vendor/core-src/registry/components/ui/dropdown-menu.tsx +298 -0
  340. package/dist/vendor/core-src/registry/components/ui/dropzone.tsx +189 -0
  341. package/dist/vendor/core-src/registry/components/ui/empty.tsx +83 -0
  342. package/dist/vendor/core-src/registry/components/ui/field.tsx +71 -0
  343. package/dist/vendor/core-src/registry/components/ui/file-tree.tsx +181 -0
  344. package/dist/vendor/core-src/registry/components/ui/footer.tsx +247 -0
  345. package/dist/vendor/core-src/registry/components/ui/form-message.tsx +36 -0
  346. package/dist/vendor/core-src/registry/components/ui/form.tsx +21 -0
  347. package/dist/vendor/core-src/registry/components/ui/hover-card.tsx +105 -0
  348. package/dist/vendor/core-src/registry/components/ui/icon-button.tsx +34 -0
  349. package/dist/vendor/core-src/registry/components/ui/input-group.tsx +80 -0
  350. package/dist/vendor/core-src/registry/components/ui/input.tsx +28 -0
  351. package/dist/vendor/core-src/registry/components/ui/kbd.tsx +73 -0
  352. package/dist/vendor/core-src/registry/components/ui/label.tsx +30 -0
  353. package/dist/vendor/core-src/registry/components/ui/list.tsx +222 -0
  354. package/dist/vendor/core-src/registry/components/ui/logo.tsx +68 -0
  355. package/dist/vendor/core-src/registry/components/ui/marker.tsx +102 -0
  356. package/dist/vendor/core-src/registry/components/ui/marquee.tsx +118 -0
  357. package/dist/vendor/core-src/registry/components/ui/message.tsx +168 -0
  358. package/dist/vendor/core-src/registry/components/ui/navbar.tsx +375 -0
  359. package/dist/vendor/core-src/registry/components/ui/navigation-menu.tsx +358 -0
  360. package/dist/vendor/core-src/registry/components/ui/number-input.tsx +150 -0
  361. package/dist/vendor/core-src/registry/components/ui/package-manager-tabs.tsx +226 -0
  362. package/dist/vendor/core-src/registry/components/ui/pager.tsx +102 -0
  363. package/dist/vendor/core-src/registry/components/ui/pagination.tsx +258 -0
  364. package/dist/vendor/core-src/registry/components/ui/pin-input.tsx +198 -0
  365. package/dist/vendor/core-src/registry/components/ui/popover.tsx +90 -0
  366. package/dist/vendor/core-src/registry/components/ui/progress.tsx +66 -0
  367. package/dist/vendor/core-src/registry/components/ui/radio-group.tsx +95 -0
  368. package/dist/vendor/core-src/registry/components/ui/rating.tsx +185 -0
  369. package/dist/vendor/core-src/registry/components/ui/resizable.tsx +195 -0
  370. package/dist/vendor/core-src/registry/components/ui/review-card.tsx +195 -0
  371. package/dist/vendor/core-src/registry/components/ui/rich-text-editor/bubble-menu.tsx +236 -0
  372. package/dist/vendor/core-src/registry/components/ui/rich-text-editor/editor.tsx +308 -0
  373. package/dist/vendor/core-src/registry/components/ui/rich-text-editor/extensions.ts +116 -0
  374. package/dist/vendor/core-src/registry/components/ui/rich-text-editor/footer.tsx +36 -0
  375. package/dist/vendor/core-src/registry/components/ui/rich-text-editor/image-dialog.tsx +75 -0
  376. package/dist/vendor/core-src/registry/components/ui/rich-text-editor/index.ts +11 -0
  377. package/dist/vendor/core-src/registry/components/ui/rich-text-editor/link-dialog.tsx +48 -0
  378. package/dist/vendor/core-src/registry/components/ui/rich-text-editor/markdown.ts +170 -0
  379. package/dist/vendor/core-src/registry/components/ui/rich-text-editor/slash-command.tsx +301 -0
  380. package/dist/vendor/core-src/registry/components/ui/rich-text-editor/table-controls.tsx +68 -0
  381. package/dist/vendor/core-src/registry/components/ui/rich-text-editor/toolbar.tsx +465 -0
  382. package/dist/vendor/core-src/registry/components/ui/rich-text-editor/use-editor.ts +231 -0
  383. package/dist/vendor/core-src/registry/components/ui/scroll-area.tsx +228 -0
  384. package/dist/vendor/core-src/registry/components/ui/section-heading.tsx +108 -0
  385. package/dist/vendor/core-src/registry/components/ui/select.tsx +156 -0
  386. package/dist/vendor/core-src/registry/components/ui/separator.tsx +37 -0
  387. package/dist/vendor/core-src/registry/components/ui/sheet.tsx +220 -0
  388. package/dist/vendor/core-src/registry/components/ui/sidebar.tsx +692 -0
  389. package/dist/vendor/core-src/registry/components/ui/skeleton.tsx +24 -0
  390. package/dist/vendor/core-src/registry/components/ui/slider.tsx +153 -0
  391. package/dist/vendor/core-src/registry/components/ui/spinner.tsx +41 -0
  392. package/dist/vendor/core-src/registry/components/ui/stat.tsx +245 -0
  393. package/dist/vendor/core-src/registry/components/ui/status.tsx +121 -0
  394. package/dist/vendor/core-src/registry/components/ui/steps.tsx +198 -0
  395. package/dist/vendor/core-src/registry/components/ui/switch.tsx +68 -0
  396. package/dist/vendor/core-src/registry/components/ui/table-of-contents.tsx +131 -0
  397. package/dist/vendor/core-src/registry/components/ui/table.tsx +160 -0
  398. package/dist/vendor/core-src/registry/components/ui/tabs.tsx +204 -0
  399. package/dist/vendor/core-src/registry/components/ui/textarea.tsx +82 -0
  400. package/dist/vendor/core-src/registry/components/ui/theme-toggle.tsx +238 -0
  401. package/dist/vendor/core-src/registry/components/ui/timeline.tsx +350 -0
  402. package/dist/vendor/core-src/registry/components/ui/titlebar-tabs.tsx +773 -0
  403. package/dist/vendor/core-src/registry/components/ui/titlebar.tsx +468 -0
  404. package/dist/vendor/core-src/registry/components/ui/toast.tsx +124 -0
  405. package/dist/vendor/core-src/registry/components/ui/toggle-group.tsx +203 -0
  406. package/dist/vendor/core-src/registry/components/ui/toggle.tsx +101 -0
  407. package/dist/vendor/core-src/registry/components/ui/tooltip.tsx +41 -0
  408. package/dist/vendor/core-src/registry/components/ui/updater-modal.tsx +254 -0
  409. package/dist/vendor/core-src/registry/index.ts +50 -0
  410. package/dist/vendor/core-src/registry/metadata.ts +742 -0
  411. package/dist/vendor/core-src/registry/providers/theme-provider.tsx +216 -0
  412. package/dist/vendor/core-src/registry/providers/theme-script.tsx +78 -0
  413. package/dist/vendor/core-src/registry/providers/theme-transitions.ts +139 -0
  414. package/dist/vendor/hooks-src/create-active-element.ts +51 -0
  415. package/dist/vendor/hooks-src/create-app-updater.ts +272 -0
  416. package/dist/vendor/hooks-src/create-audio-video.ts +444 -0
  417. package/dist/vendor/hooks-src/create-battery.ts +78 -0
  418. package/dist/vendor/hooks-src/create-chat-scroll.ts +113 -0
  419. package/dist/vendor/hooks-src/create-click-outside.ts +82 -0
  420. package/dist/vendor/hooks-src/create-clipboard.ts +69 -0
  421. package/dist/vendor/hooks-src/create-color-mode.ts +115 -0
  422. package/dist/vendor/hooks-src/create-controllable-signal.ts +56 -0
  423. package/dist/vendor/hooks-src/create-debounce.ts +90 -0
  424. package/dist/vendor/hooks-src/create-disclosure.ts +82 -0
  425. package/dist/vendor/hooks-src/create-document-tabs.ts +267 -0
  426. package/dist/vendor/hooks-src/create-document-title.ts +33 -0
  427. package/dist/vendor/hooks-src/create-drop-zone.ts +317 -0
  428. package/dist/vendor/hooks-src/create-event-source.ts +126 -0
  429. package/dist/vendor/hooks-src/create-favicon.ts +52 -0
  430. package/dist/vendor/hooks-src/create-fetch.ts +93 -0
  431. package/dist/vendor/hooks-src/create-focus-trap.ts +94 -0
  432. package/dist/vendor/hooks-src/create-form.ts +200 -0
  433. package/dist/vendor/hooks-src/create-fullscreen.ts +105 -0
  434. package/dist/vendor/hooks-src/create-geolocation.ts +140 -0
  435. package/dist/vendor/hooks-src/create-global-shortcut.ts +140 -0
  436. package/dist/vendor/hooks-src/create-hover.ts +88 -0
  437. package/dist/vendor/hooks-src/create-idle.ts +109 -0
  438. package/dist/vendor/hooks-src/create-infinite-scroll.ts +90 -0
  439. package/dist/vendor/hooks-src/create-input-mask.ts +109 -0
  440. package/dist/vendor/hooks-src/create-intersection-observer.ts +82 -0
  441. package/dist/vendor/hooks-src/create-keybindings.ts +148 -0
  442. package/dist/vendor/hooks-src/create-lock-scroll.ts +97 -0
  443. package/dist/vendor/hooks-src/create-long-press.ts +85 -0
  444. package/dist/vendor/hooks-src/create-media-query.ts +94 -0
  445. package/dist/vendor/hooks-src/create-mouse-position.ts +87 -0
  446. package/dist/vendor/hooks-src/create-network-status.ts +100 -0
  447. package/dist/vendor/hooks-src/create-orientation.ts +129 -0
  448. package/dist/vendor/hooks-src/create-pagination.ts +208 -0
  449. package/dist/vendor/hooks-src/create-permission.ts +91 -0
  450. package/dist/vendor/hooks-src/create-previous.ts +21 -0
  451. package/dist/vendor/hooks-src/create-resize-observer.ts +89 -0
  452. package/dist/vendor/hooks-src/create-scroll-into-view.ts +57 -0
  453. package/dist/vendor/hooks-src/create-scroll-position.ts +129 -0
  454. package/dist/vendor/hooks-src/create-storage.ts +106 -0
  455. package/dist/vendor/hooks-src/create-tauri-window.ts +628 -0
  456. package/dist/vendor/hooks-src/create-timer.ts +150 -0
  457. package/dist/vendor/hooks-src/create-tiptap-editor.ts +326 -0
  458. package/dist/vendor/hooks-src/create-undo-redo.ts +100 -0
  459. package/dist/vendor/hooks-src/create-web-notification.ts +111 -0
  460. package/dist/vendor/hooks-src/create-websocket.ts +179 -0
  461. package/dist/vendor/hooks-src/create-window-size.ts +41 -0
  462. package/dist/vendor/hooks-src/index.ts +48 -0
  463. package/package.json +87 -0
@@ -0,0 +1,140 @@
1
+ import { createSignal, createEffect, onCleanup, type Accessor } from "solid-js";
2
+
3
+ export interface CreateGeolocationOptions extends PositionOptions {
4
+ /** Whether to start watching position immediately upon primitive initialization. Defaults to true. */
5
+ immediate?: boolean;
6
+ }
7
+
8
+ export interface GeolocationState {
9
+ /** Current latitude coordinate in degrees. */
10
+ latitude: number | null;
11
+ /** Current longitude coordinate in degrees. */
12
+ longitude: number | null;
13
+ /** Current altitude above sea level in meters. */
14
+ altitude: number | null;
15
+ /** Position accuracy level in meters. */
16
+ accuracy: number | null;
17
+ /** Altitude accuracy in meters. */
18
+ altitudeAccuracy: number | null;
19
+ /** Current heading direction in degrees relative to true north. */
20
+ heading: number | null;
21
+ /** Current speed in meters per second. */
22
+ speed: number | null;
23
+ /** Timestamp when location was captured. */
24
+ timestamp: number | null;
25
+ }
26
+
27
+ export interface CreateGeolocationReturn {
28
+ /** Signal accessor containing current geolocation coordinates and metrics. */
29
+ coords: Accessor<GeolocationState>;
30
+ /** Signal accessor indicating whether position retrieval is in progress. */
31
+ loading: Accessor<boolean>;
32
+ /** Signal accessor containing GeolocationPositionError if request failed. */
33
+ error: Accessor<GeolocationPositionError | Error | null>;
34
+ /** Signal accessor indicating whether Geolocation API is supported in browser environment. */
35
+ isSupported: Accessor<boolean>;
36
+ /** Imperative function to fetch current position once. */
37
+ getCurrentPosition: () => void;
38
+ }
39
+
40
+ const initialCoords: GeolocationState = {
41
+ latitude: null,
42
+ longitude: null,
43
+ altitude: null,
44
+ accuracy: null,
45
+ altitudeAccuracy: null,
46
+ heading: null,
47
+ speed: null,
48
+ timestamp: null,
49
+ };
50
+
51
+ /**
52
+ * SolidJS reactive primitive for tracking user geographic location and GPS metrics.
53
+ */
54
+ export function createGeolocation(
55
+ options: CreateGeolocationOptions = {}
56
+ ): CreateGeolocationReturn {
57
+ const [coords, setCoords] = createSignal<GeolocationState>(initialCoords);
58
+ const [loading, setLoading] = createSignal(false);
59
+ const [error, setError] = createSignal<GeolocationPositionError | Error | null>(null);
60
+
61
+ const isSupported = (): boolean => {
62
+ if (typeof window === "undefined" || typeof navigator === "undefined") return false;
63
+ return "geolocation" in navigator;
64
+ };
65
+
66
+ const getOptions = (): PositionOptions => ({
67
+ timeout: options.timeout ?? 10000,
68
+ maximumAge: options.maximumAge ?? 5000,
69
+ enableHighAccuracy: options.enableHighAccuracy ?? false,
70
+ });
71
+
72
+ let watchId: number | null = null;
73
+
74
+ const updatePosition = (position: GeolocationPosition): void => {
75
+ setCoords({
76
+ latitude: position.coords.latitude,
77
+ longitude: position.coords.longitude,
78
+ altitude: position.coords.altitude,
79
+ accuracy: position.coords.accuracy,
80
+ altitudeAccuracy: position.coords.altitudeAccuracy,
81
+ heading: position.coords.heading,
82
+ speed: position.coords.speed,
83
+ timestamp: position.timestamp,
84
+ });
85
+ setLoading(false);
86
+ setError(null);
87
+ };
88
+
89
+ const handleError = (err: GeolocationPositionError): void => {
90
+ setError(err);
91
+ setLoading(false);
92
+ };
93
+
94
+ const getCurrentPosition = (): void => {
95
+ if (!isSupported()) {
96
+ setError(new Error("Geolocation API is not supported in this browser environment."));
97
+ return;
98
+ }
99
+
100
+ setLoading(true);
101
+ setError(null);
102
+
103
+ navigator.geolocation.getCurrentPosition(
104
+ (pos) => {
105
+ updatePosition(pos);
106
+ },
107
+ (err) => {
108
+ handleError(err);
109
+ },
110
+ getOptions()
111
+ );
112
+ };
113
+
114
+ createEffect(() => {
115
+ if (!isSupported()) return;
116
+
117
+ if (options.immediate ?? true) {
118
+ setLoading(true);
119
+ watchId = navigator.geolocation.watchPosition(
120
+ updatePosition,
121
+ handleError,
122
+ getOptions()
123
+ );
124
+ }
125
+
126
+ onCleanup(() => {
127
+ if (watchId !== null && typeof window !== "undefined" && "geolocation" in navigator) {
128
+ navigator.geolocation.clearWatch(watchId);
129
+ }
130
+ });
131
+ });
132
+
133
+ return {
134
+ coords,
135
+ loading,
136
+ error,
137
+ isSupported,
138
+ getCurrentPosition,
139
+ };
140
+ }
@@ -0,0 +1,140 @@
1
+ import { onMount, onCleanup } from "solid-js";
2
+ import { isTauriEnvironment } from "./create-tauri-window";
3
+
4
+ export interface CreateGlobalShortcutOptions {
5
+ /** Shortcut key combination, e.g. 'CommandOrControl+Shift+P' or 'Alt+Space'. */
6
+ shortcut: string | string[];
7
+ /** Handler invoked when global shortcut is triggered. */
8
+ onTrigger: (shortcut: string) => void;
9
+ /** Automatically register shortcut on mount. Defaults to true. */
10
+ autoRegister?: boolean;
11
+ }
12
+
13
+ export interface CreateGlobalShortcutReturn {
14
+ /** Register the configured global shortcut with Tauri / Browser. */
15
+ register: () => Promise<boolean>;
16
+ /** Unregister the shortcut. */
17
+ unregister: () => Promise<void>;
18
+ /** Indicates whether the shortcut is currently registered. */
19
+ isRegistered: () => boolean;
20
+ }
21
+
22
+ /**
23
+ * SolidJS reactive primitive for registering native OS global hotkeys via Tauri v2 global shortcut plugin,
24
+ * with automatic fallback to browser DOM keyboard listeners.
25
+ */
26
+ export function createGlobalShortcut(
27
+ options: CreateGlobalShortcutOptions
28
+ ): CreateGlobalShortcutReturn {
29
+ let registered = false;
30
+ const shortcuts = Array.isArray(options.shortcut) ? options.shortcut : [options.shortcut];
31
+
32
+ const getTauriShortcutPlugin = async () => {
33
+ if (typeof window === "undefined") return null;
34
+ try {
35
+ if ((window as any).__TAURI__?.globalShortcut) {
36
+ return (window as any).__TAURI__.globalShortcut;
37
+ }
38
+ // Variable prevents Vite dev server from static module resolution
39
+ const moduleName = "@tauri-apps/plugin-global-shortcut";
40
+ // @ts-ignore - Optional runtime dependency in Tauri apps
41
+ const plugin = await import(/* @vite-ignore */ moduleName).catch(() => null);
42
+ return plugin;
43
+ } catch {
44
+ return null;
45
+ }
46
+ };
47
+
48
+ const normalizeKey = (k: string) => {
49
+ const key = k.toLowerCase().trim();
50
+ if (key === " " || key === "space" || key === "spacebar") return "space";
51
+ if (key === "esc" || key === "escape") return "escape";
52
+ if (key === "return" || key === "enter") return "enter";
53
+ return key;
54
+ };
55
+
56
+ const handleBrowserKeydown = (e: KeyboardEvent) => {
57
+ const eventKey = normalizeKey(e.key);
58
+ const eventCode = normalizeKey(e.code.replace(/^Key|^Digit/, ""));
59
+
60
+ for (const keyCombo of shortcuts) {
61
+ const parts = keyCombo.toLowerCase().split("+");
62
+ const hasCtrlOrCmd = parts.includes("commandorcontrol") || parts.includes("ctrl") || parts.includes("cmd");
63
+ const hasShift = parts.includes("shift");
64
+ const hasAlt = parts.includes("alt");
65
+ const mainKey = parts.find((p) => !["commandorcontrol", "ctrl", "cmd", "shift", "alt"].includes(p));
66
+
67
+ const ctrlMatch = hasCtrlOrCmd ? e.ctrlKey || e.metaKey : !e.ctrlKey && !e.metaKey;
68
+ const shiftMatch = hasShift ? e.shiftKey : !e.shiftKey;
69
+ const altMatch = hasAlt ? e.altKey : !e.altKey;
70
+ const keyMatch = mainKey
71
+ ? eventKey === normalizeKey(mainKey) || eventCode === normalizeKey(mainKey)
72
+ : false;
73
+
74
+ if (ctrlMatch && shiftMatch && altMatch && keyMatch) {
75
+ e.preventDefault();
76
+ options.onTrigger(keyCombo);
77
+ break;
78
+ }
79
+ }
80
+ };
81
+
82
+ const register = async (): Promise<boolean> => {
83
+ if (typeof window === "undefined") return false;
84
+
85
+ if (isTauriEnvironment()) {
86
+ const plugin = await getTauriShortcutPlugin();
87
+ if (plugin?.register) {
88
+ try {
89
+ for (const s of shortcuts) {
90
+ await plugin.register(s, () => options.onTrigger(s));
91
+ }
92
+ registered = true;
93
+ return true;
94
+ } catch {
95
+ // Fallback to web listener
96
+ }
97
+ }
98
+ }
99
+
100
+ window.addEventListener("keydown", handleBrowserKeydown);
101
+ registered = true;
102
+ return true;
103
+ };
104
+
105
+ const unregister = async (): Promise<void> => {
106
+ if (typeof window === "undefined") return;
107
+
108
+ if (isTauriEnvironment()) {
109
+ const plugin = await getTauriShortcutPlugin();
110
+ if (plugin?.unregister) {
111
+ try {
112
+ for (const s of shortcuts) {
113
+ await plugin.unregister(s);
114
+ }
115
+ } catch {
116
+ // Handled
117
+ }
118
+ }
119
+ }
120
+
121
+ window.removeEventListener("keydown", handleBrowserKeydown);
122
+ registered = false;
123
+ };
124
+
125
+ onMount(() => {
126
+ if (options.autoRegister !== false) {
127
+ register();
128
+ }
129
+ });
130
+
131
+ onCleanup(() => {
132
+ unregister();
133
+ });
134
+
135
+ return {
136
+ register,
137
+ unregister,
138
+ isRegistered: () => registered,
139
+ };
140
+ }
@@ -0,0 +1,88 @@
1
+ import { createSignal, onCleanup, type Accessor } from "solid-js";
2
+
3
+ export interface CreateHoverOptions {
4
+ /** Delay in milliseconds before setting hover state to true */
5
+ delayEnter?: number;
6
+ /** Delay in milliseconds before setting hover state to false */
7
+ delayLeave?: number;
8
+ /** Callback fired when hover state transitions to true */
9
+ onHoverStart?: () => void;
10
+ /** Callback fired when hover state transitions to false */
11
+ onHoverEnd?: () => void;
12
+ }
13
+
14
+ export interface CreateHoverReturn {
15
+ /** Accessor indicating whether target element is hovered */
16
+ isHovered: Accessor<boolean>;
17
+ /** Event listeners props to spread onto target JSX element */
18
+ props: {
19
+ onPointerEnter: (e: PointerEvent) => void;
20
+ onPointerLeave: (e: PointerEvent) => void;
21
+ };
22
+ }
23
+
24
+ /**
25
+ * SolidJS reactive primitive for tracking element hover state with optional entrance/exit delays.
26
+ *
27
+ * @param options Configuration options for hover delays and callbacks.
28
+ */
29
+ export function createHover(options: CreateHoverOptions = {}): CreateHoverReturn {
30
+ const [isHovered, setIsHovered] = createSignal(false);
31
+ let enterTimer: ReturnType<typeof setTimeout> | undefined;
32
+ let leaveTimer: ReturnType<typeof setTimeout> | undefined;
33
+
34
+ const clearTimers = () => {
35
+ if (enterTimer) {
36
+ clearTimeout(enterTimer);
37
+ enterTimer = undefined;
38
+ }
39
+ if (leaveTimer) {
40
+ clearTimeout(leaveTimer);
41
+ leaveTimer = undefined;
42
+ }
43
+ };
44
+
45
+ const onPointerEnter = () => {
46
+ clearTimers();
47
+ const delay = options.delayEnter ?? 0;
48
+
49
+ if (delay > 0) {
50
+ enterTimer = setTimeout(() => {
51
+ setIsHovered(true);
52
+ options.onHoverStart?.();
53
+ enterTimer = undefined;
54
+ }, delay);
55
+ } else {
56
+ setIsHovered(true);
57
+ options.onHoverStart?.();
58
+ }
59
+ };
60
+
61
+ const onPointerLeave = () => {
62
+ clearTimers();
63
+ const delay = options.delayLeave ?? 0;
64
+
65
+ if (delay > 0) {
66
+ leaveTimer = setTimeout(() => {
67
+ setIsHovered(false);
68
+ options.onHoverEnd?.();
69
+ leaveTimer = undefined;
70
+ }, delay);
71
+ } else {
72
+ setIsHovered(false);
73
+ options.onHoverEnd?.();
74
+ }
75
+ };
76
+
77
+ onCleanup(() => {
78
+ clearTimers();
79
+ });
80
+
81
+ return {
82
+ isHovered,
83
+ props: {
84
+ onPointerEnter,
85
+ onPointerLeave,
86
+ },
87
+ };
88
+ }
@@ -0,0 +1,109 @@
1
+ import { createSignal, onMount, onCleanup, type Accessor } from "solid-js";
2
+ import { isServer } from "solid-js/web";
3
+
4
+ export interface CreateIdleOptions {
5
+ /** Timeout in milliseconds before user is considered idle (default: 60000 = 60s) */
6
+ timeout?: number;
7
+ /** Initial idle state (default: false) */
8
+ initialState?: boolean;
9
+ /** DOM events to listen for user activity */
10
+ events?: string[];
11
+ /** Callback fired when user becomes idle */
12
+ onIdle?: () => void;
13
+ /** Callback fired when user becomes active after being idle */
14
+ onActive?: () => void;
15
+ }
16
+
17
+ export interface CreateIdleReturn {
18
+ /** Accessor returning true if user has been inactive for timeout period */
19
+ isIdle: Accessor<boolean>;
20
+ /** Accessor returning timestamp in ms of last detected user interaction */
21
+ lastActive: Accessor<number>;
22
+ /** Reset idle state and restart timer */
23
+ reset: () => void;
24
+ }
25
+
26
+ const DEFAULT_EVENTS = [
27
+ "mousemove",
28
+ "mousedown",
29
+ "keydown",
30
+ "touchstart",
31
+ "scroll",
32
+ "wheel",
33
+ ];
34
+
35
+ /**
36
+ * SolidJS reactive primitive for detecting user inactivity (idle state) with customizable timeout and event triggers.
37
+ *
38
+ * @param options Configuration options including timeout in ms and event handlers.
39
+ */
40
+ export function createIdle(options: CreateIdleOptions = {}): CreateIdleReturn {
41
+ const initialIdle = options.initialState ?? false;
42
+
43
+ // SSR: return static defaults — no timers, no listeners
44
+ if (isServer) {
45
+ const [isIdle] = createSignal(initialIdle);
46
+ const [lastActive] = createSignal(0);
47
+ return { isIdle, lastActive, reset: () => {} };
48
+ }
49
+
50
+ const timeoutMs = options.timeout ?? 60000;
51
+ const events = options.events ?? DEFAULT_EVENTS;
52
+
53
+ const [isIdle, setIsIdle] = createSignal(initialIdle);
54
+ const [lastActive, setLastActive] = createSignal(0);
55
+
56
+ let timerId: any = null;
57
+
58
+ const startTimer = () => {
59
+ if (timerId) clearTimeout(timerId);
60
+ timerId = setTimeout(() => {
61
+ if (!isIdle()) {
62
+ setIsIdle(true);
63
+ if (options.onIdle) options.onIdle();
64
+ }
65
+ }, timeoutMs);
66
+ };
67
+
68
+ const handleUserActivity = () => {
69
+ setLastActive(Date.now());
70
+
71
+ if (isIdle()) {
72
+ setIsIdle(false);
73
+ if (options.onActive) options.onActive();
74
+ }
75
+
76
+ startTimer();
77
+ };
78
+
79
+ const reset = () => {
80
+ setLastActive(Date.now());
81
+ setIsIdle(false);
82
+ startTimer();
83
+ };
84
+
85
+ onMount(() => {
86
+ // Set initial lastActive to now on client mount
87
+ setLastActive(Date.now());
88
+
89
+ events.forEach((evt) => {
90
+ window.addEventListener(evt, handleUserActivity, { passive: true });
91
+ });
92
+
93
+ startTimer();
94
+
95
+ onCleanup(() => {
96
+ if (timerId) clearTimeout(timerId);
97
+ events.forEach((evt) => {
98
+ window.removeEventListener(evt, handleUserActivity);
99
+ });
100
+ });
101
+ });
102
+
103
+ return {
104
+ isIdle,
105
+ lastActive,
106
+ reset,
107
+ };
108
+ }
109
+
@@ -0,0 +1,90 @@
1
+ import { createSignal, createEffect, onCleanup, type Accessor } from "solid-js";
2
+
3
+ export interface CreateInfiniteScrollOptions {
4
+ /** Target element to observe or trigger scroll on. Defaults to document / scroll parent. */
5
+ target?: HTMLElement | Accessor<HTMLElement | undefined>;
6
+ /** Distance threshold from bottom in pixels to trigger fetch. Defaults to 100. */
7
+ threshold?: number;
8
+ /** Whether loading is currently enabled or auto-fetching is active. Defaults to true. */
9
+ enabled?: boolean | Accessor<boolean>;
10
+ /** Callback function when scrolled near bottom to fetch next items. */
11
+ onLoadMore: () => Promise<void> | void;
12
+ }
13
+
14
+ export interface CreateInfiniteScrollReturn {
15
+ /** Sentinel ref function to bind to a DOM element at the bottom of the list. */
16
+ setSentinelRef: (el: HTMLElement | null) => void;
17
+ /** Signal indicating whether fetching is currently in progress. */
18
+ isLoading: Accessor<boolean>;
19
+ /** Signal indicating whether an error occurred during last fetch. */
20
+ error: Accessor<Error | null>;
21
+ /** Imperative function to manually trigger next page load. */
22
+ loadMore: () => Promise<void>;
23
+ }
24
+
25
+ /**
26
+ * SolidJS reactive primitive for dynamic infinite scrolling / auto-fetching.
27
+ */
28
+ export function createInfiniteScroll(
29
+ options: CreateInfiniteScrollOptions
30
+ ): CreateInfiniteScrollReturn {
31
+ const [sentinelEl, setSentinelEl] = createSignal<HTMLElement | null>(null);
32
+ const [isLoading, setIsLoading] = createSignal(false);
33
+ const [error, setError] = createSignal<Error | null>(null);
34
+
35
+ const isEnabled = (): boolean => {
36
+ if (typeof options.enabled === "function") {
37
+ return options.enabled();
38
+ }
39
+ return options.enabled ?? true;
40
+ };
41
+
42
+ const loadMore = async (): Promise<void> => {
43
+ if (isLoading() || !isEnabled()) return;
44
+ setIsLoading(true);
45
+ setError(null);
46
+ try {
47
+ await options.onLoadMore();
48
+ } catch (err) {
49
+ setError(err instanceof Error ? err : new Error(String(err)));
50
+ } finally {
51
+ setIsLoading(false);
52
+ }
53
+ };
54
+
55
+ createEffect(() => {
56
+ if (typeof window === "undefined" || !window.IntersectionObserver) return;
57
+ if (!isEnabled()) return;
58
+
59
+ const el = sentinelEl();
60
+ if (!el) return;
61
+
62
+ const rootMargin = `${options.threshold ?? 100}px`;
63
+
64
+ const observer = new IntersectionObserver(
65
+ (entries) => {
66
+ const entry = entries[0];
67
+ if (entry?.isIntersecting && !isLoading()) {
68
+ loadMore();
69
+ }
70
+ },
71
+ {
72
+ rootMargin,
73
+ threshold: 0,
74
+ }
75
+ );
76
+
77
+ observer.observe(el);
78
+
79
+ onCleanup(() => {
80
+ observer.disconnect();
81
+ });
82
+ });
83
+
84
+ return {
85
+ setSentinelRef: setSentinelEl,
86
+ isLoading,
87
+ error,
88
+ loadMore,
89
+ };
90
+ }
@@ -0,0 +1,109 @@
1
+ import { createSignal, type Accessor } from "solid-js";
2
+
3
+ export interface CreateInputMaskOptions {
4
+ /** Mask pattern template (e.g. '+995 ### ##-##-##' or '#### #### #### ####') */
5
+ mask: string;
6
+ /** Initial default value */
7
+ defaultValue?: string;
8
+ }
9
+
10
+ export interface CreateInputMaskReturn {
11
+ /** Accessor returning formatted masked input string */
12
+ value: Accessor<string>;
13
+ /** Accessor returning raw unmasked user digits string */
14
+ unmaskedValue: Accessor<string>;
15
+ /** Function to programmatically update input value */
16
+ setValue: (val: string) => void;
17
+ /** JSX props object to spread onto target HTMLInputElement */
18
+ props: {
19
+ value: () => string;
20
+ onInput: (e: Event & { currentTarget: HTMLInputElement }) => void;
21
+ };
22
+ }
23
+
24
+ /**
25
+ * Format raw unmasked text against a mask pattern template.
26
+ */
27
+ export function formatMask(rawInput: string, pattern: string): { masked: string; unmasked: string } {
28
+ if (!rawInput) {
29
+ return { masked: "", unmasked: "" };
30
+ }
31
+
32
+ // Find static prefix of pattern before first slot placeholder (#, 0, X)
33
+ let staticPrefix = "";
34
+ for (let i = 0; i < pattern.length; i++) {
35
+ const char = pattern[i];
36
+ if (char === "#" || char === "0" || char === "X") break;
37
+ staticPrefix += char;
38
+ }
39
+ const staticPrefixDigits = staticPrefix.replace(/\D/g, "");
40
+
41
+ let digits = rawInput.replace(/\D/g, "");
42
+
43
+ // Strip static prefix digits if present at the start
44
+ if (staticPrefixDigits && digits.startsWith(staticPrefixDigits)) {
45
+ digits = digits.slice(staticPrefixDigits.length);
46
+ }
47
+
48
+ if (!digits) {
49
+ return { masked: "", unmasked: "" };
50
+ }
51
+
52
+ let masked = "";
53
+ let digitIndex = 0;
54
+
55
+ for (let i = 0; i < pattern.length; i++) {
56
+ const char = pattern[i];
57
+ if (char === "#" || char === "0" || char === "X") {
58
+ if (digitIndex < digits.length) {
59
+ masked += digits[digitIndex++];
60
+ } else {
61
+ break;
62
+ }
63
+ } else {
64
+ if (digitIndex < digits.length) {
65
+ masked += char;
66
+ } else {
67
+ break;
68
+ }
69
+ }
70
+ }
71
+
72
+ return { masked, unmasked: digits };
73
+ }
74
+
75
+ /**
76
+ * SolidJS reactive primitive for input value masking (phone numbers, credit cards, dates).
77
+ *
78
+ * @param options Configuration options including mask pattern.
79
+ */
80
+ export function createInputMask(options: CreateInputMaskOptions): CreateInputMaskReturn {
81
+ const initial = formatMask(options.defaultValue || "", options.mask);
82
+ const [value, setFormattedValue] = createSignal(initial.masked);
83
+ const [unmaskedValue, setRawValue] = createSignal(initial.unmasked);
84
+
85
+ const setValue = (newVal: string) => {
86
+ const formatted = formatMask(newVal, options.mask);
87
+ setFormattedValue(formatted.masked);
88
+ setRawValue(formatted.unmasked);
89
+ };
90
+
91
+ const onInput = (e: Event & { currentTarget: HTMLInputElement }) => {
92
+ const inputVal = e.currentTarget.value;
93
+ const formatted = formatMask(inputVal, options.mask);
94
+
95
+ setFormattedValue(formatted.masked);
96
+ setRawValue(formatted.unmasked);
97
+ e.currentTarget.value = formatted.masked;
98
+ };
99
+
100
+ return {
101
+ value,
102
+ unmaskedValue,
103
+ setValue,
104
+ props: {
105
+ value: () => value(),
106
+ onInput,
107
+ },
108
+ };
109
+ }