@stoked-ui/github 0.0.0-a.0

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 (95) hide show
  1. package/CHANGELOG.md +15014 -0
  2. package/GithubCalendar/GithubCalendar.d.ts +7 -0
  3. package/GithubCalendar/GithubCalendar.js +330 -0
  4. package/GithubCalendar/index.d.ts +2 -0
  5. package/GithubCalendar/index.js +2 -0
  6. package/GithubCalendar/package.json +6 -0
  7. package/GithubEvents/EventTypes/CreateEvent.d.ts +7 -0
  8. package/GithubEvents/EventTypes/CreateEvent.js +72 -0
  9. package/GithubEvents/EventTypes/DeleteEvent.d.ts +7 -0
  10. package/GithubEvents/EventTypes/DeleteEvent.js +65 -0
  11. package/GithubEvents/EventTypes/ForkEvent.d.ts +7 -0
  12. package/GithubEvents/EventTypes/ForkEvent.js +77 -0
  13. package/GithubEvents/EventTypes/IssueCommentEvent.d.ts +7 -0
  14. package/GithubEvents/EventTypes/IssueCommentEvent.js +210 -0
  15. package/GithubEvents/EventTypes/IssuesEvent.d.ts +7 -0
  16. package/GithubEvents/EventTypes/IssuesEvent.js +97 -0
  17. package/GithubEvents/EventTypes/ProjectsV2ColumnEvent.d.ts +7 -0
  18. package/GithubEvents/EventTypes/ProjectsV2ColumnEvent.js +69 -0
  19. package/GithubEvents/EventTypes/ProjectsV2Event.d.ts +7 -0
  20. package/GithubEvents/EventTypes/ProjectsV2Event.js +74 -0
  21. package/GithubEvents/EventTypes/ProjectsV2FieldEvent.d.ts +7 -0
  22. package/GithubEvents/EventTypes/ProjectsV2FieldEvent.js +77 -0
  23. package/GithubEvents/EventTypes/ProjectsV2ItemEvent.d.ts +7 -0
  24. package/GithubEvents/EventTypes/ProjectsV2ItemEvent.js +79 -0
  25. package/GithubEvents/EventTypes/PullRequest/CommitsList.d.ts +17 -0
  26. package/GithubEvents/EventTypes/PullRequest/CommitsList.js +99 -0
  27. package/GithubEvents/EventTypes/PullRequest/FileChanges.d.ts +17 -0
  28. package/GithubEvents/EventTypes/PullRequest/FileChanges.js +182 -0
  29. package/GithubEvents/EventTypes/PullRequest/PullRequestEvent.d.ts +8 -0
  30. package/GithubEvents/EventTypes/PullRequest/PullRequestEvent.js +374 -0
  31. package/GithubEvents/EventTypes/PullRequest/PullRequestView.d.ts +29 -0
  32. package/GithubEvents/EventTypes/PullRequest/PullRequestView.js +132 -0
  33. package/GithubEvents/EventTypes/PushEvent.d.ts +7 -0
  34. package/GithubEvents/EventTypes/PushEvent.js +106 -0
  35. package/GithubEvents/GithubEvents.d.ts +49 -0
  36. package/GithubEvents/GithubEvents.js +1454 -0
  37. package/GithubEvents/index.d.ts +2 -0
  38. package/GithubEvents/index.js +2 -0
  39. package/GithubEvents/package.json +6 -0
  40. package/LICENSE +21 -0
  41. package/README.md +29 -0
  42. package/apiHandlers/getPullRequestDetails.d.ts +7 -0
  43. package/apiHandlers/getPullRequestDetails.js +120 -0
  44. package/apiHandlers/index.d.ts +1 -0
  45. package/apiHandlers/index.js +1 -0
  46. package/apiHandlers/package.json +6 -0
  47. package/index.d.ts +3 -0
  48. package/index.js +10 -0
  49. package/modern/GithubCalendar/GithubCalendar.js +330 -0
  50. package/modern/GithubCalendar/index.js +2 -0
  51. package/modern/GithubEvents/EventTypes/CreateEvent.js +72 -0
  52. package/modern/GithubEvents/EventTypes/DeleteEvent.js +65 -0
  53. package/modern/GithubEvents/EventTypes/ForkEvent.js +77 -0
  54. package/modern/GithubEvents/EventTypes/IssueCommentEvent.js +210 -0
  55. package/modern/GithubEvents/EventTypes/IssuesEvent.js +97 -0
  56. package/modern/GithubEvents/EventTypes/ProjectsV2ColumnEvent.js +69 -0
  57. package/modern/GithubEvents/EventTypes/ProjectsV2Event.js +74 -0
  58. package/modern/GithubEvents/EventTypes/ProjectsV2FieldEvent.js +77 -0
  59. package/modern/GithubEvents/EventTypes/ProjectsV2ItemEvent.js +79 -0
  60. package/modern/GithubEvents/EventTypes/PullRequest/CommitsList.js +99 -0
  61. package/modern/GithubEvents/EventTypes/PullRequest/FileChanges.js +182 -0
  62. package/modern/GithubEvents/EventTypes/PullRequest/PullRequestEvent.js +374 -0
  63. package/modern/GithubEvents/EventTypes/PullRequest/PullRequestView.js +132 -0
  64. package/modern/GithubEvents/EventTypes/PushEvent.js +106 -0
  65. package/modern/GithubEvents/GithubEvents.js +1454 -0
  66. package/modern/GithubEvents/index.js +2 -0
  67. package/modern/apiHandlers/getPullRequestDetails.js +120 -0
  68. package/modern/apiHandlers/index.js +1 -0
  69. package/modern/index.js +10 -0
  70. package/modern/types/github.js +1 -0
  71. package/node/GithubCalendar/GithubCalendar.js +337 -0
  72. package/node/GithubCalendar/index.js +9 -0
  73. package/node/GithubEvents/EventTypes/CreateEvent.js +80 -0
  74. package/node/GithubEvents/EventTypes/DeleteEvent.js +73 -0
  75. package/node/GithubEvents/EventTypes/ForkEvent.js +85 -0
  76. package/node/GithubEvents/EventTypes/IssueCommentEvent.js +218 -0
  77. package/node/GithubEvents/EventTypes/IssuesEvent.js +105 -0
  78. package/node/GithubEvents/EventTypes/ProjectsV2ColumnEvent.js +77 -0
  79. package/node/GithubEvents/EventTypes/ProjectsV2Event.js +82 -0
  80. package/node/GithubEvents/EventTypes/ProjectsV2FieldEvent.js +85 -0
  81. package/node/GithubEvents/EventTypes/ProjectsV2ItemEvent.js +87 -0
  82. package/node/GithubEvents/EventTypes/PullRequest/CommitsList.js +107 -0
  83. package/node/GithubEvents/EventTypes/PullRequest/FileChanges.js +188 -0
  84. package/node/GithubEvents/EventTypes/PullRequest/PullRequestEvent.js +381 -0
  85. package/node/GithubEvents/EventTypes/PullRequest/PullRequestView.js +138 -0
  86. package/node/GithubEvents/EventTypes/PushEvent.js +114 -0
  87. package/node/GithubEvents/GithubEvents.js +1463 -0
  88. package/node/GithubEvents/index.js +9 -0
  89. package/node/apiHandlers/getPullRequestDetails.js +127 -0
  90. package/node/apiHandlers/index.js +13 -0
  91. package/node/index.js +27 -0
  92. package/node/types/github.js +5 -0
  93. package/package.json +71 -0
  94. package/types/github.d.ts +107 -0
  95. package/types/github.js +1 -0
