From 85228649e1d3c8d179e3fbb5c5d2eb606bc7be3a Mon Sep 17 00:00:00 2001 From: MohammadMahdi Zamanian Date: Sun, 23 Oct 2022 01:00:23 +0330 Subject: [PATCH 1/9] feat(alwatr-icon): improve --- packages/ui/icon/README.md | 1 + packages/ui/icon/package.json | 35 ++++++++++++++++++++++++++++++++++ packages/ui/icon/src/icon.ts | 20 +++++++++++++++++++ packages/ui/icon/tsconfig.json | 15 +++++++++++++++ tsconfig.json | 1 + 5 files changed, 72 insertions(+) create mode 100644 packages/ui/icon/README.md create mode 100644 packages/ui/icon/package.json create mode 100644 packages/ui/icon/src/icon.ts create mode 100644 packages/ui/icon/tsconfig.json diff --git a/packages/ui/icon/README.md b/packages/ui/icon/README.md new file mode 100644 index 000000000..70211bd78 --- /dev/null +++ b/packages/ui/icon/README.md @@ -0,0 +1 @@ +# Alwatr Icon Component diff --git a/packages/ui/icon/package.json b/packages/ui/icon/package.json new file mode 100644 index 000000000..cc9a3c559 --- /dev/null +++ b/packages/ui/icon/package.json @@ -0,0 +1,35 @@ +{ + "name": "@alwatr/icon", + "version": "0.0.1", + "description": "Premium icons for Ionic. ", + "keywords": [ + "icon", + "component", + "typescript", + "esm", + "alwatr" + ], + "main": "icon.js", + "type": "module", + "types": "icon.d.ts", + "author": "MohammadMahdi Zamanian (https://mm25zamanian.ir)", + "license": "MIT", + "files": [ + "**/*.{d.ts.map,d.ts,js.map,js,html,md}" + ], + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://github.com/AliMD/alwatr", + "directory": "packages/ui/icon" + }, + "homepage": "https://github.com/AliMD/alwatr/tree/main/packages/ui/icon#readme", + "bugs": { + "url": "https://github.com/AliMD/alwatr/issues" + }, + "dependencies": { + "tslib": "^2.3.1" + } +} diff --git a/packages/ui/icon/src/icon.ts b/packages/ui/icon/src/icon.ts new file mode 100644 index 000000000..8906c70df --- /dev/null +++ b/packages/ui/icon/src/icon.ts @@ -0,0 +1,20 @@ +import {AlwatrElement} from '@alwatr/element'; +import {html, css} from 'lit'; +import {customElement} from 'lit/decorators/custom-element.js'; + +import type {TemplateResult} from 'lit'; + +@customElement('alwatr-icon') +export class AlwatrIcon extends AlwatrElement { + static override styles = [ + css` + :host { + display: inline-block; + } + `, + ]; + + override render(): TemplateResult { + return html`

AlWatr Icon Component

