@observablehq/notebook-kit 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +7 -0
  3. package/dist/bin/build.d.ts +2 -0
  4. package/dist/bin/build.js +63 -0
  5. package/dist/bin/download.d.ts +2 -0
  6. package/dist/bin/download.js +49 -0
  7. package/dist/bin/notebooks.d.ts +2 -0
  8. package/dist/bin/notebooks.js +33 -0
  9. package/dist/bin/preview.d.ts +2 -0
  10. package/dist/bin/preview.js +48 -0
  11. package/dist/package.json +73 -0
  12. package/dist/src/index.d.ts +5 -0
  13. package/dist/src/index.js +5 -0
  14. package/dist/src/javascript/assignments.d.ts +2 -0
  15. package/dist/src/javascript/assignments.js +37 -0
  16. package/dist/src/javascript/assignments.test.d.ts +1 -0
  17. package/dist/src/javascript/assignments.test.js +33 -0
  18. package/dist/src/javascript/awaits.d.ts +2 -0
  19. package/dist/src/javascript/awaits.js +23 -0
  20. package/dist/src/javascript/awaits.test.d.ts +1 -0
  21. package/dist/src/javascript/awaits.test.js +22 -0
  22. package/dist/src/javascript/declarations.d.ts +2 -0
  23. package/dist/src/javascript/declarations.js +45 -0
  24. package/dist/src/javascript/files.d.ts +3 -0
  25. package/dist/src/javascript/files.js +18 -0
  26. package/dist/src/javascript/globals.d.ts +1 -0
  27. package/dist/src/javascript/globals.js +86 -0
  28. package/dist/src/javascript/imports/jsr.d.ts +2 -0
  29. package/dist/src/javascript/imports/jsr.js +6 -0
  30. package/dist/src/javascript/imports/npm.d.ts +2 -0
  31. package/dist/src/javascript/imports/npm.js +47 -0
  32. package/dist/src/javascript/imports/npm.test.d.ts +1 -0
  33. package/dist/src/javascript/imports/npm.test.js +32 -0
  34. package/dist/src/javascript/imports/observable.d.ts +8 -0
  35. package/dist/src/javascript/imports/observable.js +64 -0
  36. package/dist/src/javascript/imports/observable.test.d.ts +1 -0
  37. package/dist/src/javascript/imports/observable.test.js +13 -0
  38. package/dist/src/javascript/imports.d.ts +21 -0
  39. package/dist/src/javascript/imports.js +146 -0
  40. package/dist/src/javascript/observable.d.ts +2 -0
  41. package/dist/src/javascript/observable.js +72 -0
  42. package/dist/src/javascript/parse.d.ts +11 -0
  43. package/dist/src/javascript/parse.js +53 -0
  44. package/dist/src/javascript/references.d.ts +8 -0
  45. package/dist/src/javascript/references.js +129 -0
  46. package/dist/src/javascript/references.test.d.ts +1 -0
  47. package/dist/src/javascript/references.test.js +38 -0
  48. package/dist/src/javascript/sourcemap.d.ts +21 -0
  49. package/dist/src/javascript/sourcemap.js +143 -0
  50. package/dist/src/javascript/sourcemap.test.d.ts +1 -0
  51. package/dist/src/javascript/sourcemap.test.js +88 -0
  52. package/dist/src/javascript/strings.d.ts +8 -0
  53. package/dist/src/javascript/strings.js +42 -0
  54. package/dist/src/javascript/strings.test.d.ts +1 -0
  55. package/dist/src/javascript/strings.test.js +31 -0
  56. package/dist/src/javascript/syntaxError.d.ts +2 -0
  57. package/dist/src/javascript/syntaxError.js +5 -0
  58. package/dist/src/javascript/template.d.ts +3 -0
  59. package/dist/src/javascript/template.js +141 -0
  60. package/dist/src/javascript/template.test.d.ts +1 -0
  61. package/dist/src/javascript/template.test.js +32 -0
  62. package/dist/src/javascript/transpile.d.ts +25 -0
  63. package/dist/src/javascript/transpile.js +42 -0
  64. package/dist/src/javascript/transpile.test.d.ts +1 -0
  65. package/dist/src/javascript/transpile.test.js +29 -0
  66. package/dist/src/javascript/walk.d.ts +5 -0
  67. package/dist/src/javascript/walk.js +13 -0
  68. package/dist/src/lib/notebook.d.ts +35 -0
  69. package/dist/src/lib/notebook.js +19 -0
  70. package/dist/src/lib/notebook.test.d.ts +1 -0
  71. package/dist/src/lib/notebook.test.js +26 -0
  72. package/dist/src/lib/serialize.d.ts +5 -0
  73. package/dist/src/lib/serialize.js +97 -0
  74. package/dist/src/lib/serialize.test.d.ts +1 -0
  75. package/dist/src/lib/serialize.test.js +125 -0
  76. package/dist/src/lib/text.d.ts +1 -0
  77. package/dist/src/lib/text.js +3 -0
  78. package/dist/src/runtime/define.d.ts +28 -0
  79. package/dist/src/runtime/define.js +62 -0
  80. package/dist/src/runtime/display.d.ts +16 -0
  81. package/dist/src/runtime/display.js +60 -0
  82. package/dist/src/runtime/index.d.ts +11 -0
  83. package/dist/src/runtime/index.js +14 -0
  84. package/dist/src/runtime/inspect.d.ts +3 -0
  85. package/dist/src/runtime/inspect.js +43 -0
  86. package/dist/src/runtime/stdlib/assets.d.ts +4 -0
  87. package/dist/src/runtime/stdlib/assets.js +110 -0
  88. package/dist/src/runtime/stdlib/assets.test.d.ts +1 -0
  89. package/dist/src/runtime/stdlib/assets.test.js +78 -0
  90. package/dist/src/runtime/stdlib/dom/canvas.d.ts +1 -0
  91. package/dist/src/runtime/stdlib/dom/canvas.js +6 -0
  92. package/dist/src/runtime/stdlib/dom/context2d.d.ts +1 -0
  93. package/dist/src/runtime/stdlib/dom/context2d.js +9 -0
  94. package/dist/src/runtime/stdlib/dom/index.d.ts +5 -0
  95. package/dist/src/runtime/stdlib/dom/index.js +5 -0
  96. package/dist/src/runtime/stdlib/dom/svg.d.ts +1 -0
  97. package/dist/src/runtime/stdlib/dom/svg.js +7 -0
  98. package/dist/src/runtime/stdlib/dom/text.d.ts +1 -0
  99. package/dist/src/runtime/stdlib/dom/text.js +3 -0
  100. package/dist/src/runtime/stdlib/dom/uid.d.ts +8 -0
  101. package/dist/src/runtime/stdlib/dom/uid.js +25 -0
  102. package/dist/src/runtime/stdlib/dot.d.ts +2 -0
  103. package/dist/src/runtime/stdlib/dot.js +34 -0
  104. package/dist/src/runtime/stdlib/duckdb.d.ts +24 -0
  105. package/dist/src/runtime/stdlib/duckdb.js +379 -0
  106. package/dist/src/runtime/stdlib/fileAttachment.d.ts +71 -0
  107. package/dist/src/runtime/stdlib/fileAttachment.js +199 -0
  108. package/dist/src/runtime/stdlib/generators/index.d.ts +5 -0
  109. package/dist/src/runtime/stdlib/generators/index.js +5 -0
  110. package/dist/src/runtime/stdlib/generators/input.d.ts +1 -0
  111. package/dist/src/runtime/stdlib/generators/input.js +45 -0
  112. package/dist/src/runtime/stdlib/generators/now.d.ts +1 -0
  113. package/dist/src/runtime/stdlib/generators/now.js +5 -0
  114. package/dist/src/runtime/stdlib/generators/observe.d.ts +1 -0
  115. package/dist/src/runtime/stdlib/generators/observe.js +31 -0
  116. package/dist/src/runtime/stdlib/generators/queue.d.ts +1 -0
  117. package/dist/src/runtime/stdlib/generators/queue.js +27 -0
  118. package/dist/src/runtime/stdlib/generators/width.d.ts +1 -0
  119. package/dist/src/runtime/stdlib/generators/width.js +13 -0
  120. package/dist/src/runtime/stdlib/highlight.d.ts +2 -0
  121. package/dist/src/runtime/stdlib/highlight.js +76 -0
  122. package/dist/src/runtime/stdlib/index.d.ts +56 -0
  123. package/dist/src/runtime/stdlib/index.js +23 -0
  124. package/dist/src/runtime/stdlib/inputs.css +15 -0
  125. package/dist/src/runtime/stdlib/inputs.d.ts +2 -0
  126. package/dist/src/runtime/stdlib/inputs.js +2 -0
  127. package/dist/src/runtime/stdlib/leaflet.d.ts +1 -0
  128. package/dist/src/runtime/stdlib/leaflet.js +7 -0
  129. package/dist/src/runtime/stdlib/mapboxgl.d.ts +1 -0
  130. package/dist/src/runtime/stdlib/mapboxgl.js +5 -0
  131. package/dist/src/runtime/stdlib/md.d.ts +5 -0
  132. package/dist/src/runtime/stdlib/md.js +72 -0
  133. package/dist/src/runtime/stdlib/mermaid.d.ts +2 -0
  134. package/dist/src/runtime/stdlib/mermaid.js +11 -0
  135. package/dist/src/runtime/stdlib/mutable.d.ts +8 -0
  136. package/dist/src/runtime/stdlib/mutable.js +30 -0
  137. package/dist/src/runtime/stdlib/observer.d.ts +16 -0
  138. package/dist/src/runtime/stdlib/observer.js +42 -0
  139. package/dist/src/runtime/stdlib/recommendedLibraries.d.ts +25 -0
  140. package/dist/src/runtime/stdlib/recommendedLibraries.js +26 -0
  141. package/dist/src/runtime/stdlib/require.d.ts +4 -0
  142. package/dist/src/runtime/stdlib/require.js +40 -0
  143. package/dist/src/runtime/stdlib/sampleDatasets.d.ts +12 -0
  144. package/dist/src/runtime/stdlib/sampleDatasets.js +31 -0
  145. package/dist/src/runtime/stdlib/sql.d.ts +5 -0
  146. package/dist/src/runtime/stdlib/sql.js +5 -0
  147. package/dist/src/runtime/stdlib/template.d.ts +7 -0
  148. package/dist/src/runtime/stdlib/template.js +2 -0
  149. package/dist/src/runtime/stdlib/tex.d.ts +7 -0
  150. package/dist/src/runtime/stdlib/tex.js +18 -0
  151. package/dist/src/runtime/stdlib/vega-lite.d.ts +1 -0
  152. package/dist/src/runtime/stdlib/vega-lite.js +4 -0
  153. package/dist/src/styles/abstract-dark.css +14 -0
  154. package/dist/src/styles/abstract-light.css +14 -0
  155. package/dist/src/styles/global.css +266 -0
  156. package/dist/src/styles/highlight.css +47 -0
  157. package/dist/src/styles/index.css +14 -0
  158. package/dist/src/styles/inspector.css +89 -0
  159. package/dist/src/styles/plot.css +7 -0
  160. package/dist/src/styles/syntax-dark.css +12 -0
  161. package/dist/src/styles/syntax-light.css +12 -0
  162. package/dist/src/styles/theme-air.css +7 -0
  163. package/dist/src/styles/theme-coffee.css +7 -0
  164. package/dist/src/styles/theme-cotton.css +7 -0
  165. package/dist/src/styles/theme-deep-space.css +16 -0
  166. package/dist/src/styles/theme-glacier.css +7 -0
  167. package/dist/src/styles/theme-ink.css +7 -0
  168. package/dist/src/styles/theme-midnight.css +7 -0
  169. package/dist/src/styles/theme-near-midnight.css +7 -0
  170. package/dist/src/styles/theme-ocean-floor.css +7 -0
  171. package/dist/src/styles/theme-parchment.css +7 -0
  172. package/dist/src/styles/theme-slate.css +7 -0
  173. package/dist/src/styles/theme-stark.css +16 -0
  174. package/dist/src/styles/theme-sun-faded.css +7 -0
  175. package/dist/src/templates/default.html +31 -0
  176. package/dist/src/vite/config.d.ts +2 -0
  177. package/dist/src/vite/config.js +30 -0
  178. package/dist/src/vite/index.d.ts +2 -0
  179. package/dist/src/vite/index.js +2 -0
  180. package/dist/src/vite/observable.d.ts +12 -0
  181. package/dist/src/vite/observable.js +176 -0
  182. package/package.json +73 -0
