@wcstack/fetch 1.14.0 → 1.15.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
@@ -1,3 +1,24 @@
1
+ interface IWcBindableProperty {
2
+ readonly name: string;
3
+ readonly event: string;
4
+ readonly getter?: (event: Event) => any;
5
+ }
6
+ interface IWcBindableInput {
7
+ readonly name: string;
8
+ readonly attribute?: string;
9
+ }
10
+ interface IWcBindableCommand {
11
+ readonly name: string;
12
+ readonly async?: boolean;
13
+ }
14
+ interface IWcBindable {
15
+ readonly protocol: "wc-bindable";
16
+ readonly version: 1;
17
+ readonly properties: readonly IWcBindableProperty[];
18
+ readonly inputs?: readonly IWcBindableInput[];
19
+ readonly commands?: readonly IWcBindableCommand[];
20
+ }
21
+
1
22
  interface ITagNames {
2
23
  readonly fetch: string;
3
24
  readonly fetchHeader: string;
@@ -20,26 +41,7 @@ interface IWritableConfig {
20
41
  triggerAttribute?: string;
21
42
  tagNames?: IWritableTagNames;
22
43
  }
23
- interface IWcBindableProperty {
24
- readonly name: string;
25
- readonly event: string;
26
- readonly getter?: (event: Event) => any;
27
- }
28
- interface IWcBindableInput {
29
- readonly name: string;
30
- readonly attribute?: string;
31
- }
32
- interface IWcBindableCommand {
33
- readonly name: string;
34
- readonly async?: boolean;
35
- }
36
- interface IWcBindable {
37
- readonly protocol: "wc-bindable";
38
- readonly version: 1;
39
- readonly properties: IWcBindableProperty[];
40
- readonly inputs?: readonly IWcBindableInput[];
41
- readonly commands?: readonly IWcBindableCommand[];
42
- }
44
+
43
45
  /**
44
46
  * HTTP error returned when the server responds with a non-ok status (>= 400).
45
47
  */
@@ -50,7 +52,7 @@ interface WcsFetchHttpError {
50
52
  }
51
53
  /**
52
54
  * Value types for FetchCore (headless) — the 4 async state properties.
53
- * Use with `bind()` from `@wc-bindable/core` for compile-time type checking.
55
+ * Use with `bind()` from `a wc-bindable binding core` for compile-time type checking.
54
56
  *
55
57
  * @example
56
58
  * ```typescript
@@ -64,6 +66,8 @@ interface WcsFetchCoreValues<T = unknown> {
64
66
  loading: boolean;
65
67
  error: WcsFetchHttpError | Error | null;
66
68
  status: number;
69
+ /** Managed object URL for a `responseType: "blob"` response; null otherwise. */
70
+ objectURL: string | null;
67
71
  }
