opendoc-theme 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +43 -0
  4. data/_includes/directory.html +95 -0
  5. data/_includes/document-title.txt +58 -0
  6. data/_includes/toc.html +107 -0
  7. data/_includes/toolbar.html +53 -0
  8. data/_includes/welcome.html +5 -0
  9. data/_layouts/default.html +147 -0
  10. data/_layouts/home.html +4 -0
  11. data/_layouts/iframe.html +13 -0
  12. data/_layouts/page.html +4 -0
  13. data/_layouts/print.html +27 -0
  14. data/_sass/_base.scss +381 -0
  15. data/_sass/_constants.scss +87 -0
  16. data/_sass/_iframe.scss +7 -0
  17. data/_sass/_layout.scss +419 -0
  18. data/_sass/_nav.scss +592 -0
  19. data/_sass/_print.scss +43 -0
  20. data/_sass/_syntax-highlighting.scss +61 -0
  21. data/_sass/_toolbar.scss +372 -0
  22. data/_sass/_welcome.scss +41 -0
  23. data/assets/export.md +30 -0
  24. data/assets/images/chevron-up-white.svg +1 -0
  25. data/assets/images/chevron-up.svg +1 -0
  26. data/assets/images/close.svg +17 -0
  27. data/assets/images/favicon.ico +0 -0
  28. data/assets/images/feedback-hover.svg +3 -0
  29. data/assets/images/feedback-mobile.svg +1 -0
  30. data/assets/images/feedback.svg +1 -0
  31. data/assets/images/github-hover.svg +3 -0
  32. data/assets/images/github.svg +1 -0
  33. data/assets/images/home.svg +14 -0
  34. data/assets/images/index-img.png +0 -0
  35. data/assets/images/logo.png +0 -0
  36. data/assets/images/menu.svg +1 -0
  37. data/assets/images/opendoc-logo-full.svg +10 -0
  38. data/assets/images/pdf-hover.svg +11 -0
  39. data/assets/images/pdf.svg +9 -0
  40. data/assets/images/search-icon-dark.svg +19 -0
  41. data/assets/images/search-icon-white.svg +12 -0
  42. data/assets/images/share.svg +1 -0
  43. data/assets/images/sidebar-hover.svg +3 -0
  44. data/assets/images/sidebar.svg +1 -0
  45. data/assets/images/vertical-dots.svg +1 -0
  46. data/assets/images/x-mobile.svg +1 -0
  47. data/assets/index.html +5 -0
  48. data/assets/js/banner.js +20 -0
  49. data/assets/js/google_analytics.js +11 -0
  50. data/assets/js/header.js +31 -0
  51. data/assets/js/helpers.js +24 -0
  52. data/assets/js/lunr.min.js +6 -0
  53. data/assets/js/navigation.js +202 -0
  54. data/assets/js/page-index.js +57 -0
  55. data/assets/js/pqueue.js +373 -0
  56. data/assets/js/pre-loader.js +43 -0
  57. data/assets/js/search.js +580 -0
  58. data/assets/js/toolbar.js +130 -0
  59. data/assets/siteIndex.json +56 -0
  60. data/assets/startup/build.sh +18 -0
  61. data/assets/startup/docprint.html +20 -0
  62. data/assets/startup/pdf-gen.js +309 -0
  63. data/assets/startup/prebuild-lunr-index.js +52 -0
  64. data/assets/styles/main.scss +13 -0
  65. data/assets/styles/normalize.css +427 -0
  66. data/assets/vendor/babel-polyfill.min.js +3 -0
  67. data/assets/vendor/dom4.js +2 -0
  68. data/assets/vendor/fetch.umd.js +531 -0
  69. data/assets/vendor/headroom.min.js +7 -0
  70. data/assets/vendor/jump.min.js +2 -0
  71. data/assets/vendor/mark.min.js +7 -0
  72. data/assets/vendor/popper.min.js +5 -0
  73. data/assets/vendor/web-share-shim.bundle.min.js +2 -0
  74. metadata +158 -0
