-
Notifications
You must be signed in to change notification settings - Fork 464
/
Copy pathreasonReact.js
136 lines (115 loc) · 3.93 KB
/
reasonReact.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// Generated by ReScript, PLEASE EDIT WITH CARE
'use strict';
var Curry = require("../../lib/js/curry.js");
var React = require("react");
function createDomElement(s, props, children) {
var vararg = [
s,
props
].concat(children);
return Curry._2(React.createElement.apply, null, vararg);
}
function anyToUnit(param) {
}
function anyToTrue(param) {
return true;
}
function willReceivePropsDefault(param) {
return param.state;
}
function renderDefault(_self) {
return "RenderNotImplemented";
}
function initialStateDefault(param) {
}
function reducerDefault(_action, _state) {
return "NoUpdate";
}
function basicComponent(debugName) {
return {
debugName: debugName,
reactClassInternal: debugName,
handedOffState: {
contents: undefined
},
willReceiveProps: willReceivePropsDefault,
didMount: anyToUnit,
didUpdate: anyToUnit,
willUnmount: anyToUnit,
willUpdate: anyToUnit,
shouldUpdate: anyToTrue,
render: renderDefault,
initialState: initialStateDefault,
retainedProps: undefined,
reducer: reducerDefault,
jsElementWrapped: undefined
};
}
var statelessComponent = basicComponent;
var statelessComponentWithRetainedProps = basicComponent;
var reducerComponent = basicComponent;
var reducerComponentWithRetainedProps = basicComponent;
function element(keyOpt, refOpt, component) {
var key = keyOpt !== undefined ? keyOpt : undefined;
var ref = refOpt !== undefined ? refOpt : undefined;
var element$1 = {
TAG: "Element",
_0: component
};
var jsElementWrapped = component.jsElementWrapped;
if (jsElementWrapped !== undefined) {
return Curry._2(jsElementWrapped, key, ref);
} else {
return React.createElement(component.reactClassInternal, {
key: key,
ref: ref,
reasonProps: element$1
});
}
}
function wrapReasonForJs(component, jsPropsToReason) {
var uncurriedJsPropsToReason = Curry.__1(jsPropsToReason);
component.reactClassInternal.prototype.jsPropsToReason = uncurriedJsPropsToReason;
return component.reactClassInternal;
}
var dummyInteropComponent = basicComponent("interop");
function wrapJsForReason(reactClass, props, children) {
var jsElementWrapped = (function (param, param$1) {
var props$1 = Object.assign(Object.assign({}, props), {
ref: param$1,
key: param
});
var varargs = [
reactClass,
props$1
].concat(children);
return Curry._2(React.createElement.apply, null, varargs);
});
return {
debugName: dummyInteropComponent.debugName,
reactClassInternal: dummyInteropComponent.reactClassInternal,
handedOffState: dummyInteropComponent.handedOffState,
willReceiveProps: dummyInteropComponent.willReceiveProps,
didMount: dummyInteropComponent.didMount,
didUpdate: dummyInteropComponent.didUpdate,
willUnmount: dummyInteropComponent.willUnmount,
willUpdate: dummyInteropComponent.willUpdate,
shouldUpdate: dummyInteropComponent.shouldUpdate,
render: dummyInteropComponent.render,
initialState: dummyInteropComponent.initialState,
retainedProps: dummyInteropComponent.retainedProps,
reducer: dummyInteropComponent.reducer,
jsElementWrapped: jsElementWrapped
};
}
var Router;
exports.statelessComponent = statelessComponent;
exports.statelessComponentWithRetainedProps = statelessComponentWithRetainedProps;
exports.reducerComponent = reducerComponent;
exports.reducerComponentWithRetainedProps = reducerComponentWithRetainedProps;
exports.element = element;
exports.wrapReasonForJs = wrapReasonForJs;
exports.createDomElement = createDomElement;
exports.wrapJsForReason = wrapJsForReason;
exports.Router = Router;
/* dummyInteropComponent Not a pure module */