@ukho/admiralty-angular 0.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.
@@ -0,0 +1,16 @@
1
+ # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2
+ # For additional information regarding the format and rule options, please see:
3
+ # https://github.com/browserslist/browserslist#queries
4
+
5
+ # For the full list of supported browsers by the Angular framework, please see:
6
+ # https://angular.io/guide/browser-support
7
+
8
+ # You can see what browsers were selected by your queries by running:
9
+ # npx browserslist
10
+
11
+ last 1 Chrome version
12
+ last 1 Firefox version
13
+ last 2 Edge major versions
14
+ last 2 Safari major versions
15
+ last 2 iOS major versions
16
+ Firefox ESR
package/.editorconfig ADDED
@@ -0,0 +1,16 @@
1
+ # Editor configuration, see https://editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ charset = utf-8
6
+ indent_style = space
7
+ indent_size = 2
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
10
+
11
+ [*.ts]
12
+ quote_type = single
13
+
14
+ [*.md]
15
+ max_line_length = off
16
+ trim_trailing_whitespace = false
@@ -0,0 +1,7 @@
1
+ const fs = require('fs');
2
+ const rootPackageJson = require('../package.json');
3
+ const distPackageJson = require('../dist/package.json')
4
+
5
+ distPackageJson.version = rootPackageJson.version;
6
+
7
+ fs.writeFileSync('./dist/package.json', JSON.stringify(distPackageJson,null, 2))
@@ -0,0 +1,4 @@
1
+ {
2
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
3
+ "recommendations": ["angular.ng-template"]
4
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
3
+ "version": "0.2.0",
4
+ "configurations": [
5
+ {
6
+ "name": "ng serve",
7
+ "type": "pwa-chrome",
8
+ "request": "launch",
9
+ "preLaunchTask": "npm: start",
10
+ "url": "http://localhost:4200/"
11
+ },
12
+ {
13
+ "name": "ng test",
14
+ "type": "chrome",
15
+ "request": "launch",
16
+ "preLaunchTask": "npm: test",
17
+ "url": "http://localhost:9876/debug.html"
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
3
+ "version": "2.0.0",
4
+ "tasks": [
5
+ {
6
+ "type": "npm",
7
+ "script": "start",
8
+ "isBackground": true,
9
+ "problemMatcher": {
10
+ "owner": "typescript",
11
+ "pattern": "$tsc",
12
+ "background": {
13
+ "activeOnStart": true,
14
+ "beginsPattern": {
15
+ "regexp": "(.*?)"
16
+ },
17
+ "endsPattern": {
18
+ "regexp": "bundle generation complete"
19
+ }
20
+ }
21
+ }
22
+ },
23
+ {
24
+ "type": "npm",
25
+ "script": "test",
26
+ "isBackground": true,
27
+ "problemMatcher": {
28
+ "owner": "typescript",
29
+ "pattern": "$tsc",
30
+ "background": {
31
+ "activeOnStart": true,
32
+ "beginsPattern": {
33
+ "regexp": "(.*?)"
34
+ },
35
+ "endsPattern": {
36
+ "regexp": "bundle generation complete"
37
+ }
38
+ }
39
+ }
40
+ }
41
+ ]
42
+ }
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # DesignSystemAngular
2
+
3
+ This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.0.
4
+
5
+ ## Development server
6
+
7
+ Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
8
+
9
+ ## Code scaffolding
10
+
11
+ Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
12
+
13
+ ## Build
14
+
15
+ Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
16
+
17
+ ## Running unit tests
18
+
19
+ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20
+
21
+ ## Running end-to-end tests
22
+
23
+ Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
24
+
25
+ ## Further help
26
+
27
+ 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,9 @@
1
+ {
2
+ "$schema": "node_modules/ng-packagr/ng-package.schema.json",
3
+ "lib": {
4
+ "entryFile": "src/index.ts"
5
+ },
6
+ "allowedNonPeerDependencies": [
7
+ "@ukho/admiralty-core"
8
+ ]
9
+ }
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@ukho/admiralty-angular",
3
+ "version": "0.0.0",
4
+ "typings": "dist/index.d.ts",
5
+ "module": "dist/fesm2015/ukho-admiralty-angular.mjs",
6
+ "es2020": "dist/fesm2020/ukho-admiralty-angular.mjs",
7
+ "esm2020": "dist/esm2020/ukho-admiralty-angular.mjs",
8
+ "fesm2020": "dist/fesm2020/ukho-admiralty-angular.mjs",
9
+ "fesm2015": "dist/fesm2015/ukho-admiralty-angular.mjs",
10
+ "scripts": {
11
+ "prepublishOnly": "node .scripts/copyPackageVersion.js",
12
+ "build": "ng-packagr -p ng-package.json -c tsconfig.json",
13
+ "test": "jest --passWithNoTests",
14
+ "test:watch": "jest --watch"
15
+ },
16
+ "peerDependencies": {
17
+ "@angular/common": "^15.2.5",
18
+ "@angular/core": "^15.2.5"
19
+ },
20
+ "dependencies": {
21
+ "@ukho/admiralty-core": "^0.0.0",
22
+ "tslib": "^2.5.0"
23
+ },
24
+ "devDependencies": {
25
+ "@angular-devkit/build-angular": "~15.2.4",
26
+ "@angular/animations": "~15.2.5",
27
+ "@angular/cli": "~15.2.4",
28
+ "@angular/common": "^15.2.5",
29
+ "@angular/compiler": "~15.2.5",
30
+ "@angular/compiler-cli": "~15.2.5",
31
+ "@angular/core": "^15.2.5",
32
+ "@angular/forms": "~15.2.5",
33
+ "@angular/platform-browser": "~15.2.5",
34
+ "@angular/platform-browser-dynamic": "~15.2.5",
35
+ "@angular/router": "~15.2.5",
36
+ "@types/node": "^18.15.11",
37
+ "ng-packagr": "^15.2.2",
38
+ "typescript": "~4.9.3"
39
+ },
40
+ "jest": {
41
+ "preset": "jest-preset-angular",
42
+ "setupFilesAfterEnv": [
43
+ "./setupJest.ts"
44
+ ]
45
+ },
46
+ "publishConfig": {
47
+ "directory": "dist/"
48
+ },
49
+ "license": "MIT",
50
+ "url": "https://github.com/UKHO/admiralty-design-system",
51
+ "repository": "git://github.com/UKHO/admiralty-design-system.git"
52
+ }
package/src/index.ts ADDED
@@ -0,0 +1,10 @@
1
+ /*
2
+ * Public API Surface of component-library
3
+ */
4
+
5
+ export * from './lib/design-system.module';
6
+ export { DIRECTIVES } from './lib/stencil-generated';
7
+ export * from './lib/stencil-generated/components';
8
+
9
+ export { TextValueAccessor } from './lib/stencil-generated/text-value-accessor';
10
+ export { RadioValueAccessor } from './lib/stencil-generated/radio-value-accessor';
@@ -0,0 +1,8 @@
1
+ import { applyPolyfills, defineCustomElements } from '@ukho/admiralty-core/loader';
2
+ export const appInitialise = () => {
3
+ return (): any => {
4
+ return applyPolyfills().then(() => {
5
+ return defineCustomElements();
6
+ });
7
+ };
8
+ };
@@ -0,0 +1,26 @@
1
+ import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { appInitialise } from './app_initialise';
4
+ import { DIRECTIVES } from './stencil-generated';
5
+
6
+ export interface UkhoDesignSystemConfig {}
7
+
8
+ @NgModule({
9
+ declarations: [...DIRECTIVES],
10
+ imports: [CommonModule],
11
+ exports: [...DIRECTIVES],
12
+ })
13
+ export class DesignSystemModule {
14
+ static forRoot(): ModuleWithProviders<DesignSystemModule> {
15
+ return {
16
+ ngModule: DesignSystemModule,
17
+ providers: [
18
+ {
19
+ provide: APP_INITIALIZER,
20
+ useFactory: appInitialise,
21
+ multi: true,
22
+ },
23
+ ],
24
+ };
25
+ }
26
+ }
@@ -0,0 +1,57 @@
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(() => this.el[methodName].apply(this.el, args));
25
+ };
26
+ });
27
+ };
28
+
29
+ export const proxyOutputs = (instance: any, el: any, events: string[]) => {
30
+ events.forEach((eventName) => (instance[eventName] = fromEvent(el, eventName)));
31
+ };
32
+
33
+ export const defineCustomElement = (tagName: string, customElement: any) => {
34
+ if (customElement !== undefined && typeof customElements !== 'undefined' && !customElements.get(tagName)) {
35
+ customElements.define(tagName, customElement);
36
+ }
37
+ };
38
+
39
+ // tslint:disable-next-line: only-arrow-functions
40
+ export function ProxyCmp(opts: { defineCustomElementFn?: () => void; inputs?: any; methods?: any }) {
41
+ const decorator = function (cls: any) {
42
+ const { defineCustomElementFn, inputs, methods } = opts;
43
+
44
+ if (defineCustomElementFn !== undefined) {
45
+ defineCustomElementFn();
46
+ }
47
+
48
+ if (inputs) {
49
+ proxyInputs(cls, inputs);
50
+ }
51
+ if (methods) {
52
+ proxyMethods(cls, methods);
53
+ }
54
+ return cls;
55
+ };
56
+ return decorator;
57
+ }