jekyll-theme-rop 2.1.15

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 (67) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +1084 -0
  4. data/_config.yml +89 -0
  5. data/_data/placeholder.yml +0 -0
  6. data/_includes/_nav-item.html +38 -0
  7. data/_includes/_post-meta.html +24 -0
  8. data/_includes/external-link.html +59 -0
  9. data/_includes/featured_posts.html +11 -0
  10. data/_includes/featured_software.html +55 -0
  11. data/_includes/featured_specs.html +31 -0
  12. data/_includes/head.html +9 -0
  13. data/_includes/home-hero.html +27 -0
  14. data/_includes/home-hub.html +81 -0
  15. data/_includes/home-project.html +19 -0
  16. data/_includes/index-page-hero.html +3 -0
  17. data/_includes/index-page-item-filter.html +83 -0
  18. data/_includes/item-doc-page.html +138 -0
  19. data/_includes/item-external-links.html +5 -0
  20. data/_includes/legal.html +24 -0
  21. data/_includes/logo.html +1 -0
  22. data/_includes/nav-links.html +45 -0
  23. data/_includes/nav-page-link.html +17 -0
  24. data/_includes/post-author-pic.html +13 -0
  25. data/_includes/post-card.html +59 -0
  26. data/_includes/project-doc-page.html +0 -0
  27. data/_includes/project-nav.html +0 -0
  28. data/_includes/scripts.html +0 -0
  29. data/_includes/social-links.html +23 -0
  30. data/_includes/software-card-hub.html +45 -0
  31. data/_includes/software-symbol.html +6 -0
  32. data/_includes/symbol.svg +19 -0
  33. data/_includes/tag-list.html +17 -0
  34. data/_includes/title.html +1 -0
  35. data/_layouts/blog-index.html +19 -0
  36. data/_layouts/default.html +156 -0
  37. data/_layouts/docs-base.html +87 -0
  38. data/_layouts/home.html +13 -0
  39. data/_layouts/page.html +5 -0
  40. data/_layouts/post.html +57 -0
  41. data/_layouts/product.html +9 -0
  42. data/_layouts/project-index.html +45 -0
  43. data/_layouts/software-index.html +31 -0
  44. data/_layouts/spec-index.html +31 -0
  45. data/_layouts/spec.html +6 -0
  46. data/_pages/blog.html +8 -0
  47. data/_pages/software.html +6 -0
  48. data/_pages/specs.html +6 -0
  49. data/_sass/headroom.scss +22 -0
  50. data/_sass/jekyll-theme-open-project.scss +2 -0
  51. data/_sass/jekyll-theme-rop.scss +798 -0
  52. data/_sass/normalize.scss +424 -0
  53. data/_sass/rop-base.scss +572 -0
  54. data/_sass/rop-header-footer.scss +366 -0
  55. data/_sass/rop-mixins.scss +871 -0
  56. data/assets/css/style.scss +13 -0
  57. data/assets/fa/fa-brands.js +456 -0
  58. data/assets/fa/fa-solid.js +915 -0
  59. data/assets/fa/fontawesome.js +1805 -0
  60. data/assets/img/external-link.svg +4 -0
  61. data/assets/js/adoc-toc.js +175 -0
  62. data/assets/js/anchor-scroll.js +81 -0
  63. data/assets/js/clipboard.min.js +7 -0
  64. data/assets/js/headroom.min.js +7 -0
  65. data/assets/js/opf.js +289 -0
  66. data/assets/listing-widget.js +19 -0
  67. metadata +276 -0
