@warp-drive-mirror/ember 5.6.0-alpha.14 → 5.6.0-alpha.17

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.
@@ -1,216 +1,215 @@
1
1
  /**
2
- * <h3 align="center">⚛️ Data utilities for using <em style="color: lightgreen">Warp</em><strong style="color: magenta">Drive</strong> with 🐹 <em style="color: orange">Ember</em><em style="color: lightblue">.js</em></h3>
3
- *
4
- * ## Installation
5
- *
6
- * ```cli
7
- * pnpm install @warp-drive-mirror/ember
8
- * ```
9
- *
10
- * ## About
11
- *
12
- * This library provides reactive utilities for working with promises
13
- * and requests, building over these primitives to provide functions
14
- * and components that enable you to build robust performant apps with
15
- * elegant control flow.
16
- *
17
- * ## Using .hbs
18
- *
19
- * The components and utils this library exports are intended for use with Glimmer
20
- * Flavored JavaScript (gjs). To use them in handlebars files, your app should re-
21
- * export them. For instance:
22
- *
23
- * *app/components/await.ts*
24
- * ```ts
25
- * export { Await as default } from '@warp-drive-mirror/ember';
26
- * ```
27
- *
28
- * ```hbs
29
- * <Await @promise={{this.getTheData}}></Await>
30
- * ```
31
- *
32
- * This allows renaming them to avoid conflicts just by using a different filename
33
- * if desired:
34
- *
35
- * *app/components/warp-drive-await.ts*
36
- * ```ts
37
- * export { Await as default } from '@warp-drive-mirror/ember';
38
- * ```
39
- *
40
- * ```hbs
41
- * <WarpDriveAwait @promise={{this.getTheData}}></WarpDriveAwait>
42
- * ```
43
- *
44
- * @module
45
- */
46
- export { Request } from './-private/request.gts';
47
- export { Await, Throw } from './-private/await.gts';
2
+ * <h3 align="center">⚛️ Data utilities for using <em style="color: lightgreen">Warp</em><strong style="color: magenta">Drive</strong> with 🐹 <em style="color: orange">Ember</em><em style="color: lightblue">.js</em></h3>
3
+ *
4
+ * ## Installation
5
+ *
6
+ * ```cli
7
+ * pnpm install @warp-drive-mirror/ember
8
+ * ```
9
+ *
10
+ * ## About
11
+ *
12
+ * This library provides reactive utilities for working with promises
13
+ * and requests, building over these primitives to provide functions
14
+ * and components that enable you to build robust performant apps with
15
+ * elegant control flow.
16
+ *
17
+ * ## Using .hbs
18
+ *
19
+ * The components and utils this library exports are intended for use with Glimmer
20
+ * Flavored JavaScript (gjs). To use them in handlebars files, your app should re-
21
+ * export them. For instance:
22
+ *
23
+ * *app/components/await.ts*
24
+ * ```ts
25
+ * export { Await as default } from '@warp-drive-mirror/ember';
26
+ * ```
27
+ *
28
+ * ```hbs
29
+ * <Await @promise={{this.getTheData}}></Await>
30
+ * ```
31
+ *
32
+ * This allows renaming them to avoid conflicts just by using a different filename
33
+ * if desired:
34
+ *
35
+ * *app/components/warp-drive-await.ts*
36
+ * ```ts
37
+ * export { Await as default } from '@warp-drive-mirror/ember';
38
+ * ```
39
+ *
40
+ * ```hbs
41
+ * <WarpDriveAwait @promise={{this.getTheData}}></WarpDriveAwait>
42
+ * ```
43
+ *
44
+ * @module
45
+ */
46
+ export { Request } from "./-private/request.js";
47
+ export { Await, Throw } from "./-private/await.js";
48
48
  /**
49
- * PromiseState provides a reactive wrapper for a promise which allows you write declarative
50
- * code around a promise's control flow. It is useful in both Template and JavaScript contexts,
51
- * allowing you to quickly derive behaviors and data from pending, error and success states.
52
- *
53
- * ```ts
54
- * interface PromiseState<T = unknown, E = unknown> {
55
- * isPending: boolean;
56
- * isSuccess: boolean;
57
- * isError: boolean;
58
- * result: T | null;
59
- * error: E | null;
60
- * }
61
- * ```
62
- *
63
- * To get the state of a promise, use `getPromiseState`.
64
- *
65
- * @class PromiseState
66
- * @public
67
- */
49
+ * PromiseState provides a reactive wrapper for a promise which allows you write declarative
50
+ * code around a promise's control flow. It is useful in both Template and JavaScript contexts,
51
+ * allowing you to quickly derive behaviors and data from pending, error and success states.
52
+ *
53
+ * ```ts
54
+ * interface PromiseState<T = unknown, E = unknown> {
55
+ * isPending: boolean;
56
+ * isSuccess: boolean;
57
+ * isError: boolean;
58
+ * result: T | null;
59
+ * error: E | null;
60
+ * }
61
+ * ```
62
+ *
63
+ * To get the state of a promise, use `getPromiseState`.
64
+ *
65
+ * @class PromiseState
66
+ * @public
67
+ */
68
68
  /**
69
- * Returns a reactive state-machine for the provided promise or awaitable.
70
- *
71
- * Repeat calls to `getPromiseState` with the same promise will return the same state object
72
- * making is safe and easy to use in templates and JavaScript code to produce reactive
73
- * behaviors around promises.
74
- *
75
- * `getPromiseState` can be used in both JavaScript and Template contexts.
76
- *
77
- * ```ts
78
- * import { getPromiseState } from '@warp-drive-mirror/ember';
79
- *
80
- * const state = getPromiseState(promise);
81
- * ```
82
- *
83
- * For instance, we could write a getter on a component that updates whenever
84
- * the promise state advances or the promise changes, by combining the function
85
- * with the use of `@cached`
86
- *
87
- * ```ts
88
- * class Component {
89
- * @cached
90
- * get title() {
91
- * const state = getPromiseState(this.args.request);
92
- * if (state.isPending) {
93
- * return 'loading...';
94
- * }
95
- * if (state.isError) { return null; }
96
- * return state.result.title;
97
- * }
98
- * }
99
- * ```
100
- *
101
- * Or in a template as a helper:
102
- *
103
- * ```gjs
104
- * import { getPromiseState } from '@warp-drive-mirror/ember';
105
- *
106
- * <template>
107
- * {{#let (getPromiseState @request) as |state|}}
108
- * {{#if state.isPending}} <Spinner />
109
- * {{else if state.isError}} <ErrorForm @error={{state.error}} />
110
- * {{else}}
111
- * <h1>{{state.result.title}}</h1>
112
- * {{/if}}
113
- * {{/let}}
114
- * </template>
115
- * ```
116
- *
117
- * If looking to use in a template, consider also the `<Await />` component.
69
+ * Returns a reactive state-machine for the provided promise or awaitable.
70
+ *
71
+ * Repeat calls to `getPromiseState` with the same promise will return the same state object
72
+ * making is safe and easy to use in templates and JavaScript code to produce reactive
73
+ * behaviors around promises.
74
+ *
75
+ * `getPromiseState` can be used in both JavaScript and Template contexts.
76
+ *
77
+ * ```ts
78
+ * import { getPromiseState } from '@warp-drive-mirror/ember';
79
+ *
80
+ * const state = getPromiseState(promise);
81
+ * ```
82
+ *
83
+ * For instance, we could write a getter on a component that updates whenever
84
+ * the promise state advances or the promise changes, by combining the function
85
+ * with the use of `@cached`
86
+ *
87
+ * ```ts
88
+ * class Component {
89
+ * @cached
90
+ * get title() {
91
+ * const state = getPromiseState(this.args.request);
92
+ * if (state.isPending) {
93
+ * return 'loading...';
94
+ * }
95
+ * if (state.isError) { return null; }
96
+ * return state.result.title;
97
+ * }
98
+ * }
99
+ * ```
100
+ *
101
+ * Or in a template as a helper:
102
+ *
103
+ * ```gjs
104
+ * import { getPromiseState } from '@warp-drive-mirror/ember';
105
+ *
106
+ * <template>
107
+ * {{#let (getPromiseState @request) as |state|}}
108
+ * {{#if state.isPending}} <Spinner />
109
+ * {{else if state.isError}} <ErrorForm @error={{state.error}} />
110
+ * {{else}}
111
+ * <h1>{{state.result.title}}</h1>
112
+ * {{/if}}
113
+ * {{/let}}
114
+ * </template>
115
+ * ```
116
+ *
117
+ * If looking to use in a template, consider also the `<Await />` component.
118
118
 
119
- * @public
120
- * @param {Promise<T> | Awaitable<T, E>} promise
121
- * @return {PromiseState<T, E>}
122
- */
123
- export { getPromiseState } from '@warp-drive-mirror/core/store/-private';
119
+ * @public
120
+ * @param {Promise<T> | Awaitable<T, E>} promise
121
+ * @return {PromiseState<T, E>}
122
+ */
123
+ export { getPromiseState } from "@warp-drive-mirror/core/store/-private";
124
124
  /**
125
- * Lazily consumes the stream of a request, providing a number of
126
- * reactive properties that can be used to build UIs that respond
127
- * to the progress of a request.
128
- *
129
- * @class RequestLoadingState
130
- * @public
131
- */
125
+ * Lazily consumes the stream of a request, providing a number of
126
+ * reactive properties that can be used to build UIs that respond
127
+ * to the progress of a request.
128
+ *
129
+ * @class RequestLoadingState
130
+ * @public
131
+ */
132
132
  /**
133
- * RequestState extends the concept of PromiseState to provide a reactive
134
- * wrapper for a request `Future` which allows you write declarative code
135
- * around a Future's control flow.
136
- *
137
- * It is useful in both Template and JavaScript contexts, allowing you
138
- * to quickly derive behaviors and data from pending, error and success
139
- * states.
140
- *
141
- * The key difference between a Promise and a Future is that Futures provide
142
- * access to a stream of their content, the identity of the request (if any)
143
- * as well as the ability to attempt to abort the request.
144
- *
145
- * ```ts
146
- * interface Future<T> extends Promise<T>> {
147
- * getStream(): Promise<ReadableStream>;
148
- * abort(): void;
149
- * lid: StableDocumentIdentifier | null;
150
- * }
151
- * ```
152
- *
153
- * These additional APIs allow us to craft even richer state experiences.
154
- *
155
- * To get the state of a request, use `getRequestState`.
156
- *
157
- * @class RequestState
158
- * @public
159
- */
133
+ * RequestState extends the concept of PromiseState to provide a reactive
134
+ * wrapper for a request `Future` which allows you write declarative code
135
+ * around a Future's control flow.
136
+ *
137
+ * It is useful in both Template and JavaScript contexts, allowing you
138
+ * to quickly derive behaviors and data from pending, error and success
139
+ * states.
140
+ *
141
+ * The key difference between a Promise and a Future is that Futures provide
142
+ * access to a stream of their content, the identity of the request (if any)
143
+ * as well as the ability to attempt to abort the request.
144
+ *
145
+ * ```ts
146
+ * interface Future<T> extends Promise<T>> {
147
+ * getStream(): Promise<ReadableStream>;
148
+ * abort(): void;
149
+ * lid: StableDocumentIdentifier | null;
150
+ * }
151
+ * ```
152
+ *
153
+ * These additional APIs allow us to craft even richer state experiences.
154
+ *
155
+ * To get the state of a request, use `getRequestState`.
156
+ *
157
+ * @class RequestState
158
+ * @public
159
+ */
160
160
  /**
161
- *
162
- *
163
- * `getRequestState` can be used in both JavaScript and Template contexts.
164
- *
165
- * ```ts
166
- * import { getRequestState } from '@warp-drive-mirror/ember';
167
- *
168
- * const state = getRequestState(future);
169
- * ```
170
- *
171
- * For instance, we could write a getter on a component that updates whenever
172
- * the request state advances or the future changes, by combining the function
173
- * with the use of `@cached`
174
- *
175
- * ```ts
176
- * class Component {
177
- * @cached
178
- * get title() {
179
- * const state = getRequestState(this.args.request);
180
- * if (state.isPending) {
181
- * return 'loading...';
182
- * }
183
- * if (state.isError) { return null; }
184
- * return state.result.title;
185
- * }
186
- * }
187
- * ```
188
- *
189
- * Or in a template as a helper:
190
- *
191
- * ```gjs
192
- * import { getRequestState } from '@warp-drive-mirror/ember';
193
- *
194
- * <template>
195
- * {{#let (getRequestState @request) as |state|}}
196
- * {{#if state.isPending}}
197
- * <Spinner />
198
- * {{else if state.isError}}
199
- * <ErrorForm @error={{state.error}} />
200
- * {{else}}
201
- * <h1>{{state.result.title}}</h1>
202
- * {{/if}}
203
- * {{/let}}
204
- * </template>
205
- * ```
206
- *
207
- * If looking to use in a template, consider also the `<Request />` component
208
- * which offers a numbe of additional capabilities for requests *beyond* what
209
- * `RequestState` provides.
210
- *
211
- * @public
212
- * @param future
213
- * @return {RequestState}
214
- */
215
- export { getRequestState, type RequestLoadingState } from '@warp-drive-mirror/core/store/-private';
216
- //# sourceMappingURL=index.d.ts.map
161
+ *
162
+ *
163
+ * `getRequestState` can be used in both JavaScript and Template contexts.
164
+ *
165
+ * ```ts
166
+ * import { getRequestState } from '@warp-drive-mirror/ember';
167
+ *
168
+ * const state = getRequestState(future);
169
+ * ```
170
+ *
171
+ * For instance, we could write a getter on a component that updates whenever
172
+ * the request state advances or the future changes, by combining the function
173
+ * with the use of `@cached`
174
+ *
175
+ * ```ts
176
+ * class Component {
177
+ * @cached
178
+ * get title() {
179
+ * const state = getRequestState(this.args.request);
180
+ * if (state.isPending) {
181
+ * return 'loading...';
182
+ * }
183
+ * if (state.isError) { return null; }
184
+ * return state.result.title;
185
+ * }
186
+ * }
187
+ * ```
188
+ *
189
+ * Or in a template as a helper:
190
+ *
191
+ * ```gjs
192
+ * import { getRequestState } from '@warp-drive-mirror/ember';
193
+ *
194
+ * <template>
195
+ * {{#let (getRequestState @request) as |state|}}
196
+ * {{#if state.isPending}}
197
+ * <Spinner />
198
+ * {{else if state.isError}}
199
+ * <ErrorForm @error={{state.error}} />
200
+ * {{else}}
201
+ * <h1>{{state.result.title}}</h1>
202
+ * {{/if}}
203
+ * {{/let}}
204
+ * </template>
205
+ * ```
206
+ *
207
+ * If looking to use in a template, consider also the `<Request />` component
208
+ * which offers a numbe of additional capabilities for requests *beyond* what
209
+ * `RequestState` provides.
210
+ *
211
+ * @public
212
+ * @param future
213
+ * @return {RequestState}
214
+ */
215
+ export { getRequestState, type RequestLoadingState } from "@warp-drive-mirror/core/store/-private";
@@ -1,16 +1,6 @@
1
- import { tagForProperty } from '@ember/-internals/metal';
2
- type Tag = ReturnType<typeof tagForProperty>;
1
+ import type { SignalHooks } from "@warp-drive-mirror/core/store/-private";
3
2
  export declare function buildSignalConfig(options: {
4
- wellknown: {
5
- Array: symbol | string;
6
- };
7
- }): {
8
- createSignal(obj: object, key: string | symbol): Tag | [Tag, Tag, Tag];
9
- consumeSignal(signal: Tag | [Tag, Tag, Tag]): void;
10
- notifySignal(signal: Tag | [Tag, Tag, Tag]): void;
11
- createMemo: <F>(object: object, key: string | symbol, fn: () => F) => (() => F);
12
- willSyncFlushWatchers: () => boolean;
13
- waitFor: <K>(promise: Promise<K>) => Promise<K>;
14
- };
15
- export {};
16
- //# sourceMappingURL=install.d.ts.map
3
+ wellknown: {
4
+ Array: symbol | string;
5
+ };
6
+ }): SignalHooks;