@bace51/cocktailjs-react 1.0.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 ADDED
@@ -0,0 +1,75 @@
1
+ # cocktailjs-react
2
+
3
+ Lightweight React components for rendering cocktail glasses and liquids as SVG.
4
+
5
+ This package exports React components (SVG) for a variety of glasses and a `Liquid` helper used to render fills.
6
+
7
+ **Installation**
8
+
9
+ Install the package and add React as a peer dependency:
10
+
11
+ ```bash
12
+ pnpm add cocktailjs-react
13
+ # or
14
+ # npm install cocktailjs-react
15
+ ```
16
+
17
+ Note: `react` and `react-dom` are peer dependencies; install them in your app if not present.
18
+
19
+ **Basic usage**
20
+
21
+ ```jsx
22
+ import React from "react";
23
+ import { WhiskeyShotGlass, Liquid } from "cocktailjs-react";
24
+
25
+ export default function Example() {
26
+ return (
27
+ <div>
28
+ <WhiskeyShotGlass size={120} liquidFill={["#b5651d", "#8b4513"]} />
29
+ <Liquid level={0.6} highlight highlightColor="#fff" />
30
+ </div>
31
+ );
32
+ }
33
+ ```
34
+
35
+ You can also import any glass component directly:
36
+
37
+ ```jsx
38
+ import { MartiniGlass } from "cocktailjs-react";
39
+ <MartiniGlass size={200} liquidFill={["#f6d365", "#fda085"]} />;
40
+ ```
41
+
42
+ **`Liquid` props**
43
+
44
+ - `level` (number): fill level 0..1
45
+ - `highlight` (boolean): adds highlight overlay
46
+ - `highlightColor` (string): color for the highlight
47
+ - `stopPositions` (array): gradient stop offsets
48
+
49
+ **Development / Playground**
50
+
51
+ This repository includes a Vite playground (in `playground/`) that runs on port 5173. To run the playground locally from the repo root:
52
+
53
+ ```bash
54
+ pnpm install
55
+ pnpm run dev:with-playground
56
+ # Admin server runs at http://localhost:3004 and playground at http://localhost:5173
57
+ ```
58
+
59
+ **Build & publish**
60
+
61
+ The package includes esbuild-based scripts to generate ESM and CJS bundles into `dist/`.
62
+
63
+ ```bash
64
+ pnpm --filter ./packages/cocktailjs-react run build
65
+ pnpm --filter ./packages/cocktailjs-react run build:cjs
66
+ # or publish (prepare script runs build):
67
+ pnpm publish --filter ./packages/cocktailjs-react
68
+ ```
69
+
70
+ **Notes**
71
+
72
+ - The package exposes both ESM (`dist/index.mjs`) and CJS (`dist/index.cjs.js`) bundles.
73
+ - Keep `react` as a peer dependency to avoid duplicate React instances in consumer apps.
74
+
75
+ If you need help integrating the components or want additional examples, open an issue or request an example in the repo.