@microphi/styles 1.5.0 → 1.5.2

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 (4) hide show
  1. package/AGENTS.md +10 -0
  2. package/README.md +55 -188
  3. package/package.json +19 -6
  4. package/CHANGELOG.md +0 -64
package/AGENTS.md ADDED
@@ -0,0 +1,10 @@
1
+ # @microphi/styles — notes for coding agents
2
+
3
+ Flex-first SCSS utility classes. Full docs: [README.md](README.md).
4
+
5
+ ## Rules
6
+
7
+ - Load once: `@use '@microphi/styles/scss/main';` (requires `utopia-core-scss`).
8
+ - Classes are prefixed `fx-` (`fx-flex`, `fx-gap-4`, `fx-p-2`); responsive variants use `md:` style prefixes (`md:fx-flex-row`).
9
+ - Spacing and font sizes are fluid steps of a Utopia scale (`fx-text-{step}`), not pixel values: don't add fixed `px` overrides for them.
10
+ - Check `scss/` for the exact class before inventing one; prefer composing utilities over new CSS.
package/README.md CHANGED
@@ -1,219 +1,86 @@
1
- # fx-scss
1
+ # @microphi/styles [![npm](https://img.shields.io/npm/v/@microphi/styles)](https://www.npmjs.com/package/@microphi/styles)
2
2
 
3
- Welcome to the **fx-scss**, a flex first set of css classes to ease
3
+ > Flex-first SCSS utilities
4
4
 
