Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncing workspace and code #51

Open
wants to merge 224 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
224 commits
Select commit Hold shift + click to select a range
a12829c
Added babel packages and Monaco Editor
ashwinKumar0505 Dec 1, 2020
846c490
Added new reducer for code
ashwinKumar0505 Dec 1, 2020
d96aeca
Added babel-plugins and queries
ashwinKumar0505 Dec 1, 2020
940afd0
Id will be added to prop of every component
ashwinKumar0505 Dec 1, 2020
bfee4de
Setting prop in the workspace will affect the code
ashwinKumar0505 Dec 1, 2020
8a17258
Deletion of comp in workspace affects code
ashwinKumar0505 Dec 2, 2020
60335d4
Duplicating the component affects the code
ashwinKumar0505 Dec 7, 2020
83880b1
Addition of component affects code
ashwinKumar0505 Dec 7, 2020
3cc8c6b
Refactoring of code
ashwinKumar0505 Dec 7, 2020
7d85d77
Handling of empty value in prop
ashwinKumar0505 Dec 8, 2020
bedc8b4
Box with the Root id was made droppable
ashwinKumar0505 Dec 8, 2020
bf0df58
Added More chakra-ui components-structure
ashwinKumar0505 Dec 8, 2020
6fd53c9
Fixed a bug in adding component
ashwinKumar0505 Dec 8, 2020
d75b449
Handling of children prop for the component
ashwinKumar0505 Dec 8, 2020
bf13339
Added babel-plugin for reordering
ashwinKumar0505 Dec 8, 2020
2c96ea5
Clearing workspace resets the code
ashwinKumar0505 Dec 8, 2020
de6e046
Imports will be added for used components
ashwinKumar0505 Dec 9, 2020
5ac3779
Added plugin for moving the component
ashwinKumar0505 Dec 9, 2020
2b5e0f3
Code from reducer is used for codesandbox
ashwinKumar0505 Dec 9, 2020
6aa87f0
Removed unnecessary lines of code
ashwinKumar0505 Dec 10, 2020
59459fd
Changed the state structure of code
ashwinKumar0505 Dec 10, 2020
14c12ed
Added plugin for saving component
ashwinKumar0505 Dec 10, 2020
46f7911
fix: 🐛 Getting only chakra components from state for import
ashwinKumar0505 Dec 10, 2020
ed78b5e
Removed dispatch action for duplicate
ashwinKumar0505 Dec 10, 2020
8e35af1
Added plugin for adding custom components
ashwinKumar0505 Dec 10, 2020
664f679
Fixed bug in reordering children
ashwinKumar0505 Dec 17, 2020
5a6c04e
fix: 🐛 Changed again from hover pseudo class to hover state
ashwinKumar0505 Dec 17, 2020
3ff6a92
Fixed bugs in setting props
ashwinKumar0505 Dec 17, 2020
f8832de
Added plugin to add list of props
ashwinKumar0505 Dec 17, 2020
c468184
Fixed bug in grid component
ashwinKumar0505 Dec 17, 2020
810b8a3
Code will also be imported
ashwinKumar0505 Dec 17, 2020
07e3276
Added plugin for deletion of prop
ashwinKumar0505 Dec 21, 2020
5694dfb
Modified the code state
ashwinKumar0505 Dec 21, 2020
f7afed8
The custom components is dealed in different way.
ashwinKumar0505 Dec 22, 2020
07ae607
setting the children prop of the text component.
ashwinKumar0505 Dec 22, 2020
10c7866
compnent can also be created in code panel.
ashwinKumar0505 Dec 23, 2020
6ce641e
Both state and code will be updated.
ashwinKumar0505 Dec 28, 2020
5b9d078
comp state will be updated from code only for add & duplicate
ashwinKumar0505 Dec 28, 2020
ac6c4f8
Handled moving of components.
ashwinKumar0505 Dec 28, 2020
d4f1c73
Fixed a bug in checking similar custom component
ashwinKumar0505 Dec 28, 2020
10ccc15
Timeout set for updating code for move operation.
ashwinKumar0505 Dec 28, 2020
17e4dee
Removed logs.
ashwinKumar0505 Dec 28, 2020
3fb11f4
Merge pull request #57 from Codebrahma/handling-moving-of-components
ashwinKumar0505 Dec 29, 2020
fd54964
New line will be added when the component is added.
ashwinKumar0505 Dec 29, 2020
2a18646
Code actions are made undoable
ashwinKumar0505 Dec 29, 2020
200c700
Merge pull request #58 from Codebrahma/make-code-actions-undoable
ashwinKumar0505 Dec 29, 2020
c31facb
Two dispatch actions for adding normal components
ashwinKumar0505 Dec 29, 2020
f3b9a4f
Two dispatch actions for adding custom comp
ashwinKumar0505 Dec 29, 2020
80040a7
Two dispatch actions for adding meta components
ashwinKumar0505 Dec 29, 2020
86d1a44
fix: 🐛 Fixed the bug in reordering the components
ashwinKumar0505 Dec 30, 2020
f8912b2
ComponentsIds are stored in pattern of queueue(FIFO)
ashwinKumar0505 Dec 31, 2020
f92031e
rearranged accordion based on the default component structure.
ashwinKumar0505 Dec 31, 2020
31b2e7f
Added InputGroup meta component
ashwinKumar0505 Dec 31, 2020
f68e2d6
buildComponentIds file for building compIds.
ashwinKumar0505 Dec 31, 2020
1a6bc7b
Way to handle compIds for duplicating components
ashwinKumar0505 Dec 31, 2020
b2f3caf
Merge pull request #59 from Codebrahma/adding-and-duplicating-components
ashwinKumar0505 Dec 31, 2020
f534ca8
Merge pull request #60 from Codebrahma/bug-fix/reordering-components
ashwinKumar0505 Dec 31, 2020
0db1c11
babel query for exporting component from App to customComp page
ashwinKumar0505 Dec 30, 2020
cedded1
Similar componentIds for components & code action.
ashwinKumar0505 Dec 31, 2020
5159f17
Merge pull request #61 from Codebrahma/export-to-custom-comp-page-plugin
ashwinKumar0505 Dec 31, 2020
2afa112
Added set-timeout for updating code.
ashwinKumar0505 Dec 31, 2020
4284c70
Refactored the code.
ashwinKumar0505 Dec 31, 2020
7f261ad
bug-fix : wrong import used.
ashwinKumar0505 Dec 31, 2020
b7f402a
Merge pull request #62 from Codebrahma/timeout-for-updating-code
ashwinKumar0505 Dec 31, 2020
856ea59
Bug-fix : presisting the code state.
ashwinKumar0505 Dec 31, 2020
a222d91
Added plugin for exposing the prop.
ashwinKumar0505 Jan 4, 2021
35a8efa
exposing prop of the custom components will affect code
ashwinKumar0505 Jan 4, 2021
6304a7c
Merge pull request #56 from Codebrahma/updatingBothStateAndCode
ashwinKumar0505 Jan 4, 2021
cc9e2a4
props of normal components can now be exposed
ashwinKumar0505 Jan 6, 2021
2e448df
Same component-id for babel & reducer save action.
ashwinKumar0505 Jan 6, 2021
c79ff01
When the prop is exposed, the custom prop will be added to all instan…
ashwinKumar0505 Jan 6, 2021
bc147fd
plugin created for unexposing the prop.
ashwinKumar0505 Jan 4, 2021
6505619
Fixed a bug in exposing children prop.
ashwinKumar0505 Jan 4, 2021
1c9dc5f
Removing custom prop in all the comp instances.
ashwinKumar0505 Jan 5, 2021
e6e2c97
Exposed props of normal components can now be unexposed.
ashwinKumar0505 Jan 6, 2021
748b53b
If the old value of exposed prop is empty, the prop is removed.
ashwinKumar0505 Jan 6, 2021
b3470fc
Created plugin for deleting the custom prop
ashwinKumar0505 Jan 6, 2021
736e702
Fixed a bug in deleting custom prop.
ashwinKumar0505 Jan 6, 2021
eb7d261
Merge pull request #63 from Codebrahma/expose-prop-plugin
ashwinKumar0505 Jan 7, 2021
2a7a398
Merge pull request #64 from Codebrahma/unexpose-prop-plugin
ashwinKumar0505 Jan 7, 2021
3141423
Merge pull request #65 from Codebrahma/deleting-custom-prop-plugin
ashwinKumar0505 Jan 7, 2021
ffc02d4
Changed the code generation when the comp is saved.
ashwinKumar0505 Jan 7, 2021
fc190c1
The code is refactored.
ashwinKumar0505 Jan 7, 2021
ac45fea
Merge pull request #66 from Codebrahma/refactoring-of-code
ashwinKumar0505 Jan 7, 2021
54f0ed1
Merge pull request #54 from Codebrahma/approach-to-custom-components
ashwinKumar0505 Jan 7, 2021
a608a10
plugin created for handling the span elements
ashwinKumar0505 Jan 8, 2021
5578d35
timeout executes only if the children prop is an array.
ashwinKumar0505 Jan 11, 2021
012b1ab
Exposing of props can now be done in code also.
ashwinKumar0505 Jan 11, 2021
7b3f640
Span elements can now be edited in code mode.
ashwinKumar0505 Jan 11, 2021
1642a37
Merge pull request #67 from Codebrahma/plugin-for-handling-span
ashwinKumar0505 Jan 12, 2021
fed3e4b
Merge pull request #69 from Codebrahma/improving-conversion-of-code-t…
ashwinKumar0505 Jan 12, 2021
70ebd14
Default props added in code when the custom component is dropped
ashwinKumar0505 Jan 12, 2021
36f5d0c
Arguments for custom components are not destructured.
ashwinKumar0505 Jan 12, 2021
d5ed4f1
Merge pull request #70 from Codebrahma/props-usage-without-destructuring
ashwinKumar0505 Jan 12, 2021
af98cf1
Handling exposed children of box using expose-prop-plugin
ashwinKumar0505 Jan 12, 2021
3f293d1
Plugin for converting normal custom comp to container comp
ashwinKumar0505 Jan 13, 2021
a88ad4e
The custom children prop will be deleted when component converted to …
ashwinKumar0505 Jan 14, 2021
ece44b2
Merge pull request #71 from Codebrahma/exposing-box-children
ashwinKumar0505 Jan 14, 2021
af7080e
Merge pull request #72 from Codebrahma/plugin-for-creating-container-…
ashwinKumar0505 Jan 14, 2021
77d8c27
ExposeChildrenControl file is moved to controls folder.
ashwinKumar0505 Jan 14, 2021
443869c
Added ExposeChildrenControl component for flex panel.
ashwinKumar0505 Jan 14, 2021
a0e9980
Code generation for unexposing children of Box component.
ashwinKumar0505 Jan 14, 2021
c57beff
Fix : bug in unexposing the children prop of Box/Flex
ashwinKumar0505 Jan 15, 2021
86b81a6
Merge pull request #73 from Codebrahma/bug-fix/unexposing-the-exposed…
ashwinKumar0505 Jan 15, 2021
089a658
Value for the identifier in prop is found by traversing the code.
ashwinKumar0505 Jan 15, 2021
7ea2c87
Merge pull request #74 from Codebrahma/find-value-for-identifiers-in-…
ashwinKumar0505 Jan 15, 2021
dce99ce
Only the main page code will be shown.
ashwinKumar0505 Jan 15, 2021
2c2bbac
Handling code updation for setting icon-props
ashwinKumar0505 Jan 15, 2021
3d93484
Merge pull request #76 from Codebrahma/Handling-icon-props
ashwinKumar0505 Jan 15, 2021
0a7d30b
Queries file is refactored.
ashwinKumar0505 Jan 15, 2021
acba660
renamed getNode to getJSXElement
ashwinKumar0505 Jan 15, 2021
c9e3a63
refactoring of code.
ashwinKumar0505 Jan 15, 2021
3e1db6d
Merge pull request #77 from Codebrahma/refactoring-the-queries-file
ashwinKumar0505 Jan 15, 2021
8c119cc
The workspace will be saved as zip file.
ashwinKumar0505 Jan 17, 2021
7d6869b
Merge pull request #78 from Codebrahma/export-workspace-as-zip-file
ashwinKumar0505 Jan 18, 2021
74cc2ca
Fonts and custom theme added to the project.
ashwinKumar0505 Jan 18, 2021
bd190d0
Merge pull request #79 from Codebrahma/add-fonts-and-custom-theme-to-…
ashwinKumar0505 Jan 18, 2021
9e1c40f
Changed the components & props data-strucutre.
ashwinKumar0505 Jan 18, 2021
b39c0b9
Added a new reducer for the pages.
ashwinKumar0505 Jan 18, 2021
81aa40e
Code in the selected is reseted on clearing page.
ashwinKumar0505 Jan 18, 2021
be83561
Renaming of dispatchAction name to onClick
ashwinKumar0505 Jan 18, 2021
ec1ce43
Merge pull request #80 from Codebrahma/changing-the-data-structure
ashwinKumar0505 Jan 18, 2021
c2c94e5
Merge pull request #81 from Codebrahma/page-reducer
ashwinKumar0505 Jan 18, 2021
10bcdb6
Added structure for more components.
ashwinKumar0505 Jan 19, 2021
e1456d6
Merge pull request #82 from Codebrahma/components-structure
ashwinKumar0505 Jan 19, 2021
c4b4a05
Fix : bug in saving the code
ashwinKumar0505 Jan 20, 2021
f6ddbf7
chakraProvider will only be used in index file
ashwinKumar0505 Jan 20, 2021
00ecfd0
Fix: bug in getting the code of selected page
ashwinKumar0505 Jan 20, 2021
256bd4e
Fix: Bug in updating the components state
ashwinKumar0505 Jan 20, 2021
b1ad41b
Fix : bug in clearing the workspace
ashwinKumar0505 Jan 20, 2021
5f7cbb1
State of the pages is now persisted
ashwinKumar0505 Jan 20, 2021
13f2407
Fix : Bug in getting components from the code.
ashwinKumar0505 Jan 20, 2021
a5bd952
Merge pull request #85 from Codebrahma/bug-fix/get-components-from-code
ashwinKumar0505 Jan 20, 2021
8d76b15
Add : Workspaces can be imported and exported
ashwinKumar0505 Jan 20, 2021
e37be74
Merge pull request #86 from Codebrahma/import-and-export-workspaces
ashwinKumar0505 Jan 20, 2021
484f71f
Added structure for missing chakra-components
ashwinKumar0505 Jan 20, 2021
1a55f0e
Both components action and code updation.
ashwinKumar0505 Jan 20, 2021
d49e94f
Fix : bug in adding the instance to the code.
ashwinKumar0505 Jan 20, 2021
5dadd0f
Fixed bugs in the code
ashwinKumar0505 Jan 20, 2021
ff01ec1
Each page will show its own code
ashwinKumar0505 Jan 20, 2021
f490a62
Fixed re-ordering issue
Kameshwaran Jan 21, 2021
75426fd
Fixed code missing bug
Kameshwaran Jan 21, 2021
a231196
Fix : bug in exposing the prop by the code
ashwinKumar0505 Jan 21, 2021
3176f71
Custom props will be passed thorugh text component also
ashwinKumar0505 Jan 21, 2021
8299fae
Renaming of updateCompState to resetCompState
ashwinKumar0505 Jan 21, 2021
674d1d0
Merge branch 'syncing-workspace-and-code' of github.com:Codebrahma/op…
Kameshwaran Jan 21, 2021
24902d5
Moved DND provider to top most
Kameshwaran Jan 21, 2021
77d1dc3
Fix : Added proper accept-types for meta-components
ashwinKumar0505 Jan 21, 2021
b067626
Merge branch 'syncing-workspace-and-code' of github.com:Codebrahma/op…
ashwinKumar0505 Jan 21, 2021
c50ec73
Formating the code using prettier
ashwinKumar0505 Jan 21, 2021
393ea48
Merge pull request #87 from Codebrahma/format-code-using-prettier
ashwinKumar0505 Jan 21, 2021
5fcd37e
Remved prettier-format from desc.d.ts file
ashwinKumar0505 Jan 21, 2021
590b968
Imports generated for the code.
ashwinKumar0505 Jan 22, 2021
ddc81c9
removing of custom comp import when custom comp is deleted.
ashwinKumar0505 Jan 22, 2021
13a4f31
bug fix in layout components
ashwinKumar0505 Jan 27, 2021
6c73a1b
Merge pull request #90 from Codebrahma/bug-fix/layout-components
ashwinKumar0505 Jan 27, 2021
009ef98
Merge pull request #88 from Codebrahma/imports-for-the-components
ashwinKumar0505 Jan 27, 2021
9440c0d
Bug fix in container components
ashwinKumar0505 Jan 26, 2021
6f9fc96
isContainerComponent prop will not be shown in the code
ashwinKumar0505 Jan 26, 2021
2f1ea76
Merge pull request #89 from Codebrahma/bug-fix/container-components
ashwinKumar0505 Jan 27, 2021
39e036c
Fix : icons are resetting to default when the code gets changed.
ashwinKumar0505 Jan 27, 2021
3119a84
Merge pull request #91 from Codebrahma/bug-fix/icons-resetting-to-def…
ashwinKumar0505 Jan 27, 2021
8f4e575
Image component is made draggable
ashwinKumar0505 Jan 27, 2021
cf26bd0
Renamed generatePropKeyValue file to findAndReplaceExposedPropValue
ashwinKumar0505 Jan 27, 2021
cf14942
Renamed save workspace to save project
ashwinKumar0505 Jan 27, 2021
9b5129e
Fix : components not imported properly for meta components.
ashwinKumar0505 Jan 27, 2021
8e7cd3a
Fix: bug in getting state from code.
ashwinKumar0505 Jan 29, 2021
b5c3b4a
Modification of custom page
ashwinKumar0505 Jan 28, 2021
c6c9eb2
Meta components are built using its default code.
ashwinKumar0505 Jan 28, 2021
9efd01c
Deleted the composer folder for building meta components
ashwinKumar0505 Jan 28, 2021
90e3a7e
Card component is added
ashwinKumar0505 Jan 28, 2021
cd44ad6
Modified the type for components & default-props
ashwinKumar0505 Jan 28, 2021
b4987f6
Added Blog component
ashwinKumar0505 Jan 28, 2021
f176cab
Meta components are built using its default code.
ashwinKumar0505 Jan 28, 2021
52cf84a
Added Ready-made components section
ashwinKumar0505 Jan 29, 2021
1b1f920
Added second Blog component
ashwinKumar0505 Jan 29, 2021
4068a3b
Removed Card and Blog1 component from normal-components-menu
ashwinKumar0505 Jan 29, 2021
f5ab2ce
Removed card component which is built for testing
ashwinKumar0505 Jan 29, 2021
ab308a6
Only update the code if the new code & old code differs.
ashwinKumar0505 Jan 31, 2021
cf65231
Proper renaming of prop in useDropComponent
ashwinKumar0505 Jan 31, 2021
c375539
Only reorder if parent of selected comp-id and targeted comp-id is same
ashwinKumar0505 Jan 31, 2021
5a2c174
Merge pull request #95 from Codebrahma/bug-fixes
ashwinKumar0505 Jan 31, 2021
9082888
Removed an unused variable
ashwinKumar0505 Feb 1, 2021
eaed00b
Fixed a bug in image component
ashwinKumar0505 Feb 1, 2021
e82473e
Modified the sidebar
ashwinKumar0505 Feb 3, 2021
06c69cd
Added E-commerce component-1
ashwinKumar0505 Feb 1, 2021
46445a1
Handled icons while converting code to components
ashwinKumar0505 Feb 1, 2021
4d1ce3a
Second ECommerce component is added.
ashwinKumar0505 Feb 1, 2021
55a8a0c
Added first pricing component
ashwinKumar0505 Feb 1, 2021
2db281a
Fix : When icon attribute value is empty, app crashes
ashwinKumar0505 Feb 1, 2021
0871530
Fix : bugs in saving custom component code.
ashwinKumar0505 Feb 2, 2021
f2c2867
Custom components can be deleted only in the user-components-preview …
ashwinKumar0505 Feb 2, 2021
e79bf8c
Added Team component
ashwinKumar0505 Feb 2, 2021
d742261
Fix : zero value is not showing in position panels
ashwinKumar0505 Feb 2, 2021
e901be6
Modified the blog components
ashwinKumar0505 Feb 2, 2021
00c2409
Fixed issues caused after rebasing
ashwinKumar0505 Feb 3, 2021
bc4a4bc
Added built ready-components in the modified sidebar
ashwinKumar0505 Feb 3, 2021
36a6e12
Merge pull request #96 from Codebrahma/build-more-ready-components
ashwinKumar0505 Feb 3, 2021
3a95224
Renamed some image-names
ashwinKumar0505 Feb 3, 2021
fec7d0a
Both normal and meta components are handled in same way.
ashwinKumar0505 Feb 4, 2021
9195f6a
Added Heading and text components in sidebar
ashwinKumar0505 Feb 4, 2021
96556ef
Added Container components in the sidebar
ashwinKumar0505 Feb 4, 2021
d8b3f10
Added more components
ashwinKumar0505 Feb 5, 2021
6abecdc
Search option is enabled in the side-bar
ashwinKumar0505 Feb 8, 2021
41814d6
Meta elements are presented in a seperate box inside drawer
ashwinKumar0505 Feb 8, 2021
4e6426f
All the components are added.
ashwinKumar0505 Feb 8, 2021
50e69de
User custom components are also added in the side-bar
ashwinKumar0505 Feb 8, 2021
a656e37
Added margin for the side-bar elements
ashwinKumar0505 Feb 9, 2021
f1cee8a
Merge pull request #94 from Codebrahma/modify-sidebar
ashwinKumar0505 Feb 9, 2021
0de0908
Merge pull request #93 from Codebrahma/building-meta-components-from-…
ashwinKumar0505 Feb 9, 2021
3a1fc7b
Merge pull request #92 from Codebrahma/modify-custom-page
ashwinKumar0505 Feb 9, 2021
c1c67ec
Code will be modified only when the value is selected not while hover…
ashwinKumar0505 Feb 8, 2021
f6d02eb
Converted all the set-timeout to sequence(queue)
ashwinKumar0505 Feb 9, 2021
62aad8c
Merge pull request #98 from Codebrahma/performance-improvement
ashwinKumar0505 Feb 9, 2021
7786ccc
Fixed the routing issue in netlify
ashwinKumar0505 Feb 10, 2021
b2bb700
Merge pull request #100 from Codebrahma/netlify-routing-issue
ashwinKumar0505 Feb 10, 2021
321584c
Optimized the way of moving components
ashwinKumar0505 Feb 10, 2021
1120500
Moved two packages from dependencies to dev-dependencies
ashwinKumar0505 Feb 9, 2021
84ddc69
Removed unneccesary javascript files
ashwinKumar0505 Feb 10, 2021
f6e4005
Added explicit width and height to composer image
ashwinKumar0505 Feb 10, 2021
08e938d
Improving the perfomance of the app
ashwinKumar0505 Feb 12, 2021
0842ec9
More optimizations
ashwinKumar0505 Feb 12, 2021
aa1f39f
Merge pull request #99 from Codebrahma/testing-app-performance
sanandnarayan Feb 25, 2021
271f761
Merge pull request #104 from Codebrahma/app-performance-improvement
sanandnarayan Feb 25, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions decs.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
declare module 'css-to-object'
declare module '@babel/standalone'
declare module '@babel/plugin-syntax-jsx'
declare module '@babel/helper-plugin-utils'
declare module '@babel/template'
declare module 'prettier-standalone'
4 changes: 4 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
38 changes: 21 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@babel/helper-plugin-utils": "^7.10.4",
"@babel/plugin-syntax-jsx": "^7.12.1",
"@babel/standalone": "^7.12.9",
"@babel/template": "^7.12.7",
"@babel/traverse": "^7.12.9",
"@babel/types": "^7.12.7",
"@bugsnag/js": "^6.5.2",
"@bugsnag/plugin-react": "^6.5.0",
"@chakra-ui/core": "^1.0.0-rc.5",
"@chakra-ui/icons": "^1.0.0-rc.3",
"@mdx-js/react": "^1.5.5",
"@rehooks/local-storage": "^2.1.1",
"@monaco-editor/react": "^3.7.1",
"@rematch/core": "^1.3.0",
"@types/react": "^16.9.49",
"@types/react-json-tree": "^0.6.11",
"@types/webfontloader": "^1.6.32",
"better-docs": "^2.3.2",
"@types/prettier": "^2.2.0",
"browser-nativefs": "^0.7.1",
"codesandbox": "^2.1.11",
"coloreact": "^0.3.1",
"copy-to-clipboard": "^3.2.1",
"css-to-object": "^1.1.0",
"jsdoc": "^3.6.6",
"file-saver": "^2.0.5",
"jszip": "^3.5.0",
"lodash": "^4.17.15",
"lodash-es": "^4.17.15",
"lz-string": "^1.4.4",
"prism-react-renderer": "^1.0.2",
"prettier": "^2.2.1",
"react": "^16.12.0",
"react-color": "^2.18.0",
"react-color-picker": "^4.0.2",
"react-dnd": "^10.0.2",
"react-dnd-html5-backend": "^10.0.2",
Expand All @@ -35,18 +35,18 @@
"react-json-tree": "^0.11.2",
"react-redux": "^7.1.3",
"react-responsive-combo-box": "^1.2.4",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.0",
"redux": "^4.0.5",
"redux-persist": "^6.0.0",
"redux-undo": "^1.0.0",
"reselect": "^4.0.0",
"typescript": "^3.7.5",
"webfontloader": "^1.6.28",
"webpack-bundle-analyzer": "^3.6.0"
"webfontloader": "^1.6.28"
},
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"build": "react-app-rewired --max_old_space_size=4096 build",
"test": "react-app-rewired test --env=jsdom",
"analyze": "BUNDLE_VISUALIZE=1 react-app-rewired build",
"docs": "jsdoc -c jsdoc.conf.json"
Expand All @@ -70,17 +70,21 @@
"@testing-library/jest-dom": "^5.1.1",
"@testing-library/react": "^9.4.0",
"@testing-library/user-event": "^8.1.0",
"@types/file-saver": "^2.0.1",
"@types/jest": "^25.1.2",
"@types/lodash": "^4.14.149",
"@types/lz-string": "^1.3.33",
"@types/prettier": "^1.19.0",
"@types/react": "^16.9.49",
"@types/react-color": "^3.0.1",
"@types/react-json-tree": "^0.6.11",
"@types/react-redux": "^7.1.7",
"@types/react-router-dom": "^5.1.7",
"@types/webfontloader": "^1.6.32",
"better-docs": "^2.3.2",
"customize-cra": "^0.9.1",
"customize-cra-react-refresh": "^1.0.1",
"husky": "^4.2.1",
"jsdoc": "^3.6.6",
"lint-staged": "^10.0.7",
"prettier": "^1.19.1",
"pretty-quick": "^2.0.1",
"react-app-rewired": "^2.1.5",
"typedoc": "^0.16.9"
Expand Down
55 changes: 30 additions & 25 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import React from 'react'
import React, { Suspense, lazy } from 'react'
import { Flex, Box, ThemeProvider, IconButton } from '@chakra-ui/core'
import { DndProvider } from 'react-dnd'
import Backend from 'react-dnd-html5-backend'
import { useSelector } from 'react-redux'
import Editor from './components/editor/Editor'
import Header from './components/Header'
import { Global } from '@emotion/core'
import { ArrowBackIcon } from '@chakra-ui/icons'
// import EditorErrorBoundary from './components/errorBoundaries/EditorErrorBoundary'
Expand All @@ -16,9 +12,12 @@ import {
import useDispatch from './hooks/useDispatch'
import loadFonts from './utils/loadFonts'
import useCustomTheme from './hooks/useCustomTheme'
import CodePanel from './components/CodePanel'
import Sidebar from './components/sidebar/Sidebar'
import useShortCutKeys from './hooks/useShortcutKeys'
import EditorRouting from './components/editor/EditorRouting'
import Header from './components/Header/Header'
import Sidebar from './components/sidebar/Sidebar'

const CodePanel = lazy(() => import('./components/CodePanel'))

const App = () => {
const showFullScreen = useSelector(getShowFullScreen)
Expand Down Expand Up @@ -49,27 +48,33 @@ const App = () => {
/>
</Box>
) : null}
<DndProvider backend={Backend}>
<Flex width="100%">
<Box flex={1}>
{!showFullScreen ? <Header /> : null}

<ThemeProvider theme={theme}>
{/* <EditorErrorBoundary> */}
<Flex width="100%" overflowX="hidden">
<Box flex={1}>
{!showFullScreen ? <Header /> : null}

<Box
bg="white"
height={!showFullScreen ? 'calc(100vh - 3rem)' : '100vh'}
>
{showCode ? <CodePanel /> : <Editor />}
</Box>
{/* </EditorErrorBoundary> */}
</ThemeProvider>
</Box>
<ThemeProvider theme={theme}>
{/* <EditorErrorBoundary> */}

<Box
bg="white"
height={!showFullScreen ? 'calc(100vh - 3rem)' : '100vh'}
width={!showFullScreen ? 'calc(100vw - 15rem)' : '100vw'}
>
{showCode ? (
<Suspense fallback={<Box />}>
<CodePanel />{' '}
</Suspense>
) : (
<EditorRouting />
)}
</Box>
{/* </EditorErrorBoundary> */}
</ThemeProvider>
</Box>

{!showFullScreen ? <Sidebar /> : null}
</Flex>
</DndProvider>
{!showFullScreen ? <Sidebar /> : null}
</Flex>
</Box>
)
}
Expand Down
61 changes: 61 additions & 0 deletions src/babel-plugins/add-component-plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import template from '@babel/template'
import * as t from '@babel/types'
import union from 'lodash/union'

