@pyscript/core 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.js +3 -3
- package/dist/core.js.map +1 -1
- package/dist/deprecations-manager-uwH5iaZ9.js +2 -0
- package/dist/deprecations-manager-uwH5iaZ9.js.map +1 -0
- package/dist/{py-terminal-FUkJ18FU.js → py-terminal-XWbSa71s.js} +2 -2
- package/dist/py-terminal-XWbSa71s.js.map +1 -0
- package/package.json +6 -6
- package/src/3rd-party/codemirror.js +1 -0
- package/src/3rd-party/codemirror_commands.js +1 -0
- package/src/3rd-party/codemirror_lang-python.js +1 -0
- package/src/3rd-party/codemirror_language.js +1 -0
- package/src/3rd-party/codemirror_state.js +1 -0
- package/src/3rd-party/codemirror_view.js +1 -0
- package/src/hooks.js +14 -1
- package/src/plugins/deprecations-manager.js +27 -0
- package/src/plugins/py-terminal.js +0 -8
- package/src/plugins.js +1 -0
- package/src/stdlib/pyscript.js +1 -1
- package/src/stdlib/pyweb/pydom.py +2 -7
- package/types/plugins/deprecations-manager.d.ts +1 -0
- package/types/plugins.d.ts +1 -0
- package/dist/py-terminal-FUkJ18FU.js.map +0 -1
@@ -0,0 +1,2 @@
|
|
1
|
+
import{hooks as o}from"./core.js";import{notify as e}from"./error-96hMSEw8.js";function r(){const o=document.querySelectorAll("script");for(const e of o)s(e.src)}function s(o){/\/pyscript\.net\/latest/.test(o)&&e("Loading scripts from latest is deprecated and will be removed soon. Please use a specific version instead.")}o.main.onReady.add(r),o.main.onWorker.add(r);
|
2
|
+
//# sourceMappingURL=deprecations-manager-uwH5iaZ9.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"deprecations-manager-uwH5iaZ9.js","sources":["../src/plugins/deprecations-manager.js"],"sourcesContent":["// PyScript Derepcations Plugin\nimport { hooks } from \"../core.js\";\nimport { notify } from \"./error.js\";\n\n// react lazily on PyScript bootstrap\nhooks.main.onReady.add(checkDeprecations);\nhooks.main.onWorker.add(checkDeprecations);\n\n/**\n * Check that there are no scripts loading from pyscript.net/latest\n */\nfunction checkDeprecations() {\n const scripts = document.querySelectorAll(\"script\");\n for (const script of scripts) checkLoadingScriptsFromLatest(script.src);\n}\n\n/**\n * Check if src being loaded from pyscript.net/latest and display a notification if true\n * * @param {string} src\n */\nfunction checkLoadingScriptsFromLatest(src) {\n if (/\\/pyscript\\.net\\/latest/.test(src)) {\n notify(\n \"Loading scripts from latest is deprecated and will be removed soon. Please use a specific version instead.\",\n );\n }\n}\n"],"names":["checkDeprecations","scripts","document","querySelectorAll","script","checkLoadingScriptsFromLatest","src","test","notify","hooks","main","onReady","add","onWorker"],"mappings":"+EAWA,SAASA,IACL,MAAMC,EAAUC,SAASC,iBAAiB,UAC1C,IAAK,MAAMC,KAAUH,EAASI,EAA8BD,EAAOE,IACvE,CAMA,SAASD,EAA8BC,GAC/B,0BAA0BC,KAAKD,IAC/BE,EACI,6GAGZ,CArBAC,EAAMC,KAAKC,QAAQC,IAAIZ,GACvBS,EAAMC,KAAKG,SAASD,IAAIZ"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{TYPES as e,hooks as t}from"./core.js";import{notify as r}from"./error-96hMSEw8.js";const n=[...e.keys()].map((e=>`script[type="${e}"][terminal],${e}-script[terminal]`)).join(","),o=e=>{throw r(e),new Error(e)},i=async()=>{const e=document.querySelectorAll(n);if(!e.length)return;s.disconnect(),e.length>1&&o("You can use at most 1 terminal.");const[r]=e;r.matches('script[type="mpy"],mpy-script')&&o("Unsupported terminal."),document.head.append(Object.assign(document.createElement("link"),{rel:"stylesheet",href:new URL("./xterm.css",import.meta.url)}));const[{Terminal:i},{Readline:a}]=await Promise.all([import("./xterm-f2QfYNGL.js"),import("./xterm-readline-ONk85xtH.js")]),d=new a,
|
2
|
-
//# sourceMappingURL=py-terminal-
|
1
|
+
import{TYPES as e,hooks as t}from"./core.js";import{notify as r}from"./error-96hMSEw8.js";const n=[...e.keys()].map((e=>`script[type="${e}"][terminal],${e}-script[terminal]`)).join(","),o=e=>{throw r(e),new Error(e)},i=async()=>{const e=document.querySelectorAll(n);if(!e.length)return;s.disconnect(),e.length>1&&o("You can use at most 1 terminal.");const[r]=e;r.matches('script[type="mpy"],mpy-script')&&o("Unsupported terminal."),document.head.append(Object.assign(document.createElement("link"),{rel:"stylesheet",href:new URL("./xterm.css",import.meta.url)}));const[{Terminal:i},{Readline:a}]=await Promise.all([import("./xterm-f2QfYNGL.js"),import("./xterm-readline-ONk85xtH.js")]),d=new a,l=e=>{let t=r;const n=r.getAttribute("target");if(n){if(t=document.getElementById(n)||document.querySelector(n),!t)throw new Error(`Unknown target ${n}`)}else t=document.createElement("py-terminal"),t.style.display="block",r.after(t);const o=new i({theme:{background:"#191A19",foreground:"#F5F2E7"},...e});o.loadAddon(d),o.open(t),o.focus()};if(r.hasAttribute("worker")){const e=({interpreter:e},{sync:t})=>{t.pyterminal_drop_hooks();const r=new TextDecoder;let n="";const o={isatty:!0,write:e=>(n=r.decode(e),t.pyterminal_write(n),e.length)};e.setStdout(o),e.setStderr(o),e.setStdin({isatty:!0,stdin:()=>t.pyterminal_read(n)})};t.main.onWorker.add((function r(n,o){t.main.onWorker.delete(r),l({disableStdin:!1,cursorBlink:!0,cursorStyle:"block"}),o.sync.pyterminal_read=d.read.bind(d),o.sync.pyterminal_write=d.write.bind(d),o.sync.pyterminal_drop_hooks=()=>{t.worker.onReady.delete(e)}})),t.worker.onReady.add(e)}else t.main.onReady.add((function e({io:r}){console.warn("py-terminal is read only on main thread"),t.main.onReady.delete(e),l({disableStdin:!0,cursorBlink:!1,cursorStyle:"underline"}),r.stdout=e=>{d.write(`${e}\n`)},r.stderr=e=>{d.write(`${e.message||e}\n`)}}))},s=new MutationObserver(i);s.observe(document,{childList:!0,subtree:!0});var a=i();export{a as default};
|
2
|
+
//# sourceMappingURL=py-terminal-XWbSa71s.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"py-terminal-XWbSa71s.js","sources":["../src/plugins/py-terminal.js"],"sourcesContent":["// PyScript py-terminal plugin\nimport { TYPES, hooks } from \"../core.js\";\nimport { notify } from \"./error.js\";\n\nconst SELECTOR = [...TYPES.keys()]\n .map((type) => `script[type=\"${type}\"][terminal],${type}-script[terminal]`)\n .join(\",\");\n\n// show the error on main and\n// stops the module from keep executing\nconst notifyAndThrow = (message) => {\n notify(message);\n throw new Error(message);\n};\n\nconst pyTerminal = async () => {\n const terminals = document.querySelectorAll(SELECTOR);\n\n // no results will look further for runtime nodes\n if (!terminals.length) return;\n\n // if we arrived this far, let's drop the MutationObserver\n // as we only support one terminal per page (right now).\n mo.disconnect();\n\n // we currently support only one terminal as in \"classic\"\n if (terminals.length > 1) notifyAndThrow(\"You can use at most 1 terminal.\");\n\n const [element] = terminals;\n // hopefully to be removed in the near future!\n if (element.matches('script[type=\"mpy\"],mpy-script'))\n notifyAndThrow(\"Unsupported terminal.\");\n\n // import styles lazily\n document.head.append(\n Object.assign(document.createElement(\"link\"), {\n rel: \"stylesheet\",\n href: new URL(\"./xterm.css\", import.meta.url),\n }),\n );\n\n // lazy load these only when a valid terminal is found\n const [{ Terminal }, { Readline }] = await Promise.all([\n import(/* webpackIgnore: true */ \"../3rd-party/xterm.js\"),\n import(/* webpackIgnore: true */ \"../3rd-party/xterm-readline.js\"),\n ]);\n\n const readline = new Readline();\n\n // common main thread initialization for both worker\n // or main case, bootstrapping the terminal on its target\n const init = (options) => {\n let target = element;\n const selector = element.getAttribute(\"target\");\n if (selector) {\n target =\n document.getElementById(selector) ||\n document.querySelector(selector);\n if (!target) throw new Error(`Unknown target ${selector}`);\n } else {\n target = document.createElement(\"py-terminal\");\n target.style.display = \"block\";\n element.after(target);\n }\n const terminal = new Terminal({\n theme: {\n background: \"#191A19\",\n foreground: \"#F5F2E7\",\n },\n ...options,\n });\n terminal.loadAddon(readline);\n terminal.open(target);\n terminal.focus();\n };\n\n // branch logic for the worker\n if (element.hasAttribute(\"worker\")) {\n // when the remote thread onReady triggers:\n // setup the interpreter stdout and stderr\n const workerReady = ({ interpreter }, { sync }) => {\n sync.pyterminal_drop_hooks();\n const decoder = new TextDecoder();\n let data = \"\";\n const generic = {\n isatty: true,\n write(buffer) {\n data = decoder.decode(buffer);\n sync.pyterminal_write(data);\n return buffer.length;\n },\n };\n interpreter.setStdout(generic);\n interpreter.setStderr(generic);\n interpreter.setStdin({\n isatty: true,\n stdin: () => sync.pyterminal_read(data),\n });\n };\n\n // add a hook on the main thread to setup all sync helpers\n // also bootstrapping the XTerm target on main\n hooks.main.onWorker.add(function worker(_, xworker) {\n hooks.main.onWorker.delete(worker);\n init({\n disableStdin: false,\n cursorBlink: true,\n cursorStyle: \"block\",\n });\n xworker.sync.pyterminal_read = readline.read.bind(readline);\n xworker.sync.pyterminal_write = readline.write.bind(readline);\n // allow a worker to drop main thread hooks ASAP\n xworker.sync.pyterminal_drop_hooks = () => {\n hooks.worker.onReady.delete(workerReady);\n };\n });\n\n // setup remote thread JS/Python code for whenever the\n // worker is ready to become a terminal\n hooks.worker.onReady.add(workerReady);\n } else {\n // in the main case, just bootstrap XTerm without\n // allowing any input as that's not possible / awkward\n hooks.main.onReady.add(function main({ io }) {\n console.warn(\"py-terminal is read only on main thread\");\n hooks.main.onReady.delete(main);\n init({\n disableStdin: true,\n cursorBlink: false,\n cursorStyle: \"underline\",\n });\n io.stdout = (value) => {\n readline.write(`${value}\\n`);\n };\n io.stderr = (error) => {\n readline.write(`${error.message || error}\\n`);\n };\n });\n }\n};\n\nconst mo = new MutationObserver(pyTerminal);\nmo.observe(document, { childList: true, subtree: true });\n\n// try to check the current document ASAP\nexport default pyTerminal();\n"],"names":["SELECTOR","TYPES","keys","map","type","join","notifyAndThrow","message","notify","Error","pyTerminal","async","terminals","document","querySelectorAll","length","mo","disconnect","element","matches","head","append","Object","assign","createElement","rel","href","URL","url","Terminal","Readline","Promise","all","import","readline","init","options","target","selector","getAttribute","getElementById","querySelector","style","display","after","terminal","theme","background","foreground","loadAddon","open","focus","hasAttribute","workerReady","interpreter","sync","pyterminal_drop_hooks","decoder","TextDecoder","data","generic","isatty","write","buffer","decode","pyterminal_write","setStdout","setStderr","setStdin","stdin","pyterminal_read","hooks","main","onWorker","add","worker","_","xworker","delete","disableStdin","cursorBlink","cursorStyle","read","bind","onReady","io","console","warn","stdout","value","stderr","error","MutationObserver","observe","childList","subtree","pyTerminal$1"],"mappings":"0FAIA,MAAMA,EAAW,IAAIC,EAAMC,QACtBC,KAAKC,GAAS,gBAAgBA,iBAAoBA,uBAClDC,KAAK,KAIJC,EAAkBC,IAEpB,MADAC,EAAOD,GACD,IAAIE,MAAMF,EAAQ,EAGtBG,EAAaC,UACf,MAAMC,EAAYC,SAASC,iBAAiBd,GAG5C,IAAKY,EAAUG,OAAQ,OAIvBC,EAAGC,aAGCL,EAAUG,OAAS,GAAGT,EAAe,mCAEzC,MAAOY,GAAWN,EAEdM,EAAQC,QAAQ,kCAChBb,EAAe,yBAGnBO,SAASO,KAAKC,OACVC,OAAOC,OAAOV,SAASW,cAAc,QAAS,CAC1CC,IAAK,aACLC,KAAM,IAAIC,IAAI,0BAA2BC,QAKjD,OAAOC,SAAEA,IAAYC,SAAEA,UAAoBC,QAAQC,IAAI,CACnDC,OAAiC,uBACjCA,OAAiC,kCAG/BC,EAAW,IAAIJ,EAIfK,EAAQC,IACV,IAAIC,EAASnB,EACb,MAAMoB,EAAWpB,EAAQqB,aAAa,UACtC,GAAID,GAIA,GAHAD,EACIxB,SAAS2B,eAAeF,IACxBzB,SAAS4B,cAAcH,IACtBD,EAAQ,MAAM,IAAI5B,MAAM,kBAAkB6B,UAE/CD,EAASxB,SAASW,cAAc,eAChCa,EAAOK,MAAMC,QAAU,QACvBzB,EAAQ0B,MAAMP,GAElB,MAAMQ,EAAW,IAAIhB,EAAS,CAC1BiB,MAAO,CACHC,WAAY,UACZC,WAAY,cAEbZ,IAEPS,EAASI,UAAUf,GACnBW,EAASK,KAAKb,GACdQ,EAASM,OAA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
1
|
{
|
2
2
|
"name": "@pyscript/core",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.5",
|
4
4
|
"type": "module",
|
5
5
|
"description": "PyScript",
|
6
6
|
"module": "./index.js",
|
@@ -41,24 +41,24 @@
|
|
41
41
|
"dependencies": {
|
42
42
|
"@ungap/with-resolvers": "^0.1.0",
|
43
43
|
"basic-devtools": "^0.1.6",
|
44
|
-
"polyscript": "^0.
|
44
|
+
"polyscript": "^0.6.0",
|
45
45
|
"sticky-module": "^0.1.1",
|
46
46
|
"to-json-callback": "^0.1.1",
|
47
47
|
"type-checked-collections": "^0.1.7"
|
48
48
|
},
|
49
49
|
"devDependencies": {
|
50
|
-
"@playwright/test": "^1.
|
50
|
+
"@playwright/test": "^1.40.0",
|
51
51
|
"@rollup/plugin-commonjs": "^25.0.7",
|
52
52
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
53
53
|
"@rollup/plugin-terser": "^0.4.4",
|
54
54
|
"@webreflection/toml-j0.4": "^1.1.3",
|
55
55
|
"chokidar": "^3.5.3",
|
56
|
-
"eslint": "^8.
|
57
|
-
"rollup": "^4.
|
56
|
+
"eslint": "^8.54.0",
|
57
|
+
"rollup": "^4.5.1",
|
58
58
|
"rollup-plugin-postcss": "^4.0.2",
|
59
59
|
"rollup-plugin-string": "^3.0.0",
|
60
60
|
"static-handler": "^0.4.3",
|
61
|
-
"typescript": "^5.
|
61
|
+
"typescript": "^5.3.2",
|
62
62
|
"xterm": "^5.3.0",
|
63
63
|
"xterm-readline": "^1.1.1"
|
64
64
|
},
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "codemirror";
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "@codemirror/commands";
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "@codemirror/lang-python";
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "@codemirror/language";
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "@codemirror/state";
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "@codemirror/view";
|
package/src/hooks.js
CHANGED
@@ -45,6 +45,19 @@ export const createFunction = (self, name) => {
|
|
45
45
|
const SetFunction = typedSet({ typeof: "function" });
|
46
46
|
const SetString = typedSet({ typeof: "string" });
|
47
47
|
|
48
|
+
const inputFailure = `
|
49
|
+
import builtins
|
50
|
+
def input(prompt=""):
|
51
|
+
raise Exception("\\n ".join([
|
52
|
+
"input() doesn't work when PyScript runs in the main thread.",
|
53
|
+
"Consider using the worker attribute: https://docs.pyscript.net/2023.11.1/user-guide/workers/"
|
54
|
+
]))
|
55
|
+
|
56
|
+
builtins.input = input
|
57
|
+
del builtins
|
58
|
+
del input
|
59
|
+
`;
|
60
|
+
|
48
61
|
export const hooks = {
|
49
62
|
main: {
|
50
63
|
/** @type {Set<function>} */
|
@@ -60,7 +73,7 @@ export const hooks = {
|
|
60
73
|
/** @type {Set<function>} */
|
61
74
|
onAfterRunAsync: new SetFunction(),
|
62
75
|
/** @type {Set<string>} */
|
63
|
-
codeBeforeRun: new SetString(),
|
76
|
+
codeBeforeRun: new SetString([inputFailure]),
|
64
77
|
/** @type {Set<string>} */
|
65
78
|
codeBeforeRunAsync: new SetString(),
|
66
79
|
/** @type {Set<string>} */
|
@@ -0,0 +1,27 @@
|
|
1
|
+
// PyScript Derepcations Plugin
|
2
|
+
import { hooks } from "../core.js";
|
3
|
+
import { notify } from "./error.js";
|
4
|
+
|
5
|
+
// react lazily on PyScript bootstrap
|
6
|
+
hooks.main.onReady.add(checkDeprecations);
|
7
|
+
hooks.main.onWorker.add(checkDeprecations);
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Check that there are no scripts loading from pyscript.net/latest
|
11
|
+
*/
|
12
|
+
function checkDeprecations() {
|
13
|
+
const scripts = document.querySelectorAll("script");
|
14
|
+
for (const script of scripts) checkLoadingScriptsFromLatest(script.src);
|
15
|
+
}
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Check if src being loaded from pyscript.net/latest and display a notification if true
|
19
|
+
* * @param {string} src
|
20
|
+
*/
|
21
|
+
function checkLoadingScriptsFromLatest(src) {
|
22
|
+
if (/\/pyscript\.net\/latest/.test(src)) {
|
23
|
+
notify(
|
24
|
+
"Loading scripts from latest is deprecated and will be removed soon. Please use a specific version instead.",
|
25
|
+
);
|
26
|
+
}
|
27
|
+
}
|
@@ -98,12 +98,6 @@ const pyTerminal = async () => {
|
|
98
98
|
});
|
99
99
|
};
|
100
100
|
|
101
|
-
// at the end of the code, make the terminal interactive
|
102
|
-
const codeAfter = `
|
103
|
-
import code as _code
|
104
|
-
_code.interact()
|
105
|
-
`;
|
106
|
-
|
107
101
|
// add a hook on the main thread to setup all sync helpers
|
108
102
|
// also bootstrapping the XTerm target on main
|
109
103
|
hooks.main.onWorker.add(function worker(_, xworker) {
|
@@ -118,14 +112,12 @@ const pyTerminal = async () => {
|
|
118
112
|
// allow a worker to drop main thread hooks ASAP
|
119
113
|
xworker.sync.pyterminal_drop_hooks = () => {
|
120
114
|
hooks.worker.onReady.delete(workerReady);
|
121
|
-
hooks.worker.codeAfterRun.delete(codeAfter);
|
122
115
|
};
|
123
116
|
});
|
124
117
|
|
125
118
|
// setup remote thread JS/Python code for whenever the
|
126
119
|
// worker is ready to become a terminal
|
127
120
|
hooks.worker.onReady.add(workerReady);
|
128
|
-
hooks.worker.codeAfterRun.add(codeAfter);
|
129
121
|
} else {
|
130
122
|
// in the main case, just bootstrap XTerm without
|
131
123
|
// allowing any input as that's not possible / awkward
|
package/src/plugins.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
// ⚠️ This file is an artifact: DO NOT MODIFY
|
2
2
|
export default {
|
3
|
+
["deprecations-manager"]: () => import(/* webpackIgnore: true */ "./plugins/deprecations-manager.js"),
|
3
4
|
error: () => import(/* webpackIgnore: true */ "./plugins/error.js"),
|
4
5
|
["py-terminal"]: () => import(/* webpackIgnore: true */ "./plugins/py-terminal.js"),
|
5
6
|
};
|
package/src/stdlib/pyscript.js
CHANGED
@@ -8,6 +8,6 @@ export default {
|
|
8
8
|
"util.py": "class NotSupported:\n \"\"\"\n Small helper that raises exceptions if you try to get/set any attribute on\n it.\n \"\"\"\n\n def __init__(self, name, error):\n object.__setattr__(self, \"name\", name)\n object.__setattr__(self, \"error\", error)\n\n def __repr__(self):\n return f\"<NotSupported {self.name} [{self.error}]>\"\n\n def __getattr__(self, attr):\n raise AttributeError(self.error)\n\n def __setattr__(self, attr, value):\n raise AttributeError(self.error)\n\n def __call__(self, *args):\n raise TypeError(self.error)\n"
|
9
9
|
},
|
10
10
|
"pyweb": {
|
11
|
-
"pydom.py": "import sys\nimport warnings\nfrom functools import cached_property\nfrom typing import Any\n\nfrom pyodide.ffi import JsProxy\nfrom pyscript import display, document, window\n\n# from pyscript import when as _when\n\nalert = window.alert\n\n\nclass BaseElement:\n def __init__(self, js_element):\n self._js = js_element\n self._parent = None\n self.style = StyleProxy(self)\n\n def __eq__(self, obj):\n \"\"\"Check if the element is the same as the other element by comparing\n the underlying JS element\"\"\"\n return isinstance(obj, BaseElement) and obj._js == self._js\n\n @property\n def parent(self):\n if self._parent:\n return self._parent\n\n if self._js.parentElement:\n self._parent = self.__class__(self._js.parentElement)\n\n return self._parent\n\n @property\n def __class(self):\n return self.__class__ if self.__class__ != PyDom else Element\n\n def create(self, type_, is_child=True, classes=None, html=None, label=None):\n js_el = document.createElement(type_)\n element = self.__class(js_el)\n\n if classes:\n for class_ in classes:\n element.add_class(class_)\n\n if html is not None:\n element.html = html\n\n if label is not None:\n element.label = label\n\n if is_child:\n self.append(element)\n\n return element\n\n def find(self, selector):\n \"\"\"Return an ElementCollection representing all the child elements that\n match the specified selector.\n\n Args:\n selector (str): A string containing a selector expression\n\n Returns:\n ElementCollection: A collection of elements matching the selector\n \"\"\"\n elements = self._js.querySelectorAll(selector)\n if not elements:\n return None\n return ElementCollection([Element(el) for el in elements])\n\n\nclass Element(BaseElement):\n @property\n def children(self):\n return [self.__class__(el) for el in self._js.children]\n\n def append(self, child):\n # TODO: this is Pyodide specific for now!!!!!!\n # if we get passed a JSProxy Element directly we just map it to the\n # higher level Python element\n if isinstance(child, JsProxy):\n return self.append(Element(child))\n\n elif isinstance(child, Element):\n self._js.appendChild(child._js)\n\n return child\n\n elif isinstance(child, ElementCollection):\n for el in child:\n self.append(el)\n\n # -------- Pythonic Interface to Element -------- #\n @property\n def html(self):\n return self._js.innerHTML\n\n @html.setter\n def html(self, value):\n self._js.innerHTML = value\n\n @property\n def content(self):\n # TODO: This breaks with with standard template elements. Define how to best\n # handle this specifica use case. Just not support for now?\n if self._js.tagName == \"TEMPLATE\":\n warnings.warn(\n \"Content attribute not supported for template elements.\", stacklevel=2\n )\n return None\n return self._js.innerHTML\n\n @content.setter\n def content(self, value):\n # TODO: (same comment as above)\n if self._js.tagName == \"TEMPLATE\":\n warnings.warn(\n \"Content attribute not supported for template elements.\", stacklevel=2\n )\n return\n\n display(value, target=self.id)\n\n @property\n def id(self):\n return self._js.id\n\n @id.setter\n def id(self, value):\n self._js.id = value\n\n @property\n def value(self):\n return self._js.value\n\n @value.setter\n def value(self, value):\n # in order to avoid confusion to the user, we don't allow setting the\n # value of elements that don't have a value attribute\n if not hasattr(self._js, \"value\"):\n raise AttributeError(\n f\"Element {self._js.tagName} has no value attribute. If you want to \"\n \"force a value attribute, set it directly using the `_js.value = <value>` \"\n \"javascript API attribute instead.\"\n )\n self._js.value = value\n\n def clone(self, new_id=None):\n clone = Element(self._js.cloneNode(True))\n clone.id = new_id\n\n return clone\n\n def remove_class(self, classname):\n classList = self._js.classList\n if isinstance(classname, list):\n classList.remove(*classname)\n else:\n classList.remove(classname)\n return self\n\n def add_class(self, classname):\n classList = self._js.classList\n if isinstance(classname, list):\n classList.add(*classname)\n else:\n self._js.classList.add(classname)\n return self\n\n @property\n def classes(self):\n classes = self._js.classList.values()\n return [x for x in classes]\n\n def show_me(self):\n self._js.scrollIntoView()\n\n def when(self, event, handler):\n document.when(event, selector=self)(handler)\n\n\nclass StyleProxy(dict):\n def __init__(self, element: Element) -> None:\n self._element = element\n\n @cached_property\n def _style(self):\n return self._element._js.style\n\n def __getitem__(self, key):\n return self._style.getPropertyValue(key)\n\n def __setitem__(self, key, value):\n self._style.setProperty(key, value)\n\n def remove(self, key):\n self._style.removeProperty(key)\n\n def set(self, **kws):\n for k, v in kws.items():\n self._element._js.style.setProperty(k, v)\n\n # CSS Properties\n # Reference: https://github.com/microsoft/TypeScript/blob/main/src/lib/dom.generated.d.ts#L3799C1-L5005C2\n # Following prperties automatically generated from the above reference using\n # tools/codegen_css_proxy.py\n @property\n def visible(self):\n return self._element._js.style.visibility\n\n @visible.setter\n def visible(self, value):\n self._element._js.style.visibility = value\n\n\nclass StyleCollection:\n def __init__(self, collection: \"ElementCollection\") -> None:\n self._collection = collection\n\n def __get__(self, obj, objtype=None):\n return obj._get_attribute(\"style\")\n\n def __getitem__(self, key):\n return self._collection._get_attribute(\"style\")[key]\n\n def __setitem__(self, key, value):\n for element in self._collection._elements:\n element.style[key] = value\n\n def remove(self, key):\n for element in self._collection._elements:\n element.style.remove(key)\n\n\nclass ElementCollection:\n def __init__(self, elements: [Element]) -> None:\n self._elements = elements\n self.style = StyleCollection(self)\n\n def __getitem__(self, key):\n # If it's an integer we use it to access the elements in the collection\n if isinstance(key, int):\n return self._elements[key]\n # If it's a slice we use it to support slice operations over the elements\n # in the collection\n elif isinstance(key, slice):\n return ElementCollection(self._elements[key])\n\n # If it's anything else (basically a string) we use it as a selector\n # TODO: Write tests!\n elements = self._element.querySelectorAll(key)\n return ElementCollection([Element(el) for el in elements])\n\n def __len__(self):\n return len(self._elements)\n\n def __eq__(self, obj):\n \"\"\"Check if the element is the same as the other element by comparing\n the underlying JS element\"\"\"\n return isinstance(obj, ElementCollection) and obj._elements == self._elements\n\n def _get_attribute(self, attr, index=None):\n if index is None:\n return [getattr(el, attr) for el in self._elements]\n\n # As JQuery, when getting an attr, only return it for the first element\n return getattr(self._elements[index], attr)\n\n def _set_attribute(self, attr, value):\n for el in self._elements:\n setattr(el, attr, value)\n\n @property\n def html(self):\n return self._get_attribute(\"html\")\n\n @html.setter\n def html(self, value):\n self._set_attribute(\"html\", value)\n\n @property\n def value(self):\n return self._get_attribute(\"value\")\n\n @value.setter\n def value(self, value):\n self._set_attribute(\"value\", value)\n\n @property\n def children(self):\n return self._elements\n\n def __iter__(self):\n yield from self._elements\n\n def __repr__(self):\n return f\"{self.__class__.__name__} (length: {len(self._elements)}) {self._elements}\"\n\n\nclass DomScope:\n def __getattr__(self, __name: str) -> Any:\n element = document[f\"#{__name}\"]\n if element:\n return element[0]\n\n\nclass PyDom(BaseElement):\n # Add objects we want to expose to the DOM namespace since this class instance is being\n # remapped as \"the module\" itself\n BaseElement = BaseElement\n Element = Element\n ElementCollection = ElementCollection\n\n def __init__(self):\n super().__init__(document)\n self.ids = DomScope()\n self.body = Element(document.body)\n self.head = Element(document.head)\n\n def create(self, type_, parent=None, classes=None, html=None):\n return super().create(type_, is_child=False)\n\n def __getitem__(self, key):\n if isinstance(key, int):\n indices = range(*key.indices(len(self.list)))\n return [self.list[i] for i in indices]\n\n elements = self._js.querySelectorAll(key)\n if not elements:\n return None\n return ElementCollection([Element(el) for el in elements])\n\n\ndom = PyDom()\n\nsys.modules[__name__] = dom\n"
|
11
|
+
"pydom.py": "import sys\nimport warnings\nfrom functools import cached_property\nfrom typing import Any\n\nfrom pyodide.ffi import JsProxy\nfrom pyscript import display, document, window\n\nalert = window.alert\n\n\nclass BaseElement:\n def __init__(self, js_element):\n self._js = js_element\n self._parent = None\n self.style = StyleProxy(self)\n\n def __eq__(self, obj):\n \"\"\"Check if the element is the same as the other element by comparing\n the underlying JS element\"\"\"\n return isinstance(obj, BaseElement) and obj._js == self._js\n\n @property\n def parent(self):\n if self._parent:\n return self._parent\n\n if self._js.parentElement:\n self._parent = self.__class__(self._js.parentElement)\n\n return self._parent\n\n @property\n def __class(self):\n return self.__class__ if self.__class__ != PyDom else Element\n\n def create(self, type_, is_child=True, classes=None, html=None, label=None):\n js_el = document.createElement(type_)\n element = self.__class(js_el)\n\n if classes:\n for class_ in classes:\n element.add_class(class_)\n\n if html is not None:\n element.html = html\n\n if label is not None:\n element.label = label\n\n if is_child:\n self.append(element)\n\n return element\n\n def find(self, selector):\n \"\"\"Return an ElementCollection representing all the child elements that\n match the specified selector.\n\n Args:\n selector (str): A string containing a selector expression\n\n Returns:\n ElementCollection: A collection of elements matching the selector\n \"\"\"\n elements = self._js.querySelectorAll(selector)\n if not elements:\n return None\n return ElementCollection([Element(el) for el in elements])\n\n\nclass Element(BaseElement):\n @property\n def children(self):\n return [self.__class__(el) for el in self._js.children]\n\n def append(self, child):\n # TODO: this is Pyodide specific for now!!!!!!\n # if we get passed a JSProxy Element directly we just map it to the\n # higher level Python element\n if isinstance(child, JsProxy):\n return self.append(Element(child))\n\n elif isinstance(child, Element):\n self._js.appendChild(child._js)\n\n return child\n\n elif isinstance(child, ElementCollection):\n for el in child:\n self.append(el)\n\n # -------- Pythonic Interface to Element -------- #\n @property\n def html(self):\n return self._js.innerHTML\n\n @html.setter\n def html(self, value):\n self._js.innerHTML = value\n\n @property\n def content(self):\n # TODO: This breaks with with standard template elements. Define how to best\n # handle this specifica use case. Just not support for now?\n if self._js.tagName == \"TEMPLATE\":\n warnings.warn(\n \"Content attribute not supported for template elements.\", stacklevel=2\n )\n return None\n return self._js.innerHTML\n\n @content.setter\n def content(self, value):\n # TODO: (same comment as above)\n if self._js.tagName == \"TEMPLATE\":\n warnings.warn(\n \"Content attribute not supported for template elements.\", stacklevel=2\n )\n return\n\n display(value, target=self.id)\n\n @property\n def id(self):\n return self._js.id\n\n @id.setter\n def id(self, value):\n self._js.id = value\n\n @property\n def value(self):\n return self._js.value\n\n @value.setter\n def value(self, value):\n # in order to avoid confusion to the user, we don't allow setting the\n # value of elements that don't have a value attribute\n if not hasattr(self._js, \"value\"):\n raise AttributeError(\n f\"Element {self._js.tagName} has no value attribute. If you want to \"\n \"force a value attribute, set it directly using the `_js.value = <value>` \"\n \"javascript API attribute instead.\"\n )\n self._js.value = value\n\n def clone(self, new_id=None):\n clone = Element(self._js.cloneNode(True))\n clone.id = new_id\n\n return clone\n\n def remove_class(self, classname):\n classList = self._js.classList\n if isinstance(classname, list):\n classList.remove(*classname)\n else:\n classList.remove(classname)\n return self\n\n def add_class(self, classname):\n classList = self._js.classList\n if isinstance(classname, list):\n classList.add(*classname)\n else:\n self._js.classList.add(classname)\n return self\n\n @property\n def classes(self):\n classes = self._js.classList.values()\n return [x for x in classes]\n\n def show_me(self):\n self._js.scrollIntoView()\n\n\nclass StyleProxy(dict):\n def __init__(self, element: Element) -> None:\n self._element = element\n\n @cached_property\n def _style(self):\n return self._element._js.style\n\n def __getitem__(self, key):\n return self._style.getPropertyValue(key)\n\n def __setitem__(self, key, value):\n self._style.setProperty(key, value)\n\n def remove(self, key):\n self._style.removeProperty(key)\n\n def set(self, **kws):\n for k, v in kws.items():\n self._element._js.style.setProperty(k, v)\n\n # CSS Properties\n # Reference: https://github.com/microsoft/TypeScript/blob/main/src/lib/dom.generated.d.ts#L3799C1-L5005C2\n # Following prperties automatically generated from the above reference using\n # tools/codegen_css_proxy.py\n @property\n def visible(self):\n return self._element._js.style.visibility\n\n @visible.setter\n def visible(self, value):\n self._element._js.style.visibility = value\n\n\nclass StyleCollection:\n def __init__(self, collection: \"ElementCollection\") -> None:\n self._collection = collection\n\n def __get__(self, obj, objtype=None):\n return obj._get_attribute(\"style\")\n\n def __getitem__(self, key):\n return self._collection._get_attribute(\"style\")[key]\n\n def __setitem__(self, key, value):\n for element in self._collection._elements:\n element.style[key] = value\n\n def remove(self, key):\n for element in self._collection._elements:\n element.style.remove(key)\n\n\nclass ElementCollection:\n def __init__(self, elements: [Element]) -> None:\n self._elements = elements\n self.style = StyleCollection(self)\n\n def __getitem__(self, key):\n # If it's an integer we use it to access the elements in the collection\n if isinstance(key, int):\n return self._elements[key]\n # If it's a slice we use it to support slice operations over the elements\n # in the collection\n elif isinstance(key, slice):\n return ElementCollection(self._elements[key])\n\n # If it's anything else (basically a string) we use it as a selector\n # TODO: Write tests!\n elements = self._element.querySelectorAll(key)\n return ElementCollection([Element(el) for el in elements])\n\n def __len__(self):\n return len(self._elements)\n\n def __eq__(self, obj):\n \"\"\"Check if the element is the same as the other element by comparing\n the underlying JS element\"\"\"\n return isinstance(obj, ElementCollection) and obj._elements == self._elements\n\n def _get_attribute(self, attr, index=None):\n if index is None:\n return [getattr(el, attr) for el in self._elements]\n\n # As JQuery, when getting an attr, only return it for the first element\n return getattr(self._elements[index], attr)\n\n def _set_attribute(self, attr, value):\n for el in self._elements:\n setattr(el, attr, value)\n\n @property\n def html(self):\n return self._get_attribute(\"html\")\n\n @html.setter\n def html(self, value):\n self._set_attribute(\"html\", value)\n\n @property\n def value(self):\n return self._get_attribute(\"value\")\n\n @value.setter\n def value(self, value):\n self._set_attribute(\"value\", value)\n\n @property\n def children(self):\n return self._elements\n\n def __iter__(self):\n yield from self._elements\n\n def __repr__(self):\n return f\"{self.__class__.__name__} (length: {len(self._elements)}) {self._elements}\"\n\n\nclass DomScope:\n def __getattr__(self, __name: str) -> Any:\n element = document[f\"#{__name}\"]\n if element:\n return element[0]\n\n\nclass PyDom(BaseElement):\n # Add objects we want to expose to the DOM namespace since this class instance is being\n # remapped as \"the module\" itself\n BaseElement = BaseElement\n Element = Element\n ElementCollection = ElementCollection\n\n def __init__(self):\n super().__init__(document)\n self.ids = DomScope()\n self.body = Element(document.body)\n self.head = Element(document.head)\n\n def create(self, type_, classes=None, html=None):\n return super().create(type_, is_child=False, classes=classes, html=html)\n\n def __getitem__(self, key):\n if isinstance(key, int):\n indices = range(*key.indices(len(self.list)))\n return [self.list[i] for i in indices]\n\n elements = self._js.querySelectorAll(key)\n if not elements:\n return None\n return ElementCollection([Element(el) for el in elements])\n\n\ndom = PyDom()\n\nsys.modules[__name__] = dom\n"
|
12
12
|
}
|
13
13
|
};
|
@@ -6,8 +6,6 @@ from typing import Any
|
|
6
6
|
from pyodide.ffi import JsProxy
|
7
7
|
from pyscript import display, document, window
|
8
8
|
|
9
|
-
# from pyscript import when as _when
|
10
|
-
|
11
9
|
alert = window.alert
|
12
10
|
|
13
11
|
|
@@ -177,9 +175,6 @@ class Element(BaseElement):
|
|
177
175
|
def show_me(self):
|
178
176
|
self._js.scrollIntoView()
|
179
177
|
|
180
|
-
def when(self, event, handler):
|
181
|
-
document.when(event, selector=self)(handler)
|
182
|
-
|
183
178
|
|
184
179
|
class StyleProxy(dict):
|
185
180
|
def __init__(self, element: Element) -> None:
|
@@ -319,8 +314,8 @@ class PyDom(BaseElement):
|
|
319
314
|
self.body = Element(document.body)
|
320
315
|
self.head = Element(document.head)
|
321
316
|
|
322
|
-
def create(self, type_,
|
323
|
-
return super().create(type_, is_child=False)
|
317
|
+
def create(self, type_, classes=None, html=None):
|
318
|
+
return super().create(type_, is_child=False, classes=classes, html=html)
|
324
319
|
|
325
320
|
def __getitem__(self, key):
|
326
321
|
if isinstance(key, int):
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/types/plugins.d.ts
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"py-terminal-FUkJ18FU.js","sources":["../src/plugins/py-terminal.js"],"sourcesContent":["// PyScript py-terminal plugin\nimport { TYPES, hooks } from \"../core.js\";\nimport { notify } from \"./error.js\";\n\nconst SELECTOR = [...TYPES.keys()]\n .map((type) => `script[type=\"${type}\"][terminal],${type}-script[terminal]`)\n .join(\",\");\n\n// show the error on main and\n// stops the module from keep executing\nconst notifyAndThrow = (message) => {\n notify(message);\n throw new Error(message);\n};\n\nconst pyTerminal = async () => {\n const terminals = document.querySelectorAll(SELECTOR);\n\n // no results will look further for runtime nodes\n if (!terminals.length) return;\n\n // if we arrived this far, let's drop the MutationObserver\n // as we only support one terminal per page (right now).\n mo.disconnect();\n\n // we currently support only one terminal as in \"classic\"\n if (terminals.length > 1) notifyAndThrow(\"You can use at most 1 terminal.\");\n\n const [element] = terminals;\n // hopefully to be removed in the near future!\n if (element.matches('script[type=\"mpy\"],mpy-script'))\n notifyAndThrow(\"Unsupported terminal.\");\n\n // import styles lazily\n document.head.append(\n Object.assign(document.createElement(\"link\"), {\n rel: \"stylesheet\",\n href: new URL(\"./xterm.css\", import.meta.url),\n }),\n );\n\n // lazy load these only when a valid terminal is found\n const [{ Terminal }, { Readline }] = await Promise.all([\n import(/* webpackIgnore: true */ \"../3rd-party/xterm.js\"),\n import(/* webpackIgnore: true */ \"../3rd-party/xterm-readline.js\"),\n ]);\n\n const readline = new Readline();\n\n // common main thread initialization for both worker\n // or main case, bootstrapping the terminal on its target\n const init = (options) => {\n let target = element;\n const selector = element.getAttribute(\"target\");\n if (selector) {\n target =\n document.getElementById(selector) ||\n document.querySelector(selector);\n if (!target) throw new Error(`Unknown target ${selector}`);\n } else {\n target = document.createElement(\"py-terminal\");\n target.style.display = \"block\";\n element.after(target);\n }\n const terminal = new Terminal({\n theme: {\n background: \"#191A19\",\n foreground: \"#F5F2E7\",\n },\n ...options,\n });\n terminal.loadAddon(readline);\n terminal.open(target);\n terminal.focus();\n };\n\n // branch logic for the worker\n if (element.hasAttribute(\"worker\")) {\n // when the remote thread onReady triggers:\n // setup the interpreter stdout and stderr\n const workerReady = ({ interpreter }, { sync }) => {\n sync.pyterminal_drop_hooks();\n const decoder = new TextDecoder();\n let data = \"\";\n const generic = {\n isatty: true,\n write(buffer) {\n data = decoder.decode(buffer);\n sync.pyterminal_write(data);\n return buffer.length;\n },\n };\n interpreter.setStdout(generic);\n interpreter.setStderr(generic);\n interpreter.setStdin({\n isatty: true,\n stdin: () => sync.pyterminal_read(data),\n });\n };\n\n // at the end of the code, make the terminal interactive\n const codeAfter = `\n import code as _code\n _code.interact()\n `;\n\n // add a hook on the main thread to setup all sync helpers\n // also bootstrapping the XTerm target on main\n hooks.main.onWorker.add(function worker(_, xworker) {\n hooks.main.onWorker.delete(worker);\n init({\n disableStdin: false,\n cursorBlink: true,\n cursorStyle: \"block\",\n });\n xworker.sync.pyterminal_read = readline.read.bind(readline);\n xworker.sync.pyterminal_write = readline.write.bind(readline);\n // allow a worker to drop main thread hooks ASAP\n xworker.sync.pyterminal_drop_hooks = () => {\n hooks.worker.onReady.delete(workerReady);\n hooks.worker.codeAfterRun.delete(codeAfter);\n };\n });\n\n // setup remote thread JS/Python code for whenever the\n // worker is ready to become a terminal\n hooks.worker.onReady.add(workerReady);\n hooks.worker.codeAfterRun.add(codeAfter);\n } else {\n // in the main case, just bootstrap XTerm without\n // allowing any input as that's not possible / awkward\n hooks.main.onReady.add(function main({ io }) {\n console.warn(\"py-terminal is read only on main thread\");\n hooks.main.onReady.delete(main);\n init({\n disableStdin: true,\n cursorBlink: false,\n cursorStyle: \"underline\",\n });\n io.stdout = (value) => {\n readline.write(`${value}\\n`);\n };\n io.stderr = (error) => {\n readline.write(`${error.message || error}\\n`);\n };\n });\n }\n};\n\nconst mo = new MutationObserver(pyTerminal);\nmo.observe(document, { childList: true, subtree: true });\n\n// try to check the current document ASAP\nexport default pyTerminal();\n"],"names":["SELECTOR","TYPES","keys","map","type","join","notifyAndThrow","message","notify","Error","pyTerminal","async","terminals","document","querySelectorAll","length","mo","disconnect","element","matches","head","append","Object","assign","createElement","rel","href","URL","url","Terminal","Readline","Promise","all","import","readline","init","options","target","selector","getAttribute","getElementById","querySelector","style","display","after","terminal","theme","background","foreground","loadAddon","open","focus","hasAttribute","workerReady","interpreter","sync","pyterminal_drop_hooks","decoder","TextDecoder","data","generic","isatty","write","buffer","decode","pyterminal_write","setStdout","setStderr","setStdin","stdin","pyterminal_read","codeAfter","hooks","main","onWorker","add","worker","_","xworker","delete","disableStdin","cursorBlink","cursorStyle","read","bind","onReady","codeAfterRun","io","console","warn","stdout","value","stderr","error","MutationObserver","observe","childList","subtree","pyTerminal$1"],"mappings":"0FAIA,MAAMA,EAAW,IAAIC,EAAMC,QACtBC,KAAKC,GAAS,gBAAgBA,iBAAoBA,uBAClDC,KAAK,KAIJC,EAAkBC,IAEpB,MADAC,EAAOD,GACD,IAAIE,MAAMF,EA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