@marwes-ui/svelte 1.3.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +43 -11
  3. package/dist/components/README.md +31 -0
  4. package/dist/components/accordion/AccordionField.svelte +20 -6
  5. package/dist/components/accordion/index.d.ts +5 -2
  6. package/dist/components/accordion/index.js +7 -1
  7. package/dist/components/accordion/types.d.ts +3 -0
  8. package/dist/components/avatar/AvatarGroup.svelte +5 -2
  9. package/dist/components/avatar/AvatarGroup.svelte.d.ts +1 -0
  10. package/dist/components/avatar/TeamAvatarGroup.svelte +1 -0
  11. package/dist/components/avatar/TeamAvatarGroup.svelte.d.ts +1 -0
  12. package/dist/components/avatar/index.d.ts +7 -1
  13. package/dist/components/avatar/index.js +6 -0
  14. package/dist/components/avatar/types.d.ts +28 -0
  15. package/dist/components/badge/BadgeGroup.svelte +2 -1
  16. package/dist/components/badge/index.d.ts +5 -1
  17. package/dist/components/badge/index.js +4 -0
  18. package/dist/components/badge/types.d.ts +3 -0
  19. package/dist/components/banner/Banner.svelte +67 -0
  20. package/dist/components/banner/Banner.svelte.d.ts +4 -0
  21. package/dist/components/banner/ErrorBanner.svelte +9 -0
  22. package/dist/components/banner/ErrorBanner.svelte.d.ts +4 -0
  23. package/dist/components/banner/InfoBanner.svelte +9 -0
  24. package/dist/components/banner/InfoBanner.svelte.d.ts +4 -0
  25. package/dist/components/banner/SuccessBanner.svelte +9 -0
  26. package/dist/components/banner/SuccessBanner.svelte.d.ts +4 -0
  27. package/dist/components/banner/WarningBanner.svelte +9 -0
  28. package/dist/components/banner/WarningBanner.svelte.d.ts +4 -0
  29. package/dist/components/banner/index.d.ts +7 -0
  30. package/dist/components/banner/index.js +6 -0
  31. package/dist/components/banner/types.d.ts +14 -0
  32. package/dist/components/banner/types.js +1 -0
  33. package/dist/components/breadcrumb/Breadcrumb.svelte +115 -0
  34. package/dist/components/breadcrumb/Breadcrumb.svelte.d.ts +4 -0
  35. package/dist/components/breadcrumb/index.d.ts +2 -0
  36. package/dist/components/breadcrumb/index.js +1 -0
  37. package/dist/components/breadcrumb/types.d.ts +8 -0
  38. package/dist/components/breadcrumb/types.js +1 -0
  39. package/dist/components/button/Button.svelte +8 -4
  40. package/dist/components/button/DestructiveButton.svelte +1 -1
  41. package/dist/components/button/IconButton.svelte +9 -0
  42. package/dist/components/button/IconButton.svelte.d.ts +4 -0
  43. package/dist/components/button/index.d.ts +24 -1
  44. package/dist/components/button/index.js +23 -0
  45. package/dist/components/button/types.d.ts +30 -1
  46. package/dist/components/card/Card.svelte +2 -1
  47. package/dist/components/card/index.d.ts +4 -1
  48. package/dist/components/card/index.js +3 -0
  49. package/dist/components/card/types.d.ts +4 -0
  50. package/dist/components/checkbox/CheckboxField.svelte +4 -3
  51. package/dist/components/checkbox/CheckboxGroupField.svelte +21 -9
  52. package/dist/components/checkbox/index.d.ts +2 -2
  53. package/dist/components/checkbox/index.js +4 -1
  54. package/dist/components/checkbox/types.d.ts +7 -0
  55. package/dist/components/context-menu/ContextMenu.svelte +56 -0
  56. package/dist/components/context-menu/ContextMenu.svelte.d.ts +4 -0
  57. package/dist/components/context-menu/index.d.ts +2 -0
  58. package/dist/components/context-menu/index.js +1 -0
  59. package/dist/components/context-menu/types.d.ts +7 -0
  60. package/dist/components/context-menu/types.js +1 -0
  61. package/dist/components/date-picker/DatePicker.svelte +14 -2
  62. package/dist/components/date-picker/DatePickerField.svelte +72 -0
  63. package/dist/components/date-picker/DatePickerField.svelte.d.ts +4 -0
  64. package/dist/components/date-picker/index.d.ts +2 -2
  65. package/dist/components/date-picker/index.js +3 -1
  66. package/dist/components/date-picker/types.d.ts +15 -0
  67. package/dist/components/dialog/Dialog.svelte +1 -0
  68. package/dist/components/dialog/DialogModal.svelte +12 -0
  69. package/dist/components/dialog/index.d.ts +1 -1
  70. package/dist/components/dialog/types.d.ts +7 -3
  71. package/dist/components/drawer/Drawer.svelte +132 -0
  72. package/dist/components/drawer/Drawer.svelte.d.ts +4 -0
  73. package/dist/components/drawer/index.d.ts +2 -0
  74. package/dist/components/drawer/index.js +1 -0
  75. package/dist/components/drawer/types.d.ts +16 -0
  76. package/dist/components/drawer/types.js +1 -0
  77. package/dist/components/heading/H1.svelte +10 -0
  78. package/dist/components/heading/H2.svelte +6 -0
  79. package/dist/components/heading/H3.svelte +7 -0
  80. package/dist/components/input/CurrencyField.svelte +1 -1
  81. package/dist/components/input/Input.svelte +1 -0
  82. package/dist/components/input/InputField.svelte +4 -3
  83. package/dist/components/input/InputOtp.svelte +21 -44
  84. package/dist/components/input/InputOtpField.svelte +81 -0
  85. package/dist/components/input/InputOtpField.svelte.d.ts +4 -0
  86. package/dist/components/input/RichText.svelte +7 -6
  87. package/dist/components/input/RichTextField.svelte +4 -3
  88. package/dist/components/input/Select.svelte +7 -31
  89. package/dist/components/input/SelectField.svelte +6 -3
  90. package/dist/components/input/Textarea.svelte +1 -0
  91. package/dist/components/input/TextareaField.svelte +20 -5
  92. package/dist/components/input/index.d.ts +12 -4
  93. package/dist/components/input/index.js +19 -3
  94. package/dist/components/input/types.d.ts +59 -5
  95. package/dist/components/pagination/Pagination.svelte +399 -0
  96. package/dist/components/pagination/Pagination.svelte.d.ts +4 -0
  97. package/dist/components/pagination/PaginationField.svelte +72 -0
  98. package/dist/components/pagination/PaginationField.svelte.d.ts +4 -0
  99. package/dist/components/pagination/index.d.ts +2 -0
  100. package/dist/components/pagination/index.js +2 -0
  101. package/dist/components/pagination/types.d.ts +40 -0
  102. package/dist/components/pagination/types.js +1 -0
  103. package/dist/components/progress-bar/ProgressBar.svelte +50 -0
  104. package/dist/components/progress-bar/ProgressBar.svelte.d.ts +4 -0
  105. package/dist/components/progress-bar/index.d.ts +2 -0
  106. package/dist/components/progress-bar/index.js +1 -0
  107. package/dist/components/progress-bar/types.d.ts +6 -0
  108. package/dist/components/progress-bar/types.js +1 -0
  109. package/dist/components/radio/OptionRadioGroup.svelte +39 -5
  110. package/dist/components/radio/OptionRadioGroup.svelte.d.ts +2 -5
  111. package/dist/components/radio/Radio.svelte +1 -0
  112. package/dist/components/radio/RadioGroupField.svelte +4 -3
  113. package/dist/components/radio/RatingRadioGroup.svelte +18 -3
  114. package/dist/components/radio/YesNoRadioGroup.svelte +18 -3
  115. package/dist/components/radio/index.d.ts +4 -2
  116. package/dist/components/radio/index.js +6 -1
  117. package/dist/components/radio/types.d.ts +47 -0
  118. package/dist/components/segmented-control/SegmentedControl.svelte +125 -0
  119. package/dist/components/segmented-control/SegmentedControl.svelte.d.ts +25 -0
  120. package/dist/components/segmented-control/SegmentedControlField.svelte +76 -0
  121. package/dist/components/segmented-control/SegmentedControlField.svelte.d.ts +25 -0
  122. package/dist/components/segmented-control/index.d.ts +2 -0
  123. package/dist/components/segmented-control/index.js +2 -0
  124. package/dist/components/segmented-control/types.d.ts +41 -0
  125. package/dist/components/segmented-control/types.js +1 -0
  126. package/dist/components/skip-link/SkipLink.svelte +12 -0
  127. package/dist/components/skip-link/SkipLink.svelte.d.ts +4 -0
  128. package/dist/components/skip-link/index.d.ts +2 -0
  129. package/dist/components/skip-link/index.js +1 -0
  130. package/dist/components/skip-link/types.d.ts +7 -0
  131. package/dist/components/skip-link/types.js +1 -0
  132. package/dist/components/slider/SliderField.svelte +9 -8
  133. package/dist/components/slider/index.d.ts +5 -2
  134. package/dist/components/slider/index.js +7 -1
  135. package/dist/components/slider/types.d.ts +21 -0
  136. package/dist/components/spinner/EmptyStateSpinner.svelte +2 -3
  137. package/dist/components/spinner/EmptyStateSpinner.svelte.d.ts +1 -2
  138. package/dist/components/spinner/Spinner.svelte +2 -0
  139. package/dist/components/spinner/index.d.ts +2 -1
  140. package/dist/components/spinner/index.js +1 -0
  141. package/dist/components/spinner/types.d.ts +1 -0
  142. package/dist/components/switch/Switch.svelte +1 -1
  143. package/dist/components/switch/SwitchField.svelte +6 -4
  144. package/dist/components/switch/index.d.ts +4 -2
  145. package/dist/components/switch/index.js +6 -1
  146. package/dist/components/switch/types.d.ts +3 -0
  147. package/dist/components/tab/TabGroup.svelte +7 -4
  148. package/dist/components/text/Text.svelte +23 -0
  149. package/dist/components/text/Text.svelte.d.ts +4 -0
  150. package/dist/components/text/index.d.ts +4 -0
  151. package/dist/components/text/index.js +2 -0
  152. package/dist/components/text/types.d.ts +15 -0
  153. package/dist/components/text/types.js +1 -0
  154. package/dist/components/tooltip/TooltipGroup.svelte +10 -2
  155. package/dist/index.d.ts +47 -29
  156. package/dist/index.js +51 -13
  157. package/dist/provider/MarwesProvider.svelte +26 -14
  158. package/dist/provider/types.d.ts +5 -2
  159. package/package.json +6 -5
  160. package/dist/components/accordion/README.md +0 -19
  161. package/dist/components/avatar/README.md +0 -19
  162. package/dist/components/badge/README.md +0 -16
  163. package/dist/components/button/README.md +0 -21
  164. package/dist/components/card/README.md +0 -15
  165. package/dist/components/checkbox/README.md +0 -17
  166. package/dist/components/date-picker/README.md +0 -17
  167. package/dist/components/dialog/README.md +0 -23
  168. package/dist/components/divider/README.md +0 -15
  169. package/dist/components/heading/README.md +0 -13
  170. package/dist/components/icon/README.md +0 -18
  171. package/dist/components/input/README.md +0 -24
  172. package/dist/components/paragraph/README.md +0 -13
  173. package/dist/components/radio/README.md +0 -16
  174. package/dist/components/skeleton/README.md +0 -16
  175. package/dist/components/slider/README.md +0 -20
  176. package/dist/components/spacing/README.md +0 -15
  177. package/dist/components/spinner/README.md +0 -19
  178. package/dist/components/stat-tile/README.md +0 -15
  179. package/dist/components/switch/README.md +0 -17
  180. package/dist/components/tab/README.md +0 -26
  181. package/dist/components/toast/README.md +0 -35
  182. package/dist/components/tooltip/README.md +0 -22
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @marwes-ui/svelte — main public API
2
- // CSS is NOT imported here. Users import from @marwes-ui/presets explicitly.
2
+ import "@marwes-ui/presets/firstEdition/styles.css";
3
3
  // Provider
