@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.
Files changed (72) hide show
  1. package/build-infos.json +1 -1
  2. package/concorde-core.bundle.js +265 -265
  3. package/concorde-core.es.js +4600 -4385
  4. package/dist/concorde-core.bundle.js +265 -265
  5. package/dist/concorde-core.es.js +4600 -4385
  6. package/dist/js/core/components/functional/queue/queue.js +25 -153
  7. package/dist/js/core/components/functional/queue/queue.js.map +1 -1
  8. package/dist/js/core/components/ui/_css/scroll.js +2 -0
  9. package/dist/js/core/components/ui/_css/scroll.js.map +1 -1
  10. package/dist/js/core/decorators/api.js +92 -2
  11. package/dist/js/core/decorators/api.js.map +1 -1
  12. package/dist/js/core/utils/SafariScrollGuard.js +384 -0
  13. package/dist/js/core/utils/SafariScrollGuard.js.map +1 -0
  14. package/dist/js/decorators.js +4 -0
  15. package/dist/js/decorators.js.map +1 -1
  16. package/dist/js/utils.js +3 -0
  17. package/dist/js/utils.js.map +1 -1
  18. package/dist/types/core/components/functional/queue/queue.d.ts +8 -24
  19. package/dist/types/core/components/functional/queue/queue.d.ts.map +1 -1
  20. package/dist/types/core/components/ui/_css/scroll.d.ts.map +1 -1
  21. package/dist/types/core/decorators/api.d.ts +82 -60
  22. package/dist/types/core/decorators/api.d.ts.map +1 -1
  23. package/dist/types/core/utils/SafariScrollGuard.d.ts +36 -0
  24. package/dist/types/core/utils/SafariScrollGuard.d.ts.map +1 -0
  25. package/dist/types/decorators.d.ts +3 -1
  26. package/dist/types/decorators.d.ts.map +1 -1
  27. package/dist/types/utils.d.ts +1 -0
  28. package/dist/types/utils.d.ts.map +1 -1
  29. package/docs/assets/index-BL6WVF7g.css +1 -0
  30. package/docs/assets/{index-hElUgV9_.js → index-DVn8AeyA.js} +572 -555
  31. package/docs/crawl/docs/_decorators/get.html +64 -81
  32. package/docs/crawl/docs/_decorators/patch.html +35 -23
  33. package/docs/crawl/docs/_decorators/post.html +72 -72
  34. package/docs/crawl/docs/_decorators/put.html +36 -21
  35. package/docs/crawl/docs/_getting-started/ai-agents.html +45 -6
  36. package/docs/crawl/hubs/decorators.html +141 -69
  37. package/docs/crawl/hubs/remote-data.html +141 -69
  38. package/docs/index.html +2 -2
  39. package/docs/llms-full.txt +203 -149
  40. package/docs/llms.txt +4 -4
  41. package/docs/src/core/components/functional/queue/queue.md +0 -0
  42. package/docs/src/core/components/ui/button/button.md +0 -0
  43. package/docs/src/docs/_decorators/get.md +55 -81
  44. package/docs/src/docs/_decorators/patch.md +36 -25
  45. package/docs/src/docs/_decorators/post.md +71 -62
  46. package/docs/src/docs/_decorators/put.md +37 -24
  47. package/docs/src/docs/_getting-started/ai-agents.md +24 -4
  48. package/docs/src/docs/search/docs-search.json +151 -1
  49. package/docs/src/tsconfig.json +3 -0
  50. package/package.json +6 -2
  51. package/src/core/components/functional/queue/queue.ts +33 -164
  52. package/src/core/components/ui/_css/scroll.ts +3 -0
  53. package/src/core/decorators/api.post.spec.ts +79 -1
  54. package/src/core/decorators/api.spec.ts +100 -1
  55. package/src/core/decorators/api.ts +252 -138
  56. package/src/core/utils/SafariScrollGuard.ts +429 -0
  57. package/src/decorators.ts +7 -0
  58. package/src/docs/_decorators/get.md +81 -80
  59. package/src/docs/_decorators/patch.md +36 -25
  60. package/src/docs/_decorators/post.md +99 -62
  61. package/src/docs/_decorators/put.md +37 -24
  62. package/src/docs/components/docs-demo-sources.ts +1 -6
  63. package/src/docs/example/decorators-demo-geo.ts +0 -21
  64. package/src/docs/example/decorators-demo-subscribe-publish-get-demos.ts +41 -132
  65. package/src/docs/search/docs-search.json +156 -241
  66. package/src/docs/tailwind/css/tailwind.css +0 -0
  67. package/src/tsconfig.json +3 -0
  68. package/src/tsconfig.tsbuildinfo +1 -1
  69. package/src/utils.ts +13 -0
  70. package/vite.config.mts +4 -0
  71. package/vitest.setup.ts +22 -0
  72. 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>Loads data through API.getDetailed. The decorated property is ApiResult&lt;T&gt; | null: request, response (or null for dataProvider(...) resolution without HTTP), and typed result.</p>
