@warkypublic/svelix 0.1.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 (212) hide show
  1. package/LICENSE +73 -0
  2. package/README.md +3 -0
  3. package/dist/actions/index.d.ts +1 -0
  4. package/dist/actions/index.js +2 -0
  5. package/dist/components/BetterMenu/BetterMenu.stories.js +68 -0
  6. package/dist/components/BetterMenu/BetterMenu.svelte +38 -0
  7. package/dist/components/BetterMenu/BetterMenu.svelte.d.ts +14 -0
  8. package/dist/components/BetterMenu/BetterMenuAsyncButton.svelte +34 -0
  9. package/dist/components/BetterMenu/BetterMenuAsyncButton.svelte.d.ts +8 -0
  10. package/dist/components/BetterMenu/BetterMenuPreview.svelte +43 -0
  11. package/dist/components/BetterMenu/BetterMenuPreview.svelte.d.ts +7 -0
  12. package/dist/components/BetterMenu/MenuRenderer.svelte +75 -0
  13. package/dist/components/BetterMenu/MenuRenderer.svelte.d.ts +6 -0
  14. package/dist/components/BetterMenu/Plan.mdx +155 -0
  15. package/dist/components/BetterMenu/index.d.ts +4 -0
  16. package/dist/components/BetterMenu/index.js +4 -0
  17. package/dist/components/BetterMenu/store.d.ts +10 -0
  18. package/dist/components/BetterMenu/store.js +48 -0
  19. package/dist/components/BetterMenu/types.d.ts +24 -0
  20. package/dist/components/BetterMenu/types.js +1 -0
  21. package/dist/components/Boxer/Boxer.stories.d.ts +19 -0
  22. package/dist/components/Boxer/Boxer.stories.js +102 -0
  23. package/dist/components/Boxer/Boxer.svelte +411 -0
  24. package/dist/components/Boxer/Boxer.svelte.d.ts +11 -0
  25. package/dist/components/Boxer/BoxerTarget.svelte +88 -0
  26. package/dist/components/Boxer/BoxerTarget.svelte.d.ts +20 -0
  27. package/dist/components/Boxer/Plan.mdx +140 -0
  28. package/dist/components/Boxer/features.mdx +81 -0
  29. package/dist/components/Boxer/index.d.ts +4 -0
  30. package/dist/components/Boxer/index.js +4 -0
  31. package/dist/components/Boxer/store.d.ts +26 -0
  32. package/dist/components/Boxer/store.js +103 -0
  33. package/dist/components/Boxer/types.d.ts +46 -0
  34. package/dist/components/Boxer/types.js +1 -0
  35. package/dist/components/Button.stories.d.ts +11 -0
  36. package/dist/components/Button.stories.js +109 -0
  37. package/dist/components/Button.svelte +50 -0
  38. package/dist/components/Button.svelte.d.ts +12 -0
  39. package/dist/components/ButtonPreview.svelte +14 -0
  40. package/dist/components/ButtonPreview.svelte.d.ts +4 -0
  41. package/dist/components/ErrorBoundary/ErrorBoundary.stories.js +17 -0
  42. package/dist/components/ErrorBoundary/ErrorBoundary.svelte +127 -0
  43. package/dist/components/ErrorBoundary/ErrorBoundary.svelte.d.ts +13 -0
  44. package/dist/components/ErrorBoundary/ErrorBoundaryPreview.svelte +28 -0
  45. package/dist/components/ErrorBoundary/ErrorBoundaryPreview.svelte.d.ts +6 -0
  46. package/dist/components/ErrorBoundary/ErrorManager.d.ts +15 -0
  47. package/dist/components/ErrorBoundary/ErrorManager.js +158 -0
  48. package/dist/components/ErrorBoundary/Plan.mdx +182 -0
  49. package/dist/components/ErrorBoundary/index.d.ts +3 -0
  50. package/dist/components/ErrorBoundary/index.js +3 -0
  51. package/dist/components/ErrorBoundary/types.d.ts +43 -0
  52. package/dist/components/ErrorBoundary/types.js +1 -0
  53. package/dist/components/Former/Former.stories.js +228 -0
  54. package/dist/components/Former/Former.svelte +405 -0
  55. package/dist/components/Former/Former.svelte.d.ts +33 -0
  56. package/dist/components/Former/FormerButtonArea.svelte +93 -0
  57. package/dist/components/Former/FormerButtonArea.svelte.d.ts +15 -0
  58. package/dist/components/Former/FormerDrawer.svelte +115 -0
  59. package/dist/components/Former/FormerDrawer.svelte.d.ts +19 -0
  60. package/dist/components/Former/FormerDrawerPreview.svelte +226 -0
  61. package/dist/components/Former/FormerDrawerPreview.svelte.d.ts +7 -0
  62. package/dist/components/Former/FormerModal.svelte +108 -0
  63. package/dist/components/Former/FormerModal.svelte.d.ts +14 -0
  64. package/dist/components/Former/FormerModalPreview.svelte +226 -0
  65. package/dist/components/Former/FormerModalPreview.svelte.d.ts +7 -0
  66. package/dist/components/Former/FormerPreview.svelte +238 -0
  67. package/dist/components/Former/FormerPreview.svelte.d.ts +8 -0
  68. package/dist/components/Former/FormerResolveSpecAPI.d.ts +26 -0
  69. package/dist/components/Former/FormerResolveSpecAPI.js +44 -0
  70. package/dist/components/Former/FormerRestApiPreview.svelte +198 -0
  71. package/dist/components/Former/FormerRestApiPreview.svelte.d.ts +3 -0
  72. package/dist/components/Former/FormerRestHeadSpecAPI.d.ts +8 -0
  73. package/dist/components/Former/FormerRestHeadSpecAPI.js +38 -0
  74. package/dist/components/Former/Plan.mdx +115 -0
  75. package/dist/components/Former/formerState.svelte.d.ts +21 -0
  76. package/dist/components/Former/formerState.svelte.js +57 -0
  77. package/dist/components/Former/index.d.ts +8 -0
  78. package/dist/components/Former/index.js +8 -0
  79. package/dist/components/Former/types.d.ts +61 -0
  80. package/dist/components/Former/types.js +1 -0
  81. package/dist/components/FormerControllers/ButtonCtrl.stories.js +102 -0
  82. package/dist/components/FormerControllers/ButtonCtrl.svelte +65 -0
  83. package/dist/components/FormerControllers/ButtonCtrl.svelte.d.ts +14 -0
  84. package/dist/components/FormerControllers/DateTimeCtrl/DateTimeCtrl.stories.js +73 -0
  85. package/dist/components/FormerControllers/DateTimeCtrl/DateTimeCtrl.svelte +630 -0
  86. package/dist/components/FormerControllers/DateTimeCtrl/DateTimeCtrl.svelte.d.ts +54 -0
  87. package/dist/components/FormerControllers/DateTimeCtrl/DateTimeCtrl.utils.d.ts +40 -0
  88. package/dist/components/FormerControllers/DateTimeCtrl/DateTimeCtrl.utils.js +688 -0
  89. package/dist/components/FormerControllers/DateTimeCtrl/DateTimeCtrlCalendar.svelte +193 -0
  90. package/dist/components/FormerControllers/DateTimeCtrl/DateTimeCtrlCalendar.svelte.d.ts +13 -0
  91. package/dist/components/FormerControllers/DateTimeCtrl/DateTimeCtrlPickerPanel.svelte +119 -0
  92. package/dist/components/FormerControllers/DateTimeCtrl/DateTimeCtrlPickerPanel.svelte.d.ts +39 -0
  93. package/dist/components/FormerControllers/DateTimeCtrl/DateTimeCtrlTimeFields.svelte +343 -0
  94. package/dist/components/FormerControllers/DateTimeCtrl/DateTimeCtrlTimeFields.svelte.d.ts +27 -0
  95. package/dist/components/FormerControllers/DateTimeCtrl/index.d.ts +2 -0
  96. package/dist/components/FormerControllers/DateTimeCtrl/index.js +1 -0
  97. package/dist/components/FormerControllers/FormerControllers.stories.js +76 -0
  98. package/dist/components/FormerControllers/IconButtonCtrl.stories.js +77 -0
  99. package/dist/components/FormerControllers/IconButtonCtrl.svelte +64 -0
  100. package/dist/components/FormerControllers/IconButtonCtrl.svelte.d.ts +13 -0
  101. package/dist/components/FormerControllers/InlineWrapper.stories.js +133 -0
  102. package/dist/components/FormerControllers/InlineWrapper.svelte +85 -0
  103. package/dist/components/FormerControllers/InlineWrapper.svelte.d.ts +16 -0
  104. package/dist/components/FormerControllers/InlineWrapperPreview.svelte +41 -0
  105. package/dist/components/FormerControllers/InlineWrapperPreview.svelte.d.ts +13 -0
  106. package/dist/components/FormerControllers/NativeSelectCtrl.stories.js +79 -0
  107. package/dist/components/FormerControllers/NativeSelectCtrl.svelte +61 -0
  108. package/dist/components/FormerControllers/NativeSelectCtrl.svelte.d.ts +13 -0
  109. package/dist/components/FormerControllers/NumberInputCtrl.stories.js +77 -0
  110. package/dist/components/FormerControllers/NumberInputCtrl.svelte +61 -0
  111. package/dist/components/FormerControllers/NumberInputCtrl.svelte.d.ts +11 -0
  112. package/dist/components/FormerControllers/PasswordInputCtrl.stories.js +79 -0
  113. package/dist/components/FormerControllers/PasswordInputCtrl.svelte +57 -0
  114. package/dist/components/FormerControllers/PasswordInputCtrl.svelte.d.ts +8 -0
  115. package/dist/components/FormerControllers/Plan.mdx +129 -0
  116. package/dist/components/FormerControllers/SwitchCtrl.stories.js +73 -0
  117. package/dist/components/FormerControllers/SwitchCtrl.svelte +38 -0
  118. package/dist/components/FormerControllers/SwitchCtrl.svelte.d.ts +8 -0
  119. package/dist/components/FormerControllers/TextAreaCtrl.stories.js +71 -0
  120. package/dist/components/FormerControllers/TextAreaCtrl.svelte +47 -0
  121. package/dist/components/FormerControllers/TextAreaCtrl.svelte.d.ts +9 -0
  122. package/dist/components/FormerControllers/TextInputCtrl.svelte +47 -0
  123. package/dist/components/FormerControllers/TextInputCtrl.svelte.d.ts +9 -0
  124. package/dist/components/FormerControllers/index.d.ts +12 -0
  125. package/dist/components/FormerControllers/index.js +11 -0
  126. package/dist/components/FormerControllers/types.d.ts +10 -0
  127. package/dist/components/FormerControllers/types.js +1 -0
  128. package/dist/components/GlobalStateStore/GlobalStateStore.d.ts +19 -0
  129. package/dist/components/GlobalStateStore/GlobalStateStore.js +349 -0
  130. package/dist/components/GlobalStateStore/GlobalStateStore.types.d.ts +127 -0
  131. package/dist/components/GlobalStateStore/GlobalStateStore.types.js +2 -0
  132. package/dist/components/GlobalStateStore/GlobalStateStore.utils.d.ts +4 -0
  133. package/dist/components/GlobalStateStore/GlobalStateStore.utils.js +92 -0
  134. package/dist/components/GlobalStateStore/GlobalStateStoreContext.d.ts +10 -0
  135. package/dist/components/GlobalStateStore/GlobalStateStoreContext.js +10 -0
  136. package/dist/components/GlobalStateStore/GlobalStateStoreProvider.svelte +113 -0
  137. package/dist/components/GlobalStateStore/GlobalStateStoreProvider.svelte.d.ts +16 -0
  138. package/dist/components/GlobalStateStore/index.d.ts +5 -0
  139. package/dist/components/GlobalStateStore/index.js +3 -0
  140. package/dist/components/Gridler/CellEditor.svelte +126 -0
  141. package/dist/components/Gridler/CellEditor.svelte.d.ts +15 -0
  142. package/dist/components/Gridler/Gridler.stories.d.ts +56 -0
  143. package/dist/components/Gridler/Gridler.stories.js +262 -0
  144. package/dist/components/Gridler/Gridler.svelte +778 -0
  145. package/dist/components/Gridler/Gridler.svelte.d.ts +11 -0
  146. package/dist/components/Gridler/GridlerHeader.svelte +179 -0
  147. package/dist/components/Gridler/GridlerHeader.svelte.d.ts +13 -0
  148. package/dist/components/Gridler/Plan.mdx +692 -0
  149. package/dist/components/Gridler/index.d.ts +6 -0
  150. package/dist/components/Gridler/index.js +6 -0
  151. package/dist/components/Gridler/types.d.ts +84 -0
  152. package/dist/components/Gridler/types.js +16 -0
  153. package/dist/components/Gridler/utils/rendering.d.ts +16 -0
  154. package/dist/components/Gridler/utils/rendering.js +202 -0
  155. package/dist/components/Gridler/utils/scrolling.d.ts +12 -0
  156. package/dist/components/Gridler/utils/scrolling.js +97 -0
  157. package/dist/components/Portal/Portal.mdx +125 -0
  158. package/dist/components/Portal/Portal.svelte +47 -0
  159. package/dist/components/Portal/Portal.svelte.d.ts +18 -0
  160. package/dist/components/Screenshot/Screenshot.stories.d.ts +16 -0
  161. package/dist/components/Screenshot/Screenshot.stories.js +15 -0
  162. package/dist/components/Screenshot/Screenshot.svelte +54 -0
  163. package/dist/components/Screenshot/Screenshot.svelte.d.ts +3 -0
  164. package/dist/components/Screenshot/Screenshot.util.d.ts +1 -0
  165. package/dist/components/Screenshot/Screenshot.util.js +49 -0
  166. package/dist/components/Screenshot/index.d.ts +2 -0
  167. package/dist/components/Screenshot/index.js +2 -0
  168. package/dist/components/Svark/Svark.stories.js +659 -0
  169. package/dist/components/Svark/Svark.svelte +691 -0
  170. package/dist/components/Svark/Svark.svelte.d.ts +26 -0
  171. package/dist/components/Svark/SvarkResolveSpecAdapter.d.ts +16 -0
  172. package/dist/components/Svark/SvarkResolveSpecAdapter.js +68 -0
  173. package/dist/components/Svark/SvarkSelectionDemo.svelte +59 -0
  174. package/dist/components/Svark/SvarkSelectionDemo.svelte.d.ts +4 -0
  175. package/dist/components/Svark/index.d.ts +3 -0
  176. package/dist/components/Svark/index.js +3 -0
  177. package/dist/components/Svark/types.d.ts +63 -0
  178. package/dist/components/Svark/types.js +1 -0
  179. package/dist/components/VTree/VTree.models.d.ts +12 -0
  180. package/dist/components/VTree/VTree.models.js +1 -0
  181. package/dist/components/VTree/VTree.stories.d.ts +40 -0
  182. package/dist/components/VTree/VTree.stories.js +112 -0
  183. package/dist/components/VTree/VTree.svelte +471 -0
  184. package/dist/components/VTree/VTree.svelte.d.ts +5 -0
  185. package/dist/components/VTree/VTreeContextMenu.svelte +40 -0
  186. package/dist/components/VTree/VTreeContextMenu.svelte.d.ts +11 -0
  187. package/dist/components/VTree/VTreeEventsDemo.svelte +88 -0
  188. package/dist/components/VTree/VTreeEventsDemo.svelte.d.ts +3 -0
  189. package/dist/components/VTree/VTreeResolveSpecAdapter.d.ts +14 -0
  190. package/dist/components/VTree/VTreeResolveSpecAdapter.js +103 -0
  191. package/dist/components/VTree/VTreeRow.svelte +136 -0
  192. package/dist/components/VTree/VTreeRow.svelte.d.ts +37 -0
  193. package/dist/components/VTree/VTreeSearch.svelte +25 -0
  194. package/dist/components/VTree/VTreeSearch.svelte.d.ts +8 -0
  195. package/dist/components/VTree/VTreeVirtualViewport.svelte +154 -0
  196. package/dist/components/VTree/VTreeVirtualViewport.svelte.d.ts +45 -0
  197. package/dist/components/VTree/index.d.ts +3 -0
  198. package/dist/components/VTree/index.js +3 -0
  199. package/dist/components/VTree/types.d.ts +83 -0
  200. package/dist/components/VTree/types.js +1 -0
  201. package/dist/components/index.d.ts +11 -0
  202. package/dist/components/index.js +11 -0
  203. package/dist/index.d.ts +16 -0
  204. package/dist/index.js +20 -0
  205. package/dist/stores/index.d.ts +1 -0
  206. package/dist/stores/index.js +1 -0
  207. package/dist/themes/svelix_orange.css +205 -0
  208. package/dist/utils/PropsWithChildren.d.ts +5 -0
  209. package/dist/utils/PropsWithChildren.js +1 -0
  210. package/dist/utils/index.d.ts +1 -0
  211. package/dist/utils/index.js +2 -0
  212. package/package.json +85 -0
