svelte-multistyle-ui 0.0.1-alpha

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 (160) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +183 -0
  3. package/dist/actions/portal.d.ts +20 -0
  4. package/dist/actions/portal.js +32 -0
  5. package/dist/components/Accordion.svelte +64 -0
  6. package/dist/components/Accordion.svelte.d.ts +19 -0
  7. package/dist/components/Alert.svelte +61 -0
  8. package/dist/components/Alert.svelte.d.ts +23 -0
  9. package/dist/components/Avatar.svelte +31 -0
  10. package/dist/components/Avatar.svelte.d.ts +21 -0
  11. package/dist/components/Breadcrumb.svelte +35 -0
  12. package/dist/components/Breadcrumb.svelte.d.ts +15 -0
  13. package/dist/components/Button.svelte +34 -0
  14. package/dist/components/Button.svelte.d.ts +25 -0
  15. package/dist/components/ButtonGroup.svelte +45 -0
  16. package/dist/components/ButtonGroup.svelte.d.ts +23 -0
  17. package/dist/components/Card.svelte +29 -0
  18. package/dist/components/Card.svelte.d.ts +21 -0
  19. package/dist/components/Carousel.svelte +111 -0
  20. package/dist/components/Carousel.svelte.d.ts +23 -0
  21. package/dist/components/Checkbox.svelte +64 -0
  22. package/dist/components/Checkbox.svelte.d.ts +21 -0
  23. package/dist/components/Chip.svelte +43 -0
  24. package/dist/components/Chip.svelte.d.ts +27 -0
  25. package/dist/components/Column.svelte +38 -0
  26. package/dist/components/Column.svelte.d.ts +21 -0
  27. package/dist/components/CommandPalette.svelte +207 -0
  28. package/dist/components/CommandPalette.svelte.d.ts +19 -0
  29. package/dist/components/DatePicker.svelte +365 -0
  30. package/dist/components/DatePicker.svelte.d.ts +31 -0
  31. package/dist/components/Divider.svelte +32 -0
  32. package/dist/components/Divider.svelte.d.ts +17 -0
  33. package/dist/components/Drawer.svelte +69 -0
  34. package/dist/components/Drawer.svelte.d.ts +21 -0
  35. package/dist/components/DropdownMenu.svelte +113 -0
  36. package/dist/components/DropdownMenu.svelte.d.ts +25 -0
  37. package/dist/components/FAB.svelte +27 -0
  38. package/dist/components/FAB.svelte.d.ts +19 -0
  39. package/dist/components/FileUpload.svelte +76 -0
  40. package/dist/components/FileUpload.svelte.d.ts +21 -0
  41. package/dist/components/Grid.svelte +51 -0
  42. package/dist/components/Grid.svelte.d.ts +27 -0
  43. package/dist/components/IconButton.svelte +39 -0
  44. package/dist/components/IconButton.svelte.d.ts +27 -0
  45. package/dist/components/Input.svelte +121 -0
  46. package/dist/components/Input.svelte.d.ts +69 -0
  47. package/dist/components/Modal.svelte +57 -0
  48. package/dist/components/Modal.svelte.d.ts +23 -0
  49. package/dist/components/MultiSelect.svelte +125 -0
  50. package/dist/components/MultiSelect.svelte.d.ts +23 -0
  51. package/dist/components/Pagination.svelte +52 -0
  52. package/dist/components/Pagination.svelte.d.ts +19 -0
  53. package/dist/components/Popover.svelte +114 -0
  54. package/dist/components/Popover.svelte.d.ts +23 -0
  55. package/dist/components/ProgressBar.svelte +72 -0
  56. package/dist/components/ProgressBar.svelte.d.ts +21 -0
  57. package/dist/components/Radio.svelte +39 -0
  58. package/dist/components/Radio.svelte.d.ts +21 -0
  59. package/dist/components/Rating.svelte +102 -0
  60. package/dist/components/Rating.svelte.d.ts +25 -0
  61. package/dist/components/Row.svelte +39 -0
  62. package/dist/components/Row.svelte.d.ts +23 -0
  63. package/dist/components/Select.svelte +80 -0
  64. package/dist/components/Select.svelte.d.ts +23 -0
  65. package/dist/components/Skeleton.svelte +26 -0
  66. package/dist/components/Skeleton.svelte.d.ts +19 -0
  67. package/dist/components/Slider.svelte +46 -0
  68. package/dist/components/Slider.svelte.d.ts +25 -0
  69. package/dist/components/Spinner.svelte +27 -0
  70. package/dist/components/Spinner.svelte.d.ts +15 -0
  71. package/dist/components/Stepper.svelte +34 -0
  72. package/dist/components/Stepper.svelte.d.ts +17 -0
  73. package/dist/components/Table.svelte +59 -0
  74. package/dist/components/Table.svelte.d.ts +19 -0
  75. package/dist/components/Tabs.svelte +32 -0
  76. package/dist/components/Tabs.svelte.d.ts +17 -0
  77. package/dist/components/Textarea.svelte +86 -0
  78. package/dist/components/Textarea.svelte.d.ts +31 -0
  79. package/dist/components/Toast.svelte +90 -0
  80. package/dist/components/Toast.svelte.d.ts +19 -0
  81. package/dist/components/Toggle.svelte +46 -0
  82. package/dist/components/Toggle.svelte.d.ts +21 -0
  83. package/dist/components/Tooltip.svelte +35 -0
  84. package/dist/components/Tooltip.svelte.d.ts +19 -0
  85. package/dist/components/accordion-styles.css +89 -0
  86. package/dist/components/alert-styles.css +66 -0
  87. package/dist/components/avatar-styles.css +50 -0
  88. package/dist/components/breadcrumb-styles.css +73 -0
  89. package/dist/components/button-styles.css +272 -0
  90. package/dist/components/buttongroup-styles.css +118 -0
  91. package/dist/components/card-styles.css +101 -0
  92. package/dist/components/carousel-styles.css +145 -0
  93. package/dist/components/charts/BarChart.svelte +5 -0
  94. package/dist/components/charts/BarChart.svelte.d.ts +29 -0
  95. package/dist/components/charts/BubbleChart.svelte +5 -0
  96. package/dist/components/charts/BubbleChart.svelte.d.ts +29 -0
  97. package/dist/components/charts/Chart.svelte +186 -0
  98. package/dist/components/charts/Chart.svelte.d.ts +37 -0
  99. package/dist/components/charts/ComboChart.svelte +5 -0
  100. package/dist/components/charts/ComboChart.svelte.d.ts +29 -0
  101. package/dist/components/charts/DoughnutChart.svelte +5 -0
  102. package/dist/components/charts/DoughnutChart.svelte.d.ts +29 -0
  103. package/dist/components/charts/LineChart.svelte +5 -0
  104. package/dist/components/charts/LineChart.svelte.d.ts +29 -0
  105. package/dist/components/charts/PieChart.svelte +5 -0
  106. package/dist/components/charts/PieChart.svelte.d.ts +29 -0
  107. package/dist/components/charts/PolarAreaChart.svelte +5 -0
  108. package/dist/components/charts/PolarAreaChart.svelte.d.ts +29 -0
  109. package/dist/components/charts/RadarChart.svelte +5 -0
  110. package/dist/components/charts/RadarChart.svelte.d.ts +29 -0
  111. package/dist/components/charts/ScatterChart.svelte +5 -0
  112. package/dist/components/charts/ScatterChart.svelte.d.ts +29 -0
  113. package/dist/components/charts/StackedBarChart.svelte +18 -0
  114. package/dist/components/charts/StackedBarChart.svelte.d.ts +29 -0
  115. package/dist/components/charts/StackedLineChart.svelte +21 -0
  116. package/dist/components/charts/StackedLineChart.svelte.d.ts +29 -0
  117. package/dist/components/charts/chart-config.d.ts +102 -0
  118. package/dist/components/charts/chart-config.js +616 -0
  119. package/dist/components/charts/chart-styles.css +159 -0
  120. package/dist/components/checkbox-styles.css +125 -0
  121. package/dist/components/chip-styles.css +107 -0
  122. package/dist/components/column-styles.css +6 -0
  123. package/dist/components/commandpalette-styles.css +162 -0
  124. package/dist/components/datepicker-styles.css +1011 -0
  125. package/dist/components/divider-styles.css +56 -0
  126. package/dist/components/drawer-styles.css +83 -0
  127. package/dist/components/dropdown-styles.css +128 -0
  128. package/dist/components/fab-styles.css +61 -0
  129. package/dist/components/fileupload-styles.css +125 -0
  130. package/dist/components/grid-styles.css +6 -0
  131. package/dist/components/iconbutton-styles.css +146 -0
  132. package/dist/components/input-styles.css +436 -0
  133. package/dist/components/modal-styles.css +103 -0
  134. package/dist/components/multiselect-styles.css +202 -0
  135. package/dist/components/pagination-styles.css +63 -0
  136. package/dist/components/popover-styles.css +122 -0
  137. package/dist/components/progressbar-styles.css +106 -0
  138. package/dist/components/radio-styles.css +120 -0
  139. package/dist/components/rating-styles.css +68 -0
  140. package/dist/components/row-styles.css +6 -0
  141. package/dist/components/select-styles.css +218 -0
  142. package/dist/components/skeleton-styles.css +48 -0
  143. package/dist/components/slider-styles.css +85 -0
  144. package/dist/components/spinner-styles.css +52 -0
  145. package/dist/components/stepper-styles.css +93 -0
  146. package/dist/components/table-styles.css +114 -0
  147. package/dist/components/tabs-styles.css +74 -0
  148. package/dist/components/textarea-styles.css +224 -0
  149. package/dist/components/theme-base.css +64 -0
  150. package/dist/components/theme.css +440 -0
  151. package/dist/components/toast-styles.css +106 -0
  152. package/dist/components/toggle-styles.css +131 -0
  153. package/dist/components/tooltip-styles.css +56 -0
  154. package/dist/config.d.ts +1 -0
  155. package/dist/config.js +9 -0
  156. package/dist/config.svelte.d.ts +25 -0
  157. package/dist/config.svelte.js +41 -0
  158. package/dist/index.d.ts +52 -0
  159. package/dist/index.js +69 -0
  160. package/package.json +65 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
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,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,183 @@
1
+ # svelte-multistyle-ui
2
+
3
+ A multi-style, multi-theme **Svelte 5** component library. Every component can render in more than a dozen visual design languages (styles) and switch between several color palettes (themes) via two simple props.
4
+
5
+ **Live demo:** https://avinashskaranth.github.io/svelte-multistyle-ui/
6
+
7
+ ## Features
8
+
9
+ - **Svelte 5 native** — uses runes (`$props`, `$state`, `$derived`, `$effect`) and snippets (`{@render children?.()}`).
10
+ - **13 visual styles** — material, material3, fluent, brutalist, pixel, neon, metro, bootstrap, cartoon, illustration, carbon, liquid-glass, legacy-ios.
11
+ - **10 color themes** — default, ocean, forest, rose, midnight, gold, slate, candy, storm, royal.
12
+ - **CSS custom-property based theming** — easy to override or build custom themes without forking.
13
+ - **Tailwind CSS v4** friendly — no `tailwind.config.js` required; just import the theme CSS.
14
+ - **Playwright visual tests** for the interactive demo gallery.
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npm install svelte-multistyle-ui
20
+ # or
21
+ pnpm add svelte-multistyle-ui
22
+ ```
23
+
24
+ > Requires Svelte `^5.0.0` and Chart.js `^4.5.1` as peer dependencies (Chart.js is only needed if you use the chart components).
25
+
26
+ ## LLM skill
27
+
28
+ This repo ships a LLM skill (in [`/skill`](./skill)) that teaches your coding agent the library's API — every component's props, all styles/themes, and how to write custom `--t-*` themes. Add it to your own project so Claude can help you build with this library:
29
+
30
+ ```bash
31
+ npx skills add https://github.com/AvinashSKaranth/svelte-multistyle-ui/skill
32
+ ```
33
+
34
+ ## Quick start
35
+
36
+ Import the theme stylesheet once in your app, then use any component:
37
+
38
+ ```svelte
39
+ <script>
40
+ import 'svelte-multistyle-ui/theme.css';
41
+ import { Button, Card } from 'svelte-multistyle-ui';
42
+ </script>
43
+
44
+ <Card style="material" theme="ocean" elevated>
45
+ {#snippet children()}
46
+ <h2>Hello</h2>
47
+ <Button style="material" theme="ocean" variant="filled">
48
+ {#snippet children()}Get started{/snippet}
49
+ </Button>
50
+ {/snippet}
51
+ </Card>
52
+ ```
53
+
54
+ ## Global configuration
55
+
56
+ Import `initMultistyleUI` once in your app (e.g. `+layout.svelte` or `App.svelte`) to set the default `style`, `theme`, and color `mode` for every component at once. Per-component `style`/`theme` props still override these defaults.
57
+
58
+ ```js
59
+ import { initMultistyleUI } from "svelte-multistyle-ui";
60
+
61
+ initMultistyleUI({
62
+ style: "material", // visual design system
63
+ theme: "ocean", // color theme preset
64
+ mode: "system", // "system" | "light" | "dark"
65
+ });
66
+ ```
67
+
68
+ `defaults` (a reactive `$state` object) and `iconClass` (the CSS class used to render icon names — defaults to `material-symbols-outlined`) are also exported for advanced use.
69
+
70
+ ## Actions
71
+
72
+ A Svelte action for portaling content to `document.body`:
73
+
74
+ ```svelte
75
+ <script>
76
+ import { portal } from 'svelte-multistyle-ui';
77
+ </script>
78
+
79
+ <div use:portal>Portaled content</div>
80
+ ```
81
+
82
+ ## Components
83
+
84
+ The library exports the following components from `svelte-multistyle-ui`:
85
+
86
+ - Actions: `Button`, `IconButton`, `FAB`, `ButtonGroup`, `DropdownMenu`, `Popover`
87
+ - Form: `Input`, `Textarea`, `Select`, `MultiSelect`, `Checkbox`, `Radio`, `Toggle`, `Slider`, `FileUpload`, `DatePicker`
88
+ - Layout: `Card`, `Divider`, `Tabs`, `Accordion`, `Modal`, `Drawer`, `CommandPalette`, `Row`, `Column`, `Grid`
89
+ - Navigation: `Breadcrumb`, `Pagination`, `Stepper`
90
+ - Data display: `Avatar`, `Chip`, `Tooltip`, `ProgressBar`, `Table`, `Spinner`, `Skeleton`, `Rating`
91
+ - Feedback: `Alert`, `Toast`
92
+ - Charts: `BarChart`, `LineChart`, `PieChart`, `DoughnutChart`, `RadarChart`, `PolarAreaChart`, `ScatterChart`, `BubbleChart`, `StackedBarChart`, `StackedLineChart`, `ComboChart`
93
+
94
+ You can also import individual files from `svelte-multistyle-ui/components/<Component>.svelte`, and chart components from `svelte-multistyle-ui/charts/<Chart>.svelte`.
95
+
96
+ ## Theming
97
+
98
+ ### Preset themes
99
+
100
+ Import the full preset bundle:
101
+
102
+ ```js
103
+ import "svelte-multistyle-ui/theme.css";
104
+ ```
105
+
106
+ Themes are applied by adding a `theme-{name}` class to a container (usually `<html>` or a wrapping element). Light and dark variants are selected with `html.light` / `html.dark`.
107
+
108
+ ### Custom themes
109
+
110
+ Import only the token defaults and define your own presets:
111
+
112
+ ```css
113
+ @import "svelte-multistyle-ui/theme-base.css";
114
+
115
+ .theme-brand {
116
+ --t-primary: #7c3aed;
117
+ --t-secondary: #a78bfa;
118
+ --t-surface: #ffffff;
119
+ --t-card-bg: #ffffff;
120
+ --t-card-border-color: #ddd6fe;
121
+ --t-text: #2e1065;
122
+ --t-text-muted: #7c3aed;
123
+ }
124
+
125
+ html.dark .theme-brand {
126
+ --t-surface-bg: #1e0a4e;
127
+ --t-card-bg: #3b0764;
128
+ --t-text: #ddd6fe;
129
+ }
130
+ ```
131
+
132
+ Key tokens include `--t-primary`, `--t-secondary`, `--t-surface`, `--t-card-bg`, `--t-card-border-color`, `--t-text`, `--t-text-muted`, `--t-btn-bg`, `--t-btn-radius`, `--t-card-radius`, `--t-border-width`, and `--t-shadow-*`.
133
+
134
+ ## Demo & development
135
+
136
+ This repository contains a Vite demo app in `src/App.svelte` that renders every component across every style and theme.
137
+
138
+ ```bash
139
+ pnpm install
140
+ pnpm dev # start the demo
141
+ pnpm build # build the demo (static HTML/CSS/JS) to docs/
142
+ pnpm build:lib # build the library for publishing (to dist/)
143
+ pnpm preview # preview the production demo
144
+ pnpm test # run Playwright visual tests
145
+ pnpm test:ui # open the Playwright UI runner
146
+ ```
147
+
148
+ The demo supports URL parameters for quick visual regression checks:
149
+
150
+ ```
151
+ /?style=brutalist&theme=midnight&mode=dark
152
+ ```
153
+
154
+ ## Architecture notes
155
+
156
+ - Each component uses a base class (`s-<component>`), a style override class (`s-<component>-<style>`), and a theme class (`theme-<theme>`).
157
+ - Per-component styles live in `<component>-styles.css` and rely on theme tokens; no theme colors are hardcoded in component styles unless a design language requires it.
158
+ - Dark/light mode is toggled with `dark` / `light` classes on `<html>`.
159
+ - The library is built with `svelte-package` and emits to `dist/`.
160
+
161
+ ## Charts
162
+
163
+ Chart components are thin styled wrappers around [Chart.js](https://www.chartjs.org/) and accept the same `data` / `options` shape, plus the usual `style` and `theme` props. They require `chart.js` as a peer dependency.
164
+
165
+ ```svelte
166
+ <script>
167
+ import { BarChart } from 'svelte-multistyle-ui';
168
+ import 'svelte-multistyle-ui/theme.css';
169
+
170
+ const data = {
171
+ labels: ['Jan', 'Feb', 'Mar', 'Apr'],
172
+ datasets: [{ label: 'Revenue', data: [12, 19, 7, 15] }]
173
+ };
174
+ </script>
175
+
176
+ <BarChart {data} style="material" theme="ocean" />
177
+ ```
178
+
179
+ A shared `Chart` base component is also exported from `svelte-multistyle-ui/charts/Chart.svelte` for building custom chart types.
180
+
181
+ ## License
182
+
183
+ MIT
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Svelte action that reparents a node to `document.body` while it is mounted.
3
+ *
4
+ * Use this on overlay elements (`position: fixed`) so they escape any
5
+ * ancestor that creates a containing block for fixed descendants — most
6
+ * notably `transform`, `filter`, `backdrop-filter`, `perspective`, and
7
+ * `will-change` on those properties. Without a portal, the overlay is
8
+ * positioned relative to that ancestor instead of the viewport, so it can
9
+ * appear clipped or nested inside a Card.
10
+ *
11
+ * The action restores the node to its original parent on destroy.
12
+ *
13
+ * @example
14
+ * {#if open}
15
+ * <div use:portal class="s-overlay">…</div>
16
+ * {/if}
17
+ */
18
+ export function portal(node: any): {
19
+ destroy(): void;
20
+ };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Svelte action that reparents a node to `document.body` while it is mounted.
3
+ *
4
+ * Use this on overlay elements (`position: fixed`) so they escape any
5
+ * ancestor that creates a containing block for fixed descendants — most
6
+ * notably `transform`, `filter`, `backdrop-filter`, `perspective`, and
7
+ * `will-change` on those properties. Without a portal, the overlay is
8
+ * positioned relative to that ancestor instead of the viewport, so it can
9
+ * appear clipped or nested inside a Card.
10
+ *
11
+ * The action restores the node to its original parent on destroy.
12
+ *
13
+ * @example
14
+ * {#if open}
15
+ * <div use:portal class="s-overlay">…</div>
16
+ * {/if}
17
+ */
18
+ export function portal(node) {
19
+ const originalParent = node.parentNode;
20
+ document.body.appendChild(node);
21
+
22
+ return {
23
+ destroy() {
24
+ if (node.parentNode === document.body) {
25
+ document.body.removeChild(node);
26
+ } else if (originalParent && node.parentNode) {
27
+ // Fallback: reattach to original parent if something else moved it.
28
+ originalParent.appendChild(node);
29
+ }
30
+ },
31
+ };
32
+ }
@@ -0,0 +1,64 @@
1
+ <script>
2
+ import "./accordion-styles.css";
3
+ import { defaults } from "../config.js";
4
+
5
+ let {
6
+ style: styleProp,
7
+ theme: themeProp,
8
+ items = [],
9
+ multiple = false,
10
+ current = "",
11
+ ...rest
12
+ } = $props();
13
+
14
+ const style = $derived(styleProp ?? defaults.style);
15
+ const theme = $derived(themeProp ?? defaults.theme);
16
+
17
+ const styleClass = $derived(`s-accordion-${style}`);
18
+ const themeClass = $derived(`theme-${theme}`);
19
+
20
+ let openItems = $state(new Set());
21
+ $effect(() => {
22
+ if (current) openItems = new Set([current]);
23
+ });
24
+
25
+ function toggle(id) {
26
+ if (multiple) {
27
+ const next = new Set(openItems);
28
+ next.has(id) ? next.delete(id) : next.add(id);
29
+ openItems = next;
30
+ } else {
31
+ openItems = openItems.has(id) ? new Set() : new Set([id]);
32
+ }
33
+ }
34
+ </script>
35
+
36
+ <div class="s-accordion {styleClass} {themeClass}" {...rest}>
37
+ {#each items as item}
38
+ <div class="s-accordion-item" class:open={openItems.has(item.id)}>
39
+ <button
40
+ class="s-accordion-header"
41
+ onclick={() => toggle(item.id)}
42
+ aria-expanded={openItems.has(item.id)}
43
+ >
44
+ <span>{item.title}</span>
45
+ <svg
46
+ class="s-accordion-arrow"
47
+ width="18"
48
+ height="18"
49
+ viewBox="0 0 24 24"
50
+ fill="none"
51
+ stroke="#64748b"
52
+ stroke-width="2"
53
+ >
54
+ <path d="M6 9l6 6 6-6" />
55
+ </svg>
56
+ </button>
57
+ {#if openItems.has(item.id)}
58
+ <div class="s-accordion-content">
59
+ {item.content}
60
+ </div>
61
+ {/if}
62
+ </div>
63
+ {/each}
64
+ </div>
@@ -0,0 +1,19 @@
1
+ export default Accordion;
2
+ type Accordion = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
5
+ };
6
+ declare const Accordion: import("svelte").Component<{
7
+ style: any;
8
+ theme: any;
9
+ items?: any[];
10
+ multiple?: boolean;
11
+ current?: string;
12
+ } & Record<string, any>, {}, "">;
13
+ type $$ComponentProps = {
14
+ style: any;
15
+ theme: any;
16
+ items?: any[];
17
+ multiple?: boolean;
18
+ current?: string;
19
+ } & Record<string, any>;
@@ -0,0 +1,61 @@
1
+ <script>
2
+ import "./alert-styles.css";
3
+ import { defaults, iconClass } from "../config.js";
4
+ import { slide } from "svelte/transition";
5
+
6
+ let {
7
+ style: styleProp,
8
+ theme: themeProp,
9
+ variant = "info",
10
+ title = "",
11
+ icon: iconProp,
12
+ children,
13
+ dismissible = false,
14
+ ...rest
15
+ } = $props();
16
+
17
+ const style = $derived(styleProp ?? defaults.style);
18
+ const theme = $derived(themeProp ?? defaults.theme);
19
+
20
+ const styleClass = $derived(`s-alert-${style}`);
21
+ const themeClass = $derived(`theme-${theme}`);
22
+
23
+ const defaultIcons = {
24
+ info: "ℹ",
25
+ success: "✓",
26
+ warning: "⚠",
27
+ error: "✕"
28
+ };
29
+
30
+ const icon = $derived(iconProp ?? defaultIcons[variant] ?? null);
31
+ const iconEl = $derived(icon && icon.length === 1 ? icon : null);
32
+ const iconName = $derived(icon && icon.length > 1 ? icon : null);
33
+
34
+ let visible = $state(true);
35
+ </script>
36
+
37
+ {#if visible}
38
+ <div
39
+ class="s-alert {styleClass} {themeClass} s-alert-{variant}"
40
+ role="alert"
41
+ transition:slide={{ duration: 200 }}
42
+ {...rest}
43
+ >
44
+ {#if iconEl}
45
+ <span class="s-alert-icon">{iconEl}</span>
46
+ {:else if iconName}
47
+ <span class="s-alert-icon {iconClass}">{iconName}</span>
48
+ {/if}
49
+ <div class="s-alert-content">
50
+ {#if title}<strong class="s-alert-title">{title}</strong>{/if}
51
+ <div class="s-alert-body">{@render children?.()}</div>
52
+ </div>
53
+ {#if dismissible}
54
+ <button
55
+ class="s-alert-dismiss"
56
+ onclick={() => (visible = false)}
57
+ aria-label="Dismiss">&times;</button
58
+ >
59
+ {/if}
60
+ </div>
61
+ {/if}
@@ -0,0 +1,23 @@
1
+ export default Alert;
2
+ type Alert = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
5
+ };
6
+ declare const Alert: import("svelte").Component<{
7
+ style: any;
8
+ theme: any;
9
+ variant?: string;
10
+ title?: string;
11
+ icon: any;
12
+ children: any;
13
+ dismissible?: boolean;
14
+ } & Record<string, any>, {}, "">;
15
+ type $$ComponentProps = {
16
+ style: any;
17
+ theme: any;
18
+ variant?: string;
19
+ title?: string;
20
+ icon: any;
21
+ children: any;
22
+ dismissible?: boolean;
23
+ } & Record<string, any>;
@@ -0,0 +1,31 @@
1
+ <script>
2
+ import "./avatar-styles.css";
3
+ import { defaults } from "../config.js";
4
+
5
+ let {
6
+ style: styleProp,
7
+ theme: themeProp,
8
+ src = "",
9
+ alt = "",
10
+ size = "md",
11
+ fallback = "",
12
+ ...rest
13
+ } = $props();
14
+
15
+ const style = $derived(styleProp ?? defaults.style);
16
+ const theme = $derived(themeProp ?? defaults.theme);
17
+
18
+ const styleClass = $derived(`s-avatar-${style}`);
19
+ const themeClass = $derived(`theme-${theme}`);
20
+ const sizeClass = $derived(`avatar-${size}`);
21
+
22
+ let imgError = $state(false);
23
+ </script>
24
+
25
+ <div class="s-avatar {styleClass} {themeClass} {sizeClass}" {...rest}>
26
+ {#if src && !imgError}
27
+ <img {src} {alt} onerror={() => (imgError = true)} />
28
+ {:else}
29
+ <span class="avatar-fallback">{fallback}</span>
30
+ {/if}
31
+ </div>
@@ -0,0 +1,21 @@
1
+ export default Avatar;
2
+ type Avatar = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
5
+ };
6
+ declare const Avatar: import("svelte").Component<{
7
+ style: any;
8
+ theme: any;
9
+ src?: string;
10
+ alt?: string;
11
+ size?: string;
12
+ fallback?: string;
13
+ } & Record<string, any>, {}, "">;
14
+ type $$ComponentProps = {
15
+ style: any;
16
+ theme: any;
17
+ src?: string;
18
+ alt?: string;
19
+ size?: string;
20
+ fallback?: string;
21
+ } & Record<string, any>;