@wcstack/geolocation 4.10.1 → 4.11.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.min.js +1 -1
- package/dist/auto.min.js.map +1 -1
- package/dist/index.esm.js +65 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/auto.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const t={triggerAttribute:"data-geotarget",tagNames:{geo:"wcs-geo"}},e=new Set(["camera","microphone","geolocation","midi","clipboard-read","clipboard-write","screen-wake-lock","idle-detection","accelerometer","gyroscope","magnetometer","ambient-light-sensor","display-capture"]);function i(t){const i=globalThis;if(!1===i.isSecureContext)return"insecure-context";if(!e.has(t))return null;const s=i.document?.permissionsPolicy??i.document?.featurePolicy;if(void 0===s||"function"!=typeof s.allowsFeature)return null;try{return s.allowsFeature(t)?null:"policy-blocked"}catch{return null}}function s(t,e,i){return"insecure-context"===i?`${t} needs a secure context (https:, or http://localhost), and this page is not one.`:`${t} is turned off for this page by a Permissions-Policy: the server's Permissions-Policy header, or an <iframe> without allow="${e}". The browser's site settings cannot change that.`}const n="permission-denied",r="position-unavailable",o="timeout",a="capability-missing";class c extends EventTarget{static wcBindable={protocol:"wc-bindable",version:1,properties:[{name:"position",event:"wcs-geo:position",semantics:"state"},{name:"latitude",event:"wcs-geo:position",semantics:"state",getter:t=>t.detail.latitude},{name:"longitude",event:"wcs-geo:position",semantics:"state",getter:t=>t.detail.longitude},{name:"accuracy",event:"wcs-geo:position",semantics:"state",getter:t=>t.detail.accuracy},{name:"coords",event:"wcs-geo:position",semantics:"state",getter:t=>t.detail.coords},{name:"timestamp",event:"wcs-geo:position",semantics:"state",getter:t=>t.detail.timestamp},{name:"watching",event:"wcs-geo:watching-changed",semantics:"state"},{name:"loading",event:"wcs-geo:loading-changed",semantics:"state"},{name:"error",event:"wcs-geo:error",semantics:"state"},{name:"permission",event:"wcs-geo:permission-changed",semantics:"state"},{name:"errorInfo",event:"wcs-geo:error-info-changed",semantics:"state"}],commands:[{name:"getCurrentPosition",async:!0},{name:"watch"},{name:"clearWatch"}]};_target;_watchId=null;_position=null;_watching=!1;_loading=!1;_error=null;_errorInfo=null;_unsupportedErrors=new WeakSet;_permission="prompt";_permissionStatus=null;_permissionSubscribed=!1;_permGen=0;_acqGen=0;_watchGen=0;_ready=Promise.resolve();constructor(t){super(),this._target=t??this,this._ready=this._initPermission()}get position(){return this._position}get latitude(){return this._position?this._position.latitude:null}get longitude(){return this._position?this._position.longitude:null}get accuracy(){return this._position?this._position.accuracy:null}get coords(){return this._position?this._position.coords:null}get timestamp(){return this._position?this._position.timestamp:null}get watching(){return this._watching}get loading(){return this._loading}get error(){return this._error}get errorInfo(){return this._errorInfo}get permission(){return this._permission}get ready(){return this._ready}_setPosition(t){this._position=t,this._target.dispatchEvent(new CustomEvent("wcs-geo:position",{detail:t,bubbles:!0}))}_setWatching(t){this._watching!==t&&(this._watching=t,this._target.dispatchEvent(new CustomEvent("wcs-geo:watching-changed",{detail:t,bubbles:!0})))}_setLoading(t){this._loading!==t&&(this._loading=t,this._target.dispatchEvent(new CustomEvent("wcs-geo:loading-changed",{detail:t,bubbles:!0})))}_setError(t){this._error!==t&&(this._error=t,this._commitErrorInfo(null===t?null:function(t,e,i=!1){return i?{code:a,phase:"probe",recoverable:!1,message:e}:{code:1===t?n:3===t?o:r,phase:"execute",recoverable:1!==t,message:e}}(t.code,t.message,this._unsupportedErrors.has(t))),this._target.dispatchEvent(new CustomEvent("wcs-geo:error",{detail:t,bubbles:!0})))}_commitErrorInfo(t){this._errorInfo=t,this._target.dispatchEvent(new CustomEvent("wcs-geo:error-info-changed",{detail:t,bubbles:!0}))}_setPermission(t){this._permission!==t&&(this._permission=t,this._target.dispatchEvent(new CustomEvent("wcs-geo:permission-changed",{detail:t,bubbles:!0})))}getCurrentPosition(t={}){return new Promise(e=>{if(!this._hasGeolocation())return this._setError(this._unsupportedError()),void e();const i=this._acqGen;this._setLoading(!0),this._setError(null),navigator.geolocation.getCurrentPosition(t=>{if(i===this._acqGen){try{this._setLoading(!1),this._setPosition(this._normalizePosition(t))}catch{this._setError(this._unexpectedError())}e()}else e()},t=>{if(i===this._acqGen){try{this._setLoading(!1),this._setError(this._normalizeError(t))}catch{this._setError(this._unexpectedError())}e()}else e()},t)})}watch(t={}){if(!this._hasGeolocation())return void this._setError(this._unsupportedError());if(this._watching)return;this._setError(null),this._setWatching(!0);const e=++this._watchGen;this._watchId=navigator.geolocation.watchPosition(t=>{if(e===this._watchGen)try{this._setError(null),this._setPosition(this._normalizePosition(t))}catch{this._setError(this._unexpectedError())}},t=>{if(e===this._watchGen)try{this._setError(this._normalizeError(t))}catch{this._setError(this._unexpectedError())}},t)}clearWatch(){null!==this._watchId&&(navigator.geolocation.clearWatch(this._watchId),this._watchId=null),this._watchGen++,this._setWatching(!1)}observe(){return this._permissionSubscribed||(this._ready=this._initPermission()),this._ready}reinitPermission(){this.observe()}dispose(){this._permissionSubscribed=!1,this._permGen++,this._acqGen++,this._watchGen++,this._setLoading(!1),this._permissionStatus&&(this._permissionStatus.removeEventListener("change",this._onPermissionChange),this._permissionStatus=null)}_hasGeolocation(){return"undefined"!=typeof navigator&&!!navigator.geolocation&&null===i("geolocation")}_initPermission(){if(null!==i("geolocation"))return this._setPermission("unsupported"),Promise.resolve();if("undefined"==typeof navigator||!navigator.permissions||"function"!=typeof navigator.permissions.query)return this._setPermission("unsupported"),Promise.resolve();this._permissionSubscribed=!0;const t=++this._permGen;return navigator.permissions.query({name:"geolocation"}).then(e=>{t===this._permGen&&(this._permissionStatus=e,this._setPermission(e.state),e.addEventListener("change",this._onPermissionChange))},()=>{t===this._permGen&&this._setPermission("unsupported")})}_onPermissionChange=t=>{const e=t.target;this._setPermission(e.state)};_normalizePosition(t){const e=t.coords,i={latitude:e.latitude,longitude:e.longitude,accuracy:e.accuracy,altitude:e.altitude,altitudeAccuracy:e.altitudeAccuracy,heading:e.heading,speed:e.speed};return{...i,timestamp:t.timestamp,coords:i}}_normalizeError(t){return{code:t.code,message:t.message}}_unsupportedError(){const t=i("geolocation"),e={code:2,message:null===t?"Geolocation API is not available in this environment.":s("Geolocation","geolocation",t)};return this._unsupportedErrors.add(e),e}_unexpectedError(){return{code:2,message:"Unexpected error while processing the position fix."}}}let h=!1;function u(e){const i=e.target;if(!(i instanceof Element))return;const s=i.closest(`[${t.triggerAttribute}]`);if(!s)return;const n=s.getAttribute(t.triggerAttribute);if(!n)return;const r=customElements.get(t.tagNames.geo),o=document.getElementById(n);r&&o instanceof r&&(e.preventDefault(),o.getCurrentPosition())}function l(t,e){let i=Object.getPrototypeOf(t);for(;null!==i;){const t=Object.getOwnPropertyDescriptor(i,e);if(void 0!==t)return"function"==typeof t.get||"function"==typeof t.set;i=Object.getPrototypeOf(i)}return!1}const g=new WeakSet;function m(t,e,i){if(g.has(t))return;g.add(t);const s=t.localName??"element";console.warn(`[wcs/input-as-attribute] <${s}> has the attribute ${e}="${i}": 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.)`,t)}const d=new WeakMap;function _(t,e){let i=d.get(t);return void 0===i&&(i=new Map,d.set(t,i)),i.has(e)||i.set(e,t.getAttribute(e)),i.get(e)}function p(t,e,i){null===i?t.removeAttribute(e):t.setAttribute(e,i)}function w(t,e,i){const s=_(t,e);p(t,e,void 0===i?s:null===i?null:String(i))}function b(t,e,i){const s=_(t,e);p(t,e,void 0===i?s:i?"":null)}class f extends HTMLElement{static hasConnectedCallbackPromise=!0;static wcBindable={...c.wcBindable,properties:[...c.wcBindable.properties,{name:"trigger",event:"wcs-geo:trigger-changed",semantics:"state"}],inputs:[{name:"highAccuracy",attribute:"high-accuracy"},{name:"timeout",attribute:"timeout"},{name:"maximumAge",attribute:"maximum-age"},{name:"watch",attribute:"watch"},{name:"manual",attribute:"manual"},{name:"trigger"}],commands:[{name:"getCurrentPosition",async:!0},{name:"watchPosition"},{name:"clearWatch"}]};_core;_trigger=!1;_connectedCallbackPromise=Promise.resolve();_connectResolve=null;_locatePending=!1;_watchCancelled=!1;_internals=null;constructor(){super(),this._core=new c(this),this._internals=this._initInternals(),this._wireStates({"wcs-geo:watching-changed":t=>({watching:!0===t}),"wcs-geo:loading-changed":t=>({loading:!0===t}),"wcs-geo:error":t=>({error:null!=t})})}get debugStates(){return this._internals?[...this._internals.states]:[]}_initInternals(){try{if("function"!=typeof this.attachInternals)return null;const t=this.attachInternals();return t.states.add("wcs-probe"),t.states.delete("wcs-probe"),t}catch{return null}}_wireStates(t){if(null===this._internals)return;const e=this._internals.states;for(const[i,s]of Object.entries(t))this.addEventListener(i,t=>{const i=this.hasAttribute("debug-states");for(const[n,r]of Object.entries(s(t.detail))){try{r?e.add(n):e.delete(n)}catch{}i&&this.toggleAttribute(`data-wcs-state-${n}`,r)}})}get highAccuracy(){return this.hasAttribute("high-accuracy")}set highAccuracy(t){b(this,"high-accuracy",t)}get timeout(){const t=this.getAttribute("timeout");if(null===t||""===t.trim())return 1/0;const e=Number(t);return Number.isFinite(e)&&e>=0?e:1/0}set timeout(t){w(this,"timeout",t)}get maximumAge(){const t=this.getAttribute("maximum-age");if(null===t||""===t.trim())return 0;const e=Number(t);return Number.isFinite(e)&&e>=0?e:0}set maximumAge(t){w(this,"maximum-age",t)}get watch(){return this.hasAttribute("watch")}set watch(t){b(this,"watch",t)}get manual(){return this.hasAttribute("manual")}set manual(t){b(this,"manual",t)}get position(){return this._core.position}get latitude(){return this._core.latitude}get longitude(){return this._core.longitude}get accuracy(){return this._core.accuracy}get coords(){return this._core.coords}get timestamp(){return this._core.timestamp}get watching(){return this._core.watching}get loading(){return this._core.loading}get error(){return this._core.error}get errorInfo(){return this._core.errorInfo}get permission(){return this._core.permission}get connectedCallbackPromise(){return this._connectedCallbackPromise}get trigger(){return this._trigger}set trigger(t){!!t&&(this._trigger=!0,this.getCurrentPosition(),this._trigger=!1,this.dispatchEvent(new CustomEvent("wcs-geo:trigger-changed",{detail:!1,bubbles:!0})))}getCurrentPosition(){return this._core.getCurrentPosition(this._options())}watchPosition(){this._core.watch(this._options())}clearWatch(){null!==this._connectResolve&&(this._watchCancelled=!0),this._core.clearWatch()}_options(){return{enableHighAccuracy:this.highAccuracy,timeout:this.timeout,maximumAge:this.maximumAge}}_scheduleLocate(){this._locatePending||(this._locatePending=!0,queueMicrotask(()=>{this._locatePending=!1;const t=this._connectResolve;if(this._connectResolve=null,null===t)return;const e=this._watchCancelled;this._watchCancelled=!1,this.manual?t():this.watch?(e||this.watchPosition(),t()):t(this.getCurrentPosition())}))}connectedCallback(){!function(t){const e=t.constructor?.wcBindable,i=e?.inputs;if(void 0===i)return;const s=t.getAttribute;for(const e of i){const i=e.name,n="function"==typeof s?s.call(t,i.toLowerCase()):null;if(null!==n&&n.startsWith("[object ")&&m(t,i,n),!Object.prototype.hasOwnProperty.call(t,i))continue;if(!l(t,i))continue;const r=t,o=r[i];delete r[i],r[i]=o}}(this),this.style.display="none",h||(h=!0,document.addEventListener("click",u)),this._core.reinitPermission(),this._connectedCallbackPromise=new Promise(t=>{this._connectResolve=t}),this._scheduleLocate()}disconnectedCallback(){this._connectResolve?.(),this._connectResolve=null,this._watchCancelled=!1,this._core.clearWatch(),this._core.dispose()}}var v;!function(e=customElements){e.get(t.tagNames.geo)||e.define(t.tagNames.geo,f)}(v);
|
|
1
|
+
const t={triggerAttribute:"data-geotarget",tagNames:{geo:"wcs-geo"}};var e="@wcstack/geolocation",i="4.11.0";const s=new Set(["camera","microphone","geolocation","midi","clipboard-read","clipboard-write","screen-wake-lock","idle-detection","accelerometer","gyroscope","magnetometer","ambient-light-sensor","display-capture"]);function n(t){const e=globalThis;if(!1===e.isSecureContext)return"insecure-context";if(!s.has(t))return null;const i=e.document?.permissionsPolicy??e.document?.featurePolicy;if(void 0===i||"function"!=typeof i.allowsFeature)return null;try{return i.allowsFeature(t)?null:"policy-blocked"}catch{return null}}function r(t,e,i){return"insecure-context"===i?`${t} needs a secure context (https:, or http://localhost), and this page is not one.`:`${t} is turned off for this page by a Permissions-Policy: the server's Permissions-Policy header, or an <iframe> without allow="${e}". The browser's site settings cannot change that.`}const o="permission-denied",a="position-unavailable",c="timeout",h="capability-missing";class u extends EventTarget{static wcBindable={protocol:"wc-bindable",version:1,properties:[{name:"position",event:"wcs-geo:position",semantics:"state"},{name:"latitude",event:"wcs-geo:position",semantics:"state",getter:t=>t.detail.latitude},{name:"longitude",event:"wcs-geo:position",semantics:"state",getter:t=>t.detail.longitude},{name:"accuracy",event:"wcs-geo:position",semantics:"state",getter:t=>t.detail.accuracy},{name:"coords",event:"wcs-geo:position",semantics:"state",getter:t=>t.detail.coords},{name:"timestamp",event:"wcs-geo:position",semantics:"state",getter:t=>t.detail.timestamp},{name:"watching",event:"wcs-geo:watching-changed",semantics:"state"},{name:"loading",event:"wcs-geo:loading-changed",semantics:"state"},{name:"error",event:"wcs-geo:error",semantics:"state"},{name:"permission",event:"wcs-geo:permission-changed",semantics:"state"},{name:"errorInfo",event:"wcs-geo:error-info-changed",semantics:"state"}],commands:[{name:"getCurrentPosition",async:!0},{name:"watch"},{name:"clearWatch"}]};_target;_watchId=null;_position=null;_watching=!1;_loading=!1;_error=null;_errorInfo=null;_unsupportedErrors=new WeakSet;_permission="prompt";_permissionStatus=null;_permissionSubscribed=!1;_permGen=0;_acqGen=0;_watchGen=0;_ready=Promise.resolve();constructor(t){super(),this._target=t??this,this._ready=this._initPermission()}get position(){return this._position}get latitude(){return this._position?this._position.latitude:null}get longitude(){return this._position?this._position.longitude:null}get accuracy(){return this._position?this._position.accuracy:null}get coords(){return this._position?this._position.coords:null}get timestamp(){return this._position?this._position.timestamp:null}get watching(){return this._watching}get loading(){return this._loading}get error(){return this._error}get errorInfo(){return this._errorInfo}get permission(){return this._permission}get ready(){return this._ready}_setPosition(t){this._position=t,this._target.dispatchEvent(new CustomEvent("wcs-geo:position",{detail:t,bubbles:!0}))}_setWatching(t){this._watching!==t&&(this._watching=t,this._target.dispatchEvent(new CustomEvent("wcs-geo:watching-changed",{detail:t,bubbles:!0})))}_setLoading(t){this._loading!==t&&(this._loading=t,this._target.dispatchEvent(new CustomEvent("wcs-geo:loading-changed",{detail:t,bubbles:!0})))}_setError(t){this._error!==t&&(this._error=t,this._commitErrorInfo(null===t?null:function(t,e,i=!1){return i?{code:h,phase:"probe",recoverable:!1,message:e}:{code:1===t?o:3===t?c:a,phase:"execute",recoverable:1!==t,message:e}}(t.code,t.message,this._unsupportedErrors.has(t))),this._target.dispatchEvent(new CustomEvent("wcs-geo:error",{detail:t,bubbles:!0})))}_commitErrorInfo(t){this._errorInfo=t,this._target.dispatchEvent(new CustomEvent("wcs-geo:error-info-changed",{detail:t,bubbles:!0}))}_setPermission(t){this._permission!==t&&(this._permission=t,this._target.dispatchEvent(new CustomEvent("wcs-geo:permission-changed",{detail:t,bubbles:!0})))}getCurrentPosition(t={}){return new Promise(e=>{if(!this._hasGeolocation())return this._setError(this._unsupportedError()),void e();const i=this._acqGen;this._setLoading(!0),this._setError(null),navigator.geolocation.getCurrentPosition(t=>{if(i===this._acqGen){try{this._setLoading(!1),this._setPosition(this._normalizePosition(t))}catch{this._setError(this._unexpectedError())}e()}else e()},t=>{if(i===this._acqGen){try{this._setLoading(!1),this._setError(this._normalizeError(t))}catch{this._setError(this._unexpectedError())}e()}else e()},t)})}watch(t={}){if(!this._hasGeolocation())return void this._setError(this._unsupportedError());if(this._watching)return;this._setError(null),this._setWatching(!0);const e=++this._watchGen;this._watchId=navigator.geolocation.watchPosition(t=>{if(e===this._watchGen)try{this._setError(null),this._setPosition(this._normalizePosition(t))}catch{this._setError(this._unexpectedError())}},t=>{if(e===this._watchGen)try{this._setError(this._normalizeError(t))}catch{this._setError(this._unexpectedError())}},t)}clearWatch(){null!==this._watchId&&(navigator.geolocation.clearWatch(this._watchId),this._watchId=null),this._watchGen++,this._setWatching(!1)}observe(){return this._permissionSubscribed||(this._ready=this._initPermission()),this._ready}reinitPermission(){this.observe()}dispose(){this._permissionSubscribed=!1,this._permGen++,this._acqGen++,this._watchGen++,this._setLoading(!1),this._permissionStatus&&(this._permissionStatus.removeEventListener("change",this._onPermissionChange),this._permissionStatus=null)}_hasGeolocation(){return"undefined"!=typeof navigator&&!!navigator.geolocation&&null===n("geolocation")}_initPermission(){if(null!==n("geolocation"))return this._setPermission("unsupported"),Promise.resolve();if("undefined"==typeof navigator||!navigator.permissions||"function"!=typeof navigator.permissions.query)return this._setPermission("unsupported"),Promise.resolve();this._permissionSubscribed=!0;const t=++this._permGen;return navigator.permissions.query({name:"geolocation"}).then(e=>{t===this._permGen&&(this._permissionStatus=e,this._setPermission(e.state),e.addEventListener("change",this._onPermissionChange))},()=>{t===this._permGen&&this._setPermission("unsupported")})}_onPermissionChange=t=>{const e=t.target;this._setPermission(e.state)};_normalizePosition(t){const e=t.coords,i={latitude:e.latitude,longitude:e.longitude,accuracy:e.accuracy,altitude:e.altitude,altitudeAccuracy:e.altitudeAccuracy,heading:e.heading,speed:e.speed};return{...i,timestamp:t.timestamp,coords:i}}_normalizeError(t){return{code:t.code,message:t.message}}_unsupportedError(){const t=n("geolocation"),e={code:2,message:null===t?"Geolocation API is not available in this environment.":r("Geolocation","geolocation",t)};return this._unsupportedErrors.add(e),e}_unexpectedError(){return{code:2,message:"Unexpected error while processing the position fix."}}}let l=!1;function g(e){const i=e.target;if(!(i instanceof Element))return;const s=i.closest(`[${t.triggerAttribute}]`);if(!s)return;const n=s.getAttribute(t.triggerAttribute);if(!n)return;const r=customElements.get(t.tagNames.geo),o=document.getElementById(n);r&&o instanceof r&&(e.preventDefault(),o.getCurrentPosition())}function d(t,e){let i=Object.getPrototypeOf(t);for(;null!==i;){const t=Object.getOwnPropertyDescriptor(i,e);if(void 0!==t)return"function"==typeof t.get||"function"==typeof t.set;i=Object.getPrototypeOf(i)}return!1}const m=new WeakSet;function _(t,e,i){if(m.has(t))return;m.add(t);const s=t.localName??"element";console.warn(`[wcs/input-as-attribute] <${s}> has the attribute ${e}="${i}": 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.)`,t)}const p=new WeakMap;function w(t,e){let i=p.get(t);return void 0===i&&(i=new Map,p.set(t,i)),i.has(e)||i.set(e,t.getAttribute(e)),i.get(e)}function b(t,e,i){null===i?t.removeAttribute(e):t.setAttribute(e,i)}function f(t,e,i){const s=w(t,e);b(t,e,void 0===i?s:null===i?null:String(i))}function v(t,e,i){const s=w(t,e);b(t,e,void 0===i?s:i?"":null)}class y extends HTMLElement{static hasConnectedCallbackPromise=!0;static wcBindable={...u.wcBindable,properties:[...u.wcBindable.properties,{name:"trigger",event:"wcs-geo:trigger-changed",semantics:"state"}],inputs:[{name:"highAccuracy",attribute:"high-accuracy"},{name:"timeout",attribute:"timeout"},{name:"maximumAge",attribute:"maximum-age"},{name:"watch",attribute:"watch"},{name:"manual",attribute:"manual"},{name:"trigger"}],commands:[{name:"getCurrentPosition",async:!0},{name:"watchPosition"},{name:"clearWatch"}]};_core;_trigger=!1;_connectedCallbackPromise=Promise.resolve();_connectResolve=null;_locatePending=!1;_watchCancelled=!1;_internals=null;constructor(){super(),this._core=new u(this),this._internals=this._initInternals(),this._wireStates({"wcs-geo:watching-changed":t=>({watching:!0===t}),"wcs-geo:loading-changed":t=>({loading:!0===t}),"wcs-geo:error":t=>({error:null!=t})})}get debugStates(){return this._internals?[...this._internals.states]:[]}_initInternals(){try{if("function"!=typeof this.attachInternals)return null;const t=this.attachInternals();return t.states.add("wcs-probe"),t.states.delete("wcs-probe"),t}catch{return null}}_wireStates(t){if(null===this._internals)return;const e=this._internals.states;for(const[i,s]of Object.entries(t))this.addEventListener(i,t=>{const i=this.hasAttribute("debug-states");for(const[n,r]of Object.entries(s(t.detail))){try{r?e.add(n):e.delete(n)}catch{}i&&this.toggleAttribute(`data-wcs-state-${n}`,r)}})}get highAccuracy(){return this.hasAttribute("high-accuracy")}set highAccuracy(t){v(this,"high-accuracy",t)}get timeout(){const t=this.getAttribute("timeout");if(null===t||""===t.trim())return 1/0;const e=Number(t);return Number.isFinite(e)&&e>=0?e:1/0}set timeout(t){f(this,"timeout",t)}get maximumAge(){const t=this.getAttribute("maximum-age");if(null===t||""===t.trim())return 0;const e=Number(t);return Number.isFinite(e)&&e>=0?e:0}set maximumAge(t){f(this,"maximum-age",t)}get watch(){return this.hasAttribute("watch")}set watch(t){v(this,"watch",t)}get manual(){return this.hasAttribute("manual")}set manual(t){v(this,"manual",t)}get position(){return this._core.position}get latitude(){return this._core.latitude}get longitude(){return this._core.longitude}get accuracy(){return this._core.accuracy}get coords(){return this._core.coords}get timestamp(){return this._core.timestamp}get watching(){return this._core.watching}get loading(){return this._core.loading}get error(){return this._core.error}get errorInfo(){return this._core.errorInfo}get permission(){return this._core.permission}get connectedCallbackPromise(){return this._connectedCallbackPromise}get trigger(){return this._trigger}set trigger(t){!!t&&(this._trigger=!0,this.getCurrentPosition(),this._trigger=!1,this.dispatchEvent(new CustomEvent("wcs-geo:trigger-changed",{detail:!1,bubbles:!0})))}getCurrentPosition(){return this._core.getCurrentPosition(this._options())}watchPosition(){this._core.watch(this._options())}clearWatch(){null!==this._connectResolve&&(this._watchCancelled=!0),this._core.clearWatch()}_options(){return{enableHighAccuracy:this.highAccuracy,timeout:this.timeout,maximumAge:this.maximumAge}}_scheduleLocate(){this._locatePending||(this._locatePending=!0,queueMicrotask(()=>{this._locatePending=!1;const t=this._connectResolve;if(this._connectResolve=null,null===t)return;const e=this._watchCancelled;this._watchCancelled=!1,this.manual?t():this.watch?(e||this.watchPosition(),t()):t(this.getCurrentPosition())}))}connectedCallback(){!function(t){const e=t.constructor?.wcBindable,i=e?.inputs;if(void 0===i)return;const s=t.getAttribute;for(const e of i){const i=e.name,n="function"==typeof s?s.call(t,i.toLowerCase()):null;if(null!==n&&n.startsWith("[object ")&&_(t,i,n),!Object.prototype.hasOwnProperty.call(t,i))continue;if(!d(t,i))continue;const r=t,o=r[i];delete r[i],r[i]=o}}(this),this.style.display="none",l||(l=!0,document.addEventListener("click",g)),this._core.reinitPermission(),this._connectedCallbackPromise=new Promise(t=>{this._connectResolve=t}),this._scheduleLocate()}disconnectedCallback(){this._connectResolve?.(),this._connectResolve=null,this._watchCancelled=!1,this._core.clearWatch(),this._core.dispose()}}const P=Symbol.for("wcstack.package"),E=new WeakSet;function C(t,e){Object.defineProperty(t,P,{value:e,configurable:!0})}function A(t,e,i,s,n){if(void 0!==s&&(i===s||i.prototype instanceof s))return;const r=i[P];if(r===n||E.has(t))return;E.add(t);const o=n.slice(0,n.lastIndexOf("@"));console.warn(`[${o}] [wcs/package-twice] <${e}> is already defined by ${r??`another copy of ${o} that does not name its version`}; this copy, ${n}, does nothing. Load each package once.`)}function x(s=customElements){!function(t,e,i){for(const[s,n]of i){const i=t.get(s);void 0===i?(C(n,e),t.define(s,n)):A(t,s,i,n,e)}}(s,`${e}@${i}`,[[t.tagNames.geo,y]])}var k;x(k);
|
|
2
2
|
//# sourceMappingURL=auto.min.js.map
|
package/dist/auto.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto.min.js","sources":["../src/config.ts","../src/core/platformCapability.ts","../src/core/geolocationCapabilities.ts","../src/core/GeolocationCore.ts","../src/autoTrigger.ts","../src/protocol/upgradeProperties.ts","../src/protocol/inputAttribute.ts","../src/components/Geolocation.ts","../src/bootstrapGeolocation.ts","../src/registerComponents.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n autoTrigger: boolean;\n triggerAttribute: string;\n tagNames: {\n geo: string;\n };\n}\n\nconst _config: IInternalConfig = {\n autoTrigger: true,\n triggerAttribute: \"data-geotarget\",\n tagNames: {\n geo: \"wcs-geo\",\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: `bootstrapGeolocation` refuses it. */\nfunction invalid(key: string): never {\n throw new Error(`[@wcstack/geolocation] bootstrapGeolocation: \"${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 [key, value] of given) {\n if (key !== \"tagNames\") {\n options[key] = value;\n }\n }\n for (const [name, tag] of givenTags) tags[name] = tag as string;\n frozenConfig = null;\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /io-core/platform-capability.ts by scripts/sync-io-core.mjs.\n// Run `node scripts/sync-io-core.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * platform-capability.ts\n *\n * Phase 6(docs/architecture-hardening/09-remediation-design.md §7.2 /\n * 07-browser-capability-variance.md)の browser capability 判定と error taxonomy の\n * 汎用プリミティブ。node 固有の capability registry / error code は各パッケージが\n * 別ファイルで宣言し、この汎用層(型 + assess 機構)を import する。\n *\n * 原則:\n * - feature detection は境界(利用直前)で行う。module 評価時に browser global を\n * 参照しない(SSR / worker で import が失敗しない)。\n * - capability ID(`web.fetch` 等)は文字列を global property path として eval せず、\n * registry が ID ごとに副作用のない presence probe を対応付ける。\n * - availability / permission / readiness / activity / operation error を 1 つの\n * `ready / unsupported / error` enum に畳まない。required 欠如は開始しない、\n * optional 欠如は宣言済み fallback で readiness を `degraded` にする。\n *\n * 配置: 本ファイルは /io-core/ の単一正典であり、scripts/sync-io-core.mjs が\n * 各 IO ノードの src/core/ へ生成コピー (AUTO-GENERATED, 編集禁止) を配布する。\n * `protocol/wcBindable.ts` と同じ copy-distribution 方式で、ランタイム依存を導入せず\n * 各パッケージのバンドルへ inline される (zero-runtime-dep / 自己完結 CDN を維持)。\n * 編集はこの正典に対して行い、`node scripts/sync-io-core.mjs` で再配布する。\n *\n * pure(module 評価時に browser global 非参照)。\n */\n\nexport type Availability = \"available\" | \"missing\" | \"unknown\";\nexport type PermissionState = \"granted\" | \"denied\" | \"prompt\" | \"not-applicable\" | \"unknown\";\nexport type Readiness = \"idle\" | \"ready\" | \"degraded\";\nexport type Activity = \"inactive\" | \"active\";\nexport type PreconditionState = \"satisfied\" | \"required\" | \"not-applicable\";\n\n/** operation error の phase(taxonomy)。 */\nexport type WcsIoErrorPhase = \"probe\" | \"start\" | \"execute\" | \"decode\" | \"commit\" | \"dispose\";\n\n/** serializable な error info(non-cloneable な cause とは分離。DevTools / remote へは info のみ)。 */\nexport interface WcsIoErrorInfo {\n readonly code: string;\n readonly phase: WcsIoErrorPhase;\n readonly recoverable: boolean;\n readonly capabilityId?: string;\n readonly message: string;\n}\n\nexport interface PlatformAssessment {\n readonly availability: ReadonlyMap<string, Availability>;\n readonly permission: PermissionState;\n readonly readiness: Readiness;\n readonly activity: Activity;\n readonly preconditions: {\n readonly secureContext: PreconditionState;\n readonly userActivation: PreconditionState;\n };\n readonly epoch: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\n/** capability 1 件の仕様。probe は副作用なく presence を返す(利用直前に呼ぶ)。 */\nexport interface CapabilitySpec {\n readonly probe: () => boolean;\n readonly requiresSecureContext?: boolean;\n readonly requiresUserActivation?: boolean;\n /** browser compatibility dataset のキー(任意・診断用)。 */\n readonly compatKey?: string;\n}\n\nexport type CapabilityRegistry = ReadonlyMap<string, CapabilitySpec>;\n\nexport interface AssessOptions {\n readonly required: readonly string[];\n readonly optional?: readonly string[];\n readonly permission?: PermissionState;\n readonly activity?: Activity;\n readonly epoch?: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\nfunction isSecureContext(): boolean {\n return (globalThis as { isSecureContext?: unknown }).isSecureContext === true;\n}\n\n/**\n * capability を利用直前に評価して PlatformAssessment を作る。\n * required が 1 つでも欠ければ readiness は \"idle\"(開始不可)、\n * required 揃い + optional 欠けは \"degraded\"、全揃いは \"ready\"。\n */\nexport function assessCapabilities(registry: CapabilityRegistry, options: AssessOptions): PlatformAssessment {\n const availability = new Map<string, Availability>();\n const evaluate = (id: string): Availability => {\n const spec = registry.get(id);\n if (spec === undefined) return \"unknown\";\n return spec.probe() ? \"available\" : \"missing\";\n };\n\n let requiredAllAvailable = true;\n for (const id of options.required) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") requiredAllAvailable = false;\n }\n let optionalAllAvailable = true;\n for (const id of options.optional ?? []) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") optionalAllAvailable = false;\n }\n\n const readiness: Readiness = !requiredAllAvailable ? \"idle\" : (optionalAllAvailable ? \"ready\" : \"degraded\");\n\n // preconditions: 対象 capability のいずれかが要求する場合だけ評価する。\n const allIds = [...options.required, ...(options.optional ?? [])];\n const needsSecure = allIds.some((id) => registry.get(id)?.requiresSecureContext === true);\n const needsActivation = allIds.some((id) => registry.get(id)?.requiresUserActivation === true);\n const secureContext: PreconditionState = needsSecure ? (isSecureContext() ? \"satisfied\" : \"required\") : \"not-applicable\";\n const userActivation: PreconditionState = needsActivation ? \"required\" : \"not-applicable\";\n\n return {\n availability,\n permission: options.permission ?? \"not-applicable\",\n readiness,\n activity: options.activity ?? \"inactive\",\n preconditions: { secureContext, userActivation },\n epoch: options.epoch ?? 0,\n lastError: options.lastError,\n };\n}\n\n/** availability から「required がすべて available か」を判定するヘルパ(supported の最低条件)。 */\nexport function requiredCapabilitiesAvailable(assessment: PlatformAssessment, required: readonly string[]): boolean {\n return required.every((id) => assessment.availability.get(id) === \"available\");\n}\n\n/**\n * このページで機能が使えない理由(使える、または分からないなら null)。利用直前に読む。\n *\n * - `\"insecure-context\"`: 安全なコンテキストではない(`isSecureContext === false`)。\n * Permissions API が扱う機能はどれも安全なコンテキストを要る。\n * - `\"policy-blocked\"`: Permissions-Policy(サーバーのヘッダ、または `allow` の無い\n * `<iframe>`)がその機能を切っている。\n *\n * どちらも Permissions API は教えない: Chromium はポリシーで切られた文書でも\n * `granted` を、安全でない origin では `denied` を返す。利用者の拒否と区別するため、\n * 見張り役(`<wcs-permission>`)も取りに行く側も `unsupported` を報告する\n * (docs/v4-direction-2026-10.md の決定、state-field-report)。\n * `isSecureContext` が無い環境(SSR・テスト)は判断しない。\n */\nexport type FeatureUnavailableReason = \"insecure-context\" | \"policy-blocked\";\n\n/** Permissions-Policy が制御する機能(permission 名と同じ文字列)。 */\nconst POLICY_CONTROLLED = new Set([\n \"camera\", \"microphone\", \"geolocation\", \"midi\", \"clipboard-read\", \"clipboard-write\",\n \"screen-wake-lock\", \"idle-detection\", \"accelerometer\", \"gyroscope\", \"magnetometer\",\n \"ambient-light-sensor\", \"display-capture\",\n]);\n\ninterface PolicyLike { allowsFeature(feature: string): boolean }\n\nexport function featureUnavailable(feature: string): FeatureUnavailableReason | null {\n const g = globalThis as { isSecureContext?: unknown; document?: { permissionsPolicy?: PolicyLike; featurePolicy?: PolicyLike } };\n if (g.isSecureContext === false) return \"insecure-context\";\n if (!POLICY_CONTROLLED.has(feature)) return null;\n const policy = g.document?.permissionsPolicy ?? g.document?.featurePolicy;\n if (policy === undefined || typeof policy.allowsFeature !== \"function\") return null;\n try {\n return policy.allowsFeature(feature) ? null : \"policy-blocked\";\n } catch {\n return null;\n }\n}\n\n/** `featureUnavailable` の理由を、作者が直し方を読める文にする。`what` は文頭(「The camera」など)。 */\nexport function featureUnavailableMessage(what: string, feature: string, reason: FeatureUnavailableReason): string {\n return reason === \"insecure-context\"\n ? `${what} needs a secure context (https:, or http://localhost), and this page is not one.`\n : `${what} is turned off for this page by a Permissions-Policy: the server's Permissions-Policy header, ` +\n `or an <iframe> without allow=\"${feature}\". The browser's site settings cannot change that.`;\n}\n","/**\n * geolocationCapabilities.ts\n *\n * Geolocation node 固有の error code(taxonomy)と derivation。汎用の error info 型は\n * `./platformCapability.js`(/io-core/ から copy-distribution される生成ファイル)から\n * import する。geolocation は concurrent-independent(競合しない)ため lane は持たず、\n * error taxonomy(errorInfo)のみを採用する。\n */\n\nimport type { WcsIoErrorInfo } from \"./platformCapability.js\";\n\n/** 安定した geolocation error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_GEO_ERROR_CODE = {\n PermissionDenied: \"permission-denied\",\n PositionUnavailable: \"position-unavailable\",\n Timeout: \"timeout\",\n // このページで使えない(API 不在・安全でない origin・Permissions-Policy)。利用者の拒否\n // (permission-denied)と区別する — サイトの設定では直らない。\n CapabilityMissing: \"capability-missing\",\n} as const;\n\n/**\n * 正規化済み `GeolocationPositionError`(spec code 1/2/3)を serializable な error\n * taxonomy に写す。\"unexpected\" は code 2(position-unavailable)に畳むため、これは既存の\n * `error.code` を忠実にミラーする。permission-denied(1)だけは retry で回復しないため\n * recoverable=false。`unsupported`(このページで使えない — Core は `error.code` を 2 にする)\n * は capability-missing / probe / recoverable=false。\n */\nexport function deriveGeoErrorInfo(code: number, message: string, unsupported = false): WcsIoErrorInfo {\n if (unsupported) {\n return { code: WCS_GEO_ERROR_CODE.CapabilityMissing, phase: \"probe\", recoverable: false, message };\n }\n const taxonomyCode = code === 1\n ? WCS_GEO_ERROR_CODE.PermissionDenied\n : code === 3\n ? WCS_GEO_ERROR_CODE.Timeout\n : WCS_GEO_ERROR_CODE.PositionUnavailable;\n return { code: taxonomyCode, phase: \"execute\", recoverable: code !== 1, message };\n}\n","import {\n IWcBindable, GeoOptions, GeoPermissionState,\n WcsGeoPositionDetail, WcsGeoCoords, WcsGeoErrorDetail,\n} from \"../types.js\";\nimport { WcsIoErrorInfo, featureUnavailable, featureUnavailableMessage } from \"./platformCapability.js\";\nimport { deriveGeoErrorInfo } from \"./geolocationCapabilities.js\";\n\n/**\n * Headless geolocation primitive. A thin, framework-agnostic wrapper around the\n * Geolocation API exposed through the wc-bindable protocol.\n *\n * It has two phases, mirroring the two distinct shapes of the underlying API:\n * - **one-shot** — `getCurrentPosition()` resolves a single fix (like FetchCore's\n * one-shot `fetch()`), toggling `loading` around the async call.\n * - **continuous** — `watch()` / `clearWatch()` stream fixes (like TimerCore's\n * `start()` / `stop()`), toggling the `watching` flag.\n *\n * Every successful fix is published via the single `wcs-geo:position` event;\n * `latitude` / `longitude` / `accuracy` / `coords` / `timestamp` are read from\n * it through getters (mirroring how TimerCore exposes count/elapsed from one\n * `wcs-timer:tick` event), so an observer that binds any of them is notified on\n * every fix.\n *\n * Geolocation also has a permission gate absent from timer/websocket: the\n * `permission` property reflects `navigator.permissions.query({name:\n * \"geolocation\"})` (`prompt` / `granted` / `denied`, or `unsupported`) and\n * tracks its live `change` event. It is a read-only sensor — there is no\n * element-bound \"send\" path; element → state only.\n */\nexport class GeolocationCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"position\", event: \"wcs-geo:position\", semantics: \"state\" },\n { name: \"latitude\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.latitude },\n { name: \"longitude\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.longitude },\n { name: \"accuracy\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.accuracy },\n { name: \"coords\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.coords },\n { name: \"timestamp\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.timestamp },\n { name: \"watching\", event: \"wcs-geo:watching-changed\", semantics: \"state\" },\n { name: \"loading\", event: \"wcs-geo:loading-changed\", semantics: \"state\" },\n { name: \"error\", event: \"wcs-geo:error\", semantics: \"state\" },\n { name: \"permission\", event: \"wcs-geo:permission-changed\", semantics: \"state\" },\n // Serializable failure taxonomy (stable code / phase / recoverable), or null.\n // Additive bindable output derived from the normalized `error` (spec code\n // 1/2/3 → permission-denied / position-unavailable / timeout); the existing\n // `error` property/event are unchanged. Fires `wcs-geo:error-info-changed`.\n { name: \"errorInfo\", event: \"wcs-geo:error-info-changed\", semantics: \"state\" },\n ],\n commands: [\n { name: \"getCurrentPosition\", async: true },\n { name: \"watch\" },\n { name: \"clearWatch\" },\n ],\n };\n\n private _target: EventTarget;\n private _watchId: number | null = null;\n\n private _position: WcsGeoPositionDetail | null = null;\n private _watching: boolean = false;\n private _loading: boolean = false;\n private _error: WcsGeoErrorDetail | null = null;\n private _errorInfo: WcsIoErrorInfo | null = null;\n // the errors that say this page cannot use geolocation (errorInfo: capability-missing)\n private _unsupportedErrors = new WeakSet<WcsGeoErrorDetail>();\n private _permission: GeoPermissionState = \"prompt\";\n\n // Live PermissionStatus handle (when the Permissions API is available), kept\n // so the `change` listener can be removed on dispose().\n private _permissionStatus: PermissionStatus | null = null;\n\n // True once a permission subscription has been (or is being) established, and\n // reset by dispose(). Guards reinitPermission() so the first connect after\n // construction does not double-subscribe, while a reconnect after dispose()\n // does re-subscribe.\n private _permissionSubscribed: boolean = false;\n\n // Monotonic id of the current permission query. Bumped by every _initPermission()\n // and by dispose(). Each in-flight query captures its id and, on resolve, bails\n // unless it is still current — so a query superseded by a rapid (synchronous)\n // disconnect→reconnect, or one that resolves after dispose(), never attaches a\n // listener. A plain boolean cannot cover this: dispose()→reinit() flips it\n // false→true again, reopening the window for the stale query to slip through.\n private _permGen: number = 0;\n\n // Monotonic id of the current acquisition lifecycle, bumped only by dispose().\n // Each getCurrentPosition() captures it at start; the async success/error\n // callback bails (no setters, no resolve-side effects) if it is stale, so a\n // one-shot fix that resolves after the element was disconnected does not\n // dispatch wcs-geo:* on a torn-down element. Unlike FetchCore, the Geolocation\n // API has no AbortController, so a generation guard is the only way to neutralize\n // an in-flight one-shot. (watch is already stopped by clearWatch on disconnect.)\n private _acqGen: number = 0;\n\n // Monotonic id of the current watch lifecycle, bumped by watch(), clearWatch(),\n // and dispose(). Each watch() captures it; both watch callbacks bail if it is\n // stale. Unlike a live `_watchId === null` check, this distinguishes the current\n // watch from a superseded one: a clearWatch()→watch() restart installs a new\n // watchId (non-null), so a queued callback from the previous watch would pass a\n // null-check but fails the generation compare. (The README recommends exactly\n // this restart sequence to reconfigure a watch.)\n private _watchGen: number = 0;\n\n // Resolves once the most recent permission probe settles (or immediately when\n // the Permissions API is unsupported). The Shell exposes this as\n // connectedCallbackPromise so SSR can await the first probe before snapshotting\n // the HTML. Mirrors PermissionCore._ready.\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n // Probe the permission state up front so observers see the real value\n // (granted/denied/prompt) before the first read, then keep it live.\n this._ready = this._initPermission();\n }\n\n get position(): WcsGeoPositionDetail | null {\n return this._position;\n }\n\n get latitude(): number | null {\n return this._position ? this._position.latitude : null;\n }\n\n get longitude(): number | null {\n return this._position ? this._position.longitude : null;\n }\n\n get accuracy(): number | null {\n return this._position ? this._position.accuracy : null;\n }\n\n get coords(): WcsGeoCoords | null {\n return this._position ? this._position.coords : null;\n }\n\n get timestamp(): number | null {\n return this._position ? this._position.timestamp : null;\n }\n\n get watching(): boolean {\n return this._watching;\n }\n\n get loading(): boolean {\n return this._loading;\n }\n\n get error(): WcsGeoErrorDetail | null {\n return this._error;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable`), or null. Exposed as an additive wc-bindable property (event\n * `wcs-geo:error-info-changed`), derived from the normalized `error`; the\n * existing `error` property/event are unchanged.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n get permission(): GeoPermissionState {\n return this._permission;\n }\n\n /** Resolves once the first (or most recent) permission probe settles (§3.8). */\n get ready(): Promise<void> {\n return this._ready;\n }\n\n // --- State setters with event dispatch ---\n\n private _setPosition(position: WcsGeoPositionDetail): void {\n this._position = position;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:position\", {\n detail: position,\n bubbles: true,\n }));\n }\n\n private _setWatching(watching: boolean): void {\n if (this._watching === watching) return;\n this._watching = watching;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:watching-changed\", {\n detail: watching,\n bubbles: true,\n }));\n }\n\n private _setLoading(loading: boolean): void {\n if (this._loading === loading) return;\n this._loading = loading;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:loading-changed\", {\n detail: loading,\n bubbles: true,\n }));\n }\n\n private _setError(error: WcsGeoErrorDetail | null): void {\n // Same-value guard, like the other setters. Unlike `position` (which has\n // derived getters and so must re-fire even on an identical reference), `error`\n // has no derived state — so suppressing redundant null→null dispatches (e.g.\n // a successful fix clearing an already-null error) avoids spurious events.\n if (this._error === error) return;\n this._error = error;\n // Keep the additive `errorInfo` taxonomy in sync with `error`: derive it from\n // the normalized error (or null on clear). Fires before the `error` event so an\n // observer binding both sees the classification first, mirroring the io-node\n // family. No lane here — geolocation's fixes don't compete (dispose-only guard).\n this._commitErrorInfo(error === null ? null : deriveGeoErrorInfo(error.code, error.message, this._unsupportedErrors.has(error)));\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n // Called only from _setError (which already same-value-guards on the error\n // reference), so errorInfo transitions exactly when error does — no separate\n // guard needed here.\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:error-info-changed\", {\n detail: info,\n bubbles: true,\n }));\n }\n\n private _setPermission(permission: GeoPermissionState): void {\n if (this._permission === permission) return;\n this._permission = permission;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:permission-changed\", {\n detail: permission,\n bubbles: true,\n }));\n }\n\n // --- Public API ---\n\n /**\n * Acquire a single position fix. Resolves once the fix arrives or the request\n * fails — never rejects: failures are surfaced through the `error` property so\n * they flow into the declarative state, symmetrical with FetchCore.\n */\n getCurrentPosition(options: GeoOptions = {}): Promise<void> {\n return new Promise<void>((resolve) => {\n if (!this._hasGeolocation()) {\n this._setError(this._unsupportedError());\n resolve();\n return;\n }\n\n const gen = this._acqGen;\n this._setLoading(true);\n this._setError(null);\n navigator.geolocation.getCurrentPosition(\n (pos) => {\n // Stale: the element was disposed (disconnected) while this fix was in\n // flight. Drop it so a torn-down element never dispatches wcs-geo:*.\n // Still resolve() so any awaiter (e.g. connectedCallbackPromise) settles.\n if (gen !== this._acqGen) {\n resolve();\n return;\n }\n // Guard normalization/dispatch so a throw never escapes this browser\n // callback as an unhandled rejection, leaves the promise pending (which\n // would hang SSR's connectedCallbackPromise), or leaves `loading` stuck\n // true. Loading is cleared first so it holds even if a later step throws.\n try {\n this._setLoading(false);\n this._setPosition(this._normalizePosition(pos));\n } catch {\n // Surface the unexpected failure as an error so observers are not left\n // silently stale, then resolve below.\n this._setError(this._unexpectedError());\n }\n resolve();\n },\n (err) => {\n if (gen !== this._acqGen) {\n resolve();\n return;\n }\n try {\n this._setLoading(false);\n this._setError(this._normalizeError(err));\n } catch {\n this._setError(this._unexpectedError());\n }\n resolve();\n },\n options,\n );\n });\n }\n\n /**\n * Begin continuously watching the position. Idempotent while already\n * watching: a redundant watch() must not register a second `watchPosition`\n * (which would leak the handle and double the fix rate). Reconfiguring is done\n * via clearWatch() + watch().\n */\n watch(options: GeoOptions = {}): void {\n if (!this._hasGeolocation()) {\n this._setError(this._unsupportedError());\n return;\n }\n if (this._watching) return;\n\n this._setError(null);\n this._setWatching(true);\n // Open a new watch generation so any queued callback from a prior watch\n // (cleared then restarted) is recognized as stale below.\n const wgen = ++this._watchGen;\n this._watchId = navigator.geolocation.watchPosition(\n (pos) => {\n // Stale: this callback belongs to a watch that was cleared (or the element\n // disposed), possibly already superseded by a restart. A live\n // `_watchId === null` check cannot catch the restart case (the new watch\n // re-populates _watchId), so compare the captured generation instead.\n if (wgen !== this._watchGen) return;\n // Guard normalization/dispatch so an unexpected throw never escapes this\n // browser callback as an unhandled rejection — symmetric with the one-shot\n // path.\n try {\n // A recovered fix clears any prior transient error (e.g. a one-off\n // TIMEOUT) so `error` reflects the current state, not a stale failure.\n // The _setError same-value guard makes this free when error is already\n // null.\n this._setError(null);\n this._setPosition(this._normalizePosition(pos));\n } catch {\n this._setError(this._unexpectedError());\n }\n },\n (err) => {\n if (wgen !== this._watchGen) return;\n // An error does not implicitly release the watch — the watchId stays\n // valid and clearWatch() remains the teardown path — so `watching` is\n // left true to reflect \"watch still registered\". A terminal error (e.g.\n // PERMISSION_DENIED) is surfaced via the `error` property; callers that\n // want to stop on error can call clearWatch() in response.\n try {\n this._setError(this._normalizeError(err));\n } catch {\n this._setError(this._unexpectedError());\n }\n },\n options,\n );\n }\n\n clearWatch(): void {\n if (this._watchId !== null) {\n navigator.geolocation.clearWatch(this._watchId);\n this._watchId = null;\n }\n // Invalidate the current watch generation so any callback the browser may\n // still deliver after teardown bails.\n this._watchGen++;\n this._setWatching(false);\n }\n\n /**\n * Establish permission monitoring (§3.5). Idempotent: a no-op while a\n * subscription is already live (so the first connect after construction does\n * not double-subscribe), and re-subscribes after a dispose() — e.g. the Shell\n * element was disconnected and then reconnected (reparented). Returns the\n * `ready` promise, which resolves once the (re)established probe settles, so\n * the Shell can expose it as connectedCallbackPromise for SSR. Position\n * acquisition (one-shot / watch) is command-driven and the Shell drives it\n * separately from connectedCallback.\n */\n observe(): Promise<void> {\n if (!this._permissionSubscribed) {\n this._ready = this._initPermission();\n }\n return this._ready;\n }\n\n /**\n * Re-establish the permission `change` subscription after a dispose() — e.g.\n * the Shell element was disconnected and then reconnected (reparented). No-op\n * while a subscription is already live, so the first connect after\n * construction does not double-subscribe. This keeps permission tracking\n * symmetric with position acquisition, which the Shell also revives on\n * reconnect.\n *\n * Retained as a thin alias of observe() for the Shell's existing reconnect\n * path; observe() is the canonical §3.5 lifecycle entry point.\n */\n reinitPermission(): void {\n void this.observe();\n }\n\n /**\n * Detach the live permission `change` listener. Call from the Shell's\n * `disconnectedCallback` so a removed element does not leak the subscription.\n * A later reconnect can re-subscribe via reinitPermission().\n */\n dispose(): void {\n this._permissionSubscribed = false;\n // Invalidate any in-flight query so its .then() bails instead of attaching a\n // listener after teardown.\n this._permGen++;\n // Invalidate any in-flight one-shot acquisition so its success/error callback\n // bails instead of dispatching on a disconnected element.\n this._acqGen++;\n // Likewise invalidate the watch generation. The Shell already calls\n // clearWatch() before dispose(), but a direct headless dispose() (without a\n // preceding clearWatch) still neutralizes any queued watch callback.\n this._watchGen++;\n // Clear loading, with its event (timing-and-firing-contract §22): the bailed\n // callback above will not clear it, and a route the element leaves keeps its\n // nodes — bindings included — for the next entry, so a reset nobody heard would\n // leave the page showing an acquisition that is gone. Clearing it also keeps the\n // loading=true edge of the next acquisition after a reconnect.\n this._setLoading(false);\n if (this._permissionStatus) {\n this._permissionStatus.removeEventListener(\"change\", this._onPermissionChange);\n this._permissionStatus = null;\n }\n }\n\n // --- Internal ---\n\n private _hasGeolocation(): boolean {\n return typeof navigator !== \"undefined\" && !!navigator.geolocation && featureUnavailable(\"geolocation\") === null;\n }\n\n private _initPermission(): Promise<void> {\n // A page that cannot use geolocation (not a secure context, or turned off by a\n // Permissions-Policy) is \"unsupported\": the Permissions API answers \"granted\" in a\n // policy-blocked frame and \"denied\" on an insecure origin — a user's refusal, which\n // the site settings would fix and these cannot. Neither changes while the page lives.\n if (featureUnavailable(\"geolocation\") !== null) {\n this._setPermission(\"unsupported\");\n return Promise.resolve();\n }\n // The Permissions API is optional. When absent (or it rejects, e.g. some\n // browsers don't accept the \"geolocation\" name), report \"unsupported\" and\n // leave acquisition to fail loudly via the error property if attempted.\n if (typeof navigator === \"undefined\" || !navigator.permissions || typeof navigator.permissions.query !== \"function\") {\n // Route through _setPermission (not a bare assignment) so observers stay in\n // sync with the public state. The same-value guard means no redundant\n // dispatch when the state does not actually change; it does mean a\n // previously-observed \"granted\"/\"denied\" being reinit'd into an environment\n // that lost the Permissions API now correctly notifies observers of the\n // unsupported transition instead of silently overwriting the shadow value.\n this._setPermission(\"unsupported\");\n // No asynchronous probe to await: readiness is immediate.\n return Promise.resolve();\n }\n this._permissionSubscribed = true;\n const gen = ++this._permGen;\n return navigator.permissions.query({ name: \"geolocation\" as PermissionName }).then(\n (status) => {\n // Stale resolution: this query was superseded (rapid reconnect) or the\n // element was disposed while it was in flight. Drop it so only the current\n // subscription attaches a listener.\n if (gen !== this._permGen) return;\n this._permissionStatus = status;\n this._setPermission(status.state as GeoPermissionState);\n status.addEventListener(\"change\", this._onPermissionChange);\n },\n () => {\n if (gen !== this._permGen) return;\n this._setPermission(\"unsupported\");\n },\n );\n }\n\n private _onPermissionChange = (event: Event): void => {\n const status = event.target as PermissionStatus;\n this._setPermission(status.state as GeoPermissionState);\n };\n\n private _normalizePosition(pos: GeolocationPosition): WcsGeoPositionDetail {\n const c = pos.coords;\n const coords: WcsGeoCoords = {\n latitude: c.latitude,\n longitude: c.longitude,\n accuracy: c.accuracy,\n altitude: c.altitude,\n altitudeAccuracy: c.altitudeAccuracy,\n heading: c.heading,\n speed: c.speed,\n };\n return { ...coords, timestamp: pos.timestamp, coords };\n }\n\n private _normalizeError(err: GeolocationPositionError): WcsGeoErrorDetail {\n return { code: err.code, message: err.message };\n }\n\n private _unsupportedError(): WcsGeoErrorDetail {\n // Geolocation API absent, or not available to this page: surface it as\n // POSITION_UNAVAILABLE (2) so consumers that switch on the spec error codes treat\n // it like any other unavailable fix; errorInfo says capability-missing.\n const reason = featureUnavailable(\"geolocation\");\n const error: WcsGeoErrorDetail = {\n code: 2,\n message: reason === null\n ? \"Geolocation API is not available in this environment.\"\n : featureUnavailableMessage(\"Geolocation\", \"geolocation\", reason),\n };\n this._unsupportedErrors.add(error);\n return error;\n }\n\n private _unexpectedError(): WcsGeoErrorDetail {\n // An unexpected throw while normalizing/dispatching a fix. Surface it as\n // POSITION_UNAVAILABLE (2) so it flows into `error` like any other failure\n // instead of escaping the browser callback as an unhandled rejection.\n return { code: 2, message: \"Unexpected error while processing the position fix.\" };\n }\n}\n","import { config } from \"./config.js\";\nimport type { WcsGeolocation } from \"./components/Geolocation.js\";\n\nlet registered = false;\n\nfunction handleClick(event: Event): void {\n const target = event.target;\n if (!(target instanceof Element)) return;\n\n const triggerElement = target.closest<Element>(`[${config.triggerAttribute}]`);\n if (!triggerElement) return;\n\n const geoId = triggerElement.getAttribute(config.triggerAttribute);\n if (!geoId) return;\n\n // Resolve the registered constructor at call time instead of importing\n // Geolocation as a value. The value import created a components/Geolocation.ts\n // ⇄ autoTrigger.ts cycle (Geolocation.connectedCallback() calls\n // registerAutoTrigger()). instanceof against the customElements registry keeps\n // the exact same identity guarantee — only the registered <wcs-geo> class\n // matches — without the import cycle.\n const GeoCtor = customElements.get(config.tagNames.geo);\n const geoElement = document.getElementById(geoId);\n if (!GeoCtor || !(geoElement instanceof GeoCtor)) return;\n\n // Suppress the element's default action so a fix can be requested without\n // navigating. Intentional: do not attach data-geotarget to an element whose\n // default action you also want (real <a href> link, form-submit button) — it\n // will be cancelled. See README \"Optional DOM Triggering\".\n event.preventDefault();\n (geoElement as WcsGeolocation).getCurrentPosition();\n}\n\nexport function registerAutoTrigger(): void {\n if (registered) return;\n registered = true;\n document.addEventListener(\"click\", handleClick);\n}\n\nexport function unregisterAutoTrigger(): void {\n if (!registered) return;\n registered = false;\n document.removeEventListener(\"click\", handleClick);\n}\n","// ===========================================================================\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 { config } from \"../config.js\";\nimport { IWcBindable, GeoOptions, GeoPermissionState, WcsGeoPositionDetail, WcsGeoCoords, WcsGeoErrorDetail } from \"../types.js\";\nimport { GeolocationCore } from \"../core/GeolocationCore.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\nimport { registerAutoTrigger } from \"../autoTrigger.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.js\";\nimport { reflectAttribute, reflectBooleanAttribute } from \"../protocol/inputAttribute.js\";\n\n// Named WcsGeolocation (not `Geolocation`) so the class does not shadow the\n// global DOM `Geolocation` interface (the type of `navigator.geolocation`), and\n// to match the <wcs-ws> convention (WcsWebSocket). The public export keeps the\n// `WcsGeolocation` name unchanged, so this rename is non-breaking.\nexport class WcsGeolocation extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n static wcBindable: IWcBindable = {\n ...GeolocationCore.wcBindable,\n properties: [\n ...GeolocationCore.wcBindable.properties,\n { name: \"trigger\", event: \"wcs-geo:trigger-changed\", semantics: \"state\" },\n ],\n // Shell-level settable surface. Each input carries its mirrored `attribute`\n // hint (boolean flags reflect idempotently, so a binding system that writes\n // through inputs[].attribute is safe), following the <wcs-ws> convention.\n // `trigger` has no attribute — it is a momentary command-property, not a\n // declarative attribute. The `getCurrentPosition` / `watchPosition` /\n // `clearWatch` commands are declared below.\n inputs: [\n { name: \"highAccuracy\", attribute: \"high-accuracy\" },\n { name: \"timeout\", attribute: \"timeout\" },\n { name: \"maximumAge\", attribute: \"maximum-age\" },\n { name: \"watch\", attribute: \"watch\" },\n { name: \"manual\", attribute: \"manual\" },\n { name: \"trigger\" },\n ],\n // The Core's `watch` command is renamed to `watchPosition` on the Shell so it\n // does not collide with the `watch` boolean attribute accessor (same pattern\n // as <wcs-ws>, where the `send` command becomes `sendMessage` to free the\n // `send` setter). `getCurrentPosition` / `clearWatch` are unchanged.\n commands: [\n { name: \"getCurrentPosition\", async: true },\n { name: \"watchPosition\" },\n { name: \"clearWatch\" },\n ],\n };\n\n private _core: GeolocationCore;\n private _trigger: boolean = false;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n // connectedCallback が張った connectedCallbackPromise を解く関数。接続時の判断を下す\n // _scheduleLocate のマイクロタスクが(その前に外れたときは disconnectedCallback が)呼ぶ。\n private _connectResolve: ((value: void | PromiseLike<void>) => void) | null = null;\n // _scheduleLocate のマイクロタスクが待っている間 true\n private _locatePending: boolean = false;\n // 接続時の判断待ちに clearWatch() が呼ばれたら true — その判断は watch でも監視を始めない\n private _watchCancelled: boolean = false;\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new GeolocationCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-geo:watching-changed\": (d) => ({ watching: d === true }),\n \"wcs-geo:loading-changed\": (d) => ({ loading: d === true }),\n \"wcs-geo:error\": (d) => ({ error: d != null }),\n });\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (docs/custom-state-reflection-design.md §3.4): 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, it\n // 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 // Input setters never let setAttribute stringify null / undefined (an\n // \"undefined\" timeout would silently fall back to Infinity): `null` removes the\n // attribute (the default), `undefined` restores the attribute the element\n // started with (wc-bindable producer guidance P1; React 19 and a direct\n // assignment deliver it, @wcstack/state does not).\n\n get highAccuracy(): boolean {\n return this.hasAttribute(\"high-accuracy\");\n }\n\n set highAccuracy(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"high-accuracy\", value);\n }\n\n get timeout(): number {\n const attr = this.getAttribute(\"timeout\");\n if (attr === null || attr.trim() === \"\") return Infinity;\n // Strict parse via Number() (unlike parseInt, \"10px\" -> NaN, not 10). Fall\n // back to the API default (Infinity = no timeout) for any non-finite or\n // negative value, matching the README \"invalid values fall back to default\".\n const parsed = Number(attr);\n return Number.isFinite(parsed) && parsed >= 0 ? parsed : Infinity;\n }\n\n set timeout(value: number | null | undefined) {\n reflectAttribute(this, \"timeout\", value);\n }\n\n get maximumAge(): number {\n const attr = this.getAttribute(\"maximum-age\");\n if (attr === null || attr.trim() === \"\") return 0;\n // Strict parse via Number() (unlike parseInt, \"10px\" -> NaN, not 10). Fall\n // back to the API default (0 = never use a cached fix) for any non-finite or\n // negative value, matching the README \"invalid values fall back to default\".\n const parsed = Number(attr);\n return Number.isFinite(parsed) && parsed >= 0 ? parsed : 0;\n }\n\n set maximumAge(value: number | null | undefined) {\n reflectAttribute(this, \"maximum-age\", value);\n }\n\n get watch(): boolean {\n return this.hasAttribute(\"watch\");\n }\n\n set watch(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"watch\", value);\n }\n\n get manual(): boolean {\n return this.hasAttribute(\"manual\");\n }\n\n set manual(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"manual\", value);\n }\n\n // --- Core delegated getters ---\n\n get position(): WcsGeoPositionDetail | null {\n return this._core.position;\n }\n\n get latitude(): number | null {\n return this._core.latitude;\n }\n\n get longitude(): number | null {\n return this._core.longitude;\n }\n\n get accuracy(): number | null {\n return this._core.accuracy;\n }\n\n get coords(): WcsGeoCoords | null {\n return this._core.coords;\n }\n\n get timestamp(): number | null {\n return this._core.timestamp;\n }\n\n get watching(): boolean {\n return this._core.watching;\n }\n\n get loading(): boolean {\n return this._core.loading;\n }\n\n get error(): WcsGeoErrorDetail | null {\n return this._core.error;\n }\n\n get errorInfo(): WcsIoErrorInfo | null {\n return this._core.errorInfo;\n }\n\n get permission(): GeoPermissionState {\n return this._core.permission;\n }\n\n // wc-bindable connectedCallbackPromise protocol: resolves once the connect-time\n // acquisition settles, so SSR (@wcstack/server render.ts) waits for the first\n // fix before snapshotting the HTML. Mirrors Fetch.connectedCallbackPromise. The\n // connect-time decision runs in a microtask (_scheduleLocate), so the promise is\n // armed in connectedCallback and settled there; in `watch` / `manual` modes there\n // is no one-shot connect-time fix to await, so it resolves once the decision ran.\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Command property ---\n\n get trigger(): boolean {\n return this._trigger;\n }\n\n set trigger(value: boolean) {\n // Momentary command-property: a false→true write requests a single fix.\n // Mirrors the trigger flag on <wcs-timer> / <wcs-ws>. Prefer the\n // command-token protocol (`command.getCurrentPosition: $command.locate`) for\n // state-driven acquisition; this exists mainly for the DOM click trigger and\n // simple boolean bindings.\n const v = !!value;\n if (v) {\n this._trigger = true;\n // Fire-and-forget: getCurrentPosition() never rejects (failures surface via\n // the `error` property), so the returned promise is intentionally dropped.\n void this.getCurrentPosition();\n this._trigger = false;\n this.dispatchEvent(new CustomEvent(\"wcs-geo:trigger-changed\", {\n detail: false,\n bubbles: true,\n }));\n }\n }\n\n // --- Commands ---\n\n getCurrentPosition(): Promise<void> {\n return this._core.getCurrentPosition(this._options());\n }\n\n watchPosition(): void {\n this._core.watch(this._options());\n }\n\n clearWatch(): void {\n // 接続時の判断待ちなら、その連続監視を取り消す — 同じタスクの append → clearWatch() で、\n // 後のマイクロタスクが監視を始めないように(判断が同期だった頃は、始めた監視を\n // clearWatch() が止めていた)。一発取得は以前と同じく取り消さない。入れ直せば、次の\n // 判断は watch に従う\n if (this._connectResolve !== null) this._watchCancelled = true;\n this._core.clearWatch();\n }\n\n // --- Internal ---\n\n private _options(): GeoOptions {\n return {\n enableHighAccuracy: this.highAccuracy,\n timeout: this.timeout,\n maximumAge: this.maximumAge,\n };\n }\n\n // --- Lifecycle ---\n\n // 接続時の取得の判断はマイクロタスクで、そのときの manual / watch / high-accuracy /\n // timeout / maximum-age で 1 回だけ行う(timing-and-firing-contract §23)。router は遷移で\n // 同じノードを入れ直し、新しいルートの params から state が入力を書くのはマイクロタスク —\n // その場で取得すると、前の入力で getCurrentPosition / watchPosition を起こしていた\n // (docs/seam-apps.md、shift-desk)。\n private _scheduleLocate(): void {\n if (this._locatePending) return;\n this._locatePending = true;\n queueMicrotask(() => {\n this._locatePending = false;\n const resolveConnect = this._connectResolve;\n this._connectResolve = null;\n // 判断の前に外れた要素は何もしない(disconnectedCallback が解いて null にした)\n if (resolveConnect === null) return;\n const watchCancelled = this._watchCancelled;\n this._watchCancelled = false;\n if (this.manual) {\n resolveConnect();\n } else if (this.watch) {\n // `watch` attribute selects the default phase: continuous monitoring vs a\n // single fix on connect. 判断待ちに clearWatch() が呼ばれていたら始めない\n if (!watchCancelled) this.watchPosition();\n resolveConnect();\n } else {\n // Track only the one-shot connect-time fix so SSR can await it.\n // getCurrentPosition() never rejects (failures surface via `error`), so no\n // .catch() is needed.\n resolveConnect(this.getCurrentPosition());\n }\n });\n }\n\n connectedCallback(): void {\n // upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)\n upgradeProperties(this);\n this.style.display = \"none\";\n if (config.autoTrigger) {\n registerAutoTrigger();\n }\n // Revive permission tracking after a reconnect (reparenting). No-op on the\n // first connect since the constructor already subscribed; only re-subscribes\n // when disconnectedCallback's dispose() tore the subscription down. It reads no\n // input, so it stays here; only the acquisition decision is deferred.\n this._core.reinitPermission();\n // connectedCallbackPromise は接続時の判断(と一発取得)が済むまでを表す。判断は\n // マイクロタスクなので、ここで張って _scheduleLocate で解く\n this._connectedCallbackPromise = new Promise<void>((resolve) => {\n this._connectResolve = resolve;\n });\n this._scheduleLocate();\n }\n\n disconnectedCallback(): void {\n // 判断の前に外れたら、張った connectedCallbackPromise をここで解く — 同じタスクで\n // 入れ直されると次の connectedCallback が張り替えるので、待つ側が取り残されないように\n this._connectResolve?.();\n this._connectResolve = null;\n this._watchCancelled = false;\n this._core.clearWatch();\n this._core.dispose();\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapGeolocation(userConfig?: IWritableConfig, registry?: CustomElementRegistry): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents(registry);\n}\n","import { WcsGeolocation } from \"./components/Geolocation.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.geo)) {\n registry.define(config.tagNames.geo, WcsGeolocation);\n }\n}\n"],"names":["config","triggerAttribute","tagNames","geo","POLICY_CONTROLLED","Set","featureUnavailable","feature","g","globalThis","isSecureContext","has","policy","document","permissionsPolicy","featurePolicy","undefined","allowsFeature","featureUnavailableMessage","what","reason","WCS_GEO_ERROR_CODE","GeolocationCore","EventTarget","static","protocol","version","properties","name","event","semantics","getter","e","detail","latitude","longitude","accuracy","coords","timestamp","commands","async","_target","_watchId","_position","_watching","_loading","_error","_errorInfo","_unsupportedErrors","WeakSet","_permission","_permissionStatus","_permissionSubscribed","_permGen","_acqGen","_watchGen","_ready","Promise","resolve","constructor","target","super","this","_initPermission","position","watching","loading","error","errorInfo","permission","ready","_setPosition","dispatchEvent","CustomEvent","bubbles","_setWatching","_setLoading","_setError","_commitErrorInfo","code","message","unsupported","phase","recoverable","deriveGeoErrorInfo","info","_setPermission","getCurrentPosition","options","_hasGeolocation","_unsupportedError","gen","navigator","geolocation","pos","_normalizePosition","_unexpectedError","err","_normalizeError","watch","wgen","watchPosition","clearWatch","observe","reinitPermission","dispose","removeEventListener","_onPermissionChange","permissions","query","then","status","state","addEventListener","c","altitude","altitudeAccuracy","heading","speed","add","registered","handleClick","Element","triggerElement","closest","geoId","getAttribute","GeoCtor","customElements","get","geoElement","getElementById","preventDefault","hasAccessorOnPrototype","proto","Object","getPrototypeOf","descriptor","getOwnPropertyDescriptor","set","toldObjectAttribute","warnObjectAttribute","element","value","tag","localName","console","warn","initialAttributes","WeakMap","initialAttribute","el","byName","Map","writeAttribute","removeAttribute","setAttribute","reflectAttribute","initial","String","reflectBooleanAttribute","WcsGeolocation","HTMLElement","wcBindable","inputs","attribute","_core","_trigger","_connectedCallbackPromise","_connectResolve","_locatePending","_watchCancelled","_internals","_initInternals","_wireStates","d","debugStates","states","attachInternals","internals","delete","map","toStates","entries","debug","hasAttribute","on","toggleAttribute","highAccuracy","timeout","attr","trim","Infinity","parsed","Number","isFinite","maximumAge","manual","connectedCallbackPromise","trigger","_options","enableHighAccuracy","_scheduleLocate","queueMicrotask","resolveConnect","watchCancelled","connectedCallback","declaration","input","call","toLowerCase","startsWith","prototype","hasOwnProperty","record","upgradeProperties","style","display","disconnectedCallback","registry","define","registerComponents"],"mappings":"AAUA,MA4BaA,EA5BoB,CA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,EAAOoL,EAAMpL,KACbyI,EAAoC,mBAAjBvC,EAA8BA,EAAamF,KAAKnE,EAASlH,EAAKsL,eAAiB,KAExG,GADkB,OAAd7C,GAAsBA,EAAU8C,WAAW,aAAatE,EAAoBC,EAASlH,EAAMyI,IAC1F9B,OAAO6E,UAAUC,eAAeJ,KAAKnE,EAASlH,GAAO,SAC1D,IAAKyG,EAAuBS,EAASlH,GAAO,SAC5C,MAAM0L,EAASxE,EACTC,EAAQuE,EAAO1L,UACd0L,EAAO1L,GACd0L,EAAO1L,GAAQmH,CACjB,CACF,CEyOIwE,CAAkBzJ,MAClBA,KAAK0J,MAAMC,QAAU,OH1RnBjG,IACJA,GAAa,EACb3G,SAASoG,iBAAiB,QAASQ,IGgSjC3D,KAAKwG,MAAM9D,mBAGX1C,KAAK0G,0BAA4B,IAAI/G,QAAeC,IAClDI,KAAK2G,gBAAkB/G,IAEzBI,KAAK4I,iBACP,CAEA,oBAAAgB,GAGE5J,KAAK2G,oBACL3G,KAAK2G,gBAAkB,KACvB3G,KAAK6G,iBAAkB,EACvB7G,KAAKwG,MAAMhE,aACXxC,KAAKwG,MAAM7D,SACb,ECjVI,IAA6DkH,GCI7D,SAA6BA,EAAkC3F,gBAC9D2F,EAAS1F,IAAIjI,EAAOE,SAASC,MAChCwN,EAASC,OAAO5N,EAAOE,SAASC,IAAK8J,EAEzC,CDJE4D,CAAmBF"}
|
|
1
|
+
{"version":3,"file":"auto.min.js","sources":["../../src/config.ts","../../src/core/platformCapability.ts","../../src/core/geolocationCapabilities.ts","../../src/core/GeolocationCore.ts","../../src/autoTrigger.ts","../../src/protocol/upgradeProperties.ts","../../src/protocol/inputAttribute.ts","../../src/components/Geolocation.ts","../../src/protocol/defineElement.ts","../../src/registerComponents.ts","../../src/bootstrapGeolocation.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n autoTrigger: boolean;\n triggerAttribute: string;\n tagNames: {\n geo: string;\n };\n}\n\nconst _config: IInternalConfig = {\n autoTrigger: true,\n triggerAttribute: \"data-geotarget\",\n tagNames: {\n geo: \"wcs-geo\",\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: `bootstrapGeolocation` refuses it. */\nfunction invalid(key: string): never {\n throw new Error(`[@wcstack/geolocation] bootstrapGeolocation: \"${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 [key, value] of given) {\n if (key !== \"tagNames\") {\n options[key] = value;\n }\n }\n for (const [name, tag] of givenTags) tags[name] = tag as string;\n frozenConfig = null;\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /io-core/platform-capability.ts by scripts/sync-io-core.mjs.\n// Run `node scripts/sync-io-core.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * platform-capability.ts\n *\n * Phase 6(docs/architecture-hardening/09-remediation-design.md §7.2 /\n * 07-browser-capability-variance.md)の browser capability 判定と error taxonomy の\n * 汎用プリミティブ。node 固有の capability registry / error code は各パッケージが\n * 別ファイルで宣言し、この汎用層(型 + assess 機構)を import する。\n *\n * 原則:\n * - feature detection は境界(利用直前)で行う。module 評価時に browser global を\n * 参照しない(SSR / worker で import が失敗しない)。\n * - capability ID(`web.fetch` 等)は文字列を global property path として eval せず、\n * registry が ID ごとに副作用のない presence probe を対応付ける。\n * - availability / permission / readiness / activity / operation error を 1 つの\n * `ready / unsupported / error` enum に畳まない。required 欠如は開始しない、\n * optional 欠如は宣言済み fallback で readiness を `degraded` にする。\n *\n * 配置: 本ファイルは /io-core/ の単一正典であり、scripts/sync-io-core.mjs が\n * 各 IO ノードの src/core/ へ生成コピー (AUTO-GENERATED, 編集禁止) を配布する。\n * `protocol/wcBindable.ts` と同じ copy-distribution 方式で、ランタイム依存を導入せず\n * 各パッケージのバンドルへ inline される (zero-runtime-dep / 自己完結 CDN を維持)。\n * 編集はこの正典に対して行い、`node scripts/sync-io-core.mjs` で再配布する。\n *\n * pure(module 評価時に browser global 非参照)。\n */\n\nexport type Availability = \"available\" | \"missing\" | \"unknown\";\nexport type PermissionState = \"granted\" | \"denied\" | \"prompt\" | \"not-applicable\" | \"unknown\";\nexport type Readiness = \"idle\" | \"ready\" | \"degraded\";\nexport type Activity = \"inactive\" | \"active\";\nexport type PreconditionState = \"satisfied\" | \"required\" | \"not-applicable\";\n\n/** operation error の phase(taxonomy)。 */\nexport type WcsIoErrorPhase = \"probe\" | \"start\" | \"execute\" | \"decode\" | \"commit\" | \"dispose\";\n\n/** serializable な error info(non-cloneable な cause とは分離。DevTools / remote へは info のみ)。 */\nexport interface WcsIoErrorInfo {\n readonly code: string;\n readonly phase: WcsIoErrorPhase;\n readonly recoverable: boolean;\n readonly capabilityId?: string;\n readonly message: string;\n}\n\nexport interface PlatformAssessment {\n readonly availability: ReadonlyMap<string, Availability>;\n readonly permission: PermissionState;\n readonly readiness: Readiness;\n readonly activity: Activity;\n readonly preconditions: {\n readonly secureContext: PreconditionState;\n readonly userActivation: PreconditionState;\n };\n readonly epoch: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\n/** capability 1 件の仕様。probe は副作用なく presence を返す(利用直前に呼ぶ)。 */\nexport interface CapabilitySpec {\n readonly probe: () => boolean;\n readonly requiresSecureContext?: boolean;\n readonly requiresUserActivation?: boolean;\n /** browser compatibility dataset のキー(任意・診断用)。 */\n readonly compatKey?: string;\n}\n\nexport type CapabilityRegistry = ReadonlyMap<string, CapabilitySpec>;\n\nexport interface AssessOptions {\n readonly required: readonly string[];\n readonly optional?: readonly string[];\n readonly permission?: PermissionState;\n readonly activity?: Activity;\n readonly epoch?: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\nfunction isSecureContext(): boolean {\n return (globalThis as { isSecureContext?: unknown }).isSecureContext === true;\n}\n\n/**\n * capability を利用直前に評価して PlatformAssessment を作る。\n * required が 1 つでも欠ければ readiness は \"idle\"(開始不可)、\n * required 揃い + optional 欠けは \"degraded\"、全揃いは \"ready\"。\n */\nexport function assessCapabilities(registry: CapabilityRegistry, options: AssessOptions): PlatformAssessment {\n const availability = new Map<string, Availability>();\n const evaluate = (id: string): Availability => {\n const spec = registry.get(id);\n if (spec === undefined) return \"unknown\";\n return spec.probe() ? \"available\" : \"missing\";\n };\n\n let requiredAllAvailable = true;\n for (const id of options.required) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") requiredAllAvailable = false;\n }\n let optionalAllAvailable = true;\n for (const id of options.optional ?? []) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") optionalAllAvailable = false;\n }\n\n const readiness: Readiness = !requiredAllAvailable ? \"idle\" : (optionalAllAvailable ? \"ready\" : \"degraded\");\n\n // preconditions: 対象 capability のいずれかが要求する場合だけ評価する。\n const allIds = [...options.required, ...(options.optional ?? [])];\n const needsSecure = allIds.some((id) => registry.get(id)?.requiresSecureContext === true);\n const needsActivation = allIds.some((id) => registry.get(id)?.requiresUserActivation === true);\n const secureContext: PreconditionState = needsSecure ? (isSecureContext() ? \"satisfied\" : \"required\") : \"not-applicable\";\n const userActivation: PreconditionState = needsActivation ? \"required\" : \"not-applicable\";\n\n return {\n availability,\n permission: options.permission ?? \"not-applicable\",\n readiness,\n activity: options.activity ?? \"inactive\",\n preconditions: { secureContext, userActivation },\n epoch: options.epoch ?? 0,\n lastError: options.lastError,\n };\n}\n\n/** availability から「required がすべて available か」を判定するヘルパ(supported の最低条件)。 */\nexport function requiredCapabilitiesAvailable(assessment: PlatformAssessment, required: readonly string[]): boolean {\n return required.every((id) => assessment.availability.get(id) === \"available\");\n}\n\n/**\n * このページで機能が使えない理由(使える、または分からないなら null)。利用直前に読む。\n *\n * - `\"insecure-context\"`: 安全なコンテキストではない(`isSecureContext === false`)。\n * Permissions API が扱う機能はどれも安全なコンテキストを要る。\n * - `\"policy-blocked\"`: Permissions-Policy(サーバーのヘッダ、または `allow` の無い\n * `<iframe>`)がその機能を切っている。\n *\n * どちらも Permissions API は教えない: Chromium はポリシーで切られた文書でも\n * `granted` を、安全でない origin では `denied` を返す。利用者の拒否と区別するため、\n * 見張り役(`<wcs-permission>`)も取りに行く側も `unsupported` を報告する\n * (docs/v4-direction-2026-10.md の決定、state-field-report)。\n * `isSecureContext` が無い環境(SSR・テスト)は判断しない。\n */\nexport type FeatureUnavailableReason = \"insecure-context\" | \"policy-blocked\";\n\n/** Permissions-Policy が制御する機能(permission 名と同じ文字列)。 */\nconst POLICY_CONTROLLED = new Set([\n \"camera\", \"microphone\", \"geolocation\", \"midi\", \"clipboard-read\", \"clipboard-write\",\n \"screen-wake-lock\", \"idle-detection\", \"accelerometer\", \"gyroscope\", \"magnetometer\",\n \"ambient-light-sensor\", \"display-capture\",\n]);\n\ninterface PolicyLike { allowsFeature(feature: string): boolean }\n\nexport function featureUnavailable(feature: string): FeatureUnavailableReason | null {\n const g = globalThis as { isSecureContext?: unknown; document?: { permissionsPolicy?: PolicyLike; featurePolicy?: PolicyLike } };\n if (g.isSecureContext === false) return \"insecure-context\";\n if (!POLICY_CONTROLLED.has(feature)) return null;\n const policy = g.document?.permissionsPolicy ?? g.document?.featurePolicy;\n if (policy === undefined || typeof policy.allowsFeature !== \"function\") return null;\n try {\n return policy.allowsFeature(feature) ? null : \"policy-blocked\";\n } catch {\n return null;\n }\n}\n\n/** `featureUnavailable` の理由を、作者が直し方を読める文にする。`what` は文頭(「The camera」など)。 */\nexport function featureUnavailableMessage(what: string, feature: string, reason: FeatureUnavailableReason): string {\n return reason === \"insecure-context\"\n ? `${what} needs a secure context (https:, or http://localhost), and this page is not one.`\n : `${what} is turned off for this page by a Permissions-Policy: the server's Permissions-Policy header, ` +\n `or an <iframe> without allow=\"${feature}\". The browser's site settings cannot change that.`;\n}\n","/**\n * geolocationCapabilities.ts\n *\n * Geolocation node 固有の error code(taxonomy)と derivation。汎用の error info 型は\n * `./platformCapability.js`(/io-core/ から copy-distribution される生成ファイル)から\n * import する。geolocation は concurrent-independent(競合しない)ため lane は持たず、\n * error taxonomy(errorInfo)のみを採用する。\n */\n\nimport type { WcsIoErrorInfo } from \"./platformCapability.js\";\n\n/** 安定した geolocation error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_GEO_ERROR_CODE = {\n PermissionDenied: \"permission-denied\",\n PositionUnavailable: \"position-unavailable\",\n Timeout: \"timeout\",\n // このページで使えない(API 不在・安全でない origin・Permissions-Policy)。利用者の拒否\n // (permission-denied)と区別する — サイトの設定では直らない。\n CapabilityMissing: \"capability-missing\",\n} as const;\n\n/**\n * 正規化済み `GeolocationPositionError`(spec code 1/2/3)を serializable な error\n * taxonomy に写す。\"unexpected\" は code 2(position-unavailable)に畳むため、これは既存の\n * `error.code` を忠実にミラーする。permission-denied(1)だけは retry で回復しないため\n * recoverable=false。`unsupported`(このページで使えない — Core は `error.code` を 2 にする)\n * は capability-missing / probe / recoverable=false。\n */\nexport function deriveGeoErrorInfo(code: number, message: string, unsupported = false): WcsIoErrorInfo {\n if (unsupported) {\n return { code: WCS_GEO_ERROR_CODE.CapabilityMissing, phase: \"probe\", recoverable: false, message };\n }\n const taxonomyCode = code === 1\n ? WCS_GEO_ERROR_CODE.PermissionDenied\n : code === 3\n ? WCS_GEO_ERROR_CODE.Timeout\n : WCS_GEO_ERROR_CODE.PositionUnavailable;\n return { code: taxonomyCode, phase: \"execute\", recoverable: code !== 1, message };\n}\n","import {\n IWcBindable, GeoOptions, GeoPermissionState,\n WcsGeoPositionDetail, WcsGeoCoords, WcsGeoErrorDetail,\n} from \"../types.js\";\nimport { WcsIoErrorInfo, featureUnavailable, featureUnavailableMessage } from \"./platformCapability.js\";\nimport { deriveGeoErrorInfo } from \"./geolocationCapabilities.js\";\n\n/**\n * Headless geolocation primitive. A thin, framework-agnostic wrapper around the\n * Geolocation API exposed through the wc-bindable protocol.\n *\n * It has two phases, mirroring the two distinct shapes of the underlying API:\n * - **one-shot** — `getCurrentPosition()` resolves a single fix (like FetchCore's\n * one-shot `fetch()`), toggling `loading` around the async call.\n * - **continuous** — `watch()` / `clearWatch()` stream fixes (like TimerCore's\n * `start()` / `stop()`), toggling the `watching` flag.\n *\n * Every successful fix is published via the single `wcs-geo:position` event;\n * `latitude` / `longitude` / `accuracy` / `coords` / `timestamp` are read from\n * it through getters (mirroring how TimerCore exposes count/elapsed from one\n * `wcs-timer:tick` event), so an observer that binds any of them is notified on\n * every fix.\n *\n * Geolocation also has a permission gate absent from timer/websocket: the\n * `permission` property reflects `navigator.permissions.query({name:\n * \"geolocation\"})` (`prompt` / `granted` / `denied`, or `unsupported`) and\n * tracks its live `change` event. It is a read-only sensor — there is no\n * element-bound \"send\" path; element → state only.\n */\nexport class GeolocationCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"position\", event: \"wcs-geo:position\", semantics: \"state\" },\n { name: \"latitude\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.latitude },\n { name: \"longitude\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.longitude },\n { name: \"accuracy\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.accuracy },\n { name: \"coords\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.coords },\n { name: \"timestamp\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.timestamp },\n { name: \"watching\", event: \"wcs-geo:watching-changed\", semantics: \"state\" },\n { name: \"loading\", event: \"wcs-geo:loading-changed\", semantics: \"state\" },\n { name: \"error\", event: \"wcs-geo:error\", semantics: \"state\" },\n { name: \"permission\", event: \"wcs-geo:permission-changed\", semantics: \"state\" },\n // Serializable failure taxonomy (stable code / phase / recoverable), or null.\n // Additive bindable output derived from the normalized `error` (spec code\n // 1/2/3 → permission-denied / position-unavailable / timeout); the existing\n // `error` property/event are unchanged. Fires `wcs-geo:error-info-changed`.\n { name: \"errorInfo\", event: \"wcs-geo:error-info-changed\", semantics: \"state\" },\n ],\n commands: [\n { name: \"getCurrentPosition\", async: true },\n { name: \"watch\" },\n { name: \"clearWatch\" },\n ],\n };\n\n private _target: EventTarget;\n private _watchId: number | null = null;\n\n private _position: WcsGeoPositionDetail | null = null;\n private _watching: boolean = false;\n private _loading: boolean = false;\n private _error: WcsGeoErrorDetail | null = null;\n private _errorInfo: WcsIoErrorInfo | null = null;\n // the errors that say this page cannot use geolocation (errorInfo: capability-missing)\n private _unsupportedErrors = new WeakSet<WcsGeoErrorDetail>();\n private _permission: GeoPermissionState = \"prompt\";\n\n // Live PermissionStatus handle (when the Permissions API is available), kept\n // so the `change` listener can be removed on dispose().\n private _permissionStatus: PermissionStatus | null = null;\n\n // True once a permission subscription has been (or is being) established, and\n // reset by dispose(). Guards reinitPermission() so the first connect after\n // construction does not double-subscribe, while a reconnect after dispose()\n // does re-subscribe.\n private _permissionSubscribed: boolean = false;\n\n // Monotonic id of the current permission query. Bumped by every _initPermission()\n // and by dispose(). Each in-flight query captures its id and, on resolve, bails\n // unless it is still current — so a query superseded by a rapid (synchronous)\n // disconnect→reconnect, or one that resolves after dispose(), never attaches a\n // listener. A plain boolean cannot cover this: dispose()→reinit() flips it\n // false→true again, reopening the window for the stale query to slip through.\n private _permGen: number = 0;\n\n // Monotonic id of the current acquisition lifecycle, bumped only by dispose().\n // Each getCurrentPosition() captures it at start; the async success/error\n // callback bails (no setters, no resolve-side effects) if it is stale, so a\n // one-shot fix that resolves after the element was disconnected does not\n // dispatch wcs-geo:* on a torn-down element. Unlike FetchCore, the Geolocation\n // API has no AbortController, so a generation guard is the only way to neutralize\n // an in-flight one-shot. (watch is already stopped by clearWatch on disconnect.)\n private _acqGen: number = 0;\n\n // Monotonic id of the current watch lifecycle, bumped by watch(), clearWatch(),\n // and dispose(). Each watch() captures it; both watch callbacks bail if it is\n // stale. Unlike a live `_watchId === null` check, this distinguishes the current\n // watch from a superseded one: a clearWatch()→watch() restart installs a new\n // watchId (non-null), so a queued callback from the previous watch would pass a\n // null-check but fails the generation compare. (The README recommends exactly\n // this restart sequence to reconfigure a watch.)\n private _watchGen: number = 0;\n\n // Resolves once the most recent permission probe settles (or immediately when\n // the Permissions API is unsupported). The Shell exposes this as\n // connectedCallbackPromise so SSR can await the first probe before snapshotting\n // the HTML. Mirrors PermissionCore._ready.\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n // Probe the permission state up front so observers see the real value\n // (granted/denied/prompt) before the first read, then keep it live.\n this._ready = this._initPermission();\n }\n\n get position(): WcsGeoPositionDetail | null {\n return this._position;\n }\n\n get latitude(): number | null {\n return this._position ? this._position.latitude : null;\n }\n\n get longitude(): number | null {\n return this._position ? this._position.longitude : null;\n }\n\n get accuracy(): number | null {\n return this._position ? this._position.accuracy : null;\n }\n\n get coords(): WcsGeoCoords | null {\n return this._position ? this._position.coords : null;\n }\n\n get timestamp(): number | null {\n return this._position ? this._position.timestamp : null;\n }\n\n get watching(): boolean {\n return this._watching;\n }\n\n get loading(): boolean {\n return this._loading;\n }\n\n get error(): WcsGeoErrorDetail | null {\n return this._error;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable`), or null. Exposed as an additive wc-bindable property (event\n * `wcs-geo:error-info-changed`), derived from the normalized `error`; the\n * existing `error` property/event are unchanged.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n get permission(): GeoPermissionState {\n return this._permission;\n }\n\n /** Resolves once the first (or most recent) permission probe settles (§3.8). */\n get ready(): Promise<void> {\n return this._ready;\n }\n\n // --- State setters with event dispatch ---\n\n private _setPosition(position: WcsGeoPositionDetail): void {\n this._position = position;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:position\", {\n detail: position,\n bubbles: true,\n }));\n }\n\n private _setWatching(watching: boolean): void {\n if (this._watching === watching) return;\n this._watching = watching;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:watching-changed\", {\n detail: watching,\n bubbles: true,\n }));\n }\n\n private _setLoading(loading: boolean): void {\n if (this._loading === loading) return;\n this._loading = loading;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:loading-changed\", {\n detail: loading,\n bubbles: true,\n }));\n }\n\n private _setError(error: WcsGeoErrorDetail | null): void {\n // Same-value guard, like the other setters. Unlike `position` (which has\n // derived getters and so must re-fire even on an identical reference), `error`\n // has no derived state — so suppressing redundant null→null dispatches (e.g.\n // a successful fix clearing an already-null error) avoids spurious events.\n if (this._error === error) return;\n this._error = error;\n // Keep the additive `errorInfo` taxonomy in sync with `error`: derive it from\n // the normalized error (or null on clear). Fires before the `error` event so an\n // observer binding both sees the classification first, mirroring the io-node\n // family. No lane here — geolocation's fixes don't compete (dispose-only guard).\n this._commitErrorInfo(error === null ? null : deriveGeoErrorInfo(error.code, error.message, this._unsupportedErrors.has(error)));\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n // Called only from _setError (which already same-value-guards on the error\n // reference), so errorInfo transitions exactly when error does — no separate\n // guard needed here.\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:error-info-changed\", {\n detail: info,\n bubbles: true,\n }));\n }\n\n private _setPermission(permission: GeoPermissionState): void {\n if (this._permission === permission) return;\n this._permission = permission;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:permission-changed\", {\n detail: permission,\n bubbles: true,\n }));\n }\n\n // --- Public API ---\n\n /**\n * Acquire a single position fix. Resolves once the fix arrives or the request\n * fails — never rejects: failures are surfaced through the `error` property so\n * they flow into the declarative state, symmetrical with FetchCore.\n */\n getCurrentPosition(options: GeoOptions = {}): Promise<void> {\n return new Promise<void>((resolve) => {\n if (!this._hasGeolocation()) {\n this._setError(this._unsupportedError());\n resolve();\n return;\n }\n\n const gen = this._acqGen;\n this._setLoading(true);\n this._setError(null);\n navigator.geolocation.getCurrentPosition(\n (pos) => {\n // Stale: the element was disposed (disconnected) while this fix was in\n // flight. Drop it so a torn-down element never dispatches wcs-geo:*.\n // Still resolve() so any awaiter (e.g. connectedCallbackPromise) settles.\n if (gen !== this._acqGen) {\n resolve();\n return;\n }\n // Guard normalization/dispatch so a throw never escapes this browser\n // callback as an unhandled rejection, leaves the promise pending (which\n // would hang SSR's connectedCallbackPromise), or leaves `loading` stuck\n // true. Loading is cleared first so it holds even if a later step throws.\n try {\n this._setLoading(false);\n this._setPosition(this._normalizePosition(pos));\n } catch {\n // Surface the unexpected failure as an error so observers are not left\n // silently stale, then resolve below.\n this._setError(this._unexpectedError());\n }\n resolve();\n },\n (err) => {\n if (gen !== this._acqGen) {\n resolve();\n return;\n }\n try {\n this._setLoading(false);\n this._setError(this._normalizeError(err));\n } catch {\n this._setError(this._unexpectedError());\n }\n resolve();\n },\n options,\n );\n });\n }\n\n /**\n * Begin continuously watching the position. Idempotent while already\n * watching: a redundant watch() must not register a second `watchPosition`\n * (which would leak the handle and double the fix rate). Reconfiguring is done\n * via clearWatch() + watch().\n */\n watch(options: GeoOptions = {}): void {\n if (!this._hasGeolocation()) {\n this._setError(this._unsupportedError());\n return;\n }\n if (this._watching) return;\n\n this._setError(null);\n this._setWatching(true);\n // Open a new watch generation so any queued callback from a prior watch\n // (cleared then restarted) is recognized as stale below.\n const wgen = ++this._watchGen;\n this._watchId = navigator.geolocation.watchPosition(\n (pos) => {\n // Stale: this callback belongs to a watch that was cleared (or the element\n // disposed), possibly already superseded by a restart. A live\n // `_watchId === null` check cannot catch the restart case (the new watch\n // re-populates _watchId), so compare the captured generation instead.\n if (wgen !== this._watchGen) return;\n // Guard normalization/dispatch so an unexpected throw never escapes this\n // browser callback as an unhandled rejection — symmetric with the one-shot\n // path.\n try {\n // A recovered fix clears any prior transient error (e.g. a one-off\n // TIMEOUT) so `error` reflects the current state, not a stale failure.\n // The _setError same-value guard makes this free when error is already\n // null.\n this._setError(null);\n this._setPosition(this._normalizePosition(pos));\n } catch {\n this._setError(this._unexpectedError());\n }\n },\n (err) => {\n if (wgen !== this._watchGen) return;\n // An error does not implicitly release the watch — the watchId stays\n // valid and clearWatch() remains the teardown path — so `watching` is\n // left true to reflect \"watch still registered\". A terminal error (e.g.\n // PERMISSION_DENIED) is surfaced via the `error` property; callers that\n // want to stop on error can call clearWatch() in response.\n try {\n this._setError(this._normalizeError(err));\n } catch {\n this._setError(this._unexpectedError());\n }\n },\n options,\n );\n }\n\n clearWatch(): void {\n if (this._watchId !== null) {\n navigator.geolocation.clearWatch(this._watchId);\n this._watchId = null;\n }\n // Invalidate the current watch generation so any callback the browser may\n // still deliver after teardown bails.\n this._watchGen++;\n this._setWatching(false);\n }\n\n /**\n * Establish permission monitoring (§3.5). Idempotent: a no-op while a\n * subscription is already live (so the first connect after construction does\n * not double-subscribe), and re-subscribes after a dispose() — e.g. the Shell\n * element was disconnected and then reconnected (reparented). Returns the\n * `ready` promise, which resolves once the (re)established probe settles, so\n * the Shell can expose it as connectedCallbackPromise for SSR. Position\n * acquisition (one-shot / watch) is command-driven and the Shell drives it\n * separately from connectedCallback.\n */\n observe(): Promise<void> {\n if (!this._permissionSubscribed) {\n this._ready = this._initPermission();\n }\n return this._ready;\n }\n\n /**\n * Re-establish the permission `change` subscription after a dispose() — e.g.\n * the Shell element was disconnected and then reconnected (reparented). No-op\n * while a subscription is already live, so the first connect after\n * construction does not double-subscribe. This keeps permission tracking\n * symmetric with position acquisition, which the Shell also revives on\n * reconnect.\n *\n * Retained as a thin alias of observe() for the Shell's existing reconnect\n * path; observe() is the canonical §3.5 lifecycle entry point.\n */\n reinitPermission(): void {\n void this.observe();\n }\n\n /**\n * Detach the live permission `change` listener. Call from the Shell's\n * `disconnectedCallback` so a removed element does not leak the subscription.\n * A later reconnect can re-subscribe via reinitPermission().\n */\n dispose(): void {\n this._permissionSubscribed = false;\n // Invalidate any in-flight query so its .then() bails instead of attaching a\n // listener after teardown.\n this._permGen++;\n // Invalidate any in-flight one-shot acquisition so its success/error callback\n // bails instead of dispatching on a disconnected element.\n this._acqGen++;\n // Likewise invalidate the watch generation. The Shell already calls\n // clearWatch() before dispose(), but a direct headless dispose() (without a\n // preceding clearWatch) still neutralizes any queued watch callback.\n this._watchGen++;\n // Clear loading, with its event (timing-and-firing-contract §22): the bailed\n // callback above will not clear it, and a route the element leaves keeps its\n // nodes — bindings included — for the next entry, so a reset nobody heard would\n // leave the page showing an acquisition that is gone. Clearing it also keeps the\n // loading=true edge of the next acquisition after a reconnect.\n this._setLoading(false);\n if (this._permissionStatus) {\n this._permissionStatus.removeEventListener(\"change\", this._onPermissionChange);\n this._permissionStatus = null;\n }\n }\n\n // --- Internal ---\n\n private _hasGeolocation(): boolean {\n return typeof navigator !== \"undefined\" && !!navigator.geolocation && featureUnavailable(\"geolocation\") === null;\n }\n\n private _initPermission(): Promise<void> {\n // A page that cannot use geolocation (not a secure context, or turned off by a\n // Permissions-Policy) is \"unsupported\": the Permissions API answers \"granted\" in a\n // policy-blocked frame and \"denied\" on an insecure origin — a user's refusal, which\n // the site settings would fix and these cannot. Neither changes while the page lives.\n if (featureUnavailable(\"geolocation\") !== null) {\n this._setPermission(\"unsupported\");\n return Promise.resolve();\n }\n // The Permissions API is optional. When absent (or it rejects, e.g. some\n // browsers don't accept the \"geolocation\" name), report \"unsupported\" and\n // leave acquisition to fail loudly via the error property if attempted.\n if (typeof navigator === \"undefined\" || !navigator.permissions || typeof navigator.permissions.query !== \"function\") {\n // Route through _setPermission (not a bare assignment) so observers stay in\n // sync with the public state. The same-value guard means no redundant\n // dispatch when the state does not actually change; it does mean a\n // previously-observed \"granted\"/\"denied\" being reinit'd into an environment\n // that lost the Permissions API now correctly notifies observers of the\n // unsupported transition instead of silently overwriting the shadow value.\n this._setPermission(\"unsupported\");\n // No asynchronous probe to await: readiness is immediate.\n return Promise.resolve();\n }\n this._permissionSubscribed = true;\n const gen = ++this._permGen;\n return navigator.permissions.query({ name: \"geolocation\" as PermissionName }).then(\n (status) => {\n // Stale resolution: this query was superseded (rapid reconnect) or the\n // element was disposed while it was in flight. Drop it so only the current\n // subscription attaches a listener.\n if (gen !== this._permGen) return;\n this._permissionStatus = status;\n this._setPermission(status.state as GeoPermissionState);\n status.addEventListener(\"change\", this._onPermissionChange);\n },\n () => {\n if (gen !== this._permGen) return;\n this._setPermission(\"unsupported\");\n },\n );\n }\n\n private _onPermissionChange = (event: Event): void => {\n const status = event.target as PermissionStatus;\n this._setPermission(status.state as GeoPermissionState);\n };\n\n private _normalizePosition(pos: GeolocationPosition): WcsGeoPositionDetail {\n const c = pos.coords;\n const coords: WcsGeoCoords = {\n latitude: c.latitude,\n longitude: c.longitude,\n accuracy: c.accuracy,\n altitude: c.altitude,\n altitudeAccuracy: c.altitudeAccuracy,\n heading: c.heading,\n speed: c.speed,\n };\n return { ...coords, timestamp: pos.timestamp, coords };\n }\n\n private _normalizeError(err: GeolocationPositionError): WcsGeoErrorDetail {\n return { code: err.code, message: err.message };\n }\n\n private _unsupportedError(): WcsGeoErrorDetail {\n // Geolocation API absent, or not available to this page: surface it as\n // POSITION_UNAVAILABLE (2) so consumers that switch on the spec error codes treat\n // it like any other unavailable fix; errorInfo says capability-missing.\n const reason = featureUnavailable(\"geolocation\");\n const error: WcsGeoErrorDetail = {\n code: 2,\n message: reason === null\n ? \"Geolocation API is not available in this environment.\"\n : featureUnavailableMessage(\"Geolocation\", \"geolocation\", reason),\n };\n this._unsupportedErrors.add(error);\n return error;\n }\n\n private _unexpectedError(): WcsGeoErrorDetail {\n // An unexpected throw while normalizing/dispatching a fix. Surface it as\n // POSITION_UNAVAILABLE (2) so it flows into `error` like any other failure\n // instead of escaping the browser callback as an unhandled rejection.\n return { code: 2, message: \"Unexpected error while processing the position fix.\" };\n }\n}\n","import { config } from \"./config.js\";\nimport type { WcsGeolocation } from \"./components/Geolocation.js\";\n\nlet registered = false;\n\nfunction handleClick(event: Event): void {\n const target = event.target;\n if (!(target instanceof Element)) return;\n\n const triggerElement = target.closest<Element>(`[${config.triggerAttribute}]`);\n if (!triggerElement) return;\n\n const geoId = triggerElement.getAttribute(config.triggerAttribute);\n if (!geoId) return;\n\n // Resolve the registered constructor at call time instead of importing\n // Geolocation as a value. The value import created a components/Geolocation.ts\n // ⇄ autoTrigger.ts cycle (Geolocation.connectedCallback() calls\n // registerAutoTrigger()). instanceof against the customElements registry keeps\n // the exact same identity guarantee — only the registered <wcs-geo> class\n // matches — without the import cycle.\n const GeoCtor = customElements.get(config.tagNames.geo);\n const geoElement = document.getElementById(geoId);\n if (!GeoCtor || !(geoElement instanceof GeoCtor)) return;\n\n // Suppress the element's default action so a fix can be requested without\n // navigating. Intentional: do not attach data-geotarget to an element whose\n // default action you also want (real <a href> link, form-submit button) — it\n // will be cancelled. See README \"Optional DOM Triggering\".\n event.preventDefault();\n (geoElement as WcsGeolocation).getCurrentPosition();\n}\n\nexport function registerAutoTrigger(): void {\n if (registered) return;\n registered = true;\n document.addEventListener(\"click\", handleClick);\n}\n\nexport function unregisterAutoTrigger(): void {\n if (!registered) return;\n registered = false;\n document.removeEventListener(\"click\", handleClick);\n}\n","// ===========================================================================\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 { config } from \"../config.js\";\nimport { IWcBindable, GeoOptions, GeoPermissionState, WcsGeoPositionDetail, WcsGeoCoords, WcsGeoErrorDetail } from \"../types.js\";\nimport { GeolocationCore } from \"../core/GeolocationCore.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\nimport { registerAutoTrigger } from \"../autoTrigger.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.js\";\nimport { reflectAttribute, reflectBooleanAttribute } from \"../protocol/inputAttribute.js\";\n\n// Named WcsGeolocation (not `Geolocation`) so the class does not shadow the\n// global DOM `Geolocation` interface (the type of `navigator.geolocation`), and\n// to match the <wcs-ws> convention (WcsWebSocket). The public export keeps the\n// `WcsGeolocation` name unchanged, so this rename is non-breaking.\nexport class WcsGeolocation extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n static wcBindable: IWcBindable = {\n ...GeolocationCore.wcBindable,\n properties: [\n ...GeolocationCore.wcBindable.properties,\n { name: \"trigger\", event: \"wcs-geo:trigger-changed\", semantics: \"state\" },\n ],\n // Shell-level settable surface. Each input carries its mirrored `attribute`\n // hint (boolean flags reflect idempotently, so a binding system that writes\n // through inputs[].attribute is safe), following the <wcs-ws> convention.\n // `trigger` has no attribute — it is a momentary command-property, not a\n // declarative attribute. The `getCurrentPosition` / `watchPosition` /\n // `clearWatch` commands are declared below.\n inputs: [\n { name: \"highAccuracy\", attribute: \"high-accuracy\" },\n { name: \"timeout\", attribute: \"timeout\" },\n { name: \"maximumAge\", attribute: \"maximum-age\" },\n { name: \"watch\", attribute: \"watch\" },\n { name: \"manual\", attribute: \"manual\" },\n { name: \"trigger\" },\n ],\n // The Core's `watch` command is renamed to `watchPosition` on the Shell so it\n // does not collide with the `watch` boolean attribute accessor (same pattern\n // as <wcs-ws>, where the `send` command becomes `sendMessage` to free the\n // `send` setter). `getCurrentPosition` / `clearWatch` are unchanged.\n commands: [\n { name: \"getCurrentPosition\", async: true },\n { name: \"watchPosition\" },\n { name: \"clearWatch\" },\n ],\n };\n\n private _core: GeolocationCore;\n private _trigger: boolean = false;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n // connectedCallback が張った connectedCallbackPromise を解く関数。接続時の判断を下す\n // _scheduleLocate のマイクロタスクが(その前に外れたときは disconnectedCallback が)呼ぶ。\n private _connectResolve: ((value: void | PromiseLike<void>) => void) | null = null;\n // _scheduleLocate のマイクロタスクが待っている間 true\n private _locatePending: boolean = false;\n // 接続時の判断待ちに clearWatch() が呼ばれたら true — その判断は watch でも監視を始めない\n private _watchCancelled: boolean = false;\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new GeolocationCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-geo:watching-changed\": (d) => ({ watching: d === true }),\n \"wcs-geo:loading-changed\": (d) => ({ loading: d === true }),\n \"wcs-geo:error\": (d) => ({ error: d != null }),\n });\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (docs/custom-state-reflection-design.md §3.4): 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, it\n // 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 // Input setters never let setAttribute stringify null / undefined (an\n // \"undefined\" timeout would silently fall back to Infinity): `null` removes the\n // attribute (the default), `undefined` restores the attribute the element\n // started with (wc-bindable producer guidance P1; React 19 and a direct\n // assignment deliver it, @wcstack/state does not).\n\n get highAccuracy(): boolean {\n return this.hasAttribute(\"high-accuracy\");\n }\n\n set highAccuracy(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"high-accuracy\", value);\n }\n\n get timeout(): number {\n const attr = this.getAttribute(\"timeout\");\n if (attr === null || attr.trim() === \"\") return Infinity;\n // Strict parse via Number() (unlike parseInt, \"10px\" -> NaN, not 10). Fall\n // back to the API default (Infinity = no timeout) for any non-finite or\n // negative value, matching the README \"invalid values fall back to default\".\n const parsed = Number(attr);\n return Number.isFinite(parsed) && parsed >= 0 ? parsed : Infinity;\n }\n\n set timeout(value: number | null | undefined) {\n reflectAttribute(this, \"timeout\", value);\n }\n\n get maximumAge(): number {\n const attr = this.getAttribute(\"maximum-age\");\n if (attr === null || attr.trim() === \"\") return 0;\n // Strict parse via Number() (unlike parseInt, \"10px\" -> NaN, not 10). Fall\n // back to the API default (0 = never use a cached fix) for any non-finite or\n // negative value, matching the README \"invalid values fall back to default\".\n const parsed = Number(attr);\n return Number.isFinite(parsed) && parsed >= 0 ? parsed : 0;\n }\n\n set maximumAge(value: number | null | undefined) {\n reflectAttribute(this, \"maximum-age\", value);\n }\n\n get watch(): boolean {\n return this.hasAttribute(\"watch\");\n }\n\n set watch(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"watch\", value);\n }\n\n get manual(): boolean {\n return this.hasAttribute(\"manual\");\n }\n\n set manual(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"manual\", value);\n }\n\n // --- Core delegated getters ---\n\n get position(): WcsGeoPositionDetail | null {\n return this._core.position;\n }\n\n get latitude(): number | null {\n return this._core.latitude;\n }\n\n get longitude(): number | null {\n return this._core.longitude;\n }\n\n get accuracy(): number | null {\n return this._core.accuracy;\n }\n\n get coords(): WcsGeoCoords | null {\n return this._core.coords;\n }\n\n get timestamp(): number | null {\n return this._core.timestamp;\n }\n\n get watching(): boolean {\n return this._core.watching;\n }\n\n get loading(): boolean {\n return this._core.loading;\n }\n\n get error(): WcsGeoErrorDetail | null {\n return this._core.error;\n }\n\n get errorInfo(): WcsIoErrorInfo | null {\n return this._core.errorInfo;\n }\n\n get permission(): GeoPermissionState {\n return this._core.permission;\n }\n\n // wc-bindable connectedCallbackPromise protocol: resolves once the connect-time\n // acquisition settles, so SSR (@wcstack/server render.ts) waits for the first\n // fix before snapshotting the HTML. Mirrors Fetch.connectedCallbackPromise. The\n // connect-time decision runs in a microtask (_scheduleLocate), so the promise is\n // armed in connectedCallback and settled there; in `watch` / `manual` modes there\n // is no one-shot connect-time fix to await, so it resolves once the decision ran.\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Command property ---\n\n get trigger(): boolean {\n return this._trigger;\n }\n\n set trigger(value: boolean) {\n // Momentary command-property: a false→true write requests a single fix.\n // Mirrors the trigger flag on <wcs-timer> / <wcs-ws>. Prefer the\n // command-token protocol (`command.getCurrentPosition: $command.locate`) for\n // state-driven acquisition; this exists mainly for the DOM click trigger and\n // simple boolean bindings.\n const v = !!value;\n if (v) {\n this._trigger = true;\n // Fire-and-forget: getCurrentPosition() never rejects (failures surface via\n // the `error` property), so the returned promise is intentionally dropped.\n void this.getCurrentPosition();\n this._trigger = false;\n this.dispatchEvent(new CustomEvent(\"wcs-geo:trigger-changed\", {\n detail: false,\n bubbles: true,\n }));\n }\n }\n\n // --- Commands ---\n\n getCurrentPosition(): Promise<void> {\n return this._core.getCurrentPosition(this._options());\n }\n\n watchPosition(): void {\n this._core.watch(this._options());\n }\n\n clearWatch(): void {\n // 接続時の判断待ちなら、その連続監視を取り消す — 同じタスクの append → clearWatch() で、\n // 後のマイクロタスクが監視を始めないように(判断が同期だった頃は、始めた監視を\n // clearWatch() が止めていた)。一発取得は以前と同じく取り消さない。入れ直せば、次の\n // 判断は watch に従う\n if (this._connectResolve !== null) this._watchCancelled = true;\n this._core.clearWatch();\n }\n\n // --- Internal ---\n\n private _options(): GeoOptions {\n return {\n enableHighAccuracy: this.highAccuracy,\n timeout: this.timeout,\n maximumAge: this.maximumAge,\n };\n }\n\n // --- Lifecycle ---\n\n // 接続時の取得の判断はマイクロタスクで、そのときの manual / watch / high-accuracy /\n // timeout / maximum-age で 1 回だけ行う(timing-and-firing-contract §23)。router は遷移で\n // 同じノードを入れ直し、新しいルートの params から state が入力を書くのはマイクロタスク —\n // その場で取得すると、前の入力で getCurrentPosition / watchPosition を起こしていた\n // (docs/seam-apps.md、shift-desk)。\n private _scheduleLocate(): void {\n if (this._locatePending) return;\n this._locatePending = true;\n queueMicrotask(() => {\n this._locatePending = false;\n const resolveConnect = this._connectResolve;\n this._connectResolve = null;\n // 判断の前に外れた要素は何もしない(disconnectedCallback が解いて null にした)\n if (resolveConnect === null) return;\n const watchCancelled = this._watchCancelled;\n this._watchCancelled = false;\n if (this.manual) {\n resolveConnect();\n } else if (this.watch) {\n // `watch` attribute selects the default phase: continuous monitoring vs a\n // single fix on connect. 判断待ちに clearWatch() が呼ばれていたら始めない\n if (!watchCancelled) this.watchPosition();\n resolveConnect();\n } else {\n // Track only the one-shot connect-time fix so SSR can await it.\n // getCurrentPosition() never rejects (failures surface via `error`), so no\n // .catch() is needed.\n resolveConnect(this.getCurrentPosition());\n }\n });\n }\n\n connectedCallback(): void {\n // upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)\n upgradeProperties(this);\n this.style.display = \"none\";\n if (config.autoTrigger) {\n registerAutoTrigger();\n }\n // Revive permission tracking after a reconnect (reparenting). No-op on the\n // first connect since the constructor already subscribed; only re-subscribes\n // when disconnectedCallback's dispose() tore the subscription down. It reads no\n // input, so it stays here; only the acquisition decision is deferred.\n this._core.reinitPermission();\n // connectedCallbackPromise は接続時の判断(と一発取得)が済むまでを表す。判断は\n // マイクロタスクなので、ここで張って _scheduleLocate で解く\n this._connectedCallbackPromise = new Promise<void>((resolve) => {\n this._connectResolve = resolve;\n });\n this._scheduleLocate();\n }\n\n disconnectedCallback(): void {\n // 判断の前に外れたら、張った connectedCallbackPromise をここで解く — 同じタスクで\n // 入れ直されると次の connectedCallback が張り替えるので、待つ側が取り残されないように\n this._connectResolve?.();\n this._connectResolve = null;\n this._watchCancelled = false;\n this._core.clearWatch();\n this._core.dispose();\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/define-element.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * One copy of each package on a page (docs/timing-and-firing-contract.md §24). The first copy the\n * page evaluates defines the tags and a second one does nothing, so a copy that finds its tag defined\n * by another copy of the package — not its class, not a subclass of it, not the same version — warns\n * `[wcs/package-twice]` once per registry, naming both versions. The classes it defines carry\n * `\"<package>@<version>\"` under `Symbol.for(\"wcstack.package\")`; a class without it is named\n * \"another copy of <package> that does not name its version\" (an older copy, or one loaded through\n * an entry that does not stamp).\n */\n\n/** The static a class defined through this helper carries: `\"@wcstack/fetch@<version>\"`. */\nexport const PACKAGE_STAMP: unique symbol = Symbol.for(\"wcstack.package\");\n\ntype Stamped = { [PACKAGE_STAMP]?: string };\n\n/** The registries this copy warned about: one warning per package per registry. */\nconst warned = new WeakSet<CustomElementRegistry>();\n\n/**\n * Marks `cls` as defined by `pkg` (`\"@wcstack/fetch@<version>\"`). A subclass inherits the mark, and\n * `defineProperty` writes it even where a parent's mark is read-only.\n */\nexport function stampPackage(cls: CustomElementConstructor, pkg: string): void {\n Object.defineProperty(cls, PACKAGE_STAMP, { value: pkg, configurable: true });\n}\n\n/**\n * Warns when `tag` is defined as `existing` by another copy of the package `pkg` names: `existing`\n * is neither `own` nor a subclass of it (omit `own` when the copy has no class to compare with), and\n * carries another version or none. Once per registry.\n */\nexport function warnIfAnotherCopy(\n registry: CustomElementRegistry,\n tag: string,\n existing: CustomElementConstructor,\n own: CustomElementConstructor | undefined,\n pkg: string,\n): void {\n if (own !== undefined && (existing === own || existing.prototype instanceof own)) return;\n const theirs = (existing as Stamped)[PACKAGE_STAMP];\n if (theirs === pkg || warned.has(registry)) return;\n warned.add(registry);\n const name = pkg.slice(0, pkg.lastIndexOf(\"@\"));\n console.warn(\n `[${name}] [wcs/package-twice] <${tag}> is already defined by ` +\n `${theirs ?? `another copy of ${name} that does not name its version`}; ` +\n `this copy, ${pkg}, does nothing. Load each package once.`,\n );\n}\n\n/**\n * Defines each `[tag, class]` in `registry` unless the tag is already defined, stamping the class\n * with `pkg` (`\"@wcstack/fetch@<version>\"`). A tag another copy of the package defined first is left\n * as it is, with the warning above.\n */\nexport function defineElements(\n registry: CustomElementRegistry,\n pkg: string,\n definitions: readonly (readonly [tag: string, cls: CustomElementConstructor])[],\n): void {\n for (const [tag, cls] of definitions) {\n const existing = registry.get(tag);\n if (existing === undefined) {\n stampPackage(cls, pkg);\n registry.define(tag, cls);\n } else {\n warnIfAnotherCopy(registry, tag, existing, cls, pkg);\n }\n }\n}\n","import pkg from \"../package.json\" with { type: \"json\" };\nimport { WcsGeolocation } from \"./components/Geolocation.js\";\nimport { config } from \"./config.js\";\nimport { defineElements } from \"./protocol/defineElement.js\";\n\n/**\n * Register this package's tags. Pass a scoped `CustomElementRegistry` to define\n * them for a single shadow tree -- scoped registries do not inherit the global\n * one, so a tree using one needs its own definitions.\n */\nexport function registerComponents(registry: CustomElementRegistry = customElements): void {\n defineElements(registry, `${pkg.name}@${pkg.version}`, [\n [config.tagNames.geo, WcsGeolocation],\n ]);\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapGeolocation(userConfig?: IWritableConfig, registry?: CustomElementRegistry): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents(registry);\n}\n"],"names":["config","triggerAttribute","tagNames","geo","POLICY_CONTROLLED","Set","featureUnavailable","feature","g","globalThis","isSecureContext","has","policy","document","permissionsPolicy","featurePolicy","undefined","allowsFeature","featureUnavailableMessage","what","reason","WCS_GEO_ERROR_CODE","GeolocationCore","EventTarget","static","protocol","version","properties","name","event","semantics","getter","e","detail","latitude","longitude","accuracy","coords","timestamp","commands","async","_target","_watchId","_position","_watching","_loading","_error","_errorInfo","_unsupportedErrors","WeakSet","_permission","_permissionStatus","_permissionSubscribed","_permGen","_acqGen","_watchGen","_ready","Promise","resolve","constructor","target","super","this","_initPermission","position","watching","loading","error","errorInfo","permission","ready","_setPosition","dispatchEvent","CustomEvent","bubbles","_setWatching","_setLoading","_setError","_commitErrorInfo","code","message","unsupported","phase","recoverable","deriveGeoErrorInfo","info","_setPermission","getCurrentPosition","options","_hasGeolocation","_unsupportedError","gen","navigator","geolocation","pos","_normalizePosition","_unexpectedError","err","_normalizeError","watch","wgen","watchPosition","clearWatch","observe","reinitPermission","dispose","removeEventListener","_onPermissionChange","permissions","query","then","status","state","addEventListener","c","altitude","altitudeAccuracy","heading","speed","add","registered","handleClick","Element","triggerElement","closest","geoId","getAttribute","GeoCtor","customElements","get","geoElement","getElementById","preventDefault","hasAccessorOnPrototype","proto","Object","getPrototypeOf","descriptor","getOwnPropertyDescriptor","set","toldObjectAttribute","warnObjectAttribute","element","value","tag","localName","console","warn","initialAttributes","WeakMap","initialAttribute","el","byName","Map","writeAttribute","removeAttribute","setAttribute","reflectAttribute","initial","String","reflectBooleanAttribute","WcsGeolocation","HTMLElement","wcBindable","inputs","attribute","_core","_trigger","_connectedCallbackPromise","_connectResolve","_locatePending","_watchCancelled","_internals","_initInternals","_wireStates","d","debugStates","states","attachInternals","internals","delete","map","toStates","entries","debug","hasAttribute","on","toggleAttribute","highAccuracy","timeout","attr","trim","Infinity","parsed","Number","isFinite","maximumAge","manual","connectedCallbackPromise","trigger","_options","enableHighAccuracy","_scheduleLocate","queueMicrotask","resolveConnect","watchCancelled","connectedCallback","declaration","input","call","toLowerCase","startsWith","prototype","hasOwnProperty","record","upgradeProperties","style","display","disconnectedCallback","PACKAGE_STAMP","Symbol","for","warned","stampPackage","cls","pkg","defineProperty","configurable","warnIfAnotherCopy","registry","existing","own","theirs","slice","lastIndexOf","registerComponents","definitions","define","defineElements"],"mappings":"AAUA,MA4BaA,EA5BoB,CAE/BC,iBAAkB,iBAClBC,SAAU,CACRC,IAAK,oDC6IT,MAAMC,EAAoB,IAAIC,IAAI,CAChC,SAAU,aAAc,cAAe,OAAQ,iBAAkB,kBACjE,mBAAoB,iBAAkB,gBAAiB,YAAa,eACpE,uBAAwB,oBAKpB,SAAUC,EAAmBC,GACjC,MAAMC,EAAIC,WACV,IAA0B,IAAtBD,EAAEE,gBAA2B,MAAO,mBACxC,IAAKN,EAAkBO,IAAIJ,GAAU,OAAO,KAC5C,MAAMK,EAASJ,EAAEK,UAAUC,mBAAqBN,EAAEK,UAAUE,cAC5D,QAAeC,IAAXJ,GAAwD,mBAAzBA,EAAOK,cAA8B,OAAO,KAC/E,IACE,OAAOL,EAAOK,cAAcV,GAAW,KAAO,gBAChD,CAAE,MACA,OAA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66
66
|
}
|
|
67
67
|
|
|
68
|
+
var pkg = {"name":"@wcstack/geolocation","version":"4.11.0"};
|
|
69
|
+
|
|
68
70
|
// ===========================================================================
|
|
69
71
|
// AUTO-GENERATED FILE - DO NOT EDIT.
|
|
70
72
|
// Generated from /io-core/platform-capability.ts by scripts/sync-io-core.mjs.
|
|
@@ -1071,15 +1073,75 @@ class WcsGeolocation extends HTMLElement {
|
|
|
1071
1073
|
}
|
|
1072
1074
|
}
|
|
1073
1075
|
|
|
1076
|
+
// ===========================================================================
|
|
1077
|
+
// AUTO-GENERATED FILE - DO NOT EDIT.
|
|
1078
|
+
// Generated from /protocol/define-element.ts by scripts/sync-protocol-types.mjs.
|
|
1079
|
+
// Run `node scripts/sync-protocol-types.mjs` after editing the source.
|
|
1080
|
+
// ===========================================================================
|
|
1081
|
+
/**
|
|
1082
|
+
* One copy of each package on a page (docs/timing-and-firing-contract.md §24). The first copy the
|
|
1083
|
+
* page evaluates defines the tags and a second one does nothing, so a copy that finds its tag defined
|
|
1084
|
+
* by another copy of the package — not its class, not a subclass of it, not the same version — warns
|
|
1085
|
+
* `[wcs/package-twice]` once per registry, naming both versions. The classes it defines carry
|
|
1086
|
+
* `"<package>@<version>"` under `Symbol.for("wcstack.package")`; a class without it is named
|
|
1087
|
+
* "another copy of <package> that does not name its version" (an older copy, or one loaded through
|
|
1088
|
+
* an entry that does not stamp).
|
|
1089
|
+
*/
|
|
1090
|
+
/** The static a class defined through this helper carries: `"@wcstack/fetch@<version>"`. */
|
|
1091
|
+
const PACKAGE_STAMP = Symbol.for("wcstack.package");
|
|
1092
|
+
/** The registries this copy warned about: one warning per package per registry. */
|
|
1093
|
+
const warned = new WeakSet();
|
|
1094
|
+
/**
|
|
1095
|
+
* Marks `cls` as defined by `pkg` (`"@wcstack/fetch@<version>"`). A subclass inherits the mark, and
|
|
1096
|
+
* `defineProperty` writes it even where a parent's mark is read-only.
|
|
1097
|
+
*/
|
|
1098
|
+
function stampPackage(cls, pkg) {
|
|
1099
|
+
Object.defineProperty(cls, PACKAGE_STAMP, { value: pkg, configurable: true });
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Warns when `tag` is defined as `existing` by another copy of the package `pkg` names: `existing`
|
|
1103
|
+
* is neither `own` nor a subclass of it (omit `own` when the copy has no class to compare with), and
|
|
1104
|
+
* carries another version or none. Once per registry.
|
|
1105
|
+
*/
|
|
1106
|
+
function warnIfAnotherCopy(registry, tag, existing, own, pkg) {
|
|
1107
|
+
if (own !== undefined && (existing === own || existing.prototype instanceof own))
|
|
1108
|
+
return;
|
|
1109
|
+
const theirs = existing[PACKAGE_STAMP];
|
|
1110
|
+
if (theirs === pkg || warned.has(registry))
|
|
1111
|
+
return;
|
|
1112
|
+
warned.add(registry);
|
|
1113
|
+
const name = pkg.slice(0, pkg.lastIndexOf("@"));
|
|
1114
|
+
console.warn(`[${name}] [wcs/package-twice] <${tag}> is already defined by ` +
|
|
1115
|
+
`${theirs ?? `another copy of ${name} that does not name its version`}; ` +
|
|
1116
|
+
`this copy, ${pkg}, does nothing. Load each package once.`);
|
|
1117
|
+
}
|
|
1118
|
+
/**
|
|
1119
|
+
* Defines each `[tag, class]` in `registry` unless the tag is already defined, stamping the class
|
|
1120
|
+
* with `pkg` (`"@wcstack/fetch@<version>"`). A tag another copy of the package defined first is left
|
|
1121
|
+
* as it is, with the warning above.
|
|
1122
|
+
*/
|
|
1123
|
+
function defineElements(registry, pkg, definitions) {
|
|
1124
|
+
for (const [tag, cls] of definitions) {
|
|
1125
|
+
const existing = registry.get(tag);
|
|
1126
|
+
if (existing === undefined) {
|
|
1127
|
+
stampPackage(cls, pkg);
|
|
1128
|
+
registry.define(tag, cls);
|
|
1129
|
+
}
|
|
1130
|
+
else {
|
|
1131
|
+
warnIfAnotherCopy(registry, tag, existing, cls, pkg);
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1074
1136
|
/**
|
|
1075
1137
|
* Register this package's tags. Pass a scoped `CustomElementRegistry` to define
|
|
1076
1138
|
* them for a single shadow tree -- scoped registries do not inherit the global
|
|
1077
1139
|
* one, so a tree using one needs its own definitions.
|
|
1078
1140
|
*/
|
|
1079
1141
|
function registerComponents(registry = customElements) {
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1142
|
+
defineElements(registry, `${pkg.name}@${pkg.version}`, [
|
|
1143
|
+
[config.tagNames.geo, WcsGeolocation],
|
|
1144
|
+
]);
|
|
1083
1145
|
}
|
|
1084
1146
|
|
|
1085
1147
|
function bootstrapGeolocation(userConfig, registry) {
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/config.ts","../src/core/platformCapability.ts","../src/core/geolocationCapabilities.ts","../src/core/GeolocationCore.ts","../src/autoTrigger.ts","../src/protocol/upgradeProperties.ts","../src/protocol/inputAttribute.ts","../src/components/Geolocation.ts","../src/registerComponents.ts","../src/bootstrapGeolocation.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n autoTrigger: boolean;\n triggerAttribute: string;\n tagNames: {\n geo: string;\n };\n}\n\nconst _config: IInternalConfig = {\n autoTrigger: true,\n triggerAttribute: \"data-geotarget\",\n tagNames: {\n geo: \"wcs-geo\",\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: `bootstrapGeolocation` refuses it. */\nfunction invalid(key: string): never {\n throw new Error(`[@wcstack/geolocation] bootstrapGeolocation: \"${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 [key, value] of given) {\n if (key !== \"tagNames\") {\n options[key] = value;\n }\n }\n for (const [name, tag] of givenTags) tags[name] = tag as string;\n frozenConfig = null;\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /io-core/platform-capability.ts by scripts/sync-io-core.mjs.\n// Run `node scripts/sync-io-core.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * platform-capability.ts\n *\n * Phase 6(docs/architecture-hardening/09-remediation-design.md §7.2 /\n * 07-browser-capability-variance.md)の browser capability 判定と error taxonomy の\n * 汎用プリミティブ。node 固有の capability registry / error code は各パッケージが\n * 別ファイルで宣言し、この汎用層(型 + assess 機構)を import する。\n *\n * 原則:\n * - feature detection は境界(利用直前)で行う。module 評価時に browser global を\n * 参照しない(SSR / worker で import が失敗しない)。\n * - capability ID(`web.fetch` 等)は文字列を global property path として eval せず、\n * registry が ID ごとに副作用のない presence probe を対応付ける。\n * - availability / permission / readiness / activity / operation error を 1 つの\n * `ready / unsupported / error` enum に畳まない。required 欠如は開始しない、\n * optional 欠如は宣言済み fallback で readiness を `degraded` にする。\n *\n * 配置: 本ファイルは /io-core/ の単一正典であり、scripts/sync-io-core.mjs が\n * 各 IO ノードの src/core/ へ生成コピー (AUTO-GENERATED, 編集禁止) を配布する。\n * `protocol/wcBindable.ts` と同じ copy-distribution 方式で、ランタイム依存を導入せず\n * 各パッケージのバンドルへ inline される (zero-runtime-dep / 自己完結 CDN を維持)。\n * 編集はこの正典に対して行い、`node scripts/sync-io-core.mjs` で再配布する。\n *\n * pure(module 評価時に browser global 非参照)。\n */\n\nexport type Availability = \"available\" | \"missing\" | \"unknown\";\nexport type PermissionState = \"granted\" | \"denied\" | \"prompt\" | \"not-applicable\" | \"unknown\";\nexport type Readiness = \"idle\" | \"ready\" | \"degraded\";\nexport type Activity = \"inactive\" | \"active\";\nexport type PreconditionState = \"satisfied\" | \"required\" | \"not-applicable\";\n\n/** operation error の phase(taxonomy)。 */\nexport type WcsIoErrorPhase = \"probe\" | \"start\" | \"execute\" | \"decode\" | \"commit\" | \"dispose\";\n\n/** serializable な error info(non-cloneable な cause とは分離。DevTools / remote へは info のみ)。 */\nexport interface WcsIoErrorInfo {\n readonly code: string;\n readonly phase: WcsIoErrorPhase;\n readonly recoverable: boolean;\n readonly capabilityId?: string;\n readonly message: string;\n}\n\nexport interface PlatformAssessment {\n readonly availability: ReadonlyMap<string, Availability>;\n readonly permission: PermissionState;\n readonly readiness: Readiness;\n readonly activity: Activity;\n readonly preconditions: {\n readonly secureContext: PreconditionState;\n readonly userActivation: PreconditionState;\n };\n readonly epoch: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\n/** capability 1 件の仕様。probe は副作用なく presence を返す(利用直前に呼ぶ)。 */\nexport interface CapabilitySpec {\n readonly probe: () => boolean;\n readonly requiresSecureContext?: boolean;\n readonly requiresUserActivation?: boolean;\n /** browser compatibility dataset のキー(任意・診断用)。 */\n readonly compatKey?: string;\n}\n\nexport type CapabilityRegistry = ReadonlyMap<string, CapabilitySpec>;\n\nexport interface AssessOptions {\n readonly required: readonly string[];\n readonly optional?: readonly string[];\n readonly permission?: PermissionState;\n readonly activity?: Activity;\n readonly epoch?: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\nfunction isSecureContext(): boolean {\n return (globalThis as { isSecureContext?: unknown }).isSecureContext === true;\n}\n\n/**\n * capability を利用直前に評価して PlatformAssessment を作る。\n * required が 1 つでも欠ければ readiness は \"idle\"(開始不可)、\n * required 揃い + optional 欠けは \"degraded\"、全揃いは \"ready\"。\n */\nexport function assessCapabilities(registry: CapabilityRegistry, options: AssessOptions): PlatformAssessment {\n const availability = new Map<string, Availability>();\n const evaluate = (id: string): Availability => {\n const spec = registry.get(id);\n if (spec === undefined) return \"unknown\";\n return spec.probe() ? \"available\" : \"missing\";\n };\n\n let requiredAllAvailable = true;\n for (const id of options.required) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") requiredAllAvailable = false;\n }\n let optionalAllAvailable = true;\n for (const id of options.optional ?? []) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") optionalAllAvailable = false;\n }\n\n const readiness: Readiness = !requiredAllAvailable ? \"idle\" : (optionalAllAvailable ? \"ready\" : \"degraded\");\n\n // preconditions: 対象 capability のいずれかが要求する場合だけ評価する。\n const allIds = [...options.required, ...(options.optional ?? [])];\n const needsSecure = allIds.some((id) => registry.get(id)?.requiresSecureContext === true);\n const needsActivation = allIds.some((id) => registry.get(id)?.requiresUserActivation === true);\n const secureContext: PreconditionState = needsSecure ? (isSecureContext() ? \"satisfied\" : \"required\") : \"not-applicable\";\n const userActivation: PreconditionState = needsActivation ? \"required\" : \"not-applicable\";\n\n return {\n availability,\n permission: options.permission ?? \"not-applicable\",\n readiness,\n activity: options.activity ?? \"inactive\",\n preconditions: { secureContext, userActivation },\n epoch: options.epoch ?? 0,\n lastError: options.lastError,\n };\n}\n\n/** availability から「required がすべて available か」を判定するヘルパ(supported の最低条件)。 */\nexport function requiredCapabilitiesAvailable(assessment: PlatformAssessment, required: readonly string[]): boolean {\n return required.every((id) => assessment.availability.get(id) === \"available\");\n}\n\n/**\n * このページで機能が使えない理由(使える、または分からないなら null)。利用直前に読む。\n *\n * - `\"insecure-context\"`: 安全なコンテキストではない(`isSecureContext === false`)。\n * Permissions API が扱う機能はどれも安全なコンテキストを要る。\n * - `\"policy-blocked\"`: Permissions-Policy(サーバーのヘッダ、または `allow` の無い\n * `<iframe>`)がその機能を切っている。\n *\n * どちらも Permissions API は教えない: Chromium はポリシーで切られた文書でも\n * `granted` を、安全でない origin では `denied` を返す。利用者の拒否と区別するため、\n * 見張り役(`<wcs-permission>`)も取りに行く側も `unsupported` を報告する\n * (docs/v4-direction-2026-10.md の決定、state-field-report)。\n * `isSecureContext` が無い環境(SSR・テスト)は判断しない。\n */\nexport type FeatureUnavailableReason = \"insecure-context\" | \"policy-blocked\";\n\n/** Permissions-Policy が制御する機能(permission 名と同じ文字列)。 */\nconst POLICY_CONTROLLED = new Set([\n \"camera\", \"microphone\", \"geolocation\", \"midi\", \"clipboard-read\", \"clipboard-write\",\n \"screen-wake-lock\", \"idle-detection\", \"accelerometer\", \"gyroscope\", \"magnetometer\",\n \"ambient-light-sensor\", \"display-capture\",\n]);\n\ninterface PolicyLike { allowsFeature(feature: string): boolean }\n\nexport function featureUnavailable(feature: string): FeatureUnavailableReason | null {\n const g = globalThis as { isSecureContext?: unknown; document?: { permissionsPolicy?: PolicyLike; featurePolicy?: PolicyLike } };\n if (g.isSecureContext === false) return \"insecure-context\";\n if (!POLICY_CONTROLLED.has(feature)) return null;\n const policy = g.document?.permissionsPolicy ?? g.document?.featurePolicy;\n if (policy === undefined || typeof policy.allowsFeature !== \"function\") return null;\n try {\n return policy.allowsFeature(feature) ? null : \"policy-blocked\";\n } catch {\n return null;\n }\n}\n\n/** `featureUnavailable` の理由を、作者が直し方を読める文にする。`what` は文頭(「The camera」など)。 */\nexport function featureUnavailableMessage(what: string, feature: string, reason: FeatureUnavailableReason): string {\n return reason === \"insecure-context\"\n ? `${what} needs a secure context (https:, or http://localhost), and this page is not one.`\n : `${what} is turned off for this page by a Permissions-Policy: the server's Permissions-Policy header, ` +\n `or an <iframe> without allow=\"${feature}\". The browser's site settings cannot change that.`;\n}\n","/**\n * geolocationCapabilities.ts\n *\n * Geolocation node 固有の error code(taxonomy)と derivation。汎用の error info 型は\n * `./platformCapability.js`(/io-core/ から copy-distribution される生成ファイル)から\n * import する。geolocation は concurrent-independent(競合しない)ため lane は持たず、\n * error taxonomy(errorInfo)のみを採用する。\n */\n\nimport type { WcsIoErrorInfo } from \"./platformCapability.js\";\n\n/** 安定した geolocation error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_GEO_ERROR_CODE = {\n PermissionDenied: \"permission-denied\",\n PositionUnavailable: \"position-unavailable\",\n Timeout: \"timeout\",\n // このページで使えない(API 不在・安全でない origin・Permissions-Policy)。利用者の拒否\n // (permission-denied)と区別する — サイトの設定では直らない。\n CapabilityMissing: \"capability-missing\",\n} as const;\n\n/**\n * 正規化済み `GeolocationPositionError`(spec code 1/2/3)を serializable な error\n * taxonomy に写す。\"unexpected\" は code 2(position-unavailable)に畳むため、これは既存の\n * `error.code` を忠実にミラーする。permission-denied(1)だけは retry で回復しないため\n * recoverable=false。`unsupported`(このページで使えない — Core は `error.code` を 2 にする)\n * は capability-missing / probe / recoverable=false。\n */\nexport function deriveGeoErrorInfo(code: number, message: string, unsupported = false): WcsIoErrorInfo {\n if (unsupported) {\n return { code: WCS_GEO_ERROR_CODE.CapabilityMissing, phase: \"probe\", recoverable: false, message };\n }\n const taxonomyCode = code === 1\n ? WCS_GEO_ERROR_CODE.PermissionDenied\n : code === 3\n ? WCS_GEO_ERROR_CODE.Timeout\n : WCS_GEO_ERROR_CODE.PositionUnavailable;\n return { code: taxonomyCode, phase: \"execute\", recoverable: code !== 1, message };\n}\n","import {\n IWcBindable, GeoOptions, GeoPermissionState,\n WcsGeoPositionDetail, WcsGeoCoords, WcsGeoErrorDetail,\n} from \"../types.js\";\nimport { WcsIoErrorInfo, featureUnavailable, featureUnavailableMessage } from \"./platformCapability.js\";\nimport { deriveGeoErrorInfo } from \"./geolocationCapabilities.js\";\n\n/**\n * Headless geolocation primitive. A thin, framework-agnostic wrapper around the\n * Geolocation API exposed through the wc-bindable protocol.\n *\n * It has two phases, mirroring the two distinct shapes of the underlying API:\n * - **one-shot** — `getCurrentPosition()` resolves a single fix (like FetchCore's\n * one-shot `fetch()`), toggling `loading` around the async call.\n * - **continuous** — `watch()` / `clearWatch()` stream fixes (like TimerCore's\n * `start()` / `stop()`), toggling the `watching` flag.\n *\n * Every successful fix is published via the single `wcs-geo:position` event;\n * `latitude` / `longitude` / `accuracy` / `coords` / `timestamp` are read from\n * it through getters (mirroring how TimerCore exposes count/elapsed from one\n * `wcs-timer:tick` event), so an observer that binds any of them is notified on\n * every fix.\n *\n * Geolocation also has a permission gate absent from timer/websocket: the\n * `permission` property reflects `navigator.permissions.query({name:\n * \"geolocation\"})` (`prompt` / `granted` / `denied`, or `unsupported`) and\n * tracks its live `change` event. It is a read-only sensor — there is no\n * element-bound \"send\" path; element → state only.\n */\nexport class GeolocationCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"position\", event: \"wcs-geo:position\", semantics: \"state\" },\n { name: \"latitude\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.latitude },\n { name: \"longitude\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.longitude },\n { name: \"accuracy\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.accuracy },\n { name: \"coords\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.coords },\n { name: \"timestamp\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.timestamp },\n { name: \"watching\", event: \"wcs-geo:watching-changed\", semantics: \"state\" },\n { name: \"loading\", event: \"wcs-geo:loading-changed\", semantics: \"state\" },\n { name: \"error\", event: \"wcs-geo:error\", semantics: \"state\" },\n { name: \"permission\", event: \"wcs-geo:permission-changed\", semantics: \"state\" },\n // Serializable failure taxonomy (stable code / phase / recoverable), or null.\n // Additive bindable output derived from the normalized `error` (spec code\n // 1/2/3 → permission-denied / position-unavailable / timeout); the existing\n // `error` property/event are unchanged. Fires `wcs-geo:error-info-changed`.\n { name: \"errorInfo\", event: \"wcs-geo:error-info-changed\", semantics: \"state\" },\n ],\n commands: [\n { name: \"getCurrentPosition\", async: true },\n { name: \"watch\" },\n { name: \"clearWatch\" },\n ],\n };\n\n private _target: EventTarget;\n private _watchId: number | null = null;\n\n private _position: WcsGeoPositionDetail | null = null;\n private _watching: boolean = false;\n private _loading: boolean = false;\n private _error: WcsGeoErrorDetail | null = null;\n private _errorInfo: WcsIoErrorInfo | null = null;\n // the errors that say this page cannot use geolocation (errorInfo: capability-missing)\n private _unsupportedErrors = new WeakSet<WcsGeoErrorDetail>();\n private _permission: GeoPermissionState = \"prompt\";\n\n // Live PermissionStatus handle (when the Permissions API is available), kept\n // so the `change` listener can be removed on dispose().\n private _permissionStatus: PermissionStatus | null = null;\n\n // True once a permission subscription has been (or is being) established, and\n // reset by dispose(). Guards reinitPermission() so the first connect after\n // construction does not double-subscribe, while a reconnect after dispose()\n // does re-subscribe.\n private _permissionSubscribed: boolean = false;\n\n // Monotonic id of the current permission query. Bumped by every _initPermission()\n // and by dispose(). Each in-flight query captures its id and, on resolve, bails\n // unless it is still current — so a query superseded by a rapid (synchronous)\n // disconnect→reconnect, or one that resolves after dispose(), never attaches a\n // listener. A plain boolean cannot cover this: dispose()→reinit() flips it\n // false→true again, reopening the window for the stale query to slip through.\n private _permGen: number = 0;\n\n // Monotonic id of the current acquisition lifecycle, bumped only by dispose().\n // Each getCurrentPosition() captures it at start; the async success/error\n // callback bails (no setters, no resolve-side effects) if it is stale, so a\n // one-shot fix that resolves after the element was disconnected does not\n // dispatch wcs-geo:* on a torn-down element. Unlike FetchCore, the Geolocation\n // API has no AbortController, so a generation guard is the only way to neutralize\n // an in-flight one-shot. (watch is already stopped by clearWatch on disconnect.)\n private _acqGen: number = 0;\n\n // Monotonic id of the current watch lifecycle, bumped by watch(), clearWatch(),\n // and dispose(). Each watch() captures it; both watch callbacks bail if it is\n // stale. Unlike a live `_watchId === null` check, this distinguishes the current\n // watch from a superseded one: a clearWatch()→watch() restart installs a new\n // watchId (non-null), so a queued callback from the previous watch would pass a\n // null-check but fails the generation compare. (The README recommends exactly\n // this restart sequence to reconfigure a watch.)\n private _watchGen: number = 0;\n\n // Resolves once the most recent permission probe settles (or immediately when\n // the Permissions API is unsupported). The Shell exposes this as\n // connectedCallbackPromise so SSR can await the first probe before snapshotting\n // the HTML. Mirrors PermissionCore._ready.\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n // Probe the permission state up front so observers see the real value\n // (granted/denied/prompt) before the first read, then keep it live.\n this._ready = this._initPermission();\n }\n\n get position(): WcsGeoPositionDetail | null {\n return this._position;\n }\n\n get latitude(): number | null {\n return this._position ? this._position.latitude : null;\n }\n\n get longitude(): number | null {\n return this._position ? this._position.longitude : null;\n }\n\n get accuracy(): number | null {\n return this._position ? this._position.accuracy : null;\n }\n\n get coords(): WcsGeoCoords | null {\n return this._position ? this._position.coords : null;\n }\n\n get timestamp(): number | null {\n return this._position ? this._position.timestamp : null;\n }\n\n get watching(): boolean {\n return this._watching;\n }\n\n get loading(): boolean {\n return this._loading;\n }\n\n get error(): WcsGeoErrorDetail | null {\n return this._error;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable`), or null. Exposed as an additive wc-bindable property (event\n * `wcs-geo:error-info-changed`), derived from the normalized `error`; the\n * existing `error` property/event are unchanged.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n get permission(): GeoPermissionState {\n return this._permission;\n }\n\n /** Resolves once the first (or most recent) permission probe settles (§3.8). */\n get ready(): Promise<void> {\n return this._ready;\n }\n\n // --- State setters with event dispatch ---\n\n private _setPosition(position: WcsGeoPositionDetail): void {\n this._position = position;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:position\", {\n detail: position,\n bubbles: true,\n }));\n }\n\n private _setWatching(watching: boolean): void {\n if (this._watching === watching) return;\n this._watching = watching;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:watching-changed\", {\n detail: watching,\n bubbles: true,\n }));\n }\n\n private _setLoading(loading: boolean): void {\n if (this._loading === loading) return;\n this._loading = loading;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:loading-changed\", {\n detail: loading,\n bubbles: true,\n }));\n }\n\n private _setError(error: WcsGeoErrorDetail | null): void {\n // Same-value guard, like the other setters. Unlike `position` (which has\n // derived getters and so must re-fire even on an identical reference), `error`\n // has no derived state — so suppressing redundant null→null dispatches (e.g.\n // a successful fix clearing an already-null error) avoids spurious events.\n if (this._error === error) return;\n this._error = error;\n // Keep the additive `errorInfo` taxonomy in sync with `error`: derive it from\n // the normalized error (or null on clear). Fires before the `error` event so an\n // observer binding both sees the classification first, mirroring the io-node\n // family. No lane here — geolocation's fixes don't compete (dispose-only guard).\n this._commitErrorInfo(error === null ? null : deriveGeoErrorInfo(error.code, error.message, this._unsupportedErrors.has(error)));\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n // Called only from _setError (which already same-value-guards on the error\n // reference), so errorInfo transitions exactly when error does — no separate\n // guard needed here.\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:error-info-changed\", {\n detail: info,\n bubbles: true,\n }));\n }\n\n private _setPermission(permission: GeoPermissionState): void {\n if (this._permission === permission) return;\n this._permission = permission;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:permission-changed\", {\n detail: permission,\n bubbles: true,\n }));\n }\n\n // --- Public API ---\n\n /**\n * Acquire a single position fix. Resolves once the fix arrives or the request\n * fails — never rejects: failures are surfaced through the `error` property so\n * they flow into the declarative state, symmetrical with FetchCore.\n */\n getCurrentPosition(options: GeoOptions = {}): Promise<void> {\n return new Promise<void>((resolve) => {\n if (!this._hasGeolocation()) {\n this._setError(this._unsupportedError());\n resolve();\n return;\n }\n\n const gen = this._acqGen;\n this._setLoading(true);\n this._setError(null);\n navigator.geolocation.getCurrentPosition(\n (pos) => {\n // Stale: the element was disposed (disconnected) while this fix was in\n // flight. Drop it so a torn-down element never dispatches wcs-geo:*.\n // Still resolve() so any awaiter (e.g. connectedCallbackPromise) settles.\n if (gen !== this._acqGen) {\n resolve();\n return;\n }\n // Guard normalization/dispatch so a throw never escapes this browser\n // callback as an unhandled rejection, leaves the promise pending (which\n // would hang SSR's connectedCallbackPromise), or leaves `loading` stuck\n // true. Loading is cleared first so it holds even if a later step throws.\n try {\n this._setLoading(false);\n this._setPosition(this._normalizePosition(pos));\n } catch {\n // Surface the unexpected failure as an error so observers are not left\n // silently stale, then resolve below.\n this._setError(this._unexpectedError());\n }\n resolve();\n },\n (err) => {\n if (gen !== this._acqGen) {\n resolve();\n return;\n }\n try {\n this._setLoading(false);\n this._setError(this._normalizeError(err));\n } catch {\n this._setError(this._unexpectedError());\n }\n resolve();\n },\n options,\n );\n });\n }\n\n /**\n * Begin continuously watching the position. Idempotent while already\n * watching: a redundant watch() must not register a second `watchPosition`\n * (which would leak the handle and double the fix rate). Reconfiguring is done\n * via clearWatch() + watch().\n */\n watch(options: GeoOptions = {}): void {\n if (!this._hasGeolocation()) {\n this._setError(this._unsupportedError());\n return;\n }\n if (this._watching) return;\n\n this._setError(null);\n this._setWatching(true);\n // Open a new watch generation so any queued callback from a prior watch\n // (cleared then restarted) is recognized as stale below.\n const wgen = ++this._watchGen;\n this._watchId = navigator.geolocation.watchPosition(\n (pos) => {\n // Stale: this callback belongs to a watch that was cleared (or the element\n // disposed), possibly already superseded by a restart. A live\n // `_watchId === null` check cannot catch the restart case (the new watch\n // re-populates _watchId), so compare the captured generation instead.\n if (wgen !== this._watchGen) return;\n // Guard normalization/dispatch so an unexpected throw never escapes this\n // browser callback as an unhandled rejection — symmetric with the one-shot\n // path.\n try {\n // A recovered fix clears any prior transient error (e.g. a one-off\n // TIMEOUT) so `error` reflects the current state, not a stale failure.\n // The _setError same-value guard makes this free when error is already\n // null.\n this._setError(null);\n this._setPosition(this._normalizePosition(pos));\n } catch {\n this._setError(this._unexpectedError());\n }\n },\n (err) => {\n if (wgen !== this._watchGen) return;\n // An error does not implicitly release the watch — the watchId stays\n // valid and clearWatch() remains the teardown path — so `watching` is\n // left true to reflect \"watch still registered\". A terminal error (e.g.\n // PERMISSION_DENIED) is surfaced via the `error` property; callers that\n // want to stop on error can call clearWatch() in response.\n try {\n this._setError(this._normalizeError(err));\n } catch {\n this._setError(this._unexpectedError());\n }\n },\n options,\n );\n }\n\n clearWatch(): void {\n if (this._watchId !== null) {\n navigator.geolocation.clearWatch(this._watchId);\n this._watchId = null;\n }\n // Invalidate the current watch generation so any callback the browser may\n // still deliver after teardown bails.\n this._watchGen++;\n this._setWatching(false);\n }\n\n /**\n * Establish permission monitoring (§3.5). Idempotent: a no-op while a\n * subscription is already live (so the first connect after construction does\n * not double-subscribe), and re-subscribes after a dispose() — e.g. the Shell\n * element was disconnected and then reconnected (reparented). Returns the\n * `ready` promise, which resolves once the (re)established probe settles, so\n * the Shell can expose it as connectedCallbackPromise for SSR. Position\n * acquisition (one-shot / watch) is command-driven and the Shell drives it\n * separately from connectedCallback.\n */\n observe(): Promise<void> {\n if (!this._permissionSubscribed) {\n this._ready = this._initPermission();\n }\n return this._ready;\n }\n\n /**\n * Re-establish the permission `change` subscription after a dispose() — e.g.\n * the Shell element was disconnected and then reconnected (reparented). No-op\n * while a subscription is already live, so the first connect after\n * construction does not double-subscribe. This keeps permission tracking\n * symmetric with position acquisition, which the Shell also revives on\n * reconnect.\n *\n * Retained as a thin alias of observe() for the Shell's existing reconnect\n * path; observe() is the canonical §3.5 lifecycle entry point.\n */\n reinitPermission(): void {\n void this.observe();\n }\n\n /**\n * Detach the live permission `change` listener. Call from the Shell's\n * `disconnectedCallback` so a removed element does not leak the subscription.\n * A later reconnect can re-subscribe via reinitPermission().\n */\n dispose(): void {\n this._permissionSubscribed = false;\n // Invalidate any in-flight query so its .then() bails instead of attaching a\n // listener after teardown.\n this._permGen++;\n // Invalidate any in-flight one-shot acquisition so its success/error callback\n // bails instead of dispatching on a disconnected element.\n this._acqGen++;\n // Likewise invalidate the watch generation. The Shell already calls\n // clearWatch() before dispose(), but a direct headless dispose() (without a\n // preceding clearWatch) still neutralizes any queued watch callback.\n this._watchGen++;\n // Clear loading, with its event (timing-and-firing-contract §22): the bailed\n // callback above will not clear it, and a route the element leaves keeps its\n // nodes — bindings included — for the next entry, so a reset nobody heard would\n // leave the page showing an acquisition that is gone. Clearing it also keeps the\n // loading=true edge of the next acquisition after a reconnect.\n this._setLoading(false);\n if (this._permissionStatus) {\n this._permissionStatus.removeEventListener(\"change\", this._onPermissionChange);\n this._permissionStatus = null;\n }\n }\n\n // --- Internal ---\n\n private _hasGeolocation(): boolean {\n return typeof navigator !== \"undefined\" && !!navigator.geolocation && featureUnavailable(\"geolocation\") === null;\n }\n\n private _initPermission(): Promise<void> {\n // A page that cannot use geolocation (not a secure context, or turned off by a\n // Permissions-Policy) is \"unsupported\": the Permissions API answers \"granted\" in a\n // policy-blocked frame and \"denied\" on an insecure origin — a user's refusal, which\n // the site settings would fix and these cannot. Neither changes while the page lives.\n if (featureUnavailable(\"geolocation\") !== null) {\n this._setPermission(\"unsupported\");\n return Promise.resolve();\n }\n // The Permissions API is optional. When absent (or it rejects, e.g. some\n // browsers don't accept the \"geolocation\" name), report \"unsupported\" and\n // leave acquisition to fail loudly via the error property if attempted.\n if (typeof navigator === \"undefined\" || !navigator.permissions || typeof navigator.permissions.query !== \"function\") {\n // Route through _setPermission (not a bare assignment) so observers stay in\n // sync with the public state. The same-value guard means no redundant\n // dispatch when the state does not actually change; it does mean a\n // previously-observed \"granted\"/\"denied\" being reinit'd into an environment\n // that lost the Permissions API now correctly notifies observers of the\n // unsupported transition instead of silently overwriting the shadow value.\n this._setPermission(\"unsupported\");\n // No asynchronous probe to await: readiness is immediate.\n return Promise.resolve();\n }\n this._permissionSubscribed = true;\n const gen = ++this._permGen;\n return navigator.permissions.query({ name: \"geolocation\" as PermissionName }).then(\n (status) => {\n // Stale resolution: this query was superseded (rapid reconnect) or the\n // element was disposed while it was in flight. Drop it so only the current\n // subscription attaches a listener.\n if (gen !== this._permGen) return;\n this._permissionStatus = status;\n this._setPermission(status.state as GeoPermissionState);\n status.addEventListener(\"change\", this._onPermissionChange);\n },\n () => {\n if (gen !== this._permGen) return;\n this._setPermission(\"unsupported\");\n },\n );\n }\n\n private _onPermissionChange = (event: Event): void => {\n const status = event.target as PermissionStatus;\n this._setPermission(status.state as GeoPermissionState);\n };\n\n private _normalizePosition(pos: GeolocationPosition): WcsGeoPositionDetail {\n const c = pos.coords;\n const coords: WcsGeoCoords = {\n latitude: c.latitude,\n longitude: c.longitude,\n accuracy: c.accuracy,\n altitude: c.altitude,\n altitudeAccuracy: c.altitudeAccuracy,\n heading: c.heading,\n speed: c.speed,\n };\n return { ...coords, timestamp: pos.timestamp, coords };\n }\n\n private _normalizeError(err: GeolocationPositionError): WcsGeoErrorDetail {\n return { code: err.code, message: err.message };\n }\n\n private _unsupportedError(): WcsGeoErrorDetail {\n // Geolocation API absent, or not available to this page: surface it as\n // POSITION_UNAVAILABLE (2) so consumers that switch on the spec error codes treat\n // it like any other unavailable fix; errorInfo says capability-missing.\n const reason = featureUnavailable(\"geolocation\");\n const error: WcsGeoErrorDetail = {\n code: 2,\n message: reason === null\n ? \"Geolocation API is not available in this environment.\"\n : featureUnavailableMessage(\"Geolocation\", \"geolocation\", reason),\n };\n this._unsupportedErrors.add(error);\n return error;\n }\n\n private _unexpectedError(): WcsGeoErrorDetail {\n // An unexpected throw while normalizing/dispatching a fix. Surface it as\n // POSITION_UNAVAILABLE (2) so it flows into `error` like any other failure\n // instead of escaping the browser callback as an unhandled rejection.\n return { code: 2, message: \"Unexpected error while processing the position fix.\" };\n }\n}\n","import { config } from \"./config.js\";\nimport type { WcsGeolocation } from \"./components/Geolocation.js\";\n\nlet registered = false;\n\nfunction handleClick(event: Event): void {\n const target = event.target;\n if (!(target instanceof Element)) return;\n\n const triggerElement = target.closest<Element>(`[${config.triggerAttribute}]`);\n if (!triggerElement) return;\n\n const geoId = triggerElement.getAttribute(config.triggerAttribute);\n if (!geoId) return;\n\n // Resolve the registered constructor at call time instead of importing\n // Geolocation as a value. The value import created a components/Geolocation.ts\n // ⇄ autoTrigger.ts cycle (Geolocation.connectedCallback() calls\n // registerAutoTrigger()). instanceof against the customElements registry keeps\n // the exact same identity guarantee — only the registered <wcs-geo> class\n // matches — without the import cycle.\n const GeoCtor = customElements.get(config.tagNames.geo);\n const geoElement = document.getElementById(geoId);\n if (!GeoCtor || !(geoElement instanceof GeoCtor)) return;\n\n // Suppress the element's default action so a fix can be requested without\n // navigating. Intentional: do not attach data-geotarget to an element whose\n // default action you also want (real <a href> link, form-submit button) — it\n // will be cancelled. See README \"Optional DOM Triggering\".\n event.preventDefault();\n (geoElement as WcsGeolocation).getCurrentPosition();\n}\n\nexport function registerAutoTrigger(): void {\n if (registered) return;\n registered = true;\n document.addEventListener(\"click\", handleClick);\n}\n\nexport function unregisterAutoTrigger(): void {\n if (!registered) return;\n registered = false;\n document.removeEventListener(\"click\", handleClick);\n}\n","// ===========================================================================\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 { config } from \"../config.js\";\nimport { IWcBindable, GeoOptions, GeoPermissionState, WcsGeoPositionDetail, WcsGeoCoords, WcsGeoErrorDetail } from \"../types.js\";\nimport { GeolocationCore } from \"../core/GeolocationCore.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\nimport { registerAutoTrigger } from \"../autoTrigger.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.js\";\nimport { reflectAttribute, reflectBooleanAttribute } from \"../protocol/inputAttribute.js\";\n\n// Named WcsGeolocation (not `Geolocation`) so the class does not shadow the\n// global DOM `Geolocation` interface (the type of `navigator.geolocation`), and\n// to match the <wcs-ws> convention (WcsWebSocket). The public export keeps the\n// `WcsGeolocation` name unchanged, so this rename is non-breaking.\nexport class WcsGeolocation extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n static wcBindable: IWcBindable = {\n ...GeolocationCore.wcBindable,\n properties: [\n ...GeolocationCore.wcBindable.properties,\n { name: \"trigger\", event: \"wcs-geo:trigger-changed\", semantics: \"state\" },\n ],\n // Shell-level settable surface. Each input carries its mirrored `attribute`\n // hint (boolean flags reflect idempotently, so a binding system that writes\n // through inputs[].attribute is safe), following the <wcs-ws> convention.\n // `trigger` has no attribute — it is a momentary command-property, not a\n // declarative attribute. The `getCurrentPosition` / `watchPosition` /\n // `clearWatch` commands are declared below.\n inputs: [\n { name: \"highAccuracy\", attribute: \"high-accuracy\" },\n { name: \"timeout\", attribute: \"timeout\" },\n { name: \"maximumAge\", attribute: \"maximum-age\" },\n { name: \"watch\", attribute: \"watch\" },\n { name: \"manual\", attribute: \"manual\" },\n { name: \"trigger\" },\n ],\n // The Core's `watch` command is renamed to `watchPosition` on the Shell so it\n // does not collide with the `watch` boolean attribute accessor (same pattern\n // as <wcs-ws>, where the `send` command becomes `sendMessage` to free the\n // `send` setter). `getCurrentPosition` / `clearWatch` are unchanged.\n commands: [\n { name: \"getCurrentPosition\", async: true },\n { name: \"watchPosition\" },\n { name: \"clearWatch\" },\n ],\n };\n\n private _core: GeolocationCore;\n private _trigger: boolean = false;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n // connectedCallback が張った connectedCallbackPromise を解く関数。接続時の判断を下す\n // _scheduleLocate のマイクロタスクが(その前に外れたときは disconnectedCallback が)呼ぶ。\n private _connectResolve: ((value: void | PromiseLike<void>) => void) | null = null;\n // _scheduleLocate のマイクロタスクが待っている間 true\n private _locatePending: boolean = false;\n // 接続時の判断待ちに clearWatch() が呼ばれたら true — その判断は watch でも監視を始めない\n private _watchCancelled: boolean = false;\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new GeolocationCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-geo:watching-changed\": (d) => ({ watching: d === true }),\n \"wcs-geo:loading-changed\": (d) => ({ loading: d === true }),\n \"wcs-geo:error\": (d) => ({ error: d != null }),\n });\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (docs/custom-state-reflection-design.md §3.4): 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, it\n // 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 // Input setters never let setAttribute stringify null / undefined (an\n // \"undefined\" timeout would silently fall back to Infinity): `null` removes the\n // attribute (the default), `undefined` restores the attribute the element\n // started with (wc-bindable producer guidance P1; React 19 and a direct\n // assignment deliver it, @wcstack/state does not).\n\n get highAccuracy(): boolean {\n return this.hasAttribute(\"high-accuracy\");\n }\n\n set highAccuracy(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"high-accuracy\", value);\n }\n\n get timeout(): number {\n const attr = this.getAttribute(\"timeout\");\n if (attr === null || attr.trim() === \"\") return Infinity;\n // Strict parse via Number() (unlike parseInt, \"10px\" -> NaN, not 10). Fall\n // back to the API default (Infinity = no timeout) for any non-finite or\n // negative value, matching the README \"invalid values fall back to default\".\n const parsed = Number(attr);\n return Number.isFinite(parsed) && parsed >= 0 ? parsed : Infinity;\n }\n\n set timeout(value: number | null | undefined) {\n reflectAttribute(this, \"timeout\", value);\n }\n\n get maximumAge(): number {\n const attr = this.getAttribute(\"maximum-age\");\n if (attr === null || attr.trim() === \"\") return 0;\n // Strict parse via Number() (unlike parseInt, \"10px\" -> NaN, not 10). Fall\n // back to the API default (0 = never use a cached fix) for any non-finite or\n // negative value, matching the README \"invalid values fall back to default\".\n const parsed = Number(attr);\n return Number.isFinite(parsed) && parsed >= 0 ? parsed : 0;\n }\n\n set maximumAge(value: number | null | undefined) {\n reflectAttribute(this, \"maximum-age\", value);\n }\n\n get watch(): boolean {\n return this.hasAttribute(\"watch\");\n }\n\n set watch(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"watch\", value);\n }\n\n get manual(): boolean {\n return this.hasAttribute(\"manual\");\n }\n\n set manual(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"manual\", value);\n }\n\n // --- Core delegated getters ---\n\n get position(): WcsGeoPositionDetail | null {\n return this._core.position;\n }\n\n get latitude(): number | null {\n return this._core.latitude;\n }\n\n get longitude(): number | null {\n return this._core.longitude;\n }\n\n get accuracy(): number | null {\n return this._core.accuracy;\n }\n\n get coords(): WcsGeoCoords | null {\n return this._core.coords;\n }\n\n get timestamp(): number | null {\n return this._core.timestamp;\n }\n\n get watching(): boolean {\n return this._core.watching;\n }\n\n get loading(): boolean {\n return this._core.loading;\n }\n\n get error(): WcsGeoErrorDetail | null {\n return this._core.error;\n }\n\n get errorInfo(): WcsIoErrorInfo | null {\n return this._core.errorInfo;\n }\n\n get permission(): GeoPermissionState {\n return this._core.permission;\n }\n\n // wc-bindable connectedCallbackPromise protocol: resolves once the connect-time\n // acquisition settles, so SSR (@wcstack/server render.ts) waits for the first\n // fix before snapshotting the HTML. Mirrors Fetch.connectedCallbackPromise. The\n // connect-time decision runs in a microtask (_scheduleLocate), so the promise is\n // armed in connectedCallback and settled there; in `watch` / `manual` modes there\n // is no one-shot connect-time fix to await, so it resolves once the decision ran.\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Command property ---\n\n get trigger(): boolean {\n return this._trigger;\n }\n\n set trigger(value: boolean) {\n // Momentary command-property: a false→true write requests a single fix.\n // Mirrors the trigger flag on <wcs-timer> / <wcs-ws>. Prefer the\n // command-token protocol (`command.getCurrentPosition: $command.locate`) for\n // state-driven acquisition; this exists mainly for the DOM click trigger and\n // simple boolean bindings.\n const v = !!value;\n if (v) {\n this._trigger = true;\n // Fire-and-forget: getCurrentPosition() never rejects (failures surface via\n // the `error` property), so the returned promise is intentionally dropped.\n void this.getCurrentPosition();\n this._trigger = false;\n this.dispatchEvent(new CustomEvent(\"wcs-geo:trigger-changed\", {\n detail: false,\n bubbles: true,\n }));\n }\n }\n\n // --- Commands ---\n\n getCurrentPosition(): Promise<void> {\n return this._core.getCurrentPosition(this._options());\n }\n\n watchPosition(): void {\n this._core.watch(this._options());\n }\n\n clearWatch(): void {\n // 接続時の判断待ちなら、その連続監視を取り消す — 同じタスクの append → clearWatch() で、\n // 後のマイクロタスクが監視を始めないように(判断が同期だった頃は、始めた監視を\n // clearWatch() が止めていた)。一発取得は以前と同じく取り消さない。入れ直せば、次の\n // 判断は watch に従う\n if (this._connectResolve !== null) this._watchCancelled = true;\n this._core.clearWatch();\n }\n\n // --- Internal ---\n\n private _options(): GeoOptions {\n return {\n enableHighAccuracy: this.highAccuracy,\n timeout: this.timeout,\n maximumAge: this.maximumAge,\n };\n }\n\n // --- Lifecycle ---\n\n // 接続時の取得の判断はマイクロタスクで、そのときの manual / watch / high-accuracy /\n // timeout / maximum-age で 1 回だけ行う(timing-and-firing-contract §23)。router は遷移で\n // 同じノードを入れ直し、新しいルートの params から state が入力を書くのはマイクロタスク —\n // その場で取得すると、前の入力で getCurrentPosition / watchPosition を起こしていた\n // (docs/seam-apps.md、shift-desk)。\n private _scheduleLocate(): void {\n if (this._locatePending) return;\n this._locatePending = true;\n queueMicrotask(() => {\n this._locatePending = false;\n const resolveConnect = this._connectResolve;\n this._connectResolve = null;\n // 判断の前に外れた要素は何もしない(disconnectedCallback が解いて null にした)\n if (resolveConnect === null) return;\n const watchCancelled = this._watchCancelled;\n this._watchCancelled = false;\n if (this.manual) {\n resolveConnect();\n } else if (this.watch) {\n // `watch` attribute selects the default phase: continuous monitoring vs a\n // single fix on connect. 判断待ちに clearWatch() が呼ばれていたら始めない\n if (!watchCancelled) this.watchPosition();\n resolveConnect();\n } else {\n // Track only the one-shot connect-time fix so SSR can await it.\n // getCurrentPosition() never rejects (failures surface via `error`), so no\n // .catch() is needed.\n resolveConnect(this.getCurrentPosition());\n }\n });\n }\n\n connectedCallback(): void {\n // upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)\n upgradeProperties(this);\n this.style.display = \"none\";\n if (config.autoTrigger) {\n registerAutoTrigger();\n }\n // Revive permission tracking after a reconnect (reparenting). No-op on the\n // first connect since the constructor already subscribed; only re-subscribes\n // when disconnectedCallback's dispose() tore the subscription down. It reads no\n // input, so it stays here; only the acquisition decision is deferred.\n this._core.reinitPermission();\n // connectedCallbackPromise は接続時の判断(と一発取得)が済むまでを表す。判断は\n // マイクロタスクなので、ここで張って _scheduleLocate で解く\n this._connectedCallbackPromise = new Promise<void>((resolve) => {\n this._connectResolve = resolve;\n });\n this._scheduleLocate();\n }\n\n disconnectedCallback(): void {\n // 判断の前に外れたら、張った connectedCallbackPromise をここで解く — 同じタスクで\n // 入れ直されると次の connectedCallback が張り替えるので、待つ側が取り残されないように\n this._connectResolve?.();\n this._connectResolve = null;\n this._watchCancelled = false;\n this._core.clearWatch();\n this._core.dispose();\n }\n}\n","import { WcsGeolocation } from \"./components/Geolocation.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.geo)) {\n registry.define(config.tagNames.geo, WcsGeolocation);\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapGeolocation(userConfig?: IWritableConfig, registry?: CustomElementRegistry): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents(registry);\n}\n"],"names":[],"mappings":"AAUA,MAAM,OAAO,GAAoB;AAC/B,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,gBAAgB,EAAE,gBAAgB;AAClC,IAAA,QAAQ,EAAE;AACR,QAAA,GAAG,EAAE,SAAS;AACf,KAAA;CACF;AAED,SAAS,UAAU,CAAI,GAAM,EAAA;AAC3B,IAAA,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;AAAE,QAAA,OAAO,GAAG;AACvD,IAAA,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;IAClB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;AAClC,QAAA,UAAU,CAAE,GAA+B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AAA,IAAI,CAAC,eAAe,GAAG,KAAK;AAC5B,QAAA,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;AACvB,QAAA,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;IACtB;;;AClVF;;;;AAIG;AACG,SAAU,kBAAkB,CAAC,QAAA,GAAkC,cAAc,EAAA;AACjF,IAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACtC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;IACtD;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/platformCapability.ts","../../src/core/geolocationCapabilities.ts","../../src/core/GeolocationCore.ts","../../src/autoTrigger.ts","../../src/protocol/upgradeProperties.ts","../../src/protocol/inputAttribute.ts","../../src/components/Geolocation.ts","../../src/protocol/defineElement.ts","../../src/registerComponents.ts","../../src/bootstrapGeolocation.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n autoTrigger: boolean;\n triggerAttribute: string;\n tagNames: {\n geo: string;\n };\n}\n\nconst _config: IInternalConfig = {\n autoTrigger: true,\n triggerAttribute: \"data-geotarget\",\n tagNames: {\n geo: \"wcs-geo\",\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: `bootstrapGeolocation` refuses it. */\nfunction invalid(key: string): never {\n throw new Error(`[@wcstack/geolocation] bootstrapGeolocation: \"${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 [key, value] of given) {\n if (key !== \"tagNames\") {\n options[key] = value;\n }\n }\n for (const [name, tag] of givenTags) tags[name] = tag as string;\n frozenConfig = null;\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /io-core/platform-capability.ts by scripts/sync-io-core.mjs.\n// Run `node scripts/sync-io-core.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * platform-capability.ts\n *\n * Phase 6(docs/architecture-hardening/09-remediation-design.md §7.2 /\n * 07-browser-capability-variance.md)の browser capability 判定と error taxonomy の\n * 汎用プリミティブ。node 固有の capability registry / error code は各パッケージが\n * 別ファイルで宣言し、この汎用層(型 + assess 機構)を import する。\n *\n * 原則:\n * - feature detection は境界(利用直前)で行う。module 評価時に browser global を\n * 参照しない(SSR / worker で import が失敗しない)。\n * - capability ID(`web.fetch` 等)は文字列を global property path として eval せず、\n * registry が ID ごとに副作用のない presence probe を対応付ける。\n * - availability / permission / readiness / activity / operation error を 1 つの\n * `ready / unsupported / error` enum に畳まない。required 欠如は開始しない、\n * optional 欠如は宣言済み fallback で readiness を `degraded` にする。\n *\n * 配置: 本ファイルは /io-core/ の単一正典であり、scripts/sync-io-core.mjs が\n * 各 IO ノードの src/core/ へ生成コピー (AUTO-GENERATED, 編集禁止) を配布する。\n * `protocol/wcBindable.ts` と同じ copy-distribution 方式で、ランタイム依存を導入せず\n * 各パッケージのバンドルへ inline される (zero-runtime-dep / 自己完結 CDN を維持)。\n * 編集はこの正典に対して行い、`node scripts/sync-io-core.mjs` で再配布する。\n *\n * pure(module 評価時に browser global 非参照)。\n */\n\nexport type Availability = \"available\" | \"missing\" | \"unknown\";\nexport type PermissionState = \"granted\" | \"denied\" | \"prompt\" | \"not-applicable\" | \"unknown\";\nexport type Readiness = \"idle\" | \"ready\" | \"degraded\";\nexport type Activity = \"inactive\" | \"active\";\nexport type PreconditionState = \"satisfied\" | \"required\" | \"not-applicable\";\n\n/** operation error の phase(taxonomy)。 */\nexport type WcsIoErrorPhase = \"probe\" | \"start\" | \"execute\" | \"decode\" | \"commit\" | \"dispose\";\n\n/** serializable な error info(non-cloneable な cause とは分離。DevTools / remote へは info のみ)。 */\nexport interface WcsIoErrorInfo {\n readonly code: string;\n readonly phase: WcsIoErrorPhase;\n readonly recoverable: boolean;\n readonly capabilityId?: string;\n readonly message: string;\n}\n\nexport interface PlatformAssessment {\n readonly availability: ReadonlyMap<string, Availability>;\n readonly permission: PermissionState;\n readonly readiness: Readiness;\n readonly activity: Activity;\n readonly preconditions: {\n readonly secureContext: PreconditionState;\n readonly userActivation: PreconditionState;\n };\n readonly epoch: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\n/** capability 1 件の仕様。probe は副作用なく presence を返す(利用直前に呼ぶ)。 */\nexport interface CapabilitySpec {\n readonly probe: () => boolean;\n readonly requiresSecureContext?: boolean;\n readonly requiresUserActivation?: boolean;\n /** browser compatibility dataset のキー(任意・診断用)。 */\n readonly compatKey?: string;\n}\n\nexport type CapabilityRegistry = ReadonlyMap<string, CapabilitySpec>;\n\nexport interface AssessOptions {\n readonly required: readonly string[];\n readonly optional?: readonly string[];\n readonly permission?: PermissionState;\n readonly activity?: Activity;\n readonly epoch?: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\nfunction isSecureContext(): boolean {\n return (globalThis as { isSecureContext?: unknown }).isSecureContext === true;\n}\n\n/**\n * capability を利用直前に評価して PlatformAssessment を作る。\n * required が 1 つでも欠ければ readiness は \"idle\"(開始不可)、\n * required 揃い + optional 欠けは \"degraded\"、全揃いは \"ready\"。\n */\nexport function assessCapabilities(registry: CapabilityRegistry, options: AssessOptions): PlatformAssessment {\n const availability = new Map<string, Availability>();\n const evaluate = (id: string): Availability => {\n const spec = registry.get(id);\n if (spec === undefined) return \"unknown\";\n return spec.probe() ? \"available\" : \"missing\";\n };\n\n let requiredAllAvailable = true;\n for (const id of options.required) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") requiredAllAvailable = false;\n }\n let optionalAllAvailable = true;\n for (const id of options.optional ?? []) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") optionalAllAvailable = false;\n }\n\n const readiness: Readiness = !requiredAllAvailable ? \"idle\" : (optionalAllAvailable ? \"ready\" : \"degraded\");\n\n // preconditions: 対象 capability のいずれかが要求する場合だけ評価する。\n const allIds = [...options.required, ...(options.optional ?? [])];\n const needsSecure = allIds.some((id) => registry.get(id)?.requiresSecureContext === true);\n const needsActivation = allIds.some((id) => registry.get(id)?.requiresUserActivation === true);\n const secureContext: PreconditionState = needsSecure ? (isSecureContext() ? \"satisfied\" : \"required\") : \"not-applicable\";\n const userActivation: PreconditionState = needsActivation ? \"required\" : \"not-applicable\";\n\n return {\n availability,\n permission: options.permission ?? \"not-applicable\",\n readiness,\n activity: options.activity ?? \"inactive\",\n preconditions: { secureContext, userActivation },\n epoch: options.epoch ?? 0,\n lastError: options.lastError,\n };\n}\n\n/** availability から「required がすべて available か」を判定するヘルパ(supported の最低条件)。 */\nexport function requiredCapabilitiesAvailable(assessment: PlatformAssessment, required: readonly string[]): boolean {\n return required.every((id) => assessment.availability.get(id) === \"available\");\n}\n\n/**\n * このページで機能が使えない理由(使える、または分からないなら null)。利用直前に読む。\n *\n * - `\"insecure-context\"`: 安全なコンテキストではない(`isSecureContext === false`)。\n * Permissions API が扱う機能はどれも安全なコンテキストを要る。\n * - `\"policy-blocked\"`: Permissions-Policy(サーバーのヘッダ、または `allow` の無い\n * `<iframe>`)がその機能を切っている。\n *\n * どちらも Permissions API は教えない: Chromium はポリシーで切られた文書でも\n * `granted` を、安全でない origin では `denied` を返す。利用者の拒否と区別するため、\n * 見張り役(`<wcs-permission>`)も取りに行く側も `unsupported` を報告する\n * (docs/v4-direction-2026-10.md の決定、state-field-report)。\n * `isSecureContext` が無い環境(SSR・テスト)は判断しない。\n */\nexport type FeatureUnavailableReason = \"insecure-context\" | \"policy-blocked\";\n\n/** Permissions-Policy が制御する機能(permission 名と同じ文字列)。 */\nconst POLICY_CONTROLLED = new Set([\n \"camera\", \"microphone\", \"geolocation\", \"midi\", \"clipboard-read\", \"clipboard-write\",\n \"screen-wake-lock\", \"idle-detection\", \"accelerometer\", \"gyroscope\", \"magnetometer\",\n \"ambient-light-sensor\", \"display-capture\",\n]);\n\ninterface PolicyLike { allowsFeature(feature: string): boolean }\n\nexport function featureUnavailable(feature: string): FeatureUnavailableReason | null {\n const g = globalThis as { isSecureContext?: unknown; document?: { permissionsPolicy?: PolicyLike; featurePolicy?: PolicyLike } };\n if (g.isSecureContext === false) return \"insecure-context\";\n if (!POLICY_CONTROLLED.has(feature)) return null;\n const policy = g.document?.permissionsPolicy ?? g.document?.featurePolicy;\n if (policy === undefined || typeof policy.allowsFeature !== \"function\") return null;\n try {\n return policy.allowsFeature(feature) ? null : \"policy-blocked\";\n } catch {\n return null;\n }\n}\n\n/** `featureUnavailable` の理由を、作者が直し方を読める文にする。`what` は文頭(「The camera」など)。 */\nexport function featureUnavailableMessage(what: string, feature: string, reason: FeatureUnavailableReason): string {\n return reason === \"insecure-context\"\n ? `${what} needs a secure context (https:, or http://localhost), and this page is not one.`\n : `${what} is turned off for this page by a Permissions-Policy: the server's Permissions-Policy header, ` +\n `or an <iframe> without allow=\"${feature}\". The browser's site settings cannot change that.`;\n}\n","/**\n * geolocationCapabilities.ts\n *\n * Geolocation node 固有の error code(taxonomy)と derivation。汎用の error info 型は\n * `./platformCapability.js`(/io-core/ から copy-distribution される生成ファイル)から\n * import する。geolocation は concurrent-independent(競合しない)ため lane は持たず、\n * error taxonomy(errorInfo)のみを採用する。\n */\n\nimport type { WcsIoErrorInfo } from \"./platformCapability.js\";\n\n/** 安定した geolocation error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_GEO_ERROR_CODE = {\n PermissionDenied: \"permission-denied\",\n PositionUnavailable: \"position-unavailable\",\n Timeout: \"timeout\",\n // このページで使えない(API 不在・安全でない origin・Permissions-Policy)。利用者の拒否\n // (permission-denied)と区別する — サイトの設定では直らない。\n CapabilityMissing: \"capability-missing\",\n} as const;\n\n/**\n * 正規化済み `GeolocationPositionError`(spec code 1/2/3)を serializable な error\n * taxonomy に写す。\"unexpected\" は code 2(position-unavailable)に畳むため、これは既存の\n * `error.code` を忠実にミラーする。permission-denied(1)だけは retry で回復しないため\n * recoverable=false。`unsupported`(このページで使えない — Core は `error.code` を 2 にする)\n * は capability-missing / probe / recoverable=false。\n */\nexport function deriveGeoErrorInfo(code: number, message: string, unsupported = false): WcsIoErrorInfo {\n if (unsupported) {\n return { code: WCS_GEO_ERROR_CODE.CapabilityMissing, phase: \"probe\", recoverable: false, message };\n }\n const taxonomyCode = code === 1\n ? WCS_GEO_ERROR_CODE.PermissionDenied\n : code === 3\n ? WCS_GEO_ERROR_CODE.Timeout\n : WCS_GEO_ERROR_CODE.PositionUnavailable;\n return { code: taxonomyCode, phase: \"execute\", recoverable: code !== 1, message };\n}\n","import {\n IWcBindable, GeoOptions, GeoPermissionState,\n WcsGeoPositionDetail, WcsGeoCoords, WcsGeoErrorDetail,\n} from \"../types.js\";\nimport { WcsIoErrorInfo, featureUnavailable, featureUnavailableMessage } from \"./platformCapability.js\";\nimport { deriveGeoErrorInfo } from \"./geolocationCapabilities.js\";\n\n/**\n * Headless geolocation primitive. A thin, framework-agnostic wrapper around the\n * Geolocation API exposed through the wc-bindable protocol.\n *\n * It has two phases, mirroring the two distinct shapes of the underlying API:\n * - **one-shot** — `getCurrentPosition()` resolves a single fix (like FetchCore's\n * one-shot `fetch()`), toggling `loading` around the async call.\n * - **continuous** — `watch()` / `clearWatch()` stream fixes (like TimerCore's\n * `start()` / `stop()`), toggling the `watching` flag.\n *\n * Every successful fix is published via the single `wcs-geo:position` event;\n * `latitude` / `longitude` / `accuracy` / `coords` / `timestamp` are read from\n * it through getters (mirroring how TimerCore exposes count/elapsed from one\n * `wcs-timer:tick` event), so an observer that binds any of them is notified on\n * every fix.\n *\n * Geolocation also has a permission gate absent from timer/websocket: the\n * `permission` property reflects `navigator.permissions.query({name:\n * \"geolocation\"})` (`prompt` / `granted` / `denied`, or `unsupported`) and\n * tracks its live `change` event. It is a read-only sensor — there is no\n * element-bound \"send\" path; element → state only.\n */\nexport class GeolocationCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"position\", event: \"wcs-geo:position\", semantics: \"state\" },\n { name: \"latitude\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.latitude },\n { name: \"longitude\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.longitude },\n { name: \"accuracy\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.accuracy },\n { name: \"coords\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.coords },\n { name: \"timestamp\", event: \"wcs-geo:position\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.timestamp },\n { name: \"watching\", event: \"wcs-geo:watching-changed\", semantics: \"state\" },\n { name: \"loading\", event: \"wcs-geo:loading-changed\", semantics: \"state\" },\n { name: \"error\", event: \"wcs-geo:error\", semantics: \"state\" },\n { name: \"permission\", event: \"wcs-geo:permission-changed\", semantics: \"state\" },\n // Serializable failure taxonomy (stable code / phase / recoverable), or null.\n // Additive bindable output derived from the normalized `error` (spec code\n // 1/2/3 → permission-denied / position-unavailable / timeout); the existing\n // `error` property/event are unchanged. Fires `wcs-geo:error-info-changed`.\n { name: \"errorInfo\", event: \"wcs-geo:error-info-changed\", semantics: \"state\" },\n ],\n commands: [\n { name: \"getCurrentPosition\", async: true },\n { name: \"watch\" },\n { name: \"clearWatch\" },\n ],\n };\n\n private _target: EventTarget;\n private _watchId: number | null = null;\n\n private _position: WcsGeoPositionDetail | null = null;\n private _watching: boolean = false;\n private _loading: boolean = false;\n private _error: WcsGeoErrorDetail | null = null;\n private _errorInfo: WcsIoErrorInfo | null = null;\n // the errors that say this page cannot use geolocation (errorInfo: capability-missing)\n private _unsupportedErrors = new WeakSet<WcsGeoErrorDetail>();\n private _permission: GeoPermissionState = \"prompt\";\n\n // Live PermissionStatus handle (when the Permissions API is available), kept\n // so the `change` listener can be removed on dispose().\n private _permissionStatus: PermissionStatus | null = null;\n\n // True once a permission subscription has been (or is being) established, and\n // reset by dispose(). Guards reinitPermission() so the first connect after\n // construction does not double-subscribe, while a reconnect after dispose()\n // does re-subscribe.\n private _permissionSubscribed: boolean = false;\n\n // Monotonic id of the current permission query. Bumped by every _initPermission()\n // and by dispose(). Each in-flight query captures its id and, on resolve, bails\n // unless it is still current — so a query superseded by a rapid (synchronous)\n // disconnect→reconnect, or one that resolves after dispose(), never attaches a\n // listener. A plain boolean cannot cover this: dispose()→reinit() flips it\n // false→true again, reopening the window for the stale query to slip through.\n private _permGen: number = 0;\n\n // Monotonic id of the current acquisition lifecycle, bumped only by dispose().\n // Each getCurrentPosition() captures it at start; the async success/error\n // callback bails (no setters, no resolve-side effects) if it is stale, so a\n // one-shot fix that resolves after the element was disconnected does not\n // dispatch wcs-geo:* on a torn-down element. Unlike FetchCore, the Geolocation\n // API has no AbortController, so a generation guard is the only way to neutralize\n // an in-flight one-shot. (watch is already stopped by clearWatch on disconnect.)\n private _acqGen: number = 0;\n\n // Monotonic id of the current watch lifecycle, bumped by watch(), clearWatch(),\n // and dispose(). Each watch() captures it; both watch callbacks bail if it is\n // stale. Unlike a live `_watchId === null` check, this distinguishes the current\n // watch from a superseded one: a clearWatch()→watch() restart installs a new\n // watchId (non-null), so a queued callback from the previous watch would pass a\n // null-check but fails the generation compare. (The README recommends exactly\n // this restart sequence to reconfigure a watch.)\n private _watchGen: number = 0;\n\n // Resolves once the most recent permission probe settles (or immediately when\n // the Permissions API is unsupported). The Shell exposes this as\n // connectedCallbackPromise so SSR can await the first probe before snapshotting\n // the HTML. Mirrors PermissionCore._ready.\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n // Probe the permission state up front so observers see the real value\n // (granted/denied/prompt) before the first read, then keep it live.\n this._ready = this._initPermission();\n }\n\n get position(): WcsGeoPositionDetail | null {\n return this._position;\n }\n\n get latitude(): number | null {\n return this._position ? this._position.latitude : null;\n }\n\n get longitude(): number | null {\n return this._position ? this._position.longitude : null;\n }\n\n get accuracy(): number | null {\n return this._position ? this._position.accuracy : null;\n }\n\n get coords(): WcsGeoCoords | null {\n return this._position ? this._position.coords : null;\n }\n\n get timestamp(): number | null {\n return this._position ? this._position.timestamp : null;\n }\n\n get watching(): boolean {\n return this._watching;\n }\n\n get loading(): boolean {\n return this._loading;\n }\n\n get error(): WcsGeoErrorDetail | null {\n return this._error;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable`), or null. Exposed as an additive wc-bindable property (event\n * `wcs-geo:error-info-changed`), derived from the normalized `error`; the\n * existing `error` property/event are unchanged.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n get permission(): GeoPermissionState {\n return this._permission;\n }\n\n /** Resolves once the first (or most recent) permission probe settles (§3.8). */\n get ready(): Promise<void> {\n return this._ready;\n }\n\n // --- State setters with event dispatch ---\n\n private _setPosition(position: WcsGeoPositionDetail): void {\n this._position = position;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:position\", {\n detail: position,\n bubbles: true,\n }));\n }\n\n private _setWatching(watching: boolean): void {\n if (this._watching === watching) return;\n this._watching = watching;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:watching-changed\", {\n detail: watching,\n bubbles: true,\n }));\n }\n\n private _setLoading(loading: boolean): void {\n if (this._loading === loading) return;\n this._loading = loading;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:loading-changed\", {\n detail: loading,\n bubbles: true,\n }));\n }\n\n private _setError(error: WcsGeoErrorDetail | null): void {\n // Same-value guard, like the other setters. Unlike `position` (which has\n // derived getters and so must re-fire even on an identical reference), `error`\n // has no derived state — so suppressing redundant null→null dispatches (e.g.\n // a successful fix clearing an already-null error) avoids spurious events.\n if (this._error === error) return;\n this._error = error;\n // Keep the additive `errorInfo` taxonomy in sync with `error`: derive it from\n // the normalized error (or null on clear). Fires before the `error` event so an\n // observer binding both sees the classification first, mirroring the io-node\n // family. No lane here — geolocation's fixes don't compete (dispose-only guard).\n this._commitErrorInfo(error === null ? null : deriveGeoErrorInfo(error.code, error.message, this._unsupportedErrors.has(error)));\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n // Called only from _setError (which already same-value-guards on the error\n // reference), so errorInfo transitions exactly when error does — no separate\n // guard needed here.\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:error-info-changed\", {\n detail: info,\n bubbles: true,\n }));\n }\n\n private _setPermission(permission: GeoPermissionState): void {\n if (this._permission === permission) return;\n this._permission = permission;\n this._target.dispatchEvent(new CustomEvent(\"wcs-geo:permission-changed\", {\n detail: permission,\n bubbles: true,\n }));\n }\n\n // --- Public API ---\n\n /**\n * Acquire a single position fix. Resolves once the fix arrives or the request\n * fails — never rejects: failures are surfaced through the `error` property so\n * they flow into the declarative state, symmetrical with FetchCore.\n */\n getCurrentPosition(options: GeoOptions = {}): Promise<void> {\n return new Promise<void>((resolve) => {\n if (!this._hasGeolocation()) {\n this._setError(this._unsupportedError());\n resolve();\n return;\n }\n\n const gen = this._acqGen;\n this._setLoading(true);\n this._setError(null);\n navigator.geolocation.getCurrentPosition(\n (pos) => {\n // Stale: the element was disposed (disconnected) while this fix was in\n // flight. Drop it so a torn-down element never dispatches wcs-geo:*.\n // Still resolve() so any awaiter (e.g. connectedCallbackPromise) settles.\n if (gen !== this._acqGen) {\n resolve();\n return;\n }\n // Guard normalization/dispatch so a throw never escapes this browser\n // callback as an unhandled rejection, leaves the promise pending (which\n // would hang SSR's connectedCallbackPromise), or leaves `loading` stuck\n // true. Loading is cleared first so it holds even if a later step throws.\n try {\n this._setLoading(false);\n this._setPosition(this._normalizePosition(pos));\n } catch {\n // Surface the unexpected failure as an error so observers are not left\n // silently stale, then resolve below.\n this._setError(this._unexpectedError());\n }\n resolve();\n },\n (err) => {\n if (gen !== this._acqGen) {\n resolve();\n return;\n }\n try {\n this._setLoading(false);\n this._setError(this._normalizeError(err));\n } catch {\n this._setError(this._unexpectedError());\n }\n resolve();\n },\n options,\n );\n });\n }\n\n /**\n * Begin continuously watching the position. Idempotent while already\n * watching: a redundant watch() must not register a second `watchPosition`\n * (which would leak the handle and double the fix rate). Reconfiguring is done\n * via clearWatch() + watch().\n */\n watch(options: GeoOptions = {}): void {\n if (!this._hasGeolocation()) {\n this._setError(this._unsupportedError());\n return;\n }\n if (this._watching) return;\n\n this._setError(null);\n this._setWatching(true);\n // Open a new watch generation so any queued callback from a prior watch\n // (cleared then restarted) is recognized as stale below.\n const wgen = ++this._watchGen;\n this._watchId = navigator.geolocation.watchPosition(\n (pos) => {\n // Stale: this callback belongs to a watch that was cleared (or the element\n // disposed), possibly already superseded by a restart. A live\n // `_watchId === null` check cannot catch the restart case (the new watch\n // re-populates _watchId), so compare the captured generation instead.\n if (wgen !== this._watchGen) return;\n // Guard normalization/dispatch so an unexpected throw never escapes this\n // browser callback as an unhandled rejection — symmetric with the one-shot\n // path.\n try {\n // A recovered fix clears any prior transient error (e.g. a one-off\n // TIMEOUT) so `error` reflects the current state, not a stale failure.\n // The _setError same-value guard makes this free when error is already\n // null.\n this._setError(null);\n this._setPosition(this._normalizePosition(pos));\n } catch {\n this._setError(this._unexpectedError());\n }\n },\n (err) => {\n if (wgen !== this._watchGen) return;\n // An error does not implicitly release the watch — the watchId stays\n // valid and clearWatch() remains the teardown path — so `watching` is\n // left true to reflect \"watch still registered\". A terminal error (e.g.\n // PERMISSION_DENIED) is surfaced via the `error` property; callers that\n // want to stop on error can call clearWatch() in response.\n try {\n this._setError(this._normalizeError(err));\n } catch {\n this._setError(this._unexpectedError());\n }\n },\n options,\n );\n }\n\n clearWatch(): void {\n if (this._watchId !== null) {\n navigator.geolocation.clearWatch(this._watchId);\n this._watchId = null;\n }\n // Invalidate the current watch generation so any callback the browser may\n // still deliver after teardown bails.\n this._watchGen++;\n this._setWatching(false);\n }\n\n /**\n * Establish permission monitoring (§3.5). Idempotent: a no-op while a\n * subscription is already live (so the first connect after construction does\n * not double-subscribe), and re-subscribes after a dispose() — e.g. the Shell\n * element was disconnected and then reconnected (reparented). Returns the\n * `ready` promise, which resolves once the (re)established probe settles, so\n * the Shell can expose it as connectedCallbackPromise for SSR. Position\n * acquisition (one-shot / watch) is command-driven and the Shell drives it\n * separately from connectedCallback.\n */\n observe(): Promise<void> {\n if (!this._permissionSubscribed) {\n this._ready = this._initPermission();\n }\n return this._ready;\n }\n\n /**\n * Re-establish the permission `change` subscription after a dispose() — e.g.\n * the Shell element was disconnected and then reconnected (reparented). No-op\n * while a subscription is already live, so the first connect after\n * construction does not double-subscribe. This keeps permission tracking\n * symmetric with position acquisition, which the Shell also revives on\n * reconnect.\n *\n * Retained as a thin alias of observe() for the Shell's existing reconnect\n * path; observe() is the canonical §3.5 lifecycle entry point.\n */\n reinitPermission(): void {\n void this.observe();\n }\n\n /**\n * Detach the live permission `change` listener. Call from the Shell's\n * `disconnectedCallback` so a removed element does not leak the subscription.\n * A later reconnect can re-subscribe via reinitPermission().\n */\n dispose(): void {\n this._permissionSubscribed = false;\n // Invalidate any in-flight query so its .then() bails instead of attaching a\n // listener after teardown.\n this._permGen++;\n // Invalidate any in-flight one-shot acquisition so its success/error callback\n // bails instead of dispatching on a disconnected element.\n this._acqGen++;\n // Likewise invalidate the watch generation. The Shell already calls\n // clearWatch() before dispose(), but a direct headless dispose() (without a\n // preceding clearWatch) still neutralizes any queued watch callback.\n this._watchGen++;\n // Clear loading, with its event (timing-and-firing-contract §22): the bailed\n // callback above will not clear it, and a route the element leaves keeps its\n // nodes — bindings included — for the next entry, so a reset nobody heard would\n // leave the page showing an acquisition that is gone. Clearing it also keeps the\n // loading=true edge of the next acquisition after a reconnect.\n this._setLoading(false);\n if (this._permissionStatus) {\n this._permissionStatus.removeEventListener(\"change\", this._onPermissionChange);\n this._permissionStatus = null;\n }\n }\n\n // --- Internal ---\n\n private _hasGeolocation(): boolean {\n return typeof navigator !== \"undefined\" && !!navigator.geolocation && featureUnavailable(\"geolocation\") === null;\n }\n\n private _initPermission(): Promise<void> {\n // A page that cannot use geolocation (not a secure context, or turned off by a\n // Permissions-Policy) is \"unsupported\": the Permissions API answers \"granted\" in a\n // policy-blocked frame and \"denied\" on an insecure origin — a user's refusal, which\n // the site settings would fix and these cannot. Neither changes while the page lives.\n if (featureUnavailable(\"geolocation\") !== null) {\n this._setPermission(\"unsupported\");\n return Promise.resolve();\n }\n // The Permissions API is optional. When absent (or it rejects, e.g. some\n // browsers don't accept the \"geolocation\" name), report \"unsupported\" and\n // leave acquisition to fail loudly via the error property if attempted.\n if (typeof navigator === \"undefined\" || !navigator.permissions || typeof navigator.permissions.query !== \"function\") {\n // Route through _setPermission (not a bare assignment) so observers stay in\n // sync with the public state. The same-value guard means no redundant\n // dispatch when the state does not actually change; it does mean a\n // previously-observed \"granted\"/\"denied\" being reinit'd into an environment\n // that lost the Permissions API now correctly notifies observers of the\n // unsupported transition instead of silently overwriting the shadow value.\n this._setPermission(\"unsupported\");\n // No asynchronous probe to await: readiness is immediate.\n return Promise.resolve();\n }\n this._permissionSubscribed = true;\n const gen = ++this._permGen;\n return navigator.permissions.query({ name: \"geolocation\" as PermissionName }).then(\n (status) => {\n // Stale resolution: this query was superseded (rapid reconnect) or the\n // element was disposed while it was in flight. Drop it so only the current\n // subscription attaches a listener.\n if (gen !== this._permGen) return;\n this._permissionStatus = status;\n this._setPermission(status.state as GeoPermissionState);\n status.addEventListener(\"change\", this._onPermissionChange);\n },\n () => {\n if (gen !== this._permGen) return;\n this._setPermission(\"unsupported\");\n },\n );\n }\n\n private _onPermissionChange = (event: Event): void => {\n const status = event.target as PermissionStatus;\n this._setPermission(status.state as GeoPermissionState);\n };\n\n private _normalizePosition(pos: GeolocationPosition): WcsGeoPositionDetail {\n const c = pos.coords;\n const coords: WcsGeoCoords = {\n latitude: c.latitude,\n longitude: c.longitude,\n accuracy: c.accuracy,\n altitude: c.altitude,\n altitudeAccuracy: c.altitudeAccuracy,\n heading: c.heading,\n speed: c.speed,\n };\n return { ...coords, timestamp: pos.timestamp, coords };\n }\n\n private _normalizeError(err: GeolocationPositionError): WcsGeoErrorDetail {\n return { code: err.code, message: err.message };\n }\n\n private _unsupportedError(): WcsGeoErrorDetail {\n // Geolocation API absent, or not available to this page: surface it as\n // POSITION_UNAVAILABLE (2) so consumers that switch on the spec error codes treat\n // it like any other unavailable fix; errorInfo says capability-missing.\n const reason = featureUnavailable(\"geolocation\");\n const error: WcsGeoErrorDetail = {\n code: 2,\n message: reason === null\n ? \"Geolocation API is not available in this environment.\"\n : featureUnavailableMessage(\"Geolocation\", \"geolocation\", reason),\n };\n this._unsupportedErrors.add(error);\n return error;\n }\n\n private _unexpectedError(): WcsGeoErrorDetail {\n // An unexpected throw while normalizing/dispatching a fix. Surface it as\n // POSITION_UNAVAILABLE (2) so it flows into `error` like any other failure\n // instead of escaping the browser callback as an unhandled rejection.\n return { code: 2, message: \"Unexpected error while processing the position fix.\" };\n }\n}\n","import { config } from \"./config.js\";\nimport type { WcsGeolocation } from \"./components/Geolocation.js\";\n\nlet registered = false;\n\nfunction handleClick(event: Event): void {\n const target = event.target;\n if (!(target instanceof Element)) return;\n\n const triggerElement = target.closest<Element>(`[${config.triggerAttribute}]`);\n if (!triggerElement) return;\n\n const geoId = triggerElement.getAttribute(config.triggerAttribute);\n if (!geoId) return;\n\n // Resolve the registered constructor at call time instead of importing\n // Geolocation as a value. The value import created a components/Geolocation.ts\n // ⇄ autoTrigger.ts cycle (Geolocation.connectedCallback() calls\n // registerAutoTrigger()). instanceof against the customElements registry keeps\n // the exact same identity guarantee — only the registered <wcs-geo> class\n // matches — without the import cycle.\n const GeoCtor = customElements.get(config.tagNames.geo);\n const geoElement = document.getElementById(geoId);\n if (!GeoCtor || !(geoElement instanceof GeoCtor)) return;\n\n // Suppress the element's default action so a fix can be requested without\n // navigating. Intentional: do not attach data-geotarget to an element whose\n // default action you also want (real <a href> link, form-submit button) — it\n // will be cancelled. See README \"Optional DOM Triggering\".\n event.preventDefault();\n (geoElement as WcsGeolocation).getCurrentPosition();\n}\n\nexport function registerAutoTrigger(): void {\n if (registered) return;\n registered = true;\n document.addEventListener(\"click\", handleClick);\n}\n\nexport function unregisterAutoTrigger(): void {\n if (!registered) return;\n registered = false;\n document.removeEventListener(\"click\", handleClick);\n}\n","// ===========================================================================\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 { config } from \"../config.js\";\nimport { IWcBindable, GeoOptions, GeoPermissionState, WcsGeoPositionDetail, WcsGeoCoords, WcsGeoErrorDetail } from \"../types.js\";\nimport { GeolocationCore } from \"../core/GeolocationCore.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\nimport { registerAutoTrigger } from \"../autoTrigger.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.js\";\nimport { reflectAttribute, reflectBooleanAttribute } from \"../protocol/inputAttribute.js\";\n\n// Named WcsGeolocation (not `Geolocation`) so the class does not shadow the\n// global DOM `Geolocation` interface (the type of `navigator.geolocation`), and\n// to match the <wcs-ws> convention (WcsWebSocket). The public export keeps the\n// `WcsGeolocation` name unchanged, so this rename is non-breaking.\nexport class WcsGeolocation extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n static wcBindable: IWcBindable = {\n ...GeolocationCore.wcBindable,\n properties: [\n ...GeolocationCore.wcBindable.properties,\n { name: \"trigger\", event: \"wcs-geo:trigger-changed\", semantics: \"state\" },\n ],\n // Shell-level settable surface. Each input carries its mirrored `attribute`\n // hint (boolean flags reflect idempotently, so a binding system that writes\n // through inputs[].attribute is safe), following the <wcs-ws> convention.\n // `trigger` has no attribute — it is a momentary command-property, not a\n // declarative attribute. The `getCurrentPosition` / `watchPosition` /\n // `clearWatch` commands are declared below.\n inputs: [\n { name: \"highAccuracy\", attribute: \"high-accuracy\" },\n { name: \"timeout\", attribute: \"timeout\" },\n { name: \"maximumAge\", attribute: \"maximum-age\" },\n { name: \"watch\", attribute: \"watch\" },\n { name: \"manual\", attribute: \"manual\" },\n { name: \"trigger\" },\n ],\n // The Core's `watch` command is renamed to `watchPosition` on the Shell so it\n // does not collide with the `watch` boolean attribute accessor (same pattern\n // as <wcs-ws>, where the `send` command becomes `sendMessage` to free the\n // `send` setter). `getCurrentPosition` / `clearWatch` are unchanged.\n commands: [\n { name: \"getCurrentPosition\", async: true },\n { name: \"watchPosition\" },\n { name: \"clearWatch\" },\n ],\n };\n\n private _core: GeolocationCore;\n private _trigger: boolean = false;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n // connectedCallback が張った connectedCallbackPromise を解く関数。接続時の判断を下す\n // _scheduleLocate のマイクロタスクが(その前に外れたときは disconnectedCallback が)呼ぶ。\n private _connectResolve: ((value: void | PromiseLike<void>) => void) | null = null;\n // _scheduleLocate のマイクロタスクが待っている間 true\n private _locatePending: boolean = false;\n // 接続時の判断待ちに clearWatch() が呼ばれたら true — その判断は watch でも監視を始めない\n private _watchCancelled: boolean = false;\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new GeolocationCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-geo:watching-changed\": (d) => ({ watching: d === true }),\n \"wcs-geo:loading-changed\": (d) => ({ loading: d === true }),\n \"wcs-geo:error\": (d) => ({ error: d != null }),\n });\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (docs/custom-state-reflection-design.md §3.4): 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, it\n // 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 // Input setters never let setAttribute stringify null / undefined (an\n // \"undefined\" timeout would silently fall back to Infinity): `null` removes the\n // attribute (the default), `undefined` restores the attribute the element\n // started with (wc-bindable producer guidance P1; React 19 and a direct\n // assignment deliver it, @wcstack/state does not).\n\n get highAccuracy(): boolean {\n return this.hasAttribute(\"high-accuracy\");\n }\n\n set highAccuracy(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"high-accuracy\", value);\n }\n\n get timeout(): number {\n const attr = this.getAttribute(\"timeout\");\n if (attr === null || attr.trim() === \"\") return Infinity;\n // Strict parse via Number() (unlike parseInt, \"10px\" -> NaN, not 10). Fall\n // back to the API default (Infinity = no timeout) for any non-finite or\n // negative value, matching the README \"invalid values fall back to default\".\n const parsed = Number(attr);\n return Number.isFinite(parsed) && parsed >= 0 ? parsed : Infinity;\n }\n\n set timeout(value: number | null | undefined) {\n reflectAttribute(this, \"timeout\", value);\n }\n\n get maximumAge(): number {\n const attr = this.getAttribute(\"maximum-age\");\n if (attr === null || attr.trim() === \"\") return 0;\n // Strict parse via Number() (unlike parseInt, \"10px\" -> NaN, not 10). Fall\n // back to the API default (0 = never use a cached fix) for any non-finite or\n // negative value, matching the README \"invalid values fall back to default\".\n const parsed = Number(attr);\n return Number.isFinite(parsed) && parsed >= 0 ? parsed : 0;\n }\n\n set maximumAge(value: number | null | undefined) {\n reflectAttribute(this, \"maximum-age\", value);\n }\n\n get watch(): boolean {\n return this.hasAttribute(\"watch\");\n }\n\n set watch(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"watch\", value);\n }\n\n get manual(): boolean {\n return this.hasAttribute(\"manual\");\n }\n\n set manual(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"manual\", value);\n }\n\n // --- Core delegated getters ---\n\n get position(): WcsGeoPositionDetail | null {\n return this._core.position;\n }\n\n get latitude(): number | null {\n return this._core.latitude;\n }\n\n get longitude(): number | null {\n return this._core.longitude;\n }\n\n get accuracy(): number | null {\n return this._core.accuracy;\n }\n\n get coords(): WcsGeoCoords | null {\n return this._core.coords;\n }\n\n get timestamp(): number | null {\n return this._core.timestamp;\n }\n\n get watching(): boolean {\n return this._core.watching;\n }\n\n get loading(): boolean {\n return this._core.loading;\n }\n\n get error(): WcsGeoErrorDetail | null {\n return this._core.error;\n }\n\n get errorInfo(): WcsIoErrorInfo | null {\n return this._core.errorInfo;\n }\n\n get permission(): GeoPermissionState {\n return this._core.permission;\n }\n\n // wc-bindable connectedCallbackPromise protocol: resolves once the connect-time\n // acquisition settles, so SSR (@wcstack/server render.ts) waits for the first\n // fix before snapshotting the HTML. Mirrors Fetch.connectedCallbackPromise. The\n // connect-time decision runs in a microtask (_scheduleLocate), so the promise is\n // armed in connectedCallback and settled there; in `watch` / `manual` modes there\n // is no one-shot connect-time fix to await, so it resolves once the decision ran.\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Command property ---\n\n get trigger(): boolean {\n return this._trigger;\n }\n\n set trigger(value: boolean) {\n // Momentary command-property: a false→true write requests a single fix.\n // Mirrors the trigger flag on <wcs-timer> / <wcs-ws>. Prefer the\n // command-token protocol (`command.getCurrentPosition: $command.locate`) for\n // state-driven acquisition; this exists mainly for the DOM click trigger and\n // simple boolean bindings.\n const v = !!value;\n if (v) {\n this._trigger = true;\n // Fire-and-forget: getCurrentPosition() never rejects (failures surface via\n // the `error` property), so the returned promise is intentionally dropped.\n void this.getCurrentPosition();\n this._trigger = false;\n this.dispatchEvent(new CustomEvent(\"wcs-geo:trigger-changed\", {\n detail: false,\n bubbles: true,\n }));\n }\n }\n\n // --- Commands ---\n\n getCurrentPosition(): Promise<void> {\n return this._core.getCurrentPosition(this._options());\n }\n\n watchPosition(): void {\n this._core.watch(this._options());\n }\n\n clearWatch(): void {\n // 接続時の判断待ちなら、その連続監視を取り消す — 同じタスクの append → clearWatch() で、\n // 後のマイクロタスクが監視を始めないように(判断が同期だった頃は、始めた監視を\n // clearWatch() が止めていた)。一発取得は以前と同じく取り消さない。入れ直せば、次の\n // 判断は watch に従う\n if (this._connectResolve !== null) this._watchCancelled = true;\n this._core.clearWatch();\n }\n\n // --- Internal ---\n\n private _options(): GeoOptions {\n return {\n enableHighAccuracy: this.highAccuracy,\n timeout: this.timeout,\n maximumAge: this.maximumAge,\n };\n }\n\n // --- Lifecycle ---\n\n // 接続時の取得の判断はマイクロタスクで、そのときの manual / watch / high-accuracy /\n // timeout / maximum-age で 1 回だけ行う(timing-and-firing-contract §23)。router は遷移で\n // 同じノードを入れ直し、新しいルートの params から state が入力を書くのはマイクロタスク —\n // その場で取得すると、前の入力で getCurrentPosition / watchPosition を起こしていた\n // (docs/seam-apps.md、shift-desk)。\n private _scheduleLocate(): void {\n if (this._locatePending) return;\n this._locatePending = true;\n queueMicrotask(() => {\n this._locatePending = false;\n const resolveConnect = this._connectResolve;\n this._connectResolve = null;\n // 判断の前に外れた要素は何もしない(disconnectedCallback が解いて null にした)\n if (resolveConnect === null) return;\n const watchCancelled = this._watchCancelled;\n this._watchCancelled = false;\n if (this.manual) {\n resolveConnect();\n } else if (this.watch) {\n // `watch` attribute selects the default phase: continuous monitoring vs a\n // single fix on connect. 判断待ちに clearWatch() が呼ばれていたら始めない\n if (!watchCancelled) this.watchPosition();\n resolveConnect();\n } else {\n // Track only the one-shot connect-time fix so SSR can await it.\n // getCurrentPosition() never rejects (failures surface via `error`), so no\n // .catch() is needed.\n resolveConnect(this.getCurrentPosition());\n }\n });\n }\n\n connectedCallback(): void {\n // upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)\n upgradeProperties(this);\n this.style.display = \"none\";\n if (config.autoTrigger) {\n registerAutoTrigger();\n }\n // Revive permission tracking after a reconnect (reparenting). No-op on the\n // first connect since the constructor already subscribed; only re-subscribes\n // when disconnectedCallback's dispose() tore the subscription down. It reads no\n // input, so it stays here; only the acquisition decision is deferred.\n this._core.reinitPermission();\n // connectedCallbackPromise は接続時の判断(と一発取得)が済むまでを表す。判断は\n // マイクロタスクなので、ここで張って _scheduleLocate で解く\n this._connectedCallbackPromise = new Promise<void>((resolve) => {\n this._connectResolve = resolve;\n });\n this._scheduleLocate();\n }\n\n disconnectedCallback(): void {\n // 判断の前に外れたら、張った connectedCallbackPromise をここで解く — 同じタスクで\n // 入れ直されると次の connectedCallback が張り替えるので、待つ側が取り残されないように\n this._connectResolve?.();\n this._connectResolve = null;\n this._watchCancelled = false;\n this._core.clearWatch();\n this._core.dispose();\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/define-element.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * One copy of each package on a page (docs/timing-and-firing-contract.md §24). The first copy the\n * page evaluates defines the tags and a second one does nothing, so a copy that finds its tag defined\n * by another copy of the package — not its class, not a subclass of it, not the same version — warns\n * `[wcs/package-twice]` once per registry, naming both versions. The classes it defines carry\n * `\"<package>@<version>\"` under `Symbol.for(\"wcstack.package\")`; a class without it is named\n * \"another copy of <package> that does not name its version\" (an older copy, or one loaded through\n * an entry that does not stamp).\n */\n\n/** The static a class defined through this helper carries: `\"@wcstack/fetch@<version>\"`. */\nexport const PACKAGE_STAMP: unique symbol = Symbol.for(\"wcstack.package\");\n\ntype Stamped = { [PACKAGE_STAMP]?: string };\n\n/** The registries this copy warned about: one warning per package per registry. */\nconst warned = new WeakSet<CustomElementRegistry>();\n\n/**\n * Marks `cls` as defined by `pkg` (`\"@wcstack/fetch@<version>\"`). A subclass inherits the mark, and\n * `defineProperty` writes it even where a parent's mark is read-only.\n */\nexport function stampPackage(cls: CustomElementConstructor, pkg: string): void {\n Object.defineProperty(cls, PACKAGE_STAMP, { value: pkg, configurable: true });\n}\n\n/**\n * Warns when `tag` is defined as `existing` by another copy of the package `pkg` names: `existing`\n * is neither `own` nor a subclass of it (omit `own` when the copy has no class to compare with), and\n * carries another version or none. Once per registry.\n */\nexport function warnIfAnotherCopy(\n registry: CustomElementRegistry,\n tag: string,\n existing: CustomElementConstructor,\n own: CustomElementConstructor | undefined,\n pkg: string,\n): void {\n if (own !== undefined && (existing === own || existing.prototype instanceof own)) return;\n const theirs = (existing as Stamped)[PACKAGE_STAMP];\n if (theirs === pkg || warned.has(registry)) return;\n warned.add(registry);\n const name = pkg.slice(0, pkg.lastIndexOf(\"@\"));\n console.warn(\n `[${name}] [wcs/package-twice] <${tag}> is already defined by ` +\n `${theirs ?? `another copy of ${name} that does not name its version`}; ` +\n `this copy, ${pkg}, does nothing. Load each package once.`,\n );\n}\n\n/**\n * Defines each `[tag, class]` in `registry` unless the tag is already defined, stamping the class\n * with `pkg` (`\"@wcstack/fetch@<version>\"`). A tag another copy of the package defined first is left\n * as it is, with the warning above.\n */\nexport function defineElements(\n registry: CustomElementRegistry,\n pkg: string,\n definitions: readonly (readonly [tag: string, cls: CustomElementConstructor])[],\n): void {\n for (const [tag, cls] of definitions) {\n const existing = registry.get(tag);\n if (existing === undefined) {\n stampPackage(cls, pkg);\n registry.define(tag, cls);\n } else {\n warnIfAnotherCopy(registry, tag, existing, cls, pkg);\n }\n }\n}\n","import pkg from \"../package.json\" with { type: \"json\" };\nimport { WcsGeolocation } from \"./components/Geolocation.js\";\nimport { config } from \"./config.js\";\nimport { defineElements } from \"./protocol/defineElement.js\";\n\n/**\n * Register this package's tags. Pass a scoped `CustomElementRegistry` to define\n * them for a single shadow tree -- scoped registries do not inherit the global\n * one, so a tree using one needs its own definitions.\n */\nexport function registerComponents(registry: CustomElementRegistry = customElements): void {\n defineElements(registry, `${pkg.name}@${pkg.version}`, [\n [config.tagNames.geo, WcsGeolocation],\n ]);\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapGeolocation(userConfig?: IWritableConfig, registry?: CustomElementRegistry): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents(registry);\n}\n"],"names":[],"mappings":"AAUA,MAAM,OAAO,GAAoB;AAC/B,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,gBAAgB,EAAE,gBAAgB;AAClC,IAAA,QAAQ,EAAE;AACR,QAAA,GAAG,EAAE,SAAS;AACf,KAAA;CACF;AAED,SAAS,UAAU,CAAI,GAAM,EAAA;AAC3B,IAAA,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;AAAE,QAAA,OAAO,GAAG;AACvD,IAAA,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;IAClB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;AAClC,QAAA,UAAU,CAAE,GAA+B,CAAC,GAAG,CAAC,CAAC;IACnD;AACA,IAAA,OAAO,GAAG;AACZ;AAEA,SAAS,SAAS,CAAI,GAAM,EAAA;AAC1B,IAAA,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;AAAE,QAAA,OAAO,GAAG;IACvD,MAAM,KAAK,GAA4B,EAAE;IACzC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAClC,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAAE,GAA+B,CAAC,GAAG,CAAC,CAAC;IAC/D;AACA,IAAA,OAAO,KAAU;AACnB;AAEA,IAAI,YAAY,GAAmB,IAAI;AAEhC,MAAM,MAAM,GAAY,OAAkB;SAEjC,SAAS,GAAA;IACvB,IAAI,CAAC,YAAY,EAAE;QACjB,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC/C;A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,EAAE,CAAA,EAAG,GAAG,CAAC,IAAI,CAAA,CAAA,EAAI,GAAG,CAAC,OAAO,CAAA,CAAE,EAAE;AACrD,QAAA,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;AACtC,KAAA,CAAC;AACJ;;ACVM,SAAU,oBAAoB,CAAC,UAA4B,EAAE,QAAgC,EAAA;IACjG,IAAI,UAAU,EAAE;QACd,SAAS,CAAC,UAAU,CAAC;IACvB;IACA,kBAAkB,CAAC,QAAQ,CAAC;AAC9B;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wcstack/geolocation",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.0",
|
|
4
4
|
"description": "Declarative geolocation component for Web Components. Framework-agnostic Geolocation API primitive via wc-bindable-protocol.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.esm.js",
|