Skip to content

Commit b66c461

Browse files
committedOct 29, 2021
Update Dependencies
1 parent dd5dda8 commit b66c461

File tree

7 files changed

+178
-25
lines changed

7 files changed

+178
-25
lines changed
 

‎docs/assets/css/style.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/assets/js/anchor.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/assets/js/site.js

+154-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,154 @@
1-
!function(){"use strict";function u(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||s(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=s(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,l=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return l=e.done,e},e:function(e){a=!0,i=e},f:function(){try{l||null==n.return||n.return()}finally{if(a)throw i}}}}anchors.options.placement="left",anchors.add("h3").remove(".no-anchor");var d=document.querySelector("#toc").querySelectorAll("li");document.querySelector("#filter-input").addEventListener("keyup",function(e){if("Enter"===e.key){var t,n=f(d);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(!r.classList.contains("display-none"))return location.replace(r.firstChild.href),e.preventDefault()}}catch(e){n.e(e)}finally{n.f()}}var o=function(){return!0},i=document.querySelector("#filter-input").value.toLowerCase();i.match(/^\s*$/)||(o=function(e){return e.firstChild.innerHTML&&e.firstChild.innerHTML.toLowerCase().includes(i)});var l,a=f(d);try{for(a.s();!(l=a.n()).done;){var s=l.value,c=u(s.querySelectorAll("li"));o(s)||c.some(function(e){return o(e)})?s.classList.remove("display-none"):s.classList.add("display-none")}}catch(e){a.e(e)}finally{a.f()}});var e,t=f(document.querySelectorAll(".toggle-sibling"));try{for(t.s();!(e=t.n()).done;){e.value.addEventListener("click",n)}}catch(e){t.e(e)}finally{t.f()}function n(){var e=this.parentNode.querySelectorAll(".toggle-target")[0],t=this.querySelectorAll(".icon")[0],n="display-none";e.classList.contains(n)?(e.classList.remove(n),t.innerHTML="▾"):(e.classList.add(n),t.innerHTML="▸")}function o(e){var t=document.getElementById(e);t&&0===t.offsetHeight&&t.parentNode.parentNode.classList.contains("display-none")&&t.parentNode.parentNode.classList.remove("display-none")}window.addEventListener("hashchange",function(){o(location.hash.slice(1))}),o(location.hash.slice(1));var i,l=f(document.querySelectorAll(".pre-open"));try{for(l.s();!(i=l.n()).done;){i.value.addEventListener("mousedown",a,!1)}}catch(e){l.e(e)}finally{l.f()}function a(){o(this.hash.slice(1))}var c=document.querySelector("#split-left"),y=document.querySelector("#split-right");function p(){history.replaceState({leftTop:c.scrollTop,rightTop:y.scrollTop},document.title)}function h(e){e&&history.replaceState(e.state,document.title),history.state&&(c.scrollTop=history.state.leftTop,y.scrollTop=history.state.rightTop)}c.style.overflow="hidden",c.style.overflow="",Split(["#split-left","#split-right"],{elementStyle:function(e,t,n){return{"flex-basis":"calc("+t+"% - "+n+"px)"}},gutterStyle:function(e,t){return{"flex-basis":t+"px"}},gutterSize:20,sizes:[20,80]}),window.addEventListener("load",function(){setTimeout(function(){h(),p(),c.addEventListener("scroll",p),y.addEventListener("scroll",p)},1)}),window.addEventListener("popstate",h)}();
1+
(function () {
2+
'use strict';
3+
4+
/* eslint-env browser */
5+
/* eslint new-cap:0,no-undef:0,unicorn/prefer-query-selector:0 */
6+
/* global anchors */
7+
8+
// add anchor links to headers
9+
anchors.options.placement = 'left';
10+
anchors.add('h3').remove('.no-anchor');
11+
12+
// Filter UI
13+
const tocElements = document.querySelector('#toc').querySelectorAll('li');
14+
15+
document.querySelector('#filter-input').addEventListener('keyup', event_ => {
16+
// Enter key
17+
if (event_.key === 'Enter') {
18+
// Go to the first displayed item in the toc
19+
for (const element of tocElements) {
20+
if (!element.classList.contains('display-none')) {
21+
location.replace(element.firstChild.href);
22+
return event_.preventDefault()
23+
}
24+
}
25+
}
26+
27+
let match = () => true;
28+
29+
const value = document.querySelector('#filter-input').value.toLowerCase();
30+
31+
if (!/^\s*$/.test(value)) {
32+
match = element =>
33+
element.firstChild.innerHTML
34+
&& element.firstChild.innerHTML.toLowerCase().includes(value);
35+
}
36+
37+
for (const element of tocElements) {
38+
const children = [...element.querySelectorAll('li')];
39+
if (match(element) || children.some(child => match(child))) {
40+
element.classList.remove('display-none');
41+
} else {
42+
element.classList.add('display-none');
43+
}
44+
}
45+
});
46+
47+
const toggles = document.querySelectorAll('.toggle-sibling');
48+
49+
for (const toggle of toggles) {
50+
toggle.addEventListener('click', toggleSibling);
51+
}
52+
53+
function toggleSibling() {
54+
const stepSibling = this.parentNode.querySelectorAll('.toggle-target')[0];
55+
const icon = this.querySelectorAll('.icon')[0];
56+
const klass = 'display-none';
57+
if (stepSibling.classList.contains(klass)) {
58+
stepSibling.classList.remove(klass);
59+
icon.innerHTML = '▾';
60+
} else {
61+
stepSibling.classList.add(klass);
62+
icon.innerHTML = '▸';
63+
}
64+
}
65+
66+
function showHashTarget(targetId) {
67+
const hashTarget = document.getElementById(targetId);
68+
// New target is hidden
69+
if (hashTarget && hashTarget.offsetHeight === 0
70+
&& hashTarget.parentNode.parentNode.classList.contains('display-none')) {
71+
hashTarget.parentNode.parentNode.classList.remove('display-none');
72+
}
73+
}
74+
75+
window.addEventListener('hashchange', () => {
76+
showHashTarget(location.hash.slice(1));
77+
});
78+
79+
showHashTarget(location.hash.slice(1));
80+
81+
const toclinks = document.querySelectorAll('.pre-open');
82+
83+
for (const toclink of toclinks) {
84+
toclink.addEventListener('mousedown', preOpen, false);
85+
}
86+
87+
function preOpen() {
88+
showHashTarget(this.hash.slice(1));
89+
}
90+
91+
const splitLeft = document.querySelector('#split-left');
92+
const splitRight = document.querySelector('#split-right');
93+
// TODO const splitParent = splitLeft.parentNode
94+
// TODO const cwWithSb = splitLeft.clientWidth
95+
splitLeft.style.overflow = 'hidden';
96+
// TODO const cwWithoutSb = splitLeft.clientWidth
97+
splitLeft.style.overflow = '';
98+
99+
Split(['#split-left', '#split-right'], {
100+
elementStyle(dimension, size, gutterSize) {
101+
return {
102+
'flex-basis': 'calc(' + size + '% - ' + gutterSize + 'px)',
103+
}
104+
},
105+
gutterStyle(dimension, gutterSize) {
106+
return {
107+
'flex-basis': gutterSize + 'px',
108+
}
109+
},
110+
gutterSize: 20,
111+
sizes: [20, 80],
112+
});
113+
114+
// Chrome doesn't remember scroll position properly so do it ourselves.
115+
// Also works on Firefox and Edge.
116+
117+
function updateState() {
118+
history.replaceState(
119+
{
120+
leftTop: splitLeft.scrollTop,
121+
rightTop: splitRight.scrollTop,
122+
},
123+
document.title,
124+
);
125+
}
126+
127+
function loadState(ev) {
128+
if (ev) {
129+
// Edge doesn't replace change history.state on popstate.
130+
history.replaceState(ev.state, document.title);
131+
}
132+
133+
if (history.state) {
134+
splitLeft.scrollTop = history.state.leftTop;
135+
splitRight.scrollTop = history.state.rightTop;
136+
}
137+
}
138+
139+
window.addEventListener('load', () => {
140+
// Restore after Firefox scrolls to hash.
141+
setTimeout(() => {
142+
loadState();
143+
// Update with initial scroll position.
144+
updateState();
145+
// Update scroll positions only after we've loaded because Firefox
146+
// emits an initial scroll event with 0.
147+
splitLeft.addEventListener('scroll', updateState);
148+
splitRight.addEventListener('scroll', updateState);
149+
}, 1);
150+
});
151+
152+
window.addEventListener('popstate', loadState);
153+
154+
})();

