@liner-fe/prism 2.1.56 → 2.1.58
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 +26 -1
- package/lib/index.js +1853 -1751
- package/lib/index.js.map +1 -1
- package/package.json +5 -8
- package/lib/illust.d.ts +0 -28
- package/lib/illust.js +0 -87
- package/lib/illust.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liner-fe/prism",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.58",
|
|
4
4
|
"packageManager": "yarn@3.6.0",
|
|
5
|
-
"type": "module",
|
|
6
5
|
"scripts": {
|
|
7
6
|
"dev": "next dev",
|
|
8
7
|
"start": "next start",
|
|
9
8
|
"lint": "next lint",
|
|
10
9
|
"storybook": "storybook dev -p 6006",
|
|
11
10
|
"build-storybook": "storybook build",
|
|
12
|
-
"ts-node": "tsx --tsconfig tsconfig.build.json",
|
|
11
|
+
"ts-node": "tsx --tsconfig ./tsconfig.build.json",
|
|
13
12
|
"appendCSS": "yarn ts-node ./scripts/index.ts",
|
|
14
|
-
"build": "yarn illustToTypescriptCode && yarn
|
|
15
|
-
"build:package": "yarn build
|
|
16
|
-
"build:illust": "yarn tsup --config ./config/illust-tsup.config.ts",
|
|
17
|
-
"build:main": "yarn tsup --config ./config/tsup.config.ts",
|
|
13
|
+
"build": "yarn illustToTypescriptCode && yarn tsup --config ./config/tsup/tsup.config.ts && yarn ts-node ./scripts/copyPublic",
|
|
14
|
+
"build:package": "yarn build",
|
|
18
15
|
"prepack": "yarn build",
|
|
19
16
|
"illust": "yarn ts-node ./scripts/format-illust && find . -type d -empty -delete",
|
|
20
17
|
"illustToTypescriptCode": "yarn workspace @liner-fe/prism ts-node ./scripts/illustToTypescriptCode"
|
|
21
18
|
},
|
|
22
19
|
"dependencies": {
|
|
23
20
|
"@artsy/fresnel": "^7.1.4",
|
|
24
|
-
"@liner-fe/design-token": "
|
|
21
|
+
"@liner-fe/design-token": "2.3.22",
|
|
25
22
|
"clsx": "^2.1.1",
|
|
26
23
|
"cva": "beta",
|
|
27
24
|
"date-fns": "^4.1.0",
|
package/lib/illust.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ImageProps } from 'next/image';
|
|
3
|
-
import { Property } from 'csstype';
|
|
4
|
-
|
|
5
|
-
type LightIllustType = "decoration-airplane-1_1" | "decoration-bulb-1_1" | "decoration-car-1_1" | "decoration-coffee-1_1" | "decoration-english-1_1" | "decoration-flag-1_1" | "decoration-hourglass-1_1" | "decoration-money-1_1" | "decoration-palm-1_1" | "decoration-rocket-1_1" | "decoration-shake_hands-1_1" | "decoration-star_01-1_1" | "decoration-star_02-1_1" | "decoration-star_03-1_1" | "decoration-star_04-1_1" | "decoration-star_05-1_1" | "decoration-star_06-1_1" | "decoration-star_07-1_1" | "decoration-star_08-1_1" | "decoration-star_09-1_1" | "decoration-star_10-1_1" | "decoration-star_11-1_1" | "decoration-tennis-1_1" | "object-bomb-1_1" | "object-book_pencil-4_3" | "object-brain-1_1" | "object-clap-1_1" | "object-documents_02-1_1" | "object-empty_box-1_1" | "object-empty_box-4_3" | "object-feather_pen-1_1" | "object-folder_01-1_1" | "object-folder_02-1_1" | "object-free_ticket-1_1" | "object-gift-1_1" | "object-give_gift-1_1" | "object-graduation_cap_pencil-4_3" | "object-lock-4_3" | "object-magnifying_glass-1_1" | "object-magnifying_glass-4_3" | "object-megaphone-1_1" | "object-paper-1_1" | "object-pencil_paper-16_9" | "object-puzzle-4_3" | "object-smoke-16_9" | "object-university_01-1_1" | "object-university_02-1_1" | "object_documents_01-1_1" | "object_find_man-1_1" | "person-ai_writing-1_1" | "person-bye-4_3" | "person-cheerup-16_9" | "person-cheerup-4_3" | "person-holding_a_book-1_1" | "person-introduce-1_1" | "person-introduce-pro-1_1" | "person-make_profile-1_1" | "person-raining-1_1" | "person-searching-16_9" | "person-searching_01-1_1" | "person-searching_01-4_3" | "person-searching_02-1_1" | "person-space_in_work-4_3" | "person-standing_with_a_star-16_9" | "person-time_out_01-1_1" | "person-time_out_02-1_1" | "person-time_out_03-1_1" | "person-time_out_04-1_1" | "person-time_out_05-1_1" | "person-understand-1_1" | "person-working_01-4_3" | "person-working_02-4_3" | "person-worried-1_1" | "person-worried_01-4_3" | "person-worried_02-4_3" | "person-worried_03-4_3" | "person-worried_04-4_3" | "person-writing_01-1_1" | "person-writing_02-1_1";
|
|
6
|
-
type DarkIllustType = "decoration-airplane-1_1" | "decoration-bulb-1_1" | "decoration-car-1_1" | "decoration-flag-1_1" | "decoration-hourglass-1_1" | "decoration-rocket-1_1" | "decoration-star_01-1_1" | "decoration-star_02-1_1" | "decoration-star_03-1_1" | "decoration-star_04-1_1" | "decoration-star_05-1_1" | "decoration-star_06-1_1" | "decoration-star_07-1_1" | "decoration-star_08-1_1" | "decoration-star_09-1_1" | "decoration-star_10-1_1" | "decoration-star_11-1_1" | "object-bomb-1_1" | "object-brain-1_1" | "object-clap-1_1" | "object-documents_02-1_1" | "object-empty_box-1_1" | "object-empty_box-4_3" | "object-folder_01-1_1" | "object-folder_02-1_1" | "object-free_ticket-1_1" | "object-gift-1_1" | "object-give_gift-1_1" | "object-graduation_cap_pencil-4_3" | "object-lock-4_3" | "object-magnifying_glass-1_1" | "object-magnifying_glass-4_3" | "object-megaphone-1_1" | "object-paper-1_1" | "object-pencil_paper-16_9" | "object-puzzle-4_3" | "object-smoke-16_9" | "object_documents_01-1_1" | "object_find_man-1_1" | "person-bye-4_3" | "person-holding_a_book-1_1" | "person-introduce-1_1" | "person-introduce-pro-1_1" | "person-make_profile-1_1" | "person-raining-1_1" | "person-searching-16_9" | "person-searching_01-1_1" | "person-searching_01-4_3" | "person-searching_02-1_1" | "person-space_in_work-4_3" | "person-standing_with_a_star-16_9" | "person-time_out_01-1_1" | "person-time_out_02-1_1" | "person-time_out_03-1_1" | "person-time_out_04-1_1" | "person-time_out_05-1_1" | "person-working_01-4_3" | "person-worried-1_1" | "person-worried_01-4_3" | "person-worried_02-4_3" | "person-worried_03-4_3" | "person-worried_04-4_3" | "person-writing_01-1_1";
|
|
7
|
-
type IllustType = DarkIllustType | LightIllustType;
|
|
8
|
-
|
|
9
|
-
interface Source<T extends false | true = true> {
|
|
10
|
-
name: IllustType;
|
|
11
|
-
inverse?: T;
|
|
12
|
-
}
|
|
13
|
-
interface IProps extends Omit<ImageProps, 'alt' | 'width' | 'height' | 'fill' | 'src'> {
|
|
14
|
-
width: number;
|
|
15
|
-
src: {
|
|
16
|
-
light: Source<false>;
|
|
17
|
-
dark?: Source;
|
|
18
|
-
};
|
|
19
|
-
margin?: Property.Margin<string>;
|
|
20
|
-
}
|
|
21
|
-
declare const Illust: (props: IProps) => react_jsx_runtime.JSX.Element;
|
|
22
|
-
|
|
23
|
-
declare const prefetchIllust: ({ name, isDark }: {
|
|
24
|
-
name: IllustType;
|
|
25
|
-
isDark?: boolean;
|
|
26
|
-
}) => Promise<Response>;
|
|
27
|
-
|
|
28
|
-
export { Illust, type Source, prefetchIllust };
|
package/lib/illust.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// src/constants/illust/size.ts
|
|
5
|
-
var ratio = { "16:9": { width: 1344, height: 756 }, "4:3": { width: 1008, height: 756 } };
|
|
6
|
-
var illustSize = {
|
|
7
|
-
"object-pencil_paper-16_9": ratio["16:9"],
|
|
8
|
-
"object-smoke-16_9": ratio["16:9"],
|
|
9
|
-
"person-standing_with_a_star-16_9": ratio["16:9"],
|
|
10
|
-
"person-searching-16_9": ratio["16:9"],
|
|
11
|
-
"person-cheerup-16_9": ratio["16:9"],
|
|
12
|
-
"object-graduation_cap_pencil-4_3": ratio["4:3"],
|
|
13
|
-
"object-book_pencil-4_3": ratio["4:3"],
|
|
14
|
-
"object-puzzle-4_3": ratio["4:3"],
|
|
15
|
-
"object-magnifying_glass-4_3": ratio["4:3"],
|
|
16
|
-
"object-lock-4_3": ratio["4:3"],
|
|
17
|
-
"object-empty_box-4_3": ratio["4:3"],
|
|
18
|
-
"person-working_01-4_3": ratio["4:3"],
|
|
19
|
-
"person-searching_01-4_3": ratio["4:3"],
|
|
20
|
-
"person-worried_01-4_3": ratio["4:3"],
|
|
21
|
-
"person-worried_02-4_3": ratio["4:3"],
|
|
22
|
-
"person-worried_03-4_3": ratio["4:3"],
|
|
23
|
-
"person-worried_04-4_3": ratio["4:3"],
|
|
24
|
-
"person-working_02-4_3": ratio["4:3"],
|
|
25
|
-
"person-bye-4_3": ratio["4:3"],
|
|
26
|
-
"person-space_in_work-4_3": ratio["4:3"],
|
|
27
|
-
"person-cheerup-4_3": ratio["4:3"]
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
// src/components/Illust/index.tsx
|
|
31
|
-
import Image from "next/image";
|
|
32
|
-
|
|
33
|
-
// src/constants/illust/path.ts
|
|
34
|
-
var ILLUST = "/illust";
|
|
35
|
-
var DARK_MODE_ILLUST_PREFIX = `${ILLUST}/dark/`;
|
|
36
|
-
var LIGHT_MODE_ILLUST_PREFIX = `${ILLUST}/light/`;
|
|
37
|
-
|
|
38
|
-
// src/hooks/useIllust.ts
|
|
39
|
-
import { useDarkTheme } from "@liner-fe/design-token";
|
|
40
|
-
var useIllust = /* @__PURE__ */ __name(({ darkSrc, src }) => {
|
|
41
|
-
const { isDarkMode } = useDarkTheme();
|
|
42
|
-
const sourcePrefix = (() => {
|
|
43
|
-
if (isDarkMode) {
|
|
44
|
-
if (darkSrc?.inverse) {
|
|
45
|
-
return LIGHT_MODE_ILLUST_PREFIX;
|
|
46
|
-
}
|
|
47
|
-
return DARK_MODE_ILLUST_PREFIX;
|
|
48
|
-
}
|
|
49
|
-
if (src.inverse === false) {
|
|
50
|
-
return DARK_MODE_ILLUST_PREFIX;
|
|
51
|
-
}
|
|
52
|
-
return LIGHT_MODE_ILLUST_PREFIX;
|
|
53
|
-
})();
|
|
54
|
-
const currentSourceByColorTheme = isDarkMode ? darkSrc?.name || src.name : src.name;
|
|
55
|
-
return { sourcePrefix, currentSourceByColorTheme, isDarkMode };
|
|
56
|
-
}, "useIllust");
|
|
57
|
-
|
|
58
|
-
// src/components/Illust/index.tsx
|
|
59
|
-
import { jsx } from "react/jsx-runtime";
|
|
60
|
-
var Illust = /* @__PURE__ */ __name((props) => {
|
|
61
|
-
const { src, width, margin } = props;
|
|
62
|
-
const { sourcePrefix, currentSourceByColorTheme } = useIllust({ darkSrc: src.dark, src: src.light });
|
|
63
|
-
const aspectRatio = illustSize[currentSourceByColorTheme] ? illustSize[currentSourceByColorTheme].width / illustSize[currentSourceByColorTheme].height : void 0;
|
|
64
|
-
const css = {
|
|
65
|
-
width,
|
|
66
|
-
margin
|
|
67
|
-
};
|
|
68
|
-
const source = `${sourcePrefix}${currentSourceByColorTheme}.webp`;
|
|
69
|
-
return /* @__PURE__ */ jsx("div", { style: css, children: /* @__PURE__ */ jsx(
|
|
70
|
-
Image,
|
|
71
|
-
{
|
|
72
|
-
alt: currentSourceByColorTheme,
|
|
73
|
-
...props,
|
|
74
|
-
src: source,
|
|
75
|
-
width,
|
|
76
|
-
height: aspectRatio ? width / aspectRatio : width
|
|
77
|
-
}
|
|
78
|
-
) });
|
|
79
|
-
}, "Illust");
|
|
80
|
-
|
|
81
|
-
// src/utils/illust.ts
|
|
82
|
-
var prefetchIllust = /* @__PURE__ */ __name(async ({ name, isDark = false }) => await fetch(`${ILLUST}${isDark ? "/dark/" : "/light/"}${name}.webp`), "prefetchIllust");
|
|
83
|
-
export {
|
|
84
|
-
Illust,
|
|
85
|
-
prefetchIllust
|
|
86
|
-
};
|
|
87
|
-
//# sourceMappingURL=illust.js.map
|
package/lib/illust.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants/illust/size.ts","../src/components/Illust/index.tsx","../src/constants/illust/path.ts","../src/hooks/useIllust.ts","../src/utils/illust.ts"],"sourcesContent":["import { IllustType } from '@/types/illust';\n\nconst ratio = { '16:9': { width: 1344, height: 756 }, '4:3': { width: 1008, height: 756 } };\n\nexport const illustSize: Partial<Record<IllustType, { width: number; height: number }>> = {\n 'object-pencil_paper-16_9': ratio['16:9'],\n 'object-smoke-16_9': ratio['16:9'],\n 'person-standing_with_a_star-16_9': ratio['16:9'],\n 'person-searching-16_9': ratio['16:9'],\n 'person-cheerup-16_9': ratio['16:9'],\n 'object-graduation_cap_pencil-4_3': ratio['4:3'],\n 'object-book_pencil-4_3': ratio['4:3'],\n 'object-puzzle-4_3': ratio['4:3'],\n 'object-magnifying_glass-4_3': ratio['4:3'],\n 'object-lock-4_3': ratio['4:3'],\n 'object-empty_box-4_3': ratio['4:3'],\n 'person-working_01-4_3': ratio['4:3'],\n 'person-searching_01-4_3': ratio['4:3'],\n 'person-worried_01-4_3': ratio['4:3'],\n 'person-worried_02-4_3': ratio['4:3'],\n 'person-worried_03-4_3': ratio['4:3'],\n 'person-worried_04-4_3': ratio['4:3'],\n 'person-working_02-4_3': ratio['4:3'],\n 'person-bye-4_3': ratio['4:3'],\n 'person-space_in_work-4_3': ratio['4:3'],\n 'person-cheerup-4_3': ratio['4:3'],\n};\n","import { illustSize } from '@/constants/illust/size';\nimport Image, { ImageProps } from 'next/image';\nimport { CSSProperties } from 'react';\nimport { useIllust } from '@/hooks/useIllust';\nimport { IllustType } from '@/types/illust';\nimport { Property } from 'csstype';\n\nexport interface Source<T extends false | true = true> {\n name: IllustType;\n inverse?: T;\n}\n\ninterface IProps extends Omit<ImageProps, 'alt' | 'width' | 'height' | 'fill' | 'src'> {\n width: number;\n src: { light: Source<false>; dark?: Source };\n margin?: Property.Margin<string>;\n}\n\nexport const Illust = (props: IProps) => {\n const { src, width, margin } = props;\n const { sourcePrefix, currentSourceByColorTheme } = useIllust({ darkSrc: src.dark, src: src.light });\n\n const aspectRatio = illustSize[currentSourceByColorTheme]\n ? illustSize[currentSourceByColorTheme].width / illustSize[currentSourceByColorTheme].height\n : undefined;\n\n const css: CSSProperties = {\n width,\n margin,\n };\n\n const source = `${sourcePrefix}${currentSourceByColorTheme}.webp`;\n\n return (\n <div style={css}>\n <Image\n alt={currentSourceByColorTheme}\n {...props}\n src={source}\n width={width}\n height={aspectRatio ? width / aspectRatio : width}\n />\n </div>\n );\n};\n","export const ILLUST = '/illust';\n\nexport const DARK_MODE_ILLUST_PREFIX = `${ILLUST}/dark/`;\nexport const LIGHT_MODE_ILLUST_PREFIX = `${ILLUST}/light/`;\n","import { DARK_MODE_ILLUST_PREFIX, LIGHT_MODE_ILLUST_PREFIX } from '@/constants/illust/path';\nimport { Source } from '@/illust';\nimport { useDarkTheme } from '@liner-fe/design-token';\n\nexport const useIllust = ({ darkSrc, src }: { darkSrc?: Source; src: Source<false> }) => {\n const { isDarkMode } = useDarkTheme();\n\n const sourcePrefix = (() => {\n if (isDarkMode) {\n if (darkSrc?.inverse) {\n return LIGHT_MODE_ILLUST_PREFIX;\n }\n\n return DARK_MODE_ILLUST_PREFIX;\n }\n\n if (src.inverse === false) {\n return DARK_MODE_ILLUST_PREFIX;\n }\n\n return LIGHT_MODE_ILLUST_PREFIX;\n })();\n\n const currentSourceByColorTheme = isDarkMode ? darkSrc?.name || src.name : src.name;\n\n return { sourcePrefix, currentSourceByColorTheme, isDarkMode };\n};\n","import { ILLUST } from '@/constants/illust/path';\nimport { IllustType } from '@/types/illust';\n\nexport const prefetchIllust = async ({ name, isDark = false }: { name: IllustType; isDark?: boolean }) =>\n await fetch(`${ILLUST}${isDark ? '/dark/' : '/light/'}${name}.webp`);\n"],"mappings":";;;;AAEA,IAAM,QAAQ,EAAE,QAAQ,EAAE,OAAO,MAAM,QAAQ,IAAI,GAAG,OAAO,EAAE,OAAO,MAAM,QAAQ,IAAI,EAAE;AAEnF,IAAM,aAA6E;AAAA,EACx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