@nons-dev/uikit 0.1.4 → 0.1.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nons-dev/uikit",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "license": "BUSL-1.1",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -14,9 +14,14 @@
14
14
  "registry": "https://registry.npmjs.org/",
15
15
  "access": "public"
16
16
  },
17
+ "bin": {
18
+ "nons": "scripts/cli.mjs"
19
+ },
17
20
  "files": [
18
21
  "dist",
19
- "README.md"
22
+ "generated/components.json",
23
+ "scripts/cli.mjs",
24
+ "readme.md"
20
25
  ],
21
26
  "exports": {
22
27
  ".": {
@@ -31,7 +36,7 @@
31
36
  },
32
37
  "scripts": {
33
38
  "dev": "vite",
34
- "build": "npm run generate && vue-tsc -b && vite build",
39
+ "build": "npm run generate && vue-tsc -b && vite build && node scripts/copy-fonts.mjs",
35
40
  "preview": "vite preview",
36
41
  "generate": "tsx scripts/generate.ts"
37
42
  },
package/readme.md CHANGED
@@ -5,34 +5,123 @@ Schema-driven UI component library for the Nons platform — Vue 3, TypeScript,
5
5
  ## Architecture
6
6
 
7
7
  ```
8
- core/ Schema types, component registry, schema renderer, runtime context
9
- ui/ Vue 3 components (primitives, composites, layouts, sections)
10
- design-system/ CSS custom property tokens, reset, light/dark themes
11
- playground/ Demo/explorer app for component development and testing
12
- plugins/ i18n, direction, permissions
13
- adapters/ Data provider layer (mock API, storage abstraction)
14
- locales/ Persian (fa) and English (en) translation files
15
- docs/ Component contracts, style guide, reference
8
+ nons.config.yaml Single source of truth for theme, tokens, locale, direction, font
9
+ core/ Schema types, component registry, schema renderer, runtime context
10
+ ui/ Vue 3 components (primitives, composites, layouts, sections)
11
+ generated/ Auto-generated files from nons.config.yaml (tokens.css, theme.css, config.ts, locales/)
12
+ design-system/ CSS reset, global styles (imports generated/ tokens)
13
+ playground/ Demo/explorer app for component development and testing
14
+ plugins/ i18n, direction, permissions
15
+ adapters/ Data provider layer (mock API, storage abstraction)
16
+ locales/ Persian (fa) and English (en) translation YAML files
17
+ scripts/ CLI tools (generate, init, component discovery)
16
18
  ```
17
19
 
18
20
  ## Quick Start
19
21
 
22
+ ```bash
23
+ # Install
24
+ npm install @nons-dev/uikit
25
+
26
+ # Generate config file in your project root
27
+ npx @nons-dev/uikit init
28
+
29
+ # Edit nons.config.yaml to customize theme, tokens, locale, direction, font
30
+
31
+ # Use in your app
32
+ import { bootstrapRegistry, loadConfig } from '@nons-dev/uikit'
33
+ import '@nons-dev/uikit/style.css'
34
+ ```
35
+
36
+ ### Development (UI Kit only)
37
+
20
38
  ```bash
21
39
  npm install
22
- npm run dev # Start Vite dev server
23
- npm run build # Type-check + production build (vue-tsc -b && vite build)
24
- npm run preview # Preview production build
40
+ npm run dev # Start Vite dev server (playground app)
41
+ npm run build # Generate tokens + type-check + library build
42
+ npm run generate # Regenerate CSS/theme from nons.config.yaml
43
+ npm run preview # Preview production playground build
44
+ ```
45
+
46
+ ## Config System
47
+
48
+ The `nons.config.yaml` file at your project root is the **single source of truth**:
49
+
50
+ ```yaml
51
+ theme:
52
+ preset: nons
53
+
54
+ brand:
55
+ name: Nons
56
+
57
+ direction:
58
+ default: rtl
59
+
60
+ locale:
61
+ default: fa
62
+ supported: [fa, en]
63
+
64
+ font:
65
+ fa:
66
+ family: IRANSansX
67
+ en:
68
+ family: Satoshi
69
+
70
+ tokens:
71
+ colors:
72
+ light:
73
+ --color-primary: '#9FE870'
74
+ --color-danger: '#F31260'
75
+ # ... override any CSS custom property
76
+ dark:
77
+ --color-primary: '#9FE870'
78
+ --color-danger: '#f31260'
79
+ spacing:
80
+ --space-4: 16px
81
+ # ... typography, radius, shadows, z-index, opacity, button, alert
82
+
83
+ theme-mappings:
84
+ light:
85
+ --bg-primary: var(--color-ui-window)
86
+ --text-primary: var(--color-text-default)
87
+ dark:
88
+ --bg-primary: var(--color-ui-window)
89
+ --text-primary: var(--color-text-default)
25
90
  ```
26
91
 
92
+ Run `npx @nons-dev/uikit generate` to regenerate CSS variables from your config.
93
+
27
94
  ## CLI Commands
28
95
 
29
96
  ```bash
30
- npm run ui -- components:list # List all discovered UI components
31
- npm run ui -- component:show <name> # Show full detail for a component
32
- npm run ui -- schema <name> # Show schema JSON for a component
33
- npm run ui -- components:search <q> # Search components by name/description
97
+ npx @nons-dev/uikit init # Create nons.config.yaml in project root
98
+ npx @nons-dev/uikit generate # Generate CSS from nons.config.yaml
99
+ npx @nons-dev/uikit list # List all components
100
+ npx @nons-dev/uikit show <name> # Show component details (props, events, slots)
101
+ npx @nons-dev/uikit schema <name> # Show schema JSON for a component
102
+ npx @nons-dev/uikit search <query> # Search components by name or description
103
+ ```
104
+
105
+ ## Customizing Colors & Tokens
106
+
107
+ Edit `nons.config.yaml` in your project root, then regenerate:
108
+
109
+ ```bash
110
+ npx @nons-dev/uikit generate
34
111
  ```
35
112
 
113
+ This produces `generated/tokens.css` (color schemes + all tokens) and `generated/theme.css` (semantic theme mappings). Import them in your app after the uikit CSS:
114
+
115
+ ```ts
116
+ import '@nons-dev/uikit/style.css'
117
+ import './generated/tokens.css'
118
+ import './generated/theme.css'
119
+ ```
120
+
121
+ The generated CSS uses `:root` / `[data-theme="dark"]` blocks — your custom values override the defaults with the same specificity.
122
+
123
+ All visual values in the uikit reference CSS custom properties (`var(--color-primary)`), so changing a token in YAML propagates to every component.
124
+
36
125
  ## Documentation
37
126
 
38
127
  | Resource | Description |
@@ -43,8 +132,9 @@ npm run ui -- components:search <q> # Search components by name/description
43
132
  ## Key Conventions
44
133
 
45
134
  - **Zero-hardcoding** — all visual values via CSS custom properties (`var(--...)`)
135
+ - **Config-driven** — theme, tokens, direction, locale all from `nons.config.yaml`
46
136
  - **RTL-first** — `<html dir="rtl">`, logical properties (`inset-inline-start`, `margin-inline`)
47
- - **Schema-driven** — every component has a registry key, contract, and schema example
137
+ - **Schema-driven** — every component has a registry key, contract, schema example, and auto-generated metadata (53 components parsed from source)
48
138
  - **modelValue** — all form inputs use `modelValue` prop + `update:modelValue` emit
49
139
  - **No external margins** — component spacing via parent layout `gap`
50
140
  - **Flat UI** — no elevation shadows; separation via themed borders (`--border-primary`)
@@ -56,3 +146,4 @@ npm run ui -- components:search <q> # Search components by name/description
56
146
  - `@lucide/vue` icons
57
147
  - Tabler Icons (CDN)
58
148
  - Plain CSS only (no SCSS/Sass)
149
+ - Font files bundled in `dist/font/` (IRANSansX, Satoshi) — loaded via `@font-face` in generated CSS