primer_view_components 0.0.22 → 0.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +74 -1
  3. data/app/assets/javascripts/primer_view_components.js +1 -1
  4. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  5. data/app/assets/javascripts/primer_view_components.js.map.orig +5 -0
  6. data/app/assets/javascripts/primer_view_components.js.orig +6 -0
  7. data/app/components/primer/auto_complete_component.js +1 -0
  8. data/app/components/primer/avatar_component.rb +2 -4
  9. data/app/components/primer/base_component.rb +5 -13
  10. data/app/components/primer/blankslate_component.rb +2 -0
  11. data/app/components/primer/border_box_component.rb +2 -4
  12. data/app/components/primer/box_component.rb +2 -4
  13. data/app/components/primer/breadcrumb_component.html.erb +1 -2
  14. data/app/components/primer/breadcrumb_component.rb +24 -12
  15. data/app/components/primer/component.rb +2 -13
  16. data/app/components/primer/counter_component.rb +2 -4
  17. data/app/components/primer/details_component.rb +2 -3
  18. data/app/components/primer/dropdown_menu_component.rb +2 -4
  19. data/app/components/primer/flash_component.rb +2 -4
  20. data/app/components/primer/label_component.rb +18 -24
  21. data/app/components/primer/layout_component.html.erb +3 -9
  22. data/app/components/primer/layout_component.rb +30 -5
  23. data/app/components/primer/link_component.rb +2 -4
  24. data/app/components/primer/octicon_component.rb +4 -6
  25. data/app/components/primer/primer.js +1 -0
  26. data/app/components/primer/primer.ts +1 -0
  27. data/app/components/primer/progress_bar_component.html.erb +1 -1
  28. data/app/components/primer/progress_bar_component.rb +24 -27
  29. data/app/components/primer/spinner_component.rb +2 -4
  30. data/app/components/primer/state_component.rb +2 -4
  31. data/app/components/primer/subhead_component.html.erb +3 -15
  32. data/app/components/primer/subhead_component.rb +44 -58
  33. data/app/components/primer/time_ago_component.js +1 -0
  34. data/app/components/primer/time_ago_component.rb +47 -0
  35. data/app/components/primer/time_ago_component.ts +1 -0
  36. data/app/components/primer/underline_nav_component.html.erb +5 -5
  37. data/app/components/primer/underline_nav_component.rb +24 -5
  38. data/app/lib/primer/classify/functional_colors.rb.orig +124 -0
  39. data/app/lib/primer/status/dsl.rb +43 -0
  40. data/app/lib/primer/test_selector_helper.rb +20 -0
  41. data/app/lib/primer/view_helper/dsl.rb +2 -2
  42. data/lib/primer/view_components/version.rb +1 -1
  43. data/static/statuses.json +1 -1
  44. metadata +12 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3155227cd7ba3d3c02063d1021e1430df8d514a7feabe0b5fad0680c593ffc3c
4
- data.tar.gz: 344362c292977c1dd6b84d283b1a5b5fea8894d2dd0aa5be0c1007fdbf4bf397
3
+ metadata.gz: 7339cf218087e814ee88085f8767aba2cd432b88f7f4ff06dd33e4df13b4f9d2
4
+ data.tar.gz: c81f6cc9e5cbe206462be77a850d439dcbdebae8f56bffbbf765485e1e098882
5
5
  SHA512:
6
- metadata.gz: 76e300f1f5cd3cf5e861f48246f6124ad2432014a003b4b8dffe3b373415d47c43af118965c879f8fe58bfd111dded1a9270c7e2f824020022b14990028210dd
7
- data.tar.gz: 899f5cf473acde6ff778bd2a86ded0bbb90aea6d8bce9fca0483c455aefc3b8c68388cb0eec578129d6b5703ae53eeeacc14701d4b2fcbdaaba47fd447b117f6
6
+ metadata.gz: e30cf4002c404fadeb709eba7fe5c3fc57f659dcbf2974247b649eb8232112838565f1d6aa996dc0d39189a95c3bf2c549b3a9f0201be0355431348fa0e2b113
7
+ data.tar.gz: eef1aa2153705d975f03ab79cfe38b23d8bcd2b251c340fe414eef008dc623e42808229d268380aeb977f133a8b803da65c68c9c3bbe68092b3f76b68eb016f3
data/CHANGELOG.md CHANGED
@@ -1,7 +1,80 @@
1
1
  # CHANGELOG
2
2
 
3
3
  ## main
4
-
4
+
5
+ ## 0.0.27
6
+
7
+ * Promote `BreadcrumbComponent` and `ProgressBarComponent` to beta status.
8
+
9
+ *Simon Taranto*
10
+
11
+ * Fix `OcticonComponent` not rendering `data-test-selector` correctly.
12
+
13
+ *Manuel Puyol*
14
+
15
+ * Add `TimeAgo` component.
16
+
17
+ *Keith Cirkel*
18
+
19
+ * **Breaking change**: Updates `UnderlineNavComponent` to use Slots V2.
20
+
21
+ *Simon Taranto*
22
+
23
+ * **Breaking change**: Upgrade `LayoutComponent` to use Slots V2.
24
+
25
+ *Simon Taranto*
26
+
27
+ ## 0.0.26
28
+
29
+ * Fix `DetailsComponent` summary always being rendered as a `btn`.
30
+
31
+ *Manuel Puyol*
32
+
33
+ * Promote `BlankslateComponent` and `BaseComponent` to beta status.
34
+
35
+ *Simon Taranto*
36
+
37
+ ## 0.0.25
38
+
39
+ * Promote `SubheadComponent` to beta.
40
+
41
+ *Simon Taranto*
42
+
43
+ * Add deprecated `orange` and `purple` schemes to `LabelComponent`.
44
+
45
+ *Manuel Puyol*
46
+
47
+ ## 0.0.24
48
+
49
+ * Fix zeitwerk autoload integration.
50
+
51
+ *Manuel Puyol*
52
+
53
+ * **Breaking change**: Upgrade `ProgressBarComponent` to use Slots V2.
54
+
55
+ *Simon Taranto*
56
+
57
+ * **Breaking change**: Upgrade `BreadcrumbComponent` to use Slots V2.
58
+
59
+ *Manuel Puyol*
60
+
61
+ ## 0.0.23
62
+
63
+ * Remove node and yarn version requirements from `@primer/view-components`.
64
+
65
+ *Manuel Puyol*
66
+
67
+ * **Breaking change**: Upgrade `SubheadComponent` to use Slots V2.
68
+
69
+ *Simon Taranto*
70
+
71
+ * **Breaking change**: Update `LabelComponent` to use only functional color
72
+ supportive scheme keys. The component no longer accepts colors (`:gray`, for
73
+ example) but only functional schemes (`primary`, for example).
74
+ `LabelComponent` is promoted to beta status.
75
+
76
+ *Simon Taranto*
77
+
5
78
  ## 0.0.22
6
79
 
7
80
  * Add view helpers to easily render Primer components.
