REST Server

Rest Server

editor.pegasus

pegasus is a open-souce lua http-server

httpYac in vscode to send a REST request to editor.pegasus

  • selectPage.http

    this calls these commnands in editor

    selectApp
    selectBook
    selectPage

    ref edtior.tests

    1. pegasus harness receives the request in REST format (json)

    2. dispatch events to commands

      selectXXX reads App/bookX/pageX/index.lua or models/pageX/.json files, and the data are stored in nanstores for components such bookStore, pageStore, layerStore, audioStore

    3. Response of http Rest in pegasus are retreived by nanostores:get(xxxStore)

  • selectLayer.http - Read

    select a layer and shows the properties

  • selectTool.http - Write

    attach a tool (animation) to a selected layer

graph LR

subgraph vscode
  httpYac
end

subgraph solar2D
  pegasus
  subgraph commands
    selectApp
    selectBook
    selectPage
    selectLayer
    selectTool[selectTool <br> new or update class props]
  end

  subgraph controllers_save
    updateIndex[index model <br> layer model]
    save[save .json]
    render[render lua]

    updateIndex -.-> render
    updateIndex -.-> save

  end
  subgraph nanosotres
    bookStore
    pageStore
    layerStore
  end
  subgraph UI
    bookTable
    pageTable
    layerTable
    subgraph animation
      selectBox
      contropProps
      pointABBox
      onCompletebox
    end
    subgraph audio
      selectBox_[selectBox]
      contropProps_[controlProps]
      onCompletebox_[onCompletebox]
    end
  end
  subgraph models
    subgraph runtime
      lua[pageX.index <br> <br> scene.components <br> - layers  <br> - audios <br><br> layerX.lua <br> layerX_anim.lua]
    end
    subgraph persistent
      json[models/pageX/.json]
      layerX.json
      layerX_anim.json
    end
  end
end

httpYac -.- pegasus
pegasus -. 1 onGet .->selectLayer
selectLayer -. read .- lua

lua -. 1 onGet set .-> layerStore
selectLayer -. show .- layerTable
layerStore -. 1 onGet subscribed data.-> layerTable

selectTool -. nanostores get .- layerStore
selectTool -.read class.- lua

save -. write .- json
save -. write .- layerX_anim.json
save -. write .- layerX.json

render -.write .- lua
pegasus -. 2-1 onPost class.->selectTool
pegasus -. 2-2 onPost save.->updateIndex
layerX_anim.json -.setValue .-> contropProps

lua -. read .- layerX.json
lua -. 2-1 onPost read .- layerX_anim.json