@@ -0,0 +1,79 @@
1
+ import * as React from 'react';
2
+ import Box from '@mui/material/Box';
3
+ import Typography from '@mui/material/Typography';
4
+ import Link from '@mui/material/Link';
5
+ import Chip from '@mui/material/Chip';
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ export default function ProjectsV2ItemEvent({
8
+ event
9
+ }) {
10
+ var _event$payload, _event$payload2, _item$content_type;
11
+ if (!(event != null && event.date)) {
12
+ return null;
13
+ }
14
+ const item = (_event$payload = event.payload) == null ? void 0 : _event$payload.projects_v2_item;
15
+ const action = (_event$payload2 = event.payload) == null ? void 0 : _event$payload2.action;
16
+ if (!item) {
17
+ return null;
18
+ }
19
+ const itemTitle = item.title || 'Untitled Item';
20
+ const itemUrl = item.html_url;
21
+ const itemType = ((_item$content_type = item.content_type) == null ? void 0 : _item$content_type.toLowerCase()) || 'item';
22
+ const projectNumber = item.project_number;
23
+ return /*#__PURE__*/_jsxs(Box, {
24
+ sx: {
25
+ p: '16px'
26
+ },
27
+ children: [/*#__PURE__*/_jsxs(Box, {
28
+ sx: {
29
+ display: 'flex',
30
+ alignItems: 'center',
31
+ gap: 1,
32
+ mb: 2
33
+ },
34
+ children: [/*#__PURE__*/_jsx(Typography, {
35
+ variant: "caption",
36
+ color: "text.secondary",
37
+ children: event.date
38
+ }), /*#__PURE__*/_jsx(Chip, {
39
+ label: `Project #${projectNumber}`,
40
+ size: "small",
41
+ color: "default"
42
+ }), /*#__PURE__*/_jsx(Chip, {
43
+ label: itemType,
44
+ size: "small",
45
+ color: "info"
46
+ }), /*#__PURE__*/_jsx(Chip, {
47
+ label: action,
48
+ size: "small",
49
+ color: action === 'created' ? 'success' : action === 'deleted' ? 'error' : 'primary'
50
+ })]
51
+ }), /*#__PURE__*/_jsx(Typography, {
52
+ variant: "h6",
53
+ component: "h3",
54
+ sx: {
55
+ mb: 1
56
+ },
57
+ children: itemUrl ? /*#__PURE__*/_jsx(Link, {
58
+ href: itemUrl,
59
+ target: "_blank",
60
+ rel: "noopener noreferrer",
61
+ sx: {
62
+ textDecoration: 'none'
63
+ },
64
+ children: itemTitle
65
+ }) : itemTitle
66
+ }), /*#__PURE__*/_jsx(Box, {
67
+ sx: {
68
+ display: 'flex',
69
+ alignItems: 'center',
70
+ gap: 1
71
+ },
72
+ children: /*#__PURE__*/_jsxs(Typography, {
73
+ variant: "body2",
74
+ color: "text.secondary",
75
+ children: [itemType, " ", action, " in project #", projectNumber]
76
+ })
77
+ })]
78
+ });
79
+ }
@@ -0,0 +1,99 @@
1
+ var _CopyIcon, _CheckoutIcon;
2
+ import * as React from 'react';
3
+ import Box from '@mui/material/Box';
4
+ import Typography from '@mui/material/Typography';
5
+ import Avatar from '@mui/material/Avatar';
6
+ import IconButton from '@mui/material/IconButton';
7
+ import { styled } from '@mui/material/styles';
8
+ import CopyIcon from '@mui/icons-material/ContentCopy';
9
+ import CheckoutIcon from '@mui/icons-material/CallMade';
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ const CommitItem = styled(Box)(({
12
+ theme
13
+ }) => ({
14
+ display: 'flex',
15
+ alignItems: 'flex-start',
16
+ padding: theme.spacing(2),
17
+ borderBottom: `1px solid ${theme.palette.divider}`,
18
+ '&:last-child': {
19
+ borderBottom: 'none'
20
+ },
21
+ '&:hover': {
22
+ backgroundColor: theme.palette.action.hover,
23
+ '.commit-actions': {
24
+ visibility: 'visible'
25
+ }
26
+ }
27
+ }));
28
+ const CommitActions = styled(Box)({
29
+ visibility: 'hidden',
30
+ display: 'flex',
31
+ gap: '8px'
32
+ });
33
+ export default function CommitsList({
34
+ commits,
35
+ onCheckout
36
+ }) {
37
+ const handleCopyHash = hash => {
38
+ navigator.clipboard.writeText(hash);
39
+ };
40
+ return /*#__PURE__*/_jsx(Box, {
41
+ children: commits.map(commit => /*#__PURE__*/_jsx(CommitItem, {
42
+ children: /*#__PURE__*/_jsxs(Box, {
43
+ sx: {
44
+ display: 'flex',
45
+ width: '100%'
46
+ },
47
+ children: [/*#__PURE__*/_jsx(Avatar, {
48
+ src: commit.author.avatar,
49
+ alt: commit.author.name,
50
+ sx: {
51
+ width: 32,
52
+ height: 32,
53
+ mr: 2
54
+ }
55
+ }), /*#__PURE__*/_jsxs(Box, {
56
+ sx: {
57
+ flex: 1
58
+ },
59
+ children: [/*#__PURE__*/_jsx(Typography, {
60
+ variant: "body1",
61
+ sx: {
62
+ mb: 0.5,
63
+ wordBreak: 'break-word'
64
+ },
65
+ children: commit.message
66
+ }), /*#__PURE__*/_jsxs(Box, {
67
+ sx: {
68
+ display: 'flex',
69
+ alignItems: 'center',
70
+ justifyContent: 'space-between'
71
+ },
72
+ children: [/*#__PURE__*/_jsxs(Typography, {
73
+ variant: "body2",
74
+ color: "text.secondary",
75
+ children: [commit.author.name, " committed ", commit.date]
76
+ }), /*#__PURE__*/_jsxs(CommitActions, {
77
+ className: "commit-actions",
78
+ children: [/*#__PURE__*/_jsx(IconButton, {
79
+ size: "small",
80
+ onClick: () => handleCopyHash(commit.hash),
81
+ title: "Copy commit SHA",
82
+ children: _CopyIcon || (_CopyIcon = /*#__PURE__*/_jsx(CopyIcon, {
83
+ fontSize: "small"
84
+ }))
85
+ }), /*#__PURE__*/_jsx(IconButton, {
86
+ size: "small",
87
+ onClick: () => onCheckout == null ? void 0 : onCheckout(commit.hash),
88
+ title: "Checkout commit",
89
+ children: _CheckoutIcon || (_CheckoutIcon = /*#__PURE__*/_jsx(CheckoutIcon, {
90
+ fontSize: "small"
91
+ }))
92
+ })]
93
+ })]
94
+ })]
95
+ })]
96
+ })
97
+ }, commit.id))
98
+ });
99
+ }
@@ -0,0 +1,182 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ var _Chip, _Chip2, _Chip3, _FileIcon;
3
+ import * as React from 'react';
4
+ import Box from '@mui/material/Box';
5
+ import Typography from '@mui/material/Typography';
6
+ import { SimpleTreeView } from '@mui/x-tree-view/SimpleTreeView';
7
+ import { TreeItem } from '@mui/x-tree-view/TreeItem';
8
+ import { styled } from '@mui/material/styles';
9
+ // import FolderIcon from '@mui/icons-material/Folder';
10
+ import FileIcon from '@mui/icons-material/InsertDriveFile';
11
+ import ChevronRightIcon from '@mui/icons-material/ChevronRight';
12
+ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
13
+ import Chip from '@mui/material/Chip';
14
+
15
+ // const StyledTreeItem = styled(TreeItem)((props) => ({
16
+ // '& .MuiTreeItem-content': {
17
+ // padding: props.theme.spacing(1),
18
+ // borderRadius: props.theme.shape.borderRadius,
19
+ // '&:hover': {
20
+ // backgroundColor: props.theme.palette.action.hover,
21
+ // },
22
+ // '& .MuiTreeItem-label': {
23
+ // display: 'flex',
24
+ // alignItems: 'center',
25
+ // gap: props.theme.spacing(1),
26
+ // },
27
+ // },
28
+ // }));
29
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
30
+ const DiffView = styled(Box)(({
31
+ theme
32
+ }) => ({
33
+ backgroundColor: theme.palette.background.paper,
34
+ border: `1px solid ${theme.palette.divider}`,
35
+ borderRadius: theme.shape.borderRadius,
36
+ fontFamily: 'ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace',
37
+ fontSize: '12px',
38
+ lineHeight: 1.5,
39
+ overflow: 'auto'
40
+ }));
41
+ const DiffLine = styled(Box, {
42
+ shouldForwardProp: prop => prop !== 'type'
43
+ })(({
44
+ theme,
45
+ type
46
+ }) => _extends({
47
+ padding: '0 16px',
48
+ whiteSpace: 'pre'
49
+ }, type === 'addition' && {
50
+ backgroundColor: 'rgba(46, 160, 67, 0.15)',
51
+ borderLeft: '4px solid #2ea043'
52
+ }, type === 'deletion' && {
53
+ backgroundColor: 'rgba(248, 81, 73, 0.15)',
54
+ borderLeft: '4px solid #f85149'
55
+ }, type === 'context' && {
56
+ backgroundColor: 'transparent',
57
+ borderLeft: '4px solid transparent'
58
+ }));
59
+ // interface TreeNode {
60
+ // id: string;
61
+ // name: string;
62
+ // type: FileChange['type'];
63
+ // additions: number;
64
+ // deletions: number;
65
+ // diff: FileChange['diff'];
66
+ // children?: TreeNode[];
67
+ // }
68
+
69
+ export default function FileChanges({
70
+ files
71
+ }) {
72
+ const [expanded, setExpanded] = React.useState([]);
73
+ const [selected, setSelected] = React.useState([]);
74
+ const handleToggle = (_event, nodeIds) => {
75
+ setExpanded(nodeIds);
76
+ };
77
+ const handleSelect = (_event, nodeIds) => {
78
+ setSelected(nodeIds);
79
+ };
80
+ const getFileIcon = type => {
81
+ switch (type) {
82
+ case 'added':
83
+ return _Chip || (_Chip = /*#__PURE__*/_jsx(Chip, {
84
+ label: "A",
85
+ size: "small",
86
+ color: "success"
87
+ }));
88
+ case 'modified':
89
+ return _Chip2 || (_Chip2 = /*#__PURE__*/_jsx(Chip, {
90
+ label: "M",
91
+ size: "small",
92
+ color: "warning"
93
+ }));
94
+ case 'deleted':
95
+ return _Chip3 || (_Chip3 = /*#__PURE__*/_jsx(Chip, {
96
+ label: "D",
97
+ size: "small",
98
+ color: "error"
99
+ }));
100
+ default:
101
+ return _FileIcon || (_FileIcon = /*#__PURE__*/_jsx(FileIcon, {}));
102
+ }
103
+ };
104
+
105
+ // Transform files into tree nodes
106
+ // const items: TreeNode[] = files.map((file, index) => ({
107
+ // id: `file-${index}-${file.path.replace(/[^a-zA-Z0-9]/g, '-')}`,
108
+ // name: file.path,
109
+ // type: file.type,
110
+ // additions: file.additions,
111
+ // deletions: file.deletions,
112
+ // diff: file.diff
113
+ // }));
114
+
115
+ // const renderLabel = (node: TreeNode) => (
116
+ // <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
117
+ // {getFileIcon(node.type)}
118
+ // <Typography variant="body2">{node.name}</Typography>
119
+ // <Typography variant="caption" color="text.secondary">
120
+ // +{node.additions} -{node.deletions}
121
+ // </Typography>
122
+ // </Box>
123
+ // );
124
+
125
+ // const renderContent = (node: TreeNode) => (
126
+ // <Box sx={{ p: '16px' }}>
127
+ // <DiffView>
128
+ // {node.diff.map((line, index) => (
129
+ // <DiffLine key={`${node.id}-line-${index}`} type={line.type}>
130
+ // {line.content}
131
+ // </DiffLine>
132
+ // ))}
133
+ // </DiffView>
134
+ // </Box>
135
+ // );
136
+
137
+ return /*#__PURE__*/_jsx(Box, {
138
+ children: /*#__PURE__*/_jsx(SimpleTreeView, {
139
+ slots: {
140
+ collapseIcon: ExpandMoreIcon,
141
+ expandIcon: ChevronRightIcon
142
+ },
143
+ expandedItems: expanded,
144
+ selectedItems: selected,
145
+ onExpandedItemsChange: handleToggle,
146
+ onSelectedItemsChange: handleSelect,
147
+ multiSelect: true,
148
+ children: files.map((file, index) => {
149
+ const itemId = `file-${index}-${file.path.replace(/[^a-zA-Z0-9]/g, '-')}`;
150
+ return /*#__PURE__*/_jsx(TreeItem, {
151
+ itemId: itemId,
152
+ label: /*#__PURE__*/_jsxs(Box, {
153
+ sx: {
154
+ display: 'flex',
155
+ alignItems: 'center',
156
+ gap: 1
157
+ },
158
+ children: [getFileIcon(file.type), /*#__PURE__*/_jsx(Typography, {
159
+ variant: "body2",
160
+ children: file.path
161
+ }), /*#__PURE__*/_jsxs(Typography, {
162
+ variant: "caption",
163
+ color: "text.secondary",
164
+ children: ["+", file.additions, " -", file.deletions]
165
+ })]
166
+ }),
167
+ children: /*#__PURE__*/_jsx(Box, {
168
+ sx: {
169
+ p: '16px'
170
+ },
171
+ children: /*#__PURE__*/_jsx(DiffView, {
172
+ children: file.diff.map((line, index) => /*#__PURE__*/_jsx(DiffLine, {
173
+ type: line.type,
174
+ children: line.content
175
+ }, `${itemId}-line-${index}`))
176
+ })
177
+ })
178
+ }, itemId);
179
+ })
180
+ })
181
+ });
182
+ }