@wcstack/router 4.0.0-rc.8 → 4.0.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
@@ -357,6 +357,7 @@ declare class Router extends HTMLElement implements IRouter {
357
357
  private _notifyLocationChange;
358
358
  private _getBasename;
359
359
  get basename(): string;
360
+ set basename(value: string | null | undefined);
360
361
  private _getOutlet;
361
362
  private _getTemplate;
362
363
  get outlet(): IOutlet;
package/dist/index.esm.js CHANGED
@@ -2505,6 +2505,53 @@ function upgradeProperties(element) {
2505
2505
  }
2506
2506
  }
2507
2507
 
2508
+ // ===========================================================================
2509
+ // AUTO-GENERATED FILE - DO NOT EDIT.
2510
+ // Generated from /protocol/input-attribute.ts by scripts/sync-protocol-types.mjs.
2511
+ // Run `node scripts/sync-protocol-types.mjs` after editing the source.
2512
+ // ===========================================================================
2513
+ // 属性へ反映する wc-bindable 入力の producer 側(SPEC-extensions § Producer guidance for inputs の P1〜P3)。
2514
+ // 入力の setter は属性をこの 2 関数で書く。それで次が揃う:
2515
+ // - `undefined` は「値が無い」(P1): 属性を、この関数で最初に書く前の状態 — マークアップに書かれた値、
2516
+ // 無ければ属性なし(= その入力の文書化した既定値)— へ戻す。applier プロファイルを宣言する binder は
2517
+ // 値の後の `undefined` を書き(A2)、React 19 も書き、直接の代入でも届く。
2518
+ // - `null` はクリア(P2): 属性なし、つまり文書化した既定値。
2519
+ // - どちらも文字列 "undefined" / "null" として属性に入らない。
2520
+ //
2521
+ // 「最初に書く前」は、その最初の書き込みのときに読む(遅延)。upgrade 前に代入されたプロパティは
2522
+ // connectedCallback の upgradeProperties() が通し直すので、そのときにはパーサが書いた属性が揃っている。
2523
+ // 要素自身が setter を通さずに書いた属性は、最初の書き込みより前なら「最初の状態」に含まれる。
2524
+ //
2525
+ // SINGLE SOURCE OF TRUTH: edit only this file (/protocol/input-attribute.ts), then run
2526
+ // `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies
2527
+ // (packages/<pkg>/src/protocol/inputAttribute.ts). Those copies are generated — do not edit them.
2528
+ const initialAttributes = new WeakMap();
2529
+ /** The attribute as it stood before the first write through these helpers. */
2530
+ function initialAttribute(el, name) {
2531
+ let byName = initialAttributes.get(el);
2532
+ if (byName === undefined) {
2533
+ byName = new Map();
2534
+ initialAttributes.set(el, byName);
2535
+ }
2536
+ if (!byName.has(name))
2537
+ byName.set(name, el.getAttribute(name));
2538
+ return byName.get(name);
2539
+ }
2540
+ function writeAttribute(el, name, value) {
2541
+ if (value === null)
2542
+ el.removeAttribute(name);
2543
+ else
2544
+ el.setAttribute(name, value);
2545
+ }
2546
+ /**
2547
+ * A value attribute. `value` is written as `String(value)`; `null` removes the attribute;
2548
+ * `undefined` restores the attribute the element started with.
2549
+ */
2550
+ function reflectAttribute(el, name, value) {
2551
+ const initial = initialAttribute(el, name);
2552
+ writeAttribute(el, name, value === undefined ? initial : value === null ? null : String(value));
2553
+ }
2554
+
2508
2555
  /**
2509
2556
  * SSR モード判定。@wcstack/server の renderToString がレンダリング中の document
2510
2557
  * 要素へ `data-wcs-server` 属性を設定する。state 側(packages/state/src/config.ts の
@@ -2693,9 +2740,18 @@ class Router extends HTMLElement {
2693
2740
  }
2694
2741
  return this._normalizeBasename(path);
2695
2742
  }
2743
+ // 使われている basename(初期化で確定。初期化前は "")。
2696
2744
  get basename() {
2697
2745
  return this._basename;
2698
2746
  }
2747
+ // `basename` は input(wcBindable.inputs)。値は basename 属性に書き、初期化(_initialize)が一度だけ
2748
+ // 読む — 初期化の後に書いても、ルーティングの基準は変わらない(属性を直接書き換えたときと同じ)。
2749
+ // undefined は最初の属性へ戻し、null は属性を外す(wc-bindable の producer ガイダンス P1 / P2)。
2750
+ // setter が無いと、プロパティへの代入(state 4.0 の書き込み、upgrade 前の代入の取り込み直し)が
2751
+ // TypeError になり、後者では connectedCallbackPromise が決着しなくなる。
2752
+ set basename(value) {
2753
+ reflectAttribute(this, "basename", value);
2754
+ }
2699
2755
  _getOutlet() {
2700
2756
  // 自身を起点に兄弟・子孫から Outlet を探す(マルチ Router 対応)
2701
2757
  const next = this.nextElementSibling;
@@ -4036,7 +4092,7 @@ function bootstrapRouter(config, registry) {
4036
4092
  registerComponents(registry);
4037
4093
  }
4038
4094
 
4039
- var version = "4.0.0-rc.8";
4095
+ var version = "4.0.0";
4040
4096
  var pkg = {
4041
4097
  version: version};
4042
4098