Skip to content

Commit

Permalink
add new response mode feature
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzidanas committed May 14, 2024
1 parent 2607f82 commit 02d9a65
Show file tree
Hide file tree
Showing 946 changed files with 967 additions and 50 deletions.
5 changes: 3 additions & 2 deletions PUBLISHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
3. Run `npm run build` to build the frontend
4. Go out to the root directory (the one that contains `setup.py`)
5. Remove the old `dist`, `build`, and `streamlit_code_editor.egg-info` directories
6. Run `python setup.py sdist bdist_wheel` to generate new distribution files, build the project, and generate the wheel file
7. Run `twine upload dist/*` to upload the new version to PyPI. You will be prompted to enter your PyPI credentials.
6. Update the version in `setup.py`
7. Run `python setup.py sdist bdist_wheel` to generate new distribution files, build the project, and generate the wheel file
8. Run `twine upload dist/*` to upload the new version to PyPI. You will be prompted to enter your PyPI credentials.
a. The username is `__token__`
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.
6 changes: 3 additions & 3 deletions build/lib/code_editor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
# `declare_component` and call it done. The wrapper allows us to customize
# our component's API: we can pre-process its input args, post-process its
# output value, and add a docstring for users.
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):
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):
"""Create a new instance of "code_editor".
Parameters
Expand All @@ -70,7 +70,7 @@ def code_editor(code, lang='python', theme="default", shortcuts="vscode", height
#
# "default" is a special argument that specifies the initial return
# value of the component before the user has interacted with it.
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": ""})
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": ""})

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

input = st.text_area("Input:", demo_sample_python_code, height=200)
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")
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")

st.write(response_dict)

Expand Down
14 changes: 7 additions & 7 deletions build/lib/code_editor/frontend/build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"files": {
"main.js": "./static/js/main.11cf2390.chunk.js",
"main.js.map": "./static/js/main.11cf2390.chunk.js.map",
"main.js": "./static/js/main.a54db40e.chunk.js",
"main.js.map": "./static/js/main.a54db40e.chunk.js.map",
"runtime-main.js": "./static/js/runtime-main.ad47a231.js",
"runtime-main.js.map": "./static/js/runtime-main.ad47a231.js.map",
"static/js/2.753f37a1.chunk.js": "./static/js/2.753f37a1.chunk.js",
"static/js/2.753f37a1.chunk.js.map": "./static/js/2.753f37a1.chunk.js.map",
"static/js/2.7671c472.chunk.js": "./static/js/2.7671c472.chunk.js",
"static/js/2.7671c472.chunk.js.map": "./static/js/2.7671c472.chunk.js.map",
"mode-xml.js": "./01843025c65367159319c38263f48d04.js",
"mode-latte.js": "./0194846970eda6e0cefa23b927f08c6e.js",
"xquery.js": "./03325b4ae8405296dacf9ae05e26531f.js",
Expand Down Expand Up @@ -452,11 +452,11 @@
"ext-statusbar.js": "./fe64d890e7fa0c0beae6f2e7a96a7ede.js",
"verilog.js": "./ff8b71b1bce6feb81065d8340e07dfeb.js",
"index.html": "./index.html",
"static/js/2.753f37a1.chunk.js.LICENSE.txt": "./static/js/2.753f37a1.chunk.js.LICENSE.txt"
"static/js/2.7671c472.chunk.js.LICENSE.txt": "./static/js/2.7671c472.chunk.js.LICENSE.txt"
},
"entrypoints": [
"static/js/runtime-main.ad47a231.js",
"static/js/2.753f37a1.chunk.js",
"static/js/main.11cf2390.chunk.js"
"static/js/2.7671c472.chunk.js",
"static/js/main.a54db40e.chunk.js"
]
}
2 changes: 1 addition & 1 deletion build/lib/code_editor/frontend/build/index.html
Original file line number Diff line number Diff line change
@@ -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>
<!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>

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions code_editor/frontend/build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"files": {
"main.js": "./static/js/main.11cf2390.chunk.js",
"main.js.map": "./static/js/main.11cf2390.chunk.js.map",
"main.js": "./static/js/main.a54db40e.chunk.js",
"main.js.map": "./static/js/main.a54db40e.chunk.js.map",
"runtime-main.js": "./static/js/runtime-main.ad47a231.js",
"runtime-main.js.map": "./static/js/runtime-main.ad47a231.js.map",
"static/js/2.753f37a1.chunk.js": "./static/js/2.753f37a1.chunk.js",
"static/js/2.753f37a1.chunk.js.map": "./static/js/2.753f37a1.chunk.js.map",
"static/js/2.7671c472.chunk.js": "./static/js/2.7671c472.chunk.js",
"static/js/2.7671c472.chunk.js.map": "./static/js/2.7671c472.chunk.js.map",
"mode-xml.js": "./01843025c65367159319c38263f48d04.js",
"mode-latte.js": "./0194846970eda6e0cefa23b927f08c6e.js",
"xquery.js": "./03325b4ae8405296dacf9ae05e26531f.js",
Expand Down Expand Up @@ -452,11 +452,11 @@
"ext-statusbar.js": "./fe64d890e7fa0c0beae6f2e7a96a7ede.js",
"verilog.js": "./ff8b71b1bce6feb81065d8340e07dfeb.js",
"index.html": "./index.html",
"static/js/2.753f37a1.chunk.js.LICENSE.txt": "./static/js/2.753f37a1.chunk.js.LICENSE.txt"
"static/js/2.7671c472.chunk.js.LICENSE.txt": "./static/js/2.7671c472.chunk.js.LICENSE.txt"
},
"entrypoints": [
"static/js/runtime-main.ad47a231.js",
"static/js/2.753f37a1.chunk.js",
"static/js/main.11cf2390.chunk.js"
"static/js/2.7671c472.chunk.js",
"static/js/main.a54db40e.chunk.js"
]
}
2 changes: 1 addition & 1 deletion code_editor/frontend/build/index.html
Original file line number Diff line number Diff line change
@@ -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>
<!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>

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions code_editor/frontend/build/static/js/main.11cf2390.chunk.js

This file was deleted.

This file was deleted.

2 changes: 2 additions & 0 deletions code_editor/frontend/build/static/js/main.a54db40e.chunk.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit 02d9a65

Please sign in to comment.