@discord/intl 0.13.0-canary.45435b1 → 0.13.1
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/dist/formatters/ast.d.ts +2 -12
- package/dist/formatters/ast.js +1 -11
- package/package.json +2 -2
- package/src/formatters/ast.ts +2 -12
package/dist/formatters/ast.d.ts
CHANGED
|
@@ -12,17 +12,7 @@ export declare enum RichTextNodeType {
|
|
|
12
12
|
Strikethrough = "s",
|
|
13
13
|
Code = "inlineCode",
|
|
14
14
|
Link = "link",
|
|
15
|
-
Paragraph = "paragraph"
|
|
16
|
-
/**
|
|
17
|
-
* A special extension for when the value of a placeholder is an object.
|
|
18
|
-
* Rather than casting to a string here, the object is preserved as-is for a
|
|
19
|
-
* future formatter to render as appropriate (i.e., using an object as a
|
|
20
|
-
* value when formatting to an AST should keep that object structure so that
|
|
21
|
-
* the final AST is accurate for what the user expects, but when rendering to
|
|
22
|
-
* a plain string, the final formatter can just cast that object to a string
|
|
23
|
-
* using its `toString` method or some other mechanism).
|
|
24
|
-
*/
|
|
25
|
-
Object = "object"
|
|
15
|
+
Paragraph = "paragraph"
|
|
26
16
|
}
|
|
27
17
|
interface RichTextNodeBase<ContentType> {
|
|
28
18
|
type: RichTextNodeType;
|
|
@@ -48,7 +38,7 @@ interface RichTextParagraphNode extends RichTextNodeBase<RichTextNode[]> {
|
|
|
48
38
|
}
|
|
49
39
|
interface RichTextLinkNode extends RichTextNodeBase<RichTextNode[]> {
|
|
50
40
|
type: RichTextNodeType.Link;
|
|
51
|
-
target:
|
|
41
|
+
target: object;
|
|
52
42
|
}
|
|
53
43
|
export type RichTextNode = RichTextTextNode | RichTextStrongNode | RichTextEmphasisNode | RichTextStrikethroughNode | RichTextCodeNode | RichTextParagraphNode | RichTextLinkNode;
|
|
54
44
|
/**
|
package/dist/formatters/ast.js
CHANGED
|
@@ -15,16 +15,6 @@ var RichTextNodeType;
|
|
|
15
15
|
RichTextNodeType["Code"] = "inlineCode";
|
|
16
16
|
RichTextNodeType["Link"] = "link";
|
|
17
17
|
RichTextNodeType["Paragraph"] = "paragraph";
|
|
18
|
-
/**
|
|
19
|
-
* A special extension for when the value of a placeholder is an object.
|
|
20
|
-
* Rather than casting to a string here, the object is preserved as-is for a
|
|
21
|
-
* future formatter to render as appropriate (i.e., using an object as a
|
|
22
|
-
* value when formatting to an AST should keep that object structure so that
|
|
23
|
-
* the final AST is accurate for what the user expects, but when rendering to
|
|
24
|
-
* a plain string, the final formatter can just cast that object to a string
|
|
25
|
-
* using its `toString` method or some other mechanism).
|
|
26
|
-
*/
|
|
27
|
-
RichTextNodeType["Object"] = "object";
|
|
28
18
|
})(RichTextNodeType || (exports.RichTextNodeType = RichTextNodeType = {}));
|
|
29
19
|
const AST_RICH_TEXT_ELEMENTS = {
|
|
30
20
|
$b: (content) => ({ type: RichTextNodeType.Strong, content }),
|
|
@@ -33,7 +23,7 @@ const AST_RICH_TEXT_ELEMENTS = {
|
|
|
33
23
|
$code: (content) => ({ type: RichTextNodeType.Code, content }),
|
|
34
24
|
$link: (content, _, [target]) => ({
|
|
35
25
|
type: RichTextNodeType.Link,
|
|
36
|
-
target
|
|
26
|
+
target,
|
|
37
27
|
content,
|
|
38
28
|
}),
|
|
39
29
|
$p: (content) => ({ type: RichTextNodeType.Paragraph, content }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@discord/intl",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Client runtime for managing messages and translations in a React project.",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@formatjs/intl": "^2.10.1",
|
|
24
24
|
"@intrnl/xxhash64": "^0.1.2",
|
|
25
25
|
"intl-messageformat": "^10.5.11",
|
|
26
|
-
"@discord/intl-ast": "0.13.
|
|
26
|
+
"@discord/intl-ast": "0.13.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@swc/cli": "^0.3.12",
|
package/src/formatters/ast.ts
CHANGED
|
@@ -25,16 +25,6 @@ export enum RichTextNodeType {
|
|
|
25
25
|
Code = 'inlineCode',
|
|
26
26
|
Link = 'link',
|
|
27
27
|
Paragraph = 'paragraph',
|
|
28
|
-
/**
|
|
29
|
-
* A special extension for when the value of a placeholder is an object.
|
|
30
|
-
* Rather than casting to a string here, the object is preserved as-is for a
|
|
31
|
-
* future formatter to render as appropriate (i.e., using an object as a
|
|
32
|
-
* value when formatting to an AST should keep that object structure so that
|
|
33
|
-
* the final AST is accurate for what the user expects, but when rendering to
|
|
34
|
-
* a plain string, the final formatter can just cast that object to a string
|
|
35
|
-
* using its `toString` method or some other mechanism).
|
|
36
|
-
*/
|
|
37
|
-
Object = 'object',
|
|
38
28
|
}
|
|
39
29
|
|
|
40
30
|
interface RichTextNodeBase<ContentType> {
|
|
@@ -61,7 +51,7 @@ interface RichTextParagraphNode extends RichTextNodeBase<RichTextNode[]> {
|
|
|
61
51
|
}
|
|
62
52
|
interface RichTextLinkNode extends RichTextNodeBase<RichTextNode[]> {
|
|
63
53
|
type: RichTextNodeType.Link;
|
|
64
|
-
target:
|
|
54
|
+
target: object;
|
|
65
55
|
}
|
|
66
56
|
|
|
67
57
|
export type RichTextNode =
|
|
@@ -80,7 +70,7 @@ const AST_RICH_TEXT_ELEMENTS: RichTextFormattingMap<AstFunctionTypes['hook']> =
|
|
|
80
70
|
$code: (content) => ({ type: RichTextNodeType.Code, content }),
|
|
81
71
|
$link: (content, _, [target]) => ({
|
|
82
72
|
type: RichTextNodeType.Link,
|
|
83
|
-
target
|
|
73
|
+
target,
|
|
84
74
|
content,
|
|
85
75
|
}),
|
|
86
76
|
$p: (content) => ({ type: RichTextNodeType.Paragraph, content }),
|