diff --git a/CHANGELOG.md b/CHANGELOG.md index f347ba1a..19623018 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,12 @@ - [breaking] Rebuild Assembly's CSS pipeline on [UnoCSS](https://unocss.dev/). Class names and `buildUserAssets` stay compatible; the generated stylesheet's formatting, comments, and source maps may differ. Node.js 24+ is required. - [add] Export `presetAssembly()` for on-demand UnoCSS builds that keep Assembly class names. Pass `{ safelist: true }` only when you want the full prebuilt utility set. -- [add] `examples/jit` — a sample app that generates only the utilities used in its markup (no reset or component preflight). +- [add] `gap{size}`, `gapx{size}`, and `gapy{size}` on the padding scale, with `*-mm` / `*-ml` / `*-mxl` variants. Use with `flex` or `grid`. +- [breaking] `grid` is a 12-column CSS Grid. A `col` without a width class spans the full row, `w-1/12` to `w-11/12` set how many columns it spans, `ml-1/12` to `ml-11/12` set where it starts, and `grid--gut{size}` sets `column-gap`. `col--auto` is removed, and other left and right margins on a grid `col` are ignored. +- [add] `examples/jit` — a sample app that generates only the utilities used in its markup (no reset or component preflight). On-demand builds can also emit off-scale transforms (`rotate*`, `scale*`); pixel utilities stay on the documented scale. +- [add] `aspect-{ratio}` / `aspect-auto`, `object-{contain,cover,fill,none,scale-down}`, `flex--space-around-main` / `flex--space-evenly-main`, and transform utilities (`rotate{deg}`, `scale{percent}`). +- [breaking] `txt-break-word` uses `overflow-wrap: anywhere`, so words break only when they would overflow, instead of `word-break: break-all`. +- [add] `animation-shimmer`, `visible-on-parent-hover`, `bg-canvas`, and `bg-canvas--dark`. - [internal] Assembly utilities are UnoCSS rules in `src/preset/`. Reset and component CSS live in `src/preset/base.css`. The package build is `src/build-*.js`. The documentation site is VitePress under `docs/`. ## 1.16.0 diff --git a/MIGRATION_GUIDES.md b/MIGRATION_GUIDES.md index 48403458..96926d96 100644 --- a/MIGRATION_GUIDES.md +++ b/MIGRATION_GUIDES.md @@ -4,11 +4,11 @@ Version 2.0.0 rebuilds Assembly with [UnoCSS](https://unocss.dev/) while keeping the existing class names and `buildUserAssets` API. -You do not need to change class names in markup. Continue to use `assembly.css` / `assembly.js`, or keep calling `Assembly.buildUserAssets`. +Most markup works unchanged. Continue to use `assembly.css` / `assembly.js`, or keep calling `Assembly.buildUserAssets`. Check grids and `txt-break-word` for the changes below. What can change: -- The contents of `assembly.css` are generated by UnoCSS, so whitespace, comments, rule order, and source maps may differ from 1.x. Selectors and declarations for public classes stay the same. +- The contents of `assembly.css` are generated by UnoCSS, so whitespace, comments, rule order, and source maps may differ from 1.x. Selectors and declarations for public classes stay the same, except for the grid and `txt-break-word`. - Layout-scale media variants (`px12-mm`, `w-1/2-ml`, and so on) now use the same custom media queries you pass to `buildUserAssets`, instead of the hardcoded default breakpoints. - `@mapbox/assembly` now depends on `@unocss/core` (used when creating custom builds) and requires Node.js 24+. @@ -27,6 +27,29 @@ export default defineConfig({ The generated CSS still uses Assembly's CSS variables and custom media queries, so it needs a PostCSS step with `postcss-custom-properties` and `postcss-custom-media`. See [`presetAssembly` in the README](README.md#presetassemblyoptions) for the config. +### `grid` is CSS Grid + +`grid` is now a 12-column CSS Grid instead of a flexbox row. `grid`, `col`, `w-1/12` to `w-11/12`, and `grid--gut{size}` keep their names. Check grids that rely on flexbox behavior: + +- `col--auto` is removed. For columns that share the remaining space, use `flex` with `flex-child-grow` on the children. +- A `col` without a width class spans the full row instead of sizing to its content. For content-sized columns, use `flex`. +- `flex-child-*` classes have no effect on a `col`. +- Left and right margin classes on a `col` are ignored. `ml-1/12` to `ml-11/12` still offset a `col`, and need a `w-*` fraction class next to them. `mr-1/12` to `mr-11/12` have no grid equivalent. +- Give every direct child of `grid` the `col` class, including children that only have a `w-*` fraction class. +- `grid--gut{size}` sets `column-gap` instead of a negative margin on `grid` and padding on `col`. Add `gapy{size}` for space between rows. + +### `txt-break-word` + +`txt-break-word` uses `overflow-wrap: anywhere` instead of `word-break: break-all`, so words break only when they would overflow their container. + +### New utilities + +These are additive with 1.x class names: + +- `gap12` / `gapx12` / `gapy12` (padding scale) for `flex` and `grid` spacing. +- `aspect-16/9`, `object-cover`, `flex--space-evenly-main`, `rotate90`, `scale50`. +- `animation-shimmer`, `visible-on-parent-hover`, `bg-canvas`, `bg-canvas--dark`. + ## 1.0.0+ Version 1.0.0 of Assembly introduces breaking changes – learn how to resolve them with this handy guide. diff --git a/docs/.vitepress/theme/IconGrid.vue b/docs/.vitepress/theme/IconGrid.vue index 8a6a9115..ea056e31 100644 --- a/docs/.vitepress/theme/IconGrid.vue +++ b/docs/.vitepress/theme/IconGrid.vue @@ -7,7 +7,7 @@ import { data as icons } from './icons.data.js';
diff --git a/docs/.vitepress/theme/Layout.vue b/docs/.vitepress/theme/Layout.vue index 8cee1cbc..821a169a 100644 --- a/docs/.vitepress/theme/Layout.vue +++ b/docs/.vitepress/theme/Layout.vue @@ -87,16 +87,6 @@ function nestedWrapClass(parent, level) { return parent.isDoc && level === 0 ? 'block mt6' : 'inline-block block-mm'; } -function useProse() { - const current = normalized(route.path); - return ( - current !== '/' && - current !== '/catalog' && - !current.startsWith('/examples') && - !current.startsWith('/documentation') - ); -} - onMounted(() => { updateHash(); window.addEventListener('hashchange', updateHash); @@ -173,10 +163,7 @@ onUnmounted(() => {
-
+
diff --git a/docs/.vitepress/theme/LayoutScales.vue b/docs/.vitepress/theme/LayoutScales.vue index 1a9ae282..df4a1e99 100644 --- a/docs/.vitepress/theme/LayoutScales.vue +++ b/docs/.vitepress/theme/LayoutScales.vue @@ -22,6 +22,26 @@ const classSets = [ classPatterns: ['px{n}', 'py{n}', 'pl{n}', 'pt{n}', 'pr{n}', 'pb{n}'], scale: scales.padding }, + { + name: 'Gaps', + classPatterns: ['gap{n}', 'gapx{n}', 'gapy{n}'], + scale: scales.gap + }, + { + name: 'Aspect ratios', + classPatterns: ['aspect-{ratio}'], + scale: scales.aspectRatio + }, + { + name: 'Rotations', + classPatterns: ['rotate{n}'], + scale: scales.rotate + }, + { + name: 'Scales', + classPatterns: ['scale{n}'], + scale: scales.scale + }, { name: 'Widths', classPatterns: ['w{n}'], diff --git a/docs/.vitepress/theme/catalog/Grids.vue b/docs/.vitepress/theme/catalog/Grids.vue index fcc2ac7f..f8fef11c 100644 --- a/docs/.vitepress/theme/catalog/Grids.vue +++ b/docs/.vitepress/theme/catalog/Grids.vue @@ -12,6 +12,7 @@ const sizeCombos = [ ['-1/6', '-1/6', '-2/3'], ['-1/12', '-1/6', '-3/4'] ]; +const offsetCombos = sizeCombos.filter(combo => combo.length === 2);