Compare commits
27 Commits
memes_grap
...
5c11183217
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c11183217 | |||
| 2ec6426fe5 | |||
| 0df5884a88 | |||
| 6948a65a97 | |||
| bba26b9c0f | |||
| fcf528275b | |||
| d53f6687e5 | |||
| d46c1de49d | |||
| f0c5556450 | |||
| 97730899c6 | |||
| 18daf83c1c | |||
| dfef26fcf5 | |||
| 048ea0eab4 | |||
| 3509930195 | |||
| b1ac36ce3e | |||
| a12db025e0 | |||
| 5c10f3860a | |||
| a64fcbb010 | |||
| 7baa6f3648 | |||
| af92f03706 | |||
| cb263b5758 | |||
| 44879eb947 | |||
| 49bddb6365 | |||
| b5d846b35d | |||
| 60c83c608a | |||
| 58ec73972b | |||
| b705c598ff |
117
boot_js.ml
117
boot_js.ml
@ -4,8 +4,7 @@ module NVG = Graphv_webgl
|
|||||||
|
|
||||||
let _ =
|
let _ =
|
||||||
Logs.set_reporter (Human.Logs_reporter.console_reporter ());
|
Logs.set_reporter (Human.Logs_reporter.console_reporter ());
|
||||||
Logs.set_level (Some Debug);
|
Logs.set_level (Some Debug)
|
||||||
Logs.debug (fun m -> m "hello")
|
|
||||||
|
|
||||||
module Log = (val Logs.src_log Logs.default : Logs.LOG)
|
module Log = (val Logs.src_log Logs.default : Logs.LOG)
|
||||||
|
|
||||||
@ -27,12 +26,8 @@ let scale_canvas (canvas : Dom_html.canvasElement Js.t) =
|
|||||||
canvas##.style##.width := width;
|
canvas##.style##.width := width;
|
||||||
canvas##.style##.height := height
|
canvas##.style##.height := height
|
||||||
|
|
||||||
let _ =
|
let webgl_initialize canvas =
|
||||||
let canvas =
|
|
||||||
Js.Unsafe.coerce (Dom_html.getElementById_exn "canvas")
|
|
||||||
in
|
|
||||||
scale_canvas canvas;
|
scale_canvas canvas;
|
||||||
let webgl_ctx =
|
|
||||||
(* Graphv requires a stencil buffer to work properly *)
|
(* Graphv requires a stencil buffer to work properly *)
|
||||||
let attrs = WebGL.defaultContextAttributes in
|
let attrs = WebGL.defaultContextAttributes in
|
||||||
attrs##.stencil := Js._true;
|
attrs##.stencil := Js._true;
|
||||||
@ -43,7 +38,8 @@ let _ =
|
|||||||
print_endline "Sorry your browser does not support WebGL";
|
print_endline "Sorry your browser does not support WebGL";
|
||||||
raise Exit
|
raise Exit
|
||||||
| Some ctx -> ctx
|
| Some ctx -> ctx
|
||||||
in
|
|
||||||
|
let graphv_initialize webgl_ctx =
|
||||||
let open NVG in
|
let open NVG in
|
||||||
let vg =
|
let vg =
|
||||||
create
|
create
|
||||||
@ -53,57 +49,74 @@ let _ =
|
|||||||
(* File in this case is actually the CSS font name *)
|
(* File in this case is actually the CSS font name *)
|
||||||
Text.create vg ~name:"sans" ~file:"sans" |> ignore;
|
Text.create vg ~name:"sans" ~file:"sans" |> ignore;
|
||||||
webgl_ctx##clearColor 0.3 0.3 0.32 1.;
|
webgl_ctx##clearColor 0.3 0.3 0.32 1.;
|
||||||
|
vg
|
||||||
|
|
||||||
(*
|
let request_animation_frame () =
|
||||||
let render ev =
|
let t, s = Lwt.wait () in
|
||||||
webgl_ctx##clear
|
let (_ : Dom_html.animation_frame_request_id) =
|
||||||
(webgl_ctx##._COLOR_BUFFER_BIT_
|
|
||||||
lor webgl_ctx##._DEPTH_BUFFER_BIT_
|
|
||||||
lor webgl_ctx##._STENCIL_BUFFER_BIT_);
|
|
||||||
let device_ratio = Dom_html.window##.devicePixelRatio in
|
|
||||||
begin_frame vg ~width:canvas##.width ~height:canvas##.height
|
|
||||||
~device_ratio;
|
|
||||||
Transform.scale vg ~x:device_ratio ~y:device_ratio;
|
|
||||||
ignore Human.Panel.Ui.(panel vg Gg.P2.o test ev);
|
|
||||||
(*
|
|
||||||
Path.begin_ vg ;
|
|
||||||
Path.rect vg ~x:40. ~y:40. ~w:320. ~h:320. ;
|
|
||||||
set_fill_color vg ~color:Color.(rgba ~r:154 ~g:203 ~b:255 ~a:200) ;
|
|
||||||
fill vg ;
|
|
||||||
Transform.translate vg ~x:200. ~y:200. ;
|
|
||||||
Transform.rotate vg ~angle:(time *. 0.0005) ;
|
|
||||||
Text.set_font_face vg ~name:"sans" ;
|
|
||||||
Text.set_size vg ~size:48. ;
|
|
||||||
Text.set_align vg ~align:Align.(center lor middle) ;
|
|
||||||
set_fill_color vg ~color:Color.white ;
|
|
||||||
Text.text vg ~x:0. ~y:0. "Hello World!" ; *)
|
|
||||||
NVG.end_frame vg
|
|
||||||
in
|
|
||||||
Dom_html.window##requestAnimationFrame
|
Dom_html.window##requestAnimationFrame
|
||||||
(Js.wrap_callback (fun _ -> render Human.Event.empty))
|
(Js.wrap_callback (fun (time : float) -> Lwt.wakeup s time))
|
||||||
|> ignore;*)
|
in
|
||||||
let open Js_of_ocaml_lwt.Lwt_js_events in
|
t
|
||||||
async (fun () ->
|
|
||||||
buffered_loop (make_event Dom_html.Event.keydown)
|
let render_stream canvas webgl_ctx vg
|
||||||
Dom_html.document (fun ev _ ->
|
(render : NVG.t -> ?time:float -> Gg.p2 -> Human.I.t -> unit) :
|
||||||
|
Human.I.t Lwt_stream.t -> unit Lwt.t =
|
||||||
|
Lwt_stream.iter_n (fun i ->
|
||||||
|
request_animation_frame () >>= fun time ->
|
||||||
webgl_ctx##clear
|
webgl_ctx##clear
|
||||||
(webgl_ctx##._COLOR_BUFFER_BIT_
|
(webgl_ctx##._COLOR_BUFFER_BIT_
|
||||||
lor webgl_ctx##._DEPTH_BUFFER_BIT_
|
lor webgl_ctx##._DEPTH_BUFFER_BIT_
|
||||||
lor webgl_ctx##._STENCIL_BUFFER_BIT_);
|
lor webgl_ctx##._STENCIL_BUFFER_BIT_);
|
||||||
let device_ratio = Dom_html.window##.devicePixelRatio in
|
let device_ratio = Dom_html.window##.devicePixelRatio in
|
||||||
begin_frame vg ~width:canvas##.width ~height:canvas##.height
|
NVG.begin_frame vg ~width:canvas##.width ~height:canvas##.height
|
||||||
~device_ratio;
|
~device_ratio;
|
||||||
Transform.scale vg ~x:device_ratio ~y:device_ratio;
|
NVG.Transform.scale vg ~x:device_ratio ~y:device_ratio;
|
||||||
Human.Panel.Ui.(
|
render vg ~time Gg.P2.o i;
|
||||||
render_lwt vg Gg.P2.o
|
|
||||||
(Human.Event_js.evt_of_jskey `Press ev))
|
|
||||||
>>= fun p ->
|
|
||||||
Logs.debug (fun m ->
|
|
||||||
m "Drawing finished at point: %a" Gg.V2.pp p);
|
|
||||||
NVG.end_frame vg;
|
NVG.end_frame vg;
|
||||||
Lwt.return_unit))
|
Lwt.return_unit)
|
||||||
|
|
||||||
(* Dom_html.document##.onkeydown
|
open Human
|
||||||
:= Dom.handler (fun (evt : Dom_html.keyboardEvent Js.t) ->
|
|
||||||
render (Human.Event_js.evt_of_jskey `Press evt) ;
|
let _ =
|
||||||
Js._false ) *)
|
let canvas =
|
||||||
|
Js.Unsafe.coerce (Dom_html.getElementById_exn "canvas")
|
||||||
|
in
|
||||||
|
let webgl_ctx = webgl_initialize canvas in
|
||||||
|
let vg = graphv_initialize webgl_ctx in
|
||||||
|
let open Js_of_ocaml_lwt.Lwt_js_events in
|
||||||
|
let open Nottui in
|
||||||
|
let gravity_pad = Gravity.make ~h:`Negative ~v:`Negative in
|
||||||
|
let gravity_crop = Gravity.make ~h:`Positive ~v:`Negative in
|
||||||
|
let body = Lwd.var (Lwd.pure Ui.empty) in
|
||||||
|
let wm = Widgets.window_manager (Lwd.join (Lwd.get body)) in
|
||||||
|
Nav.test_pull () >>= fun test_store ->
|
||||||
|
let ui = Widgets.(h_node_area (test_store, [ [] ])) in
|
||||||
|
let root =
|
||||||
|
Lwd.set body
|
||||||
|
(Lwd.map ~f:(Ui.resize ~pad:gravity_pad ~crop:gravity_crop) ui);
|
||||||
|
Widgets.window_manager_view wm
|
||||||
|
in
|
||||||
|
|
||||||
|
let events, push_event = Lwt_stream.create () in
|
||||||
|
let images =
|
||||||
|
Human.Nottui_lwt.render vg
|
||||||
|
~size:(Gg.P2.v canvas##.width canvas##.height)
|
||||||
|
events root
|
||||||
|
in
|
||||||
|
async (fun () ->
|
||||||
|
render_stream canvas webgl_ctx vg
|
||||||
|
(fun vg ?(time = 0.) p i ->
|
||||||
|
let _ = time in
|
||||||
|
Log.debug (fun m ->
|
||||||
|
m "Drawing image: p=%a n=%a" Gg.V2.pp p
|
||||||
|
(I.Draw.pp ~attr:A.dark)
|
||||||
|
i);
|
||||||
|
let p' = I.Draw.node vg A.dark p i in
|
||||||
|
Logs.debug (fun m ->
|
||||||
|
m "Drawing finished: p'=%a" Gg.V2.pp p'))
|
||||||
|
images);
|
||||||
|
buffered_loop (make_event Dom_html.Event.keydown) Dom_html.document
|
||||||
|
(fun ev _ ->
|
||||||
|
Lwt.return
|
||||||
|
@@ push_event (Some (`Keys [ Event_js.evt_of_jskey ev ])))
|
||||||
|
|||||||
@ -4,4 +4,4 @@ if [ ! -f /tmp/key.pem ]; then
|
|||||||
openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout /tmp/key.pem -out /tmp/cert.pem -batch
|
openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout /tmp/key.pem -out /tmp/cert.pem -batch
|
||||||
fi
|
fi
|
||||||
|
|
||||||
npx http-server --cors -S -P https://github.com --log-ip -c-1 -C /tmp/cert.pem -K /tmp/key.pem
|
npx http-server --cors -S -P https://gitea.departmentofinter.net --log-ip -c-1 -C /tmp/cert.pem -K /tmp/key.pem
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
44
notes.org
Normal file
44
notes.org
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
* mvp todo
|
||||||
|
|
||||||
|
|
||||||
|
** toplevel repl in js_of_ocaml
|
||||||
|
** git pull from gitea.departmentofinter.net/console/boot
|
||||||
|
** git push to gitea.departmentofinter.net/console/boot
|
||||||
|
** execute a git file execution in top level
|
||||||
|
** display arbitrary git file from pulled repo
|
||||||
|
** edit arbitrary file with common emacs bindings
|
||||||
|
*** move left and right by character
|
||||||
|
*** move up and down by line
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* other todo
|
||||||
|
*** yank (to clipboard) next char
|
||||||
|
*** move left and right by word and sentance
|
||||||
|
*** region select
|
||||||
|
|
||||||
|
|
||||||
|
* principles?
|
||||||
|
an "anywhere" programming environment
|
||||||
|
|
||||||
|
* 221211
|
||||||
|
ok you got the scroll box mostly working so next:
|
||||||
|
** fix the scroll jump bugs
|
||||||
|
** setup better keybindings
|
||||||
|
** fix cursor and active focus indicators
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* 221210 -
|
||||||
|
** need to resolve the issue with the ui.t Resize type.
|
||||||
|
this is an issue with the direction of the determination of the .height and .width fields of Ui.t
|
||||||
|
|
||||||
|
currently you were planning to combine update_sensors and update_size
|
||||||
|
|
||||||
|
in the original nottui.ml library, are Ui.t.w and Ui.t.h determined from the top down orbottom up?
|
||||||
|
the bottom up, becahse they are chars
|
||||||
|
|
||||||
|
|
||||||
37
unicom.org
Normal file
37
unicom.org
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
UNICOM
|
||||||
|
|
||||||
|
unifying tools for thought and commmunication
|
||||||
|
|
||||||
|
At the top level is a kind of "trace" that connects all the tools together
|
||||||
|
and records the exact use of all the tools in a session. Traces are the only
|
||||||
|
kind of document in the system, and are basically written by a user when
|
||||||
|
they interact with the system. Users can store, retrieve, view, and modify
|
||||||
|
traces as a way of controlling system state, retrieving history, and sharing
|
||||||
|
information?
|
||||||
|
|
||||||
|
|
||||||
|
tools for thought:
|
||||||
|
- todo lists
|
||||||
|
- personal journal
|
||||||
|
- calendar
|
||||||
|
- calculator/spreadsheet
|
||||||
|
- health, fitness, finance data tracking, analysis
|
||||||
|
- Integrated Development Environment [for development/configuration of all these tools]
|
||||||
|
|
||||||
|
|
||||||
|
tools for communication:
|
||||||
|
- collaborative documents
|
||||||
|
video / .txt file
|
||||||
|
- content discovery,display,labeling?
|
||||||
|
twitter / netflix / books
|
||||||
|
- direct messages
|
||||||
|
sms / email
|
||||||
|
- group messages
|
||||||
|
private (chat) / private (irc,twitter)
|
||||||
|
- audio/music production
|
||||||
|
sound driver / DAW
|
||||||
|
- cad
|
||||||
|
KiCad / OpenSCAD
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user