@wcstack/pointer-lock 4.24.2 → 4.26.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 +53 -8
- package/README.md +53 -8
- package/dist/auto.min.js +1 -1
- package/dist/auto.min.js.map +1 -1
- package/dist/index.d.ts +21 -1
- package/dist/index.esm.js +126 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
`@wcstack/state` と組み合わせると、`<wcs-pointer-lock>` はパス契約で直接バインドできます:
|
|
11
11
|
|
|
12
12
|
- **入力サーフェス**: `target`
|
|
13
|
-
- **出力 state サーフェス**: `active`、`error`、`errorInfo`
|
|
13
|
+
- **出力 state サーフェス**: `active`、`error`、`errorInfo`、`supported`
|
|
14
14
|
- **コマンド**: `requestPointerLock`、`exitPointerLock`
|
|
15
15
|
|
|
16
16
|
`@wcstack/pointer-lock` は [CSBC](https://github.com/csbc-dev/arch/blob/main/README.md)(Core / Shell / Binding Contract)アーキテクチャに従います:
|
|
17
17
|
|
|
18
18
|
- **Core**(`PointerLockCore`)が `Element.requestPointerLock()` / `document.exitPointerLock()` / `document.pointerLockElement` をラップし、`document`単位で発火する `pointerlockchange` イベントを自身が解決した target と自己判定でフィルタする
|
|
19
19
|
- **Shell**(`<wcs-pointer-lock target="...">`)がDOMから「どの要素を操作するか」を解決し、display とライフサイクルを管理
|
|
20
|
-
- **Binding Contract**(`static wcBindable`)が観測可能な `active` / `error` / `errorInfo` プロパティと `requestPointerLock`/`exitPointerLock` コマンドを宣言
|
|
20
|
+
- **Binding Contract**(`static wcBindable`)が観測可能な `active` / `error` / `errorInfo` / `supported` プロパティと `requestPointerLock`/`exitPointerLock` コマンドを宣言
|
|
21
21
|
|
|
22
22
|
## 用途が限定的なノード — 使う前に必ず読んでください
|
|
23
23
|
|
|
@@ -81,13 +81,25 @@ npm install @wcstack/pointer-lock
|
|
|
81
81
|
|
|
82
82
|
`Element.requestPointerLock()` はuser gesture文脈(同期的なクリックハンドラ等)の外から呼ばれると `NotAllowedError` で reject します。本ノードは自らgestureを生成できません。**実際のuser gesture内から`requestPointerLock`を呼ぶ責務は呼び出し元にあります。** command-token プロトコル(`<wcs-pointer-lock>`上の`command.requestPointerLock: $command.<token>`、ボタンの`onclick: $command.<token>`が発行する)を配線してください — `setTimeout`内や`.then()`チェーンの奥から呼ぶとgesture文脈を失い呼び出しがrejectされますが、例外は伝播しません(never-throw、`error`に格納されます)。
|
|
83
83
|
|
|
84
|
+
### イベントで届く拒否(`pointerlockerror`)
|
|
85
|
+
|
|
86
|
+
4.25 から。断られた要求の知らせ方は、ブラウザによって違います:
|
|
87
|
+
|
|
88
|
+
- **Chromium と WebKit** は `requestPointerLock()` から promise を返し、それを reject します。その reject が、ブラウザ自身の理由とともに `error` になります — `allow-pointer-lock` の無い sandbox の `<iframe>` では `SecurityError`、WebKit の `WrongDocumentError`(`"Pointer lock requires the window to have focus."`)など。
|
|
89
|
+
- **Firefox** は `requestPointerLock()` から何も返しません。拒否がページに届くのは、document の `pointerlockerror` イベントだけです。`<wcs-pointer-lock>` は接続されている間これを聞き(ブラウザが持つ名前が `webkitpointerlockerror` ならそちらを聞き)、promise を返さなかった呼び出しでこの要素が出した要求に対して発火したとき、`error` を `NotAllowedError` の `DOMException` — `"The browser refused the pointer lock request."`、`errorInfo.code` は `not-allowed`、`recoverable: true` — にします。イベントは理由を運ばない(Firefox はコンソールに書きます)ので、ブラウザが何を理由に断ったとしても、メッセージはそれ以上を言いません。
|
|
90
|
+
|
|
91
|
+
そのため Firefox では、エラーはコマンドの promise が決着した**後**に届きます。`await el.requestPointerLock(); el.error` は、そこではまだ `null` です。`await` の直後に読むのではなく、`error` / `errorInfo` をバインドしてください。4.24 までは、Firefox では何も報告されませんでした。`error` は `null` のままで、ページは何も言えませんでした。
|
|
92
|
+
|
|
93
|
+
promise を返した呼び出しの要求には、その promise だけが答えます — Chromium と WebKit も同じ拒否について `pointerlockerror` を発火し、WebKit は promise を reject する前に発火することがあります — ので、1 つの拒否を 2 回報告することはありません。イベントは誰の要求が失敗したかを言いません。この要素の要求が答えを待っていないときのイベントは別のインスタンスのもので、無視します。
|
|
94
|
+
|
|
84
95
|
## 観測可能プロパティ(出力)
|
|
85
96
|
|
|
86
97
|
| プロパティ | イベント | 説明 |
|
|
87
98
|
| ----------- | -------------------------------------- | ------------ |
|
|
88
|
-
| `active` | `wcs-pointer-lock:change` | `document.pointerLockElement` がこのインスタンスの解決済み target と一致していれば `true`、それ以外は `false`。 |
|
|
89
|
-
| `error` | `wcs-pointer-lock:error` | 直近の失敗、または `null`。次のいずれか: rejectされたPromise(gesture外呼び出しなら`NotAllowedError`等)、プラットフォームAPI非対応なら`{ message: "Pointer Lock API is not supported." }`、`target`が要素へ未解決なら`{ message: "Pointer Lock target could not be resolved." }`。直近の呼び出しが成功済み・まだ何も失敗していない場合は`null`。 |
|
|
99
|
+
| `active` | `wcs-pointer-lock:change` | `document.pointerLockElement` がこのインスタンスの解決済み target と一致していれば `true`、それ以外は `false`。4.25 から、要素が文書の外にある間も `false`([要素が文書を離れるとき](#要素が文書を離れるとき)参照)。 |
|
|
100
|
+
| `error` | `wcs-pointer-lock:error` | 直近の失敗、または `null`。次のいずれか: rejectされたPromise(gesture外呼び出しなら`NotAllowedError`等)、プラットフォームAPI非対応なら`{ message: "Pointer Lock API is not supported." }`、`target`が要素へ未解決なら`{ message: "Pointer Lock target could not be resolved." }`。直近の呼び出しが成功済み・まだ何も失敗していない場合は`null`。4.25 から、ブラウザがイベントでしか知らせない拒否 — Firefox — は `NotAllowedError` の `DOMException`(`"The browser refused the pointer lock request."`)になる(上記参照)。 |
|
|
90
101
|
| `errorInfo` | `wcs-pointer-lock:error-info-changed` | `error` から導出される追加のシリアライズ可能な失敗タクソノミ `{ code, phase, recoverable, message }`、または `null`。下記参照。 |
|
|
102
|
+
| `supported` | `wcs-pointer-lock:supported-changed` | 4.25 から。ブラウザに Pointer Lock API があれば `true`、無ければ `false`。イベントの `detail` は boolean そのもの。下記参照。 |
|
|
91
103
|
|
|
92
104
|
`error` と `errorInfo` は **どちらも観測可能な event-backed の `wcBindable` property** です。(`error` はかつて独自イベントを持たない命令的 getter でしたが、現在はそうではありません。)wc-bindable バインディングコアが request/exit の失敗をリアクティブに配信するようになったため、コマンドが settle するたびに `element.error` をポーリングするのではなく `data-wcs` / `bind()` でバインドできます。`error` の **値の形状は不変** で、`errorInfo` は追加のシリアライズ可能な分類です。
|
|
93
105
|
|
|
@@ -99,11 +111,34 @@ npm install @wcstack/pointer-lock
|
|
|
99
111
|
| -------------------- | --------- | ------------- | ----- |
|
|
100
112
|
| `capability-missing` | `probe` | `false` | Pointer Lock API 非対応(標準名・レガシー名のどちらも存在しない) |
|
|
101
113
|
| `invalid-argument` | `start` | `false` | `target` が要素へ未解決 |
|
|
102
|
-
| `not-allowed` | `execute` | `true` | `NotAllowedError` / `TypeError` — user gesture 外での呼び出し。実際の gesture
|
|
114
|
+
| `not-allowed` | `execute` | `true` | `NotAllowedError` / `TypeError` — user gesture 外での呼び出し。実際の gesture 内で再試行すれば成功しうる。4.25 から、`pointerlockerror` イベントで届いた拒否(Firefox)もすべてここ。理由は分からない |
|
|
103
115
|
| `pointer-lock-error` | `execute` | `false` | その他の caught 例外 |
|
|
104
116
|
|
|
105
117
|
安定した `code` 値は `WCS_POINTER_LOCK_ERROR_CODE` として export されます。共有の `WcsIoErrorInfo` / `WcsIoErrorPhase` 型も本パッケージから再 export されます。
|
|
106
118
|
|
|
119
|
+
### `supported` — このページに pointer lock があるか
|
|
120
|
+
|
|
121
|
+
4.25 から。`supported` は、ブラウザに Pointer Lock API があるときに `true` です: 要素に `requestPointerLock()`(または接頭辞付きの `webkitRequestPointerLock()`)がある場合です。それ以外は `false` です — たとえば iPhone の Safari。
|
|
122
|
+
|
|
123
|
+
要求が通ることも、マウスがつながっていることも言いません。要求にはやはり user gesture が要り、sandbox の `<iframe>` には `allow-pointer-lock` が要ります。pointer lock を扱う Permissions-Policy は無いので、要素が前もって聞けるものはありません。そうしたフレームは `true` を報告し、要求は断られます(`error`)。
|
|
124
|
+
|
|
125
|
+
値は聞かれるたびにブラウザから読みます(キャッシュしません)。だからバインディングは、付いた時点で正しい値を得ます。要素は接続されたとき、最後に発火した値と違えば `wcs-pointer-lock:supported-changed` も発火します(最初は `false` なので、API のあるブラウザでは `true` が 1 回届きます)。ボタンは、使えるところでだけ出します:
|
|
126
|
+
|
|
127
|
+
```html
|
|
128
|
+
<wcs-state>
|
|
129
|
+
<script type="module">
|
|
130
|
+
export default {
|
|
131
|
+
$commandTokens: ["lockPointer"],
|
|
132
|
+
lockSupported: false,
|
|
133
|
+
};
|
|
134
|
+
</script>
|
|
135
|
+
</wcs-state>
|
|
136
|
+
|
|
137
|
+
<canvas id="scene" width="640" height="480"></canvas>
|
|
138
|
+
<wcs-pointer-lock target="#scene" data-wcs="supported: lockSupported; command.requestPointerLock: $command.lockPointer"></wcs-pointer-lock>
|
|
139
|
+
<button data-wcs="hidden: lockSupported|not; onclick: $command.lockPointer">マウスルックを有効化</button>
|
|
140
|
+
```
|
|
141
|
+
|
|
107
142
|
## コマンド
|
|
108
143
|
|
|
109
144
|
| コマンド | Async | 説明 |
|
|
@@ -139,7 +174,8 @@ wcs-pointer-lock:state(active) ~ .crosshair { display: none; } /* デフォル
|
|
|
139
174
|
入力と混同される心配がありません。`error` / `errorInfo` は `:state()` には**反映していません**。
|
|
140
175
|
これらは観測可能な `wcBindable` property ですが(上記「観測可能プロパティ」参照)、失敗オブジェクトは
|
|
141
176
|
真偽値の CSS ステートではないため、`:state()` に配線されるのは `active` のみです。
|
|
142
|
-
`error` / `errorInfo` は `data-wcs` / `bind()`
|
|
177
|
+
`error` / `errorInfo` は `data-wcs` / `bind()` で観測してください。`supported` も
|
|
178
|
+
反映しません。バインドしてください(`supported: lockSupported`)。
|
|
143
179
|
|
|
144
180
|
**対応ブラウザ**(新構文 `:state(x)`): Chrome/Edge 125+、Safari 17.4+、Firefox 126+。
|
|
145
181
|
非対応の環境ではステートが一切 set されないだけです — `:state()` セレクタがマッチしなく
|
|
@@ -174,13 +210,20 @@ wcs-pointer-lock:state(active) ~ .crosshair { display: none; } /* デフォル
|
|
|
174
210
|
|
|
175
211
|
`document.pointerLockElement` はdocument全体で単一の値しか持ちません(同時にロックできる要素は高々1つ)。複数の`<wcs-pointer-lock>`インスタンス(例: `target="#a"`と`target="#b"`)が同時に存在する場合、各インスタンスは`document.pointerLockElement`を**自分自身の**解決済みtargetと比較します(単に「documentがロック中か」ではありません)。`#a`をロックすると、`target="#a"`のインスタンスは`active: true`、`target="#b"`のインスタンスは`active: false`を報告します — document全体では何か(`#a`)がロックされているにもかかわらずです。
|
|
176
212
|
|
|
213
|
+
## 要素が文書を離れるとき
|
|
214
|
+
|
|
215
|
+
4.25 から。`<wcs-pointer-lock>` が document を聞いているのは、接続されている間だけです。`active` が `true` の間に切断されると — `if:` の枝が消える、`@wcstack/router` がルートの本文を取り外す — `active: false` を `wcs-pointer-lock:change` イベントとともに公開します。バインドした state のパスも `:state(active)` もそれに従います。文書の外にある要素は、その値をもう保証できないからです。ロック自体は**解きません**。再び接続されると本当の値を読み直し、target がまだロックされていれば `active` はイベントとともに `true` に戻ります。そのため、移動された(取り外して入れ直された)要素は `false`、`true` の順に報告します。4.24 までは切断しても `active` がそのまま残り、ロックが解けた後も state は `true` を示し続けていました。
|
|
216
|
+
|
|
217
|
+
ロックをどうするかはブラウザが決めます。**ロックされている要素が文書から取り除かれると、ブラウザはロックを解きます。** ルートの本文の中にある target はルートとともに去り、ロックもそこで終わります。ナビゲーションをまたいでポインタをロックしたままにするには、target — とその `<wcs-pointer-lock>` — をルーターの外、残り続けるレイアウトの側に置きます([router README — ルートの本文はどこに置くか](../router/README.ja.md#ルートの本文はどこに置くか))。target だけを外に置き `<wcs-pointer-lock>` をルートの中に置いた場合、ロックは続きますが、`active` はそのルートを離れている間 `false` で、戻ると `true` に戻ります。
|
|
218
|
+
|
|
177
219
|
## ベンダープレフィックス
|
|
178
220
|
|
|
179
|
-
一部の古いWebKit実装は標準名の代わりに`webkitRequestPointerLock`/`webkitExitPointerLock`/`webkitPointerLockElement`/`
|
|
221
|
+
一部の古いWebKit実装は標準名の代わりに`webkitRequestPointerLock`/`webkitExitPointerLock`/`webkitPointerLockElement`と、`webkitpointerlockchange`/`webkitpointerlockerror`イベントを公開します。API解決は**呼び出し時**(キャッシュしない)に行われ、標準名を優先し、無ければレガシー名にフォールバックします — これにより非対応環境(どちらの名前も存在しない)を正しく検出でき、テストがAPIを自由にinstall/removeできます。
|
|
180
222
|
|
|
181
223
|
## 注意・制限
|
|
182
224
|
|
|
183
225
|
- **user gesture が必須。** 上記参照 — プラットフォームの制約であり、本ノードで回避する手段はありません。
|
|
226
|
+
- **Firefox では、拒否はコマンドが決着した後にイベントで届く。** `await` の後に読むのではなく `error` をバインドしてください — 上記「イベントで届く拒否」参照。
|
|
184
227
|
- **`exitPointerLock()`は同期API**、`@wcstack/fullscreen`のPromiseベースの`exitFullscreen()`とは異なります。単独の`_gen`世代ガードは持ちません(非同期の`requestPointerLock()`のみがガードを必要とします)。それでも非準拠実装が例外を投げないよう防御的に`try/catch`で包んでいます。
|
|
185
228
|
- **`movementX`/`movementY`はv1ではスコープ外。** 上記参照。
|
|
186
229
|
- **autoTriggerなし。** `requestPointerLock()`はuser gesture文脈を必要とするため、主な起動経路は`data-*target`のクリックショートカットではなくcommand-tokenプロトコル(`<wcs-pointer-lock>`上の`command.requestPointerLock: $command.<token>`)です。
|
|
@@ -205,9 +248,11 @@ console.log(lock.active, lock.error);
|
|
|
205
248
|
|
|
206
249
|
// 後始末:
|
|
207
250
|
lock.exitPointerLock(); // 同期的
|
|
208
|
-
lock.dispose(); // document
|
|
251
|
+
lock.dispose(); // document のリスナーを外す
|
|
209
252
|
```
|
|
210
253
|
|
|
254
|
+
4.25 から、`dispose()` は `active` が `true` だったとき `active: false` を公開し(dispose した Core はもう document を聞いていません)、次の `observe(element)` が読み直します。`lock.supported` と、`observe()` が発火する `wcs-pointer-lock:supported-changed` イベントは、ブラウザに API があるかを伝えます。Firefox では、`lock.error` は `requestPointerLock()` が resolve した後に、document の `pointerlockerror` イベントで立ちます。
|
|
255
|
+
|
|
211
256
|
Core の構造サーフェスは wcstack I/O ノード横断の規範です([async-io-node-guidelines §3.9](../../docs/async-io-node-guidelines.ja.md))。要素なしで signals に束縛するには [@wcstack/signals — Core を直接束縛する](../signals/README.ja.md#core-を直接束縛する要素なし) を参照。
|
|
212
257
|
|
|
213
258
|
## アクセシビリティ
|
package/README.md
CHANGED
|
@@ -10,14 +10,14 @@ It is an **async primitive node** that turns the Pointer Lock API's lock state i
|
|
|
10
10
|
With `@wcstack/state`, `<wcs-pointer-lock>` can be bound directly through path contracts:
|
|
11
11
|
|
|
12
12
|
- **input surface**: `target`
|
|
13
|
-
- **output state surface**: `active`, `error`, `errorInfo`
|
|
13
|
+
- **output state surface**: `active`, `error`, `errorInfo`, `supported`
|
|
14
14
|
- **commands**: `requestPointerLock`, `exitPointerLock`
|
|
15
15
|
|
|
16
16
|
`@wcstack/pointer-lock` follows the [CSBC](https://github.com/csbc-dev/arch/blob/main/README.md) (Core / Shell / Binding Contract) architecture:
|
|
17
17
|
|
|
18
18
|
- **Core** (`PointerLockCore`) wraps `Element.requestPointerLock()` / `document.exitPointerLock()` / `document.pointerLockElement`, self-filtering the `document`-scoped `pointerlockchange` event against its own resolved target
|
|
19
19
|
- **Shell** (`<wcs-pointer-lock target="...">`) resolves *which* element to operate on from the DOM, manages display and lifecycle
|
|
20
|
-
- **Binding Contract** (`static wcBindable`) declares the observable `active` / `error` / `errorInfo` properties and the `requestPointerLock`/`exitPointerLock` commands
|
|
20
|
+
- **Binding Contract** (`static wcBindable`) declares the observable `active` / `error` / `errorInfo` / `supported` properties and the `requestPointerLock`/`exitPointerLock` commands
|
|
21
21
|
|
|
22
22
|
## A narrow-purpose node — read this before reaching for it
|
|
23
23
|
|
|
@@ -81,13 +81,25 @@ Every bound state path must be declared up front — `locked: false` here; bindi
|
|
|
81
81
|
|
|
82
82
|
`Element.requestPointerLock()` rejects with `NotAllowedError` when called outside a user-gesture context (e.g. a synchronous click handler). This node cannot manufacture a gesture on your behalf: **the responsibility for calling `requestPointerLock` from within an actual user gesture belongs to the caller.** Wire the command-token protocol (`command.requestPointerLock: $command.<token>` on `<wcs-pointer-lock>`, emitted by a button's `onclick: $command.<token>`) — calling it from a `setTimeout` or deep inside a `.then()` chain loses the gesture context and the call will reject, `error` will be set, but no exception will propagate (never-throw).
|
|
83
83
|
|
|
84
|
+
### A refusal that arrives as an event (`pointerlockerror`)
|
|
85
|
+
|
|
86
|
+
Since 4.25. Browsers do not report a refused request the same way:
|
|
87
|
+
|
|
88
|
+
- **Chromium and WebKit** return a promise from `requestPointerLock()` and reject it. The rejection is the `error`, with the browser's own reason — a `SecurityError` in a sandboxed `<iframe>` without `allow-pointer-lock`, WebKit's `WrongDocumentError` (`"Pointer lock requires the window to have focus."`).
|
|
89
|
+
- **Firefox** returns nothing from `requestPointerLock()`. A refusal reaches the page only as the document's `pointerlockerror` event. `<wcs-pointer-lock>` listens for it while connected (and for `webkitpointerlockerror` where that is the name the browser has), and when it fires for a request this element made with a call that returned no promise, `error` becomes a `NotAllowedError` `DOMException` — `"The browser refused the pointer lock request."`, `errorInfo.code` `not-allowed`, `recoverable: true`. The event carries no reason (Firefox writes it to the console), so the message says no more, whatever made the browser refuse.
|
|
90
|
+
|
|
91
|
+
In Firefox the error therefore arrives **after** the command's promise has settled: `await el.requestPointerLock(); el.error` still reads `null` there. Bind `error` / `errorInfo` instead of reading them right after `await`. Up to 4.24 nothing was reported in Firefox at all: `error` stayed `null` and the page could say nothing.
|
|
92
|
+
|
|
93
|
+
A request whose call returned a promise is answered by that promise alone — Chromium and WebKit fire `pointerlockerror` for the same refusal too, WebKit sometimes before it rejects the promise — so one refusal is never reported twice. The event does not say whose request failed: with no request of this element waiting for an answer, it is another instance's, and is ignored.
|
|
94
|
+
|
|
84
95
|
## Observable Properties (outputs)
|
|
85
96
|
|
|
86
97
|
| Property | Event | Description |
|
|
87
98
|
| ----------- | -------------------------------------- | ------------ |
|
|
88
|
-
| `active` | `wcs-pointer-lock:change` | `true` when `document.pointerLockElement` is this instance's resolved target, `false` otherwise. |
|
|
89
|
-
| `error` | `wcs-pointer-lock:error` | The most recent failure, or `null`. One of: a rejected promise (e.g. `NotAllowedError` for a gesture-less call), `{ message: "Pointer Lock API is not supported." }` when the platform API is missing, `{ message: "Pointer Lock target could not be resolved." }` when `target` did not resolve to an element, or `null` if the last attempt succeeded / nothing has failed yet. |
|
|
99
|
+
| `active` | `wcs-pointer-lock:change` | `true` when `document.pointerLockElement` is this instance's resolved target, `false` otherwise. Since 4.25, also `false` while the element is out of the document (see [When the element leaves the document](#when-the-element-leaves-the-document)). |
|
|
100
|
+
| `error` | `wcs-pointer-lock:error` | The most recent failure, or `null`. One of: a rejected promise (e.g. `NotAllowedError` for a gesture-less call), `{ message: "Pointer Lock API is not supported." }` when the platform API is missing, `{ message: "Pointer Lock target could not be resolved." }` when `target` did not resolve to an element, or `null` if the last attempt succeeded / nothing has failed yet. Since 4.25, also a `NotAllowedError` `DOMException` (`"The browser refused the pointer lock request."`) for a refusal the browser reports only as an event — Firefox (see above). |
|
|
90
101
|
| `errorInfo` | `wcs-pointer-lock:error-info-changed` | Additive serializable failure taxonomy derived from `error` — `{ code, phase, recoverable, message }` — or `null`. See below. |
|
|
102
|
+
| `supported` | `wcs-pointer-lock:supported-changed` | Since 4.25. `true` when the browser has the Pointer Lock API; `false` otherwise. The event's `detail` is the boolean. See below. |
|
|
91
103
|
|
|
92
104
|
`error` and `errorInfo` are **both observable, event-backed `wcBindable` properties**. (`error` was historically an imperative getter with no event of its own — that is no longer the case.) A wc-bindable binding core now delivers a request/exit failure reactively, so you can bind it with `data-wcs` / `bind()` rather than polling `element.error` after each command settles. The `error` **value shape is unchanged**; `errorInfo` is the additive serializable classification.
|
|
93
105
|
|
|
@@ -99,11 +111,34 @@ Every bound state path must be declared up front — `locked: false` here; bindi
|
|
|
99
111
|
| -------------------- | --------- | ------------- | ----- |
|
|
100
112
|
| `capability-missing` | `probe` | `false` | Pointer Lock API is unsupported (neither standard nor legacy name present) |
|
|
101
113
|
| `invalid-argument` | `start` | `false` | `target` did not resolve to an element |
|
|
102
|
-
| `not-allowed` | `execute` | `true` | `NotAllowedError` / `TypeError` — called outside a user gesture; retrying inside a real gesture can succeed |
|
|
114
|
+
| `not-allowed` | `execute` | `true` | `NotAllowedError` / `TypeError` — called outside a user gesture; retrying inside a real gesture can succeed. Since 4.25, also every refusal that arrived as a `pointerlockerror` event (Firefox), whose reason is not known |
|
|
103
115
|
| `pointer-lock-error` | `execute` | `false` | any other caught exception |
|
|
104
116
|
|
|
105
117
|
The stable `code` values are exported as `WCS_POINTER_LOCK_ERROR_CODE`; the shared `WcsIoErrorInfo` / `WcsIoErrorPhase` types are re-exported from this package.
|
|
106
118
|
|
|
119
|
+
### `supported` — does this page have pointer lock?
|
|
120
|
+
|
|
121
|
+
Since 4.25. `supported` is `true` when the browser has the Pointer Lock API: an element has `requestPointerLock()` (or the prefixed `webkitRequestPointerLock()`). It is `false` otherwise — Safari on an iPhone, for one.
|
|
122
|
+
|
|
123
|
+
It does not say that a request will succeed, nor that a mouse is attached. A request still needs a user gesture, and a sandboxed `<iframe>` needs `allow-pointer-lock`: no Permissions-Policy covers pointer lock, so there is nothing the element could ask beforehand, and such a frame reports `true` and then refuses the request (`error`).
|
|
124
|
+
|
|
125
|
+
The value is read from the browser each time it is asked for (never cached), so a binding gets the right value when it attaches. The element also dispatches `wcs-pointer-lock:supported-changed` when it is connected, if the value differs from the last one it dispatched (it starts at `false`, so a browser with the API hears `true` once). Offer the button only where it can work:
|
|
126
|
+
|
|
127
|
+
```html
|
|
128
|
+
<wcs-state>
|
|
129
|
+
<script type="module">
|
|
130
|
+
export default {
|
|
131
|
+
$commandTokens: ["lockPointer"],
|
|
132
|
+
lockSupported: false,
|
|
133
|
+
};
|
|
134
|
+
</script>
|
|
135
|
+
</wcs-state>
|
|
136
|
+
|
|
137
|
+
<canvas id="scene" width="640" height="480"></canvas>
|
|
138
|
+
<wcs-pointer-lock target="#scene" data-wcs="supported: lockSupported; command.requestPointerLock: $command.lockPointer"></wcs-pointer-lock>
|
|
139
|
+
<button data-wcs="hidden: lockSupported|not; onclick: $command.lockPointer">Enable mouse look</button>
|
|
140
|
+
```
|
|
141
|
+
|
|
107
142
|
## Commands
|
|
108
143
|
|
|
109
144
|
| Command | Async | Description |
|
|
@@ -140,7 +175,8 @@ element, so there is no risk of confusing this output state with an input.
|
|
|
140
175
|
`error` / `errorInfo` are **not** reflected onto `:state()`: they are observable
|
|
141
176
|
`wcBindable` properties (see "Observable Properties" above), but a failure object
|
|
142
177
|
is not a boolean CSS state, so only `active` is wired to `:state()`. Observe
|
|
143
|
-
`error` / `errorInfo` via `data-wcs` / `bind()` instead.
|
|
178
|
+
`error` / `errorInfo` via `data-wcs` / `bind()` instead. `supported` is not
|
|
179
|
+
reflected either: bind it (`supported: lockSupported`).
|
|
144
180
|
|
|
145
181
|
**Browser support** (`:state(x)` syntax): Chrome/Edge 125+, Safari 17.4+,
|
|
146
182
|
Firefox 126+. In older browsers the states are simply never set — `:state()`
|
|
@@ -177,13 +213,20 @@ DevTools open; it is not a supported styling hook.
|
|
|
177
213
|
|
|
178
214
|
`document.pointerLockElement` is a single document-wide value — at most one element can be locked at a time. When several `<wcs-pointer-lock>` instances exist simultaneously (e.g. `target="#a"` and `target="#b"`), each instance compares `document.pointerLockElement` against **its own** resolved target, not merely "is the document locked". Locking `#a` makes the `target="#a"` instance report `active: true` and the `target="#b"` instance report `active: false` — even though *some* element (`#a`) is locked document-wide.
|
|
179
215
|
|
|
216
|
+
## When the element leaves the document
|
|
217
|
+
|
|
218
|
+
Since 4.25. `<wcs-pointer-lock>` listens to the document only while it is connected. When it is disconnected while `active` is `true` — an `if:` branch that goes away, a route's content that `@wcstack/router` takes out — it publishes `active: false`, with its `wcs-pointer-lock:change` event, so a bound state path and `:state(active)` follow: an element that is out of the document can no longer vouch for the value. It does **not** release the lock. When it is connected again it reads the truth: if its target is still locked, `active` goes back to `true`, with the event. An element that is moved (taken out and put back) therefore reports `false`, then `true`. Up to 4.24 a disconnect left `active` as it was, and state kept showing `true` after the lock was gone.
|
|
219
|
+
|
|
220
|
+
What the browser does with the lock is its own: **when the locked element is removed from the document, the browser releases the lock.** A target inside a route's content leaves with the route, and the lock ends there. To keep the pointer locked across a navigation, put the target — and its `<wcs-pointer-lock>` — outside the router, next to the layout that stays ([router README — Where route content lives](../router/README.md#where-route-content-lives)). With only the target outside and the `<wcs-pointer-lock>` inside a route, the lock goes on, but `active` is `false` while that route is away and `true` again when it comes back.
|
|
221
|
+
|
|
180
222
|
## Vendor prefixes
|
|
181
223
|
|
|
182
|
-
Some older WebKit builds expose `webkitRequestPointerLock` / `webkitExitPointerLock` / `webkitPointerLockElement` / the `webkitpointerlockchange`
|
|
224
|
+
Some older WebKit builds expose `webkitRequestPointerLock` / `webkitExitPointerLock` / `webkitPointerLockElement` / the `webkitpointerlockchange` and `webkitpointerlockerror` events instead of the standard names. API resolution happens **at call time** (never cached), probing the standard name first and falling back to the legacy name — this lets an unsupported environment (neither name present) be detected correctly and lets tests install/remove the API freely.
|
|
183
225
|
|
|
184
226
|
## Notes & limitations
|
|
185
227
|
|
|
186
228
|
- **User gesture required.** See above — this is a platform constraint, not something this node can work around.
|
|
229
|
+
- **In Firefox a refusal arrives as an event, after the command has settled.** Bind `error` rather than reading it after `await` — see "A refusal that arrives as an event" above.
|
|
187
230
|
- **`exitPointerLock()` is synchronous**, unlike `@wcstack/fullscreen`'s Promise-based `exitFullscreen()`. It carries no `_gen` generation guard of its own (only `requestPointerLock()`, being asynchronous, needs one); it is still wrapped in `try/catch` defensively so a non-conformant implementation can never throw out of it.
|
|
188
231
|
- **`movementX`/`movementY` are out of scope for v1.** See above.
|
|
189
232
|
- **No autoTrigger.** Because `requestPointerLock()` needs a user-gesture context, the primary activation path is the command-token protocol (`command.requestPointerLock: $command.<token>` on `<wcs-pointer-lock>`) rather than a `data-*target` click shortcut.
|
|
@@ -208,9 +251,11 @@ console.log(lock.active, lock.error);
|
|
|
208
251
|
|
|
209
252
|
// later, when done:
|
|
210
253
|
lock.exitPointerLock(); // synchronous
|
|
211
|
-
lock.dispose(); // detach the document
|
|
254
|
+
lock.dispose(); // detach the document listeners
|
|
212
255
|
```
|
|
213
256
|
|
|
257
|
+
Since 4.25, `dispose()` publishes `active: false` when it was `true` (a disposed Core no longer hears the document) and the next `observe(element)` reads it again. `lock.supported`, and the `wcs-pointer-lock:supported-changed` event `observe()` dispatches, say whether the browser has the API. In Firefox `lock.error` is set by the document's `pointerlockerror` event, after `requestPointerLock()` has resolved.
|
|
258
|
+
|
|
214
259
|
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).
|
|
215
260
|
|
|
216
261
|
## Accessibility
|
package/dist/auto.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e={tagNames:{pointerLock:"wcs-pointer-lock"}};var t="@wcstack/pointer-lock",r="4.
|
|
1
|
+
const e={tagNames:{pointerLock:"wcs-pointer-lock"}};var t="@wcstack/pointer-lock",r="4.26.0";const n="capability-missing",o="invalid-argument",s="not-allowed",i="pointer-lock-error";function c(e,t){const r=function(e){return"string"==typeof e?.message?e.message:String(e)}(e);if("capability-missing"===t)return{code:n,phase:"probe",recoverable:!1,message:r};if("invalid-argument"===t)return{code:o,phase:"start",recoverable:!1,message:r};const c=e?.name;return"NotAllowedError"===c||"TypeError"===c?{code:s,phase:"execute",recoverable:!0,message:r}:{code:i,phase:"execute",recoverable:!1,message:r}}function a(){return new DOMException("The browser refused the pointer lock request.","NotAllowedError")}class l extends EventTarget{static wcBindable={protocol:"wc-bindable",version:1,properties:[{name:"active",event:"wcs-pointer-lock:change",semantics:"state"},{name:"error",event:"wcs-pointer-lock:error",semantics:"state"},{name:"errorInfo",event:"wcs-pointer-lock:error-info-changed",semantics:"state"},{name:"supported",event:"wcs-pointer-lock:supported-changed",semantics:"state"}],commands:[{name:"requestPointerLock",async:!0},{name:"exitPointerLock"}]};_target;_active=!1;_error=null;_errorInfo=null;_resolvedTarget=null;_subscribed=!1;_gen=0;_request=null;_supportedPublished=!1;_ready=Promise.resolve();constructor(e){super(),this._target=e??this}get ready(){return this._ready}get active(){return this._active}get error(){return this._error}get errorInfo(){return this._errorInfo}get supported(){const e=Element.prototype;return"function"==typeof e.requestPointerLock||"function"==typeof e.webkitRequestPointerLock}observe(e){return this._publishSupported(),this._resolvedTarget=e,this._subscribed||(this._subscribed=!0,document.addEventListener(this._pointerLockChangeEventName(),this._onChange),document.addEventListener(this._pointerLockErrorEventName(),this._onLockError)),this._applyActive(),this._ready}dispose(){this._gen++,this._request=null,this._subscribed&&(this._subscribed=!1,document.removeEventListener(this._pointerLockChangeEventName(),this._onChange),document.removeEventListener(this._pointerLockErrorEventName(),this._onLockError)),this._resolvedTarget=null,this._setActive(!1)}async requestPointerLock(e){const t=++this._gen;if(this._resolvedTarget=e,this._request=null,!e)return void this._setError({message:"Pointer Lock target could not be resolved."},"invalid-argument");const r=this._requestPointerLockFn(e);if(!r)return void this._setError({message:"Pointer Lock API is not supported."},"capability-missing");const n={waiting:!1,refused:!1};this._request=n;try{const e=r();if("function"==typeof e?.then){if(this._request=null,await e,t!==this._gen)return;return this._setError(null),void this._applyActive()}if(n.refused)return this._request=null,void this._setError(a());this._setError(null),this._applyActive(),n.waiting=!0}catch(e){if(t!==this._gen)return;this._request=null,this._setError(e)}}exitPointerLock(){try{if(null===this._pointerLockElement())return;const e=this._exitPointerLockFn();if(!e)return;e(),this._setError(null),this._applyActive()}catch(e){this._setError(e)}}_requestPointerLockFn(e){const t=Element.prototype,r=t.requestPointerLock;if("function"==typeof r)return r.bind(e);const n=t.webkitRequestPointerLock;return"function"==typeof n?n.bind(e):void 0}_exitPointerLockFn(){const e=document;return e.exitPointerLock?.bind(document)??e.webkitExitPointerLock?.bind(document)}_pointerLockElement(){const e=document;return e.pointerLockElement??e.webkitPointerLockElement??null}_pointerLockChangeEventName(){return"onpointerlockchange"in document?"pointerlockchange":"webkitpointerlockchange"}_pointerLockErrorEventName(){return"onpointerlockerror"in document?"pointerlockerror":"webkitpointerlockerror"}_onChange=()=>{this._applyActive(),this._active&&(this._request=null)};_onLockError=()=>{const e=this._request;null!==e&&(e.waiting?(this._request=null,this._setError(a())):e.refused=!0)};_publishSupported(){const e=this.supported;this._supportedPublished!==e&&(this._supportedPublished=e,this._target.dispatchEvent(new CustomEvent("wcs-pointer-lock:supported-changed",{detail:e,bubbles:!0})))}_applyActive(){const e=null!==this._resolvedTarget&&this._pointerLockElement()===this._resolvedTarget;this._setActive(e)}_setActive(e){this._active!==e&&(this._active=e,this._target.dispatchEvent(new CustomEvent("wcs-pointer-lock:change",{detail:e,bubbles:!0})))}_setError(e,t){this._error!==e&&(this._error=e,this._commitErrorInfo(null===e?null:c(e,t)),this._target.dispatchEvent(new CustomEvent("wcs-pointer-lock:error",{detail:e,bubbles:!0})))}_commitErrorInfo(e){this._errorInfo=e,this._target.dispatchEvent(new CustomEvent("wcs-pointer-lock:error-info-changed",{detail:e,bubbles:!0}))}}function u(e,t){let r=Object.getPrototypeOf(e);for(;null!==r;){const e=Object.getOwnPropertyDescriptor(r,t);if(void 0!==e)return"function"==typeof e.get||"function"==typeof e.set;r=Object.getPrototypeOf(r)}return!1}const h=new WeakSet;function d(e,t,r){if(h.has(e))return;h.add(e);const n=e.localName??"element";console.warn(`[wcs/input-as-attribute] <${n}> has the attribute ${t}="${r}": an object was written as an attribute, so the element did not receive it. A framework does that when the property is set before the element's definition loads (React 19), or when told to (Vue's .attr). Load the definition before rendering, or assign the property through a ref (Vue: .prop). (Said once per element.)`,e)}const p=new WeakMap;function _(e,t,r){const n=function(e,t){let r=p.get(e);return void 0===r&&(r=new Map,p.set(e,r)),r.has(t)||r.set(t,e.getAttribute(t)),r.get(t)}(e,t);!function(e,t,r){null===r?e.removeAttribute(t):e.setAttribute(t,r)}(e,t,void 0===r?n:null===r?null:String(r))}class g extends HTMLElement{static hasConnectedCallbackPromise=!0;static observedAttributes=["target"];static wcBindable={...l.wcBindable,inputs:[{name:"target",attribute:"target"}],commands:l.wcBindable.commands};_core;_connectedCallbackPromise=Promise.resolve();_internals=null;constructor(){super(),this._core=new l(this),this._internals=this._initInternals(),this._wireStates({"wcs-pointer-lock:change":e=>({active:!0===e})})}get connectedCallbackPromise(){return this._connectedCallbackPromise}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[r,n]of Object.entries(e))this.addEventListener(r,e=>{const r=this.hasAttribute("debug-states");for(const[o,s]of Object.entries(n(e.detail))){try{s?t.add(o):t.delete(o)}catch{}r&&this.toggleAttribute(`data-wcs-state-${o}`,s)}})}get target(){return this.getAttribute("target")??""}set target(e){_(this,"target",e)}get active(){return this._core.active}get error(){return this._core.error}get errorInfo(){return this._core.errorInfo}get supported(){return this._core.supported}async requestPointerLock(){const{element:e}=this._resolveTarget();await this._core.requestPointerLock(e)}exitPointerLock(){this._core.exitPointerLock()}connectedCallback(){!function(e){const t=e.constructor?.wcBindable,r=t?.inputs;if(void 0===r)return;const n=e.getAttribute;for(const t of r){const r=t.name,o="function"==typeof n?n.call(e,r.toLowerCase()):null;if(null!==o&&o.startsWith("[object ")&&d(e,r,o),!Object.prototype.hasOwnProperty.call(e,r))continue;if(!u(e,r))continue;const s=e,i=s[r];delete s[r],s[r]=i}}(this),this._applyDisplayAndObserve()}disconnectedCallback(){this._core.dispose()}attributeChangedCallback(e){"target"===e&&this.isConnected&&this._applyDisplayAndObserve()}_applyDisplayAndObserve(){const{element:e,display:t}=this._resolveTarget();this.style.display=t,this._connectedCallbackPromise=this._core.observe(e)}_resolveTarget(){const e=this.target;if("self"===e)return{element:this,display:"block"};if(""!==e){const t=this.getRootNode();return{element:this._safeQuery(t,e),display:"none"}}const t=this.firstElementChild;return t?{element:t,display:"contents"}:{element:this,display:"block"}}_safeQuery(e,t){try{return e.querySelector(t)}catch{return null}}}const b=Symbol.for("wcstack.package"),f=new WeakSet;function m(e,t){Object.defineProperty(e,b,{value:t,configurable:!0})}function v(e,t,r,n,o){if(void 0!==n&&(r===n||r.prototype instanceof n))return;const s=r[b];if(s===o||f.has(e))return;f.add(e);const i=o.slice(0,o.lastIndexOf("@"));console.warn(`[${i}] [wcs/package-twice] <${t}> is already defined by ${s??`another copy of ${i} that does not name its version`}; this copy, ${o}, does nothing. Load each package once.`)}function k(n=customElements){!function(e,t,r){for(const[n,o]of r){const r=e.get(n);void 0===r?(m(o,t),e.define(n,o)):v(e,n,r,o,t)}}(n,`${t}@${r}`,[[e.tagNames.pointerLock,g]])}var y;k(y);
|
|
2
2
|
//# sourceMappingURL=auto.min.js.map
|
package/dist/auto.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto.min.js","sources":["../../src/config.ts","../../src/core/pointerLockCapabilities.ts","../../src/core/PointerLockCore.ts","../../src/protocol/upgradeProperties.ts","../../src/protocol/inputAttribute.ts","../../src/components/PointerLock.ts","../../src/protocol/defineElement.ts","../../src/registerComponents.ts","../../src/bootstrapPointerLock.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n pointerLock: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n pointerLock: \"wcs-pointer-lock\",\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\n/** A misspelt option would otherwise do nothing: `bootstrapPointerLock` refuses it. */\nfunction invalid(key: string): never {\n throw new Error(`[@wcstack/pointer-lock] bootstrapPointerLock: \"${key}\" is not one of its options, or not of the option's type.`);\n}\n\n/**\n * Applies the options given; an undefined value is left out. An option this package does not\n * have, a value of another type than its default (null, or an array for an object, included) or\n * a tag name it does not define throws, and then nothing is applied.\n */\nexport function setConfig(partialConfig: IWritableConfig): void {\n const options = _config as unknown as Record<string, unknown>;\n const tags = _config.tagNames as Record<string, string>;\n const given = Object.entries(partialConfig).filter(([, value]) => value !== undefined);\n const givenTags = Object.entries(partialConfig.tagNames ?? {}).filter(([, tag]) => tag !== undefined);\n for (const [key, value] of given) {\n const current = options[key];\n if (!Object.hasOwn(options, key) || value === null || typeof value !== typeof current || Array.isArray(value) !== Array.isArray(current)) {\n invalid(key);\n }\n }\n for (const [name, tag] of givenTags) {\n if (!Object.hasOwn(tags, name) || typeof tag !== \"string\") invalid(`tagNames.${name}`);\n }\n for (const [name, tag] of givenTags) tags[name] = tag as string;\n frozenConfig = null;\n}\n","/**\n * pointerLockCapabilities.ts\n *\n * Pointer Lock node 固有の error code(taxonomy)と derivation。汎用の error info 型は\n * `./platformCapability.js`(/io-core/ から copy-distribution される生成ファイル)から\n * import する。pointer-lock は referenced element を操作するモニタ的ノードで競合 operation\n * を持たないため lane は無く、error taxonomy(errorInfo)のみを採用する。\n *\n * `_setError` は合成 `{ message }`(target 未解決 / API 非対応)と caught 例外\n * (`NotAllowedError` / `TypeError` = user gesture 外の requestPointerLock 拒否)を混在\n * 受理する。呼出側が明示 `kind` を渡して合成側を曖昧さ無く分類し、caught は `.name` で\n * 分類する(fullscreen と同じ discriminator 方式)。\n */\n\nimport type { WcsIoErrorInfo } from \"./platformCapability.js\";\n\n/** 明示 kind discriminator(合成エラーの呼出側が渡す)。 */\nexport type PointerLockErrorKind = \"capability-missing\" | \"invalid-argument\";\n\n/** 安定した pointer-lock error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_POINTER_LOCK_ERROR_CODE = {\n /** Pointer Lock API 非対応。 */\n CapabilityMissing: \"capability-missing\",\n /** target selector が要素に解決しない等の入力不備。 */\n InvalidArgument: \"invalid-argument\",\n /** `NotAllowedError` / `TypeError` — user gesture 外での要求拒否。 */\n NotAllowed: \"not-allowed\",\n /** その他の caught 例外。 */\n PointerLockError: \"pointer-lock-error\",\n} as const;\n\nfunction messageOf(error: unknown): string {\n return typeof (error as { message?: unknown } | null)?.message === \"string\"\n ? (error as { message: string }).message\n : String(error);\n}\n\n/**\n * pointer-lock の失敗を serializable な error taxonomy に写す。`kind` は合成エラーの\n * 呼出側が渡す明示 discriminator(`capability-missing` / `invalid-argument`)。未指定は\n * caught 例外を意味し、`.name` で分類する。`NotAllowedError` / `TypeError` は user\n * gesture 内で再試行すれば成功しうるため recoverable=true。\n */\nexport function derivePointerLockErrorInfo(error: unknown, kind?: PointerLockErrorKind): WcsIoErrorInfo {\n const message = messageOf(error);\n if (kind === \"capability-missing\") {\n return { code: WCS_POINTER_LOCK_ERROR_CODE.CapabilityMissing, phase: \"probe\", recoverable: false, message };\n }\n if (kind === \"invalid-argument\") {\n return { code: WCS_POINTER_LOCK_ERROR_CODE.InvalidArgument, phase: \"start\", recoverable: false, message };\n }\n const name = (error as { name?: unknown } | null)?.name;\n if (name === \"NotAllowedError\" || name === \"TypeError\") {\n return { code: WCS_POINTER_LOCK_ERROR_CODE.NotAllowed, phase: \"execute\", recoverable: true, message };\n }\n return { code: WCS_POINTER_LOCK_ERROR_CODE.PointerLockError, phase: \"execute\", recoverable: false, message };\n}\n","import { IWcBindable } from \"../types.js\";\nimport { WcsIoErrorInfo } from \"./platformCapability.js\";\nimport { derivePointerLockErrorInfo, PointerLockErrorKind } from \"./pointerLockCapabilities.js\";\n\n/**\n * Headless Pointer Lock primitive. A thin, framework-agnostic wrapper around\n * the Pointer Lock API (`Element.requestPointerLock()` /\n * `document.exitPointerLock()` / `document.pointerLockElement` / the\n * `document`-scoped `pointerlockchange` event) exposed through the\n * wc-bindable protocol.\n *\n * This Core follows the same basic pattern as `FullscreenCore`\n * (docs/fullscreen-tag-design.md, referenced by docs/pointer-lock-tag-design.md\n * §1): target resolution happens in the Shell, `pointerlockchange` is\n * subscribed on `document` (not on the target element) and each instance\n * self-filters by comparing `document.pointerLockElement` against its own\n * resolved target, API resolution is call-time (never cached) and probes the\n * standard name before the legacy (`webkit`-prefixed) name, and a single\n * Core-level `_gen` generation guard protects the asynchronous\n * `requestPointerLock()` call from stale resolution after dispose().\n *\n * Key difference from Fullscreen (docs/pointer-lock-tag-design.md §2):\n * `exitPointerLock()` is a *synchronous* platform API (it returns `void`, not\n * a `Promise`), so the Core's `exitPointerLock()` command is synchronous too\n * and carries no `_gen` guard of its own — it is wrapped in `try/catch` only\n * as a defensive measure (never-throw), not because it can go stale.\n *\n * Scope note (docs/pointer-lock-tag-design.md §3): `movementX`/`movementY`\n * are intentionally NOT exposed by this Core (v1 scope). They are\n * high-frequency `mousemove` data unsuited to the same-value-guarded\n * declarative `properties` surface; see the design doc for the rationale and\n * the planned `debounce`/`throttle`-based opt-in for a future version.\n */\nexport class PointerLockCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n // `active`'s CustomEvent detail is the bare boolean value itself — no\n // getter needed (docs/pointer-lock-tag-design.md §2). This differs from\n // FullscreenCore's `{ active }`-shaped detail + getter.\n properties: [\n { name: \"active\", event: \"wcs-pointer-lock:change\", semantics: \"state\" },\n // `error` / `errorInfo` are observable failure outputs. Historically `error`\n // was an imperative getter with no event; both are now bindable (event-backed)\n // so `data-wcs` / bind() can observe a request/exit failure. `errorInfo` is the\n // additive serializable taxonomy (stable code / phase / recoverable) derived\n // from `error`; the `error` value shape is unchanged. No lane — pointer-lock\n // drives a referenced element, not a competing operation.\n { name: \"error\", event: \"wcs-pointer-lock:error\", semantics: \"state\" },\n { name: \"errorInfo\", event: \"wcs-pointer-lock:error-info-changed\", semantics: \"state\" },\n ],\n commands: [\n { name: \"requestPointerLock\", async: true },\n // Synchronous platform API (document.exitPointerLock() returns void) —\n // no `async` flag (docs/pointer-lock-tag-design.md §2).\n { name: \"exitPointerLock\" },\n ],\n };\n\n private _target: EventTarget;\n private _active = false;\n private _error: any = null;\n private _errorInfo: WcsIoErrorInfo | null = null;\n\n // The element this instance last resolved requestPointerLock()/observe()\n // against, kept so the document-scoped `pointerlockchange` handler can\n // self-filter under multiple concurrent instances (docs/fullscreen-tag-design.md\n // §2.1, inherited verbatim by pointer-lock per docs/pointer-lock-tag-design.md §1).\n private _resolvedTarget: Element | null = null;\n\n // True once observe() has attached the live `document` listener. Guards\n // observe() so a redundant call does not re-subscribe; dispose() resets it\n // so a later observe() resumes cleanly.\n private _subscribed = false;\n\n // Core-level generation guard (§3.4 of the guidelines / §6 of\n // fullscreen-tag-design.md): only requestPointerLock() is asynchronous and\n // needs it. exitPointerLock() is synchronous and has no stale-resolution\n // race to guard against.\n private _gen = 0;\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 active(): boolean {\n return this._active;\n }\n\n get error(): any {\n return this._error;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable`), or null. Additive wc-bindable property (event\n * `wcs-pointer-lock:error-info-changed`), derived from `error`; the existing\n * `error` value shape is unchanged.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n // Lifecycle (§3.5). Idempotent: a second observe() while already subscribed\n // updates the tracked resolved target without re-subscribing to `document`.\n observe(target: Element | null): Promise<void> {\n this._resolvedTarget = target;\n if (!this._subscribed) {\n this._subscribed = true;\n document.addEventListener(this._pointerLockChangeEventName(), this._onChange);\n }\n this._applyActive();\n return this._ready;\n }\n\n dispose(): void {\n this._gen++; // invalidate any in-flight requestPointerLock() resolution\n if (this._subscribed) {\n this._subscribed = false;\n document.removeEventListener(this._pointerLockChangeEventName(), this._onChange);\n }\n this._resolvedTarget = null;\n }\n\n /**\n * Request pointer lock on `element`. Never-throw: a missing API or a\n * rejected promise (e.g. called outside a user-gesture context —\n * `NotAllowedError`, docs/fullscreen-tag-design.md §3) is captured into\n * `error` rather than propagated. `element` may be `null` when the Shell's\n * `target` selector did not resolve (docs/pointer-lock-tag-design.md §1\n * defers error representation to FullscreenCore verbatim — this null-target\n * case mirrors `FullscreenCore.requestFullscreen(null)`,\n * docs/fullscreen-tag-design.md §6): distinct from \"API is not supported\"\n * below, so a typo'd selector doesn't masquerade as an unsupported platform.\n */\n async requestPointerLock(element: Element | null): Promise<void> {\n const gen = ++this._gen;\n this._resolvedTarget = element;\n if (!element) {\n this._setError({ message: \"Pointer Lock target could not be resolved.\" }, \"invalid-argument\");\n return;\n }\n const fn = this._requestPointerLockFn(element);\n if (!fn) {\n // Resolved synchronously in the same tick as the call — dispose()\n // cannot have run yet, so no staleness check is needed here (matches\n // the reference `requestFullscreen()` implementation,\n // docs/fullscreen-tag-design.md §6).\n this._setError({ message: \"Pointer Lock API is not supported.\" }, \"capability-missing\");\n return;\n }\n try {\n // fn is already bound to `element` by _requestPointerLockFn().\n await fn();\n if (gen !== this._gen) return; // stale\n this._setError(null);\n this._applyActive();\n } catch (e: any) {\n if (gen !== this._gen) return; // stale\n this._setError(e);\n }\n }\n\n /**\n * Exit pointer lock. Synchronous platform API (docs/pointer-lock-tag-design.md\n * §2) — returns `void`, not a `Promise`. Silent no-op when nothing is\n * currently locked or the API is unsupported (mirrors\n * `FullscreenCore.exitFullscreen()`'s no-op contract,\n * docs/fullscreen-tag-design.md §7). Wrapped in try/catch defensively: even\n * though the platform API is synchronous and documented as not throwing in\n * this case, a synchronous throw from a non-conformant/fake implementation\n * must never escape (never-throw).\n */\n exitPointerLock(): void {\n try {\n if (this._pointerLockElement() === null) return; // already unlocked: silent no-op\n const fn = this._exitPointerLockFn();\n if (!fn) return; // unsupported: silent no-op (semantically already \"not locked\")\n fn();\n this._setError(null);\n this._applyActive();\n } catch (e: any) {\n this._setError(e);\n }\n }\n\n // --- API resolution (call-time, never cached — §3.7) ---\n\n // Resolved from `Element.prototype` rather than `el.requestPointerLock`\n // directly: when `target=\"self\"`, `el` is the `<wcs-pointer-lock>` Shell\n // itself, whose own class declares an instance method also named\n // `requestPointerLock()` (the wcBindable command). Reading the property off\n // the instance would pick up that Shell method instead of the native\n // platform API and recurse infinitely (Shell.requestPointerLock() ->\n // Core.requestPointerLock() -> resolves \"el.requestPointerLock\" -> the same\n // Shell method again). Going through `Element.prototype` sidesteps the name\n // collision — note this does NOT pick up an override on a subclass's own\n // prototype (e.g. `WcsPointerLock.prototype`); it deliberately jumps\n // straight to the platform-defined layer. Both the standard and legacy name\n // are resolved the same way, for symmetry — matching FullscreenCore's\n // `_elementFullscreenFn` (docs/fullscreen-tag-design.md §4) ONLY in that one\n // respect. Unlike that Core, this one does not check `el`'s own properties\n // first: there is no test-stub/per-element monkey-patch path to accommodate\n // here (mocks.ts installs the fakes directly on `Element.prototype`), so it\n // goes straight there for both names.\n private _requestPointerLockFn(el: Element): (() => Promise<void>) | undefined {\n const proto = Element.prototype as any;\n const standard = proto.requestPointerLock;\n if (typeof standard === \"function\") return standard.bind(el);\n const legacy = proto.webkitRequestPointerLock;\n return typeof legacy === \"function\" ? legacy.bind(el) : undefined;\n }\n\n private _exitPointerLockFn(): (() => void) | undefined {\n const d = document as any;\n return d.exitPointerLock?.bind(document) ?? d.webkitExitPointerLock?.bind(document);\n }\n\n private _pointerLockElement(): Element | null {\n const d = document as any;\n return d.pointerLockElement ?? d.webkitPointerLockElement ?? null;\n }\n\n // NOTE (test-environment caveat, not a production concern): happy-dom\n // always implements `document.onpointerlockchange` (as `null`) regardless\n // of which fake API surface a test installs, so `\"onpointerlockchange\" in\n // document` can never observably be `false` under this test runner and the\n // `webkitpointerlockchange` branch below cannot be driven through\n // `observe()` in a unit test. The branch is still correct and required for\n // real legacy WebKit builds that lack `onpointerlockchange` entirely — kept\n // as documented, deliberate, untestable-in-this-harness code per\n // docs/pointer-lock-tag-design.md.\n /* v8 ignore next 3 */\n private _pointerLockChangeEventName(): string {\n return \"onpointerlockchange\" in document ? \"pointerlockchange\" : \"webkitpointerlockchange\";\n }\n\n private _onChange = (): void => {\n this._applyActive();\n };\n\n // Self-filter (docs/fullscreen-tag-design.md §2.1): compares against this\n // instance's own resolved target, not merely \"is *something* locked\" — so\n // multiple concurrent instances each report the correct `active` value.\n private _applyActive(): void {\n const next = this._resolvedTarget !== null && this._pointerLockElement() === this._resolvedTarget;\n this._setActive(next);\n }\n\n // Same-value guard (MUST, §3.3 of the guidelines). detail itself is the\n // bare boolean value (no getter needed) per docs/pointer-lock-tag-design.md\n // §2 — unlike FullscreenCore's `{ active }`-shaped detail + getter.\n private _setActive(v: boolean): void {\n if (this._active === v) return;\n this._active = v;\n this._target.dispatchEvent(new CustomEvent(\"wcs-pointer-lock:change\", {\n detail: v,\n bubbles: true,\n }));\n }\n\n // `kind` is an explicit taxonomy discriminator passed only from the synthetic\n // error sites (unsupported / unresolved target); caught exceptions pass no kind\n // and are classified by their `.name`. Both `error` and the additive `errorInfo`\n // are now event-backed so a request/exit failure is observable via bind().\n private _setError(error: any, kind?: PointerLockErrorKind): void {\n // Same-value guard on reference: each failure builds a fresh object and the\n // clear path passes the literal null, so this only suppresses redundant\n // null→null (a successful request/exit clearing an already-null error).\n if (this._error === error) return;\n this._error = error;\n // Keep the additive errorInfo taxonomy in sync; fire it before the `error`\n // event so an observer of both sees the classification first (io-node family).\n this._commitErrorInfo(error === null ? null : derivePointerLockErrorInfo(error, kind));\n this._target.dispatchEvent(new CustomEvent(\"wcs-pointer-lock:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n // Called only from _setError (already reference-guarded), so errorInfo\n // transitions exactly when error does — no separate guard needed here.\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-pointer-lock:error-info-changed\", {\n detail: info,\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// 属性になってしまったオブジェクトの入力(`files=\"[object File]\"`)を、要素ごとに 1 回だけ言う。\n// React 19 は定義前の要素にプロパティが無いのでオブジェクトを属性に書き、Vue の `.attr` も\n// 書く。要素はその入力をプロパティでしか読まないので、何も受け取らず、何も言わなかった\n// (docs/seam-apps.md、fw-inventory)。\nconst toldObjectAttribute = new WeakSet<object>();\n\nfunction warnObjectAttribute(element: object, name: string, value: string): void {\n if (toldObjectAttribute.has(element)) return;\n toldObjectAttribute.add(element);\n const tag = (element as { localName?: string }).localName ?? \"element\";\n console.warn(\n `[wcs/input-as-attribute] <${tag}> has the attribute ${name}=\"${value}\": an object was written as an ` +\n `attribute, so the element did not receive it. A framework does that when the property is set before the ` +\n `element's definition loads (React 19), or when told to (Vue's .attr). Load the definition before rendering, ` +\n `or assign the property through a ref (Vue: .prop). (Said once per element.)`,\n element,\n );\n}\n\n/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n * - 値が `[object …]` の属性(属性に書かれてしまったオブジェクトの入力)は、要素ごとに 1 回警告する。\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 const getAttribute = (element as { getAttribute?: (name: string) => string | null }).getAttribute;\n for (const input of inputs) {\n const name = input.name;\n const attribute = typeof getAttribute === \"function\" ? getAttribute.call(element, name.toLowerCase()) : null;\n if (attribute !== null && attribute.startsWith(\"[object \")) warnObjectAttribute(element, name, attribute);\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","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/input-attribute.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// 属性へ反映する wc-bindable 入力の producer 側(SPEC-extensions § Producer guidance for inputs の P1〜P3)。\n// 入力の setter は属性をこの 2 関数で書く。それで次が揃う:\n// - `undefined` は「値が無い」(P1): 属性を、この関数で最初に書く前の状態 — マークアップに書かれた値、\n// 無ければ属性なし(= その入力の文書化した既定値)— へ戻す。applier プロファイルを宣言する binder は\n// 値の後の `undefined` を書き(A2)、React 19 も書き、直接の代入でも届く。\n// - `null` はクリア(P2): 属性なし、つまり文書化した既定値。\n// - どちらも文字列 \"undefined\" / \"null\" として属性に入らない。\n//\n// 「最初に書く前」は、その最初の書き込みのときに読む(遅延)。upgrade 前に代入されたプロパティは\n// connectedCallback の upgradeProperties() が通し直すので、そのときにはパーサが書いた属性が揃っている。\n// 要素自身が setter を通さずに書いた属性は、最初の書き込みより前なら「最初の状態」に含まれる。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/input-attribute.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/inputAttribute.ts). Those copies are generated — do not edit them.\n\nconst initialAttributes = new WeakMap<Element, Map<string, string | null>>();\n\n/** The attribute as it stood before the first write through these helpers. */\nfunction initialAttribute(el: Element, name: string): string | null {\n let byName = initialAttributes.get(el);\n if (byName === undefined) {\n byName = new Map();\n initialAttributes.set(el, byName);\n }\n if (!byName.has(name)) byName.set(name, el.getAttribute(name));\n return byName.get(name) as string | null;\n}\n\nfunction writeAttribute(el: Element, name: string, value: string | null): void {\n if (value === null) el.removeAttribute(name);\n else el.setAttribute(name, value);\n}\n\n/**\n * A value attribute. `value` is written as `String(value)`; `null` removes the attribute;\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value === null ? null : String(value));\n}\n\n/**\n * A boolean attribute, present while `value` is truthy (`null` and `false` remove it);\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectBooleanAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value ? \"\" : null);\n}\n","import { IWcBindable } from \"../types.js\";\nimport { PointerLockCore } from \"../core/PointerLockCore.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.js\";\nimport { reflectAttribute } from \"../protocol/inputAttribute.js\";\n\n/**\n * `<wcs-pointer-lock target=\"...\">` — declarative Pointer Lock API control.\n *\n * Like `<wcs-fullscreen>` (docs/fullscreen-tag-design.md §0), this Shell does\n * not lock itself — it operates on a *referenced* element via the `target`\n * attribute, using the same 3-mode resolution rule as `intersection`\n * (`_resolveTarget()`/`_safeQuery()`, copied verbatim per\n * docs/pointer-lock-tag-design.md §1 / docs/fullscreen-tag-design.md §1):\n *\n * | `target` | operates on | display |\n * |-----------------|-------------------------|-------------|\n * | omitted | first element child | `contents` |\n * | `\"#selector\"` | the matched element | `none` |\n * | `\"self\"` | the element itself | `block` |\n *\n * `requestPointerLock()` requires a user-gesture context (docs/fullscreen-tag-design.md\n * §3) — the primary activation path is the command-token protocol\n * (`command.requestPointerLock: $command.<token>` on `<wcs-pointer-lock>`,\n * emitted by a button's `onclick: $command.<token>`), not an\n * autoTrigger attribute (none is provided in v1,\n * docs/pointer-lock-tag-design.md §4).\n *\n * `movementX`/`movementY` are intentionally out of scope for v1\n * (docs/pointer-lock-tag-design.md §3) — do not add them without revisiting\n * the design doc.\n */\nexport class WcsPointerLock extends HTMLElement {\n // SSR (§4.4): the Core subscribes synchronously on connect, but the Shell\n // still exposes connectedCallbackPromise so the state binder can await it\n // uniformly across all IO nodes before snapshotting.\n static hasConnectedCallbackPromise = true;\n\n static observedAttributes = [\"target\"];\n\n static wcBindable: IWcBindable = {\n ...PointerLockCore.wcBindable,\n inputs: [{ name: \"target\", attribute: \"target\" }],\n // Core の commands をそのまま継承(単一情報源)。network/intersection と同型。\n commands: PointerLockCore.wcBindable.commands,\n };\n\n private _core: PointerLockCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new PointerLockCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-pointer-lock:change\": (d) => ({ active: d === true }),\n });\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\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 (docs/custom-state-reflection-design.md §3.6): attachInternals\n // is absent 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 // --- Attribute accessors ---\n\n get target(): string {\n return this.getAttribute(\"target\") ?? \"\";\n }\n\n // Never lets setAttribute stringify null / undefined (an \"undefined\" selector\n // resolves nothing): `null` removes the attribute (the first-child default),\n // `undefined` restores the attribute the element started with (wc-bindable\n // producer guidance P1; React 19 and a direct assignment deliver it,\n // @wcstack/state does not).\n set target(value: string | null | undefined) {\n reflectAttribute(this, \"target\", value);\n }\n\n // --- Core delegated getters ---\n\n get active(): boolean {\n return this._core.active;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get errorInfo(): WcsIoErrorInfo | null {\n return this._core.errorInfo;\n }\n\n // --- Commands ---\n\n /**\n * Resolve `target` and request pointer lock on it. Requires a user-gesture\n * context. never-throw: an unresolvable target or an unsupported/rejected\n * API call are both surfaced via `error`, never thrown (mirrors\n * `<wcs-fullscreen>`'s `requestFullscreen()`, docs/fullscreen-tag-design.md\n * §3/§6 — the Shell passes the (possibly `null`) resolved element straight\n * through and lets the Core set `error`, rather than silently no-op'ing\n * here).\n */\n async requestPointerLock(): Promise<void> {\n const { element } = this._resolveTarget();\n await this._core.requestPointerLock(element);\n }\n\n /** Exit pointer lock. Synchronous command — silent no-op if nothing is locked. */\n exitPointerLock(): void {\n this._core.exitPointerLock();\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n // upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)\n upgradeProperties(this);\n this._applyDisplayAndObserve();\n }\n\n disconnectedCallback(): void {\n this._core.dispose();\n }\n\n attributeChangedCallback(name: string): void {\n if (name === \"target\" && this.isConnected) {\n this._applyDisplayAndObserve();\n }\n }\n\n // --- Internal ---\n\n private _applyDisplayAndObserve(): void {\n const { element, display } = this._resolveTarget();\n this.style.display = display;\n this._connectedCallbackPromise = this._core.observe(element);\n }\n\n // Copied verbatim from packages/intersection/src/components/Intersect.ts\n // (§1 of docs/pointer-lock-tag-design.md / docs/fullscreen-tag-design.md).\n private _resolveTarget(): { element: Element | null; display: string } {\n const target = this.target;\n if (target === \"self\") {\n return { element: this, display: \"block\" };\n }\n if (target !== \"\") {\n const scope = this.getRootNode() as Document | ShadowRoot;\n return { element: this._safeQuery(scope, target), display: \"none\" };\n }\n const child = this.firstElementChild;\n if (child) {\n return { element: child, display: \"contents\" };\n }\n return { element: this, display: \"block\" };\n }\n\n // Copied verbatim from packages/intersection/src/components/Intersect.ts.\n private _safeQuery(scope: Document | ShadowRoot, selector: string): Element | null {\n try {\n return scope.querySelector(selector);\n } catch {\n return null;\n }\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/define-element.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * One copy of each package on a page (docs/timing-and-firing-contract.md §24). The first copy the\n * page evaluates defines the tags and a second one does nothing, so a copy that finds its tag defined\n * by another copy of the package — not its class, not a subclass of it, not the same version — warns\n * `[wcs/package-twice]` once per registry, naming both versions. The classes it defines carry\n * `\"<package>@<version>\"` under `Symbol.for(\"wcstack.package\")`; a class without it is named\n * \"another copy of <package> that does not name its version\" (an older copy, or one loaded through\n * an entry that does not stamp).\n */\n\n/** The static a class defined through this helper carries: `\"@wcstack/fetch@<version>\"`. */\nexport const PACKAGE_STAMP: unique symbol = Symbol.for(\"wcstack.package\");\n\ntype Stamped = { [PACKAGE_STAMP]?: string };\n\n/** The registries this copy warned about: one warning per package per registry. */\nconst warned = new WeakSet<CustomElementRegistry>();\n\n/**\n * Marks `cls` as defined by `pkg` (`\"@wcstack/fetch@<version>\"`). A subclass inherits the mark, and\n * `defineProperty` writes it even where a parent's mark is read-only.\n */\nexport function stampPackage(cls: CustomElementConstructor, pkg: string): void {\n Object.defineProperty(cls, PACKAGE_STAMP, { value: pkg, configurable: true });\n}\n\n/**\n * Warns when `tag` is defined as `existing` by another copy of the package `pkg` names: `existing`\n * is neither `own` nor a subclass of it (omit `own` when the copy has no class to compare with), and\n * carries another version or none. Once per registry.\n */\nexport function warnIfAnotherCopy(\n registry: CustomElementRegistry,\n tag: string,\n existing: CustomElementConstructor,\n own: CustomElementConstructor | undefined,\n pkg: string,\n): void {\n if (own !== undefined && (existing === own || existing.prototype instanceof own)) return;\n const theirs = (existing as Stamped)[PACKAGE_STAMP];\n if (theirs === pkg || warned.has(registry)) return;\n warned.add(registry);\n const name = pkg.slice(0, pkg.lastIndexOf(\"@\"));\n console.warn(\n `[${name}] [wcs/package-twice] <${tag}> is already defined by ` +\n `${theirs ?? `another copy of ${name} that does not name its version`}; ` +\n `this copy, ${pkg}, does nothing. Load each package once.`,\n );\n}\n\n/**\n * Defines each `[tag, class]` in `registry` unless the tag is already defined, stamping the class\n * with `pkg` (`\"@wcstack/fetch@<version>\"`). A tag another copy of the package defined first is left\n * as it is, with the warning above.\n */\nexport function defineElements(\n registry: CustomElementRegistry,\n pkg: string,\n definitions: readonly (readonly [tag: string, cls: CustomElementConstructor])[],\n): void {\n for (const [tag, cls] of definitions) {\n const existing = registry.get(tag);\n if (existing === undefined) {\n stampPackage(cls, pkg);\n registry.define(tag, cls);\n } else {\n warnIfAnotherCopy(registry, tag, existing, cls, pkg);\n }\n }\n}\n","import pkg from \"../package.json\" with { type: \"json\" };\nimport { WcsPointerLock } from \"./components/PointerLock.js\";\nimport { config } from \"./config.js\";\nimport { defineElements } from \"./protocol/defineElement.js\";\n\n/**\n * Register this package's tags. Pass a scoped `CustomElementRegistry` to define\n * them for a single shadow tree -- scoped registries do not inherit the global\n * one, so a tree using one needs its own definitions.\n */\nexport function registerComponents(registry: CustomElementRegistry = customElements): void {\n defineElements(registry, `${pkg.name}@${pkg.version}`, [\n [config.tagNames.pointerLock, WcsPointerLock],\n ]);\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapPointerLock(userConfig?: IWritableConfig, registry?: CustomElementRegistry): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents(registry);\n}\n"],"names":["config","tagNames","pointerLock","WCS_POINTER_LOCK_ERROR_CODE","derivePointerLockErrorInfo","error","kind","message","String","messageOf","code","phase","recoverable","name","PointerLockCore","EventTarget","static","protocol","version","properties","event","semantics","commands","async","_target","_active","_error","_errorInfo","_resolvedTarget","_subscribed","_gen","_ready","Promise","resolve","constructor","target","super","this","ready","active","errorInfo","observe","document","addEventListener","_pointerLockChangeEventName","_onChange","_applyActive","dispose","removeEventListener","requestPointerLock","element","gen","_setError","fn","_requestPointerLockFn","e","exitPointerLock","_pointerLockElement","_exitPointerLockFn","el","proto","Element","prototype","standard","bind","legacy","webkitRequestPointerLock","undefined","d","webkitExitPointerLock","pointerLockElement","webkitPointerLockElement","next","_setActive","v","dispatchEvent","CustomEvent","detail","bubbles","_commitErrorInfo","info","hasAccessorOnPrototype","Object","getPrototypeOf","descriptor","getOwnPropertyDescriptor","get","set","toldObjectAttribute","WeakSet","warnObjectAttribute","value","has","add","tag","localName","console","warn","initialAttributes","WeakMap","reflectAttribute","initial","byName","Map","getAttribute","initialAttribute","removeAttribute","setAttribute","writeAttribute","WcsPointerLock","HTMLElement","wcBindable","inputs","attribute","_core","_connectedCallbackPromise","_internals","_initInternals","_wireStates","connectedCallbackPromise","debugStates","states","attachInternals","internals","delete","map","toStates","entries","debug","hasAttribute","on","toggleAttribute","_resolveTarget","connectedCallback","declaration","input","call","toLowerCase","startsWith","hasOwnProperty","record","upgradeProperties","_applyDisplayAndObserve","disconnectedCallback","attributeChangedCallback","isConnected","display","style","scope","getRootNode","_safeQuery","child","firstElementChild","selector","querySelector","PACKAGE_STAMP","Symbol","for","warned","stampPackage","cls","pkg","defineProperty","configurable","warnIfAnotherCopy","registry","existing","own","theirs","slice","lastIndexOf","registerComponents","customElements","definitions","define","defineElements"],"mappings":"AAQA,MA0BaA,EA1BoB,CAC/BC,SAAU,CACRC,YAAa,8DCUV,MAAMC,EAEQ,qBAFRA,EAIM,mBAJNA,EAMC,cANDA,EAQO,qBAed,SAAUC,EAA2BC,EAAgBC,GACzD,MAAMC,EAbR,SAAmBF,GACjB,MAAmE,iBAApDA,GAAwCE,QAClDF,EAA8BE,QAC/BC,OAAOH,EACb,CASkBI,CAAUJ,GAC1B,GAAa,uBAATC,EACF,MAAO,CAAEI,KAAMP,EAA+CQ,MAAO,QAASC,aAAa,EAAOL,WAEpG,GAAa,qBAATD,EACF,MAAO,CAAEI,KAAMP,EAA6CQ,MAAO,QAASC,aAAa,EAAOL,WAElG,MAAMM,EAAQR,GAAqCQ,KACnD,MAAa,oBAATA,GAAuC,cAATA,EACzB,CAAEH,KAAMP,EAAwCQ,MAAO,UAAWC,aAAa,EAAML,WAEvF,CAAEG,KAAMP,EAA8CQ,MAAO,UAAWC,aAAa,EAAOL,UACrG,CCvBM,MAAOO,UAAwBC,YACnCC,kBAAiC,CAC/BC,SAAU,cACVC,QAAS,EAITC,WAAY,CACV,CAAEN,KAAM,SAAUO,MAAO,0BAA2BC,UAAW,SAO/D,CAAER,KAAM,QAASO,MAAO,yBAA0BC,UAAW,SAC7D,CAAER,KAAM,YAAaO,MAAO,sCAAuCC,UAAW,UAEhFC,SAAU,CACR,CAAET,KAAM,qBAAsBU,OAAO,GAGrC,CAAEV,KAAM,qBAIJW,QACAC,SAAU,EACVC,OAAc,KACdC,WAAoC,KAMpCC,gBAAkC,KAKlCC,aAAc,EAMdC,KAAO,EAIPC,OAAwBC,QAAQC,UAExC,WAAAC,CAAYC,GACVC,QACAC,KAAKb,QAAUW,GAAUE,IAC3B,CAEA,SAAIC,G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ACT,CACF,EC7LK,MAAME,EAA+BC,OAAOC,IAAI,mBAKjDC,EAAS,IAAIrE,QAMb,SAAUsE,EAAaC,EAA+BC,GAC1D/E,OAAOgF,eAAeF,EAAKL,EAAe,CAAEhE,MAAOsE,EAAKE,cAAc,GACxE,CAOM,SAAUC,EACdC,EACAvE,EACAwE,EACAC,EACAN,GAEA,QAAY9F,IAARoG,IAAsBD,IAAaC,GAAOD,EAASxG,qBAAqByG,GAAM,OAClF,MAAMC,EAAUF,EAAqBX,GACrC,GAAIa,IAAWP,GAAOH,EAAOlE,IAAIyE,GAAW,OAC5CP,EAAOjE,IAAIwE,GACX,MAAMxJ,EAAOoJ,EAAIQ,MAAM,EAAGR,EAAIS,YAAY,MAC1C1E,QAAQC,KACN,IAAIpF,2BAA8BiF,4BAC/B0E,GAAU,mBAAmB3J,kDAClBoJ,2CAElB,CC5CM,SAAUU,EAAmBN,EAAkCO,0BDoDnEP,EACAJ,EACAY,GAEA,IAAK,MAAO/E,EAAKkE,KAAQa,EAAa,CACpC,MAAMP,EAAWD,EAAS/E,IAAIQ,QACb3B,IAAbmG,GACFP,EAAaC,EAAKC,GAClBI,EAASS,OAAOhF,EAAKkE,IAErBI,EAAkBC,EAAUvE,EAAKwE,EAAUN,EAAKC,EAEpD,CACF,CChEEc,CAAeV,EAAU,GAAGJ,KAAYA,IAAe,CACrD,CAACjK,EAAOC,SAASC,YAAa2G,IAElC,CCVM,IAA6DwD,EAIjEM,EAAmBN"}
|
|
1
|
+
{"version":3,"file":"auto.min.js","sources":["../../src/config.ts","../../src/core/pointerLockCapabilities.ts","../../src/core/PointerLockCore.ts","../../src/protocol/upgradeProperties.ts","../../src/protocol/inputAttribute.ts","../../src/components/PointerLock.ts","../../src/protocol/defineElement.ts","../../src/registerComponents.ts","../../src/bootstrapPointerLock.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n pointerLock: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n pointerLock: \"wcs-pointer-lock\",\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\n/** A misspelt option would otherwise do nothing: `bootstrapPointerLock` refuses it. */\nfunction invalid(key: string): never {\n throw new Error(`[@wcstack/pointer-lock] bootstrapPointerLock: \"${key}\" is not one of its options, or not of the option's type.`);\n}\n\n/**\n * Applies the options given; an undefined value is left out. An option this package does not\n * have, a value of another type than its default (null, or an array for an object, included) or\n * a tag name it does not define throws, and then nothing is applied.\n */\nexport function setConfig(partialConfig: IWritableConfig): void {\n const options = _config as unknown as Record<string, unknown>;\n const tags = _config.tagNames as Record<string, string>;\n const given = Object.entries(partialConfig).filter(([, value]) => value !== undefined);\n const givenTags = Object.entries(partialConfig.tagNames ?? {}).filter(([, tag]) => tag !== undefined);\n for (const [key, value] of given) {\n const current = options[key];\n if (!Object.hasOwn(options, key) || value === null || typeof value !== typeof current || Array.isArray(value) !== Array.isArray(current)) {\n invalid(key);\n }\n }\n for (const [name, tag] of givenTags) {\n if (!Object.hasOwn(tags, name) || typeof tag !== \"string\") invalid(`tagNames.${name}`);\n }\n for (const [name, tag] of givenTags) tags[name] = tag as string;\n frozenConfig = null;\n}\n","/**\n * pointerLockCapabilities.ts\n *\n * Pointer Lock node 固有の error code(taxonomy)と derivation。汎用の error info 型は\n * `./platformCapability.js`(/io-core/ から copy-distribution される生成ファイル)から\n * import する。pointer-lock は referenced element を操作するモニタ的ノードで競合 operation\n * を持たないため lane は無く、error taxonomy(errorInfo)のみを採用する。\n *\n * `_setError` は合成 `{ message }`(target 未解決 / API 非対応)と caught 例外\n * (`NotAllowedError` / `TypeError` = user gesture 外の requestPointerLock 拒否)を混在\n * 受理する。呼出側が明示 `kind` を渡して合成側を曖昧さ無く分類し、caught は `.name` で\n * 分類する(fullscreen と同じ discriminator 方式)。\n */\n\nimport type { WcsIoErrorInfo } from \"./platformCapability.js\";\n\n/** 明示 kind discriminator(合成エラーの呼出側が渡す)。 */\nexport type PointerLockErrorKind = \"capability-missing\" | \"invalid-argument\";\n\n/** 安定した pointer-lock error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_POINTER_LOCK_ERROR_CODE = {\n /** Pointer Lock API 非対応。 */\n CapabilityMissing: \"capability-missing\",\n /** target selector が要素に解決しない等の入力不備。 */\n InvalidArgument: \"invalid-argument\",\n /** `NotAllowedError` / `TypeError` — user gesture 外での要求拒否。 */\n NotAllowed: \"not-allowed\",\n /** その他の caught 例外。 */\n PointerLockError: \"pointer-lock-error\",\n} as const;\n\nfunction messageOf(error: unknown): string {\n return typeof (error as { message?: unknown } | null)?.message === \"string\"\n ? (error as { message: string }).message\n : String(error);\n}\n\n/**\n * pointer-lock の失敗を serializable な error taxonomy に写す。`kind` は合成エラーの\n * 呼出側が渡す明示 discriminator(`capability-missing` / `invalid-argument`)。未指定は\n * caught 例外を意味し、`.name` で分類する。`NotAllowedError` / `TypeError` は user\n * gesture 内で再試行すれば成功しうるため recoverable=true。\n */\nexport function derivePointerLockErrorInfo(error: unknown, kind?: PointerLockErrorKind): WcsIoErrorInfo {\n const message = messageOf(error);\n if (kind === \"capability-missing\") {\n return { code: WCS_POINTER_LOCK_ERROR_CODE.CapabilityMissing, phase: \"probe\", recoverable: false, message };\n }\n if (kind === \"invalid-argument\") {\n return { code: WCS_POINTER_LOCK_ERROR_CODE.InvalidArgument, phase: \"start\", recoverable: false, message };\n }\n const name = (error as { name?: unknown } | null)?.name;\n if (name === \"NotAllowedError\" || name === \"TypeError\") {\n return { code: WCS_POINTER_LOCK_ERROR_CODE.NotAllowed, phase: \"execute\", recoverable: true, message };\n }\n return { code: WCS_POINTER_LOCK_ERROR_CODE.PointerLockError, phase: \"execute\", recoverable: false, message };\n}\n","import { IWcBindable } from \"../types.js\";\nimport { WcsIoErrorInfo } from \"./platformCapability.js\";\nimport { derivePointerLockErrorInfo, PointerLockErrorKind } from \"./pointerLockCapabilities.js\";\n\n// A request this instance made whose answer may come as an event on the\n// document. Whether it does is known only once the platform call has returned:\n// a call that returns a promise is answered by that promise alone, and one that\n// returns nothing (Firefox, the prefixed API) is answered by pointerlockchange /\n// pointerlockerror.\ninterface PendingRequest {\n // true once the call has returned without a promise: the events answer it.\n waiting: boolean;\n // a pointerlockerror fired before the call returned (decided when it returns).\n refused: boolean;\n}\n\n// What a refusal that arrives as an event is reported as. The event carries no\n// reason, so the message says no more than that; `NotAllowedError` puts it in\n// the `not-allowed` class (recoverable: a request from a user gesture may pass).\nfunction refusedByEvent(): DOMException {\n return new DOMException(\"The browser refused the pointer lock request.\", \"NotAllowedError\");\n}\n\n/**\n * Headless Pointer Lock primitive. A thin, framework-agnostic wrapper around\n * the Pointer Lock API (`Element.requestPointerLock()` /\n * `document.exitPointerLock()` / `document.pointerLockElement` / the\n * `document`-scoped `pointerlockchange` event) exposed through the\n * wc-bindable protocol.\n *\n * This Core follows the same basic pattern as `FullscreenCore`\n * (docs/fullscreen-tag-design.md, referenced by docs/pointer-lock-tag-design.md\n * §1): target resolution happens in the Shell, `pointerlockchange` is\n * subscribed on `document` (not on the target element) and each instance\n * self-filters by comparing `document.pointerLockElement` against its own\n * resolved target, API resolution is call-time (never cached) and probes the\n * standard name before the legacy (`webkit`-prefixed) name, and a single\n * Core-level `_gen` generation guard protects the asynchronous\n * `requestPointerLock()` call from stale resolution after dispose().\n *\n * Key difference from Fullscreen (docs/pointer-lock-tag-design.md §2):\n * `exitPointerLock()` is a *synchronous* platform API (it returns `void`, not\n * a `Promise`), so the Core's `exitPointerLock()` command is synchronous too\n * and carries no `_gen` guard of its own — it is wrapped in `try/catch` only\n * as a defensive measure (never-throw), not because it can go stale.\n *\n * Scope note (docs/pointer-lock-tag-design.md §3): `movementX`/`movementY`\n * are intentionally NOT exposed by this Core (v1 scope). They are\n * high-frequency `mousemove` data unsuited to the same-value-guarded\n * declarative `properties` surface; see the design doc for the rationale and\n * the planned `debounce`/`throttle`-based opt-in for a future version.\n */\nexport class PointerLockCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n // `active`'s CustomEvent detail is the bare boolean value itself — no\n // getter needed (docs/pointer-lock-tag-design.md §2). This differs from\n // FullscreenCore's `{ active }`-shaped detail + getter.\n properties: [\n { name: \"active\", event: \"wcs-pointer-lock:change\", semantics: \"state\" },\n // `error` / `errorInfo` are observable failure outputs. Historically `error`\n // was an imperative getter with no event; both are now bindable (event-backed)\n // so `data-wcs` / bind() can observe a request/exit failure. `errorInfo` is the\n // additive serializable taxonomy (stable code / phase / recoverable) derived\n // from `error`; the `error` value shape is unchanged. No lane — pointer-lock\n // drives a referenced element, not a competing operation.\n { name: \"error\", event: \"wcs-pointer-lock:error\", semantics: \"state\" },\n { name: \"errorInfo\", event: \"wcs-pointer-lock:error-info-changed\", semantics: \"state\" },\n // Whether this page has the Pointer Lock API (an element has\n // requestPointerLock() or the prefixed name). Computed at call time; the\n // event carries the boolean and fires from observe() when it differs from\n // the last value dispatched.\n { name: \"supported\", event: \"wcs-pointer-lock:supported-changed\", semantics: \"state\" },\n ],\n commands: [\n { name: \"requestPointerLock\", async: true },\n // Synchronous platform API (document.exitPointerLock() returns void) —\n // no `async` flag (docs/pointer-lock-tag-design.md §2).\n { name: \"exitPointerLock\" },\n ],\n };\n\n private _target: EventTarget;\n private _active = false;\n private _error: any = null;\n private _errorInfo: WcsIoErrorInfo | null = null;\n\n // The element this instance last resolved requestPointerLock()/observe()\n // against, kept so the document-scoped `pointerlockchange` handler can\n // self-filter under multiple concurrent instances (docs/fullscreen-tag-design.md\n // §2.1, inherited verbatim by pointer-lock per docs/pointer-lock-tag-design.md §1).\n private _resolvedTarget: Element | null = null;\n\n // True once observe() has attached the live `document` listener. Guards\n // observe() so a redundant call does not re-subscribe; dispose() resets it\n // so a later observe() resumes cleanly.\n private _subscribed = false;\n\n // Core-level generation guard (§3.4 of the guidelines / §6 of\n // fullscreen-tag-design.md): only requestPointerLock() is asynchronous and\n // needs it. exitPointerLock() is synchronous and has no stale-resolution\n // race to guard against.\n private _gen = 0;\n\n // The request this instance made that an event may still answer, or null.\n // Chromium and WebKit answer with the call's promise; Firefox (and the prefixed\n // API) return nothing and answer with pointerlockchange / pointerlockerror on\n // the document. A pointerlockerror is this instance's only while this is set\n // and waiting — the event does not say whose request failed.\n private _request: PendingRequest | null = null;\n\n // `supported` as last dispatched (never the value itself — the getter probes at\n // call time). Starts at false, so observe() announces a page that has the API.\n private _supportedPublished = 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 active(): boolean {\n return this._active;\n }\n\n get error(): any {\n return this._error;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable`), or null. Additive wc-bindable property (event\n * `wcs-pointer-lock:error-info-changed`), derived from `error`; the existing\n * `error` value shape is unchanged.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n /**\n * Whether this page has the Pointer Lock API right now: an element has\n * `requestPointerLock()` (or the prefixed `webkitRequestPointerLock()`). Probed\n * at call time, never cached. No Permissions-Policy feature governs pointer\n * lock, so there is no policy to ask. It does not say that a request will\n * succeed (that needs a user gesture, and a sandboxed `<iframe>` needs\n * `allow-pointer-lock`). A wc-bindable output (event\n * `wcs-pointer-lock:supported-changed`).\n */\n get supported(): boolean {\n const proto = Element.prototype as any;\n return typeof proto.requestPointerLock === \"function\" || typeof proto.webkitRequestPointerLock === \"function\";\n }\n\n // Lifecycle (§3.5). Idempotent: a second observe() while already subscribed\n // updates the tracked resolved target without re-subscribing to `document`.\n // Also publishes `supported` when it differs from the last value dispatched.\n observe(target: Element | null): Promise<void> {\n this._publishSupported();\n this._resolvedTarget = target;\n if (!this._subscribed) {\n this._subscribed = true;\n document.addEventListener(this._pointerLockChangeEventName(), this._onChange);\n document.addEventListener(this._pointerLockErrorEventName(), this._onLockError);\n }\n this._applyActive();\n return this._ready;\n }\n\n dispose(): void {\n this._gen++; // invalidate any in-flight requestPointerLock() resolution\n this._request = null;\n if (this._subscribed) {\n this._subscribed = false;\n document.removeEventListener(this._pointerLockChangeEventName(), this._onChange);\n document.removeEventListener(this._pointerLockErrorEventName(), this._onLockError);\n }\n this._resolvedTarget = null;\n // A disposed Core hears no pointerlockchange, so it can no longer vouch for\n // `active`: publish false through the normal setter (timing contract §22 — a\n // disconnect publishes what it changes). The lock itself is not released\n // here; observe() re-reads the truth — publishing true again — on the next\n // connect.\n this._setActive(false);\n }\n\n /**\n * Request pointer lock on `element`. Never-throw: a missing API or a\n * rejected promise (e.g. called outside a user-gesture context —\n * `NotAllowedError`, docs/fullscreen-tag-design.md §3) is captured into\n * `error` rather than propagated. `element` may be `null` when the Shell's\n * `target` selector did not resolve (docs/pointer-lock-tag-design.md §1\n * defers error representation to FullscreenCore verbatim — this null-target\n * case mirrors `FullscreenCore.requestFullscreen(null)`,\n * docs/fullscreen-tag-design.md §6): distinct from \"API is not supported\"\n * below, so a typo'd selector doesn't masquerade as an unsupported platform.\n */\n async requestPointerLock(element: Element | null): Promise<void> {\n const gen = ++this._gen;\n this._resolvedTarget = element;\n this._request = null; // this call supersedes the request before it\n if (!element) {\n this._setError({ message: \"Pointer Lock target could not be resolved.\" }, \"invalid-argument\");\n return;\n }\n const fn = this._requestPointerLockFn(element);\n if (!fn) {\n // Resolved synchronously in the same tick as the call — dispose()\n // cannot have run yet, so no staleness check is needed here (matches\n // the reference `requestFullscreen()` implementation,\n // docs/fullscreen-tag-design.md §6).\n this._setError({ message: \"Pointer Lock API is not supported.\" }, \"capability-missing\");\n return;\n }\n const request: PendingRequest = { waiting: false, refused: false };\n this._request = request;\n try {\n // fn is already bound to `element` by _requestPointerLockFn().\n const result: unknown = fn();\n if (typeof (result as { then?: unknown } | null | undefined)?.then === \"function\") {\n // Chromium and WebKit: the call's promise answers this request, and it\n // alone. They fire pointerlockerror for the same refusal as well — WebKit\n // before it rejects the promise — and the rejection carries the reason,\n // so the event is not this request's answer.\n this._request = null;\n await result;\n if (gen !== this._gen) return; // stale\n this._setError(null);\n this._applyActive();\n return;\n }\n // Firefox (and the prefixed API) return nothing: the answer is a\n // pointerlockchange or a pointerlockerror on the document.\n if (request.refused) {\n // The event fired inside the call itself.\n this._request = null;\n this._setError(refusedByEvent());\n return;\n }\n // The request is made: the failure before it is no longer the latest\n // attempt's. From here the events answer.\n this._setError(null);\n this._applyActive();\n request.waiting = true;\n } catch (e: any) {\n if (gen !== this._gen) return; // stale\n this._request = null;\n this._setError(e);\n }\n }\n\n /**\n * Exit pointer lock. Synchronous platform API (docs/pointer-lock-tag-design.md\n * §2) — returns `void`, not a `Promise`. Silent no-op when nothing is\n * currently locked or the API is unsupported (mirrors\n * `FullscreenCore.exitFullscreen()`'s no-op contract,\n * docs/fullscreen-tag-design.md §7). Wrapped in try/catch defensively: even\n * though the platform API is synchronous and documented as not throwing in\n * this case, a synchronous throw from a non-conformant/fake implementation\n * must never escape (never-throw).\n */\n exitPointerLock(): void {\n try {\n if (this._pointerLockElement() === null) return; // already unlocked: silent no-op\n const fn = this._exitPointerLockFn();\n if (!fn) return; // unsupported: silent no-op (semantically already \"not locked\")\n fn();\n this._setError(null);\n this._applyActive();\n } catch (e: any) {\n this._setError(e);\n }\n }\n\n // --- API resolution (call-time, never cached — §3.7) ---\n\n // Resolved from `Element.prototype` rather than `el.requestPointerLock`\n // directly: when `target=\"self\"`, `el` is the `<wcs-pointer-lock>` Shell\n // itself, whose own class declares an instance method also named\n // `requestPointerLock()` (the wcBindable command). Reading the property off\n // the instance would pick up that Shell method instead of the native\n // platform API and recurse infinitely (Shell.requestPointerLock() ->\n // Core.requestPointerLock() -> resolves \"el.requestPointerLock\" -> the same\n // Shell method again). Going through `Element.prototype` sidesteps the name\n // collision — note this does NOT pick up an override on a subclass's own\n // prototype (e.g. `WcsPointerLock.prototype`); it deliberately jumps\n // straight to the platform-defined layer. Both the standard and legacy name\n // are resolved the same way, for symmetry — matching FullscreenCore's\n // `_elementFullscreenFn` (docs/fullscreen-tag-design.md §4) ONLY in that one\n // respect. Unlike that Core, this one does not check `el`'s own properties\n // first: there is no test-stub/per-element monkey-patch path to accommodate\n // here (mocks.ts installs the fakes directly on `Element.prototype`), so it\n // goes straight there for both names.\n private _requestPointerLockFn(el: Element): (() => Promise<void>) | undefined {\n const proto = Element.prototype as any;\n const standard = proto.requestPointerLock;\n if (typeof standard === \"function\") return standard.bind(el);\n const legacy = proto.webkitRequestPointerLock;\n return typeof legacy === \"function\" ? legacy.bind(el) : undefined;\n }\n\n private _exitPointerLockFn(): (() => void) | undefined {\n const d = document as any;\n return d.exitPointerLock?.bind(document) ?? d.webkitExitPointerLock?.bind(document);\n }\n\n private _pointerLockElement(): Element | null {\n const d = document as any;\n return d.pointerLockElement ?? d.webkitPointerLockElement ?? null;\n }\n\n // NOTE (test-environment caveat, not a production concern): happy-dom\n // always implements `document.onpointerlockchange` (as `null`) regardless\n // of which fake API surface a test installs, so `\"onpointerlockchange\" in\n // document` can never observably be `false` under this test runner and the\n // `webkitpointerlockchange` branch below cannot be driven through\n // `observe()` in a unit test. The branch is still correct and required for\n // real legacy WebKit builds that lack `onpointerlockchange` entirely — kept\n // as documented, deliberate, untestable-in-this-harness code per\n // docs/pointer-lock-tag-design.md.\n /* v8 ignore next 3 */\n private _pointerLockChangeEventName(): string {\n return \"onpointerlockchange\" in document ? \"pointerlockchange\" : \"webkitpointerlockchange\";\n }\n\n // Picked the same way as the change event's name above. Unlike that one, this\n // branch is driven in the tests (mocks.ts removes `onpointerlockerror` from\n // the prototype that owns it).\n private _pointerLockErrorEventName(): string {\n return \"onpointerlockerror\" in document ? \"pointerlockerror\" : \"webkitpointerlockerror\";\n }\n\n private _onChange = (): void => {\n this._applyActive();\n // The target is locked: a request that was waiting for its answer has it.\n if (this._active) this._request = null;\n };\n\n // A refusal that arrives as an event. Firefox reports a refused\n // requestPointerLock() (no user gesture, say) only here — the call returns no\n // promise to reject. A request whose call returned a promise is not waiting\n // for this event (`_request` is null from the moment the call returned), so a\n // refusal the promise reports is never reported a second time. The event fires\n // on the document without saying whose request failed: with no request waiting\n // here, it is another instance's (or the page's own call) and is ignored.\n private _onLockError = (): void => {\n const request = this._request;\n if (request === null) return;\n if (!request.waiting) {\n // Inside the platform call: whether a promise answers is not known yet.\n request.refused = true;\n return;\n }\n this._request = null;\n this._setError(refusedByEvent());\n };\n\n // `supported` is probed at call time, so there is no stored value to set: this\n // dispatches the current one when it differs from the last one dispatched\n // (same-value guard). A state binding reads the property when it attaches; the\n // event is for every other listener.\n private _publishSupported(): void {\n const supported = this.supported;\n if (this._supportedPublished === supported) return;\n this._supportedPublished = supported;\n this._target.dispatchEvent(new CustomEvent(\"wcs-pointer-lock:supported-changed\", {\n detail: supported,\n bubbles: true,\n }));\n }\n\n // Self-filter (docs/fullscreen-tag-design.md §2.1): compares against this\n // instance's own resolved target, not merely \"is *something* locked\" — so\n // multiple concurrent instances each report the correct `active` value.\n private _applyActive(): void {\n const next = this._resolvedTarget !== null && this._pointerLockElement() === this._resolvedTarget;\n this._setActive(next);\n }\n\n // Same-value guard (MUST, §3.3 of the guidelines). detail itself is the\n // bare boolean value (no getter needed) per docs/pointer-lock-tag-design.md\n // §2 — unlike FullscreenCore's `{ active }`-shaped detail + getter.\n private _setActive(v: boolean): void {\n if (this._active === v) return;\n this._active = v;\n this._target.dispatchEvent(new CustomEvent(\"wcs-pointer-lock:change\", {\n detail: v,\n bubbles: true,\n }));\n }\n\n // `kind` is an explicit taxonomy discriminator passed only from the synthetic\n // error sites (unsupported / unresolved target); caught exceptions pass no kind\n // and are classified by their `.name`. Both `error` and the additive `errorInfo`\n // are now event-backed so a request/exit failure is observable via bind().\n private _setError(error: any, kind?: PointerLockErrorKind): void {\n // Same-value guard on reference: each failure builds a fresh object and the\n // clear path passes the literal null, so this only suppresses redundant\n // null→null (a successful request/exit clearing an already-null error).\n if (this._error === error) return;\n this._error = error;\n // Keep the additive errorInfo taxonomy in sync; fire it before the `error`\n // event so an observer of both sees the classification first (io-node family).\n this._commitErrorInfo(error === null ? null : derivePointerLockErrorInfo(error, kind));\n this._target.dispatchEvent(new CustomEvent(\"wcs-pointer-lock:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n // Called only from _setError (already reference-guarded), so errorInfo\n // transitions exactly when error does — no separate guard needed here.\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-pointer-lock:error-info-changed\", {\n detail: info,\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// 属性になってしまったオブジェクトの入力(`files=\"[object File]\"`)を、要素ごとに 1 回だけ言う。\n// React 19 は定義前の要素にプロパティが無いのでオブジェクトを属性に書き、Vue の `.attr` も\n// 書く。要素はその入力をプロパティでしか読まないので、何も受け取らず、何も言わなかった\n// (docs/seam-apps.md、fw-inventory)。\nconst toldObjectAttribute = new WeakSet<object>();\n\nfunction warnObjectAttribute(element: object, name: string, value: string): void {\n if (toldObjectAttribute.has(element)) return;\n toldObjectAttribute.add(element);\n const tag = (element as { localName?: string }).localName ?? \"element\";\n console.warn(\n `[wcs/input-as-attribute] <${tag}> has the attribute ${name}=\"${value}\": an object was written as an ` +\n `attribute, so the element did not receive it. A framework does that when the property is set before the ` +\n `element's definition loads (React 19), or when told to (Vue's .attr). Load the definition before rendering, ` +\n `or assign the property through a ref (Vue: .prop). (Said once per element.)`,\n element,\n );\n}\n\n/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n * - 値が `[object …]` の属性(属性に書かれてしまったオブジェクトの入力)は、要素ごとに 1 回警告する。\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 const getAttribute = (element as { getAttribute?: (name: string) => string | null }).getAttribute;\n for (const input of inputs) {\n const name = input.name;\n const attribute = typeof getAttribute === \"function\" ? getAttribute.call(element, name.toLowerCase()) : null;\n if (attribute !== null && attribute.startsWith(\"[object \")) warnObjectAttribute(element, name, attribute);\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","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/input-attribute.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// 属性へ反映する wc-bindable 入力の producer 側(SPEC-extensions § Producer guidance for inputs の P1〜P3)。\n// 入力の setter は属性をこの 2 関数で書く。それで次が揃う:\n// - `undefined` は「値が無い」(P1): 属性を、この関数で最初に書く前の状態 — マークアップに書かれた値、\n// 無ければ属性なし(= その入力の文書化した既定値)— へ戻す。applier プロファイルを宣言する binder は\n// 値の後の `undefined` を書き(A2)、React 19 も書き、直接の代入でも届く。\n// - `null` はクリア(P2): 属性なし、つまり文書化した既定値。\n// - どちらも文字列 \"undefined\" / \"null\" として属性に入らない。\n//\n// 「最初に書く前」は、その最初の書き込みのときに読む(遅延)。upgrade 前に代入されたプロパティは\n// connectedCallback の upgradeProperties() が通し直すので、そのときにはパーサが書いた属性が揃っている。\n// 要素自身が setter を通さずに書いた属性は、最初の書き込みより前なら「最初の状態」に含まれる。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/input-attribute.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/inputAttribute.ts). Those copies are generated — do not edit them.\n\nconst initialAttributes = new WeakMap<Element, Map<string, string | null>>();\n\n/** The attribute as it stood before the first write through these helpers. */\nfunction initialAttribute(el: Element, name: string): string | null {\n let byName = initialAttributes.get(el);\n if (byName === undefined) {\n byName = new Map();\n initialAttributes.set(el, byName);\n }\n if (!byName.has(name)) byName.set(name, el.getAttribute(name));\n return byName.get(name) as string | null;\n}\n\nfunction writeAttribute(el: Element, name: string, value: string | null): void {\n if (value === null) el.removeAttribute(name);\n else el.setAttribute(name, value);\n}\n\n/**\n * A value attribute. `value` is written as `String(value)`; `null` removes the attribute;\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value === null ? null : String(value));\n}\n\n/**\n * A boolean attribute, present while `value` is truthy (`null` and `false` remove it);\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectBooleanAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value ? \"\" : null);\n}\n","import { IWcBindable } from \"../types.js\";\nimport { PointerLockCore } from \"../core/PointerLockCore.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.js\";\nimport { reflectAttribute } from \"../protocol/inputAttribute.js\";\n\n/**\n * `<wcs-pointer-lock target=\"...\">` — declarative Pointer Lock API control.\n *\n * Like `<wcs-fullscreen>` (docs/fullscreen-tag-design.md §0), this Shell does\n * not lock itself — it operates on a *referenced* element via the `target`\n * attribute, using the same 3-mode resolution rule as `intersection`\n * (`_resolveTarget()`/`_safeQuery()`, copied verbatim per\n * docs/pointer-lock-tag-design.md §1 / docs/fullscreen-tag-design.md §1):\n *\n * | `target` | operates on | display |\n * |-----------------|-------------------------|-------------|\n * | omitted | first element child | `contents` |\n * | `\"#selector\"` | the matched element | `none` |\n * | `\"self\"` | the element itself | `block` |\n *\n * `requestPointerLock()` requires a user-gesture context (docs/fullscreen-tag-design.md\n * §3) — the primary activation path is the command-token protocol\n * (`command.requestPointerLock: $command.<token>` on `<wcs-pointer-lock>`,\n * emitted by a button's `onclick: $command.<token>`), not an\n * autoTrigger attribute (none is provided in v1,\n * docs/pointer-lock-tag-design.md §4).\n *\n * `movementX`/`movementY` are intentionally out of scope for v1\n * (docs/pointer-lock-tag-design.md §3) — do not add them without revisiting\n * the design doc.\n */\nexport class WcsPointerLock extends HTMLElement {\n // SSR (§4.4): the Core subscribes synchronously on connect, but the Shell\n // still exposes connectedCallbackPromise so the state binder can await it\n // uniformly across all IO nodes before snapshotting.\n static hasConnectedCallbackPromise = true;\n\n static observedAttributes = [\"target\"];\n\n static wcBindable: IWcBindable = {\n ...PointerLockCore.wcBindable,\n inputs: [{ name: \"target\", attribute: \"target\" }],\n // Core の commands をそのまま継承(単一情報源)。network/intersection と同型。\n commands: PointerLockCore.wcBindable.commands,\n };\n\n private _core: PointerLockCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new PointerLockCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-pointer-lock:change\": (d) => ({ active: d === true }),\n });\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\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 (docs/custom-state-reflection-design.md §3.6): attachInternals\n // is absent 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 // --- Attribute accessors ---\n\n get target(): string {\n return this.getAttribute(\"target\") ?? \"\";\n }\n\n // Never lets setAttribute stringify null / undefined (an \"undefined\" selector\n // resolves nothing): `null` removes the attribute (the first-child default),\n // `undefined` restores the attribute the element started with (wc-bindable\n // producer guidance P1; React 19 and a direct assignment deliver it,\n // @wcstack/state does not).\n set target(value: string | null | undefined) {\n reflectAttribute(this, \"target\", value);\n }\n\n // --- Core delegated getters ---\n\n get active(): boolean {\n return this._core.active;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get errorInfo(): WcsIoErrorInfo | null {\n return this._core.errorInfo;\n }\n\n // Whether this page has the Pointer Lock API — probed at call time by the\n // Core (never cached), so a state binding that reads it when it attaches gets\n // the right value without waiting for `wcs-pointer-lock:supported-changed`.\n get supported(): boolean {\n return this._core.supported;\n }\n\n // --- Commands ---\n\n /**\n * Resolve `target` and request pointer lock on it. Requires a user-gesture\n * context. never-throw: an unresolvable target or an unsupported/rejected\n * API call are both surfaced via `error`, never thrown (mirrors\n * `<wcs-fullscreen>`'s `requestFullscreen()`, docs/fullscreen-tag-design.md\n * §3/§6 — the Shell passes the (possibly `null`) resolved element straight\n * through and lets the Core set `error`, rather than silently no-op'ing\n * here).\n */\n async requestPointerLock(): Promise<void> {\n const { element } = this._resolveTarget();\n await this._core.requestPointerLock(element);\n }\n\n /** Exit pointer lock. Synchronous command — silent no-op if nothing is locked. */\n exitPointerLock(): void {\n this._core.exitPointerLock();\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n // upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)\n upgradeProperties(this);\n this._applyDisplayAndObserve();\n }\n\n // dispose() publishes `active: false` when it was true (timing contract §22):\n // out of the document this element hears no pointerlockchange, and the browser\n // releases the lock when the target leaves with it. Nothing is released here;\n // the next connectedCallback re-reads the truth through observe().\n disconnectedCallback(): void {\n this._core.dispose();\n }\n\n attributeChangedCallback(name: string): void {\n if (name === \"target\" && this.isConnected) {\n this._applyDisplayAndObserve();\n }\n }\n\n // --- Internal ---\n\n private _applyDisplayAndObserve(): void {\n const { element, display } = this._resolveTarget();\n this.style.display = display;\n this._connectedCallbackPromise = this._core.observe(element);\n }\n\n // Copied verbatim from packages/intersection/src/components/Intersect.ts\n // (§1 of docs/pointer-lock-tag-design.md / docs/fullscreen-tag-design.md).\n private _resolveTarget(): { element: Element | null; display: string } {\n const target = this.target;\n if (target === \"self\") {\n return { element: this, display: \"block\" };\n }\n if (target !== \"\") {\n const scope = this.getRootNode() as Document | ShadowRoot;\n return { element: this._safeQuery(scope, target), display: \"none\" };\n }\n const child = this.firstElementChild;\n if (child) {\n return { element: child, display: \"contents\" };\n }\n return { element: this, display: \"block\" };\n }\n\n // Copied verbatim from packages/intersection/src/components/Intersect.ts.\n private _safeQuery(scope: Document | ShadowRoot, selector: string): Element | null {\n try {\n return scope.querySelector(selector);\n } catch {\n return null;\n }\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/define-element.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * One copy of each package on a page (docs/timing-and-firing-contract.md §24). The first copy the\n * page evaluates defines the tags and a second one does nothing, so a copy that finds its tag defined\n * by another copy of the package — not its class, not a subclass of it, not the same version — warns\n * `[wcs/package-twice]` once per registry, naming both versions. The classes it defines carry\n * `\"<package>@<version>\"` under `Symbol.for(\"wcstack.package\")`; a class without it is named\n * \"another copy of <package> that does not name its version\" (an older copy, or one loaded through\n * an entry that does not stamp).\n */\n\n/** The static a class defined through this helper carries: `\"@wcstack/fetch@<version>\"`. */\nexport const PACKAGE_STAMP: unique symbol = Symbol.for(\"wcstack.package\");\n\ntype Stamped = { [PACKAGE_STAMP]?: string };\n\n/** The registries this copy warned about: one warning per package per registry. */\nconst warned = new WeakSet<CustomElementRegistry>();\n\n/**\n * Marks `cls` as defined by `pkg` (`\"@wcstack/fetch@<version>\"`). A subclass inherits the mark, and\n * `defineProperty` writes it even where a parent's mark is read-only.\n */\nexport function stampPackage(cls: CustomElementConstructor, pkg: string): void {\n Object.defineProperty(cls, PACKAGE_STAMP, { value: pkg, configurable: true });\n}\n\n/**\n * Warns when `tag` is defined as `existing` by another copy of the package `pkg` names: `existing`\n * is neither `own` nor a subclass of it (omit `own` when the copy has no class to compare with), and\n * carries another version or none. Once per registry.\n */\nexport function warnIfAnotherCopy(\n registry: CustomElementRegistry,\n tag: string,\n existing: CustomElementConstructor,\n own: CustomElementConstructor | undefined,\n pkg: string,\n): void {\n if (own !== undefined && (existing === own || existing.prototype instanceof own)) return;\n const theirs = (existing as Stamped)[PACKAGE_STAMP];\n if (theirs === pkg || warned.has(registry)) return;\n warned.add(registry);\n const name = pkg.slice(0, pkg.lastIndexOf(\"@\"));\n console.warn(\n `[${name}] [wcs/package-twice] <${tag}> is already defined by ` +\n `${theirs ?? `another copy of ${name} that does not name its version`}; ` +\n `this copy, ${pkg}, does nothing. Load each package once.`,\n );\n}\n\n/**\n * Defines each `[tag, class]` in `registry` unless the tag is already defined, stamping the class\n * with `pkg` (`\"@wcstack/fetch@<version>\"`). A tag another copy of the package defined first is left\n * as it is, with the warning above.\n */\nexport function defineElements(\n registry: CustomElementRegistry,\n pkg: string,\n definitions: readonly (readonly [tag: string, cls: CustomElementConstructor])[],\n): void {\n for (const [tag, cls] of definitions) {\n const existing = registry.get(tag);\n if (existing === undefined) {\n stampPackage(cls, pkg);\n registry.define(tag, cls);\n } else {\n warnIfAnotherCopy(registry, tag, existing, cls, pkg);\n }\n }\n}\n","import pkg from \"../package.json\" with { type: \"json\" };\nimport { WcsPointerLock } from \"./components/PointerLock.js\";\nimport { config } from \"./config.js\";\nimport { defineElements } from \"./protocol/defineElement.js\";\n\n/**\n * Register this package's tags. Pass a scoped `CustomElementRegistry` to define\n * them for a single shadow tree -- scoped registries do not inherit the global\n * one, so a tree using one needs its own definitions.\n */\nexport function registerComponents(registry: CustomElementRegistry = customElements): void {\n defineElements(registry, `${pkg.name}@${pkg.version}`, [\n [config.tagNames.pointerLock, WcsPointerLock],\n ]);\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapPointerLock(userConfig?: IWritableConfig, registry?: CustomElementRegistry): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents(registry);\n}\n"],"names":["config","tagNames","pointerLock","WCS_POINTER_LOCK_ERROR_CODE","derivePointerLockErrorInfo","error","kind","message","String","messageOf","code","phase","recoverable","name","refusedByEvent","DOMException","PointerLockCore","EventTarget","static","protocol","version","properties","event","semantics","commands","async","_target","_active","_error","_errorInfo","_resolvedTarget","_subscribed","_gen","_request","_supportedPublished","_ready","Promise","resolve","constructor","target","super","this","ready","active","errorInfo","supported","proto","Element","prototype","requestPointerLock","webkitRequestPointerLock","observe","_publishSupported","document","addEventListener","_pointerLockChangeEventName","_onChange","_pointerLockErrorEventName","_onLockError","_applyActive","dispose","removeEventListener","_setActive","element","gen","_setError","fn","_requestPointerLockFn","request","waiting","refused","result","then","e","exitPointerLock","_pointerLockElement","_exitPointerLockFn","el","standard","bind","legacy","undefined","d","webkitExitPointerLock","pointerLockElement","webkitPointerLockElement","dispatchEvent","CustomEvent","detail","bubbles","next","v","_commitErrorInfo","info","hasAccessorOnPrototype","Object","getPrototypeOf","descriptor","getOwnPropertyDescriptor","get","set","toldObjectAttribute","WeakSet","warnObjectAttribute","value","has","add","tag","localName","console","warn","initialAttributes","WeakMap","reflectAttribute","initial","byName","Map","getAttribute","initialAttribute","removeAttribute","setAttribute","writeAttribute","WcsPointerLock","HTMLElement","wcBindable","inputs","attribute","_core","_connectedCallbackPromise","_internals","_initInternals","_wireStates","connectedCallbackPromise","debugStates","states","attachInternals","internals","delete","map","toStates","entries","debug","hasAttribute","on","toggleAttribute","_resolveTarget","connectedCallback","declaration","input","call","toLowerCase","startsWith","hasOwnProperty","record","upgradeProperties","_applyDisplayAndObserve","disconnectedCallback","attributeChangedCallback","isConnected","display","style","scope","getRootNode","_safeQuery","child","firstElementChild","selector","querySelector","PACKAGE_STAMP","Symbol","for","warned","stampPackage","cls","pkg","defineProperty","configurable","warnIfAnotherCopy","registry","existing","own","theirs","slice","lastIndexOf","registerComponents","customElements","definitions","define","defineElements"],"mappings":"AAQA,MA0BaA,EA1BoB,CAC/BC,SAAU,CACRC,YAAa,8DCUV,MAAMC,EAEQ,qBAFRA,EAIM,mBAJNA,EAMC,cANDA,EAQO,qBAed,SAAUC,EAA2BC,EAAgBC,GACzD,MAAMC,EAbR,SAAmBF,GACjB,MAAmE,iBAApDA,GAAwCE,QAClDF,EAA8BE,QAC/BC,OAAOH,EACb,CASkBI,CAAUJ,GAC1B,GAAa,uBAATC,EACF,MAAO,CAAEI,KAAMP,EAA+CQ,MAAO,QAASC,aAAa,EAAOL,WAEpG,GAAa,qBAATD,EACF,MAAO,CAAEI,KAAMP,EAA6CQ,MAAO,QAASC,aAAa,EAAOL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U,EAAmBN,EAAkCO,0BDoDnEP,EACAJ,EACAY,GAEA,IAAK,MAAO/E,EAAKkE,KAAQa,EAAa,CACpC,MAAMP,EAAWD,EAAS/E,IAAIQ,QACb1B,IAAbkG,GACFP,EAAaC,EAAKC,GAClBI,EAASS,OAAOhF,EAAKkE,IAErBI,EAAkBC,EAAUvE,EAAKwE,EAAUN,EAAKC,EAEpD,CACF,CChEEc,CAAeV,EAAU,GAAGJ,KAAYA,IAAe,CACrD,CAAC9K,EAAOC,SAASC,YAAawH,IAElC,CCVM,IAA6DwD,EAIjEM,EAAmBN"}
|
package/dist/index.d.ts
CHANGED
|
@@ -68,6 +68,8 @@ interface IWritableConfig {
|
|
|
68
68
|
* `:error` / `:error-info-changed`), so a wc-bindable binding core delivers a
|
|
69
69
|
* request/exit failure. `errorInfo` is the additive serializable failure
|
|
70
70
|
* taxonomy derived from `error` (docs/pointer-lock-tag-design.md §2, README).
|
|
71
|
+
* `supported` (`wcs-pointer-lock:supported-changed`) says whether this page has
|
|
72
|
+
* the Pointer Lock API at all.
|
|
71
73
|
*
|
|
72
74
|
* @example
|
|
73
75
|
* ```typescript
|
|
@@ -80,10 +82,12 @@ interface WcsPointerLockCoreValues {
|
|
|
80
82
|
error: any;
|
|
81
83
|
/** Additive failure taxonomy derived from `error` (stable code / phase / recoverable). */
|
|
82
84
|
errorInfo: WcsIoErrorInfo | null;
|
|
85
|
+
/** Whether this page has the Pointer Lock API (an element has `requestPointerLock()`). */
|
|
86
|
+
supported: boolean;
|
|
83
87
|
}
|
|
84
88
|
/**
|
|
85
89
|
* Value types for the Shell (`<wcs-pointer-lock>`) — identical value surface
|
|
86
|
-
* to the Core (`active` / `error` / `errorInfo` all observable). The Shell
|
|
90
|
+
* to the Core (`active` / `error` / `errorInfo` / `supported` all observable). The Shell
|
|
87
91
|
* additionally accepts a `target` attribute
|
|
88
92
|
* (see docs/pointer-lock-tag-design.md / docs/fullscreen-tag-design.md §1).
|
|
89
93
|
*/
|
|
@@ -131,6 +135,8 @@ declare class PointerLockCore extends EventTarget {
|
|
|
131
135
|
private _resolvedTarget;
|
|
132
136
|
private _subscribed;
|
|
133
137
|
private _gen;
|
|
138
|
+
private _request;
|
|
139
|
+
private _supportedPublished;
|
|
134
140
|
private _ready;
|
|
135
141
|
constructor(target?: EventTarget);
|
|
136
142
|
get ready(): Promise<void>;
|
|
@@ -143,6 +149,16 @@ declare class PointerLockCore extends EventTarget {
|
|
|
143
149
|
* `error` value shape is unchanged.
|
|
144
150
|
*/
|
|
145
151
|
get errorInfo(): WcsIoErrorInfo | null;
|
|
152
|
+
/**
|
|
153
|
+
* Whether this page has the Pointer Lock API right now: an element has
|
|
154
|
+
* `requestPointerLock()` (or the prefixed `webkitRequestPointerLock()`). Probed
|
|
155
|
+
* at call time, never cached. No Permissions-Policy feature governs pointer
|
|
156
|
+
* lock, so there is no policy to ask. It does not say that a request will
|
|
157
|
+
* succeed (that needs a user gesture, and a sandboxed `<iframe>` needs
|
|
158
|
+
* `allow-pointer-lock`). A wc-bindable output (event
|
|
159
|
+
* `wcs-pointer-lock:supported-changed`).
|
|
160
|
+
*/
|
|
161
|
+
get supported(): boolean;
|
|
146
162
|
observe(target: Element | null): Promise<void>;
|
|
147
163
|
dispose(): void;
|
|
148
164
|
/**
|
|
@@ -172,7 +188,10 @@ declare class PointerLockCore extends EventTarget {
|
|
|
172
188
|
private _exitPointerLockFn;
|
|
173
189
|
private _pointerLockElement;
|
|
174
190
|
private _pointerLockChangeEventName;
|
|
191
|
+
private _pointerLockErrorEventName;
|
|
175
192
|
private _onChange;
|
|
193
|
+
private _onLockError;
|
|
194
|
+
private _publishSupported;
|
|
176
195
|
private _applyActive;
|
|
177
196
|
private _setActive;
|
|
178
197
|
private _setError;
|
|
@@ -222,6 +241,7 @@ declare class WcsPointerLock extends HTMLElement {
|
|
|
222
241
|
get active(): boolean;
|
|
223
242
|
get error(): any;
|
|
224
243
|
get errorInfo(): WcsIoErrorInfo | null;
|
|
244
|
+
get supported(): boolean;
|
|
225
245
|
/**
|
|
226
246
|
* Resolve `target` and request pointer lock on it. Requires a user-gesture
|
|
227
247
|
* context. never-throw: an unresolvable target or an unsupported/rejected
|
package/dist/index.esm.js
CHANGED
|
@@ -58,7 +58,7 @@ function setConfig(partialConfig) {
|
|
|
58
58
|
frozenConfig = null;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
var pkg = {"name":"@wcstack/pointer-lock","version":"4.
|
|
61
|
+
var pkg = {"name":"@wcstack/pointer-lock","version":"4.26.0"};
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
64
|
* pointerLockCapabilities.ts
|
|
@@ -110,6 +110,12 @@ function derivePointerLockErrorInfo(error, kind) {
|
|
|
110
110
|
return { code: WCS_POINTER_LOCK_ERROR_CODE.PointerLockError, phase: "execute", recoverable: false, message };
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
// What a refusal that arrives as an event is reported as. The event carries no
|
|
114
|
+
// reason, so the message says no more than that; `NotAllowedError` puts it in
|
|
115
|
+
// the `not-allowed` class (recoverable: a request from a user gesture may pass).
|
|
116
|
+
function refusedByEvent() {
|
|
117
|
+
return new DOMException("The browser refused the pointer lock request.", "NotAllowedError");
|
|
118
|
+
}
|
|
113
119
|
/**
|
|
114
120
|
* Headless Pointer Lock primitive. A thin, framework-agnostic wrapper around
|
|
115
121
|
* the Pointer Lock API (`Element.requestPointerLock()` /
|
|
@@ -156,6 +162,11 @@ class PointerLockCore extends EventTarget {
|
|
|
156
162
|
// drives a referenced element, not a competing operation.
|
|
157
163
|
{ name: "error", event: "wcs-pointer-lock:error", semantics: "state" },
|
|
158
164
|
{ name: "errorInfo", event: "wcs-pointer-lock:error-info-changed", semantics: "state" },
|
|
165
|
+
// Whether this page has the Pointer Lock API (an element has
|
|
166
|
+
// requestPointerLock() or the prefixed name). Computed at call time; the
|
|
167
|
+
// event carries the boolean and fires from observe() when it differs from
|
|
168
|
+
// the last value dispatched.
|
|
169
|
+
{ name: "supported", event: "wcs-pointer-lock:supported-changed", semantics: "state" },
|
|
159
170
|
],
|
|
160
171
|
commands: [
|
|
161
172
|
{ name: "requestPointerLock", async: true },
|
|
@@ -182,6 +193,15 @@ class PointerLockCore extends EventTarget {
|
|
|
182
193
|
// needs it. exitPointerLock() is synchronous and has no stale-resolution
|
|
183
194
|
// race to guard against.
|
|
184
195
|
_gen = 0;
|
|
196
|
+
// The request this instance made that an event may still answer, or null.
|
|
197
|
+
// Chromium and WebKit answer with the call's promise; Firefox (and the prefixed
|
|
198
|
+
// API) return nothing and answer with pointerlockchange / pointerlockerror on
|
|
199
|
+
// the document. A pointerlockerror is this instance's only while this is set
|
|
200
|
+
// and waiting — the event does not say whose request failed.
|
|
201
|
+
_request = null;
|
|
202
|
+
// `supported` as last dispatched (never the value itself — the getter probes at
|
|
203
|
+
// call time). Starts at false, so observe() announces a page that has the API.
|
|
204
|
+
_supportedPublished = false;
|
|
185
205
|
// SSR (§3.8): no asynchronous probe to await — observe() completes
|
|
186
206
|
// synchronously, so readiness is immediate.
|
|
187
207
|
_ready = Promise.resolve();
|
|
@@ -207,24 +227,48 @@ class PointerLockCore extends EventTarget {
|
|
|
207
227
|
get errorInfo() {
|
|
208
228
|
return this._errorInfo;
|
|
209
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* Whether this page has the Pointer Lock API right now: an element has
|
|
232
|
+
* `requestPointerLock()` (or the prefixed `webkitRequestPointerLock()`). Probed
|
|
233
|
+
* at call time, never cached. No Permissions-Policy feature governs pointer
|
|
234
|
+
* lock, so there is no policy to ask. It does not say that a request will
|
|
235
|
+
* succeed (that needs a user gesture, and a sandboxed `<iframe>` needs
|
|
236
|
+
* `allow-pointer-lock`). A wc-bindable output (event
|
|
237
|
+
* `wcs-pointer-lock:supported-changed`).
|
|
238
|
+
*/
|
|
239
|
+
get supported() {
|
|
240
|
+
const proto = Element.prototype;
|
|
241
|
+
return typeof proto.requestPointerLock === "function" || typeof proto.webkitRequestPointerLock === "function";
|
|
242
|
+
}
|
|
210
243
|
// Lifecycle (§3.5). Idempotent: a second observe() while already subscribed
|
|
211
244
|
// updates the tracked resolved target without re-subscribing to `document`.
|
|
245
|
+
// Also publishes `supported` when it differs from the last value dispatched.
|
|
212
246
|
observe(target) {
|
|
247
|
+
this._publishSupported();
|
|
213
248
|
this._resolvedTarget = target;
|
|
214
249
|
if (!this._subscribed) {
|
|
215
250
|
this._subscribed = true;
|
|
216
251
|
document.addEventListener(this._pointerLockChangeEventName(), this._onChange);
|
|
252
|
+
document.addEventListener(this._pointerLockErrorEventName(), this._onLockError);
|
|
217
253
|
}
|
|
218
254
|
this._applyActive();
|
|
219
255
|
return this._ready;
|
|
220
256
|
}
|
|
221
257
|
dispose() {
|
|
222
258
|
this._gen++; // invalidate any in-flight requestPointerLock() resolution
|
|
259
|
+
this._request = null;
|
|
223
260
|
if (this._subscribed) {
|
|
224
261
|
this._subscribed = false;
|
|
225
262
|
document.removeEventListener(this._pointerLockChangeEventName(), this._onChange);
|
|
263
|
+
document.removeEventListener(this._pointerLockErrorEventName(), this._onLockError);
|
|
226
264
|
}
|
|
227
265
|
this._resolvedTarget = null;
|
|
266
|
+
// A disposed Core hears no pointerlockchange, so it can no longer vouch for
|
|
267
|
+
// `active`: publish false through the normal setter (timing contract §22 — a
|
|
268
|
+
// disconnect publishes what it changes). The lock itself is not released
|
|
269
|
+
// here; observe() re-reads the truth — publishing true again — on the next
|
|
270
|
+
// connect.
|
|
271
|
+
this._setActive(false);
|
|
228
272
|
}
|
|
229
273
|
/**
|
|
230
274
|
* Request pointer lock on `element`. Never-throw: a missing API or a
|
|
@@ -240,6 +284,7 @@ class PointerLockCore extends EventTarget {
|
|
|
240
284
|
async requestPointerLock(element) {
|
|
241
285
|
const gen = ++this._gen;
|
|
242
286
|
this._resolvedTarget = element;
|
|
287
|
+
this._request = null; // this call supersedes the request before it
|
|
243
288
|
if (!element) {
|
|
244
289
|
this._setError({ message: "Pointer Lock target could not be resolved." }, "invalid-argument");
|
|
245
290
|
return;
|
|
@@ -253,17 +298,42 @@ class PointerLockCore extends EventTarget {
|
|
|
253
298
|
this._setError({ message: "Pointer Lock API is not supported." }, "capability-missing");
|
|
254
299
|
return;
|
|
255
300
|
}
|
|
301
|
+
const request = { waiting: false, refused: false };
|
|
302
|
+
this._request = request;
|
|
256
303
|
try {
|
|
257
304
|
// fn is already bound to `element` by _requestPointerLockFn().
|
|
258
|
-
|
|
259
|
-
if (
|
|
260
|
-
|
|
305
|
+
const result = fn();
|
|
306
|
+
if (typeof result?.then === "function") {
|
|
307
|
+
// Chromium and WebKit: the call's promise answers this request, and it
|
|
308
|
+
// alone. They fire pointerlockerror for the same refusal as well — WebKit
|
|
309
|
+
// before it rejects the promise — and the rejection carries the reason,
|
|
310
|
+
// so the event is not this request's answer.
|
|
311
|
+
this._request = null;
|
|
312
|
+
await result;
|
|
313
|
+
if (gen !== this._gen)
|
|
314
|
+
return; // stale
|
|
315
|
+
this._setError(null);
|
|
316
|
+
this._applyActive();
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
// Firefox (and the prefixed API) return nothing: the answer is a
|
|
320
|
+
// pointerlockchange or a pointerlockerror on the document.
|
|
321
|
+
if (request.refused) {
|
|
322
|
+
// The event fired inside the call itself.
|
|
323
|
+
this._request = null;
|
|
324
|
+
this._setError(refusedByEvent());
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
// The request is made: the failure before it is no longer the latest
|
|
328
|
+
// attempt's. From here the events answer.
|
|
261
329
|
this._setError(null);
|
|
262
330
|
this._applyActive();
|
|
331
|
+
request.waiting = true;
|
|
263
332
|
}
|
|
264
333
|
catch (e) {
|
|
265
334
|
if (gen !== this._gen)
|
|
266
335
|
return; // stale
|
|
336
|
+
this._request = null;
|
|
267
337
|
this._setError(e);
|
|
268
338
|
}
|
|
269
339
|
}
|
|
@@ -339,9 +409,51 @@ class PointerLockCore extends EventTarget {
|
|
|
339
409
|
_pointerLockChangeEventName() {
|
|
340
410
|
return "onpointerlockchange" in document ? "pointerlockchange" : "webkitpointerlockchange";
|
|
341
411
|
}
|
|
412
|
+
// Picked the same way as the change event's name above. Unlike that one, this
|
|
413
|
+
// branch is driven in the tests (mocks.ts removes `onpointerlockerror` from
|
|
414
|
+
// the prototype that owns it).
|
|
415
|
+
_pointerLockErrorEventName() {
|
|
416
|
+
return "onpointerlockerror" in document ? "pointerlockerror" : "webkitpointerlockerror";
|
|
417
|
+
}
|
|
342
418
|
_onChange = () => {
|
|
343
419
|
this._applyActive();
|
|
420
|
+
// The target is locked: a request that was waiting for its answer has it.
|
|
421
|
+
if (this._active)
|
|
422
|
+
this._request = null;
|
|
344
423
|
};
|
|
424
|
+
// A refusal that arrives as an event. Firefox reports a refused
|
|
425
|
+
// requestPointerLock() (no user gesture, say) only here — the call returns no
|
|
426
|
+
// promise to reject. A request whose call returned a promise is not waiting
|
|
427
|
+
// for this event (`_request` is null from the moment the call returned), so a
|
|
428
|
+
// refusal the promise reports is never reported a second time. The event fires
|
|
429
|
+
// on the document without saying whose request failed: with no request waiting
|
|
430
|
+
// here, it is another instance's (or the page's own call) and is ignored.
|
|
431
|
+
_onLockError = () => {
|
|
432
|
+
const request = this._request;
|
|
433
|
+
if (request === null)
|
|
434
|
+
return;
|
|
435
|
+
if (!request.waiting) {
|
|
436
|
+
// Inside the platform call: whether a promise answers is not known yet.
|
|
437
|
+
request.refused = true;
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
this._request = null;
|
|
441
|
+
this._setError(refusedByEvent());
|
|
442
|
+
};
|
|
443
|
+
// `supported` is probed at call time, so there is no stored value to set: this
|
|
444
|
+
// dispatches the current one when it differs from the last one dispatched
|
|
445
|
+
// (same-value guard). A state binding reads the property when it attaches; the
|
|
446
|
+
// event is for every other listener.
|
|
447
|
+
_publishSupported() {
|
|
448
|
+
const supported = this.supported;
|
|
449
|
+
if (this._supportedPublished === supported)
|
|
450
|
+
return;
|
|
451
|
+
this._supportedPublished = supported;
|
|
452
|
+
this._target.dispatchEvent(new CustomEvent("wcs-pointer-lock:supported-changed", {
|
|
453
|
+
detail: supported,
|
|
454
|
+
bubbles: true,
|
|
455
|
+
}));
|
|
456
|
+
}
|
|
345
457
|
// Self-filter (docs/fullscreen-tag-design.md §2.1): compares against this
|
|
346
458
|
// instance's own resolved target, not merely "is *something* locked" — so
|
|
347
459
|
// multiple concurrent instances each report the correct `active` value.
|
|
@@ -622,6 +734,12 @@ class WcsPointerLock extends HTMLElement {
|
|
|
622
734
|
get errorInfo() {
|
|
623
735
|
return this._core.errorInfo;
|
|
624
736
|
}
|
|
737
|
+
// Whether this page has the Pointer Lock API — probed at call time by the
|
|
738
|
+
// Core (never cached), so a state binding that reads it when it attaches gets
|
|
739
|
+
// the right value without waiting for `wcs-pointer-lock:supported-changed`.
|
|
740
|
+
get supported() {
|
|
741
|
+
return this._core.supported;
|
|
742
|
+
}
|
|
625
743
|
// --- Commands ---
|
|
626
744
|
/**
|
|
627
745
|
* Resolve `target` and request pointer lock on it. Requires a user-gesture
|
|
@@ -646,6 +764,10 @@ class WcsPointerLock extends HTMLElement {
|
|
|
646
764
|
upgradeProperties(this);
|
|
647
765
|
this._applyDisplayAndObserve();
|
|
648
766
|
}
|
|
767
|
+
// dispose() publishes `active: false` when it was true (timing contract §22):
|
|
768
|
+
// out of the document this element hears no pointerlockchange, and the browser
|
|
769
|
+
// releases the lock when the target leaves with it. Nothing is released here;
|
|
770
|
+
// the next connectedCallback re-reads the truth through observe().
|
|
649
771
|
disconnectedCallback() {
|
|
650
772
|
this._core.dispose();
|
|
651
773
|
}
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../src/config.ts","../../src/core/pointerLockCapabilities.ts","../../src/core/PointerLockCore.ts","../../src/protocol/upgradeProperties.ts","../../src/protocol/inputAttribute.ts","../../src/components/PointerLock.ts","../../src/protocol/defineElement.ts","../../src/registerComponents.ts","../../src/bootstrapPointerLock.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n pointerLock: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n pointerLock: \"wcs-pointer-lock\",\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\n/** A misspelt option would otherwise do nothing: `bootstrapPointerLock` refuses it. */\nfunction invalid(key: string): never {\n throw new Error(`[@wcstack/pointer-lock] bootstrapPointerLock: \"${key}\" is not one of its options, or not of the option's type.`);\n}\n\n/**\n * Applies the options given; an undefined value is left out. An option this package does not\n * have, a value of another type than its default (null, or an array for an object, included) or\n * a tag name it does not define throws, and then nothing is applied.\n */\nexport function setConfig(partialConfig: IWritableConfig): void {\n const options = _config as unknown as Record<string, unknown>;\n const tags = _config.tagNames as Record<string, string>;\n const given = Object.entries(partialConfig).filter(([, value]) => value !== undefined);\n const givenTags = Object.entries(partialConfig.tagNames ?? {}).filter(([, tag]) => tag !== undefined);\n for (const [key, value] of given) {\n const current = options[key];\n if (!Object.hasOwn(options, key) || value === null || typeof value !== typeof current || Array.isArray(value) !== Array.isArray(current)) {\n invalid(key);\n }\n }\n for (const [name, tag] of givenTags) {\n if (!Object.hasOwn(tags, name) || typeof tag !== \"string\") invalid(`tagNames.${name}`);\n }\n for (const [name, tag] of givenTags) tags[name] = tag as string;\n frozenConfig = null;\n}\n","/**\n * pointerLockCapabilities.ts\n *\n * Pointer Lock node 固有の error code(taxonomy)と derivation。汎用の error info 型は\n * `./platformCapability.js`(/io-core/ から copy-distribution される生成ファイル)から\n * import する。pointer-lock は referenced element を操作するモニタ的ノードで競合 operation\n * を持たないため lane は無く、error taxonomy(errorInfo)のみを採用する。\n *\n * `_setError` は合成 `{ message }`(target 未解決 / API 非対応)と caught 例外\n * (`NotAllowedError` / `TypeError` = user gesture 外の requestPointerLock 拒否)を混在\n * 受理する。呼出側が明示 `kind` を渡して合成側を曖昧さ無く分類し、caught は `.name` で\n * 分類する(fullscreen と同じ discriminator 方式)。\n */\n\nimport type { WcsIoErrorInfo } from \"./platformCapability.js\";\n\n/** 明示 kind discriminator(合成エラーの呼出側が渡す)。 */\nexport type PointerLockErrorKind = \"capability-missing\" | \"invalid-argument\";\n\n/** 安定した pointer-lock error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_POINTER_LOCK_ERROR_CODE = {\n /** Pointer Lock API 非対応。 */\n CapabilityMissing: \"capability-missing\",\n /** target selector が要素に解決しない等の入力不備。 */\n InvalidArgument: \"invalid-argument\",\n /** `NotAllowedError` / `TypeError` — user gesture 外での要求拒否。 */\n NotAllowed: \"not-allowed\",\n /** その他の caught 例外。 */\n PointerLockError: \"pointer-lock-error\",\n} as const;\n\nfunction messageOf(error: unknown): string {\n return typeof (error as { message?: unknown } | null)?.message === \"string\"\n ? (error as { message: string }).message\n : String(error);\n}\n\n/**\n * pointer-lock の失敗を serializable な error taxonomy に写す。`kind` は合成エラーの\n * 呼出側が渡す明示 discriminator(`capability-missing` / `invalid-argument`)。未指定は\n * caught 例外を意味し、`.name` で分類する。`NotAllowedError` / `TypeError` は user\n * gesture 内で再試行すれば成功しうるため recoverable=true。\n */\nexport function derivePointerLockErrorInfo(error: unknown, kind?: PointerLockErrorKind): WcsIoErrorInfo {\n const message = messageOf(error);\n if (kind === \"capability-missing\") {\n return { code: WCS_POINTER_LOCK_ERROR_CODE.CapabilityMissing, phase: \"probe\", recoverable: false, message };\n }\n if (kind === \"invalid-argument\") {\n return { code: WCS_POINTER_LOCK_ERROR_CODE.InvalidArgument, phase: \"start\", recoverable: false, message };\n }\n const name = (error as { name?: unknown } | null)?.name;\n if (name === \"NotAllowedError\" || name === \"TypeError\") {\n return { code: WCS_POINTER_LOCK_ERROR_CODE.NotAllowed, phase: \"execute\", recoverable: true, message };\n }\n return { code: WCS_POINTER_LOCK_ERROR_CODE.PointerLockError, phase: \"execute\", recoverable: false, message };\n}\n","import { IWcBindable } from \"../types.js\";\nimport { WcsIoErrorInfo } from \"./platformCapability.js\";\nimport { derivePointerLockErrorInfo, PointerLockErrorKind } from \"./pointerLockCapabilities.js\";\n\n/**\n * Headless Pointer Lock primitive. A thin, framework-agnostic wrapper around\n * the Pointer Lock API (`Element.requestPointerLock()` /\n * `document.exitPointerLock()` / `document.pointerLockElement` / the\n * `document`-scoped `pointerlockchange` event) exposed through the\n * wc-bindable protocol.\n *\n * This Core follows the same basic pattern as `FullscreenCore`\n * (docs/fullscreen-tag-design.md, referenced by docs/pointer-lock-tag-design.md\n * §1): target resolution happens in the Shell, `pointerlockchange` is\n * subscribed on `document` (not on the target element) and each instance\n * self-filters by comparing `document.pointerLockElement` against its own\n * resolved target, API resolution is call-time (never cached) and probes the\n * standard name before the legacy (`webkit`-prefixed) name, and a single\n * Core-level `_gen` generation guard protects the asynchronous\n * `requestPointerLock()` call from stale resolution after dispose().\n *\n * Key difference from Fullscreen (docs/pointer-lock-tag-design.md §2):\n * `exitPointerLock()` is a *synchronous* platform API (it returns `void`, not\n * a `Promise`), so the Core's `exitPointerLock()` command is synchronous too\n * and carries no `_gen` guard of its own — it is wrapped in `try/catch` only\n * as a defensive measure (never-throw), not because it can go stale.\n *\n * Scope note (docs/pointer-lock-tag-design.md §3): `movementX`/`movementY`\n * are intentionally NOT exposed by this Core (v1 scope). They are\n * high-frequency `mousemove` data unsuited to the same-value-guarded\n * declarative `properties` surface; see the design doc for the rationale and\n * the planned `debounce`/`throttle`-based opt-in for a future version.\n */\nexport class PointerLockCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n // `active`'s CustomEvent detail is the bare boolean value itself — no\n // getter needed (docs/pointer-lock-tag-design.md §2). This differs from\n // FullscreenCore's `{ active }`-shaped detail + getter.\n properties: [\n { name: \"active\", event: \"wcs-pointer-lock:change\", semantics: \"state\" },\n // `error` / `errorInfo` are observable failure outputs. Historically `error`\n // was an imperative getter with no event; both are now bindable (event-backed)\n // so `data-wcs` / bind() can observe a request/exit failure. `errorInfo` is the\n // additive serializable taxonomy (stable code / phase / recoverable) derived\n // from `error`; the `error` value shape is unchanged. No lane — pointer-lock\n // drives a referenced element, not a competing operation.\n { name: \"error\", event: \"wcs-pointer-lock:error\", semantics: \"state\" },\n { name: \"errorInfo\", event: \"wcs-pointer-lock:error-info-changed\", semantics: \"state\" },\n ],\n commands: [\n { name: \"requestPointerLock\", async: true },\n // Synchronous platform API (document.exitPointerLock() returns void) —\n // no `async` flag (docs/pointer-lock-tag-design.md §2).\n { name: \"exitPointerLock\" },\n ],\n };\n\n private _target: EventTarget;\n private _active = false;\n private _error: any = null;\n private _errorInfo: WcsIoErrorInfo | null = null;\n\n // The element this instance last resolved requestPointerLock()/observe()\n // against, kept so the document-scoped `pointerlockchange` handler can\n // self-filter under multiple concurrent instances (docs/fullscreen-tag-design.md\n // §2.1, inherited verbatim by pointer-lock per docs/pointer-lock-tag-design.md §1).\n private _resolvedTarget: Element | null = null;\n\n // True once observe() has attached the live `document` listener. Guards\n // observe() so a redundant call does not re-subscribe; dispose() resets it\n // so a later observe() resumes cleanly.\n private _subscribed = false;\n\n // Core-level generation guard (§3.4 of the guidelines / §6 of\n // fullscreen-tag-design.md): only requestPointerLock() is asynchronous and\n // needs it. exitPointerLock() is synchronous and has no stale-resolution\n // race to guard against.\n private _gen = 0;\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 active(): boolean {\n return this._active;\n }\n\n get error(): any {\n return this._error;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable`), or null. Additive wc-bindable property (event\n * `wcs-pointer-lock:error-info-changed`), derived from `error`; the existing\n * `error` value shape is unchanged.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n // Lifecycle (§3.5). Idempotent: a second observe() while already subscribed\n // updates the tracked resolved target without re-subscribing to `document`.\n observe(target: Element | null): Promise<void> {\n this._resolvedTarget = target;\n if (!this._subscribed) {\n this._subscribed = true;\n document.addEventListener(this._pointerLockChangeEventName(), this._onChange);\n }\n this._applyActive();\n return this._ready;\n }\n\n dispose(): void {\n this._gen++; // invalidate any in-flight requestPointerLock() resolution\n if (this._subscribed) {\n this._subscribed = false;\n document.removeEventListener(this._pointerLockChangeEventName(), this._onChange);\n }\n this._resolvedTarget = null;\n }\n\n /**\n * Request pointer lock on `element`. Never-throw: a missing API or a\n * rejected promise (e.g. called outside a user-gesture context —\n * `NotAllowedError`, docs/fullscreen-tag-design.md §3) is captured into\n * `error` rather than propagated. `element` may be `null` when the Shell's\n * `target` selector did not resolve (docs/pointer-lock-tag-design.md §1\n * defers error representation to FullscreenCore verbatim — this null-target\n * case mirrors `FullscreenCore.requestFullscreen(null)`,\n * docs/fullscreen-tag-design.md §6): distinct from \"API is not supported\"\n * below, so a typo'd selector doesn't masquerade as an unsupported platform.\n */\n async requestPointerLock(element: Element | null): Promise<void> {\n const gen = ++this._gen;\n this._resolvedTarget = element;\n if (!element) {\n this._setError({ message: \"Pointer Lock target could not be resolved.\" }, \"invalid-argument\");\n return;\n }\n const fn = this._requestPointerLockFn(element);\n if (!fn) {\n // Resolved synchronously in the same tick as the call — dispose()\n // cannot have run yet, so no staleness check is needed here (matches\n // the reference `requestFullscreen()` implementation,\n // docs/fullscreen-tag-design.md §6).\n this._setError({ message: \"Pointer Lock API is not supported.\" }, \"capability-missing\");\n return;\n }\n try {\n // fn is already bound to `element` by _requestPointerLockFn().\n await fn();\n if (gen !== this._gen) return; // stale\n this._setError(null);\n this._applyActive();\n } catch (e: any) {\n if (gen !== this._gen) return; // stale\n this._setError(e);\n }\n }\n\n /**\n * Exit pointer lock. Synchronous platform API (docs/pointer-lock-tag-design.md\n * §2) — returns `void`, not a `Promise`. Silent no-op when nothing is\n * currently locked or the API is unsupported (mirrors\n * `FullscreenCore.exitFullscreen()`'s no-op contract,\n * docs/fullscreen-tag-design.md §7). Wrapped in try/catch defensively: even\n * though the platform API is synchronous and documented as not throwing in\n * this case, a synchronous throw from a non-conformant/fake implementation\n * must never escape (never-throw).\n */\n exitPointerLock(): void {\n try {\n if (this._pointerLockElement() === null) return; // already unlocked: silent no-op\n const fn = this._exitPointerLockFn();\n if (!fn) return; // unsupported: silent no-op (semantically already \"not locked\")\n fn();\n this._setError(null);\n this._applyActive();\n } catch (e: any) {\n this._setError(e);\n }\n }\n\n // --- API resolution (call-time, never cached — §3.7) ---\n\n // Resolved from `Element.prototype` rather than `el.requestPointerLock`\n // directly: when `target=\"self\"`, `el` is the `<wcs-pointer-lock>` Shell\n // itself, whose own class declares an instance method also named\n // `requestPointerLock()` (the wcBindable command). Reading the property off\n // the instance would pick up that Shell method instead of the native\n // platform API and recurse infinitely (Shell.requestPointerLock() ->\n // Core.requestPointerLock() -> resolves \"el.requestPointerLock\" -> the same\n // Shell method again). Going through `Element.prototype` sidesteps the name\n // collision — note this does NOT pick up an override on a subclass's own\n // prototype (e.g. `WcsPointerLock.prototype`); it deliberately jumps\n // straight to the platform-defined layer. Both the standard and legacy name\n // are resolved the same way, for symmetry — matching FullscreenCore's\n // `_elementFullscreenFn` (docs/fullscreen-tag-design.md §4) ONLY in that one\n // respect. Unlike that Core, this one does not check `el`'s own properties\n // first: there is no test-stub/per-element monkey-patch path to accommodate\n // here (mocks.ts installs the fakes directly on `Element.prototype`), so it\n // goes straight there for both names.\n private _requestPointerLockFn(el: Element): (() => Promise<void>) | undefined {\n const proto = Element.prototype as any;\n const standard = proto.requestPointerLock;\n if (typeof standard === \"function\") return standard.bind(el);\n const legacy = proto.webkitRequestPointerLock;\n return typeof legacy === \"function\" ? legacy.bind(el) : undefined;\n }\n\n private _exitPointerLockFn(): (() => void) | undefined {\n const d = document as any;\n return d.exitPointerLock?.bind(document) ?? d.webkitExitPointerLock?.bind(document);\n }\n\n private _pointerLockElement(): Element | null {\n const d = document as any;\n return d.pointerLockElement ?? d.webkitPointerLockElement ?? null;\n }\n\n // NOTE (test-environment caveat, not a production concern): happy-dom\n // always implements `document.onpointerlockchange` (as `null`) regardless\n // of which fake API surface a test installs, so `\"onpointerlockchange\" in\n // document` can never observably be `false` under this test runner and the\n // `webkitpointerlockchange` branch below cannot be driven through\n // `observe()` in a unit test. The branch is still correct and required for\n // real legacy WebKit builds that lack `onpointerlockchange` entirely — kept\n // as documented, deliberate, untestable-in-this-harness code per\n // docs/pointer-lock-tag-design.md.\n /* v8 ignore next 3 */\n private _pointerLockChangeEventName(): string {\n return \"onpointerlockchange\" in document ? \"pointerlockchange\" : \"webkitpointerlockchange\";\n }\n\n private _onChange = (): void => {\n this._applyActive();\n };\n\n // Self-filter (docs/fullscreen-tag-design.md §2.1): compares against this\n // instance's own resolved target, not merely \"is *something* locked\" — so\n // multiple concurrent instances each report the correct `active` value.\n private _applyActive(): void {\n const next = this._resolvedTarget !== null && this._pointerLockElement() === this._resolvedTarget;\n this._setActive(next);\n }\n\n // Same-value guard (MUST, §3.3 of the guidelines). detail itself is the\n // bare boolean value (no getter needed) per docs/pointer-lock-tag-design.md\n // §2 — unlike FullscreenCore's `{ active }`-shaped detail + getter.\n private _setActive(v: boolean): void {\n if (this._active === v) return;\n this._active = v;\n this._target.dispatchEvent(new CustomEvent(\"wcs-pointer-lock:change\", {\n detail: v,\n bubbles: true,\n }));\n }\n\n // `kind` is an explicit taxonomy discriminator passed only from the synthetic\n // error sites (unsupported / unresolved target); caught exceptions pass no kind\n // and are classified by their `.name`. Both `error` and the additive `errorInfo`\n // are now event-backed so a request/exit failure is observable via bind().\n private _setError(error: any, kind?: PointerLockErrorKind): void {\n // Same-value guard on reference: each failure builds a fresh object and the\n // clear path passes the literal null, so this only suppresses redundant\n // null→null (a successful request/exit clearing an already-null error).\n if (this._error === error) return;\n this._error = error;\n // Keep the additive errorInfo taxonomy in sync; fire it before the `error`\n // event so an observer of both sees the classification first (io-node family).\n this._commitErrorInfo(error === null ? null : derivePointerLockErrorInfo(error, kind));\n this._target.dispatchEvent(new CustomEvent(\"wcs-pointer-lock:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n // Called only from _setError (already reference-guarded), so errorInfo\n // transitions exactly when error does — no separate guard needed here.\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-pointer-lock:error-info-changed\", {\n detail: info,\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// 属性になってしまったオブジェクトの入力(`files=\"[object File]\"`)を、要素ごとに 1 回だけ言う。\n// React 19 は定義前の要素にプロパティが無いのでオブジェクトを属性に書き、Vue の `.attr` も\n// 書く。要素はその入力をプロパティでしか読まないので、何も受け取らず、何も言わなかった\n// (docs/seam-apps.md、fw-inventory)。\nconst toldObjectAttribute = new WeakSet<object>();\n\nfunction warnObjectAttribute(element: object, name: string, value: string): void {\n if (toldObjectAttribute.has(element)) return;\n toldObjectAttribute.add(element);\n const tag = (element as { localName?: string }).localName ?? \"element\";\n console.warn(\n `[wcs/input-as-attribute] <${tag}> has the attribute ${name}=\"${value}\": an object was written as an ` +\n `attribute, so the element did not receive it. A framework does that when the property is set before the ` +\n `element's definition loads (React 19), or when told to (Vue's .attr). Load the definition before rendering, ` +\n `or assign the property through a ref (Vue: .prop). (Said once per element.)`,\n element,\n );\n}\n\n/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n * - 値が `[object …]` の属性(属性に書かれてしまったオブジェクトの入力)は、要素ごとに 1 回警告する。\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 const getAttribute = (element as { getAttribute?: (name: string) => string | null }).getAttribute;\n for (const input of inputs) {\n const name = input.name;\n const attribute = typeof getAttribute === \"function\" ? getAttribute.call(element, name.toLowerCase()) : null;\n if (attribute !== null && attribute.startsWith(\"[object \")) warnObjectAttribute(element, name, attribute);\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","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/input-attribute.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// 属性へ反映する wc-bindable 入力の producer 側(SPEC-extensions § Producer guidance for inputs の P1〜P3)。\n// 入力の setter は属性をこの 2 関数で書く。それで次が揃う:\n// - `undefined` は「値が無い」(P1): 属性を、この関数で最初に書く前の状態 — マークアップに書かれた値、\n// 無ければ属性なし(= その入力の文書化した既定値)— へ戻す。applier プロファイルを宣言する binder は\n// 値の後の `undefined` を書き(A2)、React 19 も書き、直接の代入でも届く。\n// - `null` はクリア(P2): 属性なし、つまり文書化した既定値。\n// - どちらも文字列 \"undefined\" / \"null\" として属性に入らない。\n//\n// 「最初に書く前」は、その最初の書き込みのときに読む(遅延)。upgrade 前に代入されたプロパティは\n// connectedCallback の upgradeProperties() が通し直すので、そのときにはパーサが書いた属性が揃っている。\n// 要素自身が setter を通さずに書いた属性は、最初の書き込みより前なら「最初の状態」に含まれる。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/input-attribute.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/inputAttribute.ts). Those copies are generated — do not edit them.\n\nconst initialAttributes = new WeakMap<Element, Map<string, string | null>>();\n\n/** The attribute as it stood before the first write through these helpers. */\nfunction initialAttribute(el: Element, name: string): string | null {\n let byName = initialAttributes.get(el);\n if (byName === undefined) {\n byName = new Map();\n initialAttributes.set(el, byName);\n }\n if (!byName.has(name)) byName.set(name, el.getAttribute(name));\n return byName.get(name) as string | null;\n}\n\nfunction writeAttribute(el: Element, name: string, value: string | null): void {\n if (value === null) el.removeAttribute(name);\n else el.setAttribute(name, value);\n}\n\n/**\n * A value attribute. `value` is written as `String(value)`; `null` removes the attribute;\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value === null ? null : String(value));\n}\n\n/**\n * A boolean attribute, present while `value` is truthy (`null` and `false` remove it);\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectBooleanAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value ? \"\" : null);\n}\n","import { IWcBindable } from \"../types.js\";\nimport { PointerLockCore } from \"../core/PointerLockCore.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.js\";\nimport { reflectAttribute } from \"../protocol/inputAttribute.js\";\n\n/**\n * `<wcs-pointer-lock target=\"...\">` — declarative Pointer Lock API control.\n *\n * Like `<wcs-fullscreen>` (docs/fullscreen-tag-design.md §0), this Shell does\n * not lock itself — it operates on a *referenced* element via the `target`\n * attribute, using the same 3-mode resolution rule as `intersection`\n * (`_resolveTarget()`/`_safeQuery()`, copied verbatim per\n * docs/pointer-lock-tag-design.md §1 / docs/fullscreen-tag-design.md §1):\n *\n * | `target` | operates on | display |\n * |-----------------|-------------------------|-------------|\n * | omitted | first element child | `contents` |\n * | `\"#selector\"` | the matched element | `none` |\n * | `\"self\"` | the element itself | `block` |\n *\n * `requestPointerLock()` requires a user-gesture context (docs/fullscreen-tag-design.md\n * §3) — the primary activation path is the command-token protocol\n * (`command.requestPointerLock: $command.<token>` on `<wcs-pointer-lock>`,\n * emitted by a button's `onclick: $command.<token>`), not an\n * autoTrigger attribute (none is provided in v1,\n * docs/pointer-lock-tag-design.md §4).\n *\n * `movementX`/`movementY` are intentionally out of scope for v1\n * (docs/pointer-lock-tag-design.md §3) — do not add them without revisiting\n * the design doc.\n */\nexport class WcsPointerLock extends HTMLElement {\n // SSR (§4.4): the Core subscribes synchronously on connect, but the Shell\n // still exposes connectedCallbackPromise so the state binder can await it\n // uniformly across all IO nodes before snapshotting.\n static hasConnectedCallbackPromise = true;\n\n static observedAttributes = [\"target\"];\n\n static wcBindable: IWcBindable = {\n ...PointerLockCore.wcBindable,\n inputs: [{ name: \"target\", attribute: \"target\" }],\n // Core の commands をそのまま継承(単一情報源)。network/intersection と同型。\n commands: PointerLockCore.wcBindable.commands,\n };\n\n private _core: PointerLockCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new PointerLockCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-pointer-lock:change\": (d) => ({ active: d === true }),\n });\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\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 (docs/custom-state-reflection-design.md §3.6): attachInternals\n // is absent 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 // --- Attribute accessors ---\n\n get target(): string {\n return this.getAttribute(\"target\") ?? \"\";\n }\n\n // Never lets setAttribute stringify null / undefined (an \"undefined\" selector\n // resolves nothing): `null` removes the attribute (the first-child default),\n // `undefined` restores the attribute the element started with (wc-bindable\n // producer guidance P1; React 19 and a direct assignment deliver it,\n // @wcstack/state does not).\n set target(value: string | null | undefined) {\n reflectAttribute(this, \"target\", value);\n }\n\n // --- Core delegated getters ---\n\n get active(): boolean {\n return this._core.active;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get errorInfo(): WcsIoErrorInfo | null {\n return this._core.errorInfo;\n }\n\n // --- Commands ---\n\n /**\n * Resolve `target` and request pointer lock on it. Requires a user-gesture\n * context. never-throw: an unresolvable target or an unsupported/rejected\n * API call are both surfaced via `error`, never thrown (mirrors\n * `<wcs-fullscreen>`'s `requestFullscreen()`, docs/fullscreen-tag-design.md\n * §3/§6 — the Shell passes the (possibly `null`) resolved element straight\n * through and lets the Core set `error`, rather than silently no-op'ing\n * here).\n */\n async requestPointerLock(): Promise<void> {\n const { element } = this._resolveTarget();\n await this._core.requestPointerLock(element);\n }\n\n /** Exit pointer lock. Synchronous command — silent no-op if nothing is locked. */\n exitPointerLock(): void {\n this._core.exitPointerLock();\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n // upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)\n upgradeProperties(this);\n this._applyDisplayAndObserve();\n }\n\n disconnectedCallback(): void {\n this._core.dispose();\n }\n\n attributeChangedCallback(name: string): void {\n if (name === \"target\" && this.isConnected) {\n this._applyDisplayAndObserve();\n }\n }\n\n // --- Internal ---\n\n private _applyDisplayAndObserve(): void {\n const { element, display } = this._resolveTarget();\n this.style.display = display;\n this._connectedCallbackPromise = this._core.observe(element);\n }\n\n // Copied verbatim from packages/intersection/src/components/Intersect.ts\n // (§1 of docs/pointer-lock-tag-design.md / docs/fullscreen-tag-design.md).\n private _resolveTarget(): { element: Element | null; display: string } {\n const target = this.target;\n if (target === \"self\") {\n return { element: this, display: \"block\" };\n }\n if (target !== \"\") {\n const scope = this.getRootNode() as Document | ShadowRoot;\n return { element: this._safeQuery(scope, target), display: \"none\" };\n }\n const child = this.firstElementChild;\n if (child) {\n return { element: child, display: \"contents\" };\n }\n return { element: this, display: \"block\" };\n }\n\n // Copied verbatim from packages/intersection/src/components/Intersect.ts.\n private _safeQuery(scope: Document | ShadowRoot, selector: string): Element | null {\n try {\n return scope.querySelector(selector);\n } catch {\n return null;\n }\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/define-element.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * One copy of each package on a page (docs/timing-and-firing-contract.md §24). The first copy the\n * page evaluates defines the tags and a second one does nothing, so a copy that finds its tag defined\n * by another copy of the package — not its class, not a subclass of it, not the same version — warns\n * `[wcs/package-twice]` once per registry, naming both versions. The classes it defines carry\n * `\"<package>@<version>\"` under `Symbol.for(\"wcstack.package\")`; a class without it is named\n * \"another copy of <package> that does not name its version\" (an older copy, or one loaded through\n * an entry that does not stamp).\n */\n\n/** The static a class defined through this helper carries: `\"@wcstack/fetch@<version>\"`. */\nexport const PACKAGE_STAMP: unique symbol = Symbol.for(\"wcstack.package\");\n\ntype Stamped = { [PACKAGE_STAMP]?: string };\n\n/** The registries this copy warned about: one warning per package per registry. */\nconst warned = new WeakSet<CustomElementRegistry>();\n\n/**\n * Marks `cls` as defined by `pkg` (`\"@wcstack/fetch@<version>\"`). A subclass inherits the mark, and\n * `defineProperty` writes it even where a parent's mark is read-only.\n */\nexport function stampPackage(cls: CustomElementConstructor, pkg: string): void {\n Object.defineProperty(cls, PACKAGE_STAMP, { value: pkg, configurable: true });\n}\n\n/**\n * Warns when `tag` is defined as `existing` by another copy of the package `pkg` names: `existing`\n * is neither `own` nor a subclass of it (omit `own` when the copy has no class to compare with), and\n * carries another version or none. Once per registry.\n */\nexport function warnIfAnotherCopy(\n registry: CustomElementRegistry,\n tag: string,\n existing: CustomElementConstructor,\n own: CustomElementConstructor | undefined,\n pkg: string,\n): void {\n if (own !== undefined && (existing === own || existing.prototype instanceof own)) return;\n const theirs = (existing as Stamped)[PACKAGE_STAMP];\n if (theirs === pkg || warned.has(registry)) return;\n warned.add(registry);\n const name = pkg.slice(0, pkg.lastIndexOf(\"@\"));\n console.warn(\n `[${name}] [wcs/package-twice] <${tag}> is already defined by ` +\n `${theirs ?? `another copy of ${name} that does not name its version`}; ` +\n `this copy, ${pkg}, does nothing. Load each package once.`,\n );\n}\n\n/**\n * Defines each `[tag, class]` in `registry` unless the tag is already defined, stamping the class\n * with `pkg` (`\"@wcstack/fetch@<version>\"`). A tag another copy of the package defined first is left\n * as it is, with the warning above.\n */\nexport function defineElements(\n registry: CustomElementRegistry,\n pkg: string,\n definitions: readonly (readonly [tag: string, cls: CustomElementConstructor])[],\n): void {\n for (const [tag, cls] of definitions) {\n const existing = registry.get(tag);\n if (existing === undefined) {\n stampPackage(cls, pkg);\n registry.define(tag, cls);\n } else {\n warnIfAnotherCopy(registry, tag, existing, cls, pkg);\n }\n }\n}\n","import pkg from \"../package.json\" with { type: \"json\" };\nimport { WcsPointerLock } from \"./components/PointerLock.js\";\nimport { config } from \"./config.js\";\nimport { defineElements } from \"./protocol/defineElement.js\";\n\n/**\n * Register this package's tags. Pass a scoped `CustomElementRegistry` to define\n * them for a single shadow tree -- scoped registries do not inherit the global\n * one, so a tree using one needs its own definitions.\n */\nexport function registerComponents(registry: CustomElementRegistry = customElements): void {\n defineElements(registry, `${pkg.name}@${pkg.version}`, [\n [config.tagNames.pointerLock, WcsPointerLock],\n ]);\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapPointerLock(userConfig?: IWritableConfig, registry?: CustomElementRegistry): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents(registry);\n}\n"],"names":[],"mappings":"AAQA,MAAM,OAAO,GAAoB;AAC/B,IAAA,QAAQ,EAAE;AACR,QAAA,WAAW,EAAE,kBAAkB;AAChC,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,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OAAO,CAAA,CAAE,EAAE;AACrD,QAAA,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC;AAC9C,KAAA,CAAC;AACJ;;ACVM,SAAU,oBAAoB,CAAC,UAA4B,EAAE,QAAgC,EAAA;IACjG,IAAI,UAAU,EAAE;QACd,SAAS,CAAC,UAAU,CAAC;IACvB;IACA,kBAAkB,CAAC,QAAQ,CAAC;AAC9B;;;;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../src/config.ts","../../src/core/pointerLockCapabilities.ts","../../src/core/PointerLockCore.ts","../../src/protocol/upgradeProperties.ts","../../src/protocol/inputAttribute.ts","../../src/components/PointerLock.ts","../../src/protocol/defineElement.ts","../../src/registerComponents.ts","../../src/bootstrapPointerLock.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n pointerLock: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n pointerLock: \"wcs-pointer-lock\",\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\n/** A misspelt option would otherwise do nothing: `bootstrapPointerLock` refuses it. */\nfunction invalid(key: string): never {\n throw new Error(`[@wcstack/pointer-lock] bootstrapPointerLock: \"${key}\" is not one of its options, or not of the option's type.`);\n}\n\n/**\n * Applies the options given; an undefined value is left out. An option this package does not\n * have, a value of another type than its default (null, or an array for an object, included) or\n * a tag name it does not define throws, and then nothing is applied.\n */\nexport function setConfig(partialConfig: IWritableConfig): void {\n const options = _config as unknown as Record<string, unknown>;\n const tags = _config.tagNames as Record<string, string>;\n const given = Object.entries(partialConfig).filter(([, value]) => value !== undefined);\n const givenTags = Object.entries(partialConfig.tagNames ?? {}).filter(([, tag]) => tag !== undefined);\n for (const [key, value] of given) {\n const current = options[key];\n if (!Object.hasOwn(options, key) || value === null || typeof value !== typeof current || Array.isArray(value) !== Array.isArray(current)) {\n invalid(key);\n }\n }\n for (const [name, tag] of givenTags) {\n if (!Object.hasOwn(tags, name) || typeof tag !== \"string\") invalid(`tagNames.${name}`);\n }\n for (const [name, tag] of givenTags) tags[name] = tag as string;\n frozenConfig = null;\n}\n","/**\n * pointerLockCapabilities.ts\n *\n * Pointer Lock node 固有の error code(taxonomy)と derivation。汎用の error info 型は\n * `./platformCapability.js`(/io-core/ から copy-distribution される生成ファイル)から\n * import する。pointer-lock は referenced element を操作するモニタ的ノードで競合 operation\n * を持たないため lane は無く、error taxonomy(errorInfo)のみを採用する。\n *\n * `_setError` は合成 `{ message }`(target 未解決 / API 非対応)と caught 例外\n * (`NotAllowedError` / `TypeError` = user gesture 外の requestPointerLock 拒否)を混在\n * 受理する。呼出側が明示 `kind` を渡して合成側を曖昧さ無く分類し、caught は `.name` で\n * 分類する(fullscreen と同じ discriminator 方式)。\n */\n\nimport type { WcsIoErrorInfo } from \"./platformCapability.js\";\n\n/** 明示 kind discriminator(合成エラーの呼出側が渡す)。 */\nexport type PointerLockErrorKind = \"capability-missing\" | \"invalid-argument\";\n\n/** 安定した pointer-lock error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_POINTER_LOCK_ERROR_CODE = {\n /** Pointer Lock API 非対応。 */\n CapabilityMissing: \"capability-missing\",\n /** target selector が要素に解決しない等の入力不備。 */\n InvalidArgument: \"invalid-argument\",\n /** `NotAllowedError` / `TypeError` — user gesture 外での要求拒否。 */\n NotAllowed: \"not-allowed\",\n /** その他の caught 例外。 */\n PointerLockError: \"pointer-lock-error\",\n} as const;\n\nfunction messageOf(error: unknown): string {\n return typeof (error as { message?: unknown } | null)?.message === \"string\"\n ? (error as { message: string }).message\n : String(error);\n}\n\n/**\n * pointer-lock の失敗を serializable な error taxonomy に写す。`kind` は合成エラーの\n * 呼出側が渡す明示 discriminator(`capability-missing` / `invalid-argument`)。未指定は\n * caught 例外を意味し、`.name` で分類する。`NotAllowedError` / `TypeError` は user\n * gesture 内で再試行すれば成功しうるため recoverable=true。\n */\nexport function derivePointerLockErrorInfo(error: unknown, kind?: PointerLockErrorKind): WcsIoErrorInfo {\n const message = messageOf(error);\n if (kind === \"capability-missing\") {\n return { code: WCS_POINTER_LOCK_ERROR_CODE.CapabilityMissing, phase: \"probe\", recoverable: false, message };\n }\n if (kind === \"invalid-argument\") {\n return { code: WCS_POINTER_LOCK_ERROR_CODE.InvalidArgument, phase: \"start\", recoverable: false, message };\n }\n const name = (error as { name?: unknown } | null)?.name;\n if (name === \"NotAllowedError\" || name === \"TypeError\") {\n return { code: WCS_POINTER_LOCK_ERROR_CODE.NotAllowed, phase: \"execute\", recoverable: true, message };\n }\n return { code: WCS_POINTER_LOCK_ERROR_CODE.PointerLockError, phase: \"execute\", recoverable: false, message };\n}\n","import { IWcBindable } from \"../types.js\";\nimport { WcsIoErrorInfo } from \"./platformCapability.js\";\nimport { derivePointerLockErrorInfo, PointerLockErrorKind } from \"./pointerLockCapabilities.js\";\n\n// A request this instance made whose answer may come as an event on the\n// document. Whether it does is known only once the platform call has returned:\n// a call that returns a promise is answered by that promise alone, and one that\n// returns nothing (Firefox, the prefixed API) is answered by pointerlockchange /\n// pointerlockerror.\ninterface PendingRequest {\n // true once the call has returned without a promise: the events answer it.\n waiting: boolean;\n // a pointerlockerror fired before the call returned (decided when it returns).\n refused: boolean;\n}\n\n// What a refusal that arrives as an event is reported as. The event carries no\n// reason, so the message says no more than that; `NotAllowedError` puts it in\n// the `not-allowed` class (recoverable: a request from a user gesture may pass).\nfunction refusedByEvent(): DOMException {\n return new DOMException(\"The browser refused the pointer lock request.\", \"NotAllowedError\");\n}\n\n/**\n * Headless Pointer Lock primitive. A thin, framework-agnostic wrapper around\n * the Pointer Lock API (`Element.requestPointerLock()` /\n * `document.exitPointerLock()` / `document.pointerLockElement` / the\n * `document`-scoped `pointerlockchange` event) exposed through the\n * wc-bindable protocol.\n *\n * This Core follows the same basic pattern as `FullscreenCore`\n * (docs/fullscreen-tag-design.md, referenced by docs/pointer-lock-tag-design.md\n * §1): target resolution happens in the Shell, `pointerlockchange` is\n * subscribed on `document` (not on the target element) and each instance\n * self-filters by comparing `document.pointerLockElement` against its own\n * resolved target, API resolution is call-time (never cached) and probes the\n * standard name before the legacy (`webkit`-prefixed) name, and a single\n * Core-level `_gen` generation guard protects the asynchronous\n * `requestPointerLock()` call from stale resolution after dispose().\n *\n * Key difference from Fullscreen (docs/pointer-lock-tag-design.md §2):\n * `exitPointerLock()` is a *synchronous* platform API (it returns `void`, not\n * a `Promise`), so the Core's `exitPointerLock()` command is synchronous too\n * and carries no `_gen` guard of its own — it is wrapped in `try/catch` only\n * as a defensive measure (never-throw), not because it can go stale.\n *\n * Scope note (docs/pointer-lock-tag-design.md §3): `movementX`/`movementY`\n * are intentionally NOT exposed by this Core (v1 scope). They are\n * high-frequency `mousemove` data unsuited to the same-value-guarded\n * declarative `properties` surface; see the design doc for the rationale and\n * the planned `debounce`/`throttle`-based opt-in for a future version.\n */\nexport class PointerLockCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n // `active`'s CustomEvent detail is the bare boolean value itself — no\n // getter needed (docs/pointer-lock-tag-design.md §2). This differs from\n // FullscreenCore's `{ active }`-shaped detail + getter.\n properties: [\n { name: \"active\", event: \"wcs-pointer-lock:change\", semantics: \"state\" },\n // `error` / `errorInfo` are observable failure outputs. Historically `error`\n // was an imperative getter with no event; both are now bindable (event-backed)\n // so `data-wcs` / bind() can observe a request/exit failure. `errorInfo` is the\n // additive serializable taxonomy (stable code / phase / recoverable) derived\n // from `error`; the `error` value shape is unchanged. No lane — pointer-lock\n // drives a referenced element, not a competing operation.\n { name: \"error\", event: \"wcs-pointer-lock:error\", semantics: \"state\" },\n { name: \"errorInfo\", event: \"wcs-pointer-lock:error-info-changed\", semantics: \"state\" },\n // Whether this page has the Pointer Lock API (an element has\n // requestPointerLock() or the prefixed name). Computed at call time; the\n // event carries the boolean and fires from observe() when it differs from\n // the last value dispatched.\n { name: \"supported\", event: \"wcs-pointer-lock:supported-changed\", semantics: \"state\" },\n ],\n commands: [\n { name: \"requestPointerLock\", async: true },\n // Synchronous platform API (document.exitPointerLock() returns void) —\n // no `async` flag (docs/pointer-lock-tag-design.md §2).\n { name: \"exitPointerLock\" },\n ],\n };\n\n private _target: EventTarget;\n private _active = false;\n private _error: any = null;\n private _errorInfo: WcsIoErrorInfo | null = null;\n\n // The element this instance last resolved requestPointerLock()/observe()\n // against, kept so the document-scoped `pointerlockchange` handler can\n // self-filter under multiple concurrent instances (docs/fullscreen-tag-design.md\n // §2.1, inherited verbatim by pointer-lock per docs/pointer-lock-tag-design.md §1).\n private _resolvedTarget: Element | null = null;\n\n // True once observe() has attached the live `document` listener. Guards\n // observe() so a redundant call does not re-subscribe; dispose() resets it\n // so a later observe() resumes cleanly.\n private _subscribed = false;\n\n // Core-level generation guard (§3.4 of the guidelines / §6 of\n // fullscreen-tag-design.md): only requestPointerLock() is asynchronous and\n // needs it. exitPointerLock() is synchronous and has no stale-resolution\n // race to guard against.\n private _gen = 0;\n\n // The request this instance made that an event may still answer, or null.\n // Chromium and WebKit answer with the call's promise; Firefox (and the prefixed\n // API) return nothing and answer with pointerlockchange / pointerlockerror on\n // the document. A pointerlockerror is this instance's only while this is set\n // and waiting — the event does not say whose request failed.\n private _request: PendingRequest | null = null;\n\n // `supported` as last dispatched (never the value itself — the getter probes at\n // call time). Starts at false, so observe() announces a page that has the API.\n private _supportedPublished = 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 active(): boolean {\n return this._active;\n }\n\n get error(): any {\n return this._error;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable`), or null. Additive wc-bindable property (event\n * `wcs-pointer-lock:error-info-changed`), derived from `error`; the existing\n * `error` value shape is unchanged.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n /**\n * Whether this page has the Pointer Lock API right now: an element has\n * `requestPointerLock()` (or the prefixed `webkitRequestPointerLock()`). Probed\n * at call time, never cached. No Permissions-Policy feature governs pointer\n * lock, so there is no policy to ask. It does not say that a request will\n * succeed (that needs a user gesture, and a sandboxed `<iframe>` needs\n * `allow-pointer-lock`). A wc-bindable output (event\n * `wcs-pointer-lock:supported-changed`).\n */\n get supported(): boolean {\n const proto = Element.prototype as any;\n return typeof proto.requestPointerLock === \"function\" || typeof proto.webkitRequestPointerLock === \"function\";\n }\n\n // Lifecycle (§3.5). Idempotent: a second observe() while already subscribed\n // updates the tracked resolved target without re-subscribing to `document`.\n // Also publishes `supported` when it differs from the last value dispatched.\n observe(target: Element | null): Promise<void> {\n this._publishSupported();\n this._resolvedTarget = target;\n if (!this._subscribed) {\n this._subscribed = true;\n document.addEventListener(this._pointerLockChangeEventName(), this._onChange);\n document.addEventListener(this._pointerLockErrorEventName(), this._onLockError);\n }\n this._applyActive();\n return this._ready;\n }\n\n dispose(): void {\n this._gen++; // invalidate any in-flight requestPointerLock() resolution\n this._request = null;\n if (this._subscribed) {\n this._subscribed = false;\n document.removeEventListener(this._pointerLockChangeEventName(), this._onChange);\n document.removeEventListener(this._pointerLockErrorEventName(), this._onLockError);\n }\n this._resolvedTarget = null;\n // A disposed Core hears no pointerlockchange, so it can no longer vouch for\n // `active`: publish false through the normal setter (timing contract §22 — a\n // disconnect publishes what it changes). The lock itself is not released\n // here; observe() re-reads the truth — publishing true again — on the next\n // connect.\n this._setActive(false);\n }\n\n /**\n * Request pointer lock on `element`. Never-throw: a missing API or a\n * rejected promise (e.g. called outside a user-gesture context —\n * `NotAllowedError`, docs/fullscreen-tag-design.md §3) is captured into\n * `error` rather than propagated. `element` may be `null` when the Shell's\n * `target` selector did not resolve (docs/pointer-lock-tag-design.md §1\n * defers error representation to FullscreenCore verbatim — this null-target\n * case mirrors `FullscreenCore.requestFullscreen(null)`,\n * docs/fullscreen-tag-design.md §6): distinct from \"API is not supported\"\n * below, so a typo'd selector doesn't masquerade as an unsupported platform.\n */\n async requestPointerLock(element: Element | null): Promise<void> {\n const gen = ++this._gen;\n this._resolvedTarget = element;\n this._request = null; // this call supersedes the request before it\n if (!element) {\n this._setError({ message: \"Pointer Lock target could not be resolved.\" }, \"invalid-argument\");\n return;\n }\n const fn = this._requestPointerLockFn(element);\n if (!fn) {\n // Resolved synchronously in the same tick as the call — dispose()\n // cannot have run yet, so no staleness check is needed here (matches\n // the reference `requestFullscreen()` implementation,\n // docs/fullscreen-tag-design.md §6).\n this._setError({ message: \"Pointer Lock API is not supported.\" }, \"capability-missing\");\n return;\n }\n const request: PendingRequest = { waiting: false, refused: false };\n this._request = request;\n try {\n // fn is already bound to `element` by _requestPointerLockFn().\n const result: unknown = fn();\n if (typeof (result as { then?: unknown } | null | undefined)?.then === \"function\") {\n // Chromium and WebKit: the call's promise answers this request, and it\n // alone. They fire pointerlockerror for the same refusal as well — WebKit\n // before it rejects the promise — and the rejection carries the reason,\n // so the event is not this request's answer.\n this._request = null;\n await result;\n if (gen !== this._gen) return; // stale\n this._setError(null);\n this._applyActive();\n return;\n }\n // Firefox (and the prefixed API) return nothing: the answer is a\n // pointerlockchange or a pointerlockerror on the document.\n if (request.refused) {\n // The event fired inside the call itself.\n this._request = null;\n this._setError(refusedByEvent());\n return;\n }\n // The request is made: the failure before it is no longer the latest\n // attempt's. From here the events answer.\n this._setError(null);\n this._applyActive();\n request.waiting = true;\n } catch (e: any) {\n if (gen !== this._gen) return; // stale\n this._request = null;\n this._setError(e);\n }\n }\n\n /**\n * Exit pointer lock. Synchronous platform API (docs/pointer-lock-tag-design.md\n * §2) — returns `void`, not a `Promise`. Silent no-op when nothing is\n * currently locked or the API is unsupported (mirrors\n * `FullscreenCore.exitFullscreen()`'s no-op contract,\n * docs/fullscreen-tag-design.md §7). Wrapped in try/catch defensively: even\n * though the platform API is synchronous and documented as not throwing in\n * this case, a synchronous throw from a non-conformant/fake implementation\n * must never escape (never-throw).\n */\n exitPointerLock(): void {\n try {\n if (this._pointerLockElement() === null) return; // already unlocked: silent no-op\n const fn = this._exitPointerLockFn();\n if (!fn) return; // unsupported: silent no-op (semantically already \"not locked\")\n fn();\n this._setError(null);\n this._applyActive();\n } catch (e: any) {\n this._setError(e);\n }\n }\n\n // --- API resolution (call-time, never cached — §3.7) ---\n\n // Resolved from `Element.prototype` rather than `el.requestPointerLock`\n // directly: when `target=\"self\"`, `el` is the `<wcs-pointer-lock>` Shell\n // itself, whose own class declares an instance method also named\n // `requestPointerLock()` (the wcBindable command). Reading the property off\n // the instance would pick up that Shell method instead of the native\n // platform API and recurse infinitely (Shell.requestPointerLock() ->\n // Core.requestPointerLock() -> resolves \"el.requestPointerLock\" -> the same\n // Shell method again). Going through `Element.prototype` sidesteps the name\n // collision — note this does NOT pick up an override on a subclass's own\n // prototype (e.g. `WcsPointerLock.prototype`); it deliberately jumps\n // straight to the platform-defined layer. Both the standard and legacy name\n // are resolved the same way, for symmetry — matching FullscreenCore's\n // `_elementFullscreenFn` (docs/fullscreen-tag-design.md §4) ONLY in that one\n // respect. Unlike that Core, this one does not check `el`'s own properties\n // first: there is no test-stub/per-element monkey-patch path to accommodate\n // here (mocks.ts installs the fakes directly on `Element.prototype`), so it\n // goes straight there for both names.\n private _requestPointerLockFn(el: Element): (() => Promise<void>) | undefined {\n const proto = Element.prototype as any;\n const standard = proto.requestPointerLock;\n if (typeof standard === \"function\") return standard.bind(el);\n const legacy = proto.webkitRequestPointerLock;\n return typeof legacy === \"function\" ? legacy.bind(el) : undefined;\n }\n\n private _exitPointerLockFn(): (() => void) | undefined {\n const d = document as any;\n return d.exitPointerLock?.bind(document) ?? d.webkitExitPointerLock?.bind(document);\n }\n\n private _pointerLockElement(): Element | null {\n const d = document as any;\n return d.pointerLockElement ?? d.webkitPointerLockElement ?? null;\n }\n\n // NOTE (test-environment caveat, not a production concern): happy-dom\n // always implements `document.onpointerlockchange` (as `null`) regardless\n // of which fake API surface a test installs, so `\"onpointerlockchange\" in\n // document` can never observably be `false` under this test runner and the\n // `webkitpointerlockchange` branch below cannot be driven through\n // `observe()` in a unit test. The branch is still correct and required for\n // real legacy WebKit builds that lack `onpointerlockchange` entirely — kept\n // as documented, deliberate, untestable-in-this-harness code per\n // docs/pointer-lock-tag-design.md.\n /* v8 ignore next 3 */\n private _pointerLockChangeEventName(): string {\n return \"onpointerlockchange\" in document ? \"pointerlockchange\" : \"webkitpointerlockchange\";\n }\n\n // Picked the same way as the change event's name above. Unlike that one, this\n // branch is driven in the tests (mocks.ts removes `onpointerlockerror` from\n // the prototype that owns it).\n private _pointerLockErrorEventName(): string {\n return \"onpointerlockerror\" in document ? \"pointerlockerror\" : \"webkitpointerlockerror\";\n }\n\n private _onChange = (): void => {\n this._applyActive();\n // The target is locked: a request that was waiting for its answer has it.\n if (this._active) this._request = null;\n };\n\n // A refusal that arrives as an event. Firefox reports a refused\n // requestPointerLock() (no user gesture, say) only here — the call returns no\n // promise to reject. A request whose call returned a promise is not waiting\n // for this event (`_request` is null from the moment the call returned), so a\n // refusal the promise reports is never reported a second time. The event fires\n // on the document without saying whose request failed: with no request waiting\n // here, it is another instance's (or the page's own call) and is ignored.\n private _onLockError = (): void => {\n const request = this._request;\n if (request === null) return;\n if (!request.waiting) {\n // Inside the platform call: whether a promise answers is not known yet.\n request.refused = true;\n return;\n }\n this._request = null;\n this._setError(refusedByEvent());\n };\n\n // `supported` is probed at call time, so there is no stored value to set: this\n // dispatches the current one when it differs from the last one dispatched\n // (same-value guard). A state binding reads the property when it attaches; the\n // event is for every other listener.\n private _publishSupported(): void {\n const supported = this.supported;\n if (this._supportedPublished === supported) return;\n this._supportedPublished = supported;\n this._target.dispatchEvent(new CustomEvent(\"wcs-pointer-lock:supported-changed\", {\n detail: supported,\n bubbles: true,\n }));\n }\n\n // Self-filter (docs/fullscreen-tag-design.md §2.1): compares against this\n // instance's own resolved target, not merely \"is *something* locked\" — so\n // multiple concurrent instances each report the correct `active` value.\n private _applyActive(): void {\n const next = this._resolvedTarget !== null && this._pointerLockElement() === this._resolvedTarget;\n this._setActive(next);\n }\n\n // Same-value guard (MUST, §3.3 of the guidelines). detail itself is the\n // bare boolean value (no getter needed) per docs/pointer-lock-tag-design.md\n // §2 — unlike FullscreenCore's `{ active }`-shaped detail + getter.\n private _setActive(v: boolean): void {\n if (this._active === v) return;\n this._active = v;\n this._target.dispatchEvent(new CustomEvent(\"wcs-pointer-lock:change\", {\n detail: v,\n bubbles: true,\n }));\n }\n\n // `kind` is an explicit taxonomy discriminator passed only from the synthetic\n // error sites (unsupported / unresolved target); caught exceptions pass no kind\n // and are classified by their `.name`. Both `error` and the additive `errorInfo`\n // are now event-backed so a request/exit failure is observable via bind().\n private _setError(error: any, kind?: PointerLockErrorKind): void {\n // Same-value guard on reference: each failure builds a fresh object and the\n // clear path passes the literal null, so this only suppresses redundant\n // null→null (a successful request/exit clearing an already-null error).\n if (this._error === error) return;\n this._error = error;\n // Keep the additive errorInfo taxonomy in sync; fire it before the `error`\n // event so an observer of both sees the classification first (io-node family).\n this._commitErrorInfo(error === null ? null : derivePointerLockErrorInfo(error, kind));\n this._target.dispatchEvent(new CustomEvent(\"wcs-pointer-lock:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n // Called only from _setError (already reference-guarded), so errorInfo\n // transitions exactly when error does — no separate guard needed here.\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-pointer-lock:error-info-changed\", {\n detail: info,\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// 属性になってしまったオブジェクトの入力(`files=\"[object File]\"`)を、要素ごとに 1 回だけ言う。\n// React 19 は定義前の要素にプロパティが無いのでオブジェクトを属性に書き、Vue の `.attr` も\n// 書く。要素はその入力をプロパティでしか読まないので、何も受け取らず、何も言わなかった\n// (docs/seam-apps.md、fw-inventory)。\nconst toldObjectAttribute = new WeakSet<object>();\n\nfunction warnObjectAttribute(element: object, name: string, value: string): void {\n if (toldObjectAttribute.has(element)) return;\n toldObjectAttribute.add(element);\n const tag = (element as { localName?: string }).localName ?? \"element\";\n console.warn(\n `[wcs/input-as-attribute] <${tag}> has the attribute ${name}=\"${value}\": an object was written as an ` +\n `attribute, so the element did not receive it. A framework does that when the property is set before the ` +\n `element's definition loads (React 19), or when told to (Vue's .attr). Load the definition before rendering, ` +\n `or assign the property through a ref (Vue: .prop). (Said once per element.)`,\n element,\n );\n}\n\n/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n * - 値が `[object …]` の属性(属性に書かれてしまったオブジェクトの入力)は、要素ごとに 1 回警告する。\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 const getAttribute = (element as { getAttribute?: (name: string) => string | null }).getAttribute;\n for (const input of inputs) {\n const name = input.name;\n const attribute = typeof getAttribute === \"function\" ? getAttribute.call(element, name.toLowerCase()) : null;\n if (attribute !== null && attribute.startsWith(\"[object \")) warnObjectAttribute(element, name, attribute);\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","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/input-attribute.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// 属性へ反映する wc-bindable 入力の producer 側(SPEC-extensions § Producer guidance for inputs の P1〜P3)。\n// 入力の setter は属性をこの 2 関数で書く。それで次が揃う:\n// - `undefined` は「値が無い」(P1): 属性を、この関数で最初に書く前の状態 — マークアップに書かれた値、\n// 無ければ属性なし(= その入力の文書化した既定値)— へ戻す。applier プロファイルを宣言する binder は\n// 値の後の `undefined` を書き(A2)、React 19 も書き、直接の代入でも届く。\n// - `null` はクリア(P2): 属性なし、つまり文書化した既定値。\n// - どちらも文字列 \"undefined\" / \"null\" として属性に入らない。\n//\n// 「最初に書く前」は、その最初の書き込みのときに読む(遅延)。upgrade 前に代入されたプロパティは\n// connectedCallback の upgradeProperties() が通し直すので、そのときにはパーサが書いた属性が揃っている。\n// 要素自身が setter を通さずに書いた属性は、最初の書き込みより前なら「最初の状態」に含まれる。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/input-attribute.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/inputAttribute.ts). Those copies are generated — do not edit them.\n\nconst initialAttributes = new WeakMap<Element, Map<string, string | null>>();\n\n/** The attribute as it stood before the first write through these helpers. */\nfunction initialAttribute(el: Element, name: string): string | null {\n let byName = initialAttributes.get(el);\n if (byName === undefined) {\n byName = new Map();\n initialAttributes.set(el, byName);\n }\n if (!byName.has(name)) byName.set(name, el.getAttribute(name));\n return byName.get(name) as string | null;\n}\n\nfunction writeAttribute(el: Element, name: string, value: string | null): void {\n if (value === null) el.removeAttribute(name);\n else el.setAttribute(name, value);\n}\n\n/**\n * A value attribute. `value` is written as `String(value)`; `null` removes the attribute;\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value === null ? null : String(value));\n}\n\n/**\n * A boolean attribute, present while `value` is truthy (`null` and `false` remove it);\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectBooleanAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value ? \"\" : null);\n}\n","import { IWcBindable } from \"../types.js\";\nimport { PointerLockCore } from \"../core/PointerLockCore.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.js\";\nimport { reflectAttribute } from \"../protocol/inputAttribute.js\";\n\n/**\n * `<wcs-pointer-lock target=\"...\">` — declarative Pointer Lock API control.\n *\n * Like `<wcs-fullscreen>` (docs/fullscreen-tag-design.md §0), this Shell does\n * not lock itself — it operates on a *referenced* element via the `target`\n * attribute, using the same 3-mode resolution rule as `intersection`\n * (`_resolveTarget()`/`_safeQuery()`, copied verbatim per\n * docs/pointer-lock-tag-design.md §1 / docs/fullscreen-tag-design.md §1):\n *\n * | `target` | operates on | display |\n * |-----------------|-------------------------|-------------|\n * | omitted | first element child | `contents` |\n * | `\"#selector\"` | the matched element | `none` |\n * | `\"self\"` | the element itself | `block` |\n *\n * `requestPointerLock()` requires a user-gesture context (docs/fullscreen-tag-design.md\n * §3) — the primary activation path is the command-token protocol\n * (`command.requestPointerLock: $command.<token>` on `<wcs-pointer-lock>`,\n * emitted by a button's `onclick: $command.<token>`), not an\n * autoTrigger attribute (none is provided in v1,\n * docs/pointer-lock-tag-design.md §4).\n *\n * `movementX`/`movementY` are intentionally out of scope for v1\n * (docs/pointer-lock-tag-design.md §3) — do not add them without revisiting\n * the design doc.\n */\nexport class WcsPointerLock extends HTMLElement {\n // SSR (§4.4): the Core subscribes synchronously on connect, but the Shell\n // still exposes connectedCallbackPromise so the state binder can await it\n // uniformly across all IO nodes before snapshotting.\n static hasConnectedCallbackPromise = true;\n\n static observedAttributes = [\"target\"];\n\n static wcBindable: IWcBindable = {\n ...PointerLockCore.wcBindable,\n inputs: [{ name: \"target\", attribute: \"target\" }],\n // Core の commands をそのまま継承(単一情報源)。network/intersection と同型。\n commands: PointerLockCore.wcBindable.commands,\n };\n\n private _core: PointerLockCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new PointerLockCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-pointer-lock:change\": (d) => ({ active: d === true }),\n });\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\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 (docs/custom-state-reflection-design.md §3.6): attachInternals\n // is absent 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 // --- Attribute accessors ---\n\n get target(): string {\n return this.getAttribute(\"target\") ?? \"\";\n }\n\n // Never lets setAttribute stringify null / undefined (an \"undefined\" selector\n // resolves nothing): `null` removes the attribute (the first-child default),\n // `undefined` restores the attribute the element started with (wc-bindable\n // producer guidance P1; React 19 and a direct assignment deliver it,\n // @wcstack/state does not).\n set target(value: string | null | undefined) {\n reflectAttribute(this, \"target\", value);\n }\n\n // --- Core delegated getters ---\n\n get active(): boolean {\n return this._core.active;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get errorInfo(): WcsIoErrorInfo | null {\n return this._core.errorInfo;\n }\n\n // Whether this page has the Pointer Lock API — probed at call time by the\n // Core (never cached), so a state binding that reads it when it attaches gets\n // the right value without waiting for `wcs-pointer-lock:supported-changed`.\n get supported(): boolean {\n return this._core.supported;\n }\n\n // --- Commands ---\n\n /**\n * Resolve `target` and request pointer lock on it. Requires a user-gesture\n * context. never-throw: an unresolvable target or an unsupported/rejected\n * API call are both surfaced via `error`, never thrown (mirrors\n * `<wcs-fullscreen>`'s `requestFullscreen()`, docs/fullscreen-tag-design.md\n * §3/§6 — the Shell passes the (possibly `null`) resolved element straight\n * through and lets the Core set `error`, rather than silently no-op'ing\n * here).\n */\n async requestPointerLock(): Promise<void> {\n const { element } = this._resolveTarget();\n await this._core.requestPointerLock(element);\n }\n\n /** Exit pointer lock. Synchronous command — silent no-op if nothing is locked. */\n exitPointerLock(): void {\n this._core.exitPointerLock();\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n // upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)\n upgradeProperties(this);\n this._applyDisplayAndObserve();\n }\n\n // dispose() publishes `active: false` when it was true (timing contract §22):\n // out of the document this element hears no pointerlockchange, and the browser\n // releases the lock when the target leaves with it. Nothing is released here;\n // the next connectedCallback re-reads the truth through observe().\n disconnectedCallback(): void {\n this._core.dispose();\n }\n\n attributeChangedCallback(name: string): void {\n if (name === \"target\" && this.isConnected) {\n this._applyDisplayAndObserve();\n }\n }\n\n // --- Internal ---\n\n private _applyDisplayAndObserve(): void {\n const { element, display } = this._resolveTarget();\n this.style.display = display;\n this._connectedCallbackPromise = this._core.observe(element);\n }\n\n // Copied verbatim from packages/intersection/src/components/Intersect.ts\n // (§1 of docs/pointer-lock-tag-design.md / docs/fullscreen-tag-design.md).\n private _resolveTarget(): { element: Element | null; display: string } {\n const target = this.target;\n if (target === \"self\") {\n return { element: this, display: \"block\" };\n }\n if (target !== \"\") {\n const scope = this.getRootNode() as Document | ShadowRoot;\n return { element: this._safeQuery(scope, target), display: \"none\" };\n }\n const child = this.firstElementChild;\n if (child) {\n return { element: child, display: \"contents\" };\n }\n return { element: this, display: \"block\" };\n }\n\n // Copied verbatim from packages/intersection/src/components/Intersect.ts.\n private _safeQuery(scope: Document | ShadowRoot, selector: string): Element | null {\n try {\n return scope.querySelector(selector);\n } catch {\n return null;\n }\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/define-element.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * One copy of each package on a page (docs/timing-and-firing-contract.md §24). The first copy the\n * page evaluates defines the tags and a second one does nothing, so a copy that finds its tag defined\n * by another copy of the package — not its class, not a subclass of it, not the same version — warns\n * `[wcs/package-twice]` once per registry, naming both versions. The classes it defines carry\n * `\"<package>@<version>\"` under `Symbol.for(\"wcstack.package\")`; a class without it is named\n * \"another copy of <package> that does not name its version\" (an older copy, or one loaded through\n * an entry that does not stamp).\n */\n\n/** The static a class defined through this helper carries: `\"@wcstack/fetch@<version>\"`. */\nexport const PACKAGE_STAMP: unique symbol = Symbol.for(\"wcstack.package\");\n\ntype Stamped = { [PACKAGE_STAMP]?: string };\n\n/** The registries this copy warned about: one warning per package per registry. */\nconst warned = new WeakSet<CustomElementRegistry>();\n\n/**\n * Marks `cls` as defined by `pkg` (`\"@wcstack/fetch@<version>\"`). A subclass inherits the mark, and\n * `defineProperty` writes it even where a parent's mark is read-only.\n */\nexport function stampPackage(cls: CustomElementConstructor, pkg: string): void {\n Object.defineProperty(cls, PACKAGE_STAMP, { value: pkg, configurable: true });\n}\n\n/**\n * Warns when `tag` is defined as `existing` by another copy of the package `pkg` names: `existing`\n * is neither `own` nor a subclass of it (omit `own` when the copy has no class to compare with), and\n * carries another version or none. Once per registry.\n */\nexport function warnIfAnotherCopy(\n registry: CustomElementRegistry,\n tag: string,\n existing: CustomElementConstructor,\n own: CustomElementConstructor | undefined,\n pkg: string,\n): void {\n if (own !== undefined && (existing === own || existing.prototype instanceof own)) return;\n const theirs = (existing as Stamped)[PACKAGE_STAMP];\n if (theirs === pkg || warned.has(registry)) return;\n warned.add(registry);\n const name = pkg.slice(0, pkg.lastIndexOf(\"@\"));\n console.warn(\n `[${name}] [wcs/package-twice] <${tag}> is already defined by ` +\n `${theirs ?? `another copy of ${name} that does not name its version`}; ` +\n `this copy, ${pkg}, does nothing. Load each package once.`,\n );\n}\n\n/**\n * Defines each `[tag, class]` in `registry` unless the tag is already defined, stamping the class\n * with `pkg` (`\"@wcstack/fetch@<version>\"`). A tag another copy of the package defined first is left\n * as it is, with the warning above.\n */\nexport function defineElements(\n registry: CustomElementRegistry,\n pkg: string,\n definitions: readonly (readonly [tag: string, cls: CustomElementConstructor])[],\n): void {\n for (const [tag, cls] of definitions) {\n const existing = registry.get(tag);\n if (existing === undefined) {\n stampPackage(cls, pkg);\n registry.define(tag, cls);\n } else {\n warnIfAnotherCopy(registry, tag, existing, cls, pkg);\n }\n }\n}\n","import pkg from \"../package.json\" with { type: \"json\" };\nimport { WcsPointerLock } from \"./components/PointerLock.js\";\nimport { config } from \"./config.js\";\nimport { defineElements } from \"./protocol/defineElement.js\";\n\n/**\n * Register this package's tags. Pass a scoped `CustomElementRegistry` to define\n * them for a single shadow tree -- scoped registries do not inherit the global\n * one, so a tree using one needs its own definitions.\n */\nexport function registerComponents(registry: CustomElementRegistry = customElements): void {\n defineElements(registry, `${pkg.name}@${pkg.version}`, [\n [config.tagNames.pointerLock, WcsPointerLock],\n ]);\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapPointerLock(userConfig?: IWritableConfig, registry?: CustomElementRegistry): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents(registry);\n}\n"],"names":[],"mappings":"AAQA,MAAM,OAAO,GAAoB;AAC/B,IAAA,QAAQ,EAAE;AACR,QAAA,WAAW,EAAE,kBAAkB;AAChC,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;QACjB,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC/C;AACA,IAAA,OAAO,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
2
2
|
"name": "@wcstack/pointer-lock",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.26.0",
|
|
4
4
|
"description": "Declarative Pointer Lock component for Web Components. Framework-agnostic Pointer Lock API control via wc-bindable-protocol.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.esm.js",
|