feat(breakpoints): document preset viewport helpers, low-level container helpers, and exported types for breakpoints
This commit is contained in:
33
readme.md
33
readme.md
@@ -110,7 +110,7 @@ const myStyles = litCss`
|
||||
`;
|
||||
```
|
||||
|
||||
**Available breakpoint helpers:**
|
||||
**Preset viewport helpers** (emit both `@media` and `@container wccToolsViewport`):
|
||||
|
||||
- `cssForDesktop(css)` - Styles for 1600px and above
|
||||
- `cssForNotebook(css)` - Styles for 1240px and below
|
||||
@@ -118,6 +118,37 @@ const myStyles = litCss`
|
||||
- `cssForPhablet(css)` - Styles for 600px and below
|
||||
- `cssForPhone(css)` - Styles for 400px and below
|
||||
|
||||
**Low-level helpers** for custom constraints and component-scoped containers:
|
||||
|
||||
```typescript
|
||||
import { breakpoints } from '@design.estate/dees-domtools';
|
||||
import { css as litCss } from 'lit';
|
||||
|
||||
// Viewport-level with custom constraints (emits @media + @container wccToolsViewport)
|
||||
breakpoints.cssForCustom({ maxWidth: 800 })(litCss`.box { padding: 8px; }`)
|
||||
|
||||
// Component-level — targets a named container (no @media fallback)
|
||||
breakpoints.cssForContainer(
|
||||
litCss`.grid { columns: 1; }`,
|
||||
'(max-width: 600px)',
|
||||
'my-component' // CSS container-name
|
||||
)
|
||||
|
||||
// Component-level with custom constraints (curried)
|
||||
breakpoints.cssForCustomContainer({ maxWidth: 500 }, 'my-component')(litCss`
|
||||
.grid { gap: 8px; }
|
||||
`)
|
||||
|
||||
// Generate containment styles for :host (used by @containerResponsive decorator)
|
||||
breakpoints.containerContextStyles('my-component')
|
||||
// → :host { container-type: inline-size; container-name: my-component; }
|
||||
```
|
||||
|
||||
**Exported types:**
|
||||
|
||||
- `ICssForConstraints` — `{ maxWidth?: number; minWidth?: number }`
|
||||
- `TViewport` — `'native' | 'desktop' | 'tablet' | 'phablet' | 'phone'`
|
||||
|
||||
### Theme Management
|
||||
|
||||
Automatic theme detection with system preference support:
|
||||
|
||||
Reference in New Issue
Block a user