@nqlib/nqui 0.4.3 → 0.4.5

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 (156) hide show
  1. package/INSTALLATION.md +234 -0
  2. package/README.md +109 -151
  3. package/dist/button-CJHdCq9I.js +155 -0
  4. package/dist/button-R304rhsj.cjs +1 -0
  5. package/dist/calendar.cjs.js +1 -1
  6. package/dist/calendar.es.js +1 -1
  7. package/dist/carousel-D1FMVglR.cjs +1 -0
  8. package/dist/carousel-U7RZhYZj.js +179 -0
  9. package/dist/carousel.cjs.js +1 -1
  10. package/dist/carousel.es.js +1 -1
  11. package/dist/command-palette-DCtLpM3Q.js +694 -0
  12. package/dist/command-palette-MHc03bBf.cjs +5 -0
  13. package/dist/command.cjs.js +1 -1
  14. package/dist/command.es.js +1 -1
  15. package/dist/components/custom/color-picker.d.ts +1 -1
  16. package/dist/components/custom/color-picker.d.ts.map +1 -1
  17. package/dist/components/custom/color-slider.d.ts +4 -10
  18. package/dist/components/custom/color-slider.d.ts.map +1 -1
  19. package/dist/components/custom/enhanced-radio-group.d.ts +13 -4
  20. package/dist/components/custom/enhanced-radio-group.d.ts.map +1 -1
  21. package/dist/components/custom/enhanced-tabs.d.ts.map +1 -1
  22. package/dist/components/debug/debug-features.d.ts +29 -0
  23. package/dist/components/debug/debug-features.d.ts.map +1 -0
  24. package/dist/components/debug/debug-panel.d.ts.map +1 -1
  25. package/dist/components/error-boundary.d.ts +20 -0
  26. package/dist/components/error-boundary.d.ts.map +1 -0
  27. package/dist/components/index.d.ts +103 -0
  28. package/dist/components/index.d.ts.map +1 -0
  29. package/dist/components/ui/badge.d.ts +16 -5
  30. package/dist/components/ui/badge.d.ts.map +1 -1
  31. package/dist/components/ui/button.d.ts +38 -4
  32. package/dist/components/ui/button.d.ts.map +1 -1
  33. package/dist/components/ui/checkbox.d.ts +16 -2
  34. package/dist/components/ui/checkbox.d.ts.map +1 -1
  35. package/dist/components/ui/combobox.d.ts +2 -1
  36. package/dist/components/ui/combobox.d.ts.map +1 -1
  37. package/dist/components/ui/frosted-glass.d.ts.map +1 -1
  38. package/dist/components/ui/input-group.d.ts +1 -1
  39. package/dist/components/ui/input-group.d.ts.map +1 -1
  40. package/dist/components/ui/pagination.d.ts +3 -2
  41. package/dist/components/ui/pagination.d.ts.map +1 -1
  42. package/dist/components/ui/radio-group.d.ts +3 -1
  43. package/dist/components/ui/radio-group.d.ts.map +1 -1
  44. package/dist/components/ui/select.d.ts +6 -1
  45. package/dist/components/ui/select.d.ts.map +1 -1
  46. package/dist/components/ui/sidebar.d.ts +1 -1
  47. package/dist/components/ui/sidebar.d.ts.map +1 -1
  48. package/dist/components/ui/slider.d.ts +10 -2
  49. package/dist/components/ui/slider.d.ts.map +1 -1
  50. package/dist/components/ui/sonner.d.ts +18 -2
  51. package/dist/components/ui/sonner.d.ts.map +1 -1
  52. package/dist/components/ui/spinner.d.ts +2 -1
  53. package/dist/components/ui/spinner.d.ts.map +1 -1
  54. package/dist/components/ui/switch.d.ts +15 -2
  55. package/dist/components/ui/switch.d.ts.map +1 -1
  56. package/dist/components/ui/tabs.d.ts +1 -1
  57. package/dist/components/ui/tabs.d.ts.map +1 -1
  58. package/dist/components/ui/toggle.d.ts +1 -1
  59. package/dist/components/ui/toggle.d.ts.map +1 -1
  60. package/dist/debug-panel-CNKk-No5.cjs +75 -0
  61. package/dist/debug-panel-pg39-6xw.js +9011 -0
  62. package/dist/debug.cjs.js +1 -0
  63. package/dist/debug.es.js +7 -0
  64. package/dist/{drawer-CU4lkcz7.js → drawer-DO26uhym.js} +31 -31
  65. package/dist/drawer-DVarEy65.cjs +1 -0
  66. package/dist/drawer.cjs.js +1 -1
  67. package/dist/drawer.es.js +1 -1
  68. package/dist/{enhanced-calendar-BENbxw7_.js → enhanced-calendar-BGlsSYJd.js} +1 -1
  69. package/dist/{enhanced-calendar-5PA8CeF7.cjs → enhanced-calendar-C7EQIr6i.cjs} +1 -1
  70. package/dist/entries/debug.d.ts +14 -0
  71. package/dist/entries/debug.d.ts.map +1 -0
  72. package/dist/entries/sonner.d.ts +1 -2
  73. package/dist/entries/sonner.d.ts.map +1 -1
  74. package/dist/hooks/use-mobile.d.ts.map +1 -1
  75. package/dist/hooks/use-scroll-spy.d.ts.map +1 -1
  76. package/dist/index-CI756mSv.cjs +41 -0
  77. package/dist/index-CgfzsUO6.js +1069 -0
  78. package/dist/index.d.ts +2 -98
  79. package/dist/index.d.ts.map +1 -1
  80. package/dist/lib/index.d.ts +9 -0
  81. package/dist/lib/index.d.ts.map +1 -0
  82. package/dist/lib/wrap-inline-label-text.d.ts +7 -0
  83. package/dist/lib/wrap-inline-label-text.d.ts.map +1 -0
  84. package/dist/nqui.cjs.js +49 -245
  85. package/dist/nqui.es.js +7402 -16735
  86. package/dist/sonner-CpmECDBk.js +179 -0
  87. package/dist/sonner-nE9hIalJ.cjs +48 -0
  88. package/dist/sonner.cjs.js +1 -1
  89. package/dist/sonner.es.js +3 -2
  90. package/dist/styles.css +237 -10
  91. package/docs/components/README.md +109 -10
  92. package/docs/components/nqui-badge.md +1 -0
  93. package/docs/components/nqui-button.md +3 -1
  94. package/docs/components/nqui-card.md +8 -0
  95. package/docs/components/nqui-carousel.md +6 -0
  96. package/docs/components/nqui-checkbox.md +38 -1
  97. package/docs/components/nqui-color-slider.md +5 -3
  98. package/docs/components/nqui-combobox.md +58 -37
  99. package/docs/components/nqui-drawer.md +1 -1
  100. package/docs/components/nqui-frosted-glass.md +83 -5
  101. package/docs/components/nqui-radio-group.md +47 -2
  102. package/docs/components/nqui-scroll-area.md +1 -1
  103. package/docs/components/nqui-select.md +2 -2
  104. package/docs/components/nqui-sheet.md +1 -1
  105. package/docs/components/nqui-slider.md +13 -0
  106. package/docs/components/nqui-spinner.md +6 -1
  107. package/docs/components/nqui-switch.md +23 -1
  108. package/docs/components/nqui-tabs.md +11 -1
  109. package/docs/components/nqui-toaster.md +5 -1
  110. package/docs/internal-notes/PUBLISHING.md +46 -4
  111. package/docs/nqui-skills/SKILL.md +106 -0
  112. package/docs/nqui-skills/design-system.md +143 -0
  113. package/docs/nqui-skills/rules/composition.md +183 -0
  114. package/docs/nqui-skills/rules/forms.md +190 -0
  115. package/docs/nqui-skills/rules/icons.md +158 -0
  116. package/docs/nqui-skills/rules/styling.md +192 -0
  117. package/package.json +23 -12
  118. package/scripts/build-styles.js +16 -0
  119. package/scripts/cli.js +1 -0
  120. package/scripts/download-skills.js +91 -0
  121. package/scripts/examples/nextjs-layout-sidebar.tsx +100 -0
  122. package/scripts/examples/nextjs-page-sidebar.tsx +81 -0
  123. package/scripts/examples/vite-app.tsx +135 -0
  124. package/scripts/examples/vite-main.tsx +17 -0
  125. package/scripts/examples.js +92 -6
  126. package/scripts/generate-docs.js +169 -0
  127. package/scripts/init-css.js +34 -14
  128. package/scripts/init-cursor.js +8 -0
  129. package/scripts/init-debug-css.js +4 -2
  130. package/scripts/post-install.js +41 -9
  131. package/scripts/publish-npmjs.js +17 -3
  132. package/scripts/resolve-target-dir.js +20 -1
  133. package/scripts/setup-helper.js +13 -1
  134. package/scripts/verify-build.js +1 -1
  135. package/scripts/wizard.js +12 -7
  136. package/dist/button-CYFTFDKe.cjs +0 -1
  137. package/dist/button-nJvDl3w8.js +0 -44
  138. package/dist/carousel-DEyyJi49.js +0 -179
  139. package/dist/carousel-Dhhz8m5V.cjs +0 -1
  140. package/dist/command-palette-UHk8zZOg.cjs +0 -45
  141. package/dist/command-palette-d-TrdBsM.js +0 -1778
  142. package/dist/components/custom/enhanced-badge.d.ts +0 -33
  143. package/dist/components/custom/enhanced-badge.d.ts.map +0 -1
  144. package/dist/components/custom/enhanced-button.d.ts +0 -34
  145. package/dist/components/custom/enhanced-button.d.ts.map +0 -1
  146. package/dist/components/custom/enhanced-checkbox.d.ts +0 -28
  147. package/dist/components/custom/enhanced-checkbox.d.ts.map +0 -1
  148. package/dist/components/custom/enhanced-combobox.d.ts +0 -35
  149. package/dist/components/custom/enhanced-combobox.d.ts.map +0 -1
  150. package/dist/components/custom/enhanced-select.d.ts +0 -30
  151. package/dist/components/custom/enhanced-select.d.ts.map +0 -1
  152. package/dist/components/custom/enhanced-sonner.d.ts +0 -16
  153. package/dist/components/custom/enhanced-sonner.d.ts.map +0 -1
  154. package/dist/drawer-BcIxWRN8.cjs +0 -1
  155. package/dist/sonner-Co6YpYVs.js +0 -546
  156. package/dist/sonner-DbQhVp8m.cjs +0 -330
