@filip.mazev/blocks-core 0.0.19 → 0.0.21

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,15 +1,27 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, inject, signal, computed, NgZone, PLATFORM_ID } from '@angular/core';
3
- import { DesktopOS as DesktopOS$1 } from '@core/enums/desktop-os.enum';
4
- import { MobileOS as MobileOS$1 } from '@core/enums/mobile-os.enum';
5
- import { DeviceTypeService as DeviceTypeService$1 } from '@core/services/device-type.service';
6
- import { WindowDimensionsService as WindowDimensionsService$1 } from '@core/services/window-dimension.service';
2
+ import { Injectable, inject, NgZone, PLATFORM_ID, signal, computed } from '@angular/core';
7
3
  import { isPlatformBrowser } from '@angular/common';
8
4
  import { fromEvent } from 'rxjs';
9
5
  import { debounceTime, map, distinctUntilChanged } from 'rxjs/operators';
10
- import { BREAKPOINTS as BREAKPOINTS$1 } from '@core/constants/window-dimension.constants';
11
6
  import { toObservable } from '@angular/core/rxjs-interop';
12
7
 
8
+ var DesktopOS;
9
+ (function (DesktopOS) {
10
+ DesktopOS["Linux"] = "linux";
11
+ DesktopOS["MacOS"] = "mac_os";
12
+ DesktopOS["Unix"] = "unix";
13
+ DesktopOS["Unknown"] = "unknown";
14
+ DesktopOS["Windows"] = "windows";
15
+ })(DesktopOS || (DesktopOS = {}));
16
+
17
+ var MobileOS;
18
+ (function (MobileOS) {
19
+ MobileOS["Android"] = "android";
20
+ MobileOS["iOS"] = "ios";
21
+ MobileOS["Unknown"] = "unknown";
22
+ MobileOS["WindowsPhone"] = "Windows Phone";
23
+ })(MobileOS || (MobileOS = {}));
24
+
13
25
  class DeviceTypeService {
14
26
  userAgent = navigator.userAgent || navigator.vendor || window.opera || undefined;
15
27
  isDesktopDevice = !this.isMobileDevice() && !this.isTabletDevice();
@@ -39,12 +51,12 @@ class DeviceTypeService {
39
51
  getMobileOS() {
40
52
  if (this.isMobileDevice()) {
41
53
  if (/windows phone/i.test(this.userAgent))
42
- return MobileOS$1.WindowsPhone;
54
+ return MobileOS.WindowsPhone;
43
55
  else if (/android/i.test(this.userAgent))
44
- return MobileOS$1.Android;
56
+ return MobileOS.Android;
45
57
  else if (/iPad|iPhone|iPod/.test(this.userAgent) && !window.MSStream)
46
- return MobileOS$1.iOS;
47
- return MobileOS$1.Unknown;
58
+ return MobileOS.iOS;
59
+ return MobileOS.Unknown;
48
60
  }
49
61
  else
50
62
  return undefined;
@@ -52,14 +64,14 @@ class DeviceTypeService {
52
64
  getDesktopOS() {
53
65
  if (this.isDesktopDevice) {
54
66
  if (this.userAgent.indexOf('Win') !== -1)
55
- return DesktopOS$1.Windows;
67
+ return DesktopOS.Windows;
56
68
  else if (this.userAgent.indexOf('Mac') !== -1)
57
- return DesktopOS$1.MacOS;
69
+ return DesktopOS.MacOS;
58
70
  else if (this.userAgent.indexOf('X11') !== -1)
59
- return DesktopOS$1.Unix;
71
+ return DesktopOS.Unix;
60
72
  else if (this.userAgent.indexOf('Linux') !== -1)
61
- return DesktopOS$1.Linux;
62
- return DesktopOS$1.Unknown;
73
+ return DesktopOS.Linux;
74
+ return DesktopOS.Unknown;
63
75
  }
64
76
  else
65
77
  return undefined;
@@ -72,12 +84,12 @@ class DeviceTypeService {
72
84
  const isMobile = this.isMobileDevice();
73
85
  const isTablet = this.isTabletDevice();
74
86
  const mobileOS = this.getMobileOS();
75
- const isAndroidDevice = this.getDeviceOS() === MobileOS$1.Android;
76
- const isAppleDevice = this.getDeviceOS() === MobileOS$1.iOS || this.getDeviceOS() === DesktopOS$1.MacOS;
77
- const isUnknownMobileDevice = this.getDeviceOS() === MobileOS$1.Unknown;
87
+ const isAndroidDevice = this.getDeviceOS() === MobileOS.Android;
88
+ const isAppleDevice = this.getDeviceOS() === MobileOS.iOS || this.getDeviceOS() === DesktopOS.MacOS;
89
+ const isUnknownMobileDevice = this.getDeviceOS() === MobileOS.Unknown;
78
90
  const desktopOS = this.getDesktopOS();
79
- const isWindowsDesktop = this.getDeviceOS() === DesktopOS$1.Windows;
80
- const isLinuxOrUnixDesktop = this.getDeviceOS() === DesktopOS$1.Linux || this.getDeviceOS() === DesktopOS$1.Unix;
91
+ const isWindowsDesktop = this.getDeviceOS() === DesktopOS.Windows;
92
+ const isLinuxOrUnixDesktop = this.getDeviceOS() === DesktopOS.Linux || this.getDeviceOS() === DesktopOS.Unix;
81
93
  return {
82
94
  isDesktop,
83
95
  desktopOS,
@@ -103,9 +115,65 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
103
115
  }]
104
116
  }], ctorParameters: () => [] });
105
117
 
118
+ const BREAKPOINTS = {
119
+ xs: 360,
120
+ sm: 640,
121
+ md: 768,
122
+ lg: 1024,
123
+ xl: 1280,
124
+ '2xl': 1536,
125
+ '3xl': 1920,
126
+ '4xl': 2560,
127
+ };
128
+
129
+ class WindowDimensionsService {
130
+ ngZone = inject(NgZone);
131
+ platformId = inject(PLATFORM_ID);
132
+ isBrowser = isPlatformBrowser(this.platformId);
133
+ _dimensions = signal(this.getCurrentDimensions(), ...(ngDevMode ? [{ debugName: "_dimensions" }] : []));
134
+ dimensions = this._dimensions.asReadonly();
135
+ isMobile = computed(() => this.dimensions().width < BREAKPOINTS.md, ...(ngDevMode ? [{ debugName: "isMobile" }] : []));
136
+ isTablet = computed(() => this.dimensions().width >= BREAKPOINTS.md && this.dimensions().width < BREAKPOINTS.lg, ...(ngDevMode ? [{ debugName: "isTablet" }] : []));
137
+ isDesktop = computed(() => this.dimensions().width >= BREAKPOINTS.lg, ...(ngDevMode ? [{ debugName: "isDesktop" }] : []));
138
+ breakpoints = BREAKPOINTS;
139
+ constructor() {
140
+ this.initResizeListener();
141
+ }
142
+ getCurrentDimensions() {
143
+ if (!this.isBrowser) {
144
+ return { width: 0, height: 0 };
145
+ }
146
+ return {
147
+ width: window.innerWidth,
148
+ height: window.innerHeight,
149
+ };
150
+ }
151
+ initResizeListener() {
152
+ if (!this.isBrowser)
153
+ return;
154
+ this.ngZone.runOutsideAngular(() => {
155
+ fromEvent(window, 'resize')
156
+ .pipe(debounceTime(150), map(() => this.getCurrentDimensions()), distinctUntilChanged((prev, curr) => prev.width === curr.width && prev.height === curr.height))
157
+ .subscribe((dims) => {
158
+ this.ngZone.run(() => {
159
+ this._dimensions.set(dims);
160
+ });
161
+ });
162
+ });
163
+ }
164
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: WindowDimensionsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
165
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: WindowDimensionsService, providedIn: 'root' });
166
+ }
167
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: WindowDimensionsService, decorators: [{
168
+ type: Injectable,
169
+ args: [{
170
+ providedIn: 'root',
171
+ }]
172
+ }], ctorParameters: () => [] });
173
+
106
174
  class ScrollLockService {
107
- deviceTypeService = inject(DeviceTypeService$1);
108
- windowDimensionsService = inject(WindowDimensionsService$1);
175
+ deviceTypeService = inject(DeviceTypeService);
176
+ windowDimensionsService = inject(WindowDimensionsService);
109
177
  activeLocks = new Map();
110
178
  _isScrollDisabled = signal(false, ...(ngDevMode ? [{ debugName: "_isScrollDisabled" }] : []));
111
179
  isScrollDisabled = this._isScrollDisabled.asReadonly();
@@ -232,51 +300,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
232
300
  }]
