discord-tsx-builder 1.0.2
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/LICENSE +21 -0
- package/README.md +295 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx-dev-runtime.d.ts +2 -0
- package/dist/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/jsx-dev-runtime.js +2 -0
- package/dist/jsx-dev-runtime.js.map +1 -0
- package/dist/jsx-runtime.d.ts +17 -0
- package/dist/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime.js +36 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/runtime.d.ts +20 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +563 -0
- package/dist/runtime.js.map +1 -0
- package/dist/scripts/postbuild.d.ts +4 -0
- package/dist/scripts/postbuild.d.ts.map +1 -0
- package/dist/scripts/postbuild.js +766 -0
- package/dist/scripts/postbuild.js.map +1 -0
- package/dist/tags.d.ts +45 -0
- package/dist/tags.d.ts.map +1 -0
- package/dist/tags.js +51 -0
- package/dist/tags.js.map +1 -0
- package/package.json +75 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Toan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
# discord-tsx-builder
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
Represent Discord Embeds and Components using TSX instead of raw JSON or long builder chains.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install discord-tsx-builder
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add discord-tsx-builder
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
yarn add discord-tsx-builder
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Use in another project
|
|
22
|
+
|
|
23
|
+
`discord-tsx-builder` is a normal npm library. In your own project:
|
|
24
|
+
|
|
25
|
+
1. Install `discord-tsx-builder`
|
|
26
|
+
2. Set TS JSX runtime config
|
|
27
|
+
3. Write TSX with `discord-tsx-builder` tags
|
|
28
|
+
4. Recommended: run postbuild transform to bake payload objects into built JS
|
|
29
|
+
|
|
30
|
+
### TS config
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"compilerOptions": {
|
|
35
|
+
"jsx": "react-jsx",
|
|
36
|
+
"jsxImportSource": "discord-tsx-builder",
|
|
37
|
+
"moduleResolution": "nodenext"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`moduleResolution: "nodenext"` (or `node16`/`bundler`) is important so `discord-tsx-builder/jsx-runtime` resolves correctly.
|
|
43
|
+
|
|
44
|
+
## Postbuild mode (Highly Recommended)
|
|
45
|
+
|
|
46
|
+
After `tsc`, run the transformer:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
discord-tsx-builder-postbuild ./dist
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This rewrites compiled `_jsx/_jsxs` trees rooted at `<DiscordEmbed>` / `<DiscordComponent>` into object literals directly in emitted JS.
|
|
53
|
+
|
|
54
|
+
Example:
|
|
55
|
+
|
|
56
|
+
`<Text>hello</Text>` becomes:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
{ type: 10, content: "hello" }
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Suggested scripts in consumer project:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"scripts": {
|
|
67
|
+
"build": "tsc",
|
|
68
|
+
"postbuild": "discord-tsx-builder-postbuild ./dist"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Runtime mode
|
|
74
|
+
|
|
75
|
+
TSX is converted to object payloads when code executes.
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
import { DiscordEmbed, Title, Description } from "discord-tsx-builder";
|
|
79
|
+
|
|
80
|
+
const name = "World";
|
|
81
|
+
const embed = (
|
|
82
|
+
<DiscordEmbed color="#ffffff">
|
|
83
|
+
<Title>Discord Tsx Builder Testing</Title>
|
|
84
|
+
<Description>Hello {name}</Description>
|
|
85
|
+
</DiscordEmbed>
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
// embed is plain JSON-like data at runtime
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Tag reference
|
|
92
|
+
|
|
93
|
+
All tags are exported from `discord-tsx-builder`.
|
|
94
|
+
|
|
95
|
+
### Embed root
|
|
96
|
+
|
|
97
|
+
Use `<DiscordEmbed>` as the root.
|
|
98
|
+
|
|
99
|
+
Props:
|
|
100
|
+
|
|
101
|
+
- `color?: string | number` (`"#ffffff"` or `16777215`)
|
|
102
|
+
|
|
103
|
+
Supported children:
|
|
104
|
+
|
|
105
|
+
- `<Title>`
|
|
106
|
+
- `<Description>`
|
|
107
|
+
- `<Url>`
|
|
108
|
+
- `<Timestamp>`
|
|
109
|
+
- `<Color>`
|
|
110
|
+
- `<Author>`
|
|
111
|
+
- `<Footer>`
|
|
112
|
+
- `<Image>`
|
|
113
|
+
- `<Thumbnail>`
|
|
114
|
+
- `<Fields>`
|
|
115
|
+
- `<Field>`
|
|
116
|
+
|
|
117
|
+
### Embed tags
|
|
118
|
+
|
|
119
|
+
`<Title>`:
|
|
120
|
+
|
|
121
|
+
- Children text -> `title`
|
|
122
|
+
|
|
123
|
+
`<Description>`:
|
|
124
|
+
|
|
125
|
+
- Children text -> `description`
|
|
126
|
+
|
|
127
|
+
`<Url>`:
|
|
128
|
+
|
|
129
|
+
- `url` prop or children text -> `url`
|
|
130
|
+
|
|
131
|
+
`<Timestamp>`:
|
|
132
|
+
|
|
133
|
+
- `value` prop or children text -> `timestamp`
|
|
134
|
+
|
|
135
|
+
`<Color>`:
|
|
136
|
+
|
|
137
|
+
- `value` prop or children text -> `color` (hex strings are converted to int)
|
|
138
|
+
|
|
139
|
+
`<Image>`:
|
|
140
|
+
|
|
141
|
+
- `url` prop or children text -> `image.url`
|
|
142
|
+
|
|
143
|
+
`<Thumbnail>` (inside embed):
|
|
144
|
+
|
|
145
|
+
- `url` or `src` prop or children text -> `thumbnail.url`
|
|
146
|
+
|
|
147
|
+
`<Author>`:
|
|
148
|
+
|
|
149
|
+
- Props: `name`, `iconUrl` (`icon_url` also accepted), `url`
|
|
150
|
+
- Children alternatives: `<AuthorName>`, `<AuthorIconUrl>`, `<AuthorUrl>`
|
|
151
|
+
|
|
152
|
+
`<Footer>`:
|
|
153
|
+
|
|
154
|
+
- Props: `text`, `iconUrl` (`icon_url` also accepted)
|
|
155
|
+
- Children alternatives: `<FooterText>`, `<FooterIconUrl>`
|
|
156
|
+
|
|
157
|
+
`<Fields>`:
|
|
158
|
+
|
|
159
|
+
- Grouping wrapper for `<Field>`
|
|
160
|
+
|
|
161
|
+
`<Field>`:
|
|
162
|
+
|
|
163
|
+
- Props: `name`, `value`, `inline`
|
|
164
|
+
- Or children: `<FieldName>`, `<FieldValue>`
|
|
165
|
+
- Requires both name and value
|
|
166
|
+
|
|
167
|
+
### Components root
|
|
168
|
+
|
|
169
|
+
Use `<DiscordComponent>` as the root. It returns:
|
|
170
|
+
|
|
171
|
+
- `{ components: [...] }` for legacy-only layouts
|
|
172
|
+
- `{ components: [...], flags: 32768 }` when v2 components are used
|
|
173
|
+
|
|
174
|
+
If you are setting components in a response, set the components and the flags separately.
|
|
175
|
+
`interaction.reply({ components: components.components, flags: components.flags })`
|
|
176
|
+
|
|
177
|
+
### Legacy components
|
|
178
|
+
|
|
179
|
+
`<ActionRow>`:
|
|
180
|
+
|
|
181
|
+
- Children: interactive components only (`<Button>` or any select menu)
|
|
182
|
+
- Select rule: a select menu must be the only child in the row
|
|
183
|
+
- Button rule: max 5 buttons in the row
|
|
184
|
+
|
|
185
|
+
`<Button>`:
|
|
186
|
+
|
|
187
|
+
- Props: `customId`, `style`, `label`, `emoji`, `url`, `disabled`, `skuId`
|
|
188
|
+
- If `label` is omitted, children text becomes label
|
|
189
|
+
- `style` accepts number or one of: `primary`, `secondary`, `success`, `danger`, `link`, `premium`
|
|
190
|
+
|
|
191
|
+
`<StringSelectMenu>`:
|
|
192
|
+
|
|
193
|
+
- Props: `customId`, `placeholder`, `minValues`, `maxValues`, `disabled`
|
|
194
|
+
- Options can come from `options` prop array or `<Option>` children
|
|
195
|
+
|
|
196
|
+
`<UserSelectMenu>`, `<RoleSelectMenu>`, `<MentionableSelectMenu>`, `<ChannelSelectMenu>`:
|
|
197
|
+
|
|
198
|
+
- Props: `customId`, `placeholder`, `minValues`, `maxValues`, `disabled`, `defaultValues`
|
|
199
|
+
- `<ChannelSelectMenu>` also supports `channelTypes`
|
|
200
|
+
|
|
201
|
+
`<Option>`:
|
|
202
|
+
|
|
203
|
+
- Props: `label`, `value`, `description`, `emoji`, `default`
|
|
204
|
+
- Used by `<StringSelectMenu>`
|
|
205
|
+
|
|
206
|
+
### V2 components
|
|
207
|
+
|
|
208
|
+
`<Container>`:
|
|
209
|
+
|
|
210
|
+
- Props: `accentColor` (`accent_color` also accepted), `spoiler`
|
|
211
|
+
- Children supported: `<Text>`, `<Section>`, `<MediaGallery>`, `<File>`, `<Separator>`, `<ActionRow>`, `<Button>`, select menus
|
|
212
|
+
- If `<Button>`/select appears directly, it is wrapped into an action row automatically
|
|
213
|
+
|
|
214
|
+
`<Text>`:
|
|
215
|
+
|
|
216
|
+
- Children text -> `{ type: 10, content: ... }`
|
|
217
|
+
|
|
218
|
+
`<Section>`:
|
|
219
|
+
|
|
220
|
+
- Needs at least one text block
|
|
221
|
+
- Text via direct text, `<Text>`, or `<SectionText>`
|
|
222
|
+
- Accessory via `<SectionAccessory>` with one child: `<Button>` or `<Thumbnail>`
|
|
223
|
+
|
|
224
|
+
`<Thumbnail>` (inside section accessory or top-level v2):
|
|
225
|
+
|
|
226
|
+
- Props: `url` or `src`, optional `description`, `spoiler`
|
|
227
|
+
|
|
228
|
+
`<MediaGallery>`:
|
|
229
|
+
|
|
230
|
+
- Props: `items` array (optional)
|
|
231
|
+
- Or `<MediaItem>` children
|
|
232
|
+
|
|
233
|
+
`<MediaItem>`:
|
|
234
|
+
|
|
235
|
+
- Props: `url` or `src`, optional `description`, `spoiler`
|
|
236
|
+
|
|
237
|
+
`<File>`:
|
|
238
|
+
|
|
239
|
+
- Props: `url` or `src`
|
|
240
|
+
|
|
241
|
+
`<Separator>`:
|
|
242
|
+
|
|
243
|
+
- Props: `divider`, `spacing`
|
|
244
|
+
|
|
245
|
+
### Top-level children allowed in `<DiscordComponent>`
|
|
246
|
+
|
|
247
|
+
- Legacy: `<ActionRow>`
|
|
248
|
+
- V2: `<Container>`, `<Section>`, `<Text>`, `<Thumbnail>`, `<MediaGallery>`, `<File>`, `<Separator>`
|
|
249
|
+
- Interactive tags at top-level (`<Button>` or select menus) are auto-wrapped into action rows and treated as v2
|
|
250
|
+
|
|
251
|
+
See full usage in:
|
|
252
|
+
|
|
253
|
+
- [examples/tag-showcase.tsx](./examples/tag-showcase.tsx)
|
|
254
|
+
|
|
255
|
+
## How Babel is handled
|
|
256
|
+
|
|
257
|
+
You do not need Babel config in your app.
|
|
258
|
+
|
|
259
|
+
- Your app still builds with `tsc` (or your normal TS pipeline).
|
|
260
|
+
- `discord-tsx-builder` runtime mode needs no Babel.
|
|
261
|
+
- `discord-tsx-builder-postbuild` internally uses Babel parser/traverse/generator APIs to parse emitted JS and rewrite only the Discord TSX runtime call trees.
|
|
262
|
+
- Those Babel packages are regular runtime dependencies of `discord-tsx-builder`, so running the CLI in another project works after install.
|
|
263
|
+
|
|
264
|
+
So: no `.babelrc`, no Babel plugin setup, no manual AST wiring in your project.
|
|
265
|
+
|
|
266
|
+
## Comparison (raw JSON vs builders vs discord-tsx-builder)
|
|
267
|
+
|
|
268
|
+
See:
|
|
269
|
+
|
|
270
|
+
- [examples/raw-json.ts](./examples/raw-json.ts)
|
|
271
|
+
- [examples/discordjs-builders.md](./examples/discordjs-builders.md)
|
|
272
|
+
- [examples/runtime-vs-postbuild.tsx](./examples/runtime-vs-postbuild.tsx)
|
|
273
|
+
- [examples/README.md](./examples/README.md)
|
|
274
|
+
|
|
275
|
+
## Validation rules
|
|
276
|
+
|
|
277
|
+
- Select menus inside `<ActionRow>` must be the only child in that row.
|
|
278
|
+
- V2 components automatically set message flag `32768` (`IsComponentsV2`).
|
|
279
|
+
|
|
280
|
+
## Local example commands
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
yarn examples:check
|
|
284
|
+
yarn examples:runtime
|
|
285
|
+
yarn examples:postbuild
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Tests
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
yarn test:runtime
|
|
292
|
+
yarn test:build
|
|
293
|
+
yarn test
|
|
294
|
+
```
|
|
295
|
+
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-dev-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.js","sourceRoot":"","sources":["../src/jsx-dev-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DiscordTagComponent } from "./tags.js";
|
|
2
|
+
export declare const Fragment: unique symbol;
|
|
3
|
+
type JsxType = DiscordTagComponent<unknown> | ((props: Record<string, unknown>) => unknown) | typeof Fragment;
|
|
4
|
+
export declare function jsx(type: JsxType, props: Record<string, unknown> | null, key?: unknown): unknown;
|
|
5
|
+
export declare function jsxs(type: JsxType, props: Record<string, unknown> | null, key?: unknown): unknown;
|
|
6
|
+
export declare function jsxDEV(type: JsxType, props: Record<string, unknown> | null, key: unknown, _isStaticChildren: boolean, _source: unknown, _self: unknown): unknown;
|
|
7
|
+
export declare namespace JSX {
|
|
8
|
+
type Element = unknown;
|
|
9
|
+
interface ElementChildrenAttribute {
|
|
10
|
+
children: unknown;
|
|
11
|
+
}
|
|
12
|
+
interface IntrinsicElements {
|
|
13
|
+
[elemName: string]: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=jsx-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAErD,eAAO,MAAM,QAAQ,eAA6C,CAAC;AAEnE,KAAK,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,GAAG,OAAO,QAAQ,CAAC;AAoC9G,wBAAgB,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO,CAEhG;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO,CAEjG;AAED,wBAAgB,MAAM,CACpB,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACrC,GAAG,EAAE,OAAO,EACZ,iBAAiB,EAAE,OAAO,EAC1B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,OAAO,GACb,OAAO,CAET;AAED,yBAAiB,GAAG,CAAC;IACnB,KAAY,OAAO,GAAG,OAAO,CAAC;IAC9B,UAAiB,wBAAwB;QACvC,QAAQ,EAAE,OAAO,CAAC;KACnB;IACD,UAAiB,iBAAiB;QAChC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC7C;CACF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { renderRoot } from "./runtime.js";
|
|
2
|
+
export const Fragment = Symbol.for("discord-tsx-builder.fragment");
|
|
3
|
+
function isTagComponent(value) {
|
|
4
|
+
return typeof value === "function" && "$$discordTag" in value;
|
|
5
|
+
}
|
|
6
|
+
function baseCreateElement(type, props, key) {
|
|
7
|
+
const normalizedProps = props ?? {};
|
|
8
|
+
if (key !== undefined) {
|
|
9
|
+
normalizedProps.key = key;
|
|
10
|
+
}
|
|
11
|
+
if (type === Fragment) {
|
|
12
|
+
return normalizedProps.children ?? null;
|
|
13
|
+
}
|
|
14
|
+
if (isTagComponent(type)) {
|
|
15
|
+
const element = {
|
|
16
|
+
__discordTsxElement: true,
|
|
17
|
+
tag: type.$$discordTag,
|
|
18
|
+
props: normalizedProps
|
|
19
|
+
};
|
|
20
|
+
return renderRoot(element);
|
|
21
|
+
}
|
|
22
|
+
if (typeof type === "function") {
|
|
23
|
+
return type(normalizedProps);
|
|
24
|
+
}
|
|
25
|
+
throw new Error("Invalid JSX tag passed to discord-tsx-builder runtime.");
|
|
26
|
+
}
|
|
27
|
+
export function jsx(type, props, key) {
|
|
28
|
+
return baseCreateElement(type, props, key);
|
|
29
|
+
}
|
|
30
|
+
export function jsxs(type, props, key) {
|
|
31
|
+
return baseCreateElement(type, props, key);
|
|
32
|
+
}
|
|
33
|
+
export function jsxDEV(type, props, key, _isStaticChildren, _source, _self) {
|
|
34
|
+
return baseCreateElement(type, props, key);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=jsx-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.js","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA0B,MAAM,cAAc,CAAC;AAGlE,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;AAInE,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO,OAAO,KAAK,KAAK,UAAU,IAAI,cAAc,IAAI,KAAK,CAAC;AAChE,CAAC;AAED,SAAS,iBAAiB,CACxB,IAAa,EACb,KAAqC,EACrC,GAAa;IAEb,MAAM,eAAe,GAAG,KAAK,IAAI,EAAE,CAAC;IACpC,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,eAAe,CAAC,GAAG,GAAG,GAAG,CAAC;IAC5B,CAAC;IAED,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtB,OAAO,eAAe,CAAC,QAAQ,IAAI,IAAI,CAAC;IAC1C,CAAC;IAED,IAAI,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,OAAO,GAAsB;YACjC,mBAAmB,EAAE,IAAI;YACzB,GAAG,EAAE,IAAI,CAAC,YAAY;YACtB,KAAK,EAAE,eAAe;SACvB,CAAC;QACF,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAED,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,IAAa,EAAE,KAAqC,EAAE,GAAa;IACrF,OAAO,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,IAAa,EAAE,KAAqC,EAAE,GAAa;IACtF,OAAO,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,MAAM,CACpB,IAAa,EACb,KAAqC,EACrC,GAAY,EACZ,iBAA0B,EAC1B,OAAgB,EAChB,KAAc;IAEd,OAAO,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TagName } from "./tags.js";
|
|
2
|
+
export interface DiscordTsxElement {
|
|
3
|
+
__discordTsxElement: true;
|
|
4
|
+
tag: TagName | (string & {});
|
|
5
|
+
props: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
export type DiscordTsxNode = DiscordTsxElement | string | number | boolean | null | undefined | DiscordTsxNode[];
|
|
8
|
+
export interface DiscordComponentsPayload {
|
|
9
|
+
components: Record<string, unknown>[];
|
|
10
|
+
flags?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare const MessageFlags: {
|
|
13
|
+
readonly IsComponentsV2: number;
|
|
14
|
+
};
|
|
15
|
+
export declare function isDiscordTsxElement(value: unknown): value is DiscordTsxElement;
|
|
16
|
+
export declare function normalizeChildren(input: unknown): DiscordTsxNode[];
|
|
17
|
+
export declare function renderDiscordEmbed(node: DiscordTsxNode): Record<string, unknown>;
|
|
18
|
+
export declare function renderDiscordComponents(node: DiscordTsxNode): DiscordComponentsPayload;
|
|
19
|
+
export declare function renderRoot(node: DiscordTsxNode): unknown;
|
|
20
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,WAAW,iBAAiB;IAChC,mBAAmB,EAAE,IAAI,CAAC;IAC1B,GAAG,EAAE,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,MAAM,cAAc,GACtB,iBAAiB,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,cAAc,EAAE,CAAC;AAErB,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,YAAY;;CAEf,CAAC;AAsCX,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAO9E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,EAAE,CAUlE;AAijBD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAGhF;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,cAAc,GAAG,wBAAwB,CAGtF;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAcxD"}
|