Skip to content

Commit

Permalink
Merge pull request #585 from jrochel/6.5
Browse files Browse the repository at this point in the history
compatibility with tyxml.4.3.0 and js_of_ocaml.3.3
  • Loading branch information
Jan Rochel authored Dec 19, 2018
2 parents bd729e3 + e154932 commit ace5cfd
Show file tree
Hide file tree
Showing 37 changed files with 108 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
===== 6.5 (2018-12-18) =====

* Compatibility with tyxml.4.3.x and js_of_caml.3.3.x

===== 6.4 (2018-12-17) =====

* Compatibility with Lwt 4.x
Expand Down
12 changes: 6 additions & 6 deletions opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
opam-version: "2.0"
name: "eliom"
version: "6.4.0"
version: "6.5.0"
maintainer: "dev@ocsigen.org"
authors: "dev@ocsigen.org"
synopsis: "Client/server Web framework"
Expand All @@ -16,16 +16,16 @@ depends: [
"deriving" {>= "0.6"}
"ppx_deriving"
"ppx_tools" {>= "0.99.3"}
"js_of_ocaml" {>= "3.0" & < "3.3"}
"js_of_ocaml-lwt" {< "3.3"}
"js_of_ocaml" {>= "3.3"}
"js_of_ocaml-lwt" {>= "3.3"}
"js_of_ocaml-ocamlbuild" {build}
"js_of_ocaml-ppx"
"js_of_ocaml-ppx" {<= "3.0.2"} | "js_of_ocaml-ppx_deriving_json"
"js_of_ocaml-tyxml" {< "3.2.0"}
"js_of_ocaml-ppx_deriving_json" {>= "3.3"}
"js_of_ocaml-tyxml" {>= "3.3"}
"lwt_log"
"lwt_ppx"
"lwt_camlp4"
"tyxml" {>= "4.0.0" & < "4.3.0"}
"tyxml" {>= "4.3.0"}
"ocsigenserver" {>= "2.10"}
"ipaddr" {>= "2.1"}
"reactiveData" {>= "0.2.1"}
Expand Down
4 changes: 2 additions & 2 deletions pkg/META
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ package "syntax" (
description = "Syntax extension: predefined commonly use syntaxes"
version = "[distributed with Eliom]"

requires(syntax, preprocessor) = "js_of_ocaml.syntax,js_of_ocaml-camlp4.deriving,lwt_camlp4"
requires(syntax, toploop) = "js_of_ocaml.syntax,js_of_ocaml-camlp4.deriving,lwt_camlp4"
requires(syntax, preprocessor) = "js_of_ocaml-camlp4,js_of_ocaml-camlp4.deriving,lwt_camlp4"
requires(syntax, toploop) = "js_of_ocaml-camlp4,js_of_ocaml-camlp4.deriving,lwt_camlp4"
archive(syntax, preprocessor) = "-ignore dummy"
)

Expand Down
1 change: 1 addition & 0 deletions src/lib/client/eliommod_cookies.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

open Js_of_ocaml
open Eliom_lib
open Ocsigen_cookies

Expand Down
1 change: 1 addition & 0 deletions src/lib/client/eliommod_dom.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

open Js_of_ocaml
open Eliom_lib

let section = Lwt_log.Section.make "eliom:dom"
Expand Down
2 changes: 2 additions & 0 deletions src/lib/client/eliommod_dom.mli
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

(** Cross browser dom manipulation functions *)

open Js_of_ocaml

class type ['element] get_tag = object
method getElementsByTagName : Js.js_string Js.t -> 'element Dom.nodeList Js.t Js.meth
end
Expand Down
2 changes: 2 additions & 0 deletions src/lib/client/eliommod_parameters.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

open Js_of_ocaml

type param = Form.form_elt
type field = [`String of Js.js_string Js.t | `File of File.file Js.t ]

Expand Down
1 change: 1 addition & 0 deletions src/lib/eliom_client.client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ include Eliom_client_core
before Eliom_service, in order to make possible to use the
client-server syntax in Eliom itself. *)

open Js_of_ocaml
open Eliom_lib
module Opt = Eliom_lib.Option

Expand Down
1 change: 1 addition & 0 deletions src/lib/eliom_client.client.mli
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

(** Call server side services and change the current page. *)

open Js_of_ocaml
open Eliom_lib

(** {2 Mobile applications} *)
Expand Down
12 changes: 11 additions & 1 deletion src/lib/eliom_client_core.client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

open Js_of_ocaml
open Eliom_lib

module Xml = Eliom_content_core.Xml
Expand Down Expand Up @@ -477,6 +478,10 @@ let reify_caml_event name node ce =
name,
`Keyboard
(fun ev -> try f ev; true with Eliom_client_value.False -> false)
| Xml.CE_client_closure_touch f ->
name,
`Touch
(fun ev -> try f ev; true with Eliom_client_value.False -> false)
| Xml.CE_client_closure_mouse f ->
name,
`Mouse
Expand All @@ -500,14 +505,19 @@ let register_event_handler, flush_load_script =
add f
| "onload", `Keyboard _ ->
failwith "keyboard event handler for onload"
| "onload", `Touch _ ->
failwith "touch event handler for onload"
| "onload", `Mouse _ ->
failwith "keyboard event handler for onload"
failwith "mouse event handler for onload"
| name, `Other f ->
Js.Unsafe.set node (Js.bytestring name)
(Dom_html.handler (fun ev -> Js.bool (f ev)))
| name, `Keyboard f ->
Js.Unsafe.set node (Js.bytestring name)
(Dom_html.handler (fun ev -> Js.bool (f ev)))
| name, `Touch f ->
Js.Unsafe.set node (Js.bytestring name)
(Dom_html.handler (fun ev -> Js.bool (f ev)))
| name, `Mouse f ->
Js.Unsafe.set node (Js.bytestring name)
(Dom_html.handler (fun ev -> Js.bool (f ev)))
Expand Down
2 changes: 2 additions & 0 deletions src/lib/eliom_client_main.eliom
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

[%%client.start]

open Js_of_ocaml

let _ = Eliom_client.init ()

(* The following lines are for Eliom_bus, Eliom_comet and Eliom_react
Expand Down
1 change: 1 addition & 0 deletions src/lib/eliom_comet.client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

(* This file is for client-side comet-programming. *)

open Js_of_ocaml
module Ecb = Eliom_comet_base

let section = Eliom_lib.Lwt_log.Section.make "eliom:comet"
Expand Down
2 changes: 2 additions & 0 deletions src/lib/eliom_config.client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

open Js_of_ocaml

let get_default_hostname () = Url.Current.host
let get_default_port () = 80 (*VVV take from server? !!!!!!!!! *) (*RRR ??? Url.default_http_port ???*)
let get_default_sslport () = 443 (*VVV take from server? !!!!!!!!! *) (*RRR ??? replace by Url.default_https_port ???*)
Expand Down
2 changes: 2 additions & 0 deletions src/lib/eliom_content.client.mli
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

open Js_of_ocaml

(** This module provides the creation of valid XML content, i.e. XML, SVG,
and (X)HTML5.
Expand Down
3 changes: 3 additions & 0 deletions src/lib/eliom_content.eliom
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
[%%shared type boxed]

[%%client

open Js_of_ocaml

include Eliom_content_
let force_link = ()

Expand Down
6 changes: 6 additions & 0 deletions src/lib/eliom_content.server.mli
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
*)

open Js_of_ocaml

(** Low-level XML manipulation. *)
module Xml : sig

Expand All @@ -96,6 +98,8 @@ module Xml : sig
(Dom_html.mouseEvent Js.t -> unit) Eliom_client_value.t
and type keyboard_event_handler =
(Dom_html.keyboardEvent Js.t -> unit) Eliom_client_value.t
and type touch_event_handler =
(Dom_html.touchEvent Js.t -> unit) Eliom_client_value.t

(** {2 Unique nodes } *)

Expand Down Expand Up @@ -164,6 +168,8 @@ module Xml_shared : Xml_sigs.T
(Dom_html.mouseEvent Js.t -> unit) Eliom_client_value.t
and type keyboard_event_handler =
(Dom_html.keyboardEvent Js.t -> unit) Eliom_client_value.t
and type touch_event_handler =
(Dom_html.touchEvent Js.t -> unit) Eliom_client_value.t

(** Building and pretty-printing valid SVG tree.
Information about Svg api can be found at {% <<a_api project="tyxml" | module Svg_sigs.T >> %}*)
Expand Down
1 change: 1 addition & 0 deletions src/lib/eliom_content_.client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*)


open Js_of_ocaml
open Eliom_lib
open Eliom_content_core

Expand Down
7 changes: 7 additions & 0 deletions src/lib/eliom_content_core.client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
Its name is not [Eliom_content_base] because this would
suggest the sharing between server and client. *)

open Js_of_ocaml
open Eliom_lib

module Xml = struct
Expand Down Expand Up @@ -90,6 +91,7 @@ module Xml = struct
type event_handler = Dom_html.event Js.t -> unit
type mouse_event_handler = Dom_html.mouseEvent Js.t -> unit
type keyboard_event_handler = Dom_html.keyboardEvent Js.t -> unit
type touch_event_handler = Dom_html.touchEvent Js.t -> unit

let event_handler_attrib name (value : event_handler) =
internal_event_handler_attrib name
Expand All @@ -100,6 +102,9 @@ module Xml = struct
let keyboard_event_handler_attrib name (value : keyboard_event_handler) =
internal_event_handler_attrib name
(Caml (CE_client_closure_keyboard value))
let touch_event_handler_attrib name (value : touch_event_handler) =
internal_event_handler_attrib name
(Caml (CE_client_closure_touch value))

let node_react_children ?(a = []) name children =
{elt = Lazy.from_val (ReactChildren (Node (name,a,[]),children)); node_id=NoId}
Expand Down Expand Up @@ -183,6 +188,7 @@ struct
type event_handler = Xml.event_handler
type mouse_event_handler = Xml.mouse_event_handler
type keyboard_event_handler = Xml.keyboard_event_handler
type touch_event_handler = Xml.touch_event_handler
type attrib = Xml.attrib

let float_attrib name s : attrib =
Expand All @@ -198,6 +204,7 @@ struct
let event_handler_attrib = Xml.event_handler_attrib
let mouse_event_handler_attrib = Xml.mouse_event_handler_attrib
let keyboard_event_handler_attrib = Xml.keyboard_event_handler_attrib
let touch_event_handler_attrib = Xml.touch_event_handler_attrib
let uri_attrib name value =
name, Xml.RAReact (React.S.map
(fun f -> Some (Xml.AStr (Eliom_lazy.force f))) value)
Expand Down
6 changes: 6 additions & 0 deletions src/lib/eliom_content_core.client.mli
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

open Js_of_ocaml

(** XML building and deconstructing. Cf. {% <<a_api subproject="server" |
module Eliom_content_core.Xml >> %}. *)

Expand Down Expand Up @@ -44,6 +46,8 @@ module Xml : sig
(Dom_html.mouseEvent Js.t -> unit) (* Client side-only *)
| CE_client_closure_keyboard of
(Dom_html.keyboardEvent Js.t -> unit) (* Client side-only *)
| CE_client_closure_touch of
(Dom_html.touchEvent Js.t -> unit) (* Client side-only *)
| CE_call_service of
( [ `A | `Form_get | `Form_post] *
((bool * string list) option) *
Expand All @@ -55,6 +59,7 @@ module Xml : sig
type event_handler = Dom_html.event Js.t -> unit
type mouse_event_handler = Dom_html.mouseEvent Js.t -> unit
type keyboard_event_handler = Dom_html.keyboardEvent Js.t -> unit
type touch_event_handler = Dom_html.touchEvent Js.t -> unit

type ename = string
type elt
Expand Down Expand Up @@ -109,6 +114,7 @@ module Xml : sig
val event_handler_attrib : aname -> event_handler -> attrib
val mouse_event_handler_attrib : aname -> mouse_event_handler -> attrib
val keyboard_event_handler_attrib : aname -> keyboard_event_handler -> attrib
val touch_event_handler_attrib : aname -> touch_event_handler -> attrib
val uri_attrib : aname -> uri -> attrib
val uris_attrib : aname -> uri list -> attrib

Expand Down
4 changes: 4 additions & 0 deletions src/lib/eliom_content_core.server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*)


open Js_of_ocaml
open Eliom_lib

(* This the core of [Eliom_content] without its dependencies to [Eliom_service] et al.
Expand Down Expand Up @@ -118,6 +119,7 @@ module Xml = struct
type event_handler = (Dom_html.event Js.t -> unit) Eliom_client_value.t
type mouse_event_handler = (Dom_html.mouseEvent Js.t -> unit) Eliom_client_value.t
type keyboard_event_handler = (Dom_html.keyboardEvent Js.t -> unit) Eliom_client_value.t
type touch_event_handler = (Dom_html.touchEvent Js.t -> unit) Eliom_client_value.t

let make_cryptographic_safe_string () =
(* FIX: we should directly produce a string of the right length *)
Expand All @@ -138,6 +140,8 @@ module Xml = struct
biggest_event_handler_attrib name cf
let keyboard_event_handler_attrib name (cf : keyboard_event_handler) =
biggest_event_handler_attrib name cf
let touch_event_handler_attrib name (cf : touch_event_handler) =
biggest_event_handler_attrib name cf

let client_attrib ?init (x : attrib Eliom_client_value.t) =
let crypto = make_cryptographic_safe_string () in
Expand Down
4 changes: 4 additions & 0 deletions src/lib/eliom_content_core.server.mli
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

(** See {% <<a_api | module Eliom_content>> %} for complete module. *)

open Js_of_ocaml

module Xml : sig
include Xml_sigs.Iterable
with type 'a wrap = 'a
Expand All @@ -30,6 +32,8 @@ module Xml : sig
(Dom_html.mouseEvent Js.t -> unit) Eliom_client_value.t
and type keyboard_event_handler =
(Dom_html.keyboardEvent Js.t -> unit) Eliom_client_value.t
and type touch_event_handler =
(Dom_html.touchEvent Js.t -> unit) Eliom_client_value.t

type caml_event_handler

Expand Down
2 changes: 2 additions & 0 deletions src/lib/eliom_form.eliom
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

open%shared Js_of_ocaml

[%%client.start]

let read_params form y =
Expand Down
2 changes: 2 additions & 0 deletions src/lib/eliom_form.eliomi
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ val set_error_handler : (unit -> bool Lwt.t) -> unit

[%%shared.start]

open Js_of_ocaml

module type Html = sig

include Html_sigs.T
Expand Down
2 changes: 2 additions & 0 deletions src/lib/eliom_lib.client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

open Js_of_ocaml

include Ocsigen_lib_base
include (Eliom_lib_base :
module type of Eliom_lib_base
Expand Down
2 changes: 2 additions & 0 deletions src/lib/eliom_lib.client.mli
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

(** Eliom standard library *)

open Js_of_ocaml

(** See {% <<a_api project="ocsigenserver"| module Ocsigen_lib_base >> %}. *)
include module type of Ocsigen_lib_base
with type poly = Ocsigen_lib.poly
Expand Down
2 changes: 2 additions & 0 deletions src/lib/eliom_parameter.client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

open Js_of_ocaml

include Eliom_parameter_base

type raw_post_data = unit
Expand Down
2 changes: 2 additions & 0 deletions src/lib/eliom_parameter.client.mli
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

open Js_of_ocaml

include Eliom_parameter_sigs.S with type raw_post_data = unit

(** Specifying parameter as [user_type ~of_string ~to_string s] tells
Expand Down
1 change: 1 addition & 0 deletions src/lib/eliom_process.client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

open Js_of_ocaml
open Eliom_lib
open Ocsigen_cookies

Expand Down
Loading

0 comments on commit ace5cfd

Please sign in to comment.