@@ -1,2 +1,2 @@
1
- class t extends HTMLElement{constructor(){super(),this.addEventListener("keydown",(t=>{const r=t.target;if(!(r instanceof HTMLElement))return;if("tab"!==r.getAttribute("role")&&!r.closest('[role="tablist"]'))return;const a=Array.from(this.querySelectorAll('[role="tablist"] [role="tab"]')),n=a.indexOf(a.find((t=>t.matches('[aria-selected="true"]'))));if("ArrowRight"===t.code){let t=n+1;t>=a.length&&(t=0),e(this,t)}else if("ArrowLeft"===t.code){let t=n-1;t<0&&(t=a.length-1),e(this,t)}else"Home"===t.code?(e(this,0),t.preventDefault()):"End"===t.code&&(e(this,a.length-1),t.preventDefault())})),this.addEventListener("click",(t=>{const r=Array.from(this.querySelectorAll('[role="tablist"] [role="tab"]'));if(!(t.target instanceof Element))return;const a=t.target.closest('[role="tab"]');if(!a||!a.closest('[role="tablist"]'))return;e(this,r.indexOf(a))}))}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 e(t,e){const r=t.querySelectorAll('[role="tablist"] [role="tab"]'),a=t.querySelectorAll('[role="tabpanel"]'),n=r[e],i=a[e];if(!!t.dispatchEvent(new CustomEvent("tab-container-change",{bubbles:!0,cancelable:!0,detail:{relatedTarget:i}}))){for(const t of r)t.setAttribute("aria-selected","false"),t.setAttribute("tabindex","-1");for(const t of a)t.hidden=!0,t.hasAttribute("tabindex")||t.hasAttribute("data-tab-container-no-tabstop")||t.setAttribute("tabindex","0");n.setAttribute("aria-selected","true"),n.setAttribute("tabindex","0"),n.focus(),i.hidden=!1,t.dispatchEvent(new CustomEvent("tab-container-changed",{bubbles:!0,detail:{relatedTarget:i}}))}}window.customElements.get("tab-container")||(window.TabContainerElement=t,window.customElements.define("tab-container",t));
1
+ class t extends HTMLElement{constructor(){super(),this.addEventListener("keydown",(t=>{const n=t.target;if(!(n instanceof HTMLElement))return;if("tab"!==n.getAttribute("role")&&!n.closest('[role="tablist"]'))return;const r=Array.from(this.querySelectorAll('[role="tablist"] [role="tab"]')),a=r.indexOf(r.find((t=>t.matches('[aria-selected="true"]'))));if("ArrowRight"===t.code){let t=a+1;t>=r.length&&(t=0),e(this,t)}else if("ArrowLeft"===t.code){let t=a-1;t<0&&(t=r.length-1),e(this,t)}else"Home"===t.code?(e(this,0),t.preventDefault()):"End"===t.code&&(e(this,r.length-1),t.preventDefault())})),this.addEventListener("click",(t=>{const n=Array.from(this.querySelectorAll('[role="tablist"] [role="tab"]'));if(!(t.target instanceof Element))return;const r=t.target.closest('[role="tab"]');if(!r||!r.closest('[role="tablist"]'))return;e(this,n.indexOf(r))}))}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 e(t,e){const n=t.querySelectorAll('[role="tablist"] [role="tab"]'),r=t.querySelectorAll('[role="tabpanel"]'),a=n[e],i=r[e];if(!!t.dispatchEvent(new CustomEvent("tab-container-change",{bubbles:!0,cancelable:!0,detail:{relatedTarget:i}}))){for(const t of n)t.setAttribute("aria-selected","false"),t.setAttribute("tabindex","-1");for(const t of r)t.hidden=!0,t.hasAttribute("tabindex")||t.hasAttribute("data-tab-container-no-tabstop")||t.setAttribute("tabindex","0");a.setAttribute("aria-selected","true"),a.setAttribute("tabindex","0"),a.focus(),i.hidden=!1,t.dispatchEvent(new CustomEvent("tab-container-changed",{bubbles:!0,detail:{relatedTarget:i}}))}}window.customElements.get("tab-container")||(window.TabContainerElement=t,window.customElements.define("tab-container",t));const n=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],r=["January","February","March","April","May","June","July","August","September","October","November","December"];function a(t){return"0".concat(t).slice(-2)}function i(t,e){const o=t.getDay(),s=t.getDate(),c=t.getMonth(),u=t.getFullYear(),l=t.getHours(),d=t.getMinutes(),m=t.getSeconds();return e.replace(/%([%aAbBcdeHIlmMpPSwyYZz])/g,(function(e){let h;switch(e[1]){case"%":return"%";case"a":return n[o].slice(0,3);case"A":return n[o];case"b":return r[c].slice(0,3);case"B":return r[c];case"c":return t.toString();case"d":return a(s);case"e":return String(s);case"H":return a(l);case"I":return a(i(t,"%l"));case"l":return String(0===l||12===l?12:(l+12)%12);case"m":return a(c+1);case"M":return a(d);case"p":return l>11?"PM":"AM";case"P":return l>11?"pm":"am";case"S":return a(m);case"w":return String(o);case"y":return a(u%100);case"Y":return String(u);case"Z":return h=t.toString().match(/\((\w+)\)$/),h?h[1]:"";case"z":return h=t.toString().match(/\w([+-]\d\d\d\d) /),h?h[1]:""}return""}))}function o(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 s=null;const c=o({day:"numeric",month:"short"});function u(){if(null!==s)return s;const t=c();if(t){const e=t.format(new Date(0));return s=!!e.match(/^\d/),s}return!1}let l=null;const d=o({day:"numeric",month:"short",year:"numeric"});function m(t){const e=t.closest("[lang]");return e instanceof HTMLElement&&e.lang?e.lang:"default"}const h=new WeakMap;class g 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 r=this.getFormattedTitle();if("datetime"===t){const t=Date.parse(n);isNaN(t)?h.delete(this):h.set(this,new Date(t))}const a=this.getFormattedTitle(),i=this.getAttribute("title");"title"===t||!a||i&&i!==r||this.setAttribute("title",a);const o=this.getFormattedDate();o&&(this.textContent=o)}get date(){return h.get(this)}getFormattedTitle(){const t=this.date;if(!t)return;const e=f();if(e)return e.format(t);try{return t.toLocaleString()}catch(e){if(e instanceof RangeError)return t.toString();throw e}}getFormattedDate(){}}const f=o({day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}),w=new WeakMap;class b extends g{attributeChangedCallback(t,e,n){"hour"!==t&&"minute"!==t&&"second"!==t&&"time-zone-name"!==t||w.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 r=u()?"weekday day month year":"weekday month day, year";for(const e in n){const a=n[e][t.getAttribute(e)];r=r.replace(e,a||"")}return r=r.replace(/(\s,)|(,\s$)/,""),i(e,r).replace(/\s+/," ").trim()}(this,t)||"",n=function(t,e){const n={},r=t.getAttribute("hour");"numeric"!==r&&"2-digit"!==r||(n.hour=r);const a=t.getAttribute("minute");"numeric"!==a&&"2-digit"!==a||(n.minute=a);const s=t.getAttribute("second");"numeric"!==s&&"2-digit"!==s||(n.second=s);const c=t.getAttribute("time-zone-name");"short"!==c&&"long"!==c||(n.timeZoneName=c);if(0===Object.keys(n).length)return;let u=w.get(t);u||(u=o(n),w.set(t,u));const l=u();if(l)return l.format(e);return i(e,n.second?"%H:%M:%S":"%H:%M")}(this,t)||"";return"".concat(e," ").concat(n).trim()}}window.customElements.get("local-time")||(window.LocalTimeElement=b,window.customElements.define("local-time",b));class y{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),r=Math.round(n/60),a=Math.round(r/24);return t>=0&&a<30?this.timeAgoFromMs(t):null}timeAhead(){const t=this.date.getTime()-(new Date).getTime(),e=Math.round(t/1e3),n=Math.round(e/60),r=Math.round(n/60),a=Math.round(r/24);return t>=0&&a<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),r=Math.round(n/60),a=Math.round(r/24),i=Math.round(a/30),o=Math.round(i/12);return t<0||e<10?M(this.locale,0,"second"):e<45?M(this.locale,-e,"second"):e<90||n<45?M(this.locale,-n,"minute"):n<90||r<24?M(this.locale,-r,"hour"):r<36||a<30?M(this.locale,-a,"day"):i<18?M(this.locale,-i,"month"):M(this.locale,-o,"year")}microTimeAgo(){const t=(new Date).getTime()-this.date.getTime(),e=Math.round(t/1e3),n=Math.round(e/60),r=Math.round(n/60),a=Math.round(r/24),i=Math.round(a/30),o=Math.round(i/12);return n<1?"1m":n<60?"".concat(n,"m"):r<24?"".concat(r,"h"):a<365?"".concat(a,"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),r=Math.round(n/60),a=Math.round(r/24),i=Math.round(a/30),o=Math.round(i/12);return i>=18||i>=12?M(this.locale,o,"year"):a>=45||a>=30?M(this.locale,i,"month"):r>=36||r>=24?M(this.locale,a,"day"):n>=90||n>=45?M(this.locale,r,"hour"):e>=90||e>=45?M(this.locale,n,"minute"):M(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),r=Math.round(n/60),a=Math.round(r/24),i=Math.round(a/30),o=Math.round(i/12);return a>=365?"".concat(o,"y"):r>=24?"".concat(a,"d"):n>=60?"".concat(r,"h"):n>1?"".concat(n,"m"):"1m"}formatDate(){let t=u()?"%e %b":"%b %e";var e;return e=this.date,(new Date).getUTCFullYear()!==e.getUTCFullYear()&&(t+=function(){if(null!==l)return l;const t=d();if(t){const e=t.format(new Date(0));return l=!!e.match(/\d,/),l}return!0}()?", %Y":" %Y"),i(this.date,t)}formatTime(){const t=A();return t?t.format(this.date):i(this.date,"%l:%M%P")}}function M(t,e,n){const r=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 r?r.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 A=o({hour:"numeric",minute:"2-digit"});class T extends g{getFormattedDate(){const t=this.date;if(t)return new y(t,m(this)).toString()}connectedCallback(){E.push(this),D||(p(),D=setInterval(p,6e4)),super.connectedCallback()}disconnectedCallback(){const t=E.indexOf(this);-1!==t&&E.splice(t,1),E.length||D&&(clearInterval(D),D=null)}}const E=[];let D;function p(){let t,e,n;for(e=0,n=E.length;e<n;e++)t=E[e],t.textContent=t.getFormattedDate()||""}window.customElements.get("relative-time")||(window.RelativeTimeElement=T,window.customElements.define("relative-time",T));class F extends T{getFormattedDate(){const t=this.getAttribute("format"),e=this.date;if(e)return"micro"===t?new y(e,m(this)).microTimeAgo():new y(e,m(this)).timeAgo()}}window.customElements.get("time-ago")||(window.TimeAgoElement=F,window.customElements.define("time-ago",F));class S extends T{getFormattedDate(){const t=this.getAttribute("format"),e=this.date;if(e)return"micro"===t?new y(e,m(this)).microTimeUntil():new y(e,m(this)).timeUntil()}}window.customElements.get("time-until")||(window.TimeUntilElement=S,window.customElements.define("time-until",S));
2
2
  //# sourceMappingURL=primer_view_components.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"primer_view_components.js","sources":["../../../node_modules/@github/tab-container-element/dist/index.js"],"sourcesContent":["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"],"names":["TabContainerElement","HTMLElement","[object Object]","super","this","addEventListener","event","target","getAttribute","closest","tabs","Array","from","querySelectorAll","currentIndex","indexOf","find","tab","matches","code","index","length","selectTab","preventDefault","Element","hasAttribute","setAttribute","tabContainer","panels","selectedTab","selectedPanel","dispatchEvent","CustomEvent","bubbles","cancelable","detail","relatedTarget","panel","hidden","focus","window","customElements","get","define"],"mappings":"AAAe,MAAMA,UAA4BC,YAC7CC,cACIC,QACAC,KAAKC,iBAAiB,WAAYC,IAC9B,MAAMC,EAASD,EAAMC,OACrB,KAAMA,aAAkBN,aACpB,OACJ,GAAoC,QAAhCM,EAAOC,aAAa,UAAsBD,EAAOE,QAAQ,oBACzD,OACJ,MAAMC,EAAOC,MAAMC,KAAKR,KAAKS,iBAAiB,kCACxCC,EAAeJ,EAAKK,QAAQL,EAAKM,MAAKC,GAAOA,EAAIC,QAAQ,6BAC/D,GAAmB,eAAfZ,EAAMa,KAAuB,CAC7B,IAAIC,EAAQN,EAAe,EACvBM,GAASV,EAAKW,SACdD,E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CG,EAAYH,aAAa,WAAY,KACrCG,EAAYU,QACZT,EAAcQ,QAAS,EACvBX,EAAaI,cAAc,IAAIC,YAAY,wBAAyB,CAChEC,SAAS,EACTE,OAAQ,CAAEC,cAAeN,OAG5BU,OAAOC,eAAeC,IAAI,mBAC3BF,OAAOxC,oBAAsBA,EAC7BwC,OAAOC,eAAeE,OAAO,gBAAiB3C"}
1
+ {"version":3,"file":"primer_view_components.js","sources":["../../../node_modules/@github/tab-container-element/dist/index.js","../../../node_modules/@github/time-elements/dist/time-elements.js"],"sourcesContent":["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":["TabContainerElement","HTMLElement","[object Object]","super","this","addEventListener","event","target","getAttribute","closest","tabs","Array","from","querySelectorAll","currentIndex","indexOf","find","tab","matches","code","index","length","selectTab","preventDefault","Element","hasAttribute","setAttribute","tabContainer","panels","selectedTab","selectedPanel","dispatchEvent","CustomEvent","bubbles","cancelable","detail","relatedTarget","panel","hidden","focus","window","customElements","get","define","weekdays","months","pad","num","concat","slice","strftime","time","formatString","day","getDay","date","getDate","month","getMonth","year","getFullYear","hour","getHours","minute","getMinutes","second","getSeconds","replace","_arg","match","toString","String","makeFormatter","options","format","Intl","DateTimeFormat","undefined","e","RangeError","dayFirst","dayFirstFormatter","isDayFirst","formatter","output","Date","yearSeparator","yearFormatter","localeFromElement","el","container","lang","datetimes","WeakMap","ExtendedTimeElement","observedAttributes","title","getFormattedTitle","text","getFormattedDate","textContent","attrName","oldValue","newValue","oldTitle","millis","parse","isNaN","delete","set","currentTitle","titleFormatter","toLocaleString","timeZoneName","formatters","LocalTimeElement","attributeChangedCallback","d","props","weekday","short","long","numeric","2-digit","prop","value","trim","formatDate","tz","Object","keys","factory","formatTime","RelativeTime","locale","ago","timeElapsed","ahead","timeAhead","ms","getTime","sec","Math","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":"AAAe,MAAMA,UAA4BC,YAC7CC,cACIC,QACAC,KAAKC,iBAAiB,WAAYC,IAC9B,MAAMC,EAASD,EAAMC,OACrB,KAAMA,aAAkBN,aACpB,OACJ,GAAoC,QAAhCM,EAAOC,aAAa,UAAsBD,EAAOE,QAAQ,oBACzD,OACJ,MAAMC,EAAOC,MAAMC,KAAKR,KAAKS,iBAAiB,kCACxCC,EAAeJ,EAAKK,QAAQL,EAAKM,MAAKC,GAAOA,EAAIC,QAAQ,6BAC/D,GAAmB,eAAfZ,EAAMa,KAAuB,CAC7B,IAAIC,EAAQN,EAAe,EACvBM,GAASV,EAAKW,SACdD,EAAQ,GACZE,EAAUlB,KAAMgB,QAEf,GAAmB,cAAfd,EAAMa,KAAsB,CACjC,IAAIC,EAAQN,EAAe,EACvBM,EAAQ,IACRA,EAAQV,EAAKW,OAAS,GAC1BC,EAAUlB,KAAMgB,OAEI,SAAfd,EAAMa,MACXG,EAAUlB,KAAM,GAChBE,EAAMiB,kBAEc,QAAfjB,EAAMa,OACXG,EAAUlB,KAAMM,EAAKW,OAAS,GAC9Bf,EAAMiB,qBAGdnB,KAAKC,iBAAiB,SAAUC,IAC5B,MAAMI,EAAOC,MAAMC,KAAKR,KAAKS,iBAAiB,kCAC9C,KAAMP,EAAMC,kBAAkBiB,SAC1B,OACJ,MAAMP,EAAMX,EAAMC,OAAOE,QAAQ,gBACjC,IAAKQ,IAAQA,EAAIR,QAAQ,oBACrB,OAEJa,EAAUlB,KADIM,EAAKK,QAAQ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K,EAAKN,EAAY/I,QAAQX,OAEnB,IAARgK,GACFN,EAAYO,OAAOD,EAAI,GAGpBN,EAAYzI,QACX2I,IACFM,cAAcN,GACdA,EAAsB,OAQ9B,MAAMF,EAAc,GAEpB,IAAIE,EAGJ,SAASC,IACP,IAAI9G,EAAMoH,EAAGC,EAEb,IAAKD,EAAI,EAAGC,EAAMV,EAAYzI,OAAQkJ,EAAIC,EAAKD,IAC7CpH,EAAO2G,EAAYS,GACnBpH,EAAKiD,YAAcjD,EAAKgD,oBAAsB,GAS7C3D,OAAOC,eAAeC,IAAI,mBAC7BF,OAAOqH,oBAAsBA,EAC7BrH,OAAOC,eAAeE,OAAO,gBAAiBkH,IAGhD,MAAMY,UAAuBZ,EAC3B3J,mBACE,MAAMwE,EAAStE,KAAKI,aAAa,UAC3B+C,EAAOnD,KAAKmD,KAClB,GAAKA,EAEL,MAAe,UAAXmB,EACK,IAAI2D,EAAa9E,EAAMiC,EAAkBpF,OAAOsK,eAEhD,IAAIrC,EAAa9E,EAAMiC,EAAkBpF,OAAOuK,WAMxDnI,OAAOC,eAAeC,IAAI,cAC7BF,OAAOiI,eAAiBA,EACxBjI,OAAOC,eAAeE,OAAO,WAAY8H,IAG3C,MAAMG,UAAyBf,EAC7B3J,mBACE,MAAMwE,EAAStE,KAAKI,aAAa,UAC3B+C,EAAOnD,KAAKmD,KAClB,GAAKA,EAEL,MAAe,UAAXmB,EACK,IAAI2D,EAAa9E,EAAMiC,EAAkBpF,OAAOyK,iBAEhD,IAAIxC,EAAa9E,EAAMiC,EAAkBpF,OAAO+I,aAMxD3G,OAAOC,eAAeC,IAAI,gBAC7BF,OAAOoI,iBAAmBA,EAC1BpI,OAAOC,eAAeE,OAAO,aAAciI"}
@@ -0,0 +1,5 @@
1
+ <<<<<<< HEAD
2
+ {"version":3,"file":"primer_view_components.js","sources":["../../../node_modules/@github/tab-container-element/dist/index.js","../../../node_modules/@github/time-elements/dist/time-elements.js"],"sourcesContent":["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":["TabContainerElement","HTMLElement","[object Object]","super","this","addEventListener","event","target","getAttribute","closest","tabs","Array","from","querySelectorAll","currentIndex","indexOf","find","tab","matches","code","index","length","selectTab","preventDefault","Element","hasAttribute","setAttribute","tabContainer","panels","selectedTab","selectedPanel","dispatchEvent","CustomEvent","bubbles","cancelable","detail","relatedTarget","panel","hidden","focus","window","customElements","get","define","weekdays","months","pad","num","concat","slice","strftime","time","formatString","day","getDay","date","getDate","month","getMonth","year","getFullYear","hour","getHours","minute","getMinutes","second","getSeconds","replace","_arg","match","toString","String","makeFormatter","options","format","Intl","DateTimeFormat","undefined","e","RangeError","dayFirst","dayFirstFormatter","isDayFirst","formatter","output","Date","yearSeparator","yearFormatter","localeFromElement","el","container","lang","datetimes","WeakMap","ExtendedTimeElement","observedAttributes","title","getFormattedTitle","text","getFormattedDate","textContent","attrName","oldValue","newValue","oldTitle","millis","parse","isNaN","delete","set","currentTitle","titleFormatter","toLocaleString","timeZoneName","formatters","LocalTimeElement","attributeChangedCallback","d","props","weekday","short","long","numeric","2-digit","prop","value","trim","formatDate","tz","Object","keys","factory","formatTime","RelativeTime","locale","ago","timeElapsed","ahead","timeAhead","ms","getTime","sec","Math","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":"AAAe,MAAMA,UAA4BC,YAC7CC,cACIC,QACAC,KAAKC,iBAAiB,WAA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C7BF,OAAOqH,oBAAsBA,EAC7BrH,OAAOC,eAAeE,OAAO,gBAAiBkH,IAGhD,MAAMY,UAAuBZ,EAC3B3J,mBACE,MAAMwE,EAAStE,KAAKI,aAAa,UAC3B+C,EAAOnD,KAAKmD,KAClB,GAAKA,EAEL,MAAe,UAAXmB,EACK,IAAI2D,EAAa9E,EAAMiC,EAAkBpF,OAAOsK,eAEhD,IAAIrC,EAAa9E,EAAMiC,EAAkBpF,OAAOuK,WAMxDnI,OAAOC,eAAeC,IAAI,cAC7BF,OAAOiI,eAAiBA,EACxBjI,OAAOC,eAAeE,OAAO,WAAY8H,IAG3C,MAAMG,UAAyBf,EAC7B3J,mBACE,MAAMwE,EAAStE,KAAKI,aAAa,UAC3B+C,EAAOnD,KAAKmD,KAClB,GAAKA,EAEL,MAAe,UAAXmB,EACK,IAAI2D,EAAa9E,EAAMiC,EAAkBpF,OAAOyK,iBAEhD,IAAIxC,EAAa9E,EAAMiC,EAAkBpF,OAAO+I,aAMxD3G,OAAOC,eAAeC,IAAI,gBAC7BF,OAAOoI,iBAAmBA,EAC1BpI,OAAOC,eAAeE,OAAO,aAAciI"}
3
+ =======
4
+ {"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"],"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"],"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"],"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,SAASC,eAAelB,EAASX,MAAMmB,aAAa,kBAAoB,IAEjF,OACJR,EAASY,iBAjJmCO,CAAiBpB,E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AQA,EAAIzG,QAAQ,oBACrB,OAEJ6G,EAAUnK,KADI4J,EAAK9G,QAAQiH,OAInClK,oBACI,IAAK,MAAMkK,KAAO/J,KAAKyC,iBAAiB,iCAC/BsH,EAAIZ,aAAa,kBAClBY,EAAIhI,aAAa,gBAAiB,SAEjCgI,EAAIZ,aAAa,cACwB,SAAtCY,EAAI9I,aAAa,iBACjB8I,EAAIhI,aAAa,WAAY,KAG7BgI,EAAIhI,aAAa,WAAY,QAMjD,SAASoI,EAAUC,EAAcF,GAC7B,MAAMN,EAAOQ,EAAa3H,iBAAiB,iCACrC4H,EAASD,EAAa3H,iBAAiB,qBACvC6H,EAAcV,EAAKM,GACnBK,EAAgBF,EAAOH,GAM7B,KALmBE,EAAa7G,cAAc,IAAIC,YAAY,uBAAwB,CAClFC,SAAS,EACT+G,YAAY,EACZC,OAAQ,CAAE9F,cAAe4F,MAE7B,CAEA,IAAK,MAAMR,KAAOH,EACdG,EAAIhI,aAAa,gBAAiB,SAClCgI,EAAIhI,aAAa,WAAY,MAEjC,IAAK,MAAM2I,KAASL,EAChBK,EAAM/G,QAAS,EACV+G,EAAMvB,aAAa,aAAgBuB,EAAMvB,aAAa,kCACvDuB,EAAM3I,aAAa,WAAY,KAGvCuI,EAAYvI,aAAa,gBAAiB,QAC1CuI,EAAYvI,aAAa,WAAY,KACrCuI,EAAYtH,QACZuH,EAAc5G,QAAS,EACvByG,EAAa7G,cAAc,IAAIC,YAAY,wBAAyB,CAChEC,SAAS,EACTgH,OAAQ,CAAE9F,cAAe4F,OAG5BxD,OAAO0C,eAAepE,IAAI,mBAC3B0B,OAAO4C,oBAAsBA,EAC7B5C,OAAO0C,eAAeC,OAAO,gBAAiBC"}
5
+ >>>>>>> add auto-complete-element dependency and rollup changes
@@ -0,0 +1,6 @@
1
+ <<<<<<< HEAD
2
+ class t extends HTMLElement{constructor(){super(),this.addEventListener("keydown",(t=>{const n=t.target;if(!(n instanceof HTMLElement))return;if("tab"!==n.getAttribute("role")&&!n.closest('[role="tablist"]'))return;const r=Array.from(this.querySelectorAll('[role="tablist"] [role="tab"]')),a=r.indexOf(r.find((t=>t.matches('[aria-selected="true"]'))));if("ArrowRight"===t.code){let t=a+1;t>=r.length&&(t=0),e(this,t)}else if("ArrowLeft"===t.code){let t=a-1;t<0&&(t=r.length-1),e(this,t)}else"Home"===t.code?(e(this,0),t.preventDefault()):"End"===t.code&&(e(this,r.length-1),t.preventDefault())})),this.addEventListener("click",(t=>{const n=Array.from(this.querySelectorAll('[role="tablist"] [role="tab"]'));if(!(t.target instanceof Element))return;const r=t.target.closest('[role="tab"]');if(!r||!r.closest('[role="tablist"]'))return;e(this,n.indexOf(r))}))}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 e(t,e){const n=t.querySelectorAll('[role="tablist"] [role="tab"]'),r=t.querySelectorAll('[role="tabpanel"]'),a=n[e],i=r[e];if(!!t.dispatchEvent(new CustomEvent("tab-container-change",{bubbles:!0,cancelable:!0,detail:{relatedTarget:i}}))){for(const t of n)t.setAttribute("aria-selected","false"),t.setAttribute("tabindex","-1");for(const t of r)t.hidden=!0,t.hasAttribute("tabindex")||t.hasAttribute("data-tab-container-no-tabstop")||t.setAttribute("tabindex","0");a.setAttribute("aria-selected","true"),a.setAttribute("tabindex","0"),a.focus(),i.hidden=!1,t.dispatchEvent(new CustomEvent("tab-container-changed",{bubbles:!0,detail:{relatedTarget:i}}))}}window.customElements.get("tab-container")||(window.TabContainerElement=t,window.customElements.define("tab-container",t));const n=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],r=["January","February","March","April","May","June","July","August","September","October","November","December"];function a(t){return"0".concat(t).slice(-2)}function i(t,e){const o=t.getDay(),s=t.getDate(),c=t.getMonth(),u=t.getFullYear(),l=t.getHours(),d=t.getMinutes(),m=t.getSeconds();return e.replace(/%([%aAbBcdeHIlmMpPSwyYZz])/g,(function(e){let h;switch(e[1]){case"%":return"%";case"a":return n[o].slice(0,3);case"A":return n[o];case"b":return r[c].slice(0,3);case"B":return r[c];case"c":return t.toString();case"d":return a(s);case"e":return String(s);case"H":return a(l);case"I":return a(i(t,"%l"));case"l":return String(0===l||12===l?12:(l+12)%12);case"m":return a(c+1);case"M":return a(d);case"p":return l>11?"PM":"AM";case"P":return l>11?"pm":"am";case"S":return a(m);case"w":return String(o);case"y":return a(u%100);case"Y":return String(u);case"Z":return h=t.toString().match(/\((\w+)\)$/),h?h[1]:"";case"z":return h=t.toString().match(/\w([+-]\d\d\d\d) /),h?h[1]:""}return""}))}function o(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 s=null;const c=o({day:"numeric",month:"short"});function u(){if(null!==s)return s;const t=c();if(t){const e=t.format(new Date(0));return s=!!e.match(/^\d/),s}return!1}let l=null;const d=o({day:"numeric",month:"short",year:"numeric"});function m(t){const e=t.closest("[lang]");return e instanceof HTMLElement&&e.lang?e.lang:"default"}const h=new WeakMap;class g 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 r=this.getFormattedTitle();if("datetime"===t){const t=Date.parse(n);isNaN(t)?h.delete(this):h.set(this,new Date(t))}const a=this.getFormattedTitle(),i=this.getAttribute("title");"title"===t||!a||i&&i!==r||this.setAttribute("title",a);const o=this.getFormattedDate();o&&(this.textContent=o)}get date(){return h.get(this)}getFormattedTitle(){const t=this.date;if(!t)return;const e=f();if(e)return e.format(t);try{return t.toLocaleString()}catch(e){if(e instanceof RangeError)return t.toString();throw e}}getFormattedDate(){}}const f=o({day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}),w=new WeakMap;class b extends g{attributeChangedCallback(t,e,n){"hour"!==t&&"minute"!==t&&"second"!==t&&"time-zone-name"!==t||w.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 r=u()?"weekday day month year":"weekday month day, year";for(const e in n){const a=n[e][t.getAttribute(e)];r=r.replace(e,a||"")}return r=r.replace(/(\s,)|(,\s$)/,""),i(e,r).replace(/\s+/," ").trim()}(this,t)||"",n=function(t,e){const n={},r=t.getAttribute("hour");"numeric"!==r&&"2-digit"!==r||(n.hour=r);const a=t.getAttribute("minute");"numeric"!==a&&"2-digit"!==a||(n.minute=a);const s=t.getAttribute("second");"numeric"!==s&&"2-digit"!==s||(n.second=s);const c=t.getAttribute("time-zone-name");"short"!==c&&"long"!==c||(n.timeZoneName=c);if(0===Object.keys(n).length)return;let u=w.get(t);u||(u=o(n),w.set(t,u));const l=u();if(l)return l.format(e);return i(e,n.second?"%H:%M:%S":"%H:%M")}(this,t)||"";return"".concat(e," ").concat(n).trim()}}window.customElements.get("local-time")||(window.LocalTimeElement=b,window.customElements.define("local-time",b));class y{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),r=Math.round(n/60),a=Math.round(r/24);return t>=0&&a<30?this.timeAgoFromMs(t):null}timeAhead(){const t=this.date.getTime()-(new Date).getTime(),e=Math.round(t/1e3),n=Math.round(e/60),r=Math.round(n/60),a=Math.round(r/24);return t>=0&&a<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),r=Math.round(n/60),a=Math.round(r/24),i=Math.round(a/30),o=Math.round(i/12);return t<0||e<10?M(this.locale,0,"second"):e<45?M(this.locale,-e,"second"):e<90||n<45?M(this.locale,-n,"minute"):n<90||r<24?M(this.locale,-r,"hour"):r<36||a<30?M(this.locale,-a,"day"):i<18?M(this.locale,-i,"month"):M(this.locale,-o,"year")}microTimeAgo(){const t=(new Date).getTime()-this.date.getTime(),e=Math.round(t/1e3),n=Math.round(e/60),r=Math.round(n/60),a=Math.round(r/24),i=Math.round(a/30),o=Math.round(i/12);return n<1?"1m":n<60?"".concat(n,"m"):r<24?"".concat(r,"h"):a<365?"".concat(a,"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),r=Math.round(n/60),a=Math.round(r/24),i=Math.round(a/30),o=Math.round(i/12);return i>=18||i>=12?M(this.locale,o,"year"):a>=45||a>=30?M(this.locale,i,"month"):r>=36||r>=24?M(this.locale,a,"day"):n>=90||n>=45?M(this.locale,r,"hour"):e>=90||e>=45?M(this.locale,n,"minute"):M(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),r=Math.round(n/60),a=Math.round(r/24),i=Math.round(a/30),o=Math.round(i/12);return a>=365?"".concat(o,"y"):r>=24?"".concat(a,"d"):n>=60?"".concat(r,"h"):n>1?"".concat(n,"m"):"1m"}formatDate(){let t=u()?"%e %b":"%b %e";var e;return e=this.date,(new Date).getUTCFullYear()!==e.getUTCFullYear()&&(t+=function(){if(null!==l)return l;const t=d();if(t){const e=t.format(new Date(0));return l=!!e.match(/\d,/),l}return!0}()?", %Y":" %Y"),i(this.date,t)}formatTime(){const t=A();return t?t.format(this.date):i(this.date,"%l:%M%P")}}function M(t,e,n){const r=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 r?r.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 A=o({hour:"numeric",minute:"2-digit"});class T extends g{getFormattedDate(){const t=this.date;if(t)return new y(t,m(this)).toString()}connectedCallback(){E.push(this),D||(p(),D=setInterval(p,6e4)),super.connectedCallback()}disconnectedCallback(){const t=E.indexOf(this);-1!==t&&E.splice(t,1),E.length||D&&(clearInterval(D),D=null)}}const E=[];let D;function p(){let t,e,n;for(e=0,n=E.length;e<n;e++)t=E[e],t.textContent=t.getFormattedDate()||""}window.customElements.get("relative-time")||(window.RelativeTimeElement=T,window.customElements.define("relative-time",T));class F extends T{getFormattedDate(){const t=this.getAttribute("format"),e=this.date;if(e)return"micro"===t?new y(e,m(this)).microTimeAgo():new y(e,m(this)).timeAgo()}}window.customElements.get("time-ago")||(window.TimeAgoElement=F,window.customElements.define("time-ago",F));class S extends T{getFormattedDate(){const t=this.getAttribute("format"),e=this.date;if(e)return"micro"===t?new y(e,m(this)).microTimeUntil():new y(e,m(this)).timeUntil()}}window.customElements.get("time-until")||(window.TimeUntilElement=S,window.customElements.define("time-until",S));
3
+ =======
4
+ 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 r=1===t?0:n.length-1;if(e&&o>=0){const e=o+t;e>=0&&e<n.length&&(r=e)}const a=n[r];if(a)for(const t of n)a===t?(this.input.setAttribute("aria-activedescendant",a.id),a.setAttribute("aria-selected","true"),s(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 s(t,e){(function(t,e){const n=t.scrollTop,i=n+t.clientHeight,s=e.offsetTop,o=s+e.clientHeight;return s>=n&&o<=i})(t,e)||(t.scrollTop=e.offsetTop)}class o extends CustomEvent{constructor(t,e){super(t,e),this.relatedTarget=e.relatedTarget}}const r=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=r.get(t);n&&n.abort();r.set(t,e);const i=()=>r.delete(t),s=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 s.then(i,i),s}(t,n)}class u{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 l=new WeakMap;class c 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&&(l.set(this,new u(this,e,n)),n.setAttribute("role","listbox"))}disconnectedCallback(){const t=l.get(this);t&&(t.destroy(),l.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=l.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}))}}}window.customElements.get("auto-complete")||(window.AutocompleteElement=c,window.customElements.define("auto-complete",c));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"]'),s=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");s.setAttribute("aria-selected","true"),s.setAttribute("tabindex","0"),s.focus(),o.hidden=!1,t.dispatchEvent(new CustomEvent("tab-container-changed",{bubbles:!0,detail:{relatedTarget:o}}))}}window.customElements.get("tab-container")||(window.TabContainerElement=h,window.customElements.define("tab-container",h));
5
+ >>>>>>> add auto-complete-element dependency and rollup changes
6
+ //# sourceMappingURL=primer_view_components.js.map
@@ -0,0 +1 @@
1
+ import '@github/auto-complete-element';
@@ -5,6 +5,8 @@ module Primer
5
5
  # Use the default round avatar for users, and the `square` argument