@@ -0,0 +1,57 @@
1
+ ---
2
+ ---
3
+ (function() {
4
+ // Data Blob
5
+ // =============================================================================
6
+ // The main "blob" of site data constructed by liquid
7
+ // We cherry pick to minimize size
8
+ // Also because jsonify doesn't work quite right and collapses the page objects
9
+ // into just strings when we jsonify the whole site
10
+ var pages = [
11
+ {%- for site_page in site.html_pages -%}
12
+ {%- unless site_page.exclude -%}
13
+ {%- capture name -%}{{ site_page.name }}{%- endcapture -%}
14
+ {%- if site_page.title == null -%}
15
+ {%- capture title %}{%- assign words = name | remove_first: '.md' | split: '-' -%}{%- for word in words -%}{{ word | capitalize }} {%- endfor -%}{%- endcapture -%}
16
+ {%- else -%}
17
+ {%- capture title -%}{{ site_page.title }}{%- endcapture -%}
18
+ {%- endif -%}
19
+ {%- comment -%}
20
+ toc_id copied from directory.html
21
+ {%- endcomment -%}
22
+ {%- assign toc_id = site_page.dir | uri_escape | remove_first: '/' | split: '/' | first | prepend: '/' | downcase -%}
23
+ {%- if toc_id != '/' -%}
24
+ {%- assign toc_id = toc_id | append: '/' -%}
25
+ {%- endif -%}
26
+ {
27
+ name: {{name | jsonify}},
28
+ title: {{title | jsonify}},
29
+ url: {{ site_page.url | relative_url | jsonify }},
30
+ escapedPath: {{ site_page.path | uri_escape | jsonify}},
31
+ dir: {{ site_page.dir | jsonify }},
32
+ tocId: {{ 'toc_' | append: toc_id | jsonify }},
33
+ documentInfo: {% include_cached document-title.txt dir=site_page.dir %}
34
+ },
35
+ {% endunless %}
36
+ {% endfor %}
37
+ ]
38
+
39
+ var pageIndex = {}
40
+ var documentList = {}
41
+
42
+ pages.forEach(function(page) {
43
+ pageIndex[page.url] = page
44
+ var documentTitle = page.documentInfo ? page.documentInfo[0] : 'root'
45
+ if (documentList[documentTitle]) {
46
+ documentList[documentTitle].push(page)
47
+ } else {
48
+ documentList[documentTitle] = [page]
49
+ }
50
+ })
51
+
52
+ // Expose as global var
53
+ root = typeof exports !== 'undefined' && exports !== null ? exports : this
54
+
55
+ root.pageIndex = pageIndex;
56
+ root.documentList = documentList;
57
+ })()
@@ -0,0 +1,373 @@
1
+ // This is a babelified port of https://github.com/sindresorhus/p-queue/blob/v3.0.0/index.js
2
+
3
+ 'use strict';
4
+ // Used to compute insertion index to keep queue sorted after insertion
5
+
6
+ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
7
+
8
+ function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } }
9
+
10
+ function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
+
12
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
13
+
14
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
15
+
16
+ function lowerBound(array, value, comp) {
17
+ var first = 0;
18
+ var count = array.length;
19
+
20
+ while (count > 0) {
21
+ var step = count / 2 | 0;
22
+ var it = first + step;
23
+
24
+ if (comp(array[it], value) <= 0) {
25
+ first = ++it;
26
+ count -= step + 1;
27
+ } else {
28
+ count = step;
29
+ }
30
+ }
31
+
32
+ return first;
33
+ }
34
+
35
+ var PriorityQueue =
36
+ /*#__PURE__*/
37
+ function () {
38
+ function PriorityQueue() {
39
+ _classCallCheck(this, PriorityQueue);
40
+
41
+ this._queue = [];
42
+ }
43
+
44
+ _createClass(PriorityQueue, [{
45
+ key: "enqueue",
46
+ value: function enqueue(run, options) {
47
+ options = Object.assign({
48
+ priority: 0
49
+ }, options);
50
+ var element = {
51
+ priority: options.priority,
52
+ run: run
53
+ };
54
+
55
+ if (this.size && this._queue[this.size - 1].priority >= options.priority) {
56
+ this._queue.push(element);
57
+
58
+ return;
59
+ }
60
+
61
+ var index = lowerBound(this._queue, element, function (a, b) {
62
+ return b.priority - a.priority;
63
+ });
64
+
65
+ this._queue.splice(index, 0, element);
66
+ }
67
+ }, {
68
+ key: "dequeue",
69
+ value: function dequeue() {
70
+ return this._queue.shift().run;
71
+ }
72
+ }, {
73
+ key: "size",
74
+ get: function get() {
75
+ return this._queue.length;
76
+ }
77
+ }]);
78
+
79
+ return PriorityQueue;
80
+ }();
81
+
82
+ var PQueue =
83
+ /*#__PURE__*/
84
+ function () {
85
+ function PQueue(options) {
86
+ _classCallCheck(this, PQueue);
87
+
88
+ options = Object.assign({
89
+ carryoverConcurrencyCount: false,
90
+ intervalCap: Infinity,
91
+ interval: 0,
92
+ concurrency: Infinity,
93
+ autoStart: true,
94
+ queueClass: PriorityQueue
95
+ }, options);
96
+
97
+ if (!(typeof options.concurrency === 'number' && options.concurrency >= 1)) {
98
+ throw new TypeError("Expected `concurrency` to be a number from 1 and up, got `".concat(options.concurrency, "` (").concat(_typeof(options.concurrency), ")"));
99
+ }
100
+
101
+ if (!(typeof options.intervalCap === 'number' && options.intervalCap >= 1)) {
102
+ throw new TypeError("Expected `intervalCap` to be a number from 1 and up, got `".concat(options.intervalCap, "` (").concat(_typeof(options.intervalCap), ")"));
103
+ }
104
+
105
+ if (!(typeof options.interval === 'number' && Number.isFinite(options.interval) && options.interval >= 0)) {
106
+ throw new TypeError("Expected `interval` to be a finite number >= 0, got `".concat(options.interval, "` (").concat(_typeof(options.interval), ")"));
107
+ }
108
+
109
+ this._carryoverConcurrencyCount = options.carryoverConcurrencyCount;
110
+ this._isIntervalIgnored = options.intervalCap === Infinity || options.interval === 0;
111
+ this._intervalCount = 0;
112
+ this._intervalCap = options.intervalCap;
113
+ this._interval = options.interval;
114
+ this._intervalId = null;
115
+ this._intervalEnd = 0;
116
+ this._timeoutId = null;
117
+ this.queue = new options.queueClass(); // eslint-disable-line new-cap
118
+
119
+ this._queueClass = options.queueClass;
120
+ this._pendingCount = 0;
121
+ this._concurrency = options.concurrency;
122
+ this._isPaused = options.autoStart === false;
123
+
124
+ this._resolveEmpty = function () { };
125
+
126
+ this._resolveIdle = function () { };
127
+ }
128
+
129
+ _createClass(PQueue, [{
130
+ key: "_next",
131
+ value: function _next() {
132
+ this._pendingCount--;
133
+
134
+ this._tryToStartAnother();
135
+ }
136
+ }, {
137
+ key: "_resolvePromises",
138
+ value: function _resolvePromises() {
139
+ this._resolveEmpty();
140
+
141
+ this._resolveEmpty = function () { };
142
+
143
+ if (this._pendingCount === 0) {
144
+ this._resolveIdle();
145
+
146
+ this._resolveIdle = function () { };
147
+ }
148
+ }
149
+ }, {
150
+ key: "_onResumeInterval",
151
+ value: function _onResumeInterval() {
152
+ this._onInterval();
153
+
154
+ this._initializeIntervalIfNeeded();
155
+
156
+ this._timeoutId = null;
157
+ }
158
+ }, {
159
+ key: "_intervalPaused",
160
+ value: function _intervalPaused() {
161
+ var _this = this;
162
+
163
+ var now = Date.now();
164
+
165
+ if (this._intervalId === null) {
166
+ var delay = this._intervalEnd - now;
167
+
168
+ if (delay < 0) {
169
+ // Act as the interval was done
170
+ // We don't need to resume it here,
171
+ // because it'll be resumed on line 160
172
+ this._intervalCount = this._carryoverConcurrencyCount ? this._pendingCount : 0;
173
+ } else {
174
+ // Act as the interval is pending
175
+ if (this._timeoutId === null) {
176
+ this._timeoutId = setTimeout(function () {
177
+ return _this._onResumeInterval();
178
+ }, delay);
179
+ }
180
+
181
+ return true;
182
+ }
183
+ }
184
+
185
+ return false;
186
+ }
187
+ }, {
188
+ key: "_tryToStartAnother",
189
+ value: function _tryToStartAnother() {
190
+ if (this.queue.size === 0) {
191
+ // We can clear the interval ("pause")
192
+ // because we can redo it later ("resume")
193
+ clearInterval(this._intervalId);
194
+ this._intervalId = null;
195
+
196
+ this._resolvePromises();
197
+
198
+ return false;
199
+ }
200
+
201
+ if (!this._isPaused) {
202
+ var canInitializeInterval = !this._intervalPaused();
203
+
204
+ if (this._doesIntervalAllowAnother && this._doesConcurrentAllowAnother) {
205
+ this.queue.dequeue()();
206
+
207
+ if (canInitializeInterval) {
208
+ this._initializeIntervalIfNeeded();
209
+ }
210
+
211
+ return true;
212
+ }
213
+ }
214
+
215
+ return false;
216
+ }
217
+ }, {
218
+ key: "_initializeIntervalIfNeeded",
219
+ value: function _initializeIntervalIfNeeded() {
220
+ var _this2 = this;
221
+
222
+ if (this._isIntervalIgnored || this._intervalId !== null) {
223
+ return;
224
+ }
225
+
226
+ this._intervalId = setInterval(function () {
227
+ return _this2._onInterval();
228
+ }, this._interval);
229
+ this._intervalEnd = Date.now() + this._interval;
230
+ }
231
+ }, {
232
+ key: "_onInterval",
233
+ value: function _onInterval() {
234
+ if (this._intervalCount === 0 && this._pendingCount === 0) {
235
+ clearInterval(this._intervalId);
236
+ this._intervalId = null;
237
+ }
238
+
239
+ this._intervalCount = this._carryoverConcurrencyCount ? this._pendingCount : 0;
240
+
241
+ while (this._tryToStartAnother()) { } // eslint-disable-line no-empty
242
+
243
+ }
244
+ }, {
245
+ key: "add",
246
+ value: function add(fn, options) {
247
+ var _this3 = this;
248
+
249
+ return new Promise(function (resolve, reject) {
250
+ var run = function run() {
251
+ _this3._pendingCount++;
252
+ _this3._intervalCount++;
253
+
254
+ try {
255
+ Promise.resolve(fn()).then(function (val) {
256
+ resolve(val);
257
+
258
+ _this3._next();
259
+ }, function (err) {
260
+ reject(err);
261
+
262
+ _this3._next();
263
+ });
264
+ } catch (err) {
265
+ reject(err);
266
+
267
+ _this3._next();
268
+ }
269
+ };
270
+
271
+ _this3.queue.enqueue(run, options);
272
+
273
+ _this3._tryToStartAnother();
274
+ });
275
+ }
276
+ }, {
277
+ key: "addAll",
278
+ value: function addAll(fns, options) {
279
+ var _this4 = this;
280
+
281
+ return Promise.all(fns.map(function (fn) {
282
+ return _this4.add(fn, options);
283
+ }));
284
+ }
285
+ }, {
286
+ key: "start",
287
+ value: function start() {
288
+ if (!this._isPaused) {
289
+ return;
290
+ }
291
+
292
+ this._isPaused = false;
293
+
294
+ while (this._tryToStartAnother()) { } // eslint-disable-line no-empty
295
+
296
+ }
297
+ }, {
298
+ key: "pause",
299
+ value: function pause() {
300
+ this._isPaused = true;
301
+ }
302
+ }, {
303
+ key: "clear",
304
+ value: function clear() {
305
+ this.queue = new this._queueClass(); // eslint-disable-line new-cap
306
+ }
307
+ }, {
308
+ key: "onEmpty",
309
+ value: function onEmpty() {
310
+ var _this5 = this;
311
+
312
+ // Instantly resolve if the queue is empty
313
+ if (this.queue.size === 0) {
314
+ return Promise.resolve();
315
+ }
316
+
317
+ return new Promise(function (resolve) {
318
+ var existingResolve = _this5._resolveEmpty;
319
+
320
+ _this5._resolveEmpty = function () {
321
+ existingResolve();
322
+ resolve();
323
+ };
324
+ });
325
+ }
326
+ }, {
327
+ key: "onIdle",
328
+ value: function onIdle() {
329
+ var _this6 = this;
330
+
331
+ // Instantly resolve if none pending and if nothing else is queued
332
+ if (this._pendingCount === 0 && this.queue.size === 0) {
333
+ return Promise.resolve();
334
+ }
335
+
336
+ return new Promise(function (resolve) {
337
+ var existingResolve = _this6._resolveIdle;
338
+
339
+ _this6._resolveIdle = function () {
340
+ existingResolve();
341
+ resolve();
342
+ };
343
+ });
344
+ }
345
+ }, {
346
+ key: "_doesIntervalAllowAnother",
347
+ get: function get() {
348
+ return this._isIntervalIgnored || this._intervalCount < this._intervalCap;
349
+ }
350
+ }, {
351
+ key: "_doesConcurrentAllowAnother",
352
+ get: function get() {
353
+ return this._pendingCount < this._concurrency;
354
+ }
355
+ }, {
356
+ key: "size",
357
+ get: function get() {
358
+ return this.queue.size;
359
+ }
360
+ }, {
361
+ key: "pending",
362
+ get: function get() {
363
+ return this._pendingCount;
364
+ }
365
+ }, {
366
+ key: "isPaused",
367
+ get: function get() {
368
+ return this._isPaused;
369
+ }
370
+ }]);
371
+
372
+ return PQueue;
373
+ }();
@@ -0,0 +1,43 @@
1
+ var queue = new PQueue({ concurrency: 4 })
2
+
3
+ /*
4
+ Priority should be as follows:
5
+ All content loading: 0
6
+ Per document loading: 1
7
+ Per page loading: 2
8
+ */
9
+
10
+ function loadDocumentContent(documentTitle, priority) {
11
+ if (!documentList || !documentList[documentTitle]) {
12
+ return
13
+ }
14
+ var pagesInDocument = documentList[documentTitle]
15
+ pagesInDocument.forEach(function (page) {
16
+ loadPageContent(page, priority)
17
+ })
18
+ }
19
+
20
+ function loadPageContent(documentPage, priority) {
21
+ if (documentPage.content) {
22
+ if (!(documentPage.content instanceof Promise) || documentPage.priority >= priority ) {
23
+ // if already cached, pull from memory
24
+ // Promise.resolve can take in both promises and non-promises
25
+ return Promise.resolve(documentPage.content)
26
+ }
27
+ }
28
+ // or else fetch it from server and cache it
29
+ documentPage.priority = priority
30
+ documentPage.content = queue.add(function () {
31
+ return fetch(documentPage.url)
32
+ .then(checkStatus)
33
+ .then(parseText)
34
+ .then(function (html) {
35
+ var parser = new DOMParser().parseFromString(html, 'text/html')
36
+ var main = parser.getElementsByTagName('main')[0]
37
+ documentPage.content = main.innerHTML
38
+ return documentPage.content
39
+ })
40
+ }, { priority: priority })
41
+ return documentPage.content
42
+ }
43
+