@@ -0,0 +1,4 @@
1
+ <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M8.7 0H1.7V2H6.3L0 8.3L1.4 9.7L7.7 3.4V8H9.7V1C9.7 0.4 9.3 0 8.7 0Z" transform="translate(12.6001) scale(2)" fill="#FF6357"/>
3
+ <path d="M14 15H1C0.4 15 0 14.6 0 14V1C0 0.4 0.4 0 1 0H5V2H2V13H13V10H15V14C15 14.6 14.6 15 14 15Z" transform="translate(0 2) scale(2)" fill="#FF6357"/>
4
+ </svg>
@@ -0,0 +1,175 @@
1
+ (function () {
2
+
3
+ const HEADER_TAGS = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
4
+ const IN_PAGE_NAV_HTML_CLASS = 'in-page-toc';
5
+ const SCROLLABLE_NAV_CONTAINER_SELECTOR = 'ul.nav-items';
6
+
7
+ /* Given a container of AsciiDoc .sectN elementss,
8
+ * returns an object containing navigation structure like this:
9
+ * { items: [ { title: "Some title", path: "./#some-title", items: [ ...subitems ] }, ... }
10
+ * Works recursively through nested sections.
11
+ */
12
+ function getAdocTocItems(containerEl, sectLvl) {
13
+ sectLvl = sectLvl || 1;
14
+ var items = [];
15
+
16
+ const topLevelSections = Array.from(containerEl.children).filter((el) => {
17
+ return el.matches(`div.sect${sectLvl}`);
18
+ });
19
+
20
+ for (let sectionEl of topLevelSections) {
21
+ const headerEl = Array.from(sectionEl.children).filter((el) => {
22
+ for (let hTagName of HEADER_TAGS) {
23
+ if (el.matches(hTagName)) { return true; }
24
+ }
25
+ return false;
26
+ })[0];
27
+ const headerId = headerEl.getAttribute('id');
28
+
29
+ var subItems = [];
30
+ const sectionBody = sectionEl.querySelector('div.sectionbody');
31
+ if (sectionBody) {
32
+ subItems = getAdocTocItems(sectionBody, sectLvl + 1);
33
+ } else {
34
+ subItems = getAdocTocItems(sectionEl, sectLvl + 1);
35
+ }
36
+
37
+ items.push({
38
+ title: headerEl.innerText,
39
+ description: headerEl.innerText,
40
+ path: `./#${headerId}`,
41
+ items: subItems,
42
+
43
+ id: headerId,
44
+ });
45
+ }
46
+
47
+ return items;
48
+ }
49
+
50
+ function highlightSelected(headerId, itemPath) {
51
+ let selectedItemEl;
52
+
53
+ for (const itemEl of document.querySelectorAll(`.${IN_PAGE_NAV_HTML_CLASS} li`)) {
54
+ const link = (itemEl.firstChild || {}).firstChild;
55
+ if (link && link.getAttribute('href') == itemPath) {
56
+ itemEl.classList.add('highlighted');
57
+ selectedItemEl = itemEl;
58
+ } else {
59
+ itemEl.classList.remove('highlighted');
60
+ }
61
+ }
62
+ for (const hTag of HEADER_TAGS) {
63
+ for (const headerEl of document.querySelectorAll(hTag)) {
64
+ headerEl.classList.remove('highlighted');
65
+ }
66
+ }
67
+ const selectedHeaderEl = document.getElementById(headerId);
68
+ selectedHeaderEl.classList.add('highlighted');
69
+
70
+ return selectedItemEl;
71
+ }
72
+
73
+ /* Given a list of navigation items, returns an <ul> containing items recursively
74
+ * with CSS classes and layout consistent with docs navigation markup expected by the theme.
75
+ */
76
+ function formatSubItems(tocItems) {
77
+ const subItemContainer = document.createElement('ul');
78
+
79
+ subItemContainer.classList.add('nav-items');
80
+ subItemContainer.classList.add('subitems');
81
+
82
+ for (let item of tocItems) {
83
+ let itemEl, itemTitleEl, itemLinkEl;
84
+
85
+ itemEl = document.createElement('li');
86
+ itemEl.classList.add('item');
87
+
88
+ itemTitleEl = document.createElement('div');
89
+ itemTitleEl.classList.add('item-title');
90
+
91
+ itemLinkEl = document.createElement('a');
92
+ itemLinkEl.setAttribute('href', item.path);
93
+ itemLinkEl.setAttribute('title', item.title);
94
+ itemLinkEl.innerText = item.title;
95
+
96
+ itemTitleEl.appendChild(itemLinkEl);
97
+ itemEl.appendChild(itemTitleEl);
98
+
99
+ if (item.items.length > 0) {
100
+ itemEl.appendChild(formatSubItems(item.items));
101
+ }
102
+
103
+ itemLinkEl.addEventListener('click', () => highlightSelected(item.id, item.path));
104
+
105
+ subItemContainer.appendChild(itemEl);
106
+ }
107
+
108
+ return subItemContainer;
109
+ }
110
+
111
+ const articleBody = document.querySelector('main section article .body');
112
+ const selectedItem = document.querySelector('main .docs-nav .nav-items li.selected');
113
+
114
+ if (articleBody && selectedItem) {
115
+ const items = getAdocTocItems(articleBody);
116
+
117
+ if (items.length > 0) {
118
+ const ulEl = formatSubItems(items);
119
+ ulEl.classList.add(IN_PAGE_NAV_HTML_CLASS);
120
+
121
+ const existingSubItems = selectedItem.querySelector('ul.nav-items');
122
+ if (existingSubItems) {
123
+ selectedItem.insertBefore(ulEl, existingSubItems);
124
+ } else {
125
+ selectedItem.appendChild(ulEl);
126
+ }
127
+ }
128
+ }
129
+
130
+ if (articleBody && window.location.hash) {
131
+ // Do things that need to be done if the page was opened
132
+ // with hash component in address bar.
133
+ // - After initial scroll to anchor, scroll up a bit
134
+ // to ensure header is in view accounting for top bar.
135
+ // - Select in-page doc nav item corresponding to the hash.
136
+
137
+ const SCROLL_COMPENSATION_AMOUNT_PX = 0 - document.querySelector('body > .underlay.header > header').offsetHeight - 10;
138
+
139
+ function _scrollUp(evt) {
140
+ window.scrollBy(0, SCROLL_COMPENSATION_AMOUNT_PX);
141
+ window.removeEventListener('scroll', _scrollUp);
142
+ };
143
+
144
+ function _selectInitialItem() {
145
+ const hash = window.location.hash.substring(1);
146
+ const anchorEl = document.getElementById(hash);
147
+
148
+ var selectedLinkId;
149
+
150
+ if (anchorEl.tagName === 'A') {
151
+ // We were selected by <a> anchor, not by <hX[id]>.
152
+ // We want to highlight selected item in the nav
153
+ // according to the nearest header upwards from anchor.
154
+ var curEl = anchorEl;
155
+ while (true) {
156
+ var curEl = curEl.parentNode;
157
+ var nearestHeaderEl = curEl.querySelector('h2');
158
+ if (nearestHeaderEl && nearestHeaderEl.hasAttribute('id')) {
159
+ selectedLinkId = nearestHeaderEl.getAttribute('id');
160
+ break;
161
+ }
162
+ }
163
+ } else {
164
+ selectedLinkId = hash;
165
+ }
166
+
167
+ const selectedItemEl = highlightSelected(selectedLinkId, `./#${selectedLinkId}`);
168
+ window.setTimeout(function () { selectedItemEl.scrollIntoView(); }, 200);
169
+ };
170
+
171
+ _selectInitialItem();
172
+ window.addEventListener('scroll', _scrollUp);
173
+ }
174
+
175
+ }());
@@ -0,0 +1,81 @@
1
+ /* Credit: Ian Clark https://stackoverflow.com/a/13067009/247441 */
2
+
3
+ (function(document, history, location) {
4
+ var HISTORY_SUPPORT = !!(history && history.pushState);
5
+
6
+ var anchorScrolls = {
7
+ ANCHOR_REGEX: /^#[^ ]+$/,
8
+ OFFSET_HEIGHT_PX: 150, // Roughly Metanorma’s header
9
+
10
+ /**
11
+ * Establish events, and fix initial scroll position if a hash is provided.
12
+ */
13
+ init: function() {
14
+ this.scrollToCurrent();
15
+ window.addEventListener('hashchange', this.scrollToCurrent.bind(this));
16
+ document.body.addEventListener('click', this.delegateAnchors.bind(this));
17
+ },
18
+
19
+ /**
20
+ * Return the offset amount to deduct from the normal scroll position.
21
+ * Modify as appropriate to allow for dynamic calculations
22
+ */
23
+ getFixedOffset: function() {
24
+ return this.OFFSET_HEIGHT_PX;
25
+ },
26
+
27
+ /**
28
+ * If the provided href is an anchor which resolves to an element on the
29
+ * page, scroll to it.
30
+ * @param {String} href
31
+ * @return {Boolean} - Was the href an anchor.
32
+ */
33
+ scrollIfAnchor: function(href, pushToHistory) {
34
+ var match, rect, anchorOffset;
35
+
36
+ if(!this.ANCHOR_REGEX.test(href)) {
37
+ return false;
38
+ }
39
+
40
+ match = document.getElementById(href.slice(1));
41
+
42
+ if(match) {
43
+ rect = match.getBoundingClientRect();
44
+ anchorOffset = window.pageYOffset + rect.top - this.getFixedOffset();
45
+ window.scrollTo(window.pageXOffset, anchorOffset);
46
+
47
+ // Add the state to history as-per normal anchor links
48
+ if(HISTORY_SUPPORT && pushToHistory) {
49
+ history.pushState({}, document.title, location.pathname + href);
50
+ }
51
+ }
52
+
53
+ return !!match;
54
+ },
55
+
56
+ /**
57
+ * Attempt to scroll to the current location's hash.
58
+ */
59
+ scrollToCurrent: function() {
60
+ this.scrollIfAnchor(window.location.hash);
61
+ },
62
+
63
+ /**
64
+ * If the click event's target was an anchor, fix the scroll position.
65
+ */
66
+ delegateAnchors: function(e) {
67
+ var elem = e.target;
68
+
69
+ if(
70
+ elem.nodeName === 'A' &&
71
+ this.scrollIfAnchor(elem.getAttribute('href'), true)
72
+ ) {
73
+ e.preventDefault();
74
+ }
75
+ }
76
+ };
77
+
78
+ window.addEventListener(
79
+ 'DOMContentLoaded', anchorScrolls.init.bind(anchorScrolls)
80
+ );
81
+ })(window.document, window.history, window.location);
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * clipboard.js v2.0.4
3
+ * https://zenorocha.github.io/clipboard.js
4
+ *
5
+ * Licensed MIT © Zeno Rocha
6
+ */
7
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return function(n){var o={};function r(t){if(o[t])return o[t].exports;var e=o[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}return r.m=n,r.c=o,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function o(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}}(),a=o(n(1)),c=o(n(3)),u=o(n(4));function o(t){return t&&t.__esModule?t:{default:t}}var l=function(t){function o(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(o.__proto__||Object.getPrototypeOf(o)).call(this));return n.resolveOptions(e),n.listenClick(t),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(o,c.default),i(o,[{key:"resolveOptions",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===r(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=(0,u.default)(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new a.default({action:this.action(e),target:this.target(e),text:this.text(e),container:this.container,trigger:e,emitter:this})}},{key:"defaultAction",value:function(t){return s("action",t)}},{key:"defaultTarget",value:function(t){var e=s("target",t);if(e)return document.querySelector(e)}},{key:"defaultText",value:function(t){return s("text",t)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:["copy","cut"],e="string"==typeof t?[t]:t,n=!!document.queryCommandSupported;return e.forEach(function(t){n=n&&!!document.queryCommandSupported(t)}),n}}]),o}();function s(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}t.exports=l},function(t,e,n){"use strict";var o,r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function o(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}}(),a=n(2),c=(o=a)&&o.__esModule?o:{default:o};var u=function(){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.resolveOptions(t),this.initSelection()}return i(e,[{key:"resolveOptions",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.container=t.container,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var t=this,e="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px";var n=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=n+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,c.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=(0,c.default)(this.target),this.copyText()}},{key:"copyText",value:function(){var e=void 0;try{e=document.execCommand(this.action)}catch(t){e=!1}this.handleResult(e)}},{key:"handleResult",value:function(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(t){if(void 0!==t){if(!t||"object"!==(void 0===t?"undefined":r(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function(){return this._target}}]),e}();t.exports=u},function(t,e){t.exports=function(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var o=window.getSelection(),r=document.createRange();r.selectNodeContents(t),o.removeAllRanges(),o.addRange(r),e=o.toString()}return e}},function(t,e){function n(){}n.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var o=this;function r(){o.off(t,r),e.apply(n,arguments)}return r._=e,this.on(t,r,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=n.length;o<r;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],r=[];if(o&&e)for(var i=0,a=o.length;i<a;i++)o[i].fn!==e&&o[i].fn._!==e&&r.push(o[i]);return r.length?n[t]=r:delete n[t],this}},t.exports=n},function(t,e,n){var d=n(5),h=n(6);t.exports=function(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!d.string(e))throw new TypeError("Second argument must be a String");if(!d.fn(n))throw new TypeError("Third argument must be a Function");if(d.node(t))return s=e,f=n,(l=t).addEventListener(s,f),{destroy:function(){l.removeEventListener(s,f)}};if(d.nodeList(t))return a=t,c=e,u=n,Array.prototype.forEach.call(a,function(t){t.addEventListener(c,u)}),{destroy:function(){Array.prototype.forEach.call(a,function(t){t.removeEventListener(c,u)})}};if(d.string(t))return o=t,r=e,i=n,h(document.body,o,r,i);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList");var o,r,i,a,c,u,l,s,f}},function(t,n){n.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},n.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||n.node(t[0]))},n.string=function(t){return"string"==typeof t||t instanceof String},n.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},function(t,e,n){var a=n(7);function i(t,e,n,o,r){var i=function(e,n,t,o){return function(t){t.delegateTarget=a(t.target,n),t.delegateTarget&&o.call(e,t)}}.apply(this,arguments);return t.addEventListener(n,i,r),{destroy:function(){t.removeEventListener(n,i,r)}}}t.exports=function(t,e,n,o,r){return"function"==typeof t.addEventListener?i.apply(null,arguments):"function"==typeof n?i.bind(null,document).apply(null,arguments):("string"==typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,function(t){return i(t,e,n,o,r)}))}},function(t,e){if("undefined"!=typeof Element&&!Element.prototype.matches){var n=Element.prototype;n.matches=n.matchesSelector||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector}t.exports=function(t,e){for(;t&&9!==t.nodeType;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}}])});
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * headroom.js v0.9.4 - Give your page some headroom. Hide your header until you need it
3
+ * Copyright (c) 2017 Nick Williams - http://wicky.nillia.ms/headroom.js
4
+ * License: MIT
5
+ */
6
+
7
+ !function(a,b){"use strict";"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?module.exports=b():a.Headroom=b()}(this,function(){"use strict";function a(a){this.callback=a,this.ticking=!1}function b(a){return a&&"undefined"!=typeof window&&(a===window||a.nodeType)}function c(a){if(arguments.length<=0)throw new Error("Missing arguments in extend function");var d,e,f=a||{};for(e=1;e<arguments.length;e++){var g=arguments[e]||{};for(d in g)"object"!=typeof f[d]||b(f[d])?f[d]=f[d]||g[d]:f[d]=c(f[d],g[d])}return f}function d(a){return a===Object(a)?a:{down:a,up:a}}function e(a,b){b=c(b,e.options),this.lastKnownScrollY=0,this.elem=a,this.tolerance=d(b.tolerance),this.classes=b.classes,this.offset=b.offset,this.scroller=b.scroller,this.initialised=!1,this.onPin=b.onPin,this.onUnpin=b.onUnpin,this.onTop=b.onTop,this.onNotTop=b.onNotTop,this.onBottom=b.onBottom,this.onNotBottom=b.onNotBottom}var f={bind:!!function(){}.bind,classList:"classList"in document.documentElement,rAF:!!(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame)};return window.requestAnimationFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame,a.prototype={constructor:a,update:function(){this.callback&&this.callback(),this.ticking=!1},requestTick:function(){this.ticking||(requestAnimationFrame(this.rafCallback||(this.rafCallback=this.update.bind(this))),this.ticking=!0)},handleEvent:function(){this.requestTick()}},e.prototype={constructor:e,init:function(){if(e.cutsTheMustard)return this.debouncer=new a(this.update.bind(this)),this.elem.classList.add(this.classes.initial),setTimeout(this.attachEvent.bind(this),100),this},destroy:function(){var a=this.classes;this.initialised=!1;for(var b in a)a.hasOwnProperty(b)&&this.elem.classList.remove(a[b]);this.scroller.removeEventListener("scroll",this.debouncer,!1)},attachEvent:function(){this.initialised||(this.lastKnownScrollY=this.getScrollY(),this.initialised=!0,this.scroller.addEventListener("scroll",this.debouncer,!1),this.debouncer.handleEvent())},unpin:function(){var a=this.elem.classList,b=this.classes;!a.contains(b.pinned)&&a.contains(b.unpinned)||(a.add(b.unpinned),a.remove(b.pinned),this.onUnpin&&this.onUnpin.call(this))},pin:function(){var a=this.elem.classList,b=this.classes;a.contains(b.unpinned)&&(a.remove(b.unpinned),a.add(b.pinned),this.onPin&&this.onPin.call(this))},top:function(){var a=this.elem.classList,b=this.classes;a.contains(b.top)||(a.add(b.top),a.remove(b.notTop),this.onTop&&this.onTop.call(this))},notTop:function(){var a=this.elem.classList,b=this.classes;a.contains(b.notTop)||(a.add(b.notTop),a.remove(b.top),this.onNotTop&&this.onNotTop.call(this))},bottom:function(){var a=this.elem.classList,b=this.classes;a.contains(b.bottom)||(a.add(b.bottom),a.remove(b.notBottom),this.onBottom&&this.onBottom.call(this))},notBottom:function(){var a=this.elem.classList,b=this.classes;a.contains(b.notBottom)||(a.add(b.notBottom),a.remove(b.bottom),this.onNotBottom&&this.onNotBottom.call(this))},getScrollY:function(){return void 0!==this.scroller.pageYOffset?this.scroller.pageYOffset:void 0!==this.scroller.scrollTop?this.scroller.scrollTop:(document.documentElement||document.body.parentNode||document.body).scrollTop},getViewportHeight:function(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight},getElementPhysicalHeight:function(a){return Math.max(a.offsetHeight,a.clientHeight)},getScrollerPhysicalHeight:function(){return this.scroller===window||this.scroller===document.body?this.getViewportHeight():this.getElementPhysicalHeight(this.scroller)},getDocumentHeight:function(){var a=document.body,b=document.documentElement;return Math.max(a.scrollHeight,b.scrollHeight,a.offsetHeight,b.offsetHeight,a.clientHeight,b.clientHeight)},getElementHeight:function(a){return Math.max(a.scrollHeight,a.offsetHeight,a.clientHeight)},getScrollerHeight:function(){return this.scroller===window||this.scroller===document.body?this.getDocumentHeight():this.getElementHeight(this.scroller)},isOutOfBounds:function(a){var b=a<0,c=a+this.getScrollerPhysicalHeight()>this.getScrollerHeight();return b||c},toleranceExceeded:function(a,b){return Math.abs(a-this.lastKnownScrollY)>=this.tolerance[b]},shouldUnpin:function(a,b){var c=a>this.lastKnownScrollY,d=a>=this.offset;return c&&d&&b},shouldPin:function(a,b){var c=a<this.lastKnownScrollY,d=a<=this.offset;return c&&b||d},update:function(){var a=this.getScrollY(),b=a>this.lastKnownScrollY?"down":"up",c=this.toleranceExceeded(a,b);this.isOutOfBounds(a)||(a<=this.offset?this.top():this.notTop(),a+this.getViewportHeight()>=this.getScrollerHeight()?this.bottom():this.notBottom(),this.shouldUnpin(a,c)?this.unpin():this.shouldPin(a,c)&&this.pin(),this.lastKnownScrollY=a)}},e.options={tolerance:{up:0,down:0},offset:0,scroller:window,classes:{pinned:"headroom--pinned",unpinned:"headroom--unpinned",top:"headroom--top",notTop:"headroom--not-top",bottom:"headroom--bottom",notBottom:"headroom--not-bottom",initial:"headroom"}},e.cutsTheMustard="undefined"!=typeof f&&f.rAF&&f.bind&&f.classList,e});
data/assets/js/opf.js ADDED
@@ -0,0 +1,289 @@
1
+ (function () {
2
+ 'use strict';
3
+
4
+ // NOTE: This contains various JS helpers for Open Project theme,
5
+ // moving forward the functionality will be refactored into smaller modules
6
+ // (potentially native reusable web components) which would written in ES6
7
+ // and compiled, minified and combined at front-end build step.
8
+
9
+
10
+ var bigscreenBreakpoint = 800;
11
+ // Conforms to CSS @media rules
12
+
13
+ var body = document.querySelector('body');
14
+
15
+ // TODO: Best way (preferably w/o Node) to split these across files
16
+ // and concatenate/minify the result on Jekyll build?
17
+
18
+
19
+
20
+ /* Search box in top bar */
21
+
22
+ var initSearchWidget = function(containerEl, triggerEl, inputEl) {
23
+ var showSearch = function() {
24
+ containerEl.classList.add('with-expanded-search');
25
+ inputEl.focus();
26
+ };
27
+ var hideSearch = function() {
28
+ containerEl.classList.remove('with-expanded-search');
29
+ };
30
+ triggerEl.addEventListener('click', showSearch);
31
+
32
+ window.initAlgolia();
33
+ };
34
+
35
+
36
+
37
+ var topMenuEl = body.querySelector('.top-menu');
38
+ var triggerEl = topMenuEl.querySelector('.search');
39
+ var inputEl = topMenuEl.querySelector('input[type=search]');
40
+
41
+
42
+
43
+ /* Topmost hamburger menu */
44
+
45
+ var initCollapsibleMenu = function(origNavEl, triggerEl, menuEl) {
46
+ var hasOpened = false;
47
+ var origNavNextSiblingEl = origNavEl.nextSibling;
48
+
49
+ if (triggerEl != null && menuEl != null) {
50
+ triggerEl.addEventListener('click', function (evt) {
51
+ hasOpened = menuEl.classList.toggle('expanded');
52
+ if (hasOpened) {
53
+ triggerEl.setAttribute('aria-expanded', true);
54
+ menuEl.setAttribute('aria-hidden', false);
55
+ origNavEl.classList.remove('top-menu');
56
+ origNavEl.remove();
57
+ menuEl.insertBefore(origNavEl, menuEl.querySelector('.site-logo-container').nextSibling);
58
+ } else {
59
+ origNavEl.remove();
60
+ origNavNextSiblingEl.parentNode.insertBefore(origNavEl, origNavNextSiblingEl);
61
+ origNavEl.classList.add('top-menu');
62
+ }
63
+ });
64
+ }
65
+
66
+ return {
67
+ hasOpened: function() {
68
+ return hasOpened;
69
+ },
70
+ };
71
+ };
72
+
73
+
74
+
75
+ /* Collapsible header */
76
+
77
+ var initCollapsibleHeader = function(headerEl, hamburgerMenu) {
78
+ var collapsibleDocsMenu;
79
+ var body = document.querySelector('body');
80
+ var headerElH = headerEl.offsetHeight;
81
+ var isPinned;
82
+
83
+ body.style.paddingTop = '' + headerElH + 'px';
84
+
85
+ var headroom = new Headroom(headerEl, {
86
+ onUnpin: function() {
87
+ isPinned = false;
88
+ },
89
+ onPin: function() {
90
+ isPinned = true;
91
+ },
92
+ });
93
+
94
+ headroom.init();
95
+
96
+ body.style.paddingTop = '' + headerElH + 'px';
97
+ body.classList.add('with-headroom');
98
+
99
+ return {
100
+ getHeaderHeight: function () {
101
+ return headerElH;
102
+ },
103
+ assignCollapsibleDocsNav: function (nav) {
104
+ collapsibleDocsMenu = nav;
105
+ },
106
+ isPinned: function () {
107
+ return isPinned;
108
+ },
109
+ }
110
+ };
111
+
112
+
113
+
114
+ /* Collapsible docs nav */
115
+
116
+ var initCollapsibleDocsNav = function(mainRoot, collapsibleHeader) {
117
+ var docsRoot = mainRoot.querySelector('section.documentation');
118
+ var article = docsRoot.querySelector('article');
119
+ var articleHeader = docsRoot.querySelector('header:first-child');
120
+ var docsNav = docsRoot.querySelector('.docs-nav');
121
+
122
+ if (!docsNav) { return; } // Must be docs landing page
123
+
124
+ var docsNavItemsContainer = docsNav.querySelector('.nav-items');
125
+ var docsHeader = mainRoot.querySelector('header.documentation-header');
126
+
127
+ var hasNav = docsHeader.classList.contains('has-nav');
128
+ var docsHeaderH = docsHeader.offsetHeight - 1; // 1px to compensate for border
129
+
130
+
131
+ // Used to offset things from the topmost edge of viewport
132
+ // to account for top header height
133
+ var topHeaderHeight = collapsibleHeader.getHeaderHeight();
134
+
135
+ docsRoot.classList.add('with-expandable-toc');
136
+ docsNav.classList.add('top-expandable');
137
+
138
+ docsHeader.style.top = '' + topHeaderHeight + 'px';
139
+
140
+ docsNavItemsContainer.style.top = '' + (topHeaderHeight + docsHeaderH) + 'px';
141
+
142
+ // Triggering opening via header link itself
143
+
144
+ var hasOpened = false;
145
+
146
+ var collapse = function (docsNav) {
147
+ hasOpened = false;
148
+
149
+ docsNav.classList.remove('expanded');
150
+ docsHeader.classList.remove('nav-expanded');
151
+ docsRoot.classList.add('with-collapsed-toc');
152
+ };
153
+
154
+ var open = function (docsNav) {
155
+ hasOpened = true;
156
+
157
+ docsNav.classList.add('expanded');
158
+ docsHeader.classList.add('nav-expanded');
159
+ docsRoot.classList.remove('with-collapsed-toc');
160
+ };
161
+
162
+ var toggle = function () {
163
+ if (hasOpened) { collapse(docsNav); }
164
+ else { open(docsNav); }
165
+ };
166
+
167
+
168
+ // Open sidebar if (A) navigation is present and (B) viewport is wide enough.
169
+
170
+ if (hasNav) {
171
+ docsHeader.addEventListener('click', toggle);
172
+ var viewportW = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
173
+ if (viewportW > bigscreenBreakpoint) {
174
+ open(docsNav);
175
+ } else {
176
+ collapse(docsNav);
177
+ }
178
+ } else {
179
+ collapse(docsNav);
180
+ }
181
+
182
+
183
+ // Hiding docs nav
184
+
185
+ // TODO: Replace with moving this to the top
186
+ // in top header’s headroom hook?
187
+ var headroom = new Headroom(docsHeader, {
188
+ classes: {
189
+ pinned: 'pinned',
190
+ unpinned: 'unpinned',
191
+ },
192
+ onUnpin: function () {
193
+ docsHeader.style.transform = 'translateY(-' + topHeaderHeight + 'px)';
194
+ docsNavItemsContainer.style.top = '' + (docsHeaderH) + 'px';
195
+ },
196
+ onPin: function () {
197
+ docsHeader.style.top = '' + topHeaderHeight + 'px';
198
+ docsHeader.style.transform = 'translateY(0)';
199
+ docsNavItemsContainer.style.top = '' + (topHeaderHeight + docsHeaderH) + 'px';
200
+ },
201
+ });
202
+
203
+ headroom.init();
204
+
205
+ return {
206
+ hasOpened: function () {
207
+ return hasOpened;
208
+ },
209
+ toggle: toggle,
210
+ }
211
+ };
212
+
213
+
214
+
215
+ /* Software/spec index filter bar */
216
+
217
+ var initIndexFilter = function(filterBar) {
218
+ var namespaces = filterBar.querySelectorAll('.namespace');
219
+
220
+ var updateScrolledStatus = function (evt) {
221
+ if (!evt.target.classList) { return; }
222
+
223
+ if (evt.target.scrollLeft > 0) {
224
+ evt.target.classList.add('scrolled');
225
+ } else {
226
+ evt.target.classList.remove('scrolled');
227
+ }
228
+ };
229
+
230
+ // Mark empty namespaces
231
+ for (let nsEl of namespaces) {
232
+ if (nsEl.querySelector('ul.tags > li') === null) {
233
+ nsEl.classList.add('empty');
234
+ }
235
+ }
236
+
237
+ // Update styling on tag bar on scroll
238
+ for (let tags of filterBar.querySelectorAll('ul.tags')) {
239
+ tags.addEventListener('scroll', updateScrolledStatus);
240
+ }
241
+ };
242
+
243
+
244
+
245
+ // Initializing stuff
246
+ // The order is significant in many cases, since it involves
247
+ // UI components that depend on each other.
248
+
249
+ var hamburgerMenu = initCollapsibleMenu(
250
+ document.querySelector('header nav.top-menu'),
251
+ document.getElementById('hamburgerButton'),
252
+ document.getElementById('hamburgerMenu'));
253
+
254
+ var collapsibleHeader;
255
+
256
+ if (document.querySelector('body.docs-page > main') != null) {
257
+ collapsibleHeader = initCollapsibleHeader(
258
+ document.querySelector('.underlay.header'),
259
+ hamburgerMenu);
260
+ }
261
+
262
+ var docsRoot = body.querySelector('body.docs-page > main');
263
+ var collapsibleDocsNav;
264
+
265
+ if (docsRoot !== null) {
266
+ collapsibleDocsNav = initCollapsibleDocsNav(docsRoot, collapsibleHeader);
267
+ collapsibleHeader.assignCollapsibleDocsNav(collapsibleDocsNav);
268
+ }
269
+
270
+ var docArticleSelectorPrefixes = ['body.docs-page .documentation > article'];
271
+
272
+ for (var prefix of docArticleSelectorPrefixes) {
273
+ var docArticleHeaderNavToggle = document.querySelector(prefix + '> header > nav > button.docs-nav-toggle');
274
+ var docArticleFooterNavToggle = document.querySelector(prefix + '> footer > nav > button.docs-nav-toggle');
275
+ for (var el of [docArticleFooterNavToggle, docArticleHeaderNavToggle]) {
276
+ if (el) { el.addEventListener('click', collapsibleDocsNav.toggle); }
277
+ }
278
+ }
279
+
280
+ if (triggerEl !== null && inputEl !== null && topMenuEl !== null) {
281
+ initSearchWidget(topMenuEl, triggerEl, inputEl);
282
+ }
283
+
284
+ var indexFilterEl = document.querySelector('nav.item-filter');
285
+ if (indexFilterEl !== null) {
286
+ initIndexFilter(indexFilterEl);
287
+ }
288
+
289
+ }());
@@ -0,0 +1,19 @@
1
+ (function () {
2
+
3
+ const listings = document.querySelectorAll('main .listingblock:not(.nocopy) pre');
4
+ const buttonHint = 'Copy code to clipboard';
5
+
6
+ for (let el of listings) {
7
+ let copyBtn = document.createElement('button');
8
+ copyBtn.innerHTML = '<i class="fas fa-copy"></i>';
9
+ copyBtn.setAttribute('aria-label', buttonHint);
10
+ copyBtn.setAttribute('title', buttonHint);
11
+ copyBtn.classList.add('listing-clipboard-button');
12
+ el.parentNode.insertBefore(copyBtn, el);
13
+ }
14
+
15
+ new ClipboardJS(document.querySelectorAll('button.listing-clipboard-button'), {
16
+ target: function (triggerEl) { return triggerEl.nextElementSibling; },
17
+ });
18
+
19
+ }());