Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ jobs:
cache: npm
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: npm ci --ignore-scripts --no-audit --fund-no
run: npm ci --no-audit --no-fund
- name: Run tests
run: npm test
- name: Build Package
run: npm run build --if-present
- name: Publish to npm
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.9.0
24.10.0
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v0.2.8] - 2026-03-14

### Changed
- Separate `@property` from old `--prop`s

### Fixed
- Fix outputing `.css` for sheets with media queries

## [v0.2.7] - 2025-04-21

### Fixed
Expand Down
57 changes: 53 additions & 4 deletions createSheets.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,78 @@ globalThis.reportError ??= console.error;

const scripts = [
'./animations.js', './button.js', './forms.js', './misc.js', './properties.js', './reset.js',
'./scrollbar.js', './styles.js', './theme.js',
'./scrollbar.js', './styles.js', './theme.js', './properties-legacy.js',
];

class CSSStyleSheet {
#text = '';
#media = null;
#disabled = false;

constructor({ media = null, disabled = false } = {}) {
this.#media = media;
this.#disabled = disabled;
}

get media() {
return this.#media;
}

get disabled() {
return this.#disabled;
}

set disabled(val) {
this,this.#disabled = val;
}

toString() {
return this.#text;
if (this.disabled) {
return '';
} else if (typeof this.#media === 'string') {
return `@media (${this.#media}) {${this.#text}}`;
} else {
return this.#text;
}
}

replaceSync(text) {
this.#text = text;
}

async replace(text) {
return Promise.resolve().then(() => this.replaceSync(text)).then(() => this);
return Promise.try(() => this.replaceSync(text)).then(() => this);
}
}

globalThis.CSS = { supports: () => true };
globalThis.CSSStyleSheet = CSSStyleSheet;
globalThis.document = {};
globalThis.MediaQueryList = class MediaQueryList extends EventTarget {};
globalThis.matchMedia = media => {
const mql = new MediaQueryList();
mql.media = media;
return mql;
};

globalThis.MediaQueryList = class MediaQueryList extends EventTarget {
#media = null;

get matches() {
return true;
}

get media() {
return this.#media;
}

set media(val) {
this.#media = val;
}

toString() {
return this.#media;
}
};

async function saveSheet(path) {
const module = await import(path);
Expand Down
Loading
Loading