lapikit 0.0.0-insiders.09c4e21 → 0.0.0-insiders.0c6d23b

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 (278) hide show
  1. package/README.md +9 -9
  2. package/bin/{helper.js → helpers.js} +41 -0
  3. package/bin/hooks.js +68 -0
  4. package/bin/index.js +31 -7
  5. package/dist/@types/actions.d.ts +19 -0
  6. package/dist/@types/animations.d.ts +7 -0
  7. package/dist/@types/components.d.ts +33 -0
  8. package/dist/@types/core.d.ts +3 -0
  9. package/dist/@types/dom.d.ts +7 -0
  10. package/dist/@types/events.d.ts +4 -0
  11. package/dist/@types/index.d.ts +7 -0
  12. package/dist/@types/index.js +7 -0
  13. package/dist/@types/props.d.ts +4 -0
  14. package/dist/animations/index.d.ts +1 -0
  15. package/dist/animations/index.js +1 -0
  16. package/dist/animations/ripple.d.ts +5 -0
  17. package/dist/{internal/core/animations → animations}/ripple.js +40 -24
  18. package/dist/assets/icon.svg +1 -0
  19. package/dist/components/accordion/accordion.svelte +104 -23
  20. package/dist/components/accordion/accordion.svelte.d.ts +1 -1
  21. package/dist/components/accordion/{types.d.ts → accordion.types.d.ts} +12 -12
  22. package/dist/components/accordion/modules/accordion-item.svelte +191 -60
  23. package/dist/components/accordion/modules/accordion-item.svelte.d.ts +1 -1
  24. package/dist/components/alert/alert.svelte +238 -50
  25. package/dist/components/alert/alert.svelte.d.ts +1 -1
  26. package/dist/components/alert/alert.types.d.ts +20 -0
  27. package/dist/components/app/app.svelte +208 -74
  28. package/dist/components/app/app.svelte.d.ts +4 -2
  29. package/dist/components/appbar/appbar.svelte +160 -19
  30. package/dist/components/appbar/appbar.svelte.d.ts +1 -1
  31. package/dist/components/appbar/{types.d.ts → appbar.types.d.ts} +6 -7
  32. package/dist/components/aspect-ratio/aspect-ratio.svelte +122 -17
  33. package/dist/components/aspect-ratio/aspect-ratio.svelte.d.ts +2 -2
  34. package/dist/components/aspect-ratio/aspect-ratio.types.d.ts +11 -0
  35. package/dist/components/avatar/avatar.svelte +137 -28
  36. package/dist/components/avatar/avatar.svelte.d.ts +1 -1
  37. package/dist/components/avatar/avatar.types.d.ts +9 -0
  38. package/dist/components/btn/btn.svelte +520 -0
  39. package/dist/components/btn/btn.svelte.d.ts +4 -0
  40. package/dist/components/btn/btn.types.d.ts +26 -0
  41. package/dist/components/card/card.svelte +204 -44
  42. package/dist/components/card/card.svelte.d.ts +1 -1
  43. package/dist/components/card/card.types.d.ts +34 -0
  44. package/dist/components/card/modules/card-actions.svelte +53 -0
  45. package/dist/components/card/modules/card-actions.svelte.d.ts +4 -0
  46. package/dist/components/card/modules/card-container.svelte +51 -0
  47. package/dist/components/card/modules/card-container.svelte.d.ts +4 -0
  48. package/dist/components/card/modules/card-content.svelte +56 -0
  49. package/dist/components/card/modules/card-content.svelte.d.ts +4 -0
  50. package/dist/components/card/modules/card-media.svelte +52 -0
  51. package/dist/components/card/modules/card-media.svelte.d.ts +4 -0
  52. package/dist/components/card/modules/card-title.svelte +56 -0
  53. package/dist/components/card/modules/card-title.svelte.d.ts +4 -0
  54. package/dist/components/chip/chip.svelte +456 -95
  55. package/dist/components/chip/chip.svelte.d.ts +2 -2
  56. package/dist/components/chip/chip.types.d.ts +24 -0
  57. package/dist/components/dialog/dialog.svelte +237 -43
  58. package/dist/components/dialog/dialog.svelte.d.ts +1 -1
  59. package/dist/components/dialog/dialog.types.d.ts +16 -0
  60. package/dist/components/dropdown/dropdown.svelte +170 -51
  61. package/dist/components/dropdown/dropdown.svelte.d.ts +2 -2
  62. package/dist/components/dropdown/{types.d.ts → dropdown.types.d.ts} +11 -10
  63. package/dist/components/icon/icon.svelte +177 -40
  64. package/dist/components/icon/icon.svelte.d.ts +1 -1
  65. package/dist/components/icon/icon.types.d.ts +16 -0
  66. package/dist/components/index.d.ts +30 -22
  67. package/dist/components/index.js +27 -22
  68. package/dist/components/list/list.svelte +158 -26
  69. package/dist/components/list/list.svelte.d.ts +1 -1
  70. package/dist/components/list/list.types.d.ts +30 -0
  71. package/dist/components/list/modules/list-item.svelte +210 -52
  72. package/dist/components/list/modules/list-item.svelte.d.ts +1 -1
  73. package/dist/{stores/components.d.ts → components/modal/modal.d.ts} +1 -2
  74. package/dist/{stores/components.js → components/modal/modal.js} +1 -1
  75. package/dist/components/modal/modal.svelte +249 -44
  76. package/dist/components/modal/modal.svelte.d.ts +1 -1
  77. package/dist/components/modal/modal.types.d.ts +18 -0
  78. package/dist/components/popover/popover.svelte +130 -30
  79. package/dist/components/popover/popover.svelte.d.ts +2 -2
  80. package/dist/components/popover/{types.d.ts → popover.types.d.ts} +8 -8
  81. package/dist/components/separator/separator.svelte +104 -20
  82. package/dist/components/separator/separator.svelte.d.ts +2 -2
  83. package/dist/components/separator/{types.d.ts → separator.types.d.ts} +4 -7
  84. package/dist/components/spacer/spacer.svelte +40 -3
  85. package/dist/components/spacer/spacer.svelte.d.ts +1 -1
  86. package/dist/components/spacer/{types.d.ts → spacer.types.d.ts} +1 -1
  87. package/dist/components/textfield/textfield.svelte +458 -79
  88. package/dist/components/textfield/textfield.svelte.d.ts +1 -1
  89. package/dist/components/textfield/{types.d.ts → textfield.types.d.ts} +8 -6
  90. package/dist/components/toolbar/toolbar.svelte +222 -22
  91. package/dist/components/toolbar/toolbar.svelte.d.ts +1 -1
  92. package/dist/components/toolbar/toolbar.types.d.ts +19 -0
  93. package/dist/components/tooltip/tooltip.svelte +297 -53
  94. package/dist/components/tooltip/tooltip.svelte.d.ts +2 -2
  95. package/dist/components/tooltip/{types.d.ts → tooltip.types.d.ts} +6 -5
  96. package/dist/components/tooltip/tooltip.types.js +1 -0
  97. package/dist/constants.d.ts +10 -0
  98. package/dist/constants.js +44 -0
  99. package/dist/entry-bundler.d.ts +3 -11
  100. package/dist/entry-bundler.js +2 -104
  101. package/dist/escaping.d.ts +2 -0
  102. package/dist/escaping.js +154 -0
  103. package/dist/framework.d.ts +15 -0
  104. package/dist/framework.js +91 -0
  105. package/dist/hooks/actions.d.ts +2 -0
  106. package/dist/hooks/actions.js +2 -0
  107. package/dist/hooks/themes.svelte.d.ts +6 -0
  108. package/dist/hooks/themes.svelte.js +102 -0
  109. package/dist/{labs/compiler/mapped-code.d.ts → html-mapped.d.ts} +2 -2
  110. package/dist/{labs/compiler/mapped-code.js → html-mapped.js} +52 -26
  111. package/dist/labs/index.d.ts +1 -0
  112. package/dist/labs/index.js +2 -0
  113. package/dist/labs/{components/btn/btn.svelte → sheet/sheet.svelte} +15 -10
  114. package/dist/labs/sheet/sheet.svelte.d.ts +7 -0
  115. package/dist/{labs/utils → utils}/components.d.ts +7 -10
  116. package/dist/utils/components.js +108 -0
  117. package/dist/{labs/utils → utils}/index.d.ts +1 -0
  118. package/dist/{labs/utils → utils}/index.js +1 -0
  119. package/dist/{internal/helpers → utils}/outside.d.ts +2 -5
  120. package/dist/{internal/helpers → utils}/outside.js +5 -0
  121. package/package.json +22 -36
  122. package/bin/configuration.js +0 -303
  123. package/bin/presets.js +0 -26
  124. package/bin/prompts.js +0 -67
  125. package/dist/actions/accordion.svelte.d.ts +0 -9
  126. package/dist/actions/index.d.ts +0 -2
  127. package/dist/actions/index.js +0 -2
  128. package/dist/actions/use-theme.d.ts +0 -1
  129. package/dist/actions/use-theme.js +0 -18
  130. package/dist/assets/icons/arrow-down.svelte +0 -12
  131. package/dist/assets/icons/arrow-down.svelte.d.ts +0 -18
  132. package/dist/assets/icons/arrow-up.svelte +0 -12
  133. package/dist/assets/icons/arrow-up.svelte.d.ts +0 -18
  134. package/dist/assets/icons/close-fill.svelte +0 -12
  135. package/dist/assets/icons/close-fill.svelte.d.ts +0 -18
  136. package/dist/assets/icons/loading-fill.svelte +0 -31
  137. package/dist/assets/icons/loading-fill.svelte.d.ts +0 -18
  138. package/dist/components/accordion/accordion.css +0 -36
  139. package/dist/components/accordion/modules/accordion-item.css +0 -68
  140. package/dist/components/alert/alert.css +0 -130
  141. package/dist/components/alert/types.d.ts +0 -28
  142. package/dist/components/app/app.css +0 -26
  143. package/dist/components/app/types.d.ts +0 -10
  144. package/dist/components/appbar/appbar.css +0 -38
  145. package/dist/components/aspect-ratio/aspect-ratio.css +0 -19
  146. package/dist/components/aspect-ratio/types.d.ts +0 -5
  147. package/dist/components/avatar/avatar.css +0 -102
  148. package/dist/components/avatar/types.d.ts +0 -22
  149. package/dist/components/button/button.css +0 -240
  150. package/dist/components/button/button.svelte +0 -102
  151. package/dist/components/button/button.svelte.d.ts +0 -4
  152. package/dist/components/button/types.d.ts +0 -29
  153. package/dist/components/card/card.css +0 -105
  154. package/dist/components/card/types.d.ts +0 -20
  155. package/dist/components/chip/chip.css +0 -224
  156. package/dist/components/chip/types.d.ts +0 -32
  157. package/dist/components/dialog/dialog.css +0 -129
  158. package/dist/components/dialog/types.d.ts +0 -24
  159. package/dist/components/dropdown/dropdown.css +0 -13
  160. package/dist/components/icon/icon.css +0 -78
  161. package/dist/components/icon/types.d.ts +0 -16
  162. package/dist/components/list/list.css +0 -149
  163. package/dist/components/list/modules/list-item.css +0 -67
  164. package/dist/components/list/types.d.ts +0 -33
  165. package/dist/components/modal/modal.css +0 -137
  166. package/dist/components/modal/types.d.ts +0 -26
  167. package/dist/components/popover/popover.css +0 -13
  168. package/dist/components/separator/separator.css +0 -42
  169. package/dist/components/spacer/spacer.css +0 -3
  170. package/dist/components/textfield/textfield.css +0 -298
  171. package/dist/components/toolbar/toolbar.css +0 -106
  172. package/dist/components/toolbar/types.d.ts +0 -27
  173. package/dist/components/tooltip/tooltip.css +0 -116
  174. package/dist/index.d.ts +0 -3
  175. package/dist/index.js +0 -24
  176. package/dist/internal/config/presets.d.ts +0 -149
  177. package/dist/internal/config/presets.js +0 -169
  178. package/dist/internal/config/variables.d.ts +0 -3
  179. package/dist/internal/config/variables.js +0 -3
  180. package/dist/internal/core/actions/assets.svelte.d.ts +0 -8
  181. package/dist/internal/core/actions/assets.svelte.js +0 -54
  182. package/dist/internal/core/actions/dropdown.svelte.d.ts +0 -7
  183. package/dist/internal/core/actions/popover.svelte.d.ts +0 -7
  184. package/dist/internal/core/actions/tooltip.svelte.d.ts +0 -7
  185. package/dist/internal/core/animations/ripple.d.ts +0 -12
  186. package/dist/internal/core/bin/ansi.d.ts +0 -40
  187. package/dist/internal/core/bin/ansi.js +0 -44
  188. package/dist/internal/core/bin/terminal.d.ts +0 -1
  189. package/dist/internal/core/bin/terminal.js +0 -12
  190. package/dist/internal/core/css.d.ts +0 -1
  191. package/dist/internal/core/css.js +0 -16
  192. package/dist/internal/core/formatter/component.d.ts +0 -5
  193. package/dist/internal/core/formatter/component.js +0 -60
  194. package/dist/internal/core/formatter/device.d.ts +0 -5
  195. package/dist/internal/core/formatter/device.js +0 -66
  196. package/dist/internal/core/formatter/index.d.ts +0 -7
  197. package/dist/internal/core/formatter/index.js +0 -35
  198. package/dist/internal/core/formatter/style.d.ts +0 -4
  199. package/dist/internal/core/formatter/style.js +0 -15
  200. package/dist/internal/core/formatter/theme.d.ts +0 -5
  201. package/dist/internal/core/formatter/theme.js +0 -44
  202. package/dist/internal/core/formatter/typography.d.ts +0 -5
  203. package/dist/internal/core/formatter/typography.js +0 -12
  204. package/dist/internal/core/minify.d.ts +0 -1
  205. package/dist/internal/core/minify.js +0 -10
  206. package/dist/internal/core/standard-colors.d.ts +0 -75
  207. package/dist/internal/core/standard-colors.js +0 -75
  208. package/dist/internal/core/x11-colors.d.ts +0 -4
  209. package/dist/internal/core/x11-colors.js +0 -151
  210. package/dist/internal/helpers/colors.d.ts +0 -1
  211. package/dist/internal/helpers/colors.js +0 -50
  212. package/dist/internal/helpers/convert.d.ts +0 -1
  213. package/dist/internal/helpers/convert.js +0 -17
  214. package/dist/internal/helpers/deep-merge.d.ts +0 -44
  215. package/dist/internal/helpers/deep-merge.js +0 -80
  216. package/dist/internal/helpers/parser.d.ts +0 -10
  217. package/dist/internal/helpers/parser.js +0 -93
  218. package/dist/internal/helpers/scroll.d.ts +0 -1
  219. package/dist/internal/helpers/scroll.js +0 -5
  220. package/dist/internal/plugins/vite.d.ts +0 -8
  221. package/dist/internal/plugins/vite.js +0 -33
  222. package/dist/internal/types/components.d.ts +0 -14
  223. package/dist/internal/types/configuration.d.ts +0 -63
  224. package/dist/internal/types/index.d.ts +0 -2
  225. package/dist/internal/types/index.js +0 -2
  226. package/dist/labs/compiler/types/dom.d.ts +0 -2
  227. package/dist/labs/compiler/types/index.d.ts +0 -1
  228. package/dist/labs/components/btn/btn.svelte.d.ts +0 -7
  229. package/dist/labs/components/index.d.ts +0 -1
  230. package/dist/labs/components/index.js +0 -2
  231. package/dist/labs/utils/components.js +0 -86
  232. package/dist/labs/utils/types/index.d.ts +0 -13
  233. package/dist/stores/breakpoints.d.ts +0 -6
  234. package/dist/stores/breakpoints.js +0 -14
  235. package/dist/stores/devices.d.ts +0 -6
  236. package/dist/stores/devices.js +0 -9
  237. package/dist/stores/index.d.ts +0 -5
  238. package/dist/stores/index.js +0 -5
  239. package/dist/stores/themes.d.ts +0 -2
  240. package/dist/stores/themes.js +0 -4
  241. package/dist/stores/viewport.d.ts +0 -7
  242. package/dist/stores/viewport.js +0 -7
  243. package/dist/styles/animation.css +0 -33
  244. package/dist/styles/keyframes.css +0 -30
  245. package/dist/styles/reset.css +0 -133
  246. package/dist/styles.css +0 -0
  247. package/dist/styles.css.d.ts +0 -4
  248. package/dist/themes.css +0 -0
  249. package/dist/themes.css.d.ts +0 -4
  250. /package/dist/{components/accordion/types.js → @types/actions.js} +0 -0
  251. /package/dist/{components/alert/types.js → @types/animations.js} +0 -0
  252. /package/dist/{internal/types → @types}/components.js +0 -0
  253. /package/dist/{components/app/types.js → @types/core.js} +0 -0
  254. /package/dist/{labs/compiler/types → @types}/dom.js +0 -0
  255. /package/dist/{components/appbar/types.js → @types/events.js} +0 -0
  256. /package/dist/{components/aspect-ratio/types.js → @types/props.js} +0 -0
  257. /package/dist/{actions → components/accordion}/accordion.svelte.js +0 -0
  258. /package/dist/components/{avatar/types.js → accordion/accordion.types.js} +0 -0
  259. /package/dist/components/{button/types.js → alert/alert.types.js} +0 -0
  260. /package/dist/components/{card/types.js → appbar/appbar.types.js} +0 -0
  261. /package/dist/components/{chip/types.js → aspect-ratio/aspect-ratio.types.js} +0 -0
  262. /package/dist/components/{dialog/types.js → avatar/avatar.types.js} +0 -0
  263. /package/dist/components/{dropdown/types.js → btn/btn.types.js} +0 -0
  264. /package/dist/components/{icon/types.js → card/card.types.js} +0 -0
  265. /package/dist/components/{list/types.js → chip/chip.types.js} +0 -0
  266. /package/dist/components/{modal/types.js → dialog/dialog.types.js} +0 -0
  267. /package/dist/{internal/core/actions → components/dropdown}/dropdown.svelte.js +0 -0
  268. /package/dist/components/{popover/types.js → dropdown/dropdown.types.js} +0 -0
  269. /package/dist/components/{separator/types.js → icon/icon.types.js} +0 -0
  270. /package/dist/components/{spacer/types.js → list/list.types.js} +0 -0
  271. /package/dist/components/{textfield/types.js → modal/modal.types.js} +0 -0
  272. /package/dist/{internal/core/actions → components/popover}/popover.svelte.js +0 -0
  273. /package/dist/components/{toolbar/types.js → popover/popover.types.js} +0 -0
  274. /package/dist/components/{tooltip/types.js → separator/separator.types.js} +0 -0
  275. /package/dist/{internal/types/configuration.js → components/spacer/spacer.types.js} +0 -0
  276. /package/dist/{labs/compiler/types/index.js → components/textfield/textfield.types.js} +0 -0
  277. /package/dist/{labs/utils/types/index.js → components/toolbar/toolbar.types.js} +0 -0
  278. /package/dist/{internal/core/actions → components/tooltip}/tooltip.svelte.js +0 -0
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <a href="https://lapikit.dev">
2
- <img src="https://raw.githubusercontent.com/Nycolaide/lapikit/main/.github/lapikit.svg" alt="Lapikit Logo" width="125">
2
+ <img src="https://raw.githubusercontent.com/lapikit/lapikit.dev/main/.github/lapikit.svg" alt="Lapikit Logo" width="125">
3
3
  </a>