‎docs/assets/js/split.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/index.html

+12-12
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ <h3 class="m0 no-anchor">@thebespokepixel/meta</h3>
8383

8484
</ul>
8585
</div>
86-
<div class="badges"><p><p><a href="https://github.com/thebespokepixel/meta" title="Github"><img src="https://img.shields.io/badge/github-source-4E73B6" alt="Github"></a> <a href="https://travis-ci.org/thebespokepixel/meta" title="Travis"><img src="https://img.shields.io/travis/thebespokepixel/meta/master?logo=travis" alt="Travis"></a> <br>
87-
</p> <p><a href="https://codeclimate.com/github/thebespokepixel/meta/maintainability" title="Code-climate"><img src="https://api.codeclimate.com/v1/badges/34ee5899a13cb62729b9/maintainability" alt="Code-climate"></a> <a href="https://codeclimate.com/github/thebespokepixel/meta/test_coverage" title="Coverage"><img src="https://api.codeclimate.com/v1/badges/34ee5899a13cb62729b9/test_coverage" alt="Coverage"></a> <br>
88-
</p> <p><a href="https://snyk.io/test/github/thebespokepixel/meta" title="Snyk"><img src="https://snyk.io/test/github/thebespokepixel/meta/badge.svg" alt="Snyk"></a> <a href="https://david-dm.org/thebespokepixel/meta/master" title="David"><img src="https://david-dm.org/thebespokepixel/meta/master/status.svg" alt="David"></a> <br>
89-
</p> <br>
90-
</p></div>
86+
<div class="badges"><p><p><p><a href="https://github.com/thebespokepixel/meta" title="github"><img src="https://img.shields.io/badge/github-source-4E73B6" alt="github" title="github"></a> </p><p><a href="https://travis-ci.com/thebespokepixel/meta" title="Travis"><img src="https://img.shields.io/travis/com/thebespokepixel/meta/master?logo=travis" alt="Travis" title="Travis"></a> </p><br>
87+
</p><p><p><a href="https://codeclimate.com/github/thebespokepixel/meta/maintainability" title="Code-Climate"><img src="https://api.codeclimate.com/v1/badges/34ee5899a13cb62729b9/maintainability" alt="Code-Climate" title="Code-Climate"></a> </p><p><a href="https://codeclimate.com/github/thebespokepixel/meta/test_coverage" title="Code-Climate Coverage"><img src="https://api.codeclimate.com/v1/badges/34ee5899a13cb62729b9/test_coverage" alt="Code-Climate Coverage" title="Code-Climate Coverage"></a> </p><br>
88+
</p><p><p><a href="https://snyk.io/test/github/thebespokepixel/meta" title="Snyk"><img src="https://snyk.io/test/github/thebespokepixel/meta/badge.svg" alt="Snyk" title="Snyk"></a> </p><p><a href="https://libraries.io/github/thebespokepixel/meta" title="Libraries.io"><img src="https://img.shields.io/librariesio/release/npm/@thebespokepixel/meta/latest?&#x26;logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8cGF0aCBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik01Ljk5OTMxNDIyLDE1LjI3NyBMNiwyMyBDNiwyMy41NTIyODQ3IDUuNTUyMjg0NzUsMjQgNSwyNCBMMiwyNCBDMS40NDc3MTUyNSwyNCAxLDIzLjU1MjI4NDcgMSwyMyBMMC45OTkzMTQyMjIsMTkuMTg0IEw1Ljk5OTMxNDIyLDE1LjI3NyBaIE0xNC40OTkzMTQyLDguNjM2IEwxNC41LDIzIEMxNC41LDIzLjU1MjI4NDcgMTQuMDUyMjg0NywyNCAxMy41LDI0IEwxMC41LDI0IEM5Ljk0NzcxNTI1LDI0IDkuNSwyMy41NTIyODQ3IDkuNSwyMyBMOS40OTkzMTQyMiwxMi41NDMgTDE0LjQ5OTMxNDIsOC42MzYgWiBNMTcuOTk5MzE0Miw4LjMzNCBMMjIuOTk5MzE0MiwxMi4xMDIgTDIzLDIzIEMyMywyMy41NTIyODQ3IDIyLjU1MjI4NDcsMjQgMjIsMjQgTDE5LDI0IEMxOC40NDc3MTUzLDI0IDE4LDIzLjU1MjI4NDcgMTgsMjMgTDE3Ljk5OTMxNDIsOC4zMzQgWiBNNSwwIEM1LjU1MjI4NDc1LDAgNiwwLjQ0NzcxNTI1IDYsMSBMNS45OTkzMTQyMiwxMS40NzEgTDAuOTk5MzE0MjIyLDE1LjM3OCBMMSwxIEMxLDAuNDQ3NzE1MjUgMS40NDc3MTUyNSwwIDIsMCBMNSwwIFogTTEzLjUsMCBDMTQuMDUyMjg0NywwIDE0LjUsMC40NDc3MTUyNSAxNC41LDEgTDE0LjQ5OTMxNDIsNC44MzEgTDkuNDk5MzE0MjIsOC43MzcgTDkuNSwxIEM5LjUsMC40NDc3MTUyNSA5Ljk0NzcxNTI1LDAgMTAuNSwwIEwxMy41LDAgWiBNMjIsMCBDMjIuNTUyMjg0NywwIDIzLDAuNDQ3NzE1MjUgMjMsMSBMMjIuOTk5MzE0Miw4LjM0NyBMMTcuOTk5MzE0Miw0LjU3OSBMMTgsMSBDMTgsMC40NDc3MTUyNSAxOC40NDc3MTUzLDAgMTksMCBMMjIsMCBaIi8%2BCjwvc3ZnPgo%3D" alt="Libraries.io" title="Libraries.io"></a> </p><br>
89+
</p></p>
90+
</div>
9191
<div class="mt1 h6 quiet">
9292
<a href="http://documentation.js.org/reading-documentation.html">Need help reading this?</a>
9393
</div>
@@ -105,17 +105,17 @@ <h2 id="usage" class="m0">
105105
</h2>
106106

