tutuca 1.0.0-beta.1 → 1.0.0-beta.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,59 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.0-beta.2
4
+
5
+ Messages are delivered by identity as well as by path, following the tree model in
6
+ `spec/tree`: a reply, a `sendAt` or a notification's next hop no longer reaches whatever
7
+ component took the path in the meantime. See [`docs/paths.md`](docs/paths.md).
8
+
9
+ ### Breaking
10
+
11
+ - **Asks are answered in an `answers` section.** `answers: { load: { ok, error, unhandled } }`
12
+ replaces the `xReplyOk` / `xReplyError` / `xHandlerNotFound` messages, and a send can't forge
13
+ one. `ctx.ask` returns a request id, which the answer's handler reads as `ctx.request`.
14
+ Stories answer asks with `step.answer`, tests with `driver.answer`. The lint checks the
15
+ section and warns about an ask a message emits with no answers for it.
16
+ - **An ask handler only answers.** It's called with the ask's arguments and `ctx.readOnly()`,
17
+ a frozen view of the asker's scope, path, source key and `now` / `random` / `uuid`, with
18
+ nothing to send with. The ask starts once the task that asked commits, so a failed task
19
+ never starts one, and its answer runs as a task of its own; an answer that throws fails only
20
+ itself.
21
+ - **A task made outside a handler is addressed with `task.prepare(root)`.**
22
+ `Host.prepareTask` is gone.
23
+ - **A message's context stages what its handler sends** in its own list, which the host
24
+ queues once the task commits.
25
+
26
+ ### Changes
27
+
28
+ - **Messages carry a sender and a receiver `Address`**, each a path and the identity it
29
+ reached. Every component instance has an identity, fresh when it's made or when a handler
30
+ returns a new one, and kept by updates. `ctx.reply(name, args)` sends to the sender of the
31
+ message being handled; `HOST` is the sender of DOM events and ask answers. A task whose
32
+ receiver was replaced is dropped and reported `stale`; one whose path reaches no component is
33
+ reported `orphaned`.
34
+ - **Notifications bubble in one turn.** Their hops are the sender's ancestors when the
35
+ bubble starts and run back to back, ahead of the queue. An ancestor without a handler passes
36
+ one on silently; one that no hop handled is reported `unhandled` once, at the root.
37
+ - **A message with no handler is a no-op that's reported** (`Host.notify("unhandled", { task,
38
+ message })`), whatever sent it, a DOM event included: components compose dynamically, so a
39
+ view can send a message its component lacks.
40
+ - **The host reports instead of throwing**: a render that throws is `renderFailed`, an event
41
+ the DOM can't route is `eventFailed`, and a stopped host drops late tasks.
42
+ - A handler's `emits` contract counts only what that handler emitted.
43
+ - `sourceKey` is `null` for a sender in another branch.
44
+ - Records and `oneOf` defaults meet the constraints of what they are made of: a record key
45
+ whose default breaks its constraints throws `NoDefaultError` naming the key, and a `oneOf`
46
+ makes its first alternative.
47
+
48
+ ### Fixes
49
+
50
+ - Morphing matches vnodes only to the nodes render made, so nodes other code puts in a
51
+ rendered element (an extension, a third-party widget, a foreign comment) stay in place.
52
+ - Routing and drags read `data-eid`, `data-dragtype` and the drag marks as attributes instead of
53
+ through `dataset`, which MathML elements lack, so a click on a formula reaches its handler.
54
+ - The vdom prebuilds constant children and elements once per view, and decides by itself
55
+ which attributes must stay dynamic.
56
+
3
57
  ## 1.0.0-beta.1
4
58
 
5
59
  Tutuca 1.0 is a rewrite. It keeps the core ideas of 0.x, but the API, the view language and the