-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
3,274 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": ["eslint:recommended", "prettier"], | ||
"env": { | ||
"es2020": true, | ||
"node": true, | ||
"browser": true | ||
}, | ||
"parserOptions": { | ||
"sourceType": "module", | ||
"ecmaVersion": "latest" | ||
}, | ||
"ignorePatterns": ["src/wasm/*"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/*.txt text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: [next] | ||
pull_request: | ||
branches: [next] | ||
|
||
jobs: | ||
build: | ||
runs-on: macOS-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- uses: jetli/[email protected] | ||
with: | ||
version: "latest" | ||
- run: npm install | ||
- run: npm run test | ||
- run: npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules | ||
.DS_Store | ||
**/target | ||
src/wasm | ||
dist | ||
**/*-actual.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
src/wasm/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"printWidth": 120, | ||
"bracketSpacing": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright 2024-present Bairui SU https://github.com/pearmini | ||
|
||
Permission to use, copy, modify, and/or distribute this software for any purpose | ||
with or without fee is hereby granted, provided that the above copyright notice | ||
and this permission notice appear in all copies. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS | ||
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | ||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF | ||
THIS SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Preview</title> | ||
</head> | ||
<body> | ||
<script src="./dist/cell.umd.min.js" type="text/javascript"></script> | ||
<script> | ||
(async () => { | ||
function Star(ctx) { | ||
return { | ||
mode: "double", | ||
width: 520, | ||
height: 520, | ||
setup() { | ||
for (let t = 0; t <= Math.PI * 2; t += Math.PI / 120) { | ||
const x = ctx.cols() / 2 + 12 * Math.cos(t) * Math.cos(t * 3); | ||
const y = ctx.rows() / 2 + 12 * Math.sin(t) * Math.cos(t * 3); | ||
ctx.stroke(Cell.wide("🌟")); | ||
ctx.point(x, y); | ||
} | ||
}, | ||
}; | ||
} | ||
|
||
document.body.append(await Cell.render(Star)); | ||
})(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"name": "@charming-art/cell", | ||
"description": "The creative coding language for ASCII Art.", | ||
"version": "0.0.1", | ||
"author": { | ||
"name": "pearmini", | ||
"url": "https://github.com/pearmini" | ||
}, | ||
"type": "module", | ||
"license": "ISC", | ||
"main": "dist/es/index.js", | ||
"module": "dist/es/index.js", | ||
"jsdelivr": "dist/cell.umd.min.js", | ||
"unpkg": "dist/cell.umd.min.js", | ||
"exports": { | ||
"umd": "./dist/cell.umd.min.js", | ||
"default": "./src/index.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/charming-art/cell.git" | ||
}, | ||
"files": [ | ||
"dist/**/*.js", | ||
"dist/**/*.wasm" | ||
], | ||
"scripts": { | ||
"dev": "npm run build:rust && vite", | ||
"test": "npm run test:rust && npm run test:js && npm run test:lint && npm run test:format", | ||
"test:js": "npm run build:rust && vitest", | ||
"test:rust": "cargo test --manifest-path ./rust/Cargo.toml", | ||
"test:lint": "eslint src test", | ||
"test:format": "prettier --check src test && cargo fmt --manifest-path ./rust/Cargo.toml --check", | ||
"build": "npm run build:rust && npm run build:js", | ||
"build:js": "rm -rf dist && rollup -c", | ||
"build:rust": "rm -rf ./src/wasm && wasm-pack build ./rust --out-dir ../src/wasm --out-name index --target web", | ||
"preview": "npm run build && vite preview", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
"sideEffects": false, | ||
"devDependencies": { | ||
"@rollup/plugin-node-resolve": "^15.1.0", | ||
"@rollup/plugin-terser": "^0.4.3", | ||
"@rollup/plugin-wasm": "^6.1.3", | ||
"eslint": "^8.44.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"prettier": "^2.8.8", | ||
"rollup": "^3.26.0", | ||
"vite": "^4.3.9", | ||
"vitest": "^0.32.1", | ||
"wasm-pack": "^0.13.0" | ||
}, | ||
"dependencies": { | ||
"d3-color": "^3.1.0", | ||
"d3-timer": "^3.0.1" | ||
}, | ||
"engines": { | ||
"node": ">=14.18" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
Oops, something went wrong.