@wcstack/clipboard 4.13.0 → 4.14.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-clipboardtarget",tagNames:{clipboard:"wcs-clipboard"}};var e="@wcstack/clipboard",r="4.13.0";const i="capability-missing",n="not-allowed",s="clipboard-error";class o extends EventTarget{static wcBindable={protocol:"wc-bindable",version:1,properties:[{name:"text",event:"wcs-clipboard:read",semantics:"event",getter:t=>t.detail.text},{name:"items",event:"wcs-clipboard:read",semantics:"event",getter:t=>t.detail.items},{name:"loading",event:"wcs-clipboard:loading-changed",semantics:"state"},{name:"error",event:"wcs-clipboard:error",semantics:"state"},{name:"readPermission",event:"wcs-clipboard:read-permission-changed",semantics:"state"},{name:"writePermission",event:"wcs-clipboard:write-permission-changed",semantics:"state"},{name:"monitoring",event:"wcs-clipboard:monitoring-changed",semantics:"state"},{name:"errorInfo",event:"wcs-clipboard:error-info-changed",semantics:"state"},{name:"copied",event:"wcs-clipboard:copied",semantics:"event",getter:t=>t.detail},{name:"cut",event:"wcs-clipboard:cut",semantics:"event",getter:t=>t.detail},{name:"pasted",event:"wcs-clipboard:pasted",semantics:"event",getter:t=>t.detail}],commands:[{name:"writeText",async:!0},{name:"write",async:!0},{name:"readText",async:!0},{name:"read",async:!0},{name:"startMonitor"},{name:"stopMonitor"}]};_target;_text=null;_items=null;_loading=!1;_error=null;_errorInfo=null;_readPermission="prompt";_writePermission="prompt";_monitoring=!1;_copied=null;_cut=null;_pasted=null;_readStatus=null;_writeStatus=null;_permissionSubscribed=!1;_permGen=0;_acqGen=0;_ready=Promise.resolve();constructor(t){super(),this._target=t??this,this._initPermissions()}get ready(){return this._ready}observe(){return this.reinitPermission(),this._ready}get text(){return this._text}get items(){return this._items}get loading(){return this._loading}get error(){return this._error}get errorInfo(){return this._errorInfo}get readPermission(){return this._readPermission}get writePermission(){return this._writePermission}get monitoring(){return this._monitoring}get copied(){return this._copied}get cut(){return this._cut}get pasted(){return this._pasted}_setRead(t){this._text=t.text,this._items=t.items,this._target.dispatchEvent(new CustomEvent("wcs-clipboard:read",{detail:t,bubbles:!0}))}_setLoading(t){this._loading!==t&&(this._loading=t,this._target.dispatchEvent(new CustomEvent("wcs-clipboard:loading-changed",{detail:t,bubbles:!0})))}_setError(t){var e,r;this._error!==t&&(this._error=t,this._commitErrorInfo(null===t?null:(e=t.name,r=t.message,"NotSupportedError"===e?{code:i,phase:"start",recoverable:!1,message:r}:"NotAllowedError"===e?{code:n,phase:"execute",recoverable:!1,message:r}:{code:s,phase:"execute",recoverable:!0,message:r})),this._target.dispatchEvent(new CustomEvent("wcs-clipboard:error",{detail:t,bubbles:!0})))}_commitErrorInfo(t){this._errorInfo=t,this._target.dispatchEvent(new CustomEvent("wcs-clipboard:error-info-changed",{detail:t,bubbles:!0}))}_setReadPermission(t){this._readPermission!==t&&(this._readPermission=t,this._target.dispatchEvent(new CustomEvent("wcs-clipboard:read-permission-changed",{detail:t,bubbles:!0})))}_setWritePermission(t){this._writePermission!==t&&(this._writePermission=t,this._target.dispatchEvent(new CustomEvent("wcs-clipboard:write-permission-changed",{detail:t,bubbles:!0})))}_setMonitoring(t){this._monitoring!==t&&(this._monitoring=t,this._target.dispatchEvent(new CustomEvent("wcs-clipboard:monitoring-changed",{detail:t,bubbles:!0})))}_setCopied(t){this._copied=t,this._target.dispatchEvent(new CustomEvent("wcs-clipboard:copied",{detail:t,bubbles:!0}))}_setCut(t){this._cut=t,this._target.dispatchEvent(new CustomEvent("wcs-clipboard:cut",{detail:t,bubbles:!0}))}_setPasted(t){this._pasted=t,this._target.dispatchEvent(new CustomEvent("wcs-clipboard:pasted",{detail:t,bubbles:!0}))}writeText(t){return this._runWrite(()=>navigator.clipboard.writeText(t))}write(t){return this._runWrite(()=>navigator.clipboard.write(t))}readText(){return this._runRead(async()=>({text:await navigator.clipboard.readText(),items:null}))}read(){return this._runRead(async()=>{const t=await navigator.clipboard.read();return this._normalizeItems(t)})}startMonitor(){this._monitoring||(this._setMonitoring(!0),document.addEventListener("copy",this._onCopy),document.addEventListener("cut",this._onCut),document.addEventListener("paste",this._onPaste))}stopMonitor(){this._removeMonitorListeners(),this._setMonitoring(!1)}reinitPermission(){this._permissionSubscribed||this._initPermissions()}dispose(){this._permissionSubscribed=!1,this._permGen++,this._acqGen++,this._setLoading(!1),this._readStatus&&(this._readStatus.removeEventListener("change",this._onReadChange),this._readStatus=null),this._writeStatus&&(this._writeStatus.removeEventListener("change",this._onWriteChange),this._writeStatus=null),this._removeMonitorListeners(),this._monitoring=!1}_runWrite(t){return this._runOp(async()=>(await t(),null))}_runRead(t){return this._runOp(t)}async _runOp(t){if(!this._hasClipboard())return void this._setError(this._unsupportedError());const e=this._acqGen;this._setLoading(!0),this._setError(null);try{const r=await t();if(e!==this._acqGen)return;this._setLoading(!1),r&&this._setRead(r)}catch(t){if(e!==this._acqGen)return;this._setLoading(!1),this._setError(this._normalizeError(t))}}_onCopy=()=>{this._setCopied(this._selectionText())};_onCut=()=>{this._setCut(this._selectionText())};_onPaste=t=>{const e=t.clipboardData,r=e?e.getData("text/plain"):"";this._setPasted(r)};_removeMonitorListeners(){document.removeEventListener("copy",this._onCopy),document.removeEventListener("cut",this._onCut),document.removeEventListener("paste",this._onPaste)}_selectionText(){const t=document.getSelection();return t?t.toString():""}_initPermissions(){if("undefined"==typeof navigator||!navigator.permissions||"function"!=typeof navigator.permissions.query)return this._setReadPermission("unsupported"),this._setWritePermission("unsupported"),void(this._ready=Promise.resolve());this._permissionSubscribed=!0;const t=++this._permGen,e=this._queryPermission("clipboard-read",t,t=>{this._readStatus=t},t=>this._setReadPermission(t),this._onReadChange),r=this._queryPermission("clipboard-write",t,t=>{this._writeStatus=t},t=>this._setWritePermission(t),this._onWriteChange);this._ready=Promise.all([e,r]).then(()=>{})}_queryPermission(t,e,r,i,n){return navigator.permissions.query({name:t}).then(t=>{e===this._permGen&&(r(t),i(t.state),t.addEventListener("change",n))},()=>{e===this._permGen&&i("unsupported")})}_onReadChange=t=>{const e=t.target;this._setReadPermission(e.state)};_onWriteChange=t=>{const e=t.target;this._setWritePermission(e.state)};_hasClipboard(){return"undefined"!=typeof navigator&&!!navigator.clipboard}async _normalizeItems(t){const e=await Promise.all(t.map(t=>Promise.all(t.types.map(e=>t.getType(e))).then(e=>({item:t,blobs:e})))),r=[];let i=null;for(const{item:t,blobs:n}of e){const e={};if(t.types.forEach((t,r)=>{e[t]=n[r]}),null===i){const e=t.types.indexOf("text/plain");-1!==e&&(i=await n[e].text())}r.push({types:[...t.types],data:e})}return{text:i,items:r}}_normalizeError(t){return t instanceof Error?{name:t.name,message:t.message}:{name:"Error",message:String(t)}}_unsupportedError(){return{name:"NotSupportedError",message:"Clipboard API is not available in this environment."}}}let a=!1;const c="data-clipboard-text";function d(e){const r=e.target;if(!(r instanceof Element))return;const i=r.closest(`[${t.triggerAttribute}]`);if(!i)return;const n=i.getAttribute(t.triggerAttribute);if(!n)return;const s=customElements.get(t.tagNames.clipboard),o=document.getElementById(n);if(!(s&&o instanceof s))return;const a=function(t){if(t.hasAttribute(c))return t.getAttribute(c)??"";const e=t.getAttribute("data-clipboard-from");if(!e)return null;const r=document.querySelector(e);return r?r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement?r.value:r.textContent??"":null}(i);null!==a&&(e.preventDefault(),o.writeText(a))}function l(t,e){let r=Object.getPrototypeOf(t);for(;null!==r;){const t=Object.getOwnPropertyDescriptor(r,e);if(void 0!==t)return"function"==typeof t.get||"function"==typeof t.set;r=Object.getPrototypeOf(r)}return!1}const u=new WeakSet;function h(t,e,r){if(u.has(t))return;u.add(t);const i=t.localName??"element";console.warn(`[wcs/input-as-attribute] <${i}> has the attribute ${e}="${r}": an object was written as an attribute, so the element did not receive it. A framework does that when the property is set before the element's definition loads (React 19), or when told to (Vue's .attr). Load the definition before rendering, or assign the property through a ref (Vue: .prop). (Said once per element.)`,t)}const m=new WeakMap;function _(t,e,r){const i=function(t,e){let r=m.get(t);return void 0===r&&(r=new Map,m.set(t,r)),r.has(e)||r.set(e,t.getAttribute(e)),r.get(e)}(t,e);!function(t,e,r){null===r?t.removeAttribute(e):t.setAttribute(e,r)}(t,e,void 0===r?i:r?"":null)}class p extends HTMLElement{static hasConnectedCallbackPromise=!0;static wcBindable={...o.wcBindable,inputs:[{name:"monitor",attribute:"monitor"}],commands:o.wcBindable.commands};_core;_connectedCallbackPromise=Promise.resolve();_monitorPending=!1;_internals=null;constructor(){super(),this._core=new o(this),this._internals=this._initInternals(),this._wireStates({"wcs-clipboard:loading-changed":t=>({loading:!0===t}),"wcs-clipboard:monitoring-changed":t=>({monitoring:!0===t}),"wcs-clipboard:error":t=>({error:null!=t})})}get connectedCallbackPromise(){return this._connectedCallbackPromise}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[r,i]of Object.entries(t))this.addEventListener(r,t=>{const r=this.hasAttribute("debug-states");for(const[n,s]of Object.entries(i(t.detail))){try{s?e.add(n):e.delete(n)}catch{}r&&this.toggleAttribute(`data-wcs-state-${n}`,s)}})}get monitor(){return this.hasAttribute("monitor")}set monitor(t){_(this,"monitor",t)}get text(){return this._core.text}get items(){return this._core.items}get loading(){return this._core.loading}get error(){return this._core.error}get errorInfo(){return this._core.errorInfo}get readPermission(){return this._core.readPermission}get writePermission(){return this._core.writePermission}get monitoring(){return this._core.monitoring}get copied(){return this._core.copied}get cut(){return this._core.cut}get pasted(){return this._core.pasted}writeText(t){return this._core.writeText(t)}write(t){return this._core.write(t)}readText(){return this._core.readText()}read(){return this._core.read()}startMonitor(){this._core.startMonitor()}stopMonitor(){this._monitorPending=!1,this._core.stopMonitor()}connectedCallback(){!function(t){const e=t.constructor?.wcBindable,r=e?.inputs;if(void 0===r)return;const i=t.getAttribute;for(const e of r){const r=e.name,n="function"==typeof i?i.call(t,r.toLowerCase()):null;if(null!==n&&n.startsWith("[object ")&&h(t,r,n),!Object.prototype.hasOwnProperty.call(t,r))continue;if(!l(t,r))continue;const s=t,o=s[r];delete s[r],s[r]=o}}(this),this.style.display="none",a||(a=!0,document.addEventListener("click",d)),this._connectedCallbackPromise=this._core.observe(),this._scheduleMonitor()}_scheduleMonitor(){this._monitorPending||(this._monitorPending=!0,queueMicrotask(()=>{this._monitorPending&&(this._monitorPending=!1,this.isConnected&&this.monitor&&this._core.startMonitor())}))}disconnectedCallback(){this._core.stopMonitor(),this._core.dispose()}}const g=Symbol.for("wcstack.package"),b=new WeakSet;function w(t,e){Object.defineProperty(t,g,{value:e,configurable:!0})}function f(t,e,r,i,n){if(void 0!==i&&(r===i||r.prototype instanceof i))return;const s=r[g];if(s===n||b.has(t))return;b.add(t);const o=n.slice(0,n.lastIndexOf("@"));console.warn(`[${o}] [wcs/package-twice] <${e}> is already defined by ${s??`another copy of ${o} that does not name its version`}; this copy, ${n}, does nothing. Load each package once.`)}function v(i=customElements){!function(t,e,r){for(const[i,n]of r){const r=t.get(i);void 0===r?(w(n,e),t.define(i,n)):f(t,i,r,n,e)}}(i,`${e}@${r}`,[[t.tagNames.clipboard,p]])}var y;v(y);
1
+ const t={triggerAttribute:"data-clipboardtarget",tagNames:{clipboard:"wcs-clipboard"}};var e="@wcstack/clipboard",r="4.14.0";const i="capability-missing",n="not-allowed",s="clipboard-error";class o extends EventTarget{static wcBindable={protocol:"wc-bindable",version:1,properties:[{name:"text",event:"wcs-clipboard:read",semantics:"event",getter:t=>t.detail.text},{name:"items",event:"wcs-clipboard:read",semantics:"event",getter:t=>t.detail.items},{name:"loading",event:"wcs-clipboard:loading-changed",semantics:"state"},{name:"error",event:"wcs-clipboard:error",semantics:"state"},{name:"readPermission",event:"wcs-clipboard:read-permission-changed",semantics:"state"},{name:"writePermission",event:"wcs-clipboard:write-permission-changed",semantics:"state"},{name:"monitoring",event:"wcs-clipboard:monitoring-changed",semantics:"state"},{name:"errorInfo",event:"wcs-clipboard:error-info-changed",semantics:"state"},{name:"copied",event:"wcs-clipboard:copied",semantics:"event",getter:t=>t.detail},{name:"cut",event:"wcs-clipboard:cut",semantics:"event",getter:t=>t.detail},{name:"pasted",event:"wcs-clipboard:pasted",semantics:"event",getter:t=>t.detail}],commands:[{name:"writeText",async:!0},{name:"write",async:!0},{name:"readText",async:!0},{name:"read",async:!0},{name:"startMonitor"},{name:"stopMonitor"}]};_target;_text=null;_items=null;_loading=!1;_error=null;_errorInfo=null;_readPermission="prompt";_writePermission="prompt";_monitoring=!1;_copied=null;_cut=null;_pasted=null;_readStatus=null;_writeStatus=null;_permissionSubscribed=!1;_permGen=0;_acqGen=0;_ready=Promise.resolve();constructor(t){super(),this._target=t??this,this._initPermissions()}get ready(){return this._ready}observe(){return this.reinitPermission(),this._ready}get text(){return this._text}get items(){return this._items}get loading(){return this._loading}get error(){return this._error}get errorInfo(){return this._errorInfo}get readPermission(){return this._readPermission}get writePermission(){return this._writePermission}get monitoring(){return this._monitoring}get copied(){return this._copied}get cut(){return this._cut}get pasted(){return this._pasted}_setRead(t){this._text=t.text,this._items=t.items,this._target.dispatchEvent(new CustomEvent("wcs-clipboard:read",{detail:t,bubbles:!0}))}_setLoading(t){this._loading!==t&&(this._loading=t,this._target.dispatchEvent(new CustomEvent("wcs-clipboard:loading-changed",{detail:t,bubbles:!0})))}_setError(t){var e,r;this._error!==t&&(this._error=t,this._commitErrorInfo(null===t?null:(e=t.name,r=t.message,"NotSupportedError"===e?{code:i,phase:"start",recoverable:!1,message:r}:"NotAllowedError"===e?{code:n,phase:"execute",recoverable:!1,message:r}:{code:s,phase:"execute",recoverable:!0,message:r})),this._target.dispatchEvent(new CustomEvent("wcs-clipboard:error",{detail:t,bubbles:!0})))}_commitErrorInfo(t){this._errorInfo=t,this._target.dispatchEvent(new CustomEvent("wcs-clipboard:error-info-changed",{detail:t,bubbles:!0}))}_setReadPermission(t){this._readPermission!==t&&(this._readPermission=t,this._target.dispatchEvent(new CustomEvent("wcs-clipboard:read-permission-changed",{detail:t,bubbles:!0})))}_setWritePermission(t){this._writePermission!==t&&(this._writePermission=t,this._target.dispatchEvent(new CustomEvent("wcs-clipboard:write-permission-changed",{detail:t,bubbles:!0})))}_setMonitoring(t){this._monitoring!==t&&(this._monitoring=t,this._target.dispatchEvent(new CustomEvent("wcs-clipboard:monitoring-changed",{detail:t,bubbles:!0})))}_setCopied(t){this._copied=t,this._target.dispatchEvent(new CustomEvent("wcs-clipboard:copied",{detail:t,bubbles:!0}))}_setCut(t){this._cut=t,this._target.dispatchEvent(new CustomEvent("wcs-clipboard:cut",{detail:t,bubbles:!0}))}_setPasted(t){this._pasted=t,this._target.dispatchEvent(new CustomEvent("wcs-clipboard:pasted",{detail:t,bubbles:!0}))}writeText(t){return this._runWrite(()=>navigator.clipboard.writeText(t))}write(t){return this._runWrite(()=>navigator.clipboard.write(t))}readText(){return this._runRead(async()=>({text:await navigator.clipboard.readText(),items:null}))}read(){return this._runRead(async()=>{const t=await navigator.clipboard.read();return this._normalizeItems(t)})}startMonitor(){this._monitoring||(this._setMonitoring(!0),document.addEventListener("copy",this._onCopy),document.addEventListener("cut",this._onCut),document.addEventListener("paste",this._onPaste))}stopMonitor(){this._removeMonitorListeners(),this._setMonitoring(!1)}reinitPermission(){this._permissionSubscribed||this._initPermissions()}dispose(){this._permissionSubscribed=!1,this._permGen++,this._acqGen++,this._setLoading(!1),this._readStatus&&(this._readStatus.removeEventListener("change",this._onReadChange),this._readStatus=null),this._writeStatus&&(this._writeStatus.removeEventListener("change",this._onWriteChange),this._writeStatus=null),this._removeMonitorListeners(),this._monitoring=!1}_runWrite(t){return this._runOp(async()=>(await t(),null))}_runRead(t){return this._runOp(t)}async _runOp(t){if(!this._hasClipboard())return void this._setError(this._unsupportedError());const e=this._acqGen;this._setLoading(!0),this._setError(null);try{const r=await t();if(e!==this._acqGen)return;this._setLoading(!1),r&&this._setRead(r)}catch(t){if(e!==this._acqGen)return;this._setLoading(!1),this._setError(this._normalizeError(t))}}_onCopy=()=>{this._setCopied(this._selectionText())};_onCut=()=>{this._setCut(this._selectionText())};_onPaste=t=>{const e=t.clipboardData,r=e?e.getData("text/plain"):"";this._setPasted(r)};_removeMonitorListeners(){document.removeEventListener("copy",this._onCopy),document.removeEventListener("cut",this._onCut),document.removeEventListener("paste",this._onPaste)}_selectionText(){const t=document.getSelection();return t?t.toString():""}_initPermissions(){if("undefined"==typeof navigator||!navigator.permissions||"function"!=typeof navigator.permissions.query)return this._setReadPermission("unsupported"),this._setWritePermission("unsupported"),void(this._ready=Promise.resolve());this._permissionSubscribed=!0;const t=++this._permGen,e=this._queryPermission("clipboard-read",t,t=>{this._readStatus=t},t=>this._setReadPermission(t),this._onReadChange),r=this._queryPermission("clipboard-write",t,t=>{this._writeStatus=t},t=>this._setWritePermission(t),this._onWriteChange);this._ready=Promise.all([e,r]).then(()=>{})}_queryPermission(t,e,r,i,n){return navigator.permissions.query({name:t}).then(t=>{e===this._permGen&&(r(t),i(t.state),t.addEventListener("change",n))},()=>{e===this._permGen&&i("unsupported")})}_onReadChange=t=>{const e=t.target;this._setReadPermission(e.state)};_onWriteChange=t=>{const e=t.target;this._setWritePermission(e.state)};_hasClipboard(){return"undefined"!=typeof navigator&&!!navigator.clipboard}async _normalizeItems(t){const e=await Promise.all(t.map(t=>Promise.all(t.types.map(e=>t.getType(e))).then(e=>({item:t,blobs:e})))),r=[];let i=null;for(const{item:t,blobs:n}of e){const e={};if(t.types.forEach((t,r)=>{e[t]=n[r]}),null===i){const e=t.types.indexOf("text/plain");-1!==e&&(i=await n[e].text())}r.push({types:[...t.types],data:e})}return{text:i,items:r}}_normalizeError(t){return t instanceof Error?{name:t.name,message:t.message}:{name:"Error",message:String(t)}}_unsupportedError(){return{name:"NotSupportedError",message:"Clipboard API is not available in this environment."}}}let a=!1;const c="data-clipboard-text";function d(e){const r=e.target;if(!(r instanceof Element))return;const i=r.closest(`[${t.triggerAttribute}]`);if(!i)return;const n=i.getAttribute(t.triggerAttribute);if(!n)return;const s=customElements.get(t.tagNames.clipboard),o=document.getElementById(n);if(!(s&&o instanceof s))return;const a=function(t){if(t.hasAttribute(c))return t.getAttribute(c)??"";const e=t.getAttribute("data-clipboard-from");if(!e)return null;const r=document.querySelector(e);return r?r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement?r.value:r.textContent??"":null}(i);null!==a&&(e.preventDefault(),o.writeText(a))}function l(t,e){let r=Object.getPrototypeOf(t);for(;null!==r;){const t=Object.getOwnPropertyDescriptor(r,e);if(void 0!==t)return"function"==typeof t.get||"function"==typeof t.set;r=Object.getPrototypeOf(r)}return!1}const u=new WeakSet;function h(t,e,r){if(u.has(t))return;u.add(t);const i=t.localName??"element";console.warn(`[wcs/input-as-attribute] <${i}> has the attribute ${e}="${r}": an object was written as an attribute, so the element did not receive it. A framework does that when the property is set before the element's definition loads (React 19), or when told to (Vue's .attr). Load the definition before rendering, or assign the property through a ref (Vue: .prop). (Said once per element.)`,t)}const m=new WeakMap;function _(t,e,r){const i=function(t,e){let r=m.get(t);return void 0===r&&(r=new Map,m.set(t,r)),r.has(e)||r.set(e,t.getAttribute(e)),r.get(e)}(t,e);!function(t,e,r){null===r?t.removeAttribute(e):t.setAttribute(e,r)}(t,e,void 0===r?i:r?"":null)}class p extends HTMLElement{static hasConnectedCallbackPromise=!0;static wcBindable={...o.wcBindable,inputs:[{name:"monitor",attribute:"monitor"}],commands:o.wcBindable.commands};_core;_connectedCallbackPromise=Promise.resolve();_monitorPending=!1;_internals=null;constructor(){super(),this._core=new o(this),this._internals=this._initInternals(),this._wireStates({"wcs-clipboard:loading-changed":t=>({loading:!0===t}),"wcs-clipboard:monitoring-changed":t=>({monitoring:!0===t}),"wcs-clipboard:error":t=>({error:null!=t})})}get connectedCallbackPromise(){return this._connectedCallbackPromise}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[r,i]of Object.entries(t))this.addEventListener(r,t=>{const r=this.hasAttribute("debug-states");for(const[n,s]of Object.entries(i(t.detail))){try{s?e.add(n):e.delete(n)}catch{}r&&this.toggleAttribute(`data-wcs-state-${n}`,s)}})}get monitor(){return this.hasAttribute("monitor")}set monitor(t){_(this,"monitor",t)}get text(){return this._core.text}get items(){return this._core.items}get loading(){return this._core.loading}get error(){return this._core.error}get errorInfo(){return this._core.errorInfo}get readPermission(){return this._core.readPermission}get writePermission(){return this._core.writePermission}get monitoring(){return this._core.monitoring}get copied(){return this._core.copied}get cut(){return this._core.cut}get pasted(){return this._core.pasted}writeText(t){return this._core.writeText(t)}write(t){return this._core.write(t)}readText(){return this._core.readText()}read(){return this._core.read()}startMonitor(){this._core.startMonitor()}stopMonitor(){this._monitorPending=!1,this._core.stopMonitor()}connectedCallback(){!function(t){const e=t.constructor?.wcBindable,r=e?.inputs;if(void 0===r)return;const i=t.getAttribute;for(const e of r){const r=e.name,n="function"==typeof i?i.call(t,r.toLowerCase()):null;if(null!==n&&n.startsWith("[object ")&&h(t,r,n),!Object.prototype.hasOwnProperty.call(t,r))continue;if(!l(t,r))continue;const s=t,o=s[r];delete s[r],s[r]=o}}(this),this.style.display="none",a||(a=!0,document.addEventListener("click",d)),this._connectedCallbackPromise=this._core.observe(),this._scheduleMonitor()}_scheduleMonitor(){this._monitorPending||(this._monitorPending=!0,queueMicrotask(()=>{this._monitorPending&&(this._monitorPending=!1,this.isConnected&&this.monitor&&this._core.startMonitor())}))}disconnectedCallback(){this._core.stopMonitor(),this._core.dispose()}}const g=Symbol.for("wcstack.package"),b=new WeakSet;function w(t,e){Object.defineProperty(t,g,{value:e,configurable:!0})}function f(t,e,r,i,n){if(void 0!==i&&(r===i||r.prototype instanceof i))return;const s=r[g];if(s===n||b.has(t))return;b.add(t);const o=n.slice(0,n.lastIndexOf("@"));console.warn(`[${o}] [wcs/package-twice] <${e}> is already defined by ${s??`another copy of ${o} that does not name its version`}; this copy, ${n}, does nothing. Load each package once.`)}function v(i=customElements){!function(t,e,r){for(const[i,n]of r){const r=t.get(i);void 0===r?(w(n,e),t.define(i,n)):f(t,i,r,n,e)}}(i,`${e}@${r}`,[[t.tagNames.clipboard,p]])}var y;v(y);
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/clipboard","version":"4.13.0"};
68
+ var pkg = {"name":"@wcstack/clipboard","version":"4.14.0"};
69
69
 
70
70
  /**
71
71
  * clipboardCapabilities.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wcstack/clipboard",
3
- "version": "4.13.0",
3
+ "version": "4.14.0",
4
4
  "description": "Declarative clipboard component for Web Components. Framework-agnostic Clipboard API primitive via wc-bindable-protocol.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.esm.js",