@0djek/sveltix 0.0.6

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 (244) hide show
  1. package/README.md +103 -0
  2. package/dist/button/Button.svelte +24 -0
  3. package/dist/button/Button.svelte.d.ts +4 -0
  4. package/dist/button/ButtonComponent.svelte.d.ts +15 -0
  5. package/dist/button/ButtonComponent.svelte.js +26 -0
  6. package/dist/button/ButtonStyles.d.ts +11 -0
  7. package/dist/button/ButtonStyles.js +2 -0
  8. package/dist/button/__tests__/builders/ButtonBuilder.d.ts +23 -0
  9. package/dist/button/__tests__/builders/ButtonBuilder.js +61 -0
  10. package/dist/button/__tests__/builders/ButtonStory.svelte +27 -0
  11. package/dist/button/__tests__/builders/ButtonStory.svelte.d.ts +14 -0
  12. package/dist/button/__tests__/pom/ButtonPom.d.ts +6 -0
  13. package/dist/button/__tests__/pom/ButtonPom.js +14 -0
  14. package/dist/button/buttonDefaults.d.ts +9 -0
  15. package/dist/button/buttonDefaults.js +9 -0
  16. package/dist/button/index.d.ts +5 -0
  17. package/dist/button/index.js +9 -0
  18. package/dist/button/internal/DefaultButtonStyles.d.ts +15 -0
  19. package/dist/button/internal/DefaultButtonStyles.js +64 -0
  20. package/dist/button/models/ButtonProps.d.ts +45 -0
  21. package/dist/button/models/ButtonProps.js +1 -0
  22. package/dist/button/models/ButtonSize.d.ts +6 -0
  23. package/dist/button/models/ButtonSize.js +7 -0
  24. package/dist/button/models/ButtonVariant.d.ts +5 -0
  25. package/dist/button/models/ButtonVariant.js +6 -0
  26. package/dist/button/models/index.d.ts +3 -0
  27. package/dist/button/models/index.js +3 -0
  28. package/dist/cache/Cache.d.ts +18 -0
  29. package/dist/cache/Cache.js +20 -0
  30. package/dist/cache/MappedCache.d.ts +7 -0
  31. package/dist/cache/MappedCache.js +35 -0
  32. package/dist/cache/__tests__/builders/CacheBuilder.d.ts +7 -0
  33. package/dist/cache/__tests__/builders/CacheBuilder.js +18 -0
  34. package/dist/cache/__tests__/builders/MappedCacheBuilder.d.ts +7 -0
  35. package/dist/cache/__tests__/builders/MappedCacheBuilder.js +18 -0
  36. package/dist/cache/index.d.ts +2 -0
  37. package/dist/cache/index.js +2 -0
  38. package/dist/datagrid/SveltixGrid.svelte.d.ts +35 -0
  39. package/dist/datagrid/SveltixGrid.svelte.js +90 -0
  40. package/dist/datagrid/SveltixGridGlobal.d.ts +9 -0
  41. package/dist/datagrid/SveltixGridGlobal.js +12 -0
  42. package/dist/datagrid/components/Datagrid.svelte +114 -0
  43. package/dist/datagrid/components/Datagrid.svelte.d.ts +39 -0
  44. package/dist/datagrid/core-modules/columns/Column.svelte.d.ts +79 -0
  45. package/dist/datagrid/core-modules/columns/Column.svelte.js +322 -0
  46. package/dist/datagrid/core-modules/columns/ColumnsModule.svelte.d.ts +26 -0
  47. package/dist/datagrid/core-modules/columns/ColumnsModule.svelte.js +77 -0
  48. package/dist/datagrid/core-modules/columns/components/CalculateCellWidth.svelte +18 -0
  49. package/dist/datagrid/core-modules/columns/components/CalculateCellWidth.svelte.d.ts +25 -0
  50. package/dist/datagrid/core-modules/columns/index.d.ts +5 -0
  51. package/dist/datagrid/core-modules/columns/index.js +11 -0
  52. package/dist/datagrid/core-modules/columns/models/ColumnOptions.d.ts +2 -0
  53. package/dist/datagrid/core-modules/columns/models/ColumnOptions.js +1 -0
  54. package/dist/datagrid/core-modules/custom/CustomComponentsModule.svelte.d.ts +27 -0
  55. package/dist/datagrid/core-modules/custom/CustomComponentsModule.svelte.js +58 -0
  56. package/dist/datagrid/core-modules/custom/components/CustomComponents.svelte +36 -0
  57. package/dist/datagrid/core-modules/custom/components/CustomComponents.svelte.d.ts +30 -0
  58. package/dist/datagrid/core-modules/custom/index.d.ts +3 -0
  59. package/dist/datagrid/core-modules/custom/index.js +10 -0
  60. package/dist/datagrid/core-modules/custom/models/CustomComponentPosition.d.ts +21 -0
  61. package/dist/datagrid/core-modules/custom/models/CustomComponentPosition.js +22 -0
  62. package/dist/datagrid/core-modules/index.d.ts +4 -0
  63. package/dist/datagrid/core-modules/index.js +4 -0
  64. package/dist/datagrid/core-modules/pipelines/PipelinesModule.svelte.d.ts +12 -0
  65. package/dist/datagrid/core-modules/pipelines/PipelinesModule.svelte.js +58 -0
  66. package/dist/datagrid/core-modules/pipelines/index.d.ts +4 -0
  67. package/dist/datagrid/core-modules/pipelines/index.js +11 -0
  68. package/dist/datagrid/core-modules/pipelines/models/CallbackSignature.d.ts +9 -0
  69. package/dist/datagrid/core-modules/pipelines/models/CallbackSignature.js +1 -0
  70. package/dist/datagrid/core-modules/rows/Cell.svelte.d.ts +27 -0
  71. package/dist/datagrid/core-modules/rows/Cell.svelte.js +103 -0
  72. package/dist/datagrid/core-modules/rows/Row.svelte.d.ts +24 -0
  73. package/dist/datagrid/core-modules/rows/Row.svelte.js +117 -0
  74. package/dist/datagrid/core-modules/rows/RowsModule.svelte.d.ts +33 -0
  75. package/dist/datagrid/core-modules/rows/RowsModule.svelte.js +115 -0
  76. package/dist/datagrid/core-modules/rows/components/body/BodyCell.svelte +31 -0
  77. package/dist/datagrid/core-modules/rows/components/body/BodyCell.svelte.d.ts +30 -0
  78. package/dist/datagrid/core-modules/rows/components/body/GroupCell.svelte +26 -0
  79. package/dist/datagrid/core-modules/rows/components/body/GroupCell.svelte.d.ts +25 -0
  80. package/dist/datagrid/core-modules/rows/index.d.ts +8 -0
  81. package/dist/datagrid/core-modules/rows/index.js +13 -0
  82. package/dist/datagrid/core-modules/rows/internal/CreateRowOptions.d.ts +15 -0
  83. package/dist/datagrid/core-modules/rows/internal/CreateRowOptions.js +1 -0
  84. package/dist/datagrid/core-modules/rows/models/RowsOptions.d.ts +3 -0
  85. package/dist/datagrid/core-modules/rows/models/RowsOptions.js +1 -0
  86. package/dist/datagrid/core-modules/rows/models/index.d.ts +1 -0
  87. package/dist/datagrid/core-modules/rows/models/index.js +1 -0
  88. package/dist/datagrid/events/generateEvents.d.ts +2 -0
  89. package/dist/datagrid/events/generateEvents.js +16 -0
  90. package/dist/datagrid/events/index.d.ts +2 -0
  91. package/dist/datagrid/events/index.js +2 -0
  92. package/dist/datagrid/events/models/RowUpdatedArgs.d.ts +5 -0
  93. package/dist/datagrid/events/models/RowUpdatedArgs.js +1 -0
  94. package/dist/datagrid/events/models/SveltixEvents.d.ts +20 -0
  95. package/dist/datagrid/events/models/SveltixEvents.js +1 -0
  96. package/dist/datagrid/events/models/index.d.ts +2 -0
  97. package/dist/datagrid/events/models/index.js +2 -0
  98. package/dist/datagrid/index.d.ts +5 -0
  99. package/dist/datagrid/index.js +5 -0
  100. package/dist/datagrid/interfaces/ISveltixGrid.d.ts +22 -0
  101. package/dist/datagrid/interfaces/ISveltixGrid.js +1 -0
  102. package/dist/datagrid/interfaces/Module.d.ts +11 -0
  103. package/dist/datagrid/interfaces/Module.js +13 -0
  104. package/dist/datagrid/interfaces/index.d.ts +2 -0
  105. package/dist/datagrid/interfaces/index.js +2 -0
  106. package/dist/datagrid/models/BaseColumn.d.ts +23 -0
  107. package/dist/datagrid/models/BaseColumn.js +1 -0
  108. package/dist/datagrid/models/Formatter.d.ts +32 -0
  109. package/dist/datagrid/models/Formatter.js +7 -0
  110. package/dist/datagrid/models/SveltixGridOptions.d.ts +12 -0
  111. package/dist/datagrid/models/SveltixGridOptions.js +1 -0
  112. package/dist/datagrid/models/Value.d.ts +21 -0
  113. package/dist/datagrid/models/Value.js +6 -0
  114. package/dist/datagrid/models/index.d.ts +4 -0
  115. package/dist/datagrid/models/index.js +4 -0
  116. package/dist/datagrid/models/module/ModuleConstructor.d.ts +5 -0
  117. package/dist/datagrid/models/module/ModuleConstructor.js +1 -0
  118. package/dist/datagrid/models/module/ModuleRegistrationEntry.d.ts +6 -0
  119. package/dist/datagrid/models/module/ModuleRegistrationEntry.js +1 -0
  120. package/dist/datagrid/models/module/index.d.ts +2 -0
  121. package/dist/datagrid/models/module/index.js +2 -0
  122. package/dist/datagrid/modules/flash/FlashModule.svelte.d.ts +9 -0
  123. package/dist/datagrid/modules/flash/FlashModule.svelte.js +33 -0
  124. package/dist/datagrid/modules/flash/index.d.ts +5 -0
  125. package/dist/datagrid/modules/flash/index.js +10 -0
  126. package/dist/datagrid/modules/flash/models/FlashModuleOptions.d.ts +4 -0
  127. package/dist/datagrid/modules/flash/models/FlashModuleOptions.js +1 -0
  128. package/dist/datagrid/modules/flash/models/index.d.ts +1 -0
  129. package/dist/datagrid/modules/flash/models/index.js +1 -0
  130. package/dist/datagrid/modules/resize/ResizeModule.svelte.d.ts +14 -0
  131. package/dist/datagrid/modules/resize/ResizeModule.svelte.js +68 -0
  132. package/dist/datagrid/modules/resize/components/ResizeCustomComponent.svelte +15 -0
  133. package/dist/datagrid/modules/resize/components/ResizeCustomComponent.svelte.d.ts +25 -0
  134. package/dist/datagrid/modules/resize/components/ResizeHandle.svelte +29 -0
  135. package/dist/datagrid/modules/resize/components/ResizeHandle.svelte.d.ts +28 -0
  136. package/dist/datagrid/modules/resize/index.d.ts +5 -0
  137. package/dist/datagrid/modules/resize/index.js +12 -0
  138. package/dist/datagrid/modules/resize/models/ResizeModuleOptions.d.ts +15 -0
  139. package/dist/datagrid/modules/resize/models/ResizeModuleOptions.js +1 -0
  140. package/dist/datagrid/modules/resize/models/index.d.ts +1 -0
  141. package/dist/datagrid/modules/resize/models/index.js +1 -0
  142. package/dist/deep-equal/deepEqual.d.ts +7 -0
  143. package/dist/deep-equal/deepEqual.js +79 -0
  144. package/dist/deep-equal/index.d.ts +1 -0
  145. package/dist/deep-equal/index.js +1 -0
  146. package/dist/di/DiContainer.d.ts +20 -0
  147. package/dist/di/DiContainer.js +42 -0
  148. package/dist/event-bus/EventBus.d.ts +9 -0
  149. package/dist/event-bus/EventBus.js +38 -0
  150. package/dist/event-bus/createEventDefinition.d.ts +1 -0
  151. package/dist/event-bus/createEventDefinition.js +5 -0
  152. package/dist/event-bus/index.d.ts +3 -0
  153. package/dist/event-bus/index.js +3 -0
  154. package/dist/event-bus/models/Event.d.ts +6 -0
  155. package/dist/event-bus/models/Event.js +1 -0
  156. package/dist/event-bus/models/SubscriberEntry.d.ts +5 -0
  157. package/dist/event-bus/models/SubscriberEntry.js +1 -0
  158. package/dist/event-bus/models/SubscriberSignature.d.ts +3 -0
  159. package/dist/event-bus/models/SubscriberSignature.js +1 -0
  160. package/dist/event-bus/models/UnsubscribeSignature.d.ts +3 -0
  161. package/dist/event-bus/models/UnsubscribeSignature.js +1 -0
  162. package/dist/event-bus/models/index.d.ts +4 -0
  163. package/dist/event-bus/models/index.js +4 -0
  164. package/dist/groupBy/groupBy.d.ts +2 -0
  165. package/dist/groupBy/groupBy.js +22 -0
  166. package/dist/groupBy/index.d.ts +2 -0
  167. package/dist/groupBy/index.js +2 -0
  168. package/dist/groupBy/models/Grouping.d.ts +4 -0
  169. package/dist/groupBy/models/Grouping.js +1 -0
  170. package/dist/groupBy/models/index.d.ts +1 -0
  171. package/dist/groupBy/models/index.js +1 -0
  172. package/dist/heading/Heading.svelte +28 -0
  173. package/dist/heading/Heading.svelte.d.ts +4 -0
  174. package/dist/heading/HeadingComponent.svelte.d.ts +13 -0
  175. package/dist/heading/HeadingComponent.svelte.js +20 -0
  176. package/dist/heading/HeadingStyles.d.ts +11 -0
  177. package/dist/heading/HeadingStyles.js +1 -0
  178. package/dist/heading/__tests__/HeadingBuilder.d.ts +12 -0
  179. package/dist/heading/__tests__/HeadingBuilder.js +34 -0
  180. package/dist/heading/__tests__/HeadingStory.svelte +16 -0
  181. package/dist/heading/__tests__/HeadingStory.svelte.d.ts +10 -0
  182. package/dist/heading/headingClasses.d.ts +8 -0
  183. package/dist/heading/headingClasses.js +8 -0
  184. package/dist/heading/index.d.ts +5 -0
  185. package/dist/heading/index.js +8 -0
  186. package/dist/heading/internal/DefaultHeadingStyles.d.ts +15 -0
  187. package/dist/heading/internal/DefaultHeadingStyles.js +75 -0
  188. package/dist/heading/models/Align.d.ts +8 -0
  189. package/dist/heading/models/Align.js +9 -0
  190. package/dist/heading/models/HeadingProps.d.ts +25 -0
  191. package/dist/heading/models/HeadingProps.js +1 -0
  192. package/dist/heading/models/HeadingTag.d.ts +1 -0
  193. package/dist/heading/models/HeadingTag.js +1 -0
  194. package/dist/heading/models/index.d.ts +3 -0
  195. package/dist/heading/models/index.js +3 -0
  196. package/dist/index.d.ts +2 -0
  197. package/dist/index.js +2 -0
  198. package/dist/ordered-map/OrderedMap.svelte.d.ts +27 -0
  199. package/dist/ordered-map/OrderedMap.svelte.js +138 -0
  200. package/dist/ordered-map/__tests__/builders/OrderedMapBuilder.d.ts +9 -0
  201. package/dist/ordered-map/__tests__/builders/OrderedMapBuilder.js +26 -0
  202. package/dist/ordered-map/index.d.ts +1 -0
  203. package/dist/ordered-map/index.js +1 -0
  204. package/dist/paragraph/P.svelte +21 -0
  205. package/dist/paragraph/P.svelte.d.ts +4 -0
  206. package/dist/paragraph/PComponents.svelte.d.ts +13 -0
  207. package/dist/paragraph/PComponents.svelte.js +20 -0
  208. package/dist/paragraph/ParagraphStyles.d.ts +11 -0
  209. package/dist/paragraph/ParagraphStyles.js +1 -0
  210. package/dist/paragraph/__tests__/PStory.svelte +15 -0
  211. package/dist/paragraph/__tests__/PStory.svelte.d.ts +10 -0
  212. package/dist/paragraph/__tests__/ParagraphBuilder.d.ts +10 -0
  213. package/dist/paragraph/__tests__/ParagraphBuilder.js +28 -0
  214. package/dist/paragraph/index.d.ts +5 -0
  215. package/dist/paragraph/index.js +8 -0
  216. package/dist/paragraph/internal/DefaultParagraphStyles.d.ts +15 -0
  217. package/dist/paragraph/internal/DefaultParagraphStyles.js +61 -0
  218. package/dist/paragraph/internal/classes.d.ts +6 -0
  219. package/dist/paragraph/internal/classes.js +7 -0
  220. package/dist/paragraph/models/PFont.d.ts +4 -0
  221. package/dist/paragraph/models/PFont.js +5 -0
  222. package/dist/paragraph/models/PProps.d.ts +12 -0
  223. package/dist/paragraph/models/PProps.js +1 -0
  224. package/dist/paragraph/models/PSize.d.ts +6 -0
  225. package/dist/paragraph/models/PSize.js +7 -0
  226. package/dist/paragraph/models/index.d.ts +3 -0
  227. package/dist/paragraph/models/index.js +3 -0
  228. package/dist/theme/Component.svelte.d.ts +13 -0
  229. package/dist/theme/Component.svelte.js +20 -0
  230. package/dist/theme/index.d.ts +2 -0
  231. package/dist/theme/index.js +2 -0
  232. package/dist/theme/models/ThemableComponent.d.ts +6 -0
  233. package/dist/theme/models/ThemableComponent.js +1 -0
  234. package/dist/theme/models/Theme.d.ts +9 -0
  235. package/dist/theme/models/Theme.js +10 -0
  236. package/dist/theme/models/index.d.ts +2 -0
  237. package/dist/theme/models/index.js +2 -0
  238. package/dist/theme/themeDefaults.d.ts +2 -0
  239. package/dist/theme/themeDefaults.js +2 -0
  240. package/dist/types/KeysOfType.d.ts +3 -0
  241. package/dist/types/KeysOfType.js +1 -0
  242. package/dist/types/SurfaceContainerStyles.d.ts +4 -0
  243. package/dist/types/SurfaceContainerStyles.js +1 -0
  244. package/package.json +82 -0
