@liner-fe/prism 2.8.15 → 2.8.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liner-fe/prism",
3
- "version": "2.8.15",
3
+ "version": "2.8.17",
4
4
  "scripts": {
5
5
  "dev": "next dev",
6
6
  "start": "next start",
@@ -9,8 +9,7 @@
9
9
  "build-storybook": "storybook build",
10
10
  "ts-node": "tsx --tsconfig ./tsconfig.build.json",
11
11
  "appendCSS": "yarn ts-node ./scripts/index.ts",
12
- "build": "yarn build:main && yarn build:illust",
13
- "build:illust": "yarn tsup --config ./config/tsup/illust-tsup.config.ts",
12
+ "build": "yarn build:main",
14
13
  "build:main": "yarn tsup --config ./config/tsup/tsup.config.ts",
15
14
  "build:package": "yarn build",
16
15
  "prepack": "yarn build"
@@ -21,6 +20,7 @@
21
20
  "@liner-fe/design-token": "workspace:^",
22
21
  "@liner-fe/design-token-primitive": "workspace:^",
23
22
  "@liner-fe/icon": "workspace:^",
23
+ "@liner-fe/illust": "workspace:^",
24
24
  "clsx": "^2.1.1",
25
25
  "cva": "beta",
26
26
  "date-fns": "^4.1.0",
@@ -72,8 +72,21 @@
72
72
  "access": "public",
73
73
  "main": "./lib/index.js"
74
74
  },
75
- "main": "./lib/index.js",
75
+ "main": "./lib/index.cjs",
76
+ "module": "./lib/index.js",
76
77
  "types": "./lib/index.d.ts",
78
+ "exports": {
79
+ ".": {
80
+ "import": {
81
+ "types": "./lib/index.d.ts",
82
+ "default": "./lib/index.js"
83
+ },
84
+ "require": {
85
+ "types": "./lib/index.d.ts",
86
+ "default": "./lib/index.cjs"
87
+ }
88
+ }
89
+ },
77
90
  "files": [
78
91
  "lib"
79
92
  ],
