# be-adoptive

> be-adoptive allows Shadow DOM to inherit styles from the parent element.

Latest version **0.0.14** (published 2023-06-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install be-adoptive
pnpm add be-adoptive
yarn add be-adoptive
bun add be-adoptive
```

## Health

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

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

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.14 |
| Published | 2023-06-04 |
| First published | 2021-10-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | anderson.bruce.b@gmail.com |
| Maintainers | bahrus |
| Keywords | web-components, web-component, custom-element, custom-elements, shadow-dom |

## Links

- npm: https://www.npmjs.com/package/be-adoptive
- Repository: https://github.com/bahrus/be-adoptive
- Homepage: https://github.com/bahrus/be-adoptive#readme
- Issues: https://github.com/bahrus/be-adoptive/issues
- npm.io page: https://npm.io/package/be-adoptive

## Dependencies (4)

- [be-hive](https://npm.io/package/be-hive.md) 0.0.99
- [be-enhanced](https://npm.io/package/be-enhanced.md) 0.0.25
- [trans-render](https://npm.io/package/trans-render.md) 0.0.684
- [xtal-element](https://npm.io/package/xtal-element.md) 0.0.564

## Recent versions

- 0.0.14 (latest) — 2023-06-04
- 0.0.13 — 2023-01-04
- 0.0.12 — 2023-01-03
- 0.0.11 — 2022-10-16
- 0.0.10 — 2022-10-15
- 0.0.9 — 2022-08-07
- 0.0.8 — 2022-02-19
- 0.0.7 — 2022-02-13
- 0.0.6 — 2022-02-08
- 0.0.5 — 2022-01-31
- 0.0.4 — 2022-01-23
- 0.0.3 — 2021-11-24
- 0.0.2 — 2021-11-20
- 0.0.1 — 2021-11-19
- 0.0.0 — 2021-10-15

## README

# be-adoptive

be-adoptive allows Shadow DOM to inherit styles from the parent element.

This provides a way to benefit from the slotting Shadow DOM provides, while being able to apply styles from the outside.

[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/be-adoptive)

[![Playwright Tests](https://github.com/bahrus/be-adoptive/actions/workflows/CI.yml/badge.svg?branch=baseline)](https://github.com/bahrus/be-adoptive/actions/workflows/CI.yml)

<a href="https://nodei.co/npm/be-adoptive/"><img src="https://nodei.co/npm/be-adoptive.png"></a>

[![How big is this package in your project?](https://img.shields.io/bundlephobia/minzip/be-adoptive?style=for-the-badge)](https://bundlephobia.com/result?p=be-adoptive)

<img src="http://img.badgesize.io/https://cdn.jsdelivr.net/npm/be-adoptive?compression=gzip">

## [Demo](https://codepen.io/bahrus/pen/porYqaz)  


Native support in Firefox and Safari for constructible stylesheets is now available!


## Syntax:

```html
<style>
    span{
        color: red;
    }
</style>
<div>
    <template shadowrootmode="open">
        <style be-adoptive>
            div{
                color: green;
            }
        </style>
        <span>Hello</span>
        <be-hive></be-hive>
    </template>
</div>
<span>Hello</span>
<be-hive></be-hive>
```

To be fully HTML5 compatible, use data-be-adoptive instead of be-adoptive.

The be-hive component allows us to specify an alternative attribute name, and acts as a "conduit" for all the [be-*](https://github.com/bahrus?tab=repositories&q=be-&type=&language=&sort=) components.  Alternatively, we can place an instance of the be-adoptive web component in our shadow DOM, and that will have the same effect.

> **Note**: It has become clear to me, after [following](https://toot.cafe/@nolan/109621170874013105) a discussion of an alternative [open-stylable](https://github.com/nolanlawson/open-stylable), that this solution is far from complete.  To be complete, the platform would need to provide a mechanism to subscribe to additions / removals of stylesheets from any Shadow DOM realm.  Or implement [this proposal](https://github.com/WICG/webcomponents/issues/909), which would render this behavior obsolete (which would be great).

## Viewing Locally

1.  Install git.
2.  Fork/clone this repo.
3.  Install node.
4.  Open command window to folder where you cloned this repo.
5.  > npm install
6.  > npm run serve
7.  Open http://localhost:3030/demo/dev in a modern browser.

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