@puzzle-ui/core 0.1.0 → 0.3.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 +70 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# @puzzle-ui/core
|
|
2
|
+
|
|
3
|
+
Framework-independent utilities shared by the Puzzle UI packages. Use them
|
|
4
|
+
directly without React, a theme provider, or CSS.
|
|
5
|
+
|
|
6
|
+
> Puzzle is under active development. APIs may change without notice; use it
|
|
7
|
+
> for experimentation and evaluation rather than production applications.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Use your preferred package manager:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm install @puzzle-ui/core
|
|
15
|
+
# or
|
|
16
|
+
bun add @puzzle-ui/core
|
|
17
|
+
# or
|
|
18
|
+
pnpm add @puzzle-ui/core
|
|
19
|
+
# or
|
|
20
|
+
yarn add @puzzle-ui/core
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { cn, isHexColor } from "@puzzle-ui/core";
|
|
27
|
+
|
|
28
|
+
const selected = true;
|
|
29
|
+
const className = cn("navigation-item", selected && "selected");
|
|
30
|
+
const validColor = isHexColor("#0284C7");
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Public utilities
|
|
34
|
+
|
|
35
|
+
| Area | Exports |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| Class names | `cn`, `ClassnameArg` |
|
|
38
|
+
| Strings | `stringWithCasing`, `normalizeSearchString`, `withSafeCharacters`, `nameToInitials` |
|
|
39
|
+
| CSS values | `assertSafeCssValue`, `escapeCssString` |
|
|
40
|
+
| Colors | `isHexColor`, `isDarkColor`, `hexToRgb`, `rgbToHex` |
|
|
41
|
+
| Responsive values | `BREAKPOINTS`, `resolveResponsiveValue`, `resolveResponsiveValueForBreakpoint` |
|
|
42
|
+
| Timing | `debounce` |
|
|
43
|
+
| Types | `DeepPartial`, `ResponsiveConfig`, `ResponsiveValue`, `Breakpoint` |
|
|
44
|
+
|
|
45
|
+
Import from the package root; internal source paths are not public entry
|
|
46
|
+
points. The package ships ESM and CommonJS builds with matching TypeScript
|
|
47
|
+
declarations and has no React peer dependency.
|
|
48
|
+
|
|
49
|
+
## Development
|
|
50
|
+
|
|
51
|
+
From an installed repository checkout:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
npm run build --workspace=@puzzle-ui/core
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
From this package directory, run the configured test script:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
bun run vitest
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`prepack` rebuilds the package before packing or publishing. See the root
|
|
64
|
+
[publishing guide](../../README.md#publishing-packages) for release order and
|
|
65
|
+
validation commands.
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT. See the repository [LICENSE](../../LICENSE); published packages include
|
|
70
|
+
the same license at `dist/LICENSE`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@puzzle-ui/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Framework-independent utilities",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"build": "tsdown",
|
|
32
32
|
"prepack": "tsdown",
|
|
33
33
|
"vitest": "bunx vitest run --passWithNoTests",
|
|
34
|
-
"vitest:watch": "bunx vitest"
|
|
34
|
+
"vitest:watch": "bunx vitest run --watch --passWithNoTests"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"tsdown": "^0.23.1",
|