4
4
  export { default as MarwesProvider } from "./provider/MarwesProvider.svelte";
5
5
  export { useTheme } from "./provider/use-theme.js";
@@ -8,6 +8,7 @@ export { useThemeMode } from "./provider/use-theme-mode.js";
8
8
  export { createMarwesThemeScript, createMarwesThemeStyle } from "./ssr.js";
9
9
  // Button
10
10
  export { default as Button } from "./components/button/Button.svelte";
11
+ export { default as IconButton } from "./components/button/IconButton.svelte";
11
12
  export { default as PrimaryButton } from "./components/button/PrimaryButton.svelte";
12
13
  export { default as SecondaryButton } from "./components/button/SecondaryButton.svelte";
13
14
  export { default as TextButton } from "./components/button/TextButton.svelte";
@@ -37,7 +38,7 @@ export { default as Spinner } from "./components/spinner/Spinner.svelte";
37
38
  export { default as ButtonSpinner } from "./components/spinner/ButtonSpinner.svelte";
38
39
  export { default as EmptyStateSpinner } from "./components/spinner/EmptyStateSpinner.svelte";
39
40
  // Input
40
- export { default as Input } from "./components/input/Input.svelte";
41
+ // `Input` atom intentionally NOT exported — use `InputField` (or a purpose variant).
41
42
  export { default as InputField } from "./components/input/InputField.svelte";
