@acorex/core 18.16.0-next.0 → 18.16.0-next.1

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.
@@ -1,5 +1,5 @@
1
- import { DOCUMENT } from '@angular/common';
2
- import { Directive, ElementRef, HostListener, inject, Input, NgZone, Renderer2 } from '@angular/core';
1
+ import { DOCUMENT, isPlatformBrowser } from '@angular/common';
2
+ import { Directive, ElementRef, HostListener, inject, Input, NgZone, PLATFORM_ID, Renderer2, } from '@angular/core';
3
3
  import * as i0 from "@angular/core";
4
4
  export class AXResizableDirective {
5
5
  constructor(el, renderer, zone) {
@@ -7,6 +7,7 @@ export class AXResizableDirective {
7
7
  this.renderer = renderer;
8
8
  this.zone = zone;
9
9
  this.document = inject(DOCUMENT);
10
+ this.platformID = inject(PLATFORM_ID);
10
11
  this.minWidth = 100; // Minimum width for the resizable element
11
12
  this.isResizing = false;
12
13
  this.createResizeHandle(); // Initialize the resize handle
@@ -35,7 +36,9 @@ export class AXResizableDirective {
35
36
  onMouseDown(event) {
36
37
  // Only allow resizing when clicking on the handle
37
38
  const handleRect = this.resizeHandle.getBoundingClientRect();
38
- if (event.clientX >= handleRect.left && event.clientX <= handleRect.right) {
39
+ if (event.clientX >= handleRect.left &&
40
+ event.clientX <= handleRect.right &&
41
+ isPlatformBrowser(this.platformID)) {
39
42
  this.zone.runOutsideAngular(() => {
40
43
  this.isResizing = true;
41
44
  this.document.body.style.cursor = 'ew-resize'; // Change cursor to resize mode
@@ -52,11 +55,13 @@ export class AXResizableDirective {
52
55
  const rect = this.el.nativeElement.getBoundingClientRect();
53
56
  let newWidth;
54
57
  // Resize logic (LTR or RTL support)
55
- if (this.document.documentElement.dir === 'rtl') {
56
- newWidth = rect.right - event.clientX;
57
- }
58
- else {
59
- newWidth = event.clientX - rect.left;
58
+ if (isPlatformBrowser(this.platformID)) {
59
+ if (this.document.documentElement.dir === 'rtl') {
60
+ newWidth = rect.right - event.clientX;
61
+ }
62
+ else {
63
+ newWidth = event.clientX - rect.left;
64
+ }
60
65
  }
61
66
  // Ensure the width does not go below the minimum width
62
67
  if (newWidth > this.minWidth) {
@@ -68,7 +73,7 @@ export class AXResizableDirective {
68
73
  // Mouse up event: End resizing
69
74
  onMouseUp() {
70
75
  this.zone.runOutsideAngular(() => {
71
- if (this.isResizing) {
76
+ if (this.isResizing && isPlatformBrowser(this.platformID)) {
72
77
  this.isResizing = false;
73
78
  this.document.body.style.cursor = 'default'; // Reset the cursor
74
79
  // Reset the resize handle color to default when resizing ends
@@ -116,4 +121,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
116
121
  type: HostListener,
117
122
  args: ['mouseleave', ['$event']]
118
123
  }] } });
119
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVzaXplLmRpcmVjdGl2ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvY29yZS91dGlscy9zcmMvbGliL3Jlc2l6ZS5kaXJlY3RpdmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQzNDLE9BQU8sRUFBRSxTQUFTLEVBQUUsVUFBVSxFQUFFLFlBQVksRUFBRSxNQUFNLEVBQUUsS0FBSyxFQUFFLE1BQU0sRUFBRSxTQUFTLEVBQUUsTUFBTSxlQUFlLENBQUM7O0FBS3RHLE1BQU0sT0FBTyxvQkFBb0I7SUFNL0IsWUFDVSxFQUFjLEVBQ2QsUUFBbUIsRUFDbkIsSUFBWTtRQUZaLE9BQUUsR0FBRixFQUFFLENBQVk7UUFDZCxhQUFRLEdBQVIsUUFBUSxDQUFXO1FBQ25CLFNBQUksR0FBSixJQUFJLENBQVE7UUFSZCxhQUFRLEdBQUcsTUFBTSxDQUFDLFFBQVE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MC4yKScpOyAvLyBEZWZhdWx0IGJhY2tncm91bmQgY29sb3JcbiAgICB9XG4gIH1cbn1cbiJdfQ==
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, NgModule, inject } from '@angular/core';
2
+ import { Injectable, NgModule, inject, PLATFORM_ID } from '@angular/core';
3
3
  import * as i1 from '@acorex/core/format';
4
4
  import { AXFormatModule } from '@acorex/core/format';
5
5
  import { DOCUMENT } from '@angular/common';
@@ -44,6 +44,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
44
44
  class AXFileService {
45
45
  constructor() {
46
46
  this.document = inject(DOCUMENT);
47
+ this.platformID = inject(PLATFORM_ID);
47
48
  this.blobToBase64 = (blob) => {
48
49
  if (blob instanceof Blob) {
49
50
  return new Promise((resolve, reject) => {
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-core-file.mjs","sources":["../../../../libs/core/file/src/lib/file-size-formatter.ts","../../../../libs/core/file/src/lib/file.module.ts","../../../../libs/core/file/src/lib/file.service.ts","../../../../libs/core/file/src/acorex-core-file.ts"],"sourcesContent":["import { AXFormatOptions, AXFormatter } from '@acorex/core/format';\nimport { Injectable } from '@angular/core';\n\nexport interface AXFileSizeFormatterOptions extends AXFormatOptions {\n format: string;\n}\n\ndeclare module '@acorex/core/format' {\n interface AXFormatOptionsMap {\n filesize: AXFileSizeFormatterOptions;\n }\n}\n\n@Injectable()\nexport class AXFileSizeFormatter implements AXFormatter {\n get name(): string {\n return 'filesize';\n }\n\n format(value: number): string {\n const size = Number(value);\n\n if (size === 0) return '0 Bytes';\n if (Number.isNaN(size)) return 'Unknown';\n\n const k = 1024;\n const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n const i = Math.floor(Math.log(size) / Math.log(k));\n\n return parseFloat((size / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];\n }\n}\n","import { AXFormatModule } from '@acorex/core/format';\nimport { NgModule } from '@angular/core';\nimport { AXFileSizeFormatter } from './file-size-formatter';\n\n@NgModule({\n imports: [AXFormatModule.forChild({ formatters: [AXFileSizeFormatter] })],\n exports: [],\n declarations: [],\n providers: [AXFileSizeFormatter],\n})\nexport class AXFileModule {}\n","import { DOCUMENT } from '@angular/common';\nimport { inject, Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXFileService {\n private document = inject(DOCUMENT);\n\n public choose(options?: { accept?: string; multiple?: boolean }): Promise<File[]> {\n return new Promise<File[]>((resolve, reject) => {\n options = Object.assign({ multiple: false }, options);\n const input: HTMLInputElement = this.document.createElement('input');\n input.style.display = 'none';\n this.document.body.appendChild(input);\n input.type = 'file';\n input.accept = options.accept || '';\n input.multiple = options.multiple || false;\n //\n const onError = (e) => {\n reject(e);\n this.document.body.removeChild(input);\n input.remove();\n input.removeEventListener('change', onChange);\n input.removeEventListener('error', onError);\n };\n //\n const onChange = () => {\n resolve(Array.from(input.files || []));\n this.document.body.removeChild(input);\n input.remove();\n input.removeEventListener('change', onChange);\n input.removeEventListener('error', onError);\n };\n //\n input.addEventListener('change', onChange);\n input.addEventListener('error', onError);\n input.click();\n });\n }\n\n public blobToBase64 = (blob: Blob) => {\n if (blob instanceof Blob) {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onerror = reject;\n reader.onload = () => {\n resolve(reader.result as string);\n };\n reader.readAsDataURL(blob);\n });\n } else {\n return Promise.reject('input is not blob');\n }\n };\n\n public getSize(file: File | Blob | string) {\n if (this.isBase64(file as string)) {\n return this.getBase64Size(file as string);\n }\n return false;\n }\n\n public isBase64(base64: string) {\n const regx = /[^:]\\w+\\/[\\w-+\\d.]+(?=;|,)/;\n return regx.test(base64);\n }\n\n public getBase64Size(base64: string) {\n return atob(base64.substring(base64.indexOf(',') + 1)).length;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAca,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B,CAAC,QAAQ,EAAE,QAAQ,CAAC;AAC1C,YAAA,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC;YACxC,KAAK,CAAC,KAAK,EAAE;AACf,SAAC,CAAC;;AAkBG,IAAA,OAAO,CAAC,IAA0B,EAAA;AACvC,QAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAc,CAAC,EAAE;AACjC,YAAA,OAAO,IAAI,CAAC,aAAa,CAAC,IAAc,CAAC;;AAE3C,QAAA,OAAO,KAAK;;AAGP,IAAA,QAAQ,CAAC,MAAc,EAAA;QAC5B,MAAM,IAAI,GAAG,4BAA4B;AACzC,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;;AAGnB,IAAA,aAAa,CAAC,MAAc,EAAA;AACjC,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM;;8GA/DpD,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAb,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,cAFZ,MAAM,EAAA,CAAA,CAAA;;2FAEP,aAAa,EAAA,UAAA,EAAA,CAAA;kBAHzB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACLD;;AAEG;;;;"}
1
+ {"version":3,"file":"acorex-core-file.mjs","sources":["../../../../libs/core/file/src/lib/file-size-formatter.ts","../../../../libs/core/file/src/lib/file.module.ts","../../../../libs/core/file/src/lib/file.service.ts","../../../../libs/core/file/src/acorex-core-file.ts"],"sourcesContent":["import { AXFormatOptions, AXFormatter } from '@acorex/core/format';\nimport { Injectable } from '@angular/core';\n\nexport interface AXFileSizeFormatterOptions extends AXFormatOptions {\n format: string;\n}\n\ndeclare module '@acorex/core/format' {\n interface AXFormatOptionsMap {\n filesize: AXFileSizeFormatterOptions;\n }\n}\n\n@Injectable()\nexport class AXFileSizeFormatter implements AXFormatter {\n get name(): string {\n return 'filesize';\n }\n\n format(value: number): string {\n const size = Number(value);\n\n if (size === 0) return '0 Bytes';\n if (Number.isNaN(size)) return 'Unknown';\n\n const k = 1024;\n const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n const i = Math.floor(Math.log(size) / Math.log(k));\n\n return parseFloat((size / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];\n }\n}\n","import { AXFormatModule } from '@acorex/core/format';\nimport { NgModule } from '@angular/core';\nimport { AXFileSizeFormatter } from './file-size-formatter';\n\n@NgModule({\n imports: [AXFormatModule.forChild({ formatters: [AXFileSizeFormatter] })],\n exports: [],\n declarations: [],\n providers: [AXFileSizeFormatter],\n})\nexport class AXFileModule {}\n","import { DOCUMENT } from '@angular/common';\nimport { inject, Injectable, PLATFORM_ID } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXFileService {\n private document = inject(DOCUMENT);\n private platformID = inject(PLATFORM_ID);\n\n public choose(options?: { accept?: string; multiple?: boolean }): Promise<File[]> {\n return new Promise<File[]>((resolve, reject) => {\n options = Object.assign({ multiple: false }, options);\n const input: HTMLInputElement = this.document.createElement('input');\n input.style.display = 'none';\n this.document.body.appendChild(input);\n input.type = 'file';\n input.accept = options.accept || '';\n input.multiple = options.multiple || false;\n //\n const onError = (e) => {\n reject(e);\n this.document.body.removeChild(input);\n input.remove();\n input.removeEventListener('change', onChange);\n input.removeEventListener('error', onError);\n };\n //\n const onChange = () => {\n resolve(Array.from(input.files || []));\n this.document.body.removeChild(input);\n input.remove();\n input.removeEventListener('change', onChange);\n input.removeEventListener('error', onError);\n };\n //\n input.addEventListener('change', onChange);\n input.addEventListener('error', onError);\n input.click();\n });\n }\n\n public blobToBase64 = (blob: Blob) => {\n if (blob instanceof Blob) {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onerror = reject;\n reader.onload = () => {\n resolve(reader.result as string);\n };\n reader.readAsDataURL(blob);\n });\n } else {\n return Promise.reject('input is not blob');\n }\n };\n\n public getSize(file: File | Blob | string) {\n if (this.isBase64(file as string)) {\n return this.getBase64Size(file as string);\n }\n return false;\n }\n\n public isBase64(base64: string) {\n const regx = /[^:]\\w+\\/[\\w-+\\d.]+(?=;|,)/;\n return regx.test(base64);\n }\n\n public getBase64Size(base64: string) {\n return atob(base64.substring(base64.indexOf(',') + 1)).length;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAca,mBAAmB,CAAA;AAC9B,IAAA,IAAI,IAAI,GAAA;AACN,QAAA,OAAO,UAAU;;AAGnB,IAAA,MAAM,CAAC,KAAa,EAAA;AAClB,QAAA,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC;QAE1B,IAAI,IAAI,KAAK,CAAC;AAAE,YAAA,OAAO,SAAS;AAChC,QAAA,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;AAAE,YAAA,OAAO,SAAS;QAExC,MAAM,CAAC,GAAG,IAAI;QACd,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QACvE,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAElD,OAAO,UAAU,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE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C,MAAM;;8GAhEpD,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAb,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,cAFZ,MAAM,EAAA,CAAA,CAAA;;2FAEP,aAAa,EAAA,UAAA,EAAA,CAAA;kBAHzB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACLD;;AAEG;;;;"}
@@ -1,10 +1,11 @@
1
1
  import { DOCUMENT } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { inject, Injectable } from '@angular/core';
3
+ import { inject, PLATFORM_ID, Injectable } from '@angular/core';
4
4
 
5
5
  class AXImageService {
6
6
  constructor() {
7
7
  this.document = inject(DOCUMENT);
8
+ this.platformID = inject(PLATFORM_ID);
8
9
  }
9
10
  async resize(options) {
10
11
  options = Object.assign({ type: 'image/png', quality: 1 }, options);
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-core-image.mjs","sources":["../../../../libs/core/image/src/lib/image.service.ts","../../../../libs/core/image/src/acorex-core-image.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { inject, Injectable } from '@angular/core';\n\n@Injectable()\nexport class AXImageService {\n private document = inject(DOCUMENT);\n async resize(options: {\n maxSize: number;\n source: HTMLImageElement | File;\n type?: 'image/png' | 'image/jpeg' | 'image/webp';\n quality?: number;\n }): Promise<Blob> {\n options = Object.assign({ type: 'image/png', quality: 1 }, options);\n\n let image: HTMLImageElement;\n if (options.source instanceof File) {\n const a = new Image();\n a.src = URL.createObjectURL(options.source);\n await new Promise<Event>((res) => (a.onload = res));\n image = a;\n } else {\n image = options.source;\n }\n\n // Resize the image\n const canvas: any = this.document.createElement('canvas');\n let width = image.width;\n let height = image.height;\n if (width > height) {\n if (width > options.maxSize) {\n height *= options.maxSize / width;\n width = options.maxSize;\n }\n } else {\n if (height > options.maxSize) {\n width *= options.maxSize / height;\n height = options.maxSize;\n }\n }\n canvas.width = width;\n canvas.height = height;\n canvas.getContext('2d').drawImage(image, 0, 0, width, height);\n return new Promise((resolve) => canvas.toBlob(resolve, options.type, options.quality));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAIa,cAAc,CAAA;AAD3B,IAAA,WAAA,GAAA;AAEU,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAuCpC;IAtCC,MAAM,MAAM,CAAC,OAKZ,EAAA;AACC,QAAA,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC;AAEnE,QAAA,IAAI,KAAuB;AAC3B,QAAA,IAAI,OAAO,CAAC,MAAM,YAAY,IAAI,EAAE;AAClC,YAAA,MAAM,CAAC,GAAG,IAAI,KAAK,EAAE;YACrB,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC;AAC3C,YAAA,MAAM,IAAI,OAAO,CAAQ,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;YACnD,KAAK,GAAG,CAAC;;aACJ;AACL,YAAA,KAAK,GAAG,OAAO,CAAC,MAAM;;;QAIxB,MAAM,MAAM,GAAQ,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC;AACzD,QAAA,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK;AACvB,QAAA,IAAI,MAAM,GAAG,KAAK,CAAC,MAAM;AACzB,QAAA,IAAI,KAAK,GAAG,MAAM,EAAE;AAClB,YAAA,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE;AAC3B,gBAAA,MAAM,IAAI,OAAO,CAAC,OAAO,GAAG,KAAK;AACjC,gBAAA,KAAK,GAAG,OAAO,CAAC,OAAO;;;aAEpB;AACL,YAAA,IAAI,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE;AAC5B,gBAAA,KAAK,IAAI,OAAO,CAAC,OAAO,GAAG,MAAM;AACjC,gBAAA,MAAM,GAAG,OAAO,CAAC,OAAO;;;AAG5B,QAAA,MAAM,CAAC,KAAK,GAAG,KAAK;AACpB,QAAA,MAAM,CAAC,MAAM,GAAG,MAAM;AACtB,QAAA,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC;QAC7D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;;8GAtC7E,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAd,cAAc,EAAA,CAAA,CAAA;;2FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAD1B;;;ACHD;;AAEG;;;;"}
1
+ {"version":3,"file":"acorex-core-image.mjs","sources":["../../../../libs/core/image/src/lib/image.service.ts","../../../../libs/core/image/src/acorex-core-image.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { inject, Injectable, PLATFORM_ID } from '@angular/core';\n\n@Injectable()\nexport class AXImageService {\n private document = inject(DOCUMENT);\n private platformID = inject(PLATFORM_ID);\n async resize(options: {\n maxSize: number;\n source: HTMLImageElement | File;\n type?: 'image/png' | 'image/jpeg' | 'image/webp';\n quality?: number;\n }): Promise<Blob> {\n options = Object.assign({ type: 'image/png', quality: 1 }, options);\n\n let image: HTMLImageElement;\n if (options.source instanceof File) {\n const a = new Image();\n a.src = URL.createObjectURL(options.source);\n await new Promise<Event>((res) => (a.onload = res));\n image = a;\n } else {\n image = options.source;\n }\n\n // Resize the image\n const canvas: any = this.document.createElement('canvas');\n let width = image.width;\n let height = image.height;\n if (width > height) {\n if (width > options.maxSize) {\n height *= options.maxSize / width;\n width = options.maxSize;\n }\n } else {\n if (height > options.maxSize) {\n width *= options.maxSize / height;\n height = options.maxSize;\n }\n }\n canvas.width = width;\n canvas.height = height;\n canvas.getContext('2d').drawImage(image, 0, 0, width, height);\n return new Promise((resolve) => canvas.toBlob(resolve, options.type, options.quality));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAIa,cAAc,CAAA;AAD3B,IAAA,WAAA,GAAA;AAEU,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC3B,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;AAuCzC;IAtCC,MAAM,MAAM,CAAC,OAKZ,EAAA;AACC,QAAA,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC;AAEnE,QAAA,IAAI,KAAuB;AAC3B,QAAA,IAAI,OAAO,CAAC,MAAM,YAAY,IAAI,EAAE;AAClC,YAAA,MAAM,CAAC,GAAG,IAAI,KAAK,EAAE;YACrB,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC;AAC3C,YAAA,MAAM,IAAI,OAAO,CAAQ,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;YACnD,KAAK,GAAG,CAAC;;aACJ;AACL,YAAA,KAAK,GAAG,OAAO,CAAC,MAAM;;;QAIxB,MAAM,MAAM,GAAQ,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC;AACzD,QAAA,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK;AACvB,QAAA,IAAI,MAAM,GAAG,KAAK,CAAC,MAAM;AACzB,QAAA,IAAI,KAAK,GAAG,MAAM,EAAE;AAClB,YAAA,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE;AAC3B,gBAAA,MAAM,IAAI,OAAO,CAAC,OAAO,GAAG,KAAK;AACjC,gBAAA,KAAK,GAAG,OAAO,CAAC,OAAO;;;aAEpB;AACL,YAAA,IAAI,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE;AAC5B,gBAAA,KAAK,IAAI,OAAO,CAAC,OAAO,GAAG,MAAM;AACjC,gBAAA,MAAM,GAAG,OAAO,CAAC,OAAO;;;AAG5B,QAAA,MAAM,CAAC,KAAK,GAAG,KAAK;AACpB,QAAA,MAAM,CAAC,MAAM,GAAG,MAAM;AACtB,QAAA,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC;QAC7D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;;8GAvC7E,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAd,cAAc,EAAA,CAAA,CAAA;;2FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAD1B;;;ACHD;;AAEG;;;;"}
@@ -1,6 +1,6 @@
1
- import { DOCUMENT } from '@angular/common';
1
+ import { isPlatformBrowser, DOCUMENT } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { signal, inject, Injectable } from '@angular/core';
3
+ import { signal, inject, PLATFORM_ID, Injectable } from '@angular/core';
4
4
  import { Subject, BehaviorSubject, fromEvent } from 'rxjs';
5
5
  import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
6
6
 
@@ -94,21 +94,30 @@ class AXPlatformEvent {
94
94
  }
95
95
  class AXPlatform {
96
96
  isDark() {
97
- return this.document.documentElement.classList.contains('ax-dark');
97
+ if (isPlatformBrowser(this.platformID)) {
98
+ return this.document.documentElement.classList.contains('ax-dark');
99
+ }
100
+ return false;
98
101
  }
99
102
  isRtl() {
100
- return (this.document.dir == 'rtl' ||
101
- this.document.body.dir == 'rtl' ||
102
- this.document.body.style.direction == 'rtl');
103
+ if (isPlatformBrowser(this.platformID)) {
104
+ return (this.document.dir == 'rtl' ||
105
+ this.document.body.dir == 'rtl' ||
106
+ this.document.body.style.direction == 'rtl');
107
+ }
108
+ return false;
103
109
  }
104
110
  isLandscape() {
105
- return window.innerHeight < window.innerWidth;
111
+ if (isPlatformBrowser(this.platformID)) {
112
+ return window.innerHeight < window.innerWidth;
113
+ }
114
+ return true;
106
115
  }
107
116
  isPortrate() {
108
117
  return !this.isLandscape();
109
118
  }
110
119
  is(name) {
111
- if (isBrowser()) {
120
+ if (isPlatformBrowser(this.platformID)) {
112
121
  return PLATFORMS_MAP[name](window) || false;
113
122
  }
114
123
  else {
@@ -119,19 +128,23 @@ class AXPlatform {
119
128
  return (['SM', 'MD', 'LG', 'XL', '2XL', '3XL', '4XL'].find((name) => PLATFORMS_MAP[name](window) == true) || '5XL');
120
129
  }
121
130
  switchLightMode() {
122
- const _html = this.document.getElementsByTagName('html')[0];
123
- _html.classList.remove('ax-dark');
131
+ if (isPlatformBrowser(this.platformID)) {
132
+ const _html = this.document.getElementsByTagName('html')[0];
133
+ _html.classList.remove('ax-dark');
134
+ }
124
135
  this.#setSystemTheme('light');
125
136
  return 'light';
126
137
  }
127
138
  switchDarkMode() {
128
- const _html = this.document.getElementsByTagName('html')[0];
129
- _html.classList.add('ax-dark');
139
+ if (isPlatformBrowser(this.platformID)) {
140
+ const _html = this.document.getElementsByTagName('html')[0];
141
+ _html.classList.add('ax-dark');
142
+ }
130
143
  this.#setSystemTheme('dark');
131
144
  return 'dark';
132
145
  }
133
146
  switchSystemMode() {
134
- if (isBrowser()) {
147
+ if (isPlatformBrowser(this.platformID)) {
135
148
  if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
136
149
  const _html = this.document.getElementsByTagName('html')[0];
137
150
  _html.classList.add('ax-dark');
@@ -156,12 +169,12 @@ class AXPlatform {
156
169
  return this.switchLightMode();
157
170
  case 'dark':
158
171
  return this.switchDarkMode();
159
- case 'system':
172
+ default:
160
173
  return this.switchSystemMode();
161
174
  }
162
175
  }
163
176
  setFullHeightRatio() {
164
- if (isBrowser()) {
177
+ if (isPlatformBrowser(this.platformID)) {
165
178
  try {
166
179
  this.document
167
180
  .querySelector(':root')
@@ -175,13 +188,15 @@ class AXPlatform {
175
188
  autoSystemModeDetection(event) {
176
189
  if (this.themeMode() === 'system') {
177
190
  const themeMode = event.matches ? 'dark' : 'light';
178
- if (themeMode === 'dark') {
179
- const _html = this.document.getElementsByTagName('html')[0];
180
- _html.classList.add('ax-dark');
181
- }
182
- else {
183
- const _html = this.document.getElementsByTagName('html')[0];
184
- _html.classList.remove('ax-dark');
191
+ if (isPlatformBrowser(this.platformID)) {
192
+ if (themeMode === 'dark') {
193
+ const _html = this.document.getElementsByTagName('html')[0];
194
+ _html.classList.add('ax-dark');
195
+ }
196
+ else {
197
+ const _html = this.document.getElementsByTagName('html')[0];
198
+ _html.classList.remove('ax-dark');
199
+ }
185
200
  }
186
201
  }
187
202
  }
@@ -193,7 +208,8 @@ class AXPlatform {
193
208
  this.themeMode$ = new BehaviorSubject('system');
194
209
  this.themeMode = signal('system');
195
210
  this.document = inject(DOCUMENT);
196
- if (isBrowser()) {
211
+ this.platformID = inject(PLATFORM_ID);
212
+ if (isPlatformBrowser(this.platformID)) {
197
213
  this.detectDarkMode();
198
214
  this.detectOnResize();
199
215
  this.detectClickEvent();
@@ -203,58 +219,68 @@ class AXPlatform {
203
219
  }
204
220
  }
205
221
  detectDarkMode() {
206
- // fromEvent(UIEvent)(window,'')
207
- if (window?.matchMedia('(prefers-color-scheme: dark)').matches) {
208
- window?.matchMedia('(prefers-color-scheme: dark)')?.addEventListener('change', (event) => {
209
- // Detect System color mode
210
- this.autoSystemModeDetection(event);
211
- });
222
+ if (isPlatformBrowser(this.platformID)) {
223
+ // fromEvent(UIEvent)(window,'')
224
+ if (window?.matchMedia('(prefers-color-scheme: dark)').matches) {
225
+ window?.matchMedia('(prefers-color-scheme: dark)')?.addEventListener('change', (event) => {
226
+ // Detect System color mode
227
+ this.autoSystemModeDetection(event);
228
+ });
229
+ }
212
230
  }
213
231
  }
214
232
  detectOnResize() {
215
- fromEvent(window, 'resize')
216
- .pipe(debounceTime(100))
217
- .pipe(distinctUntilChanged())
218
- .subscribe((e) => {
219
- this.resize.next({
220
- nativeEvent: e,
221
- source: this,
233
+ if (isPlatformBrowser(this.platformID)) {
234
+ fromEvent(window, 'resize')
235
+ .pipe(debounceTime(100))
236
+ .pipe(distinctUntilChanged())
237
+ .subscribe((e) => {
238
+ this.resize.next({
239
+ nativeEvent: e,
240
+ source: this,
241
+ });
242
+ //
243
+ this.setFullHeightRatio();
222
244
  });
223
- //
224
- this.setFullHeightRatio();
225
- });
245
+ }
226
246
  }
227
247
  detectClickEvent() {
228
- this.document.addEventListener('click', (e) => {
229
- this.click.next({
230
- nativeEvent: e,
231
- source: this,
232
- });
233
- }, true);
248
+ if (isPlatformBrowser(this.platformID)) {
249
+ this.document.addEventListener('click', (e) => {
250
+ this.click.next({
251
+ nativeEvent: e,
252
+ source: this,
253
+ });
254
+ }, true);
255
+ }
234
256
  }
235
257
  detectScrollEvent() {
236
- this.document.addEventListener('scroll', (e) => {
237
- this.scroll.next({
238
- nativeEvent: e,
239
- source: this,
240
- });
241
- }, true);
258
+ if (isPlatformBrowser(this.platformID)) {
259
+ this.document.addEventListener('scroll', (e) => {
260
+ this.scroll.next({
261
+ nativeEvent: e,
262
+ source: this,
263
+ });
264
+ }, true);
265
+ }
242
266
  }
243
267
  detectDocumentDirectionChange() {
244
- const observer = new MutationObserver((mutations) => {
245
- mutations.forEach((mutation) => {
246
- // Detect Direction Change
247
- if (mutation.attributeName === 'dir') {
248
- const dir = this.document.documentElement.getAttribute('dir');
249
- this.directionChange.next({ source: this, nativeEvent: null, data: dir });
250
- }
268
+ if (isPlatformBrowser(this.platformID)) {
269
+ const observer = new MutationObserver((mutations) => {
270
+ mutations.forEach((mutation) => {
271
+ // Detect Direction Change
272
+ if (mutation.attributeName === 'dir') {
273
+ const dir = this.document.documentElement.getAttribute('dir');
274
+ this.directionChange.next({ source: this, nativeEvent: null, data: dir });
275
+ }
276
+ });
277
+ });
278
+ observer.observe(document.documentElement, {
279
+ attributes: true,
280
+ childList: false,
281
+ characterData: false,
251
282
  });
252
- });
253
- observer.observe(document.documentElement, {
254
- attributes: true,
255
- childList: false,
256
- characterData: false,
257
- });
283
+ }
258
284
  }
259
285
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPlatform, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
260
286
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPlatform, providedIn: 'root' }); }
@@ -270,5 +296,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
270
296
  * Generated bundle index. Do not edit.
271
297
  */
272
298
 
273
- export { AXPlatform, AXPlatformEvent, isBrowser, isServer, testUserAgent };
299
+ export { AXPlatform, AXPlatformEvent, PLATFORMS_MAP, is2XLScreen, is3XLScreen, is4XLScreen, isAndroid, isAndroidTablet, isBrowser, isCapacitorNative, isChrome, isCordova, isDesktop, isEdge, isElectron, isFirefox, isHybrid, isIOS, isIpad, isIphone, isLGScreen, isMDScreen, isMSIE, isMobile, isMobileWeb, isOpera, isPWA, isPhablet, isSMScreen, isSafari, isServer, isTablet, isTouch, isXLScreen, matchMedia, testUserAgent };
274
300
  //# sourceMappingURL=acorex-core-platform.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-core-platform.mjs","sources":["../../../../libs/core/platform/src/lib/platform.service.ts","../../../../libs/core/platform/src/acorex-core-platform.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { inject, Injectable, signal } from '@angular/core';\nimport { BehaviorSubject, fromEvent, Subject } from 'rxjs';\nimport { debounceTime, distinctUntilChanged } from 'rxjs/operators';\n\nexport type AXThemeMode = 'light' | 'dark' | 'system' | 'system-dark' | 'system-light';\nexport type AXPlatforms = 'Android' | 'Desktop' | 'iOS' | 'Mobile';\nexport type AXBrowsers = 'Chrome' | 'Safari' | 'Edge' | 'Firefox' | 'Opera' | 'MSIE';\nexport type AXTechnologies = 'PWA' | 'Hybrid' | 'Electron';\n\nexport type AXScreenSizes = 'SM' | 'MD' | 'LG' | 'XL' | '2XL' | '3XL' | '4XL' | '5XL';\n\nconst isChrome = (win: Window): boolean => testUserAgent(win, /Chrome/i);\n\nconst isFirefox = (win: Window): boolean => testUserAgent(win, /Firefox/i);\n\nconst isEdge = (win: Window): boolean => testUserAgent(win, /Edge/i);\n\nconst isSafari = (win: Window): boolean => testUserAgent(win, /Safari/i);\n\nconst isOpera = (win: Window): boolean => testUserAgent(win, /Opera/i) || testUserAgent(win, /OPR/i);\n\nconst isMSIE = (win: Window): boolean => testUserAgent(win, /MSIE/i) || testUserAgent(win, /Trident/i);\n\nconst isMobileWeb = (win: Window): boolean => isMobile(win) && !isHybrid(win);\n\nconst isIpad = (win: Window) => {\n // iOS 12 and below\n if (testUserAgent(win, /iPad/i)) {\n return true;\n }\n\n // iOS 13+\n if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {\n return true;\n }\n\n return false;\n};\n\nconst isIphone = (win: Window) => testUserAgent(win, /iPhone/i);\n\nconst isIOS = (win: Window) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win);\n\nconst isAndroid = (win: Window) => testUserAgent(win, /android|sink/i);\n\nconst isAndroidTablet = (win: Window) => {\n return isAndroid(win) && !testUserAgent(win, /mobile/i);\n};\n\nconst isPhablet = (win: Window) => {\n const width = win.innerWidth;\n const height = win.innerHeight;\n const smallest = Math.min(width, height);\n const largest = Math.max(width, height);\n\n return smallest > 390 && smallest < 520 && largest > 620 && largest < 800;\n};\n\nconst isTablet = (win: Window) => {\n const width = win.innerWidth;\n const height = win.innerHeight;\n const smallest = Math.min(width, height);\n const largest = Math.max(width, height);\n\n return (\n isIpad(win) ||\n isAndroidTablet(win) ||\n (smallest > 460 && smallest < 820 && largest > 780 && largest < 1400)\n );\n};\n\nconst isMobile = (win: Window) => matchMedia(win, '(any-pointer:coarse)');\nconst isTouch = (win: Window) => matchMedia(win, '(any-pointer:coarse)');\n\nconst isDesktop = (win: Window) => !isMobile(win);\n\nconst isHybrid = (win: Window) => isCordova(win) || isCapacitorNative(win);\n\nconst isCordova = (win: any): boolean => !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);\n\nconst isCapacitorNative = (win: any): boolean => {\n const capacitor = win['Capacitor'];\n return !!(capacitor && capacitor.isNative);\n};\n\nconst isElectron = (win: Window): boolean => testUserAgent(win, /electron/i);\n\nconst isPWA = (win: Window): boolean =>\n !!(win.matchMedia('(display-mode: standalone)').matches || (win.navigator as any).standalone);\n\nexport const testUserAgent = (win: Window, expr: RegExp) => expr.test(win.navigator.userAgent);\n\nexport const isBrowser = new Function('try {return this===window;}catch(e){ return false;}');\nexport const isServer = new Function('try {return this===global;}catch(e){return false;}');\n\nconst matchMedia = (win: Window, query: string): boolean => {\n return win.matchMedia(query).matches;\n};\n\nconst isSMScreen = (win: Window) => matchMedia(win, '(max-width: 640px)');\nconst isMDScreen = (win: Window) => matchMedia(win, '(max-width: 768px)');\nconst isLGScreen = (win: Window) => matchMedia(win, '(max-width: 1024px)');\nconst isXLScreen = (win: Window) => matchMedia(win, '(max-width: 1280px)');\nconst is2XLScreen = (win: Window) => matchMedia(win, '(max-width: 1536px)');\nconst is3XLScreen = (win: Window) => matchMedia(win, '(max-width: 1920px)');\nconst is4XLScreen = (win: Window) => matchMedia(win, '(max-width: 2560px)');\n\nconst PLATFORMS_MAP: any = {\n Android: isAndroid,\n iOS: isIOS,\n Desktop: isDesktop,\n Mobile: isMobile,\n Touch: isTouch,\n Chrome: isChrome,\n Firefox: isFirefox,\n Safari: isSafari,\n Edge: isEdge,\n Opera: isOpera,\n Hybrid: isHybrid,\n PWA: isPWA,\n Electron: isElectron,\n SM: isSMScreen,\n MD: isMDScreen,\n LG: isLGScreen,\n XL: isXLScreen,\n '2XL': is2XLScreen,\n '3XL': is3XLScreen,\n '4XL': is4XLScreen,\n};\n\nexport class AXPlatformEvent<T extends Event = Event> {\n nativeEvent!: T;\n source!: AXPlatform;\n data?: any;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPlatform {\n resize: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n directionChange: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n click: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n scroll: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n themeMode$: BehaviorSubject<AXThemeMode> = new BehaviorSubject<AXThemeMode>('system');\n themeMode = signal<AXThemeMode>('system');\n private document = inject(DOCUMENT);\n\n isDark(): boolean {\n return this.document.documentElement.classList.contains('ax-dark');\n }\n\n isRtl(): boolean {\n return (\n this.document.dir == 'rtl' ||\n this.document.body.dir == 'rtl' ||\n this.document.body.style.direction == 'rtl'\n );\n }\n\n isLandscape(): boolean {\n return window.innerHeight < window.innerWidth;\n }\n\n isPortrate(): boolean {\n return !this.isLandscape();\n }\n\n is(name: AXPlatforms | AXBrowsers | AXTechnologies | AXScreenSizes): boolean {\n if (isBrowser()) {\n return PLATFORMS_MAP[name](window) || false;\n } else {\n return false;\n }\n }\n\n get screenSize(): AXScreenSizes {\n return (['SM', 'MD', 'LG', 'XL', '2XL', '3XL', '4XL'].find(\n (name) => PLATFORMS_MAP[name](window) == true,\n ) || '5XL') as AXScreenSizes;\n }\n\n switchLightMode() {\n const _html = this.document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n this.#setSystemTheme('light');\n return 'light';\n }\n\n switchDarkMode() {\n const _html = this.document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n this.#setSystemTheme('dark');\n return 'dark';\n }\n\n switchSystemMode() {\n if (isBrowser()) {\n if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {\n const _html = this.document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n this.#setSystemTheme('system-dark');\n } else {\n const _html = this.document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n this.#setSystemTheme('system-light');\n }\n }\n }\n\n #setSystemTheme(themeMode: AXThemeMode) {\n this.themeMode$.next(themeMode);\n localStorage.setItem('AX_THEME_MODE', themeMode);\n this.themeMode.set(themeMode);\n }\n\n autoDetectThemeMode() {\n const mode = localStorage.getItem('AX_THEME_MODE') || 'system';\n switch (mode) {\n case 'light':\n return this.switchLightMode();\n\n case 'dark':\n return this.switchDarkMode();\n\n case 'system':\n return this.switchSystemMode();\n }\n }\n\n private setFullHeightRatio() {\n if (isBrowser()) {\n try {\n this.document\n .querySelector<HTMLElement>(':root')\n ?.style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');\n } catch (error) {\n console.error(error);\n }\n }\n }\n\n private autoSystemModeDetection(event) {\n if (this.themeMode() === 'system') {\n const themeMode = event.matches ? 'dark' : 'light';\n\n if (themeMode === 'dark') {\n const _html = this.document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n } else {\n const _html = this.document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n }\n }\n }\n\n constructor() {\n if (isBrowser()) {\n this.detectDarkMode();\n this.detectOnResize();\n this.detectClickEvent();\n this.detectScrollEvent();\n this.setFullHeightRatio();\n this.detectDocumentDirectionChange();\n }\n }\n\n private detectDarkMode() {\n // fromEvent(UIEvent)(window,'')\n if (window?.matchMedia('(prefers-color-scheme: dark)').matches) {\n window?.matchMedia('(prefers-color-scheme: dark)')?.addEventListener('change', (event) => {\n // Detect System color mode\n this.autoSystemModeDetection(event);\n });\n }\n }\n\n private detectOnResize() {\n fromEvent<UIEvent>(window, 'resize')\n .pipe(debounceTime(100))\n .pipe(distinctUntilChanged())\n .subscribe((e) => {\n this.resize.next({\n nativeEvent: e,\n source: this,\n });\n //\n this.setFullHeightRatio();\n });\n }\n\n private detectClickEvent() {\n this.document.addEventListener(\n 'click',\n (e) => {\n this.click.next({\n nativeEvent: e,\n source: this,\n });\n },\n true,\n );\n }\n\n private detectScrollEvent() {\n this.document.addEventListener(\n 'scroll',\n (e) => {\n this.scroll.next({\n nativeEvent: e,\n source: this,\n });\n },\n true,\n );\n }\n\n private detectDocumentDirectionChange() {\n const observer = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n // Detect Direction Change\n if (mutation.attributeName === 'dir') {\n const dir = this.document.documentElement.getAttribute('dir');\n this.directionChange.next({ source: this, nativeEvent: null, data: dir });\n }\n });\n });\n observer.observe(document.documentElement, {\n attributes: true,\n childList: false,\n characterData: false,\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAYA,MAAM,QAAQ,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC;AAExE,MAAM,SAAS,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,UAAU,CAAC;AAE1E,MAAM,MAAM,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC;AAEpE,MAAM,QAAQ,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC;AAExE,MAAM,OAAO,GAAG,CAAC,GAAW,KAAc,aAAa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EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;;AAE7E,aAAC,CAAC;AACJ,SAAC,CAAC;AACF,QAAA,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,EAAE;AACzC,YAAA,UAAU,EAAE,IAAI;AAChB,YAAA,SAAS,EAAE,KAAK;AAChB,YAAA,aAAa,EAAE,KAAK;AACrB,SAAA,CAAC;;8GAhMO,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAV,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,cAFT,MAAM,EAAA,CAAA,CAAA;;2FAEP,UAAU,EAAA,UAAA,EAAA,CAAA;kBAHtB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;AC3ID;;AAEG;;;;"}
1
+ {"version":3,"file":"acorex-core-platform.mjs","sources":["../../../../libs/core/platform/src/lib/platform.service.ts","../../../../libs/core/platform/src/acorex-core-platform.ts"],"sourcesContent":["import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { inject, Injectable, PLATFORM_ID, signal } from '@angular/core';\nimport { BehaviorSubject, fromEvent, Subject } from 'rxjs';\nimport { debounceTime, distinctUntilChanged } from 'rxjs/operators';\n\nexport type AXThemeMode = 'light' | 'dark' | 'system' | 'system-dark' | 'system-light';\nexport type AXPlatforms = 'Android' | 'Desktop' | 'iOS' | 'Mobile';\nexport type AXBrowsers = 'Chrome' | 'Safari' | 'Edge' | 'Firefox' | 'Opera' | 'MSIE';\nexport type AXTechnologies = 'PWA' | 'Hybrid' | 'Electron';\n\nexport type AXScreenSizes = 'SM' | 'MD' | 'LG' | 'XL' | '2XL' | '3XL' | '4XL' | '5XL';\n\nexport const isChrome = (win: Window): boolean => testUserAgent(win, /Chrome/i);\n\nexport const isFirefox = (win: Window): boolean => testUserAgent(win, /Firefox/i);\n\nexport const isEdge = (win: Window): boolean => testUserAgent(win, /Edge/i);\n\nexport const isSafari = (win: Window): boolean => testUserAgent(win, /Safari/i);\n\nexport const isOpera = (win: Window): boolean => testUserAgent(win, /Opera/i) || testUserAgent(win, /OPR/i);\n\nexport const isMSIE = (win: Window): boolean => testUserAgent(win, /MSIE/i) || testUserAgent(win, /Trident/i);\n\nexport const isMobileWeb = (win: Window): boolean => isMobile(win) && !isHybrid(win);\n\nexport const isIpad = (win: Window) => {\n // iOS 12 and below\n if (testUserAgent(win, /iPad/i)) {\n return true;\n }\n\n // iOS 13+\n if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {\n return true;\n }\n\n return false;\n};\n\nexport const isIphone = (win: Window) => testUserAgent(win, /iPhone/i);\n\nexport const isIOS = (win: Window) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win);\n\nexport const isAndroid = (win: Window) => testUserAgent(win, /android|sink/i);\n\nexport const isAndroidTablet = (win: Window) => {\n return isAndroid(win) && !testUserAgent(win, /mobile/i);\n};\n\nexport const isPhablet = (win: Window) => {\n const width = win.innerWidth;\n const height = win.innerHeight;\n const smallest = Math.min(width, height);\n const largest = Math.max(width, height);\n\n return smallest > 390 && smallest < 520 && largest > 620 && largest < 800;\n};\n\nexport const isTablet = (win: Window) => {\n const width = win.innerWidth;\n const height = win.innerHeight;\n const smallest = Math.min(width, height);\n const largest = Math.max(width, height);\n\n return (\n isIpad(win) ||\n isAndroidTablet(win) ||\n (smallest > 460 && smallest < 820 && largest > 780 && largest < 1400)\n );\n};\n\nexport const isMobile = (win: Window) => matchMedia(win, '(any-pointer:coarse)');\nexport const isTouch = (win: Window) => matchMedia(win, '(any-pointer:coarse)');\n\nexport const isDesktop = (win: Window) => !isMobile(win);\n\nexport const isHybrid = (win: Window) => isCordova(win) || isCapacitorNative(win);\n\nexport const isCordova = (win: any): boolean => !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);\n\nexport const isCapacitorNative = (win: any): boolean => {\n const capacitor = win['Capacitor'];\n return !!(capacitor && capacitor.isNative);\n};\n\nexport const isElectron = (win: Window): boolean => testUserAgent(win, /electron/i);\n\nexport const isPWA = (win: Window): boolean =>\n !!(win.matchMedia('(display-mode: standalone)').matches || (win.navigator as any).standalone);\n\nexport const testUserAgent = (win: Window, expr: RegExp) => expr.test(win.navigator.userAgent);\n\nexport const isBrowser = new Function('try {return this===window;}catch(e){ return false;}');\nexport const isServer = new Function('try {return this===global;}catch(e){return false;}');\n\nexport const matchMedia = (win: Window, query: string): boolean => {\n return win.matchMedia(query).matches;\n};\n\nexport const isSMScreen = (win: Window) => matchMedia(win, '(max-width: 640px)');\nexport const isMDScreen = (win: Window) => matchMedia(win, '(max-width: 768px)');\nexport const isLGScreen = (win: Window) => matchMedia(win, '(max-width: 1024px)');\nexport const isXLScreen = (win: Window) => matchMedia(win, '(max-width: 1280px)');\nexport const is2XLScreen = (win: Window) => matchMedia(win, '(max-width: 1536px)');\nexport const is3XLScreen = (win: Window) => matchMedia(win, '(max-width: 1920px)');\nexport const is4XLScreen = (win: Window) => matchMedia(win, '(max-width: 2560px)');\n\nexport const PLATFORMS_MAP: any = {\n Android: isAndroid,\n iOS: isIOS,\n Desktop: isDesktop,\n Mobile: isMobile,\n Touch: isTouch,\n Chrome: isChrome,\n Firefox: isFirefox,\n Safari: isSafari,\n Edge: isEdge,\n Opera: isOpera,\n Hybrid: isHybrid,\n PWA: isPWA,\n Electron: isElectron,\n SM: isSMScreen,\n MD: isMDScreen,\n LG: isLGScreen,\n XL: isXLScreen,\n '2XL': is2XLScreen,\n '3XL': is3XLScreen,\n '4XL': is4XLScreen,\n};\n\nexport class AXPlatformEvent<T extends Event = Event> {\n nativeEvent!: T;\n source!: AXPlatform;\n data?: any;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPlatform {\n resize: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n directionChange: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n click: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n scroll: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();\n themeMode$: BehaviorSubject<AXThemeMode> = new BehaviorSubject<AXThemeMode>('system');\n themeMode = signal<AXThemeMode>('system');\n private document = inject(DOCUMENT);\n private platformID = inject(PLATFORM_ID);\n\n isDark(): boolean {\n if (isPlatformBrowser(this.platformID)) {\n return this.document.documentElement.classList.contains('ax-dark');\n }\n return false;\n }\n\n isRtl(): boolean {\n if (isPlatformBrowser(this.platformID)) {\n return (\n this.document.dir == 'rtl' ||\n this.document.body.dir == 'rtl' ||\n this.document.body.style.direction == 'rtl'\n );\n }\n return false;\n }\n\n isLandscape(): boolean {\n if (isPlatformBrowser(this.platformID)) {\n return window.innerHeight < window.innerWidth;\n }\n return true;\n }\n\n isPortrate(): boolean {\n return !this.isLandscape();\n }\n\n is(name: AXPlatforms | AXBrowsers | AXTechnologies | AXScreenSizes): boolean {\n if (isPlatformBrowser(this.platformID)) {\n return PLATFORMS_MAP[name](window) || false;\n } else {\n return false;\n }\n }\n\n get screenSize(): AXScreenSizes {\n return (['SM', 'MD', 'LG', 'XL', '2XL', '3XL', '4XL'].find(\n (name) => PLATFORMS_MAP[name](window) == true,\n ) || '5XL') as AXScreenSizes;\n }\n\n switchLightMode() {\n if (isPlatformBrowser(this.platformID)) {\n const _html = this.document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n }\n this.#setSystemTheme('light');\n return 'light';\n }\n\n switchDarkMode() {\n if (isPlatformBrowser(this.platformID)) {\n const _html = this.document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n }\n this.#setSystemTheme('dark');\n return 'dark';\n }\n\n switchSystemMode() {\n if (isPlatformBrowser(this.platformID)) {\n if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {\n const _html = this.document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n this.#setSystemTheme('system-dark');\n } else {\n const _html = this.document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n this.#setSystemTheme('system-light');\n }\n }\n }\n\n #setSystemTheme(themeMode: AXThemeMode) {\n this.themeMode$.next(themeMode);\n localStorage.setItem('AX_THEME_MODE', themeMode);\n this.themeMode.set(themeMode);\n }\n\n autoDetectThemeMode() {\n const mode = localStorage.getItem('AX_THEME_MODE') || 'system';\n switch (mode) {\n case 'light':\n return this.switchLightMode();\n\n case 'dark':\n return this.switchDarkMode();\n\n default:\n return this.switchSystemMode();\n }\n }\n\n private setFullHeightRatio() {\n if (isPlatformBrowser(this.platformID)) {\n try {\n this.document\n .querySelector<HTMLElement>(':root')\n ?.style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');\n } catch (error) {\n console.error(error);\n }\n }\n }\n\n private autoSystemModeDetection(event) {\n if (this.themeMode() === 'system') {\n const themeMode = event.matches ? 'dark' : 'light';\n\n if (isPlatformBrowser(this.platformID)) {\n if (themeMode === 'dark') {\n const _html = this.document.getElementsByTagName('html')[0];\n _html.classList.add('ax-dark');\n } else {\n const _html = this.document.getElementsByTagName('html')[0];\n _html.classList.remove('ax-dark');\n }\n }\n }\n }\n\n constructor() {\n if (isPlatformBrowser(this.platformID)) {\n this.detectDarkMode();\n this.detectOnResize();\n this.detectClickEvent();\n this.detectScrollEvent();\n this.setFullHeightRatio();\n this.detectDocumentDirectionChange();\n }\n }\n\n private detectDarkMode() {\n if (isPlatformBrowser(this.platformID)) {\n // fromEvent(UIEvent)(window,'')\n if (window?.matchMedia('(prefers-color-scheme: dark)').matches) {\n window?.matchMedia('(prefers-color-scheme: dark)')?.addEventListener('change', (event) => {\n // Detect System color mode\n this.autoSystemModeDetection(event);\n });\n }\n }\n }\n\n private detectOnResize() {\n if (isPlatformBrowser(this.platformID)) {\n fromEvent<UIEvent>(window, 'resize')\n .pipe(debounceTime(100))\n .pipe(distinctUntilChanged())\n .subscribe((e) => {\n this.resize.next({\n nativeEvent: e,\n source: this,\n });\n //\n this.setFullHeightRatio();\n });\n }\n }\n\n private detectClickEvent() {\n if (isPlatformBrowser(this.platformID)) {\n this.document.addEventListener(\n 'click',\n (e) => {\n this.click.next({\n nativeEvent: e,\n source: this,\n });\n },\n true,\n );\n }\n }\n\n private detectScrollEvent() {\n if (isPlatformBrowser(this.platformID)) {\n this.document.addEventListener(\n 'scroll',\n (e) => {\n this.scroll.next({\n nativeEvent: e,\n source: this,\n });\n },\n true,\n );\n }\n }\n\n private detectDocumentDirectionChange() {\n if (isPlatformBrowser(this.platformID)) {\n const observer = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n // Detect Direction Change\n if (mutation.attributeName === 'dir') {\n const dir = this.document.documentElement.getAttribute('dir');\n this.directionChange.next({ source: this, nativeEvent: null, data: dir });\n }\n });\n });\n observer.observe(document.documentElement, {\n attributes: true,\n childList: false,\n characterData: false,\n });\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAYO,MAAM,QAAQ,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,SAAS;AAEvE,MAAM,SAAS,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,UAAU;AAEzE,MAAM,MAAM,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,OAAO;AAEnE,MAAM,QAAQ,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,SAAS;MAEjE,OAAO,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,aAAa,CAAC,GAAG,EAAE,MAAM;MAE7F,MAAM,GAAG,CAAC,GAAW,KAAc,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,aAAa,CAAC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AA,CAAA;;2FAEP,UAAU,EAAA,UAAA,EAAA,CAAA;kBAHtB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;AC3ID;;AAEG;;;;"}
@@ -1,10 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, inject, Directive, Input, HostListener, NgModule } from '@angular/core';
2
+ import { Injectable, inject, PLATFORM_ID, Directive, Input, HostListener, NgModule } from '@angular/core';
3
3
  import { Subject, takeUntil } from 'rxjs';
4
4
  import tinycolor from 'tinycolor2';
5
5
  import tinygradient from 'tinygradient-es';
6
6
  import { isBrowser } from '@acorex/core/platform';
7
- import { DOCUMENT, CommonModule } from '@angular/common';
7
+ import { DOCUMENT, isPlatformBrowser, CommonModule } from '@angular/common';
8
8
 
9
9
  function AXAutoUnsubscriber() {
10
10
  return function (constructor) {
@@ -264,6 +264,7 @@ class AXResizableDirective {
264
264
  this.renderer = renderer;
265
265
  this.zone = zone;
266
266
  this.document = inject(DOCUMENT);
267
+ this.platformID = inject(PLATFORM_ID);
267
268
  this.minWidth = 100; // Minimum width for the resizable element
268
269
  this.isResizing = false;
269
270
  this.createResizeHandle(); // Initialize the resize handle
@@ -292,7 +293,9 @@ class AXResizableDirective {
292
293
  onMouseDown(event) {
293
294
  // Only allow resizing when clicking on the handle
294
295
  const handleRect = this.resizeHandle.getBoundingClientRect();
295
- if (event.clientX >= handleRect.left && event.clientX <= handleRect.right) {
296
+ if (event.clientX >= handleRect.left &&
297
+ event.clientX <= handleRect.right &&
298
+ isPlatformBrowser(this.platformID)) {
296
299
  this.zone.runOutsideAngular(() => {
297
300
  this.isResizing = true;
298
301
  this.document.body.style.cursor = 'ew-resize'; // Change cursor to resize mode
@@ -309,11 +312,13 @@ class AXResizableDirective {
309
312
  const rect = this.el.nativeElement.getBoundingClientRect();
310
313
  let newWidth;
311
314
  // Resize logic (LTR or RTL support)
312
- if (this.document.documentElement.dir === 'rtl') {
313
- newWidth = rect.right - event.clientX;
314
- }
315
- else {
316
- newWidth = event.clientX - rect.left;
315
+ if (isPlatformBrowser(this.platformID)) {
316
+ if (this.document.documentElement.dir === 'rtl') {
317
+ newWidth = rect.right - event.clientX;
318
+ }
319
+ else {
320
+ newWidth = event.clientX - rect.left;
321
+ }
317
322
  }
318
323
  // Ensure the width does not go below the minimum width
319
324
  if (newWidth > this.minWidth) {
@@ -325,7 +330,7 @@ class AXResizableDirective {
325
330
  // Mouse up event: End resizing
326
331
  onMouseUp() {
327
332
  this.zone.runOutsideAngular(() => {
328
- if (this.isResizing) {
333
+ if (this.isResizing && isPlatformBrowser(this.platformID)) {
329
334
  this.isResizing = false;
330
335
  this.document.body.style.cursor = 'default'; // Reset the cursor
331
336
  // Reset the resize handle color to default when resizing ends