@stemy/ngx-utils 19.7.8 → 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.
@@ -1136,19 +1136,6 @@ const shg_table = [
1136
1136
  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
1137
1137
  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24
1138
1138
  ];
1139
- function drawRect(ctx, w, h) {
1140
- ctx.beginPath();
1141
- ctx.rect(-w / 2, -h / 2, w, h);
1142
- ctx.closePath();
1143
- }
1144
- function drawOval(ctx, w, h) {
1145
- ctx.beginPath();
1146
- ctx.ellipse(0, 0, w / 2, h / 2, 0, 0, Math.PI * 2);
1147
- ctx.closePath();
1148
- }
1149
- function drawPoint(ctx) {
1150
- drawOval(ctx, 4, 4);
1151
- }
1152
1139
  class CanvasUtils {
1153
1140
  static manipulatePixels(canvas, ctx, colorTransformer) {
1154
1141
  const imgData = ctx.getImageData(0, 0, canvas.width, canvas.height);
@@ -1559,11 +1546,6 @@ class FileUtils {
1559
1546
  // @dynamic
1560
1547
  reader => reader.readAsText(file));
1561
1548
  }
1562
- static readFileAsBinaryString(file) {
1563
- return FileUtils.readFile(
1564
- // @dynamic
1565
- reader => reader.readAsBinaryString(file));
1566
- }
1567
1549
  static readFileAsDataURL(file) {
1568
1550
  return FileUtils.readFile(
1569
1551
  // @dynamic
@@ -2123,6 +2105,11 @@ class Point extends Shape {
2123
2105
  const x = Number(xOrP);
2124
2106
  this.pt = isPoint(xOrP) ? xOrP : { x: isNaN(x) ? 0 : xOrP, y };
2125
2107
  }
2108
+ draw(ctx) {
2109
+ ctx.beginPath();
2110
+ ctx.ellipse(0, 0, 1.5, 1.5, 0, 0, Math.PI * 2);
2111
+ ctx.closePath();
2112
+ }
2126
2113
  support() {
2127
2114
  return this.center;
2128
2115
  }
@@ -2195,6 +2182,17 @@ class Rect extends Shape {
2195
2182
  this.height = height;
2196
2183
  this.rotation = rotation;
2197
2184
  }
2185
+ draw(ctx, ratio) {
2186
+ ratio = ratio ?? 1;
2187
+ const w = this.width * ratio;
2188
+ const h = this.height * ratio;
2189
+ const angle = toRadians(this.rotation);
2190
+ ctx.rotate(angle);
2191
+ ctx.beginPath();
2192
+ ctx.rect(-w / 2, -h / 2, w, h);
2193
+ ctx.closePath();
2194
+ ctx.rotate(-angle);
2195
+ }
2198
2196
  support(dir) {
2199
2197
  const ang = this.rotation ?? 0;
2200
2198
  const dLocal = rotateDeg(ensurePoint(dir, { x: 1, y: 0 }), -ang);
@@ -2216,6 +2214,17 @@ class Oval extends Shape {
2216
2214
  this.height = height;
2217
2215
  this.rotation = rotation;
2218
2216
  }
2217
+ draw(ctx, ratio) {
2218
+ ratio = ratio ?? 1;
2219
+ const w = this.width * ratio;
2220
+ const h = this.height * ratio;
2221
+ const angle = toRadians(this.rotation);
2222
+ ctx.rotate(angle);
2223
+ ctx.beginPath();
2224
+ ctx.ellipse(0, 0, w / 2, h / 2, 0, 0, Math.PI * 2);
2225
+ ctx.closePath();
2226
+ ctx.rotate(-angle);
2227
+ }
2219
2228
  support(dir) {
2220
2229
  const ang = this.rotation ?? 0;
2221
2230
  const d = rotateDeg(ensurePoint(dir, { x: 1, y: 0 }), -ang);
@@ -2667,6 +2676,16 @@ function impatientPromise(factory) {
2667
2676
  };
2668
2677
  }
2669
2678
 
2679
+ function svgToDataUri(svgString) {
2680
+ // Encode as UTF-8, then to Base64
2681
+ const utf8Bytes = new TextEncoder().encode(svgString);
2682
+ let binary = "";
2683
+ for (let i = 0; i < utf8Bytes.length; i++) {
2684
+ binary += String.fromCharCode(utf8Bytes[i]);
2685
+ }
2686
+ const base64 = btoa(binary);
2687
+ return `data:image/svg+xml;base64,${base64}`;
2688
+ }
2670
2689
  class StringUtils {
2671
2690
  static concat(separator, ...strings) {
2672
2691
  return strings.filter(
@@ -3862,6 +3881,101 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
3862
3881
  type: Injectable
3863
3882
  }], ctorParameters: () => [] });
3864
3883
 
3884
+ class LocalHttpService extends BaseHttpService {
3885
+ get name() {
3886
+ return "local-http";
3887
+ }
3888
+ get config() {
3889
+ return this.configs.config;
3890
+ }
3891
+ get withCredentials() {
3892
+ return false;
3893
+ }
3894
+ initService() {
3895
+ super.initService();
3896
+ this.svgs = {};
3897
+ this.images = {};
3898
+ }
3899
+ url(url) {
3900
+ if (!url)
3901
+ return url;
3902
+ const config = this.config;
3903
+ const baseUrl = config.cdnUrl || config.baseUrl || "";
3904
+ return url.startsWith("data:") || url.startsWith("http") || url.startsWith("//")
3905
+ ? url
3906
+ : `${baseUrl}${url}`;
3907
+ }
3908
+ get(url, options, body) {
3909
+ options = this.makeOptions(options, "GET", body, this.caches.permanent);
3910
+ return this.toPromise(url, options);
3911
+ }
3912
+ getImage(url) {
3913
+ if (this.universal.isServer)
3914
+ return Promise.resolve(null);
3915
+ if (!url)
3916
+ return Promise.resolve(new Image());
3917
+ this.images[url] = this.images[url] || new Promise((resolve, reject) => {
3918
+ const image = new Image();
3919
+ image.crossOrigin = "Anonymous";
3920
+ image.src = this.url(url);
3921
+ image.onload = () => resolve(image);
3922
+ image.onerror = error => {
3923
+ console.warn(error);
3924
+ reject(`Can't load image from url: ${url}`);
3925
+ };
3926
+ });
3927
+ return this.images[url];
3928
+ }
3929
+ svgUrlFromSource(sourceStr, modifier) {
3930
+ if (!sourceStr.startsWith("<svg")) {
3931
+ throw new Error(`Src is possibly not an svg.. '${sourceStr.substring(0, 10)}'`);
3932
+ }
3933
+ if (!this.svgs[sourceStr]) {
3934
+ const parser = document.createElement("div");
3935
+ parser.innerHTML = sourceStr;
3936
+ const source = parser.querySelector("svg");
3937
+ const width = parseFloat(source.getAttribute("width"));
3938
+ const height = parseFloat(source.getAttribute("height"));
3939
+ const vb = source.getAttribute("viewBox").split(" ").map(parseFloat);
3940
+ this.svgs[sourceStr] = {
3941
+ source,
3942
+ width: width || vb[2],
3943
+ height: height || vb[3],
3944
+ };
3945
+ }
3946
+ const def = this.svgs[sourceStr];
3947
+ const sourceClone = def.source.cloneNode(true);
3948
+ const svgModified = ObjectUtils.isFunction(modifier) ? modifier(sourceClone, def.width, def.height) : def.source.outerHTML;
3949
+ return svgToDataUri(svgModified);
3950
+ }
3951
+ svgFromSource(sourceStr, modifier) {
3952
+ return this.getImage(this.svgUrlFromSource(sourceStr, modifier));
3953
+ }
3954
+ async getSvgUrl(url, modifier) {
3955
+ try {
3956
+ const svgSrc = await this.get(url, { responseType: "text" });
3957
+ return this.svgUrlFromSource(svgSrc, modifier);
3958
+ }
3959
+ catch (e) {
3960
+ throw new Error(`Can't get svg from url: ${url}, Error: ${e?.message}`);
3961
+ }
3962
+ }
3963
+ async getSvgImage(url, modifier) {
3964
+ try {
3965
+ const svgSrc = await this.get(url, { responseType: "text" });
3966
+ return await this.svgFromSource(svgSrc, modifier);
3967
+ }
3968
+ catch (e) {
3969
+ throw new Error(`Can't get svg from url: ${url}, Error: ${e?.message}`);
3970
+ }
3971
+ }
3972
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LocalHttpService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
3973
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LocalHttpService }); }
3974
+ }
3975
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LocalHttpService, decorators: [{
3976
+ type: Injectable
3977
+ }] });
3978
+
3865
3979
  class IconService {
3866
3980
  get isDisabled() {
3867
3981
  return this.disabled;
@@ -3870,7 +3984,8 @@ class IconService {
3870
3984
  this.disabled = value;
3871
3985
  this.iconsLoaded.emit();
3872
3986
  }
3873
- constructor() {
3987
+ constructor(http) {
3988
+ this.http = http;
3874
3989
  this.iconsLoaded = new EventEmitter();
3875
3990
  this.disabled = false;
3876
3991
  }
@@ -3879,12 +3994,20 @@ class IconService {
3879
3994
  activeIcon = typeof icons == "undefined" ? activeIcon : (icons[activeIcon] || icon);
3880
3995
  return Promise.resolve(active ? activeIcon : icon);
3881
3996
  }
3882
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: IconService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3997
+ async getIconUrl(icon, modifier) {
3998
+ const src = await this.getIcon(icon, icon, false);
3999
+ return this.http.svgUrlFromSource(src, modifier);
4000
+ }
4001
+ async getIconImage(icon, modifier) {
4002
+ const src = await this.getIcon(icon, icon, false);
4003
+ return this.http.svgFromSource(src, modifier);
4004
+ }
4005
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: IconService, deps: [{ token: LocalHttpService }], target: i0.ɵɵFactoryTarget.Injectable }); }
3883
4006
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: IconService }); }
3884
4007
  }