5
- ## Motivations
6
- While working on Microgamma we went through all available scss libraries. All lacked a flex first approach to layouting.
7
- We believe in a flex first approach when it comes to layouting. This library is the result of our though process in term of layouting and utilities.
5
+ Utility classes (prefixed `fx-`) built flex-first: while working on [microgamma](https://github.com/microph1) none of the available libraries treated flex layout as the default, so this is ours. Spacing and font sizes are fluid, driven by a [Utopia](https://utopia.fyi) scale.
8
6
 
7
+ ## Install
9
8
 
10
- ## Table of Contents
11
-
12
- - [Features](#features)
13
- - [Installation](#installation)
14
- - [Getting Started](#getting-started)
15
- - [Folder Structure](#folder-structure)
16
- - [Customization](#customization)
17
- - [Contributing](#contributing)
18
- - [License](#license)
19
-
20
- ## Features
21
-
22
- - **Modular Architecture:** A well-organized structure with reusable components and utilities.
23
- - **Flex layout system:** Flex layout system for clear and powerful layouting.
24
- - **Grid layout system:** Comprehensive CSS Grid utilities for modern layout solutions.
25
- - **Utility Classes:** Commonly used utility classes for margin, padding, colors, typography, etc.
26
- # - **Mixins and Functions:** Custom mixins and functions to reduce repetitive CSS and enhance your workflow.
27
- # - **Theming Support:** Easy customization of themes through variables for colors, typography, and other design elements.
28
- - **Compatibility:** Fully compatible with modern browsers and responsive across all device sizes.
29
-
30
- ## Installation
31
-
32
- Install using your favorite package manager
33
-
34
- ```bash
35
- @microphi/flexus
9
+ ```sh
10
+ npm i @microphi/styles utopia-core-scss
36
11
  ```
37
12
 
38
- Alternatively, you can manually download the SCSS files and include them in your project.
39
-
40
- ## Getting Started
41
-
42
- library_name is made of the following scss modules
43
-
44
-
45
13
  ```scss
46
- @import 'path/to/scss-library/main.scss';
14
+ @use '@microphi/styles/scss/main';
47
15
  ```
48
16
 
49
- This will include the core styles and utilities in your project. You can then start building your styles on top of the provided components.
50
-
51
- ### Example Usage
17
+ (Point Sass's load path at `node_modules`, or use the full relative path.)
52
18
 
53
- Here's a basic example using the flex system and utility classes:
19
+ ## Example
54
20
 
55
21
  ```html
56
- <div class="fx-flex fx-justify-center fx-items-center">
57
- <div class="fx-w-full fx-h-50">
58
- <p class="text-primary">This is a flex container</p>
59
- </div>
22
+ <div class="fx-flex fx-flex-col md:fx-flex-row fx-justify-between fx-items-center fx-gap-4">
23
+ <div class="fx-w-50">Half width</div>
24
+ <div class="fx-grow-1">The rest</div>
60
25
  </div>
61
26
  ```
62
27
 
63
- ### Grid System
28
+ ## What's included
64
29
 
65
- The library also provides comprehensive CSS Grid utilities for modern layout solutions:
30
+ | Area | Examples |
31
+ |---|---|
32
+ | Display | `fx-flex`, `fx-grid`, `fx-block`, `fx-hidden` |
33
+ | Flex | `fx-flex-row`, `fx-flex-col`, `fx-flex-wrap`, `fx-grow-1`, `fx-shrink-0`, `fx-justify-between`, `fx-items-center`, `fx-fill-row` |
34
+ | Grid | `fx-grid-cols-3`, `fx-grid-rows-2`, `fx-col-span-2`, `fx-col-start-1`, `fx-row-span-2`, `fx-place-self-center` |
35
+ | Spacing | `fx-p-4`, `fx-px-2`, `fx-mt-1`, `fx-m-a` (auto), `fx-gap-4`, `fx-gap-row-2` |
36
+ | Sizing | `fx-w-50`, `fx-w-full`, `fx-h-full`, `fx-vh-50`, `fx-min-w-*`, `fx-max-h-*` |
37
+ | Position | `fx-relative`, `fx-absolute`, `fx-sticky`, `fx-inset-0`, `fx-top-0`, `fx-z-10` |
38
+ | Typography | `fx-text-{step}`, `fx-headline-1`, `fx-title`, `fx-body-1`, `fx-caption`, `fx-uppercase`, `fx-tracking-wide`, `text-ellipsis` |
39
+ | Misc | `fx-rounded-*`, `fx-opacity-50`, `fx-cursor-pointer` |
66
40
 
67
- ```html
68
- <div class="fx-grid fx-grid-cols-3 fx-gap-4">
69
- <div class="fx-col-span-2">Main content</div>
70
- <div>Sidebar</div>
71
- <div class="fx-col-start-1 fx-col-end-4">Full width footer</div>
72
- </div>
73
- ```
74
-
75
- #### Grid Container Utilities
76
-
77
- - `fx-grid` - Sets display: grid
78
- - `fx-grid-cols-{n}` - Defines grid-template-columns (1-12, none, subgrid)
79
- - `fx-grid-rows-{n}` - Defines grid-template-rows (1-6, none, subgrid)
80
- - `fx-grid-flow-{dir}` - Controls grid-auto-flow (row, column, dense, etc.)
81
- - `fx-gap-{size}` - Sets gap between grid items
82
- - `fx-gap-col-{size}` - Sets column-gap
83
- - `fx-gap-row-{size}` - Sets row-gap
84
- - `fx-justify-content-{alignment}` - Justifies content along the inline axis
85
- - `fx-content-{alignment}` - Aligns content along the block axis
86
- - `fx-justify-items-{alignment}` - Justifies grid items along the inline axis
87
- - `fx-items-{alignment}` - Aligns grid items along the block axis
88
- - `fx-place-content-{position}` - Sets place-content shorthand
89
- - `fx-place-items-{position}` - Sets place-items shorthand
90
-
91
- #### Grid Item Utilities
92
-
93
- - `fx-col-span-{n}` - Makes item span across n columns (1-12, auto, full)
94
- - `fx-row-span-{n}` - Makes item span across n rows (1-6, auto, full)
95
- - `fx-col-start-{n}` - Sets grid-column-start property
96
- - `fx-col-end-{n}` - Sets grid-column-end property
97
- - `fx-row-start-{n}` - Sets grid-row-start property
98
- - `fx-row-end-{n}` - Sets grid-row-end property
99
- - `fx-area-{value}` - Sets grid-area property
100
- - `fx-place-self-{position}` - Sets place-self property
101
-
102
- #### Responsive Grid
103
-
104
- All grid utilities are responsive and support breakpoints:
41
+ ### Responsive variants
105
42
 
106
- ```html
107
- <div class="fx-grid fx-grid-cols-1 sm:fx-grid-cols-2 lg:fx-grid-cols-3 fx-gap-4">
108
- <div>Responsive grid item</div>
109
- <div>Responsive grid item</div>
110
- <div>Responsive grid item</div>
111
- </div>
112
- ```
43
+ Layout utilities have breakpoint-prefixed variants that apply from that width up:
113
44
 
114
- ### Typography System
115
-
116
- The library provides a flexible typography system that works with the Utopia scale generator. You can customize the typography scale using the Utopia package and map the generated CSS variables to the fx-scss classes.
117
-
118
- #### Dynamic Font Size Classes
119
-
120
- The system generates font size classes dynamically based on your Utopia configuration:
45
+ | Prefix | Min width |
46
+ |---|---|
47
+ | `sm:` | 640px |
48
+ | `md:` | 768px |
49
+ | `lg:` | 1024px |
50
+ | `xl:` | 1280px |
51
+ | `xxl:` | 1536px |
121
52
 
122
53
  ```html
123
- <!-- Generate classes from --fx-typography--6 to --fx-typography-6 based on your scale -->
124
- <p class="fx-text-3">Larger text using --fx-typography-3 variable</p>
125
- <p class="fx-text-0">Base text using --fx-typography-0 variable</p>
126
- <p class="fx-text--2">Smaller text using --fx-typography--2 variable</p>
54
+ <div class="fx-grid fx-grid-cols-1 sm:fx-grid-cols-2 lg:fx-grid-cols-3 fx-gap-4">...</div>
127
55
  ```
128
56
 
129
- #### Semantic Typography Classes
57
+ Breakpoints come from the `$breakpoints` map in `_variables.scss` (`!default`, so it can be overridden).
130
58
 
131
- The library also provides semantic classes that map to specific scale steps:
59
+ ## Spacing and typography scale
132
60
 
133
- ```html
134
- <h1 class="fx-headline-1">Headline 1 using --fx-typography-1</h1>
135
- <h2 class="fx-headline-2">Headline 2 using --fx-typography-2</h2>
136
- <p class="fx-title">Title using --fx-typography-1</p>
137
- <p class="fx-subtitle">Subtitle using --fx-typography-0</p>
138
- <p class="fx-body-1">Body 1 using --fx-typography--1</p>
139
- <p class="fx-body-2">Body 2 using --fx-typography--2</p>
140
- <p class="fx-caption">Caption using --fx-typography--3</p>
141
- <p class="fx-overline">Overline using --fx-typography--4</p>
142
- ```
61
+ Spacing classes resolve to Utopia space variables (`--fx-3xs` … `--fx-2xl`), and `fx-text-{step}` to type-scale variables (`--fx-typography--4` … `--fx-typography-6`). Generate both with Utopia, using the `fx` prefix.
143
62
 
144
- #### Customizing Typography Variables
63
+ Semantic typography classes map to fixed steps:
145
64
 
146
- To customize which CSS variables the classes use (e.g., if using a different prefix in Utopia), define a custom `$typography-vars` map before importing fx-scss:
65
+ | Class | Step |
66
+ |---|---|
67
+ | `fx-headline-1` / `fx-title` | 1 |
68
+ | `fx-headline-2` | 2 |
69
+ | `fx-subtitle` | 0 |
70
+ | `fx-body-1` | -1 |
71
+ | `fx-body-2` | -2 |
72
+ | `fx-caption` | -3 |
73
+ | `fx-overline` | -4 |
147
74
 
148
- ```scss
149
- // Define custom mapping to match your Utopia configuration
150
- $typography-vars: (
151
- 1: var(--step-typography-1),
152
- 2: var(--step-typography-2),
153
- 3: var(--step-typography-3),
154
- 0: var(--step-typography-0),
155
- -1: var(--step-typography--1),
156
- -2: var(--step-typography--2),
157
- // ... etc for all steps in your scale
158
- ) !default;
159
-
160
- // Now import fx-scss
161
- @import 'path/to/fx-scss/main';
162
- ```
163
-
164
- ## Folder Structure
165
-
166
- The SCSS library follows a clean, modular structure:
167
-
168
- ```
169
- scss-library/
170
- │
171
- ├── base/ # Base styles (normalize, resets, typography, etc.)
172
- ├── components/ # Reusable components (buttons, cards, forms, etc.)
173
- ├── layout/ # Layout helpers (grid, containers, spacing, etc.)
174
- ├── mixins/ # Utility mixins (media queries, typography helpers, etc.)
175
- ├── themes/ # Theming (color palettes, variables, dark/light modes)
176
- └── utilities/ # Utility classes (margin, padding, display, etc.)
177
- ```
178
-
179
- ### Key Files
180
-
181
- - `main.scss`: The primary file to import into your project.
182
- - `variables.scss`: Defines default variables for colors, typography, spacing, etc.
183
- - `mixins.scss`: Contains mixins to simplify responsive design, typography, and other features.
184
-
185
- ## Customization
186
-
187
- The library is designed to be easily customizable. You can override the default variables by creating your own SCSS file and importing the library below your custom settings:
75
+ If your Utopia variables use a different name, override the mapping when loading the library:
188
76
 
189
77
  ```scss
190
- // Custom variables
191
- $primary-color: #007bff;
192
- $secondary-color: #6c757d;
193
-
194
- // Import library after customizations
195
- @import 'path/to/scss-library/main.scss';
78
+ @use '@microphi/styles/scss/main' with (
79
+ $typography-vars: (
80
+ 0: var(--step-0),
81
+ 1: var(--step-1),
82
+ -1: var(--step--1),
83
+ // ... every step in your scale
84
+ )
85
+ );
196
86
  ```
197
-
198
- ### Theming
199
-
200
- To create a custom theme, simply modify the variables in the `themes/` folder or define new ones in your project. You can switch between themes dynamically by overriding these variables.
201
-
202
- ## Contributing
203
-
204
- We welcome contributions to improve the library! To contribute, please follow these steps:
205
-
206
- 1. Fork the repository.
207
- 2. Create a new branch for your feature or bug fix.
208
- 3. Make your changes and ensure all SCSS is properly compiled.
209
- 4. Submit a pull request with a detailed explanation of your changes.
210
-
211
- Please follow the [contribution guidelines](CONTRIBUTING.md) for more details.
212
-
213
- ## License
214
-
215
- This SCSS library is open-source and available under the [MIT License](LICENSE).
216
-
217
- ---
218
-
219
- Feel free to open an issue if you have any questions or run into any issues while using the library. Happy coding!
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@microphi/styles",
3
- "version": "1.5.0",
4
- "description": "helper styles",
3
+ "version": "1.5.2",
4
+ "description": "Flex-first SCSS utilities",
5
5
  "scripts": {},
6
6
  "private": false,
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": " "
9
+ "url": "git+https://github.com/microph1/microphi.git",
10
+ "directory": "packages/styles"
10
11
  },
11
12
  "keywords": [
12
13
  "styles",
@@ -14,13 +15,25 @@
14
15
  "scss",
15
16
  "helpers"
16
17
  ],
17
- "author": "cavaliere.davide@gmail.com",
18
- "license": "ISC",
18
+ "author": {
19
+ "name": "Davide Cavaliere",
20
+ "email": "cavaliere.davide@gmail.com",
21
+ "url": "https://github.com/microph1"
22
+ },
23
+ "license": "MIT",
19
24
  "devDependencies": {
20
25
  "utopia-core-scss": "*"
21
26
  },
22
27
  "peerDependencies": {
23
28
  "utopia-core-scss": "^1.2.0"
24
29
  },
25
- "gitHead": "12fbf2b63f2a438be307cbbacec71b93f7312fa8"
30
+ "homepage": "https://github.com/microph1/microphi/tree/master/packages/styles#readme",
31
+ "bugs": {
32
+ "url": "https://github.com/microph1/microphi/issues"
33
+ },
34
+ "files": [
35
+ "scss",
36
+ "AGENTS.md"
37
+ ],
38
+ "gitHead": "859e7630f4ce943bad7424ea406f87830d3c3af2"
26
39
  }
package/CHANGELOG.md DELETED
@@ -1,64 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- # [1.5.0](https://example.com/compare/@microphi/styles@1.4.0...@microphi/styles@1.5.0) (2026-08-22)
7
-
8
- ### Features
9
-
10
- * **styles:** add position/layer/object utilities ([66306a2](https://example.com/commits/66306a22e64d8ee9f6586e5022197bcf7d6577f4))
11
-
12
- # [1.4.0](https://example.com/compare/@microphi/styles@1.3.1...@microphi/styles@1.4.0) (2026-07-22)
13
-
14
- ### Features
15
-
16
- * **microphi:** update styles, debug, and json-db packages ([38118b2](https://example.com/commits/38118b233d2e52a701065b34a889c153107edee5))
17
- * **styles:** add CSS Grid utilities and documentation 🎉 ([c1b2739](https://example.com/commits/c1b2739a61df448fe52c9ba6c0deb4d7029b6924))
18
- * **styles:** add opacity, text-transform, letter-spacing & min/max sizing utilities; fix .fx-grid display ✨ ([0c6d75b](https://example.com/commits/0c6d75b00129236dfcc5c674f0fc57c0aeca5b0f))
19
-
20
- ## [1.3.1](https://example.com/compare/@microphi/styles@1.3.0...@microphi/styles@1.3.1) (2025-10-09)
21
-
22
- **Note:** Version bump only for package @microphi/styles
23
-
24
- # [1.3.0](https://example.com/compare/@microphi/styles@1.2.5...@microphi/styles@1.3.0) (2025-09-25)
25
-
26
- ### Features
27
-
28
- * **styles:** font-weight should bring !important ([9bd1fda](https://example.com/commits/9bd1fdaadf01e1e18c327c78526d156029b8aba0))
29
-
30
- ## [1.2.5](https://example.com/compare/@microphi/styles@1.2.4...@microphi/styles@1.2.5) (2025-09-21)
31
-
32
- **Note:** Version bump only for package @microphi/styles
33
-
34
- ## [1.2.4](https://example.com/compare/@microphi/styles@1.2.3...@microphi/styles@1.2.4) (2025-09-21)
35
-
36
- ### Bug Fixes
37
-
38
- * **styles:** add more sizing options ([e944403](https://example.com/commits/e944403c47ec1d5e1f0625f6ffa638d86d191e85))
39
-
40
- ## [1.2.3](https://example.com/compare/@microphi/styles@1.2.2...@microphi/styles@1.2.3) (2025-06-30)
41
-
42
- ### Bug Fixes
43
-
44
- * **styles:** add more sizing options ([11c5de2](https://example.com/commits/11c5de2cd29088e3f69ed89e2c3ce1ea0fce3782))
45
-
46
- ## [1.2.2](https://example.com/compare/@microphi/styles@1.2.1...@microphi/styles@1.2.2) (2025-06-29)
47
-
48
- ### Bug Fixes
49
-
50
- * **styles:** adjust widths and heights so that we can always make 100 ([8ae3b5a](https://example.com/commits/8ae3b5aa4925f9a6f27b59e5537438fb2b713437))
51
-
52
- ## [1.2.1](https://example.com/compare/@microphi/styles@1.2.0...@microphi/styles@1.2.1) (2024-11-15)
53
-
54
- **Note:** Version bump only for package @microphi/styles
55
-
56
- # 1.2.0 (2024-11-15)
57
-
58
- ### Features
59
-
60
- * **styles:** fix deprecation warnings ([4fba924](https://example.com/commits/4fba924c5bcbfa9e4019cdfee33019e16561fbff))
61
-
62
- # [1.1.0](/compare/v0.2.10...v1.1.0) (2023-01-16)
63
-
64
- **Note:** Version bump only for package @microphi/styles