|
1 | 1 | # Changelog |
2 | 2 |
|
| 3 | +## 4.1.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- [#63](https://github.com/tivac/xstate-component-tree/pull/63) [`d9d3820`](https://github.com/tivac/xstate-component-tree/commit/d9d38206146e3fb4f58da0f72985f9a016041df4) Thanks [@tivac](https://github.com/tivac)! - Added observable API |
| 8 | + |
| 9 | + Available on the `ComponentTree` instance as `.subscribe(callback)`, calls the callback function immediately with the most recent result and then will re-call it each time a build completes. |
| 10 | + |
| 11 | + Follows the [svelte store contract](https://svelte.dev/docs#component-format-script-4-prefix-stores-with-$-to-access-their-values-store-contract) which isn't _strictly_ compliant with any official observable APIs but is extremely simple and usable. |
| 12 | + |
| 13 | + The `callback` passed to `.subscribe(...)` will immediately be called with the most recent result of building the component tree (or `false` if it hasn't finished yet), and then for each complete tree building run after that the `callback` will be called with a single argument. The arg is an `Object` with a `null` prototype and the following properties: |
| 14 | + |
| 15 | + - `tree`, nested component structures. This is the same as the first argument to the older `new ComponentTree(service, callback)` API. |
| 16 | + - `state`, an [XState `State` instance ](https://paka.dev/npm/[email protected]/api#36a51e9234ff1a4d) representing the most recent state of the root statechart. |
| 17 | + - `matches(<state>)`, [`state.matches()`](https://xstate.js.org/docs/guides/states.html#state-matches-parentstatevalue) but for every statechart instance including any invoked statecharts. |
| 18 | + - `hasTag(<tag>)`, [`state.hasTag()`](https://xstate.js.org/docs/guides/states.html#state-hastag-tag) but for every statechart instance including any invoked statecharts. |
| 19 | + - `broadcast(<event>)`, [`service.send()`](https://xstate.js.org/docs/guides/interpretation.html#sending-events) but for every statechart instance including any invoked statecharts. Prefer using this instead of setting `invoke.autoForward` because it'll reduce the amount of junk events sent to invoked children. |
| 20 | + |
3 | 21 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. |
4 | 22 |
|
5 | 23 | ## [4.0.0](https://github.com/tivac/xstate-component-tree/compare/v3.5.0...v4.0.0) (2022-03-16) |
6 | 24 |
|
7 | | - |
8 | 25 | ### ⚠ BREAKING CHANGES |
9 | 26 |
|
10 | | -* previously the second arg to the callback function had a single `data` property on it representing the last `State` object seen by the top-level machine. Now it has `state` (same as data was previously), and some bound APIs for interacting with the statechart: `.hasTag()`, `.broadcast()`, and `.matches()`. These are the same APIs available on the `ComponentTree` instance but made available through the callback args for convenience. |
| 27 | +- previously the second arg to the callback function had a single `data` property on it representing the last `State` object seen by the top-level machine. Now it has `state` (same as data was previously), and some bound APIs for interacting with the statechart: `.hasTag()`, `.broadcast()`, and `.matches()`. These are the same APIs available on the `ComponentTree` instance but made available through the callback args for convenience. |
11 | 28 |
|
12 | 29 | ### Features |
13 | 30 |
|
14 | | -* make second callback arg useful ([#42](https://github.com/tivac/xstate-component-tree/issues/42)) ([0db0340](https://github.com/tivac/xstate-component-tree/commit/0db03406c8da42fe0d5b43e331d249710a4550f9)) |
| 31 | +- make second callback arg useful ([#42](https://github.com/tivac/xstate-component-tree/issues/42)) ([0db0340](https://github.com/tivac/xstate-component-tree/commit/0db03406c8da42fe0d5b43e331d249710a4550f9)) |
15 | 32 |
|
16 | 33 | ## [3.5.0](https://github.com/tivac/xstate-component-tree/compare/v3.4.2...v3.5.0) (2022-03-15) |
17 | 34 |
|
18 | | - |
19 | 35 | ### Features |
20 | 36 |
|
21 | | -* add .hasTag(), .matches(), and .broadcast() ([#41](https://github.com/tivac/xstate-component-tree/issues/41)) ([108ec3e](https://github.com/tivac/xstate-component-tree/commit/108ec3ee4f59c469c34f57d6265d8781e4c55a0b)) |
| 37 | +- add .hasTag(), .matches(), and .broadcast() ([#41](https://github.com/tivac/xstate-component-tree/issues/41)) ([108ec3e](https://github.com/tivac/xstate-component-tree/commit/108ec3ee4f59c469c34f57d6265d8781e4c55a0b)) |
22 | 38 |
|
23 | 39 | ### [3.4.2](https://github.com/tivac/xstate-component-tree/compare/v3.4.1...v3.4.2) (2022-02-20) |
24 | 40 |
|
25 | | - |
26 | 41 | ### Bug Fixes |
27 | 42 |
|
28 | | -* Use `./components` instead of `/components` for package.json subpath export. ([#34](https://github.com/tivac/xstate-component-tree/issues/34)) ([99b0e68](https://github.com/tivac/xstate-component-tree/commit/99b0e68319420013ab03d35c0a8165ced8e1ddac)) |
| 43 | +- Use `./components` instead of `/components` for package.json subpath export. ([#34](https://github.com/tivac/xstate-component-tree/issues/34)) ([99b0e68](https://github.com/tivac/xstate-component-tree/commit/99b0e68319420013ab03d35c0a8165ced8e1ddac)) |
29 | 44 |
|
30 | 45 | ### [3.4.1](https://github.com/tivac/xstate-component-tree/compare/v3.4.0...v3.4.1) (2021-11-24) |
31 | 46 |
|
32 | 47 | ## [3.4.0](https://github.com/tivac/xstate-component-tree/compare/v3.3.1...v3.4.0) (2021-11-24) |
33 | 48 |
|
34 | | - |
35 | 49 | ### Features |
36 | 50 |
|
37 | | -* Add component helper to xstate-component-tree package ([#29](https://github.com/tivac/xstate-component-tree/issues/29)) ([6e28384](https://github.com/tivac/xstate-component-tree/commit/6e28384f2483465d9b3fdaaf36b7e988ffb2bdb3)) |
| 51 | +- Add component helper to xstate-component-tree package ([#29](https://github.com/tivac/xstate-component-tree/issues/29)) ([6e28384](https://github.com/tivac/xstate-component-tree/commit/6e28384f2483465d9b3fdaaf36b7e988ffb2bdb3)) |
38 | 52 |
|
39 | 53 | ## [3.3.1](https://github.com/tivac/xstate-component-tree/compare/v3.3.0...v3.3.1) (2020-10-03) |
40 | 54 |
|
41 | | - |
42 | 55 | ### Bug Fixes |
43 | 56 |
|
44 | | -* clear dist when building ([068f209](https://github.com/tivac/xstate-component-tree/commit/068f2093f8d37b7dc431f1ffe7341fbeb2e7e773)) |
45 | | - |
46 | | - |
| 57 | +- clear dist when building ([068f209](https://github.com/tivac/xstate-component-tree/commit/068f2093f8d37b7dc431f1ffe7341fbeb2e7e773)) |
47 | 58 |
|
48 | 59 | # [3.3.0](https://github.com/tivac/xstate-component-tree/compare/v3.2.0...v3.3.0) (2020-10-03) |
49 | 60 |
|
50 | | - |
51 | 61 | ### Bug Fixes |
52 | 62 |
|
53 | | -* prevent zombie children running ([#16](https://github.com/tivac/xstate-component-tree/issues/16)) ([6f49b85](https://github.com/tivac/xstate-component-tree/commit/6f49b8596cc67683b623346487edffde1a850de2)) |
54 | | - |
55 | | - |
| 63 | +- prevent zombie children running ([#16](https://github.com/tivac/xstate-component-tree/issues/16)) ([6f49b85](https://github.com/tivac/xstate-component-tree/commit/6f49b8596cc67683b623346487edffde1a850de2)) |
56 | 64 |
|
57 | 65 | # [3.2.0](https://github.com/tivac/xstate-component-tree/compare/v3.1.2...v3.2.0) (2020-08-07) |
58 | 66 |
|
59 | | - |
60 | 67 | ### Features |
61 | 68 |
|
62 | | -* add stable option ([#14](https://github.com/tivac/xstate-component-tree/issues/14)) ([e37e1db](https://github.com/tivac/xstate-component-tree/commit/e37e1dbda3ffc05d9d404a6b99aa26c510ecaee9)) |
63 | | - |
64 | | - |
| 69 | +- add stable option ([#14](https://github.com/tivac/xstate-component-tree/issues/14)) ([e37e1db](https://github.com/tivac/xstate-component-tree/commit/e37e1dbda3ffc05d9d404a6b99aa26c510ecaee9)) |
65 | 70 |
|
66 | 71 | ## [3.1.2](https://github.com/tivac/xstate-component-tree/compare/v3.1.1...v3.1.2) (2020-08-06) |
67 | 72 |
|
68 | | - |
69 | | - |
70 | 73 | ## [3.1.1](https://github.com/tivac/xstate-component-tree/compare/v3.1.0...v3.1.1) (2020-08-06) |
71 | 74 |
|
72 | | - |
73 | 75 | ### Bug Fixes |
74 | 76 |
|
75 | | -* remove object spread ([#12](https://github.com/tivac/xstate-component-tree/issues/12)) ([3770ca4](https://github.com/tivac/xstate-component-tree/commit/3770ca4dadd63584f98ac379840b359df202a611)) |
76 | | - |
77 | | - |
| 77 | +- remove object spread ([#12](https://github.com/tivac/xstate-component-tree/issues/12)) ([3770ca4](https://github.com/tivac/xstate-component-tree/commit/3770ca4dadd63584f98ac379840b359df202a611)) |
78 | 78 |
|
79 | 79 | # [3.1.0](https://github.com/tivac/xstate-component-tree/compare/v3.0.0...v3.1.0) (2020-07-21) |
80 | 80 |
|
81 | | - |
82 | 81 | ### Features |
83 | 82 |
|
84 | | -* add path to return objects ([#11](https://github.com/tivac/xstate-component-tree/issues/11)) ([e6f266b](https://github.com/tivac/xstate-component-tree/commit/e6f266b74bbb946ba808fd21ce00a60a48514316)) |
85 | | - |
86 | | - |
| 83 | +- add path to return objects ([#11](https://github.com/tivac/xstate-component-tree/issues/11)) ([e6f266b](https://github.com/tivac/xstate-component-tree/commit/e6f266b74bbb946ba808fd21ce00a60a48514316)) |
87 | 84 |
|
88 | 85 | # [3.0.0](https://github.com/tivac/xstate-component-tree/compare/v2.0.1...v3.0.0) (2020-03-15) |
89 | 86 |
|
90 | | - |
91 | 87 | ### Features |
92 | 88 |
|
93 | | -* caching load methods ([d534245](https://github.com/tivac/xstate-component-tree/commit/d5342456669c854ae0269798f34f1ac6666658e9)) |
94 | | - |
| 89 | +- caching load methods ([d534245](https://github.com/tivac/xstate-component-tree/commit/d5342456669c854ae0269798f34f1ac6666658e9)) |
95 | 90 |
|
96 | 91 | ### BREAKING CHANGES |
97 | 92 |
|
98 | | -* - Only 1 callback per tree change, no matter if it was the deepest child or the root machine. |
99 | | -- Updated `load()` support so it can take either a `component` or `[ component, props ]` as a return and the overall `load()` as well as either `component` or `props` will be `await`ed. |
100 | | - |
| 93 | +- - Only 1 callback per tree change, no matter if it was the deepest child or the root machine. |
101 | 94 |
|
| 95 | +* Updated `load()` support so it can take either a `component` or `[ component, props ]` as a return and the overall `load()` as well as either `component` or `props` will be `await`ed. |
102 | 96 |
|
103 | 97 | ## [2.0.1](https://github.com/tivac/xstate-component-tree/compare/v2.0.0...v2.0.1) (2019-12-14) |
104 | 98 |
|
105 | | - |
106 | 99 | ### Bug Fixes |
107 | 100 |
|
108 | | -* svelte example 2.0 compat ([4a7f0da](https://github.com/tivac/xstate-component-tree/commit/4a7f0da3978aba9fdea3eb2a4fbd351dffb818e5)) |
109 | | - |
110 | | - |
| 101 | +- svelte example 2.0 compat ([4a7f0da](https://github.com/tivac/xstate-component-tree/commit/4a7f0da3978aba9fdea3eb2a4fbd351dffb818e5)) |
111 | 102 |
|
112 | 103 | # [2.0.0](https://github.com/tivac/xstate-component-tree/compare/v1.0.0...v2.0.0) (2019-12-13) |
113 | 104 |
|
114 | | - |
115 | 105 | ### Features |
116 | 106 |
|
117 | | -* insert child machine trees into parent tree ([#2](https://github.com/tivac/xstate-component-tree/issues/2)) ([7357d40](https://github.com/tivac/xstate-component-tree/commit/7357d408cd7011f9e9e82aa40ad9922eec818038)) |
118 | | - |
| 107 | +- insert child machine trees into parent tree ([#2](https://github.com/tivac/xstate-component-tree/issues/2)) ([7357d40](https://github.com/tivac/xstate-component-tree/commit/7357d408cd7011f9e9e82aa40ad9922eec818038)) |
119 | 108 |
|
120 | 109 | ### BREAKING CHANGES |
121 | 110 |
|
122 | | -* The output format has changed to no longer have an array of machines at the top-level, instead it is just the top-level components representing active states. Invoked machines are no longer part of the top-level array but now inserted into the tree of components based on the location of the component that invoked them. |
123 | | - |
124 | | - |
| 111 | +- The output format has changed to no longer have an array of machines at the top-level, instead it is just the top-level components representing active states. Invoked machines are no longer part of the top-level array but now inserted into the tree of components based on the location of the component that invoked them. |
125 | 112 |
|
126 | 113 | # [1.0.0](https://github.com/tivac/xstate-component-tree/compare/v0.1.0...v1.0.0) (2019-10-27) |
127 | 114 |
|
128 | | - |
129 | | - |
130 | 115 | # [0.1.0](https://github.com/tivac/xstate-component-tree/compare/cc0106fe07f8c7042df3558c50f96349323cb36c...v0.1.0) (2019-10-27) |
131 | 116 |
|
132 | | - |
133 | 117 | ### Bug Fixes |
134 | 118 |
|
135 | | -* invokes removed from output ([cc0106f](https://github.com/tivac/xstate-component-tree/commit/cc0106fe07f8c7042df3558c50f96349323cb36c)) |
136 | | - |
| 119 | +- invokes removed from output ([cc0106f](https://github.com/tivac/xstate-component-tree/commit/cc0106fe07f8c7042df3558c50f96349323cb36c)) |
137 | 120 |
|
138 | 121 | ### Features |
139 | 122 |
|
140 | | -* add ability to unsub from changes ([5fe766a](https://github.com/tivac/xstate-component-tree/commit/5fe766a0162506936fba3d44fcaad938cb544c36)) |
141 | | -* add props support ([0bc1954](https://github.com/tivac/xstate-component-tree/commit/0bc1954239756ffe9948d3b0818bb5709e07aec3)) |
142 | | - |
143 | | - |
144 | | - |
| 123 | +- add ability to unsub from changes ([5fe766a](https://github.com/tivac/xstate-component-tree/commit/5fe766a0162506936fba3d44fcaad938cb544c36)) |
| 124 | +- add props support ([0bc1954](https://github.com/tivac/xstate-component-tree/commit/0bc1954239756ffe9948d3b0818bb5709e07aec3)) |
0 commit comments