@@ -0,0 +1,110 @@
1
+ const SRC_SELECTOR = [
2
+ "audio source[src]", // audio
3
+ "audio[src]", // audio
4
+ "img[src]", // images
5
+ "picture source[src]", // images
6
+ "video source[src]", // videos
7
+ "video[src]" // videos
8
+ ].join();
9
+ const SRCSET_SELECTOR = [
10
+ "img[srcset]", // images
11
+ "picture source[srcset]" // images
12
+ ].join();
13
+ const HREF_SELECTOR = [
14
+ "a[href][download]", // download links
15
+ "link[href]" // stylesheets
16
+ ].join();
17
+ const ASSET_ATTRIBUTES = [
18
+ [SRC_SELECTOR, "src"],
19
+ [SRCSET_SELECTOR, "srcset"],
20
+ [HREF_SELECTOR, "href"]
21
+ ];
22
+ /** Populates the asset keys from the specified root. */
23
+ export function collectAssets(assets, root) {
24
+ for (const [selector, name] of ASSET_ATTRIBUTES) {
25
+ for (const element of root.querySelectorAll(selector)) {
26
+ if (isRelExternal(element))
27
+ continue;
28
+ const source = decodeURI(element.getAttribute(name));
29
+ if (name === "srcset") {
30
+ for (const s of parseSrcset(source)) {
31
+ if (isSourcePath(s)) {
32
+ assets.add(asImportPath(s));
33
+ }
34
+ }
35
+ }
36
+ else if (isSourcePath(source)) {
37
+ assets.add(asImportPath(source));
38
+ }
39
+ }
40
+ }
41
+ }
42
+ /** Mutates the specified root to apply the specified asset mapping. */
43
+ export function mapAssets(root, assets) {
44
+ const resolve = (s) => assets.get(asImportPath(s)) ?? s;
45
+ for (const [selector, src] of ASSET_ATTRIBUTES) {
46
+ for (const element of root.querySelectorAll(selector)) {
47
+ if (isRelExternal(element))
48
+ continue;
49
+ const source = decodeURI(element.getAttribute(src));
50
+ if (src === "srcset")
51
+ element.setAttribute(src, resolveSrcset(source, resolve));
52
+ else
53
+ element.setAttribute(src, resolve(source));
54
+ }
55
+ }
56
+ }
57
+ /** Returns true if the specified element has rel=external. */
58
+ function isRelExternal(a) {
59
+ return /(?:^|\s)external(?:\s|$)/i.test(a.getAttribute("rel") ?? ""); // e.g., <a href rel="external">
60
+ }
61
+ /** Strips the query string and anchor fragment from the specified source. */
62
+ function asPath(source) {
63
+ const i = source.indexOf("?");
64
+ const j = source.indexOf("#");
65
+ const k = i >= 0 && j >= 0 ? Math.min(i, j) : i >= 0 ? i : j;
66
+ return k >= 0 ? source.slice(0, k) : source; // strip query string or anchor fragment
67
+ }
68
+ /** Converts the specified source into an import path, typically with ./. */
69
+ function asImportPath(source) {
70
+ const path = asPath(source);
71
+ return isImportPath(path) ? path : `./${path}`;
72
+ }
73
+ /**
74
+ * Returns true if the specified import specifier is a path, as opposed to a
75
+ * bare module specifier or a URL; import paths start with ./, ../, or /.
76
+ */
77
+ function isImportPath(specifier) {
78
+ return ["./", "../", "/"].some((prefix) => specifier.startsWith(prefix));
79
+ }
80
+ /**
81
+ * Returns true if the specified source (such as an img element src attribute)
82
+ * is a path; this is anything that is not empty and does not start with a
83
+ * protocol or a hash.
84
+ */
85
+ function isSourcePath(specifier) {
86
+ return asPath(specifier) ? !/^(\w+:|#)/.test(specifier) : false;
87
+ }
88
+ /** Parses the specified srcset attribute, returning the array of sources. */
89
+ function parseSrcset(srcset) {
90
+ return srcset
91
+ .trim()
92
+ .split(/\s*,\s*/)
93
+ .filter((src) => src)
94
+ .map((src) => src.split(/\s+/)[0]);
95
+ }
96
+ /** Resolves the specified srcset attribute, resolving any sources. */
97
+ function resolveSrcset(srcset, resolve) {
98
+ return srcset
99
+ .trim()
100
+ .split(/\s*,\s*/)
101
+ .filter((src) => src)
102
+ .map((src) => {
103
+ const parts = src.split(/\s+/);
104
+ const path = resolve(parts[0]);
105
+ if (path)
106
+ parts[0] = encodeURI(path);
107
+ return parts.join(" ");
108
+ })
109
+ .join(", ");
110
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,78 @@
1
+ // @vitest-environment jsdom
2
+ import { html } from "htl";
3
+ import { assert, test } from "vitest";
4
+ import { collectAssets } from "./assets.js";
5
+ function getAssets(root) {
6
+ const assets = new Set();
7
+ collectAssets(assets, root);
8
+ return assets;
9
+ }
10
+ test("find asset paths in descendants", () => {
11
+ assert.deepStrictEqual(new Set([
12
+ "./a-href.txt",
13
+ "./audio-source-src.wav",
14
+ "./audio-src.wav",
15
+ "./img-src.png",
16
+ "./img-srcset-src.png",
17
+ "./img-srcset.png",
18
+ "./link.css",
19
+ "./picture-source-src.png",
20
+ "./picture-srcset-src.png",
21
+ "./picture-srcset.png",
22
+ "./video-source-src.mp4",
23
+ "./video-src.mp4"
24
+ ]), getAssets(html `<div>
25
+ <a href="./a-href.txt" download>download</a>
26
+ <audio><source src="./audio-source-src.wav"></audio>
27
+ <audio src="./audio-src.wav"></audio>
28
+ <img src="./img-src.png">
29
+ <img src="./img-srcset-src.png" srcset="./img-srcset.png 2x">
30
+ <link href="./link.css" rel="stylesheet">
31
+ <picture><source src="./picture-source-src.png"></picture>
32
+ <picture><source src="./picture-srcset-src.png" srcset="./picture-srcset.png 2x"></picture>
33
+ <video><source src="./video-source-src.mp4"></video>
34
+ <video src="./video-src.mp4"></video>
35
+ </div>`));
36
+ });
37
+ test("decodes paths", () => {
38
+ assert.deepStrictEqual(new Set(["./hello world.png"]), getAssets(html `<div><img src="./hello%20world.png"></div>`));
39
+ });
40
+ test("strips query strings and anchor fragments from the path", () => {
41
+ assert.deepStrictEqual(new Set(["./img1.png", "./img2.png", "./img3.png", "./img4.png"]), getAssets(html `<div>
42
+ <img src="./img1.png?foo=bar">
43
+ <img src="./img2.png#baz">
44
+ <img src="./img3.png?foo#bar">
45
+ <img src="./img4.png#foo?bar">
46
+ </div>`));
47
+ });
48
+ test("adds a leading dot slash to relative paths", () => {
49
+ assert.deepStrictEqual(new Set([
50
+ "./file.png",
51
+ "./path/to/file.png",
52
+ "/root.png",
53
+ "./dot-slash.png",
54
+ "../dot-dot-slash.png"
55
+ ]), getAssets(html `<div>
56
+ <img src="file.png">
57
+ <img src="path/to/file.png">
58
+ <img src="/root.png">
59
+ <img src="./dot-slash.png">
60
+ <img src="../dot-dot-slash.png">
61
+ </div>`));
62
+ });
63
+ test("ignores protocol links", () => {
64
+ assert.deepStrictEqual(new Set([]), getAssets(html `<div>
65
+ <img src="https://example.com/test.png">
66
+ </div>`));
67
+ });
68
+ test("ignores fragment links", () => {
69
+ assert.deepStrictEqual(new Set([]), getAssets(html `<div>
70
+ <a href="#test" download>download</a>
71
+ </div>`));
72
+ });
73
+ test("ignores rel=external elements", () => {
74
+ assert.deepStrictEqual(new Set(["./internal.txt"]), getAssets(html `<div>
75
+ <a href="external.txt" rel="external" download>download</a>
76
+ <a href="internal.txt" rel="notexternal" download>download</a>
77
+ </div>`));
78
+ });
@@ -0,0 +1 @@
1
+ export declare function canvas(width: number, height: number): HTMLCanvasElement;
@@ -0,0 +1,6 @@
1
+ export function canvas(width, height) {
2
+ const canvas = document.createElement("canvas");
3
+ canvas.width = width;
4
+ canvas.height = height;
5
+ return canvas;
6
+ }
@@ -0,0 +1 @@
1
+ export declare function context2d(width: number, height: number, dpi?: number): CanvasRenderingContext2D;
@@ -0,0 +1,9 @@
1
+ export function context2d(width, height, dpi = devicePixelRatio) {
2
+ const canvas = document.createElement("canvas");
3
+ canvas.width = width * dpi;
4
+ canvas.height = height * dpi;
5
+ canvas.style.width = `${width}px`;
6
+ const context = canvas.getContext("2d");
7
+ context.scale(dpi, dpi);
8
+ return context;
9
+ }
@@ -0,0 +1,5 @@
1
+ export { canvas } from "./canvas.js";
2
+ export { context2d } from "./context2d.js";
3
+ export { svg } from "./svg.js";
4
+ export { text } from "./text.js";
5
+ export { uid } from "./uid.js";
@@ -0,0 +1,5 @@
1
+ export { canvas } from "./canvas.js";
2
+ export { context2d } from "./context2d.js";
3
+ export { svg } from "./svg.js";
4
+ export { text } from "./text.js";
5
+ export { uid } from "./uid.js";
@@ -0,0 +1 @@
1
+ export declare function svg(width: number, height: number): SVGSVGElement;
@@ -0,0 +1,7 @@
1
+ export function svg(width, height) {
2
+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3
+ svg.setAttribute("viewBox", `0 0 ${width} ${height}`);
4
+ svg.setAttribute("width", `${width}`);
5
+ svg.setAttribute("height", `${height}`);
6
+ return svg;
7
+ }
@@ -0,0 +1 @@
1
+ export declare function text(value: string): Text;
@@ -0,0 +1,3 @@
1
+ export function text(value) {
2
+ return document.createTextNode(value);
3
+ }
@@ -0,0 +1,8 @@
1
+ export declare function uid(name?: string): Id;
2
+ declare class Id {
3
+ id: string;
4
+ href: string;
5
+ constructor(id: string);
6
+ toString(): string;
7
+ }
8
+ export {};
@@ -0,0 +1,25 @@
1
+ let count = 0;
2
+ export function uid(name) {
3
+ return new Id(`O-${name == null ? "" : `${name}-`}${++count}`);
4
+ }
5
+ class Id {
6
+ constructor(id) {
7
+ Object.defineProperty(this, "id", {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value: void 0
12
+ });
13
+ Object.defineProperty(this, "href", {
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true,
17
+ value: void 0
18
+ });
19
+ this.id = id;
20
+ this.href = new URL(`#${id}`, location.href).href;
21
+ }
22
+ toString() {
23
+ return `url(${this.href})`;
24
+ }
25
+ }
@@ -0,0 +1,2 @@
1
+ import type { RawTemplateRenderer } from "./template.js";
2
+ export declare const dot: RawTemplateRenderer;
@@ -0,0 +1,34 @@
1
+ import { instance } from "npm:@viz-js/viz";
2
+ const viz = await instance();
3
+ export const dot = (template, ...values) => {
4
+ const source = String.raw.call(String, template, ...values);
5
+ const svg = viz.renderSVGElement(source, {
6
+ graphAttributes: {
7
+ bgcolor: "none",
8
+ color: "#00000101",
9
+ fontcolor: "#00000101",
10
+ fontname: "var(--sans-serif)",
11
+ fontsize: "12"
12
+ },
13
+ nodeAttributes: {
14
+ color: "#00000101",
15
+ fontcolor: "#00000101",
16
+ fontname: "var(--sans-serif)",
17
+ fontsize: "12"
18
+ },
19
+ edgeAttributes: {
20
+ color: "#00000101"
21
+ }
22
+ });
23
+ for (const e of svg.querySelectorAll("[stroke='#000001'][stroke-opacity='0.003922']")) {
24
+ e.setAttribute("stroke", "currentColor");
25
+ e.removeAttribute("stroke-opacity");
26
+ }
27
+ for (const e of svg.querySelectorAll("[fill='#000001'][fill-opacity='0.003922']")) {
28
+ e.setAttribute("fill", "currentColor");
29
+ e.removeAttribute("fill-opacity");
30
+ }
31
+ svg.remove();
32
+ svg.style = "max-width: 100%; height: auto;";
33
+ return svg;
34
+ };
@@ -0,0 +1,24 @@
1
+ export class DuckDBClient {
2
+ static of(sources?: {}, config?: {}): Promise<DuckDBClient>;
3
+ static sql(...args: any[]): Promise<(strings: any, ...args: any[]) => Promise<any>>;
4
+ constructor(db: any);
5
+ queryStream(query: any, params: any): Promise<{
6
+ schema: any;
7
+ readRows(): AsyncGenerator<any, void, unknown>;
8
+ }>;
9
+ query(query: any, params: any): Promise<any>;
10
+ queryRow(query: any, params: any): Promise<any>;
11
+ sql(strings: any, ...args: any[]): Promise<any>;
12
+ queryTag(strings: any, ...params: any[]): any[];
13
+ escape(name: any): string;
14
+ describeTables(): Promise<{
15
+ name: any;
16
+ }[]>;
17
+ describeColumns(options?: {}): Promise<{
18
+ name: any;
19
+ type: string;
20
+ nullable: boolean;
21
+ databaseType: any;
22
+ }[]>;
23
+ readonly dialect: string;
24
+ }