Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@observablehq/inspector

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@observablehq/inspector - npm Package Compare versions

Comparing version 3.0.5 to 3.1.0

src/immutable.js

4

dist/inspector.js

@@ -1,2 +0,2 @@

// @observablehq/inspector v3.0.5 Copyright 2019 Observable, Inc.
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.observablehq=e.observablehq||{})}(this,function(e){"use strict";function n(e,n,t){t=t||{};var o=e.ownerDocument,r=o.defaultView.CustomEvent;"function"==typeof r?r=new r(n,{detail:t}):((r=o.createEvent("Event")).initEvent(n,!1,!1),r.detail=t),e.dispatchEvent(r)}function t(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 n=document.createElement("span");return n.className="observablehq--cellname",n.textContent=`${e} = `,n}const a=Symbol.prototype.toString;function s(e){return a.call(e)}const{getOwnPropertySymbols:c,prototype:{hasOwnProperty:i}}=Object,{toStringTag:l}=Symbol,d={},u=c;function p(e,n){return i.call(e,n)}function f(e){return e[l]||e.constructor&&e.constructor.name||"Object"}function h(e,n){try{const t=e[n];return t&&t.constructor,t}catch(e){return d}}function m(e,o,a){const s=t(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 u=d.appendChild(document.createElement("a"));u.innerHTML="<svg width=8 height=8 class='observablehq--caret'>\n <path d='M4 7L0 1h8z' fill='currentColor' />\n </svg>",u.appendChild(document.createTextNode(`${c}${s?" [":" {"}`)),u.addEventListener("mouseup",function(n){n.stopPropagation(),K(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),n(d,"load")})}return d.appendChild(document.createTextNode(s?"]":"}")),d}function*b(e){for(const[n,t]of e)yield x(n,t);yield*y(e)}function*v(e){for(const n of e)yield E(n);yield*y(e)}function*C(e){for(let n=0,t=e.length;n<t;++n)n in e&&(yield g(n,h(e,n),"observablehq--index"));for(const n in e)!o(n)&&p(e,n)&&(yield g(n,h(e,n),"observablehq--key"));for(const n of u(e))yield g(s(n),h(e,n),"observablehq--symbol")}function*y(e){for(const n in e)p(e,n)&&(yield g(n,h(e,n),"observablehq--key"));for(const n of u(e))yield g(s(n),h(e,n),"observablehq--symbol")}function g(e,n,t){const o=document.createElement("div"),r=o.appendChild(document.createElement("span"));return o.className="observablehq--field",r.className=t,r.textContent=` ${e}`,o.appendChild(document.createTextNode(": ")),o.appendChild(Y(n)),o}function x(e,n){const t=document.createElement("div");return t.className="observablehq--field",t.appendChild(document.createTextNode(" ")),t.appendChild(Y(e)),t.appendChild(document.createTextNode(" => ")),t.appendChild(Y(n)),t}function E(e){const n=document.createElement("div");return n.className="observablehq--field",n.appendChild(document.createTextNode(" ")),n.appendChild(Y(e)),n}function N(e){const n=window.getSelection();return"Range"===n.type&&(n.containsNode(e,!0)||n.anchorNode.isSelfOrDescendant(e)||n.focusNode.isSelfOrDescendant(e))}function q(e,n,o){const a=t(e);let s,c,i;if(e instanceof Map?(s=`Map(${e.size})`,c=S):e instanceof Set?(s=`Set(${e.size})`,c=w):a?(s=`${e.constructor.name}(${e.length})`,c=T):(s=f(e),c=$),n){const n=document.createElement("span");return n.className="observablehq--shallow",o&&n.appendChild(r(o)),n.appendChild(document.createTextNode(s)),n.addEventListener("mouseup",function(t){N(n)||(t.stopPropagation(),K(n,q(e)))}),n}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(n){N(l)||(n.stopPropagation(),K(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*S(e){for(const[n,t]of e)yield M(n,t);yield*$(e)}function*w(e){for(const n of e)yield Y(n,!0);yield*$(e)}function*T(e){let n=-1,t=0;for(const o=e.length;t<o;++t)t in e&&(t>n+1&&(yield L(t-n-1)),yield Y(h(e,t),!0),n=t);t>n+1&&(yield L(t-n-1));for(const n in e)!o(n)&&p(e,n)&&(yield k(n,h(e,n),"observablehq--key"));for(const n of u(e))yield k(s(n),h(e,n),"observablehq--symbol")}function*$(e){for(const n in e)p(e,n)&&(yield k(n,h(e,n),"observablehq--key"));for(const n of u(e))yield k(s(n),h(e,n),"observablehq--symbol")}function L(e){const n=document.createElement("span");return n.className="observablehq--empty",n.textContent=1===e?"empty":`empty × ${e}`,n}function k(e,n,t){const o=document.createDocumentFragment(),r=o.appendChild(document.createElement("span"));return r.className=t,r.textContent=e,o.appendChild(document.createTextNode(": ")),o.appendChild(Y(n,!0)),o}function M(e,n){const t=document.createDocumentFragment();return t.appendChild(Y(e,!0)),t.appendChild(document.createTextNode(" => ")),t.appendChild(Y(n,!0)),t}function A(e,n){var t=e+"",o=t.length;return o<n?new Array(n-o+1).join(0)+t:t}function j(e){return e<0?"-"+A(-e,6):e>9999?"+"+A(e,6):A(e,4)}var O=Error.prototype.toString;var U=RegExp.prototype.toString;const D=20;function F(e){return e.replace(/[\\`\x00-\x09\x0b-\x19]|\${/g,P)}function P(e){var n=e.charCodeAt(0);switch(n){case 8:return"\\b";case 9:return"\\t";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r"}return n<16?"\\x0"+n.toString(16):n<32?"\\x"+n.toString(16):"\\"+e}function z(e,n){for(var t=0;n.exec(e);)++t;return t}var _=Function.prototype.toString,I={prefix:"async ƒ"},H={prefix:"async ƒ*"},R={prefix:"class"},B={prefix:"ƒ"},G={prefix:"ƒ*"};function J(e,n,t){var o=document.createElement("span");o.className="observablehq--function",t&&o.appendChild(r(t));var a=o.appendChild(document.createElement("span"));return a.className="observablehq--keyword",a.textContent=e.prefix,o.appendChild(document.createTextNode(n)),o}const{prototype:{toString:V}}=Object;function Y(e,n,t,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,n){var t,o,r=_.call(e);switch(e.constructor&&e.constructor.name){case"AsyncFunction":t=I;break;case"AsyncGeneratorFunction":t=H;break;case"GeneratorFunction":t=G;break;default:t=/^class\b/.test(r)?R:B}return t===R?J(t,"",n):(o=/^(?:async\s*)?(\w+)\s*=>/.exec(r))?J(t,"("+o[1]+")",n):(o=/^(?:async\s*)?\(\s*(\w+(?:\s*,\s*\w+)*)?\s*\)/.exec(r))?J(t,o[1]?"("+o[1].replace(/\s*,\s*/g,", ")+")":"()",n):(o=/^(?:async\s*)?function(?:\s*\*)?(?:\s*\w+)?\s*\(\s*(\w+(?:\s*,\s*\w+)*)?\s*\)/.exec(r))?J(t,o[1]?"("+o[1].replace(/\s*,\s*/g,", ")+")":"()",n):J(t,"(…)",n)}(e,o);case"string":return function(e,n,t,o){if(!1===n){if(z(e,/["\n]/g)<=z(e,/`|\${/g)){const n=document.createElement("span");o&&n.appendChild(r(o));const t=n.appendChild(document.createElement("span"));return t.className="observablehq--string",t.textContent=JSON.stringify(e),n}const a=e.split("\n");if(a.length>D&&!t){const t=document.createElement("div");o&&t.appendChild(r(o));const s=t.appendChild(document.createElement("span"));s.className="observablehq--string",s.textContent="`"+F(a.slice(0,D).join("\n"));const c=t.appendChild(document.createElement("span")),i=a.length-D;return c.textContent=`Show ${i} truncated line${i>1?"s":""}`,c.className="observablehq--string-expand",c.addEventListener("mouseup",function(r){r.stopPropagation(),K(t,Y(e,n,!0,o))}),t}const s=document.createElement("span");o&&s.appendChild(r(o));const c=s.appendChild(document.createElement("span"));return c.className=`observablehq--string${t?" 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,n,t,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)?j(c.getUTCFullYear())+"-"+A(c.getUTCMonth()+1,2)+"-"+A(c.getUTCDate(),2):j(c.getFullYear())+"-"+A(c.getMonth()+1,2)+"-"+A(c.getDate(),2)+"T"+A(c.getHours(),2)+":"+A(c.getMinutes(),2)+(c.getMilliseconds()?":"+A(c.getSeconds(),2)+"."+A(c.getMilliseconds(),3):c.getSeconds()?":"+A(c.getSeconds(),2):"");break}if(e===d){a="forbidden",e="[forbidden]";break}switch(V.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||O.call(e)}(e);break;default:return(t?m:q)(e,n,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 K(e,t){e.classList.contains("observablehq--inspect")&&t.classList.add("observablehq--inspect"),e.parentNode.replaceChild(t,e),n(t,"load")}const Q=/\s+\(\d+:\d+\)$/m;class W{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,t){const{_node:o}=this;if((!(e instanceof Element||e instanceof Text)||e.parentNode&&e.parentNode!==o)&&(e=Y(e,!1,o.firstChild&&o.firstChild.classList&&o.firstChild.classList.contains("observablehq--expanded"),t)).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);n(o,"update")}rejected(e,t){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",t&&a.appendChild(r(t)),a.appendChild(document.createTextNode((e+"").replace(Q,""))),o.appendChild(a),n(o,"error",{error:e})}}W.into=function(e){if("string"==typeof e&&null==(e=document.querySelector(e)))throw new Error("container not found");return function(){return new W(e.appendChild(document.createElement("div")))}},e.Inspector=W,Object.defineProperty(e,"__esModule",{value:!0})});
// @observablehq/inspector v3.1.0 Copyright 2019 Observable, Inc.
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).observablehq=e.observablehq||{})}(this,function(e){"use strict";function n(e,n,t){t=t||{};var o=e.ownerDocument,r=o.defaultView.CustomEvent;"function"==typeof r?r=new r(n,{detail:t}):((r=o.createEvent("Event")).initEvent(n,!1,!1),r.detail=t),e.dispatchEvent(r)}function t(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 n=document.createElement("span");return n.className="observablehq--cellname",n.textContent=`${e} = `,n}const a=Symbol.prototype.toString;function s(e){return a.call(e)}const{getOwnPropertySymbols:i,prototype:{hasOwnProperty:c}}=Object,{toStringTag:l}=Symbol,d={},u=i;function p(e,n){return c.call(e,n)}function f(e){return e[l]||e.constructor&&e.constructor.name||"Object"}function m(e,n){try{const t=e[n];return t&&t.constructor,t}catch(e){return d}}const h=[{symbol:"@@__IMMUTABLE_INDEXED__@@",name:"Indexed",modifier:!0},{symbol:"@@__IMMUTABLE_KEYED__@@",name:"Keyed",modifier:!0},{symbol:"@@__IMMUTABLE_LIST__@@",name:"List",arrayish:!0},{symbol:"@@__IMMUTABLE_MAP__@@",name:"Map"},{symbol:"@@__IMMUTABLE_ORDERED__@@",name:"Ordered",modifier:!0,prefix:!0},{symbol:"@@__IMMUTABLE_RECORD__@@",name:"Record"},{symbol:"@@__IMMUTABLE_SET__@@",name:"Set",arrayish:!0,setish:!0},{symbol:"@@__IMMUTABLE_STACK__@@",name:"Stack",arrayish:!0}];function b(e){try{let n=h.filter(({symbol:n})=>!0===e[n]);if(!n.length)return;const t=n.find(e=>!e.modifier),o="Map"===t.name&&n.find(e=>e.modifier&&e.prefix),r=n.some(e=>e.arrayish),a=n.some(e=>e.setish);return{name:`${o?o.name:""}${t.name}`,symbols:n,arrayish:r&&!a,setish:a}}catch(e){return null}}function y(e,o,a){let s,i,c,l,d=t(e);e instanceof Map?(s=`Map(${e.size})`,i=v):e instanceof Set?(s=`Set(${e.size})`,i=C):d?(s=`${e.constructor.name}(${e.length})`,i=x):(l=b(e))?(s=`Immutable.${l.name}${"Record"===l.name?"":`(${e.size})`}`,d=l.arrayish,i=l.arrayish?E:l.setish?g:q):(s=f(e),i=N);const u=document.createElement("span");u.className="observablehq--expanded",a&&u.appendChild(r(a));const p=u.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(`${s}${d?" [":" {"}`)),p.addEventListener("mouseup",function(n){n.stopPropagation(),oe(u,$(e,null,a))}),i=i(e);for(let e=0;!(c=i.next()).done&&e<20;++e)u.appendChild(c.value);if(!c.done){const e=u.appendChild(document.createElement("a"));e.className="observablehq--field",e.style.display="block",e.appendChild(document.createTextNode(" … more")),e.addEventListener("mouseup",function(e){e.stopPropagation(),u.insertBefore(c.value,u.lastChild.previousSibling);for(let e=0;!(c=i.next()).done&&e<19;++e)u.insertBefore(c.value,u.lastChild.previousSibling);c.done&&u.removeChild(u.lastChild.previousSibling),n(u,"load")})}return u.appendChild(document.createTextNode(d?"]":"}")),u}function*v(e){for(const[n,t]of e)yield T(n,t);yield*N(e)}function*C(e){for(const n of e)yield M(n);yield*N(e)}function*g(e){for(const n of e)yield M(n)}function*x(e){for(let n=0,t=e.length;n<t;++n)n in e&&(yield _(n,m(e,n),"observablehq--index"));for(const n in e)!o(n)&&p(e,n)&&(yield _(n,m(e,n),"observablehq--key"));for(const n of u(e))yield _(s(n),m(e,n),"observablehq--symbol")}function*E(e){let n=0;for(const t=e.size;n<t;++n)yield _(n,e.get(n),!0)}function*N(e){for(const n in e)p(e,n)&&(yield _(n,m(e,n),"observablehq--key"));for(const n of u(e))yield _(s(n),m(e,n),"observablehq--symbol")}function*q(e){for(const[n,t]of e)yield _(n,t,"observablehq--key")}function _(e,n,t){const o=document.createElement("div"),r=o.appendChild(document.createElement("span"));return o.className="observablehq--field",r.className=t,r.textContent=` ${e}`,o.appendChild(document.createTextNode(": ")),o.appendChild(te(n)),o}function T(e,n){const t=document.createElement("div");return t.className="observablehq--field",t.appendChild(document.createTextNode(" ")),t.appendChild(te(e)),t.appendChild(document.createTextNode(" => ")),t.appendChild(te(n)),t}function M(e){const n=document.createElement("div");return n.className="observablehq--field",n.appendChild(document.createTextNode(" ")),n.appendChild(te(e)),n}function S(e){const n=window.getSelection();return"Range"===n.type&&(n.containsNode(e,!0)||n.anchorNode.isSelfOrDescendant(e)||n.focusNode.isSelfOrDescendant(e))}function $(e,n,o){let a,s,i,c,l=t(e);if(e instanceof Map?(a=`Map(${e.size})`,s=L):e instanceof Set?(a=`Set(${e.size})`,s=w):l?(a=`${e.constructor.name}(${e.length})`,s=U):(c=b(e))?(a=`Immutable.${c.name}${"Record"===c.name?"":`(${e.size})`}`,l=c.arrayish,s=c.arrayish?k:c.setish?A:D):(a=f(e),s=I),n){const n=document.createElement("span");return n.className="observablehq--shallow",o&&n.appendChild(r(o)),n.appendChild(document.createTextNode(a)),n.addEventListener("mouseup",function(t){S(n)||(t.stopPropagation(),oe(n,$(e)))}),n}const d=document.createElement("span");d.className="observablehq--collapsed",o&&d.appendChild(r(o));const u=d.appendChild(document.createElement("a"));u.innerHTML="<svg width=8 height=8 class='observablehq--caret'>\n <path d='M7 4L1 8V0z' fill='currentColor' />\n </svg>",u.appendChild(document.createTextNode(`${a}${l?" [":" {"}`)),d.addEventListener("mouseup",function(n){S(d)||(n.stopPropagation(),oe(d,y(e,0,o)))},!0),s=s(e);for(let e=0;!(i=s.next()).done&&e<20;++e)e>0&&d.appendChild(document.createTextNode(", ")),d.appendChild(i.value);return i.done||d.appendChild(document.createTextNode(", …")),d.appendChild(document.createTextNode(l?"]":"}")),d}function*L(e){for(const[n,t]of e)yield z(n,t);yield*I(e)}function*w(e){for(const n of e)yield te(n,!0);yield*I(e)}function*A(e){for(const n of e)yield te(n,!0)}function*k(e){let n=-1,t=0;for(const o=e.size;t<o;++t)t>n+1&&(yield O(t-n-1)),yield te(e.get(t),!0),n=t;t>n+1&&(yield O(t-n-1))}function*U(e){let n=-1,t=0;for(const o=e.length;t<o;++t)t in e&&(t>n+1&&(yield O(t-n-1)),yield te(m(e,t),!0),n=t);t>n+1&&(yield O(t-n-1));for(const n in e)!o(n)&&p(e,n)&&(yield j(n,m(e,n),"observablehq--key"));for(const n of u(e))yield j(s(n),m(e,n),"observablehq--symbol")}function*I(e){for(const n in e)p(e,n)&&(yield j(n,m(e,n),"observablehq--key"));for(const n of u(e))yield j(s(n),m(e,n),"observablehq--symbol")}function*D(e){for(const[n,t]of e)yield j(n,t,"observablehq--key")}function O(e){const n=document.createElement("span");return n.className="observablehq--empty",n.textContent=1===e?"empty":`empty × ${e}`,n}function j(e,n,t){const o=document.createDocumentFragment(),r=o.appendChild(document.createElement("span"));return r.className=t,r.textContent=e,o.appendChild(document.createTextNode(": ")),o.appendChild(te(n,!0)),o}function z(e,n){const t=document.createDocumentFragment();return t.appendChild(te(e,!0)),t.appendChild(document.createTextNode(" => ")),t.appendChild(te(n,!0)),t}function B(e,n){var t=e+"",o=t.length;return o<n?new Array(n-o+1).join(0)+t:t}function F(e){return e<0?"-"+B(-e,6):e>9999?"+"+B(e,6):B(e,4)}var R=Error.prototype.toString;var P=RegExp.prototype.toString;const H=20;function K(e){return e.replace(/[\\`\x00-\x09\x0b-\x19]|\${/g,Y)}function Y(e){var n=e.charCodeAt(0);switch(n){case 8:return"\\b";case 9:return"\\t";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r"}return n<16?"\\x0"+n.toString(16):n<32?"\\x"+n.toString(16):"\\"+e}function G(e,n){for(var t=0;n.exec(e);)++t;return t}var J=Function.prototype.toString,V={prefix:"async ƒ"},X={prefix:"async ƒ*"},Q={prefix:"class"},W={prefix:"ƒ"},Z={prefix:"ƒ*"};function ee(e,n,t){var o=document.createElement("span");o.className="observablehq--function",t&&o.appendChild(r(t));var a=o.appendChild(document.createElement("span"));return a.className="observablehq--keyword",a.textContent=e.prefix,o.appendChild(document.createTextNode(n)),o}const{prototype:{toString:ne}}=Object;function te(e,n,t,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,n){var t,o,r=J.call(e);switch(e.constructor&&e.constructor.name){case"AsyncFunction":t=V;break;case"AsyncGeneratorFunction":t=X;break;case"GeneratorFunction":t=Z;break;default:t=/^class\b/.test(r)?Q:W}return t===Q?ee(t,"",n):(o=/^(?:async\s*)?(\w+)\s*=>/.exec(r))?ee(t,"("+o[1]+")",n):(o=/^(?:async\s*)?\(\s*(\w+(?:\s*,\s*\w+)*)?\s*\)/.exec(r))?ee(t,o[1]?"("+o[1].replace(/\s*,\s*/g,", ")+")":"()",n):(o=/^(?:async\s*)?function(?:\s*\*)?(?:\s*\w+)?\s*\(\s*(\w+(?:\s*,\s*\w+)*)?\s*\)/.exec(r))?ee(t,o[1]?"("+o[1].replace(/\s*,\s*/g,", ")+")":"()",n):ee(t,"(…)",n)}(e,o);case"string":return function(e,n,t,o){if(!1===n){if(G(e,/["\n]/g)<=G(e,/`|\${/g)){const n=document.createElement("span");o&&n.appendChild(r(o));const t=n.appendChild(document.createElement("span"));return t.className="observablehq--string",t.textContent=JSON.stringify(e),n}const a=e.split("\n");if(a.length>H&&!t){const t=document.createElement("div");o&&t.appendChild(r(o));const s=t.appendChild(document.createElement("span"));s.className="observablehq--string",s.textContent="`"+K(a.slice(0,H).join("\n"));const i=t.appendChild(document.createElement("span")),c=a.length-H;return i.textContent=`Show ${c} truncated line${c>1?"s":""}`,i.className="observablehq--string-expand",i.addEventListener("mouseup",function(r){r.stopPropagation(),oe(t,te(e,n,!0,o))}),t}const s=document.createElement("span");o&&s.appendChild(r(o));const i=s.appendChild(document.createElement("span"));return i.className=`observablehq--string${t?" observablehq--expanded":""}`,i.textContent="`"+K(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,n,t,o);default:if(null===e){a=null,e="null";break}if(e instanceof Date){a="date",i=e,e=isNaN(i)?"Invalid Date":function(e){return 0===e.getUTCMilliseconds()&&0===e.getUTCSeconds()&&0===e.getUTCMinutes()&&0===e.getUTCHours()}(i)?F(i.getUTCFullYear())+"-"+B(i.getUTCMonth()+1,2)+"-"+B(i.getUTCDate(),2):F(i.getFullYear())+"-"+B(i.getMonth()+1,2)+"-"+B(i.getDate(),2)+"T"+B(i.getHours(),2)+":"+B(i.getMinutes(),2)+(i.getMilliseconds()?":"+B(i.getSeconds(),2)+"."+B(i.getMilliseconds(),3):i.getSeconds()?":"+B(i.getSeconds(),2):"");break}if(e===d){a="forbidden",e="[forbidden]";break}switch(ne.call(e)){case"[object RegExp]":a="regexp",e=function(e){return P.call(e)}(e);break;case"[object Error]":case"[object DOMException]":a="error",e=function(e){return e.stack||R.call(e)}(e);break;default:return(t?y:$)(e,n,o)}}var i;const c=document.createElement("span");o&&c.appendChild(r(o));const l=c.appendChild(document.createElement("span"));return l.className=`observablehq--${a}`,l.textContent=e,c}function oe(e,t){e.classList.contains("observablehq--inspect")&&t.classList.add("observablehq--inspect"),e.parentNode.replaceChild(t,e),n(t,"load")}const re=/\s+\(\d+:\d+\)$/m;class ae{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,t){const{_node:o}=this;if((!(e instanceof Element||e instanceof Text)||e.parentNode&&e.parentNode!==o)&&(e=te(e,!1,o.firstChild&&o.firstChild.classList&&o.firstChild.classList.contains("observablehq--expanded"),t)).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);n(o,"update")}rejected(e,t){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",t&&a.appendChild(r(t)),a.appendChild(document.createTextNode((e+"").replace(re,""))),o.appendChild(a),n(o,"error",{error:e})}}ae.into=function(e){if("string"==typeof e&&null==(e=document.querySelector(e)))throw new Error("container not found");return function(){return new ae(e.appendChild(document.createElement("div")))}},e.Inspector=ae,Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "@observablehq/inspector",
"version": "3.0.5",
"version": "3.1.0",
"license": "ISC",

@@ -44,8 +44,9 @@ "main": "dist/inspector.js",

"eslint": "^5.10.0",
"husky": "^1.2.0",
"jest": "^23.6.0",
"rollup": "^0.67.4",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-terser": "^3.0.0"
"husky": "^2.3.0",
"immutable": "^4.0.0-rc.12",
"jest": "^24.8.0",
"rollup": "^1.12.3",
"rollup-plugin-node-resolve": "^5.0.0",
"rollup-plugin-terser": "^5.0.0"
}
}
# @observablehq/inspector
[![CircleCI](https://circleci.com/gh/observablehq/inspector/tree/master.svg?style=svg)](https://circleci.com/gh/observablehq/inspector/tree/master)
[![CircleCI](https://circleci.com/gh/observablehq/inspector/tree/master.svg?style=svg)](https://circleci.com/gh/observablehq/inspector/tree/master) [![Greenkeeper badge](https://badges.greenkeeper.io/observablehq/inspector.svg)](https://greenkeeper.io/)

@@ -5,0 +5,0 @@ This library implements the default value renderer for Observable programs. When used with the [Observable runtime](https://github.com/observablehq/runtime) as [observers](https://github.com/observablehq/runtime/blob/master/README.md#observers), inspectors can insert elements into the DOM and render interactive displays for arbitrary values.

@@ -7,2 +7,3 @@ import {isarray, isindex} from "./array.js";

import {isown, symbolsof, tagof, valueof} from "./object.js";
import {immutableName} from "./immutable.js";

@@ -20,4 +21,4 @@ function hasSelection(elem) {

export default function inspectCollapsed(object, shallow, name) {
const arrayish = isarray(object);
let tag, fields, next;
let arrayish = isarray(object);
let tag, fields, next, n;

@@ -33,2 +34,6 @@ if (object instanceof Map) {

fields = iterateArray;
} else if ((n = immutableName(object))) {
tag = `Immutable.${n.name}${n.name === 'Record' ? '' : `(${object.size})`}`;
arrayish = n.arrayish;
fields = n.arrayish ? iterateImArray : n.setish ? iterateImSet : iterateImObject;
} else {

@@ -96,2 +101,18 @@ tag = tagof(object);

function* iterateImSet(set) {
for (const value of set) {
yield inspect(value, true);
}
}
function* iterateImArray(array) {
let i0 = -1, i1 = 0;
for (const n = array.size; i1 < n; ++i1) {
if (i1 > i0 + 1) yield formatEmpty(i1 - i0 - 1);
yield inspect(array.get(i1), true);
i0 = i1;
}
if (i1 > i0 + 1) yield formatEmpty(i1 - i0 - 1);
}
function* iterateArray(array) {

@@ -128,2 +149,8 @@ let i0 = -1, i1 = 0;

function* iterateImObject(object) {
for (const [key, value] of object) {
yield formatField(key, value, "observablehq--key");
}
}
function formatEmpty(e) {

@@ -130,0 +157,0 @@ const span = document.createElement("span");

@@ -8,6 +8,7 @@ import dispatch from "./dispatch.js";

import {isown, symbolsof, tagof, valueof} from "./object.js";
import {immutableName} from "./immutable.js";
export default function inspectExpanded(object, _, name) {
const arrayish = isarray(object);
let tag, fields, next;
let arrayish = isarray(object);
let tag, fields, next, n;

@@ -23,2 +24,6 @@ if (object instanceof Map) {

fields = iterateArray;
} else if ((n = immutableName(object))) {
tag = `Immutable.${n.name}${n.name === 'Record' ? '' : `(${object.size})`}`;
arrayish = n.arrayish;
fields = n.arrayish ? iterateImArray : n.setish ? iterateImSet : iterateImObject;
} else {

@@ -84,2 +89,8 @@ tag = tagof(object);

function* iterateImSet(set) {
for (const value of set) {
yield formatSetField(value);
}
}
function* iterateArray(array) {

@@ -101,2 +112,9 @@ for (let i = 0, n = array.length; i < n; ++i) {

function* iterateImArray(array) {
let i1 = 0;
for (const n = array.size; i1 < n; ++i1) {
yield formatField(i1, array.get(i1), true);
}
}
function* iterateObject(object) {

@@ -113,2 +131,8 @@ for (const key in object) {

function* iterateImObject(object) {
for (const [key, value] of object) {
yield formatField(key, value, "observablehq--key");
}
}
function formatField(key, value, className) {

@@ -115,0 +139,0 @@ const item = document.createElement("div");

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc