@xplortech/apollo-angular 2.11.0
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.
- package/AGENTS.md +25 -0
- package/LICENSE +21 -0
- package/README.md +184 -0
- package/css/apollo.css +13345 -0
- package/dist/directives/angular-component-lib/utils.d.ts +9 -0
- package/dist/directives/angular-component-lib/utils.js +49 -0
- package/dist/directives/angular-component-lib/utils.js.map +1 -0
- package/dist/directives/boolean-value-accessor.d.ts +6 -0
- package/dist/directives/boolean-value-accessor.js +39 -0
- package/dist/directives/boolean-value-accessor.js.map +1 -0
- package/dist/directives/index.d.ts +7 -0
- package/dist/directives/index.js +83 -0
- package/dist/directives/index.js.map +1 -0
- package/dist/directives/proxies.d.ts +727 -0
- package/dist/directives/proxies.js +1951 -0
- package/dist/directives/proxies.js.map +1 -0
- package/dist/directives/radio-value-accessor.d.ts +6 -0
- package/dist/directives/radio-value-accessor.js +38 -0
- package/dist/directives/radio-value-accessor.js.map +1 -0
- package/dist/directives/select-value-accessor.d.ts +6 -0
- package/dist/directives/select-value-accessor.js +38 -0
- package/dist/directives/select-value-accessor.js.map +1 -0
- package/dist/directives/text-value-accessor.d.ts +5 -0
- package/dist/directives/text-value-accessor.js +35 -0
- package/dist/directives/text-value-accessor.js.map +1 -0
- package/dist/directives/value-accessor.d.ts +15 -0
- package/dist/directives/value-accessor.js +50 -0
- package/dist/directives/value-accessor.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/package.json +101 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# AGENTS.md — `@xplortech/apollo-angular`
|
|
2
|
+
|
|
3
|
+
**Angular 19+** standalone bindings for Apollo web components (`@xplortech/apollo-core`). Part of the Apollo monorepo: https://github.com/xplor/apollo
|
|
4
|
+
|
|
5
|
+
## Conventions
|
|
6
|
+
|
|
7
|
+
See the root [AGENTS.md](https://github.com/xplor/apollo/blob/main/AGENTS.md) for npm-only workflows, Conventional Commits (**scope `angular`**), PR `Refs:` lines, and shared design-system rules.
|
|
8
|
+
|
|
9
|
+
## This package (from repo root)
|
|
10
|
+
|
|
11
|
+
| Task | Command |
|
|
12
|
+
|------|---------|
|
|
13
|
+
| Build | `nx build @xplortech/apollo-angular` |
|
|
14
|
+
| TypeScript compile | `nx tsc @xplortech/apollo-angular` |
|
|
15
|
+
| Clean | `nx clean @xplortech/apollo-angular` |
|
|
16
|
+
|
|
17
|
+
There is no per-package lint or test target; lint runs at the workspace level via `npm run lint`.
|
|
18
|
+
|
|
19
|
+
**Nx Release group:** `core`.
|
|
20
|
+
|
|
21
|
+
## Public API
|
|
22
|
+
|
|
23
|
+
- Usage, `[(ngModel)]`, and registration patterns: [README.md](./README.md)
|
|
24
|
+
- Depends on `@xplortech/apollo-core` for custom elements and loader
|
|
25
|
+
- Built from Stencil-generated proxies in `src/directives/` (regenerated by `nx build @xplortech/apollo-core`)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023, Xplor XT1, LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# Apollo Angular
|
|
2
|
+
|
|
3
|
+
Angular bindings for the Apollo design system (`@xplortech/apollo-core` web components). Use this package in Angular apps for typed inputs, RxJS-backed outputs, and `[(ngModel)]` / reactive forms on form controls.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Published as **`@xplortech/apollo-angular`** on the public npm registry (same scope as `@xplortech/apollo-core` and `@xplortech/apollo-react`).
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @xplortech/apollo-angular @xplortech/apollo-core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Peer dependencies: **Angular 19+**, **RxJS 7+**, and **TypeScript 5+**.
|
|
14
|
+
|
|
15
|
+
Import styles once in your app (path may vary with your bundler):
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
// e.g. in styles.css / styles.scss
|
|
19
|
+
@import '@xplortech/apollo-angular/css/apollo.css';
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
The package ships **standalone** Angular component wrappers (Angular 14+, the default since v17). Custom elements register automatically when you import any wrapper — there is no `APP_INITIALIZER` setup required.
|
|
25
|
+
|
|
26
|
+
### Standalone components
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { Component } from '@angular/core';
|
|
30
|
+
import { FormsModule } from '@angular/forms';
|
|
31
|
+
import { TextValueAccessor, XplButton, XplInput } from '@xplortech/apollo-angular';
|
|
32
|
+
|
|
33
|
+
@Component({
|
|
34
|
+
selector: 'app-root',
|
|
35
|
+
standalone: true,
|
|
36
|
+
// FormsModule + TextValueAccessor enable [(ngModel)] on xpl-input.
|
|
37
|
+
imports: [FormsModule, XplButton, XplInput, TextValueAccessor],
|
|
38
|
+
template: `
|
|
39
|
+
<xpl-input [(ngModel)]="email" label="Email" type="email"></xpl-input>
|
|
40
|
+
<xpl-button variant="primary" (click)="save()">Save</xpl-button>
|
|
41
|
+
`,
|
|
42
|
+
})
|
|
43
|
+
export class AppComponent {
|
|
44
|
+
email = '';
|
|
45
|
+
save() {}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### NgModule consumers
|
|
50
|
+
|
|
51
|
+
If your app still uses `NgModule`, import `DIRECTIVES` (the full array of wrappers) or individual wrappers into the `imports` array:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { NgModule } from '@angular/core';
|
|
55
|
+
import { DIRECTIVES } from '@xplortech/apollo-angular';
|
|
56
|
+
|
|
57
|
+
@NgModule({
|
|
58
|
+
declarations: [AppComponent],
|
|
59
|
+
imports: [...DIRECTIVES],
|
|
60
|
+
})
|
|
61
|
+
export class AppModule {}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Forms (`[(ngModel)]` and reactive forms)
|
|
65
|
+
|
|
66
|
+
These wrappers integrate as Angular `ControlValueAccessor` implementations:
|
|
67
|
+
|
|
68
|
+
| Component | Form value | Update event (internal) | Value accessor |
|
|
69
|
+
|---------------|---------------|-------------------------|-----------------------|
|
|
70
|
+
| `XplInput` | `value` | `valueChange` | `TextValueAccessor` |
|
|
71
|
+
| `XplCheckbox` | `checked` | `checkboxChange` | `BooleanValueAccessor`|
|
|
72
|
+
| `XplRadio` | `selectedValue` | `radioChange` | `RadioValueAccessor` |
|
|
73
|
+
| `XplToggle` | `checked` | `toggleChange` | `BooleanValueAccessor`|
|
|
74
|
+
| `XplSelect` | `selectedValues` | `changeEvent` | `SelectValueAccessor` |
|
|
75
|
+
|
|
76
|
+
> **Standalone imports:** each form control's value accessor is a **separate
|
|
77
|
+
> standalone directive**. To use `[(ngModel)]` or `formControlName` you must
|
|
78
|
+
> import the matching value accessor alongside the component (see below), or
|
|
79
|
+
> import the full `DIRECTIVES` array (which includes every wrapper **and** every
|
|
80
|
+
> value accessor). `NgModule` consumers that import `...DIRECTIVES` get form
|
|
81
|
+
> binding automatically.
|
|
82
|
+
|
|
83
|
+
### Template-driven forms
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import { Component } from '@angular/core';
|
|
87
|
+
import { FormsModule } from '@angular/forms';
|
|
88
|
+
import {
|
|
89
|
+
BooleanValueAccessor,
|
|
90
|
+
TextValueAccessor,
|
|
91
|
+
XplCheckbox,
|
|
92
|
+
XplInput,
|
|
93
|
+
XplToggle,
|
|
94
|
+
} from '@xplortech/apollo-angular';
|
|
95
|
+
|
|
96
|
+
@Component({
|
|
97
|
+
selector: 'app-profile',
|
|
98
|
+
standalone: true,
|
|
99
|
+
imports: [
|
|
100
|
+
FormsModule,
|
|
101
|
+
XplCheckbox,
|
|
102
|
+
XplInput,
|
|
103
|
+
XplToggle,
|
|
104
|
+
// Value accessors register NG_VALUE_ACCESSOR on the hosts above.
|
|
105
|
+
TextValueAccessor,
|
|
106
|
+
BooleanValueAccessor,
|
|
107
|
+
],
|
|
108
|
+
template: `
|
|
109
|
+
<xpl-input [(ngModel)]="name" label="Name"></xpl-input>
|
|
110
|
+
<xpl-checkbox [(ngModel)]="agreed" label="I agree"></xpl-checkbox>
|
|
111
|
+
<xpl-toggle [(ngModel)]="enabled">Enabled</xpl-toggle>
|
|
112
|
+
`,
|
|
113
|
+
})
|
|
114
|
+
export class ProfileComponent {
|
|
115
|
+
name = '';
|
|
116
|
+
agreed = false;
|
|
117
|
+
enabled = false;
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Reactive forms
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
import { Component } from '@angular/core';
|
|
125
|
+
import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
|
|
126
|
+
import {
|
|
127
|
+
BooleanValueAccessor,
|
|
128
|
+
TextValueAccessor,
|
|
129
|
+
XplInput,
|
|
130
|
+
XplToggle,
|
|
131
|
+
} from '@xplortech/apollo-angular';
|
|
132
|
+
|
|
133
|
+
@Component({
|
|
134
|
+
selector: 'app-settings',
|
|
135
|
+
standalone: true,
|
|
136
|
+
imports: [
|
|
137
|
+
ReactiveFormsModule,
|
|
138
|
+
XplInput,
|
|
139
|
+
XplToggle,
|
|
140
|
+
TextValueAccessor,
|
|
141
|
+
BooleanValueAccessor,
|
|
142
|
+
],
|
|
143
|
+
template: `
|
|
144
|
+
<form [formGroup]="form">
|
|
145
|
+
<xpl-input formControlName="name" label="Name"></xpl-input>
|
|
146
|
+
<xpl-toggle formControlName="enabled">Enabled</xpl-toggle>
|
|
147
|
+
</form>
|
|
148
|
+
`,
|
|
149
|
+
})
|
|
150
|
+
export class SettingsComponent {
|
|
151
|
+
form = this.fb.group({ name: '', enabled: false });
|
|
152
|
+
constructor(private fb: FormBuilder) {}
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
> **Tip:** to avoid importing individual value accessors, import the whole
|
|
157
|
+
> `DIRECTIVES` array in a standalone component's `imports` — it registers every
|
|
158
|
+
> wrapper and value accessor at once.
|
|
159
|
+
|
|
160
|
+
**Specialized input types:** `<xpl-input type="date">`, `type="time"`, `type="phone"`, `type="color"`, and `type="file"` all work with `[(ngModel)]`. Internally, `xpl-input` renders a sub-component (e.g. `xpl-input-date`) and forwards its events. Prefer `<xpl-input type="date" [(ngModel)]="val">` over using the sub-components directly.
|
|
161
|
+
|
|
162
|
+
## Events and complex props
|
|
163
|
+
|
|
164
|
+
Stencil `@Event()` names are exposed as Angular `@Output()` `EventEmitter`s and emit `CustomEvent` instances. Use `.detail` to read the payload:
|
|
165
|
+
|
|
166
|
+
```html
|
|
167
|
+
<xpl-table
|
|
168
|
+
[data]="rows"
|
|
169
|
+
[columns]="cols"
|
|
170
|
+
(tableSelect)="onSelect($event.detail)"
|
|
171
|
+
></xpl-table>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Pass objects and arrays directly as `[propName]` bindings — Angular forwards them as DOM properties:
|
|
175
|
+
|
|
176
|
+
```html
|
|
177
|
+
<xpl-table [data]="rows" [columns]="cols"></xpl-table>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Further reading
|
|
181
|
+
|
|
182
|
+
- [Apollo repo](https://github.com/xplor/apollo)
|
|
183
|
+
- Core components and behavior: `@xplortech/apollo-core` / Storybook in this monorepo
|
|
184
|
+
- [Stencil Angular output target docs](https://stenciljs.com/docs/angular)
|