@xyd-js/atlas 0.1.0-xyd.10 → 0.1.0-xyd.12
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 +15 -0
- package/dist/CodeSample-Cp42Adjc-C5AHaCBx.js +2 -0
- package/dist/CodeSample-Cp42Adjc-C5AHaCBx.js.map +1 -0
- package/dist/CodeSample-DxPp80ID-C5AHaCBx.js +2 -0
- package/dist/CodeSample-DxPp80ID-C5AHaCBx.js.map +1 -0
- package/dist/atlas-index.d.ts +15 -0
- package/dist/atlas-index.js +2 -0
- package/dist/atlas-index.js.map +1 -0
- package/dist/index.css +58 -58
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/tokens.css +57 -0
- package/index.ts +1 -2
- package/package.json +8 -3
- package/packages/atlas-index/AtlasIndex.tsx +79 -0
- package/packages/atlas-index/index.ts +3 -0
- package/rollup.config.js +53 -11
- package/src/components/ApiRef/ApiRefItem/ApiRefItem.styles.tsx +2 -2
- package/src/components/ApiRef/ApiRefProperties/ApiRefProperties.styles.tsx +9 -8
- package/src/components/Code/CodeCopy/CodeCopy.style.tsx +6 -8
- package/src/components/Code/CodeSample/CodeSample.styles.tsx +9 -9
- package/src/components/Code/CodeSample/CodeSample.tsx +3 -3
- package/src/components/Code/CodeSampleButtons/CodeSampleButtons.styles.tsx +5 -11
- package/src/styles/tokens.css +57 -0
- package/src/utils/linaria.ts +20 -0
- package/tsconfig.json +3 -0
package/dist/tokens.css
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
/* Ref tokens - Base values */
|
|
3
|
+
--XydAtlas-Ref-Palette-Primary-60: #7051d4;
|
|
4
|
+
--XydAtlas-Ref-Palette-Primary-70: #6045b9;
|
|
5
|
+
--XydAtlas-Ref-Palette-Primary-80: #4f399e;
|
|
6
|
+
|
|
7
|
+
--XydAtlas-Ref-Palette-Neutral-10: #F8F9FA;
|
|
8
|
+
--XydAtlas-Ref-Palette-Neutral-20: #F1F3F5;
|
|
9
|
+
--XydAtlas-Ref-Palette-Neutral-30: #E9ECEF;
|
|
10
|
+
--XydAtlas-Ref-Palette-Neutral-40: #DEE2E6;
|
|
11
|
+
--XydAtlas-Ref-Palette-Neutral-70: #6C757D;
|
|
12
|
+
--XydAtlas-Ref-Palette-Neutral-80: #495057;
|
|
13
|
+
--XydAtlas-Ref-Palette-Neutral-100: #212529;
|
|
14
|
+
|
|
15
|
+
/* System tokens - Semantic values */
|
|
16
|
+
--XydAtlas-Sys-Color-Primary: var(--XydAtlas-Ref-Palette-Primary-60);
|
|
17
|
+
--XydAtlas-Sys-Color-Primary--hover: var(--XydAtlas-Ref-Palette-Primary-70);
|
|
18
|
+
--XydAtlas-Sys-Color-Primary--active: var(--XydAtlas-Ref-Palette-Primary-80);
|
|
19
|
+
|
|
20
|
+
--XydAtlas-Sys-Color-Surface: var(--XydAtlas-Ref-Palette-Neutral-10);
|
|
21
|
+
--XydAtlas-Sys-Color-Surface--hover: var(--XydAtlas-Ref-Palette-Neutral-20);
|
|
22
|
+
--XydAtlas-Sys-Color-Surface--active: var(--XydAtlas-Ref-Palette-Neutral-30);
|
|
23
|
+
|
|
24
|
+
--XydAtlas-Sys-Color-Text-Primary: var(--XydAtlas-Ref-Palette-Neutral-100);
|
|
25
|
+
--XydAtlas-Sys-Color-Text-Secondary: var(--XydAtlas-Ref-Palette-Neutral-80);
|
|
26
|
+
--XydAtlas-Sys-Color-Text-Tertiary: var(--XydAtlas-Ref-Palette-Neutral-70);
|
|
27
|
+
|
|
28
|
+
--XydAtlas-Sys-Color-Border: var(--XydAtlas-Ref-Palette-Neutral-30);
|
|
29
|
+
--XydAtlas-Sys-Color-Border--hover: var(--XydAtlas-Ref-Palette-Neutral-40);
|
|
30
|
+
--XydAtlas-Sys-Color-Border--active: var(--XydAtlas-Ref-Palette-Primary-60);
|
|
31
|
+
|
|
32
|
+
/* Component tokens - Specific component values */
|
|
33
|
+
/* ApiRef Properties */
|
|
34
|
+
--XydAtlas-Component-ApiRef-Properties__color-description: var(--XydAtlas-Sys-Color-Text-Secondary);
|
|
35
|
+
--XydAtlas-Component-ApiRef-Properties__color-propName: var(--XydAtlas-Sys-Color-Text-Primary);
|
|
36
|
+
--XydAtlas-Component-ApiRef-Properties__color-propType: var(--XydAtlas-Sys-Color-Text-Tertiary);
|
|
37
|
+
--XydAtlas-Component-ApiRef-Properties__color--active: var(--XydAtlas-Sys-Color-Primary);
|
|
38
|
+
--XydAtlas-Component-ApiRef-Properties__color-border: var(--XydAtlas-Sys-Color-Border);
|
|
39
|
+
|
|
40
|
+
/* ApiRef Item */
|
|
41
|
+
--XydAtlas-Component-ApiRef-Item__color-border: var(--XydAtlas-Sys-Color-Border);
|
|
42
|
+
--XydAtlas-Component-ApiRef-Item__color-navbar: var(--XydAtlas-Sys-Color-Text-Secondary);
|
|
43
|
+
|
|
44
|
+
/* Code Sample */
|
|
45
|
+
--XydAtlas-Component-Code-Sample__color-border: var(--XydAtlas-Sys-Color-Border);
|
|
46
|
+
--XydAtlas-Component-Code-Sample__color: var(--XydAtlas-Sys-Color-Text-Secondary);
|
|
47
|
+
--XydAtlas-Component-Code-Sample__color--active: var(--XydAtlas-Sys-Color-Primary);
|
|
48
|
+
--XydAtlas-Component-Code-Sample__color-background: var(--XydAtlas-Sys-Color-Surface--hover);
|
|
49
|
+
--XydAtlas-Component-Code-Sample__color-markBorder--active: var(--XydAtlas-Sys-Color-Primary);
|
|
50
|
+
--XydAtlas-Component-Code-Sample__color-markBackground--active: var(--XydAtlas-Sys-Color-Surface--hover);
|
|
51
|
+
|
|
52
|
+
/* Code Sample Buttons */
|
|
53
|
+
--XydAtlas-Component-Code-SampleButtons__color-containerBackground: var(--XydAtlas-Sys-Color-Surface);
|
|
54
|
+
--XydAtlas-Component-Code-SampleButtons__color-background--active: var(--XydAtlas-Sys-Color-Surface--active);
|
|
55
|
+
--XydAtlas-Component-Code-SampleButtons__color: var(--XydAtlas-Sys-Color-Text-Secondary);
|
|
56
|
+
--XydAtlas-Component-Code-SampleButtons__color--active: var(--XydAtlas-Sys-Color-Text-Primary);
|
|
57
|
+
}
|
package/index.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export * from "./src/components/Atlas"
|
|
1
|
+
export * from "./src/components/Atlas"
|
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.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -8,8 +8,12 @@
|
|
|
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
|
+
"./atlas-index": {
|
|
16
|
+
"import": "./dist/atlas-index.js"
|
|
13
17
|
}
|
|
14
18
|
},
|
|
15
19
|
"dependencies": {
|
|
@@ -17,7 +21,7 @@
|
|
|
17
21
|
"@radix-ui/react-tabs": "^1.1.1",
|
|
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.11"
|
|
21
25
|
},
|
|
22
26
|
"peerDependencies": {
|
|
23
27
|
"react": "^19.0.0"
|
|
@@ -56,12 +60,13 @@
|
|
|
56
60
|
"rimraf": "^3.0.2",
|
|
57
61
|
"prop-types": "^15.8.1",
|
|
58
62
|
"storybook": "^8.4.5",
|
|
59
|
-
"@xyd-js/gql": "0.1.0-xyd.
|
|
63
|
+
"@xyd-js/gql": "0.1.0-xyd.9"
|
|
60
64
|
},
|
|
61
65
|
"scripts": {
|
|
62
66
|
"clean": "rimraf build",
|
|
63
67
|
"prebuild": "pnpm clean",
|
|
64
68
|
"build": "rollup -c rollup.config.js",
|
|
69
|
+
"dev": "rollup -c rollup.config.js --watch",
|
|
65
70
|
"storybook": "storybook dev -p 6006",
|
|
66
71
|
"build-storybook": "storybook build"
|
|
67
72
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import type {Reference} from "@xyd-js/uniform";
|
|
4
|
+
import {
|
|
5
|
+
Heading,
|
|
6
|
+
TableV2,
|
|
7
|
+
Details,
|
|
8
|
+
Code,
|
|
9
|
+
|
|
10
|
+
IconQuote
|
|
11
|
+
} from "@xyd-js/components/writer";
|
|
12
|
+
import {
|
|
13
|
+
helperContent
|
|
14
|
+
} from "@xyd-js/components/content";
|
|
15
|
+
|
|
16
|
+
import {MDXReference, mdxValue} from "@/utils/mdx";
|
|
17
|
+
|
|
18
|
+
const {Content} = helperContent()
|
|
19
|
+
|
|
20
|
+
// TODO: interface should be imported from somewhere
|
|
21
|
+
interface CodeSourceContext {
|
|
22
|
+
fileName: string;
|
|
23
|
+
fileFullPath: string;
|
|
24
|
+
sourcecode: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface AtlasIndexProps {
|
|
28
|
+
data: MDXReference<Reference<CodeSourceContext>>
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function AtlasIndex({data}: AtlasIndexProps) {
|
|
32
|
+
return <Content>
|
|
33
|
+
<Heading size={1}>
|
|
34
|
+
{mdxValue(data.title)}
|
|
35
|
+
</Heading>
|
|
36
|
+
|
|
37
|
+
<p>
|
|
38
|
+
{data.description.children}
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
{
|
|
42
|
+
mdxValue(data.context?.fileName) && <Details
|
|
43
|
+
label=""
|
|
44
|
+
kind="tertiary"
|
|
45
|
+
title={<>
|
|
46
|
+
Source code in <Code>{mdxValue(data.context.fileFullPath)}</Code>
|
|
47
|
+
</>}
|
|
48
|
+
icon={<IconQuote/>}>
|
|
49
|
+
{data.context.sourcecode.children}
|
|
50
|
+
</Details>
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
{
|
|
54
|
+
data.definitions.map((definition, index) => {
|
|
55
|
+
return <>
|
|
56
|
+
<Heading size={2}>
|
|
57
|
+
{mdxValue(definition.title)}
|
|
58
|
+
</Heading>
|
|
59
|
+
<TableV2 key={index}>
|
|
60
|
+
<TableV2.Head>
|
|
61
|
+
<TableV2.Tr>
|
|
62
|
+
<TableV2.Th>Type</TableV2.Th>
|
|
63
|
+
<TableV2.Th>Description</TableV2.Th>
|
|
64
|
+
</TableV2.Tr>
|
|
65
|
+
</TableV2.Head>
|
|
66
|
+
{definition.properties?.map((property, propIndex) => (
|
|
67
|
+
<TableV2.Tr key={propIndex}>
|
|
68
|
+
<TableV2.Td>
|
|
69
|
+
<Code>{mdxValue(property.name) || mdxValue(property.type)}</Code>
|
|
70
|
+
</TableV2.Td>
|
|
71
|
+
<TableV2.Td muted>{property?.children}</TableV2.Td>
|
|
72
|
+
</TableV2.Tr>
|
|
73
|
+
))}
|
|
74
|
+
</TableV2>
|
|
75
|
+
</>
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
</Content>
|
|
79
|
+
}
|
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,33 @@ const external = [
|
|
|
21
23
|
...Object.keys(devDependencies),
|
|
22
24
|
];
|
|
23
25
|
|
|
26
|
+
// Function to copy tokens.css to dist
|
|
27
|
+
function copyTokensCss() {
|
|
28
|
+
return {
|
|
29
|
+
name: 'copy-tokens-css',
|
|
30
|
+
writeBundle() {
|
|
31
|
+
const tokensCss = fs.readFileSync('src/styles/tokens.css', 'utf8');
|
|
32
|
+
fs.mkdirSync('dist', { recursive: true });
|
|
33
|
+
fs.writeFileSync('dist/tokens.css', tokensCss);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
24
38
|
export default [
|
|
25
39
|
{
|
|
26
|
-
input:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
format: 'esm',
|
|
30
|
-
sourcemap: true,
|
|
40
|
+
input: {
|
|
41
|
+
index: 'index.ts',
|
|
42
|
+
["atlas-index"]: 'packages/atlas-index/index.ts'
|
|
31
43
|
},
|
|
44
|
+
output: [
|
|
45
|
+
{
|
|
46
|
+
dir: 'dist',
|
|
47
|
+
format: 'esm',
|
|
48
|
+
sourcemap: true,
|
|
49
|
+
entryFileNames: '[name].js'
|
|
50
|
+
}
|
|
51
|
+
],
|
|
32
52
|
plugins: [
|
|
33
|
-
// alias({ TODO: finish?
|
|
34
|
-
// entries: [
|
|
35
|
-
// {find: '@', replacement: resolve(__dirname, 'src')}
|
|
36
|
-
// ]
|
|
37
|
-
// }),
|
|
38
53
|
wyw({
|
|
39
54
|
include: ['**/*.{ts,tsx}'],
|
|
40
55
|
babelOptions: {
|
|
@@ -43,10 +58,28 @@ export default [
|
|
|
43
58
|
'@babel/preset-react'
|
|
44
59
|
],
|
|
45
60
|
},
|
|
61
|
+
classNameSlug: (hash, title, {file}) => {
|
|
62
|
+
// Get the full path after 'src/components/'
|
|
63
|
+
const pathParts = file.split('/');
|
|
64
|
+
const componentsIndex = pathParts.indexOf('components');
|
|
65
|
+
if (componentsIndex === -1) return `XydAtlas-Component-${title}_${hash}`;
|
|
66
|
+
|
|
67
|
+
// Get everything after 'components' directory
|
|
68
|
+
const componentPath = pathParts
|
|
69
|
+
.slice(componentsIndex + 1)
|
|
70
|
+
.filter(part => !part.endsWith('.styles.tsx')) // Remove styles.tsx
|
|
71
|
+
.join('-');
|
|
72
|
+
|
|
73
|
+
// Use the title as the style name (it's already the variable name)
|
|
74
|
+
const styleName = title.replace(/^\$/, ''); // Remove $ prefix if present
|
|
75
|
+
|
|
76
|
+
return `XydAtlas-Component-${componentPath}__${styleName}_${hash}`;
|
|
77
|
+
}
|
|
46
78
|
}),
|
|
47
79
|
css({
|
|
48
80
|
output: 'index.css',
|
|
49
81
|
}),
|
|
82
|
+
copyTokensCss(),
|
|
50
83
|
resolve(),
|
|
51
84
|
commonjs(),
|
|
52
85
|
typescript({
|
|
@@ -73,4 +106,13 @@ export default [
|
|
|
73
106
|
plugins: [dts()],
|
|
74
107
|
external
|
|
75
108
|
},
|
|
109
|
+
{
|
|
110
|
+
input: 'packages/atlas-index/index.ts',
|
|
111
|
+
output: {
|
|
112
|
+
file: 'dist/atlas-index.d.ts',
|
|
113
|
+
format: 'es',
|
|
114
|
+
},
|
|
115
|
+
plugins: [dts()],
|
|
116
|
+
external
|
|
117
|
+
},
|
|
76
118
|
];
|
|
@@ -17,13 +17,13 @@ export const $navbar = {
|
|
|
17
17
|
|
|
18
18
|
padding: 8px;
|
|
19
19
|
|
|
20
|
-
border: 1px solid var(--
|
|
20
|
+
border: 1px solid var(--XydAtlas-Component-ApiRef-Item__color-border);
|
|
21
21
|
border-radius: 8px;
|
|
22
22
|
|
|
23
23
|
font-size: 13px;
|
|
24
24
|
`,
|
|
25
25
|
label: css`
|
|
26
|
-
color: var(--
|
|
26
|
+
color: var(--XydAtlas-Component-ApiRef-Item__color-navbar);
|
|
27
27
|
|
|
28
28
|
margin-right: 4px;
|
|
29
29
|
`,
|
|
@@ -35,7 +35,7 @@ export const $description = {
|
|
|
35
35
|
host: css`
|
|
36
36
|
font-size: 14px;
|
|
37
37
|
line-height: 22px;
|
|
38
|
-
color: var(--
|
|
38
|
+
color: var(--XydAtlas-Component-ApiRef-Properties__color-description);
|
|
39
39
|
`
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -64,7 +64,7 @@ export const $propNameCode = {
|
|
|
64
64
|
|
|
65
65
|
font-weight: 600;
|
|
66
66
|
font-size: 13px;
|
|
67
|
-
color: var(--
|
|
67
|
+
color: var(--XydAtlas-Component-ApiRef-Properties__color-propName);
|
|
68
68
|
`,
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -77,14 +77,15 @@ export const $propTypeCode = {
|
|
|
77
77
|
border-radius: 4px;
|
|
78
78
|
|
|
79
79
|
font-size: 10px;
|
|
80
|
-
color: var(--
|
|
80
|
+
color: var(--XydAtlas-Component-ApiRef-Properties__color-propType);
|
|
81
81
|
`,
|
|
82
82
|
link: css`
|
|
83
|
-
color: var(--
|
|
83
|
+
color: var(--XydAtlas-Component-ApiRef-Properties__color--active);
|
|
84
84
|
text-decoration: underline;
|
|
85
85
|
|
|
86
86
|
&:hover {
|
|
87
87
|
text-decoration: none;
|
|
88
|
+
color: var(--XydAtlas-Sys-Color-Primary--hover);
|
|
88
89
|
}
|
|
89
90
|
`
|
|
90
91
|
}
|
|
@@ -112,7 +113,7 @@ export const $subProps = {
|
|
|
112
113
|
list-style: none;
|
|
113
114
|
|
|
114
115
|
border: none;
|
|
115
|
-
border-left: 1px solid var(--
|
|
116
|
+
border-left: 1px solid var(--XydAtlas-Component-ApiRef-Properties__color-border);
|
|
116
117
|
`,
|
|
117
118
|
li: css`
|
|
118
119
|
padding: 0 16px;
|
|
@@ -140,9 +141,9 @@ export const $propToggle = {
|
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
&:hover {
|
|
143
|
-
svg {
|
|
144
|
+
svg {
|
|
144
145
|
transition: all ease-in .1s;
|
|
145
|
-
color: var(--
|
|
146
|
+
color: var(--XydAtlas-Component-ApiRef-Properties__color--active);
|
|
146
147
|
}
|
|
147
148
|
}
|
|
148
149
|
`,
|
|
@@ -153,7 +154,7 @@ export const $propToggle = {
|
|
|
153
154
|
|
|
154
155
|
&:hover {
|
|
155
156
|
transition: all ease-in .1s;
|
|
156
|
-
color: var(--
|
|
157
|
+
color: var(--XydAtlas-Component-ApiRef-Properties__color--active);
|
|
157
158
|
}
|
|
158
159
|
`
|
|
159
160
|
}
|
|
@@ -2,20 +2,18 @@ import {css} from "@linaria/core";
|
|
|
2
2
|
|
|
3
3
|
export const $copy = {
|
|
4
4
|
host: css`
|
|
5
|
-
all: unset;
|
|
6
|
-
|
|
7
|
-
cursor: pointer;
|
|
8
|
-
|
|
9
5
|
display: flex;
|
|
10
6
|
align-items: center;
|
|
11
7
|
justify-content: center;
|
|
12
|
-
|
|
8
|
+
|
|
9
|
+
padding: 8px;
|
|
10
|
+
|
|
13
11
|
border-radius: 6px;
|
|
14
|
-
|
|
12
|
+
|
|
13
|
+
cursor: pointer;
|
|
15
14
|
|
|
16
15
|
&:hover {
|
|
17
|
-
|
|
18
|
-
background: var(--atlas-comp-code-copy-background--active);
|
|
16
|
+
background: var(--XydAtlas-Component-Code-Copy__color-background--active);
|
|
19
17
|
}
|
|
20
18
|
`
|
|
21
19
|
}
|
|
@@ -7,7 +7,7 @@ export const $sample = {
|
|
|
7
7
|
min-width: 0;
|
|
8
8
|
max-width: 512px;
|
|
9
9
|
|
|
10
|
-
border: 1px solid var(--
|
|
10
|
+
border: 1px solid var(--XydAtlas-Component-Code-Sample__color-border);
|
|
11
11
|
border-radius: 16px;
|
|
12
12
|
`,
|
|
13
13
|
}
|
|
@@ -46,18 +46,18 @@ export const $languages = {
|
|
|
46
46
|
padding: 6px;
|
|
47
47
|
|
|
48
48
|
font-size: 14px;
|
|
49
|
-
color: var(--
|
|
49
|
+
color: var(--XydAtlas-Component-Code-Sample__color);
|
|
50
50
|
|
|
51
51
|
&[data-state="active"] {
|
|
52
|
-
color: var(--
|
|
53
|
-
border-bottom: 1px solid var(--
|
|
52
|
+
color: var(--XydAtlas-Component-Code-Sample__color--active);
|
|
53
|
+
border-bottom: 1px solid var(--XydAtlas-Component-Code-Sample__color--active);
|
|
54
54
|
border-bottom-left-radius: 0px;
|
|
55
55
|
border-bottom-right-radius: 0px;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
&:hover {
|
|
59
59
|
transition: ease-in 0.1s;
|
|
60
|
-
background: var(--
|
|
60
|
+
background: var(--XydAtlas-Component-Code-Sample__color-background);
|
|
61
61
|
}
|
|
62
62
|
`,
|
|
63
63
|
description: css`
|
|
@@ -66,7 +66,7 @@ export const $languages = {
|
|
|
66
66
|
gap: 4px;
|
|
67
67
|
|
|
68
68
|
font-size: 14px;
|
|
69
|
-
color: var(--
|
|
69
|
+
color: var(--XydAtlas-Component-Code-Sample__color);
|
|
70
70
|
|
|
71
71
|
margin-left: 4px;
|
|
72
72
|
margin-right: 4px;
|
|
@@ -95,7 +95,7 @@ export const $code = {
|
|
|
95
95
|
margin: 0;
|
|
96
96
|
padding: 8px 16px;
|
|
97
97
|
|
|
98
|
-
border-top: 1px solid var(--
|
|
98
|
+
border-top: 1px solid var(--XydAtlas-Component-Code-Sample__color-border);
|
|
99
99
|
border-bottom-left-radius: 10px;
|
|
100
100
|
border-bottom-right-radius: 10px;
|
|
101
101
|
|
|
@@ -119,8 +119,8 @@ export const $mark = {
|
|
|
119
119
|
flex: 1 1 0%;
|
|
120
120
|
`,
|
|
121
121
|
$$annotated: css`
|
|
122
|
-
border-color: var(--
|
|
123
|
-
background-color: var(--
|
|
122
|
+
border-color: var(--XydAtlas-Component-Code-Sample__color-markBorder--active);
|
|
123
|
+
background-color: var(--XydAtlas-Component-Code-Sample__color-markBackground--active);
|
|
124
124
|
`
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
$mark,
|
|
21
21
|
$lineNumber
|
|
22
22
|
} from "./CodeSample.styles";
|
|
23
|
+
import {CodeLoader} from "@xyd-js/components/coder";
|
|
23
24
|
|
|
24
25
|
// TODO: try to use codehiki in build time / ASYNC !!! - we need rr server-components
|
|
25
26
|
// TODO: separate highlight
|
|
@@ -57,14 +58,13 @@ export function CodeSample(props: CodeSampleProps) {
|
|
|
57
58
|
}, [props.codeblocks]);
|
|
58
59
|
|
|
59
60
|
if (highlighted.length === 0) {
|
|
60
|
-
return <
|
|
61
|
+
return <CodeLoader/>
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
if (!highlighted) {
|
|
64
|
-
return <
|
|
65
|
+
return <CodeLoader/>
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
|
|
68
68
|
return (
|
|
69
69
|
<$$LocalStoredTab
|
|
70
70
|
className={$sample.host}
|
|
@@ -9,15 +9,13 @@ export const $sample = {
|
|
|
9
9
|
display: flex;
|
|
10
10
|
align-items: center;
|
|
11
11
|
border-radius: 8px;
|
|
12
|
-
|
|
13
|
-
background-color: #F3F4F6;
|
|
12
|
+
background-color: var(--XydAtlas-Component-Code-SampleButtons__color-containerBackground);
|
|
14
13
|
`
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
export const $arrow = {
|
|
18
17
|
host: css`
|
|
19
18
|
padding: 8px;
|
|
20
|
-
//background-color: var(--atlas-comp-code-sample_buttons-background--active);
|
|
21
19
|
background-color: #ffffff;
|
|
22
20
|
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
23
21
|
`,
|
|
@@ -55,19 +53,15 @@ export const $button = {
|
|
|
55
53
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
56
54
|
transition-duration: 300ms;
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
color: #6B7280;
|
|
56
|
+
color: var(--XydAtlas-Component-Code-SampleButtons__color);
|
|
60
57
|
|
|
61
58
|
&:hover {
|
|
62
|
-
|
|
63
|
-
color: #111827;
|
|
59
|
+
color: var(--XydAtlas-Component-Code-SampleButtons__color--active);
|
|
64
60
|
}
|
|
65
61
|
`,
|
|
66
62
|
$$active: css`
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
color: #111827;
|
|
70
|
-
background-color: #ffffff;
|
|
63
|
+
color: var(--XydAtlas-Component-Code-SampleButtons__color--active);
|
|
64
|
+
background-color: var(--XydAtlas-Component-Code-SampleButtons__color-background--active);
|
|
71
65
|
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
72
66
|
`
|
|
73
67
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
/* Ref tokens - Base values */
|
|
3
|
+
--XydAtlas-Ref-Palette-Primary-60: #7051d4;
|
|
4
|
+
--XydAtlas-Ref-Palette-Primary-70: #6045b9;
|
|
5
|
+
--XydAtlas-Ref-Palette-Primary-80: #4f399e;
|
|
6
|
+
|
|
7
|
+
--XydAtlas-Ref-Palette-Neutral-10: #F8F9FA;
|
|
8
|
+
--XydAtlas-Ref-Palette-Neutral-20: #F1F3F5;
|
|
9
|
+
--XydAtlas-Ref-Palette-Neutral-30: #E9ECEF;
|
|
10
|
+
--XydAtlas-Ref-Palette-Neutral-40: #DEE2E6;
|
|
11
|
+
--XydAtlas-Ref-Palette-Neutral-70: #6C757D;
|
|
12
|
+
--XydAtlas-Ref-Palette-Neutral-80: #495057;
|
|
13
|
+
--XydAtlas-Ref-Palette-Neutral-100: #212529;
|
|
14
|
+
|
|
15
|
+
/* System tokens - Semantic values */
|
|
16
|
+
--XydAtlas-Sys-Color-Primary: var(--XydAtlas-Ref-Palette-Primary-60);
|
|
17
|
+
--XydAtlas-Sys-Color-Primary--hover: var(--XydAtlas-Ref-Palette-Primary-70);
|
|
18
|
+
--XydAtlas-Sys-Color-Primary--active: var(--XydAtlas-Ref-Palette-Primary-80);
|
|
19
|
+
|
|
20
|
+
--XydAtlas-Sys-Color-Surface: var(--XydAtlas-Ref-Palette-Neutral-10);
|
|
21
|
+
--XydAtlas-Sys-Color-Surface--hover: var(--XydAtlas-Ref-Palette-Neutral-20);
|
|
22
|
+
--XydAtlas-Sys-Color-Surface--active: var(--XydAtlas-Ref-Palette-Neutral-30);
|
|
23
|
+
|
|
24
|
+
--XydAtlas-Sys-Color-Text-Primary: var(--XydAtlas-Ref-Palette-Neutral-100);
|
|
25
|
+
--XydAtlas-Sys-Color-Text-Secondary: var(--XydAtlas-Ref-Palette-Neutral-80);
|
|
26
|
+
--XydAtlas-Sys-Color-Text-Tertiary: var(--XydAtlas-Ref-Palette-Neutral-70);
|
|
27
|
+
|
|
28
|
+
--XydAtlas-Sys-Color-Border: var(--XydAtlas-Ref-Palette-Neutral-30);
|
|
29
|
+
--XydAtlas-Sys-Color-Border--hover: var(--XydAtlas-Ref-Palette-Neutral-40);
|
|
30
|
+
--XydAtlas-Sys-Color-Border--active: var(--XydAtlas-Ref-Palette-Primary-60);
|
|
31
|
+
|
|
32
|
+
/* Component tokens - Specific component values */
|
|
33
|
+
/* ApiRef Properties */
|
|
34
|
+
--XydAtlas-Component-ApiRef-Properties__color-description: var(--XydAtlas-Sys-Color-Text-Secondary);
|
|
35
|
+
--XydAtlas-Component-ApiRef-Properties__color-propName: var(--XydAtlas-Sys-Color-Text-Primary);
|
|
36
|
+
--XydAtlas-Component-ApiRef-Properties__color-propType: var(--XydAtlas-Sys-Color-Text-Tertiary);
|
|
37
|
+
--XydAtlas-Component-ApiRef-Properties__color--active: var(--XydAtlas-Sys-Color-Primary);
|
|
38
|
+
--XydAtlas-Component-ApiRef-Properties__color-border: var(--XydAtlas-Sys-Color-Border);
|
|
39
|
+
|
|
40
|
+
/* ApiRef Item */
|
|
41
|
+
--XydAtlas-Component-ApiRef-Item__color-border: var(--XydAtlas-Sys-Color-Border);
|
|
42
|
+
--XydAtlas-Component-ApiRef-Item__color-navbar: var(--XydAtlas-Sys-Color-Text-Secondary);
|
|
43
|
+
|
|
44
|
+
/* Code Sample */
|
|
45
|
+
--XydAtlas-Component-Code-Sample__color-border: var(--XydAtlas-Sys-Color-Border);
|
|
46
|
+
--XydAtlas-Component-Code-Sample__color: var(--XydAtlas-Sys-Color-Text-Secondary);
|
|
47
|
+
--XydAtlas-Component-Code-Sample__color--active: var(--XydAtlas-Sys-Color-Primary);
|
|
48
|
+
--XydAtlas-Component-Code-Sample__color-background: var(--XydAtlas-Sys-Color-Surface--hover);
|
|
49
|
+
--XydAtlas-Component-Code-Sample__color-markBorder--active: var(--XydAtlas-Sys-Color-Primary);
|
|
50
|
+
--XydAtlas-Component-Code-Sample__color-markBackground--active: var(--XydAtlas-Sys-Color-Surface--hover);
|
|
51
|
+
|
|
52
|
+
/* Code Sample Buttons */
|
|
53
|
+
--XydAtlas-Component-Code-SampleButtons__color-containerBackground: var(--XydAtlas-Sys-Color-Surface);
|
|
54
|
+
--XydAtlas-Component-Code-SampleButtons__color-background--active: var(--XydAtlas-Sys-Color-Surface--active);
|
|
55
|
+
--XydAtlas-Component-Code-SampleButtons__color: var(--XydAtlas-Sys-Color-Text-Secondary);
|
|
56
|
+
--XydAtlas-Component-Code-SampleButtons__color--active: var(--XydAtlas-Sys-Color-Text-Primary);
|
|
57
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {generateClassName} from '@linaria/utils';
|
|
2
|
+
|
|
3
|
+
export function createCustomClassName(moduleName: string) {
|
|
4
|
+
return (componentPath: string, styleName: string, hash: string) => {
|
|
5
|
+
// Convert component path to PascalCase
|
|
6
|
+
const componentParts = componentPath.split('/');
|
|
7
|
+
const componentName = componentParts
|
|
8
|
+
.map(part => part.charAt(0).toUpperCase() + part.slice(1))
|
|
9
|
+
.join('-');
|
|
10
|
+
|
|
11
|
+
// Convert style name to camelCase
|
|
12
|
+
const styleNameFormatted = styleName
|
|
13
|
+
.replace(/^[A-Z]/, c => c.toLowerCase())
|
|
14
|
+
.replace(/([A-Z])/g, c => `-${c.toLowerCase()}`);
|
|
15
|
+
|
|
16
|
+
// Construct the class name following the pattern:
|
|
17
|
+
// Module-Component-ComponentName__styleName_hash
|
|
18
|
+
return `${moduleName}-Component-${componentName}__${styleNameFormatted}_${hash}`;
|
|
19
|
+
};
|
|
20
|
+
}
|