Compare commits

...

4 Commits
v2.4.0 ... main

5 changed files with 54 additions and 6 deletions

View File

@@ -1,5 +1,22 @@
# Changelog # Changelog
## 2026-03-11 - 2.5.1 - fix(breakpoints)
rename exported functions to reflect constraint-based API: cssForCustom -> cssForConstraint and cssForCustomContainer -> cssForConstraintContainer; update README usage
- Renamed cssForCustom to cssForConstraint
- Renamed cssForCustomContainer to cssForConstraintContainer
- Updated README examples to use new names
- Function behavior and signatures unchanged; only exported names and internal comment updated
- Consumers must update imports/usages to the new function names (breaking change)
## 2026-03-11 - 2.5.0 - feat(breakpoints)
document preset viewport helpers, low-level container helpers, and exported types for breakpoints
- Added documentation for preset viewport helpers (they emit both @media and @container wccToolsViewport)
- Added usage examples and API for low-level helpers: cssForCustom, cssForContainer, cssForCustomContainer, and containerContextStyles
- Documented exported types: ICssForConstraints and TViewport
- Clarified that component-level container helpers target named containers and do not emit @media fallbacks
## 2026-03-11 - 2.4.0 - feat(css.breakpoints) ## 2026-03-11 - 2.4.0 - feat(css.breakpoints)
add constraint-based CSS breakpoint helpers and container context utilities add constraint-based CSS breakpoint helpers and container context utilities

View File

@@ -1,6 +1,6 @@
{ {
"name": "@design.estate/dees-domtools", "name": "@design.estate/dees-domtools",
"version": "2.4.0", "version": "2.5.1",
"private": false, "private": false,
"description": "A package providing tools to simplify complex CSS structures and web development tasks, featuring TypeScript support and integration with various web technologies.", "description": "A package providing tools to simplify complex CSS structures and web development tasks, featuring TypeScript support and integration with various web technologies.",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",

View File

@@ -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 - `cssForDesktop(css)` - Styles for 1600px and above
- `cssForNotebook(css)` - Styles for 1240px and below - `cssForNotebook(css)` - Styles for 1240px and below
@@ -118,6 +118,37 @@ const myStyles = litCss`
- `cssForPhablet(css)` - Styles for 600px and below - `cssForPhablet(css)` - Styles for 600px and below
- `cssForPhone(css)` - Styles for 400px 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.cssForConstraint({ 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.cssForConstraintContainer({ 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 ### Theme Management
Automatic theme detection with system preference support: Automatic theme detection with system preference support:

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@design.estate/dees-domtools', name: '@design.estate/dees-domtools',
version: '2.4.0', version: '2.5.1',
description: 'A package providing tools to simplify complex CSS structures and web development tasks, featuring TypeScript support and integration with various web technologies.' description: 'A package providing tools to simplify complex CSS structures and web development tasks, featuring TypeScript support and integration with various web technologies.'
} }

View File

@@ -54,13 +54,13 @@ export const cssForContainer = (cssArg: CSSResult, condition: string, containerN
}; };
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Custom constraints (curried) // Constraint-based (curried)
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
export const cssForCustom = (constraints: ICssForConstraints) => export const cssForConstraint = (constraints: ICssForConstraints) =>
(cssArg: CSSResult) => cssForViewport(cssArg, buildCondition(constraints)); (cssArg: CSSResult) => cssForViewport(cssArg, buildCondition(constraints));
export const cssForCustomContainer = (constraints: ICssForConstraints, containerName: string) => export const cssForConstraintContainer = (constraints: ICssForConstraints, containerName: string) =>
(cssArg: CSSResult) => cssForContainer(cssArg, buildCondition(constraints), containerName); (cssArg: CSSResult) => cssForContainer(cssArg, buildCondition(constraints), containerName);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------