import { getComponentId } from './utils/babel-plugin-utils'

export interface IComponentIds {
[type: string]: string
}

const addComponentPlugin = (
_: any,
options: {
parentId: string
componentsToImport: string[]
componentCode: string
},
) => {
const { componentCode, parentId, componentsToImport } = options

return {
visitor: {
ImportDeclaration(path: any) {
if (path.node.source.value !== '@chakra-ui/core') return

const importedComponents = path.node.specifiers.map(
(specifier: any) => specifier.local.name,
)

const components = union(importedComponents, componentsToImport)

path.node.specifiers = components.map(component =>
t.importSpecifier(t.identifier(component), t.identifier(component)),
)
},
JSXElement(path: any) {
const openingElement = path.node.openingElement

const visitedComponentId = getComponentId(openingElement)
if (visitedComponentId && visitedComponentId === parentId) {
// Change the JSX element in the string to node template
const node = template.ast(componentCode, {
plugins: ['jsx'],
}).expression

const newLineText = t.jsxText('\n')

// Add to the children of the parent component
if (path.node.children.length > 0) {
path.node.children.push(node)
path.node.children.push(newLineText)
} else {
path.node.children = [newLineText, node, newLineText]
}
}
},
},
}
}

export default addComponentPlugin
101 changes: 101 additions & 0 deletions src/babel-plugins/add-custom-component-plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import { getComponentId } from './utils/babel-plugin-utils'
import template from '@babel/template'
import * as t from '@babel/types'
import checkIsComponentId from '../utils/checkIsComponentId'

