@mevbg/design-essentials-vendor 2.0.0

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.
Files changed (143) hide show
  1. package/README.md +2340 -0
  2. package/dist/defaults.d.ts +8 -0
  3. package/dist/defaults.js +137 -0
  4. package/dist/defaults.js.map +1 -0
  5. package/dist/generators/favicons/favicons.generator.d.ts +4 -0
  6. package/dist/generators/favicons/favicons.generator.js +58 -0
  7. package/dist/generators/favicons/favicons.generator.js.map +1 -0
  8. package/dist/generators/favicons/favicons.types.d.ts +7 -0
  9. package/dist/generators/favicons/favicons.types.js +5 -0
  10. package/dist/generators/favicons/favicons.types.js.map +1 -0
  11. package/dist/generators/font-faces/font-faces.generator.d.ts +2 -0
  12. package/dist/generators/font-faces/font-faces.generator.js +123 -0
  13. package/dist/generators/font-faces/font-faces.generator.js.map +1 -0
  14. package/dist/generators/font-faces/font-faces.types.d.ts +11 -0
  15. package/dist/generators/font-faces/font-faces.types.js +5 -0
  16. package/dist/generators/font-faces/font-faces.types.js.map +1 -0
  17. package/dist/generators/icons/icons.generator.d.ts +2 -0
  18. package/dist/generators/icons/icons.generator.js +47 -0
  19. package/dist/generators/icons/icons.generator.js.map +1 -0
  20. package/dist/generators/icons/icons.types.d.ts +6 -0
  21. package/dist/generators/icons/icons.types.js +5 -0
  22. package/dist/generators/icons/icons.types.js.map +1 -0
  23. package/dist/generators/index.d.ts +7 -0
  24. package/dist/generators/index.js +13 -0
  25. package/dist/generators/index.js.map +1 -0
  26. package/dist/generators/master/master.generator.d.ts +3 -0
  27. package/dist/generators/master/master.generator.js +73 -0
  28. package/dist/generators/master/master.generator.js.map +1 -0
  29. package/dist/generators/master/master.types.d.ts +14 -0
  30. package/dist/generators/master/master.types.js +5 -0
  31. package/dist/generators/master/master.types.js.map +1 -0
  32. package/dist/generators/scrollbar/scrollbar.generator.d.ts +2 -0
  33. package/dist/generators/scrollbar/scrollbar.generator.js +109 -0
  34. package/dist/generators/scrollbar/scrollbar.generator.js.map +1 -0
  35. package/dist/generators/scrollbar/scrollbar.types.d.ts +11 -0
  36. package/dist/generators/scrollbar/scrollbar.types.js +5 -0
  37. package/dist/generators/scrollbar/scrollbar.types.js.map +1 -0
  38. package/dist/generators/tokens/handlers/basic.handler.d.ts +2 -0
  39. package/dist/generators/tokens/handlers/basic.handler.js +57 -0
  40. package/dist/generators/tokens/handlers/basic.handler.js.map +1 -0
  41. package/dist/generators/tokens/handlers/color.handler.d.ts +2 -0
  42. package/dist/generators/tokens/handlers/color.handler.js +117 -0
  43. package/dist/generators/tokens/handlers/color.handler.js.map +1 -0
  44. package/dist/generators/tokens/handlers/index.d.ts +3 -0
  45. package/dist/generators/tokens/handlers/index.js +7 -0
  46. package/dist/generators/tokens/handlers/index.js.map +1 -0
  47. package/dist/generators/tokens/handlers/utopia.handler.d.ts +2 -0
  48. package/dist/generators/tokens/handlers/utopia.handler.js +79 -0
  49. package/dist/generators/tokens/handlers/utopia.handler.js.map +1 -0
  50. package/dist/generators/tokens/platforms/css/formats.d.ts +2 -0
  51. package/dist/generators/tokens/platforms/css/formats.js +20 -0
  52. package/dist/generators/tokens/platforms/css/formats.js.map +1 -0
  53. package/dist/generators/tokens/platforms/css/index.d.ts +2 -0
  54. package/dist/generators/tokens/platforms/css/index.js +20 -0
  55. package/dist/generators/tokens/platforms/css/index.js.map +1 -0
  56. package/dist/generators/tokens/platforms/css/utils.d.ts +3 -0
  57. package/dist/generators/tokens/platforms/css/utils.js +12 -0
  58. package/dist/generators/tokens/platforms/css/utils.js.map +1 -0
  59. package/dist/generators/tokens/platforms/formats.d.ts +3 -0
  60. package/dist/generators/tokens/platforms/formats.js +7 -0
  61. package/dist/generators/tokens/platforms/formats.js.map +1 -0
  62. package/dist/generators/tokens/platforms/index.d.ts +8 -0
  63. package/dist/generators/tokens/platforms/index.js +83 -0
  64. package/dist/generators/tokens/platforms/index.js.map +1 -0
  65. package/dist/generators/tokens/platforms/js/formats.d.ts +2 -0
  66. package/dist/generators/tokens/platforms/js/formats.js +15 -0
  67. package/dist/generators/tokens/platforms/js/formats.js.map +1 -0
  68. package/dist/generators/tokens/platforms/js/index.d.ts +2 -0
  69. package/dist/generators/tokens/platforms/js/index.js +18 -0
  70. package/dist/generators/tokens/platforms/js/index.js.map +1 -0
  71. package/dist/generators/tokens/platforms/js/utils.d.ts +3 -0
  72. package/dist/generators/tokens/platforms/js/utils.js +20 -0
  73. package/dist/generators/tokens/platforms/js/utils.js.map +1 -0
  74. package/dist/generators/tokens/platforms/json/index.d.ts +2 -0
  75. package/dist/generators/tokens/platforms/json/index.js +24 -0
  76. package/dist/generators/tokens/platforms/json/index.js.map +1 -0
  77. package/dist/generators/tokens/platforms/scss/formats.d.ts +2 -0
  78. package/dist/generators/tokens/platforms/scss/formats.js +15 -0
  79. package/dist/generators/tokens/platforms/scss/formats.js.map +1 -0
  80. package/dist/generators/tokens/platforms/scss/index.d.ts +2 -0
  81. package/dist/generators/tokens/platforms/scss/index.js +15 -0
  82. package/dist/generators/tokens/platforms/scss/index.js.map +1 -0
  83. package/dist/generators/tokens/platforms/scss/utils.d.ts +3 -0
  84. package/dist/generators/tokens/platforms/scss/utils.js +15 -0
  85. package/dist/generators/tokens/platforms/scss/utils.js.map +1 -0
  86. package/dist/generators/tokens/tokens.generator.d.ts +3 -0
  87. package/dist/generators/tokens/tokens.generator.js +52 -0
  88. package/dist/generators/tokens/tokens.generator.js.map +1 -0
  89. package/dist/generators/tokens/tokens.types.d.ts +17 -0
  90. package/dist/generators/tokens/tokens.types.js +12 -0
  91. package/dist/generators/tokens/tokens.types.js.map +1 -0
  92. package/dist/generators/tokens/types/color-scheme.types.d.ts +13 -0
  93. package/dist/generators/tokens/types/color-scheme.types.js +29 -0
  94. package/dist/generators/tokens/types/color-scheme.types.js.map +1 -0
  95. package/dist/generators/tokens/types/format.types.d.ts +52 -0
  96. package/dist/generators/tokens/types/format.types.js +35 -0
  97. package/dist/generators/tokens/types/format.types.js.map +1 -0
  98. package/dist/generators/tokens/types/platform.types.d.ts +33 -0
  99. package/dist/generators/tokens/types/platform.types.js +36 -0
  100. package/dist/generators/tokens/types/platform.types.js.map +1 -0
  101. package/dist/generators/tokens/types/tokens.types.d.ts +27 -0
  102. package/dist/generators/tokens/types/tokens.types.js +41 -0
  103. package/dist/generators/tokens/types/tokens.types.js.map +1 -0
  104. package/dist/generators/tokens/types/utopia-scheme.types.d.ts +4 -0
  105. package/dist/generators/tokens/types/utopia-scheme.types.js +5 -0
  106. package/dist/generators/tokens/types/utopia-scheme.types.js.map +1 -0
  107. package/dist/generators/tokens/utils/color-tokens.utils.d.ts +8 -0
  108. package/dist/generators/tokens/utils/color-tokens.utils.js +24 -0
  109. package/dist/generators/tokens/utils/color-tokens.utils.js.map +1 -0
  110. package/dist/generators/tokens/utils/formats.utils.d.ts +17 -0
  111. package/dist/generators/tokens/utils/formats.utils.js +164 -0
  112. package/dist/generators/tokens/utils/formats.utils.js.map +1 -0
  113. package/dist/generators/tokens/utils/utopia-tokens.utils.d.ts +10 -0
  114. package/dist/generators/tokens/utils/utopia-tokens.utils.js +56 -0
  115. package/dist/generators/tokens/utils/utopia-tokens.utils.js.map +1 -0
  116. package/dist/generators/viewport-scaler/viewport-scaler.generator.d.ts +2 -0
  117. package/dist/generators/viewport-scaler/viewport-scaler.generator.js +56 -0
  118. package/dist/generators/viewport-scaler/viewport-scaler.generator.js.map +1 -0
  119. package/dist/generators/viewport-scaler/viewport-scaler.types.d.ts +7 -0
  120. package/dist/generators/viewport-scaler/viewport-scaler.types.js +5 -0
  121. package/dist/generators/viewport-scaler/viewport-scaler.types.js.map +1 -0
  122. package/dist/index.d.ts +2 -0
  123. package/dist/index.js +11 -0
  124. package/dist/index.js.map +1 -0
  125. package/dist/types/generator.types.d.ts +2 -0
  126. package/dist/types/generator.types.js +5 -0
  127. package/dist/types/generator.types.js.map +1 -0
  128. package/dist/types/index.d.ts +8 -0
  129. package/dist/types/index.js +12 -0
  130. package/dist/types/index.js.map +1 -0
  131. package/dist/types/utils.types.d.ts +2 -0
  132. package/dist/types/utils.types.js +5 -0
  133. package/dist/types/utils.types.js.map +1 -0
  134. package/dist/utils/formats.utils.d.ts +14 -0
  135. package/dist/utils/formats.utils.js +24 -0
  136. package/dist/utils/formats.utils.js.map +1 -0
  137. package/dist/utils/generators.utils.d.ts +2 -0
  138. package/dist/utils/generators.utils.js +39 -0
  139. package/dist/utils/generators.utils.js.map +1 -0
  140. package/dist/utils/strings.utils.d.ts +5 -0
  141. package/dist/utils/strings.utils.js +46 -0
  142. package/dist/utils/strings.utils.js.map +1 -0
  143. package/package.json +91 -0