156
+ <p>@get loads data and stores the result in an ApiResult&lt;T&gt; | null property.</p>
157
157
  <pre class="doc-excerpt">@get
158
158
 
159
- Loads data through API.getDetailed. The decorated property is ApiResult | null: request, response (or null for dataProvider(...) resolution without HTTP), and typed result.
159
+ @get loads data and stores the result in an ApiResult | null property.
160
160
 
161
- Pass an Endpoint as the first argument. Import get and ApiResult from @supersoniks/concorde/decorators, and Endpoint from @supersoniks/concorde/utils/endpoint.
161
+ - payload.result: typed data;
162
+ - payload.response: the HTTP response;
163
+ - payload.request: the request that was sent.
162
164
 
163
- Configuration
165
+ Minimal usage
164
166
 
165
- - Default: HTML.getApiConfiguration(host) (ancestor serviceURL, etc.).
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 (&quot;users&quot;);
167
168
 
168
- Dynamic path
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
- ${prop} on the endpoint or config key is resolved on the host. While a placeholder is null or undefined, no GET runs. Optional skipEmptyPlaceholder: true also blocks &quot;&quot; (empty string only). Details: Dynamic path placeholders.
186
+ const usersGet = get(new Endpoint (&quot;users&quot;));
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
- Pass as the second argument (scoped config) or third (with a configuration key). Same shape as send decorators where applicable:
198
+ Options are the second argument, or the third argument when an API
199
+ configuration key is provided.
175
200
 
176
- | Option | Description |
177
- |--------|-------------|
178
- | skipEmptyPlaceholder | Treat &quot;&quot; as not ready (see Dynamic path). |
179
- | refetchEveryMs | Automatic polling interval (ms). 0 or omitted = no polling. |
180
- | tri</pre>
201
+ - skipEmptyPlaceholder: blocks the GET when ${prop} is &quot;&quot;.
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>Sends data through API.patchDetailed. Same model as @post: decorated property is ApiResult&lt;T&gt; | null (request, response, result).</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
- Sends data through API.patchDetailed. Same model as @post: decorated property is ApiResult | null (request, response, result).
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
- Pass an Endpoint and a DataProviderKey for the request body. Import patch and ApiResult from @supersoniks/concorde/decorators.
218
+ Minimal usage
191
219
 
192
- Configuration
220
+ const bodyKey = new DataProviderKey &gt;(&quot;users.patch&quot;);
221
+ const patchUser = patch(new Endpoint (&quot;users/42&quot;), bodyKey);
193
222
 
194
- Same as @post / @get: scoped HTML.getApiConfiguration(host) or DataProviderKey as third argument.
223
+ @patchUser
224
+ @state()
225
+ payload: ApiResult | null = null;
195
226
 
196
- Options (PatchOptions)
227
+ To run the operation again from the component:
197
228
 
198
- Same shape as PostOptions on @post (ApiSendOptions): refetchEveryMs, skipIfBodyMissing, autoPostOnBodyMutation, triggerKey, skipEmptyPlaceholder. See Dynamic path placeholders for ${sessionId} and empty-string behaviour.
229
+ savePatch() {
230
+ patchUser.send(this);
231
+ }
199
232
 
200
- Import
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
- import { patch, type ApiResult } from &quot;@supersoniks/concorde/decorators&quot;;
203
- import { Endpoint } from &quot;@supersoniks/concorde/utils/endpoint&quot;;
204
- import { DataProviderKey } from &quot;@supersoniks/concorde/dataProviderKey&quot;;
237
+ - autoPostOnBodyMutation
238
+ - skipIfBodyMissing
239
+ - refetchEveryMs
240
+ - skipEmptyPlaceholder
205
241
 
206
- Example
242
+ Pass explicit API configuration as the third argument:
207
243
 
208
- const patchBodyKey = new DataProviderKey&amp;lt;Partial&amp;lt;Resource&amp;gt;&amp;gt;(&quot;resourcePatch&quot;);
244
+ @patch(endpoint, bodyKey, apiConfigurationKey)
209
245
 
210
- @patch(
211
- new Endpoint&amp;lt;Resource, { resourceId: string }&amp;gt;(&quot;resources/${resourceId}&quot;),
212
- patchBodyKey,
213
- { skipEmptyPlaceholder: true },
214
- )
215
- @state()
216
- payload?: ApiResult&amp;lt;Resource&amp;gt; | null;
246
+ Import
247
+
248
+ import { patch, type ApiResult } from &quot;@supersoniks/concorde/decorators&quot;;
249
+ import { DataProviderKey } from &quot;@supersoniks/concorde/dataProviderKey&quot;;
250
+ import { Endpoint } from &quot;@supersoniks/concorde/utils/endpoint&quot;;
217
251
 