3885
4008
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: IconService, decorators: [{
3886
4009
  type: Injectable
3887
- }], ctorParameters: () => [] });
4010
+ }], ctorParameters: () => [{ type: LocalHttpService }] });
3888
4011
 
3889
4012
  class StaticLanguageService {
3890
4013
  get defaultLanguage() {
@@ -4169,54 +4292,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
4169
4292
  type: Injectable
4170
4293
  }] });
4171
4294
 
4172
- class LocalHttpService extends BaseHttpService {
4173
- get name() {
4174
- return "local-http";
4175
- }
4176
- get config() {
4177
- return this.configs.config;
4178
- }
4179
- get withCredentials() {
4180
- return false;
4181
- }
4182
- initService() {
4183
- super.initService();
4184
- this.images = {};
4185
- }
4186
- url(url) {
4187
- if (!url)
4188
- return url;
4189
- const config = this.config;
4190
- const baseUrl = config.cdnUrl || config.baseUrl || "";
4191
- return url.startsWith("data:") || url.startsWith("http") || url.startsWith("//")
4192
- ? url
4193
- : `${baseUrl}${url}`;
4194
- }
4195
- get(url, options, body) {
4196
- options = this.makeOptions(options, "GET", body, this.caches.permanent);
4197
- return this.toPromise(url, options);
4198
- }
4199
- getImage(url) {
4200
- if (this.universal.isServer)
4201
- return Promise.resolve(null);
4202
- if (!url)
4203
- return Promise.resolve(new Image());
4204
- this.images[url] = this.images[url] || new Promise((resolve, reject) => {
4205
- const image = new Image();
4206
- image.crossOrigin = "Anonymous";
4207
- image.src = this.url(url);
4208
- image.onload = () => resolve(image);
4209
- image.onerror = reject;
4210
- });
4211
- return this.images[url];
4212
- }
4213
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LocalHttpService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
4214
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LocalHttpService }); }
4215
- }
4216
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LocalHttpService, decorators: [{
4217
- type: Injectable
4218
- }] });
4219
-
4220
4295
  class OpenApiService {
4221
4296
  constructor(api, staticSchemas) {
4222
4297
  this.api = api;
@@ -7769,6 +7844,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
7769
7844
  }] } });
