Skip to content

Commit ac603f1

Browse files
committed
add React bindings to ReactPPX4Support
1 parent 64bd843 commit ac603f1

8 files changed

+55
-38
lines changed

jscomp/main/builtin_cmi_datasets.ml

+3-3
Large diffs are not rendered by default.

jscomp/main/builtin_cmj_datasets.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(* b2255d2167c126f9d8da59a636e3b5ba *)
1+
(* 3fbf725f522373b95266468828fa54b3 *)
22
let module_names : string array = Obj.magic (
33
"Js" (* 23 *),
44
"Arg" (* 217 *),
@@ -250,7 +250,7 @@ let module_data : string array = Obj.magic (
250250
(* CamlinternalMod *)"\132\149\166\190\000\000\000\003\000\000\000\001\000\000\000\003\000\000\000\003\160\128A",
251251
(* Js_typed_array2 *)"\132\149\166\190\000\000\000\003\000\000\000\001\000\000\000\003\000\000\000\003\160\128A",
252252
(* CamlinternalLazy *)"\132\149\166\190\000\000\0002\000\000\000\017\000\000\0005\000\000\0002\160\176\176%force\144\160\160A@@@\176&is_val\144\160\160A@@@\176)force_val\144\160\160A@@@A",
253-
(* ReactPPX4Support *)"\132\149\166\190\000\000\000E\000\000\000\012\000\000\000.\000\000\000'\160\160\1764createElementWithKey\144\160\160D@@@\176<createElementVariadicWithKey\144\160\160E@@@A",
253+
(* ReactPPX4Support *)"\132\149\166\190\000\000\000E\000\000\000\012\000\000\000.\000\000\000'\160\160\1764createElementWithKey\144\160\160C@@@\176<createElementVariadicWithKey\144\160\160D@@@@",
254254
(* Belt_MutableQueue *)"\132\149\166\190\000\000\002O\000\000\000\176\000\000\002D\000\000\002)\160\b\000\000T\000\176#add\144\160\160B@@@\176#map\144\160\160B@@@\176#pop\144\160\160A@@@\176$copy\144\160\160A@@@\176$make\144\160\160A@@\144\148\192A\160\176\001\003\245%param@@\151\176\176@\179\176&length%first$lastA@A\160\146\160\025_i\000\000\000\000\000@\160\146A\160\146A@\176\192;others/belt_MutableQueue.mlb\001\005\172\001\005\176\192\004\002e\001\005\216\001\005\235@\208B@@@@\176$mapU\144\160\160B@@@\176$peek\144\160\160A@@@\176$size\144\160\160A@@\144\148\192A\160\176\001\004\171!q@@\151\176\161@\160\004)A\160\144\004\b@\176\192\004 \001\000\163\001\016F\001\016H\192\004!\001\000\163\001\016F\001\016P@\208B@@@@\176%clear\144\160\160A@@@\176&popExn\144\160\160A@@@\176&reduce\144\160\160C@@@\176'forEach\144\160\160B@@@\176'isEmpty\144\160\160A@@\144\148\192A\160\176\001\004\169!q@@\151\176\152@\160\151\176\161@\160\004VA\160\144\004\012@\176\192\004M\001\000\160\001\016)\001\016+\192\004N\001\000\160\001\016)\001\0163@\160\146\160\025_i\000\000\000\000\000@@\176\004\007\192\004T\001\000\160\001\016)\001\0167@\208B@@@@\176'peekExn\144\160\160A@@@\176'reduceU\144\160\160C@@@\176'toArray\144\160\160A@@@\176(forEachU\144\160\160B@@@\176(transfer\144\160\160B@@@\176)fromArray\144\160\160A@@@\176,popUndefined\144\160\160A@@@\176-peekUndefined\144\160\160A@@@A",
255255
(* Belt_MutableStack *)"\132\149\166\190\000\000\002\030\000\000\000\158\000\000\002\021\000\000\002\000\160\b\000\0008\000\176#pop\144\160\160A@@@\176#top\144\160\160A@@@\176$copy\144\160\160A@@\144\148\192A\160\176\001\003\246!s@@\151\176\176@\179\144$rootA@A\160\151\176\161@\160\004\006A\160\144\004\015@\176\192;others/belt_MutableStack.mlf\001\005\229\001\006\b\192\004\002f\001\005\229\001\006\014@@\176\192\004\004f\001\005\229\001\006\000\192\004\005f\001\005\229\001\006\015@\208B@@@@\176$make\144\160\160A@@\144\148\192A\160\176\001\003\242%param@@\151\176\176@\179\144\004 A@A\160\146A@\176\192\004\026b\001\005\169\001\005\183\192\004\027b\001\005\169\001\005\196@\208B@@@@\176$push\144\160\160B@@@\176$size\144\160\160A@@@\176%clear\144\160\160A@@\144\148\192A\160\176\001\003\244!s@@\151\176\162@\144\004?\160\144\004\b\160\146A@\176\192\004;d\001\005\198\001\005\213\192\004<d\001\005\198\001\005\227@\208B@@A@\176'forEach\144\160\160B@@@\176'isEmpty\144\160\160A@@\144\148\192A\160\176\001\004f!s@@\151\176\152@\160\151\176\161@\160\004_A\160\144\004\012@\176\192\004Yu\001\007\024\001\007(\192\004Zu\001\007\024\001\007.@\160\146A@\176\004\005\192\004^u\001\007\024\001\0075@\208B@@@@\176(forEachU\144\160\160B@@@\176,popUndefined\144\160\160A@@@\176,topUndefined\144\160\160A@@@\176.dynamicPopIter\144\160\160B@@@\176/dynamicPopIterU\144\160\160B@@@A",
256256
(* Belt_SortArrayInt *)"\132\149\166\190\000\000\000\164\000\000\000*\000\000\000\144\000\000\000\132\160\b\000\000 \000\176$diff\144\160\160H@@@\176%union\144\160\160H@@@\176(isSorted\144\160\160A@@@\176)intersect\144\160\160H@@@\176*stableSort\144\160\160A@@@\176,binarySearch\144\160\160B@@@\1761stableSortInPlace\144\160\160A@@@\1764strictlySortedLength\144\160\160A@@@A",

jscomp/others/reactPPX4Support.res

+9-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,15 @@
3434
}
3535
)
3636

