@xyd-js/atlas 0.1.0-xyd.15 → 0.1.0-xyd.18
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 -2
- package/.storybook/preview.ts +1 -2
- package/CHANGELOG.md +31 -0
- package/dist/Update-BlhP2VFR-COLbZvRj.js +4 -0
- package/dist/Update-BlhP2VFR-COLbZvRj.js.map +1 -0
- package/dist/Update-CMM38Snc-COLbZvRj.js +4 -0
- package/dist/Update-CMM38Snc-COLbZvRj.js.map +1 -0
- package/dist/Update-D5e_yqty-COLbZvRj.js +4 -0
- package/dist/Update-D5e_yqty-COLbZvRj.js.map +1 -0
- package/dist/index.css +47 -58
- 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 +5 -2
- package/dist/xydPlugin.d.ts +5 -0
- package/dist/xydPlugin.js +2 -0
- package/dist/xydPlugin.js.map +1 -0
- package/index.ts +2 -1
- package/package.json +13 -9
- package/packages/xyd-plugin/SidebarItem.tsx +27 -0
- package/packages/xyd-plugin/index.ts +19 -0
- package/rollup.config.js +27 -25
- package/src/components/ApiRef/ApiRefItem/ApiRefItem.styles.tsx +60 -17
- package/src/components/ApiRef/ApiRefItem/ApiRefItem.tsx +508 -49
- package/src/components/ApiRef/ApiRefProperties/ApiRefProperties.styles.tsx +73 -16
- package/src/components/ApiRef/ApiRefProperties/ApiRefProperties.tsx +574 -56
- package/src/components/ApiRef/ApiRefSamples/ApiRefSamples.styles.tsx +2 -1
- package/src/components/ApiRef/ApiRefSamples/ApiRefSamples.tsx +37 -19
- package/src/components/Atlas/Atlas.styles.tsx +1 -1
- package/src/components/Atlas/Atlas.tsx +35 -19
- 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.tsx +2 -2
- 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 +4 -5
- package/src/components/Code/CodeSampleButtons/CodeSampleButtons.tsx +6 -8
- 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 +5 -2
- package/src/utils/mdx.ts +0 -29
- package/tsconfig.json +6 -2
- package/types.d.ts +22 -0
- package/dist/CodeSample-B9VUhTKF-DJ2leksk.js +0 -2
- package/dist/CodeSample-B9VUhTKF-DJ2leksk.js.map +0 -1
- package/dist/CodeSample-BSXeFy0x-DJ2leksk.js +0 -2
- package/dist/CodeSample-BSXeFy0x-DJ2leksk.js.map +0 -1
- package/dist/CodeSample-BwP208sQ-DJ2leksk.js +0 -2
- package/dist/CodeSample-BwP208sQ-DJ2leksk.js.map +0 -1
- package/dist/CodeSample-CK-CQYrV-DJ2leksk.js +0 -2
- package/dist/CodeSample-CK-CQYrV-DJ2leksk.js.map +0 -1
- package/dist/CodeSample-CUemtj_W-DJ2leksk.js +0 -2
- package/dist/CodeSample-CUemtj_W-DJ2leksk.js.map +0 -1
- package/dist/CodeSample-D0iKih-A-DJ2leksk.js +0 -2
- package/dist/CodeSample-D0iKih-A-DJ2leksk.js.map +0 -1
- package/dist/CodeSample-D33vTa6M-DJ2leksk.js +0 -2
- package/dist/CodeSample-D33vTa6M-DJ2leksk.js.map +0 -1
- package/dist/CodeSample-DUSx2KBt-DJ2leksk.js +0 -2
- package/dist/CodeSample-DUSx2KBt-DJ2leksk.js.map +0 -1
- package/dist/CodeSample-P4yxkHPW-DJ2leksk.js +0 -2
- package/dist/CodeSample-P4yxkHPW-DJ2leksk.js.map +0 -1
- package/dist/atlas-index.d.ts +0 -15
- package/dist/atlas-index.js +0 -2
- package/dist/atlas-index.js.map +0 -1
- package/packages/atlas-index/AtlasIndex.tsx +0 -79
- package/packages/atlas-index/index.ts +0 -3
- package/src/components/Code/CodeCopy/CodeCopy.styles.tsx +0 -17
- package/src/components/Code/CodeCopy/CodeCopy.tsx +0 -30
- package/src/components/Code/CodeCopy/index.ts +0 -7
- package/src/components/Code/CodeSample/CodeSample.styles.tsx +0 -131
- package/src/components/Code/CodeSample/CodeSample.tsx +0 -143
- 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
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
/* Ref tokens - Base values */
|
|
3
|
+
--XydAtlas-Ref-Palette-White: #FFFFFF;
|
|
4
|
+
|
|
3
5
|
--XydAtlas-Ref-Palette-Primary-60: #7051d4;
|
|
4
6
|
--XydAtlas-Ref-Palette-Primary-70: #6045b9;
|
|
5
7
|
--XydAtlas-Ref-Palette-Primary-80: #4f399e;
|
|
@@ -40,6 +42,7 @@
|
|
|
40
42
|
/* ApiRef Item */
|
|
41
43
|
--XydAtlas-Component-ApiRef-Item__color-border: var(--XydAtlas-Sys-Color-Border);
|
|
42
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);
|
|
43
46
|
|
|
44
47
|
/* Code Sample */
|
|
45
48
|
--XydAtlas-Component-Code-Sample__color-border: var(--XydAtlas-Sys-Color-Border);
|
|
@@ -51,7 +54,7 @@
|
|
|
51
54
|
|
|
52
55
|
/* Code Sample Buttons */
|
|
53
56
|
--XydAtlas-Component-Code-SampleButtons__color-containerBackground: var(--XydAtlas-Sys-Color-Surface);
|
|
54
|
-
--XydAtlas-Component-Code-SampleButtons__color-background--active: var(--XydAtlas-
|
|
55
|
-
--XydAtlas-Component-Code-SampleButtons__color: var(--XydAtlas-
|
|
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);
|
|
56
59
|
--XydAtlas-Component-Code-SampleButtons__color--active: var(--XydAtlas-Sys-Color-Text-Primary);
|
|
57
60
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e from"react";import"radix-ui";import{a as t,c as r}from"./Update-D5e_yqty-COLbZvRj.js";import"lucide-react";"function"==typeof SuppressedError&&SuppressedError;var i=function(e){return e.NavRight="nav.right",e.SidebarTop="sidebar.top",e.PageFooterBottom="page.footer.bottom",e.SidebarItemLeft="sidebar.item.left",e.SidebarItemRight="sidebar.item.right",e}(i||{});function a(i){var a,o=(null===(a=null==i?void 0:i.pageMeta)||void 0===a?void 0:a.openapi)||"",n=o.includes("#")?o.split("#"):["",o],d=t(n,2);d[0];var s=d[1],u=(void 0===s?"":s).split(" "),p=t(u,1)[0],l=void 0===p?"":p;if(!l)return null;if(l.includes("components/schemas"))return null;var m=l.toUpperCase();return"DELETE"===l&&(m="DEL"),e.createElement("div",{"data-active":(null==i?void 0:i.active)?"true":void 0,"atlas-oas-method":l},e.createElement(r,{size:"xs"},m))}function o(){return function(e){return{name:"atlas-xyd-plugin",customComponents:{AtlasSidebarItemRight:{component:a,surface:i.SidebarItemRight}}}}}export{o as default};
|
|
2
|
+
//# sourceMappingURL=xydPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xydPlugin.js","sources":["../../xyd-ui/dist/index.js","../packages/xyd-plugin/SidebarItem.tsx","../packages/xyd-plugin/index.ts"],"sourcesContent":["import e,{useRef as t,useEffect as r,useState as n,useCallback as a,createContext as c,useContext as i}from\"react\";import{Tabs as l}from\"radix-ui\";import{Link as o}from\"react-router\";function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function s(e){if(Array.isArray(e))return e}function f(){throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}function d(e,t){return s(e)||function(e,t){var r=null==e?null:\"undefined\"!=typeof Symbol&&e[Symbol.iterator]||e[\"@@iterator\"];if(null!=r){var n,a,c,i,l=[],o=!0,u=!1;try{if(c=(r=r.call(e)).next,0===t);else for(;!(o=(n=c.call(r)).done)&&(l.push(n.value),l.length!==t);o=!0);}catch(e){u=!0,a=e}finally{try{if(!o&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||h(e,t)||f()}function m(e){return s(e)||function(e){if(\"undefined\"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e[\"@@iterator\"])return Array.from(e)}(e)||h(e)||f()}function h(e,t){if(e){if(\"string\"==typeof e)return u(e,t);var r={}.toString.call(e).slice(8,-1);return\"Object\"===r&&e.constructor&&(r=e.constructor.name),\"Map\"===r||\"Set\"===r?Array.from(e):\"Arguments\"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}function v(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&\"function\"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}\"function\"==typeof SuppressedError&&SuppressedError;function p(t){var r=t.children,n=t.value,a=t.onChange,c=t.logo,i=t.kind,o=t.className,u=t.rightSurface;return e.createElement(l.Root,{asChild:!0,value:n,onValueChange:a},e.createElement(\"xyd-nav\",{className:\"\".concat(\"n1vu90xp\",\" \").concat(o||\"\"),\"data-kind\":i},e.createElement(\"div\",{part:\"shadow\"}),e.createElement(\"nav\",{part:\"nav\"},e.createElement(\"div\",{part:\"logo\"},c),e.createElement(l.List,{asChild:!0},e.createElement(\"div\",{part:\"list\"},r)),(\"middle\"===i||u)&&e.createElement(\"div\",{part:\"right\"},u))))}function y(t){var r=t.children,n=v(t,[\"children\"]);return e.createElement(\"a\",Object.assign({},n),r)}p.Tab=function(t){var r=t.children,n=t.value,a=t.onChange;return e.createElement(l.Root,{asChild:!0,value:n,onValueChange:a},e.createElement(l.List,null,r))},p.Item=function(t){var r=t.children,n=t.value,a=t.href,c=t.as||y;return e.createElement(l.Trigger,{asChild:!0,value:n},e.createElement(\"xyd-nav-item\",{className:\"i1i2i14o\"},e.createElement(c,{href:a},e.createElement(\"span\",{part:\"title1\"},r),e.createElement(\"span\",{part:\"title2\"},r))))};function g(t){var r=t.className,n=t.isActive,a=void 0!==n&&n;return e.createElement(\"xyd-progressbar\",{\"data-active\":String(a),role:\"progressbar\",\"aria-hidden\":\"true\",\"aria-label\":\"loading bar\",className:\"\".concat(\"p1jzdbj3\",\" \").concat(r||\"\")},e.createElement(\"div\",{part:\"item\"}))}function E(n){var a=n.children,c=n.isOpen,i=n.horizontal,l=void 0!==i&&i,o=n.className,u=t(null),s=t(null),f=t(null),d=t(c),m=t(!0),h=t(null),v=function(){var e=u.current,t=s.current;if(e&&t){var r=t.querySelectorAll('[class*=\"collapse\"]'),n=[];if(r.forEach(function(e){e instanceof HTMLElement&&(n.push({element:e,height:e.style.height,overflow:e.style.overflow}),e.style.height=\"auto\",e.style.overflow=\"visible\")}),l){var a=t.scrollWidth;e.style.width=\"\".concat(a,\"px\"),t.style.width=\"\".concat(a,\"px\")}else{var c=t.scrollHeight;e.style.height=\"\".concat(c,\"px\"),t.style.height=\"\".concat(c,\"px\")}n.forEach(function(e){var t=e.element,r=e.height,n=e.overflow;t.style.height=r,t.style.overflow=n})}};return r(function(){var e=u.current,t=s.current;if(f.current&&clearTimeout(f.current),!m.current&&e&&t){if(h.current&&h.current.disconnect(),c)v(),h.current=new MutationObserver(function(e){e.some(function(e){var t;return\"childList\"===e.type||\"attributes\"===e.type||\"characterData\"===e.type&&(null===(t=e.target.parentElement)||void 0===t?void 0:t.closest('[class*=\"collapse\"]'))})&&v()}),h.current.observe(t,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),f.current=window.setTimeout(function(){e.style.removeProperty(l?\"width\":\"height\"),t.style.removeProperty(l?\"width\":\"height\"),h.current&&h.current.disconnect()},300);else if(l){var r=e.scrollWidth;e.style.width=\"\".concat(r,\"px\"),e.offsetWidth,e.style.width=\"0px\"}else{var n=e.scrollHeight;e.style.height=\"\".concat(n,\"px\"),e.offsetHeight,e.style.height=\"0px\"}return function(){h.current&&h.current.disconnect(),f.current&&clearTimeout(f.current)}}},[l,c]),r(function(){m.current=!1},[]),e.createElement(\"xyd-collapse\",{\"data-open\":String(c),className:\"\".concat(\"c12fwmxc\",\" \").concat(o||\"\"),ref:u,style:d.current||l?void 0:{height:0}},e.createElement(\"div\",{part:\"child\",ref:s},a))}function b(n){var a=n.children,c=n.footerItems,i=n.className,l=t(null);return r(function(){if(l.current){var e=l.current.querySelector('[data-active=\"true\"]');if(e){var t=l.current.clientHeight,r=e.getBoundingClientRect().top,n=e.clientHeight,a=l.current.scrollTop+r-t/2+n/2;l.current.scrollTo({top:a,behavior:\"auto\"})}}},[]),e.createElement(\"xyd-sidebar\",{className:\"\".concat(\"sptag3l\",\" \").concat(i||\"\")},e.createElement(\"ul\",{part:\"list\",ref:l},a),c&&e.createElement(\"div\",{part:\"footer\"},e.createElement(\"ul\",null,c)))}function w(t){var r=t.children,n=v(t,[\"children\"]);return e.createElement(\"a\",Object.assign({},n),r)}b.Item=function(t){var r=t.children,n=t.button,a=t.href,c=t.active,i=t.activeTheme,l=t.isParentActive,u=t.anchor,s=t.icon,f=t.onClick,d=m(e.Children.toArray(r)),h=d[0],v=d.slice(1),p=n?\"button\":o,y=(null==a?void 0:a.endsWith(\"/\"))?a.slice(0,-1):a;return e.createElement(\"li\",{part:\"item\",className:\"iead4fo\",\"data-theme\":i,\"data-anchor\":u?String(u):void 0},e.createElement(p,{part:\"item-\".concat(n?\"button\":\"link\"),href:n?void 0:y,to:y,onClick:f},e.createElement(\"div\",{part:\"first-item\",\"data-parent-active\":l,\"data-active\":c,\"data-anchor\":u?String(u):void 0},e.createElement(e.Fragment,null,s,h))),v)},b.ItemHeader=function(t){var r=t.children,n=t.icon;return e.createElement(\"li\",{part:\"item-header\",className:\"i1btwdcv\"},n,r)},b.SubTree=function(t){var r=t.children,n=t.isOpen;return e.createElement(\"ul\",{part:\"subtree\",className:\"t1hrlfak\"},e.createElement(E,{isOpen:n||!1},r))},b.FooterItem=function(t){var r=t.children,n=t.href,a=t.icon,c=t.as||w;return e.createElement(\"li\",{part:\"footer-item\",className:\"f1801o7t\"},e.createElement(c,{part:\"footer-link\",href:n},a,r))};function x(t){var r=t.children,n=t.title,a=t.value,c=t.onChange,i=t.className;return e.createElement(l.Root,{asChild:!0,value:a,onValueChange:c},e.createElement(\"xyd-subnav\",{className:\"\".concat(\"s4ah3ok\",\" \").concat(i||\"\")},e.createElement(\"div\",{part:\"prefix\"},n),e.createElement(l.List,{asChild:!0},e.createElement(\"ul\",{part:\"list\"},r))))}function S(t){var r=t.children,n=v(t,[\"children\"]);return e.createElement(\"a\",Object.assign({},n),r)}x.Item=function(t){var r=t.children,n=t.value,a=t.href,c=t.as||S;return e.createElement(l.Trigger,{asChild:!0,value:n},e.createElement(\"xyd-subnav-item\",null,e.createElement(\"li\",{className:\"s1ncaln9\"},e.createElement(c,{part:\"link\",href:a},r))))};var C=c({value:\"\",onChange:function(){},registerActiveItem:function(){},unregisterActiveItem:function(){}});function A(c){var i=c.children,l=c.defaultValue,o=c.className,u=c.maxDepth,s=void 0===u?2:u,f=d(n(0),2),m=f[0],v=f[1],p=d(n(0),2),y=p[0],g=p[1],E=d(n(l||\"\"),2),b=E[0],w=E[1],x=t(new Map),S=t([]),A=t(!1),I=a(function(e,t){x.current.set(t,e)},[]),N=a(function(e){x.current.delete(e)},[]),O=a(function(e){w(e),A.current=!0},[]);function k(){var e=Array.from({length:s},function(e,t){return\"h\".concat(t+2)}).join(\",\");S.current=Array.from(document.querySelectorAll(e)).map(function(e){return e.id})}return r(function(){return k(),!l&&S.current.length&&w(S.current[0]),window.addEventListener(\"resize\",k),function(){return window.removeEventListener(\"resize\",k)}},[l]),r(function(){var e=window;function t(){if(A.current)A.current=!1;else{var t,r=e instanceof Window?window.pageYOffset:e.scrollTop,n=e instanceof Window?window.innerHeight:e.clientHeight,a=.2*n,c=S.current[0]||\"\",i=function(e,t){var r=\"undefined\"!=typeof Symbol&&e[Symbol.iterator]||e[\"@@iterator\"];if(!r){if(Array.isArray(e)||(r=h(e))||t){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}var c,i=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){l=!0,c=e},f:function(){try{i||null==r.return||r.return()}finally{if(l)throw c}}}}(S.current);try{for(i.s();!(t=i.n()).done;){var l=t.value,o=document.getElementById(l);if(o){if(!(o.getBoundingClientRect().top<=a))break;c=l}}}catch(e){i.e(e)}finally{i.f()}var u=e instanceof Window?document.documentElement.scrollHeight:e.scrollHeight;u>n&&r+n>=u-1&&(c=S.current[S.current.length-1]||c),c!==b&&w(c)}}return e.addEventListener(\"scroll\",t),t(),function(){return e.removeEventListener(\"scroll\",t)}},[b]),r(function(){var e;(null==(e=x.current.get(b))?void 0:e.current)&&(v(e.current.offsetHeight),g(e.current.offsetTop))},[b]),e.createElement(C.Provider,{value:{value:b,onChange:O,registerActiveItem:I,unregisterActiveItem:N}},e.createElement(\"xyd-toc\",{className:\"\".concat(\"t19g75q2\",\" \").concat(o||\"\")},e.createElement(\"div\",{part:\"scroller\"},e.createElement(\"div\",{part:\"scroll\",style:{\"--xyd-toc-active-track-height\":\"\".concat(m,\"px\"),\"--xyd-toc-active-track-top\":\"\".concat(y,\"px\")}})),e.createElement(\"ul\",{part:\"list\"},i)))}A.Item=function(n){var a=n.children,c=n.id,l=n.className,u=n.depth,s=i(C),f=s.value,d=s.onChange,m=s.registerActiveItem,h=s.unregisterActiveItem,v=t(null),p=f===c;return r(function(){return p&&v.current&&m(v,c),function(){return h(c)}},[p,c,m,h]),e.createElement(\"xyd-toc-item\",null,e.createElement(\"li\",{ref:v,className:\"\".concat(\"teg7kxf\",\" \").concat(l||\"\"),\"data-active\":String(p),\"data-depth\":u},e.createElement(o,{part:\"link\",to:\"\",onClick:function(e){var t;e.preventDefault(),d(c);var r=new URL(window.location.href);r.hash=c,history.replaceState(null,\"\",r.toString()),null===(t=document.getElementById(c))||void 0===t||t.scrollIntoView()}},a)))};export{p as Nav,g as ProgressBar,x as SubNav,A as Toc,b as UISidebar};\n//# sourceMappingURL=index.js.map\n","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/react\"\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}"],"names":["SuppressedError","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":"oHAwUkD,mBAApBA,iBAAiCA,2NCpUzD,SAAUC,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
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from "./src/components/Atlas"
|
|
1
|
+
export * from "./src/components/Atlas"
|
|
2
|
+
|
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.18",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,21 +12,26 @@
|
|
|
12
12
|
".": {
|
|
13
13
|
"import": "./dist/index.js"
|
|
14
14
|
},
|
|
15
|
-
"./
|
|
16
|
-
"import": "./dist/
|
|
15
|
+
"./xydPlugin": {
|
|
16
|
+
"import": "./dist/xydPlugin.js"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@code-hike/lighter": "^1.0.
|
|
21
|
-
"
|
|
20
|
+
"@code-hike/lighter": "^1.0.3",
|
|
21
|
+
"radix-ui": "^1.4.2",
|
|
22
22
|
"codehike": "^1.0.2",
|
|
23
23
|
"lucide-react": "^0.447.0",
|
|
24
|
-
"@xyd-js/
|
|
24
|
+
"@xyd-js/components": "0.1.0-xyd.13",
|
|
25
|
+
"@xyd-js/uniform": "0.1.0-xyd.17"
|
|
25
26
|
},
|
|
26
27
|
"peerDependencies": {
|
|
27
|
-
"react": "^19.0.0"
|
|
28
|
+
"react": "^19.0.0",
|
|
29
|
+
"@xyd-js/framework": "0.1.0-xyd.34",
|
|
30
|
+
"@xyd-js/plugins": "0.1.0-xyd.2"
|
|
28
31
|
},
|
|
29
32
|
"devDependencies": {
|
|
33
|
+
"@types/react": "^19.0.0",
|
|
34
|
+
"@types/react-dom": "^19.0.0",
|
|
30
35
|
"@linaria/atomic": "^6.2.0",
|
|
31
36
|
"@linaria/core": "^6.2.0",
|
|
32
37
|
"@babel/preset-typescript": "^7.26.0",
|
|
@@ -59,8 +64,7 @@
|
|
|
59
64
|
"tsup": "^8.3.0",
|
|
60
65
|
"rimraf": "^3.0.2",
|
|
61
66
|
"prop-types": "^15.8.1",
|
|
62
|
-
"storybook": "^8.4.5"
|
|
63
|
-
"@xyd-js/gql": "0.1.0-xyd.12"
|
|
67
|
+
"storybook": "^8.4.5"
|
|
64
68
|
},
|
|
65
69
|
"scripts": {
|
|
66
70
|
"clean": "rimraf build",
|
|
@@ -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,19 @@
|
|
|
1
|
+
import { Settings } from "@xyd-js/core"
|
|
2
|
+
import { Plugin } from "@xyd-js/plugins"
|
|
3
|
+
import { SurfaceTarget } from "@xyd-js/framework/react"
|
|
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
|
+
}
|
package/rollup.config.js
CHANGED
|
@@ -24,13 +24,15 @@ const external = [
|
|
|
24
24
|
];
|
|
25
25
|
|
|
26
26
|
// Function to copy tokens.css to dist
|
|
27
|
-
function
|
|
27
|
+
function copyCss(names) {
|
|
28
28
|
return {
|
|
29
|
-
name: '
|
|
29
|
+
name: `copy-${names.join('-')}-css`,
|
|
30
30
|
writeBundle() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
+
});
|
|
34
36
|
}
|
|
35
37
|
};
|
|
36
38
|
}
|
|
@@ -39,7 +41,7 @@ export default [
|
|
|
39
41
|
{
|
|
40
42
|
input: {
|
|
41
43
|
index: 'index.ts',
|
|
42
|
-
|
|
44
|
+
xydPlugin: 'packages/xyd-plugin/index.ts',
|
|
43
45
|
},
|
|
44
46
|
output: [
|
|
45
47
|
{
|
|
@@ -58,28 +60,28 @@ export default [
|
|
|
58
60
|
'@babel/preset-react'
|
|
59
61
|
],
|
|
60
62
|
},
|
|
61
|
-
classNameSlug: (hash, title, {file}) => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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}`;
|
|
66
68
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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('-');
|
|
72
74
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
// // Use the title as the style name (it's already the variable name)
|
|
76
|
+
// const styleName = title.replace(/^\$/, ''); // Remove $ prefix if present
|
|
75
77
|
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
+
// return `XydAtlas-Component-${componentPath}__${styleName}`;
|
|
79
|
+
// }
|
|
78
80
|
}),
|
|
79
81
|
css({
|
|
80
82
|
output: 'index.css',
|
|
81
83
|
}),
|
|
82
|
-
|
|
84
|
+
copyCss(['tokens', 'styles']),
|
|
83
85
|
resolve(),
|
|
84
86
|
commonjs(),
|
|
85
87
|
typescript({
|
|
@@ -100,19 +102,19 @@ export default [
|
|
|
100
102
|
{
|
|
101
103
|
input: 'index.ts',
|
|
102
104
|
output: {
|
|
103
|
-
|
|
105
|
+
file: 'dist/index.d.ts',
|
|
104
106
|
format: 'es',
|
|
105
107
|
},
|
|
106
108
|
plugins: [dts()],
|
|
107
109
|
external
|
|
108
110
|
},
|
|
109
111
|
{
|
|
110
|
-
input: 'packages/
|
|
112
|
+
input: 'packages/xyd-plugin/index.ts',
|
|
111
113
|
output: {
|
|
112
|
-
file: 'dist/
|
|
114
|
+
file: 'dist/xydPlugin.d.ts',
|
|
113
115
|
format: 'es',
|
|
114
116
|
},
|
|
115
117
|
plugins: [dts()],
|
|
116
118
|
external
|
|
117
|
-
}
|
|
119
|
+
}
|
|
118
120
|
];
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import {css} from "@linaria/core";
|
|
1
|
+
import { css } from "@linaria/core";
|
|
2
2
|
|
|
3
3
|
export const ApiRefItemTitleHost = css`
|
|
4
|
-
font-
|
|
5
|
-
font-weight: 400;
|
|
4
|
+
font-weight: var(--xyd-font-weight-normal);
|
|
6
5
|
`;
|
|
7
6
|
|
|
8
7
|
export const ApiRefItemTitleLink = css`
|
|
9
8
|
`;
|
|
10
9
|
|
|
11
10
|
export const ApiRefItemNavbarHost = css`
|
|
11
|
+
margin: 20px 0px;
|
|
12
12
|
`;
|
|
13
13
|
|
|
14
14
|
export const ApiRefItemNavbarContainer = css`
|
|
15
|
-
background: linear-gradient(45deg,
|
|
15
|
+
background: linear-gradient(45deg, var(--XydAtlas-Component-ApiRef-Item__background-navbar) 0%, var(--XydAtlas-Component-ApiRef-Item__background-navbar) 100%);
|
|
16
16
|
padding: 8px;
|
|
17
17
|
border: 1px solid var(--XydAtlas-Component-ApiRef-Item__color-border);
|
|
18
18
|
border-radius: 8px;
|
|
19
|
-
|
|
19
|
+
display: flex;
|
|
20
|
+
gap: 4px;
|
|
21
|
+
overflow: scroll;
|
|
20
22
|
`;
|
|
21
23
|
|
|
22
24
|
export const ApiRefItemNavbarLabel = css`
|
|
@@ -24,36 +26,77 @@ export const ApiRefItemNavbarLabel = css`
|
|
|
24
26
|
margin-right: 4px;
|
|
25
27
|
`;
|
|
26
28
|
|
|
29
|
+
export const ApiRefItemNavbarSubtitle = css`
|
|
30
|
+
display: flex;
|
|
31
|
+
letter-spacing: 1px;
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
text-overflow: ellipsis;
|
|
34
|
+
`;
|
|
35
|
+
|
|
27
36
|
export const ApiRefItemHost = css`
|
|
28
37
|
display: flex;
|
|
29
38
|
flex-direction: column;
|
|
30
39
|
gap: 16px;
|
|
31
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
|
+
}
|
|
32
53
|
`;
|
|
33
54
|
|
|
34
55
|
export const ApiRefItemGrid = css`
|
|
35
|
-
display: grid;
|
|
36
|
-
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
37
56
|
align-items: normal;
|
|
38
|
-
gap: 100px;
|
|
39
57
|
`;
|
|
40
58
|
|
|
41
|
-
export const
|
|
59
|
+
export const ApiRefItemDefinitionsHost = css`
|
|
42
60
|
`;
|
|
43
61
|
|
|
44
|
-
export const
|
|
62
|
+
export const ApiRefItemDefinitionsItem = css`
|
|
45
63
|
display: flex;
|
|
46
64
|
flex-direction: column;
|
|
47
65
|
gap: 25px;
|
|
48
66
|
margin-bottom: 25px;
|
|
49
|
-
`;
|
|
50
67
|
|
|
51
|
-
|
|
52
|
-
font-size: 15px;
|
|
53
|
-
font-weight: 600;
|
|
54
|
-
`;
|
|
68
|
+
margin-top: var(--space-xxlarge);
|
|
55
69
|
|
|
56
|
-
|
|
57
|
-
|
|
70
|
+
[part="controls"] {
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
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);
|
|
82
|
+
|
|
83
|
+
display: grid;
|
|
84
|
+
grid-template-columns: 1fr auto;
|
|
85
|
+
align-items: center;
|
|
86
|
+
gap: 16px;
|
|
87
|
+
|
|
88
|
+
> :first-child {
|
|
89
|
+
justify-self: start;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
> :not(:first-child) {
|
|
93
|
+
justify-self: end;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
58
96
|
`;
|
|
59
97
|
|
|
98
|
+
export const DefinitionBody = css`
|
|
99
|
+
display: flex;
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
gap: 15px;
|
|
102
|
+
`
|