@ev-core/aurelia-v1-icon 0.2.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,161 @@
1
+ # `google-tag-manager`
2
+
3
+ This project is bootstrapped by [aurelia-cli](https://github.com/aurelia/cli).
4
+
5
+ This Aurelia plugin project has a built-in dev app (with CLI built-in bundler and RequireJS) to simplify development.
6
+
7
+ 1. The local `src/` folder, is the source code for the plugin.
8
+ 2. The local `dev-app/` folder, is the code for the dev app, just like a normal app bootstrapped by aurelia-cli.
9
+ 3. You can use normal `au run` and `au test` in development just like developing an app.
10
+ 4. You can use aurelia-testing to test your plugin, just like developing an app.
11
+ 5. To ensure compatibility to other apps, always use `PLATFORM.moduleName()` wrapper in files inside `src/`. You don't need to use the wrapper in `dev-app/` folder as CLI built-in bundler supports module name without the wrapper.
12
+
13
+ Note aurelia-cli doesn't provide a plugin skeleton with Webpack setup (not yet), but this plugin can be consumed by any app using Webpack, or CLI built-in bundler, or jspm.
14
+
15
+ ## How to write an Aurelia plugin
16
+
17
+ For a full length tutorial, visit [Aurelia plugin guide](https://aurelia.io/docs/plugins/write-new-plugin).
18
+
19
+ Here is some basics. You can create new custom element, custom attribute, value converter or binding behavior manually, or use command `au generate` to help.
20
+ ```shell
21
+ au generate element some-name
22
+ au generate attribute some-name
23
+ au generate value-converter some-name
24
+ au generate binding-behavior some-name
25
+ ```
26
+
27
+ By default, the cli generates command generates files in following folders:
28
+ ```
29
+ src/elements
30
+ src/attributes
31
+ src/value-converters
32
+ src/binding-behaviors
33
+ ```
34
+
35
+ Note the folder structure is only to help you organising the files, it's not a requirement of Aurelia. You can manually create new element (or other thing) anywhere in `src/`.
36
+
37
+ After you added some new file, you need to register it in `src/index.ts`. Like this:
38
+ ```js
39
+ config.globalResources([
40
+ // ...
41
+ PLATFORM.moduleName('./path/to/new-file-without-ext')
42
+ ]);
43
+ ````
44
+
45
+ The usage of `PLATFORM.moduleName` wrapper is mandatory. It's needed for your plugin to be consumed by any app using webpack, CLI built-in bundler, or jspm.
46
+
47
+ ## Resource import within the dev app
48
+
49
+ In dev app, when you need to import something from the inner plugin (for example, importing a class for dependency injection), use special name `"resources"` to reference the inner plugin.
50
+
51
+ ```js
52
+ import {autoinject} from 'aurelia-framework';
53
+ // "resources" refers the inner plugin src/index.ts
54
+ import {MyService} from 'resources';
55
+
56
+ @autoinject()
57
+ export class App {
58
+ constructor(myService: MyService) {}
59
+ }
60
+ ```
61
+
62
+ ## Manage dependencies
63
+
64
+ By default, this plugin has no "dependencies" in package.json. Theoretically this plugin depends on at least `aurelia-pal` because `src/index.ts` imports it. It could also depends on more core Aurelia package like `aurelia-binding` or `aurelia-templating` if you build advanced components that reference them.
65
+
66
+ Ideally you need to carefully add those `aurelia-pal` (`aurelia-binding`...) to "dependencies" in package.json. But in practice you don't have to. Because every app that consumes this plugin will have full Aurelia core packages installed.
67
+
68
+ Furthermore, there are two benefits by leaving those dependencies out of plugin's package.json.
69
+ 1. ensure this plugin doesn't bring in a duplicated Aurelia core package to consumers' app. This is mainly for app built with webpack. We had been hit with `aurelia-binding` v1 and v2 conflicts due to 3rd party plugin asks for `aurelia-binding` v1.
70
+ 2. reduce the burden for npm/yarn when installing this plugin.
71
+
72
+ If you are a perfectionist who could not stand leaving out dependencies, I recommend you to add `aurelia-pal` (`aurelia-binding`...) to "peerDependencies" in package.json. So at least it could not cause a duplicated Aurelia core package.
73
+
74
+ If your plugin depends on other npm package, like `lodash` or `jquery`, **you have to add them to "dependencies" in package.json**.
75
+
76
+ ## Build Plugin
77
+
78
+ Run `au build-plugin`. This will transpile all files from `src/` folder to `dist/native-modules/` and `dist/commonjs/`.
79
+
80
+ For example, `src/index.ts` will become `dist/native-modules/index.js` and `dist/commonjs/index.js`.
81
+
82
+ Note all other files in `dev-app/` folder are for the dev app, they would not appear in the published npm package.
83
+
84
+ ## Consume Plugin
85
+
86
+ By default, the `dist/` folder is not committed to git. (We have `/dist` in `.gitignore`). But that would not prevent you from consuming this plugin through direct git reference.
87
+
88
+ You can consume this plugin directly by:
89
+ ```shell
90
+ npm i github:your_github_username/google-tag-manager
91
+ # or if you use bitbucket
92
+ npm i bitbucket:your_github_username/google-tag-manager
93
+ # or if you use gitlab
94
+ npm i gitlab:your_github_username/google-tag-manager
95
+ # or plain url
96
+ npm i https:/github.com/your_github_username/google-tag-manager.git
97
+ ```
98
+
99
+ Then load the plugin in app's `main.ts` like this.
100
+ ```js
101
+ aurelia.use.plugin('google-tag-manager');
102
+ // for webpack user, use PLATFORM.moduleName wrapper
103
+ aurelia.use.plugin(PLATFORM.moduleName('google-tag-manager'));
104
+ ```
105
+
106
+ The missing `dist/` files will be filled up by npm through `"prepare": "npm run build"` (in `"scripts"` section of package.json).
107
+
108
+ Yarn has a [bug](https://github.com/yarnpkg/yarn/issues/5235) that ignores `"prepare"` script. If you want to use yarn to consume your plugin through direct git reference, remove `/dist` from `.gitignore` and commit all the files. Note you don't need to commit `dist/` files if you only use yarn to consume this plugin through published npm package (`npm i google-tag-manager`).
109
+
110
+ ## Publish npm package
111
+
112
+ By default, `"private"` field in package.json has been turned on, this prevents you from accidentally publish a private plugin to npm.
113
+
114
+ To publish the plugin to npm for public consumption:
115
+
116
+ 1. Remove `"private": true,` from package.json.
117
+ 2. Pump up project version. This will run through `au test` (in "preversion" in package.json) first.
118
+ ```shell
119
+ npm version patch # or minor or major
120
+ ```
121
+ 3. Push up changes to your git server
122
+ ```shell
123
+ git push && git push --tags
124
+ ```
125
+ 4. Then publish to npm, you need to have your npm account logged in.
126
+ ```shell
127
+ npm publish
128
+ ```
129
+
130
+ ## Automate changelog, git push, and npm publish
131
+
132
+ You can enable `npm version patch # or minor or major` to automatically update changelog, push commits and version tag to the git server, and publish to npm.
133
+
134
+ Here is one simple setup.
135
+ 1. `npm i -D standard-changelog`. We use [`standard-changelog`](https://github.com/conventional-changelog/conventional-changelog) as a minimum example to support conventional changelog.
136
+ * Alternatively you can use high level [standard-version](https://github.com/conventional-changelog/standard-version).
137
+ 2. Add two commands to `"scripts"` section of package.json.
138
+ ```
139
+ "scripts": {
140
+ // ...
141
+ "version": "standard-changelog && git add CHANGELOG.md",
142
+ "postversion": "git push && git push --tags && npm publish"
143
+ },
144
+ ```
145
+ 3. you can remove `&& npm publish` if your project is private
146
+
147
+ For more information, go to https://aurelia.io/docs/cli/cli-bundler
148
+
149
+ ## Run dev app
150
+
151
+ Run `au run`, then open `http://localhost:9000`
152
+
153
+ To open browser automatically, do `au run --open`.
154
+
155
+ To change dev server port, do `au run --port 8888`.
156
+
157
+ To change dev server host, do `au run --host 127.0.0.1`
158
+
159
+
160
+ **PS:** You could mix all the flags as well, `au run --host 127.0.0.1 --port 7070 --open`
161
+
@@ -0,0 +1,12 @@
1
+ import { Htmler } from "@ev-core/core";
2
+ export declare class UiIconAttribute {
3
+ private el;
4
+ elMan: Htmler.ElementManager;
5
+ icon: string;
6
+ iconChanged(icon: string, prevIcon?: string): void;
7
+ constructor(el: HTMLElement);
8
+ bind(): void;
9
+ attached(): void;
10
+ unbind(): void;
11
+ private build;
12
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UiIconAttribute = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const aurelia_framework_1 = require("aurelia-framework");
6
+ const core_1 = require("@ev-core/core");
7
+ const icon_valueconverter_1 = require("../value-converter/icon-valueconverter");
8
+ let UiIconAttribute = class UiIconAttribute {
9
+ iconChanged(icon, prevIcon) {
10
+ this.build(icon);
11
+ }
12
+ constructor(el) {
13
+ this.el = el;
14
+ this.elMan = core_1.Htmler.ElementManager.create({ el });
15
+ }
16
+ bind() { }
17
+ attached() {
18
+ this.iconChanged(this.icon);
19
+ }
20
+ unbind() {
21
+ this.elMan.dispose();
22
+ }
23
+ build(icon) {
24
+ let classes = icon_valueconverter_1.UiIconValueConverter.convertToClassList(icon);
25
+ let cleanPrev = this.elMan.counter > 0;
26
+ this.elMan
27
+ .apply(props => {
28
+ props.classes = classes;
29
+ }, cleanPrev);
30
+ }
31
+ };
32
+ exports.UiIconAttribute = UiIconAttribute;
33
+ tslib_1.__decorate([
34
+ (0, aurelia_framework_1.bindable)({ defaultBindingMode: aurelia_framework_1.bindingMode.toView, primaryProperty: true }),
35
+ tslib_1.__metadata("design:type", String)
36
+ ], UiIconAttribute.prototype, "icon", void 0);
37
+ exports.UiIconAttribute = UiIconAttribute = tslib_1.__decorate([
38
+ (0, aurelia_framework_1.customAttribute)('ui-icon'),
39
+ (0, aurelia_framework_1.inject)(aurelia_framework_1.DOM.Element),
40
+ tslib_1.__metadata("design:paramtypes", [HTMLElement])
41
+ ], UiIconAttribute);
42
+
43
+ //# sourceMappingURL=icon-attribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/attributes/icon-attribute.ts"],"names":[],"mappings":";;;;AAAA,yDAAwF;AACxF,wCAAuC;AACvC,gFAA8E;AAIvE,IAAM,eAAe,GAArB,MAAM,eAAe;IAG1B,WAAW,CAAC,IAAY,EAAE,QAAiB;QACzC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IAED,YACU,EAAe;QAAf,OAAE,GAAF,EAAE,CAAa;QAEvB,IAAI,CAAC,KAAK,GAAG,aAAM,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,KAAK,CAAC;IAEV,QAAQ;QACN,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAGD,MAAM;QACJ,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;IAEO,KAAK,CAAC,IAAY;QACxB,IAAI,OAAO,GAAG,0CAAoB,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAE5D,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK;aACP,KAAK,CAAC,KAAK,CAAC,EAAE;YACb,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;QAC1B,CAAC,EAAE,SAAS,CAAC,CAAC;IAClB,CAAC;CACF,CAAA;AAjCY,0CAAe;AAEmD;IAA5E,IAAA,4BAAQ,EAAC,EAAE,kBAAkB,EAAE,+BAAW,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;;6CAAc;0BAF/E,eAAe;IAF3B,IAAA,mCAAe,EAAC,SAAS,CAAC;IAC1B,IAAA,0BAAM,EAAC,uBAAG,CAAC,OAAO,CAAC;6CASJ,WAAW;GARd,eAAe,CAiC3B","file":"icon-attribute.js","sourceRoot":"../../../src/"}
@@ -0,0 +1,2 @@
1
+ import { FrameworkConfiguration } from 'aurelia-framework';
2
+ export declare function configure(config: FrameworkConfiguration): void;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configure = configure;
4
+ const aurelia_pal_1 = require("aurelia-pal");
5
+ function configure(config) {
6
+ config.globalResources([
7
+ aurelia_pal_1.PLATFORM.moduleName('./attributes/icon-attribute'),
8
+ aurelia_pal_1.PLATFORM.moduleName('./value-converter/icon-valueconverter')
9
+ ]);
10
+ }
11
+
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;AAGA,8BAKC;AAPD,6CAAuC;AAEvC,SAAgB,SAAS,CAAC,MAA8B;IACtD,MAAM,CAAC,eAAe,CAAC;QACrB,sBAAQ,CAAC,UAAU,CAAC,6BAA6B,CAAC;QAClD,sBAAQ,CAAC,UAAU,CAAC,uCAAuC,CAAC;KAC7D,CAAC,CAAC;AACL,CAAC","file":"index.js","sourceRoot":"../../src/"}
@@ -0,0 +1,6 @@
1
+ export declare class UiIconValueConverter {
2
+ toView: typeof UiIconValueConverter.convert;
3
+ static convert(icon: string): string;
4
+ static convertToClassList(icon: string): string[];
5
+ static ensureType(classes: string[]): void;
6
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var UiIconValueConverter_1;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.UiIconValueConverter = void 0;
5
+ const tslib_1 = require("tslib");
6
+ const aurelia_framework_1 = require("aurelia-framework");
7
+ const prefix = 'fa-';
8
+ const types = ['fa-solid', 'fa-regular'];
9
+ const fallback = 'exclamation';
10
+ let UiIconValueConverter = UiIconValueConverter_1 = class UiIconValueConverter {
11
+ constructor() {
12
+ this.toView = UiIconValueConverter_1.convert;
13
+ }
14
+ static convert(icon) {
15
+ return UiIconValueConverter_1.convertToClassList(icon)?.join(' ') ?? '';
16
+ }
17
+ static convertToClassList(icon) {
18
+ if (!icon) {
19
+ icon = fallback;
20
+ }
21
+ let classes = icon.trim().split(' ').map(e => prefix + e);
22
+ UiIconValueConverter_1.ensureType(classes);
23
+ return classes;
24
+ }
25
+ static ensureType(classes) {
26
+ const hasType = classes.some(e => types.some(t => t == e));
27
+ if (hasType) {
28
+ return;
29
+ }
30
+ classes.unshift(types[0]);
31
+ }
32
+ };
33
+ exports.UiIconValueConverter = UiIconValueConverter;
34
+ exports.UiIconValueConverter = UiIconValueConverter = UiIconValueConverter_1 = tslib_1.__decorate([
35
+ (0, aurelia_framework_1.valueConverter)('icon')
36
+ ], UiIconValueConverter);
37
+
38
+ //# sourceMappingURL=icon-valueconverter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/value-converter/icon-valueconverter.ts"],"names":[],"mappings":";;;;;AAAA,yDAAmD;AAEnD,MAAM,MAAM,GAAG,KAAK,CAAC;AACrB,MAAM,KAAK,GAAG,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AACzC,MAAM,QAAQ,GAAG,aAAa,CAAC;AAGxB,IAAM,oBAAoB,4BAA1B,MAAM,oBAAoB;IAA1B;QACL,WAAM,GAAG,sBAAoB,CAAC,OAAO,CAAC;IAqBxC,CAAC;IAnBC,MAAM,CAAC,OAAO,CAAC,IAAY;QACzB,OAAO,sBAAoB,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;IACxE,CAAC;IAED,MAAM,CAAC,kBAAkB,CAAC,IAAY;QACpC,IAAI,CAAC,IAAI,EAAE,CAAC;YAAC,IAAI,GAAG,QAAQ,CAAC;QAAC,CAAC;QAC/B,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1D,sBAAoB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAEzC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,OAAiB;QACjC,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3D,IAAI,OAAO,EAAE,CAAC;YAAC,OAAO;QAAC,CAAC;QAExB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;CAEF,CAAA;AAtBY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,kCAAc,EAAC,MAAM,CAAC;GACV,oBAAoB,CAsBhC","file":"icon-valueconverter.js","sourceRoot":"../../../src/"}
@@ -0,0 +1,12 @@
1
+ import { Htmler } from "@ev-core/core";
2
+ export declare class UiIconAttribute {
3
+ private el;
4
+ elMan: Htmler.ElementManager;
5
+ icon: string;
6
+ iconChanged(icon: string, prevIcon?: string): void;
7
+ constructor(el: HTMLElement);
8
+ bind(): void;
9
+ attached(): void;
10
+ unbind(): void;
11
+ private build;
12
+ }
@@ -0,0 +1,40 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { bindable, bindingMode, customAttribute, DOM, inject } from "aurelia-framework";
3
+ import { Htmler } from "@ev-core/core";
4
+ import { UiIconValueConverter } from "../value-converter/icon-valueconverter";
5
+ let UiIconAttribute = class UiIconAttribute {
6
+ iconChanged(icon, prevIcon) {
7
+ this.build(icon);
8
+ }
9
+ constructor(el) {
10
+ this.el = el;
11
+ this.elMan = Htmler.ElementManager.create({ el });
12
+ }
13
+ bind() { }
14
+ attached() {
15
+ this.iconChanged(this.icon);
16
+ }
17
+ unbind() {
18
+ this.elMan.dispose();
19
+ }
20
+ build(icon) {
21
+ let classes = UiIconValueConverter.convertToClassList(icon);
22
+ let cleanPrev = this.elMan.counter > 0;
23
+ this.elMan
24
+ .apply(props => {
25
+ props.classes = classes;
26
+ }, cleanPrev);
27
+ }
28
+ };
29
+ __decorate([
30
+ bindable({ defaultBindingMode: bindingMode.toView, primaryProperty: true }),
31
+ __metadata("design:type", String)
32
+ ], UiIconAttribute.prototype, "icon", void 0);
33
+ UiIconAttribute = __decorate([
34
+ customAttribute('ui-icon'),
35
+ inject(DOM.Element),
36
+ __metadata("design:paramtypes", [HTMLElement])
37
+ ], UiIconAttribute);
38
+ export { UiIconAttribute };
39
+
40
+ //# sourceMappingURL=icon-attribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/attributes/icon-attribute.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAIvE,IAAM,eAAe,GAArB,MAAM,eAAe;IAG1B,WAAW,CAAC,IAAY,EAAE,QAAiB;QACzC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IAED,YACU,EAAe;QAAf,OAAE,GAAF,EAAE,CAAa;QAEvB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,KAAK,CAAC;IAEV,QAAQ;QACN,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAGD,MAAM;QACJ,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;IAEO,KAAK,CAAC,IAAY;QACxB,IAAI,OAAO,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAE5D,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK;aACP,KAAK,CAAC,KAAK,CAAC,EAAE;YACb,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;QAC1B,CAAC,EAAE,SAAS,CAAC,CAAC;IAClB,CAAC;CACF,CAAA;AA/B8E;IAA5E,QAAQ,CAAC,EAAE,kBAAkB,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;;6CAAc;AAF/E,eAAe;IAF3B,eAAe,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;qCASJ,WAAW;GARd,eAAe,CAiC3B","file":"icon-attribute.js","sourceRoot":"../../../src/"}
@@ -0,0 +1,2 @@
1
+ import { FrameworkConfiguration } from 'aurelia-framework';
2
+ export declare function configure(config: FrameworkConfiguration): void;
@@ -0,0 +1,9 @@
1
+ import { PLATFORM } from 'aurelia-pal';
2
+ export function configure(config) {
3
+ config.globalResources([
4
+ PLATFORM.moduleName('./attributes/icon-attribute'),
5
+ PLATFORM.moduleName('./value-converter/icon-valueconverter')
6
+ ]);
7
+ }
8
+
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,UAAU,SAAS,CAAC,MAA8B;IACtD,MAAM,CAAC,eAAe,CAAC;QACrB,QAAQ,CAAC,UAAU,CAAC,6BAA6B,CAAC;QAClD,QAAQ,CAAC,UAAU,CAAC,uCAAuC,CAAC;KAC7D,CAAC,CAAC;AACL,CAAC","file":"index.js","sourceRoot":"../../src/"}
@@ -0,0 +1,6 @@
1
+ export declare class UiIconValueConverter {
2
+ toView: typeof UiIconValueConverter.convert;
3
+ static convert(icon: string): string;
4
+ static convertToClassList(icon: string): string[];
5
+ static ensureType(classes: string[]): void;
6
+ }
@@ -0,0 +1,35 @@
1
+ var UiIconValueConverter_1;
2
+ import { __decorate } from "tslib";
3
+ import { valueConverter } from "aurelia-framework";
4
+ const prefix = 'fa-';
5
+ const types = ['fa-solid', 'fa-regular'];
6
+ const fallback = 'exclamation';
7
+ let UiIconValueConverter = UiIconValueConverter_1 = class UiIconValueConverter {
8
+ constructor() {
9
+ this.toView = UiIconValueConverter_1.convert;
10
+ }
11
+ static convert(icon) {
12
+ return UiIconValueConverter_1.convertToClassList(icon)?.join(' ') ?? '';
13
+ }
14
+ static convertToClassList(icon) {
15
+ if (!icon) {
16
+ icon = fallback;
17
+ }
18
+ let classes = icon.trim().split(' ').map(e => prefix + e);
19
+ UiIconValueConverter_1.ensureType(classes);
20
+ return classes;
21
+ }
22
+ static ensureType(classes) {
23
+ const hasType = classes.some(e => types.some(t => t == e));
24
+ if (hasType) {
25
+ return;
26
+ }
27
+ classes.unshift(types[0]);
28
+ }
29
+ };
30
+ UiIconValueConverter = UiIconValueConverter_1 = __decorate([
31
+ valueConverter('icon')
32
+ ], UiIconValueConverter);
33
+ export { UiIconValueConverter };
34
+
35
+ //# sourceMappingURL=icon-valueconverter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/value-converter/icon-valueconverter.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,MAAM,GAAG,KAAK,CAAC;AACrB,MAAM,KAAK,GAAG,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AACzC,MAAM,QAAQ,GAAG,aAAa,CAAC;AAGxB,IAAM,oBAAoB,4BAA1B,MAAM,oBAAoB;IAA1B;QACL,WAAM,GAAG,sBAAoB,CAAC,OAAO,CAAC;IAqBxC,CAAC;IAnBC,MAAM,CAAC,OAAO,CAAC,IAAY;QACzB,OAAO,sBAAoB,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;IACxE,CAAC;IAED,MAAM,CAAC,kBAAkB,CAAC,IAAY;QACpC,IAAI,CAAC,IAAI,EAAE,CAAC;YAAC,IAAI,GAAG,QAAQ,CAAC;QAAC,CAAC;QAC/B,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1D,sBAAoB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAEzC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,OAAiB;QACjC,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3D,IAAI,OAAO,EAAE,CAAC;YAAC,OAAO;QAAC,CAAC;QAExB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;CAEF,CAAA;AAtBY,oBAAoB;IADhC,cAAc,CAAC,MAAM,CAAC;GACV,oBAAoB,CAsBhC","file":"icon-valueconverter.js","sourceRoot":"../../../src/"}
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@ev-core/aurelia-v1-icon",
3
+ "description": "An Aurelia plugin project.",
4
+ "version": "0.2.0",
5
+ "dependencies": {
6
+ "@ev-core/core": "0.2.0"
7
+ },
8
+ "peerDependencies": {
9
+ "aurelia-binding": "^1.0.0 || ^2.0.0",
10
+ "aurelia-dependency-injection": "^1.0.0",
11
+ "aurelia-event-aggregator": "^1.0.0",
12
+ "aurelia-framework": "^1.0.0",
13
+ "aurelia-logging": "^1.0.0",
14
+ "aurelia-pal": "^1.0.0",
15
+ "tslib": "^2.8.1"
16
+ },
17
+ "devDependencies": {
18
+ "eslint": "^9.17.0",
19
+ "globals": "^15.14.0",
20
+ "aurelia-cli": "^3.0.4",
21
+ "aurelia-testing": "^1.1.0",
22
+ "gulp": "^4.0.2",
23
+ "gulp-eslint-new": "^2.4.0",
24
+ "minimatch": "^10.0.1",
25
+ "promise-polyfill": "^8.3.0",
26
+ "aurelia-bootstrapper": "^2.4.1",
27
+ "aurelia-animator-css": "^1.0.4",
28
+ "typescript": "^5.7.2",
29
+ "@types/node": "^22.10.2",
30
+ "typescript-eslint": "^8.18.1",
31
+ "gulp-sourcemaps": "^3.0.0",
32
+ "requirejs": "^2.3.7",
33
+ "text": "requirejs/text",
34
+ "gulp-typescript": "^6.0.0-alpha.1",
35
+ "connect": "^3.7.0",
36
+ "connect-history-api-fallback": "^2.0.0",
37
+ "connect-injector": "^0.4.4",
38
+ "serve-static": "^1.16.2",
39
+ "socket.io": "^4.8.1",
40
+ "open": "^8.4.2",
41
+ "server-destroy": "^1.0.1",
42
+ "debounce": "^2.2.0",
43
+ "gulp-plumber": "^1.2.1",
44
+ "gulp-rename": "^2.0.0",
45
+ "gulp-watch": "^5.0.1",
46
+ "gulp-if": "^3.0.0"
47
+ },
48
+ "overrides": {
49
+ "chokidar": "^3.0.0",
50
+ "glob-stream": "^7.0.0",
51
+ "glob-parent": "^6.0.0",
52
+ "micromatch": "^4.0.0"
53
+ },
54
+ "main": "dist/commonjs/index.js",
55
+ "module": "dist/native-modules/index.js",
56
+ "files": [
57
+ "dist"
58
+ ],
59
+ "scripts": {
60
+ "build": "au build-plugin --env prod",
61
+ "clean": "rimraf dist",
62
+ "start": "au run",
63
+ "watch": "au build-plugin --watch"
64
+ }
65
+ }