package/README.md ADDED
@@ -0,0 +1,103 @@
1
+ # Sveltix
2
+
3
+ ## Getting started
4
+
5
+ To make it easy for you to get started with GitLab, here's a list of recommended next steps.
6
+
7
+ Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
8
+
9
+ ## Add your files
10
+
11
+ - [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
12
+ - [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
13
+
14
+ ```
15
+ cd existing_repo
16
+ git remote add origin https://gitlab.com/0djek/sveltix.git
17
+ git branch -M main
18
+ git push -uf origin main
19
+ ```
20
+
21
+ ## Integrate with your tools
22
+
23
+ - [ ] [Set up project integrations](https://gitlab.com/0djek/sveltix/-/settings/integrations)
24
+
25
+ ## Collaborate with your team
26
+
27
+ - [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
28
+ - [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
29
+ - [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
30
+ - [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
31
+ - [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
32
+
33
+ ## Test and Deploy
34
+
35
+ Use the built-in continuous integration in GitLab.
36
+
37
+ - [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
38
+ - [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
39
+ - [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
40
+ - [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
41
+ - [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
42
+
43
+ ---
44
+
45
+ # Editing this README
46
+
47
+ When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
48
+
49
+ ## Suggestions for a good README
50
+
51
+ Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
52
+
53
+ ## Name
54
+
55
+ Choose a self-explaining name for your project.
56
+
57
+ ## Description
58
+
59
+ Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
60
+
61
+ ## Badges
62
+
63
+ On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
64
+
65
+ ## Visuals
66
+
67
+ Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
68
+
69
+ ## Installation
70
+
71
+ Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
72
+
73
+ ## Usage
74
+
75
+ Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
76
+
77
+ ## Support
78
+
79
+ Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
80
+
81
+ ## Roadmap
82
+
83
+ If you have ideas for releases in the future, it is a good idea to list them in the README.
84
+
85
+ ## Contributing
86
+
87
+ State if you are open to contributions and what your requirements are for accepting them.
88
+
89
+ For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
90
+
91
+ You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
92
+
93
+ ## Authors and acknowledgment
94
+
95
+ Show your appreciation to those who have contributed to the project.
96
+
97
+ ## License
98
+
99
+ For open source projects, say how it is licensed.
100
+
101
+ ## Project status
102
+
103
+ If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
@@ -0,0 +1,24 @@
1
+ <script lang="ts">
2
+ import { buttonKey } from '.';
3
+ import { ButtonComponent } from './ButtonComponent.svelte';
4
+ import type { ButtonProps } from './models/ButtonProps';
5
+
6
+ const props: ButtonProps = $props();
7
+
8
+ const button = new ButtonComponent(() => props, buttonKey);
9
+ </script>
10
+
11
+ <button
12
+ class={[
13
+ button.getStyles().getBase(),
14
+ button.getStyles().getTheme(button.getTheme(), button.getVariant()),
15
+ button.getStyles().getSize(button.getSize()),
16
+ {
17
+ 'w-fit': !button.getStretch(),
18
+ },
19
+ ]}
20
+ onclick={() => button.clicked()}
21
+ ondblclick={() => button.dblClicked()}
22
+ disabled={button.getDisabled()}>
23
+ {@render props.children?.()}
24
+ </button>
@@ -0,0 +1,4 @@
1
+ import type { ButtonProps } from './models/ButtonProps';
2
+ declare const Button: import("svelte").Component<ButtonProps, {}, "">;
3
+ type Button = ReturnType<typeof Button>;
4
+ export default Button;
@@ -0,0 +1,15 @@
1
+ import { Component } from '../theme';
2
+ import type { ButtonStyles } from './ButtonStyles';
3
+ import type { ButtonProps, ButtonSize, ButtonVariant } from './models';
4
+ export declare class ButtonComponent extends Component<ButtonStyles, ButtonProps> {
5
+ private _size;
6
+ private _variant;
7
+ private _stretch;
8
+ private _disabled;
9
+ getSize(): ButtonSize;
10
+ getVariant(): ButtonVariant;
11
+ getStretch(): boolean;
12
+ getDisabled(): boolean;
13
+ clicked(): void;
14
+ dblClicked(): void;
15
+ }
@@ -0,0 +1,26 @@
1
+ import { Component } from '../theme';
2
+ import { buttonDefaults } from './buttonDefaults';
3
+ export class ButtonComponent extends Component {
4
+ _size = $derived(this._getProps().size ?? buttonDefaults.meta.size);
5
+ _variant = $derived(this._getProps().variant ?? buttonDefaults.meta.variant);
6
+ _stretch = $derived(this._getProps().stretch ?? buttonDefaults.meta.stretch);
7
+ _disabled = $derived(this._getProps().disabled ?? buttonDefaults.meta.disabled);
8
+ getSize() {
9
+ return this._size;
10
+ }
11
+ getVariant() {
12
+ return this._variant;
13
+ }
14
+ getStretch() {
15
+ return this._stretch;
16
+ }
17
+ getDisabled() {
18
+ return this._disabled;
19
+ }
20
+ clicked() {
21
+ this._getProps().events.click?.();
22
+ }
23
+ dblClicked() {
24
+ this._getProps().events.dblClick?.();
25
+ }
26
+ }
@@ -0,0 +1,11 @@
1
+ import { Theme } from '../theme';
2
+ import { ButtonSize } from './models/ButtonSize';
3
+ import type { ButtonVariant } from './models/ButtonVariant';
4
+ export interface ButtonStyles {
5
+ getBase(): string;
6
+ setBase(base: string): void;
7
+ setSize(size: ButtonSize, classes: string): void;
8
+ getSize(size: ButtonSize): string;
9
+ setTheme(theme: Theme, variant: ButtonVariant, classes: string): void;
10
+ getTheme(theme: Theme, variant: ButtonVariant): string;
11
+ }
@@ -0,0 +1,2 @@
1
+ import { Theme } from '../theme';
2
+ import { ButtonSize } from './models/ButtonSize';
@@ -0,0 +1,23 @@
1
+ import { type Mock } from 'vitest';
2
+ import { ButtonPom } from '../pom/ButtonPom';
3
+ import type { Procedure } from '@vitest/spy';
4
+ import { Theme } from '../../../theme';
5
+ import type { ButtonSize, ButtonVariant } from '../../models';
6
+ export declare class ButtonBuilder {
7
+ private _content;
8
+ private _onClick;
9
+ private _onDblClick;
10
+ private _theme;
11
+ private _isDisabled;
12
+ private _variant;
13
+ private _size;
14
+ static create(): ButtonBuilder;
15
+ withContent(content: string): ButtonBuilder;
16
+ withOnClick(onClick: Mock<Procedure>): ButtonBuilder;
17
+ withOnDblClick(onDblClick: Mock<Procedure>): ButtonBuilder;
18
+ withTheme(theme: Theme): ButtonBuilder;
19
+ withVariant(variant: ButtonVariant): ButtonBuilder;
20
+ withDisabled(isDisabled: boolean): ButtonBuilder;
21
+ withSize(size: ButtonSize): ButtonBuilder;
22
+ build(): Promise<ButtonPom>;
23
+ }
@@ -0,0 +1,61 @@
1
+ import { vi } from 'vitest';
2
+ import { ButtonPom } from '../pom/ButtonPom';
3
+ import ButtonStory from './ButtonStory.svelte';
4
+ import { render } from 'vitest-browser-svelte';
5
+ import { Theme } from '../../../theme';
6
+ import { DEFAULT_THEME } from '../../../theme/themeDefaults';
7
+ import { buttonDefaults } from '../../buttonDefaults';
8
+ export class ButtonBuilder {
9
+ _content = 'Default content';
10
+ _onClick = vi.fn();
11
+ _onDblClick = vi.fn();
12
+ _theme = DEFAULT_THEME;
13
+ _isDisabled = false;
14
+ _variant = buttonDefaults.meta.variant;
15
+ _size = buttonDefaults.meta.size;
16
+ static create() {
17
+ return new ButtonBuilder();
18
+ }
19
+ withContent(content) {
20
+ this._content = content;
21
+ return this;
22
+ }
23
+ withOnClick(onClick) {
24
+ this._onClick = onClick;
25
+ return this;
26
+ }
27
+ withOnDblClick(onDblClick) {
28
+ this._onDblClick = onDblClick;
29
+ return this;
30
+ }
31
+ withTheme(theme) {
32
+ this._theme = theme;
33
+ return this;
34
+ }
35
+ withVariant(variant) {
36
+ this._variant = variant;
37
+ return this;
38
+ }
39
+ withDisabled(isDisabled) {
40
+ this._isDisabled = isDisabled;
41
+ return this;
42
+ }
43
+ withSize(size) {
44
+ this._size = size;
45
+ return this;
46
+ }
47
+ async build() {
48
+ await render(ButtonStory, {
49
+ props: {
50
+ content: this._content,
51
+ onClick: this._onClick,
52
+ onDblClick: this._onDblClick,
53
+ theme: this._theme,
54
+ disabled: this._isDisabled,
55
+ variant: this._variant,
56
+ size: this._size,
57
+ },
58
+ });
59
+ return new ButtonPom();
60
+ }
61
+ }
@@ -0,0 +1,27 @@
1
+ <script lang="ts">
2
+ import Button from '../../Button.svelte';
3
+ import type { ButtonSize, ButtonVariant } from '../../models';
4
+ import type { Theme } from '../../../theme';
5
+
6
+ interface Props {
7
+ content: string;
8
+ onClick: () => void;
9
+ onDblClick: () => void;
10
+ theme: Theme;
11
+ disabled: boolean;
12
+ variant: ButtonVariant;
13
+ size: ButtonSize;
14
+ }
15
+
16
+ const { content, onClick, onDblClick, theme, disabled, variant, size }: Props = $props();
17
+ </script>
18
+
19
+ <Button
20
+ {theme}
21
+ {disabled}
22
+ {variant}
23
+ {size}
24
+ events={{
25
+ click: onClick,
26
+ dblClick: onDblClick,
27
+ }}>{content}</Button>
@@ -0,0 +1,14 @@
1
+ import type { ButtonSize, ButtonVariant } from '../../models';
2
+ import type { Theme } from '../../../theme';
3
+ interface Props {
4
+ content: string;
5
+ onClick: () => void;
6
+ onDblClick: () => void;
7
+ theme: Theme;
8
+ disabled: boolean;
9
+ variant: ButtonVariant;
10
+ size: ButtonSize;
11
+ }
12
+ declare const ButtonStory: import("svelte").Component<Props, {}, "">;
13
+ type ButtonStory = ReturnType<typeof ButtonStory>;
14
+ export default ButtonStory;
@@ -0,0 +1,6 @@
1
+ import { type Locator } from 'vitest/browser';
2
+ export declare class ButtonPom {
3
+ getButton(): Locator;
4
+ click(): Promise<void>;
5
+ dblClick(): Promise<void>;
6
+ }
@@ -0,0 +1,14 @@
1
+ import { page } from 'vitest/browser';
2
+ export class ButtonPom {
3
+ getButton() {
4
+ return page.getByRole('button');
5
+ }
6
+ async click() {
7
+ const button = this.getButton();
8
+ await button.click();
9
+ }
10
+ async dblClick() {
11
+ const button = this.getButton();
12
+ await button.dblClick();
13
+ }
14
+ }
@@ -0,0 +1,9 @@
1
+ import { ButtonSize, ButtonVariant } from './models';
2
+ export declare const buttonDefaults: {
3
+ meta: {
4
+ size: ButtonSize;
5
+ variant: ButtonVariant;
6
+ stretch: boolean;
7
+ disabled: boolean;
8
+ };
9
+ };
@@ -0,0 +1,9 @@
1
+ import { ButtonSize, ButtonVariant } from './models';
2
+ export const buttonDefaults = {
3
+ meta: {
4
+ size: ButtonSize.Sm,
5
+ variant: ButtonVariant.Solid,
6
+ stretch: false,
7
+ disabled: false,
8
+ },
9
+ };
@@ -0,0 +1,5 @@
1
+ import Button from './Button.svelte';
2
+ import { type ButtonStyles } from './ButtonStyles';
3
+ export { Button };
4
+ export * from './models';
5
+ export declare const buttonKey: import("../di/DiContainer").InjectionKey<ButtonStyles>;
@@ -0,0 +1,9 @@
1
+ import { sveltix } from '..';
2
+ import { createKey } from '../di/DiContainer';
3
+ import Button from './Button.svelte';
4
+ import {} from './ButtonStyles';
5
+ import { DefaultButtonStyles } from './internal/DefaultButtonStyles';
6
+ export { Button };
7
+ export * from './models';
8
+ export const buttonKey = createKey(DefaultButtonStyles);
9
+ sveltix.registerSingleton(buttonKey);
@@ -0,0 +1,15 @@
1
+ import type { Theme } from '../../theme';
2
+ import type { ButtonStyles } from '../ButtonStyles';
3
+ import type { ButtonSize } from '../models/ButtonSize';
4
+ import type { ButtonVariant } from '../models/ButtonVariant';
5
+ export declare class DefaultButtonStyles implements ButtonStyles {
6
+ private _baseClasses;
7
+ private _sizes;
8
+ private _themes;
9
+ getBase(): string;
10
+ setBase(base: string): void;
11
+ setSize(size: ButtonSize, classes: string): void;
12
+ getSize(size: ButtonSize): string;
13
+ setTheme(theme: Theme, variant: ButtonVariant, classes: string): void;
14
+ getTheme(theme: Theme, variant: ButtonVariant): string;
15
+ }
@@ -0,0 +1,64 @@
1
+ export class DefaultButtonStyles {
2
+ _baseClasses = 'inline-flex justify-center items-center cursor-pointer disabled:cursor-not-allowed disabled:opacity-50';
3
+ _sizes = {
4
+ Xs: 'gap-1 rounded-md px-2 text-p-xs py-1',
5
+ Sm: 'gap-1 rounded-lg px-2.5 text-p-sm py-1.5',
6
+ Default: 'gap-1.5 rounded-lg px-3 py-2 text-p-md',
7
+ Lg: 'gap-1.5 rounded-lg px-4 py-3 text-p-lg',
8
+ };
9
+ _themes = {
10
+ Primary: {
11
+ Outline: 'ring-2 ring-primary text-primary-on-surface hover:bg-primary-surface-hover hover:text-primary-on-surface-hover focus:bg-primary-surface-focus focus:text-primary-on-surface-focus',
12
+ Solid: 'bg-primary text-primary-on font-medium hover:bg-primary-hover focus:bg-primary-focus',
13
+ Text: 'text-primary-on-surface hover:text-primary-on-surface-hover hover:bg-primary-surface focus:bg-primary-surface-focus focus:text-primary-on-surface-focus',
14
+ },
15
+ Secondary: {
16
+ Outline: 'ring-2 ring-secondary text-secondary-on-surface hover:bg-secondary-surface-hover hover:text-secondary-on-surface-hover focus:bg-secondary-surface-focus focus:text-secondary-on-surface-focus',
17
+ Solid: 'bg-secondary text-secondary-on font-medium hover:bg-secondary-hover focus:bg-secondary-focus',
18
+ Text: 'text-secondary-on-surface hover:text-secondary-on-surface-hover hover:bg-secondary-surface focus:bg-secondary-surface-focus focus:text-secondary-on-surface-focus',
19
+ },
20
+ Neutral: {
21
+ Outline: 'ring-2 ring-neutral text-neutral-on-surface hover:bg-neutral-surface-hover hover:text-neutral-on-surface-hover focus:bg-neutral-surface-focus focus:text-neutral-on-surface-focus',
22
+ Solid: 'bg-neutral text-neutral-on font-medium hover:bg-neutral-hover focus:bg-neutral-focus',
23
+ Text: 'text-neutral-on-surface hover:text-neutral-on-surface-hover hover:bg-neutral-surface focus:bg-neutral-surface-focus focus:text-neutral-on-surface-focus',
24
+ },
25
+ Info: {
26
+ Outline: 'ring-2 ring-info text-info-on-surface hover:bg-info-surface-hover hover:text-info-on-surface-hover focus:bg-info-surface-focus focus:text-info-on-surface-focus',
27
+ Solid: 'bg-info text-info-on font-medium hover:bg-info-hover focus:bg-info-focus',
28
+ Text: 'text-info-on-surface hover:text-info-on-surface-hover hover:bg-info-surface focus:bg-info-surface-focus focus:text-info-on-surface-focus',
29
+ },
30
+ Negative: {
31
+ Outline: 'ring-2 ring-negative text-negative-on-surface hover:bg-negative-surface-hover hover:text-negative-on-surface-hover focus:bg-negative-surface-focus focus:text-negative-on-surface-focus',
32
+ Solid: 'bg-negative text-negative-on font-medium hover:bg-negative-hover focus:bg-negative-focus',
33
+ Text: 'text-negative-on-surface hover:text-negative-on-surface-hover hover:bg-negative-surface focus:bg-negative-surface-focus focus:text-negative-on-surface-focus',
34
+ },
35
+ Positive: {
36
+ Outline: 'ring-2 ring-positive text-positive-on-surface hover:bg-positive-surface-hover hover:text-positive-on-surface-hover focus:bg-positive-surface-focus focus:text-positive-on-surface-focus',
37
+ Solid: 'bg-positive text-positive-on font-medium hover:bg-positive-hover focus:bg-positive-focus',
38
+ Text: 'text-positive-on-surface hover:text-positive-on-surface-hover hover:bg-positive-surface focus:bg-positive-surface-focus focus:text-positive-on-surface-focus',
39
+ },
40
+ Warning: {
41
+ Outline: 'ring-2 ring-warning text-warning-on-surface hover:bg-warning-surface-hover hover:text-warning-on-surface-hover focus:bg-warning-surface-focus focus:text-warning-on-surface-focus',
42
+ Solid: 'bg-warning text-warning-on font-medium hover:bg-warning-hover focus:bg-warning-focus',
43
+ Text: 'text-warning-on-surface hover:text-warning-on-surface-hover hover:bg-warning-surface focus:bg-warning-surface-focus focus:text-warning-on-surface-focus',
44
+ },
45
+ };
46
+ getBase() {
47
+ return this._baseClasses;
48
+ }
49
+ setBase(base) {
50
+ this._baseClasses = base;
51
+ }
52
+ setSize(size, classes) {
53
+ this._sizes[size] = classes;
54
+ }
55
+ getSize(size) {
56
+ return this._sizes[size];
57
+ }
58
+ setTheme(theme, variant, classes) {
59
+ this._themes[theme][variant] = classes;
60
+ }
61
+ getTheme(theme, variant) {
62
+ return this._themes[theme][variant];
63
+ }
64
+ }
@@ -0,0 +1,45 @@
1
+ import type { ThemableComponent } from '../../theme';
2
+ import type { Snippet } from 'svelte';
3
+ import type { ButtonSize } from './ButtonSize';
4
+ import type { HTMLButtonAttributes } from 'svelte/elements';
5
+ import type { ButtonVariant } from './ButtonVariant';
6
+ import type { ButtonStyles } from '../ButtonStyles';
7
+ export interface ButtonProps extends ThemableComponent<ButtonStyles> {
8
+ /**
9
+ * Children snippets to render for the component.
10
+ */
11
+ children: Snippet;
12
+ /**
13
+ * If `true`, button can't be clicked.
14
+ */
15
+ disabled?: boolean;
16
+ /**
17
+ * How big the button should be.
18
+ * @default Default
19
+ */
20
+ size?: ButtonSize;
21
+ /**
22
+ * Which variant to use for the button
23
+ * @default Solid
24
+ */
25
+ variant?: ButtonVariant;
26
+ /**
27
+ * If `true`, button stretches to occupy all parent width.
28
+ * @default false
29
+ */
30
+ stretch?: boolean;
31
+ /**
32
+ * Various events dispatched by the button component.
33
+ */
34
+ events: {
35
+ /**
36
+ * Event that is dispatched when button is clicked.
37
+ */
38
+ click?: () => void;
39
+ /**
40
+ * Event that is dispatched when button is double clicked.
41
+ */
42
+ dblClick?: () => void;
43
+ };
44
+ htmlAttrs?: Omit<HTMLButtonAttributes, 'disabled'>;
45
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare enum ButtonSize {
2
+ Xs = "Xs",
3
+ Sm = "Sm",
4
+ Default = "Default",
5
+ Lg = "Lg"
6
+ }
@@ -0,0 +1,7 @@
1
+ export var ButtonSize;
2
+ (function (ButtonSize) {
3
+ ButtonSize["Xs"] = "Xs";
4
+ ButtonSize["Sm"] = "Sm";
5
+ ButtonSize["Default"] = "Default";
6
+ ButtonSize["Lg"] = "Lg";
7
+ })(ButtonSize || (ButtonSize = {}));
@@ -0,0 +1,5 @@
1
+ export declare enum ButtonVariant {
2
+ Solid = "Solid",
3
+ Outline = "Outline",
4
+ Text = "Text"
5
+ }
@@ -0,0 +1,6 @@
1
+ export var ButtonVariant;
2
+ (function (ButtonVariant) {
3
+ ButtonVariant["Solid"] = "Solid";
4
+ ButtonVariant["Outline"] = "Outline";
5
+ ButtonVariant["Text"] = "Text";
6
+ })(ButtonVariant || (ButtonVariant = {}));
@@ -0,0 +1,3 @@
1
+ export * from './ButtonProps';
2
+ export * from './ButtonSize';
3
+ export * from './ButtonVariant';
@@ -0,0 +1,3 @@
1
+ export * from './ButtonProps';
2
+ export * from './ButtonSize';
3
+ export * from './ButtonVariant';
@@ -0,0 +1,18 @@
1
+ interface CacheExistsBase {
2
+ exists: boolean;
3
+ }
4
+ interface CacheExists<TValue> extends CacheExistsBase {
5
+ exists: true;
6
+ value: TValue;
7
+ }
8
+ interface CacheNotExists extends CacheExistsBase {
9
+ exists: false;
10
+ }
11
+ export type CacheResult<T> = CacheExists<T> | CacheNotExists;
12
+ export declare class Cache<TKey, TValue> {
13
+ private _cachedValues;
14
+ set(key: TKey, value: TValue): void;
15
+ get(key: TKey): CacheResult<TValue>;
16
+ delete(key: TKey): void;
17
+ }
18
+ export {};
@@ -0,0 +1,20 @@
1
+ export class Cache {
2
+ _cachedValues = new Map();
3
+ set(key, value) {
4
+ this._cachedValues.set(key, value);
5
+ }
6
+ get(key) {
7
+ if (!this._cachedValues.has(key)) {
8
+ return {
9
+ exists: false,
10
+ };
11
+ }
12
+ return {
13
+ exists: true,
14
+ value: this._cachedValues.get(key),
15
+ };
16
+ }
17
+ delete(key) {
18
+ this._cachedValues.delete(key);
19
+ }
20
+ }
@@ -0,0 +1,7 @@
1
+ import { type CacheResult } from './Cache';
2
+ export declare class MappedCache<T> {
3
+ private _cachedMap;
4
+ get(mapKey: string, cacheKey: string): CacheResult<T>;
5
+ set(mapKey: string, cacheKey: string, value: T): void;
6
+ delete(mapKey: string, cacheKey?: string): void;
7
+ }
@@ -0,0 +1,35 @@
1
+ import { Cache } from './Cache';
2
+ export class MappedCache {
3
+ _cachedMap = new Map();
4
+ get(mapKey, cacheKey) {
5
+ const mappedCache = this._cachedMap.get(mapKey);
6
+ if (mappedCache == null) {
7
+ return {
8
+ exists: false,
9
+ };
10
+ }
11
+ const keyCache = mappedCache.get(cacheKey);
12
+ return keyCache;
13
+ }
14
+ set(mapKey, cacheKey, value) {
15
+ let cache = this._cachedMap.get(mapKey);
16
+ if (cache == null) {
17
+ cache = new Cache();
18
+ }
19
+ cache.set(cacheKey, value);
20
+ this._cachedMap.set(mapKey, cache);
21
+ }
22
+ delete(mapKey, cacheKey) {
23
+ // If cache key is not defined, just delete the whole map.
24
+ if (cacheKey == null) {
25
+ this._cachedMap.delete(mapKey);
26
+ return;
27
+ }
28
+ let cache = this._cachedMap.get(mapKey);
29
+ if (cache == null) {
30
+ cache = new Cache();
31
+ }
32
+ cache.delete(cacheKey);
33
+ this._cachedMap.set(mapKey, cache);
34
+ }
35
+ }
@@ -0,0 +1,7 @@
1
+ import { Cache } from '../../Cache';
2
+ export declare class CacheBuilder {
3
+ private _entries;
4
+ static create(): CacheBuilder;
5
+ setEntry(key: string, value: number): CacheBuilder;
6
+ build(): Cache<string, number>;
7
+ }