@filip.mazev/blocks-core 1.0.15 → 1.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
@@ -75,6 +75,65 @@ Usage:
75
75
  }
76
76
  ```
77
77
 
78
+ ### 3. Design Tokens & Utilities
79
+
80
+ Blocks Core includes a strictly defined design system for spacing, border-radiuses, shadows, and z-indexes. This ensures visual consistency across all components and applications.
81
+
82
+ The library exposes these tokens in three different ways so you can use them wherever they fit best: **SCSS Functions, HTML Utility Classes**, and **CSS Variables**.
83
+
84
+ #### Using SCSS Functions (Recommended for Component Styles)
85
+
86
+ When writing custom component styles, use the provided SCSS functions to access the design tokens. This replaces hardcoded "magic numbers" (like `16px` or `1rem`) with standardized scale values.
87
+
88
+ ```scss
89
+ @use "@filip.mazev/blocks-core/src/lib/styles/index" as blocks;
90
+
91
+ .my-card-element {
92
+ // Spacing
93
+ padding: blocks.spacing(4) blocks.spacing(6);
94
+ margin-bottom: blocks.spacing(2);
95
+
96
+ // Styling
97
+ border-radius: blocks.radius(lg);
98
+ box-shadow: blocks.shadow(md);
99
+
100
+ // Z-Index
101
+ z-index: blocks.z(dropdown);
102
+ }
103
+ ```
104
+
105
+ #### Using Utility Classes (Tailwind-Style)
106
+
107
+ For rapid UI development directly in your templates, Blocks Core automatically generates utility classes prefixed with `.fm-`.
108
+
109
+ ```html
110
+ <div class="fm-p-4 fm-my-2 fm-px-6">...</div>
111
+
112
+ <div class="fm-rounded-md fm-rounded-t-lg">...</div>
113
+
114
+ <div class="fm-shadow-modal fm-z-fixed">...</div>
115
+ ```
116
+
117
+ #### Using CSS Variables
118
+
119
+ If you need to access tokens inline or outside of SCSS compilation, they are exposed globally on the `:root` element.
120
+
121
+ ```scss
122
+ .dynamic-element {
123
+ padding: var(--fm-space-4);
124
+ border-radius: var(--fm-rounded-pill);
125
+ box-shadow: var(--fm-shadow-toast);
126
+ z-index: var(--fm-z-modal);
127
+ }
128
+ ```
129
+
130
+ #### Available Scales Reference
131
+
132
+ - Spacing Scale: `0`, `1` (0.25rem), `2` (0.5rem), `3` (0.75rem), `4` (1rem), `5` (1.25rem), `6` (1.5rem), `8` (2rem), `10` (2.5rem), `12` (3rem)
133
+ - Radius Scale: `none`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`, `pill`
134
+ - Shadow Scale: `sm`, `md`, `lg`, `xl`, `modal`, `toast`
135
+ - Z-Index Scale: `base` (1), `dropdown` (100), `sticky` (200), `fixed` (300), `modal` (400), `popover` (500), `tooltip` (600), `toast` (9999)
136
+
78
137
  ## Core Services
79
138
 
80
139
  ### `WindowDimensionsService`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@filip.mazev/blocks-core",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  "./mixins": "./lib/styles/_mixins.scss",
@@ -1,5 +1,6 @@
1
1
  @forward 'mixins';
2
2
  @forward 'variables';
3
+ @forward 'utilities';
3
4
  @forward 'theme-provider';
4
5
  @forward 'themes/default-theme';
5
6
  @forward 'themes/orange-company-theme';
@@ -14,7 +14,23 @@
14
14
  }
15
15
 
