crayon-design-system-ui 0.0.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.
- package/README.md +487 -0
- package/dist/angular/index.d.ts +614 -0
- package/dist/angular/index.d.ts.map +1 -0
- package/dist/angular/index.js +209 -0
- package/dist/assets/attributes-o88QCNuy.js +1 -0
- package/dist/assets/custom-element-CN6vLcFC.js +2 -0
- package/dist/assets/each-DkX3FjFL.js +1 -0
- package/dist/assets/if-DdiIl-sg.js +1 -0
- package/dist/assets/index-client-CiUbrQq_.js +1 -0
- package/dist/assets/lifecycle-BK5NY8qp.js +2 -0
- package/dist/assets/props-DbUVX42-.js +1 -0
- package/dist/assets/slot-CRFQJtYY.js +1 -0
- package/dist/assets/this-DllEouAd.js +1 -0
- package/dist/components/accordion/Accordion.d.ts +1 -0
- package/dist/components/accordion/Accordion.js +5 -0
- package/dist/components/accordion/Accordion.svelte +203 -0
- package/dist/components/accordion/Accordion.svelte.d.ts +19 -0
- package/dist/components/accordion-item/AccordionItem.d.ts +1 -0
- package/dist/components/accordion-item/AccordionItem.js +3 -0
- package/dist/components/accordion-item/AccordionItem.svelte +159 -0
- package/dist/components/accordion-item/AccordionItem.svelte.d.ts +18 -0
- package/dist/components/avatar/Avatar.d.ts +1 -0
- package/dist/components/avatar/Avatar.js +4 -0
- package/dist/components/avatar/Avatar.svelte +132 -0
- package/dist/components/avatar/Avatar.svelte.d.ts +24 -0
- package/dist/components/button/Button.d.ts +1 -0
- package/dist/components/button/Button.js +35 -0
- package/dist/components/button/Button.svelte +254 -0
- package/dist/components/button/Button.svelte.d.ts +31 -0
- package/dist/components/card/Card.d.ts +1 -0
- package/dist/components/card/Card.js +29 -0
- package/dist/components/card/Card.svelte +244 -0
- package/dist/components/card/Card.svelte.d.ts +27 -0
- package/dist/components/checkbox/Checkbox.d.ts +1 -0
- package/dist/components/checkbox/Checkbox.js +23 -0
- package/dist/components/checkbox/Checkbox.svelte +196 -0
- package/dist/components/checkbox/Checkbox.svelte.d.ts +28 -0
- package/dist/components/form/Form.d.ts +1 -0
- package/dist/components/form/Form.js +4 -0
- package/dist/components/form/Form.svelte +54 -0
- package/dist/components/form/Form.svelte.d.ts +29 -0
- package/dist/components/form-select/FormSelect.d.ts +1 -0
- package/dist/components/form-select/FormSelect.js +20 -0
- package/dist/components/form-select/FormSelect.svelte +244 -0
- package/dist/components/form-select/FormSelect.svelte.d.ts +41 -0
- package/dist/components/form-select/FormSelectOption.d.ts +1 -0
- package/dist/components/form-select/FormSelectOption.js +3 -0
- package/dist/components/form-select/FormSelectOption.svelte +10 -0
- package/dist/components/form-select/FormSelectOption.svelte.d.ts +20 -0
- package/dist/components/input/Input.d.ts +1 -0
- package/dist/components/input/Input.js +24 -0
- package/dist/components/input/Input.svelte +429 -0
- package/dist/components/input/Input.svelte.d.ts +48 -0
- package/dist/components/label/Label.d.ts +1 -0
- package/dist/components/label/Label.js +3 -0
- package/dist/components/label/Label.svelte +74 -0
- package/dist/components/label/Label.svelte.d.ts +23 -0
- package/dist/components/radio/Radio.d.ts +1 -0
- package/dist/components/radio/Radio.js +16 -0
- package/dist/components/radio/Radio.svelte +147 -0
- package/dist/components/radio/Radio.svelte.d.ts +26 -0
- package/dist/components/textarea/Textarea.d.ts +1 -0
- package/dist/components/textarea/Textarea.js +5 -0
- package/dist/components/textarea/Textarea.svelte +122 -0
- package/dist/components/textarea/Textarea.svelte.d.ts +34 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +13 -0
- package/dist/react/index.d.ts +24 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +26 -0
- package/dist/register/accordion-item.d.ts +1 -0
- package/dist/register/accordion-item.js +4 -0
- package/dist/register/accordion.d.ts +1 -0
- package/dist/register/accordion.js +4 -0
- package/dist/register/avatar.d.ts +1 -0
- package/dist/register/avatar.js +4 -0
- package/dist/register/button.d.ts +1 -0
- package/dist/register/button.js +4 -0
- package/dist/register/card.d.ts +1 -0
- package/dist/register/card.js +4 -0
- package/dist/register/checkbox.d.ts +1 -0
- package/dist/register/checkbox.js +4 -0
- package/dist/register/form-select-option.d.ts +1 -0
- package/dist/register/form-select-option.js +4 -0
- package/dist/register/form-select.d.ts +1 -0
- package/dist/register/form-select.js +4 -0
- package/dist/register/form.d.ts +1 -0
- package/dist/register/form.js +4 -0
- package/dist/register/input.d.ts +1 -0
- package/dist/register/input.js +4 -0
- package/dist/register/label.d.ts +1 -0
- package/dist/register/label.js +4 -0
- package/dist/register/radio.d.ts +1 -0
- package/dist/register/radio.js +4 -0
- package/dist/register/textarea.d.ts +1 -0
- package/dist/register/textarea.js +4 -0
- package/dist/register.d.ts +1 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +18 -0
- package/dist/tokens.css +184 -0
- package/dist-browser/assets/Accordion-CwOMoX3u.js +3 -0
- package/dist-browser/assets/AccordionItem-CuTFqdt6.js +1 -0
- package/dist-browser/assets/Avatar-Ct0ZUf_m.js +2 -0
- package/dist-browser/assets/Button-BvYyhPrn.js +33 -0
- package/dist-browser/assets/Card-DM0rPY9s.js +27 -0
- package/dist-browser/assets/Checkbox-DK1LWC1i.js +21 -0
- package/dist-browser/assets/Form-BZFKnk3f.js +2 -0
- package/dist-browser/assets/FormSelect-CBTpNNrh.js +18 -0
- package/dist-browser/assets/FormSelectOption-DhOxPDjS.js +1 -0
- package/dist-browser/assets/Input-DZZF_45U.js +22 -0
- package/dist-browser/assets/Label-BX3_KNGn.js +1 -0
- package/dist-browser/assets/Radio-Bwape_rC.js +14 -0
- package/dist-browser/assets/Textarea-BYsLYgK4.js +3 -0
- package/dist-browser/assets/attributes-BN21YWvK.js +1 -0
- package/dist-browser/assets/custom-element-vZIc-tZM.js +2 -0
- package/dist-browser/assets/each-CDVyljdy.js +1 -0
- package/dist-browser/assets/if-B3xMWYuB.js +1 -0
- package/dist-browser/assets/index-client-BMTknfvN.js +1 -0
- package/dist-browser/assets/lifecycle-BSCLFPkh.js +2 -0
- package/dist-browser/assets/props-DClXGNhw.js +1 -0
- package/dist-browser/assets/slot-Btw_EhJQ.js +1 -0
- package/dist-browser/assets/this-CobEtPHm.js +1 -0
- package/dist-browser/bundle.js +2 -0
- package/dist-browser/tokens.css +184 -0
- package/package.json +89 -0
package/README.md
ADDED
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
# Svelte library
|
|
2
|
+
|
|
3
|
+
Everything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).
|
|
4
|
+
|
|
5
|
+
Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
|
|
6
|
+
|
|
7
|
+
## Creating a project
|
|
8
|
+
|
|
9
|
+
If you're seeing this, you've probably already done this step. Congrats!
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
# create a new project in the current directory
|
|
13
|
+
npx sv create
|
|
14
|
+
|
|
15
|
+
# create a new project in my-app
|
|
16
|
+
npx sv create my-app
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
To recreate this project with the same configuration:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
# recreate this project
|
|
23
|
+
npx sv create --template library --types ts --no-install design-system-ui
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Developing
|
|
27
|
+
|
|
28
|
+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
npm run dev
|
|
32
|
+
|
|
33
|
+
# or start the server and open the app in a new browser tab
|
|
34
|
+
npm run dev -- --open
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
|
|
38
|
+
|
|
39
|
+
## Building
|
|
40
|
+
|
|
41
|
+
To build your library:
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
npm pack
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
To create a production version of your showcase app:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
npm run build
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
You can preview the production build with `npm run preview`.
|
|
54
|
+
|
|
55
|
+
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
|
|
56
|
+
|
|
57
|
+
## Publishing
|
|
58
|
+
|
|
59
|
+
Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
|
|
60
|
+
|
|
61
|
+
To publish your library to [npm](https://www.npmjs.com):
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
npm publish
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
# Design System UI
|
|
68
|
+
|
|
69
|
+
Package name: **`crayon-design-system-ui`**. A reusable Design System built using **Svelte 5 + Web Components**, packaged for use in:
|
|
70
|
+
|
|
71
|
+
- Plain HTML
|
|
72
|
+
- SvelteKit
|
|
73
|
+
- React
|
|
74
|
+
- Angular
|
|
75
|
+
- Vue
|
|
76
|
+
- Any browser-based framework
|
|
77
|
+
|
|
78
|
+
Use **custom elements** (`import 'crayon-design-system-ui/register'` then `<ui-button>`) everywhere, or in Svelte use the named component: `import { Button } from 'crayon-design-system-ui'`.
|
|
79
|
+
|
|
80
|
+
Example:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
<ui-button></ui-button>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Component usage docs:** See [docs/README.md](docs/README.md) for a list of per-component usage documents (Button, Accordion, AccordionItem). When you change a component in `src/lib/components/`, update its doc in `docs/components/` so the docs stay in sync.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
# Architecture Overview
|
|
91
|
+
|
|
92
|
+
The design system is built using:
|
|
93
|
+
|
|
94
|
+
- Svelte 5
|
|
95
|
+
- Web Components (customElements)
|
|
96
|
+
- Vite
|
|
97
|
+
- SvelteKit (library mode)
|
|
98
|
+
|
|
99
|
+
Outputs:
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
dist/ → Library build (types, Svelte exports)
|
|
103
|
+
dist-browser/ → Browser bundle (registers custom elements)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The browser bundle is the main runtime entry.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
# Project Structure
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
design-system-ui/
|
|
114
|
+
|
|
115
|
+
src/
|
|
116
|
+
lib/
|
|
117
|
+
components/
|
|
118
|
+
Button.svelte
|
|
119
|
+
index.ts
|
|
120
|
+
|
|
121
|
+
register.ts ← SSR-safe registration entry
|
|
122
|
+
|
|
123
|
+
vite.config.ts ← library build config
|
|
124
|
+
vite.browser.config.ts ← browser bundle config
|
|
125
|
+
|
|
126
|
+
package.json
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
dist/
|
|
130
|
+
dist-browser/
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
# Component Example
|
|
136
|
+
|
|
137
|
+
Button component:
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
<ui-button variant="primary">
|
|
141
|
+
Click Me
|
|
142
|
+
</ui-button>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Supports:
|
|
146
|
+
|
|
147
|
+
- variants
|
|
148
|
+
- sizes
|
|
149
|
+
- disabled
|
|
150
|
+
- loading
|
|
151
|
+
- custom color
|
|
152
|
+
- click events
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
# Build Commands
|
|
157
|
+
|
|
158
|
+
## Build library
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
npm run build
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Output:
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
dist/
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Build browser bundle
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
npm run build:browser
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Output:
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
dist-browser/bundle.js
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
# Local npm Packaging
|
|
185
|
+
|
|
186
|
+
Create installable package:
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
npm pack
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Produces:
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
design-system-ui-0.0.1.tgz
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Install in another project:
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
npm install ../design-system-ui/design-system-ui-0.0.1.tgz
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
# Usage — Plain HTML
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
<script type="module">
|
|
210
|
+
import 'design-system-ui';
|
|
211
|
+
</script>
|
|
212
|
+
|
|
213
|
+
<ui-button variant="primary">
|
|
214
|
+
Click Me
|
|
215
|
+
</ui-button>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Optional click event:
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
document.querySelector('ui-button')
|
|
222
|
+
.addEventListener('ui-click', () => alert('Clicked'));
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Run using local server:
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
npx serve .
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
# Usage — Same everywhere (Svelte, React, Angular, plain HTML)
|
|
234
|
+
|
|
235
|
+
Use **custom elements** the same way in every project. You don’t need to know the customer’s framework or Svelte version — one API works everywhere.
|
|
236
|
+
|
|
237
|
+
**1. Register** (once, e.g. in your app entry or layout):
|
|
238
|
+
|
|
239
|
+
```js
|
|
240
|
+
import 'crayon-design-system-ui/register';
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**2. Use the tags** in your templates/JSX/HTML:
|
|
244
|
+
|
|
245
|
+
```html
|
|
246
|
+
<ui-button variant="primary">Click Me</ui-button>
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**Single component** (smaller bundle): register only what you need:
|
|
250
|
+
|
|
251
|
+
```js
|
|
252
|
+
import 'crayon-design-system-ui/register/button';
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Then use `<ui-button>` as above. Other entries: `register/input`, `register/textarea`, `register/accordion`, `register/accordion-item`, `register/form-select`, `register/form-select-option`, `register/checkbox`, `register/radio`, `register/label`, `register/form`, `register/avatar`, `register/card`.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
# Usage — Svelte: named component import
|
|
260
|
+
|
|
261
|
+
In Svelte apps you can also use the **Svelte component** directly (package name: `crayon-design-system-ui`):
|
|
262
|
+
|
|
263
|
+
```svelte
|
|
264
|
+
<script>
|
|
265
|
+
import { Button } from 'crayon-design-system-ui';
|
|
266
|
+
</script>
|
|
267
|
+
<Button variant="primary">Click Me</Button>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Other named exports: `Input`, `Textarea`, `Accordion`, `AccordionItem`, `FormSelect`, `FormSelectOption`, `Checkbox`, `Radio`, `Label`, `Form`, `Avatar`, `Card`. Use this when your app and the design system are on the same major Svelte version; otherwise use the custom elements above.
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
# Usage — SvelteKit
|
|
275
|
+
|
|
276
|
+
## Step 1 — Install
|
|
277
|
+
|
|
278
|
+
```
|
|
279
|
+
npm install crayon-design-system-ui
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
(or local .tgz file)
|
|
283
|
+
|
|
284
|
+
## Step 2 — Register globally
|
|
285
|
+
|
|
286
|
+
File:
|
|
287
|
+
|
|
288
|
+
```
|
|
289
|
+
src/routes/+layout.svelte
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
```svelte
|
|
293
|
+
<script>
|
|
294
|
+
import 'crayon-design-system-ui/register';
|
|
295
|
+
</script>
|
|
296
|
+
<slot />
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
For a single component (e.g. only Button):
|
|
300
|
+
|
|
301
|
+
```svelte
|
|
302
|
+
<script>
|
|
303
|
+
import 'crayon-design-system-ui/register/button';
|
|
304
|
+
</script>
|
|
305
|
+
<slot />
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## Step 3 — Use component
|
|
309
|
+
|
|
310
|
+
```svelte
|
|
311
|
+
<ui-button variant="primary">
|
|
312
|
+
Click Me
|
|
313
|
+
</ui-button>
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
# Usage — React / Angular / Other Frameworks
|
|
319
|
+
|
|
320
|
+
**Option 1 — Named imports (same style as Svelte)**
|
|
321
|
+
|
|
322
|
+
Register once in your app entry (e.g. `main.tsx` / `main.ts`), then use wrapper components:
|
|
323
|
+
|
|
324
|
+
**React:**
|
|
325
|
+
|
|
326
|
+
```ts
|
|
327
|
+
// main.tsx
|
|
328
|
+
import 'crayon-design-system-ui/register';
|
|
329
|
+
|
|
330
|
+
// In any component:
|
|
331
|
+
import { Button, Input } from 'crayon-design-system-ui/react';
|
|
332
|
+
|
|
333
|
+
<Button variant="primary">Click</Button>
|
|
334
|
+
<Input placeholder="Name" />
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
**Angular:**
|
|
338
|
+
|
|
339
|
+
```ts
|
|
340
|
+
// main.ts
|
|
341
|
+
import 'crayon-design-system-ui/register';
|
|
342
|
+
|
|
343
|
+
// In a module or standalone component:
|
|
344
|
+
import { CrayonDesignSystemModule } from 'crayon-design-system-ui/angular';
|
|
345
|
+
// or import { ButtonComponent } from 'crayon-design-system-ui/angular';
|
|
346
|
+
|
|
347
|
+
// Template:
|
|
348
|
+
<crayon-button variant="primary">Click</crayon-button>
|
|
349
|
+
<crayon-input placeholder="Name"></crayon-input>
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
**Option 2 — Custom elements only**
|
|
353
|
+
|
|
354
|
+
Register once, then use the custom element tags in templates/JSX:
|
|
355
|
+
|
|
356
|
+
```ts
|
|
357
|
+
import 'crayon-design-system-ui/register';
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
```html
|
|
361
|
+
<ui-button variant="primary">Click</ui-button>
|
|
362
|
+
<ui-input placeholder="Name"></ui-input>
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
# SSR-safe Registration
|
|
368
|
+
|
|
369
|
+
File:
|
|
370
|
+
|
|
371
|
+
```
|
|
372
|
+
src/register.ts
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
```
|
|
376
|
+
if (typeof window !== 'undefined' && 'customElements' in window) {
|
|
377
|
+
import('./lib/components/button/Button.svelte');
|
|
378
|
+
}
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
Prevents server-side rendering errors.
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
# package.json (important fields)
|
|
386
|
+
|
|
387
|
+
```
|
|
388
|
+
{
|
|
389
|
+
"main": "./dist-browser/bundle.js",
|
|
390
|
+
"types": "./dist/index.d.ts",
|
|
391
|
+
|
|
392
|
+
"exports": {
|
|
393
|
+
".": {
|
|
394
|
+
"types": "./dist/index.d.ts",
|
|
395
|
+
"default": "./dist-browser/bundle.js"
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
|
|
399
|
+
"files": [
|
|
400
|
+
"dist",
|
|
401
|
+
"dist-browser"
|
|
402
|
+
]
|
|
403
|
+
}
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
Ensures correct runtime entry.
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
# Development
|
|
411
|
+
|
|
412
|
+
Run dev server:
|
|
413
|
+
|
|
414
|
+
```
|
|
415
|
+
npm run dev
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Build everything:
|
|
419
|
+
|
|
420
|
+
```
|
|
421
|
+
npm run build
|
|
422
|
+
npm run build:browser
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
---
|
|
426
|
+
|
|
427
|
+
# How It Works
|
|
428
|
+
|
|
429
|
+
When imported:
|
|
430
|
+
|
|
431
|
+
```
|
|
432
|
+
import 'design-system-ui'
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
The browser bundle executes:
|
|
436
|
+
|
|
437
|
+
```
|
|
438
|
+
customElements.define('ui-button', ...)
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
Registers the component globally.
|
|
442
|
+
|
|
443
|
+
---
|
|
444
|
+
|
|
445
|
+
# Supported Environments
|
|
446
|
+
|
|
447
|
+
Works in:
|
|
448
|
+
|
|
449
|
+
- Plain HTML
|
|
450
|
+
- SvelteKit
|
|
451
|
+
- React
|
|
452
|
+
- Angular
|
|
453
|
+
- Vue
|
|
454
|
+
- Any browser-based framework
|
|
455
|
+
|
|
456
|
+
---
|
|
457
|
+
|
|
458
|
+
# Next Steps
|
|
459
|
+
|
|
460
|
+
Add more components:
|
|
461
|
+
|
|
462
|
+
- Input
|
|
463
|
+
- Card
|
|
464
|
+
- Modal
|
|
465
|
+
- Select
|
|
466
|
+
|
|
467
|
+
Optional:
|
|
468
|
+
|
|
469
|
+
- Storybook
|
|
470
|
+
- Private npm publish
|
|
471
|
+
- Design tokens
|
|
472
|
+
|
|
473
|
+
---
|
|
474
|
+
|
|
475
|
+
# Summary
|
|
476
|
+
|
|
477
|
+
This design system:
|
|
478
|
+
|
|
479
|
+
- Uses Web Components
|
|
480
|
+
- Framework independent
|
|
481
|
+
- npm installable
|
|
482
|
+
- SSR-safe
|
|
483
|
+
- Production ready foundation
|
|
484
|
+
|
|
485
|
+
---
|
|
486
|
+
|
|
487
|
+
End of README
|