package/lib/illust.d.ts DELETED
@@ -1,31 +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
- 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"];
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"];
7
-
8
- type LightIllustType = (typeof illustNames)[number];
9
- type DarkIllustType = (typeof darkIllustNames)[number];
10
- type IllustType = DarkIllustType | LightIllustType;
11
-
12
- interface Source<T extends false | true = true> {
13
- name: IllustType;
14
- inverse?: T;
15
- }
16
- interface IllustProps extends Omit<ImageProps, 'alt' | 'width' | 'height' | 'fill' | 'src'> {
17
- width: number;
18
- src: {
19
- light: Source<false>;
20
- dark?: Source;
21
- };
22
- margin?: Property.Margin<string>;
23
- }
24
- declare const Illust: (props: IllustProps) => react_jsx_runtime.JSX.Element;
25
-
26
- declare const prefetchIllust: ({ name, isDark, }: {
27
- name: IllustType;
28
- isDark?: boolean;
29
- }) => Promise<Response>;
30
-
31
- export { Illust, type IllustProps, type Source, prefetchIllust };
package/lib/illust.js DELETED
@@ -1,132 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
-
31
- // src/illust.ts
32
- var illust_exports = {};
33
- __export(illust_exports, {
34
- Illust: () => Illust,
35
- prefetchIllust: () => prefetchIllust
36
- });
37
- module.exports = __toCommonJS(illust_exports);
38
-
39
- // src/constants/illust/size.ts
40
- var ratio = {
41
- "4:3": { width: 180, height: 135 },
42
- "1:1": { width: 250, height: 250 }
43
- };
44
- var illustSize = {
45
- "hero-gift": ratio["1:1"],
46
- "hero-search": ratio["1:1"],
47
- "mini-documents-2": ratio["1:1"],
48
- "mini-documents-3": ratio["1:1"],
49
- "mini-documents-4": ratio["1:1"],
50
- "mini-documents-5": ratio["1:1"],
51
- "mini-documents": ratio["1:1"],
52
- "mini-egg": ratio["1:1"],
53
- "mini-gift": ratio["1:1"],
54
- "mini-graduation_hat": ratio["1:1"],
55
- "mini-search": ratio["1:1"],
56
- "mini-ticket": ratio["1:1"],
57
- "mini-window": ratio["1:1"],
58
- "spot-catch_star": ratio["4:3"],
59
- "spot-clap": ratio["4:3"],
60
- "spot-empty": ratio["4:3"],
61
- "spot-no_search": ratio["4:3"],
62
- "spot-search-2": ratio["4:3"],
63
- "spot-search-3": ratio["4:3"],
64
- "spot-search-4": ratio["4:3"],
65
- "spot-search-5": ratio["4:3"],
66
- "spot-search": ratio["4:3"],
67
- "spot-write": ratio["4:3"],
68
- "spot-gift": ratio["4:3"],
69
- "mini-empty": ratio["1:1"],
70
- "spot-team": ratio["4:3"]
71
- };
72
-
73
- // src/components/Illust/index.tsx
74
- var import_image = __toESM(require("next/image"));
75
-
76
- // src/constants/illust/path.ts
77
- var ILLUST = "https://assets.getliner.com/common/illust";
78
- var DARK_MODE_ILLUST_PREFIX = `${ILLUST}/dark/`;
79
- var LIGHT_MODE_ILLUST_PREFIX = `${ILLUST}/light/`;
80
-
81
- // src/hooks/useIllust.ts
82
- var import_design_token = require("@liner-fe/design-token");
83
- var useIllust = /* @__PURE__ */ __name(({ darkSrc, src }) => {
84
- const { isDarkMode } = (0, import_design_token.useDarkTheme)();
85
- const sourcePrefix = (() => {
86
- if (isDarkMode) {
87
- if (darkSrc?.inverse) {
88
- return LIGHT_MODE_ILLUST_PREFIX;
89
- }
90
- return DARK_MODE_ILLUST_PREFIX;
91
- }
92
- if (src.inverse === false) {
93
- return DARK_MODE_ILLUST_PREFIX;
94
- }
95
- return LIGHT_MODE_ILLUST_PREFIX;
96
- })();
97
- const currentSourceByColorTheme = isDarkMode ? darkSrc?.name || src.name : src.name;
98
- return { sourcePrefix, currentSourceByColorTheme, isDarkMode };
99
- }, "useIllust");
100
-
101
- // src/components/Illust/index.tsx
102
- var import_jsx_runtime = require("react/jsx-runtime");
103
- var Illust = /* @__PURE__ */ __name((props) => {
104
- const { src, width, margin } = props;
105
- const { sourcePrefix, currentSourceByColorTheme } = useIllust({
106
- darkSrc: src.dark,
107
- src: src.light
108
- });
109
- const aspectRatio = illustSize[currentSourceByColorTheme] ? illustSize[currentSourceByColorTheme].width / illustSize[currentSourceByColorTheme].height : void 0;
110
- const css = {
111
- width,
112
- margin
113
- };
114
- const source = `${sourcePrefix}${currentSourceByColorTheme}.webp`;
115
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: css, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
116
- import_image.default,
117
- {
118
- ...props,
119
- alt: currentSourceByColorTheme,
120
- src: source,
121
- width,
122
- height: aspectRatio ? width / aspectRatio : width,
123
- unoptimized: true
124
- }
125
- ) });
126
- }, "Illust");
127
-
128
- // src/utils/illust.ts
129
- var prefetchIllust = /* @__PURE__ */ __name(async ({
130
- name,
131
- isDark = false
132
- }) => await fetch(`${ILLUST}${isDark ? "/dark/" : "/light/"}${name}.webp`), "prefetchIllust");