line-flex-message-renderer 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/LICENSE +21 -0
- package/README.md +126 -0
- package/dist/index.cjs +472 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +153 -0
- package/dist/index.d.ts +153 -0
- package/dist/index.js +468 -0
- package/dist/index.js.map +1 -0
- package/package.json +75 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
// src/constants.ts
|
|
4
|
+
var TEXT_SIZE = {
|
|
5
|
+
xxs: "11px",
|
|
6
|
+
xs: "12px",
|
|
7
|
+
sm: "13px",
|
|
8
|
+
md: "14px",
|
|
9
|
+
lg: "16px",
|
|
10
|
+
xl: "18px",
|
|
11
|
+
xxl: "22px",
|
|
12
|
+
"3xl": "26px",
|
|
13
|
+
"4xl": "30px",
|
|
14
|
+
"5xl": "36px"
|
|
15
|
+
};
|
|
16
|
+
var SPACING = {
|
|
17
|
+
none: "0px",
|
|
18
|
+
xs: "2px",
|
|
19
|
+
sm: "4px",
|
|
20
|
+
md: "8px",
|
|
21
|
+
lg: "12px",
|
|
22
|
+
xl: "16px",
|
|
23
|
+
xxl: "20px"
|
|
24
|
+
};
|
|
25
|
+
var IMAGE_SIZE = {
|
|
26
|
+
xxs: "40px",
|
|
27
|
+
xs: "60px",
|
|
28
|
+
sm: "80px",
|
|
29
|
+
md: "100px",
|
|
30
|
+
lg: "120px",
|
|
31
|
+
xl: "150px",
|
|
32
|
+
xxl: "180px",
|
|
33
|
+
"3xl": "220px",
|
|
34
|
+
"4xl": "260px",
|
|
35
|
+
"5xl": "300px",
|
|
36
|
+
full: "100%"
|
|
37
|
+
};
|
|
38
|
+
var ICON_SIZE = {
|
|
39
|
+
xxs: "14px",
|
|
40
|
+
xs: "16px",
|
|
41
|
+
sm: "18px",
|
|
42
|
+
md: "20px",
|
|
43
|
+
lg: "24px",
|
|
44
|
+
xl: "28px",
|
|
45
|
+
xxl: "32px"
|
|
46
|
+
};
|
|
47
|
+
var BUBBLE_WIDTH = {
|
|
48
|
+
nano: "120px",
|
|
49
|
+
micro: "150px",
|
|
50
|
+
kilo: "230px",
|
|
51
|
+
mega: "300px",
|
|
52
|
+
giga: "386px"
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// src/utils.ts
|
|
56
|
+
function resolveSize(value, map, fallback) {
|
|
57
|
+
if (!value) return fallback;
|
|
58
|
+
return map[value] ?? value;
|
|
59
|
+
}
|
|
60
|
+
function FlexButtonComponent({ component }) {
|
|
61
|
+
const isPrimary = component.style === "primary";
|
|
62
|
+
const isLink = component.style === "link";
|
|
63
|
+
const height = component.height === "sm" ? "40px" : "52px";
|
|
64
|
+
const style = {
|
|
65
|
+
width: "100%",
|
|
66
|
+
height,
|
|
67
|
+
display: "flex",
|
|
68
|
+
alignItems: "center",
|
|
69
|
+
justifyContent: "center",
|
|
70
|
+
borderRadius: isPrimary || component.style === "secondary" ? "9999px" : void 0,
|
|
71
|
+
backgroundColor: isPrimary ? component.color ?? "#17C950" : isLink ? "transparent" : "#EFEFEF",
|
|
72
|
+
color: isPrimary ? "#ffffff" : isLink ? component.color ?? "#42659A" : "#111111",
|
|
73
|
+
fontSize: TEXT_SIZE.sm,
|
|
74
|
+
fontWeight: 600,
|
|
75
|
+
border: "none",
|
|
76
|
+
cursor: "pointer",
|
|
77
|
+
marginTop: resolveSize(component.margin, SPACING, void 0),
|
|
78
|
+
flex: component.flex !== void 0 ? `${component.flex} 0 0%` : void 0
|
|
79
|
+
};
|
|
80
|
+
return /* @__PURE__ */ jsx("button", { type: "button", style, children: component.action.label });
|
|
81
|
+
}
|
|
82
|
+
function FlexIconComponent({ component }) {
|
|
83
|
+
const size = resolveSize(component.size, ICON_SIZE, ICON_SIZE.md);
|
|
84
|
+
return /* @__PURE__ */ jsx(
|
|
85
|
+
"img",
|
|
86
|
+
{
|
|
87
|
+
src: component.url,
|
|
88
|
+
alt: "",
|
|
89
|
+
style: { width: size, height: size, objectFit: "contain" }
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
function FlexImageComponent({ component }) {
|
|
94
|
+
const [w, h] = (component.aspectRatio ?? "1:1").split(":").map(Number);
|
|
95
|
+
const style = {
|
|
96
|
+
width: component.size === "full" ? "100%" : resolveSize(component.size, IMAGE_SIZE, IMAGE_SIZE.md),
|
|
97
|
+
marginTop: resolveSize(component.margin, SPACING, void 0),
|
|
98
|
+
flex: component.flex !== void 0 ? `${component.flex} 0 0%` : void 0,
|
|
99
|
+
backgroundColor: component.backgroundColor
|
|
100
|
+
};
|
|
101
|
+
const innerStyle = {
|
|
102
|
+
width: "100%",
|
|
103
|
+
paddingTop: `${h / w * 100}%`,
|
|
104
|
+
position: "relative",
|
|
105
|
+
overflow: "hidden"
|
|
106
|
+
};
|
|
107
|
+
const imgStyle = {
|
|
108
|
+
position: "absolute",
|
|
109
|
+
top: 0,
|
|
110
|
+
left: 0,
|
|
111
|
+
width: "100%",
|
|
112
|
+
height: "100%",
|
|
113
|
+
objectFit: component.aspectMode === "fit" ? "contain" : "cover"
|
|
114
|
+
};
|
|
115
|
+
return /* @__PURE__ */ jsx("div", { style, children: /* @__PURE__ */ jsx("div", { style: innerStyle, children: /* @__PURE__ */ jsx("img", { src: component.url, alt: "", style: imgStyle }) }) });
|
|
116
|
+
}
|
|
117
|
+
function FlexSeparatorComponent({
|
|
118
|
+
component
|
|
119
|
+
}) {
|
|
120
|
+
const style = {
|
|
121
|
+
borderTop: `1px solid ${component.color ?? "#E5E5E5"}`,
|
|
122
|
+
marginTop: resolveSize(component.margin, SPACING, void 0),
|
|
123
|
+
width: "100%"
|
|
124
|
+
};
|
|
125
|
+
return /* @__PURE__ */ jsx("hr", { style });
|
|
126
|
+
}
|
|
127
|
+
function FlexSpanComponent({ span }) {
|
|
128
|
+
const style = {
|
|
129
|
+
fontSize: resolveSize(span.size, TEXT_SIZE, "inherit"),
|
|
130
|
+
color: span.color,
|
|
131
|
+
fontWeight: span.weight === "bold" ? 700 : void 0,
|
|
132
|
+
textDecoration: span.decoration !== "none" ? span.decoration : void 0,
|
|
133
|
+
fontStyle: span.style
|
|
134
|
+
};
|
|
135
|
+
return /* @__PURE__ */ jsx("span", { style, children: span.text });
|
|
136
|
+
}
|
|
137
|
+
var alignMap = {
|
|
138
|
+
start: "left",
|
|
139
|
+
center: "center",
|
|
140
|
+
end: "right"
|
|
141
|
+
};
|
|
142
|
+
var gravityMap = {
|
|
143
|
+
top: "flex-start",
|
|
144
|
+
center: "center",
|
|
145
|
+
bottom: "flex-end"
|
|
146
|
+
};
|
|
147
|
+
function FlexTextComponent({ component }) {
|
|
148
|
+
const hasSpans = component.contents && component.contents.length > 0;
|
|
149
|
+
const fontSize = resolveSize(component.size, TEXT_SIZE, TEXT_SIZE.md);
|
|
150
|
+
const style = {
|
|
151
|
+
fontSize,
|
|
152
|
+
color: component.color,
|
|
153
|
+
fontWeight: component.weight === "bold" ? 700 : 400,
|
|
154
|
+
textAlign: alignMap[component.align ?? "start"] ?? "left",
|
|
155
|
+
marginTop: resolveSize(component.margin, SPACING, void 0),
|
|
156
|
+
flex: component.flex !== void 0 ? `${component.flex} 0 0%` : void 0,
|
|
157
|
+
alignSelf: component.gravity ? gravityMap[component.gravity] : void 0,
|
|
158
|
+
textDecoration: component.decoration !== "none" ? component.decoration : void 0,
|
|
159
|
+
fontStyle: component.style,
|
|
160
|
+
lineHeight: component.lineSpacing ?? 1.4,
|
|
161
|
+
...!component.wrap ? {
|
|
162
|
+
overflow: "hidden",
|
|
163
|
+
textOverflow: "ellipsis",
|
|
164
|
+
whiteSpace: "nowrap"
|
|
165
|
+
} : {
|
|
166
|
+
whiteSpace: "pre-wrap",
|
|
167
|
+
wordBreak: "break-word"
|
|
168
|
+
},
|
|
169
|
+
...component.maxLines && component.wrap ? {
|
|
170
|
+
display: "-webkit-box",
|
|
171
|
+
WebkitLineClamp: component.maxLines,
|
|
172
|
+
WebkitBoxOrient: "vertical",
|
|
173
|
+
overflow: "hidden"
|
|
174
|
+
} : {}
|
|
175
|
+
};
|
|
176
|
+
if (hasSpans) {
|
|
177
|
+
return /* @__PURE__ */ jsx("p", { style, children: component.contents?.map((span, i) => /* @__PURE__ */ jsx(FlexSpanComponent, { span }, i)) });
|
|
178
|
+
}
|
|
179
|
+
return /* @__PURE__ */ jsx("p", { style, children: component.text });
|
|
180
|
+
}
|
|
181
|
+
function FlexComponentRenderer({
|
|
182
|
+
component
|
|
183
|
+
}) {
|
|
184
|
+
switch (component.type) {
|
|
185
|
+
case "box":
|
|
186
|
+
return /* @__PURE__ */ jsx(FlexBoxComponent, { component });
|
|
187
|
+
case "text":
|
|
188
|
+
return /* @__PURE__ */ jsx(FlexTextComponent, { component });
|
|
189
|
+
case "image":
|
|
190
|
+
return /* @__PURE__ */ jsx(FlexImageComponent, { component });
|
|
191
|
+
case "button":
|
|
192
|
+
return /* @__PURE__ */ jsx(FlexButtonComponent, { component });
|
|
193
|
+
case "separator":
|
|
194
|
+
return /* @__PURE__ */ jsx(FlexSeparatorComponent, { component });
|
|
195
|
+
case "spacer":
|
|
196
|
+
return /* @__PURE__ */ jsx(
|
|
197
|
+
"div",
|
|
198
|
+
{
|
|
199
|
+
style: {
|
|
200
|
+
flexGrow: 1,
|
|
201
|
+
height: resolveSize(component.size, SPACING, "0px")
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
case "filler":
|
|
206
|
+
return /* @__PURE__ */ jsx("div", { style: { flexGrow: component.flex ?? 1 } });
|
|
207
|
+
case "icon":
|
|
208
|
+
return /* @__PURE__ */ jsx(FlexIconComponent, { component });
|
|
209
|
+
default:
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function FlexBoxComponent({ component }) {
|
|
214
|
+
const isVertical = component.layout === "vertical";
|
|
215
|
+
const isBaseline = component.layout === "baseline";
|
|
216
|
+
const style = {
|
|
217
|
+
display: "flex",
|
|
218
|
+
flexDirection: isVertical ? "column" : "row",
|
|
219
|
+
alignItems: isBaseline ? "baseline" : component.alignItems ?? (isVertical ? "stretch" : "center"),
|
|
220
|
+
justifyContent: component.justifyContent,
|
|
221
|
+
gap: resolveSize(component.spacing, SPACING, void 0),
|
|
222
|
+
marginTop: resolveSize(component.margin, SPACING, void 0),
|
|
223
|
+
padding: resolveSize(component.paddingAll, SPACING, void 0),
|
|
224
|
+
paddingTop: resolveSize(component.paddingTop, SPACING, void 0),
|
|
225
|
+
paddingBottom: resolveSize(component.paddingBottom, SPACING, void 0),
|
|
226
|
+
paddingLeft: resolveSize(component.paddingStart, SPACING, void 0),
|
|
227
|
+
paddingRight: resolveSize(component.paddingEnd, SPACING, void 0),
|
|
228
|
+
backgroundColor: component.backgroundColor,
|
|
229
|
+
borderRadius: component.cornerRadius,
|
|
230
|
+
borderColor: component.borderColor,
|
|
231
|
+
borderWidth: component.borderWidth,
|
|
232
|
+
borderStyle: component.borderWidth ? "solid" : void 0,
|
|
233
|
+
flex: component.flex !== void 0 ? `${component.flex} 0 0%` : void 0
|
|
234
|
+
};
|
|
235
|
+
return /* @__PURE__ */ jsx("div", { style, children: component.contents.map((child, i) => /* @__PURE__ */ jsx(FlexComponentRenderer, { component: child }, i)) });
|
|
236
|
+
}
|
|
237
|
+
function BubbleRenderer({
|
|
238
|
+
json,
|
|
239
|
+
className,
|
|
240
|
+
style: extraStyle
|
|
241
|
+
}) {
|
|
242
|
+
const width = BUBBLE_WIDTH[json.size ?? "mega"];
|
|
243
|
+
const headerBg = json.styles?.header?.backgroundColor;
|
|
244
|
+
const bodyBg = json.styles?.body?.backgroundColor;
|
|
245
|
+
const footerBg = json.styles?.footer?.backgroundColor;
|
|
246
|
+
const footerSep = json.styles?.footer?.separator;
|
|
247
|
+
const bodySep = json.styles?.body?.separator;
|
|
248
|
+
const heroSep = json.styles?.hero?.separator;
|
|
249
|
+
return /* @__PURE__ */ jsxs(
|
|
250
|
+
"div",
|
|
251
|
+
{
|
|
252
|
+
className,
|
|
253
|
+
style: {
|
|
254
|
+
width,
|
|
255
|
+
maxWidth: "100%",
|
|
256
|
+
borderRadius: "16px",
|
|
257
|
+
overflow: "hidden",
|
|
258
|
+
backgroundColor: "#ffffff",
|
|
259
|
+
boxShadow: "0 1px 6px rgba(0,0,0,0.12)",
|
|
260
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Arial, sans-serif',
|
|
261
|
+
...extraStyle
|
|
262
|
+
},
|
|
263
|
+
children: [
|
|
264
|
+
json.header && /* @__PURE__ */ jsx("div", { style: { padding: "16px 16px 0", backgroundColor: headerBg }, children: /* @__PURE__ */ jsx(FlexBoxComponent, { component: json.header }) }),
|
|
265
|
+
heroSep && /* @__PURE__ */ jsx("hr", { style: { borderTop: "1px solid #E5E5E5", margin: 0 } }),
|
|
266
|
+
json.hero && /* @__PURE__ */ jsx(FlexImageComponent, { component: json.hero }),
|
|
267
|
+
bodySep && /* @__PURE__ */ jsx("hr", { style: { borderTop: "1px solid #E5E5E5", margin: 0 } }),
|
|
268
|
+
json.body && /* @__PURE__ */ jsx("div", { style: { padding: "16px", backgroundColor: bodyBg }, children: /* @__PURE__ */ jsx(FlexBoxComponent, { component: json.body }) }),
|
|
269
|
+
footerSep && /* @__PURE__ */ jsx("hr", { style: { borderTop: "1px solid #E5E5E5", margin: 0 } }),
|
|
270
|
+
json.footer && /* @__PURE__ */ jsx("div", { style: { padding: "8px 16px 16px", backgroundColor: footerBg }, children: /* @__PURE__ */ jsx(FlexBoxComponent, { component: json.footer }) })
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
function FlexMessagePreview({
|
|
276
|
+
json,
|
|
277
|
+
className,
|
|
278
|
+
style
|
|
279
|
+
}) {
|
|
280
|
+
if (json.type === "carousel") {
|
|
281
|
+
return /* @__PURE__ */ jsx(
|
|
282
|
+
"div",
|
|
283
|
+
{
|
|
284
|
+
className,
|
|
285
|
+
style: {
|
|
286
|
+
display: "flex",
|
|
287
|
+
gap: 8,
|
|
288
|
+
overflowX: "auto",
|
|
289
|
+
scrollSnapType: "x mandatory",
|
|
290
|
+
...style
|
|
291
|
+
},
|
|
292
|
+
children: json.contents.map((bubble, i) => /* @__PURE__ */ jsx("div", { style: { scrollSnapAlign: "start", flexShrink: 0 }, children: /* @__PURE__ */ jsx(BubbleRenderer, { json: bubble }) }, i))
|
|
293
|
+
}
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
return /* @__PURE__ */ jsx(BubbleRenderer, { json, className, style });
|
|
297
|
+
}
|
|
298
|
+
function DefaultAvatar() {
|
|
299
|
+
return /* @__PURE__ */ jsx(
|
|
300
|
+
"div",
|
|
301
|
+
{
|
|
302
|
+
style: {
|
|
303
|
+
width: 36,
|
|
304
|
+
height: 36,
|
|
305
|
+
borderRadius: "50%",
|
|
306
|
+
backgroundColor: "#00B900",
|
|
307
|
+
display: "flex",
|
|
308
|
+
alignItems: "center",
|
|
309
|
+
justifyContent: "center",
|
|
310
|
+
flexShrink: 0,
|
|
311
|
+
color: "#fff",
|
|
312
|
+
fontSize: 11,
|
|
313
|
+
fontWeight: 700
|
|
314
|
+
},
|
|
315
|
+
children: "BOT"
|
|
316
|
+
}
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
function LineChatFrame({
|
|
320
|
+
children,
|
|
321
|
+
accountName = "\u30C8\u30FC\u30AF",
|
|
322
|
+
avatarUrl,
|
|
323
|
+
width = 375
|
|
324
|
+
}) {
|
|
325
|
+
return /* @__PURE__ */ jsxs(
|
|
326
|
+
"div",
|
|
327
|
+
{
|
|
328
|
+
style: {
|
|
329
|
+
width,
|
|
330
|
+
minHeight: 500,
|
|
331
|
+
borderRadius: 12,
|
|
332
|
+
overflow: "hidden",
|
|
333
|
+
boxShadow: "0 4px 24px rgba(0,0,0,0.18)",
|
|
334
|
+
display: "flex",
|
|
335
|
+
flexDirection: "column",
|
|
336
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Arial, sans-serif'
|
|
337
|
+
},
|
|
338
|
+
children: [
|
|
339
|
+
/* @__PURE__ */ jsxs(
|
|
340
|
+
"div",
|
|
341
|
+
{
|
|
342
|
+
style: {
|
|
343
|
+
backgroundColor: "#00B900",
|
|
344
|
+
color: "#fff",
|
|
345
|
+
padding: "12px 16px",
|
|
346
|
+
fontSize: 16,
|
|
347
|
+
fontWeight: 700,
|
|
348
|
+
display: "flex",
|
|
349
|
+
alignItems: "center",
|
|
350
|
+
gap: 8
|
|
351
|
+
},
|
|
352
|
+
children: [
|
|
353
|
+
/* @__PURE__ */ jsx(
|
|
354
|
+
"svg",
|
|
355
|
+
{
|
|
356
|
+
width: "18",
|
|
357
|
+
height: "18",
|
|
358
|
+
viewBox: "0 0 24 24",
|
|
359
|
+
fill: "none",
|
|
360
|
+
stroke: "currentColor",
|
|
361
|
+
strokeWidth: "2.5",
|
|
362
|
+
strokeLinecap: "round",
|
|
363
|
+
strokeLinejoin: "round",
|
|
364
|
+
role: "img",
|
|
365
|
+
"aria-label": "Back",
|
|
366
|
+
children: /* @__PURE__ */ jsx("path", { d: "M15 18l-6-6 6-6" })
|
|
367
|
+
}
|
|
368
|
+
),
|
|
369
|
+
/* @__PURE__ */ jsx("span", { children: accountName })
|
|
370
|
+
]
|
|
371
|
+
}
|
|
372
|
+
),
|
|
373
|
+
/* @__PURE__ */ jsx(
|
|
374
|
+
"div",
|
|
375
|
+
{
|
|
376
|
+
style: {
|
|
377
|
+
backgroundColor: "#7B9EB0",
|
|
378
|
+
flex: 1,
|
|
379
|
+
padding: "16px 12px",
|
|
380
|
+
display: "flex",
|
|
381
|
+
flexDirection: "column",
|
|
382
|
+
gap: 8
|
|
383
|
+
},
|
|
384
|
+
children: /* @__PURE__ */ jsxs(
|
|
385
|
+
"div",
|
|
386
|
+
{
|
|
387
|
+
style: {
|
|
388
|
+
display: "flex",
|
|
389
|
+
alignItems: "flex-end",
|
|
390
|
+
gap: 8
|
|
391
|
+
},
|
|
392
|
+
children: [
|
|
393
|
+
avatarUrl ? /* @__PURE__ */ jsx(
|
|
394
|
+
"img",
|
|
395
|
+
{
|
|
396
|
+
src: avatarUrl,
|
|
397
|
+
alt: "",
|
|
398
|
+
style: {
|
|
399
|
+
width: 36,
|
|
400
|
+
height: 36,
|
|
401
|
+
borderRadius: "50%",
|
|
402
|
+
objectFit: "cover",
|
|
403
|
+
flexShrink: 0
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
) : /* @__PURE__ */ jsx(DefaultAvatar, {}),
|
|
407
|
+
/* @__PURE__ */ jsx("div", { style: { maxWidth: "calc(100% - 52px)" }, children })
|
|
408
|
+
]
|
|
409
|
+
}
|
|
410
|
+
)
|
|
411
|
+
}
|
|
412
|
+
),
|
|
413
|
+
/* @__PURE__ */ jsx(
|
|
414
|
+
"div",
|
|
415
|
+
{
|
|
416
|
+
style: {
|
|
417
|
+
backgroundColor: "#F7F7F7",
|
|
418
|
+
padding: "10px 12px",
|
|
419
|
+
display: "flex",
|
|
420
|
+
alignItems: "center",
|
|
421
|
+
gap: 8,
|
|
422
|
+
borderTop: "1px solid #E0E0E0"
|
|
423
|
+
},
|
|
424
|
+
children: /* @__PURE__ */ jsx(
|
|
425
|
+
"div",
|
|
426
|
+
{
|
|
427
|
+
style: {
|
|
428
|
+
flex: 1,
|
|
429
|
+
backgroundColor: "#fff",
|
|
430
|
+
borderRadius: 20,
|
|
431
|
+
padding: "8px 14px",
|
|
432
|
+
fontSize: 14,
|
|
433
|
+
color: "#999"
|
|
434
|
+
},
|
|
435
|
+
children: "Aa"
|
|
436
|
+
}
|
|
437
|
+
)
|
|
438
|
+
}
|
|
439
|
+
)
|
|
440
|
+
]
|
|
441
|
+
}
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
function LineTextBubble({ text }) {
|
|
445
|
+
return /* @__PURE__ */ jsx(
|
|
446
|
+
"div",
|
|
447
|
+
{
|
|
448
|
+
style: {
|
|
449
|
+
backgroundColor: "#ffffff",
|
|
450
|
+
borderRadius: "16px 16px 16px 4px",
|
|
451
|
+
padding: "10px 14px",
|
|
452
|
+
fontSize: 14,
|
|
453
|
+
lineHeight: 1.5,
|
|
454
|
+
color: "#111111",
|
|
455
|
+
whiteSpace: "pre-wrap",
|
|
456
|
+
wordBreak: "break-word",
|
|
457
|
+
maxWidth: 260,
|
|
458
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.08)",
|
|
459
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Arial, sans-serif'
|
|
460
|
+
},
|
|
461
|
+
children: text
|
|
462
|
+
}
|
|
463
|
+
);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
export { FlexMessagePreview, LineChatFrame, LineTextBubble };
|
|
467
|
+
//# sourceMappingURL=index.js.map
|
|
468
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/constants.ts","../src/utils.ts","../src/components/FlexButton.tsx","../src/components/FlexIcon.tsx","../src/components/FlexImage.tsx","../src/components/FlexSeparator.tsx","../src/components/FlexSpan.tsx","../src/components/FlexText.tsx","../src/components/FlexComponentRenderer.tsx","../src/components/FlexBox.tsx","../src/components/FlexMessagePreview.tsx","../src/components/LineChatFrame.tsx","../src/components/LineTextBubble.tsx"],"names":["jsx","jsxs"],"mappings":";;;AAAO,IAAM,SAAA,GAAoC;AAAA,EAChD,GAAA,EAAK,MAAA;AAAA,EACL,EAAA,EAAI,MAAA;AAAA,EACJ,EAAA,EAAI,MAAA;AAAA,EACJ,EAAA,EAAI,MAAA;AAAA,EACJ,EAAA,EAAI,MAAA;AAAA,EACJ,EAAA,EAAI,MAAA;AAAA,EACJ,GAAA,EAAK,MAAA;AAAA,EACL,KAAA,EAAO,MAAA;AAAA,EACP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T,QAAA,EAAU,EAAA;AAAA,QACV,UAAA,EAAY,GAAA;AAAA,QACZ,KAAA,EAAO,SAAA;AAAA,QACP,UAAA,EAAY,UAAA;AAAA,QACZ,SAAA,EAAW,YAAA;AAAA,QACX,QAAA,EAAU,GAAA;AAAA,QACV,SAAA,EAAW,4BAAA;AAAA,QACX,UAAA,EACC;AAAA,OACF;AAAA,MAEC,QAAA,EAAA;AAAA;AAAA,GACF;AAEF","file":"index.js","sourcesContent":["export const TEXT_SIZE: Record<string, string> = {\n\txxs: \"11px\",\n\txs: \"12px\",\n\tsm: \"13px\",\n\tmd: \"14px\",\n\tlg: \"16px\",\n\txl: \"18px\",\n\txxl: \"22px\",\n\t\"3xl\": \"26px\",\n\t\"4xl\": \"30px\",\n\t\"5xl\": \"36px\",\n};\n\nexport const SPACING: Record<string, string> = {\n\tnone: \"0px\",\n\txs: \"2px\",\n\tsm: \"4px\",\n\tmd: \"8px\",\n\tlg: \"12px\",\n\txl: \"16px\",\n\txxl: \"20px\",\n};\n\nexport const IMAGE_SIZE: Record<string, string> = {\n\txxs: \"40px\",\n\txs: \"60px\",\n\tsm: \"80px\",\n\tmd: \"100px\",\n\tlg: \"120px\",\n\txl: \"150px\",\n\txxl: \"180px\",\n\t\"3xl\": \"220px\",\n\t\"4xl\": \"260px\",\n\t\"5xl\": \"300px\",\n\tfull: \"100%\",\n};\n\nexport const ICON_SIZE: Record<string, string> = {\n\txxs: \"14px\",\n\txs: \"16px\",\n\tsm: \"18px\",\n\tmd: \"20px\",\n\tlg: \"24px\",\n\txl: \"28px\",\n\txxl: \"32px\",\n};\n\nexport const BUBBLE_WIDTH: Record<string, string> = {\n\tnano: \"120px\",\n\tmicro: \"150px\",\n\tkilo: \"230px\",\n\tmega: \"300px\",\n\tgiga: \"386px\",\n};\n","export function resolveSize(\n\tvalue: string | undefined,\n\tmap: Record<string, string>,\n\tfallback?: string,\n): string | undefined {\n\tif (!value) return fallback;\n\treturn map[value] ?? value;\n}\n","import type React from \"react\";\nimport { SPACING, TEXT_SIZE } from \"../constants\";\nimport type { FlexButton } from \"../types\";\nimport { resolveSize } from \"../utils\";\n\nexport function FlexButtonComponent({ component }: { component: FlexButton }) {\n\tconst isPrimary = component.style === \"primary\";\n\tconst isLink = component.style === \"link\";\n\tconst height = component.height === \"sm\" ? \"40px\" : \"52px\";\n\n\tconst style: React.CSSProperties = {\n\t\twidth: \"100%\",\n\t\theight,\n\t\tdisplay: \"flex\",\n\t\talignItems: \"center\",\n\t\tjustifyContent: \"center\",\n\t\tborderRadius:\n\t\t\tisPrimary || component.style === \"secondary\" ? \"9999px\" : undefined,\n\t\tbackgroundColor: isPrimary\n\t\t\t? (component.color ?? \"#17C950\")\n\t\t\t: isLink\n\t\t\t\t? \"transparent\"\n\t\t\t\t: \"#EFEFEF\",\n\t\tcolor: isPrimary\n\t\t\t? \"#ffffff\"\n\t\t\t: isLink\n\t\t\t\t? (component.color ?? \"#42659A\")\n\t\t\t\t: \"#111111\",\n\t\tfontSize: TEXT_SIZE.sm,\n\t\tfontWeight: 600,\n\t\tborder: \"none\",\n\t\tcursor: \"pointer\",\n\t\tmarginTop: resolveSize(component.margin, SPACING, undefined),\n\t\tflex: component.flex !== undefined ? `${component.flex} 0 0%` : undefined,\n\t};\n\n\treturn (\n\t\t<button type=\"button\" style={style}>\n\t\t\t{component.action.label}\n\t\t</button>\n\t);\n}\n","import { ICON_SIZE } from \"../constants\";\nimport type { FlexIcon } from \"../types\";\nimport { resolveSize } from \"../utils\";\n\nexport function FlexIconComponent({ component }: { component: FlexIcon }) {\n\tconst size = resolveSize(component.size, ICON_SIZE, ICON_SIZE.md);\n\treturn (\n\t\t<img\n\t\t\tsrc={component.url}\n\t\t\talt=\"\"\n\t\t\tstyle={{ width: size, height: size, objectFit: \"contain\" }}\n\t\t/>\n\t);\n}\n","import type React from \"react\";\nimport { IMAGE_SIZE, SPACING } from \"../constants\";\nimport type { FlexImage } from \"../types\";\nimport { resolveSize } from \"../utils\";\n\nexport function FlexImageComponent({ component }: { component: FlexImage }) {\n\tconst [w, h] = (component.aspectRatio ?? \"1:1\").split(\":\").map(Number);\n\n\tconst style: React.CSSProperties = {\n\t\twidth:\n\t\t\tcomponent.size === \"full\"\n\t\t\t\t? \"100%\"\n\t\t\t\t: resolveSize(component.size, IMAGE_SIZE, IMAGE_SIZE.md),\n\t\tmarginTop: resolveSize(component.margin, SPACING, undefined),\n\t\tflex: component.flex !== undefined ? `${component.flex} 0 0%` : undefined,\n\t\tbackgroundColor: component.backgroundColor,\n\t};\n\n\tconst innerStyle: React.CSSProperties = {\n\t\twidth: \"100%\",\n\t\tpaddingTop: `${(h / w) * 100}%`,\n\t\tposition: \"relative\",\n\t\toverflow: \"hidden\",\n\t};\n\n\tconst imgStyle: React.CSSProperties = {\n\t\tposition: \"absolute\",\n\t\ttop: 0,\n\t\tleft: 0,\n\t\twidth: \"100%\",\n\t\theight: \"100%\",\n\t\tobjectFit: component.aspectMode === \"fit\" ? \"contain\" : \"cover\",\n\t};\n\n\treturn (\n\t\t<div style={style}>\n\t\t\t<div style={innerStyle}>\n\t\t\t\t<img src={component.url} alt=\"\" style={imgStyle} />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","import type React from \"react\";\nimport { SPACING } from \"../constants\";\nimport type { FlexSeparator } from \"../types\";\nimport { resolveSize } from \"../utils\";\n\nexport function FlexSeparatorComponent({\n\tcomponent,\n}: {\n\tcomponent: FlexSeparator;\n}) {\n\tconst style: React.CSSProperties = {\n\t\tborderTop: `1px solid ${component.color ?? \"#E5E5E5\"}`,\n\t\tmarginTop: resolveSize(component.margin, SPACING, undefined),\n\t\twidth: \"100%\",\n\t};\n\treturn <hr style={style} />;\n}\n","import type React from \"react\";\nimport { TEXT_SIZE } from \"../constants\";\nimport type { FlexSpan } from \"../types\";\nimport { resolveSize } from \"../utils\";\n\nexport function FlexSpanComponent({ span }: { span: FlexSpan }) {\n\tconst style: React.CSSProperties = {\n\t\tfontSize: resolveSize(span.size, TEXT_SIZE, \"inherit\"),\n\t\tcolor: span.color,\n\t\tfontWeight: span.weight === \"bold\" ? 700 : undefined,\n\t\ttextDecoration: span.decoration !== \"none\" ? span.decoration : undefined,\n\t\tfontStyle: span.style,\n\t};\n\treturn <span style={style}>{span.text}</span>;\n}\n","import type React from \"react\";\nimport { SPACING, TEXT_SIZE } from \"../constants\";\nimport type { FlexText } from \"../types\";\nimport { resolveSize } from \"../utils\";\nimport { FlexSpanComponent } from \"./FlexSpan\";\n\nconst alignMap: Record<string, string> = {\n\tstart: \"left\",\n\tcenter: \"center\",\n\tend: \"right\",\n};\n\nconst gravityMap: Record<string, string> = {\n\ttop: \"flex-start\",\n\tcenter: \"center\",\n\tbottom: \"flex-end\",\n};\n\nexport function FlexTextComponent({ component }: { component: FlexText }) {\n\tconst hasSpans = component.contents && component.contents.length > 0;\n\tconst fontSize = resolveSize(component.size, TEXT_SIZE, TEXT_SIZE.md);\n\n\tconst style: React.CSSProperties = {\n\t\tfontSize,\n\t\tcolor: component.color,\n\t\tfontWeight: component.weight === \"bold\" ? 700 : 400,\n\t\ttextAlign: (alignMap[component.align ?? \"start\"] ??\n\t\t\t\"left\") as React.CSSProperties[\"textAlign\"],\n\t\tmarginTop: resolveSize(component.margin, SPACING, undefined),\n\t\tflex: component.flex !== undefined ? `${component.flex} 0 0%` : undefined,\n\t\talignSelf: component.gravity ? gravityMap[component.gravity] : undefined,\n\t\ttextDecoration:\n\t\t\tcomponent.decoration !== \"none\" ? component.decoration : undefined,\n\t\tfontStyle: component.style,\n\t\tlineHeight: component.lineSpacing ?? 1.4,\n\t\t...(!component.wrap\n\t\t\t? {\n\t\t\t\t\toverflow: \"hidden\",\n\t\t\t\t\ttextOverflow: \"ellipsis\",\n\t\t\t\t\twhiteSpace: \"nowrap\",\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\twhiteSpace: \"pre-wrap\",\n\t\t\t\t\twordBreak: \"break-word\",\n\t\t\t\t}),\n\t\t...(component.maxLines && component.wrap\n\t\t\t? {\n\t\t\t\t\tdisplay: \"-webkit-box\",\n\t\t\t\t\tWebkitLineClamp: component.maxLines,\n\t\t\t\t\tWebkitBoxOrient: \"vertical\" as const,\n\t\t\t\t\toverflow: \"hidden\",\n\t\t\t\t}\n\t\t\t: {}),\n\t};\n\n\tif (hasSpans) {\n\t\treturn (\n\t\t\t<p style={style}>\n\t\t\t\t{component.contents?.map((span, i) => (\n\t\t\t\t\t<FlexSpanComponent key={i} span={span} />\n\t\t\t\t))}\n\t\t\t</p>\n\t\t);\n\t}\n\n\treturn <p style={style}>{component.text}</p>;\n}\n","import { SPACING } from \"../constants\";\nimport type { FlexComponentType, FlexFiller, FlexSpacer } from \"../types\";\nimport { resolveSize } from \"../utils\";\nimport { FlexBoxComponent } from \"./FlexBox\";\nimport { FlexButtonComponent } from \"./FlexButton\";\nimport { FlexIconComponent } from \"./FlexIcon\";\nimport { FlexImageComponent } from \"./FlexImage\";\nimport { FlexSeparatorComponent } from \"./FlexSeparator\";\nimport { FlexTextComponent } from \"./FlexText\";\n\nexport function FlexComponentRenderer({\n\tcomponent,\n}: {\n\tcomponent: FlexComponentType;\n}) {\n\tswitch (component.type) {\n\t\tcase \"box\":\n\t\t\treturn <FlexBoxComponent component={component} />;\n\t\tcase \"text\":\n\t\t\treturn <FlexTextComponent component={component} />;\n\t\tcase \"image\":\n\t\t\treturn <FlexImageComponent component={component} />;\n\t\tcase \"button\":\n\t\t\treturn <FlexButtonComponent component={component} />;\n\t\tcase \"separator\":\n\t\t\treturn <FlexSeparatorComponent component={component} />;\n\t\tcase \"spacer\":\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tflexGrow: 1,\n\t\t\t\t\t\theight: resolveSize((component as FlexSpacer).size, SPACING, \"0px\"),\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t);\n\t\tcase \"filler\":\n\t\t\treturn <div style={{ flexGrow: (component as FlexFiller).flex ?? 1 }} />;\n\t\tcase \"icon\":\n\t\t\treturn <FlexIconComponent component={component} />;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n}\n","import type React from \"react\";\nimport { SPACING } from \"../constants\";\nimport type { FlexBox } from \"../types\";\nimport { resolveSize } from \"../utils\";\nimport { FlexComponentRenderer } from \"./FlexComponentRenderer\";\n\nexport function FlexBoxComponent({ component }: { component: FlexBox }) {\n\tconst isVertical = component.layout === \"vertical\";\n\tconst isBaseline = component.layout === \"baseline\";\n\n\tconst style: React.CSSProperties = {\n\t\tdisplay: \"flex\",\n\t\tflexDirection: isVertical ? \"column\" : \"row\",\n\t\talignItems: isBaseline\n\t\t\t? \"baseline\"\n\t\t\t: (component.alignItems ?? (isVertical ? \"stretch\" : \"center\")),\n\t\tjustifyContent: component.justifyContent,\n\t\tgap: resolveSize(component.spacing, SPACING, undefined),\n\t\tmarginTop: resolveSize(component.margin, SPACING, undefined),\n\t\tpadding: resolveSize(component.paddingAll, SPACING, undefined),\n\t\tpaddingTop: resolveSize(component.paddingTop, SPACING, undefined),\n\t\tpaddingBottom: resolveSize(component.paddingBottom, SPACING, undefined),\n\t\tpaddingLeft: resolveSize(component.paddingStart, SPACING, undefined),\n\t\tpaddingRight: resolveSize(component.paddingEnd, SPACING, undefined),\n\t\tbackgroundColor: component.backgroundColor,\n\t\tborderRadius: component.cornerRadius,\n\t\tborderColor: component.borderColor,\n\t\tborderWidth: component.borderWidth,\n\t\tborderStyle: component.borderWidth ? \"solid\" : undefined,\n\t\tflex: component.flex !== undefined ? `${component.flex} 0 0%` : undefined,\n\t};\n\n\treturn (\n\t\t<div style={style}>\n\t\t\t{component.contents.map((child, i) => (\n\t\t\t\t<FlexComponentRenderer key={i} component={child} />\n\t\t\t))}\n\t\t</div>\n\t);\n}\n","import type React from \"react\";\nimport { BUBBLE_WIDTH } from \"../constants\";\nimport type { FlexBubble, FlexContainer } from \"../types\";\nimport { FlexBoxComponent } from \"./FlexBox\";\nimport { FlexImageComponent } from \"./FlexImage\";\n\nexport interface FlexMessagePreviewProps {\n\t/** Flex Message JSON(bubble or carousel) */\n\tjson: FlexContainer;\n\t/** 追加 className */\n\tclassName?: string;\n\t/** 追加 inline style */\n\tstyle?: React.CSSProperties;\n}\n\nfunction BubbleRenderer({\n\tjson,\n\tclassName,\n\tstyle: extraStyle,\n}: {\n\tjson: FlexBubble;\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n}) {\n\tconst width = BUBBLE_WIDTH[json.size ?? \"mega\"];\n\tconst headerBg = json.styles?.header?.backgroundColor;\n\tconst bodyBg = json.styles?.body?.backgroundColor;\n\tconst footerBg = json.styles?.footer?.backgroundColor;\n\tconst footerSep = json.styles?.footer?.separator;\n\tconst bodySep = json.styles?.body?.separator;\n\tconst heroSep = json.styles?.hero?.separator;\n\n\treturn (\n\t\t<div\n\t\t\tclassName={className}\n\t\t\tstyle={{\n\t\t\t\twidth,\n\t\t\t\tmaxWidth: \"100%\",\n\t\t\t\tborderRadius: \"16px\",\n\t\t\t\toverflow: \"hidden\",\n\t\t\t\tbackgroundColor: \"#ffffff\",\n\t\t\t\tboxShadow: \"0 1px 6px rgba(0,0,0,0.12)\",\n\t\t\t\tfontFamily:\n\t\t\t\t\t'-apple-system, BlinkMacSystemFont, \"Helvetica Neue\", \"Segoe UI\", Arial, sans-serif',\n\t\t\t\t...extraStyle,\n\t\t\t}}\n\t\t>\n\t\t\t{/* Header */}\n\t\t\t{json.header && (\n\t\t\t\t<div style={{ padding: \"16px 16px 0\", backgroundColor: headerBg }}>\n\t\t\t\t\t<FlexBoxComponent component={json.header} />\n\t\t\t\t</div>\n\t\t\t)}\n\n\t\t\t{/* Hero separator */}\n\t\t\t{heroSep && <hr style={{ borderTop: \"1px solid #E5E5E5\", margin: 0 }} />}\n\n\t\t\t{/* Hero */}\n\t\t\t{json.hero && <FlexImageComponent component={json.hero} />}\n\n\t\t\t{/* Body separator */}\n\t\t\t{bodySep && <hr style={{ borderTop: \"1px solid #E5E5E5\", margin: 0 }} />}\n\n\t\t\t{/* Body */}\n\t\t\t{json.body && (\n\t\t\t\t<div style={{ padding: \"16px\", backgroundColor: bodyBg }}>\n\t\t\t\t\t<FlexBoxComponent component={json.body} />\n\t\t\t\t</div>\n\t\t\t)}\n\n\t\t\t{/* Footer separator */}\n\t\t\t{footerSep && (\n\t\t\t\t<hr style={{ borderTop: \"1px solid #E5E5E5\", margin: 0 }} />\n\t\t\t)}\n\n\t\t\t{/* Footer */}\n\t\t\t{json.footer && (\n\t\t\t\t<div style={{ padding: \"8px 16px 16px\", backgroundColor: footerBg }}>\n\t\t\t\t\t<FlexBoxComponent component={json.footer} />\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nexport function FlexMessagePreview({\n\tjson,\n\tclassName,\n\tstyle,\n}: FlexMessagePreviewProps) {\n\tif (json.type === \"carousel\") {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={className}\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\tgap: 8,\n\t\t\t\t\toverflowX: \"auto\",\n\t\t\t\t\tscrollSnapType: \"x mandatory\",\n\t\t\t\t\t...style,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{json.contents.map((bubble, i) => (\n\t\t\t\t\t<div key={i} style={{ scrollSnapAlign: \"start\", flexShrink: 0 }}>\n\t\t\t\t\t\t<BubbleRenderer json={bubble} />\n\t\t\t\t\t</div>\n\t\t\t\t))}\n\t\t\t</div>\n\t\t);\n\t}\n\treturn <BubbleRenderer json={json} className={className} style={style} />;\n}\n","import type React from \"react\";\n\nexport interface LineChatFrameProps {\n\tchildren: React.ReactNode;\n\t/** トーク画面のヘッダー名(デフォルト: \"トーク\") */\n\taccountName?: string;\n\t/** アバター画像 URL(未指定時は緑の BOT アイコン) */\n\tavatarUrl?: string;\n\t/** フレーム幅(デフォルト: 375) */\n\twidth?: number;\n}\n\nfunction DefaultAvatar() {\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\twidth: 36,\n\t\t\t\theight: 36,\n\t\t\t\tborderRadius: \"50%\",\n\t\t\t\tbackgroundColor: \"#00B900\",\n\t\t\t\tdisplay: \"flex\",\n\t\t\t\talignItems: \"center\",\n\t\t\t\tjustifyContent: \"center\",\n\t\t\t\tflexShrink: 0,\n\t\t\t\tcolor: \"#fff\",\n\t\t\t\tfontSize: 11,\n\t\t\t\tfontWeight: 700,\n\t\t\t}}\n\t\t>\n\t\t\tBOT\n\t\t</div>\n\t);\n}\n\nexport function LineChatFrame({\n\tchildren,\n\taccountName = \"トーク\",\n\tavatarUrl,\n\twidth = 375,\n}: LineChatFrameProps) {\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\twidth,\n\t\t\t\tminHeight: 500,\n\t\t\t\tborderRadius: 12,\n\t\t\t\toverflow: \"hidden\",\n\t\t\t\tboxShadow: \"0 4px 24px rgba(0,0,0,0.18)\",\n\t\t\t\tdisplay: \"flex\",\n\t\t\t\tflexDirection: \"column\",\n\t\t\t\tfontFamily:\n\t\t\t\t\t'-apple-system, BlinkMacSystemFont, \"Helvetica Neue\", \"Segoe UI\", Arial, sans-serif',\n\t\t\t}}\n\t\t>\n\t\t\t{/* Header bar */}\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tbackgroundColor: \"#00B900\",\n\t\t\t\t\tcolor: \"#fff\",\n\t\t\t\t\tpadding: \"12px 16px\",\n\t\t\t\t\tfontSize: 16,\n\t\t\t\t\tfontWeight: 700,\n\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\talignItems: \"center\",\n\t\t\t\t\tgap: 8,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\twidth=\"18\"\n\t\t\t\t\theight=\"18\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstrokeWidth=\"2.5\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\trole=\"img\"\n\t\t\t\t\taria-label=\"Back\"\n\t\t\t\t>\n\t\t\t\t\t<path d=\"M15 18l-6-6 6-6\" />\n\t\t\t\t</svg>\n\t\t\t\t<span>{accountName}</span>\n\t\t\t</div>\n\n\t\t\t{/* Chat area */}\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tbackgroundColor: \"#7B9EB0\",\n\t\t\t\t\tflex: 1,\n\t\t\t\t\tpadding: \"16px 12px\",\n\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\tflexDirection: \"column\",\n\t\t\t\t\tgap: 8,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{/* Message row */}\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\t\talignItems: \"flex-end\",\n\t\t\t\t\t\tgap: 8,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{avatarUrl ? (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tsrc={avatarUrl}\n\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\twidth: 36,\n\t\t\t\t\t\t\t\theight: 36,\n\t\t\t\t\t\t\t\tborderRadius: \"50%\",\n\t\t\t\t\t\t\t\tobjectFit: \"cover\",\n\t\t\t\t\t\t\t\tflexShrink: 0,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<DefaultAvatar />\n\t\t\t\t\t)}\n\t\t\t\t\t<div style={{ maxWidth: \"calc(100% - 52px)\" }}>{children}</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t{/* Input bar */}\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tbackgroundColor: \"#F7F7F7\",\n\t\t\t\t\tpadding: \"10px 12px\",\n\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\talignItems: \"center\",\n\t\t\t\t\tgap: 8,\n\t\t\t\t\tborderTop: \"1px solid #E0E0E0\",\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tflex: 1,\n\t\t\t\t\t\tbackgroundColor: \"#fff\",\n\t\t\t\t\t\tborderRadius: 20,\n\t\t\t\t\t\tpadding: \"8px 14px\",\n\t\t\t\t\t\tfontSize: 14,\n\t\t\t\t\t\tcolor: \"#999\",\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\tAa\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","export function LineTextBubble({ text }: { text: string }) {\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tbackgroundColor: \"#ffffff\",\n\t\t\t\tborderRadius: \"16px 16px 16px 4px\",\n\t\t\t\tpadding: \"10px 14px\",\n\t\t\t\tfontSize: 14,\n\t\t\t\tlineHeight: 1.5,\n\t\t\t\tcolor: \"#111111\",\n\t\t\t\twhiteSpace: \"pre-wrap\",\n\t\t\t\twordBreak: \"break-word\",\n\t\t\t\tmaxWidth: 260,\n\t\t\t\tboxShadow: \"0 1px 3px rgba(0,0,0,0.08)\",\n\t\t\t\tfontFamily:\n\t\t\t\t\t'-apple-system, BlinkMacSystemFont, \"Helvetica Neue\", \"Segoe UI\", Arial, sans-serif',\n\t\t\t}}\n\t\t>\n\t\t\t{text}\n\t\t</div>\n\t);\n}\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "line-flex-message-renderer",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React component to render LINE Flex Message JSON as a visual preview — pixel-accurate to the LINE app.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"line",
|
|
7
|
+
"flex-message",
|
|
8
|
+
"line-bot",
|
|
9
|
+
"messaging-api",
|
|
10
|
+
"react",
|
|
11
|
+
"preview",
|
|
12
|
+
"renderer",
|
|
13
|
+
"storybook"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"author": "kanketsu-jp",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/kanketsu-jp/line-flex-renderer-npm.git"
|
|
20
|
+
},
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "./dist/index.cjs",
|
|
23
|
+
"module": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"import": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"default": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"require": {
|
|
32
|
+
"types": "./dist/index.d.cts",
|
|
33
|
+
"default": "./dist/index.cjs"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"README.md",
|
|
40
|
+
"LICENSE"
|
|
41
|
+
],
|
|
42
|
+
"sideEffects": false,
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"react": ">=18.0.0",
|
|
45
|
+
"react-dom": ">=18.0.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@biomejs/biome": "^2.4.9",
|
|
49
|
+
"@storybook/addon-a11y": "^10.3.3",
|
|
50
|
+
"@storybook/addon-docs": "^10.3.3",
|
|
51
|
+
"@storybook/react-vite": "^10.3.3",
|
|
52
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
53
|
+
"@testing-library/react": "^16.3.2",
|
|
54
|
+
"@types/react": "^19.2.14",
|
|
55
|
+
"@types/react-dom": "^19.2.3",
|
|
56
|
+
"jsdom": "^29.0.1",
|
|
57
|
+
"react": "^19.2.4",
|
|
58
|
+
"react-dom": "^19.2.4",
|
|
59
|
+
"storybook": "^10.3.3",
|
|
60
|
+
"tsup": "^8.5.1",
|
|
61
|
+
"typescript": "^6.0.2",
|
|
62
|
+
"vitest": "^4.1.1"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "tsup",
|
|
66
|
+
"dev": "tsup --watch",
|
|
67
|
+
"lint": "biome check src/",
|
|
68
|
+
"lint:fix": "biome check --write src/",
|
|
69
|
+
"test": "vitest run",
|
|
70
|
+
"test:watch": "vitest",
|
|
71
|
+
"storybook": "storybook dev -p 6006",
|
|
72
|
+
"build-storybook": "storybook build",
|
|
73
|
+
"typecheck": "tsc --noEmit"
|
|
74
|
+
}
|
|
75
|
+
}
|