Skip to content
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
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,57 @@
# Impulse

A JavaScript framework that leverages the Web Components API.
A lightweight JavaScript framework that leverages the Web Components API. Unlike traditional frameworks, Impulse doesn't
dictate how you render HTML. Instead, it's designed to augment your existing HTML with just the right amount of
JavaScript to make it interactive and reactive.

Write your HTML however you like, and let Impulse handle the behavior.

## Installation

```bash
yarn add @ambiki/impulse
```

## Example: Simple counter

```ts
import { ImpulseElement, property, registerElement, target } from '@ambiki/impulse';

@registerElement('counter-element')
export default class CounterElement extends ImpulseElement {
@property({ type: Number }) count = 0;
@target() output: HTMLElement;

countChanged(newValue: number) {
this.output.textContent = String(newValue);
}

decrement() {
this.count--;
}

increment() {
this.count++;
}
}
```

HTML:

```html
<counter-element count="0">
<h2>Count: <span data-target="counter-element.output">0</span></h2>
<button data-action="click->counter-element#decrement">-</button>
<button data-action="click->counter-element#increment">+</button>
</counter-element>
```

The counter automatically syncs the `count` attribute with the component property, calling `countChanged()` whenever it
updates. No virtual DOM, no JSX - just progressive enhancement of your HTML.

## Learn more

Check out the [full documentation](https://ambiki.github.io/impulse/) to explore more.

## License

Expand Down
5 changes: 3 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
}
},
"files": [
"dist"
"dist",
"README.md"
],
"keywords": [
"web-components"
Expand All @@ -41,7 +42,7 @@
"build": "rollup --config rollup.config.js",
"build:watch": "rollup --config rollup.config.js --watch",
"clean": "rm -fr dist",
"prepublishOnly": "yarn clean && yarn build",
"prepublishOnly": "cp ../../README.md . && yarn clean && yarn build",
"test": "web-test-runner",
"test:watch": "web-test-runner --watch"
},
Expand Down