poon-choi 0.0.0-stage โ†’ 0.0.1

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 CHANGED
@@ -1,3 +1,110 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # ๐Ÿฅ˜ poon-choi
2
+
3
+ English | [ไธญๆ–‡](./README.zh.md)
4
+
5
+ > A tiny local server that plates up your images into a WeChat cover โ€” like a **poon choi**, one basin holding many ingredients, layer by layer.
6
+
7
+ [![npm version](https://img.shields.io/npm/v/poon-choi.svg)](https://www.npmjs.com/package/poon-choi)
8
+ [![npm downloads](https://img.shields.io/npm/dm/poon-choi.svg)](https://www.npmjs.com/package/poon-choi)
9
+ [![license](https://img.shields.io/npm/l/poon-choi.svg)](./LICENSE)
10
+
11
+ **poon-choi** (็›†่œ) is a Cantonese dish where many ingredients are stacked in one basin and shared from the top down. This tool does the same for images: drop in 1โ€“6 pictures, and it plates them into a single **2.35:1 WeChat cover (900ร—383)**, plus a **1:1 thumbnail (383ร—383)**.
12
+
13
+ No build step, no config. One command and a local server.
14
+
15
+ ## Quick start
16
+
17
+ ```bash
18
+ pnpx poon-choi
19
+ ```
20
+
21
+ Opens the tool on a local port and prints the URL. Then just drag images into the page.
22
+
23
+ ### Pick your own port
24
+
25
+ ```bash
26
+ pnpx poon-choi --port 5173
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ```bash
32
+ poon-choi [options]
33
+
34
+ Options:
35
+ -p, --port <number> Port to listen on (default: 3000)
36
+ -h, --help Show this help
37
+ -v, --version Show version
38
+ ```
39
+
40
+ ### Examples
41
+
42
+ ```bash
43
+ # default port
44
+ pnpx poon-choi
45
+
46
+ # custom port
47
+ pnpx poon-choi --port 5173
48
+
49
+ # short flag
50
+ pnpx poon-choi -p 3000
51
+ ```
52
+
53
+ Then open the printed URL (e.g. `http://localhost:5173`) in your browser.
54
+
55
+ > Prefer a global install?
56
+ >
57
+ > ```bash
58
+ > npm i -g poon-choi
59
+ > poon-choi --port 5173
60
+ > ```
61
+
62
+ ## What it does
63
+
64
+ * **Input** โ€” drag & drop, click to pick, or paste from clipboard. Hard cap of **6 images**; extras are ignored with a toast. Non-image and corrupt files are skipped individually.
65
+
66
+ * **Layout** โ€” auto-arranged by image count:
67
+
68
+ | Images | Layout |
69
+ | ------ | --------------------------------------- |
70
+ | 1 | full-bleed cover-crop |
71
+ | 2 | two equal columns |
72
+ | 3 | three equal columns |
73
+ | 4 | 2ร—2 grid |
74
+ | 5โ€“6 | 3ร—2 grid (5 leaves the last cell blank) |
75
+
76
+ * **Fit mode** โ€” `Cover` (center crop, fills the cell) or `Contain` (whole image, padded with the gap color). Toggle anytime.
77
+
78
+ * **Gap color** โ€” color picker, a preset palette with visible swatches, and a "cycle through presets" button.
79
+
80
+ * **Boundaries** โ€” a subtle 1px inner edge per cell so white-on-white images stay distinguishable.
81
+
82
+ * **Reorder** โ€” drag thumbnails to reorder (free-form insert); remove with ร—. On touch devices, โ†/โ†’ buttons appear.
83
+
84
+ * **Export**
85
+ * `wechat-cover-900x383.jpg` โ€” the 2.35:1 cover
86
+ * `wechat-cover-thumbnail-383x383.jpg` โ€” 1:1 center-crop thumbnail
87
+ * JPEG, quality โ‰ˆ 0.92; preview is DPR-aware, export is exact pixel size.
88
+
89
+ ## Why "poon-choi"?
90
+
91
+ Poon choi is a shared basin of many ingredients โ€” bottom layer of radish and taro soaking up the juices, prized abalone and prawns on top. This tool stacks your images into one basin-shaped cover, each in its own cell, shared as a single frame. One basin, many ingredients.
92
+
93
+ ## Requirements
94
+
95
+ * Node.js **22.18.0+**
96
+ * A modern browser (Chrome, Edge, Firefox, Safari)
97
+
98
+ ***
99
+
100
+ ## Development
101
+
102
+ ```bash
103
+ pnpm install
104
+ pnpm dev # start the local server in watch mode
105
+ pnpm build # build for distribution
106
+ ```
107
+
108
+ ## License
109
+
110
+ [MIT](./LICENSE)
@@ -0,0 +1,224 @@
1
+ Welcome to your new TanStack Start app!
2
+
3
+ # Getting Started
4
+
5
+ To run this application:
6
+
7
+ ```bash
8
+ pnpm install
9
+ pnpm dev
10
+ ```
11
+
12
+ # Building For Production
13
+
14
+ To build this application for production:
15
+
16
+ ```bash
17
+ pnpm build
18
+ ```
19
+
20
+ ## Styling
21
+
22
+ This project uses [Tailwind CSS](https://tailwindcss.com/) for styling.
23
+
24
+ ### Removing Tailwind CSS
25
+
26
+ If you prefer not to use Tailwind CSS:
27
+
28
+ 1. Remove the demo pages in `src/routes/demo/`
29
+ 2. Replace the Tailwind import in `src/styles.css` with your own styles
30
+ 3. Remove `tailwindcss()` from the plugins array in `vite.config.ts`
31
+ 4. Remove `@tailwindcss/vite` and `tailwindcss` from `package.json`
32
+
33
+ ## Linting & Formatting
34
+
35
+ This project uses [Biome](https://biomejs.dev/) for linting and formatting. The following scripts are available:
36
+
37
+
38
+ ```bash
39
+ pnpm lint
40
+ pnpm format
41
+ pnpm check
42
+ ```
43
+
44
+
45
+ ## Deploy to Render
46
+
47
+ This project includes a Render Blueprint:
48
+
49
+ 1. Push this repo to GitHub, GitLab, or Bitbucket
50
+ 2. In Render, choose **New > Blueprint** and connect this repo
51
+ 3. Render reads `render.yaml` and creates the web service
52
+ 4. In the Render Dashboard, add any secrets from `.env.example` under **Environment**
53
+ 5. Deploy
54
+
55
+ The Nitro server handles SSR, server functions, API routes, and static assets.
56
+ Render provides `PORT` automatically; Nitro reads it at runtime.
57
+
58
+ Need a database? Add one from the Render Dashboard, then connect it via
59
+ environment variables. See https://render.com/docs/databases for options.
60
+
61
+
62
+ ## Shadcn
63
+
64
+ Add components using the latest version of [Shadcn](https://ui.shadcn.com/).
65
+
66
+ ```bash
67
+ pnpm dlx shadcn@latest add button
68
+ ```
69
+
70
+
71
+
72
+ ## Routing
73
+
74
+ This project uses [TanStack Router](https://tanstack.com/router) with file-based routing. Routes are managed as files in `src/routes`.
75
+
76
+ ### Adding A Route
77
+
78
+ To add a new route to your application just add a new file in the `./src/routes` directory.
79
+
80
+ TanStack will automatically generate the content of the route file for you.
81
+
82
+ Now that you have two routes you can use a `Link` component to navigate between them.
83
+
84
+ ### Adding Links
85
+
86
+ To use SPA (Single Page Application) navigation you will need to import the `Link` component from `@tanstack/react-router`.
87
+
88
+ ```tsx
89
+ import { Link } from "@tanstack/react-router";
90
+ ```
91
+
92
+ Then anywhere in your JSX you can use it like so:
93
+
94
+ ```tsx
95
+ <Link to="/about">About</Link>
96
+ ```
97
+
98
+ This will create a link that will navigate to the `/about` route.
99
+
100
+ More information on the `Link` component can be found in the [Link documentation](https://tanstack.com/router/v1/docs/framework/react/api/router/linkComponent).
101
+
102
+ ### Using A Layout
103
+
104
+ In the File Based Routing setup the layout is located in `src/routes/__root.tsx`. Anything you add to the root route will appear in all the routes. The route content will appear in the JSX where you render `{children}` in the `shellComponent`.
105
+
106
+ Here is an example layout that includes a header:
107
+
108
+ ```tsx
109
+ import { HeadContent, Scripts, createRootRoute } from '@tanstack/react-router'
110
+
111
+ export const Route = createRootRoute({
112
+ head: () => ({
113
+ meta: [
114
+ { charSet: 'utf-8' },
115
+ { name: 'viewport', content: 'width=device-width, initial-scale=1' },
116
+ { title: 'My App' },
117
+ ],
118
+ }),
119
+ shellComponent: ({ children }) => (
120
+ <html lang="en">
121
+ <head>
122
+ <HeadContent />
123
+ </head>
124
+ <body>
125
+ <header>
126
+ <nav>
127
+ <Link to="/">Home</Link>
128
+ <Link to="/about">About</Link>
129
+ </nav>
130
+ </header>
131
+ {children}
132
+ <Scripts />
133
+ </body>
134
+ </html>
135
+ ),
136
+ })
137
+ ```
138
+
139
+ More information on layouts can be found in the [Layouts documentation](https://tanstack.com/router/latest/docs/framework/react/guide/routing-concepts#layouts).
140
+
141
+ ## Server Functions
142
+
143
+ TanStack Start provides server functions that allow you to write server-side code that seamlessly integrates with your client components.
144
+
145
+ ```tsx
146
+ import { createServerFn } from '@tanstack/react-start'
147
+
148
+ const getServerTime = createServerFn({
149
+ method: 'GET',
150
+ }).handler(async () => {
151
+ return new Date().toISOString()
152
+ })
153
+
154
+ // Use in a component
155
+ function MyComponent() {
156
+ const [time, setTime] = useState('')
157
+
158
+ useEffect(() => {
159
+ getServerTime().then(setTime)
160
+ }, [])
161
+
162
+ return <div>Server time: {time}</div>
163
+ }
164
+ ```
165
+
166
+ ## API Routes
167
+
168
+ You can create API routes by using the `server` property in your route definitions:
169
+
170
+ ```tsx
171
+ import { createFileRoute } from '@tanstack/react-router'
172
+ import { json } from '@tanstack/react-start'
173
+
174
+ export const Route = createFileRoute('/api/hello')({
175
+ server: {
176
+ handlers: {
177
+ GET: () => json({ message: 'Hello, World!' }),
178
+ },
179
+ },
180
+ })
181
+ ```
182
+
183
+ ## Data Fetching
184
+
185
+ There are multiple ways to fetch data in your application. You can use TanStack Query to fetch data from a server. But you can also use the `loader` functionality built into TanStack Router to load the data for a route before it's rendered.
186
+
187
+ For example:
188
+
189
+ ```tsx
190
+ import { createFileRoute } from '@tanstack/react-router'
191
+
192
+ export const Route = createFileRoute('/people')({
193
+ loader: async () => {
194
+ const response = await fetch('https://swapi.dev/api/people')
195
+ return response.json()
196
+ },
197
+ component: PeopleComponent,
198
+ })
199
+
200
+ function PeopleComponent() {
201
+ const data = Route.useLoaderData()
202
+ return (
203
+ <ul>
204
+ {data.results.map((person) => (
205
+ <li key={person.name}>{person.name}</li>
206
+ ))}
207
+ </ul>
208
+ )
209
+ }
210
+ ```
211
+
212
+ Loaders simplify your data fetching logic dramatically. Check out more information in the [Loader documentation](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#loader-parameters).
213
+
214
+
215
+ # Demo files
216
+
217
+ Files prefixed with `demo` can be safely deleted. They are there to provide a starting point for you to play around with the features you've installed.
218
+
219
+
220
+ # Learn More
221
+
222
+ You can learn more about all of the offerings from TanStack in the [TanStack documentation](https://tanstack.com).
223
+
224
+ For TanStack Start specific documentation, visit [TanStack Start](https://tanstack.com/start).
package/README.zh.md ADDED
@@ -0,0 +1,107 @@
1
+ # ๐Ÿฅ˜ ็›†่œ๏ผˆpoon-choi๏ผ‰
2
+
3
+ [English](./README.md) | ไธญๆ–‡
4
+
5
+ > ไธ€ไธช่ฝป้‡ๆœฌๅœฐๆœๅŠก๏ผŒๆŠŠๅคšๅผ ๅ›พ็‰‡ๆ‹ผๅˆๆˆๅพฎไฟกๅฐ้ขโ€”โ€”ๅฐฑๅƒไธ€ไปฝ**็›†่œ**๏ผŒไธ€้’ตๅฎน็บณๅคš็งไธๅŒ้ฃŸๆใ€‚
6
+
7
+ [![npm version](https://img.shields.io/npm/v/poon-choi.svg)](https://www.npmjs.com/package/poon-choi)
8
+ [![npm downloads](https://img.shields.io/npm/dm/poon-choi.svg)](https://www.npmjs.com/package/poon-choi)
9
+ [![license](https://img.shields.io/npm/l/poon-choi.svg)](./LICENSE)
10
+
11
+ **poon-choi๏ผˆ็›†่œ๏ผ‰** ๆ˜ฏไธ€้“็ฒค่œ๏ผŒๅคš็ง้ฃŸๆ็ ๅœจๅŒไธ€ไธช็›†้‡Œ๏ผŒ็”ฑไธŠ่‡ณไธ‹ไบซ็”จใ€‚่ฟ™ไธชๅทฅๅ…ทไนŸๆ˜ฏๅŒ็†๏ผšๆ”พๅ…ฅ 1โ€“6 ๅผ ๅ›พ็‰‡๏ผŒๅฎƒไผš่‡ชๅŠจๆ‹ผๅ‡บไธ€ๅผ  **2.35:1 ็š„ๅพฎไฟกๅฐ้ข๏ผˆ900ร—383๏ผ‰**๏ผŒๅŒๆ—ถ็”Ÿๆˆไธ€ๅผ  **1:1 ็š„็ผฉ็•ฅๅ›พ๏ผˆ383ร—383๏ผ‰**ใ€‚
12
+
13
+ ๆ— ้œ€ๆž„ๅปบๆต็จ‹๏ผŒไธ็”จ้ขๅค–้…็ฝฎ๏ผŒไธ€ๆกๅ‘ฝไปคๅณๅฏๅฏๅŠจๆœฌๅœฐๆœๅŠกใ€‚
14
+
15
+ ## ๅฟซ้€ŸไธŠๆ‰‹
16
+
17
+ ```bash
18
+ pnpx poon-choi
19
+ ```
20
+
21
+ ๅทฅๅ…ทไผšๅœจๆœฌๅœฐ็ซฏๅฃๅฏๅŠจ๏ผŒๅนถ่พ“ๅ‡บ่ฎฟ้—ฎ้“พๆŽฅ๏ผŒไน‹ๅŽ็›ดๆŽฅๆŠŠๅ›พ็‰‡ๆ‹–ๅ…ฅ้กต้ขๅณๅฏใ€‚
22
+
23
+ ### ๆŒ‡ๅฎš็ซฏๅฃ
24
+
25
+ ```bash
26
+ pnpx poon-choi --port 5173
27
+ ```
28
+
29
+ ## ไฝฟ็”จๆ–นๅผ
30
+
31
+ ```bash
32
+ poon-choi [้€‰้กน]
33
+
34
+ ้€‰้กน๏ผš
35
+ -p, --port <ๆ•ฐๅญ—> ็›‘ๅฌ็ซฏๅฃ๏ผˆ้ป˜่ฎค๏ผš3000๏ผ‰
36
+ -h, --help ๅฑ•็คบๅธฎๅŠฉไฟกๆฏ
37
+ -v, --version ๆŸฅ็œ‹็‰ˆๆœฌ
38
+ ```
39
+
40
+ ### ไฝฟ็”จ็คบไพ‹
41
+
42
+ ```bash
43
+ # ไฝฟ็”จ้ป˜่ฎค็ซฏๅฃ
44
+ pnpx poon-choi
45
+
46
+ # ๆŒ‡ๅฎš่‡ชๅฎšไน‰็ซฏๅฃ
47
+ pnpx poon-choi --port 5173
48
+
49
+ # ไฝฟ็”จ็Ÿญๅ‚ๆ•ฐ
50
+ pnpx poon-choi -p 3000
51
+ ```
52
+
53
+ ็„ถๅŽๅœจๆต่งˆๅ™จๆ‰“ๅผ€่พ“ๅ‡บ็š„้“พๆŽฅ๏ผŒไพ‹ๅฆ‚ `[http://localhost:5173](http://localhost:5173)`ใ€‚
54
+
55
+ >
56
+ > ๆƒณ่ฆๅ…จๅฑ€ๅฎ‰่ฃ…๏ผŸ
57
+ >
58
+ >
59
+ > ```bash
60
+ > npm i -g poon-choi
61
+ > poon-choi --port 5173
62
+ > ```
63
+
64
+ ## ๅŠŸ่ƒฝ่ฏดๆ˜Ž
65
+
66
+ - **ๅฏผๅ…ฅ** โ€” ๆ”ฏๆŒๆ‹–ๆ‹ฝไธŠไผ ใ€็‚นๅ‡ป้€‰ๆ‹ฉๆˆ–่€…ๅ‰ช่ดดๆฟ็ฒ˜่ดดใ€‚ๆœ€ๅคšไธŠไผ  **6 ๅผ ๅ›พ็‰‡**๏ผŒ่ถ…ๅ‡บ้ƒจๅˆ†ไผš้€š่ฟ‡ๅผน็ช—ๆ็คบๅนถๅฟฝ็•ฅ๏ผ›้žๅ›พ็‰‡ๆ–‡ไปถใ€ๆŸๅๆ–‡ไปถไผšๅ•็‹ฌ่ทณ่ฟ‡ใ€‚
67
+ - **ๅธƒๅฑ€** โ€” ๆ นๆฎๅ›พ็‰‡ๆ•ฐ้‡่‡ชๅŠจๆŽ’็‰ˆ๏ผš
68
+
69
+ | ๅ›พ็‰‡ๆ•ฐ้‡ | ๅธƒๅฑ€ๆ–นๅผ |
70
+ | --- | --- |
71
+ | 1 | ๅ…จๅฑ่ฃๅˆ‡้“บๆปก |
72
+ | 2 | ็ญ‰ๅฎฝไธคๅˆ— |
73
+ | 3 | ็ญ‰ๅฎฝไธ‰ๅˆ— |
74
+ | 4 | 2ร—2 ็ฝ‘ๆ ผ |
75
+ | 5โ€“6 | 3ร—2 ็ฝ‘ๆ ผ๏ผˆ5 ๅผ ๆ—ถๆœ€ๅŽไธ€ๆ ผ็•™็ฉบ๏ผ‰ |
76
+
77
+ - **ๅกซๅ……ๆจกๅผ** โ€” `Cover`๏ผˆๅฑ…ไธญ่ฃๅˆ‡๏ผŒๅกซๆปกๆ ผๅญ๏ผ‰ๆˆ–่€… `Contain`๏ผˆๅฎŒๆ•ดๅฑ•็คบๅ›พ็‰‡๏ผŒ็•™็™ฝไฝฟ็”จ้—ด้š™่‰ฒๅกซๅ……๏ผ‰๏ผŒ้šๆ—ถๅˆ‡ๆขใ€‚
78
+ - **้—ด้š™้ขœ่‰ฒ** โ€” ๆ‹พ่‰ฒๅ™จใ€ๅธฆ่‰ฒๅก็š„้ข„่ฎพ่ฐƒ่‰ฒๆฟ๏ผŒ่ฟ˜ๆœ‰ไธ€้”ฎ่ฝฎๆข้ข„่ฎพ้ขœ่‰ฒ็š„ๆŒ‰้’ฎใ€‚
79
+ - **ๅˆ†้š”่พน** โ€” ๆฏไธชๆ ผๅญๅธฆๆœ‰็ป†ๅพฎ็š„ 1 ๅƒ็ด ๅ†…่พน็บฟ๏ผŒ็™ฝๅบ•ๅ›พ็‰‡ๅ ๅŠ ๅœจไธ€่ตทๆ—ถไนŸ่ƒฝๅˆ†ๆธ…่พน็•Œใ€‚
80
+ - **่ฐƒๆ•ด้กบๅบ** โ€” ๆ‹–ๆ‹ฝ็ผฉ็•ฅๅ›พ่‡ช็”ฑๆŽ’ๅบ๏ผ›็‚นๅ‡ป ร— ๅˆ ้™คๅ›พ็‰‡ใ€‚่งฆๅฑ่ฎพๅค‡ไผšๆ˜พ็คบๅทฆๅณๅˆ‡ๆขๆŒ‰้’ฎใ€‚
81
+ - **ๅฏผๅ‡บ**
82
+ - `wechat-cover-900x383.jpg` โ€” 2.35:1 ๅฐ้ขๅ›พ
83
+ - `wechat-cover-thumbnail-383x383.jpg` โ€” ๅฑ…ไธญ่ฃๅˆ‡็š„ 1:1 ็ผฉ็•ฅๅ›พ
84
+ - ่พ“ๅ‡บไธบ JPEG๏ผŒ็”ป่ดจ็บฆ 0.92๏ผ›้ข„่งˆ้€‚้…่ฎพๅค‡ๅƒ็ด ๆฏ”๏ผŒๅฏผๅ‡บๅฐบๅฏธไธฅๆ ผ็ฌฆๅˆๅƒ็ด ่ง„ๆ ผใ€‚
85
+
86
+ ## ไธบไป€ไนˆๅซโ€œ็›†่œโ€๏ผŸ
87
+
88
+ ็›†่œๆ˜ฏๆฑ‡่šไผ—ๅคš้ฃŸๆ็š„ๅคง็›†๏ผšๅบ•ๅฑ‚ๆ”พ่ๅœใ€่Š‹ๅคดๅธ้ฅฑๆฑคๆฑ๏ผŒ้ฒ้ฑผใ€ๅคง่™พ่ฟ™็ฑปๅ่ดต้ฃŸๆๆ‘†ๅœจ้กถๅฑ‚ใ€‚่ฟ™ไธชๅทฅๅ…ทๆŠŠไฝ ็š„ๅ›พ็‰‡่ฃ…่ฟ›ๅŒไธ€ไธชโ€œ็›†็Šถโ€ๅฐ้ข๏ผŒๆฏๅผ ๅ›พ็‰‡ๅ„่‡ชไธ€ๆ ผ๏ผŒๅˆๅนถๆˆไธ€ๆ•ดๅผ ๅ›พใ€‚ไธ€้’ต็››็™พๅ‘ณใ€‚
89
+
90
+ ## ็Žฏๅขƒ่ฆๆฑ‚
91
+
92
+ - Node.js **22.18.0+**
93
+ - ็Žฐไปฃๆต่งˆๅ™จ๏ผˆChromeใ€Edgeใ€Firefoxใ€Safari๏ผ‰
94
+
95
+ ---
96
+
97
+ ## ๅผ€ๅ‘
98
+
99
+ ```bash
100
+ pnpm install
101
+ pnpm dev # ๅฏๅŠจ็›‘ๅฌๆจกๅผ็š„ๆœฌๅœฐๆœๅŠก
102
+ pnpm build # ๆ‰“ๅŒ…ๅ‘ๅธƒ็‰ˆๆœฌ
103
+ ```
104
+
105
+ ## ่ฎธๅฏ่ฏ
106
+
107
+ [MIT](./LICENSE)
package/bin/index.ts ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+
3
+ // vite dev --port 3000
4
+
5
+ import { spawn } from 'node:child_process';
6
+ import { parseArgs } from 'node:util';
7
+
8
+ main();
9
+
10
+ function main() {
11
+ const { values } = parseArgs({
12
+ options: {
13
+ port: {
14
+ short: 'p',
15
+ type: 'string',
16
+ default: '3000',
17
+ },
18
+ },
19
+ });
20
+
21
+ console.log(values);
22
+
23
+ const port = Number(values.port);
24
+ // validate port in a valid range
25
+ const valid = port >= 1024 && port <= 65535
26
+ if (!valid) {
27
+ console.error(`Invalid port number ${values.port}, should be between 1024 and 65535`);
28
+ process.exitCode =1;
29
+
30
+ return
31
+ }
32
+
33
+ spawn('npx', ['vite', 'dev', `--port=${port}`], {
34
+ stdio: 'inherit',
35
+ shell: true,
36
+ })
37
+ }
package/package.json CHANGED
@@ -1,6 +1,67 @@
1
1
  {
2
2
  "name": "poon-choi",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.1",
4
+ "description": "poon-choi ๐Ÿฒ is a wechat-cover-studio: a cover mosaic tool to generate wechat (2.35:1) cover image using multiple images",
5
+ "private": false,
6
+ "type": "module",
7
+ "imports": {
8
+ "#/*": "./src/*"
9
+ },
10
+ "bin": {
11
+ "poon-choi": "./bin/index.ts"
12
+ },
13
+ "files": [
14
+ "bin/",
15
+ "src/"
16
+ ],
17
+ "scripts": {
18
+ "dev": "vite dev --port 3000",
19
+ "generate-routes": "tsr generate",
20
+ "build": "vite build",
21
+ "preview": "vite preview",
22
+ "format": "biome format",
23
+ "lint": "biome lint",
24
+ "check": "biome check",
25
+ "start": "node .output/server/index.mjs",
26
+ "test": "echo no test yet",
27
+ "pub:patch": "npm version patch",
28
+ "pub:minor": "npm version minor",
29
+ "pub:major": "npm version major",
30
+ "preversion": "npm test",
31
+ "postversion": "npm publish && git push && git push --tags"
32
+ },
33
+ "dependencies": {
34
+ "@tailwindcss/vite": "^4.1.18",
35
+ "@tanstack/react-devtools": "0.10.13",
36
+ "@tanstack/react-router": "1.170.46",
37
+ "@tanstack/react-router-devtools": "1.167.2",
38
+ "@tanstack/react-start": "1.169.4",
39
+ "class-variance-authority": "^0.7.1",
40
+ "clsx": "^2.1.1",
41
+ "lucide-react": "^0.577.0",
42
+ "nitro": "3.0.260610-beta",
43
+ "react": "^19.2.0",
44
+ "react-dom": "^19.2.0",
45
+ "tailwind-merge": "^3.0.2",
46
+ "tailwindcss": "^4.1.18",
47
+ "tw-animate-css": "^1.3.6"
48
+ },
49
+ "devDependencies": {
50
+ "@biomejs/biome": "2.4.5",
51
+ "@tailwindcss/typography": "^0.5.16",
52
+ "@tanstack/devtools-vite": "0.8.5",
53
+ "@tanstack/router-cli": "^1.132.0",
54
+ "@types/node": "^22.10.2",
55
+ "@types/react": "^19.2.0",
56
+ "@types/react-dom": "^19.2.0",
57
+ "@vitejs/plugin-react": "^6.0.1",
58
+ "typescript": "^6.0.2",
59
+ "vite": "^8.0.0"
60
+ },
61
+ "pnpm": {
62
+ "onlyBuiltDependencies": [
63
+ "esbuild",
64
+ "lightningcss"
65
+ ]
66
+ }
67
+ }
@@ -0,0 +1,64 @@
1
+ /** biome-ignore-all lint/a11y/noStaticElementInteractions: <explanation> */
2
+ /** biome-ignore-all lint/a11y/useKeyWithClickEvents: <explanation> */
3
+
4
+ import { useRef, useState } from 'react'
5
+
6
+ type Props = {
7
+ items: unknown[]
8
+ children: React.ReactNode
9
+ onFiles: (files: FileList) => void // โฌ…๏ธ ๅฏนๅบ” addFiles
10
+ id?: string
11
+ }
12
+
13
+ export function DropStage({ items, children, onFiles }: Props) {
14
+ const dragDepth = useRef(0)
15
+ const [isDragOver, setIsDragOver] = useState(false)
16
+
17
+ const handleDragEnter = (e: React.DragEvent) => {
18
+ if (e.dataTransfer && Array.from(e.dataTransfer.types).includes('Files')) {
19
+ e.preventDefault()
20
+ dragDepth.current += 1
21
+ setIsDragOver(true)
22
+ }
23
+ }
24
+
25
+ const handleDragover = (e: React.DragEvent) => {
26
+ if (e.dataTransfer && Array.from(e.dataTransfer.types).includes('Files')) {
27
+ e.preventDefault()
28
+ e.dataTransfer.dropEffect = 'copy'
29
+ }
30
+ }
31
+ const handleDragLeave = (_e: React.DragEvent) => {
32
+ dragDepth.current = Math.max(0, dragDepth.current - 1)
33
+ if (dragDepth.current === 0) setIsDragOver(false)
34
+ }
35
+ const handleDrop = (e: React.DragEvent) => {
36
+ if (e.dataTransfer && Array.from(e.dataTransfer.types).includes('Files')) {
37
+ e.preventDefault()
38
+ dragDepth.current = 0
39
+ setIsDragOver(false)
40
+ onFiles(e.dataTransfer.files)
41
+ }
42
+ }
43
+
44
+ const className = [
45
+ 'stage',
46
+ items.length > 0 && 'has-image',
47
+ isDragOver && 'dragover',
48
+ ]
49
+ .filter(Boolean)
50
+ .join(' ')
51
+
52
+ return (
53
+ <div
54
+ className={className}
55
+ id="stage"
56
+ onDragEnter={(event) => handleDragEnter(event)}
57
+ onDragLeave={handleDragLeave}
58
+ onDragOver={handleDragover}
59
+ onDrop={handleDrop}
60
+ >
61
+ {children}
62
+ </div>
63
+ )
64
+ }
@@ -0,0 +1,34 @@
1
+ import type { FitMode } from '#/lib/draw'
2
+
3
+ /**
4
+ * ๅ—ๆŽง็š„ๆจกๅผๅˆ‡ๆขๆŒ‰้’ฎใ€‚
5
+ * value: 'cover' | 'contain'
6
+ * onChange: (next: 'cover' | 'contain') => void
7
+ */
8
+ export function FitModeToggle({
9
+ value,
10
+ onChange,
11
+ className = '',
12
+ }: {
13
+ value: FitMode
14
+ onChange: (next: FitMode) => void
15
+ className?: string
16
+ }) {
17
+ const next = value === 'cover' ? 'contain' : 'cover'
18
+ const label = value === 'cover' ? 'Cover' : 'Contain'
19
+ return (
20
+ <button
21
+ type="button"
22
+ onClick={() => onChange(next)}
23
+ aria-pressed={value === 'contain'}
24
+ className={
25
+ 'cursor-pointer ' +
26
+ 'px-4 py-2.5 rounded-lg text-sm font-medium bg-white text-slate-700 ' +
27
+ 'border border-slate-200 transition hover:bg-slate-50 ' +
28
+ className
29
+ }
30
+ >
31
+ ่ฃๅ‰ชๆจกๅผ๏ผš{label}
32
+ </button>
33
+ )
34
+ }
@@ -0,0 +1,44 @@
1
+ export default function Footer() {
2
+ const year = new Date().getFullYear()
3
+
4
+ return (
5
+ <footer className="mt-20 border-t border-[var(--line)] px-4 pb-14 pt-10 text-[var(--sea-ink-soft)]">
6
+ <div className="page-wrap flex flex-col items-center justify-between gap-4 text-center sm:flex-row sm:text-left">
7
+ <p className="m-0 text-sm">
8
+ &copy; {year} Your name here. All rights reserved.
9
+ </p>
10
+ <p className="island-kicker m-0">Built with TanStack Start</p>
11
+ </div>
12
+ <div className="mt-4 flex justify-center gap-4">
13
+ <a
14
+ href="https://x.com/tan_stack"
15
+ target="_blank"
16
+ rel="noreferrer"
17
+ className="rounded-xl p-2 text-[var(--sea-ink-soft)] transition hover:bg-[var(--link-bg-hover)] hover:text-[var(--sea-ink)]"
18
+ >
19
+ <span className="sr-only">Follow TanStack on X</span>
20
+ <svg viewBox="0 0 16 16" aria-hidden="true" width="32" height="32">
21
+ <path
22
+ fill="currentColor"
23
+ d="M12.6 1h2.2L10 6.48 15.64 15h-4.41L7.78 9.82 3.23 15H1l5.14-5.84L.72 1h4.52l3.12 4.73L12.6 1zm-.77 12.67h1.22L4.57 2.26H3.26l8.57 11.41z"
24
+ />
25
+ </svg>
26
+ </a>
27
+ <a
28
+ href="https://github.com/TanStack"
29
+ target="_blank"
30
+ rel="noreferrer"
31
+ className="rounded-xl p-2 text-[var(--sea-ink-soft)] transition hover:bg-[var(--link-bg-hover)] hover:text-[var(--sea-ink)]"
32
+ >
33
+ <span className="sr-only">Go to TanStack GitHub</span>
34
+ <svg viewBox="0 0 16 16" aria-hidden="true" width="32" height="32">
35
+ <path
36
+ fill="currentColor"
37
+ d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z"
38
+ />
39
+ </svg>
40
+ </a>
41
+ </div>
42
+ </footer>
43
+ )
44
+ }