gradiente 1.0.2 → 2.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.
Files changed (5) hide show
  1. package/README.md +94 -175
  2. package/dist/index.d.mts +363 -291
  3. package/dist/index.mjs +1534 -1284
  4. package/package.json +16 -13
  5. package/LICENSE +0 -21
package/README.md CHANGED
@@ -1,175 +1,94 @@
1
- ![gradiente](https://raw.githubusercontent.com/Flowscape-UI/gradiente/fff32510afe7e3e1b7b2f73dbf7246843a06d859/assets/logo.svg)
2
-
3
- <a href="https://www.npmjs.com/package/gradiente">
4
- <img src="https://img.shields.io/npm/v/gradiente.svg?style=flat-square&labelColor=d84f4c&color=black" alt="npm version">
5
- </a>
6
- <a href="https://bundlephobia.com/result?p=gradiente">
7
- <img src="https://img.shields.io/bundlephobia/minzip/gradiente?style=flat-square&labelColor=d84f4c&color=black" alt="bundle size">
8
- </a>
9
- <a href="https://www.npmjs.com/package/gradiente">
10
- <img src="https://img.shields.io/npm/dw/gradiente?style=flat-square&labelColor=d84f4c&color=black" alt="weekly downloads">
11
- </a>
12
-
13
-
14
- # Gradiente
15
-
16
- **Gradiente** is a lightweight gradient engine for turning CSS gradients into clean, normalized data structures.
17
-
18
- It is built for rendering systems, visual editors, and developer tools where gradients need to be more than just strings.
19
-
20
- > **Gradients as data, not strings.**
21
-
22
- ---
23
-
24
- ## Installation
25
-
26
- ```bash
27
- npm install gradiente
28
- bun add gradiente
29
- pnpm add gradiente
30
- yarn add gradiente
31
- ```
32
-
33
- ---
34
-
35
- ## Quick Example
36
-
37
- ```ts
38
- import { parse } from 'gradiente';
39
-
40
- const gradient = parse('linear-gradient(red, blue)');
41
- ```
42
-
43
- ## Result:
44
-
45
- ```ts
46
- {
47
- kind: 'linear',
48
- repeat: 'normal',
49
- direction: {
50
- kind: 'angle',
51
- value: { kind: 'dimension', value: 0, unit: 'deg' },
52
- valueRaw: { kind: 'dimension', value: 0, unit: 'rad' },
53
- keywords: ['to', 'top']
54
- },
55
- stops: [
56
- {
57
- kind: 'color-stop',
58
- color: 'red',
59
- position: { kind: 'percentage', value: 0 }
60
- },
61
- {
62
- kind: 'color-stop',
63
- color: 'blue',
64
- position: { kind: 'percentage', value: 1 }
65
- }
66
- ]
67
- }
68
- ```
69
-
70
- ---
71
-
72
- ## Supported Gradients
73
-
74
- Gradiente currently supports:
75
-
76
- ```ts
77
- parse('linear-gradient(...)')
78
- parse('repeating-linear-gradient(...)')
79
-
80
- parse('radial-gradient(...)')
81
- parse('repeating-radial-gradient(...)')
82
-
83
- parse('conic-gradient(...)')
84
- parse('repeating-conic-gradient(...)')
85
- ```
86
-
87
- ---
88
-
89
- ## What Gradiente Does
90
-
91
- ### Parses gradients into structured objects
92
-
93
- ```ts
94
- import { parse } from 'gradiente';
95
-
96
- const gradient = parse('conic-gradient(from 45deg, red, blue)');
97
- ```
98
-
99
- Instead of getting a raw string you have to manually interpret, you get real data you can work with.
100
-
101
- ---
102
-
103
- ### Keeps values renderer-friendly
104
-
105
- Angles and positions are normalized into a stable internal representation so they are easier to use in:
106
-
107
- * Canvas
108
- * WebGL
109
- * Pixi
110
- * Konva
111
- * custom graphics engines
112
-
113
-
114
-
115
- ## Design Goals
116
-
117
- Gradiente is built around a few core ideas:
118
-
119
- * **Simple external API**
120
- * **Normalized internal model**
121
- * **Predictable stop data**
122
- * **Useful for real rendering systems**
123
- * **Easy to extend for future gradient types**
124
-
125
- It is not trying to be a full browser CSS engine.
126
-
127
- It is trying to be a practical gradient engine for developers.
128
-
129
- ---
130
-
131
- ## Built For
132
-
133
- Gradiente is especially useful for:
134
-
135
- * design tools
136
- * visual editors
137
- * whiteboards
138
- * canvas engines
139
- * procedural graphics
140
- * charting and data visualization systems
141
- * custom render pipelines
142
-
143
- ---
144
-
145
- ## Current Status
146
-
147
- Implemented:
148
-
149
- * linear gradients
150
- * repeating linear gradients
151
- * radial gradients
152
- * repeating radial gradients
153
- * conic gradients
154
- * repeating conic gradients
155
- * stop normalization
156
- * repeating stop expansion
157
-
158
- Planned:
159
-
160
- * gradient serialization
161
- * gradient sampling
162
- * playground / live preview
163
- * docs website
164
-
165
- ---
166
-
167
- ## Philosophy
168
-
169
- Gradiente treats gradients as a structured graphics primitive.
170
-
171
- Not a string to preserve.
172
- Not a browser quirk to emulate.
173
- A piece of graphics data you can actually use.
174
-
175
- > **Build gradients like an engine, not like a stylesheet.**
1
+ <div align="center">
2
+
3
+ <img src="https://raw.githubusercontent.com/Flowscape-UI/gradiente/fff32510afe7e3e1b7b2f73dbf7246843a06d859/assets/logo.svg" alt="gradiente logo" />
4
+
5
+ <h1>gradiente</h1>
6
+
7
+ <p>Minimalist & lightweight engine for sophisticated web gradients</p>
8
+
9
+ <img src="https://raw.githubusercontent.com/Flowscape-UI/gradiente/d8429051f700698f664d8d2392cfa58a604f8e83/assets/flowscape-badge.svg" alt="npm version" />
10
+ <br />
11
+
12
+ <a href="https://www.npmjs.com/package/gradiente">
13
+ <img src="https://img.shields.io/npm/v/gradiente.svg?style=flat-square&labelColor=d84f4c&color=black" alt="npm version">
14
+ </a>
15
+ <a href="https://bundlephobia.com/result?p=gradiente">
16
+ <img src="https://img.shields.io/bundlephobia/minzip/gradiente?style=flat-square&labelColor=d84f4c&color=black" alt="bundle size"/>
17
+ </a>
18
+ <a href="https://github.com/Flowscape-UI/gradiente/blob/main/LICENSE">
19
+ <img src="https://img.shields.io/github/license/Flowscape-UI/gradiente?style=flat-square&labelColor=d84f4c&color=black" alt="license"/>
20
+ </a>
21
+ </div>
22
+
23
+
24
+ # Gradiente
25
+
26
+ **Gradiente** is a lightweight gradient parser and transformer for modern rendering systems.
27
+
28
+ Parse CSS gradients → work with structured data → render anywhere.
29
+
30
+ > Gradients as data, not strings.
31
+
32
+
33
+ ## Install
34
+
35
+ ```bash
36
+ npm install gradiente
37
+ ```
38
+
39
+
40
+ ## Example
41
+
42
+ ```ts
43
+ import { parse, transformTo } from "gradiente";
44
+
45
+ const gradient = parse("linear-gradient(red, blue)");
46
+
47
+ const css = transformTo("css", gradient);
48
+ const canvas = transformTo("canvas", gradient);
49
+
50
+ canvas.draw(ctx, 300, 300);
51
+ ```
52
+
53
+ The full documentation is published on [gradiente docs](https://flowscape-ui.github.io/gradiente/). Some quick entry points:
54
+
55
+ - [Getting started](https://flowscape-ui.github.io/gradiente/getting-started.html)
56
+ - [API References](https://flowscape-ui.github.io/gradiente/core-api/working-with-gradients.html)
57
+ - [Custom Gradients](https://flowscape-ui.github.io/gradiente/core-api/custom-gradients.html)
58
+
59
+
60
+ ## What it does
61
+
62
+ - Parses gradients into structured objects
63
+ - Normalizes angles, positions, and stops
64
+ - Transforms gradients to different targets:
65
+ - CSS
66
+ - Canvas
67
+ - (more coming)
68
+
69
+ ---
70
+
71
+ ## Built for
72
+
73
+ * design tools
74
+ * visual editors
75
+ * canvas engines
76
+ * WebGL / Pixi / Konva
77
+ * custom rendering pipelines
78
+
79
+ ---
80
+
81
+ ## Philosophy
82
+
83
+ Gradiente treats gradients as a graphics primitive.
84
+
85
+ Not a string to preserve -
86
+ but data you can transform and render anywhere.
87
+
88
+ ## Contributing
89
+
90
+ Contributions of all kinds (feedback, ideas, bug fixes, documentation) are welcome.
91
+
92
+ Please open a GitHub issue/discussion before putting in any work that’s not straightforward.
93
+
94
+ More in [CONTRIBUTING.md](../../CONTRIBUTING.md).