Skip to content

Commit

Permalink
Drop way too specific color definitions (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispuska authored Jan 6, 2024
2 parents 71c183f + a5b9433 commit f2dc5ac
Show file tree
Hide file tree
Showing 83 changed files with 4,515 additions and 3,205 deletions.
14 changes: 14 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": ["prettier"],
"plugins": ["prettier", "@typescript-eslint"],
"rules": {
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
]
}
}
26 changes: 0 additions & 26 deletions .github/workflows/jest.yml

This file was deleted.

11 changes: 11 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: npm:test
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: oven-sh/setup-bun@v1
- run: npm i
- run: npm test
37 changes: 33 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,37 @@
.cache
.DS_Store
.env
.env.development.local
.env.local
.env.test
.eslintcache
.git
.next
.node_repl_history
.nova
.now
.npm
.sentryclirc
.tmp
.turbo
.vercel
.vscode
out
.yarn
.yarn-integrity
*.lcov
*.log
*.pid
*.pid.lock
*.seed
*.tsbuildinfo
# next-env.d.ts
coverage
dist
dist-demo
node_modules
yarn-error.log
logs
node_modules/
npm-debug.log*
pids
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
typings/
yarn-debug.log*
yarn-error.log*
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.git
.env
node_modules
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"tabWidth": 2,
"semi": false,
"tabWidth": 4,
"useTabs": true
}
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 Chris Puska
Copyright (c) 2015 Helios Graphics

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Fractures

Fractures is a collection of low level atomic utilities for humans that makes products more resilient, composable and scalable. Only the good parts.
Fractures is a collection of low level atomic utilities that makes products more resilient, composable and scalable. Only the good parts.

- Atomic
- Framework agnostic
Expand All @@ -9,12 +9,7 @@ Fractures is a collection of low level atomic utilities for humans that makes pr
- Manageable cognitive load
- Small footprint

### This repo publishes 3 packages:
### This repo publishes 2 packages:

- `@heliosgraphics/fractures` Atomic CSS.
- `@heliosgraphics/library` Types and constraints of visual spaces, no presets or definitions.
- `@heliosgraphics/utils` Helpers functions for both.

### Roadmap

- `2024` Fractures as a template repository for agents to build from.
- `@heliosgraphics/utils` Utility Functions.
30 changes: 19 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
{
"author": "Chris Puska <03b8@helios.graphics>",
"author": "03b8 <03b8@helios.graphics>",
"private": false,
"license": "MIT",
"version": "4.0.0-alpha-5",
"version": "5.0.0",
"scripts": {
"test": "vitest",
"test": "NODE_ENV=test vitest run",
"test:u": "NODE_ENV=test vitest run --update",
"test:watch": "NODE_ENV=test vitest",
"test:coverage": "NODE_ENV=test vitest run --coverage",
"pub:fractures": "pnpm publish --access public --filter fractures",
"pub:library": "pnpm publish --access public --filter library",
"pub:utils": "pnpm publish --access public --filter utils",
"fractures:build": "pnpm run --filter fractures build"
"prettier:write": "prettier --no-semi --use-tabs --write ./packages/**"
},
"workspaces": [
"packages/*"
],
"dependencies": {},
"devDependencies": {
"@types/node": "^20.6.3",
"@types/react": "^18.2.22",
"eslint": "^8.50.0",
"eslint-config-next": "^13.5.2",
"prettier": "^3.0.3",
"typescript": "^5.2.2",
"vitest": "^1.1.0"
"@typescript-eslint/eslint-plugin": "latest",
"@types/node": "latest",
"@types/react": "latest",
"@vitest/coverage-v8": "latest",
"eslint": "latest",
"eslint-config-prettier": "latest",
"eslint-plugin-prettier": "latest",
"jsdom": "latest",
"prettier": "latest",
"typescript": "latest",
"vite": "latest",
"vitest": "latest"
}
}
14 changes: 6 additions & 8 deletions packages/fractures/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@heliosgraphics/fractures",
"version": "4.0.0-alpha-5",
"version": "5.0.0",
"type": "module",
"author": "Chris Puska <03b8@helios.graphics>",
"author": "03b8 <03b8@helios.graphics>",
"description": "Functional CSS, but only the good parts.",
"main": "dist/fractures.min.css",
"files": [
Expand All @@ -17,7 +17,7 @@
},
"keywords": [
"CSS",
"atomic"
"Atomic CSS"
],
"repository": {
"type": "git",
Expand All @@ -27,11 +27,9 @@
"bugs": {
"url": "https://github.com/heliosgraphics/fractures/issues"
},
"dependencies": {
"@heliosgraphics/library": "latest"
},
"dependencies": {},
"devDependencies": {
"typescript": "^5.3.3",
"vitest": "^1.1.0"
"csstype": "latest",
"typescript": "latest"
}
}
62 changes: 47 additions & 15 deletions packages/fractures/src/build.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,51 @@
import { fractureFiles } from "library/src/index";
import { generateOutput } from "./generators";
import { reset } from "./root.reset";
import { easings } from "./root.easings";
import { config } from "./root.config";
import { writeFile } from "./utils";
import { borderRadius } from "./rules/border-radius"
import { config } from "./root.config"
import { cursor } from "./rules/cursor"
import { display } from "./rules/display"
import { easings } from "./root.easings"
import { flex } from "./rules/flex"
import { generateOutput } from "./generators"
import { grid } from "./rules/grid"
import { height } from "./rules/height"
import { list } from "./rules/list"
import { margin } from "./rules/margin"
import { opacity } from "./rules/opacity"
import { overflow } from "./rules/overflow"
import { padding } from "./rules/padding"
import { position } from "./rules/position"
import { reset } from "./root.reset"
import { type } from "./rules/type"
import { width } from "./rules/width"
import { writeFile } from "./utils"
import type { FractureFiles } from "./types/meta"

