@diteme/emojis 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/README.md +143 -0
- package/dist/ai_tutor-WNHWQYDP.png +0 -0
- package/dist/coins-O4IPZ7NP.png +0 -0
- package/dist/components/Avatar.d.ts +4 -0
- package/dist/components/Avatar.d.ts.map +1 -0
- package/dist/components/Avatar.native.d.ts +4 -0
- package/dist/components/Avatar.native.d.ts.map +1 -0
- package/dist/components/Emoji.d.ts +4 -0
- package/dist/components/Emoji.d.ts.map +1 -0
- package/dist/components/Emoji.native.d.ts +4 -0
- package/dist/components/Emoji.native.d.ts.map +1 -0
- package/dist/components/NativePrimitiveImage.d.ts +8 -0
- package/dist/components/NativePrimitiveImage.d.ts.map +1 -0
- package/dist/components/PrimitiveImage.d.ts +8 -0
- package/dist/components/PrimitiveImage.d.ts.map +1 -0
- package/dist/components/createEmojiComponent.d.ts +6 -0
- package/dist/components/createEmojiComponent.d.ts.map +1 -0
- package/dist/components/createNativeEmojiComponent.d.ts +4 -0
- package/dist/components/createNativeEmojiComponent.d.ts.map +1 -0
- package/dist/congratulations-ASF4U4ZT.png +0 -0
- package/dist/conversation-RQCTXP2V.png +0 -0
- package/dist/daily-challenge-ETWYJP6A.png +0 -0
- package/dist/disappointed-ZTUVBCHH.png +0 -0
- package/dist/downloads-MHRIFXAD.png +0 -0
- package/dist/experience-DZI47QB2.png +0 -0
- package/dist/favorites-D252WOG6.png +0 -0
- package/dist/fill-in-the-blanks-M77OTWD5.png +0 -0
- package/dist/flashcards-KDHV7RYV.png +0 -0
- package/dist/generated.d.ts +100 -0
- package/dist/generated.d.ts.map +1 -0
- package/dist/generated.native.d.ts +34 -0
- package/dist/generated.native.d.ts.map +1 -0
- package/dist/happy-YJGFQKB6.png +0 -0
- package/dist/high_five-HQXYZPSY.png +0 -0
- package/dist/index.cjs +478 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +400 -0
- package/dist/index.js.map +1 -0
- package/dist/index.native.cjs +460 -0
- package/dist/index.native.cjs.map +1 -0
- package/dist/index.native.d.ts +7 -0
- package/dist/index.native.d.ts.map +1 -0
- package/dist/index.native.js +382 -0
- package/dist/index.native.js.map +1 -0
- package/dist/leaderboard-LSTOIIHH.png +0 -0
- package/dist/lessons-TDLQ53WK.png +0 -0
- package/dist/level_up-HAS7QDZ6.png +0 -0
- package/dist/listening-WLOQCLXP.png +0 -0
- package/dist/master-X6PI6XFY.png +0 -0
- package/dist/matching-MBZYB3CK.png +0 -0
- package/dist/offline_mode-VZCIU7GA.png +0 -0
- package/dist/pronounciation-RUNA2US6.png +0 -0
- package/dist/proud-E3JWJCQT.png +0 -0
- package/dist/proverbs-FPHAQNJO.png +0 -0
- package/dist/quiz-EVDBV2KO.png +0 -0
- package/dist/reading-ILT7U2L4.png +0 -0
- package/dist/reading-MQFP6R2R.png +0 -0
- package/dist/registry/avatarRegistry.d.ts +26 -0
- package/dist/registry/avatarRegistry.d.ts.map +1 -0
- package/dist/registry/emojiRegistry.d.ts +38 -0
- package/dist/registry/emojiRegistry.d.ts.map +1 -0
- package/dist/reward-PPH4P2MK.png +0 -0
- package/dist/rewards-MSB2SMRJ.png +0 -0
- package/dist/sad-6QTYKR6L.png +0 -0
- package/dist/speaking-QZUAZHPF.png +0 -0
- package/dist/streak-IID4BHCE.png +0 -0
- package/dist/surprised-75YTN54Y.png +0 -0
- package/dist/team_victory-QIHTVW2O.png +0 -0
- package/dist/thinking-SMJV3B45.png +0 -0
- package/dist/translate-XPSXXHX5.png +0 -0
- package/dist/trophy-C5CZ5KAE.png +0 -0
- package/dist/types.d.ts +30 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/nativeStyles.d.ts +3 -0
- package/dist/utils/nativeStyles.d.ts.map +1 -0
- package/dist/utils/styles.d.ts +5 -0
- package/dist/utils/styles.d.ts.map +1 -0
- package/dist/waving-GIM4YVJK.png +0 -0
- package/dist/winner-MZFH4NCH.png +0 -0
- package/dist/writing-BLTJ4UKC.png +0 -0
- package/dist/xp_earned-SEZGMCR3.png +0 -0
- package/package.json +81 -0
- package/src/__tests__/emojis.test.tsx +43 -0
- package/src/assets/avatars/zebra/congratulations.png +0 -0
- package/src/assets/avatars/zebra/disappointed.png +0 -0
- package/src/assets/avatars/zebra/happy.png +0 -0
- package/src/assets/avatars/zebra/proud.png +0 -0
- package/src/assets/avatars/zebra/reading.png +0 -0
- package/src/assets/avatars/zebra/sad.png +0 -0
- package/src/assets/avatars/zebra/surprised.png +0 -0
- package/src/assets/avatars/zebra/thinking.png +0 -0
- package/src/assets/emojis/ai_tutor.png +0 -0
- package/src/assets/emojis/coins.png +0 -0
- package/src/assets/emojis/conversation.png +0 -0
- package/src/assets/emojis/daily-challenge.png +0 -0
- package/src/assets/emojis/downloads.png +0 -0
- package/src/assets/emojis/experience.png +0 -0
- package/src/assets/emojis/favorites.png +0 -0
- package/src/assets/emojis/fill-in-the-blanks.png +0 -0
- package/src/assets/emojis/flashcards.png +0 -0
- package/src/assets/emojis/high_five.png +0 -0
- package/src/assets/emojis/leaderboard.png +0 -0
- package/src/assets/emojis/lessons.png +0 -0
- package/src/assets/emojis/level_up.png +0 -0
- package/src/assets/emojis/listening.png +0 -0
- package/src/assets/emojis/master.png +0 -0
- package/src/assets/emojis/matching.png +0 -0
- package/src/assets/emojis/offline_mode.png +0 -0
- package/src/assets/emojis/pronounciation.png +0 -0
- package/src/assets/emojis/proverbs.png +0 -0
- package/src/assets/emojis/quiz.png +0 -0
- package/src/assets/emojis/reading.png +0 -0
- package/src/assets/emojis/reward.png +0 -0
- package/src/assets/emojis/rewards.png +0 -0
- package/src/assets/emojis/speaking.png +0 -0
- package/src/assets/emojis/streak/streak.png +0 -0
- package/src/assets/emojis/streak.png +0 -0
- package/src/assets/emojis/team_victory.png +0 -0
- package/src/assets/emojis/translate.png +0 -0
- package/src/assets/emojis/trophy.png +0 -0
- package/src/assets/emojis/waving.png +0 -0
- package/src/assets/emojis/winner.png +0 -0
- package/src/assets/emojis/writing.png +0 -0
- package/src/assets/emojis/xp_earned.png +0 -0
- package/src/components/Avatar.native.tsx +22 -0
- package/src/components/Avatar.tsx +22 -0
- package/src/components/Emoji.native.tsx +21 -0
- package/src/components/Emoji.tsx +21 -0
- package/src/components/NativePrimitiveImage.tsx +28 -0
- package/src/components/PrimitiveImage.tsx +42 -0
- package/src/components/createEmojiComponent.tsx +26 -0
- package/src/components/createNativeEmojiComponent.tsx +29 -0
- package/src/generated.native.ts +80 -0
- package/src/generated.ts +80 -0
- package/src/index.native.ts +22 -0
- package/src/index.ts +22 -0
- package/src/png.d.ts +4 -0
- package/src/react-native.d.ts +18 -0
- package/src/registry/avatarRegistry.ts +41 -0
- package/src/registry/emojiRegistry.ts +76 -0
- package/src/types.ts +81 -0
- package/src/utils/nativeStyles.ts +18 -0
- package/src/utils/styles.ts +23 -0
package/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@diteme/emojis",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Production-ready Diteme emoji and mascot components for React, Next.js, Vite, CRA, Expo, and React Native.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"diteme",
|
|
7
|
+
"emoji",
|
|
8
|
+
"emojis",
|
|
9
|
+
"avatar",
|
|
10
|
+
"mascot",
|
|
11
|
+
"react",
|
|
12
|
+
"react-native",
|
|
13
|
+
"expo",
|
|
14
|
+
"nextjs",
|
|
15
|
+
"vite",
|
|
16
|
+
"typescript"
|
|
17
|
+
],
|
|
18
|
+
"homepage": "https://github.com/diteme/emojis#readme",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/diteme/emojis/issues"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/diteme/emojis.git"
|
|
25
|
+
},
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"author": "Diteme",
|
|
28
|
+
"type": "module",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"react-native": "./src/index.native.ts",
|
|
33
|
+
"import": "./dist/index.js",
|
|
34
|
+
"require": "./dist/index.cjs"
|
|
35
|
+
},
|
|
36
|
+
"./native": {
|
|
37
|
+
"types": "./dist/index.native.d.ts",
|
|
38
|
+
"import": "./dist/index.native.js",
|
|
39
|
+
"require": "./dist/index.native.cjs"
|
|
40
|
+
},
|
|
41
|
+
"./package.json": "./package.json"
|
|
42
|
+
},
|
|
43
|
+
"main": "./dist/index.cjs",
|
|
44
|
+
"types": "./dist/index.d.ts",
|
|
45
|
+
"files": [
|
|
46
|
+
"dist",
|
|
47
|
+
"src",
|
|
48
|
+
"README.md",
|
|
49
|
+
"package.json"
|
|
50
|
+
],
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "tsup --config tsup.config.mjs && node ./scripts/copy-assets.mjs",
|
|
53
|
+
"dev": "tsup --config tsup.config.mjs --watch",
|
|
54
|
+
"test": "vitest run",
|
|
55
|
+
"typecheck": "tsc --noEmit"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@types/react": "^19.0.0",
|
|
59
|
+
"@types/react-dom": "^19.0.0",
|
|
60
|
+
"react": "^19.0.0",
|
|
61
|
+
"react-dom": "^19.0.0",
|
|
62
|
+
"tsup": "^8.5.1",
|
|
63
|
+
"typescript": "^5.7.2",
|
|
64
|
+
"vitest": "^4.1.10"
|
|
65
|
+
},
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"react": ">=18.3.0 || >=19.0.0",
|
|
68
|
+
"react-native": ">=0.74.0"
|
|
69
|
+
},
|
|
70
|
+
"peerDependenciesMeta": {
|
|
71
|
+
"react-native": {
|
|
72
|
+
"optional": true
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"publishConfig": {
|
|
76
|
+
"access": "public"
|
|
77
|
+
},
|
|
78
|
+
"sideEffects": false,
|
|
79
|
+
"module": "./dist/index.js",
|
|
80
|
+
"react-native": "./src/index.native.ts"
|
|
81
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
3
|
+
import { describe, expect, it } from "vitest";
|
|
4
|
+
import {
|
|
5
|
+
Avatar,
|
|
6
|
+
Emoji,
|
|
7
|
+
Trophy,
|
|
8
|
+
avatarRegistry,
|
|
9
|
+
emojiRegistry,
|
|
10
|
+
getAvatarAsset,
|
|
11
|
+
getEmojiAsset,
|
|
12
|
+
} from "../index";
|
|
13
|
+
|
|
14
|
+
describe("@diteme/emojis", () => {
|
|
15
|
+
it("loads the emoji registry", () => {
|
|
16
|
+
expect(emojiRegistry.trophy).toBeDefined();
|
|
17
|
+
expect(getEmojiAsset("translate")?.type).toBe("png");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("loads the avatar registry", () => {
|
|
21
|
+
expect(avatarRegistry.zebra.happy).toBeDefined();
|
|
22
|
+
expect(getAvatarAsset("zebra", "reading")?.type).toBe("png");
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("renders components", () => {
|
|
26
|
+
expect(renderToStaticMarkup(<Emoji name="trophy" size={64} />)).toContain(
|
|
27
|
+
"img",
|
|
28
|
+
);
|
|
29
|
+
expect(
|
|
30
|
+
renderToStaticMarkup(
|
|
31
|
+
<Avatar character="zebra" mood="happy" size={220} />,
|
|
32
|
+
),
|
|
33
|
+
).toContain("img");
|
|
34
|
+
expect(renderToStaticMarkup(<Trophy size={48} />)).toContain("img");
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("falls back gracefully for invalid emoji names", () => {
|
|
38
|
+
const html = renderToStaticMarkup(<Emoji name="not-real" size={32} />);
|
|
39
|
+
|
|
40
|
+
expect(html).toContain("data-diteme-missing-asset");
|
|
41
|
+
expect(html).toContain("not-real");
|
|
42
|
+
});
|
|
43
|
+
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { NativePrimitiveImage } from "./NativePrimitiveImage";
|
|
3
|
+
import { getAvatarAsset } from "../registry/avatarRegistry";
|
|
4
|
+
import type { AvatarProps } from "../types";
|
|
5
|
+
|
|
6
|
+
export const Avatar = React.memo(function Avatar({
|
|
7
|
+
character,
|
|
8
|
+
mood,
|
|
9
|
+
alt = `${character} ${mood}`,
|
|
10
|
+
...props
|
|
11
|
+
}: AvatarProps) {
|
|
12
|
+
const asset = getAvatarAsset(character, mood);
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<NativePrimitiveImage
|
|
16
|
+
{...props}
|
|
17
|
+
alt={alt}
|
|
18
|
+
fallbackLabel={`${character}:${mood}`}
|
|
19
|
+
source={asset?.source}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { PrimitiveImage } from "./PrimitiveImage";
|
|
3
|
+
import { getAvatarAsset } from "../registry/avatarRegistry";
|
|
4
|
+
import type { AvatarProps } from "../types";
|
|
5
|
+
|
|
6
|
+
export const Avatar = React.memo(function Avatar({
|
|
7
|
+
character,
|
|
8
|
+
mood,
|
|
9
|
+
alt = `${character} ${mood}`,
|
|
10
|
+
...props
|
|
11
|
+
}: AvatarProps) {
|
|
12
|
+
const asset = getAvatarAsset(character, mood);
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<PrimitiveImage
|
|
16
|
+
{...props}
|
|
17
|
+
alt={alt}
|
|
18
|
+
fallbackLabel={`${character}:${mood}`}
|
|
19
|
+
source={asset?.source}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { NativePrimitiveImage } from "./NativePrimitiveImage";
|
|
3
|
+
import { getEmojiAsset } from "../registry/emojiRegistry";
|
|
4
|
+
import type { EmojiProps } from "../types";
|
|
5
|
+
|
|
6
|
+
export const Emoji = React.memo(function Emoji({
|
|
7
|
+
name,
|
|
8
|
+
alt = name,
|
|
9
|
+
...props
|
|
10
|
+
}: EmojiProps) {
|
|
11
|
+
const asset = getEmojiAsset(name);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<NativePrimitiveImage
|
|
15
|
+
{...props}
|
|
16
|
+
alt={alt}
|
|
17
|
+
fallbackLabel={name}
|
|
18
|
+
source={asset?.source}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { PrimitiveImage } from "./PrimitiveImage";
|
|
3
|
+
import { getEmojiAsset } from "../registry/emojiRegistry";
|
|
4
|
+
import type { EmojiProps } from "../types";
|
|
5
|
+
|
|
6
|
+
export const Emoji = React.memo(function Emoji({
|
|
7
|
+
name,
|
|
8
|
+
alt = name,
|
|
9
|
+
...props
|
|
10
|
+
}: EmojiProps) {
|
|
11
|
+
const asset = getEmojiAsset(name);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<PrimitiveImage
|
|
15
|
+
{...props}
|
|
16
|
+
alt={alt}
|
|
17
|
+
fallbackLabel={name}
|
|
18
|
+
source={asset?.source}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Image, View } from "react-native";
|
|
3
|
+
import { getNativeImageStyle } from "../utils/nativeStyles";
|
|
4
|
+
import type { BaseImageProps } from "../types";
|
|
5
|
+
|
|
6
|
+
export interface NativePrimitiveImageProps extends BaseImageProps {
|
|
7
|
+
source?: unknown;
|
|
8
|
+
fallbackLabel: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const NativePrimitiveImage = React.memo(function NativePrimitiveImage({
|
|
12
|
+
source,
|
|
13
|
+
fallbackLabel,
|
|
14
|
+
alt = fallbackLabel,
|
|
15
|
+
objectFit = "contain",
|
|
16
|
+
...styleProps
|
|
17
|
+
}: NativePrimitiveImageProps) {
|
|
18
|
+
const style = getNativeImageStyle(styleProps);
|
|
19
|
+
const resizeMode = objectFit === "cover" ? "cover" : "contain";
|
|
20
|
+
|
|
21
|
+
if (!source) {
|
|
22
|
+
return <View accessibilityLabel={alt} style={style} />;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Image accessibilityLabel={alt} resizeMode={resizeMode} source={source} style={style} />
|
|
27
|
+
);
|
|
28
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { getImageStyle } from "../utils/styles";
|
|
3
|
+
import type { BaseImageProps } from "../types";
|
|
4
|
+
|
|
5
|
+
export interface PrimitiveImageProps extends BaseImageProps {
|
|
6
|
+
source?: unknown;
|
|
7
|
+
fallbackLabel: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const PrimitiveImage = React.memo(function PrimitiveImage({
|
|
11
|
+
source,
|
|
12
|
+
fallbackLabel,
|
|
13
|
+
alt = fallbackLabel,
|
|
14
|
+
loading = "lazy",
|
|
15
|
+
className,
|
|
16
|
+
...styleProps
|
|
17
|
+
}: PrimitiveImageProps) {
|
|
18
|
+
const style = getImageStyle(styleProps);
|
|
19
|
+
|
|
20
|
+
if (typeof source !== "string" || source.length === 0) {
|
|
21
|
+
return (
|
|
22
|
+
<span
|
|
23
|
+
aria-label={alt}
|
|
24
|
+
className={className}
|
|
25
|
+
data-diteme-missing-asset={fallbackLabel}
|
|
26
|
+
role="img"
|
|
27
|
+
style={style}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<img
|
|
34
|
+
alt={alt}
|
|
35
|
+
className={className}
|
|
36
|
+
decoding="async"
|
|
37
|
+
loading={loading}
|
|
38
|
+
src={source}
|
|
39
|
+
style={style}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { PrimitiveImage } from "./PrimitiveImage";
|
|
3
|
+
import type { BaseImageProps, EmojiName } from "../types";
|
|
4
|
+
|
|
5
|
+
export function createEmojiComponent(name: EmojiName | (string & {}), source: unknown) {
|
|
6
|
+
const Component = React.memo(function DitemeEmoji({
|
|
7
|
+
alt = name,
|
|
8
|
+
...props
|
|
9
|
+
}: Omit<BaseImageProps, "animated"> & { animated?: boolean }) {
|
|
10
|
+
return (
|
|
11
|
+
<PrimitiveImage
|
|
12
|
+
{...props}
|
|
13
|
+
alt={alt}
|
|
14
|
+
fallbackLabel={name}
|
|
15
|
+
source={source}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
Component.displayName = name
|
|
21
|
+
.split(/[-_]/)
|
|
22
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
23
|
+
.join("");
|
|
24
|
+
|
|
25
|
+
return Component;
|
|
26
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { NativePrimitiveImage } from "./NativePrimitiveImage";
|
|
3
|
+
import type { BaseImageProps, EmojiName } from "../types";
|
|
4
|
+
|
|
5
|
+
export function createNativeEmojiComponent(
|
|
6
|
+
name: EmojiName | (string & {}),
|
|
7
|
+
source: unknown,
|
|
8
|
+
) {
|
|
9
|
+
const Component = React.memo(function DitemeNativeEmoji({
|
|
10
|
+
alt = name,
|
|
11
|
+
...props
|
|
12
|
+
}: BaseImageProps) {
|
|
13
|
+
return (
|
|
14
|
+
<NativePrimitiveImage
|
|
15
|
+
{...props}
|
|
16
|
+
alt={alt}
|
|
17
|
+
fallbackLabel={name}
|
|
18
|
+
source={source}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
Component.displayName = name
|
|
24
|
+
.split(/[-_]/)
|
|
25
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
26
|
+
.join("");
|
|
27
|
+
|
|
28
|
+
return Component;
|
|
29
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import AiTutorPNG from "./assets/emojis/ai_tutor.png";
|
|
2
|
+
import CoinsPNG from "./assets/emojis/coins.png";
|
|
3
|
+
import ConversationPNG from "./assets/emojis/conversation.png";
|
|
4
|
+
import DailyChallengePNG from "./assets/emojis/daily-challenge.png";
|
|
5
|
+
import DownloadsPNG from "./assets/emojis/downloads.png";
|
|
6
|
+
import ExperiencePNG from "./assets/emojis/experience.png";
|
|
7
|
+
import FavoritesPNG from "./assets/emojis/favorites.png";
|
|
8
|
+
import FillInTheBlanksPNG from "./assets/emojis/fill-in-the-blanks.png";
|
|
9
|
+
import FlashcardsPNG from "./assets/emojis/flashcards.png";
|
|
10
|
+
import HighFivePNG from "./assets/emojis/high_five.png";
|
|
11
|
+
import LeaderboardPNG from "./assets/emojis/leaderboard.png";
|
|
12
|
+
import LessonsPNG from "./assets/emojis/lessons.png";
|
|
13
|
+
import LevelUpPNG from "./assets/emojis/level_up.png";
|
|
14
|
+
import ListeningPNG from "./assets/emojis/listening.png";
|
|
15
|
+
import MatchingPNG from "./assets/emojis/matching.png";
|
|
16
|
+
import MasterPNG from "./assets/emojis/master.png";
|
|
17
|
+
import OfflineModePNG from "./assets/emojis/offline_mode.png";
|
|
18
|
+
import PronounciationPNG from "./assets/emojis/pronounciation.png";
|
|
19
|
+
import ProverbsPNG from "./assets/emojis/proverbs.png";
|
|
20
|
+
import QuizPNG from "./assets/emojis/quiz.png";
|
|
21
|
+
import ReadingPNG from "./assets/emojis/reading.png";
|
|
22
|
+
import RewardPNG from "./assets/emojis/reward.png";
|
|
23
|
+
import RewardsPNG from "./assets/emojis/rewards.png";
|
|
24
|
+
import SpeakingPNG from "./assets/emojis/speaking.png";
|
|
25
|
+
import StreakPNG from "./assets/emojis/streak.png";
|
|
26
|
+
import TeamVictoryPNG from "./assets/emojis/team_victory.png";
|
|
27
|
+
import TranslatePNG from "./assets/emojis/translate.png";
|
|
28
|
+
import TrophyPNG from "./assets/emojis/trophy.png";
|
|
29
|
+
import WavingPNG from "./assets/emojis/waving.png";
|
|
30
|
+
import WinnerPNG from "./assets/emojis/winner.png";
|
|
31
|
+
import XpEarnedPNG from "./assets/emojis/xp_earned.png";
|
|
32
|
+
import WritingPNG from "./assets/emojis/writing.png";
|
|
33
|
+
import { createNativeEmojiComponent } from "./components/createNativeEmojiComponent";
|
|
34
|
+
|
|
35
|
+
export const AiTutor = createNativeEmojiComponent("ai_tutor", AiTutorPNG);
|
|
36
|
+
export const Coins = createNativeEmojiComponent("coins", CoinsPNG);
|
|
37
|
+
export const Conversation = createNativeEmojiComponent("conversation", ConversationPNG);
|
|
38
|
+
export const DailyChallenge = createNativeEmojiComponent(
|
|
39
|
+
"daily-challenge",
|
|
40
|
+
DailyChallengePNG,
|
|
41
|
+
);
|
|
42
|
+
export const Downloads = createNativeEmojiComponent("downloads", DownloadsPNG);
|
|
43
|
+
export const Experience = createNativeEmojiComponent("experience", ExperiencePNG);
|
|
44
|
+
export const Favorites = createNativeEmojiComponent("favorites", FavoritesPNG);
|
|
45
|
+
export const FillInTheBlanks = createNativeEmojiComponent(
|
|
46
|
+
"fill-in-the-blanks",
|
|
47
|
+
FillInTheBlanksPNG,
|
|
48
|
+
);
|
|
49
|
+
export const Flashcards = createNativeEmojiComponent("flashcards", FlashcardsPNG);
|
|
50
|
+
export const HighFive = createNativeEmojiComponent("high_five", HighFivePNG);
|
|
51
|
+
export const Leaderboard = createNativeEmojiComponent("leaderboard", LeaderboardPNG);
|
|
52
|
+
export const Lessons = createNativeEmojiComponent("lessons", LessonsPNG);
|
|
53
|
+
export const LevelUp = createNativeEmojiComponent("level_up", LevelUpPNG);
|
|
54
|
+
export const Listening = createNativeEmojiComponent("listening", ListeningPNG);
|
|
55
|
+
export const Matching = createNativeEmojiComponent("matching", MatchingPNG);
|
|
56
|
+
export const Master = createNativeEmojiComponent("master", MasterPNG);
|
|
57
|
+
export const OfflineMode = createNativeEmojiComponent(
|
|
58
|
+
"offline_mode",
|
|
59
|
+
OfflineModePNG,
|
|
60
|
+
);
|
|
61
|
+
export const Pronounciation = createNativeEmojiComponent(
|
|
62
|
+
"pronounciation",
|
|
63
|
+
PronounciationPNG,
|
|
64
|
+
);
|
|
65
|
+
export const Proverbs = createNativeEmojiComponent("proverbs", ProverbsPNG);
|
|
66
|
+
export const Quiz = createNativeEmojiComponent("quiz", QuizPNG);
|
|
67
|
+
export const Reading = createNativeEmojiComponent("reading", ReadingPNG);
|
|
68
|
+
export const Reward = createNativeEmojiComponent("reward", RewardPNG);
|
|
69
|
+
export const Rewards = createNativeEmojiComponent("rewards", RewardsPNG);
|
|
70
|
+
export const Speaking = createNativeEmojiComponent("speaking", SpeakingPNG);
|
|
71
|
+
export const Streak = createNativeEmojiComponent("streak", StreakPNG);
|
|
72
|
+
export const TeamVictory = createNativeEmojiComponent("team_victory", TeamVictoryPNG);
|
|
73
|
+
export const Translate = createNativeEmojiComponent("translate", TranslatePNG);
|
|
74
|
+
export const Trophy = createNativeEmojiComponent("trophy", TrophyPNG);
|
|
75
|
+
export const Waving = createNativeEmojiComponent("waving", WavingPNG);
|
|
76
|
+
export const Winner = createNativeEmojiComponent("winner", WinnerPNG);
|
|
77
|
+
export const XpEarned = createNativeEmojiComponent("xp_earned", XpEarnedPNG);
|
|
78
|
+
export const Writing = createNativeEmojiComponent("writing", WritingPNG);
|
|
79
|
+
|
|
80
|
+
export const Fire = createNativeEmojiComponent("fire", undefined);
|
package/src/generated.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import AiTutorPNG from "./assets/emojis/ai_tutor.png";
|
|
2
|
+
import CoinsPNG from "./assets/emojis/coins.png";
|
|
3
|
+
import ConversationPNG from "./assets/emojis/conversation.png";
|
|
4
|
+
import DailyChallengePNG from "./assets/emojis/daily-challenge.png";
|
|
5
|
+
import DownloadsPNG from "./assets/emojis/downloads.png";
|
|
6
|
+
import ExperiencePNG from "./assets/emojis/experience.png";
|
|
7
|
+
import FavoritesPNG from "./assets/emojis/favorites.png";
|
|
8
|
+
import FillInTheBlanksPNG from "./assets/emojis/fill-in-the-blanks.png";
|
|
9
|
+
import FlashcardsPNG from "./assets/emojis/flashcards.png";
|
|
10
|
+
import HighFivePNG from "./assets/emojis/high_five.png";
|
|
11
|
+
import LeaderboardPNG from "./assets/emojis/leaderboard.png";
|
|
12
|
+
import LessonsPNG from "./assets/emojis/lessons.png";
|
|
13
|
+
import LevelUpPNG from "./assets/emojis/level_up.png";
|
|
14
|
+
import ListeningPNG from "./assets/emojis/listening.png";
|
|
15
|
+
import MatchingPNG from "./assets/emojis/matching.png";
|
|
16
|
+
import MasterPNG from "./assets/emojis/master.png";
|
|
17
|
+
import OfflineModePNG from "./assets/emojis/offline_mode.png";
|
|
18
|
+
import PronounciationPNG from "./assets/emojis/pronounciation.png";
|
|
19
|
+
import ProverbsPNG from "./assets/emojis/proverbs.png";
|
|
20
|
+
import QuizPNG from "./assets/emojis/quiz.png";
|
|
21
|
+
import ReadingPNG from "./assets/emojis/reading.png";
|
|
22
|
+
import RewardPNG from "./assets/emojis/reward.png";
|
|
23
|
+
import RewardsPNG from "./assets/emojis/rewards.png";
|
|
24
|
+
import SpeakingPNG from "./assets/emojis/speaking.png";
|
|
25
|
+
import StreakPNG from "./assets/emojis/streak.png";
|
|
26
|
+
import TeamVictoryPNG from "./assets/emojis/team_victory.png";
|
|
27
|
+
import TranslatePNG from "./assets/emojis/translate.png";
|
|
28
|
+
import TrophyPNG from "./assets/emojis/trophy.png";
|
|
29
|
+
import WavingPNG from "./assets/emojis/waving.png";
|
|
30
|
+
import WinnerPNG from "./assets/emojis/winner.png";
|
|
31
|
+
import XpEarnedPNG from "./assets/emojis/xp_earned.png";
|
|
32
|
+
import WritingPNG from "./assets/emojis/writing.png";
|
|
33
|
+
import { createEmojiComponent } from "./components/createEmojiComponent";
|
|
34
|
+
|
|
35
|
+
export const AiTutor = createEmojiComponent("ai_tutor", AiTutorPNG);
|
|
36
|
+
export const Coins = createEmojiComponent("coins", CoinsPNG);
|
|
37
|
+
export const Conversation = createEmojiComponent("conversation", ConversationPNG);
|
|
38
|
+
export const DailyChallenge = createEmojiComponent(
|
|
39
|
+
"daily-challenge",
|
|
40
|
+
DailyChallengePNG,
|
|
41
|
+
);
|
|
42
|
+
export const Downloads = createEmojiComponent("downloads", DownloadsPNG);
|
|
43
|
+
export const Experience = createEmojiComponent("experience", ExperiencePNG);
|
|
44
|
+
export const Favorites = createEmojiComponent("favorites", FavoritesPNG);
|
|
45
|
+
export const FillInTheBlanks = createEmojiComponent(
|
|
46
|
+
"fill-in-the-blanks",
|
|
47
|
+
FillInTheBlanksPNG,
|
|
48
|
+
);
|
|
49
|
+
export const Flashcards = createEmojiComponent("flashcards", FlashcardsPNG);
|
|
50
|
+
export const HighFive = createEmojiComponent("high_five", HighFivePNG);
|
|
51
|
+
export const Leaderboard = createEmojiComponent("leaderboard", LeaderboardPNG);
|
|
52
|
+
export const Lessons = createEmojiComponent("lessons", LessonsPNG);
|
|
53
|
+
export const LevelUp = createEmojiComponent("level_up", LevelUpPNG);
|
|
54
|
+
export const Listening = createEmojiComponent("listening", ListeningPNG);
|
|
55
|
+
export const Matching = createEmojiComponent("matching", MatchingPNG);
|
|
56
|
+
export const Master = createEmojiComponent("master", MasterPNG);
|
|
57
|
+
export const OfflineMode = createEmojiComponent(
|
|
58
|
+
"offline_mode",
|
|
59
|
+
OfflineModePNG,
|
|
60
|
+
);
|
|
61
|
+
export const Pronounciation = createEmojiComponent(
|
|
62
|
+
"pronounciation",
|
|
63
|
+
PronounciationPNG,
|
|
64
|
+
);
|
|
65
|
+
export const Proverbs = createEmojiComponent("proverbs", ProverbsPNG);
|
|
66
|
+
export const Quiz = createEmojiComponent("quiz", QuizPNG);
|
|
67
|
+
export const Reading = createEmojiComponent("reading", ReadingPNG);
|
|
68
|
+
export const Reward = createEmojiComponent("reward", RewardPNG);
|
|
69
|
+
export const Rewards = createEmojiComponent("rewards", RewardsPNG);
|
|
70
|
+
export const Speaking = createEmojiComponent("speaking", SpeakingPNG);
|
|
71
|
+
export const Streak = createEmojiComponent("streak", StreakPNG);
|
|
72
|
+
export const TeamVictory = createEmojiComponent("team_victory", TeamVictoryPNG);
|
|
73
|
+
export const Translate = createEmojiComponent("translate", TranslatePNG);
|
|
74
|
+
export const Trophy = createEmojiComponent("trophy", TrophyPNG);
|
|
75
|
+
export const Waving = createEmojiComponent("waving", WavingPNG);
|
|
76
|
+
export const Winner = createEmojiComponent("winner", WinnerPNG);
|
|
77
|
+
export const XpEarned = createEmojiComponent("xp_earned", XpEarnedPNG);
|
|
78
|
+
export const Writing = createEmojiComponent("writing", WritingPNG);
|
|
79
|
+
|
|
80
|
+
export const Fire = createEmojiComponent("fire", undefined);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { Avatar } from "./components/Avatar.native";
|
|
2
|
+
export { Emoji } from "./components/Emoji.native";
|
|
3
|
+
export {
|
|
4
|
+
avatarCharacters,
|
|
5
|
+
avatarRegistry,
|
|
6
|
+
getAvatarAsset,
|
|
7
|
+
zebra,
|
|
8
|
+
} from "./registry/avatarRegistry";
|
|
9
|
+
export { emojiNames, emojiRegistry, getEmojiAsset } from "./registry/emojiRegistry";
|
|
10
|
+
export * from "./generated.native";
|
|
11
|
+
export type {
|
|
12
|
+
AssetRegistry,
|
|
13
|
+
AvatarCharacter,
|
|
14
|
+
AvatarMood,
|
|
15
|
+
AvatarProps,
|
|
16
|
+
BaseImageProps,
|
|
17
|
+
EmojiName,
|
|
18
|
+
EmojiProps,
|
|
19
|
+
ImageFit,
|
|
20
|
+
ResolvedAsset,
|
|
21
|
+
ZebraMood,
|
|
22
|
+
} from "./types";
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { Avatar } from "./components/Avatar";
|
|
2
|
+
export { Emoji } from "./components/Emoji";
|
|
3
|
+
export {
|
|
4
|
+
avatarCharacters,
|
|
5
|
+
avatarRegistry,
|
|
6
|
+
getAvatarAsset,
|
|
7
|
+
zebra,
|
|
8
|
+
} from "./registry/avatarRegistry";
|
|
9
|
+
export { emojiNames, emojiRegistry, getEmojiAsset } from "./registry/emojiRegistry";
|
|
10
|
+
export * from "./generated";
|
|
11
|
+
export type {
|
|
12
|
+
AssetRegistry,
|
|
13
|
+
AvatarCharacter,
|
|
14
|
+
AvatarMood,
|
|
15
|
+
AvatarProps,
|
|
16
|
+
BaseImageProps,
|
|
17
|
+
EmojiName,
|
|
18
|
+
EmojiProps,
|
|
19
|
+
ImageFit,
|
|
20
|
+
ResolvedAsset,
|
|
21
|
+
ZebraMood,
|
|
22
|
+
} from "./types";
|