package/README.md ADDED
@@ -0,0 +1,2340 @@
1
+ # Mev’s Design Essentials Vendor
2
+
3
+ > A simple vendor of design system essentials
4
+
5
+ ## 🎯 Overview
6
+
7
+ _[Mev](https://mev.bg)’s Design Essentials Vendor_ (**mDEV**) is a full-fledged factory for generating essential assets used to scaffold a robust Design System. Built on top of [Style Dictionary](https://styledictionary.com/) and [Favicons](https://www.npmjs.com/package/favicons), it delivers a strongly opinionated and production-ready foundation of assets, tokens and utilities — aligned with Mev’s principle for creating resilient and stable UIs.
8
+
9
+ The existence of this module is justified by the need for a single source of assets and pre-programmed models that define a proven-effective look and feel, while embodying shared values and concepts in the development of web interfaces.
10
+
11
+ ## 📚 Core Philosophies
12
+
13
+ **mDEV** is built upon several core philosophies in modern web interface development — philosophies that have proven themselves as effective, proven concepts, evolving into long-term, foundational principles applied unconditionally across projects.
14
+
15
+ This section explores the essence of those philosophies in detail.
16
+
17
+ ### Color Scheme Philosophy
18
+
19
+ The **Color Scheme Philosophy** represents a fundamental belief that has evolved into an unconditional principle: **providing support for light/dark color schemes is now a critical requirement for every web environment, without exception**.
20
+
21
+ This philosophy is built upon the recognition that modern users expect seamless adaptation to their visual preferences and environmental conditions. Whether working in bright daylight or low-light environments, users deserve interfaces that respect their comfort and accessibility needs.
22
+
23
+ However, this philosophy extends beyond mere system synchronization. While automatic detection and adaptation to system preferences is essential, **it is equally crucial to recognize the user’s absolute right to override and lock their preferred color scheme, even when it conflicts with their system settings**.
24
+
25
+ This dual approach — system-aware yet user-empowering — ensures that:
26
+
27
+ - **Accessibility is prioritized**: Users with visual impairments or specific needs can maintain their preferred contrast settings
28
+ - **User autonomy is respected**: Personal preferences take precedence over automated decisions
29
+ - **Consistency is maintained**: Once a user makes a choice, it should persist across sessions until explicitly changed
30
+ - **System integration remains intact**: Default behavior still honors system preferences for users who haven’t made explicit choices
31
+
32
+ This philosophy has been field-tested across numerous projects and has proven to be not just a feature, but a **fundamental right** that every web interface must provide. It’s a principle that transcends technical implementation — it’s about respecting user agency and ensuring digital environments adapt to humans, not the other way around.
33
+
34
+ This is precisely why **mDEV** includes a specially crafted and embedded system for processing color-related design tokens, ensuring that the generated CSS output is fully equipped to cover all the principles described above.
35
+
36
+ ### Utopia Scheme Philosophy
37
+
38
+ The **Utopia Scheme Philosophy** represents a collaborative approach that begins with designers’ perceptions but evolves into a mutual effort and shared success. This philosophy addresses a fundamental challenge in modern web design: **creating truly responsive typography and spacing that adapts intelligently across different device sizes and viewing distances**.
39
+
40
+ This philosophy is deeply inspired by and aligned to some degree with the [Utopia.fyi](https://utopia.fyi) concept — a testament to the fact that this approach resonates with the broader design community and represents a shared vision for better responsive design practices.
41
+
42
+ The fundamental challenge this philosophy addresses is the inadequacy of traditional responsive design approaches when it comes to typography and spacing. The old-fashioned approach of jumping from breakpoint to breakpoint, with static values remaining unchanged in the range between two breakpoints, creates jarring and inconsistent user experiences.
43
+
44
+ True responsiveness is not about discrete jumps from point to point, but about **smooth scaling of typography and spacing** that adapts fluidly across the entire viewport spectrum. This philosophy recognizes that **typography and spacing must scale proportionally to viewing distance, not just screen size**, accounting for the fundamental differences in how users interact with different devices:
45
+
46
+ - **Mobile devices** are typically held closer to the eyes (30-40cm)
47
+ - **Tablets** are viewed at medium distances (40-60cm)
48
+ - **Desktop screens** are positioned further away (60-80cm or more)
49
+
50
+ These varying distances create different visual experiences and readability requirements that simple breakpoint-based scaling cannot adequately address.
51
+
52
+ This philosophy has become a **foundational principle** when defining design tokens related to typography, spacing, and other dimensional elements. It’s a conviction that has been validated across numerous projects and has proven to be essential for creating truly accessible and comfortable reading experiences across all devices.
53
+
54
+ The implementation of this philosophy ensures that:
55
+
56
+ - **Reading comfort is optimized**: Text scales appropriately for each device’s typical viewing distance
57
+ - **Visual hierarchy is maintained**: Proportional relationships between elements remain consistent
58
+ - **Accessibility is enhanced**: Text remains readable regardless of device or viewing conditions
59
+ - **Design consistency is preserved**: The same design principles apply across all screen sizes
60
+
61
+ This is why **mDEV** features a sophisticated token processing engine that generates fluid, responsive CSS with mathematical precision, delivering the smooth scaling capabilities needed to implement these principles effectively.
62
+
63
+ ### Viewport Scale Philosophy
64
+
65
+ The **Viewport Scale Philosophy** represents a fundamental belief that has evolved into an unconditional principle: **every web interface must scale gracefully from near-zero widths to beyond 4K screens, without artificial limits or hard edges**.
66
+
67
+ This philosophy stems from the recognition that **even invisible details matter** — like the craftsmanship on the back of a handmade wardrobe or the smooth underside of a sculptor’s marble base. In web development, this translates to treating the outer edges of responsiveness with the same care as the visible content.
68
+
69
+ The primary issue this philosophy tackles is the inadequacy of traditional responsive design approaches that enforce strict minimums and maximums. Most developers define responsive systems between breakpoints like `320px` and `1920px`, treating anything outside that range as an afterthought. This creates two critical issues:
70
+
71
+ - **On tiny screens** (below `320px`), horizontal scrollbars appear, buttons overflow, and layouts break, reducing elegant compositions to chaos
72
+ - **On ultrawide monitors or presentation screens**, designs feel artificially constrained, with oceans of empty space or rigid boxes that look tiny from across a room
73
+
74
+ Both scenarios break user immersion and communicate: _"This website wasn’t made for your screen"_.
75
+
76
+ The **"responsive from zero to infinity"** approach ensures **full proportional coverage** regardless of screen size, embracing elegance where many choose compromise. The key lies in dynamically adjusting the root `font-size`, which cascades through all rem-based spacing, typography, and layout.
77
+
78
+ This philosophy has matured into an **unconditional principle** when defining viewport scaling strategies. It’s a conviction that has been validated across numerous projects and has proven essential for creating truly timeless and screen-proof interfaces.
79
+
80
+ The implementation of this philosophy ensures these:
81
+
82
+ - **Full proportional coverage**: No screen size is left behind
83
+ - **Zero layout breakage**: Graceful scaling in both directions
84
+ - **Elegant scaling**: Mathematical precision without compromise
85
+ - **Optional presentation support**: Fluid scaling for big displays when needed
86
+
87
+ **mDEV** tackles this challenge through its dedicated viewport scaler feature, which generates mathematically precise CSS that delivers the fluid scaling capabilities needed to implement these principles effectively.
88
+
89
+ ### Icons System Philosophy
90
+
91
+ The **Icons System Philosophy** represents a fundamental belief that has evolved into an unconditional principle: **icon font systems should be preferred over individual SVG files for comprehensive icon management in web interfaces**.
92
+
93
+ This philosophy stems from two core convictions that have proven themselves across numerous projects:
94
+
95
+ **1. Baseline alignment control remains in designers’ hands**: Icon fonts provide precise control over vertical alignment, ensuring consistent positioning across different contexts and screen sizes. Unlike SVG files that require manual adjustment for each implementation, icon fonts maintain baseline consistency automatically, allowing designers to focus on visual hierarchy rather than technical alignment issues.
96
+
97
+ **2. Variable fonts revolutionize the game**: The emergence of variable font technology has fundamentally transformed icon system capabilities. Modern icon fonts now support dynamic switching between multiple visual styles — outlined, rounded, sharp, filled — as well as weight variations, grade adjustments, and optical size optimization. This level of flexibility was previously impossible with static SVG files and represents a paradigm shift in icon system design.
98
+
99
+ The central challenge this philosophy confronts is the fragmentation and inconsistency that often results from managing individual SVG icon files. Traditional approaches require separate files for each icon variant, leading to maintenance overhead, inconsistent sizing, and alignment challenges across different contexts.
100
+
101
+ This philosophy has solidified as an **unconditional principle** when defining icon system strategies. It’s a conviction that has been validated across numerous projects and has proven essential for creating truly scalable and maintainable icon systems.
102
+
103
+ The implementation of this philosophy ensures that:
104
+
105
+ - **Consistent alignment**: Automatic baseline consistency across all contexts
106
+ - **Scalable management**: Single font file instead of hundreds of individual SVGs
107
+ - **Dynamic flexibility**: Variable font capabilities for multiple visual styles
108
+ - **Performance optimization**: Reduced HTTP requests and better caching
109
+ - **Designer empowerment**: Focus on visual design rather than technical implementation
110
+
111
+ **mDEV** confronts this challenge through its dedicated icon font generator, which produces CSS with selectors for a complete icon matrix from a given font, delivering the comprehensive icon system capabilities needed to implement these principles effectively.
112
+
113
+ ### Design Tokens Philosophy
114
+
115
+ The **Design Tokens Philosophy** represents a widely accepted and long-established principle in modern web development: **all design values should be defined as named tokens rather than hardcoded values in CSS**.
116
+
117
+ This philosophy has been embraced by the design and development community for years, which is why tools like [Style Dictionary](https://styledictionary.com/) have emerged to support this approach. The motivation for quality code and easy maintenance is just one of the arguments for defining tokens with values.
118
+
119
+ The fundamental principle is that **when writing CSS, static values should never be assigned directly**. In an ideal world, all values should come from a predefined collection of values with meaningful names that reflect their purpose and context. This approach ensures consistency, maintainability, and semantic clarity across the entire design system.
120
+
121
+ Another vital criterion is **cross-platform support**, which guarantees the use of the same values across different programming environments, regardless of whether it’s CSS, JavaScript, Sass, or any other platform. This unified approach eliminates inconsistencies and ensures that design decisions are consistently applied across all implementation contexts.
122
+
123
+ The fundamental issue this philosophy resolves is the chaos and inconsistency that results from scattered hardcoded values throughout codebases. Traditional approaches lead to maintenance nightmares, inconsistent implementations, and design drift that makes systems increasingly difficult to manage over time.
124
+
125
+ This philosophy has crystallized as an **unconditional principle** when defining design system architecture. It’s a conviction that has been validated across numerous projects and has proven essential for creating truly maintainable and scalable design systems.
126
+
127
+ The implementation of this philosophy ensures that:
128
+
129
+ - **Consistency is guaranteed**: Same values used across all platforms and contexts
130
+ - **Maintainability is enhanced**: Changes in one place propagate everywhere
131
+ - **Semantic clarity is achieved**: Values have meaningful names that reflect their purpose
132
+ - **Cross-platform harmony**: Unified design language across all implementation environments
133
+ - **Future-proof architecture**: Systems that can evolve without breaking existing implementations
134
+
135
+ **mDEV** resolves this challenge through its dedicated tokens generator, which produces tokens for specific platforms, ensuring the origin and consistency of all design values across the entire system.
136
+
137
+ ## 🚀 Features
138
+
139
+ Currently, **mDEV** provides the ability to produce 6️⃣ established essentials, each of which is described as a feature in this section. Every feature has its own (so called) _Generator_ and the list of these will most likely continue to grow as new needs and capabilities emerge.
140
+
141
+ > The technical specifications of the generators and the ways they can be utilized are described further down in [Usage of Generators](#️-usage-of-generators) section.
142
+
143
+ ### Design Tokens Feature
144
+
145
+ This feature represents one of the core and primary functionalities of the **mDEV** module — the ability to generate specially formatted design tokens output using Style Dictionary, covering all the principles described in the Core Philosophies section. This feature enables the creation of a unified design system foundation that ensures consistency, maintainability, and cross-platform harmony across all implementation environments.
146
+
147
+ > Examples of partial output with design tokens for CSS and JS can be seen in the [Design Tokens Output Example](#design-tokens-output-example) section.
148
+
149
+ ### Viewport Scaler Feature
150
+
151
+ This feature provides a ready-made CSS file with dynamic root font size, defined as a CSS custom property that changes its value based on specified parameters. It also provides a presentation mode class, ensuring full proportional coverage across all screen sizes with zero layout breakage and elegant mathematical scaling, which embodies the principles of the Viewport Scale philosophy.
152
+
153
+ > An example of the CSS output can be seen in the [Viewport Scaler Output Example](#viewport-scaler-output-example) section.
154
+
155
+ ### Scrollbar Feature
156
+
157
+ This feature deals with the creation of a CSS file with styles for styling native scrollbar elements in a given web environment, transforming them into elegant-looking indicators. It implements refined, context-aware styling that treats scrollbars as first-class UI elements, ensuring they blend seamlessly with the overall design while providing essential visual feedback for content length and scroll progress.
158
+
159
+ > An example of the CSS output can be seen in the [Scrollbar Output Example](#scrollbar-output-example) section.
160
+
161
+ ### Font Faces Feature
162
+
163
+ This feature handles the generation of `@font-face` declarations in CSS when attaching self-hosted local fonts. The functionality is designed to work by scanning a provided directory containing fonts and matching them with a provided brief description of the names of different styles and which name corresponds to which font-weight. The system scans the provided directory, discovers what styles are available, maps them to the provided configuration, and generates a CSS file with all necessary `@font-face` declarations. The system recognizes the availability of Italic styles for given weights and works only with `woff2` file format.
164
+
165
+ > An example of the CSS output can be seen in the [Font Faces Output Example](#font-faces-output-example) section.
166
+
167
+ ### Icons Feature
168
+
169
+ This feature generates comprehensive CSS selectors for a given icon font based on provided name-to-unicode mappings. It creates individual `::after` pseudo-selectors for each glyph in the font, enabling precise targeting and visualization of specific icons. This approach delivers a complete, ready-to-use icon system that simplifies icon implementation across projects.
170
+
171
+ > An example of the CSS output can be seen in the [Icons Output Example](#icons-output-example) section.
172
+
173
+ ### Favicons Feature
174
+
175
+ This feature leverages the [favicons](https://www.npmjs.com/package/favicons) module to generate a comprehensive suite of icons for all platforms, devices, and web services based on specified parameters. Beyond traditional favicons, it produces startup splash screens and a web app manifest, effectively delivering production-ready assets for authentic Progressive Web Applications (PWAs). This comprehensive approach ensures complete platform coverage and professional-grade icon implementation across all target environments.
176
+
177
+ > An example of the generated files list can be seen in the [Favicons Output Example](#favicons-output-example) section.
178
+
179
+ ## 📦 Installation
180
+
181
+ ### npm
182
+
183
+ ```bash
184
+ npm install @mevbg/design-essentials-vendor --save-dev
185
+ ```
186
+
187
+ ### pnpm
188
+
189
+ ```bash
190
+ pnpm add @mevbg/design-essentials-vendor --save-dev
191
+ ```
192
+
193
+ ### yarn
194
+
195
+ ```bash
196
+ yarn add @mevbg/design-essentials-vendor --ds
197
+ ```
198
+
199
+ ## ⚙️ Usage of Generators
200
+
201
+ As outlined in the [Features](#-features) section, each feature is implemented through a dedicated function responsible for producing its corresponding output. These functions are referred to as _Generators_.
202
+
203
+ The defined type for a _Generator_ function is as follows:
204
+
205
+ ```ts
206
+ type GeneratorFn<T, Response = StyleDictionary> = (params: T) => Promise<Response>;
207
+ ```
208
+
209
+ • `T` represents the type of parameters expected by the specific generator;
210
+ • `Response` represents the return type of the Promise that the generator resolves to. By default, this is a `StyleDictionary` object, as it is the most commonly returned type.
211
+
212
+ ---
213
+
214
+ **mDEV**’s API exposes all individual generators, enabling selective usage when only a subset of features is required — although such scenarios are considered unlikely.
215
+
216
+ In addition to the six generators currently available, **mDEV** also provides a **Master Generator**, exposed as `generateDesignEssentials`. This central utility allows all features to be executed at once by triggering all six feature-based generators in a single operation.
217
+
218
+ ### Master Generator
219
+
220
+ (_exposed as_ `generateDesignEssentials`)
221
+
222
+ ```ts
223
+ generateDesignEssentials: GeneratorFn<MasterGeneratorParams, void>;
224
+ ```
225
+
226
+ The _Master Generator_ is the primary (and preferred) way to use this vendor. As mentioned above, it utilizes the full capabilities of the module and can produce output from all developed and supported features.
227
+
228
+ The _Master Generator_ itself does not generate any output. Its role is to trigger all content-producing generators — or more precisely, only those specified in its input parameters, since selective execution is supported.
229
+
230
+ #### Master Generator Parameters
231
+
232
+ At the root level, the Master Generator accepts four parameters:
233
+ `buildPath` | `prefix` | `baseFontSize` | `generators`
234
+
235
+ Here is the type definition for the parameters:
236
+
237
+ ```ts
238
+ type MasterGeneratorParams = {
239
+ buildPath?: string;
240
+ prefix?: string;
241
+ baseFontSize?: number;
242
+ generators: {
243
+ tokens?: TokensGeneratorParams;
244
+ viewportScaler?: ViewportScalerGeneratorParams;
245
+ fontFaces?: FontFacesGeneratorParams;
246
+ icons?: IconsGeneratorParams;
247
+ scrollbar?: ScrollbarGeneratorParams;
248
+ favicons?: FaviconsGeneratorParams;
249
+ };
250
+ };
251
+ ```
252
+
253
+ Of all four parameters, only the `generators` object is **required**, as it must explicitly specify which generators will be used, along with the corresponding parameters for each. Default values are provided for the remaining three. Here are more details:
254
+
255
+ ##### **`buildPath`**
256
+
257
+ **Type**: `string` _(optional)_
258
+ **Default**: `'dist'`
259
+ **Description**: This field specifies the path to the directory where the generated output should be placed. If no path is provided, a `dist` directory will be created at the root of the project from which the process is executed.
260
+
261
+ ##### **`prefix`**
262
+
263
+ **Type**: `string` _(optional)_
264
+ **Default**: `'ds'` _(stands for "Design System")_
265
+ **Description**: This prefix is used exclusively by Style Dictionary when generating CSS Custom Properties.
266
+ It is primarily utilized by the Viewport Scaler Generator and Tokens Generator, as both produce CSS output containing custom properties whose names are structured using this prefix.
267
+
268
+ ##### **`baseFontSize`**
269
+
270
+ **Type**: `number` _(optional)_
271
+ **Default**: `10`
272
+ **Description**: This value defines the base font size of the web document, from which all relative `rem` units are derived. It also serves as the foundation for the CSS formulas that are integral to both Scaling Layout logic and Content Scaling logic. More details about these two strategies can be found further down in this documentation.
273
+
274
+ ##### **`generators`**
275
+
276
+ **Type**: `object` **_(required)_**
277
+ **Description**: This object accepts optional properties corresponding to the available feature-based generators. Each property represents a configuration object that contains the necessary parameters for the respective feature. Only the generators with a configuration object provided will produce output. If an empty object `{}` is passed to `generators`, no output will be generated at all. Some generators require mandatory configuration fields, and their usage depends on providing those parameters. Others have default values for all parameters, in which case passing an empty object `{}` is sufficient to trigger production. Detailed information about the required and optional parameters for each generator is provided further down in this documentation.
278
+
279
+ #### Usage of Master Generator
280
+
281
+ ```ts
282
+ import { generateDesignEssentials } from ’@mevbg/design-essentials-vendor’;
283
+
284
+ try {
285
+ await generateDesignEssentials({
286
+ buildPath: ’./dist’,
287
+ prefix: ’mev’,
288
+ baseFontSize: 16,
289
+ generators: {
290
+ favicons: {
291
+ id: ’https://mev.bg’,
292
+ sourcePath: ’assets/images/logo.svg’,
293
+ appName: ’Mev.bg’,
294
+ appShortName: ’Mev’,
295
+ appDescription: ’Personal webpage’,
296
+ version: ’1.0.0’
297
+ },
298
+ fontFaces: {
299
+ sourcePath: ’assets/client/fonts’,
300
+ fonts: {
301
+ Helvetica: {
302
+ Regular: 400,
303
+ Bold: 700
304
+ }
305
+ }
306
+ },
307
+ icons: {
308
+ fontFamily: ’MevIcons’,
309
+ color: ’var(--mev-color-content-gray)’,
310
+ list: {
311
+ main: ’E000’,
312
+ nav: ’E001’,
313
+ search: ’E002’,
314
+ profile: ’E003’
315
+ // ...
316
+ },
317
+ viewportScaler: {},
318
+ scrollbar: {},
319
+ tokens: {
320
+ sourcePath: ’./design/tokens/**/index.js’,
321
+ platforms: [’css’, ’js’, ’scss’],
322
+ contentScaling: {
323
+ minViewportW: 600,
324
+ maxViewportW: 1200
325
+ },
326
+ colorScheme: {
327
+ default: ’light’,
328
+ method: ’combined’
329
+ }
330
+ }
331
+ }
332
+ }
333
+ });
334
+ console.info(’Design essentials generated successfully!’);
335
+ } catch (err) {
336
+ console.error(’Failed to generate design essentials:’, err.message);
337
+ }
338
+ ```
339
+
340
+ The configuration for each of the generators shown in the example above will make more sense after reading the documentation for their purpose in the following sections.
341
+
342
+ ### Tokens Generator
343
+
344
+ (_exposed as_ `generateTokens`)
345
+
346
+ ```ts
347
+ generateTokens: GeneratorFn<TokensGeneratorParams, void>;
348
+ ```
349
+
350
+ The _Tokens Generator_ is one of the most complex and feature-rich generators in this vendor. It leverages the power of Style Dictionary to transform design tokens from source files into multiple output formats. The generator supports various platforms (CSS, SCSS, JavaScript, JSON), implements color scheme management, and includes Utopia fluid typography scaling.
351
+
352
+ The _Tokens Generator_ processes design tokens from specified source files and generates platform-specific output files based on the configuration provided. It supports advanced features like color scheme switching, fluid typography scaling, and multiple output formats simultaneously.
353
+
354
+ #### Tokens Generator Parameters
355
+
356
+ The Tokens Generator accepts several parameters that control its behavior and output:
357
+
358
+ ```ts
359
+ type TokensGeneratorParams = {
360
+ sourcePath: string;
361
+ platforms?: PlatformType[];
362
+ prefix?: string;
363
+ baseFontSize?: number;
364
+ colorScheme?: ColorSchemeParams;
365
+ utopiaScheme?: UtopiaSchemeParams;
366
+ buildPath?: string;
367
+ };
368
+ ```
369
+
370
+ Of all parameters, only `sourcePath` is **required** as it specifies where the design token source files are located. All other parameters have sensible defaults. Here are more details:
371
+
372
+ ##### **`sourcePath`**
373
+
374
+ **Type**: `string` **_(required)_**
375
+ **Description**: This field specifies the path to the directory or glob pattern where the design token source files are located. These files should contain the raw design tokens that will be processed and transformed into the specified output formats.
376
+
377
+ ##### **`platforms`**
378
+
379
+ **Type**: `PlatformType[]` _(optional)_
380
+ **Default**: `['css', 'scss', 'js', 'json']`
381
+ **Description**: This array specifies which output platforms should be generated. Available options are:
382
+
383
+ - `'css'` - Generates CSS files with CSS Custom Properties
384
+ - `'scss'` - Generates SCSS files with SCSS variables
385
+ - `'js'` - Generates JavaScript files with static values and CSS custom properties
386
+ - `'json'` - Generates JSON files with all tokens
387
+
388
+ <!-- markdownlint-disable-next-line MD024 -->
389
+ ##### **`prefix`**
390
+
391
+ **Type**: `string` _(optional)_
392
+ **Default**: `'ds'` _(stands for "Design System")_
393
+ **Description**: This prefix is used by Style Dictionary when generating CSS Custom Properties and other prefixed outputs. It helps namespace the generated tokens to avoid conflicts.
394
+
395
+ <!-- markdownlint-disable-next-line MD024 -->
396
+ ##### **`baseFontSize`**
397
+
398
+ **Type**: `number` _(optional)_
399
+ **Default**: `10`
400
+ **Description**: This value defines the base font size used for calculating relative units and fluid typography scaling. It serves as the foundation for Utopia scheme calculations.
401
+
402
+ ##### **`colorScheme`**
403
+
404
+ **Type**: `ColorSchemeParams` _(optional)_
405
+ **Default**: `{ default: 'light', method: 'combined' }`
406
+ **Description**: This object configures color scheme behavior. It contains:
407
+
408
+ - `default` - The default color scheme (`'light'` or `'dark'`)
409
+ - `method` - The method for applying color schemes:
410
+ - `'media'` - Uses `prefers-color-scheme` media query
411
+ - `'class'` - Uses CSS classes on the root element
412
+ - `'combined'` - Uses both methods with class priority
413
+
414
+ ##### **`utopiaScheme`**
415
+
416
+ **Type**: `UtopiaSchemeParams` _(optional)_
417
+ **Default**: `{ minViewportW: 600, maxViewportW: 1200 }`
418
+ **Description**: This object configures Utopia fluid typography scaling. It contains:
419
+
420
+ - `minViewportW` - Minimum viewport width for scaling _(in pixels)_
421
+ - `maxViewportW` - Maximum viewport width for scaling _(in pixels)_
422
+
423
+ <!-- markdownlint-disable-next-line MD024 -->
424
+ ##### **`buildPath`**
425
+
426
+ **Type**: `string` _(optional)_
427
+ **Default**: `'dist'`
428
+ **Description**: This field specifies the path to the directory where the generated output files should be placed.
429
+
430
+ #### Usage of Tokens Generator
431
+
432
+ ```ts
433
+ import { generateTokens } from '@mevbg/design-essentials-vendor';
434
+
435
+ try {
436
+ await generateTokens({
437
+ sourcePath: './design/tokens/**/index.js',
438
+ platforms: ['css', 'scss', 'js', 'json'],
439
+ prefix: 'mev',
440
+ baseFontSize: 16,
441
+ colorScheme: {
442
+ default: 'light',
443
+ method: 'combined'
444
+ },
445
+ utopiaScheme: {
446
+ minViewportW: 600,
447
+ maxViewportW: 1200
448
+ },
449
+ buildPath: './dist/tokens'
450
+ });
451
+ console.info('Design tokens generated successfully!');
452
+ } catch (err) {
453
+ console.error('Failed to generate design tokens:', err.message);
454
+ }
455
+ ```
456
+
457
+ The configuration above will:
458
+
459
+ - Process design tokens from files matching the glob pattern `./design/tokens/**/index.js`
460
+ - Generate output for CSS, SCSS, and JavaScript platforms
461
+ - Use the prefix `mev` for all generated CSS custom properties
462
+ - Set up a base font size of 16px for calculations
463
+ - Configure a light-first color scheme with combined media query and class support
464
+ - Enable Utopia fluid typography scaling between 600px and 1200px viewport widths
465
+ - Output all files to the `./dist/tokens` directory
466
+
467
+ #### Tokens Generated Output
468
+
469
+ The generator produces platform-specific output files based on the configured platforms:
470
+
471
+ **CSS Platform**:
472
+
473
+ - `all.css` - Complete CSS file with all tokens as CSS custom properties
474
+ - `color.css` - Color tokens only
475
+ - `typography.css` - Typography tokens only
476
+ - `spacing.css` - Spacing and sizing tokens
477
+ - `border.css` - Border and shadow tokens
478
+ - `others.css` - Any additional token categories
479
+
480
+ **SCSS Platform**:
481
+
482
+ - `all.scss` - Complete SCSS file with all tokens as SCSS variables
483
+ - Individual token type files (same structure as CSS)
484
+
485
+ **JavaScript Platform**:
486
+
487
+ - `static.js` - JavaScript object with static token values
488
+ - `variable.js` - JavaScript object with CSS custom property references
489
+
490
+ **JSON Platform**:
491
+
492
+ - `all.json` - Complete JSON file with all tokens and their values
493
+
494
+ ### Viewport Scaler Generator
495
+
496
+ (_exposed as_ `generateViewportScaler`)
497
+
498
+ ```ts
499
+ generateViewportScaler: GeneratorFn<ViewportScalerGeneratorParams, void>;
500
+ ```
501
+
502
+ The _Viewport Scaler Generator_ is responsible for creating responsive layout scaling by dynamically adjusting the root font size based on viewport width. This approach enables true fluid scaling of all elements that use `rem` or `em` units, creating a more responsive and adaptive design system.
503
+
504
+ The _Viewport Scaler Generator_ generates CSS media queries that set the `--root-font-size` CSS custom property on the `:root` element. This property is then used as the foundation for all relative unit calculations, allowing the entire layout to scale proportionally with the viewport size.
505
+
506
+ #### Viewport Scaler Generator Parameters
507
+
508
+ The Viewport Scaler Generator accepts several parameters that control the scaling behavior:
509
+
510
+ ```ts
511
+ type ViewportScalerGeneratorParams = {
512
+ prefix?: string;
513
+ baseFontSize?: number;
514
+ minViewportW?: number;
515
+ maxViewportW?: number;
516
+ buildPath?: string;
517
+ };
518
+ ```
519
+
520
+ All parameters are **optional** and have sensible defaults. Here are more details:
521
+
522
+ <!-- markdownlint-disable-next-line MD024 -->
523
+ ##### **`prefix`**
524
+
525
+ **Type**: `string` _(optional)_
526
+ **Default**: `'ds'` _(stands for "Design System")_
527
+ **Description**: This prefix is used for the CSS custom property name to avoid conflicts with other custom properties. The generated property will be named `--{prefix}-root-font-size`.
528
+
529
+ <!-- markdownlint-disable-next-line MD024 -->
530
+ ##### **`baseFontSize`**
531
+
532
+ **Type**: `number` _(optional)_
533
+ **Default**: `10`
534
+ **Description**: This value defines the base font size used for calculating the scaling formula. It serves as the foundation for all viewport-based calculations.
535
+
536
+ ##### **`minViewportW`**
537
+
538
+ **Type**: `number` _(optional)_
539
+ **Default**: `300`
540
+ **Description**: This is the minimum viewport width _(in pixels)_ below which the viewport scaler is applied. Below this breakpoint, the root font size scales proportionally with the viewport width.
541
+
542
+ ##### **`maxViewportW`**
543
+
544
+ **Type**: `number` _(optional)_
545
+ **Default**: `2100`
546
+ **Description**: This is the maximum viewport width _(in pixels)_ above which the viewport scaler is applied in presentation mode. Above this breakpoint, the root font size scales proportionally with the viewport width when the `html.presentation-mode` class is present.
547
+
548
+ <!-- markdownlint-disable-next-line MD024 -->
549
+ ##### **`buildPath`**
550
+
551
+ **Type**: `string` _(optional)_
552
+ **Default**: `'dist'`
553
+ **Description**: This field specifies the path to the directory where the generated CSS file should be placed.
554
+
555
+ #### Usage of Viewport Scaler Generator
556
+
557
+ ```ts
558
+ import { generateViewportScaler } from '@mevbg/design-essentials-vendor';
559
+
560
+ try {
561
+ await generateViewportScaler({
562
+ prefix: 'mev',
563
+ baseFontSize: 16,
564
+ minViewportW: 320,
565
+ maxViewportW: 1920,
566
+ buildPath: './dist/css'
567
+ });
568
+ console.info('Viewport scaler generated successfully!');
569
+ } catch (err) {
570
+ console.error('Failed to generate viewport scaler:', err.message);
571
+ }
572
+ ```
573
+
574
+ The configuration above will:
575
+
576
+ - Use the prefix `mev` for the CSS custom property `--mev-root-font-size`
577
+ - Set up a base font size of 16px for calculations
578
+ - Apply viewport scaling below 320px viewport width
579
+ - Apply viewport scaling above 1920px viewport width in presentation mode
580
+ - Output the CSS file to the `./dist/css` directory
581
+
582
+ #### Viewport Scaler Generated Output
583
+
584
+ The generator produces CSS media queries that create three distinct scaling zones:
585
+
586
+ 1. **Below minimum viewport width**: Fluid scaling using `calc((baseFontSize * 100vw) / minViewportW)`
587
+ 2. **Between min and max viewport width**: Fixed scaling using the base font size percentage
588
+ 3. **Above maximum viewport width**: Fixed scaling with optional presentation mode fluid scaling
589
+
590
+ ### Scrollbar Generator
591
+
592
+ (_exposed as_ `generateScrollbar`)
593
+
594
+ ```ts
595
+ generateScrollbar: GeneratorFn<ScrollbarGeneratorParams, void>;
596
+ ```
597
+
598
+ The _Scrollbar Generator_ creates custom scrollbar styles for web applications, providing a consistent and branded scrolling experience across different browsers. It generates CSS that customizes the appearance of scrollbars using WebKit-specific pseudo-elements and CSS custom properties.
599
+
600
+ The _Scrollbar Generator_ produces CSS that targets WebKit-based browsers (Chrome, Safari, Edge) and applies custom styling to scrollbar elements. It uses CSS custom properties to make the styling configurable and maintainable, while providing hover and active states for better user interaction.
601
+
602
+ #### Scrollbar Generator Parameters
603
+
604
+ The Scrollbar Generator accepts several parameters that control the scrollbar appearance:
605
+
606
+ ```ts
607
+ type ScrollbarGeneratorParams = {
608
+ areaWidth?: number;
609
+ thumbSizeBase?: number;
610
+ thumbSizeOver?: number;
611
+ thumbMinSize?: number;
612
+ scrollbarBackground?: string;
613
+ thumbColor?: string;
614
+ thumbColorHover?: string;
615
+ thumbColorActive?: string;
616
+ buildPath?: string;
617
+ };
618
+ ```
619
+
620
+ All parameters are **optional** and have sensible defaults. Here are more details:
621
+
622
+ ##### **`areaWidth`**
623
+
624
+ **Type**: `number` _(optional)_
625
+ **Default**: `16`
626
+ **Description**: This value defines the total width _(in pixels)_ of the scrollbar area for vertical scrollbars and the height for horizontal scrollbars.
627
+
628
+ ##### **`thumbSizeBase`**
629
+
630
+ **Type**: `number` _(optional)_
631
+ **Default**: `4`
632
+ **Description**: This value defines the base width _(in pixels)_ of the scrollbar thumb in its normal state.
633
+
634
+ ##### **`thumbSizeOver`**
635
+
636
+ **Type**: `number` _(optional)_
637
+ **Default**: `10`
638
+ **Description**: This value defines the width _(in pixels)_ of the scrollbar thumb when hovered or active, providing visual feedback to users.
639
+
640
+ ##### **`thumbMinSize`**
641
+
642
+ **Type**: `number` _(optional)_
643
+ **Default**: `80`
644
+ **Description**: This value defines the minimum size _(in pixels)_ that the scrollbar thumb can have, ensuring it remains usable even on very long content.
645
+
646
+ ##### **`scrollbarBackground`**
647
+
648
+ **Type**: `string` _(optional)_
649
+ **Default**: `'transparent'`
650
+ **Description**: This value defines the background color of the scrollbar track area. Can be any valid CSS color value.
651
+
652
+ ##### **`thumbColor`**
653
+
654
+ **Type**: `string` _(optional)_
655
+ **Default**: `'#ccc'`
656
+ **Description**: This value defines the color of the scrollbar thumb in its normal state. Can be any valid CSS color value.
657
+
658
+ ##### **`thumbColorHover`**
659
+
660
+ **Type**: `string` _(optional)_
661
+ **Default**: `'#ccc'`
662
+ **Description**: This value defines the color of the scrollbar thumb when hovered. Can be any valid CSS color value.
663
+
664
+ ##### **`thumbColorActive`**
665
+
666
+ **Type**: `string` _(optional)_
667
+ **Default**: `'#999'`
668
+ **Description**: This value defines the color of the scrollbar thumb when active (being dragged). Can be any valid CSS color value.
669
+
670
+ <!-- markdownlint-disable-next-line MD024 -->
671
+ ##### **`buildPath`**
672
+
673
+ **Type**: `string` _(optional)_
674
+ **Default**: `'dist'`
675
+ **Description**: This field specifies the path to the directory where the generated CSS file should be placed.
676
+
677
+ #### Usage of Scrollbar Generator
678
+
679
+ ```ts
680
+ import { generateScrollbar } from '@mevbg/design-essentials-vendor';
681
+
682
+ try {
683
+ await generateScrollbar({
684
+ areaWidth: 12,
685
+ thumbSizeBase: 6,
686
+ thumbSizeOver: 8,
687
+ thumbMinSize: 60,
688
+ scrollbarBackground: 'rgba(0, 0, 0, 0.1)',
689
+ thumbColor: '#666',
690
+ thumbColorHover: '#888',
691
+ thumbColorActive: '#444',
692
+ buildPath: './dist/css'
693
+ });
694
+ console.info('Scrollbar styles generated successfully!');
695
+ } catch (err) {
696
+ console.error('Failed to generate scrollbar styles:', err.message);
697
+ }
698
+ ```
699
+
700
+ The configuration above will:
701
+
702
+ - Create a 12px wide scrollbar area
703
+ - Use a 6px base thumb size that expands to 8px on hover
704
+ - Set a minimum thumb size of 60px
705
+ - Use a semi-transparent dark background for the track
706
+ - Apply a gray color scheme with darker shades for hover and active states
707
+ - Output the CSS file to the `./dist/css` directory
708
+
709
+ #### Scrollbar Generated Output
710
+
711
+ The generator produces CSS that includes:
712
+
713
+ - CSS custom properties for all configurable values
714
+ - WebKit-specific scrollbar styling for vertical and horizontal scrollbars
715
+ - Hover and active states for the scrollbar thumb
716
+ - Proper cursor styling for different scrollbar elements
717
+ - Hidden scrollbar buttons for a cleaner appearance
718
+ - Automatic calculation of gap sizes based on area and thumb dimensions
719
+
720
+ ### Font Faces Generator
721
+
722
+ (_exposed as_ `generateFontFaces`)
723
+
724
+ ```ts
725
+ generateFontFaces: GeneratorFn<FontFacesGeneratorParams, void>;
726
+ ```
727
+
728
+ The _Font Faces Generator_ automatically scans a directory of font files and generates CSS `@font-face` declarations for web applications. It supports WOFF2 font files and automatically detects font weights and styles based on file naming conventions.
729
+
730
+ The _Font Faces Generator_ processes font files from a specified source directory and creates CSS that defines custom font families with proper font-weight and font-style declarations. It automatically handles both regular and italic variants, and maps font file names to appropriate CSS font-weight values.
731
+
732
+ #### Font Faces Generator Parameters
733
+
734
+ The Font Faces Generator accepts several parameters that control the font processing:
735
+
736
+ ```ts
737
+ type FontFacesGeneratorParams = {
738
+ sourcePath: string;
739
+ fonts: Record<string, Record<string, number>>;
740
+ buildPath?: string;
741
+ };
742
+ ```
743
+
744
+ Two parameters are **required** and one is optional. Here are more details:
745
+
746
+ <!-- markdownlint-disable-next-line MD024 -->
747
+ ##### **`sourcePath`**
748
+
749
+ **Type**: `string` **_(required)_**
750
+ **Description**: This field specifies the path to the directory containing font files. The generator expects a specific directory structure where each font family has its own subdirectory containing the font files.
751
+
752
+ ##### **`fonts`**
753
+
754
+ **Type**: `Record<string, Record<string, number>>` **_(required)_**
755
+ **Description**: This object maps font family names to their weight configurations. The structure is:
756
+
757
+ - **Outer key**: Font family name _(must match the directory name)_
758
+ - **Inner key**: Weight name _(must match the filename pattern)_
759
+ - **Value**: CSS font-weight number _(e.g., 400 for normal, 700 for bold)_
760
+
761
+ Example:
762
+
763
+ ```ts
764
+ {
765
+ 'Helvetica': {
766
+ 'Regular': 400,
767
+ 'Bold': 700
768
+ }
769
+ }
770
+ ```
771
+
772
+ <!-- markdownlint-disable-next-line MD024 -->
773
+ ##### **`buildPath`**
774
+
775
+ **Type**: `string` _(optional)_
776
+ **Default**: `'dist'`
777
+ **Description**: This field specifies the path to the directory where the generated CSS file should be placed.
778
+
779
+ #### Usage of Fonts Faces Generator
780
+
781
+ ```ts
782
+ import { generateFontFaces } from '@mevbg/design-essentials-vendor';
783
+
784
+ try {
785
+ await generateFontFaces({
786
+ sourcePath: './assets/fonts',
787
+ fonts: {
788
+ Helvetica: {
789
+ Regular: 400,
790
+ Bold: 700
791
+ }
792
+ },
793
+ buildPath: './dist/css'
794
+ });
795
+ console.info('Font faces generated successfully!');
796
+ } catch (err) {
797
+ console.error('Failed to generate font faces:', err.message);
798
+ }
799
+ ```
800
+
801
+ The configuration above will:
802
+
803
+ - Scan the `./assets/fonts` directory for font files
804
+ - Process Helvetica font family
805
+ - Map font weights according to the provided configuration
806
+ - Generate CSS `@font-face` declarations for all detected fonts
807
+ - Output the CSS file to the `./dist/css` directory
808
+
809
+ #### Directory Structure Requirements
810
+
811
+ The generator expects the following directory structure:
812
+
813
+ ```text
814
+ assets/fonts/
815
+ └── Helvetica/
816
+ ├── Helvetica-Regular.woff2
817
+ ├── Helvetica-RegularItalic.woff2
818
+ ├── Helvetica-Bold.woff2
819
+ └── Helvetica-BoldItalic.woff2
820
+ ```
821
+
822
+ #### Font Faces Generated Output
823
+
824
+ The generator produces CSS `@font-face` declarations that include:
825
+
826
+ - Proper font-family names matching the directory structure
827
+ - Font-weight values mapped from the configuration
828
+ - Font-style detection (normal/italic) based on filename patterns
829
+ - WOFF2 format declarations with relative URLs
830
+ - Automatic handling of both regular and italic variants
831
+
832
+ ### Icons Generator
833
+
834
+ (_exposed as_ `generateIcons`)
835
+
836
+ ```ts
837
+ generateIcons: GeneratorFn<IconsGeneratorParams, void>;
838
+ ```
839
+
840
+ The _Icons Generator_ creates CSS-based icon system using font icons and CSS custom properties. It generates CSS that allows you to use icons through HTML data attributes, providing a flexible and scalable icon solution for web applications.
841
+
842
+ The _Icons Generator_ produces CSS that defines icon styles using the `data-i` attribute selector. It creates a system where icons can be easily used in HTML by simply adding a data attribute, and the corresponding icon will be displayed using CSS pseudo-elements and Unicode characters.
843
+
844
+ #### Icons Generator Parameters
845
+
846
+ The Icons Generator accepts several parameters that control the icon system:
847
+
848
+ ```ts
849
+ type IconsGeneratorParams = {
850
+ fontFamily?: string;
851
+ color?: string;
852
+ list: Record<string, string>;
853
+ buildPath?: string;
854
+ };
855
+ ```
856
+
857
+ One parameter is **required** and three are optional. Here are more details:
858
+
859
+ ##### **`list`**
860
+
861
+ **Type**: `Record<string, string>` **_(required)_**
862
+ **Description**: This object maps icon names to their Unicode character codes. The structure is:
863
+
864
+ - **Key**: Icon name (used in the HTML `data-i` attribute)
865
+ - **Value**: Unicode character code (without the `\u` prefix)
866
+
867
+ Example:
868
+
869
+ ```ts
870
+ {
871
+ 'home': 'e900',
872
+ 'search': 'e901',
873
+ 'user': 'e902',
874
+ 'settings': 'e903'
875
+ }
876
+ ```
877
+
878
+ ##### **`fontFamily`**
879
+
880
+ **Type**: `string` _(optional)_
881
+ **Default**: `'Iconography'`
882
+ **Description**: This value defines the font family that will be used for displaying the icons. It should match the font family name of your icon font (e.g., Font Awesome, Material Icons, or a custom icon font).
883
+
884
+ ##### **`color`**
885
+
886
+ **Type**: `string` _(optional)_
887
+ **Default**: `'currentColor'`
888
+ **Description**: This value defines the default color for all icons. Using `currentColor` allows icons to inherit the text color from their parent element, making them flexible and themeable.
889
+
890
+ <!-- markdownlint-disable-next-line MD024 -->
891
+ ##### **`buildPath`**
892
+
893
+ **Type**: `string` _(optional)_
894
+ **Default**: `'dist'`
895
+ **Description**: This field specifies the path to the directory where the generated CSS file should be placed.
896
+
897
+ #### Usage of Icons Generator
898
+
899
+ ```ts
900
+ import { generateIcons } from '@mevbg/design-essentials-vendor';
901
+
902
+ try {
903
+ await generateIcons({
904
+ fontFamily: 'MyIcons',
905
+ color: 'var(--mev-color-primary)',
906
+ list: {
907
+ home: 'e900',
908
+ search: 'e901',
909
+ user: 'e902',
910
+ settings: 'e903',
911
+ menu: 'e904',
912
+ close: 'e905'
913
+ },
914
+ buildPath: './dist/css'
915
+ });
916
+ console.info('Icons generated successfully!');
917
+ } catch (err) {
918
+ console.error('Failed to generate icons:', err.message);
919
+ }
920
+ ```
921
+
922
+ The configuration above will:
923
+
924
+ - Use the `MyIcons` font family for displaying icons
925
+ - Set the default icon color to use a CSS custom property
926
+ - Define six icons with their respective Unicode codes
927
+ - Output the CSS file to the `./dist/css` directory
928
+
929
+ #### HTML Usage
930
+
931
+ After generating the CSS, you can use icons in your HTML like this:
932
+
933
+ ```html
934
+ <!-- <span> as an icon -->
935
+ <span data-i="home"></span>
936
+
937
+ <!-- <i> as an icon -->
938
+ <i data-i="user"></i>
939
+ ```
940
+
941
+ #### Icons Generated Output
942
+
943
+ The generator produces CSS that includes:
944
+
945
+ - Base styles for all icon elements using the `[data-i]` selector
946
+ - Proper sizing and positioning for consistent icon display
947
+ - Font family and color configuration
948
+ - Individual icon definitions using `::after` pseudo-elements
949
+ - Unicode character content for each defined icon
950
+ - Responsive sizing using `em` units for scalability
951
+
952
+ ### Favicons Generator
953
+
954
+ (_exposed as_ `generateFavicons`)
955
+
956
+ ```ts
957
+ generateFavicons: GeneratorFn<FaviconsGeneratorParams, FaviconResponse>;
958
+ ```
959
+
960
+ The _Favicons Generator_ creates comprehensive favicon sets and web app manifests for modern web applications. It leverages the popular `favicons` npm package to generate icons for various platforms and devices, including browsers, mobile devices, and PWA installations.
961
+
962
+ The _Favicons Generator_ processes a source image and generates a complete set of favicons, touch icons, and web app manifest files. It supports multiple platforms including Android, iOS, Windows, and various browsers, ensuring your web application has proper branding across all devices and platforms.
963
+
964
+ #### Favicons Generator Parameters
965
+
966
+ The Favicons Generator accepts several parameters that control the favicon generation:
967
+
968
+ ```ts
969
+ type FaviconsGeneratorParams = {
970
+ id: string;
971
+ sourcePath: string;
972
+ appName: string;
973
+ appShortName: string;
974
+ appDescription: string;
975
+ version: string;
976
+ developerName?: string;
977
+ developerURL?: string;
978
+ dir?: string;
979
+ lang?: string;
980
+ background?: string;
981
+ theme_color?: string;
982
+ appleStatusBarStyle?: string;
983
+ display?: string;
984
+ orientation?: string;
985
+ scope?: string;
986
+ start_url?: string;
987
+ preferRelatedApplications?: boolean;
988
+ relatedApplications?: Array<{ id: string; url: string; platform: string }>;
989
+ manifestMaskable?: boolean | string;
990
+ loadManifestWithCredentials?: boolean;
991
+ icons?: Record<string, any>;
992
+ buildPath?: string;
993
+ };
994
+ ```
995
+
996
+ Six parameters are **required** and the rest are optional. Here are more details:
997
+
998
+ ##### **`id`**
999
+
1000
+ **Type**: `string` **_(required)_**
1001
+ **Description**: This field specifies the unique identifier for the web application. It is used in the generated manifest file and helps identify the app across different platforms.
1002
+
1003
+ <!-- markdownlint-disable-next-line MD024 -->
1004
+ ##### **`sourcePath`**
1005
+
1006
+ **Type**: `string` **_(required)_**
1007
+ **Description**: This field specifies the path to the source image file that will be used to generate all favicon variants. The image should be high quality (at least 1024x1024 pixels) and square.
1008
+
1009
+ ##### **`appName`**
1010
+
1011
+ **Type**: `string` **_(required)_**
1012
+ **Description**: This field specifies the full name of the web application as it will appear in app stores and device home screens.
1013
+
1014
+ ##### **`appShortName`**
1015
+
1016
+ **Type**: `string` **_(required)_**
1017
+ **Description**: This field specifies the short name of the web application, typically used when space is limited _(e.g., on home screens)_.
1018
+
1019
+ ##### **`appDescription`**
1020
+
1021
+ **Type**: `string` **_(required)_**
1022
+ **Description**: This field provides a brief description of the web application for app stores and device listings.
1023
+
1024
+ ##### **`version`**
1025
+
1026
+ **Type**: `string` **_(required)_**
1027
+ **Description**: This field specifies the version number of the web application _(e.g., "1.0.0")_.
1028
+
1029
+ ##### **`developerName`**
1030
+
1031
+ **Type**: `string` _(optional)_
1032
+ **Default**: `'Martin Metodiev'`
1033
+ **Description**: This field specifies the name of the developer or organization that created the web application.
1034
+
1035
+ ##### **`developerURL`**
1036
+
1037
+ **Type**: `string` _(optional)_
1038
+ **Default**: `'https://mev.bg'`
1039
+ **Description**: This field specifies the URL of the developer or organization website.
1040
+
1041
+ ##### **`background`**
1042
+
1043
+ **Type**: `string` _(optional)_
1044
+ **Default**: `'#fff'`
1045
+ **Description**: This field specifies the background color for flattened icons and splash screens.
1046
+
1047
+ ##### **`theme_color`**
1048
+
1049
+ **Type**: `string` _(optional)_
1050
+ **Default**: `'#fff'`
1051
+ **Description**: This field specifies the theme color used in browser UI elements and Android task switcher.
1052
+
1053
+ ##### **`display`**
1054
+
1055
+ **Type**: `string` _(optional)_
1056
+ **Default**: `'standalone'`
1057
+ **Description**: This field specifies the preferred display mode for the web application. Options include: `'fullscreen'`, `'standalone'`, `'minimal-ui'`, or `'browser'`.
1058
+
1059
+ <!-- markdownlint-disable-next-line MD024 -->
1060
+ ##### **`buildPath`**
1061
+
1062
+ **Type**: `string` _(optional)_
1063
+ **Default**: `'dist'`
1064
+ **Description**: This field specifies the path to the directory where the generated favicon files should be placed.
1065
+
1066
+ #### Usage of Favicons Generator
1067
+
1068
+ ```ts
1069
+ import { generateFavicons } from '@mevbg/design-essentials-vendor';
1070
+
1071
+ try {
1072
+ await generateFavicons({
1073
+ id: 'https://mev.bg',
1074
+ sourcePath: './assets/images/logo.svg',
1075
+ appName: 'Mev.bg - Personal Website',
1076
+ appShortName: 'Mev.bg',
1077
+ appDescription: 'Personal website and portfolio of Martin Metodiev',
1078
+ version: '1.0.0',
1079
+ developerName: 'Martin Metodiev',
1080
+ developerURL: 'https://mev.bg',
1081
+ background: '#ffffff',
1082
+ theme_color: '#3b82f6',
1083
+ display: 'standalone',
1084
+ buildPath: './dist/favicons'
1085
+ });
1086
+ console.info('Favicons generated successfully!');
1087
+ } catch (err) {
1088
+ console.error('Failed to generate favicons:', err.message);
1089
+ }
1090
+ ```
1091
+
1092
+ The configuration above will:
1093
+
1094
+ - Use the logo.svg file as the source image for all favicon variants
1095
+ - Set up a complete web app manifest with proper branding
1096
+ - Generate favicons for all major platforms and browsers
1097
+ - Create a standalone web app experience
1098
+ - Output all files to the `./dist/favicons` directory
1099
+
1100
+ #### Generated Output
1101
+
1102
+ The generator produces a comprehensive set of files including:
1103
+
1104
+ - **Favicon files**: Various sizes for different browsers and devices
1105
+ - **Touch icons**: Apple touch icons for iOS devices
1106
+ - **Android icons**: Home screen and app store icons
1107
+ - **Windows tiles**: Windows 8/10 tile icons
1108
+ - **Web app manifest**: JSON manifest file for PWA functionality
1109
+ - **HTML snippets**: Ready-to-use HTML tags for favicon integration
1110
+ - **Splash screens**: Apple startup images for iOS devices
1111
+
1112
+ #### HTML Integration
1113
+
1114
+ After generation, you can integrate the favicons into your HTML:
1115
+
1116
+ ```html
1117
+ <!-- Include the generated HTML snippets in your <head> section -->
1118
+ <link rel="icon" type="image/x-icon" href="/favicons/favicon.ico" />
1119
+ <link rel="icon" type="image/png" sizes="32x32" href="/favicons/favicon-32x32.png" />
1120
+ <link rel="icon" type="image/png" sizes="16x16" href="/favicons/favicon-16x16.png" />
1121
+ <link rel="apple-touch-icon" sizes="180x180" href="/favicons/apple-touch-icon.png" />
1122
+ <link rel="manifest" href="/favicons/manifest.webmanifest" />
1123
+ ```
1124
+
1125
+ ## 🔧 Development
1126
+
1127
+ This section provides comprehensive technical documentation regarding **mDEV** module. It covers the internal architecture, source code structure, and implementation details that are essential for understanding, maintaining, and extending the codebase. The documentation is written from a developer’s perspective, focusing on code organization, dependencies, and the technical implementation of each component.
1128
+
1129
+ ### Source File Structure
1130
+
1131
+ The following represents the complete file structure of the `src` directory that contains the source code of the **mDEV** module:
1132
+
1133
+ ```text
1134
+ src/
1135
+ ├── index.ts # Main entry point - exports all generators and types
1136
+ ├── defaults.ts # Default configuration parameters for all generators
1137
+ ├── generators/ # Core generators implementation
1138
+ │ ├── index.ts # Exports all generators
1139
+ │ ├── master/ # Master generator - orchestrates all other generators
1140
+ │ │ ├── master.generator.ts # Main orchestration logic
1141
+ │ │ └── master.types.ts # Master generator parameter types
1142
+ │ ├── tokens/ # Design tokens generator - most complex generator
1143
+ │ │ ├── tokens.generator.ts # Main tokens generation logic
1144
+ │ │ ├── tokens.types.ts # Tokens generator parameter types
1145
+ │ │ ├── handlers/ # Token processing handlers
1146
+ │ │ │ ├── index.ts # Exports all handlers
1147
+ │ │ │ ├── basic.handler.ts # Basic token processing logic
1148
+ │ │ │ ├── color.handler.ts # Color-specific token processing
1149
+ │ │ │ └── utopia.handler.ts # Utopia fluid typography processing
1150
+ │ │ ├── platforms/ # Output format platforms
1151
+ │ │ │ ├── index.ts # Platform registry and management
1152
+ │ │ │ ├── formats.ts # Platform format definitions
1153
+ │ │ │ ├── css/ # CSS platform implementation
1154
+ │ │ │ │ ├── index.ts # CSS platform entry point
1155
+ │ │ │ │ ├── formats.ts # CSS-specific format definitions
1156
+ │ │ │ │ └── utils.ts # CSS platform utilities
1157
+ │ │ │ ├── js/ # JavaScript platform implementation
1158
+ │ │ │ │ ├── index.ts # JS platform entry point
1159
+ │ │ │ │ ├── formats.ts # JS-specific format definitions
1160
+ │ │ │ │ └── utils.ts # JS platform utilities
1161
+ │ │ │ ├── scss/ # SCSS platform implementation
1162
+ │ │ │ │ ├── index.ts # SCSS platform entry point
1163
+ │ │ │ │ ├── formats.ts # SCSS-specific format definitions
1164
+ │ │ │ │ └── utils.ts # SCSS platform utilities
1165
+ │ │ │ └── json/ # JSON platform implementation
1166
+ │ │ │ └── index.ts # JSON platform entry point
1167
+ │ │ ├── types/ # Tokens-specific type definitions
1168
+ │ │ │ ├── tokens.types.ts # Core tokens type definitions
1169
+ │ │ │ ├── platform.types.ts # Platform-related types
1170
+ │ │ │ ├── format.types.ts # Format-related types
1171
+ │ │ │ ├── color-scheme.types.ts # Color scheme types
1172
+ │ │ │ └── utopia-scheme.types.ts # Utopia scheme types
1173
+ │ │ └── utils/ # Tokens-specific utilities
1174
+ │ │ ├── formats.utils.ts # Format processing utilities
1175
+ │ │ ├── color-tokens.utils.ts # Color token utilities
1176
+ │ │ └── utopia-tokens.utils.ts # Utopia token utilities
1177
+ │ ├── viewport-scaler/ # Viewport scaler generator
1178
+ │ │ ├── viewport-scaler.generator.ts # Main viewport scaler logic
1179
+ │ │ └── viewport-scaler.types.ts # Viewport scaler parameter types
1180
+ │ ├── scrollbar/ # Scrollbar styling generator
1181
+ │ │ ├── scrollbar.generator.ts # Main scrollbar generation logic
1182
+ │ │ └── scrollbar.types.ts # Scrollbar parameter types
1183
+ │ ├── font-faces/ # Font faces generator
1184
+ │ │ ├── font-faces.generator.ts # Main font faces generation logic
1185
+ │ │ └── font-faces.types.ts # Font faces parameter types
1186
+ │ ├── icons/ # Icons generator
1187
+ │ │ ├── icons.generator.ts # Main icons generation logic
1188
+ │ │ └── icons.types.ts # Icons parameter types
1189
+ │ └── favicons/ # Favicons generator
1190
+ │ ├── favicons.generator.ts # Main favicons generation logic
1191
+ │ └── favicons.types.ts # Favicons parameter types
1192
+ ├── types/ # Global type definitions
1193
+ │ ├── index.ts # Exports all types
1194
+ │ ├── generator.types.ts # Base generator type definitions
1195
+ │ └── utils.types.ts # Utility type definitions
1196
+ └── utils/ # Global utility functions
1197
+ ├── generators.utils.ts # Generator-related utilities
1198
+ ├── formats.utils.ts # Format processing utilities
1199
+ └── strings.utils.ts # String manipulation utilities
1200
+ ```
1201
+
1202
+ ### Source Architecture
1203
+
1204
+ The **mDEV** module follows a well-structured, modular architecture that separates concerns and promotes maintainability. The architecture is built around the concept of **Generators** - specialized functions that produce specific outputs based on design system principles.
1205
+
1206
+ #### Core Architecture Components
1207
+
1208
+ **Generator Function Type (`GeneratorFn<T, Response>`)**
1209
+ `src/types/generator.types.ts`
1210
+
1211
+ - **Purpose**: Defines the standard interface for all generators
1212
+ - **Signature**: `(params: T) => Promise<Response>`
1213
+ - **Default Response**: `StyleDictionary` object (most common return type)
1214
+ - **Role**: Ensures consistency across all generators and provides type safety
1215
+
1216
+ **Utility Types**
1217
+ `src/types/utils.types.ts`
1218
+
1219
+ - **`Kebab<T>`**: Converts camelCase strings to kebab-case (e.g., `fontFamily` → `font-family`)
1220
+ - **`EnforceRequired<T, K>`**: Utility type that enforces required properties on a type
1221
+
1222
+ #### Individual Generators
1223
+
1224
+ ##### I. TOKENS GENERATOR `src/generators/tokens/`
1225
+
1226
+ This generator is the most complex component, implementing a sophisticated multi-platform design tokens system.
1227
+
1228
+ **Token Types**
1229
+ `src/generators/tokens/types/tokens.types.ts`
1230
+
1231
+ - `enum CoreToken`: Defines the fundamental token categories that the system recognizes:
1232
+ - _Typography_: `fontFamily`, `fontSize`, `fontWeight`, `letterSpacing`, `lineHeight`
1233
+ - _Color_: `color` (with special color scheme logic)
1234
+ - _Size_: `size` (with Utopia fluid typography support)
1235
+ - _Border_: `borderColor`, `borderRadius`, `borderStyle`, `borderWidth`
1236
+ - _Effects_: `boxShadow`
1237
+ - _Layout_: `breakpoint`, `dimensions`
1238
+ - _Visual_: `opacity`, `transition`
1239
+ - `type CoreTokenCamelValues`: camelCase representation of core tokens
1240
+ - `type CoreTokenKebabValues`: kebab-case representation for CSS custom properties
1241
+ - `type TokensDesignData`: Contains design context (baseFontSize, colorScheme, utopiaScheme)
1242
+
1243
+ **Platform System Types**
1244
+ `src/generators/tokens/types/platform.types.ts`
1245
+
1246
+ - Platform Type _(Defines supported output formats)_:
1247
+ - `CSS`: CSS custom properties format
1248
+ - `SCSS`: SCSS variables format
1249
+ - `JS`: JavaScript objects format
1250
+ - `JSON`: JSON structure format
1251
+
1252
+ - Platform Context _(Defines platform configuration)_:
1253
+ - `config`: Style Dictionary platform configuration
1254
+ - `allTokensFile`: Whether to generate a single file with all tokens
1255
+ - `tokenTypeFiles`: Whether to generate separate files for each token type
1256
+ - `customFiles`: Additional custom file names
1257
+
1258
+ - File Type System:
1259
+ - `CommonPlatformFileType`: Shared file types for CSS/SCSS (`ALL`, `CORE`, `OTHERS`)
1260
+ - `JsCustomPlatformFileType`: JS-specific file types (`STATIC`, `VARIABLE`)
1261
+ - `PlatformFilename`: Union type of all possible output file names
1262
+
1263
+ **Format System**
1264
+ `src/generators/tokens/types/format.types.ts`
1265
+
1266
+ - Custom Formatter Categories:
1267
+ - `CustomFormatterCategory`: CSS, SCSS, JS formatter categories
1268
+ - `CustomFormatterType`: Specific formatter types for each category
1269
+
1270
+ - Handler System:
1271
+ - `HandlerResolver`: Function type for token processing handlers
1272
+ - `CoreTokensHandlerResolvers`: Record mapping core tokens to their handlers
1273
+ - `CommonHandlerParams`: Shared parameters for all handlers
1274
+
1275
+ - Output Configuration:
1276
+ - `OutputConfig`: Controls output formatting _(noChapterTitle, prefix)_
1277
+ - `WrapperParams`: Parameters for code block wrapping
1278
+ - `DefinerParams`: Parameters for code block content definition
1279
+
1280
+ **Token Processing Handlers**
1281
+ `src/generators/tokens/handlers/`
1282
+
1283
+ - `basic.handler.ts`
1284
+ - **Purpose**: Processes standard tokens without special logic
1285
+ - **Functionality**:
1286
+ - Renders tokens in the appropriate format for each platform
1287
+ - Handles "Other" tokens by grouping them by type
1288
+ - Applies different formatting for CSS vs JS/SCSS platforms
1289
+ - **Dependencies**: Uses `getFileOutput` utility and string formatting functions
1290
+
1291
+ - `color.handler.ts`
1292
+ - **Purpose**: Processes color tokens with color scheme support
1293
+ - **Functionality**:
1294
+ - Supports multiple color scheme methods: `media`, `class`, `combined`
1295
+ - Generates CSS media queries for `prefers-color-scheme`
1296
+ - Creates CSS classes for manual color scheme switching
1297
+ - Handles different output formats (CSS, SCSS, JS)
1298
+ - **Dependencies**: Uses `getColorScheme` utility for color scheme processing
1299
+
1300
+ - `utopia.handler.ts`
1301
+ - **Purpose**: Processes fluid typography tokens using Utopia methodology
1302
+ - **Functionality**:
1303
+ - Separates Utopia tokens from basic tokens
1304
+ - Generates three responsive variants: Min, Utopia (fluid), Max
1305
+ - Creates CSS media queries for responsive breakpoints
1306
+ - Maps token values to different viewport ranges
1307
+ - **Dependencies**: Uses Utopia utilities for token value mapping and separation
1308
+
1309
+ **Platform Implementation System**
1310
+ `src/generators/tokens/platforms/`
1311
+
1312
+ Platform Registry (`index.ts`)
1313
+
1314
+ - **Purpose**: Central registry for all platform configurations
1315
+ - **Functionality**:
1316
+ - Dynamically imports platform context getters
1317
+ - Generates Style Dictionary platform configurations
1318
+ - Creates file definitions based on platform context
1319
+ - Handles formatter assignment and filtering
1320
+
1321
+ Platform-Specific Implementations
1322
+ _Each platform (except for JSON) contains:_
1323
+
1324
+ - `index.ts`: Platform context getter function
1325
+ - `formats.ts`: Platform-specific format definitions
1326
+ - `utils.ts`: Platform-specific utility functions
1327
+
1328
+ Platforms
1329
+
1330
+ - CSS:
1331
+ - Generates CSS custom properties
1332
+ - Supports media queries and color schemes
1333
+ - Creates responsive typography with Utopia
1334
+
1335
+ - JS:
1336
+ - Generates JavaScript objects
1337
+ - Supports both static values and CSS custom property references
1338
+ - Creates modular exports for each token type
1339
+
1340
+ - SCSS:
1341
+ - Generates SCSS variables
1342
+ - Supports nested color schemes
1343
+ - Creates mixins and functions
1344
+
1345
+ - JSON:
1346
+ - Generates JSON structure
1347
+ - Provides raw token data
1348
+ - Supports external tool integration
1349
+
1350
+ **Utility Systems**
1351
+ `src/generators/tokens/utils/`
1352
+
1353
+ - `formats.utils.ts`
1354
+ - **Purpose**: Handles file output generation and formatting
1355
+ - **Key Functions**:
1356
+ - `getFileOutput`: Main file generation orchestrator
1357
+ - `getCategoryFormatterName`: Generates formatter names
1358
+ - `getDestinationFileName`: Generates output file names
1359
+
1360
+ - `color-tokens.utils.ts`
1361
+ - **Purpose**: Processes color scheme logic
1362
+ - **Key Functions**:
1363
+ - `getColorScheme`: Organizes tokens by color scheme
1364
+ - Color value transformations and validations
1365
+
1366
+ - `utopia-tokens.utils.ts`
1367
+ - **Purpose**: Handles fluid typography calculations
1368
+ - **Key Functions**:
1369
+ - `mapUtopiaTokenValuesToMin/Max/Responsive`: Maps tokens to viewport ranges
1370
+ - `separateUtopiaAndBasicTokens`: Separates fluid from static tokens
1371
+
1372
+ ---
1373
+
1374
+ ##### II. VIEWPORT SCALER GENERATOR `src/generators/viewport-scaler/`
1375
+
1376
+ This generator implements the Viewport Scale philosophy by creating dynamic root font size CSS that scales the entire layout proportionally.
1377
+
1378
+ **Core Functionality**:
1379
+
1380
+ - **Dynamic Root Font Size**: Sets `--ds-root-font-size` CSS custom property
1381
+ - **Responsive Scaling**: Applies scaling below `minViewportW` and above `maxViewportW` (in presentation mode)
1382
+ - **Mathematical Scaling**: Uses `calc((baseFontSize * 100vw) / viewportWidth)` formula
1383
+ - **Presentation Mode**: Special class for continuous scaling above max viewport
1384
+
1385
+ **Implementation Details**:
1386
+
1387
+ `viewportScalerGenerator(params)`
1388
+
1389
+ - **Called by**: Master generator or directly by user
1390
+ - **Purpose**: Main generator function that implements the Viewport Scale philosophy by creating dynamic root font size CSS
1391
+ - **Process**:
1392
+ 1. Receives viewport scaler configuration parameters (`minViewportW`, `maxViewportW`, `baseFontSize`, `prefix`)
1393
+ 2. Uses `cssGenerator()` utility to handle the CSS generation process
1394
+ 3. Extracts required parameters and creates prefix string (e.g., `'ds-'` if prefix is `'ds'`)
1395
+ 4. Defines three viewport range variants as an array of objects:
1396
+ - **Below min breakpoint** (`max-width: ${minViewportW - 1}px`):
1397
+ - Uses fluid scaling formula: `calc((${baseFontSize} * 100vw) / ${minViewportW})`
1398
+ - Scales proportionally from 0 to min viewport width
1399
+ - **Normal range** (`min-width: ${minViewportW}px and max-width: ${maxViewportW}px`):
1400
+ - Uses fixed base font size: `var(--${prefix}font-size-base-percentage)`
1401
+ - Maintains consistent sizing in the design system’s intended range
1402
+ - **Above max breakpoint** (`min-width: ${maxViewportW + 1}px`):
1403
+ - Default: Fixed base font size (same as normal range)
1404
+ - Presentation mode: Fluid scaling formula: `calc((${baseFontSize} * 100vw) / ${maxViewportW})`
1405
+ - Allows continuous scaling above max viewport when presentation mode is active
1406
+ 5. Iterates through each variant using `forEach()`:
1407
+ - Generates CSS media query: `@media all and ${media} {`
1408
+ - For each wrapper in the variant:
1409
+ - Uses `cssSelectorBlock()` to format CSS selectors (`:root` or `html.presentation-mode`)
1410
+ - Adds proper indentation using `tab()` function
1411
+ - Handles spacing between multiple wrappers in the same media query
1412
+ - Closes media query with `}`
1413
+ 6. Joins all CSS output into a single string with proper formatting
1414
+ - **Returns**: Complete CSS string with responsive root font size definitions for all viewport ranges
1415
+
1416
+ **Parameters**
1417
+ `viewport-scaler.types.ts`:
1418
+
1419
+ - `prefix`: CSS custom property prefix (default: 'ds')
1420
+ - `baseFontSize`: Base font size for calculations (default: 10)
1421
+ - `minViewportW`: Minimum viewport width for scaling (default: 300)
1422
+ - `maxViewportW`: Maximum viewport width for scaling (default: 2100)
1423
+ - `buildPath`: Output directory path
1424
+
1425
+ ---
1426
+
1427
+ ##### III. SCROLLBAR GENERATOR `src/generators/scrollbar/`
1428
+
1429
+ This generator creates sophisticated custom scrollbar styling that treats scrollbars as first-class UI elements.
1430
+
1431
+ **Core Functionality**:
1432
+
1433
+ - **WebKit Scrollbar Styling**: Comprehensive `::-webkit-scrollbar` selectors
1434
+ - **Context-Aware Design**: Blends seamlessly with overall design system
1435
+ - **Interactive States**: Hover and active states for thumb elements
1436
+ - **Cross-Platform**: Excludes macOS (uses native scrollbars)
1437
+ - **Mathematical Precision**: Calculated gap sizes and proportions
1438
+
1439
+ **Implementation Details**:
1440
+
1441
+ `scrollbarGenerator(params)`
1442
+
1443
+ - **Called by**: Master generator or directly by user
1444
+ - **Purpose**: Main generator function that creates comprehensive custom scrollbar styling CSS
1445
+ - **Process**:
1446
+ 1. Receives scrollbar configuration parameters (colors, sizes, etc.)
1447
+ 2. Uses `cssGenerator()` utility to handle the CSS generation process
1448
+ 3. Creates a single CSS selector block for `html:not(.isMacOs)` to exclude macOS
1449
+ 4. Generates CSS custom properties for all scrollbar dimensions and colors:
1450
+ - `--scrollbar-area`: Overall scrollbar width/height
1451
+ - `--scrollbar-thumb-size-base/over`: Thumb sizes for different states
1452
+ - `--scrollbar-gap-size-base/over`: Calculated gap sizes using CSS calc()
1453
+ - `--scrollbar-background`: Track background color
1454
+ - `--scrollbar-thumb-color*`: Thumb colors for different states
1455
+ - `--scrollbar-thumb-min-size`: Minimum thumb size
1456
+ 5. Generates comprehensive `::-webkit-scrollbar` selectors:
1457
+ - **Area selectors**: `::-webkit-scrollbar:vertical/horizontal` for dimensions
1458
+ - **Base selector**: `::-webkit-scrollbar` for background and scroll-margin
1459
+ - **Track selector**: `::-webkit-scrollbar-track-piece` with transparent styling
1460
+ - **Thumb selectors**: `::-webkit-scrollbar-thumb` with hover/active states
1461
+ - **Cursor selectors**: Appropriate cursor types (ns-resize, ew-resize, default)
1462
+ - **Button selector**: `::-webkit-scrollbar-button` hidden by default
1463
+ 6. Implements interactive states with hover and active pseudo-classes
1464
+ 7. Uses `background-clip: padding-box` for proper visual appearance
1465
+ 8. Joins all CSS into a single string with proper formatting
1466
+ - **Returns**: Complete CSS string with comprehensive scrollbar styling system
1467
+
1468
+ **Parameters:**
1469
+ `scrollbar.types.ts`
1470
+
1471
+ - `areaWidth`: Overall scrollbar width/height (default: 16px)
1472
+ - `thumbSizeBase`: Base thumb size (default: 4px)
1473
+ - `thumbSizeOver`: Hover/active thumb size (default: 10px)
1474
+ - `thumbMinSize`: Minimum thumb size (default: 80px)
1475
+ - `scrollbarBackground`: Track background color
1476
+ - `thumbColor`: Base thumb color
1477
+ - `thumbColorHover`: Hover state color
1478
+ - `thumbColorActive`: Active state color
1479
+ - `buildPath`: Output directory path
1480
+
1481
+ ---
1482
+
1483
+ ##### IV. FONT FACES GENERATOR `src/generators/font-faces/`
1484
+
1485
+ This generator automatically scans font directories and generates comprehensive `@font-face` declarations for self-hosted fonts.
1486
+
1487
+ **Core Functionality**:
1488
+
1489
+ - **Directory Scanning**: Automatically discovers available font files
1490
+ - **Font Weight Mapping**: Maps font files to CSS font-weight values
1491
+ - **Style Detection**: Automatically detects italic and regular styles
1492
+ - **WOFF2 Support**: Works exclusively with WOFF2 format for optimal performance
1493
+ - **Error Handling**: Graceful handling of missing directories or files
1494
+
1495
+ **Implementation Details**:
1496
+
1497
+ `getTypefaces(dir: string)`
1498
+
1499
+ - **Called by**: `getFontFaces()` function
1500
+ - **Purpose**: Scans the fonts directory and discovers all available font families and their files
1501
+ - **Process**:
1502
+ 1. Reads all subdirectories in the fonts folder using `fs.readdirSync()`
1503
+ 2. For each subdirectory (font family), reads all `.woff2` files
1504
+ 3. Parses each filename to extract the weight/style information
1505
+ 4. Handles naming patterns like "Helvetica-Regular.woff2" or "Helvetica-Bold.woff2"
1506
+ 5. Groups files by weight, separating italic variants
1507
+ 6. Returns an array of typefaces with their weights and file lists
1508
+ - **Returns**: Array of `{ name: string; weights: Record<string, string[]> }[]`
1509
+
1510
+ `getFontFaces({ fonts, sourcePath })`
1511
+
1512
+ - **Called by**: `fontFacesGenerator()` function
1513
+ - **Purpose**: Processes the discovered typefaces and creates FontFace objects for CSS generation
1514
+ - **Process**:
1515
+ 1. Calls `getTypefaces(sourcePath)` to discover available fonts
1516
+ 2. For each typeface, checks if there’s a predefined weight mapping in the `fonts` config
1517
+ 3. If no mapping exists and multiple weights are detected, skips the typeface (can't determine weights)
1518
+ 4. Sorts weights by their numeric values if mapping exists
1519
+ 5. Filters files to ensure only `.woff2` files are processed
1520
+ 6. Creates FontFace objects with:
1521
+ - `font-family`: Typeface name
1522
+ - `font-style`: 'normal' or 'italic' (detected from filename)
1523
+ - `font-weight`: Numeric weight from mapping or default 400
1524
+ - `src`: Relative path to font file with format specification
1525
+ - **Returns**: Array of `FontFace[]` objects ready for CSS generation
1526
+
1527
+ `fontFacesGenerator(params)`
1528
+
1529
+ - **Called by**: Master generator or directly by user
1530
+ - **Purpose**: Main generator function that orchestrates the entire font face generation process
1531
+ - **Process**:
1532
+ 1. Receives parameters including `fonts` mapping and `sourcePath`
1533
+ 2. Calls `getFontFaces(config)` to get all FontFace objects
1534
+ 3. Iterates through each FontFace object
1535
+ 4. For each FontFace, generates a CSS `@font-face` declaration using `cssSelectorBlock()`
1536
+ 5. Formats each property (font-family, font-style, font-weight, src) with proper indentation
1537
+ 6. Joins all declarations into a single CSS string
1538
+ - **Returns**: Complete CSS string with all `@font-face` declarations
1539
+
1540
+ **Parameters:**
1541
+ `font-faces.types.ts`
1542
+
1543
+ - `sourcePath`: Path to fonts directory (required)
1544
+ - `fonts`: Font weight mapping configuration
1545
+ - `buildPath`: Output directory path
1546
+
1547
+ ---
1548
+
1549
+ ##### V. ICONS GENERATOR `src/generators/icons/`
1550
+
1551
+ This generator creates a complete icon system using CSS selectors and icon fonts with precise glyph targeting.
1552
+
1553
+ **Core Functionality**:
1554
+
1555
+ - **Icon Font Integration**: Works with any icon font (Iconography, DevIcons, etc.)
1556
+ - **CSS Selector System**: Uses `data-i` attribute for icon targeting
1557
+ - **Pseudo-Element Rendering**: `::after` pseudo-elements for glyph display
1558
+ - **Unicode Mapping**: Maps icon names to unicode values
1559
+ - **Responsive Design**: Scalable icons using em units
1560
+
1561
+ **Implementation Details**:
1562
+
1563
+ `iconsGenerator(params)`
1564
+
1565
+ - **Called by**: Master generator or directly by user
1566
+ - **Purpose**: Main generator function that creates a complete CSS icon system using attribute selectors and pseudo-elements
1567
+ - **Process**:
1568
+ 1. Receives icon configuration parameters (`fontFamily`, `color`, `list`)
1569
+ 2. Uses `cssGenerator()` utility to handle the CSS generation process
1570
+ 3. Defines the attribute name as `'data-i'` for icon targeting
1571
+ 4. Generates base icon styles using `[data-i]` selector:
1572
+ - Creates CSS object with common icon properties (display, width, height, color, font-family, etc.)
1573
+ - Converts object to CSS properties using `Object.entries()` and `map()`
1574
+ - Formats each property with proper indentation using `tab()`
1575
+ - Joins properties with newlines
1576
+ 5. Generates pseudo-element styles using `[data-i]::after` selector:
1577
+ - Creates CSS object for `::after` pseudo-element properties
1578
+ - Sets `font-size: 1.25em` and `line-height: 0.6em` for proper glyph rendering
1579
+ - Formats and joins properties similar to base styles
1580
+ 6. Iterates through the icon list (`Object.entries(list)`):
1581
+ - For each icon name and unicode code pair
1582
+ - Generates specific icon selector `[data-i="iconName"]::after`
1583
+ - Sets the `content` property with escaped unicode value (`"\\${code}"`)
1584
+ - Each icon gets its own CSS rule for precise targeting
1585
+ 7. Joins all CSS rules into a single string with proper formatting
1586
+ - **Returns**: Complete CSS string with comprehensive icon system including base styles, pseudo-elements, and individual icon definitions
1587
+
1588
+ **Parameters:**
1589
+ `icons.types.ts`
1590
+
1591
+ - `fontFamily`: Icon font family name (default: 'Iconography')
1592
+ - `color`: Icon color (default: 'currentColor')
1593
+ - `list`: Icon name to unicode mapping (required)
1594
+ - `buildPath`: Output directory path
1595
+
1596
+ ---
1597
+
1598
+ ##### VI. FAVICONS GENERATOR `src/generators/favicons/`
1599
+
1600
+ This generator leverages the `favicons` npm package to create comprehensive favicon and PWA assets for all platforms and devices.
1601
+
1602
+ **Core Functionality**:
1603
+
1604
+ - **Multi-Platform Support**: iOS, Android, Windows, macOS, Linux
1605
+ - **PWA Assets**: Web app manifest and startup screens
1606
+ - **Responsive Icons**: Various sizes for different devices
1607
+ - **Maskable Icons**: Android adaptive icons
1608
+ - **Startup Screens**: iOS splash screens for all device sizes
1609
+
1610
+ **Implementation Details**:
1611
+
1612
+ `faviconsGenerator(params)`
1613
+
1614
+ - **Called by**: Master generator or directly by user
1615
+ - **Purpose**: Main generator function that leverages the `favicons` npm package to create comprehensive favicon and PWA assets
1616
+ - **Process**:
1617
+ 1. Receives favicon configuration parameters (`id`, `sourcePath`, and other favicon options)
1618
+ 2. Merges default parameters with provided parameters using spread operator
1619
+ 3. Sets `manifestMaskable` to `sourcePath` if not provided (uses same image for maskable icons)
1620
+ 4. Resolves the build path using `path.resolve()` for absolute path
1621
+ 5. Creates the output directory if it doesn't exist using `fs.mkdir()` with `recursive: true`
1622
+ 6. Calls the `favicons()` function from the favicons package with `sourcePath` and `config`
1623
+ 7. Uses `Promise.all()` to handle concurrent file writing operations:
1624
+ - **Image files**: Maps through `faviconsResult.images` array
1625
+ - For each image, writes the file using `fs.writeFile()`
1626
+ - Uses `path.join()` to create proper file paths
1627
+ - **Manifest and other files**: Maps through `faviconsResult.files` array
1628
+ - For each file, prepares the content
1629
+ - **Special handling for manifest.webmanifest**:
1630
+ - Parses the JSON manifest using `JSON.parse()`
1631
+ - Adds custom `id` property to the manifest
1632
+ - Adds `developer_name` and `developer_url` from config
1633
+ - Updates icon paths by removing leading slash from `src` properties
1634
+ - Stringifies the updated manifest with proper formatting
1635
+ - Writes the file using `fs.writeFile()`
1636
+ 8. Logs success information with file counts
1637
+ 9. Returns the complete `FaviconResponse` object from the favicons package
1638
+ - **Returns**: `FaviconResponse` object containing all generated assets and metadata
1639
+
1640
+ **Generated Assets**:
1641
+
1642
+ - **Traditional Favicons**: `.ico`, `.png` files in various sizes
1643
+ - **Apple Touch Icons**: iOS home screen and app icons
1644
+ - **Android Chrome Icons**: Android browser and app icons
1645
+ - **Microsoft Tiles**: Windows tile icons
1646
+ - **Startup Screens**: iOS splash screens for all orientations
1647
+ - **PWA Manifest**: Web app manifest with proper configuration
1648
+ - **Browser Configs**: Platform-specific configuration files
1649
+
1650
+ **Parameters:**
1651
+ `favicons.types.ts`
1652
+
1653
+ - **`id`**: Unique identifier for the web app (required)
1654
+ - **`sourcePath`**: Path to source image (required)
1655
+ - **`buildPath`**: Output directory path
1656
+ - **`appName`**: Full application name (required)
1657
+ - **`appShortName`**: Short application name (required)
1658
+ - **`appDescription`**: Application description (required)
1659
+ - **`version`**: Application version (required)
1660
+ - **Additional Options**: All favicons package options supported
1661
+
1662
+ ---
1663
+
1664
+ #### Generator Orchestration
1665
+
1666
+ ##### MASTER GENERATOR `src/generators/master/master.generator.ts`
1667
+
1668
+ - **Purpose**: Orchestrates all individual generators
1669
+ - **Functionality**:
1670
+ - Accepts configuration for all generators
1671
+ - Executes generators selectively based on configuration
1672
+ - Manages build paths and shared parameters
1673
+ - Provides unified interface for the entire system
1674
+
1675
+ **Individual Generators**:
1676
+ Each generator follows the same pattern:
1677
+
1678
+ - **`*.generator.ts`**: Main generation logic
1679
+ - **`*.types.ts`**: Generator-specific parameter types
1680
+ - **Dependencies**: Use shared utilities and types
1681
+
1682
+ #### Dependencies and Data Flow
1683
+
1684
+ **1. Type Dependencies**:
1685
+
1686
+ ```text
1687
+ All generators → generator.types.ts
1688
+ Tokens generator → utils.types.ts (Kebab type)
1689
+ Platform types, format types → tokens.types.ts
1690
+ Format types → platform.types.ts
1691
+ Handler implementations → format.types.ts
1692
+ ```
1693
+
1694
+ **2. Handler Dependencies**:
1695
+
1696
+ ```text
1697
+ basic.handler.ts → formats.utils.ts, strings.utils.ts
1698
+ color.handler.ts → color-tokens.utils.ts, formats.utils.ts
1699
+ utopia.handler.ts → utopia-tokens.utils.ts, formats.utils.ts
1700
+ ```
1701
+
1702
+ **3. Platform Dependencies**:
1703
+
1704
+ ```text
1705
+ platforms/index.ts → All platform implementations
1706
+ platforms/*/index.ts → formats.utils.ts, strings.utils.ts
1707
+ platforms/*/formats.ts → format.types.ts
1708
+ platforms/*/utils.ts → Platform-specific utilities
1709
+ ```
1710
+
1711
+ **4. Generator Dependencies**:
1712
+
1713
+ ```text
1714
+ tokens.generator.ts → platforms/index.ts, platforms/formats.ts
1715
+ master.generator.ts → All individual generators
1716
+ All generators → defaults.ts, types/index.ts
1717
+ ```
1718
+
1719
+ **5. Utility Dependencies**:
1720
+
1721
+ ```text
1722
+ formats.utils.ts → strings.utils.ts
1723
+ color-tokens.utils.ts → strings.utils.ts
1724
+ utopia-tokens.utils.ts → strings.utils.ts
1725
+ generators.utils.ts → strings.utils.ts
1726
+ ```
1727
+
1728
+ This architecture ensures:
1729
+
1730
+ - **Modularity**: Each component has a single responsibility
1731
+ - **Extensibility**: New platforms and token types can be easily added
1732
+ - **Type Safety**: Comprehensive TypeScript types prevent runtime errors
1733
+ - **Maintainability**: Clear separation of concerns and dependencies
1734
+ - **Performance**: Efficient token processing and file generation
1735
+
1736
+ ## 📋 Output Examples
1737
+
1738
+ ### Output File Structure
1739
+
1740
+ The following represents the complete file structure of the `dist` directory that can be generated by the **mDEV** module:
1741
+
1742
+ ```text
1743
+ dist/
1744
+ ├── css/
1745
+ │ ├── font-faces.css
1746
+ │ ├── icons.css
1747
+ │ ├── scrollbar.css
1748
+ │ └── viewport-scaler.css
1749
+ ├── tokens/
1750
+ │ ├── css/
1751
+ │ │ ├── all.css
1752
+ │ │ ├── border-color.css
1753
+ │ │ ├── border-radius.css
1754
+ │ │ ├── border-style.css
1755
+ │ │ ├── border-width.css
1756
+ │ │ ├── box-shadow.css
1757
+ │ │ ├── breakpoint.css
1758
+ │ │ ├── color.css
1759
+ │ │ ├── dimensions.css
1760
+ │ │ ├── font-family.css
1761
+ │ │ ├── font-size.css
1762
+ │ │ ├── font-weight.css
1763
+ │ │ ├── letter-spacing.css
1764
+ │ │ ├── line-height.css
1765
+ │ │ ├── opacity.css
1766
+ │ │ └── size.css
1767
+ │ ├── js/
1768
+ │ │ ├── static.js
1769
+ │ │ └── variable.js
1770
+ │ ├── scss/
1771
+ │ │ ├── all.scss
1772
+ │ │ ├── border-color.scss
1773
+ │ │ ├── border-radius.scss
1774
+ │ │ ├── border-style.scss
1775
+ │ │ ├── border-width.scss
1776
+ │ │ ├── box-shadow.scss
1777
+ │ │ ├── breakpoint.scss
1778
+ │ │ ├── color.scss
1779
+ │ │ ├── dimensions.scss
1780
+ │ │ ├── font-family.scss
1781
+ │ │ ├── font-size.scss
1782
+ │ │ ├── font-weight.scss
1783
+ │ │ ├── letter-spacing.scss
1784
+ │ │ ├── line-height.scss
1785
+ │ │ ├── opacity.scss
1786
+ │ │ └── size.scss
1787
+ │ └── json/
1788
+ │ └── all.json
1789
+ └── favicons/
1790
+ ├── android-chrome-36x36.png
1791
+ ├── android-chrome-48x48.png
1792
+ ├── android-chrome-72x72.png
1793
+ ├── android-chrome-96x96.png
1794
+ ├── android-chrome-144x144.png
1795
+ ├── android-chrome-192x192.png
1796
+ ├── android-chrome-256x256.png
1797
+ ├── android-chrome-384x384.png
1798
+ ├── android-chrome-512x512.png
1799
+ ├── android-chrome-maskable-36x36.png
1800
+ ├── android-chrome-maskable-48x48.png
1801
+ ├── android-chrome-maskable-72x72.png
1802
+ ├── android-chrome-maskable-96x96.png
1803
+ ├── android-chrome-maskable-144x144.png
1804
+ ├── android-chrome-maskable-192x192.png
1805
+ ├── android-chrome-maskable-256x256.png
1806
+ ├── android-chrome-maskable-384x384.png
1807
+ ├── android-chrome-maskable-512x512.png
1808
+ ├── apple-touch-icon.png
1809
+ ├── apple-touch-icon-57x57.png
1810
+ ├── apple-touch-icon-60x60.png
1811
+ ├── apple-touch-icon-72x72.png
1812
+ ├── apple-touch-icon-76x76.png
1813
+ ├── apple-touch-icon-114x114.png
1814
+ ├── apple-touch-icon-120x120.png
1815
+ ├── apple-touch-icon-144x144.png
1816
+ ├── apple-touch-icon-152x152.png
1817
+ ├── apple-touch-icon-167x167.png
1818
+ ├── apple-touch-icon-180x180.png
1819
+ ├── apple-touch-icon-1024x1024.png
1820
+ ├── apple-touch-icon-precomposed.png
1821
+ ├── apple-touch-startup-image-640x1136.png
1822
+ ├── apple-touch-startup-image-750x1334.png
1823
+ ├── apple-touch-startup-image-828x1792.png
1824
+ ├── apple-touch-startup-image-1125x2436.png
1825
+ ├── apple-touch-startup-image-1136x640.png
1826
+ ├── apple-touch-startup-image-1170x2532.png
1827
+ ├── apple-touch-startup-image-1179x2556.png
1828
+ ├── apple-touch-startup-image-1242x2208.png
1829
+ ├── apple-touch-startup-image-1242x2688.png
1830
+ ├── apple-touch-startup-image-1284x2778.png
1831
+ ├── apple-touch-startup-image-1290x2796.png
1832
+ ├── apple-touch-startup-image-1334x750.png
1833
+ ├── apple-touch-startup-image-1488x2266.png
1834
+ ├── apple-touch-startup-image-1536x2048.png
1835
+ ├── apple-touch-startup-image-1620x2160.png
1836
+ ├── apple-touch-startup-image-1640x2160.png
1837
+ ├── apple-touch-startup-image-1668x2224.png
1838
+ ├── apple-touch-startup-image-1668x2388.png
1839
+ ├── apple-touch-startup-image-1792x828.png
1840
+ ├── apple-touch-startup-image-2048x1536.png
1841
+ ├── apple-touch-startup-image-2048x2732.png
1842
+ ├── apple-touch-startup-image-2160x1620.png
1843
+ ├── apple-touch-startup-image-2160x1640.png
1844
+ ├── apple-touch-startup-image-2208x1242.png
1845
+ ├── apple-touch-startup-image-2224x1668.png
1846
+ ├── apple-touch-startup-image-2266x1488.png
1847
+ ├── apple-touch-startup-image-2388x1668.png
1848
+ ├── apple-touch-startup-image-2436x1125.png
1849
+ ├── apple-touch-startup-image-2532x1170.png
1850
+ ├── apple-touch-startup-image-2556x1179.png
1851
+ ├── apple-touch-startup-image-2688x1242.png
1852
+ ├── apple-touch-startup-image-2732x2048.png
1853
+ ├── apple-touch-startup-image-2778x1284.png
1854
+ ├── apple-touch-startup-image-2796x1290.png
1855
+ ├── favicon.ico
1856
+ ├── favicon-16x16.png
1857
+ ├── favicon-32x32.png
1858
+ ├── favicon-48x48.png
1859
+ ├── mstile-70x70.png
1860
+ ├── mstile-144x144.png
1861
+ ├── mstile-150x150.png
1862
+ ├── mstile-310x150.png
1863
+ ├── mstile-310x310.png
1864
+ ├── yandex-browser-50x50.png
1865
+ ├── yandex-browser-manifest.json
1866
+ ├── browserconfig.xml
1867
+ └── manifest.webmanifest
1868
+ ```
1869
+
1870
+ ### Output Files Content
1871
+
1872
+ The following examples illustrate what the outputs produced by the available generators look like.
1873
+
1874
+ #### Design Tokens Output Example
1875
+
1876
+ Details on how such an output can be generated are provided in the [Design Tokens Feature](#design-tokens-feature) section.
1877
+
1878
+ ##### CSS CUSTOM PROPERTIES OUTPUT
1879
+
1880
+ ```css
1881
+ /* =================================================== */
1882
+ /* CSS TOKENS */
1883
+ /* =================================================== */
1884
+
1885
+ /* FONT FAMILY */
1886
+
1887
+ :root {
1888
+ --ds-font-family-sans: Helvetica, system-ui, sans-serif;
1889
+ --ds-font-family-monospace: ui-monospace, monospace;
1890
+ --ds-font-family-icon: Iconography;
1891
+ }
1892
+
1893
+ /* FONT SIZE */
1894
+
1895
+ @media all and (max-width: 599px) {
1896
+ :root {
1897
+ --ds-font-size-display: 32px;
1898
+ --ds-font-size-head: 24px;
1899
+ --ds-font-size-title: 20px;
1900
+ --ds-font-size-subtitle: 16px;
1901
+ --ds-font-size-body: 14px;
1902
+ }
1903
+ }
1904
+
1905
+ @media all and (min-width: 600px) and (max-width: 1200px) {
1906
+ :root {
1907
+ --ds-font-size-display: calc(2.4rem + 1.33333vw);
1908
+ --ds-font-size-head: calc(1.6rem + 1.33333vw);
1909
+ --ds-font-size-title: calc(1.6rem + 0.66667vw);
1910
+ --ds-font-size-subtitle: calc(1.2rem + 0.66667vw);
1911
+ --ds-font-size-body: calc(1rem + 0.66667vw);
1912
+ }
1913
+ }
1914
+
1915
+ @media all and (min-width: 1201px) {
1916
+ :root {
1917
+ --ds-font-size-display: 40px;
1918
+ --ds-font-size-head: 32px;
1919
+ --ds-font-size-title: 24px;
1920
+ --ds-font-size-subtitle: 20px;
1921
+ --ds-font-size-body: 18px;
1922
+ }
1923
+ }
1924
+
1925
+ :root {
1926
+ --ds-font-size-base: 10px;
1927
+ --ds-font-size-base-percentage: 62.5%;
1928
+ }
1929
+
1930
+ /* FONT WEIGHT */
1931
+
1932
+ :root {
1933
+ --ds-font-weight-helvetica-regular: 400;
1934
+ --ds-font-weight-helvetica-bold: 700;
1935
+ }
1936
+
1937
+ /* LETTER SPACING */
1938
+
1939
+ :root {
1940
+ --ds-letter-spacing-base: 0;
1941
+ --ds-letter-spacing-bit: 0.08em;
1942
+ }
1943
+
1944
+ /* LINE HEIGHT */
1945
+
1946
+ :root {
1947
+ --ds-line-height-none: 0;
1948
+ --ds-line-height-100: 1;
1949
+ --ds-line-height-120: 1.2;
1950
+ --ds-line-height-140: 1.4;
1951
+ }
1952
+ ```
1953
+
1954
+ ---
1955
+
1956
+ ##### JS OBJECTS OUTPUT
1957
+
1958
+ ```js
1959
+ /* =================================================== */
1960
+ /* JS TOKENS (VARIABLE) */
1961
+ /* =================================================== */
1962
+
1963
+ /* FONT FAMILY */
1964
+
1965
+ export const fontFamily = {
1966
+ sans: 'var(--ds-font-family-sans)',
1967
+ monospace: 'var(--ds-font-family-monospace)',
1968
+ icon: 'var(--ds-font-family-icon)'
1969
+ };
1970
+
1971
+ /* FONT SIZE */
1972
+
1973
+ export const fontSize = {
1974
+ base: 'var(--ds-font-size-base)',
1975
+ 'base-percentage': 'var(--ds-font-size-base-percentage)',
1976
+ display: 'var(--ds-font-size-display)',
1977
+ head: 'var(--ds-font-size-head)',
1978
+ title: 'var(--ds-font-size-title)',
1979
+ subtitle: 'var(--ds-font-size-subtitle)',
1980
+ body: 'var(--ds-font-size-body)'
1981
+ };
1982
+
1983
+ /* FONT WEIGHT */
1984
+
1985
+ export const fontWeight = {
1986
+ 'helvetica-regular': 'var(--ds-font-weight-helvetica-regular)',
1987
+ 'helvetica-bold': 'var(--ds-font-weight-helvetica-bold)'
1988
+ };
1989
+
1990
+ /* LETTER SPACING */
1991
+
1992
+ export const letterSpacing = {
1993
+ base: 'var(--ds-letter-spacing-base)',
1994
+ bit: 'var(--ds-letter-spacing-bit)'
1995
+ };
1996
+
1997
+ /* LINE HEIGHT */
1998
+
1999
+ export const lineHeight = {
2000
+ none: 'var(--ds-line-height-none)',
2001
+ 100: 'var(--ds-line-height-100)',
2002
+ 120: 'var(--ds-line-height-120)',
2003
+ 140: 'var(--ds-line-height-140)'
2004
+ };
2005
+ ```
2006
+
2007
+ #### Viewport Scaler Output Example
2008
+
2009
+ Details on how such an output can be generated are provided in the [Viewport Scaler Feature](#viewport-scaler-feature) section.
2010
+
2011
+ ```css
2012
+ /* =================================================== */
2013
+ /* VIEWPORT SCALER */
2014
+ /* =================================================== */
2015
+
2016
+ @media all and (max-width: 299px) {
2017
+ :root {
2018
+ --ds-root-font-size: calc((10 * 100vw) / 300);
2019
+ }
2020
+ }
2021
+
2022
+ @media all and (min-width: 300px) and (max-width: 2100px) {
2023
+ :root {
2024
+ --ds-root-font-size: var(--ds-font-size-base-percentage);
2025
+ }
2026
+ }
2027
+
2028
+ @media all and (min-width: 2101px) {
2029
+ :root {
2030
+ --ds-root-font-size: var(--ds-font-size-base-percentage);
2031
+ }
2032
+
2033
+ html.presentation-mode {
2034
+ --ds-root-font-size: calc((10 * 100vw) / 2100);
2035
+ }
2036
+ }
2037
+ ```
2038
+
2039
+ #### Scrollbar Output Example
2040
+
2041
+ Details on how such an output can be generated are provided in the [Scrollbar Feature](#scrollbar-feature) section.
2042
+
2043
+ ```css
2044
+ /* =================================================== */
2045
+ /* SCROLLBAR */
2046
+ /* =================================================== */
2047
+
2048
+ html:not(.isMacOs) {
2049
+ --scrollbar-area: 16px;
2050
+ --scrollbar-thumb-size-base: 4px;
2051
+ --scrollbar-thumb-size-over: 10px;
2052
+ --scrollbar-gap-size-base: calc(
2053
+ (var(--scrollbar-area) - var(--scrollbar-thumb-size-base)) / 2
2054
+ ); /* 6px */
2055
+ --scrollbar-gap-size-over: calc(
2056
+ (var(--scrollbar-area) - var(--scrollbar-thumb-size-over)) / 2
2057
+ ); /* 3px */
2058
+ --scrollbar-background: transparent;
2059
+ --scrollbar-thumb-color: var(--ds-color-content-gray-weak);
2060
+ --scrollbar-thumb-color-hover: var(--ds-color-content-gray-weak);
2061
+ --scrollbar-thumb-color-active: var(--ds-color-content-gray-medium);
2062
+ --scrollbar-thumb-min-size: 80px;
2063
+
2064
+ /* Scrollbar area */
2065
+ ::-webkit-scrollbar:vertical {
2066
+ width: var(--scrollbar-area);
2067
+ }
2068
+
2069
+ ::-webkit-scrollbar:horizontal {
2070
+ height: var(--scrollbar-area);
2071
+ }
2072
+
2073
+ ::-webkit-scrollbar {
2074
+ scroll-margin: 0;
2075
+ background-color: var(--scrollbar-background);
2076
+ }
2077
+
2078
+ /* Track */
2079
+ ::-webkit-scrollbar-track-piece {
2080
+ border: var(--scrollbar-gap-size-base) solid transparent;
2081
+ border-radius: var(--scrollbar-thumb-size-base);
2082
+ background-color: transparent;
2083
+ }
2084
+
2085
+ /* Thumb */
2086
+ ::-webkit-scrollbar-thumb:vertical {
2087
+ min-height: var(--scrollbar-thumb-min-size);
2088
+ }
2089
+
2090
+ ::-webkit-scrollbar-thumb:horizontal {
2091
+ min-width: var(--scrollbar-thumb-min-size);
2092
+ }
2093
+
2094
+ ::-webkit-scrollbar-thumb {
2095
+ border: var(--scrollbar-gap-size-base) solid transparent;
2096
+ border-radius: var(--scrollbar-area);
2097
+ background: var(--scrollbar-thumb-color);
2098
+ }
2099
+
2100
+ ::-webkit-scrollbar-thumb:hover {
2101
+ --scrollbar-thumb-color: var(--scrollbar-thumb-color-hover);
2102
+ }
2103
+
2104
+ ::-webkit-scrollbar-thumb:active {
2105
+ --scrollbar-thumb-color: var(--scrollbar-thumb-color-active);
2106
+ }
2107
+
2108
+ ::-webkit-scrollbar-thumb:hover,
2109
+ ::-webkit-scrollbar-thumb:active {
2110
+ border: var(--scrollbar-gap-size-over) solid transparent;
2111
+ }
2112
+
2113
+ ::-webkit-scrollbar-thumb,
2114
+ ::-webkit-scrollbar-thumb:hover,
2115
+ ::-webkit-scrollbar-thumb:active {
2116
+ background-clip: padding-box;
2117
+ }
2118
+
2119
+ /* Cursor */
2120
+ ::-webkit-scrollbar-track-piece,
2121
+ ::-webkit-scrollbar-track-piece:hover,
2122
+ ::-webkit-scrollbar-track-piece:active {
2123
+ cursor: default;
2124
+ }
2125
+
2126
+ ::-webkit-scrollbar-thumb:vertical,
2127
+ ::-webkit-scrollbar-thumb:vertical:hover,
2128
+ ::-webkit-scrollbar-thumb:vertical:active {
2129
+ cursor: ns-resize;
2130
+ }
2131
+
2132
+ ::-webkit-scrollbar-thumb:horizontal,
2133
+ ::-webkit-scrollbar-thumb:horizontal:hover,
2134
+ ::-webkit-scrollbar-thumb:horizontal:active {
2135
+ cursor: ew-resize;
2136
+ }
2137
+
2138
+ /* Button */
2139
+ ::-webkit-scrollbar-button {
2140
+ display: none;
2141
+ }
2142
+ }
2143
+ ```
2144
+
2145
+ #### Font Faces Output Example
2146
+
2147
+ Details on how such an output can be generated are provided in the [Font Faces Feature](#font-faces-feature) section.
2148
+
2149
+ ```css
2150
+ /* =================================================== */
2151
+ /* FONT FACES */
2152
+ /* =================================================== */
2153
+
2154
+ @font-face {
2155
+ font-family: Iconography;
2156
+ font-style: normal;
2157
+ font-weight: 400;
2158
+ src: url('fonts/Iconography/Iconography-Regular.woff2') format('woff2');
2159
+ }
2160
+
2161
+ @font-face {
2162
+ font-family: Helvetica;
2163
+ font-style: normal;
2164
+ font-weight: 400;
2165
+ src: url('fonts/Helvetica/Helvetica-Regular.woff2') format('woff2');
2166
+ }
2167
+
2168
+ @font-face {
2169
+ font-family: Helvetica;
2170
+ font-style: italic;
2171
+ font-weight: 400;
2172
+ src: url('fonts/Helvetica/Helvetica-Italic.woff2') format('woff2');
2173
+ }
2174
+
2175
+ @font-face {
2176
+ font-family: Helvetica;
2177
+ font-style: normal;
2178
+ font-weight: 700;
2179
+ src: url('fonts/Helvetica/Helvetica-Bold.woff2') format('woff2');
2180
+ }
2181
+
2182
+ @font-face {
2183
+ font-family: Helvetica;
2184
+ font-style: italic;
2185
+ font-weight: 700;
2186
+ src: url('fonts/Helvetica/Helvetica-BoldItalic.woff2') format('woff2');
2187
+ }
2188
+ ```
2189
+
2190
+ #### Icons Output Example
2191
+
2192
+ Details on how such an output can be generated are provided in the [Icons Feature](#icons-feature) section.
2193
+
2194
+ ```css
2195
+ /* =================================================== */
2196
+ /* ICONS */
2197
+ /* =================================================== */
2198
+
2199
+ [data-i] {
2200
+ display: inline-block;
2201
+ width: 1em;
2202
+ height: 1em;
2203
+ color: var(--ds-color-content-gray-weak);
2204
+ font-family: DevIcons;
2205
+ font-weight: normal;
2206
+ font-style: normal;
2207
+ line-height: 1;
2208
+ }
2209
+
2210
+ [data-i]::after {
2211
+ display: inline-block;
2212
+ width: 100%;
2213
+ height: 100%;
2214
+ font-size: 1.25em;
2215
+ line-height: 0.6em;
2216
+ }
2217
+
2218
+ [data-i='main']::after {
2219
+ content: '\E000';
2220
+ }
2221
+
2222
+ [data-i='nav']::after {
2223
+ content: '\E001';
2224
+ }
2225
+
2226
+ [data-i='search']::after {
2227
+ content: '\E002';
2228
+ }
2229
+
2230
+ [data-i='profile']::after {
2231
+ content: '\E003';
2232
+ }
2233
+
2234
+ [data-i='play']::after {
2235
+ content: '\E004';
2236
+ }
2237
+
2238
+ [data-i='publication']::after {
2239
+ content: '\E005';
2240
+ }
2241
+
2242
+ [data-i='close']::after {
2243
+ content: '\E006';
2244
+ }
2245
+
2246
+ [data-i='clear']::after {
2247
+ content: '\E007';
2248
+ }
2249
+ ```
2250
+
2251
+ #### Favicons Output Example
2252
+
2253
+ Details on how such an output can be generated are provided in the [Favicons Feature](#favicons-feature) section.
2254
+
2255
+ ```text
2256
+ favicons/
2257
+ ├── android-chrome-36x36.png
2258
+ ├── android-chrome-48x48.png
2259
+ ├── android-chrome-72x72.png
2260
+ ├── android-chrome-96x96.png
2261
+ ├── android-chrome-144x144.png
2262
+ ├── android-chrome-192x192.png
2263
+ ├── android-chrome-256x256.png
2264
+ ├── android-chrome-384x384.png
2265
+ ├── android-chrome-512x512.png
2266
+ ├── android-chrome-maskable-36x36.png
2267
+ ├── android-chrome-maskable-48x48.png
2268
+ ├── android-chrome-maskable-72x72.png
2269
+ ├── android-chrome-maskable-96x96.png
2270
+ ├── android-chrome-maskable-144x144.png
2271
+ ├── android-chrome-maskable-192x192.png
2272
+ ├── android-chrome-maskable-256x256.png
2273
+ ├── android-chrome-maskable-384x384.png
2274
+ ├── android-chrome-maskable-512x512.png
2275
+ ├── apple-touch-icon.png
2276
+ ├── apple-touch-icon-57x57.png
2277
+ ├── apple-touch-icon-60x60.png
2278
+ ├── apple-touch-icon-72x72.png
2279
+ ├── apple-touch-icon-76x76.png
2280
+ ├── apple-touch-icon-114x114.png
2281
+ ├── apple-touch-icon-120x120.png
2282
+ ├── apple-touch-icon-144x144.png
2283
+ ├── apple-touch-icon-152x152.png
2284
+ ├── apple-touch-icon-167x167.png
2285
+ ├── apple-touch-icon-180x180.png
2286
+ ├── apple-touch-icon-1024x1024.png
2287
+ ├── apple-touch-icon-precomposed.png
2288
+ ├── apple-touch-startup-image-640x1136.png
2289
+ ├── apple-touch-startup-image-750x1334.png
2290
+ ├── apple-touch-startup-image-828x1792.png
2291
+ ├── apple-touch-startup-image-1125x2436.png
2292
+ ├── apple-touch-startup-image-1136x640.png
2293
+ ├── apple-touch-startup-image-1170x2532.png
2294
+ ├── apple-touch-startup-image-1179x2556.png
2295
+ ├── apple-touch-startup-image-1242x2208.png
2296
+ ├── apple-touch-startup-image-1242x2688.png
2297
+ ├── apple-touch-startup-image-1284x2778.png
2298
+ ├── apple-touch-startup-image-1290x2796.png
2299
+ ├── apple-touch-startup-image-1334x750.png
2300
+ ├── apple-touch-startup-image-1488x2266.png
2301
+ ├── apple-touch-startup-image-1536x2048.png
2302
+ ├── apple-touch-startup-image-1620x2160.png
2303
+ ├── apple-touch-startup-image-1640x2160.png
2304
+ ├── apple-touch-startup-image-1668x2224.png
2305
+ ├── apple-touch-startup-image-1668x2388.png
2306
+ ├── apple-touch-startup-image-1792x828.png
2307
+ ├── apple-touch-startup-image-2048x1536.png
2308
+ ├── apple-touch-startup-image-2048x2732.png
2309
+ ├── apple-touch-startup-image-2160x1620.png
2310
+ ├── apple-touch-startup-image-2160x1640.png
2311
+ ├── apple-touch-startup-image-2208x1242.png
2312
+ ├── apple-touch-startup-image-2224x1668.png
2313
+ ├── apple-touch-startup-image-2266x1488.png
2314
+ ├── apple-touch-startup-image-2388x1668.png
2315
+ ├── apple-touch-startup-image-2436x1125.png
2316
+ ├── apple-touch-startup-image-2532x1170.png
2317
+ ├── apple-touch-startup-image-2556x1179.png
2318
+ ├── apple-touch-startup-image-2688x1242.png
2319
+ ├── apple-touch-startup-image-2732x2048.png
2320
+ ├── apple-touch-startup-image-2778x1284.png
2321
+ ├── apple-touch-startup-image-2796x1290.png
2322
+ ├── favicon.ico
2323
+ ├── favicon-16x16.png
2324
+ ├── favicon-32x32.png
2325
+ ├── favicon-48x48.png
2326
+ ├── mstile-70x70.png
2327
+ ├── mstile-144x144.png
2328
+ ├── mstile-150x150.png
2329
+ ├── mstile-310x150.png
2330
+ ├── mstile-310x310.png
2331
+ ├── yandex-browser-50x50.png
2332
+ ├── yandex-browser-manifest.json
2333
+ ├── browserconfig.xml
2334
+ └── manifest.webmanifest
2335
+ ```
2336
+
2337
+ ## 🤝🏻 Contributing
2338
+
2339
+ This is a personal tool and no contributions are expected.
2340
+ At least for now. 😋