6
6
  # for organizations or any other non-human avatars.
7
7
  class AvatarComponent < Primer::Component
8
+ status :beta
9
+
8
10
  SMALL_THRESHOLD = 24
9
11
 
10
12
  # @example Default
@@ -49,9 +51,5 @@ module Primer
49
51
  render(Primer::BaseComponent.new(**@system_arguments)) { content }
50
52
  end
51
53
  end
52
-
53
- def self.status
54
- Primer::Component::STATUSES[:beta]
55
- end
56
54
  end
57
55
  end
@@ -3,7 +3,7 @@
3
3
  module Primer
4
4
  # All Primer ViewComponents accept a standard set of options called system arguments, mimicking the [styled-system API](https://styled-system.com/table) used by [Primer React](https://primer.style/components/system-props).
5
5
  #
6
- # Under the hood, system arguments are [mapped](https://github.com/primer/view_components/blob/main/lib/primer/classify.rb) to Primer CSS classes, with any remaining options passed to Rails' [`content_tag`](https://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-content_tag).
6
+ # Under the hood, system arguments are [mapped](https://github.com/primer/view_components/blob/main/app/lib/primer/classify.rb) to Primer CSS classes, with any remaining options passed to Rails' [`content_tag`](https://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-content_tag).
7
7
  #
