@xyd-js/atlas 0.1.0-xyd.4 → 0.1.0-xyd.57

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.
Files changed (87) hide show
  1. package/.storybook/index.css +1 -27
  2. package/.storybook/preview.ts +1 -2
  3. package/CHANGELOG.md +554 -0
  4. package/LICENSE +21 -0
  5. package/dist/Update-48mkPPHi-COLbZvRj.js +4 -0
  6. package/dist/Update-48mkPPHi-COLbZvRj.js.map +1 -0
  7. package/dist/Update-6IvrCbUn-COLbZvRj.js +4 -0
  8. package/dist/Update-6IvrCbUn-COLbZvRj.js.map +1 -0
  9. package/dist/Update-B31SkKLO-COLbZvRj.js +4 -0
  10. package/dist/Update-B31SkKLO-COLbZvRj.js.map +1 -0
  11. package/dist/Update-BDC6jF5Q-COLbZvRj.js +4 -0
  12. package/dist/Update-BDC6jF5Q-COLbZvRj.js.map +1 -0
  13. package/dist/Update-BdhhXj2D-COLbZvRj.js +4 -0
  14. package/dist/Update-BdhhXj2D-COLbZvRj.js.map +1 -0
  15. package/dist/Update-BzuP6PUF-COLbZvRj.js +4 -0
  16. package/dist/Update-BzuP6PUF-COLbZvRj.js.map +1 -0
  17. package/dist/Update-C-w0Og8S-COLbZvRj.js +4 -0
  18. package/dist/Update-C-w0Og8S-COLbZvRj.js.map +1 -0
  19. package/dist/Update-CRZyUhwE-COLbZvRj.js +4 -0
  20. package/dist/Update-CRZyUhwE-COLbZvRj.js.map +1 -0
  21. package/dist/Update-Cmw6WVrs-COLbZvRj.js +4 -0
  22. package/dist/Update-Cmw6WVrs-COLbZvRj.js.map +1 -0
  23. package/dist/Update-D5pUmk9V-COLbZvRj.js +4 -0
  24. package/dist/Update-D5pUmk9V-COLbZvRj.js.map +1 -0
  25. package/dist/Update-D7tzid9y-COLbZvRj.js +4 -0
  26. package/dist/Update-D7tzid9y-COLbZvRj.js.map +1 -0
  27. package/dist/Update-DDQewhuu-COLbZvRj.js +4 -0
  28. package/dist/Update-DDQewhuu-COLbZvRj.js.map +1 -0
  29. package/dist/Update-DPeHa_01-COLbZvRj.js +4 -0
  30. package/dist/Update-DPeHa_01-COLbZvRj.js.map +1 -0
  31. package/dist/Update-DUFcLP3--COLbZvRj.js +4 -0
  32. package/dist/Update-DUFcLP3--COLbZvRj.js.map +1 -0
  33. package/dist/Update-DbvzJGdB-COLbZvRj.js +4 -0
  34. package/dist/Update-DbvzJGdB-COLbZvRj.js.map +1 -0
  35. package/dist/Update-SFXhorqS-COLbZvRj.js +4 -0
  36. package/dist/Update-SFXhorqS-COLbZvRj.js.map +1 -0
  37. package/dist/Update-b8FT7xsG-COLbZvRj.js +4 -0
  38. package/dist/Update-b8FT7xsG-COLbZvRj.js.map +1 -0
  39. package/dist/index.css +43 -53
  40. package/dist/index.d.ts +30 -10
  41. package/dist/index.js +2 -1
  42. package/dist/index.js.map +1 -0
  43. package/dist/styles.css +89 -0
  44. package/dist/tokens.css +60 -0
  45. package/dist/xydPlugin.d.ts +5 -0
  46. package/dist/xydPlugin.js +2 -0
  47. package/dist/xydPlugin.js.map +1 -0
  48. package/index.ts +1 -2
  49. package/package.json +27 -21
  50. package/packages/xyd-plugin/SidebarItem.tsx +27 -0
  51. package/packages/xyd-plugin/index.ts +20 -0
  52. package/rollup.config.js +66 -21
  53. package/src/components/ApiRef/ApiRefItem/ApiRefItem.styles.tsx +95 -63
  54. package/src/components/ApiRef/ApiRefItem/ApiRefItem.tsx +512 -52
  55. package/src/components/ApiRef/ApiRefProperties/ApiRefProperties.styles.tsx +186 -138
  56. package/src/components/ApiRef/ApiRefProperties/ApiRefProperties.tsx +590 -59
  57. package/src/components/ApiRef/ApiRefSamples/ApiRefSamples.styles.tsx +19 -23
  58. package/src/components/ApiRef/ApiRefSamples/ApiRefSamples.tsx +39 -24
  59. package/src/components/Atlas/Atlas.styles.tsx +3 -5
  60. package/src/components/Atlas/Atlas.tsx +35 -17
  61. package/src/components/Atlas/AtlasContext.tsx +47 -0
  62. package/src/components/Atlas/AtlasDecorator.styles.ts +22 -0
  63. package/src/components/Atlas/AtlasDecorator.tsx +15 -0
  64. package/src/components/Atlas/AtlasLazy/AtlasLazy.styles.tsx +7 -8
  65. package/src/components/Atlas/AtlasLazy/AtlasLazy.tsx +5 -8
  66. package/src/components/Atlas/AtlasPrimary.tsx +21 -0
  67. package/src/components/Atlas/AtlasSecondary.tsx +148 -0
  68. package/src/components/Atlas/index.ts +6 -2
  69. package/src/components/Atlas/types.ts +11 -0
  70. package/src/components/Code/CodeSampleButtons/CodeSampleButtons.styles.tsx +56 -65
  71. package/src/components/Code/CodeSampleButtons/CodeSampleButtons.tsx +20 -29
  72. package/src/components/Code/index.ts +0 -4
  73. package/src/components/Icon/index.tsx +384 -0
  74. package/src/docs/AtlasExample/todo-app.uniform.json +1 -1
  75. package/src/styles/styles.css +89 -0
  76. package/src/styles/tokens.css +60 -0
  77. package/src/utils/mdx.ts +0 -29
  78. package/tsconfig.json +9 -2
  79. package/types.d.ts +22 -0
  80. package/src/components/Code/CodeCopy/CodeCopy.style.tsx +0 -21
  81. package/src/components/Code/CodeCopy/CodeCopy.tsx +0 -32
  82. package/src/components/Code/CodeCopy/index.ts +0 -7
  83. package/src/components/Code/CodeSample/CodeSample.styles.tsx +0 -134
  84. package/src/components/Code/CodeSample/CodeSample.tsx +0 -149
  85. package/src/components/Code/CodeSample/index.ts +0 -8
  86. package/src/components/Code/CodeSample/withLocalStored.tsx +0 -52
  87. package/src/components/Code/default-theme.ts +0 -266
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyd-js/atlas",
3
- "version": "0.1.0-xyd.4",
3
+ "version": "0.1.0-xyd.57",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -8,53 +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.0",
17
- "@emotion/react": "^11.13.5",
18
- "@linaria/atomic": "^6.2.0",
19
- "@linaria/core": "^6.2.0",
20
- "@radix-ui/react-tabs": "^1.1.1",
20
+ "@code-hike/lighter": "^1.0.3",
21
+ "radix-ui": "^1.4.2",
21
22
  "codehike": "^1.0.2",
