@xyd-js/atlas 0.1.0-xyd.8 → 0.1.0-xyd.99
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/.storybook/index.css +1 -27
- package/.storybook/preview.ts +1 -2
- package/CHANGELOG.md +1057 -0
- package/LICENSE +21 -0
- package/dist/Update-0XruJHjj-COLbZvRj.js +4 -0
- package/dist/Update-0XruJHjj-COLbZvRj.js.map +1 -0
- package/dist/Update-DKOAw8p9-COLbZvRj.js +4 -0
- package/dist/Update-DKOAw8p9-COLbZvRj.js.map +1 -0
- package/dist/index.css +43 -54
- package/dist/index.d.ts +30 -11
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +89 -0
- package/dist/tokens.css +60 -0
- package/dist/xydPlugin.d.ts +5 -0
- package/dist/xydPlugin.js +2 -0
- package/dist/xydPlugin.js.map +1 -0
- package/index.ts +1 -1
- package/package.json +20 -21
- package/packages/xyd-plugin/SidebarItem.tsx +27 -0
- package/packages/xyd-plugin/index.ts +20 -0
- package/rollup.config.js +56 -12
- package/src/components/ApiRef/ApiRefItem/ApiRefItem.styles.tsx +95 -63
- package/src/components/ApiRef/ApiRefItem/ApiRefItem.tsx +507 -55
- package/src/components/ApiRef/ApiRefProperties/ApiRefProperties.styles.tsx +186 -143
- package/src/components/ApiRef/ApiRefProperties/ApiRefProperties.tsx +584 -76
- package/src/components/ApiRef/ApiRefSamples/ApiRefSamples.styles.tsx +19 -23
- package/src/components/ApiRef/ApiRefSamples/ApiRefSamples.tsx +39 -24
- package/src/components/Atlas/Atlas.styles.tsx +3 -5
- package/src/components/Atlas/Atlas.tsx +34 -21
- package/src/components/Atlas/AtlasContext.tsx +47 -0
- package/src/components/Atlas/AtlasDecorator.styles.ts +22 -0
- package/src/components/Atlas/AtlasDecorator.tsx +15 -0
- package/src/components/Atlas/AtlasLazy/AtlasLazy.styles.tsx +7 -8
- package/src/components/Atlas/AtlasLazy/AtlasLazy.tsx +4 -6
- package/src/components/Atlas/AtlasPrimary.tsx +21 -0
- package/src/components/Atlas/AtlasSecondary.tsx +148 -0
- package/src/components/Atlas/index.ts +6 -2
- package/src/components/Atlas/types.ts +11 -0
- package/src/components/Code/CodeSampleButtons/CodeSampleButtons.styles.tsx +56 -141
- package/src/components/Code/CodeSampleButtons/CodeSampleButtons.tsx +19 -28
- package/src/components/Code/index.ts +0 -4
- package/src/components/Icon/index.tsx +384 -0
- package/src/styles/styles.css +89 -0
- package/src/styles/tokens.css +60 -0
- package/src/utils/mdx.ts +0 -29
- package/tsconfig.json +9 -2
- package/types.d.ts +22 -0
- package/src/components/Code/CodeCopy/CodeCopy.style.tsx +0 -21
- package/src/components/Code/CodeCopy/CodeCopy.tsx +0 -32
- package/src/components/Code/CodeCopy/index.ts +0 -7
- package/src/components/Code/CodeSample/CodeSample.styles.tsx +0 -134
- package/src/components/Code/CodeSample/CodeSample.tsx +0 -149
- package/src/components/Code/CodeSample/index.ts +0 -8
- package/src/components/Code/CodeSample/withLocalStored.tsx +0 -52
- package/src/components/Code/default-theme.ts +0 -266
package/dist/styles.css
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
@layer overrides {
|
|
2
|
+
:root {
|
|
3
|
+
--oas-method-get-color: #15803d;
|
|
4
|
+
--oas-method-get-bg: rgba(74, 222, 128, .2);
|
|
5
|
+
--oas-method-get-color--active: var(--white);
|
|
6
|
+
--oas-method-get-bg--active: #2ab673;
|
|
7
|
+
|
|
8
|
+
--oas-method-post-color: #1D4ED8;
|
|
9
|
+
--oas-method-post-bg: rgba(96, 165, 250, .2);
|
|
10
|
+
--oas-method-post-color--active: var(--white);
|
|
11
|
+
--oas-method-post-bg--active: #3064e3;
|
|
12
|
+
|
|
13
|
+
--oas-method-put-color: #C28C30;
|
|
14
|
+
--oas-method-put-bg: rgba(250, 204, 21, .2);
|
|
15
|
+
--oas-method-put-color--active: var(--white);
|
|
16
|
+
--oas-method-put-bg--active: #C28C30;
|
|
17
|
+
|
|
18
|
+
--oas-method-delete-color: #B91C1C;
|
|
19
|
+
--oas-method-delete-bg: rgba(248, 114, 114, 0.2);
|
|
20
|
+
--oas-method-delete-color--active: var(--white);
|
|
21
|
+
--oas-method-delete-bg--active: #cb3a32;
|
|
22
|
+
|
|
23
|
+
--oas-method-patch-color: #c2410c;
|
|
24
|
+
--oas-method-patch-bg: rgba(251, 146, 60, .2);
|
|
25
|
+
--oas-method-patch-color--active: var(--white);
|
|
26
|
+
--oas-method-patch-bg--active: #DA622B;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* HTTP Method Colors */
|
|
30
|
+
[atlas-oas-method="GET"] {
|
|
31
|
+
--method-color: var(--oas-method-get-color);
|
|
32
|
+
--method-bg: var(--oas-method-get-bg);
|
|
33
|
+
|
|
34
|
+
&[data-active="true"] {
|
|
35
|
+
--method-bg: var(--oas-method-get-bg--active);
|
|
36
|
+
--method-color: var(--oas-method-get-color--active);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
[atlas-oas-method="POST"] {
|
|
41
|
+
--method-color: var(--oas-method-post-color);
|
|
42
|
+
--method-bg: var(--oas-method-post-bg);
|
|
43
|
+
|
|
44
|
+
&[data-active="true"] {
|
|
45
|
+
--method-bg: var(--oas-method-post-bg--active);
|
|
46
|
+
--method-color: var(--oas-method-post-color--active);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
[atlas-oas-method="PUT"] {
|
|
51
|
+
--method-color: var(--oas-method-put-color);
|
|
52
|
+
--method-bg: var(--oas-method-put-bg);
|
|
53
|
+
|
|
54
|
+
&[data-active="true"] {
|
|
55
|
+
--method-bg: var(--oas-method-put-bg--active);
|
|
56
|
+
--method-color: var(--oas-method-put-color--active);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
[atlas-oas-method="DELETE"] {
|
|
61
|
+
--method-color: var(--oas-method-delete-color);
|
|
62
|
+
--method-bg: var(--oas-method-delete-bg);
|
|
63
|
+
|
|
64
|
+
&[data-active="true"] {
|
|
65
|
+
--method-bg: var(--oas-method-delete-bg--active);
|
|
66
|
+
--method-color: var(--oas-method-delete-color--active);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
[atlas-oas-method="PATCH"] {
|
|
71
|
+
--method-color: var(--oas-method-patch-color);
|
|
72
|
+
--method-bg: var(--oas-method-patch-bg);
|
|
73
|
+
|
|
74
|
+
&[data-active="true"] {
|
|
75
|
+
--method-bg: var(--oas-method-patch-bg--active);
|
|
76
|
+
--method-color: var(--oas-method-patch-color--active);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
[atlas-oas-method] {
|
|
81
|
+
color: var(--method-color);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
[atlas-oas-method] xyd-badge {
|
|
85
|
+
background-color: var(--method-bg);
|
|
86
|
+
color: var(--method-color);
|
|
87
|
+
font-weight: var(--xyd-font-weight-bold);
|
|
88
|
+
}
|
|
89
|
+
}
|
package/dist/tokens.css
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
/* Ref tokens - Base values */
|
|
3
|
+
--XydAtlas-Ref-Palette-White: #FFFFFF;
|
|
4
|
+
|
|
5
|
+
--XydAtlas-Ref-Palette-Primary-60: #7051d4;
|
|
6
|
+
--XydAtlas-Ref-Palette-Primary-70: #6045b9;
|
|
7
|
+
--XydAtlas-Ref-Palette-Primary-80: #4f399e;
|
|
8
|
+
|
|
9
|
+
--XydAtlas-Ref-Palette-Neutral-10: #F8F9FA;
|
|
10
|
+
--XydAtlas-Ref-Palette-Neutral-20: #F1F3F5;
|
|
11
|
+
--XydAtlas-Ref-Palette-Neutral-30: #E9ECEF;
|
|
12
|
+
--XydAtlas-Ref-Palette-Neutral-40: #DEE2E6;
|
|
13
|
+
--XydAtlas-Ref-Palette-Neutral-70: #6C757D;
|
|
14
|
+
--XydAtlas-Ref-Palette-Neutral-80: #495057;
|
|
15
|
+
--XydAtlas-Ref-Palette-Neutral-100: #212529;
|
|
16
|
+
|
|
17
|
+
/* System tokens - Semantic values */
|
|
18
|
+
--XydAtlas-Sys-Color-Primary: var(--XydAtlas-Ref-Palette-Primary-60);
|
|
19
|
+
--XydAtlas-Sys-Color-Primary--hover: var(--XydAtlas-Ref-Palette-Primary-70);
|
|
20
|
+
--XydAtlas-Sys-Color-Primary--active: var(--XydAtlas-Ref-Palette-Primary-80);
|
|
21
|
+
|
|
22
|
+
--XydAtlas-Sys-Color-Surface: var(--XydAtlas-Ref-Palette-Neutral-10);
|
|
23
|
+
--XydAtlas-Sys-Color-Surface--hover: var(--XydAtlas-Ref-Palette-Neutral-20);
|
|
24
|
+
--XydAtlas-Sys-Color-Surface--active: var(--XydAtlas-Ref-Palette-Neutral-30);
|
|
25
|
+
|
|
26
|
+
--XydAtlas-Sys-Color-Text-Primary: var(--XydAtlas-Ref-Palette-Neutral-100);
|
|
27
|
+
--XydAtlas-Sys-Color-Text-Secondary: var(--XydAtlas-Ref-Palette-Neutral-80);
|
|
28
|
+
--XydAtlas-Sys-Color-Text-Tertiary: var(--XydAtlas-Ref-Palette-Neutral-70);
|
|
29
|
+
|
|
30
|
+
--XydAtlas-Sys-Color-Border: var(--XydAtlas-Ref-Palette-Neutral-30);
|
|
31
|
+
--XydAtlas-Sys-Color-Border--hover: var(--XydAtlas-Ref-Palette-Neutral-40);
|
|
32
|
+
--XydAtlas-Sys-Color-Border--active: var(--XydAtlas-Ref-Palette-Primary-60);
|
|
33
|
+
|
|
34
|
+
/* Component tokens - Specific component values */
|
|
35
|
+
/* ApiRef Properties */
|
|
36
|
+
--XydAtlas-Component-ApiRef-Properties__color-description: var(--XydAtlas-Sys-Color-Text-Secondary);
|
|
37
|
+
--XydAtlas-Component-ApiRef-Properties__color-propName: var(--XydAtlas-Sys-Color-Text-Primary);
|
|
38
|
+
--XydAtlas-Component-ApiRef-Properties__color-propType: var(--XydAtlas-Sys-Color-Text-Tertiary);
|
|
39
|
+
--XydAtlas-Component-ApiRef-Properties__color--active: var(--XydAtlas-Sys-Color-Primary);
|
|
40
|
+
--XydAtlas-Component-ApiRef-Properties__color-border: var(--XydAtlas-Sys-Color-Border);
|
|
41
|
+
|
|
42
|
+
/* ApiRef Item */
|
|
43
|
+
--XydAtlas-Component-ApiRef-Item__color-border: var(--XydAtlas-Sys-Color-Border);
|
|
44
|
+
--XydAtlas-Component-ApiRef-Item__color-navbar: var(--XydAtlas-Sys-Color-Text-Secondary);
|
|
45
|
+
--XydAtlas-Component-ApiRef-Item__background-navbar: var(--XydAtlas-Ref-Palette-Neutral-10);
|
|
46
|
+
|
|
47
|
+
/* Code Sample */
|
|
48
|
+
--XydAtlas-Component-Code-Sample__color-border: var(--XydAtlas-Sys-Color-Border);
|
|
49
|
+
--XydAtlas-Component-Code-Sample__color: var(--XydAtlas-Sys-Color-Text-Secondary);
|
|
50
|
+
--XydAtlas-Component-Code-Sample__color--active: var(--XydAtlas-Sys-Color-Primary);
|
|
51
|
+
--XydAtlas-Component-Code-Sample__color-background: var(--XydAtlas-Sys-Color-Surface--hover);
|
|
52
|
+
--XydAtlas-Component-Code-Sample__color-markBorder--active: var(--XydAtlas-Sys-Color-Primary);
|
|
53
|
+
--XydAtlas-Component-Code-Sample__color-markBackground--active: var(--XydAtlas-Sys-Color-Surface--hover);
|
|
54
|
+
|
|
55
|
+
/* Code Sample Buttons */
|
|
56
|
+
--XydAtlas-Component-Code-SampleButtons__color-containerBackground: var(--XydAtlas-Sys-Color-Surface);
|
|
57
|
+
--XydAtlas-Component-Code-SampleButtons__color-background--active: var(--XydAtlas-Ref-Palette-White);
|
|
58
|
+
--XydAtlas-Component-Code-SampleButtons__color: var(--XydAtlas-Ref-Palette-Neutral-40);
|
|
59
|
+
--XydAtlas-Component-Code-SampleButtons__color--active: var(--XydAtlas-Sys-Color-Text-Primary);
|
|
60
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{SurfaceTarget as e}from"@xyd-js/framework";import{a as t,c as r}from"./Update-0XruJHjj-COLbZvRj.js";import i from"react";import"radix-ui";import"lucide-react";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 l=u[1],s=(void 0===l?"":l).split(" "),d=t(s,1)[0],m=void 0===d?"":d;if(!m)return null;if(m.includes("components/schemas"))return null;var p=m.toUpperCase();return"DELETE"===m&&(p="DEL"),i.createElement("div",{"data-active":(null==e?void 0:e.active)?"true":void 0,"atlas-oas-method":m},i.createElement(r,{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
|
+
//# sourceMappingURL=xydPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xydPlugin.js","sources":["../packages/xyd-plugin/SidebarItem.tsx","../packages/xyd-plugin/index.ts"],"sourcesContent":["import React from \"react\"\n\nimport { Badge } from \"@xyd-js/components/writer\"\n\nexport function SidebarItemRight(props: any) {\n const openapi = props?.pageMeta?.openapi || \"\"\n const [_, region = \"\"] = openapi.includes(\"#\") ? openapi.split(\"#\") : [\"\", openapi]\n const [method = \"\"] = region.split(\" \")\n\n if (!method) {\n return null\n }\n if (method.includes(\"components/schemas\")) {\n return null\n }\n\n let methodText = method.toUpperCase()\n if (method === \"DELETE\") {\n methodText = \"DEL\"\n }\n\n return <div data-active={props?.active ? \"true\" : undefined} atlas-oas-method={method}>\n <Badge size=\"xs\">\n {methodText}\n </Badge>\n </div>\n}","import { Settings } from \"@xyd-js/core\"\nimport { Plugin } from \"@xyd-js/plugins\"\nimport { SurfaceTarget } from \"@xyd-js/framework\"\n\nimport { SidebarItemRight } from \"./SidebarItem\"\n\nexport default function XydAtlasPlugin(): Plugin {\n return function (settings: Settings) {\n return {\n name: \"atlas-xyd-plugin\",\n customComponents: {\n AtlasSidebarItemRight: {\n component: SidebarItemRight,\n surface: SurfaceTarget.SidebarItemRight,\n }\n }\n }\n }\n}\n\n"],"names":["SidebarItemRight","props","openapi","_a","pageMeta","_ref","includes","split","_ref2","_slicedToArray","_ref2$","_region$split","_region$split2$","method","methodText","toUpperCase","React","createElement","active","undefined","Badge","size","XydAtlasPlugin","settings","name","customComponents","AtlasSidebarItemRight","component","surface","SurfaceTarget"],"mappings":"sKAIM,SAAUA,EAAiBC,SACvBC,GAAyB,QAAfC,EAAAF,aAAK,EAALA,EAAOG,gBAAQ,IAAAD,OAAA,EAAAA,EAAED,UAAW,GAC5CG,EAAyBH,EAAQI,SAAS,KAAOJ,EAAQK,MAAM,KAAO,CAAC,GAAIL,GAAQM,EAAAC,EAAAJ,EAAA,GAA3EG,EAAA,GAAAE,IAAAA,EAAAF,EAAA,GACRG,QADgB,IAAAD,EAAG,GAAEA,GACQH,MAAM,KAAIK,EAAAH,EAAAE,EAAA,GAAA,GAAhCE,OAAM,IAAAD,EAAG,GAAEA,EAElB,IAAKC,EACD,OAAO,KAEX,GAAIA,EAAOP,SAAS,sBAChB,OAAO,KAGX,IAAIQ,EAAaD,EAAOE,cAKxB,MAJe,WAAXF,IACAC,EAAa,OAGVE,EAAAC,cAAA,MAAA,CAAK,eAAahB,aAAK,EAALA,EAAOiB,QAAS,YAASC,EAAW,mBAAkBN,GAC3EG,EAAAC,cAACG,EAAK,CAACC,KAAK,MACPP,GAGb,CCpBc,SAAUQ,IACpB,OAAO,SAAUC,GACb,MAAO,CACHC,KAAM,mBACNC,iBAAkB,CACdC,sBAAuB,CACnBC,UAAW3B,EACX4B,QAASC,EAAc7B,oBAK3C"}
|
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyd-js/atlas",
|
|
3
|
-
"version": "0.1.0-xyd.
|
|
3
|
+
"version": "0.1.0-xyd.99",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -8,60 +8,59 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
"./package.json": "./package.json",
|
|
10
10
|
"./index.css": "./dist/index.css",
|
|
11
|
+
"./tokens.css": "./dist/tokens.css",
|
|
11
12
|
".": {
|
|
12
13
|
"import": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./xydPlugin": {
|
|
16
|
+
"import": "./dist/xydPlugin.js"
|
|
13
17
|
}
|
|
14
18
|
},
|
|
15
19
|
"dependencies": {
|
|
16
|
-
"@code-hike/lighter": "^1.0.
|
|
17
|
-
"
|
|
20
|
+
"@code-hike/lighter": "^1.0.3",
|
|
21
|
+
"radix-ui": "^1.4.2",
|
|
18
22
|
"codehike": "^1.0.2",
|
|
19
23
|
"lucide-react": "^0.447.0",
|
|
20
|
-
"@xyd-js/uniform": "0.1.0-xyd.
|
|
24
|
+
"@xyd-js/uniform": "0.1.0-xyd.98",
|
|
25
|
+
"@xyd-js/components": "0.1.0-xyd.94"
|
|
21
26
|
},
|
|
22
27
|
"peerDependencies": {
|
|
23
|
-
"react": "^19.
|
|
28
|
+
"react": "^19.1.0",
|
|
29
|
+
"@xyd-js/framework": "0.1.0-xyd.115",
|
|
30
|
+
"@xyd-js/plugins": "0.1.0-xyd.83",
|
|
31
|
+
"@xyd-js/core": "0.1.0-xyd.96"
|
|
24
32
|
},
|
|
25
33
|
"devDependencies": {
|
|
26
|
-
"@
|
|
34
|
+
"@types/react": "^19.1.0",
|
|
35
|
+
"@types/react-dom": "^19.1.0",
|
|
27
36
|
"@linaria/core": "^6.2.0",
|
|
28
|
-
"@babel/preset-typescript": "^7.26.0",
|
|
29
37
|
"@babel/preset-react": "^7.26.0",
|
|
30
38
|
"@babel/preset-env": "^7.26.0",
|
|
31
|
-
"@babel/preset-flow": "^7.25.9",
|
|
32
|
-
"@rollup/plugin-alias": "^5.1.1",
|
|
33
39
|
"@rollup/plugin-babel": "^6.0.4",
|
|
34
40
|
"@rollup/plugin-commonjs": "^28.0.1",
|
|
35
41
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
36
42
|
"@rollup/plugin-typescript": "^12.1.1",
|
|
37
43
|
"@wyw-in-js/rollup": "^0.5.5",
|
|
38
44
|
"@wyw-in-js/vite": "^0.5.5",
|
|
39
|
-
"@chromatic-com/storybook": "^3.2.2",
|
|
40
|
-
"@storybook/addon-essentials": "^8.4.5",
|
|
41
|
-
"@storybook/addon-interactions": "^8.4.5",
|
|
42
|
-
"@storybook/addon-onboarding": "^8.4.5",
|
|
43
|
-
"@storybook/blocks": "^8.4.5",
|
|
44
45
|
"@storybook/react": "^8.4.5",
|
|
45
46
|
"@storybook/react-vite": "^8.4.5",
|
|
46
47
|
"@storybook/test": "^8.4.5",
|
|
47
|
-
"autoprefixer": "^10.4.20",
|
|
48
|
-
"postcss": "^8.4.47",
|
|
49
|
-
"postcss-import": "^16.1.0",
|
|
50
48
|
"rollup": "^4.27.4",
|
|
51
49
|
"rollup-plugin-css-only": "^4.5.2",
|
|
52
50
|
"rollup-plugin-dts": "^6.1.1",
|
|
53
|
-
"rollup-plugin-postcss": "^4.0.2",
|
|
54
51
|
"rollup-plugin-terser": "^7.0.2",
|
|
55
|
-
"tsup": "^8.3.0",
|
|
56
52
|
"rimraf": "^3.0.2",
|
|
57
|
-
"prop-types": "^15.8.1",
|
|
58
53
|
"storybook": "^8.4.5",
|
|
59
|
-
"
|
|
54
|
+
"vite": "^7.0.0",
|
|
55
|
+
"@vitejs/plugin-react": "^4.3.2",
|
|
56
|
+
"unist-util-visit": "^5.0.0",
|
|
57
|
+
"@mdx-js/mdx": "^3.1.0"
|
|
60
58
|
},
|
|
61
59
|
"scripts": {
|
|
62
60
|
"clean": "rimraf build",
|
|
63
61
|
"prebuild": "pnpm clean",
|
|
64
62
|
"build": "rollup -c rollup.config.js",
|
|
63
|
+
"dev": "rollup -c rollup.config.js --watch",
|
|
65
64
|
"storybook": "storybook dev -p 6006",
|
|
66
65
|
"build-storybook": "storybook build"
|
|
67
66
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
|
|
3
|
+
import { Badge } from "@xyd-js/components/writer"
|
|
4
|
+
|
|
5
|
+
export function SidebarItemRight(props: any) {
|
|
6
|
+
const openapi = props?.pageMeta?.openapi || ""
|
|
7
|
+
const [_, region = ""] = openapi.includes("#") ? openapi.split("#") : ["", openapi]
|
|
8
|
+
const [method = ""] = region.split(" ")
|
|
9
|
+
|
|
10
|
+
if (!method) {
|
|
11
|
+
return null
|
|
12
|
+
}
|
|
13
|
+
if (method.includes("components/schemas")) {
|
|
14
|
+
return null
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let methodText = method.toUpperCase()
|
|
18
|
+
if (method === "DELETE") {
|
|
19
|
+
methodText = "DEL"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return <div data-active={props?.active ? "true" : undefined} atlas-oas-method={method}>
|
|
23
|
+
<Badge size="xs">
|
|
24
|
+
{methodText}
|
|
25
|
+
</Badge>
|
|
26
|
+
</div>
|
|
27
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Settings } from "@xyd-js/core"
|
|
2
|
+
import { Plugin } from "@xyd-js/plugins"
|
|
3
|
+
import { SurfaceTarget } from "@xyd-js/framework"
|
|
4
|
+
|
|
5
|
+
import { SidebarItemRight } from "./SidebarItem"
|
|
6
|
+
|
|
7
|
+
export default function XydAtlasPlugin(): Plugin {
|
|
8
|
+
return function (settings: Settings) {
|
|
9
|
+
return {
|
|
10
|
+
name: "atlas-xyd-plugin",
|
|
11
|
+
customComponents: {
|
|
12
|
+
AtlasSidebarItemRight: {
|
|
13
|
+
component: SidebarItemRight,
|
|
14
|
+
surface: SurfaceTarget.SidebarItemRight,
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
package/rollup.config.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import {createRequire} from 'module';
|
|
3
|
+
|
|
1
4
|
import resolve from '@rollup/plugin-node-resolve';
|
|
2
5
|
import commonjs from '@rollup/plugin-commonjs';
|
|
3
6
|
import typescript from '@rollup/plugin-typescript';
|
|
@@ -6,7 +9,6 @@ import {terser} from 'rollup-plugin-terser';
|
|
|
6
9
|
import babel from '@rollup/plugin-babel';
|
|
7
10
|
import css from 'rollup-plugin-css-only';
|
|
8
11
|
import wyw from '@wyw-in-js/rollup';
|
|
9
|
-
import {createRequire} from 'module';
|
|
10
12
|
|
|
11
13
|
const require = createRequire(import.meta.url);
|
|
12
14
|
const {
|
|
@@ -21,20 +23,35 @@ const external = [
|
|
|
21
23
|
...Object.keys(devDependencies),
|
|
22
24
|
];
|
|
23
25
|
|
|
26
|
+
// Function to copy tokens.css to dist
|
|
27
|
+
function copyCss(names) {
|
|
28
|
+
return {
|
|
29
|
+
name: `copy-${names.join('-')}-css`,
|
|
30
|
+
writeBundle() {
|
|
31
|
+
names.forEach(name => {
|
|
32
|
+
const css = fs.readFileSync(`src/styles/${name}.css`, 'utf8');
|
|
33
|
+
fs.mkdirSync('dist', { recursive: true });
|
|
34
|
+
fs.writeFileSync(`dist/${name}.css`, css);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
24
40
|
export default [
|
|
25
41
|
{
|
|
26
|
-
input:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
format: 'esm',
|
|
30
|
-
sourcemap: true,
|
|
42
|
+
input: {
|
|
43
|
+
index: 'index.ts',
|
|
44
|
+
xydPlugin: 'packages/xyd-plugin/index.ts',
|
|
31
45
|
},
|
|
46
|
+
output: [
|
|
47
|
+
{
|
|
48
|
+
dir: 'dist',
|
|
49
|
+
format: 'esm',
|
|
50
|
+
sourcemap: true,
|
|
51
|
+
entryFileNames: '[name].js'
|
|
52
|
+
}
|
|
53
|
+
],
|
|
32
54
|
plugins: [
|
|
33
|
-
// alias({ TODO: finish?
|
|
34
|
-
// entries: [
|
|
35
|
-
// {find: '@', replacement: resolve(__dirname, 'src')}
|
|
36
|
-
// ]
|
|
37
|
-
// }),
|
|
38
55
|
wyw({
|
|
39
56
|
include: ['**/*.{ts,tsx}'],
|
|
40
57
|
babelOptions: {
|
|
@@ -43,10 +60,28 @@ export default [
|
|
|
43
60
|
'@babel/preset-react'
|
|
44
61
|
],
|
|
45
62
|
},
|
|
63
|
+
// classNameSlug: (hash, title, {file}) => {
|
|
64
|
+
// // Get the full path after 'src/components/'
|
|
65
|
+
// const pathParts = file.split('/');
|
|
66
|
+
// const componentsIndex = pathParts.indexOf('components');
|
|
67
|
+
// if (componentsIndex === -1) return `XydAtlas-Component-${title}`;
|
|
68
|
+
|
|
69
|
+
// // Get everything after 'components' directory
|
|
70
|
+
// const componentPath = pathParts
|
|
71
|
+
// .slice(componentsIndex + 1)
|
|
72
|
+
// .filter(part => !part.endsWith('.styles.tsx')) // Remove styles.tsx
|
|
73
|
+
// .join('-');
|
|
74
|
+
|
|
75
|
+
// // Use the title as the style name (it's already the variable name)
|
|
76
|
+
// const styleName = title.replace(/^\$/, ''); // Remove $ prefix if present
|
|
77
|
+
|
|
78
|
+
// return `XydAtlas-Component-${componentPath}__${styleName}`;
|
|
79
|
+
// }
|
|
46
80
|
}),
|
|
47
81
|
css({
|
|
48
82
|
output: 'index.css',
|
|
49
83
|
}),
|
|
84
|
+
copyCss(['tokens', 'styles']),
|
|
50
85
|
resolve(),
|
|
51
86
|
commonjs(),
|
|
52
87
|
typescript({
|
|
@@ -67,10 +102,19 @@ export default [
|
|
|
67
102
|
{
|
|
68
103
|
input: 'index.ts',
|
|
69
104
|
output: {
|
|
70
|
-
|
|
105
|
+
file: 'dist/index.d.ts',
|
|
71
106
|
format: 'es',
|
|
72
107
|
},
|
|
73
108
|
plugins: [dts()],
|
|
74
109
|
external
|
|
75
110
|
},
|
|
111
|
+
{
|
|
112
|
+
input: 'packages/xyd-plugin/index.ts',
|
|
113
|
+
output: {
|
|
114
|
+
file: 'dist/xydPlugin.d.ts',
|
|
115
|
+
format: 'es',
|
|
116
|
+
},
|
|
117
|
+
plugins: [dts()],
|
|
118
|
+
external
|
|
119
|
+
}
|
|
76
120
|
];
|
|
@@ -1,70 +1,102 @@
|
|
|
1
|
-
import {css} from "@linaria/core";
|
|
2
|
-
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
import { css } from "@linaria/core";
|
|
2
|
+
|
|
3
|
+
export const ApiRefItemTitleHost = css`
|
|
4
|
+
font-weight: var(--xyd-font-weight-normal);
|
|
5
|
+
`;
|
|
6
|
+
|
|
7
|
+
export const ApiRefItemTitleLink = css`
|
|
8
|
+
`;
|
|
9
|
+
|
|
10
|
+
export const ApiRefItemNavbarHost = css`
|
|
11
|
+
margin: 20px 0px;
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export const ApiRefItemNavbarContainer = css`
|
|
15
|
+
background: linear-gradient(45deg, var(--XydAtlas-Component-ApiRef-Item__background-navbar) 0%, var(--XydAtlas-Component-ApiRef-Item__background-navbar) 100%);
|
|
16
|
+
padding: 8px;
|
|
17
|
+
border: 1px solid var(--XydAtlas-Component-ApiRef-Item__color-border);
|
|
18
|
+
border-radius: 8px;
|
|
19
|
+
display: flex;
|
|
20
|
+
gap: 4px;
|
|
21
|
+
overflow: scroll;
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
export const ApiRefItemNavbarLabel = css`
|
|
25
|
+
color: var(--XydAtlas-Component-ApiRef-Item__color-navbar);
|
|
26
|
+
margin-right: 4px;
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
export const ApiRefItemNavbarSubtitle = css`
|
|
30
|
+
display: flex;
|
|
31
|
+
letter-spacing: 1px;
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
text-overflow: ellipsis;
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
export const ApiRefItemHost = css`
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
gap: 16px;
|
|
40
|
+
padding-bottom: 25px;
|
|
41
|
+
|
|
42
|
+
&[data-has-examples="true"] {
|
|
43
|
+
atlas-apiref-item-showcase {
|
|
44
|
+
display: grid;
|
|
45
|
+
gap: 100px;
|
|
46
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
47
|
+
|
|
48
|
+
@media (max-width: 767px) {
|
|
49
|
+
grid-template-columns: 1fr;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
|
|
55
|
+
export const ApiRefItemGrid = css`
|
|
56
|
+
align-items: normal;
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
export const ApiRefItemDefinitionsHost = css`
|
|
60
|
+
`;
|
|
61
|
+
|
|
62
|
+
export const ApiRefItemDefinitionsItem = css`
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
gap: 25px;
|
|
66
|
+
margin-bottom: 25px;
|
|
67
|
+
|
|
68
|
+
margin-top: var(--space-xxlarge);
|
|
69
|
+
|
|
70
|
+
[part="controls"] {
|
|
34
71
|
display: flex;
|
|
35
|
-
|
|
72
|
+
align-items: center;
|
|
36
73
|
gap: 16px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
> [part="header"] {
|
|
77
|
+
h2, h3, h4, h5, h6 {
|
|
78
|
+
margin: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
border-bottom: 1px solid var(--XydAtlas-Component-ApiRef-Item__color-border);
|
|
37
82
|
|
|
38
|
-
padding-bottom: 25px;
|
|
39
|
-
`,
|
|
40
|
-
grid: css`
|
|
41
83
|
display: grid;
|
|
42
|
-
grid-template-columns:
|
|
43
|
-
align-items:
|
|
44
|
-
gap:
|
|
45
|
-
`,
|
|
46
|
-
}
|
|
84
|
+
grid-template-columns: 1fr auto;
|
|
85
|
+
align-items: center;
|
|
86
|
+
gap: 16px;
|
|
47
87
|
|
|
48
|
-
|
|
49
|
-
|
|
88
|
+
> :first-child {
|
|
89
|
+
justify-self: start;
|
|
90
|
+
}
|
|
50
91
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
margin-bottom: 25px;
|
|
58
|
-
`,
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export const $subtitle = {
|
|
62
|
-
host: css`
|
|
63
|
-
font-size: 15px;
|
|
64
|
-
font-weight: 600;
|
|
65
|
-
`,
|
|
66
|
-
link: css`
|
|
67
|
-
text-decoration: none;
|
|
68
|
-
`,
|
|
69
|
-
}
|
|
92
|
+
> :not(:first-child) {
|
|
93
|
+
justify-self: end;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
`;
|
|
70
97
|
|
|
98
|
+
export const DefinitionBody = css`
|
|
99
|
+
display: flex;
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
gap: 15px;
|
|
102
|
+
`
|