218
252
  See also
219
253
 
220
- - @post — POST (live demos)
221
- - @put — full rep</pre>
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>Sends data through API.postDetailed. The decorated property is ApiResult&lt;T&gt; | null: request, response, and typed result.</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
- Sends data through API.postDetailed. The decorated property is ApiResult | null: request, response, and typed result.
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 (&quot;users.form&quot;);
272
+ const createUser = post(new Endpoint (&quot;users&quot;), 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
- Pass an Endpoint as the first argument and a DataProviderKey for the request body as the second. Import post and ApiResult from @supersoniks/concorde/decorators, and Endpoint from @supersoniks/concorde/utils/endpoint.
285
+ Sending the POST again
232
286
 
233
- Configuration
287
+ From the component
234
288
 
235
- Same as @get: scoped HTML.getApiConfiguration(host) by default, or DataProviderKey as third argument. See API configuration for mock demos.
289
+ Keep the decorator to access send(component). The body is read again when the
290
+ operation runs.
236
291
 
237
- Optional PostOptions (third or fourth argument)
292
+ saveAgain() {
293
+ createUser.send(this);
294
+ }
238
295
 
239
- | Option | Description |
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
- When the POST runs again
299
+ Options (PostOptions)
248
300
 
249
- - Body publisher onInternalMutation when autoPostOnBodyMutation is true (defa</pre>
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>Sends data through API.putDetailed. Same model as @post: decorated property is ApiResult&lt;T&gt; | null (request, response, result).</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
- Sends data through API.putDetailed. Same model as @post: decorated property is ApiResult | null (request, response, result).
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
- Pass an Endpoint and a DataProviderKey for the request body. Import put and ApiResult from @supersoniks/concorde/decorators.
321
+ Minimal usage
260
322
 
261
- Configuration
323
+ const bodyKey = new DataProviderKey (&quot;users.form&quot;);
324
+ const updateUser = put(new Endpoint (&quot;users/42&quot;), bodyKey);
262
325
 
263
- Same as @post / @get: scoped HTML.getApiConfiguration(host) or DataProviderKey as third argument.
326
+ @updateUser
327
+ @state()
328
+ payload: ApiResult | null = null;
264
329
 
265
- Options (PutOptions)
330
+ To run the operation again from the component:
266
331
 
267
- Same shape as PostOptions on @post (ApiSendOptions): refetchEveryMs, skipIfBodyMissing, autoPostOnBodyMutation, triggerKey, skipEmptyPlaceholder. See Dynamic path placeholders for ${sessionId} and empty-string behaviour.
332
+ update() {
333
+ updateUser.send(this);
334
+ }
268
335
 
269
- Import
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
- import { put, type ApiResult } from &quot;@supersoniks/concorde/decorators&quot;;
272
- import { Endpoint } from &quot;@supersoniks/concorde/utils/endpoint&quot;;
273
- import { DataProviderKey } from &quot;@supersoniks/concorde/dataProviderKey&quot;;
340
+ - autoPostOnBodyMutation
341
+ - skipIfBodyMissing
342
+ - refetchEveryMs
343
+ - skipEmptyPlaceholder
274
344
 
275
- Example
345
+ Pass explicit API configuration as the third argument:
276
346
 
277
- const bodyKey = new DataProviderKey&amp;lt;UpdatePayload&amp;gt;(&quot;resourceBody&quot;);
347
+ @put(endpoint, bodyKey, apiConfigurationKey)
278
348
 
279
- @put(new Endpoint&amp;lt;Resource, { resourceId: string }&amp;gt;(&quot;resources/${resourceId}&quot;), bodyKey)
280
- @state()
281
- payload?: ApiResult&amp;lt;Resource&amp;gt; | null;
349
+ Import
282
350
 
283
- Changing resourceId on the host re-runs the PUT when the path becomes ready — see Dynamic path placeholders.
351
+ import { put, type ApiResult } from &quot;@supersoniks/concorde/decorators&quot;;
352
+ import { DataProviderKey } from &quot;@supersoniks/concorde/dataProviderKey&quot;;
353
+ import { Endpoint } from &quot;@supersoniks/concorde/utils/endpoint&quot;;
284
354
 
285
355
  See also
286
356
 
287
- - @post —</pre>
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-hElUgV9_.js"></script>
14
- <link rel="stylesheet" crossorigin href="./assets/index-Bnp7gVaA.css">
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