8
8
  # ## Responsive values
9
9
  #
@@ -37,7 +37,10 @@ module Primer
37
37
  # | `style` | `String` | Inline styles. |
38
38
  # | `hidden` | `Boolean` | Whether to assign the `hidden` attribute. |
39
39
  class BaseComponent < Primer::Component
40
- TEST_SELECTOR_TAG = :test_selector
40
+ status :beta
41
+
42
+ include TestSelectorHelper
43
+
41
44
  # @param test_selector [String] Adds `data-test-selector='given value'` in non-Production environments for testing purposes.
42
45
  #
43
46
  # @param m [Integer] Margin. <%= one_of((-6..6).to_a) %>
@@ -118,16 +121,5 @@ module Primer
118
121
  def call
119
122
  content_tag(@tag, content, @content_tag_args.merge(@result))
120
123
  end
121
-
122
- private
123
-
124
- def add_test_selector(args)
125
- if args.key?(TEST_SELECTOR_TAG) && !Rails.env.production?
126
- args[:data] ||= {}
127
- args[:data][TEST_SELECTOR_TAG] = args[TEST_SELECTOR_TAG]
128
- end
129
-
130
- args.except(TEST_SELECTOR_TAG)
131
- end
132
124
  end
133
125
  end
@@ -3,6 +3,8 @@
3
3
  module Primer