68
72
  /**
69
73
  * Value types for the Shell (`<wcs-fetch>`) — extends Core with `trigger`.
@@ -86,12 +90,14 @@ declare function bootstrapFetch(userConfig?: IWritableConfig): void;
86
90
 
87
91
  declare function getConfig(): IConfig;
88
92
 
93
+ type FetchResponseType = "auto" | "json" | "text" | "blob" | "arrayBuffer";
89
94
  interface FetchRequestOptions {
90
95
  method?: string;
91
96
  headers?: Record<string, string>;
92
97
  body?: BodyInit | null;
93
98
  contentType?: string | null;
94
99
  forceText?: boolean;
100
+ responseType?: FetchResponseType;
95
101
  }
96
102
  declare class FetchCore extends EventTarget {
97
103
  static wcBindable: IWcBindable;
@@ -100,17 +106,26 @@ declare class FetchCore extends EventTarget {
100
106
  private _loading;
101
107
  private _error;
102
108
  private _status;
109
+ private _objectURL;
103
110
  private _abortController;
104
111
  private _promise;
112
+ private _gen;
113
+ private _ready;
105
114
  constructor(target?: EventTarget);
115
+ get ready(): Promise<void>;
116
+ observe(): Promise<void>;
117
+ dispose(): void;
106
118
  get value(): any;
107
119
  get loading(): boolean;
108
120
  get error(): any;
109
121
  get status(): number;
122
+ get objectURL(): string | null;
110
123
  get promise(): Promise<any>;
111
124
  private _setLoading;
112
125
  private _setError;
113
126
  private _setResponse;
127
+ private _createObjectURL;
128
+ private _revokeObjectURL;
114
129
  abort(): void;
115
130
  fetch(url: string, options?: FetchRequestOptions): Promise<any>;
116
131
  private _doFetch;
@@ -134,10 +149,13 @@ declare class Fetch extends HTMLElement {
134
149
  set method(value: string | null);
135
150
  get target(): string | null;
136
151
  set target(value: string | null);
152
+ get responseType(): FetchResponseType;
153
+ set responseType(value: string | null);
137
154
  get value(): any;
138
155
  get loading(): boolean;
139
156
  get error(): any;
140
157
  get status(): number;
158
+ get objectURL(): string | null;
141
159
  get promise(): Promise<any>;
142
160
  get connectedCallbackPromise(): Promise<void>;
143
161
  get manual(): boolean;
@@ -147,6 +165,7 @@ declare class Fetch extends HTMLElement {
147
165
  get trigger(): boolean;
148
166
  set trigger(value: boolean);
149
167
  private _collectHeaders;
168
+ private _isNativeBodyInit;
150
169
  private _collectBody;
151
170
  abort(): void;
152
171
  /**
package/dist/index.esm.js CHANGED
@@ -47,10 +47,6 @@ function setConfig(partialConfig) {
47
47
  frozenConfig = null;
48
48
  }
49
49
 
50
- function raiseError(message) {
51
- throw new Error(`[@wcstack/fetch] ${message}`);
52
- }
53
-
54
50
  class FetchCore extends EventTarget {
55
51
  static wcBindable = {
56
52
  protocol: "wc-bindable",
@@ -60,6 +56,10 @@ class FetchCore extends EventTarget {
60
56
  { name: "loading", event: "wcs-fetch:loading-changed" },
61
57
  { name: "error", event: "wcs-fetch:error" },
62
58
  { name: "status", event: "wcs-fetch:response", getter: (e) => e.detail.status },
59
+ // Managed object URL for a `responseType: "blob"` response (null otherwise).
60
+ // The Core revokes the previous URL on each new response and on dispose, so
61
+ // a consumer can bind it straight into <img src> without lifecycle glue.
62
+ { name: "objectURL", event: "wcs-fetch:response", getter: (e) => e.detail.objectURL },
63
63
  ],
64
64
  inputs: [
65
65
  { name: "url" },
@@ -75,12 +75,39 @@ class FetchCore extends EventTarget {
75
75
  _loading = false;
76
76
  _error = null;
77
77
  _status = 0;
78
+ _objectURL = null;
78
79
  _abortController = null;
79
80
  _promise = Promise.resolve(null);
81
+ // Generation guard (§3.4): bumped on dispose() (and each fetch start). An
82
+ // in-flight request that settles after dispose / a superseding start has a
83
+ // stale `gen` and MUST NOT write state to a torn-down element. A boolean flag
84
+ // is insufficient (dispose→observe would let stale work slip through).
85
+ _gen = 0;
86
+ // SSR (§3.8): no asynchronous probe to await, so readiness is immediate.
87
+ _ready = Promise.resolve();
80
88
  constructor(target) {
81
89
  super();
82
90
  this._target = target ?? this;
83
91
  }
92
+ get ready() {
93
+ return this._ready;
94
+ }
95
+ // Lifecycle (§3.5). Fetch is command-driven with no subscription to
96
+ // establish, so observe() is an idempotent no-op that resolves once ready;
97
+ // dispose() invalidates any in-flight request and aborts it.
98
+ observe() {
99
+ return this._ready;
100
+ }
101
+ dispose() {
102
+ this._gen++;
103
+ this.abort();
104
+ // Release any outstanding blob object URL on teardown (the other revoke point
105
+ // is _setResponse, which drops the previous URL when a new response arrives).
106
+ if (this._objectURL !== null) {
107
+ this._revokeObjectURL(this._objectURL);
108
+ this._objectURL = null;
109
+ }
110
+ }
84
111
  get value() {
85
112
  return this._value;
86
113
  }
@@ -93,6 +120,9 @@ class FetchCore extends EventTarget {
93
120
  get status() {
94
121
  return this._status;
95
122
  }
123
+ get objectURL() {
124
+ return this._objectURL;
125
+ }
96
126
  get promise() {
97
127
  return this._promise;
98
128
  }
@@ -110,14 +140,37 @@ class FetchCore extends EventTarget {
110
140
  bubbles: true,
111
141
  }));
112
142
  }
113
- _setResponse(value, status) {
143
+ _setResponse(value, status, objectURL = null) {
144
+ // Revoke the previous blob object URL before replacing it. Any new response
145
+ // (success, HTTP error, or network error all funnel through here) supersedes
146
+ // the prior one, so the old URL is no longer needed; this plus dispose()
147
+ // revocation keeps blob downloads leak-free.
148
+ if (this._objectURL !== null) {
149
+ this._revokeObjectURL(this._objectURL);
150
+ }
151
+ this._objectURL = objectURL;
114
152
  this._value = value;
115
153
  this._status = status;
116
154
  this._target.dispatchEvent(new CustomEvent("wcs-fetch:response", {
117
- detail: { value, status },
155
+ detail: { value, status, objectURL },
118
156
  bubbles: true,
119
157
  }));
120
158
  }
159
+ // Object URL lifecycle for responseType: "blob". The Core owns the blob's
160
+ // object URL (mirrors RecorderCore) so a consumer can bind `objectURL` straight
161
+ // into <img src>/<a href> without managing createObjectURL/revokeObjectURL. Both
162
+ // helpers tolerate environments without URL.createObjectURL (SSR / headless).
163
+ _createObjectURL(blob) {
164
+ if (typeof URL !== "undefined" && typeof URL.createObjectURL === "function") {
165
+ return URL.createObjectURL(blob);
166
+ }
167
+ return null;
168
+ }
169
+ _revokeObjectURL(url) {
170
+ if (typeof URL !== "undefined" && typeof URL.revokeObjectURL === "function") {
171
+ URL.revokeObjectURL(url);
172
+ }
173
+ }
121
174
  abort() {
122
175
  if (this._abortController) {
123
176
  this._abortController.abort();
@@ -125,8 +178,12 @@ class FetchCore extends EventTarget {
125
178
  }
126
179
  }
127
180
  async fetch(url, options = {}) {
181
+ // never-throw (§3.6): 引数バリデーション失敗は例外ではなく error プロパティに
182
+ // 流し、サニタイズ値(null)を返す。command-token 経路からの呼び出しが unhandled
183
+ // rejection にならず、「fetch() は全終了ケースで resolve」契約とも整合する。
128
184
  if (!url) {
129
- raiseError("url attribute is required.");
185
+ this._setError({ message: "url attribute is required." });
186
+ return null;
130
187
  }
131
188
  const p = this._doFetch(url, options);
132
189
  this._promise = p;
@@ -143,9 +200,12 @@ class FetchCore extends EventTarget {
143
200
  const ac = new AbortController();
144
201
  this._abortController = ac;
145
202
  const { signal } = ac;
203
+ // Capture the generation at async start (§3.4). A completion that runs after
204
+ // dispose() (which bumps _gen) is stale and must not write state.
205
+ const gen = ++this._gen;
146
206
  this._setLoading(true);
147
207
  this._setError(null);
148
- const { method = "GET", body = null, contentType = null, forceText = false, } = options;
208
+ const { method = "GET", body = null, contentType = null, forceText = false, responseType = "auto", } = options;
149
209
  // Copy the caller's headers so the contentType injection below never mutates
150
210
  // the object passed in by a headless consumer (the Shell already builds a
151
211
  // fresh object, but direct FetchCore users may reuse theirs).
@@ -163,6 +223,11 @@ class FetchCore extends EventTarget {
163
223
  requestInit.body = body;
164
224
  }
165
225
  const response = await globalThis.fetch(url, requestInit);
226
+ // A stale generation means dispose() (or a superseding fetch) ran while the
227
+ // request was in flight. Drop the result without touching torn-down state.
228
+ if (gen !== this._gen) {
229
+ return null;
230
+ }
166
231
  if (!response.ok) {
167
232
  const errorBody = await response.text().catch(() => "");
168
233
  const error = { status: response.status, statusText: response.statusText, body: errorBody };
@@ -182,10 +247,31 @@ class FetchCore extends EventTarget {
182
247
  this._setResponse(null, response.status);
183
248
  }
184
249
  else if (forceText) {
250
+ // HTML-replace mode (the Shell sets forceText when `target` is present)
251
+ // always reads text and takes priority over responseType.
185
252
  const text = await response.text();
186
253
  this._setResponse(text, response.status);
187
254
  }
255
+ else if (responseType === "blob") {
256
+ const blob = await response.blob();
257
+ // Publish a managed object URL alongside the Blob so consumers can bind it
258
+ // directly into <img src> etc.
259
+ this._setResponse(blob, response.status, this._createObjectURL(blob));
260
+ }
261
+ else if (responseType === "arrayBuffer") {
262
+ const buffer = await response.arrayBuffer();
263
+ this._setResponse(buffer, response.status);
264
+ }
265
+ else if (responseType === "text") {
266
+ const text = await response.text();
267
+ this._setResponse(text, response.status);
268
+ }
269
+ else if (responseType === "json") {
270
+ const data = await response.json();
271
+ this._setResponse(data, response.status);
272
+ }
188
273
  else {
274
+ // "auto" (default): sniff Content-Type — JSON when it says so, else text.
189
275
  const responseContentType = response.headers.get("Content-Type") || "";
190
276
  if (responseContentType.includes("application/json")) {
191
277
  const data = await response.json();
@@ -200,17 +286,17 @@ class FetchCore extends EventTarget {
200
286
  return this._value;
201
287
  }
202
288
  catch (e) {
289
+ // Stale completion (dispose / superseding fetch ran during a later await
290
+ // such as response.json()). Drop the result without writing state.
291
+ if (gen !== this._gen) {
292
+ return null;
293
+ }
203
294
  if (e.name === "AbortError") {
204
- // Suppress loading=false when a later request has already taken over. A
205
- // subsequent fetch() aborts this one via abort() (which nulls the field) and
206
- // then immediately installs its own controller, so `this._abortController` is
207
- // non-null here. That newer request has already emitted loading=true and is
208
- // still in flight, so emitting loading=false now would make observers see a
209
- // spurious flicker. An explicit abort() leaves the field null, so that path
210
- // still reports loading=false as expected.
211
- if (this._abortController === null) {
212
- this._setLoading(false);
213
- }
295
+ // A matching generation means this is an explicit abort() of the current
296
+ // request (a superseding fetch bumps _gen and is caught by the stale guard
297
+ // above; dispose() likewise bumps _gen). Explicit abort clears loading so
298
+ // observers leave the in-flight state.
299
+ this._setLoading(false);
214
300
  return null;
215
301
  }
216
302
  this._setError(e);
@@ -293,6 +379,7 @@ class Fetch extends HTMLElement {
293
379
  { name: "target" },
294
380
  { name: "manual" },
295
381
  { name: "body" },
382
+ { name: "responseType" },
296
383
  { name: "trigger" },
297
384
  ],
298
385
  };
@@ -346,6 +433,20 @@ class Fetch extends HTMLElement {
346
433
  this.setAttribute("target", value);
347
434
  }
348
435
  }
436
+ // Response body interpretation. Backed by the `response-type` attribute so it is
437
+ // settable from HTML, JS, or a binding. An unknown value falls through to the
438
+ // Core's "auto" branch. `target` (HTML-replace mode) overrides this.
439
+ get responseType() {
440
+ return this.getAttribute("response-type") || "auto";
441
+ }
442
+ set responseType(value) {
443
+ if (value == null) {
444
+ this.removeAttribute("response-type");
445
+ }
446
+ else {
447
+ this.setAttribute("response-type", value);
448
+ }
449
+ }
349
450
  get value() {
350
451
  return this._core.value;
351
452
  }
@@ -358,6 +459,9 @@ class Fetch extends HTMLElement {
358
459
  get status() {
359
460
  return this._core.status;
360
461
  }
462
+ get objectURL() {
463
+ return this._core.objectURL;
464
+ }
361
465
  get promise() {
362
466
  return this._core.promise;
363
467
  }
@@ -423,13 +527,32 @@ class Fetch extends HTMLElement {
423
527
  }
424
528
  return headers;
425
529
  }
530
+ // fetch がネイティブに扱える BodyInit か判定する。これらは JSON.stringify せず
531
+ // 素通しし、Content-Type をブラウザに委ねる (FormData の multipart boundary、
532
+ // Blob の type、URLSearchParams の application/x-www-form-urlencoded を自動付与
533
+ // させるため、_collectBody は contentType に null を返す)。ReadableStream は
534
+ // RequestInit.duplex: 'half' を要するため初版では対象外とし、従来どおり扱う。
535
+ _isNativeBodyInit(value) {
536
+ return value instanceof Blob // File は Blob のサブクラス
537
+ || value instanceof FormData
538
+ || value instanceof URLSearchParams
539
+ || value instanceof ArrayBuffer
540
+ || ArrayBuffer.isView(value); // TypedArray / DataView
541
+ }
426
542
  _collectBody(bodySnapshot) {
427
543
  // JS API経由のbodyが優先
428
544
  if (bodySnapshot !== null) {
429
- return {
430
- body: typeof bodySnapshot === "string" ? bodySnapshot : JSON.stringify(bodySnapshot),
431
- contentType: typeof bodySnapshot === "string" ? null : "application/json",
432
- };
545
+ // 文字列はそのまま。Content-Type はユーザーのヘッダ指定に委ねる。
546
+ if (typeof bodySnapshot === "string") {
547
+ return { body: bodySnapshot, contentType: null };
548
+ }
549
+ // ネイティブ BodyInit (Blob/File/FormData/URLSearchParams/ArrayBuffer/TypedArray)
550
+ // は素通し。Content-Type はブラウザに委ねるため null を返す。
551
+ if (this._isNativeBodyInit(bodySnapshot)) {
552
+ return { body: bodySnapshot, contentType: null };
553
+ }
554
+ // それ以外のオブジェクトは JSON 化する。
555
+ return { body: JSON.stringify(bodySnapshot), contentType: "application/json" };
433
556
  }
434
557
  // サブタグからbodyを取得
435
558
  const bodyElement = this.querySelector(config.tagNames.fetchBody);
@@ -501,12 +624,22 @@ class Fetch extends HTMLElement {
501
624
  const bodySnapshot = this._body;
502
625
  this._body = null;
503
626
  const { body, contentType } = this._collectBody(bodySnapshot);
627
+ // FormData に手動で Content-Type を付けると、ブラウザが付与するはずの multipart
628
+ // boundary が失われてサーバー側でパースできなくなる。ヘッダはユーザー指定を
629
+ // 尊重して素通しするが、この典型的な誤設定は警告する。
630
+ if (body instanceof FormData &&
631
+ Object.keys(headers).some((name) => name.toLowerCase() === "content-type")) {
632
+ console.warn("[@wcstack/fetch] A manual Content-Type header was set alongside a FormData body. " +
633
+ "This drops the multipart boundary the browser adds automatically; remove the " +
634
+ "Content-Type header (e.g. the <wcs-fetch-header>) to fix multipart uploads.");
635
+ }
504
636
  const result = await this._core.fetch(this.url, {
505
637
  method: this.method,
506
638
  headers,
507
639
  body,
508
640
  contentType,
509
641
  forceText: !!this.target,
642
+ responseType: this.responseType,
510
643
  });
511
644
  // HTML置換モード
512
645
  // Security: the response is injected as raw innerHTML without sanitization.
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/config.ts","../src/raiseError.ts","../src/core/FetchCore.ts","../src/autoTrigger.ts","../src/components/Fetch.ts","../src/components/FetchHeader.ts","../src/components/FetchBody.ts","../src/components/InfiniteScroll.ts","../src/registerComponents.ts","../src/bootstrapFetch.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n autoTrigger: boolean;\n triggerAttribute: string;\n tagNames: {\n fetch: string;\n fetchHeader: string;\n fetchBody: string;\n infiniteScroll: string;\n };\n}\n\nconst _config: IInternalConfig = {\n autoTrigger: true,\n triggerAttribute: \"data-fetchtarget\",\n tagNames: {\n fetch: \"wcs-fetch\",\n fetchHeader: \"wcs-fetch-header\",\n fetchBody: \"wcs-fetch-body\",\n infiniteScroll: \"wcs-infinite-scroll\",\n },\n};\n\nfunction deepFreeze<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n Object.freeze(obj);\n for (const key of Object.keys(obj)) {\n deepFreeze((obj as Record<string, unknown>)[key]);\n }\n return obj;\n}\n\nfunction deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n const clone: Record<string, unknown> = {};\n for (const key of Object.keys(obj)) {\n clone[key] = deepClone((obj as Record<string, unknown>)[key]);\n }\n return clone as T;\n}\n\nlet frozenConfig: IConfig | null = null;\n\nexport const config: IConfig = _config as IConfig;\n\nexport function getConfig(): IConfig {\n if (!frozenConfig) {\n frozenConfig = deepFreeze(deepClone(_config));\n }\n return frozenConfig;\n}\n\nexport function setConfig(partialConfig: IWritableConfig): void {\n if (typeof partialConfig.autoTrigger === \"boolean\") {\n _config.autoTrigger = partialConfig.autoTrigger;\n }\n if (typeof partialConfig.triggerAttribute === \"string\") {\n _config.triggerAttribute = partialConfig.triggerAttribute;\n }\n if (partialConfig.tagNames) {\n Object.assign(_config.tagNames, partialConfig.tagNames);\n }\n frozenConfig = null;\n}\n","export function raiseError(message: string): never {\n throw new Error(`[@wcstack/fetch] ${message}`);\n}\n","import { raiseError } from \"../raiseError.js\";\nimport { IWcBindable } from \"../types.js\";\n\nexport interface FetchRequestOptions {\n method?: string;\n headers?: Record<string, string>;\n body?: BodyInit | null;\n contentType?: string | null;\n forceText?: boolean;\n}\n\nexport class FetchCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"value\", event: \"wcs-fetch:response\", getter: (e: Event) => (e as CustomEvent).detail.value },\n { name: \"loading\", event: \"wcs-fetch:loading-changed\" },\n { name: \"error\", event: \"wcs-fetch:error\" },\n { name: \"status\", event: \"wcs-fetch:response\", getter: (e: Event) => (e as CustomEvent).detail.status },\n ],\n inputs: [\n { name: \"url\" },\n { name: \"method\" },\n ],\n commands: [\n { name: \"fetch\", async: true },\n { name: \"abort\" },\n ],\n };\n\n private _target: EventTarget;\n private _value: any = null;\n private _loading: boolean = false;\n private _error: any = null;\n private _status: number = 0;\n private _abortController: AbortController | null = null;\n private _promise: Promise<any> = Promise.resolve(null);\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n }\n\n get value(): any {\n return this._value;\n }\n\n get loading(): boolean {\n return this._loading;\n }\n\n get error(): any {\n return this._error;\n }\n\n get status(): number {\n return this._status;\n }\n\n get promise(): Promise<any> {\n return this._promise;\n }\n\n private _setLoading(loading: boolean): void {\n this._loading = loading;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:loading-changed\", {\n detail: loading,\n bubbles: true,\n }));\n }\n\n private _setError(error: any): void {\n this._error = error;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n private _setResponse(value: any, status: number): void {\n this._value = value;\n this._status = status;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:response\", {\n detail: { value, status },\n bubbles: true,\n }));\n }\n\n abort(): void {\n if (this._abortController) {\n this._abortController.abort();\n this._abortController = null;\n }\n }\n\n async fetch(url: string, options: FetchRequestOptions = {}): Promise<any> {\n if (!url) {\n raiseError(\"url attribute is required.\");\n }\n\n const p = this._doFetch(url, options);\n this._promise = p;\n return p;\n }\n\n private async _doFetch(url: string, options: FetchRequestOptions): Promise<any> {\n // 進行中のリクエストをキャンセル\n this.abort();\n\n // Hold the controller in a local so the finally block (which can run after a\n // subsequent fetch has already replaced this._abortController) only clears the\n // field when it still owns it. Without the identity check, an aborted earlier\n // request's finally would null out the controller of the request that superseded\n // it, leaving the later request un-abortable.\n const ac = new AbortController();\n this._abortController = ac;\n const { signal } = ac;\n\n this._setLoading(true);\n this._setError(null);\n\n const {\n method = \"GET\",\n body = null,\n contentType = null,\n forceText = false,\n } = options;\n\n // Copy the caller's headers so the contentType injection below never mutates\n // the object passed in by a headless consumer (the Shell already builds a\n // fresh object, but direct FetchCore users may reuse theirs).\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n\n try {\n if (contentType && !headers[\"Content-Type\"]) {\n headers[\"Content-Type\"] = contentType;\n }\n\n const requestInit: RequestInit = {\n method,\n headers,\n signal,\n };\n\n if (method !== \"GET\" && method !== \"HEAD\" && body !== null) {\n requestInit.body = body;\n }\n\n const response = await globalThis.fetch(url, requestInit);\n\n if (!response.ok) {\n const errorBody = await response.text().catch(() => \"\");\n const error = { status: response.status, statusText: response.statusText, body: errorBody };\n this._setError(error);\n // Notify `status` observers on HTTP errors too. The `status` property is\n // surfaced via the `wcs-fetch:response` event (getter reads detail.status),\n // so without dispatching it here a bind() subscriber would never see the\n // error status (404, 500, ...). `value` is reset to null on error.\n this._setResponse(null, response.status);\n this._setLoading(false);\n return null;\n }\n\n if (method === \"HEAD\") {\n // HEAD responses carry no body by spec. Reading it as JSON would throw a\n // parse error on the empty body (and end up as a spurious `error`), so skip\n // body reading entirely and surface only the status with a null value.\n this._setResponse(null, response.status);\n } else if (forceText) {\n const text = await response.text();\n this._setResponse(text, response.status);\n } else {\n const responseContentType = response.headers.get(\"Content-Type\") || \"\";\n if (responseContentType.includes(\"application/json\")) {\n const data = await response.json();\n this._setResponse(data, response.status);\n } else {\n const text = await response.text();\n this._setResponse(text, response.status);\n }\n }\n\n this._setLoading(false);\n return this._value;\n } catch (e: any) {\n if (e.name === \"AbortError\") {\n // Suppress loading=false when a later request has already taken over. A\n // subsequent fetch() aborts this one via abort() (which nulls the field) and\n // then immediately installs its own controller, so `this._abortController` is\n // non-null here. That newer request has already emitted loading=true and is\n // still in flight, so emitting loading=false now would make observers see a\n // spurious flicker. An explicit abort() leaves the field null, so that path\n // still reports loading=false as expected.\n if (this._abortController === null) {\n this._setLoading(false);\n }\n return null;\n }\n this._setError(e);\n // Reset value/status on network errors too, mirroring the HTTP-error path\n // (`_setResponse(null, response.status)`). Without this, a prior successful\n // request's value/status would linger while `error` is non-null, showing\n // observers an inconsistent state (e.g. status=200 alongside a network\n // error). status=0 is the web-platform convention for \"no HTTP response\"\n // (matches XMLHttpRequest.status on network failure) and the initial value.\n this._setResponse(null, 0);\n this._setLoading(false);\n return null;\n } finally {\n if (this._abortController === ac) {\n this._abortController = null;\n }\n }\n }\n}\n","import { config } from \"./config.js\";\nimport type { Fetch } from \"./components/Fetch.js\";\n\nlet registered = false;\n\nfunction handleClick(event: Event): void {\n const target = event.target;\n if (!(target instanceof Element)) return;\n\n const triggerElement = target.closest<Element>(`[${config.triggerAttribute}]`);\n if (!triggerElement) return;\n\n const fetchId = triggerElement.getAttribute(config.triggerAttribute);\n if (!fetchId) return;\n\n // Resolve the registered constructor at call time instead of importing Fetch\n // as a value. The value import created a components/Fetch.ts ⇄ autoTrigger.ts\n // cycle (Fetch.connectedCallback() calls registerAutoTrigger()). instanceof\n // against the customElements registry keeps the exact same identity guarantee\n // — only the registered <wcs-fetch> class matches — without the import cycle.\n const FetchCtor = customElements.get(config.tagNames.fetch);\n const el = document.getElementById(fetchId);\n if (!FetchCtor || !(el instanceof FetchCtor)) return;\n const fetchElement = el as Fetch;\n\n // Skip when the target has no url. fetch() is fire-and-forget here (its returned\n // promise is intentionally not awaited), and FetchCore.fetch() rejects synchronously\n // on an empty url. Without this guard that rejection would surface as an unhandled\n // promise rejection. Treat a url-less target as \"nothing to do\", consistent with the\n // other early returns above.\n if (!fetchElement.url) return;\n\n // Suppress the element's default action so a fetch can fire without navigating.\n // Intentional: do not attach data-fetchtarget to an element whose default action\n // you also want (real <a href> link, form-submit button) — it will be cancelled.\n // See README \"Optional DOM Triggering\".\n event.preventDefault();\n fetchElement.fetch();\n}\n\nexport function registerAutoTrigger(): void {\n if (registered) return;\n registered = true;\n document.addEventListener(\"click\", handleClick);\n}\n\nexport function unregisterAutoTrigger(): void {\n if (!registered) return;\n registered = false;\n document.removeEventListener(\"click\", handleClick);\n}\n","import { config } from \"../config.js\";\nimport { IWcBindable } from \"../types.js\";\nimport { FetchCore } from \"../core/FetchCore.js\";\nimport { FetchHeader } from \"./FetchHeader.js\";\nimport { FetchBody } from \"./FetchBody.js\";\nimport { registerAutoTrigger } from \"../autoTrigger.js\";\n\nexport class Fetch extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n static wcBindable: IWcBindable = {\n ...FetchCore.wcBindable,\n properties: [\n ...FetchCore.wcBindable.properties,\n { name: \"trigger\", event: \"wcs-fetch:trigger-changed\" },\n ],\n // Shell-level input surface. The Core declares only the portable `url` / `method`;\n // the Shell adds the DOM-driven settable surface. No `attribute` hints are given:\n // these setters already reflect to their attributes themselves, so a binding system\n // that mirrors inputs[].attribute would set the attribute twice. `commands`\n // (fetch / abort) are inherited unchanged from the Core via the spread above.\n inputs: [\n { name: \"url\" },\n { name: \"method\" },\n { name: \"target\" },\n { name: \"manual\" },\n { name: \"body\" },\n { name: \"trigger\" },\n ],\n };\n static get observedAttributes(): string[] { return [\"url\"]; }\n\n private _core: FetchCore;\n private _body: any = null;\n private _trigger: boolean = false;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n // Auto-fetch coalescing state (see _scheduleAutoFetch).\n private _autoPending: boolean = false;\n private _connectResolve: (() => void) | null = null;\n private _lastFetchedUrl: string | null = null;\n\n constructor() {\n super();\n this._core = new FetchCore(this);\n }\n\n // Input setters normalize null/undefined to attribute removal instead of\n // letting setAttribute stringify them (\"undefined\" url would auto-fetch\n // /undefined, \"undefined\" method is an invalid HTTP method). The binder\n // already skips undefined writes; this guards direct JS assignment too.\n get url(): string {\n return this.getAttribute(\"url\") || \"\";\n }\n\n set url(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"url\");\n } else {\n this.setAttribute(\"url\", value);\n }\n }\n\n get method(): string {\n return (this.getAttribute(\"method\") || \"GET\").toUpperCase();\n }\n\n set method(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"method\");\n } else {\n this.setAttribute(\"method\", value);\n }\n }\n\n get target(): string | null {\n return this.getAttribute(\"target\");\n }\n\n set target(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"target\");\n } else {\n this.setAttribute(\"target\", value);\n }\n }\n\n get value(): any {\n return this._core.value;\n }\n\n get loading(): boolean {\n return this._core.loading;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get status(): number {\n return this._core.status;\n }\n\n get promise(): Promise<any> {\n return this._core.promise;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n get manual(): boolean {\n return this.hasAttribute(\"manual\");\n }\n\n set manual(value: boolean) {\n if (value) {\n this.setAttribute(\"manual\", \"\");\n } else {\n this.removeAttribute(\"manual\");\n }\n }\n\n get body(): any {\n return this._body;\n }\n\n set body(value: any) {\n // Normalize undefined to null: _collectBody treats \"!== null\" as \"body was\n // provided\", so a raw undefined would serialize as a JSON request body.\n this._body = value ?? null;\n }\n\n get trigger(): boolean {\n return this._trigger;\n }\n\n set trigger(value: boolean) {\n const v = !!value;\n if (v) {\n // Skip when url is empty. fetch() is fire-and-forget here (its returned\n // promise is intentionally only chained with .finally() to reset the flag,\n // never .catch()'d), and FetchCore.fetch() rejects on an empty url. Without\n // this guard that rejection — re-thrown by .finally() — surfaces as an\n // unhandled promise rejection. Mirrors the url-less guard in autoTrigger.\n //\n // Leave `_trigger` false (do not set it) and emit no event: nothing ran, so\n // surfacing a `wcs-fetch:trigger-changed` \"completion\" would lie to observers.\n // Keeping the flag false also avoids stalling — once url is provided, writing\n // `true` again is a real false→true transition that triggers the fetch.\n if (!this.url) return;\n this._trigger = true;\n this.fetch().finally(() => {\n this._trigger = false;\n this.dispatchEvent(new CustomEvent(\"wcs-fetch:trigger-changed\", {\n detail: false,\n bubbles: true,\n }));\n });\n }\n }\n\n private _collectHeaders(): Record<string, string> {\n const headers: Record<string, string> = {};\n const headerElements = this.querySelectorAll<FetchHeader>(config.tagNames.fetchHeader);\n for (const el of headerElements) {\n const name = el.headerName;\n const value = el.headerValue;\n if (name) {\n headers[name] = value;\n }\n }\n return headers;\n }\n\n private _collectBody(bodySnapshot: any): { body: BodyInit | null; contentType: string | null } {\n // JS API経由のbodyが優先\n if (bodySnapshot !== null) {\n return {\n body: typeof bodySnapshot === \"string\" ? bodySnapshot : JSON.stringify(bodySnapshot),\n contentType: typeof bodySnapshot === \"string\" ? null : \"application/json\",\n };\n }\n\n // サブタグからbodyを取得\n const bodyElement = this.querySelector<FetchBody>(config.tagNames.fetchBody);\n if (bodyElement) {\n return {\n body: bodyElement.bodyContent || null,\n contentType: bodyElement.contentType,\n };\n }\n\n return { body: null, contentType: null };\n }\n\n abort(): void {\n this._core.abort();\n }\n\n /**\n * Coalesce auto-fetch requests in the current task into a single microtask.\n *\n * Multiple synchronous input writes in the same tick — e.g. a `...` spread\n * writing `url` before `manual` — collapse into one decision made against the\n * FINAL element state, so the spread application order can no longer trigger a\n * stray fetch. The microtask re-reads `isConnected` / `manual` / `url` at fire\n * time; whatever was written last wins.\n *\n * Only the implicit auto-fetch (url attribute change, connect-time) is routed\n * here. Explicit triggers — the `trigger` setter, the `fetch` command, and\n * autoTrigger (data-fetchtarget clicks) — must fire immediately and stay on\n * their own synchronous paths.\n *\n * The connect-time promise (connectedCallbackPromise) is resolved here in\n * EVERY exit path, including the no-fetch branch, so awaiting it never hangs\n * when the final state turns out to be manual / url-less / disconnected.\n */\n private _scheduleAutoFetch(): void {\n if (this._autoPending) {\n return;\n }\n this._autoPending = true;\n queueMicrotask(() => {\n this._autoPending = false;\n const resolveConnect = this._connectResolve;\n this._connectResolve = null;\n const url = this.url;\n // Same-value guard (Phase 4): skip a redundant auto-fetch for the url we\n // last fetched. A spread re-evaluation rewrites every input each cycle, so\n // the `url` setter calls setAttribute with an unchanged value and fires\n // attributeChangedCallback again; without this guard an unrelated state\n // change would refetch. Auto-path only — explicit fetch()/trigger/command\n // stay unconditional (a manual refresh of the same url must work), and\n // `_lastFetchedUrl` is reset on disconnect so a remount refetches.\n if (this.isConnected && !this.manual && url && url !== this._lastFetchedUrl) {\n // fetch() cannot reject here: FetchCore swallows network/HTTP errors and\n // only rejects on an empty url, which the `url` guard above rules out.\n this.fetch().finally(() => resolveConnect?.());\n } else {\n resolveConnect?.();\n }\n });\n }\n\n async fetch(): Promise<any> {\n // Record the url for the auto-fetch same-value guard. Every fetch (explicit\n // included) updates it so a later auto-write of the same url is treated as a\n // no-op rather than a duplicate request.\n this._lastFetchedUrl = this.url;\n const headers = this._collectHeaders();\n\n // Snapshot and reset `body` synchronously, before any await. The body is a\n // one-shot input; resetting it after the await (when another caller may have\n // already set a new body for the next request) would silently drop that value.\n const bodySnapshot = this._body;\n this._body = null;\n const { body, contentType } = this._collectBody(bodySnapshot);\n\n const result = await this._core.fetch(this.url, {\n method: this.method,\n headers,\n body,\n contentType,\n forceText: !!this.target,\n });\n\n // HTML置換モード\n // Security: the response is injected as raw innerHTML without sanitization.\n // This is an opt-in convenience for trusted fragments only; the primary,\n // recommended path is state-driven binding via @wcstack/state. Do not point\n // `target` at an untrusted endpoint (XSS risk). See README \"HTML Replace Mode\".\n if (this.target && result !== null) {\n const targetElement = document.getElementById(this.target);\n if (targetElement) {\n targetElement.innerHTML = result;\n }\n }\n\n return result;\n }\n\n attributeChangedCallback(name: string, _oldValue: string | null, _newValue: string | null): void {\n // Re-fetch on url changes, but intentionally do NOT update\n // `_connectedCallbackPromise`. Per the wc-bindable connectedCallbackPromise\n // protocol that promise represents the one-shot \"connect-time initialization\n // is done\" signal; it resolves once and is not re-armed for later url-driven\n // requests. Await `promise` if you need to track a specific re-fetch.\n //\n // Defer the decision to a microtask (see _scheduleAutoFetch) instead of\n // fetching synchronously here: a `...` spread writes `url` before `manual`,\n // so a synchronous fetch would fire before `manual` is applied. The final\n // state (isConnected / manual / url) is re-read at microtask time.\n if (name === \"url\") {\n this._scheduleAutoFetch();\n }\n }\n\n connectedCallback(): void {\n this.style.display = \"none\";\n if (config.autoTrigger) {\n registerAutoTrigger();\n }\n // Only the initial connect-time fetch is tracked by connectedCallbackPromise.\n // Arm a deferred here when an auto-fetch looks likely; the scheduled\n // microtask resolves it (in every exit path, so awaiting never hangs). The\n // actual fetch decision is re-evaluated at microtask time against the final\n // state, so a spread that sets `manual` after `url` still suppresses it.\n if (!this.manual && this.url) {\n this._connectedCallbackPromise = new Promise<void>((resolve) => {\n this._connectResolve = resolve;\n });\n }\n this._scheduleAutoFetch();\n }\n\n disconnectedCallback(): void {\n this.abort();\n // Reset the same-value guard so a remount (reconnect with the same url)\n // refetches rather than being skipped as a duplicate.\n this._lastFetchedUrl = null;\n // Resolve any armed connect-time deferred before detaching. A synchronous\n // remove()→append() before the scheduled microtask fires would otherwise let\n // the second connectedCallback overwrite _connectResolve, orphaning the first\n // deferred and hanging any caller that already awaited connectedCallbackPromise.\n // Disconnection makes connect-time init moot, so resolving (never hanging) is\n // correct; the pending microtask then sees _connectResolve === null and no-ops.\n this._connectResolve?.();\n this._connectResolve = null;\n }\n}\n","export class FetchHeader extends HTMLElement {\n connectedCallback(): void {\n this.style.display = \"none\";\n }\n\n get headerName(): string {\n return this.getAttribute(\"name\") || \"\";\n }\n\n get headerValue(): string {\n return this.getAttribute(\"value\") || \"\";\n }\n}\n","export class FetchBody extends HTMLElement {\n constructor() {\n super();\n // スロットなしのShadow DOMでlight DOM(bodyテキスト)の描画を抑制\n this.attachShadow({ mode: \"open\" });\n }\n\n get contentType(): string {\n return this.getAttribute(\"type\") || \"application/json\";\n }\n\n get bodyContent(): string {\n return this.textContent?.trim() || \"\";\n }\n}\n","import { Fetch } from \"./Fetch.js\";\n\nexport class InfiniteScroll extends HTMLElement {\n static get observedAttributes(): string[] {\n return [\"target\", \"root\", \"root-margin\", \"threshold\", \"disabled\"];\n }\n\n private _observer: IntersectionObserver | null = null;\n private _done: boolean = false;\n\n get target(): string {\n return this.getAttribute(\"target\") || \"\";\n }\n\n set target(value: string) {\n this.setAttribute(\"target\", value);\n }\n\n get root(): string | null {\n return this.getAttribute(\"root\");\n }\n\n set root(value: string | null) {\n if (value === null) {\n this.removeAttribute(\"root\");\n } else {\n this.setAttribute(\"root\", value);\n }\n }\n\n get rootMargin(): string {\n return this.getAttribute(\"root-margin\") || \"0px\";\n }\n\n set rootMargin(value: string) {\n this.setAttribute(\"root-margin\", value);\n }\n\n get threshold(): number {\n const value = Number(this.getAttribute(\"threshold\") ?? \"0\");\n return Number.isFinite(value) ? value : 0;\n }\n\n set threshold(value: number) {\n this.setAttribute(\"threshold\", String(value));\n }\n\n get disabled(): boolean {\n return this.hasAttribute(\"disabled\");\n }\n\n set disabled(value: boolean) {\n if (value) {\n this.setAttribute(\"disabled\", \"\");\n } else {\n this.removeAttribute(\"disabled\");\n }\n }\n\n get once(): boolean {\n return this.hasAttribute(\"once\");\n }\n\n set once(value: boolean) {\n if (value) {\n this.setAttribute(\"once\", \"\");\n } else {\n this.removeAttribute(\"once\");\n }\n }\n\n connectedCallback(): void {\n this._observe();\n }\n\n disconnectedCallback(): void {\n this._disconnectObserver();\n }\n\n attributeChangedCallback(): void {\n if (this.isConnected) {\n this._observe();\n }\n }\n\n private _observe(): void {\n this._disconnectObserver();\n\n if (this._done || this.disabled || !this.target || typeof IntersectionObserver === \"undefined\") {\n return;\n }\n\n this._observer = new IntersectionObserver((entries) => {\n if (entries.some((entry) => entry.isIntersecting)) {\n this._triggerFetch();\n }\n }, {\n root: this._resolveRoot(),\n rootMargin: this.rootMargin,\n threshold: this.threshold,\n });\n this._observer.observe(this);\n }\n\n private _disconnectObserver(): void {\n if (this._observer) {\n this._observer.disconnect();\n this._observer = null;\n }\n }\n\n private _resolveRoot(): Element | Document | null {\n if (!this.root) return null;\n return document.getElementById(this.root) || null;\n }\n\n private _triggerFetch(): void {\n const target = document.getElementById(this.target);\n if (!(target instanceof Fetch)) {\n return;\n }\n\n if (target.loading) {\n return;\n }\n\n target.trigger = true;\n\n if (this.once) {\n this._done = true;\n this._disconnectObserver();\n }\n }\n}","import { Fetch } from \"./components/Fetch.js\";\nimport { FetchHeader } from \"./components/FetchHeader.js\";\nimport { FetchBody } from \"./components/FetchBody.js\";\nimport { InfiniteScroll } from \"./components/InfiniteScroll.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.fetch)) {\n customElements.define(config.tagNames.fetch, Fetch);\n }\n if (!customElements.get(config.tagNames.fetchHeader)) {\n customElements.define(config.tagNames.fetchHeader, FetchHeader);\n }\n if (!customElements.get(config.tagNames.fetchBody)) {\n customElements.define(config.tagNames.fetchBody, FetchBody);\n }\n if (!customElements.get(config.tagNames.infiniteScroll)) {\n customElements.define(config.tagNames.infiniteScroll, InfiniteScroll);\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapFetch(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n"],"names":[],"mappings":"AAaA,MAAM,OAAO,GAAoB;AAC/B,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,gBAAgB,EAAE,kBAAkB;AACpC,IAAA,QAAQ,EAAE;AACR,QAAA,KAAK,EAAE,WAAW;AAClB,QAAA,WAAW,EAAE,kBAAkB;AAC/B,QAAA,SAAS,EAAE,gBAAgB;AAC3B,QAAA,cAAc,EAA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9B;QACF;AAEA,QAAA,IAAI,MAAM,CAAC,OAAO,EAAE;YAClB;QACF;AAEA,QAAA,MAAM,CAAC,OAAO,GAAG,IAAI;AAErB,QAAA,IAAI,IAAI,CAAC,IAAI,EAAE;AACb,YAAA,IAAI,CAAC,KAAK,GAAG,IAAI;YACjB,IAAI,CAAC,mBAAmB,EAAE;QAC5B;IACF;AACD;;SC/He,kBAAkB,GAAA;AAChC,IAAA,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QAC9C,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACrD;AACA,IAAA,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;QACpD,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IACjE;AACA,IAAA,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;QAClD,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC7D;AACA,IAAA,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;QACvD,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACvE;AACF;;ACfM,SAAU,cAAc,CAAC,UAA4B,EAAA;IACzD,IAAI,UAAU,EAAE;QACd,SAAS,CAAC,UAAU,CAAC;IACvB;AACA,IAAA,kBAAkB,EAAE;AACtB;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/config.ts","../src/core/FetchCore.ts","../src/autoTrigger.ts","../src/components/Fetch.ts","../src/components/FetchHeader.ts","../src/components/FetchBody.ts","../src/components/InfiniteScroll.ts","../src/registerComponents.ts","../src/bootstrapFetch.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n autoTrigger: boolean;\n triggerAttribute: string;\n tagNames: {\n fetch: string;\n fetchHeader: string;\n fetchBody: string;\n infiniteScroll: string;\n };\n}\n\nconst _config: IInternalConfig = {\n autoTrigger: true,\n triggerAttribute: \"data-fetchtarget\",\n tagNames: {\n fetch: \"wcs-fetch\",\n fetchHeader: \"wcs-fetch-header\",\n fetchBody: \"wcs-fetch-body\",\n infiniteScroll: \"wcs-infinite-scroll\",\n },\n};\n\nfunction deepFreeze<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n Object.freeze(obj);\n for (const key of Object.keys(obj)) {\n deepFreeze((obj as Record<string, unknown>)[key]);\n }\n return obj;\n}\n\nfunction deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n const clone: Record<string, unknown> = {};\n for (const key of Object.keys(obj)) {\n clone[key] = deepClone((obj as Record<string, unknown>)[key]);\n }\n return clone as T;\n}\n\nlet frozenConfig: IConfig | null = null;\n\nexport const config: IConfig = _config as IConfig;\n\nexport function getConfig(): IConfig {\n if (!frozenConfig) {\n frozenConfig = deepFreeze(deepClone(_config));\n }\n return frozenConfig;\n}\n\nexport function setConfig(partialConfig: IWritableConfig): void {\n if (typeof partialConfig.autoTrigger === \"boolean\") {\n _config.autoTrigger = partialConfig.autoTrigger;\n }\n if (typeof partialConfig.triggerAttribute === \"string\") {\n _config.triggerAttribute = partialConfig.triggerAttribute;\n }\n if (partialConfig.tagNames) {\n Object.assign(_config.tagNames, partialConfig.tagNames);\n }\n frozenConfig = null;\n}\n","import { IWcBindable } from \"../types.js\";\n\nexport type FetchResponseType = \"auto\" | \"json\" | \"text\" | \"blob\" | \"arrayBuffer\";\n\nexport interface FetchRequestOptions {\n method?: string;\n headers?: Record<string, string>;\n body?: BodyInit | null;\n contentType?: string | null;\n forceText?: boolean;\n // How to read the response body. \"auto\" (default) sniffs Content-Type (JSON or\n // text). \"blob\"/\"arrayBuffer\" enable binary downloads; \"blob\" additionally\n // publishes a managed `objectURL`. `forceText` (HTML-replace mode) takes\n // priority over this.\n responseType?: FetchResponseType;\n}\n\nexport class FetchCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"value\", event: \"wcs-fetch:response\", getter: (e: Event) => (e as CustomEvent).detail.value },\n { name: \"loading\", event: \"wcs-fetch:loading-changed\" },\n { name: \"error\", event: \"wcs-fetch:error\" },\n { name: \"status\", event: \"wcs-fetch:response\", getter: (e: Event) => (e as CustomEvent).detail.status },\n // Managed object URL for a `responseType: \"blob\"` response (null otherwise).\n // The Core revokes the previous URL on each new response and on dispose, so\n // a consumer can bind it straight into <img src> without lifecycle glue.\n { name: \"objectURL\", event: \"wcs-fetch:response\", getter: (e: Event) => (e as CustomEvent).detail.objectURL },\n ],\n inputs: [\n { name: \"url\" },\n { name: \"method\" },\n ],\n commands: [\n { name: \"fetch\", async: true },\n { name: \"abort\" },\n ],\n };\n\n private _target: EventTarget;\n private _value: any = null;\n private _loading: boolean = false;\n private _error: any = null;\n private _status: number = 0;\n private _objectURL: string | null = null;\n private _abortController: AbortController | null = null;\n private _promise: Promise<any> = Promise.resolve(null);\n // Generation guard (§3.4): bumped on dispose() (and each fetch start). An\n // in-flight request that settles after dispose / a superseding start has a\n // stale `gen` and MUST NOT write state to a torn-down element. A boolean flag\n // is insufficient (dispose→observe would let stale work slip through).\n private _gen = 0;\n // SSR (§3.8): no asynchronous probe to await, so readiness is immediate.\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n }\n\n get ready(): Promise<void> {\n return this._ready;\n }\n\n // Lifecycle (§3.5). Fetch is command-driven with no subscription to\n // establish, so observe() is an idempotent no-op that resolves once ready;\n // dispose() invalidates any in-flight request and aborts it.\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n this._gen++;\n this.abort();\n // Release any outstanding blob object URL on teardown (the other revoke point\n // is _setResponse, which drops the previous URL when a new response arrives).\n if (this._objectURL !== null) {\n this._revokeObjectURL(this._objectURL);\n this._objectURL = null;\n }\n }\n\n get value(): any {\n return this._value;\n }\n\n get loading(): boolean {\n return this._loading;\n }\n\n get error(): any {\n return this._error;\n }\n\n get status(): number {\n return this._status;\n }\n\n get objectURL(): string | null {\n return this._objectURL;\n }\n\n get promise(): Promise<any> {\n return this._promise;\n }\n\n private _setLoading(loading: boolean): void {\n this._loading = loading;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:loading-changed\", {\n detail: loading,\n bubbles: true,\n }));\n }\n\n private _setError(error: any): void {\n this._error = error;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n private _setResponse(value: any, status: number, objectURL: string | null = null): void {\n // Revoke the previous blob object URL before replacing it. Any new response\n // (success, HTTP error, or network error all funnel through here) supersedes\n // the prior one, so the old URL is no longer needed; this plus dispose()\n // revocation keeps blob downloads leak-free.\n if (this._objectURL !== null) {\n this._revokeObjectURL(this._objectURL);\n }\n this._objectURL = objectURL;\n this._value = value;\n this._status = status;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:response\", {\n detail: { value, status, objectURL },\n bubbles: true,\n }));\n }\n\n // Object URL lifecycle for responseType: \"blob\". The Core owns the blob's\n // object URL (mirrors RecorderCore) so a consumer can bind `objectURL` straight\n // into <img src>/<a href> without managing createObjectURL/revokeObjectURL. Both\n // helpers tolerate environments without URL.createObjectURL (SSR / headless).\n private _createObjectURL(blob: Blob): string | null {\n if (typeof URL !== \"undefined\" && typeof URL.createObjectURL === \"function\") {\n return URL.createObjectURL(blob);\n }\n return null;\n }\n\n private _revokeObjectURL(url: string): void {\n if (typeof URL !== \"undefined\" && typeof URL.revokeObjectURL === \"function\") {\n URL.revokeObjectURL(url);\n }\n }\n\n abort(): void {\n if (this._abortController) {\n this._abortController.abort();\n this._abortController = null;\n }\n }\n\n async fetch(url: string, options: FetchRequestOptions = {}): Promise<any> {\n // never-throw (§3.6): 引数バリデーション失敗は例外ではなく error プロパティに\n // 流し、サニタイズ値(null)を返す。command-token 経路からの呼び出しが unhandled\n // rejection にならず、「fetch() は全終了ケースで resolve」契約とも整合する。\n if (!url) {\n this._setError({ message: \"url attribute is required.\" });\n return null;\n }\n\n const p = this._doFetch(url, options);\n this._promise = p;\n return p;\n }\n\n private async _doFetch(url: string, options: FetchRequestOptions): Promise<any> {\n // 進行中のリクエストをキャンセル\n this.abort();\n\n // Hold the controller in a local so the finally block (which can run after a\n // subsequent fetch has already replaced this._abortController) only clears the\n // field when it still owns it. Without the identity check, an aborted earlier\n // request's finally would null out the controller of the request that superseded\n // it, leaving the later request un-abortable.\n const ac = new AbortController();\n this._abortController = ac;\n const { signal } = ac;\n\n // Capture the generation at async start (§3.4). A completion that runs after\n // dispose() (which bumps _gen) is stale and must not write state.\n const gen = ++this._gen;\n\n this._setLoading(true);\n this._setError(null);\n\n const {\n method = \"GET\",\n body = null,\n contentType = null,\n forceText = false,\n responseType = \"auto\",\n } = options;\n\n // Copy the caller's headers so the contentType injection below never mutates\n // the object passed in by a headless consumer (the Shell already builds a\n // fresh object, but direct FetchCore users may reuse theirs).\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n\n try {\n if (contentType && !headers[\"Content-Type\"]) {\n headers[\"Content-Type\"] = contentType;\n }\n\n const requestInit: RequestInit = {\n method,\n headers,\n signal,\n };\n\n if (method !== \"GET\" && method !== \"HEAD\" && body !== null) {\n requestInit.body = body;\n }\n\n const response = await globalThis.fetch(url, requestInit);\n\n // A stale generation means dispose() (or a superseding fetch) ran while the\n // request was in flight. Drop the result without touching torn-down state.\n if (gen !== this._gen) {\n return null;\n }\n\n if (!response.ok) {\n const errorBody = await response.text().catch(() => \"\");\n const error = { status: response.status, statusText: response.statusText, body: errorBody };\n this._setError(error);\n // Notify `status` observers on HTTP errors too. The `status` property is\n // surfaced via the `wcs-fetch:response` event (getter reads detail.status),\n // so without dispatching it here a bind() subscriber would never see the\n // error status (404, 500, ...). `value` is reset to null on error.\n this._setResponse(null, response.status);\n this._setLoading(false);\n return null;\n }\n\n if (method === \"HEAD\") {\n // HEAD responses carry no body by spec. Reading it as JSON would throw a\n // parse error on the empty body (and end up as a spurious `error`), so skip\n // body reading entirely and surface only the status with a null value.\n this._setResponse(null, response.status);\n } else if (forceText) {\n // HTML-replace mode (the Shell sets forceText when `target` is present)\n // always reads text and takes priority over responseType.\n const text = await response.text();\n this._setResponse(text, response.status);\n } else if (responseType === \"blob\") {\n const blob = await response.blob();\n // Publish a managed object URL alongside the Blob so consumers can bind it\n // directly into <img src> etc.\n this._setResponse(blob, response.status, this._createObjectURL(blob));\n } else if (responseType === \"arrayBuffer\") {\n const buffer = await response.arrayBuffer();\n this._setResponse(buffer, response.status);\n } else if (responseType === \"text\") {\n const text = await response.text();\n this._setResponse(text, response.status);\n } else if (responseType === \"json\") {\n const data = await response.json();\n this._setResponse(data, response.status);\n } else {\n // \"auto\" (default): sniff Content-Type — JSON when it says so, else text.\n const responseContentType = response.headers.get(\"Content-Type\") || \"\";\n if (responseContentType.includes(\"application/json\")) {\n const data = await response.json();\n this._setResponse(data, response.status);\n } else {\n const text = await response.text();\n this._setResponse(text, response.status);\n }\n }\n\n this._setLoading(false);\n return this._value;\n } catch (e: any) {\n // Stale completion (dispose / superseding fetch ran during a later await\n // such as response.json()). Drop the result without writing state.\n if (gen !== this._gen) {\n return null;\n }\n if (e.name === \"AbortError\") {\n // A matching generation means this is an explicit abort() of the current\n // request (a superseding fetch bumps _gen and is caught by the stale guard\n // above; dispose() likewise bumps _gen). Explicit abort clears loading so\n // observers leave the in-flight state.\n this._setLoading(false);\n return null;\n }\n this._setError(e);\n // Reset value/status on network errors too, mirroring the HTTP-error path\n // (`_setResponse(null, response.status)`). Without this, a prior successful\n // request's value/status would linger while `error` is non-null, showing\n // observers an inconsistent state (e.g. status=200 alongside a network\n // error). status=0 is the web-platform convention for \"no HTTP response\"\n // (matches XMLHttpRequest.status on network failure) and the initial value.\n this._setResponse(null, 0);\n this._setLoading(false);\n return null;\n } finally {\n if (this._abortController === ac) {\n this._abortController = null;\n }\n }\n }\n}\n","import { config } from \"./config.js\";\nimport type { Fetch } from \"./components/Fetch.js\";\n\nlet registered = false;\n\nfunction handleClick(event: Event): void {\n const target = event.target;\n if (!(target instanceof Element)) return;\n\n const triggerElement = target.closest<Element>(`[${config.triggerAttribute}]`);\n if (!triggerElement) return;\n\n const fetchId = triggerElement.getAttribute(config.triggerAttribute);\n if (!fetchId) return;\n\n // Resolve the registered constructor at call time instead of importing Fetch\n // as a value. The value import created a components/Fetch.ts ⇄ autoTrigger.ts\n // cycle (Fetch.connectedCallback() calls registerAutoTrigger()). instanceof\n // against the customElements registry keeps the exact same identity guarantee\n // — only the registered <wcs-fetch> class matches — without the import cycle.\n const FetchCtor = customElements.get(config.tagNames.fetch);\n const el = document.getElementById(fetchId);\n if (!FetchCtor || !(el instanceof FetchCtor)) return;\n const fetchElement = el as Fetch;\n\n // Skip when the target has no url. fetch() is fire-and-forget here (its returned\n // promise is intentionally not awaited), and FetchCore.fetch() rejects synchronously\n // on an empty url. Without this guard that rejection would surface as an unhandled\n // promise rejection. Treat a url-less target as \"nothing to do\", consistent with the\n // other early returns above.\n if (!fetchElement.url) return;\n\n // Suppress the element's default action so a fetch can fire without navigating.\n // Intentional: do not attach data-fetchtarget to an element whose default action\n // you also want (real <a href> link, form-submit button) — it will be cancelled.\n // See README \"Optional DOM Triggering\".\n event.preventDefault();\n fetchElement.fetch();\n}\n\nexport function registerAutoTrigger(): void {\n if (registered) return;\n registered = true;\n document.addEventListener(\"click\", handleClick);\n}\n\nexport function unregisterAutoTrigger(): void {\n if (!registered) return;\n registered = false;\n document.removeEventListener(\"click\", handleClick);\n}\n","import { config } from \"../config.js\";\nimport { IWcBindable } from \"../types.js\";\nimport { FetchCore, FetchResponseType } from \"../core/FetchCore.js\";\nimport { FetchHeader } from \"./FetchHeader.js\";\nimport { FetchBody } from \"./FetchBody.js\";\nimport { registerAutoTrigger } from \"../autoTrigger.js\";\n\nexport class Fetch extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n static wcBindable: IWcBindable = {\n ...FetchCore.wcBindable,\n properties: [\n ...FetchCore.wcBindable.properties,\n { name: \"trigger\", event: \"wcs-fetch:trigger-changed\" },\n ],\n // Shell-level input surface. The Core declares only the portable `url` / `method`;\n // the Shell adds the DOM-driven settable surface. No `attribute` hints are given:\n // these setters already reflect to their attributes themselves, so a binding system\n // that mirrors inputs[].attribute would set the attribute twice. `commands`\n // (fetch / abort) are inherited unchanged from the Core via the spread above.\n inputs: [\n { name: \"url\" },\n { name: \"method\" },\n { name: \"target\" },\n { name: \"manual\" },\n { name: \"body\" },\n { name: \"responseType\" },\n { name: \"trigger\" },\n ],\n };\n static get observedAttributes(): string[] { return [\"url\"]; }\n\n private _core: FetchCore;\n private _body: any = null;\n private _trigger: boolean = false;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n // Auto-fetch coalescing state (see _scheduleAutoFetch).\n private _autoPending: boolean = false;\n private _connectResolve: (() => void) | null = null;\n private _lastFetchedUrl: string | null = null;\n\n constructor() {\n super();\n this._core = new FetchCore(this);\n }\n\n // Input setters normalize null/undefined to attribute removal instead of\n // letting setAttribute stringify them (\"undefined\" url would auto-fetch\n // /undefined, \"undefined\" method is an invalid HTTP method). The binder\n // already skips undefined writes; this guards direct JS assignment too.\n get url(): string {\n return this.getAttribute(\"url\") || \"\";\n }\n\n set url(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"url\");\n } else {\n this.setAttribute(\"url\", value);\n }\n }\n\n get method(): string {\n return (this.getAttribute(\"method\") || \"GET\").toUpperCase();\n }\n\n set method(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"method\");\n } else {\n this.setAttribute(\"method\", value);\n }\n }\n\n get target(): string | null {\n return this.getAttribute(\"target\");\n }\n\n set target(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"target\");\n } else {\n this.setAttribute(\"target\", value);\n }\n }\n\n // Response body interpretation. Backed by the `response-type` attribute so it is\n // settable from HTML, JS, or a binding. An unknown value falls through to the\n // Core's \"auto\" branch. `target` (HTML-replace mode) overrides this.\n get responseType(): FetchResponseType {\n return (this.getAttribute(\"response-type\") as FetchResponseType) || \"auto\";\n }\n\n set responseType(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"response-type\");\n } else {\n this.setAttribute(\"response-type\", value);\n }\n }\n\n get value(): any {\n return this._core.value;\n }\n\n get loading(): boolean {\n return this._core.loading;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get status(): number {\n return this._core.status;\n }\n\n get objectURL(): string | null {\n return this._core.objectURL;\n }\n\n get promise(): Promise<any> {\n return this._core.promise;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n get manual(): boolean {\n return this.hasAttribute(\"manual\");\n }\n\n set manual(value: boolean) {\n if (value) {\n this.setAttribute(\"manual\", \"\");\n } else {\n this.removeAttribute(\"manual\");\n }\n }\n\n get body(): any {\n return this._body;\n }\n\n set body(value: any) {\n // Normalize undefined to null: _collectBody treats \"!== null\" as \"body was\n // provided\", so a raw undefined would serialize as a JSON request body.\n this._body = value ?? null;\n }\n\n get trigger(): boolean {\n return this._trigger;\n }\n\n set trigger(value: boolean) {\n const v = !!value;\n if (v) {\n // Skip when url is empty. fetch() is fire-and-forget here (its returned\n // promise is intentionally only chained with .finally() to reset the flag,\n // never .catch()'d), and FetchCore.fetch() rejects on an empty url. Without\n // this guard that rejection — re-thrown by .finally() — surfaces as an\n // unhandled promise rejection. Mirrors the url-less guard in autoTrigger.\n //\n // Leave `_trigger` false (do not set it) and emit no event: nothing ran, so\n // surfacing a `wcs-fetch:trigger-changed` \"completion\" would lie to observers.\n // Keeping the flag false also avoids stalling — once url is provided, writing\n // `true` again is a real false→true transition that triggers the fetch.\n if (!this.url) return;\n this._trigger = true;\n this.fetch().finally(() => {\n this._trigger = false;\n this.dispatchEvent(new CustomEvent(\"wcs-fetch:trigger-changed\", {\n detail: false,\n bubbles: true,\n }));\n });\n }\n }\n\n private _collectHeaders(): Record<string, string> {\n const headers: Record<string, string> = {};\n const headerElements = this.querySelectorAll<FetchHeader>(config.tagNames.fetchHeader);\n for (const el of headerElements) {\n const name = el.headerName;\n const value = el.headerValue;\n if (name) {\n headers[name] = value;\n }\n }\n return headers;\n }\n\n // fetch がネイティブに扱える BodyInit か判定する。これらは JSON.stringify せず\n // 素通しし、Content-Type をブラウザに委ねる (FormData の multipart boundary、\n // Blob の type、URLSearchParams の application/x-www-form-urlencoded を自動付与\n // させるため、_collectBody は contentType に null を返す)。ReadableStream は\n // RequestInit.duplex: 'half' を要するため初版では対象外とし、従来どおり扱う。\n private _isNativeBodyInit(value: unknown): value is BodyInit {\n return value instanceof Blob // File は Blob のサブクラス\n || value instanceof FormData\n || value instanceof URLSearchParams\n || value instanceof ArrayBuffer\n || ArrayBuffer.isView(value); // TypedArray / DataView\n }\n\n private _collectBody(bodySnapshot: any): { body: BodyInit | null; contentType: string | null } {\n // JS API経由のbodyが優先\n if (bodySnapshot !== null) {\n // 文字列はそのまま。Content-Type はユーザーのヘッダ指定に委ねる。\n if (typeof bodySnapshot === \"string\") {\n return { body: bodySnapshot, contentType: null };\n }\n // ネイティブ BodyInit (Blob/File/FormData/URLSearchParams/ArrayBuffer/TypedArray)\n // は素通し。Content-Type はブラウザに委ねるため null を返す。\n if (this._isNativeBodyInit(bodySnapshot)) {\n return { body: bodySnapshot, contentType: null };\n }\n // それ以外のオブジェクトは JSON 化する。\n return { body: JSON.stringify(bodySnapshot), contentType: \"application/json\" };\n }\n\n // サブタグからbodyを取得\n const bodyElement = this.querySelector<FetchBody>(config.tagNames.fetchBody);\n if (bodyElement) {\n return {\n body: bodyElement.bodyContent || null,\n contentType: bodyElement.contentType,\n };\n }\n\n return { body: null, contentType: null };\n }\n\n abort(): void {\n this._core.abort();\n }\n\n /**\n * Coalesce auto-fetch requests in the current task into a single microtask.\n *\n * Multiple synchronous input writes in the same tick — e.g. a `...` spread\n * writing `url` before `manual` — collapse into one decision made against the\n * FINAL element state, so the spread application order can no longer trigger a\n * stray fetch. The microtask re-reads `isConnected` / `manual` / `url` at fire\n * time; whatever was written last wins.\n *\n * Only the implicit auto-fetch (url attribute change, connect-time) is routed\n * here. Explicit triggers — the `trigger` setter, the `fetch` command, and\n * autoTrigger (data-fetchtarget clicks) — must fire immediately and stay on\n * their own synchronous paths.\n *\n * The connect-time promise (connectedCallbackPromise) is resolved here in\n * EVERY exit path, including the no-fetch branch, so awaiting it never hangs\n * when the final state turns out to be manual / url-less / disconnected.\n */\n private _scheduleAutoFetch(): void {\n if (this._autoPending) {\n return;\n }\n this._autoPending = true;\n queueMicrotask(() => {\n this._autoPending = false;\n const resolveConnect = this._connectResolve;\n this._connectResolve = null;\n const url = this.url;\n // Same-value guard (Phase 4): skip a redundant auto-fetch for the url we\n // last fetched. A spread re-evaluation rewrites every input each cycle, so\n // the `url` setter calls setAttribute with an unchanged value and fires\n // attributeChangedCallback again; without this guard an unrelated state\n // change would refetch. Auto-path only — explicit fetch()/trigger/command\n // stay unconditional (a manual refresh of the same url must work), and\n // `_lastFetchedUrl` is reset on disconnect so a remount refetches.\n if (this.isConnected && !this.manual && url && url !== this._lastFetchedUrl) {\n // fetch() cannot reject here: FetchCore swallows network/HTTP errors and\n // only rejects on an empty url, which the `url` guard above rules out.\n this.fetch().finally(() => resolveConnect?.());\n } else {\n resolveConnect?.();\n }\n });\n }\n\n async fetch(): Promise<any> {\n // Record the url for the auto-fetch same-value guard. Every fetch (explicit\n // included) updates it so a later auto-write of the same url is treated as a\n // no-op rather than a duplicate request.\n this._lastFetchedUrl = this.url;\n const headers = this._collectHeaders();\n\n // Snapshot and reset `body` synchronously, before any await. The body is a\n // one-shot input; resetting it after the await (when another caller may have\n // already set a new body for the next request) would silently drop that value.\n const bodySnapshot = this._body;\n this._body = null;\n const { body, contentType } = this._collectBody(bodySnapshot);\n\n // FormData に手動で Content-Type を付けると、ブラウザが付与するはずの multipart\n // boundary が失われてサーバー側でパースできなくなる。ヘッダはユーザー指定を\n // 尊重して素通しするが、この典型的な誤設定は警告する。\n if (body instanceof FormData &&\n Object.keys(headers).some((name) => name.toLowerCase() === \"content-type\")) {\n console.warn(\n \"[@wcstack/fetch] A manual Content-Type header was set alongside a FormData body. \" +\n \"This drops the multipart boundary the browser adds automatically; remove the \" +\n \"Content-Type header (e.g. the <wcs-fetch-header>) to fix multipart uploads.\",\n );\n }\n\n const result = await this._core.fetch(this.url, {\n method: this.method,\n headers,\n body,\n contentType,\n forceText: !!this.target,\n responseType: this.responseType,\n });\n\n // HTML置換モード\n // Security: the response is injected as raw innerHTML without sanitization.\n // This is an opt-in convenience for trusted fragments only; the primary,\n // recommended path is state-driven binding via @wcstack/state. Do not point\n // `target` at an untrusted endpoint (XSS risk). See README \"HTML Replace Mode\".\n if (this.target && result !== null) {\n const targetElement = document.getElementById(this.target);\n if (targetElement) {\n targetElement.innerHTML = result;\n }\n }\n\n return result;\n }\n\n attributeChangedCallback(name: string, _oldValue: string | null, _newValue: string | null): void {\n // Re-fetch on url changes, but intentionally do NOT update\n // `_connectedCallbackPromise`. Per the wc-bindable connectedCallbackPromise\n // protocol that promise represents the one-shot \"connect-time initialization\n // is done\" signal; it resolves once and is not re-armed for later url-driven\n // requests. Await `promise` if you need to track a specific re-fetch.\n //\n // Defer the decision to a microtask (see _scheduleAutoFetch) instead of\n // fetching synchronously here: a `...` spread writes `url` before `manual`,\n // so a synchronous fetch would fire before `manual` is applied. The final\n // state (isConnected / manual / url) is re-read at microtask time.\n if (name === \"url\") {\n this._scheduleAutoFetch();\n }\n }\n\n connectedCallback(): void {\n this.style.display = \"none\";\n if (config.autoTrigger) {\n registerAutoTrigger();\n }\n // Only the initial connect-time fetch is tracked by connectedCallbackPromise.\n // Arm a deferred here when an auto-fetch looks likely; the scheduled\n // microtask resolves it (in every exit path, so awaiting never hangs). The\n // actual fetch decision is re-evaluated at microtask time against the final\n // state, so a spread that sets `manual` after `url` still suppresses it.\n if (!this.manual && this.url) {\n this._connectedCallbackPromise = new Promise<void>((resolve) => {\n this._connectResolve = resolve;\n });\n }\n this._scheduleAutoFetch();\n }\n\n disconnectedCallback(): void {\n this.abort();\n // Reset the same-value guard so a remount (reconnect with the same url)\n // refetches rather than being skipped as a duplicate.\n this._lastFetchedUrl = null;\n // Resolve any armed connect-time deferred before detaching. A synchronous\n // remove()→append() before the scheduled microtask fires would otherwise let\n // the second connectedCallback overwrite _connectResolve, orphaning the first\n // deferred and hanging any caller that already awaited connectedCallbackPromise.\n // Disconnection makes connect-time init moot, so resolving (never hanging) is\n // correct; the pending microtask then sees _connectResolve === null and no-ops.\n this._connectResolve?.();\n this._connectResolve = null;\n }\n}\n","export class FetchHeader extends HTMLElement {\n connectedCallback(): void {\n this.style.display = \"none\";\n }\n\n get headerName(): string {\n return this.getAttribute(\"name\") || \"\";\n }\n\n get headerValue(): string {\n return this.getAttribute(\"value\") || \"\";\n }\n}\n","export class FetchBody extends HTMLElement {\n constructor() {\n super();\n // スロットなしのShadow DOMでlight DOM(bodyテキスト)の描画を抑制\n this.attachShadow({ mode: \"open\" });\n }\n\n get contentType(): string {\n return this.getAttribute(\"type\") || \"application/json\";\n }\n\n get bodyContent(): string {\n return this.textContent?.trim() || \"\";\n }\n}\n","import { Fetch } from \"./Fetch.js\";\n\nexport class InfiniteScroll extends HTMLElement {\n static get observedAttributes(): string[] {\n return [\"target\", \"root\", \"root-margin\", \"threshold\", \"disabled\"];\n }\n\n private _observer: IntersectionObserver | null = null;\n private _done: boolean = false;\n\n get target(): string {\n return this.getAttribute(\"target\") || \"\";\n }\n\n set target(value: string) {\n this.setAttribute(\"target\", value);\n }\n\n get root(): string | null {\n return this.getAttribute(\"root\");\n }\n\n set root(value: string | null) {\n if (value === null) {\n this.removeAttribute(\"root\");\n } else {\n this.setAttribute(\"root\", value);\n }\n }\n\n get rootMargin(): string {\n return this.getAttribute(\"root-margin\") || \"0px\";\n }\n\n set rootMargin(value: string) {\n this.setAttribute(\"root-margin\", value);\n }\n\n get threshold(): number {\n const value = Number(this.getAttribute(\"threshold\") ?? \"0\");\n return Number.isFinite(value) ? value : 0;\n }\n\n set threshold(value: number) {\n this.setAttribute(\"threshold\", String(value));\n }\n\n get disabled(): boolean {\n return this.hasAttribute(\"disabled\");\n }\n\n set disabled(value: boolean) {\n if (value) {\n this.setAttribute(\"disabled\", \"\");\n } else {\n this.removeAttribute(\"disabled\");\n }\n }\n\n get once(): boolean {\n return this.hasAttribute(\"once\");\n }\n\n set once(value: boolean) {\n if (value) {\n this.setAttribute(\"once\", \"\");\n } else {\n this.removeAttribute(\"once\");\n }\n }\n\n connectedCallback(): void {\n this._observe();\n }\n\n disconnectedCallback(): void {\n this._disconnectObserver();\n }\n\n attributeChangedCallback(): void {\n if (this.isConnected) {\n this._observe();\n }\n }\n\n private _observe(): void {\n this._disconnectObserver();\n\n if (this._done || this.disabled || !this.target || typeof IntersectionObserver === \"undefined\") {\n return;\n }\n\n this._observer = new IntersectionObserver((entries) => {\n if (entries.some((entry) => entry.isIntersecting)) {\n this._triggerFetch();\n }\n }, {\n root: this._resolveRoot(),\n rootMargin: this.rootMargin,\n threshold: this.threshold,\n });\n this._observer.observe(this);\n }\n\n private _disconnectObserver(): void {\n if (this._observer) {\n this._observer.disconnect();\n this._observer = null;\n }\n }\n\n private _resolveRoot(): Element | Document | null {\n if (!this.root) return null;\n return document.getElementById(this.root) || null;\n }\n\n private _triggerFetch(): void {\n const target = document.getElementById(this.target);\n if (!(target instanceof Fetch)) {\n return;\n }\n\n if (target.loading) {\n return;\n }\n\n target.trigger = true;\n\n if (this.once) {\n this._done = true;\n this._disconnectObserver();\n }\n }\n}","import { Fetch } from \"./components/Fetch.js\";\nimport { FetchHeader } from \"./components/FetchHeader.js\";\nimport { FetchBody } from \"./components/FetchBody.js\";\nimport { InfiniteScroll } from \"./components/InfiniteScroll.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.fetch)) {\n customElements.define(config.tagNames.fetch, Fetch);\n }\n if (!customElements.get(config.tagNames.fetchHeader)) {\n customElements.define(config.tagNames.fetchHeader, FetchHeader);\n }\n if (!customElements.get(config.tagNames.fetchBody)) {\n customElements.define(config.tagNames.fetchBody, FetchBody);\n }\n if (!customElements.get(config.tagNames.infiniteScroll)) {\n customElements.define(config.tagNames.infiniteScroll, InfiniteScroll);\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapFetch(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n"],"names":[],"mappings":"AAaA,MAAM,OAAO,GAAoB;AAC/B,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,gBAAgB,EAAE,kBAAkB;AACpC,IAAA,QAAQ,EAAE;AACR,QAAA,KAAK,EAAE,WAAW;AAClB,QAAA,WAAW,EAAE,kBAAkB;AAC/B,QAAA,SAAS,EAAE,gBAAgB;AAC3B,QAAA,cAAc,EAAE,qBAAqB;AACtC,KAAA;CACF;AAED,SAAS,UAAU,CAAI,GAAM,EAAA;AAC3B,IAAA,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;AAAE,QAAA,OAAO,GAAG;AACvD,IAAA,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;IAClB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;AAClC,QAAA,UAAU,CAAE,GAA+B,CAAC,GAAG,CAAC,CAAC;IACnD;AACA,IAAA,OAAO,GAAG;AACZ;AAEA,SAAS,SAAS,CAAI,GAAM,EAAA;AAC1B,IAAA,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,G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,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;QACvD,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACvE;AACF;;ACfM,SAAU,cAAc,CAAC,UAA4B,EAAA;IACzD,IAAI,UAAU,EAAE;QACd,SAAS,CAAC,UAAU,CAAC;IACvB;AACA,IAAA,kBAAkB,EAAE;AACtB;;;;"}
@@ -1,2 +1,2 @@
1
- const t={autoTrigger:!0,triggerAttribute:"data-fetchtarget",tagNames:{fetch:"wcs-fetch",fetchHeader:"wcs-fetch-header",fetchBody:"wcs-fetch-body",infiniteScroll:"wcs-infinite-scroll"}};function e(t){if(null===t||"object"!=typeof t)return t;Object.freeze(t);for(const s of Object.keys(t))e(t[s]);return t}function s(t){if(null===t||"object"!=typeof t)return t;const e={};for(const r of Object.keys(t))e[r]=s(t[r]);return e}let r=null;const n=t;function o(){return r||(r=e(s(t))),r}class i extends EventTarget{static wcBindable={protocol:"wc-bindable",version:1,properties:[{name:"value",event:"wcs-fetch:response",getter:t=>t.detail.value},{name:"loading",event:"wcs-fetch:loading-changed"},{name:"error",event:"wcs-fetch:error"},{name:"status",event:"wcs-fetch:response",getter:t=>t.detail.status}],inputs:[{name:"url"},{name:"method"}],commands:[{name:"fetch",async:!0},{name:"abort"}]};_target;_value=null;_loading=!1;_error=null;_status=0;_abortController=null;_promise=Promise.resolve(null);constructor(t){super(),this._target=t??this}get value(){return this._value}get loading(){return this._loading}get error(){return this._error}get status(){return this._status}get promise(){return this._promise}_setLoading(t){this._loading=t,this._target.dispatchEvent(new CustomEvent("wcs-fetch:loading-changed",{detail:t,bubbles:!0}))}_setError(t){this._error=t,this._target.dispatchEvent(new CustomEvent("wcs-fetch:error",{detail:t,bubbles:!0}))}_setResponse(t,e){this._value=t,this._status=e,this._target.dispatchEvent(new CustomEvent("wcs-fetch:response",{detail:{value:t,status:e},bubbles:!0}))}abort(){this._abortController&&(this._abortController.abort(),this._abortController=null)}async fetch(t,e={}){t||function(t){throw new Error(`[@wcstack/fetch] ${t}`)}("url attribute is required.");const s=this._doFetch(t,e);return this._promise=s,s}async _doFetch(t,e){this.abort();const s=new AbortController;this._abortController=s;const{signal:r}=s;this._setLoading(!0),this._setError(null);const{method:n="GET",body:o=null,contentType:i=null,forceText:a=!1}=e,l={...e.headers??{}};try{i&&!l["Content-Type"]&&(l["Content-Type"]=i);const e={method:n,headers:l,signal:r};"GET"!==n&&"HEAD"!==n&&null!==o&&(e.body=o);const s=await globalThis.fetch(t,e);if(!s.ok){const t=await s.text().catch(()=>""),e={status:s.status,statusText:s.statusText,body:t};return this._setError(e),this._setResponse(null,s.status),this._setLoading(!1),null}if("HEAD"===n)this._setResponse(null,s.status);else if(a){const t=await s.text();this._setResponse(t,s.status)}else{if((s.headers.get("Content-Type")||"").includes("application/json")){const t=await s.json();this._setResponse(t,s.status)}else{const t=await s.text();this._setResponse(t,s.status)}}return this._setLoading(!1),this._value}catch(t){return"AbortError"===t.name?(null===this._abortController&&this._setLoading(!1),null):(this._setError(t),this._setResponse(null,0),this._setLoading(!1),null)}finally{this._abortController===s&&(this._abortController=null)}}}let a=!1;function l(t){const e=t.target;if(!(e instanceof Element))return;const s=e.closest(`[${n.triggerAttribute}]`);if(!s)return;const r=s.getAttribute(n.triggerAttribute);if(!r)return;const o=customElements.get(n.tagNames.fetch),i=document.getElementById(r);if(!(o&&i instanceof o))return;const a=i;a.url&&(t.preventDefault(),a.fetch())}class c extends HTMLElement{static hasConnectedCallbackPromise=!0;static wcBindable={...i.wcBindable,properties:[...i.wcBindable.properties,{name:"trigger",event:"wcs-fetch:trigger-changed"}],inputs:[{name:"url"},{name:"method"},{name:"target"},{name:"manual"},{name:"body"},{name:"trigger"}]};static get observedAttributes(){return["url"]}_core;_body=null;_trigger=!1;_connectedCallbackPromise=Promise.resolve();_autoPending=!1;_connectResolve=null;_lastFetchedUrl=null;constructor(){super(),this._core=new i(this)}get url(){return this.getAttribute("url")||""}set url(t){null==t?this.removeAttribute("url"):this.setAttribute("url",t)}get method(){return(this.getAttribute("method")||"GET").toUpperCase()}set method(t){null==t?this.removeAttribute("method"):this.setAttribute("method",t)}get target(){return this.getAttribute("target")}set target(t){null==t?this.removeAttribute("target"):this.setAttribute("target",t)}get value(){return this._core.value}get loading(){return this._core.loading}get error(){return this._core.error}get status(){return this._core.status}get promise(){return this._core.promise}get connectedCallbackPromise(){return this._connectedCallbackPromise}get manual(){return this.hasAttribute("manual")}set manual(t){t?this.setAttribute("manual",""):this.removeAttribute("manual")}get body(){return this._body}set body(t){this._body=t??null}get trigger(){return this._trigger}set trigger(t){if(!!t){if(!this.url)return;this._trigger=!0,this.fetch().finally(()=>{this._trigger=!1,this.dispatchEvent(new CustomEvent("wcs-fetch:trigger-changed",{detail:!1,bubbles:!0}))})}}_collectHeaders(){const t={},e=this.querySelectorAll(n.tagNames.fetchHeader);for(const s of e){const e=s.headerName,r=s.headerValue;e&&(t[e]=r)}return t}_collectBody(t){if(null!==t)return{body:"string"==typeof t?t:JSON.stringify(t),contentType:"string"==typeof t?null:"application/json"};const e=this.querySelector(n.tagNames.fetchBody);return e?{body:e.bodyContent||null,contentType:e.contentType}:{body:null,contentType:null}}abort(){this._core.abort()}_scheduleAutoFetch(){this._autoPending||(this._autoPending=!0,queueMicrotask(()=>{this._autoPending=!1;const t=this._connectResolve;this._connectResolve=null;const e=this.url;this.isConnected&&!this.manual&&e&&e!==this._lastFetchedUrl?this.fetch().finally(()=>t?.()):t?.()}))}async fetch(){this._lastFetchedUrl=this.url;const t=this._collectHeaders(),e=this._body;this._body=null;const{body:s,contentType:r}=this._collectBody(e),n=await this._core.fetch(this.url,{method:this.method,headers:t,body:s,contentType:r,forceText:!!this.target});if(this.target&&null!==n){const t=document.getElementById(this.target);t&&(t.innerHTML=n)}return n}attributeChangedCallback(t,e,s){"url"===t&&this._scheduleAutoFetch()}connectedCallback(){this.style.display="none",n.autoTrigger&&(a||(a=!0,document.addEventListener("click",l))),!this.manual&&this.url&&(this._connectedCallbackPromise=new Promise(t=>{this._connectResolve=t})),this._scheduleAutoFetch()}disconnectedCallback(){this.abort(),this._lastFetchedUrl=null,this._connectResolve?.(),this._connectResolve=null}}class h extends HTMLElement{connectedCallback(){this.style.display="none"}get headerName(){return this.getAttribute("name")||""}get headerValue(){return this.getAttribute("value")||""}}class u extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}get contentType(){return this.getAttribute("type")||"application/json"}get bodyContent(){return this.textContent?.trim()||""}}class g extends HTMLElement{static get observedAttributes(){return["target","root","root-margin","threshold","disabled"]}_observer=null;_done=!1;get target(){return this.getAttribute("target")||""}set target(t){this.setAttribute("target",t)}get root(){return this.getAttribute("root")}set root(t){null===t?this.removeAttribute("root"):this.setAttribute("root",t)}get rootMargin(){return this.getAttribute("root-margin")||"0px"}set rootMargin(t){this.setAttribute("root-margin",t)}get threshold(){const t=Number(this.getAttribute("threshold")??"0");return Number.isFinite(t)?t:0}set threshold(t){this.setAttribute("threshold",String(t))}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get once(){return this.hasAttribute("once")}set once(t){t?this.setAttribute("once",""):this.removeAttribute("once")}connectedCallback(){this._observe()}disconnectedCallback(){this._disconnectObserver()}attributeChangedCallback(){this.isConnected&&this._observe()}_observe(){this._disconnectObserver(),this._done||this.disabled||!this.target||"undefined"==typeof IntersectionObserver||(this._observer=new IntersectionObserver(t=>{t.some(t=>t.isIntersecting)&&this._triggerFetch()},{root:this._resolveRoot(),rootMargin:this.rootMargin,threshold:this.threshold}),this._observer.observe(this))}_disconnectObserver(){this._observer&&(this._observer.disconnect(),this._observer=null)}_resolveRoot(){return this.root&&document.getElementById(this.root)||null}_triggerFetch(){const t=document.getElementById(this.target);t instanceof c&&(t.loading||(t.trigger=!0,this.once&&(this._done=!0,this._disconnectObserver())))}}function d(e){var s;e&&("boolean"==typeof(s=e).autoTrigger&&(t.autoTrigger=s.autoTrigger),"string"==typeof s.triggerAttribute&&(t.triggerAttribute=s.triggerAttribute),s.tagNames&&Object.assign(t.tagNames,s.tagNames),r=null),customElements.get(n.tagNames.fetch)||customElements.define(n.tagNames.fetch,c),customElements.get(n.tagNames.fetchHeader)||customElements.define(n.tagNames.fetchHeader,h),customElements.get(n.tagNames.fetchBody)||customElements.define(n.tagNames.fetchBody,u),customElements.get(n.tagNames.infiniteScroll)||customElements.define(n.tagNames.infiniteScroll,g)}export{i as FetchCore,c as WcsFetch,g as WcsInfiniteScroll,d as bootstrapFetch,o as getConfig};
1
+ const t={autoTrigger:!0,triggerAttribute:"data-fetchtarget",tagNames:{fetch:"wcs-fetch",fetchHeader:"wcs-fetch-header",fetchBody:"wcs-fetch-body",infiniteScroll:"wcs-infinite-scroll"}};function e(t){if(null===t||"object"!=typeof t)return t;Object.freeze(t);for(const s of Object.keys(t))e(t[s]);return t}function s(t){if(null===t||"object"!=typeof t)return t;const e={};for(const r of Object.keys(t))e[r]=s(t[r]);return e}let r=null;const n=t;function o(){return r||(r=e(s(t))),r}class i extends EventTarget{static wcBindable={protocol:"wc-bindable",version:1,properties:[{name:"value",event:"wcs-fetch:response",getter:t=>t.detail.value},{name:"loading",event:"wcs-fetch:loading-changed"},{name:"error",event:"wcs-fetch:error"},{name:"status",event:"wcs-fetch:response",getter:t=>t.detail.status},{name:"objectURL",event:"wcs-fetch:response",getter:t=>t.detail.objectURL}],inputs:[{name:"url"},{name:"method"}],commands:[{name:"fetch",async:!0},{name:"abort"}]};_target;_value=null;_loading=!1;_error=null;_status=0;_objectURL=null;_abortController=null;_promise=Promise.resolve(null);_gen=0;_ready=Promise.resolve();constructor(t){super(),this._target=t??this}get ready(){return this._ready}observe(){return this._ready}dispose(){this._gen++,this.abort(),null!==this._objectURL&&(this._revokeObjectURL(this._objectURL),this._objectURL=null)}get value(){return this._value}get loading(){return this._loading}get error(){return this._error}get status(){return this._status}get objectURL(){return this._objectURL}get promise(){return this._promise}_setLoading(t){this._loading=t,this._target.dispatchEvent(new CustomEvent("wcs-fetch:loading-changed",{detail:t,bubbles:!0}))}_setError(t){this._error=t,this._target.dispatchEvent(new CustomEvent("wcs-fetch:error",{detail:t,bubbles:!0}))}_setResponse(t,e,s=null){null!==this._objectURL&&this._revokeObjectURL(this._objectURL),this._objectURL=s,this._value=t,this._status=e,this._target.dispatchEvent(new CustomEvent("wcs-fetch:response",{detail:{value:t,status:e,objectURL:s},bubbles:!0}))}_createObjectURL(t){return"undefined"!=typeof URL&&"function"==typeof URL.createObjectURL?URL.createObjectURL(t):null}_revokeObjectURL(t){"undefined"!=typeof URL&&"function"==typeof URL.revokeObjectURL&&URL.revokeObjectURL(t)}abort(){this._abortController&&(this._abortController.abort(),this._abortController=null)}async fetch(t,e={}){if(!t)return this._setError({message:"url attribute is required."}),null;const s=this._doFetch(t,e);return this._promise=s,s}async _doFetch(t,e){this.abort();const s=new AbortController;this._abortController=s;const{signal:r}=s,n=++this._gen;this._setLoading(!0),this._setError(null);const{method:o="GET",body:i=null,contentType:a=null,forceText:l=!1,responseType:c="auto"}=e,h={...e.headers??{}};try{a&&!h["Content-Type"]&&(h["Content-Type"]=a);const e={method:o,headers:h,signal:r};"GET"!==o&&"HEAD"!==o&&null!==i&&(e.body=i);const s=await globalThis.fetch(t,e);if(n!==this._gen)return null;if(!s.ok){const t=await s.text().catch(()=>""),e={status:s.status,statusText:s.statusText,body:t};return this._setError(e),this._setResponse(null,s.status),this._setLoading(!1),null}if("HEAD"===o)this._setResponse(null,s.status);else if(l){const t=await s.text();this._setResponse(t,s.status)}else if("blob"===c){const t=await s.blob();this._setResponse(t,s.status,this._createObjectURL(t))}else if("arrayBuffer"===c){const t=await s.arrayBuffer();this._setResponse(t,s.status)}else if("text"===c){const t=await s.text();this._setResponse(t,s.status)}else if("json"===c){const t=await s.json();this._setResponse(t,s.status)}else{if((s.headers.get("Content-Type")||"").includes("application/json")){const t=await s.json();this._setResponse(t,s.status)}else{const t=await s.text();this._setResponse(t,s.status)}}return this._setLoading(!1),this._value}catch(t){return n!==this._gen?null:"AbortError"===t.name?(this._setLoading(!1),null):(this._setError(t),this._setResponse(null,0),this._setLoading(!1),null)}finally{this._abortController===s&&(this._abortController=null)}}}let a=!1;function l(t){const e=t.target;if(!(e instanceof Element))return;const s=e.closest(`[${n.triggerAttribute}]`);if(!s)return;const r=s.getAttribute(n.triggerAttribute);if(!r)return;const o=customElements.get(n.tagNames.fetch),i=document.getElementById(r);if(!(o&&i instanceof o))return;const a=i;a.url&&(t.preventDefault(),a.fetch())}class c extends HTMLElement{static hasConnectedCallbackPromise=!0;static wcBindable={...i.wcBindable,properties:[...i.wcBindable.properties,{name:"trigger",event:"wcs-fetch:trigger-changed"}],inputs:[{name:"url"},{name:"method"},{name:"target"},{name:"manual"},{name:"body"},{name:"responseType"},{name:"trigger"}]};static get observedAttributes(){return["url"]}_core;_body=null;_trigger=!1;_connectedCallbackPromise=Promise.resolve();_autoPending=!1;_connectResolve=null;_lastFetchedUrl=null;constructor(){super(),this._core=new i(this)}get url(){return this.getAttribute("url")||""}set url(t){null==t?this.removeAttribute("url"):this.setAttribute("url",t)}get method(){return(this.getAttribute("method")||"GET").toUpperCase()}set method(t){null==t?this.removeAttribute("method"):this.setAttribute("method",t)}get target(){return this.getAttribute("target")}set target(t){null==t?this.removeAttribute("target"):this.setAttribute("target",t)}get responseType(){return this.getAttribute("response-type")||"auto"}set responseType(t){null==t?this.removeAttribute("response-type"):this.setAttribute("response-type",t)}get value(){return this._core.value}get loading(){return this._core.loading}get error(){return this._core.error}get status(){return this._core.status}get objectURL(){return this._core.objectURL}get promise(){return this._core.promise}get connectedCallbackPromise(){return this._connectedCallbackPromise}get manual(){return this.hasAttribute("manual")}set manual(t){t?this.setAttribute("manual",""):this.removeAttribute("manual")}get body(){return this._body}set body(t){this._body=t??null}get trigger(){return this._trigger}set trigger(t){if(!!t){if(!this.url)return;this._trigger=!0,this.fetch().finally(()=>{this._trigger=!1,this.dispatchEvent(new CustomEvent("wcs-fetch:trigger-changed",{detail:!1,bubbles:!0}))})}}_collectHeaders(){const t={},e=this.querySelectorAll(n.tagNames.fetchHeader);for(const s of e){const e=s.headerName,r=s.headerValue;e&&(t[e]=r)}return t}_isNativeBodyInit(t){return t instanceof Blob||t instanceof FormData||t instanceof URLSearchParams||t instanceof ArrayBuffer||ArrayBuffer.isView(t)}_collectBody(t){if(null!==t)return"string"==typeof t||this._isNativeBodyInit(t)?{body:t,contentType:null}:{body:JSON.stringify(t),contentType:"application/json"};const e=this.querySelector(n.tagNames.fetchBody);return e?{body:e.bodyContent||null,contentType:e.contentType}:{body:null,contentType:null}}abort(){this._core.abort()}_scheduleAutoFetch(){this._autoPending||(this._autoPending=!0,queueMicrotask(()=>{this._autoPending=!1;const t=this._connectResolve;this._connectResolve=null;const e=this.url;this.isConnected&&!this.manual&&e&&e!==this._lastFetchedUrl?this.fetch().finally(()=>t?.()):t?.()}))}async fetch(){this._lastFetchedUrl=this.url;const t=this._collectHeaders(),e=this._body;this._body=null;const{body:s,contentType:r}=this._collectBody(e);s instanceof FormData&&Object.keys(t).some(t=>"content-type"===t.toLowerCase())&&console.warn("[@wcstack/fetch] A manual Content-Type header was set alongside a FormData body. This drops the multipart boundary the browser adds automatically; remove the Content-Type header (e.g. the <wcs-fetch-header>) to fix multipart uploads.");const n=await this._core.fetch(this.url,{method:this.method,headers:t,body:s,contentType:r,forceText:!!this.target,responseType:this.responseType});if(this.target&&null!==n){const t=document.getElementById(this.target);t&&(t.innerHTML=n)}return n}attributeChangedCallback(t,e,s){"url"===t&&this._scheduleAutoFetch()}connectedCallback(){this.style.display="none",n.autoTrigger&&(a||(a=!0,document.addEventListener("click",l))),!this.manual&&this.url&&(this._connectedCallbackPromise=new Promise(t=>{this._connectResolve=t})),this._scheduleAutoFetch()}disconnectedCallback(){this.abort(),this._lastFetchedUrl=null,this._connectResolve?.(),this._connectResolve=null}}class h extends HTMLElement{connectedCallback(){this.style.display="none"}get headerName(){return this.getAttribute("name")||""}get headerValue(){return this.getAttribute("value")||""}}class u extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}get contentType(){return this.getAttribute("type")||"application/json"}get bodyContent(){return this.textContent?.trim()||""}}class d extends HTMLElement{static get observedAttributes(){return["target","root","root-margin","threshold","disabled"]}_observer=null;_done=!1;get target(){return this.getAttribute("target")||""}set target(t){this.setAttribute("target",t)}get root(){return this.getAttribute("root")}set root(t){null===t?this.removeAttribute("root"):this.setAttribute("root",t)}get rootMargin(){return this.getAttribute("root-margin")||"0px"}set rootMargin(t){this.setAttribute("root-margin",t)}get threshold(){const t=Number(this.getAttribute("threshold")??"0");return Number.isFinite(t)?t:0}set threshold(t){this.setAttribute("threshold",String(t))}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get once(){return this.hasAttribute("once")}set once(t){t?this.setAttribute("once",""):this.removeAttribute("once")}connectedCallback(){this._observe()}disconnectedCallback(){this._disconnectObserver()}attributeChangedCallback(){this.isConnected&&this._observe()}_observe(){this._disconnectObserver(),this._done||this.disabled||!this.target||"undefined"==typeof IntersectionObserver||(this._observer=new IntersectionObserver(t=>{t.some(t=>t.isIntersecting)&&this._triggerFetch()},{root:this._resolveRoot(),rootMargin:this.rootMargin,threshold:this.threshold}),this._observer.observe(this))}_disconnectObserver(){this._observer&&(this._observer.disconnect(),this._observer=null)}_resolveRoot(){return this.root&&document.getElementById(this.root)||null}_triggerFetch(){const t=document.getElementById(this.target);t instanceof c&&(t.loading||(t.trigger=!0,this.once&&(this._done=!0,this._disconnectObserver())))}}function g(e){var s;e&&("boolean"==typeof(s=e).autoTrigger&&(t.autoTrigger=s.autoTrigger),"string"==typeof s.triggerAttribute&&(t.triggerAttribute=s.triggerAttribute),s.tagNames&&Object.assign(t.tagNames,s.tagNames),r=null),customElements.get(n.tagNames.fetch)||customElements.define(n.tagNames.fetch,c),customElements.get(n.tagNames.fetchHeader)||customElements.define(n.tagNames.fetchHeader,h),customElements.get(n.tagNames.fetchBody)||customElements.define(n.tagNames.fetchBody,u),customElements.get(n.tagNames.infiniteScroll)||customElements.define(n.tagNames.infiniteScroll,d)}export{i as FetchCore,c as WcsFetch,d as WcsInfiniteScroll,g as bootstrapFetch,o as getConfig};
2
2
  //# sourceMappingURL=index.esm.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.min.js","sources":["../src/config.ts","../src/core/FetchCore.ts","../src/raiseError.ts","../src/autoTrigger.ts","../src/components/Fetch.ts","../src/components/FetchHeader.ts","../src/components/FetchBody.ts","../src/components/InfiniteScroll.ts","../src/bootstrapFetch.ts","../src/registerComponents.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n autoTrigger: boolean;\n triggerAttribute: string;\n tagNames: {\n fetch: string;\n fetchHeader: string;\n fetchBody: string;\n infiniteScroll: string;\n };\n}\n\nconst _config: IInternalConfig = {\n autoTrigger: true,\n triggerAttribute: \"data-fetchtarget\",\n tagNames: {\n fetch: \"wcs-fetch\",\n fetchHeader: \"wcs-fetch-header\",\n fetchBody: \"wcs-fetch-body\",\n infiniteScroll: \"wcs-infinite-scroll\",\n },\n};\n\nfunction deepFreeze<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n Object.freeze(obj);\n for (const key of Object.keys(obj)) {\n deepFreeze((obj as Record<string, unknown>)[key]);\n }\n return obj;\n}\n\nfunction deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n const clone: Record<string, unknown> = {};\n for (const key of Object.keys(obj)) {\n clone[key] = deepClone((obj as Record<string, unknown>)[key]);\n }\n return clone as T;\n}\n\nlet frozenConfig: IConfig | null = null;\n\nexport const config: IConfig = _config as IConfig;\n\nexport function getConfig(): IConfig {\n if (!frozenConfig) {\n frozenConfig = deepFreeze(deepClone(_config));\n }\n return frozenConfig;\n}\n\nexport function setConfig(partialConfig: IWritableConfig): void {\n if (typeof partialConfig.autoTrigger === \"boolean\") {\n _config.autoTrigger = partialConfig.autoTrigger;\n }\n if (typeof partialConfig.triggerAttribute === \"string\") {\n _config.triggerAttribute = partialConfig.triggerAttribute;\n }\n if (partialConfig.tagNames) {\n Object.assign(_config.tagNames, partialConfig.tagNames);\n }\n frozenConfig = null;\n}\n","import { raiseError } from \"../raiseError.js\";\nimport { IWcBindable } from \"../types.js\";\n\nexport interface FetchRequestOptions {\n method?: string;\n headers?: Record<string, string>;\n body?: BodyInit | null;\n contentType?: string | null;\n forceText?: boolean;\n}\n\nexport class FetchCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"value\", event: \"wcs-fetch:response\", getter: (e: Event) => (e as CustomEvent).detail.value },\n { name: \"loading\", event: \"wcs-fetch:loading-changed\" },\n { name: \"error\", event: \"wcs-fetch:error\" },\n { name: \"status\", event: \"wcs-fetch:response\", getter: (e: Event) => (e as CustomEvent).detail.status },\n ],\n inputs: [\n { name: \"url\" },\n { name: \"method\" },\n ],\n commands: [\n { name: \"fetch\", async: true },\n { name: \"abort\" },\n ],\n };\n\n private _target: EventTarget;\n private _value: any = null;\n private _loading: boolean = false;\n private _error: any = null;\n private _status: number = 0;\n private _abortController: AbortController | null = null;\n private _promise: Promise<any> = Promise.resolve(null);\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n }\n\n get value(): any {\n return this._value;\n }\n\n get loading(): boolean {\n return this._loading;\n }\n\n get error(): any {\n return this._error;\n }\n\n get status(): number {\n return this._status;\n }\n\n get promise(): Promise<any> {\n return this._promise;\n }\n\n private _setLoading(loading: boolean): void {\n this._loading = loading;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:loading-changed\", {\n detail: loading,\n bubbles: true,\n }));\n }\n\n private _setError(error: any): void {\n this._error = error;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n private _setResponse(value: any, status: number): void {\n this._value = value;\n this._status = status;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:response\", {\n detail: { value, status },\n bubbles: true,\n }));\n }\n\n abort(): void {\n if (this._abortController) {\n this._abortController.abort();\n this._abortController = null;\n }\n }\n\n async fetch(url: string, options: FetchRequestOptions = {}): Promise<any> {\n if (!url) {\n raiseError(\"url attribute is required.\");\n }\n\n const p = this._doFetch(url, options);\n this._promise = p;\n return p;\n }\n\n private async _doFetch(url: string, options: FetchRequestOptions): Promise<any> {\n // 進行中のリクエストをキャンセル\n this.abort();\n\n // Hold the controller in a local so the finally block (which can run after a\n // subsequent fetch has already replaced this._abortController) only clears the\n // field when it still owns it. Without the identity check, an aborted earlier\n // request's finally would null out the controller of the request that superseded\n // it, leaving the later request un-abortable.\n const ac = new AbortController();\n this._abortController = ac;\n const { signal } = ac;\n\n this._setLoading(true);\n this._setError(null);\n\n const {\n method = \"GET\",\n body = null,\n contentType = null,\n forceText = false,\n } = options;\n\n // Copy the caller's headers so the contentType injection below never mutates\n // the object passed in by a headless consumer (the Shell already builds a\n // fresh object, but direct FetchCore users may reuse theirs).\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n\n try {\n if (contentType && !headers[\"Content-Type\"]) {\n headers[\"Content-Type\"] = contentType;\n }\n\n const requestInit: RequestInit = {\n method,\n headers,\n signal,\n };\n\n if (method !== \"GET\" && method !== \"HEAD\" && body !== null) {\n requestInit.body = body;\n }\n\n const response = await globalThis.fetch(url, requestInit);\n\n if (!response.ok) {\n const errorBody = await response.text().catch(() => \"\");\n const error = { status: response.status, statusText: response.statusText, body: errorBody };\n this._setError(error);\n // Notify `status` observers on HTTP errors too. The `status` property is\n // surfaced via the `wcs-fetch:response` event (getter reads detail.status),\n // so without dispatching it here a bind() subscriber would never see the\n // error status (404, 500, ...). `value` is reset to null on error.\n this._setResponse(null, response.status);\n this._setLoading(false);\n return null;\n }\n\n if (method === \"HEAD\") {\n // HEAD responses carry no body by spec. Reading it as JSON would throw a\n // parse error on the empty body (and end up as a spurious `error`), so skip\n // body reading entirely and surface only the status with a null value.\n this._setResponse(null, response.status);\n } else if (forceText) {\n const text = await response.text();\n this._setResponse(text, response.status);\n } else {\n const responseContentType = response.headers.get(\"Content-Type\") || \"\";\n if (responseContentType.includes(\"application/json\")) {\n const data = await response.json();\n this._setResponse(data, response.status);\n } else {\n const text = await response.text();\n this._setResponse(text, response.status);\n }\n }\n\n this._setLoading(false);\n return this._value;\n } catch (e: any) {\n if (e.name === \"AbortError\") {\n // Suppress loading=false when a later request has already taken over. A\n // subsequent fetch() aborts this one via abort() (which nulls the field) and\n // then immediately installs its own controller, so `this._abortController` is\n // non-null here. That newer request has already emitted loading=true and is\n // still in flight, so emitting loading=false now would make observers see a\n // spurious flicker. An explicit abort() leaves the field null, so that path\n // still reports loading=false as expected.\n if (this._abortController === null) {\n this._setLoading(false);\n }\n return null;\n }\n this._setError(e);\n // Reset value/status on network errors too, mirroring the HTTP-error path\n // (`_setResponse(null, response.status)`). Without this, a prior successful\n // request's value/status would linger while `error` is non-null, showing\n // observers an inconsistent state (e.g. status=200 alongside a network\n // error). status=0 is the web-platform convention for \"no HTTP response\"\n // (matches XMLHttpRequest.status on network failure) and the initial value.\n this._setResponse(null, 0);\n this._setLoading(false);\n return null;\n } finally {\n if (this._abortController === ac) {\n this._abortController = null;\n }\n }\n }\n}\n","export function raiseError(message: string): never {\n throw new Error(`[@wcstack/fetch] ${message}`);\n}\n","import { config } from \"./config.js\";\nimport type { Fetch } from \"./components/Fetch.js\";\n\nlet registered = false;\n\nfunction handleClick(event: Event): void {\n const target = event.target;\n if (!(target instanceof Element)) return;\n\n const triggerElement = target.closest<Element>(`[${config.triggerAttribute}]`);\n if (!triggerElement) return;\n\n const fetchId = triggerElement.getAttribute(config.triggerAttribute);\n if (!fetchId) return;\n\n // Resolve the registered constructor at call time instead of importing Fetch\n // as a value. The value import created a components/Fetch.ts ⇄ autoTrigger.ts\n // cycle (Fetch.connectedCallback() calls registerAutoTrigger()). instanceof\n // against the customElements registry keeps the exact same identity guarantee\n // — only the registered <wcs-fetch> class matches — without the import cycle.\n const FetchCtor = customElements.get(config.tagNames.fetch);\n const el = document.getElementById(fetchId);\n if (!FetchCtor || !(el instanceof FetchCtor)) return;\n const fetchElement = el as Fetch;\n\n // Skip when the target has no url. fetch() is fire-and-forget here (its returned\n // promise is intentionally not awaited), and FetchCore.fetch() rejects synchronously\n // on an empty url. Without this guard that rejection would surface as an unhandled\n // promise rejection. Treat a url-less target as \"nothing to do\", consistent with the\n // other early returns above.\n if (!fetchElement.url) return;\n\n // Suppress the element's default action so a fetch can fire without navigating.\n // Intentional: do not attach data-fetchtarget to an element whose default action\n // you also want (real <a href> link, form-submit button) — it will be cancelled.\n // See README \"Optional DOM Triggering\".\n event.preventDefault();\n fetchElement.fetch();\n}\n\nexport function registerAutoTrigger(): void {\n if (registered) return;\n registered = true;\n document.addEventListener(\"click\", handleClick);\n}\n\nexport function unregisterAutoTrigger(): void {\n if (!registered) return;\n registered = false;\n document.removeEventListener(\"click\", handleClick);\n}\n","import { config } from \"../config.js\";\nimport { IWcBindable } from \"../types.js\";\nimport { FetchCore } from \"../core/FetchCore.js\";\nimport { FetchHeader } from \"./FetchHeader.js\";\nimport { FetchBody } from \"./FetchBody.js\";\nimport { registerAutoTrigger } from \"../autoTrigger.js\";\n\nexport class Fetch extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n static wcBindable: IWcBindable = {\n ...FetchCore.wcBindable,\n properties: [\n ...FetchCore.wcBindable.properties,\n { name: \"trigger\", event: \"wcs-fetch:trigger-changed\" },\n ],\n // Shell-level input surface. The Core declares only the portable `url` / `method`;\n // the Shell adds the DOM-driven settable surface. No `attribute` hints are given:\n // these setters already reflect to their attributes themselves, so a binding system\n // that mirrors inputs[].attribute would set the attribute twice. `commands`\n // (fetch / abort) are inherited unchanged from the Core via the spread above.\n inputs: [\n { name: \"url\" },\n { name: \"method\" },\n { name: \"target\" },\n { name: \"manual\" },\n { name: \"body\" },\n { name: \"trigger\" },\n ],\n };\n static get observedAttributes(): string[] { return [\"url\"]; }\n\n private _core: FetchCore;\n private _body: any = null;\n private _trigger: boolean = false;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n // Auto-fetch coalescing state (see _scheduleAutoFetch).\n private _autoPending: boolean = false;\n private _connectResolve: (() => void) | null = null;\n private _lastFetchedUrl: string | null = null;\n\n constructor() {\n super();\n this._core = new FetchCore(this);\n }\n\n // Input setters normalize null/undefined to attribute removal instead of\n // letting setAttribute stringify them (\"undefined\" url would auto-fetch\n // /undefined, \"undefined\" method is an invalid HTTP method). The binder\n // already skips undefined writes; this guards direct JS assignment too.\n get url(): string {\n return this.getAttribute(\"url\") || \"\";\n }\n\n set url(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"url\");\n } else {\n this.setAttribute(\"url\", value);\n }\n }\n\n get method(): string {\n return (this.getAttribute(\"method\") || \"GET\").toUpperCase();\n }\n\n set method(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"method\");\n } else {\n this.setAttribute(\"method\", value);\n }\n }\n\n get target(): string | null {\n return this.getAttribute(\"target\");\n }\n\n set target(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"target\");\n } else {\n this.setAttribute(\"target\", value);\n }\n }\n\n get value(): any {\n return this._core.value;\n }\n\n get loading(): boolean {\n return this._core.loading;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get status(): number {\n return this._core.status;\n }\n\n get promise(): Promise<any> {\n return this._core.promise;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n get manual(): boolean {\n return this.hasAttribute(\"manual\");\n }\n\n set manual(value: boolean) {\n if (value) {\n this.setAttribute(\"manual\", \"\");\n } else {\n this.removeAttribute(\"manual\");\n }\n }\n\n get body(): any {\n return this._body;\n }\n\n set body(value: any) {\n // Normalize undefined to null: _collectBody treats \"!== null\" as \"body was\n // provided\", so a raw undefined would serialize as a JSON request body.\n this._body = value ?? null;\n }\n\n get trigger(): boolean {\n return this._trigger;\n }\n\n set trigger(value: boolean) {\n const v = !!value;\n if (v) {\n // Skip when url is empty. fetch() is fire-and-forget here (its returned\n // promise is intentionally only chained with .finally() to reset the flag,\n // never .catch()'d), and FetchCore.fetch() rejects on an empty url. Without\n // this guard that rejection — re-thrown by .finally() — surfaces as an\n // unhandled promise rejection. Mirrors the url-less guard in autoTrigger.\n //\n // Leave `_trigger` false (do not set it) and emit no event: nothing ran, so\n // surfacing a `wcs-fetch:trigger-changed` \"completion\" would lie to observers.\n // Keeping the flag false also avoids stalling — once url is provided, writing\n // `true` again is a real false→true transition that triggers the fetch.\n if (!this.url) return;\n this._trigger = true;\n this.fetch().finally(() => {\n this._trigger = false;\n this.dispatchEvent(new CustomEvent(\"wcs-fetch:trigger-changed\", {\n detail: false,\n bubbles: true,\n }));\n });\n }\n }\n\n private _collectHeaders(): Record<string, string> {\n const headers: Record<string, string> = {};\n const headerElements = this.querySelectorAll<FetchHeader>(config.tagNames.fetchHeader);\n for (const el of headerElements) {\n const name = el.headerName;\n const value = el.headerValue;\n if (name) {\n headers[name] = value;\n }\n }\n return headers;\n }\n\n private _collectBody(bodySnapshot: any): { body: BodyInit | null; contentType: string | null } {\n // JS API経由のbodyが優先\n if (bodySnapshot !== null) {\n return {\n body: typeof bodySnapshot === \"string\" ? bodySnapshot : JSON.stringify(bodySnapshot),\n contentType: typeof bodySnapshot === \"string\" ? null : \"application/json\",\n };\n }\n\n // サブタグからbodyを取得\n const bodyElement = this.querySelector<FetchBody>(config.tagNames.fetchBody);\n if (bodyElement) {\n return {\n body: bodyElement.bodyContent || null,\n contentType: bodyElement.contentType,\n };\n }\n\n return { body: null, contentType: null };\n }\n\n abort(): void {\n this._core.abort();\n }\n\n /**\n * Coalesce auto-fetch requests in the current task into a single microtask.\n *\n * Multiple synchronous input writes in the same tick — e.g. a `...` spread\n * writing `url` before `manual` — collapse into one decision made against the\n * FINAL element state, so the spread application order can no longer trigger a\n * stray fetch. The microtask re-reads `isConnected` / `manual` / `url` at fire\n * time; whatever was written last wins.\n *\n * Only the implicit auto-fetch (url attribute change, connect-time) is routed\n * here. Explicit triggers — the `trigger` setter, the `fetch` command, and\n * autoTrigger (data-fetchtarget clicks) — must fire immediately and stay on\n * their own synchronous paths.\n *\n * The connect-time promise (connectedCallbackPromise) is resolved here in\n * EVERY exit path, including the no-fetch branch, so awaiting it never hangs\n * when the final state turns out to be manual / url-less / disconnected.\n */\n private _scheduleAutoFetch(): void {\n if (this._autoPending) {\n return;\n }\n this._autoPending = true;\n queueMicrotask(() => {\n this._autoPending = false;\n const resolveConnect = this._connectResolve;\n this._connectResolve = null;\n const url = this.url;\n // Same-value guard (Phase 4): skip a redundant auto-fetch for the url we\n // last fetched. A spread re-evaluation rewrites every input each cycle, so\n // the `url` setter calls setAttribute with an unchanged value and fires\n // attributeChangedCallback again; without this guard an unrelated state\n // change would refetch. Auto-path only — explicit fetch()/trigger/command\n // stay unconditional (a manual refresh of the same url must work), and\n // `_lastFetchedUrl` is reset on disconnect so a remount refetches.\n if (this.isConnected && !this.manual && url && url !== this._lastFetchedUrl) {\n // fetch() cannot reject here: FetchCore swallows network/HTTP errors and\n // only rejects on an empty url, which the `url` guard above rules out.\n this.fetch().finally(() => resolveConnect?.());\n } else {\n resolveConnect?.();\n }\n });\n }\n\n async fetch(): Promise<any> {\n // Record the url for the auto-fetch same-value guard. Every fetch (explicit\n // included) updates it so a later auto-write of the same url is treated as a\n // no-op rather than a duplicate request.\n this._lastFetchedUrl = this.url;\n const headers = this._collectHeaders();\n\n // Snapshot and reset `body` synchronously, before any await. The body is a\n // one-shot input; resetting it after the await (when another caller may have\n // already set a new body for the next request) would silently drop that value.\n const bodySnapshot = this._body;\n this._body = null;\n const { body, contentType } = this._collectBody(bodySnapshot);\n\n const result = await this._core.fetch(this.url, {\n method: this.method,\n headers,\n body,\n contentType,\n forceText: !!this.target,\n });\n\n // HTML置換モード\n // Security: the response is injected as raw innerHTML without sanitization.\n // This is an opt-in convenience for trusted fragments only; the primary,\n // recommended path is state-driven binding via @wcstack/state. Do not point\n // `target` at an untrusted endpoint (XSS risk). See README \"HTML Replace Mode\".\n if (this.target && result !== null) {\n const targetElement = document.getElementById(this.target);\n if (targetElement) {\n targetElement.innerHTML = result;\n }\n }\n\n return result;\n }\n\n attributeChangedCallback(name: string, _oldValue: string | null, _newValue: string | null): void {\n // Re-fetch on url changes, but intentionally do NOT update\n // `_connectedCallbackPromise`. Per the wc-bindable connectedCallbackPromise\n // protocol that promise represents the one-shot \"connect-time initialization\n // is done\" signal; it resolves once and is not re-armed for later url-driven\n // requests. Await `promise` if you need to track a specific re-fetch.\n //\n // Defer the decision to a microtask (see _scheduleAutoFetch) instead of\n // fetching synchronously here: a `...` spread writes `url` before `manual`,\n // so a synchronous fetch would fire before `manual` is applied. The final\n // state (isConnected / manual / url) is re-read at microtask time.\n if (name === \"url\") {\n this._scheduleAutoFetch();\n }\n }\n\n connectedCallback(): void {\n this.style.display = \"none\";\n if (config.autoTrigger) {\n registerAutoTrigger();\n }\n // Only the initial connect-time fetch is tracked by connectedCallbackPromise.\n // Arm a deferred here when an auto-fetch looks likely; the scheduled\n // microtask resolves it (in every exit path, so awaiting never hangs). The\n // actual fetch decision is re-evaluated at microtask time against the final\n // state, so a spread that sets `manual` after `url` still suppresses it.\n if (!this.manual && this.url) {\n this._connectedCallbackPromise = new Promise<void>((resolve) => {\n this._connectResolve = resolve;\n });\n }\n this._scheduleAutoFetch();\n }\n\n disconnectedCallback(): void {\n this.abort();\n // Reset the same-value guard so a remount (reconnect with the same url)\n // refetches rather than being skipped as a duplicate.\n this._lastFetchedUrl = null;\n // Resolve any armed connect-time deferred before detaching. A synchronous\n // remove()→append() before the scheduled microtask fires would otherwise let\n // the second connectedCallback overwrite _connectResolve, orphaning the first\n // deferred and hanging any caller that already awaited connectedCallbackPromise.\n // Disconnection makes connect-time init moot, so resolving (never hanging) is\n // correct; the pending microtask then sees _connectResolve === null and no-ops.\n this._connectResolve?.();\n this._connectResolve = null;\n }\n}\n","export class FetchHeader extends HTMLElement {\n connectedCallback(): void {\n this.style.display = \"none\";\n }\n\n get headerName(): string {\n return this.getAttribute(\"name\") || \"\";\n }\n\n get headerValue(): string {\n return this.getAttribute(\"value\") || \"\";\n }\n}\n","export class FetchBody extends HTMLElement {\n constructor() {\n super();\n // スロットなしのShadow DOMでlight DOM(bodyテキスト)の描画を抑制\n this.attachShadow({ mode: \"open\" });\n }\n\n get contentType(): string {\n return this.getAttribute(\"type\") || \"application/json\";\n }\n\n get bodyContent(): string {\n return this.textContent?.trim() || \"\";\n }\n}\n","import { Fetch } from \"./Fetch.js\";\n\nexport class InfiniteScroll extends HTMLElement {\n static get observedAttributes(): string[] {\n return [\"target\", \"root\", \"root-margin\", \"threshold\", \"disabled\"];\n }\n\n private _observer: IntersectionObserver | null = null;\n private _done: boolean = false;\n\n get target(): string {\n return this.getAttribute(\"target\") || \"\";\n }\n\n set target(value: string) {\n this.setAttribute(\"target\", value);\n }\n\n get root(): string | null {\n return this.getAttribute(\"root\");\n }\n\n set root(value: string | null) {\n if (value === null) {\n this.removeAttribute(\"root\");\n } else {\n this.setAttribute(\"root\", value);\n }\n }\n\n get rootMargin(): string {\n return this.getAttribute(\"root-margin\") || \"0px\";\n }\n\n set rootMargin(value: string) {\n this.setAttribute(\"root-margin\", value);\n }\n\n get threshold(): number {\n const value = Number(this.getAttribute(\"threshold\") ?? \"0\");\n return Number.isFinite(value) ? value : 0;\n }\n\n set threshold(value: number) {\n this.setAttribute(\"threshold\", String(value));\n }\n\n get disabled(): boolean {\n return this.hasAttribute(\"disabled\");\n }\n\n set disabled(value: boolean) {\n if (value) {\n this.setAttribute(\"disabled\", \"\");\n } else {\n this.removeAttribute(\"disabled\");\n }\n }\n\n get once(): boolean {\n return this.hasAttribute(\"once\");\n }\n\n set once(value: boolean) {\n if (value) {\n this.setAttribute(\"once\", \"\");\n } else {\n this.removeAttribute(\"once\");\n }\n }\n\n connectedCallback(): void {\n this._observe();\n }\n\n disconnectedCallback(): void {\n this._disconnectObserver();\n }\n\n attributeChangedCallback(): void {\n if (this.isConnected) {\n this._observe();\n }\n }\n\n private _observe(): void {\n this._disconnectObserver();\n\n if (this._done || this.disabled || !this.target || typeof IntersectionObserver === \"undefined\") {\n return;\n }\n\n this._observer = new IntersectionObserver((entries) => {\n if (entries.some((entry) => entry.isIntersecting)) {\n this._triggerFetch();\n }\n }, {\n root: this._resolveRoot(),\n rootMargin: this.rootMargin,\n threshold: this.threshold,\n });\n this._observer.observe(this);\n }\n\n private _disconnectObserver(): void {\n if (this._observer) {\n this._observer.disconnect();\n this._observer = null;\n }\n }\n\n private _resolveRoot(): Element | Document | null {\n if (!this.root) return null;\n return document.getElementById(this.root) || null;\n }\n\n private _triggerFetch(): void {\n const target = document.getElementById(this.target);\n if (!(target instanceof Fetch)) {\n return;\n }\n\n if (target.loading) {\n return;\n }\n\n target.trigger = true;\n\n if (this.once) {\n this._done = true;\n this._disconnectObserver();\n }\n }\n}","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapFetch(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n","import { Fetch } from \"./components/Fetch.js\";\nimport { FetchHeader } from \"./components/FetchHeader.js\";\nimport { FetchBody } from \"./components/FetchBody.js\";\nimport { InfiniteScroll } from \"./components/InfiniteScroll.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.fetch)) {\n customElements.define(config.tagNames.fetch, Fetch);\n }\n if (!customElements.get(config.tagNames.fetchHeader)) {\n customElements.define(config.tagNames.fetchHeader, FetchHeader);\n }\n if (!customElements.get(config.tagNames.fetchBody)) {\n customElements.define(config.tagNames.fetchBody, FetchBody);\n }\n if (!customElements.get(config.tagNames.infiniteScroll)) {\n customElements.define(config.tagNames.infiniteScroll, InfiniteScroll);\n }\n}\n"],"names":["_config","autoTrigger","triggerAttribute","tagNames","fetch","fetchHeader","fetchBody","infiniteScroll","deepFreeze","obj","Object","freeze","key","keys","deepClone","clone","frozenConfig","config","getConfig","FetchCore","EventTarget","static","protocol","version","properties","name","event","getter","e","detail","value","status","inputs","commands","async","_target","_value","_loading","_error","_status","_abortController","_promise","Promise","resolve","constructor","target","super","this","loading","error","promise","_setLoading","dispatchEvent","CustomEvent","bubbles","_setError","_setResponse","abort","url","options","message","Error","raiseError","p","_doFetch","ac","AbortController","signal","method","body","contentType","forceText","headers","requestInit","response","globalThis","ok","errorBody","text","catch","statusText","get","includes","data","json","registered","handleClick","Element","triggerElement","closest","fetchId","getAttribute","FetchCtor","customElements","el","document","getElementById","fetchElement","preventDefault","Fetch","HTMLElement","wcBindable","observedAttributes","_core","_body","_trigger","_connectedCallbackPromise","_autoPending","_connectResolve","_lastFetchedUrl","removeAttribute","setAttribute","toUpperCase","connectedCallbackPromise","manual","hasAttribute","trigger","finally","_collectHeaders","headerElements","querySelectorAll","headerName","headerValue","_collectBody","bodySnapshot","JSON","stringify","bodyElement","querySelector","bodyContent","_scheduleAutoFetch","queueMicrotask","resolveConnect","isConnected","result","targetElement","innerHTML","attributeChangedCallback","_oldValue","_newValue","connectedCallback","style","display","addEventListener","disconnectedCallback","FetchHeader","FetchBody","attachShadow","mode","textContent","trim","InfiniteScroll","_observer","_done","root","rootMargin","threshold","Number","isFinite","String","disabled","once","_observe","_disconnectObserver","IntersectionObserver","entries","some","entry","isIntersecting","_triggerFetch","_resolveRoot","observe","disconnect","bootstrapFetch","userConfig","partialConfig","assign","define"],"mappings":"AAaA,MAAMA,EAA2B,CAC/BC,aAAa,EACbC,iBAAkB,mBAClBC,SAAU,CACRC,MAAO,YACPC,YAAa,mBACbC,UAAW,iBACXC,eAAgB,wBAIpB,SAASC,EAAcC,GACrB,GAAY,OAARA,GAA+B,iBAARA,EAAkB,OAAOA,EACpDC,OAAOC,OAAOF,GACd,IAAK,MAAMG,KAAOF,OAAOG,KAAKJ,GAC5BD,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AOd,SAASI,eAAgBgJ,EDR1D"}
