@wc-bindable/angular 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +60 -60
  2. package/package.json +35 -35
package/README.md CHANGED
@@ -1,60 +1,60 @@
1
- # @wc-bindable/angular
2
-
3
- Angular adapter for the **wc-bindable** protocol.
4
-
5
- ## Install
6
-
7
- ```bash
8
- npm install @wc-bindable/angular @wc-bindable/core
9
- ```
10
-
11
- ## Usage
12
-
13
- ```typescript
14
- import { Component } from "@angular/core";
15
- import { WcBindableDirective } from "@wc-bindable/angular";
16
-
17
- @Component({
18
- selector: "app-root",
19
- standalone: true,
20
- imports: [WcBindableDirective],
21
- template: `
22
- <my-input wcBindable (wcBindableChange)="onUpdate($event)" />
23
- <p>Current value: {{ currentValue }}</p>
24
- `,
25
- })
26
- export class AppComponent {
27
- currentValue = "";
28
-
29
- onUpdate(event: { name: string; value: unknown }) {
30
- if (event.name === "value") {
31
- this.currentValue = event.value as string;
32
- }
33
- }
34
- }
35
- ```
36
-
37
- ## API
38
-
39
- ### `WcBindableDirective`
40
-
41
- A standalone directive applied via the `wcBindable` attribute selector.
42
-
43
- | Output | Type | Description |
44
- |---|---|---|
45
- | `wcBindableChange` | `{ name: string; value: unknown }` | Emitted whenever a bindable property changes |
46
-
47
- - Binds on `ngOnInit` and cleans up on `ngOnDestroy`.
48
- - If the element does not implement `wc-bindable`, the directive is a no-op.
49
-
50
- ## Design Notes
51
-
52
- This directive uses `@Output()` with `EventEmitter` rather than the newer `output()` function API (Angular 17.3+). Reasons:
53
-
54
- - **Broader compatibility** — works with Angular 17+ (matching the `peerDependencies` requirement).
55
- - **Testability** — `@Output()` does not require an injection context, so the directive can be instantiated directly in unit tests.
56
- - **Stability** — `EventEmitter` is a long-established, stable Angular API with no deprecation planned.
57
-
58
- ## License
59
-
60
- MIT
1
+ # @wc-bindable/angular
2
+
3
+ Angular adapter for the **wc-bindable** protocol.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @wc-bindable/angular @angular/core
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { Component } from "@angular/core";
15
+ import { WcBindableDirective } from "@wc-bindable/angular";
16
+
17
+ @Component({
18
+ selector: "app-root",
19
+ standalone: true,
20
+ imports: [WcBindableDirective],
21
+ template: `
22
+ <my-input wcBindable (wcBindableChange)="onUpdate($event)" />
23
+ <p>Current value: {{ currentValue }}</p>
24
+ `,
25
+ })
26
+ export class AppComponent {
27
+ currentValue = "";
28
+
29
+ onUpdate(event: { name: string; value: unknown }) {
30
+ if (event.name === "value") {
31
+ this.currentValue = event.value as string;
32
+ }
33
+ }
34
+ }
35
+ ```
36
+
37
+ ## API
38
+
39
+ ### `WcBindableDirective`
40
+
41
+ A standalone directive applied via the `wcBindable` attribute selector.
42
+
43
+ | Output | Type | Description |
44
+ |---|---|---|
45
+ | `wcBindableChange` | `{ name: string; value: unknown }` | Emitted whenever a bindable property changes |
46
+
47
+ - Binds on `ngOnInit` and cleans up on `ngOnDestroy`.
48
+ - If the element does not implement `wc-bindable`, the directive is a no-op.
49
+
50
+ ## Design Notes
51
+
52
+ This directive uses `@Output()` with `EventEmitter` rather than the newer `output()` function API (Angular 17.3+). Reasons:
53
+
54
+ - **Broader compatibility** — works with Angular 17+ (matching the `peerDependencies` requirement).
55
+ - **Testability** — `@Output()` does not require an injection context, so the directive can be instantiated directly in unit tests.
56
+ - **Stability** — `EventEmitter` is a long-established, stable Angular API with no deprecation planned.
57
+
58
+ ## License
59
+
60
+ MIT
package/package.json CHANGED
@@ -1,35 +1,35 @@
1
- {
2
- "name": "@wc-bindable/angular",
3
- "version": "0.5.0",
4
- "description": "Angular adapter for wc-bindable protocol",
5
- "type": "module",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "default": "./dist/index.js"
12
- }
13
- },
14
- "files": [
15
- "dist",
16
- "LICENSE",
17
- "README.md"
18
- ],
19
- "scripts": {
20
- "build": "tsc",
21
- "dev": "tsc --watch"
22
- },
23
- "dependencies": {
24
- "@wc-bindable/core": "^0.5.0"
25
- },
26
- "peerDependencies": {
27
- "@angular/core": ">=17"
28
- },
29
- "repository": {
30
- "type": "git",
31
- "url": "https://github.com/wc-bindable-protocol/wc-bindable-protocol.git",
32
- "directory": "packages/angular"
33
- },
34
- "license": "MIT"
35
- }
1
+ {
2
+ "name": "@wc-bindable/angular",
3
+ "version": "0.6.1",
4
+ "description": "Angular adapter for wc-bindable protocol",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "LICENSE",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "dev": "tsc --watch"
22
+ },
23
+ "dependencies": {
24
+ "@wc-bindable/core": "^0.6.0"
25
+ },
26
+ "peerDependencies": {
27
+ "@angular/core": ">=17"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/wc-bindable-protocol/wc-bindable-protocol.git",
32
+ "directory": "packages/angular"
33
+ },
34
+ "license": "MIT"
35
+ }