42
43
  export { default as PasswordField } from "./components/input/PasswordField.svelte";
43
44
  export { default as EmailField } from "./components/input/EmailField.svelte";
@@ -48,8 +49,10 @@ export { default as CurrencyField } from "./components/input/CurrencyField.svelt
48
49
  export { default as DateOfBirthField } from "./components/input/DateOfBirthField.svelte";
49
50
  export { default as ZipCodeField } from "./components/input/ZipCodeField.svelte";
50
51
  export { default as DropdownField } from "./components/input/DropdownField.svelte";
51
- export { default as InputOtp } from "./components/input/InputOtp.svelte";
52
- export { default as RichText } from "./components/input/RichText.svelte";
52
+ // `InputOtp` (the bare atom — cells-only render) is intentionally NOT
53
+ // exported from the public entry. Use `InputOtpField` instead.
54
+ export { default as InputOtpField } from "./components/input/InputOtpField.svelte";
55
+ // `RichText` atom intentionally NOT exported from the public entry — use `RichTextField`.
53
56
  export { default as RichTextField } from "./components/input/RichTextField.svelte";
54
57
  // Badge
55
58
  export { default as Badge } from "./components/badge/Badge.svelte";
@@ -57,6 +60,13 @@ export { default as BadgeGroup } from "./components/badge/BadgeGroup.svelte";
57
60
  export { default as StatusBadge } from "./components/badge/StatusBadge.svelte";
58
61
  export { default as PriorityBadge } from "./components/badge/PriorityBadge.svelte";
59
62
  export { default as NotificationBadge } from "./components/badge/NotificationBadge.svelte";
63
+ // Banner
64
+ export { default as Banner } from "./components/banner/Banner.svelte";
65
+ export { default as InfoBanner } from "./components/banner/InfoBanner.svelte";
66
+ export { default as SuccessBanner } from "./components/banner/SuccessBanner.svelte";
67
+ export { default as WarningBanner } from "./components/banner/WarningBanner.svelte";
68
+ export { default as ErrorBanner } from "./components/banner/ErrorBanner.svelte";
69
+ export { BannerVariant } from "@marwes-ui/core";
60
70
  // Card
61
71
  export { default as Card } from "./components/card/Card.svelte";
62
72
  export { default as ProductCard } from "./components/card/ProductCard.svelte";
@@ -64,6 +74,10 @@ export { default as ProfileCard } from "./components/card/ProfileCard.svelte";
64
74
  export { default as StatCard } from "./components/card/StatCard.svelte";
65
75
  // Divider
66
76
  export { default as Divider } from "./components/divider/Divider.svelte";
77
+ // ContextMenu
78
+ export { default as ContextMenu } from "./components/context-menu/ContextMenu.svelte";
79
+ // Breadcrumb
80
+ export { default as Breadcrumb } from "./components/breadcrumb/Breadcrumb.svelte";
67
81
  // Spacing
68
82
  export { default as Spacing } from "./components/spacing/Spacing.svelte";
69
83
  export { default as Spacer } from "./components/spacing/Spacer.svelte";
@@ -73,24 +87,30 @@ export { default as H2 } from "./components/heading/H2.svelte";
73
87
  export { default as H3 } from "./components/heading/H3.svelte";
74
88
  // Paragraph
75
89
  export { default as Paragraph } from "./components/paragraph/Paragraph.svelte";
90
+ // Text
91
+ export { default as Text } from "./components/text/Text.svelte";
92
+ export { default as TypographyText } from "./components/text/Text.svelte";
76
93
  // Textarea
77
- export { default as Textarea } from "./components/input/Textarea.svelte";
94
+ // `Textarea` atom intentionally NOT exported — use `TextareaField`.
78
95
  export { default as TextareaField } from "./components/input/TextareaField.svelte";
