@dvcol/neo-svelte 0.1.1

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 (163) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/LICENSE +21 -0
  3. package/README.md +89 -0
  4. package/dist/assets/neo-icon-resizer-bottom-right.svg +5 -0
  5. package/dist/buttons/NeoButton.svelte +466 -0
  6. package/dist/buttons/NeoButton.svelte.d.ts +19 -0
  7. package/dist/buttons/NeoButtonGroup.svelte +369 -0
  8. package/dist/buttons/NeoButtonGroup.svelte.d.ts +19 -0
  9. package/dist/buttons/index.d.ts +4 -0
  10. package/dist/buttons/index.js +2 -0
  11. package/dist/buttons/neo-button-group.model.d.ts +71 -0
  12. package/dist/buttons/neo-button-group.model.js +1 -0
  13. package/dist/buttons/neo-button.model.d.ts +110 -0
  14. package/dist/buttons/neo-button.model.js +1 -0
  15. package/dist/cards/NeoCard.svelte +413 -0
  16. package/dist/cards/NeoCard.svelte.d.ts +19 -0
  17. package/dist/cards/index.d.ts +2 -0
  18. package/dist/cards/index.js +1 -0
  19. package/dist/cards/neo-card.model.d.ts +129 -0
  20. package/dist/cards/neo-card.model.js +1 -0
  21. package/dist/containers/NeoTransitionContainer.svelte +34 -0
  22. package/dist/containers/NeoTransitionContainer.svelte.d.ts +19 -0
  23. package/dist/containers/index.d.ts +2 -0
  24. package/dist/containers/index.js +1 -0
  25. package/dist/containers/neo-transition-container.model.d.ts +25 -0
  26. package/dist/containers/neo-transition-container.model.js +1 -0
  27. package/dist/divider/NeoDivider.svelte +47 -0
  28. package/dist/divider/NeoDivider.svelte.d.ts +19 -0
  29. package/dist/divider/index.d.ts +2 -0
  30. package/dist/divider/index.js +1 -0
  31. package/dist/divider/neo-divider.model.d.ts +7 -0
  32. package/dist/divider/neo-divider.model.js +1 -0
  33. package/dist/icons/IconAccount.svelte +10 -0
  34. package/dist/icons/IconAccount.svelte.d.ts +26 -0
  35. package/dist/icons/IconAdd.svelte +10 -0
  36. package/dist/icons/IconAdd.svelte.d.ts +26 -0
  37. package/dist/icons/IconAlert.svelte +14 -0
  38. package/dist/icons/IconAlert.svelte.d.ts +26 -0
  39. package/dist/icons/IconCircleLoading.svelte +16 -0
  40. package/dist/icons/IconCircleLoading.svelte.d.ts +26 -0
  41. package/dist/icons/IconClear.svelte +10 -0
  42. package/dist/icons/IconClear.svelte.d.ts +26 -0
  43. package/dist/icons/IconClose.svelte +14 -0
  44. package/dist/icons/IconClose.svelte.d.ts +26 -0
  45. package/dist/icons/IconConfirm.svelte +10 -0
  46. package/dist/icons/IconConfirm.svelte.d.ts +26 -0
  47. package/dist/icons/IconEmpty.svelte +10 -0
  48. package/dist/icons/IconEmpty.svelte.d.ts +26 -0
  49. package/dist/icons/IconFileUpload.svelte +18 -0
  50. package/dist/icons/IconFileUpload.svelte.d.ts +26 -0
  51. package/dist/icons/IconGithub.svelte +29 -0
  52. package/dist/icons/IconGithub.svelte.d.ts +26 -0
  53. package/dist/icons/IconImage.svelte +18 -0
  54. package/dist/icons/IconImage.svelte.d.ts +26 -0
  55. package/dist/icons/IconMinus.svelte +14 -0
  56. package/dist/icons/IconMinus.svelte.d.ts +26 -0
  57. package/dist/icons/IconMoon.svelte +64 -0
  58. package/dist/icons/IconMoon.svelte.d.ts +26 -0
  59. package/dist/icons/IconSave.svelte +15 -0
  60. package/dist/icons/IconSave.svelte.d.ts +26 -0
  61. package/dist/icons/IconSaveOff.svelte +19 -0
  62. package/dist/icons/IconSaveOff.svelte.d.ts +26 -0
  63. package/dist/icons/IconSearch.svelte +14 -0
  64. package/dist/icons/IconSearch.svelte.d.ts +26 -0
  65. package/dist/icons/IconSun.svelte +54 -0
  66. package/dist/icons/IconSun.svelte.d.ts +26 -0
  67. package/dist/icons/IconSunrise.svelte +24 -0
  68. package/dist/icons/IconSunrise.svelte.d.ts +26 -0
  69. package/dist/icons/IconVideo.svelte +15 -0
  70. package/dist/icons/IconVideo.svelte.d.ts +26 -0
  71. package/dist/icons/IconWatch.svelte +21 -0
  72. package/dist/icons/IconWatch.svelte.d.ts +26 -0
  73. package/dist/icons/IconWatchOff.svelte +26 -0
  74. package/dist/icons/IconWatchOff.svelte.d.ts +26 -0
  75. package/dist/index.d.ts +8 -0
  76. package/dist/index.js +8 -0
  77. package/dist/inputs/NeoInput.svelte +750 -0
  78. package/dist/inputs/NeoInput.svelte.d.ts +27 -0
  79. package/dist/inputs/NeoPassword.svelte +31 -0
  80. package/dist/inputs/NeoPassword.svelte.d.ts +19 -0
  81. package/dist/inputs/NeoTextarea.svelte +768 -0
  82. package/dist/inputs/NeoTextarea.svelte.d.ts +27 -0
  83. package/dist/inputs/NeoValidation.svelte +106 -0
  84. package/dist/inputs/NeoValidation.svelte.d.ts +22 -0
  85. package/dist/inputs/index.d.ts +4 -0
  86. package/dist/inputs/index.js +3 -0
  87. package/dist/inputs/neo-input.model.d.ts +234 -0
  88. package/dist/inputs/neo-input.model.js +10 -0
  89. package/dist/inputs/neo-validation.model.d.ts +40 -0
  90. package/dist/inputs/neo-validation.model.js +1 -0
  91. package/dist/nav/NeoTab.svelte +170 -0
  92. package/dist/nav/NeoTab.svelte.d.ts +19 -0
  93. package/dist/nav/NeoTabPanel.svelte +75 -0
  94. package/dist/nav/NeoTabPanel.svelte.d.ts +19 -0
  95. package/dist/nav/NeoTabs.svelte +288 -0
  96. package/dist/nav/NeoTabs.svelte.d.ts +19 -0
  97. package/dist/nav/NeoTabsCard.svelte +47 -0
  98. package/dist/nav/NeoTabsCard.svelte.d.ts +19 -0
  99. package/dist/nav/index.d.ts +8 -0
  100. package/dist/nav/index.js +4 -0
  101. package/dist/nav/neo-tab-panel.model.d.ts +30 -0
  102. package/dist/nav/neo-tab-panel.model.js +1 -0
  103. package/dist/nav/neo-tab.model.d.ts +43 -0
  104. package/dist/nav/neo-tab.model.js +1 -0
  105. package/dist/nav/neo-tabs-card.model.d.ts +25 -0
  106. package/dist/nav/neo-tabs-card.model.js +5 -0
  107. package/dist/nav/neo-tabs-context.svelte.d.ts +82 -0
  108. package/dist/nav/neo-tabs-context.svelte.js +163 -0
  109. package/dist/nav/neo-tabs.model.d.ts +60 -0
  110. package/dist/nav/neo-tabs.model.js +1 -0
  111. package/dist/providers/NeoThemeProvider.svelte +28 -0
  112. package/dist/providers/NeoThemeProvider.svelte.d.ts +21 -0
  113. package/dist/providers/NeoThemeSelector.svelte +79 -0
  114. package/dist/providers/NeoThemeSelector.svelte.d.ts +19 -0
  115. package/dist/providers/index.d.ts +5 -0
  116. package/dist/providers/index.js +3 -0
  117. package/dist/providers/neo-theme-provider-context.svelte.d.ts +26 -0
  118. package/dist/providers/neo-theme-provider-context.svelte.js +78 -0
  119. package/dist/providers/neo-theme-provider.model.d.ts +35 -0
  120. package/dist/providers/neo-theme-provider.model.js +20 -0
  121. package/dist/providers/neo-theme-selector.model.d.ts +6 -0
  122. package/dist/providers/neo-theme-selector.model.js +1 -0
  123. package/dist/skeletons/NeoSkeletonContainer.svelte +48 -0
  124. package/dist/skeletons/NeoSkeletonContainer.svelte.d.ts +19 -0
  125. package/dist/skeletons/NeoSkeletonMedia.svelte +146 -0
  126. package/dist/skeletons/NeoSkeletonMedia.svelte.d.ts +19 -0
  127. package/dist/skeletons/NeoSkeletonText.svelte +170 -0
  128. package/dist/skeletons/NeoSkeletonText.svelte.d.ts +19 -0
  129. package/dist/skeletons/index.d.ts +4 -0
  130. package/dist/skeletons/index.js +2 -0
  131. package/dist/skeletons/neo-skeleton-container.model.d.ts +29 -0
  132. package/dist/skeletons/neo-skeleton-container.model.js +1 -0
  133. package/dist/skeletons/neo-skeleton-media.model.d.ts +40 -0
  134. package/dist/skeletons/neo-skeleton-media.model.js +1 -0
  135. package/dist/skeletons/neo-skeleton-text.model.d.ts +45 -0
  136. package/dist/skeletons/neo-skeleton-text.model.js +1 -0
  137. package/dist/styles/animation.scss +75 -0
  138. package/dist/styles/common/colors.scss +217 -0
  139. package/dist/styles/common/flex.scss +26 -0
  140. package/dist/styles/common/properties.css +23 -0
  141. package/dist/styles/common/shadows.scss +305 -0
  142. package/dist/styles/common/spacing.scss +27 -0
  143. package/dist/styles/common/typography.scss +13 -0
  144. package/dist/styles/common/utils.scss +8 -0
  145. package/dist/styles/common/z-index.scss +12 -0
  146. package/dist/styles/mixin.scss +225 -0
  147. package/dist/styles/reset.scss +81 -0
  148. package/dist/styles/theme.scss +22 -0
  149. package/dist/utils/action.utils.d.ts +52 -0
  150. package/dist/utils/action.utils.js +30 -0
  151. package/dist/utils/error.utils.d.ts +25 -0
  152. package/dist/utils/error.utils.js +35 -0
  153. package/dist/utils/html-element.utils.d.ts +22 -0
  154. package/dist/utils/html-element.utils.js +1 -0
  155. package/dist/utils/logger.utils.d.ts +14 -0
  156. package/dist/utils/logger.utils.js +31 -0
  157. package/dist/utils/shadow.utils.d.ts +8 -0
  158. package/dist/utils/shadow.utils.js +26 -0
  159. package/dist/utils/timeout.util.d.ts +5 -0
  160. package/dist/utils/timeout.util.js +15 -0
  161. package/dist/utils/transition.utils.d.ts +5 -0
  162. package/dist/utils/transition.utils.js +8 -0
  163. package/package.json +180 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,58 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
