@nuralyui/icon 0.0.1

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,11 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class HyIconDemo extends LitElement {
3
+ static readonly styles: import("lit").CSSResult;
4
+ render(): import("lit").TemplateResult<1>;
5
+ }
6
+ declare global {
7
+ interface HTMLElementTagNameMap {
8
+ 'hy-icon-demo': HyIconDemo;
9
+ }
10
+ }
11
+ //# sourceMappingURL=hy-icon-demo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hy-icon-demo.d.ts","sourceRoot":"","sources":["../../../../src/components/icon/demo/hy-icon-demo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAY,MAAM,KAAK,CAAC;AAG1C,qBACa,UAAW,SAAQ,UAAU;IACxC,gBAAyB,MAAM,0BAa7B;IACO,MAAM;CAchB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,UAAU,CAAC;KAC5B;CACF"}
@@ -0,0 +1,43 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { LitElement, css, html } from 'lit';
8
+ import { customElement } from 'lit/decorators.js';
9
+ let HyIconDemo = class HyIconDemo extends LitElement {
10
+ render() {
11
+ return html `
12
+ <h3>Default icon (solid)</h3>
13
+ <hy-icon name="envelope"></hy-icon>
14
+ <h3>Icon with overriden color</h3>
15
+ <hy-icon id="first-icon" name="check"></hy-icon>
16
+ <h3>Icon with overriden size</h3>
17
+ <hy-icon id="second-icon" name="warning"></hy-icon>
18
+ <h3>Icon with overriden size and color</h3>
19
+ <hy-icon id="third-icon" name="bug"></hy-icon>
20
+ <h3>Regular icon</h3>
21
+ <hy-icon name="envelope" type="regular"></hy-icon>
22
+ `;
23
+ }
24
+ };
25
+ HyIconDemo.styles = css `
26
+ #first-icon {
27
+ --hybrid-icon-color: red;
28
+ }
29
+ #second-icon {
30
+ --hybrid-icon-width: 20px;
31
+ --hybrid-icon-height: 25px;
32
+ }
33
+ #third-icon {
34
+ --hybrid-icon-width: 30px;
35
+ --hybrid-icon-height: 35px;
36
+ --hybrid-icon-color: green;
37
+ }
38
+ `;
39
+ HyIconDemo = __decorate([
40
+ customElement('hy-icon-demo')
41
+ ], HyIconDemo);
42
+ export { HyIconDemo };
43
+ //# sourceMappingURL=hy-icon-demo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hy-icon-demo.js","sourceRoot":"","sources":["../../../../src/components/icon/demo/hy-icon-demo.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,UAAU,EAAE,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAGhD,IAAa,UAAU,GAAvB,MAAa,UAAW,SAAQ,UAAU;IAe/B,MAAM;QACb,OAAO,IAAI,CAAA;;;;;;;;;;;KAWV,CAAC;IACJ,CAAC;CACF,CAAA;AA5B0B,iBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;GAanC,CAAA;AAdS,UAAU;IADtB,aAAa,CAAC,cAAc,CAAC;GACjB,UAAU,CA6BtB;SA7BY,UAAU","sourcesContent":["import {LitElement, css, html} from 'lit';\nimport {customElement} from 'lit/decorators.js';\n\n@customElement('hy-icon-demo')\nexport class HyIconDemo extends LitElement {\n static override readonly styles = css`\n #first-icon {\n --hybrid-icon-color: red;\n }\n #second-icon {\n --hybrid-icon-width: 20px;\n --hybrid-icon-height: 25px;\n }\n #third-icon {\n --hybrid-icon-width: 30px;\n --hybrid-icon-height: 35px;\n --hybrid-icon-color: green;\n }\n `;\n override render() {\n return html`\n <h3>Default icon (solid)</h3>\n <hy-icon name=\"envelope\"></hy-icon>\n <h3>Icon with overriden color</h3>\n <hy-icon id=\"first-icon\" name=\"check\"></hy-icon>\n <h3>Icon with overriden size</h3>\n <hy-icon id=\"second-icon\" name=\"warning\"></hy-icon>\n <h3>Icon with overriden size and color</h3>\n <hy-icon id=\"third-icon\" name=\"bug\"></hy-icon>\n <h3>Regular icon</h3>\n <hy-icon name=\"envelope\" type=\"regular\"></hy-icon>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'hy-icon-demo': HyIconDemo;\n }\n}\n"]}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Nuraly Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ /// <reference types="react" />
7
+ import { LitElement } from 'lit';
8
+ import { IconTypes } from './icon.types.js';
9
+ export declare class HyIconElement extends LitElement {
10
+ name: string;
11
+ type: IconTypes;
12
+ static readonly styles: import("lit").CSSResult[];
13
+ render(): import("lit").TemplateResult<1>;
14
+ getIconPath(): any;
15
+ }
16
+ declare global {
17
+ interface HTMLElementTagNameMap {
18
+ 'hy-icon': HyIconElement;
19
+ }
20
+ namespace JSX {
21
+ interface IntrinsicElements {
22
+ 'hy-icon': React.DetailedHTMLProps<React.HTMLAttributes<HyIconElement>, HyIconElement> | Partial<HyIconElement>;
23
+ }
24
+ }
25
+ }
26
+ //# sourceMappingURL=icon.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.component.d.ts","sourceRoot":"","sources":["../../../src/components/icon/icon.component.ts"],"names":[],"mappings":"AACA;;;;GAIG;;AAEH,OAAO,EAAC,UAAU,EAAO,MAAM,KAAK,CAAC;AASrC,OAAO,EAAC,SAAS,EAAiC,MAAM,iBAAiB,CAAC;AAE1E,qBACa,aAAc,SAAQ,UAAU;IAE3C,IAAI,EAAG,MAAM,CAAC;IAEd,IAAI,YAAmB;IAEvB,gBAAyB,MAAM,4BAAU;IAChC,MAAM;IAOf,WAAW;CAKZ;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,aAAa,CAAC;KAC1B;IAED,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;SACjH;KACF;CACF"}
@@ -0,0 +1,51 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ /**
3
+ * @license
4
+ * Copyright 2023 Nuraly Laabidi Aymen
5
+ * SPDX-License-Identifier: MIT
6
+ */
7
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
8
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
11
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
12
+ };
13
+ import { LitElement, html } from 'lit';
14
+ import { customElement, property } from 'lit/decorators.js';
15
+ import { library, dom } from '@fortawesome/fontawesome-svg-core';
16
+ import { far } from '@fortawesome/free-regular-svg-icons';
17
+ import { fas } from '@fortawesome/free-solid-svg-icons';
18
+ library.add(fas, far);
19
+ dom.watch();
20
+ import { styles } from './icon.style.js';
21
+ import { regularIconPack, solidIconPack } from './icon.types.js';
22
+ let HyIconElement = class HyIconElement extends LitElement {
23
+ constructor() {
24
+ super(...arguments);
25
+ this.type = "solid" /* IconTypes.Solid */;
26
+ }
27
+ render() {
28
+ return html `
29
+ <svg class="svg-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 550 550">
30
+ <path d="${this.getIconPath()}" />
31
+ </svg>
32
+ `;
33
+ }
34
+ getIconPath() {
35
+ const iconPack = this.type == "solid" /* IconTypes.Solid */ ? solidIconPack : regularIconPack;
36
+ const iconDefinition = library.definitions[iconPack][this.name];
37
+ return iconDefinition ? iconDefinition[4] : '';
38
+ }
39
+ };
40
+ HyIconElement.styles = styles;
41
+ __decorate([
42
+ property({ type: String })
43
+ ], HyIconElement.prototype, "name", void 0);
44
+ __decorate([
45
+ property()
46
+ ], HyIconElement.prototype, "type", void 0);
47
+ HyIconElement = __decorate([
48
+ customElement('hy-icon')
49
+ ], HyIconElement);
50
+ export { HyIconElement };
51
+ //# sourceMappingURL=icon.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.component.js","sourceRoot":"","sources":["../../../src/components/icon/icon.component.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD;;;;GAIG;;;;;;;AAEH,OAAO,EAAC,UAAU,EAAE,IAAI,EAAC,MAAM,KAAK,CAAC;AACrC,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAC,OAAO,EAAE,GAAG,EAAC,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAC,GAAG,EAAC,MAAM,qCAAqC,CAAC;AACxD,OAAO,EAAC,GAAG,EAAC,MAAM,mCAAmC,CAAC;AACtD,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACtB,GAAG,CAAC,KAAK,EAAE,CAAC;AAEZ,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAY,eAAe,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAG1E,IAAa,aAAa,GAA1B,MAAa,aAAc,SAAQ,UAAU;IAA7C;;QAIE,SAAI,iCAAmB;IAezB,CAAC;IAZU,MAAM;QACb,OAAO,IAAI,CAAA;;mBAEI,IAAI,CAAC,WAAW,EAAE;;KAEhC,CAAC;IACJ,CAAC;IACD,WAAW;QACT,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,iCAAmB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,eAAe,CAAC;QAChF,MAAM,cAAc,GAAI,OAAe,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzE,OAAO,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACjD,CAAC;CACF,CAAA;AAb0B,oBAAM,GAAG,MAAO,CAAA;AAJzC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;2CACX;AAEd;IADC,QAAQ,EAAE;2CACY;AAJZ,aAAa;IADzB,aAAa,CAAC,SAAS,CAAC;GACZ,aAAa,CAmBzB;SAnBY,aAAa","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * @license\n * Copyright 2023 Nuraly Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport {LitElement, html} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\nimport {library, dom} from '@fortawesome/fontawesome-svg-core';\nimport {far} from '@fortawesome/free-regular-svg-icons';\nimport {fas} from '@fortawesome/free-solid-svg-icons';\nlibrary.add(fas, far);\ndom.watch();\n\nimport {styles} from './icon.style.js';\nimport {IconTypes, regularIconPack, solidIconPack} from './icon.types.js';\n\n@customElement('hy-icon')\nexport class HyIconElement extends LitElement {\n @property({type: String})\n name!: string;\n @property()\n type = IconTypes.Solid;\n\n static override readonly styles = styles;\n override render() {\n return html`\n <svg class=\"svg-icon\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 550 550\">\n <path d=\"${this.getIconPath()}\" />\n </svg>\n `;\n }\n getIconPath() {\n const iconPack = this.type == IconTypes.Solid ? solidIconPack : regularIconPack;\n const iconDefinition = (library as any).definitions[iconPack][this.name];\n return iconDefinition ? iconDefinition[4] : '';\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'hy-icon': HyIconElement;\n }\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n 'hy-icon': React.DetailedHTMLProps<React.HTMLAttributes<HyIconElement>, HyIconElement> | Partial<HyIconElement>;\n }\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const styles: import("lit").CSSResult[];
2
+ //# sourceMappingURL=icon.style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.style.d.ts","sourceRoot":"","sources":["../../../src/components/icon/icon.style.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,MAAM,2BAA+B,CAAC"}
package/icon.style.js ADDED
@@ -0,0 +1,11 @@
1
+ import { css } from 'lit';
2
+ import { styleVariables } from './icon.variables.js';
3
+ const iconStyles = css `
4
+ .svg-icon {
5
+ fill: var(--hybrid-icon-color);
6
+ width: var(--hybrid-icon-width);
7
+ height: var(--hybrid-icon-height);
8
+ }
9
+ `;
10
+ export const styles = [iconStyles, styleVariables];
11
+ //# sourceMappingURL=icon.style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.style.js","sourceRoot":"","sources":["../../../src/components/icon/icon.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAEnD,MAAM,UAAU,GAAG,GAAG,CAAA;;;;;;CAMrB,CAAC;AACF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import {css} from 'lit';\nimport {styleVariables} from './icon.variables.js';\n\nconst iconStyles = css`\n .svg-icon {\n fill: var(--hybrid-icon-color);\n width: var(--hybrid-icon-width);\n height: var(--hybrid-icon-height);\n }\n`;\nexport const styles = [iconStyles, styleVariables];\n"]}
@@ -0,0 +1,7 @@
1
+ export declare const enum IconTypes {
2
+ Solid = "solid",
3
+ Regular = "regular"
4
+ }
5
+ export declare const solidIconPack = "fas";
6
+ export declare const regularIconPack = "far";
7
+ //# sourceMappingURL=icon.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.types.d.ts","sourceRoot":"","sources":["../../../src/components/icon/icon.types.ts"],"names":[],"mappings":"AAAA,0BAAkB,SAAS;IACzB,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AACD,eAAO,MAAM,aAAa,QAAQ,CAAC;AACnC,eAAO,MAAM,eAAe,QAAQ,CAAC"}
package/icon.types.js ADDED
@@ -0,0 +1,3 @@
1
+ export const solidIconPack = 'fas';
2
+ export const regularIconPack = 'far';
3
+ //# sourceMappingURL=icon.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.types.js","sourceRoot":"","sources":["../../../src/components/icon/icon.types.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC;AACnC,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC","sourcesContent":["export const enum IconTypes {\n Solid = 'solid',\n Regular = 'regular',\n}\nexport const solidIconPack = 'fas';\nexport const regularIconPack = 'far';\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const styleVariables: import("lit").CSSResult;
2
+ //# sourceMappingURL=icon.variables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.variables.d.ts","sourceRoot":"","sources":["../../../src/components/icon/icon.variables.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,yBAW1B,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { css } from 'lit';
2
+ export const styleVariables = css `
3
+ :host {
4
+ --hybrid-icon-color: #000000;
5
+ --hybrid-icon-width: 14px;
6
+ --hybrid-icon-height: 15px;
7
+ }
8
+ @media (prefers-color-scheme: dark) {
9
+ :host {
10
+ --hybrid-icon-color: #ffffff;
11
+ }
12
+ }
13
+ `;
14
+ //# sourceMappingURL=icon.variables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.variables.js","sourceRoot":"","sources":["../../../src/components/icon/icon.variables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;;;;;;;;;;;CAWhC,CAAC","sourcesContent":["import {css} from 'lit';\n\nexport const styleVariables = css`\n :host {\n --hybrid-icon-color: #000000;\n --hybrid-icon-width: 14px;\n --hybrid-icon-height: 15px;\n }\n @media (prefers-color-scheme: dark) {\n :host {\n --hybrid-icon-color: #ffffff;\n }\n }\n`;\n"]}
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './icon.component.js';
2
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/icon/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
package/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './icon.component.js';
2
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/icon/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './icon.component.js';\n"]}
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@nuralyui/icon",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "author": "Labidi Aymen",
11
+ "license": "ISC"
12
+ }
package/react.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { HyIconElement } from './icon.component.js';
2
+ export declare const HyIcon: import("@lit-labs/react").ReactWebComponent<HyIconElement, {}>;
3
+ //# sourceMappingURL=react.d.ts.map
package/react.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/components/icon/react.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAClD,eAAO,MAAM,MAAM,gEAIjB,CAAC"}
package/react.js ADDED
@@ -0,0 +1,9 @@
1
+ import { createComponent } from '@lit-labs/react';
2
+ import * as React from 'react';
3
+ import { HyIconElement } from './icon.component.js';
4
+ export const HyIcon = createComponent({
5
+ tagName: 'hy-icon',
6
+ elementClass: HyIconElement,
7
+ react: React,
8
+ });
9
+ //# sourceMappingURL=react.js.map
package/react.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../../../src/components/icon/react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAClD,MAAM,CAAC,MAAM,MAAM,GAAG,eAAe,CAAC;IACpC,OAAO,EAAE,SAAS;IAClB,YAAY,EAAE,aAAa;IAC3B,KAAK,EAAE,KAAK;CACb,CAAC,CAAC","sourcesContent":["import {createComponent} from '@lit-labs/react';\nimport * as React from 'react';\nimport {HyIconElement} from './icon.component.js';\nexport const HyIcon = createComponent({\n tagName: 'hy-icon',\n elementClass: HyIconElement,\n react: React,\n});\n"]}