@cloudwick/astral-ui-cli 2.0.1 → 2.2.0
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 +17 -5
- package/dist/index.js +1235 -139
- package/dist/index.js.map +1 -1
- package/dist/templates/constants/index.ts +1 -0
- package/dist/templates/constants/keyboardKey.ts +1 -0
- package/dist/templates/css/fonts.min.css +1 -1
- package/dist/templates/fonts/NotoSans-Bold.woff2 +0 -0
- package/dist/templates/fonts/NotoSans-BoldItalic.woff2 +0 -0
- package/dist/templates/fonts/NotoSans-Italic.woff2 +0 -0
- package/dist/templates/fonts/NotoSans-Medium.woff2 +0 -0
- package/dist/templates/fonts/NotoSans-MediumItalic.woff2 +0 -0
- package/dist/templates/fonts/NotoSans-Regular.woff2 +0 -0
- package/dist/templates/fonts/NotoSans-SemiBold.woff2 +0 -0
- package/dist/templates/fonts/NotoSans-SemiBoldItalic.woff2 +0 -0
- package/dist/templates/hooks/index.ts +20 -1
- package/dist/templates/hooks/useAsyncOptions.ts +346 -0
- package/dist/templates/hooks/useAsyncOptionsReducer.ts +182 -0
- package/dist/templates/hooks/useAvailableProjection.ts +77 -0
- package/dist/templates/hooks/useDebouncedCallback.ts +42 -0
- package/dist/templates/hooks/useFilterQuery.ts +145 -0
- package/dist/templates/hooks/useIgnoredPropWarning.ts +17 -0
- package/dist/templates/hooks/useInfiniteScroll.ts +63 -0
- package/dist/templates/hooks/useIsTruncated.ts +63 -0
- package/dist/templates/hooks/useListboxKeyboardNav.ts +120 -0
- package/dist/templates/hooks/useOnValueChange.ts +17 -0
- package/dist/templates/hooks/usePrefetchBaseline.ts +38 -0
- package/dist/templates/schema/components-config.schema.json +3 -0
- package/dist/templates/tailwind/tailwind.config.js +8 -8
- package/dist/templates/utils/devWarn.ts +9 -0
- package/dist/templates/utils/elementUtils.ts +26 -0
- package/dist/templates/utils/index.ts +7 -1
- package/dist/templates/utils/matchesQuery.ts +23 -0
- package/dist/templates/utils/mergeUnique.ts +24 -0
- package/dist/templates/utils/resolveLoadErrors.ts +40 -0
- package/dist/templates/utils/resolveReloadControls.ts +31 -0
- package/package.json +2 -2
- package/dist/templates/fonts/Inter_18pt-Bold.ttf +0 -0
- package/dist/templates/fonts/Inter_18pt-BoldItalic.ttf +0 -0
- package/dist/templates/fonts/Inter_18pt-Italic.ttf +0 -0
- package/dist/templates/fonts/Inter_18pt-Medium.ttf +0 -0
- package/dist/templates/fonts/Inter_18pt-MediumItalic.ttf +0 -0
- package/dist/templates/fonts/Inter_18pt-Regular.ttf +0 -0
- package/dist/templates/fonts/Inter_18pt-SemiBold.ttf +0 -0
- package/dist/templates/fonts/Inter_18pt-SemiBoldItalic.ttf +0 -0
package/README.md
CHANGED
|
@@ -37,6 +37,7 @@ npx @cloudwick/astral-ui-cli add button card
|
|
|
37
37
|
import { Button } from '@components/button';
|
|
38
38
|
import { cn } from '@utils';
|
|
39
39
|
import { keyboardKeys, mobileBreakPoint } from '@constants';
|
|
40
|
+
import { useWindowSize } from '@hooks';
|
|
40
41
|
```
|
|
41
42
|
|
|
42
43
|
## Workflow
|
|
@@ -65,7 +66,7 @@ This command will:
|
|
|
65
66
|
- Install Tailwind CSS if not already present
|
|
66
67
|
- Add required configuration to existing Tailwind config or create a new one
|
|
67
68
|
- Add utility functions
|
|
68
|
-
- Add
|
|
69
|
+
- Add Noto Sans font files for consistent typography
|
|
69
70
|
- Set up font CSS for proper font rendering
|
|
70
71
|
- Display detailed path alias setup instructions based on your project type (Next.js, Vite, Webpack, CRA, etc.)
|
|
71
72
|
|
|
@@ -189,7 +190,8 @@ The `components.json` file is created during initialization and contains configu
|
|
|
189
190
|
"aliases": {
|
|
190
191
|
"components": "src/components",
|
|
191
192
|
"utils": "src/utils",
|
|
192
|
-
"constants": "src/constants"
|
|
193
|
+
"constants": "src/constants",
|
|
194
|
+
"hooks": "src/hooks"
|
|
193
195
|
}
|
|
194
196
|
}
|
|
195
197
|
```
|
|
@@ -197,7 +199,7 @@ The `components.json` file is created during initialization and contains configu
|
|
|
197
199
|
You can edit this file to customize:
|
|
198
200
|
- **tailwind.config**: Path to your Tailwind configuration file
|
|
199
201
|
- **css**: Path to your global CSS file
|
|
200
|
-
- **aliases**: Paths where components, utilities, and
|
|
202
|
+
- **aliases**: Paths where components, utilities, constants, and hooks are installed
|
|
201
203
|
|
|
202
204
|
> **Note**: The `utils` path in `components.json` is stored without a file extension. The CLI automatically adds `.ts` or `.js` extension based on whether your project uses TypeScript or JavaScript. When configuring path aliases, you should use the path without an extension as shown in the `components.json` file.
|
|
203
205
|
|
|
@@ -207,7 +209,7 @@ Alongside your `components.json`, the CLI generates a JSON Schema file at `schem
|
|
|
207
209
|
You can use this schema in your editor or CI to validate your configuration. It defines:
|
|
208
210
|
- `$schema` (string): URI of this schema file.
|
|
209
211
|
- `tailwind` (object): Paths to your Tailwind config (`config`) and CSS file (`css`).
|
|
210
|
-
- `aliases` (object): Directories for `components`, `utils`, and `
|
|
212
|
+
- `aliases` (object): Directories for `components`, `utils`, `constants`, and `hooks`. The `hooks` entry is optional — configs created by older CLI versions omit it and fall back to `src/hooks` (`lib/hooks` on Next.js).
|
|
211
213
|
|
|
212
214
|
For full details, see `schema/components-config.schema.json` in your project.
|
|
213
215
|
|
|
@@ -273,6 +275,16 @@ The CLI creates a utility file with the `cn` function that helps combine Tailwin
|
|
|
273
275
|
|
|
274
276
|
The `cn` function allows you to conditionally combine class names and automatically handles Tailwind class conflicts.
|
|
275
277
|
|
|
278
|
+
### About the Hooks Directory
|
|
279
|
+
|
|
280
|
+
The CLI also installs a directory of shared React hooks (`useAsyncOptions`, `useFilterQuery`, `useInfiniteScroll`, `useListboxKeyboardNav`, `useIsTruncated`, `useWindowSize`, and others). This directory:
|
|
281
|
+
|
|
282
|
+
- Is automatically created during initialization in the path specified in `components.json` (`hooks` field)
|
|
283
|
+
- Is exposed through the `@hooks` alias, which must be configured alongside `@components`, `@utils`, and `@constants`
|
|
284
|
+
- Is required by several components — `Select`, `TransferList`, `MultiSelectTransfer`, `Scrollbar`, and `CtaGroup` all import from `@hooks`, so those components will fail to resolve without this alias
|
|
285
|
+
|
|
286
|
+
Import hooks as `import { useWindowSize } from '@hooks'` — always from the barrel, not from individual files.
|
|
287
|
+
|
|
276
288
|
## Styling Components
|
|
277
289
|
|
|
278
290
|
The components in the registry require Tailwind CSS to be properly configured in your application. When you run `npx @cloudwick/astral-ui-cli init`, the CLI will:
|
|
@@ -313,7 +325,7 @@ The CSS file includes all necessary CSS variables that components reference, inc
|
|
|
313
325
|
|
|
314
326
|
If you're having problems with imports:
|
|
315
327
|
|
|
316
|
-
1. **Check your configuration**: Make sure the paths in tsconfig.json/jsconfig.json match your project structure
|
|
328
|
+
1. **Check your configuration**: Make sure the paths in tsconfig.json/jsconfig.json match your project structure. All four aliases are required: `@components/*`, `@utils`, `@constants`, and `@hooks`. A `Cannot find module '@hooks'` error means that alias is missing.
|
|
317
329
|
2. **Framework-specific issues**:
|
|
318
330
|
- **Next.js**: Make sure you're using the correct import format for your Next.js version
|
|
319
331
|
- **tsconfig.app.json**: If your project uses tsconfig.app.json, configure paths there as well
|