-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require("@rakkasjs/eslint-config/patch"); | ||
|
||
module.exports = { | ||
root: true, | ||
extends: ["@rakkasjs"], | ||
parserOptions: { tsconfigRootDir: __dirname }, | ||
settings: { | ||
"import/resolver": { | ||
typescript: { | ||
project: [__dirname + "/tsconfig.json"], | ||
}, | ||
}, | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"src/routes/layout.css": { | ||
"file": "assets/layout-a3081c07.css", | ||
"src": "src/routes/layout.css" | ||
}, | ||
"src/routes/todo/index.page.css": { | ||
"file": "assets/index.page-82bf85a8.css", | ||
"src": "src/routes/todo/index.page.css" | ||
}, | ||
"_jsx-runtime-4e3661cc.js": { | ||
"file": "assets/jsx-runtime-4e3661cc.js", | ||
"imports": [ | ||
"virtual:rakkasjs:client-entry" | ||
] | ||
}, | ||
"src/routes/index.page.tsx": { | ||
"file": "assets/index.page-cac0fc4b.js", | ||
"src": "src/routes/index.page.tsx", | ||
"isDynamicEntry": true, | ||
"imports": [ | ||
"_jsx-runtime-4e3661cc.js", | ||
"virtual:rakkasjs:client-entry" | ||
] | ||
}, | ||
"src/routes/about.page.tsx": { | ||
"file": "assets/about.page-12473f38.js", | ||
"src": "src/routes/about.page.tsx", | ||
"isDynamicEntry": true, | ||
"imports": [ | ||
"_jsx-runtime-4e3661cc.js", | ||
"virtual:rakkasjs:client-entry" | ||
] | ||
}, | ||
"src/routes/layout.tsx": { | ||
"file": "assets/layout-52f6684f.js", | ||
"src": "src/routes/layout.tsx", | ||
"isDynamicEntry": true, | ||
"imports": [ | ||
"_jsx-runtime-4e3661cc.js", | ||
"virtual:rakkasjs:client-entry" | ||
], | ||
"css": [ | ||
"assets/layout-a3081c07.css" | ||
] | ||
}, | ||
"src/routes/todo/index.page.tsx": { | ||
"file": "assets/index.page-3e66956f.js", | ||
"src": "src/routes/todo/index.page.tsx", | ||
"isDynamicEntry": true, | ||
"imports": [ | ||
"_jsx-runtime-4e3661cc.js", | ||
"virtual:rakkasjs:client-entry" | ||
], | ||
"css": [ | ||
"assets/index.page-82bf85a8.css" | ||
] | ||
}, | ||
"virtual:rakkasjs:client-entry": { | ||
"file": "assets/index-2ba2cd1d.js", | ||
"src": "virtual:rakkasjs:client-entry", | ||
"isEntry": true, | ||
"dynamicImports": [ | ||
"src/routes/layout.tsx", | ||
"src/routes/about.page.tsx", | ||
"src/routes/index.page.tsx", | ||
"src/routes/todo/index.page.tsx" | ||
] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
import { j as jsxs, a as jsx } from "./jsx-runtime-746fc63d.js"; | ||
import { b as useMutation } from "../hattip.js"; | ||
import { useState } from "react"; | ||
let todoItems = [ | ||
{ | ||
id: 1, | ||
text: "Learn React", | ||
done: true | ||
}, | ||
{ | ||
id: 2, | ||
text: "Learn Rakkas", | ||
done: false | ||
} | ||
]; | ||
let nextId = 3; | ||
function readAllTodos() { | ||
return todoItems; | ||
} | ||
function createTodo(item2) { | ||
todoItems.push({ ...item2, id: nextId }); | ||
return nextId++; | ||
} | ||
function updateTodo(id, data) { | ||
const found = todoItems.find((x) => x.id === id); | ||
if (found) { | ||
Object.assign(found, data); | ||
} | ||
return found; | ||
} | ||
function deleteTodo(id) { | ||
todoItems = todoItems.filter((x) => x.id !== id); | ||
} | ||
const item = "_item_urmsp_1"; | ||
const done = "_done_urmsp_12"; | ||
const input = "_input_urmsp_16"; | ||
const buttons = "_buttons_urmsp_28"; | ||
const css = { | ||
item, | ||
done, | ||
input, | ||
buttons | ||
}; | ||
const Todo = ({ | ||
todo, | ||
refetch | ||
}) => { | ||
const [state, setState] = useState({ | ||
text: todo.text, | ||
editing: false | ||
}); | ||
const { | ||
mutate: update | ||
} = useMutation(async (item2) => { | ||
const result = null; | ||
refetch(); | ||
return result; | ||
}); | ||
const { | ||
mutate: remove | ||
} = useMutation(async () => { | ||
null; | ||
refetch(); | ||
}); | ||
return /* @__PURE__ */ jsxs("li", { | ||
className: css.item, | ||
children: [!state.editing && /* @__PURE__ */ jsxs("label", { | ||
children: [/* @__PURE__ */ jsx("input", { | ||
type: "checkbox", | ||
checked: todo.done, | ||
onChange: (e) => update({ | ||
done: e.target.checked | ||
}) | ||
}), " ", /* @__PURE__ */ jsx("span", { | ||
className: todo.done ? css.done : void 0, | ||
children: todo.text | ||
}), " "] | ||
}), state.editing && /* @__PURE__ */ jsx("input", { | ||
className: css.input, | ||
autoFocus: true, | ||
value: state.text, | ||
onChange: (e) => setState({ | ||
text: e.target.value, | ||
editing: true | ||
}), | ||
onKeyDown: (e) => { | ||
if (e.key === "Enter") { | ||
setState({ | ||
text: todo.text, | ||
editing: false | ||
}); | ||
update({ | ||
text: state.text | ||
}); | ||
} else if (e.key === "Escape") { | ||
setState({ | ||
text: todo.text, | ||
editing: false | ||
}); | ||
} | ||
} | ||
}), /* @__PURE__ */ jsxs("span", { | ||
className: css.buttons, | ||
children: [!todo.done && !state.editing && /* @__PURE__ */ jsx("button", { | ||
type: "button", | ||
onClick: () => setState({ | ||
text: todo.text, | ||
editing: true | ||
}), | ||
children: "Edit" | ||
}), todo.done && /* @__PURE__ */ jsx("button", { | ||
type: "button", | ||
onClick: () => remove(), | ||
children: "Delete" | ||
}), state.editing && state.text !== todo.text && /* @__PURE__ */ jsx("button", { | ||
type: "button", | ||
onClick: async () => { | ||
setState({ | ||
text: todo.text, | ||
editing: false | ||
}); | ||
update({ | ||
text: state.text | ||
}); | ||
}, | ||
children: "Save" | ||
}), state.editing && /* @__PURE__ */ jsx("button", { | ||
type: "button", | ||
onClick: () => setState({ | ||
text: todo.text, | ||
editing: false | ||
}), | ||
children: "Cancel" | ||
})] | ||
})] | ||
}, todo.id); | ||
}; | ||
const $runServerSide$ = [async ($runServerSideClosure$) => { | ||
let [id, item2] = $runServerSideClosure$; | ||
return updateTodo(id, item2); | ||
}, async ($runServerSideClosure$) => { | ||
let [id] = $runServerSideClosure$; | ||
return deleteTodo(id); | ||
}]; | ||
const Todo$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
$runServerSide$, | ||
Todo | ||
}, Symbol.toStringTag, { value: "Module" })); | ||
export { | ||
Todo as T, | ||
Todo$1 as a, | ||
createTodo as c, | ||
readAllTodos as r | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { j as jsxs, a as jsx } from "./jsx-runtime-746fc63d.js"; | ||
import "react/jsx-runtime"; | ||
const AboutPage = () => /* @__PURE__ */ jsxs("main", { children: [ | ||
/* @__PURE__ */ jsx("h1", { children: "About" }), | ||
/* @__PURE__ */ jsxs("p", { children: [ | ||
/* @__PURE__ */ jsx("b", { children: "Rakkas" }), | ||
" aims to be a", | ||
" ", | ||
/* @__PURE__ */ jsx("a", { href: "https://reactjs.org", target: "_blank", rel: "noreferrer", children: "React" }), | ||
" ", | ||
"framework powered by", | ||
" ", | ||
/* @__PURE__ */ jsx("a", { href: "https://vitejs.dev", target: "_blank", rel: "noreferrer", children: "Vite" }), | ||
", with a developer experience inspired by", | ||
" ", | ||
/* @__PURE__ */ jsx("a", { href: "https://nextjs.org", target: "_blank", rel: "noreferrer", children: "Next.js" }), | ||
" ", | ||
"and", | ||
" ", | ||
/* @__PURE__ */ jsx("a", { href: "https://kit.svelte.dev", target: "_blank", rel: "noreferrer", children: "Svelte Kit" }), | ||
". Pages of a Rakkas web applications are rendered on the server-side and hydrated on the client side." | ||
] }) | ||
] }); | ||
export { | ||
AboutPage as default | ||
}; |