22
23
  "lucide-react": "^0.447.0",
23
- "react": "^18.3.1",
24
- "@xyd-js/uniform": "0.1.0-xyd.3"
24
+ "@xyd-js/uniform": "0.1.0-xyd.56",
25
+ "@xyd-js/components": "0.1.0-xyd.52"
26
+ },
27
+ "peerDependencies": {
28
+ "react": "^19.1.0",
29
+ "@xyd-js/plugins": "0.1.0-xyd.41",
30
+ "@xyd-js/core": "0.1.0-xyd.54",
31
+ "@xyd-js/framework": "0.1.0-xyd.73"
25
32
  },
26
33
  "devDependencies": {
34
+ "@types/react": "^19.1.0",
35
+ "@types/react-dom": "^19.1.0",
36
+ "@linaria/core": "^6.2.0",
37
+ "@babel/preset-react": "^7.26.0",
27
38
  "@babel/preset-env": "^7.26.0",
28
- "@babel/preset-flow": "^7.25.9",
29
- "@chromatic-com/storybook": "^3.2.2",
30
- "@rollup/plugin-alias": "^5.1.1",
31
39
  "@rollup/plugin-babel": "^6.0.4",
32
40
  "@rollup/plugin-commonjs": "^28.0.1",
33
41
  "@rollup/plugin-node-resolve": "^15.3.0",
34
42
  "@rollup/plugin-typescript": "^12.1.1",
35
- "@storybook/addon-essentials": "^8.4.5",
36
- "@storybook/addon-interactions": "^8.4.5",
37
- "@storybook/addon-onboarding": "^8.4.5",
38
- "@storybook/blocks": "^8.4.5",
43
+ "@wyw-in-js/rollup": "^0.5.5",
44
+ "@wyw-in-js/vite": "^0.5.5",
39
45
  "@storybook/react": "^8.4.5",
40
46
  "@storybook/react-vite": "^8.4.5",
41
47
  "@storybook/test": "^8.4.5",
42
- "@wyw-in-js/rollup": "^0.5.5",
43
- "@wyw-in-js/vite": "^0.5.5",
44
- "autoprefixer": "^10.4.20",
45
- "postcss": "^8.4.47",
46
- "prop-types": "^15.8.1",
47
48
  "rollup": "^4.27.4",
48
49
  "rollup-plugin-css-only": "^4.5.2",
49
50
  "rollup-plugin-dts": "^6.1.1",
50
51
  "rollup-plugin-terser": "^7.0.2",
52
+ "rimraf": "^3.0.2",
51
53
  "storybook": "^8.4.5",
52
- "@xyd-js/gql": "0.1.0-xyd.1"
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"
53
58
  },
