Skip to content

Commit e221040

Browse files
committed
update changelog for 0.32.0 release
1 parent 3cbc8f2 commit e221040

8 files changed

+77
-23
lines changed

Diff for: docs/source/architectural-patterns.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ Communication Scheme
173173
--------------------
174174

175175
To communicate between its back-end Python server and Javascript client, IDOM uses
176-
something called a Virtual Document Object Model (:ref:`VDOM <VDOM Mimetype>`) to
176+
something called a Virtual Document Object Model (:ref:`VDOM`) to
177177
construct a representation of the view. The VDOM is constructed on the Python side by
178178
components. Then, as it evolves, IDOM's layout computes VDOM-diffs and wires them to its
179179
Javascript client where it is ultimately displayed:

Diff for: docs/source/changelog.rst

+37
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,43 @@
11
Changelog
22
=========
33

4+
5+
0.32.0
6+
------
7+
8+
In addition to a variety of bug fixes and other minor improvements, there's a breaking
9+
change to the custom component interface - instead of exporting multiple functions that
10+
render custom components, we simply expect a single ``bind()`` function.
11+
binding function then must return an object with a ``render()`` and ``unmount()``
12+
function. This change was made in order to better support the rendering of child models.
13+
See :ref:`Custom JavaScript Components` for details on the new interface.
14+
15+
**Closed Issues**
16+
17+
- Docs broken on Firefox - :issue:`469`
18+
- URL resolution for web modules does not consider urls starting with / - :issue:`460`
19+
- Query params in package name for module_from_template not stripped - :issue:`455`
20+
- Make docs section margins larger - :issue:`450`
21+
- Search broken in docs - :issue:`443`
22+
- Move src/idom/client out of Python package - :issue:`429`
23+
- Use composition instead of classes with Layout and LifeCycleHook - :issue:`412`
24+
- Remove Python language extension - :issue:`282`
25+
- Add keys to models so React doesn't complain of child arrays requiring them -
26+
:issue:`255`
27+
- Fix binder link in docs - :issue:`231`
28+
29+
**Pull Requests**
30+
31+
- Update issue form - :pull:`471`
32+
- improve heading legibility - :pull:`470`
33+
- fix search in docs by upgrading sphinx - :pull:`462`
34+
- rework custom component interface with bind() func - :pull:`458`
35+
- parse package as url path in module_from_template - :pull:`456`
36+
- add file extensions to import - :pull:`439`
37+
- fix key warnings - :pull:`438`
38+
- fix #429 - move client JS to top of src/ dir - :pull:`430`
39+
40+
441
0.31.0
542
------
643

Diff for: docs/source/core-abstractions.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ the adage "the best code is no code at all," we make the related claim that "the
1212
way to manage state is to have no state at all."
1313

1414
With IDOM the core of your application will be built on the back of basic functions and
15-
coroutines that return :ref:`VDOM <VDOM Mimetype>` models and which do so without state
15+
coroutines that return :ref:`VDOM` models and which do so without state
1616
and without `side effects`_. We call these kinds of model rendering functions
1717
:ref:`Pure Components`. For example, one might want a function which
1818
accepted a list of strings and turned it into a series of paragraph elements:
@@ -54,7 +54,7 @@ whose body contains a hook usage. We'll demonstrate that with a simple
5454
Component Layout
5555
----------------
5656

57-
Displaying components requires you to turn them into :ref:`VDOM <VDOM Mimetype>`. This
57+
Displaying components requires you to turn them into :ref:`VDOM`. This
5858
transformation, known as "rendering a component", is done by a
5959
:class:`~idom.core.proto.LayoutType`. Layouts are responsible for rendering components
6060
and scheduling their re-renders when they change. IDOM's concrete

Diff for: docs/source/faq.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ work, even those that don't rely on React.
3636
How does IDOM communicate with the client?
3737
------------------------------------------
3838

39-
IDOM sends diffs of a Virtual Document Object Model (:ref:`VDOM <VDOM Mimetype>`) to the
39+
IDOM sends diffs of a Virtual Document Object Model (:ref:`VDOM`) to the
4040
client. For more details, see the description in
4141
`this article <https://ryanmorshead.com/articles/2021/idom-react-but-its-python/article/#virtual-document-object-model>`__.
4242

Diff for: docs/source/handling-events.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Handling Events
33

44
When :ref:`Getting Started`, we saw how IDOM makes it possible to write server-side code
55
that defines basic views and can react to client-side events. The simplest way to listen
6-
and respond to events is by assigning a callable object to a :ref:`VDOM <VDOM Mimetype>`
6+
and respond to events is by assigning a callable object to a :ref:`VDOM`
77
an attribute where event signals are sent. This is relatively similar to
88
`handling events in React`_:
99

Diff for: docs/source/javascript-components.rst

+25-7
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ adheres to the following interface:
7272
}
7373
7474
type bind = (node: HTMLElement, context: LayoutContext) => ({
75-
render(component: any, props: Object, children: Array<any>): void;
75+
render(component: any, props: Object, childModels: Array<any>): void;
7676
unmount(): void;
7777
});
7878
@@ -88,7 +88,10 @@ adheres to the following interface:
8888
- ``props`` is an object containing attributes and callbacks for the given
8989
``component``.
9090