79
96
  // Select
80
- export { default as Select } from "./components/input/Select.svelte";
97
+ // `Select` atom intentionally NOT exported — use `SelectField` or `DropdownField`.
81
98
  export { default as SelectField } from "./components/input/SelectField.svelte";
82
99
  // Checkbox
83
- export { default as Checkbox } from "./components/checkbox/Checkbox.svelte";
100
+ // The `Checkbox` atom is intentionally NOT exported from the public entry —
101
+ // use `CheckboxField` (or `CheckboxGroupField`) instead.
84
102
  export { default as CheckboxField } from "./components/checkbox/CheckboxField.svelte";
85
103
  export { default as CheckboxGroupField } from "./components/checkbox/CheckboxGroupField.svelte";
86
104
  // Switch
87
- export { default as Switch } from "./components/switch/Switch.svelte";
105
+ // The `Switch` atom is intentionally NOT exported from the public entry —
106
+ // use `SwitchField` (or a purpose variant) instead.
88
107
  export { default as SwitchField } from "./components/switch/SwitchField.svelte";
89
108
  export { default as FeatureToggle } from "./components/switch/FeatureToggle.svelte";
90
109
  export { default as PreferenceSwitch } from "./components/switch/PreferenceSwitch.svelte";
91
110
  export { default as PermissionSwitch } from "./components/switch/PermissionSwitch.svelte";
92
111
  // Radio
93
- export { default as Radio } from "./components/radio/Radio.svelte";
112
+ // The `Radio` atom is intentionally NOT exported from the public entry —
113
+ // use `RadioGroupField` (or a purpose variant) instead.
94
114
  export { default as RadioGroupField } from "./components/radio/RadioGroupField.svelte";
95
115
  export { default as OptionRadioGroup } from "./components/radio/OptionRadioGroup.svelte";
96
116
  export { default as YesNoRadioGroup } from "./components/radio/YesNoRadioGroup.svelte";
@@ -103,9 +123,15 @@ export { default as ProfileAvatar } from "./components/avatar/ProfileAvatar.svel
103
123
  export { default as PresenceAvatar } from "./components/avatar/PresenceAvatar.svelte";
104
124
  export { default as TeamAvatarGroup } from "./components/avatar/TeamAvatarGroup.svelte";
105
125
  // DatePicker
106
- export { default as DatePicker } from "./components/date-picker/DatePicker.svelte";
126
+ // The `DatePicker` atom is intentionally NOT exported from the public entry —
127
+ // use `DatePickerField` instead.
128
+ export { default as DatePickerField } from "./components/date-picker/DatePickerField.svelte";
129
+ // Drawer
130
+ export { default as Drawer } from "./components/drawer/Drawer.svelte";
107
131
  // Skeleton
108
132
  export { default as Skeleton } from "./components/skeleton/Skeleton.svelte";
133
+ // ProgressBar
134
+ export { default as ProgressBar } from "./components/progress-bar/ProgressBar.svelte";
109
135
  // StatTile
110
136
  export { default as StatTile } from "./components/stat-tile/StatTile.svelte";
111
137
  // Tooltip
@@ -127,7 +153,8 @@ export { default as ConfirmDialog } from "./components/dialog/ConfirmDialog.svel
127
153
  export { default as DestructiveDialog } from "./components/dialog/DestructiveDialog.svelte";
128
154
  export { default as InfoDialog } from "./components/dialog/InfoDialog.svelte";
129
155
  // Accordion
130
- export { default as Accordion } from "./components/accordion/Accordion.svelte";
156
+ // The `Accordion` atom (single collapsible panel) is intentionally NOT exported —
157
+ // use `AccordionField` (groups) or a purpose variant.
131
158
  export { default as AccordionField } from "./components/accordion/AccordionField.svelte";
132
159
  export { default as FAQAccordion } from "./components/accordion/FAQAccordion.svelte";
133
160
  export { default as SettingsAccordion } from "./components/accordion/SettingsAccordion.svelte";
@@ -139,11 +166,22 @@ export { default as TabGroup } from "./components/tab/TabGroup.svelte";
139
166
  export { default as NavigationTabs } from "./components/tab/NavigationTabs.svelte";
140
167
  export { default as ContentTabs } from "./components/tab/ContentTabs.svelte";
141
168
  export { default as SettingsTabs } from "./components/tab/SettingsTabs.svelte";
169
+ // Segmented Control
170
+ // The `SegmentedControl` atom is intentionally NOT exported from the public entry —
171
+ // use `SegmentedControlField` instead.
172
+ export { default as SegmentedControlField } from "./components/segmented-control/SegmentedControlField.svelte";
173
+ // Pagination
174
+ // The `Pagination` atom is intentionally NOT exported from the public entry —
175
+ // use `PaginationField` instead.
176
+ export { default as PaginationField } from "./components/pagination/PaginationField.svelte";
177
+ // SkipLink
178
+ export { default as SkipLink } from "./components/skip-link/SkipLink.svelte";
142
179
  // Slider
143
- export { default as Slider } from "./components/slider/Slider.svelte";
180
+ // The `Slider` atom is intentionally NOT exported from the public entry —
181
+ // use `SliderField` (or a purpose variant) instead.
144
182
  export { default as SliderField } from "./components/slider/SliderField.svelte";
145
183
  export { default as VolumeSlider } from "./components/slider/VolumeSlider.svelte";
146
184
  export { default as BrightnessSlider } from "./components/slider/BrightnessSlider.svelte";
147
185
  export { default as RadiusSlider } from "./components/slider/RadiusSlider.svelte";
148
186
  // Core re-exports
