kozz-module-maker 0.2.4 → 0.2.5
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.
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @param commandName
|
|
4
4
|
* @param data
|
|
5
5
|
*/
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const inlineCommand: (commandName: string, data?: Record<string, any>) => string;
|
|
7
7
|
/**
|
|
8
8
|
* Tags someone in the message. The tag will be visible for everyone
|
|
9
9
|
* @param id
|
|
@@ -15,4 +15,40 @@ export declare const tagMember: (id: string) => string;
|
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
17
|
export declare const invisibleTagMember: (id: string) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Invisibly tag everyone
|
|
20
|
+
* @param except
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
18
23
|
export declare const tagEveryone: (except?: string[]) => string;
|
|
24
|
+
/**
|
|
25
|
+
* Formats text as bold.
|
|
26
|
+
* @param text The text to be formatted as bold
|
|
27
|
+
*/
|
|
28
|
+
export declare const bold: (text: string) => string;
|
|
29
|
+
/**
|
|
30
|
+
* Formats text as inline code.
|
|
31
|
+
* @param text The text to be formatted as code
|
|
32
|
+
*/
|
|
33
|
+
export declare const code: (text: string) => string;
|
|
34
|
+
/**
|
|
35
|
+
* Formats text as monospace.
|
|
36
|
+
* @param text The text to be formatted as monospace
|
|
37
|
+
*/
|
|
38
|
+
export declare const monospace: (text: string) => string;
|
|
39
|
+
/**
|
|
40
|
+
* Formats text with stroke effect.
|
|
41
|
+
* @param text The text to be formatted with stroke
|
|
42
|
+
*/
|
|
43
|
+
export declare const stroke: (text: string) => string;
|
|
44
|
+
/**
|
|
45
|
+
* Formats text as italic.
|
|
46
|
+
* @param text The text to be formatted as italic
|
|
47
|
+
*/
|
|
48
|
+
export declare const italic: (text: string) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a list item.
|
|
51
|
+
* @param text The content of the list item
|
|
52
|
+
*/
|
|
53
|
+
export declare const listItem: (text: string) => string;
|
|
54
|
+
export declare const paragraph: (text: string) => string;
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.tagMember = exports.tagEveryone = exports.invisibleTagMember = exports.
|
|
6
|
+
exports.tagMember = exports.tagEveryone = exports.stroke = exports.paragraph = exports.monospace = exports.listItem = exports.italic = exports.invisibleTagMember = exports.inlineCommand = exports.code = exports.bold = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* Creates an inline command with unespecified name and payload data.
|
|
9
9
|
* @param commandName
|
|
10
10
|
* @param data
|
|
11
11
|
*/
|
|
12
|
-
const
|
|
12
|
+
const inlineCommand = (commandName, data = {}) => {
|
|
13
13
|
return `%${commandName}:${JSON.stringify(data)}`;
|
|
14
14
|
};
|
|
15
15
|
|
|
@@ -17,8 +17,8 @@ const generalCommand = (commandName, data = {}) => {
|
|
|
17
17
|
* Tags someone in the message. The tag will be visible for everyone
|
|
18
18
|
* @param id
|
|
19
19
|
*/
|
|
20
|
-
exports.
|
|
21
|
-
const tagMember = id =>
|
|
20
|
+
exports.inlineCommand = inlineCommand;
|
|
21
|
+
const tagMember = id => inlineCommand('mention', {
|
|
22
22
|
id
|
|
23
23
|
});
|
|
24
24
|
|
|
@@ -28,11 +28,75 @@ const tagMember = id => generalCommand('mention', {
|
|
|
28
28
|
* @returns
|
|
29
29
|
*/
|
|
30
30
|
exports.tagMember = tagMember;
|
|
31
|
-
const invisibleTagMember = id =>
|
|
31
|
+
const invisibleTagMember = id => inlineCommand('invisiblemention', {
|
|
32
32
|
id
|
|
33
33
|
});
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Invisibly tag everyone
|
|
37
|
+
* @param except
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
34
40
|
exports.invisibleTagMember = invisibleTagMember;
|
|
35
|
-
const tagEveryone = (except = []) =>
|
|
41
|
+
const tagEveryone = (except = []) => inlineCommand('tageveryone', {
|
|
36
42
|
except
|
|
37
43
|
});
|
|
38
|
-
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Formats text as bold.
|
|
47
|
+
* @param text The text to be formatted as bold
|
|
48
|
+
*/
|
|
49
|
+
exports.tagEveryone = tagEveryone;
|
|
50
|
+
const bold = text => inlineCommand('bold', {
|
|
51
|
+
text
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Formats text as inline code.
|
|
56
|
+
* @param text The text to be formatted as code
|
|
57
|
+
*/
|
|
58
|
+
exports.bold = bold;
|
|
59
|
+
const code = text => inlineCommand('code', {
|
|
60
|
+
text
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Formats text as monospace.
|
|
65
|
+
* @param text The text to be formatted as monospace
|
|
66
|
+
*/
|
|
67
|
+
exports.code = code;
|
|
68
|
+
const monospace = text => inlineCommand('monospace', {
|
|
69
|
+
text
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Formats text with stroke effect.
|
|
74
|
+
* @param text The text to be formatted with stroke
|
|
75
|
+
*/
|
|
76
|
+
exports.monospace = monospace;
|
|
77
|
+
const stroke = text => inlineCommand('stroke', {
|
|
78
|
+
text
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Formats text as italic.
|
|
83
|
+
* @param text The text to be formatted as italic
|
|
84
|
+
*/
|
|
85
|
+
exports.stroke = stroke;
|
|
86
|
+
const italic = text => inlineCommand('italic', {
|
|
87
|
+
text
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Creates a list item.
|
|
92
|
+
* @param text The content of the list item
|
|
93
|
+
*/
|
|
94
|
+
exports.italic = italic;
|
|
95
|
+
const listItem = text => inlineCommand('listItem', {
|
|
96
|
+
text
|
|
97
|
+
});
|
|
98
|
+
exports.listItem = listItem;
|
|
99
|
+
const paragraph = text => inlineCommand('paragraph', {
|
|
100
|
+
text
|
|
101
|
+
});
|
|
102
|
+
exports.paragraph = paragraph;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { type Component } from '.';
|
|
2
|
+
export declare const createTemplatingComponent: (command: (text: string) => string) => Component<{}>;
|
|
2
3
|
export declare const Bold: Component<{}>;
|
|
3
4
|
export declare const Code: Component<{}>;
|
|
4
|
-
export declare const Line: Component<{}>;
|
|
5
5
|
export declare const Monospace: Component<{}>;
|
|
6
6
|
export declare const Stroke: Component<{}>;
|
|
7
7
|
export declare const Italic: Component<{}>;
|
|
8
|
+
export declare const ListItem: Component<{}>;
|
|
9
|
+
export declare const Paragraph: Component<{}>;
|
|
10
|
+
export declare const Line: Component<{}>;
|
|
8
11
|
export declare const List: ({ items }: {
|
|
9
12
|
items: string | string[];
|
|
10
13
|
}) => string;
|
|
@@ -3,18 +3,27 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.Stroke = exports.Render = exports.Monospace = exports.List = exports.Line = exports.Italic = exports.ForEach = exports.Code = exports.Bold = void 0;
|
|
7
|
-
|
|
6
|
+
exports.createTemplatingComponent = exports.Stroke = exports.Render = exports.Paragraph = exports.Monospace = exports.ListItem = exports.List = exports.Line = exports.Italic = exports.ForEach = exports.Code = exports.Bold = void 0;
|
|
7
|
+
var _InlineCommands = require("src/InlineCommands");
|
|
8
|
+
const createTemplatingComponent = command => ({
|
|
8
9
|
children
|
|
9
10
|
}) => {
|
|
10
|
-
return typeof children === 'string' ? `${
|
|
11
|
+
return typeof children === 'string' ? `${command(children)}` : Array.isArray(children) ? `${command(children.join(''))}` : children?.toString();
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const Monospace = exports.Monospace = createTemplatingComponent(
|
|
16
|
-
const Stroke = exports.Stroke = createTemplatingComponent(
|
|
17
|
-
const Italic = exports.Italic = createTemplatingComponent(
|
|
13
|
+
exports.createTemplatingComponent = createTemplatingComponent;
|
|
14
|
+
const Bold = exports.Bold = createTemplatingComponent(_InlineCommands.bold);
|
|
15
|
+
const Code = exports.Code = createTemplatingComponent(_InlineCommands.code);
|
|
16
|
+
const Monospace = exports.Monospace = createTemplatingComponent(_InlineCommands.monospace);
|
|
17
|
+
const Stroke = exports.Stroke = createTemplatingComponent(_InlineCommands.stroke);
|
|
18
|
+
const Italic = exports.Italic = createTemplatingComponent(_InlineCommands.italic);
|
|
19
|
+
const ListItem = exports.ListItem = createTemplatingComponent(_InlineCommands.listItem);
|
|
20
|
+
const Paragraph = exports.Paragraph = createTemplatingComponent(_InlineCommands.paragraph);
|
|
21
|
+
const Line = ({
|
|
22
|
+
children
|
|
23
|
+
}) => {
|
|
24
|
+
return typeof children === 'string' ? children : Array.isArray(children) ? `${children.join('')}` : children?.toString();
|
|
25
|
+
};
|
|
26
|
+
exports.Line = Line;
|
|
18
27
|
const List = ({
|
|
19
28
|
items
|
|
20
29
|
}) => {
|