@xyd-js/atlas 0.0.0-build-d97dca6-20250821231438 → 0.0.0-build-4afb92e-20250828232425
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-CeNyr0lW-BWu_u92C.js → VideoGuide-q5P1gOHB-BWu_u92C.js} +1 -1
- package/dist/{VideoGuide-CeNyr0lW-BWu_u92C.js.map → VideoGuide-q5P1gOHB-BWu_u92C.js.map} +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/xydPlugin.js +1 -1
- package/package.json +6 -6
- package/src/components/ApiRef/ApiRefItem/ApiRefItem.styles.tsx +4 -0
- package/src/components/ApiRef/ApiRefItem/ApiRefItem.tsx +70 -82
package/dist/xydPlugin.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{SurfaceTarget as e}from"@xyd-js/framework";import{a as t,b as i}from"./VideoGuide-
|
|
1
|
+
import{SurfaceTarget as e}from"@xyd-js/framework";import{a as t,b as i}from"./VideoGuide-q5P1gOHB-BWu_u92C.js";import r from"react";import"radix-ui";import"lucide-react";import"openux-js";function a(e){var a,o=(null===(a=null==e?void 0:e.pageMeta)||void 0===a?void 0:a.openapi)||"",n=o.includes("#")?o.split("#"):["",o],u=t(n,2);u[0];var d=u[1],l=(void 0===d?"":d).split(" "),s=t(l,1)[0],m=void 0===s?"":s;if(!m)return null;if(m.includes("components/schemas"))return null;var p=m.toUpperCase();return"DELETE"===m&&(p="DEL"),r.createElement("div",{"data-active":(null==e?void 0:e.active)?"true":void 0,"data-atlas-oas-method":m},r.createElement(i,{size:"xs"},p))}function o(){return function(t){return{name:"atlas-xyd-plugin",customComponents:{AtlasSidebarItemRight:{component:a,surface:e.SidebarItemRight}}}}}export{o as default};
|
|
2
2
|
//# sourceMappingURL=xydPlugin.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyd-js/atlas",
|
|
3
|
-
"version": "0.0.0-build-
|
|
3
|
+
"version": "0.0.0-build-4afb92e-20250828232425",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"react": "^19.1.0",
|
|
27
27
|
"openux-js": "0.0.0-pre.1",
|
|
28
|
-
"@xyd-js/framework": "0.0.0-build-
|
|
29
|
-
"@xyd-js/plugins": "0.0.0-build-
|
|
30
|
-
"@xyd-js/core": "0.0.0-build-
|
|
31
|
-
"@xyd-js/uniform": "0.0.0-build-
|
|
32
|
-
"@xyd-js/components": "0.0.0-build-
|
|
28
|
+
"@xyd-js/framework": "0.0.0-build-4afb92e-20250828232425",
|
|
29
|
+
"@xyd-js/plugins": "0.0.0-build-4afb92e-20250828232425",
|
|
30
|
+
"@xyd-js/core": "0.0.0-build-4afb92e-20250828232425",
|
|
31
|
+
"@xyd-js/uniform": "0.0.0-build-4afb92e-20250828232425",
|
|
32
|
+
"@xyd-js/components": "0.0.0-build-4afb92e-20250828232425"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/react": "^19.1.0",
|
|
@@ -31,6 +31,10 @@ export const ApiRefItemNavbarSubtitle = css`
|
|
|
31
31
|
letter-spacing: 1px;
|
|
32
32
|
white-space: nowrap;
|
|
33
33
|
text-overflow: ellipsis;
|
|
34
|
+
user-select: text;
|
|
35
|
+
-webkit-user-select: text;
|
|
36
|
+
-moz-user-select: text;
|
|
37
|
+
-ms-user-select: text;
|
|
34
38
|
`;
|
|
35
39
|
|
|
36
40
|
export const ApiRefItemHost = css`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {createContext, useContext, useState, useCallback, useEffect} from "react";
|
|
1
|
+
import React, { createContext, useContext, useState, useCallback, useEffect } from "react";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
Definition,
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
Reference,
|
|
9
9
|
ReferenceCategory
|
|
10
10
|
} from "@xyd-js/uniform";
|
|
11
|
-
import {Heading, Code, Badge, Text} from "@xyd-js/components/writer";
|
|
11
|
+
import { Heading, Code, Badge, Text } from "@xyd-js/components/writer";
|
|
12
12
|
|
|
13
13
|
import {
|
|
14
14
|
ApiRefProperties,
|
|
15
15
|
ApiRefSamples
|
|
16
16
|
} from "@/components/ApiRef";
|
|
17
17
|
import * as cn from "@/components/ApiRef/ApiRefItem/ApiRefItem.styles";
|
|
18
|
-
import {useVariantToggles, type VariantToggleConfig} from "@/components/Atlas/AtlasContext";
|
|
18
|
+
import { useVariantToggles, type VariantToggleConfig } from "@/components/Atlas/AtlasContext";
|
|
19
19
|
|
|
20
20
|
export interface ApiRefItemProps {
|
|
21
21
|
reference: Reference
|
|
@@ -24,13 +24,13 @@ export interface ApiRefItemProps {
|
|
|
24
24
|
|
|
25
25
|
// TODO: context with current referene?
|
|
26
26
|
export function ApiRefItem({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
kind,
|
|
28
|
+
reference
|
|
29
|
+
}: ApiRefItemProps) {
|
|
30
30
|
const hasExamples = reference.examples?.groups?.length || false
|
|
31
31
|
|
|
32
|
-
let header: React.ReactNode | null = <$IntroHeader reference={reference}/>
|
|
33
|
-
let examples: React.ReactNode | null = <ApiRefSamples examples={reference.examples}/>
|
|
32
|
+
let header: React.ReactNode | null = <$IntroHeader reference={reference} />
|
|
33
|
+
let examples: React.ReactNode | null = <ApiRefSamples examples={reference.examples} />
|
|
34
34
|
|
|
35
35
|
if (kind === "secondary") {
|
|
36
36
|
header = null
|
|
@@ -55,7 +55,7 @@ export function ApiRefItem({
|
|
|
55
55
|
</atlas-apiref-item>
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
function $IntroHeader({reference}: ApiRefItemProps) {
|
|
58
|
+
function $IntroHeader({ reference }: ApiRefItemProps) {
|
|
59
59
|
let topNavbar;
|
|
60
60
|
|
|
61
61
|
switch (reference?.category) {
|
|
@@ -76,7 +76,7 @@ function $IntroHeader({reference}: ApiRefItemProps) {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
return <>
|
|
79
|
-
<$Title title={reference.title}/>
|
|
79
|
+
<$Title title={reference.title} />
|
|
80
80
|
|
|
81
81
|
{topNavbar}
|
|
82
82
|
|
|
@@ -84,7 +84,7 @@ function $IntroHeader({reference}: ApiRefItemProps) {
|
|
|
84
84
|
</>
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
function $Authorization({reference}: ApiRefItemProps) {
|
|
87
|
+
function $Authorization({ reference }: ApiRefItemProps) {
|
|
88
88
|
if (!reference.context) {
|
|
89
89
|
return null;
|
|
90
90
|
}
|
|
@@ -98,7 +98,7 @@ function $Authorization({reference}: ApiRefItemProps) {
|
|
|
98
98
|
return <div>
|
|
99
99
|
<div className={cn.ApiRefItemDefinitionsItem}>
|
|
100
100
|
<div part="header">
|
|
101
|
-
<$Subtitle title="Scopes"/>
|
|
101
|
+
<$Subtitle title="Scopes" />
|
|
102
102
|
</div>
|
|
103
103
|
|
|
104
104
|
<$DefinitionBody definition={{
|
|
@@ -132,9 +132,9 @@ const VariantContext = createContext<{
|
|
|
132
132
|
});
|
|
133
133
|
|
|
134
134
|
function $Definitions({
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
kind,
|
|
136
|
+
reference
|
|
137
|
+
}: ApiRefItemProps) {
|
|
138
138
|
let argDefinition: Definition | undefined
|
|
139
139
|
let definitions = reference?.definitions || []
|
|
140
140
|
|
|
@@ -158,50 +158,50 @@ function $Definitions({
|
|
|
158
158
|
definitions = gqlDefinitions
|
|
159
159
|
.filter(definition => definition?.properties?.length)
|
|
160
160
|
.map(definition => {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
161
|
+
if (!definition.properties?.length) return definition
|
|
162
|
+
|
|
163
|
+
// For each property in the definition
|
|
164
|
+
const updatedProperties = definition.properties.map(prop => {
|
|
165
|
+
// Find matching variant in argDefinition by symbolName
|
|
166
|
+
const matchingVariant = argDefinition?.variants?.find(variant => {
|
|
167
|
+
const symbolMeta = variant.meta?.find(m => m.name === 'symbolName')
|
|
168
|
+
return symbolMeta?.value === prop.name
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
if (matchingVariant) {
|
|
172
|
+
// Add meta flag to indicate this property has arguments, but only if it doesn't already have it
|
|
173
|
+
const meta = prop.meta || []
|
|
174
|
+
if (!meta.some(m => m.name === 'hasArguments')) {
|
|
175
|
+
meta.push({
|
|
176
|
+
name: 'hasArguments', // TODO: better solution in the future
|
|
177
|
+
value: 'true'
|
|
178
|
+
})
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Merge properties from the matching variant
|
|
182
|
+
return {
|
|
183
|
+
...prop,
|
|
184
|
+
meta,
|
|
185
|
+
properties: matchingVariant.properties || []
|
|
186
|
+
}
|
|
179
187
|
}
|
|
180
188
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
...prop,
|
|
184
|
-
meta,
|
|
185
|
-
properties: matchingVariant.properties || []
|
|
186
|
-
}
|
|
187
|
-
}
|
|
189
|
+
return prop
|
|
190
|
+
})
|
|
188
191
|
|
|
189
|
-
return
|
|
192
|
+
return {
|
|
193
|
+
...definition,
|
|
194
|
+
properties: updatedProperties
|
|
195
|
+
}
|
|
190
196
|
})
|
|
191
|
-
|
|
192
|
-
return {
|
|
193
|
-
...definition,
|
|
194
|
-
properties: updatedProperties
|
|
195
|
-
}
|
|
196
|
-
})
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
return <atlas-apiref-definitions className={cn.ApiRefItemDefinitionsHost}>
|
|
200
|
-
<$Authorization reference={reference}/>
|
|
200
|
+
<$Authorization reference={reference} />
|
|
201
201
|
|
|
202
202
|
{definitions?.map((definition, i) => {
|
|
203
203
|
if (kind === "secondary") {
|
|
204
|
-
return <$DefinitionBody key={i} definition={definition}/>
|
|
204
|
+
return <$DefinitionBody key={i} definition={definition} />
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
return <$VariantsProvider key={i} definition={definition}>
|
|
@@ -209,13 +209,13 @@ function $Definitions({
|
|
|
209
209
|
{
|
|
210
210
|
definition?.title ? <div key={i} className={cn.ApiRefItemDefinitionsItem}>
|
|
211
211
|
<div part="header">
|
|
212
|
-
<$Subtitle title={definition.title}/>
|
|
212
|
+
<$Subtitle title={definition.title} />
|
|
213
213
|
<div part="controls">
|
|
214
|
-
<$VariantSelects/>
|
|
214
|
+
<$VariantSelects />
|
|
215
215
|
</div>
|
|
216
216
|
</div>
|
|
217
217
|
|
|
218
|
-
<$DefinitionBody definition={definition}/>
|
|
218
|
+
<$DefinitionBody definition={definition} />
|
|
219
219
|
</div> : null
|
|
220
220
|
}
|
|
221
221
|
</div>
|
|
@@ -224,7 +224,7 @@ function $Definitions({
|
|
|
224
224
|
</atlas-apiref-definitions>
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
function $VariantsProvider({definition, children}: {
|
|
227
|
+
function $VariantsProvider({ definition, children }: {
|
|
228
228
|
definition: Definition,
|
|
229
229
|
children: React.ReactNode
|
|
230
230
|
}) {
|
|
@@ -234,8 +234,8 @@ function $VariantsProvider({definition, children}: {
|
|
|
234
234
|
...metaAcc,
|
|
235
235
|
[meta.name]: 1,
|
|
236
236
|
}), {}) || {}
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
|
|
238
|
+
|
|
239
239
|
return {
|
|
240
240
|
...acc,
|
|
241
241
|
...allMetaNames,
|
|
@@ -252,7 +252,7 @@ function $VariantsProvider({definition, children}: {
|
|
|
252
252
|
});
|
|
253
253
|
|
|
254
254
|
const setSelectedValue = useCallback((key: string, value: string) => {
|
|
255
|
-
setSelectedValues(prev => ({...prev, [key]: value}));
|
|
255
|
+
setSelectedValues(prev => ({ ...prev, [key]: value }));
|
|
256
256
|
}, []);
|
|
257
257
|
|
|
258
258
|
|
|
@@ -291,7 +291,7 @@ function findMatchingVariant(variants: DefinitionVariant[], selectedValues: Reco
|
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
function $VariantSelects() {
|
|
294
|
-
const {variantToggles, selectedValues, setSelectedValue, variants} = useContext(VariantContext);
|
|
294
|
+
const { variantToggles, selectedValues, setSelectedValue, variants } = useContext(VariantContext);
|
|
295
295
|
|
|
296
296
|
if (!variants?.length) return null;
|
|
297
297
|
|
|
@@ -385,22 +385,22 @@ interface DefinitionBodyProps {
|
|
|
385
385
|
}
|
|
386
386
|
|
|
387
387
|
function $DefinitionBody(props: DefinitionBodyProps) {
|
|
388
|
-
const {definition} = props;
|
|
389
|
-
const {variant} = useContext(VariantContext);
|
|
388
|
+
const { definition } = props;
|
|
389
|
+
const { variant } = useContext(VariantContext);
|
|
390
390
|
|
|
391
391
|
let apiRefProperties: React.ReactNode | null = null;
|
|
392
392
|
|
|
393
393
|
if (variant) {
|
|
394
394
|
if (variant.properties?.length) {
|
|
395
|
-
apiRefProperties = <ApiRefProperties properties={variant.properties}/>;
|
|
395
|
+
apiRefProperties = <ApiRefProperties properties={variant.properties} />;
|
|
396
396
|
} else if (variant.rootProperty) {
|
|
397
|
-
apiRefProperties = <ApiRefProperties properties={[variant.rootProperty]}/>;
|
|
397
|
+
apiRefProperties = <ApiRefProperties properties={[variant.rootProperty]} />;
|
|
398
398
|
}
|
|
399
399
|
} else {
|
|
400
400
|
if (definition.properties?.length) {
|
|
401
|
-
apiRefProperties = <ApiRefProperties properties={definition.properties}/>;
|
|
401
|
+
apiRefProperties = <ApiRefProperties properties={definition.properties} />;
|
|
402
402
|
} else if (definition.rootProperty) {
|
|
403
|
-
apiRefProperties = <ApiRefProperties properties={[definition.rootProperty]}/>;
|
|
403
|
+
apiRefProperties = <ApiRefProperties properties={[definition.rootProperty]} />;
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
406
|
|
|
@@ -470,7 +470,7 @@ interface NavbarProps {
|
|
|
470
470
|
matchSubtitle?: string
|
|
471
471
|
}
|
|
472
472
|
|
|
473
|
-
function $Navbar({label, subtitle, matchSubtitle}: NavbarProps) {
|
|
473
|
+
function $Navbar({ label, subtitle, matchSubtitle }: NavbarProps) {
|
|
474
474
|
const renderSubtitle = () => {
|
|
475
475
|
if (!matchSubtitle) {
|
|
476
476
|
return subtitle;
|
|
@@ -486,27 +486,16 @@ function $Navbar({label, subtitle, matchSubtitle}: NavbarProps) {
|
|
|
486
486
|
const after = subtitle.substring(index + matchSubtitle.length);
|
|
487
487
|
|
|
488
488
|
return (
|
|
489
|
-
|
|
489
|
+
<span>
|
|
490
490
|
{before}
|
|
491
|
-
<Text as="span" weight="bold">
|
|
491
|
+
<Text size="inherit" as="span" weight="bold">
|
|
492
492
|
{match}
|
|
493
493
|
</Text>
|
|
494
494
|
{after}
|
|
495
|
-
|
|
495
|
+
</span>
|
|
496
496
|
);
|
|
497
497
|
};
|
|
498
498
|
|
|
499
|
-
const handleClick = (e: React.MouseEvent) => {
|
|
500
|
-
const target = e.target as HTMLElement;
|
|
501
|
-
const range = document.createRange();
|
|
502
|
-
range.selectNodeContents(target);
|
|
503
|
-
const selection = window.getSelection();
|
|
504
|
-
if (selection) {
|
|
505
|
-
selection.removeAllRanges();
|
|
506
|
-
selection.addRange(range);
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
|
|
510
499
|
return <>
|
|
511
500
|
<div className={cn.ApiRefItemNavbarHost}>
|
|
512
501
|
<div className={cn.ApiRefItemNavbarContainer}>
|
|
@@ -518,9 +507,8 @@ function $Navbar({label, subtitle, matchSubtitle}: NavbarProps) {
|
|
|
518
507
|
</Badge>
|
|
519
508
|
</div>
|
|
520
509
|
</div>
|
|
521
|
-
<div
|
|
510
|
+
<div
|
|
522
511
|
className={cn.ApiRefItemNavbarSubtitle}
|
|
523
|
-
onClick={handleClick}
|
|
524
512
|
>
|
|
525
513
|
{renderSubtitle()}
|
|
526
514
|
</div>
|
|
@@ -529,7 +517,7 @@ function $Navbar({label, subtitle, matchSubtitle}: NavbarProps) {
|
|
|
529
517
|
</>
|
|
530
518
|
}
|
|
531
519
|
|
|
532
|
-
function $Title({title}: { title: string }) {
|
|
520
|
+
function $Title({ title }: { title: string }) {
|
|
533
521
|
return <>
|
|
534
522
|
<Heading size={1}>
|
|
535
523
|
{title}
|
|
@@ -537,7 +525,7 @@ function $Title({title}: { title: string }) {
|
|
|
537
525
|
</>
|
|
538
526
|
}
|
|
539
527
|
|
|
540
|
-
function $Subtitle({title}: { title: string }) {
|
|
528
|
+
function $Subtitle({ title }: { title: string }) {
|
|
541
529
|
return <>
|
|
542
530
|
<Heading size={3}>
|
|
543
531
|
{title}
|