package/LICENSE ADDED
@@ -0,0 +1,73 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
12
+
13
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
14
+
15
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
16
+
17
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
18
+
19
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
20
+
21
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
22
+
23
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
24
+
25
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
26
+
27
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
28
+
29
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
30
+
31
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
32
+
33
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
34
+
35
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
36
+
37
+ (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
38
+
39
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
40
+
41
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
42
+
43
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
44
+
45
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
46
+
47
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
48
+
49
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50
+
51
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
52
+
53
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
54
+
55
+ END OF TERMS AND CONDITIONS
56
+
57
+ APPENDIX: How to apply the Apache License to your work.
58
+
59
+ To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
60
+
61
+ Copyright 2026 wdevs
62
+
63
+ Licensed under the Apache License, Version 2.0 (the "License");
64
+ you may not use this file except in compliance with the License.
65
+ You may obtain a copy of the License at
66
+
67
+ http://www.apache.org/licenses/LICENSE-2.0
68
+
69
+ Unless required by applicable law or agreed to in writing, software
70
+ distributed under the License is distributed on an "AS IS" BASIS,
71
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
72
+ See the License for the specific language governing permissions and
73
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # svelix
2
+
3
+ Svelix - Svelte UI tools
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ // Export Svelte actions here
2
+ export {};
@@ -0,0 +1,68 @@
1
+ import { expect, userEvent, within } from '@storybook/test';
2
+ import BetterMenu from './BetterMenu.svelte';
3
+ import BetterMenuPreview from './BetterMenuPreview.svelte';
4
+ const meta = {
5
+ title: 'Components/BetterMenu',
6
+ component: BetterMenu,
7
+ tags: ['autodocs'],
8
+ };
9
+ export default meta;
10
+ export const Default = {
11
+ args: {
12
+ providerID: 'storybook-menu',
13
+ },
14
+ render: (args) => ({
15
+ Component: BetterMenuPreview,
16
+ props: args,
17
+ }),
18
+ play: async ({ canvasElement }) => {
19
+ const canvas = within(canvasElement);
20
+ // Verify the trigger button is rendered
21
+ const triggerBtn = canvas.getByRole('button', { name: /display menu/i });
22
+ expect(triggerBtn).toBeTruthy();
23
+ // Click to open the menu
24
+ await userEvent.click(triggerBtn);
25
+ // Menu items should be visible
26
+ const option1 = canvas.getByText('Option 1');
27
+ expect(option1).toBeTruthy();
28
+ const option2 = canvas.getByText('Option 2');
29
+ expect(option2).toBeTruthy();
30
+ },
31
+ };
32
+ export const MenuVisible = {
33
+ args: {
34
+ providerID: 'storybook-menu-visible',
35
+ },
36
+ render: (args) => ({
37
+ Component: BetterMenuPreview,
38
+ props: args,
39
+ }),
40
+ play: async ({ canvasElement }) => {
41
+ const canvas = within(canvasElement);
42
+ const triggerBtn = canvas.getByRole('button', { name: /display menu/i });
43
+ // Open menu
44
+ await userEvent.click(triggerBtn);
45
+ // Verify menu items appear
46
+ expect(canvas.getByText('Option 1')).toBeTruthy();
47
+ expect(canvas.getByText('Option 2')).toBeTruthy();
48
+ expect(canvas.getByText('Option 3')).toBeTruthy();
49
+ },
50
+ };
51
+ export const MenuHideOnBackdrop = {
52
+ args: {
53
+ providerID: 'storybook-menu-backdrop',
54
+ },
55
+ render: (args) => ({
56
+ Component: BetterMenuPreview,
57
+ props: args,
58
+ }),
59
+ play: async ({ canvasElement }) => {
60
+ const canvas = within(canvasElement);
61
+ const triggerBtn = canvas.getByRole('button', { name: /display menu/i });
62
+ // Open menu
63
+ await userEvent.click(triggerBtn);
64
+ expect(canvas.getByText('Option 1')).toBeTruthy();
65
+ // Press Escape to close (or click backdrop)
66
+ await userEvent.keyboard('{Escape}');
67
+ },
68
+ };
@@ -0,0 +1,38 @@
1
+ <script lang="ts">
2
+ import { setContext } from 'svelte';
3
+ import type { Snippet } from 'svelte';
4
+ import { createBetterMenuStore } from './store';
5
+ import MenuRenderer from './MenuRenderer.svelte';
6
+ import type { BetterMenuInstance } from './types';
7
+
8
+ interface Props {
9
+ children: Snippet;
10
+ disablePortal?: boolean;
11
+ providerID?: string;
12
+ width?: number;
13
+ }
14
+
15
+ const { children, disablePortal = false, providerID, width }: Props = $props();
16
+
17
+ // providerID intentionally uses initial value - stores are created once per provider instance
18
+ const store = createBetterMenuStore(providerID);
19
+
20
+ $effect(() => {
21
+ if (width !== undefined) {
22
+ store.setWidth(width);
23
+ }
24
+ });
25
+
26
+ setContext('betterMenuStore', store);
27
+
28
+ export function show(id: string, options?: Partial<Omit<BetterMenuInstance, 'id'>>) {
29
+ store.show(id, options);
30
+ }
31
+
32
+ export function hide(id: string) {
33
+ store.hide(id);
34
+ }
35
+ </script>
36
+
37
+ <MenuRenderer {disablePortal} />
38
+ {@render children()}
@@ -0,0 +1,14 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { BetterMenuInstance } from './types';
3
+ interface Props {
4
+ children: Snippet;
5
+ disablePortal?: boolean;
6
+ providerID?: string;
7
+ width?: number;
8
+ }
9
+ declare const BetterMenu: import("svelte").Component<Props, {
10
+ show: (id: string, options?: Partial<Omit<BetterMenuInstance, "id">>) => void;
11
+ hide: (id: string) => void;
12
+ }, "">;
13
+ type BetterMenu = ReturnType<typeof BetterMenu>;
14
+ export default BetterMenu;
@@ -0,0 +1,34 @@
1
+ <script lang="ts">
2
+ import type { BetterMenuInstanceItem } from './types';
3
+
4
+ interface Props {
5
+ item: BetterMenuInstanceItem;
6
+ onClose: () => void;
7
+ }
8
+
9
+ const { item, onClose }: Props = $props();
10
+
11
+ let loading = $state(false);
12
+
13
+ async function handleClick(e: MouseEvent) {
14
+ item.onClick?.(e);
15
+ if (item.onClickAsync) {
16
+ loading = true;
17
+ try {
18
+ await item.onClickAsync(e);
19
+ } finally {
20
+ loading = false;
21
+ }
22
+ }
23
+ onClose();
24
+ }
25
+ </script>
26
+
27
+ <button
28
+ class="w-full text-left px-4 py-2 text-sm hover:bg-surface-100-900 flex items-center gap-2 disabled:opacity-50"
29
+ disabled={loading}
30
+ onclick={handleClick}
31
+ >
32
+ {#if loading}<span class="animate-spin text-xs">⟳</span>{/if}
33
+ {item.label}
34
+ </button>
@@ -0,0 +1,8 @@
1
+ import type { BetterMenuInstanceItem } from './types';
2
+ interface Props {
3
+ item: BetterMenuInstanceItem;
4
+ onClose: () => void;
5
+ }
6
+ declare const BetterMenuAsyncButton: import("svelte").Component<Props, {}, "">;
7
+ type BetterMenuAsyncButton = ReturnType<typeof BetterMenuAsyncButton>;
8
+ export default BetterMenuAsyncButton;
@@ -0,0 +1,43 @@
1
+ <script lang="ts">
2
+ import BetterMenu from './BetterMenu.svelte';
3
+ import type { BetterMenuInstance } from './types';
4
+
5
+ interface Props {
6
+ providerID?: string;
7
+ width?: number;
8
+ }
9
+
10
+ const { providerID = 'storybook-menu', width }: Props = $props();
11
+
12
+ type BetterMenuRef = { show: (id: string, options?: Partial<Omit<BetterMenuInstance, 'id'>>) => void; hide: (id: string) => void };
13
+ let betterMenuRef: BetterMenuRef | undefined = $state();
14
+ let buttonRef: HTMLButtonElement | null = $state(null);
15
+
16
+ function showMenu() {
17
+ if (betterMenuRef && buttonRef) {
18
+ const rect = buttonRef.getBoundingClientRect();
19
+ betterMenuRef.show('example-menu', {
20
+ x: rect.left,
21
+ y: rect.bottom + 8,
22
+ items: [
23
+ { label: 'Option 1', onClick: () => { /* Option 1 selected */ } },
24
+ { label: 'Option 2', onClick: () => { /* Option 2 selected */ } },
25
+ { isDivider: true },
26
+ { label: 'Option 3', onClick: () => { /* Option 3 selected */ } },
27
+ ]
28
+ });
29
+ }
30
+ }
31
+ </script>
32
+
33
+ <BetterMenu bind:this={betterMenuRef} {providerID} {width}>
34
+ <div class="p-8 space-y-4">
35
+ <h2 class="text-2xl font-bold">BetterMenu Example</h2>
36
+ <p class="text-surface-500">Click the button below to display the menu.</p>
37
+ <div>
38
+ <button bind:this={buttonRef} class="btn btn-filled btn-primary btn-md" onclick={showMenu}>
39
+ Display Menu
40
+ </button>
41
+ </div>
42
+ </div>
43
+ </BetterMenu>
@@ -0,0 +1,7 @@
1
+ interface Props {
2
+ providerID?: string;
3
+ width?: number;
4
+ }
5
+ declare const BetterMenuPreview: import("svelte").Component<Props, {}, "">;
6
+ type BetterMenuPreview = ReturnType<typeof BetterMenuPreview>;
7
+ export default BetterMenuPreview;
@@ -0,0 +1,75 @@
1
+ <script lang="ts">
2
+ import { getContext } from 'svelte';
3
+ import type { BetterMenuInstanceItem, BetterMenuStoreState } from './types';
4
+ import type { BetterMenuStore } from './store';
5
+ import BetterMenuAsyncButton from './BetterMenuAsyncButton.svelte';
6
+ import Portal from '../Portal/Portal.svelte';
7
+
8
+ interface Props {
9
+ disablePortal?: boolean;
10
+ }
11
+ const { disablePortal = false }: Props = $props();
12
+
13
+ const store = getContext<BetterMenuStore>('betterMenuStore');
14
+ let state = $state<BetterMenuStoreState>({ menus: [], providerID: '' });
15
+
16
+ $effect(() => {
17
+ return store.subscribe((s) => {
18
+ state = s;
19
+ });
20
+ });
21
+
22
+ function hideMenu(id: string) {
23
+ store.setInstanceState(id, 'visible', false);
24
+ }
25
+ </script>
26
+
27
+ {#snippet menuItem(item: BetterMenuInstanceItem, onClose: () => void)}
28
+ {#if item.isDivider}
29
+ <hr class="border-surface-300-700 my-1" />
30
+ {:else if item.onClick || item.onClickAsync}
31
+ <BetterMenuAsyncButton {item} {onClose} />
32
+ {:else if item.items && item.items.length > 0}
33
+ <div class="relative group">
34
+ <button
35
+ class="w-full text-left px-4 py-2 text-sm hover:bg-surface-100-900 flex items-center justify-between gap-2"
36
+ >
37
+ {item.label}
38
+ <span class="text-xs">▶</span>
39
+ </button>
40
+ <div
41
+ class="absolute left-full top-0 hidden group-hover:block card bg-surface-100-900 shadow-xl min-w-48 py-1 z-50"
42
+ >
43
+ {#each item.items as subItem, i (`sub_${i}`)}
44
+ {@render menuItem(subItem, onClose)}
45
+ {/each}
46
+ </div>
47
+ </div>
48
+ {:else}
49
+ <div class="px-4 py-1 text-xs font-semibold text-surface-500-400-token uppercase tracking-wider">
50
+ {item.label}
51
+ </div>
52
+ {/if}
53
+ {/snippet}
54
+
55
+ <Portal disabled={disablePortal}>
56
+ {#each state.menus as menu, menuIndex (menu.id)}
57
+ {#if menu.visible}
58
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
59
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
60
+ <div class="fixed inset-0 z-40" onclick={() => hideMenu(menu.id)}></div>
61
+
62
+ <div
63
+ class="fixed z-50 card bg-surface-100-900 shadow-xl min-w-48 py-1"
64
+ id={`bmm_portal_${state.providerID}_${menuIndex}`}
65
+ style:left="{menu.x}px"
66
+ style:top="{menu.y}px"
67
+ style:width={state.width ? `${state.width}px` : undefined}
68
+ >
69
+ {#each menu.items ?? [] as item, itemIndex (`${menu.id}_item_${item.id ?? itemIndex}`)}
70
+ {@render menuItem(item, () => hideMenu(menu.id))}
71
+ {/each}
72
+ </div>
73
+ {/if}
74
+ {/each}
75
+ </Portal>
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ disablePortal?: boolean;
3
+ }
4
+ declare const MenuRenderer: import("svelte").Component<Props, {}, "">;
5
+ type MenuRenderer = ReturnType<typeof MenuRenderer>;
6
+ export default MenuRenderer;
@@ -0,0 +1,155 @@
1
+ # BetterMenu Implementation Plan
2
+
3
+ BetterMenu is a context-based menu management system that allows showing/hiding multiple menus from anywhere in the component tree.
4
+
5
+ ## Technology Stack
6
+
7
+ **React → Svelte 5 Mapping:**
8
+ - Zustand store → Svelte `writable` store
9
+ - React Context API → Svelte `setContext`/`getContext`
10
+ - Mantine Menu → Skeleton UI Menu
11
+ - React testing library → Vitest
12
+
13
+ ## Component Structure
14
+
15
+ ```
16
+ BetterMenu/
17
+ ├── BetterMenu.svelte # Provider component
18
+ ├── MenuRenderer.svelte # Renders active menus from store
19
+ ├── store.ts # Svelte writable store
20
+ ├── types.ts # TypeScript interfaces
21
+ ├── BetterMenu.test.ts # Vitest tests
22
+ ├── BetterMenu.stories.ts # Storybook stories
23
+ └── index.ts # Exports
24
+ ```
25
+
26
+ ## Core Concepts
27
+
28
+ ### Store State
29
+
30
+ ```
31
+ | Property | Type | Description |
32
+ |----------|------|-------------|
33
+ | `activeMenus` | `Map<string, MenuInstance>` | Currently open menus |
34
+ | `show(instance)` | `function` | Open a menu |
35
+ | `hide(id)` | `function` | Close a menu by ID |
36
+ | `hideAll()` | `function` | Close all menus |
37
+ ```
38
+
39
+ ### Menu Instance
40
+
41
+ ```
42
+ | Property | Type | Description |
43
+ |----------|------|-------------|
44
+ | `id` | `string` | Unique menu identifier |
45
+ | `position` | `{x, y}` | Menu position on screen |
46
+ | `items` | `MenuItem[]` | Menu item definitions |
47
+ | `onSelect` | `function` | Callback when item clicked |
48
+ ```
49
+
50
+ ### Menu Item
51
+
52
+ ```
53
+ | Property | Type | Description |
54
+ |----------|------|-------------|
55
+ | `label` | `string` | Display text |
56
+ | `icon` | `string` | Icon name (optional) |
57
+ | `disabled` | `boolean` | Item disabled state |
58
+ | `onClick` | `function` | Click handler |
59
+ ```
60
+
61
+ ## Components
62
+
63
+ ### 1. BetterMenu.svelte (Provider)
64
+ - Wraps application
65
+ - Provides context via `setContext('betterMenu', store)`
66
+ - Renders `MenuRenderer` child
67
+ - Handles escape key to close menus
68
+ - Props: `children` (via `{#snippet}`)
69
+
70
+ ### 2. MenuRenderer.svelte
71
+ - Subscribes to store via `getContext('betterMenu')`
72
+ - Iterates over `activeMenus` and renders each
73
+ - Uses Skeleton UI positioning + Tailwind CSS
74
+ - Handles click-outside to close menus
75
+ - No props — purely reactive from store
76
+
77
+ ### 3. store.ts
78
+ Svelte writable store with methods:
79
+
80
+ ```typescript
81
+ export const betterMenuStore = writable<BetterMenuState>({
82
+ activeMenus: new Map()
83
+ });
84
+
85
+ export function show(instance: MenuInstance): void
86
+ export function hide(id: string): void
87
+ export function hideAll(): void
88
+ ```
89
+
90
+ ## Implementation Steps
91
+
92
+ ### 1. Setup & Types
93
+ - [ ] Create `types.ts` with MenuInstance, MenuItem, BetterMenuState interfaces
94
+
95
+ ### 2. Store
96
+ - [ ] Create `store.ts` with `writable` store + show/hide/hideAll functions
97
+
98
+ ### 3. Components
99
+ - [ ] Create `BetterMenu.svelte` provider component
100
+ - [ ] Create `MenuRenderer.svelte` for rendering menus
101
+
102
+ ### 4. Testing & Documentation
103
+ - [ ] Port `MantineBetterMenu.test.tsx` → `BetterMenu.test.ts` (Vitest)
104
+ - [ ] Create `BetterMenu.stories.ts` with usage examples
105
+ - [ ] Export from `src/lib/components/index.ts` and `src/lib/index.ts`
106
+
107
+ ### 5. Verification
108
+ - [ ] Run `pnpm check` — TypeScript passes
109
+ - [ ] Run `pnpm lint` — ESLint passes
110
+ - [ ] Run `pnpm test` — Vitest passes
111
+ - [ ] Run `pnpm storybook` — component renders
112
+
113
+ ## API Usage
114
+
115
+ ```typescript
116
+ // In parent component
117
+ <BetterMenu>
118
+ <MyComponent />
119
+ </BetterMenu>
120
+
121
+ // In child component
122
+ import { getContext } from 'svelte';
123
+ const { show, hide, hideAll } = getContext('betterMenu');
124
+
125
+ // Show menu
126
+ show({
127
+ id: 'my-menu',
128
+ position: { x: 100, y: 200 },
129
+ items: [
130
+ { label: 'Edit', onClick: () => {} },
131
+ { label: 'Delete', onClick: () => {}, disabled: false }
132
+ ],
133
+ onSelect: (item) => {}
134
+ });
135
+
136
+ // Hide menu
137
+ hide('my-menu');
138
+ ```
139
+
140
+ ## Dependencies
141
+
142
+ No new dependencies needed (uses existing Skeleton UI and Tailwind CSS).
143
+
144
+ ## Related Components
145
+
146
+ - **FormerControllers** — May use BetterMenu for dropdown options
147
+ - **Boxer** — May use BetterMenu for option selection
148
+
149
+ ## Key Technical Decisions
150
+
151
+ 1. **Store Pattern**: Svelte `writable` with exported functions (vs. class-based)
152
+ 2. **Context**: Use Svelte `setContext`/`getContext` for provider pattern
153
+ 3. **Positioning**: CSS fixed + Tailwind for menu positioning
154
+ 4. **Click-Outside**: Detect clicks outside menu to close automatically
155
+ 5. **Keyboard**: Escape key closes all menus
@@ -0,0 +1,4 @@
1
+ export { default as BetterMenu } from './BetterMenu.svelte';
2
+ export { default as MenuRenderer } from './MenuRenderer.svelte';
3
+ export { createBetterMenuStore } from './store';
4
+ export * from './types';
@@ -0,0 +1,4 @@
1
+ export { default as BetterMenu } from './BetterMenu.svelte';
2
+ export { default as MenuRenderer } from './MenuRenderer.svelte';
3
+ export { createBetterMenuStore } from './store';
4
+ export * from './types';
@@ -0,0 +1,10 @@
1
+ import type { BetterMenuInstance, BetterMenuStoreState } from './types';
2
+ export declare function createBetterMenuStore(providerID?: string): {
3
+ hide: (menuId: string) => void;
4
+ setInstanceState: <K extends keyof BetterMenuInstance>(id: string, key: K, value: BetterMenuInstance[K]) => void;
5
+ setWidth: (width: number) => void;
6
+ show: (menuId: string, options?: Partial<Omit<BetterMenuInstance, "id">>) => void;
7
+ subscribe: (this: void, run: import("svelte/store").Subscriber<BetterMenuStoreState>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
8
+ update: (this: void, updater: import("svelte/store").Updater<BetterMenuStoreState>) => void;
9
+ };
10
+ export type BetterMenuStore = ReturnType<typeof createBetterMenuStore>;
@@ -0,0 +1,48 @@
1
+ import { writable } from 'svelte/store';
2
+ export function createBetterMenuStore(providerID) {
3
+ const id = providerID ?? `MenuStore-${crypto.randomUUID()}`;
4
+ const { subscribe, update } = writable({
5
+ menus: [],
6
+ providerID: id,
7
+ width: undefined,
8
+ });
9
+ function show(menuId, options) {
10
+ update((state) => {
11
+ const menuIndex = state.menus.findIndex((m) => m.id === menuId);
12
+ if (menuIndex < 0) {
13
+ const newMenu = {
14
+ id: menuId,
15
+ visible: true,
16
+ x: 0,
17
+ y: 0,
18
+ ...options,
19
+ };
20
+ return { ...state, menus: [...state.menus, newMenu] };
21
+ }
22
+ else {
23
+ const menus = [...state.menus];
24
+ const current = menus[menuIndex];
25
+ menus[menuIndex] = { ...current, ...options, id: menuId, visible: !current.visible };
26
+ return { ...state, menus };
27
+ }
28
+ });
29
+ }
30
+ function hide(menuId) {
31
+ setInstanceState(menuId, 'visible', false);
32
+ }
33
+ function setInstanceState(id, key, value) {
34
+ update((state) => {
35
+ const idx = state.menus.findIndex((m) => m.id === id);
36
+ if (idx >= 0) {
37
+ const menus = [...state.menus];
38
+ menus[idx] = { ...menus[idx], [key]: value };
39
+ return { ...state, menus };
40
+ }
41
+ return state;
42
+ });
43
+ }
44
+ function setWidth(width) {
45
+ update((state) => ({ ...state, width }));
46
+ }
47
+ return { hide, setInstanceState, setWidth, show, subscribe, update };
48
+ }
@@ -0,0 +1,24 @@
1
+ import type { Snippet } from 'svelte';
2
+ export interface BetterMenuInstance {
3
+ id: string;
4
+ items?: Array<BetterMenuInstanceItem>;
5
+ renderer?: Snippet | ((props: Record<string, unknown>) => unknown);
6
+ visible: boolean;
7
+ x: number;
8
+ y: number;
9
+ }
10
+ export interface BetterMenuInstanceItem {
11
+ id?: string;
12
+ isDivider?: boolean;
13
+ items?: Array<BetterMenuInstanceItem>;
14
+ label?: string;
15
+ leftSection?: Snippet;
16
+ onClick?: (e?: MouseEvent) => void;
17
+ onClickAsync?: (e?: MouseEvent) => Promise<void>;
18
+ renderer?: Snippet | ((props: BetterMenuInstanceItem & Record<string, unknown>) => unknown);
19
+ }
20
+ export interface BetterMenuStoreState {
21
+ menus: Array<BetterMenuInstance>;
22
+ providerID: string;
23
+ width?: number;
24
+ }
@@ -0,0 +1 @@
1
+ export {};