@haiilo/catalyst-angular 0.0.7

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/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## 0.0.7 (2022-04-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * lerna integration ([ebab9a3](https://github.com/haiilo/catalyst/commit/ebab9a37748e11a33fd552502ed95bfec949c409))
12
+ * umd warning ([e678c5f](https://github.com/haiilo/catalyst/commit/e678c5fa6e8d89105323de0fcb90b9cfdba6222c))
13
+
14
+
15
+ ### Features
16
+
17
+ * **core:** add alert ([8cad923](https://github.com/haiilo/catalyst/commit/8cad92339ac74b142ca6a4a0ec143982c659b970))
18
+ * **core:** add badge ([d250eb8](https://github.com/haiilo/catalyst/commit/d250eb808f77c34a430b5406edba7c11e12cf4bd))
19
+ * **core:** add skeleton component ([561f7a6](https://github.com/haiilo/catalyst/commit/561f7a627770aaef6daadca0acc5c0c858261320))
20
+ * **core:** added scrollable component ([347886b](https://github.com/haiilo/catalyst/commit/347886b2782801e445da7afc2f768aa531862084))
21
+ * **core:** changes for coyo app integration ([7304886](https://github.com/haiilo/catalyst/commit/7304886e5a2a781adcb0db2b1a63ddc58eaa6ef8))
22
+ * **core:** changes for coyo app integration ([2b6cc05](https://github.com/haiilo/catalyst/commit/2b6cc057bbd813f328ff36374a514bc56d6a15bd))
23
+ * **core:** changes for coyo app integration ([101297d](https://github.com/haiilo/catalyst/commit/101297dde26a5e8ecd007cd535667d2d3e71441a))
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018
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,24 @@
1
+ # Catalyst
2
+
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Run `ng generate component component-name --project catalyst` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project catalyst`.
8
+ > Note: Don't forget to add `--project catalyst` or else it will be added to the default project in your `angular.json` file.
9
+
10
+ ## Build
11
+
12
+ Run `ng build catalyst` 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 catalyst`, go to the dist folder `cd dist/catalyst` and run `npm publish`.
17
+
18
+ ## Running unit tests
19
+
20
+ Run `ng test catalyst` 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.
package/karma.conf.js ADDED
@@ -0,0 +1,44 @@
1
+ // Karma configuration file, see link for more information
2
+ // https://karma-runner.github.io/1.0/config/configuration-file.html
3
+
4
+ module.exports = function (config) {
5
+ config.set({
6
+ basePath: '',
7
+ frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
+ plugins: [
9
+ require('karma-jasmine'),
10
+ require('karma-chrome-launcher'),
11
+ require('karma-jasmine-html-reporter'),
12
+ require('karma-coverage'),
13
+ require('@angular-devkit/build-angular/plugins/karma')
14
+ ],
15
+ client: {
16
+ jasmine: {
17
+ // you can add configuration options for Jasmine here
18
+ // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19
+ // for example, you can disable the random execution with `random: false`
20
+ // or set a specific seed with `seed: 4321`
21
+ },
22
+ clearContext: false // leave Jasmine Spec Runner output visible in browser
23
+ },
24
+ jasmineHtmlReporter: {
25
+ suppressAll: true // removes the duplicated traces
26
+ },
27
+ coverageReporter: {
28
+ dir: require('path').join(__dirname, '../../coverage/catalyst'),
29
+ subdir: '.',
30
+ reporters: [
31
+ { type: 'html' },
32
+ { type: 'text-summary' }
33
+ ]
34
+ },
35
+ reporters: ['progress', 'kjhtml'],
36
+ port: 9876,
37
+ colors: true,
38
+ logLevel: config.LOG_INFO,
39
+ autoWatch: true,
40
+ browsers: ['Chrome'],
41
+ singleRun: false,
42
+ restartOnFileChange: true
43
+ });
44
+ };
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/catalyst",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ },
7
+ "allowedNonPeerDependencies": [
8
+ "@haiilo/catalyst"
9
+ ]
10
+ }
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@haiilo/catalyst-angular",
3
+ "version": "0.0.7",
4
+ "description": "Angular wrapper for Catalyst Design System",
5
+ "license": "MIT",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "dependencies": {
10
+ "@haiilo/catalyst": "^0.2.3",
11
+ "tslib": "^2.3.0"
12
+ },
13
+ "peerDependencies": {
14
+ "@angular/core": ">=12.0.0",
15
+ "rxjs": ">=6.6.0"
16
+ },
17
+ "gitHead": "3bd083786a1df0a2de5b5d4a5eb557b44fb97800"
18
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './public-api';
@@ -0,0 +1,29 @@
1
+ import { ModuleWithProviders, NgModule } from '@angular/core';
2
+ import { defineCustomElements } from '@haiilo/catalyst/loader';
3
+ import * as Components from './directives/proxies';
4
+
5
+ const CatComponents = [
6
+ Components.CatButton,
7
+ Components.CatIcon,
8
+ Components.CatSpinner,
9
+ Components.CatScrollable,
10
+ Components.CatAlert,
11
+ Components.CatBadge,
12
+ Components.CatSkeleton
13
+ ];
14
+
15
+ @NgModule({
16
+ imports: [],
17
+ declarations: [...CatComponents],
18
+ exports: [...CatComponents],
19
+ providers: []
20
+ })
21
+ export class CatalystModule {
22
+
23
+ static forRoot(): ModuleWithProviders<CatalystModule> {
24
+ defineCustomElements();
25
+ return {
26
+ ngModule: CatalystModule
27
+ };
28
+ }
29
+ }
@@ -0,0 +1,63 @@
1
+ /* eslint-disable */
2
+ /* tslint:disable */
3
+ import { fromEvent } from 'rxjs';
4
+
5
+ export const proxyInputs = (Cmp: any, inputs: string[]) => {
6
+ const Prototype = Cmp.prototype;
7
+ inputs.forEach(item => {
8
+ Object.defineProperty(Prototype, item, {
9
+ get() {
10
+ return this.el[item];
11
+ },
12
+ set(val: any) {
13
+ this.z.runOutsideAngular(() => (this.el[item] = val));
14
+ }
15
+ });
16
+ });
17
+ };
18
+
19
+ export const proxyMethods = (Cmp: any, methods: string[]) => {
20
+ const Prototype = Cmp.prototype;
21
+ methods.forEach(methodName => {
22
+ Prototype[methodName] = function () {
23
+ const args = arguments;
24
+ return this.z.runOutsideAngular(() =>
25
+ this.el[methodName].apply(this.el, args)
26
+ );
27
+ };
28
+ });
29
+ };
30
+
31
+ export const proxyOutputs = (instance: any, el: any, events: string[]) => {
32
+ events.forEach(eventName => instance[eventName] = fromEvent(el, eventName));
33
+ }
34
+
35
+ export const defineCustomElement = (tagName: string, customElement: any) => {
36
+ if (
37
+ customElement !== undefined &&
38
+ typeof customElements !== 'undefined' &&
39
+ !customElements.get(tagName)
40
+ ) {
41
+ customElements.define(tagName, customElement);
42
+ }
43
+ }
44
+
45
+ // tslint:disable-next-line: only-arrow-functions
46
+ export function ProxyCmp(opts: { defineCustomElementFn?: () => void, inputs?: any; methods?: any }) {
47
+ const decorator = function (cls: any) {
48
+ const { defineCustomElementFn, inputs, methods } = opts;
49
+
50
+ if (defineCustomElementFn !== undefined) {
51
+ defineCustomElementFn();
52
+ }
53
+
54
+ if (inputs) {
55
+ proxyInputs(cls, inputs);
56
+ }
57
+ if (methods) {
58
+ proxyMethods(cls, methods);
59
+ }
60
+ return cls;
61
+ };
62
+ return decorator;
63
+ }
@@ -0,0 +1,222 @@
1
+ /* tslint:disable */
2
+ /* auto-generated angular directive proxies */
3
+ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, NgZone } from '@angular/core';
4
+ import { ProxyCmp, proxyOutputs } from './angular-component-lib/utils';
5
+
6
+ import { Components } from '@haiilo/catalyst';
7
+
8
+
9
+
10
+
11
+ export declare interface CatAlert extends Components.CatAlert {}
12
+
13
+ @ProxyCmp({
14
+ defineCustomElementFn: undefined,
15
+ inputs: ['color']
16
+ })
17
+ @Component({
18
+ selector: 'cat-alert',
19
+ changeDetection: ChangeDetectionStrategy.OnPush,
20
+ template: '<ng-content></ng-content>',
21
+ inputs: ['color']
22
+ })
23
+ export class CatAlert {
24
+ protected el: HTMLElement;
25
+ constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
26
+ c.detach();
27
+ this.el = r.nativeElement;
28
+ }
29
+ }
30
+
31
+
32
+ export declare interface CatBadge extends Components.CatBadge {}
33
+
34
+ @ProxyCmp({
35
+ defineCustomElementFn: undefined,
36
+ inputs: ['color', 'pulse', 'round', 'size', 'variant']
37
+ })
38
+ @Component({
39
+ selector: 'cat-badge',
40
+ changeDetection: ChangeDetectionStrategy.OnPush,
41
+ template: '<ng-content></ng-content>',
42
+ inputs: ['color', 'pulse', 'round', 'size', 'variant']
43
+ })
44
+ export class CatBadge {
45
+ protected el: HTMLElement;
46
+ constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
47
+ c.detach();
48
+ this.el = r.nativeElement;
49
+ }
50
+ }
51
+
52
+
53
+ export declare interface CatButton extends Components.CatButton {
54
+ /**
55
+ * Emitted when the button is clicked.
56
+ */
57
+ catClick: EventEmitter<CustomEvent<MouseEvent>>;
58
+ /**
59
+ * Emitted when the button received focus.
60
+ */
61
+ catFocus: EventEmitter<CustomEvent<FocusEvent>>;
62
+ /**
63
+ * Emitted when the button loses focus.
64
+ */
65
+ catBlur: EventEmitter<CustomEvent<FocusEvent>>;
66
+
67
+ }
68
+
69
+ @ProxyCmp({
70
+ defineCustomElementFn: undefined,
71
+ inputs: ['a11yLabel', 'buttonId', 'color', 'disabled', 'ellipsed', 'icon', 'iconOnly', 'iconSuffix', 'loading', 'name', 'round', 'size', 'submit', 'url', 'urlTarget', 'value', 'variant'],
72
+ methods: ['setFocus']
73
+ })
74
+ @Component({
75
+ selector: 'cat-button',
76
+ changeDetection: ChangeDetectionStrategy.OnPush,
77
+ template: '<ng-content></ng-content>',
78
+ inputs: ['a11yLabel', 'buttonId', 'color', 'disabled', 'ellipsed', 'icon', 'iconOnly', 'iconSuffix', 'loading', 'name', 'round', 'size', 'submit', 'url', 'urlTarget', 'value', 'variant']
79
+ })
80
+ export class CatButton {
81
+ protected el: HTMLElement;
82
+ constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
83
+ c.detach();
84
+ this.el = r.nativeElement;
85
+ proxyOutputs(this, this.el, ['catClick', 'catFocus', 'catBlur']);
86
+ }
87
+ }
88
+
89
+
90
+ export declare interface CatIcon extends Components.CatIcon {}
91
+
92
+ @ProxyCmp({
93
+ defineCustomElementFn: undefined,
94
+ inputs: ['a11yLabel', 'icon', 'size']
95
+ })
96
+ @Component({
97
+ selector: 'cat-icon',
98
+ changeDetection: ChangeDetectionStrategy.OnPush,
99
+ template: '<ng-content></ng-content>',
100
+ inputs: ['a11yLabel', 'icon', 'size']
101
+ })
102
+ export class CatIcon {
103
+ protected el: HTMLElement;
104
+ constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
105
+ c.detach();
106
+ this.el = r.nativeElement;
107
+ }
108
+ }
109
+
110
+
111
+ export declare interface CatMenu extends Components.CatMenu {
112
+ /**
113
+ * Emitted when the menu is opened.
114
+ */
115
+ catOpen: EventEmitter<CustomEvent<FocusEvent>>;
116
+ /**
117
+ * Emitted when the menu is closed.
118
+ */
119
+ catClose: EventEmitter<CustomEvent<FocusEvent>>;
120
+
121
+ }
122
+
123
+ @ProxyCmp({
124
+ defineCustomElementFn: undefined,
125
+ inputs: ['placement']
126
+ })
127
+ @Component({
128
+ selector: 'cat-menu',
129
+ changeDetection: ChangeDetectionStrategy.OnPush,
130
+ template: '<ng-content></ng-content>',
131
+ inputs: ['placement']
132
+ })
133
+ export class CatMenu {
134
+ protected el: HTMLElement;
135
+ constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
136
+ c.detach();
137
+ this.el = r.nativeElement;
138
+ proxyOutputs(this, this.el, ['catOpen', 'catClose']);
139
+ }
140
+ }
141
+
142
+
143
+ export declare interface CatScrollable extends Components.CatScrollable {
144
+ /**
145
+ * Emitted when the content is fully scrolled to the top.
146
+ */
147
+ scrolledTop: EventEmitter<CustomEvent<void>>;
148
+ /**
149
+ * Emitted when the content is fully scrolled to the left.
150
+ */
151
+ scrolledLeft: EventEmitter<CustomEvent<void>>;
152
+ /**
153
+ * Emitted when the content is fully scrolled to the right.
154
+ */
155
+ scrolledRight: EventEmitter<CustomEvent<void>>;
156
+ /**
157
+ * Emitted when the content is fully scrolled to the bottom.
158
+ */
159
+ scrolledBottom: EventEmitter<CustomEvent<void>>;
160
+
161
+ }
162
+
163
+ @ProxyCmp({
164
+ defineCustomElementFn: undefined,
165
+ inputs: ['overflowX', 'overflowY', 'overscroll', 'scrolledBuffer', 'scrolledInit', 'shadowX', 'shadowY']
166
+ })
167
+ @Component({
168
+ selector: 'cat-scrollable',
169
+ changeDetection: ChangeDetectionStrategy.OnPush,
170
+ template: '<ng-content></ng-content>',
171
+ inputs: ['overflowX', 'overflowY', 'overscroll', 'scrolledBuffer', 'scrolledInit', 'shadowX', 'shadowY']
172
+ })
173
+ export class CatScrollable {
174
+ protected el: HTMLElement;
175
+ constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
176
+ c.detach();
177
+ this.el = r.nativeElement;
178
+ proxyOutputs(this, this.el, ['scrolledTop', 'scrolledLeft', 'scrolledRight', 'scrolledBottom']);
179
+ }
180
+ }
181
+
182
+
183
+ export declare interface CatSkeleton extends Components.CatSkeleton {}
184
+
185
+ @ProxyCmp({
186
+ defineCustomElementFn: undefined,
187
+ inputs: ['effect', 'lines', 'size', 'variant']
188
+ })
189
+ @Component({
190
+ selector: 'cat-skeleton',
191
+ changeDetection: ChangeDetectionStrategy.OnPush,
192
+ template: '<ng-content></ng-content>',
193
+ inputs: ['effect', 'lines', 'size', 'variant']
194
+ })
195
+ export class CatSkeleton {
196
+ protected el: HTMLElement;
197
+ constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
198
+ c.detach();
199
+ this.el = r.nativeElement;
200
+ }
201
+ }
202
+
203
+
204
+ export declare interface CatSpinner extends Components.CatSpinner {}
205
+
206
+ @ProxyCmp({
207
+ defineCustomElementFn: undefined,
208
+ inputs: ['a11yLabel', 'size']
209
+ })
210
+ @Component({
211
+ selector: 'cat-spinner',
212
+ changeDetection: ChangeDetectionStrategy.OnPush,
213
+ template: '<ng-content></ng-content>',
214
+ inputs: ['a11yLabel', 'size']
215
+ })
216
+ export class CatSpinner {
217
+ protected el: HTMLElement;
218
+ constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
219
+ c.detach();
220
+ this.el = r.nativeElement;
221
+ }
222
+ }
@@ -0,0 +1,2 @@
1
+ export * from './lib/directives/proxies';
2
+ export * from './lib/catalyst.module';
package/src/test.ts ADDED
@@ -0,0 +1,28 @@
1
+ // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
+
3
+ import 'zone.js';
4
+ import 'zone.js/testing';
5
+ import { getTestBed } from '@angular/core/testing';
6
+ import {
7
+ BrowserDynamicTestingModule,
8
+ platformBrowserDynamicTesting
9
+ } from '@angular/platform-browser-dynamic/testing';
10
+
11
+ declare const require: {
12
+ context(path: string, deep?: boolean, filter?: RegExp): {
13
+ keys(): string[];
14
+ <T>(id: string): T;
15
+ };
16
+ };
17
+
18
+ // First, initialize the Angular testing environment.
19
+ getTestBed().initTestEnvironment(
20
+ BrowserDynamicTestingModule,
21
+ platformBrowserDynamicTesting(),
22
+ { teardown: { destroyAfterEach: true }},
23
+ );
24
+
25
+ // Then we find all the tests.
26
+ const context = require.context('./', true, /\.spec\.ts$/);
27
+ // And load the modules.
28
+ context.keys().map(context);
@@ -0,0 +1,20 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "../../tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "../../out-tsc/lib",
6
+ "target": "es2015",
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "inlineSources": true,
10
+ "types": [],
11
+ "lib": [
12
+ "dom",
13
+ "es2018"
14
+ ]
15
+ },
16
+ "exclude": [
17
+ "src/test.ts",
18
+ "**/*.spec.ts"
19
+ ]
20
+ }
@@ -0,0 +1,10 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "./tsconfig.lib.json",
4
+ "compilerOptions": {
5
+ "declarationMap": false
6
+ },
7
+ "angularCompilerOptions": {
8
+ "compilationMode": "partial"
9
+ }
10
+ }
@@ -0,0 +1,17 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "../../tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "../../out-tsc/spec",
6
+ "types": [
7
+ "jasmine"
8
+ ]
9
+ },
10
+ "files": [
11
+ "src/test.ts"
12
+ ],
13
+ "include": [
14
+ "**/*.spec.ts",
15
+ "**/*.d.ts"
16
+ ]
17
+ }