@diwacopilot/components-angular 1.0.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/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # @diwacopilot/components-angular
2
+
3
+ Angular wrappers for `@diwacopilot/components`.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @diwacopilot/components @diwacopilot/components-angular
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { DIRECTIVES, DButton } from "@diwacopilot/components-angular";
15
+ ```
16
+
17
+ Register web components once in your app bootstrap:
18
+
19
+ ```ts
20
+ import { defineCustomElements } from "@diwacopilot/components/loader";
21
+
22
+ defineCustomElements();
23
+ ```
@@ -0,0 +1,10 @@
1
+ export declare const proxyInputs: (Cmp: any, inputs: string[]) => void;
2
+ export declare const proxyMethods: (Cmp: any, methods: string[]) => void;
3
+ export declare const proxyOutputs: (instance: any, el: any, events: string[]) => void;
4
+ export declare const defineCustomElement: (tagName: string, customElement: any) => void;
5
+ export declare function ProxyCmp(opts: {
6
+ defineCustomElementFn?: () => void;
7
+ inputs?: any;
8
+ methods?: any;
9
+ }): (cls: any) => any;
10
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/directives/angular-component-lib/utils.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,GAAI,KAAK,GAAG,EAAE,QAAQ,MAAM,EAAE,SAoBrD,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,KAAK,GAAG,EAAE,SAAS,MAAM,EAAE,SAQvD,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,UAAU,GAAG,EAAE,IAAI,GAAG,EAAE,QAAQ,MAAM,EAAE,SAEpE,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,EAAE,eAAe,GAAG,SAItE,CAAC;AAGF,wBAAgB,QAAQ,CAAC,IAAI,EAAE;IAAE,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE,GAAG,CAAC;IAAC,OAAO,CAAC,EAAE,GAAG,CAAA;CAAE,SAC/D,GAAG,SAgBrC"}
@@ -0,0 +1,58 @@
1
+ /* eslint-disable */
2
+ /* tslint:disable */
3
+ import { fromEvent } from 'rxjs';
4
+ export const proxyInputs = (Cmp, inputs) => {
5
+ const Prototype = Cmp.prototype;
6
+ inputs.forEach((item) => {
7
+ Object.defineProperty(Prototype, item, {
8
+ get() {
9
+ return this.el[item];
10
+ },
11
+ set(val) {
12
+ this.z.runOutsideAngular(() => (this.el[item] = val));
13
+ },
14
+ /**
15
+ * In the event that proxyInputs is called
16
+ * multiple times re-defining these inputs
17
+ * will cause an error to be thrown. As a result
18
+ * we set configurable: true to indicate these
19
+ * properties can be changed.
20
+ */
21
+ configurable: true,
22
+ });
23
+ });
24
+ };
25
+ export const proxyMethods = (Cmp, methods) => {
26
+ const Prototype = Cmp.prototype;
27
+ methods.forEach((methodName) => {
28
+ Prototype[methodName] = function () {
29
+ const args = arguments;
30
+ return this.z.runOutsideAngular(() => this.el[methodName].apply(this.el, args));
31
+ };
32
+ });
33
+ };
34
+ export const proxyOutputs = (instance, el, events) => {
35
+ events.forEach((eventName) => (instance[eventName] = fromEvent(el, eventName)));
36
+ };
37
+ export const defineCustomElement = (tagName, customElement) => {
38
+ if (customElement !== undefined && typeof customElements !== 'undefined' && !customElements.get(tagName)) {
39
+ customElements.define(tagName, customElement);
40
+ }
41
+ };
42
+ // tslint:disable-next-line: only-arrow-functions
43
+ export function ProxyCmp(opts) {
44
+ const decorator = function (cls) {
45
+ const { defineCustomElementFn, inputs, methods } = opts;
46
+ if (defineCustomElementFn !== undefined) {
47
+ defineCustomElementFn();
48
+ }
49
+ if (inputs) {
50
+ proxyInputs(cls, inputs);
51
+ }
52
+ if (methods) {
53
+ proxyMethods(cls, methods);
54
+ }
55
+ return cls;
56
+ };
57
+ return decorator;
58
+ }
@@ -0,0 +1,60 @@
1
+ /**
2
+ * D* Angular wrapper components.
3
+ *
4
+ * These are thin Angular components with `d-*` selectors that forward all
5
+ * props and content-projection to the underlying `diwa-*` web components.
6
+ * CUSTOM_ELEMENTS_SCHEMA allows the inner `<diwa-*>` tag in each template.
7
+ *
8
+ * Usage:
9
+ * import { DButton } from '@diwacopilot/components-angular';
10
+ *
11
+ * @Component({
12
+ * standalone: true,
13
+ * imports: [DButton],
14
+ * template: `<d-button variant="primary" (click)="save()">Save</d-button>`,
15
+ * })
16
+ * export class MyComponent {}
17
+ */
18
+ import { EventEmitter } from '@angular/core';
19
+ export declare class DBadge {
20
+ label?: string;
21
+ size?: string;
22
+ variant?: string;
23
+ }
24
+ export declare class DButton {
25
+ theme?: string;
26
+ variant?: string;
27
+ size?: string;
28
+ type?: string;
29
+ disabled?: boolean;
30
+ loading?: boolean;
31
+ href?: string;
32
+ target?: string;
33
+ name?: string;
34
+ value?: string;
35
+ label?: string;
36
+ hideLabel?: boolean;
37
+ }
38
+ export declare class DInput {
39
+ type?: string;
40
+ label?: string;
41
+ placeholder?: string;
42
+ value?: string;
43
+ required?: boolean;
44
+ disabled?: boolean;
45
+ readonly?: boolean;
46
+ state?: string;
47
+ hint?: string;
48
+ autocomplete?: string;
49
+ name?: string;
50
+ inputId?: string;
51
+ diwaInput: EventEmitter<CustomEvent<string>>;
52
+ diwaChange: EventEmitter<CustomEvent<string>>;
53
+ diwaFocus: EventEmitter<CustomEvent<FocusEvent>>;
54
+ diwaBlur: EventEmitter<CustomEvent<FocusEvent>>;
55
+ }
56
+ export declare class DSpinner {
57
+ label?: string;
58
+ size?: string;
59
+ }
60
+ //# sourceMappingURL=d-proxies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"d-proxies.d.ts","sourceRoot":"","sources":["../../src/directives/d-proxies.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAIL,YAAY,EAGb,MAA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
@@ -0,0 +1,250 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ /* eslint-disable */
8
+ /**
9
+ * D* Angular wrapper components.
10
+ *
11
+ * These are thin Angular components with `d-*` selectors that forward all
12
+ * props and content-projection to the underlying `diwa-*` web components.
13
+ * CUSTOM_ELEMENTS_SCHEMA allows the inner `<diwa-*>` tag in each template.
14
+ *
15
+ * Usage:
16
+ * import { DButton } from '@diwacopilot/components-angular';
17
+ *
18
+ * @Component({
19
+ * standalone: true,
20
+ * imports: [DButton],
21
+ * template: `<d-button variant="primary" (click)="save()">Save</d-button>`,
22
+ * })
23
+ * export class MyComponent {}
24
+ */
25
+ import { ChangeDetectionStrategy, Component, CUSTOM_ELEMENTS_SCHEMA, EventEmitter, Input, Output, } from '@angular/core';
26
+ // ─── DBadge ──────────────────────────────────────────────────────────────────
27
+ let DBadge = class DBadge {
28
+ label;
29
+ size;
30
+ variant;
31
+ };
32
+ __decorate([
33
+ Input()
34
+ ], DBadge.prototype, "label", void 0);
35
+ __decorate([
36
+ Input()
37
+ ], DBadge.prototype, "size", void 0);
38
+ __decorate([
39
+ Input()
40
+ ], DBadge.prototype, "variant", void 0);
41
+ DBadge = __decorate([
42
+ Component({
43
+ selector: 'd-badge',
44
+ standalone: true,
45
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
46
+ changeDetection: ChangeDetectionStrategy.OnPush,
47
+ template: `<diwa-badge
48
+ [label]="label"
49
+ [size]="size"
50
+ [variant]="variant"
51
+ ></diwa-badge>`,
52
+ inputs: ['label', 'size', 'variant'],
53
+ })
54
+ ], DBadge);
55
+ export { DBadge };
56
+ // ─── DButton ─────────────────────────────────────────────────────────────────
57
+ let DButton = class DButton {
58
+ theme;
59
+ variant;
60
+ size;
61
+ type;
62
+ disabled;
63
+ loading;
64
+ href;
65
+ target;
66
+ name;
67
+ value;
68
+ label;
69
+ hideLabel;
70
+ };
71
+ __decorate([
72
+ Input()
73
+ ], DButton.prototype, "theme", void 0);
74
+ __decorate([
75
+ Input()
76
+ ], DButton.prototype, "variant", void 0);
77
+ __decorate([
78
+ Input()
79
+ ], DButton.prototype, "size", void 0);
80
+ __decorate([
81
+ Input()
82
+ ], DButton.prototype, "type", void 0);
83
+ __decorate([
84
+ Input()
85
+ ], DButton.prototype, "disabled", void 0);
86
+ __decorate([
87
+ Input()
88
+ ], DButton.prototype, "loading", void 0);
89
+ __decorate([
90
+ Input()
91
+ ], DButton.prototype, "href", void 0);
92
+ __decorate([
93
+ Input()
94
+ ], DButton.prototype, "target", void 0);
95
+ __decorate([
96
+ Input()
97
+ ], DButton.prototype, "name", void 0);
98
+ __decorate([
99
+ Input()
100
+ ], DButton.prototype, "value", void 0);
101
+ __decorate([
102
+ Input()
103
+ ], DButton.prototype, "label", void 0);
104
+ __decorate([
105
+ Input()
106
+ ], DButton.prototype, "hideLabel", void 0);
107
+ DButton = __decorate([
108
+ Component({
109
+ selector: 'd-button',
110
+ standalone: true,
111
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
112
+ changeDetection: ChangeDetectionStrategy.OnPush,
113
+ template: `<diwa-button
114
+ [theme]="theme"
115
+ [variant]="variant"
116
+ [size]="size"
117
+ [type]="type"
118
+ [disabled]="disabled"
119
+ [loading]="loading"
120
+ [href]="href"
121
+ [target]="target"
122
+ [name]="name"
123
+ [value]="value"
124
+ [label]="label"
125
+ [hideLabel]="hideLabel"
126
+ ><ng-content></ng-content></diwa-button>`,
127
+ inputs: ['theme', 'variant', 'size', 'type', 'disabled', 'loading', 'href', 'target', 'name', 'value', 'label', 'hideLabel'],
128
+ })
129
+ ], DButton);
130
+ export { DButton };
131
+ // ─── DInput ──────────────────────────────────────────────────────────────────
132
+ let DInput = class DInput {
133
+ type;
134
+ label;
135
+ placeholder;
136
+ value;
137
+ required;
138
+ disabled;
139
+ readonly;
140
+ state;
141
+ hint;
142
+ autocomplete;
143
+ name;
144
+ inputId;
145
+ diwaInput = new EventEmitter();
146
+ diwaChange = new EventEmitter();
147
+ diwaFocus = new EventEmitter();
148
+ diwaBlur = new EventEmitter();
149
+ };
150
+ __decorate([
151
+ Input()
152
+ ], DInput.prototype, "type", void 0);
153
+ __decorate([
154
+ Input()
155
+ ], DInput.prototype, "label", void 0);
156
+ __decorate([
157
+ Input()
158
+ ], DInput.prototype, "placeholder", void 0);
159
+ __decorate([
160
+ Input()
161
+ ], DInput.prototype, "value", void 0);
162
+ __decorate([
163
+ Input()
164
+ ], DInput.prototype, "required", void 0);
165
+ __decorate([
166
+ Input()
167
+ ], DInput.prototype, "disabled", void 0);
168
+ __decorate([
169
+ Input()
170
+ ], DInput.prototype, "readonly", void 0);
171
+ __decorate([
172
+ Input()
173
+ ], DInput.prototype, "state", void 0);
174
+ __decorate([
175
+ Input()
176
+ ], DInput.prototype, "hint", void 0);
177
+ __decorate([
178
+ Input()
179
+ ], DInput.prototype, "autocomplete", void 0);
180
+ __decorate([
181
+ Input()
182
+ ], DInput.prototype, "name", void 0);
183
+ __decorate([
184
+ Input()
185
+ ], DInput.prototype, "inputId", void 0);
186
+ __decorate([
187
+ Output()
188
+ ], DInput.prototype, "diwaInput", void 0);
189
+ __decorate([
190
+ Output()
191
+ ], DInput.prototype, "diwaChange", void 0);
192
+ __decorate([
193
+ Output()
194
+ ], DInput.prototype, "diwaFocus", void 0);
195
+ __decorate([
196
+ Output()
197
+ ], DInput.prototype, "diwaBlur", void 0);
198
+ DInput = __decorate([
199
+ Component({
200
+ selector: 'd-input',
201
+ standalone: true,
202
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
203
+ changeDetection: ChangeDetectionStrategy.OnPush,
204
+ template: `<diwa-input
205
+ [type]="type"
206
+ [label]="label"
207
+ [placeholder]="placeholder"
208
+ [value]="value"
209
+ [required]="required"
210
+ [disabled]="disabled"
211
+ [readonly]="readonly"
212
+ [state]="state"
213
+ [hint]="hint"
214
+ [autocomplete]="autocomplete"
215
+ [name]="name"
216
+ [inputId]="inputId"
217
+ (diwaInput)="diwaInput.emit($event)"
218
+ (diwaChange)="diwaChange.emit($event)"
219
+ (diwaFocus)="diwaFocus.emit($event)"
220
+ (diwaBlur)="diwaBlur.emit($event)"
221
+ ></diwa-input>`,
222
+ inputs: ['type', 'label', 'placeholder', 'value', 'required', 'disabled', 'readonly', 'state', 'hint', 'autocomplete', 'name', 'inputId'],
223
+ })
224
+ ], DInput);
225
+ export { DInput };
226
+ // ─── DSpinner ────────────────────────────────────────────────────────────────
227
+ let DSpinner = class DSpinner {
228
+ label;
229
+ size;
230
+ };
231
+ __decorate([
232
+ Input()
233
+ ], DSpinner.prototype, "label", void 0);
234
+ __decorate([
235
+ Input()
236
+ ], DSpinner.prototype, "size", void 0);
237
+ DSpinner = __decorate([
238
+ Component({
239
+ selector: 'd-spinner',
240
+ standalone: true,
241
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
242
+ changeDetection: ChangeDetectionStrategy.OnPush,
243
+ template: `<diwa-spinner
244
+ [label]="label"
245
+ [size]="size"
246
+ ></diwa-spinner>`,
247
+ inputs: ['label', 'size'],
248
+ })
249
+ ], DSpinner);
250
+ export { DSpinner };
@@ -0,0 +1,3 @@
1
+ import * as d from './proxies';
2
+ export declare const DIRECTIVES: (typeof d.DiwaAccordion | typeof d.DiwaBadge | typeof d.DiwaButton | typeof d.DiwaButtonPure | typeof d.DiwaCheckbox | typeof d.DiwaDivider | typeof d.DiwaFlyout | typeof d.DiwaIcon | typeof d.DiwaInlineNotification | typeof d.DiwaInput | typeof d.DiwaInputDate | typeof d.DiwaInputEmail | typeof d.DiwaInputMonth | typeof d.DiwaInputNumber | typeof d.DiwaInputPassword | typeof d.DiwaInputSearch | typeof d.DiwaInputTel | typeof d.DiwaInputText | typeof d.DiwaInputTime | typeof d.DiwaInputUrl | typeof d.DiwaInputWeek | typeof d.DiwaLink | typeof d.DiwaLinkPure | typeof d.DiwaModal | typeof d.DiwaMultiSelect | typeof d.DiwaMultiSelectOption | typeof d.DiwaPagination | typeof d.DiwaPinCode | typeof d.DiwaPopover | typeof d.DiwaRadioGroup | typeof d.DiwaRadioGroupItem | typeof d.DiwaScroller | typeof d.DiwaSegmentedControl | typeof d.DiwaSegmentedControlItem | typeof d.DiwaSelect | typeof d.DiwaSelectOption | typeof d.DiwaSpinner | typeof d.DiwaStepperHorizontal | typeof d.DiwaStepperHorizontalItem | typeof d.DiwaSwitch | typeof d.DiwaTable | typeof d.DiwaTableBody | typeof d.DiwaTableCell | typeof d.DiwaTableHead | typeof d.DiwaTableHeadCell | typeof d.DiwaTableRow | typeof d.DiwaTabs | typeof d.DiwaTabsBar | typeof d.DiwaTabsItem | typeof d.DiwaTag | typeof d.DiwaTagDismissible | typeof d.DiwaText | typeof d.DiwaTextList | typeof d.DiwaTextListItem | typeof d.DiwaTextarea | typeof d.DiwaToast | typeof d.DiwaToastItem)[];
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/directives/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAC;AAE/B,eAAO,MAAM,UAAU,i6CA0DtB,CAAC"}
@@ -0,0 +1,60 @@
1
+ import * as d from './proxies';
2
+ export const DIRECTIVES = [
3
+ d.DiwaAccordion,
4
+ d.DiwaBadge,
5
+ d.DiwaButton,
6
+ d.DiwaButtonPure,
7
+ d.DiwaCheckbox,
8
+ d.DiwaDivider,
9
+ d.DiwaFlyout,
10
+ d.DiwaIcon,
11
+ d.DiwaInlineNotification,
12
+ d.DiwaInput,
13
+ d.DiwaInputDate,
14
+ d.DiwaInputEmail,
15
+ d.DiwaInputMonth,
16
+ d.DiwaInputNumber,
17
+ d.DiwaInputPassword,
18
+ d.DiwaInputSearch,
19
+ d.DiwaInputTel,
20
+ d.DiwaInputText,
21
+ d.DiwaInputTime,
22
+ d.DiwaInputUrl,
23
+ d.DiwaInputWeek,
24
+ d.DiwaLink,
25
+ d.DiwaLinkPure,
26
+ d.DiwaModal,
27
+ d.DiwaMultiSelect,
28
+ d.DiwaMultiSelectOption,
29
+ d.DiwaPagination,
30
+ d.DiwaPinCode,
31
+ d.DiwaPopover,
32
+ d.DiwaRadioGroup,
33
+ d.DiwaRadioGroupItem,
34
+ d.DiwaScroller,
35
+ d.DiwaSegmentedControl,
36
+ d.DiwaSegmentedControlItem,
37
+ d.DiwaSelect,
38
+ d.DiwaSelectOption,
39
+ d.DiwaSpinner,
40
+ d.DiwaStepperHorizontal,
41
+ d.DiwaStepperHorizontalItem,
42
+ d.DiwaSwitch,
43
+ d.DiwaTable,
44
+ d.DiwaTableBody,
45
+ d.DiwaTableCell,
46
+ d.DiwaTableHead,
47
+ d.DiwaTableHeadCell,
48
+ d.DiwaTableRow,
49
+ d.DiwaTabs,
50
+ d.DiwaTabsBar,
51
+ d.DiwaTabsItem,
52
+ d.DiwaTag,
53
+ d.DiwaTagDismissible,
54
+ d.DiwaText,
55
+ d.DiwaTextList,
56
+ d.DiwaTextListItem,
57
+ d.DiwaTextarea,
58
+ d.DiwaToast,
59
+ d.DiwaToastItem
60
+ ];