7770
7845
 
7771
7846
  class InteractiveItemComponent {
7847
+ get frame() {
7848
+ return this.mFrame;
7849
+ }
7772
7850
  get shapes() {
7773
7851
  return this.mShapes;
7774
7852
  }
@@ -7833,10 +7911,11 @@ class InteractiveItemComponent {
7833
7911
  this.valid = true;
7834
7912
  this.pos = Point.Zero;
7835
7913
  this.direction = "none";
7914
+ this.mFrame = new Rect(0, 0, 3, 3);
7836
7915
  this.mShapes = [];
7837
7916
  }
7838
- draw(ctx) {
7839
- drawOval(ctx, 4, 4);
7917
+ draw(ctx, shape) {
7918
+ shape.draw(ctx, 1);
7840
7919
  ctx.fill();
7841
7920
  ctx.stroke();
7842
7921
  }
@@ -7864,8 +7943,7 @@ class InteractiveItemComponent {
7864
7943
  const target = this.restrictPosition(this.direction === "vertical" ? this.pos.x : x, this.direction === "horizontal" ? this.pos.y : y);
7865
7944
  this.pos = new Point(target);
7866
7945
  this.calcShapes();
7867
- this.valid = this.isValidByParams() &&
7868
- this.canvas.items.every(other => this === other || this.isValidByDistance(other));
7946
+ this.valid = this.checkIsValid();
7869
7947
  this.validPos = this.valid ? this.pos : this.validPos;
7870
7948
  }
7871
7949
  moveBy(dx, dy) {
@@ -7893,6 +7971,10 @@ class InteractiveItemComponent {
7893
7971
  : clamp(y, this.canvas.yRange)
7894
7972
  };
7895
7973
  }
7974
+ checkIsValid() {
7975
+ return this.isValidByParams() &&
7976
+ this.canvas.items.every(other => this === other || this.isValidByDistance(other));
7977
+ }
7896
7978
  isValidByParams() {
7897
7979
  return !this.shapes.some(shape => {
7898
7980
  return this.canvas.excludedAreas.some(ex => {
@@ -8072,17 +8154,22 @@ class InteractiveCanvasComponent {
8072
8154
  this.shouldDraw = false;
8073
8155
  }
8074
8156
  async tempPaint(cb) {
8075
- const renderCanvas = this.canvas;
8157
+ const mainCanvas = this.canvas;
8158
+ const mainCtx = mainCanvas.getContext("2d");
8076
8159
  const canvas = this.tempCanvas;
8077
- canvas.width = renderCanvas.width;
8078
- canvas.height = renderCanvas.height;
8079
8160
  const ctx = canvas.getContext("2d");
8161
+ const transform = mainCtx.getTransform();
8162
+ canvas.width = mainCanvas.width;
8163
+ canvas.height = mainCanvas.height;
8080
8164
  ctx.globalCompositeOperation = "source-over";
8081
8165
  ctx.clearRect(0, 0, canvas.width, canvas.height);
8082
- const bgCtx = renderCanvas.getContext("2d");
8083
- bgCtx.globalCompositeOperation = await cb(ctx) || "source-over";
8084
- bgCtx.drawImage(canvas, 0, 0);
8085
- bgCtx.globalCompositeOperation = "source-over";
8166
+ ctx.setTransform(transform);
8167
+ mainCtx.resetTransform();
8168
+ mainCtx.globalCompositeOperation = await cb(ctx) || "source-over";
8169
+ mainCtx.drawImage(canvas, 0, 0);
8170
+ mainCtx.globalCompositeOperation = "source-over";
8171
+ mainCtx.setTransform(transform);
8172
+ ctx.resetTransform();
8086
8173
  }
8087
8174
  resize() {
8088
8175
  const realWidth = this.width();
@@ -8115,17 +8202,17 @@ class InteractiveCanvasComponent {
8115
8202
  onTouchStart($event) {
8116
8203
  this.hoveredIndex = this.getIndexUnderPointer($event.touches.item(0));
8117
8204
  this.lockedIndex = this.hoveredIndex;
8118
- this.touched = true;
8205
+ this.selectItem();
8119
8206
  }
8120
- onTouchEnd($event) {
8121
- this.selectItem($event.touches.item(0));
8207
+ onTouchEnd() {
8208
+ this.touched = false;
8122
8209
  }
8123
8210
  onMouseDown($event) {
8124
8211
  this.lockedIndex = this.getIndexUnderPointer($event);
8125
- this.touched = true;
8212
+ this.selectItem();
8126
8213
  }
8127
- onMouseUp($event) {
8128
- this.selectItem($event);
8214
+ onMouseUp() {
8215
+ this.touched = false;
8129
8216
  }
8130
8217
  onMouseMove($event) {
8131
8218
  if (this.touched)
@@ -8212,14 +8299,12 @@ class InteractiveCanvasComponent {
8212
8299
  });
8213
8300
  this.onRotate.emit(this.rotation);
8214
8301
  }
8215
- selectItem(pointer) {
8216
- const selected = this.getIndexUnderPointer(pointer);
8217
- const item = this.items[selected];
8218
- this.touched = false;
8219
- if (item) {
8220
- this.selectedItem = item;
8221
- }
8222
- this.hoveredIndex = selected;
8302
+ selectItem() {
8303
+ this.touched = true;
8304
+ const item = this.items[this.lockedIndex];
8305
+ if (!item)
8306
+ return;
8307
+ this.selectedItem = item;
8223
8308
  }
8224
8309
  toCanvasPoint(pointer) {
8225
8310
  if (!pointer || !this.canvas)
@@ -8291,7 +8376,7 @@ class InteractiveCanvasComponent {
8291
8376
  ctx.lineWidth = 1;
8292
8377
  ctx.strokeStyle = "black";
8293
8378
  ctx.fillStyle = "white";
8294
- await item.draw(ctx);
8379
+ await item.draw(ctx, shape);
8295
8380
  ctx.restore();
8296
8381
  }
8297
8382
  }
@@ -8328,7 +8413,7 @@ class InteractiveCanvasComponent {
8328
8413
  ctx.restore();
8329
8414
  }
8330
8415
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InteractiveCanvasComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8331
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.14", type: InteractiveCanvasComponent, isStandalone: false, selector: "interactive-canvas", inputs: { infinite: { classPropertyName: "infinite", publicName: "infinite", isSignal: true, isRequired: false, transformFunction: null }, resizeMode: { classPropertyName: "resizeMode", publicName: "resizeMode", isSignal: true, isRequired: false, transformFunction: null }, horizontal: { classPropertyName: "horizontal", publicName: "horizontal", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, params: { classPropertyName: "params", publicName: "params", isSignal: true, isRequired: false, transformFunction: null }, selectedIndex: { classPropertyName: "selectedIndex", publicName: "selectedIndex", isSignal: true, isRequired: false, transformFunction: null }, panOffset: { classPropertyName: "panOffset", publicName: "panOffset", isSignal: true, isRequired: false, transformFunction: null }, renderCtx: { classPropertyName: "renderCtx", publicName: "renderCtx", isSignal: true, isRequired: false, transformFunction: null }, beforeItems: { classPropertyName: "beforeItems", publicName: "beforeItems", isSignal: true, isRequired: false, transformFunction: null }, afterItems: { classPropertyName: "afterItems", publicName: "afterItems", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedIndex: "selectedIndexChange", onRotate: "onRotate", onItemPan: "onItemPan", onItemPanned: "onItemPanned", onPan: "onPan", onPanned: "onPanned" }, host: { listeners: { "window:touchend": "onTouchEnd($event)", "window:mouseup": "onMouseUp($event)" } }, queries: [{ propertyName: "itemList", predicate: InteractiveItemComponent, isSignal: true }], viewQueries: [{ propertyName: "containerElem", first: true, predicate: ["containerElem"], descendants: true, static: true }, { propertyName: "canvasElem", first: true, predicate: ["canvasElem"], descendants: true, static: true }], ngImport: i0, template: "<div #containerElem\n [ngClass]=\"['interactive-canvas-container', horizontal() ? 'horizontal' : 'vertical']\"\n (resize)=\"resize()\"\n (touchstart)=\"onTouchStart($event)\"\n (mousedown)=\"onMouseDown($event)\"\n (mousemove)=\"onMouseMove($event)\"\n (mouseleave)=\"onMouseLeave()\"\n (panend)=\"onPanEnd()\"\n (panmove)=\"onPanMove($event)\"\n (panstart)=\"onPanStart()\">\n <canvas #canvasElem class=\"interactive-canvas-element\"></canvas>\n</div>\n", styles: [".interactive-canvas-container{width:100%;height:100%;position:relative;display:flex;align-items:center;justify-content:center}.interactive-canvas-container .interactive-canvas-element{position:absolute;pointer-events:none}\n"], dependencies: [{ kind: "directive", type: i1$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
8416
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.14", type: InteractiveCanvasComponent, isStandalone: false, selector: "interactive-canvas", inputs: { infinite: { classPropertyName: "infinite", publicName: "infinite", isSignal: true, isRequired: false, transformFunction: null }, resizeMode: { classPropertyName: "resizeMode", publicName: "resizeMode", isSignal: true, isRequired: false, transformFunction: null }, horizontal: { classPropertyName: "horizontal", publicName: "horizontal", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, params: { classPropertyName: "params", publicName: "params", isSignal: true, isRequired: false, transformFunction: null }, selectedIndex: { classPropertyName: "selectedIndex", publicName: "selectedIndex", isSignal: true, isRequired: false, transformFunction: null }, panOffset: { classPropertyName: "panOffset", publicName: "panOffset", isSignal: true, isRequired: false, transformFunction: null }, renderCtx: { classPropertyName: "renderCtx", publicName: "renderCtx", isSignal: true, isRequired: false, transformFunction: null }, beforeItems: { classPropertyName: "beforeItems", publicName: "beforeItems", isSignal: true, isRequired: false, transformFunction: null }, afterItems: { classPropertyName: "afterItems", publicName: "afterItems", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedIndex: "selectedIndexChange", onRotate: "onRotate", onItemPan: "onItemPan", onItemPanned: "onItemPanned", onPan: "onPan", onPanned: "onPanned" }, host: { listeners: { "window:touchend": "onTouchEnd()", "window:mouseup": "onMouseUp()" } }, queries: [{ propertyName: "itemList", predicate: InteractiveItemComponent, isSignal: true }], viewQueries: [{ propertyName: "containerElem", first: true, predicate: ["containerElem"], descendants: true, static: true }, { propertyName: "canvasElem", first: true, predicate: ["canvasElem"], descendants: true, static: true }], ngImport: i0, template: "<div #containerElem\n [ngClass]=\"['interactive-canvas-container', horizontal() ? 'horizontal' : 'vertical']\"\n (resize)=\"resize()\"\n (touchstart)=\"onTouchStart($event)\"\n (mousedown)=\"onMouseDown($event)\"\n (mousemove)=\"onMouseMove($event)\"\n (mouseleave)=\"onMouseLeave()\"\n (panend)=\"onPanEnd()\"\n (panmove)=\"onPanMove($event)\"\n (panstart)=\"onPanStart()\">\n <canvas #canvasElem class=\"interactive-canvas-element\"></canvas>\n</div>\n", styles: [".interactive-canvas-container{width:100%;height:100%;position:relative;display:flex;align-items:center;justify-content:center}.interactive-canvas-container .interactive-canvas-element{position:absolute;pointer-events:none}\n"], dependencies: [{ kind: "directive", type: i1$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
8332
8417
  }
8333
8418
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InteractiveCanvasComponent, decorators: [{
8334
8419
  type: Component,
@@ -8341,29 +8426,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
8341
8426
  args: ["canvasElem", { static: true }]
8342
8427
  }], onTouchEnd: [{
8343
8428
  type: HostListener,
8344
- args: ["window:touchend", ["$event"]]
8429
+ args: ["window:touchend"]
8345
8430
  }], onMouseUp: [{
8346
8431
  type: HostListener,
8347
- args: ["window:mouseup", ["$event"]]
8432
+ args: ["window:mouseup"]
8348
8433
  }] } });
8349
8434
 
8350
8435
  class InteractiveCircleComponent extends InteractiveItemComponent {
8351
8436
  constructor() {
8352
8437
  super();
8353
- this.radius = 10;
8354
- }
8355
- draw(ctx) {
8356
- const diameter = this.radius * 2 * this.canvas.ratio;
8357
- drawOval(ctx, diameter, diameter);
8358
- ctx.fill();
8359
- ctx.stroke();
8438
+ this.radius = input(10);
8439
+ effect(() => {
8440
+ const radius = this.radius();
8441
+ this.mFrame = new Rect(0, 0, radius * 2, radius * 2);
8442
+ });
8360
8443
  }
8361
8444
  calcShape(x, y) {
8362
- const ratio = this.canvas.ratio;
8363
- return new Circle(x, y, this.radius * ratio);
8445
+ const radius = untracked(() => this.radius());
8446
+ return new Circle(x, y, radius * this.canvas.ratio);
8364
8447
  }
8365
8448
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InteractiveCircleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8366
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: InteractiveCircleComponent, isStandalone: false, selector: "interactive-circle", inputs: { radius: "radius" }, providers: [
8449
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: InteractiveCircleComponent, isStandalone: false, selector: "interactive-circle", inputs: { radius: { classPropertyName: "radius", publicName: "radius", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
8367
8450
  { provide: InteractiveItemComponent, useExisting: InteractiveCircleComponent },
8368
8451
  ], usesInheritance: true, ngImport: i0, template: "", isInline: true }); }
8369
8452
  }
@@ -8377,30 +8460,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
8377
8460
  { provide: InteractiveItemComponent, useExisting: InteractiveCircleComponent },
8378
8461
  ]
8379
8462
  }]
8380
- }], ctorParameters: () => [], propDecorators: { radius: [{
8381
- type: Input
8382
- }] } });
8463
+ }], ctorParameters: () => [] });
8383
8464
 