const addCustomComponentPlugin = (
_: any,
options: {
componentId: string
parentId: string
type: string
defaultProps: IProp[]
isContainerComponent: boolean
},
) => {
const {
componentId,
parentId,
type,
defaultProps,
isContainerComponent,
} = options

// If the value of the prop is a component-id, then the box component should be added.
// or else its respective value will be added.
const defaultPropsProvider = () => {
return defaultProps
.filter(prop => prop.name !== 'children')
.map(prop => {
if (checkIsComponentId(prop.value)) {
return `${prop.name}={<Box compId="${prop.value}"></Box>}`
} else {
return `${prop.name}="${prop.value}"`
}
})
.join(' ')
}

const buildImportDeclaration = (name: string) =>
t.importDeclaration(
[t.importDefaultSpecifier(t.identifier(name))],
t.stringLiteral(`./components/${name}.js`),
)

return {
visitor: {
Program(path: any) {
const importDeclarations = path.node.body.filter(
(declaration: any) => declaration.type === 'ImportDeclaration',
)

const isComponentImported =
importDeclarations.findIndex(
(declaration: any) =>
declaration.source.value === `./components/${type}.js`,
) !== -1

if (isComponentImported) return

path.node.body.splice(
importDeclarations.length,
0,
buildImportDeclaration(type),
)
},
JSXElement(path: any) {
const openingElement = path.node.openingElement

const visitedComponentId = getComponentId(openingElement)
if (visitedComponentId && visitedComponentId === parentId) {
let component: string = ``

// If the component is container component, the element will be <Card></Card>
// If the component is not a container component, the element will be <Card />

if (isContainerComponent) {
component = `<${type} compId="${componentId}" ${defaultPropsProvider()}></${type}>`
} else {
component = `<${type} compId="${componentId}" ${defaultPropsProvider()}/>`
}

// Change the JSX element in the string to node template
const node = template.ast(component, {
plugins: ['jsx'],
}).expression
const newLineText = t.jsxText('\n')

// Add to the children of the parent component
if (path.node.children.length > 0) {
path.node.children.push(node)
path.node.children.push(newLineText)
} else {
path.node.children = [newLineText, node, newLineText]
}
}
},
},
}
}

