# with-properties

> custom elements base class factory with properties mapped to observed attributes

Latest version **3.1.0** (published 2022-03-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install with-properties
pnpm add with-properties
yarn add with-properties
bun add with-properties
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.0 |
| Published | 2022-03-16 |
| First published | 2021-12-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 75.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | stagas |
| Maintainers | stagas |
| Keywords | custom elements, web components, observed attributes, attributes, properties, mixin |

## Links

- npm: https://www.npmjs.com/package/with-properties
- Repository: https://git@github.com/stagas/with-properties
- Homepage: https://github.com/stagas/with-properties#readme
- Issues: https://github.com/stagas/with-properties/issues
- npm.io page: https://npm.io/package/with-properties

## Dependencies (2)

- [define-accessors](https://npm.io/package/define-accessors.md) ^1.1.1
- [camelcase-to-kebab](https://npm.io/package/camelcase-to-kebab.md) ^1.0.0

## Recent versions

- 3.1.0 (latest) — 2022-03-16
- 3.0.1 — 2022-03-13
- 3.0.0 — 2022-03-13
- 2.0.0 — 2022-02-01
- 1.0.0 — 2022-01-30
- 0.1.0 — 2021-12-04

## README

<h1 align="center">with-properties</h1>

<p align="center">
custom elements base class factory with properties mapped to observed attributes
</p>

<p align="center">
   <a href="#install">        🔧 <strong>Install</strong></a>
 · <a href="#example">        🧩 <strong>Example</strong></a>
 · <a href="#api">            📜 <strong>API docs</strong></a>
 · <a href="https://github.com/stagas/with-properties/releases"> 🔥 <strong>Releases</strong></a>
 · <a href="#contribute">     💪🏼 <strong>Contribute</strong></a>
 · <a href="https://github.com/stagas/with-properties/issues">   🖐️ <strong>Help</strong></a>
</p>

***

## Install

```sh
$ npm i with-properties
```

## API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

#### Table of Contents

*   [withProperties](#withproperties)
    *   [Parameters](#parameters)

### withProperties

[src/index.ts:84-129](https://github.com/stagas/with-properties/blob/347859f1dd6689f28f04586900fbe4e8a754a482/src/index.ts#L84-L129 "Source code on GitHub")

```js
class Foo extends withProperties(
  HTMLElement,
  class {
    string? = String
    number? = Number
    boolean = Boolean
    implicitString = 'string'
    implicitNumber = 123
    implicitBoolean = true
    somethingElse? = new Uint8Array(1)
  }
) {}
```

#### Parameters

*   `parent` **C** The parent constructor to extend (usually `HTMLElement`)
*   `propsClass` **[Constructor](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor)\<P>** A "props" class to create the properties from

Returns **any** A base constructor to be extended from

## Contribute

[Fork](https://github.com/stagas/with-properties/fork) or
[edit](https://github.dev/stagas/with-properties) and submit a PR.

All contributions are welcome!

## License

MIT © 2021
[stagas](https://github.com/stagas)

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