@sudobility/svgr_lib 0.0.12 → 0.0.13
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 +63 -0
- package/package.json +7 -7
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# @sudobility/svgr_lib
|
|
2
|
+
|
|
3
|
+
Shared business logic for SVGR web and React Native apps -- hooks, constants, i18n, and validation utilities.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @sudobility/svgr_lib
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { useImageConverter, APP_NAME, APP_DOMAIN, isValidImageType } from "@sudobility/svgr_lib";
|
|
15
|
+
|
|
16
|
+
// React hook for conversion workflow
|
|
17
|
+
const { quality, transparentBg, svgResult, error } = useImageConverter();
|
|
18
|
+
|
|
19
|
+
// Validate input
|
|
20
|
+
const valid = isValidImageType("image/png"); // true
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## API
|
|
24
|
+
|
|
25
|
+
### Hooks
|
|
26
|
+
|
|
27
|
+
- `useImageConverter` -- Main conversion workflow hook (quality, transparentBg, svgResult, error state)
|
|
28
|
+
|
|
29
|
+
### Constants
|
|
30
|
+
|
|
31
|
+
- `APP_NAME` ("SVGR"), `APP_DOMAIN` ("svgr.app")
|
|
32
|
+
- Quality range: 1-10, default 5
|
|
33
|
+
- `SUPPORTED_IMAGE_TYPES` -- PNG, JPEG, WebP, BMP, GIF
|
|
34
|
+
|
|
35
|
+
### Utils
|
|
36
|
+
|
|
37
|
+
- `isValidImageType(type)` -- Validate file type against supported types
|
|
38
|
+
- `getSvgDimensions(svg)` -- Parse SVG string for width/height
|
|
39
|
+
- `getSvgFileSize(svg)` -- Get SVG string byte size
|
|
40
|
+
|
|
41
|
+
### i18n
|
|
42
|
+
|
|
43
|
+
16 supported languages with namespace-based translation structure.
|
|
44
|
+
|
|
45
|
+
## Development
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
bun run build # Build ESM
|
|
49
|
+
bun test # Run tests
|
|
50
|
+
bun run typecheck # TypeScript check
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Related Packages
|
|
54
|
+
|
|
55
|
+
- `svgr_types` -- Shared type definitions
|
|
56
|
+
- `svgr_client` -- API client SDK
|
|
57
|
+
- `svgr_api` -- Backend API server
|
|
58
|
+
- `svgr_app` -- Web app consumer
|
|
59
|
+
- `svgr_app_rn` -- React Native app consumer
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
BUSL-1.1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudobility/svgr_lib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "Shared business logic library for SVGR web and React Native apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -35,17 +35,17 @@
|
|
|
35
35
|
"author": "John Huang",
|
|
36
36
|
"license": "BUSL-1.1",
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@sudobility/svgr_client": "^1.0.
|
|
39
|
-
"@sudobility/svgr_types": "^1.0.
|
|
40
|
-
"@sudobility/types": "^1.9.
|
|
38
|
+
"@sudobility/svgr_client": "^1.0.17",
|
|
39
|
+
"@sudobility/svgr_types": "^1.0.9",
|
|
40
|
+
"@sudobility/types": "^1.9.57",
|
|
41
41
|
"@tanstack/react-query": ">=5.0.0",
|
|
42
42
|
"react": ">=18.0.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@eslint/js": "^9.39.2",
|
|
46
|
-
"@sudobility/svgr_client": "^1.0.
|
|
47
|
-
"@sudobility/svgr_types": "^1.0.
|
|
48
|
-
"@sudobility/types": "^1.9.
|
|
46
|
+
"@sudobility/svgr_client": "^1.0.17",
|
|
47
|
+
"@sudobility/svgr_types": "^1.0.9",
|
|
48
|
+
"@sudobility/types": "^1.9.57",
|
|
49
49
|
"@tanstack/react-query": "^5.90.5",
|
|
50
50
|
"@types/node": "^24.9.1",
|
|
51
51
|
"@types/react": "^19.2.2",
|