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

WIP: [Tiny-lisp] test build #33

Open
wants to merge 68 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
317f59c
add structure of the tiny-lisp-integration
lambduli Oct 16, 2021
1579ed9
start working on the tiny-lis-integration
lambduli Oct 16, 2021
5dfefc8
fix the lambda core package - installation is now automatic
lambduli Oct 17, 2021
42107ea
add structure of the tiny-lisp-integration
lambduli Oct 16, 2021
940d842
start working on the tiny-lis-integration
lambduli Oct 16, 2021
7af1bce
fix the lambda core package - installation is now automatic
lambduli Oct 17, 2021
f8bc3e3
merge
lambduli Oct 24, 2021
c5e19a0
add code colouring
vojsa5 Jan 6, 2022
5bf6353
add underlines
vojsa5 Jan 22, 2022
59f6ba2
some improvement
vojsa5 Feb 5, 2022
c02fb5d
highliting
vojsa5 Feb 8, 2022
dbace80
colouring still bugged
vojsa5 Feb 13, 2022
b19c22d
new types of nodes and more improvement
vojsa5 Feb 18, 2022
0f05da5
bug fixing, add placeholders
vojsa5 Feb 23, 2022
c9e1ca1
import from index
vojsa5 Feb 23, 2022
e3114e5
add structure of the tiny-lisp-integration
lambduli Oct 16, 2021
913ed7f
rebasing on the develop - "start working on the lisp integration"
lambduli Oct 16, 2021
4e46d34
fix the lambda core package - installation is now automatic
lambduli Oct 17, 2021
8b8b6c2
start working on the tiny-lis-integration
lambduli Oct 16, 2021
1311298
fix the lambda core package - installation is now automatic
lambduli Oct 17, 2021
476c415
add code colouring
vojsa5 Jan 6, 2022
ce483ee
add underlines
vojsa5 Jan 22, 2022
0f7740d
some improvement
vojsa5 Feb 5, 2022
743e799
highliting
vojsa5 Feb 8, 2022
6d04179
colouring still bugged
vojsa5 Feb 13, 2022
b727d32
new types of nodes and more improvement
vojsa5 Feb 18, 2022
6b7371a
bug fixing, add placeholders
vojsa5 Feb 23, 2022
6b5e709
import from index
vojsa5 Feb 23, 2022
e397dda
merging and resolving conflicts
lambduli Feb 24, 2022
f9284d5
some changes can't tell
lambduli Feb 24, 2022
dbbab2d
update outdated dependencies
lambduli Feb 24, 2022
5800d69
add missing file
vojsa5 Feb 25, 2022
ffe5cc9
import from dist
vojsa5 Feb 26, 2022
2f5525a
shorten some imports
vojsa5 Feb 26, 2022
17c076d
change some imports
vojsa5 Feb 26, 2022
5bc2195
fix imports
vojsa5 Feb 27, 2022
7c8a1b3
add submit button and more improvements
vojsa5 Feb 27, 2022
6c5ae0a
finally fixes the build error related to imports
lambduli Feb 28, 2022
53d1fb6
Revert "finally fixes the build error related to imports"
lambduli Feb 28, 2022
47c8d42
rebasing on the develop - "start working on the lisp integration"
lambduli Oct 16, 2021
bcce154
fix the lambda core package - installation is now automatic
lambduli Oct 17, 2021
0bf6c30
fix some frontend errors
vojsa5 Feb 28, 2022
01a6534
rename imports once more
vojsa5 Feb 28, 2022
e0fd75e
merging changes
lambduli Mar 1, 2022
06b0e37
try and fix the build/deploy error
lambduli Mar 1, 2022
6559367
fix warnings
vojsa5 Mar 2, 2022
fb6596b
fix some problems with recursive functions
vojsa5 Mar 5, 2022
b79a4a2
a lot of improvements
vojsa5 Mar 9, 2022
b24f9fa
improve recursive functions
vojsa5 Mar 9, 2022
bd01299
a lot of changes
vojsa5 Mar 10, 2022
c8e63a9
some logs
vojsa5 Mar 11, 2022
5e06179
improvements
vojsa5 Mar 12, 2022
3839aff
refactor
vojsa5 Mar 15, 2022
ecff581
improvements
vojsa5 Mar 16, 2022
388397a
rework macros
vojsa5 Mar 30, 2022
1be605e
some improvements
vojsa5 Apr 4, 2022
511350d
.
vojsa5 Apr 17, 2022
a98bce4
fix warnings
vojsa5 Apr 17, 2022
2b9b466
fix frontend macro
vojsa5 Apr 24, 2022
424e9e7
polish
vojsa5 May 12, 2022
9c7c0fc
fix bug with operator being a reduce node
vojsa5 Jul 19, 2022
9705460
to the rescue
lambduli Sep 7, 2022
03b928b
Merge branch 'develop' into tiny-lisp
lambduli Sep 7, 2022
a121bed
fixing some broken stuff
lambduli Sep 7, 2022
7120f53
Merge branch 'tiny-lisp' of github.com:lambdulus/frontend into tiny-lisp
lambduli Sep 7, 2022
a55ae4f
remove menuopen
lambduli Sep 7, 2022
04f55b0
fixing obviously broken merge, thanks github
lambduli Sep 7, 2022
b3f928d
use InterpreterState instead of Interpreter
vojsa5 Sep 13, 2022
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
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@lambdulus/core": "^0.0.7",
"@lambdulus/tiny-lisp-core": "git+ssh://git@github.com:lambdulus/tiny-lisp-core.git",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
Expand Down Expand Up @@ -42,4 +43,4 @@
"last 1 safari version"
]
}
}
}
7 changes: 4 additions & 3 deletions src/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const CLEAR_WORKSPACE_CONFIRMATION : string =

