@tamer4lynx/tamer-icons 0.0.4 → 0.0.5
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 +22 -15
- package/android/build.gradle.kts +2 -0
- package/dist/icon-jsx.d.ts +13 -0
- package/dist/icon-jsx.d.ts.map +1 -0
- package/dist/icon-jsx.js +1 -0
- package/dist/index.d.ts +2 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.jsx +2 -13
- package/package.json +12 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# tamer-icons
|
|
2
2
|
|
|
3
|
-
Icon fonts for Lynx: Material Icons, Font Awesome.
|
|
3
|
+
Icon fonts for Lynx: Material Icons, Font Awesome. Provides TypeScript typings for the native `<icon>` element, font URLs, and codepoint data.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -12,29 +12,36 @@ Add to your app's dependencies and run `t4l link`.
|
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
import { Icon, Tfont, type IconSet } from '@tamer4lynx/tamer-icons'
|
|
15
|
+
Import the package once so JSX knows the `<icon>` intrinsic (or rely on `.tamer/tamer-components.d.ts` from `t4l init` / `t4l link`):
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
```tsx
|
|
18
|
+
import '@tamer4lynx/tamer-icons'
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
<icon
|
|
21
|
+
icon="home"
|
|
22
|
+
set="material"
|
|
23
|
+
size={24}
|
|
24
|
+
iconColor="#333"
|
|
25
|
+
style={{ width: '24px', height: '24px' }}
|
|
26
|
+
/>
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
<Tfont src="https://..." family="MyIcons" />
|
|
26
|
-
<Icon name="custom-icon" set="material" size={32} />
|
|
28
|
+
<icon icon="fa-home" set="fontawesome" size={24} iconColor="#333" style={{ width: '24px', height: '24px' }} />
|
|
27
29
|
```
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
| Attribute | Description |
|
|
32
|
+
|-----------|-------------|
|
|
33
|
+
| `icon` | Icon name / codepoint key |
|
|
34
|
+
| `set` | `'material'` \| `'fontawesome'` \| `'fa'` |
|
|
35
|
+
| `size` | Number (optional; pair with `style` width/height as needed) |
|
|
36
|
+
| `iconColor` | Color string |
|
|
37
|
+
| `style` | Lynx `ViewProps` style (e.g. width/height) |
|
|
30
38
|
|
|
31
|
-
|
|
32
|
-
|-----------|-------|-------------|
|
|
33
|
-
| `Icon` | `name`, `set?`, `size?`, `color?`, `style?` | Renders icon. `set`: `'material'` \| `'fontawesome'` \| `'fa'` |
|
|
34
|
-
| `Tfont` | `src`, `family`, `weight?`, `style?` | Registers custom icon font |
|
|
39
|
+
## Exports
|
|
35
40
|
|
|
36
41
|
| Export | Description |
|
|
37
42
|
|--------|-------------|
|
|
43
|
+
| `IconElementProps` | Props type for `<icon>` |
|
|
44
|
+
| `IconSet` | `'material'` \| `'fontawesome'` \| `'fa'` |
|
|
38
45
|
| `MATERIAL_ICONS_URL` | Material Icons font URL |
|
|
39
46
|
| `FONTAWESOME_SOLID_URL` | Font Awesome solid URL |
|
|
40
47
|
| `MATERIAL_CODEPOINTS` | Material icon codepoint map |
|
package/android/build.gradle.kts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
plugins {
|
|
2
2
|
id("com.android.library")
|
|
3
3
|
id("org.jetbrains.kotlin.android")
|
|
4
|
+
id("org.jetbrains.kotlin.kapt")
|
|
4
5
|
}
|
|
5
6
|
|
|
6
7
|
android {
|
|
@@ -24,5 +25,6 @@ android {
|
|
|
24
25
|
dependencies {
|
|
25
26
|
compileOnly("org.lynxsdk.lynx:lynx:3.3.1")
|
|
26
27
|
compileOnly("org.lynxsdk.lynx:lynx-jssdk:3.3.1")
|
|
28
|
+
kapt("org.lynxsdk.lynx:lynx-processor:3.3.1")
|
|
27
29
|
implementation("androidx.core:core-ktx:1.10.1")
|
|
28
30
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ViewProps } from '@lynx-js/types';
|
|
2
|
+
export type IconElementProps = {
|
|
3
|
+
icon: string;
|
|
4
|
+
set?: 'material' | 'fontawesome' | 'fa';
|
|
5
|
+
iconColor?: string;
|
|
6
|
+
size?: number;
|
|
7
|
+
} & ViewProps;
|
|
8
|
+
declare module '@lynx-js/types' {
|
|
9
|
+
interface IntrinsicElements {
|
|
10
|
+
icon: IconElementProps;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=icon-jsx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon-jsx.d.ts","sourceRoot":"","sources":["../src/icon-jsx.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,UAAU,GAAG,aAAa,GAAG,IAAI,CAAA;IACvC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,GAAG,SAAS,CAAA;AAEb,OAAO,QAAQ,gBAAgB,CAAC;IAC9B,UAAU,iBAAiB;QACzB,IAAI,EAAE,gBAAgB,CAAA;KACvB;CACF"}
|
package/dist/icon-jsx.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference path="./icon-jsx.d.ts" />
|
|
2
|
+
export type { IconElementProps } from './icon-jsx';
|
|
2
3
|
export { MATERIAL_ICONS_URL, FONTAWESOME_SOLID_URL } from './fonts';
|
|
3
4
|
export { MATERIAL_CODEPOINTS } from './material-codepoints';
|
|
4
|
-
export interface TfontProps {
|
|
5
|
-
src: string;
|
|
6
|
-
family: string;
|
|
7
|
-
weight?: number;
|
|
8
|
-
style?: ViewProps['style'];
|
|
9
|
-
}
|
|
10
5
|
export type IconSet = 'material' | 'fontawesome' | 'fa';
|
|
11
|
-
export interface IconProps extends ViewProps {
|
|
12
|
-
name: string;
|
|
13
|
-
set?: IconSet;
|
|
14
|
-
size?: number;
|
|
15
|
-
color?: string;
|
|
16
|
-
}
|
|
17
|
-
export declare function Tfont(props: TfontProps): null;
|
|
18
|
-
export declare function Icon(props: IconProps): any;
|
|
19
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,YAAY,CAAA;AAEnB,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,aAAa,GAAG,IAAI,CAAA"}
|
package/dist/index.jsx
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
+
/// <reference types="@lynx-js/react" />
|
|
2
|
+
import './icon-jsx';
|
|
1
3
|
export { MATERIAL_ICONS_URL, FONTAWESOME_SOLID_URL } from './fonts';
|
|
2
4
|
export { MATERIAL_CODEPOINTS } from './material-codepoints';
|
|
3
|
-
const px = (value) => `${Math.round(value)}px`;
|
|
4
|
-
export function Tfont(props) {
|
|
5
|
-
void props;
|
|
6
|
-
return null;
|
|
7
|
-
}
|
|
8
|
-
export function Icon(props) {
|
|
9
|
-
const { name, set = 'material', size = 24, color, style, ...rest } = props;
|
|
10
|
-
return (<icon icon={name} set={set} size={size} iconColor={color} style={{
|
|
11
|
-
width: px(size),
|
|
12
|
-
height: px(size),
|
|
13
|
-
...style,
|
|
14
|
-
}} {...rest}/>);
|
|
15
|
-
}
|
package/package.json
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"access": "public",
|
|
5
5
|
"tag": "prerelease"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.0.
|
|
7
|
+
"version": "0.0.5",
|
|
8
8
|
"type": "module",
|
|
9
|
-
"description": "Icon fonts for Lynx: Material Icons, Font Awesome.
|
|
9
|
+
"description": "Icon fonts for Lynx: Material Icons, Font Awesome. Native `<icon>` element typings and font URLs.",
|
|
10
10
|
"main": "dist/index.jsx",
|
|
11
11
|
"types": "dist/index.d.ts",
|
|
12
12
|
"exports": {
|
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
"types": "./dist/tamer.config.d.ts",
|
|
20
20
|
"import": "./dist/tamer.config.js",
|
|
21
21
|
"default": "./dist/tamer.config.js"
|
|
22
|
+
},
|
|
23
|
+
"./icon-jsx": {
|
|
24
|
+
"types": "./dist/icon-jsx.d.ts",
|
|
25
|
+
"import": "./dist/icon-jsx.js",
|
|
26
|
+
"default": "./dist/icon-jsx.js"
|
|
22
27
|
}
|
|
23
28
|
},
|
|
24
29
|
"files": [
|
|
@@ -32,13 +37,17 @@
|
|
|
32
37
|
"lynx": {
|
|
33
38
|
"ext": "lynx.ext.json"
|
|
34
39
|
},
|
|
40
|
+
"tamer": {
|
|
41
|
+
"ambientTypeExports": ["./icon-jsx"]
|
|
42
|
+
},
|
|
35
43
|
"peerDependencies": {
|
|
36
44
|
"@lynx-js/react": ">=0.100.0",
|
|
45
|
+
"@lynx-js/types": ">=3.3.0",
|
|
37
46
|
"react": "^17.0.0"
|
|
38
47
|
},
|
|
39
48
|
"scripts": {
|
|
40
49
|
"fetch-fonts": "node scripts/fetch-fonts.mjs",
|
|
41
|
-
"build": "npm run fetch-fonts && node scripts/generate-codepoints.mjs && npm run copy-android-fonts && npm run copy-ios-fonts && rm -rf dist && tsc",
|
|
50
|
+
"build": "npm run fetch-fonts && node scripts/generate-codepoints.mjs && npm run copy-android-fonts && npm run copy-ios-fonts && rm -rf dist && tsc && node ./scripts/patch-index-dts.mjs",
|
|
42
51
|
"copy-android-fonts": "mkdir -p android/src/main/assets/fonts && cp fonts/*.ttf android/src/main/assets/fonts/ 2>/dev/null || true",
|
|
43
52
|
"copy-ios-fonts": "mkdir -p ios/tamericons/tamericons/Resources && cp fonts/MaterialSymbolsOutlined.ttf fonts/fa-solid-900.ttf ios/tamericons/tamericons/Resources/",
|
|
44
53
|
"prepare": "npm run build"
|