Skip to content

switch to furo, a simpler theme #245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@app.route("/")
async def forward_to_index(request):
return response.redirect("/docs/content/index.html")
return response.redirect("/docs/index.html")


mount, element = multiview()
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import textwrap
from pathlib import Path

from sphinx.application import Sphinx
Expand Down Expand Up @@ -112,7 +111,7 @@ def _literal_include_js_lines(name, linenos):


def _string_to_nested_lines(content):
return StringList(textwrap.indent(content, " ").split("\n"))
return StringList(content.split("\n"))


def setup(app: Sphinx) -> None:
Expand Down
Binary file added docs/source/branding/idom-logo-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 12 additions & 18 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
sys.path.insert(0, str(here.parent.parent))

# extension path
sys.path.insert(0, str(here / "exts"))
sys.path.insert(0, str(here / "_exts"))


# -- Project information -----------------------------------------------------
Expand Down Expand Up @@ -52,6 +52,7 @@
"widget_example",
"async_doctest",
"sphinx_panels",
"sphinx_copybutton",
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -64,7 +65,7 @@
source_suffix = ".rst"

# The master toctree document.
master_doc = "content/index"
master_doc = "index"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -95,7 +96,11 @@
# -- sphinx.ext.autodoc --

# show base classes for autodoc
autodoc_default_flags = ["show-inheritance", "inherited-members"]
autodoc_default_options = {
"show-inheritance": True,
"inherited-members": True,
"member-order": "bysource",
}
# order autodoc members by their order in the source
autodoc_member_order = "bysource"

Expand All @@ -104,35 +109,24 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "pydata_sphinx_theme"
html_theme = "furo"
html_logo = "branding/idom-logo-white.png"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
html_theme_options = {
"github_url": "https://github.com/idom-team/idom",
"use_edit_page_button": True,
"show_toc_level": 2,
}

html_context = {
"github_user": "idom-team",
"github_repo": "idom",
"github_version": "main",
"doc_path": "docs/source",
}
# html_theme_options = {}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["static"]
html_static_path = ["_static"]

# These paths are either relative to html_static_path
# or fully qualified paths (eg. https://...)
html_css_files = [
"css/interactive-widget.css",
"css/fix-code-linenos.css",
]

# Custom sidebar templates, must be a dictionary that maps document names
Expand Down
14 changes: 0 additions & 14 deletions docs/source/content/advanced-usage/index.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/source/content/api-reference/index.rst

This file was deleted.

13 changes: 0 additions & 13 deletions docs/source/content/user-guide/index.rst

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ Core Concepts
This section covers core features of IDOM that are used in making
interactive interfaces.

.. contents::
:local:
:depth: 1


Pure Elements
-------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
Javascript Modules
==================
Custom Javascript
=================

.. note::

This is a recent feature of IDOM. If you have a problem following this tutorial
`post an issue <https://github.com/rmorshea/idom/issues>`__.

.. contents::
:local:
:depth: 1

While IDOM is a great tool for displaying HTML and responding to browser events with
pure Python, there are other projects which already allow you to do this inside
`Jupyter Notebooks <https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20Basics.html>`__
Expand All @@ -19,11 +15,7 @@ The real power of IDOM comes from its ability to seemlessly leverage the existin
ecosystem of
`React components <https://reactjs.org/docs/components-and-props.html>`__.

So long as your library of interest is an
`ES Module <https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/>`__
you could install using
`Snowpack <https://www.snowpack.dev/>`__
you can use it with IDOM
So long as your library of interest can be installed NPM_, you can use it with IDOM
You can even define your own Javascript modules which use these third party Javascript
packages.

Expand All @@ -33,7 +25,7 @@ Installing React Components

.. note::

Be sure that you've installed `npm <https://www.npmjs.com/get-npm>`__.
Be sure that you `install NPM`_ before continuing.

In this example we'll be using the ubiquitous React-based UI framework `Material UI`_
which can be easily installed using the ``idom`` CLI:
Expand Down Expand Up @@ -95,3 +87,5 @@ under construction...
.. =====

.. _Material UI: https://material-ui.com/
.. _NPM: https://www.npmjs.com
.. _install NPM: https://www.npmjs.com/get-npm
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
Examples
========

.. contents::
:local:
:depth: 1


Slideshow
---------
Expand All @@ -31,7 +27,7 @@ Try typing in the text box and pressing 'Enter' 📋
The Game Snake
--------------

Click to start playing and use WASD to move 🎮
Click to start playing and use the arrow keys to move 🎮

Slow internet may cause inconsistent frame pacing 😅

Expand Down
10 changes: 5 additions & 5 deletions docs/source/examples/snake_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ def GameView():


class Direction(enum.Enum):
w = (0, -1)
a = (-1, 0)
s = (0, 1)
d = (1, 0)
ArrowUp = (0, -1)
ArrowLeft = (-1, 0)
ArrowDown = (0, 1)
ArrowRight = (1, 0)


@idom.element
def GameLoop(grid_size, block_scale, set_game_state):
# we `use_ref` here to capture the latest direction press without any delay
direction = idom.hooks.use_ref(Direction.d.value)
direction = idom.hooks.use_ref(Direction.ArrowRight.value)

snake, set_snake = idom.hooks.use_state([(grid_size // 2 - 1, grid_size // 2 - 1)])
food, set_food = use_snake_food(grid_size, snake)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ Extra Features

Optionally installable features of IDOM.

.. contents::
:local:
:depth: 1

To install a **stable** set of features for IDOM simply run.

.. code-block::
Expand Down
29 changes: 19 additions & 10 deletions docs/source/content/index.rst → docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
IDOM |release|
==============

.. image:: branding/idom-logo.png
:height: 250px
IDOM
====

Libraries for defining and controlling interactive webpages with Python
3.7 and above.

.. toctree::
:maxdepth: 1

user-guide/index
:hidden:
:caption: User Guide

installation
getting-started
life-cycle-hooks
core-concepts
custom-javascript
examples
advanced-usage/index
api-reference/index

.. toctree::
:hidden:
:caption: Reference

GitHub <https://github.com/idom-team/idom>
package-api
specifications
extra-features


Early Days
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Installation

idom install some-js-package

For more info see the :ref:`Javascript Modules` section.
For more info see the :ref:`Custom Javascript` section.

* - Extra Features

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ cases the :ref:`Basic Hooks` should be enough, however the remaining
`In the future <https://github.com/idom-team/idom/issues/203>`_ they will be
added, but if you have a particular need for a missing hook post an issue.

.. contents::
:local:
:depth: 2


Basic Hooks
===========
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
Package API
===========

.. contents::
:local:
:depth: 1

.. module:: idom


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ created by `Nteract <https://nteract.io>`_ and which was built into
for VDOM is fairly well established, it should not be relied until it's been fully
adopted by the aforementioned organizations.

.. contents::
:local:
:depth: 1


VDOM Mimetype
-------------
Expand Down
5 changes: 3 additions & 2 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
sphinx ==2.2.0
sphinx ==3.2.1
sphinx-autodoc-typehints ==1.7.0
pydata-sphinx-theme ==0.4.1
furo ==2020.10.13b12
sphinx-panels ==0.5.0
setuptools_scm
sphinx-copybutton ==0.3.0