Skip to content

Commit 6ea9e48

Browse files
YunChaoTsaixingoxu
andauthored
update Flex message types (#265)
* changed the maximum number of bubbles that can be included in a carousel * add box justifyContent and alignItems property * add box background * change flex image size * change flex icon, text and span size * add flex text and button adjustMode * add deprecated to flex spacer Co-authored-by: xingo xu <xingoxu@users.noreply.github.com>
1 parent 03e37c4 commit 6ea9e48

File tree

1 file changed

+107
-2
lines changed

1 file changed

+107
-2
lines changed

lib/types.ts

Lines changed: 107 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ export type FlexBlockStyle = {
890890
export type FlexCarousel = {
891891
type: "carousel";
892892
/**
893-
* (Max: 10 bubbles)
893+
* (Max: 12 bubbles)
894894
*/
895895
contents: FlexBubble[];
896896
};
@@ -1061,6 +1061,25 @@ export type FlexBox = {
10611061
* Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
10621062
*/
10631063
action?: Action;
1064+
/**
1065+
* How child elements are aligned along the main axis of the parent element. If the
1066+
* parent element is a horizontal box, this only takes effect when its child elements have
1067+
* their `flex` property set equal to 0. For more information, see [Arranging a box's child elements and free space](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#justify-property)
1068+
* in the Messaging API documentation.
1069+
*/
1070+
justifyContent?:
1071+
| "flex-start"
1072+
| "center"
1073+
| "flex-end"
1074+
| "space-between"
1075+
| "space-around"
1076+
| "space-evenly";
1077+
/**
1078+
* How child elements are aligned along the cross axis of the parent element. For more
1079+
* information, see [Arranging a box's child elements and free space](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#justify-property) in the Messaging API documentation.
1080+
*/
1081+
alignItems?: "flex-start" | "center" | "flex-end";
1082+
background?: Background;
10641083
} & Offset;
10651084

10661085
export type Offset = {
@@ -1095,6 +1114,49 @@ export type Offset = {
10951114
offsetEnd?: string;
10961115
};
10971116

1117+
export type Background = {
1118+
/**
1119+
* The type of background used. Specify these values:
1120+
* - `linearGradient`: Linear gradient. For more information, see [Linear gradient backgrounds](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#linear-gradient-bg) in the Messaging API documentation.
1121+
*/
1122+
type: "linearGradient";
1123+
/**
1124+
* The angle at which a linear gradient moves. Specify the angle using an integer value
1125+
* like `90deg` (90 degrees) or a decimal number like `23.5deg` (23.5 degrees) in the
1126+
* half-open interval [0, 360). The direction of the linear gradient rotates clockwise as the
1127+
* angle increases. Given a value of `0deg`, the gradient starts at the bottom and ends at
1128+
* the top; given a value of `45deg`, the gradient starts at the bottom-left corner and ends
1129+
* at the top-right corner; given a value of 90deg, the gradient starts at the left and ends
1130+
* at the right; and given a value of `180deg`, the gradient starts at the top and ends at
1131+
* the bottom. For more information, see [Direction (angle) of linear gradient backgrounds](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#linear-gradient-bg-angle) in the Messaging API documentation.
1132+
*/
1133+
angle: string;
1134+
/**
1135+
* The color at the gradient's starting point. Use a hexadecimal color code in the
1136+
* `#RRGGBB` or `#RRGGBBAA` format.
1137+
*/
1138+
startColor: string;
1139+
/**
1140+
* The color at the gradient's ending point. Use a hexadecimal color code in the
1141+
* `#RRGGBB` or `#RRGGBBAA` format.
1142+
*/
1143+
endColor: string;
1144+
/**
1145+
* The color in the middle of the gradient. Use a hexadecimal color code in the `#RRGGBB`
1146+
* or `#RRGGBBAA` format. Specify a value for the `background.centerColor` property to
1147+
* create a gradient that has three colors. For more information, see [Intermediate color stops for linear gradients](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#linear-gradient-bg-center-color) in the
1148+
* Messaging API documentation.
1149+
*/
1150+
centerColor?: string;
1151+
/**
1152+
* The position of the intermediate color stop. Specify an integer or decimal value
1153+
* between `0%` (the starting point) and `100%` (the ending point). This is `50%` by
1154+
* default. For more information, see [Intermediate color stops for linear gradients](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#linear-gradient-bg-center-color) in the
1155+
* Messaging API documentation.
1156+
*/
1157+
centerPosition?: string;
1158+
};
1159+
10981160
/**
10991161
* This component draws a button.
11001162
*
@@ -1163,6 +1225,18 @@ export type FlexButton = {
11631225
* property will be ignored.
11641226
*/
11651227
gravity?: "top" | "bottom" | "center";
1228+
/**
1229+
* The method by which to adjust the text font size. Specify this value:
1230+
*
1231+
* - `shrink-to-fit`: Automatically shrink the font
1232+
* size to fit the width of the component. This
1233+
* property takes a "best-effort" approach that may
1234+
* work differently—or not at all!—on some platforms.
1235+
* For more information, see [Automatically shrink fonts to fit](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#adjusts-fontsize-to-fit)
1236+
* in the Messaging API documentation.
1237+
* - LINE 10.13.0 or later for iOS and Android
1238+
*/
1239+
adjustMode?: "shrink-to-fit";
11661240
} & Offset;
11671241

11681242
/**
@@ -1209,8 +1283,10 @@ export type FlexIcon = {
12091283
* Maximum size of the icon width.
12101284
* The size increases in the order of listing.
12111285
* The default value is `md`.
1286+
* For more information, see [Icon, text, and span size](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#other-component-size) in the Messaging API documentation.
12121287
*/
12131288
size?:
1289+
| string
12141290
| "xxs"
12151291
| "xs"
12161292
| "sm"
@@ -1292,8 +1368,10 @@ export type FlexImage = {
12921368
* Maximum size of the image width.
12931369
* The size increases in the order of listing.
12941370
* The default value is `md`.
1371+
* For more information, see [Image size](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#image-size) in the Messaging API documentation.
12951372
*/
12961373
size?:
1374+
| string
12971375
| "xxs"
12981376
| "xs"
12991377
| "sm"
@@ -1361,6 +1439,7 @@ export type FlexSeparator = {
13611439
/**
13621440
* This is an invisible component that places a fixed-size space at the
13631441
* beginning or end of the box.
1442+
* @deprecated
13641443
*/
13651444
export type FlexSpacer = {
13661445
type: "spacer";
@@ -1379,6 +1458,18 @@ export type FlexText = {
13791458
* Array of spans. Be sure to set either one of the `text` property or `contents` property. If you set the `contents` property, `text` is ignored.
13801459
*/
13811460
contents?: FlexSpan[];
1461+
/**
1462+
* The method by which to adjust the text font size. Specify this value:
1463+
*
1464+
* - `shrink-to-fit`: Automatically shrink the font
1465+
* size to fit the width of the component. This
1466+
* property takes a "best-effort" approach that may
1467+
* work differently—or not at all!—on some platforms.
1468+
* For more information, see [Automatically shrink fonts to fit](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#adjusts-fontsize-to-fit)
1469+
* in the Messaging API documentation.
1470+
* - LINE 10.13.0 or later for iOS and Android
1471+
*/
1472+
adjustMode?: "shrink-to-fit";
13821473
/**
13831474
* The ratio of the width or height of this box within the parent box.
13841475
*
@@ -1405,8 +1496,10 @@ export type FlexText = {
14051496
* Font size.
14061497
* The size increases in the order of listing.
14071498
* The default value is `md`.
1499+
* For more information, see [Icon, text, and span size](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#other-component-size) in the Messaging API documentation.
14081500
*/
14091501
size?:
1502+
| string
14101503
| "xxs"
14111504
| "xs"
14121505
| "sm"
@@ -1504,8 +1597,20 @@ export type FlexSpan = {
15041597
color?: string;
15051598
/**
15061599
* Font size. You can specify one of the following values: `xxs`, `xs`, `sm`, `md`, `lg`, `xl`, `xxl`, `3xl`, `4xl`, or `5xl`. The size increases in the order of listing. The default value is `md`.
1600+
* For more information, see [Icon, text, and span size](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#other-component-size) in the Messaging API documentation.
15071601
*/
1508-
size?: string;
1602+
size?:
1603+
| string
1604+
| "xxs"
1605+
| "xs"
1606+
| "sm"
1607+
| "md"
1608+
| "lg"
1609+
| "xl"
1610+
| "xxl"
1611+
| "3xl"
1612+
| "4xl"
1613+
| "5xl";
15091614
/**
15101615
* Font weight. You can specify one of the following values: `regular` or `bold`. Specifying `bold` makes the font bold. The default value is `regular`.
15111616
*/

0 commit comments

Comments
 (0)