Skip to content

Commit

Permalink
0.0.47
Browse files Browse the repository at this point in the history
  • Loading branch information
bahrus committed Jul 21, 2024
1 parent f16413c commit 5a2415b
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 28 deletions.
38 changes: 29 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# be-value-added
# be-value-added (📶)

(The name of that emoji is "antenna bars").


[![How big is this package in your project?](https://img.shields.io/bundlephobia/minzip/be-value-added?style=for-the-badge)](https://bundlephobia.com/result?p=be-value-added)
<img src="http://img.badgesize.io/https://cdn.jsdelivr.net/npm/be-value-added?compression=gzip">
[![NPM version](https://badge.fury.io/js/be-value-added.png)](http://badge.fury.io/js/be-value-added)
[![Playwright Tests](https://github.com/bahrus/be-value-added/actions/workflows/CI.yml/badge.svg?branch=baseline)](https://github.com/bahrus/be-value-added/actions/workflows/CI.yml)

Enhances most built-in elements with a "value" property, which other enhancements use to provide formatting. Adds two-way binding support between this "value" property and a key property, in some cases.
*be-value*added* is a [be-enhanced](https://github.com/bahrus/be-enhanced) based enhancement that enhances most built-in elements with a "value" property, which other enhancements use to provide formatting. Adds two-way binding support between this "value" property and a key property of the enhanced element, in some cases.

The [output element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/output) provides an example of a built-in element that "outputs" its value. It's a bit of a strange creature, given that it displays the exact value passed in, but the "value-add" proposition the output element provides may be a bit esoteric (a11y related).

Expand All @@ -31,16 +34,33 @@ Anyway, the model / precedent that the output element provides seems quite usefu
<meta id=meta be-value-added>
<link id=link be-value-added>
...

<script type=module>
import 'be-enhanced/beEnhanced.js';
import '../be-value-added.js';
const {emc} = await import('be-value-added/behivior.js'));
await time.whenResolved(emc).value = new Date();
await data.whenResolved(emc).value = 13456789;
await meta.whenResolved(emc).value = 'hello';
await link.whenResolved(emc).value = true;
</script>
```

Where values are displayed (for the data and time tags above), the user will see the .toLocale... value. To customize the international settings, use [https://github.com/bahrus/be-intl](be-intl) enhancement that enhances this enhancement.

This is the canonical name. In less formal settings, where there is little chance of collision with other libraries, you can reference 📶.js instead and use the much shorter syntax:

```html
<time id=time 📶></time>
<data id=data 📶></data>
<meta id=meta 📶>
<link id=link 📶>
...

<script type=module>
await customElements.whenDefined('be-enhanced');
time.beEnhanced.by.beValueAdded.value = new Date();
data.beEnhanced.by.beValueAdded.value = 13456789;
meta.beEnhanced.by.beValueAdded.value = 'hello';
link.beEnhanced.by.beValueAdded.value = true;
const {emc} = await import('be-value-added/📶.js'));
await time.whenResolved(emc).value = new Date();
await data.whenResolved(emc).value = 13456789;
await meta.whenResolved(emc).value = 'hello';
await link.whenResolved(emc).value = true;
</script>
```

Expand Down
30 changes: 15 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"update": "ncu -u && npm install"
},
"dependencies": {
"be-enhanced": "0.0.113",
"be-hive": "0.0.193",
"trans-render": "0.0.800"
"be-enhanced": "0.0.114",
"be-hive": "0.0.194",
"trans-render": "0.0.801"
},
"devDependencies": {
"may-it-serve": "0.0.8",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"skipLibCheck": true
},
"files":[
"behivior.ts"
"📶.ts"
],
"exclude":[
"node_modules"
Expand Down
9 changes: 9 additions & 0 deletions 📶.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { MountObserver, seed, BeHive } from 'be-hive/be-hive.js';
import { emc as baseEMC } from './behivior.js';
export const emc = {
...baseEMC,
base: '📶',
enhPropKey: '📶',
};
const mose = seed(emc);
MountObserver.synthesize(document, BeHive, mose);
13 changes: 13 additions & 0 deletions 📶.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { EMC, MountObserver, seed, BeHive } from 'be-hive/be-hive.js';
import { emc as baseEMC} from './behivior.js';

export const emc: EMC = {
...baseEMC,
base: '📶',
enhPropKey: '📶',

};

const mose = seed(emc);

MountObserver.synthesize(document, BeHive, mose);

0 comments on commit 5a2415b

Please sign in to comment.