From cc71cc7f644ded9c09abfd91d9302cbc8eb628d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulysse=20G=C3=A9rard?= Date: Wed, 21 Aug 2024 12:43:36 +0200 Subject: [PATCH] Split brr_lwd_ui in multiple libs --- bin/main.ml | 9 ++--- bin/servers.ml | 4 +-- vendor/brr_lwd_ui/brr-lwd-ui.opam | 34 +++++++++++++++++++ vendor/brr_lwd_ui/lib/brr_lwd_ui.ml | 7 ++++ vendor/brr_lwd_ui/lib/{ => button}/button.ml | 0 vendor/brr_lwd_ui/lib/{ => button}/button.mli | 0 vendor/brr_lwd_ui/lib/button/dune | 5 +++ vendor/brr_lwd_ui/lib/{ => common}/attrs.ml | 0 vendor/brr_lwd_ui/lib/common/dune | 4 +++ .../brr_lwd_ui/lib/{ => common}/encodings.ml | 0 vendor/brr_lwd_ui/lib/{ => common}/import.ml | 0 .../brr_lwd_ui/lib/{ => common}/persistent.ml | 0 .../lib/{ => common}/persistent.mli | 0 .../brr_lwd_ui/lib/{ => common}/translated.ml | 0 vendor/brr_lwd_ui/lib/{ => common}/utils.ml | 0 .../controlled_scroll.ml | 1 + .../controlled_scroll.mli | 0 vendor/brr_lwd_ui/lib/controlled_scroll/dune | 5 +++ vendor/brr_lwd_ui/lib/dune | 16 +++++++-- vendor/brr_lwd_ui/lib/forms/dune | 5 +++ vendor/brr_lwd_ui/lib/table/dune | 13 +++++++ 21 files changed, 94 insertions(+), 9 deletions(-) create mode 100644 vendor/brr_lwd_ui/brr-lwd-ui.opam create mode 100644 vendor/brr_lwd_ui/lib/brr_lwd_ui.ml rename vendor/brr_lwd_ui/lib/{ => button}/button.ml (100%) rename vendor/brr_lwd_ui/lib/{ => button}/button.mli (100%) create mode 100644 vendor/brr_lwd_ui/lib/button/dune rename vendor/brr_lwd_ui/lib/{ => common}/attrs.ml (100%) create mode 100644 vendor/brr_lwd_ui/lib/common/dune rename vendor/brr_lwd_ui/lib/{ => common}/encodings.ml (100%) rename vendor/brr_lwd_ui/lib/{ => common}/import.ml (100%) rename vendor/brr_lwd_ui/lib/{ => common}/persistent.ml (100%) rename vendor/brr_lwd_ui/lib/{ => common}/persistent.mli (100%) rename vendor/brr_lwd_ui/lib/{ => common}/translated.ml (100%) rename vendor/brr_lwd_ui/lib/{ => common}/utils.ml (100%) rename vendor/brr_lwd_ui/lib/{ => controlled_scroll}/controlled_scroll.ml (99%) rename vendor/brr_lwd_ui/lib/{ => controlled_scroll}/controlled_scroll.mli (100%) create mode 100644 vendor/brr_lwd_ui/lib/controlled_scroll/dune create mode 100644 vendor/brr_lwd_ui/lib/forms/dune create mode 100644 vendor/brr_lwd_ui/lib/table/dune diff --git a/bin/main.ml b/bin/main.ml index 218e2af..08b38fc 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -35,6 +35,7 @@ module P = Player.Playback_controller (struct end) let app = + let open Brr_lwd_ui.Forms in let playlist = Brr_lwd_ui.Persistent.var ~key:"toto1" 0 in let on_click _ _ = Lwd.set playlist (Lwd.peek playlist + 1); @@ -59,11 +60,11 @@ let app = Elwd.div ~at:[ `P (At.style (Jstr.v "grid-column:1/-1")) ] [ `R player ] in let f_search = - let open Brr_lwd_ui.Field_textinput in + let open Field_textinput in make { name = "pouet"; default = None; label = [] } in let f_sort = - let open Brr_lwd_ui.Field_select in + let open Field_select in let options = Lwd.pure (Lwd_seq.of_list [ ("date_added", "Date added"); ("name", "Name") ]) @@ -71,7 +72,7 @@ let app = make { name = "view-sort"; default = "date_added"; label = [] } options in let f_order = - let open Brr_lwd_ui.Field_select in + let open Field_select in let options = Lwd.pure (Lwd_seq.of_list @@ -82,7 +83,7 @@ let app = let f_sort_order = Lwd.pair f_sort.value f_order.value in let filters, f_value = let f_libraries = - let open Brr_lwd_ui.Field_checkboxes in + let open Field_checkboxes in let choices = Lwd_seq.fold_monoid (fun (_, l) -> diff --git a/bin/servers.ml b/bin/servers.ml index 3156e80..f8acb25 100644 --- a/bin/servers.ml +++ b/bin/servers.ml @@ -46,7 +46,7 @@ let new_connexion ~base_url ~username ~password = connexions module Connect_form = struct - open Brr_lwd_ui.Form + open Brr_lwd_ui.Forms.Form type t = { url : string Field.validation; @@ -82,7 +82,7 @@ module Connect_form = struct end let ui_form () = - let open Brr_lwd_ui.Form in + let open Brr_lwd_ui.Forms.Form in create (module Connect_form) (fun t -> diff --git a/vendor/brr_lwd_ui/brr-lwd-ui.opam b/vendor/brr_lwd_ui/brr-lwd-ui.opam new file mode 100644 index 0000000..1c02083 --- /dev/null +++ b/vendor/brr_lwd_ui/brr-lwd-ui.opam @@ -0,0 +1,34 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +synopsis: "UI components for use with with brr_lwd" +description: "A _really_ long description" +maintainer: [""] +authors: ["Ulysse GĂ©rard"] +license: "AGPL-3.0" +homepage: "https://github.com/voodoos/brr-lwd-ui" +bug-reports: "https://github.com/voodoos/brr-lwd-ui/issues" +depends: [ + "dune" {>= "3.11"} + "containers" + "js_of_ocaml" + "js_of_ocaml-ppx" + "brr" + "lwd" + "brr-lwd" + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] +] +dev-repo: "git+https://github.com/voodoos/brr-lwd-ui.git" diff --git a/vendor/brr_lwd_ui/lib/brr_lwd_ui.ml b/vendor/brr_lwd_ui/lib/brr_lwd_ui.ml new file mode 100644 index 0000000..50e0d04 --- /dev/null +++ b/vendor/brr_lwd_ui/lib/brr_lwd_ui.ml @@ -0,0 +1,7 @@ +module Attrs = Attrs +module Button = Button +module Persistent = Persistent +module Utils = Utils +module Translated = Translated +module Controlled_scroll = Controlled_scroll +module Forms = Forms diff --git a/vendor/brr_lwd_ui/lib/button.ml b/vendor/brr_lwd_ui/lib/button/button.ml similarity index 100% rename from vendor/brr_lwd_ui/lib/button.ml rename to vendor/brr_lwd_ui/lib/button/button.ml diff --git a/vendor/brr_lwd_ui/lib/button.mli b/vendor/brr_lwd_ui/lib/button/button.mli similarity index 100% rename from vendor/brr_lwd_ui/lib/button.mli rename to vendor/brr_lwd_ui/lib/button/button.mli diff --git a/vendor/brr_lwd_ui/lib/button/dune b/vendor/brr_lwd_ui/lib/button/dune new file mode 100644 index 0000000..6b80b95 --- /dev/null +++ b/vendor/brr_lwd_ui/lib/button/dune @@ -0,0 +1,5 @@ +(library + (name button) + (public_name brr-lwd-ui.button) + (flags :standard -open Common) + (libraries containers containers-data brrer lwd brr-lwd base64 common)) diff --git a/vendor/brr_lwd_ui/lib/attrs.ml b/vendor/brr_lwd_ui/lib/common/attrs.ml similarity index 100% rename from vendor/brr_lwd_ui/lib/attrs.ml rename to vendor/brr_lwd_ui/lib/common/attrs.ml diff --git a/vendor/brr_lwd_ui/lib/common/dune b/vendor/brr_lwd_ui/lib/common/dune new file mode 100644 index 0000000..c46156e --- /dev/null +++ b/vendor/brr_lwd_ui/lib/common/dune @@ -0,0 +1,4 @@ +(library + (name common) + (public_name brr-lwd-ui.common) + (libraries containers containers-data brrer lwd brr-lwd base64)) diff --git a/vendor/brr_lwd_ui/lib/encodings.ml b/vendor/brr_lwd_ui/lib/common/encodings.ml similarity index 100% rename from vendor/brr_lwd_ui/lib/encodings.ml rename to vendor/brr_lwd_ui/lib/common/encodings.ml diff --git a/vendor/brr_lwd_ui/lib/import.ml b/vendor/brr_lwd_ui/lib/common/import.ml similarity index 100% rename from vendor/brr_lwd_ui/lib/import.ml rename to vendor/brr_lwd_ui/lib/common/import.ml diff --git a/vendor/brr_lwd_ui/lib/persistent.ml b/vendor/brr_lwd_ui/lib/common/persistent.ml similarity index 100% rename from vendor/brr_lwd_ui/lib/persistent.ml rename to vendor/brr_lwd_ui/lib/common/persistent.ml diff --git a/vendor/brr_lwd_ui/lib/persistent.mli b/vendor/brr_lwd_ui/lib/common/persistent.mli similarity index 100% rename from vendor/brr_lwd_ui/lib/persistent.mli rename to vendor/brr_lwd_ui/lib/common/persistent.mli diff --git a/vendor/brr_lwd_ui/lib/translated.ml b/vendor/brr_lwd_ui/lib/common/translated.ml similarity index 100% rename from vendor/brr_lwd_ui/lib/translated.ml rename to vendor/brr_lwd_ui/lib/common/translated.ml diff --git a/vendor/brr_lwd_ui/lib/utils.ml b/vendor/brr_lwd_ui/lib/common/utils.ml similarity index 100% rename from vendor/brr_lwd_ui/lib/utils.ml rename to vendor/brr_lwd_ui/lib/common/utils.ml diff --git a/vendor/brr_lwd_ui/lib/controlled_scroll.ml b/vendor/brr_lwd_ui/lib/controlled_scroll/controlled_scroll.ml similarity index 99% rename from vendor/brr_lwd_ui/lib/controlled_scroll.ml rename to vendor/brr_lwd_ui/lib/controlled_scroll/controlled_scroll.ml index 0455e9b..b21a503 100644 --- a/vendor/brr_lwd_ui/lib/controlled_scroll.ml +++ b/vendor/brr_lwd_ui/lib/controlled_scroll/controlled_scroll.ml @@ -1,3 +1,4 @@ +open Import open Brr open Brr_lwd diff --git a/vendor/brr_lwd_ui/lib/controlled_scroll.mli b/vendor/brr_lwd_ui/lib/controlled_scroll/controlled_scroll.mli similarity index 100% rename from vendor/brr_lwd_ui/lib/controlled_scroll.mli rename to vendor/brr_lwd_ui/lib/controlled_scroll/controlled_scroll.mli diff --git a/vendor/brr_lwd_ui/lib/controlled_scroll/dune b/vendor/brr_lwd_ui/lib/controlled_scroll/dune new file mode 100644 index 0000000..354a283 --- /dev/null +++ b/vendor/brr_lwd_ui/lib/controlled_scroll/dune @@ -0,0 +1,5 @@ +(library + (name controlled_scroll) + (public_name brr-lwd-ui.controlled-scroll) + (flags :standard -open Common) + (libraries containers containers-data brrer lwd brr-lwd base64 common)) diff --git a/vendor/brr_lwd_ui/lib/dune b/vendor/brr_lwd_ui/lib/dune index 0eb8ac8..cfb55bf 100644 --- a/vendor/brr_lwd_ui/lib/dune +++ b/vendor/brr_lwd_ui/lib/dune @@ -1,6 +1,16 @@ -(include_subdirs unqualified) - (library (name brr_lwd_ui) (public_name brr-lwd-ui) - (libraries containers containers-data brrer lwd brr-lwd base64)) + (flags :standard -open Common) + (libraries + containers + containers-data + brrer + lwd + brr-lwd + base64 + common + button + controlled_scroll + forms + table)) diff --git a/vendor/brr_lwd_ui/lib/forms/dune b/vendor/brr_lwd_ui/lib/forms/dune new file mode 100644 index 0000000..11a63ff --- /dev/null +++ b/vendor/brr_lwd_ui/lib/forms/dune @@ -0,0 +1,5 @@ +(library + (name forms) + (public_name brr-lwd-ui.forms) + (flags :standard -open Common) + (libraries containers containers-data brrer lwd brr-lwd base64 common)) diff --git a/vendor/brr_lwd_ui/lib/table/dune b/vendor/brr_lwd_ui/lib/table/dune new file mode 100644 index 0000000..f629b12 --- /dev/null +++ b/vendor/brr_lwd_ui/lib/table/dune @@ -0,0 +1,13 @@ +(library + (name table) + (public_name brr-lwd-ui.table) + (flags :standard -open Common) + (libraries + containers + containers-data + brrer + lwd + brr-lwd + base64 + common + controlled_scroll))