This experiment is about documenting the structure of the document. It will be in a JSON format, and stored in supabase as a jsonb column.
Root
title: name of document. Default isUntitledsettings: general settingsframe: frame settingswindow: window settingstimeline: a list of events
Settings
preset: the color preset. Default islight.css: global css rules to add. Default is an empty string.easing: default easing function. Default islinear.duration: default duration of a timeline event. Default is1000.
Frame
Settings related to the frame:
width: the width of the frame. Default is640.height: the height of the frame. Default is480.background: the background color. Default is#cccccc.
Window
Settings related to the code editor window
title: the title of the window. Default iscode.width: the width of the window. Default is640.height: the height of the window. Default is480.controls: wether controls should be displayed. Default istrue.border.enabled: enable or disable border. Default istrue.border.color: the color of the border. Default ispreset.background: the background color of the window. Default ispreset.language: the program language, used for syntax highlighting. Default isjavascript.lineNumbers: whether line numbers should be displayed. Default istrue.initial: the initial code. Default is an empty string.
Events
All events share this properties:
type: the type of the event. Can be one ofinsert,append,delete,scroll,selectlabel: the label of the event. Default is an empty string.caption: displays a caption at the bottom the screen. Default is an empty string.offset: the offset in milliseconds. Default islast.offset + last.durationeffect.duration: the length of the event in milliseconds. Default isdefaultwhich usessettings.duration.effect.easing: the easing function. The default isdefault, which usessettings.easing.
Append
Code to append to the end of the document:
code: the code to append. default is an empty string.typewriter:trueto enabled the typewriter effect. default isfalsehighlight:trueto hightlight text while typing. default isfalse
Insert
Code to insert into the document:
position: the position to insert at. ie{line: 10, char: 3}. default is{line: 0, char: 0}code: the code to insert. default is an empty string.typewriter:trueto enabled the typewriter effect. default isfalsehighlight:trueto hightlight text while typing. default isfalse
Delete
Deletes code from the document:
position: the position to delete at. ie{line: 10, char: 3}. default is{line: 0, char: 0}length: the number of chars to delete. default is0.typewriter:trueto enabled the typewriter effect. default isfalsehighlight:trueto hightlight text while deleting. default isfalse
Replace
Replace code in the document:
selection: the position to delete. ie{from: {line: 10, char: 3}, length: 0}. default is{from: {line: 0, char: 0}, length: 0}code: the code to insert. default is an empty string.typewriter:trueto enabled the typewriter effect. default isfalsehighlight:trueto hightlight text while removing and adding. default isfalse
Select
A list of one or more selections
- a list of:
start: the start of the selectionend: the end of the selectionscroll:trueto scroll to the line. Default isfalse.
classes: a list of css classes. Default is[]styles: css styles to add. Default is an empty string.
Scroll
Scroll the window
scrollType: the type of scrolling. One ofpixelorline. Default isline.y: theyposition to scroll to.line: the line number to scroll to.
Notes
- Support for multiple windows in the future