@wcstack/pointer-lock 4.5.0 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/auto.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ // Importing this module defines the package's custom elements. It exports nothing.
2
+ export {};
package/dist/auto.min.js CHANGED
@@ -1,2 +1,2 @@
1
- const e={tagNames:{pointerLock:"wcs-pointer-lock"}},t="capability-missing",r="invalid-argument",n="not-allowed",s="pointer-lock-error";function i(e,i){const o=function(e){return"string"==typeof e?.message?e.message:String(e)}(e);if("capability-missing"===i)return{code:t,phase:"probe",recoverable:!1,message:o};if("invalid-argument"===i)return{code:r,phase:"start",recoverable:!1,message:o};const c=e?.name;return"NotAllowedError"===c||"TypeError"===c?{code:n,phase:"execute",recoverable:!0,message:o}:{code:s,phase:"execute",recoverable:!1,message:o}}class o 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"}],commands:[{name:"requestPointerLock",async:!0},{name:"exitPointerLock"}]};_target;_active=!1;_error=null;_errorInfo=null;_resolvedTarget=null;_subscribed=!1;_gen=0;_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}observe(e){return this._resolvedTarget=e,this._subscribed||(this._subscribed=!0,document.addEventListener(this._pointerLockChangeEventName(),this._onChange)),this._applyActive(),this._ready}dispose(){this._gen++,this._subscribed&&(this._subscribed=!1,document.removeEventListener(this._pointerLockChangeEventName(),this._onChange)),this._resolvedTarget=null}async requestPointerLock(e){const t=++this._gen;if(this._resolvedTarget=e,!e)return void this._setError({message:"Pointer Lock target could not be resolved."},"invalid-argument");const r=this._requestPointerLockFn(e);if(r)try{if(await r(),t!==this._gen)return;this._setError(null),this._applyActive()}catch(e){if(t!==this._gen)return;this._setError(e)}else this._setError({message:"Pointer Lock API is not supported."},"capability-missing")}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"}_onChange=()=>{this._applyActive()};_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:i(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 c(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 a=new WeakMap;function l(e,t,r){const n=function(e,t){let r=a.get(e);return void 0===r&&(r=new Map,a.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 u extends HTMLElement{static hasConnectedCallbackPromise=!0;static observedAttributes=["target"];static wcBindable={...o.wcBindable,inputs:[{name:"target",attribute:"target"}],commands:o.wcBindable.commands};_core;_connectedCallbackPromise=Promise.resolve();_internals=null;constructor(){super(),this._core=new o(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[s,i]of Object.entries(n(e.detail))){try{i?t.add(s):t.delete(s)}catch{}r&&this.toggleAttribute(`data-wcs-state-${s}`,i)}})}get target(){return this.getAttribute("target")??""}set target(e){l(this,"target",e)}get active(){return this._core.active}get error(){return this._core.error}get errorInfo(){return this._core.errorInfo}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)for(const t of r){const r=t.name;if(!Object.prototype.hasOwnProperty.call(e,r))continue;if(!c(e,r))continue;const n=e,s=n[r];delete n[r],n[r]=s}}(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}}}var h;!function(t=customElements){t.get(e.tagNames.pointerLock)||t.define(e.tagNames.pointerLock,u)}(h);
1
+ const e={tagNames:{pointerLock:"wcs-pointer-lock"}},t="capability-missing",r="invalid-argument",n="not-allowed",s="pointer-lock-error";function o(e,o){const i=function(e){return"string"==typeof e?.message?e.message:String(e)}(e);if("capability-missing"===o)return{code:t,phase:"probe",recoverable:!1,message:i};if("invalid-argument"===o)return{code:r,phase:"start",recoverable:!1,message:i};const c=e?.name;return"NotAllowedError"===c||"TypeError"===c?{code:n,phase:"execute",recoverable:!0,message:i}:{code:s,phase:"execute",recoverable:!1,message:i}}class i 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"}],commands:[{name:"requestPointerLock",async:!0},{name:"exitPointerLock"}]};_target;_active=!1;_error=null;_errorInfo=null;_resolvedTarget=null;_subscribed=!1;_gen=0;_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}observe(e){return this._resolvedTarget=e,this._subscribed||(this._subscribed=!0,document.addEventListener(this._pointerLockChangeEventName(),this._onChange)),this._applyActive(),this._ready}dispose(){this._gen++,this._subscribed&&(this._subscribed=!1,document.removeEventListener(this._pointerLockChangeEventName(),this._onChange)),this._resolvedTarget=null}async requestPointerLock(e){const t=++this._gen;if(this._resolvedTarget=e,!e)return void this._setError({message:"Pointer Lock target could not be resolved."},"invalid-argument");const r=this._requestPointerLockFn(e);if(r)try{if(await r(),t!==this._gen)return;this._setError(null),this._applyActive()}catch(e){if(t!==this._gen)return;this._setError(e)}else this._setError({message:"Pointer Lock API is not supported."},"capability-missing")}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"}_onChange=()=>{this._applyActive()};_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:o(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 c(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 a=new WeakSet;function l(e,t,r){if(a.has(e))return;a.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 u=new WeakMap;function h(e,t,r){const n=function(e,t){let r=u.get(e);return void 0===r&&(r=new Map,u.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 d extends HTMLElement{static hasConnectedCallbackPromise=!0;static observedAttributes=["target"];static wcBindable={...i.wcBindable,inputs:[{name:"target",attribute:"target"}],commands:i.wcBindable.commands};_core;_connectedCallbackPromise=Promise.resolve();_internals=null;constructor(){super(),this._core=new i(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[s,o]of Object.entries(n(e.detail))){try{o?t.add(s):t.delete(s)}catch{}r&&this.toggleAttribute(`data-wcs-state-${s}`,o)}})}get target(){return this.getAttribute("target")??""}set target(e){h(this,"target",e)}get active(){return this._core.active}get error(){return this._core.error}get errorInfo(){return this._core.errorInfo}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,s="function"==typeof n?n.call(e,r.toLowerCase()):null;if(null!==s&&s.startsWith("[object ")&&l(e,r,s),!Object.prototype.hasOwnProperty.call(e,r))continue;if(!c(e,r))continue;const o=e,i=o[r];delete o[r],o[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}}}var p;!function(t=customElements){t.get(e.tagNames.pointerLock)||t.define(e.tagNames.pointerLock,d)}(p);
2
2
  //# sourceMappingURL=auto.min.js.map
@@ -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/bootstrapPointerLock.ts","../src/registerComponents.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/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n */\nexport function upgradeProperties(element: object): void {\n const declaration = (element as { constructor?: { wcBindable?: IWcBindable } }).constructor?.wcBindable;\n const inputs = declaration?.inputs;\n if (inputs === undefined) return;\n for (const input of inputs) {\n const name = input.name;\n if (!Object.prototype.hasOwnProperty.call(element, name)) continue;\n if (!hasAccessorOnPrototype(element, name)) continue;\n const record = element as Record<string, unknown>;\n const value = record[name];\n delete record[name];\n record[name] = value;\n }\n}\n","// ===========================================================================\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","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","import { WcsPointerLock } from \"./components/PointerLock.js\";\nimport { config } from \"./config.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 if (!registry.get(config.tagNames.pointerLock)) {\n registry.define(config.tagNames.pointerLock, WcsPointerLock);\n }\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","initialAttributes","WeakMap","reflectAttribute","value","initial","byName","Map","has","getAttribute","initialAttribute","removeAttribute","setAttribute","writeAttribute","WcsPointerLock","HTMLElement","wcBindable","inputs","attribute","_core","_connectedCallbackPromise","_internals","_initInternals","_wireStates","connectedCallbackPromise","debugStates","states","attachInternals","internals","add","delete","map","toStates","entries","debug","hasAttribute","on","toggleAttribute","_resolveTarget","connectedCallback","declaration","input","hasOwnProperty","call","record","upgradeProperties","_applyDisplayAndObserve","disconnectedCallback","attributeChangedCallback","isConnected","display","style","scope","getRootNode","_safeQuery","child","firstElementChild","selector","querySelector","registry","customElements","define","registerComponents"],"mappings":"AAQA,MA0BaA,EA1BoB,CAC/BC,SAAU,CACRC,YAAa,qBCUJC,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,QA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J,EAAOC,SAASC,YAAamG,EAEjD,CDJEgD,CAAmBH"}
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/bootstrapPointerLock.ts","../src/registerComponents.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","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","import { WcsPointerLock } from \"./components/PointerLock.js\";\nimport { config } from \"./config.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 if (!registry.get(config.tagNames.pointerLock)) {\n registry.define(config.tagNames.pointerLock, WcsPointerLock);\n }\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","registry","customElements","define","registerComponents"],"mappings":"AAQA,MA0BaA,EA1BoB,CAC/BC,SAAU,CACRC,YAAa,qBCUJC,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,GACF,OAAOD,KAAKN,MACd,CAEA,UAAIQ,GACF,OAAOF,KAAKZ,OACd,CAEA,SAAIpB,GACF,OAAOgC,KAAKX,MACd,CAQA,aAAIc,GACF,OAAOH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a2G,EAEjD,CDJEiD,CAAmBH"}
package/dist/index.esm.js CHANGED
@@ -405,6 +405,21 @@ function hasAccessorOnPrototype(target, name) {
405
405
  }
406
406
  return false;
407
407
  }