4
4
  # Use Primer::BlankslateComponent when there is a lack of content within a page or section. Use as placeholder to tell users why something isn't there.
5
5
  class BlankslateComponent < Primer::Component
6
+ status :beta
7
+
6
8
  include ViewComponent::SlotableV2
7
9
 
8
10
  # Optional Spinner.
@@ -3,6 +3,8 @@
3
3
  module Primer
4
4
  # BorderBox is a Box component with a border.
5
5
  class BorderBoxComponent < Primer::Component
6
+ status :beta
7
+
6
8
  include ViewComponent::SlotableV2
7
9
 
8
10
  # Optional Header.
@@ -88,9 +90,5 @@ module Primer
88
90
  def render?
89
91
  rows.any? || header.present? || body.present? || footer.present?
90
92
  end
91
-
92
- def self.status
93
- Primer::Component::STATUSES[:beta]
94
- end
95
93
  end
96
94
  end
@@ -3,6 +3,8 @@
3
3
  module Primer
4
4
  # A basic wrapper component for most layout related needs.
5
5
  class BoxComponent < Primer::Component
6
+ status :stable
7
+
6
8
  # @example Default
7
9
  # <%= render(Primer::BoxComponent.new) { "Your content here" } %>
8
10
  #
@@ -18,9 +20,5 @@ module Primer
18
20
  def call