Are you sure?`


export function mapBoxTypeToStr (type : BoxType) : string {
switch (type) {
case BoxType.UNTYPED_LAMBDA:
Expand Down Expand Up @@ -75,6 +74,7 @@ export function loadSettingsFromStorage () : GlobalSettings {


export function loadAppStateFromStorage () : AppState {
return EmptyAppState/*
const maybeState : string | null = localStorage.getItem('AppState')

if (maybeState === null) {
Expand All @@ -90,11 +90,12 @@ export function loadAppStateFromStorage () : AppState {

return EmptyAppState
}
}
}*/
}

export function updateAppStateToStorage (state : AppState) : void {
localStorage.setItem('AppState', JSON.stringify(state))
const {stringify} = require('flatted/cjs');
localStorage.setItem('AppState', stringify(state))
}

export function updateNotebookStateToStorage (notebook : NotebookState, index : number) {
Expand Down
7 changes: 2 additions & 5 deletions src/Types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { UntypedLambdaState, UntypedLambdaSettings } from "./untyped-lambda-integration/Types"
import { NoteState } from "./markdown-integration/AppTypes"
import { TinyLispState } from "./tiny-lisp-integration/Types"

export enum BoxType {
UNTYPED_LAMBDA = 'UNTYPED_LAMBDA',
Expand All @@ -26,15 +27,11 @@ export interface AbstractSettings {
type : BoxType,
}

export interface LispBox extends AbstractBoxState {
// TODO: delete this placeholder and implement it
}

export interface LispSettings extends AbstractSettings {
// TODO: delete this placeholder and implement it
}

export type BoxState = UntypedLambdaState | LispBox | NoteState // or other things in the future
export type BoxState = UntypedLambdaState | TinyLispState | NoteState // or other things in the future

export type Settings = UntypedLambdaSettings | LispSettings // or other things in the future

Expand Down
13 changes: 13 additions & 0 deletions src/components/Box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { NoteState } from '../markdown-integration/AppTypes'
import Note from '../markdown-integration/Note'

import Empty from '../empty-integration'
import TinyLispBox from '../tiny-lisp-integration/TinyLispBox'
import { TinyLispState } from '../tiny-lisp-integration/Types'

// import { BoxState } from '../AppTypes'

Expand Down Expand Up @@ -59,6 +61,17 @@ export default function Box (props : BoxProperties) : JSX.Element {
/>
)
}
if (type === BoxType.LISP) {
return (
<TinyLispBox
state={ state as TinyLispState }
isActive={ isActive }
isFocused={ isFocused }

setBoxState={ updateBoxState }
/>
)
}
else {
return (
<Empty />
Expand Down
3 changes: 2 additions & 1 deletion src/components/BoxTitleBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ export default class BoxTitleBar extends Component<Props, State> {
break
}
case BoxType.MARKDOWN: {
updateBoxState({ ...state, isEditing : true })
updateBoxState({ ...state, isEditing : true } as NoteState)
// updateBoxState(resetMarkdownBox(state as NoteState))
break
}
}
Expand Down
53 changes: 32 additions & 21 deletions src/components/PickBoxTypeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ import React from 'react'
import { GlobalSettings, BoxState } from '../Types'
import { createNewMarkdown } from '../markdown-integration/AppTypes'
import { UntypedLambdaSettings, UntypedLambdaState } from '../untyped-lambda-integration/Types'
import { createNewUntypedLambdaExpression, ADD_BOX_LABEL, CODE_NAME as UNTYPED_CODE_NAME } from '../untyped-lambda-integration/AppTypes'

import { createNewUntypedLambdaExpression, ADD_BOX_LABEL as UNTYPED_ADD_BOX_LABEL, CODE_NAME as UNTYPED_CODE_NAME } from '../untyped-lambda-integration/AppTypes'
import { CODE_NAME as TINY_LISP_CODE_NAME, ADD_BOX_LABEL as TINY_LISP_ADD_BOX_LABEL } from '../tiny-lisp-integration/Constants'


import '../styles/PickBoxTypeModal.css'
import { createNewTinyLispExpression } from '../tiny-lisp-integration/Constants'
import { TinyLispSettings } from '../tiny-lisp-integration/Types'


interface Props {
Expand All @@ -18,6 +22,7 @@ export default function PickBoxTypeModal (props : Props) : JSX.Element {
const { addNew, settings } : Props = props

const untLSettings : UntypedLambdaSettings = settings[UNTYPED_CODE_NAME] as UntypedLambdaState
const tinyLSettings : TinyLispSettings = settings[TINY_LISP_CODE_NAME] as TinyLispSettings

const addLambdaBox = (
<div className='add-box--group'
Expand All @@ -31,29 +36,35 @@ export default function PickBoxTypeModal (props : Props) : JSX.Element {
className='plusBtn'
title='Create new λ box'
>
<p className='create-box--big'>λ</p>
<p className='creat-box--label'>{ ADD_BOX_LABEL }</p>
<div
className='plusBtn'
title='Create new λ box'
>
<p className='create-box--big'>λ</p>
<p className='creat-box--label'>{ UNTYPED_ADD_BOX_LABEL }</p>
</div>
</div>
</div>
)

// const addLispBox = (
// <div className='add-box--group'
// onClick={ (e) => {
// e.stopPropagation()
// // this.setState({ opened : false })
// addNew({__key : Date.now().toString()} as BoxState) } // NOTE: just for now
// }
// >
// <div
// className='plusBtn'
// title='Create new Lisp box'
// >
// <p className='create-box--big'>()</p>
// <p className='creat-box--label'>+ Lisp</p>
// </div>
// </div>
// )

const addLispBox = (
<div className='add-box--group'
onClick={ (e) => {
e.stopPropagation()
// this.setState({ opened : false })
addNew(createNewTinyLispExpression(tinyLSettings)) } // NOTE: just for now
}
>
<div
className='plusBtn'
title='Create new Lisp box'
>
<p className='create-box--big'>()</p>
<p className='creat-box--label'>{ TINY_LISP_ADD_BOX_LABEL }</p>
</div>
</div>
)

const addMDBox = (
<div className='add-box--group'
Expand All @@ -78,7 +89,7 @@ export default function PickBoxTypeModal (props : Props) : JSX.Element {
<div className='modal--create-box'>
<div className='modal--create-box--container'>
{ addLambdaBox }
{/* { addLispBox } */}
{ addLispBox }
{ addMDBox }
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export default function TopBar (props : Props) : JSX.Element {
const { name } : NotebookState = ntbk

// const dehydrated : object = dehydrate(state)

const serialized : string = JSON.stringify(ntbk)
const {stringify} = require('flatted/cjs');
const serialized : string = stringify(ntbk)
const link : string = createURL(serialized)

return (
Expand Down
2 changes: 1 addition & 1 deletion src/styles/PickBoxTypeModal.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

.add-box--group {
display: inline-block;
width: 50%;
width: 33.3%;
text-align: center;
/* margin: 30px; */
margin-right: 0%;
Expand Down
33 changes: 33 additions & 0 deletions src/tiny-lisp-integration/Constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { InstructionShortcut } from "@lambdulus/tiny-lisp-core";
import { BoxType } from "../Types";
import { TinyLispSettings, TinyLispState, TinyLispType } from "./Types"

export const ADD_BOX_LABEL = '+ Lisp Expression'

export const CODE_NAME = 'TINY_LISP'


export function createNewTinyLispExpression (defaultSettings : TinyLispSettings) : TinyLispState {
return {
__key : Date.now().toString(),
type : BoxType.LISP,
title : 'New Tiny Lisp Expression',
minimized : false,
settingsOpen : false,

subtype: TinyLispType.EMPTY,
expression : '',
mouseOver: null,
cleanNeeded: false,
interpreterState: null,
errorMsg: null,

editor : {
placeholder : '',
content : '',
caretPosition : -1,
syntaxError : null,
},
current : InstructionShortcut.DUMMY
};
}
Loading