@wcstack/geolocation 4.11.2 → 4.12.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 CHANGED
@@ -1,2 +1,2 @@
1
- const t={triggerAttribute:"data-geotarget",tagNames:{geo:"wcs-geo"}};var e="@wcstack/geolocation",i="4.11.2";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);
1
+ const t={triggerAttribute:"data-geotarget",tagNames:{geo:"wcs-geo"}};var e="@wcstack/geolocation",i="4.12.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/index.esm.js CHANGED
@@ -65,7 +65,7 @@ function setConfig(partialConfig) {
65
65
  frozenConfig = null;
66
66
  }
67
67
 
68
- var pkg = {"name":"@wcstack/geolocation","version":"4.11.2"};
68
+ var pkg = {"name":"@wcstack/geolocation","version":"4.12.0"};
69
69
 
70
70
  // ===========================================================================
71
71
  // AUTO-GENERATED FILE - DO NOT EDIT.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wcstack/geolocation",
3
- "version": "4.11.2",
3
+ "version": "4.12.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",