@filip.mazev/blocks-core 0.0.23 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -71,7 +71,7 @@ Bridges the gap between CSS media queries and TypeScript logic. It provides reac
|
|
|
71
71
|
|
|
72
72
|
```typescript
|
|
73
73
|
export class MyComponent {
|
|
74
|
-
protected windowDimensionsService = inject(WindowDimensionsService);
|
|
74
|
+
protected readonly windowDimensionsService = inject(WindowDimensionsService);
|
|
75
75
|
|
|
76
76
|
protected windowDimensions = this.windowDimensionsService.dimensions;
|
|
77
77
|
protected breakpoints = this.windowDimensionsService.breakpoints;
|
|
@@ -23,8 +23,8 @@ var MobileOS;
|
|
|
23
23
|
})(MobileOS || (MobileOS = {}));
|
|
24
24
|
|
|
25
25
|
class DeviceTypeService {
|
|
26
|
-
userAgent = navigator.userAgent || navigator.vendor || window?.opera || undefined;
|
|
27
26
|
isDesktopDevice = !this.isMobileDevice() && !this.isTabletDevice();
|
|
27
|
+
userAgent = navigator.userAgent || navigator.vendor || window?.opera || undefined;
|
|
28
28
|
supportedScreenOrientation = (screen?.orientation || {}).type ?? screen.mozOrientation ?? screen.msOrientation;
|
|
29
29
|
safariScreenOrientation = !screen?.orientation && matchMedia('(orientation: portrait)').matches ? 'portrait-primary' : 'landscape-primary';
|
|
30
30
|
initialScreenOrientation = this.supportedScreenOrientation ?? this.safariScreenOrientation ?? 'portrait-primary';
|
|
@@ -176,72 +176,79 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImpor
|
|
|
176
176
|
}], ctorParameters: () => [] });
|
|
177
177
|
|
|
178
178
|
class ScrollLockService {
|
|
179
|
-
|
|
180
|
-
isScrollDisabled = this._isScrollDisabled.asReadonly();
|
|
179
|
+
platformId = inject(PLATFORM_ID);
|
|
181
180
|
deviceTypeService = inject(DeviceTypeService);
|
|
182
181
|
windowDimensionsService = inject(WindowDimensionsService);
|
|
182
|
+
isBrowser = isPlatformBrowser(this.platformId);
|
|
183
183
|
activeLocks = new Map();
|
|
184
|
-
previousBodyPadding = null;
|
|
185
|
-
activeConfig = computed(() => {
|
|
186
|
-
if (this.activeLocks.size === 0)
|
|
187
|
-
return null;
|
|
188
|
-
const keys = Array.from(this.activeLocks.keys());
|
|
189
|
-
const lastKey = keys[keys.length - 1];
|
|
190
|
-
return this.activeLocks.get(lastKey) ?? null;
|
|
191
|
-
}, ...(ngDevMode ? [{ debugName: "activeConfig" }] : []));
|
|
192
|
-
windowDimensions = this.windowDimensionsService.dimensions;
|
|
193
184
|
boundHandleTouchMove = this.handleTouchMove.bind(this);
|
|
194
185
|
boundPreventDefault = this.preventDefault.bind(this);
|
|
186
|
+
_isScrollDisabled = signal(false, ...(ngDevMode ? [{ debugName: "_isScrollDisabled" }] : []));
|
|
187
|
+
isScrollDisabled = this._isScrollDisabled.asReadonly();
|
|
188
|
+
previousBodyPadding = null;
|
|
189
|
+
pendingListenerTimeout = null;
|
|
195
190
|
ngOnDestroy() {
|
|
196
|
-
this.
|
|
197
|
-
|
|
191
|
+
if (!this.isBrowser)
|
|
192
|
+
return;
|
|
193
|
+
this.clearPendingTimeout();
|
|
194
|
+
this.forceCleanupAll();
|
|
198
195
|
}
|
|
199
196
|
disableScroll(usageId, config) {
|
|
200
|
-
|
|
197
|
+
if (!this.isBrowser)
|
|
198
|
+
return;
|
|
199
|
+
const wasDisabled = this._isScrollDisabled();
|
|
201
200
|
this.activeLocks.set(usageId, config);
|
|
202
201
|
this._isScrollDisabled.set(true);
|
|
203
|
-
if (
|
|
202
|
+
if (wasDisabled)
|
|
204
203
|
return;
|
|
205
|
-
}
|
|
206
204
|
const documentWidth = document.documentElement.clientWidth;
|
|
207
205
|
const windowWidth = window.innerWidth;
|
|
208
206
|
const scrollBarWidth = windowWidth - documentWidth;
|
|
209
207
|
if (scrollBarWidth > 0) {
|
|
210
208
|
this.previousBodyPadding = document.body.style.paddingRight;
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
document.body.style.setProperty('padding-right', `${newPadding}px`, 'important');
|
|
209
|
+
const computedPadding = parseInt(getComputedStyle(document.body).paddingRight, 10) || 0;
|
|
210
|
+
document.body.style.setProperty('padding-right', `${computedPadding + scrollBarWidth}px`, 'important');
|
|
214
211
|
}
|
|
215
212
|
document.body.style.setProperty('overflow', 'hidden', 'important');
|
|
216
213
|
if (config.handleTouchInput !== false) {
|
|
217
214
|
document.body.style.setProperty('touch-action', 'none', 'important');
|
|
218
215
|
}
|
|
219
|
-
|
|
216
|
+
this.clearPendingTimeout();
|
|
217
|
+
this.pendingListenerTimeout = window.setTimeout(() => {
|
|
220
218
|
if (!this._isScrollDisabled())
|
|
221
219
|
return;
|
|
222
220
|
if (config.handleTouchInput === true) {
|
|
223
221
|
document.body.addEventListener('touchmove', this.boundHandleTouchMove, { passive: false });
|
|
224
222
|
}
|
|
225
223
|
if (config.handleExtremeOverflow === true) {
|
|
226
|
-
const
|
|
227
|
-
window.addEventListener('wheel', this.boundPreventDefault,
|
|
228
|
-
window.addEventListener('mousewheel', this.boundPreventDefault,
|
|
229
|
-
window.addEventListener('scroll', this.boundPreventDefault,
|
|
230
|
-
window.addEventListener('DOMMouseScroll', this.boundPreventDefault,
|
|
224
|
+
const opt = { passive: false };
|
|
225
|
+
window.addEventListener('wheel', this.boundPreventDefault, opt);
|
|
226
|
+
window.addEventListener('mousewheel', this.boundPreventDefault, opt);
|
|
227
|
+
window.addEventListener('scroll', this.boundPreventDefault, opt);
|
|
228
|
+
window.addEventListener('DOMMouseScroll', this.boundPreventDefault, opt);
|
|
231
229
|
}
|
|
232
230
|
}, (config.animationDuration ?? 0) + 10);
|
|
233
231
|
}
|
|
234
|
-
enableScroll(usageId,
|
|
235
|
-
if (!this.
|
|
232
|
+
enableScroll(usageId, extremeOverflow) {
|
|
233
|
+
if (!this.isBrowser)
|
|
234
|
+
return;
|
|
235
|
+
if (!this.activeLocks.has(usageId))
|
|
236
236
|
return;
|
|
237
|
-
}
|
|
238
237
|
this.activeLocks.delete(usageId);
|
|
239
|
-
if (this.activeLocks.size > 0)
|
|
238
|
+
if (this.activeLocks.size > 0)
|
|
240
239
|
return;
|
|
241
|
-
|
|
242
|
-
|
|
240
|
+
this.updateStateAndCleanup(extremeOverflow);
|
|
241
|
+
}
|
|
242
|
+
getActiveConfig() {
|
|
243
|
+
if (this.activeLocks.size === 0)
|
|
244
|
+
return null;
|
|
245
|
+
const keys = Array.from(this.activeLocks.keys());
|
|
246
|
+
return this.activeLocks.get(keys[keys.length - 1]) ?? null;
|
|
243
247
|
}
|
|
244
|
-
updateStateAndCleanup(
|
|
248
|
+
updateStateAndCleanup(extremeOverflow) {
|
|
249
|
+
if (!this.isBrowser)
|
|
250
|
+
return;
|
|
251
|
+
this.clearPendingTimeout();
|
|
245
252
|
this._isScrollDisabled.set(false);
|
|
246
253
|
document.body.style.removeProperty('overflow');
|
|
247
254
|
if (this.previousBodyPadding !== null) {
|
|
@@ -255,39 +262,46 @@ class ScrollLockService {
|
|
|
255
262
|
}
|
|
256
263
|
document.body.removeEventListener('touchmove', this.boundHandleTouchMove);
|
|
257
264
|
document.body.style.removeProperty('touch-action');
|
|
258
|
-
if (
|
|
265
|
+
if (extremeOverflow !== false) {
|
|
259
266
|
window.removeEventListener('wheel', this.boundPreventDefault);
|
|
260
267
|
window.removeEventListener('mousewheel', this.boundPreventDefault);
|
|
261
268
|
window.removeEventListener('scroll', this.boundPreventDefault);
|
|
262
269
|
window.removeEventListener('DOMMouseScroll', this.boundPreventDefault);
|
|
263
270
|
}
|
|
264
271
|
}
|
|
272
|
+
forceCleanupAll() {
|
|
273
|
+
this.activeLocks.clear();
|
|
274
|
+
this.updateStateAndCleanup(true);
|
|
275
|
+
}
|
|
276
|
+
clearPendingTimeout() {
|
|
277
|
+
if (this.pendingListenerTimeout !== null) {
|
|
278
|
+
clearTimeout(this.pendingListenerTimeout);
|
|
279
|
+
this.pendingListenerTimeout = null;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
265
282
|
handleTouchMove(event) {
|
|
266
283
|
const targetNode = event.target;
|
|
267
|
-
const
|
|
268
|
-
if (!this.isAllowedToScroll(targetNode) && (
|
|
269
|
-
if (
|
|
270
|
-
|
|
271
|
-
(
|
|
284
|
+
const cfg = this.getActiveConfig();
|
|
285
|
+
if (!this.isAllowedToScroll(targetNode) && (cfg === null || cfg.handleTouchInput !== false)) {
|
|
286
|
+
if (cfg === null ||
|
|
287
|
+
cfg.mobileOnlyTouchPrevention !== true ||
|
|
288
|
+
(cfg.mobileOnlyTouchPrevention === true &&
|
|
272
289
|
(!this.deviceTypeService.getDeviceState().isMobile || !this.deviceTypeService.getDeviceState().isTablet) &&
|
|
273
|
-
this.
|
|
290
|
+
this.windowDimensionsService.dimensions().width < this.windowDimensionsService.breakpoints.sm)) {
|
|
274
291
|
event.preventDefault();
|
|
275
292
|
event.stopPropagation();
|
|
276
293
|
}
|
|
277
294
|
}
|
|
278
295
|
}
|
|
279
296
|
isAllowedToScroll(targetNode) {
|
|
280
|
-
const
|
|
281
|
-
|
|
297
|
+
const cfg = this.getActiveConfig();
|
|
298
|
+
const allow = cfg?.allowTouchInputOn;
|
|
299
|
+
if (!allow)
|
|
282
300
|
return true;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
return currentConfiguration.allowTouchInputOn.contains(targetNode);
|
|
286
|
-
}
|
|
287
|
-
for (const element of currentConfiguration.allowTouchInputOn) {
|
|
288
|
-
if (element.contains(targetNode)) {
|
|
301
|
+
if (Array.isArray(allow)) {
|
|
302
|
+
if (allow.length === 0)
|
|
289
303
|
return true;
|
|
290
|
-
|
|
304
|
+
return allow.some((el) => el.contains(targetNode));
|
|
291
305
|
}
|
|
292
306
|
return false;
|
|
293
307
|
}
|
|
@@ -300,19 +314,17 @@ class ScrollLockService {
|
|
|
300
314
|
}
|
|
301
315
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScrollLockService, decorators: [{
|
|
302
316
|
type: Injectable,
|
|
303
|
-
args: [{
|
|
304
|
-
providedIn: 'root'
|
|
305
|
-
}]
|
|
317
|
+
args: [{ providedIn: 'root' }]
|
|
306
318
|
}] });
|
|
307
319
|
|
|
308
320
|
class ThemingService {
|
|
321
|
+
platformId = inject(PLATFORM_ID);
|
|
322
|
+
isBrowser = isPlatformBrowser(this.platformId);
|
|
309
323
|
_systemTheme = signal(this.detectInitialSystemTheme(), ...(ngDevMode ? [{ debugName: "_systemTheme" }] : []));
|
|
310
324
|
_applicationTheme = signal(null, ...(ngDevMode ? [{ debugName: "_applicationTheme" }] : []));
|
|
311
325
|
systemTheme = this._systemTheme.asReadonly();
|
|
312
326
|
applicationTheme = this._applicationTheme.asReadonly();
|
|
313
327
|
activeTheme = computed(() => this.applicationTheme() ?? this.systemTheme(), ...(ngDevMode ? [{ debugName: "activeTheme" }] : []));
|
|
314
|
-
platformId = inject(PLATFORM_ID);
|
|
315
|
-
isBrowser = isPlatformBrowser(this.platformId);
|
|
316
328
|
systemTheme$ = toObservable(this._systemTheme);
|
|
317
329
|
applicationTheme$ = toObservable(this._applicationTheme);
|
|
318
330
|
mediaQueryList;
|
|
@@ -330,16 +342,9 @@ class ThemingService {
|
|
|
330
342
|
setApplicationTheme(theme) {
|
|
331
343
|
this._applicationTheme.set(theme);
|
|
332
344
|
}
|
|
333
|
-
/**
|
|
334
|
-
* Returns an observable of the system theme.
|
|
335
|
-
* Safe to call anywhere because the observable is pre-created in the constructor context.
|
|
336
|
-
*/
|
|
337
345
|
getSystemTheme$() {
|
|
338
346
|
return this.systemTheme$;
|
|
339
347
|
}
|
|
340
|
-
/**
|
|
341
|
-
* Returns an observable of the application theme.
|
|
342
|
-
*/
|
|
343
348
|
getApplicationTheme$() {
|
|
344
349
|
return this.applicationTheme$;
|
|
345
350
|
}
|
|
@@ -1 +1 @@
|
|
|
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}\n","export enum MobileOS {\n Android = 'android',\n iOS = 'ios',\n Unknown = 'unknown',\n WindowsPhone = 'Windows Phone'\n}\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, LegacyScreenOrientation, MSStreamWindow, OperaCapableWindow } from '../types/core.types';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class DeviceTypeService {\n private userAgent?: string = navigator.userAgent || navigator.vendor || (window as OperaCapableWindow)?.opera || undefined;\n private readonly isDesktopDevice = !this.isMobileDevice() && !this.isTabletDevice();\n\n private supportedScreenOrientation =\n (screen?.orientation || {}).type ?? (screen as LegacyScreenOrientation).mozOrientation ?? (screen as LegacyScreenOrientation).msOrientation;\n\n private safariScreenOrientation: DeviceOrientationType =\n !screen?.orientation && matchMedia('(orientation: portrait)').matches ? 'portrait-primary' : 'landscape-primary';\n\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('change', (ev: Event) => {\n const orientation = ev.target as ScreenOrientation | null;\n if (orientation?.type) {\n this.screenOrientation = orientation.type;\n }\n });\n }\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 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 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 private getMobileOS(): MobileOS | undefined {\n if (this.isMobileDevice() && this.userAgent) {\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 MSStreamWindow).MSStream) return MobileOS.iOS;\n\n return MobileOS.Unknown;\n }\n return undefined;\n }\n\n private getDesktopOS(): DesktopOS | undefined {\n if (this.isDesktopDevice && this.userAgent) {\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","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;\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 '../constants/window-dimension.constants';\nimport { WindowDimensions } from '../interfaces/window-dimensions.interface';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class WindowDimensionsService {\n public readonly ngZone = inject(NgZone);\n public readonly platformId = inject(PLATFORM_ID);\n public readonly isBrowser = isPlatformBrowser(this.platformId);\n\n public 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) => prev.width === curr.width && prev.height === curr.height)\n )\n .subscribe((dims) => {\n this.ngZone.run(() => {\n this._dimensions.set(dims);\n });\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 public _isScrollDisabled = signal<boolean>(false);\n public readonly isScrollDisabled = this._isScrollDisabled.asReadonly();\n\n private deviceTypeService = inject(DeviceTypeService);\n private windowDimensionsService = inject(WindowDimensionsService);\n\n private activeLocks = new Map<string, IScrollLockConfig>();\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 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 () => {\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 },\n (config.animationDuration ?? 0) + 10\n );\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 (\n currentConfiguration === null ||\n currentConfiguration?.mobileOnlyTouchPrevention !== true ||\n (currentConfiguration?.mobileOnlyTouchPrevention === true &&\n (!this.deviceTypeService.getDeviceState().isMobile || !this.deviceTypeService.getDeviceState().isTablet) &&\n this.windowDimensions().width < this.windowDimensionsService.breakpoints.sm)\n ) {\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) {\n return true;\n }\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}\n","import { Injectable, OnDestroy, inject, signal, PLATFORM_ID, computed } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { DeviceTheme } from '../types/core.types';\nimport { toObservable } from '@angular/core/rxjs-interop';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ThemingService implements OnDestroy {\n public readonly _systemTheme = signal<DeviceTheme>(this.detectInitialSystemTheme());\n public 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 private readonly platformId = inject(PLATFORM_ID);\n\n private readonly isBrowser = isPlatformBrowser(this.platformId);\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}\n","export const SCROLL_LOCK_INSTANCE_IDENTIFIER = 'scroll_lock_instance_';\n","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","/*\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/core.types';\n\nexport * from './lib/helpers/uui4';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;IAAY;AAAZ,CAAA,UAAY,SAAS,EAAA;AACnB,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;AACrB,CAAC,EANW,SAAS,KAAT,SAAS,GAAA,EAAA,CAAA,CAAA;;ICAT;AAAZ,CAAA,UAAY,QAAQ,EAAA;AAClB,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;AAChC,CAAC,EALW,QAAQ,KAAR,QAAQ,GAAA,EAAA,CAAA,CAAA;;MCSP,iBAAiB,CAAA;AACpB,IAAA,SAAS,GAAY,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,IAAK,MAA6B,EAAE,KAAK,IAAI,SAAS;AACzG,IAAA,eAAe,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;AAE3E,IAAA,0BAA0B,GAChC,CAAC,MAAM,EAAE,WAAW,IAAI,EAAE,EAAE,IAAI,IAAK,MAAkC,CAAC,cAAc,IAAK,MAAkC,CAAC,aAAa;IAErI,uBAAuB,GAC7B,CAAC,MAAM,EAAE,WAAW,IAAI,UAAU,CAAC,yBAAyB,CAAC,CAAC,OAAO,GAAG,kBAAkB,GAAG,mBAAmB;IAE1G,wB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s","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}\n","export enum MobileOS {\n Android = 'android',\n iOS = 'ios',\n Unknown = 'unknown',\n WindowsPhone = 'Windows Phone'\n}\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, LegacyScreenOrientation, MSStreamWindow, OperaCapableWindow } from '../types/core.types';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class DeviceTypeService {\n private readonly isDesktopDevice = !this.isMobileDevice() && !this.isTabletDevice();\n private userAgent?: string = navigator.userAgent || navigator.vendor || (window as OperaCapableWindow)?.opera || undefined;\n\n private supportedScreenOrientation =\n (screen?.orientation || {}).type ?? (screen as LegacyScreenOrientation).mozOrientation ?? (screen as LegacyScreenOrientation).msOrientation;\n\n private safariScreenOrientation: DeviceOrientationType =\n !screen?.orientation && matchMedia('(orientation: portrait)').matches ? 'portrait-primary' : 'landscape-primary';\n\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('change', (ev: Event) => {\n const orientation = ev.target as ScreenOrientation | null;\n if (orientation?.type) {\n this.screenOrientation = orientation.type;\n }\n });\n }\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 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 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 private getMobileOS(): MobileOS | undefined {\n if (this.isMobileDevice() && this.userAgent) {\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 MSStreamWindow).MSStream) return MobileOS.iOS;\n\n return MobileOS.Unknown;\n }\n return undefined;\n }\n\n private getDesktopOS(): DesktopOS | undefined {\n if (this.isDesktopDevice && this.userAgent) {\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","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;\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 '../constants/window-dimension.constants';\nimport { WindowDimensions } from '../interfaces/window-dimensions.interface';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class WindowDimensionsService {\n public readonly ngZone = inject(NgZone);\n public readonly platformId = inject(PLATFORM_ID);\n\n public readonly isBrowser = isPlatformBrowser(this.platformId);\n\n public 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) => prev.width === curr.width && prev.height === curr.height)\n )\n .subscribe((dims) => {\n this.ngZone.run(() => {\n this._dimensions.set(dims);\n });\n });\n });\n }\n}\n","import { Injectable, OnDestroy, inject, signal, PLATFORM_ID } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { DeviceTypeService } from './device-type.service';\nimport { WindowDimensionsService } from './window-dimension.service';\nimport { IScrollLockConfig } from '../interfaces/scroll-lock-config.interface';\n\n@Injectable({ providedIn: 'root' })\nexport class ScrollLockService implements OnDestroy {\n private readonly platformId = inject(PLATFORM_ID);\n private readonly deviceTypeService = inject(DeviceTypeService);\n private readonly windowDimensionsService = inject(WindowDimensionsService);\n\n private readonly isBrowser = isPlatformBrowser(this.platformId);\n private readonly activeLocks = new Map<string, IScrollLockConfig>();\n private readonly boundHandleTouchMove = this.handleTouchMove.bind(this);\n private readonly boundPreventDefault = this.preventDefault.bind(this);\n\n public readonly _isScrollDisabled = signal(false);\n public readonly isScrollDisabled = this._isScrollDisabled.asReadonly();\n\n private previousBodyPadding: string | null = null;\n\n private pendingListenerTimeout: number | null = null;\n\n public ngOnDestroy(): void {\n if (!this.isBrowser) return;\n this.clearPendingTimeout();\n this.forceCleanupAll();\n }\n\n public disableScroll(usageId: string, config: IScrollLockConfig): void {\n if (!this.isBrowser) return;\n\n const wasDisabled = this._isScrollDisabled();\n\n this.activeLocks.set(usageId, config);\n this._isScrollDisabled.set(true);\n\n if (wasDisabled) return;\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 const computedPadding = parseInt(getComputedStyle(document.body).paddingRight, 10) || 0;\n\n document.body.style.setProperty('padding-right', `${computedPadding + scrollBarWidth}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 this.clearPendingTimeout();\n\n this.pendingListenerTimeout = window.setTimeout(\n () => {\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 opt = { passive: false };\n window.addEventListener('wheel', this.boundPreventDefault, opt);\n window.addEventListener('mousewheel', this.boundPreventDefault, opt);\n window.addEventListener('scroll', this.boundPreventDefault, opt);\n window.addEventListener('DOMMouseScroll', this.boundPreventDefault, opt);\n }\n },\n (config.animationDuration ?? 0) + 10\n );\n }\n\n public enableScroll(usageId: string, extremeOverflow?: boolean): void {\n if (!this.isBrowser) return;\n\n if (!this.activeLocks.has(usageId)) return;\n\n this.activeLocks.delete(usageId);\n\n if (this.activeLocks.size > 0) return;\n\n this.updateStateAndCleanup(extremeOverflow);\n }\n\n private getActiveConfig(): IScrollLockConfig | null {\n if (this.activeLocks.size === 0) return null;\n const keys = Array.from(this.activeLocks.keys());\n return this.activeLocks.get(keys[keys.length - 1]) ?? null;\n }\n\n private updateStateAndCleanup(extremeOverflow?: boolean): void {\n if (!this.isBrowser) return;\n\n this.clearPendingTimeout();\n\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 (extremeOverflow !== 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 forceCleanupAll(): void {\n this.activeLocks.clear();\n this.updateStateAndCleanup(true);\n }\n\n private clearPendingTimeout(): void {\n if (this.pendingListenerTimeout !== null) {\n clearTimeout(this.pendingListenerTimeout);\n this.pendingListenerTimeout = null;\n }\n }\n\n private handleTouchMove(event: Event): void {\n const targetNode = event.target as Node;\n const cfg = this.getActiveConfig();\n\n if (!this.isAllowedToScroll(targetNode) && (cfg === null || cfg.handleTouchInput !== false)) {\n if (\n cfg === null ||\n cfg.mobileOnlyTouchPrevention !== true ||\n (cfg.mobileOnlyTouchPrevention === true &&\n (!this.deviceTypeService.getDeviceState().isMobile || !this.deviceTypeService.getDeviceState().isTablet) &&\n this.windowDimensionsService.dimensions().width < this.windowDimensionsService.breakpoints.sm)\n ) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n }\n\n private isAllowedToScroll(targetNode: Node): boolean {\n const cfg = this.getActiveConfig();\n const allow = cfg?.allowTouchInputOn;\n\n if (!allow) return true;\n\n if (Array.isArray(allow)) {\n if (allow.length === 0) return true;\n return allow.some((el) => el.contains(targetNode));\n }\n\n return false;\n }\n\n private preventDefault(event: Event): void {\n event.preventDefault();\n event.stopPropagation();\n }\n}\n","import { Injectable, OnDestroy, inject, signal, PLATFORM_ID, computed } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { DeviceTheme } from '@core/types/core.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 public getSystemTheme$() {\n return this.systemTheme$;\n }\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_';\n","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","/*\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/core.types';\n\nexport * from './lib/helpers/uui4';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;IAAY;AAAZ,CAAA,UAAY,SAAS,EAAA;AACnB,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;AACrB,CAAC,EANW,SAAS,KAAT,SAAS,GAAA,EAAA,CAAA,CAAA;;ICAT;AAAZ,CAAA,UAAY,QAAQ,EAAA;AAClB,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;AAChC,CAAC,EALW,QAAQ,KAAR,QAAQ,GAAA,EAAA,CAAA,CAAA;;MCSP,iBAAiB,CAAA;AACX,IAAA,eAAe,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;AAC3E,IAAA,SAAS,GAAY,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,IAAK,MAA6B,EAAE,KAAK,IAAI,SAAS;AAElH,IAAA,0BAA0B,GAChC,CAAC,MAAM,EAAE,WAAW,IAAI,EAAE,EAAE,IAAI,IAAK,MAAkC,CAAC,cAAc,IAAK,MAAkC,CA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AAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE;AACb,iBAAA;;;ACPM,MAAM,+BAA+B,GAAG;;SCA/B,MAAM,GAAA;IACpB,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;AAC/J;;ACFA;;AAEG;;ACFH;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
2
|
import { OnDestroy, NgZone } from '@angular/core';
|
|
3
3
|
import * as rxjs from 'rxjs';
|
|
4
|
+
import { DeviceTheme as DeviceTheme$1 } from '@core/types/core.types';
|
|
4
5
|
|
|
5
6
|
declare enum DesktopOS {
|
|
6
7
|
Linux = "linux",
|
|
@@ -33,8 +34,8 @@ interface DeviceState {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
declare class DeviceTypeService {
|
|
36
|
-
private userAgent?;
|
|
37
37
|
private readonly isDesktopDevice;
|
|
38
|
+
private userAgent?;
|
|
38
39
|
private supportedScreenOrientation;
|
|
39
40
|
private safariScreenOrientation;
|
|
40
41
|
private initialScreenOrientation;
|
|
@@ -61,20 +62,24 @@ interface IScrollLockConfig {
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
declare class ScrollLockService implements OnDestroy {
|
|
64
|
-
|
|
65
|
+
private readonly platformId;
|
|
66
|
+
private readonly deviceTypeService;
|
|
67
|
+
private readonly windowDimensionsService;
|
|
68
|
+
private readonly isBrowser;
|
|
69
|
+
private readonly activeLocks;
|
|
70
|
+
private readonly boundHandleTouchMove;
|
|
71
|
+
private readonly boundPreventDefault;
|
|
72
|
+
readonly _isScrollDisabled: _angular_core.WritableSignal<boolean>;
|
|
65
73
|
readonly isScrollDisabled: _angular_core.Signal<boolean>;
|
|
66
|
-
private deviceTypeService;
|
|
67
|
-
private windowDimensionsService;
|
|
68
|
-
private activeLocks;
|
|
69
74
|
private previousBodyPadding;
|
|
70
|
-
private
|
|
71
|
-
private windowDimensions;
|
|
72
|
-
private boundHandleTouchMove;
|
|
73
|
-
private boundPreventDefault;
|
|
75
|
+
private pendingListenerTimeout;
|
|
74
76
|
ngOnDestroy(): void;
|
|
75
77
|
disableScroll(usageId: string, config: IScrollLockConfig): void;
|
|
76
|
-
enableScroll(usageId: string,
|
|
78
|
+
enableScroll(usageId: string, extremeOverflow?: boolean): void;
|
|
79
|
+
private getActiveConfig;
|
|
77
80
|
private updateStateAndCleanup;
|
|
81
|
+
private forceCleanupAll;
|
|
82
|
+
private clearPendingTimeout;
|
|
78
83
|
private handleTouchMove;
|
|
79
84
|
private isAllowedToScroll;
|
|
80
85
|
private preventDefault;
|
|
@@ -113,44 +118,23 @@ declare class WindowDimensionsService {
|
|
|
113
118
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<WindowDimensionsService>;
|
|
114
119
|
}
|
|
115
120
|
|
|
116
|
-
type DeviceTheme = 'light' | 'dark';
|
|
117
|
-
type DeviceOS = DesktopOS | MobileOS;
|
|
118
|
-
type DeviceOrientationType = 'portrait-primary' | 'landscape-primary' | 'portrait-secondary' | 'landscape-secondary';
|
|
119
|
-
type OperaCapableWindow = Window & {
|
|
120
|
-
opera?: string;
|
|
121
|
-
};
|
|
122
|
-
type LegacyScreenOrientation = Screen & {
|
|
123
|
-
mozOrientation?: DeviceOrientationType;
|
|
124
|
-
msOrientation?: DeviceOrientationType;
|
|
125
|
-
};
|
|
126
|
-
type MSStreamWindow = Window & {
|
|
127
|
-
MSStream?: unknown;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
121
|
declare class ThemingService implements OnDestroy {
|
|
131
|
-
readonly _systemTheme: _angular_core.WritableSignal<DeviceTheme>;
|
|
132
|
-
readonly _applicationTheme: _angular_core.WritableSignal<DeviceTheme | null>;
|
|
133
|
-
readonly systemTheme: _angular_core.Signal<DeviceTheme>;
|
|
134
|
-
readonly applicationTheme: _angular_core.Signal<DeviceTheme | null>;
|
|
135
|
-
readonly activeTheme: _angular_core.Signal<DeviceTheme>;
|
|
136
122
|
private readonly platformId;
|
|
137
123
|
private readonly isBrowser;
|
|
124
|
+
private readonly _systemTheme;
|
|
125
|
+
private readonly _applicationTheme;
|
|
126
|
+
readonly systemTheme: _angular_core.Signal<DeviceTheme$1>;
|
|
127
|
+
readonly applicationTheme: _angular_core.Signal<DeviceTheme$1 | null>;
|
|
128
|
+
readonly activeTheme: _angular_core.Signal<DeviceTheme$1>;
|
|
138
129
|
private readonly systemTheme$;
|
|
139
130
|
private readonly applicationTheme$;
|
|
140
131
|
private mediaQueryList?;
|
|
141
132
|
private mediaQueryListener?;
|
|
142
133
|
constructor();
|
|
143
134
|
ngOnDestroy(): void;
|
|
144
|
-
setApplicationTheme(theme: DeviceTheme): void;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
* Safe to call anywhere because the observable is pre-created in the constructor context.
|
|
148
|
-
*/
|
|
149
|
-
getSystemTheme$(): rxjs.Observable<DeviceTheme>;
|
|
150
|
-
/**
|
|
151
|
-
* Returns an observable of the application theme.
|
|
152
|
-
*/
|
|
153
|
-
getApplicationTheme$(): rxjs.Observable<DeviceTheme | null>;
|
|
135
|
+
setApplicationTheme(theme: DeviceTheme$1): void;
|
|
136
|
+
getSystemTheme$(): rxjs.Observable<DeviceTheme$1>;
|
|
137
|
+
getApplicationTheme$(): rxjs.Observable<DeviceTheme$1 | null>;
|
|
154
138
|
private detectInitialSystemTheme;
|
|
155
139
|
private initSystemThemeListener;
|
|
156
140
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ThemingService, never>;
|
|
@@ -170,6 +154,20 @@ declare const BREAKPOINTS: {
|
|
|
170
154
|
|
|
171
155
|
declare const SCROLL_LOCK_INSTANCE_IDENTIFIER = "scroll_lock_instance_";
|
|
172
156
|
|
|
157
|
+
type DeviceTheme = 'light' | 'dark';
|
|
158
|
+
type DeviceOS = DesktopOS | MobileOS;
|
|
159
|
+
type DeviceOrientationType = 'portrait-primary' | 'landscape-primary' | 'portrait-secondary' | 'landscape-secondary';
|
|
160
|
+
type OperaCapableWindow = Window & {
|
|
161
|
+
opera?: string;
|
|
162
|
+
};
|
|
163
|
+
type LegacyScreenOrientation = Screen & {
|
|
164
|
+
mozOrientation?: DeviceOrientationType;
|
|
165
|
+
msOrientation?: DeviceOrientationType;
|
|
166
|
+
};
|
|
167
|
+
type MSStreamWindow = Window & {
|
|
168
|
+
MSStream?: unknown;
|
|
169
|
+
};
|
|
170
|
+
|
|
173
171
|
declare function uuidv4(): string;
|
|
174
172
|
|
|
175
173
|
export { BREAKPOINTS, DesktopOS, DeviceTypeService, MobileOS, SCROLL_LOCK_INSTANCE_IDENTIFIER, ScrollLockService, ThemingService, WindowDimensionsService, uuidv4 };
|