@liner-fe/illust 0.1.6 → 0.1.7
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/.ultra.cache.json +1 -0
- package/CHANGELOG.md +6 -0
- package/README.md +13 -0
- package/lib/index.d.ts +2 -9
- package/lib/index.js +15 -35
- package/package.json +3 -2
- package/src/components/index.tsx +9 -7
- package/src/constants/size.ts +6 -29
- package/src/utils/illust.ts +1 -2
- package/src/constants/name.ts +0 -84
- package/src/types/illust.ts +0 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"files":{"lib":"1760605459889.4683",".gitignore":"dc555529d53e3f2c4f0e55a863459c4b37d735aa","CHANGELOG.md":"677998a160c0e099f34e7b6277ce9e0a905f6ebe.1760605418770.452","README.md":"63221bc63a67877867f2e5687df18a8fd094aaeb","config/tsup/tsup.config.ts":"a859643cfe271fbb36f8dcdbddf48e2a50cd3467","package.json":"4cafd85c35c17ec1315da5b50d16cd2781427f95.1760605418762.452","src/components/index.tsx":"a76f6fffbe12d6ba35c1514c75cbf25bfa921dca","src/constants/path.ts":"3d830e3cec1911a55b97d4c019ffa64544691f55","src/constants/size.ts":"7b67ec10bd33f292bd8ceeef1b6caa5c7aae8db8","src/index.ts":"c622c42f0af65297761fd53dc4bcdce07f282859","src/utils/illust.ts":"d38b03c111b7f8441af200053469c4b590ce1251","tsconfig.build.json":"c72ec6a3beec74122bb0b83d3881081d33af3ced","tsconfig.json":"81023397af8ff9abb35dce28ed574a745240aec4"},"deps":{}}
|
package/CHANGELOG.md
CHANGED
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @liner-fe/illust
|
|
2
|
+
|
|
3
|
+
## 일러스트 추가하기
|
|
4
|
+
|
|
5
|
+
새로운 일러스트를 추가하려면 다음 단계를 따르세요:
|
|
6
|
+
|
|
7
|
+
### 1. 이미지 파일 추가
|
|
8
|
+
|
|
9
|
+
- **형식**: [WebP exporter](https://www.figma.com/community/plugin/1181873200384736932/webp-exporter)를 활용해서 같은 이름으로 추가해주세요.
|
|
10
|
+
- **위치**:
|
|
11
|
+
- 라이트 모드: `https://assets.getliner.com/common/illust/light/`
|
|
12
|
+
- 다크 모드: `https://assets.getliner.com/common/illust/dark/`
|
|
13
|
+
- CDN 링크: https://fe-admin.liner.space/cloud/buckets/liner-v1--assets/common/illust
|
package/lib/index.d.ts
CHANGED
|
@@ -2,15 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { DetailedHTMLProps, ImgHTMLAttributes } from 'react';
|
|
3
3
|
import { Property } from 'csstype';
|
|
4
4
|
|
|
5
|
-
declare const illustNames: readonly ["hero-gift", "hero-search", "mini-approve", "mini-documents-2", "mini-documents-3", "mini-documents-4", "mini-documents-5", "mini-documents", "mini-egg", "mini-empty-message", "mini-empty", "mini-gift", "mini-graduation_hat", "mini-not-search", "mini-not-ticket-2", "mini-private", "mini-search", "mini-ticket", "mini-ticket-3", "mini-window", "spot-catch_star", "spot-clap", "spot-empty", "spot-gift", "spot-no_search", "spot-search-2", "spot-search-3", "spot-search-4", "spot-search-5", "spot-search", "spot-sign_up", "spot-team", "spot-write", "mini-sign", "mini-pots", "mini-erase", "mini-rocket", "mini-empty-history", "mini-upload", "mini-empty-search"];
|
|
6
|
-
declare const darkIllustNames: readonly ["hero-gift", "hero-search", "mini-approve", "mini-documents-2", "mini-documents-3", "mini-documents-4", "mini-documents-5", "mini-documents", "mini-egg", "mini-empty-message", "mini-empty", "mini-gift", "mini-graduation_hat", "mini-not-search", "mini-not-ticket-2", "mini-private", "mini-search", "mini-ticket", "mini-ticket-3", "mini-window", "spot-catch_star", "spot-clap", "spot-empty", "spot-gift", "spot-no_search", "spot-search-2", "spot-search-3", "spot-search-4", "spot-search-5", "spot-search", "spot-sign_up", "spot-team", "spot-write", "mini-sign", "mini-pots", "mini-erase", "mini-rocket", "mini-empty-history", "mini-upload", "mini-empty-search"];
|
|
7
|
-
|
|
8
|
-
type LightIllustType = (typeof illustNames)[number];
|
|
9
|
-
type DarkIllustType = (typeof darkIllustNames)[number];
|
|
10
|
-
type IllustType = DarkIllustType | LightIllustType;
|
|
11
|
-
|
|
12
5
|
interface Source<T extends false | true = true> {
|
|
13
|
-
name:
|
|
6
|
+
name: string;
|
|
14
7
|
inverse?: T;
|
|
15
8
|
}
|
|
16
9
|
interface IllustProps extends Omit<DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, 'src'> {
|
|
@@ -24,7 +17,7 @@ interface IllustProps extends Omit<DetailedHTMLProps<ImgHTMLAttributes<HTMLImage
|
|
|
24
17
|
declare const Illust: (props: IllustProps) => react_jsx_runtime.JSX.Element;
|
|
25
18
|
|
|
26
19
|
declare const prefetchIllust: ({ name, isDark, }: {
|
|
27
|
-
name:
|
|
20
|
+
name: string;
|
|
28
21
|
isDark?: boolean;
|
|
29
22
|
}) => Promise<Response>;
|
|
30
23
|
|
package/lib/index.js
CHANGED
|
@@ -1,44 +1,22 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
|
+
// src/constants/path.ts
|
|
5
|
+
var ILLUST = "https://assets.getliner.com/common/illust";
|
|
6
|
+
var DARK_MODE_ILLUST_PREFIX = `${ILLUST}/dark/`;
|
|
7
|
+
var LIGHT_MODE_ILLUST_PREFIX = `${ILLUST}/light/`;
|
|
8
|
+
|
|
4
9
|
// src/constants/size.ts
|
|
5
10
|
var ratio = {
|
|
6
11
|
"4:3": { width: 180, height: 135 },
|
|
7
12
|
"1:1": { width: 250, height: 250 }
|
|
8
13
|
};
|
|
9
|
-
var
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"mini-documents-5": ratio["1:1"],
|
|
16
|
-
"mini-documents": ratio["1:1"],
|
|
17
|
-
"mini-egg": ratio["1:1"],
|
|
18
|
-
"mini-gift": ratio["1:1"],
|
|
19
|
-
"mini-graduation_hat": ratio["1:1"],
|
|
20
|
-
"mini-search": ratio["1:1"],
|
|
21
|
-
"mini-ticket": ratio["1:1"],
|
|
22
|
-
"mini-window": ratio["1:1"],
|
|
23
|
-
"spot-catch_star": ratio["4:3"],
|
|
24
|
-
"spot-clap": ratio["4:3"],
|
|
25
|
-
"spot-empty": ratio["4:3"],
|
|
26
|
-
"spot-no_search": ratio["4:3"],
|
|
27
|
-
"spot-search-2": ratio["4:3"],
|
|
28
|
-
"spot-search-3": ratio["4:3"],
|
|
29
|
-
"spot-search-4": ratio["4:3"],
|
|
30
|
-
"spot-search-5": ratio["4:3"],
|
|
31
|
-
"spot-search": ratio["4:3"],
|
|
32
|
-
"spot-write": ratio["4:3"],
|
|
33
|
-
"spot-gift": ratio["4:3"],
|
|
34
|
-
"mini-empty": ratio["1:1"],
|
|
35
|
-
"spot-team": ratio["4:3"]
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// src/constants/path.ts
|
|
39
|
-
var ILLUST = "https://assets.getliner.com/common/illust";
|
|
40
|
-
var DARK_MODE_ILLUST_PREFIX = `${ILLUST}/dark/`;
|
|
41
|
-
var LIGHT_MODE_ILLUST_PREFIX = `${ILLUST}/light/`;
|
|
14
|
+
var getIllustAspectRatio = /* @__PURE__ */ __name((name) => {
|
|
15
|
+
if (name.startsWith("spot-")) {
|
|
16
|
+
return ratio["4:3"];
|
|
17
|
+
}
|
|
18
|
+
return ratio["1:1"];
|
|
19
|
+
}, "getIllustAspectRatio");
|
|
42
20
|
|
|
43
21
|
// src/components/index.tsx
|
|
44
22
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -46,8 +24,10 @@ var Illust = /* @__PURE__ */ __name((props) => {
|
|
|
46
24
|
const { src, width, margin } = props;
|
|
47
25
|
const darkSource = src.dark?.name || src.light.name;
|
|
48
26
|
const lightSource = src.light.name;
|
|
49
|
-
const
|
|
50
|
-
const
|
|
27
|
+
const darkAspectRatio = getIllustAspectRatio(darkSource);
|
|
28
|
+
const lightAspectRatio = getIllustAspectRatio(lightSource);
|
|
29
|
+
const aspectRatioDark = darkAspectRatio ? darkAspectRatio.width / darkAspectRatio.height : void 0;
|
|
30
|
+
const aspectRatio = lightAspectRatio ? lightAspectRatio.width / lightAspectRatio.height : void 0;
|
|
51
31
|
const css = {
|
|
52
32
|
width,
|
|
53
33
|
margin
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liner-fe/illust",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "yarn tsup --config ./config/tsup/tsup.config.ts"
|
|
6
|
+
"build": "yarn tsup --config ./config/tsup/tsup.config.ts",
|
|
7
|
+
"build:package": "yarn build"
|
|
7
8
|
},
|
|
8
9
|
"publishConfig": {
|
|
9
10
|
"access": "public",
|
package/src/components/index.tsx
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { illustSize } from '../constants/size';
|
|
2
1
|
import { CSSProperties, DetailedHTMLProps, ImgHTMLAttributes } from 'react';
|
|
3
|
-
import { IllustType } from '../types/illust';
|
|
4
2
|
import { Property } from 'csstype';
|
|
5
3
|
import { DARK_MODE_ILLUST_PREFIX, LIGHT_MODE_ILLUST_PREFIX } from '@/constants/path';
|
|
4
|
+
import { getIllustAspectRatio } from '@/constants/size';
|
|
6
5
|
|
|
7
6
|
export interface Source<T extends false | true = true> {
|
|
8
|
-
name:
|
|
7
|
+
name: string;
|
|
9
8
|
inverse?: T;
|
|
10
9
|
}
|
|
11
10
|
|
|
@@ -22,12 +21,15 @@ export const Illust = (props: IllustProps) => {
|
|
|
22
21
|
const darkSource = src.dark?.name || src.light.name;
|
|
23
22
|
const lightSource = src.light.name;
|
|
24
23
|
|
|
25
|
-
const
|
|
26
|
-
|
|
24
|
+
const darkAspectRatio = getIllustAspectRatio(darkSource);
|
|
25
|
+
const lightAspectRatio = getIllustAspectRatio(lightSource);
|
|
26
|
+
|
|
27
|
+
const aspectRatioDark = darkAspectRatio
|
|
28
|
+
? darkAspectRatio.width / darkAspectRatio.height
|
|
27
29
|
: undefined;
|
|
28
30
|
|
|
29
|
-
const aspectRatio =
|
|
30
|
-
?
|
|
31
|
+
const aspectRatio = lightAspectRatio
|
|
32
|
+
? lightAspectRatio.width / lightAspectRatio.height
|
|
31
33
|
: undefined;
|
|
32
34
|
|
|
33
35
|
const css: CSSProperties = {
|
package/src/constants/size.ts
CHANGED
|
@@ -1,35 +1,12 @@
|
|
|
1
|
-
import { IllustType } from '../types/illust';
|
|
2
|
-
|
|
3
1
|
const ratio = {
|
|
4
2
|
'4:3': { width: 180, height: 135 },
|
|
5
3
|
'1:1': { width: 250, height: 250 },
|
|
6
4
|
};
|
|
7
5
|
|
|
8
|
-
export const
|
|
9
|
-
'
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
'mini-documents-5': ratio['1:1'],
|
|
15
|
-
'mini-documents': ratio['1:1'],
|
|
16
|
-
'mini-egg': ratio['1:1'],
|
|
17
|
-
'mini-gift': ratio['1:1'],
|
|
18
|
-
'mini-graduation_hat': ratio['1:1'],
|
|
19
|
-
'mini-search': ratio['1:1'],
|
|
20
|
-
'mini-ticket': ratio['1:1'],
|
|
21
|
-
'mini-window': ratio['1:1'],
|
|
22
|
-
'spot-catch_star': ratio['4:3'],
|
|
23
|
-
'spot-clap': ratio['4:3'],
|
|
24
|
-
'spot-empty': ratio['4:3'],
|
|
25
|
-
'spot-no_search': ratio['4:3'],
|
|
26
|
-
'spot-search-2': ratio['4:3'],
|
|
27
|
-
'spot-search-3': ratio['4:3'],
|
|
28
|
-
'spot-search-4': ratio['4:3'],
|
|
29
|
-
'spot-search-5': ratio['4:3'],
|
|
30
|
-
'spot-search': ratio['4:3'],
|
|
31
|
-
'spot-write': ratio['4:3'],
|
|
32
|
-
'spot-gift': ratio['4:3'],
|
|
33
|
-
'mini-empty': ratio['1:1'],
|
|
34
|
-
'spot-team': ratio['4:3'],
|
|
6
|
+
export const getIllustAspectRatio = (name: string) => {
|
|
7
|
+
if (name.startsWith('spot-')) {
|
|
8
|
+
return ratio['4:3'];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return ratio['1:1'];
|
|
35
12
|
};
|
package/src/utils/illust.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { ILLUST } from '../constants/path';
|
|
2
|
-
import { IllustType } from '../types/illust';
|
|
3
2
|
|
|
4
3
|
export const prefetchIllust = async ({
|
|
5
4
|
name,
|
|
6
5
|
isDark = false,
|
|
7
6
|
}: {
|
|
8
|
-
name:
|
|
7
|
+
name: string;
|
|
9
8
|
isDark?: boolean;
|
|
10
9
|
}) => await fetch(`${ILLUST}${isDark ? '/dark/' : '/light/'}${name}.webp`);
|
package/src/constants/name.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
export const illustNames = [
|
|
2
|
-
'hero-gift',
|
|
3
|
-
'hero-search',
|
|
4
|
-
'mini-approve',
|
|
5
|
-
'mini-documents-2',
|
|
6
|
-
'mini-documents-3',
|
|
7
|
-
'mini-documents-4',
|
|
8
|
-
'mini-documents-5',
|
|
9
|
-
'mini-documents',
|
|
10
|
-
'mini-egg',
|
|
11
|
-
'mini-empty-message',
|
|
12
|
-
'mini-empty',
|
|
13
|
-
'mini-gift',
|
|
14
|
-
'mini-graduation_hat',
|
|
15
|
-
'mini-not-search',
|
|
16
|
-
'mini-not-ticket-2',
|
|
17
|
-
'mini-private',
|
|
18
|
-
'mini-search',
|
|
19
|
-
'mini-ticket',
|
|
20
|
-
'mini-ticket-3',
|
|
21
|
-
'mini-window',
|
|
22
|
-
'spot-catch_star',
|
|
23
|
-
'spot-clap',
|
|
24
|
-
'spot-empty',
|
|
25
|
-
'spot-gift',
|
|
26
|
-
'spot-no_search',
|
|
27
|
-
'spot-search-2',
|
|
28
|
-
'spot-search-3',
|
|
29
|
-
'spot-search-4',
|
|
30
|
-
'spot-search-5',
|
|
31
|
-
'spot-search',
|
|
32
|
-
'spot-sign_up',
|
|
33
|
-
'spot-team',
|
|
34
|
-
'spot-write',
|
|
35
|
-
'mini-sign',
|
|
36
|
-
'mini-pots',
|
|
37
|
-
'mini-erase',
|
|
38
|
-
'mini-rocket',
|
|
39
|
-
'mini-empty-history',
|
|
40
|
-
'mini-upload',
|
|
41
|
-
'mini-empty-search',
|
|
42
|
-
] as const;
|
|
43
|
-
export const darkIllustNames = [
|
|
44
|
-
'hero-gift',
|
|
45
|
-
'hero-search',
|
|
46
|
-
'mini-approve',
|
|
47
|
-
'mini-documents-2',
|
|
48
|
-
'mini-documents-3',
|
|
49
|
-
'mini-documents-4',
|
|
50
|
-
'mini-documents-5',
|
|
51
|
-
'mini-documents',
|
|
52
|
-
'mini-egg',
|
|
53
|
-
'mini-empty-message',
|
|
54
|
-
'mini-empty',
|
|
55
|
-
'mini-gift',
|
|
56
|
-
'mini-graduation_hat',
|
|
57
|
-
'mini-not-search',
|
|
58
|
-
'mini-not-ticket-2',
|
|
59
|
-
'mini-private',
|
|
60
|
-
'mini-search',
|
|
61
|
-
'mini-ticket',
|
|
62
|
-
'mini-ticket-3',
|
|
63
|
-
'mini-window',
|
|
64
|
-
'spot-catch_star',
|
|
65
|
-
'spot-clap',
|
|
66
|
-
'spot-empty',
|
|
67
|
-
'spot-gift',
|
|
68
|
-
'spot-no_search',
|
|
69
|
-
'spot-search-2',
|
|
70
|
-
'spot-search-3',
|
|
71
|
-
'spot-search-4',
|
|
72
|
-
'spot-search-5',
|
|
73
|
-
'spot-search',
|
|
74
|
-
'spot-sign_up',
|
|
75
|
-
'spot-team',
|
|
76
|
-
'spot-write',
|
|
77
|
-
'mini-sign',
|
|
78
|
-
'mini-pots',
|
|
79
|
-
'mini-erase',
|
|
80
|
-
'mini-rocket',
|
|
81
|
-
'mini-empty-history',
|
|
82
|
-
'mini-upload',
|
|
83
|
-
'mini-empty-search',
|
|
84
|
-
] as const;
|
package/src/types/illust.ts
DELETED