@supersoniks/concorde 4.9.7 → 4.9.91
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/build-infos.json +1 -1
- package/concorde-core.bundle.js +265 -265
- package/concorde-core.es.js +4600 -4385
- package/dist/concorde-core.bundle.js +265 -265
- package/dist/concorde-core.es.js +4600 -4385
- package/dist/js/core/components/functional/queue/queue.js +25 -153
- package/dist/js/core/components/functional/queue/queue.js.map +1 -1
- package/dist/js/core/components/ui/_css/scroll.js +2 -0
- package/dist/js/core/components/ui/_css/scroll.js.map +1 -1
- package/dist/js/core/decorators/api.js +92 -2
- package/dist/js/core/decorators/api.js.map +1 -1
- package/dist/js/core/utils/SafariScrollGuard.js +384 -0
- package/dist/js/core/utils/SafariScrollGuard.js.map +1 -0
- package/dist/js/decorators.js +4 -0
- package/dist/js/decorators.js.map +1 -1
- package/dist/js/utils.js +3 -0
- package/dist/js/utils.js.map +1 -1
- package/dist/types/core/components/functional/queue/queue.d.ts +8 -24
- package/dist/types/core/components/functional/queue/queue.d.ts.map +1 -1
- package/dist/types/core/components/ui/_css/scroll.d.ts.map +1 -1
- package/dist/types/core/decorators/api.d.ts +82 -60
- package/dist/types/core/decorators/api.d.ts.map +1 -1
- package/dist/types/core/utils/SafariScrollGuard.d.ts +36 -0
- package/dist/types/core/utils/SafariScrollGuard.d.ts.map +1 -0
- package/dist/types/decorators.d.ts +3 -1
- package/dist/types/decorators.d.ts.map +1 -1
- package/dist/types/utils.d.ts +1 -0
- package/dist/types/utils.d.ts.map +1 -1
- package/docs/assets/index-BL6WVF7g.css +1 -0
- package/docs/assets/{index-hElUgV9_.js → index-DVn8AeyA.js} +572 -555
- package/docs/crawl/docs/_decorators/get.html +64 -81
- package/docs/crawl/docs/_decorators/patch.html +35 -23
- package/docs/crawl/docs/_decorators/post.html +72 -72
- package/docs/crawl/docs/_decorators/put.html +36 -21
- package/docs/crawl/docs/_getting-started/ai-agents.html +45 -6
- package/docs/crawl/hubs/decorators.html +141 -69
- package/docs/crawl/hubs/remote-data.html +141 -69
- package/docs/index.html +2 -2
- package/docs/llms-full.txt +203 -149
- package/docs/llms.txt +4 -4
- package/docs/src/core/components/functional/queue/queue.md +0 -0
- package/docs/src/core/components/ui/button/button.md +0 -0
- package/docs/src/docs/_decorators/get.md +55 -81
- package/docs/src/docs/_decorators/patch.md +36 -25
- package/docs/src/docs/_decorators/post.md +71 -62
- package/docs/src/docs/_decorators/put.md +37 -24
- package/docs/src/docs/_getting-started/ai-agents.md +24 -4
- package/docs/src/docs/search/docs-search.json +151 -1
- package/docs/src/tsconfig.json +3 -0
- package/package.json +6 -2
- package/src/core/components/functional/queue/queue.ts +33 -164
- package/src/core/components/ui/_css/scroll.ts +3 -0
- package/src/core/decorators/api.post.spec.ts +79 -1
- package/src/core/decorators/api.spec.ts +100 -1
- package/src/core/decorators/api.ts +252 -138
- package/src/core/utils/SafariScrollGuard.ts +429 -0
- package/src/decorators.ts +7 -0
- package/src/docs/_decorators/get.md +81 -80
- package/src/docs/_decorators/patch.md +36 -25
- package/src/docs/_decorators/post.md +99 -62
- package/src/docs/_decorators/put.md +37 -24
- package/src/docs/components/docs-demo-sources.ts +1 -6
- package/src/docs/example/decorators-demo-geo.ts +0 -21
- package/src/docs/example/decorators-demo-subscribe-publish-get-demos.ts +41 -132
- package/src/docs/search/docs-search.json +156 -241
- package/src/docs/tailwind/css/tailwind.css +0 -0
- package/src/tsconfig.json +3 -0
- package/src/tsconfig.tsbuildinfo +1 -1
- package/src/utils.ts +13 -0
- package/vite.config.mts +4 -0
- package/vitest.setup.ts +22 -0
- package/docs/assets/index-Bnp7gVaA.css +0 -1
|
@@ -153,138 +153,210 @@ dp(c</pre>
|
|
|
153
153
|
<section id="docs-_decorators-get" data-doc-id="docs/_decorators/get">
|
|
154
154
|
<h2><a href="../docs/_decorators/get.html">@get</a></h2>
|
|
155
155
|
<p><strong>Doc ID:</strong> <code>docs/_decorators/get</code> · <a href="../docs/_decorators/get.html">full page</a></p>
|
|
156
|
-
<p
|
|
156
|
+
<p>@get loads data and stores the result in an ApiResult<T> | null property.</p>
|
|
157
157
|
<pre class="doc-excerpt">@get
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
@get loads data and stores the result in an ApiResult | null property.
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
- payload.result: typed data;
|
|
162
|
+
- payload.response: the HTTP response;
|
|
163
|
+
- payload.request: the request that was sent.
|
|
162
164
|
|
|
163
|
-
|
|
165
|
+
Minimal usage
|
|
164
166
|
|
|
165
|
-
|
|
166
|
-
- Second argument: DataProviderKey — config is read from the publisher at the resolved path; internal mutations trigger another GET. See API configuration for mock demos.
|
|
167
|
+
const usersEndpoint = new Endpoint ("users");
|
|
167
168
|
|
|
168
|
-
|
|
169
|
+
@get(usersEndpoint)
|
|
170
|
+
@state()
|
|
171
|
+
payload: ApiResult | null = null;
|
|
172
|
+
|
|
173
|
+
The first argument is always an
|
|
174
|
+
Endpoint . API configuration is read
|
|
175
|
+
from the HTML scope (serviceURL, token, etc.), so the component is usually
|
|
176
|
+
placed below an element that provides this configuration.
|
|
177
|
+
|
|
178
|
+
Refetching a GET
|
|
179
|
+
|
|
180
|
+
From the component
|
|
181
|
+
|
|
182
|
+
Keep the decorator in a constant to access refetch(component). Refetch only
|
|
183
|
+
targets the instance passed as the argument, even before it has received a
|
|
184
|
+
result.
|
|
169
185
|
|
|
170
|
-
|
|
186
|
+
const usersGet = get(new Endpoint ("users"));
|
|
187
|
+
|
|
188
|
+
@usersGet
|
|
189
|
+
@state()
|
|
190
|
+
payload: ApiResult | null = null;
|
|
191
|
+
|
|
192
|
+
refresh() {
|
|
193
|
+
usersGet.refetch(this);
|
|
194
|
+
}
|
|
171
195
|
|
|
172
196
|
Options (GetOptions)
|
|
173
197
|
|
|
174
|
-
|
|
198
|
+
Options are the second argument, or the third argument when an API
|
|
199
|
+
configuration key is provided.
|
|
175
200
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
201
|
+
- skipEmptyPlaceholder: blocks the GET when ${prop} is "".
|
|
202
|
+
- refetchEveryMs: automatically runs the GET again after this interval
|
|
203
|
+
(milliseconds). Omit the option, or use 0, to disable polling.
|
|
204
|
+
|
|
205
|
+
With a configurat</pre>
|
|
181
206
|
</section>
|
|
182
207
|
<section id="docs-_decorators-patch" data-doc-id="docs/_decorators/patch">
|
|
183
208
|
<h2><a href="../docs/_decorators/patch.html">@patch</a></h2>
|
|
184
209
|
<p><strong>Doc ID:</strong> <code>docs/_decorators/patch</code> · <a href="../docs/_decorators/patch.html">full page</a></p>
|
|
185
|
-
<p
|
|
210
|
+
<p>@patch applies a partial update with the body from a publisher. It uses the</p>
|
|
186
211
|
<pre class="doc-excerpt">@patch
|
|
187
212
|
|
|
188
|
-
|
|
213
|
+
@patch applies a partial update with the body from a publisher. It uses the
|
|
214
|
+
same model as @post:
|
|
215
|
+
Endpoint , DataProviderKey , ApiResult , options, and the
|
|
216
|
+
send(component) handle.
|
|
189
217
|
|
|
190
|
-
|
|
218
|
+
Minimal usage
|
|
191
219
|
|
|
192
|
-
|
|
220
|
+
const bodyKey = new DataProviderKey >("users.patch");
|
|
221
|
+
const patchUser = patch(new Endpoint ("users/42"), bodyKey);
|
|
193
222
|
|
|
194
|
-
|
|
223
|
+
@patchUser
|
|
224
|
+
@state()
|
|
225
|
+
payload: ApiResult | null = null;
|
|
195
226
|
|
|
196
|
-
|
|
227
|
+
To run the operation again from the component:
|
|
197
228
|
|
|
198
|
-
|
|
229
|
+
savePatch() {
|
|
230
|
+
patchUser.send(this);
|
|
231
|
+
}
|
|
199
232
|
|
|
200
|
-
|
|
233
|
+
The PATCH is also sent automatically when the body mutates, unless
|
|
234
|
+
autoPostOnBodyMutation: false is set. The available options are described in
|
|
235
|
+
@post:
|
|
201
236
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
237
|
+
- autoPostOnBodyMutation
|
|
238
|
+
- skipIfBodyMissing
|
|
239
|
+
- refetchEveryMs
|
|
240
|
+
- skipEmptyPlaceholder
|
|
205
241
|
|
|
206
|
-
|
|
242
|
+
Pass explicit API configuration as the third argument:
|
|
207
243
|
|
|
208
|
-
|
|
244
|
+
@patch(endpoint, bodyKey, apiConfigurationKey)
|
|
209
245
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
@state()
|
|
216
|
-
payload?: ApiResult&lt;Resource&gt; | null;
|
|
246
|
+
Import
|
|
247
|
+
|
|
248
|
+
import { patch, type ApiResult } from "@supersoniks/concorde/decorators";
|
|
249
|
+
import { DataProviderKey } from "@supersoniks/concorde/dataProviderKey";
|
|
250
|
+
import { Endpoint } from "@supersoniks/concorde/utils/endpoint";
|
|
217
251
|
|
|
218
252
|
See also
|
|
219
253
|
|
|
220
|
-
- @post —
|
|
221
|
-
- @put — full
|
|
254
|
+
- @post — options and triggers
|
|
255
|
+
- @put — full replacement
|
|
256
|
+
- Dynamic path placeholders</pre>
|
|
222
257
|
</section>
|
|
223
258
|
<section id="docs-_decorators-post" data-doc-id="docs/_decorators/post">
|
|
224
259
|
<h2><a href="../docs/_decorators/post.html">@post</a></h2>
|
|
225
260
|
<p><strong>Doc ID:</strong> <code>docs/_decorators/post</code> · <a href="../docs/_decorators/post.html">full page</a></p>
|
|
226
|
-
<p
|
|
261
|
+
<p>@post sends the contents of a publisher and stores the response in an</p>
|
|
227
262
|
<pre class="doc-excerpt">@post
|
|
228
263
|
|
|
229
|
-
|
|
264
|
+
@post sends the contents of a publisher and stores the response in an
|
|
265
|
+
ApiResult | null property.
|
|
266
|
+
|
|
267
|
+
Minimal usage
|
|
268
|
+
|
|
269
|
+
Pass an Endpoint and a DataProviderKey for the request body.
|
|
270
|
+
|
|
271
|
+
const userBodyKey = new DataProviderKey ("users.form");
|
|
272
|
+
const createUser = post(new Endpoint ("users"), userBodyKey);
|
|
273
|
+
|
|
274
|
+
@createUser
|
|
275
|
+
@state()
|
|
276
|
+
payload: ApiResult | null = null;
|
|
277
|
+
|
|
278
|
+
The current body is read from userBodyKey. By default, the POST is sent when
|
|
279
|
+
the component connects and after each body mutation. Mutations in the same
|
|
280
|
+
frame are coalesced into one request.
|
|
281
|
+
|
|
282
|
+
API configuration is read from the HTML scope, as with
|
|
283
|
+
@get.
|
|
230
284
|
|
|
231
|
-
|
|
285
|
+
Sending the POST again
|
|
232
286
|
|
|
233
|
-
|
|
287
|
+
From the component
|
|
234
288
|
|
|
235
|
-
|
|
289
|
+
Keep the decorator to access send(component). The body is read again when the
|
|
290
|
+
operation runs.
|
|
236
291
|
|
|
237
|
-
|
|
292
|
+
saveAgain() {
|
|
293
|
+
createUser.send(this);
|
|
294
|
+
}
|
|
238
295
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
| refetchEveryMs | Re-post on an interval (ms). |
|
|
242
|
-
| skipIfBodyMissing | Skip when body publisher is null/undefined (default: true). |
|
|
243
|
-
| autoPostOnBodyMutation | Re-post when the body publisher mutates (default: true). false = manual via triggerKey.invalidate(). |
|
|
244
|
-
| skipEmptyPlaceholder | If true, a placeholder resolved to '' blocks the request (empty string only — not 0 or false). See Dynamic paths. |
|
|
245
|
-
| triggerKey | DataProviderKey — invalidate() re-runs the POST with the current body. |
|
|
296
|
+
send() is useful for “Save” or “Retry” buttons. It can repeat an operation
|
|
297
|
+
with side effects.
|
|
246
298
|
|
|
247
|
-
|
|
299
|
+
Options (PostOptions)
|
|
248
300
|
|
|
249
|
-
|
|
301
|
+
Options are the third argument, or the fourth argument when a configuration key
|
|
302
|
+
is provided.
|
|
303
|
+
|
|
304
|
+
- autoPostOnBodyMutation: send after a body mutation (default: true). Set
|
|
305
|
+
it to false to use send().
|
|
306
|
+
- skipIfBodyMissing: skip when the body is null or undefined (default:
|
|
307
|
+
true).
|
|
308
|
+
- refetchE</pre>
|
|
250
309
|
</section>
|
|
251
310
|
<section id="docs-_decorators-put" data-doc-id="docs/_decorators/put">
|
|
252
311
|
<h2><a href="../docs/_decorators/put.html">@put</a></h2>
|
|
253
312
|
<p><strong>Doc ID:</strong> <code>docs/_decorators/put</code> · <a href="../docs/_decorators/put.html">full page</a></p>
|
|
254
|
-
<p
|
|
313
|
+
<p>@put replaces a resource with the body from a publisher. It uses exactly the</p>
|
|
255
314
|
<pre class="doc-excerpt">@put
|
|
256
315
|
|
|
257
|
-
|
|
316
|
+
@put replaces a resource with the body from a publisher. It uses exactly the
|
|
317
|
+
same model as @post:
|
|
318
|
+
Endpoint , DataProviderKey , ApiResult , options, and the
|
|
319
|
+
send(component) handle.
|
|
258
320
|
|
|
259
|
-
|
|
321
|
+
Minimal usage
|
|
260
322
|
|
|
261
|
-
|
|
323
|
+
const bodyKey = new DataProviderKey ("users.form");
|
|
324
|
+
const updateUser = put(new Endpoint ("users/42"), bodyKey);
|
|
262
325
|
|
|
263
|
-
|
|
326
|
+
@updateUser
|
|
327
|
+
@state()
|
|
328
|
+
payload: ApiResult | null = null;
|
|
264
329
|
|
|
265
|
-
|
|
330
|
+
To run the operation again from the component:
|
|
266
331
|
|
|
267
|
-
|
|
332
|
+
update() {
|
|
333
|
+
updateUser.send(this);
|
|
334
|
+
}
|
|
268
335
|
|
|
269
|
-
|
|
336
|
+
The PUT is also sent automatically when the body mutates, unless
|
|
337
|
+
autoPostOnBodyMutation: false is set. See
|
|
338
|
+
@post for the option details:
|
|
270
339
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
340
|
+
- autoPostOnBodyMutation
|
|
341
|
+
- skipIfBodyMissing
|
|
342
|
+
- refetchEveryMs
|
|
343
|
+
- skipEmptyPlaceholder
|
|
274
344
|
|
|
275
|
-
|
|
345
|
+
Pass explicit API configuration as the third argument:
|
|
276
346
|
|
|
277
|
-
|
|
347
|
+
@put(endpoint, bodyKey, apiConfigurationKey)
|
|
278
348
|
|
|
279
|
-
|
|
280
|
-
@state()
|
|
281
|
-
payload?: ApiResult&lt;Resource&gt; | null;
|
|
349
|
+
Import
|
|
282
350
|
|
|
283
|
-
|
|
351
|
+
import { put, type ApiResult } from "@supersoniks/concorde/decorators";
|
|
352
|
+
import { DataProviderKey } from "@supersoniks/concorde/dataProviderKey";
|
|
353
|
+
import { Endpoint } from "@supersoniks/concorde/utils/endpoint";
|
|
284
354
|
|
|
285
355
|
See also
|
|
286
356
|
|
|
287
|
-
- @post
|
|
357
|
+
- @post — options and triggers
|
|
358
|
+
- @patch — partial update
|
|
359
|
+
- Dynamic path placeholders</pre>
|
|
288
360
|
</section>
|
|
289
361
|
<section id="docs-_misc-api-configuration" data-doc-id="docs/_misc/api-configuration">
|
|
290
362
|
<h2><a href="../docs/_misc/api-configuration.html">API configuration</a></h2>
|
package/docs/index.html
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
<!-- <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
|
11
11
|
-->
|
|
12
12
|
<script src="https://cdn.jsdelivr.net/npm/marked@13.0.3"></script>
|
|
13
|
-
<script type="module" crossorigin src="./assets/index-
|
|
14
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
13
|
+
<script type="module" crossorigin src="./assets/index-DVn8AeyA.js"></script>
|
|
14
|
+
<link rel="stylesheet" crossorigin href="./assets/index-BL6WVF7g.css">
|
|
15
15
|
</head>
|
|
16
16
|
<body class="px-6 lg:px-20">
|
|
17
17
|
<sonic-theme
|