408
+ // 属性になってしまったオブジェクトの入力(`files="[object File]"`)を、要素ごとに 1 回だけ言う。
409
+ // React 19 は定義前の要素にプロパティが無いのでオブジェクトを属性に書き、Vue の `.attr` も
410
+ // 書く。要素はその入力をプロパティでしか読まないので、何も受け取らず、何も言わなかった
411
+ // (docs/seam-apps.md、fw-inventory)。
412
+ const toldObjectAttribute = new WeakSet();
413
+ function warnObjectAttribute(element, name, value) {
414
+ if (toldObjectAttribute.has(element))
415
+ return;
416
+ toldObjectAttribute.add(element);
417
+ const tag = element.localName ?? "element";
418
+ console.warn(`[wcs/input-as-attribute] <${tag}> has the attribute ${name}="${value}": an object was written as an ` +
419
+ `attribute, so the element did not receive it. A framework does that when the property is set before the ` +
420
+ `element's definition loads (React 19), or when told to (Vue's .attr). Load the definition before rendering, ` +
421
+ `or assign the property through a ref (Vue: .prop). (Said once per element.)`, element);
422
+ }
408
423
  /**
409
424
  * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で
410
425
  * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。
@@ -412,14 +427,19 @@ function hasAccessorOnPrototype(target, name) {
412
427
  * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。
413
428
  * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。
414
429
  * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。
430
+ * - 値が `[object …]` の属性(属性に書かれてしまったオブジェクトの入力)は、要素ごとに 1 回警告する。
415
431
  */
