@filip.mazev/blocks-core 1.0.16 → 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.16",
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';
@@ -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
+ }
@@ -67,8 +67,7 @@ $z-index: (
67
67
  dropdown: 100,
68
68
  sticky: 200,
69
69
  fixed: 300,
70
- modal-backdrop: 400,
71
- modal: 410,
70
+ modal: 400,
72
71
  popover: 500,
73
72
  tooltip: 600,
74
73
  toast: 9999,