@satorijs/adapter-lark 3.11.6 → 3.11.8

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/content.d.ts CHANGED
@@ -124,11 +124,11 @@ export declare namespace MessageContent {
124
124
  interface Config {
125
125
  streaming_mode?: boolean;
126
126
  streaming_config?: StreamingConfig;
127
- summary: {
127
+ summary?: {
128
128
  content: string;
129
129
  i18n_content?: Record<string, string>;
130
130
  };
131
- locales: string[];
131
+ locales?: string[];
132
132
  enable_forward?: boolean;
133
133
  update_multi?: boolean;
134
134
  width_mode?: 'compact' | 'fill';
@@ -542,7 +542,7 @@ export declare namespace MessageContent {
542
542
  confirm?: ConfirmElement;
543
543
  behaviors?: ActionBehavior[];
544
544
  hover_tips?: TextElement;
545
- disable_tips?: TextElement;
545
+ disabled_tips?: TextElement;
546
546
  }
547
547
  namespace CheckerElement {
548
548
  interface Text extends Card.TextElement<'plain_text' | 'lark_md'> {
package/lib/index.cjs CHANGED
@@ -986,7 +986,10 @@ var LarkMessageEncoder = class extends import_core3.MessageEncoder {
986
986
  } else if (type === "hr") {
987
987
  this.flushText();
988
988
  this.richContent.push([{ tag: "hr" }]);
989
- this.elements.push({ tag: "hr" });
989
+ this.elements.push({
990
+ tag: "hr",
991
+ margin: attrs.margin
992
+ });
990
993
  } else if (type === "form") {
991
994
  this.flushText();
992
995
  const parent = this.elements;
@@ -1009,7 +1012,17 @@ var LarkMessageEncoder = class extends import_core3.MessageEncoder {
1009
1012
  text: {
1010
1013
  tag: "lark_md",
1011
1014
  content: this.textContent
1012
- }
1015
+ },
1016
+ hover_tips: attrs.hoverTips && {
1017
+ tag: "plain_text",
1018
+ content: attrs.hoverTips
1019
+ },
1020
+ disabled_tips: attrs.disabledTips && {
1021
+ tag: "plain_text",
1022
+ content: attrs.disabledTips
1023
+ },
1024
+ behaviors: this.createBehaviors(attrs),
1025
+ margin: attrs.margin
1013
1026
  });
1014
1027
  this.textContent = "";
1015
1028
  } else if (attrs.type === "submit") {
@@ -1024,7 +1037,8 @@ var LarkMessageEncoder = class extends import_core3.MessageEncoder {
1024
1037
  content: this.textContent
1025
1038
  },
1026
1039
  form_action_type: "submit",
1027
- behaviors: this.createBehaviors(attrs)
1040
+ behaviors: this.createBehaviors(attrs),
1041
+ margin: attrs.margin
1028
1042
  });
1029
1043
  this.textContent = "";
1030
1044
  } else {
@@ -1041,10 +1055,15 @@ var LarkMessageEncoder = class extends import_core3.MessageEncoder {
1041
1055
  tag: "plain_text",
1042
1056
  content: attrs.placeholder
1043
1057
  },
1058
+ disabled_tips: attrs.disabledTips && {
1059
+ tag: "plain_text",
1060
+ content: attrs.disabledTips
1061
+ },
1044
1062
  default_value: attrs.value,
1045
1063
  disabled: attrs.disabled,
1046
1064
  required: attrs.required,
1047
- behaviors: this.createBehaviors(attrs)
1065
+ behaviors: this.createBehaviors(attrs),
1066
+ margin: attrs.margin
1048
1067
  };
1049
1068
  this.elements.push(input);
1050
1069
  }
@@ -1062,7 +1081,8 @@ var LarkMessageEncoder = class extends import_core3.MessageEncoder {
1062
1081
  content: attrs.placeholder
1063
1082
  },
1064
1083
  options: [],
1065
- behaviors: this.createBehaviors(attrs)
1084
+ behaviors: this.createBehaviors(attrs),
1085
+ margin: attrs.margin
1066
1086
  };
