@xyd-js/atlas 0.0.0-build

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 (66) hide show
  1. package/.babelrc +6 -0
  2. package/.storybook/index.css +6 -0
  3. package/.storybook/main.ts +19 -0
  4. package/.storybook/preview.ts +17 -0
  5. package/.storybook/public/fonts/fustat-ext-500.woff2 +0 -0
  6. package/.storybook/public/fonts/fustat-ext-600.woff2 +0 -0
  7. package/.storybook/public/fonts/fustat-ext-700.woff2 +0 -0
  8. package/.storybook/public/fonts/fustat-regular.woff2 +0 -0
  9. package/CHANGELOG.md +13 -0
  10. package/LICENSE +21 -0
  11. package/README.md +3 -0
  12. package/declarations.d.ts +4 -0
  13. package/dist/VideoGuide-BLUkXIOB-Dk2lkn4r.js +4 -0
  14. package/dist/VideoGuide-BLUkXIOB-Dk2lkn4r.js.map +1 -0
  15. package/dist/index.css +48 -0
  16. package/dist/index.d.ts +38 -0
  17. package/dist/index.js +2 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/styles.css +104 -0
  20. package/dist/tokens.css +60 -0
  21. package/dist/xydPlugin.d.ts +5 -0
  22. package/dist/xydPlugin.js +2 -0
  23. package/dist/xydPlugin.js.map +1 -0
  24. package/index.ts +2 -0
  25. package/package.json +68 -0
  26. package/packages/xyd-plugin/SidebarItem.tsx +27 -0
  27. package/packages/xyd-plugin/index.ts +20 -0
  28. package/postcss.config.cjs +5 -0
  29. package/rollup.config.js +120 -0
  30. package/src/components/ApiRef/ApiRefItem/ApiRefItem.styles.tsx +110 -0
  31. package/src/components/ApiRef/ApiRefItem/ApiRefItem.tsx +557 -0
  32. package/src/components/ApiRef/ApiRefItem/index.ts +7 -0
  33. package/src/components/ApiRef/ApiRefProperties/ApiRefProperties.styles.tsx +202 -0
  34. package/src/components/ApiRef/ApiRefProperties/ApiRefProperties.tsx +665 -0
  35. package/src/components/ApiRef/ApiRefProperties/index.ts +7 -0
  36. package/src/components/ApiRef/ApiRefSamples/ApiRefSamples.styles.tsx +28 -0
  37. package/src/components/ApiRef/ApiRefSamples/ApiRefSamples.tsx +69 -0
  38. package/src/components/ApiRef/ApiRefSamples/index.ts +7 -0
  39. package/src/components/ApiRef/index.ts +5 -0
  40. package/src/components/Atlas/Atlas.styles.tsx +5 -0
  41. package/src/components/Atlas/Atlas.tsx +43 -0
  42. package/src/components/Atlas/AtlasContext.tsx +47 -0
  43. package/src/components/Atlas/AtlasDecorator.styles.ts +22 -0
  44. package/src/components/Atlas/AtlasDecorator.tsx +15 -0
  45. package/src/components/Atlas/AtlasLazy/AtlasLazy.styles.tsx +9 -0
  46. package/src/components/Atlas/AtlasLazy/AtlasLazy.tsx +42 -0
  47. package/src/components/Atlas/AtlasLazy/hooks.ts +29 -0
  48. package/src/components/Atlas/AtlasLazy/index.ts +7 -0
  49. package/src/components/Atlas/AtlasPrimary.tsx +21 -0
  50. package/src/components/Atlas/AtlasSecondary.tsx +148 -0
  51. package/src/components/Atlas/index.ts +7 -0
  52. package/src/components/Atlas/types.ts +11 -0
  53. package/src/components/Code/CodeSampleButtons/CodeSampleButtons.styles.tsx +58 -0
  54. package/src/components/Code/CodeSampleButtons/CodeSampleButtons.tsx +97 -0
  55. package/src/components/Code/CodeSampleButtons/index.ts +7 -0
  56. package/src/components/Code/index.ts +2 -0
  57. package/src/components/Icon/index.tsx +386 -0
  58. package/src/docs/AtlasExample/AtlasExample.stories.tsx +47 -0
  59. package/src/docs/AtlasExample/todo-app.uniform.json +625 -0
  60. package/src/docs/AtlasExample/uniform-to-references.ts +101 -0
  61. package/src/styles/styles.css +104 -0
  62. package/src/styles/tokens.css +60 -0
  63. package/src/utils/mdx.ts +2 -0
  64. package/tsconfig.json +51 -0
  65. package/types.d.ts +22 -0
  66. package/vite.config.ts +25 -0
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@xyd-js/atlas",
3
+ "version": "0.0.0-build+6952c2c-20250813013245",
4
+ "description": "",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ "./package.json": "./package.json",
10
+ "./index.css": "./dist/index.css",
11
+ "./tokens.css": "./dist/tokens.css",
12
+ ".": {
13
+ "import": "./dist/index.js"
14
+ },
15
+ "./xydPlugin": {
16
+ "import": "./dist/xydPlugin.js"
17
+ }
18
+ },
19
+ "dependencies": {
20
+ "@code-hike/lighter": "^1.0.3",
21
+ "radix-ui": "^1.4.2",
22
+ "codehike": "^1.0.2",
23
+ "lucide-react": "^0.447.0"
24
+ },
25
+ "peerDependencies": {
26
+ "react": "^19.1.0",
27
+ "openux-js": "0.0.0-pre.1",
28
+ "@xyd-js/framework": "0.0.0-build+6952c2c-20250813013245",
29
+ "@xyd-js/plugins": "0.0.0-build+6952c2c-20250813013245",
30
+ "@xyd-js/core": "0.0.0-build+6952c2c-20250813013245",
31
+ "@xyd-js/uniform": "0.0.0-build+6952c2c-20250813013245",
32
+ "@xyd-js/components": "0.0.0-build+6952c2c-20250813013245"
33
+ },
34
+ "devDependencies": {
35
+ "@types/react": "^19.1.0",
36
+ "@types/react-dom": "^19.1.0",
37
+ "@linaria/core": "^6.2.0",
38
+ "@babel/preset-react": "^7.26.0",
39
+ "@babel/preset-env": "^7.26.0",
40
+ "@rollup/plugin-babel": "^6.0.4",
41
+ "@rollup/plugin-commonjs": "^28.0.1",
42
+ "@rollup/plugin-node-resolve": "^15.3.0",
43
+ "@rollup/plugin-typescript": "^12.1.1",
44
+ "@wyw-in-js/rollup": "^0.5.5",
45
+ "@wyw-in-js/vite": "^0.5.5",
46
+ "@storybook/react": "^8.4.5",
47
+ "@storybook/react-vite": "^8.4.5",
48
+ "@storybook/test": "^8.4.5",
49
+ "rollup": "^4.27.4",
50
+ "rollup-plugin-css-only": "^4.5.2",
51
+ "rollup-plugin-dts": "^6.1.1",
52
+ "rollup-plugin-terser": "^7.0.2",
53
+ "rimraf": "^3.0.2",
54
+ "storybook": "^8.4.5",
55
+ "vite": "^7.0.0",
56
+ "@vitejs/plugin-react": "^4.3.2",
57
+ "unist-util-visit": "^5.0.0",
58
+ "@mdx-js/mdx": "^3.1.0"
59
+ },
60
+ "scripts": {
61
+ "clean": "rimraf build",
62
+ "prebuild": "pnpm clean",
63
+ "build": "rollup -c rollup.config.js",
64
+ "dev": "rollup -c rollup.config.js --watch",
65
+ "storybook": "storybook dev -p 6006",
66
+ "build-storybook": "storybook build"
67
+ }
68
+ }
@@ -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} data-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
+
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ plugins: {
3
+ autoprefixer: {},
4
+ },
5
+ }
@@ -0,0 +1,120 @@
1
+ import fs from 'fs';
2
+ import {createRequire} from 'module';
3
+
4
+ import resolve from '@rollup/plugin-node-resolve';
5
+ import commonjs from '@rollup/plugin-commonjs';
6
+ import typescript from '@rollup/plugin-typescript';
7
+ import dts from 'rollup-plugin-dts';
8
+ import {terser} from 'rollup-plugin-terser';
9
+ import babel from '@rollup/plugin-babel';
10
+ import css from 'rollup-plugin-css-only';
11
+ import wyw from '@wyw-in-js/rollup';
12
+
13
+ const require = createRequire(import.meta.url);
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
+ ];
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
+
40
+ export default [
41
+ {
42
+ input: {
43
+ index: 'index.ts',
44
+ xydPlugin: 'packages/xyd-plugin/index.ts',
45
+ },
46
+ output: [
47
+ {
48
+ dir: 'dist',
49
+ format: 'esm',
50
+ sourcemap: true,
51
+ entryFileNames: '[name].js'
52
+ }
53
+ ],
54
+ plugins: [
55
+ wyw({
56
+ include: ['**/*.{ts,tsx}'],
57
+ babelOptions: {
58
+ presets: [
59
+ '@babel/preset-typescript',
60
+ '@babel/preset-react'
61
+ ],
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
+ // }
80
+ }),
81
+ css({
82
+ output: 'index.css',
83
+ }),
84
+ copyCss(['tokens', 'styles']),
85
+ resolve(),
86
+ commonjs(),
87
+ typescript({
88
+ tsconfig: './tsconfig.json',
89
+ }),
90
+ babel({
91
+ babelHelpers: 'bundled',
92
+ extensions: ['.js', '.jsx', '.ts', '.tsx'],
93
+ presets: [
94
+ '@babel/preset-env',
95
+ '@babel/preset-react'
96
+ ],
97
+ }),
98
+ terser(),
99
+ ],
100
+ external
101
+ },
102
+ {
103
+ input: 'index.ts',
104
+ output: {
105
+ file: 'dist/index.d.ts',
106
+ format: 'es',
107
+ },
108
+ plugins: [dts()],
109
+ external
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
+ }
120
+ ];
@@ -0,0 +1,110 @@
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: 768px) {
49
+ display: flex;
50
+ flex-direction: column;
51
+ gap: 16px;
52
+ }
53
+ }
54
+ }
55
+ `;
56
+
57
+ export const ApiRefItemGrid = css`
58
+ align-items: normal;
59
+
60
+ @media (max-width: 1280px) {
61
+ xyd-grid-decorator {
62
+ --cols: 1;
63
+ }
64
+ }
65
+ `;
66
+
67
+ export const ApiRefItemDefinitionsHost = css`
68
+ `;
69
+
70
+ export const ApiRefItemDefinitionsItem = css`
71
+ display: flex;
72
+ flex-direction: column;
73
+ gap: 25px;
74
+ margin-bottom: 25px;
75
+
76
+ margin-top: var(--space-xxlarge);
77
+
78
+ [part="controls"] {
79
+ display: flex;
80
+ align-items: center;
81
+ gap: 16px;
82
+ }
83
+
84
+ > [part="header"] {
85
+ h2, h3, h4, h5, h6 {
86
+ margin: 0;
87
+ }
88
+
89
+ border-bottom: 1px solid var(--XydAtlas-Component-ApiRef-Item__color-border);
90
+
91
+ display: grid;
92
+ grid-template-columns: 1fr auto;
93
+ align-items: center;
94
+ gap: 16px;
95
+
96
+ > :first-child {
97
+ justify-self: start;
98
+ }
99
+
100
+ > :not(:first-child) {
101
+ justify-self: end;
102
+ }
103
+ }
104
+ `;
105
+
106
+ export const DefinitionBody = css`
107
+ display: flex;
108
+ flex-direction: column;
109
+ gap: 15px;
110
+ `