19
21
  render(Primer::BaseComponent.new(**@system_arguments)) { content }
20
22
  end
21
-
22
- def self.status
23
- Primer::Component::STATUSES[:stable]
24
- end
25
23
  end
26
24
  end
@@ -1,8 +1,7 @@
1
1
  <%= render Primer::BaseComponent.new(**@system_arguments) do %>
2
2
  <ol>
3
3
  <% items.each do |item| %>
4
- <%# The <li> and <a> need to be on the same line to prevent unwanted whitespace %>
5
- <%= render Primer::BaseComponent.new(**item.system_arguments) do %><%- if item.href.present? %><a href="<%= item.href %>"><%= item.content %></a><%- else %><%= item.content %><%- end %><%- end %>
4
+ <%= item %>
6
5
  <% end %>
7
6
  </ol>
8
7
  <% end %>
@@ -3,15 +3,21 @@
3
3
  module Primer
4
4
  # Use breadcrumbs to display page hierarchy within a section of the site. All of the items in the breadcrumb "trail" are links except for the final item, which is a plain string indicating the current page.
5
5
  class BreadcrumbComponent < Primer::Component
6
- include ViewComponent::Slotable
6
+ include ViewComponent::SlotableV2
7
+ status :beta
7
8
 
8
- with_slot :item, collection: true, class_name: "BreadcrumbItem"
9
+ # _Note: if both `href` and `selected: true` are passed in, `href` will be ignored and the item will not be rendered as a link._
10
+ #
11
+ # @param href [String] The URL to link to.
12
+ # @param selected [Boolean] Whether or not the item is selected and not rendered as a link.
13
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
14
+ renders_many :items, "ItemComponent"
9
15
 
