@noahbaumgartner/svelte-ui 0.0.1 → 0.0.4

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 (2) hide show
  1. package/README.md +69 -38
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,65 +1,96 @@
1
- # Svelte library
1
+ # svelte-ui
2
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!
3
+ A minimal, monochrome component library for Svelte 5, built with runes, TypeScript and plain CSS custom properties.
10
4
 
11
5
  ```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
6
+ npm install @noahbaumgartner/svelte-ui
17
7
  ```
18
8
 
19
- To recreate this project with the same configuration:
9
+ ## Usage
20
10
 
21
- ```sh
22
- # recreate this project
23
- npx sv@0.17.1 create --template library --types ts --add storybook vitest="usages:unit,component" eslint prettier --install npm svelte-ui
24
- ```
11
+ Import the design tokens once, at the root of your app (e.g. `src/routes/+layout.svelte`):
25
12
 
26
- ## Developing
13
+ ```svelte
14
+ <script lang="ts">
15
+ import '@noahbaumgartner/svelte-ui/tokens.css';
27
16
 
28
- Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
17
+ let { children } = $props();
18
+ </script>
29
19
 
30
- ```sh
31
- npm run dev
20
+ {@render children()}
21
+ ```
32
22
 
33
- # or start the server and open the app in a new browser tab
34
- npm run dev -- --open
23
+ Then use the components:
24
+
25
+ ```svelte
26
+ <script lang="ts">
27
+ import { Button, Card, CardHeader, CardTitle, CardContent } from '@noahbaumgartner/svelte-ui';
28
+ import { Plus } from '@noahbaumgartner/svelte-ui/icons';
29
+ </script>
30
+
31
+ <Card>
32
+ <CardHeader>
33
+ <CardTitle>Projects</CardTitle>
34
+ </CardHeader>
35
+ <CardContent>
36
+ <Button icon={Plus} variant="primary">New project</Button>
37
+ </CardContent>
38
+ </Card>
35
39
  ```
36
40
 
37
- Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
41
+ ### Icons
38
42
 
39
- ## Building
43
+ [Lucide](https://lucide.dev) icons are re-exported from `@noahbaumgartner/svelte-ui/icons`, so you don't need a separate `@lucide/svelte` install. They live on their own entry point because some icon names (`Link`, `Image`, …) collide with component names.
40
44
 
41
- To build your library:
45
+ ### Theming
42
46
 
43
- ```sh
44
- npm pack
47
+ All colours are derived from two variables, `--base` and `--ink`, mixed into a grey scale. Light and dark mode follow `prefers-color-scheme` by default; force one with a `data-theme` attribute on `<html>`:
48
+
49
+ ```html
50
+ <html data-theme="dark"></html>
45
51
  ```
46
52
 
47
- To create a production version of your showcase app:
53
+ Set `--accent` to colour checked controls, primary buttons and focus rings. It defaults to `--ink`, and the foreground colour on top of it is picked automatically for contrast:
48
54
 
49
- ```sh
50
- npm run build
55
+ ```css
56
+ :root {
57
+ --accent: #2563eb;
58
+ }
51
59
  ```
52
60
 
53
- You can preview the production build with `npm run preview`.
61
+ See [`src/lib/styles/tokens.css`](src/lib/styles/tokens.css) for every token.
54
62
 
55
- > To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
63
+ ## Components
56
64
 
57
- ## Publishing
65
+ | Category | Components |
66
+ | ---------- | ---------------------------------------------------------------------------------------------- |
67
+ | Actions | `Button`, `ButtonGroup`, `Toggle`, `Link` |
68
+ | Forms | `Input`, `InputGroup`, `Textarea`, `Checkbox`, `RadioGroup`, `Switch`, `Label`, `Field` family |
69
+ | Pickers | `Calendar`, `TimePicker`, `ColorPicker` |
70
+ | Overlays | `Dialog`, `AlertDialog`, `Popover`, `Tooltip`, `ContextMenu`, `Toaster` + `toast()` |
71
+ | Navigation | `Navbar`, `NavigationMenu`, `Sidebar` family, `Breadcrumb` |
72
+ | Display | `Card` family, `Table`, `Avatar`, `Badge`, `Kbd`, `Separator`, `Skeleton`, `Spinner` |
58
73
 
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/)).
74
+ Every component is documented in Storybook, with one story per prop.
60
75
 
61
- To publish your library to [npm](https://www.npmjs.com):
76
+ ## Development
62
77
 
63
78
  ```sh
64
- npm publish
79
+ npm install
80
+ npm run storybook # component workbench on http://localhost:6006
65
81
  ```
82
+
83
+ | Script | Description |
84
+ | ------------------- | ------------------------------------------------ |
85
+ | `npm run storybook` | Start Storybook |
86
+ | `npm run check` | Type-check with `svelte-check` |
87
+ | `npm run test` | Run unit and Storybook tests with Vitest |
88
+ | `npm run lint` | Check formatting (Prettier) and lint (ESLint) |
89
+ | `npm run format` | Format all files |
90
+ | `npm run build` | Build the package into `dist/` and run `publint` |
91
+
92
+ Components live in `src/lib/components/<name>/`, each next to its `.stories.svelte` file, and are exported from [`src/lib/index.ts`](src/lib/index.ts).
93
+
94
+ ## Releasing
95
+
96
+ Publishing a GitHub release triggers [`.github/workflows/publish.yml`](.github/workflows/publish.yml), which sets the package version from the release tag (e.g. `v0.2.0` → `0.2.0`), type-checks, and stages the publish on npm with provenance. The staged version then has to be approved with 2FA (`npm stage approve <stage-id>` or on npmjs.com).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noahbaumgartner/svelte-ui",
3
- "version": "0.0.1",
3
+ "version": "0.0.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/noahbaumgartner/svelte-ui.git"
@@ -85,4 +85,4 @@
85
85
  "dependencies": {
86
86
  "@lucide/svelte": "^1.47.0"
87
87
  }
88
- }
88
+ }