@pyscript/core 0.5.2-rc1 → 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.
Files changed (28) hide show
  1. package/dist/core-BWvprkAU.js +2 -0
  2. package/dist/core-BWvprkAU.js.map +1 -0
  3. package/dist/core.js +1 -1
  4. package/dist/{deprecations-manager-UTlZA-QO.js → deprecations-manager-7QcXHGFa.js} +2 -2
  5. package/dist/{deprecations-manager-UTlZA-QO.js.map → deprecations-manager-7QcXHGFa.js.map} +1 -1
  6. package/dist/{error-pkP88m2k.js → error-TXLNLhiL.js} +2 -2
  7. package/dist/{error-pkP88m2k.js.map → error-TXLNLhiL.js.map} +1 -1
  8. package/dist/{mpy-CMlzlpA-.js → mpy-Bk2Gn8sr.js} +2 -2
  9. package/dist/{mpy-CMlzlpA-.js.map → mpy-Bk2Gn8sr.js.map} +1 -1
  10. package/dist/{py-CDrjT89T.js → py-LariLnuJ.js} +2 -2
  11. package/dist/{py-CDrjT89T.js.map → py-LariLnuJ.js.map} +1 -1
  12. package/dist/{py-editor-JOpPWlcv.js → py-editor-BiqntXFZ.js} +2 -2
  13. package/dist/{py-editor-JOpPWlcv.js.map → py-editor-BiqntXFZ.js.map} +1 -1
  14. package/dist/{py-terminal-Dgw1v0pP.js → py-terminal-Bb5ZeysW.js} +2 -2
  15. package/dist/{py-terminal-Dgw1v0pP.js.map → py-terminal-Bb5ZeysW.js.map} +1 -1
  16. package/dist/toml-DiUM0_qs.js.map +1 -1
  17. package/dist/{zip-CGWtiqjJ.js → zip-BUaoNci7.js} +2 -2
  18. package/dist/zip-BUaoNci7.js.map +1 -0
  19. package/package.json +3 -3
  20. package/src/core.js +8 -7
  21. package/src/stdlib/pyscript/event_handling.py +1 -1
  22. package/src/stdlib/pyscript/{web/elements.py → web.py} +400 -322
  23. package/src/stdlib/pyscript.js +2 -5
  24. package/types/stdlib/pyscript.d.ts +1 -4
  25. package/dist/core-CjUKQdH6.js +0 -2
  26. package/dist/core-CjUKQdH6.js.map +0 -1
  27. package/dist/zip-CGWtiqjJ.js.map +0 -1
  28. 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-rc1",
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.4",
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.19.1",
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 isAsync = !isSync(element);
207
- const target = element.getAttribute("target");
208
- const show = target
209
- ? queryTarget(element, target)
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 (!target) {
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 = !isSync(this);
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.elements import Element, ElementCollection
23
+ from pyscript.web import Element, ElementCollection
24
24
 
25
25
  if isinstance(selector, str):
26
26
  elements = document.querySelectorAll(selector)