91-
- ``children`` is an array of unrendered VDOM elements.
91+
- ``childModels`` is an array of unrendered VDOM elements. Passing them in this raw
92+
form allows for other frameworks besides react to render them as needed. If you
93+
are using react, you can just use the ``idom-client-react`` library to process
94+
them. See :ref:`Distributing Javascript via PyPI` for an example usage.
9295

9396
The interface returned by ``bind()`` can be thought of as being similar to that of
9497
React.
@@ -215,12 +218,26 @@ To start, let's take a look at the file structure we'll be building:
215218
216219
import * as React from "react";
217220
import * as ReactDOM from "react-dom";
221+
import { LayoutConfigContext, elementChildren } from "idom-client-react";
222+
223+
export function bind(node, config) {
224+
return {
225+
render: (component, props, childModels) =>
226+
ReactDOM.render(createElement(config, component, props, childModels), node),
227+
unmount: () => ReactDOM.unmountComponentAtNode(node),
228+
};
229+
}
218230
219-
// exports required to interface with IDOM
220-
export const createElement = (component, props) =>
221-
React.createElement(component, props);
222-
export const renderElement = ReactDOM.render;
223-
export const unmountElement = ReactDOM.unmountComponentAtNode;
231+
function createElement(config, component, props, childModels) {
232+
// Render child models with idom-client-react
233+
return React.createElement(
234+
LayoutConfigContext.Provider,
235+
{ value: config },
236+
React.createElement(
237+
component, props, ...elementChildren(children)
238+
)
239+
)
240+
}
224241
225242
// exports for your components
226243
export YourFirstComponent(props) {...};
@@ -248,6 +265,7 @@ Your ``package.json`` should include the following:
248265
"dependencies": {
249266
"react": "^17.0.1",
250267
"react-dom": "^17.0.1",
268+
"idom-client-react": "^0.8.5",
251269
...
252270
},
253271
...

Diff for: docs/source/specifications.rst

+7-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@ Specifications
22
==============
33

44
Describes various data structures and protocols used to define and communicate virtual
5-
document object models (:ref:`VDOM <VDOM Mimetype>`). The definitions to below follow in
6-
the footsteps of
5+
document object models (:ref:`VDOM`). The definitions below follow in the footsteps of
76
`a specification <https://github.com/nteract/vdom/blob/master/docs/mimetype-spec.md>`_
87
created by `Nteract <https://nteract.io>`_ and which was built into
98
`JupyterLab <https://jupyterlab.readthedocs.io/en/stable/>`_. While IDOM's specification
109
for VDOM is fairly well established, it should not be relied until it's been fully
1110
adopted by the aforementioned organizations.
1211

1312

14-
VDOM Mimetype
15-
-------------
13+
VDOM
14+
----
1615

1716
A set of definitions that explain how IDOM creates a virtual representation of
1817
the document object model. We'll begin by looking at a bit of HTML that we'll convert
@@ -149,7 +148,10 @@ type name. The various properties for the ``onChange`` handler are:
149148
`here <https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation>`__.
150149

151150

152-
To clearly describe the VDOM schema we've created a `JSON Schema <https://json-schema.org/>`_:
151+
VDOM JSON Schema
152+
................
153+
154+
To clearly describe the VDOM spec we've created a `JSON Schema <https://json-schema.org/>`_:
153155

154156
.. literalinclude:: ./vdom-json-schema.json
155157
:language: json

Diff for: src/idom/core/vdom.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
},
8989
},
9090
}
91-
"""JSON Schema describing serialized VDOM - see :ref:`VDOM Mimetype` for more info"""
91+
"""JSON Schema describing serialized VDOM - see :ref:`VDOM` for more info"""
9292

9393

9494
# we can't add a docstring to this because Sphinx doesn't know how to find its source
@@ -283,7 +283,7 @@ class _VdomDictRequired(TypedDict, total=True):
283283

284284

285285
class VdomDict(_VdomDictRequired, _VdomDictOptional):
286-
"""A VDOM dictionary - see :ref:`VDOM Mimetype` for more info"""
286+
"""A :ref:`VDOM` dictionary"""
287287

288288

289289
class ImportSourceDict(TypedDict):
@@ -306,10 +306,7 @@ class _RequiredVdomJson(TypedDict, total=True):
306306

307307

308308
class VdomJson(_RequiredVdomJson, _OptionalVdomJson):
309-
"""A JSON serializable form of :class:`VdomDict` compliant with :data:`VDOM_JSON_SCHEMA`
310-
311-
For more information on this form see :ref:`VDOM Mimetype`.
312-
"""
309+
"""A JSON serializable form of :class:`VdomDict` matching the :data:`VDOM_JSON_SCHEMA`"""
313310

314311

315312
class _JsonEventTarget(TypedDict):

0 commit comments

Comments
 (0)