diff --git a/.github/workflows/test-docs.yml b/.github/workflows/test-docs.yml index 228e4fca..3bbacf4f 100644 --- a/.github/workflows/test-docs.yml +++ b/.github/workflows/test-docs.yml @@ -1,25 +1,25 @@ name: Test on: - push: - branches: - - main - pull_request: - branches: - - main - schedule: - - cron: "0 0 * * *" + push: + branches: + - main + pull_request: + branches: + - main + schedule: + - cron: "0 0 * * *" jobs: - docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: actions/setup-python@v4 - with: - python-version: 3.x - - run: pip install -r requirements/build-docs.txt - - run: linkcheckMarkdown docs/ -v -r - - run: mkdocs build --verbose + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + - run: pip install -r requirements/build-docs.txt + - run: linkcheckMarkdown docs/ -v -r + - run: mkdocs build --verbose --strict diff --git a/CHANGELOG.md b/CHANGELOG.md index cab02d0e..9e0b8d57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,16 +26,16 @@ Using the following categories, list your changes in this order: ## [2.1.0] - 2022-11-01 -## Changed +### Changed - Minimum `channels` version is now `4.0.0`. ### Fixed - Change type hint on `view_to_component` callable to have `request` argument be optional. -- Change type hint on `view_to_component` to represent it as a decorator with paranthesis (ex `@view_to_component(compatibility=True)`) +- Change type hint on `view_to_component` to represent it as a decorator with parenthesis (such as `@view_to_component(compatibility=True)`) -## Security +### Security - Add note to docs about potential information exposure via `view_to_component` when using `compatibility=True`. @@ -137,7 +137,7 @@ Using the following categories, list your changes in this order: - Ability to declare the HTML class of the top-level component `div` - `name = ...` parameter to IDOM HTTP paths for use with `django.urls.reverse()` -- Cache versioning to automatically invalidate old web module files from the cache backend +- Cache versioning to automatically invalidate old web module files from the cache back-end - Automatic pre-population of the IDOM component registry - Type hinting for `IdomWebsocket` @@ -153,7 +153,7 @@ Using the following categories, list your changes in this order: - `IDOM_WEB_MODULES_PATH` has been replaced with Django `include(...)` - `IDOM_WS_MAX_RECONNECT_DELAY` has been renamed to `IDOM_WS_MAX_RECONNECT_TIMEOUT` -- `idom_web_modules` cache backend has been renamed to `idom` +- `idom_web_modules` cache back-end has been renamed to `idom` ### Fixed @@ -162,7 +162,7 @@ Using the following categories, list your changes in this order: ### Security -- Fixed potential directory travesal attack on the IDOM web modules URL +- Fixed potential directory traversal attack on the IDOM web modules URL ## [0.0.1] - 2021-08-18 diff --git a/README.md b/README.md index 1c7e4fbc..3f06594a 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ -Django-IDOM connects your Python project to a ReactJS frontend, allowing you to create **interactive websites without needing JavaScript!** +Django-IDOM connects your Python project to a ReactJS front-end, allowing you to create **interactive websites without needing JavaScript!** Following ReactJS styling, web elements are combined into [reusable "components"](https://idom-docs.herokuapp.com/docs/guides/creating-interfaces/your-first-components/index.html#parametrizing-components). These components can utilize [hooks](https://idom-docs.herokuapp.com/docs/reference/hooks-api.html) and [events](https://idom-docs.herokuapp.com/docs/guides/adding-interactivity/responding-to-events/index.html#async-event-handlers) to create infinitely complex web pages. @@ -25,7 +25,7 @@ Any Python web framework with Websockets can support IDOM. See below for what fr -You'll need a file to define your [IDOM](https://github.com/idom-team/idom) components. We recommend creating a `components.py` file within your chosen **Django app** to start out. Within this file, we will create a simple `hello_world` component. +You will need a file to define your [IDOM](https://github.com/idom-team/idom) components. We recommend creating a `components.py` file within your chosen **Django app** to start out. Within this file, we will create a simple `hello_world` component. @@ -46,7 +46,7 @@ def hello_world(recipient: str): In your **Django app**'s HTML template, you can now embed your IDOM component using the `component` template tag. Within this tag, you will need to type in your dotted path to the component function as the first argument. -Additonally, you can pass in keyword arguments into your component function. For example, after reading the code below, pay attention to how the function definition for `hello_world` (_in the previous example_) accepts a `recipient` argument. +Additionally, you can pass in keyword arguments into your component function. For example, after reading the code below, pay attention to how the function definition for `hello_world` (_in the previous example_) accepts a `recipient` argument. diff --git a/docs/src/contribute/code.md b/docs/src/contribute/code.md index 3f3d7aee..2a6b9feb 100644 --- a/docs/src/contribute/code.md +++ b/docs/src/contribute/code.md @@ -2,7 +2,7 @@ Everything within the `django-idom` repository must be specific to Django integration. Check out the [IDOM Core documentation](https://idom-docs.herokuapp.com/docs/about/contributor-guide.html) to contribute general features such as: components, hooks, events, and more. -If you plan to make code changes to this repository, you'll need to install the following dependencies first: +If you plan to make code changes to this repository, you will need to install the following dependencies first: - [Python 3.8+](https://www.python.org/downloads/) - [Git](https://git-scm.com/downloads) diff --git a/docs/src/contribute/docs.md b/docs/src/contribute/docs.md index 231fb603..d918c4b9 100644 --- a/docs/src/contribute/docs.md +++ b/docs/src/contribute/docs.md @@ -1,4 +1,4 @@ -If you plan to make changes to this documentation, you'll need to install the following dependencies first: +If you plan to make changes to this documentation, you will need to install the following dependencies first: - [Python 3.8+](https://www.python.org/downloads/) - [Git](https://git-scm.com/downloads) diff --git a/docs/src/contribute/running-tests.md b/docs/src/contribute/running-tests.md index f1ff6cc1..8f806e08 100644 --- a/docs/src/contribute/running-tests.md +++ b/docs/src/contribute/running-tests.md @@ -1,6 +1,6 @@ -This repo uses [Nox](https://nox.thea.codes/en/stable/) to run tests. For a full test of available scripts run `nox -l`. +This repository uses [Nox](https://nox.thea.codes/en/stable/) to run tests. For a full test of available scripts run `nox -l`. -If you plan to run tests, you'll need to install the following dependencies first: +If you plan to run tests, you will need to install the following dependencies first: - [Python 3.8+](https://www.python.org/downloads/) - [Git](https://git-scm.com/downloads) diff --git a/docs/src/dictionary.txt b/docs/src/dictionary.txt new file mode 100644 index 00000000..3e4179a1 --- /dev/null +++ b/docs/src/dictionary.txt @@ -0,0 +1,24 @@ +django +nox +websocket +websockets +changelog +async +pre +prefetch +preloader +whitespace +refetch +refetched +refetching +html +jupyter +webserver +iframe +keyworded +stylesheet +stylesheets +unstyled +py +idom +asgi diff --git a/docs/src/features/components.md b/docs/src/features/components.md index eca86f66..019f03b7 100644 --- a/docs/src/features/components.md +++ b/docs/src/features/components.md @@ -4,7 +4,7 @@ ## View To Component -Convert any Django view into a IDOM component by usng this decorator. Compatible with [Function Based Views](https://docs.djangoproject.com/en/dev/topics/http/views/) and [Class Based Views](https://docs.djangoproject.com/en/dev/topics/class-based-views/). Views can be sync or async. +Convert any Django view into a IDOM component by using this decorator. Compatible with [Function Based Views](https://docs.djangoproject.com/en/dev/topics/http/views/) and [Class Based Views](https://docs.djangoproject.com/en/dev/topics/class-based-views/). Views can be sync or async. === "components.py" @@ -30,10 +30,10 @@ Convert any Django view into a IDOM component by usng this decorator. Compatible | Name | Type | Description | Default | | --- | --- | --- | --- | - | view | `Callable | View` | The view function or class to convert. | N/A | - | compatibility | `bool` | If True, the component will be rendered in an iframe. When using compatibility mode `tranforms`, `strict_parsing`, `request`, `args`, and `kwargs` arguments will be ignored. | `False` | - | transforms | `Sequence[Callable[[VdomDict], Any]]` | A list of functions that transforms the newly generated VDOM. The functions will be called on each VDOM node. | `tuple` | - | strict_parsing | `bool` | If True, an exception will be generated if the HTML does not perfectly adhere to HTML5. | `True` | + | `view` | `Callable | View` | The view function or class to convert. | N/A | + | `compatibility` | `bool` | If True, the component will be rendered in an iframe. When using compatibility mode `tranforms`, `strict_parsing`, `request`, `args`, and `kwargs` arguments will be ignored. | `False` | + | `transforms` | `Sequence[Callable[[VdomDict], Any]]` | A list of functions that transforms the newly generated VDOM. The functions will be called on each VDOM node. | `tuple` | + | `strict_parsing` | `bool` | If True, an exception will be generated if the HTML does not perfectly adhere to HTML5. | `True` | **Returns** @@ -45,9 +45,9 @@ Convert any Django view into a IDOM component by usng this decorator. Compatible When using `compatibility` mode, IDOM automatically exposes a URL to your view. - It is your responsibility to ensure priveledged information is not leaked via this method. + It is your responsibility to ensure privileged information is not leaked via this method. - This can be done via directly writing conditionals into your view, or by adding decorators such as [user_passes_test](https://docs.djangoproject.com/en/dev/topics/auth/default/#django.contrib.auth.decorators.user_passes_test) to your views prior to using `view_to_component`. + This can be done via directly writing conditionals into your view, or by adding decorators such as [`user_passes_test`](https://docs.djangoproject.com/en/dev/topics/auth/default/#django.contrib.auth.decorators.user_passes_test) to your views prior to using `view_to_component`. === "Function Based View" @@ -78,7 +78,7 @@ Convert any Django view into a IDOM component by usng this decorator. Compatible - Requires manual intervention to change request methods beyond `GET`. - IDOM events cannot conveniently be attached to converted view HTML. - Does not currently load any HTML contained with a `
` tag - - Has no option to automatically intercept local anchor link (ex. `#!html `) click events + - Has no option to automatically intercept local anchor link (such as `#!html `) click events _Please note these limitations do not exist when using `compatibility` mode._ @@ -303,8 +303,8 @@ Allows you to defer loading a CSS stylesheet until a component begins rendering. | Name | Type | Description | Default | | --- | --- | --- | --- | - | static_path | `str` | The path to the static file. This path is identical to what you would use on a `static` template tag. | N/A | - | key | `Key | None` | A key to uniquely identify this component which is unique amongst a component's immediate siblings | `None` | + | `static_path` | `str` | The path to the static file. This path is identical to what you would use on a `static` template tag. | N/A | + | `key` | `Key | None` | A key to uniquely identify this component which is unique amongst a component's immediate siblings | `None` | **Returns** @@ -318,7 +318,7 @@ Allows you to defer loading a CSS stylesheet until a component begins rendering. ??? question "Can I load static CSS using `html.link` instead?" - While you can load stylesheets with `html.link`, keep in mind that loading this way **does not** ensure load order. Thus, your stylesheet will be loaded after your component is displayed. This would likely cause some visual jankiness, so use this at your own discretion. + While you can load stylesheets with `html.link`, keep in mind that loading this way **does not** ensure load order. Thus, your stylesheet will be loaded after your component is displayed. This would likely cause unintended visual behavior, so use this at your own discretion. Here's an example on what you should avoid doing for Django static files: @@ -381,8 +381,8 @@ Allows you to defer loading JavaScript until a component begins rendering. This | Name | Type | Description | Default | | --- | --- | --- | --- | - | static_path | `str` | The path to the static file. This path is identical to what you would use on a `static` template tag. | N/A | - | key | `Key | None` | A key to uniquely identify this component which is unique amongst a component's immediate siblings | `None` | + | `static_path` | `str` | The path to the static file. This path is identical to what you would use on a `static` template tag. | N/A | + | `key` | `Key | None` | A key to uniquely identify this component which is unique amongst a component's immediate siblings | `None` | **Returns** diff --git a/docs/src/features/decorators.md b/docs/src/features/decorators.md index 8b28c08a..663dfb52 100644 --- a/docs/src/features/decorators.md +++ b/docs/src/features/decorators.md @@ -31,8 +31,8 @@ This decorator can be used with or without parentheses. | Name | Type | Description | Default | | --- | --- | --- | --- | - | auth_attribute | `str` | The value to check within the user object. This is checked in the form of `UserModel.