@blockquote-web-components/blockquote-controller-xstate 2.1.2 → 2.2.0
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/README.md +13 -16
- package/package.json +3 -3
- package/src/BlockquoteControllerXstate.js +6 -10
package/README.md
CHANGED
|
@@ -114,9 +114,6 @@ export class XstateCounter extends LitElement {
|
|
|
114
114
|
constructor() {
|
|
115
115
|
super();
|
|
116
116
|
this._xstate = {};
|
|
117
|
-
this._inspectEvents = this._inspectEvents.bind(this);
|
|
118
|
-
this._callbackCounterController = this._callbackCounterController.bind(this);
|
|
119
|
-
|
|
120
117
|
this.counterController = new BlockquoteControllerXstate(this, {
|
|
121
118
|
machine: counterMachine,
|
|
122
119
|
options: {
|
|
@@ -126,15 +123,15 @@ export class XstateCounter extends LitElement {
|
|
|
126
123
|
});
|
|
127
124
|
}
|
|
128
125
|
|
|
129
|
-
_callbackCounterController
|
|
126
|
+
_callbackCounterController = snapshot => {
|
|
130
127
|
this._xstate = snapshot;
|
|
131
|
-
}
|
|
128
|
+
};
|
|
132
129
|
|
|
133
|
-
_inspectEvents
|
|
130
|
+
_inspectEvents = inspEvent => {
|
|
134
131
|
if (inspEvent.type === '@xstate.snapshot' && inspEvent.event.type === 'xstate.stop') {
|
|
135
132
|
this._xstate = {};
|
|
136
133
|
}
|
|
137
|
-
}
|
|
134
|
+
};
|
|
138
135
|
|
|
139
136
|
updated(props) {
|
|
140
137
|
super.updated && super.updated(props);
|
|
@@ -196,6 +193,7 @@ export class XstateCounter extends LitElement {
|
|
|
196
193
|
| ----------------- | ------- | ---- | ---------- | ----------- | -------------- |
|
|
197
194
|
| `actor` | | | | | |
|
|
198
195
|
| `snapshot` | | | | | |
|
|
196
|
+
| `onNext` | | | | | |
|
|
199
197
|
| `machine` | | | `machine` | | |
|
|
200
198
|
| `options` | | | `options` | | |
|
|
201
199
|
| `callback` | | | `callback` | | |
|
|
@@ -203,15 +201,14 @@ export class XstateCounter extends LitElement {
|
|
|
203
201
|
|
|
204
202
|
##### Methods
|
|
205
203
|
|
|
206
|
-
| Name | Privacy | Description | Parameters
|
|
207
|
-
| ------------------ | ------- | ----------- |
|
|
208
|
-
| `send` | | | `ev: EventFrom<typeof this.machine>`
|
|
209
|
-
| `unsubscribe` | | |
|
|
210
|
-
| `
|
|
211
|
-
| `
|
|
212
|
-
| `
|
|
213
|
-
| `
|
|
214
|
-
| `hostDisconnected` | | | | | |
|
|
204
|
+
| Name | Privacy | Description | Parameters | Return | Inherited From |
|
|
205
|
+
| ------------------ | ------- | ----------- | ------------------------------------ | ------ | -------------- |
|
|
206
|
+
| `send` | | | `ev: EventFrom<typeof this.machine>` | | |
|
|
207
|
+
| `unsubscribe` | | | | | |
|
|
208
|
+
| `startService` | | | | | |
|
|
209
|
+
| `stopService` | | | | | |
|
|
210
|
+
| `hostConnected` | | | | | |
|
|
211
|
+
| `hostDisconnected` | | | | | |
|
|
215
212
|
|
|
216
213
|
<hr/>
|
|
217
214
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockquote-web-components/blockquote-controller-xstate",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "This controller allows you to subscribe to an XState actor, updating a specified reactive property whenever the state machine transitions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lit",
|
|
@@ -98,11 +98,11 @@
|
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
100
|
"@blockquote-web-components/blockquote-base-common-dev-dependencies": "^1.9.1",
|
|
101
|
-
"@blockquote-web-components/blockquote-base-embedded-webview": "^1.
|
|
101
|
+
"@blockquote-web-components/blockquote-base-embedded-webview": "^1.11.0"
|
|
102
102
|
},
|
|
103
103
|
"publishConfig": {
|
|
104
104
|
"access": "public"
|
|
105
105
|
},
|
|
106
106
|
"customElements": "custom-elements.json",
|
|
107
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "015e61740035c23471a5164f460ce03b05adab32"
|
|
108
108
|
}
|
|
@@ -116,9 +116,6 @@ import { createActor } from 'xstate';
|
|
|
116
116
|
* constructor() {
|
|
117
117
|
* super();
|
|
118
118
|
* this._xstate = {};
|
|
119
|
-
* this._inspectEvents = this._inspectEvents.bind(this);
|
|
120
|
-
* this._callbackCounterController = this._callbackCounterController.bind(this);
|
|
121
|
-
*
|
|
122
119
|
* this.counterController = new BlockquoteControllerXstate(this, {
|
|
123
120
|
* machine: counterMachine,
|
|
124
121
|
* options: {
|
|
@@ -128,15 +125,15 @@ import { createActor } from 'xstate';
|
|
|
128
125
|
* });
|
|
129
126
|
* }
|
|
130
127
|
*
|
|
131
|
-
* _callbackCounterController
|
|
128
|
+
* _callbackCounterController = snapshot => {
|
|
132
129
|
* this._xstate = snapshot;
|
|
133
|
-
* }
|
|
130
|
+
* };
|
|
134
131
|
*
|
|
135
|
-
* _inspectEvents
|
|
132
|
+
* _inspectEvents = inspEvent => {
|
|
136
133
|
* if (inspEvent.type === '@xstate.snapshot' && inspEvent.event.type === 'xstate.stop') {
|
|
137
134
|
* this._xstate = {};
|
|
138
135
|
* }
|
|
139
|
-
* }
|
|
136
|
+
* };
|
|
140
137
|
*
|
|
141
138
|
* updated(props) {
|
|
142
139
|
* super.updated && super.updated(props);
|
|
@@ -201,7 +198,6 @@ class UseMachine {
|
|
|
201
198
|
this.options = options;
|
|
202
199
|
this.callback = callback;
|
|
203
200
|
this.currentSnapshot = this.snapshot;
|
|
204
|
-
this.onNext = this.onNext.bind(this);
|
|
205
201
|
|
|
206
202
|
(this.host = host).addController(this);
|
|
207
203
|
}
|
|
@@ -228,13 +224,13 @@ class UseMachine {
|
|
|
228
224
|
/**
|
|
229
225
|
* @param {import('xstate').SnapshotFrom<typeof this.machine>} snapshot
|
|
230
226
|
*/
|
|
231
|
-
onNext
|
|
227
|
+
onNext = snapshot => {
|
|
232
228
|
if (this.currentSnapshot !== snapshot) {
|
|
233
229
|
this.currentSnapshot = snapshot;
|
|
234
230
|
this.callback?.(snapshot);
|
|
235
231
|
this.host.requestUpdate();
|
|
236
232
|
}
|
|
237
|
-
}
|
|
233
|
+
};
|
|
238
234
|
|
|
239
235
|
startService() {
|
|
240
236
|
this.actorRef = createActor(this.machine, this.options);
|