Skip to content

Commit

Permalink
Merge pull request #94 from AegisJSProject/bug/parser
Browse files Browse the repository at this point in the history
Switch to `@aegisjsproject/parsers`
  • Loading branch information
shgysk8zer0 authored Nov 26, 2024
2 parents 11355b0 + dc76714 commit ee9205f
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 144 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v0.2.6] - 2024-11-26

### Changed
- Change default border width on `.btn` to `0`
- Switch CSS parser to `@aegisjsproject/parsers/css.js`

## [v0.2.5] - 2024-11-06

### Added
Expand Down
2 changes: 1 addition & 1 deletion animations.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { css } from '@aegisjsproject/core/parsers/css.js';
import { css } from '@aegisjsproject/parsers/css.js';

export const transform = css`.transform-origin-center {
transform-origin: center;
Expand Down
4 changes: 2 additions & 2 deletions button.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { css } from '@aegisjsproject/core/parsers/css.js';
import { css } from '@aegisjsproject/parsers/css.js';
import { blue, green, red, yellow, gray, cyan } from './palette/bootstrap.js';
import { SUPPORTS_CUSTOM_STATES } from './consts.js';
import {
Expand All @@ -17,7 +17,7 @@ export const btn = css`.btn:not([hidden]) {
cursor: pointer;
display: inline-block;
padding: 0.6em 1.3em;
border-width: 1px;
border-width: var(--aegis-btn-border-width, 0px);
border-style: solid;
appearance: button;
line-height: 1.5;
Expand Down
1 change: 1 addition & 0 deletions consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
export const customProperties = {
'font': { initialValue: 'system-ui', syntax: '<custom-ident> | <string>' },
'btn-border-radius': { initialValue: '5px', syntax: '<length>' },
'btn-border-width': { initialValue: '0px', syntax: '<length>' },
'color-light': { initialValue: colorLight, syntax: '<color>' },
'color-dark': { initialValue: colorDark, syntax: '<color>' },
'bg-light': { initialValue: bgLight, syntax: '<color>' },
Expand Down
2 changes: 2 additions & 0 deletions createSheets.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { writeFile } from 'node:fs/promises';

globalThis.reportError ??= console.error;

const scripts = [
'./animations.js', './button.js', './forms.js', './misc.js', './properties.js', './reset.js',
'./scrollbar.js', './styles.js', './theme.js',
Expand Down
2 changes: 1 addition & 1 deletion misc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { css } from '@aegisjsproject/core/parsers/css.js';
import { css } from '@aegisjsproject/parsers/css.js';

export const displays = css`.block:not([hidden]):not([popover]) {
display: block;
Expand Down
146 changes: 17 additions & 129 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aegisjsproject/styles",
"version": "0.2.5",
"version": "0.2.6",
"description": "Pre-made and reusable styles for `@aegisjsproject/core`",
"keywords": [
"aegis",
Expand Down Expand Up @@ -93,6 +93,6 @@
"rollup": "^4.9.6"
},
"dependencies": {
"@aegisjsproject/core": "^0.2.0"
"@aegisjsproject/parsers": "^0.0.16"
}
}
2 changes: 1 addition & 1 deletion properties.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { css } from '@aegisjsproject/core/parsers/css.js';
import { css } from '@aegisjsproject/parsers/css.js';
import { customProperties } from './consts.js';

export const properties = css`${Object.entries(customProperties).map(
Expand Down
2 changes: 1 addition & 1 deletion reset.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { css } from '@aegisjsproject/core/parsers/css.js';
import { css } from '@aegisjsproject/parsers/css.js';

export const reset = css`body {
margin: 0;
Expand Down
2 changes: 1 addition & 1 deletion scrollbar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { css } from '@aegisjsproject/core/parsers/css.js';
import { css } from '@aegisjsproject/parsers/css.js';
import { scrollbarColor, scrollbarTrack } from './palette/aegis.js';

export const scrollbarFallback = css`@supports not (scrollbar-color: currentColor transparent) {
Expand Down
6 changes: 2 additions & 4 deletions test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@
<meta name="color-scheme" content="light dark" />
<meta http-equiv="Content-Security-Policy"
content="default-src 'none';
script-src 'self' https://unpkg.com/@shgysk8zer0/ https://unpkg.com/@aegisjsproject/ 'sha384-RT8/jXa3tV8Aauh9mL7PPogrsOeGCZNnM+GYKnXiACl8RUsAuyPtexdx/oXkKHDj';
script-src 'self' https://unpkg.com/@shgysk8zer0/ https://unpkg.com/@aegisjsproject/ 'sha384-dtmkYmRnd1nNvWF7BbOk4tnyias1nALlsUJ8HiTAvxU1YV5CA/dxcEtWqFDWukVy';
style-src 'self' blob: data:;
connect-src https://icanhazdadjoke.com https://unpkg.com/@shgysk8zer0/ https://unpkg.com/@kernvalley/;
trusted-types empty#html empty#script aegis-sanitizer#html default;
require-trusted-types-for 'script';" />
<title>Aegis Styles Test</title>
<script type="importmap" integrity="sha384-RT8/jXa3tV8Aauh9mL7PPogrsOeGCZNnM+GYKnXiACl8RUsAuyPtexdx/oXkKHDj">
<script type="importmap">
{
"imports": {
"@aegisjsproject/core": "../node_modules/@aegisjsproject/core/core.js",
"@aegisjsproject/core/": "../node_modules/@aegisjsproject/core/",
"@aegisjsproject/styles": "../styles.js",
"@aegisjsproject/styles/": "../",
"@shgysk8zer0/": "https://unpkg.com/@shgysk8zer0/",
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { css } from '@aegisjsproject/core';
import { css } from '@aegisjsproject/parsers/css.js';
const { properties, propertiesLegacy, componentBase, componentBorder, componentDarkTheme, componentLightTheme, btn, reset, sheetToLink, ...styles } = await import('@aegisjsproject/styles');

document.head.append(await sheetToLink(propertiesLegacy));
Expand Down
5 changes: 4 additions & 1 deletion theme.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { light, dark, gray } from './palette/bootstrap.js';
import { css, darkCSS, lightCSS } from '@aegisjsproject/core/parsers/css.js';
import { css, createCSSParser } from '@aegisjsproject/parsers/css.js';

const darkCSS = createCSSParser({ media: '(prefers-color-scheme: dark)' });
const lightCSS = createCSSParser({ media: '(prefers-color-scheme: light)' });

export const baseTheme = css`:root {
color-scheme: light dark;
Expand Down

0 comments on commit ee9205f

Please sign in to comment.