1067
1087
  for (const child of children) {
1068
1088
  if (child.type !== "option") continue;
@@ -1095,15 +1115,16 @@ var LarkMessageEncoder = class extends import_core3.MessageEncoder {
1095
1115
  token: attrs["lark:icon"],
1096
1116
  color: attrs["lark:icon-color"]
1097
1117
  },
1098
- hover_tips: attrs["lark:hover-tips"] && {
1118
+ hover_tips: attrs.hoverTips && {
1099
1119
  tag: "plain_text",
1100
- content: attrs["lark:hover-tips"]
1120
+ content: attrs.hoverTips
1101
1121
  },
1102
- disabled_tips: attrs["lark:disabled-tips"] && {
1122
+ disabled_tips: attrs.disabledTips && {
1103
1123
  tag: "plain_text",
1104
- content: attrs["lark:disabled-tips"]
1124
+ content: attrs.disabledTips
1105
1125
  },
1106
- behaviors: this.createBehaviors(attrs)
1126
+ behaviors: this.createBehaviors(attrs),
1127
+ margin: attrs.margin
1107
1128
  });
1108
1129
  this.textContent = "";
1109
1130
  } else if (type === "div") {
@@ -1154,6 +1175,15 @@ var LarkMessageEncoder = class extends import_core3.MessageEncoder {
1154
1175
  await this.flush();
1155
1176
  this.card = {
1156
1177
  schema: "2.0",
1178
+ config: {
1179
+ summary: attrs.summary && {
1180
+ content: attrs.summary
1181
+ },
1182
+ enable_forward: attrs.enableForward,
1183
+ update_multi: attrs.updateMulti,
1184
+ enable_forward_interaction: attrs.enableForwardInteraction,
1185
+ style: typeof attrs.style === "string" ? JSON.parse(attrs.style) : attrs.style
1186
+ },
1157
1187
  header: attrs.title && {
1158
1188
  template: attrs.color,
1159
1189
  icon: attrs.icon && {
@@ -1171,6 +1201,12 @@ var LarkMessageEncoder = class extends import_core3.MessageEncoder {
1171
1201
  }
1172
1202
  },
1173
1203
  body: {
1204
+ direction: attrs.direction,
1205
+ padding: attrs.padding,
1206
+ horizontal_spacing: attrs.horizontalSpacing,
1207
+ horizontal_align: attrs.horizontalAlign,
1208
+ vertical_spacing: attrs.verticalSpacing,
1209
+ vertical_align: attrs.verticalAlign,
1174
1210
  elements: this.elements = []
1175
1211
  }
1176
1212
  };
@@ -1195,6 +1231,14 @@ var LarkMessageEncoder = class extends import_core3.MessageEncoder {
1195
1231
  border_color: attrs.borderColor,
1196
1232
  corner_radius: attrs.cornerRadius,
1197
1233
  elements: this.elements = [],
1234
+ hover_tips: attrs.hoverTips && {
1235
+ tag: "plain_text",
1236
+ content: attrs.hoverTips
1237
+ },
1238
+ disabled_tips: attrs.disabledTips && {
1239
+ tag: "plain_text",
1240
+ content: attrs.disabledTips
1241
+ },
1198
1242
  behaviors: this.createBehaviors(attrs)
1199
1243
  });
1200
1244
  await this.render(children);
@@ -1224,6 +1268,7 @@ var LarkMessageEncoder = class extends import_core3.MessageEncoder {
1224
1268
  tag: "column",
1225
1269
  width: child.attrs.width,
1226
1270
  weight: child.attrs.weight,
1271
+ margin: child.attrs.margin,
1227
1272
  padding: child.attrs.padding,
1228
1273
  vertical_align: child.attrs.verticalAlign ?? "center",
1229
1274
  vertical_spacing: child.attrs.verticalSpacing ?? "0px",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@satorijs/adapter-lark",
3
3
  "description": "Lark (飞书) Adapter for Satorijs",
4
- "version": "3.11.6",
4
+ "version": "3.11.8",
5
5
  "type": "module",
6
6
  "main": "lib/index.cjs",
7
7
  "types": "lib/index.d.ts",
package/src/content.ts CHANGED
@@ -164,11 +164,11 @@ export namespace MessageContent {
164
164
  export interface Config {
165
165
  streaming_mode?: boolean
166
166
  streaming_config?: StreamingConfig
167
- summary: {
167
+ summary?: {
168
168
  content: string
169
169
  i18n_content?: Record<string, string>
170
170
  }
171
- locales: string[]
171
+ locales?: string[]
172
172
  enable_forward?: boolean
173
173
  update_multi?: boolean
174
174
  width_mode?: 'compact' | 'fill'
@@ -633,7 +633,7 @@ export namespace MessageContent {
633
633
  confirm?: ConfirmElement
634
634
  behaviors?: ActionBehavior[]
635
635
  hover_tips?: TextElement
636
- disable_tips?: TextElement
636
+ disabled_tips?: TextElement
637
637
  }
638
638
 
639
639
  export namespace CheckerElement {
package/src/message.ts CHANGED
@@ -250,7 +250,10 @@ export class LarkMessageEncoder<C extends Context = Context> extends MessageEnco
250
250
  } else if (type === 'hr') {
251
251
  this.flushText()
252
252
  this.richContent.push([{ tag: 'hr' }])
253
- this.elements.push({ tag: 'hr' })
253
+ this.elements.push({
254
+ tag: 'hr',
255
+ margin: attrs.margin,
256
+ })
254
257
  } else if (type === 'form') {
255
258
  this.flushText()
256
259
  const parent = this.elements
@@ -274,6 +277,16 @@ export class LarkMessageEncoder<C extends Context = Context> extends MessageEnco
274
277
  tag: 'lark_md',
275
278
  content: this.textContent,
276
279
  },
280
+ hover_tips: attrs.hoverTips && {
281
+ tag: 'plain_text',
282
+ content: attrs.hoverTips,
283
+ },
284
+ disabled_tips: attrs.disabledTips && {
285
+ tag: 'plain_text',
286
+ content: attrs.disabledTips,
287
+ },
288
+ behaviors: this.createBehaviors(attrs),
289
+ margin: attrs.margin,
277
290
  })
278
291
  this.textContent = ''
279
292
  } else if (attrs.type === 'submit') {
@@ -289,6 +302,7 @@ export class LarkMessageEncoder<C extends Context = Context> extends MessageEnco
289
302
  },
290
303
  form_action_type: 'submit',
291
304
  behaviors: this.createBehaviors(attrs),
305
+ margin: attrs.margin,
292
306
  })
293
307
  this.textContent = ''
294
308
  } else {
@@ -305,10 +319,15 @@ export class LarkMessageEncoder<C extends Context = Context> extends MessageEnco
305
319
  tag: 'plain_text',
306
320
  content: attrs.placeholder,
307
321
  },
