@filip.mazev/blocks-core 0.0.15 → 0.0.17
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
|
@@ -13,7 +13,7 @@ Blocks Core utilizes a robust SCSS architecture to manage design tokens and resp
|
|
|
13
13
|
The library uses a CSS Variable system generated via SCSS maps. To initialize the core theme, use the `core-theme` mixin in your global styles.
|
|
14
14
|
|
|
15
15
|
```scss
|
|
16
|
-
@use
|
|
16
|
+
@use "@filip.mazev/blocks-core/src/lib/styles/index" as blocks;
|
|
17
17
|
|
|
18
18
|
:root {
|
|
19
19
|
// Initialize default light theme
|
|
@@ -26,7 +26,7 @@ body.dark-theme {
|
|
|
26
26
|
}
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
This generates CSS variables with the `--fm-` prefix (e.g.,`--fm-primary`, `--fm-
|
|
29
|
+
This generates CSS variables with the `--fm-` prefix (e.g.,`--fm-primary`, `--fm-surface`, `--fm-element`).
|
|
30
30
|
|
|
31
31
|
### 2. Responsive Mixins
|
|
32
32
|
|
|
@@ -34,19 +34,19 @@ The library provides mixins that strictly align with the WindowDimensionsService
|
|
|
34
34
|
|
|
35
35
|
Available Breakpoints:
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
- `xs`: 360px
|
|
38
|
+
- `sm`: 640px
|
|
39
|
+
- `md`: 768px
|
|
40
|
+
- `lg`: 1024px
|
|
41
|
+
- `xl`: 1280px
|
|
42
|
+
- `2xl`: 1536px
|
|
43
|
+
- `3xl`: 1920px
|
|
44
|
+
- `4xl`: 2560px
|
|
45
45
|
|
|
46
46
|
Usage:
|
|
47
47
|
|
|
48
48
|
```scss
|
|
49
|
-
@use
|
|
49
|
+
@use "@filip.mazev/blocks-core/src/lib/styles/mixins" as *;
|
|
50
50
|
|
|
51
51
|
.my-element {
|
|
52
52
|
width: 100%;
|
|
@@ -72,7 +72,7 @@ Bridges the gap between CSS media queries and TypeScript logic. It provides reac
|
|
|
72
72
|
```typescript
|
|
73
73
|
export class MyComponent {
|
|
74
74
|
protected windowDimensionsService = inject(WindowDimensionsService);
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
protected windowDimensions = this.windowDimensionsService.dimensions;
|
|
77
77
|
protected breakpoints = this.windowDimensionsService.breakpoints;
|
|
78
78
|
|
|
@@ -90,9 +90,9 @@ export class MyComponent {
|
|
|
90
90
|
|
|
91
91
|
Handles the detection of system preferences (Dark/Light mode) and manages the application-level theme state.
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
- `getSystemTheme$()`: Observes the OS/Browser prefers-color-scheme.
|
|
94
|
+
- `getApplicationTheme$()`: Observes the manually set application theme.
|
|
95
|
+
- `setApplicationTheme(theme: DeviceTheme)`: Manually overrides the current theme ('light' | 'dark').
|
|
96
96
|
|
|
97
97
|
### `DeviceTypeService`
|
|
98
98
|
|
|
@@ -100,21 +100,21 @@ Provides detailed information about the user's device, OS, and orientation. Usef
|
|
|
100
100
|
|
|
101
101
|
`getDeviceState()` returns:
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
- isMobile / isTablet / isDesktop
|
|
104
|
+
- desktopOS (Windows, Mac, Linux, Unix)
|
|
105
|
+
- mobileOS (iOS, Android)
|
|
106
|
+
- isAppleDevice (checks both iOS and MacOS)
|
|
107
|
+
- isLandscapeOrientation / isPortraitOrientation
|
|
108
108
|
|
|
109
109
|
### `ScrollLockService`
|
|
110
110
|
|
|
111
111
|
A utility to prevent background scrolling when overlays (like Modals) are active. This service handles complex edge cases, including:
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
- **Scrollbar Compensation**: Adds padding to the body to prevent layout shifts when the scrollbar disappears.
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
- **Mobile Touch**: Prevents "scroll chaining" on mobile devices.
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
- **Extreme Overflow**: Optionally disables wheel and touch events entirely for strict locking.
|
|
118
118
|
|
|
119
119
|
To use the scroll locking service within a component, in order to prevent enabling the scroll from one instance when another is disabling it, a `scrollLockId` must be generated and passed to the `disableScroll` and `enableScroll` methods, the provided `uuidv4` method from this library is recommended to be used for this.
|
|
120
120
|
|
|
@@ -126,7 +126,7 @@ private scrollLockId: string = uuidv4();
|
|
|
126
126
|
// Lock scroll
|
|
127
127
|
this.scrollLockService.disableScroll(this.scrollLockId, {
|
|
128
128
|
handleTouchInput: true,
|
|
129
|
-
handleExtremeOverflow: false
|
|
129
|
+
handleExtremeOverflow: false,
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
// Unlock
|
package/package.json
CHANGED
|
@@ -4,20 +4,4 @@
|
|
|
4
4
|
@each $key, $value in $config {
|
|
5
5
|
--fm-#{$key}: #{$value};
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
@if map.has-key($config, 'canvas') {
|
|
9
|
-
--fm-bg-canvas: #{map.get($config, 'canvas')};
|
|
10
|
-
}
|
|
11
|
-
@if map.has-key($config, 'surface') {
|
|
12
|
-
--fm-bg-surface: #{map.get($config, 'surface')};
|
|
13
|
-
}
|
|
14
|
-
@if map.has-key($config, 'element') {
|
|
15
|
-
--fm-bg-element: #{map.get($config, 'element')};
|
|
16
|
-
}
|
|
17
|
-
@if map.has-key($config, 'text') {
|
|
18
|
-
--fm-text-main: #{map.get($config, 'text')};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
$surface: map.get($config, 'surface');
|
|
22
|
-
--fm-contrast-main: #{if($surface == #ffffff or $surface == #f9fafb, #000, #fff)};
|
|
23
7
|
}
|
|
@@ -49,7 +49,7 @@ $orange-company-light-theme-config: (
|
|
|
49
49
|
|
|
50
50
|
'canvas': #ffffff,
|
|
51
51
|
'surface': #ffffff,
|
|
52
|
-
'element': #
|
|
52
|
+
'element': #f4f4f4,
|
|
53
53
|
'text': #484848,
|
|
54
54
|
'status-warn': map-get($warning-palette, 500),
|
|
55
55
|
'status-error': map-get($error-palette, 500),
|
|
@@ -105,6 +105,7 @@ $orange-company-dark-theme-config: (
|
|
|
105
105
|
|
|
106
106
|
'canvas': #000000,
|
|
107
107
|
'surface': #0d0d0d,
|
|
108
|
+
'element': #171717,
|
|
108
109
|
'text': #ffffff,
|
|
109
110
|
'status-warn': map-get($warning-palette, 500),
|
|
110
111
|
'status-error': map-get($error-palette, 400),
|