10
16
  # @example Basic
11
17
  # <%= render(Primer::BreadcrumbComponent.new) do |component| %>
12
- # <% component.slot(:item, href: "/") do %>Home<% end %>
13
- # <% component.slot(:item, href: "/about") do %>About<% end %>
14
- # <% component.slot(:item, selected: true) do %>Team<% end %>
18
+ # <% component.item(href: "/") do %>Home<% end %>
19
+ # <% component.item(href: "/about") do %>About<% end %>
20
+ # <% component.item(selected: true) do %>Team<% end %>
15
21
  # <% end %>
16
22
  #
17
23
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
@@ -25,13 +31,9 @@ module Primer
25
31
  items.any?
26
32
  end
27
33
 
28
- # _Note: if both `href` and `selected: true` are passed in, `href` will be ignored and the item will not be rendered as a link._
29
- class BreadcrumbItem < Primer::Slot
30
- attr_reader :href, :system_arguments
31
-
32
- # @param href [String] The URL to link to.
33
- # @param selected [Boolean] Whether or not the item is selected and not rendered as a link.
34
- # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
34
+ # This component is part of `Primer::BreadcrumbComponent` and should not be
35
+ # used as a standalone component.
36
+ class ItemComponent < Primer::Component
35
37
  def initialize(href: nil, selected: false, **system_arguments)
36
38
  @href = href
37
39
  @system_arguments = system_arguments
@@ -41,6 +43,16 @@ module Primer
41
43
  @system_arguments[:"aria-current"] = "page" if selected
42
44
  @system_arguments[:classes] = "breadcrumb-item #{@system_arguments[:classes]}"
43
45
  end
46
+
47
+ def call
48
+ render(Primer::BaseComponent.new(**@system_arguments)) do
49
+ if @href.present?
50
+ render(Primer::LinkComponent.new(href: @href)) { content }
51
+ else
52
+ content
53
+ end
54
+ end
55
+ end
44
56
  end
45
57
  end
46
58
  end
@@ -9,19 +9,8 @@ module Primer
9
9
  include FetchOrFallbackHelper
10
10
  include OcticonsHelper
11
11
  include JoinStyleArgumentsHelper
12
- include ViewHelper::DSL
12
+ include ViewHelper::Dsl
13
13
  include ViewHelper
14
-
15
- # sourced from https://primer.style/doctocat/usage/front-matter#status
16
- STATUSES = {
17
- alpha: :alpha,
18
- beta: :beta,
19
- stable: :stable,
20
- deprecated: :deprecated
21
- }.freeze
22
-
23
- def self.status
24
- STATUSES[:alpha]
25
- end
14
+ include Status::Dsl
26
15
  end
27
16
  end
@@ -3,6 +3,8 @@
3
3
  module Primer
