31
31
32
32
/**
33
33
* @template {Jsx} [JsxFunction=Jsx]
34
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
34
35
* @typedef {ReturnType<JsxFunction> | string | null | undefined } Child
35
36
* Child.
36
37
*/
37
38
38
39
/**
39
40
* @template {Jsx} [JsxFunction=Jsx]
41
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
40
42
* @callback Create
41
43
* Create something in development or production.
42
44
* @param {Nodes } node
53
55
54
56
/**
55
57
* @template {Jsx} [JsxFunction=Jsx]
58
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
56
59
* @callback CreateEvaluater
57
60
* Create an evaluator that turns ESTree ASTs from embedded MDX into values.
58
61
* @returns {Evaluater<JsxFunction> }
69
72
70
73
/**
71
74
* @template {Jsx} [JsxFunction=Jsx]
75
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
72
76
* @callback EvaluateExpression
73
77
* Turn an MDX expression into a value.
74
78
* @param {Expression } expression
90
94
91
95
/**
92
96
* @template {Jsx} [JsxFunction=Jsx]
97
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
93
98
* @typedef Evaluater
94
99
* Evaluator that turns ESTree ASTs from embedded MDX into values.
95
100
* @property {EvaluateExpression<JsxFunction> } evaluateExpression
105
110
106
111
/**
107
112
* @template [JsxElementType=any]
113
+ * Element type: `Fragment` symbol, tag name (`string`), component.
108
114
* @template [JsxProps=any]
115
+ * Element props, `children`, and maybe `node`.
109
116
* @template [JsxKey=any]
117
+ * Dynamicly generated key to use.
110
118
* @template [JsxElement=any]
119
+ * Analogous to `JSX.Element`.
111
120
* @callback Jsx
121
+ * Create a production element.
112
122
* @param {JsxElementType } type
123
+ * Element type: `Fragment` symbol, tag name (`string`), component.
113
124
* @param {JsxProps } props
125
+ * Element props, `children`, and maybe `node`.
114
126
* @param {JsxKey } [key]
127
+ * Dynamicly generated key to use.
115
128
* @returns {JsxElement }
129
+ * Element from your framework.
116
130
*/
117
131
118
132
/**
119
133
* @template {Jsx} [JsxFunction=Jsx]
134
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
120
135
* @typedef {Parameters<JsxFunction>[0] } GetType
121
136
*/
122
137
123
138
/**
124
139
* @template {Jsx} [JsxFunction=Jsx]
140
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
125
141
* @typedef {Parameters<JsxFunction>[1] } GetProps
126
142
*/
127
143
128
144
/**
129
145
* @template {Jsx} [JsxFunction=Jsx]
146
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
130
147
* @typedef {Parameters<JsxFunction>[2] } GetKey
131
148
*/
132
149
133
150
/**
134
151
* @template {Jsx} [JsxFunction=Jsx]
152
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
135
153
* @callback JsxDev
136
154
* Create a development element.
137
155
* @param {GetType<JsxFunction> } type
153
171
154
172
/**
155
173
* @template {Jsx} [JsxFunction=Jsx]
174
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
156
175
* @typedef {{
157
176
* children?: Array<Child<JsxFunction>> | Child<JsxFunction>, node?: Element | MdxJsxFlowElement | MdxJsxTextElement | undefined,
158
177
* [prop: string]: Array<Child<JsxFunction>> | Child<JsxFunction> | Element | MdxJsxFlowElement | MdxJsxTextElement | Value | undefined
162
181
163
182
/**
164
183
* @template {Jsx} [JsxFunction=Jsx]
184
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
165
185
* @typedef RegularFields
166
186
* Configuration.
167
187
* @property {Record<string, GetType<JsxFunction>> } [components]
200
220
201
221
/**
202
222
* @template {Jsx} [JsxFunction=Jsx]
223
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
203
224
* @typedef RuntimeDevelopment
204
225
* Runtime fields when development is on.
205
226
* @property {GetType<JsxFunction> } Fragment
216
237
217
238
/**
218
239
* @template {Jsx} [JsxFunction=Jsx]
240
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
219
241
* @typedef RuntimeProduction
220
242
* Runtime fields when development is off.
221
243
* @property {GetType<JsxFunction> } Fragment
231
253
232
254
/**
233
255
* @template {Jsx} [JsxFunction=Jsx]
256
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
234
257
* @typedef RuntimeUnknown
235
258
* Runtime fields when development might be on or off.
236
259
* @property {GetType<JsxFunction> } Fragment
269
292
270
293
/**
271
294
* @template {Jsx} [JsxFunction=Jsx]
295
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
272
296
* @typedef State
273
297
* Info passed around.
274
298
* @property {GetType<JsxFunction> } Fragment
319
343
320
344
/**
321
345
* @template {Jsx} [JsxFunction=Jsx]
346
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
322
347
* @typedef {RuntimeDevelopment<JsxFunction> & RegularFields<JsxFunction> } Development
323
348
* Configuration (development).
324
349
*/
325
350
326
351
/**
327
352
* @template {Jsx} [JsxFunction=Jsx]
353
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
328
354
* @typedef {Development<JsxFunction> | Production<JsxFunction> } Options
329
355
* Configuration.
330
356
*/
331
357
332
358
/**
333
359
* @template {Jsx} [JsxFunction=Jsx]
360
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
334
361
* @typedef {RegularFields<JsxFunction> & RuntimeProduction<JsxFunction> } Production
335
362
* Configuration (production).
336
363
*/
337
364
338
365
/**
339
366
* @template {Jsx} [JsxFunction=Jsx]
367
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
340
368
* @typedef {RegularFields<JsxFunction> & RuntimeUnknown<JsxFunction> } Unknown
341
369
* Configuration (production or development).
342
370
*/
@@ -381,6 +409,7 @@ const docs = 'https://github.com/syntax-tree/hast-util-to-jsx-runtime'
381
409
* with an automatic JSX runtime.
382
410
*
383
411
* @template {Jsx} [JsxFunction=Jsx]
412
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
384
413
* @param {Nodes } tree
385
414
* Tree to transform.
386
415
* @param {Options<JsxFunction> } options
@@ -455,6 +484,7 @@ export function toJsxRuntime(tree, options) {
455
484
* Transform a node.
456
485
*
457
486
* @template {Jsx} [JsxFunction=Jsx]
487
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
458
488
* @param {State<JsxFunction> } state
459
489
* Info passed around.
460
490
* @param {Nodes } node
@@ -494,6 +524,7 @@ function one(state, node, key) {
494
524
* Handle element.
495
525
*
496
526
* @template {Jsx} [JsxFunction=Jsx]
527
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
497
528
* @param {State<JsxFunction> } state
498
529
* Info passed around.
499
530
* @param {Element } node
@@ -538,6 +569,7 @@ function element(state, node, key) {
538
569
* Handle MDX expression.
539
570
*
540
571
* @template {Jsx} [JsxFunction=Jsx]
572
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
541
573
* @param {State<JsxFunction> } state
542
574
* Info passed around.
543
575
* @param {MdxFlowExpression | MdxTextExpression } node
@@ -564,6 +596,7 @@ function mdxExpression(state, node) {
564
596
* Handle MDX ESM.
565
597
*
566
598
* @template {Jsx} [JsxFunction=Jsx]
599
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
567
600
* @param {State<JsxFunction> } state
568
601
* Info passed around.
569
602
* @param {MdxjsEsm } node
@@ -587,6 +620,7 @@ function mdxEsm(state, node) {
587
620
*
588
621
*
589
622
* @template {Jsx} [JsxFunction=Jsx]
623
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
590
624
* @param {State<JsxFunction> } state
591
625
* Info passed around.
592
626
* @param {MdxJsxFlowElement | MdxJsxTextElement } node
@@ -628,6 +662,7 @@ function mdxJsxElement(state, node, key) {
628
662
* Handle root.
629
663
*
630
664
* @template {Jsx} [JsxFunction=Jsx]
665
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
631
666
* @param {State<JsxFunction> } state
632
667
* Info passed around.
633
668
* @param {Root } node
@@ -650,6 +685,7 @@ function root(state, node, key) {
650
685
* Handle text.
651
686
*
652
687
* @template {Jsx} [JsxFunction=Jsx]
688
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
653
689
* @param {State<JsxFunction> } _
654
690
* Info passed around.
655
691
* @param {Text } node
@@ -665,6 +701,7 @@ function text(_, node) {
665
701
* Add `node` to props.
666
702
*
667
703
* @template {Jsx} [JsxFunction=Jsx]
704
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
668
705
* @param {State<JsxFunction> } state
669
706
* Info passed around.
670
707
* @param {Props<JsxFunction> } props
@@ -687,6 +724,7 @@ function addNode(state, props, type, node) {
687
724
* Add children to props.
688
725
*
689
726
* @template {Jsx} [JsxFunction=Jsx]
727
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
690
728
* @param {Props<JsxFunction> } props
691
729
* Props.
692
730
* @param {Array<Child<JsxFunction>> } children
@@ -706,6 +744,7 @@ function addChildren(props, children) {
706
744
707
745
/**
708
746
* @template {Jsx} [JsxFunction=Jsx]
747
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
709
748
* @param {string | undefined } _
710
749
* Path to file.
711
750
* @param {JsxFunction } jsx
@@ -728,6 +767,7 @@ function productionCreate(_, jsx, jsxs) {
728
767
729
768
/**
730
769
* @template {Jsx} [JsxFunction=Jsx]
770
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
731
771
* @param {string | undefined } filePath
732
772
* Path to file.
733
773
* @param {JsxDev<JsxFunction> } jsxDEV
@@ -761,6 +801,7 @@ function developmentCreate(filePath, jsxDEV) {
761
801
* Create props from an element.
762
802
*
763
803
* @template {Jsx} [JsxFunction=Jsx]
804
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
764
805
* @param {State<JsxFunction> } state
765
806
* Info passed around.
766
807
* @param {Element } node
@@ -811,6 +852,7 @@ function createElementProps(state, node) {
811
852
* Create props from a JSX element.
812
853
*
813
854
* @template {Jsx} [JsxFunction=Jsx]
855
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
814
856
* @param {State<JsxFunction> } state
815
857
* Info passed around.
816
858
* @param {MdxJsxFlowElement | MdxJsxTextElement } node
@@ -876,6 +918,7 @@ function createJsxElementProps(state, node) {
876
918
* Create children.
877
919
*
878
920
* @template {Jsx} [JsxFunction=Jsx]
921
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
879
922
* @param {State<JsxFunction> } state
880
923
* Info passed around.
881
924
* @param {Parents } node
@@ -924,6 +967,7 @@ function createChildren(state, node) {
924
967
* Handle a property.
925
968
*
926
969
* @template {Jsx} [JsxFunction=Jsx]
970
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
927
971
* @param {State<JsxFunction> } state
928
972
* Info passed around.
929
973
* @param {string } prop
@@ -975,6 +1019,7 @@ function createProperty(state, prop, value) {
975
1019
* Parse a CSS declaration to an object.
976
1020
*
977
1021
* @template {Jsx} [JsxFunction=Jsx]
1022
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
978
1023
* @param {State<JsxFunction> } state
979
1024
* Info passed around.
980
1025
* @param {string } value
@@ -1035,6 +1080,7 @@ function parseStyle(state, value) {
1035
1080
* Create a JSX name from a string.
1036
1081
*
1037
1082
* @template {Jsx} [JsxFunction=Jsx]
1083
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
1038
1084
* @param {State<JsxFunction> } state
1039
1085
* To do.
1040
1086
* @param {string } name
@@ -1101,6 +1147,7 @@ function findComponentFromName(state, name, allowExpression) {
1101
1147
1102
1148
/**
1103
1149
* @template {Jsx} [JsxFunction=Jsx]
1150
+ * The type of the `jsx` function impoted from `${jsxImportSource}/jsx-runtime`.
1104
1151
* @param {State<JsxFunction> } state
1105
1152
* @param {Position | undefined } [place]
1106
1153
* @returns {never }
0 commit comments