alemonjs 2.1.26 → 2.1.27
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/README.md +3 -3
- package/lib/app/index.js +1 -1
- package/lib/app/message-format.d.ts +5 -2
- package/lib/app/message-format.js +17 -2
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/app/index.js
CHANGED
|
@@ -18,5 +18,5 @@ export { createSelects, onSelects, unChildren, useChannel, useClient, useMe, use
|
|
|
18
18
|
export { onState, unState, useState } from './hook-use-state.js';
|
|
19
19
|
export { useObserver, useSubscribe } from './hook-use-subscribe.js';
|
|
20
20
|
export { createDataFormat, createEventValue, format, getMessageIntent, sendToChannel, sendToUser } from './message-api.js';
|
|
21
|
-
export { Format, createEvent } from './message-format.js';
|
|
21
|
+
export { Format, FormatButtonGroup, FormatMarkDown, createEvent } from './message-format.js';
|
|
22
22
|
export { Ark, Attachment, Audio, BT, Custom, Image, ImageFile, ImageURL, Link, MD, Markdown, Mention, Text, Video } from './message-format-old.js';
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { DataButtonGroup, DataMarkDown, DataEnums, EventKeys, Events } from '../types';
|
|
2
2
|
import { Text, Link, Image, ImageFile, ImageURL, Mention, BT, MD, Markdown, Attachment, Audio, Video, Custom } from './message-format-old.js';
|
|
3
3
|
export * from './message-format-old.js';
|
|
4
|
-
declare class FormatButtonGroup {
|
|
4
|
+
export declare class FormatButtonGroup {
|
|
5
5
|
#private;
|
|
6
6
|
get value(): DataButtonGroup;
|
|
7
|
+
absorb(group: FormatButtonGroup): this;
|
|
7
8
|
addRow(): this;
|
|
8
9
|
addButton(...args: Parameters<typeof BT>): this;
|
|
9
10
|
clear(): this;
|
|
10
11
|
}
|
|
11
|
-
declare class FormatMarkDown {
|
|
12
|
+
export declare class FormatMarkDown {
|
|
12
13
|
#private;
|
|
13
14
|
get value(): DataMarkDown;
|
|
15
|
+
absorb(md: FormatMarkDown): this;
|
|
14
16
|
addContent(...args: Parameters<typeof MD.content>): this;
|
|
15
17
|
addText(...args: Parameters<typeof MD.text>): this;
|
|
16
18
|
addTitle(...args: Parameters<typeof MD.title>): this;
|
|
@@ -37,6 +39,7 @@ export declare class Format {
|
|
|
37
39
|
static createMarkdown(): FormatMarkDown;
|
|
38
40
|
static createButtonGroup(): FormatButtonGroup;
|
|
39
41
|
get value(): DataEnums[];
|
|
42
|
+
absorb(format: Format): this;
|
|
40
43
|
addText(...args: Parameters<typeof Text>): this;
|
|
41
44
|
addImage(...args: Parameters<typeof Image>): this;
|
|
42
45
|
addMention(...args: Parameters<typeof Mention>): this;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BT, MD, Text, Image, Mention, Markdown, Attachment, Audio, Video, Custom, Link, ImageFile, ImageURL } from './message-format-old.js';
|
|
2
2
|
export { Ark } from './message-format-old.js';
|
|
3
3
|
|
|
4
4
|
class FormatButtonGroup {
|
|
@@ -14,6 +14,13 @@ class FormatButtonGroup {
|
|
|
14
14
|
this.#currentRow = null;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
+
absorb(group) {
|
|
18
|
+
if (this.#currentRow && this.#currentRow.length > 0) {
|
|
19
|
+
this.#flush();
|
|
20
|
+
}
|
|
21
|
+
this.#rows.push(...group.value.value);
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
17
24
|
addRow() {
|
|
18
25
|
this.#flush();
|
|
19
26
|
this.#currentRow = [];
|
|
@@ -37,6 +44,10 @@ class FormatMarkDown {
|
|
|
37
44
|
get value() {
|
|
38
45
|
return MD(...this.#data);
|
|
39
46
|
}
|
|
47
|
+
absorb(md) {
|
|
48
|
+
this.#data.push(...md.value.value);
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
40
51
|
addContent(...args) {
|
|
41
52
|
this.#data.push(MD.content(...args));
|
|
42
53
|
return this;
|
|
@@ -128,6 +139,10 @@ class Format {
|
|
|
128
139
|
get value() {
|
|
129
140
|
return this.#data;
|
|
130
141
|
}
|
|
142
|
+
absorb(format) {
|
|
143
|
+
this.#data.push(...format.value);
|
|
144
|
+
return this;
|
|
145
|
+
}
|
|
131
146
|
addText(...args) {
|
|
132
147
|
this.#data.push(Text(...args));
|
|
133
148
|
return this;
|
|
@@ -220,4 +235,4 @@ function createEvent(options) {
|
|
|
220
235
|
return { ...event, ...o };
|
|
221
236
|
}
|
|
222
237
|
|
|
223
|
-
export { Attachment, Audio, BT, Custom, Format, Image, ImageFile, ImageURL, Link, MD, Markdown, Mention, Text, Video, createEvent };
|
|
238
|
+
export { Attachment, Audio, BT, Custom, Format, FormatButtonGroup, FormatMarkDown, Image, ImageFile, ImageURL, Link, MD, Markdown, Mention, Text, Video, createEvent };
|
package/lib/index.js
CHANGED
|
@@ -25,6 +25,6 @@ export { createSelects, onSelects, unChildren, useChannel, useClient, useMe, use
|
|
|
25
25
|
export { onState, unState, useState } from './app/hook-use-state.js';
|
|
26
26
|
export { useObserver, useSubscribe } from './app/hook-use-subscribe.js';
|
|
27
27
|
export { createDataFormat, createEventValue, format, getMessageIntent, sendToChannel, sendToUser } from './app/message-api.js';
|
|
28
|
-
export { Format, createEvent } from './app/message-format.js';
|
|
28
|
+
export { Format, FormatButtonGroup, FormatMarkDown, createEvent } from './app/message-format.js';
|
|
29
29
|
export { start } from './main.js';
|
|
30
30
|
export { Ark, Attachment, Audio, BT, Custom, Image, ImageFile, ImageURL, Link, MD, Markdown, Mention, Text, Video } from './app/message-format-old.js';
|