* PyEditor fixes
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* PyEditor cumulative fixes & improvements
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* change pydom example to use new pyscript.web namespace
* change tests to use new pyscript.web namespace
* create new pyscript.web package and move pydom to pyscript.web.dom
* add __init__ to pyscript.web and expose the dom instance instead of the pyscript.web.dom module
* move elements from pyweb.ui to pyscript.web and temp fix pydom import
* moved of elements file completed
* moved media from pyweb to pyscript.web
* RIP pyweb
* move JSProperty from pyscript.web.dom to pyscript.web.elements
* move element classes from pyscript.web.dom to pyscript.web.elements
* first round of fixes while running tests
* fix test typo
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* restore right type type returned for Element.parent. ALL TESTS PASS LOCALLY NOW
* lint
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* clean up dom.py from dead commented code and osbolete comments
* bugfix: dom shouldn't return None when it can't find any element for a specific selector so it now returns an empty collection
* additional cleanup in tests
* lint
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* add JSProperty to pydom so it can be used to create descriptors mapping to specific JS attributes
* add pyweb.ui
* fix pyweb imports
* fix link and a elements and add a script element
* fix imports and add initialization to load resources to shoelace module
* new pyweb.ui test folder
* remove comments
* add Icon to shoelace components
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* use html property rather than accessing _js directly
* add markdown suppport
* move examples section out of stdlib pyweb to examples.py in the demo itself
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify demo code
* improve docstrings
* precommit fixes
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify code for main page
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add load_resources to markdown
* add showlace extra style dynamically
* precommit
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add gallery files
* add global attributes and dynamic property assignment
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add shoelace radio component (#1961)
* add shoelace radio component
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* fix type that lead using the the JSDescriptor directly instead of the factory method
* add missing marked dependency
* refactor gallary to simplify codebase
* precommig lint
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add text attribute to pydom Elements
* add global JS attributes to elements and improve demos
* lint
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix image instantiation on card since the API has changed
* add attributes to all classes in elements
* lint
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* change example creation functions to take the label and the object directly
* fix input name clashing with input keyword
* refactor examples to better simplify and automate
* fix div clashing names
* fix demo left menu width
* simplify base elements demo by moving all the examples to the examples module
* rename Grid to grid to align to other elements
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* reorg classes order in elements.py and add missing elements to examples
* fix issue related to now importing div from pyweb.ui
* improve demo
* link and fix spelling typo
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add a bunch more elements (#1966)
* Add copy button
* Add skeleton and spinner
* Add Switch
* Add text area
* Add more elements
* More styling to each component
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabio Pliger <fpliger@users.noreply.github.com>
* Add radio group (#1963)
* add radio group
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabio Pliger <fpliger@users.noreply.github.com>
* Small tweaks to main demo page (#1962)
* Small tweaks to main demo page
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabio Pliger <fpliger@users.noreply.github.com>
* fix post merge issues
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixed issues with renaming Grid to grid, after we merged
* lint
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add multple HTML elements in alphabetical order from abbr to em
* fix attributes of some of the elements added in the previous commit and add embed
* fix embed attributes and add fieldset
* add figcation, figure and form. Also fix ordering of definitoin of img and input_
* add style and lint
* wrap up adding all major html elements
* fix test failing due to different error message from fake server compared to a real test server
* change default docstring associated with all classes dynamically patched
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* lint
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add pyweb tests
* lint
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add global attributes and change abbr test
* fix abbr to inherit from TextElementBase
* add address test and improve error messaging when ElementBase gets a bad input as style
* change test helper function to be more flexible on attributes and manage content vs non content based elements. Also adds area tests
* add test for more elements up to caption
* fix canvas and caption as elements that have content and fix name typo on figcaption
* fix another typo on figcaption
* minor fixes and complete tests for all elements
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* adapt shoelace to latest upates in ui.elements
* fix issue with example code not showing created button
* move global attributes to base class
* replace all the calls to _add_js_properties with defining attributes directly in the classes
* finish moving all properties manually on each class
* remove _add_js_properties
* replace JSProperty with js_property
* replace JSProperty with js_property
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixed merge conflicts
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* remove js_property and just use JSProperty with name and allow_nones as arguments
* fix bug around Element not being able to map global attributes in subclasses
* remove js_property and fix references
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* precommit
* precommit again
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* lint
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* enable pyweb on micropython
* switch examples to micropython
* fix pydom issue with micropython, created by the monkeypatch around JsProxy
* print micropython version on micropython pydom example
* lint and remove of textwrap in stdlib for micropython compatibility
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added msising attributes on the option Element. Tests are all passing now
* fix tests
* lint
* temp ugly fix for micropython, using the when decorator with a function without arguments
* small fixes and improvements to examples
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix examples and broken link from the removal of markdown and shoelace from stdlib
* lint
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* dynamically change the server address in tests
* use the right element in test_a
* lint
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* skipping test_audio in CI due to different behavior of fake_server vs a real server, that runs in local tests
* add conditional expected_missing_file_errors property to manage different behaviour between local tests and CI (due to fake_server)
* lint
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Askat <aaskat@users.noreply.github.com>
Co-authored-by: Fábio Rosado <hello@fabiorosado.dev>
Co-authored-by: Andrea Giammarchi <andrea.giammarchi@gmail.com>
* Expose pyscript.py_modules for lazy Python modules
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Expose py-editor code content read/write
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Allow MicroPython Terminal on Main
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Add spinner to disabled py-editor run buttons
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* css nit suggested by WebReflection
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Fix#2056 - Provide a default empty config per editor env
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Even better PyEditor offline use case (#2050)
* Even better PyEditor offline use case
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* PyEditor - process(code) ability
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Even better PyEditor offline use case
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Fix#2031 - Add pyscript.WebSocket to the mix
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Working on a test case anyone can run
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Fix#2040 - Polyscript update to provide config dictionary
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Avoid PyWeb as part of stdlib on MicroPython
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Added @xterm/addon-web-links to the terminal
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* PyTerminal .process(code) utility
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
## Changes
* fixed an issue with the **py-editor** related to the new `linebuffer` directive
* provide in worker hook scope a simple callback that pre-buffers unicode sequences [accordingly to the standard](https://encoding.spec.whatwg.org/#utf-8-bytes-needed) so that the buffer is sent to the terminal only once those sequences are fulfilled
* test with both `µ` and way more convoluted sequences such as 👩❤️👨 that the output, if either requested as input or already evaluated from the page works ... in latter case `test = "👩❤️👨"` completely messes up the program and the resulting string is empty
* Fix#1998 - Allow lazy PyTerminal bootstrap
* Fix#1998 - Allow lazy terminal bootstrap / runtime
* Implemented mpy terminal in both main and worker
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Fix#2000 - Allow advanced users to deal themselves with responses
* rolled back the direct utility idea
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated to latest MicroPython and latest way to have direct access with fetch
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* add missing test for html attribute
* add test for text attribute
* fix text attribute test
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Andrea Giammarchi <andrea.giammarchi@gmail.com>
* fix pydom example
* fix the pydom test example to use a python syntax that works with MicroPython by replacing datetime
* add note about capturing errors importing when
* patch event_handler to handle compat with micropython
* turn pyweb into a package and remove hack to make pydom a sort of module with an ugly hack
* add pydom example using micropython
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix select element test
* change pydom test page to let pytest tests load it properly
* add missing folders to test dev server so it can run examples in the manual tests folder
* add pydom tests to the test suite as integration tests
* lint
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* improve fixes in event_handling
* change when decorator to actually dynamically fail in micropython and support handlers with or without arguments
* simplify when decorator code
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add type declaration back for the MP use case
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed code to access pydom get index as I can't think of any proper use case
* remove old commented hack to replace pydom module with class
* fix examples title
* precommit checks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* add media module
* add Device class to media
* add camera test example
* add snap, download and other convenience methods
* load devices automagically
* add draw method to canvas
* add docstring for download
* add docstrings to draw method
* add docstrings to snap
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* load devices as soon as the page loads
* solve conflict
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* remove display calls listing devices in camera example
* fix typos and other small errors
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix typo in docstring
* fix error message typo
* replace setAttribute on JS properties with accessors
* remove debug statement
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add docstrings
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add docstrings to camera example
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Fix#1899 - Expose pyscript.js_modules as module
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix#1899 - Make import as smooth as in polyscript
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* PyTerminal - expose the reference through the element
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* add tests for select options
* add classes to support select and options management
* fix add methond and implement clear on options
* fix optionsproxy.add
* fix select.add method
* add test adding a second option to select
* add tests around adding options in multiple flavors
* add test to add an option by passing the option it wants to be added before
* complete test around adding options
* add select to add test on remove
* add tests and support for selected item
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Andrea Giammarchi <andrea.giammarchi@gmail.com>
This MR shows errors and exit in these conditions:
* multiple `<py-config>` or `<mpy-config>` found on the page
* both `<py-config>` and `<script type="py" config="file.toml">` found on main
* different `<script type="py" config="a.toml">` and `<script type="py" config="b.toml">` configs found on main