4
4
  # Use Primer::CounterComponent to add a count to navigational elements and buttons.
5
5
  class CounterComponent < Primer::Component
6
+ status :beta
7
+
6
8
  DEFAULT_SCHEME = :default
7
9
  SCHEME_MAPPINGS = {
8
10
  DEFAULT_SCHEME => "Counter",
@@ -51,10 +53,6 @@ module Primer
51
53
  render(Primer::BaseComponent.new(**@system_arguments)) { value }
52
54
  end
53
55
 
54
- def self.status
55
- Primer::Component::STATUSES[:beta]
56
- end
57
-
58
56
  private
59
57
 
60
58
  def title
@@ -16,12 +16,11 @@ module Primer
16
16
  #
17
17
  # @param button [Boolean] Whether to render the Summary as a button or not.
18
18
  # @param kwargs [Hash] The same arguments as <%= link_to_system_arguments_docs %>.
19
- renders_one :summary, lambda { |button = true, **system_arguments|
20
- system_arguments = system_arguments
19
+ renders_one :summary, lambda { |button: true, **system_arguments|
21
20
  system_arguments[:tag] = :summary
22
21
  system_arguments[:role] = "button"
23
22
 
24
- Primer::BaseComponent.new(**system_arguments) unless button
23
+ return Primer::BaseComponent.new(**system_arguments) unless button
25
24
 
26
25
  Primer::ButtonComponent.new(**system_arguments)
27
26
  }
@@ -5,6 +5,8 @@ module Primer
5
5
  # They're great for instances where you don't need the full power (and code)
6
6
  # of the select menu.
7
7
  class DropdownMenuComponent < Primer::Component
8
+ status :deprecated
9
+
8
10
  SCHEME_DEFAULT = :default
9
11
  SCHEME_MAPPINGS = {
10
12
  SCHEME_DEFAULT => "",
@@ -14,10 +16,6 @@ module Primer
14
16
  DIRECTION_DEFAULT = :se
15
17
  DIRECTION_OPTIONS = [DIRECTION_DEFAULT, :sw, :w, :e, :ne, :s].freeze
16
18
 
17
- def self.status
18
- STATUSES[:deprecated]
19
- end
20
-
21
19
  # @example With a header
22
20
  # <div>
23
21
  # <%= render(Primer::DetailsComponent.new(overlay: :default, reset: true, position: :relative)) do |c| %>
@@ -3,6 +3,8 @@
3
3
  module Primer
4
4
  # Use the Flash component to inform users of successful or pending actions.
5
5
  class FlashComponent < Primer::Component
6
+ status :beta
7
+
6
8
  include ViewComponent::SlotableV2
7
9
 
8
10
  # Optional action content showed on the right side of the component.
@@ -64,9 +66,5 @@ module Primer
64
66
  )
65
67
  @system_arguments[:mb] ||= spacious ? 4 : nil
66
68
  end
67
-
68
- def self.status
69
- Primer::Component::STATUSES[:beta]
70
- end
71
69
  end
72
70
  end
@@ -3,30 +3,19 @@
3
3
  module Primer
4
4
  # Use labels to add contextual metadata to a design.
5
5
  class LabelComponent < Primer::Component
6
- NEW_SCHEME_MAPPINGS = {
6
+ status :beta
7
+
8
+ SCHEME_MAPPINGS = {
7
9
  primary: "Label--primary",
8
10
  secondary: "Label--secondary",
9
11
  info: "Label--info",
10
12
  success: "Label--success",
11
13
  warning: "Label--warning",
12
- danger: "Label--danger"
13
- }.freeze
14
-
15
- DEPRECATED_SCHEME_MAPPINGS = {
16
- gray: "Label--gray",
17
- dark_gray: "Label--gray-darker",
18
- yellow: "Label--yellow",
14
+ danger: "Label--danger",
15
+ # deprecated
19
16
  orange: "Label--orange",
20
- red: "Label--red",
21
- green: "Label--green",
22
- blue: "Label--blue",
23
- purple: "Label--purple",
24
- pink: "Label--pink",
25
- outline: "Label--outline",
26
- green_outline: "Label--outline-green"
17
+ purple: "Label--purple"
27
18
  }.freeze
28
-
29
- SCHEME_MAPPINGS = NEW_SCHEME_MAPPINGS.merge(DEPRECATED_SCHEME_MAPPINGS)
30
19
  SCHEME_OPTIONS = SCHEME_MAPPINGS.keys << nil
31
20
 
32
21
  VARIANT_MAPPINGS = {
@@ -36,19 +25,24 @@ module Primer
36
25
  VARIANT_OPTIONS = VARIANT_MAPPINGS.keys << nil
37
26
 
38
27
  # @example Schemes
39
- # <%= render(Primer::LabelComponent.new(title: "Label: Label")) { "default" } %>
40
- # <%= render(Primer::LabelComponent.new(title: "Label: Label", scheme: :gray)) { "gray" } %>
41
- # <%= render(Primer::LabelComponent.new(title: "Label: Label", scheme: :dark_gray)) { "dark_gray" } %>
42
- # <%= render(Primer::LabelComponent.new(title: "Label: Label", scheme: :yellow)) { "yellow" } %>
43
- # <%= render(Primer::LabelComponent.new(title: "Label: Label", scheme: :green)) { "green" } %>
44
- # <%= render(Primer::LabelComponent.new(title: "Label: Label", scheme: :purple)) { "purple" } %>
28
+ # <%= render(Primer::LabelComponent.new(title: "Label: Label")) { "Default" } %>
29
+ # <%= render(Primer::LabelComponent.new(title: "Label: Label", scheme: :primary)) { "Primary" } %>
30
+ # <%= render(Primer::LabelComponent.new(title: "Label: Label", scheme: :secondary)) { "Secondary" } %>
31
+ # <%= render(Primer::LabelComponent.new(title: "Label: Label", scheme: :info)) { "Info" } %>
32
+ # <%= render(Primer::LabelComponent.new(title: "Label: Label", scheme: :success)) { "Success" } %>
33
+ # <%= render(Primer::LabelComponent.new(title: "Label: Label", scheme: :warning)) { "Warning" } %>
34
+ # <%= render(Primer::LabelComponent.new(title: "Label: Label", scheme: :danger)) { "Danger" } %>
45
35
  #
46
36
  # @example Variants
47
37
  # <%= render(Primer::LabelComponent.new(title: "Label: Label")) { "Default" } %>
48
38
  # <%= render(Primer::LabelComponent.new(title: "Label: Label", variant: :large)) { "Large" } %>
49
39
  #
40
+ # @example Deprecated schemes
41
+ # <%= render(Primer::LabelComponent.new(title: "Label: Label", scheme: :orange)) { "Orange" } %>
42
+ # <%= render(Primer::LabelComponent.new(title: "Label: Label", scheme: :purple)) { "Purple" } %>
43
+ #
50
44
  # @param title [String] `title` attribute for the component element.
51
- # @param scheme [Symbol] <%= one_of(Primer::LabelComponent::DEPRECATED_SCHEME_MAPPINGS.keys) %>
45
+ # @param scheme [Symbol] <%= one_of(Primer::LabelComponent::SCHEME_MAPPINGS.keys) %>
52
46
  # @param variant [Symbol] <%= one_of(Primer::LabelComponent::VARIANT_OPTIONS) %>
53
47
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
54
48
  def initialize(title:, scheme: nil, variant: nil, **system_arguments)