@reactpy/client 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -0
- package/package.json +6 -6
- package/src/bind.tsx +59 -0
- package/src/components.tsx +25 -12
- package/src/index.ts +1 -0
- package/src/types.ts +0 -1
- package/src/vdom.tsx +113 -18
- package/dist/client.d.ts +0 -29
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -60
- package/dist/client.js.map +0 -1
- package/dist/components.d.ts +0 -9
- package/dist/components.d.ts.map +0 -1
- package/dist/components.js +0 -171
- package/dist/components.js.map +0 -1
- package/dist/index.d.ts +0 -10
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/logger.d.ts +0 -8
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -7
- package/dist/logger.js.map +0 -1
- package/dist/mount.d.ts +0 -3
- package/dist/mount.d.ts.map +0 -1
- package/dist/mount.js +0 -32
- package/dist/mount.js.map +0 -1
- package/dist/types.d.ts +0 -126
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -1
- package/dist/types.js.map +0 -1
- package/dist/vdom.d.ts +0 -8
- package/dist/vdom.d.ts.map +0 -1
- package/dist/vdom.js +0 -174
- package/dist/vdom.js.map +0 -1
- package/dist/websocket.d.ts +0 -6
- package/dist/websocket.d.ts.map +0 -1
- package/dist/websocket.js +0 -57
- package/dist/websocket.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
package/dist/components.js
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
2
|
-
import { set as setJsonPointer } from "json-pointer";
|
|
3
|
-
import { createContext, createElement, Fragment } from "preact";
|
|
4
|
-
import { useContext, useEffect, useRef, useState } from "preact/hooks";
|
|
5
|
-
import { createAttributes, createChildren, loadImportSource } from "./vdom";
|
|
6
|
-
const ClientContext = createContext(null);
|
|
7
|
-
export function Layout(props) {
|
|
8
|
-
const currentModel = useState({ tagName: "" })[0];
|
|
9
|
-
const forceUpdate = useForceUpdate();
|
|
10
|
-
useEffect(() => props.client.onMessage("layout-update", ({ path, model }) => {
|
|
11
|
-
if (path === "") {
|
|
12
|
-
Object.assign(currentModel, model);
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
setJsonPointer(currentModel, path, model);
|
|
16
|
-
}
|
|
17
|
-
forceUpdate();
|
|
18
|
-
}), [currentModel, props.client]);
|
|
19
|
-
return (_jsx(ClientContext.Provider, { value: props.client, children: _jsx(Element, { model: currentModel }) }));
|
|
20
|
-
}
|
|
21
|
-
export function Element({ model }) {
|
|
22
|
-
if (model.error !== undefined) {
|
|
23
|
-
if (model.error) {
|
|
24
|
-
return _jsx("pre", { children: model.error });
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
let SpecializedElement;
|
|
31
|
-
if (model.tagName in SPECIAL_ELEMENTS) {
|
|
32
|
-
SpecializedElement =
|
|
33
|
-
SPECIAL_ELEMENTS[model.tagName];
|
|
34
|
-
}
|
|
35
|
-
else if (model.importSource) {
|
|
36
|
-
SpecializedElement = ImportedElement;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
SpecializedElement = StandardElement;
|
|
40
|
-
}
|
|
41
|
-
return _jsx(SpecializedElement, { model: model });
|
|
42
|
-
}
|
|
43
|
-
function StandardElement({ model }) {
|
|
44
|
-
const client = useContext(ClientContext);
|
|
45
|
-
// Use createElement here to avoid warning about variable numbers of children not
|
|
46
|
-
// having keys. Warning about this must now be the responsibility of the client
|
|
47
|
-
// providing the models instead of the client rendering them.
|
|
48
|
-
return createElement(model.tagName === "" ? Fragment : model.tagName, createAttributes(model, client), ...createChildren(model, (child) => {
|
|
49
|
-
return _jsx(Element, { model: child }, child.key);
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
function UserInputElement({ model }) {
|
|
53
|
-
const client = useContext(ClientContext);
|
|
54
|
-
const props = createAttributes(model, client);
|
|
55
|
-
const [value, setValue] = useState(props.value);
|
|
56
|
-
// honor changes to value from the client via props
|
|
57
|
-
useEffect(() => setValue(props.value), [props.value]);
|
|
58
|
-
const givenOnChange = props.onChange;
|
|
59
|
-
if (typeof givenOnChange === "function") {
|
|
60
|
-
props.onChange = (event) => {
|
|
61
|
-
// immediately update the value to give the user feedback
|
|
62
|
-
if (event.target) {
|
|
63
|
-
setValue(event.target.value);
|
|
64
|
-
}
|
|
65
|
-
// allow the client to respond (and possibly change the value)
|
|
66
|
-
givenOnChange(event);
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
// Use createElement here to avoid warning about variable numbers of children not
|
|
70
|
-
// having keys. Warning about this must now be the responsibility of the client
|
|
71
|
-
// providing the models instead of the client rendering them.
|
|
72
|
-
return createElement(model.tagName,
|
|
73
|
-
// overwrite
|
|
74
|
-
{ ...props, value }, ...createChildren(model, (child) => (_jsx(Element, { model: child }, child.key))));
|
|
75
|
-
}
|
|
76
|
-
function ScriptElement({ model }) {
|
|
77
|
-
const ref = useRef(null);
|
|
78
|
-
useEffect(() => {
|
|
79
|
-
// Don't run if the parent element is missing
|
|
80
|
-
if (!ref.current) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
// Create the script element
|
|
84
|
-
const scriptElement = document.createElement("script");
|
|
85
|
-
for (const [k, v] of Object.entries(model.attributes || {})) {
|
|
86
|
-
scriptElement.setAttribute(k, v);
|
|
87
|
-
}
|
|
88
|
-
// Add the script content as text
|
|
89
|
-
const scriptContent = model?.children?.filter((value) => typeof value == "string")[0];
|
|
90
|
-
if (scriptContent) {
|
|
91
|
-
scriptElement.appendChild(document.createTextNode(scriptContent));
|
|
92
|
-
}
|
|
93
|
-
// Append the script element to the parent element
|
|
94
|
-
ref.current.appendChild(scriptElement);
|
|
95
|
-
// Remove the script element when the component is unmounted
|
|
96
|
-
return () => {
|
|
97
|
-
ref.current?.removeChild(scriptElement);
|
|
98
|
-
};
|
|
99
|
-
}, [model.key]);
|
|
100
|
-
return _jsx("div", { ref: ref });
|
|
101
|
-
}
|
|
102
|
-
function ImportedElement({ model }) {
|
|
103
|
-
const importSourceVdom = model.importSource;
|
|
104
|
-
const importSourceRef = useImportSource(model);
|
|
105
|
-
if (!importSourceVdom) {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
const importSourceFallback = importSourceVdom.fallback;
|
|
109
|
-
if (!importSourceVdom) {
|
|
110
|
-
// display a fallback if one was given
|
|
111
|
-
if (!importSourceFallback) {
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
else if (typeof importSourceFallback === "string") {
|
|
115
|
-
return _jsx("span", { children: importSourceFallback });
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
return _jsx(StandardElement, { model: importSourceFallback });
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
return _jsx("span", { ref: importSourceRef });
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
function useForceUpdate() {
|
|
126
|
-
const [, setState] = useState(false);
|
|
127
|
-
return () => setState((old) => !old);
|
|
128
|
-
}
|
|
129
|
-
function useImportSource(model) {
|
|
130
|
-
const vdomImportSource = model.importSource;
|
|
131
|
-
const vdomImportSourceJsonString = JSON.stringify(vdomImportSource);
|
|
132
|
-
const mountPoint = useRef(null);
|
|
133
|
-
const client = useContext(ClientContext);
|
|
134
|
-
const [binding, setBinding] = useState(null);
|
|
135
|
-
useEffect(() => {
|
|
136
|
-
let unmounted = false;
|
|
137
|
-
if (vdomImportSource) {
|
|
138
|
-
loadImportSource(vdomImportSource, client).then((bind) => {
|
|
139
|
-
if (!unmounted && mountPoint.current) {
|
|
140
|
-
setBinding(bind(mountPoint.current));
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
return () => {
|
|
145
|
-
unmounted = true;
|
|
146
|
-
if (binding &&
|
|
147
|
-
vdomImportSource &&
|
|
148
|
-
!vdomImportSource.unmountBeforeUpdate) {
|
|
149
|
-
binding.unmount();
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
}, [client, vdomImportSourceJsonString, setBinding, mountPoint.current]);
|
|
153
|
-
// this effect must run every time in case the model has changed
|
|
154
|
-
useEffect(() => {
|
|
155
|
-
if (!(binding && vdomImportSource)) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
binding.render(model);
|
|
159
|
-
if (vdomImportSource.unmountBeforeUpdate) {
|
|
160
|
-
return binding.unmount;
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
return mountPoint;
|
|
164
|
-
}
|
|
165
|
-
const SPECIAL_ELEMENTS = {
|
|
166
|
-
input: UserInputElement,
|
|
167
|
-
script: ScriptElement,
|
|
168
|
-
select: UserInputElement,
|
|
169
|
-
textarea: UserInputElement,
|
|
170
|
-
};
|
|
171
|
-
//# sourceMappingURL=components.js.map
|
package/dist/components.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,IAAI,cAAc,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAY,MAAM,QAAQ,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAOvE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAE5E,MAAM,aAAa,GAAG,aAAa,CAAyB,IAAW,CAAC,CAAC;AAEzE,MAAM,UAAU,MAAM,CAAC,KAAyC;IAC9D,MAAM,YAAY,GAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,C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pB,CAAC;AAED,MAAM,gBAAgB,GAAG;IACvB,KAAK,EAAE,gBAAgB;IACvB,MAAM,EAAE,aAAa;IACrB,MAAM,EAAE,gBAAgB;IACxB,QAAQ,EAAE,gBAAgB;CAC3B,CAAC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from "./client";
|
|
2
|
-
export * from "./components";
|
|
3
|
-
export * from "./mount";
|
|
4
|
-
export * from "./types";
|
|
5
|
-
export * from "./vdom";
|
|
6
|
-
export * from "./websocket";
|
|
7
|
-
export { default as React } from "preact/compat";
|
|
8
|
-
export { default as ReactDOM } from "preact/compat";
|
|
9
|
-
export * as preact from "preact";
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC"}
|
package/dist/logger.d.ts
DELETED
package/dist/logger.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";mBACiB,GAAG,EAAE,KAAG,IAAI;oBACX,GAAG,EAAE,KAAG,IAAI;oBACZ,GAAG,EAAE,KAAG,IAAI;qBACX,GAAG,EAAE,KAAG,IAAI;;AAJ/B,wBAKE"}
|
package/dist/logger.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
log: (...args) => console.log("[ReactPy]", ...args),
|
|
3
|
-
info: (...args) => console.info("[ReactPy]", ...args),
|
|
4
|
-
warn: (...args) => console.warn("[ReactPy]", ...args),
|
|
5
|
-
error: (...args) => console.error("[ReactPy]", ...args),
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=logger.js.map
|
package/dist/logger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,eAAe;IACb,GAAG,EAAE,CAAC,GAAG,IAAW,EAAQ,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC;IAChE,IAAI,EAAE,CAAC,GAAG,IAAW,EAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC;IAClE,IAAI,EAAE,CAAC,GAAG,IAAW,EAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC;IAClE,KAAK,EAAE,CAAC,GAAG,IAAW,EAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC;CACrE,CAAC"}
|
package/dist/mount.d.ts
DELETED
package/dist/mount.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,QAkC7C"}
|
package/dist/mount.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
2
|
-
import { render } from "preact";
|
|
3
|
-
import { ReactPyClient } from "./client";
|
|
4
|
-
import { Layout } from "./components";
|
|
5
|
-
export function mountReactPy(props) {
|
|
6
|
-
// WebSocket route for component rendering
|
|
7
|
-
const wsProtocol = `ws${window.location.protocol === "https:" ? "s" : ""}:`;
|
|
8
|
-
const wsOrigin = `${wsProtocol}//${window.location.host}`;
|
|
9
|
-
const componentUrl = new URL(`${wsOrigin}${props.pathPrefix}${props.componentPath || ""}`);
|
|
10
|
-
// Embed the initial HTTP path into the WebSocket URL
|
|
11
|
-
componentUrl.searchParams.append("http_pathname", window.location.pathname);
|
|
12
|
-
if (window.location.search) {
|
|
13
|
-
componentUrl.searchParams.append("http_query_string", window.location.search);
|
|
14
|
-
}
|
|
15
|
-
// Configure a new ReactPy client
|
|
16
|
-
const client = new ReactPyClient({
|
|
17
|
-
urls: {
|
|
18
|
-
componentUrl: componentUrl,
|
|
19
|
-
jsModulesPath: `${window.location.origin}${props.pathPrefix}modules/`,
|
|
20
|
-
},
|
|
21
|
-
reconnectOptions: {
|
|
22
|
-
interval: props.reconnectInterval || 750,
|
|
23
|
-
maxInterval: props.reconnectMaxInterval || 60000,
|
|
24
|
-
maxRetries: props.reconnectMaxRetries || 150,
|
|
25
|
-
backoffMultiplier: props.reconnectBackoffMultiplier || 1.25,
|
|
26
|
-
},
|
|
27
|
-
mountElement: props.mountElement,
|
|
28
|
-
});
|
|
29
|
-
// Start rendering the component
|
|
30
|
-
render(_jsx(Layout, { client: client }), props.mountElement);
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=mount.js.map
|
package/dist/mount.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../src/mount.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,MAAM,UAAU,YAAY,CAAC,KAAiB;IAC5C,0CAA0C;IAC1C,MAAM,UAAU,GAAG,KAAK,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;IAC5E,MAAM,QAAQ,GAAG,GAAG,UAAU,KAAK,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC1D,MAAM,YAAY,GAAG,IAAI,GAAG,CAC1B,GAAG,QAAQ,GAAG,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,aAAa,IAAI,EAAE,EAAE,CAC7D,CAAC;IAEF,qDAAqD;IACrD,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC5E,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QAC3B,YAAY,CAAC,YAAY,CAAC,MAAM,CAC9B,mBAAmB,EACnB,MAAM,CAAC,QAAQ,CAAC,MAAM,CACvB,CAAC;IACJ,CAAC;IAED,iCAAiC;IACjC,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC;QAC/B,IAAI,EAAE;YACJ,YAAY,EAAE,YAAY;YAC1B,aAAa,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAC,UAAU,UAAU;SACtE;QACD,gBAAgB,EAAE;YAChB,QAAQ,EAAE,KAAK,CAAC,iBAAiB,IAAI,GAAG;YACxC,WAAW,EAAE,KAAK,CAAC,oBAAoB,IAAI,KAAK;YAChD,UAAU,EAAE,KAAK,CAAC,mBAAmB,IAAI,GAAG;YAC5C,iBAAiB,EAAE,KAAK,CAAC,0BAA0B,IAAI,IAAI;SAC5D;QACD,YAAY,EAAE,KAAK,CAAC,YAAY;KACjC,CAAC,CAAC;IAEH,gCAAgC;IAChC,MAAM,CAAC,KAAC,MAAM,IAAC,MAAM,EAAE,MAAM,GAAI,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;AACzD,CAAC"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import type { ComponentType } from "preact";
|
|
2
|
-
export type ReconnectOptions = {
|
|
3
|
-
interval: number;
|
|
4
|
-
maxInterval: number;
|
|
5
|
-
maxRetries: number;
|
|
6
|
-
backoffMultiplier: number;
|
|
7
|
-
};
|
|
8
|
-
export type CreateReconnectingWebSocketProps = {
|
|
9
|
-
url: URL;
|
|
10
|
-
readyPromise: Promise<void>;
|
|
11
|
-
onMessage: (message: MessageEvent<any>) => void;
|
|
12
|
-
onOpen?: () => void;
|
|
13
|
-
onClose?: () => void;
|
|
14
|
-
interval: number;
|
|
15
|
-
maxInterval: number;
|
|
16
|
-
maxRetries: number;
|
|
17
|
-
backoffMultiplier: number;
|
|
18
|
-
};
|
|
19
|
-
export type ReactPyUrls = {
|
|
20
|
-
componentUrl: URL;
|
|
21
|
-
jsModulesPath: string;
|
|
22
|
-
};
|
|
23
|
-
export type GenericReactPyClientProps = {
|
|
24
|
-
urls: ReactPyUrls;
|
|
25
|
-
reconnectOptions: ReconnectOptions;
|
|
26
|
-
mountElement: HTMLElement;
|
|
27
|
-
};
|
|
28
|
-
export type MountProps = {
|
|
29
|
-
mountElement: HTMLElement;
|
|
30
|
-
pathPrefix: string;
|
|
31
|
-
componentPath?: string;
|
|
32
|
-
reconnectInterval?: number;
|
|
33
|
-
reconnectMaxInterval?: number;
|
|
34
|
-
reconnectMaxRetries?: number;
|
|
35
|
-
reconnectBackoffMultiplier?: number;
|
|
36
|
-
};
|
|
37
|
-
export type ReactPyComponent = ComponentType<{
|
|
38
|
-
model: ReactPyVdom;
|
|
39
|
-
}>;
|
|
40
|
-
export type ReactPyVdom = {
|
|
41
|
-
tagName: string;
|
|
42
|
-
key?: string;
|
|
43
|
-
attributes?: {
|
|
44
|
-
[key: string]: string;
|
|
45
|
-
};
|
|
46
|
-
children?: (ReactPyVdom | string)[];
|
|
47
|
-
error?: string;
|
|
48
|
-
eventHandlers?: {
|
|
49
|
-
[key: string]: ReactPyVdomEventHandler;
|
|
50
|
-
};
|
|
51
|
-
inlineJavaScript?: {
|
|
52
|
-
[key: string]: string;
|
|
53
|
-
};
|
|
54
|
-
importSource?: ReactPyVdomImportSource;
|
|
55
|
-
};
|
|
56
|
-
export type ReactPyVdomEventHandler = {
|
|
57
|
-
target: string;
|
|
58
|
-
preventDefault?: boolean;
|
|
59
|
-
stopPropagation?: boolean;
|
|
60
|
-
};
|
|
61
|
-
export type ReactPyVdomImportSource = {
|
|
62
|
-
source: string;
|
|
63
|
-
sourceType?: "URL" | "NAME";
|
|
64
|
-
fallback?: string | ReactPyVdom;
|
|
65
|
-
unmountBeforeUpdate?: boolean;
|
|
66
|
-
};
|
|
67
|
-
export type ReactPyModule = {
|
|
68
|
-
bind: (node: HTMLElement, context: ReactPyModuleBindingContext) => ReactPyModuleBinding;
|
|
69
|
-
} & {
|
|
70
|
-
[key: string]: any;
|
|
71
|
-
};
|
|
72
|
-
export type ReactPyModuleBindingContext = {
|
|
73
|
-
sendMessage: ReactPyClientInterface["sendMessage"];
|
|
74
|
-
onMessage: ReactPyClientInterface["onMessage"];
|
|
75
|
-
};
|
|
76
|
-
export type ReactPyModuleBinding = {
|
|
77
|
-
create: (type: any, props?: any, children?: (any | string | ReactPyVdom)[]) => any;
|
|
78
|
-
render: (element: any) => void;
|
|
79
|
-
unmount: () => void;
|
|
80
|
-
};
|
|
81
|
-
export type BindImportSource = (node: HTMLElement) => ImportSourceBinding | null;
|
|
82
|
-
export type ImportSourceBinding = {
|
|
83
|
-
render: (model: ReactPyVdom) => void;
|
|
84
|
-
unmount: () => void;
|
|
85
|
-
};
|
|
86
|
-
export type LayoutUpdateMessage = {
|
|
87
|
-
type: "layout-update";
|
|
88
|
-
path: string;
|
|
89
|
-
model: ReactPyVdom;
|
|
90
|
-
};
|
|
91
|
-
export type LayoutEventMessage = {
|
|
92
|
-
type: "layout-event";
|
|
93
|
-
target: string;
|
|
94
|
-
data: any;
|
|
95
|
-
};
|
|
96
|
-
export type IncomingMessage = LayoutUpdateMessage;
|
|
97
|
-
export type OutgoingMessage = LayoutEventMessage;
|
|
98
|
-
export type Message = IncomingMessage | OutgoingMessage;
|
|
99
|
-
/**
|
|
100
|
-
* A client for communicating with a ReactPy server.
|
|
101
|
-
*/
|
|
102
|
-
export interface ReactPyClientInterface {
|
|
103
|
-
/**
|
|
104
|
-
* Register a handler for a message type.
|
|
105
|
-
*
|
|
106
|
-
* The first time this is called, the client will be considered ready.
|
|
107
|
-
*
|
|
108
|
-
* @param type The type of message to handle.
|
|
109
|
-
* @param handler The handler to call when a message of the given type is received.
|
|
110
|
-
* @returns A function to unregister the handler.
|
|
111
|
-
*/
|
|
112
|
-
onMessage(type: string, handler: (message: any) => void): () => void;
|
|
113
|
-
/**
|
|
114
|
-
* Send a message to the server.
|
|
115
|
-
*
|
|
116
|
-
* @param message The message to send. Messages must have a `type` property.
|
|
117
|
-
*/
|
|
118
|
-
sendMessage(message: any): void;
|
|
119
|
-
/**
|
|
120
|
-
* Load a module from the server.
|
|
121
|
-
* @param moduleName The name of the module to load.
|
|
122
|
-
* @returns A promise that resolves to the module.
|
|
123
|
-
*/
|
|
124
|
-
loadModule(moduleName: string): Promise<ReactPyModule>;
|
|
125
|
-
}
|
|
126
|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E,GAAG,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAErE;;;;OAIG;IACH,WAAW,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI,CAAC;IAEhC;;;;OAIG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CACxD"}
|
package/dist/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/dist/vdom.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ReactPyClientInterface } from "./types";
|
|
2
|
-
import type { ReactPyVdom, ReactPyVdomImportSource, BindImportSource } from "./types";
|
|
3
|
-
export declare function loadImportSource(vdomImportSource: ReactPyVdomImportSource, client: ReactPyClientInterface): Promise<BindImportSource>;
|
|
4
|
-
export declare function createChildren<Child>(model: ReactPyVdom, createChild: (child: ReactPyVdom) => Child): (Child | string)[];
|
|
5
|
-
export declare function createAttributes(model: ReactPyVdom, client: ReactPyClientInterface): {
|
|
6
|
-
[key: string]: any;
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=vdom.d.ts.map
|
package/dist/vdom.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vdom.d.ts","sourceRoot":"","sources":["../src/vdom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,OAAO,KAAK,EACV,WAAW,EACX,uBAAuB,EAGvB,gBAAgB,EAEjB,MAAM,SAAS,CAAC;AAGjB,wBAAsB,gBAAgB,CACpC,gBAAgB,EAAE,uBAAuB,EACzC,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,gBAAgB,CAAC,CA2C3B;AAoGD,wBAAgB,cAAc,CAAC,KAAK,EAClC,KAAK,EAAE,WAAW,EAClB,WAAW,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,KAAK,GACzC,CAAC,KAAK,GAAG,MAAM,CAAC,EAAE,CAapB;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,sBAAsB,GAC7B;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAmBxB"}
|
package/dist/vdom.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import eventToObject from "event-to-object";
|
|
2
|
-
import log from "./logger";
|
|
3
|
-
export async function loadImportSource(vdomImportSource, client) {
|
|
4
|
-
let module;
|
|
5
|
-
if (vdomImportSource.sourceType === "URL") {
|
|
6
|
-
module = await import(vdomImportSource.source);
|
|
7
|
-
}
|
|
8
|
-
else {
|
|
9
|
-
module = await client.loadModule(vdomImportSource.source);
|
|
10
|
-
}
|
|
11
|
-
if (typeof module.bind !== "function") {
|
|
12
|
-
throw new Error(`${vdomImportSource.source} did not export a function 'bind'`);
|
|
13
|
-
}
|
|
14
|
-
return (node) => {
|
|
15
|
-
const binding = module.bind(node, {
|
|
16
|
-
sendMessage: client.sendMessage,
|
|
17
|
-
onMessage: client.onMessage,
|
|
18
|
-
});
|
|
19
|
-
if (!(typeof binding.create === "function" &&
|
|
20
|
-
typeof binding.render === "function" &&
|
|
21
|
-
typeof binding.unmount === "function")) {
|
|
22
|
-
log.error(`${vdomImportSource.source} returned an impropper binding`);
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
return {
|
|
26
|
-
render: (model) => binding.render(createImportSourceElement({
|
|
27
|
-
client,
|
|
28
|
-
module,
|
|
29
|
-
binding,
|
|
30
|
-
model,
|
|
31
|
-
currentImportSource: vdomImportSource,
|
|
32
|
-
})),
|
|
33
|
-
unmount: binding.unmount,
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function createImportSourceElement(props) {
|
|
38
|
-
let type;
|
|
39
|
-
if (props.model.importSource) {
|
|
40
|
-
if (!isImportSourceEqual(props.currentImportSource, props.model.importSource)) {
|
|
41
|
-
log.error("Parent element import source " +
|
|
42
|
-
stringifyImportSource(props.currentImportSource) +
|
|
43
|
-
" does not match child's import source " +
|
|
44
|
-
stringifyImportSource(props.model.importSource));
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
type = getComponentFromModule(props.module, props.model.tagName, props.model.importSource);
|
|
49
|
-
if (!type) {
|
|
50
|
-
// Error message logged within getComponentFromModule
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
type = props.model.tagName;
|
|
57
|
-
}
|
|
58
|
-
return props.binding.create(type, createAttributes(props.model, props.client), createChildren(props.model, (child) => createImportSourceElement({
|
|
59
|
-
...props,
|
|
60
|
-
model: child,
|
|
61
|
-
})));
|
|
62
|
-
}
|
|
63
|
-
function getComponentFromModule(module, componentName, importSource) {
|
|
64
|
-
/* Gets the component with the provided name from the provided module.
|
|
65
|
-
|
|
66
|
-
Built specifically to work on inifinitely deep nested components.
|
|
67
|
-
For example, component "My.Nested.Component" is accessed from
|
|
68
|
-
ModuleA like so: ModuleA["My"]["Nested"]["Component"].
|
|
69
|
-
*/
|
|
70
|
-
const componentParts = componentName.split(".");
|
|
71
|
-
let Component = null;
|
|
72
|
-
for (let i = 0; i < componentParts.length; i++) {
|
|
73
|
-
const iterAttr = componentParts[i];
|
|
74
|
-
Component = i == 0 ? module[iterAttr] : Component[iterAttr];
|
|
75
|
-
if (!Component) {
|
|
76
|
-
if (i == 0) {
|
|
77
|
-
log.error("Module from source " +
|
|
78
|
-
stringifyImportSource(importSource) +
|
|
79
|
-
` does not export ${iterAttr}`);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
console.error(`Component ${componentParts.slice(0, i).join(".")} from source ` +
|
|
83
|
-
stringifyImportSource(importSource) +
|
|
84
|
-
` does not have subcomponent ${iterAttr}`);
|
|
85
|
-
}
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return Component;
|
|
90
|
-
}
|
|
91
|
-
function isImportSourceEqual(source1, source2) {
|
|
92
|
-
return (source1.source === source2.source &&
|
|
93
|
-
source1.sourceType === source2.sourceType);
|
|
94
|
-
}
|
|
95
|
-
function stringifyImportSource(importSource) {
|
|
96
|
-
return JSON.stringify({
|
|
97
|
-
source: importSource.source,
|
|
98
|
-
sourceType: importSource.sourceType,
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
export function createChildren(model, createChild) {
|
|
102
|
-
if (!model.children) {
|
|
103
|
-
return [];
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
return model.children.map((child) => {
|
|
107
|
-
switch (typeof child) {
|
|
108
|
-
case "object":
|
|
109
|
-
return createChild(child);
|
|
110
|
-
case "string":
|
|
111
|
-
return child;
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
export function createAttributes(model, client) {
|
|
117
|
-
return Object.fromEntries(Object.entries({
|
|
118
|
-
// Normal HTML attributes
|
|
119
|
-
...model.attributes,
|
|
120
|
-
// Construct event handlers
|
|
121
|
-
...Object.fromEntries(Object.entries(model.eventHandlers || {}).map(([name, handler]) => createEventHandler(client, name, handler))),
|
|
122
|
-
...Object.fromEntries(Object.entries(model.inlineJavaScript || {}).map(([name, inlineJavaScript]) => createInlineJavaScript(name, inlineJavaScript))),
|
|
123
|
-
}));
|
|
124
|
-
}
|
|
125
|
-
function createEventHandler(client, name, { target, preventDefault, stopPropagation }) {
|
|
126
|
-
const eventHandler = function (...args) {
|
|
127
|
-
const data = Array.from(args).map((value) => {
|
|
128
|
-
const event = value;
|
|
129
|
-
if (preventDefault) {
|
|
130
|
-
event.preventDefault();
|
|
131
|
-
}
|
|
132
|
-
if (stopPropagation) {
|
|
133
|
-
event.stopPropagation();
|
|
134
|
-
}
|
|
135
|
-
// Convert JavaScript objects to plain JSON, if needed
|
|
136
|
-
if (typeof event === "object") {
|
|
137
|
-
return eventToObject(event);
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
return event;
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
client.sendMessage({ type: "layout-event", data, target });
|
|
144
|
-
};
|
|
145
|
-
eventHandler.isHandler = true;
|
|
146
|
-
return [name, eventHandler];
|
|
147
|
-
}
|
|
148
|
-
function createInlineJavaScript(name, inlineJavaScript) {
|
|
149
|
-
/* Function that will execute the string-like InlineJavaScript
|
|
150
|
-
via eval in the most appropriate way */
|
|
151
|
-
const wrappedExecutable = function (...args) {
|
|
152
|
-
function handleExecution(...args) {
|
|
153
|
-
const evalResult = eval(inlineJavaScript);
|
|
154
|
-
if (typeof evalResult == "function") {
|
|
155
|
-
return evalResult(...args);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
if (args.length > 0 && args[0] instanceof Event) {
|
|
159
|
-
/* If being triggered by an event, set the event's current
|
|
160
|
-
target to "this". This ensures that inline
|
|
161
|
-
javascript statements such as the following work:
|
|
162
|
-
html.button({"onclick": 'this.value = "Clicked!"'}, "Click Me")*/
|
|
163
|
-
return handleExecution.call(args[0].currentTarget, ...args);
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
/* If not being triggered by an event, do not set "this" and
|
|
167
|
-
just call normally */
|
|
168
|
-
return handleExecution(...args);
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
wrappedExecutable.isHandler = false;
|
|
172
|
-
return [name, wrappedExecutable];
|
|
173
|
-
}
|
|
174
|
-
//# sourceMappingURL=vdom.js.map
|
package/dist/vdom.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vdom.js","sourceRoot":"","sources":["../src/vdom.tsx"],"names":[],"mappings":"AACA,OAAO,aAAa,MAAM,iBAAiB,CAA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QAClC,CAAC;IACH,CAAC,CAAC;IACF,iBAAiB,CAAC,SAAS,GAAG,KAAK,CAAC;IACpC,OAAO,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;AACnC,CAAC"}
|
package/dist/websocket.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CreateReconnectingWebSocketProps } from "./types";
|
|
2
|
-
export declare function createReconnectingWebSocket(props: CreateReconnectingWebSocketProps): {
|
|
3
|
-
current?: WebSocket;
|
|
4
|
-
};
|
|
5
|
-
export declare function nextInterval(currentInterval: number, backoffMultiplier: number, maxInterval: number): number;
|
|
6
|
-
//# sourceMappingURL=websocket.d.ts.map
|
package/dist/websocket.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["../src/websocket.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,SAAS,CAAC;AAGhE,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,gCAAgC;cAOb,SAAS;EAkDpC;AAED,wBAAgB,YAAY,CAC1B,eAAe,EAAE,MAAM,EACvB,iBAAiB,EAAE,MAAM,EACzB,WAAW,EAAE,MAAM,GAClB,MAAM,CAOR"}
|