silva-ui 1.0.0 → 1.0.2

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Blacksilva
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Blacksilva
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # silva-ui Component Library
2
2
 
3
+ [![Publish to npm](https://github.com/black-silva/silva-ui/actions/workflows/publish-npm.yml/badge.svg)](https://github.com/black-silva/silva-ui/actions/workflows/publish-npm.yml)
4
+
3
5
  [![Bundle size](https://badgen.net/bundlephobia/min/silva-ui)](https://bundlephobia.com/package/silva-ui)
4
6
  [![Minified + gzipped size](https://badgen.net/bundlephobia/minzip/silva-ui)](https://bundlephobia.com/package/silva-ui)
5
7
  [![TypeScript](https://badgen.net/badge/built%20with/TypeScript/blue)](https://www.typescriptlang.org/)
@@ -7,6 +9,9 @@
7
9
 
8
10
  A Hono JSX UI component library with framework-neutral styling and Tamagui-inspired theming, built on `@vanilla-extract/css` and `@vanilla-extract/sprinkles`.
9
11
 
12
+ Contributions are welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md) for
13
+ development setup, validation commands, and pull request expectations.
14
+
10
15
  ---
11
16
 
12
17
  ## Component Inventory
@@ -63,24 +68,13 @@ A Hono JSX UI component library with framework-neutral styling and Tamagui-inspi
63
68
  - [`ContextMenu`](./src/overlays/ContextMenu.tsx) family — Fixed positioning at coordinates via CSS custom properties
64
69
  - [`Accordion`](./src/overlays/Accordion.tsx) family (`Item`, `Trigger` with rotating chevron, `Content`)
65
70
 
66
- ## Profiling the library
67
-
68
- The library can be profiled without including the documentation example app:
69
-
70
- ```bash
71
- npm run profile:library
72
- ```
73
-
74
- This builds from `src/index.ts` using `vite.library.config.ts`, excludes the
75
- `example/` entry point, writes the library output to `dist/library`, and
76
- generates `vite-profile-0.cpuprofile`. Open the `.cpuprofile` file in Chrome
77
- DevTools under **Performance** to inspect build-time CPU usage.
78
71
 
79
72
  ---
80
73
 
81
74
  ## Quick Example in Hono JSX
82
75
 
83
76
  ```tsx
77
+ import 'silva-ui/style.css';
84
78
  import {
85
79
  YStack,
86
80
  XStack,
@@ -128,6 +122,9 @@ export function SignupCard() {
128
122
  }
129
123
  ```
130
124
 
125
+ The published package includes prebuilt CSS. Import `silva-ui/style.css` once
126
+ from your application entry point.
127
+
131
128
  ## Colors and themes
132
129
 
133
130
  Theme styling is generated at build time with Vanilla Extract. `Theme` scopes the
@@ -176,8 +173,7 @@ variables are emitted at build time.
176
173
  `themeColors.background` or `themeColors.blue6`; Vanilla Extract can then keep
177
174
  the variable names consistent through production builds.
178
175
 
179
- Silva UI follows Tamagui's palette/template model while remaining framework
180
- agnostic. The exported `createThemes` helper composes named palettes and
176
+ Silva UI follows Tamagui's palette/template model. The exported `createThemes` helper composes named palettes and
181
177
  templates into theme records, and built-in themes include generated surface
182
178
  variants such as `dark_surface1` and `light_surface2`:
183
179
 
@@ -211,17 +207,3 @@ to that `Theme` subtree. Built-in names such as `dark`, `emerald`, and
211
207
  `midnight` continue to use their precompiled theme classes. Supported palette
212
208
  names are the exported color scales, including `red`, `blue`, `green`,
213
209
  `purple`, and the other Radix scales.
214
-
215
- Theme values are extracted into CSS classes at build time. For framework-neutral
216
- runtime tooling, `addTheme`, `updateTheme`, `replaceTheme`, `getTheme`, and
217
- `getThemes` provide an in-memory theme registry; applications can use the
218
- returned records with their own CSS or rendering integration.
219
-
220
- ## Interactive documentation
221
-
222
- The `example` app is the interactive component documentation. Start it with
223
- `npm run dev`, then use the sidebar or home page to browse live examples for
224
- each exported component, color tokens, and themes. The theme selector in the
225
- header lets you preview the documentation in every built-in theme. The
226
- installation and project setup walkthrough is available from its **Get started**
227
- page in the documentation sidebar.
@@ -0,0 +1,51 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
5
+ <title>Silva UI live previews</title>
6
+ <style>
7
+ :root{--bg:#f8fafc;--card:#fff;--text:#172033;--muted:#64748b;--line:#dbe4ee;--primary:#0f766e;--primary-ink:#fff;--danger:#b42318;--shadow:0 8px 22px rgba(15,23,42,.07)}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font:14px/1.45 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}.shell{min-height:100vh;padding:20px}.demo{max-width:760px;margin:auto;background:var(--card);border:1px solid var(--line);border-radius:16px;padding:22px;box-shadow:var(--shadow)}h1,h2,h3,p{margin:0}h2{font-size:18px}h3{font-size:16px}.muted{color:var(--muted)}.small{font-size:12px}.stack{display:grid;gap:14px}.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.between{justify-content:space-between}.panel{padding:16px;border:1px solid var(--line);border-radius:12px;background:#fff}.subtle{background:#f1f5f9}.button{border:1px solid var(--primary);background:var(--primary);color:var(--primary-ink);border-radius:9px;padding:8px 12px;font:inherit;font-weight:650;cursor:pointer}.button.outline{background:#fff;color:var(--primary)}.button.ghost{background:transparent;color:var(--primary);border-color:transparent}.field{display:grid;gap:6px;font-weight:600}.input,textarea,select{font:inherit;color:var(--text);width:100%;border:1px solid #b9c7d6;border-radius:8px;padding:9px;background:#fff}textarea{min-height:76px;resize:vertical}.checkbox,.radio{display:flex;gap:8px;align-items:center;font-weight:400}.progress{height:9px;overflow:hidden;background:#e2e8f0;border-radius:999px}.progress span{display:block;height:100%;width:56%;background:var(--primary);border-radius:inherit}.avatar{display:grid;place-items:center;width:52px;height:52px;border-radius:50%;background:#cbd5e1;color:#334155;font-weight:700}.avatar.photo{background:linear-gradient(135deg,#f59e0b,#e879f9,#22c55e);color:#fff}.list{border:1px solid var(--line);border-radius:10px;overflow:hidden}.list .item{padding:12px;display:flex;gap:10px;align-items:center;border-bottom:1px solid var(--line)}.list .item:last-child{border:0}.dot{width:9px;height:9px;border-radius:50%;background:#22c55e}.spinner{width:28px;height:28px;border:3px solid #cbd5e1;border-top-color:var(--primary);border-radius:50%;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(1turn)}}.loader{height:5px;background:#dbeafe;border-radius:99px;overflow:hidden}.loader:after{content:"";display:block;width:42%;height:100%;background:var(--primary);animation:slide 1.2s ease-in-out infinite}@keyframes slide{0%{transform:translateX(-110%)}100%{transform:translateX(340%)}}.tabs{display:flex;gap:4px;border-bottom:1px solid var(--line)}.tab{border:0;background:transparent;padding:9px 10px;color:var(--muted);cursor:pointer}.tab.active{color:var(--primary);border-bottom:2px solid var(--primary);font-weight:700}.tabpanel{padding-top:14px}.dialog-backdrop{background:rgba(15,23,42,.08);border-radius:10px;padding:18px}.dialog{max-width:420px;margin:auto;padding:18px;background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow)}.xgroup{display:inline-flex}.xgroup .button{border-radius:0}.xgroup .button:first-child{border-radius:9px 0 0 9px}.xgroup .button:last-child{border-radius:0 9px 9px 0}.sep{height:1px;background:var(--line);border:0;width:100%}.theme{background:#12201f;color:#e5fffb;border-color:#275750}.theme .panel{background:#1d302f;color:#e5fffb;border-color:#3a615d}.theme .muted{color:#a4c5c1}.toast{border-left:4px solid #22c55e}.notice{padding:10px 12px;border-radius:9px;background:#ecfdf5;color:#065f46}.swatches{display:flex;gap:8px}.swatch{padding:15px 10px;border-radius:8px;color:#fff;font-size:12px;font-weight:700}.a{background:#0f766e}.b{background:#14b8a6}.c{background:#0f172a}.server{background:#0f172a;color:#d1fae5;border-radius:10px;padding:14px;font:12px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace}.server b{color:#5eead4}@media(max-width:440px){.shell{padding:10px}.demo{padding:15px}}
8
+ </style></head>
9
+ <body><main class="shell"><section class="demo" id="app"></section></main>
10
+ <script>
11
+ const example = location.hash.slice(1) || new URLSearchParams(location.search).get('example') || 'default';
12
+ const app = document.querySelector('#app');
13
+ const button=(label,kind='')=>`<button class="button ${kind}" type="button">${label}</button>`;
14
+ const card=(content,extra='')=>`<div class="panel ${extra}">${content}</div>`;
15
+ const title=(name,sub='Interactive visual result')=>`<div class="stack"><div><h2>${name}</h2><p class="muted small">${sub}</p></div>`;
16
+ const end='</div>';
17
+ const previews={
18
+ 'display-1':()=>title('Card')+card(`<div class="stack"><div class="row between"><div><h3>Storage</h3><p class="muted">18 GB of 50 GB used</p></div></div><div class="progress"><span style="width:36%"></span></div><div>${button('Manage storage','outline')}</div></div>`)+end,
19
+ 'display-2':()=>title('Avatar and image')+`<div class="row"><div class="avatar photo">BS</div><div class="stack"><div class="panel subtle" style="width:210px;height:80px;display:grid;place-items:center;color:#475569">Product banner</div><p class="muted small">Image with fallback avatar</p></div></div>`+end,
20
+ 'display-3':()=>title('List item')+`<div class="list"><div class="item"><div class="avatar" style="width:32px;height:32px">BS</div><div><b>BlackSilva</b><div class="muted small">Owner</div></div></div></div>`+end,
21
+ 'display-4':()=>title('Loading states')+`<div class="row"><div class="spinner"></div><div class="stack" style="flex:1"><span class="muted small">Saving your changes</span><div class="loader"></div></div></div>`+end,
22
+ 'forms-1':()=>title('Subscribe form')+`<form class="stack" onsubmit="event.preventDefault();this.querySelector('.notice').hidden=false"><label class="field">Email address<input class="input" type="email" placeholder="you@example.com" required></label><p class="muted small">We will only send product updates.</p>${button('Subscribe')}<p class="notice" hidden>Subscribed locally for this preview.</p></form>`+end,
23
+ 'forms-2':()=>title('Message field')+`<label class="field">Message<textarea placeholder="Tell us what you need."></textarea></label>`+end,
24
+ 'forms-3':()=>title('Choice controls')+`<div class="stack"><label class="checkbox"><input type="checkbox"> I agree to the terms</label><label class="checkbox"><input type="checkbox" checked> Enable alerts</label><div class="row"><label class="radio"><input type="radio" name="plan"> Starter</label><label class="radio"><input type="radio" name="plan" checked> Pro</label></div><div class="progress"><span style="width:72%"></span></div></div>`+end,
25
+ 'forms-4':()=>title('Button variants')+`<div class="row">${button('Save changes')}${button('Preview','outline')}${button('Cancel','ghost')}</div>`+end,
26
+ 'overlay-1':()=>title('Dialog')+`<div class="dialog-backdrop"><div class="dialog stack"><div><h3>Delete project?</h3><p class="muted">This cannot be undone.</p></div><div class="row" style="justify-content:flex-end">${button('Cancel','outline')}${button('Delete')}</div></div></div>`+end,
27
+ 'overlay-2':()=>title('Tabs')+`<div class="tabs"><button class="tab active">Profile</button><button class="tab">Security</button></div><div class="tabpanel">Profile content</div>`+end,
28
+ 'layout-1':()=>title('Box')+card('Content','subtle')+end,
29
+ 'layout-2':()=>title('Stack layout')+card(`<div class="stack"><h3>Account settings</h3><div class="row between"><span>Email alerts</span><label><input type="checkbox" checked aria-label="Email alerts"></label></div></div>`)+end,
30
+ 'layout-3':()=>title('XGroup')+`<div class="xgroup">${button('Day','outline')}${button('Week','outline')}${button('Month','outline')}</div>`+end,
31
+ 'layout-4':()=>title('Separator')+`<div class="stack"><span>Content above</span><hr class="sep"><span>Content below</span></div>`+end,
32
+ 'sprinkles-1':()=>title('Sprinkles surface')+card(`<h3>Build once, compose anywhere</h3><p class="muted">Spacing, colour and border-radius tokens are applied together.</p>`)+end,
33
+ 'sprinkles-2':()=>title('Responsive layout')+`<div class="row"><div class="panel subtle" style="flex:1">Main content</div><div class="panel" style="flex:1">Sidebar</div></div>`+end,
34
+ 'typography-1':()=>title('Text styles')+`<div class="stack"><strong>Strong emphasis</strong><p class="muted">Supporting copy</p></div>`+end,
35
+ 'typography-2':()=>title('Headings')+`<div class="stack"><h1 style="font-size:26px">Build faster</h1><h3>A short, readable description.</h3><p class="muted">Clear hierarchy without custom CSS.</p></div>`+end,
36
+ 'typography-3':()=>title('Paragraph')+`<p class="muted">A readable paragraph with semantic colour and comfortable line height.</p>`+end,
37
+ 'intro-1':()=>title('Quick start')+card(`<div class="stack"><h3>Welcome to Silva UI</h3><p class="muted">Theme-aware components ready for composition.</p>${button('Get started')}</div>`)+end,
38
+ 'install-1':()=>title('Style import','Bundled stylesheet ready')+`<div class="server"><b>✓</b> Silva UI styles loaded successfully</div>`+end,
39
+ 'install-2':()=>title('Hono JSX app','Server-rendered component output')+`<div class="server"><b>GET /</b> 200 OK<br>&lt;main&gt;Silva UI is ready.&lt;/main&gt;</div>`+end,
40
+ 'recipes-1':()=>title('Settings row')+card(`<div class="row between"><div><b>Email notifications</b><div class="muted small">Receive a summary of account activity.</div></div><input type="checkbox" checked aria-label="Email notifications"></div>`)+end,
41
+ 'recipes-2':()=>title('Empty state')+card(`<div class="stack" style="text-align:center;justify-items:center"><h3>No projects yet</h3><p class="muted">Create your first project to get started.</p>${button('Create project')}</div>`)+end,
42
+ 'recipes-3':()=>title('Toast')+`<div class="panel toast"><b>Changes saved</b><div class="muted">Your profile is up to date.</div></div>`+end,
43
+ 'recipes-4':()=>title('Theme preview')+`<div class="row"><div class="panel">light</div><div class="panel theme">dark</div><div class="panel" style="border-color:#14b8a6;color:#0f766e">emerald</div></div>`+end,
44
+ 'theming-1':()=>title('Built-in dark theme')+card(`<p>Semantic tokens follow the active theme.</p>`,'theme')+end,
45
+ 'theming-2':()=>title('Nested theme scopes')+card(`<div class="panel" style="background:#0f766e;color:#fff;border:0">This nested section uses emerald tokens.</div>`,'theme')+end,
46
+ 'theming-3':()=>title('Custom theme definition')+`<div class="swatches"><div class="swatch a">primary</div><div class="swatch b">accent</div><div class="swatch c">surface</div></div>`+end,
47
+ 'default':()=>title('Silva UI example')+card(`<div class="stack"><h3>Live component preview</h3><p class="muted">This is the rendered visual result of the example.</p>${button('Try action')}</div>`)+end
48
+ };
49
+ app.innerHTML=(previews[example]||previews.default)();
50
+ app.addEventListener('click',(event)=>{const tab=event.target.closest('.tab');if(tab){tab.parentElement.querySelectorAll('.tab').forEach(x=>x.classList.remove('active'));tab.classList.add('active');document.querySelector('.tabpanel').textContent=tab.textContent+' content';}});
51
+ </script></body></html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "silva-ui",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "A Hono JSX UI component library with framework-neutral styling and Tamagui-inspired theming.",
5
5
  "main": "./dist/library/silva-ui.js",
6
6
  "module": "./dist/library/silva-ui.js",
@@ -31,9 +31,22 @@
31
31
  "preview": "vite preview",
32
32
  "typecheck": "tsc --noEmit"
33
33
  },
34
- "keywords": [],
35
- "author": "",
36
- "license": "ISC",
34
+ "keywords": [
35
+ "ui",
36
+ "ui-components",
37
+ "component-library",
38
+ "design-system",
39
+ "hono",
40
+ "hono-jsx",
41
+ "jsx",
42
+ "typescript",
43
+ "vanilla-extract",
44
+ "sprinkles",
45
+ "theming",
46
+ "accessible"
47
+ ],
48
+ "author": "BlackSilva",
49
+ "license": "MIT",
37
50
  "type": "module",
38
51
  "peerDependencies": {
39
52
  "hono": "^4.13.13"
@@ -45,5 +58,9 @@
45
58
  "hono": "^4.13.13",
46
59
  "typescript": "^7.0.2",
47
60
  "vite": "^8.3.4"
61
+ },
62
+ "repository": {
63
+ "type": "git",
64
+ "url": "git+https://github.com/black-silva/silva-ui.git"
48
65
  }
49
66
  }