Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor events, lifecycle, no emit return, 💯 thunks, cut >100 bytes #317

Merged
merged 8 commits into from
Aug 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 0 additions & 91 deletions CONTRIBUTING.md

This file was deleted.

36 changes: 17 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,44 @@

HyperApp is a JavaScript library for building frontend applications.

[Elm Architecture]: https://guide.elm-lang.org/architecture/
[Hyperx]: https://github.com/substack/hyperx
[JSX]: https://facebook.github.io/react/docs/introducing-jsx.html
[CDN]: https://unpkg.com/hyperapp

* **Minimal**: HyperApp was born out of the attempt to do more with less. We have aggressively minimized the concepts you need to understand while remaining on par with what other frameworks can do.
* **Functional**: HyperApp's design is based on the [Elm Architecture]. Create scalable browser-based applications using a functional paradigm. The twist is you don't have to learn a new language.
* **Batteries-included**: Out of the box, HyperApp combines state management with a Virtual DOM engine that supports keyed updates & lifecycle events — all with no dependencies.
- **Minimal**: HyperApp was born out of the attempt to do [more with less](https://en.wikipedia.org/wiki/Worse_is_better). We have aggressively minimized the concepts you need to understand while remaining on par with what other frameworks can do.
- **Functional**: HyperApp's design is based on [The Elm Architecture](https://guide.elm-lang.org/architecture). Create scalable browser-based applications using a functional paradigm. The twist is you don't have to learn a new language.
- **Batteries-included**: Out of the box, HyperApp combines state management with a Virtual DOM engine that supports keyed updates & lifecycle events — all with no dependencies.

[Get started with HyperApp](/docs/getting-started.md)

## Hello World

[Try it online](https://codepen.io/hyperapp/pen/zNxZLP?editors=0010)
[Try it Online](https://codepen.io/hyperapp/pen/zNxZLP?editors=0010)

```jsx
app({
state: 0,
state: {
count: 0
},
view: (state, actions) =>
<main>
<h1>{state}</h1>
<button onclick={actions.add}>+</button>
<button onclick={actions.sub}>-</button>
<h1>{state.count}</h1>
<button onclick={actions.sub}>ー</button>
<button onclick={actions.add}>+</button>
</main>,
actions: {
add: state => state + 1,
sub: state => state - 1
sub: state => ({ count: state.count - 1 }),
add: state => ({ count: state.count + 1 })
}
})
```

## Documentation

The documentation is located in the [/docs](/docs) directory.
The documentation is in the [docs](/docs) directory.

## Community

* [Slack](https://hyperappjs.herokuapp.com)
* [/r/hyperapp](https://www.reddit.com/r/hyperapp)
* [Twitter](https://twitter.com/hyperappjs)
- [Slack](https://hyperappjs.herokuapp.com)
- [/r/hyperapp](https://www.reddit.com/r/hyperapp)
- [CodePen](https://codepen.io/hyperapp)
- [Twitter](https://twitter.com/hyperappjs)

## License

Expand Down
44 changes: 44 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Contributing to HyperApp

Thank you for taking the time to read our contribution guidelines. You can start to contribute in many ways, from writing tutorials, improving the documentation, filing bug reports and requesting new features.

## Code of Conduct

Our open source community strives to:

- **Be nice.**
- **Be welcoming**: We strive to be a community that welcomes and supports people of all backgrounds and identities.
- **Be considerate**: Remember that we're a world-wide community, so you might not be communicating in someone else's primary language.
- **Be respectful**: Not all of us will agree all the time, but disagreement is no excuse for poor behavior and poor manners.
- **Be careful in the words that you choose**: We are a community of professionals, and we conduct ourselves professionally. Be kind to others. Do not insult or put down other participants. Harassment and other exclusionary behavior aren't acceptable.

This code is not exhaustive or complete. It serves to distill our common understanding of a collaborative, shared environment, and goals. We expect it to be followed in spirit as much as in the letter.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting us at <hyperappjs@gmail.com>.

## Code Style

- Prefer descriptive single-word variable / function names to single-letter names.
- Format your code before committing using [prettier](https://prettier.github.io/prettier) or run the `format` script.
- We use ES6 modules but the rest of the code base is written in ES5.
- We prefer keeping all the moving parts inside as few files as possible. We don't have plans to break up the library into smaller modules.

## Filing Bugs

- Before submitting a bug report, search the issues for similar tickets. Your issue may have already been discussed and resolved. Feel free to add a comment to an existing ticket, even if it's closed.
- Determine which repository the problem should be reported in. If you have an issue with the Router, you'll be better served in [hyperapp/router](https://github.com/hyperapp/router), etc.
- If you have a question or need help with something you are building, we recommend joining the [HyperApp Slack Team](https://hyperappjs.herokuapp.com).
- Be thorough in your title and report, don't leave out important details, describe your setup and include any relevant code with your issue.
- Use GitHub [fenced code blocks](https://help.github.com/articles/creating-and-highlighting-code-blocks/) when sharing code. If your code has JSX in it, please use <code>```jsx</code> for accurate syntax highlighting.

## Writing Tests

- We use [Babel](https://babeljs.io) and [Jest](http://facebook.github.io/jest) to run the tests.
- Feel free to create a new `test/*.test.js` file if none of the existing test files suits your test case.
- Tests usually start by creating a small application and using a feature, then check if `document.body.innerHTML` matches some expected string. The app call is async, so we often use [oncreate](/docs/api.md#oncreate) or [onupdate](/docs/api.md#onupdate) lifecycle events to detect when the view has been rendered.
- We use [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame) to throttle renders, but it is not natively supported by Jest. For this reason you'll often see the following code at the top of a test file:

```js
window.requestAnimationFrame = setTimeout
```

4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Documentation

We assume you have some knowledge of HTML and JavaScript. If you are completely new to frontend development, you may prefer to come back after learning the basics. Previous experience with other frameworks is a plus, but not required.

- [Index](/docs/index.md)
- [Contribution Guidelines](/docs/CONTRIBUTING.md)
- [Getting Started](/docs/getting-started.md)
- [Installation](/docs/getting-started.md#installation)
- [Usage](/docs/getting-started.md#usage)
Expand All @@ -21,6 +20,7 @@ We assume you have some knowledge of HTML and JavaScript. If you are completely
- [Keys](/docs/keys.md)
- [Components](/docs/components.md)
- [Lifecycle Events](/docs/lifecycle-events.md)
- [SSR & Hydration](/docs/hydration.md)
- Learning
- [Implementation Notes](/docs/implementation-notes.md)
- [Tutorials](/docs/tutorials.md)
Expand Down
Loading