this.gui 0.0.0 → 0.0.2

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/README.md CHANGED
@@ -0,0 +1,15 @@
1
+ Consistent Theming: By wrapping MUI or any other UI framework inside your GUI package, you can set a consistent theme, typography, and other styles that will be common across all the apps where you use this package. This ensures brand consistency.
2
+
3
+ Custom Components: You can build upon MUI components to create higher-level components tailored for your needs. For instance, you might have a custom UserAvatar component that integrates with your user system or a DataGrid tailored for your backend's data format.
4
+
5
+ Integrated Logic: The GUI package can contain not just visual components but also logic. For instance, a LoginForm component can have integrated authentication logic that talks to your backend directly. This simplifies the usage in actual apps.
6
+
7
+ Utilities & Helpers: Apart from components, you can also have utility functions and hooks. For instance, a useUser() hook that fetches and manages the user's state.
8
+
9
+ Extendability: You can set up your GUI package in a way that while it provides a default theme and behavior, individual projects can customize or extend them as needed.
10
+
11
+ Version Control: Changes in the UI/UX can be versioned. If you update a component's look or behavior in the GUI package and bump the version, you can choose when to adopt these changes in your various projects by updating the package version.
12
+
13
+ Documentation: You can maintain a single documentation site/source for your custom GUI package, making it easier for your team (and potentially third-party developers) to understand and use your components.
14
+
15
+ Dependency Management: With a single GUI package, you can manage the versions of MUI or other dependencies in one place. This can make updates and maintenance easier, especially if breaking changes are introduced in the UI libraries you depend on.
@@ -0,0 +1,3 @@
1
+ {
2
+ "presets": ["@babel/preset-env", "@babel/preset-react"]
3
+ }
package/index.js ADDED
File without changes
package/jsdoc.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "source": {
3
+ "include": ["./src", "./src/index.ts"],
4
+ "includePattern": "\\.(js|jsx|ts|tsx)$",
5
+ "excludePattern": "(node_modules/|docs)"
6
+ },
7
+ "opts": {
8
+ "destination": "./docs",
9
+ "template": "../../../../../Sandbox/dev_tools/assets/better-docs",
10
+ "readme": "./README.md"
11
+ },
12
+ "templates": {
13
+ "cleverLinks": false,
14
+ "monospaceLinks": false,
15
+ "search": true,
16
+ "default": {
17
+ "staticFiles": {
18
+ "include": [
19
+ "./README.md"
20
+ ]
21
+ }
22
+ },
23
+ "better-docs": {
24
+ "name": "This.GUI",
25
+ "title": "Docs for this.GUI",
26
+ "css": "style.css",
27
+ "trackingCode": "-",
28
+ "hideGenerator": false,
29
+ "navLinks": [
30
+ {
31
+ "label": "All.This",
32
+ "href": "https://suign.github.io/all.this/"
33
+ },
34
+ {
35
+ "label": "@Source",
36
+ "href": "https://suign.github.io/"
37
+ },
38
+ {
39
+ "label": "Github",
40
+ "href": "https://github.com/suiGn/cleaker"
41
+ },
42
+ {
43
+ "label": "Cleaker.me",
44
+ "href": "https://cleaker.me"
45
+ },
46
+ {
47
+ "label": "What is all.this?",
48
+ "href": "https://www.neurons.me/this"
49
+ }
50
+ ]
51
+ }
52
+ }
53
+ }
package/package.json CHANGED
@@ -1,27 +1,48 @@
1
1
  {
2
- "dependencies": {
3
- "@emotion/react": "latest",
4
- "@emotion/styled": "latest",
5
- "@mui/icons-material": "latest",
6
- "@mui/joy": "latest",
7
- "@mui/material": "latest",
8
- "@types/react": "latest",
9
- "@types/react-dom": "latest",
10
- "react": "latest",
11
- "react-dom": "latest",
12
- "typescript": "latest"
13
- },
14
- "description": "https://github.com/mui/material-ui/blob/v5.14.10/docs/data/joy/templates/messages/App.tsx",
15
- "devDependencies": {
16
- "react-scripts": "latest"
2
+ "name": "this.gui",
3
+ "version": "0.0.2",
4
+ "description": "This Graphic User Interface.",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/suiGn/GUI.git"
17
10
  },
18
- "main": "index.tsx",
19
11
  "scripts": {
20
- "start": "react-scripts start",
21
- "build": "react-scripts build",
22
- "test": "react-scripts test --env=jsdom",
23
- "eject": "react-scripts eject"
12
+ "build": "tsc",
13
+ "test": "jest"
24
14
  },
25
- "name": "this.gui",
26
- "version": "0.0.0"
27
- }
15
+ "homepage": "https://www.npmjs.com/package/this.gui",
16
+ "docs": "https://suiGn.github.io/GUI",
17
+ "author": "suiGn",
18
+ "license": "MIT",
19
+ "repoType": "NPM Package",
20
+ "devDependencies": {
21
+ "@babel/core": "^7.23.6",
22
+ "@babel/preset-env": "^7.23.6",
23
+ "@babel/preset-react": "^7.23.3",
24
+ "@testing-library/jest-dom": "^6.1.6",
25
+ "@testing-library/react": "^14.1.2",
26
+ "@types/jest": "^29.5.11",
27
+ "@types/react": "^18.2.46",
28
+ "@types/react-dom": "^18.2.18",
29
+ "@types/testing-library__react": "^10.2.0",
30
+ "babel-jest": "^29.7.0",
31
+ "jest": "^29.7.0",
32
+ "jest-environment-jsdom": "^29.7.0",
33
+ "jsdom": "^23.0.1",
34
+ "ts-jest": "^29.1.1",
35
+ "typedoc": "^0.25.4",
36
+ "typedoc-material-theme": "^1.0.1",
37
+ "typescript": "^5.3.3"
38
+ },
39
+ "dependencies": {
40
+ "@emotion/react": "^11.11.3",
41
+ "@emotion/styled": "^11.11.0",
42
+ "@fontsource/inter": "^5.0.16",
43
+ "@mui/joy": "^5.0.0-beta.20",
44
+ "@mui/material": "^5.15.2",
45
+ "react": "^18.2.0",
46
+ "react-dom": "^18.2.0"
47
+ }
48
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es5", // Specify ECMAScript target version
4
+ "module": "commonjs", // Specify module code generation
5
+ "lib": ["es6", "dom"], // Specify library files to be included in the compilation
6
+ "sourceMap": true, // Generates corresponding '.map' file
7
+ "outDir": "./dist", // Redirect output structure to the directory
8
+ "rootDir": "./src", // Specify the root directory of input files
9
+ "strict": true, // Enable all strict type-checking options
10
+ "noImplicitAny": true, // Raise error on expressions and declarations with an implied 'any' type
11
+ "moduleResolution": "node", // Select module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)
12
+ "esModuleInterop": true, // Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports
13
+ "skipLibCheck": true, // Skip type checking of declaration files
14
+ "forceConsistentCasingInFileNames": true, // Disallow inconsistently-cased references to the same file
15
+ "jsx": "react" // Support JSX in '.tsx' files: 'preserve', 'react-native', or 'react'
16
+ },
17
+ "include": ["src/**/*"],
18
+ "exclude": ["node_modules", "tests", "dist"]
19
+ }
package/typedoc.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "theme": "default",
3
+ "entryPoints": ["src/index.ts"],
4
+ "out": "./docs",
5
+ "exclude": ["**/node_modules/**"],
6
+ "readme": "README.md",
7
+ "includeVersion": true, // Include TypeScript version in the generated documentation
8
+ "excludeExternals": true, // Exclude external dependencies from documentation
9
+ "excludePrivate": true, // Exclude private members from documentation
10
+ "excludeProtected": true, // Exclude protected members from documentation
11
+ "tsconfig": "tsconfig.json" // Path to your TypeScript configuration file
12
+ }
13
+
Binary file
package/public/index.html DELETED
@@ -1,38 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6
- <meta name="theme-color" content="#000000">
7
- <!--
8
- manifest.json provides metadata used when your web app is added to the
9
- homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
10
- -->
11
- <link rel="manifest" href="%PUBLIC_URL%/manifest.json">
12
- <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
13
- <!--
14
- Notice the use of %PUBLIC_URL% in the tags above.
15
- It will be replaced with the URL of the `public` folder during the build.
16
- Only files inside the `public` folder can be referenced from the HTML.
17
-
18
- Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
19
- work correctly both with client-side routing and a non-root public URL.
20
- Learn how to configure a non-root public URL by running `npm run build`.
21
- -->
22
- <title>React App</title>
23
-
24
- </head>
25
- <body>
26
- <div id="root"></div>
27
- <!--
28
- This HTML file is a template.
29
- If you open it directly in the browser, you will see an empty page.
30
-
31
- You can add webfonts, meta tags, or analytics to this file.
32
- The build step will place the bundled scripts into the <body> tag.
33
-
34
- To begin the development, run `npm start` or `yarn start`.
35
- To create a production bundle, use `npm run build` or `yarn build`.
36
- -->
37
- </body>
38
- </html>
@@ -1,15 +0,0 @@
1
- {
2
- "short_name": "React App",
3
- "name": "Create React App Sample",
4
- "icons": [
5
- {
6
- "src": "favicon.ico",
7
- "sizes": "192x192",
8
- "type": "image/png"
9
- }
10
- ],
11
- "start_url": "./index.html",
12
- "display": "standalone",
13
- "theme_color": "#000000",
14
- "background_color": "#ffffff"
15
- }
package/src/App.tsx DELETED
@@ -1,22 +0,0 @@
1
- import * as React from 'react';
2
- import { CssVarsProvider } from '@mui/joy/styles';
3
- import CssBaseline from '@mui/joy/CssBaseline';
4
- import Box from '@mui/joy/Box';
5
- import Sidebar from './components/Sidebar';
6
- import Header from './components/Header';
7
- import MyMessages from './components/MyMessages';
8
-
9
- export default function JoyMessagesTemplate() {
10
- return (
11
- <CssVarsProvider disableTransitionOnChange>
12
- <CssBaseline />
13
- <Box sx={{ display: 'flex', minHeight: '100dvh' }}>
14
- <Sidebar />
15
- <Header />
16
- <Box component="main" className="MainContent" sx={{ flex: 1 }}>
17
- <MyMessages />
18
- </Box>
19
- </Box>
20
- </CssVarsProvider>
21
- );
22
- }
@@ -1,26 +0,0 @@
1
- import * as React from 'react';
2
- import Badge from '@mui/joy/Badge';
3
- import Avatar, { AvatarProps } from '@mui/joy/Avatar';
4
-
5
- type AvatarWithStatusProps = AvatarProps & {
6
- online?: boolean;
7
- };
8
-
9
- export default function AvatarWithStatus({
10
- online = false,
11
- ...rest
12
- }: AvatarWithStatusProps) {
13
- return (
14
- <div>
15
- <Badge
16
- color={online ? 'success' : 'neutral'}
17
- variant={online ? 'solid' : 'soft'}
18
- size="sm"
19
- anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}
20
- badgeInset="4px 4px"
21
- >
22
- <Avatar size="sm" {...rest} />
23
- </Badge>
24
- </div>
25
- );
26
- }
@@ -1,135 +0,0 @@
1
- import * as React from 'react';
2
- import Avatar from '@mui/joy/Avatar';
3
- import Box from '@mui/joy/Box';
4
- import IconButton from '@mui/joy/IconButton';
5
- import Stack from '@mui/joy/Stack';
6
- import Sheet from '@mui/joy/Sheet';
7
- import Typography from '@mui/joy/Typography';
8
- import CelebrationOutlinedIcon from '@mui/icons-material/CelebrationOutlined';
9
- import FavoriteBorderIcon from '@mui/icons-material/FavoriteBorder';
10
- import InsertDriveFileRoundedIcon from '@mui/icons-material/InsertDriveFileRounded';
11
- import { MessageProps } from '../types';
12
-
13
- type ChatBubbleProps = MessageProps & {
14
- variant: 'sent' | 'received';
15
- };
16
-
17
- export default function ChatBubble({
18
- content,
19
- variant,
20
- timestamp,
21
- attachment = undefined,
22
- sender,
23
- }: ChatBubbleProps) {
24
- const isSent = variant === 'sent';
25
- const [isHovered, setIsHovered] = React.useState<boolean>(false);
26
- const [isLiked, setIsLiked] = React.useState<boolean>(false);
27
- const [isCelebrated, setIsCelebrated] = React.useState<boolean>(false);
28
- return (
29
- <Box sx={{ maxWidth: '60%', minWidth: 'auto' }}>
30
- <Stack
31
- direction="row"
32
- justifyContent="space-between"
33
- spacing={2}
34
- sx={{ mb: 0.25 }}
35
- >
36
- <Typography level="body-xs">
37
- {sender === 'You' ? sender : sender.name}
38
- </Typography>
39
- <Typography level="body-xs">{timestamp}</Typography>
40
- </Stack>
41
- {attachment ? (
42
- <Sheet
43
- variant="outlined"
44
- sx={{
45
- px: 1.75,
46
- py: 1.25,
47
- borderRadius: 'lg',
48
- borderTopRightRadius: isSent ? 0 : 'lg',
49
- borderTopLeftRadius: isSent ? 'lg' : 0,
50
- }}
51
- >
52
- <Stack direction="row" spacing={1.5} alignItems="center">
53
- <Avatar color="primary" size="lg">
54
- <InsertDriveFileRoundedIcon />
55
- </Avatar>
56
- <div>
57
- <Typography fontSize="sm">{attachment.fileName}</Typography>
58
- <Typography level="body-sm">{attachment.size}</Typography>
59
- </div>
60
- </Stack>
61
- </Sheet>
62
- ) : (
63
- <Box
64
- sx={{ position: 'relative' }}
65
- onMouseEnter={() => setIsHovered(true)}
66
- onMouseLeave={() => setIsHovered(false)}
67
- >
68
- <Sheet
69
- color={isSent ? 'primary' : 'neutral'}
70
- variant={isSent ? 'solid' : 'soft'}
71
- sx={{
72
- p: 1.25,
73
- borderRadius: 'lg',
74
- borderTopRightRadius: isSent ? 0 : 'lg',
75
- borderTopLeftRadius: isSent ? 'lg' : 0,
76
- backgroundColor: isSent
77
- ? 'var(--joy-palette-primary-solidBg)'
78
- : 'background.body',
79
- }}
80
- >
81
- <Typography
82
- level="body-sm"
83
- sx={{
84
- color: isSent
85
- ? 'var(--joy-palette-common-white)'
86
- : 'var(--joy-palette-text-primary)',
87
- }}
88
- >
89
- {content}
90
- </Typography>
91
- </Sheet>
92
- {(isHovered || isLiked || isCelebrated) && (
93
- <Stack
94
- direction="row"
95
- justifyContent={isSent ? 'flex-end' : 'flex-start'}
96
- spacing={0.5}
97
- sx={{
98
- position: 'absolute',
99
- top: '50%',
100
- p: 1.5,
101
- ...(isSent
102
- ? {
103
- left: 0,
104
- transform: 'translate(-100%, -50%)',
105
- }
106
- : {
107
- right: 0,
108
- transform: 'translate(100%, -50%)',
109
- }),
110
- }}
111
- >
112
- <IconButton
113
- variant={isLiked ? 'soft' : 'plain'}
114
- color={isLiked ? 'danger' : 'neutral'}
115
- size="sm"
116
- onClick={() => setIsLiked((prevState) => !prevState)}
117
- >
118
- {isLiked ? '❤️' : <FavoriteBorderIcon />}
119
- </IconButton>
120
-
121
- <IconButton
122
- variant={isCelebrated ? 'soft' : 'plain'}
123
- color={isCelebrated ? 'warning' : 'neutral'}
124
- size="sm"
125
- onClick={() => setIsCelebrated((prevState) => !prevState)}
126
- >
127
- {isCelebrated ? '🎉' : <CelebrationOutlinedIcon />}
128
- </IconButton>
129
- </Stack>
130
- )}
131
- </Box>
132
- )}
133
- </Box>
134
- );
135
- }
@@ -1,87 +0,0 @@
1
- import * as React from 'react';
2
- import Box from '@mui/joy/Box';
3
- import ListDivider from '@mui/joy/ListDivider';
4
- import ListItem from '@mui/joy/ListItem';
5
- import ListItemButton, { ListItemButtonProps } from '@mui/joy/ListItemButton';
6
- import Stack from '@mui/joy/Stack';
7
- import Typography from '@mui/joy/Typography';
8
- import CircleIcon from '@mui/icons-material/Circle';
9
- import AvatarWithStatus from './AvatarWithStatus';
10
- import { ChatProps, MessageProps, UserProps } from '../types';
11
- import { toggleMessagesPane } from '../utils';
12
-
13
- type ChatListItemProps = ListItemButtonProps & {
14
- id: string;
15
- unread?: boolean;
16
- sender: UserProps;
17
- messages: MessageProps[];
18
- selectedChatId?: string;
19
- setSelectedChat: (chat: ChatProps) => void;
20
- };
21
-
22
- export default function ChatListItem({
23
- id,
24
- sender,
25
- messages,
26
- selectedChatId,
27
- setSelectedChat,
28
- }: ChatListItemProps) {
29
- const selected = selectedChatId === id;
30
- return (
31
- <React.Fragment>
32
- <ListItem>
33
- <ListItemButton
34
- onClick={() => {
35
- toggleMessagesPane();
36
- setSelectedChat({ id, sender, messages });
37
- }}
38
- selected={selected}
39
- color="neutral"
40
- sx={{
41
- flexDirection: 'column',
42
- alignItems: 'initial',
43
- gap: 1,
44
- }}
45
- >
46
- <Stack direction="row" spacing={1.5}>
47
- <AvatarWithStatus online={sender.online} src={sender.avatar} />
48
- <Box sx={{ flex: 1 }}>
49
- <Typography level="title-sm">{sender.name}</Typography>
50
- <Typography level="body-sm">{sender.username}</Typography>
51
- </Box>
52
- <Box
53
- sx={{
54
- lineHeight: 1.5,
55
- textAlign: 'right',
56
- }}
57
- >
58
- {messages[0].unread && (
59
- <CircleIcon sx={{ fontSize: 12 }} color="primary" />
60
- )}
61
- <Typography
62
- level="body-xs"
63
- display={{ xs: 'none', md: 'block' }}
64
- noWrap
65
- >
66
- 5 mins ago
67
- </Typography>
68
- </Box>
69
- </Stack>
70
- <Typography
71
- level="body-sm"
72
- sx={{
73
- display: '-webkit-box',
74
- WebkitLineClamp: '2',
75
- WebkitBoxOrient: 'vertical',
76
- overflow: 'hidden',
77
- textOverflow: 'ellipsis',
78
- }}
79
- >
80
- {messages[0].content}
81
- </Typography>
82
- </ListItemButton>
83
- </ListItem>
84
- <ListDivider sx={{ margin: 0 }} />
85
- </React.Fragment>
86
- );
87
- }
@@ -1,110 +0,0 @@
1
- import * as React from 'react';
2
- import Stack from '@mui/joy/Stack';
3
- import Sheet from '@mui/joy/Sheet';
4
- import Typography from '@mui/joy/Typography';
5
- import { Box, Chip, IconButton, Input } from '@mui/joy';
6
- import List from '@mui/joy/List';
7
- import EditNoteRoundedIcon from '@mui/icons-material/EditNoteRounded';
8
- import SearchRoundedIcon from '@mui/icons-material/SearchRounded';
9
- import CloseRoundedIcon from '@mui/icons-material/CloseRounded';
10
- import ChatListItem from './ChatListItem';
11
- import { ChatProps } from '../types';
12
- import { toggleMessagesPane } from '../utils';
13
-
14
- type ChatsPaneProps = {
15
- chats: ChatProps[];
16
- setSelectedChat: (chat: ChatProps) => void;
17
- selectedChatId: string;
18
- };
19
-
20
- export default function ChatsPane({
21
- chats,
22
- setSelectedChat,
23
- selectedChatId,
24
- }: ChatsPaneProps) {
25
- return (
26
- <Sheet
27
- sx={{
28
- borderRight: '1px solid',
29
- borderColor: 'divider',
30
- height: 'calc(100dvh - var(--Header-height))',
31
- overflowY: 'auto',
32
- }}
33
- >
34
- <Stack
35
- direction="row"
36
- spacing={1}
37
- alignItems="center"
38
- justifyContent="space-between"
39
- p={2}
40
- pb={1.5}
41
- >
42
- <Typography
43
- fontSize={{ xs: 'md', md: 'lg' }}
44
- component="h1"
45
- fontWeight="lg"
46
- endDecorator={
47
- <Chip
48
- variant="soft"
49
- color="primary"
50
- size="md"
51
- slotProps={{ root: { component: 'span' } }}
52
- >
53
- 4
54
- </Chip>
55
- }
56
- sx={{ mr: 'auto' }}
57
- >
58
- Messages
59
- </Typography>
60
-
61
- <IconButton
62
- variant="plain"
63
- aria-label="edit"
64
- color="neutral"
65
- size="sm"
66
- sx={{ display: { xs: 'none', sm: 'unset' } }}
67
- >
68
- <EditNoteRoundedIcon />
69
- </IconButton>
70
-
71
- <IconButton
72
- variant="plain"
73
- aria-label="edit"
74
- color="neutral"
75
- size="sm"
76
- onClick={() => {
77
- toggleMessagesPane();
78
- }}
79
- sx={{ display: { sm: 'none' } }}
80
- >
81
- <CloseRoundedIcon />
82
- </IconButton>
83
- </Stack>
84
- <Box sx={{ px: 2, pb: 1.5 }}>
85
- <Input
86
- size="sm"
87
- startDecorator={<SearchRoundedIcon />}
88
- placeholder="Search"
89
- aria-label="Search"
90
- />
91
- </Box>
92
- <List
93
- sx={{
94
- py: 0,
95
- '--ListItem-paddingY': '0.75rem',
96
- '--ListItem-paddingX': '1rem',
97
- }}
98
- >
99
- {chats.map((chat) => (
100
- <ChatListItem
101
- key={chat.id}
102
- {...chat}
103
- setSelectedChat={setSelectedChat}
104
- selectedChatId={selectedChatId}
105
- />
106
- ))}
107
- </List>
108
- </Sheet>
109
- );
110
- }