A utilitarian framework for creating simple UI in javascript https://dreamland.js.org
Find a file
2024-02-24 10:14:57 -05:00
examples completely rewrite reactivity 2024-02-14 20:43:25 -05:00
.gitignore split css html and js 2024-01-27 17:34:50 -05:00
.npmignore fix alicecss speed, root element, misc refactors 2024-01-23 22:29:50 -05:00
css.js css cachign 2024-02-19 11:10:24 -05:00
DreamlandJS.d.ts dreamland.js branding 2024-02-24 10:14:57 -05:00
DreamlandJS.js dreamland.js branding 2024-02-24 10:14:57 -05:00
html.js bump semver 2024-02-12 16:59:16 -05:00
js.js minor minification optimizations, fix bug with if statements 2024-02-24 09:56:32 -05:00
LICENSE add code 2023-12-31 22:01:48 -05:00
package.json dreamland.js branding 2024-02-24 10:14:57 -05:00
pnpm-lock.yaml add code 2023-12-31 22:01:48 -05:00
README.md dreamland.js branding 2024-02-24 10:14:57 -05:00
store.js rewrite array reactivity entirely and fix if statemensts also add fragemetns lol 2024-02-23 10:54:18 -05:00
tsconfig.json dreamland.js branding 2024-02-24 10:14:57 -05:00

What is Dreamland?

dreamland.js is a reactive JSX-based rendering library with no virtual dom

Why do we need another javascript framework????

React is great, but the API is unnecesarily complex and bloated. Dreamland lets you write code where what you see is what you get, no trickery.

What does it look like?

Here's a simple counter app

function App() {
  this.counter = 0;
  return (
    <div>
      <button on:click={() => this.counter++}>Click me!</button>
      <p>
       {use(this.counter)}
      </p>
    </div>
  );
}

window.addEventListener("load", () => {
  document.body.appendChild(<App/>);
});

Compare that to the equivalent code in react:

import { React, useState } from 'react'
 
function App() {
  const [counter, setCounter] = useState(0);
 
  const increase = () => {
    setCounter(count => count + 1);
  };
 
  return (
    <div>
      <button onClick={increase}>Click me!</button>
      <p>
        Value: {counter}
      </p>
    </div>
  );
}

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById("root")
);

dreamland.js provides a simple and intuitive API at a low cost (~3kb, smaller than preact), while maintaining performance and ease of use

To get started with dreamland, add this to the compileroptions of your tsconfig.json

"jsx":"react",
"jsxFactory":"h",
"jsxFragmentFactory":"Fragment",
"types": ["@mercuryworkshop/dreamlandjs"],

and run npm install @mercuryworkshop/dreamlandjs

If you prefer using modules and are using a bundler, simply import "@mercuryworkshop/dreamlandjs"; into at least one file you're using.

If you don't like using modules, just add <script src="://unpkg.com/@mercuryworkshop/dreamlandjs"></script> to your html, and you can use AliceJS as normal.

dreamland can even be used without a build step, here's the counter example in plain JS

function App() {
  this.counter = 0;
  return html`
    <div>
      <button on:click=${() => this.counter++}>Click me!</button>
      <p>
        ${use(this.counter)}
      </p>
    </div>
  `;
}

window.addEventListener("load", () => {
  document.body.appendChild(h(App));
});

See the examples/ directory for more.