Add migration-driven theme and modal primitives

This commit is contained in:
2026-10-29 23:01:50 +01:00
parent f3fcafcb7d
commit 1944cb8f5a
7 changed files with 72 additions and 2 deletions
+6
View File
@@ -1,5 +1,11 @@
# Changelog
## 0.2.0
- Added semantic `--frost-color-selection` and `--frost-color-overlay` tokens for project-defined themes.
- Added compact and icon button variants: `frost-button--sm` and `frost-button--icon`.
- Added CSS-only modal primitives: `frost-backdrop`, `frost-modal`, and modal content/header/body/footer helpers.
## 0.1.0
- Added the semantic Frost token system.
+20
View File
@@ -55,6 +55,13 @@ npm install @fretuks/frost
</div>
```
Compact and icon controls are available when a project needs smaller repeated actions:
```html
<button class="frost-button frost-button--secondary frost-button--sm">Edit</button>
<button class="frost-button frost-button--ghost frost-button--icon" aria-label="Close">×</button>
```
## Forms
```html
@@ -93,6 +100,19 @@ body.theme-blue {
}
```
`--frost-color-selection` and `--frost-color-overlay` are available for theme-specific selection and overlay colors. Frost's modal primitives provide visual structure only; opening, closing, focus management, and ARIA behavior remain application responsibilities.
```html
<div class="frost-backdrop" hidden></div>
<section class="frost-modal" role="dialog" aria-modal="true" aria-labelledby="dialog-title" hidden>
<div class="frost-modal__content">
<header class="frost-modal__header"><h2 id="dialog-title">Confirm</h2></header>
<div class="frost-modal__body">Continue?</div>
<footer class="frost-modal__footer"><button class="frost-button frost-button--primary">OK</button></footer>
</div>
</section>
```
## Customization
Override semantic tokens in the project layer:
+1 -1
View File
@@ -38,6 +38,6 @@
:where(code, kbd, pre) { font-family: var(--frost-font-mono); }
:where(table) { border-collapse: collapse; border-spacing: 0; }
:where(th, td) { text-align: start; }
:where(::selection) { background: var(--frost-color-accent); color: var(--frost-color-on-accent); }
:where(::selection) { background: var(--frost-color-selection); color: var(--frost-color-on-accent); }
}
+34
View File
@@ -37,6 +37,40 @@
.frost-notice--warning { border-color: var(--frost-color-warning); }
.frost-notice--danger { border-color: var(--frost-color-danger); }
.frost-backdrop {
position: fixed;
inset: 0;
background: var(--frost-color-overlay);
z-index: var(--frost-z-overlay);
}
.frost-modal {
position: fixed;
inset: 0;
display: grid;
place-items: center;
padding: var(--frost-space-4);
z-index: var(--frost-z-modal);
}
.frost-modal__content {
width: min(100%, 32rem);
max-height: min(90vh, 42rem);
overflow: auto;
padding: var(--frost-space-6);
border: 1px solid var(--frost-color-border-strong);
border-radius: var(--frost-radius-lg);
background: var(--frost-color-surface);
color: var(--frost-color-text);
box-shadow: var(--frost-shadow-lg);
}
.frost-modal__header,
.frost-modal__footer { display: flex; align-items: center; gap: var(--frost-space-3); }
.frost-modal__header { justify-content: space-between; margin-block-end: var(--frost-space-4); }
.frost-modal__body { display: grid; gap: var(--frost-space-4); }
.frost-modal__footer { justify-content: flex-end; margin-block-start: var(--frost-space-4); }
@media (prefers-reduced-motion: reduce) {
.frost-card--interactive:hover,
.frost-card--interactive:focus-within { transform: none; }
+2
View File
@@ -26,6 +26,8 @@
:where(.frost-button--danger:hover:not(:disabled):not([aria-disabled="true"])) { filter: brightness(0.92); }
:where(.frost-button:active:not(:disabled):not([aria-disabled="true"])) { transform: translateY(1px); }
:where(.frost-button:disabled, .frost-button[aria-disabled="true"]) { opacity: 0.55; cursor: not-allowed; }
:where(.frost-button--sm) { min-height: 2rem; padding: var(--frost-space-1) var(--frost-space-2); font-size: var(--frost-font-size-sm); }
:where(.frost-button--icon) { width: 2.5rem; min-width: 2.5rem; padding: var(--frost-space-2); }
:where(.frost-input, .frost-select, .frost-textarea) {
display: block;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@fretuks/frost",
"version": "0.1.0",
"version": "0.2.0",
"description": "A compact, semantic CSS foundation for websites and web applications.",
"style": "./frost.css",
"exports": {
+8
View File
@@ -12,6 +12,8 @@
--frost-color-accent: #2563eb;
--frost-color-accent-hover: #1d4ed8;
--frost-color-on-accent: #ffffff;
--frost-color-selection: var(--frost-color-accent);
--frost-color-overlay: rgb(0 0 0 / 0.6);
--frost-color-success: #147a4b;
--frost-color-warning: #9a5b00;
--frost-color-danger: #b42318;
@@ -59,6 +61,8 @@
--frost-focus-color: var(--frost-color-accent);
--frost-focus-width: 3px;
--frost-focus-offset: 3px;
--frost-z-overlay: 1000;
--frost-z-modal: 1001;
}
@media (prefers-color-scheme: dark) {
@@ -75,6 +79,8 @@
--frost-color-accent: #79a9ff;
--frost-color-accent-hover: #a0c2ff;
--frost-color-on-accent: #0d1a32;
--frost-color-selection: var(--frost-color-accent);
--frost-color-overlay: rgb(0 0 0 / 0.72);
--frost-color-success: #65d39b;
--frost-color-warning: #f3bd63;
--frost-color-danger: #ff9388;
@@ -98,6 +104,8 @@
--frost-color-accent: #79a9ff;
--frost-color-accent-hover: #a0c2ff;
--frost-color-on-accent: #0d1a32;
--frost-color-selection: var(--frost-color-accent);
--frost-color-overlay: rgb(0 0 0 / 0.72);
--frost-color-success: #65d39b;
--frost-color-warning: #f3bd63;
--frost-color-danger: #ff9388;