@observablehq/inspector
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -1,2 +0,2 @@ | ||
// @observablehq/inspector v3.0.1 Copyright 2018 Observable, Inc. | ||
// @observablehq/inspector v3.0.2 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(),R(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(J(t)),o}function x(e,t){const n=document.createElement("div");return n.className="observablehq--field",n.appendChild(document.createTextNode(" ")),n.appendChild(J(e)),n.appendChild(document.createTextNode(" => ")),n.appendChild(J(t)),n}function E(e){const t=document.createElement("div");return t.className="observablehq--field",t.appendChild(document.createTextNode(" ")),t.appendChild(J(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(),R(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(),R(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 L(t,n);yield*$(e)}function*w(e){for(const t of e)yield J(t,!0);yield*$(e)}function*S(e){for(let t=-1,n=0,o=e.length;n<o;++n)if(n in e){let o=n-t-1;if(o>0){const e=document.createElement("span");e.className="observablehq--empty",e.textContent=1===o?"empty":`empty × ${n-t-1}`,yield e}yield J(h(e,n),!0),t=n}for(const t in e)!o(t)&&u(e,t)&&(yield T(t,h(e,t),"observablehq--key"));for(const t of p(e))yield T(s(t),h(e,t),"observablehq--symbol")}function*$(e){for(const t in e)u(e,t)&&(yield T(t,h(e,t),"observablehq--key"));for(const t of p(e))yield T(s(t),h(e,t),"observablehq--symbol")}function T(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(J(t,!0)),o}function L(e,t){const n=document.createDocumentFragment();return n.appendChild(J(e,!0)),n.appendChild(document.createTextNode(" => ")),n.appendChild(J(t,!0)),n}function k(e,t){var n=e+"",o=n.length;return o<t?new Array(t-o+1).join(0)+n:n}var M=Error.prototype.toString;var A=RegExp.prototype.toString;const j=20;function F(e){return e.replace(/[\\`\x00-\x09\x0b-\x19]|\${/g,O)}function O(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 D=Function.prototype.toString,z={prefix:"async ƒ"},H={prefix:"async ƒ*"},_={prefix:"class"},I={prefix:"ƒ"},U={prefix:"ƒ*"};function B(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:G}}=Object;function J(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=D.call(e);switch(e.constructor&&e.constructor.name){case"AsyncFunction":n=z;break;case"AsyncGeneratorFunction":n=H;break;case"GeneratorFunction":n=U;break;default:n=/^class\b/.test(r)?_:I}return n===_?B(n,"",t):(o=/^(?:async\s*)?(\w+)\s*=>/.exec(r))?B(n,"("+o[1]+")",t):(o=/^(?:async\s*)?\(\s*(\w+(?:\s*,\s*\w+)*)?\s*\)/.exec(r))?B(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))?B(n,o[1]?"("+o[1].replace(/\s*,\s*/g,", ")+")":"()",t):B(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>j&&!n){const n=document.createElement("div");o&&n.appendChild(r(o));const s=n.appendChild(document.createElement("span"));s.className="observablehq--string",s.textContent="`"+F(a.slice(0,j).join("\n"));const c=n.appendChild(document.createElement("span")),i=a.length-j;return c.textContent=`Show ${i} truncated line${i>1?"s":""}`,c.className="observablehq--string-expand",c.addEventListener("mouseup",function(r){r.stopPropagation(),R(n,J(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="`"+F(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":k(c.getFullYear(),4)+"-"+k(c.getMonth()+1,2)+"-"+k(c.getDate(),2)+(c.getMilliseconds()?"T"+k(c.getHours(),2)+":"+k(c.getMinutes(),2)+":"+k(c.getSeconds(),2)+"."+k(c.getMilliseconds(),3):c.getSeconds()?"T"+k(c.getHours(),2)+":"+k(c.getMinutes(),2)+":"+k(c.getSeconds(),2):c.getMinutes()||c.getHours()?"T"+k(c.getHours(),2)+":"+k(c.getMinutes(),2):"");break}if(e===d){a="forbidden",e="[forbidden]";break}switch(G.call(e)){case"[object RegExp]":a="regexp",e=function(e){return A.call(e)}(e);break;case"[object Error]":case"[object DOMException]":a="error",e=function(e){return e.stack||M.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 R(e,n){e.classList.contains("observablehq--inspect")&&n.classList.add("observablehq--inspect"),e.parentNode.replaceChild(n,e),t(n,"load")}const V=/\s+\(\d+:\d+\)$/m;class Y{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=J(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(V,""))),o.appendChild(a),t(o,"error",{error:e})}}Y.into=function(e){if("string"==typeof e&&null==(e=document.querySelector(e)))throw new Error("container not found");return function(){return new Y(e.appendChild(document.createElement("div")))}},e.Inspector=Y,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "@observablehq/inspector", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"license": "ISC", | ||
@@ -33,6 +33,6 @@ "main": "dist/inspector.js", | ||
"files": [ | ||
"src/**.css", | ||
"src/**.js", | ||
"dist/**.css", | ||
"dist/**.js" | ||
"src/**/*.css", | ||
"src/**/*.js", | ||
"dist/**/*.css", | ||
"dist/**/*.js" | ||
], | ||
@@ -39,0 +39,0 @@ "dependencies": { |
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
40613