@observablehq/stdlib
Advanced tools
Comparing version 3.4.0 to 3.4.1
@@ -1,2 +0,2 @@ | ||
// @observablehq/stdlib v3.4.0 Copyright 2020 Observable, Inc. | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).observablehq=e.observablehq||{})}(this,(function(e){"use strict";const t=new Map,n=[],r=n.map,o=n.some,i=n.hasOwnProperty,a="https://cdn.jsdelivr.net/npm/",u=/^((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?(?:\/(.*))?$/,l=/^\d+\.\d+\.\d+(-[\w-.+]+)?$/,s=/\.[^/]*$/,c=["unpkg","jsdelivr","browser","main"];class RequireError extends Error{constructor(e){super(e)}}function f(e){const t=u.exec(e);return t&&{name:t[1],version:t[2],path:t[3]}}function d(e){const n=`${a}${e.name}${e.version?`@${e.version}`:""}/package.json`;let r=t.get(n);return r||t.set(n,r=fetch(n).then(e=>{if(!e.ok)throw new RequireError("unable to load package.json");return e.redirected&&!t.has(e.url)&&t.set(e.url,r),e.json()})),r}RequireError.prototype.name=RequireError.name;var m=h((async function(e,t){if(e.startsWith(a)&&(e=e.substring(a.length)),/^(\w+:)|\/\//i.test(e))return e;if(/^[.]{0,2}\//i.test(e))return new URL(e,null==t?location:t).href;if(!e.length||/^[\s._]/.test(e)||/\s$/.test(e))throw new RequireError("illegal name");const n=f(e);if(!n)return`${a}${e}`;if(!n.version&&null!=t&&t.startsWith(a)){const e=await d(f(t.substring(a.length)));n.version=e.dependencies&&e.dependencies[n.name]||e.peerDependencies&&e.peerDependencies[n.name]}if(n.path&&!s.test(n.path)&&(n.path+=".js"),n.path&&n.version&&l.test(n.version))return`${a}${n.name}@${n.version}/${n.path}`;const r=await d(n);return`${a}${r.name}@${r.version}/${n.path||function(e){for(const t of c){const n=e[t];if("string"==typeof n)return s.test(n)?n:`${n}.js`}}(r)||"index.js"}`}));function h(e){const t=new Map,o=a(null);function i(e){if("string"!=typeof e)return e;let r=t.get(e);return r||t.set(e,r=new Promise((t,r)=>{const o=document.createElement("script");o.onload=()=>{try{t(n.pop()(a(e)))}catch(e){r(new RequireError("invalid module"))}o.remove()},o.onerror=()=>{r(new RequireError("unable to load module")),o.remove()},o.async=!0,o.src=e,window.define=b,document.head.appendChild(o)})),r}function a(t){return n=>Promise.resolve(e(n,t)).then(i)}function u(e){return arguments.length>1?Promise.all(r.call(arguments,o)).then(w):o(e)}return u.alias=function(t){return h((n,r)=>n in t&&(r=null,"string"!=typeof(n=t[n]))?n:e(n,r))},u.resolve=e,u}function w(e){const t={};for(const n of e)for(const e in n)i.call(n,e)&&(null==n[e]?Object.defineProperty(t,e,{get:v(n,e)}):t[e]=n[e]);return t}function v(e,t){return()=>e[t]}function p(e){return"exports"===(e+="")||"module"===e}function b(e,t,i){const a=arguments.length;a<2?(i=e,t=[]):a<3&&(i=t,t="string"==typeof e?[]:e),n.push(o.call(t,p)?e=>{const n={},o={exports:n};return Promise.all(r.call(t,t=>"exports"===(t+="")?n:"module"===t?o:e(t))).then(e=>(i.apply(null,e),o.exports))}:e=>Promise.all(r.call(t,e)).then(e=>"function"==typeof i?i.apply(null,e):i))}async function g(e){const t=await fetch(await e.url());if(!t.ok)throw new Error(`Unable to load file: ${e.name}`);return t}async function y(e,t,{array:n=!1,typed:r=!1}={}){const[o,i]=await Promise.all([e.text(),m("d3-dsv@2.0.0/dist/d3-dsv.min.js")]);return("\t"===t?n?i.tsvParseRows:i.tsvParse:n?i.csvParseRows:i.csvParse)(o,r&&i.autoType)}b.amd={};class x{constructor(e,t){Object.defineProperties(this,{_url:{value:e},name:{value:t,enumerable:!0}})}async url(){return await this._url+""}async blob(){return(await g(this)).blob()}async arrayBuffer(){return(await g(this)).arrayBuffer()}async text(){return(await g(this)).text()}async json(){return(await g(this)).json()}async stream(){return(await g(this)).body}async csv(e){return y(this,",",e)}async tsv(e){return y(this,"\t",e)}async image(){const e=await this.url();return new Promise((t,n)=>{const r=new Image;new URL(e,document.baseURI).origin!==new URL(location).origin&&(r.crossOrigin="anonymous"),r.onload=()=>t(r),r.onerror=()=>n(new Error(`Unable to load file: ${this.name}`)),r.src=e})}}function E(e){throw new Error(`File not found: ${e}`)}function P(e){return function(){return e}}var j={math:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};var k=0;function L(e){this.id=e,this.href=new URL(`#${e}`,location)+""}L.prototype.toString=function(){return"url("+this.href+")"};var $={canvas:function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,n},context2d:function(e,t,n){null==n&&(n=devicePixelRatio);var r=document.createElement("canvas");r.width=e*n,r.height=t*n,r.style.width=e+"px";var o=r.getContext("2d");return o.scale(n,n),o},download:function(e,t="untitled",n="Save"){const r=document.createElement("a"),o=r.appendChild(document.createElement("button"));async function i(){await new Promise(requestAnimationFrame),URL.revokeObjectURL(r.href),r.removeAttribute("href"),o.textContent=n,o.disabled=!1}return o.textContent=n,r.download=t,r.onclick=async t=>{if(o.disabled=!0,r.href)return i();o.textContent="Saving…";try{const t=await("function"==typeof e?e():e);o.textContent="Download",r.href=URL.createObjectURL(t)}catch(e){o.textContent=n}if(t.eventPhase)return i();o.disabled=!1},r},element:function(e,t){var n,r=e+="",o=r.indexOf(":");o>=0&&"xmlns"!==(r=e.slice(0,o))&&(e=e.slice(o+1));var i=j.hasOwnProperty(r)?document.createElementNS(j[r],e):document.createElement(e);if(t)for(var a in t)o=(r=a).indexOf(":"),n=t[a],o>=0&&"xmlns"!==(r=a.slice(0,o))&&(a=a.slice(o+1)),j.hasOwnProperty(r)?i.setAttributeNS(j[r],a,n):i.setAttribute(a,n);return i},input:function(e){var t=document.createElement("input");return null!=e&&(t.type=e),t},range:function(e,t,n){1===arguments.length&&(t=e,e=null);var r=document.createElement("input");return r.min=e=null==e?0:+e,r.max=t=null==t?1:+t,r.step=null==n?"any":n=+n,r.type="range",r},select:function(e){var t=document.createElement("select");return Array.prototype.forEach.call(e,(function(e){var n=document.createElement("option");n.value=n.textContent=e,t.appendChild(n)})),t},svg:function(e,t){var n=document.createElementNS("http://www.w3.org/2000/svg","svg");return n.setAttribute("viewBox",[0,0,e,t]),n.setAttribute("width",e),n.setAttribute("height",t),n},text:function(e){return document.createTextNode(e)},uid:function(e){return new L("O-"+(null==e?"":e+"-")+ ++k)}};var A={buffer:function(e){return new Promise((function(t,n){var r=new FileReader;r.onload=function(){t(r.result)},r.onerror=n,r.readAsArrayBuffer(e)}))},text:function(e){return new Promise((function(t,n){var r=new FileReader;r.onload=function(){t(r.result)},r.onerror=n,r.readAsText(e)}))},url:function(e){return new Promise((function(t,n){var r=new FileReader;r.onload=function(){t(r.result)},r.onerror=n,r.readAsDataURL(e)}))}};function O(){return this}function N(e,t){let n=!1;if("function"!=typeof t)throw new Error("dispose is not a function");return{[Symbol.iterator]:O,next:()=>n?{done:!0}:(n=!0,{done:!1,value:e}),return:()=>(n=!0,t(e),{done:!0}),throw:()=>({done:n=!0})}}function R(e){let t,n,r=!1;const o=e((function(e){n?(n(e),n=null):r=!0;return t=e}));if(null!=o&&"function"!=typeof o)throw new Error("function"==typeof o.then?"async initializers are not supported":"initializer returned something, but not a dispose function");return{[Symbol.iterator]:O,throw:()=>({done:!0}),return:()=>(null!=o&&o(),{done:!0}),next:function(){return{done:!1,value:r?(r=!1,Promise.resolve(t)):new Promise(e=>n=e)}}}}function C(e){switch(e.type){case"range":case"number":return e.valueAsNumber;case"date":return e.valueAsDate;case"checkbox":return e.checked;case"file":return e.multiple?e.files:e.files[0];case"select-multiple":return Array.from(e.selectedOptions,e=>e.value);default:return e.value}}var M={disposable:N,filter:function*(e,t){for(var n,r=-1;!(n=e.next()).done;)t(n.value,++r)&&(yield n.value)},input:function(e){return R((function(t){var n=function(e){switch(e.type){case"button":case"submit":case"checkbox":return"click";case"file":return"change";default:return"input"}}(e),r=C(e);function o(){t(C(e))}return e.addEventListener(n,o),void 0!==r&&t(r),function(){e.removeEventListener(n,o)}}))},map:function*(e,t){for(var n,r=-1;!(n=e.next()).done;)yield t(n.value,++r)},observe:R,queue:function(e){let t;const n=[],r=e((function(e){n.push(e),t&&(t(n.shift()),t=null);return e}));if(null!=r&&"function"!=typeof r)throw new Error("function"==typeof r.then?"async initializers are not supported":"initializer returned something, but not a dispose function");return{[Symbol.iterator]:O,throw:()=>({done:!0}),return:()=>(null!=r&&r(),{done:!0}),next:function(){return{done:!1,value:n.length?Promise.resolve(n.shift()):new Promise(e=>t=e)}}}},range:function*(e,t,n){e=+e,t=+t,n=(o=arguments.length)<2?(t=e,e=0,1):o<3?1:+n;for(var r=-1,o=0|Math.max(0,Math.ceil((t-e)/n));++r<o;)yield e+r*n},valueAt:function(e,t){if(!(!isFinite(t=+t)||t<0||t!=t|0))for(var n,r=-1;!(n=e.next()).done;)if(++r===t)return n.value},worker:function(e){const t=URL.createObjectURL(new Blob([e],{type:"text/javascript"})),n=new Worker(t);return N(n,()=>{n.terminate(),URL.revokeObjectURL(t)})}};function U(e,t){return function(n){var r,o,i,a,u,l,s,c,f=n[0],d=[],m=null,h=-1;for(u=1,l=arguments.length;u<l;++u){if((r=arguments[u])instanceof Node)d[++h]=r,f+="\x3c!--o:"+h+"--\x3e";else if(Array.isArray(r)){for(s=0,c=r.length;s<c;++s)(o=r[s])instanceof Node?(null===m&&(d[++h]=m=document.createDocumentFragment(),f+="\x3c!--o:"+h+"--\x3e"),m.appendChild(o)):(m=null,f+=o);m=null}else f+=r;f+=n[u]}if(m=e(f),++h>0){for(i=new Array(h),a=document.createTreeWalker(m,NodeFilter.SHOW_COMMENT,null,!1);a.nextNode();)o=a.currentNode,/^o:/.test(o.nodeValue)&&(i[+o.nodeValue.slice(2)]=o);for(u=0;u<h;++u)(o=i[u])&&o.parentNode.replaceChild(d[u],o)}return 1===m.childNodes.length?m.removeChild(m.firstChild):11===m.nodeType?((o=t()).appendChild(m),o):m}}var S=U((function(e){var t=document.createElement("template");return t.innerHTML=e.trim(),document.importNode(t.content,!0)}),(function(){return document.createElement("span")}));const F="https://cdn.jsdelivr.net/npm/@observablehq/highlight.js@2.0.0/";function T(e){return function(){return e("marked@0.3.12/marked.min.js").then((function(t){return U((function(n){var r=document.createElement("div");r.innerHTML=t(n,{langPrefix:""}).trim();var o=r.querySelectorAll("pre code[class]");return o.length>0&&e(F+"highlight.min.js").then((function(t){o.forEach((function(n){function r(){t.highlightBlock(n),n.parentNode.classList.add("observablehq--md-pre")}t.getLanguage(n.className)?r():e(F+"async-languages/index.js").then(r=>{if(r.has(n.className))return e(F+"async-languages/"+r.get(n.className)).then(e=>{t.registerLanguage(n.className,e)})}).then(r,r)}))})),r}),(function(){return document.createElement("div")}))}))}}function q(e){let t;Object.defineProperties(this,{generator:{value:R(e=>{t=e})},value:{get:()=>e,set:n=>t(e=n)}}),void 0!==e&&t(e)}function*D(){for(;;)yield Date.now()}var W=new Map;function _(e,t){var n;return(n=W.get(e=+e))?n.then(P(t)):(n=Date.now())>=e?Promise.resolve(t):function(e,t){var n=new Promise((function(n){W.delete(t);var r=t-e;if(!(r>0))throw new Error("invalid time");if(r>2147483647)throw new Error("too long to wait");setTimeout(n,r)}));return W.set(t,n),n}(n,e).then(P(t))}var z={delay:function(e,t){return new Promise((function(n){setTimeout((function(){n(t)}),e)}))},tick:function(e,t){return _(Math.ceil((Date.now()+1)/e)*e,t)},when:_};function B(e,t){if(/^(\w+:)|\/\//i.test(e))return e;if(/^[.]{0,2}\//i.test(e))return new URL(e,null==t?location:t).href;if(!e.length||/^[\s._]/.test(e)||/\s$/.test(e))throw new Error("illegal name");return"https://unpkg.com/"+e}function H(e){return null==e?m:h(e)}var I=U((function(e){var t=document.createElementNS("http://www.w3.org/2000/svg","g");return t.innerHTML=e.trim(),t}),(function(){return document.createElementNS("http://www.w3.org/2000/svg","g")})),V=String.raw;function G(e){return new Promise((function(t,n){var r=document.createElement("link");r.rel="stylesheet",r.href=e,r.onerror=n,r.onload=t,document.head.appendChild(r)}))}function X(e){return function(){return Promise.all([e("@observablehq/katex@0.11.1/dist/katex.min.js"),e.resolve("@observablehq/katex@0.11.1/dist/katex.min.css").then(G)]).then((function(e){var t=e[0],n=r();function r(e){return function(){var n=document.createElement("div");return t.render(V.apply(String,arguments),n,e),n.removeChild(n.firstChild)}}return n.options=r,n.block=r({displayMode:!0}),n}))}}function J(){return R((function(e){var t=e(document.body.clientWidth);function n(){var n=document.body.clientWidth;n!==t&&e(t=n)}return window.addEventListener("resize",n),function(){window.removeEventListener("resize",n)}}))}var K=Object.assign((function(e){const t=H(e);Object.defineProperties(this,{DOM:{value:$,writable:!0,enumerable:!0},FileAttachment:{value:P(E),writable:!0,enumerable:!0},Files:{value:A,writable:!0,enumerable:!0},Generators:{value:M,writable:!0,enumerable:!0},html:{value:P(S),writable:!0,enumerable:!0},md:{value:T(t),writable:!0,enumerable:!0},Mutable:{value:P(q),writable:!0,enumerable:!0},now:{value:D,writable:!0,enumerable:!0},Promises:{value:z,writable:!0,enumerable:!0},require:{value:P(t),writable:!0,enumerable:!0},resolve:{value:P(B),writable:!0,enumerable:!0},svg:{value:P(I),writable:!0,enumerable:!0},tex:{value:X(t),writable:!0,enumerable:!0},width:{value:J,writable:!0,enumerable:!0}})}),{resolve:m.resolve});e.FileAttachments=function(e){return Object.assign(t=>{const n=e(t+="");if(null==n)throw new Error(`File not found: ${t}`);return new x(n,t)},{prototype:x.prototype})},e.Library=K,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
// @observablehq/stdlib v3.4.1 Copyright 2021 Observable, Inc. | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).observablehq=e.observablehq||{})}(this,(function(e){"use strict";const t=new Map,n=[],r=n.map,o=n.some,i=n.hasOwnProperty,a="https://cdn.jsdelivr.net/npm/",u=/^((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?(?:\/(.*))?$/,l=/^\d+\.\d+\.\d+(-[\w-.+]+)?$/,s=/\.[^/]*$/,c=["unpkg","jsdelivr","browser","main"];class RequireError extends Error{constructor(e){super(e)}}function f(e){const t=u.exec(e);return t&&{name:t[1],version:t[2],path:t[3]}}function d(e){const n=`${a}${e.name}${e.version?`@${e.version}`:""}/package.json`;let r=t.get(n);return r||t.set(n,r=fetch(n).then((e=>{if(!e.ok)throw new RequireError("unable to load package.json");return e.redirected&&!t.has(e.url)&&t.set(e.url,r),e.json()}))),r}RequireError.prototype.name=RequireError.name;var m=h((async function(e,t){if(e.startsWith(a)&&(e=e.substring(a.length)),/^(\w+:)|\/\//i.test(e))return e;if(/^[.]{0,2}\//i.test(e))return new URL(e,null==t?location:t).href;if(!e.length||/^[\s._]/.test(e)||/\s$/.test(e))throw new RequireError("illegal name");const n=f(e);if(!n)return`${a}${e}`;if(!n.version&&null!=t&&t.startsWith(a)){const e=await d(f(t.substring(a.length)));n.version=e.dependencies&&e.dependencies[n.name]||e.peerDependencies&&e.peerDependencies[n.name]}if(n.path&&!s.test(n.path)&&(n.path+=".js"),n.path&&n.version&&l.test(n.version))return`${a}${n.name}@${n.version}/${n.path}`;const r=await d(n);return`${a}${r.name}@${r.version}/${n.path||function(e){for(const t of c){const n=e[t];if("string"==typeof n)return s.test(n)?n:`${n}.js`}}(r)||"index.js"}`}));function h(e){const t=new Map,o=a(null);function i(e){if("string"!=typeof e)return e;let r=t.get(e);return r||t.set(e,r=new Promise(((t,r)=>{const o=document.createElement("script");o.onload=()=>{try{t(n.pop()(a(e)))}catch(e){r(new RequireError("invalid module"))}o.remove()},o.onerror=()=>{r(new RequireError("unable to load module")),o.remove()},o.async=!0,o.src=e,window.define=b,document.head.appendChild(o)}))),r}function a(t){return n=>Promise.resolve(e(n,t)).then(i)}function u(e){return arguments.length>1?Promise.all(r.call(arguments,o)).then(w):o(e)}return u.alias=function(t){return h(((n,r)=>n in t&&(r=null,"string"!=typeof(n=t[n]))?n:e(n,r)))},u.resolve=e,u}function w(e){const t={};for(const n of e)for(const e in n)i.call(n,e)&&(null==n[e]?Object.defineProperty(t,e,{get:v(n,e)}):t[e]=n[e]);return t}function v(e,t){return()=>e[t]}function p(e){return"exports"===(e+="")||"module"===e}function b(e,t,i){const a=arguments.length;a<2?(i=e,t=[]):a<3&&(i=t,t="string"==typeof e?[]:e),n.push(o.call(t,p)?e=>{const n={},o={exports:n};return Promise.all(r.call(t,(t=>"exports"===(t+="")?n:"module"===t?o:e(t)))).then((e=>(i.apply(null,e),o.exports)))}:e=>Promise.all(r.call(t,e)).then((e=>"function"==typeof i?i.apply(null,e):i)))}async function g(e){const t=await fetch(await e.url());if(!t.ok)throw new Error(`Unable to load file: ${e.name}`);return t}async function y(e,t,{array:n=!1,typed:r=!1}={}){const[o,i]=await Promise.all([e.text(),m("d3-dsv@2.0.0/dist/d3-dsv.min.js")]);return("\t"===t?n?i.tsvParseRows:i.tsvParse:n?i.csvParseRows:i.csvParse)(o,r&&i.autoType)}b.amd={};class x{constructor(e,t){Object.defineProperties(this,{_url:{value:e},name:{value:t,enumerable:!0}})}async url(){return await this._url+""}async blob(){return(await g(this)).blob()}async arrayBuffer(){return(await g(this)).arrayBuffer()}async text(){return(await g(this)).text()}async json(){return(await g(this)).json()}async stream(){return(await g(this)).body}async csv(e){return y(this,",",e)}async tsv(e){return y(this,"\t",e)}async image(){const e=await this.url();return new Promise(((t,n)=>{const r=new Image;new URL(e,document.baseURI).origin!==new URL(location).origin&&(r.crossOrigin="anonymous"),r.onload=()=>t(r),r.onerror=()=>n(new Error(`Unable to load file: ${this.name}`)),r.src=e}))}}function E(e){throw new Error(`File not found: ${e}`)}function P(e){return function(){return e}}var j={math:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};var k=0;function L(e){this.id=e,this.href=new URL(`#${e}`,location)+""}L.prototype.toString=function(){return"url("+this.href+")"};var $={canvas:function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,n},context2d:function(e,t,n){null==n&&(n=devicePixelRatio);var r=document.createElement("canvas");r.width=e*n,r.height=t*n,r.style.width=e+"px";var o=r.getContext("2d");return o.scale(n,n),o},download:function(e,t="untitled",n="Save"){const r=document.createElement("a"),o=r.appendChild(document.createElement("button"));async function i(){await new Promise(requestAnimationFrame),URL.revokeObjectURL(r.href),r.removeAttribute("href"),o.textContent=n,o.disabled=!1}return o.textContent=n,r.download=t,r.onclick=async t=>{if(o.disabled=!0,r.href)return i();o.textContent="Saving…";try{const t=await("function"==typeof e?e():e);o.textContent="Download",r.href=URL.createObjectURL(t)}catch(e){o.textContent=n}if(t.eventPhase)return i();o.disabled=!1},r},element:function(e,t){var n,r=e+="",o=r.indexOf(":");o>=0&&"xmlns"!==(r=e.slice(0,o))&&(e=e.slice(o+1));var i=j.hasOwnProperty(r)?document.createElementNS(j[r],e):document.createElement(e);if(t)for(var a in t)o=(r=a).indexOf(":"),n=t[a],o>=0&&"xmlns"!==(r=a.slice(0,o))&&(a=a.slice(o+1)),j.hasOwnProperty(r)?i.setAttributeNS(j[r],a,n):i.setAttribute(a,n);return i},input:function(e){var t=document.createElement("input");return null!=e&&(t.type=e),t},range:function(e,t,n){1===arguments.length&&(t=e,e=null);var r=document.createElement("input");return r.min=e=null==e?0:+e,r.max=t=null==t?1:+t,r.step=null==n?"any":n=+n,r.type="range",r},select:function(e){var t=document.createElement("select");return Array.prototype.forEach.call(e,(function(e){var n=document.createElement("option");n.value=n.textContent=e,t.appendChild(n)})),t},svg:function(e,t){var n=document.createElementNS("http://www.w3.org/2000/svg","svg");return n.setAttribute("viewBox",[0,0,e,t]),n.setAttribute("width",e),n.setAttribute("height",t),n},text:function(e){return document.createTextNode(e)},uid:function(e){return new L("O-"+(null==e?"":e+"-")+ ++k)}};var A={buffer:function(e){return new Promise((function(t,n){var r=new FileReader;r.onload=function(){t(r.result)},r.onerror=n,r.readAsArrayBuffer(e)}))},text:function(e){return new Promise((function(t,n){var r=new FileReader;r.onload=function(){t(r.result)},r.onerror=n,r.readAsText(e)}))},url:function(e){return new Promise((function(t,n){var r=new FileReader;r.onload=function(){t(r.result)},r.onerror=n,r.readAsDataURL(e)}))}};function O(){return this}function N(e,t){let n=!1;if("function"!=typeof t)throw new Error("dispose is not a function");return{[Symbol.iterator]:O,next:()=>n?{done:!0}:(n=!0,{done:!1,value:e}),return:()=>(n=!0,t(e),{done:!0}),throw:()=>({done:n=!0})}}function R(e){let t,n,r=!1;const o=e((function(e){n?(n(e),n=null):r=!0;return t=e}));if(null!=o&&"function"!=typeof o)throw new Error("function"==typeof o.then?"async initializers are not supported":"initializer returned something, but not a dispose function");return{[Symbol.iterator]:O,throw:()=>({done:!0}),return:()=>(null!=o&&o(),{done:!0}),next:function(){return{done:!1,value:r?(r=!1,Promise.resolve(t)):new Promise((e=>n=e))}}}}function C(e){switch(e.type){case"range":case"number":return e.valueAsNumber;case"date":return e.valueAsDate;case"checkbox":return e.checked;case"file":return e.multiple?e.files:e.files[0];case"select-multiple":return Array.from(e.selectedOptions,(e=>e.value));default:return e.value}}var M={disposable:N,filter:function*(e,t){for(var n,r=-1;!(n=e.next()).done;)t(n.value,++r)&&(yield n.value)},input:function(e){return R((function(t){var n=function(e){switch(e.type){case"button":case"submit":case"checkbox":return"click";case"file":return"change";default:return"input"}}(e),r=C(e);function o(){t(C(e))}return e.addEventListener(n,o),void 0!==r&&t(r),function(){e.removeEventListener(n,o)}}))},map:function*(e,t){for(var n,r=-1;!(n=e.next()).done;)yield t(n.value,++r)},observe:R,queue:function(e){let t;const n=[],r=e((function(e){n.push(e),t&&(t(n.shift()),t=null);return e}));if(null!=r&&"function"!=typeof r)throw new Error("function"==typeof r.then?"async initializers are not supported":"initializer returned something, but not a dispose function");return{[Symbol.iterator]:O,throw:()=>({done:!0}),return:()=>(null!=r&&r(),{done:!0}),next:function(){return{done:!1,value:n.length?Promise.resolve(n.shift()):new Promise((e=>t=e))}}}},range:function*(e,t,n){e=+e,t=+t,n=(o=arguments.length)<2?(t=e,e=0,1):o<3?1:+n;for(var r=-1,o=0|Math.max(0,Math.ceil((t-e)/n));++r<o;)yield e+r*n},valueAt:function(e,t){if(!(!isFinite(t=+t)||t<0||t!=t|0))for(var n,r=-1;!(n=e.next()).done;)if(++r===t)return n.value},worker:function(e){const t=URL.createObjectURL(new Blob([e],{type:"text/javascript"})),n=new Worker(t);return N(n,(()=>{n.terminate(),URL.revokeObjectURL(t)}))}};function U(e,t){return function(n){var r,o,i,a,u,l,s,c,f=n[0],d=[],m=null,h=-1;for(u=1,l=arguments.length;u<l;++u){if((r=arguments[u])instanceof Node)d[++h]=r,f+="\x3c!--o:"+h+"--\x3e";else if(Array.isArray(r)){for(s=0,c=r.length;s<c;++s)(o=r[s])instanceof Node?(null===m&&(d[++h]=m=document.createDocumentFragment(),f+="\x3c!--o:"+h+"--\x3e"),m.appendChild(o)):(m=null,f+=o);m=null}else f+=r;f+=n[u]}if(m=e(f),++h>0){for(i=new Array(h),a=document.createTreeWalker(m,NodeFilter.SHOW_COMMENT,null,!1);a.nextNode();)o=a.currentNode,/^o:/.test(o.nodeValue)&&(i[+o.nodeValue.slice(2)]=o);for(u=0;u<h;++u)(o=i[u])&&o.parentNode.replaceChild(d[u],o)}return 1===m.childNodes.length?m.removeChild(m.firstChild):11===m.nodeType?((o=t()).appendChild(m),o):m}}var S=U((function(e){var t=document.createElement("template");return t.innerHTML=e.trim(),document.importNode(t.content,!0)}),(function(){return document.createElement("span")}));const T="https://cdn.jsdelivr.net/npm/@observablehq/highlight.js@2.0.0/";function F(e){return function(){return e("marked@0.3.12/marked.min.js").then((function(t){return U((function(n){var r=document.createElement("div");r.innerHTML=t(n,{langPrefix:""}).trim();var o=r.querySelectorAll("pre code[class]");return o.length>0&&e(T+"highlight.min.js").then((function(t){o.forEach((function(n){function r(){t.highlightBlock(n),n.parentNode.classList.add("observablehq--md-pre")}t.getLanguage(n.className)?r():e(T+"async-languages/index.js").then((r=>{if(r.has(n.className))return e(T+"async-languages/"+r.get(n.className)).then((e=>{t.registerLanguage(n.className,e)}))})).then(r,r)}))})),r}),(function(){return document.createElement("div")}))}))}}function q(e){let t;Object.defineProperties(this,{generator:{value:R((e=>{t=e}))},value:{get:()=>e,set:n=>t(e=n)}}),void 0!==e&&t(e)}function*D(){for(;;)yield Date.now()}var W=new Map;function _(e,t){var n;return(n=W.get(e=+e))?n.then(P(t)):(n=Date.now())>=e?Promise.resolve(t):function(e,t){var n=new Promise((function(n){W.delete(t);var r=t-e;if(!(r>0))throw new Error("invalid time");if(r>2147483647)throw new Error("too long to wait");setTimeout(n,r)}));return W.set(t,n),n}(n,e).then(P(t))}var z={delay:function(e,t){return new Promise((function(n){setTimeout((function(){n(t)}),e)}))},tick:function(e,t){return _(Math.ceil((Date.now()+1)/e)*e,t)},when:_};function B(e,t){if(/^(\w+:)|\/\//i.test(e))return e;if(/^[.]{0,2}\//i.test(e))return new URL(e,null==t?location:t).href;if(!e.length||/^[\s._]/.test(e)||/\s$/.test(e))throw new Error("illegal name");return"https://unpkg.com/"+e}function H(e){return null==e?m:h(e)}var I=U((function(e){var t=document.createElementNS("http://www.w3.org/2000/svg","g");return t.innerHTML=e.trim(),t}),(function(){return document.createElementNS("http://www.w3.org/2000/svg","g")})),V=String.raw;function G(e){return new Promise((function(t,n){var r=document.createElement("link");r.rel="stylesheet",r.href=e,r.onerror=n,r.onload=t,document.head.appendChild(r)}))}function X(e){return function(){return Promise.all([e("@observablehq/katex@0.11.1/dist/katex.min.js"),e.resolve("@observablehq/katex@0.11.1/dist/katex.min.css").then(G)]).then((function(e){var t=e[0],n=r();function r(e){return function(){var n=document.createElement("div");return t.render(V.apply(String,arguments),n,e),n.removeChild(n.firstChild)}}return n.options=r,n.block=r({displayMode:!0}),n}))}}function J(){return R((function(e){var t=e(document.body.clientWidth);function n(){var n=document.body.clientWidth;n!==t&&e(t=n)}return window.addEventListener("resize",n),function(){window.removeEventListener("resize",n)}}))}var K=Object.assign((function(e){const t=H(e);Object.defineProperties(this,{DOM:{value:$,writable:!0,enumerable:!0},FileAttachment:{value:P(E),writable:!0,enumerable:!0},Files:{value:A,writable:!0,enumerable:!0},Generators:{value:M,writable:!0,enumerable:!0},html:{value:P(S),writable:!0,enumerable:!0},md:{value:F(t),writable:!0,enumerable:!0},Mutable:{value:P(q),writable:!0,enumerable:!0},now:{value:D,writable:!0,enumerable:!0},Promises:{value:z,writable:!0,enumerable:!0},require:{value:P(t),writable:!0,enumerable:!0},resolve:{value:P(B),writable:!0,enumerable:!0},svg:{value:P(I),writable:!0,enumerable:!0},tex:{value:X(t),writable:!0,enumerable:!0},width:{value:J,writable:!0,enumerable:!0}})}),{resolve:m.resolve});e.FileAttachments=function(e){return Object.assign((t=>{const n=e(t+="");if(null==n)throw new Error(`File not found: ${t}`);return new x(n,t)}),{prototype:x.prototype})},e.Library=K,Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "@observablehq/stdlib", | ||
"version": "3.4.0", | ||
"version": "3.4.1", | ||
"license": "ISC", | ||
@@ -33,9 +33,9 @@ "main": "dist/stdlib.js", | ||
"devDependencies": { | ||
"eslint": "^6.7.2", | ||
"husky": "^3.1.0", | ||
"rollup": "^1.27.8", | ||
"rollup-plugin-node-resolve": "^5.0.0", | ||
"rollup-plugin-terser": "^5.2.0", | ||
"tap": "^14.10.2" | ||
"eslint": "^7.18.0", | ||
"husky": "^4.3.8", | ||
"rollup": "^2.37.1", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"tap": "^14.11.0" | ||
} | ||
} |
@@ -699,3 +699,3 @@ # @observablehq/stdlib | ||
Returns a promise that resolves with the specified *value* when this cell is visible in the viewport. | ||
Returns a promise that resolves with the specified *value* when this cell is visible in the viewport. The visibility function is provided by the runtime rather than the standard library because it resolves to a different function for each cell. | ||
@@ -702,0 +702,0 @@ ### HTML |
@@ -7,5 +7,5 @@ import observe from "./generators/observe.js"; | ||
generator: {value: observe(_ => void (change = _))}, | ||
value: {get: () => value, set: x => change(value = x)} | ||
value: {get: () => value, set: x => change(value = x)} // eslint-disable-line no-setter-return | ||
}); | ||
if (value !== undefined) change(value); | ||
} |
Sorry, the diff of this file is not supported yet
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
82260