this.gui 1.0.12 → 1.0.13
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/package.json +5 -2
- package/src/App.jsx +31 -0
- package/src/MDXEditor.jsx +32 -0
- package/src/MdxProvider.jsx +20 -0
- package/src/Theme.jsx +28 -0
- package/src/components/CodeBlock.jsx +22 -0
- package/src/components/ComponentFactory.jsx +36 -0
- package/src/components/ComponentRegistry.js +21 -0
- package/src/index.mdx +154 -0
- package/src/main.jsx +18 -0
- package/src/scripts/generateComponents.js +166 -0
- package/src/scripts/logASCIIArt.js +12 -0
- package/src/scripts/postinstall.js +64 -0
- package/src/scripts/verifyMolecules.js +158 -0
- package/src/scripts/verify_and_install_atoms.js +211 -0
- package/src/stories/Atoms/Alert/Alert.css +29 -0
- package/src/stories/Atoms/Alert/Alert.jsx +41 -0
- package/src/stories/Atoms/Alert/Alert.stories.jsx +41 -0
- package/src/stories/Atoms/Audio/Audio.css +29 -0
- package/src/stories/Atoms/Audio/Audio.jsx +41 -0
- package/src/stories/Atoms/Audio/Audio.stories.jsx +41 -0
- package/src/stories/Atoms/Badge/Badge.css +29 -0
- package/src/stories/Atoms/Badge/Badge.jsx +41 -0
- package/src/stories/Atoms/Badge/Badge.stories.jsx +41 -0
- package/src/stories/Atoms/Button/Button.css +70 -0
- package/src/stories/Atoms/Button/Button.jsx +98 -0
- package/src/stories/Atoms/Button/Button.stories.jsx +54 -0
- package/src/stories/Atoms/Caption/Caption.css +29 -0
- package/src/stories/Atoms/Caption/Caption.jsx +41 -0
- package/src/stories/Atoms/Caption/Caption.stories.jsx +41 -0
- package/src/stories/Atoms/Checkbox/Checkbox.css +29 -0
- package/src/stories/Atoms/Checkbox/Checkbox.jsx +41 -0
- package/src/stories/Atoms/Checkbox/Checkbox.stories.jsx +41 -0
- package/src/stories/Atoms/Container/Container.css +29 -0
- package/src/stories/Atoms/Container/Container.jsx +41 -0
- package/src/stories/Atoms/Container/Container.stories.jsx +41 -0
- package/src/stories/Atoms/Divider/Divider.css +29 -0
- package/src/stories/Atoms/Divider/Divider.jsx +41 -0
- package/src/stories/Atoms/Divider/Divider.stories.jsx +41 -0
- package/src/stories/Atoms/Heading/Heading.css +29 -0
- package/src/stories/Atoms/Heading/Heading.jsx +41 -0
- package/src/stories/Atoms/Heading/Heading.stories.jsx +41 -0
- package/src/stories/Atoms/Icon/Icon.css +48 -0
- package/src/stories/Atoms/Icon/Icon.jsx +51 -0
- package/src/stories/Atoms/Icon/Icon.stories.jsx +72 -0
- package/src/stories/Atoms/Image/Image.css +29 -0
- package/src/stories/Atoms/Image/Image.jsx +41 -0
- package/src/stories/Atoms/Image/Image.stories.jsx +41 -0
- package/src/stories/Atoms/Label/Label.css +29 -0
- package/src/stories/Atoms/Label/Label.jsx +41 -0
- package/src/stories/Atoms/Label/Label.stories.jsx +41 -0
- package/src/stories/Atoms/Link/Link.css +29 -0
- package/src/stories/Atoms/Link/Link.jsx +41 -0
- package/src/stories/Atoms/Link/Link.stories.jsx +41 -0
- package/src/stories/Atoms/Loader/Loader.css +29 -0
- package/src/stories/Atoms/Loader/Loader.jsx +41 -0
- package/src/stories/Atoms/Loader/Loader.stories.jsx +41 -0
- package/src/stories/Atoms/Paragraph/Paragraph.css +29 -0
- package/src/stories/Atoms/Paragraph/Paragraph.jsx +41 -0
- package/src/stories/Atoms/Paragraph/Paragraph.stories.jsx +41 -0
- package/src/stories/Atoms/ProgressBar/ProgressBar.css +29 -0
- package/src/stories/Atoms/ProgressBar/ProgressBar.jsx +41 -0
- package/src/stories/Atoms/ProgressBar/ProgressBar.stories.jsx +41 -0
- package/src/stories/Atoms/RadioButton/RadioButton.css +29 -0
- package/src/stories/Atoms/RadioButton/RadioButton.jsx +41 -0
- package/src/stories/Atoms/RadioButton/RadioButton.stories.jsx +41 -0
- package/src/stories/Atoms/RangeInput/RangeInput.css +29 -0
- package/src/stories/Atoms/RangeInput/RangeInput.jsx +41 -0
- package/src/stories/Atoms/RangeInput/RangeInput.stories.jsx +41 -0
- package/src/stories/Atoms/Select/Select.css +29 -0
- package/src/stories/Atoms/Select/Select.jsx +41 -0
- package/src/stories/Atoms/Select/Select.stories.jsx +41 -0
- package/src/stories/Atoms/Slider/Slider.css +29 -0
- package/src/stories/Atoms/Slider/Slider.jsx +41 -0
- package/src/stories/Atoms/Slider/Slider.stories.jsx +41 -0
- package/src/stories/Atoms/Snackbar/Snackbar.css +29 -0
- package/src/stories/Atoms/Snackbar/Snackbar.jsx +41 -0
- package/src/stories/Atoms/Snackbar/Snackbar.stories.jsx +41 -0
- package/src/stories/Atoms/Spacer/Spacer.css +29 -0
- package/src/stories/Atoms/Spacer/Spacer.jsx +41 -0
- package/src/stories/Atoms/Spacer/Spacer.stories.jsx +41 -0
- package/src/stories/Atoms/Spinner/Spinner.css +29 -0
- package/src/stories/Atoms/Spinner/Spinner.jsx +41 -0
- package/src/stories/Atoms/Spinner/Spinner.stories.jsx +41 -0
- package/src/stories/Atoms/Tag/Tag.css +29 -0
- package/src/stories/Atoms/Tag/Tag.jsx +41 -0
- package/src/stories/Atoms/Tag/Tag.stories.jsx +41 -0
- package/src/stories/Atoms/TextArea/TextArea.css +29 -0
- package/src/stories/Atoms/TextArea/TextArea.jsx +41 -0
- package/src/stories/Atoms/TextArea/TextArea.stories.jsx +41 -0
- package/src/stories/Atoms/TextInput/TextInput.css +29 -0
- package/src/stories/Atoms/TextInput/TextInput.jsx +41 -0
- package/src/stories/Atoms/TextInput/TextInput.stories.jsx +41 -0
- package/src/stories/Atoms/Toggle/Toggle.css +29 -0
- package/src/stories/Atoms/Toggle/Toggle.jsx +41 -0
- package/src/stories/Atoms/Toggle/Toggle.stories.jsx +41 -0
- package/src/stories/Atoms/Tooltip/Tooltip.css +29 -0
- package/src/stories/Atoms/Tooltip/Tooltip.jsx +41 -0
- package/src/stories/Atoms/Tooltip/Tooltip.stories.jsx +41 -0
- package/src/stories/Atoms/Video/Video.css +29 -0
- package/src/stories/Atoms/Video/Video.jsx +41 -0
- package/src/stories/Atoms/Video/Video.stories.jsx +41 -0
- package/src/stories/Atoms/index.js +65 -0
- package/src/stories/Atoms/meta_Atoms.js +46 -0
- package/src/stories/Components.js +198 -0
- package/src/stories/Components.md +189 -0
- package/src/stories/Getting Started.mdx +239 -0
- package/src/stories/Layouts/Grid/Grid.css +4 -0
- package/src/stories/Layouts/Grid/Grid.jsx +15 -0
- package/src/stories/Layouts/Grid/Grid.stories.jsx +26 -0
- package/src/stories/Layouts/Layout.js +28 -0
- package/src/stories/MDX.mdx +118 -0
- package/src/stories/Miscellaneous/Miscellaneous.js +24 -0
- package/src/stories/Molecules/Accordion/Accordion.css +4 -0
- package/src/stories/Molecules/Accordion/Accordion.jsx +25 -0
- package/src/stories/Molecules/Accordion/Accordion.stories.jsx +20 -0
- package/src/stories/Molecules/AudioPlayer/AudioPlayer.css +4 -0
- package/src/stories/Molecules/AudioPlayer/AudioPlayer.jsx +25 -0
- package/src/stories/Molecules/AudioPlayer/AudioPlayer.stories.jsx +20 -0
- package/src/stories/Molecules/AvatarWithName/AvatarWithName.css +4 -0
- package/src/stories/Molecules/AvatarWithName/AvatarWithName.jsx +25 -0
- package/src/stories/Molecules/AvatarWithName/AvatarWithName.stories.jsx +20 -0
- package/src/stories/Molecules/Breadcrumbs/Breadcrumbs.css +4 -0
- package/src/stories/Molecules/Breadcrumbs/Breadcrumbs.jsx +25 -0
- package/src/stories/Molecules/Breadcrumbs/Breadcrumbs.stories.jsx +20 -0
- package/src/stories/Molecules/ButtonGroup/ButtonGroup.css +4 -0
- package/src/stories/Molecules/ButtonGroup/ButtonGroup.jsx +25 -0
- package/src/stories/Molecules/ButtonGroup/ButtonGroup.stories.jsx +20 -0
- package/src/stories/Molecules/Card/Card.css +4 -0
- package/src/stories/Molecules/Card/Card.jsx +25 -0
- package/src/stories/Molecules/Card/Card.stories.jsx +20 -0
- package/src/stories/Molecules/ComparisonTable/ComparisonTable.css +4 -0
- package/src/stories/Molecules/ComparisonTable/ComparisonTable.jsx +25 -0
- package/src/stories/Molecules/ComparisonTable/ComparisonTable.stories.jsx +20 -0
- package/src/stories/Molecules/DataTable/DataTable.css +4 -0
- package/src/stories/Molecules/DataTable/DataTable.jsx +25 -0
- package/src/stories/Molecules/DataTable/DataTable.stories.jsx +20 -0
- package/src/stories/Molecules/FileUpload/FileUpload.css +4 -0
- package/src/stories/Molecules/FileUpload/FileUpload.jsx +25 -0
- package/src/stories/Molecules/FileUpload/FileUpload.stories.jsx +20 -0
- package/src/stories/Molecules/FormField/FormField.css +4 -0
- package/src/stories/Molecules/FormField/FormField.jsx +25 -0
- package/src/stories/Molecules/FormField/FormField.stories.jsx +20 -0
- package/src/stories/Molecules/Header/Header.css +35 -0
- package/src/stories/Molecules/Header/Header.jsx +76 -0
- package/src/stories/Molecules/Header/Header.stories.jsx +28 -0
- package/src/stories/Molecules/IconButton/IconButton.css +4 -0
- package/src/stories/Molecules/IconButton/IconButton.jsx +25 -0
- package/src/stories/Molecules/IconButton/IconButton.stories.jsx +20 -0
- package/src/stories/Molecules/ImageWithCaption/ImageWithCaption.css +4 -0
- package/src/stories/Molecules/ImageWithCaption/ImageWithCaption.jsx +25 -0
- package/src/stories/Molecules/ImageWithCaption/ImageWithCaption.stories.jsx +20 -0
- package/src/stories/Molecules/InputGroup/InputGroup.css +4 -0
- package/src/stories/Molecules/InputGroup/InputGroup.jsx +25 -0
- package/src/stories/Molecules/InputGroup/InputGroup.stories.jsx +20 -0
- package/src/stories/Molecules/InputWithLabel/InputWithLabel.css +4 -0
- package/src/stories/Molecules/InputWithLabel/InputWithLabel.jsx +25 -0
- package/src/stories/Molecules/InputWithLabel/InputWithLabel.stories.jsx +20 -0
- package/src/stories/Molecules/List/List.css +4 -0
- package/src/stories/Molecules/List/List.jsx +25 -0
- package/src/stories/Molecules/List/List.stories.jsx +20 -0
- package/src/stories/Molecules/MediaCard/MediaCard.css +4 -0
- package/src/stories/Molecules/MediaCard/MediaCard.jsx +25 -0
- package/src/stories/Molecules/MediaCard/MediaCard.stories.jsx +20 -0
- package/src/stories/Molecules/Modal/Modal.css +4 -0
- package/src/stories/Molecules/Modal/Modal.jsx +25 -0
- package/src/stories/Molecules/Modal/Modal.stories.jsx +20 -0
- package/src/stories/Molecules/Molecules.js +44 -0
- package/src/stories/Molecules/Navbar/Navbar.css +87 -0
- package/src/stories/Molecules/Navbar/Navbar.jsx +87 -0
- package/src/stories/Molecules/Navbar/Navbar.stories.jsx +20 -0
- package/src/stories/Molecules/Notification/Notification.css +4 -0
- package/src/stories/Molecules/Notification/Notification.jsx +25 -0
- package/src/stories/Molecules/Notification/Notification.stories.jsx +20 -0
- package/src/stories/Molecules/PricingTable/PricingTable.css +4 -0
- package/src/stories/Molecules/PricingTable/PricingTable.jsx +25 -0
- package/src/stories/Molecules/PricingTable/PricingTable.stories.jsx +20 -0
- package/src/stories/Molecules/SearchBar/SearchBar.css +4 -0
- package/src/stories/Molecules/SearchBar/SearchBar.jsx +25 -0
- package/src/stories/Molecules/SearchBar/SearchBar.stories.jsx +20 -0
- package/src/stories/Molecules/SelectTheme/SelectTheme.css +25 -0
- package/src/stories/Molecules/SelectTheme/SelectTheme.jsx +44 -0
- package/src/stories/Molecules/SelectTheme/SelectTheme.stories.jsx +25 -0
- package/src/stories/Molecules/Sidebar/Sidebar.css +4 -0
- package/src/stories/Molecules/Sidebar/Sidebar.jsx +25 -0
- package/src/stories/Molecules/Sidebar/Sidebar.stories.jsx +20 -0
- package/src/stories/Molecules/VideoWithDescription/VideoWithDescription.css +4 -0
- package/src/stories/Molecules/VideoWithDescription/VideoWithDescription.jsx +25 -0
- package/src/stories/Molecules/VideoWithDescription/VideoWithDescription.stories.jsx +20 -0
- package/src/stories/Molecules/index.js +57 -0
- package/src/stories/Organisms/Organisms.js +39 -0
- package/src/stories/Organisms/Profile/UserFriends/UserFriends.context.jsx +15 -0
- package/src/stories/Organisms/Profile/UserFriends/UserFriends.css +4 -0
- package/src/stories/Organisms/Profile/UserFriends/UserFriends.jsx +13 -0
- package/src/stories/Organisms/Profile/UserFriends/UserFriends.stories.jsx +26 -0
- package/src/stories/Organisms/Profile/UserPosts/UserPosts.context.jsx +15 -0
- package/src/stories/Organisms/Profile/UserPosts/UserPosts.css +4 -0
- package/src/stories/Organisms/Profile/UserPosts/UserPosts.jsx +13 -0
- package/src/stories/Organisms/Profile/UserPosts/UserPosts.stories.jsx +26 -0
- package/src/stories/Organisms/Profile/UserProfile/UserProfile.context.jsx +15 -0
- package/src/stories/Organisms/Profile/UserProfile/UserProfile.css +4 -0
- package/src/stories/Organisms/Profile/UserProfile/UserProfile.jsx +13 -0
- package/src/stories/Organisms/Profile/UserProfile/UserProfile.stories.jsx +26 -0
- package/src/stories/Pages/Page/Page.css +69 -0
- package/src/stories/Pages/Page/Page.jsx +69 -0
- package/src/stories/Pages/Page/Page.stories.js +26 -0
- package/src/stories/Pages/Page/Pages.js +31 -0
- package/src/stories/Templates/Templates.js +27 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/styles/Header.modules.css +32 -0
- package/src/styles/global.css +59 -0
- package/src/themes/ThemeProvider.jsx +36 -0
- package/src/themes/Themes.js +44 -0
- package/src/themes/dark.js +22 -0
- package/src/themes/light.js +22 -0
- package/src/themes/typ/Readme.md +4 -0
- package/src/themes/typ/github/open-sans-v17-latin-ext_latin-700.woff2 +0 -0
- package/src/themes/typ/github/open-sans-v17-latin-ext_latin-700italic.woff2 +0 -0
- package/src/themes/typ/github/open-sans-v17-latin-ext_latin-italic.woff2 +0 -0
- package/src/themes/typ/github/open-sans-v17-latin-ext_latin-regular.woff2 +0 -0
- package/src/themes/typ/github.css +416 -0
- package/src/themes/typ/gothic/GUST e-foundry License.txt +29 -0
- package/src/themes/typ/gothic/didact-gothic-c-ext.woff2 +0 -0
- package/src/themes/typ/gothic/didact-gothic-c.woff2 +0 -0
- package/src/themes/typ/gothic/texgyreadventor-bold.woff +0 -0
- package/src/themes/typ/gothic/texgyreadventor-bolditalic.woff +0 -0
- package/src/themes/typ/gothic/texgyreadventor-italic.woff +0 -0
- package/src/themes/typ/gothic/texgyreadventor-regular.woff +0 -0
- package/src/themes/typ/gothic.css +410 -0
- package/src/themes/typ/newsprint/pt-serif-v11-latin-700.woff2 +0 -0
- package/src/themes/typ/newsprint/pt-serif-v11-latin-700italic.woff2 +0 -0
- package/src/themes/typ/newsprint/pt-serif-v11-latin-italic.woff2 +0 -0
- package/src/themes/typ/newsprint/pt-serif-v11-latin-regular.woff2 +0 -0
- package/src/themes/typ/newsprint.css +622 -0
- package/src/themes/typ/night/codeblock.dark.css +113 -0
- package/src/themes/typ/night/credit.html +1 -0
- package/src/themes/typ/night/cursor.png +0 -0
- package/src/themes/typ/night/cursor@2x.png +0 -0
- package/src/themes/typ/night/mermaid.dark.css +7 -0
- package/src/themes/typ/night/sourcemode.dark.css +38 -0
- package/src/themes/typ/night.css +1032 -0
- package/src/themes/typ/pixyll/lato-v14-latin-300.woff +0 -0
- package/src/themes/typ/pixyll/lato-v14-latin-300italic.woff +0 -0
- package/src/themes/typ/pixyll/lato-v14-latin-900.woff +0 -0
- package/src/themes/typ/pixyll/lato-v14-latin-900italic.woff +0 -0
- package/src/themes/typ/pixyll/merriweather-v19-latin-300.woff +0 -0
- package/src/themes/typ/pixyll/merriweather-v19-latin-300italic.woff +0 -0
- package/src/themes/typ/pixyll/merriweather-v19-latin-700.woff +0 -0
- package/src/themes/typ/pixyll/merriweather-v19-latin-700italic.woff +0 -0
- package/src/themes/typ/pixyll.css +528 -0
- package/src/themes/typ/whitey.css +299 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "this.gui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "This Graphic User Interface.",
|
|
5
5
|
"main": "dist/this-gui.umd.js",
|
|
6
6
|
"module": "dist/this-gui.es.js",
|
|
@@ -59,6 +59,9 @@
|
|
|
59
59
|
"vite": "^4.5.3"
|
|
60
60
|
},
|
|
61
61
|
"files": [
|
|
62
|
-
"dist"
|
|
62
|
+
"dist",
|
|
63
|
+
"src",
|
|
64
|
+
"README.md",
|
|
65
|
+
"package.json"
|
|
63
66
|
]
|
|
64
67
|
}
|
package/src/App.jsx
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// src/App.jsx
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { BrowserRouter as Router, Route, Switch, Link } from 'react-router-dom';
|
|
4
|
+
import { ThemeProvider } from './themes/ThemeProvider'; // Import ThemeProvider
|
|
5
|
+
|
|
6
|
+
const App = () => {
|
|
7
|
+
return (
|
|
8
|
+
<ThemeProvider>
|
|
9
|
+
<Router>
|
|
10
|
+
<Switch>
|
|
11
|
+
<Route exact path="/">
|
|
12
|
+
<div>
|
|
13
|
+
<h1>Main App</h1>
|
|
14
|
+
<Link to="/" style={{ marginRight: '20px' }}>Home</Link>
|
|
15
|
+
<Link to="/storybook" style={{ marginRight: '20px' }}>Storybook</Link>
|
|
16
|
+
</div>
|
|
17
|
+
</Route>
|
|
18
|
+
<Route path="/storybook">
|
|
19
|
+
<iframe
|
|
20
|
+
src="http://localhost:6006" // Adjust the URL based on your setup
|
|
21
|
+
style={{ width: '100%', height: '100vh', border: 'none' }}
|
|
22
|
+
title="Storybook"
|
|
23
|
+
></iframe>
|
|
24
|
+
</Route>
|
|
25
|
+
</Switch>
|
|
26
|
+
</Router>
|
|
27
|
+
</ThemeProvider>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default App;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// this.GUI/src/MDXEditor.jsx
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { MdxProvider } from './providers/MdxProvider';
|
|
4
|
+
import { ThemeProvider } from './providers/ThemeProvider';
|
|
5
|
+
import Editor from '@monaco-editor/react'; // Or any other MDX editor you prefer
|
|
6
|
+
|
|
7
|
+
const MDXEditor = () => {
|
|
8
|
+
const [content, setContent] = useState('# Your MDX here');
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<ThemeProvider>
|
|
12
|
+
<MdxProvider>
|
|
13
|
+
<div style={{ display: 'flex', height: '100vh' }}>
|
|
14
|
+
<Editor
|
|
15
|
+
height="100%"
|
|
16
|
+
defaultLanguage="mdx"
|
|
17
|
+
value={content}
|
|
18
|
+
onChange={(value) => setContent(value || '')}
|
|
19
|
+
/>
|
|
20
|
+
<div style={{ flex: 1, padding: '20px', overflow: 'auto' }}>
|
|
21
|
+
<MdxProvider>
|
|
22
|
+
{/* Live preview of the MDX content */}
|
|
23
|
+
{React.createElement(MdxProvider, {}, content)}
|
|
24
|
+
</MdxProvider>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</MdxProvider>
|
|
28
|
+
</ThemeProvider>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default MDXEditor;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//this.GUI/src/MdxProvider.jsx
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { MDXProvider } from '@mdx-js/react';
|
|
4
|
+
|
|
5
|
+
// Define custom components without inline styles
|
|
6
|
+
const components = {
|
|
7
|
+
h1: (props) => <h1 className="mdx-h1" {...props} />, // Let the theme handle the styles
|
|
8
|
+
h2: (props) => <h2 className="mdx-h2" {...props} />,
|
|
9
|
+
p: (props) => <p className="mdx-p" {...props} />,
|
|
10
|
+
a: (props) => <a className="mdx-link" {...props} />,
|
|
11
|
+
code: (props) => <code className="mdx-code" {...props} />,
|
|
12
|
+
pre: (props) => <pre className="mdx-pre" {...props} />,
|
|
13
|
+
// Add more custom components as needed, without inline styles
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const MdxProvider = ({ children }) => {
|
|
17
|
+
return <MDXProvider components={components}>{children}</MDXProvider>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default MdxProvider;
|
package/src/Theme.jsx
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// this.GUI/src/Theme.jsx
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
|
+
import { CssVarsProvider } from '@mui/joy/styles'; // Import MUI Joy's CssVarsProvider
|
|
4
|
+
import lightTheme from './themes/light'; // Import light theme
|
|
5
|
+
import darkTheme from './themes/dark'; // Import dark theme
|
|
6
|
+
|
|
7
|
+
const Theme = ({ children }) => {
|
|
8
|
+
const [theme, setTheme] = useState(localStorage.getItem('theme') || 'light');
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
localStorage.setItem('theme', theme); // Persist theme preference in localStorage
|
|
12
|
+
}, [theme]);
|
|
13
|
+
|
|
14
|
+
const currentTheme = theme === 'dark' ? darkTheme : lightTheme;
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<CssVarsProvider theme={currentTheme}> {/* Wrap with the correct theme */}
|
|
18
|
+
<div>
|
|
19
|
+
<button onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}>
|
|
20
|
+
Toggle Theme
|
|
21
|
+
</button>
|
|
22
|
+
{children}
|
|
23
|
+
</div>
|
|
24
|
+
</CssVarsProvider>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default Theme;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/components/CodeBlock.jsx
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Light as SyntaxHighlighter } from 'react-syntax-highlighter';
|
|
5
|
+
// Import the language(s) you need
|
|
6
|
+
import javascript from 'react-syntax-highlighter/dist/esm/languages/hljs/javascript';
|
|
7
|
+
// Import a syntax highlighting style
|
|
8
|
+
import { atomOneLight } from 'react-syntax-highlighter/dist/esm/styles/hljs';
|
|
9
|
+
|
|
10
|
+
SyntaxHighlighter.registerLanguage('javascript', javascript);
|
|
11
|
+
|
|
12
|
+
const CodeBlock = ({ className, children }) => {
|
|
13
|
+
const language = className ? className.replace('language-', '') : 'javascript';
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<SyntaxHighlighter language={language} style={atomOneLight}>
|
|
17
|
+
{children}
|
|
18
|
+
</SyntaxHighlighter>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default CodeBlock;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// src/components/ComponentFactory.jsx
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import GUI from '../../index';
|
|
4
|
+
|
|
5
|
+
const ComponentFactory = ({ category, subcategory, componentName, ...props }) => {
|
|
6
|
+
const Category = GUI[category];
|
|
7
|
+
|
|
8
|
+
if (!Category) {
|
|
9
|
+
console.error(`Category "${category}" not found.`);
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let Component;
|
|
14
|
+
|
|
15
|
+
if (subcategory) {
|
|
16
|
+
const Subcategory = Category[subcategory];
|
|
17
|
+
|
|
18
|
+
if (!Subcategory) {
|
|
19
|
+
console.error(`Subcategory "${subcategory}" not found in category "${category}".`);
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
Component = Subcategory[componentName];
|
|
24
|
+
} else {
|
|
25
|
+
Component = Category[componentName];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!Component) {
|
|
29
|
+
console.error(`Component "${componentName}" not found in category "${category}"${subcategory ? ` and subcategory "${subcategory}"` : ''}.`);
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return <Component {...props} />;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default ComponentFactory;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/components/ComponentRegistry.js
|
|
2
|
+
import { Button } from '../stories/_Atomic/Button/Button';
|
|
3
|
+
import { Input } from '../stories/_Atomic/Input/Input';
|
|
4
|
+
// Import the Navbar component
|
|
5
|
+
import { Navbar } from '../stories/_Molecules/Navbar/Navbar';
|
|
6
|
+
// ... import other components
|
|
7
|
+
|
|
8
|
+
const ComponentRegistry = {
|
|
9
|
+
_Atomic: {
|
|
10
|
+
Button,
|
|
11
|
+
Input,
|
|
12
|
+
// ... other atomic components
|
|
13
|
+
},
|
|
14
|
+
_Molecules: {
|
|
15
|
+
Navbar,
|
|
16
|
+
// ... other molecule components
|
|
17
|
+
},
|
|
18
|
+
// ... other categories
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default ComponentRegistry;
|
package/src/index.mdx
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import GUI from '../index';
|
|
2
|
+
|
|
3
|
+
<GUI.Molecules.Navbar
|
|
4
|
+
links={[
|
|
5
|
+
{ url: '/', label: 'Home', isActive: true },
|
|
6
|
+
{ url: '/about', label: 'About', isActive: false },
|
|
7
|
+
{ url: 'http://localhost:6006/', label: 'Storybook', isActive: false },
|
|
8
|
+
{ url: '/contact', label: 'Contact', isActive: false },
|
|
9
|
+
]}
|
|
10
|
+
logo={
|
|
11
|
+
<img src="https://suign.github.io/assets/imgs/neurons_me_logo.png" alt="Logo" style={{ height: '40px' }} />
|
|
12
|
+
}
|
|
13
|
+
userControls={
|
|
14
|
+
<GUI.Atoms.Button>Click</GUI.Atoms.Button>
|
|
15
|
+
}
|
|
16
|
+
/>
|
|
17
|
+
|
|
18
|
+
# Welcome to THIS.GUI
|
|
19
|
+
|
|
20
|
+
## Understanding MDX (Markdown + JSX)
|
|
21
|
+
This page is written in **MDX**, a powerful format that allows you to write Markdown while embedding JSX components. With MDX, you can write documentation or content using Markdown's simplicity and still interact with React components directly within the same file.
|
|
22
|
+
For example, in this document, we can use regular Markdown syntax for headings, paragraphs, and links, but we also import and use components from our `this.GUI` library.
|
|
23
|
+
|
|
24
|
+
### Key Concepts of MDX
|
|
25
|
+
- **Markdown for Content**: Regular text, links, images, and other static content can be written using Markdown.
|
|
26
|
+
- **JSX for Interactivity**: You can directly use any JSX component (like React components) within the MDX file. This makes it ideal for documentation or websites that need to showcase and render components dynamically.
|
|
27
|
+
|
|
28
|
+
## Example: Navbar Component in MDX
|
|
29
|
+
In the following example, we use the `Navbar` component from the `this.GUI` library. This demonstrates how we can integrate interactive elements within a Markdown-style document.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
```mdx
|
|
34
|
+
<GUI.Molecules.Navbar
|
|
35
|
+
links={[
|
|
36
|
+
{ url: '/', label: 'Home', isActive: true },
|
|
37
|
+
{ url: '/about', label: 'About', isActive: false },
|
|
38
|
+
{ url: 'http://localhost:6006/', label: 'Storybook', isActive: false },
|
|
39
|
+
{ url: '/contact', label: 'Contact', isActive: false },
|
|
40
|
+
]}
|
|
41
|
+
logo={
|
|
42
|
+
<img src="https://suign.github.io/assets/imgs/neurons_me_logo.png" alt="Logo" style={{ height: '40px' }} />
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
userControls={
|
|
46
|
+
<GUI.Atoms.Button>Click</GUI.Atoms.Button>
|
|
47
|
+
}
|
|
48
|
+
/>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This renders a live `Navbar` component, with links for navigation, including one to our Storybook instance.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
### How This Page is Built with MDX
|
|
56
|
+
1. **Markdown Elements**:
|
|
57
|
+
- This heading (`# Welcome to THIS.GUI`) and paragraphs you're reading are written using Markdown.
|
|
58
|
+
- Links like [Click here](https://example.com) are also written in Markdown syntax.
|
|
59
|
+
|
|
60
|
+
2. **JSX Elements**:
|
|
61
|
+
- Below, we render interactive components from `this.GUI`, such as buttons and the navbar, using JSX.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Using MDX to Showcase Components
|
|
66
|
+
MDX allows you to mix documentation with interactive elements. For instance, let's explore different types of buttons you can use with `this.GUI`. These buttons will be rendered dynamically, and their usage will be demonstrated.
|
|
67
|
+
|
|
68
|
+
### **Atomic Components Example: Buttons**
|
|
69
|
+
Below are different variations of the Button component available in `this.GUI`, along with the code examples for each.
|
|
70
|
+
|
|
71
|
+
<div>
|
|
72
|
+
{/* Primary Button */}
|
|
73
|
+
<GUI.Atoms.Button primary size="medium">Primary Button</GUI.Atoms.Button>
|
|
74
|
+
|
|
75
|
+
```jsx
|
|
76
|
+
<GUI.Atoms.Button primary size="medium">Primary Button</GUI.Atoms.Button>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
{/* Secondary Button */}
|
|
80
|
+
<GUI.Atoms.Button size="medium">Secondary Button</GUI.Atoms.Button>
|
|
81
|
+
|
|
82
|
+
```jsx
|
|
83
|
+
<GUI.Atoms.Button size="medium">Secondary Button</GUI.Atoms.Button>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
{/* No Border Button */}
|
|
87
|
+
<GUI.Atoms.Button noBorder size="medium">No Border Button</GUI.Atoms.Button>
|
|
88
|
+
|
|
89
|
+
```jsx
|
|
90
|
+
<GUI.Atoms.Button noBorder size="medium">No Border Button</GUI.Atoms.Button>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
{/* Small Primary Button */}
|
|
94
|
+
<GUI.Atoms.Button primary size="small">Small Primary Button</GUI.Atoms.Button>
|
|
95
|
+
|
|
96
|
+
```jsx
|
|
97
|
+
<GUI.Atoms.Button primary size="small">Small Primary Button</GUI.Atoms.Button>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
{/* Large No Border Button */}
|
|
101
|
+
<GUI.Atoms.Button noBorder size="large">Large No Border Button</GUI.Atoms.Button>
|
|
102
|
+
|
|
103
|
+
```jsx
|
|
104
|
+
<GUI.Atoms.Button noBorder size="large">Large No Border Button</GUI.Atoms.Button>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
{/* Custom Button Example */}
|
|
108
|
+
<GUI.Atoms.Button
|
|
109
|
+
primary
|
|
110
|
+
size="large"
|
|
111
|
+
primaryBgColor="#007bff"
|
|
112
|
+
primaryTextColor="#ffffff"
|
|
113
|
+
primaryHoverBgColor="#0056b3"
|
|
114
|
+
padding="12px 24px"
|
|
115
|
+
>
|
|
116
|
+
Custom Styled Button
|
|
117
|
+
</GUI.Atoms.Button>
|
|
118
|
+
|
|
119
|
+
```jsx
|
|
120
|
+
<GUI.Atoms.Button
|
|
121
|
+
primary
|
|
122
|
+
size="large"
|
|
123
|
+
primaryBgColor="#007bff"
|
|
124
|
+
primaryTextColor="#ffffff"
|
|
125
|
+
primaryHoverBgColor="#0056b3"
|
|
126
|
+
padding="12px 24px"
|
|
127
|
+
>
|
|
128
|
+
Custom Styled Button
|
|
129
|
+
</GUI.Atoms.Button>
|
|
130
|
+
```
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
### How to Use MDX in Your Own Projects
|
|
136
|
+
You can use MDX in your own documentation to:
|
|
137
|
+
|
|
138
|
+
- Write clear and simple documentation using Markdown.
|
|
139
|
+
- Embed interactive React components to showcase examples or provide live demos.
|
|
140
|
+
- Combine content and functionality into one coherent file.
|
|
141
|
+
|
|
142
|
+
MDX files are ideal for documentation, blog posts, or any content-heavy web pages where you also want to include interactive elements. By leveraging MDX, you're able to write once and render rich, dynamic content with ease.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
This example showcases how MDX combines the best of both Markdown and JSX, giving you the flexibility to create interactive, component-rich documentation.
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Key Changes:
|
|
150
|
+
- I've added an explanation of **MDX** and how it combines Markdown and JSX.
|
|
151
|
+
- Each button example is now enclosed in a code block to show how MDX renders both the live component and its JSX code.
|
|
152
|
+
- The file explains the concepts of MDX, making it clearer for developers and users to understand how this page was created.
|
|
153
|
+
|
|
154
|
+
This should provide a solid foundation for users exploring your project and help them understand how MDX can be used effectively.
|
package/src/main.jsx
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//this.GUI/src/mains.jsx
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import ReactDOM from 'react-dom';
|
|
4
|
+
import MDXContent from './index.mdx';
|
|
5
|
+
import MdxProvider from './MdxProvider';
|
|
6
|
+
import { ThemeProvider } from './themes/ThemeProvider'; // Import ThemeProvider
|
|
7
|
+
import './styles/global.css'; // Import the global CSS
|
|
8
|
+
|
|
9
|
+
ReactDOM.render(
|
|
10
|
+
<React.StrictMode>
|
|
11
|
+
<ThemeProvider>
|
|
12
|
+
<MdxProvider>
|
|
13
|
+
<MDXContent />
|
|
14
|
+
</MdxProvider>
|
|
15
|
+
</ThemeProvider>
|
|
16
|
+
</React.StrictMode>,
|
|
17
|
+
document.getElementById('root')
|
|
18
|
+
);
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
const components = {
|
|
2
|
+
"Atomic": {
|
|
3
|
+
"Text": ["Heading", "Paragraph", "Label", "Caption"],
|
|
4
|
+
"Interactive": [
|
|
5
|
+
"Button",
|
|
6
|
+
"Link",
|
|
7
|
+
"Icon",
|
|
8
|
+
"Checkbox",
|
|
9
|
+
"RadioButton",
|
|
10
|
+
"Toggle",
|
|
11
|
+
"TextInput",
|
|
12
|
+
"TextArea",
|
|
13
|
+
"Select",
|
|
14
|
+
"Slider",
|
|
15
|
+
"RangeInput"
|
|
16
|
+
],
|
|
17
|
+
"Media": ["Image", "Video", "Audio", "Icon"],
|
|
18
|
+
"Visual": [
|
|
19
|
+
"Divider",
|
|
20
|
+
"Spacer",
|
|
21
|
+
"Tooltip",
|
|
22
|
+
"Badge",
|
|
23
|
+
"Tag"
|
|
24
|
+
],
|
|
25
|
+
"Feedback": [
|
|
26
|
+
"Loader",
|
|
27
|
+
"Spinner",
|
|
28
|
+
"ProgressBar",
|
|
29
|
+
"Alert",
|
|
30
|
+
"Snackbar"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
"Molecules": {
|
|
35
|
+
"FormElements": [
|
|
36
|
+
"InputGroup",
|
|
37
|
+
"InputWithLabel",
|
|
38
|
+
"SearchBar",
|
|
39
|
+
"FileUpload",
|
|
40
|
+
"FormField"
|
|
41
|
+
],
|
|
42
|
+
"ButtonsWithIcons": [
|
|
43
|
+
"IconButton",
|
|
44
|
+
"ButtonGroup"
|
|
45
|
+
],
|
|
46
|
+
"MediaMolecules": [
|
|
47
|
+
"ImageWithCaption",
|
|
48
|
+
"VideoWithDescription",
|
|
49
|
+
"AvatarWithName",
|
|
50
|
+
"AudioPlayer"
|
|
51
|
+
],
|
|
52
|
+
"FeedbackMolecules": [
|
|
53
|
+
"Notification",
|
|
54
|
+
"Modal"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
"Organisms": {
|
|
59
|
+
"Forms": [
|
|
60
|
+
"SignInForm",
|
|
61
|
+
"RegistrationForm",
|
|
62
|
+
"ContactForm"
|
|
63
|
+
],
|
|
64
|
+
"ContentDisplay": [
|
|
65
|
+
"Card",
|
|
66
|
+
"MediaCard",
|
|
67
|
+
"List",
|
|
68
|
+
"Accordion"
|
|
69
|
+
],
|
|
70
|
+
"Navigation": [
|
|
71
|
+
"Navbar",
|
|
72
|
+
"Sidebar",
|
|
73
|
+
"Breadcrumbs"
|
|
74
|
+
],
|
|
75
|
+
"MediaCollections": [
|
|
76
|
+
"ImageGallery",
|
|
77
|
+
"VideoPlaylist",
|
|
78
|
+
"Carousel"
|
|
79
|
+
],
|
|
80
|
+
"Tables": [
|
|
81
|
+
"DataTable",
|
|
82
|
+
"PricingTable",
|
|
83
|
+
"ComparisonTable"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
"Layout": {
|
|
88
|
+
"Grid": ["Grid"],
|
|
89
|
+
"Section": ["Section"],
|
|
90
|
+
"FlexboxLayout": ["Flexbox"],
|
|
91
|
+
"NavigationAndMenus": [
|
|
92
|
+
"Header",
|
|
93
|
+
"Footer",
|
|
94
|
+
"DropdownMenu",
|
|
95
|
+
"Pagination"
|
|
96
|
+
],
|
|
97
|
+
"ContentOrganization": [
|
|
98
|
+
"Sidebar",
|
|
99
|
+
"Tabs",
|
|
100
|
+
"Accordion"
|
|
101
|
+
],
|
|
102
|
+
"HeroSections": [
|
|
103
|
+
"HeroBanner",
|
|
104
|
+
"HeroImageVideo"
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
"Templates": {
|
|
109
|
+
"LandingPages": [
|
|
110
|
+
"HeroSection",
|
|
111
|
+
"FeaturesList",
|
|
112
|
+
"CallToAction",
|
|
113
|
+
"Testimonials"
|
|
114
|
+
],
|
|
115
|
+
"DashboardLayouts": [
|
|
116
|
+
"AdminDashboard",
|
|
117
|
+
"SidebarTopNav"
|
|
118
|
+
],
|
|
119
|
+
"ECommercePages": [
|
|
120
|
+
"ProductPage",
|
|
121
|
+
"ShoppingCart"
|
|
122
|
+
],
|
|
123
|
+
"AuthenticationPages": [
|
|
124
|
+
"SignInPage",
|
|
125
|
+
"RegistrationPage"
|
|
126
|
+
],
|
|
127
|
+
"ContactUsPages": [
|
|
128
|
+
"FormSection",
|
|
129
|
+
"LocationInfo",
|
|
130
|
+
"SocialMediaLinks"
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
"Pages": {
|
|
135
|
+
"HomePage": ["HomePage"],
|
|
136
|
+
"AboutUsPage": ["AboutUsPage"],
|
|
137
|
+
"ContactUsPage": ["ContactUsPage"],
|
|
138
|
+
"UserProfilePage": ["UserProfilePage"],
|
|
139
|
+
"ProductDetailPage": ["ProductDetailPage"],
|
|
140
|
+
"CheckoutPage": ["CheckoutPage"],
|
|
141
|
+
"BlogPage": ["BlogPage"],
|
|
142
|
+
"AdminDashboard": ["AdminDashboard"],
|
|
143
|
+
"SearchResultsPage": ["SearchResultsPage"]
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
"Miscellaneous": {
|
|
147
|
+
"TooltipsPopovers": [
|
|
148
|
+
"Tooltip",
|
|
149
|
+
"Popover"
|
|
150
|
+
],
|
|
151
|
+
"Overlays": [
|
|
152
|
+
"ModalWindow",
|
|
153
|
+
"Drawer"
|
|
154
|
+
],
|
|
155
|
+
"SearchComponents": [
|
|
156
|
+
"SearchBox",
|
|
157
|
+
"Autocomplete"
|
|
158
|
+
],
|
|
159
|
+
"MediaAndContentControls": [
|
|
160
|
+
"AudioControls",
|
|
161
|
+
"VideoControls",
|
|
162
|
+
"Filters"
|
|
163
|
+
],
|
|
164
|
+
"InteractiveMaps": ["Map"]
|
|
165
|
+
}
|
|
166
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/scripts/logASCIIArt.js
|
|
2
|
+
import figlet from 'figlet';
|
|
3
|
+
|
|
4
|
+
function logASCIIArt() {
|
|
5
|
+
console.log(figlet.textSync('This.GUI', {
|
|
6
|
+
font: 'Big', // Choose a style like 'Big', 'Standard', etc.
|
|
7
|
+
horizontalLayout: 'default',
|
|
8
|
+
verticalLayout: 'default'
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
logASCIIArt(); // This calls the function when the script is executed
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// this.GUI/scripts/postinstall.js
|
|
2
|
+
import { mkdir, writeFile, access } from 'fs/promises';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
|
|
6
|
+
// Get the current directory path
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = join(__filename, '..', '..');
|
|
9
|
+
|
|
10
|
+
// Define paths for directories
|
|
11
|
+
const guiDir = join(__dirname, '..', 'GUI');
|
|
12
|
+
const componentsDir = join(guiDir, 'components');
|
|
13
|
+
const mdxDir = join(guiDir, 'mdx');
|
|
14
|
+
const stylesDir = join(guiDir, 'styles');
|
|
15
|
+
|
|
16
|
+
// Helper function to create directories
|
|
17
|
+
async function createDir(dirPath) {
|
|
18
|
+
try {
|
|
19
|
+
await access(dirPath);
|
|
20
|
+
console.log(`Directory already exists: ${dirPath}`);
|
|
21
|
+
} catch {
|
|
22
|
+
await mkdir(dirPath, { recursive: true });
|
|
23
|
+
console.log(`Created: ${dirPath}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Helper function to create initial files if they don't exist
|
|
28
|
+
async function initializeFiles() {
|
|
29
|
+
const mdxWelcomeFile = join(mdxDir, 'Welcome.mdx');
|
|
30
|
+
const stylesFile = join(stylesDir, 'global.css');
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
await access(mdxWelcomeFile);
|
|
34
|
+
console.log(`File already exists: ${mdxWelcomeFile}`);
|
|
35
|
+
} catch {
|
|
36
|
+
await writeFile(
|
|
37
|
+
mdxWelcomeFile,
|
|
38
|
+
`# Welcome to Your Custom GUI\n\nThis is your first MDX file. Edit it to start building your pages!`
|
|
39
|
+
);
|
|
40
|
+
console.log(`Created: ${mdxWelcomeFile}`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
await access(stylesFile);
|
|
45
|
+
console.log(`File already exists: ${stylesFile}`);
|
|
46
|
+
} catch {
|
|
47
|
+
await writeFile(
|
|
48
|
+
stylesFile,
|
|
49
|
+
`/* Add your custom styles here */\nbody { font-family: 'Roboto', sans-serif; }`
|
|
50
|
+
);
|
|
51
|
+
console.log(`Created: ${stylesFile}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Create the directory structure and initialize files
|
|
56
|
+
(async () => {
|
|
57
|
+
await createDir(guiDir);
|
|
58
|
+
await createDir(componentsDir);
|
|
59
|
+
await createDir(mdxDir);
|
|
60
|
+
await createDir(stylesDir);
|
|
61
|
+
await initializeFiles();
|
|
62
|
+
|
|
63
|
+
console.log('this.GUI setup complete!');
|
|
64
|
+
})();
|