4
4
 
5
5
  # Lapikit - Svelte components library
@@ -8,10 +8,10 @@
8
8
  [![][subscribe-to-instagram]](https://www.instagram.com/lapikit/)
9
9
  [![][join-discord-lapikit]](https://discord.gg/gn9ZGtDtK4)
10
10
 
11
- [![][version]](https://github.com/nycolaide/lapikit/releases?q=lapikit&expanded=true)
11
+ [![][version]](https://github.com/lapikit/lapikit/releases?q=lapikit&expanded=true)
12
12
  [![][installs]](https://www.npmjs.com/package/lapikit)
13
13
  [![][installs-this-month]](https://www.npmjs.com/package/lapikit)
14
- [![][license]](https://github.com/nycolaide/lapikit/blob/main/LICENSE)
14
+ [![][license]](https://github.com/lapikit/lapikit/blob/main/LICENSE)
15
15
  [![][discord]](https://discord.gg/gn9ZGtDtK4)
16
16
 
17
17
  Lapikit is a comprehensive Svelte components library that provides developers with a wide range of pre-built, customizable UI components to streamline the development process. Whether you're building a simple website or a complex web application, Lapikit has the tools you need to create beautiful and functional user interfaces with ease.
@@ -71,7 +71,7 @@ Lapikit has created to help Svelte developers save time and effort when building
71
71
 
72
72
  ## 💖Community
73
73
 
74
- Join our growing community on [Discord](https://discord.gg/gn9ZGtDtK4) and [GitHub Discussions](https://github.com/nycolaide/lapikit/discussions) where we discuss and collaborate on all things Lapikit. Don't be shy, jump right in and be part of the discussion!
74
+ Join our growing community on [Discord](https://discord.gg/gn9ZGtDtK4) and [GitHub Discussions](https://github.com/lapikit/lapikit/discussions) where we discuss and collaborate on all things Lapikit. Don't be shy, jump right in and be part of the discussion!
75
75
 
76
76
  ## 💁‍♂️Contributing
77
77
 
@@ -84,9 +84,9 @@ Be part of the next revolution in code editing by contributing to the project. T
84
84
 
85
85
  ## 📄License
86
86
 
87
- Licensed under the [MIT license](https://github.com/nycolaide/lapikit/blob/main/LICENSE).
87
+ Licensed under the [MIT license](https://github.com/lapikit/lapikit/blob/main/LICENSE).
88
88
 
89
- Copyright © 2025 Nycolaide
89
+ Copyright © 2025 - 2026 Nycolaide
90
90
 
91
91
  ## 🪧We support these projects
92
92
 
@@ -96,12 +96,12 @@ We are proud supporters of the open-source community and contribute to several p
96
96
  <tr>
97
97
  <td>
98
98
  <a href="https://www.w3.org/">
99
- <img src="https://raw.githubusercontent.com/Nycolaide/lapikit/main/.github/w3c.svg" alt="W3C" width="75">
99
+ <img src="https://raw.githubusercontent.com/lapikit/lapikit.dev/main/.github/w3c.svg" alt="W3C" width="75">
100
100
  </a>
101
101
  </td>
102
102
  <td>
103
103
  <a href="https://humanstxt.org/">
104
- <img src="https://raw.githubusercontent.com/Nycolaide/lapikit/main/.github/humans.png" alt="Humans.txt" width="115">
104
+ <img src="https://raw.githubusercontent.com/lapikit/lapikit.dev/main/.github/humans.png" alt="Humans.txt" width="115">
105
105
  </a>
106
106
  </td>
107
107
  </tr>
@@ -111,7 +111,7 @@ We are proud supporters of the open-source community and contribute to several p
111
111
  [join-discord-lapikit]: https://img.shields.io/badge/Join%20the%20community-black.svg?style=for-the-badge&logo=Discord
112
112
  [subscribe-to-instagram]: https://img.shields.io/badge/Follow%20@Lapikit-black.svg?style=for-the-badge&logo=Instagram
113
113
  [version]: https://img.shields.io/npm/v/lapikit.svg?label=Version&color=f58142
114
- [license]: https://badgen.net/github/license/nycolaide/lapikit?label=License&color=cc5640
114
+ [license]: https://badgen.net/github/license/lapikit/lapikit?label=License&color=cc5640
115
115
  [installs]: https://badgen.net/npm/dt/lapikit?label=NPM%20installs&color=40ba12
116
116
  [installs-this-month]: https://badgen.net/npm/dm/lapikit?label=NPM%20installs&color=40ba12
117
117
  [discord]: https://img.shields.io/discord/1383879204671721492?color=5865F2&label=Discord&logo=discord&logoColor=white
@@ -1,3 +1,5 @@
1
+ import readline from 'node:readline/promises';
2
+
1
3
  const color = {
2
4
  red: (text) => `\x1b[31m${text}\x1b[0m`,
3
5
  green: (text) => `\x1b[32m${text}\x1b[0m`,
@@ -57,3 +59,42 @@ export const terminal = (type = 'info', msg) => {
57
59
  else if (type === 'none') console.log(msg);
58
60
  else console.log(name, ansi.bold.blue('[info]'), msg);
59
61
  };
62
+
63
+ export function createRL() {
64
+ return readline.createInterface({ input: process.stdin, output: process.stdout });
65
+ }
66
+
67
+ export async function toggle(rl, message, initial = true) {
68
+ const hint = initial ? 'Y/n' : 'y/N';
69
+ const answer = (await rl.question(`${message} (${hint}): `)).trim().toLowerCase();
70
+ if (answer === '') return initial;
71
+ return answer === 'y';
72
+ }
73
+
74
+ export async function text(rl, message, initial = '', validate) {
75
+ while (true) {
76
+ const hint = initial ? ` (${initial})` : '';
77
+ const answer = (await rl.question(`${message}${hint}: `)).trim();
78
+ const value = answer === '' ? initial : answer;
79
+ if (validate) {
80
+ const result = validate(value);
81
+ if (result !== true) {
82
+ terminal('warn', result);
83
+ continue;
84
+ }
85
+ }
86
+ return value;
87
+ }
88
+ }
89
+
90
+ export async function select(rl, message, choices) {
91
+ console.log(`\n${message}`);
92
+ choices.forEach((c, i) => console.log(` ${i + 1}. ${c.title}`));
93
+
94
+ while (true) {
95
+ const answer = (await rl.question(`Choice (1): `)).trim();
96
+ const index = answer === '' ? 0 : parseInt(answer, 10) - 1;
97
+ if (index >= 0 && index < choices.length) return choices[index].value;
98
+ terminal('warn', `Please enter a number between 1 and ${choices.length}`);
99
+ }
100
+ }
package/bin/hooks.js ADDED
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+ import { promises as fs } from 'node:fs';
3
+ import path from 'node:path';
4
+ import { terminal } from './helpers.js';
5
+
6
+ export async function findSvelteConfigFile(projectPath) {
7
+ for (const ext of ['js', 'ts']) {
8
+ const file = path.join(projectPath, `svelte.config.${ext}`);
9
+ try {
10
+ await fs.access(file);
11
+ return file;
12
+ } catch {
13
+ // lapikit other step
14
+ }
15
+ }
16
+ throw new Error('No svelte.config.js or svelte.config.ts file found');
17
+ }
18
+
19
+ export async function addLiliPreprocess(svelteConfigFile) {
20
+ let content = await fs.readFile(svelteConfigFile, 'utf-8');
21
+ const lapikitImport = `import { lapikitPreprocess } from 'lapikit/labs/preprocess';`;
22
+
23
+ if (content.includes(`from 'lapikit/labs/preprocess'`)) {
24
+ terminal('info', `lapikitPreprocess already imported in ${svelteConfigFile}`);
25
+ return;
26
+ }
27
+
28
+ const lines = content.split('\n');
29
+ let importInsertIndex = 0;
30
+ for (let i = 0; i < lines.length; i++) {
31
+ if (lines[i].trim().startsWith('import ')) importInsertIndex = i + 1;
32
+ }
33
+ lines.splice(importInsertIndex, 0, lapikitImport);
34
+ content = lines.join('\n');
35
+
36
+ if (!content.match(/preprocess\s*:/)) {
37
+ content = content.replace(
38
+ /(const\s+\w+\s*=\s*\{|export\s+default\s*\{)/,
39
+ (m) => `${m}\n\tpreprocess: [lapikitPreprocess()],`
40
+ );
41
+ } else if (content.match(/preprocess\s*:\s*\[/)) {
42
+ content = content.replace(/preprocess\s*:\s*\[([\s\S]*?)\]/, (_, inner) => {
43
+ const trimmed = inner.trim();
44
+ if (!trimmed) return `preprocess: [lapikitPreprocess()]`;
45
+
46
+ if (inner.includes('\n')) {
47
+ const firstItemMatch = inner.match(/\n(\s*)\S/);
48
+ const indent = firstItemMatch ? firstItemMatch[1] : '\t\t';
49
+ const closingMatch = inner.match(/\n(\s*)$/);
50
+ const closingIndent = closingMatch ? closingMatch[1] : '\t';
51
+ const innerTrimmed = inner.trimEnd();
52
+ const sep = innerTrimmed.endsWith(',') ? '' : ',';
53
+ return `preprocess: [${innerTrimmed}${sep}\n${indent}lapikitPreprocess()\n${closingIndent}]`;
54
+ } else {
55
+ const sep = trimmed.endsWith(',') ? ' ' : ', ';
56
+ return `preprocess: [${trimmed}${sep}lapikitPreprocess()]`;
57
+ }
58
+ });
59
+ } else {
60
+ content = content.replace(
61
+ /preprocess\s*:\s*([^,\n\]{}]+)/,
62
+ (_, val) => `preprocess: [${val.trim()}, lapikitPreprocess()]`
63
+ );
64
+ }
65
+
66
+ await fs.writeFile(svelteConfigFile, content);
67
+ terminal('success', `lapikitPreprocess added to ${svelteConfigFile}`);
68
+ }
package/bin/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { initConfiguration } from './configuration.js';
3
- import { ansi, terminal } from './helper.js';
4
- import { initPrompts } from './prompts.js';
2
+ import { ansi, terminal, createRL, toggle } from './helpers.js';
3
+ import { addLiliPreprocess, findSvelteConfigFile } from './hooks.js';
5
4
 
6
5
  async function run() {
6
+ const rl = createRL();
7
+
7
8
  console.log(' _ _ _ _ _ ');
8
9
  console.log(' | | (_) | (_) | ');
9
10
  console.log(' | | __ _ _ __ _| | ___| |_ ');
@@ -15,15 +16,38 @@ async function run() {
15
16
 
16
17
  terminal('none', `${ansi.bold.blue('Lapikit')} - Component Library for Svelte\n\n`);
17
18
 
18
- const promptsConfig = await initPrompts();
19
+ console.log(
20
+ 'This installer will guide you through the process of installing Lapikit on your Svelte project.\n'
21
+ );
22
+
23
+ console.log('List actions that will be done:');
24
+ console.log(
25
+ ansi.color.green('✓') +
26
+ ' Add lili preprocess (named: lapikitPreprocess) on your svelte.config.js file\n'
27
+ );
28
+ console.log(ansi.underline.purple('Setup will take less than 5 seconds\n'));
29
+
30
+ const confirm = await toggle(rl, 'Launch install Lapikit on your project?');
31
+ if (!confirm) {
32
+ terminal('warn', `installation canceled.`);
33
+ process.exit(0);
34
+ }
35
+
36
+ console.log('\n');
19
37
 
20
- await initConfiguration(promptsConfig);
38
+ try {
39
+ const svelteConfigFile = await findSvelteConfigFile(process.cwd());
40
+ await addLiliPreprocess(svelteConfigFile);
41
+ } catch (error) {
42
+ terminal('warn', `Warning: Could not update svelte.config file: ${error.message}`);
43
+ }
21
44
  }
22
45
 
23
46
  run()
24
47
  .then(() => {
25
- terminal('none', `\n\n\n\nWebsite: https://lapikit.dev`);
26
- terminal('none', `Github: https://github.com/nycolaide/lapikit`);
48
+ terminal('none', `\n\nThank's for installing Lapikit!\n`);
49
+ terminal('none', `Website: https://lapikit.dev`);
50
+ terminal('none', `Github: https://github.com/lapikit/lapikit`);
27
51
  terminal('none', `Support the developement: https://buymeacoffee.com/nycolaide`);
28
52
  process.exit(0);
29
53
  })
@@ -0,0 +1,19 @@
1
+ import type { Action } from 'svelte/action';
2
+ /** Accordion */
3
+ export type AccordionOptions = {
4
+ multiple?: boolean;
5
+ readOnly?: boolean;
6
+ };
7
+ /**Modal */
8
+ export type ModalState = boolean | 'persistent';
9
+ /**Theme */
10
+ export type ThemeOptions = {
11
+ name?: string;
12
+ key?: string;
13
+ overridden?: boolean;
14
+ };
15
+ export type ThemeAction = {
16
+ action: Action<HTMLElement, ThemeOptions | undefined>;
17
+ set: (name: string) => void;
18
+ readonly active: string;
19
+ };
@@ -0,0 +1,7 @@
1
+ export interface RippleProps {
2
+ component?: string;
3
+ center?: boolean;
4
+ color?: string;
5
+ duration?: number;
6
+ disabled?: boolean;
7
+ }
@@ -0,0 +1,33 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { ClassNameType, IdElementType, KitClassNameType, KitStylePropertiesType, PropValue, SClassProp, SStyleProp, StylePropertiesType } from './';
3
+ export interface useClassNameProps {
4
+ baseClass?: string;
5
+ className?: string;
6
+ sClass?: SClassProp;
7
+ classProps?: Record<string, PropValue>;
8
+ }
9
+ export interface useStylesProps {
10
+ styleAttr?: string;
11
+ sStyle?: SStyleProp;
12
+ styleProps?: Record<string, PropValue>;
13
+ }
14
+ export interface Base {
15
+ id?: IdElementType;
16
+ class?: ClassNameType;
17
+ style?: StylePropertiesType;
18
+ 's-class'?: KitClassNameType;
19
+ 's-style'?: KitStylePropertiesType;
20
+ [key: string]: any;
21
+ }
22
+ export interface Component extends Base {
23
+ children?: Snippet;
24
+ }
25
+ export type KitComponentScan = {
26
+ code: string;
27
+ changed: boolean;
28
+ importedComponents: Map<string, string>;
29
+ };
30
+ export type ComponentInfo = {
31
+ name: string;
32
+ ref: string;
33
+ };
@@ -0,0 +1,3 @@
1
+ export type LapikitPreprocessOptions = {
2
+ plugins?: string[];
3
+ };
@@ -0,0 +1,7 @@
1
+ export type IdElementType = string | undefined;
2
+ export type ClassNameType = string | string[] | undefined;
3
+ export type StylePropertiesType = string | undefined;
4
+ export type KitClassNameType = string | string[] | undefined;
5
+ export type KitStylePropertiesType = Record<string, boolean | string> | undefined;
6
+ export type SClassProp = string | string[] | Record<string, boolean | string> | undefined;
7
+ export type SStyleProp = Record<string, boolean | string> | undefined;
@@ -0,0 +1,4 @@
1
+ export type ClickOutsideOptions = {
2
+ exclude?: (HTMLElement | PointerEvent | null)[];
3
+ onClose: () => void;
4
+ };
@@ -0,0 +1,7 @@
1
+ export * from './dom.js';
2
+ export * from './components.js';
3
+ export * from './props.js';
4
+ export * from './events.js';
5
+ export * from './animations.js';
6
+ export * from './core.js';
7
+ export * from './actions.js';
@@ -0,0 +1,7 @@
1
+ export * from './dom.js';
2
+ export * from './components.js';
3
+ export * from './props.js';
4
+ export * from './events.js';
5
+ export * from './animations.js';
6
+ export * from './core.js';
7
+ export * from './actions.js';
@@ -0,0 +1,4 @@
1
+ export type PropValue = string | boolean | number | null | undefined;
2
+ export type SizeType = 'default' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
3
+ export type RoundedType = 0 | '0' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
4
+ export type DensityType = 'none' | 'compact' | 'default' | 'comfortable';
@@ -0,0 +1 @@
1
+ export * from './ripple.ts';
@@ -0,0 +1 @@
1
+ export * from "./ripple.js";
@@ -0,0 +1,5 @@
1
+ import type { RippleProps } from '../@types';
2
+ export declare function ripple(el: HTMLElement, options?: RippleProps): {
3
+ destroy(): void;
4
+ update(newOptions: RippleProps): void;
5
+ };
@@ -1,9 +1,22 @@
1
1
  const triggerEvents = ['pointerdown', 'touchstart', 'keydown'];
2
2
  const cancelEvents = ['mouseleave', 'dragleave', 'touchmove', 'touchcancel', 'pointerup', 'keyup'];
3
+ function resolveDuration(options) {
4
+ return options.duration && options.duration > 0 ? options.duration : undefined;
5
+ }
6
+ function getCoords(e) {
7
+ if (window.TouchEvent && e instanceof TouchEvent) {
8
+ return { x: e.touches[0].clientX, y: e.touches[0].clientY };
9
+ }
10
+ return { x: e.clientX, y: e.clientY };
11
+ }
3
12
  export function ripple(el, options = {}) {
4
13
  const rippleContainer = document.createElement('div');
14
+ const activeRipples = new Set();
5
15
  addClasses();
6
16
  setOptions(options);
17
+ function isAriaDisabled() {
18
+ return el.getAttribute('aria-disabled') === 'true';
19
+ }
7
20
  function addClasses(center) {
8
21
  const shouldBeCentered = center || options.center;
9
22
  if (!rippleContainer.classList.contains('kit-ripple--effect')) {
@@ -16,28 +29,26 @@ export function ripple(el, options = {}) {
16
29
  rippleContainer.classList.add('kit-ripple--center');
17
30
  }
18
31
  }
19
- function setOptions(options) {
20
- if (options.disabled || el.hasAttribute('aria-disabled')) {
32
+ function setOptions(newOptions) {
33
+ if (newOptions.disabled || isAriaDisabled()) {
21
34
  rippleContainer.remove();
22
35
  }
23
36
  else {
24
37
  el.appendChild(rippleContainer);
25
38
  }
26
- if (options.duration && options.duration < 0) {
27
- options.duration = undefined;
39
+ if (newOptions.component) {
40
+ rippleContainer.style.setProperty('--system-ripple-radius', `var(--kit-${newOptions.component}-radius)`);
28
41
  }
29
- if (options.component) {
30
- rippleContainer.style.setProperty('--system-ripple-radius', `var(--${options.component}-shape)`);
42
+ if (newOptions.color) {
43
+ rippleContainer.style.setProperty('--system-ripple-color', newOptions.color);
31
44
  }
32
- if (options.color) {
33
- rippleContainer.style.setProperty('--system-ripple-color', options.color);
34
- }
35
- if (options.duration) {
36
- rippleContainer.style.setProperty('--system-animation-ripple-duration', `${options.duration}ms`);
45
+ const duration = resolveDuration(newOptions);
46
+ if (duration) {
47
+ rippleContainer.style.setProperty('--system-animation-ripple-duration', `${duration}ms`);
37
48
  }
38
49
  }
39
50
  function createRipple(e, center) {
40
- if (options.disabled || el.hasAttribute('aria-disabled')) {
51
+ if (options.disabled || isAriaDisabled()) {
41
52
  return;
42
53
  }
43
54
  if (e instanceof KeyboardEvent) {
@@ -51,12 +62,7 @@ export function ripple(el, options = {}) {
51
62
  }
52
63
  addClasses(center);
53
64
  const rect = el.getBoundingClientRect();
54
- const clientX = window.TouchEvent && e instanceof TouchEvent
55
- ? e.touches[0].clientX
56
- : e.clientX;
57
- const clientY = window.TouchEvent && e instanceof TouchEvent
58
- ? e.touches[0].clientY
59
- : e.clientY;
65
+ const { x: clientX, y: clientY } = getCoords(e);
60
66
  const x = clientX - rect.left > el.offsetWidth / 2 ? 0 : el.offsetWidth;
61
67
  const y = clientY - rect.top > el.offsetHeight / 2 ? 0 : el.offsetHeight;
62
68
  const radius = Math.hypot(x - (clientX - rect.left), y - (clientY - rect.top));
@@ -66,16 +72,23 @@ export function ripple(el, options = {}) {
66
72
  ripple.style.top = `${clientY - rect.top - radius}px`;
67
73
  ripple.style.width = ripple.style.height = `${radius * 2}px`;
68
74
  rippleContainer.appendChild(ripple);
69
- function removeRipple() {
70
- if (ripple === null) {
71
- return;
75
+ let timeoutId;
76
+ function cleanup() {
77
+ if (timeoutId) {
78
+ clearTimeout(timeoutId);
72
79
  }
80
+ cancelEvents.forEach((event) => el.removeEventListener(event, removeRipple));
81
+ ripple.remove();
82
+ }
83
+ function removeRipple() {
73
84
  ripple.style.opacity = '0';
74
- setTimeout(() => {
75
- ripple.remove();
76
- }, options.duration || 1000);
77
85
  cancelEvents.forEach((event) => el.removeEventListener(event, removeRipple));
86
+ timeoutId = setTimeout(() => {
87
+ ripple.remove();
88
+ activeRipples.delete(cleanup);
89
+ }, resolveDuration(options) || 1000);
78
90
  }
91
+ activeRipples.add(cleanup);
79
92
  cancelEvents.forEach((event) => el.addEventListener(event, removeRipple, { passive: true }));
80
93
  }
81
94
  triggerEvents.forEach((event) => el.addEventListener(event, createRipple, { passive: event === 'touchstart' }));
@@ -84,6 +97,9 @@ export function ripple(el, options = {}) {
84
97
  triggerEvents.forEach((event) => {
85
98
  el.removeEventListener(event, createRipple);
86
99
  });
100
+ activeRipples.forEach((cleanup) => cleanup());
101
+ activeRipples.clear();
102
+ rippleContainer.remove();
87
103
  },
88
104
  update(newOptions) {
89
105
  options = newOptions;
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-align-end-horizontal-icon lucide-align-end-horizontal"><rect width="6" height="16" x="4" y="2" rx="2"/><rect width="6" height="9" x="14" y="9" rx="2"/><path d="M22 22H2"/></svg>
@@ -1,39 +1,120 @@
1
1
  <script lang="ts">
2
- import { getAssets } from '../../internal/core/actions/assets.svelte.js';
3
- import type { AccordionProps } from './types.js';
2
+ import { useClassName, useStyles } from '../../utils';
3
+ import { makeComponentProps } from '../../html-mapped';
4
+ import type { AccordionProps } from './accordion.types.js';
4
5
 
5
6
  let {
6
7
  ref = $bindable(),
7
- children,
8
8
  is = 'div',
9
- dark,
10
- light,
11
- color,
12
- background,
13
- spacer,
14
- hideIcon,
15
- rounded,
9
+ children = undefined,
10
+ class: className = '',
11
+ style: styleAttr = '',
12
+ 's-class': sClass,
13
+ 's-style': sStyle,
14
+ text = undefined,
15
+ color = undefined,
16
+ background = undefined,
17
+ rounded = undefined,
18
+ spacer = false,
19
+ hideIcon = false,
16
20
  ...rest
17
21
  }: AccordionProps = $props();
18
22
 
19
- const assets = getAssets();
23
+ let { classProps, styleProps, restProps } = $derived(
24
+ makeComponentProps(rest as Record<string, unknown>)
25
+ );
26
+
27
+ let componentClass = $derived(
28
+ useClassName({
29
+ baseClass: 'kit-accordion',
30
+ className: `${className ?? ''}`.trim(),
31
+ sClass,
32
+ classProps
33
+ })
34
+ );
35
+
36
+ let componentStyle = $derived(
37
+ useStyles({
38
+ styleAttr,
39
+ sStyle,
40
+ styleProps
41
+ })
42
+ );
43
+
44
+ let mergedStyle = $derived(
45
+ [
46
+ componentStyle,
47
+ color ? `--kit-accordion-fg:${color}` : '',
48
+ background ? `--kit-accordion-bg:${background}` : ''
49
+ ]
50
+ .filter(Boolean)
51
+ .join('; ')
52
+ );
20
53
  </script>
21
54
 
22
55
  <svelte:element
23
56
  this={is}
24
57
  bind:this={ref}
25
- {...rest}
26
- class={[
27
- 'kit-accordion',
28
- spacer && 'kit-accordion--spacer',
29
- hideIcon && 'kit-accordion--hide-icon',
30
- light && 'light',
31
- dark && 'dark',
32
- rest.class
33
- ]}
34
- style:--accordion-shape={assets.shape(rounded)}
35
- style:--accordion-background={assets.color(background)}
36
- style:--accordion-color={assets.color(color)}
58
+ class={componentClass}
59
+ style={mergedStyle}
60
+ {...restProps}
61
+ data-text={text ? true : undefined}
62
+ data-spacer={spacer}
63
+ data-hide-icon={hideIcon}
64
+ data-rounded={rounded}
37
65
  >
38
66
  {@render children?.()}
39
67
  </svelte:element>
68
+
69
+ <style>
70
+ .kit-accordion {
71
+ --kit-accordion-radius: 8px;
72
+ --kit-accordion-gap: 0;
73
+ --kit-accordion-fg: var(--kit-fg);
74
+ --kit-accordion-bg: transparent;
75
+
76
+ display: flex;
77
+ flex-wrap: wrap;
78
+ justify-content: center;
79
+ width: 100%;
80
+ padding: 0;
81
+ list-style: none;
82
+ position: relative;
83
+ z-index: 1;
84
+ gap: var(--kit-accordion-gap);
85
+ color: var(--kit-accordion-fg);
86
+ background: var(--kit-accordion-bg);
87
+ }
88
+
89
+ .kit-accordion[data-spacer='true'] {
90
+ --kit-accordion-gap: 1rem;
91
+ }
92
+
93
+ .kit-accordion[data-rounded='0'] {
94
+ --kit-accordion-radius: 0;
95
+ }
96
+
97
+ .kit-accordion[data-rounded='xs'] {
98
+ --kit-accordion-radius: 2px;
99
+ }
100
+
101
+ .kit-accordion[data-rounded='sm'] {
102
+ --kit-accordion-radius: 4px;
103
+ }
104
+
105
+ .kit-accordion[data-rounded='md'] {
106
+ --kit-accordion-radius: 8px;
107
+ }
108
+
109
+ .kit-accordion[data-rounded='lg'] {
110
+ --kit-accordion-radius: 16px;
111
+ }
112
+
113
+ .kit-accordion[data-rounded='xl'] {
114
+ --kit-accordion-radius: 99999px;
115
+ }
116
+
117
+ .kit-accordion[data-hide-icon='true'] :global(.kit-accordion-item__indicator) {
118
+ display: none;
119
+ }
120
+ </style>
@@ -1,4 +1,4 @@
1
- import type { AccordionProps } from './types.js';
1
+ import type { AccordionProps } from './accordion.types.ts';
2
2
  declare const Accordion: import("svelte").Component<AccordionProps, {}, "ref">;
3
3
  type Accordion = ReturnType<typeof Accordion>;
4
4
  export default Accordion;