@stemy/ngx-utils 19.7.9 → 19.7.10
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/stemy-ngx-utils.mjs +56 -49
- package/fesm2022/stemy-ngx-utils.mjs.map +1 -1
- package/ngx-utils/common-types.d.ts +11 -1
- package/ngx-utils/components/interactive-canvas/interactive-circle.component.d.ts +2 -3
- package/ngx-utils/components/interactive-canvas/interactive-item.component.d.ts +5 -3
- package/ngx-utils/components/interactive-canvas/interactive-rect.component.d.ts +4 -5
- package/ngx-utils/utils/canvas.d.ts +0 -3
- package/ngx-utils/utils/geometry/shapes.d.ts +4 -0
- package/package.json +1 -1
- package/public_api.d.ts +2 -2
|
@@ -320,6 +320,7 @@ export interface ShapeDistance {
|
|
|
320
320
|
}
|
|
321
321
|
export interface IShape extends IPoint {
|
|
322
322
|
readonly center: IPoint;
|
|
323
|
+
draw(ctx: CanvasRenderingContext2D, ratio?: number): void;
|
|
323
324
|
support(dir: IPoint): IPoint;
|
|
324
325
|
move(pos: IPoint): IShape;
|
|
325
326
|
intersection(shape: IShape): ShapeIntersection;
|
|
@@ -337,6 +338,14 @@ export interface RectCoords {
|
|
|
337
338
|
width: number;
|
|
338
339
|
height: number;
|
|
339
340
|
}
|
|
341
|
+
/**
|
|
342
|
+
* Rectangle frame interface
|
|
343
|
+
*/
|
|
344
|
+
export interface Frame extends IShape {
|
|
345
|
+
width: number;
|
|
346
|
+
height: number;
|
|
347
|
+
rotation: number;
|
|
348
|
+
}
|
|
340
349
|
/**
|
|
341
350
|
* Interface for an interactive canvas params
|
|
342
351
|
*/
|
|
@@ -351,6 +360,7 @@ export interface InteractiveCanvasParams {
|
|
|
351
360
|
*/
|
|
352
361
|
export interface InteractiveCanvasItem {
|
|
353
362
|
readonly position: IPoint;
|
|
363
|
+
readonly frame: Frame;
|
|
354
364
|
readonly shapes: ReadonlyArray<IShape>;
|
|
355
365
|
readonly isValid: boolean;
|
|
356
366
|
readonly validPosition: IPoint;
|
|
@@ -359,7 +369,7 @@ export interface InteractiveCanvasItem {
|
|
|
359
369
|
readonly active: boolean;
|
|
360
370
|
readonly canvas: InteractiveCanvas;
|
|
361
371
|
readonly index: number;
|
|
362
|
-
draw(ctx: CanvasRenderingContext2D): MaybePromise<void>;
|
|
372
|
+
draw(ctx: CanvasRenderingContext2D, shape: IShape): MaybePromise<void>;
|
|
363
373
|
}
|
|
364
374
|
export type InteractiveCanvasItems = ReadonlyArray<InteractiveCanvasItem>;
|
|
365
375
|
/**
|
|
@@ -2,10 +2,9 @@ import { IShape } from "../../common-types";
|
|
|
2
2
|
import { InteractiveItemComponent } from "./interactive-item.component";
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class InteractiveCircleComponent extends InteractiveItemComponent {
|
|
5
|
-
radius: number
|
|
5
|
+
readonly radius: import("@angular/core").InputSignal<number>;
|
|
6
6
|
constructor();
|
|
7
|
-
draw(ctx: CanvasRenderingContext2D): void;
|
|
8
7
|
protected calcShape(x: number, y: number): IShape;
|
|
9
8
|
static ɵfac: i0.ɵɵFactoryDeclaration<InteractiveCircleComponent, never>;
|
|
10
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<InteractiveCircleComponent, "interactive-circle", never, { "radius": { "alias": "radius"; "required": false; }; }, {}, never, never, false, never>;
|
|
9
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<InteractiveCircleComponent, "interactive-circle", never, { "radius": { "alias": "radius"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
11
10
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { OnChanges } from "@angular/core";
|
|
2
|
-
import { CanvasItemDirection, InteractiveCanvas, InteractiveCanvasItem, IPoint, IShape } from "../../common-types";
|
|
3
|
-
import { Point } from "../../utils/geometry";
|
|
2
|
+
import { CanvasItemDirection, InteractiveCanvas, InteractiveCanvasItem, IPoint, IShape, Frame } from "../../common-types";
|
|
3
|
+
import { Point, Rect } from "../../utils/geometry";
|
|
4
4
|
import { MaybePromise } from "../../helper-types";
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export declare class InteractiveItemComponent implements OnChanges, InteractiveCanvasItem {
|
|
7
7
|
protected pos: Point;
|
|
8
|
+
protected mFrame: Rect;
|
|
8
9
|
protected mShapes: IShape[];
|
|
10
|
+
get frame(): Frame;
|
|
9
11
|
get shapes(): ReadonlyArray<IShape>;
|
|
10
12
|
get x(): number;
|
|
11
13
|
set x(value: number);
|
|
@@ -28,7 +30,7 @@ export declare class InteractiveItemComponent implements OnChanges, InteractiveC
|
|
|
28
30
|
protected valid: boolean;
|
|
29
31
|
protected validPos: Point;
|
|
30
32
|
constructor();
|
|
31
|
-
draw(ctx: CanvasRenderingContext2D): MaybePromise<void>;
|
|
33
|
+
draw(ctx: CanvasRenderingContext2D, shape: IShape): MaybePromise<void>;
|
|
32
34
|
ngOnChanges(): void;
|
|
33
35
|
calcShapes(): void;
|
|
34
36
|
hit(point: Point): boolean;
|
|
@@ -2,12 +2,11 @@ import { IShape } from "../../common-types";
|
|
|
2
2
|
import { InteractiveItemComponent } from "./interactive-item.component";
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class InteractiveRectComponent extends InteractiveItemComponent {
|
|
5
|
-
width: number
|
|
6
|
-
height: number
|
|
7
|
-
rotation: number
|
|
5
|
+
readonly width: import("@angular/core").InputSignal<number>;
|
|
6
|
+
readonly height: import("@angular/core").InputSignal<number>;
|
|
7
|
+
readonly rotation: import("@angular/core").InputSignal<number>;
|
|
8
8
|
constructor();
|
|
9
|
-
draw(ctx: CanvasRenderingContext2D): void;
|
|
10
9
|
protected calcShape(x: number, y: number): IShape;
|
|
11
10
|
static ɵfac: i0.ɵɵFactoryDeclaration<InteractiveRectComponent, never>;
|
|
12
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<InteractiveRectComponent, "interactive-rect", never, { "width": { "alias": "width"; "required": false; }; "height": { "alias": "height"; "required": false; }; "rotation": { "alias": "rotation"; "required": false; }; }, {}, never, never, false, never>;
|
|
11
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<InteractiveRectComponent, "interactive-rect", never, { "width": { "alias": "width"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "rotation": { "alias": "rotation"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
13
12
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { CanvasColor } from "../common-types";
|
|
2
|
-
export declare function drawRect(ctx: CanvasRenderingContext2D, w: number, h: number): void;
|
|
3
|
-
export declare function drawOval(ctx: CanvasRenderingContext2D, w: number, h: number): void;
|
|
4
|
-
export declare function drawPoint(ctx: CanvasRenderingContext2D): void;
|
|
5
2
|
export declare class CanvasUtils {
|
|
6
3
|
static manipulatePixels(canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D, colorTransformer: (color: CanvasColor, greyscale?: number) => CanvasColor): void;
|
|
7
4
|
static thresholding(canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D, threshold: number, colorTransformer: (color: CanvasColor, limit: boolean, greyscale?: number) => CanvasColor): void;
|
|
@@ -5,6 +5,7 @@ declare abstract class Shape implements IShape {
|
|
|
5
5
|
get y(): number;
|
|
6
6
|
protected pt: IPoint;
|
|
7
7
|
protected constructor(x: number, y: number);
|
|
8
|
+
abstract draw(ctx: CanvasRenderingContext2D, ratio?: number): void;
|
|
8
9
|
abstract support(dir: IPoint): IPoint;
|
|
9
10
|
abstract move(pos: IPoint): IShape;
|
|
10
11
|
intersection(shape: IShape): ShapeIntersection;
|
|
@@ -17,6 +18,7 @@ export declare class Point extends Shape {
|
|
|
17
18
|
get length(): number;
|
|
18
19
|
get perpendicular(): Point;
|
|
19
20
|
constructor(xOrP: number | IPoint, y?: number);
|
|
21
|
+
draw(ctx: CanvasRenderingContext2D): void;
|
|
20
22
|
support(): IPoint;
|
|
21
23
|
move(pos: IPoint): IShape;
|
|
22
24
|
add(p: IPoint): Point;
|
|
@@ -36,6 +38,7 @@ export declare class Rect extends Shape {
|
|
|
36
38
|
readonly height: number;
|
|
37
39
|
readonly rotation: number;
|
|
38
40
|
constructor(x: number, y: number, width: number, height: number, rotation?: number);
|
|
41
|
+
draw(ctx: CanvasRenderingContext2D, ratio: number): void;
|
|
39
42
|
support(dir: IPoint): IPoint;
|
|
40
43
|
move(pos: IPoint): Rect;
|
|
41
44
|
}
|
|
@@ -44,6 +47,7 @@ export declare class Oval extends Shape {
|
|
|
44
47
|
readonly height: number;
|
|
45
48
|
readonly rotation: number;
|
|
46
49
|
constructor(x: number, y: number, width: number, height: number, rotation?: number);
|
|
50
|
+
draw(ctx: CanvasRenderingContext2D, ratio: number): void;
|
|
47
51
|
support(dir: IPoint): IPoint;
|
|
48
52
|
move(pos: IPoint): Oval;
|
|
49
53
|
}
|
package/package.json
CHANGED
package/public_api.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "zone.js";
|
|
2
2
|
export { MaybePromise, MaybeArray, KeysOfType, ObjOfType, StringKeys, CapitalizeFirst, CamelJoin, PrefixedPick } from "./ngx-utils/helper-types";
|
|
3
|
-
export { DurationUnit, TypedFactoryProvider, TypedValueProvider, TypedExistingProvider, TypedClassProvider, TypedTokenProvider, TypedProvider, CachedFactory, ResolveFactory, IResolveFactory, CanvasColor, IIconService, ITranslation, ITranslations, ILanguageSetting, ILanguageSettings, ILanguageService, IUserData, IAuthService, RouteValidator, IRouteData, IRoute, IAclComponent, IDialogButtonConfig, IDialogConfig, IConfirmMessageConfig, IConfirmDialogConfig, IDialogService, IPromiseService, IRouteStateInfo, NavigationUrlParam, StorageMode, ToastType, IToasterService, IAsyncMessage, AsyncMethod, IconMap, IconProps, ButtonType, ButtonSize, ButtonProps, TabValue, TabOption, ChipValue, ChipStatus, ChipOption, DropdownAttachTo, UnorderedListTemplate, UnorderedListTemplates, UnorderedListStyle, UploadType, IFileUploadResult, IFileUploadProcess, IAjaxRequestDetails, AjaxRequestCallback, ScriptType, ILoadableElement, ILoaderPromises, ISearchObservable, FactoryDependencies, ObjectType, ITimer, IExtraProperties, IGroupMap, TranslationQuery, IPageInfo, IPaginationData, PaginationDataLoader, PaginationItemContext, IPoint, ShapeIntersection, ShapeDistance, IShape, CanvasResizeMode, CanvasItemDirection, CanvasPaintFunc, RangeCoords, RectCoords, InteractiveCanvasParams, InteractiveCanvasItem, InteractiveCanvasItems, InteractiveCanvas, InteractiveCanvasRenderer, InteractivePanEvent, InteractiveCanvasPointer, HttpRequestHeaders, HttpRequestQuery, HttpClientRequestOptions, HttpRequestOptions, UploadData, IIssueContext, IProgress, ProgressListener, CacheExpireMode, IHttpService, SvgSourceModifier, IApiService, DynamicSchemaRef, OpenApiSchemaProperty, OpenApiSchema, OpenApiSchemas, TableFilterType, ITableOrders, ITableColumn, ITableColumns, TableColumns, ITableTemplate, ITableTemplates, ITableDataQuery, TableDataItems, TableDataLoader, DragDropEvent, DragEventHandler, ITableDragEvent, DynamicTableDragHandler, ResourceIfContext, CssSelector, CssSelectorList, DynamicComponentLocation, DynamicModuleInfo, DynamicEntryComponents, IConfiguration, IConfigService, ResizeEventStrategy, ErrorHandlerCallback, GlobalComponentModifier, AppInitializerFunc, IModuleConfig, ValuedPromise } from "./ngx-utils/common-types";
|
|
3
|
+
export { DurationUnit, TypedFactoryProvider, TypedValueProvider, TypedExistingProvider, TypedClassProvider, TypedTokenProvider, TypedProvider, CachedFactory, ResolveFactory, IResolveFactory, CanvasColor, IIconService, ITranslation, ITranslations, ILanguageSetting, ILanguageSettings, ILanguageService, IUserData, IAuthService, RouteValidator, IRouteData, IRoute, IAclComponent, IDialogButtonConfig, IDialogConfig, IConfirmMessageConfig, IConfirmDialogConfig, IDialogService, IPromiseService, IRouteStateInfo, NavigationUrlParam, StorageMode, ToastType, IToasterService, IAsyncMessage, AsyncMethod, IconMap, IconProps, ButtonType, ButtonSize, ButtonProps, TabValue, TabOption, ChipValue, ChipStatus, ChipOption, DropdownAttachTo, UnorderedListTemplate, UnorderedListTemplates, UnorderedListStyle, UploadType, IFileUploadResult, IFileUploadProcess, IAjaxRequestDetails, AjaxRequestCallback, ScriptType, ILoadableElement, ILoaderPromises, ISearchObservable, FactoryDependencies, ObjectType, ITimer, IExtraProperties, IGroupMap, TranslationQuery, IPageInfo, IPaginationData, PaginationDataLoader, PaginationItemContext, IPoint, ShapeIntersection, ShapeDistance, IShape, CanvasResizeMode, CanvasItemDirection, CanvasPaintFunc, RangeCoords, RectCoords, Frame, InteractiveCanvasParams, InteractiveCanvasItem, InteractiveCanvasItems, InteractiveCanvas, InteractiveCanvasRenderer, InteractivePanEvent, InteractiveCanvasPointer, HttpRequestHeaders, HttpRequestQuery, HttpClientRequestOptions, HttpRequestOptions, UploadData, IIssueContext, IProgress, ProgressListener, CacheExpireMode, IHttpService, SvgSourceModifier, IApiService, DynamicSchemaRef, OpenApiSchemaProperty, OpenApiSchema, OpenApiSchemas, TableFilterType, ITableOrders, ITableColumn, ITableColumns, TableColumns, ITableTemplate, ITableTemplates, ITableDataQuery, TableDataItems, TableDataLoader, DragDropEvent, DragEventHandler, ITableDragEvent, DynamicTableDragHandler, ResourceIfContext, CssSelector, CssSelectorList, DynamicComponentLocation, DynamicModuleInfo, DynamicEntryComponents, IConfiguration, IConfigService, ResizeEventStrategy, ErrorHandlerCallback, GlobalComponentModifier, AppInitializerFunc, IModuleConfig, ValuedPromise } from "./ngx-utils/common-types";
|
|
4
4
|
export { ICON_TYPE, ICON_MAP, BUTTON_TYPE, ERROR_HANDLER, STATIC_SCHEMAS, RESIZE_STRATEGY, RESIZE_DELAY, ROOT_ELEMENT, SCRIPT_PARAMS, BASE_CONFIG, CONFIG_SERVICE, APP_BASE_URL, API_SERVICE, EXPRESS_REQUEST, PROMISE_SERVICE, DIALOG_SERVICE, TOASTER_SERVICE, AUTH_SERVICE, LANGUAGE_SERVICE, ICON_SERVICE, OPTIONS_TOKEN } from "./ngx-utils/tokens";
|
|
5
5
|
export { AjaxRequestHandler } from "./ngx-utils/utils/ajax-request-handler";
|
|
6
6
|
export { ArrayUtils } from "./ngx-utils/utils/array.utils";
|
|
7
7
|
export { AuthGuard } from "./ngx-utils/utils/auth.guard";
|
|
8
8
|
export { createTypedProvider, cachedFactory } from "./ngx-utils/utils/cached-factory";
|
|
9
|
-
export {
|
|
9
|
+
export { CanvasUtils } from "./ngx-utils/utils/canvas";
|
|
10
10
|
export { DateUtils } from "./ngx-utils/utils/date.utils";
|
|
11
11
|
export { FileUtils } from "./ngx-utils/utils/file.utils";
|
|
12
12
|
export { ForbiddenZone } from "./ngx-utils/utils/forbidden-zone";
|