107107

108-
109108

110109

111110
<h4>Installation</h4>
112111
<pre class='hljs'>npm install --save @thebespokepixel/meta</pre>
113112
<h4>Setup</h4>
114113
<p>Import (or require) the module…</p>
115-
<h6>ES6</h6>
116-
<pre class='hljs'><span class="hljs-keyword">import</span> meta <span class="hljs-keyword">from</span> <span class="hljs-string">'@thebespokepixel/meta'</span>
114+
<pre class='hljs'><span class="hljs-keyword">import</span> {dirname} <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;node:path&#x27;</span>
115+
<span class="hljs-keyword">import</span> {fileURLToPath} <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;node:url&#x27;</span>
116+
<span class="hljs-keyword">import</span> meta <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;@thebespokepixel/meta&#x27;</span>
117117

118-
<span class="hljs-keyword">const</span> metadata = meta(__dirname) <span class="hljs-comment">// Start searching from inside this scripts module</span></pre>
118+
<span class="hljs-keyword">const</span> metadata = <span class="hljs-title function_">meta</span>(<span class="hljs-title function_">dirname</span>(<span class="hljs-title function_">fileURLToPath</span>(<span class="hljs-keyword">import</span>.<span class="hljs-property">meta</span>.<span class="hljs-property">url</span>))) <span class="hljs-comment">// Start searching from inside this scripts module</span></pre>
119119