// Generate standalone config CSS
writeFile('dist/fractures.reset.css', reset);
writeFile('dist/fractures.config.css', config);
writeFile('dist/fractures.easings.css', easings);
export const fractureFiles: FractureFiles = {
borderRadius,
cursor,
display,
flex,
grid,
height,
list,
margin,
opacity,
overflow,
padding,
position,
type,
width,
}

// Generate default bundle
generateOutput(fractureFiles, config + reset, "dist/fractures.min.css");
// generates standalone versions, each containing only their specific parts.
// TODO this can be just a copy.
writeFile("dist/fractures.reset.css", reset)
writeFile("dist/fractures.config.css", config)
writeFile("dist/fractures.easings.css", easings)

// Generate file sets
Object.entries(fractureFiles).forEach(rules => {
generateOutput(rules[1], '', `dist/set/${rules[0]}.css`);
// generates the default bundle.
generateOutput(fractureFiles, config + reset, "dist/fractures.min.css")

// generates set of files, eg.: `@heliosgraphics/fractures/dist/set/flex.css`
Object.entries(fractureFiles).forEach((rules) => {
generateOutput(rules[1], "", `dist/set/${rules[0]}.css`)
})
21 changes: 12 additions & 9 deletions packages/fractures/src/generators.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { it, describe, expect } from 'vitest';
import { _generateRule } from './generators'
import type { FractureRuleType } from "library/types/meta";
import { it, describe, expect } from "vitest"
import { _generateRule } from "./generators"
import type { FractureRuleType } from "./types/meta"

const MOCK_RULE: FractureRuleType = {
selector: 'bg-gray-0',
declarations: { backgroundColor: 'hsla(var(--hsl-gray-0), var(--bg-opacity))' },
variables: { '--bg-opacity': 1 }
selector: "bg-gray-0",
declarations: {
backgroundColor: "hsla(var(--hsl-gray-0), var(--bg-opacity))",
},
variables: { "--bg-opacity": 1 },
}

const MOCK_EXPECTED = `.bg-gray-0 {
Expand All @@ -14,6 +16,7 @@ background-color: hsla(var(--hsl-gray-0), var(--bg-opacity));
}
`

describe('generateRules', () => {
it('Generates a sample selector', () => expect(_generateRule(MOCK_RULE)).toEqual(MOCK_EXPECTED));
});
describe("generateRules", () => {
it("Generates a sample selector", () =>
expect(_generateRule(MOCK_RULE)).toEqual(MOCK_EXPECTED))
})
Loading

0 comments on commit f2dc5ac

Please sign in to comment.