8384
8465
  class InteractiveRectComponent extends InteractiveItemComponent {
8385
8466
  constructor() {
8386
8467
  super();
8387
- this.width = 10;
8388
- this.height = 10;
8389
- this.rotation = 0;
8390
- }
8391
- draw(ctx) {
8392
- const ratio = this.canvas.ratio;
8393
- ctx.rotate(toRadians(this.rotation));
8394
- drawRect(ctx, this.width * ratio, this.height * ratio);
8395
- ctx.fill();
8396
- ctx.stroke();
8468
+ this.width = input(10);
8469
+ this.height = input(10);
8470
+ this.rotation = input(0);
8471
+ effect(() => {
8472
+ this.mFrame = new Rect(0, 0, this.width(), this.height(), this.rotation());
8473
+ });
8397
8474
  }
8398
8475
  calcShape(x, y) {
8399
8476
  const ratio = this.canvas.ratio;
8400
- return new Rect(x, y, this.width * ratio, this.height * ratio, this.rotation);
8477
+ const width = untracked(() => this.width());
8478
+ const height = untracked(() => this.height());
8479
+ const rotation = untracked(() => this.rotation());
8480
+ return new Rect(x, y, width * ratio, height * ratio, rotation);
8401
8481
  }
8402
8482
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InteractiveRectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8403
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: InteractiveRectComponent, isStandalone: false, selector: "interactive-rect", inputs: { width: "width", height: "height", rotation: "rotation" }, providers: [
8483
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: InteractiveRectComponent, isStandalone: false, selector: "interactive-rect", inputs: { width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, rotation: { classPropertyName: "rotation", publicName: "rotation", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
8404
8484
  { provide: InteractiveItemComponent, useExisting: InteractiveRectComponent },
8405
8485
  ], usesInheritance: true, ngImport: i0, template: "", isInline: true }); }