149
- export { AvatarSize, AvatarType, BadgeVariant, ButtonAction, ButtonSize, ButtonVariant, createFontStack, IconName, mwAvailableFonts, mwFontFallbacks, mwGoogleFontFamilies, mwStyledTheme, mwThemeVarNames, mwThemeVars, mwVar, Spacings, SwitchSize, ThemeMode, } from "@marwes-ui/core";
187
+ export { AvatarSize, AvatarType, BadgeVariant, ButtonAction, ButtonSize, ButtonVariant, createFontStack, IconName, mwAvailableFonts, mwFontFallbacks, mwGoogleFontFamilies, mwStyledTheme, mwTheme, mwThemeVarNames, mwThemeVars, mwVar, createMwTheme, createMwThemeMedia, Spacings, SwitchSize, TextVariant, ThemeMode, } from "@marwes-ui/core";
@@ -1,11 +1,12 @@
1
1
  <script lang="ts">
2
2
  import {
3
3
  ThemeMode as MwThemeMode,
4
+ createMwTheme,
4
5
  nextThemeMode,
5
6
  resolveThemeInput,
6
7
  resolveThemePreference,
7
8
  } from "@marwes-ui/core";
8
- import type { ResolvedTheme, ThemeMode, ThemePreference } from "@marwes-ui/core";
9
+ import type { MwTheme, ResolvedTheme, ThemeMode, ThemePreference } from "@marwes-ui/core";
9
10
  import { setMarwesContext } from "./context.js";
10
11
  import { applyThemeToElement, loadThemeFonts, themeToRootStyle } from "./runtime-theme.js";
11
12
  import {
@@ -38,13 +39,17 @@
38
39
 
39
40
  let rootElement: HTMLDivElement | undefined = $state(undefined);
40
41
 
41
- let internalPreference = $state<ThemePreference>(
42
- defaultPreference ?? defaultMode ?? MwThemeMode.light
43
- );
42
+ function getInitialPreference(): ThemePreference {
43
+ return defaultPreference ?? defaultMode ?? MwThemeMode.light;
44
+ }
44
45
 
45
- let systemMode = $state<ThemeMode>(
46
- enableSystem ? getSystemThemeMode() : MwThemeMode.light
47
- );
46
+ function getInitialSystemMode(): ThemeMode {
47
+ return enableSystem ? getSystemThemeMode() : MwThemeMode.light;
48
+ }
49
+
50
+ let internalPreference = $state<ThemePreference>(getInitialPreference());
51
+
52
+ let systemMode = $state<ThemeMode>(getInitialSystemMode());
48
53
 
49
54
  const activePreference = $derived(
50
55
  controlledPreference ?? controlledMode ?? theme?.mode ?? internalPreference
@@ -60,6 +65,8 @@
60
65
  resolveThemeInput({ ...(theme ?? {}), mode: activeMode })
61
66
  );
62
67
 
68
+ const mwTheme: MwTheme = $derived(createMwTheme(resolved));
69
+
63
70
  const rootStyle = $derived(
64
71
  variableStrategy === "style-tag" ? undefined : themeToRootStyle(resolved)
65
72
  );
@@ -89,13 +96,17 @@
89
96
  setMode(nextThemeMode(activeMode));
90
97
  }
91
98
 
99
+ function getInitialContextState(): MarwesContextState {
100
+ return {
101
+ theme: resolved,
102
+ mode: activeMode,
103
+ preference: activePreference,
104
+ systemMode,
105
+ };
106
+ }
107
+
92
108
  // Context state — mutated reactively by effects below
93
- const contextState: MarwesContextState = $state({
94
- theme: resolved,
95
- mode: activeMode,
96
- preference: activePreference,
97
- systemMode,
98
- });
109
+ const contextState: MarwesContextState = $state(getInitialContextState());
99
110
 
