Skip to content

Commit

Permalink
Change namespace to cm (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
pearmini authored Sep 30, 2024
1 parent bd5436e commit 139124d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ function Star(ctx) {
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.stroke(cm.wide("🌟"));
ctx.point(x, y);
}
},
};
}

document.body.append(await Cell.render(Star));
document.body.append(await cm.cell(Star));
```
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>Preview</title>
</head>
<body>
<script src="./dist/cell.umd.min.js" type="text/javascript"></script>
<script src="./dist/charming-cell.umd.min.js" type="text/javascript"></script>
<script>
(async () => {
function Star(ctx) {
Expand All @@ -18,14 +18,14 @@
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.stroke(cm.wide("🌟"));
ctx.point(x, y);
}
},
};
}

document.body.append(await Cell.render(Star));
document.body.append(await cm.cell(Star));
})();
</script>
</body>
Expand Down
6 changes: 3 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const umd = {
input: "src/index.js",
output: {
format: "umd",
name: "Cell",
name: "cm",
},
plugins: [wasm({targetEnv: "auto-inline"}), node()],
};
Expand All @@ -26,14 +26,14 @@ export default [
...umd,
output: {
...umd.output,
file: "dist/cell.umd.js",
file: "dist/charming-cell.umd.js",
},
},
{
...umd,
output: {
...umd.output,
file: "dist/cell.umd.min.js",
file: "dist/charming-cell.umd.min.js",
},
plugins: [...umd.plugins, terser()],
},
Expand Down
2 changes: 1 addition & 1 deletion src/render.js → src/cell.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Context} from "./context/index.js";

export async function render(App) {
export async function cell(App) {
const ctx = new Context();
const {setup, ...options} = App(ctx);
await ctx.init(options);
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export {render} from "./render.js";
export {cell} from "./cell.js";
export {wide} from "./wide.js";
4 changes: 2 additions & 2 deletions test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<meta charset="utf-8" />
</head>
<script type="module">
import * as Cell from "@charming-art/cell";
import * as cm from "@charming-art/cell";
import * as apps from "./apps/index.js";

// UI
Expand Down Expand Up @@ -42,7 +42,7 @@
if (typeof preClear === "function") preClear();
if (isNode(preNode)) preNode.remove();
const App = apps[select.value];
preNode = await Cell.render(App);
preNode = await cm.cell(App);
if (isNode(preNode)) {
document.body.appendChild(preNode);
}
Expand Down

0 comments on commit 139124d

Please sign in to comment.