@pixerate/editor 0.146.0 → 0.147.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 +3 -1
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/agent/index.cjs +36 -34
- package/dist/agent/index.js +7 -5
- package/dist/animation/index.cjs +5 -3
- package/dist/animation/index.js +4 -2
- package/dist/animation-editor/index.cjs +62 -60
- package/dist/animation-editor/index.js +6 -4
- package/dist/canvas/index.cjs +36 -34
- package/dist/canvas/index.js +19 -17
- package/dist/chart/index.cjs +88 -86
- package/dist/chart/index.js +7 -5
- package/dist/{chunk-WBJ6BG4R.js → chunk-2AQL4JHM.js} +6 -6
- package/dist/{chunk-HLMF3E53.cjs → chunk-2WDZI6QD.cjs} +15 -15
- package/dist/{chunk-ZNHB5RG6.js → chunk-37RLSNQ3.js} +2 -2
- package/dist/{chunk-5WOY52O6.cjs → chunk-4YQKRHMI.cjs} +8 -8
- package/dist/chunk-6ONMQ6WF.js +113 -0
- package/dist/{chunk-L434J57V.cjs → chunk-6QTON3VW.cjs} +16 -16
- package/dist/chunk-AA34BA7G.js +1913 -0
- package/dist/{chunk-QX25HWFL.js → chunk-AY65VQSU.js} +1 -1
- package/dist/{chunk-ONZJD2OD.cjs → chunk-BROJYMWU.cjs} +57 -153
- package/dist/{chunk-YM75DN54.js → chunk-DSZCDNTM.js} +1 -1
- package/dist/{chunk-PUR6BZFA.cjs → chunk-DVLMW3GB.cjs} +53 -53
- package/dist/{chunk-ALUWD3FG.js → chunk-EIUTJPEL.js} +1 -1
- package/dist/{chunk-X65C4DWV.js → chunk-EQ4SF4X4.js} +1 -1
- package/dist/{chunk-77SG47WT.js → chunk-FLOGD3QB.js} +1 -1
- package/dist/{chunk-AJSW5GMP.js → chunk-HVQVHUTV.js} +19 -115
- package/dist/{chunk-UR37VCIR.cjs → chunk-I4AHLP7F.cjs} +16 -35
- package/dist/chunk-IPJ3TEYR.cjs +113 -0
- package/dist/chunk-KY3FYKP3.js +52 -0
- package/dist/chunk-LEUZ4FRC.cjs +52 -0
- package/dist/{chunk-H6FX45CP.cjs → chunk-LIXLD433.cjs} +37 -37
- package/dist/{chunk-6GAYGQDC.js → chunk-O5ML2I6O.js} +3 -3
- package/dist/{chunk-KI2VBONS.js → chunk-OET45HIR.js} +2 -2
- package/dist/{chunk-XNZWATSB.cjs → chunk-QCEQIRJQ.cjs} +85 -85
- package/dist/{chunk-HRI3ZMDM.cjs → chunk-RHXW4TA5.cjs} +3 -3
- package/dist/{chunk-UUTTJK77.cjs → chunk-SUF6WRXR.cjs} +2 -2
- package/dist/{chunk-RN767PO6.js → chunk-SUVZJ2CP.js} +15 -34
- package/dist/{chunk-FLUTRPLY.cjs → chunk-TLMRGLQQ.cjs} +16 -16
- package/dist/{chunk-DAS7M4RY.js → chunk-UILRJQFD.js} +2 -2
- package/dist/chunk-UKCJ43YL.cjs +1913 -0
- package/dist/{chunk-XQ33O5BC.cjs → chunk-X35BV5YT.cjs} +44 -44
- package/dist/{chunk-6HMEHNWW.cjs → chunk-XTU6QO2W.cjs} +26 -26
- package/dist/{chunk-VM6JYWXQ.js → chunk-ZQUANEK4.js} +2 -2
- package/dist/cms/index.cjs +5 -3
- package/dist/cms/index.js +18 -16
- package/dist/color/contrast.d.cts +14 -0
- package/dist/color/contrast.d.ts +14 -0
- package/dist/color/convert.d.cts +30 -0
- package/dist/color/convert.d.ts +30 -0
- package/dist/color/dual.d.cts +98 -0
- package/dist/color/dual.d.ts +98 -0
- package/dist/color/format.d.cts +12 -0
- package/dist/color/format.d.ts +12 -0
- package/dist/color/gamut.d.cts +12 -0
- package/dist/color/gamut.d.ts +12 -0
- package/dist/color/harmony.d.cts +22 -0
- package/dist/color/harmony.d.ts +22 -0
- package/dist/color/index.cjs +115 -0
- package/dist/color/index.d.cts +18 -0
- package/dist/color/index.d.ts +18 -0
- package/dist/color/index.js +115 -0
- package/dist/color/mix.d.cts +11 -0
- package/dist/color/mix.d.ts +11 -0
- package/dist/color/named.d.cts +5 -0
- package/dist/color/named.d.ts +5 -0
- package/dist/color/parse.d.cts +11 -0
- package/dist/color/parse.d.ts +11 -0
- package/dist/color/picker.d.cts +52 -0
- package/dist/color/picker.d.ts +52 -0
- package/dist/color/recent.d.cts +8 -0
- package/dist/color/recent.d.ts +8 -0
- package/dist/color/tools.d.cts +15 -0
- package/dist/color/tools.d.ts +15 -0
- package/dist/color/types.d.cts +41 -0
- package/dist/color/types.d.ts +41 -0
- package/dist/color/vision.d.cts +36 -0
- package/dist/color/vision.d.ts +36 -0
- package/dist/export/index.cjs +6 -4
- package/dist/export/index.js +5 -3
- package/dist/extensions/index.cjs +10 -8
- package/dist/extensions/index.js +9 -7
- package/dist/gradient/controller.d.cts +109 -0
- package/dist/gradient/controller.d.ts +109 -0
- package/dist/gradient/editor.d.cts +38 -0
- package/dist/gradient/editor.d.ts +38 -0
- package/dist/gradient/index.cjs +1549 -0
- package/dist/gradient/index.d.cts +5 -0
- package/dist/gradient/index.d.ts +5 -0
- package/dist/gradient/index.js +1549 -0
- package/dist/gradient/model.d.cts +94 -0
- package/dist/gradient/model.d.ts +94 -0
- package/dist/gradient/tools.d.cts +11 -0
- package/dist/gradient/tools.d.ts +11 -0
- package/dist/gradient/types.d.cts +44 -0
- package/dist/gradient/types.d.ts +44 -0
- package/dist/image-editor/index.cjs +649 -647
- package/dist/image-editor/index.js +6 -4
- package/dist/index.cjs +19 -17
- package/dist/index.js +16 -14
- package/dist/paint-editor/color.d.cts +3 -13
- package/dist/paint-editor/color.d.ts +3 -13
- package/dist/paint-editor/index.cjs +23 -68
- package/dist/paint-editor/index.js +15 -60
- package/dist/vector/index.cjs +950 -948
- package/dist/vector/index.js +5 -3
- package/dist/video-editor/index.cjs +5 -3
- package/dist/video-editor/index.js +4 -2
- package/package.json +21 -1
- package/skills/README.md +1 -0
- package/skills/pixerate-color/SKILL.md +69 -0
- package/dist/chunk-45VRG4RB.js +0 -65
- package/dist/chunk-5FXOR7F2.cjs +0 -65
package/dist/extensions/index.js
CHANGED
|
@@ -95,8 +95,7 @@ import {
|
|
|
95
95
|
updateImageSrc,
|
|
96
96
|
validateFindPattern,
|
|
97
97
|
writeRichClipboard
|
|
98
|
-
} from "../chunk-
|
|
99
|
-
import "../chunk-V5OOP74P.js";
|
|
98
|
+
} from "../chunk-2AQL4JHM.js";
|
|
100
99
|
import {
|
|
101
100
|
DEFAULT_STYLES,
|
|
102
101
|
NORMAL_STYLE_ID,
|
|
@@ -105,7 +104,8 @@ import {
|
|
|
105
104
|
isValidStyleId,
|
|
106
105
|
safeCSSValue
|
|
107
106
|
} from "../chunk-CXXKJBQZ.js";
|
|
108
|
-
import "../chunk-
|
|
107
|
+
import "../chunk-EQ4SF4X4.js";
|
|
108
|
+
import "../chunk-V5OOP74P.js";
|
|
109
109
|
import {
|
|
110
110
|
ALLOW_NESTED_TABLES_META,
|
|
111
111
|
AgentCaret,
|
|
@@ -171,10 +171,10 @@ import {
|
|
|
171
171
|
tableNestingPluginKey,
|
|
172
172
|
typeAgentText,
|
|
173
173
|
unnestTables
|
|
174
|
-
} from "../chunk-
|
|
175
|
-
import "../chunk-
|
|
176
|
-
import "../chunk-
|
|
177
|
-
import "../chunk-
|
|
174
|
+
} from "../chunk-O5ML2I6O.js";
|
|
175
|
+
import "../chunk-OET45HIR.js";
|
|
176
|
+
import "../chunk-DSZCDNTM.js";
|
|
177
|
+
import "../chunk-SUVZJ2CP.js";
|
|
178
178
|
import "../chunk-ZLZKGHSZ.js";
|
|
179
179
|
import "../chunk-2INPJDNY.js";
|
|
180
180
|
import "../chunk-RTRQ7XFI.js";
|
|
@@ -214,6 +214,8 @@ import "../chunk-WJSD3MAZ.js";
|
|
|
214
214
|
import "../chunk-CIQIM2IP.js";
|
|
215
215
|
import "../chunk-VDGBHYC7.js";
|
|
216
216
|
import "../chunk-RNSANXPT.js";
|
|
217
|
+
import "../chunk-AA34BA7G.js";
|
|
218
|
+
import "../chunk-6ONMQ6WF.js";
|
|
217
219
|
export {
|
|
218
220
|
ALLOW_NESTED_TABLES_META,
|
|
219
221
|
AgentCaret,
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { HistoryManager } from '../history/HistoryManager.cjs';
|
|
2
|
+
import type { Gradient, GradientInterpolation, GradientShape, GradientStop, GradientType } from './types.cjs';
|
|
3
|
+
export interface GradientControllerOptions {
|
|
4
|
+
/** Initial gradient value (parsed or object). */
|
|
5
|
+
value?: unknown;
|
|
6
|
+
/** History manager to record undo/redo into (creates own if omitted). */
|
|
7
|
+
history?: HistoryManager;
|
|
8
|
+
/** Whether the gradient is read-only or a function returning reason/boolean. */
|
|
9
|
+
readOnly?: boolean | string | (() => boolean | string);
|
|
10
|
+
/** Callback invoked whenever the gradient or selection changes. */
|
|
11
|
+
onChange?: (gradient: Readonly<Gradient>) => void;
|
|
12
|
+
}
|
|
13
|
+
export interface GradientState {
|
|
14
|
+
gradient: Readonly<Gradient>;
|
|
15
|
+
selectedStopId: string | null;
|
|
16
|
+
canUndo: boolean;
|
|
17
|
+
canRedo: boolean;
|
|
18
|
+
undoLabel: string;
|
|
19
|
+
redoLabel: string;
|
|
20
|
+
revision: number;
|
|
21
|
+
}
|
|
22
|
+
export type GradientActionResult = {
|
|
23
|
+
ok: true;
|
|
24
|
+
} | {
|
|
25
|
+
ok: false;
|
|
26
|
+
message: string;
|
|
27
|
+
};
|
|
28
|
+
/** The geometry fields `setGeometry` changes; omitted fields stay as they are. */
|
|
29
|
+
export interface GradientGeometryPatch {
|
|
30
|
+
type?: GradientType;
|
|
31
|
+
/** Degrees (linear and conic); any finite number, stored modulo 360. */
|
|
32
|
+
angle?: number;
|
|
33
|
+
/** 0–1 of the box (radial and conic). */
|
|
34
|
+
center?: {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
};
|
|
38
|
+
shape?: GradientShape;
|
|
39
|
+
interpolation?: GradientInterpolation;
|
|
40
|
+
repeating?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare const GRADIENT_TYPES: readonly GradientType[];
|
|
43
|
+
export declare const GRADIENT_INTERPOLATIONS: readonly GradientInterpolation[];
|
|
44
|
+
export declare class GradientController {
|
|
45
|
+
private _gradient;
|
|
46
|
+
private _selectedStopId;
|
|
47
|
+
private readonly _history;
|
|
48
|
+
private readonly _readOnlyOption?;
|
|
49
|
+
private readonly _onChange?;
|
|
50
|
+
private readonly _listeners;
|
|
51
|
+
private _gestureKey;
|
|
52
|
+
private _gestureCount;
|
|
53
|
+
private _revision;
|
|
54
|
+
private _cachedState;
|
|
55
|
+
constructor(options?: GradientControllerOptions);
|
|
56
|
+
get state(): GradientState;
|
|
57
|
+
get readOnlyReason(): string | null;
|
|
58
|
+
get isReadOnly(): boolean;
|
|
59
|
+
getGradient(): Readonly<Gradient>;
|
|
60
|
+
getSelectedStopId(): string | null;
|
|
61
|
+
getSelectedStop(): GradientStop | null;
|
|
62
|
+
subscribe(fn: (state: GradientState) => void): () => void;
|
|
63
|
+
/** `changed` is false for view-only updates (selection), which don't call `onChange`. */
|
|
64
|
+
private _notify;
|
|
65
|
+
private _checkReadOnly;
|
|
66
|
+
/** Selects a stop (view state; not an undo step and no `onChange`). Unknown ids are ignored. */
|
|
67
|
+
selectStop(stopId: string | null): void;
|
|
68
|
+
beginGesture(label?: string): void;
|
|
69
|
+
endGesture(): void;
|
|
70
|
+
private _apply;
|
|
71
|
+
/** The selected stop after `next` replaces the gradient: same id if it survives, else same index. */
|
|
72
|
+
private _selectionAfterReplace;
|
|
73
|
+
setGradient(value: unknown, label?: string): GradientActionResult;
|
|
74
|
+
/**
|
|
75
|
+
* Replaces the gradient without an undo step (e.g. syncing a controlled `value` from the
|
|
76
|
+
* host). Keeps the selection when the stop survives. Notifies subscribers and `onChange`.
|
|
77
|
+
*/
|
|
78
|
+
load(value: unknown, options?: {
|
|
79
|
+
clearHistory?: boolean;
|
|
80
|
+
}): GradientActionResult;
|
|
81
|
+
/**
|
|
82
|
+
* Changes any of type, angle, center, shape, interpolation and repeating as one undo step.
|
|
83
|
+
* Every field is checked before anything changes; an invalid one fails the whole call.
|
|
84
|
+
*/
|
|
85
|
+
setGeometry(patch: GradientGeometryPatch, label?: string): GradientActionResult;
|
|
86
|
+
setType(type: GradientType): GradientActionResult;
|
|
87
|
+
setAngle(angle: number): GradientActionResult;
|
|
88
|
+
setCenter(center: {
|
|
89
|
+
x: number;
|
|
90
|
+
y: number;
|
|
91
|
+
}): GradientActionResult;
|
|
92
|
+
setShape(shape: GradientShape): GradientActionResult;
|
|
93
|
+
setInterpolation(interpolation: GradientInterpolation): GradientActionResult;
|
|
94
|
+
setRepeating(repeating: boolean): GradientActionResult;
|
|
95
|
+
addStop(offset: number, color?: string): {
|
|
96
|
+
ok: true;
|
|
97
|
+
stop: GradientStop;
|
|
98
|
+
} | {
|
|
99
|
+
ok: false;
|
|
100
|
+
message: string;
|
|
101
|
+
};
|
|
102
|
+
updateStop(id: string, patch: Partial<Omit<GradientStop, 'id'>>): GradientActionResult;
|
|
103
|
+
removeStop(id: string): GradientActionResult;
|
|
104
|
+
reverse(): GradientActionResult;
|
|
105
|
+
distribute(): GradientActionResult;
|
|
106
|
+
undo(): boolean;
|
|
107
|
+
redo(): boolean;
|
|
108
|
+
dispose(): void;
|
|
109
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { HistoryManager } from '../history/HistoryManager.js';
|
|
2
|
+
import type { Gradient, GradientInterpolation, GradientShape, GradientStop, GradientType } from './types.js';
|
|
3
|
+
export interface GradientControllerOptions {
|
|
4
|
+
/** Initial gradient value (parsed or object). */
|
|
5
|
+
value?: unknown;
|
|
6
|
+
/** History manager to record undo/redo into (creates own if omitted). */
|
|
7
|
+
history?: HistoryManager;
|
|
8
|
+
/** Whether the gradient is read-only or a function returning reason/boolean. */
|
|
9
|
+
readOnly?: boolean | string | (() => boolean | string);
|
|
10
|
+
/** Callback invoked whenever the gradient or selection changes. */
|
|
11
|
+
onChange?: (gradient: Readonly<Gradient>) => void;
|
|
12
|
+
}
|
|
13
|
+
export interface GradientState {
|
|
14
|
+
gradient: Readonly<Gradient>;
|
|
15
|
+
selectedStopId: string | null;
|
|
16
|
+
canUndo: boolean;
|
|
17
|
+
canRedo: boolean;
|
|
18
|
+
undoLabel: string;
|
|
19
|
+
redoLabel: string;
|
|
20
|
+
revision: number;
|
|
21
|
+
}
|
|
22
|
+
export type GradientActionResult = {
|
|
23
|
+
ok: true;
|
|
24
|
+
} | {
|
|
25
|
+
ok: false;
|
|
26
|
+
message: string;
|
|
27
|
+
};
|
|
28
|
+
/** The geometry fields `setGeometry` changes; omitted fields stay as they are. */
|
|
29
|
+
export interface GradientGeometryPatch {
|
|
30
|
+
type?: GradientType;
|
|
31
|
+
/** Degrees (linear and conic); any finite number, stored modulo 360. */
|
|
32
|
+
angle?: number;
|
|
33
|
+
/** 0–1 of the box (radial and conic). */
|
|
34
|
+
center?: {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
};
|
|
38
|
+
shape?: GradientShape;
|
|
39
|
+
interpolation?: GradientInterpolation;
|
|
40
|
+
repeating?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare const GRADIENT_TYPES: readonly GradientType[];
|
|
43
|
+
export declare const GRADIENT_INTERPOLATIONS: readonly GradientInterpolation[];
|
|
44
|
+
export declare class GradientController {
|
|
45
|
+
private _gradient;
|
|
46
|
+
private _selectedStopId;
|
|
47
|
+
private readonly _history;
|
|
48
|
+
private readonly _readOnlyOption?;
|
|
49
|
+
private readonly _onChange?;
|
|
50
|
+
private readonly _listeners;
|
|
51
|
+
private _gestureKey;
|
|
52
|
+
private _gestureCount;
|
|
53
|
+
private _revision;
|
|
54
|
+
private _cachedState;
|
|
55
|
+
constructor(options?: GradientControllerOptions);
|
|
56
|
+
get state(): GradientState;
|
|
57
|
+
get readOnlyReason(): string | null;
|
|
58
|
+
get isReadOnly(): boolean;
|
|
59
|
+
getGradient(): Readonly<Gradient>;
|
|
60
|
+
getSelectedStopId(): string | null;
|
|
61
|
+
getSelectedStop(): GradientStop | null;
|
|
62
|
+
subscribe(fn: (state: GradientState) => void): () => void;
|
|
63
|
+
/** `changed` is false for view-only updates (selection), which don't call `onChange`. */
|
|
64
|
+
private _notify;
|
|
65
|
+
private _checkReadOnly;
|
|
66
|
+
/** Selects a stop (view state; not an undo step and no `onChange`). Unknown ids are ignored. */
|
|
67
|
+
selectStop(stopId: string | null): void;
|
|
68
|
+
beginGesture(label?: string): void;
|
|
69
|
+
endGesture(): void;
|
|
70
|
+
private _apply;
|
|
71
|
+
/** The selected stop after `next` replaces the gradient: same id if it survives, else same index. */
|
|
72
|
+
private _selectionAfterReplace;
|
|
73
|
+
setGradient(value: unknown, label?: string): GradientActionResult;
|
|
74
|
+
/**
|
|
75
|
+
* Replaces the gradient without an undo step (e.g. syncing a controlled `value` from the
|
|
76
|
+
* host). Keeps the selection when the stop survives. Notifies subscribers and `onChange`.
|
|
77
|
+
*/
|
|
78
|
+
load(value: unknown, options?: {
|
|
79
|
+
clearHistory?: boolean;
|
|
80
|
+
}): GradientActionResult;
|
|
81
|
+
/**
|
|
82
|
+
* Changes any of type, angle, center, shape, interpolation and repeating as one undo step.
|
|
83
|
+
* Every field is checked before anything changes; an invalid one fails the whole call.
|
|
84
|
+
*/
|
|
85
|
+
setGeometry(patch: GradientGeometryPatch, label?: string): GradientActionResult;
|
|
86
|
+
setType(type: GradientType): GradientActionResult;
|
|
87
|
+
setAngle(angle: number): GradientActionResult;
|
|
88
|
+
setCenter(center: {
|
|
89
|
+
x: number;
|
|
90
|
+
y: number;
|
|
91
|
+
}): GradientActionResult;
|
|
92
|
+
setShape(shape: GradientShape): GradientActionResult;
|
|
93
|
+
setInterpolation(interpolation: GradientInterpolation): GradientActionResult;
|
|
94
|
+
setRepeating(repeating: boolean): GradientActionResult;
|
|
95
|
+
addStop(offset: number, color?: string): {
|
|
96
|
+
ok: true;
|
|
97
|
+
stop: GradientStop;
|
|
98
|
+
} | {
|
|
99
|
+
ok: false;
|
|
100
|
+
message: string;
|
|
101
|
+
};
|
|
102
|
+
updateStop(id: string, patch: Partial<Omit<GradientStop, 'id'>>): GradientActionResult;
|
|
103
|
+
removeStop(id: string): GradientActionResult;
|
|
104
|
+
reverse(): GradientActionResult;
|
|
105
|
+
distribute(): GradientActionResult;
|
|
106
|
+
undo(): boolean;
|
|
107
|
+
redo(): boolean;
|
|
108
|
+
dispose(): void;
|
|
109
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Gradient, GradientStop } from './types.cjs';
|
|
2
|
+
export interface GradientKeyStepResult {
|
|
3
|
+
stopId?: string;
|
|
4
|
+
offset?: number;
|
|
5
|
+
remove?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Returns the stop offset (0..1) corresponding to a track x position (0..1).
|
|
9
|
+
*/
|
|
10
|
+
export declare function stopFromTrackPosition(g: Gradient, x: number): number;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the track x position (0..1) corresponding to a stop.
|
|
13
|
+
*/
|
|
14
|
+
export declare function trackPositionFromStop(stop: GradientStop): number;
|
|
15
|
+
/**
|
|
16
|
+
* Handles keyboard navigation on a stop handle.
|
|
17
|
+
* ArrowLeft / ArrowRight moves by 0.01 (or 0.1 with shiftKey).
|
|
18
|
+
* Delete / Backspace requests removal (remove: true).
|
|
19
|
+
* Returns null if the key is unhandled.
|
|
20
|
+
*/
|
|
21
|
+
export declare function gradientKeyStep(g: Gradient, id: string, key: string, shift?: boolean): GradientKeyStepResult | null;
|
|
22
|
+
/**
|
|
23
|
+
* Calculates angle in degrees (CSS convention: 0 = up, 90 = right, 180 = down, 270 = left)
|
|
24
|
+
* from a center coordinate to a pointer coordinate.
|
|
25
|
+
* Optional snapStep snaps to nearest multiple (e.g. 15 deg).
|
|
26
|
+
*/
|
|
27
|
+
export declare function angleFromPointer(center: {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
}, point: {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
}, snapStep?: number): number;
|
|
34
|
+
/**
|
|
35
|
+
* Returns a linear 90deg CSS gradient string suitable for rendering the stop track
|
|
36
|
+
* across the horizontal slider, regardless of the underlying gradient's type.
|
|
37
|
+
*/
|
|
38
|
+
export declare function gradientTrackBackground(g: Gradient): string;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Gradient, GradientStop } from './types.js';
|
|
2
|
+
export interface GradientKeyStepResult {
|
|
3
|
+
stopId?: string;
|
|
4
|
+
offset?: number;
|
|
5
|
+
remove?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Returns the stop offset (0..1) corresponding to a track x position (0..1).
|
|
9
|
+
*/
|
|
10
|
+
export declare function stopFromTrackPosition(g: Gradient, x: number): number;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the track x position (0..1) corresponding to a stop.
|
|
13
|
+
*/
|
|
14
|
+
export declare function trackPositionFromStop(stop: GradientStop): number;
|
|
15
|
+
/**
|
|
16
|
+
* Handles keyboard navigation on a stop handle.
|
|
17
|
+
* ArrowLeft / ArrowRight moves by 0.01 (or 0.1 with shiftKey).
|
|
18
|
+
* Delete / Backspace requests removal (remove: true).
|
|
19
|
+
* Returns null if the key is unhandled.
|
|
20
|
+
*/
|
|
21
|
+
export declare function gradientKeyStep(g: Gradient, id: string, key: string, shift?: boolean): GradientKeyStepResult | null;
|
|
22
|
+
/**
|
|
23
|
+
* Calculates angle in degrees (CSS convention: 0 = up, 90 = right, 180 = down, 270 = left)
|
|
24
|
+
* from a center coordinate to a pointer coordinate.
|
|
25
|
+
* Optional snapStep snaps to nearest multiple (e.g. 15 deg).
|
|
26
|
+
*/
|
|
27
|
+
export declare function angleFromPointer(center: {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
}, point: {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
}, snapStep?: number): number;
|
|
34
|
+
/**
|
|
35
|
+
* Returns a linear 90deg CSS gradient string suitable for rendering the stop track
|
|
36
|
+
* across the horizontal slider, regardless of the underlying gradient's type.
|
|
37
|
+
*/
|
|
38
|
+
export declare function gradientTrackBackground(g: Gradient): string;
|