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.
- package/README.md +94 -175
- package/dist/index.d.mts +363 -291
- package/dist/index.mjs +1534 -1284
- package/package.json +16 -13
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -1,175 +1,94 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
</
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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).
|