`; + } +} diff --git a/packages/ui/icon/tsconfig.json b/packages/ui/icon/tsconfig.json new file mode 100644 index 000000000..56909057d --- /dev/null +++ b/packages/ui/icon/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "composite": true, + "tsBuildInfoFile": ".tsbuildinfo", + "rootDir": "src", + "outDir": "." + }, + // files, include and exclude from the inheriting config are always overwritten. + "include": ["src/**/*"], + "exclude": [], + "references": [ + // { "path": "../x" }, + ] +} diff --git a/tsconfig.json b/tsconfig.json index 1df380d9d..b42357a04 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -113,6 +113,7 @@ {"path": "./packages/core/nano-server"}, {"path": "./packages/core/storage"}, {"path": "./packages/core/token"}, + {"path": "./packages/ui/icon"}, {"path": "./packages/lab/zx-example"}, {"path": "./demo"} ] From 6152f04b7ceb5b5c76de68cda116ce72ad425886 Mon Sep 17 00:00:00 2001 From: MohammadMahdi Zamanian Date: Sun, 23 Oct 2022 01:13:53 +0330 Subject: [PATCH 2/9] chore: packages --- packages/ui/icon/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/ui/icon/package.json b/packages/ui/icon/package.json index cc9a3c559..86c06ba63 100644 --- a/packages/ui/icon/package.json +++ b/packages/ui/icon/package.json @@ -30,6 +30,7 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { + "@alwatr/element": "^0.18.0", "tslib": "^2.3.1" } } From 89ec9b6f672e96b2424b81465d118f6338ad5524 Mon Sep 17 00:00:00 2001 From: MohammadMahdi Zamanian Date: Sun, 23 Oct 2022 01:17:02 +0330 Subject: [PATCH 3/9] feat(element): add to tsconfig --- tsconfig.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index b42357a04..5004a2355 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -113,8 +113,9 @@ {"path": "./packages/core/nano-server"}, {"path": "./packages/core/storage"}, {"path": "./packages/core/token"}, - {"path": "./packages/ui/icon"}, + {"path": "./packages/core/element"}, {"path": "./packages/lab/zx-example"}, - {"path": "./demo"} + {"path": "./packages/ui/icon"}, + {"path": "./demo"}, ] } From fa0e7c7c22bd9d45e7c3bde7ddb1323875223f63 Mon Sep 17 00:00:00 2001 From: MohammadMahdi Zamanian Date: Sat, 29 Oct 2022 17:27:22 +0330 Subject: [PATCH 4/9] feat(`alwatr-icon`): define styles & proprties --- packages/ui/icon/package.json | 8 ++++++-- packages/ui/icon/src/icon.ts | 32 +++++++++++++++++++++++++++++++- packages/ui/icon/tsconfig.json | 8 ++++++-- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/packages/ui/icon/package.json b/packages/ui/icon/package.json index 86c06ba63..7d4bc461c 100644 --- a/packages/ui/icon/package.json +++ b/packages/ui/icon/package.json @@ -1,7 +1,7 @@ { "name": "@alwatr/icon", "version": "0.0.1", - "description": "Premium icons for Ionic. ", + "description": "Premium icons", "keywords": [ "icon", "component", @@ -12,7 +12,10 @@ "main": "icon.js", "type": "module", "types": "icon.d.ts", - "author": "MohammadMahdi Zamanian (https://mm25zamanian.ir)", + "author": "S. Ali Mihandoost (https://ali.mihandoost.com)", + "contributors": [ + "MohammadMahdi Zamanian (https://mm25zamanian.ir)" + ], "license": "MIT", "files": [ "**/*.{d.ts.map,d.ts,js.map,js,html,md}" @@ -31,6 +34,7 @@ }, "dependencies": { "@alwatr/element": "^0.18.0", + "lit": "^2.4.0", "tslib": "^2.3.1" } } diff --git a/packages/ui/icon/src/icon.ts b/packages/ui/icon/src/icon.ts index 8906c70df..3cd056666 100644 --- a/packages/ui/icon/src/icon.ts +++ b/packages/ui/icon/src/icon.ts @@ -1,6 +1,7 @@ import {AlwatrElement} from '@alwatr/element'; import {html, css} from 'lit'; import {customElement} from 'lit/decorators/custom-element.js'; +import {property} from 'lit/decorators/property.js'; import type {TemplateResult} from 'lit'; @@ -10,11 +11,40 @@ export class AlwatrIcon extends AlwatrElement { css` :host { display: inline-block; + width: 1em; + height: 1em; + contain: strict; + fill: currentColor; + box-sizing: content-box !important; + } + svg { + display: block; + + height: 100%; + width: 100%; } `, ]; + @property({reflect: true}) name?: string; + @property({reflect: true}) preurl = 'https://cdn.jsdelivr.net/gh/ionic-team/ionicons@6.0.3/src/svg/'; + override render(): TemplateResult { - return html`

AlWatr Icon Component

