@xyd-js/atlas 0.1.0-xyd.1 → 0.1.0-xyd.11
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 +39 -0
- package/dist/index.css +12 -11
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -0
- package/index.ts +0 -1
- package/package.json +27 -20
- package/rollup.config.js +11 -10
- package/src/components/ApiRef/ApiRefItem/ApiRefItem.tsx +10 -2
- package/src/components/ApiRef/ApiRefProperties/ApiRefProperties.styles.tsx +9 -4
- package/src/components/ApiRef/ApiRefProperties/ApiRefProperties.tsx +28 -5
- package/src/components/ApiRef/ApiRefSamples/ApiRefSamples.tsx +1 -1
- package/src/components/Atlas/Atlas.tsx +7 -2
- package/src/components/Atlas/AtlasLazy/AtlasLazy.tsx +1 -2
- package/src/components/Code/CodeSampleButtons/CodeSampleButtons.styles.tsx +83 -7
- package/src/components/Code/CodeSampleButtons/CodeSampleButtons.tsx +1 -1
- package/src/docs/AtlasExample/todo-app.uniform.json +1 -1
|
@@ -21,8 +21,6 @@ export const $li = {
|
|
|
21
21
|
margin: 0;
|
|
22
22
|
padding: 0;
|
|
23
23
|
|
|
24
|
-
border-top: 1px solid var(--atlas-comp-apiref-properties-border-color);
|
|
25
|
-
|
|
26
24
|
&:first-child {
|
|
27
25
|
padding-top: 0;
|
|
28
26
|
}
|
|
@@ -81,6 +79,14 @@ export const $propTypeCode = {
|
|
|
81
79
|
font-size: 10px;
|
|
82
80
|
color: var(--atlas-comp-apiref-properties-prop__type-color);
|
|
83
81
|
`,
|
|
82
|
+
link: css`
|
|
83
|
+
color: var(--atlas-comp-apiref-properties-color--active);
|
|
84
|
+
text-decoration: underline;
|
|
85
|
+
|
|
86
|
+
&:hover {
|
|
87
|
+
text-decoration: none;
|
|
88
|
+
}
|
|
89
|
+
`
|
|
84
90
|
}
|
|
85
91
|
|
|
86
92
|
export const $subProps = {
|
|
@@ -106,11 +112,10 @@ export const $subProps = {
|
|
|
106
112
|
list-style: none;
|
|
107
113
|
|
|
108
114
|
border: none;
|
|
115
|
+
border-left: 1px solid var(--atlas-comp-apiref-properties-border-color);
|
|
109
116
|
`,
|
|
110
117
|
li: css`
|
|
111
118
|
padding: 0 16px;
|
|
112
|
-
|
|
113
|
-
border-top: 1px solid var(--atlas-comp-apiref-properties-border-color);
|
|
114
119
|
`,
|
|
115
120
|
}
|
|
116
121
|
|
|
@@ -24,7 +24,11 @@ export function ApiRefProperties({properties}: ApiRefPropertiesProps) {
|
|
|
24
24
|
<li className={$li.host} key={i}>
|
|
25
25
|
<dl className={$dl.host}>
|
|
26
26
|
<$PropName name="name" value={mdxValue(property.name)}/>
|
|
27
|
-
<$PropType
|
|
27
|
+
<$PropType
|
|
28
|
+
name="type"
|
|
29
|
+
value={mdxValue(property.type)}
|
|
30
|
+
href={propertyTypeHref(property)}
|
|
31
|
+
/>
|
|
28
32
|
</dl>
|
|
29
33
|
<div className={$description.host}>
|
|
30
34
|
{property.children}
|
|
@@ -49,15 +53,20 @@ function $PropName({name, value}: { name: string, value: string }) {
|
|
|
49
53
|
</>
|
|
50
54
|
}
|
|
51
55
|
|
|
52
|
-
function $PropType({name, value}: { name: string, value: string }) {
|
|
56
|
+
function $PropType({name, value, href}: { name: string, value: string, href?: string }) {
|
|
53
57
|
return <>
|
|
54
58
|
<dd>
|
|
55
|
-
<code className={$propTypeCode.host}>
|
|
59
|
+
<code className={$propTypeCode.host}>
|
|
60
|
+
{
|
|
61
|
+
href
|
|
62
|
+
? <a className={$propTypeCode.link} href={href}>{value}</a>
|
|
63
|
+
: value
|
|
64
|
+
}
|
|
65
|
+
</code>
|
|
56
66
|
</dd>
|
|
57
67
|
</>
|
|
58
68
|
}
|
|
59
69
|
|
|
60
|
-
// const styles$ =
|
|
61
70
|
function $SubProperties({properties}: { properties: MDXReference<DefinitionProperty>[] }) {
|
|
62
71
|
const [expanded, setExpanded] = useState(false)
|
|
63
72
|
|
|
@@ -77,7 +86,11 @@ function $SubProperties({properties}: { properties: MDXReference<DefinitionPrope
|
|
|
77
86
|
return <li className={$subProps.li} key={i}>
|
|
78
87
|
<dl className={$dl.host}>
|
|
79
88
|
<$PropName name="name" value={mdxValue(prop.name)}/>
|
|
80
|
-
<$PropType
|
|
89
|
+
<$PropType
|
|
90
|
+
name="type"
|
|
91
|
+
value={mdxValue(prop.type)}
|
|
92
|
+
href={propertyTypeHref(prop)}
|
|
93
|
+
/>
|
|
81
94
|
</dl>
|
|
82
95
|
<div className={$description.host}>
|
|
83
96
|
{prop.children}
|
|
@@ -132,3 +145,13 @@ function $PropToggle(props: PropsToggleProps) {
|
|
|
132
145
|
)
|
|
133
146
|
}
|
|
134
147
|
|
|
148
|
+
function propertyTypeHref(property: MDXReference<DefinitionProperty>) {
|
|
149
|
+
if (property?.context?.graphqlBuiltInType?.title === "true") { // graphqlBuiltInType should be a boolean
|
|
150
|
+
return undefined
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// TODO: FINISH SLUG
|
|
154
|
+
return property.context?.graphqlTypeShort?.title
|
|
155
|
+
? `/docs/api/graphql/${property.context?.graphqlTypeShort?.title}-${mdxValue(property.context?.graphqlTypeFlat?.title)}`
|
|
156
|
+
: undefined
|
|
157
|
+
}
|
|
@@ -17,7 +17,7 @@ export interface ApiRefSamplesProps {
|
|
|
17
17
|
export function ApiRefSamples({examples}: ApiRefSamplesProps) {
|
|
18
18
|
return <div className={$container.host}>
|
|
19
19
|
{
|
|
20
|
-
examples.groups
|
|
20
|
+
examples.groups?.map(({description, examples}, i) => {
|
|
21
21
|
const [activeExample, setActiveExample] = useState<MDXReference<Example> | null>(examples?.[0])
|
|
22
22
|
|
|
23
23
|
const codeblocks = activeExample?.codeblock?.tabs?.map(tab => {
|
|
@@ -16,8 +16,13 @@ export interface AtlasProps {
|
|
|
16
16
|
export function Atlas(props: AtlasProps) {
|
|
17
17
|
return <div className={$atlas.host}>
|
|
18
18
|
{
|
|
19
|
-
props.references
|
|
20
|
-
<ApiRefItem
|
|
19
|
+
props.references?.map((reference, i) => <div key={i}>
|
|
20
|
+
<ApiRefItem
|
|
21
|
+
reference={{
|
|
22
|
+
|
|
23
|
+
...reference
|
|
24
|
+
}}
|
|
25
|
+
/>
|
|
21
26
|
</div>
|
|
22
27
|
)
|
|
23
28
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, {useEffect, useRef} from "react";
|
|
2
|
-
import {useNavigate} from "react-router";
|
|
3
2
|
|
|
4
3
|
import {Reference} from "@xyd-js/uniform";
|
|
5
4
|
|
|
@@ -17,7 +16,7 @@ export interface AtlasLazyProps {
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
export function AtlasLazy(props: AtlasLazyProps) {
|
|
20
|
-
return props.references
|
|
19
|
+
return props.references?.map((reference: any, i: number) => <>
|
|
21
20
|
<div
|
|
22
21
|
key={i}
|
|
23
22
|
// TODO: slug should be passed from reference or somrthing
|
|
@@ -9,14 +9,16 @@ export const $sample = {
|
|
|
9
9
|
display: flex;
|
|
10
10
|
align-items: center;
|
|
11
11
|
border-radius: 8px;
|
|
12
|
-
background-color: var(--atlas-comp-code-sample_buttons-container-background);
|
|
12
|
+
//background-color: var(--atlas-comp-code-sample_buttons-container-background);
|
|
13
|
+
background-color: #F3F4F6;
|
|
13
14
|
`
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export const $arrow = {
|
|
17
18
|
host: css`
|
|
18
19
|
padding: 8px;
|
|
19
|
-
background-color: var(--atlas-comp-code-sample_buttons-background--active);
|
|
20
|
+
//background-color: var(--atlas-comp-code-sample_buttons-background--active);
|
|
21
|
+
background-color: #ffffff;
|
|
20
22
|
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
21
23
|
`,
|
|
22
24
|
icon: css`
|
|
@@ -53,15 +55,89 @@ export const $button = {
|
|
|
53
55
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
54
56
|
transition-duration: 300ms;
|
|
55
57
|
|
|
56
|
-
color: var(--atlas-comp-code-sample_buttons-color);
|
|
58
|
+
//color: var(--atlas-comp-code-sample_buttons-color);
|
|
59
|
+
color: #6B7280;
|
|
60
|
+
|
|
61
|
+
&:hover {
|
|
62
|
+
//color: var(--atlas-comp-code-sample_buttons-color--active);
|
|
63
|
+
color: #111827;
|
|
64
|
+
}
|
|
65
|
+
`,
|
|
66
|
+
$$active: css`
|
|
67
|
+
//color: var(--atlas-comp-code-sample_buttons-color--active);
|
|
68
|
+
//background-color: var(--atlas-comp-code-sample_buttons-background--active);
|
|
69
|
+
color: #111827;
|
|
70
|
+
background-color: #ffffff;
|
|
71
|
+
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
72
|
+
`
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/*
|
|
76
|
+
import {css} from "@linaria/core";
|
|
77
|
+
|
|
78
|
+
export const $sample = {
|
|
79
|
+
host: css`
|
|
80
|
+
position: relative;
|
|
81
|
+
max-width: 100%;
|
|
82
|
+
`,
|
|
83
|
+
container: css`
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
border-radius: 8px;
|
|
87
|
+
background-color: #F3F4F6;
|
|
88
|
+
`
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export const $arrow = {
|
|
92
|
+
host: css`
|
|
93
|
+
padding: 8px;
|
|
94
|
+
background-color: #ffffff;
|
|
95
|
+
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
96
|
+
`,
|
|
97
|
+
icon: css`
|
|
98
|
+
width: 16px;
|
|
99
|
+
height: 16px;
|
|
100
|
+
`
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export const $scroller = {
|
|
104
|
+
host: css`
|
|
105
|
+
overflow-x: auto;
|
|
106
|
+
flex-grow: 1;
|
|
107
|
+
`,
|
|
108
|
+
container: css`
|
|
109
|
+
display: inline-flex;
|
|
110
|
+
gap: 4px;
|
|
111
|
+
|
|
112
|
+
padding: 4px;
|
|
113
|
+
margin-left: 4px;
|
|
114
|
+
`
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export const $button = {
|
|
118
|
+
host: css`
|
|
119
|
+
padding: 0.5rem 1rem;
|
|
120
|
+
|
|
121
|
+
border-radius: 0.375rem;
|
|
122
|
+
font-size: 0.875rem;
|
|
123
|
+
line-height: 1.25rem;
|
|
124
|
+
font-weight: 500;
|
|
125
|
+
white-space: nowrap;
|
|
126
|
+
|
|
127
|
+
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
|
|
128
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
129
|
+
transition-duration: 300ms;
|
|
130
|
+
|
|
131
|
+
color: #6B7280;
|
|
57
132
|
|
|
58
133
|
&:hover {
|
|
59
|
-
color:
|
|
134
|
+
color: #111827;
|
|
60
135
|
}
|
|
61
136
|
`,
|
|
62
137
|
$$active: css`
|
|
63
|
-
color:
|
|
64
|
-
background-color:
|
|
138
|
+
color: #111827;
|
|
139
|
+
background-color: #ffffff;
|
|
65
140
|
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
66
141
|
`
|
|
67
|
-
}
|
|
142
|
+
}
|
|
143
|
+
*/
|
|
@@ -63,7 +63,7 @@ export function CodeExampleButtons({examples, activeExample, onClick}: CodeExamp
|
|
|
63
63
|
className={$scroller.host}
|
|
64
64
|
>
|
|
65
65
|
<div className={$scroller.container}>
|
|
66
|
-
{examples
|
|
66
|
+
{examples?.map((example) => (
|
|
67
67
|
<$SampleButton
|
|
68
68
|
key={example.codeblock.title}
|
|
69
69
|
onClick={() => onClick(example)}
|