primer_view_components 0.0.37 → 0.0.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -0
- data/app/assets/javascripts/primer_view_components.js +1 -1
- data/app/assets/javascripts/primer_view_components.js.map +1 -1
- data/app/components/primer/base_button.rb +47 -0
- data/app/components/primer/button_component.rb +3 -19
- data/app/components/primer/button_component.rb.orig +138 -0
- data/app/components/primer/{button_group_component.html.erb → button_group.html.erb} +0 -0
- data/app/components/primer/button_group.rb +61 -0
- data/app/components/primer/button_marketing_component.rb +3 -8
- data/app/components/primer/clipboard_copy.html.erb +8 -0
- data/app/components/primer/clipboard_copy.rb +26 -0
- data/app/components/primer/clipboard_copy_component.d.ts +1 -0
- data/app/components/primer/clipboard_copy_component.js +25 -0
- data/app/components/primer/clipboard_copy_component.ts +28 -0
- data/app/components/primer/close_button.rb +8 -1
- data/app/components/primer/heading_component.rb +32 -4
- data/app/components/primer/hidden_text_expander.rb +1 -3
- data/app/components/primer/primer.d.ts +1 -0
- data/app/components/primer/primer.js +1 -0
- data/app/components/primer/primer.ts +1 -0
- data/app/components/primer/state_component.rb +1 -1
- data/app/lib/primer/classify.rb +1 -1
- data/lib/primer/view_components/version.rb +1 -1
- data/static/statuses.json +1 -1
- metadata +11 -4
- data/app/components/primer/button_group_component.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4636a8eac9b455873244794904e41a01d1e9d71daf99c42ea368eda59c7dcbc
|
4
|
+
data.tar.gz: d0058736ab95a6584e7e6eac15bcd259172803dda98f35bcc4ced133cd070b2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4109fac345bc7b757b51da488e7856bc9872b6b2d6208ac92b875e079b22691265c1ad7e98f39ebdb3e06872bc20f89ca5b2161932f3e815d7d2fea6ad762af5
|
7
|
+
data.tar.gz: 28eff5b61ba8f4799ec505a318417f967d79dd29608830c0325f3da27d8450b693819ceec171fa1db999d56527de9b5ad5e93943ad74d79c05e48c1527fd4350
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,32 @@
|
|
2
2
|
|
3
3
|
## main
|
4
4
|
|
5
|
+
## 0.0.38
|
6
|
+
|
7
|
+
* Extract `BaseButton` component.
|
8
|
+
|
9
|
+
*Manuel Puyol*
|
10
|
+
|
11
|
+
* Add default `aria-label` of "Close" to `CloseButton` component.
|
12
|
+
|
13
|
+
*Kate Higa*
|
14
|
+
|
15
|
+
* Set button variants in the `ButtonGroup` parent.
|
16
|
+
|
17
|
+
*Manuel Puyol*
|
18
|
+
|
19
|
+
* **Breaking change**: Rename `ButtonGroupComponent` to `ButtonGroup` and promote it to beta.
|
20
|
+
|
21
|
+
*Manuel Puyol*
|
22
|
+
|
23
|
+
* **Breaking change**: Do not provide default for `Heading` and improve documentation.
|
24
|
+
|
25
|
+
*Kate Higa*
|
26
|
+
|
27
|
+
* **Breaking change**: Don't allow `StateComponent` to be a link.
|
28
|
+
|
29
|
+
*Kate Higa*
|
30
|
+
|
5
31
|
## 0.0.37
|
6
32
|
|
7
33
|
* Update NPM package to include subdirectory JS files.
|
@@ -1,2 +1,2 @@
|
|
1
|
-
const t=!!navigator.userAgent.match(/Macintosh/);class e{constructor(e,n){this.input=e,this.list=n,this.isComposing=!1,n.id||(n.id=`combobox-${Math.random().toString().slice(2,6)}`),this.keyboardEventHandler=e=>function(e,n){if(e.shiftKey||e.metaKey||e.altKey)return;if(!t&&e.ctrlKey)return;if(n.isComposing)return;switch(e.key){case"Enter":case"Tab":(function(t,e){const n=e.querySelector('[aria-selected="true"]');return!!n&&("true"===n.getAttribute("aria-disabled")||n.click(),!0)})(n.input,n.list)&&e.preventDefault();break;case"Escape":n.clearSelection();break;case"ArrowDown":n.navigate(1),e.preventDefault();break;case"ArrowUp":n.navigate(-1),e.preventDefault();break;case"n":t&&e.ctrlKey&&(n.navigate(1),e.preventDefault());break;case"p":t&&e.ctrlKey&&(n.navigate(-1),e.preventDefault());break;default:if(e.ctrlKey)break;n.clearSelection()}}(e,this),this.compositionEventHandler=t=>function(t,e){e.isComposing="compositionstart"===t.type;if(!document.getElementById(e.input.getAttribute("aria-controls")||""))return;e.clearSelection()}(t,this),this.inputHandler=this.clearSelection.bind(this),e.setAttribute("role","combobox"),e.setAttribute("aria-controls",n.id),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("aria-haspopup","listbox")}destroy(){this.clearSelection(),this.stop(),this.input.removeAttribute("role"),this.input.removeAttribute("aria-controls"),this.input.removeAttribute("aria-expanded"),this.input.removeAttribute("aria-autocomplete"),this.input.removeAttribute("aria-haspopup")}start(){this.input.setAttribute("aria-expanded","true"),this.input.addEventListener("compositionstart",this.compositionEventHandler),this.input.addEventListener("compositionend",this.compositionEventHandler),this.input.addEventListener("input",this.inputHandler),this.input.addEventListener("keydown",this.keyboardEventHandler),this.list.addEventListener("click",n)}stop(){this.clearSelection(),this.input.setAttribute("aria-expanded","false"),this.input.removeEventListener("compositionstart",this.compositionEventHandler),this.input.removeEventListener("compositionend",this.compositionEventHandler),this.input.removeEventListener("input",this.inputHandler),this.input.removeEventListener("keydown",this.keyboardEventHandler),this.list.removeEventListener("click",n)}navigate(t=1){const e=Array.from(this.list.querySelectorAll('[aria-selected="true"]')).filter(i)[0],n=Array.from(this.list.querySelectorAll('[role="option"]')).filter(i),s=n.indexOf(e);if(s===n.length-1&&1===t||0===s&&-1===t)return this.clearSelection(),void this.input.focus();let o=1===t?0:n.length-1;if(e&&s>=0){const e=s+t;e>=0&&e<n.length&&(o=e)}const a=n[o];if(a)for(const t of n)a===t?(this.input.setAttribute("aria-activedescendant",a.id),a.setAttribute("aria-selected","true"),r(this.list,a)):t.setAttribute("aria-selected","false")}clearSelection(){this.input.removeAttribute("aria-activedescendant");for(const t of this.list.querySelectorAll('[aria-selected="true"]'))t.setAttribute("aria-selected","false")}}function n(t){if(!(t.target instanceof Element))return;const e=t.target.closest('[role="option"]');e&&"true"!==e.getAttribute("aria-disabled")&&function(t){t.dispatchEvent(new CustomEvent("combobox-commit",{bubbles:!0}))}(e)}function i(t){return!t.hidden&&!(t instanceof HTMLInputElement&&"hidden"===t.type)&&(t.offsetWidth>0||t.offsetHeight>0)}function r(t,e){(function(t,e){const n=t.scrollTop,i=n+t.clientHeight,r=e.offsetTop,s=r+e.clientHeight;return r>=n&&s<=i})(t,e)||(t.scrollTop=e.offsetTop)}class s extends CustomEvent{constructor(t,e){super(t,e),this.relatedTarget=e.relatedTarget}}const o=new WeakMap;function a(t,e){const n=new XMLHttpRequest;return n.open("GET",e,!0),n.setRequestHeader("Accept","text/fragment+html"),function(t,e){const n=o.get(t);n&&n.abort();o.set(t,e);const i=()=>o.delete(t),r=function(t){return new Promise(((e,n)=>{t.onload=function(){t.status>=200&&t.status<300?e(t.responseText):n(new Error(t.responseText))},t.onerror=n,t.send()}))}(e);return r.then(i,i),r}(t,n)}class c{constructor(t,n,i){this.container=t,this.input=n,this.results=i,this.combobox=new e(n,i),this.results.hidden=!0,this.input.setAttribute("autocomplete","off"),this.input.setAttribute("spellcheck","false"),this.interactingWithList=!1,this.onInputChange=function(t,e=0){let n;return function(...i){clearTimeout(n),n=window.setTimeout((()=>{clearTimeout(n),t(...i)}),e)}}(this.onInputChange.bind(this),300),this.onResultsMouseDown=this.onResultsMouseDown.bind(this),this.onInputBlur=this.onInputBlur.bind(this),this.onInputFocus=this.onInputFocus.bind(this),this.onKeydown=this.onKeydown.bind(this),this.onCommit=this.onCommit.bind(this),this.input.addEventListener("keydown",this.onKeydown),this.input.addEventListener("focus",this.onInputFocus),this.input.addEventListener("blur",this.onInputBlur),this.input.addEventListener("input",this.onInputChange),this.results.addEventListener("mousedown",this.onResultsMouseDown),this.results.addEventListener("combobox-commit",this.onCommit)}destroy(){this.input.removeEventListener("keydown",this.onKeydown),this.input.removeEventListener("focus",this.onInputFocus),this.input.removeEventListener("blur",this.onInputBlur),this.input.removeEventListener("input",this.onInputChange),this.results.removeEventListener("mousedown",this.onResultsMouseDown),this.results.removeEventListener("combobox-commit",this.onCommit)}onKeydown(t){if("Escape"===t.key&&this.container.open)this.container.open=!1,t.stopPropagation(),t.preventDefault();else if(t.altKey&&"ArrowUp"===t.key&&this.container.open)this.container.open=!1,t.stopPropagation(),t.preventDefault();else if(t.altKey&&"ArrowDown"===t.key&&!this.container.open){if(!this.input.value.trim())return;this.container.open=!0,t.stopPropagation(),t.preventDefault()}}onInputFocus(){this.fetchResults()}onInputBlur(){this.interactingWithList?this.interactingWithList=!1:this.container.open=!1}onCommit({target:t}){const e=t;if(!(e instanceof HTMLElement))return;if(this.container.open=!1,e instanceof HTMLAnchorElement)return;const n=e.getAttribute("data-autocomplete-value")||e.textContent;this.container.value=n}onResultsMouseDown(){this.interactingWithList=!0}onInputChange(){this.container.removeAttribute("value"),this.fetchResults()}identifyOptions(){let t=0;for(const e of this.results.querySelectorAll('[role="option"]:not([id])'))e.id=`${this.results.id}-option-${t++}`}fetchResults(){const t=this.input.value.trim();if(!t)return void(this.container.open=!1);const e=this.container.src;if(!e)return;const n=new URL(e,window.location.href),i=new URLSearchParams(n.search.slice(1));i.append("q",t),n.search=i.toString(),this.container.dispatchEvent(new CustomEvent("loadstart")),a(this.input,n.toString()).then((t=>{this.results.innerHTML=t,this.identifyOptions();const e=!!this.results.querySelector('[role="option"]');this.container.open=e,this.container.dispatchEvent(new CustomEvent("load")),this.container.dispatchEvent(new CustomEvent("loadend"))})).catch((()=>{this.container.dispatchEvent(new CustomEvent("error")),this.container.dispatchEvent(new CustomEvent("loadend"))}))}open(){this.results.hidden&&(this.combobox.start(),this.results.hidden=!1)}close(){this.results.hidden||(this.combobox.stop(),this.results.hidden=!0)}}const u=new WeakMap;class l extends HTMLElement{constructor(){super()}connectedCallback(){const t=this.getAttribute("for");if(!t)return;const e=this.querySelector("input"),n=document.getElementById(t);e instanceof HTMLInputElement&&n&&(u.set(this,new c(this,e,n)),n.setAttribute("role","listbox"))}disconnectedCallback(){const t=u.get(this);t&&(t.destroy(),u.delete(this))}get src(){return this.getAttribute("src")||""}set src(t){this.setAttribute("src",t)}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t)}get open(){return this.hasAttribute("open")}set open(t){t?this.setAttribute("open",""):this.removeAttribute("open")}static get observedAttributes(){return["open","value"]}attributeChangedCallback(t,e,n){if(e===n)return;const i=u.get(this);if(i)switch(t){case"open":null===n?i.close():i.open();break;case"value":null!==n&&(i.input.value=n),this.dispatchEvent(new s("auto-complete-change",{bubbles:!0,relatedTarget:i.input}))}}}window.customElements.get("auto-complete")||(window.AutocompleteElement=l,window.customElements.define("auto-complete",l));class h extends HTMLElement{constructor(){super(),this.addEventListener("keydown",(t=>{const e=t.target;if(!(e instanceof HTMLElement))return;if("tab"!==e.getAttribute("role")&&!e.closest('[role="tablist"]'))return;const n=Array.from(this.querySelectorAll('[role="tablist"] [role="tab"]')),i=n.indexOf(n.find((t=>t.matches('[aria-selected="true"]'))));if("ArrowRight"===t.code){let t=i+1;t>=n.length&&(t=0),d(this,t)}else if("ArrowLeft"===t.code){let t=i-1;t<0&&(t=n.length-1),d(this,t)}else"Home"===t.code?(d(this,0),t.preventDefault()):"End"===t.code&&(d(this,n.length-1),t.preventDefault())})),this.addEventListener("click",(t=>{const e=Array.from(this.querySelectorAll('[role="tablist"] [role="tab"]'));if(!(t.target instanceof Element))return;const n=t.target.closest('[role="tab"]');if(!n||!n.closest('[role="tablist"]'))return;d(this,e.indexOf(n))}))}connectedCallback(){for(const t of this.querySelectorAll('[role="tablist"] [role="tab"]'))t.hasAttribute("aria-selected")||t.setAttribute("aria-selected","false"),t.hasAttribute("tabindex")||("true"===t.getAttribute("aria-selected")?t.setAttribute("tabindex","0"):t.setAttribute("tabindex","-1"))}}function d(t,e){const n=t.querySelectorAll('[role="tablist"] [role="tab"]'),i=t.querySelectorAll('[role="tabpanel"]'),r=n[e],s=i[e];if(!!t.dispatchEvent(new CustomEvent("tab-container-change",{bubbles:!0,cancelable:!0,detail:{relatedTarget:s}}))){for(const t of n)t.setAttribute("aria-selected","false"),t.setAttribute("tabindex","-1");for(const t of i)t.hidden=!0,t.hasAttribute("tabindex")||t.hasAttribute("data-tab-container-no-tabstop")||t.setAttribute("tabindex","0");r.setAttribute("aria-selected","true"),r.setAttribute("tabindex","0"),r.focus(),s.hidden=!1,t.dispatchEvent(new CustomEvent("tab-container-changed",{bubbles:!0,detail:{relatedTarget:s}}))}}window.customElements.get("tab-container")||(window.TabContainerElement=h,window.customElements.define("tab-container",h));const m=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],p=["January","February","March","April","May","June","July","August","September","October","November","December"];function f(t){return"0".concat(t).slice(-2)}function b(t,e){const n=t.getDay(),i=t.getDate(),r=t.getMonth(),s=t.getFullYear(),o=t.getHours(),a=t.getMinutes(),c=t.getSeconds();return e.replace(/%([%aAbBcdeHIlmMpPSwyYZz])/g,(function(e){let u;switch(e[1]){case"%":return"%";case"a":return m[n].slice(0,3);case"A":return m[n];case"b":return p[r].slice(0,3);case"B":return p[r];case"c":return t.toString();case"d":return f(i);case"e":return String(i);case"H":return f(o);case"I":return f(b(t,"%l"));case"l":return String(0===o||12===o?12:(o+12)%12);case"m":return f(r+1);case"M":return f(a);case"p":return o>11?"PM":"AM";case"P":return o>11?"pm":"am";case"S":return f(c);case"w":return String(n);case"y":return f(s%100);case"Y":return String(s);case"Z":return u=t.toString().match(/\((\w+)\)$/),u?u[1]:"";case"z":return u=t.toString().match(/\w([+-]\d\d\d\d) /),u?u[1]:""}return""}))}function g(t){let e;return function(){if(e)return e;if("Intl"in window)try{return e=new Intl.DateTimeFormat(void 0,t),e}catch(t){if(!(t instanceof RangeError))throw t}}}let w=null;const v=g({day:"numeric",month:"short"});function y(){if(null!==w)return w;const t=v();if(t){const e=t.format(new Date(0));return w=!!e.match(/^\d/),w}return!1}let A=null;const E=g({day:"numeric",month:"short",year:"numeric"});function M(t){const e=t.closest("[lang]");return e instanceof HTMLElement&&e.lang?e.lang:"default"}const T=new WeakMap;class k extends HTMLElement{static get observedAttributes(){return["datetime","day","format","lang","hour","minute","month","second","title","weekday","year"]}connectedCallback(){const t=this.getFormattedTitle();t&&!this.hasAttribute("title")&&this.setAttribute("title",t);const e=this.getFormattedDate();e&&(this.textContent=e)}attributeChangedCallback(t,e,n){const i=this.getFormattedTitle();if("datetime"===t){const t=Date.parse(n);isNaN(t)?T.delete(this):T.set(this,new Date(t))}const r=this.getFormattedTitle(),s=this.getAttribute("title");"title"===t||!r||s&&s!==i||this.setAttribute("title",r);const o=this.getFormattedDate();o&&(this.textContent=o)}get date(){return T.get(this)}getFormattedTitle(){const t=this.date;if(!t)return;const e=C();if(e)return e.format(t);try{return t.toLocaleString()}catch(e){if(e instanceof RangeError)return t.toString();throw e}}getFormattedDate(){}}const C=g({day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}),L=new WeakMap;class D extends k{attributeChangedCallback(t,e,n){"hour"!==t&&"minute"!==t&&"second"!==t&&"time-zone-name"!==t||L.delete(this),super.attributeChangedCallback(t,e,n)}getFormattedDate(){const t=this.date;if(!t)return;const e=function(t,e){const n={weekday:{short:"%a",long:"%A"},day:{numeric:"%e","2-digit":"%d"},month:{short:"%b",long:"%B"},year:{numeric:"%Y","2-digit":"%y"}};let i=y()?"weekday day month year":"weekday month day, year";for(const e in n){const r=n[e][t.getAttribute(e)];i=i.replace(e,r||"")}return i=i.replace(/(\s,)|(,\s$)/,""),b(e,i).replace(/\s+/," ").trim()}(this,t)||"",n=function(t,e){const n={},i=t.getAttribute("hour");"numeric"!==i&&"2-digit"!==i||(n.hour=i);const r=t.getAttribute("minute");"numeric"!==r&&"2-digit"!==r||(n.minute=r);const s=t.getAttribute("second");"numeric"!==s&&"2-digit"!==s||(n.second=s);const o=t.getAttribute("time-zone-name");"short"!==o&&"long"!==o||(n.timeZoneName=o);if(0===Object.keys(n).length)return;let a=L.get(t);a||(a=g(n),L.set(t,a));const c=a();if(c)return c.format(e);return b(e,n.second?"%H:%M:%S":"%H:%M")}(this,t)||"";return"".concat(e," ").concat(n).trim()}}window.customElements.get("local-time")||(window.LocalTimeElement=D,window.customElements.define("local-time",D));class S{constructor(t,e){this.date=t,this.locale=e}toString(){const t=this.timeElapsed();if(t)return t;{const t=this.timeAhead();return t||"on ".concat(this.formatDate())}}timeElapsed(){const t=(new Date).getTime()-this.date.getTime(),e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),r=Math.round(i/24);return t>=0&&r<30?this.timeAgoFromMs(t):null}timeAhead(){const t=this.date.getTime()-(new Date).getTime(),e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),r=Math.round(i/24);return t>=0&&r<30?this.timeUntil():null}timeAgo(){const t=(new Date).getTime()-this.date.getTime();return this.timeAgoFromMs(t)}timeAgoFromMs(t){const e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),r=Math.round(i/24),s=Math.round(r/30),o=Math.round(s/12);return t<0||e<10?x(this.locale,0,"second"):e<45?x(this.locale,-e,"second"):e<90||n<45?x(this.locale,-n,"minute"):n<90||i<24?x(this.locale,-i,"hour"):i<36||r<30?x(this.locale,-r,"day"):s<18?x(this.locale,-s,"month"):x(this.locale,-o,"year")}microTimeAgo(){const t=(new Date).getTime()-this.date.getTime(),e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),r=Math.round(i/24),s=Math.round(r/30),o=Math.round(s/12);return n<1?"1m":n<60?"".concat(n,"m"):i<24?"".concat(i,"h"):r<365?"".concat(r,"d"):"".concat(o,"y")}timeUntil(){const t=this.date.getTime()-(new Date).getTime();return this.timeUntilFromMs(t)}timeUntilFromMs(t){const e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),r=Math.round(i/24),s=Math.round(r/30),o=Math.round(s/12);return s>=18||s>=12?x(this.locale,o,"year"):r>=45||r>=30?x(this.locale,s,"month"):i>=36||i>=24?x(this.locale,r,"day"):n>=90||n>=45?x(this.locale,i,"hour"):e>=90||e>=45?x(this.locale,n,"minute"):x(this.locale,e>=10?e:0,"second")}microTimeUntil(){const t=this.date.getTime()-(new Date).getTime(),e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),r=Math.round(i/24),s=Math.round(r/30),o=Math.round(s/12);return r>=365?"".concat(o,"y"):i>=24?"".concat(r,"d"):n>=60?"".concat(i,"h"):n>1?"".concat(n,"m"):"1m"}formatDate(){let t=y()?"%e %b":"%b %e";var e;return e=this.date,(new Date).getUTCFullYear()!==e.getUTCFullYear()&&(t+=function(){if(null!==A)return A;const t=E();if(t){const e=t.format(new Date(0));return A=!!e.match(/\d,/),A}return!0}()?", %Y":" %Y"),b(this.date,t)}formatTime(){const t=H();return t?t.format(this.date):b(this.date,"%l:%M%P")}}function x(t,e,n){const i=function(t,e){if("Intl"in window&&"RelativeTimeFormat"in window.Intl)try{return new Intl.RelativeTimeFormat(t,e)}catch(t){if(!(t instanceof RangeError))throw t}}(t,{numeric:"auto"});return i?i.format(e,n):function(t,e){if(0===t)switch(e){case"year":case"quarter":case"month":case"week":return"this ".concat(e);case"day":return"today";case"hour":case"minute":return"in 0 ".concat(e,"s");case"second":return"now"}else if(1===t)switch(e){case"year":case"quarter":case"month":case"week":return"next ".concat(e);case"day":return"tomorrow";case"hour":case"minute":case"second":return"in 1 ".concat(e)}else if(-1===t)switch(e){case"year":case"quarter":case"month":case"week":return"last ".concat(e);case"day":return"yesterday";case"hour":case"minute":case"second":return"1 ".concat(e," ago")}else if(t>1)switch(e){case"year":case"quarter":case"month":case"week":case"day":case"hour":case"minute":case"second":return"in ".concat(t," ").concat(e,"s")}else if(t<-1)switch(e){case"year":case"quarter":case"month":case"week":case"day":case"hour":case"minute":case"second":return"".concat(-t," ").concat(e,"s ago")}throw new RangeError("Invalid unit argument for format() '".concat(e,"'"))}(e,n)}const H=g({hour:"numeric",minute:"2-digit"});class F extends k{getFormattedDate(){const t=this.date;if(t)return new S(t,M(this)).toString()}connectedCallback(){I.push(this),q||(R(),q=setInterval(R,6e4)),super.connectedCallback()}disconnectedCallback(){const t=I.indexOf(this);-1!==t&&I.splice(t,1),I.length||q&&(clearInterval(q),q=null)}}const I=[];let q;function R(){let t,e,n;for(e=0,n=I.length;e<n;e++)t=I[e],t.textContent=t.getFormattedDate()||""}window.customElements.get("relative-time")||(window.RelativeTimeElement=F,window.customElements.define("relative-time",F));class K extends F{getFormattedDate(){const t=this.getAttribute("format"),e=this.date;if(e)return"micro"===t?new S(e,M(this)).microTimeAgo():new S(e,M(this)).timeAgo()}}window.customElements.get("time-ago")||(window.TimeAgoElement=K,window.customElements.define("time-ago",K));class U extends F{getFormattedDate(){const t=this.getAttribute("format"),e=this.date;if(e)return"micro"===t?new S(e,M(this)).microTimeUntil():new S(e,M(this)).timeUntil()}}window.customElements.get("time-until")||(window.TimeUntilElement=U,window.customElements.define("time-until",U));
|
1
|
+
const t=!!navigator.userAgent.match(/Macintosh/);class e{constructor(e,n){this.input=e,this.list=n,this.isComposing=!1,n.id||(n.id=`combobox-${Math.random().toString().slice(2,6)}`),this.keyboardEventHandler=e=>function(e,n){if(e.shiftKey||e.metaKey||e.altKey)return;if(!t&&e.ctrlKey)return;if(n.isComposing)return;switch(e.key){case"Enter":case"Tab":(function(t,e){const n=e.querySelector('[aria-selected="true"]');return!!n&&("true"===n.getAttribute("aria-disabled")||n.click(),!0)})(n.input,n.list)&&e.preventDefault();break;case"Escape":n.clearSelection();break;case"ArrowDown":n.navigate(1),e.preventDefault();break;case"ArrowUp":n.navigate(-1),e.preventDefault();break;case"n":t&&e.ctrlKey&&(n.navigate(1),e.preventDefault());break;case"p":t&&e.ctrlKey&&(n.navigate(-1),e.preventDefault());break;default:if(e.ctrlKey)break;n.clearSelection()}}(e,this),this.compositionEventHandler=t=>function(t,e){e.isComposing="compositionstart"===t.type;if(!document.getElementById(e.input.getAttribute("aria-controls")||""))return;e.clearSelection()}(t,this),this.inputHandler=this.clearSelection.bind(this),e.setAttribute("role","combobox"),e.setAttribute("aria-controls",n.id),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("aria-haspopup","listbox")}destroy(){this.clearSelection(),this.stop(),this.input.removeAttribute("role"),this.input.removeAttribute("aria-controls"),this.input.removeAttribute("aria-expanded"),this.input.removeAttribute("aria-autocomplete"),this.input.removeAttribute("aria-haspopup")}start(){this.input.setAttribute("aria-expanded","true"),this.input.addEventListener("compositionstart",this.compositionEventHandler),this.input.addEventListener("compositionend",this.compositionEventHandler),this.input.addEventListener("input",this.inputHandler),this.input.addEventListener("keydown",this.keyboardEventHandler),this.list.addEventListener("click",n)}stop(){this.clearSelection(),this.input.setAttribute("aria-expanded","false"),this.input.removeEventListener("compositionstart",this.compositionEventHandler),this.input.removeEventListener("compositionend",this.compositionEventHandler),this.input.removeEventListener("input",this.inputHandler),this.input.removeEventListener("keydown",this.keyboardEventHandler),this.list.removeEventListener("click",n)}navigate(t=1){const e=Array.from(this.list.querySelectorAll('[aria-selected="true"]')).filter(i)[0],n=Array.from(this.list.querySelectorAll('[role="option"]')).filter(i),o=n.indexOf(e);if(o===n.length-1&&1===t||0===o&&-1===t)return this.clearSelection(),void this.input.focus();let s=1===t?0:n.length-1;if(e&&o>=0){const e=o+t;e>=0&&e<n.length&&(s=e)}const a=n[s];if(a)for(const t of n)a===t?(this.input.setAttribute("aria-activedescendant",a.id),a.setAttribute("aria-selected","true"),r(this.list,a)):t.setAttribute("aria-selected","false")}clearSelection(){this.input.removeAttribute("aria-activedescendant");for(const t of this.list.querySelectorAll('[aria-selected="true"]'))t.setAttribute("aria-selected","false")}}function n(t){if(!(t.target instanceof Element))return;const e=t.target.closest('[role="option"]');e&&"true"!==e.getAttribute("aria-disabled")&&function(t){t.dispatchEvent(new CustomEvent("combobox-commit",{bubbles:!0}))}(e)}function i(t){return!t.hidden&&!(t instanceof HTMLInputElement&&"hidden"===t.type)&&(t.offsetWidth>0||t.offsetHeight>0)}function r(t,e){(function(t,e){const n=t.scrollTop,i=n+t.clientHeight,r=e.offsetTop,o=r+e.clientHeight;return r>=n&&o<=i})(t,e)||(t.scrollTop=e.offsetTop)}class o extends CustomEvent{constructor(t,e){super(t,e),this.relatedTarget=e.relatedTarget}}const s=new WeakMap;function a(t,e){const n=new XMLHttpRequest;return n.open("GET",e,!0),n.setRequestHeader("Accept","text/fragment+html"),function(t,e){const n=s.get(t);n&&n.abort();s.set(t,e);const i=()=>s.delete(t),r=function(t){return new Promise(((e,n)=>{t.onload=function(){t.status>=200&&t.status<300?e(t.responseText):n(new Error(t.responseText))},t.onerror=n,t.send()}))}(e);return r.then(i,i),r}(t,n)}class c{constructor(t,n,i){this.container=t,this.input=n,this.results=i,this.combobox=new e(n,i),this.results.hidden=!0,this.input.setAttribute("autocomplete","off"),this.input.setAttribute("spellcheck","false"),this.interactingWithList=!1,this.onInputChange=function(t,e=0){let n;return function(...i){clearTimeout(n),n=window.setTimeout((()=>{clearTimeout(n),t(...i)}),e)}}(this.onInputChange.bind(this),300),this.onResultsMouseDown=this.onResultsMouseDown.bind(this),this.onInputBlur=this.onInputBlur.bind(this),this.onInputFocus=this.onInputFocus.bind(this),this.onKeydown=this.onKeydown.bind(this),this.onCommit=this.onCommit.bind(this),this.input.addEventListener("keydown",this.onKeydown),this.input.addEventListener("focus",this.onInputFocus),this.input.addEventListener("blur",this.onInputBlur),this.input.addEventListener("input",this.onInputChange),this.results.addEventListener("mousedown",this.onResultsMouseDown),this.results.addEventListener("combobox-commit",this.onCommit)}destroy(){this.input.removeEventListener("keydown",this.onKeydown),this.input.removeEventListener("focus",this.onInputFocus),this.input.removeEventListener("blur",this.onInputBlur),this.input.removeEventListener("input",this.onInputChange),this.results.removeEventListener("mousedown",this.onResultsMouseDown),this.results.removeEventListener("combobox-commit",this.onCommit)}onKeydown(t){if("Escape"===t.key&&this.container.open)this.container.open=!1,t.stopPropagation(),t.preventDefault();else if(t.altKey&&"ArrowUp"===t.key&&this.container.open)this.container.open=!1,t.stopPropagation(),t.preventDefault();else if(t.altKey&&"ArrowDown"===t.key&&!this.container.open){if(!this.input.value.trim())return;this.container.open=!0,t.stopPropagation(),t.preventDefault()}}onInputFocus(){this.fetchResults()}onInputBlur(){this.interactingWithList?this.interactingWithList=!1:this.container.open=!1}onCommit({target:t}){const e=t;if(!(e instanceof HTMLElement))return;if(this.container.open=!1,e instanceof HTMLAnchorElement)return;const n=e.getAttribute("data-autocomplete-value")||e.textContent;this.container.value=n}onResultsMouseDown(){this.interactingWithList=!0}onInputChange(){this.container.removeAttribute("value"),this.fetchResults()}identifyOptions(){let t=0;for(const e of this.results.querySelectorAll('[role="option"]:not([id])'))e.id=`${this.results.id}-option-${t++}`}fetchResults(){const t=this.input.value.trim();if(!t)return void(this.container.open=!1);const e=this.container.src;if(!e)return;const n=new URL(e,window.location.href),i=new URLSearchParams(n.search.slice(1));i.append("q",t),n.search=i.toString(),this.container.dispatchEvent(new CustomEvent("loadstart")),a(this.input,n.toString()).then((t=>{this.results.innerHTML=t,this.identifyOptions();const e=!!this.results.querySelector('[role="option"]');this.container.open=e,this.container.dispatchEvent(new CustomEvent("load")),this.container.dispatchEvent(new CustomEvent("loadend"))})).catch((()=>{this.container.dispatchEvent(new CustomEvent("error")),this.container.dispatchEvent(new CustomEvent("loadend"))}))}open(){this.results.hidden&&(this.combobox.start(),this.results.hidden=!1)}close(){this.results.hidden||(this.combobox.stop(),this.results.hidden=!0)}}const u=new WeakMap;class l extends HTMLElement{constructor(){super()}connectedCallback(){const t=this.getAttribute("for");if(!t)return;const e=this.querySelector("input"),n=document.getElementById(t);e instanceof HTMLInputElement&&n&&(u.set(this,new c(this,e,n)),n.setAttribute("role","listbox"))}disconnectedCallback(){const t=u.get(this);t&&(t.destroy(),u.delete(this))}get src(){return this.getAttribute("src")||""}set src(t){this.setAttribute("src",t)}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t)}get open(){return this.hasAttribute("open")}set open(t){t?this.setAttribute("open",""):this.removeAttribute("open")}static get observedAttributes(){return["open","value"]}attributeChangedCallback(t,e,n){if(e===n)return;const i=u.get(this);if(i)switch(t){case"open":null===n?i.close():i.open();break;case"value":null!==n&&(i.input.value=n),this.dispatchEvent(new o("auto-complete-change",{bubbles:!0,relatedTarget:i.input}))}}}function d(t){if("clipboard"in navigator)return navigator.clipboard.writeText(t.textContent);const e=getSelection();if(null==e)return Promise.reject(new Error);e.removeAllRanges();const n=document.createRange();return n.selectNodeContents(t),e.addRange(n),document.execCommand("copy"),e.removeAllRanges(),Promise.resolve()}function h(t){if("clipboard"in navigator)return navigator.clipboard.writeText(t);const e=document.body;if(!e)return Promise.reject(new Error);const n=function(t){const e=document.createElement("pre");return e.style.width="1px",e.style.height="1px",e.style.position="fixed",e.style.top="5px",e.textContent=t,e}(t);return e.appendChild(n),d(n),e.removeChild(n),Promise.resolve()}function m(t){const e=t.getAttribute("for"),n=t.getAttribute("value");function i(){t.dispatchEvent(new CustomEvent("clipboard-copy",{bubbles:!0}))}if(n)h(n).then(i);else if(e){const n="getRootNode"in Element.prototype?t.getRootNode():t.ownerDocument;if(!(n instanceof Document||"ShadowRoot"in window&&n instanceof ShadowRoot))return;const o=n.getElementById(e);o&&(r=o,r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement?h(r.value):r instanceof HTMLAnchorElement&&r.hasAttribute("href")?h(r.href):d(r)).then(i)}var r}function p(t){const e=t.currentTarget;e instanceof HTMLElement&&m(e)}function f(t){if(" "===t.key||"Enter"===t.key){const e=t.currentTarget;e instanceof HTMLElement&&(t.preventDefault(),m(e))}}function b(t){t.currentTarget.addEventListener("keydown",f)}function g(t){t.currentTarget.removeEventListener("keydown",f)}window.customElements.get("auto-complete")||(window.AutocompleteElement=l,window.customElements.define("auto-complete",l));class w extends HTMLElement{constructor(){super(),this.addEventListener("click",p),this.addEventListener("focus",b),this.addEventListener("blur",g)}connectedCallback(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("role")||this.setAttribute("role","button")}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t)}}function v(t){""===t.style.display||"block"===t.style.display?t.style.display="none":t.style.display="block"}function y(t){const[e,n]=t.querySelectorAll(".octicon");e&&v(e),n&&v(n)}window.customElements.get("clipboard-copy")||(window.ClipboardCopyElement=w,window.customElements.define("clipboard-copy",w)),document.addEventListener("clipboard-copy",(function({target:t}){t instanceof HTMLElement&&(y(t),setTimeout(y,2e3,t))}));class E extends HTMLElement{constructor(){super(),this.addEventListener("keydown",(t=>{const e=t.target;if(!(e instanceof HTMLElement))return;if("tab"!==e.getAttribute("role")&&!e.closest('[role="tablist"]'))return;const n=Array.from(this.querySelectorAll('[role="tablist"] [role="tab"]')),i=n.indexOf(n.find((t=>t.matches('[aria-selected="true"]'))));if("ArrowRight"===t.code){let t=i+1;t>=n.length&&(t=0),A(this,t)}else if("ArrowLeft"===t.code){let t=i-1;t<0&&(t=n.length-1),A(this,t)}else"Home"===t.code?(A(this,0),t.preventDefault()):"End"===t.code&&(A(this,n.length-1),t.preventDefault())})),this.addEventListener("click",(t=>{const e=Array.from(this.querySelectorAll('[role="tablist"] [role="tab"]'));if(!(t.target instanceof Element))return;const n=t.target.closest('[role="tab"]');if(!n||!n.closest('[role="tablist"]'))return;A(this,e.indexOf(n))}))}connectedCallback(){for(const t of this.querySelectorAll('[role="tablist"] [role="tab"]'))t.hasAttribute("aria-selected")||t.setAttribute("aria-selected","false"),t.hasAttribute("tabindex")||("true"===t.getAttribute("aria-selected")?t.setAttribute("tabindex","0"):t.setAttribute("tabindex","-1"))}}function A(t,e){const n=t.querySelectorAll('[role="tablist"] [role="tab"]'),i=t.querySelectorAll('[role="tabpanel"]'),r=n[e],o=i[e];if(!!t.dispatchEvent(new CustomEvent("tab-container-change",{bubbles:!0,cancelable:!0,detail:{relatedTarget:o}}))){for(const t of n)t.setAttribute("aria-selected","false"),t.setAttribute("tabindex","-1");for(const t of i)t.hidden=!0,t.hasAttribute("tabindex")||t.hasAttribute("data-tab-container-no-tabstop")||t.setAttribute("tabindex","0");r.setAttribute("aria-selected","true"),r.setAttribute("tabindex","0"),r.focus(),o.hidden=!1,t.dispatchEvent(new CustomEvent("tab-container-changed",{bubbles:!0,detail:{relatedTarget:o}}))}}window.customElements.get("tab-container")||(window.TabContainerElement=E,window.customElements.define("tab-container",E));const M=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],T=["January","February","March","April","May","June","July","August","September","October","November","December"];function k(t){return"0".concat(t).slice(-2)}function L(t,e){const n=t.getDay(),i=t.getDate(),r=t.getMonth(),o=t.getFullYear(),s=t.getHours(),a=t.getMinutes(),c=t.getSeconds();return e.replace(/%([%aAbBcdeHIlmMpPSwyYZz])/g,(function(e){let u;switch(e[1]){case"%":return"%";case"a":return M[n].slice(0,3);case"A":return M[n];case"b":return T[r].slice(0,3);case"B":return T[r];case"c":return t.toString();case"d":return k(i);case"e":return String(i);case"H":return k(s);case"I":return k(L(t,"%l"));case"l":return String(0===s||12===s?12:(s+12)%12);case"m":return k(r+1);case"M":return k(a);case"p":return s>11?"PM":"AM";case"P":return s>11?"pm":"am";case"S":return k(c);case"w":return String(n);case"y":return k(o%100);case"Y":return String(o);case"Z":return u=t.toString().match(/\((\w+)\)$/),u?u[1]:"";case"z":return u=t.toString().match(/\w([+-]\d\d\d\d) /),u?u[1]:""}return""}))}function x(t){let e;return function(){if(e)return e;if("Intl"in window)try{return e=new Intl.DateTimeFormat(void 0,t),e}catch(t){if(!(t instanceof RangeError))throw t}}}let C=null;const S=x({day:"numeric",month:"short"});function D(){if(null!==C)return C;const t=S();if(t){const e=t.format(new Date(0));return C=!!e.match(/^\d/),C}return!1}let H=null;const I=x({day:"numeric",month:"short",year:"numeric"});function F(t){const e=t.closest("[lang]");return e instanceof HTMLElement&&e.lang?e.lang:"default"}const R=new WeakMap;class q extends HTMLElement{static get observedAttributes(){return["datetime","day","format","lang","hour","minute","month","second","title","weekday","year"]}connectedCallback(){const t=this.getFormattedTitle();t&&!this.hasAttribute("title")&&this.setAttribute("title",t);const e=this.getFormattedDate();e&&(this.textContent=e)}attributeChangedCallback(t,e,n){const i=this.getFormattedTitle();if("datetime"===t){const t=Date.parse(n);isNaN(t)?R.delete(this):R.set(this,new Date(t))}const r=this.getFormattedTitle(),o=this.getAttribute("title");"title"===t||!r||o&&o!==i||this.setAttribute("title",r);const s=this.getFormattedDate();s&&(this.textContent=s)}get date(){return R.get(this)}getFormattedTitle(){const t=this.date;if(!t)return;const e=K();if(e)return e.format(t);try{return t.toLocaleString()}catch(e){if(e instanceof RangeError)return t.toString();throw e}}getFormattedDate(){}}const K=x({day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}),U=new WeakMap;class P extends q{attributeChangedCallback(t,e,n){"hour"!==t&&"minute"!==t&&"second"!==t&&"time-zone-name"!==t||U.delete(this),super.attributeChangedCallback(t,e,n)}getFormattedDate(){const t=this.date;if(!t)return;const e=function(t,e){const n={weekday:{short:"%a",long:"%A"},day:{numeric:"%e","2-digit":"%d"},month:{short:"%b",long:"%B"},year:{numeric:"%Y","2-digit":"%y"}};let i=D()?"weekday day month year":"weekday month day, year";for(const e in n){const r=n[e][t.getAttribute(e)];i=i.replace(e,r||"")}return i=i.replace(/(\s,)|(,\s$)/,""),L(e,i).replace(/\s+/," ").trim()}(this,t)||"",n=function(t,e){const n={},i=t.getAttribute("hour");"numeric"!==i&&"2-digit"!==i||(n.hour=i);const r=t.getAttribute("minute");"numeric"!==r&&"2-digit"!==r||(n.minute=r);const o=t.getAttribute("second");"numeric"!==o&&"2-digit"!==o||(n.second=o);const s=t.getAttribute("time-zone-name");"short"!==s&&"long"!==s||(n.timeZoneName=s);if(0===Object.keys(n).length)return;let a=U.get(t);a||(a=x(n),U.set(t,a));const c=a();if(c)return c.format(e);return L(e,n.second?"%H:%M:%S":"%H:%M")}(this,t)||"";return"".concat(e," ").concat(n).trim()}}window.customElements.get("local-time")||(window.LocalTimeElement=P,window.customElements.define("local-time",P));class B{constructor(t,e){this.date=t,this.locale=e}toString(){const t=this.timeElapsed();if(t)return t;{const t=this.timeAhead();return t||"on ".concat(this.formatDate())}}timeElapsed(){const t=(new Date).getTime()-this.date.getTime(),e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),r=Math.round(i/24);return t>=0&&r<30?this.timeAgoFromMs(t):null}timeAhead(){const t=this.date.getTime()-(new Date).getTime(),e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),r=Math.round(i/24);return t>=0&&r<30?this.timeUntil():null}timeAgo(){const t=(new Date).getTime()-this.date.getTime();return this.timeAgoFromMs(t)}timeAgoFromMs(t){const e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),r=Math.round(i/24),o=Math.round(r/30),s=Math.round(o/12);return t<0||e<10?W(this.locale,0,"second"):e<45?W(this.locale,-e,"second"):e<90||n<45?W(this.locale,-n,"minute"):n<90||i<24?W(this.locale,-i,"hour"):i<36||r<30?W(this.locale,-r,"day"):o<18?W(this.locale,-o,"month"):W(this.locale,-s,"year")}microTimeAgo(){const t=(new Date).getTime()-this.date.getTime(),e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),r=Math.round(i/24),o=Math.round(r/30),s=Math.round(o/12);return n<1?"1m":n<60?"".concat(n,"m"):i<24?"".concat(i,"h"):r<365?"".concat(r,"d"):"".concat(s,"y")}timeUntil(){const t=this.date.getTime()-(new Date).getTime();return this.timeUntilFromMs(t)}timeUntilFromMs(t){const e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),r=Math.round(i/24),o=Math.round(r/30),s=Math.round(o/12);return o>=18||o>=12?W(this.locale,s,"year"):r>=45||r>=30?W(this.locale,o,"month"):i>=36||i>=24?W(this.locale,r,"day"):n>=90||n>=45?W(this.locale,i,"hour"):e>=90||e>=45?W(this.locale,n,"minute"):W(this.locale,e>=10?e:0,"second")}microTimeUntil(){const t=this.date.getTime()-(new Date).getTime(),e=Math.round(t/1e3),n=Math.round(e/60),i=Math.round(n/60),r=Math.round(i/24),o=Math.round(r/30),s=Math.round(o/12);return r>=365?"".concat(s,"y"):i>=24?"".concat(r,"d"):n>=60?"".concat(i,"h"):n>1?"".concat(n,"m"):"1m"}formatDate(){let t=D()?"%e %b":"%b %e";var e;return e=this.date,(new Date).getUTCFullYear()!==e.getUTCFullYear()&&(t+=function(){if(null!==H)return H;const t=I();if(t){const e=t.format(new Date(0));return H=!!e.match(/\d,/),H}return!0}()?", %Y":" %Y"),L(this.date,t)}formatTime(){const t=N();return t?t.format(this.date):L(this.date,"%l:%M%P")}}function W(t,e,n){const i=function(t,e){if("Intl"in window&&"RelativeTimeFormat"in window.Intl)try{return new Intl.RelativeTimeFormat(t,e)}catch(t){if(!(t instanceof RangeError))throw t}}(t,{numeric:"auto"});return i?i.format(e,n):function(t,e){if(0===t)switch(e){case"year":case"quarter":case"month":case"week":return"this ".concat(e);case"day":return"today";case"hour":case"minute":return"in 0 ".concat(e,"s");case"second":return"now"}else if(1===t)switch(e){case"year":case"quarter":case"month":case"week":return"next ".concat(e);case"day":return"tomorrow";case"hour":case"minute":case"second":return"in 1 ".concat(e)}else if(-1===t)switch(e){case"year":case"quarter":case"month":case"week":return"last ".concat(e);case"day":return"yesterday";case"hour":case"minute":case"second":return"1 ".concat(e," ago")}else if(t>1)switch(e){case"year":case"quarter":case"month":case"week":case"day":case"hour":case"minute":case"second":return"in ".concat(t," ").concat(e,"s")}else if(t<-1)switch(e){case"year":case"quarter":case"month":case"week":case"day":case"hour":case"minute":case"second":return"".concat(-t," ").concat(e,"s ago")}throw new RangeError("Invalid unit argument for format() '".concat(e,"'"))}(e,n)}const N=x({hour:"numeric",minute:"2-digit"});class O extends q{getFormattedDate(){const t=this.date;if(t)return new B(t,F(this)).toString()}connectedCallback(){Y.push(this),$||(z(),$=setInterval(z,6e4)),super.connectedCallback()}disconnectedCallback(){const t=Y.indexOf(this);-1!==t&&Y.splice(t,1),Y.length||$&&(clearInterval($),$=null)}}const Y=[];let $;function z(){let t,e,n;for(e=0,n=Y.length;e<n;e++)t=Y[e],t.textContent=t.getFormattedDate()||""}window.customElements.get("relative-time")||(window.RelativeTimeElement=O,window.customElements.define("relative-time",O));class Z extends O{getFormattedDate(){const t=this.getAttribute("format"),e=this.date;if(e)return"micro"===t?new B(e,F(this)).microTimeAgo():new B(e,F(this)).timeAgo()}}window.customElements.get("time-ago")||(window.TimeAgoElement=Z,window.customElements.define("time-ago",Z));class j extends O{getFormattedDate(){const t=this.getAttribute("format"),e=this.date;if(e)return"micro"===t?new B(e,F(this)).microTimeUntil():new B(e,F(this)).timeUntil()}}window.customElements.get("time-until")||(window.TimeUntilElement=j,window.customElements.define("time-until",j));
|
2
2
|
//# sourceMappingURL=primer_view_components.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"primer_view_components.js","sources":["../../../node_modules/@github/combobox-nav/dist/index.js","../../../node_modules/@github/auto-complete-element/dist/index.js","../../../node_modules/@github/tab-container-element/dist/index.js","../../../node_modules/@github/time-elements/dist/time-elements.js"],"sourcesContent":["const ctrlBindings = !!navigator.userAgent.match(/Macintosh/);\nexport default class Combobox {\n constructor(input, list) {\n this.input = input;\n this.list = list;\n this.isComposing = false;\n if (!list.id) {\n list.id = `combobox-${Math.random()\n .toString()\n .slice(2, 6)}`;\n }\n this.keyboardEventHandler = event => keyboardBindings(event, this);\n this.compositionEventHandler = event => trackComposition(event, this);\n this.inputHandler = this.clearSelection.bind(this);\n input.setAttribute('role', 'combobox');\n input.setAttribute('aria-controls', list.id);\n input.setAttribute('aria-expanded', 'false');\n input.setAttribute('aria-autocomplete', 'list');\n input.setAttribute('aria-haspopup', 'listbox');\n }\n destroy() {\n this.clearSelection();\n this.stop();\n this.input.removeAttribute('role');\n this.input.removeAttribute('aria-controls');\n this.input.removeAttribute('aria-expanded');\n this.input.removeAttribute('aria-autocomplete');\n this.input.removeAttribute('aria-haspopup');\n }\n start() {\n this.input.setAttribute('aria-expanded', 'true');\n this.input.addEventListener('compositionstart', this.compositionEventHandler);\n this.input.addEventListener('compositionend', this.compositionEventHandler);\n this.input.addEventListener('input', this.inputHandler);\n this.input.addEventListener('keydown', this.keyboardEventHandler);\n this.list.addEventListener('click', commitWithElement);\n }\n stop() {\n this.clearSelection();\n this.input.setAttribute('aria-expanded', 'false');\n this.input.removeEventListener('compositionstart', this.compositionEventHandler);\n this.input.removeEventListener('compositionend', this.compositionEventHandler);\n this.input.removeEventListener('input', this.inputHandler);\n this.input.removeEventListener('keydown', this.keyboardEventHandler);\n this.list.removeEventListener('click', commitWithElement);\n }\n navigate(indexDiff = 1) {\n const focusEl = Array.from(this.list.querySelectorAll('[aria-selected=\"true\"]')).filter(visible)[0];\n const els = Array.from(this.list.querySelectorAll('[role=\"option\"]')).filter(visible);\n const focusIndex = els.indexOf(focusEl);\n if ((focusIndex === els.length - 1 && indexDiff === 1) || (focusIndex === 0 && indexDiff === -1)) {\n this.clearSelection();\n this.input.focus();\n return;\n }\n let indexOfItem = indexDiff === 1 ? 0 : els.length - 1;\n if (focusEl && focusIndex >= 0) {\n const newIndex = focusIndex + indexDiff;\n if (newIndex >= 0 && newIndex < els.length)\n indexOfItem = newIndex;\n }\n const target = els[indexOfItem];\n if (!target)\n return;\n for (const el of els) {\n if (target === el) {\n this.input.setAttribute('aria-activedescendant', target.id);\n target.setAttribute('aria-selected', 'true');\n scrollTo(this.list, target);\n }\n else {\n el.setAttribute('aria-selected', 'false');\n }\n }\n }\n clearSelection() {\n this.input.removeAttribute('aria-activedescendant');\n for (const el of this.list.querySelectorAll('[aria-selected=\"true\"]')) {\n el.setAttribute('aria-selected', 'false');\n }\n }\n}\nfunction keyboardBindings(event, combobox) {\n if (event.shiftKey || event.metaKey || event.altKey)\n return;\n if (!ctrlBindings && event.ctrlKey)\n return;\n if (combobox.isComposing)\n return;\n switch (event.key) {\n case 'Enter':\n case 'Tab':\n if (commit(combobox.input, combobox.list)) {\n event.preventDefault();\n }\n break;\n case 'Escape':\n combobox.clearSelection();\n break;\n case 'ArrowDown':\n combobox.navigate(1);\n event.preventDefault();\n break;\n case 'ArrowUp':\n combobox.navigate(-1);\n event.preventDefault();\n break;\n case 'n':\n if (ctrlBindings && event.ctrlKey) {\n combobox.navigate(1);\n event.preventDefault();\n }\n break;\n case 'p':\n if (ctrlBindings && event.ctrlKey) {\n combobox.navigate(-1);\n event.preventDefault();\n }\n break;\n default:\n if (event.ctrlKey)\n break;\n combobox.clearSelection();\n }\n}\nfunction commitWithElement(event) {\n if (!(event.target instanceof Element))\n return;\n const target = event.target.closest('[role=\"option\"]');\n if (!target)\n return;\n if (target.getAttribute('aria-disabled') === 'true')\n return;\n fireCommitEvent(target);\n}\nfunction commit(input, list) {\n const target = list.querySelector('[aria-selected=\"true\"]');\n if (!target)\n return false;\n if (target.getAttribute('aria-disabled') === 'true')\n return true;\n target.click();\n return true;\n}\nfunction fireCommitEvent(target) {\n target.dispatchEvent(new CustomEvent('combobox-commit', { bubbles: true }));\n}\nfunction visible(el) {\n return (!el.hidden &&\n !(el instanceof HTMLInputElement && el.type === 'hidden') &&\n (el.offsetWidth > 0 || el.offsetHeight > 0));\n}\nfunction trackComposition(event, combobox) {\n combobox.isComposing = event.type === 'compositionstart';\n const list = document.getElementById(combobox.input.getAttribute('aria-controls') || '');\n if (!list)\n return;\n combobox.clearSelection();\n}\nfunction scrollTo(container, target) {\n if (!inViewport(container, target)) {\n container.scrollTop = target.offsetTop;\n }\n}\nfunction inViewport(container, element) {\n const scrollTop = container.scrollTop;\n const containerBottom = scrollTop + container.clientHeight;\n const top = element.offsetTop;\n const bottom = top + element.clientHeight;\n return top >= scrollTop && bottom <= containerBottom;\n}\n","import Combobox from '@github/combobox-nav';\n\nclass AutocompleteEvent extends CustomEvent {\n constructor(type, init) {\n super(type, init);\n this.relatedTarget = init.relatedTarget;\n }\n}\n\nfunction debounce(callback, wait = 0) {\n let timeout;\n return function (...Rest) {\n clearTimeout(timeout);\n timeout = window.setTimeout(() => {\n clearTimeout(timeout);\n callback(...Rest);\n }, wait);\n };\n}\n\nconst requests = new WeakMap();\nfunction fragment(el, url) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.setRequestHeader('Accept', 'text/fragment+html');\n return request(el, xhr);\n}\nfunction request(el, xhr) {\n const pending = requests.get(el);\n if (pending)\n pending.abort();\n requests.set(el, xhr);\n const clear = () => requests.delete(el);\n const result = send(xhr);\n result.then(clear, clear);\n return result;\n}\nfunction send(xhr) {\n return new Promise((resolve, reject) => {\n xhr.onload = function () {\n if (xhr.status >= 200 && xhr.status < 300) {\n resolve(xhr.responseText);\n }\n else {\n reject(new Error(xhr.responseText));\n }\n };\n xhr.onerror = reject;\n xhr.send();\n });\n}\n\nclass Autocomplete {\n constructor(container, input, results) {\n this.container = container;\n this.input = input;\n this.results = results;\n this.combobox = new Combobox(input, results);\n this.results.hidden = true;\n this.input.setAttribute('autocomplete', 'off');\n this.input.setAttribute('spellcheck', 'false');\n this.interactingWithList = false;\n this.onInputChange = debounce(this.onInputChange.bind(this), 300);\n this.onResultsMouseDown = this.onResultsMouseDown.bind(this);\n this.onInputBlur = this.onInputBlur.bind(this);\n this.onInputFocus = this.onInputFocus.bind(this);\n this.onKeydown = this.onKeydown.bind(this);\n this.onCommit = this.onCommit.bind(this);\n this.input.addEventListener('keydown', this.onKeydown);\n this.input.addEventListener('focus', this.onInputFocus);\n this.input.addEventListener('blur', this.onInputBlur);\n this.input.addEventListener('input', this.onInputChange);\n this.results.addEventListener('mousedown', this.onResultsMouseDown);\n this.results.addEventListener('combobox-commit', this.onCommit);\n }\n destroy() {\n this.input.removeEventListener('keydown', this.onKeydown);\n this.input.removeEventListener('focus', this.onInputFocus);\n this.input.removeEventListener('blur', this.onInputBlur);\n this.input.removeEventListener('input', this.onInputChange);\n this.results.removeEventListener('mousedown', this.onResultsMouseDown);\n this.results.removeEventListener('combobox-commit', this.onCommit);\n }\n onKeydown(event) {\n if (event.key === 'Escape' && this.container.open) {\n this.container.open = false;\n event.stopPropagation();\n event.preventDefault();\n }\n else if (event.altKey && event.key === 'ArrowUp' && this.container.open) {\n this.container.open = false;\n event.stopPropagation();\n event.preventDefault();\n }\n else if (event.altKey && event.key === 'ArrowDown' && !this.container.open) {\n if (!this.input.value.trim())\n return;\n this.container.open = true;\n event.stopPropagation();\n event.preventDefault();\n }\n }\n onInputFocus() {\n this.fetchResults();\n }\n onInputBlur() {\n if (this.interactingWithList) {\n this.interactingWithList = false;\n return;\n }\n this.container.open = false;\n }\n onCommit({ target }) {\n const selected = target;\n if (!(selected instanceof HTMLElement))\n return;\n this.container.open = false;\n if (selected instanceof HTMLAnchorElement)\n return;\n const value = selected.getAttribute('data-autocomplete-value') || selected.textContent;\n this.container.value = value;\n }\n onResultsMouseDown() {\n this.interactingWithList = true;\n }\n onInputChange() {\n this.container.removeAttribute('value');\n this.fetchResults();\n }\n identifyOptions() {\n let id = 0;\n for (const el of this.results.querySelectorAll('[role=\"option\"]:not([id])')) {\n el.id = `${this.results.id}-option-${id++}`;\n }\n }\n fetchResults() {\n const query = this.input.value.trim();\n if (!query) {\n this.container.open = false;\n return;\n }\n const src = this.container.src;\n if (!src)\n return;\n const url = new URL(src, window.location.href);\n const params = new URLSearchParams(url.search.slice(1));\n params.append('q', query);\n url.search = params.toString();\n this.container.dispatchEvent(new CustomEvent('loadstart'));\n fragment(this.input, url.toString())\n .then(html => {\n this.results.innerHTML = html;\n this.identifyOptions();\n const hasResults = !!this.results.querySelector('[role=\"option\"]');\n this.container.open = hasResults;\n this.container.dispatchEvent(new CustomEvent('load'));\n this.container.dispatchEvent(new CustomEvent('loadend'));\n })\n .catch(() => {\n this.container.dispatchEvent(new CustomEvent('error'));\n this.container.dispatchEvent(new CustomEvent('loadend'));\n });\n }\n open() {\n if (!this.results.hidden)\n return;\n this.combobox.start();\n this.results.hidden = false;\n }\n close() {\n if (this.results.hidden)\n return;\n this.combobox.stop();\n this.results.hidden = true;\n }\n}\n\nconst state = new WeakMap();\nclass AutocompleteElement extends HTMLElement {\n constructor() {\n super();\n }\n connectedCallback() {\n const listId = this.getAttribute('for');\n if (!listId)\n return;\n const input = this.querySelector('input');\n const results = document.getElementById(listId);\n if (!(input instanceof HTMLInputElement) || !results)\n return;\n state.set(this, new Autocomplete(this, input, results));\n results.setAttribute('role', 'listbox');\n }\n disconnectedCallback() {\n const autocomplete = state.get(this);\n if (autocomplete) {\n autocomplete.destroy();\n state.delete(this);\n }\n }\n get src() {\n return this.getAttribute('src') || '';\n }\n set src(url) {\n this.setAttribute('src', url);\n }\n get value() {\n return this.getAttribute('value') || '';\n }\n set value(value) {\n this.setAttribute('value', value);\n }\n get open() {\n return this.hasAttribute('open');\n }\n set open(value) {\n if (value) {\n this.setAttribute('open', '');\n }\n else {\n this.removeAttribute('open');\n }\n }\n static get observedAttributes() {\n return ['open', 'value'];\n }\n attributeChangedCallback(name, oldValue, newValue) {\n if (oldValue === newValue)\n return;\n const autocomplete = state.get(this);\n if (!autocomplete)\n return;\n switch (name) {\n case 'open':\n newValue === null ? autocomplete.close() : autocomplete.open();\n break;\n case 'value':\n if (newValue !== null) {\n autocomplete.input.value = newValue;\n }\n this.dispatchEvent(new AutocompleteEvent('auto-complete-change', {\n bubbles: true,\n relatedTarget: autocomplete.input\n }));\n break;\n }\n }\n}\n\nif (!window.customElements.get('auto-complete')) {\n window.AutocompleteElement = AutocompleteElement;\n window.customElements.define('auto-complete', AutocompleteElement);\n}\n\nexport default AutocompleteElement;\nexport { AutocompleteEvent };\n","export default class TabContainerElement extends HTMLElement {\n constructor() {\n super();\n this.addEventListener('keydown', (event) => {\n const target = event.target;\n if (!(target instanceof HTMLElement))\n return;\n if (target.getAttribute('role') !== 'tab' && !target.closest('[role=\"tablist\"]'))\n return;\n const tabs = Array.from(this.querySelectorAll('[role=\"tablist\"] [role=\"tab\"]'));\n const currentIndex = tabs.indexOf(tabs.find(tab => tab.matches('[aria-selected=\"true\"]')));\n if (event.code === 'ArrowRight') {\n let index = currentIndex + 1;\n if (index >= tabs.length)\n index = 0;\n selectTab(this, index);\n }\n else if (event.code === 'ArrowLeft') {\n let index = currentIndex - 1;\n if (index < 0)\n index = tabs.length - 1;\n selectTab(this, index);\n }\n else if (event.code === 'Home') {\n selectTab(this, 0);\n event.preventDefault();\n }\n else if (event.code === 'End') {\n selectTab(this, tabs.length - 1);\n event.preventDefault();\n }\n });\n this.addEventListener('click', (event) => {\n const tabs = Array.from(this.querySelectorAll('[role=\"tablist\"] [role=\"tab\"]'));\n if (!(event.target instanceof Element))\n return;\n const tab = event.target.closest('[role=\"tab\"]');\n if (!tab || !tab.closest('[role=\"tablist\"]'))\n return;\n const index = tabs.indexOf(tab);\n selectTab(this, index);\n });\n }\n connectedCallback() {\n for (const tab of this.querySelectorAll('[role=\"tablist\"] [role=\"tab\"]')) {\n if (!tab.hasAttribute('aria-selected')) {\n tab.setAttribute('aria-selected', 'false');\n }\n if (!tab.hasAttribute('tabindex')) {\n if (tab.getAttribute('aria-selected') === 'true') {\n tab.setAttribute('tabindex', '0');\n }\n else {\n tab.setAttribute('tabindex', '-1');\n }\n }\n }\n }\n}\nfunction selectTab(tabContainer, index) {\n const tabs = tabContainer.querySelectorAll('[role=\"tablist\"] [role=\"tab\"]');\n const panels = tabContainer.querySelectorAll('[role=\"tabpanel\"]');\n const selectedTab = tabs[index];\n const selectedPanel = panels[index];\n const cancelled = !tabContainer.dispatchEvent(new CustomEvent('tab-container-change', {\n bubbles: true,\n cancelable: true,\n detail: { relatedTarget: selectedPanel }\n }));\n if (cancelled)\n return;\n for (const tab of tabs) {\n tab.setAttribute('aria-selected', 'false');\n tab.setAttribute('tabindex', '-1');\n }\n for (const panel of panels) {\n panel.hidden = true;\n if (!panel.hasAttribute('tabindex') && !panel.hasAttribute('data-tab-container-no-tabstop')) {\n panel.setAttribute('tabindex', '0');\n }\n }\n selectedTab.setAttribute('aria-selected', 'true');\n selectedTab.setAttribute('tabindex', '0');\n selectedTab.focus();\n selectedPanel.hidden = false;\n tabContainer.dispatchEvent(new CustomEvent('tab-container-changed', {\n bubbles: true,\n detail: { relatedTarget: selectedPanel }\n }));\n}\nif (!window.customElements.get('tab-container')) {\n window.TabContainerElement = TabContainerElement;\n window.customElements.define('tab-container', TabContainerElement);\n}\n//# sourceMappingURL=index.js.map","const weekdays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];\nconst months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];\n\nfunction pad(num) {\n return \"0\".concat(num).slice(-2);\n}\n\nfunction strftime(time, formatString) {\n const day = time.getDay();\n const date = time.getDate();\n const month = time.getMonth();\n const year = time.getFullYear();\n const hour = time.getHours();\n const minute = time.getMinutes();\n const second = time.getSeconds();\n return formatString.replace(/%([%aAbBcdeHIlmMpPSwyYZz])/g, function (_arg) {\n let match;\n const modifier = _arg[1];\n\n switch (modifier) {\n case '%':\n return '%';\n\n case 'a':\n return weekdays[day].slice(0, 3);\n\n case 'A':\n return weekdays[day];\n\n case 'b':\n return months[month].slice(0, 3);\n\n case 'B':\n return months[month];\n\n case 'c':\n return time.toString();\n\n case 'd':\n return pad(date);\n\n case 'e':\n return String(date);\n\n case 'H':\n return pad(hour);\n\n case 'I':\n return pad(strftime(time, '%l'));\n\n case 'l':\n if (hour === 0 || hour === 12) {\n return String(12);\n } else {\n return String((hour + 12) % 12);\n }\n\n case 'm':\n return pad(month + 1);\n\n case 'M':\n return pad(minute);\n\n case 'p':\n if (hour > 11) {\n return 'PM';\n } else {\n return 'AM';\n }\n\n case 'P':\n if (hour > 11) {\n return 'pm';\n } else {\n return 'am';\n }\n\n case 'S':\n return pad(second);\n\n case 'w':\n return String(day);\n\n case 'y':\n return pad(year % 100);\n\n case 'Y':\n return String(year);\n\n case 'Z':\n match = time.toString().match(/\\((\\w+)\\)$/);\n return match ? match[1] : '';\n\n case 'z':\n match = time.toString().match(/\\w([+-]\\d\\d\\d\\d) /);\n return match ? match[1] : '';\n }\n\n return '';\n });\n}\nfunction makeFormatter(options) {\n let format;\n return function () {\n if (format) return format;\n\n if ('Intl' in window) {\n try {\n format = new Intl.DateTimeFormat(undefined, options);\n return format;\n } catch (e) {\n if (!(e instanceof RangeError)) {\n throw e;\n }\n }\n }\n };\n}\nlet dayFirst = null;\nconst dayFirstFormatter = makeFormatter({\n day: 'numeric',\n month: 'short'\n}); // Private: Determine if the day should be formatted before the month name in\n// the user's current locale. For example, `9 Jun` for en-GB and `Jun 9`\n// for en-US.\n//\n// Returns true if the day appears before the month.\n\nfunction isDayFirst() {\n if (dayFirst !== null) {\n return dayFirst;\n }\n\n const formatter = dayFirstFormatter();\n\n if (formatter) {\n const output = formatter.format(new Date(0));\n dayFirst = !!output.match(/^\\d/);\n return dayFirst;\n } else {\n return false;\n }\n}\nlet yearSeparator = null;\nconst yearFormatter = makeFormatter({\n day: 'numeric',\n month: 'short',\n year: 'numeric'\n}); // Private: Determine if the year should be separated from the month and day\n// with a comma. For example, `9 Jun 2014` in en-GB and `Jun 9, 2014` in en-US.\n//\n// Returns true if the date needs a separator.\n\nfunction isYearSeparator() {\n if (yearSeparator !== null) {\n return yearSeparator;\n }\n\n const formatter = yearFormatter();\n\n if (formatter) {\n const output = formatter.format(new Date(0));\n yearSeparator = !!output.match(/\\d,/);\n return yearSeparator;\n } else {\n return true;\n }\n} // Private: Determine if the date occurs in the same year as today's date.\n//\n// date - The Date to test.\n//\n// Returns true if it's this year.\n\nfunction isThisYear(date) {\n const now = new Date();\n return now.getUTCFullYear() === date.getUTCFullYear();\n}\nfunction makeRelativeFormat(locale, options) {\n if ('Intl' in window && 'RelativeTimeFormat' in window.Intl) {\n try {\n // eslint-disable-next-line flowtype/no-flow-fix-me-comments\n // $FlowFixMe: missing RelativeTimeFormat type\n return new Intl.RelativeTimeFormat(locale, options);\n } catch (e) {\n if (!(e instanceof RangeError)) {\n throw e;\n }\n }\n }\n} // Private: Get preferred Intl locale for a target element.\n//\n// Traverses parents until it finds an explicit `lang` other returns \"default\".\n\nfunction localeFromElement(el) {\n const container = el.closest('[lang]');\n\n if (container instanceof HTMLElement && container.lang) {\n return container.lang;\n }\n\n return 'default';\n}\n\nconst datetimes = new WeakMap();\nclass ExtendedTimeElement extends HTMLElement {\n static get observedAttributes() {\n return ['datetime', 'day', 'format', 'lang', 'hour', 'minute', 'month', 'second', 'title', 'weekday', 'year'];\n }\n\n connectedCallback() {\n const title = this.getFormattedTitle();\n\n if (title && !this.hasAttribute('title')) {\n this.setAttribute('title', title);\n }\n\n const text = this.getFormattedDate();\n\n if (text) {\n this.textContent = text;\n }\n } // Internal: Refresh the time element's formatted date when an attribute changes.\n\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n const oldTitle = this.getFormattedTitle();\n\n if (attrName === 'datetime') {\n const millis = Date.parse(newValue);\n\n if (isNaN(millis)) {\n datetimes.delete(this);\n } else {\n datetimes.set(this, new Date(millis));\n }\n }\n\n const title = this.getFormattedTitle();\n const currentTitle = this.getAttribute('title');\n\n if (attrName !== 'title' && title && (!currentTitle || currentTitle === oldTitle)) {\n this.setAttribute('title', title);\n }\n\n const text = this.getFormattedDate();\n\n if (text) {\n this.textContent = text;\n }\n }\n\n get date() {\n return datetimes.get(this);\n } // Internal: Format the ISO 8601 timestamp according to the user agent's\n // locale-aware formatting rules. The element's existing `title` attribute\n // value takes precedence over this custom format.\n //\n // Returns a formatted time String.\n\n\n getFormattedTitle() {\n const date = this.date;\n if (!date) return;\n const formatter = titleFormatter();\n\n if (formatter) {\n return formatter.format(date);\n } else {\n try {\n return date.toLocaleString();\n } catch (e) {\n if (e instanceof RangeError) {\n return date.toString();\n } else {\n throw e;\n }\n }\n }\n }\n\n getFormattedDate() {}\n\n}\nconst titleFormatter = makeFormatter({\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n timeZoneName: 'short'\n});\n\nconst formatters = new WeakMap();\nclass LocalTimeElement extends ExtendedTimeElement {\n attributeChangedCallback(attrName, oldValue, newValue) {\n if (attrName === 'hour' || attrName === 'minute' || attrName === 'second' || attrName === 'time-zone-name') {\n formatters.delete(this);\n }\n\n super.attributeChangedCallback(attrName, oldValue, newValue);\n } // Formats the element's date, in the user's current locale, according to\n // the formatting attribute values. Values are not passed straight through to\n // an Intl.DateTimeFormat instance so that weekday and month names are always\n // displayed in English, for now.\n //\n // Supported attributes are:\n //\n // weekday - \"short\", \"long\"\n // year - \"numeric\", \"2-digit\"\n // month - \"short\", \"long\"\n // day - \"numeric\", \"2-digit\"\n // hour - \"numeric\", \"2-digit\"\n // minute - \"numeric\", \"2-digit\"\n // second - \"numeric\", \"2-digit\"\n //\n // Returns a formatted time String.\n\n\n getFormattedDate() {\n const d = this.date;\n if (!d) return;\n const date = formatDate(this, d) || '';\n const time = formatTime(this, d) || '';\n return \"\".concat(date, \" \").concat(time).trim();\n }\n\n} // Private: Format a date according to the `weekday`, `day`, `month`,\n// and `year` attribute values.\n//\n// This doesn't use Intl.DateTimeFormat to avoid creating text in the user's\n// language when the majority of the surrounding text is in English. There's\n// currently no way to separate the language from the format in Intl.\n//\n// el - The local-time element to format.\n//\n// Returns a date String or null if no date formats are provided.\n\nfunction formatDate(el, date) {\n // map attribute values to strftime\n const props = {\n weekday: {\n short: '%a',\n long: '%A'\n },\n day: {\n numeric: '%e',\n '2-digit': '%d'\n },\n month: {\n short: '%b',\n long: '%B'\n },\n year: {\n numeric: '%Y',\n '2-digit': '%y'\n }\n }; // build a strftime format string\n\n let format = isDayFirst() ? 'weekday day month year' : 'weekday month day, year';\n\n for (const prop in props) {\n const value = props[prop][el.getAttribute(prop)];\n format = format.replace(prop, value || '');\n } // clean up year separator comma\n\n\n format = format.replace(/(\\s,)|(,\\s$)/, ''); // squeeze spaces from final string\n\n return strftime(date, format).replace(/\\s+/, ' ').trim();\n} // Private: Format a time according to the `hour`, `minute`, and `second`\n// attribute values.\n//\n// el - The local-time element to format.\n//\n// Returns a time String or null if no time formats are provided.\n\n\nfunction formatTime(el, date) {\n const options = {}; // retrieve format settings from attributes\n\n const hour = el.getAttribute('hour');\n if (hour === 'numeric' || hour === '2-digit') options.hour = hour;\n const minute = el.getAttribute('minute');\n if (minute === 'numeric' || minute === '2-digit') options.minute = minute;\n const second = el.getAttribute('second');\n if (second === 'numeric' || second === '2-digit') options.second = second;\n const tz = el.getAttribute('time-zone-name');\n if (tz === 'short' || tz === 'long') options.timeZoneName = tz; // No time format attributes provided.\n\n if (Object.keys(options).length === 0) {\n return;\n }\n\n let factory = formatters.get(el);\n\n if (!factory) {\n factory = makeFormatter(options);\n formatters.set(el, factory);\n }\n\n const formatter = factory();\n\n if (formatter) {\n // locale-aware formatting of 24 or 12 hour times\n return formatter.format(date);\n } else {\n // fall back to strftime for non-Intl browsers\n const timef = options.second ? '%H:%M:%S' : '%H:%M';\n return strftime(date, timef);\n }\n} // Public: LocalTimeElement constructor.\n//\n// var time = new LocalTimeElement()\n// # => <local-time></local-time>\n//\n\n\nif (!window.customElements.get('local-time')) {\n window.LocalTimeElement = LocalTimeElement;\n window.customElements.define('local-time', LocalTimeElement);\n}\n\nclass RelativeTime {\n constructor(date, locale) {\n this.date = date;\n this.locale = locale;\n }\n\n toString() {\n const ago = this.timeElapsed();\n\n if (ago) {\n return ago;\n } else {\n const ahead = this.timeAhead();\n\n if (ahead) {\n return ahead;\n } else {\n return \"on \".concat(this.formatDate());\n }\n }\n }\n\n timeElapsed() {\n const ms = new Date().getTime() - this.date.getTime();\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n\n if (ms >= 0 && day < 30) {\n return this.timeAgoFromMs(ms);\n } else {\n return null;\n }\n }\n\n timeAhead() {\n const ms = this.date.getTime() - new Date().getTime();\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n\n if (ms >= 0 && day < 30) {\n return this.timeUntil();\n } else {\n return null;\n }\n }\n\n timeAgo() {\n const ms = new Date().getTime() - this.date.getTime();\n return this.timeAgoFromMs(ms);\n }\n\n timeAgoFromMs(ms) {\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n\n if (ms < 0) {\n return formatRelativeTime(this.locale, 0, 'second');\n } else if (sec < 10) {\n return formatRelativeTime(this.locale, 0, 'second');\n } else if (sec < 45) {\n return formatRelativeTime(this.locale, -sec, 'second');\n } else if (sec < 90) {\n return formatRelativeTime(this.locale, -min, 'minute');\n } else if (min < 45) {\n return formatRelativeTime(this.locale, -min, 'minute');\n } else if (min < 90) {\n return formatRelativeTime(this.locale, -hr, 'hour');\n } else if (hr < 24) {\n return formatRelativeTime(this.locale, -hr, 'hour');\n } else if (hr < 36) {\n return formatRelativeTime(this.locale, -day, 'day');\n } else if (day < 30) {\n return formatRelativeTime(this.locale, -day, 'day');\n } else if (month < 18) {\n return formatRelativeTime(this.locale, -month, 'month');\n } else {\n return formatRelativeTime(this.locale, -year, 'year');\n }\n }\n\n microTimeAgo() {\n const ms = new Date().getTime() - this.date.getTime();\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n\n if (min < 1) {\n return '1m';\n } else if (min < 60) {\n return \"\".concat(min, \"m\");\n } else if (hr < 24) {\n return \"\".concat(hr, \"h\");\n } else if (day < 365) {\n return \"\".concat(day, \"d\");\n } else {\n return \"\".concat(year, \"y\");\n }\n }\n\n timeUntil() {\n const ms = this.date.getTime() - new Date().getTime();\n return this.timeUntilFromMs(ms);\n }\n\n timeUntilFromMs(ms) {\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n\n if (month >= 18) {\n return formatRelativeTime(this.locale, year, 'year');\n } else if (month >= 12) {\n return formatRelativeTime(this.locale, year, 'year');\n } else if (day >= 45) {\n return formatRelativeTime(this.locale, month, 'month');\n } else if (day >= 30) {\n return formatRelativeTime(this.locale, month, 'month');\n } else if (hr >= 36) {\n return formatRelativeTime(this.locale, day, 'day');\n } else if (hr >= 24) {\n return formatRelativeTime(this.locale, day, 'day');\n } else if (min >= 90) {\n return formatRelativeTime(this.locale, hr, 'hour');\n } else if (min >= 45) {\n return formatRelativeTime(this.locale, hr, 'hour');\n } else if (sec >= 90) {\n return formatRelativeTime(this.locale, min, 'minute');\n } else if (sec >= 45) {\n return formatRelativeTime(this.locale, min, 'minute');\n } else if (sec >= 10) {\n return formatRelativeTime(this.locale, sec, 'second');\n } else {\n return formatRelativeTime(this.locale, 0, 'second');\n }\n }\n\n microTimeUntil() {\n const ms = this.date.getTime() - new Date().getTime();\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n\n if (day >= 365) {\n return \"\".concat(year, \"y\");\n } else if (hr >= 24) {\n return \"\".concat(day, \"d\");\n } else if (min >= 60) {\n return \"\".concat(hr, \"h\");\n } else if (min > 1) {\n return \"\".concat(min, \"m\");\n } else {\n return '1m';\n }\n }\n\n formatDate() {\n let format = isDayFirst() ? '%e %b' : '%b %e';\n\n if (!isThisYear(this.date)) {\n format += isYearSeparator() ? ', %Y' : ' %Y';\n }\n\n return strftime(this.date, format);\n }\n\n formatTime() {\n const formatter = timeFormatter();\n\n if (formatter) {\n return formatter.format(this.date);\n } else {\n return strftime(this.date, '%l:%M%P');\n }\n }\n\n}\n\nfunction formatRelativeTime(locale, value, unit) {\n const formatter = makeRelativeFormat(locale, {\n numeric: 'auto'\n });\n\n if (formatter) {\n return formatter.format(value, unit);\n } else {\n return formatEnRelativeTime(value, unit);\n }\n} // Simplified \"en\" RelativeTimeFormat.format function\n//\n// Values should roughly match\n// new Intl.RelativeTimeFormat('en', {numeric: 'auto'}).format(value, unit)\n//\n\n\nfunction formatEnRelativeTime(value, unit) {\n if (value === 0) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n return \"this \".concat(unit);\n\n case 'day':\n return 'today';\n\n case 'hour':\n case 'minute':\n return \"in 0 \".concat(unit, \"s\");\n\n case 'second':\n return 'now';\n }\n } else if (value === 1) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n return \"next \".concat(unit);\n\n case 'day':\n return 'tomorrow';\n\n case 'hour':\n case 'minute':\n case 'second':\n return \"in 1 \".concat(unit);\n }\n } else if (value === -1) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n return \"last \".concat(unit);\n\n case 'day':\n return 'yesterday';\n\n case 'hour':\n case 'minute':\n case 'second':\n return \"1 \".concat(unit, \" ago\");\n }\n } else if (value > 1) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n case 'day':\n case 'hour':\n case 'minute':\n case 'second':\n return \"in \".concat(value, \" \").concat(unit, \"s\");\n }\n } else if (value < -1) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n case 'day':\n case 'hour':\n case 'minute':\n case 'second':\n return \"\".concat(-value, \" \").concat(unit, \"s ago\");\n }\n }\n\n throw new RangeError(\"Invalid unit argument for format() '\".concat(unit, \"'\"));\n}\n\nconst timeFormatter = makeFormatter({\n hour: 'numeric',\n minute: '2-digit'\n});\n\nclass RelativeTimeElement extends ExtendedTimeElement {\n getFormattedDate() {\n const date = this.date;\n\n if (date) {\n return new RelativeTime(date, localeFromElement(this)).toString();\n }\n }\n\n connectedCallback() {\n nowElements.push(this);\n\n if (!updateNowElementsId) {\n updateNowElements();\n updateNowElementsId = setInterval(updateNowElements, 60 * 1000);\n }\n\n super.connectedCallback();\n }\n\n disconnectedCallback() {\n const ix = nowElements.indexOf(this);\n\n if (ix !== -1) {\n nowElements.splice(ix, 1);\n }\n\n if (!nowElements.length) {\n if (updateNowElementsId) {\n clearInterval(updateNowElementsId);\n updateNowElementsId = null;\n }\n }\n }\n\n} // Internal: Array tracking all elements attached to the document that need\n// to be updated every minute.\n\nconst nowElements = []; // Internal: Timer ID for `updateNowElements` interval.\n\nlet updateNowElementsId; // Internal: Install a timer to refresh all attached relative-time elements every\n// minute.\n\nfunction updateNowElements() {\n let time, i, len;\n\n for (i = 0, len = nowElements.length; i < len; i++) {\n time = nowElements[i];\n time.textContent = time.getFormattedDate() || '';\n }\n} // Public: RelativeTimeElement constructor.\n//\n// var time = new RelativeTimeElement()\n// # => <relative-time></relative-time>\n//\n\n\nif (!window.customElements.get('relative-time')) {\n window.RelativeTimeElement = RelativeTimeElement;\n window.customElements.define('relative-time', RelativeTimeElement);\n}\n\nclass TimeAgoElement extends RelativeTimeElement {\n getFormattedDate() {\n const format = this.getAttribute('format');\n const date = this.date;\n if (!date) return;\n\n if (format === 'micro') {\n return new RelativeTime(date, localeFromElement(this)).microTimeAgo();\n } else {\n return new RelativeTime(date, localeFromElement(this)).timeAgo();\n }\n }\n\n}\n\nif (!window.customElements.get('time-ago')) {\n window.TimeAgoElement = TimeAgoElement;\n window.customElements.define('time-ago', TimeAgoElement);\n}\n\nclass TimeUntilElement extends RelativeTimeElement {\n getFormattedDate() {\n const format = this.getAttribute('format');\n const date = this.date;\n if (!date) return;\n\n if (format === 'micro') {\n return new RelativeTime(date, localeFromElement(this)).microTimeUntil();\n } else {\n return new RelativeTime(date, localeFromElement(this)).timeUntil();\n }\n }\n\n}\n\nif (!window.customElements.get('time-until')) {\n window.TimeUntilElement = TimeUntilElement;\n window.customElements.define('time-until', TimeUntilElement);\n}\n\nexport { LocalTimeElement, RelativeTimeElement, TimeAgoElement, TimeUntilElement };\n"],"names":["ctrlBindings","navigator","userAgent","match","Combobox","[object Object]","input","list","this","isComposing","id","Math","random","toString","slice","keyboardEventHandler","event","combobox","shiftKey","metaKey","altKey","ctrlKey","key","target","querySelector","getAttribute","click","commit","preventDefault","clearSelection","navigate","keyboardBindings","compositionEventHandler","type","document","getElementById","trackComposition","inputHandler","bind","setAttribute","stop","removeAttribute","addEventListener","commitWithElement","removeEventListener","indexDiff","focusEl","Array","from","querySelectorAll","filter","visible","els","focusIndex","indexOf","length","focus","indexOfItem","newIndex","el","scrollTo","Element","closest","dispatchEvent","CustomEvent","bubbles","fireCommitEvent","hidden","HTMLInputElement","offsetWidth","offsetHeight","container","element","scrollTop","containerBottom","clientHeight","top","offsetTop","bottom","inViewport","AutocompleteEvent","init","super","relatedTarget","requests","WeakMap","fragment","url","xhr","XMLHttpRequest","open","setRequestHeader","pending","get","abort","set","clear","delete","result","Promise","resolve","reject","onload","status","responseText","Error","onerror","send","then","request","Autocomplete","results","interactingWithList","onInputChange","callback","wait","timeout","Rest","clearTimeout","window","setTimeout","debounce","onResultsMouseDown","onInputBlur","onInputFocus","onKeydown","onCommit","stopPropagation","value","trim","fetchResults","selected","HTMLElement","HTMLAnchorElement","textContent","query","src","URL","location","href","params","URLSearchParams","search","append","html","innerHTML","identifyOptions","hasResults","catch","start","state","AutocompleteElement","listId","autocomplete","destroy","hasAttribute","observedAttributes","name","oldValue","newValue","close","customElements","define","TabContainerElement","tabs","currentIndex","find","tab","matches","code","index","selectTab","tabContainer","panels","selectedTab","selectedPanel","cancelable","detail","panel","weekdays","months","pad","num","concat","strftime","time","formatString","day","getDay","date","getDate","month","getMonth","year","getFullYear","hour","getHours","minute","getMinutes","second","getSeconds","replace","_arg","String","makeFormatter","options","format","Intl","DateTimeFormat","undefined","e","RangeError","dayFirst","dayFirstFormatter","isDayFirst","formatter","output","Date","yearSeparator","yearFormatter","localeFromElement","lang","datetimes","ExtendedTimeElement","title","getFormattedTitle","text","getFormattedDate","attrName","oldTitle","millis","parse","isNaN","currentTitle","titleFormatter","toLocaleString","timeZoneName","formatters","LocalTimeElement","attributeChangedCallback","d","props","weekday","short","long","numeric","2-digit","prop","formatDate","tz","Object","keys","factory","formatTime","RelativeTime","locale","ago","timeElapsed","ahead","timeAhead","ms","getTime","sec","round","min","hr","timeAgoFromMs","timeUntil","formatRelativeTime","timeUntilFromMs","getUTCFullYear","isYearSeparator","timeFormatter","unit","RelativeTimeFormat","makeRelativeFormat","formatEnRelativeTime","RelativeTimeElement","nowElements","push","updateNowElementsId","updateNowElements","setInterval","connectedCallback","ix","splice","clearInterval","i","len","TimeAgoElement","microTimeAgo","timeAgo","TimeUntilElement","microTimeUntil"],"mappings":"AAAA,MAAMA,IAAiBC,UAAUC,UAAUC,MAAM,aAClC,MAAMC,EACjBC,YAAYC,EAAOC,GACfC,KAAKF,MAAQA,EACbE,KAAKD,KAAOA,EACZC,KAAKC,aAAc,EACdF,EAAKG,KACNH,EAAKG,GAAK,YAAYC,KAAKC,SACtBC,WACAC,MAAM,EAAG,MAElBN,KAAKO,qBAAuBC,GAuEpC,SAA0BA,EAAOC,GAC7B,GAAID,EAAME,UAAYF,EAAMG,SAAWH,EAAMI,OACzC,OACJ,IAAKpB,GAAgBgB,EAAMK,QACvB,OACJ,GAAIJ,EAASR,YACT,OACJ,OAAQO,EAAMM,KACV,IAAK,QACL,IAAK,OA4Cb,SAAgBhB,EAAOC,GACnB,MAAMgB,EAAShB,EAAKiB,cAAc,0BAClC,QAAKD,IAEwC,SAAzCA,EAAOE,aAAa,kBAExBF,EAAOG,SADI,IAhDCC,CAAOV,EAASX,MAAOW,EAASV,OAChCS,EAAMY,iBAEV,MACJ,IAAK,SACDX,EAASY,iBACT,MACJ,IAAK,YACDZ,EAASa,SAAS,GAClBd,EAAMY,iBACN,MACJ,IAAK,UACDX,EAASa,UAAU,GACnBd,EAAMY,iBACN,MACJ,IAAK,IACG5B,GAAgBgB,EAAMK,UACtBJ,EAASa,SAAS,GAClBd,EAAMY,kBAEV,MACJ,IAAK,IACG5B,GAAgBgB,EAAMK,UACtBJ,EAASa,UAAU,GACnBd,EAAMY,kBAEV,MACJ,QACI,GAAIZ,EAAM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,IAG3C,MAAMG,UAAyBf,EAC7BhR,mBACE,MAAMyM,EAAStM,KAAKiB,aAAa,UAC3BoK,EAAOrL,KAAKqL,KAClB,GAAKA,EAEL,MAAe,UAAXiB,EACK,IAAIgD,EAAajE,EAAM+B,EAAkBpN,OAAO6R,iBAEhD,IAAIvC,EAAajE,EAAM+B,EAAkBpN,OAAOmQ,aAMxDpJ,OAAO0C,eAAepE,IAAI,gBAC7B0B,OAAO6K,iBAAmBA,EAC1B7K,OAAO0C,eAAeC,OAAO,aAAckI"}
|
1
|
+
{"version":3,"file":"primer_view_components.js","sources":["../../../node_modules/@github/combobox-nav/dist/index.js","../../../node_modules/@github/auto-complete-element/dist/index.js","../../../node_modules/@github/clipboard-copy-element/dist/index.esm.js","../../components/primer/clipboard_copy_component.js","../../../node_modules/@github/tab-container-element/dist/index.js","../../../node_modules/@github/time-elements/dist/time-elements.js"],"sourcesContent":["const ctrlBindings = !!navigator.userAgent.match(/Macintosh/);\nexport default class Combobox {\n constructor(input, list) {\n this.input = input;\n this.list = list;\n this.isComposing = false;\n if (!list.id) {\n list.id = `combobox-${Math.random()\n .toString()\n .slice(2, 6)}`;\n }\n this.keyboardEventHandler = event => keyboardBindings(event, this);\n this.compositionEventHandler = event => trackComposition(event, this);\n this.inputHandler = this.clearSelection.bind(this);\n input.setAttribute('role', 'combobox');\n input.setAttribute('aria-controls', list.id);\n input.setAttribute('aria-expanded', 'false');\n input.setAttribute('aria-autocomplete', 'list');\n input.setAttribute('aria-haspopup', 'listbox');\n }\n destroy() {\n this.clearSelection();\n this.stop();\n this.input.removeAttribute('role');\n this.input.removeAttribute('aria-controls');\n this.input.removeAttribute('aria-expanded');\n this.input.removeAttribute('aria-autocomplete');\n this.input.removeAttribute('aria-haspopup');\n }\n start() {\n this.input.setAttribute('aria-expanded', 'true');\n this.input.addEventListener('compositionstart', this.compositionEventHandler);\n this.input.addEventListener('compositionend', this.compositionEventHandler);\n this.input.addEventListener('input', this.inputHandler);\n this.input.addEventListener('keydown', this.keyboardEventHandler);\n this.list.addEventListener('click', commitWithElement);\n }\n stop() {\n this.clearSelection();\n this.input.setAttribute('aria-expanded', 'false');\n this.input.removeEventListener('compositionstart', this.compositionEventHandler);\n this.input.removeEventListener('compositionend', this.compositionEventHandler);\n this.input.removeEventListener('input', this.inputHandler);\n this.input.removeEventListener('keydown', this.keyboardEventHandler);\n this.list.removeEventListener('click', commitWithElement);\n }\n navigate(indexDiff = 1) {\n const focusEl = Array.from(this.list.querySelectorAll('[aria-selected=\"true\"]')).filter(visible)[0];\n const els = Array.from(this.list.querySelectorAll('[role=\"option\"]')).filter(visible);\n const focusIndex = els.indexOf(focusEl);\n if ((focusIndex === els.length - 1 && indexDiff === 1) || (focusIndex === 0 && indexDiff === -1)) {\n this.clearSelection();\n this.input.focus();\n return;\n }\n let indexOfItem = indexDiff === 1 ? 0 : els.length - 1;\n if (focusEl && focusIndex >= 0) {\n const newIndex = focusIndex + indexDiff;\n if (newIndex >= 0 && newIndex < els.length)\n indexOfItem = newIndex;\n }\n const target = els[indexOfItem];\n if (!target)\n return;\n for (const el of els) {\n if (target === el) {\n this.input.setAttribute('aria-activedescendant', target.id);\n target.setAttribute('aria-selected', 'true');\n scrollTo(this.list, target);\n }\n else {\n el.setAttribute('aria-selected', 'false');\n }\n }\n }\n clearSelection() {\n this.input.removeAttribute('aria-activedescendant');\n for (const el of this.list.querySelectorAll('[aria-selected=\"true\"]')) {\n el.setAttribute('aria-selected', 'false');\n }\n }\n}\nfunction keyboardBindings(event, combobox) {\n if (event.shiftKey || event.metaKey || event.altKey)\n return;\n if (!ctrlBindings && event.ctrlKey)\n return;\n if (combobox.isComposing)\n return;\n switch (event.key) {\n case 'Enter':\n case 'Tab':\n if (commit(combobox.input, combobox.list)) {\n event.preventDefault();\n }\n break;\n case 'Escape':\n combobox.clearSelection();\n break;\n case 'ArrowDown':\n combobox.navigate(1);\n event.preventDefault();\n break;\n case 'ArrowUp':\n combobox.navigate(-1);\n event.preventDefault();\n break;\n case 'n':\n if (ctrlBindings && event.ctrlKey) {\n combobox.navigate(1);\n event.preventDefault();\n }\n break;\n case 'p':\n if (ctrlBindings && event.ctrlKey) {\n combobox.navigate(-1);\n event.preventDefault();\n }\n break;\n default:\n if (event.ctrlKey)\n break;\n combobox.clearSelection();\n }\n}\nfunction commitWithElement(event) {\n if (!(event.target instanceof Element))\n return;\n const target = event.target.closest('[role=\"option\"]');\n if (!target)\n return;\n if (target.getAttribute('aria-disabled') === 'true')\n return;\n fireCommitEvent(target);\n}\nfunction commit(input, list) {\n const target = list.querySelector('[aria-selected=\"true\"]');\n if (!target)\n return false;\n if (target.getAttribute('aria-disabled') === 'true')\n return true;\n target.click();\n return true;\n}\nfunction fireCommitEvent(target) {\n target.dispatchEvent(new CustomEvent('combobox-commit', { bubbles: true }));\n}\nfunction visible(el) {\n return (!el.hidden &&\n !(el instanceof HTMLInputElement && el.type === 'hidden') &&\n (el.offsetWidth > 0 || el.offsetHeight > 0));\n}\nfunction trackComposition(event, combobox) {\n combobox.isComposing = event.type === 'compositionstart';\n const list = document.getElementById(combobox.input.getAttribute('aria-controls') || '');\n if (!list)\n return;\n combobox.clearSelection();\n}\nfunction scrollTo(container, target) {\n if (!inViewport(container, target)) {\n container.scrollTop = target.offsetTop;\n }\n}\nfunction inViewport(container, element) {\n const scrollTop = container.scrollTop;\n const containerBottom = scrollTop + container.clientHeight;\n const top = element.offsetTop;\n const bottom = top + element.clientHeight;\n return top >= scrollTop && bottom <= containerBottom;\n}\n","import Combobox from '@github/combobox-nav';\n\nclass AutocompleteEvent extends CustomEvent {\n constructor(type, init) {\n super(type, init);\n this.relatedTarget = init.relatedTarget;\n }\n}\n\nfunction debounce(callback, wait = 0) {\n let timeout;\n return function (...Rest) {\n clearTimeout(timeout);\n timeout = window.setTimeout(() => {\n clearTimeout(timeout);\n callback(...Rest);\n }, wait);\n };\n}\n\nconst requests = new WeakMap();\nfunction fragment(el, url) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.setRequestHeader('Accept', 'text/fragment+html');\n return request(el, xhr);\n}\nfunction request(el, xhr) {\n const pending = requests.get(el);\n if (pending)\n pending.abort();\n requests.set(el, xhr);\n const clear = () => requests.delete(el);\n const result = send(xhr);\n result.then(clear, clear);\n return result;\n}\nfunction send(xhr) {\n return new Promise((resolve, reject) => {\n xhr.onload = function () {\n if (xhr.status >= 200 && xhr.status < 300) {\n resolve(xhr.responseText);\n }\n else {\n reject(new Error(xhr.responseText));\n }\n };\n xhr.onerror = reject;\n xhr.send();\n });\n}\n\nclass Autocomplete {\n constructor(container, input, results) {\n this.container = container;\n this.input = input;\n this.results = results;\n this.combobox = new Combobox(input, results);\n this.results.hidden = true;\n this.input.setAttribute('autocomplete', 'off');\n this.input.setAttribute('spellcheck', 'false');\n this.interactingWithList = false;\n this.onInputChange = debounce(this.onInputChange.bind(this), 300);\n this.onResultsMouseDown = this.onResultsMouseDown.bind(this);\n this.onInputBlur = this.onInputBlur.bind(this);\n this.onInputFocus = this.onInputFocus.bind(this);\n this.onKeydown = this.onKeydown.bind(this);\n this.onCommit = this.onCommit.bind(this);\n this.input.addEventListener('keydown', this.onKeydown);\n this.input.addEventListener('focus', this.onInputFocus);\n this.input.addEventListener('blur', this.onInputBlur);\n this.input.addEventListener('input', this.onInputChange);\n this.results.addEventListener('mousedown', this.onResultsMouseDown);\n this.results.addEventListener('combobox-commit', this.onCommit);\n }\n destroy() {\n this.input.removeEventListener('keydown', this.onKeydown);\n this.input.removeEventListener('focus', this.onInputFocus);\n this.input.removeEventListener('blur', this.onInputBlur);\n this.input.removeEventListener('input', this.onInputChange);\n this.results.removeEventListener('mousedown', this.onResultsMouseDown);\n this.results.removeEventListener('combobox-commit', this.onCommit);\n }\n onKeydown(event) {\n if (event.key === 'Escape' && this.container.open) {\n this.container.open = false;\n event.stopPropagation();\n event.preventDefault();\n }\n else if (event.altKey && event.key === 'ArrowUp' && this.container.open) {\n this.container.open = false;\n event.stopPropagation();\n event.preventDefault();\n }\n else if (event.altKey && event.key === 'ArrowDown' && !this.container.open) {\n if (!this.input.value.trim())\n return;\n this.container.open = true;\n event.stopPropagation();\n event.preventDefault();\n }\n }\n onInputFocus() {\n this.fetchResults();\n }\n onInputBlur() {\n if (this.interactingWithList) {\n this.interactingWithList = false;\n return;\n }\n this.container.open = false;\n }\n onCommit({ target }) {\n const selected = target;\n if (!(selected instanceof HTMLElement))\n return;\n this.container.open = false;\n if (selected instanceof HTMLAnchorElement)\n return;\n const value = selected.getAttribute('data-autocomplete-value') || selected.textContent;\n this.container.value = value;\n }\n onResultsMouseDown() {\n this.interactingWithList = true;\n }\n onInputChange() {\n this.container.removeAttribute('value');\n this.fetchResults();\n }\n identifyOptions() {\n let id = 0;\n for (const el of this.results.querySelectorAll('[role=\"option\"]:not([id])')) {\n el.id = `${this.results.id}-option-${id++}`;\n }\n }\n fetchResults() {\n const query = this.input.value.trim();\n if (!query) {\n this.container.open = false;\n return;\n }\n const src = this.container.src;\n if (!src)\n return;\n const url = new URL(src, window.location.href);\n const params = new URLSearchParams(url.search.slice(1));\n params.append('q', query);\n url.search = params.toString();\n this.container.dispatchEvent(new CustomEvent('loadstart'));\n fragment(this.input, url.toString())\n .then(html => {\n this.results.innerHTML = html;\n this.identifyOptions();\n const hasResults = !!this.results.querySelector('[role=\"option\"]');\n this.container.open = hasResults;\n this.container.dispatchEvent(new CustomEvent('load'));\n this.container.dispatchEvent(new CustomEvent('loadend'));\n })\n .catch(() => {\n this.container.dispatchEvent(new CustomEvent('error'));\n this.container.dispatchEvent(new CustomEvent('loadend'));\n });\n }\n open() {\n if (!this.results.hidden)\n return;\n this.combobox.start();\n this.results.hidden = false;\n }\n close() {\n if (this.results.hidden)\n return;\n this.combobox.stop();\n this.results.hidden = true;\n }\n}\n\nconst state = new WeakMap();\nclass AutocompleteElement extends HTMLElement {\n constructor() {\n super();\n }\n connectedCallback() {\n const listId = this.getAttribute('for');\n if (!listId)\n return;\n const input = this.querySelector('input');\n const results = document.getElementById(listId);\n if (!(input instanceof HTMLInputElement) || !results)\n return;\n state.set(this, new Autocomplete(this, input, results));\n results.setAttribute('role', 'listbox');\n }\n disconnectedCallback() {\n const autocomplete = state.get(this);\n if (autocomplete) {\n autocomplete.destroy();\n state.delete(this);\n }\n }\n get src() {\n return this.getAttribute('src') || '';\n }\n set src(url) {\n this.setAttribute('src', url);\n }\n get value() {\n return this.getAttribute('value') || '';\n }\n set value(value) {\n this.setAttribute('value', value);\n }\n get open() {\n return this.hasAttribute('open');\n }\n set open(value) {\n if (value) {\n this.setAttribute('open', '');\n }\n else {\n this.removeAttribute('open');\n }\n }\n static get observedAttributes() {\n return ['open', 'value'];\n }\n attributeChangedCallback(name, oldValue, newValue) {\n if (oldValue === newValue)\n return;\n const autocomplete = state.get(this);\n if (!autocomplete)\n return;\n switch (name) {\n case 'open':\n newValue === null ? autocomplete.close() : autocomplete.open();\n break;\n case 'value':\n if (newValue !== null) {\n autocomplete.input.value = newValue;\n }\n this.dispatchEvent(new AutocompleteEvent('auto-complete-change', {\n bubbles: true,\n relatedTarget: autocomplete.input\n }));\n break;\n }\n }\n}\n\nif (!window.customElements.get('auto-complete')) {\n window.AutocompleteElement = AutocompleteElement;\n window.customElements.define('auto-complete', AutocompleteElement);\n}\n\nexport default AutocompleteElement;\nexport { AutocompleteEvent };\n","function createNode(text) {\n const node = document.createElement('pre');\n node.style.width = '1px';\n node.style.height = '1px';\n node.style.position = 'fixed';\n node.style.top = '5px';\n node.textContent = text;\n return node;\n}\n\nfunction copyNode(node) {\n if ('clipboard' in navigator) {\n // eslint-disable-next-line flowtype/no-flow-fix-me-comments\n // $FlowFixMe Clipboard is not defined in Flow yet.\n return navigator.clipboard.writeText(node.textContent);\n }\n\n const selection = getSelection();\n\n if (selection == null) {\n return Promise.reject(new Error());\n }\n\n selection.removeAllRanges();\n const range = document.createRange();\n range.selectNodeContents(node);\n selection.addRange(range);\n document.execCommand('copy');\n selection.removeAllRanges();\n return Promise.resolve();\n}\nfunction copyText(text) {\n if ('clipboard' in navigator) {\n // eslint-disable-next-line flowtype/no-flow-fix-me-comments\n // $FlowFixMe Clipboard is not defined in Flow yet.\n return navigator.clipboard.writeText(text);\n }\n\n const body = document.body;\n\n if (!body) {\n return Promise.reject(new Error());\n }\n\n const node = createNode(text);\n body.appendChild(node);\n copyNode(node);\n body.removeChild(node);\n return Promise.resolve();\n}\n\nfunction copy(button) {\n const id = button.getAttribute('for');\n const text = button.getAttribute('value');\n\n function trigger() {\n button.dispatchEvent(new CustomEvent('clipboard-copy', {\n bubbles: true\n }));\n }\n\n if (text) {\n copyText(text).then(trigger);\n } else if (id) {\n const root = 'getRootNode' in Element.prototype ? button.getRootNode() : button.ownerDocument;\n if (!(root instanceof Document || 'ShadowRoot' in window && root instanceof ShadowRoot)) return;\n const node = root.getElementById(id);\n if (node) copyTarget(node).then(trigger);\n }\n}\n\nfunction copyTarget(content) {\n if (content instanceof HTMLInputElement || content instanceof HTMLTextAreaElement) {\n return copyText(content.value);\n } else if (content instanceof HTMLAnchorElement && content.hasAttribute('href')) {\n return copyText(content.href);\n } else {\n return copyNode(content);\n }\n}\n\nfunction clicked(event) {\n const button = event.currentTarget;\n\n if (button instanceof HTMLElement) {\n copy(button);\n }\n}\n\nfunction keydown(event) {\n if (event.key === ' ' || event.key === 'Enter') {\n const button = event.currentTarget;\n\n if (button instanceof HTMLElement) {\n event.preventDefault();\n copy(button);\n }\n }\n}\n\nfunction focused(event) {\n event.currentTarget.addEventListener('keydown', keydown);\n}\n\nfunction blurred(event) {\n event.currentTarget.removeEventListener('keydown', keydown);\n}\n\nclass ClipboardCopyElement extends HTMLElement {\n constructor() {\n super();\n this.addEventListener('click', clicked);\n this.addEventListener('focus', focused);\n this.addEventListener('blur', blurred);\n }\n\n connectedCallback() {\n if (!this.hasAttribute('tabindex')) {\n this.setAttribute('tabindex', '0');\n }\n\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'button');\n }\n }\n\n get value() {\n return this.getAttribute('value') || '';\n }\n\n set value(text) {\n this.setAttribute('value', text);\n }\n\n}\n\nif (!window.customElements.get('clipboard-copy')) {\n window.ClipboardCopyElement = ClipboardCopyElement;\n window.customElements.define('clipboard-copy', ClipboardCopyElement);\n}\n\nexport default ClipboardCopyElement;\n","import '@github/clipboard-copy-element';\nfunction toggleSVG(svg) {\n if (svg.style.display === '' || svg.style.display === 'block') {\n svg.style.display = 'none';\n }\n else {\n svg.style.display = 'block';\n }\n}\n// Toggle a copy button.\nfunction toggleCopyButton(button) {\n const [clippyIcon, checkIcon] = button.querySelectorAll('.octicon');\n if (clippyIcon) {\n toggleSVG(clippyIcon);\n }\n if (checkIcon) {\n toggleSVG(checkIcon);\n }\n}\ndocument.addEventListener('clipboard-copy', function ({ target }) {\n if (!(target instanceof HTMLElement))\n return;\n toggleCopyButton(target);\n setTimeout(toggleCopyButton, 2000, target);\n});\n","export default class TabContainerElement extends HTMLElement {\n constructor() {\n super();\n this.addEventListener('keydown', (event) => {\n const target = event.target;\n if (!(target instanceof HTMLElement))\n return;\n if (target.getAttribute('role') !== 'tab' && !target.closest('[role=\"tablist\"]'))\n return;\n const tabs = Array.from(this.querySelectorAll('[role=\"tablist\"] [role=\"tab\"]'));\n const currentIndex = tabs.indexOf(tabs.find(tab => tab.matches('[aria-selected=\"true\"]')));\n if (event.code === 'ArrowRight') {\n let index = currentIndex + 1;\n if (index >= tabs.length)\n index = 0;\n selectTab(this, index);\n }\n else if (event.code === 'ArrowLeft') {\n let index = currentIndex - 1;\n if (index < 0)\n index = tabs.length - 1;\n selectTab(this, index);\n }\n else if (event.code === 'Home') {\n selectTab(this, 0);\n event.preventDefault();\n }\n else if (event.code === 'End') {\n selectTab(this, tabs.length - 1);\n event.preventDefault();\n }\n });\n this.addEventListener('click', (event) => {\n const tabs = Array.from(this.querySelectorAll('[role=\"tablist\"] [role=\"tab\"]'));\n if (!(event.target instanceof Element))\n return;\n const tab = event.target.closest('[role=\"tab\"]');\n if (!tab || !tab.closest('[role=\"tablist\"]'))\n return;\n const index = tabs.indexOf(tab);\n selectTab(this, index);\n });\n }\n connectedCallback() {\n for (const tab of this.querySelectorAll('[role=\"tablist\"] [role=\"tab\"]')) {\n if (!tab.hasAttribute('aria-selected')) {\n tab.setAttribute('aria-selected', 'false');\n }\n if (!tab.hasAttribute('tabindex')) {\n if (tab.getAttribute('aria-selected') === 'true') {\n tab.setAttribute('tabindex', '0');\n }\n else {\n tab.setAttribute('tabindex', '-1');\n }\n }\n }\n }\n}\nfunction selectTab(tabContainer, index) {\n const tabs = tabContainer.querySelectorAll('[role=\"tablist\"] [role=\"tab\"]');\n const panels = tabContainer.querySelectorAll('[role=\"tabpanel\"]');\n const selectedTab = tabs[index];\n const selectedPanel = panels[index];\n const cancelled = !tabContainer.dispatchEvent(new CustomEvent('tab-container-change', {\n bubbles: true,\n cancelable: true,\n detail: { relatedTarget: selectedPanel }\n }));\n if (cancelled)\n return;\n for (const tab of tabs) {\n tab.setAttribute('aria-selected', 'false');\n tab.setAttribute('tabindex', '-1');\n }\n for (const panel of panels) {\n panel.hidden = true;\n if (!panel.hasAttribute('tabindex') && !panel.hasAttribute('data-tab-container-no-tabstop')) {\n panel.setAttribute('tabindex', '0');\n }\n }\n selectedTab.setAttribute('aria-selected', 'true');\n selectedTab.setAttribute('tabindex', '0');\n selectedTab.focus();\n selectedPanel.hidden = false;\n tabContainer.dispatchEvent(new CustomEvent('tab-container-changed', {\n bubbles: true,\n detail: { relatedTarget: selectedPanel }\n }));\n}\nif (!window.customElements.get('tab-container')) {\n window.TabContainerElement = TabContainerElement;\n window.customElements.define('tab-container', TabContainerElement);\n}\n//# sourceMappingURL=index.js.map","const weekdays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];\nconst months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];\n\nfunction pad(num) {\n return \"0\".concat(num).slice(-2);\n}\n\nfunction strftime(time, formatString) {\n const day = time.getDay();\n const date = time.getDate();\n const month = time.getMonth();\n const year = time.getFullYear();\n const hour = time.getHours();\n const minute = time.getMinutes();\n const second = time.getSeconds();\n return formatString.replace(/%([%aAbBcdeHIlmMpPSwyYZz])/g, function (_arg) {\n let match;\n const modifier = _arg[1];\n\n switch (modifier) {\n case '%':\n return '%';\n\n case 'a':\n return weekdays[day].slice(0, 3);\n\n case 'A':\n return weekdays[day];\n\n case 'b':\n return months[month].slice(0, 3);\n\n case 'B':\n return months[month];\n\n case 'c':\n return time.toString();\n\n case 'd':\n return pad(date);\n\n case 'e':\n return String(date);\n\n case 'H':\n return pad(hour);\n\n case 'I':\n return pad(strftime(time, '%l'));\n\n case 'l':\n if (hour === 0 || hour === 12) {\n return String(12);\n } else {\n return String((hour + 12) % 12);\n }\n\n case 'm':\n return pad(month + 1);\n\n case 'M':\n return pad(minute);\n\n case 'p':\n if (hour > 11) {\n return 'PM';\n } else {\n return 'AM';\n }\n\n case 'P':\n if (hour > 11) {\n return 'pm';\n } else {\n return 'am';\n }\n\n case 'S':\n return pad(second);\n\n case 'w':\n return String(day);\n\n case 'y':\n return pad(year % 100);\n\n case 'Y':\n return String(year);\n\n case 'Z':\n match = time.toString().match(/\\((\\w+)\\)$/);\n return match ? match[1] : '';\n\n case 'z':\n match = time.toString().match(/\\w([+-]\\d\\d\\d\\d) /);\n return match ? match[1] : '';\n }\n\n return '';\n });\n}\nfunction makeFormatter(options) {\n let format;\n return function () {\n if (format) return format;\n\n if ('Intl' in window) {\n try {\n format = new Intl.DateTimeFormat(undefined, options);\n return format;\n } catch (e) {\n if (!(e instanceof RangeError)) {\n throw e;\n }\n }\n }\n };\n}\nlet dayFirst = null;\nconst dayFirstFormatter = makeFormatter({\n day: 'numeric',\n month: 'short'\n}); // Private: Determine if the day should be formatted before the month name in\n// the user's current locale. For example, `9 Jun` for en-GB and `Jun 9`\n// for en-US.\n//\n// Returns true if the day appears before the month.\n\nfunction isDayFirst() {\n if (dayFirst !== null) {\n return dayFirst;\n }\n\n const formatter = dayFirstFormatter();\n\n if (formatter) {\n const output = formatter.format(new Date(0));\n dayFirst = !!output.match(/^\\d/);\n return dayFirst;\n } else {\n return false;\n }\n}\nlet yearSeparator = null;\nconst yearFormatter = makeFormatter({\n day: 'numeric',\n month: 'short',\n year: 'numeric'\n}); // Private: Determine if the year should be separated from the month and day\n// with a comma. For example, `9 Jun 2014` in en-GB and `Jun 9, 2014` in en-US.\n//\n// Returns true if the date needs a separator.\n\nfunction isYearSeparator() {\n if (yearSeparator !== null) {\n return yearSeparator;\n }\n\n const formatter = yearFormatter();\n\n if (formatter) {\n const output = formatter.format(new Date(0));\n yearSeparator = !!output.match(/\\d,/);\n return yearSeparator;\n } else {\n return true;\n }\n} // Private: Determine if the date occurs in the same year as today's date.\n//\n// date - The Date to test.\n//\n// Returns true if it's this year.\n\nfunction isThisYear(date) {\n const now = new Date();\n return now.getUTCFullYear() === date.getUTCFullYear();\n}\nfunction makeRelativeFormat(locale, options) {\n if ('Intl' in window && 'RelativeTimeFormat' in window.Intl) {\n try {\n // eslint-disable-next-line flowtype/no-flow-fix-me-comments\n // $FlowFixMe: missing RelativeTimeFormat type\n return new Intl.RelativeTimeFormat(locale, options);\n } catch (e) {\n if (!(e instanceof RangeError)) {\n throw e;\n }\n }\n }\n} // Private: Get preferred Intl locale for a target element.\n//\n// Traverses parents until it finds an explicit `lang` other returns \"default\".\n\nfunction localeFromElement(el) {\n const container = el.closest('[lang]');\n\n if (container instanceof HTMLElement && container.lang) {\n return container.lang;\n }\n\n return 'default';\n}\n\nconst datetimes = new WeakMap();\nclass ExtendedTimeElement extends HTMLElement {\n static get observedAttributes() {\n return ['datetime', 'day', 'format', 'lang', 'hour', 'minute', 'month', 'second', 'title', 'weekday', 'year'];\n }\n\n connectedCallback() {\n const title = this.getFormattedTitle();\n\n if (title && !this.hasAttribute('title')) {\n this.setAttribute('title', title);\n }\n\n const text = this.getFormattedDate();\n\n if (text) {\n this.textContent = text;\n }\n } // Internal: Refresh the time element's formatted date when an attribute changes.\n\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n const oldTitle = this.getFormattedTitle();\n\n if (attrName === 'datetime') {\n const millis = Date.parse(newValue);\n\n if (isNaN(millis)) {\n datetimes.delete(this);\n } else {\n datetimes.set(this, new Date(millis));\n }\n }\n\n const title = this.getFormattedTitle();\n const currentTitle = this.getAttribute('title');\n\n if (attrName !== 'title' && title && (!currentTitle || currentTitle === oldTitle)) {\n this.setAttribute('title', title);\n }\n\n const text = this.getFormattedDate();\n\n if (text) {\n this.textContent = text;\n }\n }\n\n get date() {\n return datetimes.get(this);\n } // Internal: Format the ISO 8601 timestamp according to the user agent's\n // locale-aware formatting rules. The element's existing `title` attribute\n // value takes precedence over this custom format.\n //\n // Returns a formatted time String.\n\n\n getFormattedTitle() {\n const date = this.date;\n if (!date) return;\n const formatter = titleFormatter();\n\n if (formatter) {\n return formatter.format(date);\n } else {\n try {\n return date.toLocaleString();\n } catch (e) {\n if (e instanceof RangeError) {\n return date.toString();\n } else {\n throw e;\n }\n }\n }\n }\n\n getFormattedDate() {}\n\n}\nconst titleFormatter = makeFormatter({\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n timeZoneName: 'short'\n});\n\nconst formatters = new WeakMap();\nclass LocalTimeElement extends ExtendedTimeElement {\n attributeChangedCallback(attrName, oldValue, newValue) {\n if (attrName === 'hour' || attrName === 'minute' || attrName === 'second' || attrName === 'time-zone-name') {\n formatters.delete(this);\n }\n\n super.attributeChangedCallback(attrName, oldValue, newValue);\n } // Formats the element's date, in the user's current locale, according to\n // the formatting attribute values. Values are not passed straight through to\n // an Intl.DateTimeFormat instance so that weekday and month names are always\n // displayed in English, for now.\n //\n // Supported attributes are:\n //\n // weekday - \"short\", \"long\"\n // year - \"numeric\", \"2-digit\"\n // month - \"short\", \"long\"\n // day - \"numeric\", \"2-digit\"\n // hour - \"numeric\", \"2-digit\"\n // minute - \"numeric\", \"2-digit\"\n // second - \"numeric\", \"2-digit\"\n //\n // Returns a formatted time String.\n\n\n getFormattedDate() {\n const d = this.date;\n if (!d) return;\n const date = formatDate(this, d) || '';\n const time = formatTime(this, d) || '';\n return \"\".concat(date, \" \").concat(time).trim();\n }\n\n} // Private: Format a date according to the `weekday`, `day`, `month`,\n// and `year` attribute values.\n//\n// This doesn't use Intl.DateTimeFormat to avoid creating text in the user's\n// language when the majority of the surrounding text is in English. There's\n// currently no way to separate the language from the format in Intl.\n//\n// el - The local-time element to format.\n//\n// Returns a date String or null if no date formats are provided.\n\nfunction formatDate(el, date) {\n // map attribute values to strftime\n const props = {\n weekday: {\n short: '%a',\n long: '%A'\n },\n day: {\n numeric: '%e',\n '2-digit': '%d'\n },\n month: {\n short: '%b',\n long: '%B'\n },\n year: {\n numeric: '%Y',\n '2-digit': '%y'\n }\n }; // build a strftime format string\n\n let format = isDayFirst() ? 'weekday day month year' : 'weekday month day, year';\n\n for (const prop in props) {\n const value = props[prop][el.getAttribute(prop)];\n format = format.replace(prop, value || '');\n } // clean up year separator comma\n\n\n format = format.replace(/(\\s,)|(,\\s$)/, ''); // squeeze spaces from final string\n\n return strftime(date, format).replace(/\\s+/, ' ').trim();\n} // Private: Format a time according to the `hour`, `minute`, and `second`\n// attribute values.\n//\n// el - The local-time element to format.\n//\n// Returns a time String or null if no time formats are provided.\n\n\nfunction formatTime(el, date) {\n const options = {}; // retrieve format settings from attributes\n\n const hour = el.getAttribute('hour');\n if (hour === 'numeric' || hour === '2-digit') options.hour = hour;\n const minute = el.getAttribute('minute');\n if (minute === 'numeric' || minute === '2-digit') options.minute = minute;\n const second = el.getAttribute('second');\n if (second === 'numeric' || second === '2-digit') options.second = second;\n const tz = el.getAttribute('time-zone-name');\n if (tz === 'short' || tz === 'long') options.timeZoneName = tz; // No time format attributes provided.\n\n if (Object.keys(options).length === 0) {\n return;\n }\n\n let factory = formatters.get(el);\n\n if (!factory) {\n factory = makeFormatter(options);\n formatters.set(el, factory);\n }\n\n const formatter = factory();\n\n if (formatter) {\n // locale-aware formatting of 24 or 12 hour times\n return formatter.format(date);\n } else {\n // fall back to strftime for non-Intl browsers\n const timef = options.second ? '%H:%M:%S' : '%H:%M';\n return strftime(date, timef);\n }\n} // Public: LocalTimeElement constructor.\n//\n// var time = new LocalTimeElement()\n// # => <local-time></local-time>\n//\n\n\nif (!window.customElements.get('local-time')) {\n window.LocalTimeElement = LocalTimeElement;\n window.customElements.define('local-time', LocalTimeElement);\n}\n\nclass RelativeTime {\n constructor(date, locale) {\n this.date = date;\n this.locale = locale;\n }\n\n toString() {\n const ago = this.timeElapsed();\n\n if (ago) {\n return ago;\n } else {\n const ahead = this.timeAhead();\n\n if (ahead) {\n return ahead;\n } else {\n return \"on \".concat(this.formatDate());\n }\n }\n }\n\n timeElapsed() {\n const ms = new Date().getTime() - this.date.getTime();\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n\n if (ms >= 0 && day < 30) {\n return this.timeAgoFromMs(ms);\n } else {\n return null;\n }\n }\n\n timeAhead() {\n const ms = this.date.getTime() - new Date().getTime();\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n\n if (ms >= 0 && day < 30) {\n return this.timeUntil();\n } else {\n return null;\n }\n }\n\n timeAgo() {\n const ms = new Date().getTime() - this.date.getTime();\n return this.timeAgoFromMs(ms);\n }\n\n timeAgoFromMs(ms) {\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n\n if (ms < 0) {\n return formatRelativeTime(this.locale, 0, 'second');\n } else if (sec < 10) {\n return formatRelativeTime(this.locale, 0, 'second');\n } else if (sec < 45) {\n return formatRelativeTime(this.locale, -sec, 'second');\n } else if (sec < 90) {\n return formatRelativeTime(this.locale, -min, 'minute');\n } else if (min < 45) {\n return formatRelativeTime(this.locale, -min, 'minute');\n } else if (min < 90) {\n return formatRelativeTime(this.locale, -hr, 'hour');\n } else if (hr < 24) {\n return formatRelativeTime(this.locale, -hr, 'hour');\n } else if (hr < 36) {\n return formatRelativeTime(this.locale, -day, 'day');\n } else if (day < 30) {\n return formatRelativeTime(this.locale, -day, 'day');\n } else if (month < 18) {\n return formatRelativeTime(this.locale, -month, 'month');\n } else {\n return formatRelativeTime(this.locale, -year, 'year');\n }\n }\n\n microTimeAgo() {\n const ms = new Date().getTime() - this.date.getTime();\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n\n if (min < 1) {\n return '1m';\n } else if (min < 60) {\n return \"\".concat(min, \"m\");\n } else if (hr < 24) {\n return \"\".concat(hr, \"h\");\n } else if (day < 365) {\n return \"\".concat(day, \"d\");\n } else {\n return \"\".concat(year, \"y\");\n }\n }\n\n timeUntil() {\n const ms = this.date.getTime() - new Date().getTime();\n return this.timeUntilFromMs(ms);\n }\n\n timeUntilFromMs(ms) {\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n\n if (month >= 18) {\n return formatRelativeTime(this.locale, year, 'year');\n } else if (month >= 12) {\n return formatRelativeTime(this.locale, year, 'year');\n } else if (day >= 45) {\n return formatRelativeTime(this.locale, month, 'month');\n } else if (day >= 30) {\n return formatRelativeTime(this.locale, month, 'month');\n } else if (hr >= 36) {\n return formatRelativeTime(this.locale, day, 'day');\n } else if (hr >= 24) {\n return formatRelativeTime(this.locale, day, 'day');\n } else if (min >= 90) {\n return formatRelativeTime(this.locale, hr, 'hour');\n } else if (min >= 45) {\n return formatRelativeTime(this.locale, hr, 'hour');\n } else if (sec >= 90) {\n return formatRelativeTime(this.locale, min, 'minute');\n } else if (sec >= 45) {\n return formatRelativeTime(this.locale, min, 'minute');\n } else if (sec >= 10) {\n return formatRelativeTime(this.locale, sec, 'second');\n } else {\n return formatRelativeTime(this.locale, 0, 'second');\n }\n }\n\n microTimeUntil() {\n const ms = this.date.getTime() - new Date().getTime();\n const sec = Math.round(ms / 1000);\n const min = Math.round(sec / 60);\n const hr = Math.round(min / 60);\n const day = Math.round(hr / 24);\n const month = Math.round(day / 30);\n const year = Math.round(month / 12);\n\n if (day >= 365) {\n return \"\".concat(year, \"y\");\n } else if (hr >= 24) {\n return \"\".concat(day, \"d\");\n } else if (min >= 60) {\n return \"\".concat(hr, \"h\");\n } else if (min > 1) {\n return \"\".concat(min, \"m\");\n } else {\n return '1m';\n }\n }\n\n formatDate() {\n let format = isDayFirst() ? '%e %b' : '%b %e';\n\n if (!isThisYear(this.date)) {\n format += isYearSeparator() ? ', %Y' : ' %Y';\n }\n\n return strftime(this.date, format);\n }\n\n formatTime() {\n const formatter = timeFormatter();\n\n if (formatter) {\n return formatter.format(this.date);\n } else {\n return strftime(this.date, '%l:%M%P');\n }\n }\n\n}\n\nfunction formatRelativeTime(locale, value, unit) {\n const formatter = makeRelativeFormat(locale, {\n numeric: 'auto'\n });\n\n if (formatter) {\n return formatter.format(value, unit);\n } else {\n return formatEnRelativeTime(value, unit);\n }\n} // Simplified \"en\" RelativeTimeFormat.format function\n//\n// Values should roughly match\n// new Intl.RelativeTimeFormat('en', {numeric: 'auto'}).format(value, unit)\n//\n\n\nfunction formatEnRelativeTime(value, unit) {\n if (value === 0) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n return \"this \".concat(unit);\n\n case 'day':\n return 'today';\n\n case 'hour':\n case 'minute':\n return \"in 0 \".concat(unit, \"s\");\n\n case 'second':\n return 'now';\n }\n } else if (value === 1) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n return \"next \".concat(unit);\n\n case 'day':\n return 'tomorrow';\n\n case 'hour':\n case 'minute':\n case 'second':\n return \"in 1 \".concat(unit);\n }\n } else if (value === -1) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n return \"last \".concat(unit);\n\n case 'day':\n return 'yesterday';\n\n case 'hour':\n case 'minute':\n case 'second':\n return \"1 \".concat(unit, \" ago\");\n }\n } else if (value > 1) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n case 'day':\n case 'hour':\n case 'minute':\n case 'second':\n return \"in \".concat(value, \" \").concat(unit, \"s\");\n }\n } else if (value < -1) {\n switch (unit) {\n case 'year':\n case 'quarter':\n case 'month':\n case 'week':\n case 'day':\n case 'hour':\n case 'minute':\n case 'second':\n return \"\".concat(-value, \" \").concat(unit, \"s ago\");\n }\n }\n\n throw new RangeError(\"Invalid unit argument for format() '\".concat(unit, \"'\"));\n}\n\nconst timeFormatter = makeFormatter({\n hour: 'numeric',\n minute: '2-digit'\n});\n\nclass RelativeTimeElement extends ExtendedTimeElement {\n getFormattedDate() {\n const date = this.date;\n\n if (date) {\n return new RelativeTime(date, localeFromElement(this)).toString();\n }\n }\n\n connectedCallback() {\n nowElements.push(this);\n\n if (!updateNowElementsId) {\n updateNowElements();\n updateNowElementsId = setInterval(updateNowElements, 60 * 1000);\n }\n\n super.connectedCallback();\n }\n\n disconnectedCallback() {\n const ix = nowElements.indexOf(this);\n\n if (ix !== -1) {\n nowElements.splice(ix, 1);\n }\n\n if (!nowElements.length) {\n if (updateNowElementsId) {\n clearInterval(updateNowElementsId);\n updateNowElementsId = null;\n }\n }\n }\n\n} // Internal: Array tracking all elements attached to the document that need\n// to be updated every minute.\n\nconst nowElements = []; // Internal: Timer ID for `updateNowElements` interval.\n\nlet updateNowElementsId; // Internal: Install a timer to refresh all attached relative-time elements every\n// minute.\n\nfunction updateNowElements() {\n let time, i, len;\n\n for (i = 0, len = nowElements.length; i < len; i++) {\n time = nowElements[i];\n time.textContent = time.getFormattedDate() || '';\n }\n} // Public: RelativeTimeElement constructor.\n//\n// var time = new RelativeTimeElement()\n// # => <relative-time></relative-time>\n//\n\n\nif (!window.customElements.get('relative-time')) {\n window.RelativeTimeElement = RelativeTimeElement;\n window.customElements.define('relative-time', RelativeTimeElement);\n}\n\nclass TimeAgoElement extends RelativeTimeElement {\n getFormattedDate() {\n const format = this.getAttribute('format');\n const date = this.date;\n if (!date) return;\n\n if (format === 'micro') {\n return new RelativeTime(date, localeFromElement(this)).microTimeAgo();\n } else {\n return new RelativeTime(date, localeFromElement(this)).timeAgo();\n }\n }\n\n}\n\nif (!window.customElements.get('time-ago')) {\n window.TimeAgoElement = TimeAgoElement;\n window.customElements.define('time-ago', TimeAgoElement);\n}\n\nclass TimeUntilElement extends RelativeTimeElement {\n getFormattedDate() {\n const format = this.getAttribute('format');\n const date = this.date;\n if (!date) return;\n\n if (format === 'micro') {\n return new RelativeTime(date, localeFromElement(this)).microTimeUntil();\n } else {\n return new RelativeTime(date, localeFromElement(this)).timeUntil();\n }\n }\n\n}\n\nif (!window.customElements.get('time-until')) {\n window.TimeUntilElement = TimeUntilElement;\n window.customElements.define('time-until', TimeUntilElement);\n}\n\nexport { LocalTimeElement, RelativeTimeElement, TimeAgoElement, TimeUntilElement };\n"],"names":["ctrlBindings","navigator","userAgent","match","Combobox","[object Object]","input","list","this","isComposing","id","Math","random","toString","slice","keyboardEventHandler","event","combobox","shiftKey","metaKey","altKey","ctrlKey","key","target","querySelector","getAttribute","click","commit","preventDefault","clearSelection","navigate","keyboardBindings","compositionEventHandler","type","document","getElementById","trackComposition","inputHandler","bind","setAttribute","stop","removeAttribute","addEventListener","commitWithElement","removeEventListener","indexDiff","focusEl","Array","from","querySelectorAll","filter","visible","els","focusIndex","indexOf","length","focus","indexOfItem","newIndex","el","scrollTo","Element","closest","dispatchEvent","CustomEvent","bubbles","fireCommitEvent","hidden","HTMLInputElement","offsetWidth","offsetHeight","container","element","scrollTop","containerBottom","clientHeight","top","offsetTop","bottom","inViewport","AutocompleteEvent","init","super","relatedTarget","requests","WeakMap","fragment","url","xhr","XMLHttpRequest","open","setRequestHeader","pending","get","abort","set","clear","delete","result","Promise","resolve","reject","onload","status","responseText","Error","onerror","send","then","request","Autocomplete","results","interactingWithList","onInputChange","callback","wait","timeout","Rest","clearTimeout","window","setTimeout","debounce","onResultsMouseDown","onInputBlur","onInputFocus","onKeydown","onCommit","stopPropagation","value","trim","fetchResults","selected","HTMLElement","HTMLAnchorElement","textContent","query","src","URL","location","href","params","URLSearchParams","search","append","html","innerHTML","identifyOptions","hasResults","catch","start","state","AutocompleteElement","listId","autocomplete","destroy","hasAttribute","observedAttributes","name","oldValue","newValue","close","copyNode","node","clipboard","writeText","selection","getSelection","removeAllRanges","range","createRange","selectNodeContents","addRange","execCommand","copyText","text","body","createElement","style","width","height","position","createNode","appendChild","removeChild","copy","button","trigger","root","prototype","getRootNode","ownerDocument","Document","ShadowRoot","content","HTMLTextAreaElement","clicked","currentTarget","keydown","focused","blurred","customElements","define","ClipboardCopyElement","toggleSVG","svg","display","toggleCopyButton","clippyIcon","checkIcon","TabContainerElement","tabs","currentIndex","find","tab","matches","code","index","selectTab","tabContainer","panels","selectedTab","selectedPanel","cancelable","detail","panel","weekdays","months","pad","num","concat","strftime","time","formatString","day","getDay","date","getDate","month","getMonth","year","getFullYear","hour","getHours","minute","getMinutes","second","getSeconds","replace","_arg","String","makeFormatter","options","format","Intl","DateTimeFormat","undefined","e","RangeError","dayFirst","dayFirstFormatter","isDayFirst","formatter","output","Date","yearSeparator","yearFormatter","localeFromElement","lang","datetimes","ExtendedTimeElement","title","getFormattedTitle","getFormattedDate","attrName","oldTitle","millis","parse","isNaN","currentTitle","titleFormatter","toLocaleString","timeZoneName","formatters","LocalTimeElement","attributeChangedCallback","d","props","weekday","short","long","numeric","2-digit","prop","formatDate","tz","Object","keys","factory","formatTime","RelativeTime","locale","ago","timeElapsed","ahead","timeAhead","ms","getTime","sec","round","min","hr","timeAgoFromMs","timeUntil","formatRelativeTime","timeUntilFromMs","getUTCFullYear","isYearSeparator","timeFormatter","unit","RelativeTimeFormat","makeRelativeFormat","formatEnRelativeTime","RelativeTimeElement","nowElements","push","updateNowElementsId","updateNowElements","setInterval","connectedCallback","ix","splice","clearInterval","i","len","TimeAgoElement","microTimeAgo","timeAgo","TimeUntilElement","microTimeUntil"],"mappings":"AAAA,MAAMA,IAAiBC,UAAUC,UAAUC,MAAM,aAClC,MAAMC,EACjBC,YAAYC,EAAOC,GACfC,KAAKF,MAAQA,EACbE,KAAKD,KAAOA,EACZC,KAAKC,aAAc,EACdF,EAAKG,KACNH,EAAKG,GAAK,YAAYC,KAAKC,SACtBC,WACAC,MAAM,EAAG,MAElBN,KAAKO,qBAAuBC,GAuEpC,SAA0BA,EAAOC,GAC7B,GAAID,EAAME,UAAYF,EAAMG,SAAWH,EAAMI,OACzC,OACJ,IAAKpB,GAAgBgB,EAAMK,QACvB,OACJ,GAAIJ,EAASR,YACT,OACJ,OAAQO,EAAMM,KACV,IAAK,QACL,IAAK,OA4Cb,SAAgBhB,EAAOC,GACnB,MAAMgB,EAAShB,EAAKiB,cAAc,0BAClC,QAAKD,IAEwC,SAAzCA,EAAOE,aAAa,kBAExBF,EAAOG,SADI,IAhDCC,CAAOV,EAASX,MAAOW,EAASV,OAChCS,EAAMY,iBAEV,MACJ,IAAK,SACDX,EAASY,iBACT,MACJ,IAAK,YACDZ,EAASa,SAAS,GAClBd,EAAMY,iBACN,MACJ,IAAK,UACDX,EAASa,UAAU,GACnBd,EAAMY,iBACN,MACJ,IAAK,IACG5B,GAAgBgB,EAAMK,UACtBJ,EAASa,SAAS,GAClBd,EAAMY,kBAEV,MACJ,IAAK,IACG5B,GAAgBgB,EAAMK,UACtBJ,EAASa,UAAU,GACnBd,EAAMY,kBAEV,MACJ,QACI,GAAIZ,EAAMK,QACN,MACJJ,EAASY,kBA/GwBE,CAAiBf,EAAOR,MAC7DA,KAAKwB,wBAA0BhB,GA4IvC,SAA0BA,EAAOC,GAC7BA,EAASR,YAA6B,qBAAfO,EAAMiB,KAE7B,IADaC,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f,EAC7B7T,mBACE,MAAMuP,EAASpP,KAAKiB,aAAa,UAC3BkN,EAAOnO,KAAKmO,KAClB,GAAKA,EAEL,MAAe,UAAXiB,EACK,IAAI+C,EAAahE,EAAM+B,EAAkBlQ,OAAO0U,iBAEhD,IAAIvC,EAAahE,EAAM+B,EAAkBlQ,OAAOgT,aAMxDjM,OAAOiF,eAAe3G,IAAI,gBAC7B0B,OAAO0N,iBAAmBA,EAC1B1N,OAAOiF,eAAeC,OAAO,aAAcwI"}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
# Use BaseButton to render an unstyled `<button>` tag that can be customized.
|
5
|
+
class BaseButton < Primer::Component
|
6
|
+
status :beta
|
7
|
+
|
8
|
+
DEFAULT_TAG = :button
|
9
|
+
TAG_OPTIONS = [DEFAULT_TAG, :a, :summary].freeze
|
10
|
+
|
11
|
+
DEFAULT_TYPE = :button
|
12
|
+
TYPE_OPTIONS = [DEFAULT_TYPE, :reset, :submit].freeze
|
13
|
+
|
14
|
+
# @example Block
|
15
|
+
# <%= render(Primer::BaseButton.new(block: :true)) { "Block" } %>
|
16
|
+
# <%= render(Primer::BaseButton.new(block: :true, scheme: :primary)) { "Primary block" } %>
|
17
|
+
#
|
18
|
+
# @param tag [Symbol] <%= one_of(Primer::BaseButton::TAG_OPTIONS) %>
|
19
|
+
# @param type [Symbol] <%= one_of(Primer::BaseButton::TYPE_OPTIONS) %>
|
20
|
+
# @param block [Boolean] Whether button is full-width with `display: block`.
|
21
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
22
|
+
def initialize(
|
23
|
+
tag: DEFAULT_TAG,
|
24
|
+
type: DEFAULT_TYPE,
|
25
|
+
block: false,
|
26
|
+
**system_arguments
|
27
|
+
)
|
28
|
+
@system_arguments = system_arguments
|
29
|
+
@system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, DEFAULT_TAG)
|
30
|
+
|
31
|
+
if @system_arguments[:tag] == :button
|
32
|
+
@system_arguments[:type] = fetch_or_fallback(TYPE_OPTIONS, type, DEFAULT_TYPE)
|
33
|
+
else
|
34
|
+
@system_arguments[:role] = :button
|
35
|
+
end
|
36
|
+
|
37
|
+
@system_arguments[:classes] = class_names(
|
38
|
+
system_arguments[:classes],
|
39
|
+
"btn-block" => block
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
def call
|
44
|
+
render(Primer::BaseComponent.new(**@system_arguments)) { content }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -25,12 +25,6 @@ module Primer
|
|
25
25
|
}.freeze
|
26
26
|
VARIANT_OPTIONS = VARIANT_MAPPINGS.keys
|
27
27
|
|
28
|
-
DEFAULT_TAG = :button
|
29
|
-
TAG_OPTIONS = [DEFAULT_TAG, :a, :summary].freeze
|
30
|
-
|
31
|
-
DEFAULT_TYPE = :button
|
32
|
-
TYPE_OPTIONS = [DEFAULT_TYPE, :reset, :submit].freeze
|
33
|
-
|
34
28
|
# @example Schemes
|
35
29
|
# <%= render(Primer::ButtonComponent.new) { "Default" } %>
|
36
30
|
# <%= render(Primer::ButtonComponent.new(scheme: :primary)) { "Primary" } %>
|
@@ -50,29 +44,19 @@ module Primer
|
|
50
44
|
#
|
51
45
|
# @param scheme [Symbol] <%= one_of(Primer::ButtonComponent::SCHEME_OPTIONS) %>
|
52
46
|
# @param variant [Symbol] <%= one_of(Primer::ButtonComponent::VARIANT_OPTIONS) %>
|
53
|
-
# @param tag [Symbol] <%= one_of(Primer::
|
54
|
-
# @param type [Symbol] <%= one_of(Primer::
|
47
|
+
# @param tag [Symbol] <%= one_of(Primer::BaseButton::TAG_OPTIONS) %>
|
48
|
+
# @param type [Symbol] <%= one_of(Primer::BaseButton::TYPE_OPTIONS) %>
|
55
49
|
# @param group_item [Boolean] Whether button is part of a ButtonGroup.
|
56
50
|
# @param block [Boolean] Whether button is full-width with `display: block`.
|
57
51
|
def initialize(
|
58
52
|
scheme: DEFAULT_SCHEME,
|
59
53
|
variant: DEFAULT_VARIANT,
|
60
|
-
tag: DEFAULT_TAG,
|
61
|
-
type: DEFAULT_TYPE,
|
62
54
|
group_item: false,
|
63
55
|
block: false,
|
64
56
|
**system_arguments
|
65
57
|
)
|
66
58
|
@scheme = scheme
|
67
59
|
@system_arguments = system_arguments
|
68
|
-
@system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, DEFAULT_TAG)
|
69
|
-
|
70
|
-
if @system_arguments[:tag] == :button
|
71
|
-
@system_arguments[:type] = type
|
72
|
-
else
|
73
|
-
@system_arguments[:role] = :button
|
74
|
-
end
|
75
|
-
|
76
60
|
@system_arguments[:classes] = class_names(
|
77
61
|
system_arguments[:classes],
|
78
62
|
SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_OPTIONS, scheme, DEFAULT_SCHEME)],
|
@@ -84,7 +68,7 @@ module Primer
|
|
84
68
|
end
|
85
69
|
|
86
70
|
def call
|
87
|
-
render(Primer::
|
71
|
+
render(Primer::BaseButton.new(**@system_arguments)) { content }
|
88
72
|
end
|
89
73
|
|
90
74
|
private
|
@@ -0,0 +1,138 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
# Use buttons for actions (e.g. in forms). Use links for destinations, or moving from one page to another.
|
5
|
+
class ButtonComponent < Primer::Component
|
6
|
+
status :beta
|
7
|
+
|
8
|
+
DEFAULT_SCHEME = :default
|
9
|
+
LINK_SCHEME = :link
|
10
|
+
SCHEME_MAPPINGS = {
|
11
|
+
DEFAULT_SCHEME => "",
|
12
|
+
:primary => "btn-primary",
|
13
|
+
:danger => "btn-danger",
|
14
|
+
:outline => "btn-outline",
|
15
|
+
:invisible => "btn-invisible",
|
16
|
+
LINK_SCHEME => "btn-link"
|
17
|
+
}.freeze
|
18
|
+
SCHEME_OPTIONS = SCHEME_MAPPINGS.keys
|
19
|
+
|
20
|
+
DEFAULT_VARIANT = :medium
|
21
|
+
VARIANT_MAPPINGS = {
|
22
|
+
:small => "btn-sm",
|
23
|
+
DEFAULT_VARIANT => "",
|
24
|
+
:large => "btn-large"
|
25
|
+
}.freeze
|
26
|
+
VARIANT_OPTIONS = VARIANT_MAPPINGS.keys
|
27
|
+
|
28
|
+
<<<<<<< HEAD
|
29
|
+
=======
|
30
|
+
DEFAULT_TAG = :button
|
31
|
+
TAG_OPTIONS = [DEFAULT_TAG, :a, :summary].freeze
|
32
|
+
|
33
|
+
DEFAULT_TYPE = :button
|
34
|
+
TYPE_OPTIONS = [DEFAULT_TYPE, :reset, :submit].freeze
|
35
|
+
|
36
|
+
DEFAULT_ICON_ALIGN = :left
|
37
|
+
ICON_ALIGN_OPTIONS = [DEFAULT_ICON_ALIGN, :right].freeze
|
38
|
+
|
39
|
+
# Icon to be rendered in the button.
|
40
|
+
#
|
41
|
+
# @param align [Symbol] <%= one_of(Primer::ButtonComponent::ICON_ALIGN_OPTIONS) %>
|
42
|
+
# @param system_arguments [Hash] Same arguments as <%= link_to_component(Primer::OcticonComponent) %>.
|
43
|
+
renders_one :icon, lambda { |align: DEFAULT_ICON_ALIGN, **system_arguments|
|
44
|
+
@icon_align = fetch_or_fallback(ICON_ALIGN_OPTIONS, align, DEFAULT_ICON_ALIGN)
|
45
|
+
|
46
|
+
Primer::OcticonComponent.new(**system_arguments)
|
47
|
+
}
|
48
|
+
|
49
|
+
# Counter to be rendered in the button.
|
50
|
+
#
|
51
|
+
# @param system_arguments [Hash] Same arguments as <%= link_to_component(Primer::CounterComponent) %>.
|
52
|
+
renders_one :counter, Primer::CounterComponent
|
53
|
+
|
54
|
+
>>>>>>> 05bacd3 (add icon and counter slots to button)
|
55
|
+
# @example Schemes
|
56
|
+
# <%= render(Primer::ButtonComponent.new) { "Default" } %>
|
57
|
+
# <%= render(Primer::ButtonComponent.new(scheme: :primary)) { "Primary" } %>
|
58
|
+
# <%= render(Primer::ButtonComponent.new(scheme: :danger)) { "Danger" } %>
|
59
|
+
# <%= render(Primer::ButtonComponent.new(scheme: :outline)) { "Outline" } %>
|
60
|
+
# <%= render(Primer::ButtonComponent.new(scheme: :invisible)) { "Invisible" } %>
|
61
|
+
# <%= render(Primer::ButtonComponent.new(scheme: :link)) { "Link" } %>
|
62
|
+
#
|
63
|
+
# @example Variants
|
64
|
+
# <%= render(Primer::ButtonComponent.new(variant: :small)) { "Small" } %>
|
65
|
+
# <%= render(Primer::ButtonComponent.new(variant: :medium)) { "Medium" } %>
|
66
|
+
# <%= render(Primer::ButtonComponent.new(variant: :large)) { "Large" } %>
|
67
|
+
#
|
68
|
+
# @example Block
|
69
|
+
# <%= render(Primer::ButtonComponent.new(block: :true)) { "Block" } %>
|
70
|
+
# <%= render(Primer::ButtonComponent.new(block: :true, scheme: :primary)) { "Primary block" } %>
|
71
|
+
#
|
72
|
+
# @example With icons
|
73
|
+
# <%= render(Primer::ButtonComponent.new) do |c| %>
|
74
|
+
# <% c.icon(icon: :star) %>
|
75
|
+
# Button
|
76
|
+
# <% end %>
|
77
|
+
# <%= render(Primer::ButtonComponent.new) do |c| %>
|
78
|
+
# <% c.icon(icon: :star, align: :right) %>
|
79
|
+
# Button
|
80
|
+
# <% end %>
|
81
|
+
#
|
82
|
+
# @example With counter
|
83
|
+
# <%= render(Primer::ButtonComponent.new) do |c| %>
|
84
|
+
# <% c.counter(count: 15) %>
|
85
|
+
# Button
|
86
|
+
# <% end %>
|
87
|
+
#
|
88
|
+
# @example With icons and counter
|
89
|
+
# <%= render(Primer::ButtonComponent.new) do |c| %>
|
90
|
+
# <% c.icon(icon: :star) %>
|
91
|
+
# <% c.counter(count: 15) %>
|
92
|
+
# Button
|
93
|
+
# <% end %>
|
94
|
+
# <%= render(Primer::ButtonComponent.new) do |c| %>
|
95
|
+
# <% c.icon(icon: :star, align: :right) %>
|
96
|
+
# <% c.counter(count: 15) %>
|
97
|
+
# Button
|
98
|
+
# <% end %>
|
99
|
+
#
|
100
|
+
# @param scheme [Symbol] <%= one_of(Primer::ButtonComponent::SCHEME_OPTIONS) %>
|
101
|
+
# @param variant [Symbol] <%= one_of(Primer::ButtonComponent::VARIANT_OPTIONS) %>
|
102
|
+
# @param tag [Symbol] <%= one_of(Primer::BaseButton::TAG_OPTIONS) %>
|
103
|
+
# @param type [Symbol] <%= one_of(Primer::BaseButton::TYPE_OPTIONS) %>
|
104
|
+
# @param group_item [Boolean] Whether button is part of a ButtonGroup.
|
105
|
+
# @param block [Boolean] Whether button is full-width with `display: block`.
|
106
|
+
def initialize(
|
107
|
+
scheme: DEFAULT_SCHEME,
|
108
|
+
variant: DEFAULT_VARIANT,
|
109
|
+
group_item: false,
|
110
|
+
block: false,
|
111
|
+
**system_arguments
|
112
|
+
)
|
113
|
+
@scheme = scheme
|
114
|
+
@system_arguments = system_arguments
|
115
|
+
@system_arguments[:classes] = class_names(
|
116
|
+
system_arguments[:classes],
|
117
|
+
SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_OPTIONS, scheme, DEFAULT_SCHEME)],
|
118
|
+
VARIANT_MAPPINGS[fetch_or_fallback(VARIANT_OPTIONS, variant, DEFAULT_VARIANT)],
|
119
|
+
"btn" => !link?,
|
120
|
+
"btn-block" => block,
|
121
|
+
"BtnGroup-item" => group_item
|
122
|
+
)
|
123
|
+
end
|
124
|
+
|
125
|
+
<<<<<<< HEAD
|
126
|
+
def call
|
127
|
+
render(Primer::BaseButton.new(**@system_arguments)) { content }
|
128
|
+
end
|
129
|
+
|
130
|
+
=======
|
131
|
+
>>>>>>> 05bacd3 (add icon and counter slots to button)
|
132
|
+
private
|
133
|
+
|
134
|
+
def link?
|
135
|
+
@scheme == LINK_SCHEME
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
File without changes
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
# Use ButtonGroup to render a series of buttons.
|
5
|
+
class ButtonGroup < Primer::Component
|
6
|
+
status :beta
|
7
|
+
|
8
|
+
# Required list of buttons to be rendered.
|
9
|
+
#
|
10
|
+
# @param kwargs [Hash] The same arguments as <%= link_to_component(Primer::ButtonComponent) %> except for `variant` and `group_item`.
|
11
|
+
renders_many :buttons, lambda { |**kwargs|
|
12
|
+
kwargs[:group_item] = true
|
13
|
+
kwargs[:variant] = @variant
|
14
|
+
|
15
|
+
Primer::ButtonComponent.new(**kwargs)
|
16
|
+
}
|
17
|
+
|
18
|
+
# @example Default
|
19
|
+
#
|
20
|
+
# <%= render(Primer::ButtonGroup.new) do |component| %>
|
21
|
+
# <% component.button { "Default" } %>
|
22
|
+
# <% component.button(scheme: :primary) { "Primary" } %>
|
23
|
+
# <% component.button(scheme: :danger) { "Danger" } %>
|
24
|
+
# <% component.button(scheme: :outline) { "Outline" } %>
|
25
|
+
# <% component.button(classes: "my-class") { "Custom class" } %>
|
26
|
+
# <% end %>
|
27
|
+
#
|
28
|
+
# @example Variants
|
29
|
+
#
|
30
|
+
# <%= render(Primer::ButtonGroup.new(variant: :small)) do |component| %>
|
31
|
+
# <% component.button { "Default" } %>
|
32
|
+
# <% component.button(scheme: :primary) { "Primary" } %>
|
33
|
+
# <% component.button(scheme: :danger) { "Danger" } %>
|
34
|
+
# <% component.button(scheme: :outline) { "Outline" } %>
|
35
|
+
# <% end %>
|
36
|
+
#
|
37
|
+
# <%= render(Primer::ButtonGroup.new(variant: :large)) do |component| %>
|
38
|
+
# <% component.button { "Default" } %>
|
39
|
+
# <% component.button(scheme: :primary) { "Primary" } %>
|
40
|
+
# <% component.button(scheme: :danger) { "Danger" } %>
|
41
|
+
# <% component.button(scheme: :outline) { "Outline" } %>
|
42
|
+
# <% end %>
|
43
|
+
#
|
44
|
+
# @param variant [Symbol] <%= one_of(Primer::ButtonComponent::VARIANT_OPTIONS) %>
|
45
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
46
|
+
def initialize(variant: Primer::ButtonComponent::DEFAULT_VARIANT, **system_arguments)
|
47
|
+
@variant = variant
|
48
|
+
@system_arguments = system_arguments
|
49
|
+
@system_arguments[:tag] ||= :div
|
50
|
+
|
51
|
+
@system_arguments[:classes] = class_names(
|
52
|
+
"BtnGroup",
|
53
|
+
system_arguments[:classes]
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
def render?
|
58
|
+
buttons.any?
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -50,14 +50,9 @@ module Primer
|
|
50
50
|
**system_arguments
|
51
51
|
)
|
52
52
|
@system_arguments = system_arguments
|
53
|
+
@system_arguments[:block] = false
|
53
54
|
@system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, DEFAULT_TAG)
|
54
|
-
|
55
|
-
if @system_arguments[:tag] == :a
|
56
|
-
@system_arguments[:role] = :button
|
57
|
-
else
|
58
|
-
@system_arguments[:type] = fetch_or_fallback(TYPE_OPTIONS, type, DEFAULT_TYPE)
|
59
|
-
end
|
60
|
-
|
55
|
+
@system_arguments[:type] = fetch_or_fallback(TYPE_OPTIONS, type, DEFAULT_TYPE)
|
61
56
|
@system_arguments[:classes] = class_names(
|
62
57
|
"btn-mktg",
|
63
58
|
SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_OPTIONS, scheme, DEFAULT_SCHEME)],
|
@@ -67,7 +62,7 @@ module Primer
|
|
67
62
|
end
|
68
63
|
|
69
64
|
def call
|
70
|
-
render(Primer::
|
65
|
+
render(Primer::BaseButton.new(**@system_arguments)) { content }
|
71
66
|
end
|
72
67
|
end
|
73
68
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= render Primer::BaseComponent.new(**@system_arguments) do %>
|
2
|
+
<% if content.present? %>
|
3
|
+
<%= content %>
|
4
|
+
<% else %>
|
5
|
+
<%= render Primer::OcticonComponent.new("clippy") %>
|
6
|
+
<%= render Primer::OcticonComponent.new("check", color: :icon_success, style: "display: none;") %>
|
7
|
+
<% end %>
|
8
|
+
<% end %>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
# Use ClipboardCopy to copy element text content or input values to the clipboard.
|
5
|
+
class ClipboardCopy < Primer::Component
|
6
|
+
status :alpha
|
7
|
+
|
8
|
+
# @example Default
|
9
|
+
# <%= render(Primer::ClipboardCopy.new(value: "Text to copy", label: "Copy text to the system clipboard")) %>
|
10
|
+
#
|
11
|
+
# @example With text instead of icons
|
12
|
+
# <%= render(Primer::ClipboardCopy.new(value: "Text to copy", label: "Copy text to the system clipboard")) do %>
|
13
|
+
# Click to copy!
|
14
|
+
# <% end %>
|
15
|
+
#
|
16
|
+
# @param label [String] String that will be read to screenreaders when the component is focused
|
17
|
+
# @param value [String] Text to copy into the users clipboard when they click the component
|
18
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
19
|
+
def initialize(label:, value:, **system_arguments)
|
20
|
+
@system_arguments = system_arguments
|
21
|
+
@system_arguments[:tag] = "clipboard-copy"
|
22
|
+
@system_arguments[:value] = value
|
23
|
+
@system_arguments[:"aria-label"] = label
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
import '@github/clipboard-copy-element';
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import '@github/clipboard-copy-element';
|
2
|
+
function toggleSVG(svg) {
|
3
|
+
if (svg.style.display === '' || svg.style.display === 'block') {
|
4
|
+
svg.style.display = 'none';
|
5
|
+
}
|
6
|
+
else {
|
7
|
+
svg.style.display = 'block';
|
8
|
+
}
|
9
|
+
}
|
10
|
+
// Toggle a copy button.
|
11
|
+
function toggleCopyButton(button) {
|
12
|
+
const [clippyIcon, checkIcon] = button.querySelectorAll('.octicon');
|
13
|
+
if (clippyIcon) {
|
14
|
+
toggleSVG(clippyIcon);
|
15
|
+
}
|
16
|
+
if (checkIcon) {
|
17
|
+
toggleSVG(checkIcon);
|
18
|
+
}
|
19
|
+
}
|
20
|
+
document.addEventListener('clipboard-copy', function ({ target }) {
|
21
|
+
if (!(target instanceof HTMLElement))
|
22
|
+
return;
|
23
|
+
toggleCopyButton(target);
|
24
|
+
setTimeout(toggleCopyButton, 2000, target);
|
25
|
+
});
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import '@github/clipboard-copy-element'
|
2
|
+
|
3
|
+
function toggleSVG(svg: SVGElement) {
|
4
|
+
if (svg.style.display === '' || svg.style.display === 'block') {
|
5
|
+
svg.style.display = 'none'
|
6
|
+
} else {
|
7
|
+
svg.style.display = 'block'
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
// Toggle a copy button.
|
12
|
+
function toggleCopyButton(button: HTMLElement) {
|
13
|
+
const [clippyIcon, checkIcon] = button.querySelectorAll<SVGElement>('.octicon')
|
14
|
+
|
15
|
+
if (clippyIcon) {
|
16
|
+
toggleSVG(clippyIcon)
|
17
|
+
}
|
18
|
+
if (checkIcon) {
|
19
|
+
toggleSVG(checkIcon)
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
document.addEventListener('clipboard-copy', function ({target}) {
|
24
|
+
if (!(target instanceof HTMLElement)) return
|
25
|
+
toggleCopyButton(target)
|
26
|
+
|
27
|
+
setTimeout(toggleCopyButton, 2000, target)
|
28
|
+
})
|
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
module Primer
|
4
4
|
# Use CloseButton to render an `×` without default button styles.
|
5
|
+
#
|
6
|
+
# @accessibility
|
7
|
+
# CloseButton has a default `aria-label` of "Close" to provides assistive technologies with an accessible label.
|
8
|
+
# You may choose to override this label with something more descriptive via [system_arguments][0].
|
9
|
+
# [0]: https://primer.style/view-components/system-arguments#html-attributes
|
5
10
|
class CloseButton < Primer::Component
|
6
11
|
DEFAULT_TYPE = :button
|
7
12
|
TYPE_OPTIONS = [DEFAULT_TYPE, :submit].freeze
|
@@ -14,15 +19,17 @@ module Primer
|
|
14
19
|
def initialize(type: DEFAULT_TYPE, **system_arguments)
|
15
20
|
@system_arguments = system_arguments
|
16
21
|
@system_arguments[:tag] = :button
|
22
|
+
@system_arguments[:block] = false
|
17
23
|
@system_arguments[:type] = fetch_or_fallback(TYPE_OPTIONS, type, DEFAULT_TYPE)
|
18
24
|
@system_arguments[:classes] = class_names(
|
19
25
|
"close-button",
|
20
26
|
system_arguments[:classes]
|
21
27
|
)
|
28
|
+
@system_arguments[:"aria-label"] ||= "Close"
|
22
29
|
end
|
23
30
|
|
24
31
|
def call
|
25
|
-
render(Primer::
|
32
|
+
render(Primer::BaseButton.new(**@system_arguments)) do
|
26
33
|
render(Primer::OcticonComponent.new("x"))
|
27
34
|
end
|
28
35
|
end
|
@@ -1,19 +1,47 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Primer
|
4
|
-
#
|
4
|
+
# Heading can be used to communicate page organization and hierarchy.
|
5
|
+
#
|
6
|
+
# - Set tag to one of `:h1`, `:h2`, `:h3`, `:h4`, `:h5`, `:h6` based on what is
|
7
|
+
# appropriate for the page context.
|
8
|
+
# - Use Heading as the title of a section or sub section.
|
9
|
+
# - Do not use Heading for styling alone. To style text without conveying heading semantics,
|
10
|
+
# consider using <%= link_to_component(Primer::TextComponent) %> with relevant <%= link_to_typography_docs %>.
|
11
|
+
# - Do not jump heading levels. For instance, do not follow a `<h1>` with an `<h3>`. Heading levels should
|
12
|
+
# increase by one in ascending order.
|
13
|
+
#
|
14
|
+
# @accessibility
|
15
|
+
# Headings convey semantic meaning. Assistive technology users rely on headings to quickly navigate and scan information on a page.
|
16
|
+
# Inappropriate use of headings can lead to a confusing experience.
|
17
|
+
# [Learn more about best heading practices (WAI Headings)](https://www.w3.org/WAI/tutorials/page-structure/headings/)
|
5
18
|
class HeadingComponent < Primer::Component
|
6
19
|
status :beta
|
7
20
|
|
21
|
+
TAG_FALLBACK = :h2
|
22
|
+
TAG_OPTIONS = [:h1, TAG_FALLBACK, :h3, :h4, :h5, :h6].freeze
|
23
|
+
|
8
24
|
# @example Default
|
9
|
-
# <%= render(Primer::HeadingComponent.new) { "H1 Text" } %>
|
25
|
+
# <%= render(Primer::HeadingComponent.new(tag: :h1)) { "H1 Text" } %>
|
10
26
|
# <%= render(Primer::HeadingComponent.new(tag: :h2)) { "H2 Text" } %>
|
11
27
|
# <%= render(Primer::HeadingComponent.new(tag: :h3)) { "H3 Text" } %>
|
28
|
+
# <%= render(Primer::HeadingComponent.new(tag: :h4)) { "H4 Text" } %>
|
29
|
+
# <%= render(Primer::HeadingComponent.new(tag: :h5)) { "H5 Text" } %>
|
30
|
+
# <%= render(Primer::HeadingComponent.new(tag: :h6)) { "H6 Text" } %>
|
31
|
+
#
|
32
|
+
# @example With `font_size`
|
33
|
+
# <%= render(Primer::HeadingComponent.new(tag: :h1, font_size: 6)) { "h1 tag, font_size 6" } %>
|
34
|
+
# <%= render(Primer::HeadingComponent.new(tag: :h2, font_size: 3)) { "h2 tag, font_size 3" } %>
|
35
|
+
# <%= render(Primer::HeadingComponent.new(tag: :h3, font_size: 2)) { "h3 tag, font_size 2" } %>
|
36
|
+
# <%= render(Primer::HeadingComponent.new(tag: :h4, font_size: 0)) { "h4 tag, font_size 0" } %>
|
37
|
+
# <%= render(Primer::HeadingComponent.new(tag: :h5, font_size: 1)) { "h5 tag, font_size 1" } %>
|
38
|
+
# <%= render(Primer::HeadingComponent.new(tag: :h6, font_size: 4)) { "h6 tag, font_size 4" } %>
|
12
39
|
#
|
40
|
+
# @param tag [String] <%= one_of(Primer::HeadingComponent::TAG_OPTIONS) %>
|
13
41
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
14
|
-
def initialize(**system_arguments)
|
42
|
+
def initialize(tag:, **system_arguments)
|
15
43
|
@system_arguments = system_arguments
|
16
|
-
@system_arguments[:tag]
|
44
|
+
@system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, TAG_FALLBACK)
|
17
45
|
end
|
18
46
|
|
19
47
|
def call
|
@@ -25,8 +25,6 @@ module Primer
|
|
25
25
|
)
|
26
26
|
|
27
27
|
@button_arguments = button_arguments
|
28
|
-
@button_arguments[:tag] = :button
|
29
|
-
@button_arguments[:type] = :button
|
30
28
|
@button_arguments[:"aria-expanded"] = false
|
31
29
|
@button_arguments[:classes] = class_names(
|
32
30
|
"ellipsis-expander",
|
@@ -36,7 +34,7 @@ module Primer
|
|
36
34
|
|
37
35
|
def call
|
38
36
|
render(Primer::BaseComponent.new(**@system_arguments)) do
|
39
|
-
render(Primer::
|
37
|
+
render(Primer::BaseButton.new(**@button_arguments)) { "…" }
|
40
38
|
end
|
41
39
|
end
|
42
40
|
end
|
@@ -29,7 +29,7 @@ module Primer
|
|
29
29
|
SIZE_OPTIONS = SIZE_MAPPINGS.keys
|
30
30
|
|
31
31
|
TAG_DEFAULT = :span
|
32
|
-
TAG_OPTIONS = [TAG_DEFAULT, :div
|
32
|
+
TAG_OPTIONS = [TAG_DEFAULT, :div].freeze
|
33
33
|
|
34
34
|
# @example Default
|
35
35
|
# <%= render(Primer::StateComponent.new(title: "title")) { "State" } %>
|
data/app/lib/primer/classify.rb
CHANGED
@@ -15,7 +15,7 @@ module Primer
|
|
15
15
|
CONCAT_KEYS = SPACING_KEYS + %i[hide position v float col text box_shadow].freeze
|
16
16
|
|
17
17
|
INVALID_CLASS_NAME_PREFIXES =
|
18
|
-
(["bg-", "color-", "text-", "d-", "v-align-", "wb-", "
|
18
|
+
(["bg-", "color-", "text-", "d-", "v-align-", "wb-", "box-shadow-"] + CONCAT_KEYS.map { |k| "#{k}-" }).freeze
|
19
19
|
|
20
20
|
COLOR_KEY = :color
|
21
21
|
BG_KEY = :bg
|
data/static/statuses.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"Primer::AutoComplete":"beta","Primer::AutoComplete::Item":"beta","Primer::AvatarComponent":"beta","Primer::AvatarStackComponent":"beta","Primer::BaseComponent":"beta","Primer::BlankslateComponent":"beta","Primer::BorderBoxComponent":"beta","Primer::BoxComponent":"stable","Primer::BreadcrumbComponent":"beta","Primer::BreadcrumbComponent::ItemComponent":"alpha","Primer::ButtonComponent":"beta","Primer::
|
1
|
+
{"Primer::AutoComplete":"beta","Primer::AutoComplete::Item":"beta","Primer::AvatarComponent":"beta","Primer::AvatarStackComponent":"beta","Primer::BaseButton":"beta","Primer::BaseComponent":"beta","Primer::BlankslateComponent":"beta","Primer::BorderBoxComponent":"beta","Primer::BoxComponent":"stable","Primer::BreadcrumbComponent":"beta","Primer::BreadcrumbComponent::ItemComponent":"alpha","Primer::ButtonComponent":"beta","Primer::ButtonGroup":"beta","Primer::ButtonMarketingComponent":"alpha","Primer::ClipboardCopy":"alpha","Primer::CloseButton":"alpha","Primer::CounterComponent":"beta","Primer::DetailsComponent":"beta","Primer::Dropdown::MenuComponent":"alpha","Primer::DropdownComponent":"alpha","Primer::DropdownMenuComponent":"deprecated","Primer::FlashComponent":"beta","Primer::FlexComponent":"alpha","Primer::FlexItemComponent":"alpha","Primer::HeadingComponent":"beta","Primer::HiddenTextExpander":"alpha","Primer::LabelComponent":"beta","Primer::LayoutComponent":"alpha","Primer::LinkComponent":"beta","Primer::MarkdownComponent":"alpha","Primer::MenuComponent":"alpha","Primer::Navigation::TabComponent":"alpha","Primer::OcticonComponent":"beta","Primer::PopoverComponent":"beta","Primer::ProgressBarComponent":"beta","Primer::SpinnerComponent":"beta","Primer::StateComponent":"beta","Primer::SubheadComponent":"beta","Primer::TabContainerComponent":"alpha","Primer::TabNavComponent":"alpha","Primer::TextComponent":"beta","Primer::TimeAgoComponent":"beta","Primer::TimelineItemComponent":"beta","Primer::TimelineItemComponent::BadgeComponent":"alpha","Primer::TooltipComponent":"alpha","Primer::Truncate":"beta","Primer::UnderlineNavComponent":"alpha"}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: primer_view_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.38
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -333,6 +333,7 @@ files:
|
|
333
333
|
- app/components/primer/avatar_component.rb
|
334
334
|
- app/components/primer/avatar_stack_component.html.erb
|
335
335
|
- app/components/primer/avatar_stack_component.rb
|
336
|
+
- app/components/primer/base_button.rb
|
336
337
|
- app/components/primer/base_component.rb
|
337
338
|
- app/components/primer/blankslate_component.html.erb
|
338
339
|
- app/components/primer/blankslate_component.rb
|
@@ -342,9 +343,15 @@ files:
|
|
342
343
|
- app/components/primer/breadcrumb_component.html.erb
|
343
344
|
- app/components/primer/breadcrumb_component.rb
|
344
345
|
- app/components/primer/button_component.rb
|
345
|
-
- app/components/primer/
|
346
|
-
- app/components/primer/
|
346
|
+
- app/components/primer/button_component.rb.orig
|
347
|
+
- app/components/primer/button_group.html.erb
|
348
|
+
- app/components/primer/button_group.rb
|
347
349
|
- app/components/primer/button_marketing_component.rb
|
350
|
+
- app/components/primer/clipboard_copy.html.erb
|
351
|
+
- app/components/primer/clipboard_copy.rb
|
352
|
+
- app/components/primer/clipboard_copy_component.d.ts
|
353
|
+
- app/components/primer/clipboard_copy_component.js
|
354
|
+
- app/components/primer/clipboard_copy_component.ts
|
348
355
|
- app/components/primer/close_button.rb
|
349
356
|
- app/components/primer/component.rb
|
350
357
|
- app/components/primer/counter_component.rb
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Primer
|
4
|
-
# Use ButtonGroupComponent to render a series of buttons.
|
5
|
-
class ButtonGroupComponent < Primer::Component
|
6
|
-
# Required list of buttons to be rendered.
|
7
|
-
#
|
8
|
-
# @param kwargs [Hash] The same arguments as <%= link_to_component(Primer::ButtonComponent) %>.
|
9
|
-
renders_many :buttons, ->(**kwargs) { Primer::ButtonComponent.new(group_item: true, **kwargs) }
|
10
|
-
|
11
|
-
# @example Default
|
12
|
-
# <%= render(Primer::ButtonGroupComponent.new) do |component|
|
13
|
-
# component.button { "Default" }
|
14
|
-
# component.button(scheme: :primary) { "Primary" }
|
15
|
-
# component.button(scheme: :danger) { "Danger" }
|
16
|
-
# component.button(scheme: :outline) { "Outline" }
|
17
|
-
# component.button(classes: "my-class") { "Custom class" }
|
18
|
-
# end %>
|
19
|
-
#
|
20
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
21
|
-
def initialize(**system_arguments)
|
22
|
-
@system_arguments = system_arguments
|
23
|
-
@system_arguments[:tag] ||= :div
|
24
|
-
|
25
|
-
@system_arguments[:classes] = class_names(
|
26
|
-
"BtnGroup",
|
27
|
-
system_arguments[:classes]
|
28
|
-
)
|
29
|
-
end
|
30
|
-
|
31
|
-
def render?
|
32
|
-
buttons.any?
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|