@shish2k/react-faicon 0.0.1 → 0.1.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/dist/index.d.ts CHANGED
@@ -1,7 +1,17 @@
1
- import type { RefAttributes, SVGAttributes } from 'react';
2
- import type { IconDefinition } from '@fortawesome/fontawesome-common-types';
3
- export interface FAIconProps extends Omit<SVGAttributes<SVGSVGElement>, 'children' | 'mask' | 'transform'>, RefAttributes<SVGSVGElement> {
4
- icon: IconDefinition;
5
- className?: string;
1
+ import { ReactElement, RefAttributes, SVGAttributes } from "react";
2
+ import { IconDefinition } from "@fortawesome/fontawesome-common-types";
3
+
4
+ //#region src/index.d.ts
5
+ interface FAIconProps extends Omit<SVGAttributes<SVGSVGElement>, 'children' | 'mask' | 'transform'>, RefAttributes<SVGSVGElement> {
6
+ icon: IconDefinition;
7
+ className?: string;
6
8
  }
7
- export declare function FAIcon({ icon, className, ...svgProps }: FAIconProps): import("react/jsx-runtime").JSX.Element;
9
+ declare function FAIcon({
10
+ icon,
11
+ className,
12
+ style,
13
+ ...svgProps
14
+ }: FAIconProps): ReactElement;
15
+ //#endregion
16
+ export { FAIcon, FAIconProps };
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;UAQiB,WAAA,SACP,IAAA,CAAK,aAAA,CAAc,aAAA,uCACzB,aAAA,CAAc,aAAA;EAChB,IAAA,EAAM,cAAA;EACN,SAAA;AAAA;AAAA,iBAGc,MAAA,CAAA;EACd,IAAA;EACA,SAAA;EACA,KAAA;EAAA,GACG;AAAA,GACF,WAAA,GAAc,YAAA"}
package/dist/index.js CHANGED
@@ -1,31 +1,34 @@
1
- import { jsx } from "react/jsx-runtime";
2
- function FAIcon({ icon, className = '', ...svgProps }) {
3
- let [width, height, _ligatures, _unicode, svgPathData] = icon.icon;
4
- if ('string' == typeof svgPathData) svgPathData = [
5
- svgPathData
6
- ];
7
- return /*#__PURE__*/ jsx("svg", {
8
- "aria-hidden": "true",
9
- focusable: "false",
10
- "data-prefix": icon.prefix,
11
- "data-icon": icon.iconName,
12
- className: `fa-${icon.iconName} ${className}`,
13
- style: {
14
- boxSizing: 'content-box',
15
- display: 'inline-block',
16
- height: '1em',
17
- width: '1em',
18
- overflow: 'visible',
19
- verticalAlign: '-0.125em'
20
- },
21
- role: "img",
22
- xmlns: "http://www.w3.org/2000/svg",
23
- viewBox: `0 0 ${width} ${height}`,
24
- ...svgProps,
25
- children: svgPathData.map((d, i)=>/*#__PURE__*/ jsx("path", {
26
- fill: "currentColor",
27
- d: d
28
- }, i))
29
- });
1
+ import { createElement } from "react";
2
+ //#region src/index.ts
3
+ function FAIcon({ icon, className = "", style, ...svgProps }) {
4
+ let [width, height, _ligatures, _unicode, svgPathData] = icon.icon;
5
+ if (typeof svgPathData === "string") svgPathData = [svgPathData];
6
+ return createElement("svg", {
7
+ "aria-hidden": "true",
8
+ focusable: "false",
9
+ "data-prefix": icon.prefix,
10
+ "data-icon": icon.iconName,
11
+ className: `fa-${icon.iconName} ${className}`,
12
+ style: {
13
+ boxSizing: "content-box",
14
+ display: "inline-block",
15
+ height: "1em",
16
+ width: "1em",
17
+ overflow: "visible",
18
+ verticalAlign: "-0.125em",
19
+ ...style
20
+ },
21
+ role: "img",
22
+ xmlns: "http://www.w3.org/2000/svg",
23
+ viewBox: `0 0 ${width} ${height}`,
24
+ ...svgProps
25
+ }, ...svgPathData.map((d) => createElement("path", {
26
+ key: d,
27
+ fill: "currentColor",
28
+ d
29
+ })));
30
30
  }
31
+ //#endregion
31
32
  export { FAIcon };
33
+
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["// This is a minimal reimplementation of FontAwesomeIcon\n// to avoid pulling in the whole ~80kb library\n// See https://docs.fontawesome.com/v5/web/use-with/react\n\nimport type { IconDefinition } from '@fortawesome/fontawesome-common-types';\nimport type { ReactElement, RefAttributes, SVGAttributes } from 'react';\nimport { createElement } from 'react';\n\nexport interface FAIconProps\n extends Omit<SVGAttributes<SVGSVGElement>, 'children' | 'mask' | 'transform'>,\n RefAttributes<SVGSVGElement> {\n icon: IconDefinition;\n className?: string;\n}\n\nexport function FAIcon({\n icon,\n className = '',\n style,\n ...svgProps\n}: FAIconProps): ReactElement {\n let [width, height, _ligatures, _unicode, svgPathData] = icon.icon;\n if (typeof svgPathData === 'string') {\n svgPathData = [svgPathData];\n }\n return createElement(\n 'svg',\n {\n 'aria-hidden': 'true',\n focusable: 'false',\n 'data-prefix': icon.prefix,\n 'data-icon': icon.iconName,\n className: `fa-${icon.iconName} ${className}`,\n style: {\n boxSizing: 'content-box',\n display: 'inline-block',\n height: '1em',\n width: '1em',\n overflow: 'visible',\n verticalAlign: '-0.125em',\n ...style,\n },\n role: 'img',\n xmlns: 'http://www.w3.org/2000/svg',\n viewBox: `0 0 ${width} ${height}`,\n ...svgProps,\n },\n ...svgPathData.map((d) =>\n createElement('path', { key: d, fill: 'currentColor', d }),\n ),\n );\n}\n"],"mappings":";;AAeA,SAAgB,OAAO,EACrB,MACA,YAAY,IACZ,OACA,GAAG,YACyB;CAC5B,IAAI,CAAC,OAAO,QAAQ,YAAY,UAAU,eAAe,KAAK;AAC9D,KAAI,OAAO,gBAAgB,SACzB,eAAc,CAAC,YAAY;AAE7B,QAAO,cACL,OACA;EACE,eAAe;EACf,WAAW;EACX,eAAe,KAAK;EACpB,aAAa,KAAK;EAClB,WAAW,MAAM,KAAK,SAAS,GAAG;EAClC,OAAO;GACL,WAAW;GACX,SAAS;GACT,QAAQ;GACR,OAAO;GACP,UAAU;GACV,eAAe;GACf,GAAG;GACJ;EACD,MAAM;EACN,OAAO;EACP,SAAS,OAAO,MAAM,GAAG;EACzB,GAAG;EACJ,EACD,GAAG,YAAY,KAAK,MAClB,cAAc,QAAQ;EAAE,KAAK;EAAG,MAAM;EAAgB;EAAG,CAAC,CAC3D,CACF"}
package/package.json CHANGED
@@ -1,42 +1,55 @@
1
1
  {
2
2
  "name": "@shish2k/react-faicon",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "A tiny (<1kb) fontawesome icon renderer",
6
+ "keywords": [
7
+ "react",
8
+ "icon"
9
+ ],
4
10
  "author": "Shish <shish+npm@shishnet.org>",
5
11
  "license": "MIT",
6
- "repository": "shish/react-faicon",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/shish/react-faicon.git"
15
+ },
7
16
  "homepage": "https://github.com/shish/react-faicon",
8
17
  "bugs": {
9
18
  "url": "https://github.com/shish/react-faicon/issues"
10
19
  },
11
- "type": "module",
20
+ "main": "./dist/index.js",
21
+ "types": "./dist/index.d.ts",
12
22
  "exports": {
13
23
  ".": {
14
24
  "types": "./dist/index.d.ts",
15
- "import": "./dist/index.js"
25
+ "default": "./dist/index.js"
16
26
  }
17
27
  },
18
- "types": "./dist/index.d.ts",
19
28
  "files": [
20
29
  "dist"
21
30
  ],
22
- "scripts": {
23
- "build": "rslib build",
24
- "check": "biome check --write",
25
- "dev": "rslib build --watch",
26
- "format": "biome format --write",
27
- "release": "git tag $npm_package_version && git push && git push --tags && npm publish --tag latest --access public"
28
- },
29
- "devDependencies": {
30
- "@biomejs/biome": "2.3.2",
31
- "@rsbuild/plugin-react": "^1.4.2",
32
- "@rslib/core": "^0.18.2",
33
- "@types/react": "^19.2.6",
34
- "react": "^19.2.0",
35
- "typescript": "^5.9.3"
36
- },
37
31
  "peerDependencies": {
38
32
  "react": ">=16.9.0",
39
- "react-dom": ">=16.9.0",
40
33
  "@fortawesome/fontawesome-common-types": ">=7.0.0"
34
+ },
35
+ "devDependencies": {
36
+ "@biomejs/biome": "^2.0",
37
+ "@types/react": "^19.0",
38
+ "react": "^19.0",
39
+ "tsdown": "^0.21",
40
+ "typescript": "^6.0"
41
+ },
42
+ "scripts": {
43
+ "format": "biome format --write .",
44
+ "lint": "biome lint .",
45
+ "check": "biome check --write .",
46
+ "build": "tsdown",
47
+ "check-git-clean": "test $(git rev-parse --abbrev-ref HEAD) = main || (echo 'please checkout the main branch to make a release!' >&2 && exit 1) && test -z \"$(git status --porcelain)\" || (echo 'please commit your changes before making a release!' >&2 && exit 1)",
48
+ "prepare": "npm run build",
49
+ "prepublishOnly": "npm run check",
50
+ "release": "npm run check-git-clean && git tag $npm_package_version && git push && git push --tags && npm publish --tag latest --access public"
51
+ },
52
+ "tsdown": {
53
+ "platform": "browser"
41
54
  }
42
55
  }