@widgetic/design-system 0.3.78 → 0.3.80

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 (96) hide show
  1. package/README.md +592 -126
  2. package/dist/components/CopyableHeader.svelte +13 -11
  3. package/dist/components/EmptyState.svelte +2 -9
  4. package/dist/components/EmptyState.svelte.d.ts +1 -2
  5. package/dist/components/PasswordInput.svelte +1 -5
  6. package/dist/components/WScrollArea.svelte +3 -3
  7. package/dist/components/debug-grid/DebugGrid.svelte +1 -1
  8. package/dist/components/ic/browser/BrowserInputController.svelte +1 -1
  9. package/dist/components/index.d.ts +1 -1
  10. package/dist/components/index.js +1 -1
  11. package/dist/components/modals/BaseModal.svelte +1 -1
  12. package/dist/components/modals/NewItemDialog.svelte +1 -1
  13. package/dist/components/modals/RenameDialog.svelte +6 -7
  14. package/dist/components/modals/modalStore.js +21 -26
  15. package/dist/components/navigation/Breadcrumbs.svelte +9 -9
  16. package/dist/components/pdf/PDFViewer.svelte +19 -10
  17. package/dist/components/search-input/SearchInput.svelte +8 -3
  18. package/dist/components/search-input/index.d.ts +14 -3
  19. package/dist/components/search-input/index.js +2 -1
  20. package/dist/components/shad-editor/custom/image-extended-component.svelte +1 -1
  21. package/dist/components/shad-editor/editor.css +4 -8
  22. package/dist/components/shad-editor/icons/table.svelte +3 -3
  23. package/dist/components/shad-editor/icons/text.svelte +1 -1
  24. package/dist/components/shad-editor/onedark.css +0 -3
  25. package/dist/components/shad-editor/shad-editor.svelte +1 -1
  26. package/dist/components/toast/ToasterModal.svelte +11 -15
  27. package/dist/components/ui/accordion/index.d.ts +1 -1
  28. package/dist/components/ui/badge/badge.svelte +1 -1
  29. package/dist/components/ui/badge/badge.svelte.d.ts +2 -2
  30. package/dist/components/ui/button/button.svelte +1 -1
  31. package/dist/components/ui/button/button.svelte.d.ts +2 -2
  32. package/dist/components/ui/calendar/calendar-day.svelte +4 -4
  33. package/dist/components/ui/calendar/calendar.svelte.d.ts +1 -1
  34. package/dist/components/ui/card/card.svelte +1 -1
  35. package/dist/components/ui/checkbox/checkbox.svelte +1 -1
  36. package/dist/components/ui/collapsible/index.d.ts +1 -1
  37. package/dist/components/ui/command/command-dialog.svelte +1 -1
  38. package/dist/components/ui/command/command-dialog.svelte.d.ts +1 -1
  39. package/dist/components/ui/command/command-input.svelte +1 -1
  40. package/dist/components/ui/command/command-input.svelte.d.ts +1 -1
  41. package/dist/components/ui/command/command-item.svelte +1 -1
  42. package/dist/components/ui/command/command-link-item.svelte +1 -1
  43. package/dist/components/ui/command/command.svelte.d.ts +1 -1
  44. package/dist/components/ui/dialog/dialog-content.svelte +1 -1
  45. package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +1 -1
  46. package/dist/components/ui/dropdown-menu/dropdown-menu-content.svelte +1 -1
  47. package/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte +1 -1
  48. package/dist/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +1 -1
  49. package/dist/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +1 -1
  50. package/dist/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +1 -1
  51. package/dist/components/ui/dropdown-menu/index.d.ts +1 -1
  52. package/dist/components/ui/hover-card/hover-card-content.svelte +1 -1
  53. package/dist/components/ui/input/input.svelte +1 -1
  54. package/dist/components/ui/input/input.svelte.d.ts +1 -1
  55. package/dist/components/ui/input-otp/input-otp.svelte +1 -1
  56. package/dist/components/ui/input-otp/input-otp.svelte.d.ts +1 -1
  57. package/dist/components/ui/popover/popover-content.svelte +1 -1
  58. package/dist/components/ui/radio-group/radio-group-item.svelte +1 -1
  59. package/dist/components/ui/radio-group/radio-group.svelte.d.ts +1 -1
  60. package/dist/components/ui/range-calendar/range-calendar-day.svelte +6 -6
  61. package/dist/components/ui/range-calendar/range-calendar.svelte.d.ts +1 -1
  62. package/dist/components/ui/select/index.d.ts +1 -1
  63. package/dist/components/ui/select/select-item.svelte +1 -1
  64. package/dist/components/ui/select/select-trigger.svelte +1 -1
  65. package/dist/components/ui/slider/slider.svelte +1 -1
  66. package/dist/components/ui/slider/slider.svelte.d.ts +1 -1
  67. package/dist/components/ui/switch/switch.svelte +1 -1
  68. package/dist/components/ui/tabs/index.d.ts +1 -1
  69. package/dist/components/ui/tabs/tabs-content.svelte +1 -1
  70. package/dist/components/ui/tabs/tabs-trigger.svelte +1 -1
  71. package/dist/components/ui/textarea/textarea.svelte +1 -1
  72. package/dist/components/ui/textarea/textarea.svelte.d.ts +1 -1
  73. package/dist/components/ui/toggle/toggle.svelte +1 -1
  74. package/dist/components/ui/toggle/toggle.svelte.d.ts +2 -2
  75. package/dist/components/ui/toggle-group/toggle-group-item.svelte.d.ts +1 -1
  76. package/dist/components/ui/toggle-group/toggle-group.svelte.d.ts +1 -1
  77. package/dist/components/widget-system/Moveable.svelte +62 -19
  78. package/dist/icons/LogoWidgetic.svelte +6 -17
  79. package/dist/icons/LogoWidgeticGreen.svelte +13 -0
  80. package/dist/icons/LogoWidgeticGreen.svelte.d.ts +20 -0
  81. package/dist/icons/LogoWidgeticType-old.svelte +13 -0
  82. package/dist/icons/LogoWidgeticType-old.svelte.d.ts +20 -0
  83. package/dist/icons/LogoWidgeticType-old.svg +4 -0
  84. package/dist/icons/LogoWidgeticType.svelte +18 -10
  85. package/dist/icons/LogoWidgeticType.svg +10 -3
  86. package/dist/icons/index.d.ts +3 -1
  87. package/dist/icons/index.js +3 -1
  88. package/dist/styles/fonts.css +39 -50
  89. package/dist/styles/global.css +45 -64
  90. package/package.json +42 -44
  91. package/tailwind.config.ts +6 -1
  92. package/dist/components/search-input/index2.d.ts +0 -14
  93. package/dist/components/shad-editor/README.md +0 -18
  94. package/dist/icons/eye-off.svg +0 -1
  95. package/dist/icons/eye.svg +0 -1
  96. /package/dist/icons/{checked.svg → Checked.svg} +0 -0
