@warp-drive-mirror/ember 5.8.0-alpha.37 → 5.8.0-alpha.40
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/dist/unpkg/dev/index.js +7 -16
- package/dist/unpkg/dev/install.js +13 -41
- package/dist/unpkg/dev-deprecated/index.js +7 -16
- package/dist/unpkg/dev-deprecated/install.js +15 -12
- package/dist/unpkg/prod/index.js +1 -21
- package/dist/unpkg/prod/install.js +3 -44
- package/dist/unpkg/prod-deprecated/index.js +1 -21
- package/dist/unpkg/prod-deprecated/install.js +5 -15
- package/package.json +12 -20
- package/dist/unpkg/dev/declarations/-private/await.d.ts +0 -81
- package/dist/unpkg/dev/declarations/-private/request.d.ts +0 -289
- package/dist/unpkg/dev/declarations/index.d.ts +0 -8
- package/dist/unpkg/dev/declarations/install.d.ts +0 -6
- package/dist/unpkg/dev-deprecated/declarations/-private/await.d.ts +0 -81
- package/dist/unpkg/dev-deprecated/declarations/-private/request.d.ts +0 -289
- package/dist/unpkg/dev-deprecated/declarations/index.d.ts +0 -8
- package/dist/unpkg/dev-deprecated/declarations/install.d.ts +0 -6
- package/dist/unpkg/prod/declarations/-private/await.d.ts +0 -81
- package/dist/unpkg/prod/declarations/-private/request.d.ts +0 -289
- package/dist/unpkg/prod/declarations/index.d.ts +0 -8
- package/dist/unpkg/prod/declarations/install.d.ts +0 -6
- package/dist/unpkg/prod-deprecated/declarations/-private/await.d.ts +0 -81
- package/dist/unpkg/prod-deprecated/declarations/-private/request.d.ts +0 -289
- package/dist/unpkg/prod-deprecated/declarations/index.d.ts +0 -8
- package/dist/unpkg/prod-deprecated/declarations/install.d.ts +0 -6
package/dist/unpkg/dev/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { service } from '@ember/service';
|
|
2
2
|
import Component from '@glimmer/component';
|
|
3
|
-
import { macroCondition, getGlobalConfig, moduleExists, importSync } from '@embroider/macros';
|
|
4
3
|
import { DISPOSE, createRequestSubscription, memoized } from '@warp-drive-mirror/core/store/-private';
|
|
5
4
|
export { createRequestSubscription, getRequestState } from '@warp-drive-mirror/core/store/-private';
|
|
6
5
|
import { getPromiseState } from '@warp-drive-mirror/core/reactive';
|
|
@@ -28,10 +27,8 @@ class Throw extends Component {
|
|
|
28
27
|
super(owner, args);
|
|
29
28
|
// this error is opaque (user supplied) so we don't validate it
|
|
30
29
|
// as an Error instance.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
console.error(this.args.error);
|
|
34
|
-
} else {
|
|
30
|
+
|
|
31
|
+
{
|
|
35
32
|
// eslint-disable-next-line @typescript-eslint/only-throw-error
|
|
36
33
|
throw this.args.error;
|
|
37
34
|
}
|
|
@@ -164,22 +161,16 @@ function initializeDeferredDecorator(target, prop) {
|
|
|
164
161
|
}
|
|
165
162
|
|
|
166
163
|
function notNull(x) {
|
|
167
|
-
|
|
164
|
+
(test => {
|
|
168
165
|
if (!test) {
|
|
169
166
|
throw new Error('Expected a non-null value, but got null');
|
|
170
167
|
}
|
|
171
|
-
})(x !== null)
|
|
168
|
+
})(x !== null);
|
|
172
169
|
return x;
|
|
173
170
|
}
|
|
174
171
|
const not = x => !x;
|
|
175
172
|
const IdleBlockMissingError = new Error('No idle block provided for <Request> component, and no query or request was provided.');
|
|
176
173
|
let consume = service;
|
|
177
|
-
if (macroCondition(moduleExists('ember-provide-consume-context'))) {
|
|
178
|
-
const {
|
|
179
|
-
consume: contextConsume
|
|
180
|
-
} = importSync('ember-provide-consume-context');
|
|
181
|
-
consume = contextConsume;
|
|
182
|
-
}
|
|
183
174
|
const DefaultChrome = setComponentTemplate(precompileTemplate("{{yield}}", {
|
|
184
175
|
strictMode: true
|
|
185
176
|
}), templateOnly());
|
|
@@ -412,11 +403,11 @@ class Request extends Component {
|
|
|
412
403
|
*/
|
|
413
404
|
get store() {
|
|
414
405
|
const store = this.args.store || this._store;
|
|
415
|
-
|
|
406
|
+
(test => {
|
|
416
407
|
if (!test) {
|
|
417
|
-
throw new Error(
|
|
408
|
+
throw new Error(`No store was provided to the <Request> component. Either provide a store via the @store arg or by registering a store service.`);
|
|
418
409
|
}
|
|
419
|
-
})(store)
|
|
410
|
+
})(store);
|
|
420
411
|
return store;
|
|
421
412
|
}
|
|
422
413
|
_state = null;
|
|
@@ -1,58 +1,31 @@
|
|
|
1
1
|
import { tagForProperty } from '@ember/-internals/metal';
|
|
2
2
|
import { _backburner } from '@ember/runloop';
|
|
3
|
-
import { createCache,
|
|
4
|
-
import { macroCondition, getGlobalConfig, importSync } from '@embroider/macros';
|
|
3
|
+
import { createCache, getValue, dirtyTag, consumeTag } from '@glimmer/validator';
|
|
5
4
|
import { setupSignals } from '@warp-drive-mirror/core/configure';
|
|
5
|
+
import * as _importSync20 from '@ember/test-waiters';
|
|
6
|
+
|
|
7
|
+
function esCompat(m) {
|
|
8
|
+
return m?.__esModule ? m : {
|
|
9
|
+
default: m,
|
|
10
|
+
...m
|
|
11
|
+
};
|
|
12
|
+
}
|
|
6
13
|
|
|
7
14
|
const emberDirtyTag = dirtyTag;
|
|
8
15
|
function buildSignalConfig(options) {
|
|
9
|
-
|
|
16
|
+
options.wellknown.Array;
|
|
10
17
|
return {
|
|
11
18
|
createSignal(obj, key) {
|
|
12
|
-
if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_COMPUTED_CHAINS)) {
|
|
13
|
-
if (key === ARRAY_SIGNAL) {
|
|
14
|
-
return [tagForProperty(obj, key), tagForProperty(obj, 'length'), tagForProperty(obj, '[]')];
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
19
|
return tagForProperty(obj, key);
|
|
18
20
|
},
|
|
19
21
|
consumeSignal(signal) {
|
|
20
|
-
if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_COMPUTED_CHAINS)) {
|
|
21
|
-
if (Array.isArray(signal)) {
|
|
22
|
-
consumeTag(signal[0]);
|
|
23
|
-
consumeTag(signal[1]);
|
|
24
|
-
consumeTag(signal[2]);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
22
|
consumeTag(signal);
|
|
29
23
|
},
|
|
30
24
|
notifySignal(signal) {
|
|
31
|
-
if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_COMPUTED_CHAINS)) {
|
|
32
|
-
if (Array.isArray(signal)) {
|
|
33
|
-
emberDirtyTag(signal[0]);
|
|
34
|
-
emberDirtyTag(signal[1]);
|
|
35
|
-
emberDirtyTag(signal[2]);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
25
|
emberDirtyTag(signal);
|
|
40
26
|
},
|
|
41
27
|
createMemo: (object, key, fn) => {
|
|
42
|
-
|
|
43
|
-
const propertyTag = tagForProperty(object, key);
|
|
44
|
-
const memo = createCache(fn);
|
|
45
|
-
let ret;
|
|
46
|
-
const wrappedFn = () => {
|
|
47
|
-
ret = getValue(memo);
|
|
48
|
-
};
|
|
49
|
-
return () => {
|
|
50
|
-
const tag = track(wrappedFn);
|
|
51
|
-
updateTag(propertyTag, tag);
|
|
52
|
-
consumeTag(tag);
|
|
53
|
-
return ret;
|
|
54
|
-
};
|
|
55
|
-
} else {
|
|
28
|
+
{
|
|
56
29
|
const memo = createCache(fn);
|
|
57
30
|
return () => getValue(memo);
|
|
58
31
|
}
|
|
@@ -62,13 +35,12 @@ function buildSignalConfig(options) {
|
|
|
62
35
|
return !!_backburner.currentInstance && _backburner._autorun !== true;
|
|
63
36
|
},
|
|
64
37
|
waitFor: async promise => {
|
|
65
|
-
|
|
38
|
+
{
|
|
66
39
|
const {
|
|
67
40
|
waitForPromise
|
|
68
|
-
} =
|
|
41
|
+
} = esCompat(_importSync20);
|
|
69
42
|
return waitForPromise(promise);
|
|
70
43
|
}
|
|
71
|
-
return promise;
|
|
72
44
|
}
|
|
73
45
|
};
|
|
74
46
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { service } from '@ember/service';
|
|
2
2
|
import Component from '@glimmer/component';
|
|
3
|
-
import { macroCondition, getGlobalConfig, moduleExists, importSync } from '@embroider/macros';
|
|
4
3
|
import { DISPOSE, createRequestSubscription, memoized } from '@warp-drive-mirror/core/store/-private';
|
|
5
4
|
export { createRequestSubscription, getRequestState } from '@warp-drive-mirror/core/store/-private';
|
|
6
5
|
import { getPromiseState } from '@warp-drive-mirror/core/reactive';
|
|
@@ -28,10 +27,8 @@ class Throw extends Component {
|
|
|
28
27
|
super(owner, args);
|
|
29
28
|
// this error is opaque (user supplied) so we don't validate it
|
|
30
29
|
// as an Error instance.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
console.error(this.args.error);
|
|
34
|
-
} else {
|
|
30
|
+
|
|
31
|
+
{
|
|
35
32
|
// eslint-disable-next-line @typescript-eslint/only-throw-error
|
|
36
33
|
throw this.args.error;
|
|
37
34
|
}
|
|
@@ -164,22 +161,16 @@ function initializeDeferredDecorator(target, prop) {
|
|
|
164
161
|
}
|
|
165
162
|
|
|
166
163
|
function notNull(x) {
|
|
167
|
-
|
|
164
|
+
(test => {
|
|
168
165
|
if (!test) {
|
|
169
166
|
throw new Error('Expected a non-null value, but got null');
|
|
170
167
|
}
|
|
171
|
-
})(x !== null)
|
|
168
|
+
})(x !== null);
|
|
172
169
|
return x;
|
|
173
170
|
}
|
|
174
171
|
const not = x => !x;
|
|
175
172
|
const IdleBlockMissingError = new Error('No idle block provided for <Request> component, and no query or request was provided.');
|
|
176
173
|
let consume = service;
|
|
177
|
-
if (macroCondition(moduleExists('ember-provide-consume-context'))) {
|
|
178
|
-
const {
|
|
179
|
-
consume: contextConsume
|
|
180
|
-
} = importSync('ember-provide-consume-context');
|
|
181
|
-
consume = contextConsume;
|
|
182
|
-
}
|
|
183
174
|
const DefaultChrome = setComponentTemplate(precompileTemplate("{{yield}}", {
|
|
184
175
|
strictMode: true
|
|
185
176
|
}), templateOnly());
|
|
@@ -412,11 +403,11 @@ class Request extends Component {
|
|
|
412
403
|
*/
|
|
413
404
|
get store() {
|
|
414
405
|
const store = this.args.store || this._store;
|
|
415
|
-
|
|
406
|
+
(test => {
|
|
416
407
|
if (!test) {
|
|
417
|
-
throw new Error(
|
|
408
|
+
throw new Error(`No store was provided to the <Request> component. Either provide a store via the @store arg or by registering a store service.`);
|
|
418
409
|
}
|
|
419
|
-
})(store)
|
|
410
|
+
})(store);
|
|
420
411
|
return store;
|
|
421
412
|
}
|
|
422
413
|
_state = null;
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import { tagForProperty } from '@ember/-internals/metal';
|
|
2
2
|
import { _backburner } from '@ember/runloop';
|
|
3
|
-
import { createCache, track, updateTag, consumeTag,
|
|
4
|
-
import { macroCondition, getGlobalConfig, importSync } from '@embroider/macros';
|
|
3
|
+
import { createCache, track, updateTag, consumeTag, dirtyTag, getValue } from '@glimmer/validator';
|
|
5
4
|
import { setupSignals } from '@warp-drive-mirror/core/configure';
|
|
5
|
+
import * as _importSync20 from '@ember/test-waiters';
|
|
6
|
+
|
|
7
|
+
function esCompat(m) {
|
|
8
|
+
return m?.__esModule ? m : {
|
|
9
|
+
default: m,
|
|
10
|
+
...m
|
|
11
|
+
};
|
|
12
|
+
}
|
|
6
13
|
|
|
7
14
|
const emberDirtyTag = dirtyTag;
|
|
8
15
|
function buildSignalConfig(options) {
|
|
9
16
|
const ARRAY_SIGNAL = options.wellknown.Array;
|
|
10
17
|
return {
|
|
11
18
|
createSignal(obj, key) {
|
|
12
|
-
|
|
19
|
+
{
|
|
13
20
|
if (key === ARRAY_SIGNAL) {
|
|
14
21
|
return [tagForProperty(obj, key), tagForProperty(obj, 'length'), tagForProperty(obj, '[]')];
|
|
15
22
|
}
|
|
@@ -17,7 +24,7 @@ function buildSignalConfig(options) {
|
|
|
17
24
|
return tagForProperty(obj, key);
|
|
18
25
|
},
|
|
19
26
|
consumeSignal(signal) {
|
|
20
|
-
|
|
27
|
+
{
|
|
21
28
|
if (Array.isArray(signal)) {
|
|
22
29
|
consumeTag(signal[0]);
|
|
23
30
|
consumeTag(signal[1]);
|
|
@@ -28,7 +35,7 @@ function buildSignalConfig(options) {
|
|
|
28
35
|
consumeTag(signal);
|
|
29
36
|
},
|
|
30
37
|
notifySignal(signal) {
|
|
31
|
-
|
|
38
|
+
{
|
|
32
39
|
if (Array.isArray(signal)) {
|
|
33
40
|
emberDirtyTag(signal[0]);
|
|
34
41
|
emberDirtyTag(signal[1]);
|
|
@@ -39,7 +46,7 @@ function buildSignalConfig(options) {
|
|
|
39
46
|
emberDirtyTag(signal);
|
|
40
47
|
},
|
|
41
48
|
createMemo: (object, key, fn) => {
|
|
42
|
-
|
|
49
|
+
{
|
|
43
50
|
const propertyTag = tagForProperty(object, key);
|
|
44
51
|
const memo = createCache(fn);
|
|
45
52
|
let ret;
|
|
@@ -52,9 +59,6 @@ function buildSignalConfig(options) {
|
|
|
52
59
|
consumeTag(tag);
|
|
53
60
|
return ret;
|
|
54
61
|
};
|
|
55
|
-
} else {
|
|
56
|
-
const memo = createCache(fn);
|
|
57
|
-
return () => getValue(memo);
|
|
58
62
|
}
|
|
59
63
|
},
|
|
60
64
|
willSyncFlushWatchers: () => {
|
|
@@ -62,13 +66,12 @@ function buildSignalConfig(options) {
|
|
|
62
66
|
return !!_backburner.currentInstance && _backburner._autorun !== true;
|
|
63
67
|
},
|
|
64
68
|
waitFor: async promise => {
|
|
65
|
-
|
|
69
|
+
{
|
|
66
70
|
const {
|
|
67
71
|
waitForPromise
|
|
68
|
-
} =
|
|
72
|
+
} = esCompat(_importSync20);
|
|
69
73
|
return waitForPromise(promise);
|
|
70
74
|
}
|
|
71
|
-
return promise;
|
|
72
75
|
}
|
|
73
76
|
};
|
|
74
77
|
}
|
package/dist/unpkg/prod/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { service } from '@ember/service';
|
|
2
2
|
import Component from '@glimmer/component';
|
|
3
|
-
import { macroCondition, getGlobalConfig, moduleExists, importSync } from '@embroider/macros';
|
|
4
3
|
import { DISPOSE, createRequestSubscription, memoized } from '@warp-drive-mirror/core/store/-private';
|
|
5
4
|
export { createRequestSubscription, getRequestState } from '@warp-drive-mirror/core/store/-private';
|
|
6
5
|
import { getPromiseState } from '@warp-drive-mirror/core/reactive';
|
|
@@ -28,12 +27,9 @@ class Throw extends Component {
|
|
|
28
27
|
super(owner, args);
|
|
29
28
|
// this error is opaque (user supplied) so we don't validate it
|
|
30
29
|
// as an Error instance.
|
|
31
|
-
|
|
30
|
+
{
|
|
32
31
|
// eslint-disable-next-line no-console
|
|
33
32
|
console.error(this.args.error);
|
|
34
|
-
} else {
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/only-throw-error
|
|
36
|
-
throw this.args.error;
|
|
37
33
|
}
|
|
38
34
|
}
|
|
39
35
|
static {
|
|
@@ -164,22 +160,11 @@ function initializeDeferredDecorator(target, prop) {
|
|
|
164
160
|
}
|
|
165
161
|
|
|
166
162
|
function notNull(x) {
|
|
167
|
-
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
168
|
-
if (!test) {
|
|
169
|
-
throw new Error('Expected a non-null value, but got null');
|
|
170
|
-
}
|
|
171
|
-
})(x !== null) : {};
|
|
172
163
|
return x;
|
|
173
164
|
}
|
|
174
165
|
const not = x => !x;
|
|
175
166
|
const IdleBlockMissingError = new Error('No idle block provided for <Request> component, and no query or request was provided.');
|
|
176
167
|
let consume = service;
|
|
177
|
-
if (macroCondition(moduleExists('ember-provide-consume-context'))) {
|
|
178
|
-
const {
|
|
179
|
-
consume: contextConsume
|
|
180
|
-
} = importSync('ember-provide-consume-context');
|
|
181
|
-
consume = contextConsume;
|
|
182
|
-
}
|
|
183
168
|
const DefaultChrome = setComponentTemplate(precompileTemplate("{{yield}}", {
|
|
184
169
|
strictMode: true
|
|
185
170
|
}), templateOnly());
|
|
@@ -412,11 +397,6 @@ class Request extends Component {
|
|
|
412
397
|
*/
|
|
413
398
|
get store() {
|
|
414
399
|
const store = this.args.store || this._store;
|
|
415
|
-
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
416
|
-
if (!test) {
|
|
417
|
-
throw new Error(moduleExists('ember-provide-consume-context') ? `No store was provided to the <Request> component. Either provide a store via the @store arg or via the context API provided by ember-provide-consume-context.` : `No store was provided to the <Request> component. Either provide a store via the @store arg or by registering a store service.`);
|
|
418
|
-
}
|
|
419
|
-
})(store) : {};
|
|
420
400
|
return store;
|
|
421
401
|
}
|
|
422
402
|
_state = null;
|
|
@@ -1,58 +1,23 @@
|
|
|
1
1
|
import { tagForProperty } from '@ember/-internals/metal';
|
|
2
2
|
import { _backburner } from '@ember/runloop';
|
|
3
|
-
import { createCache,
|
|
4
|
-
import { macroCondition, getGlobalConfig, importSync } from '@embroider/macros';
|
|
3
|
+
import { createCache, getValue, dirtyTag, consumeTag } from '@glimmer/validator';
|
|
5
4
|
import { setupSignals } from '@warp-drive-mirror/core/configure';
|
|
6
5
|
|
|
7
6
|
const emberDirtyTag = dirtyTag;
|
|
8
7
|
function buildSignalConfig(options) {
|
|
9
|
-
|
|
8
|
+
options.wellknown.Array;
|
|
10
9
|
return {
|
|
11
10
|
createSignal(obj, key) {
|
|
12
|
-
if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_COMPUTED_CHAINS)) {
|
|
13
|
-
if (key === ARRAY_SIGNAL) {
|
|
14
|
-
return [tagForProperty(obj, key), tagForProperty(obj, 'length'), tagForProperty(obj, '[]')];
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
11
|
return tagForProperty(obj, key);
|
|
18
12
|
},
|
|
19
13
|
consumeSignal(signal) {
|
|
20
|
-
if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_COMPUTED_CHAINS)) {
|
|
21
|
-
if (Array.isArray(signal)) {
|
|
22
|
-
consumeTag(signal[0]);
|
|
23
|
-
consumeTag(signal[1]);
|
|
24
|
-
consumeTag(signal[2]);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
14
|
consumeTag(signal);
|
|
29
15
|
},
|
|
30
16
|
notifySignal(signal) {
|
|
31
|
-
if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_COMPUTED_CHAINS)) {
|
|
32
|
-
if (Array.isArray(signal)) {
|
|
33
|
-
emberDirtyTag(signal[0]);
|
|
34
|
-
emberDirtyTag(signal[1]);
|
|
35
|
-
emberDirtyTag(signal[2]);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
17
|
emberDirtyTag(signal);
|
|
40
18
|
},
|
|
41
19
|
createMemo: (object, key, fn) => {
|
|
42
|
-
|
|
43
|
-
const propertyTag = tagForProperty(object, key);
|
|
44
|
-
const memo = createCache(fn);
|
|
45
|
-
let ret;
|
|
46
|
-
const wrappedFn = () => {
|
|
47
|
-
ret = getValue(memo);
|
|
48
|
-
};
|
|
49
|
-
return () => {
|
|
50
|
-
const tag = track(wrappedFn);
|
|
51
|
-
updateTag(propertyTag, tag);
|
|
52
|
-
consumeTag(tag);
|
|
53
|
-
return ret;
|
|
54
|
-
};
|
|
55
|
-
} else {
|
|
20
|
+
{
|
|
56
21
|
const memo = createCache(fn);
|
|
57
22
|
return () => getValue(memo);
|
|
58
23
|
}
|
|
@@ -62,12 +27,6 @@ function buildSignalConfig(options) {
|
|
|
62
27
|
return !!_backburner.currentInstance && _backburner._autorun !== true;
|
|
63
28
|
},
|
|
64
29
|
waitFor: async promise => {
|
|
65
|
-
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.TESTING)) {
|
|
66
|
-
const {
|
|
67
|
-
waitForPromise
|
|
68
|
-
} = importSync('@ember/test-waiters');
|
|
69
|
-
return waitForPromise(promise);
|
|
70
|
-
}
|
|
71
30
|
return promise;
|
|
72
31
|
}
|
|
73
32
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { service } from '@ember/service';
|
|
2
2
|
import Component from '@glimmer/component';
|
|
3
|
-
import { macroCondition, getGlobalConfig, moduleExists, importSync } from '@embroider/macros';
|
|
4
3
|
import { DISPOSE, createRequestSubscription, memoized } from '@warp-drive-mirror/core/store/-private';
|
|
5
4
|
export { createRequestSubscription, getRequestState } from '@warp-drive-mirror/core/store/-private';
|
|
6
5
|
import { getPromiseState } from '@warp-drive-mirror/core/reactive';
|
|
@@ -28,12 +27,9 @@ class Throw extends Component {
|
|
|
28
27
|
super(owner, args);
|
|
29
28
|
// this error is opaque (user supplied) so we don't validate it
|
|
30
29
|
// as an Error instance.
|
|
31
|
-
|
|
30
|
+
{
|
|
32
31
|
// eslint-disable-next-line no-console
|
|
33
32
|
console.error(this.args.error);
|
|
34
|
-
} else {
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/only-throw-error
|
|
36
|
-
throw this.args.error;
|
|
37
33
|
}
|
|
38
34
|
}
|
|
39
35
|
static {
|
|
@@ -164,22 +160,11 @@ function initializeDeferredDecorator(target, prop) {
|
|
|
164
160
|
}
|
|
165
161
|
|
|
166
162
|
function notNull(x) {
|
|
167
|
-
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
168
|
-
if (!test) {
|
|
169
|
-
throw new Error('Expected a non-null value, but got null');
|
|
170
|
-
}
|
|
171
|
-
})(x !== null) : {};
|
|
172
163
|
return x;
|
|
173
164
|
}
|
|
174
165
|
const not = x => !x;
|
|
175
166
|
const IdleBlockMissingError = new Error('No idle block provided for <Request> component, and no query or request was provided.');
|
|
176
167
|
let consume = service;
|
|
177
|
-
if (macroCondition(moduleExists('ember-provide-consume-context'))) {
|
|
178
|
-
const {
|
|
179
|
-
consume: contextConsume
|
|
180
|
-
} = importSync('ember-provide-consume-context');
|
|
181
|
-
consume = contextConsume;
|
|
182
|
-
}
|
|
183
168
|
const DefaultChrome = setComponentTemplate(precompileTemplate("{{yield}}", {
|
|
184
169
|
strictMode: true
|
|
185
170
|
}), templateOnly());
|
|
@@ -412,11 +397,6 @@ class Request extends Component {
|
|
|
412
397
|
*/
|
|
413
398
|
get store() {
|
|
414
399
|
const store = this.args.store || this._store;
|
|
415
|
-
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
416
|
-
if (!test) {
|
|
417
|
-
throw new Error(moduleExists('ember-provide-consume-context') ? `No store was provided to the <Request> component. Either provide a store via the @store arg or via the context API provided by ember-provide-consume-context.` : `No store was provided to the <Request> component. Either provide a store via the @store arg or by registering a store service.`);
|
|
418
|
-
}
|
|
419
|
-
})(store) : {};
|
|
420
400
|
return store;
|
|
421
401
|
}
|
|
422
402
|
_state = null;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { tagForProperty } from '@ember/-internals/metal';
|
|
2
2
|
import { _backburner } from '@ember/runloop';
|
|
3
|
-
import { createCache, track, updateTag, consumeTag,
|
|
4
|
-
import { macroCondition, getGlobalConfig, importSync } from '@embroider/macros';
|
|
3
|
+
import { createCache, track, updateTag, consumeTag, dirtyTag, getValue } from '@glimmer/validator';
|
|
5
4
|
import { setupSignals } from '@warp-drive-mirror/core/configure';
|
|
6
5
|
|
|
7
6
|
const emberDirtyTag = dirtyTag;
|
|
@@ -9,7 +8,7 @@ function buildSignalConfig(options) {
|
|
|
9
8
|
const ARRAY_SIGNAL = options.wellknown.Array;
|
|
10
9
|
return {
|
|
11
10
|
createSignal(obj, key) {
|
|
12
|
-
|
|
11
|
+
{
|
|
13
12
|
if (key === ARRAY_SIGNAL) {
|
|
14
13
|
return [tagForProperty(obj, key), tagForProperty(obj, 'length'), tagForProperty(obj, '[]')];
|
|
15
14
|
}
|
|
@@ -17,7 +16,7 @@ function buildSignalConfig(options) {
|
|
|
17
16
|
return tagForProperty(obj, key);
|
|
18
17
|
},
|
|
19
18
|
consumeSignal(signal) {
|
|
20
|
-
|
|
19
|
+
{
|
|
21
20
|
if (Array.isArray(signal)) {
|
|
22
21
|
consumeTag(signal[0]);
|
|
23
22
|
consumeTag(signal[1]);
|
|
@@ -28,7 +27,7 @@ function buildSignalConfig(options) {
|
|
|
28
27
|
consumeTag(signal);
|
|
29
28
|
},
|
|
30
29
|
notifySignal(signal) {
|
|
31
|
-
|
|
30
|
+
{
|
|
32
31
|
if (Array.isArray(signal)) {
|
|
33
32
|
emberDirtyTag(signal[0]);
|
|
34
33
|
emberDirtyTag(signal[1]);
|
|
@@ -39,7 +38,7 @@ function buildSignalConfig(options) {
|
|
|
39
38
|
emberDirtyTag(signal);
|
|
40
39
|
},
|
|
41
40
|
createMemo: (object, key, fn) => {
|
|
42
|
-
|
|
41
|
+
{
|
|
43
42
|
const propertyTag = tagForProperty(object, key);
|
|
44
43
|
const memo = createCache(fn);
|
|
45
44
|
let ret;
|
|
@@ -52,9 +51,6 @@ function buildSignalConfig(options) {
|
|
|
52
51
|
consumeTag(tag);
|
|
53
52
|
return ret;
|
|
54
53
|
};
|
|
55
|
-
} else {
|
|
56
|
-
const memo = createCache(fn);
|
|
57
|
-
return () => getValue(memo);
|
|
58
54
|
}
|
|
59
55
|
},
|
|
60
56
|
willSyncFlushWatchers: () => {
|
|
@@ -62,12 +58,6 @@ function buildSignalConfig(options) {
|
|
|
62
58
|
return !!_backburner.currentInstance && _backburner._autorun !== true;
|
|
63
59
|
},
|
|
64
60
|
waitFor: async promise => {
|
|
65
|
-
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.TESTING)) {
|
|
66
|
-
const {
|
|
67
|
-
waitForPromise
|
|
68
|
-
} = importSync('@ember/test-waiters');
|
|
69
|
-
return waitForPromise(promise);
|
|
70
|
-
}
|
|
71
61
|
return promise;
|
|
72
62
|
}
|
|
73
63
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warp-drive-mirror/ember",
|
|
3
3
|
"description": "Data bindings and utilities for Ember applications using WarpDrive",
|
|
4
|
-
"version": "5.8.0-alpha.
|
|
4
|
+
"version": "5.8.0-alpha.40",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Chris Thoburn <runspired@users.noreply.github.com>",
|
|
7
7
|
"repository": {
|
|
@@ -24,26 +24,18 @@
|
|
|
24
24
|
],
|
|
25
25
|
"exports": {
|
|
26
26
|
".": {
|
|
27
|
-
"unpkg":
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
"deprecations": "./dist/unpkg/prod-deprecated/index.js",
|
|
33
|
-
"default": "./dist/unpkg/prod/index.js"
|
|
34
|
-
},
|
|
27
|
+
"unpkg-dev-deprecated": "./dist/unpkg/dev-deprecated/index.js",
|
|
28
|
+
"unpkg-dev": "./dist/unpkg/dev/index.js",
|
|
29
|
+
"unpkg-deprecated": "./dist/unpkg/prod-deprecated/index.js",
|
|
30
|
+
"unpkg": "./dist/unpkg/prod/index.js",
|
|
35
31
|
"types": "./declarations/index.d.ts",
|
|
36
32
|
"default": "./dist/index.js"
|
|
37
33
|
},
|
|
38
34
|
"./*": {
|
|
39
|
-
"unpkg":
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
"deprecations": "./dist/unpkg/prod-deprecated/*.js",
|
|
45
|
-
"default": "./dist/unpkg/prod/*.js"
|
|
46
|
-
},
|
|
35
|
+
"unpkg-dev-deprecated": "./dist/unpkg/dev-deprecated/*.js",
|
|
36
|
+
"unpkg-dev": "./dist/unpkg/dev/*.js",
|
|
37
|
+
"unpkg-deprecated": "./dist/unpkg/prod-deprecated/*.js",
|
|
38
|
+
"unpkg": "./dist/unpkg/prod/*.js",
|
|
47
39
|
"types": "./declarations/*.d.ts",
|
|
48
40
|
"default": "./dist/*.js"
|
|
49
41
|
}
|
|
@@ -54,7 +46,7 @@
|
|
|
54
46
|
},
|
|
55
47
|
"dependencies": {
|
|
56
48
|
"@embroider/macros": "^1.18.1",
|
|
57
|
-
"@warp-drive-mirror/core": "5.8.0-alpha.
|
|
49
|
+
"@warp-drive-mirror/core": "5.8.0-alpha.40"
|
|
58
50
|
},
|
|
59
51
|
"peerDependenciesMeta": {
|
|
60
52
|
"ember-provide-consume-context": {
|
|
@@ -76,8 +68,8 @@
|
|
|
76
68
|
"@embroider/addon-dev": "^8.1.0",
|
|
77
69
|
"@ember/test-helpers": "5.2.0",
|
|
78
70
|
"@ember/test-waiters": "^4.1.1",
|
|
79
|
-
"@warp-drive/internal-config": "5.8.0-alpha.
|
|
80
|
-
"@warp-drive-mirror/core": "5.8.0-alpha.
|
|
71
|
+
"@warp-drive/internal-config": "5.8.0-alpha.40",
|
|
72
|
+
"@warp-drive-mirror/core": "5.8.0-alpha.40",
|
|
81
73
|
"babel-plugin-ember-template-compilation": "^2.4.1",
|
|
82
74
|
"ember-template-imports": "^4.3.0",
|
|
83
75
|
"ember-source": "~6.6.0",
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import type Owner from "@ember/owner";
|
|
2
|
-
import Component from "@glimmer/component";
|
|
3
|
-
import { type PromiseState } from "@warp-drive-mirror/core/reactive";
|
|
4
|
-
import type { Awaitable } from "@warp-drive-mirror/core/request";
|
|
5
|
-
export declare const and: (x: unknown, y: unknown) => boolean;
|
|
6
|
-
interface ThrowSignature<E = Error | string | object> {
|
|
7
|
-
Args: {
|
|
8
|
-
error: E;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* The `<Throw />` component is used to throw an error in a template.
|
|
13
|
-
*
|
|
14
|
-
* That's all it does. So don't use it unless the application should
|
|
15
|
-
* throw an error if it reaches this point in the template.
|
|
16
|
-
*
|
|
17
|
-
* ```gts
|
|
18
|
-
* <Throw @error={{anError}} />
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @category Components
|
|
22
|
-
* @public
|
|
23
|
-
*/ export declare class Throw<T> extends Component<ThrowSignature<T>> {
|
|
24
|
-
constructor(owner: Owner, args: ThrowSignature<T>["Args"]);
|
|
25
|
-
}
|
|
26
|
-
interface AwaitSignature<
|
|
27
|
-
T,
|
|
28
|
-
E = Error | string | object
|
|
29
|
-
> {
|
|
30
|
-
Args: {
|
|
31
|
-
promise: Promise<T> | Awaitable<T, E>;
|
|
32
|
-
};
|
|
33
|
-
Blocks: {
|
|
34
|
-
pending: [];
|
|
35
|
-
error: [error: E];
|
|
36
|
-
success: [value: T];
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* The `<Await />` component allow you to utilize reactive control flow
|
|
41
|
-
* for asynchronous states in your application.
|
|
42
|
-
*
|
|
43
|
-
* Await is ideal for handling "boundaries", outside which some state is
|
|
44
|
-
* still allowed to be unresolved and within which it MUST be resolved.
|
|
45
|
-
*
|
|
46
|
-
* ```gts
|
|
47
|
-
* import { Await } from '@warp-drive-mirror/ember';
|
|
48
|
-
*
|
|
49
|
-
* <template>
|
|
50
|
-
* <Await @promise={{@request}}>
|
|
51
|
-
* <:pending>
|
|
52
|
-
* <Spinner />
|
|
53
|
-
* </:pending>
|
|
54
|
-
*
|
|
55
|
-
* <:error as |error|>
|
|
56
|
-
* <ErrorForm @error={{error}} />
|
|
57
|
-
* </:error>
|
|
58
|
-
*
|
|
59
|
-
* <:success as |result|>
|
|
60
|
-
* <h1>{{result.title}}</h1>
|
|
61
|
-
* </:success>
|
|
62
|
-
* </Await>
|
|
63
|
-
* </template>
|
|
64
|
-
* ```
|
|
65
|
-
*
|
|
66
|
-
* The `<Await />` component requires that error states are properly handled.
|
|
67
|
-
*
|
|
68
|
-
* If no error block is provided and the promise rejects, the error will
|
|
69
|
-
* be thrown.
|
|
70
|
-
*
|
|
71
|
-
* @category Components
|
|
72
|
-
* @public
|
|
73
|
-
*/ export declare class Await<
|
|
74
|
-
T,
|
|
75
|
-
E
|
|
76
|
-
> extends Component<AwaitSignature<T, E>> {
|
|
77
|
-
get state(): Readonly<PromiseState<T, E>>;
|
|
78
|
-
get error(): E;
|
|
79
|
-
get result(): T;
|
|
80
|
-
}
|
|
81
|
-
export {};
|