@nova-design-system/nova-angular 3.0.0-beta.16

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/LICENSE.MD ADDED
@@ -0,0 +1,151 @@
1
+ # End-User License Agreement: Nova Design System
2
+
3
+ This End-User License Agreement ("Agreement") is entered into between:
4
+
5
+ 1. **Elia Group NV**
6
+ Located at Keizerslaan 20, 1000 Brussel, registered at the Crossroads Bank for Enterprises in Belgium under number 0476.388.378 (hereafter: “Licensor”, “Elia”, “We”, “Our” or “Us”), and
7
+ 2. **Subsidiaries, Partners, or Affiliates**
8
+ Collectively referred to as the "Licensee".
9
+
10
+ **Licensor** and **Licensee** may both be referred to as a “Party” and jointly as the “Parties”.
11
+
12
+ This Agreement can only be entered into by a party which qualifies as the “Licensee”. Any attempt by Third Parties to claim rights or licenses under this Agreement shall be considered null and void, as the Agreement is strictly limited to the Licensee, as defined herein.
13
+
14
+ ## Article 1: Definitions
15
+
16
+ ### 1.1 Affiliate
17
+
18
+ A business entity related to Elia through ownership, control, or shared interests, as per Article 1:15 of the Belgian Code of Companies and Associations.
19
+
20
+ ### 1.2 Effective Date
21
+
22
+ The date from which the Licensee accesses and downloads the Works.
23
+
24
+ ### 1.3 Elia Projects
25
+
26
+ Initiatives, projects, or tasks directly relating to Elia’s business operations or those of Subsidiaries, Affiliates, or Partners, including development, execution, or management of services or products.
27
+
28
+ ### 1.4 Intellectual Property Rights
29
+
30
+ Any intellectual property rights, including copyrights, trademarks, patents, and related rights worldwide.
31
+
32
+ ### 1.5 License
33
+
34
+ As described in Article 2.1.
35
+
36
+ ### 1.6 Partner
37
+
38
+ A business partner, subcontractor, or service provider of Elia engaged in Elia Projects.
39
+
40
+ ### 1.7 Subsidiary
41
+
42
+ An entity directly or indirectly controlled by the Licensee, per Article 1:14 of the Belgian Code of Companies and Associations.
43
+
44
+ ### 1.8 Territory
45
+
46
+ The entire world.
47
+
48
+ ### 1.9 Third Party
49
+
50
+ A person or entity not defined as a Party, Subsidiary, Affiliate, or Partner of the Licensor.
51
+
52
+ ### 1.10 Works
53
+
54
+ All elements and visuals in the UI library of the "Nova Design System", including source code and associated materials.
55
+
56
+ ## Article 2: Grant of License
57
+
58
+ ### 2.1 License Grant
59
+
60
+ The **Licensor** grants the **Licensee** a non-exclusive, revocable, sublicensable, and non-transferable right to use the Works worldwide solely for Elia Projects.
61
+
62
+ ### 2.2 Usage Rights
63
+
64
+ The usage rights include reproduction, translation, and public communication, provided the Licensee complies with the Agreement.
65
+
66
+ ### 2.3 Reporting Infringements
67
+
68
+ Licensee must inform Licensor of any Intellectual Property infringement.
69
+
70
+ ## Article 3: Ownership of Intellectual Property Rights
71
+
72
+ ### 3.1 Ownership Retained
73
+
74
+ The **Licensor** retains all ownership rights to the Intellectual Property related to the Works.
75
+
76
+ ### 3.2 Updates
77
+
78
+ Updates may be implemented by the Licensor without prior notice. Licensee may choose whether to implement updates.
79
+
80
+ ## Article 4: Permitted Use and Restrictions
81
+
82
+ ### 4.1 Permitted Use
83
+
84
+ - The Works may only be used by employees or contractors of the Licensee in Elia Projects.
85
+ - Installation is restricted to devices owned or controlled by the Licensee.
86
+
87
+ ### 4.2 Restrictions
88
+
89
+ The Works must not be:
90
+
91
+ - Shared, sublicensed, or otherwise transferred to Third Parties.
92
+ - Reverse-engineered, decompiled, or disassembled.
93
+
94
+ ## Article 5: Liability and Disclaimer of Warranties
95
+
96
+ ### 5.1 Disclaimer
97
+
98
+ The Works are provided "as is", without warranty of any kind. The **Licensor** disclaims all implied warranties.
99
+
100
+ ### 5.2 Limitation of Liability
101
+
102
+ The **Licensor** limits its liability to €1,000. The Licensee assumes all risks related to the use of the Works.
103
+
104
+ ## Article 6: Term and Termination
105
+
106
+ ### 6.1 Initial Term
107
+
108
+ The Agreement is effective indefinitely from the Effective Date unless terminated.
109
+
110
+ ### 6.2 Termination by Notice
111
+
112
+ Either Party may terminate with one month's written notice.
113
+
114
+ ### 6.3 Automatic Termination
115
+
116
+ Termination occurs automatically upon:
117
+
118
+ - Changes in control, ownership, or project participation.
119
+ - Breach of material terms by the Licensee, following written notice.
120
+
121
+ ### 6.4 Post-Termination Obligations
122
+
123
+ Upon termination, the **Licensee** must cease using and destroy all copies of the Works.
124
+
125
+ ## Article 7: Miscellaneous
126
+
127
+ ### 7.1 Waiver
128
+
129
+ Waivers must be in writing and do not constitute ongoing waivers of similar rights.
130
+
131
+ ### 7.2 Costs
132
+
133
+ Each Party bears its own implementation costs.
134
+
135
+ ### 7.3 Assignment
136
+
137
+ The Agreement may not be assigned without prior consent from the **Licensor**.
138
+
139
+ ### 7.4 Severability
140
+
141
+ Invalid provisions will not affect the remainder of the Agreement.
142
+
143
+ ## Article 8: Governing Law and Jurisdiction
144
+
145
+ ### 8.1 Governing Law
146
+
147
+ This Agreement is governed by Belgian law.
148
+
149
+ ### 8.2 Jurisdiction
150
+
151
+ The Dutch-speaking courts of Brussels have exclusive jurisdiction for disputes.
package/README.md ADDED
@@ -0,0 +1,253 @@
1
+ # Nova Components Angular
2
+
3
+ **Nova Components Angular** allows you to integrate Nova's native UI elements into your Angular applications. It provides flexibility in usage with both standalone components and module-based setups. This guide will walk you through the necessary steps for setting up and using Nova Components in your Angular project.
4
+
5
+ ## Installation
6
+
7
+ First, install the necessary Nova packages using your package manager:
8
+
9
+ ```bash
10
+ npm install @nova-design-system/nova-webcomponents @nova-design-system/nova-base @nova-design-system/nova-angular
11
+ ```
12
+
13
+ or
14
+
15
+ ```bash
16
+ yarn add @nova-design-system/nova-webcomponents @nova-design-system/nova-base @nova-design-system/nova-angular
17
+ ```
18
+
19
+ ## Setup
20
+
21
+ ### CSS Integration
22
+
23
+ To include the Nova UI styles in your Angular project, add the Nova CSS file to the `styles` array in your `angular.json` configuration file:
24
+
25
+ ```json
26
+ {
27
+ "projects": {
28
+ "your-project-name": {
29
+ "architect": {
30
+ "build": {
31
+ "options": {
32
+ "styles": [
33
+ "src/styles.css",
34
+ "@nova-design-system/nova-base/dist/css/nova-utils.css",
35
+ "@nova-design-system/nova-base/dist/css/spark.css", // or ocean.css
36
+ ],
37
+ "scripts": []
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ ```
45
+
46
+ This setup ensures that the Nova styles are available throughout your application.
47
+
48
+ ## Nova Font Pro Integration
49
+
50
+ To use Nova fonts in your Angular application, you'll need to contact the Nova team via Teams, email, or check the [Nova Wiki](https://dev.azure.com/elia-digitization/Nova/_wiki/wikis/Nova.wiki/30245/Nova-Font-Pro) to obtain the full CDN URL. Once you have the URL, you can integrate it using any of these methods:
51
+
52
+ ### Option 1: Angular.json Configuration (Recommended)
53
+
54
+ Add the Nova Font Pro CDN URL to the styles array in your `angular.json` configuration:
55
+
56
+ ```json
57
+ "styles": [
58
+ "https://novaassets.azureedge.net/fonts/nova-fonts-pro.css"
59
+ ]
60
+ ```
61
+
62
+ ### Option 2: Import in Styles.css
63
+
64
+ ```css
65
+ @import url('https://novaassets.azureedge.net/fonts/nova-fonts-pro.css');
66
+ ```
67
+
68
+ ### Option 3: HTML Integration
69
+
70
+ ```html
71
+ <!DOCTYPE html>
72
+ <html>
73
+ <head>
74
+ <link rel="stylesheet" href="https://novaassets.azureedge.net/fonts/nova-fonts-pro.css">
75
+ </head>
76
+ <body>
77
+ <app-root></app-root>
78
+ </body>
79
+ </html>
80
+ ```
81
+
82
+ The `nova-fonts-pro.css` file includes both font definitions and the `font-family` rule for the `body`, automatically applying the fonts across your Angular application.
83
+
84
+ ## Standalone Component Setup
85
+
86
+ If you're using Angular's standalone components, follow these steps:
87
+
88
+ ### 1. Provide Nova Components
89
+
90
+ Add the `provideNovaComponents` function to your `app.config.ts` file to make Nova Web Components available across your application:
91
+
92
+ ```typescript
93
+ import { provideNovaComponents } from '@nova-design-system/nova-angular';
94
+
95
+ export const appConfig: ApplicationConfig = {
96
+ providers: [provideRouter(routes), provideNovaComponents()],
97
+ };
98
+ ```
99
+
100
+ ### 2. Import Nova Components Module in Your Standalone Components
101
+
102
+ For any standalone component where you want to use Nova Components, add the `NovaComponentsModule` to the `imports` array in the component decorator:
103
+
104
+ ```typescript
105
+ import { NovaComponentsModule } from '@nova-design-system/nova-angular';
106
+
107
+ @Component({
108
+ selector: 'app-root',
109
+ standalone: true,
110
+ imports: [RouterOutlet, NovaComponentsModule],
111
+ templateUrl: './app.component.html',
112
+ styleUrls: ['./app.component.css']
113
+ })
114
+ export class AppComponent {
115
+ // Your component logic here
116
+ }
117
+ ```
118
+
119
+ ## Module-Based Setup
120
+
121
+ If you're using Angular modules, the setup is even simpler:
122
+
123
+ ### 1. Import Nova Components Module
124
+
125
+ In the module where you want to use Nova components, add the `NovaComponentsModule` to the `imports` array. This automatically adds the required providers:
126
+
127
+ ```typescript
128
+ import { NovaComponentsModule } from '@nova-design-system/nova-angular';
129
+
130
+ @NgModule({
131
+ declarations: [AppComponent],
132
+ imports: [
133
+ BrowserModule,
134
+ AppRoutingModule,
135
+ NovaComponentsModule // Add NovaComponentsModule here
136
+ ],
137
+ providers: [],
138
+ bootstrap: [AppComponent]
139
+ })
140
+ export class AppModule {}
141
+ ```
142
+
143
+ By including `NovaComponentsModule` in your imports, Nova's web components become available throughout the module.
144
+
145
+ ## Usage Example
146
+
147
+ Once set up, you can use Nova components in your Angular templates just like any other Angular component. Here’s an example of using an `nv-button`:
148
+
149
+ ```html
150
+ <nv-button danger (click)="incrementCount()">Count is {{ count }}</nv-button>
151
+ ```
152
+
153
+ In your component class, you can manage the button's behavior:
154
+
155
+ ```typescript
156
+ export class AppComponent {
157
+ count = 0;
158
+
159
+ incrementCount() {
160
+ this.count++;
161
+ }
162
+ }
163
+ ```
164
+
165
+ ## Handling Angular Forms with Nova Components
166
+
167
+ Nova Components Angular also supports seamless integration with Angular's reactive forms and template-driven forms through the `NovaComponentsValueAccessorModule`. This module provides value accessor directives that allow Nova components to work effortlessly with Angular forms.
168
+
169
+ ### Standalone Component Setup
170
+
171
+ When working with standalone components, you can easily integrate Nova components with Angular forms by importing the `NovaComponentsValueAccessorModule`. Here’s how you can set it up:
172
+
173
+ ```typescript
174
+ import { Component } from '@angular/core';
175
+ import { RouterOutlet } from '@angular/router';
176
+ import { FormsModule } from '@angular/forms';
177
+ import {
178
+ NovaComponentsModule,
179
+ NovaComponentsValueAccessorModule,
180
+ } from '@nova-design-system/nova-angular';
181
+
182
+ @Component({
183
+ selector: 'app-root',
184
+ standalone: true,
185
+ imports: [
186
+ RouterOutlet,
187
+ NovaComponentsModule,
188
+ FormsModule,
189
+ NovaComponentsValueAccessorModule, // Import the Value Accessor Module here
190
+ ],
191
+ templateUrl: './app.component.html',
192
+ styleUrls: ['./app.component.css'],
193
+ })
194
+ export class AppComponent {}
195
+ ```
196
+
197
+ This setup allows Nova components to be used seamlessly with Angular forms in your standalone components.
198
+
199
+ ### Module-Based Setup
200
+
201
+ If you're using Angular modules, you can also integrate the value accessors by importing the `NovaComponentsValueAccessorModule` in your module:
202
+
203
+ ```typescript
204
+ import { NgModule } from '@angular/core';
205
+ import { BrowserModule } from '@angular/platform-browser';
206
+ import { FormsModule } from '@angular/forms';
207
+ import {
208
+ NovaComponentsModule,
209
+ NovaComponentsValueAccessorModule,
210
+ } from '@nova-design-system/nova-angular';
211
+
212
+ @NgModule({
213
+ declarations: [AppComponent],
214
+ imports: [
215
+ BrowserModule,
216
+ FormsModule,
217
+ NovaComponentsModule, // Add NovaComponentsModule here
218
+ NovaComponentsValueAccessorModule, // Import the Value Accessor Module here
219
+ ],
220
+ providers: [],
221
+ bootstrap: [AppComponent]
222
+ })
223
+ export class AppModule {}
224
+ ```
225
+
226
+ This setup ensures that Nova components are fully compatible with Angular forms throughout your module.
227
+
228
+ ## Usage Example with Angular Forms
229
+
230
+ With the value accessors set up, you can now use Nova components within Angular forms. Here's an example:
231
+
232
+ ```html
233
+ <form>
234
+ <nv-fieldtext [(ngModel)]="inputValue" name="input"></nv-fieldtext>
235
+ <button type="submit">Submit</button>
236
+ </form>
237
+ ```
238
+
239
+ In your component:
240
+
241
+ ```typescript
242
+ export class AppComponent {
243
+ inputValue = 'hello';
244
+ }
245
+ ```
246
+
247
+ This setup allows you to use `nv-fieldtext` just like any other Angular form control, complete with two-way binding and validation.
248
+
249
+ ## Conclusion
250
+
251
+ Nova Components Angular provides an easy and flexible way to incorporate Nova's UI components into your Angular projects, whether you prefer using standalone components or a module-based approach. Follow the setup steps corresponding to your preferred method, and you’ll be ready to start building with Nova components in your Angular applications.
252
+
253
+ For more detailed documentation and examples, refer to the official Nova documentation.
@@ -0,0 +1,24 @@
1
+ # NovaComponents
2
+
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.3.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Run `ng generate component component-name --project nova-components` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project nova-components`.
8
+ > Note: Don't forget to add `--project nova-components` or else it will be added to the default project in your `angular.json` file.
9
+
10
+ ## Build
11
+
12
+ Run `ng build nova-components` to build the project. The build artifacts will be stored in the `dist/` directory.
13
+
14
+ ## Publishing
15
+
16
+ After building your library with `ng build nova-components`, go to the dist folder `cd dist/nova-components` and run `npm publish`.
17
+
18
+ ## Running unit tests
19
+
20
+ Run `ng test nova-components` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
+
22
+ ## Further help
23
+
24
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
@@ -0,0 +1,45 @@
1
+ import { APP_INITIALIZER, NgModule } from '@angular/core';
2
+ import { defineCustomElements } from '@nova-design-system/nova-webcomponents/loader';
3
+ import { DIRECTIVES } from './stencil-generated';
4
+ import { VALUE_ACCESSORS } from './stencil-generated/component-value-accessors';
5
+ import * as i0 from "@angular/core";
6
+ import * as i1 from "./stencil-generated/components";
7
+ import * as i2 from "./stencil-generated/component-value-accessors";
8
+ /**
9
+ * Initialize the Nova Components
10
+ *
11
+ * @returns {Provider} - The provider to be used for nova components
12
+ */
13
+ export function provideNovaComponents() {
14
+ return {
15
+ provide: APP_INITIALIZER,
16
+ useFactory: () => defineCustomElements,
17
+ multi: true,
18
+ };
19
+ }
20
+ export class NovaComponentsModule {
21
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: NovaComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
22
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.9", ngImport: i0, type: NovaComponentsModule, declarations: [i1.NvAlert, i1.NvAvatar, i1.NvBadge, i1.NvBase, i1.NvButton, i1.NvCol, i1.NvFieldcheckbox, i1.NvFieldnumber, i1.NvFieldpassword, i1.NvFieldradio, i1.NvFieldselect, i1.NvFieldtext, i1.NvFieldtextarea, i1.NvFieldtoggle, i1.NvIcon, i1.NvIconbutton, i1.NvLoader, i1.NvMenu, i1.NvMenuitem, i1.NvPopover, i1.NvRow, i1.NvStack, i1.NvTooltip], exports: [i1.NvAlert, i1.NvAvatar, i1.NvBadge, i1.NvBase, i1.NvButton, i1.NvCol, i1.NvFieldcheckbox, i1.NvFieldnumber, i1.NvFieldpassword, i1.NvFieldradio, i1.NvFieldselect, i1.NvFieldtext, i1.NvFieldtextarea, i1.NvFieldtoggle, i1.NvIcon, i1.NvIconbutton, i1.NvLoader, i1.NvMenu, i1.NvMenuitem, i1.NvPopover, i1.NvRow, i1.NvStack, i1.NvTooltip] }); }
23
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: NovaComponentsModule, providers: [provideNovaComponents()] }); }
24
+ }
25
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: NovaComponentsModule, decorators: [{
26
+ type: NgModule,
27
+ args: [{
28
+ declarations: [...DIRECTIVES],
29
+ exports: [...DIRECTIVES],
30
+ providers: [provideNovaComponents()],
31
+ }]
32
+ }] });
33
+ export class NovaComponentsValueAccessorModule {
34
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: NovaComponentsValueAccessorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
35
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.9", ngImport: i0, type: NovaComponentsValueAccessorModule, declarations: [i2.NvAlertValueAccessor, i2.NvFieldcheckboxValueAccessor, i2.NvFieldnumberValueAccessor, i2.NvFieldpasswordValueAccessor, i2.NvFieldradioValueAccessor, i2.NvFieldselectValueAccessor, i2.NvFieldtextValueAccessor, i2.NvFieldtextareaValueAccessor, i2.NvFieldtoggleValueAccessor, i2.NvPopoverValueAccessor], exports: [i2.NvAlertValueAccessor, i2.NvFieldcheckboxValueAccessor, i2.NvFieldnumberValueAccessor, i2.NvFieldpasswordValueAccessor, i2.NvFieldradioValueAccessor, i2.NvFieldselectValueAccessor, i2.NvFieldtextValueAccessor, i2.NvFieldtextareaValueAccessor, i2.NvFieldtoggleValueAccessor, i2.NvPopoverValueAccessor] }); }
36
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: NovaComponentsValueAccessorModule }); }
37
+ }
38
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: NovaComponentsValueAccessorModule, decorators: [{
39
+ type: NgModule,
40
+ args: [{
41
+ declarations: [...VALUE_ACCESSORS],
42
+ exports: [...VALUE_ACCESSORS],
43
+ }]
44
+ }] });
45
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm92YS1jb21wb25lbnRzLm1vZHVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL25vdmEtY29tcG9uZW50cy9zcmMvbGliL25vdmEtY29tcG9uZW50cy5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYX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LFxuICBleHBvcnRzOiBbLi4uVkFMVUVfQUNDRVNTT1JTXSxcbn0pXG5leHBvcnQgY2xhc3MgTm92YUNvbXBvbmVudHNWYWx1ZUFjY2Vzc29yTW9kdWxlIHt9XG4iXX0=
@@ -0,0 +1,59 @@
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;
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