package/README.md CHANGED
@@ -1,165 +1,503 @@
1
- # Widgetic Design System (`@widgetic/design-system`)
2
-
3
- This is the official design system package for the Widgetic platform.
4
-
5
- Built with SvelteKit and Tailwind CSS (using shadcn-svelte components as a base), it provides reusable UI components, global styles, design tokens, icons, and fonts for building consistent interfaces across Widgetic projects.
6
-
7
- ## Features
8
-
9
- * **Styles:** Exports global CSS styles, including CSS variables for design tokens (colors, spacing, etc.) and utility classes based on Tailwind CSS v4.
10
- * **UI Components:** A library of Svelte components built upon [shadcn-svelte](https://shadcn-svelte.com/), providing elements like Buttons, Cards, Dialogs, Input fields, Accordions, etc. Includes both base shadcn components and custom Widgetic components.
11
- * **Icons:** Exports icons from [Lucide Svelte](https://lucide.dev/) and potentially [Tabler Icons](https://tabler-icons.io/), accessible via named imports.
12
- * **Fonts:** Includes specific font families used across the Widgetic platform. Font files themselves are exported, but consuming projects need to ensure they are loaded correctly (e.g., via CSS `@import` or `<link>`).
13
-
14
- ## Installation
15
-
16
- 1. **Install the package:**
17
- ```bash
18
- npm install @widgetic/design-system
19
- ```
20
-
21
- 2. **Install Peer Dependencies:** This package relies on several peer dependencies that you need to install in your project if you haven't already. Ensure your `package.json` includes compatible versions:
22
- ```json
23
- "devDependencies": {
24
- // Required by Tailwind v4 setup
25
- "postcss": "^8.x.x",
26
- "@tailwindcss/postcss": "^4.x.x",
27
- "tailwindcss": "^4.x.x",
28
- // Required by SvelteKit/Svelte 5
29
- "svelte": "^5.x.x",
30
- "@sveltejs/kit": "^2.x.x",
31
- // Required by shadcn-svelte components used internally
32
- "bits-ui": "^1.x.x",
33
- "clsx": "^2.x.x",
34
- "tailwind-merge": "^2.x.x",
35
- "tailwind-variants": "^0.x.x",
36
- "svelte-sonner": "^0.x.x",
37
- // Required by specific components if used
38
- "@internationalized/date": "^3.x.x",
39
- "lucide-svelte": "^0.x.x",
40
- "@tabler/icons-svelte": "^3.x.x",
41
- "vaul-svelte": "^1.x.x-next.x"
42
- // ... other project devDependencies
43
- }
44
- ```
45
- *Note: Replace `x.x` with appropriate version numbers compatible with the design system's requirements (check its `package.json` `peerDependencies` for specifics).* Make sure you have `postcss.config.js` (or `.mjs`) set up.
46
-
47
- ## Setup
48
-
49
- ### 1. Tailwind Configuration
50
-
51
- To ensure Tailwind processes the design system's classes and applies your project's customizations correctly, configure your project's `tailwind.config.ts` (or `.js`) to use the design system's configuration as a preset:
1
+ # Widgetic Design System
52
2
 
3
+ This is the design system package for the Widgetic platform.
4
+
5
+ It is built with SvelteKit and TailwindCSS and exports styles(with tailwind), ui components(with shadcn), icons and fonts for the entire platform.
6
+
7
+ ## Initial Setup (Required for Team Development)
8
+
9
+ After cloning the repository, run the install script which handles dependencies and Git configuration:
10
+
11
+ ```bash
12
+ npm run i
13
+ ```
14
+
15
+ This script installs dependencies, links the package, and automatically configures Git for proper case sensitivity. This prevents file case conflicts between different operating systems (macOS, Windows, Linux). **All team members should run this** when first working with the design system.
16
+
17
+ 0. Styles: it uses tailwindcss and exports global styles and design tokens that are imported in the project where the design system is imported:
18
+
19
+ ```svelte
20
+ <script>
21
+ import '@widgetic/design-system/styles';
22
+ </script>
23
+ ```
24
+
25
+ 0.1. To add new fonts:
26
+ - Add the font in the fonts folder.
27
+ - Add the font-face rule and the class in the fonts.css file and then the class can be used anywhere in the projects that import the design system's styles:
28
+ ```css
29
+ /* First font-face rule */
30
+ @font-face {
31
+ font-family: 'BL Melody';
32
+ src: url('@widgetic/design-system/fonts/BLMelody/BLMelody-ExtraLight.woff2') format('woff2');
33
+ font-weight: 200;
34
+ font-style: normal;
35
+ font-display: swap;
36
+ }
37
+
38
+ /* Second fonte class(can be any custom name) */
39
+ .font-bl-melody-extra-light {
40
+ font-family: 'BL Melody';
41
+ font-weight: 200;
42
+ }
43
+ ```
44
+
45
+ - Use the font-family in any class in the global.css file if needed like this:
46
+ ```css
47
+ .my-button-class {
48
+ /* other CSS properties */
49
+ background-color: red;
50
+
51
+ /* font-family properties here */
52
+ font-family: 'BL Melody', sans-serif;
53
+ font-weight: 200;
54
+ font-style: normal;
55
+ }
56
+ ```
57
+
58
+ 1.1. Components: It uses the SHADCN UI components for basic ui components and custom components for the Widgetic platform.
59
+
60
+ a. (Re)Install latest all shadcn components:
61
+
62
+ ```bash
63
+ npm run i-shadcn
64
+ ```
65
+
66
+ At prompt answer like this:
67
+ ```bash
68
+ Which style would you like to use?
69
+ │ Default
70
+ │
71
+ ◇ Which base color would you like to use?
72
+ │ Slate
73
+ │
74
+ ◇ Where is your global CSS file? (this file will be overwritten)
75
+ │ src/app.css (!!! add local project's css file as we don't want to overwrite our project's global styles)
76
+ │
77
+ ◇ Where is your Tailwind config located? (this file will be overwritten)
78
+ │ tailwind.config.ts
79
+ │
80
+ ◇ Configure the import alias for components:
81
+ │ $lib/components
82
+ │
83
+ ◆ Configure the import alias for utils:
84
+ │ $lib/utils
85
+ │
86
+ ◆ Configure the import alias for hooks:
87
+ │ $lib/hooks
88
+ │
89
+ ◆ Configure the import alias for ui:
90
+ │ $lib/components/ui
91
+
92
+
93
+ Components to install:
94
+ │ accordion, badge, button, calendar, range-calendar, card, checkbox, collapsible, dialog,
95
+ │ drawer, dropdown-menu, input, input-otp, label, popover, progress, radio-group, scroll-area,
96
+ │ select, separator, slider, switch, table, tabs, textarea, tooltip
97
+ │
98
+ ◆ Ready to install components and dependencies?
99
+ │ ● Yes / ○ No
100
+ ...
101
+ tooltip installed at src/lib/components/ui/tooltip
102
+ │
103
+ ◇ Dependencies installed with npm
104
+ │
105
+ ◇ Config file components.json updated
106
+ │
107
+ └ Success! Component installation completed.
108
+
109
+ !!! On commit the change uncheck the grouped components(Table, Select, etc.) baerel file.
110
+ ```
111
+
112
+ b. Installing the shadcn-svelte package:
113
+
114
+ ```bash
115
+ npx shadcn-svelte@next init
116
+ ```
117
+
118
+ c. Add one or more SHADCN UI components:
119
+
120
+ ```bash
121
+ npx shadcn-svelte@next add <component-name component-name2>
122
+ ```
123
+
124
+ d. Check tailwind.config.ts file to see if you didn't lose any of the project's config.
125
+
126
+ e. Check /src/lib/utils/utils.ts file to see if you didn't lose any of the project's utils.
127
+
128
+ f. Check /src/lib/hooks/hooks.ts file to see if you didn't lose any of the project's hooks.
129
+
130
+ g. Check SHADCN UI Grouped components(eg. Table or Select) barel file to export a constant with the subcomponents.
131
+ We do that just be wrapping the first part of the export statement with a constant named as the component ("Table" here) and replace the exported subcomponent: "Table" in this case with "TableRoot".
53
132
  ```ts
54
- // tailwind.config.ts
55
- import type { Config } from 'tailwindcss';
56
- import designSystemPreset from '@widgetic/design-system/tailwind.config'; // Import the preset
133
+ // src/lib/components/ui/table/index.ts
134
+ const Table = {
135
+ Root,
136
+ Body,
137
+ Caption,
138
+ Cell,
139
+ Footer,
140
+ Head,
141
+ Header,
142
+ Row
143
+ };
144
+
145
+ export {
146
+ Table, // add the constant name "Table" that will be the namespace for the grouped components
147
+ Root as TableRoot, // Change the name of the Root component from "Table" to "TableRoot"
148
+ Body as TableBody,
149
+ Caption as TableCaption,
150
+ Cell as TableCell,
151
+ Footer as TableFooter,
152
+ Head as TableHead,
153
+ Header as TableHeader,
154
+ Row as TableRow,
155
+ };
156
+ ```
157
+ Then you can import and use the namespace in the project:
158
+ ```svelte
159
+ import { Table } from '@widgetic/design-system';
160
+ ```
57
161
 
58
- const config = {
59
- // Use the design system preset
60
- presets: [designSystemPreset],
61
-
62
- // Add your project's paths AND the design system's path to the content array
63
- content: [
64
- './src/**/*.{html,js,svelte,ts}', // Your project files
65
- './node_modules/@widgetic/design-system/dist/**/*.{html,js,svelte,ts}' // Design system package files
66
- ],
67
-
68
- // You can optionally extend the theme further here
69
- theme: {
70
- extend: {
71
- // Your project-specific theme extensions
72
- }
73
- },
74
-
75
- plugins: [
76
- // Your project-specific plugins (if any)
77
- ]
78
- } satisfies Config;
162
+ h. If there is a component that looks compound but is not, add the @notCompound marker in the file:
163
+ ```ts
164
+ // @notCompound
165
+ export {
166
+ Root,
167
+ Scrollbar,
168
+ //,
169
+ Root as ScrollArea,
170
+ Scrollbar as ScrollAreaScrollbar,
171
+ };
172
+ ```
173
+ ScrollArea is not a compound component but it looks like one.
79
174
 
80
- export default config;
175
+ h. If you want to export only the main component and not the subcomponents, add the @noSubcomponents marker in the file:
176
+ ```ts
177
+ // @noSubcomponents
178
+ export {
179
+ Day,
180
+ Cell,
181
+ Grid,
182
+ Header,
183
+ Months,
184
+ GridRow,
185
+ Heading,
186
+ GridBody,
187
+ GridHead,
188
+ HeadCell,
189
+ NextButton,
190
+ PrevButton,
191
+ //
192
+ Root as RangeCalendar,
193
+ };
81
194
  ```
195
+ RangeCalendar share the same subcomponents with Calendar so we don't want to export them.
82
196
 
83
- * **Presets:** The `presets` array applies the design system's base configuration (colors, fonts, plugins like `tailwindcss-animate`).
84
- * **Content:** It's crucial to include the path to the installed design system package (`./node_modules/@widgetic/design-system/dist/...`) in your `content` array. This allows Tailwind to scan the design system's components and generate the necessary utility classes.
197
+ 1.2. In general we should follow the shadcn-svelte approach to export the components with more subcomponents or compound components.
198
+
199
+ 2. Icons: It also uses the Lucide and Tabler icons or custom icons for the platform.
200
+
201
+ ```svelte
202
+ import { IconName } from '@widgetic/design-system/icons';
203
+ ```
85
204
 
86
- ### 2. Global Styles
87
205
 
88
- Import the design system's global CSS file into your main layout file (e.g., `src/routes/+layout.svelte`). This file includes base styles, CSS variables (design tokens), and imports necessary fonts.
206
+ 3. Fonts: The design system uses Google Fonts that we need to import in the project where the design system is imported.
89
207
 
90
208
  ```svelte
91
- <!-- src/routes/+layout.svelte -->
92
- <script>
93
- import '@widgetic/design-system/styles'; // Import global styles
209
+ import { FontName } from '@widgetic/design-system/fonts';
210
+ ```
94
211
 
95
- // Your layout script...
96
- </script>
97
212
 
98
- <slot />
213
+ ## Performance Optimization for Linked Design System
214
+
215
+ When using the linked design system in development mode, you may experience slow initial load times and delayed navigation. This is because Vite's default file watching behavior can create performance issues when working with linked packages.
216
+
217
+ ### Common Issues:
218
+ - Long initial loading time (>1 minute)
219
+ - "Pending" status on network requests when navigating between pages
220
+ - High CPU usage during development
221
+
222
+ ### Solution:
223
+
224
+ #### 1. For consuming projects (like site, context-chat, etc.):
225
+
226
+ Optimize your `vite.config.ts` with these settings:
227
+
228
+ ```ts
229
+ server: {
230
+ watch: {
231
+ // Don't use polling (which causes high CPU usage)
232
+ // Remove the following if present:
233
+ // usePolling: true,
234
+ // interval: 2000,
235
+ // binaryInterval: 2000,
236
+
237
+ // Ignore all node_modules EXCEPT the design system dist folder if needed
238
+ ignored: [
239
+ '**/node_modules/**',
240
+ '**/*.map',
241
+ '**/*.d.ts',
242
+ '**/*.log'
243
+ ]
244
+ },
245
+ hmr: {
246
+ // Reduce timeout for faster updates
247
+ timeout: 2000
248
+ }
249
+ },
250
+ optimizeDeps: {
251
+ // Don't include the design system in optimizeDeps
252
+ // Remove this if present:
253
+ // include: ['@widgetic/design-system']
254
+
255
+ // Keep other settings
256
+ exclude: ['@sveltejs/kit']
257
+ },
258
+ build: {
259
+ // Add these for faster builds
260
+ sourcemap: false,
261
+ reportCompressedSize: false
262
+ }
99
263
  ```
100
264
 
101
- ## Usage
265
+ #### 2. For production deployments:
266
+
267
+ When deploying to production, you'll use the published npm package instead of the linked development version. No special configuration is needed beyond the optimizations above.
268
+
269
+ #### 3. Development vs. Production Mode:
270
+
271
+ The design system's `vite.config.ts` already includes development-specific optimizations. When publishing the package to npm, the built version will be used, and these configurations won't affect end users.
102
272
 
103
- ### Components
273
+ **Note:** These optimizations are only needed during development with linked packages and won't affect the published npm package performance.
104
274
 
105
- Import components directly from the package:
106
275
 
276
+ ## How to link DS into another project and develop it(first time)
277
+
278
+ 0. Go into the DS project and link it in the system and start it with: `cd Frontend/design-system && npm link && npm run dev`
279
+
280
+ 1. Go into the consuming project and make sure you have installed tailwindcss and postcss by checking in package.json if it has these dependencies:
281
+
282
+ ```json
283
+ "dependencies": {
284
+ "tailwindcss": "^3.4.16",
285
+ "@tailwindcss/postcss": "^4.1.2",
286
+ }
287
+ ```
288
+
289
+ Also make sure you have a 'tailwind.config.ts'(if there is a '.js' version rename it to '.ts') and a 'postcss.config.js' file.
290
+ (optional)If not already in the project follow the install guide at: https://tailwindcss.com/docs/installation/using-postcss.
291
+
292
+
293
+ 2. Also add these dependencies and overrides(that are needed for DS) with these exact versions into the package.json file of the consuming project:
294
+ ```json package.json
295
+ "dependencies": {
296
+ "@sveltejs/kit": "^2.20.2",
297
+ "svelte": "^5.25.6",
298
+ "@tabler/icons-svelte": "^3.24.0",
299
+ "lucide-svelte": "^0.468.0",
300
+ "bits-ui": "^1.3.0",
301
+ "svelte-sonner": "^0.3.28",
302
+
303
+ "tailwind-merge": "^2.5.2",
304
+ "tailwind-variants": "^0.2.1",
305
+ "tailwindcss-animate": "^1.0.7",
306
+ }
307
+
308
+ "overrides": {
309
+ "bits-ui": {
310
+ "@melt-ui/svelte": "^0.86.3"
311
+ },
312
+ "vaul-svelte": {
313
+ "bits-ui": {
314
+ "@melt-ui/svelte": "^0.86.3"
315
+ }
316
+ },
317
+ "svelte": "^5.25.6"
318
+ },
319
+ ```
320
+
321
+ Also keep the exact versions mentioned above and check and remove these dependencies from devDependencies or peerDependencies in the package.json of the consuming project.
322
+
323
+ 3. Also add this "i"(install) and "lds"(link) scripts into the package.json file exactly as following:
324
+ "i": "rm -rf node_modules && npm i && npm run lds",
325
+ "lds": "volta run npm link @widgetic/design-system",
326
+ Then run it with: `npm run i`
327
+
328
+ 4. Also add these "dev" scripts into the package.json file for usual start of the consuming project:
329
+ "dev": "npm run dev-sv -- --open",
330
+ "dev-sv": "NODE_ENV=development vite dev",
331
+
332
+ 5. Import DS config into the tailwind.config.ts file(of consuming project) and add it in the presets array:
333
+ ```ts
334
+ // tailwind.config.ts
335
+
336
+ import designSystemPreset from '@widgetic/design-system/tailwind.config';
337
+
338
+ const config = {
339
+ // add here the DS preset
340
+ presets: [
341
+ designSystemPreset
342
+ ],
343
+ // add here the '@widgetic/*/dist/...' to scan also the DS package files
344
+ content: [
345
+ "./src/**/*.{html,js,svelte,ts}",
346
+ // Include all @widgetic packages from node_modules(for development only) to be sure Tailwind scans all the files
347
+ "./node_modules/@widgetic/*/dist/**/*.{html,js,svelte,ts}"
348
+ ],
349
+ // the rest of the config properties
350
+ theme: {
351
+ extend: {
352
+ // current extend config...
353
+ }
354
+ }
355
+ };
356
+
357
+ export default config;
358
+ ```
359
+ Also make sure you remove the type of the config to avoid conflicts with the DS config.
360
+ Then leave the rest of the config as it is.
361
+
362
+ 6. Import styles and a test component from DS in the consuming project:
363
+ a. In the root layout of the project import the global styles:
364
+ ```svelte
365
+ <!-- +layout.svelte -->
366
+ <script>
367
+ import '@widgetic/design-system/styles';
368
+ </script>
369
+ ```
370
+ b. In the root page of the consuming project import any component(e.g. Button) and use it:
107
371
  ```svelte
372
+ <!-- +page.svelte -->
108
373
  <script>
109
- import { Button, Card, CardHeader, CardTitle, CardContent } from '@widgetic/design-system';
110
- // For grouped components (like Table, Accordion), use the namespace
111
- import { Table } from '@widgetic/design-system';
374
+ import { Button } from '@widgetic/design-system/';
112
375
  </script>
113
376
 
114
- <Button>Click Me</Button>
377
+ <!-- HTML zone -->
378
+ <Button>Click me</Button>
379
+ ```
380
+
381
+ 7. Finally: go into the in the consuming project's folder and start the development server with:
382
+ ```bash
383
+ npm run dev
384
+ ```
385
+
386
+ This automatically opens the http://localhost:5173 (default port) for the consuming project and you can see how DS components work in it.
387
+
388
+
389
+
390
+ ## Developing inside this project:
391
+
392
+ 1. Install dependencies with `npm install`
393
+
394
+ 2. Link the package in the system with npm:
395
+ ```bash
396
+ npm link
397
+ ```
398
+
399
+ 3. Start the development server with:
400
+ ```bash
401
+ npm run dev
402
+ ```
403
+
404
+ 3. Test the design system in action:
405
+ - In the root layout of the DS project there is a global styles import to test the design system's global styles.
406
+ - In the root page of the project there is a button component import to test the design system's components.
407
+
408
+ Open in new tab in browser with address: http://localhost:5173/ to see the design system in action.
409
+
115
410
 
116
- <Card.Root>
117
- <Card.Header>
118
- <Card.Title>Card Title</Card.Title>
119
- </Card.Header>
120
- <Card.Content>
121
- <p>Card body content...</p>
122
- </Card.Content>
123
- </Card.Root>
124
411
 
125
- <Table.Root>
126
- <Table.Header>
127
- <Table.Row>
128
- <Table.Head>Header 1</Table.Head>
129
- </Table.Row>
130
- </Table.Header>
131
- <Table.Body>
132
- <Table.Row>
133
- <Table.Cell>Cell 1</Table.Cell>
134
- </Table.Row>
135
- </Table.Body>
136
- </Table.Root>
412
+ ### Global Tailwind CSS and Design Tokens:
413
+
414
+ ```css
415
+ /* src/lib/styles/global.css */
416
+ @tailwind base;
417
+ @tailwind components;
418
+ @tailwind utilities;
419
+
420
+ /* CUSTOM GLOBAL STYLES */
421
+ /* ADD HERE CLASSES AND CSS VARIABLES that are used in the projects where the design system is imported */
422
+
423
+ /* Base styles */
424
+ @layer base {
425
+ :root {
426
+ /* Design tokens */
427
+ --color-primary: 30 158 210; /* RGB values for easier theming */
428
+ --color-secondary: 46 204 113;
429
+ --radius: 0.5rem;
430
+ }
431
+
432
+ /* Dark mode tokens */
433
+ .dark {
434
+ --color-primary: 100 200 255;
435
+ --color-secondary: 100 255 150;
436
+ }
437
+ }
438
+
439
+ /* Reusable component classes */
440
+ @layer components {
441
+ .btn-primary {
442
+ @apply bg-[rgb(var(--color-primary))] text-white rounded-[var(--radius)];
443
+ }
444
+
445
+ .card {
446
+ @apply shadow-md rounded-lg p-4 bg-white dark:bg-gray-800;
447
+ }
448
+ }
449
+
450
+ /* Custom utility classes */
451
+ @layer utilities {
452
+ .text-balance {
453
+ text-wrap: balance;
454
+ }
455
+ }
137
456
  ```
138
457
 
139
- Refer to the specific component documentation or source code for available props and variants.
458
+ 2. In the project where the design system is imported:
459
+ - Import the global styles in the +layout.svelte file:
460
+ ```svelte
461
+ <script>
462
+ import '@widgetic/design-system/styles';
463
+ </script>
464
+ ```
140
465
 
141
- ### Icons
142
466
 
143
- Import required icons by name:
467
+ ### Create a Custom Shared Component in the Design System project using a SHADCN UI component and classes from the global styles:
144
468
 
469
+ src/lib/components/MyButton.svelte:
145
470
  ```svelte
146
471
  <script>
147
- import { ChevronUp, IconSettings } from '@widgetic/design-system/icons'; // Example names
472
+ // Import Button from the SHADCN UI components
473
+ import { Button } from './components/ui';
148
474
  </script>
149
475
 
150
- <button>
151
- <ChevronUp class="size-4" /> Settings <IconSettings class="size-4" />
152
- </button>
476
+ <MyButton
477
+ {type}
478
+ class="btn-primary"
479
+ on:click
480
+ >
481
+ <slot />
482
+ </MyButton>
483
+ ```
484
+ Then export the component in the "src/lib/components/index.ts" file:
485
+ ```ts
486
+ export {default as MyButton } from './components/MyButton.svelte';
153
487
  ```
154
488
 
155
- ### Fonts & Typography
156
489
 
157
- The global styles load the necessary `@font-face` rules. You can apply typography using standard Tailwind utility classes (e.g., `text-lg`, `font-semibold`) or the custom typography utility classes exported by the design system (defined in `fonts.css`, like `h1`, `body-medium`, `subtext`).
490
+ ## Deployment of Design System
158
491
 
159
- ```svelte
160
- <h1 class="h1">Main Title</h1>
161
- <p class="body-medium">This is body text.</p>
162
- <span class="subtext">Some smaller text.</span>
492
+ To deploy the design system, run the following command:
493
+ ```bash
494
+ npm run prepublishOnly
495
+ ```
496
+ This will create a `dist` folder with the production build of the design system.
497
+
498
+ To publish the design system to the npm registry, run the following command:
499
+ ```bash
500
+ npm run publish-package
163
501
  ```
164
502
 
165
503
  ## Grid System
@@ -400,3 +738,131 @@ You can provide custom title and message for specific contexts:
400
738
  on:cancel={handleCancel}
401
739
  />
402
740
  ```
741
+
742
+
743
+ ## Troubleshooting
744
+
745
+ ### File Case Sensitivity Issues (macOS/Windows Teams)
746
+
747
+ **Problem:** Component imports break inconsistently across team members, with errors like:
748
+ - `Cannot resolve module './checked.svelte'` vs `'./Checked.svelte'`
749
+ - Barrel file exports pointing to wrong case filenames
750
+ - One developer's changes cause import errors for others
751
+
752
+ **Root Cause:** Different operating systems handle file case differently:
753
+ - **macOS/Windows:** Case-insensitive but case-preserving file systems
754
+ - **Linux:** Case-sensitive file system
755
+ - **Git:** May not properly sync case-only file renames between different systems
756
+
757
+ **Solutions:**
758
+
759
+ 1. **Quick Setup (Recommended):** Run the install script which includes Git configuration:
760
+ ```bash
761
+ npm run i # Installs dependencies and configures Git automatically
762
+ ```
763
+
764
+ 2. **Git Only:** If you just need to configure Git case sensitivity:
765
+ ```bash
766
+ npm run set-git
767
+ ```
768
+
769
+ 3. **Manual Setup:** Configure Git to be case-sensitive in your local repository:
770
+ ```bash
771
+ git config core.ignorecase false
772
+ ```
773
+
774
+ 4. **Team Setup:** After the above configuration, if you encounter existing case conflicts:
775
+ ```bash
776
+ git pull # Get latest changes
777
+ npm run dev # Auto-fixes any remaining case issues via Vite plugin
778
+ ```
779
+
780
+ **Prevention:**
781
+ - All team members should run `npm run i` when first working with the design system
782
+ - Always use PascalCase for `.svelte` component files (e.g., `MyComponent.svelte`)
783
+ - The development server automatically renames files to follow PascalCase convention
784
+
785
+ ### Cursor IDE: TypeScript Parser Not Recognizing Svelte Files
786
+
787
+ **Problem:** After updating Cursor IDE, you may see TypeScript parsing errors in `.svelte` files that use design system components, such as:
788
+ - `Cannot find name 'script'`
789
+ - `'>': expected`
790
+ - `Cannot find name 'lang'`
791
+ - Other syntax errors in valid Svelte code
792
+
793
+ **Root Cause:** Mixed tabs and spaces in the file can confuse the TypeScript parser, preventing it from properly recognizing the file as a Svelte component. This issue commonly occurs after Cursor IDE updates.
794
+
795
+ **Solution:**
796
+ 1. Select the file showing the error
797
+ 2. In the bottom-right corner of Cursor IDE, click the "TypeScript" box
798
+ 3. When you hover over it, it shows "Select Language Mode"
799
+ 4. Select **"Svelte"** from the dropdown
800
+ 5. The file should now be parsed correctly as a Svelte component
801
+
802
+ **Prevention:** Ensure your project has proper Svelte language support configured:
803
+ - Install the Svelte extension for Cursor/VS Code
804
+ - Check that `svelte.config.js` is properly configured
805
+ - Ensure consistent indentation (spaces vs tabs) in your `.svelte` files
806
+
807
+ ### Design System Import Errors
808
+
809
+ **Problem:** Cannot import components or getting module resolution errors.
810
+
811
+ **Solutions:**
812
+ 1. **Check peer dependencies:** Ensure all required peer dependencies are installed with compatible versions
813
+ 2. **Restart development server:** After installing the design system or updating dependencies
814
+ 3. **Clear caches:** Run your project's cache clearing commands (e.g., `npm run clean-svelte-cache`)
815
+ 4. **Verify Tailwind config:** Ensure the design system preset is properly imported in your `tailwind.config.ts`
816
+
817
+ ### Styling Issues
818
+
819
+ **Problem:** Components appear unstyled or with incorrect styling.
820
+
821
+ **Solutions:**
822
+ 1. **Import global styles:** Ensure you've imported `@widgetic/design-system/styles/global.css` in your root layout
823
+ 2. **Check Tailwind setup:** Verify your `tailwind.config.ts` includes the design system preset
824
+ 3. **PostCSS configuration:** Ensure `postcss.config.js` is set up for Tailwind v4
825
+ 4. **Content paths:** Make sure your Tailwind config includes the design system in content paths:
826
+ ```js
827
+ content: [
828
+ "./src/**/*.{html,js,svelte,ts}",
829
+ "./node_modules/@widgetic/*/dist/**/*.{html,js,svelte,ts}"
830
+ ]
831
+ ```
832
+
833
+ ### Version Compatibility Issues
834
+
835
+ **Problem:** Getting errors after updating Svelte, SvelteKit, or other dependencies.
836
+
837
+ **Solutions:**
838
+ 1. **Check compatibility:** Ensure your project's Svelte/SvelteKit versions are compatible with the design system
839
+ 2. **Update together:** Consider updating both the design system and your project dependencies together
840
+ 3. **Check breaking changes:** Review changelogs for any breaking changes
841
+ 4. **Use exact versions:** For critical projects, consider pinning exact versions instead of ranges
842
+
843
+ ### Performance Issues
844
+
845
+ **Problem:** Slow build times or large bundle sizes.
846
+
847
+ **Solutions:**
848
+ 1. **Tree shaking:** Import only the components you need:
849
+ ```js
850
+ // Good: Import specific components
851
+ import { Button } from '@widgetic/design-system/components';
852
+
853
+ // Avoid: Importing everything
854
+ import * as DS from '@widgetic/design-system';
855
+ ```
856
+ 2. **Check Tailwind purging:** Ensure Tailwind is properly purging unused styles
857
+ 3. **Optimize imports:** Use direct imports when possible to improve tree shaking
858
+
859
+ ### Getting Help
860
+
861
+ If you continue to experience issues:
862
+ 1. Check the latest documentation in this README
863
+ 2. Review the `__docs/how-to-link-ds.md` guide for setup instructions
864
+ 3. Check for updates to the design system package
865
+ 4. Report persistent issues to the development team with:
866
+ - Your project's `package.json` dependencies
867
+ - Complete error messages
868
+ - Steps to reproduce the issue