Spaces:
Sleeping
Sleeping
Delete st_bridge
Browse files- st_bridge/__init__.py +0 -2
- st_bridge/bridge.py +0 -48
- st_bridge/bridge/.gitignore +0 -28
- st_bridge/bridge/build/asset-manifest.json +0 -19
- st_bridge/bridge/build/bootstrap.min.css +0 -0
- st_bridge/bridge/build/bootstrap.min.css.map +0 -0
- st_bridge/bridge/build/index.html +0 -1
- st_bridge/bridge/build/precache-manifest.fad985818978633f1a71f25d0a3349e9.js +0 -22
- st_bridge/bridge/build/service-worker.js +0 -39
- st_bridge/bridge/build/static/js/2.d57250d1.chunk.js +0 -0
- st_bridge/bridge/build/static/js/2.d57250d1.chunk.js.LICENSE.txt +0 -42
- st_bridge/bridge/build/static/js/2.d57250d1.chunk.js.map +0 -0
- st_bridge/bridge/build/static/js/main.4c504d7b.chunk.js +0 -2
- st_bridge/bridge/build/static/js/main.4c504d7b.chunk.js.map +0 -1
- st_bridge/bridge/build/static/js/runtime-main.f43d5da3.js +0 -2
- st_bridge/bridge/build/static/js/runtime-main.f43d5da3.js.map +0 -1
- st_bridge/bridge/package-lock.json +0 -0
- st_bridge/bridge/package.json +0 -33
- st_bridge/bridge/public/bootstrap.min.css +0 -0
- st_bridge/bridge/public/bootstrap.min.css.map +0 -0
- st_bridge/bridge/public/index.html +0 -14
- st_bridge/bridge/src/index.tsx +0 -65
- st_bridge/bridge/src/react-app-env.d.ts +0 -1
- st_bridge/bridge/tsconfig.json +0 -19
- st_bridge/bridge/yarn.lock +0 -0
- st_bridge/html.py +0 -65
- st_bridge/html/.gitignore +0 -28
- st_bridge/html/build/asset-manifest.json +0 -19
- st_bridge/html/build/bootstrap.min.css +0 -0
- st_bridge/html/build/bootstrap.min.css.map +0 -0
- st_bridge/html/build/index.html +0 -1
- st_bridge/html/build/precache-manifest.5b5300284d43bf8ba972ca3da2f90d8d.js +0 -22
- st_bridge/html/build/service-worker.js +0 -39
- st_bridge/html/build/static/js/2.ce2c8f1c.chunk.js +0 -0
- st_bridge/html/build/static/js/2.ce2c8f1c.chunk.js.LICENSE.txt +0 -42
- st_bridge/html/build/static/js/2.ce2c8f1c.chunk.js.map +0 -0
- st_bridge/html/build/static/js/main.4e83250e.chunk.js +0 -2
- st_bridge/html/build/static/js/main.4e83250e.chunk.js.map +0 -1
- st_bridge/html/build/static/js/runtime-main.d8806d63.js +0 -2
- st_bridge/html/build/static/js/runtime-main.d8806d63.js.map +0 -1
- st_bridge/html/package-lock.json +0 -0
- st_bridge/html/package.json +0 -33
- st_bridge/html/public/bootstrap.min.css +0 -0
- st_bridge/html/public/bootstrap.min.css.map +0 -0
- st_bridge/html/public/index.html +0 -14
- st_bridge/html/src/index.tsx +0 -70
- st_bridge/html/src/react-app-env.d.ts +0 -1
- st_bridge/html/tsconfig.json +0 -19
- st_bridge/html/yarn.lock +0 -0
st_bridge/__init__.py
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
from st_bridge.bridge import bridge
|
2 |
-
from st_bridge.html import html
|
|
|
|
|
|
st_bridge/bridge.py
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
from optparse import Option
|
2 |
-
import os
|
3 |
-
from typing import Any, Optional
|
4 |
-
import orjson
|
5 |
-
import streamlit.components.v1 as components
|
6 |
-
|
7 |
-
_RELEASE = True
|
8 |
-
|
9 |
-
if not _RELEASE:
|
10 |
-
_bridge = components.declare_component(
|
11 |
-
"bridge",
|
12 |
-
url="http://localhost:3000",
|
13 |
-
)
|
14 |
-
else:
|
15 |
-
parent_dir = os.path.dirname(os.path.abspath(__file__))
|
16 |
-
build_dir = os.path.join(parent_dir, "bridge/build")
|
17 |
-
_bridge = components.declare_component("bridge", path=build_dir)
|
18 |
-
|
19 |
-
|
20 |
-
def bridge(
|
21 |
-
name: str,
|
22 |
-
default: Optional[Any] = None,
|
23 |
-
key: Optional[str] = None,
|
24 |
-
):
|
25 |
-
"""Create a new instance of "Streamlit Bridge", allowing call from the client to
|
26 |
-
the server.
|
27 |
-
|
28 |
-
Everytime JS client send data to the server, streamlit will trigger a rerun and the data
|
29 |
-
is returned by this function.
|
30 |
-
|
31 |
-
Args:
|
32 |
-
name: unique name of the bridge to identify the bridge Javascript's call will send data to
|
33 |
-
default: the initial return value of the component before the user has interacted with it.
|
34 |
-
key: streamlit component's id
|
35 |
-
"""
|
36 |
-
val = _bridge(name=name, key=key, default=default)
|
37 |
-
return val
|
38 |
-
|
39 |
-
|
40 |
-
# Some test code for development.
|
41 |
-
# Run: `$ streamlit run st_bridge/bridge.py`
|
42 |
-
if not _RELEASE:
|
43 |
-
import streamlit as st
|
44 |
-
|
45 |
-
st.title("Streamlit Bridge")
|
46 |
-
|
47 |
-
text = bridge("aaa")
|
48 |
-
st.write("Message from browser: %s" % text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/bridge/.gitignore
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
2 |
-
|
3 |
-
node_modules
|
4 |
-
|
5 |
-
# dependencies
|
6 |
-
/node_modules
|
7 |
-
/.pnp
|
8 |
-
.pnp.js
|
9 |
-
|
10 |
-
# testing
|
11 |
-
/coverage
|
12 |
-
|
13 |
-
# production
|
14 |
-
!/build
|
15 |
-
|
16 |
-
# misc
|
17 |
-
.DS_Store
|
18 |
-
.env.local
|
19 |
-
.env.development.local
|
20 |
-
.env.test.local
|
21 |
-
.env.production.local
|
22 |
-
|
23 |
-
npm-debug.log*
|
24 |
-
yarn-debug.log*
|
25 |
-
yarn-error.log*
|
26 |
-
|
27 |
-
.yalc
|
28 |
-
yalc.lock
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/bridge/build/asset-manifest.json
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"files": {
|
3 |
-
"main.js": "./static/js/main.4c504d7b.chunk.js",
|
4 |
-
"main.js.map": "./static/js/main.4c504d7b.chunk.js.map",
|
5 |
-
"runtime-main.js": "./static/js/runtime-main.f43d5da3.js",
|
6 |
-
"runtime-main.js.map": "./static/js/runtime-main.f43d5da3.js.map",
|
7 |
-
"static/js/2.d57250d1.chunk.js": "./static/js/2.d57250d1.chunk.js",
|
8 |
-
"static/js/2.d57250d1.chunk.js.map": "./static/js/2.d57250d1.chunk.js.map",
|
9 |
-
"index.html": "./index.html",
|
10 |
-
"precache-manifest.fad985818978633f1a71f25d0a3349e9.js": "./precache-manifest.fad985818978633f1a71f25d0a3349e9.js",
|
11 |
-
"service-worker.js": "./service-worker.js",
|
12 |
-
"static/js/2.d57250d1.chunk.js.LICENSE.txt": "./static/js/2.d57250d1.chunk.js.LICENSE.txt"
|
13 |
-
},
|
14 |
-
"entrypoints": [
|
15 |
-
"static/js/runtime-main.f43d5da3.js",
|
16 |
-
"static/js/2.d57250d1.chunk.js",
|
17 |
-
"static/js/main.4c504d7b.chunk.js"
|
18 |
-
]
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/bridge/build/bootstrap.min.css
DELETED
The diff for this file is too large to render.
See raw diff
|
|
st_bridge/bridge/build/bootstrap.min.css.map
DELETED
The diff for this file is too large to render.
See raw diff
|
|
st_bridge/bridge/build/index.html
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<!doctype html><html lang="en"><head><title>Streamlit Component</title><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Streamlit Component"/><link rel="stylesheet" href="bootstrap.min.css"/></head><body><noscript>You need to enable JavaScript to run this app.</noscript><script>!function(e){function r(r){for(var n,i,l=r[0],a=r[1],f=r[2],c=0,s=[];c<l.length;c++)i=l[c],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&s.push(o[i][0]),o[i]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var a=t[l];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={1:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,function(r){return e[r]}.bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="./";var l=this["webpackJsonpstreamlit-bridge"]=this["webpackJsonpstreamlit-bridge"]||[],a=l.push.bind(l);l.push=r,l=l.slice();for(var f=0;f<l.length;f++)r(l[f]);var p=a;t()}([])</script><script src="./static/js/2.d57250d1.chunk.js"></script><script src="./static/js/main.4c504d7b.chunk.js"></script></body></html>
|
|
|
|
st_bridge/bridge/build/precache-manifest.fad985818978633f1a71f25d0a3349e9.js
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
self.__precacheManifest = (self.__precacheManifest || []).concat([
|
2 |
-
{
|
3 |
-
"revision": "83498d3a337a0cc5e1918e1ef635b7e2",
|
4 |
-
"url": "./index.html"
|
5 |
-
},
|
6 |
-
{
|
7 |
-
"revision": "79f3664c334f065fbae9",
|
8 |
-
"url": "./static/js/2.d57250d1.chunk.js"
|
9 |
-
},
|
10 |
-
{
|
11 |
-
"revision": "b5321db7731dbb9a09b1fc4c60b61213",
|
12 |
-
"url": "./static/js/2.d57250d1.chunk.js.LICENSE.txt"
|
13 |
-
},
|
14 |
-
{
|
15 |
-
"revision": "f5707067d3a368089b77",
|
16 |
-
"url": "./static/js/main.4c504d7b.chunk.js"
|
17 |
-
},
|
18 |
-
{
|
19 |
-
"revision": "5e8ec43ca3bba2a86cdb",
|
20 |
-
"url": "./static/js/runtime-main.f43d5da3.js"
|
21 |
-
}
|
22 |
-
]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/bridge/build/service-worker.js
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Welcome to your Workbox-powered service worker!
|
3 |
-
*
|
4 |
-
* You'll need to register this file in your web app and you should
|
5 |
-
* disable HTTP caching for this file too.
|
6 |
-
* See https://goo.gl/nhQhGp
|
7 |
-
*
|
8 |
-
* The rest of the code is auto-generated. Please don't update this file
|
9 |
-
* directly; instead, make changes to your Workbox build configuration
|
10 |
-
* and re-run your build process.
|
11 |
-
* See https://goo.gl/2aRDsh
|
12 |
-
*/
|
13 |
-
|
14 |
-
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
|
15 |
-
|
16 |
-
importScripts(
|
17 |
-
"./precache-manifest.fad985818978633f1a71f25d0a3349e9.js"
|
18 |
-
);
|
19 |
-
|
20 |
-
self.addEventListener('message', (event) => {
|
21 |
-
if (event.data && event.data.type === 'SKIP_WAITING') {
|
22 |
-
self.skipWaiting();
|
23 |
-
}
|
24 |
-
});
|
25 |
-
|
26 |
-
workbox.core.clientsClaim();
|
27 |
-
|
28 |
-
/**
|
29 |
-
* The workboxSW.precacheAndRoute() method efficiently caches and responds to
|
30 |
-
* requests for URLs in the manifest.
|
31 |
-
* See https://goo.gl/S9QRab
|
32 |
-
*/
|
33 |
-
self.__precacheManifest = [].concat(self.__precacheManifest || []);
|
34 |
-
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
|
35 |
-
|
36 |
-
workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("./index.html"), {
|
37 |
-
|
38 |
-
blacklist: [/^\/_/,/\/[^/?]+\.[^/]+$/],
|
39 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/bridge/build/static/js/2.d57250d1.chunk.js
DELETED
The diff for this file is too large to render.
See raw diff
|
|
st_bridge/bridge/build/static/js/2.d57250d1.chunk.js.LICENSE.txt
DELETED
@@ -1,42 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
object-assign
|
3 |
-
(c) Sindre Sorhus
|
4 |
-
@license MIT
|
5 |
-
*/
|
6 |
-
|
7 |
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
8 |
-
|
9 |
-
/**
|
10 |
-
* @license
|
11 |
-
* Copyright 2018-2021 Streamlit Inc.
|
12 |
-
*
|
13 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
14 |
-
* you may not use this file except in compliance with the License.
|
15 |
-
* You may obtain a copy of the License at
|
16 |
-
*
|
17 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
18 |
-
*
|
19 |
-
* Unless required by applicable law or agreed to in writing, software
|
20 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
21 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
22 |
-
* See the License for the specific language governing permissions and
|
23 |
-
* limitations under the License.
|
24 |
-
*/
|
25 |
-
|
26 |
-
/** @license React v16.13.1
|
27 |
-
* react-is.production.min.js
|
28 |
-
*
|
29 |
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
30 |
-
*
|
31 |
-
* This source code is licensed under the MIT license found in the
|
32 |
-
* LICENSE file in the root directory of this source tree.
|
33 |
-
*/
|
34 |
-
|
35 |
-
/** @license React v16.14.0
|
36 |
-
* react.production.min.js
|
37 |
-
*
|
38 |
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
39 |
-
*
|
40 |
-
* This source code is licensed under the MIT license found in the
|
41 |
-
* LICENSE file in the root directory of this source tree.
|
42 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/bridge/build/static/js/2.d57250d1.chunk.js.map
DELETED
The diff for this file is too large to render.
See raw diff
|
|
st_bridge/bridge/build/static/js/main.4c504d7b.chunk.js
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
(this["webpackJsonpstreamlit-bridge"]=this["webpackJsonpstreamlit-bridge"]||[]).push([[0],{5:function(e,t,n){e.exports=n(6)},6:function(e,t,n){"use strict";n.r(t);var i=n(0),s=n(1),a=n(3),r=function(){function e(t,n){Object(i.a)(this,e),this.name=void 0,this.key=void 0,this.name=t,this.key=n}return Object(s.a)(e,[{key:"send",value:function(e){a.a.setComponentValue(e)}}]),e}();var o=function(){var e;try{e=window.top||window.parent}catch(t){e=window.parent}return e}();if(void 0===o.stBridges){var d={bridges:{},send:function(e,t){d.bridges[e].send(t)}};o.stBridges=d}a.a.events.addEventListener(a.a.RENDER_EVENT,(function(e){var t=e.detail,n=o.stBridges,i=t.args.name,s=t.args.key;n.bridges[i]=new r(i,s)})),a.a.setComponentReady()}},[[5,1,2]]]);
|
2 |
-
//# sourceMappingURL=main.4c504d7b.chunk.js.map
|
|
|
|
|
|
st_bridge/bridge/build/static/js/main.4c504d7b.chunk.js.map
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"version":3,"sources":["index.tsx"],"names":["Bridge","name","key","this","data","Streamlit","setComponentValue","global","window","top","parent","getGlobal","undefined","stBridges","bridges","send","events","addEventListener","RENDER_EVENT","event","detail","bridge","args","setComponentReady"],"mappings":"4LAEMA,E,WAIJ,WAAYC,EAAcC,GAA8B,yBAHjDD,UAGgD,OAFhDC,SAEgD,EACrDC,KAAKF,KAAOA,EACZE,KAAKD,IAAMA,E,wCAGb,SAAYE,GACVC,IAAUC,kBAAkBF,O,KAoBhC,IAAMG,EAbN,WACE,IAAIA,EACJ,IAIEA,EAASC,OAAOC,KAAOD,OAAOE,OAC9B,SACAH,EAASC,OAAOE,OAElB,OAAOH,EAGMI,GAEf,QAAkCC,IAA7BL,EAAeM,UAAyB,CAC3C,IAAMA,EAAY,CAChBC,QAAS,GACTC,KAAM,SAACd,EAAcG,GACnBS,EAAUC,QAAQb,GAAMc,KAAKX,KAGhCG,EAAeM,UAAYA,EAmB9BR,IAAUW,OAAOC,iBAAiBZ,IAAUa,cAX5C,SAAkBC,GAEhB,IAAMf,EAAQe,EAAkCC,OAE1CP,EAAaN,EAAeM,UAC5BQ,EAASjB,EAAKkB,KAAL,KACTpB,EAAME,EAAKkB,KAAL,IACZT,EAAUC,QAAQO,GAAU,IAAIrB,EAAOqB,EAAQnB,MAQjDG,IAAUkB,sB","file":"static/js/main.4c504d7b.chunk.js","sourcesContent":["import { Streamlit, RenderData } from \"streamlit-component-lib\";\n\nclass Bridge {\n public name: string;\n public key: string | number | null;\n\n constructor(name: string, key: string | number | null) {\n this.name = name;\n this.key = key;\n }\n\n public send(data: any) {\n Streamlit.setComponentValue(data);\n }\n}\n\n// store data in the topmost window in the window hierarchy as the component\n// is rendered inside an iframe.\n\nfunction getGlobal() {\n let global: Window;\n try {\n /* Try to access a property of window.top. This will fail when window.top\n is unset or cross-origin doesn't allow us to access window.top\n */\n global = window.top || window.parent;\n } catch {\n global = window.parent;\n }\n return global;\n}\n\nconst global = getGlobal();\n\nif ((global as any).stBridges === undefined) {\n const stBridges = {\n bridges: {} as { [key: string]: Bridge },\n send: (name: string, data: any) => {\n stBridges.bridges[name].send(data);\n },\n };\n (global as any).stBridges = stBridges;\n}\n\n/**\n * The component's render function. This will be called immediately after\n * the component is initially loaded, and then again every time the\n * component gets new data from Python.\n */\nfunction onRender(event: Event): void {\n // Get the RenderData from the event\n const data = (event as CustomEvent<RenderData>).detail;\n\n const stBridges = (global as any).stBridges;\n const bridge = data.args[\"name\"];\n const key = data.args[\"key\"];\n stBridges.bridges[bridge] = new Bridge(bridge, key);\n}\n\n// Attach our `onRender` handler to Streamlit's render event.\nStreamlit.events.addEventListener(Streamlit.RENDER_EVENT, onRender);\n\n// Tell Streamlit we're ready to start receiving data. We won't get our\n// first RENDER_EVENT until we call this function.\nStreamlit.setComponentReady();\n"],"sourceRoot":""}
|
|
|
|
st_bridge/bridge/build/static/js/runtime-main.f43d5da3.js
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
!function(e){function r(r){for(var n,i,l=r[0],a=r[1],f=r[2],c=0,s=[];c<l.length;c++)i=l[c],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&s.push(o[i][0]),o[i]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var a=t[l];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={1:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,function(r){return e[r]}.bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="./";var l=this["webpackJsonpstreamlit-bridge"]=this["webpackJsonpstreamlit-bridge"]||[],a=l.push.bind(l);l.push=r,l=l.slice();for(var f=0;f<l.length;f++)r(l[f]);var p=a;t()}([]);
|
2 |
-
//# sourceMappingURL=runtime-main.f43d5da3.js.map
|
|
|
|
|
|
st_bridge/bridge/build/static/js/runtime-main.f43d5da3.js.map
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"version":3,"sources":["../webpack/bootstrap"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","1","exports","module","l","m","c","d","name","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","p","jsonpArray","this","oldJsonpFunction","slice"],"mappings":"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","file":"static/js/runtime-main.f43d5da3.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t1: 0\n \t};\n\n \tvar deferredModules = [];\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"./\";\n\n \tvar jsonpArray = this[\"webpackJsonpstreamlit-bridge\"] = this[\"webpackJsonpstreamlit-bridge\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// run deferred modules from other chunks\n \tcheckDeferredModules();\n"],"sourceRoot":""}
|
|
|
|
st_bridge/bridge/package-lock.json
DELETED
The diff for this file is too large to render.
See raw diff
|
|
st_bridge/bridge/package.json
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "streamlit-bridge",
|
3 |
-
"version": "1.0.2",
|
4 |
-
"private": true,
|
5 |
-
"dependencies": {
|
6 |
-
"@testing-library/jest-dom": "^4.2.4",
|
7 |
-
"@testing-library/react": "^9.3.2",
|
8 |
-
"@testing-library/user-event": "^7.1.2",
|
9 |
-
"@types/jest": "^24.0.0",
|
10 |
-
"@types/node": "^12.0.0",
|
11 |
-
"react-scripts": "3.4.1",
|
12 |
-
"streamlit-component-lib": "^1.3.0",
|
13 |
-
"typescript": "~3.8.0"
|
14 |
-
},
|
15 |
-
"scripts": {
|
16 |
-
"start": "react-scripts start",
|
17 |
-
"build": "react-scripts build",
|
18 |
-
"test": "react-scripts test",
|
19 |
-
"eject": "react-scripts eject"
|
20 |
-
},
|
21 |
-
"eslintConfig": {
|
22 |
-
"extends": "react-app"
|
23 |
-
},
|
24 |
-
"browserslist": {
|
25 |
-
"production": [">0.2%", "not dead", "not op_mini all"],
|
26 |
-
"development": [
|
27 |
-
"last 1 chrome version",
|
28 |
-
"last 1 firefox version",
|
29 |
-
"last 1 safari version"
|
30 |
-
]
|
31 |
-
},
|
32 |
-
"homepage": "."
|
33 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/bridge/public/bootstrap.min.css
DELETED
The diff for this file is too large to render.
See raw diff
|
|
st_bridge/bridge/public/bootstrap.min.css.map
DELETED
The diff for this file is too large to render.
See raw diff
|
|
st_bridge/bridge/public/index.html
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
-
<html lang="en">
|
3 |
-
<head>
|
4 |
-
<title>Streamlit Component</title>
|
5 |
-
<meta charset="UTF-8" />
|
6 |
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
7 |
-
<meta name="theme-color" content="#000000" />
|
8 |
-
<meta name="description" content="Streamlit Component" />
|
9 |
-
<link rel="stylesheet" href="bootstrap.min.css" />
|
10 |
-
</head>
|
11 |
-
<body>
|
12 |
-
<noscript>You need to enable JavaScript to run this app.</noscript>
|
13 |
-
</body>
|
14 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/bridge/src/index.tsx
DELETED
@@ -1,65 +0,0 @@
|
|
1 |
-
import { Streamlit, RenderData } from "streamlit-component-lib";
|
2 |
-
|
3 |
-
class Bridge {
|
4 |
-
public name: string;
|
5 |
-
public key: string | number | null;
|
6 |
-
|
7 |
-
constructor(name: string, key: string | number | null) {
|
8 |
-
this.name = name;
|
9 |
-
this.key = key;
|
10 |
-
}
|
11 |
-
|
12 |
-
public send(data: any) {
|
13 |
-
Streamlit.setComponentValue(data);
|
14 |
-
}
|
15 |
-
}
|
16 |
-
|
17 |
-
// store data in the topmost window in the window hierarchy as the component
|
18 |
-
// is rendered inside an iframe.
|
19 |
-
|
20 |
-
function getGlobal() {
|
21 |
-
let global: Window;
|
22 |
-
try {
|
23 |
-
/* Try to access a property of window.top. This will fail when window.top
|
24 |
-
is unset or cross-origin doesn't allow us to access window.top
|
25 |
-
*/
|
26 |
-
global = window.top || window.parent;
|
27 |
-
} catch {
|
28 |
-
global = window.parent;
|
29 |
-
}
|
30 |
-
return global;
|
31 |
-
}
|
32 |
-
|
33 |
-
const global = getGlobal();
|
34 |
-
|
35 |
-
if ((global as any).stBridges === undefined) {
|
36 |
-
const stBridges = {
|
37 |
-
bridges: {} as { [key: string]: Bridge },
|
38 |
-
send: (name: string, data: any) => {
|
39 |
-
stBridges.bridges[name].send(data);
|
40 |
-
},
|
41 |
-
};
|
42 |
-
(global as any).stBridges = stBridges;
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* The component's render function. This will be called immediately after
|
47 |
-
* the component is initially loaded, and then again every time the
|
48 |
-
* component gets new data from Python.
|
49 |
-
*/
|
50 |
-
function onRender(event: Event): void {
|
51 |
-
// Get the RenderData from the event
|
52 |
-
const data = (event as CustomEvent<RenderData>).detail;
|
53 |
-
|
54 |
-
const stBridges = (global as any).stBridges;
|
55 |
-
const bridge = data.args["name"];
|
56 |
-
const key = data.args["key"];
|
57 |
-
stBridges.bridges[bridge] = new Bridge(bridge, key);
|
58 |
-
}
|
59 |
-
|
60 |
-
// Attach our `onRender` handler to Streamlit's render event.
|
61 |
-
Streamlit.events.addEventListener(Streamlit.RENDER_EVENT, onRender);
|
62 |
-
|
63 |
-
// Tell Streamlit we're ready to start receiving data. We won't get our
|
64 |
-
// first RENDER_EVENT until we call this function.
|
65 |
-
Streamlit.setComponentReady();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/bridge/src/react-app-env.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
/// <reference types="react-scripts" />
|
|
|
|
st_bridge/bridge/tsconfig.json
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"compilerOptions": {
|
3 |
-
"target": "es5",
|
4 |
-
"lib": ["dom", "dom.iterable", "esnext"],
|
5 |
-
"allowJs": true,
|
6 |
-
"skipLibCheck": true,
|
7 |
-
"esModuleInterop": true,
|
8 |
-
"allowSyntheticDefaultImports": true,
|
9 |
-
"strict": true,
|
10 |
-
"forceConsistentCasingInFileNames": true,
|
11 |
-
"module": "esnext",
|
12 |
-
"moduleResolution": "node",
|
13 |
-
"resolveJsonModule": true,
|
14 |
-
"isolatedModules": true,
|
15 |
-
"noEmit": true,
|
16 |
-
"jsx": "react"
|
17 |
-
},
|
18 |
-
"include": ["src"]
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/bridge/yarn.lock
DELETED
The diff for this file is too large to render.
See raw diff
|
|
st_bridge/html.py
DELETED
@@ -1,65 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
from typing import Optional
|
3 |
-
import streamlit as st
|
4 |
-
import streamlit.components.v1 as components
|
5 |
-
|
6 |
-
# Create a _RELEASE constant. We'll set this to False while we're developing
|
7 |
-
# the component, and True when we're ready to package and distribute it.
|
8 |
-
# (This is, of course, optional - there are innumerable ways to manage your
|
9 |
-
# release process.)
|
10 |
-
_RELEASE = True
|
11 |
-
|
12 |
-
# Declare a Streamlit component. `declare_component` returns a function
|
13 |
-
# that is used to create instances of the component. We're naming this
|
14 |
-
# function "_component_func", with an underscore prefix, because we don't want
|
15 |
-
# to expose it directly to users. Instead, we will create a custom wrapper
|
16 |
-
# function, below, that will serve as our component's public API.
|
17 |
-
|
18 |
-
# It's worth noting that this call to `declare_component` is the
|
19 |
-
# *only thing* you need to do to create the binding between Streamlit and
|
20 |
-
# your component frontend. Everything else we do in this file is simply a
|
21 |
-
# best practice.
|
22 |
-
|
23 |
-
if not _RELEASE:
|
24 |
-
_html_func = components.declare_component(
|
25 |
-
"html",
|
26 |
-
url="http://localhost:3000",
|
27 |
-
)
|
28 |
-
else:
|
29 |
-
parent_dir = os.path.dirname(os.path.abspath(__file__))
|
30 |
-
build_dir = os.path.join(parent_dir, "html/build")
|
31 |
-
_html_func = components.declare_component("html", path=build_dir)
|
32 |
-
|
33 |
-
|
34 |
-
def html(html: str, iframe: bool = False, key: Optional[str]=None) -> None:
|
35 |
-
"""Render HTML in Streamlit without being processed by Markdown.
|
36 |
-
|
37 |
-
Args:
|
38 |
-
html: HTML to render
|
39 |
-
iframe: whether to render the HTML in an iframe or in the main document.
|
40 |
-
By default streamlit component is rendered inside an iframe, so by
|
41 |
-
setting it to false, we allow the HTML to rendered in the main document.
|
42 |
-
key: streamlit component's id
|
43 |
-
"""
|
44 |
-
if iframe:
|
45 |
-
return _html_func(html=html, iframe=iframe, key=key, default="")
|
46 |
-
|
47 |
-
with st.container():
|
48 |
-
_html_func(html=html, iframe=iframe, key=key, default="")
|
49 |
-
|
50 |
-
|
51 |
-
# Some test code for development.
|
52 |
-
# Run: `$ streamlit run st_bridge/html.py`
|
53 |
-
if not _RELEASE:
|
54 |
-
import streamlit as st
|
55 |
-
|
56 |
-
st.title("Streamlit HTML Component")
|
57 |
-
content = st.text_area("HTML", value="""
|
58 |
-
<h1>Hello world</h1>
|
59 |
-
<div>
|
60 |
-
<code>Hello world</code>
|
61 |
-
<p><pre>Hello world</pre></p>
|
62 |
-
<p><code>Hello world 2</code></p>
|
63 |
-
</div>
|
64 |
-
""")
|
65 |
-
html(content, iframe=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/html/.gitignore
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
2 |
-
|
3 |
-
node_modules
|
4 |
-
|
5 |
-
# dependencies
|
6 |
-
/node_modules
|
7 |
-
/.pnp
|
8 |
-
.pnp.js
|
9 |
-
|
10 |
-
# testing
|
11 |
-
/coverage
|
12 |
-
|
13 |
-
# production
|
14 |
-
!/build
|
15 |
-
|
16 |
-
# misc
|
17 |
-
.DS_Store
|
18 |
-
.env.local
|
19 |
-
.env.development.local
|
20 |
-
.env.test.local
|
21 |
-
.env.production.local
|
22 |
-
|
23 |
-
npm-debug.log*
|
24 |
-
yarn-debug.log*
|
25 |
-
yarn-error.log*
|
26 |
-
|
27 |
-
.yalc
|
28 |
-
yalc.lock
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/html/build/asset-manifest.json
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"files": {
|
3 |
-
"main.js": "./static/js/main.4e83250e.chunk.js",
|
4 |
-
"main.js.map": "./static/js/main.4e83250e.chunk.js.map",
|
5 |
-
"runtime-main.js": "./static/js/runtime-main.d8806d63.js",
|
6 |
-
"runtime-main.js.map": "./static/js/runtime-main.d8806d63.js.map",
|
7 |
-
"static/js/2.ce2c8f1c.chunk.js": "./static/js/2.ce2c8f1c.chunk.js",
|
8 |
-
"static/js/2.ce2c8f1c.chunk.js.map": "./static/js/2.ce2c8f1c.chunk.js.map",
|
9 |
-
"index.html": "./index.html",
|
10 |
-
"precache-manifest.5b5300284d43bf8ba972ca3da2f90d8d.js": "./precache-manifest.5b5300284d43bf8ba972ca3da2f90d8d.js",
|
11 |
-
"service-worker.js": "./service-worker.js",
|
12 |
-
"static/js/2.ce2c8f1c.chunk.js.LICENSE.txt": "./static/js/2.ce2c8f1c.chunk.js.LICENSE.txt"
|
13 |
-
},
|
14 |
-
"entrypoints": [
|
15 |
-
"static/js/runtime-main.d8806d63.js",
|
16 |
-
"static/js/2.ce2c8f1c.chunk.js",
|
17 |
-
"static/js/main.4e83250e.chunk.js"
|
18 |
-
]
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/html/build/bootstrap.min.css
DELETED
The diff for this file is too large to render.
See raw diff
|
|
st_bridge/html/build/bootstrap.min.css.map
DELETED
The diff for this file is too large to render.
See raw diff
|
|
st_bridge/html/build/index.html
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<!doctype html><html lang="en"><head><title>Streamlit Component</title><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Streamlit Component"/><link rel="stylesheet" href="bootstrap.min.css"/></head><body><noscript>You need to enable JavaScript to run this app.</noscript><script>!function(e){function t(t){for(var n,l,i=t[0],a=t[1],f=t[2],c=0,s=[];c<i.length;c++)l=i[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(p&&p(t);s.length;)s.shift()();return u.push.apply(u,f||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,i=1;i<r.length;i++){var a=r[i];0!==o[a]&&(n=!1)}n&&(u.splice(t--,1),e=l(l.s=r[0]))}return e}var n={},o={1:0},u=[];function l(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.m=e,l.c=n,l.d=function(e,t,r){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(l.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(r,n,function(t){return e[t]}.bind(null,n));return r},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="./";var i=this["webpackJsonpstreamlit-html"]=this["webpackJsonpstreamlit-html"]||[],a=i.push.bind(i);i.push=t,i=i.slice();for(var f=0;f<i.length;f++)t(i[f]);var p=a;r()}([])</script><script src="./static/js/2.ce2c8f1c.chunk.js"></script><script src="./static/js/main.4e83250e.chunk.js"></script></body></html>
|
|
|
|
st_bridge/html/build/precache-manifest.5b5300284d43bf8ba972ca3da2f90d8d.js
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
self.__precacheManifest = (self.__precacheManifest || []).concat([
|
2 |
-
{
|
3 |
-
"revision": "a2b865f3f4b0ee942e6b9693a992ac9f",
|
4 |
-
"url": "./index.html"
|
5 |
-
},
|
6 |
-
{
|
7 |
-
"revision": "761b640253c93d5c8cc7",
|
8 |
-
"url": "./static/js/2.ce2c8f1c.chunk.js"
|
9 |
-
},
|
10 |
-
{
|
11 |
-
"revision": "b5321db7731dbb9a09b1fc4c60b61213",
|
12 |
-
"url": "./static/js/2.ce2c8f1c.chunk.js.LICENSE.txt"
|
13 |
-
},
|
14 |
-
{
|
15 |
-
"revision": "bdd8d70b0d568f536339",
|
16 |
-
"url": "./static/js/main.4e83250e.chunk.js"
|
17 |
-
},
|
18 |
-
{
|
19 |
-
"revision": "2be61b5108aa2269d46b",
|
20 |
-
"url": "./static/js/runtime-main.d8806d63.js"
|
21 |
-
}
|
22 |
-
]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/html/build/service-worker.js
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Welcome to your Workbox-powered service worker!
|
3 |
-
*
|
4 |
-
* You'll need to register this file in your web app and you should
|
5 |
-
* disable HTTP caching for this file too.
|
6 |
-
* See https://goo.gl/nhQhGp
|
7 |
-
*
|
8 |
-
* The rest of the code is auto-generated. Please don't update this file
|
9 |
-
* directly; instead, make changes to your Workbox build configuration
|
10 |
-
* and re-run your build process.
|
11 |
-
* See https://goo.gl/2aRDsh
|
12 |
-
*/
|
13 |
-
|
14 |
-
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
|
15 |
-
|
16 |
-
importScripts(
|
17 |
-
"./precache-manifest.5b5300284d43bf8ba972ca3da2f90d8d.js"
|
18 |
-
);
|
19 |
-
|
20 |
-
self.addEventListener('message', (event) => {
|
21 |
-
if (event.data && event.data.type === 'SKIP_WAITING') {
|
22 |
-
self.skipWaiting();
|
23 |
-
}
|
24 |
-
});
|
25 |
-
|
26 |
-
workbox.core.clientsClaim();
|
27 |
-
|
28 |
-
/**
|
29 |
-
* The workboxSW.precacheAndRoute() method efficiently caches and responds to
|
30 |
-
* requests for URLs in the manifest.
|
31 |
-
* See https://goo.gl/S9QRab
|
32 |
-
*/
|
33 |
-
self.__precacheManifest = [].concat(self.__precacheManifest || []);
|
34 |
-
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
|
35 |
-
|
36 |
-
workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("./index.html"), {
|
37 |
-
|
38 |
-
blacklist: [/^\/_/,/\/[^/?]+\.[^/]+$/],
|
39 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/html/build/static/js/2.ce2c8f1c.chunk.js
DELETED
The diff for this file is too large to render.
See raw diff
|
|
st_bridge/html/build/static/js/2.ce2c8f1c.chunk.js.LICENSE.txt
DELETED
@@ -1,42 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
object-assign
|
3 |
-
(c) Sindre Sorhus
|
4 |
-
@license MIT
|
5 |
-
*/
|
6 |
-
|
7 |
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
8 |
-
|
9 |
-
/**
|
10 |
-
* @license
|
11 |
-
* Copyright 2018-2021 Streamlit Inc.
|
12 |
-
*
|
13 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
14 |
-
* you may not use this file except in compliance with the License.
|
15 |
-
* You may obtain a copy of the License at
|
16 |
-
*
|
17 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
18 |
-
*
|
19 |
-
* Unless required by applicable law or agreed to in writing, software
|
20 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
21 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
22 |
-
* See the License for the specific language governing permissions and
|
23 |
-
* limitations under the License.
|
24 |
-
*/
|
25 |
-
|
26 |
-
/** @license React v16.13.1
|
27 |
-
* react-is.production.min.js
|
28 |
-
*
|
29 |
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
30 |
-
*
|
31 |
-
* This source code is licensed under the MIT license found in the
|
32 |
-
* LICENSE file in the root directory of this source tree.
|
33 |
-
*/
|
34 |
-
|
35 |
-
/** @license React v16.14.0
|
36 |
-
* react.production.min.js
|
37 |
-
*
|
38 |
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
39 |
-
*
|
40 |
-
* This source code is licensed under the MIT license found in the
|
41 |
-
* LICENSE file in the root directory of this source tree.
|
42 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/html/build/static/js/2.ce2c8f1c.chunk.js.map
DELETED
The diff for this file is too large to render.
See raw diff
|
|
st_bridge/html/build/static/js/main.4e83250e.chunk.js
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
(this["webpackJsonpstreamlit-html"]=this["webpackJsonpstreamlit-html"]||[]).push([[0],[,,,function(e,t,n){e.exports=n(4)},function(e,t,n){"use strict";n.r(t);var a=n(1),i=document.body.appendChild(document.createElement("div")),r=null;function o(){if(null!==r)return r;for(var e=window.parent.document.getElementsByTagName("iframe"),t=0;t<e.length;t++){var n,a=e[t];(a.contentDocument||(null===(n=a.contentWindow)||void 0===n?void 0:n.document))===document&&(r=a.parentElement)}return null===r&&console.error("Failed to identify the container of the HTML component"),r}a.a.events.addEventListener(a.a.RENDER_EVENT,(function(e){var t=e.detail,n=t.args.html;if(!0===t.args.iframe)return i.innerHTML=n,void a.a.setFrameHeight();var r=o();if(null!==r){if("iframe"===r.lastElementChild.tagName.toLowerCase()){var l=window.parent.document.createElement("div");r.appendChild(l),r.firstElementChild.style.display="none"}r.lastElementChild.innerHTML=n}})),a.a.setComponentReady(),a.a.setFrameHeight()}],[[3,1,2]]]);
|
2 |
-
//# sourceMappingURL=main.4e83250e.chunk.js.map
|
|
|
|
|
|
st_bridge/html/build/static/js/main.4e83250e.chunk.js.map
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"version":3,"sources":["index.tsx"],"names":["root","document","body","appendChild","createElement","container","getContainer","iframes","window","parent","getElementsByTagName","i","length","iframe","contentDocument","contentWindow","parentElement","console","error","Streamlit","events","addEventListener","RENDER_EVENT","event","data","detail","html","args","innerHTML","setFrameHeight","lastElementChild","tagName","toLowerCase","div","firstElementChild","style","display","setComponentReady"],"mappings":"uJAAA,kBAEMA,EAAOC,SAASC,KAAKC,YAAYF,SAASG,cAAc,QAE1DC,EAAmC,KAEvC,SAASC,IACP,GAAkB,OAAdD,EAAoB,OAAOA,EAG/B,IADA,IAAME,EAAUC,OAAOC,OAAOR,SAASS,qBAAqB,UACnDC,EAAI,EAAGA,EAAIJ,EAAQK,OAAQD,IAAK,CAAC,IAAD,EACjCE,EAASN,EAAQI,IAEpBE,EAAOC,kBAAP,UAA0BD,EAAOE,qBAAjC,aAA0B,EAAsBd,aAAcA,WAE/DI,EAAYQ,EAAOG,eAQvB,OAJkB,OAAdX,GACFY,QAAQC,MAAM,0DAGTb,EAsCTc,IAAUC,OAAOC,iBAAiBF,IAAUG,cA9B5C,SAAkBC,GAEhB,IAAMC,EAAQD,EAAkCE,OAE1CC,EAAOF,EAAKG,KAAL,KAGb,IAAe,IAFAH,EAAKG,KAAL,OAMb,OAHA3B,EAAK4B,UAAYF,OACjBP,IAAUU,iBAMZ,IAAMxB,EAAYC,IAClB,GAAkB,OAAdD,EAAJ,CAEA,GAA0D,WAAtDA,EAAUyB,iBAAkBC,QAAQC,cAA4B,CAElE,IAAMC,EAAMzB,OAAOC,OAAOR,SAASG,cAAc,OACjDC,EAAUF,YAAY8B,GAErB5B,EAAU6B,kBAAmCC,MAAMC,QAAU,OAGhE/B,EAAUyB,iBAAkBF,UAAYF,MAQ1CP,IAAUkB,oBAIVlB,IAAUU,mB","file":"static/js/main.4e83250e.chunk.js","sourcesContent":["import { Streamlit, RenderData } from \"streamlit-component-lib\";\n\nconst root = document.body.appendChild(document.createElement(\"div\"));\n\nlet container: HTMLDivElement | null = null;\n\nfunction getContainer() {\n if (container !== null) return container;\n\n const iframes = window.parent.document.getElementsByTagName(\"iframe\");\n for (let i = 0; i < iframes.length; i++) {\n const iframe = iframes[i];\n if (\n (iframe.contentDocument || iframe.contentWindow?.document) === document\n ) {\n container = iframe.parentElement! as HTMLDivElement;\n }\n }\n\n if (container === null) {\n console.error(\"Failed to identify the container of the HTML component\");\n }\n\n return container;\n}\n\n/**\n * The component's render function. This will be called immediately after\n * the component is initially loaded, and then again every time the\n * component gets new data from Python.\n */\nfunction onRender(event: Event): void {\n // Get the RenderData from the event\n const data = (event as CustomEvent<RenderData>).detail;\n\n const html = data.args[\"html\"];\n const iframe = data.args[\"iframe\"];\n\n if (iframe === true) {\n root.innerHTML = html;\n Streamlit.setFrameHeight();\n\n return;\n }\n\n // not render inside iframe, we create a div sibling and render it there\n const container = getContainer();\n if (container === null) return;\n\n if (container.lastElementChild!.tagName.toLowerCase() === \"iframe\") {\n // need to create a new div to render the html\n const div = window.parent.document.createElement(\"div\");\n container.appendChild(div);\n // hide the iframe\n (container.firstElementChild! as HTMLElement).style.display = \"none\";\n }\n\n container.lastElementChild!.innerHTML = html;\n}\n\n// Attach our `onRender` handler to Streamlit's render event.\nStreamlit.events.addEventListener(Streamlit.RENDER_EVENT, onRender);\n\n// Tell Streamlit we're ready to start receiving data. We won't get our\n// first RENDER_EVENT until we call this function.\nStreamlit.setComponentReady();\n\n// Finally, tell Streamlit to update our initial height. We omit the\n// `height` parameter here to have it default to our scrollHeight.\nStreamlit.setFrameHeight();\n"],"sourceRoot":""}
|
|
|
|
st_bridge/html/build/static/js/runtime-main.d8806d63.js
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
!function(e){function t(t){for(var n,l,i=t[0],a=t[1],f=t[2],c=0,s=[];c<i.length;c++)l=i[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(p&&p(t);s.length;)s.shift()();return u.push.apply(u,f||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,i=1;i<r.length;i++){var a=r[i];0!==o[a]&&(n=!1)}n&&(u.splice(t--,1),e=l(l.s=r[0]))}return e}var n={},o={1:0},u=[];function l(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.m=e,l.c=n,l.d=function(e,t,r){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},l.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(l.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(r,n,function(t){return e[t]}.bind(null,n));return r},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="./";var i=this["webpackJsonpstreamlit-html"]=this["webpackJsonpstreamlit-html"]||[],a=i.push.bind(i);i.push=t,i=i.slice();for(var f=0;f<i.length;f++)t(i[f]);var p=a;r()}([]);
|
2 |
-
//# sourceMappingURL=runtime-main.d8806d63.js.map
|
|
|
|
|
|
st_bridge/html/build/static/js/runtime-main.d8806d63.js.map
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"version":3,"sources":["../webpack/bootstrap"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","1","exports","module","l","m","c","d","name","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","p","jsonpArray","this","oldJsonpFunction","slice"],"mappings":"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","file":"static/js/runtime-main.d8806d63.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t1: 0\n \t};\n\n \tvar deferredModules = [];\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"./\";\n\n \tvar jsonpArray = this[\"webpackJsonpstreamlit-html\"] = this[\"webpackJsonpstreamlit-html\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// run deferred modules from other chunks\n \tcheckDeferredModules();\n"],"sourceRoot":""}
|
|
|
|
st_bridge/html/package-lock.json
DELETED
The diff for this file is too large to render.
See raw diff
|
|
st_bridge/html/package.json
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "streamlit-html",
|
3 |
-
"version": "1.0.1",
|
4 |
-
"private": true,
|
5 |
-
"dependencies": {
|
6 |
-
"@testing-library/jest-dom": "^4.2.4",
|
7 |
-
"@testing-library/react": "^9.3.2",
|
8 |
-
"@testing-library/user-event": "^7.1.2",
|
9 |
-
"@types/jest": "^24.0.0",
|
10 |
-
"@types/node": "^12.0.0",
|
11 |
-
"react-scripts": "3.4.1",
|
12 |
-
"streamlit-component-lib": "^1.3.0",
|
13 |
-
"typescript": "~3.8.0"
|
14 |
-
},
|
15 |
-
"scripts": {
|
16 |
-
"start": "react-scripts start",
|
17 |
-
"build": "react-scripts build",
|
18 |
-
"test": "react-scripts test",
|
19 |
-
"eject": "react-scripts eject"
|
20 |
-
},
|
21 |
-
"eslintConfig": {
|
22 |
-
"extends": "react-app"
|
23 |
-
},
|
24 |
-
"browserslist": {
|
25 |
-
"production": [">0.2%", "not dead", "not op_mini all"],
|
26 |
-
"development": [
|
27 |
-
"last 1 chrome version",
|
28 |
-
"last 1 firefox version",
|
29 |
-
"last 1 safari version"
|
30 |
-
]
|
31 |
-
},
|
32 |
-
"homepage": "."
|
33 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/html/public/bootstrap.min.css
DELETED
The diff for this file is too large to render.
See raw diff
|
|
st_bridge/html/public/bootstrap.min.css.map
DELETED
The diff for this file is too large to render.
See raw diff
|
|
st_bridge/html/public/index.html
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
-
<html lang="en">
|
3 |
-
<head>
|
4 |
-
<title>Streamlit Component</title>
|
5 |
-
<meta charset="UTF-8" />
|
6 |
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
7 |
-
<meta name="theme-color" content="#000000" />
|
8 |
-
<meta name="description" content="Streamlit Component" />
|
9 |
-
<link rel="stylesheet" href="bootstrap.min.css" />
|
10 |
-
</head>
|
11 |
-
<body>
|
12 |
-
<noscript>You need to enable JavaScript to run this app.</noscript>
|
13 |
-
</body>
|
14 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/html/src/index.tsx
DELETED
@@ -1,70 +0,0 @@
|
|
1 |
-
import { Streamlit, RenderData } from "streamlit-component-lib";
|
2 |
-
|
3 |
-
const root = document.body.appendChild(document.createElement("div"));
|
4 |
-
|
5 |
-
let container: HTMLDivElement | null = null;
|
6 |
-
|
7 |
-
function getContainer() {
|
8 |
-
if (container !== null) return container;
|
9 |
-
|
10 |
-
const iframes = window.parent.document.getElementsByTagName("iframe");
|
11 |
-
for (let i = 0; i < iframes.length; i++) {
|
12 |
-
const iframe = iframes[i];
|
13 |
-
if (
|
14 |
-
(iframe.contentDocument || iframe.contentWindow?.document) === document
|
15 |
-
) {
|
16 |
-
container = iframe.parentElement! as HTMLDivElement;
|
17 |
-
}
|
18 |
-
}
|
19 |
-
|
20 |
-
if (container === null) {
|
21 |
-
console.error("Failed to identify the container of the HTML component");
|
22 |
-
}
|
23 |
-
|
24 |
-
return container;
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* The component's render function. This will be called immediately after
|
29 |
-
* the component is initially loaded, and then again every time the
|
30 |
-
* component gets new data from Python.
|
31 |
-
*/
|
32 |
-
function onRender(event: Event): void {
|
33 |
-
// Get the RenderData from the event
|
34 |
-
const data = (event as CustomEvent<RenderData>).detail;
|
35 |
-
|
36 |
-
const html = data.args["html"];
|
37 |
-
const iframe = data.args["iframe"];
|
38 |
-
|
39 |
-
if (iframe === true) {
|
40 |
-
root.innerHTML = html;
|
41 |
-
Streamlit.setFrameHeight();
|
42 |
-
|
43 |
-
return;
|
44 |
-
}
|
45 |
-
|
46 |
-
// not render inside iframe, we create a div sibling and render it there
|
47 |
-
const container = getContainer();
|
48 |
-
if (container === null) return;
|
49 |
-
|
50 |
-
if (container.lastElementChild!.tagName.toLowerCase() === "iframe") {
|
51 |
-
// need to create a new div to render the html
|
52 |
-
const div = window.parent.document.createElement("div");
|
53 |
-
container.appendChild(div);
|
54 |
-
// hide the iframe
|
55 |
-
(container.firstElementChild! as HTMLElement).style.display = "none";
|
56 |
-
}
|
57 |
-
|
58 |
-
container.lastElementChild!.innerHTML = html;
|
59 |
-
}
|
60 |
-
|
61 |
-
// Attach our `onRender` handler to Streamlit's render event.
|
62 |
-
Streamlit.events.addEventListener(Streamlit.RENDER_EVENT, onRender);
|
63 |
-
|
64 |
-
// Tell Streamlit we're ready to start receiving data. We won't get our
|
65 |
-
// first RENDER_EVENT until we call this function.
|
66 |
-
Streamlit.setComponentReady();
|
67 |
-
|
68 |
-
// Finally, tell Streamlit to update our initial height. We omit the
|
69 |
-
// `height` parameter here to have it default to our scrollHeight.
|
70 |
-
Streamlit.setFrameHeight();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/html/src/react-app-env.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
/// <reference types="react-scripts" />
|
|
|
|
st_bridge/html/tsconfig.json
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"compilerOptions": {
|
3 |
-
"target": "es5",
|
4 |
-
"lib": ["dom", "dom.iterable", "esnext"],
|
5 |
-
"allowJs": true,
|
6 |
-
"skipLibCheck": true,
|
7 |
-
"esModuleInterop": true,
|
8 |
-
"allowSyntheticDefaultImports": true,
|
9 |
-
"strict": true,
|
10 |
-
"forceConsistentCasingInFileNames": true,
|
11 |
-
"module": "esnext",
|
12 |
-
"moduleResolution": "node",
|
13 |
-
"resolveJsonModule": true,
|
14 |
-
"isolatedModules": true,
|
15 |
-
"noEmit": true,
|
16 |
-
"jsx": "react"
|
17 |
-
},
|
18 |
-
"include": ["src"]
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st_bridge/html/yarn.lock
DELETED
The diff for this file is too large to render.
See raw diff
|
|