16
16
  @mixin respond-between($min, $max) {
17
- @media (min-width: map.get($breakpoints, $min)) and (max-width: map.get($breakpoints, $max)) {
17
+ @media (min-width: map.get($breakpoints, $min)) and (max-width: map.get($breakpoints, $max)) {
18
18
  @content;
19
19
  }
20
+ }
21
+
22
+ @function spacing($key) {
23
+ @return map-get($spacing, $key);
24
+ }
25
+
26
+ @function radius($key) {
27
+ @return map-get($radiuses, $key);
28
+ }
29
+
30
+ @function shadow($key) {
31
+ @return map-get($shadows, $key);
32
+ }
33
+
34
+ @function z($key) {
35
+ @return map-get($z-index, $key);
20
36
  }
@@ -0,0 +1,119 @@
1
+ @use 'variables' as *;
2
+
3
+ @each $key, $val in $spacing {
4
+ .fm-p-#{$key} {
5
+ padding: #{$val};
6
+ }
7
+
8
+ .fm-pt-#{$key} {
9
+ padding-top: #{$val};
10
+ }
11
+
12
+ .fm-pr-#{$key} {
13
+ padding-right: #{$val};
14
+ }
15
+
16
+ .fm-pb-#{$key} {
17
+ padding-bottom: #{$val};
18
+ }
19
+
20
+ .fm-pl-#{$key} {
21
+ padding-left: #{$val};
22
+ }
23
+
24
+ .fm-px-#{$key} {
25
+ padding-left: #{$val};
26
+ padding-right: #{$val};
27
+ }
28
+
29
+ .fm-py-#{$key} {
30
+ padding-top: #{$val};
31
+ padding-bottom: #{$val};
32
+ }
33
+
34
+ .fm-m-#{$key} {
35
+ margin: #{$val};
36
+ }
37
+
38
+ .fm-mt-#{$key} {
39
+ margin-top: #{$val};
40
+ }
41
+
42
+ .fm-mr-#{$key} {
43
+ margin-right: #{$val};
44
+ }
45
+
46
+ .fm-mb-#{$key} {
47
+ margin-bottom: #{$val};
48
+ }
49
+
50
+ .fm-ml-#{$key} {
51
+ margin-left: #{$val};
52
+ }
53
+
54
+ .fm-mx-#{$key} {
55
+ margin-left: #{$val};
56
+ margin-right: #{$val};
57
+ }
58
+
59
+ .fm-my-#{$key} {
60
+ margin-top: #{$val};
61
+ margin-bottom: #{$val};
62
+ }
63
+ }
64
+
65
+ @each $key, $val in $radiuses {
66
+ .fm-rounded-#{$key} {
67
+ border-radius: #{$val};
68
+ }
69
+
70
+ .fm-rounded-t-#{$key} {
71
+ border-top-left-radius: #{$val};
72
+ border-top-right-radius: #{$val};
73
+ }
74
+
75
+ .fm-rounded-b-#{$key} {
76
+ border-bottom-left-radius: #{$val};
77
+ border-bottom-right-radius: #{$val};
78
+ }
79
+
80
+ .fm-rounded-l-#{$key} {
81
+ border-top-left-radius: #{$val};
82
+ border-bottom-left-radius: #{$val};
83
+ }
84
+
85
+ .fm-rounded-r-#{$key} {
86
+ border-top-right-radius: #{$val};
87
+ border-bottom-right-radius: #{$val};
88
+ }
89
+ }
90
+
91
+ @each $key, $val in $shadows {
92
+ .fm-shadow-#{$key} {
93
+ box-shadow: #{$val};
94
+ }
95
+ }
96
+
97
+ @each $key, $val in $z-index {
98
+ .fm-z-#{$key} {
99
+ z-index: #{$val};
100
+ }
101
+ }
102
+
103
+ :root {
104
+ @each $key, $val in $spacing {
105
+ --fm-space-#{$key}: #{$val};
106
+ }
107
+
108
+ @each $key, $val in $radiuses {
109
+ --fm-rounded-#{$key}: #{$val};
110
+ }
111
+
112
+ @each $key, $val in $shadows {
113
+ --fm-shadow-#{$key}: #{$val};
114
+ }
115
+
116
+ @each $key, $val in $z-index {
117
+ --fm-z-#{$key}: #{$val};
118
+ }
119
+ }
@@ -29,6 +29,50 @@ $hc-cyan: #00ffff;
29
29
  $hc-red: #ff0000;