1
+ {"version":3,"file":"index.esm.min.js","sources":["../src/config.ts","../src/core/FetchCore.ts","../src/autoTrigger.ts","../src/components/Fetch.ts","../src/components/FetchHeader.ts","../src/components/FetchBody.ts","../src/components/InfiniteScroll.ts","../src/bootstrapFetch.ts","../src/registerComponents.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n autoTrigger: boolean;\n triggerAttribute: string;\n tagNames: {\n fetch: string;\n fetchHeader: string;\n fetchBody: string;\n infiniteScroll: string;\n };\n}\n\nconst _config: IInternalConfig = {\n autoTrigger: true,\n triggerAttribute: \"data-fetchtarget\",\n tagNames: {\n fetch: \"wcs-fetch\",\n fetchHeader: \"wcs-fetch-header\",\n fetchBody: \"wcs-fetch-body\",\n infiniteScroll: \"wcs-infinite-scroll\",\n },\n};\n\nfunction deepFreeze<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n Object.freeze(obj);\n for (const key of Object.keys(obj)) {\n deepFreeze((obj as Record<string, unknown>)[key]);\n }\n return obj;\n}\n\nfunction deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n const clone: Record<string, unknown> = {};\n for (const key of Object.keys(obj)) {\n clone[key] = deepClone((obj as Record<string, unknown>)[key]);\n }\n return clone as T;\n}\n\nlet frozenConfig: IConfig | null = null;\n\nexport const config: IConfig = _config as IConfig;\n\nexport function getConfig(): IConfig {\n if (!frozenConfig) {\n frozenConfig = deepFreeze(deepClone(_config));\n }\n return frozenConfig;\n}\n\nexport function setConfig(partialConfig: IWritableConfig): void {\n if (typeof partialConfig.autoTrigger === \"boolean\") {\n _config.autoTrigger = partialConfig.autoTrigger;\n }\n if (typeof partialConfig.triggerAttribute === \"string\") {\n _config.triggerAttribute = partialConfig.triggerAttribute;\n }\n if (partialConfig.tagNames) {\n Object.assign(_config.tagNames, partialConfig.tagNames);\n }\n frozenConfig = null;\n}\n","import { IWcBindable } from \"../types.js\";\n\nexport type FetchResponseType = \"auto\" | \"json\" | \"text\" | \"blob\" | \"arrayBuffer\";\n\nexport interface FetchRequestOptions {\n method?: string;\n headers?: Record<string, string>;\n body?: BodyInit | null;\n contentType?: string | null;\n forceText?: boolean;\n // How to read the response body. \"auto\" (default) sniffs Content-Type (JSON or\n // text). \"blob\"/\"arrayBuffer\" enable binary downloads; \"blob\" additionally\n // publishes a managed `objectURL`. `forceText` (HTML-replace mode) takes\n // priority over this.\n responseType?: FetchResponseType;\n}\n\nexport class FetchCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"value\", event: \"wcs-fetch:response\", getter: (e: Event) => (e as CustomEvent).detail.value },\n { name: \"loading\", event: \"wcs-fetch:loading-changed\" },\n { name: \"error\", event: \"wcs-fetch:error\" },\n { name: \"status\", event: \"wcs-fetch:response\", getter: (e: Event) => (e as CustomEvent).detail.status },\n // Managed object URL for a `responseType: \"blob\"` response (null otherwise).\n // The Core revokes the previous URL on each new response and on dispose, so\n // a consumer can bind it straight into <img src> without lifecycle glue.\n { name: \"objectURL\", event: \"wcs-fetch:response\", getter: (e: Event) => (e as CustomEvent).detail.objectURL },\n ],\n inputs: [\n { name: \"url\" },\n { name: \"method\" },\n ],\n commands: [\n { name: \"fetch\", async: true },\n { name: \"abort\" },\n ],\n };\n\n private _target: EventTarget;\n private _value: any = null;\n private _loading: boolean = false;\n private _error: any = null;\n private _status: number = 0;\n private _objectURL: string | null = null;\n private _abortController: AbortController | null = null;\n private _promise: Promise<any> = Promise.resolve(null);\n // Generation guard (§3.4): bumped on dispose() (and each fetch start). An\n // in-flight request that settles after dispose / a superseding start has a\n // stale `gen` and MUST NOT write state to a torn-down element. A boolean flag\n // is insufficient (dispose→observe would let stale work slip through).\n private _gen = 0;\n // SSR (§3.8): no asynchronous probe to await, so readiness is immediate.\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n }\n\n get ready(): Promise<void> {\n return this._ready;\n }\n\n // Lifecycle (§3.5). Fetch is command-driven with no subscription to\n // establish, so observe() is an idempotent no-op that resolves once ready;\n // dispose() invalidates any in-flight request and aborts it.\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n this._gen++;\n this.abort();\n // Release any outstanding blob object URL on teardown (the other revoke point\n // is _setResponse, which drops the previous URL when a new response arrives).\n if (this._objectURL !== null) {\n this._revokeObjectURL(this._objectURL);\n this._objectURL = null;\n }\n }\n\n get value(): any {\n return this._value;\n }\n\n get loading(): boolean {\n return this._loading;\n }\n\n get error(): any {\n return this._error;\n }\n\n get status(): number {\n return this._status;\n }\n\n get objectURL(): string | null {\n return this._objectURL;\n }\n\n get promise(): Promise<any> {\n return this._promise;\n }\n\n private _setLoading(loading: boolean): void {\n this._loading = loading;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:loading-changed\", {\n detail: loading,\n bubbles: true,\n }));\n }\n\n private _setError(error: any): void {\n this._error = error;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n private _setResponse(value: any, status: number, objectURL: string | null = null): void {\n // Revoke the previous blob object URL before replacing it. Any new response\n // (success, HTTP error, or network error all funnel through here) supersedes\n // the prior one, so the old URL is no longer needed; this plus dispose()\n // revocation keeps blob downloads leak-free.\n if (this._objectURL !== null) {\n this._revokeObjectURL(this._objectURL);\n }\n this._objectURL = objectURL;\n this._value = value;\n this._status = status;\n this._target.dispatchEvent(new CustomEvent(\"wcs-fetch:response\", {\n detail: { value, status, objectURL },\n bubbles: true,\n }));\n }\n\n // Object URL lifecycle for responseType: \"blob\". The Core owns the blob's\n // object URL (mirrors RecorderCore) so a consumer can bind `objectURL` straight\n // into <img src>/<a href> without managing createObjectURL/revokeObjectURL. Both\n // helpers tolerate environments without URL.createObjectURL (SSR / headless).\n private _createObjectURL(blob: Blob): string | null {\n if (typeof URL !== \"undefined\" && typeof URL.createObjectURL === \"function\") {\n return URL.createObjectURL(blob);\n }\n return null;\n }\n\n private _revokeObjectURL(url: string): void {\n if (typeof URL !== \"undefined\" && typeof URL.revokeObjectURL === \"function\") {\n URL.revokeObjectURL(url);\n }\n }\n\n abort(): void {\n if (this._abortController) {\n this._abortController.abort();\n this._abortController = null;\n }\n }\n\n async fetch(url: string, options: FetchRequestOptions = {}): Promise<any> {\n // never-throw (§3.6): 引数バリデーション失敗は例外ではなく error プロパティに\n // 流し、サニタイズ値(null)を返す。command-token 経路からの呼び出しが unhandled\n // rejection にならず、「fetch() は全終了ケースで resolve」契約とも整合する。\n if (!url) {\n this._setError({ message: \"url attribute is required.\" });\n return null;\n }\n\n const p = this._doFetch(url, options);\n this._promise = p;\n return p;\n }\n\n private async _doFetch(url: string, options: FetchRequestOptions): Promise<any> {\n // 進行中のリクエストをキャンセル\n this.abort();\n\n // Hold the controller in a local so the finally block (which can run after a\n // subsequent fetch has already replaced this._abortController) only clears the\n // field when it still owns it. Without the identity check, an aborted earlier\n // request's finally would null out the controller of the request that superseded\n // it, leaving the later request un-abortable.\n const ac = new AbortController();\n this._abortController = ac;\n const { signal } = ac;\n\n // Capture the generation at async start (§3.4). A completion that runs after\n // dispose() (which bumps _gen) is stale and must not write state.\n const gen = ++this._gen;\n\n this._setLoading(true);\n this._setError(null);\n\n const {\n method = \"GET\",\n body = null,\n contentType = null,\n forceText = false,\n responseType = \"auto\",\n } = options;\n\n // Copy the caller's headers so the contentType injection below never mutates\n // the object passed in by a headless consumer (the Shell already builds a\n // fresh object, but direct FetchCore users may reuse theirs).\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n\n try {\n if (contentType && !headers[\"Content-Type\"]) {\n headers[\"Content-Type\"] = contentType;\n }\n\n const requestInit: RequestInit = {\n method,\n headers,\n signal,\n };\n\n if (method !== \"GET\" && method !== \"HEAD\" && body !== null) {\n requestInit.body = body;\n }\n\n const response = await globalThis.fetch(url, requestInit);\n\n // A stale generation means dispose() (or a superseding fetch) ran while the\n // request was in flight. Drop the result without touching torn-down state.\n if (gen !== this._gen) {\n return null;\n }\n\n if (!response.ok) {\n const errorBody = await response.text().catch(() => \"\");\n const error = { status: response.status, statusText: response.statusText, body: errorBody };\n this._setError(error);\n // Notify `status` observers on HTTP errors too. The `status` property is\n // surfaced via the `wcs-fetch:response` event (getter reads detail.status),\n // so without dispatching it here a bind() subscriber would never see the\n // error status (404, 500, ...). `value` is reset to null on error.\n this._setResponse(null, response.status);\n this._setLoading(false);\n return null;\n }\n\n if (method === \"HEAD\") {\n // HEAD responses carry no body by spec. Reading it as JSON would throw a\n // parse error on the empty body (and end up as a spurious `error`), so skip\n // body reading entirely and surface only the status with a null value.\n this._setResponse(null, response.status);\n } else if (forceText) {\n // HTML-replace mode (the Shell sets forceText when `target` is present)\n // always reads text and takes priority over responseType.\n const text = await response.text();\n this._setResponse(text, response.status);\n } else if (responseType === \"blob\") {\n const blob = await response.blob();\n // Publish a managed object URL alongside the Blob so consumers can bind it\n // directly into <img src> etc.\n this._setResponse(blob, response.status, this._createObjectURL(blob));\n } else if (responseType === \"arrayBuffer\") {\n const buffer = await response.arrayBuffer();\n this._setResponse(buffer, response.status);\n } else if (responseType === \"text\") {\n const text = await response.text();\n this._setResponse(text, response.status);\n } else if (responseType === \"json\") {\n const data = await response.json();\n this._setResponse(data, response.status);\n } else {\n // \"auto\" (default): sniff Content-Type — JSON when it says so, else text.\n const responseContentType = response.headers.get(\"Content-Type\") || \"\";\n if (responseContentType.includes(\"application/json\")) {\n const data = await response.json();\n this._setResponse(data, response.status);\n } else {\n const text = await response.text();\n this._setResponse(text, response.status);\n }\n }\n\n this._setLoading(false);\n return this._value;\n } catch (e: any) {\n // Stale completion (dispose / superseding fetch ran during a later await\n // such as response.json()). Drop the result without writing state.\n if (gen !== this._gen) {\n return null;\n }\n if (e.name === \"AbortError\") {\n // A matching generation means this is an explicit abort() of the current\n // request (a superseding fetch bumps _gen and is caught by the stale guard\n // above; dispose() likewise bumps _gen). Explicit abort clears loading so\n // observers leave the in-flight state.\n this._setLoading(false);\n return null;\n }\n this._setError(e);\n // Reset value/status on network errors too, mirroring the HTTP-error path\n // (`_setResponse(null, response.status)`). Without this, a prior successful\n // request's value/status would linger while `error` is non-null, showing\n // observers an inconsistent state (e.g. status=200 alongside a network\n // error). status=0 is the web-platform convention for \"no HTTP response\"\n // (matches XMLHttpRequest.status on network failure) and the initial value.\n this._setResponse(null, 0);\n this._setLoading(false);\n return null;\n } finally {\n if (this._abortController === ac) {\n this._abortController = null;\n }\n }\n }\n}\n","import { config } from \"./config.js\";\nimport type { Fetch } from \"./components/Fetch.js\";\n\nlet registered = false;\n\nfunction handleClick(event: Event): void {\n const target = event.target;\n if (!(target instanceof Element)) return;\n\n const triggerElement = target.closest<Element>(`[${config.triggerAttribute}]`);\n if (!triggerElement) return;\n\n const fetchId = triggerElement.getAttribute(config.triggerAttribute);\n if (!fetchId) return;\n\n // Resolve the registered constructor at call time instead of importing Fetch\n // as a value. The value import created a components/Fetch.ts ⇄ autoTrigger.ts\n // cycle (Fetch.connectedCallback() calls registerAutoTrigger()). instanceof\n // against the customElements registry keeps the exact same identity guarantee\n // — only the registered <wcs-fetch> class matches — without the import cycle.\n const FetchCtor = customElements.get(config.tagNames.fetch);\n const el = document.getElementById(fetchId);\n if (!FetchCtor || !(el instanceof FetchCtor)) return;\n const fetchElement = el as Fetch;\n\n // Skip when the target has no url. fetch() is fire-and-forget here (its returned\n // promise is intentionally not awaited), and FetchCore.fetch() rejects synchronously\n // on an empty url. Without this guard that rejection would surface as an unhandled\n // promise rejection. Treat a url-less target as \"nothing to do\", consistent with the\n // other early returns above.\n if (!fetchElement.url) return;\n\n // Suppress the element's default action so a fetch can fire without navigating.\n // Intentional: do not attach data-fetchtarget to an element whose default action\n // you also want (real <a href> link, form-submit button) — it will be cancelled.\n // See README \"Optional DOM Triggering\".\n event.preventDefault();\n fetchElement.fetch();\n}\n\nexport function registerAutoTrigger(): void {\n if (registered) return;\n registered = true;\n document.addEventListener(\"click\", handleClick);\n}\n\nexport function unregisterAutoTrigger(): void {\n if (!registered) return;\n registered = false;\n document.removeEventListener(\"click\", handleClick);\n}\n","import { config } from \"../config.js\";\nimport { IWcBindable } from \"../types.js\";\nimport { FetchCore, FetchResponseType } from \"../core/FetchCore.js\";\nimport { FetchHeader } from \"./FetchHeader.js\";\nimport { FetchBody } from \"./FetchBody.js\";\nimport { registerAutoTrigger } from \"../autoTrigger.js\";\n\nexport class Fetch extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n static wcBindable: IWcBindable = {\n ...FetchCore.wcBindable,\n properties: [\n ...FetchCore.wcBindable.properties,\n { name: \"trigger\", event: \"wcs-fetch:trigger-changed\" },\n ],\n // Shell-level input surface. The Core declares only the portable `url` / `method`;\n // the Shell adds the DOM-driven settable surface. No `attribute` hints are given:\n // these setters already reflect to their attributes themselves, so a binding system\n // that mirrors inputs[].attribute would set the attribute twice. `commands`\n // (fetch / abort) are inherited unchanged from the Core via the spread above.\n inputs: [\n { name: \"url\" },\n { name: \"method\" },\n { name: \"target\" },\n { name: \"manual\" },\n { name: \"body\" },\n { name: \"responseType\" },\n { name: \"trigger\" },\n ],\n };\n static get observedAttributes(): string[] { return [\"url\"]; }\n\n private _core: FetchCore;\n private _body: any = null;\n private _trigger: boolean = false;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n // Auto-fetch coalescing state (see _scheduleAutoFetch).\n private _autoPending: boolean = false;\n private _connectResolve: (() => void) | null = null;\n private _lastFetchedUrl: string | null = null;\n\n constructor() {\n super();\n this._core = new FetchCore(this);\n }\n\n // Input setters normalize null/undefined to attribute removal instead of\n // letting setAttribute stringify them (\"undefined\" url would auto-fetch\n // /undefined, \"undefined\" method is an invalid HTTP method). The binder\n // already skips undefined writes; this guards direct JS assignment too.\n get url(): string {\n return this.getAttribute(\"url\") || \"\";\n }\n\n set url(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"url\");\n } else {\n this.setAttribute(\"url\", value);\n }\n }\n\n get method(): string {\n return (this.getAttribute(\"method\") || \"GET\").toUpperCase();\n }\n\n set method(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"method\");\n } else {\n this.setAttribute(\"method\", value);\n }\n }\n\n get target(): string | null {\n return this.getAttribute(\"target\");\n }\n\n set target(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"target\");\n } else {\n this.setAttribute(\"target\", value);\n }\n }\n\n // Response body interpretation. Backed by the `response-type` attribute so it is\n // settable from HTML, JS, or a binding. An unknown value falls through to the\n // Core's \"auto\" branch. `target` (HTML-replace mode) overrides this.\n get responseType(): FetchResponseType {\n return (this.getAttribute(\"response-type\") as FetchResponseType) || \"auto\";\n }\n\n set responseType(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"response-type\");\n } else {\n this.setAttribute(\"response-type\", value);\n }\n }\n\n get value(): any {\n return this._core.value;\n }\n\n get loading(): boolean {\n return this._core.loading;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get status(): number {\n return this._core.status;\n }\n\n get objectURL(): string | null {\n return this._core.objectURL;\n }\n\n get promise(): Promise<any> {\n return this._core.promise;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n get manual(): boolean {\n return this.hasAttribute(\"manual\");\n }\n\n set manual(value: boolean) {\n if (value) {\n this.setAttribute(\"manual\", \"\");\n } else {\n this.removeAttribute(\"manual\");\n }\n }\n\n get body(): any {\n return this._body;\n }\n\n set body(value: any) {\n // Normalize undefined to null: _collectBody treats \"!== null\" as \"body was\n // provided\", so a raw undefined would serialize as a JSON request body.\n this._body = value ?? null;\n }\n\n get trigger(): boolean {\n return this._trigger;\n }\n\n set trigger(value: boolean) {\n const v = !!value;\n if (v) {\n // Skip when url is empty. fetch() is fire-and-forget here (its returned\n // promise is intentionally only chained with .finally() to reset the flag,\n // never .catch()'d), and FetchCore.fetch() rejects on an empty url. Without\n // this guard that rejection — re-thrown by .finally() — surfaces as an\n // unhandled promise rejection. Mirrors the url-less guard in autoTrigger.\n //\n // Leave `_trigger` false (do not set it) and emit no event: nothing ran, so\n // surfacing a `wcs-fetch:trigger-changed` \"completion\" would lie to observers.\n // Keeping the flag false also avoids stalling — once url is provided, writing\n // `true` again is a real false→true transition that triggers the fetch.\n if (!this.url) return;\n this._trigger = true;\n this.fetch().finally(() => {\n this._trigger = false;\n this.dispatchEvent(new CustomEvent(\"wcs-fetch:trigger-changed\", {\n detail: false,\n bubbles: true,\n }));\n });\n }\n }\n\n private _collectHeaders(): Record<string, string> {\n const headers: Record<string, string> = {};\n const headerElements = this.querySelectorAll<FetchHeader>(config.tagNames.fetchHeader);\n for (const el of headerElements) {\n const name = el.headerName;\n const value = el.headerValue;\n if (name) {\n headers[name] = value;\n }\n }\n return headers;\n }\n\n // fetch がネイティブに扱える BodyInit か判定する。これらは JSON.stringify せず\n // 素通しし、Content-Type をブラウザに委ねる (FormData の multipart boundary、\n // Blob の type、URLSearchParams の application/x-www-form-urlencoded を自動付与\n // させるため、_collectBody は contentType に null を返す)。ReadableStream は\n // RequestInit.duplex: 'half' を要するため初版では対象外とし、従来どおり扱う。\n private _isNativeBodyInit(value: unknown): value is BodyInit {\n return value instanceof Blob // File は Blob のサブクラス\n || value instanceof FormData\n || value instanceof URLSearchParams\n || value instanceof ArrayBuffer\n || ArrayBuffer.isView(value); // TypedArray / DataView\n }\n\n private _collectBody(bodySnapshot: any): { body: BodyInit | null; contentType: string | null } {\n // JS API経由のbodyが優先\n if (bodySnapshot !== null) {\n // 文字列はそのまま。Content-Type はユーザーのヘッダ指定に委ねる。\n if (typeof bodySnapshot === \"string\") {\n return { body: bodySnapshot, contentType: null };\n }\n // ネイティブ BodyInit (Blob/File/FormData/URLSearchParams/ArrayBuffer/TypedArray)\n // は素通し。Content-Type はブラウザに委ねるため null を返す。\n if (this._isNativeBodyInit(bodySnapshot)) {\n return { body: bodySnapshot, contentType: null };\n }\n // それ以外のオブジェクトは JSON 化する。\n return { body: JSON.stringify(bodySnapshot), contentType: \"application/json\" };\n }\n\n // サブタグからbodyを取得\n const bodyElement = this.querySelector<FetchBody>(config.tagNames.fetchBody);\n if (bodyElement) {\n return {\n body: bodyElement.bodyContent || null,\n contentType: bodyElement.contentType,\n };\n }\n\n return { body: null, contentType: null };\n }\n\n abort(): void {\n this._core.abort();\n }\n\n /**\n * Coalesce auto-fetch requests in the current task into a single microtask.\n *\n * Multiple synchronous input writes in the same tick — e.g. a `...` spread\n * writing `url` before `manual` — collapse into one decision made against the\n * FINAL element state, so the spread application order can no longer trigger a\n * stray fetch. The microtask re-reads `isConnected` / `manual` / `url` at fire\n * time; whatever was written last wins.\n *\n * Only the implicit auto-fetch (url attribute change, connect-time) is routed\n * here. Explicit triggers — the `trigger` setter, the `fetch` command, and\n * autoTrigger (data-fetchtarget clicks) — must fire immediately and stay on\n * their own synchronous paths.\n *\n * The connect-time promise (connectedCallbackPromise) is resolved here in\n * EVERY exit path, including the no-fetch branch, so awaiting it never hangs\n * when the final state turns out to be manual / url-less / disconnected.\n */\n private _scheduleAutoFetch(): void {\n if (this._autoPending) {\n return;\n }\n this._autoPending = true;\n queueMicrotask(() => {\n this._autoPending = false;\n const resolveConnect = this._connectResolve;\n this._connectResolve = null;\n const url = this.url;\n // Same-value guard (Phase 4): skip a redundant auto-fetch for the url we\n // last fetched. A spread re-evaluation rewrites every input each cycle, so\n // the `url` setter calls setAttribute with an unchanged value and fires\n // attributeChangedCallback again; without this guard an unrelated state\n // change would refetch. Auto-path only — explicit fetch()/trigger/command\n // stay unconditional (a manual refresh of the same url must work), and\n // `_lastFetchedUrl` is reset on disconnect so a remount refetches.\n if (this.isConnected && !this.manual && url && url !== this._lastFetchedUrl) {\n // fetch() cannot reject here: FetchCore swallows network/HTTP errors and\n // only rejects on an empty url, which the `url` guard above rules out.\n this.fetch().finally(() => resolveConnect?.());\n } else {\n resolveConnect?.();\n }\n });\n }\n\n async fetch(): Promise<any> {\n // Record the url for the auto-fetch same-value guard. Every fetch (explicit\n // included) updates it so a later auto-write of the same url is treated as a\n // no-op rather than a duplicate request.\n this._lastFetchedUrl = this.url;\n const headers = this._collectHeaders();\n\n // Snapshot and reset `body` synchronously, before any await. The body is a\n // one-shot input; resetting it after the await (when another caller may have\n // already set a new body for the next request) would silently drop that value.\n const bodySnapshot = this._body;\n this._body = null;\n const { body, contentType } = this._collectBody(bodySnapshot);\n\n // FormData に手動で Content-Type を付けると、ブラウザが付与するはずの multipart\n // boundary が失われてサーバー側でパースできなくなる。ヘッダはユーザー指定を\n // 尊重して素通しするが、この典型的な誤設定は警告する。\n if (body instanceof FormData &&\n Object.keys(headers).some((name) => name.toLowerCase() === \"content-type\")) {\n console.warn(\n \"[@wcstack/fetch] A manual Content-Type header was set alongside a FormData body. \" +\n \"This drops the multipart boundary the browser adds automatically; remove the \" +\n \"Content-Type header (e.g. the <wcs-fetch-header>) to fix multipart uploads.\",\n );\n }\n\n const result = await this._core.fetch(this.url, {\n method: this.method,\n headers,\n body,\n contentType,\n forceText: !!this.target,\n responseType: this.responseType,\n });\n\n // HTML置換モード\n // Security: the response is injected as raw innerHTML without sanitization.\n // This is an opt-in convenience for trusted fragments only; the primary,\n // recommended path is state-driven binding via @wcstack/state. Do not point\n // `target` at an untrusted endpoint (XSS risk). See README \"HTML Replace Mode\".\n if (this.target && result !== null) {\n const targetElement = document.getElementById(this.target);\n if (targetElement) {\n targetElement.innerHTML = result;\n }\n }\n\n return result;\n }\n\n attributeChangedCallback(name: string, _oldValue: string | null, _newValue: string | null): void {\n // Re-fetch on url changes, but intentionally do NOT update\n // `_connectedCallbackPromise`. Per the wc-bindable connectedCallbackPromise\n // protocol that promise represents the one-shot \"connect-time initialization\n // is done\" signal; it resolves once and is not re-armed for later url-driven\n // requests. Await `promise` if you need to track a specific re-fetch.\n //\n // Defer the decision to a microtask (see _scheduleAutoFetch) instead of\n // fetching synchronously here: a `...` spread writes `url` before `manual`,\n // so a synchronous fetch would fire before `manual` is applied. The final\n // state (isConnected / manual / url) is re-read at microtask time.\n if (name === \"url\") {\n this._scheduleAutoFetch();\n }\n }\n\n connectedCallback(): void {\n this.style.display = \"none\";\n if (config.autoTrigger) {\n registerAutoTrigger();\n }\n // Only the initial connect-time fetch is tracked by connectedCallbackPromise.\n // Arm a deferred here when an auto-fetch looks likely; the scheduled\n // microtask resolves it (in every exit path, so awaiting never hangs). The\n // actual fetch decision is re-evaluated at microtask time against the final\n // state, so a spread that sets `manual` after `url` still suppresses it.\n if (!this.manual && this.url) {\n this._connectedCallbackPromise = new Promise<void>((resolve) => {\n this._connectResolve = resolve;\n });\n }\n this._scheduleAutoFetch();\n }\n\n disconnectedCallback(): void {\n this.abort();\n // Reset the same-value guard so a remount (reconnect with the same url)\n // refetches rather than being skipped as a duplicate.\n this._lastFetchedUrl = null;\n // Resolve any armed connect-time deferred before detaching. A synchronous\n // remove()→append() before the scheduled microtask fires would otherwise let\n // the second connectedCallback overwrite _connectResolve, orphaning the first\n // deferred and hanging any caller that already awaited connectedCallbackPromise.\n // Disconnection makes connect-time init moot, so resolving (never hanging) is\n // correct; the pending microtask then sees _connectResolve === null and no-ops.\n this._connectResolve?.();\n this._connectResolve = null;\n }\n}\n","export class FetchHeader extends HTMLElement {\n connectedCallback(): void {\n this.style.display = \"none\";\n }\n\n get headerName(): string {\n return this.getAttribute(\"name\") || \"\";\n }\n\n get headerValue(): string {\n return this.getAttribute(\"value\") || \"\";\n }\n}\n","export class FetchBody extends HTMLElement {\n constructor() {\n super();\n // スロットなしのShadow DOMでlight DOM(bodyテキスト)の描画を抑制\n this.attachShadow({ mode: \"open\" });\n }\n\n get contentType(): string {\n return this.getAttribute(\"type\") || \"application/json\";\n }\n\n get bodyContent(): string {\n return this.textContent?.trim() || \"\";\n }\n}\n","import { Fetch } from \"./Fetch.js\";\n\nexport class InfiniteScroll extends HTMLElement {\n static get observedAttributes(): string[] {\n return [\"target\", \"root\", \"root-margin\", \"threshold\", \"disabled\"];\n }\n\n private _observer: IntersectionObserver | null = null;\n private _done: boolean = false;\n\n get target(): string {\n return this.getAttribute(\"target\") || \"\";\n }\n\n set target(value: string) {\n this.setAttribute(\"target\", value);\n }\n\n get root(): string | null {\n return this.getAttribute(\"root\");\n }\n\n set root(value: string | null) {\n if (value === null) {\n this.removeAttribute(\"root\");\n } else {\n this.setAttribute(\"root\", value);\n }\n }\n\n get rootMargin(): string {\n return this.getAttribute(\"root-margin\") || \"0px\";\n }\n\n set rootMargin(value: string) {\n this.setAttribute(\"root-margin\", value);\n }\n\n get threshold(): number {\n const value = Number(this.getAttribute(\"threshold\") ?? \"0\");\n return Number.isFinite(value) ? value : 0;\n }\n\n set threshold(value: number) {\n this.setAttribute(\"threshold\", String(value));\n }\n\n get disabled(): boolean {\n return this.hasAttribute(\"disabled\");\n }\n\n set disabled(value: boolean) {\n if (value) {\n this.setAttribute(\"disabled\", \"\");\n } else {\n this.removeAttribute(\"disabled\");\n }\n }\n\n get once(): boolean {\n return this.hasAttribute(\"once\");\n }\n\n set once(value: boolean) {\n if (value) {\n this.setAttribute(\"once\", \"\");\n } else {\n this.removeAttribute(\"once\");\n }\n }\n\n connectedCallback(): void {\n this._observe();\n }\n\n disconnectedCallback(): void {\n this._disconnectObserver();\n }\n\n attributeChangedCallback(): void {\n if (this.isConnected) {\n this._observe();\n }\n }\n\n private _observe(): void {\n this._disconnectObserver();\n\n if (this._done || this.disabled || !this.target || typeof IntersectionObserver === \"undefined\") {\n return;\n }\n\n this._observer = new IntersectionObserver((entries) => {\n if (entries.some((entry) => entry.isIntersecting)) {\n this._triggerFetch();\n }\n }, {\n root: this._resolveRoot(),\n rootMargin: this.rootMargin,\n threshold: this.threshold,\n });\n this._observer.observe(this);\n }\n\n private _disconnectObserver(): void {\n if (this._observer) {\n this._observer.disconnect();\n this._observer = null;\n }\n }\n\n private _resolveRoot(): Element | Document | null {\n if (!this.root) return null;\n return document.getElementById(this.root) || null;\n }\n\n private _triggerFetch(): void {\n const target = document.getElementById(this.target);\n if (!(target instanceof Fetch)) {\n return;\n }\n\n if (target.loading) {\n return;\n }\n\n target.trigger = true;\n\n if (this.once) {\n this._done = true;\n this._disconnectObserver();\n }\n }\n}","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapFetch(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n","import { Fetch } from \"./components/Fetch.js\";\nimport { FetchHeader } from \"./components/FetchHeader.js\";\nimport { FetchBody } from \"./components/FetchBody.js\";\nimport { InfiniteScroll } from \"./components/InfiniteScroll.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.fetch)) {\n customElements.define(config.tagNames.fetch, Fetch);\n }\n if (!customElements.get(config.tagNames.fetchHeader)) {\n customElements.define(config.tagNames.fetchHeader, FetchHeader);\n }\n if (!customElements.get(config.tagNames.fetchBody)) {\n customElements.define(config.tagNames.fetchBody, FetchBody);\n }\n if (!customElements.get(config.tagNames.infiniteScroll)) {\n customElements.define(config.tagNames.infiniteScroll, InfiniteScroll);\n }\n}\n"],"names":["_config","autoTrigger","triggerAttribute","tagNames","fetch","fetchHeader","fetchBody","infiniteScroll","deepFreeze","obj","Object","freeze","key","keys","deepClone","clone","frozenConfig","config","getConfig","FetchCore","EventTarget","static","protocol","version","properties","name","event","getter","e","detail","value","status","objectURL","inputs","commands","async","_target","_value","_loading","_error","_status","_objectURL","_abortController","_promise","Promise","resolve","_gen","_ready","constructor","target","super","this","ready","observe","dispose","abort","_revokeObjectURL","loading","error","promise","_setLoading","dispatchEvent","CustomEvent","bubbles","_setError","_setResponse","_createObjectURL","blob","URL","createObjectURL","url","revokeObjectURL","options","message","p","_doFetch","ac","AbortController","signal","gen","method","body","contentType","forceText","responseType","headers","requestInit","response","globalThis","ok","errorBody","text","catch","statusText","buffer","arrayBuffer","data","json","get","includes","registered","handleClick","Element","triggerElement","closest","fetchId","getAttribute","FetchCtor","customElements","el","document","getElementById","fetchElement","preventDefault","Fetch","HTMLElement","wcBindable","observedAttributes","_core","_body","_trigger","_connectedCallbackPromise","_autoPending","_connectResolve","_lastFetchedUrl","removeAttribute","setAttribute","toUpperCase","connectedCallbackPromise","manual","hasAttribute","trigger","finally","_collectHeaders","headerElements","querySelectorAll","headerName","headerValue","_isNativeBodyInit","Blob","FormData","URLSearchParams","ArrayBuffer","isView","_collectBody","bodySnapshot","JSON","stringify","bodyElement","querySelector","bodyContent","_scheduleAutoFetch","queueMicrotask","resolveConnect","isConnected","some","toLowerCase","console","warn","result","targetElement","innerHTML","attributeChangedCallback","_oldValue","_newValue","connectedCallback","style","display","addEventListener","disconnectedCallback","FetchHeader","FetchBody","attachShadow","mode","textContent","trim","InfiniteScroll","_observer","_done","root","rootMargin","threshold","Number","isFinite","String","disabled","once","_observe","_disconnectObserver","IntersectionObserver","entries","entry","isIntersecting","_triggerFetch","_resolveRoot","disconnect","bootstrapFetch","userConfig","partialConfig","assign","define"],"mappings":"AAaA,MAAMA,EAA2B,CAC/BC,aAAa,EACbC,iBAAkB,mBAClBC,SAAU,CACRC,MAAO,YACPC,YAAa,mBACbC,UAAW,iBACXC,eAAgB,wBAIpB,SAASC,EAAcC,GACrB,GAAY,OAARA,GAA+B,iBAARA,EAAkB,OAAOA,EACpDC,OAAOC,OAAOF,GACd,IAAK,MAAMG,KAAOF,OAAOG,KAAKJ,GAC5BD,EAAYC,EAAgCG,IAE9C,OAAOH,CACT,CAEA,SAASK,EAAaL,GACpB,GAAY,OAARA,GAA+B,iBAARA,EAAkB,OAAOA,EACpD,MAAMM,EAAiC,CAAA,EACvC,IAAK,MAAMH,KAAOF,OAAOG,KAAKJ,GAC5BM,EAAMH,GAAOE,EAAWL,EAAgCG,IAE1D,OAAOG,CACT,CAEA,IAAIC,EAA+B,KAE5B,MAAMC,EAAkBjB,WAEfkB,IAId,OAHKF,IACHA,EAAeR,EAAWM,EAAUd,KAE/BgB,CACT,CClCM,MAAOG,UAAkBC,YAC7BC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EhD9D,eAAeV,IAAIjF,EAAOd,SAASG,YACtCsG,eAAe4F,OAAOvL,EAAOd,SAASG,UAAWqK,GAE9C/D,eAAeV,IAAIjF,EAAOd,SAASI,iBACtCqG,eAAe4F,OAAOvL,EAAOd,SAASI,eAAgByK,EDR1D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wcstack/fetch",
3
- "version": "1.14.0",
3
+ "version": "1.15.0",
4
4
  "description": "Declarative fetch component for Web Components. Framework-agnostic async data fetching via wc-bindable-protocol.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.esm.js",