`; + return html` + + + + + + `; } } diff --git a/packages/ui/icon/tsconfig.json b/packages/ui/icon/tsconfig.json index 56909057d..11b2bd6fb 100644 --- a/packages/ui/icon/tsconfig.json +++ b/packages/ui/icon/tsconfig.json @@ -7,9 +7,13 @@ "outDir": "." }, // files, include and exclude from the inheriting config are always overwritten. - "include": ["src/**/*"], + "include": [ + "src/**/*" + ], "exclude": [], "references": [ - // { "path": "../x" }, + { + "path": "../../core/element" + }, ] } From 6519f6f05567b8a4ce3db0bd3a442139902a01d4 Mon Sep 17 00:00:00 2001 From: MohammadMahdi Zamanian Date: Sat, 29 Oct 2022 17:28:04 +0330 Subject: [PATCH 5/9] feat(`demo`): improve icon demo --- demo/icon/index.html | 13 +++++++++++++ demo/icon/index.ts | 1 + demo/tsconfig.json | 1 + 3 files changed, 15 insertions(+) create mode 100644 demo/icon/index.html create mode 100644 demo/icon/index.ts diff --git a/demo/icon/index.html b/demo/icon/index.html new file mode 100644 index 000000000..68d1cf07d --- /dev/null +++ b/demo/icon/index.html @@ -0,0 +1,13 @@ + + + + + + @alwatr/icon + + + + + + + diff --git a/demo/icon/index.ts b/demo/icon/index.ts new file mode 100644 index 000000000..ab449b9c6 --- /dev/null +++ b/demo/icon/index.ts @@ -0,0 +1 @@ +import '@alwatr/icon'; diff --git a/demo/tsconfig.json b/demo/tsconfig.json index b14ccee8f..fbdf1970f 100644 --- a/demo/tsconfig.json +++ b/demo/tsconfig.json @@ -11,6 +11,7 @@ {"path": "../packages/core/logger"}, {"path": "../packages/core/fetch"}, {"path": "../packages/core/signal"}, + {"path": "../packages/ui/icon"}, {"path": "../packages/core/router"}, {"path": "../packages/core/i18n"}, {"path": "../packages/core/math"}, From 7873fff095453129e0453268e1d7ab46d86d6ced Mon Sep 17 00:00:00 2001 From: MohammadMahdi Zamanian Date: Mon, 31 Oct 2022 15:33:05 +0330 Subject: [PATCH 6/9] chore: private --- packages/ui/icon/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/ui/icon/package.json b/packages/ui/icon/package.json index 7d4bc461c..af66987d4 100644 --- a/packages/ui/icon/package.json +++ b/packages/ui/icon/package.json @@ -12,13 +12,14 @@ "main": "icon.js", "type": "module", "types": "icon.d.ts", + "private": true, "author": "S. Ali Mihandoost (https://ali.mihandoost.com)", "contributors": [ "MohammadMahdi Zamanian (https://mm25zamanian.ir)" ], "license": "MIT", "files": [ - "**/*.{d.ts.map,d.ts,js.map,js,html,md}" + "**/*.{d.ts.map,d.ts,js.map,js,html,md,svg}" ], "publishConfig": { "access": "public" From 26752bf34376634eac531e066f4a98437fe60b90 Mon Sep 17 00:00:00 2001 From: MohammadMahdi Zamanian Date: Mon, 31 Oct 2022 15:33:44 +0330 Subject: [PATCH 7/9] feat(`alwatr-icon`): svg content --- packages/ui/icon/src/icon.ts | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/packages/ui/icon/src/icon.ts b/packages/ui/icon/src/icon.ts index 3cd056666..bc26f9825 100644 --- a/packages/ui/icon/src/icon.ts +++ b/packages/ui/icon/src/icon.ts @@ -30,21 +30,16 @@ export class AlwatrIcon extends AlwatrElement { @property({reflect: true}) preurl = 'https://cdn.jsdelivr.net/gh/ionic-team/ionicons@6.0.3/src/svg/'; override render(): TemplateResult { - return html` - - - - - - `; + return html` + Book + + `; } } From b1ce3df4dc28c3e32cb02c5efcf518c406ebfa82 Mon Sep 17 00:00:00 2001 From: MohammadMahdi Zamanian Date: Mon, 31 Oct 2022 15:40:00 +0330 Subject: [PATCH 8/9] feat(`alwatr-icon`): reflect property --- packages/ui/icon/src/icon.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ui/icon/src/icon.ts b/packages/ui/icon/src/icon.ts index bc26f9825..0e7d5d02a 100644 --- a/packages/ui/icon/src/icon.ts +++ b/packages/ui/icon/src/icon.ts @@ -26,8 +26,8 @@ export class AlwatrIcon extends AlwatrElement { `, ]; - @property({reflect: true}) name?: string; - @property({reflect: true}) preurl = 'https://cdn.jsdelivr.net/gh/ionic-team/ionicons@6.0.3/src/svg/'; + @property() name?: string; + @property() preurl = 'https://cdn.jsdelivr.net/gh/ionic-team/ionicons@6.0.3/src/svg/'; override render(): TemplateResult { return html` From 3af2dd4ba4a6451d54db7577badce9b279509265 Mon Sep 17 00:00:00 2001 From: MohammadMahdi Zamanian Date: Mon, 31 Oct 2022 15:41:26 +0330 Subject: [PATCH 9/9] feat(`alwatr-icon`): `url-prefix` attr --- packages/ui/icon/src/icon.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ui/icon/src/icon.ts b/packages/ui/icon/src/icon.ts index 0e7d5d02a..c826820b1 100644 --- a/packages/ui/icon/src/icon.ts +++ b/packages/ui/icon/src/icon.ts @@ -27,7 +27,7 @@ export class AlwatrIcon extends AlwatrElement { ]; @property() name?: string; - @property() preurl = 'https://cdn.jsdelivr.net/gh/ionic-team/ionicons@6.0.3/src/svg/'; + @property({attribute: 'url-prefix'}) urlPrefix = 'https://cdn.jsdelivr.net/gh/ionic-team/ionicons@6.0.3/src/svg/'; override render(): TemplateResult { return html`