233
301
  }], ctorParameters: () => [] });
234
302
 
235
- class WindowDimensionsService {
236
- ngZone = inject(NgZone);
237
- platformId = inject(PLATFORM_ID);
238
- isBrowser = isPlatformBrowser(this.platformId);
239
- _dimensions = signal(this.getCurrentDimensions(), ...(ngDevMode ? [{ debugName: "_dimensions" }] : []));
240
- dimensions = this._dimensions.asReadonly();
241
- isMobile = computed(() => this.dimensions().width < BREAKPOINTS$1.md, ...(ngDevMode ? [{ debugName: "isMobile" }] : []));
242
- isTablet = computed(() => this.dimensions().width >= BREAKPOINTS$1.md && this.dimensions().width < BREAKPOINTS$1.lg, ...(ngDevMode ? [{ debugName: "isTablet" }] : []));
243
- isDesktop = computed(() => this.dimensions().width >= BREAKPOINTS$1.lg, ...(ngDevMode ? [{ debugName: "isDesktop" }] : []));
244
- breakpoints = BREAKPOINTS$1;
245
- constructor() {
246
- this.initResizeListener();
247
- }
248
- getCurrentDimensions() {
249
- if (!this.isBrowser) {
250
- return { width: 0, height: 0 };
251
- }
252
- return {
253
- width: window.innerWidth,
254
- height: window.innerHeight,
255
- };
256
- }
257
- initResizeListener() {
258
- if (!this.isBrowser)
259
- return;
260
- this.ngZone.runOutsideAngular(() => {
261
- fromEvent(window, 'resize')
262
- .pipe(debounceTime(150), map(() => this.getCurrentDimensions()), distinctUntilChanged((prev, curr) => prev.width === curr.width && prev.height === curr.height))
263
- .subscribe((dims) => {
264
- this.ngZone.run(() => {
265
- this._dimensions.set(dims);
266
- });
267
- });
268
- });
269
- }
270
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: WindowDimensionsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
271
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: WindowDimensionsService, providedIn: 'root' });
272
- }
273
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: WindowDimensionsService, decorators: [{
274
- type: Injectable,
275
- args: [{
276
- providedIn: 'root',
277
- }]
278
- }], ctorParameters: () => [] });
279
-
280
303
  class ThemingService {
281
304
  platformId = inject(PLATFORM_ID);
282
305
  isBrowser = isPlatformBrowser(this.platformId);
@@ -285,6 +308,8 @@ class ThemingService {
285
308
  systemTheme = this._systemTheme.asReadonly();
286
309
  applicationTheme = this._applicationTheme.asReadonly();
287
310
  activeTheme = computed(() => this.applicationTheme() ?? this.systemTheme(), ...(ngDevMode ? [{ debugName: "activeTheme" }] : []));
311
+ systemTheme$ = toObservable(this._systemTheme);
312
+ applicationTheme$ = toObservable(this._applicationTheme);
288
313
  mediaQueryList;
289
314
  mediaQueryListener;
290
315
  constructor() {
@@ -300,11 +325,18 @@ class ThemingService {
300
325
  setApplicationTheme(theme) {
301
326
  this._applicationTheme.set(theme);
302
327
  }
328
+ /**
329
+ * Returns an observable of the system theme.
330
+ * Safe to call anywhere because the observable is pre-created in the constructor context.
331
+ */
303
332
  getSystemTheme$() {
304
- return toObservable(this._systemTheme);
333
+ return this.systemTheme$;
305
334
  }
335
+ /**
336
+ * Returns an observable of the application theme.
337
+ */
306
338
  getApplicationTheme$() {
307
- return toObservable(this._applicationTheme);
339
+ return this.applicationTheme$;
308
340
  }
309
341
  detectInitialSystemTheme() {
310
342
  if (!this.isBrowser)
@@ -328,34 +360,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
328
360
  }]
329
361
  }], ctorParameters: () => [] });
330
362
 
331
- var DesktopOS;
332
- (function (DesktopOS) {
333
- DesktopOS["Linux"] = "linux";
334
- DesktopOS["MacOS"] = "mac_os";
335
- DesktopOS["Unix"] = "unix";
336
- DesktopOS["Unknown"] = "unknown";
337
- DesktopOS["Windows"] = "windows";
338
- })(DesktopOS || (DesktopOS = {}));
339
-
340
- var MobileOS;
341
- (function (MobileOS) {
342
- MobileOS["Android"] = "android";
343
- MobileOS["iOS"] = "ios";
344
- MobileOS["Unknown"] = "unknown";
345
- MobileOS["WindowsPhone"] = "Windows Phone";
346
- })(MobileOS || (MobileOS = {}));
347
-
348
- const BREAKPOINTS = {
349
- xs: 360,
350
- sm: 640,
351
- md: 768,
352
- lg: 1024,
353
- xl: 1280,
354
- '2xl': 1536,
355
- '3xl': 1920,
356
- '4xl': 2560,
357
- };
358
-
359
363
  const SCROLL_LOCK_INSTANCE_IDENTIFIER = 'scroll_lock_instance_';
360
364
 
