@nexxtmove/ui 2.2.0 → 2.3.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/dist/components/editor/molecules/EditorBackgroundSize/EditorBackgroundSize.vue.d.ts +2 -2
- package/dist/components/editor/molecules/EditorBlur/EditorBlur.vue.d.ts +2 -2
- package/dist/components/editor/molecules/EditorColor/EditorColor.vue.d.ts +44 -20
- package/dist/components/editor/molecules/EditorColor/_ColorField.vue.d.ts +66 -0
- package/dist/components/editor/molecules/EditorColor/colorClass.d.ts +46 -0
- package/dist/components/editor/molecules/EditorColor/gradientClass.d.ts +80 -0
- package/dist/components/editor/molecules/EditorGap/EditorGap.vue.d.ts +2 -2
- package/dist/components/editor/molecules/EditorMaxWidth/EditorMaxWidth.vue.d.ts +2 -2
- package/dist/components/editor/molecules/EditorShadow/EditorShadow.vue.d.ts +2 -2
- package/dist/components/organisms/ColorPicker/ColorPicker.vue.d.ts +58 -2
- package/dist/components/organisms/ColorPicker/_GradientField.vue.d.ts +23 -0
- package/dist/components/organisms/ColorPicker/_GradientPreview.vue.d.ts +11 -0
- package/dist/components/organisms/ColorPicker/_GradientStopRow.vue.d.ts +21 -0
- package/dist/components/organisms/ColorPicker/_GradientStops.vue.d.ts +19 -0
- package/dist/components/organisms/ColorPicker/gradient.d.ts +189 -0
- package/dist/components/organisms/ColorPicker/gradientGeometry.d.ts +101 -0
- package/dist/components/organisms/ColorPicker/useGradientEditor.d.ts +89 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +3392 -2082
- package/package.json +1 -1
- package/src/components/editor/molecules/EditorColor/EditorColor.vue +83 -171
- package/src/components/editor/molecules/EditorColor/_ColorField.vue +445 -0
- package/src/components/editor/molecules/EditorColor/colorClass.ts +61 -0
- package/src/components/editor/molecules/EditorColor/gradientClass.ts +225 -0
- package/src/components/molecules/ToggleGroup/ToggleGroup.vue +6 -2
- package/src/components/organisms/ColorPicker/ColorPicker.vue +673 -271
- package/src/components/organisms/ColorPicker/_GradientField.vue +93 -0
- package/src/components/organisms/ColorPicker/_GradientPreview.vue +401 -0
- package/src/components/organisms/ColorPicker/_GradientStopRow.vue +181 -0
- package/src/components/organisms/ColorPicker/_GradientStops.vue +218 -0
- package/src/components/organisms/ColorPicker/gradient.ts +303 -0
- package/src/components/organisms/ColorPicker/gradientGeometry.ts +216 -0
- package/src/components/organisms/ColorPicker/useGradientEditor.ts +358 -0
- package/src/index.ts +25 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The gradient of NexxtColorPicker's gradient mode, as plain data. The picker
|
|
3
|
+
* knows no class names: a wrapper such as NexxtEditorColor turns this into
|
|
4
|
+
* whatever it stores.
|
|
5
|
+
*/
|
|
6
|
+
/** A named colour a stop can be bound to, such as a theme role. Always opaque. */
|
|
7
|
+
export interface ColorPickerPreset {
|
|
8
|
+
/** What the wrapper knows the preset by, such as `'main'`. */
|
|
9
|
+
key: string;
|
|
10
|
+
/** Name of the preset as the user reads it, announced on the stop's handle. */
|
|
11
|
+
label: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ColorPickerGradientStop {
|
|
14
|
+
/** The colour as `#rrggbb`, or `#rrggbbaa` below full opacity; lower case. */
|
|
15
|
+
color: string;
|
|
16
|
+
/** Whole percentage, 0–100. */
|
|
17
|
+
position: number;
|
|
18
|
+
/** Set when the stop is bound to a preset; `color` is then the preset's hex. */
|
|
19
|
+
preset?: ColorPickerPreset;
|
|
20
|
+
}
|
|
21
|
+
export interface ColorPickerGradient {
|
|
22
|
+
type: 'linear' | 'radial';
|
|
23
|
+
/** Whole degrees, 0–359, clockwise from the top. Only used by a linear gradient. */
|
|
24
|
+
angle: number;
|
|
25
|
+
/** Centre in whole percentages from the left. Only used by a radial gradient. */
|
|
26
|
+
centerX: number;
|
|
27
|
+
/** Centre in whole percentages from the top. Only used by a radial gradient. */
|
|
28
|
+
centerY: number;
|
|
29
|
+
/** Two or three stops, in order of position. */
|
|
30
|
+
stops: ColorPickerGradientStop[];
|
|
31
|
+
}
|
|
32
|
+
export declare const MIN_STOPS = 2;
|
|
33
|
+
export declare const MAX_STOPS = 3;
|
|
34
|
+
export declare const DEFAULT_ANGLE = 180;
|
|
35
|
+
export declare const DEFAULT_CENTER = 50;
|
|
36
|
+
/** What the gradient mode shows while there is no readable gradient. */
|
|
37
|
+
export declare const DEFAULT_GRADIENT: ColorPickerGradient;
|
|
38
|
+
/** Rounds and clamps to a whole percentage. */
|
|
39
|
+
export declare const clampPercent: (value: number) => number;
|
|
40
|
+
/** Rounds and wraps to a whole angle, 0–359: 360 is 0 and -10 is 350. */
|
|
41
|
+
export declare const wrapAngle: (value: number) => number;
|
|
42
|
+
/** A stop as CSS needs it: any CSS colour, and a position in percent. */
|
|
43
|
+
export interface CssGradientStop {
|
|
44
|
+
color: string;
|
|
45
|
+
position: number;
|
|
46
|
+
}
|
|
47
|
+
/** The shape of a gradient as CSS needs it. */
|
|
48
|
+
export type CssGradientShape = {
|
|
49
|
+
type: 'linear';
|
|
50
|
+
angle: number;
|
|
51
|
+
} | {
|
|
52
|
+
type: 'radial';
|
|
53
|
+
centerX: number;
|
|
54
|
+
centerY: number;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* A gradient as a CSS `background-image`, always interpolated in oklab and with
|
|
58
|
+
* every position written. This is how the consuming app draws a gradient class
|
|
59
|
+
* (as inline CSS), so the preview shows exactly what the app renders. For
|
|
60
|
+
* `bg-linear-*` and `bg-radial` it is also what the Tailwind class renders;
|
|
61
|
+
* for `bg-radial-[at_…]` Tailwind would interpolate in sRGB, the app does not.
|
|
62
|
+
* The position comes before the interpolation method, as in
|
|
63
|
+
* `radial-gradient(at 30% 70% in oklab, …)`; a centred radial gradient leaves
|
|
64
|
+
* the position out.
|
|
65
|
+
*/
|
|
66
|
+
export declare const buildGradientCss: (shape: CssGradientShape, stops: CssGradientStop[]) => string;
|
|
67
|
+
/** The picker's gradient as CSS; see `buildGradientCss`. */
|
|
68
|
+
export declare const gradientCss: (gradient: ColorPickerGradient) => string;
|
|
69
|
+
/** The stops left to right in oklab, for the stop bar. */
|
|
70
|
+
export declare const stopBarCss: (gradient: ColorPickerGradient) => string;
|
|
71
|
+
/** The checkerboard that shows through a translucent colour. */
|
|
72
|
+
export declare const CHECKERBOARD = "repeating-conic-gradient(#e5e7eb 0% 25%, #ffffff 0% 50%)";
|
|
73
|
+
type Rgba = [r: number, g: number, b: number, a: number];
|
|
74
|
+
/** `#rrggbb`, or `#rrggbbaa` below full opacity, in lower case. */
|
|
75
|
+
export declare const formatHex: ([r, g, b, a]: Rgba) => string;
|
|
76
|
+
/** A hex in the one spelling the picker reports: lower case, without an opaque `ff`. */
|
|
77
|
+
export declare const normalizeHex: (hex: string) => string;
|
|
78
|
+
/**
|
|
79
|
+
* Mixes two colours the way a CSS gradient does: in the given space, with
|
|
80
|
+
* premultiplied alpha, so a fade from a transparent black to a colour keeps the
|
|
81
|
+
* colour's hue all the way.
|
|
82
|
+
*/
|
|
83
|
+
export declare const mixColors: (from: string, to: string, t: number, space: "oklab" | "srgb") => string;
|
|
84
|
+
/**
|
|
85
|
+
* The colour the gradient shows at `position`, as a hex: what a stop added
|
|
86
|
+
* there needs so that the gradient does not change. Interpolated in oklab, as
|
|
87
|
+
* every gradient is drawn. Before the first stop and after the last the
|
|
88
|
+
* gradient is flat.
|
|
89
|
+
*/
|
|
90
|
+
export declare const colorAt: (stops: ColorPickerGradientStop[], position: number) => string;
|
|
91
|
+
/**
|
|
92
|
+
* Copy of the gradient mode. Every key is optional and merged over the Dutch
|
|
93
|
+
* defaults. `{n}`, `{total}`, `{x}` and `{y}` are filled in by the picker.
|
|
94
|
+
*/
|
|
95
|
+
export interface ColorPickerGradientMessages {
|
|
96
|
+
/** Accessible name of the solid/gradient switch. Defaults to `'Vulling'`. */
|
|
97
|
+
mode?: string;
|
|
98
|
+
/** Solid option of the switch. Defaults to `'Effen'`. */
|
|
99
|
+
solid?: string;
|
|
100
|
+
/** Gradient option of the switch. Defaults to `'Verloop'`. */
|
|
101
|
+
gradient?: string;
|
|
102
|
+
/** Accessible name of the type switch. Defaults to `'Type verloop'`. */
|
|
103
|
+
type?: string;
|
|
104
|
+
/** Linear option of the type switch. Defaults to `'Lineair'`. */
|
|
105
|
+
linear?: string;
|
|
106
|
+
/** Radial option of the type switch. Defaults to `'Radiaal'`. */
|
|
107
|
+
radial?: string;
|
|
108
|
+
/** Accessible name of the angle point in the preview. Defaults to `'Hoek'`. */
|
|
109
|
+
angle?: string;
|
|
110
|
+
/** Value text of the angle point. Defaults to `'{n} graden'`. */
|
|
111
|
+
angleValue?: string;
|
|
112
|
+
/** Accessible name of the centre point in the preview. Defaults to `'Middelpunt'`. */
|
|
113
|
+
center?: string;
|
|
114
|
+
/** Value text of the centre point. Defaults to `'{x} % van links, {y} % van boven'`. */
|
|
115
|
+
centerValue?: string;
|
|
116
|
+
/** Accessible name of the reverse button. Defaults to `'Kleurstops omdraaien'`. */
|
|
117
|
+
reverse?: string;
|
|
118
|
+
/** Heading above the stop list. Defaults to `'Kleurstops'`. */
|
|
119
|
+
stops?: string;
|
|
120
|
+
/** Hint next to the heading. Defaults to `'max. 3'`. */
|
|
121
|
+
max?: string;
|
|
122
|
+
/** Why no stop can be added, announced on the add button. Defaults to `'Een verloop heeft maximaal 3 kleurstops.'`. */
|
|
123
|
+
maxReason?: string;
|
|
124
|
+
/** Visible text of the add button. Defaults to `'Toevoegen'`. */
|
|
125
|
+
add?: string;
|
|
126
|
+
/** Accessible name of the add button. Defaults to `'Kleurstop toevoegen'`. */
|
|
127
|
+
addName?: string;
|
|
128
|
+
/** Name of a stop's row and of its handle on the bar. Defaults to `'Kleurstop {n} van {total}'`. */
|
|
129
|
+
stop?: string;
|
|
130
|
+
/** Accessible name of a row's position field. Defaults to `'Positie (%)'`. */
|
|
131
|
+
position?: string;
|
|
132
|
+
/** Accessible name of a row's colour button. Defaults to `'Kleur kiezen'`. */
|
|
133
|
+
pick?: string;
|
|
134
|
+
/** Accessible name of a row's hex field. Defaults to `'Hex'`. */
|
|
135
|
+
hex?: string;
|
|
136
|
+
/** Accessible name of a row's remove button. Defaults to `'Verwijderen'`. */
|
|
137
|
+
remove?: string;
|
|
138
|
+
/** Accessible name of a stop's colour popover. Defaults to `'Kleur van kleurstop {n}'`. */
|
|
139
|
+
dialog?: string;
|
|
140
|
+
/** Opacity part of a handle's value text. Defaults to `'dekking {n} %'`. */
|
|
141
|
+
stopOpacity?: string;
|
|
142
|
+
/** Hint under the locked opacity slider of a stop bound to a preset. Defaults to `'Huisstijlkleuren zijn altijd dekkend.'`. */
|
|
143
|
+
roleOpaque?: string;
|
|
144
|
+
/** Trigger text for a linear gradient. Defaults to `'Lineair verloop'`. */
|
|
145
|
+
triggerLinear?: string;
|
|
146
|
+
/** Trigger text for a radial gradient. Defaults to `'Radiaal verloop'`. */
|
|
147
|
+
triggerRadial?: string;
|
|
148
|
+
/** Name of the trigger swatch for a linear gradient. Defaults to `'Geselecteerd verloop: lineair, {n} kleuren'`. */
|
|
149
|
+
swatchLinear?: string;
|
|
150
|
+
/** Name of the trigger swatch for a radial gradient. Defaults to `'Geselecteerd verloop: radiaal, {n} kleuren'`. */
|
|
151
|
+
swatchRadial?: string;
|
|
152
|
+
/** Name of the trigger swatch while there is no gradient. Defaults to `'Geen kleur geselecteerd'`. */
|
|
153
|
+
swatchEmpty?: string;
|
|
154
|
+
}
|
|
155
|
+
export declare const DEFAULT_GRADIENT_MESSAGES: {
|
|
156
|
+
mode: string;
|
|
157
|
+
solid: string;
|
|
158
|
+
gradient: string;
|
|
159
|
+
type: string;
|
|
160
|
+
linear: string;
|
|
161
|
+
radial: string;
|
|
162
|
+
angle: string;
|
|
163
|
+
angleValue: string;
|
|
164
|
+
center: string;
|
|
165
|
+
centerValue: string;
|
|
166
|
+
reverse: string;
|
|
167
|
+
stops: string;
|
|
168
|
+
max: string;
|
|
169
|
+
maxReason: string;
|
|
170
|
+
add: string;
|
|
171
|
+
addName: string;
|
|
172
|
+
stop: string;
|
|
173
|
+
position: string;
|
|
174
|
+
pick: string;
|
|
175
|
+
hex: string;
|
|
176
|
+
remove: string;
|
|
177
|
+
dialog: string;
|
|
178
|
+
stopOpacity: string;
|
|
179
|
+
roleOpaque: string;
|
|
180
|
+
triggerLinear: string;
|
|
181
|
+
triggerRadial: string;
|
|
182
|
+
swatchLinear: string;
|
|
183
|
+
swatchRadial: string;
|
|
184
|
+
swatchEmpty: string;
|
|
185
|
+
};
|
|
186
|
+
export type GradientCopy = typeof DEFAULT_GRADIENT_MESSAGES;
|
|
187
|
+
/** Fills `{key}` placeholders in a message. */
|
|
188
|
+
export declare const fillMessage: (message: string, values: Record<string, string | number>) => string;
|
|
189
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Geometry of the gradient preview: where a stop renders in a square of side
|
|
3
|
+
* `S`, and which angle, centre and positions a set of points stands for. The
|
|
4
|
+
* square's origin is its top-left corner with y pointing down; its centre is
|
|
5
|
+
* C = (S/2, S/2). Every derivation works on the rounded values that are
|
|
6
|
+
* written to the model, so the points and the rendered gradient always agree.
|
|
7
|
+
*
|
|
8
|
+
* Linear (CSS: 0° is up, clockwise): direction d = (sin θ, −cos θ), length of
|
|
9
|
+
* the gradient line L = S·(|sin θ| + |cos θ|), and a point P sits at
|
|
10
|
+
* t = 0.5 + ((P − C)·d) / L.
|
|
11
|
+
*
|
|
12
|
+
* Radial (`ellipse farthest-corner`): an ellipse with the proportions of
|
|
13
|
+
* `closest-side` that runs through the farthest corner, and t is the
|
|
14
|
+
* normalized distance from the centre.
|
|
15
|
+
*/
|
|
16
|
+
export interface Point {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
}
|
|
20
|
+
export declare const linearDirection: (angle: number) => Point;
|
|
21
|
+
/** Length of the CSS gradient line for `angle` in a square of side `size`. */
|
|
22
|
+
export declare const linearLength: (angle: number, size: number) => number;
|
|
23
|
+
/** Where on the gradient line a point projects, 0–1 inside the square (unclamped). */
|
|
24
|
+
export declare const linearT: (angle: number, point: Point, size: number) => number;
|
|
25
|
+
/** The position a point stands for: a whole percentage, 0–100. */
|
|
26
|
+
export declare const linearPosition: (angle: number, point: Point, size: number) => number;
|
|
27
|
+
/** The canonical point of a position: on the line through the middle. */
|
|
28
|
+
export declare const linearPoint: (angle: number, position: number, size: number) => Point;
|
|
29
|
+
/** Whether a point lies in the square (edges included). */
|
|
30
|
+
export declare const isInSquare: (point: Point, size: number) => boolean;
|
|
31
|
+
/** A pointer clamped onto the square, so a dragged point never leaves it. */
|
|
32
|
+
export declare const clampToSquare: (point: Point, size: number) => Point;
|
|
33
|
+
/**
|
|
34
|
+
* Where the handle of a position is drawn: its canonical point, or -- when that
|
|
35
|
+
* lies outside the square, as 0 % and 100 % do at angles off the axes -- where
|
|
36
|
+
* the gradient line leaves the square. The handle is a grip; the class and the
|
|
37
|
+
* numbers stay the real CSS values.
|
|
38
|
+
*/
|
|
39
|
+
export declare const linearHandlePoint: (angle: number, position: number, size: number) => Point;
|
|
40
|
+
/**
|
|
41
|
+
* The angle from the from-point to the to-point, in whole degrees 0–359. Two
|
|
42
|
+
* points closer than `minDistance` say nothing about a direction, so the
|
|
43
|
+
* previous angle stays.
|
|
44
|
+
*/
|
|
45
|
+
export declare const angleBetween: (from: Point, to: Point, previous: number, minDistance: number) => number;
|
|
46
|
+
/** How far a point lies along the segment from `a` to `b`, clamped to 0–1. */
|
|
47
|
+
export declare const projectOnSegment: (point: Point, a: Point, b: Point) => number;
|
|
48
|
+
/** The point at fraction `f` from `a` to `b`. */
|
|
49
|
+
export declare const lerpPoint: (a: Point, b: Point, f: number) => Point;
|
|
50
|
+
/** Where the via stop sits between from and to: (via − from) / (to − from), or 0.5. */
|
|
51
|
+
export declare const viaFraction: (from: number, via: number, to: number) => number;
|
|
52
|
+
/**
|
|
53
|
+
* The angle and positions a set of points stands for: the angle from the
|
|
54
|
+
* from-point to the to-point, each position the projection of its point on the
|
|
55
|
+
* line of that rounded angle, and via at fraction `f` of the segment.
|
|
56
|
+
*/
|
|
57
|
+
export declare const linearFromPoints: (options: {
|
|
58
|
+
from: Point;
|
|
59
|
+
to: Point;
|
|
60
|
+
viaFraction?: number;
|
|
61
|
+
previousAngle: number;
|
|
62
|
+
size: number;
|
|
63
|
+
minDistance: number;
|
|
64
|
+
}) => {
|
|
65
|
+
angle: number;
|
|
66
|
+
from: number;
|
|
67
|
+
via: number | undefined;
|
|
68
|
+
to: number;
|
|
69
|
+
};
|
|
70
|
+
export interface RadialEllipse {
|
|
71
|
+
/** Centre in px. */
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
74
|
+
/** Radii in px. */
|
|
75
|
+
rx: number;
|
|
76
|
+
ry: number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Clamps a centre percentage to 1–99: at 0 or 100 the closest side is 0 and
|
|
80
|
+
* CSS degenerates the ellipse.
|
|
81
|
+
*/
|
|
82
|
+
export declare const clampCenter: (value: number) => number;
|
|
83
|
+
/** The `farthest-corner` ellipse of a centre at (cx %, cy %) in a square of side `size`. */
|
|
84
|
+
export declare const radialEllipse: (cx: number, cy: number, size: number) => RadialEllipse;
|
|
85
|
+
/** The normalized distance of a point from the centre; 1 on the ellipse (unclamped). */
|
|
86
|
+
export declare const radialT: (ellipse: RadialEllipse, point: Point) => number;
|
|
87
|
+
export declare const radialPosition: (ellipse: RadialEllipse, point: Point) => number;
|
|
88
|
+
/** The direction of the ray through a point, in the ellipse's own coordinates. */
|
|
89
|
+
export declare const radialAngle: (ellipse: RadialEllipse, point: Point) => number;
|
|
90
|
+
/** The ray towards the farthest corner, where 100 % falls exactly on the corner. */
|
|
91
|
+
export declare const farthestCornerAngle: (ellipse: RadialEllipse, size: number) => number;
|
|
92
|
+
/**
|
|
93
|
+
* The ray the stops are drawn on: `psi` while the farthest stop (`position`)
|
|
94
|
+
* still lies inside the square, otherwise the ray to the farthest corner. That
|
|
95
|
+
* one always fits: 100 % lands exactly on the corner. A ψ from a drag, or one
|
|
96
|
+
* left over after the centre moved, could otherwise put a point outside the
|
|
97
|
+
* preview, over the controls around it.
|
|
98
|
+
*/
|
|
99
|
+
export declare const radialRay: (ellipse: RadialEllipse, psi: number | null, position: number, size: number) => number;
|
|
100
|
+
/** The point of a position on the ray `psi`: M + t·(E − M). */
|
|
101
|
+
export declare const radialPoint: (ellipse: RadialEllipse, psi: number, position: number) => Point;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { ColorPickerGradient, ColorPickerPreset } from './gradient';
|
|
3
|
+
/** A stop as the editor keeps it: with an id, so it stays itself while it moves. */
|
|
4
|
+
export interface GradientEditorStop {
|
|
5
|
+
id: number;
|
|
6
|
+
color: string;
|
|
7
|
+
position: number;
|
|
8
|
+
preset?: ColorPickerPreset;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* State and actions of the picker's gradient mode. The stops are kept in the
|
|
12
|
+
* order of their handles in the DOM, which is only brought back in line with
|
|
13
|
+
* their positions once an action is over (`settle`): a dragged stop that passes
|
|
14
|
+
* another keeps its id, colour, selection and focus. What reaches the model is
|
|
15
|
+
* always in order of position, ties in the order they had before.
|
|
16
|
+
*
|
|
17
|
+
* `value` is the model. A change from outside is merged into the stops that are
|
|
18
|
+
* there, so ids survive a round trip through the parent; a different number of
|
|
19
|
+
* stops starts over. While `value` is unset `start` (or the default gradient)
|
|
20
|
+
* is shown and nothing is written until the first action.
|
|
21
|
+
*/
|
|
22
|
+
export declare const useGradientEditor: (options: {
|
|
23
|
+
value: Ref<ColorPickerGradient | undefined>;
|
|
24
|
+
selectedIndex: Ref<number>;
|
|
25
|
+
/** What to show while `value` is unset; the default gradient without it. */
|
|
26
|
+
start?: () => ColorPickerGradient | undefined;
|
|
27
|
+
}) => {
|
|
28
|
+
type: Ref<"linear" | "radial", "linear" | "radial">;
|
|
29
|
+
angle: Ref<number, number>;
|
|
30
|
+
centerX: Ref<number, number>;
|
|
31
|
+
centerY: Ref<number, number>;
|
|
32
|
+
stops: Ref<{
|
|
33
|
+
id: number;
|
|
34
|
+
color: string;
|
|
35
|
+
position: number;
|
|
36
|
+
preset?: {
|
|
37
|
+
key: string;
|
|
38
|
+
label: string;
|
|
39
|
+
} | undefined;
|
|
40
|
+
}[], GradientEditorStop[] | {
|
|
41
|
+
id: number;
|
|
42
|
+
color: string;
|
|
43
|
+
position: number;
|
|
44
|
+
preset?: {
|
|
45
|
+
key: string;
|
|
46
|
+
label: string;
|
|
47
|
+
} | undefined;
|
|
48
|
+
}[]>;
|
|
49
|
+
sorted: import('vue').ComputedRef<{
|
|
50
|
+
id: number;
|
|
51
|
+
color: string;
|
|
52
|
+
position: number;
|
|
53
|
+
preset?: {
|
|
54
|
+
key: string;
|
|
55
|
+
label: string;
|
|
56
|
+
} | undefined;
|
|
57
|
+
}[]>;
|
|
58
|
+
snapshot: import('vue').ComputedRef<ColorPickerGradient>;
|
|
59
|
+
selectedId: Ref<number, number>;
|
|
60
|
+
centerSelected: Ref<boolean, boolean>;
|
|
61
|
+
selected: import('vue').ComputedRef<{
|
|
62
|
+
id: number;
|
|
63
|
+
color: string;
|
|
64
|
+
position: number;
|
|
65
|
+
preset?: {
|
|
66
|
+
key: string;
|
|
67
|
+
label: string;
|
|
68
|
+
} | undefined;
|
|
69
|
+
} | undefined>;
|
|
70
|
+
selectedOrder: import('vue').ComputedRef<number>;
|
|
71
|
+
canAdd: import('vue').ComputedRef<boolean>;
|
|
72
|
+
canRemove: import('vue').ComputedRef<boolean>;
|
|
73
|
+
neighbourColor: import('vue').ComputedRef<string>;
|
|
74
|
+
select: (id: number) => void;
|
|
75
|
+
selectCenter: () => void;
|
|
76
|
+
settle: () => void;
|
|
77
|
+
setType: (next: ColorPickerGradient["type"]) => void;
|
|
78
|
+
setAngle: (next: number) => void;
|
|
79
|
+
setCenter: (x: number, y: number) => void;
|
|
80
|
+
moveStop: (id: number, position: number) => void;
|
|
81
|
+
setGeometry: (positions: Map<number, number>, nextAngle?: number) => void;
|
|
82
|
+
addStop: (position?: number) => number | null;
|
|
83
|
+
removeStop: (id: number) => number | null;
|
|
84
|
+
reverse: () => void;
|
|
85
|
+
setStopColor: (color: string, preset?: ColorPickerPreset) => void;
|
|
86
|
+
setColorOf: (id: number, color: string, preset?: ColorPickerPreset) => void;
|
|
87
|
+
resetSession: () => void;
|
|
88
|
+
};
|
|
89
|
+
export type GradientEditor = ReturnType<typeof useGradientEditor>;
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,9 @@ export type { NexxtPageMockupType } from './components/molecules/PageMockup/Page
|
|
|
14
14
|
export type { NexxtPickerGroupData, NexxtPickerItemData, } from './components/molecules/PickerList/PickerList.vue';
|
|
15
15
|
export type { NexxtTreeMove, NexxtTreeNode, NexxtTreeProps, NexxtTreeSlots, } from './components/molecules/Tree/Tree.vue';
|
|
16
16
|
export type { NexxtPlaceholderGroup, NexxtPlaceholderInputMessages, NexxtPlaceholderInputProps, } from './components/molecules/PlaceholderInput/PlaceholderInput.vue';
|
|
17
|
+
export type { ColorFormat, ColorPickerGradient, ColorPickerGradientMessages, ColorPickerGradientStop, ColorPickerFillMode, ColorPickerPreset, ColorSuggestions, } from './components/organisms/ColorPicker/ColorPicker.vue';
|
|
18
|
+
export { gradientClassToCss, looksLikeGradientClass, parseGradientClass, } from './components/editor/molecules/EditorColor/gradientClass';
|
|
19
|
+
export type { GradientClass, GradientClassColor, GradientClassStop, GradientClassType, } from './components/editor/molecules/EditorColor/gradientClass';
|
|
17
20
|
export { EDITOR_ALIGNMENT_POSITIONS } from './components/editor/molecules/EditorAlignmentGrid/EditorAlignmentGrid.vue';
|
|
18
21
|
export type { EditorAlignmentDirection, EditorAlignmentGridMessages, EditorAlignmentMode, EditorAlignmentPosition, EditorAlignmentValue, } from './components/editor/molecules/EditorAlignmentGrid/EditorAlignmentGrid.vue';
|
|
19
22
|
export { EDITOR_ALIGN_ITEMS_OPTIONS } from './components/editor/molecules/EditorAlignItems/EditorAlignItems.vue';
|
|
@@ -28,7 +31,7 @@ export { EDITOR_FLEX_DIRECTION_OPTIONS } from './components/editor/molecules/Edi
|
|
|
28
31
|
export type { EditorFlexDirectionMessages, EditorFlexDirectionValue, } from './components/editor/molecules/EditorFlexDirection/EditorFlexDirection.vue';
|
|
29
32
|
export { EDITOR_GAP_STEPS } from './components/editor/molecules/EditorGap/EditorGap.vue';
|
|
30
33
|
export type { EditorGapMessages, EditorGapValue, } from './components/editor/molecules/EditorGap/EditorGap.vue';
|
|
31
|
-
export type { EditorColorLiteralValue, EditorColorMessages, EditorColorProperty, EditorColorRole, EditorColorRoleValue, EditorColorThemeRole, EditorColorValue, } from './components/editor/molecules/EditorColor/EditorColor.vue';
|
|
34
|
+
export type { EditorColorFillMode, EditorColorGradientMessages, EditorColorGradientValue, EditorColorLinearGradientValue, EditorColorLiteralValue, EditorColorMessages, EditorColorProperty, EditorColorRadialGradientValue, EditorColorRole, EditorColorRoleValue, EditorColorThemeRole, EditorColorValue, } from './components/editor/molecules/EditorColor/EditorColor.vue';
|
|
32
35
|
export { EDITOR_BORDER_STEPS } from './components/editor/molecules/EditorBorder/EditorBorder.vue';
|
|
33
36
|
export type { EditorBorderMessages, EditorBorderWidth, } from './components/editor/molecules/EditorBorder/EditorBorder.vue';
|
|
34
37
|
export { EDITOR_HEADING_TYPE_OPTIONS } from './components/editor/molecules/EditorHeadingType/EditorHeadingType.vue';
|