120120

121121
</section>
@@ -152,7 +152,7 @@ <h3 class='left m0 panel-title' id='meta'>
152152
</h3>
153153

154154

155-
<a class='pl3 pr1 right rounded github' href='https://MarkGriffiths@github.com/thebespokepixel/meta/blob/b901dc5c1954e3fb82b9db773d488280bee8605b/src/index.js#L18-L87'>
155+
<a class='pl3 pr1 right rounded github' href='https://MarkGriffiths@github.com/thebespokepixel/meta/blob/dd5dda811a59688c0a9ede73708e74ac522c0f4d/src/index.js#L18-L87'>
156156
<span>src/index.js</span>
157157
</a>
158158

@@ -227,7 +227,7 @@ <h3 class='left m0 panel-title' id='metadata'>
227227
</h3>
228228

229229

230-
<a class='pl3 pr1 right rounded github' href='https://MarkGriffiths@github.com/thebespokepixel/meta/blob/b901dc5c1954e3fb82b9db773d488280bee8605b/src/index.js#L30-L84'>
230+
<a class='pl3 pr1 right rounded github' href='https://MarkGriffiths@github.com/thebespokepixel/meta/blob/dd5dda811a59688c0a9ede73708e74ac522c0f4d/src/index.js#L30-L84'>
231231
<span>src/index.js</span>
232232
</a>
233233

