Skip to content

Commit

Permalink
adding-mithril
Browse files Browse the repository at this point in the history
  • Loading branch information
ebsi-bblake committed Apr 4, 2023
1 parent 7c466de commit c246879
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
33 changes: 33 additions & 0 deletions build/lib/playground/createMithrilPlayground.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import nodePath from "node:path";

export default function createMithrilREPL() {
const BASE_URL = "https://flems.io/";

function utoa(data) {
return btoa(unescape(encodeURIComponent(data)));
}

function generateURLFromData(data) {
return `${BASE_URL}${utoa(JSON.stringify(data))}`;
}

function fromContentByFilename(contentByFilename) {
console.log("contentByFilename", contentByFilename);
const data = Object.keys(contentByFilename).map((filename) => {
const content = contentByFilename[filename];
const parsedFilename = nodePath.parse(filename);
return {
name: parsedFilename.name,
type: parsedFilename.ext.split(".").pop(),
source: content,
};
});

const url = generateURLFromData(data);
return url;
}

return {
fromContentByFilename,
};
}
2 changes: 2 additions & 0 deletions build/lib/playground/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import createMithrilPlayground from "./createMithrilPlayground.js";
import createAlpinePlayground from "./createAlpinePlayground.js";
import createSveltePlayground from "./createSveltePlayground.js";
import createVue3Playground from "./createVue3Playground.js";
import createSolidPlayground from "./createSolidPlayground.js";

export default {
mithril: createMithrilPlayground(),
vue3: createVue3Playground(),
svelte: createSveltePlayground(),
alpine: createAlpinePlayground(),
Expand Down
2 changes: 1 addition & 1 deletion content/6-form-input/3-radio/mithril/PickPill.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function PickPill() {
m("input", {
id: pill,
checked: picked == pill,
type: RadioNodeList,
type: "radio",
value: pill,
onchange: handleChange,
}),
Expand Down
2 changes: 1 addition & 1 deletion content/7-webapp-features/1-render-app/lit/app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LitElement, html } from "lit";
import { customElement } from "lit/decorators.js";

@customElement("x-app")
// @customElement("x-app")
export class XApp extends LitElement {
render() {
return html`<h1>Hello world</h1>`;
Expand Down
2 changes: 1 addition & 1 deletion public/framework/mithril.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c246879

Please sign in to comment.