@xyd-js/atlas 0.0.0-build-8b31648-20250923204702 → 0.0.0-build-9f87f13-20250930210637
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/CHANGELOG.md +6 -6
- package/dist/{VideoGuide-B5GYVCMy-BWu_u92C.js → VideoGuide-mnR1NnMY-BWu_u92C.js} +1 -1
- package/dist/{VideoGuide-B5GYVCMy-BWu_u92C.js.map → VideoGuide-mnR1NnMY-BWu_u92C.js.map} +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/xydPlugin.js +1 -1
- package/package.json +7 -6
- package/src/components/ApiRef/ApiRefProperties/ApiRefProperties.tsx +563 -581
- package/src/components/ApiRef/ApiRefSamples/ApiRefSamples.tsx +112 -56
- package/src/components/Atlas/Atlas.tsx +38 -24
- package/src/components/Atlas/AtlasContext.tsx +3 -1
- package/src/components/Code/CodeSampleButtons/CodeSampleButtons.tsx +3 -2
- package/types.d.ts +4 -0
|
@@ -1,693 +1,675 @@
|
|
|
1
|
-
import React, {useContext, useState} from "react";
|
|
2
|
-
import {
|
|
1
|
+
import React, { useContext, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
DEFINED_DEFINITION_PROPERTY_TYPE,
|
|
4
|
+
DefinitionProperty,
|
|
5
|
+
DefinitionPropertyMeta,
|
|
6
|
+
} from "@xyd-js/uniform";
|
|
3
7
|
|
|
4
8
|
import * as cn from "./ApiRefProperties.styles";
|
|
5
|
-
import {AtlasContext, useBaseMatch} from "@/components/Atlas/AtlasContext";
|
|
6
|
-
import {Badge} from "@xyd-js/components/writer";
|
|
9
|
+
import { AtlasContext, useBaseMatch } from "@/components/Atlas/AtlasContext";
|
|
10
|
+
import { Badge } from "@xyd-js/components/writer";
|
|
7
11
|
|
|
8
12
|
export interface ApiRefPropertiesProps {
|
|
9
|
-
|
|
13
|
+
properties: DefinitionProperty[];
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
// TODO: in the future configurable
|
|
13
|
-
const HIDE_INTERNAL = true
|
|
14
|
-
|
|
15
|
-
export function ApiRefProperties({properties}: ApiRefPropertiesProps) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<SubProperties
|
|
55
|
-
parent={property}
|
|
56
|
-
properties={propertyProperties}
|
|
57
|
-
/> : null
|
|
58
|
-
}
|
|
59
|
-
</li>
|
|
60
|
-
})
|
|
61
|
-
}
|
|
17
|
+
const HIDE_INTERNAL = true;
|
|
18
|
+
|
|
19
|
+
export function ApiRefProperties({ properties }: ApiRefPropertiesProps) {
|
|
20
|
+
return (
|
|
21
|
+
<ul className={cn.ApiRefPropertiesUlHost}>
|
|
22
|
+
{filterProperties(properties)?.map((property, i) => {
|
|
23
|
+
const propName = property.name;
|
|
24
|
+
const propValue = property.type;
|
|
25
|
+
const propertyProperties = propProperties(property);
|
|
26
|
+
const description =
|
|
27
|
+
property.ofProperty?.description || property.description || "";
|
|
28
|
+
const metaInfo = renderMetaInfo(property.meta);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<atlas-apiref-prop className={cn.ApiRefPropertiesLiHost} key={i}>
|
|
32
|
+
{propName || propValue ? (
|
|
33
|
+
<dl className={cn.ApiRefPropertiesDlHost}>
|
|
34
|
+
<PropName property={property} meta={property.meta || []} />
|
|
35
|
+
<PropType property={property} />
|
|
36
|
+
<PropMetaList metas={property.meta || []} />
|
|
37
|
+
</dl>
|
|
38
|
+
) : null}
|
|
39
|
+
|
|
40
|
+
{description || metaInfo ? (
|
|
41
|
+
<atlas-apiref-propdescription className={cn.ApiRefPropertiesDescriptionHost}>
|
|
42
|
+
<>
|
|
43
|
+
<div>{description}</div>
|
|
44
|
+
<div>{renderMetaInfo(property.meta)}</div>
|
|
45
|
+
</>
|
|
46
|
+
</atlas-apiref-propdescription>
|
|
47
|
+
) : null}
|
|
48
|
+
|
|
49
|
+
{propertyProperties?.length > 0 ? (
|
|
50
|
+
<SubProperties
|
|
51
|
+
parent={property}
|
|
52
|
+
properties={propertyProperties}
|
|
53
|
+
/>
|
|
54
|
+
) : null}
|
|
55
|
+
</atlas-apiref-prop>
|
|
56
|
+
);
|
|
57
|
+
})}
|
|
62
58
|
</ul>
|
|
59
|
+
);
|
|
63
60
|
}
|
|
64
61
|
|
|
65
|
-
|
|
66
62
|
interface PropNameProps {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
property: DefinitionProperty;
|
|
64
|
+
meta: DefinitionPropertyMeta[];
|
|
65
|
+
parentChoiceType?: boolean;
|
|
70
66
|
}
|
|
71
67
|
|
|
72
68
|
function PropName(props: PropNameProps) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
69
|
+
const value = props.property.name;
|
|
70
|
+
|
|
71
|
+
if (!value) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<atlas-apiref-propname>
|
|
77
|
+
<dd>
|
|
78
|
+
<code
|
|
79
|
+
data-parent-choice-type={props.parentChoiceType ? "true" : undefined}
|
|
80
|
+
className={cn.ApiRefPropertiesPropNameCodeHost}
|
|
81
|
+
>
|
|
82
|
+
{value}
|
|
83
|
+
</code>
|
|
84
|
+
</dd>
|
|
86
85
|
</atlas-apiref-propname>
|
|
86
|
+
);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
interface PropTypeProps {
|
|
90
|
-
|
|
90
|
+
property: DefinitionProperty;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
function PropType({property}: PropTypeProps) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
93
|
+
function PropType({ property }: PropTypeProps) {
|
|
94
|
+
const { Link = "a" } = useContext(AtlasContext);
|
|
95
|
+
const href = useSymbolLink(property);
|
|
96
|
+
|
|
97
|
+
const symbol = resolvePropertySymbol(property);
|
|
98
|
+
|
|
99
|
+
let propSymbol: string | React.ReactNode = symbol;
|
|
100
|
+
|
|
101
|
+
if (!propSymbol) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (href) {
|
|
106
|
+
propSymbol = (
|
|
107
|
+
<Link className={cn.ApiRefPropertiesPropTypeCodeLink} href={href}>
|
|
108
|
+
{propSymbol}
|
|
109
|
+
</Link>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<atlas-apiref-proptype>
|
|
115
|
+
<dd>
|
|
116
|
+
<code className={cn.ApiRefPropertiesPropTypeCodeHost}>
|
|
117
|
+
{propSymbol}
|
|
118
|
+
</code>
|
|
119
|
+
</dd>
|
|
115
120
|
</atlas-apiref-proptype>
|
|
121
|
+
);
|
|
116
122
|
}
|
|
117
123
|
|
|
118
124
|
export interface PropMetaProps extends DefinitionPropertyMeta {
|
|
119
|
-
|
|
125
|
+
href?: string;
|
|
120
126
|
}
|
|
121
127
|
|
|
122
128
|
function PropMeta(props: PropMetaProps) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
</code>
|
|
162
|
-
</dd>
|
|
129
|
+
let valueText = props.value;
|
|
130
|
+
|
|
131
|
+
switch (props.name) {
|
|
132
|
+
case "required":
|
|
133
|
+
valueText = "Required";
|
|
134
|
+
break;
|
|
135
|
+
case "deprecated":
|
|
136
|
+
valueText = "Deprecated";
|
|
137
|
+
break;
|
|
138
|
+
case "defaults":
|
|
139
|
+
valueText = `Defaults: ${props.value}`;
|
|
140
|
+
break;
|
|
141
|
+
case "nullable":
|
|
142
|
+
return null;
|
|
143
|
+
case "enum-type":
|
|
144
|
+
return null;
|
|
145
|
+
case "minimum":
|
|
146
|
+
return null;
|
|
147
|
+
case "maximum":
|
|
148
|
+
return null;
|
|
149
|
+
case "example":
|
|
150
|
+
return null;
|
|
151
|
+
case "examples":
|
|
152
|
+
return null;
|
|
153
|
+
case "internal":
|
|
154
|
+
return null;
|
|
155
|
+
case "hasArguments":
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<atlas-apiref-propmeta data-name={props.name} data-value={props.value}>
|
|
161
|
+
<dd>
|
|
162
|
+
<code>
|
|
163
|
+
{props.href ? <a href={props.href}>{valueText}</a> : valueText}
|
|
164
|
+
</code>
|
|
165
|
+
</dd>
|
|
163
166
|
</atlas-apiref-propmeta>
|
|
167
|
+
);
|
|
164
168
|
}
|
|
165
169
|
|
|
166
170
|
export interface PropMetaListProps {
|
|
167
|
-
|
|
171
|
+
metas: PropMetaProps[];
|
|
168
172
|
}
|
|
169
173
|
|
|
170
|
-
function PropMetaList({metas}: PropMetaListProps) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const sortedMetas = [...metas].sort((a, b) => {
|
|
174
|
-
return (order[a.name as keyof typeof order] ?? 3) - (order[b.name as keyof typeof order] ?? 3);
|
|
175
|
-
});
|
|
174
|
+
function PropMetaList({ metas }: PropMetaListProps) {
|
|
175
|
+
const order = { deprecated: 0, required: 1, defaults: 2 };
|
|
176
176
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
177
|
+
const sortedMetas = [...metas].sort((a, b) => {
|
|
178
|
+
return (
|
|
179
|
+
(order[a.name as keyof typeof order] ?? 3) -
|
|
180
|
+
(order[b.name as keyof typeof order] ?? 3)
|
|
181
|
+
);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<>
|
|
186
|
+
{sortedMetas.map((meta, i) => (
|
|
187
|
+
<PropMeta key={i} {...meta} />
|
|
188
|
+
))}
|
|
186
189
|
</>
|
|
190
|
+
);
|
|
187
191
|
}
|
|
188
192
|
|
|
189
193
|
interface SubPropertiesProps {
|
|
190
|
-
|
|
194
|
+
parent: DefinitionProperty;
|
|
191
195
|
|
|
192
|
-
|
|
196
|
+
properties: DefinitionProperty[];
|
|
193
197
|
}
|
|
194
198
|
|
|
195
|
-
function SubProperties({parent, properties}: SubPropertiesProps) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
// Get the actual properties to display
|
|
199
|
-
const foundProperties = filterProperties(properties || [])
|
|
200
|
-
|
|
201
|
-
const choiceType = isChoiceType(parent)
|
|
202
|
-
const noChildProps = function () {
|
|
203
|
-
if (
|
|
204
|
-
(
|
|
205
|
-
parent?.type === DEFINED_DEFINITION_PROPERTY_TYPE.ARRAY &&
|
|
206
|
-
parent?.ofProperty?.type === DEFINED_DEFINITION_PROPERTY_TYPE.ENUM
|
|
207
|
-
) ||
|
|
208
|
-
parent?.type === DEFINED_DEFINITION_PROPERTY_TYPE.ENUM
|
|
209
|
-
) {
|
|
210
|
-
return false
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
return foundProperties.every(prop => {
|
|
214
|
-
if (prop.ofProperty) {
|
|
215
|
-
return false
|
|
216
|
-
}
|
|
199
|
+
function SubProperties({ parent, properties }: SubPropertiesProps) {
|
|
200
|
+
const [expanded, setExpanded] = useState(false);
|
|
217
201
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}()
|
|
202
|
+
// Get the actual properties to display
|
|
203
|
+
const foundProperties = filterProperties(properties || []);
|
|
221
204
|
|
|
222
|
-
|
|
223
|
-
|
|
205
|
+
const choiceType = isChoiceType(parent);
|
|
206
|
+
const noChildProps = (function () {
|
|
207
|
+
if (
|
|
208
|
+
(parent?.type === DEFINED_DEFINITION_PROPERTY_TYPE.ARRAY &&
|
|
209
|
+
parent?.ofProperty?.type === DEFINED_DEFINITION_PROPERTY_TYPE.ENUM) ||
|
|
210
|
+
parent?.type === DEFINED_DEFINITION_PROPERTY_TYPE.ENUM
|
|
211
|
+
) {
|
|
212
|
+
return false;
|
|
224
213
|
}
|
|
225
214
|
|
|
226
|
-
|
|
215
|
+
return foundProperties.every((prop) => {
|
|
216
|
+
if (prop.ofProperty) {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
227
219
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
</
|
|
292
|
-
|
|
220
|
+
return !(prop.properties?.length ?? 0);
|
|
221
|
+
});
|
|
222
|
+
})();
|
|
223
|
+
|
|
224
|
+
if (choiceType && noChildProps) {
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const hasArguments = parent.meta?.some(
|
|
229
|
+
(m) => m.name === "hasArguments" && m.value === "true"
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
return (
|
|
233
|
+
<>
|
|
234
|
+
{foundProperties?.length ? (
|
|
235
|
+
<PropToggle
|
|
236
|
+
choiceType={choiceType}
|
|
237
|
+
isArgument={hasArguments}
|
|
238
|
+
onClick={() => setExpanded(!expanded)}
|
|
239
|
+
isExpanded={expanded}
|
|
240
|
+
/>
|
|
241
|
+
) : null}
|
|
242
|
+
|
|
243
|
+
<div
|
|
244
|
+
className={`${cn.ApiRefPropertiesSubPropsHost} ${expanded && cn.ApiRefPropertiesSubPropsHostExpanded}`}
|
|
245
|
+
>
|
|
246
|
+
<div className={cn.ApiRefPropertiesSubPropsBox}>
|
|
247
|
+
<ul role="list" className={cn.ApiRefPropertiesSubPropsUl}>
|
|
248
|
+
{foundProperties?.map((prop, i) => {
|
|
249
|
+
const propName = prop.name;
|
|
250
|
+
const propValue = prop.type;
|
|
251
|
+
const properties = propProperties(prop);
|
|
252
|
+
const description =
|
|
253
|
+
prop.ofProperty?.description || prop.description || "";
|
|
254
|
+
const metaInfo = renderMetaInfo(prop.meta);
|
|
255
|
+
|
|
256
|
+
return (
|
|
257
|
+
<atlas-apiref-prop className={cn.ApiRefPropertiesSubPropsLi} key={i}>
|
|
258
|
+
{propName || propValue ? (
|
|
259
|
+
<dl className={cn.ApiRefPropertiesDlHost}>
|
|
260
|
+
<PropName
|
|
261
|
+
property={prop}
|
|
262
|
+
meta={prop.meta || []}
|
|
263
|
+
parentChoiceType={choiceType || !!hasArguments}
|
|
264
|
+
/>
|
|
265
|
+
<PropType property={prop} />
|
|
266
|
+
<PropMetaList metas={prop.meta || []} />
|
|
267
|
+
</dl>
|
|
268
|
+
) : null}
|
|
269
|
+
|
|
270
|
+
{description || metaInfo ? (
|
|
271
|
+
<atlas-apiref-propdescription
|
|
272
|
+
className={cn.ApiRefPropertiesDescriptionHost}
|
|
273
|
+
>
|
|
274
|
+
<>
|
|
275
|
+
<div>{description}</div>
|
|
276
|
+
<div>{renderMetaInfo(prop.meta)}</div>
|
|
277
|
+
</>
|
|
278
|
+
</atlas-apiref-propdescription>
|
|
279
|
+
) : null}
|
|
280
|
+
{properties?.length ? (
|
|
281
|
+
<SubProperties parent={prop} properties={properties} />
|
|
282
|
+
) : null}
|
|
283
|
+
</atlas-apiref-prop>
|
|
284
|
+
);
|
|
285
|
+
})}
|
|
286
|
+
</ul>
|
|
293
287
|
</div>
|
|
288
|
+
</div>
|
|
294
289
|
</>
|
|
290
|
+
);
|
|
295
291
|
}
|
|
296
292
|
|
|
297
|
-
|
|
298
293
|
interface PropsToggleProps {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
294
|
+
isExpanded: boolean;
|
|
295
|
+
choiceType: boolean;
|
|
296
|
+
isArgument?: boolean;
|
|
297
|
+
onClick: () => void;
|
|
303
298
|
}
|
|
304
299
|
|
|
305
|
-
function PropToggle(
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
</button>
|
|
344
|
-
)
|
|
300
|
+
function PropToggle(props: PropsToggleProps) {
|
|
301
|
+
let text = props.isExpanded ? "Hide properties" : "Show properties";
|
|
302
|
+
|
|
303
|
+
if (props.choiceType) {
|
|
304
|
+
text = props.isExpanded ? "Hide possible types" : "Show possible types";
|
|
305
|
+
} else if (props.isArgument) {
|
|
306
|
+
text = props.isExpanded
|
|
307
|
+
? "Hide possible arguments"
|
|
308
|
+
: "Show possible arguments";
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
return (
|
|
312
|
+
<button
|
|
313
|
+
aria-expanded={props.isExpanded}
|
|
314
|
+
aria-controls="chat/object-usage_table"
|
|
315
|
+
onClick={props.onClick}
|
|
316
|
+
className={cn.ApiRefPropertiesPropToggleHost}
|
|
317
|
+
>
|
|
318
|
+
<svg
|
|
319
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
320
|
+
width="1em"
|
|
321
|
+
height="1em"
|
|
322
|
+
fill="currentColor"
|
|
323
|
+
viewBox="0 0 24 24"
|
|
324
|
+
>
|
|
325
|
+
<path
|
|
326
|
+
fillRule="evenodd"
|
|
327
|
+
d={
|
|
328
|
+
props.isExpanded
|
|
329
|
+
? "M12 8a1 1 0 0 1 .707.293l7 7a1 1 0 0 1-1.414 1.414L12 10.414l-6.293 6.293a1 1 0 0 1-1.414-1.414l7-7A1 1 0 0 1 12 8Z"
|
|
330
|
+
: "M4.293 8.293a1 1 0 0 1 1.414 0L12 14.586l6.293-6.293a1 1 0 1 1 1.414 1.414l-7 7a1 1 0 0 1-1.414 0l-7-7a1 1 0 0 1 0-1.414Z"
|
|
331
|
+
}
|
|
332
|
+
clipRule="evenodd"
|
|
333
|
+
/>
|
|
334
|
+
</svg>
|
|
335
|
+
<span className={cn.ApiRefPropertiesPropToggleLink}>{text}</span>
|
|
336
|
+
</button>
|
|
337
|
+
);
|
|
345
338
|
}
|
|
346
339
|
|
|
347
340
|
function isChoiceType(property: DefinitionProperty) {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
341
|
+
if (
|
|
342
|
+
property.type === DEFINED_DEFINITION_PROPERTY_TYPE.ARRAY &&
|
|
343
|
+
property.ofProperty?.type === DEFINED_DEFINITION_PROPERTY_TYPE.ENUM
|
|
344
|
+
) {
|
|
345
|
+
return true;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
if (property.ofProperty) {
|
|
349
|
+
return isChoiceType(property.ofProperty);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
return [
|
|
353
|
+
DEFINED_DEFINITION_PROPERTY_TYPE.UNION,
|
|
354
|
+
DEFINED_DEFINITION_PROPERTY_TYPE.XOR,
|
|
355
|
+
DEFINED_DEFINITION_PROPERTY_TYPE.ENUM,
|
|
356
|
+
].includes(property.type as DEFINED_DEFINITION_PROPERTY_TYPE);
|
|
364
357
|
}
|
|
365
358
|
|
|
366
359
|
function useSymbolLink(property: DefinitionProperty) {
|
|
367
|
-
|
|
360
|
+
const baseMatch = useBaseMatch();
|
|
368
361
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
362
|
+
if (!property?.symbolDef?.canonical?.length) {
|
|
363
|
+
return "";
|
|
364
|
+
}
|
|
372
365
|
|
|
373
|
-
|
|
366
|
+
let symbolLink = property.symbolDef.canonical;
|
|
374
367
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
return `${baseMatch}${symbolLink}`;
|
|
381
|
-
} else {
|
|
382
|
-
console.warn("Multiple canonical links found for property", property.name, property.symbolDef.canonical)
|
|
368
|
+
if (!Array.isArray(symbolLink)) {
|
|
369
|
+
// TODO: support array of canonicals
|
|
370
|
+
if (!symbolLink.startsWith("/")) {
|
|
371
|
+
symbolLink = "/" + symbolLink;
|
|
383
372
|
}
|
|
384
373
|
|
|
385
|
-
return
|
|
374
|
+
return `${baseMatch}${symbolLink}`;
|
|
375
|
+
} else {
|
|
376
|
+
console.warn(
|
|
377
|
+
"Multiple canonical links found for property",
|
|
378
|
+
property.name,
|
|
379
|
+
property.symbolDef.canonical
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
return "";
|
|
386
384
|
}
|
|
387
385
|
|
|
388
386
|
function propProperties(prop: DefinitionProperty): DefinitionProperty[] {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
387
|
+
if (prop.properties?.length) {
|
|
388
|
+
return prop.properties;
|
|
389
|
+
}
|
|
392
390
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
391
|
+
if (prop.ofProperty) {
|
|
392
|
+
return propProperties(prop.ofProperty);
|
|
393
|
+
}
|
|
396
394
|
|
|
397
|
-
|
|
395
|
+
return [];
|
|
398
396
|
}
|
|
399
397
|
|
|
400
|
-
function filterProperties(
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
398
|
+
function filterProperties(
|
|
399
|
+
properties: DefinitionProperty[]
|
|
400
|
+
): DefinitionProperty[] {
|
|
401
|
+
return properties.filter((property) => {
|
|
402
|
+
if (
|
|
403
|
+
property?.meta?.some((m) => m.name === "internal" && m.value === "true")
|
|
404
|
+
) {
|
|
405
|
+
if (HIDE_INTERNAL) {
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
407
409
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
+
return true;
|
|
411
|
+
});
|
|
410
412
|
}
|
|
411
413
|
|
|
412
414
|
function resolvePropertySymbol(property: DefinitionProperty): string {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
const atomicDefinedSymbol = atomicDefinedPropertySymbol(property.ofProperty)
|
|
432
|
-
const ofPrefix = [
|
|
433
|
-
atomicDefinedSymbol,
|
|
434
|
-
"of"
|
|
435
|
-
]
|
|
436
|
-
|
|
437
|
-
return [
|
|
438
|
-
[
|
|
439
|
-
...ofPrefix,
|
|
440
|
-
...ofOfSymbols
|
|
441
|
-
].join(" ")
|
|
442
|
-
]
|
|
443
|
-
}
|
|
444
|
-
case DEFINED_DEFINITION_PROPERTY_TYPE.UNION:
|
|
445
|
-
case DEFINED_DEFINITION_PROPERTY_TYPE.ENUM:
|
|
446
|
-
case DEFINED_DEFINITION_PROPERTY_TYPE.XOR: {
|
|
447
|
-
if (property.ofProperty.properties?.length) {
|
|
448
|
-
const atomicDefinedSymbol = atomicDefinedPropertySymbol(property)
|
|
449
|
-
|
|
450
|
-
if (atomicDefinedSymbol) {
|
|
451
|
-
let unionSymbol = ""
|
|
452
|
-
if (
|
|
453
|
-
property.ofProperty.type === DEFINED_DEFINITION_PROPERTY_TYPE.ENUM &&
|
|
454
|
-
property.ofProperty.ofProperty?.type
|
|
455
|
-
) {
|
|
456
|
-
unionSymbol = groupSymbol({
|
|
457
|
-
name: "",
|
|
458
|
-
description: "",
|
|
459
|
-
type: property.ofProperty.ofProperty?.type,
|
|
460
|
-
properties: property.ofProperty.properties || [],
|
|
461
|
-
})
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
if (!unionSymbol) {
|
|
465
|
-
unionSymbol = groupSymbol({
|
|
466
|
-
name: "",
|
|
467
|
-
description: "",
|
|
468
|
-
type: DEFINED_DEFINITION_PROPERTY_TYPE.UNION,
|
|
469
|
-
properties: property.ofProperty.properties || [],
|
|
470
|
-
})
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
if (unionSymbol?.length && unionSymbol.includes("$$")) {
|
|
474
|
-
return [atomicDefinedSymbol]
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
return [
|
|
478
|
-
[
|
|
479
|
-
atomicDefinedSymbol,
|
|
480
|
-
"of",
|
|
481
|
-
unionSymbol
|
|
482
|
-
].join(" ")
|
|
483
|
-
]
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
return [
|
|
487
|
-
property.type,
|
|
488
|
-
groupSymbol(property.ofProperty)
|
|
489
|
-
]
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
if (property.ofProperty?.ofProperty) {
|
|
493
|
-
return [property.ofProperty?.ofProperty?.type]
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
return []
|
|
497
|
-
}
|
|
498
|
-
default: {
|
|
499
|
-
if (!property.ofProperty.name) {
|
|
500
|
-
const defined = atomicDefinedPropertySymbol(property)
|
|
501
|
-
const symbol = atomicPropertySymbol(property)
|
|
502
|
-
|
|
503
|
-
if (symbol.startsWith("$$")) {
|
|
504
|
-
return [property.ofProperty.type]
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
const chains = [
|
|
508
|
-
symbol
|
|
509
|
-
]
|
|
510
|
-
|
|
511
|
-
if (defined) {
|
|
512
|
-
chains.push("of")
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
chains.push(
|
|
516
|
-
groupSymbol(property.ofProperty)
|
|
517
|
-
)
|
|
518
|
-
|
|
519
|
-
return chains
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
return [
|
|
523
|
-
property.ofProperty.type
|
|
524
|
-
]
|
|
525
|
-
}
|
|
415
|
+
function resolvePropertySymbolInner(property: DefinitionProperty) {
|
|
416
|
+
if (property?.ofProperty) {
|
|
417
|
+
switch (property.ofProperty.type) {
|
|
418
|
+
case DEFINED_DEFINITION_PROPERTY_TYPE.ARRAY: {
|
|
419
|
+
let ofOfSymbols: string[] = [];
|
|
420
|
+
|
|
421
|
+
if (property.type) {
|
|
422
|
+
ofOfSymbols.push(property.type);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
if (property.ofProperty.ofProperty) {
|
|
426
|
+
const symbol = groupSymbol(property.ofProperty.ofProperty);
|
|
427
|
+
|
|
428
|
+
if (symbol) {
|
|
429
|
+
ofOfSymbols.push(symbol);
|
|
526
430
|
}
|
|
527
|
-
|
|
431
|
+
}
|
|
528
432
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
433
|
+
const atomicDefinedSymbol = atomicDefinedPropertySymbol(
|
|
434
|
+
property.ofProperty
|
|
435
|
+
);
|
|
436
|
+
const ofPrefix = [atomicDefinedSymbol, "of"];
|
|
437
|
+
|
|
438
|
+
return [[...ofPrefix, ...ofOfSymbols].join(" ")];
|
|
439
|
+
}
|
|
440
|
+
case DEFINED_DEFINITION_PROPERTY_TYPE.UNION:
|
|
441
|
+
case DEFINED_DEFINITION_PROPERTY_TYPE.ENUM:
|
|
442
|
+
case DEFINED_DEFINITION_PROPERTY_TYPE.XOR: {
|
|
443
|
+
if (property.ofProperty.properties?.length) {
|
|
444
|
+
const atomicDefinedSymbol = atomicDefinedPropertySymbol(property);
|
|
445
|
+
|
|
446
|
+
if (atomicDefinedSymbol) {
|
|
447
|
+
let unionSymbol = "";
|
|
448
|
+
if (
|
|
449
|
+
property.ofProperty.type ===
|
|
450
|
+
DEFINED_DEFINITION_PROPERTY_TYPE.ENUM &&
|
|
451
|
+
property.ofProperty.ofProperty?.type
|
|
452
|
+
) {
|
|
453
|
+
unionSymbol = groupSymbol({
|
|
454
|
+
name: "",
|
|
455
|
+
description: "",
|
|
456
|
+
type: property.ofProperty.ofProperty?.type,
|
|
457
|
+
properties: property.ofProperty.properties || [],
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
if (!unionSymbol) {
|
|
462
|
+
unionSymbol = groupSymbol({
|
|
463
|
+
name: "",
|
|
464
|
+
description: "",
|
|
465
|
+
type: DEFINED_DEFINITION_PROPERTY_TYPE.UNION,
|
|
466
|
+
properties: property.ofProperty.properties || [],
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
if (unionSymbol?.length && unionSymbol.includes("$$")) {
|
|
471
|
+
return [atomicDefinedSymbol];
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
return [[atomicDefinedSymbol, "of", unionSymbol].join(" ")];
|
|
564
475
|
}
|
|
565
476
|
|
|
566
|
-
|
|
567
|
-
|
|
477
|
+
return [property.type, groupSymbol(property.ofProperty)];
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
if (property.ofProperty?.ofProperty) {
|
|
481
|
+
return [property.ofProperty?.ofProperty?.type];
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
return [];
|
|
485
|
+
}
|
|
486
|
+
default: {
|
|
487
|
+
if (!property.ofProperty.name) {
|
|
488
|
+
const defined = atomicDefinedPropertySymbol(property);
|
|
489
|
+
const symbol = atomicPropertySymbol(property);
|
|
490
|
+
|
|
491
|
+
if (symbol.startsWith("$$")) {
|
|
492
|
+
return [property.ofProperty.type];
|
|
568
493
|
}
|
|
569
494
|
|
|
570
|
-
|
|
571
|
-
|
|
495
|
+
const chains = [symbol];
|
|
496
|
+
|
|
497
|
+
if (defined) {
|
|
498
|
+
chains.push("of");
|
|
572
499
|
}
|
|
500
|
+
|
|
501
|
+
chains.push(groupSymbol(property.ofProperty));
|
|
502
|
+
|
|
503
|
+
return chains;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
return [property.ofProperty.type];
|
|
573
507
|
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
switch (property.type) {
|
|
512
|
+
case (DEFINED_DEFINITION_PROPERTY_TYPE.UNION,
|
|
513
|
+
DEFINED_DEFINITION_PROPERTY_TYPE.XOR): {
|
|
514
|
+
if (property.properties?.length) {
|
|
515
|
+
const respMap = {};
|
|
516
|
+
let resp: string[] = [];
|
|
517
|
+
for (const prop of property.properties) {
|
|
518
|
+
let symbols = resolvePropertySymbolInner(prop);
|
|
519
|
+
|
|
520
|
+
if (prop.ofProperty && symbols.length > 1) {
|
|
521
|
+
symbols = [
|
|
522
|
+
[symbols[0], ...symbols.slice(1, symbols.length)].join(""),
|
|
523
|
+
];
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
resp.push(...symbols);
|
|
527
|
+
}
|
|
574
528
|
|
|
575
|
-
|
|
576
|
-
|
|
529
|
+
let hasOr = false; // TODO: in the future better
|
|
530
|
+
for (const symbol of resp) {
|
|
531
|
+
if (symbol.trim() === "or") {
|
|
532
|
+
hasOr = true;
|
|
533
|
+
break;
|
|
534
|
+
}
|
|
535
|
+
respMap[symbol] = true;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
if (!hasOr) {
|
|
539
|
+
resp = Object.keys(respMap);
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
return [resp.join(" or ")];
|
|
577
543
|
}
|
|
578
544
|
|
|
579
|
-
|
|
545
|
+
break;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
case DEFINED_DEFINITION_PROPERTY_TYPE.ARRAY: {
|
|
549
|
+
return ["array"];
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
case DEFINED_DEFINITION_PROPERTY_TYPE.ENUM: {
|
|
553
|
+
return ["enum"];
|
|
554
|
+
}
|
|
580
555
|
}
|
|
581
556
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
if (symbolsParts.length) {
|
|
585
|
-
symbolsParts.push("or", "null")
|
|
586
|
-
} else {
|
|
587
|
-
symbolsParts.push("null")
|
|
588
|
-
}
|
|
557
|
+
if (property.type?.startsWith("$$")) {
|
|
558
|
+
return [];
|
|
589
559
|
}
|
|
590
560
|
|
|
591
|
-
return
|
|
561
|
+
return [property.type];
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
const symbolsParts = resolvePropertySymbolInner(property);
|
|
565
|
+
if (nullableProperty(property)) {
|
|
566
|
+
if (symbolsParts.length) {
|
|
567
|
+
symbolsParts.push("or", "null");
|
|
568
|
+
} else {
|
|
569
|
+
symbolsParts.push("null");
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
return symbolsParts.join(" ");
|
|
592
574
|
}
|
|
593
575
|
|
|
594
576
|
function atomicDefinedPropertySymbol(property: DefinitionProperty): string {
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
577
|
+
switch (property.type) {
|
|
578
|
+
case DEFINED_DEFINITION_PROPERTY_TYPE.ARRAY: {
|
|
579
|
+
return "array";
|
|
580
|
+
}
|
|
581
|
+
case DEFINED_DEFINITION_PROPERTY_TYPE.UNION:
|
|
582
|
+
case DEFINED_DEFINITION_PROPERTY_TYPE.ENUM:
|
|
583
|
+
case DEFINED_DEFINITION_PROPERTY_TYPE.XOR: {
|
|
584
|
+
return "";
|
|
585
|
+
}
|
|
604
586
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
}
|
|
587
|
+
default: {
|
|
588
|
+
return "";
|
|
608
589
|
}
|
|
590
|
+
}
|
|
609
591
|
}
|
|
610
592
|
|
|
611
593
|
function groupSymbol(property: DefinitionProperty) {
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
594
|
+
const symbol = resolvePropertySymbol(property);
|
|
595
|
+
if (symbol?.startsWith("$$")) {
|
|
596
|
+
return "";
|
|
597
|
+
}
|
|
616
598
|
|
|
617
|
-
|
|
599
|
+
return symbol;
|
|
618
600
|
}
|
|
619
601
|
|
|
620
602
|
function atomicPropertySymbol(property: DefinitionProperty): string {
|
|
621
|
-
|
|
603
|
+
const defined = atomicDefinedPropertySymbol(property);
|
|
622
604
|
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
605
|
+
if (!defined) {
|
|
606
|
+
return property.type;
|
|
607
|
+
}
|
|
626
608
|
|
|
627
|
-
|
|
609
|
+
return defined;
|
|
628
610
|
}
|
|
629
611
|
|
|
630
612
|
function nullableProperty(property: DefinitionProperty): boolean {
|
|
631
|
-
|
|
613
|
+
return (
|
|
614
|
+
property.meta?.some((m) => m.name === "nullable" && m.value === "true") ||
|
|
615
|
+
false
|
|
616
|
+
);
|
|
632
617
|
}
|
|
633
618
|
|
|
634
619
|
function renderMetaInfo(meta: DefinitionPropertyMeta[] | undefined) {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
);
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
const exampleInfo = example || examples ? <div part="examples">
|
|
620
|
+
if (!meta?.length) return null;
|
|
621
|
+
|
|
622
|
+
const minimum = meta.find((m) => m.name === "minimum")?.value;
|
|
623
|
+
const maximum = meta.find((m) => m.name === "maximum")?.value;
|
|
624
|
+
const example = meta.find((m) => m.name === "example")?.value;
|
|
625
|
+
const examples = meta.find((m) => m.name === "examples")?.value;
|
|
626
|
+
|
|
627
|
+
const rangeInfo: React.ReactNode[] = [];
|
|
628
|
+
if (minimum !== undefined && maximum !== undefined) {
|
|
629
|
+
rangeInfo.push(
|
|
630
|
+
<div>
|
|
631
|
+
Required range: <Badge>{`${minimum} <= x <= ${maximum}`}</Badge>
|
|
632
|
+
</div>
|
|
633
|
+
);
|
|
634
|
+
} else if (minimum !== undefined) {
|
|
635
|
+
rangeInfo.push(
|
|
636
|
+
<div>
|
|
637
|
+
Required range: <Badge>{`x >= ${minimum}`}</Badge>
|
|
638
|
+
</div>
|
|
639
|
+
);
|
|
640
|
+
} else if (maximum !== undefined) {
|
|
641
|
+
rangeInfo.push(
|
|
642
|
+
<div>
|
|
643
|
+
Required range: <Badge>{`x <= ${maximum}`}</Badge>
|
|
644
|
+
</div>
|
|
645
|
+
);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
const exampleInfo =
|
|
649
|
+
example || examples ? (
|
|
650
|
+
<div part="examples">
|
|
670
651
|
<span>Examples:</span>
|
|
671
|
-
{
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
652
|
+
{example ? <Badge pre>{`${example}`}</Badge> : null}
|
|
653
|
+
{Array.isArray(examples) && (
|
|
654
|
+
<div part="examples-list">
|
|
655
|
+
{examples.map((example, i) => (
|
|
656
|
+
<Badge key={`example-${i}`} pre>{`${example}`}</Badge>
|
|
657
|
+
))}
|
|
658
|
+
</div>
|
|
659
|
+
)}
|
|
660
|
+
</div>
|
|
661
|
+
) : null;
|
|
662
|
+
|
|
663
|
+
if (!rangeInfo?.length && !exampleInfo) {
|
|
664
|
+
return null;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
return (
|
|
668
|
+
<atlas-apiref-meta-info className={cn.ApiRefPropertiesMetaInfoHost}>
|
|
669
|
+
{rangeInfo?.map((info, i) => (
|
|
670
|
+
<div key={`range-${i}`}>{info}</div>
|
|
671
|
+
))}
|
|
672
|
+
{exampleInfo}
|
|
692
673
|
</atlas-apiref-meta-info>
|
|
693
|
-
|
|
674
|
+
);
|
|
675
|
+
}
|