# kuebox

> Lightweight frontend framework for multipage SPA

Latest version **1.1.0** (published 2023-07-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install kuebox
pnpm add kuebox
yarn add kuebox
bun add kuebox
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2023-07-01 |
| First published | 2023-05-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 24.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | vndg |
| Maintainers | vndg |
| Keywords | frontend, spa, typescript, vanilla, lightweight, event-driven, engine, single-page-application, router |

## Links

- npm: https://www.npmjs.com/package/kuebox
- Repository: https://github.com/Belousov-Daniil/kuebox
- Homepage: https://github.com/Belousov-Daniil/kuebox#readme
- Issues: https://github.com/Belousov-Daniil/kuebox/issues
- npm.io page: https://npm.io/package/kuebox

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2023-07-01
- 1.0.0 — 2023-05-21

## README

Event-driven typescript frontend framework created for multipage SPA


# Application

`KUBApplication` class - A SPA client app instance.

### API
#### Controllers

- Create new App
`createApp(): KUBApplication`

- Start App
`launchApp(): void`

- Render elements on top static layer
`renderOnDesktop(...views: HTMLElement[]): void`

#### Configuration

- Configure new route on a client side
`configurePage(route: string, pageToRender: new (props?: any) => IKUBPage): void`

- Configure 404/not-found page on a client side
`setPage404(page404: KUBPageType): void`

- Callback for decorating how pages will swap
`decorateSwapPages: (previosPage: IKUBPage, nextPage: IKUBPage) => Promise<void>`

#### Events

- Fired when path changes 
`onRouteChange: (newRoute: string) => void = () => undefined`

- Fired when new page renders
`onPageRender: (event: IPageRenderEvent) => void = () => undefined`

- Fired when page for requested path on client side was not found
`onPageNotFound: (event: IPageNotFoundEvent) => void = () => undefined`

- @depracated
`onLaunch: VoidFunction = () => undefined`

- @depricated
`onFirstRender: VoidFunction = () => undefined`

#### System

- Get application view
`static GET_APP_WINDOW(): HTMLElement`

- Get desktop layer view
`static GET_DESKTOP_LAYER(): HTMLElement`


# Pages

`KUBPage` abstract class - client app page

## API

- Render page to the App
`async RenderPage(callback = () => undefined): Promise<void>`

- Remove page from the App
`async RemovePage(callback = () => undefined): Promise<void>`

- Get page root element
`getViewRoot(): HTMLElement`

### Events

- Do before being mounted to the screen
`protected onBeforeRender: () => Promise<void>`

- Do when page is rendered to the screen
`protected onAfterRender: () => void`

- Do before page being removed from the screen
`protected onBeforeRemove: () => Promise<void>`


# Plugins

@under-rewrite

# Helpers

@under-rewrite

---
_Source: https://npm.io/package/kuebox · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