416
432
  function upgradeProperties(element) {
417
433
  const declaration = element.constructor?.wcBindable;
418
434
  const inputs = declaration?.inputs;
419
435
  if (inputs === undefined)
420
436
  return;
437
+ const getAttribute = element.getAttribute;
421
438
  for (const input of inputs) {
422
439
  const name = input.name;
440
+ const attribute = typeof getAttribute === "function" ? getAttribute.call(element, name.toLowerCase()) : null;
441
+ if (attribute !== null && attribute.startsWith("[object "))
442
+ warnObjectAttribute(element, name, attribute);
423
443
  if (!Object.prototype.hasOwnProperty.call(element, name))
424
444
  continue;
425
445
  if (!hasAccessorOnPrototype(element, name))
@@ -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/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/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n */\nexport function upgradeProperties(element: object): void {\n const declaration = (element as { constructor?: { wcBindable?: IWcBindable } }).constructor?.wcBindable;\n const inputs = declaration?.inputs;\n if (inputs === undefined) return;\n for (const input of inputs) {\n const name = input.name;\n if (!Object.prototype.hasOwnProperty.call(element, name)) continue;\n if (!hasAccessorOnPrototype(element, name)) continue;\n const record = element as Record<string, unknown>;\n const value = record[name];\n delete record[name];\n record[name] = value;\n }\n}\n","// ===========================================================================\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","import { WcsPointerLock } from \"./components/PointerLock.js\";\nimport { config } from \"./config.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 if (!registry.get(config.tagNames.pointerLock)) {\n registry.define(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,IA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ACA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE;IAC5C;;IAGQ,UAAU,CAAC,KAA4B,EAAE,QAAgB,EAAA;AAC/D,QAAA,IAAI;AACF,YAAA,OAAO,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC;QACtC;AAAE,QAAA,MAAM;AACN,YAAA,OAAO,IAAI;QACb;IACF;;;AC3MF;;;;AAIG;AACG,SAAU,kBAAkB,CAAC,QAAA,GAAkC,cAAc,EAAA;AACjF,IAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;QAC9C,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC;IAC9D;AACF;;ACRM,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/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","import { WcsPointerLock } from \"./components/PointerLock.js\";\nimport { config } from \"./config.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 if (!registry.get(config.tagNames.pointerLock)) {\n registry.define(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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C,WAAW,CAAC,EAAE;QAC9C,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC;IAC9D;AACF;;ACRM,SAAU,oBAAoB,CAAC,UAA4B,EAAE,QAAgC,EAAA;IACjG,IAAI,UAAU,EAAE;QACd,SAAS,CAAC,UAAU,CAAC;IACvB;IACA,kBAAkB,CAAC,QAAQ,CAAC;AAC9B;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wcstack/pointer-lock",
3
- "version": "4.5.0",
3
+ "version": "4.6.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",
@@ -11,7 +11,10 @@
11
11
  "types": "./dist/index.d.ts",
12
12
  "import": "./dist/index.esm.js"
13
13
  },
14
- "./auto": "./dist/auto.min.js"
14
+ "./auto": {
15
+ "types": "./dist/auto.d.ts",
16
+ "import": "./dist/auto.min.js"
17
+ }
15
18
  },
16
19
  "files": [
17
20
  "dist"