322
+ disabled_tips: attrs.disabledTips && {
323
+ tag: 'plain_text',
324
+ content: attrs.disabledTips,
325
+ },
308
326
  default_value: attrs.value,
309
327
  disabled: attrs.disabled,
310
328
  required: attrs.required,
311
329
  behaviors: this.createBehaviors(attrs),
330
+ margin: attrs.margin,
312
331
  }
313
332
  this.elements.push(input)
314
333
  }
@@ -327,6 +346,7 @@ export class LarkMessageEncoder<C extends Context = Context> extends MessageEnco
327
346
  },
328
347
  options: [],
329
348
  behaviors: this.createBehaviors(attrs),
349
+ margin: attrs.margin,
330
350
  }
331
351
  for (const child of children) {
332
352
  if (child.type !== 'option') continue
@@ -359,15 +379,16 @@ export class LarkMessageEncoder<C extends Context = Context> extends MessageEnco
359
379
  token: attrs['lark:icon'],
360
380
  color: attrs['lark:icon-color'],
361
381
  },
362
- hover_tips: attrs['lark:hover-tips'] && {
382
+ hover_tips: attrs.hoverTips && {
363
383
  tag: 'plain_text',
364
- content: attrs['lark:hover-tips'],
384
+ content: attrs.hoverTips,
365
385
  },
366
- disabled_tips: attrs['lark:disabled-tips'] && {
386
+ disabled_tips: attrs.disabledTips && {
367
387
  tag: 'plain_text',
368
- content: attrs['lark:disabled-tips'],
388
+ content: attrs.disabledTips,
369
389
  },
370
390
  behaviors: this.createBehaviors(attrs),
391
+ margin: attrs.margin,
371
392
  })
372
393
  this.textContent = ''
373
394
  } else if (type === 'div') {
@@ -418,6 +439,15 @@ export class LarkMessageEncoder<C extends Context = Context> extends MessageEnco
418
439
  await this.flush()
419
440
  this.card = {
420
441
  schema: '2.0',
442
+ config: {
443
+ summary: attrs.summary && {
444
+ content: attrs.summary,
445
+ },
446
+ enable_forward: attrs.enableForward,
447
+ update_multi: attrs.updateMulti,
448
+ enable_forward_interaction: attrs.enableForwardInteraction,
449
+ style: typeof attrs.style === 'string' ? JSON.parse(attrs.style) : attrs.style,
450
+ },
421
451
  header: attrs.title && {
422
452
  template: attrs.color,
423
453
  icon: attrs.icon && {
@@ -435,6 +465,12 @@ export class LarkMessageEncoder<C extends Context = Context> extends MessageEnco
435
465
  },
436
466
  },
437
467
  body: {
468
+ direction: attrs.direction,
469
+ padding: attrs.padding,
470
+ horizontal_spacing: attrs.horizontalSpacing,
471
+ horizontal_align: attrs.horizontalAlign,
472
+ vertical_spacing: attrs.verticalSpacing,
473
+ vertical_align: attrs.verticalAlign,
438
474
  elements: this.elements = [],
439
475
  },
440
476
  }
@@ -459,6 +495,14 @@ export class LarkMessageEncoder<C extends Context = Context> extends MessageEnco
459
495
  border_color: attrs.borderColor,
460
496
  corner_radius: attrs.cornerRadius,
461
497
  elements: this.elements = [],
498
+ hover_tips: attrs.hoverTips && {
499
+ tag: 'plain_text',
500
+ content: attrs.hoverTips,
501
+ },
502
+ disabled_tips: attrs.disabledTips && {
503
+ tag: 'plain_text',
504
+ content: attrs.disabledTips,
505
+ },
462
506
  behaviors: this.createBehaviors(attrs),
463
507
  })
464
508
  await this.render(children)
@@ -489,6 +533,7 @@ export class LarkMessageEncoder<C extends Context = Context> extends MessageEnco
489
533
  tag: 'column',
490
534
  width: child.attrs.width,
491
535
  weight: child.attrs.weight,
536
+ margin: child.attrs.margin,
492
537
  padding: child.attrs.padding,
493
538
  vertical_align: child.attrs.verticalAlign ?? 'center',
494
539
  vertical_spacing: child.attrs.verticalSpacing ?? '0px',