@wcstack/fetch 4.4.0 → 4.5.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/dist/index.d.ts CHANGED
@@ -274,6 +274,7 @@ declare class Fetch extends HTMLElement {
274
274
  private _autoPending;
275
275
  private _connectResolve;
276
276
  private _lastFetchedUrl;
277
+ private _toldTriggerWithoutUrl;
277
278
  private _internals;
278
279
  constructor();
279
280
  get debugStates(): string[];
@@ -339,6 +340,13 @@ declare class Fetch extends HTMLElement {
339
340
  * sent an empty POST on every navigation after the first post, without a word
340
341
  * (docs/seam-apps.md, ssr-news; docs/mistake-catalogue.md).
341
342
  */
343
+ /**
344
+ * A `trigger` written while `url` is empty does nothing (timing-and-firing-contract §1.5),
345
+ * and said nothing: a `trigger` before `url` in one `data-wcs` (bindings apply in the
346
+ * order written), a url that state has not computed yet. Said once per element
347
+ * (docs/v4-direction-2026-10.md §5.1, the I/O command policy).
348
+ */
349
+ private _warnTriggerWithoutUrl;
342
350
  private _warnUnsafeAutoFetch;
343
351
  fetch(): Promise<any>;
344
352
  attributeChangedCallback(name: string, _oldValue: string | null, _newValue: string | null): void;
package/dist/index.esm.js CHANGED
@@ -1158,6 +1158,7 @@ class Fetch extends HTMLElement {
1158
1158
  _autoPending = false;
1159
1159
  _connectResolve = null;
1160
1160
  _lastFetchedUrl = null;
1161
+ _toldTriggerWithoutUrl = false;
1161
1162
  _internals = null;
1162
1163
  constructor() {
1163
1164
  super();
@@ -1320,8 +1321,10 @@ class Fetch extends HTMLElement {
1320
1321
  // surfacing a `wcs-fetch:trigger-changed` "completion" would lie to observers.
1321
1322
  // Keeping the flag false also avoids stalling — once url is provided, writing
1322
1323
  // `true` again is a real false→true transition that triggers the fetch.
1323
- if (!this.url)
1324
+ if (!this.url) {
1325
+ this._warnTriggerWithoutUrl();
1324
1326
  return;
1327
+ }
1325
1328
  this._trigger = true;
1326
1329
  this.fetch().finally(() => {
1327
1330
  this._trigger = false;
@@ -1445,6 +1448,20 @@ class Fetch extends HTMLElement {
1445
1448
  * sent an empty POST on every navigation after the first post, without a word
1446
1449
  * (docs/seam-apps.md, ssr-news; docs/mistake-catalogue.md).
1447
1450
  */
1451
+ /**
1452
+ * A `trigger` written while `url` is empty does nothing (timing-and-firing-contract §1.5),
1453
+ * and said nothing: a `trigger` before `url` in one `data-wcs` (bindings apply in the
1454
+ * order written), a url that state has not computed yet. Said once per element
1455
+ * (docs/v4-direction-2026-10.md §5.1, the I/O command policy).
1456
+ */
1457
+ _warnTriggerWithoutUrl() {
1458
+ if (this._toldTriggerWithoutUrl)
1459
+ return;
1460
+ this._toldTriggerWithoutUrl = true;
1461
+ console.warn("[@wcstack/fetch] [wcs/command-not-ready] trigger was refused: there is no url, so nothing is fetched. " +
1462
+ "Write url before trigger (bindings apply in the order written), and write trigger again once there is one. " +
1463
+ "(Said once per element.)", this);
1464
+ }
1448
1465
  _warnUnsafeAutoFetch() {
1449
1466
  const method = this.method;
1450
1467
  if (method === "GET" || method === "HEAD" || method === "OPTIONS")