8406
8486
  }
@@ -8414,13 +8494,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
8414
8494
  { provide: InteractiveItemComponent, useExisting: InteractiveRectComponent },
8415
8495
  ]
8416
8496
  }]
8417
- }], ctorParameters: () => [], propDecorators: { width: [{
8418
- type: Input
8419
- }], height: [{
8420
- type: Input
8421
- }], rotation: [{
8422
- type: Input
8423
- }] } });
8497
+ }], ctorParameters: () => [] });
8424
8498
 
8425
8499
  class TabsComponent {
8426
8500
  constructor() {
@@ -9137,5 +9211,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
9137
9211
  * Generated bundle index. Do not edit.
9138
9212
  */
9139
9213
 
9140
- export { API_SERVICE, APP_BASE_URL, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodBase, AsyncMethodDirective, AsyncMethodTargetDirective, AuthGuard, BASE_CONFIG, BUTTON_TYPE, BackgroundDirective, BaseDialogService, BaseHttpClient, BaseHttpService, BaseToasterService, BtnComponent, BtnDefaultComponent, CONFIG_SERVICE, CacheService, CanvasColor, CanvasUtils, ChipsComponent, ChunkPipe, Circle, CloseBtnComponent, ComponentLoaderDirective, ComponentLoaderService, ConfigService, DIALOG_SERVICE, DateUtils, DragDropEventPlugin, DropListComponent, DropdownBoxComponent, DropdownContentDirective, DropdownDirective, DropdownToggleDirective, DynamicTableComponent, DynamicTableTemplateDirective, EPSILON, ERROR_HANDLER, EXPRESS_REQUEST, EntriesPipe, ErrorHandlerService, EventsService, ExtraItemPropertiesPipe, FactoryDependencies, FakeModuleComponent, FileSystemEntry, FileUtils, FilterPipe, FindPipe, ForbiddenZone, FormatNumberPipe, FormatterService, GenericValue, GetOffsetPipe, GetTypePipe, GetValuePipe, GlobalTemplateDirective, GlobalTemplatePipe, GlobalTemplateService, GroupByPipe, ICON_MAP, ICON_SERVICE, ICON_TYPE, IConfiguration, IconComponent, IconDefaultComponent, IconDirective, IconService, IncludesPipe, Initializer, InteractiveCanvasComponent, InteractiveCircleComponent, InteractiveItemComponent, InteractiveRectComponent, IsTypePipe, JSONfn, JoinPipe, KeysPipe, LANGUAGE_SERVICE, LanguageService, LoaderUtils, LocalHttpService, MapPipe, MathUtils, MaxPipe, MinPipe, NgxTemplateOutletDirective, NgxUtilsModule, OPTIONS_TOKEN, ObjectType, ObjectUtils, ObservableUtils, OpenApiService, Oval, PROMISE_SERVICE, PaginationDirective, PaginationItemContext, PaginationItemDirective, PaginationMenuComponent, Point, PopPipe, PromiseService, RESIZE_DELAY, RESIZE_STRATEGY, ROOT_ELEMENT, Rect, ReducePipe, ReflectUtils, RemapPipe, ReplacePipe, ResizeEventPlugin, ResourceIfContext, ResourceIfDirective, ReversePipe, RoundPipe, SCRIPT_PARAMS, STATIC_SCHEMAS, SafeHtmlPipe, ScrollEventPlugin, SetUtils, ShiftPipe, SocketClient, SocketService, SplitPipe, StateService, StaticAuthService, StaticLanguageService, StickyClassDirective, StickyDirective, StorageMode, StorageService, StringUtils, TOASTER_SERVICE, TabsComponent, TabsItemDirective, TabsTemplateDirective, TimerUtils, TranslatePipe, TranslatedUrlSerializer, UniqueUtils, UniversalService, UnorderedListComponent, UnorderedListItemDirective, UnorderedListTemplateDirective, UploadComponent, ValuedPromise, ValuesPipe, addPts, cachedFactory, cancelablePromise, checkTransitions, clamp, computedPrevious, createTypedProvider, cssStyles, cssVariables, distance, distanceSq, dividePts, dotProduct, drawOval, drawRect, ensurePoint, getComponentDef, getCssVariables, getRoot, gjkDistance, gjkIntersection, hashCode, impatientPromise, injectOptions, isBrowser, isPoint, lengthOfPt, lerpPts, multiplyPts, negatePt, normalizePt, normalizeRange, overflow, parseSelector, perpendicular, provideEntryComponents, provideOptions, provideWithOptions, rotateDeg, rotateRad, selectorMatchesList, subPts, switchClass, toDegrees, toRadians, tripleProduct };
9214
+ export { API_SERVICE, APP_BASE_URL, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodBase, AsyncMethodDirective, AsyncMethodTargetDirective, AuthGuard, BASE_CONFIG, BUTTON_TYPE, BackgroundDirective, BaseDialogService, BaseHttpClient, BaseHttpService, BaseToasterService, BtnComponent, BtnDefaultComponent, CONFIG_SERVICE, CacheService, CanvasColor, CanvasUtils, ChipsComponent, ChunkPipe, Circle, CloseBtnComponent, ComponentLoaderDirective, ComponentLoaderService, ConfigService, DIALOG_SERVICE, DateUtils, DragDropEventPlugin, DropListComponent, DropdownBoxComponent, DropdownContentDirective, DropdownDirective, DropdownToggleDirective, DynamicTableComponent, DynamicTableTemplateDirective, EPSILON, ERROR_HANDLER, EXPRESS_REQUEST, EntriesPipe, ErrorHandlerService, EventsService, ExtraItemPropertiesPipe, FactoryDependencies, FakeModuleComponent, FileSystemEntry, FileUtils, FilterPipe, FindPipe, ForbiddenZone, FormatNumberPipe, FormatterService, GenericValue, GetOffsetPipe, GetTypePipe, GetValuePipe, GlobalTemplateDirective, GlobalTemplatePipe, GlobalTemplateService, GroupByPipe, ICON_MAP, ICON_SERVICE, ICON_TYPE, IConfiguration, IconComponent, IconDefaultComponent, IconDirective, IconService, IncludesPipe, Initializer, InteractiveCanvasComponent, InteractiveCircleComponent, InteractiveItemComponent, InteractiveRectComponent, IsTypePipe, JSONfn, JoinPipe, KeysPipe, LANGUAGE_SERVICE, LanguageService, LoaderUtils, LocalHttpService, MapPipe, MathUtils, MaxPipe, MinPipe, NgxTemplateOutletDirective, NgxUtilsModule, OPTIONS_TOKEN, ObjectType, ObjectUtils, ObservableUtils, OpenApiService, Oval, PROMISE_SERVICE, PaginationDirective, PaginationItemContext, PaginationItemDirective, PaginationMenuComponent, Point, PopPipe, PromiseService, RESIZE_DELAY, RESIZE_STRATEGY, ROOT_ELEMENT, Rect, ReducePipe, ReflectUtils, RemapPipe, ReplacePipe, ResizeEventPlugin, ResourceIfContext, ResourceIfDirective, ReversePipe, RoundPipe, SCRIPT_PARAMS, STATIC_SCHEMAS, SafeHtmlPipe, ScrollEventPlugin, SetUtils, ShiftPipe, SocketClient, SocketService, SplitPipe, StateService, StaticAuthService, StaticLanguageService, StickyClassDirective, StickyDirective, StorageMode, StorageService, StringUtils, TOASTER_SERVICE, TabsComponent, TabsItemDirective, TabsTemplateDirective, TimerUtils, TranslatePipe, TranslatedUrlSerializer, UniqueUtils, UniversalService, UnorderedListComponent, UnorderedListItemDirective, UnorderedListTemplateDirective, UploadComponent, ValuedPromise, ValuesPipe, addPts, cachedFactory, cancelablePromise, checkTransitions, clamp, computedPrevious, createTypedProvider, cssStyles, cssVariables, distance, distanceSq, dividePts, dotProduct, ensurePoint, getComponentDef, getCssVariables, getRoot, gjkDistance, gjkIntersection, hashCode, impatientPromise, injectOptions, isBrowser, isPoint, lengthOfPt, lerpPts, multiplyPts, negatePt, normalizePt, normalizeRange, overflow, parseSelector, perpendicular, provideEntryComponents, provideOptions, provideWithOptions, rotateDeg, rotateRad, selectorMatchesList, subPts, svgToDataUri, switchClass, toDegrees, toRadians, tripleProduct };
9141
9215
  //# sourceMappingURL=stemy-ngx-utils.mjs.map