@wcstack/network 1.22.6 → 1.24.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/README.ja.md CHANGED
@@ -203,6 +203,8 @@ console.log(net.effectiveType);
203
203
  net.dispose(); // live な `change` リスナーを外す
204
204
  ```
205
205
 
206
+ Core の構造サーフェスは wcstack I/O ノード横断の規範です([async-io-node-guidelines §3.9](../../docs/async-io-node-guidelines.md))。要素なしで signals に束縛するには [@wcstack/signals — Core を直接束縛する](../signals/README.ja.md#core-を直接束縛する要素なし) を参照。
207
+
206
208
  ## ライセンス
207
209
 
208
210
  MIT
package/README.md CHANGED
@@ -205,6 +205,8 @@ console.log(net.effectiveType);
205
205
  net.dispose(); // detach the live `change` listener
206
206
  ```
207
207
 
208
+ The structural Core surface is normative across wcstack IO nodes ([async-io-node-guidelines §3.9](../../docs/async-io-node-guidelines.md)); to bind it into signals with no element at all, see [@wcstack/signals — Binding a Core directly](../signals/README.md#binding-a-core-directly-no-element).
209
+
208
210
  ## License
209
211
 
210
212
  MIT
package/dist/index.d.ts CHANGED
@@ -1,7 +1,24 @@
1
+ /**
2
+ * Observation semantics of a `properties` entry.
3
+ *
4
+ * "state" — current value. A snapshot may cache it, and equality-based dedupe is safe.
5
+ * "event" — occurrence. Repeated identical payloads are distinct occurrences; never dedupe.
6
+ * "handle" — live / opaque resource with its own lifecycle (e.g. MediaStream). Not
7
+ * snapshot-safe and not necessarily serializable; consumers need an explicit
8
+ * ref / callback surface rather than a value slot.
9
+ */
10
+ type WcBindableSemantics = "state" | "event" | "handle";
1
11
  interface IWcBindableProperty {
2
12
  readonly name: string;
3
13
  readonly event: string;
4
14
  readonly getter?: (event: Event) => any;
15
+ /**
16
+ * Optional, additive, forward-compatible. An absent value means **unspecified**, NOT
17
+ * "state": a reader that finds no `semantics` MUST keep the behavior it had before this
18
+ * field existed (deliver the update as-is; do not start deduping, caching or serializing
19
+ * on assumption). Only an explicit value licenses a reader to change its handling.
20
+ */
21
+ readonly semantics?: WcBindableSemantics;
5
22
  }
6
23
  interface IWcBindableInput {
7
24
  readonly name: string;
package/dist/index.esm.js CHANGED
@@ -61,11 +61,11 @@ class NetworkCore extends EventTarget {
61
61
  protocol: "wc-bindable",
62
62
  version: 1,
63
63
  properties: [
64
- { name: "effectiveType", event: "wcs-network:change", getter: (e) => e.detail.effectiveType },
65
- { name: "downlink", event: "wcs-network:change", getter: (e) => e.detail.downlink },
66
- { name: "rtt", event: "wcs-network:change", getter: (e) => e.detail.rtt },
67
- { name: "saveData", event: "wcs-network:change", getter: (e) => e.detail.saveData },
68
- { name: "supported", event: "wcs-network:change", getter: (e) => e.detail.supported },
64
+ { name: "effectiveType", event: "wcs-network:change", semantics: "state", getter: (e) => e.detail.effectiveType },
65
+ { name: "downlink", event: "wcs-network:change", semantics: "state", getter: (e) => e.detail.downlink },
66
+ { name: "rtt", event: "wcs-network:change", semantics: "state", getter: (e) => e.detail.rtt },
67
+ { name: "saveData", event: "wcs-network:change", semantics: "state", getter: (e) => e.detail.saveData },
68
+ { name: "supported", event: "wcs-network:change", semantics: "state", getter: (e) => e.detail.supported },
69
69
  ],
70
70
  // Pure monitor: navigator.connection has no request()/action method to invoke.
71
71
  commands: [],
@@ -173,6 +173,48 @@ class NetworkCore extends EventTarget {
173
173
  }
174
174
  }
175
175
 
176
+ // ===========================================================================
177
+ // AUTO-GENERATED FILE - DO NOT EDIT.
178
+ // Generated from /protocol/upgrade-properties.ts by scripts/sync-protocol-types.mjs.
179
+ // Run `node scripts/sync-protocol-types.mjs` after editing the source.
180
+ // ===========================================================================
181
+ function hasAccessorOnPrototype(target, name) {
182
+ let proto = Object.getPrototypeOf(target);
183
+ while (proto !== null) {
184
+ const descriptor = Object.getOwnPropertyDescriptor(proto, name);
185
+ if (descriptor !== undefined) {
186
+ return typeof descriptor.get === "function" || typeof descriptor.set === "function";
187
+ }
188
+ proto = Object.getPrototypeOf(proto);
189
+ }
190
+ return false;
191
+ }
192
+ /**
193
+ * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で
194
+ * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。
195
+ *
196
+ * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。
197
+ * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。
198
+ * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。
199
+ */
200
+ function upgradeProperties(element) {
201
+ const declaration = element.constructor?.wcBindable;
202
+ const inputs = declaration?.inputs;
203
+ if (inputs === undefined)
204
+ return;
205
+ for (const input of inputs) {
206
+ const name = input.name;
207
+ if (!Object.prototype.hasOwnProperty.call(element, name))
208
+ continue;
209
+ if (!hasAccessorOnPrototype(element, name))
210
+ continue;
211
+ const record = element;
212
+ const value = record[name];
213
+ delete record[name];
214
+ record[name] = value;
215
+ }
216
+ }
217
+
176
218
  /**
177
219
  * `<wcs-network>` — declarative Network Information API monitor.
178
220
  *
@@ -276,6 +318,8 @@ class WcsNetwork extends HTMLElement {
276
318
  }
277
319
  // --- Lifecycle ---
278
320
  connectedCallback() {
321
+ // upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)
322
+ upgradeProperties(this);
279
323
  this.style.display = "none";
280
324
  this._connectedCallbackPromise = this._core.observe();
281
325
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/config.ts","../src/core/NetworkCore.ts","../src/components/Network.ts","../src/registerComponents.ts","../src/bootstrapNetwork.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n network: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n network: \"wcs-network\",\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 (partialConfig.tagNames) {\n Object.assign(_config.tagNames, partialConfig.tagNames);\n }\n frozenConfig = null;\n}\n","import { IWcBindable, WcsNetworkSnapshot } from \"../types.js\";\n\nconst UNSUPPORTED_SNAPSHOT: WcsNetworkSnapshot = Object.freeze({\n effectiveType: null,\n downlink: null,\n rtt: null,\n saveData: null,\n supported: false,\n});\n\n/**\n * Headless Network Information primitive. A thin, framework-agnostic wrapper\n * around `navigator.connection` exposed through the wc-bindable protocol.\n *\n * Unlike most wcstack IO nodes, this Core needs no `_gen` generation guard\n * (§3.4): subscribing/unsubscribing to `navigator.connection`'s `change` event\n * is fully synchronous, so there is no asynchronous probe whose stale\n * resolution could race a dispose() (docs/network-tag-design.md §5).\n *\n * `navigator.connection` is unimplemented in Firefox/Safari — unsupported is\n * the common case here, not an edge case (docs/network-tag-design.md §0). All\n * four data fields collapse to `null` and `supported` to `false` in that case.\n */\nexport class NetworkCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"effectiveType\", event: \"wcs-network:change\", getter: (e: Event) => (e as CustomEvent).detail.effectiveType },\n { name: \"downlink\", event: \"wcs-network:change\", getter: (e: Event) => (e as CustomEvent).detail.downlink },\n { name: \"rtt\", event: \"wcs-network:change\", getter: (e: Event) => (e as CustomEvent).detail.rtt },\n { name: \"saveData\", event: \"wcs-network:change\", getter: (e: Event) => (e as CustomEvent).detail.saveData },\n { name: \"supported\", event: \"wcs-network:change\", getter: (e: Event) => (e as CustomEvent).detail.supported },\n ],\n // Pure monitor: navigator.connection has no request()/action method to invoke.\n commands: [],\n };\n\n private _target: EventTarget;\n private _snapshot: WcsNetworkSnapshot = UNSUPPORTED_SNAPSHOT;\n\n // The live NetworkInformation object the `change` listener is attached to (kept\n // so dispose() can remove it precisely; not read for anything else).\n private _connection: EventTarget | null = null;\n\n // True once observe() has attached the live listener (or determined there is\n // nothing to attach to). Guards observe() so a redundant call does not\n // re-subscribe; dispose() resets it so a later observe() resumes cleanly.\n private _subscribed = false;\n\n // SSR (§3.8): no asynchronous probe to await — observe() completes\n // synchronously, 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 get effectiveType(): string | null {\n return this._snapshot.effectiveType;\n }\n\n get downlink(): number | null {\n return this._snapshot.downlink;\n }\n\n get rtt(): number | null {\n return this._snapshot.rtt;\n }\n\n get saveData(): boolean | null {\n return this._snapshot.saveData;\n }\n\n get supported(): boolean {\n return this._snapshot.supported;\n }\n\n // Lifecycle (§3.5). Idempotent: a second observe() while already subscribed\n // is a no-op (no double listener, no redundant dispatch). Synchronous overall\n // (no probe to await), so the returned promise is only for API uniformity\n // with other IO nodes.\n observe(): Promise<void> {\n if (!this._subscribed) {\n this._subscribed = true;\n const api = this._api();\n if (api) {\n this._connection = api;\n api.addEventListener(\"change\", this._onChange);\n }\n this._apply(this._read());\n }\n return this._ready;\n }\n\n dispose(): void {\n this._subscribed = false;\n if (this._connection) {\n this._connection.removeEventListener(\"change\", this._onChange);\n this._connection = null;\n }\n }\n\n // API resolution is call-time, never cached (§3.7): lets tests install/remove\n // navigator.connection freely and lets an unsupported environment be detected\n // correctly on every observe()/reading.\n private _api(): (EventTarget & { effectiveType?: string; downlink?: number; rtt?: number; saveData?: boolean }) | undefined {\n const nav = (globalThis as any).navigator;\n return typeof nav !== \"undefined\" && nav.connection ? nav.connection : undefined;\n }\n\n private _read(): WcsNetworkSnapshot {\n const c = this._api();\n if (!c) {\n return UNSUPPORTED_SNAPSHOT;\n }\n return {\n effectiveType: typeof c.effectiveType === \"string\" ? c.effectiveType : null,\n downlink: typeof c.downlink === \"number\" ? c.downlink : null,\n rtt: typeof c.rtt === \"number\" ? c.rtt : null,\n saveData: typeof c.saveData === \"boolean\" ? c.saveData : null,\n supported: true,\n };\n }\n\n private _onChange = (): void => {\n this._apply(this._read());\n };\n\n // Same-value guard (§3.3 MUST): the native `change` event already fires only\n // on a real change, but this Core still verifies field-by-field before\n // dispatching — defense in depth against a browser quirk double-firing\n // `change` with identical values.\n private _apply(next: WcsNetworkSnapshot): void {\n const prev = this._snapshot;\n if (\n prev.effectiveType === next.effectiveType &&\n prev.downlink === next.downlink &&\n prev.rtt === next.rtt &&\n prev.saveData === next.saveData &&\n prev.supported === next.supported\n ) {\n return;\n }\n this._snapshot = next;\n this._target.dispatchEvent(new CustomEvent(\"wcs-network:change\", {\n detail: next,\n // Family-wide MUST (async-io-node-guidelines.md §3.3): the event bubbles\n // from the Shell element so document-level consumers can delegate.\n bubbles: true,\n }));\n }\n}\n","import { IWcBindable } from \"../types.js\";\nimport { NetworkCore } from \"../core/NetworkCore.js\";\n\n/**\n * `<wcs-network>` — declarative Network Information API monitor.\n *\n * The smallest Shell in the batch (docs/network-tag-design.md §9): no\n * attributes at all. `navigator.connection` is a single global with nothing to\n * configure, unlike target-based nodes (`intersection`/`resize`) or\n * descriptor-based ones (`permission`).\n */\nexport class WcsNetwork extends HTMLElement {\n // SSR (§4.4): observe() completes synchronously, but the Shell still exposes\n // connectedCallbackPromise so SSR (@wcstack/server render.ts) can await it\n // uniformly across all IO nodes before snapshotting the HTML. Mirrors\n // WcsPermission.connectedCallbackPromise.\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...NetworkCore.wcBindable,\n inputs: [],\n // Core の commands をそのまま継承(単一情報源)。permission と同型。\n commands: NetworkCore.wcBindable.commands,\n };\n\n private _core: NetworkCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new NetworkCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-network:change\": (d) => ({\n \"save-data\": d.saveData === true,\n supported: d.supported === true,\n }),\n });\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\n }\n\n // --- Core delegated getters ---\n\n get effectiveType(): string | null {\n return this._core.effectiveType;\n }\n\n get downlink(): number | null {\n return this._core.downlink;\n }\n\n get rtt(): number | null {\n return this._core.rtt;\n }\n\n get saveData(): boolean | null {\n return this._core.saveData;\n }\n\n get supported(): boolean {\n return this._core.supported;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n this.style.display = \"none\";\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n this._core.dispose();\n }\n}\n","import { WcsNetwork } from \"./components/Network.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.network)) {\n customElements.define(config.tagNames.network, WcsNetwork);\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapNetwork(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n"],"names":[],"mappings":"AAQA,MAAM,OAAO,GAAoB;AAC/B,IAAA,QAAQ,EAAE;AACR,QAAA,OAAO,EAAE,aAAa;AACvB,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,GAAG,KAAK,QAAQ;AAAE,QAAA,OAAO,GAAG;IACvD,MAAM,KAAK,GAA4B,EAAE;IACzC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAClC,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAAE,GAA+B,CAAC,GAAG,CAAC,CAAC;IAC/D;AACA,IAAA,OAAO,KAAU;AAC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CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC5D;AACF;;ACHM,SAAU,gBAAgB,CAAC,UAA4B,EAAA;IAC3D,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/NetworkCore.ts","../src/protocol/upgradeProperties.ts","../src/components/Network.ts","../src/registerComponents.ts","../src/bootstrapNetwork.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n network: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n network: \"wcs-network\",\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 (partialConfig.tagNames) {\n Object.assign(_config.tagNames, partialConfig.tagNames);\n }\n frozenConfig = null;\n}\n","import { IWcBindable, WcsNetworkSnapshot } from \"../types.js\";\n\nconst UNSUPPORTED_SNAPSHOT: WcsNetworkSnapshot = Object.freeze({\n effectiveType: null,\n downlink: null,\n rtt: null,\n saveData: null,\n supported: false,\n});\n\n/**\n * Headless Network Information primitive. A thin, framework-agnostic wrapper\n * around `navigator.connection` exposed through the wc-bindable protocol.\n *\n * Unlike most wcstack IO nodes, this Core needs no `_gen` generation guard\n * (§3.4): subscribing/unsubscribing to `navigator.connection`'s `change` event\n * is fully synchronous, so there is no asynchronous probe whose stale\n * resolution could race a dispose() (docs/network-tag-design.md §5).\n *\n * `navigator.connection` is unimplemented in Firefox/Safari — unsupported is\n * the common case here, not an edge case (docs/network-tag-design.md §0). All\n * four data fields collapse to `null` and `supported` to `false` in that case.\n */\nexport class NetworkCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"effectiveType\", event: \"wcs-network:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.effectiveType },\n { name: \"downlink\", event: \"wcs-network:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.downlink },\n { name: \"rtt\", event: \"wcs-network:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.rtt },\n { name: \"saveData\", event: \"wcs-network:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.saveData },\n { name: \"supported\", event: \"wcs-network:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.supported },\n ],\n // Pure monitor: navigator.connection has no request()/action method to invoke.\n commands: [],\n };\n\n private _target: EventTarget;\n private _snapshot: WcsNetworkSnapshot = UNSUPPORTED_SNAPSHOT;\n\n // The live NetworkInformation object the `change` listener is attached to (kept\n // so dispose() can remove it precisely; not read for anything else).\n private _connection: EventTarget | null = null;\n\n // True once observe() has attached the live listener (or determined there is\n // nothing to attach to). Guards observe() so a redundant call does not\n // re-subscribe; dispose() resets it so a later observe() resumes cleanly.\n private _subscribed = false;\n\n // SSR (§3.8): no asynchronous probe to await — observe() completes\n // synchronously, 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 get effectiveType(): string | null {\n return this._snapshot.effectiveType;\n }\n\n get downlink(): number | null {\n return this._snapshot.downlink;\n }\n\n get rtt(): number | null {\n return this._snapshot.rtt;\n }\n\n get saveData(): boolean | null {\n return this._snapshot.saveData;\n }\n\n get supported(): boolean {\n return this._snapshot.supported;\n }\n\n // Lifecycle (§3.5). Idempotent: a second observe() while already subscribed\n // is a no-op (no double listener, no redundant dispatch). Synchronous overall\n // (no probe to await), so the returned promise is only for API uniformity\n // with other IO nodes.\n observe(): Promise<void> {\n if (!this._subscribed) {\n this._subscribed = true;\n const api = this._api();\n if (api) {\n this._connection = api;\n api.addEventListener(\"change\", this._onChange);\n }\n this._apply(this._read());\n }\n return this._ready;\n }\n\n dispose(): void {\n this._subscribed = false;\n if (this._connection) {\n this._connection.removeEventListener(\"change\", this._onChange);\n this._connection = null;\n }\n }\n\n // API resolution is call-time, never cached (§3.7): lets tests install/remove\n // navigator.connection freely and lets an unsupported environment be detected\n // correctly on every observe()/reading.\n private _api(): (EventTarget & { effectiveType?: string; downlink?: number; rtt?: number; saveData?: boolean }) | undefined {\n const nav = (globalThis as any).navigator;\n return typeof nav !== \"undefined\" && nav.connection ? nav.connection : undefined;\n }\n\n private _read(): WcsNetworkSnapshot {\n const c = this._api();\n if (!c) {\n return UNSUPPORTED_SNAPSHOT;\n }\n return {\n effectiveType: typeof c.effectiveType === \"string\" ? c.effectiveType : null,\n downlink: typeof c.downlink === \"number\" ? c.downlink : null,\n rtt: typeof c.rtt === \"number\" ? c.rtt : null,\n saveData: typeof c.saveData === \"boolean\" ? c.saveData : null,\n supported: true,\n };\n }\n\n private _onChange = (): void => {\n this._apply(this._read());\n };\n\n // Same-value guard (§3.3 MUST): the native `change` event already fires only\n // on a real change, but this Core still verifies field-by-field before\n // dispatching — defense in depth against a browser quirk double-firing\n // `change` with identical values.\n private _apply(next: WcsNetworkSnapshot): void {\n const prev = this._snapshot;\n if (\n prev.effectiveType === next.effectiveType &&\n prev.downlink === next.downlink &&\n prev.rtt === next.rtt &&\n prev.saveData === next.saveData &&\n prev.supported === next.supported\n ) {\n return;\n }\n this._snapshot = next;\n this._target.dispatchEvent(new CustomEvent(\"wcs-network:change\", {\n detail: next,\n // Family-wide MUST (async-io-node-guidelines.md §3.3): the event bubbles\n // from the Shell element so document-level consumers can delegate.\n bubbles: true,\n }));\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/upgrade-properties.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// custom element の property upgrade — `static wcBindable.inputs` に宣言した入力のうち、\n// 要素が upgrade される前に代入された own データプロパティを取り込み直す。\n//\n// なぜ必要か:\n// 未定義タグの要素は素の HTMLElement なので、`el.url = \"...\"` は own データプロパティを作る。\n// upgrade 後にクラスの accessor が prototype へ入っても own プロパティが優先されるため、\n// setter は二度と呼ばれず、値は要素へ届かないまま消える(エラーも警告も出ない)。\n// 常にプロパティ代入を行う framework(Angular の `[prop]`、Lit の `.prop=`、\n// Solid の `prop:`、Vue の `.prop` 修飾子)× 遅延定義(autoloader / CDN / code-split)で\n// 常態的に起きる。docs/architecture-hardening/13-framework-adapter-binding-constraints.md §1.2。\n//\n// 安全側の判定:\n// own プロパティがあっても、prototype チェーンに accessor が無ければ「シャドウ」ではなく\n// その own プロパティ自体が正規の格納先なので触らない(public class field を壊さない)。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/upgrade-properties.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/upgradeProperties.ts). Those copies are generated — do not edit them.\nimport { IWcBindable } from \"./wcBindable.js\";\n\nfunction hasAccessorOnPrototype(target: object, name: string): boolean {\n let proto = Object.getPrototypeOf(target);\n while (proto !== null) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, name);\n if (descriptor !== undefined) {\n return typeof descriptor.get === \"function\" || typeof descriptor.set === \"function\";\n }\n proto = Object.getPrototypeOf(proto);\n }\n return false;\n}\n\n/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n */\nexport function upgradeProperties(element: object): void {\n const declaration = (element as { constructor?: { wcBindable?: IWcBindable } }).constructor?.wcBindable;\n const inputs = declaration?.inputs;\n if (inputs === undefined) return;\n for (const input of inputs) {\n const name = input.name;\n if (!Object.prototype.hasOwnProperty.call(element, name)) continue;\n if (!hasAccessorOnPrototype(element, name)) continue;\n const record = element as Record<string, unknown>;\n const value = record[name];\n delete record[name];\n record[name] = value;\n }\n}\n","import { IWcBindable } from \"../types.js\";\nimport { NetworkCore } from \"../core/NetworkCore.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.js\";\n\n/**\n * `<wcs-network>` — declarative Network Information API monitor.\n *\n * The smallest Shell in the batch (docs/network-tag-design.md §9): no\n * attributes at all. `navigator.connection` is a single global with nothing to\n * configure, unlike target-based nodes (`intersection`/`resize`) or\n * descriptor-based ones (`permission`).\n */\nexport class WcsNetwork extends HTMLElement {\n // SSR (§4.4): observe() completes synchronously, but the Shell still exposes\n // connectedCallbackPromise so SSR (@wcstack/server render.ts) can await it\n // uniformly across all IO nodes before snapshotting the HTML. Mirrors\n // WcsPermission.connectedCallbackPromise.\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...NetworkCore.wcBindable,\n inputs: [],\n // Core の commands をそのまま継承(単一情報源)。permission と同型。\n commands: NetworkCore.wcBindable.commands,\n };\n\n private _core: NetworkCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new NetworkCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-network:change\": (d) => ({\n \"save-data\": d.saveData === true,\n supported: d.supported === true,\n }),\n });\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\n }\n\n // --- Core delegated getters ---\n\n get effectiveType(): string | null {\n return this._core.effectiveType;\n }\n\n get downlink(): number | null {\n return this._core.downlink;\n }\n\n get rtt(): number | null {\n return this._core.rtt;\n }\n\n get saveData(): boolean | null {\n return this._core.saveData;\n }\n\n get supported(): boolean {\n return this._core.supported;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n // upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)\n upgradeProperties(this);\n this.style.display = \"none\";\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n this._core.dispose();\n }\n}\n","import { WcsNetwork } from \"./components/Network.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.network)) {\n customElements.define(config.tagNames.network, WcsNetwork);\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapNetwork(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n"],"names":[],"mappings":"AAQA,MAAM,OAAO,GAAoB;AAC/B,IAAA,QAAQ,EAAE;AACR,QAAA,OAAO,EAAE,aAAa;AACvB,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,GAAG,KAAK,QAAQ;AAAE,QAAA,OAAO,GAAG;IACvD,MAAM,KAAK,GAA4B,EAAE;IACzC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAClC,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAAE,GAA+B,CAAC,GAAG,CAAC,CAAC;IAC/D;AACA,IAAA,OAAO,KAAU;AACnB;AAEA,IAAI,YAAY,GAAmB,IAAI;AAEhC,MAAM,MAAM,GAAY,OAAkB;SAEjC,SAAS,GAAA;IACvB,IAAI,CAAC,YAAY,EAAE;Q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O,EAAE,UAAU,CAAC;IAC5D;AACF;;ACHM,SAAU,gBAAgB,CAAC,UAA4B,EAAA;IAC3D,IAAI,UAAU,EAAE;QACd,SAAS,CAAC,UAAU,CAAC;IACvB;AACA,IAAA,kBAAkB,EAAE;AACtB;;;;"}
@@ -1,2 +1,2 @@
1
- const e={tagNames:{network:"wcs-network"}};function t(e){if(null===e||"object"!=typeof e)return e;Object.freeze(e);for(const n of Object.keys(e))t(e[n]);return e}function n(e){if(null===e||"object"!=typeof e)return e;const t={};for(const s of Object.keys(e))t[s]=n(e[s]);return t}let s=null;const a=e;function r(){return s||(s=t(n(e))),s}const i=Object.freeze({effectiveType:null,downlink:null,rtt:null,saveData:null,supported:!1});class o extends EventTarget{static wcBindable={protocol:"wc-bindable",version:1,properties:[{name:"effectiveType",event:"wcs-network:change",getter:e=>e.detail.effectiveType},{name:"downlink",event:"wcs-network:change",getter:e=>e.detail.downlink},{name:"rtt",event:"wcs-network:change",getter:e=>e.detail.rtt},{name:"saveData",event:"wcs-network:change",getter:e=>e.detail.saveData},{name:"supported",event:"wcs-network:change",getter:e=>e.detail.supported}],commands:[]};_target;_snapshot=i;_connection=null;_subscribed=!1;_ready=Promise.resolve();constructor(e){super(),this._target=e??this}get ready(){return this._ready}get effectiveType(){return this._snapshot.effectiveType}get downlink(){return this._snapshot.downlink}get rtt(){return this._snapshot.rtt}get saveData(){return this._snapshot.saveData}get supported(){return this._snapshot.supported}observe(){if(!this._subscribed){this._subscribed=!0;const e=this._api();e&&(this._connection=e,e.addEventListener("change",this._onChange)),this._apply(this._read())}return this._ready}dispose(){this._subscribed=!1,this._connection&&(this._connection.removeEventListener("change",this._onChange),this._connection=null)}_api(){const e=globalThis.navigator;return void 0!==e&&e.connection?e.connection:void 0}_read(){const e=this._api();return e?{effectiveType:"string"==typeof e.effectiveType?e.effectiveType:null,downlink:"number"==typeof e.downlink?e.downlink:null,rtt:"number"==typeof e.rtt?e.rtt:null,saveData:"boolean"==typeof e.saveData?e.saveData:null,supported:!0}:i}_onChange=()=>{this._apply(this._read())};_apply(e){const t=this._snapshot;t.effectiveType===e.effectiveType&&t.downlink===e.downlink&&t.rtt===e.rtt&&t.saveData===e.saveData&&t.supported===e.supported||(this._snapshot=e,this._target.dispatchEvent(new CustomEvent("wcs-network:change",{detail:e,bubbles:!0})))}}class c extends HTMLElement{static hasConnectedCallbackPromise=!0;static wcBindable={...o.wcBindable,inputs:[],commands:o.wcBindable.commands};_core;_connectedCallbackPromise=Promise.resolve();_internals=null;constructor(){super(),this._core=new o(this),this._internals=this._initInternals(),this._wireStates({"wcs-network:change":e=>({"save-data":!0===e.saveData,supported:!0===e.supported})})}get debugStates(){return this._internals?[...this._internals.states]:[]}_initInternals(){try{if("function"!=typeof this.attachInternals)return null;const e=this.attachInternals();return e.states.add("wcs-probe"),e.states.delete("wcs-probe"),e}catch{return null}}_wireStates(e){if(null===this._internals)return;const t=this._internals.states;for(const[n,s]of Object.entries(e))this.addEventListener(n,e=>{const n=this.hasAttribute("debug-states");for(const[a,r]of Object.entries(s(e.detail))){try{r?t.add(a):t.delete(a)}catch{}n&&this.toggleAttribute(`data-wcs-state-${a}`,r)}})}get effectiveType(){return this._core.effectiveType}get downlink(){return this._core.downlink}get rtt(){return this._core.rtt}get saveData(){return this._core.saveData}get supported(){return this._core.supported}get connectedCallbackPromise(){return this._connectedCallbackPromise}connectedCallback(){this.style.display="none",this._connectedCallbackPromise=this._core.observe()}disconnectedCallback(){this._core.dispose()}}function l(t){var n;t&&((n=t).tagNames&&Object.assign(e.tagNames,n.tagNames),s=null),customElements.get(a.tagNames.network)||customElements.define(a.tagNames.network,c)}export{o as NetworkCore,c as WcsNetwork,l as bootstrapNetwork,r as getConfig};
1
+ const t={tagNames:{network:"wcs-network"}};function e(t){if(null===t||"object"!=typeof t)return t;Object.freeze(t);for(const n of Object.keys(t))e(t[n]);return t}function n(t){if(null===t||"object"!=typeof t)return t;const e={};for(const s of Object.keys(t))e[s]=n(t[s]);return e}let s=null;const r=t;function a(){return s||(s=e(n(t))),s}const o=Object.freeze({effectiveType:null,downlink:null,rtt:null,saveData:null,supported:!1});class i extends EventTarget{static wcBindable={protocol:"wc-bindable",version:1,properties:[{name:"effectiveType",event:"wcs-network:change",semantics:"state",getter:t=>t.detail.effectiveType},{name:"downlink",event:"wcs-network:change",semantics:"state",getter:t=>t.detail.downlink},{name:"rtt",event:"wcs-network:change",semantics:"state",getter:t=>t.detail.rtt},{name:"saveData",event:"wcs-network:change",semantics:"state",getter:t=>t.detail.saveData},{name:"supported",event:"wcs-network:change",semantics:"state",getter:t=>t.detail.supported}],commands:[]};_target;_snapshot=o;_connection=null;_subscribed=!1;_ready=Promise.resolve();constructor(t){super(),this._target=t??this}get ready(){return this._ready}get effectiveType(){return this._snapshot.effectiveType}get downlink(){return this._snapshot.downlink}get rtt(){return this._snapshot.rtt}get saveData(){return this._snapshot.saveData}get supported(){return this._snapshot.supported}observe(){if(!this._subscribed){this._subscribed=!0;const t=this._api();t&&(this._connection=t,t.addEventListener("change",this._onChange)),this._apply(this._read())}return this._ready}dispose(){this._subscribed=!1,this._connection&&(this._connection.removeEventListener("change",this._onChange),this._connection=null)}_api(){const t=globalThis.navigator;return void 0!==t&&t.connection?t.connection:void 0}_read(){const t=this._api();return t?{effectiveType:"string"==typeof t.effectiveType?t.effectiveType:null,downlink:"number"==typeof t.downlink?t.downlink:null,rtt:"number"==typeof t.rtt?t.rtt:null,saveData:"boolean"==typeof t.saveData?t.saveData:null,supported:!0}:o}_onChange=()=>{this._apply(this._read())};_apply(t){const e=this._snapshot;e.effectiveType===t.effectiveType&&e.downlink===t.downlink&&e.rtt===t.rtt&&e.saveData===t.saveData&&e.supported===t.supported||(this._snapshot=t,this._target.dispatchEvent(new CustomEvent("wcs-network:change",{detail:t,bubbles:!0})))}}function c(t,e){let n=Object.getPrototypeOf(t);for(;null!==n;){const t=Object.getOwnPropertyDescriptor(n,e);if(void 0!==t)return"function"==typeof t.get||"function"==typeof t.set;n=Object.getPrototypeOf(n)}return!1}class l extends HTMLElement{static hasConnectedCallbackPromise=!0;static wcBindable={...i.wcBindable,inputs:[],commands:i.wcBindable.commands};_core;_connectedCallbackPromise=Promise.resolve();_internals=null;constructor(){super(),this._core=new i(this),this._internals=this._initInternals(),this._wireStates({"wcs-network:change":t=>({"save-data":!0===t.saveData,supported:!0===t.supported})})}get debugStates(){return this._internals?[...this._internals.states]:[]}_initInternals(){try{if("function"!=typeof this.attachInternals)return null;const t=this.attachInternals();return t.states.add("wcs-probe"),t.states.delete("wcs-probe"),t}catch{return null}}_wireStates(t){if(null===this._internals)return;const e=this._internals.states;for(const[n,s]of Object.entries(t))this.addEventListener(n,t=>{const n=this.hasAttribute("debug-states");for(const[r,a]of Object.entries(s(t.detail))){try{a?e.add(r):e.delete(r)}catch{}n&&this.toggleAttribute(`data-wcs-state-${r}`,a)}})}get effectiveType(){return this._core.effectiveType}get downlink(){return this._core.downlink}get rtt(){return this._core.rtt}get saveData(){return this._core.saveData}get supported(){return this._core.supported}get connectedCallbackPromise(){return this._connectedCallbackPromise}connectedCallback(){!function(t){const e=t.constructor?.wcBindable,n=e?.inputs;if(void 0!==n)for(const e of n){const n=e.name;if(!Object.prototype.hasOwnProperty.call(t,n))continue;if(!c(t,n))continue;const s=t,r=s[n];delete s[n],s[n]=r}}(this),this.style.display="none",this._connectedCallbackPromise=this._core.observe()}disconnectedCallback(){this._core.dispose()}}function u(e){var n;e&&((n=e).tagNames&&Object.assign(t.tagNames,n.tagNames),s=null),customElements.get(r.tagNames.network)||customElements.define(r.tagNames.network,l)}export{i as NetworkCore,l as WcsNetwork,u as bootstrapNetwork,a 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/NetworkCore.ts","../src/components/Network.ts","../src/bootstrapNetwork.ts","../src/registerComponents.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n network: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n network: \"wcs-network\",\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 (partialConfig.tagNames) {\n Object.assign(_config.tagNames, partialConfig.tagNames);\n }\n frozenConfig = null;\n}\n","import { IWcBindable, WcsNetworkSnapshot } from \"../types.js\";\n\nconst UNSUPPORTED_SNAPSHOT: WcsNetworkSnapshot = Object.freeze({\n effectiveType: null,\n downlink: null,\n rtt: null,\n saveData: null,\n supported: false,\n});\n\n/**\n * Headless Network Information primitive. A thin, framework-agnostic wrapper\n * around `navigator.connection` exposed through the wc-bindable protocol.\n *\n * Unlike most wcstack IO nodes, this Core needs no `_gen` generation guard\n * (§3.4): subscribing/unsubscribing to `navigator.connection`'s `change` event\n * is fully synchronous, so there is no asynchronous probe whose stale\n * resolution could race a dispose() (docs/network-tag-design.md §5).\n *\n * `navigator.connection` is unimplemented in Firefox/Safari — unsupported is\n * the common case here, not an edge case (docs/network-tag-design.md §0). All\n * four data fields collapse to `null` and `supported` to `false` in that case.\n */\nexport class NetworkCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"effectiveType\", event: \"wcs-network:change\", getter: (e: Event) => (e as CustomEvent).detail.effectiveType },\n { name: \"downlink\", event: \"wcs-network:change\", getter: (e: Event) => (e as CustomEvent).detail.downlink },\n { name: \"rtt\", event: \"wcs-network:change\", getter: (e: Event) => (e as CustomEvent).detail.rtt },\n { name: \"saveData\", event: \"wcs-network:change\", getter: (e: Event) => (e as CustomEvent).detail.saveData },\n { name: \"supported\", event: \"wcs-network:change\", getter: (e: Event) => (e as CustomEvent).detail.supported },\n ],\n // Pure monitor: navigator.connection has no request()/action method to invoke.\n commands: [],\n };\n\n private _target: EventTarget;\n private _snapshot: WcsNetworkSnapshot = UNSUPPORTED_SNAPSHOT;\n\n // The live NetworkInformation object the `change` listener is attached to (kept\n // so dispose() can remove it precisely; not read for anything else).\n private _connection: EventTarget | null = null;\n\n // True once observe() has attached the live listener (or determined there is\n // nothing to attach to). Guards observe() so a redundant call does not\n // re-subscribe; dispose() resets it so a later observe() resumes cleanly.\n private _subscribed = false;\n\n // SSR (§3.8): no asynchronous probe to await — observe() completes\n // synchronously, 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 get effectiveType(): string | null {\n return this._snapshot.effectiveType;\n }\n\n get downlink(): number | null {\n return this._snapshot.downlink;\n }\n\n get rtt(): number | null {\n return this._snapshot.rtt;\n }\n\n get saveData(): boolean | null {\n return this._snapshot.saveData;\n }\n\n get supported(): boolean {\n return this._snapshot.supported;\n }\n\n // Lifecycle (§3.5). Idempotent: a second observe() while already subscribed\n // is a no-op (no double listener, no redundant dispatch). Synchronous overall\n // (no probe to await), so the returned promise is only for API uniformity\n // with other IO nodes.\n observe(): Promise<void> {\n if (!this._subscribed) {\n this._subscribed = true;\n const api = this._api();\n if (api) {\n this._connection = api;\n api.addEventListener(\"change\", this._onChange);\n }\n this._apply(this._read());\n }\n return this._ready;\n }\n\n dispose(): void {\n this._subscribed = false;\n if (this._connection) {\n this._connection.removeEventListener(\"change\", this._onChange);\n this._connection = null;\n }\n }\n\n // API resolution is call-time, never cached (§3.7): lets tests install/remove\n // navigator.connection freely and lets an unsupported environment be detected\n // correctly on every observe()/reading.\n private _api(): (EventTarget & { effectiveType?: string; downlink?: number; rtt?: number; saveData?: boolean }) | undefined {\n const nav = (globalThis as any).navigator;\n return typeof nav !== \"undefined\" && nav.connection ? nav.connection : undefined;\n }\n\n private _read(): WcsNetworkSnapshot {\n const c = this._api();\n if (!c) {\n return UNSUPPORTED_SNAPSHOT;\n }\n return {\n effectiveType: typeof c.effectiveType === \"string\" ? c.effectiveType : null,\n downlink: typeof c.downlink === \"number\" ? c.downlink : null,\n rtt: typeof c.rtt === \"number\" ? c.rtt : null,\n saveData: typeof c.saveData === \"boolean\" ? c.saveData : null,\n supported: true,\n };\n }\n\n private _onChange = (): void => {\n this._apply(this._read());\n };\n\n // Same-value guard (§3.3 MUST): the native `change` event already fires only\n // on a real change, but this Core still verifies field-by-field before\n // dispatching — defense in depth against a browser quirk double-firing\n // `change` with identical values.\n private _apply(next: WcsNetworkSnapshot): void {\n const prev = this._snapshot;\n if (\n prev.effectiveType === next.effectiveType &&\n prev.downlink === next.downlink &&\n prev.rtt === next.rtt &&\n prev.saveData === next.saveData &&\n prev.supported === next.supported\n ) {\n return;\n }\n this._snapshot = next;\n this._target.dispatchEvent(new CustomEvent(\"wcs-network:change\", {\n detail: next,\n // Family-wide MUST (async-io-node-guidelines.md §3.3): the event bubbles\n // from the Shell element so document-level consumers can delegate.\n bubbles: true,\n }));\n }\n}\n","import { IWcBindable } from \"../types.js\";\nimport { NetworkCore } from \"../core/NetworkCore.js\";\n\n/**\n * `<wcs-network>` — declarative Network Information API monitor.\n *\n * The smallest Shell in the batch (docs/network-tag-design.md §9): no\n * attributes at all. `navigator.connection` is a single global with nothing to\n * configure, unlike target-based nodes (`intersection`/`resize`) or\n * descriptor-based ones (`permission`).\n */\nexport class WcsNetwork extends HTMLElement {\n // SSR (§4.4): observe() completes synchronously, but the Shell still exposes\n // connectedCallbackPromise so SSR (@wcstack/server render.ts) can await it\n // uniformly across all IO nodes before snapshotting the HTML. Mirrors\n // WcsPermission.connectedCallbackPromise.\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...NetworkCore.wcBindable,\n inputs: [],\n // Core の commands をそのまま継承(単一情報源)。permission と同型。\n commands: NetworkCore.wcBindable.commands,\n };\n\n private _core: NetworkCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new NetworkCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-network:change\": (d) => ({\n \"save-data\": d.saveData === true,\n supported: d.supported === true,\n }),\n });\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\n }\n\n // --- Core delegated getters ---\n\n get effectiveType(): string | null {\n return this._core.effectiveType;\n }\n\n get downlink(): number | null {\n return this._core.downlink;\n }\n\n get rtt(): number | null {\n return this._core.rtt;\n }\n\n get saveData(): boolean | null {\n return this._core.saveData;\n }\n\n get supported(): boolean {\n return this._core.supported;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n this.style.display = \"none\";\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n this._core.dispose();\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapNetwork(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n","import { WcsNetwork } from \"./components/Network.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.network)) {\n customElements.define(config.tagNames.network, WcsNetwork);\n }\n}\n"],"names":["_config","tagNames","network","deepFreeze","obj","Object","freeze","key","keys","deepClone","clone","frozenConfig","config","getConfig","UNSUPPORTED_SNAPSHOT","effectiveType","downlink","rtt","saveData","supported","NetworkCore","EventTarget","static","protocol","version","properties","name","event","getter","e","detail","commands","_target","_snapshot","_connection","_subscribed","_ready","Promise","resolve","constructor","target","super","this","ready","observe","api","_api","addEventListener","_onChange","_apply","_read","dispose","removeEventListener","nav","globalThis","navigator","connection","undefined","c","next","prev","dispatchEvent","CustomEvent","bubbles","WcsNetwork","HTMLElement","wcBindable","inputs","_core","_connectedCallbackPromise","_internals","_initInternals","_wireStates","d","debugStates","states","attachInternals","internals","add","delete","map","toStates","entries","debug","hasAttribute","on","toggleAttribute","connectedCallbackPromise","connectedCallback","style","display","disconnectedCallback","bootstrapNetwork","userConfig","partialConfig","assign","customElements","get","define"],"mappings":"AAQA,MAAMA,EAA2B,CAC/BC,SAAU,CACRC,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AO2B,KAAK0B,MAAMrD,aACpB,CAEA,YAAIC,GACF,OAAO0B,KAAK0B,MAAMpD,QACpB,CAEA,OAAIC,GACF,OAAOyB,KAAK0B,MAAMnD,GACpB,CAEA,YAAIC,GACF,OAAOwB,KAAK0B,MAAMlD,QACpB,CAEA,aAAIC,GACF,OAAOuB,KAAK0B,MAAMjD,SACpB,CAEA,4BAAIoE,GACF,OAAO7C,KAAK2B,yBACd,CAIA,iBAAAmB,GACE9C,KAAK+C,MAAMC,QAAU,OACrBhD,KAAK2B,0BAA4B3B,KAAK0B,MAAMxB,SAC9C,CAEA,oBAAA+C,GACEjD,KAAK0B,MAAMjB,SACb,ECjHI,SAAUyC,EAAiBC,GHuC3B,IAAoBC,EGtCpBD,KHsCoBC,EGrCZD,GHsCM5F,UAChBI,OAAO0F,OAAO/F,EAAQC,SAAU6F,EAAc7F,UAEhDU,EAAe,MI3CVqF,eAAeC,IAAIrF,EAAOX,SAASC,UACtC8F,eAAeE,OAAOtF,EAAOX,SAASC,QAAS8D,EDInD"}
1
+ {"version":3,"file":"index.esm.min.js","sources":["../src/config.ts","../src/core/NetworkCore.ts","../src/protocol/upgradeProperties.ts","../src/components/Network.ts","../src/bootstrapNetwork.ts","../src/registerComponents.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n network: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n network: \"wcs-network\",\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 (partialConfig.tagNames) {\n Object.assign(_config.tagNames, partialConfig.tagNames);\n }\n frozenConfig = null;\n}\n","import { IWcBindable, WcsNetworkSnapshot } from \"../types.js\";\n\nconst UNSUPPORTED_SNAPSHOT: WcsNetworkSnapshot = Object.freeze({\n effectiveType: null,\n downlink: null,\n rtt: null,\n saveData: null,\n supported: false,\n});\n\n/**\n * Headless Network Information primitive. A thin, framework-agnostic wrapper\n * around `navigator.connection` exposed through the wc-bindable protocol.\n *\n * Unlike most wcstack IO nodes, this Core needs no `_gen` generation guard\n * (§3.4): subscribing/unsubscribing to `navigator.connection`'s `change` event\n * is fully synchronous, so there is no asynchronous probe whose stale\n * resolution could race a dispose() (docs/network-tag-design.md §5).\n *\n * `navigator.connection` is unimplemented in Firefox/Safari — unsupported is\n * the common case here, not an edge case (docs/network-tag-design.md §0). All\n * four data fields collapse to `null` and `supported` to `false` in that case.\n */\nexport class NetworkCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"effectiveType\", event: \"wcs-network:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.effectiveType },\n { name: \"downlink\", event: \"wcs-network:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.downlink },\n { name: \"rtt\", event: \"wcs-network:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.rtt },\n { name: \"saveData\", event: \"wcs-network:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.saveData },\n { name: \"supported\", event: \"wcs-network:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.supported },\n ],\n // Pure monitor: navigator.connection has no request()/action method to invoke.\n commands: [],\n };\n\n private _target: EventTarget;\n private _snapshot: WcsNetworkSnapshot = UNSUPPORTED_SNAPSHOT;\n\n // The live NetworkInformation object the `change` listener is attached to (kept\n // so dispose() can remove it precisely; not read for anything else).\n private _connection: EventTarget | null = null;\n\n // True once observe() has attached the live listener (or determined there is\n // nothing to attach to). Guards observe() so a redundant call does not\n // re-subscribe; dispose() resets it so a later observe() resumes cleanly.\n private _subscribed = false;\n\n // SSR (§3.8): no asynchronous probe to await — observe() completes\n // synchronously, 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 get effectiveType(): string | null {\n return this._snapshot.effectiveType;\n }\n\n get downlink(): number | null {\n return this._snapshot.downlink;\n }\n\n get rtt(): number | null {\n return this._snapshot.rtt;\n }\n\n get saveData(): boolean | null {\n return this._snapshot.saveData;\n }\n\n get supported(): boolean {\n return this._snapshot.supported;\n }\n\n // Lifecycle (§3.5). Idempotent: a second observe() while already subscribed\n // is a no-op (no double listener, no redundant dispatch). Synchronous overall\n // (no probe to await), so the returned promise is only for API uniformity\n // with other IO nodes.\n observe(): Promise<void> {\n if (!this._subscribed) {\n this._subscribed = true;\n const api = this._api();\n if (api) {\n this._connection = api;\n api.addEventListener(\"change\", this._onChange);\n }\n this._apply(this._read());\n }\n return this._ready;\n }\n\n dispose(): void {\n this._subscribed = false;\n if (this._connection) {\n this._connection.removeEventListener(\"change\", this._onChange);\n this._connection = null;\n }\n }\n\n // API resolution is call-time, never cached (§3.7): lets tests install/remove\n // navigator.connection freely and lets an unsupported environment be detected\n // correctly on every observe()/reading.\n private _api(): (EventTarget & { effectiveType?: string; downlink?: number; rtt?: number; saveData?: boolean }) | undefined {\n const nav = (globalThis as any).navigator;\n return typeof nav !== \"undefined\" && nav.connection ? nav.connection : undefined;\n }\n\n private _read(): WcsNetworkSnapshot {\n const c = this._api();\n if (!c) {\n return UNSUPPORTED_SNAPSHOT;\n }\n return {\n effectiveType: typeof c.effectiveType === \"string\" ? c.effectiveType : null,\n downlink: typeof c.downlink === \"number\" ? c.downlink : null,\n rtt: typeof c.rtt === \"number\" ? c.rtt : null,\n saveData: typeof c.saveData === \"boolean\" ? c.saveData : null,\n supported: true,\n };\n }\n\n private _onChange = (): void => {\n this._apply(this._read());\n };\n\n // Same-value guard (§3.3 MUST): the native `change` event already fires only\n // on a real change, but this Core still verifies field-by-field before\n // dispatching — defense in depth against a browser quirk double-firing\n // `change` with identical values.\n private _apply(next: WcsNetworkSnapshot): void {\n const prev = this._snapshot;\n if (\n prev.effectiveType === next.effectiveType &&\n prev.downlink === next.downlink &&\n prev.rtt === next.rtt &&\n prev.saveData === next.saveData &&\n prev.supported === next.supported\n ) {\n return;\n }\n this._snapshot = next;\n this._target.dispatchEvent(new CustomEvent(\"wcs-network:change\", {\n detail: next,\n // Family-wide MUST (async-io-node-guidelines.md §3.3): the event bubbles\n // from the Shell element so document-level consumers can delegate.\n bubbles: true,\n }));\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/upgrade-properties.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// custom element の property upgrade — `static wcBindable.inputs` に宣言した入力のうち、\n// 要素が upgrade される前に代入された own データプロパティを取り込み直す。\n//\n// なぜ必要か:\n// 未定義タグの要素は素の HTMLElement なので、`el.url = \"...\"` は own データプロパティを作る。\n// upgrade 後にクラスの accessor が prototype へ入っても own プロパティが優先されるため、\n// setter は二度と呼ばれず、値は要素へ届かないまま消える(エラーも警告も出ない)。\n// 常にプロパティ代入を行う framework(Angular の `[prop]`、Lit の `.prop=`、\n// Solid の `prop:`、Vue の `.prop` 修飾子)× 遅延定義(autoloader / CDN / code-split)で\n// 常態的に起きる。docs/architecture-hardening/13-framework-adapter-binding-constraints.md §1.2。\n//\n// 安全側の判定:\n// own プロパティがあっても、prototype チェーンに accessor が無ければ「シャドウ」ではなく\n// その own プロパティ自体が正規の格納先なので触らない(public class field を壊さない)。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/upgrade-properties.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/upgradeProperties.ts). Those copies are generated — do not edit them.\nimport { IWcBindable } from \"./wcBindable.js\";\n\nfunction hasAccessorOnPrototype(target: object, name: string): boolean {\n let proto = Object.getPrototypeOf(target);\n while (proto !== null) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, name);\n if (descriptor !== undefined) {\n return typeof descriptor.get === \"function\" || typeof descriptor.set === \"function\";\n }\n proto = Object.getPrototypeOf(proto);\n }\n return false;\n}\n\n/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n */\nexport function upgradeProperties(element: object): void {\n const declaration = (element as { constructor?: { wcBindable?: IWcBindable } }).constructor?.wcBindable;\n const inputs = declaration?.inputs;\n if (inputs === undefined) return;\n for (const input of inputs) {\n const name = input.name;\n if (!Object.prototype.hasOwnProperty.call(element, name)) continue;\n if (!hasAccessorOnPrototype(element, name)) continue;\n const record = element as Record<string, unknown>;\n const value = record[name];\n delete record[name];\n record[name] = value;\n }\n}\n","import { IWcBindable } from \"../types.js\";\nimport { NetworkCore } from \"../core/NetworkCore.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.js\";\n\n/**\n * `<wcs-network>` — declarative Network Information API monitor.\n *\n * The smallest Shell in the batch (docs/network-tag-design.md §9): no\n * attributes at all. `navigator.connection` is a single global with nothing to\n * configure, unlike target-based nodes (`intersection`/`resize`) or\n * descriptor-based ones (`permission`).\n */\nexport class WcsNetwork extends HTMLElement {\n // SSR (§4.4): observe() completes synchronously, but the Shell still exposes\n // connectedCallbackPromise so SSR (@wcstack/server render.ts) can await it\n // uniformly across all IO nodes before snapshotting the HTML. Mirrors\n // WcsPermission.connectedCallbackPromise.\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...NetworkCore.wcBindable,\n inputs: [],\n // Core の commands をそのまま継承(単一情報源)。permission と同型。\n commands: NetworkCore.wcBindable.commands,\n };\n\n private _core: NetworkCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new NetworkCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-network:change\": (d) => ({\n \"save-data\": d.saveData === true,\n supported: d.supported === true,\n }),\n });\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\n }\n\n // --- Core delegated getters ---\n\n get effectiveType(): string | null {\n return this._core.effectiveType;\n }\n\n get downlink(): number | null {\n return this._core.downlink;\n }\n\n get rtt(): number | null {\n return this._core.rtt;\n }\n\n get saveData(): boolean | null {\n return this._core.saveData;\n }\n\n get supported(): boolean {\n return this._core.supported;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n // upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)\n upgradeProperties(this);\n this.style.display = \"none\";\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n this._core.dispose();\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapNetwork(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n","import { WcsNetwork } from \"./components/Network.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.network)) {\n customElements.define(config.tagNames.network, WcsNetwork);\n }\n}\n"],"names":["_config","tagNames","network","deepFreeze","obj","Object","freeze","key","keys","deepClone","clone","frozenConfig","config","getConfig","UNSUPPORTED_SNAPSHOT","effectiveType","downlink","rtt","saveData","supported","NetworkCore","EventTarget","static","protocol","version","properties","name","event","semantics","getter","e","detail","commands","_target","_snapshot","_connection","_subscribed","_ready","Promise","resolve","constructor","target","super","this","ready","observe","api","_api","addEventListener","_onChange","_apply","_read","dispose","removeEventListener","nav","globalThis","navigator","connection","undefined","c","next","prev","dispatchEvent","CustomEvent","bubbles","hasAccessorOnPrototype","proto","getPrototypeOf","descriptor","getOwnPropertyDescriptor","get","set","WcsNetwork","HTMLElement","wcBindable","inputs","_core","_connectedCallbackPromise","_internals","_initInternals","_wireStates","d","debugStates","states","attachInternals","internals","add","delete","map","toStates","entries","debug","hasAttribute","on","toggleAttribute","connectedCallbackPromise","connectedCallback","element","declaration","input","prototype","hasOwnProperty","call","record","value","upgradeProperties","style","display","disconnectedCallback","bootstrapNetwork","userConfig","partialConfig","assign","customElements","define"],"mappings":"AAQA,MAAMA,EAA2B,CAC/BC,SAAU,CACRC,QAAS,gBAIb,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,EAAkBZ,WAEfa,IAId,OAHKF,IACHA,EAAeR,EAAWM,EAAUT,KAE/BW,CACT,CCvCA,MAAMG,EAA2CT,OAAOC,OAAO,CAC7DS,cAAe,KACfC,SAAU,KACVC,IAAK,KACLC,SAAU,KACVC,WAAW,IAgBP,MAAOC,UAAoBC,YAC/BC,kBAAiC,CAC/BC,SAAU,cACVC,QAAS,EACTC,WAAY,CACV,CAAEC,KAAM,gBAAiBC,MAAO,qBAAsBC,UAAW,QAASC,OAASC,GAAcA,EAAkBC,OAAOhB,eAC1H,CAAEW,KAAM,WAAYC,MAAO,qBAAsBC,UAAW,QAASC,OAASC,GAAcA,EAAkBC,OAAOf,UACrH,CAAEU,KAAM,MAAOC,MAAO,qBAAsBC,UAAW,QAASC,OAASC,GAAcA,EAAkBC,OAAOd,KAChH,CAAES,KAAM,WAAYC,MAAO,qBAAsBC,UAAW,QAASC,OAASC,GAAcA,EAAkBC,OAAOb,UACrH,CAAEQ,KAAM,YAAaC,MAAO,qBAAsB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U,OACrBhE,KAAKkC,0BAA4BlC,KAAKiC,MAAM/B,SAC9C,CAEA,oBAAA+D,GACEjE,KAAKiC,MAAMxB,SACb,ECpHI,SAAUyD,EAAiBC,GJuC3B,IAAoBC,EItCpBD,KJsCoBC,EIrCZD,GJsCM7G,UAChBI,OAAO2G,OAAOhH,EAAQC,SAAU8G,EAAc9G,UAEhDU,EAAe,MK3CVsG,eAAe3C,IAAI1D,EAAOX,SAASC,UACtC+G,eAAeC,OAAOtG,EAAOX,SAASC,QAASsE,EDInD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wcstack/network",
3
- "version": "1.22.6",
3
+ "version": "1.24.0",
4
4
  "description": "Declarative Network Information component for Web Components. Framework-agnostic navigator.connection monitor via wc-bindable-protocol.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.esm.js",