@@ -321,7 +321,7 @@ <h3 class='left m0 panel-title' id='metadata'>
321321
<div class='clearfix'>
322322

323323

324-
<a class='pl3 pr1 right rounded github' href='https://MarkGriffiths@github.com/thebespokepixel/meta/blob/b901dc5c1954e3fb82b9db773d488280bee8605b/src/index.js#L64-L83'>
324+
<a class='pl3 pr1 right rounded github' href='https://MarkGriffiths@github.com/thebespokepixel/meta/blob/dd5dda811a59688c0a9ede73708e74ac522c0f4d/src/index.js#L64-L83'>
325325
<span>src/index.js</span>
326326
</a>
327327

‎readme.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ npm install --save @thebespokepixel/meta
3030

3131
Import (or require) the module…
3232

33-
###### ES6
34-
3533
```javascript
34+
import {dirname} from 'node:path'
35+
import {fileURLToPath} from 'node:url'
3636
import meta from '@thebespokepixel/meta'
3737

38-
const metadata = meta(__dirname) // Start searching from inside this scripts module
38+
const metadata = meta(dirname(fileURLToPath(import.meta.url))) // Start searching from inside this scripts module
3939
```
4040
4141

‎src/docs/example.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ npm install --save @thebespokepixel/meta
88

99
Import (or require) the module…
1010

11-
###### ES6
12-
1311
```javascript
12+
import {dirname} from 'node:path'
13+
import {fileURLToPath} from 'node:url'
1414
import meta from '@thebespokepixel/meta'
1515

16-
const metadata = meta(__dirname) // Start searching from inside this scripts module
16+
const metadata = meta(dirname(fileURLToPath(import.meta.url))) // Start searching from inside this scripts module
1717
```
1818

0 commit comments

Comments
 (0)
Please sign in to comment.