@liner-fe/illust 0.2.8 → 0.2.9

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/lib/index.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { DetailedHTMLProps, ImgHTMLAttributes } from 'react';
3
+ import { Property } from 'csstype';
4
+
5
+ interface Source<T extends false | true = true> {
6
+ name: string;
7
+ inverse?: T;
8
+ }
9
+ interface IllustProps extends Omit<DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, 'src'> {
10
+ width: number;
11
+ src: {
12
+ light: Source<false>;
13
+ dark?: Source;
14
+ };
15
+ margin?: Property.Margin<string>;
16
+ }
17
+ declare const Illust: (props: IllustProps) => react_jsx_runtime.JSX.Element;
18
+
19
+ declare const prefetchIllust: ({ name, isDark, }: {
20
+ name: string;
21
+ isDark?: boolean;
22
+ }) => Promise<Response>;
23
+
24
+ export { Illust, type IllustProps, type Source, prefetchIllust };
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@liner-fe/illust",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "files": [
9
- "*"
9
+ "lib"
10
10
  ],
11
11
  "main": "./lib/index.js",
12
12
  "types": "./lib/index.d.ts",
package/.gitignore DELETED
@@ -1 +0,0 @@
1
- /lib
package/.ultra.cache.json DELETED
@@ -1 +0,0 @@
1
- {"files":{"lib":"1760876275317.5342","node_modules":"1761203842576.7976",".gitignore":"dc555529d53e3f2c4f0e55a863459c4b37d735aa","CHANGELOG.md":"f0c3c24b8d2fd6dd50505c9f52e0e4ac3b2fd22d","README.md":"63221bc63a67877867f2e5687df18a8fd094aaeb","config/tsup/tsup.config.ts":"a859643cfe271fbb36f8dcdbddf48e2a50cd3467","package.json":"a4e3e14b66382d159c15c77932c135f9f9ebc62a","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 DELETED
@@ -1,43 +0,0 @@
1
- # @liner-fe/illust
2
-
3
- ## 0.1.7
4
-
5
- ### Patch Changes
6
-
7
- - 11ff74f: chore: 코치마크 close 아이콘 컬러 변경
8
-
9
- ## 0.1.6
10
-
11
- ### Patch Changes
12
-
13
- - c95bf49: feat: illust 추가
14
-
15
- ## 0.1.5
16
-
17
- ### Patch Changes
18
-
19
- - 99448a8: illust design token 의존성 삭제
20
-
21
- ## 0.1.4
22
-
23
- ### Patch Changes
24
-
25
- - e5cfc5c: ESM으로 전부 마이그레이션
26
-
27
- ## 0.1.3
28
-
29
- ### Patch Changes
30
-
31
- - 6bf3a85: liner-fe/illust build code 삭제
32
-
33
- ## 0.1.2
34
-
35
- ### Patch Changes
36
-
37
- - 07ae3a7: fix: illust, prism dual package로 전환
38
-
39
- ## 0.1.1
40
-
41
- ### Patch Changes
42
-
43
- - d9f0ee4: illust package 분리 및 prism ESM으로 마이그레이션
@@ -1,19 +0,0 @@
1
- import { defineConfig } from 'tsup';
2
- import { nodeExternalsPlugin } from 'esbuild-node-externals';
3
-
4
- export default defineConfig({
5
- entry: ['src/index.ts'],
6
- outDir: 'lib',
7
- // 이거는 무슨 옵션일까?
8
- // splitting: false,
9
- format: 'esm',
10
- bundle: true,
11
- minify: false,
12
- keepNames: true,
13
- jsxFactory: 'React.createElement',
14
- jsxFragment: 'Fragment',
15
- tsconfig: './tsconfig.build.json',
16
- platform: 'neutral',
17
- dts: true,
18
- esbuildPlugins: [nodeExternalsPlugin()],
19
- });
@@ -1,61 +0,0 @@
1
- import { CSSProperties, DetailedHTMLProps, ImgHTMLAttributes } from 'react';
2
- import { Property } from 'csstype';
3
- import { DARK_MODE_ILLUST_PREFIX, LIGHT_MODE_ILLUST_PREFIX } from '@/constants/path';
4
- import { getIllustAspectRatio } from '@/constants/size';
5
-
6
- export interface Source<T extends false | true = true> {
7
- name: string;
8
- inverse?: T;
9
- }
10
-
11
- export interface IllustProps
12
- extends Omit<DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, 'src'> {
13
- width: number;
14
- src: { light: Source<false>; dark?: Source };
15
- margin?: Property.Margin<string>;
16
- }
17
-
18
- export const Illust = (props: IllustProps) => {
19
- const { src, width, margin } = props;
20
-
21
- const darkSource = src.dark?.name || src.light.name;
22
- const lightSource = src.light.name;
23
-
24
- const darkAspectRatio = getIllustAspectRatio(darkSource);
25
- const lightAspectRatio = getIllustAspectRatio(lightSource);
26
-
27
- const aspectRatioDark = darkAspectRatio
28
- ? darkAspectRatio.width / darkAspectRatio.height
29
- : undefined;
30
-
31
- const aspectRatio = lightAspectRatio
32
- ? lightAspectRatio.width / lightAspectRatio.height
33
- : undefined;
34
-
35
- const css: CSSProperties = {
36
- width,
37
- margin,
38
- };
39
-
40
- return (
41
- <div style={css}>
42
- <img
43
- {...props}
44
- alt={lightSource}
45
- src={`${src.light.inverse === false ? DARK_MODE_ILLUST_PREFIX : LIGHT_MODE_ILLUST_PREFIX}${lightSource}.webp`}
46
- width={width}
47
- height={aspectRatio ? width / aspectRatio : width}
48
- data-hide-on-theme={'dark'}
49
- />
50
- {/* dark */}
51
- <img
52
- {...props}
53
- alt={darkSource}
54
- src={`${src.dark?.inverse ? LIGHT_MODE_ILLUST_PREFIX : DARK_MODE_ILLUST_PREFIX}${darkSource}.webp`}
55
- width={width}
56
- height={aspectRatioDark ? width / aspectRatioDark : width}
57
- data-hide-on-theme={'light'}
58
- />
59
- </div>
60
- );
61
- };
@@ -1,4 +0,0 @@
1
- export const ILLUST = 'https://assets.getliner.com/common/illust';
2
-
3
- export const DARK_MODE_ILLUST_PREFIX = `${ILLUST}/dark/`;
4
- export const LIGHT_MODE_ILLUST_PREFIX = `${ILLUST}/light/`;
@@ -1,12 +0,0 @@
1
- const ratio = {
2
- '4:3': { width: 180, height: 135 },
3
- '1:1': { width: 250, height: 250 },
4
- };
5
-
6
- export const getIllustAspectRatio = (name: string) => {
7
- if (name.startsWith('spot-')) {
8
- return ratio['4:3'];
9
- }
10
-
11
- return ratio['1:1'];
12
- };
package/src/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './components/index';
2
- export * from './utils/illust';
@@ -1,9 +0,0 @@
1
- import { ILLUST } from '../constants/path';
2
-
3
- export const prefetchIllust = async ({
4
- name,
5
- isDark = false,
6
- }: {
7
- name: string;
8
- isDark?: boolean;
9
- }) => await fetch(`${ILLUST}${isDark ? '/dark/' : '/light/'}${name}.webp`);
@@ -1,35 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "target": "ESNext",
5
- "emitDeclarationOnly": true,
6
- "skipLibCheck": true,
7
- "allowJs": true,
8
- "incremental": false,
9
- "jsx": "react-jsx",
10
- "rootDir": "src",
11
- "outDir": "lib",
12
- "module": "ESNext",
13
- "moduleResolution": "Bundler",
14
- "esModuleInterop": true,
15
- "forceConsistentCasingInFileNames": true,
16
- "declaration": true,
17
- "strict": true,
18
- "noImplicitAny": true,
19
- "resolveJsonModule": true,
20
- "baseUrl": ".",
21
- "plugins": [
22
- {
23
- "name": "next"
24
- }
25
- // {
26
- // "name": "typescript-plugin-css-modules"
27
- // }
28
- ],
29
- "paths": {
30
- "@/*": ["./src/*"]
31
- }
32
- },
33
- "include": ["next-env.d.ts", "src/**/*.ts", "src/**/*.tsx", ".next/types/**/*.ts"],
34
- "exclude": ["node_modules", "**/*.stories.ts", "**/*.stories.tsx"]
35
- }
package/tsconfig.json DELETED
@@ -1,29 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "lib": ["dom", "dom.iterable", "esnext"],
5
- "allowJs": true,
6
- "skipLibCheck": true,
7
- "noEmit": false,
8
- "resolveJsonModule": true,
9
- "isolatedModules": true,
10
- "jsx": "preserve",
11
- "incremental": true,
12
- "baseUrl": ".",
13
- "module": "ESNext",
14
- "moduleResolution": "Bundler",
15
- "plugins": [
16
- {
17
- "name": "next"
18
- }
19
- // {
20
- // "name": "typescript-plugin-css-modules"
21
- // }
22
- ],
23
- "paths": {
24
- "@/*": ["./src/*"]
25
- }
26
- },
27
- "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "../illust/src/utils/illust.ts", "../illust/src/types/illust.ts"],
28
- "exclude": ["node_modules"]
29
- }