100
111
  setMarwesContext({
101
112
  get state() { return contextState; },
@@ -180,7 +191,8 @@
180
191
  class={`mw-theme--${resolved.mode}`}
181
192
  data-marwes-theme="true"
182
193
  data-marwes-mode={resolved.mode}
194
+ data-marwes-personality={resolved.personality}
183
195
  style={rootStyleString}
184
196
  >
185
- {@render children?.()}
197
+ {@render children?.({ mwTheme })}
186
198
  </div>
@@ -1,6 +1,9 @@
1
- import type { FontLoadingConfig, ResolvedTheme, ThemeInput, ThemeMode, ThemePreference, ThemeVariableStrategy } from "@marwes-ui/core";
1
+ import type { FontLoadingConfig, MwTheme, ResolvedTheme, ThemeInput, ThemeMode, ThemePreference, ThemeVariableStrategy } from "@marwes-ui/core";
2
2
  import type { Snippet } from "svelte";
3
3
  import type { ThemeAttribute, ThemeTarget } from "./theme-mode-runtime.js";
4
+ export interface MarwesProviderSnippetProps {
5
+ mwTheme: MwTheme;
6
+ }
4
7
  export interface MarwesProviderProps {
5
8
  theme?: ThemeInput;
6
9
  defaultPreference?: ThemePreference;
@@ -16,7 +19,7 @@ export interface MarwesProviderProps {
16
19
  attribute?: ThemeAttribute;
17
20
  disableTransitionOnChange?: boolean;
18
21
  variableStrategy?: ThemeVariableStrategy;
19
- children?: Snippet;
22
+ children?: Snippet<[MarwesProviderSnippetProps?]>;
20
23
  }
21
24
  export interface MarwesContextState {
22
25
  theme: ResolvedTheme;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@marwes-ui/svelte",
3
- "version": "1.3.0",
3
+ "version": "1.4.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
7
  "license": "MIT",
8
8
  "private": false,
9
9
  "type": "module",
10
- "sideEffects": false,
10
+ "sideEffects": true,
11
11
  "main": "./dist/index.js",
12
12
  "files": [
13
13
  "dist",
@@ -29,7 +29,8 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@marwes-ui/core": "1.3.0"
32
+ "@marwes-ui/core": "1.4.1",
33
+ "@marwes-ui/presets": "1.4.1"
33
34
  },
34
35
  "peerDependencies": {
35
36
  "svelte": "^5.20.0"
@@ -40,11 +41,11 @@
40
41
  "@testing-library/svelte": "^5.0.0",
41
42
  "jsdom": "26.1.0",
42
43
  "rimraf": "6.1.2",
43
- "svelte": "^5.20.0",
44
+ "svelte": "5.56.3",
44
45
  "svelte-check": "^4.0.0",
45
46
  "typescript": "5.9.3",
46
47
  "vite": "^6.0.0",
47
- "vitest": "4.0.18"
48
+ "vitest": "4.1.8"
48
49
  },
49
50
  "scripts": {
50
51
  "dev": "svelte-package --watch",
@@ -1,19 +0,0 @@
1
- # Accordion — Parity Findings
2
-
3
- ## Svelte vs React/Vue
4
-
5
- ### Aligned ✅
6
- - `createAccordionRecipe` integration
7
- - Open/closed state with `ontoggle` callback
8
- - Disabled state
9
- - Proper aria wiring: aria-expanded, aria-controls, aria-labelledby
10
- - Trigger + panel compound structure
11
- - Generated IDs via `$props.id()`
12
- - Icon placeholder for expand/collapse indicator
13
-
14
- ### Missing ❌
15
- - **`AccordionField`** molecule (wraps accordion with label/description)
16
- - **Purpose variants**: React/Vue have some accordion variants
17
-
18
- ### Notes
19
- - The base accordion is fully functional. `AccordionField` adds a thin label/description wrapper around a group of accordions.
@@ -1,19 +0,0 @@
1
- # Avatar — Parity Findings
2
-
3
- ## Svelte vs React/Vue
4
-
5
- ### Aligned ✅
6
- - `createAvatarRecipe` integration
7
- - All types: icon, initials, image (auto-detected)
8
- - All sizes: small, medium, large
9
- - Proper content rendering per type (img, span with initials, Icon)
10
- - Accessibility: role="img", aria-hidden for decorative, aria-label
11
- - Initials normalization (max 2 chars, uppercase)
12
-
13
- ### Missing ❌
14
- - **`AvatarBadge`** component (small indicator overlaid on avatar)
15
- - **`AvatarGroup`** component (stacked avatar row with overlap)
16
- - **Purpose variants**
17
-
18
- ### Notes
19
- - `AvatarBadge` and `AvatarGroup` are layout/positioning components. Medium complexity. They rely on CSS positioning rather than core recipes.
@@ -1,16 +0,0 @@
1
- # Badge — Parity Findings
2
-
3
- ## Svelte vs React/Vue
4
-
5
- ### Aligned ✅
6
- - `Badge` atom with `createBadgeRecipe`
7
- - All variants: neutral, info, success, warning, error
8
- - `BadgeGroup` molecule with fieldset/legend/aria-labelledby
9
- - Class merging, data attributes spreading
10
- - Optional ariaLabel, id, custom dataAttributes
11
-
12
- ### Missing ❌
13
- - **Purpose variant wrappers** (3): `StatusBadge`, `PriorityBadge`, `NotificationBadge`
14
-
15
- ### Notes
16
- - Purpose badge variants are thin — they pre-set variant and add purpose-specific data attributes. Low priority follow-up.
@@ -1,21 +0,0 @@
1
- # Button — Parity Findings
2
-
3
- ## Svelte vs React/Vue
4
-
5
- ### Aligned ✅
6
- - Base `Button` component with full `createButtonRecipe` integration
7
- - All props: variant, size, action, disabled, loading, iconLeft, iconRight, href, as
8
- - Anchor path (as="a") with href
9
- - Loading state with `ButtonSpinner`
10
- - Icon rendering via `Icon` component
11
- - Class/style merging with core output
12
- - All a11y attributes from core recipe
13
- - Data attributes spreading
14
-
15
- ### Missing ❌
16
- - **Purpose variant wrappers** (22 components): `PrimaryButton`, `SecondaryButton`, `TextButton`, `SuccessButton`, `DestructiveButton`, `CreateButton`, `SubmitButton`, `CancelButton`, `LinkButton`, `SaveButton`, `ConfirmButton`, `VerifyButton`, `EditButton`, `CloseButton`, `RefreshButton`, `UploadButton`, `DownloadButton`, `CopyButton`, `SearchButton`, `FilterButton`, `SortButton`, `DropdownButton`
17
- - Dev-mode warnings for forbidden props on purpose variants
18
-
19
- ### Notes
20
- - Purpose wrappers are thin — each just pre-sets `variant`, `action`, and optionally `iconLeft`/`iconRight` via the core `createPurposeSemanticAttributes`. Can be added as a follow-up batch.
21
- - The base `Button` atom is fully functional and covers all use cases the purpose wrappers serve.
@@ -1,15 +0,0 @@
1
- # Card — Parity Findings
2
-
3
- ## Svelte vs React/Vue
4
-
5
- ### Aligned ✅
6
- - `Card` atom with `createCardRecipe`
7
- - Title (string or snippet) + body content
8
- - Correct DOM structure: mw-card > mw-card__header > mw-card__title + mw-card__body
9
- - Class merging, id, data attributes
10
-
11
- ### Missing ❌
12
- - **Purpose variant wrappers** (3): `ProductCard`, `ProfileCard`, `StatCard`
13
-
14
- ### Notes
15
- - Purpose card variants add pre-configured slot structures and data-purpose attributes. Medium complexity — each needs custom slot/snippet layout.
@@ -1,17 +0,0 @@
1
- # Checkbox — Parity Findings
2
-
3
- ## Svelte vs React/Vue
4
-
5
- ### Aligned ✅
6
- - `Checkbox` atom with `checkboxRecipe`
7
- - `bind:checked` support
8
- - `indeterminate` DOM property applied via `$effect`
9
- - `oncheckedchange` callback
10
- - All a11y: aria-label, aria-labelledby, aria-describedby, aria-checked="mixed", aria-invalid
11
- - `CheckboxField` molecule with label, description, error, `buildCheckboxFieldA11yIds`
12
-
13
- ### Missing ❌
14
- - **`CheckboxGroupField`** molecule (groups multiple checkboxes with shared label/error)
15
-
16
- ### Notes
17
- - `CheckboxGroupField` is a fieldset-based wrapper around multiple `CheckboxField` items. Same pattern as `RadioGroupField`. Medium complexity.
@@ -1,17 +0,0 @@
1
- # DatePicker — Parity Findings
2
-
3
- ## Svelte vs React/Vue
4
-
5
- ### Aligned ✅
6
- - `DatePicker` atom with `createDatePickerRecipe`
7
- - Month grid with weekday headers and day buttons
8
- - Navigation controls: previous/next month/year
9
- - Footer with cancel/apply buttons
10
- - Day states: default, hover, selected, range, range-hover, disabled, null
11
- - `aria-label`, `aria-pressed` on selected days, `disabled` on empty/disabled days
12
- - Device variants: desktop, mobile
13
- - All label props for customization
14
-
15
- ### Notes
16
- - Date parsing, formatting, popover state, and form orchestration are intentionally outside the component scope.
17
- - The consumer provides `weeks`, `weekdayLabels`, and `monthLabel` data — the component is a pure rendering surface.
@@ -1,23 +0,0 @@
1
- # Dialog — Parity Findings
2
-
3
- ## Svelte vs React/Vue
4
-
5
- ### Aligned ✅
6
- - `Dialog` atom with `createDialogRecipe`
7
- - Header with title, close button (via `IconName.X`)
8
- - Content area with optional description
9
- - Footer via Svelte snippet: `{#snippet footer({ close })}...{/snippet}`
10
- - `aria-labelledby` wired to title, `aria-describedby` wired to description
11
- - `aria-label` fallback when no visible title
12
- - `aria-modal` only when `modal` is explicitly true
13
- - `DialogModal` molecule with scrim, focus trap, escape/scrim-click dismiss, focus restoration
14
- - `ConfirmDialog`, `DestructiveDialog`, `InfoDialog` purpose wrappers with `createPurposeSemanticAttributes`
15
- - `bind:open` two-way binding on modal components
16
-
17
- ### Svelte-specific
18
- - Footer uses Svelte snippets instead of React render props: `{#snippet footer({ close })}` vs `footer={({ close }) => ...}`
19
- - No `portalTarget` prop — Svelte renders modals in-place (no React portal equivalent needed)
20
-
21
- ### Notes
22
- - All purpose dialogs set correct `data-purpose` attributes.
23
- - Focus management follows the same algorithm: first focusable element, or dialog surface as fallback.
@@ -1,15 +0,0 @@
1
- # Divider — Parity Findings
2
-
3
- ## Svelte vs React/Vue
4
-
5
- ### Aligned ✅
6
- - Full parity with React/Vue
7
- - `createDividerRecipe` integration
8
- - All sizes: xxs, xs, sm, md, lg, xl, xxl
9
- - Orientation: horizontal, vertical
10
- - Semantic `<hr>` with role="separator" and aria-orientation
11
- - CSS vars for line thickness and spacing
12
- - Data attributes, class/style merging
13
-
14
- ### Missing ❌
15
- - None — full parity.
@@ -1,13 +0,0 @@
1
- # Heading — Parity Findings
2
-
3
- ## Svelte vs React/Vue
4
-
5
- ### Aligned ✅
6
- - `H1`, `H2`, `H3` components with `headingRecipe`
7
- - `mw-heading` class with size modifiers (`mw-heading--h1`, etc.)
8
- - CSS vars for font family, size, weight, line height from resolved theme
9
- - Optional `id`, `ariaLabel`, `size` override, custom `class`, `style`
10
- - Requires `MarwesProvider` context for theme access
11
-
12
- ### Notes
13
- - Heading recipe requires the resolved theme to compute font variables.
@@ -1,18 +0,0 @@
1
- # Icon — Parity Findings
2
-
3
- ## Svelte vs React/Vue
4
-
5
- ### Aligned ✅
6
- - Full `iconRegistry` integration
7
- - All props: name, size, strokeWidth, decorative, aria-label
8
- - SVG rendering from core registry nodes
9
- - Proper kebab-case attribute conversion via `svgAttrsToKebab`
10
- - All SVG element types handled (path, circle, line, polygon, polyline, rect, ellipse)
11
- - Accessibility: role="img", aria-hidden, aria-label from `resolveIconA11y`
12
- - `class` prop merging
13
-
14
- ### Missing ❌
15
- - None — full parity with React/Vue atom.
16
-
17
- ### Notes
18
- - The `color` prop from core (`IconColor`) is accepted in types but visual application relies on preset CSS (`mw-icon--currentColor` etc.)
@@ -1,24 +0,0 @@
1
- # Input — Parity Findings
2
-
3
- ## Svelte vs React/Vue
4
-
5
- ### Aligned ✅
6
- - `Input` atom with `createInputRecipe` and `bind:value`
7
- - `InputField` molecule with label, helperText, error, leadingSymbol, ariaDescribedBy
8
- - Stable generated IDs via `$props.id()`
9
- - Full a11y: aria-invalid, aria-describedby, aria-live="polite" on error
10
- - `buildInputFieldA11yIds` integration from core
11
-
12
- ### Missing ❌
13
- - **`Select`** — implemented as separate component (not under input folder like React/Vue)
14
- - **`Textarea`** — implemented as separate component
15
- - **`SelectField`** molecule
16
- - **`TextareaField`** molecule
17
- - **`RichText`** atom + `RichTextField` molecule
18
- - **`InputOtp`** atom
19
- - **Field variant wrappers** (9): `DropdownField`, `SearchField`, `PasswordField`, `EmailField`, `DateOfBirthField`, `ZipCodeField`, `PhoneField`, `URLField`, `CurrencyField`
20
-
21
- ### Notes
22
- - React/Vue group Select, Textarea, RichText under `components/input/`. Svelte separates them into their own folders for clarity.
23
- - The missing field variants are thin wrappers that pre-configure InputField with specific type/inputMode/leadingSymbol. Can be added as a batch.
24
- - `RichText` and `InputOtp` are high-complexity components flagged for later implementation.
@@ -1,13 +0,0 @@
1
- # Paragraph — Parity Findings
2
-
3
- ## Svelte vs React/Vue
4
-
5
- ### Aligned ✅
6
- - `Paragraph` component with `paragraphRecipe`
7
- - `mw-p` class with size modifiers (`mw-p--sm`, `mw-p--md`, `mw-p--lg`)
8
- - CSS vars for font family, size, weight, line height from resolved theme
9
- - Optional `id`, `size`, custom `class`, `style`
10
- - Requires `MarwesProvider` context for theme access
11
-
12
- ### Notes
13
- - Paragraph recipe requires the resolved theme to compute font variables.
@@ -1,16 +0,0 @@
1
- # Radio — Parity Findings
2
-
3
- ## Svelte vs React/Vue
4
-
5
- ### Aligned ✅
6
- - `Radio` atom with `radioRecipe`
7
- - `bind:checked` support
8
- - `oncheckedchange` callback
9
- - `RadioGroupField` molecule with fieldset, legend, aria-labelledby, error region
10
- - `buildRadioGroupFieldA11yIds` integration
11
-
12
- ### Missing ❌
13
- - **Purpose variant wrappers**: React/Vue have `RadioCard` and similar (not critical)
14
-
15
- ### Notes
16
- - Full functional parity for the core atom + group field. Variant wrappers are optional enhancements.
@@ -1,16 +0,0 @@
1
- # Skeleton — Parity Findings
2
-
3
- ## Svelte vs React/Vue
4
-
5
- ### Aligned ✅
6
- - Full parity with React/Vue
7
- - `createSkeletonRecipe` integration
8
- - All variants: text, circular, rectangular
9
- - All animations: pulse, wave, none
10
- - Custom width, height, radius
11
- - CSS vars for dimensions
12
- - Accessibility: aria-hidden or role="status" with aria-label
13
- - Data attributes
14
-
15
- ### Missing ❌
16
- - None — full parity.
@@ -1,20 +0,0 @@
1
- # Slider — Parity Findings
2
-
3
- ## Svelte vs React/Vue
4
-
5
- ### Aligned ✅
6
- - `createSliderRecipe` integration
7
- - `bind:value` + `onvaluechange` callback
8
- - Native `<input type="range">` with proper a11y
9
- - All props: min, max, step, disabled, orientation, ariaLabel, ariaValueText
10
- - CSS var for fill percentage (--mw-slider-fill-percentage)
11
- - Tooltip support
12
- - Data attributes
13
-
14
- ### Missing ❌
15
- - **`SliderField`** molecule (label, description, error wiring)
16
- - **Touch area** visual treatment (showTouchArea renders differently in React)
17
- - **Purpose variants**
18
-
19
- ### Notes
20
- - The base slider is fully functional. `SliderField` follows the standard field molecule pattern and can be added easily.
@@ -1,15 +0,0 @@
1
- # Spacing — Parity Findings
2
-
3
- ## Svelte vs React/Vue
4
-
5
- ### Aligned ✅
6
- - Full parity with React/Vue
7
- - `createSpacingRecipe` integration
8
- - All 18 token sizes (sp-0 through sp-120)
9
- - `scale` multiplier prop
10
- - Decorative `<div>` with aria-hidden="true"
11
- - Data attributes, class/style/CSS vars merging
12
- - `Spacer` alias component
13
-
14
- ### Missing ❌
15
- - None — full parity.
@@ -1,19 +0,0 @@
1
- # Spinner — Parity Findings
2
-
3
- ## Svelte vs React/Vue
4
-
5
- ### Aligned ✅
6
- - `Spinner` atom with full `createSpinnerRecipe` integration
7
- - All 7 variants: classic, ring, dual, dots-round, dots-square, lines, cross
8
- - All sizes: xs, sm, md, lg (and custom numeric)
9
- - SVG node rendering with kebab-case attribute conversion
10
- - `ButtonSpinner` purpose wrapper with track/indicator color vars
11
- - Accessibility: role="status", aria-hidden, aria-label, aria-live
12
- - Data attributes: data-component, data-variant, data-size
13
- - Class/style/CSS vars merging
14
-
15
- ### Missing ❌
16
- - `EmptyStateSpinner` purpose wrapper (React/Vue have it, low priority)
17
-
18
- ### Notes
19
- - `EmptyStateSpinner` is trivial — same as `ButtonSpinner` but defaults to `variant="dots-round"`, `size="lg"`, with `data-purpose="empty-state"`.
@@ -1,15 +0,0 @@
1
- # StatTile — Parity Findings
2
-
3
- ## Svelte vs React/Vue
4
-
5
- ### Aligned ✅
6
- - Full parity with React/Vue
7
- - `createStatTileRecipe` integration
8
- - All tones: neutral, brand, success, warning, danger
9
- - Trend direction with icon (↑/↓) and trend value
10
- - Slots: header, label, value, subtitle, trend
11
- - aria-label on trend for screen readers
12
- - Data attributes (data-component, data-tone, data-trend)
13
-
14
- ### Missing ❌
15
- - None — full parity.