@pyscript/core 0.5.2-rc2 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core-BWvprkAU.js +2 -0
- package/dist/core-BWvprkAU.js.map +1 -0
- package/dist/core.js +1 -1
- package/dist/{deprecations-manager-NZiilPwd.js → deprecations-manager-7QcXHGFa.js} +2 -2
- package/dist/{deprecations-manager-NZiilPwd.js.map → deprecations-manager-7QcXHGFa.js.map} +1 -1
- package/dist/{error-C8ancGMn.js → error-TXLNLhiL.js} +2 -2
- package/dist/{error-C8ancGMn.js.map → error-TXLNLhiL.js.map} +1 -1
- package/dist/{mpy-BMuA4LtC.js → mpy-Bk2Gn8sr.js} +2 -2
- package/dist/{mpy-BMuA4LtC.js.map → mpy-Bk2Gn8sr.js.map} +1 -1
- package/dist/{py-CEZskUpM.js → py-LariLnuJ.js} +2 -2
- package/dist/{py-CEZskUpM.js.map → py-LariLnuJ.js.map} +1 -1
- package/dist/{py-editor-wBsF6NjT.js → py-editor-BiqntXFZ.js} +2 -2
- package/dist/{py-editor-wBsF6NjT.js.map → py-editor-BiqntXFZ.js.map} +1 -1
- package/dist/{py-terminal-rg1cOOgx.js → py-terminal-Bb5ZeysW.js} +2 -2
- package/dist/{py-terminal-rg1cOOgx.js.map → py-terminal-Bb5ZeysW.js.map} +1 -1
- package/dist/toml-DiUM0_qs.js.map +1 -1
- package/dist/zip-BUaoNci7.js.map +1 -1
- package/package.json +3 -3
- package/src/core.js +8 -7
- package/src/stdlib/pyscript/event_handling.py +1 -1
- package/src/stdlib/pyscript/{web/elements.py → web.py} +400 -322
- package/src/stdlib/pyscript.js +2 -5
- package/types/stdlib/pyscript.d.ts +1 -4
- package/dist/core-DghpsAMR.js +0 -2
- package/dist/core-DghpsAMR.js.map +0 -1
- package/src/stdlib/pyscript/web/__init__.py +0 -22
    
        package/package.json
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            {
         | 
| 2 2 | 
             
                "name": "@pyscript/core",
         | 
| 3 | 
            -
                "version": "0.5.2 | 
| 3 | 
            +
                "version": "0.5.2",
         | 
| 4 4 | 
             
                "type": "module",
         | 
| 5 5 | 
             
                "description": "PyScript",
         | 
| 6 6 | 
             
                "module": "./index.js",
         | 
| @@ -44,7 +44,7 @@ | |
| 44 44 | 
             
                "dependencies": {
         | 
| 45 45 | 
             
                    "@ungap/with-resolvers": "^0.1.0",
         | 
| 46 46 | 
             
                    "basic-devtools": "^0.1.6",
         | 
| 47 | 
            -
                    "polyscript": "^0.14. | 
| 47 | 
            +
                    "polyscript": "^0.14.5",
         | 
| 48 48 | 
             
                    "sticky-module": "^0.1.1",
         | 
| 49 49 | 
             
                    "to-json-callback": "^0.1.1",
         | 
| 50 50 | 
             
                    "type-checked-collections": "^0.1.7"
         | 
| @@ -67,7 +67,7 @@ | |
| 67 67 | 
             
                    "codemirror": "^6.0.1",
         | 
| 68 68 | 
             
                    "eslint": "^9.8.0",
         | 
| 69 69 | 
             
                    "flatted": "^3.3.1",
         | 
| 70 | 
            -
                    "rollup": "^4. | 
| 70 | 
            +
                    "rollup": "^4.20.0",
         | 
| 71 71 | 
             
                    "rollup-plugin-postcss": "^4.0.2",
         | 
| 72 72 | 
             
                    "rollup-plugin-string": "^3.0.0",
         | 
| 73 73 | 
             
                    "static-handler": "^0.4.3",
         | 
    
        package/src/core.js
    CHANGED
    
    | @@ -12,7 +12,6 @@ import { | |
| 12 12 | 
             
                define,
         | 
| 13 13 | 
             
                defineProperty,
         | 
| 14 14 | 
             
                dispatch,
         | 
| 15 | 
            -
                isSync,
         | 
| 16 15 | 
             
                queryTarget,
         | 
| 17 16 | 
             
                unescape,
         | 
| 18 17 | 
             
                whenDefined,
         | 
| @@ -203,13 +202,15 @@ for (const [TYPE, interpreter] of TYPES) { | |
| 203 202 | 
             
                                    }
         | 
| 204 203 |  | 
| 205 204 | 
             
                                    if (isScript(element)) {
         | 
| 206 | 
            -
                                        const  | 
| 207 | 
            -
             | 
| 208 | 
            -
                                         | 
| 209 | 
            -
             | 
| 205 | 
            +
                                        const {
         | 
| 206 | 
            +
                                            attributes: { async: isAsync, target },
         | 
| 207 | 
            +
                                        } = element;
         | 
| 208 | 
            +
                                        const hasTarget = !!target?.value;
         | 
| 209 | 
            +
                                        const show = hasTarget
         | 
| 210 | 
            +
                                            ? queryTarget(element, target.value)
         | 
| 210 211 | 
             
                                            : document.createElement("script-py");
         | 
| 211 212 |  | 
| 212 | 
            -
                                        if (! | 
| 213 | 
            +
                                        if (!hasTarget) {
         | 
| 213 214 | 
             
                                            const { head, body } = document;
         | 
| 214 215 | 
             
                                            if (head.contains(element)) body.append(show);
         | 
| 215 216 | 
             
                                            else element.after(show);
         | 
| @@ -330,7 +331,7 @@ for (const [TYPE, interpreter] of TYPES) { | |
| 330 331 | 
             
                                async connectedCallback() {
         | 
| 331 332 | 
             
                                    if (!this.executed) {
         | 
| 332 333 | 
             
                                        this.executed = true;
         | 
| 333 | 
            -
                                        const isAsync =  | 
| 334 | 
            +
                                        const isAsync = this.hasAttribute("async");
         | 
| 334 335 | 
             
                                        const { io, run, runAsync } = await this._wrap
         | 
| 335 336 | 
             
                                            .promise;
         | 
| 336 337 | 
             
                                        this.srcCode = await fetchSource(
         | 
| @@ -20,7 +20,7 @@ def when(event_type=None, selector=None): | |
| 20 20 |  | 
| 21 21 | 
             
                def decorator(func):
         | 
| 22 22 |  | 
| 23 | 
            -
                    from pyscript.web | 
| 23 | 
            +
                    from pyscript.web import Element, ElementCollection
         | 
| 24 24 |  | 
| 25 25 | 
             
                    if isinstance(selector, str):
         | 
| 26 26 | 
             
                        elements = document.querySelectorAll(selector)
         |