54
59
  "scripts": {
55
60
  "clean": "rimraf build",
56
61
  "prebuild": "pnpm clean",
57
62
  "build": "rollup -c rollup.config.js",
63
+ "dev": "rollup -c rollup.config.js --watch",
58
64
  "storybook": "storybook dev -p 6006",
59
65
  "build-storybook": "storybook build"
60
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,34 +9,49 @@ 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 alias from '@rollup/plugin-alias';
10
- import {fileURLToPath} from 'url';
11
- import {dirname} from 'path';
12
-
13
- const __filename = fileURLToPath(import.meta.url);
14
- const __dirname = dirname(__filename);
15
-
16
- import {createRequire} from 'module';
17
12
 
18
13
  const require = createRequire(import.meta.url);
19
- const {dependencies} = require('./package.json', {assert: {type: 'json'}});
14
+ const {
15
+ dependencies,
16
+ peerDependencies,
17
+ devDependencies
18
+ } = require('./package.json', {assert: {type: 'json'}});
19
+
20
+ const external = [
21
+ ...Object.keys(dependencies),
22
+ ...Object.keys(peerDependencies),
23
+ ...Object.keys(devDependencies),
24
+ ];
20
25
 
21
- const external = Object.keys(dependencies);
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
+ }
22
39
 
23
40
  export default [
24
41
  {
25
- input: 'index.ts',
26
- output: {
27
- dir: 'dist',
28
- format: 'esm',
29
- sourcemap: false,
42
+ input: {
43
+ index: 'index.ts',
44
+ xydPlugin: 'packages/xyd-plugin/index.ts',
30
45
  },
46
+ output: [
47
+ {
48
+ dir: 'dist',
49
+ format: 'esm',
50
+ sourcemap: true,
51
+ entryFileNames: '[name].js'
52
+ }
53
+ ],
31
54
  plugins: [
32
- // alias({ TODO: finish?
33
- // entries: [
34
- // {find: '@', replacement: resolve(__dirname, 'src')}
35
- // ]
36
- // }),
37
55
  wyw({
38
56
  include: ['**/*.{ts,tsx}'],
39
57
  babelOptions: {
@@ -42,10 +60,28 @@ export default [
42
60
  '@babel/preset-react'
43
61
  ],
44
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
+ // }
45
80
  }),
46
81
  css({
47
82
  output: 'index.css',
48
83
  }),
84
+ copyCss(['tokens', 'styles']),
49
85
  resolve(),
50
86
  commonjs(),
51
87
  typescript({
@@ -66,10 +102,19 @@ export default [
66
102
  {
67
103
  input: 'index.ts',
68
104
  output: {
69
- dir: 'dist',
105
+ file: 'dist/index.d.ts',
70
106
  format: 'es',
71
107
  },
72
108
  plugins: [dts()],
73
109
  external
74
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
+ }
75
120
  ];
@@ -1,70 +1,102 @@
1
- import {css} from "@linaria/core";
2
-
3
- export const $title = {
4
- host: css`
5
- font-size: 30px;
6
- font-weight: 400;
7
- `,
8
- link: css`
9
- `,
10
- }
11
-
12
- export const $navbar = {
13
- host: css`
14
- `,
15
- container: css`
16
- background: linear-gradient(45deg, rgb(247, 247, 248) 0%, rgb(247, 247, 248) 100%);
17
-
18
- padding: 8px;
19
-
20
- border: 1px solid var(--atlas-comp-apiref-item-border-color);
21
- border-radius: 8px;
22
-
23
- font-size: 13px;
24
- `,
25
- label: css`
26
- color: var(--atlas-comp-apiref-item-navbar-color);
27
-
28
- margin-right: 4px;
29
- `,
30
- }
31
-
32
- export const $refItem = {
33
- host: css`
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
- flex-direction: column;
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: repeat(2, minmax(0, 1fr));
43
- align-items: normal;
44
- gap: 100px;
45
- `,
46
- }
84
+ grid-template-columns: 1fr auto;
85
+ align-items: center;
86
+ gap: 16px;
47
87
 
48
- export const $properties = {
49
- host: css`
88
+ > :first-child {
89
+ justify-self: start;
90
+ }
50
91
 
51
- `,
52
- item: css`
53
- display: flex;
54
- flex-direction: column;
55
- gap: 25px;
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
+ `