@eagami/ui 5.88.4 → 5.90.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/fesm2022/eagami-ui.mjs +308 -172
- package/fesm2022/eagami-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/eagami-ui.d.ts +41 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eagami/ui",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.90.0",
|
|
4
4
|
"description": "Lightweight, accessible, themeable Angular UI component library and icon set built on CSS custom properties",
|
|
5
5
|
"author": "Michal Wiraszka <michal@eagami.com>",
|
|
6
6
|
"license": "MIT",
|
package/types/eagami-ui.d.ts
CHANGED
|
@@ -76,6 +76,7 @@ export interface EagamiMessages {
|
|
|
76
76
|
remove: string;
|
|
77
77
|
invalidType: string;
|
|
78
78
|
tooLarge: (maxMb: number) => string;
|
|
79
|
+
lowResolution: string;
|
|
79
80
|
};
|
|
80
81
|
breadcrumbs: {
|
|
81
82
|
label: string;
|
|
@@ -1196,14 +1197,18 @@ export interface AvatarEditorCropState {
|
|
|
1196
1197
|
/**
|
|
1197
1198
|
* Canvas-based image editor for cropping avatars. Supports drag-and-drop
|
|
1198
1199
|
* upload, mouse/touch panning, zoom via slider or scroll wheel, and exports
|
|
1199
|
-
* the cropped image as either a `Blob` or a data URL.
|
|
1200
|
+
* the cropped image as either a `Blob` or a data URL. With `letterbox` on, the
|
|
1201
|
+
* image can be zoomed out until it fits the frame whole, and
|
|
1202
|
+
* `--ea-avatar-editor-letterbox` fills the frame around it.
|
|
1200
1203
|
*/
|
|
1201
1204
|
export declare class AvatarEditorComponent implements OnDestroy {
|
|
1205
|
+
readonly rootEl: import("@angular/core").Signal<ElementRef<HTMLElement> | undefined>;
|
|
1202
1206
|
readonly canvasEl: import("@angular/core").Signal<ElementRef<HTMLCanvasElement> | undefined>;
|
|
1203
1207
|
readonly fileInputEl: import("@angular/core").Signal<ElementRef<HTMLInputElement> | undefined>;
|
|
1204
1208
|
protected readonly i18n: EagamiI18nService;
|
|
1205
1209
|
readonly shape: import("@angular/core").InputSignal<AvatarEditorShape>;
|
|
1206
1210
|
readonly canvasSize: import("@angular/core").InputSignal<number>;
|
|
1211
|
+
readonly aspectRatio: import("@angular/core").InputSignal<number>;
|
|
1207
1212
|
readonly currentSrc: import("@angular/core").InputSignal<string | undefined>;
|
|
1208
1213
|
readonly loading: import("@angular/core").InputSignal<boolean>;
|
|
1209
1214
|
readonly accept: import("@angular/core").InputSignal<string>;
|
|
@@ -1212,6 +1217,8 @@ export declare class AvatarEditorComponent implements OnDestroy {
|
|
|
1212
1217
|
readonly maxZoom: import("@angular/core").InputSignal<number>;
|
|
1213
1218
|
readonly exportQuality: import("@angular/core").InputSignal<number>;
|
|
1214
1219
|
readonly exportType: import("@angular/core").InputSignal<string>;
|
|
1220
|
+
readonly displayWidth: import("@angular/core").InputSignal<number | undefined>;
|
|
1221
|
+
readonly letterbox: import("@angular/core").InputSignal<boolean>;
|
|
1215
1222
|
readonly cropState: import("@angular/core").InputSignal<AvatarEditorCropState | null | undefined>;
|
|
1216
1223
|
/** Fires when the user finalises a crop via {@link exportCrop}; payload contains both `Blob` and data URL. */
|
|
1217
1224
|
readonly cropped: import("@angular/core").OutputEmitterRef<AvatarEditorCropEvent>;
|
|
@@ -1231,9 +1238,16 @@ export declare class AvatarEditorComponent implements OnDestroy {
|
|
|
1231
1238
|
readonly isLoading: import("@angular/core").Signal<boolean>;
|
|
1232
1239
|
readonly zoom: import("@angular/core").WritableSignal<number>;
|
|
1233
1240
|
readonly canRevert: import("@angular/core").Signal<boolean>;
|
|
1241
|
+
/** Height of the crop frame, from `canvasSize` as its width and `aspectRatio`. */
|
|
1242
|
+
readonly frameHeight: import("@angular/core").Signal<number>;
|
|
1243
|
+
/** Lowest zoom the controls reach, down to the whole image fitting the frame when `letterbox` is on. */
|
|
1244
|
+
readonly lowestZoom: import("@angular/core").Signal<number>;
|
|
1245
|
+
/** True when the part of the image inside the frame is narrower than `displayWidth`, so the exported crop would be upscaled. */
|
|
1246
|
+
readonly isLowResolution: import("@angular/core").Signal<boolean>;
|
|
1234
1247
|
/** True when the visible crop is darker than mid-grey; drives the `--on-light` class on the overlay so the "Change photo" affordance stays readable. */
|
|
1235
1248
|
readonly isImageDark: import("@angular/core").WritableSignal<boolean>;
|
|
1236
1249
|
private image;
|
|
1250
|
+
private readonly imageSize;
|
|
1237
1251
|
private offsetX;
|
|
1238
1252
|
private offsetY;
|
|
1239
1253
|
private dragStartX;
|
|
@@ -1287,24 +1301,32 @@ export declare class AvatarEditorComponent implements OnDestroy {
|
|
|
1287
1301
|
captureOriginal(): void;
|
|
1288
1302
|
/** Restores the image and crop state captured by the most recent {@link captureOriginal}. */
|
|
1289
1303
|
revertImage(): void;
|
|
1290
|
-
/**
|
|
1291
|
-
|
|
1304
|
+
/**
|
|
1305
|
+
* Renders the current crop to an offscreen canvas, emits `cropped`, and resolves with the resulting `Blob`.
|
|
1306
|
+
* Pass `width` to export at a different width than the frame, keeping its aspect ratio.
|
|
1307
|
+
*/
|
|
1308
|
+
exportCrop(width?: number): Promise<Blob>;
|
|
1292
1309
|
private loadFromUrl;
|
|
1293
1310
|
private loadFile;
|
|
1294
1311
|
private scheduleDrawAfterRender;
|
|
1295
1312
|
private drawLoadedImage;
|
|
1296
1313
|
private centerImage;
|
|
1314
|
+
private setImage;
|
|
1297
1315
|
private getScale;
|
|
1316
|
+
private scaleFor;
|
|
1317
|
+
private traceEllipse;
|
|
1298
1318
|
private getDrawParams;
|
|
1299
1319
|
private applyZoom;
|
|
1300
1320
|
private clampOffset;
|
|
1321
|
+
private clampAxis;
|
|
1322
|
+
private letterboxColor;
|
|
1301
1323
|
private draw;
|
|
1302
1324
|
/**
|
|
1303
1325
|
* Samples the visible crop region and stores whether it's darker than
|
|
1304
1326
|
* mid-grey, so the hover overlay can flip its label and icon between
|
|
1305
1327
|
* white (on dark photos) and black (on light photos).
|
|
1306
1328
|
*
|
|
1307
|
-
* Restricts sampling to the inscribed
|
|
1329
|
+
* Restricts sampling to the inscribed ellipse for circle crops to ignore
|
|
1308
1330
|
* the soon-to-be-masked corners. Uses Rec. 601 perceptual luminance
|
|
1309
1331
|
* weights; transparent pixels and CORS-tainted canvases default to a
|
|
1310
1332
|
* "dark" assumption (white ink).
|
|
@@ -1324,6 +1346,11 @@ export declare class AvatarEditorComponent implements OnDestroy {
|
|
|
1324
1346
|
"required": false;
|
|
1325
1347
|
"isSignal": true;
|
|
1326
1348
|
};
|
|
1349
|
+
"aspectRatio": {
|
|
1350
|
+
"alias": "aspectRatio";
|
|
1351
|
+
"required": false;
|
|
1352
|
+
"isSignal": true;
|
|
1353
|
+
};
|
|
1327
1354
|
"currentSrc": {
|
|
1328
1355
|
"alias": "currentSrc";
|
|
1329
1356
|
"required": false;
|
|
@@ -1364,6 +1391,16 @@ export declare class AvatarEditorComponent implements OnDestroy {
|
|
|
1364
1391
|
"required": false;
|
|
1365
1392
|
"isSignal": true;
|
|
1366
1393
|
};
|
|
1394
|
+
"displayWidth": {
|
|
1395
|
+
"alias": "displayWidth";
|
|
1396
|
+
"required": false;
|
|
1397
|
+
"isSignal": true;
|
|
1398
|
+
};
|
|
1399
|
+
"letterbox": {
|
|
1400
|
+
"alias": "letterbox";
|
|
1401
|
+
"required": false;
|
|
1402
|
+
"isSignal": true;
|
|
1403
|
+
};
|
|
1367
1404
|
"cropState": {
|
|
1368
1405
|
"alias": "cropState";
|
|
1369
1406
|
"required": false;
|