diff --git a/langs/en/examples-src/$descriptor.json b/langs/en/examples-src/$descriptor.json
new file mode 100644
index 00000000..95e1c458
--- /dev/null
+++ b/langs/en/examples-src/$descriptor.json
@@ -0,0 +1,14 @@
+[
+ "counter",
+ "todos",
+ "forms",
+ "cssanimations",
+ "context",
+ "clock",
+ "ethasketch",
+ "scoreboard",
+ "asyncresource",
+ "suspensetabs",
+ "simpletodos",
+ "simpletodoshyperscript"
+]
diff --git a/langs/en/examples-src/README.md b/langs/en/examples-src/README.md
new file mode 100644
index 00000000..cd304b54
--- /dev/null
+++ b/langs/en/examples-src/README.md
@@ -0,0 +1,26 @@
+# README of /examples-src/
+
+This folder contains all the existing examples.
+
+
+## Creating an example
+
+1. add a new folder like `/examples-src/new-example` (`new-example` is later used as the example ID)
+2. fill the `/examples-src/new-example` folder with all the files of the new example
+3. add an `/examples-src/new-example/$descriptor.json` file with meaningful data (see existing examples)
+
+NOTE: only the files included in the `$descriptor.files` list will be published
+
+
+## Publishing an example
+
+1. add the example ID to the `/examples-src/$descriptor.json` file
+
+NOTE: only the examples included in the `$descriptor` list will be published
+
+
+## Rollup
+
+The `generate-json-folders` (rollup plugin) creates a bunch of JSON files based on the structure of the `examples-src` tree and its `$descriptor` files.
+
+Just run `$ yarn build` to see the result in `/examples/`.
diff --git a/langs/en/examples-src/asyncresource/$descriptor.json b/langs/en/examples-src/asyncresource/$descriptor.json
new file mode 100644
index 00000000..d8dd20a6
--- /dev/null
+++ b/langs/en/examples-src/asyncresource/$descriptor.json
@@ -0,0 +1,5 @@
+{
+ "name": "Complex/Async Resource",
+ "description": "Ajax requests to SWAPI with Promise cancellation",
+ "files": ["main.jsx"]
+}
\ No newline at end of file
diff --git a/langs/en/examples-src/asyncresource/main.jsx b/langs/en/examples-src/asyncresource/main.jsx
new file mode 100644
index 00000000..f80207be
--- /dev/null
+++ b/langs/en/examples-src/asyncresource/main.jsx
@@ -0,0 +1,27 @@
+import { createSignal, createResource } from "solid-js";
+import { render } from "solid-js/web";
+
+const fetchUser = async (id) =>
+ (await fetch(`https://swapi.dev/api/people/${id}/`)).json();
+
+const App = () => {
+ const [userId, setUserId] = createSignal();
+ const [user] = createResource(userId, fetchUser);
+
+ return (
+ <>
+ setUserId(e.currentTarget.value)}
+ />
+ {user.loading && "Loading..."}
+
+ `;
+};
+
+render(App, document.getElementById("app"));
\ No newline at end of file
diff --git a/langs/en/examples-src/simpletodoshyperscript/$descriptor.json b/langs/en/examples-src/simpletodoshyperscript/$descriptor.json
new file mode 100644
index 00000000..dc0b43f5
--- /dev/null
+++ b/langs/en/examples-src/simpletodoshyperscript/$descriptor.json
@@ -0,0 +1,5 @@
+{
+ "name": "Complex/Simple Todos Hyperscript",
+ "description": "Simple Todos using Hyper DOM Expressions",
+ "files": ["main.jsx"]
+}
\ No newline at end of file
diff --git a/langs/en/examples-src/simpletodoshyperscript/main.jsx b/langs/en/examples-src/simpletodoshyperscript/main.jsx
new file mode 100644
index 00000000..edb3308c
--- /dev/null
+++ b/langs/en/examples-src/simpletodoshyperscript/main.jsx
@@ -0,0 +1,86 @@
+import { createEffect, For } from "solid-js";
+import { createStore } from "solid-js/store";
+import { render } from "solid-js/web";
+import h from "solid-js/h";
+
+function createLocalStore(initState) {
+ const [state, setState] = createStore(initState);
+ if (localStorage.todos) setState(JSON.parse(localStorage.todos));
+ createEffect(() => (localStorage.todos = JSON.stringify(state)));
+ return [state, setState];
+}
+
+const App = () => {
+ const [state, setState] = createLocalStore({
+ todos: [],
+ newTitle: "",
+ idCounter: 0
+ });
+ return [
+ h("h3", "Simple Todos Example"),
+ h("input", {
+ type: "text",
+ placeholder: "enter todo and click +",
+ value: () => state.newTitle,
+ onInput: (e) => setState("newTitle", e.target.value)
+ }),
+ h(
+ "button",
+ {
+ onClick: () =>
+ setState((s) => ({
+ idCounter: s.idCounter + 1,
+ todos: [
+ ...s.todos,
+ {
+ id: state.idCounter,
+ title: state.newTitle,
+ done: false
+ }
+ ],
+ newTitle: ""
+ }))
+ },
+ "+"
+ ),
+ h(For, { each: () => state.todos }, (todo) =>
+ h(
+ "div",
+ h("input", {
+ type: "checkbox",
+ checked: todo.done,
+ onChange: (e) =>
+ setState(
+ "todos",
+ state.todos.findIndex((t) => t.id === todo.id),
+ {
+ done: e.target.checked
+ }
+ )
+ }),
+ h("input", {
+ type: "text",
+ value: todo.title,
+ onChange: (e) =>
+ setState(
+ "todos",
+ state.todos.findIndex((t) => t.id === todo.id),
+ {
+ title: e.target.value
+ }
+ )
+ }),
+ h(
+ "button",
+ {
+ onClick: () =>
+ setState("todos", (t) => t.filter((t) => t.id !== todo.id))
+ },
+ "x"
+ )
+ )
+ )
+ ];
+};
+
+render(App, document.getElementById("app"));
\ No newline at end of file
diff --git a/langs/en/examples-src/styledjsx/$descriptor.json b/langs/en/examples-src/styledjsx/$descriptor.json
new file mode 100644
index 00000000..dae02405
--- /dev/null
+++ b/langs/en/examples-src/styledjsx/$descriptor.json
@@ -0,0 +1,3 @@
+{
+ "files": ["main.jsx","tab1.jsx"]
+}
\ No newline at end of file
diff --git a/langs/en/examples-src/styledjsx/main.jsx b/langs/en/examples-src/styledjsx/main.jsx
new file mode 100644
index 00000000..004efad9
--- /dev/null
+++ b/langs/en/examples-src/styledjsx/main.jsx
@@ -0,0 +1,33 @@
+import { createSignal } from "solid-js";
+import { render } from "solid-js/web";
+
+function Button() {
+ const [isLoggedIn, login] = createSignal(false);
+ return (
+ <>
+
+
+ >
+ );
+}
+
+render(
+ () => (
+ <>
+
+
+ >
+ ),
+ document.getElementById("app")
+);
\ No newline at end of file
diff --git a/langs/en/examples-src/styledjsx/tab1.jsx b/langs/en/examples-src/styledjsx/tab1.jsx
new file mode 100644
index 00000000..aa743248
--- /dev/null
+++ b/langs/en/examples-src/styledjsx/tab1.jsx
@@ -0,0 +1,63 @@
+import { createState } from "solid-js";
+
+function checkValid({ element, validators = [] }, setErrors, errorClass) {
+ return async () => {
+ element.setCustomValidity("");
+ element.checkValidity();
+ let message = element.validationMessage;
+ if (!message) {
+ for (const validator of validators) {
+ const text = await validator(element);
+ if (text) {
+ element.setCustomValidity(text);
+ break;
+ }
+ }
+ message = element.validationMessage;
+ }
+ if (message) {
+ errorClass && element.classList.toggle(errorClass, true);
+ setErrors({ [element.name]: message });
+ }
+ };
+}
+
+export function useForm({ errorClass }) {
+ const [errors, setErrors] = createState({}),
+ fields = {};
+
+ const validate = (validators = []) => {
+ return ref => {
+ let config;
+ fields[ref.name] = config = { element: ref, validators };
+ ref.onblur = checkValid(config, setErrors, errorClass);
+ ref.oninput = () => {
+ if (!errors[ref.name]) return;
+ setErrors({ [ref.name]: undefined });
+ errorClass && ref.classList.toggle(errorClass, false);
+ };
+ };
+ };
+
+ const handleSubmit = (callback = () => {}) => {
+ return ref => {
+ ref.setAttribute("novalidate", "");
+ ref.onsubmit = async e => {
+ e.preventDefault();
+ let errored = false;
+
+ for (const k in fields) {
+ const field = fields[k];
+ await checkValid(field, setErrors, errorClass)();
+ if (!errored && field.element.validationMessage) {
+ field.element.focus();
+ errored = true;
+ }
+ }
+ !errored && callback(ref);
+ };
+ };
+ };
+
+ return { validate, handleSubmit, errors };
+}
diff --git a/langs/en/examples-src/suspensetabs/$descriptor.json b/langs/en/examples-src/suspensetabs/$descriptor.json
new file mode 100644
index 00000000..8538f66c
--- /dev/null
+++ b/langs/en/examples-src/suspensetabs/$descriptor.json
@@ -0,0 +1,5 @@
+{
+ "name": "Complex/Suspense Transitions",
+ "description": "Deferred loading spinners for smooth UX",
+ "files": ["main.jsx","child.jsx","styles.css"]
+}
\ No newline at end of file
diff --git a/langs/en/examples-src/suspensetabs/child.jsx b/langs/en/examples-src/suspensetabs/child.jsx
new file mode 100644
index 00000000..a260398b
--- /dev/null
+++ b/langs/en/examples-src/suspensetabs/child.jsx
@@ -0,0 +1,27 @@
+import { createResource } from "solid-js";
+
+const CONTENT = {
+ Uno: `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.`,
+ Dos: `Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?`,
+ Tres: `On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.`
+};
+
+function createDelay() {
+ return new Promise((resolve) => {
+ const delay = Math.random() * 420 + 160;
+ setTimeout(() => resolve(delay), delay);
+ });
+}
+
+const Child = (props) => {
+ const [time] = createResource(createDelay);
+
+ return (
+
+ This content is for page "{props.page}" after {time()?.toFixed()}ms.
+
\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris\n facilisis enim libero, at lacinia diam fermentum id. Pellentesque\n habitant morbi tristique senectus et netus.\n
\n )}\n \n \n Animation:\n \n {show() && (\n
\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris\n facilisis enim libero, at lacinia diam fermentum id. Pellentesque\n habitant morbi tristique senectus et netus.\n
\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris\n facilisis enim libero, at lacinia diam fermentum id. Pellentesque\n habitant morbi tristique senectus et netus.\n
\n )}\n \n \n Switch OutIn\n \n \n \n \n \n
The First
\n \n \n
The Second
\n \n \n
The Third
\n \n \n \n Group\n \n \n \n \n \n \n {(r) => {r}}\n \n >\n );\n};\n\nrender(App, document.getElementById(\"app\"));"},{"name":"styles","type":"css","content":".container {\n position: relative;\n}\n\n.fade-enter-active,\n.fade-exit-active {\n transition: opacity 0.5s;\n}\n.fade-enter,\n.fade-exit-to {\n opacity: 0;\n}\n\n.slide-fade-enter-active {\n transition: all 0.3s ease;\n}\n.slide-fade-exit-active {\n transition: all 0.8s cubic-bezier(1, 0.5, 0.8, 1);\n}\n.slide-fade-enter,\n.slide-fade-exit-to {\n transform: translateX(10px);\n opacity: 0;\n}\n\n.bounce-enter-active {\n animation: bounce-in 0.5s;\n}\n.bounce-exit-active {\n animation: bounce-in 0.5s reverse;\n}\n@keyframes bounce-in {\n 0% {\n transform: scale(0);\n }\n 50% {\n transform: scale(1.5);\n }\n 100% {\n transform: scale(1);\n }\n}\n\n.list-item {\n transition: all 0.5s;\n display: inline-block;\n margin-right: 10px;\n}\n\n.list-item-enter,\n.list-item-exit-to {\n opacity: 0;\n transform: translateY(30px);\n}\n.list-item-exit-active {\n position: absolute;\n}\n"}]}
\ No newline at end of file
diff --git a/langs/en/examples/ethasketch.json b/langs/en/examples/ethasketch.json
new file mode 100644
index 00000000..f9153d5f
--- /dev/null
+++ b/langs/en/examples/ethasketch.json
@@ -0,0 +1 @@
+{"id":"ethasketch","name":"Complex/Etch A Sketch","description":"Uses Index and createMemo to create a grid graphic","files":[{"name":"main","type":"tsx","content":"// Project idea from https://www.theodinproject.com/paths/foundations/courses/foundations/lessons/etch-a-sketch-project\nimport { render } from \"solid-js/web\";\nimport { createSignal, createMemo, Index } from \"solid-js\";\n\nimport \"./styles.css\";\n\nconst maxGridPixelWidth = 500;\n\nfunction randomHexColorString(): string {\n return \"#\" + Math.floor(Math.random() * 16777215).toString(16);\n}\n\nfunction clampGridSideLength(newSideLength: number): number {\n return Math.min(Math.max(newSideLength, 0), 100);\n}\n\nfunction EtchASketch() {\n const [gridSideLength, setGridSideLength] = createSignal(10);\n const gridTemplateString = createMemo(\n () =>\n `repeat(${gridSideLength()}, ${maxGridPixelWidth / gridSideLength()}px)`\n );\n\n return (\n <>\n
\n `;\n};\n\nrender(App, document.getElementById(\"app\"));"}]}
\ No newline at end of file
diff --git a/langs/en/examples/simpletodoshyperscript.json b/langs/en/examples/simpletodoshyperscript.json
new file mode 100644
index 00000000..9464520a
--- /dev/null
+++ b/langs/en/examples/simpletodoshyperscript.json
@@ -0,0 +1 @@
+{"id":"simpletodoshyperscript","name":"Complex/Simple Todos Hyperscript","description":"Simple Todos using Hyper DOM Expressions","files":[{"name":"main","type":"jsx","content":"import { createEffect, For } from \"solid-js\";\nimport { createStore } from \"solid-js/store\";\nimport { render } from \"solid-js/web\";\nimport h from \"solid-js/h\";\n\nfunction createLocalStore(initState) {\n const [state, setState] = createStore(initState);\n if (localStorage.todos) setState(JSON.parse(localStorage.todos));\n createEffect(() => (localStorage.todos = JSON.stringify(state)));\n return [state, setState];\n}\n\nconst App = () => {\n const [state, setState] = createLocalStore({\n todos: [],\n newTitle: \"\",\n idCounter: 0\n });\n return [\n h(\"h3\", \"Simple Todos Example\"),\n h(\"input\", {\n type: \"text\",\n placeholder: \"enter todo and click +\",\n value: () => state.newTitle,\n onInput: (e) => setState(\"newTitle\", e.target.value)\n }),\n h(\n \"button\",\n {\n onClick: () =>\n setState((s) => ({\n idCounter: s.idCounter + 1,\n todos: [\n ...s.todos,\n {\n id: state.idCounter,\n title: state.newTitle,\n done: false\n }\n ],\n newTitle: \"\"\n }))\n },\n \"+\"\n ),\n h(For, { each: () => state.todos }, (todo) =>\n h(\n \"div\",\n h(\"input\", {\n type: \"checkbox\",\n checked: todo.done,\n onChange: (e) =>\n setState(\n \"todos\",\n state.todos.findIndex((t) => t.id === todo.id),\n {\n done: e.target.checked\n }\n )\n }),\n h(\"input\", {\n type: \"text\",\n value: todo.title,\n onChange: (e) =>\n setState(\n \"todos\",\n state.todos.findIndex((t) => t.id === todo.id),\n {\n title: e.target.value\n }\n )\n }),\n h(\n \"button\",\n {\n onClick: () =>\n setState(\"todos\", (t) => t.filter((t) => t.id !== todo.id))\n },\n \"x\"\n )\n )\n )\n ];\n};\n\nrender(App, document.getElementById(\"app\"));"}]}
\ No newline at end of file
diff --git a/langs/en/examples/styledjsx.json b/langs/en/examples/styledjsx.json
new file mode 100644
index 00000000..9b8f6f99
--- /dev/null
+++ b/langs/en/examples/styledjsx.json
@@ -0,0 +1 @@
+{"id":"styledjsx","files":[{"name":"main","type":"jsx","content":"import { createSignal } from \"solid-js\";\nimport { render } from \"solid-js/web\";\n\nfunction Button() {\n const [isLoggedIn, login] = createSignal(false);\n return (\n <>\n \n \n >\n );\n}\n\nrender(\n () => (\n <>\n \n \n >\n ),\n document.getElementById(\"app\")\n);"},{"name":"tab1","type":"jsx","content":"import { createState } from \"solid-js\";\n\nfunction checkValid({ element, validators = [] }, setErrors, errorClass) {\n return async () => {\n element.setCustomValidity(\"\");\n element.checkValidity();\n let message = element.validationMessage;\n if (!message) {\n for (const validator of validators) {\n const text = await validator(element);\n if (text) {\n element.setCustomValidity(text);\n break;\n }\n }\n message = element.validationMessage;\n }\n if (message) {\n errorClass && element.classList.toggle(errorClass, true);\n setErrors({ [element.name]: message });\n }\n };\n}\n\nexport function useForm({ errorClass }) {\n const [errors, setErrors] = createState({}),\n fields = {};\n\n const validate = (validators = []) => {\n return ref => {\n let config;\n fields[ref.name] = config = { element: ref, validators };\n ref.onblur = checkValid(config, setErrors, errorClass);\n ref.oninput = () => {\n if (!errors[ref.name]) return;\n setErrors({ [ref.name]: undefined });\n errorClass && ref.classList.toggle(errorClass, false);\n };\n };\n };\n\n const handleSubmit = (callback = () => {}) => {\n return ref => {\n ref.setAttribute(\"novalidate\", \"\");\n ref.onsubmit = async e => {\n e.preventDefault();\n let errored = false;\n\n for (const k in fields) {\n const field = fields[k];\n await checkValid(field, setErrors, errorClass)();\n if (!errored && field.element.validationMessage) {\n field.element.focus();\n errored = true;\n }\n }\n !errored && callback(ref);\n };\n };\n };\n\n return { validate, handleSubmit, errors };\n}\n"}]}
\ No newline at end of file
diff --git a/langs/en/examples/suspensetabs.json b/langs/en/examples/suspensetabs.json
new file mode 100644
index 00000000..190dd213
--- /dev/null
+++ b/langs/en/examples/suspensetabs.json
@@ -0,0 +1 @@
+{"id":"suspensetabs","name":"Complex/Suspense Transitions","description":"Deferred loading spinners for smooth UX","files":[{"name":"main","type":"jsx","content":"import { createSignal, Suspense, Switch, Match, useTransition } from \"solid-js\";\nimport { render } from \"solid-js/web\";\nimport Child from \"./child\";\n\nimport \"./styles.css\";\n\nconst App = () => {\n const [tab, setTab] = createSignal(0);\n const [pending, start] = useTransition();\n const updateTab = (index) => () => start(() => setTab(index));\n\n return (\n <>\n
\n
\n Uno\n
\n
\n Dos\n
\n
\n Tres\n
\n
\n
\n Loading...
}>\n \n \n \n \n \n \n \n \n \n \n \n \n \n >\n );\n};\n\nrender(App, document.getElementById(\"app\"));\n"},{"name":"child","type":"jsx","content":"import { createResource } from \"solid-js\";\n\nconst CONTENT = {\n Uno: `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.`,\n Dos: `Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?`,\n Tres: `On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.`\n};\n\nfunction createDelay() {\n return new Promise((resolve) => {\n const delay = Math.random() * 420 + 160;\n setTimeout(() => resolve(delay), delay);\n });\n}\n\nconst Child = (props) => {\n const [time] = createResource(createDelay);\n\n return (\n
\n This content is for page \"{props.page}\" after {time()?.toFixed()}ms.\n