37-
let createElementWithKey = (~key=?, createElement, component, props) =>
37+
@module("react")
38+
external createElement: (Jsx.component<'props>, 'props) => Jsx.element = "createElement"
39+
40+
@variadic @module("react")
41+
external createElementVariadic: (Jsx.component<'props>, 'props, array<Jsx.element>) => Jsx.element =
42+
"createElement"
43+
44+
let createElementWithKey = (~key=?, component, props) =>
3845
createElement(component, addKeyProp(~key?, props))
3946

40-
let createElementVariadicWithKey = (~key=?, createElementVariadic, component, props, elements) =>
47+
let createElementVariadicWithKey = (~key=?, component, props, elements) =>
4148
createElementVariadic(component, addKeyProp(~key?, props), elements)

lib/4.06.1/unstable/js_compiler.ml

+5-5
Large diffs are not rendered by default.

lib/4.06.1/unstable/js_playground_compiler.ml

+5-5
Large diffs are not rendered by default.

lib/4.06.1/whole_compiler.ml

+5-5
Large diffs are not rendered by default.

lib/es6/reactPPX4Support.js

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11

22

3-
import * as Curry from "./curry.js";
3+
import * as React from "react";
4+
import * as Caml_splice_call from "./caml_splice_call.js";
45

5-
function createElementWithKey(key, createElement, component, props) {
6-
return Curry._2(createElement, component, key !== undefined ? Object.assign({}, props, {
6+
function createElementWithKey(key, component, props) {
7+
return React.createElement(component, key !== undefined ? Object.assign({}, props, {
78
key: key
89
}) : props);
910
}
1011

11-
function createElementVariadicWithKey(key, createElementVariadic, component, props, elements) {
12-
return Curry._3(createElementVariadic, component, key !== undefined ? Object.assign({}, props, {
13-
key: key
14-
}) : props, elements);
12+
function createElementVariadicWithKey(key, component, props, elements) {
13+
return Caml_splice_call.spliceApply(React.createElement, [
14+
component,
15+
key !== undefined ? Object.assign({}, props, {
16+
key: key
17+
}) : props,
18+
elements
19+
]);
1520
}
1621

1722
export {
1823
createElementWithKey ,
1924
createElementVariadicWithKey ,
2025
}
21-
/* No side effect */
26+
/* react Not a pure module */

lib/js/reactPPX4Support.js

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
'use strict';
22

3-
var Curry = require("./curry.js");
3+
var React = require("react");
4+
var Caml_splice_call = require("./caml_splice_call.js");
45

5-
function createElementWithKey(key, createElement, component, props) {
6-
return Curry._2(createElement, component, key !== undefined ? Object.assign({}, props, {
6+
function createElementWithKey(key, component, props) {
7+
return React.createElement(component, key !== undefined ? Object.assign({}, props, {
78
key: key
89
}) : props);
910
}
1011

11-
function createElementVariadicWithKey(key, createElementVariadic, component, props, elements) {
12-
return Curry._3(createElementVariadic, component, key !== undefined ? Object.assign({}, props, {
13-
key: key
14-
}) : props, elements);
12+
function createElementVariadicWithKey(key, component, props, elements) {
13+
return Caml_splice_call.spliceApply(React.createElement, [
14+
component,
15+
key !== undefined ? Object.assign({}, props, {
16+
key: key
17+
}) : props,
18+
elements
19+
]);
1520
}
1621

1722
exports.createElementWithKey = createElementWithKey;
1823
exports.createElementVariadicWithKey = createElementVariadicWithKey;
19-
/* No side effect */
24+
/* react Not a pure module */

0 commit comments

Comments
 (0)