@observablehq/inspector
Advanced tools
Comparing version 3.0.3 to 3.0.4
@@ -1,2 +0,2 @@ | ||
// @observablehq/inspector v3.0.3 Copyright 2018 Observable, Inc. | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.observablehq=e.observablehq||{})}(this,function(e){"use strict";function t(e,t,n){n=n||{};var o=e.ownerDocument,r=o.defaultView.CustomEvent;"function"==typeof r?r=new r(t,{detail:n}):((r=o.createEvent("Event")).initEvent(t,!1,!1),r.detail=n),e.dispatchEvent(r)}function n(e){return Array.isArray(e)||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function o(e){return e===(0|e)+""}function r(e){const t=document.createElement("span");return t.className="observablehq--cellname",t.textContent=`${e} = `,t}const a=Symbol.prototype.toString;function s(e){return a.call(e)}const{getOwnPropertySymbols:c,prototype:{hasOwnProperty:i}}=Object,{toStringTag:l}=Symbol,d={},p=c;function u(e,t){return i.call(e,t)}function f(e){return e[l]||e.constructor&&e.constructor.name||"Object"}function h(e,t){try{const n=e[t];return n&&n.constructor,n}catch(e){return d}}function m(e,o,a){const s=n(e);let c,i,l;e instanceof Map?(c=`Map(${e.size})`,i=b):e instanceof Set?(c=`Set(${e.size})`,i=v):s?(c=`${e.constructor.name}(${e.length})`,i=C):(c=f(e),i=y);const d=document.createElement("span");d.className="observablehq--expanded",a&&d.appendChild(r(a));const p=d.appendChild(document.createElement("a"));p.innerHTML="<svg width=8 height=8 class='observablehq--caret'>\n <path d='M4 7L0 1h8z' fill='currentColor' />\n </svg>",p.appendChild(document.createTextNode(`${c}${s?" [":" {"}`)),p.addEventListener("mouseup",function(t){t.stopPropagation(),V(d,q(e,null,a))}),i=i(e);for(let e=0;!(l=i.next()).done&&e<20;++e)d.appendChild(l.value);if(!l.done){const e=d.appendChild(document.createElement("a"));e.className="observablehq--field",e.style.display="block",e.appendChild(document.createTextNode(" … more")),e.addEventListener("mouseup",function(e){e.stopPropagation(),d.insertBefore(l.value,d.lastChild.previousSibling);for(let e=0;!(l=i.next()).done&&e<19;++e)d.insertBefore(l.value,d.lastChild.previousSibling);l.done&&d.removeChild(d.lastChild.previousSibling),t(d,"load")})}return d.appendChild(document.createTextNode(s?"]":"}")),d}function*b(e){for(const[t,n]of e)yield x(t,n);yield*y(e)}function*v(e){for(const t of e)yield E(t);yield*y(e)}function*C(e){for(let t=0,n=e.length;t<n;++t)t in e&&(yield g(t,h(e,t),"observablehq--index"));for(const t in e)!o(t)&&u(e,t)&&(yield g(t,h(e,t),"observablehq--key"));for(const t of p(e))yield g(s(t),h(e,t),"observablehq--symbol")}function*y(e){for(const t in e)u(e,t)&&(yield g(t,h(e,t),"observablehq--key"));for(const t of p(e))yield g(s(t),h(e,t),"observablehq--symbol")}function g(e,t,n){const o=document.createElement("div"),r=o.appendChild(document.createElement("span"));return o.className="observablehq--field",r.className=n,r.textContent=` ${e}`,o.appendChild(document.createTextNode(": ")),o.appendChild(R(t)),o}function x(e,t){const n=document.createElement("div");return n.className="observablehq--field",n.appendChild(document.createTextNode(" ")),n.appendChild(R(e)),n.appendChild(document.createTextNode(" => ")),n.appendChild(R(t)),n}function E(e){const t=document.createElement("div");return t.className="observablehq--field",t.appendChild(document.createTextNode(" ")),t.appendChild(R(e)),t}function q(e,t,o){const a=n(e);let s,c,i;if(e instanceof Map?(s=`Map(${e.size})`,c=N):e instanceof Set?(s=`Set(${e.size})`,c=w):a?(s=`${e.constructor.name}(${e.length})`,c=S):(s=f(e),c=$),t){const t=document.createElement("span");return t.className="observablehq--shallow",o&&t.appendChild(r(o)),t.appendChild(document.createTextNode(s)),t.addEventListener("mouseup",function(n){n.stopPropagation(),V(t,q(e))}),t}const l=document.createElement("span");l.className="observablehq--collapsed",o&&l.appendChild(r(o));const d=l.appendChild(document.createElement("a"));d.innerHTML="<svg width=8 height=8 class='observablehq--caret'>\n <path d='M7 4L1 8V0z' fill='currentColor' />\n </svg>",d.appendChild(document.createTextNode(`${s}${a?" [":" {"}`)),l.addEventListener("mouseup",function(t){t.stopPropagation(),V(l,m(e,0,o))},!0),c=c(e);for(let e=0;!(i=c.next()).done&&e<20;++e)e>0&&l.appendChild(document.createTextNode(", ")),l.appendChild(i.value);return i.done||l.appendChild(document.createTextNode(", …")),l.appendChild(document.createTextNode(a?"]":"}")),l}function*N(e){for(const[t,n]of e)yield k(t,n);yield*$(e)}function*w(e){for(const t of e)yield R(t,!0);yield*$(e)}function*S(e){let t=-1,n=0;for(const o=e.length;n<o;++n)n in e&&(n>t+1&&(yield T(n-t-1)),yield R(h(e,n),!0),t=n);n>t+1&&(yield T(n-t-1));for(const t in e)!o(t)&&u(e,t)&&(yield L(t,h(e,t),"observablehq--key"));for(const t of p(e))yield L(s(t),h(e,t),"observablehq--symbol")}function*$(e){for(const t in e)u(e,t)&&(yield L(t,h(e,t),"observablehq--key"));for(const t of p(e))yield L(s(t),h(e,t),"observablehq--symbol")}function T(e){const t=document.createElement("span");return t.className="observablehq--empty",t.textContent=1===e?"empty":`empty × ${e}`,t}function L(e,t,n){const o=document.createDocumentFragment(),r=o.appendChild(document.createElement("span"));return r.className=n,r.textContent=e,o.appendChild(document.createTextNode(": ")),o.appendChild(R(t,!0)),o}function k(e,t){const n=document.createDocumentFragment();return n.appendChild(R(e,!0)),n.appendChild(document.createTextNode(" => ")),n.appendChild(R(t,!0)),n}function M(e,t){var n=e+"",o=n.length;return o<t?new Array(t-o+1).join(0)+n:n}var A=Error.prototype.toString;var j=RegExp.prototype.toString;const F=20;function O(e){return e.replace(/[\\`\x00-\x09\x0b-\x19]|\${/g,P)}function P(e){var t=e.charCodeAt(0);switch(t){case 8:return"\\b";case 9:return"\\t";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r"}return t<16?"\\x0"+t.toString(16):t<32?"\\x"+t.toString(16):"\\"+e}function D(e,t){for(var n=0;t.exec(e);)++n;return n}var z=Function.prototype.toString,H={prefix:"async ƒ"},_={prefix:"async ƒ*"},I={prefix:"class"},U={prefix:"ƒ"},B={prefix:"ƒ*"};function G(e,t,n){var o=document.createElement("span");o.className="observablehq--function",n&&o.appendChild(r(n));var a=o.appendChild(document.createElement("span"));return a.className="observablehq--keyword",a.textContent=e.prefix,o.appendChild(document.createTextNode(t)),o}const{prototype:{toString:J}}=Object;function R(e,t,n,o){let a=typeof e;switch(a){case"boolean":case"undefined":e+="";break;case"number":e=0===e&&1/e<0?"-0":e+"";break;case"bigint":e+="n";break;case"symbol":e=s(e);break;case"function":return function(e,t){var n,o,r=z.call(e);switch(e.constructor&&e.constructor.name){case"AsyncFunction":n=H;break;case"AsyncGeneratorFunction":n=_;break;case"GeneratorFunction":n=B;break;default:n=/^class\b/.test(r)?I:U}return n===I?G(n,"",t):(o=/^(?:async\s*)?(\w+)\s*=>/.exec(r))?G(n,"("+o[1]+")",t):(o=/^(?:async\s*)?\(\s*(\w+(?:\s*,\s*\w+)*)?\s*\)/.exec(r))?G(n,o[1]?"("+o[1].replace(/\s*,\s*/g,", ")+")":"()",t):(o=/^(?:async\s*)?function(?:\s*\*)?(?:\s*\w+)?\s*\(\s*(\w+(?:\s*,\s*\w+)*)?\s*\)/.exec(r))?G(n,o[1]?"("+o[1].replace(/\s*,\s*/g,", ")+")":"()",t):G(n,"(…)",t)}(e,o);case"string":return function(e,t,n,o){if(!1===t){if(D(e,/["\n]/g)<=D(e,/`|\${/g)){const t=document.createElement("span");o&&t.appendChild(r(o));const n=t.appendChild(document.createElement("span"));return n.className="observablehq--string",n.textContent=JSON.stringify(e),t}const a=e.split("\n");if(a.length>F&&!n){const n=document.createElement("div");o&&n.appendChild(r(o));const s=n.appendChild(document.createElement("span"));s.className="observablehq--string",s.textContent="`"+O(a.slice(0,F).join("\n"));const c=n.appendChild(document.createElement("span")),i=a.length-F;return c.textContent=`Show ${i} truncated line${i>1?"s":""}`,c.className="observablehq--string-expand",c.addEventListener("mouseup",function(r){r.stopPropagation(),V(n,R(e,t,!0,o))}),n}const s=document.createElement("span");o&&s.appendChild(r(o));const c=s.appendChild(document.createElement("span"));return c.className=`observablehq--string${n?" observablehq--expanded":""}`,c.textContent="`"+O(e)+"`",s}const a=document.createElement("span");o&&a.appendChild(r(o));const s=a.appendChild(document.createElement("span"));return s.className="observablehq--string",s.textContent=JSON.stringify(e.length>100?`${e.slice(0,50)}…${e.slice(-49)}`:e),a}(e,t,n,o);default:if(null===e){a=null,e="null";break}if(e instanceof Date){a="date",c=e,e=isNaN(c)?"Invalid Date":M(c.getFullYear(),4)+"-"+M(c.getMonth()+1,2)+"-"+M(c.getDate(),2)+(c.getMilliseconds()?"T"+M(c.getHours(),2)+":"+M(c.getMinutes(),2)+":"+M(c.getSeconds(),2)+"."+M(c.getMilliseconds(),3):c.getSeconds()?"T"+M(c.getHours(),2)+":"+M(c.getMinutes(),2)+":"+M(c.getSeconds(),2):c.getMinutes()||c.getHours()?"T"+M(c.getHours(),2)+":"+M(c.getMinutes(),2):"");break}if(e===d){a="forbidden",e="[forbidden]";break}switch(J.call(e)){case"[object RegExp]":a="regexp",e=function(e){return j.call(e)}(e);break;case"[object Error]":case"[object DOMException]":a="error",e=function(e){return e.stack||A.call(e)}(e);break;default:return(n?m:q)(e,t,o)}}var c;const i=document.createElement("span");o&&i.appendChild(r(o));const l=i.appendChild(document.createElement("span"));return l.className=`observablehq--${a}`,l.textContent=e,i}function V(e,n){e.classList.contains("observablehq--inspect")&&n.classList.add("observablehq--inspect"),e.parentNode.replaceChild(n,e),t(n,"load")}const Y=/\s+\(\d+:\d+\)$/m;class K{constructor(e){if(!e)throw new Error("invalid node");this._node=e,e.classList.add("observablehq")}pending(){const{_node:e}=this;e.classList.remove("observablehq--error"),e.classList.add("observablehq--running")}fulfilled(e,n){const{_node:o}=this;if((!(e instanceof Element||e instanceof Text)||e.parentNode&&e.parentNode!==o)&&(e=R(e,!1,o.firstChild&&o.firstChild.classList&&o.firstChild.classList.contains("observablehq--expanded"),n)).classList.add("observablehq--inspect"),o.classList.remove("observablehq--running","observablehq--error"),o.firstChild!==e)if(o.firstChild){for(;o.lastChild!==o.firstChild;)o.removeChild(o.lastChild);o.replaceChild(e,o.firstChild)}else o.appendChild(e);t(o,"update")}rejected(e,n){const{_node:o}=this;for(o.classList.remove("observablehq--running"),o.classList.add("observablehq--error");o.lastChild;)o.removeChild(o.lastChild);var a=document.createElement("div");a.className="observablehq--inspect",n&&a.appendChild(r(n)),a.appendChild(document.createTextNode((e+"").replace(Y,""))),o.appendChild(a),t(o,"error",{error:e})}}K.into=function(e){if("string"==typeof e&&null==(e=document.querySelector(e)))throw new Error("container not found");return function(){return new K(e.appendChild(document.createElement("div")))}},e.Inspector=K,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
// @observablehq/inspector v3.0.4 Copyright 2019 Observable, Inc. | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.observablehq=e.observablehq||{})}(this,function(e){"use strict";function t(e,t,n){n=n||{};var o=e.ownerDocument,r=o.defaultView.CustomEvent;"function"==typeof r?r=new r(t,{detail:n}):((r=o.createEvent("Event")).initEvent(t,!1,!1),r.detail=n),e.dispatchEvent(r)}function n(e){return Array.isArray(e)||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function o(e){return e===(0|e)+""}function r(e){const t=document.createElement("span");return t.className="observablehq--cellname",t.textContent=`${e} = `,t}const a=Symbol.prototype.toString;function s(e){return a.call(e)}const{getOwnPropertySymbols:c,prototype:{hasOwnProperty:i}}=Object,{toStringTag:l}=Symbol,d={},p=c;function u(e,t){return i.call(e,t)}function f(e){return e[l]||e.constructor&&e.constructor.name||"Object"}function h(e,t){try{const n=e[t];return n&&n.constructor,n}catch(e){return d}}function m(e,o,a){const s=n(e);let c,i,l;e instanceof Map?(c=`Map(${e.size})`,i=b):e instanceof Set?(c=`Set(${e.size})`,i=v):s?(c=`${e.constructor.name}(${e.length})`,i=C):(c=f(e),i=y);const d=document.createElement("span");d.className="observablehq--expanded",a&&d.appendChild(r(a));const p=d.appendChild(document.createElement("a"));p.innerHTML="<svg width=8 height=8 class='observablehq--caret'>\n <path d='M4 7L0 1h8z' fill='currentColor' />\n </svg>",p.appendChild(document.createTextNode(`${c}${s?" [":" {"}`)),p.addEventListener("mouseup",function(t){t.stopPropagation(),Y(d,q(e,null,a))}),i=i(e);for(let e=0;!(l=i.next()).done&&e<20;++e)d.appendChild(l.value);if(!l.done){const e=d.appendChild(document.createElement("a"));e.className="observablehq--field",e.style.display="block",e.appendChild(document.createTextNode(" … more")),e.addEventListener("mouseup",function(e){e.stopPropagation(),d.insertBefore(l.value,d.lastChild.previousSibling);for(let e=0;!(l=i.next()).done&&e<19;++e)d.insertBefore(l.value,d.lastChild.previousSibling);l.done&&d.removeChild(d.lastChild.previousSibling),t(d,"load")})}return d.appendChild(document.createTextNode(s?"]":"}")),d}function*b(e){for(const[t,n]of e)yield x(t,n);yield*y(e)}function*v(e){for(const t of e)yield E(t);yield*y(e)}function*C(e){for(let t=0,n=e.length;t<n;++t)t in e&&(yield g(t,h(e,t),"observablehq--index"));for(const t in e)!o(t)&&u(e,t)&&(yield g(t,h(e,t),"observablehq--key"));for(const t of p(e))yield g(s(t),h(e,t),"observablehq--symbol")}function*y(e){for(const t in e)u(e,t)&&(yield g(t,h(e,t),"observablehq--key"));for(const t of p(e))yield g(s(t),h(e,t),"observablehq--symbol")}function g(e,t,n){const o=document.createElement("div"),r=o.appendChild(document.createElement("span"));return o.className="observablehq--field",r.className=n,r.textContent=` ${e}`,o.appendChild(document.createTextNode(": ")),o.appendChild(V(t)),o}function x(e,t){const n=document.createElement("div");return n.className="observablehq--field",n.appendChild(document.createTextNode(" ")),n.appendChild(V(e)),n.appendChild(document.createTextNode(" => ")),n.appendChild(V(t)),n}function E(e){const t=document.createElement("div");return t.className="observablehq--field",t.appendChild(document.createTextNode(" ")),t.appendChild(V(e)),t}function q(e,t,o){const a=n(e);let s,c,i;if(e instanceof Map?(s=`Map(${e.size})`,c=N):e instanceof Set?(s=`Set(${e.size})`,c=T):a?(s=`${e.constructor.name}(${e.length})`,c=w):(s=f(e),c=S),t){const t=document.createElement("span");return t.className="observablehq--shallow",o&&t.appendChild(r(o)),t.appendChild(document.createTextNode(s)),t.addEventListener("mouseup",function(n){n.stopPropagation(),Y(t,q(e))}),t}const l=document.createElement("span");l.className="observablehq--collapsed",o&&l.appendChild(r(o));const d=l.appendChild(document.createElement("a"));d.innerHTML="<svg width=8 height=8 class='observablehq--caret'>\n <path d='M7 4L1 8V0z' fill='currentColor' />\n </svg>",d.appendChild(document.createTextNode(`${s}${a?" [":" {"}`)),l.addEventListener("mouseup",function(t){t.stopPropagation(),Y(l,m(e,0,o))},!0),c=c(e);for(let e=0;!(i=c.next()).done&&e<20;++e)e>0&&l.appendChild(document.createTextNode(", ")),l.appendChild(i.value);return i.done||l.appendChild(document.createTextNode(", …")),l.appendChild(document.createTextNode(a?"]":"}")),l}function*N(e){for(const[t,n]of e)yield k(t,n);yield*S(e)}function*T(e){for(const t of e)yield V(t,!0);yield*S(e)}function*w(e){let t=-1,n=0;for(const o=e.length;n<o;++n)n in e&&(n>t+1&&(yield $(n-t-1)),yield V(h(e,n),!0),t=n);n>t+1&&(yield $(n-t-1));for(const t in e)!o(t)&&u(e,t)&&(yield L(t,h(e,t),"observablehq--key"));for(const t of p(e))yield L(s(t),h(e,t),"observablehq--symbol")}function*S(e){for(const t in e)u(e,t)&&(yield L(t,h(e,t),"observablehq--key"));for(const t of p(e))yield L(s(t),h(e,t),"observablehq--symbol")}function $(e){const t=document.createElement("span");return t.className="observablehq--empty",t.textContent=1===e?"empty":`empty × ${e}`,t}function L(e,t,n){const o=document.createDocumentFragment(),r=o.appendChild(document.createElement("span"));return r.className=n,r.textContent=e,o.appendChild(document.createTextNode(": ")),o.appendChild(V(t,!0)),o}function k(e,t){const n=document.createDocumentFragment();return n.appendChild(V(e,!0)),n.appendChild(document.createTextNode(" => ")),n.appendChild(V(t,!0)),n}function M(e,t){var n=e+"",o=n.length;return o<t?new Array(t-o+1).join(0)+n:n}function A(e){return e<0?"-"+M(-e,6):e>9999?"+"+M(e,6):M(e,4)}var j=Error.prototype.toString;var U=RegExp.prototype.toString;const F=20;function O(e){return e.replace(/[\\`\x00-\x09\x0b-\x19]|\${/g,D)}function D(e){var t=e.charCodeAt(0);switch(t){case 8:return"\\b";case 9:return"\\t";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r"}return t<16?"\\x0"+t.toString(16):t<32?"\\x"+t.toString(16):"\\"+e}function P(e,t){for(var n=0;t.exec(e);)++n;return n}var z=Function.prototype.toString,_={prefix:"async ƒ"},I={prefix:"async ƒ*"},H={prefix:"class"},B={prefix:"ƒ"},G={prefix:"ƒ*"};function J(e,t,n){var o=document.createElement("span");o.className="observablehq--function",n&&o.appendChild(r(n));var a=o.appendChild(document.createElement("span"));return a.className="observablehq--keyword",a.textContent=e.prefix,o.appendChild(document.createTextNode(t)),o}const{prototype:{toString:R}}=Object;function V(e,t,n,o){let a=typeof e;switch(a){case"boolean":case"undefined":e+="";break;case"number":e=0===e&&1/e<0?"-0":e+"";break;case"bigint":e+="n";break;case"symbol":e=s(e);break;case"function":return function(e,t){var n,o,r=z.call(e);switch(e.constructor&&e.constructor.name){case"AsyncFunction":n=_;break;case"AsyncGeneratorFunction":n=I;break;case"GeneratorFunction":n=G;break;default:n=/^class\b/.test(r)?H:B}return n===H?J(n,"",t):(o=/^(?:async\s*)?(\w+)\s*=>/.exec(r))?J(n,"("+o[1]+")",t):(o=/^(?:async\s*)?\(\s*(\w+(?:\s*,\s*\w+)*)?\s*\)/.exec(r))?J(n,o[1]?"("+o[1].replace(/\s*,\s*/g,", ")+")":"()",t):(o=/^(?:async\s*)?function(?:\s*\*)?(?:\s*\w+)?\s*\(\s*(\w+(?:\s*,\s*\w+)*)?\s*\)/.exec(r))?J(n,o[1]?"("+o[1].replace(/\s*,\s*/g,", ")+")":"()",t):J(n,"(…)",t)}(e,o);case"string":return function(e,t,n,o){if(!1===t){if(P(e,/["\n]/g)<=P(e,/`|\${/g)){const t=document.createElement("span");o&&t.appendChild(r(o));const n=t.appendChild(document.createElement("span"));return n.className="observablehq--string",n.textContent=JSON.stringify(e),t}const a=e.split("\n");if(a.length>F&&!n){const n=document.createElement("div");o&&n.appendChild(r(o));const s=n.appendChild(document.createElement("span"));s.className="observablehq--string",s.textContent="`"+O(a.slice(0,F).join("\n"));const c=n.appendChild(document.createElement("span")),i=a.length-F;return c.textContent=`Show ${i} truncated line${i>1?"s":""}`,c.className="observablehq--string-expand",c.addEventListener("mouseup",function(r){r.stopPropagation(),Y(n,V(e,t,!0,o))}),n}const s=document.createElement("span");o&&s.appendChild(r(o));const c=s.appendChild(document.createElement("span"));return c.className=`observablehq--string${n?" observablehq--expanded":""}`,c.textContent="`"+O(e)+"`",s}const a=document.createElement("span");o&&a.appendChild(r(o));const s=a.appendChild(document.createElement("span"));return s.className="observablehq--string",s.textContent=JSON.stringify(e.length>100?`${e.slice(0,50)}…${e.slice(-49)}`:e),a}(e,t,n,o);default:if(null===e){a=null,e="null";break}if(e instanceof Date){a="date",c=e,e=isNaN(c)?"Invalid Date":function(e){return 0===e.getUTCMilliseconds()&&0===e.getUTCSeconds()&&0===e.getUTCMinutes()&&0===e.getUTCHours()}(c)?A(c.getUTCFullYear())+"-"+M(c.getUTCMonth()+1,2)+"-"+M(c.getUTCDate(),2):A(c.getFullYear())+"-"+M(c.getMonth()+1,2)+"-"+M(c.getDate(),2)+"T"+M(c.getHours(),2)+":"+M(c.getMinutes(),2)+(c.getMilliseconds()?":"+M(c.getSeconds(),2)+"."+M(c.getMilliseconds(),3):c.getSeconds()?":"+M(c.getSeconds(),2):"");break}if(e===d){a="forbidden",e="[forbidden]";break}switch(R.call(e)){case"[object RegExp]":a="regexp",e=function(e){return U.call(e)}(e);break;case"[object Error]":case"[object DOMException]":a="error",e=function(e){return e.stack||j.call(e)}(e);break;default:return(n?m:q)(e,t,o)}}var c;const i=document.createElement("span");o&&i.appendChild(r(o));const l=i.appendChild(document.createElement("span"));return l.className=`observablehq--${a}`,l.textContent=e,i}function Y(e,n){e.classList.contains("observablehq--inspect")&&n.classList.add("observablehq--inspect"),e.parentNode.replaceChild(n,e),t(n,"load")}const K=/\s+\(\d+:\d+\)$/m;class Q{constructor(e){if(!e)throw new Error("invalid node");this._node=e,e.classList.add("observablehq")}pending(){const{_node:e}=this;e.classList.remove("observablehq--error"),e.classList.add("observablehq--running")}fulfilled(e,n){const{_node:o}=this;if((!(e instanceof Element||e instanceof Text)||e.parentNode&&e.parentNode!==o)&&(e=V(e,!1,o.firstChild&&o.firstChild.classList&&o.firstChild.classList.contains("observablehq--expanded"),n)).classList.add("observablehq--inspect"),o.classList.remove("observablehq--running","observablehq--error"),o.firstChild!==e)if(o.firstChild){for(;o.lastChild!==o.firstChild;)o.removeChild(o.lastChild);o.replaceChild(e,o.firstChild)}else o.appendChild(e);t(o,"update")}rejected(e,n){const{_node:o}=this;for(o.classList.remove("observablehq--running"),o.classList.add("observablehq--error");o.lastChild;)o.removeChild(o.lastChild);var a=document.createElement("div");a.className="observablehq--inspect",n&&a.appendChild(r(n)),a.appendChild(document.createTextNode((e+"").replace(K,""))),o.appendChild(a),t(o,"error",{error:e})}}Q.into=function(e){if("string"==typeof e&&null==(e=document.querySelector(e)))throw new Error("container not found");return function(){return new Q(e.appendChild(document.createElement("div")))}},e.Inspector=Q,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "@observablehq/inspector", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"license": "ISC", | ||
@@ -5,0 +5,0 @@ "main": "dist/inspector.js", |
@@ -6,20 +6,25 @@ function pad(value, width) { | ||
function isUTCMidnight(date) { | ||
return date.getUTCMilliseconds() === 0 | ||
&& date.getUTCSeconds() === 0 | ||
&& date.getUTCMinutes() === 0 | ||
&& date.getUTCHours() === 0; | ||
} | ||
function formatYear(year) { | ||
return year < 0 ? "-" + pad(-year, 6) | ||
: year > 9999 ? "+" + pad(year, 6) | ||
: pad(year, 4); | ||
} | ||
export default function formatDate(date) { | ||
return isNaN(date) ? "Invalid Date" | ||
: pad(date.getFullYear(), 4) + "-" | ||
+ pad(date.getMonth() + 1, 2) + "-" | ||
+ pad(date.getDate(), 2) | ||
+ (date.getMilliseconds() ? "T" | ||
+ pad(date.getHours(), 2) + ":" | ||
+ pad(date.getMinutes(), 2) + ":" | ||
+ pad(date.getSeconds(), 2) + "." | ||
+ pad(date.getMilliseconds(), 3) | ||
: date.getSeconds() ? "T" | ||
+ pad(date.getHours(), 2) + ":" | ||
+ pad(date.getMinutes(), 2) + ":" | ||
+ pad(date.getSeconds(), 2) | ||
: date.getMinutes() || date.getHours() ? "T" | ||
+ pad(date.getHours(), 2) + ":" | ||
+ pad(date.getMinutes(), 2) | ||
: ""); | ||
return isNaN(date) | ||
? "Invalid Date" | ||
: isUTCMidnight(date) | ||
? formatYear(date.getUTCFullYear()) + "-" + pad(date.getUTCMonth() + 1, 2) + "-" + pad(date.getUTCDate(), 2) | ||
: formatYear(date.getFullYear()) + "-" + pad(date.getMonth() + 1, 2) + "-" + pad(date.getDate(), 2) | ||
+ "T" + pad(date.getHours(), 2) + ":" + pad(date.getMinutes(), 2) | ||
+ (date.getMilliseconds() ? ":" + pad(date.getSeconds(), 2) + "." + pad(date.getMilliseconds(), 3) | ||
: date.getSeconds() ? ":" + pad(date.getSeconds(), 2) | ||
: ""); | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41038
690