gradiente 2.5.0 → 3.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/dist/gradiente.global.iife.js +70 -176
- package/dist/index.d.ts +824 -398
- package/dist/index.js +2870 -3404
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -84,30 +84,42 @@ declare function matchExpression(classified: GradientAbiInput[], patternTokens:
|
|
|
84
84
|
declare function isValid(input: GradientAbiInput[], pattern: string): boolean;
|
|
85
85
|
declare function validate(classified: GradientAbiInput[], pattern: string): boolean;
|
|
86
86
|
//#endregion
|
|
87
|
-
//#region src/
|
|
87
|
+
//#region src/gradient/kind/hue/types.d.ts
|
|
88
88
|
declare const GRADIENT_COLOR_SPACE: readonly ["oklab", "lch", "oklch", "hsl", "hwb", "lab", "srgb", "srgb-linear", "xyz", "display-p3", "a98-rgb", "prophoto-rgb", "rec2020"];
|
|
89
89
|
declare const GRADIENT_HUE_INTERPOLATIONS: readonly ['shorter', 'longer', 'increasing', 'decreasing'];
|
|
90
90
|
declare const GRADIENT_POLAR_COLOR_SPACES: readonly ["hsl", "hwb", "lch", "oklch"];
|
|
91
91
|
type GradientHueInterpolation = (typeof GRADIENT_HUE_INTERPOLATIONS)[number];
|
|
92
92
|
type GradientColorSpace = (typeof GRADIENT_COLOR_SPACE)[number];
|
|
93
93
|
type GradientPolarColorSpace = (typeof GRADIENT_POLAR_COLOR_SPACES)[number];
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/gradient/kind/hue/index.d.ts
|
|
94
96
|
declare function isGradientHueInterpolation(value: string): value is GradientHueInterpolation;
|
|
95
97
|
declare function isGradientColorSpace(value: string): value is GradientColorSpace;
|
|
96
98
|
declare function isGradientPolarColorSpace(value: string): value is GradientPolarColorSpace;
|
|
97
99
|
//#endregion
|
|
98
|
-
//#region src/
|
|
100
|
+
//#region src/gradient/kind/base/types.d.ts
|
|
101
|
+
type GradientType = string;
|
|
102
|
+
type GradientStopKind = "color-stop" | "color-hint";
|
|
103
|
+
type GradientColorStop<TPosition = number, TMeta extends object = {}> = {
|
|
104
|
+
type: "color-stop";
|
|
105
|
+
value: string;
|
|
106
|
+
position: TPosition;
|
|
107
|
+
} & TMeta;
|
|
108
|
+
type GradientColorHint<TPosition = number> = {
|
|
109
|
+
type: "color-hint";
|
|
110
|
+
position: TPosition;
|
|
111
|
+
};
|
|
112
|
+
type GradientStop<TPosition = number, TMeta extends object = {}> = GradientColorStop<TPosition, TMeta> | GradientColorHint<TPosition>;
|
|
99
113
|
type GradientInterpolation = {
|
|
100
114
|
colorSpace: GradientColorSpace;
|
|
101
115
|
hue?: GradientHueInterpolation;
|
|
102
116
|
};
|
|
103
|
-
/**
|
|
104
|
-
* Shared scalar units
|
|
105
|
-
*/
|
|
106
|
-
type GradientAngleUnit = "deg" | "rad" | "turn" | "grad";
|
|
107
117
|
type GradientLengthUnit = "px" | "em" | "rem" | "vw" | "vh" | "vmin" | "vmax" | "cm" | "mm" | "in" | "pt" | "pc";
|
|
108
|
-
type
|
|
109
|
-
|
|
118
|
+
type GradientAngleUnit = "deg" | "rad" | "turn" | "grad";
|
|
119
|
+
type GradientAngleValue = {
|
|
120
|
+
kind: "angle";
|
|
110
121
|
value: number;
|
|
122
|
+
unit: GradientAngleUnit;
|
|
111
123
|
};
|
|
112
124
|
type GradientPercentValue = {
|
|
113
125
|
kind: "percent";
|
|
@@ -118,18 +130,9 @@ type GradientLengthValue = {
|
|
|
118
130
|
value: number;
|
|
119
131
|
unit: GradientLengthUnit;
|
|
120
132
|
};
|
|
121
|
-
type GradientAngleValue = {
|
|
122
|
-
kind: "angle";
|
|
123
|
-
value: number;
|
|
124
|
-
unit: GradientAngleUnit;
|
|
125
|
-
};
|
|
126
133
|
type GradientLengthPercentage = GradientLengthValue | GradientPercentValue;
|
|
127
134
|
type GradientPositionKeywordX = "left" | "center" | "right";
|
|
128
135
|
type GradientPositionKeywordY = "top" | "center" | "bottom";
|
|
129
|
-
/**
|
|
130
|
-
* Position model
|
|
131
|
-
* Не строка, а нормальная структура.
|
|
132
|
-
*/
|
|
133
136
|
type GradientPosition = {
|
|
134
137
|
kind: "keywords";
|
|
135
138
|
x: GradientPositionKeywordX;
|
|
@@ -139,295 +142,664 @@ type GradientPosition = {
|
|
|
139
142
|
x: GradientLengthPercentage;
|
|
140
143
|
y: GradientLengthPercentage;
|
|
141
144
|
};
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
type GradientRectangularColorSpace = "srgb" | "srgb-linear" | "display-p3" | "display-p3-linear" | "a98-rgb" | "prophoto-rgb" | "rec2020" | "lab" | "oklab" | "xyz" | "xyz-d50" | "xyz-d65";
|
|
149
|
-
type GradientColorInterpolation = {
|
|
150
|
-
kind: "rectangular";
|
|
151
|
-
space: GradientRectangularColorSpace;
|
|
152
|
-
} | {
|
|
153
|
-
kind: "polar";
|
|
154
|
-
space: GradientPolarColorSpace;
|
|
155
|
-
hueMethod?: GradientHueInterpolationMethod;
|
|
156
|
-
};
|
|
157
|
-
/**
|
|
158
|
-
* Shared stop model
|
|
159
|
-
* Твой текущий stop layer сюда ложится нормально.
|
|
160
|
-
*/
|
|
161
|
-
type GradientColorStop = {
|
|
162
|
-
type: "color-stop";
|
|
163
|
-
color: string;
|
|
164
|
-
position: number | null;
|
|
165
|
-
};
|
|
166
|
-
type GradientColorHint = {
|
|
167
|
-
type: "color-hint";
|
|
168
|
-
position: number;
|
|
169
|
-
};
|
|
170
|
-
type GradientStop = {
|
|
171
|
-
type: "color-stop" | "color-hint";
|
|
172
|
-
value: string;
|
|
173
|
-
position: number;
|
|
174
|
-
};
|
|
175
|
-
/**
|
|
176
|
-
* Base config fields common to all gradient classes
|
|
177
|
-
*/
|
|
178
|
-
type GradientCommonConfig = {
|
|
179
|
-
interpolation?: GradientColorInterpolation | null;
|
|
145
|
+
type GradientJSON<TConfig extends object = Record<string, never>, TExtra extends object = {}> = {
|
|
146
|
+
type: GradientType;
|
|
147
|
+
config: TConfig;
|
|
148
|
+
} & TExtra;
|
|
149
|
+
type GradientWithStopsJSONExtra = {
|
|
150
|
+
isRepeating?: boolean;
|
|
180
151
|
};
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
interface
|
|
152
|
+
type GradientWithStopsJSON<TStop = GradientStop, TConfig extends object = Record<string, never>> = GradientJSON<TConfig, {
|
|
153
|
+
stops: TStop[];
|
|
154
|
+
}>;
|
|
155
|
+
interface IGradient<TConfig extends object = Record<string, never>> {
|
|
185
156
|
readonly type: GradientType;
|
|
157
|
+
getConfig(): TConfig;
|
|
186
158
|
clone(): this;
|
|
159
|
+
equals(other: unknown): boolean;
|
|
187
160
|
toString(): string;
|
|
188
|
-
toJSON():
|
|
189
|
-
type: GradientType;
|
|
190
|
-
};
|
|
161
|
+
toJSON(): GradientJSON<TConfig>;
|
|
191
162
|
}
|
|
192
|
-
interface
|
|
193
|
-
isRepeating: boolean;
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
interface IGradientBase<TConfig = unknown> extends GradientLike<GradientData<TConfig>> {
|
|
198
|
-
readonly type: GradientType;
|
|
199
|
-
readonly isRepeating: boolean;
|
|
200
|
-
readonly config: TConfig;
|
|
201
|
-
readonly stops: GradientStop[];
|
|
202
|
-
toJSON(): GradientData<TConfig> & {
|
|
203
|
-
type: GradientType;
|
|
204
|
-
};
|
|
205
|
-
addStop(stop: GradientStop): void;
|
|
163
|
+
interface IGradientWithStops<TStop = GradientStop, TConfig extends object = Record<string, never>> extends IGradient<TConfig> {
|
|
164
|
+
isRepeating(): boolean;
|
|
165
|
+
getStops(): TStop[];
|
|
166
|
+
addStop(stop: TStop): void;
|
|
206
167
|
removeStop(index: number): void;
|
|
207
|
-
|
|
168
|
+
minColorStopsCount(): number;
|
|
169
|
+
toJSON(): GradientWithStopsJSON<TStop, TConfig>;
|
|
208
170
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/gradient/kind/base/GradientBase.d.ts
|
|
173
|
+
type SerializedStopToken = {
|
|
174
|
+
type: "color-hint";
|
|
175
|
+
position: number;
|
|
176
|
+
} | {
|
|
177
|
+
type: "color-stop";
|
|
178
|
+
value: string;
|
|
179
|
+
positions: [number] | [number, number];
|
|
180
|
+
};
|
|
181
|
+
declare abstract class GradientBase<TConfig extends object = Record<string, never>> implements IGradient<TConfig> {
|
|
182
|
+
readonly type: GradientType;
|
|
212
183
|
private _config;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
get isRepeating(): boolean;
|
|
216
|
-
get config(): TConfig;
|
|
217
|
-
get stops(): GradientStop[];
|
|
184
|
+
constructor(type: GradientType, config: TConfig);
|
|
185
|
+
getConfig(): TConfig;
|
|
218
186
|
abstract clone(): this;
|
|
187
|
+
abstract equals(other: unknown): boolean;
|
|
219
188
|
abstract toString(): string;
|
|
220
|
-
toJSON():
|
|
221
|
-
type: GradientType;
|
|
222
|
-
};
|
|
223
|
-
addStop(stop: GradientStop): void;
|
|
224
|
-
static fromString(_: string): void;
|
|
225
|
-
static fromAbi(_: GradientAbi): void;
|
|
226
|
-
removeStop(index: number): void;
|
|
227
|
-
equals(other: IGradientBase<TConfig>): boolean;
|
|
228
|
-
protected _minColorStopsCount(): number;
|
|
229
|
-
protected _getSortedStops(stops: GradientStop[]): GradientStop[];
|
|
189
|
+
toJSON(): GradientJSON<TConfig>;
|
|
230
190
|
protected abstract _validateConfig(value: TConfig): void;
|
|
231
|
-
private _validateStops;
|
|
232
|
-
protected _validateStopsShape(value: GradientStop[]): void;
|
|
233
|
-
protected _validateStopsSequence(value: GradientStop[]): void;
|
|
234
|
-
private _cloneStops;
|
|
235
191
|
private _cloneConfig;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
192
|
+
}
|
|
193
|
+
declare abstract class GradientWithStopsBase<TStop extends GradientStop<number, object>, TConfig extends GradientWithStopsJSONExtra & {
|
|
194
|
+
interpolation: GradientInterpolation;
|
|
195
|
+
}> extends GradientBase<TConfig> implements IGradientWithStops<TStop, TConfig> {
|
|
196
|
+
private _stops;
|
|
197
|
+
constructor(type: GradientType, stops: TStop[], config: TConfig);
|
|
198
|
+
static fromAbi(abi: GradientAbi): GradientWithStopsBase<GradientStop, GradientWithStopsJSONExtra & {
|
|
199
|
+
interpolation: GradientInterpolation;
|
|
200
|
+
}>;
|
|
201
|
+
static fromString(input: string): GradientWithStopsBase<GradientStop, GradientWithStopsJSONExtra & {
|
|
202
|
+
interpolation: GradientInterpolation;
|
|
243
203
|
}>;
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
}>): boolean;
|
|
204
|
+
private static _normalizeConfigInterpolation;
|
|
205
|
+
isRepeating(): boolean;
|
|
206
|
+
minColorStopsCount(): number;
|
|
207
|
+
getStops(): TStop[];
|
|
208
|
+
toJSON(): GradientWithStopsJSON<TStop, TConfig>;
|
|
209
|
+
addStop(stop: TStop): void;
|
|
210
|
+
removeStop(index: number): void;
|
|
252
211
|
protected _serializeStopsCompact(): string[];
|
|
212
|
+
protected _buildSerializedStopTokens(): SerializedStopToken[];
|
|
213
|
+
protected _canOmitAllStopPositions(tokens: SerializedStopToken[]): boolean;
|
|
253
214
|
protected _formatPercent(value: number): number;
|
|
254
215
|
protected static _normalizeAbiInputsToStops(inputs: GradientAbiInput[]): GradientStop[];
|
|
255
216
|
private static _parsePosition;
|
|
256
217
|
private static _parseColorStopInput;
|
|
257
218
|
private static _resolvePendingStops;
|
|
219
|
+
private _cloneStops;
|
|
220
|
+
private _getSortedStops;
|
|
221
|
+
private _validateStops;
|
|
222
|
+
private _validateStopsShape;
|
|
223
|
+
private _validateStopsSequence;
|
|
258
224
|
}
|
|
259
225
|
//#endregion
|
|
260
|
-
//#region src/
|
|
261
|
-
|
|
226
|
+
//#region src/gradient/kind/base/geometry.d.ts
|
|
227
|
+
declare function parseGradientAngle(input: string): GradientAngleValue;
|
|
228
|
+
declare function formatGradientAngle(value: GradientAngleValue): string;
|
|
229
|
+
declare function parseGradientLengthPercentage(input: string): GradientLengthPercentage;
|
|
230
|
+
declare function formatGradientLengthPercentage(value: GradientLengthPercentage): string;
|
|
231
|
+
declare function isGradientLengthPercentageToken(value: string | undefined): value is string;
|
|
232
|
+
declare function parseGradientPosition(tokens: string[]): GradientPosition;
|
|
233
|
+
declare function formatGradientPosition(position: GradientPosition): string;
|
|
234
|
+
declare function validateGradientAngle(value: GradientAngleValue): void;
|
|
235
|
+
declare function validateGradientLengthPercentage(value: GradientLengthPercentage): void;
|
|
236
|
+
declare function validateGradientPosition(position: GradientPosition): void;
|
|
237
|
+
declare function isDefaultGradientPosition(position: GradientPosition): boolean;
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/gradient/kind/linear/types.d.ts
|
|
240
|
+
/**
|
|
241
|
+
* Discriminator for linear gradient instances and serialized linear gradient data.
|
|
242
|
+
*
|
|
243
|
+
* Дискриминатор для экземпляров линейного градиента и его сериализованных данных.
|
|
244
|
+
*/
|
|
245
|
+
type GradientLinearType = "linear-gradient";
|
|
246
|
+
/**
|
|
247
|
+
* Stop model used by linear gradients.
|
|
248
|
+
*
|
|
249
|
+
* Модель stop-точки, которую использует линейный градиент.
|
|
250
|
+
*
|
|
251
|
+
* @remarks
|
|
252
|
+
* This currently maps to the shared Gradiente stop model: color stops and color hints.
|
|
253
|
+
*
|
|
254
|
+
* Сейчас это общий stop-слой Gradiente: цветовые stop-точки и color hints.
|
|
255
|
+
*/
|
|
256
|
+
type GradientLinearStop = GradientStop;
|
|
257
|
+
/**
|
|
258
|
+
* Configuration for the internal linear gradient model.
|
|
259
|
+
*
|
|
260
|
+
* Конфигурация внутренней модели линейного градиента.
|
|
261
|
+
*
|
|
262
|
+
* @remarks
|
|
263
|
+
* Renderer-specific concepts such as CSS direction keywords belong to parsers or serializers.
|
|
264
|
+
* The core model stores geometry as a normalized numeric angle.
|
|
265
|
+
*
|
|
266
|
+
* Renderer-специфичные понятия, например CSS-направления через keywords, относятся к
|
|
267
|
+
* парсерам или сериализаторам. В core-модели геометрия хранится как нормализованный числовой угол.
|
|
268
|
+
*/
|
|
269
|
+
type GradientLinearConfig = GradientWithStopsJSONExtra & {
|
|
270
|
+
/**
|
|
271
|
+
* Direction angle in radians, normalized to the internal Gradiente angle model.
|
|
272
|
+
*
|
|
273
|
+
* Угол направления в радианах, нормализованный под внутреннюю модель углов Gradiente.
|
|
274
|
+
*/
|
|
262
275
|
angle: number;
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
276
|
+
/**
|
|
277
|
+
* Color interpolation settings used between color stops.
|
|
278
|
+
*
|
|
279
|
+
* Настройки цветовой интерполяции между цветовыми stop-точками.
|
|
280
|
+
*/
|
|
281
|
+
interpolation: GradientInterpolation;
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* JSON representation of a linear gradient in Gradiente's internal model.
|
|
285
|
+
*
|
|
286
|
+
* JSON-представление линейного градиента во внутренней модели Gradiente.
|
|
287
|
+
*
|
|
288
|
+
* @remarks
|
|
289
|
+
* This is not a CSS string or renderer adapter payload. It preserves the typed config and stops.
|
|
290
|
+
*
|
|
291
|
+
* Это не CSS-строка и не payload renderer-адаптера. Здесь сохраняются типизированные
|
|
292
|
+
* config и stops.
|
|
293
|
+
*/
|
|
294
|
+
type GradientLinearJSON = GradientWithStopsJSON<GradientLinearStop, GradientLinearConfig> & {
|
|
295
|
+
/**
|
|
296
|
+
* Serialized gradient type discriminator.
|
|
297
|
+
*
|
|
298
|
+
* Дискриминатор типа сериализованного градиента.
|
|
299
|
+
*/
|
|
300
|
+
type: GradientLinearType;
|
|
301
|
+
};
|
|
302
|
+
/**
|
|
303
|
+
* Optional constructor config for a linear gradient.
|
|
304
|
+
*
|
|
305
|
+
* Опциональная конфигурация конструктора линейного градиента.
|
|
306
|
+
*
|
|
307
|
+
* @remarks
|
|
308
|
+
* Every config field is optional. Missing values are resolved from the class defaults.
|
|
309
|
+
*
|
|
310
|
+
* Все поля config опциональны. Отсутствующие значения заполняются дефолтами класса.
|
|
311
|
+
*/
|
|
312
|
+
type GradientLinearConfigInput = Omit<Partial<GradientLinearConfig>, "interpolation"> & {
|
|
313
|
+
/**
|
|
314
|
+
* Optional color interpolation overrides.
|
|
315
|
+
*
|
|
316
|
+
* Опциональные переопределения цветовой интерполяции.
|
|
317
|
+
*/
|
|
318
|
+
interpolation?: Partial<GradientInterpolation>;
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* Public instance contract for a linear gradient.
|
|
322
|
+
*
|
|
323
|
+
* Публичный контракт экземпляра линейного градиента.
|
|
324
|
+
*
|
|
325
|
+
* @remarks
|
|
326
|
+
* The interface exposes the renderer-agnostic model: typed config, typed stops,
|
|
327
|
+
* cloning, equality, string serialization, and JSON serialization inherited from the base contract.
|
|
328
|
+
*
|
|
329
|
+
* Интерфейс раскрывает renderer-agnostic модель: типизированный config, типизированные stops,
|
|
330
|
+
* клонирование, сравнение, строковую сериализацию и JSON-сериализацию из базового контракта.
|
|
331
|
+
*/
|
|
332
|
+
interface IGradientLinear extends IGradientWithStops<GradientLinearStop, GradientLinearConfig> {
|
|
333
|
+
/**
|
|
334
|
+
* Linear gradient type discriminator.
|
|
335
|
+
*
|
|
336
|
+
* Дискриминатор типа линейного градиента.
|
|
337
|
+
*/
|
|
338
|
+
readonly type: GradientLinearType;
|
|
339
|
+
}
|
|
340
|
+
//#endregion
|
|
341
|
+
//#region src/gradient/kind/linear/GradientLinear.d.ts
|
|
342
|
+
declare class GradientLinear extends GradientWithStopsBase<GradientLinearStop, GradientLinearConfig> implements IGradientLinear {
|
|
343
|
+
private static readonly DEFAULT_CONFIG;
|
|
344
|
+
readonly type: GradientLinearType;
|
|
345
|
+
constructor(stops: GradientLinearStop[], config?: GradientLinearConfigInput);
|
|
346
|
+
static normalizeConfig(input: string): GradientLinearConfig;
|
|
347
|
+
static fromString(input: string): GradientLinear;
|
|
348
|
+
static fromAbi(abi: GradientAbi): GradientLinear;
|
|
271
349
|
clone(): this;
|
|
350
|
+
equals(other: unknown): boolean;
|
|
351
|
+
toJSON(): GradientLinearJSON;
|
|
272
352
|
toString(): string;
|
|
273
|
-
protected _validateConfig(
|
|
274
|
-
private static
|
|
275
|
-
private
|
|
276
|
-
private _parseAngleToString;
|
|
277
|
-
private _parseInterpolationToString;
|
|
353
|
+
protected _validateConfig(config: GradientLinearConfig): void;
|
|
354
|
+
private static _resolveConfig;
|
|
355
|
+
private static _parseAngleToken;
|
|
278
356
|
private static _tokenizeConfigInput;
|
|
357
|
+
private _serializeConfig;
|
|
358
|
+
private _serializeAngle;
|
|
359
|
+
private _serializeInterpolation;
|
|
360
|
+
private _isDefaultInterpolation;
|
|
279
361
|
}
|
|
280
362
|
//#endregion
|
|
281
|
-
//#region src/
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
363
|
+
//#region src/gradient/kind/radial/types.d.ts
|
|
364
|
+
/**
|
|
365
|
+
* Discriminator for radial gradient instances and serialized radial gradient data.
|
|
366
|
+
*
|
|
367
|
+
* Дискриминатор для экземпляров радиального градиента и его сериализованных данных.
|
|
368
|
+
*/
|
|
369
|
+
type GradientRadialType = "radial-gradient";
|
|
370
|
+
/**
|
|
371
|
+
* Stop model used by radial gradients.
|
|
372
|
+
*
|
|
373
|
+
* Модель stop-точки, которую использует радиальный градиент.
|
|
374
|
+
*/
|
|
375
|
+
type GradientRadialStop = GradientStop;
|
|
376
|
+
/**
|
|
377
|
+
* Shape of a radial gradient.
|
|
378
|
+
*
|
|
379
|
+
* Форма радиального градиента.
|
|
380
|
+
*/
|
|
381
|
+
type GradientRadialShape = "circle" | "ellipse";
|
|
382
|
+
/**
|
|
383
|
+
* Keyword extent used to resolve radial gradient size.
|
|
384
|
+
*
|
|
385
|
+
* Keyword-область, через которую определяется размер радиального градиента.
|
|
386
|
+
*/
|
|
387
|
+
type GradientRadialExtent = "closest-side" | "closest-corner" | "farthest-side" | "farthest-corner";
|
|
388
|
+
/**
|
|
389
|
+
* Internal size model for radial gradients.
|
|
390
|
+
*
|
|
391
|
+
* Внутренняя модель размера радиального градиента.
|
|
392
|
+
*/
|
|
393
|
+
type GradientRadialSize = {
|
|
285
394
|
kind: "extent";
|
|
286
|
-
value:
|
|
395
|
+
value: GradientRadialExtent;
|
|
287
396
|
} | {
|
|
288
397
|
kind: "explicit";
|
|
289
398
|
x: GradientLengthPercentage;
|
|
290
399
|
y?: GradientLengthPercentage;
|
|
291
400
|
};
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
401
|
+
/**
|
|
402
|
+
* Configuration for the internal radial gradient model.
|
|
403
|
+
*
|
|
404
|
+
* Конфигурация внутренней модели радиального градиента.
|
|
405
|
+
*/
|
|
406
|
+
type GradientRadialConfig = GradientWithStopsJSONExtra & {
|
|
407
|
+
shape: GradientRadialShape;
|
|
408
|
+
size: GradientRadialSize;
|
|
295
409
|
position: GradientPosition;
|
|
296
|
-
interpolation
|
|
410
|
+
interpolation: GradientInterpolation;
|
|
411
|
+
};
|
|
412
|
+
/**
|
|
413
|
+
* Optional constructor config for a radial gradient.
|
|
414
|
+
*
|
|
415
|
+
* Опциональная конфигурация конструктора радиального градиента.
|
|
416
|
+
*/
|
|
417
|
+
type GradientRadialConfigInput = Omit<Partial<GradientRadialConfig>, "interpolation"> & {
|
|
418
|
+
interpolation?: Partial<GradientInterpolation>;
|
|
419
|
+
};
|
|
420
|
+
/**
|
|
421
|
+
* JSON representation of a radial gradient in Gradiente's internal model.
|
|
422
|
+
*
|
|
423
|
+
* JSON-представление радиального градиента во внутренней модели Gradiente.
|
|
424
|
+
*/
|
|
425
|
+
type GradientRadialJSON<TType extends string = GradientRadialType> = GradientWithStopsJSON<GradientRadialStop, GradientRadialConfig> & {
|
|
426
|
+
type: TType;
|
|
297
427
|
};
|
|
298
|
-
|
|
428
|
+
/**
|
|
429
|
+
* Public instance contract for a radial gradient.
|
|
430
|
+
*
|
|
431
|
+
* Публичный контракт экземпляра радиального градиента.
|
|
432
|
+
*/
|
|
433
|
+
interface IGradientRadial extends IGradientWithStops<GradientRadialStop, GradientRadialConfig> {
|
|
434
|
+
readonly type: GradientRadialType;
|
|
435
|
+
}
|
|
436
|
+
//#endregion
|
|
437
|
+
//#region src/gradient/kind/radial/GradientRadial.d.ts
|
|
438
|
+
declare class GradientRadial<TType extends string = GradientRadialType> extends GradientWithStopsBase<GradientRadialStop, GradientRadialConfig> {
|
|
439
|
+
protected static readonly gradientType: string;
|
|
299
440
|
private static readonly DEFAULT_CONFIG;
|
|
300
|
-
readonly type:
|
|
301
|
-
constructor(
|
|
302
|
-
static
|
|
303
|
-
static
|
|
441
|
+
readonly type: TType;
|
|
442
|
+
constructor(stops: GradientRadialStop[], config?: GradientRadialConfigInput);
|
|
443
|
+
static normalizeConfig(input: string): GradientRadialConfig;
|
|
444
|
+
static fromString(input: string): GradientRadial<string>;
|
|
445
|
+
static fromAbi(abi: GradientAbi): GradientRadial<string>;
|
|
304
446
|
clone(): this;
|
|
447
|
+
equals(other: unknown): boolean;
|
|
448
|
+
minColorStopsCount(): number;
|
|
449
|
+
toJSON(): GradientRadialJSON<TType>;
|
|
305
450
|
toString(): string;
|
|
306
|
-
protected _validateConfig(config:
|
|
307
|
-
private
|
|
308
|
-
|
|
309
|
-
private
|
|
310
|
-
private
|
|
311
|
-
private
|
|
312
|
-
private
|
|
313
|
-
private
|
|
451
|
+
protected _validateConfig(config: GradientRadialConfig): void;
|
|
452
|
+
private static _resolveConfig;
|
|
453
|
+
protected static _parseConfig(inputs: GradientAbiInput[]): GradientRadialConfig;
|
|
454
|
+
private static _parseConfigInput;
|
|
455
|
+
private static _parseRadialPosition;
|
|
456
|
+
private static _parseKeywordPosition;
|
|
457
|
+
private static _parseLengthPercentage;
|
|
458
|
+
private static _isShape;
|
|
459
|
+
private static _isExtent;
|
|
460
|
+
private static _isLengthPercentageToken;
|
|
461
|
+
private static _isLengthUnit;
|
|
462
|
+
private static _isPositionKeywordX;
|
|
463
|
+
private static _isPositionKeywordY;
|
|
464
|
+
private _serializeConfig;
|
|
465
|
+
private _serializeRadialConfig;
|
|
466
|
+
private _serializeSize;
|
|
314
467
|
private _serializePosition;
|
|
468
|
+
private _serializeInterpolation;
|
|
315
469
|
private _formatLengthPercentage;
|
|
316
|
-
|
|
317
|
-
private
|
|
318
|
-
private
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
declare class DiamondGradient extends RadialGradient {
|
|
324
|
-
readonly type: GradientType;
|
|
325
|
-
constructor(input: Partial<GradientData<DiamondGradientConfig>>);
|
|
326
|
-
static fromString(input: string): DiamondGradient;
|
|
327
|
-
static fromAbi(abi: GradientAbi): DiamondGradient;
|
|
328
|
-
clone(): this;
|
|
470
|
+
private _isDefaultShape;
|
|
471
|
+
private _isDefaultSize;
|
|
472
|
+
private _isDefaultPosition;
|
|
473
|
+
private _isDefaultInterpolation;
|
|
474
|
+
private _validateSize;
|
|
475
|
+
private _validatePosition;
|
|
476
|
+
private _validateLengthPercentage;
|
|
329
477
|
}
|
|
330
478
|
//#endregion
|
|
331
|
-
//#region src/
|
|
332
|
-
|
|
479
|
+
//#region src/gradient/kind/conic/types.d.ts
|
|
480
|
+
/**
|
|
481
|
+
* Discriminator for conic gradient instances and serialized conic gradient data.
|
|
482
|
+
*
|
|
483
|
+
* Дискриминатор для экземпляров конического градиента и его сериализованных данных.
|
|
484
|
+
*/
|
|
485
|
+
type GradientConicType = "conic-gradient";
|
|
486
|
+
/**
|
|
487
|
+
* Stop model used by conic gradients.
|
|
488
|
+
*
|
|
489
|
+
* Модель stop-точки, которую использует конический градиент.
|
|
490
|
+
*/
|
|
491
|
+
type GradientConicStop = GradientStop;
|
|
492
|
+
/**
|
|
493
|
+
* Configuration for the internal conic gradient model.
|
|
494
|
+
*
|
|
495
|
+
* Конфигурация внутренней модели конического градиента.
|
|
496
|
+
*/
|
|
497
|
+
type GradientConicConfig = GradientWithStopsJSONExtra & {
|
|
333
498
|
from: GradientAngleValue;
|
|
334
499
|
position: GradientPosition;
|
|
335
|
-
interpolation
|
|
500
|
+
interpolation: GradientInterpolation;
|
|
336
501
|
};
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
502
|
+
/**
|
|
503
|
+
* Optional constructor config for a conic gradient.
|
|
504
|
+
*
|
|
505
|
+
* Опциональная конфигурация конструктора конического градиента.
|
|
506
|
+
*/
|
|
507
|
+
type GradientConicConfigInput = Omit<Partial<GradientConicConfig>, "interpolation"> & {
|
|
508
|
+
interpolation?: Partial<GradientInterpolation>;
|
|
509
|
+
};
|
|
510
|
+
/**
|
|
511
|
+
* JSON representation of a conic gradient in Gradiente's internal model.
|
|
512
|
+
*
|
|
513
|
+
* JSON-представление конического градиента во внутренней модели Gradiente.
|
|
514
|
+
*/
|
|
515
|
+
type GradientConicJSON = GradientWithStopsJSON<GradientConicStop, GradientConicConfig> & {
|
|
516
|
+
type: GradientConicType;
|
|
517
|
+
};
|
|
518
|
+
/**
|
|
519
|
+
* Public instance contract for a conic gradient.
|
|
520
|
+
*
|
|
521
|
+
* Публичный контракт экземпляра конического градиента.
|
|
522
|
+
*/
|
|
523
|
+
interface IGradientConic extends IGradientWithStops<GradientConicStop, GradientConicConfig> {
|
|
524
|
+
readonly type: GradientConicType;
|
|
525
|
+
}
|
|
526
|
+
//#endregion
|
|
527
|
+
//#region src/gradient/kind/conic/GradientConic.d.ts
|
|
528
|
+
declare class GradientConic extends GradientWithStopsBase<GradientConicStop, GradientConicConfig> implements IGradientConic {
|
|
529
|
+
private static readonly DEFAULT_CONFIG;
|
|
530
|
+
readonly type: GradientConicType;
|
|
531
|
+
constructor(stops: GradientConicStop[], config?: GradientConicConfigInput);
|
|
532
|
+
static normalizeConfig(input: string): GradientConicConfig;
|
|
533
|
+
static fromString(input: string): GradientConic;
|
|
534
|
+
static fromAbi(abi: GradientAbi): GradientConic;
|
|
340
535
|
clone(): this;
|
|
536
|
+
equals(other: unknown): boolean;
|
|
537
|
+
minColorStopsCount(): number;
|
|
538
|
+
toJSON(): GradientConicJSON;
|
|
341
539
|
toString(): string;
|
|
342
|
-
|
|
343
|
-
static
|
|
344
|
-
|
|
540
|
+
protected _validateConfig(config: GradientConicConfig): void;
|
|
541
|
+
private static _resolveConfig;
|
|
542
|
+
private static _parseConfigInput;
|
|
345
543
|
private _serializeConfig;
|
|
346
|
-
private _serializePosition;
|
|
347
|
-
private _formatLengthPercentage;
|
|
348
544
|
private _serializeInterpolation;
|
|
349
545
|
private _isDefaultFrom;
|
|
350
|
-
private
|
|
351
|
-
private static _parseConfig;
|
|
352
|
-
private static _parseLengthPercentage;
|
|
353
|
-
private static _parseAngle;
|
|
546
|
+
private _isDefaultInterpolation;
|
|
354
547
|
}
|
|
355
548
|
//#endregion
|
|
356
|
-
//#region src/
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
549
|
+
//#region src/gradient/kind/diamond/types.d.ts
|
|
550
|
+
/**
|
|
551
|
+
* Discriminator for diamond gradient instances and serialized diamond gradient data.
|
|
552
|
+
*
|
|
553
|
+
* Дискриминатор для экземпляров diamond-градиента и его сериализованных данных.
|
|
554
|
+
*/
|
|
555
|
+
type GradientDiamondType = "diamond-gradient";
|
|
556
|
+
/**
|
|
557
|
+
* Stop model used by diamond gradients.
|
|
558
|
+
*
|
|
559
|
+
* Модель stop-точки, которую использует diamond-градиент.
|
|
560
|
+
*/
|
|
561
|
+
type GradientDiamondStop = GradientRadialStop;
|
|
562
|
+
/**
|
|
563
|
+
* Configuration for the internal diamond gradient model.
|
|
564
|
+
*
|
|
565
|
+
* Конфигурация внутренней модели diamond-градиента.
|
|
566
|
+
*/
|
|
567
|
+
type GradientDiamondConfig = GradientRadialConfig;
|
|
568
|
+
/**
|
|
569
|
+
* Optional constructor config for a diamond gradient.
|
|
570
|
+
*
|
|
571
|
+
* Опциональная конфигурация конструктора diamond-градиента.
|
|
572
|
+
*/
|
|
573
|
+
type GradientDiamondConfigInput = GradientRadialConfigInput;
|
|
574
|
+
/**
|
|
575
|
+
* JSON representation of a diamond gradient in Gradiente's internal model.
|
|
576
|
+
*
|
|
577
|
+
* JSON-представление diamond-градиента во внутренней модели Gradiente.
|
|
578
|
+
*/
|
|
579
|
+
type GradientDiamondJSON = GradientWithStopsJSON<GradientDiamondStop, GradientDiamondConfig> & {
|
|
580
|
+
type: GradientDiamondType;
|
|
581
|
+
};
|
|
582
|
+
/**
|
|
583
|
+
* Public instance contract for a diamond gradient.
|
|
584
|
+
*
|
|
585
|
+
* Публичный контракт экземпляра diamond-градиента.
|
|
586
|
+
*/
|
|
587
|
+
interface IGradientDiamond extends IGradientWithStops<GradientDiamondStop, GradientDiamondConfig> {
|
|
588
|
+
readonly type: GradientDiamondType;
|
|
589
|
+
}
|
|
590
|
+
//#endregion
|
|
591
|
+
//#region src/gradient/kind/diamond/GradientDiamond.d.ts
|
|
592
|
+
declare class GradientDiamond extends GradientRadial<GradientDiamondType> implements IGradientDiamond {
|
|
593
|
+
protected static readonly gradientType: string;
|
|
594
|
+
constructor(stops: GradientDiamondStop[], config?: GradientDiamondConfigInput);
|
|
595
|
+
static fromString(input: string): GradientDiamond;
|
|
596
|
+
static fromAbi(abi: GradientAbi): GradientDiamond;
|
|
597
|
+
clone(): this;
|
|
598
|
+
equals(other: unknown): boolean;
|
|
599
|
+
toJSON(): GradientDiamondJSON;
|
|
600
|
+
}
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region src/gradient/kind/mesh/types.d.ts
|
|
603
|
+
/**
|
|
604
|
+
* Discriminator for mesh gradient instances and serialized mesh gradient data.
|
|
605
|
+
*
|
|
606
|
+
* Дискриминатор для экземпляров mesh-градиента и его сериализованных данных.
|
|
607
|
+
*/
|
|
608
|
+
type GradientMeshType = "mesh-gradient";
|
|
609
|
+
/**
|
|
610
|
+
* Surface interpolation method used to sample colors inside mesh patches.
|
|
611
|
+
*
|
|
612
|
+
* Метод интерполяции поверхности, который используется для сэмплинга цветов внутри mesh-патчей.
|
|
613
|
+
*/
|
|
614
|
+
type GradientMeshInterpolationMethod = "bilinear" | "bicubic";
|
|
615
|
+
/**
|
|
616
|
+
* Patch edge that can carry optional cubic control handles.
|
|
617
|
+
*
|
|
618
|
+
* Сторона патча, на которой могут быть опциональные cubic-контрольные ручки.
|
|
619
|
+
*/
|
|
620
|
+
type GradientMeshPatchSide = "top" | "right" | "bottom" | "left";
|
|
621
|
+
/**
|
|
622
|
+
* Configuration for the internal mesh gradient model.
|
|
623
|
+
*
|
|
624
|
+
* Конфигурация внутренней модели mesh-градиента.
|
|
625
|
+
*
|
|
626
|
+
* @remarks
|
|
627
|
+
* The grid describes the regular topology expected by renderers and samplers.
|
|
628
|
+
* Vertices may still be spatially distorted: `rows` and `columns` describe topology, not visual alignment.
|
|
629
|
+
*
|
|
630
|
+
* Grid описывает регулярную топологию для рендереров и сэмплеров.
|
|
631
|
+
* Вершины могут быть визуально искажены: `rows` и `columns` описывают топологию, а не выравнивание на плоскости.
|
|
632
|
+
*/
|
|
633
|
+
type GradientMeshConfig = {
|
|
634
|
+
/**
|
|
635
|
+
* Number of vertex rows in the mesh topology.
|
|
636
|
+
*
|
|
637
|
+
* Количество рядов вершин в mesh-топологии.
|
|
638
|
+
*/
|
|
360
639
|
rows: number;
|
|
640
|
+
/**
|
|
641
|
+
* Number of vertex columns in the mesh topology.
|
|
642
|
+
*
|
|
643
|
+
* Количество колонок вершин в mesh-топологии.
|
|
644
|
+
*/
|
|
361
645
|
columns: number;
|
|
362
|
-
|
|
363
|
-
|
|
646
|
+
/**
|
|
647
|
+
* Color sampling method inside each patch.
|
|
648
|
+
*
|
|
649
|
+
* Метод сэмплинга цвета внутри каждого патча.
|
|
650
|
+
*/
|
|
651
|
+
method: GradientMeshInterpolationMethod;
|
|
652
|
+
/**
|
|
653
|
+
* Color interpolation settings used when sampling mesh colors.
|
|
654
|
+
*
|
|
655
|
+
* Настройки цветовой интерполяции, используемые при сэмплинге цветов mesh-градиента.
|
|
656
|
+
*/
|
|
657
|
+
interpolation: GradientInterpolation;
|
|
658
|
+
};
|
|
659
|
+
/**
|
|
660
|
+
* Optional constructor config for a mesh gradient.
|
|
661
|
+
*
|
|
662
|
+
* Опциональная конфигурация конструктора mesh-градиента.
|
|
663
|
+
*
|
|
664
|
+
* @remarks
|
|
665
|
+
* Every config field is optional. Missing `rows` and `columns` are inferred from vertex ids or counts when possible,
|
|
666
|
+
* then fall back to the class defaults.
|
|
667
|
+
*
|
|
668
|
+
* Все поля config опциональны. Отсутствующие `rows` и `columns` по возможности выводятся из id вершин или количества
|
|
669
|
+
* элементов, а затем заменяются дефолтами класса.
|
|
670
|
+
*/
|
|
671
|
+
type GradientMeshConfigInput = Omit<Partial<GradientMeshConfig>, "interpolation"> & {
|
|
672
|
+
/**
|
|
673
|
+
* Optional color interpolation overrides.
|
|
674
|
+
*
|
|
675
|
+
* Опциональные переопределения цветовой интерполяции.
|
|
676
|
+
*/
|
|
677
|
+
interpolation?: Partial<GradientInterpolation>;
|
|
364
678
|
};
|
|
365
|
-
|
|
679
|
+
/**
|
|
680
|
+
* Mesh vertex in Gradiente's internal model.
|
|
681
|
+
*
|
|
682
|
+
* Mesh-вершина во внутренней модели Gradiente.
|
|
683
|
+
*/
|
|
684
|
+
type GradientMeshVertex = {
|
|
685
|
+
/**
|
|
686
|
+
* Stable vertex id referenced by patches.
|
|
687
|
+
*
|
|
688
|
+
* Стабильный id вершины, на который ссылаются патчи.
|
|
689
|
+
*/
|
|
366
690
|
id: string;
|
|
691
|
+
/**
|
|
692
|
+
* Horizontal vertex position.
|
|
693
|
+
*
|
|
694
|
+
* Горизонтальная позиция вершины.
|
|
695
|
+
*/
|
|
367
696
|
x: GradientLengthPercentage;
|
|
697
|
+
/**
|
|
698
|
+
* Vertical vertex position.
|
|
699
|
+
*
|
|
700
|
+
* Вертикальная позиция вершины.
|
|
701
|
+
*/
|
|
368
702
|
y: GradientLengthPercentage;
|
|
703
|
+
/**
|
|
704
|
+
* Vertex color in any Culori-readable color format.
|
|
705
|
+
*
|
|
706
|
+
* Цвет вершины в любом формате, который может прочитать Culori.
|
|
707
|
+
*/
|
|
369
708
|
color: string;
|
|
370
709
|
};
|
|
371
|
-
|
|
710
|
+
/**
|
|
711
|
+
* Cubic handle coordinate used by mesh patch edges.
|
|
712
|
+
*
|
|
713
|
+
* Координата cubic-ручки, используемая сторонами mesh-патча.
|
|
714
|
+
*/
|
|
715
|
+
type GradientMeshHandle = {
|
|
372
716
|
x: GradientLengthPercentage;
|
|
373
717
|
y: GradientLengthPercentage;
|
|
374
718
|
};
|
|
375
|
-
|
|
719
|
+
/**
|
|
720
|
+
* Optional pair of edge handles for a mesh patch side.
|
|
721
|
+
*
|
|
722
|
+
* Опциональная пара edge-ручек для стороны mesh-патча.
|
|
723
|
+
*/
|
|
724
|
+
type GradientMeshPatchHandle = {
|
|
725
|
+
from: GradientMeshHandle;
|
|
726
|
+
to: GradientMeshHandle;
|
|
727
|
+
};
|
|
728
|
+
/**
|
|
729
|
+
* Optional handle map keyed by patch side.
|
|
730
|
+
*
|
|
731
|
+
* Опциональная карта ручек по сторонам патча.
|
|
732
|
+
*/
|
|
733
|
+
type GradientMeshPatchHandles = Partial<Record<GradientMeshPatchSide, GradientMeshPatchHandle>>;
|
|
734
|
+
/**
|
|
735
|
+
* Mesh patch made from four unique vertex references.
|
|
736
|
+
*
|
|
737
|
+
* Mesh-патч, состоящий из четырех уникальных ссылок на вершины.
|
|
738
|
+
*/
|
|
739
|
+
type GradientMeshPatch = {
|
|
740
|
+
/**
|
|
741
|
+
* Stable patch id.
|
|
742
|
+
*
|
|
743
|
+
* Стабильный id патча.
|
|
744
|
+
*/
|
|
376
745
|
id: string;
|
|
377
746
|
topLeft: string;
|
|
378
747
|
topRight: string;
|
|
379
748
|
bottomRight: string;
|
|
380
749
|
bottomLeft: string;
|
|
381
|
-
handles?:
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
type
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
750
|
+
handles?: GradientMeshPatchHandles;
|
|
751
|
+
};
|
|
752
|
+
/**
|
|
753
|
+
* JSON representation of a mesh gradient in Gradiente's internal model.
|
|
754
|
+
*
|
|
755
|
+
* JSON-представление mesh-градиента во внутренней модели Gradiente.
|
|
756
|
+
*/
|
|
757
|
+
type GradientMeshJSON = GradientJSON<GradientMeshConfig, {
|
|
758
|
+
vertices: GradientMeshVertex[];
|
|
759
|
+
patches: GradientMeshPatch[];
|
|
760
|
+
}> & {
|
|
761
|
+
type: GradientMeshType;
|
|
762
|
+
};
|
|
763
|
+
/**
|
|
764
|
+
* Public instance contract for a mesh gradient.
|
|
765
|
+
*
|
|
766
|
+
* Публичный контракт экземпляра mesh-градиента.
|
|
767
|
+
*/
|
|
768
|
+
interface IGradientMesh extends IGradient<GradientMeshConfig> {
|
|
769
|
+
readonly type: GradientMeshType;
|
|
770
|
+
getVertices(): GradientMeshVertex[];
|
|
771
|
+
getPatches(): GradientMeshPatch[];
|
|
772
|
+
getVertex(id: string): GradientMeshVertex | null;
|
|
773
|
+
getPatch(id: string): GradientMeshPatch | null;
|
|
774
|
+
samplePatchColor(patchId: string, u: number, v: number): string;
|
|
775
|
+
}
|
|
776
|
+
//#endregion
|
|
777
|
+
//#region src/gradient/kind/mesh/GradientMesh.d.ts
|
|
778
|
+
declare class GradientMesh extends GradientBase<GradientMeshConfig> implements IGradientMesh {
|
|
779
|
+
private static readonly DEFAULT_CONFIG;
|
|
780
|
+
readonly type: GradientMeshType;
|
|
408
781
|
private readonly _vertices;
|
|
409
782
|
private readonly _patches;
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
static
|
|
415
|
-
static fromAbi(abi: GradientAbi): MeshGradient;
|
|
783
|
+
private _colorSampler?;
|
|
784
|
+
constructor(vertices: GradientMeshVertex[], patches: GradientMeshPatch[], config?: GradientMeshConfigInput);
|
|
785
|
+
static normalizeConfig(input: string): GradientMeshConfig;
|
|
786
|
+
static fromString(input: string): GradientMesh;
|
|
787
|
+
static fromAbi(abi: GradientAbi): GradientMesh;
|
|
416
788
|
clone(): this;
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
};
|
|
789
|
+
equals(other: unknown): boolean;
|
|
790
|
+
toJSON(): GradientMeshJSON;
|
|
420
791
|
toString(): string;
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
private
|
|
428
|
-
private
|
|
429
|
-
private
|
|
430
|
-
private
|
|
792
|
+
getVertices(): GradientMeshVertex[];
|
|
793
|
+
getPatches(): GradientMeshPatch[];
|
|
794
|
+
getVertex(id: string): GradientMeshVertex | null;
|
|
795
|
+
getPatch(id: string): GradientMeshPatch | null;
|
|
796
|
+
samplePatchColor(patchId: string, u: number, v: number): string;
|
|
797
|
+
protected _validateConfig(config: GradientMeshConfig): void;
|
|
798
|
+
private static _resolveConfig;
|
|
799
|
+
private static _inferMissingColumns;
|
|
800
|
+
private static _inferGridSize;
|
|
801
|
+
private static _inferGridSizeFromVertexIds;
|
|
802
|
+
private static _inferGridSizeFromCounts;
|
|
431
803
|
private static _parseConfig;
|
|
432
804
|
private static _parseVertex;
|
|
433
805
|
private static _parsePatch;
|
|
@@ -435,41 +807,35 @@ declare class MeshGradient implements GradientLike<MeshGradientData> {
|
|
|
435
807
|
private static _attachHandles;
|
|
436
808
|
private static _parseLengthPercentage;
|
|
437
809
|
private static _normalizeInterpolation;
|
|
810
|
+
private static _isInterpolationMethod;
|
|
811
|
+
private static _isPatchSide;
|
|
438
812
|
private static _parseFunction;
|
|
439
813
|
private static _findOuterClosingParenIndex;
|
|
440
814
|
private static _splitTopLevelInputs;
|
|
441
815
|
private static _pushTrimmed;
|
|
816
|
+
private _validateMesh;
|
|
817
|
+
private _validateId;
|
|
818
|
+
private _validatePatchVertices;
|
|
819
|
+
private _validateHandles;
|
|
820
|
+
private _validateRegularPatchTopology;
|
|
821
|
+
private _serializeConfig;
|
|
822
|
+
private _serializeInterpolation;
|
|
823
|
+
private _serializeVertex;
|
|
824
|
+
private _serializePatch;
|
|
825
|
+
private _serializeHandles;
|
|
826
|
+
private _isDefaultInterpolation;
|
|
827
|
+
private _validateSampleCoordinate;
|
|
828
|
+
private _getColorSampler;
|
|
442
829
|
}
|
|
443
830
|
//#endregion
|
|
444
|
-
//#region src/
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
fromString(input: string): TGradient;
|
|
448
|
-
}
|
|
449
|
-
declare class GradientFactory {
|
|
450
|
-
private static readonly _registry;
|
|
451
|
-
private static _initialized;
|
|
452
|
-
static add(type: string, value: IGradientStatic): void;
|
|
453
|
-
static get(functionName: string): IGradientStatic | null;
|
|
454
|
-
static remove(functionName: string): boolean;
|
|
455
|
-
static create(input: string | GradientAbi): AnyGradient;
|
|
456
|
-
static isValid(input: string): boolean;
|
|
457
|
-
private static _ensureInitialized;
|
|
458
|
-
private static _getFunctionName;
|
|
459
|
-
}
|
|
460
|
-
type AnyGradient = LinearGradient | RadialGradient | DiamondGradient | ConicGradient | MeshGradient;
|
|
461
|
-
declare function parse(input: string): AnyGradient;
|
|
462
|
-
declare function isGradient(input: string): boolean;
|
|
463
|
-
declare function format(input: string | AnyGradient): string;
|
|
464
|
-
declare function transformTo(target: string, input: string | AnyGradient): unknown;
|
|
465
|
-
declare function transformFrom<TInput = unknown>(target: string, gradientType: string, input: TInput): AnyGradient;
|
|
466
|
-
//#endregion
|
|
467
|
-
//#region src/gradient-transformer/modules/types.d.ts
|
|
831
|
+
//#region src/gradient/transformer/modules/types.d.ts
|
|
832
|
+
type AnyGradient = GradientLinear | GradientRadial<string> | GradientDiamond | GradientConic | GradientMesh;
|
|
833
|
+
type GradientTransformerTarget = "css" | "canvas-2d" | "canvas-webgl" | "svg" | string;
|
|
468
834
|
interface IGradientTransformerModule<TOutput = unknown> {
|
|
469
835
|
readonly target: string;
|
|
470
836
|
readonly gradientType: string;
|
|
471
|
-
to(input:
|
|
472
|
-
from?(input: TOutput):
|
|
837
|
+
to(input: AnyGradient): TOutput;
|
|
838
|
+
from?(input: TOutput): AnyGradient;
|
|
473
839
|
}
|
|
474
840
|
interface ICanvasPaintResult {
|
|
475
841
|
draw(ctx: CanvasRenderingContext2D, width: number, height: number): void;
|
|
@@ -484,182 +850,242 @@ interface ISvgGradientResult {
|
|
|
484
850
|
svg: string;
|
|
485
851
|
}
|
|
486
852
|
//#endregion
|
|
487
|
-
//#region src/gradient
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
//#
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
//#
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
private _resolveKeywordX;
|
|
561
|
-
private _resolveKeywordY;
|
|
562
|
-
private _toRad;
|
|
853
|
+
//#region src/gradient/transformer/modules/GradientTransformerModule.d.ts
|
|
854
|
+
type GradientRuntimeClass<TGradient extends AnyGradient> = Function & {
|
|
855
|
+
prototype: TGradient;
|
|
856
|
+
};
|
|
857
|
+
type GradientTransformerModuleOptions<TGradient extends AnyGradient> = {
|
|
858
|
+
target: string;
|
|
859
|
+
gradientType: TGradient["type"];
|
|
860
|
+
gradientClass: GradientRuntimeClass<TGradient>;
|
|
861
|
+
expectedName: string;
|
|
862
|
+
};
|
|
863
|
+
declare abstract class GradientTransformerModule<TGradient extends AnyGradient, TOutput> implements IGradientTransformerModule<TOutput> {
|
|
864
|
+
readonly target: string;
|
|
865
|
+
readonly gradientType: TGradient["type"];
|
|
866
|
+
private readonly _gradientClass;
|
|
867
|
+
private readonly _expectedName;
|
|
868
|
+
protected constructor(options: GradientTransformerModuleOptions<TGradient>);
|
|
869
|
+
to(input: AnyGradient): TOutput;
|
|
870
|
+
protected abstract transform(gradient: TGradient): TOutput;
|
|
871
|
+
protected _expectGradient(input: AnyGradient): TGradient;
|
|
872
|
+
}
|
|
873
|
+
declare abstract class GradientCssStringTransformerModule<TGradient extends AnyGradient> extends GradientTransformerModule<TGradient, string> {
|
|
874
|
+
protected transform(gradient: TGradient): string;
|
|
875
|
+
}
|
|
876
|
+
//#endregion
|
|
877
|
+
//#region src/gradient/transformer/modules/css/ModuleTransformerLinearGradientToCss.d.ts
|
|
878
|
+
declare class ModuleTransformerLinearGradientToCss extends GradientCssStringTransformerModule<GradientLinear> {
|
|
879
|
+
constructor();
|
|
880
|
+
}
|
|
881
|
+
//#endregion
|
|
882
|
+
//#region src/gradient/transformer/modules/css/ModuleTransformerRadialGradientToCss.d.ts
|
|
883
|
+
declare class ModuleTransformerRadialGradientToCss extends GradientCssStringTransformerModule<GradientRadial> {
|
|
884
|
+
constructor();
|
|
885
|
+
}
|
|
886
|
+
//#endregion
|
|
887
|
+
//#region src/gradient/transformer/modules/css/ModuleTransformerDiamondGradientToCss.d.ts
|
|
888
|
+
declare class ModuleTransformerDiamondGradientToCss extends GradientTransformerModule<GradientDiamond, string> {
|
|
889
|
+
constructor();
|
|
890
|
+
protected transform(gradient: GradientDiamond): string;
|
|
891
|
+
}
|
|
892
|
+
//#endregion
|
|
893
|
+
//#region src/gradient/transformer/modules/css/ModuleTransformerConicGradientToCss.d.ts
|
|
894
|
+
declare class ModuleTransformerConicGradientToCss extends GradientCssStringTransformerModule<GradientConic> {
|
|
895
|
+
constructor();
|
|
896
|
+
}
|
|
897
|
+
//#endregion
|
|
898
|
+
//#region src/gradient/transformer/modules/css/ModuleTransformerMeshGradientToCss.d.ts
|
|
899
|
+
declare class ModuleTransformerMeshGradientToCss extends GradientTransformerModule<GradientMesh, string> {
|
|
900
|
+
constructor();
|
|
901
|
+
protected transform(gradient: GradientMesh): string;
|
|
902
|
+
}
|
|
903
|
+
//#endregion
|
|
904
|
+
//#region src/gradient/transformer/modules/canvas/ModuleTransformerLinearGradientToCanvas.d.ts
|
|
905
|
+
declare class ModuleTransformerLinearGradientToCanvas extends GradientTransformerModule<GradientLinear, ICanvasPaintResult> {
|
|
906
|
+
constructor();
|
|
907
|
+
protected transform(gradient: GradientLinear): ICanvasPaintResult;
|
|
908
|
+
}
|
|
909
|
+
//#endregion
|
|
910
|
+
//#region src/gradient/transformer/modules/canvas/ModuleTransformerRadialGradientToCanvas.d.ts
|
|
911
|
+
declare class ModuleTransformerRadialGradientToCanvas extends GradientTransformerModule<GradientRadial, ICanvasPaintResult> {
|
|
912
|
+
constructor();
|
|
913
|
+
protected transform(gradient: GradientRadial): ICanvasPaintResult;
|
|
914
|
+
}
|
|
915
|
+
//#endregion
|
|
916
|
+
//#region src/gradient/transformer/modules/canvas/ModuleTransformerDiamondGradientToCanvas.d.ts
|
|
917
|
+
declare class ModuleTransformerDiamondGradientToCanvas extends GradientTransformerModule<GradientDiamond, ICanvasPaintResult> {
|
|
918
|
+
constructor();
|
|
919
|
+
protected transform(gradient: GradientDiamond): ICanvasPaintResult;
|
|
920
|
+
}
|
|
921
|
+
//#endregion
|
|
922
|
+
//#region src/gradient/transformer/modules/canvas/ModuleTransformerConicGradientToCanvas.d.ts
|
|
923
|
+
declare class ModuleTransformerConicGradientToCanvas extends GradientTransformerModule<GradientConic, ICanvasPaintResult> {
|
|
924
|
+
constructor();
|
|
925
|
+
protected transform(gradient: GradientConic): ICanvasPaintResult;
|
|
563
926
|
private _normalizeStops;
|
|
564
927
|
private _sampleColor;
|
|
565
|
-
private _mixColor;
|
|
566
|
-
private _parseColor;
|
|
567
|
-
private _clamp01;
|
|
568
928
|
}
|
|
569
929
|
//#endregion
|
|
570
|
-
//#region src/gradient
|
|
571
|
-
declare class ModuleTransformerMeshGradientToCanvas
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
to(input: GradientLike): ICanvasPaintResult;
|
|
930
|
+
//#region src/gradient/transformer/modules/canvas/ModuleTransformerMeshGradientToCanvas.d.ts
|
|
931
|
+
declare class ModuleTransformerMeshGradientToCanvas extends GradientTransformerModule<GradientMesh, ICanvasPaintResult> {
|
|
932
|
+
constructor();
|
|
933
|
+
protected transform(gradient: GradientMesh): ICanvasPaintResult;
|
|
575
934
|
}
|
|
576
935
|
//#endregion
|
|
577
|
-
//#region src/gradient
|
|
936
|
+
//#region src/gradient/transformer/modules/helpers/color-stops.d.ts
|
|
937
|
+
type GradientRenderableColorStop = Extract<GradientStop, {
|
|
938
|
+
type: "color-stop";
|
|
939
|
+
}>;
|
|
940
|
+
//#endregion
|
|
941
|
+
//#region src/gradient/transformer/modules/webgl/helpers.d.ts
|
|
942
|
+
/**
|
|
943
|
+
* RU: Создает и компилирует WebGL shader с подробной ошибкой компиляции.
|
|
944
|
+
* EN: Creates and compiles a WebGL shader with a detailed compile error.
|
|
945
|
+
*/
|
|
946
|
+
declare function createWebGLShader(gl: WebGLRenderingContext, type: number, source: string): WebGLShader;
|
|
947
|
+
/**
|
|
948
|
+
* RU: Создает WebGL program из vertex/fragment shader source.
|
|
949
|
+
* EN: Creates a WebGL program from vertex/fragment shader source.
|
|
950
|
+
*/
|
|
951
|
+
declare function createWebGLProgram(gl: WebGLRenderingContext, vertexSource: string, fragmentSource: string): WebGLProgram;
|
|
952
|
+
/**
|
|
953
|
+
* RU: Преобразует CSS-цвет в WebGL vec4 с каналами 0..1.
|
|
954
|
+
* EN: Converts a CSS color into a WebGL vec4 with 0..1 channels.
|
|
955
|
+
*/
|
|
956
|
+
declare function toWebGLColor(input: string): [number, number, number, number];
|
|
957
|
+
/**
|
|
958
|
+
* RU: Подбирает количество samples на segment так, чтобы уложиться в лимит uniforms.
|
|
959
|
+
* EN: Picks per-segment sample count so the result fits the uniform limit.
|
|
960
|
+
*/
|
|
961
|
+
declare function getWebGLSampleCount(stops: GradientStop[], maxStops: number): number;
|
|
962
|
+
/**
|
|
963
|
+
* RU: Уменьшает stops до WebGL-лимита, пересэмплируя цвета при необходимости.
|
|
964
|
+
* EN: Fits stops to the WebGL limit by resampling colors when necessary.
|
|
965
|
+
*/
|
|
966
|
+
declare function fitStopsToWebGLLimit(stops: GradientStop[], maxStops: number): GradientRenderableColorStop[];
|
|
967
|
+
//#endregion
|
|
968
|
+
//#region src/gradient/transformer/modules/webgl/types.d.ts
|
|
578
969
|
interface IWebGLPaintResult {
|
|
579
970
|
draw(canvas: HTMLCanvasElement, width: number, height: number): void;
|
|
580
971
|
}
|
|
581
972
|
//#endregion
|
|
582
|
-
//#region src/gradient
|
|
583
|
-
declare class ModuleTransformerLinearGradientToCanvasWebGL
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
973
|
+
//#region src/gradient/transformer/modules/webgl/ModuleTransformerLinearGradientToWebgl.d.ts
|
|
974
|
+
declare class ModuleTransformerLinearGradientToCanvasWebGL extends GradientTransformerModule<GradientLinear, IWebGLPaintResult> {
|
|
975
|
+
constructor();
|
|
976
|
+
protected transform(gradient: GradientLinear): IWebGLPaintResult;
|
|
977
|
+
}
|
|
978
|
+
//#endregion
|
|
979
|
+
//#region src/gradient/transformer/modules/webgl/ModuleTransformerConicGradientToWebgl.d.ts
|
|
980
|
+
declare class ModuleTransformerConicGradientToCanvasWebGL extends GradientTransformerModule<GradientConic, IWebGLPaintResult> {
|
|
981
|
+
constructor();
|
|
982
|
+
protected transform(gradient: GradientConic): IWebGLPaintResult;
|
|
587
983
|
}
|
|
588
984
|
//#endregion
|
|
589
|
-
//#region src/gradient
|
|
590
|
-
declare class
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
to(input: GradientBase<any>): IWebGLPaintResult;
|
|
985
|
+
//#region src/gradient/transformer/modules/webgl/ModuleTransformerRadialGradientToWebgl.d.ts
|
|
986
|
+
declare class ModuleTransformerRadialGradientToCanvasWebGL extends GradientTransformerModule<GradientRadial, IWebGLPaintResult> {
|
|
987
|
+
constructor();
|
|
988
|
+
protected transform(gradient: GradientRadial): IWebGLPaintResult;
|
|
594
989
|
}
|
|
595
990
|
//#endregion
|
|
596
|
-
//#region src/gradient
|
|
597
|
-
declare class
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
to(input: GradientBase<any>): IWebGLPaintResult;
|
|
991
|
+
//#region src/gradient/transformer/modules/webgl/ModuleTransformerDiamondGradientToWebgl.d.ts
|
|
992
|
+
declare class ModuleTransformerDiamondGradientToCanvasWebGL extends GradientTransformerModule<GradientDiamond, IWebGLPaintResult> {
|
|
993
|
+
constructor();
|
|
994
|
+
protected transform(gradient: GradientDiamond): IWebGLPaintResult;
|
|
601
995
|
}
|
|
602
996
|
//#endregion
|
|
603
|
-
//#region src/gradient
|
|
604
|
-
declare class
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
to(input: GradientBase<any>): IWebGLPaintResult;
|
|
997
|
+
//#region src/gradient/transformer/modules/webgl/ModuleTransformerMeshGradientToWebgl.d.ts
|
|
998
|
+
declare class ModuleTransformerMeshGradientToCanvasWebGL extends GradientTransformerModule<GradientMesh, IWebGLPaintResult> {
|
|
999
|
+
constructor();
|
|
1000
|
+
protected transform(gradient: GradientMesh): IWebGLPaintResult;
|
|
608
1001
|
}
|
|
609
1002
|
//#endregion
|
|
610
|
-
//#region src/gradient
|
|
611
|
-
declare class
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
to(input: GradientLike): IWebGLPaintResult;
|
|
1003
|
+
//#region src/gradient/transformer/modules/svg/ModuleTransformerLinearGradientToSvg.d.ts
|
|
1004
|
+
declare class ModuleTransformerLinearGradientToSvg extends GradientTransformerModule<GradientLinear, ISvgGradientResult> {
|
|
1005
|
+
constructor();
|
|
1006
|
+
protected transform(gradientValue: GradientLinear): ISvgGradientResult;
|
|
615
1007
|
}
|
|
616
1008
|
//#endregion
|
|
617
|
-
//#region src/gradient
|
|
618
|
-
declare class
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
to(input: GradientLike): ISvgGradientResult;
|
|
1009
|
+
//#region src/gradient/transformer/modules/svg/ModuleTransformerRadialGradientToSvg.d.ts
|
|
1010
|
+
declare class ModuleTransformerRadialGradientToSvg extends GradientTransformerModule<GradientRadial, ISvgGradientResult> {
|
|
1011
|
+
constructor();
|
|
1012
|
+
protected transform(gradientValue: GradientRadial): ISvgGradientResult;
|
|
622
1013
|
}
|
|
623
1014
|
//#endregion
|
|
624
|
-
//#region src/gradient
|
|
625
|
-
declare class
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
to(input: GradientLike): ISvgGradientResult;
|
|
1015
|
+
//#region src/gradient/transformer/modules/svg/ModuleTransformerConicGradientToSvg.d.ts
|
|
1016
|
+
declare class ModuleTransformerConicGradientToSvg extends GradientTransformerModule<GradientConic, ISvgGradientResult> {
|
|
1017
|
+
constructor();
|
|
1018
|
+
protected transform(gradientValue: GradientConic): ISvgGradientResult;
|
|
629
1019
|
}
|
|
630
1020
|
//#endregion
|
|
631
|
-
//#region src/gradient
|
|
632
|
-
declare class
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
to(input: GradientLike): ISvgGradientResult;
|
|
1021
|
+
//#region src/gradient/transformer/modules/svg/ModuleTransformerDiamondGradientToSvg.d.ts
|
|
1022
|
+
declare class ModuleTransformerDiamondGradientToSvg extends GradientTransformerModule<GradientDiamond, ISvgGradientResult> {
|
|
1023
|
+
constructor();
|
|
1024
|
+
protected transform(gradientValue: GradientDiamond): ISvgGradientResult;
|
|
636
1025
|
}
|
|
637
1026
|
//#endregion
|
|
638
|
-
//#region src/gradient
|
|
639
|
-
declare class
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
to(input: GradientLike): ISvgGradientResult;
|
|
1027
|
+
//#region src/gradient/transformer/modules/svg/ModuleTransformerMeshGradientToSvg.d.ts
|
|
1028
|
+
declare class ModuleTransformerMeshGradientToSvg extends GradientTransformerModule<GradientMesh, ISvgGradientResult> {
|
|
1029
|
+
constructor();
|
|
1030
|
+
protected transform(gradientValue: GradientMesh): ISvgGradientResult;
|
|
643
1031
|
}
|
|
644
1032
|
//#endregion
|
|
645
|
-
//#region src/gradient
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
1033
|
+
//#region src/gradient/kind/GradientFactory.d.ts
|
|
1034
|
+
type BuiltInGradientFunctionName = "linear-gradient" | "radial-gradient" | "diamond-gradient" | "conic-gradient" | "mesh-gradient";
|
|
1035
|
+
type GradientByFunctionName = {
|
|
1036
|
+
"linear-gradient": GradientLinear;
|
|
1037
|
+
"radial-gradient": GradientRadial<string>;
|
|
1038
|
+
"diamond-gradient": GradientDiamond;
|
|
1039
|
+
"conic-gradient": GradientConic;
|
|
1040
|
+
"mesh-gradient": GradientMesh;
|
|
1041
|
+
};
|
|
1042
|
+
type GradientTransformOutputByTarget = {
|
|
1043
|
+
css: string;
|
|
1044
|
+
"canvas-2d": ICanvasPaintResult;
|
|
1045
|
+
"canvas-webgl": IWebGLPaintResult;
|
|
1046
|
+
svg: ISvgGradientResult;
|
|
1047
|
+
};
|
|
1048
|
+
type GradientTransformTarget = keyof GradientTransformOutputByTarget;
|
|
1049
|
+
type GradientInstance = IGradient<object>;
|
|
1050
|
+
interface IGradientStatic<TGradient extends GradientInstance = GradientInstance> {
|
|
1051
|
+
fromAbi(abi: GradientAbi): TGradient;
|
|
1052
|
+
fromString(input: string): TGradient;
|
|
650
1053
|
}
|
|
1054
|
+
declare class GradientFactory {
|
|
1055
|
+
private static readonly _registry;
|
|
1056
|
+
private static _initialized;
|
|
1057
|
+
static add<TGradient extends GradientInstance>(type: string, value: IGradientStatic<TGradient>): void;
|
|
1058
|
+
static get<TFunctionName extends BuiltInGradientFunctionName>(functionName: TFunctionName): IGradientStatic<GradientByFunctionName[TFunctionName]> | null;
|
|
1059
|
+
static get<TGradient extends GradientInstance = GradientInstance>(functionName: string): IGradientStatic<TGradient> | null;
|
|
1060
|
+
static remove(functionName: string): boolean;
|
|
1061
|
+
static create<TFunctionName extends BuiltInGradientFunctionName>(input: GradientAbi & {
|
|
1062
|
+
functionName: TFunctionName;
|
|
1063
|
+
}): GradientByFunctionName[TFunctionName];
|
|
1064
|
+
static create(input: string | GradientAbi): AnyGradient;
|
|
1065
|
+
static isValid(input: string): boolean;
|
|
1066
|
+
private static _ensureInitialized;
|
|
1067
|
+
private static _readFunctionName;
|
|
1068
|
+
private static _normalizeFunctionName;
|
|
1069
|
+
}
|
|
1070
|
+
declare function parse(input: string): AnyGradient;
|
|
1071
|
+
declare function isGradient(input: string): boolean;
|
|
1072
|
+
declare function format(input: string | AnyGradient): string;
|
|
651
1073
|
//#endregion
|
|
652
|
-
//#region src/gradient
|
|
1074
|
+
//#region src/gradient/transformer/GradientTransformer.d.ts
|
|
653
1075
|
declare class GradientTransformer {
|
|
654
1076
|
private static readonly _modules;
|
|
655
1077
|
private static _initialized;
|
|
656
1078
|
static add(module: IGradientTransformerModule): void;
|
|
657
1079
|
static get(target: string, gradientType: string): IGradientTransformerModule | null;
|
|
658
1080
|
static remove(target: string, gradientType: string): boolean;
|
|
659
|
-
static to<TOutput = unknown>(target: string, input: string |
|
|
1081
|
+
static to<TOutput = unknown>(target: string, input: string | AnyGradient): TOutput;
|
|
660
1082
|
static from<TOutput = unknown>(target: string, gradientType: string, input: TOutput): AnyGradient;
|
|
661
1083
|
private static _ensureInitialized;
|
|
662
1084
|
private static _getKey;
|
|
663
1085
|
}
|
|
1086
|
+
declare function transformTo<TTarget extends GradientTransformTarget>(target: TTarget, input: string | AnyGradient): GradientTransformOutputByTarget[TTarget];
|
|
1087
|
+
declare function transformTo<TOutput = unknown>(target: string, input: string | AnyGradient): TOutput;
|
|
1088
|
+
declare function transformFrom<TFunctionName extends BuiltInGradientFunctionName>(target: string, gradientType: TFunctionName, input: unknown): GradientByFunctionName[TFunctionName];
|
|
1089
|
+
declare function transformFrom<TInput = unknown>(target: string, gradientType: string, input: TInput): AnyGradient;
|
|
664
1090
|
//#endregion
|
|
665
|
-
export { AbiInputType, AngleUnit, AnyGradient,
|
|
1091
|
+
export { AbiInputType, AngleUnit, AnyGradient, BuiltInGradientFunctionName, GRADIENT_COLOR_SPACE, GRADIENT_HUE_INTERPOLATIONS, GRADIENT_POLAR_COLOR_SPACES, GradientAbi, GradientAbiInput, GradientAngleUnit, GradientAngleValue, GradientBase, GradientByFunctionName, GradientColorHint, GradientColorSpace, GradientColorStop, GradientConic, GradientConicConfig, GradientConicConfigInput, GradientConicJSON, GradientConicStop, GradientConicType, GradientCssStringTransformerModule, GradientDiamond, GradientDiamondConfig, GradientDiamondConfigInput, GradientDiamondJSON, GradientDiamondStop, GradientDiamondType, GradientFactory, GradientHueInterpolation, GradientInterpolation, GradientJSON, GradientLengthPercentage, GradientLengthUnit, GradientLengthValue, GradientLinear, GradientLinearConfig, GradientLinearConfigInput, GradientLinearJSON, GradientLinearStop, GradientLinearType, GradientMesh, GradientMeshConfig, GradientMeshConfigInput, GradientMeshHandle, GradientMeshInterpolationMethod, GradientMeshJSON, GradientMeshPatch, GradientMeshPatchHandle, GradientMeshPatchHandles, GradientMeshPatchSide, GradientMeshType, GradientMeshVertex, GradientPercentValue, GradientPolarColorSpace, GradientPosition, GradientPositionKeywordX, GradientPositionKeywordY, GradientRadial, GradientRadialConfig, GradientRadialConfigInput, GradientRadialExtent, GradientRadialJSON, GradientRadialShape, GradientRadialSize, GradientRadialStop, GradientRadialType, GradientStop, GradientStopKind, GradientTransformOutputByTarget, GradientTransformTarget, GradientTransformer, GradientTransformerModule, GradientTransformerTarget, GradientType, GradientWithStopsBase, GradientWithStopsJSON, GradientWithStopsJSONExtra, ICanvasPaintResult, IGradient, IGradientConic, IGradientDiamond, IGradientLinear, IGradientMesh, IGradientRadial, IGradientStatic, IGradientTransformerModule, IGradientWithStops, ISvgGradientResult, ModuleTransformerConicGradientToCanvas, ModuleTransformerConicGradientToCanvasWebGL, ModuleTransformerConicGradientToCss, ModuleTransformerConicGradientToSvg, ModuleTransformerDiamondGradientToCanvas, ModuleTransformerDiamondGradientToCanvasWebGL, ModuleTransformerDiamondGradientToCss, ModuleTransformerDiamondGradientToSvg, ModuleTransformerLinearGradientToCanvas, ModuleTransformerLinearGradientToCanvasWebGL, ModuleTransformerLinearGradientToCss, ModuleTransformerLinearGradientToSvg, ModuleTransformerMeshGradientToCanvas, ModuleTransformerMeshGradientToCanvasWebGL, ModuleTransformerMeshGradientToCss, ModuleTransformerMeshGradientToSvg, ModuleTransformerRadialGradientToCanvas, ModuleTransformerRadialGradientToCanvasWebGL, ModuleTransformerRadialGradientToCss, ModuleTransformerRadialGradientToSvg, PatternTokenKind, angleValueFromString, ceilTo, clamp, createWebGLProgram, createWebGLShader, degToRad, fitStopsToWebGLLimit, floorTo, format, formatGradientAngle, formatGradientLengthPercentage, formatGradientPosition, fromPercent, getWebGLSampleCount, gradToRad, isAngle, isAngleUnit, isColorHint, isColorStop, isConfig, isDefaultGradientPosition, isGradient, isGradientColorSpace, isGradientHueInterpolation, isGradientLengthPercentageToken, isGradientPolarColorSpace, isPatternSyntaxValid, isPatternValid, isValid, matchExpression, normalizeAngleDeg, normalizeAngleRad, parse, parseGradientAngle, parseGradientLengthPercentage, parseGradientPosition, parseStringToAbi, radToDeg, roundTo, splitTopLevelByWhitespace, toPercent, toWebGLColor, tokenizePattern, transformFrom, transformTo, truncTo, turnToRad, validate, validateGradientAngle, validateGradientLengthPercentage, validateGradientPosition, validatePattern, validatePatternSemantic, validatePatternStructure, validatePatternSyntax };
|