Skip to content

Commit 02d9a65

Browse files
committed
add new response mode feature
1 parent 2607f82 commit 02d9a65

File tree

946 files changed

+967
-50
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

946 files changed

+967
-50
lines changed

PUBLISHING.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
3. Run `npm run build` to build the frontend
66
4. Go out to the root directory (the one that contains `setup.py`)
77
5. Remove the old `dist`, `build`, and `streamlit_code_editor.egg-info` directories
8-
6. Run `python setup.py sdist bdist_wheel` to generate new distribution files, build the project, and generate the wheel file
9-
7. Run `twine upload dist/*` to upload the new version to PyPI. You will be prompted to enter your PyPI credentials.
8+
6. Update the version in `setup.py`
9+
7. Run `python setup.py sdist bdist_wheel` to generate new distribution files, build the project, and generate the wheel file
10+
8. Run `twine upload dist/*` to upload the new version to PyPI. You will be prompted to enter your PyPI credentials.
1011
a. The username is `__token__`
1112
b. The password is the token generated by PyPI. If one has already been generated for this project, it is likely stored in secrets or hidden .env files.

build/lib/code_editor/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
# `declare_component` and call it done. The wrapper allows us to customize
4747
# our component's API: we can pre-process its input args, post-process its
4848
# output value, and add a docstring for users.
49-
def code_editor(code, lang='python', theme="default", shortcuts="vscode", height=30, focus=False, allow_reset=False, snippets=["", ""], keybindings={}, buttons=[], menu={}, info={}, options={}, props={}, editor_props={}, component_props={}, key=None):
49+
def code_editor(code, lang='python', theme="default", shortcuts="vscode", height=30, focus=False, allow_reset=False, response_mode="default", snippets=["", ""], keybindings={}, buttons=[], menu={}, info={}, options={}, props={}, editor_props={}, component_props={}, key=None):
5050
"""Create a new instance of "code_editor".
5151
5252
Parameters
@@ -70,7 +70,7 @@ def code_editor(code, lang='python', theme="default", shortcuts="vscode", height
7070
#
7171
# "default" is a special argument that specifies the initial return
7272
# value of the component before the user has interacted with it.
73-
component_value = _component_func(code=code, lang=lang, theme=theme, key=key, height=height, focus=focus, shortcuts=shortcuts, snippets=snippets, keybindings=keybindings, buttons=buttons, options=options, props=props, editor_props=editor_props, component_props=component_props, menu=menu, info=info, allow_reset=allow_reset, default={"id": "", "type": "", "text": "", "lang": "", "cursor": ""})
73+
component_value = _component_func(code=code, lang=lang, theme=theme, key=key, height=height, focus=focus, shortcuts=shortcuts, snippets=snippets, keybindings=keybindings, buttons=buttons, options=options, props=props, editor_props=editor_props, component_props=component_props, menu=menu, info=info, allow_reset=allow_reset, response_mode=response_mode, default={"id": "", "type": "", "lang": "", "text": "", "selected": "", "cursor": ""})
7474

7575
# We could modify the value returned from the component if we wanted.
7676
# There's no need to do this in our simple example - but it's an option.
@@ -172,7 +172,7 @@ def code_editor(code, lang='python', theme="default", shortcuts="vscode", height
172172
ace_props = {"style": {"borderRadius": "0px 0px 8px 8px"}}
173173

174174
input = st.text_area("Input:", demo_sample_python_code, height=200)
175-
response_dict = code_editor(input, height = height, lang=language, theme=theme, shortcuts=shortcuts, focus=focus, buttons=btns, info=info_bar, props=ace_props, options={"wrap": False}, allow_reset=True, key="code_editor_demo")
175+
response_dict = code_editor(input, height = height, lang=language, theme=theme, shortcuts=shortcuts, focus=focus, buttons=btns, info=info_bar, props=ace_props, options={"wrap": False}, allow_reset=True, response_mode=["debounce", "blur", "select"], key="code_editor_demo")
176176

177177
st.write(response_dict)
178178

build/lib/code_editor/frontend/build/asset-manifest.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"files": {
3-
"main.js": "./static/js/main.11cf2390.chunk.js",
4-
"main.js.map": "./static/js/main.11cf2390.chunk.js.map",
3+
"main.js": "./static/js/main.a54db40e.chunk.js",
4+
"main.js.map": "./static/js/main.a54db40e.chunk.js.map",
55
"runtime-main.js": "./static/js/runtime-main.ad47a231.js",
66
"runtime-main.js.map": "./static/js/runtime-main.ad47a231.js.map",
7-
"static/js/2.753f37a1.chunk.js": "./static/js/2.753f37a1.chunk.js",
8-
"static/js/2.753f37a1.chunk.js.map": "./static/js/2.753f37a1.chunk.js.map",
7+
"static/js/2.7671c472.chunk.js": "./static/js/2.7671c472.chunk.js",
8+
"static/js/2.7671c472.chunk.js.map": "./static/js/2.7671c472.chunk.js.map",
99
"mode-xml.js": "./01843025c65367159319c38263f48d04.js",
1010
"mode-latte.js": "./0194846970eda6e0cefa23b927f08c6e.js",
1111
"xquery.js": "./03325b4ae8405296dacf9ae05e26531f.js",
@@ -452,11 +452,11 @@
452452
"ext-statusbar.js": "./fe64d890e7fa0c0beae6f2e7a96a7ede.js",
453453
"verilog.js": "./ff8b71b1bce6feb81065d8340e07dfeb.js",
454454
"index.html": "./index.html",
455-
"static/js/2.753f37a1.chunk.js.LICENSE.txt": "./static/js/2.753f37a1.chunk.js.LICENSE.txt"
455+
"static/js/2.7671c472.chunk.js.LICENSE.txt": "./static/js/2.7671c472.chunk.js.LICENSE.txt"
456456
},
457457
"entrypoints": [
458458
"static/js/runtime-main.ad47a231.js",
459-
"static/js/2.753f37a1.chunk.js",
460-
"static/js/main.11cf2390.chunk.js"
459+
"static/js/2.7671c472.chunk.js",
460+
"static/js/main.a54db40e.chunk.js"
461461
]
462462
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
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><div id="root"></div><script>!function(e){function t(t){for(var n,i,l=t[0],a=t[1],f=t[2],p=0,s=[];p<l.length;p++)i=l[p],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(c&&c(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,l=1;l<r.length;l++){var a=r[l];0!==o[a]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},u=[];function i(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,i),r.l=!0,r.exports}i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="./";var l=this["webpackJsonpstreamlit-code-editor"]=this["webpackJsonpstreamlit-code-editor"]||[],a=l.push.bind(l);l.push=t,l=l.slice();for(var f=0;f<l.length;f++)t(l[f]);var c=a;r()}([])</script><script src="./static/js/2.753f37a1.chunk.js"></script><script src="./static/js/main.11cf2390.chunk.js"></script></body></html>
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><div id="root"></div><script>!function(e){function t(t){for(var n,i,l=t[0],a=t[1],f=t[2],p=0,s=[];p<l.length;p++)i=l[p],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(c&&c(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,l=1;l<r.length;l++){var a=r[l];0!==o[a]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},u=[];function i(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,i),r.l=!0,r.exports}i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="./";var l=this["webpackJsonpstreamlit-code-editor"]=this["webpackJsonpstreamlit-code-editor"]||[],a=l.push.bind(l);l.push=t,l=l.slice();for(var f=0;f<l.length;f++)t(l[f]);var c=a;r()}([])</script><script src="./static/js/2.7671c472.chunk.js"></script><script src="./static/js/main.a54db40e.chunk.js"></script></body></html>

build/lib/code_editor/frontend/build/static/js/2.753f37a1.chunk.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

build/lib/code_editor/frontend/build/static/js/2.753f37a1.chunk.js renamed to build/lib/code_editor/frontend/build/static/js/2.7671c472.chunk.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/lib/code_editor/frontend/build/static/js/2.7671c472.chunk.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/lib/code_editor/frontend/build/static/js/main.11cf2390.chunk.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

build/lib/code_editor/frontend/build/static/js/main.11cf2390.chunk.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

build/lib/code_editor/frontend/build/static/js/main.a54db40e.chunk.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/lib/code_editor/frontend/build/static/js/main.a54db40e.chunk.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code_editor/frontend/build/asset-manifest.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"files": {
3-
"main.js": "./static/js/main.11cf2390.chunk.js",
4-
"main.js.map": "./static/js/main.11cf2390.chunk.js.map",
3+
"main.js": "./static/js/main.a54db40e.chunk.js",
4+
"main.js.map": "./static/js/main.a54db40e.chunk.js.map",
55
"runtime-main.js": "./static/js/runtime-main.ad47a231.js",
66
"runtime-main.js.map": "./static/js/runtime-main.ad47a231.js.map",
7-
"static/js/2.753f37a1.chunk.js": "./static/js/2.753f37a1.chunk.js",
8-
"static/js/2.753f37a1.chunk.js.map": "./static/js/2.753f37a1.chunk.js.map",
7+
"static/js/2.7671c472.chunk.js": "./static/js/2.7671c472.chunk.js",
8+
"static/js/2.7671c472.chunk.js.map": "./static/js/2.7671c472.chunk.js.map",
99
"mode-xml.js": "./01843025c65367159319c38263f48d04.js",
1010
"mode-latte.js": "./0194846970eda6e0cefa23b927f08c6e.js",
1111
"xquery.js": "./03325b4ae8405296dacf9ae05e26531f.js",
@@ -452,11 +452,11 @@
452452
"ext-statusbar.js": "./fe64d890e7fa0c0beae6f2e7a96a7ede.js",
453453
"verilog.js": "./ff8b71b1bce6feb81065d8340e07dfeb.js",
454454
"index.html": "./index.html",
455-
"static/js/2.753f37a1.chunk.js.LICENSE.txt": "./static/js/2.753f37a1.chunk.js.LICENSE.txt"
455+
"static/js/2.7671c472.chunk.js.LICENSE.txt": "./static/js/2.7671c472.chunk.js.LICENSE.txt"
456456
},
457457
"entrypoints": [
458458
"static/js/runtime-main.ad47a231.js",
459-
"static/js/2.753f37a1.chunk.js",
460-
"static/js/main.11cf2390.chunk.js"
459+
"static/js/2.7671c472.chunk.js",
460+
"static/js/main.a54db40e.chunk.js"
461461
]
462462
}

code_editor/frontend/build/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
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><div id="root"></div><script>!function(e){function t(t){for(var n,i,l=t[0],a=t[1],f=t[2],p=0,s=[];p<l.length;p++)i=l[p],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(c&&c(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,l=1;l<r.length;l++){var a=r[l];0!==o[a]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},u=[];function i(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,i),r.l=!0,r.exports}i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="./";var l=this["webpackJsonpstreamlit-code-editor"]=this["webpackJsonpstreamlit-code-editor"]||[],a=l.push.bind(l);l.push=t,l=l.slice();for(var f=0;f<l.length;f++)t(l[f]);var c=a;r()}([])</script><script src="./static/js/2.753f37a1.chunk.js"></script><script src="./static/js/main.11cf2390.chunk.js"></script></body></html>
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><div id="root"></div><script>!function(e){function t(t){for(var n,i,l=t[0],a=t[1],f=t[2],p=0,s=[];p<l.length;p++)i=l[p],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(c&&c(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,l=1;l<r.length;l++){var a=r[l];0!==o[a]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},u=[];function i(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,i),r.l=!0,r.exports}i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="./";var l=this["webpackJsonpstreamlit-code-editor"]=this["webpackJsonpstreamlit-code-editor"]||[],a=l.push.bind(l);l.push=t,l=l.slice();for(var f=0;f<l.length;f++)t(l[f]);var c=a;r()}([])</script><script src="./static/js/2.7671c472.chunk.js"></script><script src="./static/js/main.a54db40e.chunk.js"></script></body></html>

code_editor/frontend/build/static/js/2.753f37a1.chunk.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

code_editor/frontend/build/static/js/2.753f37a1.chunk.js renamed to code_editor/frontend/build/static/js/2.7671c472.chunk.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code_editor/frontend/build/static/js/2.7671c472.chunk.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code_editor/frontend/build/static/js/main.11cf2390.chunk.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

code_editor/frontend/build/static/js/main.11cf2390.chunk.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

code_editor/frontend/build/static/js/main.a54db40e.chunk.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code_editor/frontend/build/static/js/main.a54db40e.chunk.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)