Stabilize Frost and prepare npm package

This commit is contained in:
2026-10-29 21:57:42 +01:00
parent f5cd37254c
commit 94ec8bb573
9 changed files with 167 additions and 3 deletions
+11
View File
@@ -0,0 +1,11 @@
# Changelog
## 0.1.0
- Added the semantic Frost token system.
- Added the base/reset layer and accessible focus behavior.
- Added container, stack, row, center, grid, and sidebar layouts.
- Added buttons, form controls, cards, surfaces, badges, and notices.
- Added light, dark, and system theme support.
- Added reduced-motion, skip-link, visually-hidden, and native hidden helpers.
- Validated the foundation against Penguin-chat and PortfolioTemplate migrations.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Fretux
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+32
View File
@@ -16,6 +16,16 @@ For a CSS-aware build:
@import "./frost/frost.css"; @import "./frost/frost.css";
``` ```
For npm-based projects:
```bash
npm install @fretux/frost
```
```css
@import "@fretux/frost";
```
## Basic usage ## Basic usage
```html ```html
@@ -71,6 +81,18 @@ or:
Frost does not require JavaScript; a theme switcher can be added later by Iceberg or ordinary vanilla JavaScript. Frost does not require JavaScript; a theme switcher can be added later by Iceberg or ordinary vanilla JavaScript.
Projects with additional themes should override Frost's semantic roles rather than reaching into component selectors:
```css
body.theme-blue {
--frost-color-bg: #071a2b;
--frost-color-surface: #0d2a40;
--frost-color-text: #e8f5ff;
--frost-color-accent: #55b9ff;
--frost-color-accent-hover: #8bd1ff;
}
```
## Customization ## Customization
Override semantic tokens in the project layer: Override semantic tokens in the project layer:
@@ -85,6 +107,16 @@ Override semantic tokens in the project layer:
The public API uses the `frost-` class prefix and `--frost-*` custom-property prefix to reduce collisions with project CSS and third-party libraries. The public API uses the `frost-` class prefix and `--frost-*` custom-property prefix to reduce collisions with project CSS and third-party libraries.
## Package maintenance
The package intentionally ships only the CSS modules, documentation, license, and small dependency-free validation scripts. Example pages remain in the repository but are excluded from the npm tarball.
```bash
npm run lint
npm run size
npm pack --dry-run
```
## Philosophy ## Philosophy
Frost is intentionally smaller than Bootstrap and Tailwind. It establishes predictable foundations while leaving branding, page composition, JavaScript behavior, and specialized components to the project using it. Frost is intentionally smaller than Bootstrap and Tailwind. It establishes predictable foundations while leaving branding, page composition, JavaScript behavior, and specialized components to the project using it.
+1
View File
@@ -32,6 +32,7 @@
} }
.frost-skip-link:focus { transform: translateY(1rem); } .frost-skip-link:focus { transform: translateY(1rem); }
:where([hidden]) { display: none; }
.frost-hidden { display: none; } .frost-hidden { display: none; }
@media (prefers-reduced-motion: reduce) { @media (prefers-reduced-motion: reduce) {
+4 -2
View File
@@ -9,7 +9,8 @@
.frost-card--flat { box-shadow: none; } .frost-card--flat { box-shadow: none; }
.frost-card--elevated { box-shadow: var(--frost-shadow-md); } .frost-card--elevated { box-shadow: var(--frost-shadow-md); }
.frost-card--interactive { transition: border-color var(--frost-duration-base) var(--frost-ease-standard), box-shadow var(--frost-duration-base) var(--frost-ease-standard), transform var(--frost-duration-fast) var(--frost-ease-out); } .frost-card--interactive { transition: border-color var(--frost-duration-base) var(--frost-ease-standard), box-shadow var(--frost-duration-base) var(--frost-ease-standard), transform var(--frost-duration-fast) var(--frost-ease-out); }
.frost-card--interactive:hover { border-color: var(--frost-color-border-strong); box-shadow: var(--frost-shadow-md); transform: translateY(-1px); } .frost-card--interactive:hover,
.frost-card--interactive:focus-within { border-color: var(--frost-color-border-strong); box-shadow: var(--frost-shadow-md); transform: translateY(-1px); }
.frost-badge { .frost-badge {
display: inline-flex; display: inline-flex;
@@ -37,7 +38,8 @@
.frost-notice--danger { border-color: var(--frost-color-danger); } .frost-notice--danger { border-color: var(--frost-color-danger); }
@media (prefers-reduced-motion: reduce) { @media (prefers-reduced-motion: reduce) {
.frost-card--interactive:hover { transform: none; } .frost-card--interactive:hover,
.frost-card--interactive:focus-within { transform: none; }
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
@layer frost.layout { @layer frost.layout {
.frost-container { .frost-container {
width: min(100% - (2 * var(--frost-container-gutter)), var(--frost-container-max)); width: min(100% - var(--frost-container-gutter) - var(--frost-container-gutter), var(--frost-container-max));
margin-inline: auto; margin-inline: auto;
} }
+44
View File
@@ -0,0 +1,44 @@
{
"name": "@fretux/frost",
"version": "0.1.0",
"description": "A compact, semantic CSS foundation for websites and web applications.",
"style": "./frost.css",
"exports": {
".": "./frost.css",
"./frost.css": "./frost.css",
"./tokens.css": "./tokens.css",
"./base.css": "./base.css",
"./accessibility.css": "./accessibility.css",
"./layout.css": "./layout.css",
"./controls.css": "./controls.css",
"./components.css": "./components.css",
"./package.json": "./package.json"
},
"files": [
"*.css",
"README.md",
"CHANGELOG.md",
"LICENSE",
"scripts/*.mjs"
],
"keywords": [
"css",
"framework",
"design-system",
"ui",
"frost"
],
"author": "Fretux",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://git.bachmannj.ch/Fretux/Frost.git"
},
"homepage": "https://git.bachmannj.ch/Fretux/Frost",
"scripts": {
"lint": "node scripts/check.mjs",
"size": "node scripts/size.mjs",
"test": "node scripts/check.mjs"
},
"sideEffects": true
}
+38
View File
@@ -0,0 +1,38 @@
import { readFile } from "node:fs/promises";
import { resolve } from "node:path";
import { fileURLToPath } from "node:url";
const root = fileURLToPath(new URL("..", import.meta.url));
const cssFiles = [
"frost.css",
"tokens.css",
"base.css",
"accessibility.css",
"layout.css",
"controls.css",
"components.css",
];
const errors = [];
for (const file of cssFiles) {
const source = await readFile(resolve(root, file), "utf8");
const opens = (source.match(/\{/g) ?? []).length;
const closes = (source.match(/\}/g) ?? []).length;
if (opens !== closes) errors.push(`${file}: unbalanced braces`);
if (/transition\s*:\s*all\b/.test(source)) errors.push(`${file}: transition: all is not allowed`);
if (/(?:^|[;{])\s*--(?!frost-)[a-z0-9-]+\s*:/.test(source)) errors.push(`${file}: found an unprefixed public custom property`);
}
const entry = await readFile(resolve(root, "frost.css"), "utf8");
for (const match of entry.matchAll(/@import\s+url\("([^"]+)"\)/g)) {
try { await readFile(resolve(root, match[1]), "utf8"); }
catch { errors.push(`frost.css: missing import ${match[1]}`); }
}
if (errors.length) {
console.error(errors.join("\n"));
process.exitCode = 1;
} else {
console.log(`Checked ${cssFiles.length} CSS files; imports, braces, transitions, and public token prefixes look valid.`);
}
+15
View File
@@ -0,0 +1,15 @@
import { gzipSync } from "node:zlib";
import { readFile } from "node:fs/promises";
import { resolve } from "node:path";
import { fileURLToPath } from "node:url";
const root = fileURLToPath(new URL("..", import.meta.url));
const files = ["tokens.css", "base.css", "accessibility.css", "layout.css", "controls.css", "components.css"];
const source = (await Promise.all(files.map((file) => readFile(resolve(root, file), "utf8")))).join("\n");
const rawBytes = Buffer.byteLength(source);
const gzipBytes = gzipSync(source).byteLength;
console.log(`Combined CSS: ${rawBytes} bytes raw, ${gzipBytes} bytes gzip`);
if (gzipBytes > 10 * 1024) {
console.error("Warning: Frost exceeds the 10 KB gzip budget.");
process.exitCode = 1;
}