mlut documentation

9 #addons Addons

Addons may include styles, tools, utility sets, and more. For the time being, they are in a @mlut/core package, but later they will be moved into separate packages

Source: content/main.css, line 1770

9.1 #addons.how_works How it works

Here you will learn how to include addons and how to create your own.

Source: content/main.css, line 1780

9.1.1 #addons.how_works.create Create

At the moment, an addon is a regular Sass modules that add functionality to mlut or some CSS. Key point to keep in mind: addon is imported after user has configure mlut. This means that you cannot configure mlut tools as a Sass module. But you can modify the configuration manually

That said, it is recommended that you merge your configuration changes so that it does not erase the user's configuration (if hypothetically possible)

// import mlut tools
@use "@mlut/core/tools" as ml;

// add some new features
$new-colors: (
	'red0': #f22,
	'green0': #1f1,
	'blue0': #33f,
);

// neat merge it
ml.$utils-db: map.merge(
	ml.$utils-db, 'common', 'keywords', 'colors',
	map.merge(
		$new-colors,
		map.get(ml.$utils-db, 'common', 'keywords', 'colors')
	)
);
Source: content/main.css, line 1816

9.1.2 #addons.how_works.import Import

To import addon that contains utilities as CSS (AOT), you will need:

@charset "utf-8";

// import tools
@use "@mlut/core/tools" as ml;

// optional import styles from the core that you need: helpers, utilities, etc
@use "@mlut/core/dist/css/base-setup";

// import addons
@use "@mlut/core/dist/addons/demo-theme";

// import a module that initialize utilities
@use "@mlut/core/dist/css/utils/init";

You can also cancel the generation of all utilities from the addon, and get only the necessary values from there. To do this, pass the parameter to the config of the addon: $generate: false.

If the addon contains only a ready-made Sass/CSS code, it can be included in any order after tools. Addon also may have their own settings. They can be seen in the code or documentation.

Source: content/main.css, line 1790

9.2 #addons.catalog Catalog

Addons that are delivered with mlut are described here.

Source: content/main.css, line 1846

9.2.1 #addons.catalog.demo_theme Demo theme

A full-fledged design theme to create an interface. Contains a set of utilities and a colors palette.

By default (in JIT mode), only the palette will be loaded. If you want to load and generate utilities (AOT), pass $is-aot: true to the module configuration.

Source: ../packages/core/src/sass/addons/demo-theme.scss, line 4

9.2.1.1 #addons.catalog.demo_theme.colors Colors

Colors are automatically loaded into the mlut settings, so you can use them when adding utilities or styles. Utilities with colors are generated with range syntax.

  • step of color shade: 25
  • step in the value of utilities: 50
  • shades for each color: 8. This means that for each color there are shades from 0 to 350. For example: C-red0, Bgc-blue150
Name Base color
gray #c5ccd3
red #ff5c5c
orange #ffad5c
yellow #faeb61
green #70fa61
aqua #5cffbb
blue #62a8f8
purple #d35cff
Source: ../packages/core/src/sass/addons/demo-theme.scss, line 12

9.2.1.2 #addons.catalog.demo_theme.utils Utils (AOT)

Below are the utilities contained in the addon. Names of utilities in Generation Syntax are specified in the left column. In the right you can see the available values. In addition to the list, they can be spicified in the range syntax or as a map.

"BpAll _W"
  • 5u
  • 10u
  • 20u
  • 25u
  • 40u
  • 70u
"BpAll _H"
  • 5u
  • 10u
  • 20u
  • 25u
"BpAll_^:h _Colors_ h f fw ph"
  • [("gray0", "red0", "orange0", "yellow0", "green0", "aqua0", "blue0", "purple0"), 8, ("rgb": -25)]
  • "white"
"BpAll _Fns"
  • [1u, 8]
  • 3gg
  • 14u
  • 4gg
  • 5gg
"BpAll _Lnh"
md 1.4
lg 1.6
xl 1.8
xxl 2
"BpAll _Offsets"
  • [1u, 8]
"BpAll _Translates"
  • [1u, 8]
  • [-8u, -1]
"BpAll _BdWidth"
  • 1u
  • 2u
"BpAll _BdRadius"
  • 2
  • [1u, 4]
"BpAll ArSt_^:h _O_ h f fw"
  • [10p, 90, 10]
"BpAll ArSt_^:h _Bxsd_ h f fw"
sm
  • rgba(0, 0, 0, 0.16)
  • 0px
  • 1px
  • 4px
md
  • rgba(0, 0, 0, 0.24)
  • 0px
  • 3px
  • 8px
lg
  • rgba(0, 0, 0, 0.35)
  • 0px
  • 5px
  • 15px
"BpAll ArSt _-S_ h f"
  • 0.8
  • 0.9
  • 1.1
  • 1.2
  • 1.5
Source: content/generate.css, line 2850