qstd 0.1.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/CHANGELOG.md +23 -0
- package/README.md +127 -0
- package/dist/client/index.cjs +587 -0
- package/dist/client/index.d.cts +75 -0
- package/dist/client/index.d.ts +75 -0
- package/dist/client/index.js +577 -0
- package/dist/preset/index.cjs +475 -0
- package/dist/preset/index.d.cts +39 -0
- package/dist/preset/index.d.ts +39 -0
- package/dist/preset/index.js +473 -0
- package/dist/random-DMErOOdk.d.cts +447 -0
- package/dist/random-DMErOOdk.d.ts +447 -0
- package/dist/react/index.cjs +3155 -0
- package/dist/react/index.css +1566 -0
- package/dist/react/index.d.cts +21092 -0
- package/dist/react/index.d.ts +21092 -0
- package/dist/react/index.js +3128 -0
- package/dist/server/index.cjs +541 -0
- package/dist/server/index.d.cts +17 -0
- package/dist/server/index.d.ts +17 -0
- package/dist/server/index.js +527 -0
- package/package.json +111 -0
- package/panda.config.ts +68 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Initial package structure
|
|
13
|
+
- Shared utilities: List, Dict, Int, Money, Str, Time, Flow, Random
|
|
14
|
+
- Client utilities placeholder: Dom, Storage, Browser
|
|
15
|
+
- Server utilities placeholder: Fs, Env, Path
|
|
16
|
+
- React hooks placeholder: useDebounce, useToggle, useLocalStorage
|
|
17
|
+
- Panda CSS preset placeholder
|
|
18
|
+
- Block component placeholder
|
|
19
|
+
|
|
20
|
+
## [0.1.0] - TBD
|
|
21
|
+
|
|
22
|
+
Initial beta release (to be published)
|
|
23
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# qstd
|
|
2
|
+
|
|
3
|
+
> Standard Block component and utilities library with Panda CSS
|
|
4
|
+
|
|
5
|
+
**📖 Maintainer?** See [DEVELOPMENT.md](./DEVELOPMENT.md) for the complete "how to update and publish" guide.
|
|
6
|
+
|
|
7
|
+
A single npm package providing:
|
|
8
|
+
|
|
9
|
+
- **Block Component** - Polymorphic UI component with Panda CSS inline prop styling
|
|
10
|
+
- **React Hooks** - useDebounce, useThrottle, useMatchMedia
|
|
11
|
+
- **Global File Types** - ImageFile, AudioFile, VideoFile (automatically available)
|
|
12
|
+
- **Universal Utilities** - Lodash-style functions that work in browser and Node.js
|
|
13
|
+
- **Client Utilities** - Browser-specific DOM functions
|
|
14
|
+
- **Server Utilities** - Node.js file operations
|
|
15
|
+
- **Panda CSS Preset** - Custom utilities, tokens, and theme configuration
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pnpm add qstd
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### React (Block + Hooks)
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import Block, { useDebounce, useThrottle, useMatchMedia } from "qstd/react";
|
|
29
|
+
|
|
30
|
+
function SearchComponent() {
|
|
31
|
+
const [query, setQuery] = useState("");
|
|
32
|
+
const debouncedQuery = useDebounce(query, 500);
|
|
33
|
+
const [isMobile] = useMatchMedia(["(max-width: 600px)"]);
|
|
34
|
+
|
|
35
|
+
// File types are global - no import needed!
|
|
36
|
+
const handleImage = (file: ImageFile) => {
|
|
37
|
+
console.log(file.width, file.height, file.preview);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Block grid rowG={4}>
|
|
42
|
+
<Block
|
|
43
|
+
is="input"
|
|
44
|
+
value={query}
|
|
45
|
+
onChange={(e) => setQuery(e.target.value)}
|
|
46
|
+
/>
|
|
47
|
+
<Block is="btn" bg="blue.500" p={4} br={8}>
|
|
48
|
+
Search
|
|
49
|
+
</Block>
|
|
50
|
+
</Block>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Client Utilities (Browser)
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import * as Q from "qstd/client";
|
|
59
|
+
|
|
60
|
+
// Shared utilities
|
|
61
|
+
const xs = Q.List.create(5, (_, i) => i);
|
|
62
|
+
const color = Q.Random.hexColor();
|
|
63
|
+
const formatted = Q.Int.formatBytes(12345);
|
|
64
|
+
|
|
65
|
+
// DOM utilities
|
|
66
|
+
Q.Dom.scrollToTop();
|
|
67
|
+
Q.Dom.copy("text to clipboard");
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Server Utilities (Node.js)
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import * as Q from "qstd/server";
|
|
74
|
+
|
|
75
|
+
// Shared utilities (same as client)
|
|
76
|
+
const chunks = Q.List.chunk(arr, 10);
|
|
77
|
+
const money = Q.Money.convertToUsd(cents);
|
|
78
|
+
|
|
79
|
+
// File operations
|
|
80
|
+
const content = Q.File.readFile("path/to/file.txt");
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Panda CSS Preset
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
// panda.config.ts
|
|
87
|
+
import { defineConfig } from "@pandacss/dev";
|
|
88
|
+
import qstdPreset from "qstd/preset";
|
|
89
|
+
|
|
90
|
+
export default defineConfig({
|
|
91
|
+
// IMPORTANT: Include base preset to get default colors (neutral, red, blue, etc.)
|
|
92
|
+
presets: ["@pandacss/dev/presets", qstdPreset],
|
|
93
|
+
|
|
94
|
+
include: ["./src/**/*.{ts,tsx}"],
|
|
95
|
+
|
|
96
|
+
theme: {
|
|
97
|
+
extend: {
|
|
98
|
+
// Your custom theme
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Global Types
|
|
105
|
+
|
|
106
|
+
When you install qstd, these types become **globally available** (no import needed):
|
|
107
|
+
|
|
108
|
+
- `ImageFile` - Image with metadata (width, height, orientation, preview)
|
|
109
|
+
- `AudioFile` - Audio with metadata (source, preview)
|
|
110
|
+
- `VideoFile` - Video with metadata (duration, width, height, orientation)
|
|
111
|
+
- `MediaFile` - Union of File | ImageFile | AudioFile
|
|
112
|
+
- `File` - Augmented with `preview?` and `id?` properties
|
|
113
|
+
|
|
114
|
+
## Package Exports
|
|
115
|
+
|
|
116
|
+
- `qstd/react` - Block component (default) + hooks
|
|
117
|
+
- `qstd/client` - Browser utilities + all shared
|
|
118
|
+
- `qstd/server` - Node.js utilities + all shared
|
|
119
|
+
- `qstd/preset` - Panda CSS configuration
|
|
120
|
+
|
|
121
|
+
## Documentation
|
|
122
|
+
|
|
123
|
+
See [SUMMARY.md](./SUMMARY.md) for complete package contents and [QSTD_PACKAGE_PRD.md](./QSTD_PACKAGE_PRD.md) for full specification.
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
MIT
|