30
30
  $hc-green: #00ff00;
31
31
 
32
+ $spacing: (
33
+ 0: 0,
34
+ 1: 0.25rem,
35
+ 2: 0.5rem,
36
+ 3: 0.75rem,
37
+ 4: 1rem,
38
+ 5: 1.25rem,
39
+ 6: 1.5rem,
40
+ 8: 2rem,
41
+ 10: 2.5rem,
42
+ 12: 3rem,
43
+ ) !default;
44
+
45
+ $radiuses: (
46
+ none: 0,
47
+ sm: 0.25rem,
48
+ md: 0.5rem,
49
+ lg: 0.75rem,
50
+ xl: 1rem,
51
+ 2xl: 1.5rem,
52
+ 3xl: 1.875rem,
53
+ pill: 9999px,
54
+ ) !default;
55
+
56
+ $shadows: (
57
+ sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)",
58
+ md: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
59
+ lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",
60
+ xl: "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",
61
+ modal: "0 8px 20px rgba(0, 0, 0, 0.12)",
62
+ toast: "0 4px 12px rgba(0, 0, 0, 0.15)",
63
+ ) !default;
64
+
65
+ $z-index: (
66
+ base: 1,
67
+ dropdown: 100,
68
+ sticky: 200,
69
+ fixed: 300,
70
+ modal: 400,
71
+ popover: 500,
72
+ tooltip: 600,
73
+ toast: 9999,
74
+ ) !default;
75
+
32
76
  $breakpoints: (
33
77
  xs: 360px,
34
78
 
@@ -35,18 +35,18 @@ $default-light-theme-config: (
35
35
  'button-grayscale': map-get($gray-palette, 200),
36
36
 
37
37
  // Feedback
38
- 'toast-info-bg': #ebf5ff,
38
+ 'toast-info-bg': #f7fbfff8,
39
39
  'toast-info-border': #bcd3eb,
40
40
  'toast-info-accent': #1a5bc4,
41
- 'toast-error-bg': map-get($error-palette, 50),
41
+ 'toast-error-bg': #fffbfbf8,
42
42
  'toast-error-border': #f5cccc,
43
- 'toast-error-accent': map-get($error-palette, 500),
44
- 'toast-success-bg': #f0fdf4,
45
- 'toast-success-border': #a0e09af8,
43
+ 'toast-error-accent': #d33737,
44
+ 'toast-success-bg': #fbfffcf8,
45
+ 'toast-success-border': #a0e09a,
46
46
  'toast-success-accent': #0e873a,
47
- 'toast-warn-bg': map-get($warning-palette, 50),
47
+ 'toast-warn-bg': #fffdf7f8,
48
48
  'toast-warn-border': #f6e5c9,
49
- 'toast-warn-accent': map-get($warning-palette, 500),
49
+ 'toast-warn-accent': #ba7909,
50
50
 
51
51
  // Scrollbar & Sliders
52
52
  'scroll-bg': map-get($gray-palette, 100),
@@ -99,18 +99,18 @@ $default-dark-theme-config: (
99
99
  'button-grayscale': map-get($gray-palette, 700),
100
100
 
101
101
  // Feedback
102
- 'toast-info-bg': #0c151e,
102
+ 'toast-info-bg': #0c151ef8,
103
103
  'toast-info-border': #1e2f44,
104
104
  'toast-info-accent': #7cb7ff,
105
- 'toast-error-bg': #180c0c,
105
+ 'toast-error-bg': #1a0f0ff8,
106
106
  'toast-error-border': #3b1313,
107
- 'toast-error-accent': map-get($error-palette, 400),
108
- 'toast-success-bg': #0a150f,
107
+ 'toast-error-accent': #ff5757,
108
+ 'toast-success-bg': #0a150ff8,
109
109
  'toast-success-border': #133914,
110
- 'toast-success-accent': #4eee89,
111
- 'toast-warn-bg': #19100a,
110
+ 'toast-success-accent': #56e87f,
111
+ 'toast-warn-bg': #19100af8,
112
112
  'toast-warn-border': #311e12,
113
- 'toast-warn-accent': map-get($warning-palette, 500),
113
+ 'toast-warn-accent': #ffab1b,
114
114
 
115
115
  // Scrollbar & Sliders
116
116
  'scroll-bg': map-get($gray-palette, 800),
@@ -35,18 +35,18 @@ $orange-company-light-theme-config: (
35
35
  'button-grayscale': #d0d0d0b3,
36
36
 
37
37
  // Feedback
38
- 'toast-info-bg': #ecf4fbf8,
39
- 'toast-info-border': #c8dcf2f8,
40
- 'toast-info-accent': #2d82d7,
41
- 'toast-error-bg': #fadfdff8,
42
- 'toast-error-border': #f1b5b6f8,
43
- 'toast-error-accent': #d1282b,
44
- 'toast-success-bg': #e1fddaf8,
45
- 'toast-success-border': #b2f1acf8,
46
- 'toast-success-accent': #077f37,
47
- 'toast-warn-bg': #f6e7cbf9,
48
- 'toast-warn-border': #f0c7a8f8,
49
- 'toast-warn-accent': #8d660b,
38
+ 'toast-info-bg': #fbfdfff8,
39
+ 'toast-info-border': #d0ddea,
40
+ 'toast-info-accent': #1e69a7,
41
+ 'toast-error-bg': #fffcfcf8,
42
+ 'toast-error-border': #ead0d0,
43
+ 'toast-error-accent': #ba2e2e,
44
+ 'toast-success-bg': #fcfffcf8,
45
+ 'toast-success-border': #d1ead0,
46
+ 'toast-success-accent': #1e8f2d,
47
+ 'toast-warn-bg': #fffefbf8,
48
+ 'toast-warn-border': #eae3d0,
49
+ 'toast-warn-accent': #a96d18,
50
50
 
51
51
  // Scrollbar & Sliders
52
52
  'scroll-bg': #FFEDD4,
@@ -99,18 +99,18 @@ $orange-company-dark-theme-config: (
99
99
  'button-grayscale': #2e2e2eb1,
100
100
 
101
101
  // Feedback
102
- 'toast-info-bg': #080c11f5,
103
- 'toast-info-border': #112338f5,
104
- 'toast-info-accent': #80c6ffcd,
105
- 'toast-error-bg': #190b0bf9,
106
- 'toast-error-border': #391111f9,
107
- 'toast-error-accent': #dd6363,
108
- 'toast-success-bg': #0c130df8,
109
- 'toast-success-border': #183519f8,
110
- 'toast-success-accent': #52bc67,
111
- 'toast-warn-bg': #18130df5,
112
- 'toast-warn-border': #3a2211f5,
113
- 'toast-warn-accent': #e7a34b,
102
+ 'toast-info-bg': #0c0d0ef8,
103
+ 'toast-info-border': #17202b,
104
+ 'toast-info-accent': #5fb7c3,
105
+ 'toast-error-bg': #0e0c0cf8,
106
+ 'toast-error-border': #2b1717,
107
+ 'toast-error-accent': #f76d6d,
108
+ 'toast-success-bg': #0c0e0cf8,
109
+ 'toast-success-border': #172b18,
110
+ 'toast-success-accent': #5fc370,
111
+ 'toast-warn-bg': #0e0d0cf8,
112
+ 'toast-warn-border': #2b2317,
113
+ 'toast-warn-accent': #e4ad55,
114
114
 
115
115
  // Scroll & Sliders
116
116
  'scroll-bg': #712000,