361
365
  function uuidv4() {
@@ -1 +1 @@
1
- {"version":3,"file":"filip.mazev-blocks-core.mjs","sources":["../../../projects/blocks-core/src/lib/services/device-type.service.ts","../../../projects/blocks-core/src/lib/services/scroll-lock.service.ts","../../../projects/blocks-core/src/lib/services/window-dimension.service.ts","../../../projects/blocks-core/src/lib/services/theming.service.ts","../../../projects/blocks-core/src/lib/enums/desktop-os.enum.ts","../../../projects/blocks-core/src/lib/enums/mobile-os.enum.ts","../../../projects/blocks-core/src/lib/constants/window-dimension.constants.ts","../../../projects/blocks-core/src/lib/constants/scroll-lock.constants.ts","../../../projects/blocks-core/src/lib/utils/uui4.ts","../../../projects/blocks-core/src/public-api.ts","../../../projects/blocks-core/src/filip.mazev-blocks-core.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { DesktopOS } from '@core/enums/desktop-os.enum';\nimport { MobileOS } from '@core/enums/mobile-os.enum';\nimport { DeviceState } from '@core/interfaces/device-state.interface';\nimport { DeviceOS, DeviceOrientationType } from '@core/types/device.types';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class DeviceTypeService {\n private userAgent: string = navigator.userAgent || navigator.vendor || (window as any).opera || undefined;\n private isDesktopDevice: boolean = !this.isMobileDevice() && !this.isTabletDevice();\n\n private supportedScreenOrientation = (screen?.orientation || {}).type ?? (screen as any).mozOrientation ?? (screen as any).msOrientation;\n private safariScreenOrientation: DeviceOrientationType = !screen?.orientation && matchMedia('(orientation: portrait)').matches ? 'portrait-primary' : 'landscape-primary';\n private initialScreenOrientation: DeviceOrientationType = this.supportedScreenOrientation ?? this.safariScreenOrientation ?? 'portrait-primary';\n private screenOrientation: DeviceOrientationType = this.initialScreenOrientation;\n \n constructor() {\n if (screen.orientation) {\n screen.orientation.addEventListener(\n 'change',\n (ev: Event) => (this.screenOrientation = (ev.target ?? ({} as any)).type as OrientationType)\n );\n }\n }\n\n private isMobileDevice(): boolean {\n const regexs = [/(Android)(.+)(Mobile)/i, /BlackBerry/i, /iPhone|iPod/i, /Opera Mini/i, /IEMobile/i];\n return regexs.some(b => this.userAgent.match(b) !== null);\n }\n\n private isTabletDevice(): boolean {\n const regex = /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/;\n return regex.test(this.userAgent.toLowerCase());\n }\n\n public isLandscapeOrientation(): boolean {\n return ['landscape-primary', 'landscape-secondary'].includes(this.screenOrientation);\n }\n\n public isPortraitOrientation(): boolean {\n return ['portrait-primary', 'portrait-secondary'].includes(this.screenOrientation);\n }\n\n private getMobileOS(): MobileOS | undefined {\n if (this.isMobileDevice()) {\n if (/windows phone/i.test(this.userAgent)) return MobileOS.WindowsPhone;\n else if (/android/i.test(this.userAgent)) return MobileOS.Android;\n else if (/iPad|iPhone|iPod/.test(this.userAgent) && !(window as any).MSStream) return MobileOS.iOS;\n\n return MobileOS.Unknown;\n } else return undefined;\n }\n\n private getDesktopOS(): DesktopOS | undefined {\n if (this.isDesktopDevice) {\n if (this.userAgent.indexOf('Win') !== -1) return DesktopOS.Windows;\n else if (this.userAgent.indexOf('Mac') !== -1) return DesktopOS.MacOS;\n else if (this.userAgent.indexOf('X11') !== -1) return DesktopOS.Unix;\n else if (this.userAgent.indexOf('Linux') !== -1) return DesktopOS.Linux;\n\n return DesktopOS.Unknown;\n } else return undefined;\n }\n\n private getDeviceOS(): DeviceOS | undefined {\n return this.getMobileOS() ?? this.getDesktopOS();\n }\n\n public getDeviceState(): DeviceState {\n const isDesktop = this.isDesktopDevice;\n const isMobile = this.isMobileDevice();\n const isTablet = this.isTabletDevice();\n const mobileOS: MobileOS | undefined = this.getMobileOS();\n const isAndroidDevice = this.getDeviceOS() === MobileOS.Android;\n const isAppleDevice = this.getDeviceOS() === MobileOS.iOS || this.getDeviceOS() === DesktopOS.MacOS;\n const isUnknownMobileDevice = this.getDeviceOS() === MobileOS.Unknown;\n const desktopOS: DesktopOS | undefined = this.getDesktopOS();\n const isWindowsDesktop = this.getDeviceOS() === DesktopOS.Windows;\n const isLinuxOrUnixDesktop = this.getDeviceOS() === DesktopOS.Linux || this.getDeviceOS() === DesktopOS.Unix;\n\n return {\n isDesktop,\n desktopOS,\n isWindowsDesktop,\n isLinuxOrUnixDesktop,\n isMobile,\n mobileOS,\n isAndroidDevice,\n isAppleDevice,\n isUnknownMobileDevice,\n isTablet,\n isLandscapeOrientation: () => this.isLandscapeOrientation(),\n isPortraitOrientation: () => this.isPortraitOrientation()\n };\n }\n}\n","import { Injectable, OnDestroy, inject, signal, computed } from '@angular/core';\nimport { DeviceTypeService } from '@core/services/device-type.service';\nimport { WindowDimensionsService } from '@core/services/window-dimension.service';\nimport { IScrollLockConfig } from '@core/interfaces/scroll-lock-config.interface';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ScrollLockService implements OnDestroy {\n private deviceTypeService = inject(DeviceTypeService);\n private windowDimensionsService = inject(WindowDimensionsService);\n\n private activeLocks = new Map<string, IScrollLockConfig>();\n\n private _isScrollDisabled = signal<boolean>(false);\n public readonly isScrollDisabled = this._isScrollDisabled.asReadonly();\n\n private previousBodyPadding: string | null = null;\n\n private activeConfig = computed(() => {\n if (this.activeLocks.size === 0) return null;\n const keys = Array.from(this.activeLocks.keys());\n const lastKey = keys[keys.length - 1];\n return this.activeLocks.get(lastKey) ?? null;\n });\n\n private windowDimensions = this.windowDimensionsService.dimensions;\n\n private boundHandleTouchMove = this.handleTouchMove.bind(this);\n private boundPreventDefault = this.preventDefault.bind(this);\n\n constructor() { }\n\n public ngOnDestroy(): void {\n this.activeLocks.clear();\n this.updateStateAndCleanup();\n }\n\n public disableScroll(usageId: string, config: IScrollLockConfig): void {\n const wasAlreadyDisabled = this._isScrollDisabled();\n\n this.activeLocks.set(usageId, config);\n this._isScrollDisabled.set(true);\n\n if (wasAlreadyDisabled) {\n return;\n }\n\n const documentWidth = document.documentElement.clientWidth;\n const windowWidth = window.innerWidth;\n const scrollBarWidth = windowWidth - documentWidth;\n\n if (scrollBarWidth > 0) {\n this.previousBodyPadding = document.body.style.paddingRight;\n\n const computedBodyPadding = parseInt(window.getComputedStyle(document.body).paddingRight, 10) || 0;\n const newPadding = computedBodyPadding + scrollBarWidth;\n\n document.body.style.setProperty('padding-right', `${newPadding}px`, 'important');\n }\n\n document.body.style.setProperty('overflow', 'hidden', 'important');\n\n if (config.handleTouchInput !== false) {\n document.body.style.setProperty('touch-action', 'none', 'important');\n }\n\n setTimeout(() => {\n if (!this._isScrollDisabled()) return;\n\n if (config.handleTouchInput === true) {\n document.body.addEventListener('touchmove', this.boundHandleTouchMove, { passive: false });\n }\n\n if (config.handleExtremeOverflow === true) {\n const options = { passive: false };\n window.addEventListener('wheel', this.boundPreventDefault, options);\n window.addEventListener('mousewheel', this.boundPreventDefault, options);\n window.addEventListener('scroll', this.boundPreventDefault, options);\n window.addEventListener('DOMMouseScroll', this.boundPreventDefault, options);\n }\n }, (config.animationDuration ?? 0) + 10);\n }\n\n public enableScroll(usageId: string, extreme_overflow?: boolean): void {\n if (!this.activeLocks.has(usageId)) {\n return;\n }\n\n this.activeLocks.delete(usageId);\n\n if (this.activeLocks.size > 0) {\n return;\n }\n\n this.updateStateAndCleanup(extreme_overflow);\n }\n\n private updateStateAndCleanup(extreme_overflow?: boolean): void {\n this._isScrollDisabled.set(false);\n\n document.body.style.removeProperty('overflow');\n\n if (this.previousBodyPadding !== null) {\n if (this.previousBodyPadding) {\n document.body.style.setProperty('padding-right', this.previousBodyPadding);\n } else {\n document.body.style.removeProperty('padding-right');\n }\n this.previousBodyPadding = null;\n }\n\n document.body.removeEventListener('touchmove', this.boundHandleTouchMove);\n document.body.style.removeProperty('touch-action');\n\n if (extreme_overflow !== false) {\n window.removeEventListener('wheel', this.boundPreventDefault);\n window.removeEventListener('mousewheel', this.boundPreventDefault);\n window.removeEventListener('scroll', this.boundPreventDefault);\n window.removeEventListener('DOMMouseScroll', this.boundPreventDefault);\n }\n }\n\n private handleTouchMove(event: Event): void {\n const targetNode = event.target as Node;\n const currentConfiguration = this.activeConfig();\n\n if (!this.isAllowedToScroll(targetNode) && (currentConfiguration === null || currentConfiguration?.handleTouchInput !== false)) {\n if (currentConfiguration === null || currentConfiguration?.mobileOnlyTouchPrevention !== true ||\n (currentConfiguration?.mobileOnlyTouchPrevention === true && ((!this.deviceTypeService.getDeviceState().isMobile || !this.deviceTypeService.getDeviceState().isTablet)\n && (this.windowDimensions().width < this.windowDimensionsService.breakpoints.sm)))) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n }\n\n private isAllowedToScroll(targetNode: Node): boolean {\n const currentConfiguration = this.activeConfig();\n\n if (!currentConfiguration?.allowTouchInputOn || currentConfiguration.allowTouchInputOn.length === 0) { return true; }\n\n if (currentConfiguration.allowTouchInputOn.length === undefined) {\n return (currentConfiguration.allowTouchInputOn as unknown as Element).contains(targetNode);\n }\n\n for (const element of currentConfiguration.allowTouchInputOn) {\n if (element.contains(targetNode)) {\n return true;\n }\n }\n\n return false;\n }\n\n private preventDefault(event: Event): void {\n event.preventDefault();\n event.stopPropagation();\n }\n}","import { Injectable, inject, NgZone, PLATFORM_ID, signal, computed } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { fromEvent } from 'rxjs';\nimport { debounceTime, distinctUntilChanged, map } from 'rxjs/operators';\nimport { BREAKPOINTS } from '@core/constants/window-dimension.constants';\nimport { WindowDimensions } from '@core/interfaces/window-dimensions.interface';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class WindowDimensionsService {\n private readonly ngZone = inject(NgZone);\n private readonly platformId = inject(PLATFORM_ID);\n private readonly isBrowser = isPlatformBrowser(this.platformId);\n\n private readonly _dimensions = signal<WindowDimensions>(this.getCurrentDimensions());\n\n public readonly dimensions = this._dimensions.asReadonly();\n\n public readonly isMobile = computed(() => this.dimensions().width < BREAKPOINTS.md);\n public readonly isTablet = computed(() => this.dimensions().width >= BREAKPOINTS.md && this.dimensions().width < BREAKPOINTS.lg);\n public readonly isDesktop = computed(() => this.dimensions().width >= BREAKPOINTS.lg);\n\n public readonly breakpoints = BREAKPOINTS;\n\n constructor() {\n this.initResizeListener();\n }\n\n private getCurrentDimensions(): WindowDimensions {\n if (!this.isBrowser) {\n return { width: 0, height: 0 };\n }\n return {\n width: window.innerWidth,\n height: window.innerHeight,\n };\n }\n\n private initResizeListener(): void {\n if (!this.isBrowser) return;\n\n this.ngZone.runOutsideAngular(() => {\n fromEvent(window, 'resize')\n .pipe(\n debounceTime(150),\n map(() => this.getCurrentDimensions()),\n distinctUntilChanged((prev, curr) => \n prev.width === curr.width && prev.height === curr.height\n )\n )\n .subscribe((dims) => {\n this.ngZone.run(() => {\n this._dimensions.set(dims);\n });\n });\n });\n }\n}","import { Injectable, OnDestroy, inject, signal, PLATFORM_ID, computed } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { DeviceTheme } from '@core/types/device.types';\nimport { toObservable } from '@angular/core/rxjs-interop';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ThemingService implements OnDestroy {\n private readonly platformId = inject(PLATFORM_ID);\n private readonly isBrowser = isPlatformBrowser(this.platformId);\n\n private readonly _systemTheme = signal<DeviceTheme>(this.detectInitialSystemTheme());\n\n private readonly _applicationTheme = signal<DeviceTheme | null>(null);\n\n public readonly systemTheme = this._systemTheme.asReadonly();\n public readonly applicationTheme = this._applicationTheme.asReadonly();\n\n public readonly activeTheme = computed(() => this.applicationTheme() ?? this.systemTheme());\n\n private mediaQueryList?: MediaQueryList;\n private mediaQueryListener?: (event: MediaQueryListEvent) => void;\n\n constructor() {\n if (this.isBrowser) {\n this.initSystemThemeListener();\n }\n }\n\n public ngOnDestroy(): void {\n if (this.mediaQueryList && this.mediaQueryListener) {\n this.mediaQueryList.removeEventListener('change', this.mediaQueryListener);\n }\n }\n\n public setApplicationTheme(theme: DeviceTheme): void {\n this._applicationTheme.set(theme);\n }\n\n public getSystemTheme$() {\n return toObservable(this._systemTheme);\n }\n\n public getApplicationTheme$() {\n return toObservable(this._applicationTheme);\n }\n\n private detectInitialSystemTheme(): DeviceTheme {\n if (!this.isBrowser) return 'light';\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n\n private initSystemThemeListener(): void {\n this.mediaQueryList = window.matchMedia('(prefers-color-scheme: dark)');\n\n this.mediaQueryListener = (event: MediaQueryListEvent) => {\n this._systemTheme.set(event.matches ? 'dark' : 'light');\n };\n\n this.mediaQueryList.addEventListener('change', this.mediaQueryListener);\n }\n}","export enum DesktopOS {\n Linux = 'linux',\n MacOS = 'mac_os',\n Unix = 'unix',\n Unknown = 'unknown',\n Windows = 'windows'\n}","export enum MobileOS {\n Android = 'android',\n iOS = 'ios',\n Unknown = 'unknown',\n WindowsPhone = 'Windows Phone'\n}","export const BREAKPOINTS = {\n xs: 360,\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n '2xl': 1536,\n '3xl': 1920,\n '4xl': 2560,\n} as const;","export const SCROLL_LOCK_INSTANCE_IDENTIFIER = 'scroll_lock_instance_';","export function uuidv4() {\n return \"10000000-1000-4000-8000-100000000000\".replace(/[018]/g, (c) => (+c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (+c / 4)))).toString(16));\n}","/*\n * Public API Surface of blocks-core\n */\n\nexport * from './lib/services/device-type.service';\nexport * from './lib/services/scroll-lock.service';\nexport * from './lib/services/window-dimension.service';\nexport * from './lib/services/theming.service';\n\nexport * from './lib/enums/desktop-os.enum';\nexport * from './lib/enums/mobile-os.enum';\n\nexport * from './lib/interfaces/device-state.interface';\nexport * from './lib/interfaces/scroll-lock-config.interface';\nexport * from './lib/interfaces/window-dimensions.interface';\n\nexport * from './lib/constants/window-dimension.constants';\nexport * from './lib/constants/scroll-lock.constants';\n\nexport * from './lib/types/device.types';\n\nexport * from './lib/utils/uui4';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["MobileOS","DesktopOS","DeviceTypeService","WindowDimensionsService","BREAKPOINT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AAZ,CAAA,UAAY,QAAQ,EAAA;AAChB,IAAA,QAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,QAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,QAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,QAAA,CAAA,cAAA,CAAA,GAAA,eAA8B;AAClC,CAAC,EALW,QAAQ,KAAR,QAAQ,GAAA,EAAA,CAAA,CAAA;;ACAb,MAAM,WAAW,GAAG;AACzB,IAAA,EAAE,EAAE,GAAG;AACP,IAAA,EAAE,EAAE,GAAG;AACP,IAAA,EAAE,EAAE,GAAG;AACP,IAAA,EAAE,EAAE,IAAI;AACR,IAAA,EAAE,EAAE,IAAI;AACR,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,KAAK,EAAE,IAAI;;;ACRN,MAAM,+BAA+B,GAAG;;SCA/B,MAAM,GAAA;IAClB,OAAO,sCAAsC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;AACjK;;ACFA;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"filip.mazev-blocks-core.mjs","sources":["../../../projects/blocks-core/src/lib/enums/desktop-os.enum.ts","../../../projects/blocks-core/src/lib/enums/mobile-os.enum.ts","../../../projects/blocks-core/src/lib/services/device-type.service.ts","../../../projects/blocks-core/src/lib/constants/window-dimension.constants.ts","../../../projects/blocks-core/src/lib/services/window-dimension.service.ts","../../../projects/blocks-core/src/lib/services/scroll-lock.service.ts","../../../projects/blocks-core/src/lib/services/theming.service.ts","../../../projects/blocks-core/src/lib/constants/scroll-lock.constants.ts","../../../projects/blocks-core/src/lib/helpers/uui4.ts","../../../projects/blocks-core/src/public-api.ts","../../../projects/blocks-core/src/filip.mazev-blocks-core.ts"],"sourcesContent":["export enum DesktopOS {\n Linux = 'linux',\n MacOS = 'mac_os',\n Unix = 'unix',\n Unknown = 'unknown',\n Windows = 'windows'\n}","export enum MobileOS {\n Android = 'android',\n iOS = 'ios',\n Unknown = 'unknown',\n WindowsPhone = 'Windows Phone'\n}","import { Injectable } from '@angular/core';\nimport { DesktopOS } from '../enums/desktop-os.enum';\nimport { MobileOS } from '../enums/mobile-os.enum';\nimport { DeviceState } from '../interfaces/device-state.interface';\nimport { DeviceOS, DeviceOrientationType } from '../types/device.types';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class DeviceTypeService {\n private userAgent: string = navigator.userAgent || navigator.vendor || (window as any).opera || undefined;\n private isDesktopDevice: boolean = !this.isMobileDevice() && !this.isTabletDevice();\n\n private supportedScreenOrientation = (screen?.orientation || {}).type ?? (screen as any).mozOrientation ?? (screen as any).msOrientation;\n private safariScreenOrientation: DeviceOrientationType = !screen?.orientation && matchMedia('(orientation: portrait)').matches ? 'portrait-primary' : 'landscape-primary';\n private initialScreenOrientation: DeviceOrientationType = this.supportedScreenOrientation ?? this.safariScreenOrientation ?? 'portrait-primary';\n private screenOrientation: DeviceOrientationType = this.initialScreenOrientation;\n \n constructor() {\n if (screen.orientation) {\n screen.orientation.addEventListener(\n 'change',\n (ev: Event) => (this.screenOrientation = (ev.target ?? ({} as any)).type as OrientationType)\n );\n }\n }\n\n private isMobileDevice(): boolean {\n const regexs = [/(Android)(.+)(Mobile)/i, /BlackBerry/i, /iPhone|iPod/i, /Opera Mini/i, /IEMobile/i];\n return regexs.some(b => this.userAgent.match(b) !== null);\n }\n\n private isTabletDevice(): boolean {\n const regex = /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/;\n return regex.test(this.userAgent.toLowerCase());\n }\n\n public isLandscapeOrientation(): boolean {\n return ['landscape-primary', 'landscape-secondary'].includes(this.screenOrientation);\n }\n\n public isPortraitOrientation(): boolean {\n return ['portrait-primary', 'portrait-secondary'].includes(this.screenOrientation);\n }\n\n private getMobileOS(): MobileOS | undefined {\n if (this.isMobileDevice()) {\n if (/windows phone/i.test(this.userAgent)) return MobileOS.WindowsPhone;\n else if (/android/i.test(this.userAgent)) return MobileOS.Android;\n else if (/iPad|iPhone|iPod/.test(this.userAgent) && !(window as any).MSStream) return MobileOS.iOS;\n\n return MobileOS.Unknown;\n } else return undefined;\n }\n\n private getDesktopOS(): DesktopOS | undefined {\n if (this.isDesktopDevice) {\n if (this.userAgent.indexOf('Win') !== -1) return DesktopOS.Windows;\n else if (this.userAgent.indexOf('Mac') !== -1) return DesktopOS.MacOS;\n else if (this.userAgent.indexOf('X11') !== -1) return DesktopOS.Unix;\n else if (this.userAgent.indexOf('Linux') !== -1) return DesktopOS.Linux;\n\n return DesktopOS.Unknown;\n } else return undefined;\n }\n\n private getDeviceOS(): DeviceOS | undefined {\n return this.getMobileOS() ?? this.getDesktopOS();\n }\n\n public getDeviceState(): DeviceState {\n const isDesktop = this.isDesktopDevice;\n const isMobile = this.isMobileDevice();\n const isTablet = this.isTabletDevice();\n const mobileOS: MobileOS | undefined = this.getMobileOS();\n const isAndroidDevice = this.getDeviceOS() === MobileOS.Android;\n const isAppleDevice = this.getDeviceOS() === MobileOS.iOS || this.getDeviceOS() === DesktopOS.MacOS;\n const isUnknownMobileDevice = this.getDeviceOS() === MobileOS.Unknown;\n const desktopOS: DesktopOS | undefined = this.getDesktopOS();\n const isWindowsDesktop = this.getDeviceOS() === DesktopOS.Windows;\n const isLinuxOrUnixDesktop = this.getDeviceOS() === DesktopOS.Linux || this.getDeviceOS() === DesktopOS.Unix;\n\n return {\n isDesktop,\n desktopOS,\n isWindowsDesktop,\n isLinuxOrUnixDesktop,\n isMobile,\n mobileOS,\n isAndroidDevice,\n isAppleDevice,\n isUnknownMobileDevice,\n isTablet,\n isLandscapeOrientation: () => this.isLandscapeOrientation(),\n isPortraitOrientation: () => this.isPortraitOrientation()\n };\n }\n}\n","export const BREAKPOINTS = {\n xs: 360,\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n '2xl': 1536,\n '3xl': 1920,\n '4xl': 2560,\n} as const;","import { Injectable, inject, NgZone, PLATFORM_ID, signal, computed } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { fromEvent } from 'rxjs';\nimport { debounceTime, distinctUntilChanged, map } from 'rxjs/operators';\nimport { BREAKPOINTS } from '../constants/window-dimension.constants';\nimport { WindowDimensions } from '../interfaces/window-dimensions.interface';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class WindowDimensionsService {\n private readonly ngZone = inject(NgZone);\n private readonly platformId = inject(PLATFORM_ID);\n private readonly isBrowser = isPlatformBrowser(this.platformId);\n\n private readonly _dimensions = signal<WindowDimensions>(this.getCurrentDimensions());\n\n public readonly dimensions = this._dimensions.asReadonly();\n\n public readonly isMobile = computed(() => this.dimensions().width < BREAKPOINTS.md);\n public readonly isTablet = computed(() => this.dimensions().width >= BREAKPOINTS.md && this.dimensions().width < BREAKPOINTS.lg);\n public readonly isDesktop = computed(() => this.dimensions().width >= BREAKPOINTS.lg);\n\n public readonly breakpoints = BREAKPOINTS;\n\n constructor() {\n this.initResizeListener();\n }\n\n private getCurrentDimensions(): WindowDimensions {\n if (!this.isBrowser) {\n return { width: 0, height: 0 };\n }\n return {\n width: window.innerWidth,\n height: window.innerHeight,\n };\n }\n\n private initResizeListener(): void {\n if (!this.isBrowser) return;\n\n this.ngZone.runOutsideAngular(() => {\n fromEvent(window, 'resize')\n .pipe(\n debounceTime(150),\n map(() => this.getCurrentDimensions()),\n distinctUntilChanged((prev, curr) => \n prev.width === curr.width && prev.height === curr.height\n )\n )\n .subscribe((dims) => {\n this.ngZone.run(() => {\n this._dimensions.set(dims);\n });\n });\n });\n }\n}","import { Injectable, OnDestroy, inject, signal, computed } from '@angular/core';\nimport { DeviceTypeService } from './device-type.service';\nimport { WindowDimensionsService } from './window-dimension.service';\nimport { IScrollLockConfig } from '../interfaces/scroll-lock-config.interface';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ScrollLockService implements OnDestroy {\n private deviceTypeService = inject(DeviceTypeService);\n private windowDimensionsService = inject(WindowDimensionsService);\n\n private activeLocks = new Map<string, IScrollLockConfig>();\n\n private _isScrollDisabled = signal<boolean>(false);\n public readonly isScrollDisabled = this._isScrollDisabled.asReadonly();\n\n private previousBodyPadding: string | null = null;\n\n private activeConfig = computed(() => {\n if (this.activeLocks.size === 0) return null;\n const keys = Array.from(this.activeLocks.keys());\n const lastKey = keys[keys.length - 1];\n return this.activeLocks.get(lastKey) ?? null;\n });\n\n private windowDimensions = this.windowDimensionsService.dimensions;\n\n private boundHandleTouchMove = this.handleTouchMove.bind(this);\n private boundPreventDefault = this.preventDefault.bind(this);\n\n constructor() { }\n\n public ngOnDestroy(): void {\n this.activeLocks.clear();\n this.updateStateAndCleanup();\n }\n\n public disableScroll(usageId: string, config: IScrollLockConfig): void {\n const wasAlreadyDisabled = this._isScrollDisabled();\n\n this.activeLocks.set(usageId, config);\n this._isScrollDisabled.set(true);\n\n if (wasAlreadyDisabled) {\n return;\n }\n\n const documentWidth = document.documentElement.clientWidth;\n const windowWidth = window.innerWidth;\n const scrollBarWidth = windowWidth - documentWidth;\n\n if (scrollBarWidth > 0) {\n this.previousBodyPadding = document.body.style.paddingRight;\n\n const computedBodyPadding = parseInt(window.getComputedStyle(document.body).paddingRight, 10) || 0;\n const newPadding = computedBodyPadding + scrollBarWidth;\n\n document.body.style.setProperty('padding-right', `${newPadding}px`, 'important');\n }\n\n document.body.style.setProperty('overflow', 'hidden', 'important');\n\n if (config.handleTouchInput !== false) {\n document.body.style.setProperty('touch-action', 'none', 'important');\n }\n\n setTimeout(() => {\n if (!this._isScrollDisabled()) return;\n\n if (config.handleTouchInput === true) {\n document.body.addEventListener('touchmove', this.boundHandleTouchMove, { passive: false });\n }\n\n if (config.handleExtremeOverflow === true) {\n const options = { passive: false };\n window.addEventListener('wheel', this.boundPreventDefault, options);\n window.addEventListener('mousewheel', this.boundPreventDefault, options);\n window.addEventListener('scroll', this.boundPreventDefault, options);\n window.addEventListener('DOMMouseScroll', this.boundPreventDefault, options);\n }\n }, (config.animationDuration ?? 0) + 10);\n }\n\n public enableScroll(usageId: string, extreme_overflow?: boolean): void {\n if (!this.activeLocks.has(usageId)) {\n return;\n }\n\n this.activeLocks.delete(usageId);\n\n if (this.activeLocks.size > 0) {\n return;\n }\n\n this.updateStateAndCleanup(extreme_overflow);\n }\n\n private updateStateAndCleanup(extreme_overflow?: boolean): void {\n this._isScrollDisabled.set(false);\n\n document.body.style.removeProperty('overflow');\n\n if (this.previousBodyPadding !== null) {\n if (this.previousBodyPadding) {\n document.body.style.setProperty('padding-right', this.previousBodyPadding);\n } else {\n document.body.style.removeProperty('padding-right');\n }\n this.previousBodyPadding = null;\n }\n\n document.body.removeEventListener('touchmove', this.boundHandleTouchMove);\n document.body.style.removeProperty('touch-action');\n\n if (extreme_overflow !== false) {\n window.removeEventListener('wheel', this.boundPreventDefault);\n window.removeEventListener('mousewheel', this.boundPreventDefault);\n window.removeEventListener('scroll', this.boundPreventDefault);\n window.removeEventListener('DOMMouseScroll', this.boundPreventDefault);\n }\n }\n\n private handleTouchMove(event: Event): void {\n const targetNode = event.target as Node;\n const currentConfiguration = this.activeConfig();\n\n if (!this.isAllowedToScroll(targetNode) && (currentConfiguration === null || currentConfiguration?.handleTouchInput !== false)) {\n if (currentConfiguration === null || currentConfiguration?.mobileOnlyTouchPrevention !== true ||\n (currentConfiguration?.mobileOnlyTouchPrevention === true && ((!this.deviceTypeService.getDeviceState().isMobile || !this.deviceTypeService.getDeviceState().isTablet)\n && (this.windowDimensions().width < this.windowDimensionsService.breakpoints.sm)))) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n }\n\n private isAllowedToScroll(targetNode: Node): boolean {\n const currentConfiguration = this.activeConfig();\n\n if (!currentConfiguration?.allowTouchInputOn || currentConfiguration.allowTouchInputOn.length === 0) { return true; }\n\n if (currentConfiguration.allowTouchInputOn.length === undefined) {\n return (currentConfiguration.allowTouchInputOn as unknown as Element).contains(targetNode);\n }\n\n for (const element of currentConfiguration.allowTouchInputOn) {\n if (element.contains(targetNode)) {\n return true;\n }\n }\n\n return false;\n }\n\n private preventDefault(event: Event): void {\n event.preventDefault();\n event.stopPropagation();\n }\n}","import { Injectable, OnDestroy, inject, signal, PLATFORM_ID, computed } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { DeviceTheme } from '../types/device.types';\nimport { toObservable } from '@angular/core/rxjs-interop';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ThemingService implements OnDestroy {\n private readonly platformId = inject(PLATFORM_ID);\n private readonly isBrowser = isPlatformBrowser(this.platformId);\n\n private readonly _systemTheme = signal<DeviceTheme>(this.detectInitialSystemTheme());\n private readonly _applicationTheme = signal<DeviceTheme | null>(null);\n\n public readonly systemTheme = this._systemTheme.asReadonly();\n public readonly applicationTheme = this._applicationTheme.asReadonly();\n public readonly activeTheme = computed(() => this.applicationTheme() ?? this.systemTheme());\n\n private readonly systemTheme$ = toObservable(this._systemTheme);\n private readonly applicationTheme$ = toObservable(this._applicationTheme);\n\n private mediaQueryList?: MediaQueryList;\n private mediaQueryListener?: (event: MediaQueryListEvent) => void;\n\n constructor() {\n if (this.isBrowser) {\n this.initSystemThemeListener();\n }\n }\n\n public ngOnDestroy(): void {\n if (this.mediaQueryList && this.mediaQueryListener) {\n this.mediaQueryList.removeEventListener('change', this.mediaQueryListener);\n }\n }\n\n public setApplicationTheme(theme: DeviceTheme): void {\n this._applicationTheme.set(theme);\n }\n\n /**\n * Returns an observable of the system theme. \n * Safe to call anywhere because the observable is pre-created in the constructor context.\n */\n public getSystemTheme$() {\n return this.systemTheme$;\n }\n\n /**\n * Returns an observable of the application theme.\n */\n public getApplicationTheme$() {\n return this.applicationTheme$;\n }\n\n private detectInitialSystemTheme(): DeviceTheme {\n if (!this.isBrowser) return 'light';\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n\n private initSystemThemeListener(): void {\n this.mediaQueryList = window.matchMedia('(prefers-color-scheme: dark)');\n\n this.mediaQueryListener = (event: MediaQueryListEvent) => {\n this._systemTheme.set(event.matches ? 'dark' : 'light');\n };\n\n this.mediaQueryList.addEventListener('change', this.mediaQueryListener);\n }\n}","export const SCROLL_LOCK_INSTANCE_IDENTIFIER = 'scroll_lock_instance_';","export function uuidv4() {\n return \"10000000-1000-4000-8000-100000000000\".replace(/[018]/g, (c) => (+c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (+c / 4)))).toString(16));\n}","/*\n * Public API Surface of blocks-core\n */\n\nexport * from './lib/services/device-type.service';\nexport * from './lib/services/scroll-lock.service';\nexport * from './lib/services/window-dimension.service';\nexport * from './lib/services/theming.service';\n\nexport * from './lib/enums/desktop-os.enum';\nexport * from './lib/enums/mobile-os.enum';\n\nexport * from './lib/interfaces/device-state.interface';\nexport * from './lib/interfaces/scroll-lock-config.interface';\nexport * from './lib/interfaces/window-dimensions.interface';\n\nexport * from './lib/constants/window-dimension.constants';\nexport * from './lib/constants/scroll-lock.constants';\n\nexport * from './lib/types/device.types';\n\nexport * from './lib/helpers/uui4';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;IAAY;AAAZ,CAAA,UAAY,SAAS,EAAA;AACjB,IAAA,SAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,SAAA,CAAA,OAAA,CAAA,GAAA,QAAgB;AAChB,IAAA,SAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACvB,CAAC,EANW,SAAS,K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AA;AAAd,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cAFb,MAAM,EAAA,CAAA;;2FAEP,cAAc,EAAA,UAAA,EAAA,CAAA;kBAH1B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE;AACb,iBAAA;;;ACPM,MAAM,+BAA+B,GAAG;;SCA/B,MAAM,GAAA;IAClB,OAAO,sCAAsC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;AACjK;;ACFA;;AAEG;;ACFH;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@filip.mazev/blocks-core",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  "./mixins": "./lib/styles/_mixins.scss",
@@ -1,4 +1,4 @@
1
- @use 'sass:map';
1
+ @use "sass:map";
2
2
  @use 'variables' as *;
3
3
 
4
4
  @mixin respond-up($size) {
@@ -1,12 +1,36 @@
1
- import { DeviceState as DeviceState$1 } from '@core/interfaces/device-state.interface';
2
1
  import * as _angular_core from '@angular/core';
3
2
  import { OnDestroy } from '@angular/core';
4
- import { IScrollLockConfig as IScrollLockConfig$1 } from '@core/interfaces/scroll-lock-config.interface';
5
- import { WindowDimensions as WindowDimensions$1 } from '@core/interfaces/window-dimensions.interface';
6
3
  import * as rxjs from 'rxjs';
7
- import { DeviceTheme as DeviceTheme$1 } from '@core/types/device.types';
8
- import { DesktopOS as DesktopOS$1 } from '@core/enums/desktop-os.enum';
9
- import { MobileOS as MobileOS$1 } from '@core/enums/mobile-os.enum';
4
+
5
+ declare enum DesktopOS {
6
+ Linux = "linux",
7
+ MacOS = "mac_os",
8
+ Unix = "unix",
9
+ Unknown = "unknown",
10
+ Windows = "windows"
11
+ }
12
+
13
+ declare enum MobileOS {
14
+ Android = "android",
15
+ iOS = "ios",
16
+ Unknown = "unknown",
17
+ WindowsPhone = "Windows Phone"
18
+ }
19
+
20
+ interface DeviceState {
21
+ isDesktop: boolean;
22
+ desktopOS: DesktopOS | undefined;
23
+ isWindowsDesktop: boolean;
24
+ isLinuxOrUnixDesktop: boolean;
25
+ isMobile: boolean;
26
+ mobileOS: MobileOS | undefined;
27
+ isAndroidDevice: boolean;
28
+ isAppleDevice: boolean;
29
+ isUnknownMobileDevice: boolean;
30
+ isTablet: boolean;
31
+ isLandscapeOrientation: () => boolean;
32
+ isPortraitOrientation: () => boolean;
33
+ }
10
34
 
11
35
  declare class DeviceTypeService {
12
36
  private userAgent;
@@ -23,11 +47,19 @@ declare class DeviceTypeService {
23
47
  private getMobileOS;
24
48
  private getDesktopOS;
25
49
  private getDeviceOS;
26
- getDeviceState(): DeviceState$1;
50
+ getDeviceState(): DeviceState;
27
51
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DeviceTypeService, never>;
28
52
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<DeviceTypeService>;
29
53
  }
30
54
 
55
+ interface IScrollLockConfig {
56
+ allowTouchInputOn?: Element[];
57
+ handleExtremeOverflow?: boolean;
58
+ animationDuration?: number;
59
+ handleTouchInput?: boolean;
60
+ mobileOnlyTouchPrevention?: boolean;
61
+ }
62
+
31
63
  declare class ScrollLockService implements OnDestroy {
32
64
  private deviceTypeService;
33
65
  private windowDimensionsService;
@@ -41,7 +73,7 @@ declare class ScrollLockService implements OnDestroy {
41
73
  private boundPreventDefault;
42
74
  constructor();
43
75
  ngOnDestroy(): void;
44
- disableScroll(usageId: string, config: IScrollLockConfig$1): void;
76
+ disableScroll(usageId: string, config: IScrollLockConfig): void;
45
77
  enableScroll(usageId: string, extreme_overflow?: boolean): void;
46
78
  private updateStateAndCleanup;
47
79
  private handleTouchMove;
@@ -51,12 +83,17 @@ declare class ScrollLockService implements OnDestroy {
51
83
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<ScrollLockService>;
52
84
  }
53
85
 
86
+ interface WindowDimensions {
87
+ width: number;
88
+ height: number;
89
+ }
90
+
54
91
  declare class WindowDimensionsService {
55
92
  private readonly ngZone;
56
93
  private readonly platformId;
57
94
  private readonly isBrowser;
58
95
  private readonly _dimensions;
59
- readonly dimensions: _angular_core.Signal<WindowDimensions$1>;
96
+ readonly dimensions: _angular_core.Signal<WindowDimensions>;
60
97
  readonly isMobile: _angular_core.Signal<boolean>;
61
98
  readonly isTablet: _angular_core.Signal<boolean>;
62
99
  readonly isDesktop: _angular_core.Signal<boolean>;
@@ -77,70 +114,40 @@ declare class WindowDimensionsService {
77
114
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<WindowDimensionsService>;
78
115
  }
79
116
 
117
+ type DeviceTheme = "light" | "dark";
118
+ type DeviceOS = DesktopOS | MobileOS;
119
+ type DeviceOrientationType = 'portrait-primary' | 'landscape-primary' | 'portrait-secondary' | 'landscape-secondary';
120
+
80
121
  declare class ThemingService implements OnDestroy {
81
122
  private readonly platformId;
82
123
  private readonly isBrowser;
83
124
  private readonly _systemTheme;
84
125
  private readonly _applicationTheme;
85
- readonly systemTheme: _angular_core.Signal<DeviceTheme$1>;
86
- readonly applicationTheme: _angular_core.Signal<DeviceTheme$1 | null>;
87
- readonly activeTheme: _angular_core.Signal<DeviceTheme$1>;
126
+ readonly systemTheme: _angular_core.Signal<DeviceTheme>;
127
+ readonly applicationTheme: _angular_core.Signal<DeviceTheme | null>;
128
+ readonly activeTheme: _angular_core.Signal<DeviceTheme>;
129
+ private readonly systemTheme$;
130
+ private readonly applicationTheme$;
88
131
  private mediaQueryList?;
89
132
  private mediaQueryListener?;
90
133
  constructor();
91
134
  ngOnDestroy(): void;
92
- setApplicationTheme(theme: DeviceTheme$1): void;
93
- getSystemTheme$(): rxjs.Observable<DeviceTheme$1>;
94
- getApplicationTheme$(): rxjs.Observable<DeviceTheme$1 | null>;
135
+ setApplicationTheme(theme: DeviceTheme): void;
136
+ /**
137
+ * Returns an observable of the system theme.
138
+ * Safe to call anywhere because the observable is pre-created in the constructor context.
139
+ */
140
+ getSystemTheme$(): rxjs.Observable<DeviceTheme>;
141
+ /**
142
+ * Returns an observable of the application theme.
143
+ */
144
+ getApplicationTheme$(): rxjs.Observable<DeviceTheme | null>;
95
145
  private detectInitialSystemTheme;
96
146
  private initSystemThemeListener;
97
147
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ThemingService, never>;
98
148
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<ThemingService>;
99
149
  }
100
150
 
101
- declare enum DesktopOS {
102
- Linux = "linux",
103
- MacOS = "mac_os",
104
- Unix = "unix",
105
- Unknown = "unknown",
106
- Windows = "windows"
107
- }
108
-
109
- declare enum MobileOS {
110
- Android = "android",
111
- iOS = "ios",
112
- Unknown = "unknown",
113
- WindowsPhone = "Windows Phone"
114
- }
115
-
116
- interface DeviceState {
117
- isDesktop: boolean;
118
- desktopOS: DesktopOS$1 | undefined;
119
- isWindowsDesktop: boolean;
120
- isLinuxOrUnixDesktop: boolean;
121
- isMobile: boolean;
122
- mobileOS: MobileOS$1 | undefined;
123
- isAndroidDevice: boolean;
124
- isAppleDevice: boolean;
125
- isUnknownMobileDevice: boolean;
126
- isTablet: boolean;
127
- isLandscapeOrientation: () => boolean;
128
- isPortraitOrientation: () => boolean;
129
- }
130
-
131
- interface IScrollLockConfig {
132
- allowTouchInputOn?: Element[];
133
- handleExtremeOverflow?: boolean;
134
- animationDuration?: number;
135
- handleTouchInput?: boolean;
136
- mobileOnlyTouchPrevention?: boolean;
137
- }
138
-
139
- interface WindowDimensions {
140
- width: number;
141
- height: number;
142
- }
143
-
144
151
  declare const BREAKPOINTS: {
145
152
  readonly xs: 360;
146
153
  readonly sm: 640;
@@ -154,10 +161,6 @@ declare const BREAKPOINTS: {
154
161
 
155
162
  declare const SCROLL_LOCK_INSTANCE_IDENTIFIER = "scroll_lock_instance_";
156
163
 
157
- type DeviceTheme = "light" | "dark";
158
- type DeviceOS = DesktopOS$1 | MobileOS$1;
159
- type DeviceOrientationType = 'portrait-primary' | 'landscape-primary' | 'portrait-secondary' | 'landscape-secondary';
160
-
161
164
  declare function uuidv4(): string;
162
165
 
163
166
  export { BREAKPOINTS, DesktopOS, DeviceTypeService, MobileOS, SCROLL_LOCK_INSTANCE_IDENTIFIER, ScrollLockService, ThemingService, WindowDimensionsService, uuidv4 };