export default addCustomComponentPlugin
44 changes: 44 additions & 0 deletions src/babel-plugins/add-prop-in-all-instances.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import * as t from '@babel/types'
import { toJsxAttribute, getJSXElement } from './utils/babel-plugin-utils'

const addPropInAllInstances = (
_: any,
options: {
propName: string
propValue: string
componentName: string
boxId?: string
},
) => {
// If the prop boxId is present, then it denotes that children prop is exposed.
// And the custom prop will hold jsx element
// For example : <Layout top={<Box><Text>Hello world</Text></Box>} bottom={<Box><Button>Click me</Button></Box>}/>
const { propName, propValue, componentName, boxId } = options

return {
visitor: {
JSXOpeningElement(path: any) {
const visitedComponentName = path.node.name.name

if (visitedComponentName === componentName) {
if (boxId) {
const boxComponent = `<Box compId="${boxId}"></Box>`

const element = getJSXElement(boxComponent)

const jsxAttribute = t.jsxAttribute(
t.jsxIdentifier(propName),
t.jsxExpressionContainer(element),
)
path.node.attributes.push(jsxAttribute)
} else {
const jsxAttribute = toJsxAttribute(propName, propValue)
path.node.attributes.push(jsxAttribute)
}
} else return
},
},
}
}

export default addPropInAllInstances
Loading