@@ -0,0 +1,234 @@
1
+ # nqui – Installation & CLI reference
2
+
3
+ Developer guide: what runs on install, available commands, and the recommended setup sequence.
4
+
5
+ ---
6
+
7
+ ## What runs on `npm install`
8
+
9
+ When you add `@nqlib/nqui` to a project and run `npm install` (or pnpm/yarn/bun):
10
+
11
+ 1. **Postinstall script** runs: `node scripts/post-install.js` (same as `npx @nqlib/nqui setup`).
12
+ 2. **Behavior:**
13
+ - If your project has a `package.json` and no `nqui:init` script, a **`nqui:init`** script is added to run the full setup in one command.
14
+ - **Cursor rules** are written into your project’s `.cursor/` directory:
15
+ - `.cursor/rules/nqui-components.mdc`
16
+ - `.cursor/skills/nqui-install/`
17
+ - `.cursor/skills/nqui-components/`
18
+ - A **next-steps message** is printed (run `npx nqui-setup` anytime to see it again).
19
+ 3. **Not done on install:** Peer packages are not installed, `.cursor/nqui-skills/` is not created, and CSS is not set up. Run the full setup (see below) for that.
20
+ 4. **CI:** Postinstall is skipped when `CI=true` or `CI=1`.
21
+
22
+ ---
23
+
24
+ ## CLI commands
25
+
26
+ All commands are run from your **project root** (where `package.json` lives).
27
+
28
+ | Command | Description |
29
+ |--------|-------------|
30
+ | `npx @nqlib/nqui setup` | Re-run postinstall: print next steps and write Cursor rules (no peers/skills/CSS). Same as `npx nqui-setup`. |
31
+ | `npx @nqlib/nqui install-peers` | Install `@nqlib/nqui` and all required + optional peer dependencies (icons, cmdk, dnd-kit, etc.). |
32
+ | `npx @nqlib/nqui init-cursor` | Write `.cursor/rules` and `.cursor/skills`, and **download nqui-skills** (copy `docs/nqui-skills` → `.cursor/nqui-skills`, create `AGENTS.md`). |
33
+ | `npx @nqlib/nqui init-skills` | Only download skills: copy to `.cursor/nqui-skills`, (re)create `AGENTS.md`. Use `--force` to overwrite. |
34
+ | `npx @nqlib/nqui init-css` | Detect framework, create `nqui/index.css` and `nqui/nqui-setup.css`, optionally copy example layouts. Options: `--sidebar`, `--force`, `--wizard`. |
35
+ | `npx @nqlib/nqui` _(no args)_ | Runs **init-css** with default output `nqui/index.css`. |
36
+ | `npx @nqlib/nqui init-debug` / `init-debug-css` | Initialize debug CSS for `DebugPanel`. |
37
+ | `npm run nqui:init` | One-shot full setup (only after install added the script): install-peers → init-cursor → init-skills → init-css --sidebar --force. |
38
+
39
+ **Monorepos:** Cursor rules and skills are written to the package that has `@nqlib/nqui` in `node_modules` or in its `package.json`. Open that package folder in Cursor for skills to resolve.
40
+
41
+ ---
42
+
43
+ ## Recommended sequence
44
+
45
+ ### Option A: One command (after install)
46
+
47
+ If postinstall added the script:
48
+
49
+ ```bash
50
+ npm run nqui:init
51
+ ```
52
+
53
+ This runs: **install-peers** → **init-cursor** → **init-skills** → **init-css --sidebar --force**.
54
+
55
+ Then **manually** add the nqui CSS import to your main CSS file (see [Step 2: Setup CSS](#step-2-setup-css-required) below).
56
+
57
+ ### Option B: Step by step
58
+
59
+ ```bash
60
+ # 1. Install nqui + minimal deps (or use install-peers for full)
61
+ npm install @nqlib/nqui @hugeicons/react @hugeicons/core-free-icons
62
+ # or: npx @nqlib/nqui install-peers
63
+
64
+ # 2. Cursor rules + nqui-skills
65
+ npx @nqlib/nqui init-cursor
66
+
67
+ # 3. (Optional) Refresh skills only
68
+ npx @nqlib/nqui init-skills
69
+
70
+ # 4. CSS setup
71
+ npx @nqlib/nqui init-css --sidebar
72
+ # Then add the import to your main CSS (see Step 2 below)
73
+ ```
74
+
75
+ ---
76
+
77
+ ## Requirements
78
+
79
+ - **React 18 or 19** (peer: `^18.0.0 || ^19.0.0`)
80
+ - **Tailwind CSS v4**
81
+ - **Node.js** per your framework
82
+
83
+ ---
84
+
85
+ ## Step 1: Install nqui + peers
86
+
87
+ **Minimal (icons required for most components):**
88
+
89
+ ```bash
90
+ npm install @nqlib/nqui @hugeicons/react @hugeicons/core-free-icons
91
+ ```
92
+
93
+ **Full (all optional peers for Sortable, Carousel, DataTable, Calendar, etc.):**
94
+
95
+ ```bash
96
+ npx @nqlib/nqui install-peers
97
+ ```
98
+
99
+ ---
100
+
101
+ ## Step 2: Setup CSS (required)
102
+
103
+ ### 2a. Run init-css
104
+
105
+ ```bash
106
+ npx @nqlib/nqui init-css
107
+ ```
108
+
109
+ Creates:
110
+
111
+ - `nqui/index.css` — imports `@nqlib/nqui/styles`
112
+ - `nqui/nqui-setup.css` — framework-specific Tailwind + nqui snippet
113
+
114
+ ### 2b. Add import to main CSS (manual)
115
+
116
+ Add the nqui import to your **main CSS file**:
117
+
118
+ | Framework | Main CSS file |
119
+ |-----------|----------------|
120
+ | Next.js | `app/globals.css` |
121
+ | Vite | `src/index.css` |
122
+ | Remix | `app/root.css` |
123
+
124
+ **Option A (recommended):** After `@import "tailwindcss"`:
125
+
126
+ ```css
127
+ @import "@nqlib/nqui/styles";
128
+ ```
129
+
130
+ **Option B:** Copy the **entire contents** of `nqui/nqui-setup.css` to the **very top** of your main CSS file.
131
+
132
+ ### 2c. Vite + Tailwind v4
133
+
134
+ With `@tailwindcss/vite`, Tailwind usually scans your app files automatically. If **components look unstyled**, **spacing or button classes from `@nqlib/nqui` are missing**, or utilities used only inside the installed package do not appear in CSS, add these **`@source` lines after** `@import "@nqlib/nqui/styles";` in your main stylesheet (paths are relative to that CSS file — adjust if your entry is not `src/index.css`):
135
+
136
+ ```css
137
+ @import "@nqlib/nqui/styles";
138
+
139
+ @source "./**/*.{js,ts,jsx,tsx,mdx}";
140
+ @source "../components/**/*.{js,ts,jsx,tsx,mdx}";
141
+ @source "../node_modules/@nqlib/nqui/dist/**/*.js";
142
+ ```
143
+
144
+ Example layout: `src/index.css` → `../components` is `src/components`, `../node_modules` is the project root `node_modules`.
145
+
146
+ ### 2d. Next.js + Tailwind v4
147
+
148
+ Include these in your main CSS:
149
+
150
+ ```css
151
+ @source "./**/*.{js,ts,jsx,tsx,mdx}";
152
+ @source "../components/**/*.{js,ts,jsx,tsx,mdx}";
153
+ @source "../node_modules/@nqlib/nqui/dist/**/*.js";
154
+ ```
155
+
156
+ ### 2e. Custom path
157
+
158
+ ```bash
159
+ npx @nqlib/nqui init-css app/styles/nqui.css
160
+ ```
161
+
162
+ ---
163
+
164
+ ## Step 3: Use components
165
+
166
+ ```tsx
167
+ import { Button, Input, Card } from "@nqlib/nqui";
168
+ ```
169
+
170
+ Next.js App Router pages that use nqui need `"use client"`.
171
+
172
+ ---
173
+
174
+ ## Step 4: Debug tools (optional)
175
+
176
+ ```bash
177
+ npx @nqlib/nqui init-debug-css
178
+ ```
179
+
180
+ Then in your app:
181
+
182
+ ```tsx
183
+ import { DebugPanel } from "@nqlib/nqui";
184
+ import "./nqui-debug.css"; // or path from init-debug-css
185
+
186
+ // In your root/layout: render when NODE_ENV === 'development'
187
+ <DebugPanel />
188
+ ```
189
+
190
+ ---
191
+
192
+ ## Step 5: Cursor / IDE rules
193
+
194
+ On install, basic rules are written to `.cursor/rules/nqui-components.mdc`. For the full **nqui-skills** set (`.cursor/nqui-skills/` and `AGENTS.md`), run:
195
+
196
+ ```bash
197
+ npx @nqlib/nqui init-cursor
198
+ ```
199
+
200
+ Component docs index: `node_modules/@nqlib/nqui/docs/components/README.md`.
201
+
202
+ ---
203
+
204
+ ## Optional: Local vs published nqui
205
+
206
+ To switch between a **local** (linked) build and the **published** npm package during development, you can add a `scripts/toggle-nqui.js` script to your app and wire it to your `dev` script. This is optional and not created by nqui. See the nqui skill **nqui-local-published-toggle** for the script and usage (e.g. `USE_LOCAL_NQUI=true node scripts/toggle-nqui.js && next dev`).
207
+
208
+ ---
209
+
210
+ ## Troubleshooting
211
+
212
+ **"Module not found: '@nqlib/nqui/styles'" or CSS not loading**
213
+
214
+ 1. Run `npx @nqlib/nqui init-css`.
215
+ 2. Add `@import "@nqlib/nqui/styles";` near the **top** of your main CSS file.
216
+ 3. Ensure it appears **before** other app styles.
217
+
218
+ **Components render without styles**
219
+
220
+ Your main CSS is missing the nqui import. Add `@import "@nqlib/nqui/styles";` or paste the contents of `nqui/nqui-setup.css` at the top of your main CSS.
221
+
222
+ **Vite: broken layout, missing spacing, or button styles**
223
+
224
+ 1. Confirm `@import "@nqlib/nqui/styles";` is present and `@tailwindcss/vite` is in `vite.config.ts`.
225
+ 2. Add the **`@source` directives** from [§2c Vite + Tailwind v4](#2c-vite--tailwind-v4) so Tailwind scans your app and `node_modules/@nqlib/nqui/dist`.
226
+
227
+ **Debug Panel not showing**
228
+
229
+ - Ensure `NODE_ENV !== 'production'`.
230
+ - Import the debug CSS and render `<DebugPanel />` in your app tree.
231
+
232
+ **Package name**
233
+
234
+ Use `@nqlib/nqui` (the published package name).
package/README.md CHANGED
@@ -10,42 +10,88 @@ A React component library with enhanced UI components and developer tools. Built
10
10
 
11
11
  ## Installation
12
12
 
13
- Install from npmjs.com (recommended - no authentication needed):
13
+ ### Install the package
14
+
15
+ Install the published package from [npm](https://www.npmjs.com/package/@nqlib/nqui):
14
16
 
15
17
  ```bash
16
18
  npm install @nqlib/nqui @hugeicons/react @hugeicons/core-free-icons
17
19
  ```
18
20
 
19
- Hugeicons is required for icon display in components (Button, Accordion, Select, etc.).
21
+ Hugeicons is required for icons in components (Button, Accordion, Select, etc.).
20
22
 
21
- **Full install** (all optional peers for Sortable, Carousel, DataTable, Calendar, etc.):
23
+ **All optional peers** (Sortable, Carousel, DataTable, Calendar, etc.):
22
24
 
23
25
  ```bash
24
26
  npx @nqlib/nqui install-peers
25
27
  ```
26
28
 
27
- **After install:** A post-install message will show the next steps. Run `npx nqui-setup` anytime to see them again.
29
+ **After `npm install`:** the post-install script may add a `nqui:init` script and write initial Cursor rules under `.cursor/`. It does **not** copy full **nqui-skills** or set up CSS — run the commands below. Run `npx nqui-setup` (same as `npx @nqlib/nqui setup`) anytime to see next steps again. Post-install is skipped when `CI=true` or `CI=1`.
30
+
31
+ ### IDE skills (Cursor and compatible agents)
32
+
33
+ Copy the library’s **skills** into your app so your IDE can follow nqui patterns (components, design system, ToggleGroup rules, etc.):
34
+
35
+ | Command | What it does |
36
+ |--------|----------------|
37
+ | `npx @nqlib/nqui init-cursor` | Writes `.cursor/rules` and `.cursor/skills`, copies **`docs/nqui-skills`** → **`.cursor/nqui-skills`**, and creates **`AGENTS.md`** at the project root pointing agents at `.cursor/nqui-skills/SKILL.md`. |
38
+ | `npx @nqlib/nqui init-skills` | **Skills only:** copies nqui-skills to `.cursor/nqui-skills/` and (re)creates `AGENTS.md`. Use `--force` to overwrite existing files. |
39
+ | `npm run nqui:init` | **One-shot** (if post-install added this script): `install-peers` → `init-cursor` → `init-skills` → `init-css --sidebar --force`. You still add the CSS import to your main stylesheet (see [INSTALLATION.md](./INSTALLATION.md)). |
40
+
41
+ After copying skills, **restart the IDE** so rules and skills reload.
42
+
43
+ **Monorepos:** rules and skills are written to the workspace package that depends on `@nqlib/nqui`. Open that folder in your IDE so paths resolve.
44
+
45
+ ---
46
+
47
+ ### CLI commands
28
48
 
29
- **Alternative:** Install from GitHub Packages (requires GitHub account + token):
49
+ Run from your **app project root** (where `package.json` lives). Equivalent **global bins** (when the package is installed): `nqui`, `nqui-setup`, `nqui-install-peers`, `nqui-init-cursor`, `nqui-init-skills`, `nqui-init-css`, `nqui-init-debug`.
50
+
51
+ | Command | Description |
52
+ |--------|-------------|
53
+ | `npx @nqlib/nqui setup` | Re-run post-install: next steps + Cursor rules (not full skills/CSS). Same as `npx nqui-setup`. |
54
+ | `npx @nqlib/nqui install-peers` | Install `@nqlib/nqui` and required + optional peer dependencies. |
55
+ | `npx @nqlib/nqui init-cursor` | Cursor rules + **nqui-skills** → `.cursor/nqui-skills/` + `AGENTS.md`. |
56
+ | `npx @nqlib/nqui init-skills` | Copy nqui-skills only; `--force` to overwrite. |
57
+ | `npx @nqlib/nqui init-css` | Detect framework; create `nqui/index.css` and `nqui/nqui-setup.css`. Flags: `--sidebar`, `--force`, `--wizard`. Optional output path, e.g. `npx @nqlib/nqui init-css app/styles/nqui.css`. |
58
+ | `npx @nqlib/nqui` | No args → same as **init-css** (default `nqui/index.css`). |
59
+ | `npx @nqlib/nqui init-debug` or `init-debug-css` | Scaffold CSS for `DebugPanel`. |
60
+
61
+ ---
62
+
63
+ ### Recommended setup order
64
+
65
+ **Option A — one command** (if `nqui:init` exists in `package.json`):
30
66
 
31
67
  ```bash
32
- # Create .npmrc in your project
33
- echo "@nqlib:registry=https://npm.pkg.github.com" > .npmrc
68
+ npm run nqui:init
69
+ ```
70
+
71
+ Then add `@import "@nqlib/nqui/styles";` (or your framework’s full CSS snippet) to your main CSS — see [INSTALLATION.md](./INSTALLATION.md) Step 2.
34
72
 
35
- # Authenticate with GitHub
36
- npm login --registry=https://npm.pkg.github.com
73
+ **Option B step by step:**
37
74
 
38
- # Install
75
+ ```bash
39
76
  npm install @nqlib/nqui @hugeicons/react @hugeicons/core-free-icons
77
+ # optional: npx @nqlib/nqui install-peers
78
+
79
+ npx @nqlib/nqui init-cursor
80
+ # optional refresh: npx @nqlib/nqui init-skills
81
+
82
+ npx @nqlib/nqui init-css --sidebar
83
+ # add CSS import to app/globals.css or src/index.css — see INSTALLATION.md
40
84
  ```
41
85
 
86
+ **Detailed CSS paths, Next.js `@source` lines, and troubleshooting:** [INSTALLATION.md](./INSTALLATION.md).
87
+
42
88
  ## Quick Start
43
89
 
44
- ### Option 1: Package Import (Recommended)
90
+ ### Option 1: Package import (recommended)
45
91
 
46
- #### For Next.js
92
+ #### Next.js
47
93
 
48
- 1. **Import CSS in your `app/layout.tsx` or `app/globals.css`:**
94
+ 1. **Import CSS** in `app/globals.css` (or equivalent):
49
95
 
50
96
  ```tsx
51
97
  // app/globals.css
@@ -71,9 +117,10 @@ export default function Page() {
71
117
  }
72
118
  ```
73
119
 
74
- **Note:** Pages using nqui components must include `"use client"` because nqui components use React hooks.
120
+ Pages using nqui must use `"use client"` where required (hooks).
121
+
122
+ **Local linking:** with `npm link` or `file:`, you may need Webpack instead of Turbopack:
75
123
 
76
- **For Local Development:** If you're using `npm link` or `file:` protocol, you may need to use Webpack instead of Turbopack:
77
124
  ```json
78
125
  {
79
126
  "scripts": {
@@ -81,22 +128,27 @@ export default function Page() {
81
128
  }
82
129
  }
83
130
  ```
84
- See [Troubleshooting](#troubleshooting) for more details.
85
131
 
86
- #### For Vite
132
+ See [Troubleshooting](#troubleshooting).
87
133
 
88
- 1. **Import CSS in your `src/main.tsx` or `src/index.css`:**
134
+ #### Vite
135
+
136
+ 1. **CSS** in `src/index.css`:
89
137
 
90
138
  ```css
91
- /* src/index.css */
92
139
  @import "tailwindcss";
93
140
  @import "tw-animate-css";
94
141
  @import "@nqlib/nqui/styles";
142
+
143
+ /* Add if styles from @nqlib/nqui look missing (see INSTALLATION.md §2c) */
144
+ @source "./**/*.{js,ts,jsx,tsx,mdx}";
145
+ @source "../components/**/*.{js,ts,jsx,tsx,mdx}";
146
+ @source "../node_modules/@nqlib/nqui/dist/**/*.js";
95
147
  ```
96
148
 
97
- **Note:** Vite does NOT require `@source` directives. Tailwind CSS v4 automatically scans files when using the `@tailwindcss/vite` plugin. Only Next.js requires `@source` directives.
149
+ Vite with `@tailwindcss/vite` often works without `@source`; add the block above when utilities from the package do not show up in CSS.
98
150
 
99
- 2. **Use components:**
151
+ 2. **Components:**
100
152
 
101
153
  ```tsx
102
154
  import { Button } from '@nqlib/nqui';
@@ -106,43 +158,30 @@ function App() {
106
158
  }
107
159
  ```
108
160
 
109
- ### Option 2: Init Script (Alternative)
110
-
111
- The init script automatically detects your framework and sets up CSS with framework-specific Tailwind directives:
161
+ ### Option 2: `init-css` helper
112
162
 
113
163
  ```bash
114
164
  npx @nqlib/nqui init-css
115
165
  ```
116
166
 
117
- This will:
118
- - Detect your framework (Next.js, Vite, Remix, etc.)
119
- - Add framework-specific Tailwind setup
120
- - Copy nqui CSS variables to the appropriate location
121
- - Provide next steps
122
-
123
- **For Next.js:** Creates/updates `app/globals.css` with Next.js-specific directives
124
- **For Vite:** Creates/updates `src/index.css` with Vite-specific directives
167
+ Detects Next.js, Vite, Remix, etc., and scaffolds CSS entry files; see [INSTALLATION.md](./INSTALLATION.md) for wiring the import into your main stylesheet.
125
168
 
126
- ## Setup Requirements
169
+ ## Setup requirements
127
170
 
128
- ### Tailwind CSS Configuration
171
+ ### Tailwind CSS
129
172
 
130
- nqui requires Tailwind CSS v4. Ensure you have it installed:
173
+ nqui expects Tailwind CSS v4:
131
174
 
132
175
  ```bash
133
176
  npm install tailwindcss@^4.1.0
134
177
  ```
135
178
 
136
- For **Next.js**, Tailwind CSS v4 works with the new `@import` syntax in CSS files.
137
-
138
- For **Vite**, install the Tailwind CSS Vite plugin:
179
+ **Vite** add the plugin:
139
180
 
140
181
  ```bash
141
182
  npm install @tailwindcss/vite
142
183
  ```
143
184
 
144
- Then add it to your `vite.config.ts`:
145
-
146
185
  ```ts
147
186
  import tailwindcss from '@tailwindcss/vite';
148
187
  import { defineConfig } from 'vite';
@@ -152,16 +191,12 @@ export default defineConfig({
152
191
  });
153
192
  ```
154
193
 
155
- ### Optional: Debug Tools
156
-
157
- If you want to use the debug tools in development:
194
+ ### Optional: debug tools
158
195
 
159
196
  ```bash
160
197
  npx @nqlib/nqui init-debug-css
161
198
  ```
162
199
 
163
- Then import in your app:
164
-
165
200
  ```tsx
166
201
  import { DebugPanel } from '@nqlib/nqui';
167
202
  import '@nqlib/nqui/debug.css';
@@ -176,16 +211,11 @@ function App() {
176
211
  }
177
212
  ```
178
213
 
179
- ## Component Instructions
180
-
181
- Per-component implementation guides (AI/LLM-optimized) are in `docs/components/`:
182
- - After install: `node_modules/@nqlib/nqui/docs/components/README.md` (index of all components)
183
- - Each file: `nqui-<component>.md` — import, variants, props, notes
184
- - Token-optimized for easy AI consumption and implementation
214
+ ## Component instructions
185
215
 
186
- **Cursor/IDE rules:** Component guidelines are auto-injected to `.cursor/rules/nqui-components.mdc` on install. Run `npx @nqlib/nqui init-cursor` to refresh.
216
+ Guides for each component live under `docs/components/` in the package (after install: `node_modules/@nqlib/nqui/docs/components/`). Use **`npx @nqlib/nqui init-skills`** (or `init-cursor`) so your IDE loads `.cursor/nqui-skills` and `AGENTS.md`.
187
217
 
188
- ### Basic Components
218
+ ### Examples
189
219
 
190
220
  ```tsx
191
221
  import { Button, Checkbox, Input } from '@nqlib/nqui';
@@ -198,13 +228,8 @@ function MyForm() {
198
228
  <Button variant="default">Submit</Button>
199
229
  </form>
200
230
  );
201
- }
202
231
  ```
203
232
 
204
- ### Enhanced Components
205
-
206
- nqui includes enhanced versions of common components with additional variants:
207
-
208
233
  ```tsx
209
234
  import { Button, Separator } from '@nqlib/nqui';
210
235
 
@@ -220,8 +245,6 @@ function MyComponent() {
220
245
  }
221
246
  ```
222
247
 
223
- ### Custom Components
224
-
225
248
  ```tsx
226
249
  import { ColorPicker, Rating, TableOfContents } from '@nqlib/nqui';
227
250
 
@@ -236,48 +259,26 @@ function MyApp() {
236
259
  }
237
260
  ```
238
261
 
239
- ## Framework Support
262
+ ## Framework support
240
263
 
241
- - **Next.js** (App Router) - Fully tested and supported
242
- - **Vite** - Fully supported
243
- - **Remix** - Supported
244
- - **Create React App** - Supported
264
+ - **Next.js** (App Router)
265
+ - **Vite**
266
+ - **Remix**
267
+ - **Create React App**
245
268
 
246
- All components are framework-agnostic and work with any React setup.
269
+ Components are framework-agnostic for any React setup.
247
270
 
248
271
  ## Troubleshooting
249
272
 
250
- ### @source Directives: Next.js vs Vite
251
-
252
- **Problem:** Tailwind classes not working, or confusion about whether to use `@source` directives
253
-
254
- **Solution:**
255
- - **Next.js REQUIRES `@source` directives** in your CSS file:
256
- ```css
257
- @import "tailwindcss";
258
- @source "./**/*.{js,ts,jsx,tsx,mdx}";
259
- @source "../components/**/*.{js,ts,jsx,tsx,mdx}";
260
- @source "../node_modules/@nqlib/nqui/dist/**/*.js";
261
- @import "tw-animate-css";
262
- @import "@nqlib/nqui/styles";
263
- ```
273
+ ### `@source`: Next.js vs Vite
264
274
 
265
- - **Vite does NOT need `@source` directives** - Tailwind automatically scans files:
266
- ```css
267
- @import "tailwindcss";
268
- @import "tw-animate-css";
269
- @import "@nqlib/nqui/styles";
270
- ```
275
+ - **Next.js** needs `@source` lines so Tailwind sees app and `node_modules/@nqlib/nqui` — see the Quick Start block above.
276
+ - **Vite** often works without extra `@source` lines; if components look unstyled, use the same three `@source` paths after `@import "@nqlib/nqui/styles";` ([INSTALLATION.md](./INSTALLATION.md) §2c).
271
277
 
272
- **Why the difference?** Next.js has a different file structure and build process, so Tailwind needs explicit paths. Vite's `@tailwindcss/vite` plugin automatically handles file scanning.
278
+ ### Module resolution (Next.js 16+, local packages)
273
279
 
274
- **Common mistake:** Adding `@source` directives to Vite projects (not needed and may cause issues) or missing them in Next.js projects (will cause Tailwind to not find classes).
280
+ If `@nqlib/nqui` fails to resolve with `npm link` / `file:`:
275
281
 
276
- ### Module Resolution Issues (Next.js 16+)
277
-
278
- If you encounter `Module not found: Can't resolve '@nqlib/nqui'` when using `npm link` or `file:` protocol, switch to Webpack:
279
-
280
- **Quick Fix:**
281
282
  ```json
282
283
  {
283
284
  "scripts": {
@@ -286,79 +287,36 @@ If you encounter `Module not found: Can't resolve '@nqlib/nqui'` when using `npm
286
287
  }
287
288
  ```
288
289
 
289
- **Or in `next.config.ts`:**
290
- ```typescript
291
- const nextConfig: NextConfig = {
292
- experimental: {
293
- turbo: undefined, // Disable Turbopack
294
- },
295
- };
296
- ```
297
-
298
- **Why?** Next.js 16 uses Turbopack by default, which has limited symlink support. Webpack handles symlinks better for local development. Production builds always use Webpack, so there's no production impact.
290
+ Production builds use Webpack; this mainly affects local dev with symlinks.
299
291
 
300
- See [instructions.md](./instructions.md) for more troubleshooting tips.
292
+ More tips: [instructions.md](./instructions.md).
301
293
 
302
294
  ## Features
303
295
 
304
- - **Enhanced UI Components** - Button, Checkbox, RadioGroup, Separator, ScrollArea with additional variants
305
- - 🎨 **Custom Components** - ColorPicker, Rating, TableOfContents
306
- - 🛠️ **Debug Tools** - Development tools for inspecting and testing components
307
- - 🎯 **TypeScript** - Full TypeScript support with exported types
308
- - **Accessible** - Built on Radix UI primitives for accessibility
309
- - 🎨 **Themable** - CSS variables for easy theming
310
- - 📦 **Tree-shakeable** - Import only what you need
296
+ - **UI components** Buttons, forms, layout, data display, overlays, with consistent variants
297
+ - **Custom components** e.g. ColorPicker, Rating, TableOfContents
298
+ - **Debug tools** optional `DebugPanel` in development
299
+ - **TypeScript** exported types
300
+ - **Accessible** Radix UI primitives
301
+ - **Theming** CSS variables
302
+ - **Tree-shakeable** import only what you use
311
303
 
312
304
  ## Documentation
313
305
 
314
- - [Installation Guide](./INSTALLATION.md) - Detailed setup instructions
315
- - [Debug Tools](./src/components/debug/README.md) - Debug panel documentation
316
- - [AGENTS.md](./AGENTS.md) - Development guidelines for contributors
306
+ - [INSTALLATION.md](./INSTALLATION.md) CSS setup, CLI details, monorepos
307
+ - [Debug tools](./src/components/debug/README.md) debug panel
308
+ - [CHANGELOG.md](./CHANGELOG.md) release history
317
309
 
318
- ## Development
319
-
320
- For contributors:
310
+ ## Publishing (maintainers)
321
311
 
322
- ```bash
323
- # Install dependencies
324
- npm install
325
-
326
- # Run dev server (showcase app)
327
- npm run dev
328
-
329
- # Build library
330
- npm run build:lib
331
-
332
- # Build showcase app
333
- npm run build:app
334
-
335
- # Lint
336
- npm run lint
337
- ```
338
-
339
- ## Publishing
340
-
341
- For maintainers:
342
-
343
- **Publish to npmjs.com (recommended):**
344
312
  ```bash
345
313
  npm version patch|minor|major
346
314
  npm run publish:npm
347
315
  ```
348
316
 
349
- **Publish to GitHub Packages:**
350
- ```bash
351
- npm version patch|minor|major
352
- npm run publish:github
353
- ```
354
-
355
- **Publish to both:**
356
- ```bash
357
- npm version patch|minor|major
358
- npm run publish:both
359
- ```
317
+ GitHub Packages: `npm run publish:github`. Both: `npm run publish:both`.
360
318
 
361
- See [PUBLISHING.md](./PUBLISHING.md) for detailed instructions.
319
+ Details: [docs/internal-notes/PUBLISHING.md](./docs/internal-notes/PUBLISHING.md).
362
320
 
363
321
  ## License
364
322