@vscode-elements/elements 2.3.0 → 2.3.1-pre.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/custom-elements.json +179 -192
- package/dist/bundled.js +6 -6
- package/dist/includes/VscElement.js +1 -1
- package/dist/includes/VscElement.js.map +1 -1
- package/dist/vscode-radio/vscode-radio.d.ts +9 -12
- package/dist/vscode-radio/vscode-radio.d.ts.map +1 -1
- package/dist/vscode-radio/vscode-radio.js +44 -42
- package/dist/vscode-radio/vscode-radio.js.map +1 -1
- package/dist/vscode-radio-group/vscode-radio-group.d.ts +4 -6
- package/dist/vscode-radio-group/vscode-radio-group.d.ts.map +1 -1
- package/dist/vscode-radio-group/vscode-radio-group.js +37 -27
- package/dist/vscode-radio-group/vscode-radio-group.js.map +1 -1
- package/package.json +1 -1
- package/vscode.css-custom-data.json +5 -5
- package/vscode.html-custom-data.json +17 -17
package/dist/bundled.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),s=new WeakMap;let o=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const i=this.t;if(e&&void 0===t){const e=void 0!==i&&1===i.length;e&&(t=s.get(i)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&s.set(i,t))}return t}toString(){return this.cssText}};const r=t=>new o("string"==typeof t?t:t+"",void 0,i),n=(t,...e)=>{const s=1===t.length?t[0]:e.reduce(((e,i,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1]),t[0]);return new o(s,t,i)},l=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return r(e)})(t):t,{is:a,defineProperty:h,getOwnPropertyDescriptor:c,getOwnPropertyNames:d,getOwnPropertySymbols:u,getPrototypeOf:p}=Object,v=globalThis,b=v.trustedTypes,f=b?b.emptyScript:"",g=v.reactiveElementPolyfillSupport,m=(t,e)=>t,x={toAttribute(t,e){switch(e){case Boolean:t=t?f:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},w=(t,e)=>!a(t,e),y={attribute:!0,type:String,converter:x,reflect:!1,useDefault:!1,hasChanged:w};Symbol.metadata??=Symbol("metadata"),v.litPropertyMetadata??=new WeakMap;let k=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=y){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&h(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:o}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const r=s?.call(this);o?.call(this,e),this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??y}static _$Ei(){if(this.hasOwnProperty(m("elementProperties")))return;const t=p(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(m("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(m("properties"))){const t=this.properties,e=[...d(t),...u(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((i,s)=>{if(e)i.adoptedStyleSheets=s.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of s){const s=document.createElement("style"),o=t.litNonce;void 0!==o&&s.setAttribute("nonce",o),s.textContent=e.cssText,i.appendChild(s)}})(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(void 0!==s&&!0===i.reflect){const o=(void 0!==i.converter?.toAttribute?i.converter:x).toAttribute(e,i.type);this._$Em=t,null==o?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){const i=this.constructor,s=i._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=i.getPropertyOptions(s),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:x;this._$Em=s,this[s]=o.fromAttribute(e,t.type)??this._$Ej?.get(s)??null,this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){const s=this.constructor,o=this[t];if(i??=s.getPropertyOptions(t),!((i.hasChanged??w)(o,e)||i.useDefault&&i.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:o},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??e??this[t]),!0!==o||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};k.elementStyles=[],k.shadowRootOptions={mode:"open"},k[m("elementProperties")]=new Map,k[m("finalized")]=new Map,g?.({ReactiveElement:k}),(v.reactiveElementVersions??=[]).push("2.1.0");const $=globalThis,_=$.trustedTypes,S=_?_.createPolicy("lit-html",{createHTML:t=>t}):void 0,B="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,O="?"+C,A=`<${O}>`,z=document,E=()=>z.createComment(""),I=t=>null===t||"object"!=typeof t&&"function"!=typeof t,j=Array.isArray,M="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,D=/-->/g,F=/>/g,V=RegExp(`>|${M}(?:([^\\s"'>=/]+)(${M}*=${M}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),T=/'/g,N=/"/g,R=/^(?:script|style|textarea|title)$/i,L=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),U=L(1),G=L(2),H=Symbol.for("lit-noChange"),q=Symbol.for("lit-nothing"),W=new WeakMap,K=z.createTreeWalker(z,129);function X(t,e){if(!j(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==S?S.createHTML(e):e}const J=(t,e)=>{const i=t.length-1,s=[];let o,r=2===e?"<svg>":3===e?"<math>":"",n=P;for(let e=0;e<i;e++){const i=t[e];let l,a,h=-1,c=0;for(;c<i.length&&(n.lastIndex=c,a=n.exec(i),null!==a);)c=n.lastIndex,n===P?"!--"===a[1]?n=D:void 0!==a[1]?n=F:void 0!==a[2]?(R.test(a[2])&&(o=RegExp("</"+a[2],"g")),n=V):void 0!==a[3]&&(n=V):n===V?">"===a[0]?(n=o??P,h=-1):void 0===a[1]?h=-2:(h=n.lastIndex-a[2].length,l=a[1],n=void 0===a[3]?V:'"'===a[3]?N:T):n===N||n===T?n=V:n===D||n===F?n=P:(n=V,o=void 0);const d=n===V&&t[e+1].startsWith("/>")?" ":"";r+=n===P?i+A:h>=0?(s.push(l),i.slice(0,h)+B+i.slice(h)+C+d):i+C+(-2===h?e:d)}return[X(t,r+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]};class Y{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let o=0,r=0;const n=t.length-1,l=this.parts,[a,h]=J(t,e);if(this.el=Y.createElement(a,i),K.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=K.nextNode())&&l.length<n;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(B)){const e=h[r++],i=s.getAttribute(t).split(C),n=/([.?@])?(.*)/.exec(e);l.push({type:1,index:o,name:n[2],strings:i,ctor:"."===n[1]?et:"?"===n[1]?it:"@"===n[1]?st:tt}),s.removeAttribute(t)}else t.startsWith(C)&&(l.push({type:6,index:o}),s.removeAttribute(t));if(R.test(s.tagName)){const t=s.textContent.split(C),e=t.length-1;if(e>0){s.textContent=_?_.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],E()),K.nextNode(),l.push({type:2,index:++o});s.append(t[e],E())}}}else if(8===s.nodeType)if(s.data===O)l.push({type:2,index:o});else{let t=-1;for(;-1!==(t=s.data.indexOf(C,t+1));)l.push({type:7,index:o}),t+=C.length-1}o++}}static createElement(t,e){const i=z.createElement("template");return i.innerHTML=t,i}}function Z(t,e,i=t,s){if(e===H)return e;let o=void 0!==s?i._$Co?.[s]:i._$Cl;const r=I(e)?void 0:e._$litDirective$;return o?.constructor!==r&&(o?._$AO?.(!1),void 0===r?o=void 0:(o=new r(t),o._$AT(t,i,s)),void 0!==s?(i._$Co??=[])[s]=o:i._$Cl=o),void 0!==o&&(e=Z(t,o._$AS(t,e.values),o,s)),e}class Q{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=q,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Z(this,t,e),I(t)?t===q||null==t||""===t?(this._$AH!==q&&this._$AR(),this._$AH=q):t!==this._$AH&&t!==H&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>j(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==q&&I(this._$AH)?this._$AA.nextSibling.data=t:this.T(z.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,s="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=Y.createElement(X(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,s=(t?.creationScope??z).importNode(e,!0);K.currentNode=s;let o=K.nextNode(),r=0,n=0,l=i[0];for(;void 0!==l;){if(r===l.index){let e;2===l.type?e=new Q(o,o.nextSibling,this,t):1===l.type?e=new l.ctor(o,l.name,l.strings,this,t):6===l.type&&(e=new ot(o,this,t)),this._$AV.push(e),l=i[++n]}r!==l?.index&&(o=K.nextNode(),r++)}return K.currentNode=z,s}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}(s,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=W.get(t.strings);return void 0===e&&W.set(t.strings,e=new Y(t)),e}k(t){j(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const o of t)s===e.length?e.push(i=new Q(this.O(E()),this.O(E()),this,this.options)):i=e[s],i._$AI(o),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class tt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,o){this.type=1,this._$AH=q,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=o,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=q}_$AI(t,e=this,i,s){const o=this.strings;let r=!1;if(void 0===o)t=Z(this,t,e,0),r=!I(t)||t!==this._$AH&&t!==H,r&&(this._$AH=t);else{const s=t;let n,l;for(t=o[0],n=0;n<o.length-1;n++)l=Z(this,s[i+n],e,n),l===H&&(l=this._$AH[n]),r||=!I(l)||l!==this._$AH[n],l===q?t=q:t!==q&&(t+=(l??"")+o[n+1]),this._$AH[n]=l}r&&!s&&this.j(t)}j(t){t===q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class et extends tt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===q?void 0:t}}class it extends tt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==q)}}class st extends tt{constructor(t,e,i,s,o){super(t,e,i,s,o),this.type=5}_$AI(t,e=this){if((t=Z(this,t,e,0)??q)===H)return;const i=this._$AH,s=t===q&&i!==q||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==q&&(i===q||s);s&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class ot{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Z(this,t)}}const rt={I:Q},nt=$.litHtmlPolyfillSupport;nt?.(Y,Q),($.litHtmlVersions??=[]).push("3.3.0");const lt=(t,e,i)=>{const s=i?.renderBefore??e;let o=s._$litPart$;if(void 0===o){const t=i?.renderBefore??null;s._$litPart$=o=new Q(e.insertBefore(E(),t),t,void 0,i??{})}return o._$AI(t),o},at=globalThis;let ht=class extends k{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=lt(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return H}};ht._$litElement$=!0,ht.finalized=!0,at.litElementHydrateSupport?.({LitElement:ht});const ct=at.litElementPolyfillSupport;ct?.({LitElement:ht}),(at.litElementVersions??=[]).push("4.2.0");const dt={attribute:!0,type:String,converter:x,reflect:!1,hasChanged:w},ut=(t=dt,e,i)=>{const{kind:s,metadata:o}=i;let r=globalThis.litPropertyMetadata.get(o);if(void 0===r&&globalThis.litPropertyMetadata.set(o,r=new Map),"setter"===s&&((t=Object.create(t)).wrapped=!0),r.set(i.name,t),"accessor"===s){const{name:s}=i;return{set(i){const o=e.get.call(this);e.set.call(this,i),this.requestUpdate(s,o,t)},init(e){return void 0!==e&&this.C(s,void 0,t,e),e}}}if("setter"===s){const{name:s}=i;return function(i){const o=this[s];e.call(this,i),this.requestUpdate(s,o,t)}}throw Error("Unsupported decorator location: "+s)};function pt(t){return(e,i)=>"object"==typeof i?ut(t,e,i):((t,e,i)=>{const s=e.hasOwnProperty(i);return e.constructor.createProperty(i,t),s?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)}function vt(t){return pt({...t,state:!0,attribute:!1})}const bt=(t,e,i)=>(i.configurable=!0,i.enumerable=!0,i);function ft(t,e){return(i,s,o)=>{const r=e=>e.renderRoot?.querySelector(t)??null;if(e){const{get:t,set:e}="object"==typeof s?i:o??(()=>{const t=Symbol();return{get(){return this[t]},set(e){this[t]=e}}})();return bt(0,0,{get(){let i=t.call(this);return void 0===i&&(i=r(this),(null!==i||this.hasUpdated)&&e.call(this,i)),i}})}return bt(0,0,{get(){return r(this)}})}}let gt;function mt(t){return(e,i)=>{const{slot:s,selector:o}=t??{},r="slot"+(s?`[name=${s}]`:":not([name])");return bt(0,0,{get(){const e=this.renderRoot?.querySelector(r),i=e?.assignedElements(t)??[];return void 0===o?i:i.filter((t=>t.matches(o)))}})}}const xt="2.3.0",wt="__vscodeElements_disableRegistryWarning__";class yt extends ht{get version(){return xt}}const kt=t=>e=>{if(!customElements.get(t))return void customElements.define(t,e);if(wt in window)return;const i=document.createElement(t),s=i?.version;let o="";s?s!==xt?(o+="is already registered by a different version of VSCode Elements. ",o+=`This version is "${xt}", while the other one is "${s}".`):o+=`is already registered by the same version of VSCode Elements (${xt}).`:o+="is already registered by an unknown custom element handler class.",console.warn(`[VSCode Elements] ${t} ${o}\nTo suppress this warning, set window.${wt} to true`)};var $t=n`
|
|
1
|
+
const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),s=new WeakMap;let o=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const i=this.t;if(e&&void 0===t){const e=void 0!==i&&1===i.length;e&&(t=s.get(i)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&s.set(i,t))}return t}toString(){return this.cssText}};const r=t=>new o("string"==typeof t?t:t+"",void 0,i),n=(t,...e)=>{const s=1===t.length?t[0]:e.reduce(((e,i,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1]),t[0]);return new o(s,t,i)},l=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return r(e)})(t):t,{is:a,defineProperty:h,getOwnPropertyDescriptor:c,getOwnPropertyNames:d,getOwnPropertySymbols:u,getPrototypeOf:p}=Object,v=globalThis,b=v.trustedTypes,f=b?b.emptyScript:"",g=v.reactiveElementPolyfillSupport,m=(t,e)=>t,x={toAttribute(t,e){switch(e){case Boolean:t=t?f:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},w=(t,e)=>!a(t,e),y={attribute:!0,type:String,converter:x,reflect:!1,useDefault:!1,hasChanged:w};Symbol.metadata??=Symbol("metadata"),v.litPropertyMetadata??=new WeakMap;let k=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=y){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&h(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:o}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const r=s?.call(this);o?.call(this,e),this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??y}static _$Ei(){if(this.hasOwnProperty(m("elementProperties")))return;const t=p(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(m("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(m("properties"))){const t=this.properties,e=[...d(t),...u(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((i,s)=>{if(e)i.adoptedStyleSheets=s.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of s){const s=document.createElement("style"),o=t.litNonce;void 0!==o&&s.setAttribute("nonce",o),s.textContent=e.cssText,i.appendChild(s)}})(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(void 0!==s&&!0===i.reflect){const o=(void 0!==i.converter?.toAttribute?i.converter:x).toAttribute(e,i.type);this._$Em=t,null==o?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){const i=this.constructor,s=i._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=i.getPropertyOptions(s),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:x;this._$Em=s,this[s]=o.fromAttribute(e,t.type)??this._$Ej?.get(s)??null,this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){const s=this.constructor,o=this[t];if(i??=s.getPropertyOptions(t),!((i.hasChanged??w)(o,e)||i.useDefault&&i.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:o},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??e??this[t]),!0!==o||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};k.elementStyles=[],k.shadowRootOptions={mode:"open"},k[m("elementProperties")]=new Map,k[m("finalized")]=new Map,g?.({ReactiveElement:k}),(v.reactiveElementVersions??=[]).push("2.1.0");const $=globalThis,_=$.trustedTypes,S=_?_.createPolicy("lit-html",{createHTML:t=>t}):void 0,B="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,O="?"+C,A=`<${O}>`,z=document,E=()=>z.createComment(""),I=t=>null===t||"object"!=typeof t&&"function"!=typeof t,j=Array.isArray,M="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,D=/-->/g,F=/>/g,V=RegExp(`>|${M}(?:([^\\s"'>=/]+)(${M}*=${M}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),T=/'/g,N=/"/g,R=/^(?:script|style|textarea|title)$/i,L=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),U=L(1),G=L(2),H=Symbol.for("lit-noChange"),q=Symbol.for("lit-nothing"),W=new WeakMap,K=z.createTreeWalker(z,129);function X(t,e){if(!j(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==S?S.createHTML(e):e}const J=(t,e)=>{const i=t.length-1,s=[];let o,r=2===e?"<svg>":3===e?"<math>":"",n=P;for(let e=0;e<i;e++){const i=t[e];let l,a,h=-1,c=0;for(;c<i.length&&(n.lastIndex=c,a=n.exec(i),null!==a);)c=n.lastIndex,n===P?"!--"===a[1]?n=D:void 0!==a[1]?n=F:void 0!==a[2]?(R.test(a[2])&&(o=RegExp("</"+a[2],"g")),n=V):void 0!==a[3]&&(n=V):n===V?">"===a[0]?(n=o??P,h=-1):void 0===a[1]?h=-2:(h=n.lastIndex-a[2].length,l=a[1],n=void 0===a[3]?V:'"'===a[3]?N:T):n===N||n===T?n=V:n===D||n===F?n=P:(n=V,o=void 0);const d=n===V&&t[e+1].startsWith("/>")?" ":"";r+=n===P?i+A:h>=0?(s.push(l),i.slice(0,h)+B+i.slice(h)+C+d):i+C+(-2===h?e:d)}return[X(t,r+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]};class Y{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let o=0,r=0;const n=t.length-1,l=this.parts,[a,h]=J(t,e);if(this.el=Y.createElement(a,i),K.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=K.nextNode())&&l.length<n;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(B)){const e=h[r++],i=s.getAttribute(t).split(C),n=/([.?@])?(.*)/.exec(e);l.push({type:1,index:o,name:n[2],strings:i,ctor:"."===n[1]?et:"?"===n[1]?it:"@"===n[1]?st:tt}),s.removeAttribute(t)}else t.startsWith(C)&&(l.push({type:6,index:o}),s.removeAttribute(t));if(R.test(s.tagName)){const t=s.textContent.split(C),e=t.length-1;if(e>0){s.textContent=_?_.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],E()),K.nextNode(),l.push({type:2,index:++o});s.append(t[e],E())}}}else if(8===s.nodeType)if(s.data===O)l.push({type:2,index:o});else{let t=-1;for(;-1!==(t=s.data.indexOf(C,t+1));)l.push({type:7,index:o}),t+=C.length-1}o++}}static createElement(t,e){const i=z.createElement("template");return i.innerHTML=t,i}}function Z(t,e,i=t,s){if(e===H)return e;let o=void 0!==s?i._$Co?.[s]:i._$Cl;const r=I(e)?void 0:e._$litDirective$;return o?.constructor!==r&&(o?._$AO?.(!1),void 0===r?o=void 0:(o=new r(t),o._$AT(t,i,s)),void 0!==s?(i._$Co??=[])[s]=o:i._$Cl=o),void 0!==o&&(e=Z(t,o._$AS(t,e.values),o,s)),e}class Q{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=q,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Z(this,t,e),I(t)?t===q||null==t||""===t?(this._$AH!==q&&this._$AR(),this._$AH=q):t!==this._$AH&&t!==H&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>j(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==q&&I(this._$AH)?this._$AA.nextSibling.data=t:this.T(z.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,s="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=Y.createElement(X(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,s=(t?.creationScope??z).importNode(e,!0);K.currentNode=s;let o=K.nextNode(),r=0,n=0,l=i[0];for(;void 0!==l;){if(r===l.index){let e;2===l.type?e=new Q(o,o.nextSibling,this,t):1===l.type?e=new l.ctor(o,l.name,l.strings,this,t):6===l.type&&(e=new ot(o,this,t)),this._$AV.push(e),l=i[++n]}r!==l?.index&&(o=K.nextNode(),r++)}return K.currentNode=z,s}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}(s,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=W.get(t.strings);return void 0===e&&W.set(t.strings,e=new Y(t)),e}k(t){j(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const o of t)s===e.length?e.push(i=new Q(this.O(E()),this.O(E()),this,this.options)):i=e[s],i._$AI(o),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class tt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,o){this.type=1,this._$AH=q,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=o,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=q}_$AI(t,e=this,i,s){const o=this.strings;let r=!1;if(void 0===o)t=Z(this,t,e,0),r=!I(t)||t!==this._$AH&&t!==H,r&&(this._$AH=t);else{const s=t;let n,l;for(t=o[0],n=0;n<o.length-1;n++)l=Z(this,s[i+n],e,n),l===H&&(l=this._$AH[n]),r||=!I(l)||l!==this._$AH[n],l===q?t=q:t!==q&&(t+=(l??"")+o[n+1]),this._$AH[n]=l}r&&!s&&this.j(t)}j(t){t===q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class et extends tt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===q?void 0:t}}class it extends tt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==q)}}class st extends tt{constructor(t,e,i,s,o){super(t,e,i,s,o),this.type=5}_$AI(t,e=this){if((t=Z(this,t,e,0)??q)===H)return;const i=this._$AH,s=t===q&&i!==q||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==q&&(i===q||s);s&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class ot{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Z(this,t)}}const rt={I:Q},nt=$.litHtmlPolyfillSupport;nt?.(Y,Q),($.litHtmlVersions??=[]).push("3.3.0");const lt=(t,e,i)=>{const s=i?.renderBefore??e;let o=s._$litPart$;if(void 0===o){const t=i?.renderBefore??null;s._$litPart$=o=new Q(e.insertBefore(E(),t),t,void 0,i??{})}return o._$AI(t),o},at=globalThis;let ht=class extends k{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=lt(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return H}};ht._$litElement$=!0,ht.finalized=!0,at.litElementHydrateSupport?.({LitElement:ht});const ct=at.litElementPolyfillSupport;ct?.({LitElement:ht}),(at.litElementVersions??=[]).push("4.2.0");const dt={attribute:!0,type:String,converter:x,reflect:!1,hasChanged:w},ut=(t=dt,e,i)=>{const{kind:s,metadata:o}=i;let r=globalThis.litPropertyMetadata.get(o);if(void 0===r&&globalThis.litPropertyMetadata.set(o,r=new Map),"setter"===s&&((t=Object.create(t)).wrapped=!0),r.set(i.name,t),"accessor"===s){const{name:s}=i;return{set(i){const o=e.get.call(this);e.set.call(this,i),this.requestUpdate(s,o,t)},init(e){return void 0!==e&&this.C(s,void 0,t,e),e}}}if("setter"===s){const{name:s}=i;return function(i){const o=this[s];e.call(this,i),this.requestUpdate(s,o,t)}}throw Error("Unsupported decorator location: "+s)};function pt(t){return(e,i)=>"object"==typeof i?ut(t,e,i):((t,e,i)=>{const s=e.hasOwnProperty(i);return e.constructor.createProperty(i,t),s?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)}function vt(t){return pt({...t,state:!0,attribute:!1})}const bt=(t,e,i)=>(i.configurable=!0,i.enumerable=!0,i);function ft(t,e){return(i,s,o)=>{const r=e=>e.renderRoot?.querySelector(t)??null;if(e){const{get:t,set:e}="object"==typeof s?i:o??(()=>{const t=Symbol();return{get(){return this[t]},set(e){this[t]=e}}})();return bt(0,0,{get(){let i=t.call(this);return void 0===i&&(i=r(this),(null!==i||this.hasUpdated)&&e.call(this,i)),i}})}return bt(0,0,{get(){return r(this)}})}}let gt;function mt(t){return(e,i)=>{const{slot:s,selector:o}=t??{},r="slot"+(s?`[name=${s}]`:":not([name])");return bt(0,0,{get(){const e=this.renderRoot?.querySelector(r),i=e?.assignedElements(t)??[];return void 0===o?i:i.filter((t=>t.matches(o)))}})}}const xt="2.3.1-pre.0",wt="__vscodeElements_disableRegistryWarning__";class yt extends ht{get version(){return xt}}const kt=t=>e=>{if(!customElements.get(t))return void customElements.define(t,e);if(wt in window)return;const i=document.createElement(t),s=i?.version;let o="";s?s!==xt?(o+="is already registered by a different version of VSCode Elements. ",o+=`This version is "${xt}", while the other one is "${s}".`):o+=`is already registered by the same version of VSCode Elements (${xt}).`:o+="is already registered by an unknown custom element handler class.",console.warn(`[VSCode Elements] ${t} ${o}\nTo suppress this warning, set window.${wt} to true`)};var $t=n`
|
|
2
2
|
:host([hidden]) {
|
|
3
3
|
display: none;
|
|
4
4
|
}
|
|
@@ -1897,7 +1897,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1897
1897
|
outline: 1px solid var(--vscode-focusBorder, #0078d4);
|
|
1898
1898
|
outline-offset: -1px;
|
|
1899
1899
|
}
|
|
1900
|
-
`];var di=function(t,e,i,s){for(var o,r=arguments.length,n=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(o=t[l])&&(n=(r<3?o(n):r>3?o(e,i,n):o(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};let ui=class extends(Xt(Wt)){constructor(){super(),this.autofocus=!1,this.checked=!1,this.defaultChecked=!1,this.invalid=!1,this.name="",this.value="",this.disabled=!1,this.required=!1,this.
|
|
1900
|
+
`];var di=function(t,e,i,s){for(var o,r=arguments.length,n=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(o=t[l])&&(n=(r<3?o(n):r>3?o(e,i,n):o(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};let ui=class extends(Xt(Wt)){get form(){return this._internals.form}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}constructor(){super(),this.autofocus=!1,this.checked=!1,this.defaultChecked=!1,this.invalid=!1,this.name="",this.type="radio",this.value="",this.disabled=!1,this.required=!1,this.tabIndex=0,this._slottedText="",this._handleClick=()=>{this.disabled||this.checked||(this._checkButton(),this._handleValueChange(),this.dispatchEvent(new Event("change",{bubbles:!0})))},this._handleKeyDown=t=>{this.disabled||"Enter"!==t.key&&" "!==t.key||(t.preventDefault()," "!==t.key||this.checked||(this.checked=!0,this._handleValueChange(),this.dispatchEvent(new Event("change",{bubbles:!0}))),"Enter"===t.key&&this._internals.form?.requestSubmit())},this._internals=this.attachInternals(),this.addEventListener("keydown",this._handleKeyDown),this.addEventListener("click",this._handleClick)}connectedCallback(){super.connectedCallback(),this._handleValueChange()}update(t){super.update(t),t.has("checked")&&this._handleValueChange(),t.has("required")&&this._handleValueChange()}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}formResetCallback(){this._getRadios().forEach((t=>{t.checked=t.defaultChecked})),this.updateComplete.then((()=>{this._handleValueChange()}))}formStateRestoreCallback(t,e){this.value===t&&""!==t&&(this.checked=!0)}setComponentValidity(t){t?this._internals.setValidity({}):this._internals.setValidity({valueMissing:!0},"Please select one of these options.",this._inputEl)}_getRadios(){const t=this.getRootNode({composed:!0});if(!t)return[];const e=t.querySelectorAll(`vscode-radio[name="${this.name}"]`);return Array.from(e)}_uncheckOthers(t){t.forEach((t=>{t!==this&&(t.checked=!1)}))}_checkButton(){const t=this._getRadios();this.checked=!0,t.forEach((t=>{t!==this&&(t.checked=!1)}))}_setGroupValidity(t,e){this.updateComplete.then((()=>{t.forEach((t=>{t.setComponentValidity(e)}))}))}_setActualFormValue(){let t="";t=this.checked?this.value?this.value:"on":null,this._internals.setFormValue(t)}_handleValueChange(){const t=this._getRadios(),e=t.some((t=>t.required));if(this._setActualFormValue(),this.checked)this._uncheckOthers(t),this._setGroupValidity(t,!0);else{const i=!!t.find((t=>t.checked)),s=e&&!i;this._setGroupValidity(t,!s)}}render(){const t=jt({icon:!0,checked:this.checked}),e=jt({"label-inner":!0,"is-slot-empty":""===this._slottedText});return U`
|
|
1901
1901
|
<div class="wrapper">
|
|
1902
1902
|
<input
|
|
1903
1903
|
?autofocus=${this.autofocus}
|
|
@@ -1916,7 +1916,7 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1916
1916
|
</span>
|
|
1917
1917
|
</label>
|
|
1918
1918
|
</div>
|
|
1919
|
-
`}};ui.styles=ci,ui.formAssociated=!0,ui.shadowRootOptions={...ht.shadowRootOptions,delegatesFocus:!0},di([pt({type:Boolean,reflect:!0})],ui.prototype,"autofocus",void 0),di([pt({type:Boolean,reflect:!0})],ui.prototype,"checked",void 0),di([pt({type:Boolean,reflect:!0,attribute:"default-checked"})],ui.prototype,"defaultChecked",void 0),di([pt({type:Boolean,reflect:!0})],ui.prototype,"invalid",void 0),di([pt({reflect:!0})],ui.prototype,"name",void 0),di([pt()],ui.prototype,"
|
|
1919
|
+
`}};ui.styles=ci,ui.formAssociated=!0,ui.shadowRootOptions={...ht.shadowRootOptions,delegatesFocus:!0},di([pt({type:Boolean,reflect:!0})],ui.prototype,"autofocus",void 0),di([pt({type:Boolean,reflect:!0})],ui.prototype,"checked",void 0),di([pt({type:Boolean,reflect:!0,attribute:"default-checked"})],ui.prototype,"defaultChecked",void 0),di([pt({type:Boolean,reflect:!0})],ui.prototype,"invalid",void 0),di([pt({reflect:!0})],ui.prototype,"name",void 0),di([pt()],ui.prototype,"type",void 0),di([pt()],ui.prototype,"value",void 0),di([pt({type:Boolean,reflect:!0})],ui.prototype,"disabled",void 0),di([pt({type:Boolean,reflect:!0})],ui.prototype,"required",void 0),di([pt({type:Number,reflect:!0})],ui.prototype,"tabIndex",void 0),di([vt()],ui.prototype,"_slottedText",void 0),di([ft("#input")],ui.prototype,"_inputEl",void 0),ui=di([kt("vscode-radio")],ui);const pi=[$t,n`
|
|
1920
1920
|
:host {
|
|
1921
1921
|
display: block;
|
|
1922
1922
|
}
|
|
@@ -1946,11 +1946,11 @@ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow
|
|
|
1946
1946
|
:host([variant='vertical']) ::slotted(vscode-radio:last-child) {
|
|
1947
1947
|
margin-bottom: 0;
|
|
1948
1948
|
}
|
|
1949
|
-
`];var vi=function(t,e,i,s){for(var o,r=arguments.length,n=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(o=t[l])&&(n=(r<3?o(n):r>3?o(e,i,n):o(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};let bi=class extends yt{constructor(){super(
|
|
1949
|
+
`];var vi=function(t,e,i,s){for(var o,r=arguments.length,n=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(o=t[l])&&(n=(r<3?o(n):r>3?o(e,i,n):o(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};let bi=class extends yt{constructor(){super(),this.variant="horizontal",this.role="radiogroup",this._focusedRadio=-1,this._checkedRadio=-1,this._firstContentLoaded=!1,this._handleKeyDown=t=>{const{key:e}=t;["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(e)&&t.preventDefault(),"ArrowRight"!==e&&"ArrowDown"!==e||this._checkNext(),"ArrowLeft"!==e&&"ArrowUp"!==e||this._checkPrev()},this.addEventListener("keydown",this._handleKeyDown)}_uncheckPreviousChecked(t,e){-1!==t&&(this._radios[t].checked=!1),-1!==e&&(this._radios[e].tabIndex=-1)}_afterCheck(){this._focusedRadio=this._checkedRadio,this._radios[this._checkedRadio].checked=!0,this._radios[this._checkedRadio].tabIndex=0,this._radios[this._checkedRadio].focus()}_checkPrev(){const t=this._radios.findIndex((t=>t.checked)),e=this._radios.findIndex((t=>t.focused)),i=-1!==e?e:t;this._uncheckPreviousChecked(t,e),this._checkedRadio=-1===i?this._radios.length-1:i-1>=0?i-1:this._radios.length-1,this._afterCheck()}_checkNext(){const t=this._radios.findIndex((t=>t.checked)),e=this._radios.findIndex((t=>t.focused)),i=-1!==e?e:t;this._uncheckPreviousChecked(t,e),-1===i?this._checkedRadio=0:i+1<this._radios.length?this._checkedRadio=i+1:this._checkedRadio=0,this._afterCheck()}_handleChange(t){const e=this._radios.findIndex((e=>e===t.target));-1!==e&&(-1!==this._focusedRadio&&(this._radios[this._focusedRadio].tabIndex=-1),-1!==this._checkedRadio&&this._checkedRadio!==e&&(this._radios[this._checkedRadio].checked=!1),this._focusedRadio=e,this._checkedRadio=e,this._radios[e].tabIndex=0)}_handleSlotChange(){if(!this._firstContentLoaded){const t=this._radios.findIndex((t=>t.autofocus));t>-1&&(this._focusedRadio=t),this._firstContentLoaded=!0}let t=-1;this._radios.forEach(((e,i)=>{this._focusedRadio>-1?e.tabIndex=i===this._focusedRadio?0:-1:e.tabIndex=0===i?0:-1,e.defaultChecked&&(t>-1&&(this._radios[t].defaultChecked=!1),t=i)})),t>-1&&(this._radios[t].checked=!0)}render(){return U`
|
|
1950
1950
|
<div class="wrapper">
|
|
1951
1951
|
<slot
|
|
1952
|
-
@slotchange=${this.
|
|
1953
|
-
@
|
|
1952
|
+
@slotchange=${this._handleSlotChange}
|
|
1953
|
+
@change=${this._handleChange}
|
|
1954
1954
|
></slot>
|
|
1955
1955
|
</div>
|
|
1956
1956
|
`}};bi.styles=pi,vi([pt({reflect:!0})],bi.prototype,"variant",void 0),vi([pt({reflect:!0})],bi.prototype,"role",void 0),vi([mt({selector:"vscode-radio"})],bi.prototype,"_radios",void 0),vi([vt()],bi.prototype,"_focusedRadio",void 0),vi([vt()],bi.prototype,"_checkedRadio",void 0),bi=vi([kt("vscode-radio-group")],bi);var fi=function(t,e,i,s){for(var o,r=arguments.length,n=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(o=t[l])&&(n=(r<3?o(n):r>3?o(e,i,n):o(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};let gi=class extends ti{set selectedIndex(t){this._opts.selectedIndex=t;const e=this._opts.getOptionByIndex(t);e?(this._opts.activeIndex=t,this._value=e.value,this._internals.setFormValue(this._value),this._manageRequired()):(this._value="",this._internals.setFormValue(""),this._manageRequired())}get selectedIndex(){return this._opts.selectedIndex}set value(t){this._opts.value=t,this._opts.selectedIndex>-1?this._requestedValueToSetLater="":this._requestedValueToSetLater=t,this._internals.setFormValue(this._value),this._manageRequired()}get value(){return this._opts.value}get validity(){return this._internals.validity}get validationMessage(){return this._internals.validationMessage}get willValidate(){return this._internals.willValidate}checkValidity(){return this._internals.checkValidity()}reportValidity(){return this._internals.reportValidity()}updateInputValue(){if(!this.combobox)return;const t=this.renderRoot.querySelector(".combobox-input");if(t){const e=this._opts.getSelectedOption();t.value=e?.label??""}}constructor(){super(),this.defaultValue="",this.name=void 0,this.required=!1,this._requestedValueToSetLater="",this._opts.multiSelect=!1,this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),this.updateComplete.then((()=>{this._manageRequired()}))}formResetCallback(){this.value=this.defaultValue}formStateRestoreCallback(t,e){this.updateComplete.then((()=>{this.value=t}))}get type(){return"select-one"}get form(){return this._internals.form}async _createAndSelectSuggestedOption(){const t=this._createSuggestedOption();await this.updateComplete,this._opts.selectedIndex=t,this._dispatchChangeEvent();const e=new CustomEvent("vsc-single-select-create-option",{detail:{value:this._opts.getOptionByIndex(t)?.value??""}});this.dispatchEvent(e),this.open=!1,this._isPlaceholderOptionActive=!1}_setStateFromSlottedElements(){super._setStateFromSlottedElements(),this.combobox||0!==this._opts.selectedIndexes.length||(this._opts.selectedIndex=this._opts.options.length>0?0:-1)}_onSlotChange(){if(super._onSlotChange(),this._requestedValueToSetLater){const t=this._opts.getOptionByValue(this._requestedValueToSetLater);t&&(this._opts.selectedIndex=t.index,this._requestedValueToSetLater="")}this._opts.selectedIndex>-1&&this._opts.numOptions>0?(this._internals.setFormValue(this._opts.value),this._manageRequired()):(this._internals.setFormValue(null),this._manageRequired())}_onEnterKeyDown(t){super._onEnterKeyDown(t);let e=!1;this.combobox?this.open?this._isPlaceholderOptionActive?this._createAndSelectSuggestedOption():(e=this._opts.activeIndex!==this._opts.selectedIndex,this._opts.selectedIndex=this._opts.activeIndex,this.open=!1):(this.open=!0,this._scrollActiveElementToTop()):this.open?(e=this._opts.activeIndex!==this._opts.selectedIndex,this._opts.selectedIndex=this._opts.activeIndex,this.open=!1):(this.open=!0,this._scrollActiveElementToTop()),e&&(this._dispatchChangeEvent(),this.updateInputValue(),this._internals.setFormValue(this._opts.value),this._manageRequired())}_onOptionClick(t){super._onOptionClick(t);const e=t.composedPath().find((t=>{if("matches"in t)return t.matches("li.option")}));if(!e||e.matches(".disabled"))return;e.classList.contains("placeholder")?this.creatable&&this._createAndSelectSuggestedOption():(this._opts.selectedIndex=Number(e.dataset.index),this.open=!1,this._internals.setFormValue(this._value),this._manageRequired(),this._dispatchChangeEvent())}_manageRequired(){const{value:t}=this;""===t&&this.required?this._internals.setValidity({valueMissing:!0},"Please select an item in the list.",this._face):this._internals.setValidity({})}_renderSelectFace(){const t=this._opts.getSelectedOption(),e=t?.label??"",i=this._opts.activeIndex>-1?`op-${this._opts.activeIndex}`:"";return U`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VscElement.js","sourceRoot":"","sources":["../../src/includes/VscElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,KAAK,CAAC;AAE/B,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"VscElement.js","sourceRoot":"","sources":["../../src/includes/VscElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,KAAK,CAAC;AAE/B,MAAM,OAAO,GAAG,aAAa,CAAC;AAC9B,MAAM,UAAU,GAAG,2CAA2C,CAAC;AAE/D,MAAM,OAAO,UAAW,SAAQ,UAAU;IACxC,8BAA8B;IAC9B,IAAI,OAAO;QACT,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AASD;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,EAAE;IAC/C,OAAO,CAAC,aAAiC,EAAE,EAAE;QAC3C,MAAM,kBAAkB,GAAG,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAEvD,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACxB,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,aAAyC,CAAC,CAAC;YAC1E,OAAO;QACT,CAAC;QAED,IAAI,UAAU,IAAI,MAAM,EAAE,CAAC;YACzB,OAAO;QACT,CAAC;QAED,MAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAC3C,MAAM,cAAc,GAAI,EAAiB,EAAE,OAAO,CAAC;QACnD,IAAI,OAAO,GAAG,EAAE,CAAC;QAEjB,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,OAAO;gBACL,mEAAmE,CAAC;QACxE,CAAC;aAAM,IAAI,cAAc,KAAK,OAAO,EAAE,CAAC;YACtC,OAAO;gBACL,mEAAmE,CAAC;YACtE,OAAO,IAAI,oBAAoB,OAAO,8BAA8B,cAAc,IAAI,CAAC;QACzF,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,iEAAiE,OAAO,IAAI,CAAC;QAC1F,CAAC;QAED,sCAAsC;QACtC,OAAO,CAAC,IAAI,CACV,qBAAqB,OAAO,IAAI,OAAO,0CAA0C,UAAU,UAAU,CACtG,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {LitElement} from 'lit';\n\nconst VERSION = '2.3.1-pre.0';\nconst CONFIG_KEY = '__vscodeElements_disableRegistryWarning__';\n\nexport class VscElement extends LitElement {\n /** VSCode Elements version */\n get version(): string {\n return VERSION;\n }\n}\n\ntype CustomElementClass = Omit<typeof HTMLElement, 'new'>;\n\nexport type Constructor<T> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n};\n\n/**\n * Own implementation of Lit's customElement decorator.\n */\nexport const customElement = (tagName: string) => {\n return (classOrTarget: CustomElementClass) => {\n const customElementClass = customElements.get(tagName);\n\n if (!customElementClass) {\n customElements.define(tagName, classOrTarget as CustomElementConstructor);\n return;\n }\n\n if (CONFIG_KEY in window) {\n return;\n }\n\n const el = document.createElement(tagName);\n const anotherVersion = (el as VscElement)?.version;\n let message = '';\n\n if (!anotherVersion) {\n message +=\n 'is already registered by an unknown custom element handler class.';\n } else if (anotherVersion !== VERSION) {\n message +=\n 'is already registered by a different version of VSCode Elements. ';\n message += `This version is \"${VERSION}\", while the other one is \"${anotherVersion}\".`;\n } else {\n message += `is already registered by the same version of VSCode Elements (${VERSION}).`;\n }\n\n // eslint-disable-next-line no-console\n console.warn(\n `[VSCode Elements] ${tagName} ${message}\\nTo suppress this warning, set window.${CONFIG_KEY} to true`\n );\n };\n};\n"]}
|
|
@@ -42,39 +42,36 @@ export declare class VscodeRadio extends VscodeRadio_base implements AssociatedF
|
|
|
42
42
|
* Name which is used as a variable name in the data of the form-container.
|
|
43
43
|
*/
|
|
44
44
|
name: string;
|
|
45
|
+
/** @internal */
|
|
46
|
+
type: string;
|
|
45
47
|
value: string;
|
|
46
48
|
disabled: boolean;
|
|
47
49
|
required: boolean;
|
|
48
50
|
/** @internal */
|
|
49
|
-
role: string;
|
|
50
|
-
/** @internal */
|
|
51
51
|
tabIndex: number;
|
|
52
|
+
get form(): HTMLFormElement | null;
|
|
53
|
+
get validity(): ValidityState;
|
|
54
|
+
get validationMessage(): string;
|
|
55
|
+
get willValidate(): boolean;
|
|
52
56
|
private _slottedText;
|
|
53
57
|
private _inputEl;
|
|
54
58
|
private _internals;
|
|
55
59
|
constructor();
|
|
56
60
|
connectedCallback(): void;
|
|
57
|
-
disconnectedCallback(): void;
|
|
58
61
|
update(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
|
59
|
-
get form(): HTMLFormElement | null;
|
|
60
|
-
/** @internal */
|
|
61
|
-
type: string;
|
|
62
|
-
get validity(): ValidityState;
|
|
63
|
-
get validationMessage(): string;
|
|
64
|
-
get willValidate(): boolean;
|
|
65
62
|
checkValidity(): boolean;
|
|
66
63
|
reportValidity(): boolean;
|
|
67
64
|
/** @internal */
|
|
68
65
|
formResetCallback(): void;
|
|
69
66
|
/** @internal */
|
|
70
67
|
formStateRestoreCallback(state: string, _mode: 'restore' | 'autocomplete'): void;
|
|
71
|
-
private _getRadios;
|
|
72
|
-
private _uncheckOthers;
|
|
73
|
-
private _checkButton;
|
|
74
68
|
/**
|
|
75
69
|
* @internal
|
|
76
70
|
*/
|
|
77
71
|
setComponentValidity(isValid: boolean): void;
|
|
72
|
+
private _getRadios;
|
|
73
|
+
private _uncheckOthers;
|
|
74
|
+
private _checkButton;
|
|
78
75
|
private _setGroupValidity;
|
|
79
76
|
private _setActualFormValue;
|
|
80
77
|
private _handleValueChange;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vscode-radio.d.ts","sourceRoot":"","sources":["../../src/vscode-radio/vscode-radio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,gBAAgB,EAAE,cAAc,EAAC,MAAM,KAAK,CAAC;AAIvE,OAAO,EAAC,oBAAoB,EAAC,MAAM,wDAAwD,CAAC;AAG5F,OAAO,EAAC,qBAAqB,EAAC,MAAM,sCAAsC,CAAC;;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBACa,WACX,SAAQ,gBACR,YAAW,qBAAqB;IAEhC,OAAgB,MAAM,+BAAU;IAEhC,gBAAgB;IAChB,MAAM,CAAC,cAAc,UAAQ;IAE7B,gBAAgB;IAChB,OAAgB,iBAAiB,EAAE,cAAc,CAG/C;
|
|
1
|
+
{"version":3,"file":"vscode-radio.d.ts","sourceRoot":"","sources":["../../src/vscode-radio/vscode-radio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,gBAAgB,EAAE,cAAc,EAAC,MAAM,KAAK,CAAC;AAIvE,OAAO,EAAC,oBAAoB,EAAC,MAAM,wDAAwD,CAAC;AAG5F,OAAO,EAAC,qBAAqB,EAAC,MAAM,sCAAsC,CAAC;;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBACa,WACX,SAAQ,gBACR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,CAAC,cAAc,GAAI,IAAI,aAAa,KAAG,IAAI,CAclD;IAIO,MAAM,IAAI,cAAc;CA+BlC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
|
|
@@ -38,8 +38,23 @@ import styles from './vscode-radio.styles.js';
|
|
|
38
38
|
* @cssprop [--vscode-inputValidation-errorBorder=#be1100]
|
|
39
39
|
*/
|
|
40
40
|
let VscodeRadio = class VscodeRadio extends LabelledCheckboxOrRadioMixin(FormButtonWidgetBase) {
|
|
41
|
+
get form() {
|
|
42
|
+
return this._internals.form;
|
|
43
|
+
}
|
|
44
|
+
get validity() {
|
|
45
|
+
return this._internals.validity;
|
|
46
|
+
}
|
|
47
|
+
get validationMessage() {
|
|
48
|
+
return this._internals.validationMessage;
|
|
49
|
+
}
|
|
50
|
+
get willValidate() {
|
|
51
|
+
return this._internals.willValidate;
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region lifecycle methods
|
|
41
55
|
constructor() {
|
|
42
56
|
super();
|
|
57
|
+
//#region properties
|
|
43
58
|
this.autofocus = false;
|
|
44
59
|
this.checked = false;
|
|
45
60
|
this.defaultChecked = false;
|
|
@@ -48,16 +63,16 @@ let VscodeRadio = class VscodeRadio extends LabelledCheckboxOrRadioMixin(FormBut
|
|
|
48
63
|
* Name which is used as a variable name in the data of the form-container.
|
|
49
64
|
*/
|
|
50
65
|
this.name = '';
|
|
66
|
+
/** @internal */
|
|
67
|
+
this.type = 'radio';
|
|
51
68
|
this.value = '';
|
|
52
69
|
this.disabled = false;
|
|
53
70
|
this.required = false;
|
|
54
71
|
/** @internal */
|
|
55
|
-
this.role = 'radio';
|
|
56
|
-
/** @internal */
|
|
57
72
|
this.tabIndex = 0;
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region private variables
|
|
58
75
|
this._slottedText = '';
|
|
59
|
-
/** @internal */
|
|
60
|
-
this.type = 'radio';
|
|
61
76
|
this._handleClick = () => {
|
|
62
77
|
if (this.disabled) {
|
|
63
78
|
return;
|
|
@@ -82,18 +97,13 @@ let VscodeRadio = class VscodeRadio extends LabelledCheckboxOrRadioMixin(FormBut
|
|
|
82
97
|
}
|
|
83
98
|
};
|
|
84
99
|
this._internals = this.attachInternals();
|
|
100
|
+
this.addEventListener('keydown', this._handleKeyDown);
|
|
101
|
+
this.addEventListener('click', this._handleClick);
|
|
85
102
|
}
|
|
86
103
|
connectedCallback() {
|
|
87
104
|
super.connectedCallback();
|
|
88
|
-
this.addEventListener('keydown', this._handleKeyDown);
|
|
89
|
-
this.addEventListener('click', this._handleClick);
|
|
90
105
|
this._handleValueChange();
|
|
91
106
|
}
|
|
92
|
-
disconnectedCallback() {
|
|
93
|
-
super.disconnectedCallback();
|
|
94
|
-
this.removeEventListener('keydown', this._handleKeyDown);
|
|
95
|
-
this.removeEventListener('click', this._handleClick);
|
|
96
|
-
}
|
|
97
107
|
update(
|
|
98
108
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
99
109
|
changedProperties) {
|
|
@@ -105,18 +115,8 @@ let VscodeRadio = class VscodeRadio extends LabelledCheckboxOrRadioMixin(FormBut
|
|
|
105
115
|
this._handleValueChange();
|
|
106
116
|
}
|
|
107
117
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
get validity() {
|
|
112
|
-
return this._internals.validity;
|
|
113
|
-
}
|
|
114
|
-
get validationMessage() {
|
|
115
|
-
return this._internals.validationMessage;
|
|
116
|
-
}
|
|
117
|
-
get willValidate() {
|
|
118
|
-
return this._internals.willValidate;
|
|
119
|
-
}
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region public methods
|
|
120
120
|
checkValidity() {
|
|
121
121
|
return this._internals.checkValidity();
|
|
122
122
|
}
|
|
@@ -139,6 +139,21 @@ let VscodeRadio = class VscodeRadio extends LabelledCheckboxOrRadioMixin(FormBut
|
|
|
139
139
|
this.checked = true;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* @internal
|
|
144
|
+
*/
|
|
145
|
+
setComponentValidity(isValid) {
|
|
146
|
+
if (isValid) {
|
|
147
|
+
this._internals.setValidity({});
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
this._internals.setValidity({
|
|
151
|
+
valueMissing: true,
|
|
152
|
+
}, 'Please select one of these options.', this._inputEl);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region private methods
|
|
142
157
|
_getRadios() {
|
|
143
158
|
const root = this.getRootNode({ composed: true });
|
|
144
159
|
if (!root) {
|
|
@@ -163,19 +178,6 @@ let VscodeRadio = class VscodeRadio extends LabelledCheckboxOrRadioMixin(FormBut
|
|
|
163
178
|
}
|
|
164
179
|
});
|
|
165
180
|
}
|
|
166
|
-
/**
|
|
167
|
-
* @internal
|
|
168
|
-
*/
|
|
169
|
-
setComponentValidity(isValid) {
|
|
170
|
-
if (isValid) {
|
|
171
|
-
this._internals.setValidity({});
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
this._internals.setValidity({
|
|
175
|
-
valueMissing: true,
|
|
176
|
-
}, 'Please select one of these options.', this._inputEl);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
181
|
_setGroupValidity(radios, isValid) {
|
|
180
182
|
this.updateComplete.then(() => {
|
|
181
183
|
radios.forEach((r) => {
|
|
@@ -193,6 +195,8 @@ let VscodeRadio = class VscodeRadio extends LabelledCheckboxOrRadioMixin(FormBut
|
|
|
193
195
|
}
|
|
194
196
|
this._internals.setFormValue(actualValue);
|
|
195
197
|
}
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region event handlers
|
|
196
200
|
_handleValueChange() {
|
|
197
201
|
const radios = this._getRadios();
|
|
198
202
|
const anyRequired = radios.some((r) => {
|
|
@@ -209,6 +213,7 @@ let VscodeRadio = class VscodeRadio extends LabelledCheckboxOrRadioMixin(FormBut
|
|
|
209
213
|
this._setGroupValidity(radios, !isInvalid);
|
|
210
214
|
}
|
|
211
215
|
}
|
|
216
|
+
//#endregion
|
|
212
217
|
render() {
|
|
213
218
|
const iconClasses = classMap({
|
|
214
219
|
icon: true,
|
|
@@ -263,6 +268,9 @@ __decorate([
|
|
|
263
268
|
__decorate([
|
|
264
269
|
property({ reflect: true })
|
|
265
270
|
], VscodeRadio.prototype, "name", void 0);
|
|
271
|
+
__decorate([
|
|
272
|
+
property()
|
|
273
|
+
], VscodeRadio.prototype, "type", void 0);
|
|
266
274
|
__decorate([
|
|
267
275
|
property()
|
|
268
276
|
], VscodeRadio.prototype, "value", void 0);
|
|
@@ -272,9 +280,6 @@ __decorate([
|
|
|
272
280
|
__decorate([
|
|
273
281
|
property({ type: Boolean, reflect: true })
|
|
274
282
|
], VscodeRadio.prototype, "required", void 0);
|
|
275
|
-
__decorate([
|
|
276
|
-
property({ reflect: true })
|
|
277
|
-
], VscodeRadio.prototype, "role", void 0);
|
|
278
283
|
__decorate([
|
|
279
284
|
property({ type: Number, reflect: true })
|
|
280
285
|
], VscodeRadio.prototype, "tabIndex", void 0);
|
|
@@ -284,9 +289,6 @@ __decorate([
|
|
|
284
289
|
__decorate([
|
|
285
290
|
query('#input')
|
|
286
291
|
], VscodeRadio.prototype, "_inputEl", void 0);
|
|
287
|
-
__decorate([
|
|
288
|
-
property()
|
|
289
|
-
], VscodeRadio.prototype, "type", void 0);
|
|
290
292
|
VscodeRadio = __decorate([
|
|
291
293
|
customElement('vscode-radio')
|
|
292
294
|
], VscodeRadio);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vscode-radio.js","sourceRoot":"","sources":["../../src/vscode-radio/vscode-radio.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,IAAI,EAAE,UAAU,EAAmC,MAAM,KAAK,CAAC;AACvE,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACzD,OAAO,E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AAQ,EAAE;0CACA;AAGX;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;6CACxB;AAGjB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;6CACxB;AAIR;IADR,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;yCACF;AAIf;IADR,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;6CAClB;AAGd;IADP,KAAK,EAAE;iDACkB;AAGlB;IADP,KAAK,CAAC,QAAQ,CAAC;6CACoB;AA8CpC;IADC,QAAQ,EAAE;yCACI;AApGJ,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAqSvB","sourcesContent":["import {html, LitElement, PropertyValueMap, TemplateResult} from 'lit';\nimport {property, state, query} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {customElement} from '../includes/VscElement.js';\nimport {FormButtonWidgetBase} from '../includes/form-button-widget/FormButtonWidgetBase.js';\nimport {LabelledCheckboxOrRadioMixin} from '../includes/form-button-widget/LabelledCheckboxOrRadio.js';\nimport styles from './vscode-radio.styles.js';\nimport {AssociatedFormControl} from '../includes/AssociatedFormControl.js';\n\n/**\n * When participating in a form, it supports the `:invalid` pseudo class. Otherwise the error styles\n * can be applied through the `invalid` property.\n *\n * @tag vscode-radio\n *\n * @attr name - Name which is used as a variable name in the data of the form-container.\n * @attr label - Attribute pair of the `label` property.\n *\n * @prop label - Label text. It is only applied if component's innerHTML doesn't contain any text.\n *\n * @fires {Event} change - Dispatched when checked state is changed.\n * @fires {Event} invalid - Dispatched when the element is invalid and `checkValidity()` has been called or the form containing this element is submitted.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/invalid_event)\n *\n * @cssprop [--vscode-font-family=sans-serif]\n * @cssprop [--vscode-font-size=13px]\n * @cssprop [--vscode-font-weight=normal]\n * @cssprop [--vscode-settings-checkboxBackground=#313131]\n * @cssprop [--vscode-settings-checkboxBorder=#3c3c3c]\n * @cssprop [--vscode-settings-checkboxForeground=#cccccc]\n * @cssprop [--vscode-focusBorder=#0078d4]\n * @cssprop [--vscode-inputValidation-errorBackground=#5a1d1d]\n * @cssprop [--vscode-inputValidation-errorBorder=#be1100]\n */\n@customElement('vscode-radio')\nexport class VscodeRadio\n extends LabelledCheckboxOrRadioMixin(FormButtonWidgetBase)\n implements AssociatedFormControl\n{\n static override styles = styles;\n\n /** @internal */\n static formAssociated = true;\n\n /** @internal */\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n @property({type: Boolean, reflect: true})\n override autofocus = false;\n\n @property({type: Boolean, reflect: true})\n checked = false;\n\n @property({type: Boolean, reflect: true, attribute: 'default-checked'})\n defaultChecked = false;\n\n @property({type: Boolean, reflect: true})\n invalid = false;\n\n /**\n * Name which is used as a variable name in the data of the form-container.\n */\n @property({reflect: true})\n name = '';\n\n @property()\n value = '';\n\n @property({type: Boolean, reflect: true})\n disabled = false;\n\n @property({type: Boolean, reflect: true})\n required = false;\n\n /** @internal */\n @property({reflect: true})\n override role = 'radio';\n\n /** @internal */\n @property({type: Number, reflect: true})\n override tabIndex = 0;\n\n @state()\n private _slottedText = '';\n\n @query('#input')\n private _inputEl!: HTMLInputElement;\n\n private _internals: ElementInternals;\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n\n this.addEventListener('keydown', this._handleKeyDown);\n this.addEventListener('click', this._handleClick);\n\n this._handleValueChange();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n\n this.removeEventListener('keydown', this._handleKeyDown);\n this.removeEventListener('click', this._handleClick);\n }\n\n override update(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n super.update(changedProperties);\n\n if (changedProperties.has('checked')) {\n this._handleValueChange();\n }\n\n if (changedProperties.has('required')) {\n this._handleValueChange();\n }\n }\n\n get form(): HTMLFormElement | null {\n return this._internals.form;\n }\n\n /** @internal */\n @property()\n type = 'radio';\n\n get validity(): ValidityState {\n return this._internals.validity;\n }\n\n get validationMessage(): string {\n return this._internals.validationMessage;\n }\n\n get willValidate(): boolean {\n return this._internals.willValidate;\n }\n\n checkValidity(): boolean {\n return this._internals.checkValidity();\n }\n\n reportValidity(): boolean {\n return this._internals.reportValidity();\n }\n\n /** @internal */\n formResetCallback(): void {\n const radios = this._getRadios();\n\n radios.forEach((r) => {\n r.checked = r.defaultChecked;\n });\n\n this.updateComplete.then(() => {\n this._handleValueChange();\n });\n }\n\n /** @internal */\n formStateRestoreCallback(\n state: string,\n _mode: 'restore' | 'autocomplete'\n ): void {\n if (this.value === state && state !== '') {\n this.checked = true;\n }\n }\n\n private _getRadios(): VscodeRadio[] {\n const root = this.getRootNode({composed: true}) as Document | ShadowRoot;\n\n if (!root) {\n return [];\n }\n\n const radios = root.querySelectorAll(\n `vscode-radio[name=\"${this.name}\"]`\n ) as NodeListOf<VscodeRadio>;\n\n return Array.from(radios);\n }\n\n private _uncheckOthers(radios: VscodeRadio[]) {\n radios.forEach((r) => {\n if (r !== this) {\n r.checked = false;\n }\n });\n }\n\n private _checkButton() {\n const radios = this._getRadios();\n this.checked = true;\n\n radios.forEach((r) => {\n if (r !== this) {\n r.checked = false;\n }\n });\n }\n\n /**\n * @internal\n */\n setComponentValidity(isValid: boolean) {\n if (isValid) {\n this._internals.setValidity({});\n } else {\n this._internals.setValidity(\n {\n valueMissing: true,\n },\n 'Please select one of these options.',\n this._inputEl\n );\n }\n }\n\n private _setGroupValidity(radios: VscodeRadio[], isValid: boolean) {\n this.updateComplete.then(() => {\n radios.forEach((r) => {\n r.setComponentValidity(isValid);\n });\n });\n }\n\n private _setActualFormValue() {\n let actualValue: string | null = '';\n\n if (this.checked) {\n actualValue = !this.value ? 'on' : this.value;\n } else {\n actualValue = null;\n }\n\n this._internals.setFormValue(actualValue);\n }\n\n private _handleValueChange() {\n const radios = this._getRadios();\n const anyRequired = radios.some((r) => {\n return r.required;\n });\n\n this._setActualFormValue();\n\n if (this.checked) {\n this._uncheckOthers(radios);\n this._setGroupValidity(radios, true);\n } else {\n const anyChecked = !!radios.find((r) => r.checked);\n const isInvalid = anyRequired && !anyChecked;\n\n this._setGroupValidity(radios, !isInvalid);\n }\n }\n\n private _handleClick = (): void => {\n if (this.disabled) {\n return;\n }\n\n if (!this.checked) {\n this._checkButton();\n this._handleValueChange();\n this.dispatchEvent(new Event('change', {bubbles: true}));\n }\n };\n\n protected _handleKeyDown = (ev: KeyboardEvent): void => {\n if (!this.disabled && (ev.key === 'Enter' || ev.key === ' ')) {\n ev.preventDefault();\n\n if (ev.key === ' ' && !this.checked) {\n this.checked = true;\n this._handleValueChange();\n this.dispatchEvent(new Event('change', {bubbles: true}));\n }\n\n if (ev.key === 'Enter') {\n this._internals.form?.requestSubmit();\n }\n }\n };\n\n override render(): TemplateResult {\n const iconClasses = classMap({\n icon: true,\n checked: this.checked,\n });\n const labelInnerClasses = classMap({\n 'label-inner': true,\n 'is-slot-empty': this._slottedText === '',\n });\n\n return html`\n <div class=\"wrapper\">\n <input\n ?autofocus=${this.autofocus}\n id=\"input\"\n class=\"radio\"\n type=\"checkbox\"\n ?checked=${this.checked}\n value=${this.value}\n tabindex=${this.tabIndex}\n >\n <div class=${iconClasses}></div>\n <label for=\"input\" class=\"label\" @click=${this._handleClick}>\n <span class=${labelInnerClasses}>\n ${this._renderLabelAttribute()}\n <slot @slotchange=${this._handleSlotChange}></slot>\n </span>\n </label>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vscode-radio': VscodeRadio;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"vscode-radio.js","sourceRoot":"","sources":["../../src/vscode-radio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;4CACzB;AAMhB;IADC,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;yCAChB;AAIV;IADC,QAAQ,EAAE;yCACI;AAGf;IADC,QAAQ,EAAE;0CACA;AAGX;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;6CACxB;AAGjB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;6CACxB;AAIR;IADR,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;6CAClB;AAuBd;IADP,KAAK,EAAE;iDACkB;AAGlB;IADP,KAAK,CAAC,QAAQ,CAAC;6CACoB;AA5EzB,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAkTvB","sourcesContent":["import {html, LitElement, PropertyValueMap, TemplateResult} from 'lit';\nimport {property, state, query} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {customElement} from '../includes/VscElement.js';\nimport {FormButtonWidgetBase} from '../includes/form-button-widget/FormButtonWidgetBase.js';\nimport {LabelledCheckboxOrRadioMixin} from '../includes/form-button-widget/LabelledCheckboxOrRadio.js';\nimport styles from './vscode-radio.styles.js';\nimport {AssociatedFormControl} from '../includes/AssociatedFormControl.js';\n\n/**\n * When participating in a form, it supports the `:invalid` pseudo class. Otherwise the error styles\n * can be applied through the `invalid` property.\n *\n * @tag vscode-radio\n *\n * @attr name - Name which is used as a variable name in the data of the form-container.\n * @attr label - Attribute pair of the `label` property.\n *\n * @prop label - Label text. It is only applied if component's innerHTML doesn't contain any text.\n *\n * @fires {Event} change - Dispatched when checked state is changed.\n * @fires {Event} invalid - Dispatched when the element is invalid and `checkValidity()` has been called or the form containing this element is submitted.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/invalid_event)\n *\n * @cssprop [--vscode-font-family=sans-serif]\n * @cssprop [--vscode-font-size=13px]\n * @cssprop [--vscode-font-weight=normal]\n * @cssprop [--vscode-settings-checkboxBackground=#313131]\n * @cssprop [--vscode-settings-checkboxBorder=#3c3c3c]\n * @cssprop [--vscode-settings-checkboxForeground=#cccccc]\n * @cssprop [--vscode-focusBorder=#0078d4]\n * @cssprop [--vscode-inputValidation-errorBackground=#5a1d1d]\n * @cssprop [--vscode-inputValidation-errorBorder=#be1100]\n */\n@customElement('vscode-radio')\nexport class VscodeRadio\n extends LabelledCheckboxOrRadioMixin(FormButtonWidgetBase)\n implements AssociatedFormControl\n{\n static override styles = styles;\n\n /** @internal */\n static formAssociated = true;\n\n /** @internal */\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n //#region properties\n\n @property({type: Boolean, reflect: true})\n override autofocus = false;\n\n @property({type: Boolean, reflect: true})\n checked = false;\n\n @property({type: Boolean, reflect: true, attribute: 'default-checked'})\n defaultChecked = false;\n\n @property({type: Boolean, reflect: true})\n invalid = false;\n\n /**\n * Name which is used as a variable name in the data of the form-container.\n */\n @property({reflect: true})\n name = '';\n\n /** @internal */\n @property()\n type = 'radio';\n\n @property()\n value = '';\n\n @property({type: Boolean, reflect: true})\n disabled = false;\n\n @property({type: Boolean, reflect: true})\n required = false;\n\n /** @internal */\n @property({type: Number, reflect: true})\n override tabIndex = 0;\n\n get form(): HTMLFormElement | null {\n return this._internals.form;\n }\n\n get validity(): ValidityState {\n return this._internals.validity;\n }\n\n get validationMessage(): string {\n return this._internals.validationMessage;\n }\n\n get willValidate(): boolean {\n return this._internals.willValidate;\n }\n\n //#endregion\n\n //#region private variables\n\n @state()\n private _slottedText = '';\n\n @query('#input')\n private _inputEl!: HTMLInputElement;\n\n private _internals: ElementInternals;\n\n //#endregion\n\n //#region lifecycle methods\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n\n this.addEventListener('keydown', this._handleKeyDown);\n this.addEventListener('click', this._handleClick);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n\n this._handleValueChange();\n }\n\n override update(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n super.update(changedProperties);\n\n if (changedProperties.has('checked')) {\n this._handleValueChange();\n }\n\n if (changedProperties.has('required')) {\n this._handleValueChange();\n }\n }\n\n //#endregion\n\n //#region public methods\n\n checkValidity(): boolean {\n return this._internals.checkValidity();\n }\n\n reportValidity(): boolean {\n return this._internals.reportValidity();\n }\n\n /** @internal */\n formResetCallback(): void {\n const radios = this._getRadios();\n\n radios.forEach((r) => {\n r.checked = r.defaultChecked;\n });\n\n this.updateComplete.then(() => {\n this._handleValueChange();\n });\n }\n\n /** @internal */\n formStateRestoreCallback(\n state: string,\n _mode: 'restore' | 'autocomplete'\n ): void {\n if (this.value === state && state !== '') {\n this.checked = true;\n }\n }\n\n /**\n * @internal\n */\n setComponentValidity(isValid: boolean) {\n if (isValid) {\n this._internals.setValidity({});\n } else {\n this._internals.setValidity(\n {\n valueMissing: true,\n },\n 'Please select one of these options.',\n this._inputEl\n );\n }\n }\n\n //#endregion\n\n //#region private methods\n\n private _getRadios(): VscodeRadio[] {\n const root = this.getRootNode({composed: true}) as Document | ShadowRoot;\n\n if (!root) {\n return [];\n }\n\n const radios = root.querySelectorAll(\n `vscode-radio[name=\"${this.name}\"]`\n ) as NodeListOf<VscodeRadio>;\n\n return Array.from(radios);\n }\n\n private _uncheckOthers(radios: VscodeRadio[]) {\n radios.forEach((r) => {\n if (r !== this) {\n r.checked = false;\n }\n });\n }\n\n private _checkButton() {\n const radios = this._getRadios();\n this.checked = true;\n\n radios.forEach((r) => {\n if (r !== this) {\n r.checked = false;\n }\n });\n }\n\n private _setGroupValidity(radios: VscodeRadio[], isValid: boolean) {\n this.updateComplete.then(() => {\n radios.forEach((r) => {\n r.setComponentValidity(isValid);\n });\n });\n }\n\n private _setActualFormValue() {\n let actualValue: string | null = '';\n\n if (this.checked) {\n actualValue = !this.value ? 'on' : this.value;\n } else {\n actualValue = null;\n }\n\n this._internals.setFormValue(actualValue);\n }\n\n //#endregion\n\n //#region event handlers\n\n private _handleValueChange() {\n const radios = this._getRadios();\n const anyRequired = radios.some((r) => {\n return r.required;\n });\n\n this._setActualFormValue();\n\n if (this.checked) {\n this._uncheckOthers(radios);\n this._setGroupValidity(radios, true);\n } else {\n const anyChecked = !!radios.find((r) => r.checked);\n const isInvalid = anyRequired && !anyChecked;\n\n this._setGroupValidity(radios, !isInvalid);\n }\n }\n\n private _handleClick = (): void => {\n if (this.disabled) {\n return;\n }\n\n if (!this.checked) {\n this._checkButton();\n this._handleValueChange();\n this.dispatchEvent(new Event('change', {bubbles: true}));\n }\n };\n\n protected _handleKeyDown = (ev: KeyboardEvent): void => {\n if (!this.disabled && (ev.key === 'Enter' || ev.key === ' ')) {\n ev.preventDefault();\n\n if (ev.key === ' ' && !this.checked) {\n this.checked = true;\n this._handleValueChange();\n this.dispatchEvent(new Event('change', {bubbles: true}));\n }\n\n if (ev.key === 'Enter') {\n this._internals.form?.requestSubmit();\n }\n }\n };\n\n //#endregion\n\n override render(): TemplateResult {\n const iconClasses = classMap({\n icon: true,\n checked: this.checked,\n });\n const labelInnerClasses = classMap({\n 'label-inner': true,\n 'is-slot-empty': this._slottedText === '',\n });\n\n return html`\n <div class=\"wrapper\">\n <input\n ?autofocus=${this.autofocus}\n id=\"input\"\n class=\"radio\"\n type=\"checkbox\"\n ?checked=${this.checked}\n value=${this.value}\n tabindex=${this.tabIndex}\n >\n <div class=${iconClasses}></div>\n <label for=\"input\" class=\"label\" @click=${this._handleClick}>\n <span class=${labelInnerClasses}>\n ${this._renderLabelAttribute()}\n <slot @slotchange=${this._handleSlotChange}></slot>\n </span>\n </label>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vscode-radio': VscodeRadio;\n }\n}\n"]}
|
|
@@ -10,20 +10,18 @@ export declare class VscodeRadioGroup extends VscElement {
|
|
|
10
10
|
variant: 'horizontal' | 'vertical';
|
|
11
11
|
/** @internal */
|
|
12
12
|
role: string;
|
|
13
|
-
connectedCallback(): void;
|
|
14
|
-
disconnectedCallback(): void;
|
|
15
13
|
private _radios;
|
|
16
14
|
private _focusedRadio;
|
|
17
15
|
private _checkedRadio;
|
|
18
16
|
private _firstContentLoaded;
|
|
17
|
+
constructor();
|
|
19
18
|
private _uncheckPreviousChecked;
|
|
20
19
|
private _afterCheck;
|
|
21
20
|
private _checkPrev;
|
|
22
21
|
private _checkNext;
|
|
23
|
-
private
|
|
24
|
-
private
|
|
25
|
-
private
|
|
26
|
-
private _onSlotChange;
|
|
22
|
+
private _handleKeyDown;
|
|
23
|
+
private _handleChange;
|
|
24
|
+
private _handleSlotChange;
|
|
27
25
|
render(): TemplateResult;
|
|
28
26
|
}
|
|
29
27
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vscode-radio-group.d.ts","sourceRoot":"","sources":["../../src/vscode-radio-group/vscode-radio-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,cAAc,EAAC,MAAM,KAAK,CAAC;AAEzC,OAAO,EAAgB,UAAU,EAAC,MAAM,2BAA2B,CAAC;AAIpE;;;;GAIG;AACH,qBACa,gBAAiB,SAAQ,UAAU;IAC9C,OAAgB,MAAM,+BAAU;
|
|
1
|
+
{"version":3,"file":"vscode-radio-group.d.ts","sourceRoot":"","sources":["../../src/vscode-radio-group/vscode-radio-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,cAAc,EAAC,MAAM,KAAK,CAAC;AAEzC,OAAO,EAAgB,UAAU,EAAC,MAAM,2BAA2B,CAAC;AAIpE;;;;GAIG;AACH,qBACa,gBAAiB,SAAQ,UAAU;IAC9C,OAAgB,MAAM,+BAAU;IAKhC,OAAO,EAAE,YAAY,GAAG,UAAU,CAAgB;IAElD,gBAAgB;IAEP,IAAI,SAAgB;IAO7B,OAAO,CAAC,OAAO,CAAiB;IAGhC,OAAO,CAAC,aAAa,CAAM;IAG3B,OAAO,CAAC,aAAa,CAAM;IAE3B,OAAO,CAAC,mBAAmB,CAAS;;IAgBpC,OAAO,CAAC,uBAAuB;IAU/B,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,UAAU;IAkBlB,OAAO,CAAC,UAAU;IAsBlB,OAAO,CAAC,cAAc,CAepB;IAEF,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,iBAAiB;IAqChB,MAAM,IAAI,cAAc;CAUlC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,gBAAgB,CAAC;KACxC;CACF"}
|