+
5
+ ### 0.1.1 (2024-11-25)
6
+
7
+
8
+ ### Features
9
+
10
+ * **button-groups:** adds button groups ([92c23bf](https://github.com/dvcol/neo-svelte/commit/92c23bf1cef47a06ca1f01d407e204a9d675ca21))
11
+ * **button:** adds glass button style ([287f7fe](https://github.com/dvcol/neo-svelte/commit/287f7fe4eaec6ef6907c1aa31def0b2b95d8e6f7))
12
+ * **button:** adds initial setup & button component ([f3c6237](https://github.com/dvcol/neo-svelte/commit/f3c62378bd29b950c77de1d4599c96432355d41a))
13
+ * **button:** adds skeleton state ([c1bae7c](https://github.com/dvcol/neo-svelte/commit/c1bae7c23a5474bd4746e109a9963681b3019fd1))
14
+ * **button:** adds support for anchor buttons ([6919204](https://github.com/dvcol/neo-svelte/commit/6919204bed54b9b93b8192f52e88e8bc0a653012))
15
+ * **buttons:** adds shallow styling for buttons & tabs ([3bbb5d7](https://github.com/dvcol/neo-svelte/commit/3bbb5d79f6e9dc75930feff5c37608e9b58ae5cd))
16
+ * **cards:** adds card segments ([c7eb3df](https://github.com/dvcol/neo-svelte/commit/c7eb3dfc7683b8c3c50544650361de690a3d0c0e))
17
+ * **cards:** first commit about cards ([50496e4](https://github.com/dvcol/neo-svelte/commit/50496e4c5673f1346b4b06e47817be4aea1b65ce))
18
+ * **card:** supports close button ([8d0bff1](https://github.com/dvcol/neo-svelte/commit/8d0bff16cf52e636429291fd45a1fed87c66e437))
19
+ * **card:** supports horizontal view ([71699c3](https://github.com/dvcol/neo-svelte/commit/71699c32bd9d9b2613b113737dad665c4a5f5321))
20
+ * **glass:** adds saturation ([aee2cd9](https://github.com/dvcol/neo-svelte/commit/aee2cd9462433be0296ba0dd754e6b6995a1725b))
21
+ * **groups:** adds recessed style to groups & tabs ([98ce6dc](https://github.com/dvcol/neo-svelte/commit/98ce6dc0aeb52b5a5a0bafceb7407a0e51c957b9))
22
+ * **input:** adds basic label support ([473b4c7](https://github.com/dvcol/neo-svelte/commit/473b4c79dc540caa74a69e419b6d869c8c283f28))
23
+ * **input:** adds first draft of text area ([902d43c](https://github.com/dvcol/neo-svelte/commit/902d43ced6e7bafd2abded70595813f74e43900c))
24
+ * **input:** adds text-area auto-resize ([c8892af](https://github.com/dvcol/neo-svelte/commit/c8892af1d861b103958739224433f0bb68014760))
25
+ * **input:** adds text-area scrollbar ([0752d22](https://github.com/dvcol/neo-svelte/commit/0752d22d1204af900efa8f3ef701b77f58c07ba9))
26
+ * **input:** initial commit for inputs ([df5f565](https://github.com/dvcol/neo-svelte/commit/df5f565271109187d53d21024bd19d888ba02544))
27
+ * **input:** input password ([82abf80](https://github.com/dvcol/neo-svelte/commit/82abf8079a3c0f0b0ecbb9fb7cd930defcb40bce))
28
+ * **input:** refactor validation ([9f5940a](https://github.com/dvcol/neo-svelte/commit/9f5940a6ddded79c04de2514e7067385374c400f))
29
+ * **input:** standard inputs ([fc5df4a](https://github.com/dvcol/neo-svelte/commit/fc5df4afb7347aa780db6f228c71e0b9065ba426))
30
+ * **input:** support validation ([b323288](https://github.com/dvcol/neo-svelte/commit/b3232889523429db24eca274198a1f3da323244b))
31
+ * **input:** switch to translate instead of absolute ([32e117e](https://github.com/dvcol/neo-svelte/commit/32e117e9003ffe5b2ec1cc5a1ca1e9dc87fb0b65))
32
+ * **package:** adds index & exports ([506fcea](https://github.com/dvcol/neo-svelte/commit/506fceaa9980f451af228cedb6baa1eb3a8ba3f2))
33
+ * **provider:** adds theme provider & selector ([93f68e6](https://github.com/dvcol/neo-svelte/commit/93f68e65741fc257b96dce0ba1c5ae2f4c81d4d0))
34
+ * **shadows:** adds light source origin ([6ea598c](https://github.com/dvcol/neo-svelte/commit/6ea598cae648411c6b1414d6188cbe630722f157))
35
+ * **skeleton:** adds skeleton & various fixes ([96994a8](https://github.com/dvcol/neo-svelte/commit/96994a800f9dfb3cdd12d17374a2f112efd83953))
36
+ * **style:** adds dark mode support ([b0a9422](https://github.com/dvcol/neo-svelte/commit/b0a942212a3db1a24e8c958de931912d93c8baf4))
37
+ * **styles:** adds border loading & progress ([07b65c2](https://github.com/dvcol/neo-svelte/commit/07b65c20755f25370f04760576e32511440ae16c))
38
+ * **TabBar:** adds slider animation ([1fd438a](https://github.com/dvcol/neo-svelte/commit/1fd438a3c86c5856e20d53f513624bf9e7c98e02))
39
+ * **tabs:** adds animated tab card wrapper ([105202c](https://github.com/dvcol/neo-svelte/commit/105202c796d76f7fe8446aef85f7ddd7c48d3bda))
40
+ * **tabs:** adds base tab bar component ([9864b86](https://github.com/dvcol/neo-svelte/commit/9864b86ce56df1ba4b225ce5714fd55cb73e8543))
41
+ * **tabs:** adds pane to tabs ([0e6d0fa](https://github.com/dvcol/neo-svelte/commit/0e6d0fab0e120e3ae0acd1eb2aca33955296606e))
42
+ * **theme:** adds light/dark theme toggle ([6a33674](https://github.com/dvcol/neo-svelte/commit/6a3367457bf42f9cfa6a70b4899895610f993ddc))
43
+
44
+
45
+ ### Bug Fixes
46
+
47
+ * **a11y:** update aria dynamically ([a151753](https://github.com/dvcol/neo-svelte/commit/a151753d46a4828c307e110ceb3f2860b707d9fc))
48
+ * **button:** remove border rotate ([03a6c14](https://github.com/dvcol/neo-svelte/commit/03a6c14440ff1fda1a4f63832b21cd0e21995aee))
49
+ * **buttons:** fix line styling & rework action binding ([62b9544](https://github.com/dvcol/neo-svelte/commit/62b9544aab91581447c033f012e46547cb0b0e8c))
50
+ * **card:** show close on hover & fix focus-visible color ([23026ee](https://github.com/dvcol/neo-svelte/commit/23026eeb90c3ecd51e93d4a1e767d43766abba73))
51
+ * **css:** adjust css and switch to semantic tags ([b5d80d8](https://github.com/dvcol/neo-svelte/commit/b5d80d816dbb81dde1adc54cfe31759412c4d10e))
52
+ * **elevation:** remove half steps ([4f9801e](https://github.com/dvcol/neo-svelte/commit/4f9801e31d22f17eb4b9e9f6a566e2079be6ba6a))
53
+ * **input:** support floating positions labels ([f249aec](https://github.com/dvcol/neo-svelte/commit/f249aec28a8b134f6b777c00717f26e49fbaa590))
54
+ * **lint:** fix various ts errors ([63c19e9](https://github.com/dvcol/neo-svelte/commit/63c19e9449b501893d98f5419c3fd5f3ee34ad6e))
55
+ * **panes:** get animate state from context if not provided ([a2510a6](https://github.com/dvcol/neo-svelte/commit/a2510a659ecd7bc670c968fba255e51543fe0b46))
56
+ * **spacing:** adjust margin and elevation ([45f0858](https://github.com/dvcol/neo-svelte/commit/45f0858492de4028c3d2b3bc33f2d078b1269a8b))
57
+ * **spacing:** adjust shadow margin ([a1ea01f](https://github.com/dvcol/neo-svelte/commit/a1ea01fd677985c7eea7a94628df6bf28ad014d1))
58
+ * **tabs:** adds flex override and nowrap ([02cfac5](https://github.com/dvcol/neo-svelte/commit/02cfac5839ca7c79989173338e72b04d23ccd3b6))
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Dinh-Van Colomban
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # neo-svelte
2
+ Neomorphic ui library for svelte 5
3
+
4
+ ## TODO
5
+ - [ ] @media any-pointer:coarse any-hover:none
6
+ - [x] Buttons
7
+ - [x] Tabs
8
+ - [x] Card
9
+ - [x] Inputs
10
+ - [x] Password
11
+ - [ ] Color picker
12
+ - [ ] numbers
13
+ - [ } digits
14
+ - [ ] range
15
+ - [ ] animation ?
16
+ - [ ] currency
17
+ - [ ] percentage
18
+ - [ ] phone
19
+ - [ ] credit card
20
+ - [ ] pin
21
+ - [ ] slider
22
+ - [ ] range
23
+ - [ ] steps/ticks
24
+ - [ ] labels
25
+ - [ ] file picker
26
+ - [ ] drag & drop ?
27
+ - [ ] progress ?
28
+ - [ ] multiple
29
+ - [ ] select
30
+ - [ ] Text Area
31
+ - [ ] lines
32
+ - [ ] auto-resize
33
+ - [ ] @ / # tags
34
+ - [ ] time/date/week
35
+ - [ ] range
36
+ - [ ] switch
37
+ - [ ] loading
38
+ - [ ] border loading
39
+ - [ ] skeleton
40
+ - [ ] checkbox
41
+ - [ ] checkbox (square & round)
42
+ - [ ] radio
43
+ - [ ] groups
44
+ - [ ] auto-complete
45
+ - [ ] @ / # tags
46
+ - [ ] select
47
+ - [ ] multiple
48
+ - [ ] auto-complete
49
+ - [ ] @ / # tags
50
+
51
+ - [ ] image
52
+ - [ ] videos
53
+ - [ ] carousel
54
+ - [ ] avatar
55
+ - [ ] badge
56
+ - [ ] tags/pills
57
+ - [ ] badge
58
+ - [ ] Progress/Loading
59
+ - [ ] bar
60
+ - [ ] circle
61
+ - [ ] border
62
+ - [ ] background
63
+ - [ ] accordion
64
+ - [ ] summary
65
+ - [ ] details (html semantic tags)
66
+
67
+ - [ ] tooltip
68
+ - [ ] popconfirm
69
+ - [ ] popselect
70
+ - [ ] text
71
+ - [ ] elevation
72
+ - [ ] elipsis
73
+
74
+ - [ ] Alerts
75
+ - [ ] toast
76
+ - [ ] rich notification
77
+ - [ ] Modal/dialog
78
+ - [ ] drawer/panel
79
+ - [ ] collapsible
80
+ - [ ] position
81
+ - [ ] backdrop
82
+ - [ ] click outside
83
+ - [ ] scrollbar ?
84
+ - [ ] container
85
+ - [ ] transition
86
+ - [ ] split/resizable
87
+ - [ ] flex
88
+ - [ ] grid
89
+ - [ ] masonry ?
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <svg width="1em" height="1em" opacity="0.5" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M21 15L15 21M21 8L8 21" stroke="#a49fa4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
4
+ </svg>
5
+
@@ -0,0 +1,466 @@
1
+ <script lang="ts">
2
+ import { width } from '@dvcol/svelte-utils/transition';
3
+
4
+ import type { NeoButtonProps } from './neo-button.model.js';
5
+
6
+ import IconCircleLoading from '../icons/IconCircleLoading.svelte';
7
+ import { toAction, toActionProps, toTransition, toTransitionProps } from '../utils/action.utils.js';
8
+ import { enterDefaultTransition } from '../utils/transition.utils.js';
9
+
10
+ /* eslint-disable prefer-const -- necessary for binding checked */
11
+ let {
12
+ // Snippets
13
+ children,
14
+ icon,
15
+
16
+ // States
17
+ ref = $bindable(),
18
+ tag,
19
+ href,
20
+ loading,
21
+ skeleton,
22
+ disabled,
23
+ empty: only,
24
+ toggle,
25
+ readonly,
26
+ checked = $bindable(false),
27
+
28
+ // Styles
29
+ borderless,
30
+ start,
31
+ text,
32
+ flat,
33
+ glass,
34
+ shallow,
35
+ rounded,
36
+ reverse,
37
+ coalesce,
38
+ pulse,
39
+
40
+ // Flex
41
+ justify,
42
+ align,
43
+ flex,
44
+
45
+ // Events
46
+ onchecked,
47
+ onclick,
48
+ onkeydown,
49
+ onkeyup,
50
+
51
+ // Transition
52
+ in: inAction,
53
+ out: outAction,
54
+ transition: transitionAction,
55
+
56
+ // Actions
57
+ use,
58
+
59
+ // Other props
60
+ ...rest
61
+ }: NeoButtonProps = $props();
62
+ /* eslint-enable prefer-const */
63
+
64
+ let enter = $state(false);
65
+ let active = $state(false);
66
+ const pressed = $derived(enter || active || checked);
67
+ const empty = $derived(only || !children);
68
+
69
+ let timeout: ReturnType<typeof setTimeout>;
70
+ const onActive = () => {
71
+ clearTimeout(timeout);
72
+ active = true;
73
+ timeout = setTimeout(() => {
74
+ active = false;
75
+ }, 150);
76
+ };
77
+
78
+ const onClick = (e: MouseEvent) => {
79
+ if (loading || disabled) return;
80
+ if (toggle) {
81
+ if (!readonly) checked = !checked;
82
+ onchecked?.(checked);
83
+ onclick?.(e, checked);
84
+ return;
85
+ }
86
+
87
+ onclick?.(e);
88
+ onActive();
89
+ };
90
+
91
+ const onKeydownEnter = (e: KeyboardEvent) => {
92
+ if (loading || disabled) return;
93
+ if (e.key === 'Enter') enter = true;
94
+ onkeydown?.(e);
95
+ };
96
+
97
+ const onKeyUpEnter = (e: KeyboardEvent) => {
98
+ if (e.key === 'Enter') enter = false;
99
+ if (loading || disabled) return;
100
+ onkeyup?.(e);
101
+ };
102
+
103
+ const element = $derived(tag ?? (href ? 'a' : 'button'));
104
+ const role = $derived(!['button', 'a'].includes(element) ? 'button' : undefined);
105
+ const tabindex = $derived(!disabled && role ? 0 : undefined);
106
+
107
+ const inFn = $derived(toTransition(inAction ?? transitionAction));
108
+ const inProps = $derived(toTransitionProps(inAction ?? transitionAction));
109
+ const outFn = $derived(toTransition(outAction ?? transitionAction));
110
+ const outProps = $derived(toTransitionProps(outAction ?? transitionAction));
111
+
112
+ const useFn = $derived(toAction(use));
113
+ const useProps = $derived(toActionProps(use));
114
+ </script>
115
+
116
+ <svelte:element
117
+ this={element}
118
+ bind:this={ref}
119
+ {href}
120
+ {role}
121
+ {tabindex}
122
+ class:neo-button={true}
123
+ class:pulse
124
+ class:coalesce
125
+ class:pressed
126
+ class:loading
127
+ class:skeleton
128
+ class:start
129
+ class:glass
130
+ class:flat={flat || text}
131
+ class:borderless={borderless || text}
132
+ class:shallow
133
+ class:rounded
134
+ class:empty
135
+ style:justify-content={justify}
136
+ style:align-items={align}
137
+ style:flex
138
+ use:useFn={useProps}
139
+ out:outFn={outProps}
140
+ in:inFn={inProps}
141
+ onkeydown={onKeydownEnter}
142
+ onkeyup={onKeyUpEnter}
143
+ onclick={onClick}
144
+ disabled={disabled || skeleton}
145
+ {...rest}
146
+ >
147
+ <span class="content" class:reverse>
148
+ {#if loading || icon}
149
+ <span class="icon" class:only={empty} transition:width={enterDefaultTransition}>
150
+ {#if loading}
151
+ <IconCircleLoading />
152
+ {:else}
153
+ {@render icon?.()}
154
+ {/if}
155
+ </span>
156
+ {/if}
157
+ {#if !empty}
158
+ {@render children?.()}
159
+ {/if}
160
+ </span>
161
+ </svelte:element>
162
+
163
+ <style>.neo-button.pulse::after, .neo-button.pulse::before, .neo-button.coalesce::after, .neo-button.coalesce::before {
164
+ position: absolute;
165
+ top: 0;
166
+ left: 0;
167
+ z-index: var(--neo-z-index-behind, -1);
168
+ display: flex;
169
+ width: 100%;
170
+ height: 100%;
171
+ border-radius: inherit;
172
+ opacity: 0;
173
+ content: "";
174
+ }
175
+
176
+ .neo-button {
177
+ display: flex;
178
+ align-items: center;
179
+ justify-content: center;
180
+ box-sizing: border-box;
181
+ min-height: calc(var(--neo-btn-min-height, var(--neo-line-height)) + 0.5rem);
182
+ margin: var(--neo-shadow-margin, 0.6rem);
183
+ padding: 0.25rem 0.75rem;
184
+ color: var(--neo-btn-text-color, inherit);
185
+ font: inherit;
186
+ text-decoration: inherit;
187
+ background-color: var(--neo-btn-bg-color, transparent);
188
+ border: var(--neo-border-width, 1px) var(--neo-btn-border-color, transparent) solid;
189
+ border-radius: var(--neo-btn-border-radius, var(--neo-border-radius));
190
+ box-shadow: var(--neo-box-shadow-raised-3);
191
+ cursor: pointer;
192
+ transition: opacity 0.3s ease, color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease, border-radius 0.3s ease, box-shadow 0.3s ease-out;
193
+ }
194
+ .neo-button.empty {
195
+ padding: 0.5rem;
196
+ }
197
+ .neo-button.loading {
198
+ cursor: wait;
199
+ }
200
+ .neo-button.borderless {
201
+ border-color: transparent !important;
202
+ }
203
+ .neo-button.flat, .neo-button.shallow {
204
+ --neo-coalesce-box-shadow: var(--neo-box-shadow-raised-2);
205
+ --neo-pulse-box-shadow: var(--neo-box-shadow-raised-2);
206
+ }
207
+ .neo-button.shallow {
208
+ --neo-coalesce-box-shadow-reverse: var(--neo-box-shadow-inset-1);
209
+ --neo-pulse-box-shadow-reverse: var(--neo-box-shadow-inset-1);
210
+ }
211
+ .neo-button:hover {
212
+ color: var(--neo-btn-text-color-hover, inherit);
213
+ }
214
+ .neo-button.glass {
215
+ background-color: var(--neo-btn-bg-color, var(--neo-glass-background-color));
216
+ box-shadow: var(--neo-glass-box-shadow-raised-3);
217
+ backdrop-filter: var(--neo-blur-4) var(--neo-saturate-2);
218
+ }
219
+ .neo-button.glass:focus-visible {
220
+ background-color: var(--neo-glass-background-color-focus);
221
+ box-shadow: var(--neo-glass-box-shadow-raised-2);
222
+ }
223
+ .neo-button.glass.pressed, .neo-button.glass:active {
224
+ box-shadow: var(--neo-glass-box-shadow-inset-3);
225
+ backdrop-filter: var(--neo-blur-2) var(--neo-saturate-3);
226
+ }
227
+ .neo-button.glass.pressed.shallow, .neo-button.glass:active.shallow {
228
+ box-shadow: var(--neo-glass-box-shadow-flat);
229
+ }
230
+ .neo-button.glass:not(:hover, :active, .neo-button.glass.pressed, .neo-button.glass.skeleton) {
231
+ border-color: var(--neo-btn-border-color, var(--neo-glass-top-border-color) var(--neo-glass-right-border-color) var(--neo-glass-bottom-border-color) var(--neo-glass-left-border-color));
232
+ }
233
+ .neo-button.glass.loading:active:not(.pressed), .neo-button.glass:hover:not(:active, .neo-button.glass.pressed) {
234
+ background-color: var(--neo-glass-background-color-hover);
235
+ border-color: var(--neo-btn-border-color-hover, var(--neo-glass-border-color-hover));
236
+ box-shadow: var(--neo-box-shadow-flat);
237
+ backdrop-filter: var(--neo-blur-3) var(--neo-saturate-2);
238
+ }
239
+ .neo-button.glass.loading:active:not(.pressed).shallow, .neo-button.glass:hover:not(:active, .neo-button.glass.pressed).shallow {
240
+ border-color: transparent;
241
+ box-shadow: var(--neo-glass-box-shadow-raised-2);
242
+ }
243
+ .neo-button.pressed, .neo-button:active {
244
+ color: var(--neo-btn-text-color-active, var(--neo-text-color-active));
245
+ box-shadow: var(--neo-box-shadow-inset-3);
246
+ transition: opacity 0.3s ease, color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease, border-radius 0.3s ease, box-shadow 0.15s ease-out;
247
+ }
248
+ .neo-button.pressed.shallow, .neo-button:active.shallow {
249
+ box-shadow: var(--neo-box-shadow-flat);
250
+ }
251
+ .neo-button.pressed.shallow.flat, .neo-button:active.shallow.flat {
252
+ box-shadow: var(--neo-box-shadow-inset-2);
253
+ }
254
+ .neo-button.pressed.shallow:not(.flat, .glass, .loading), .neo-button:active.shallow:not(.flat, .glass, .loading) {
255
+ border-color: var(--neo-btn-border-color, var(--neo-border-color));
256
+ }
257
+ .neo-button:focus-visible {
258
+ color: var(--neo-btn-text-color-focused, var(--neo-text-color-focused));
259
+ outline: none;
260
+ transition: opacity 0.3s ease, color 0s, background-color 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease, border-radius 0.3s ease, box-shadow 0.15s ease-out;
261
+ }
262
+ .neo-button:focus-visible:hover {
263
+ color: var(--neo-btn-text-color-focused-hover, var(--neo-text-color-focused));
264
+ }
265
+ .neo-button:focus-visible.pressed, .neo-button:focus-visible:active {
266
+ color: var(--neo-btn-text-color-focused-active, var(--neo-text-color-focused-active));
267
+ }
268
+ .neo-button:focus-visible:not(.pressed, :active) {
269
+ box-shadow: var(--neo-box-shadow-raised-2);
270
+ }
271
+ .flat:not(:active, :hover, .neo-button.pressed):focus-visible {
272
+ border-color: var(--neo-btn-border-color-focused, var(--neo-border-color-focused));
273
+ }
274
+ @starting-style {
275
+ .neo-button.start {
276
+ box-shadow: var(--neo-box-shadow-flat);
277
+ }
278
+ .neo-button.start:not(.borderless, .glass) {
279
+ border-color: var(--neo-btn-border-color, var(--neo-border-color));
280
+ }
281
+ }
282
+ .neo-button:disabled:not(.skeleton), .neo-button[disabled]:not([disabled=false], .skeleton) {
283
+ color: var(--neo-btn-text-color-disabled, var(--neo-text-color-disabled)) !important;
284
+ cursor: not-allowed;
285
+ opacity: var(--neo-btn-opacity-disabled, var(--neo-opacity-disabled));
286
+ }
287
+ .neo-button:disabled:not(.skeleton):not(.pressed), .neo-button[disabled]:not([disabled=false], .skeleton):not(.pressed) {
288
+ box-shadow: var(--neo-box-shadow-flat);
289
+ }
290
+ .neo-button:disabled:not(.skeleton):not(.borderless), .neo-button[disabled]:not([disabled=false], .skeleton):not(.borderless) {
291
+ border-color: var(--neo-btn-border-color-disabled, var(--neo-border-color-disabled)) !important;
292
+ }
293
+ .neo-button:disabled:not(.skeleton)::after, .neo-button:disabled:not(.skeleton)::before, .neo-button[disabled]:not([disabled=false], .skeleton)::after, .neo-button[disabled]:not([disabled=false], .skeleton)::before {
294
+ box-shadow: none;
295
+ animation-play-state: paused;
296
+ }
297
+ .neo-button.flat:not(:active, .neo-button.pressed), .neo-button.loading:active:not(.pressed), .neo-button:hover:not(:active, .neo-button.pressed) {
298
+ box-shadow: var(--neo-box-shadow-flat);
299
+ }
300
+ .neo-button.flat:not(:active, .neo-button.pressed):not(.glass, .borderless, .flat:hover, .flat:focus-visible, .shallow:not(.flat)), .neo-button.loading:active:not(.pressed):not(.glass, .borderless, .flat:hover, .flat:focus-visible, .shallow:not(.flat)), .neo-button:hover:not(:active, .neo-button.pressed):not(.glass, .borderless, .flat:hover, .flat:focus-visible, .shallow:not(.flat)) {
301
+ border-color: var(--neo-btn-border-color-hover, var(--neo-border-color));
302
+ }
303
+ .neo-button.flat:not(:active, .neo-button.pressed).shallow:not(.flat, .glass), .neo-button.loading:active:not(.pressed).shallow:not(.flat, .glass), .neo-button:hover:not(:active, .neo-button.pressed).shallow:not(.flat, .glass) {
304
+ box-shadow: var(--neo-box-shadow-raised-2);
305
+ }
306
+ .neo-button.flat.loading:active:not(.pressed), .neo-button.flat:hover:not(:active, .neo-button.pressed) {
307
+ box-shadow: var(--neo-box-shadow-inset-2);
308
+ }
309
+ .neo-button.flat.loading:active:not(.pressed).shallow, .neo-button.flat:hover:not(:active, .neo-button.pressed).shallow {
310
+ box-shadow: var(--neo-box-shadow-inset-1);
311
+ }
312
+ .neo-button.skeleton {
313
+ box-shadow: var(--neo-box-shadow-flat) !important;
314
+ pointer-events: none;
315
+ --neo-skeleton-color-start: var(--neo-skeleton-color);
316
+ --neo-skeleton-color-end: oklch(from var(--neo-skeleton-color) calc(l - var(--neo-skeleton-color-step, 0.05)) c h);
317
+ color: var(--neo-skeleton-color-start);
318
+ background-color: var(--neo-skeleton-color-start);
319
+ border-color: var(--neo-skeleton-color-start);
320
+ transition: background-color 1s ease, color 1s ease, border-color 1s ease;
321
+ animation: skeleton 3s var(--neo-transition-skeleton) infinite;
322
+ animation-delay: 1s;
323
+ }
324
+ .neo-button.skeleton::before, .neo-button.skeleton::after,
325
+ .neo-button.skeleton :global(> *::before),
326
+ .neo-button.skeleton :global(> *::after),
327
+ .neo-button.skeleton :global(> *) {
328
+ visibility: hidden;
329
+ pointer-events: none;
330
+ }
331
+ @keyframes skeleton {
332
+ 0% {
333
+ color: var(--neo-skeleton-color-start);
334
+ background-color: var(--neo-skeleton-color-start);
335
+ border-color: var(--neo-skeleton-color-start);
336
+ }
337
+ 40% {
338
+ color: var(--neo-skeleton-color-end);
339
+ background-color: var(--neo-skeleton-color-end);
340
+ border-color: var(--neo-skeleton-color-end);
341
+ }
342
+ 80% {
343
+ color: var(--neo-skeleton-color-start);
344
+ background-color: var(--neo-skeleton-color-start);
345
+ border-color: var(--neo-skeleton-color-start);
346
+ }
347
+ 100% {
348
+ color: var(--neo-skeleton-color-start);
349
+ background-color: var(--neo-skeleton-color-start);
350
+ border-color: var(--neo-skeleton-color-start);
351
+ }
352
+ }
353
+ .neo-button.skeleton.glass {
354
+ --neo-skeleton-color: var(--neo-glass-skeleton-color);
355
+ }
356
+ .neo-button.rounded {
357
+ border-radius: var(--neo-btn-border-radius-rounded, var(--neo-border-radius-lg));
358
+ }
359
+ .neo-button.pulse {
360
+ position: relative;
361
+ }
362
+ .neo-button.pulse::after, .neo-button.pulse::before {
363
+ box-shadow: var(--neo-pulse-box-shadow, var(--neo-box-shadow-raised-3));
364
+ will-change: transform, opacity;
365
+ }
366
+ .neo-button.pulse::before {
367
+ animation: pulse var(--neo-pulse-duration, 6s) linear var(--neo-pulse-delay, 1s) infinite;
368
+ }
369
+ .neo-button.pulse::after {
370
+ animation: pulse var(--neo-pulse-duration, 6s) linear calc(var(--neo-pulse-delay, 1s) + var(--neo-pulse-interval, 3s)) infinite;
371
+ }
372
+ .neo-button.pulse.pressed::after, .neo-button.pulse.pressed::before, .neo-button.pulse:focus-visible::after, .neo-button.pulse:focus-visible::before, .neo-button.pulse:hover::after, .neo-button.pulse:hover::before, .neo-button.pulse:active::after, .neo-button.pulse:active::before {
373
+ box-shadow: var(--neo-pulse-box-shadow-reverse, var(--neo-box-shadow-inset-2));
374
+ animation-name: coalesce;
375
+ animation-timing-function: ease-out;
376
+ }
377
+ @keyframes pulse {
378
+ 0% {
379
+ transform: scaleX(1) scaleY(1);
380
+ opacity: 0;
381
+ }
382
+ 25% {
383
+ opacity: 1;
384
+ }
385
+ 100% {
386
+ transform: scaleX(var(--neo-pulse-scale-x, 2)) scaleY(var(--neo-pulse-scale-y, 2));
387
+ opacity: 0;
388
+ }
389
+ }
390
+ @keyframes coalesce {
391
+ 0% {
392
+ transform: scaleX(var(--neo-pulse-scale-x, 2)) scaleY(var(--neo-pulse-scale-y, 2));
393
+ opacity: 0;
394
+ }
395
+ 75% {
396
+ opacity: 1;
397
+ }
398
+ 100% {
399
+ transform: scale(1);
400
+ opacity: 0;
401
+ }
402
+ }
403
+ .neo-button.coalesce {
404
+ position: relative;
405
+ }
406
+ .neo-button.coalesce::after, .neo-button.coalesce::before {
407
+ box-shadow: var(--neo-coalesce-box-shadow, var(--neo-box-shadow-raised-3));
408
+ will-change: transform, opacity;
409
+ }
410
+ .neo-button.coalesce::before {
411
+ animation: coalesce var(--neo-coalesce-duration, 6s) ease-out var(--neo-coalesce-delay, 1s) infinite;
412
+ }
413
+ .neo-button.coalesce::after {
414
+ animation: coalesce var(--neo-coalesce-duration, 6s) ease-out calc(var(--neo-coalesce-delay, 1s) + var(--neo-coalesce-interval, 3s)) infinite;
415
+ }
416
+ .neo-button.coalesce.pressed::after, .neo-button.coalesce.pressed::before, .neo-button.coalesce:focus-visible::after, .neo-button.coalesce:focus-visible::before, .neo-button.coalesce:hover::after, .neo-button.coalesce:hover::before, .neo-button.coalesce:active::after, .neo-button.coalesce:active::before {
417
+ box-shadow: var(--neo-coalesce-box-shadow-reverse, var(--neo-box-shadow-inset-2));
418
+ animation-name: pulse;
419
+ animation-timing-function: linear;
420
+ }
421
+ @keyframes pulse {
422
+ 0% {
423
+ transform: scaleX(1) scaleY(1);
424
+ opacity: 0;
425
+ }
426
+ 25% {
427
+ opacity: 1;
428
+ }
429
+ 100% {
430
+ transform: scaleX(var(--neo-coalesce-scale-x, 2)) scaleY(var(--neo-coalesce-scale-y, 2));
431
+ opacity: 0;
432
+ }
433
+ }
434
+ @keyframes coalesce {
435
+ 0% {
436
+ transform: scaleX(var(--neo-coalesce-scale-x, 2)) scaleY(var(--neo-coalesce-scale-y, 2));
437
+ opacity: 0;
438
+ }
439
+ 75% {
440
+ opacity: 1;
441
+ }
442
+ 100% {
443
+ transform: scale(1);
444
+ opacity: 0;
445
+ }
446
+ }
447
+ .neo-button .icon,
448
+ .neo-button .content {
449
+ display: inline-flex;
450
+ align-items: center;
451
+ justify-content: center;
452
+ }
453
+ .neo-button .content {
454
+ height: 100%;
455
+ }
456
+ .neo-button .content .icon:not(.only) {
457
+ margin-right: var(--neo-btn-icon-gap, 0.35rem);
458
+ margin-left: var(--neo-btn-icon-offset, calc(0.25rem - var(--neo-btn-icon-gap, 0.35rem)));
459
+ }
460
+ .neo-button .content.reverse {
461
+ flex-direction: row-reverse;
462
+ }
463
+ .neo-button .content.reverse .icon:not(.only) {
464
+ margin-right: var(--neo-btn-icon-offset, calc(0.25rem - var(--neo-btn-icon-gap, 0.35rem)));
465
+ margin-left: var(--neo-btn-icon-gap, 0.35rem);
466
+ }</style>
@@ -0,0 +1,19 @@
1
+ import type { NeoButtonProps } from './neo-button.model.js';
2
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
+ $$bindings?: Bindings;
5
+ } & Exports;
6
+ (internal: unknown, props: Props & {
7
+ $$events?: Events;
8
+ $$slots?: Slots;
9
+ }): Exports & {
10
+ $set?: any;
11
+ $on?: any;
12
+ };
13
+ z_$$bindings?: Bindings;
14
+ }
15
+ declare const NeoButton: $$__sveltets_2_IsomorphicComponent<NeoButtonProps, {
16
+ [evt: string]: CustomEvent<any>;
17
+ }, {}, {}, "ref" | "checked">;
18
+ type NeoButton = InstanceType<typeof NeoButton>;
19
+ export default NeoButton;