@gradio/core 0.0.2 → 0.0.3

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 (106) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/blocks.d.ts +1 -0
  3. package/dist/blocks.js +1 -0
  4. package/dist/index.d.ts +4 -0
  5. package/dist/index.js +4 -0
  6. package/dist/login.d.ts +1 -0
  7. package/dist/login.js +1 -0
  8. package/dist/src/Blocks.svelte +671 -0
  9. package/dist/src/Blocks.svelte.d.ts +41 -0
  10. package/dist/src/Embed.svelte +195 -0
  11. package/dist/src/Embed.svelte.d.ts +26 -0
  12. package/dist/src/Login.svelte +107 -0
  13. package/dist/src/Login.svelte.d.ts +19 -0
  14. package/dist/src/MountComponents.svelte +26 -0
  15. package/dist/src/MountComponents.svelte.d.ts +26 -0
  16. package/dist/src/Render.svelte +91 -0
  17. package/dist/src/Render.svelte.d.ts +29 -0
  18. package/dist/src/RenderComponent.svelte +51 -0
  19. package/dist/src/RenderComponent.svelte.d.ts +32 -0
  20. package/dist/src/api_docs/ApiBanner.svelte +115 -0
  21. package/dist/src/api_docs/ApiBanner.svelte.d.ts +19 -0
  22. package/dist/src/api_docs/ApiDocs.svelte +388 -0
  23. package/dist/src/api_docs/ApiDocs.svelte.d.ts +27 -0
  24. package/dist/src/api_docs/ApiRecorder.svelte +72 -0
  25. package/dist/src/api_docs/ApiRecorder.svelte.d.ts +18 -0
  26. package/dist/src/api_docs/CodeSnippet.svelte +184 -0
  27. package/dist/src/api_docs/CodeSnippet.svelte.d.ts +24 -0
  28. package/dist/src/api_docs/CopyButton.svelte +15 -0
  29. package/dist/src/api_docs/CopyButton.svelte.d.ts +16 -0
  30. package/dist/src/api_docs/EndpointDetail.svelte +36 -0
  31. package/dist/src/api_docs/EndpointDetail.svelte.d.ts +18 -0
  32. package/dist/src/api_docs/InputPayload.svelte +149 -0
  33. package/dist/src/api_docs/InputPayload.svelte.d.ts +24 -0
  34. package/dist/src/api_docs/InstallSnippet.svelte +56 -0
  35. package/dist/src/api_docs/InstallSnippet.svelte.d.ts +16 -0
  36. package/dist/src/api_docs/NoApi.svelte +71 -0
  37. package/dist/src/api_docs/NoApi.svelte.d.ts +18 -0
  38. package/dist/src/api_docs/ParametersSnippet.svelte +104 -0
  39. package/dist/src/api_docs/ParametersSnippet.svelte.d.ts +19 -0
  40. package/dist/src/api_docs/RecordingSnippet.svelte +210 -0
  41. package/dist/src/api_docs/RecordingSnippet.svelte.d.ts +22 -0
  42. package/dist/src/api_docs/ResponseSnippet.svelte +95 -0
  43. package/dist/src/api_docs/ResponseSnippet.svelte.d.ts +19 -0
  44. package/dist/src/api_docs/TryButton.svelte +17 -0
  45. package/dist/src/api_docs/TryButton.svelte.d.ts +17 -0
  46. package/dist/src/api_docs/img/api-logo.svg +4 -0
  47. package/dist/src/api_docs/img/bash.svg +8 -0
  48. package/dist/src/api_docs/img/clear.svelte +19 -0
  49. package/dist/src/api_docs/img/clear.svelte.d.ts +23 -0
  50. package/dist/src/api_docs/img/javascript.svg +16 -0
  51. package/dist/src/api_docs/img/python.svg +20 -0
  52. package/dist/src/api_docs/index.d.ts +2 -0
  53. package/dist/src/api_docs/index.js +2 -0
  54. package/dist/src/api_docs/utils.d.ts +2 -0
  55. package/dist/src/api_docs/utils.js +135 -0
  56. package/dist/src/css.d.ts +2 -0
  57. package/dist/src/css.js +93 -0
  58. package/dist/src/gradio_helper.js +4 -0
  59. package/dist/src/i18n.d.ts +6 -0
  60. package/dist/src/i18n.js +22 -0
  61. package/dist/src/images/lightning.svg +2 -0
  62. package/dist/src/images/logo.svg +19 -0
  63. package/dist/src/images/play.svg +2 -0
  64. package/dist/src/images/spaces.svg +7 -0
  65. package/dist/src/init.d.ts +107 -0
  66. package/dist/src/init.js +377 -0
  67. package/dist/src/lang/BCP47_codes.d.ts +2 -0
  68. package/dist/src/lang/BCP47_codes.js +58 -0
  69. package/dist/src/lang/ar.json +16 -0
  70. package/dist/src/lang/ca.json +19 -0
  71. package/dist/src/lang/ckb.json +108 -0
  72. package/dist/src/lang/de.json +16 -0
  73. package/dist/src/lang/en.json +118 -0
  74. package/dist/src/lang/es.json +17 -0
  75. package/dist/src/lang/eu.json +16 -0
  76. package/dist/src/lang/fa.json +16 -0
  77. package/dist/src/lang/fr.json +30 -0
  78. package/dist/src/lang/he.json +16 -0
  79. package/dist/src/lang/hi.json +16 -0
  80. package/dist/src/lang/ja.json +16 -0
  81. package/dist/src/lang/ko.json +16 -0
  82. package/dist/src/lang/lt.json +16 -0
  83. package/dist/src/lang/nl.json +16 -0
  84. package/dist/src/lang/pl.json +16 -0
  85. package/dist/src/lang/pt-BR.json +19 -0
  86. package/dist/src/lang/ru.json +118 -0
  87. package/dist/src/lang/ta.json +16 -0
  88. package/dist/src/lang/tr.json +16 -0
  89. package/dist/src/lang/uk.json +16 -0
  90. package/dist/src/lang/ur.json +16 -0
  91. package/dist/src/lang/uz.json +15 -0
  92. package/dist/src/lang/zh-CN.json +115 -0
  93. package/dist/src/lang/zh-TW.json +16 -0
  94. package/dist/src/s-blocks.d.ts +1 -0
  95. package/dist/src/s-blocks.js +1 -0
  96. package/dist/src/s-login.d.ts +1 -0
  97. package/dist/src/s-login.js +1 -0
  98. package/dist/src/stores.d.ts +30 -0
  99. package/dist/src/stores.js +93 -0
  100. package/dist/src/types.d.ts +95 -0
  101. package/dist/src/types.js +1 -0
  102. package/dist/src/vite-env-override.d.ts +20 -0
  103. package/package.json +71 -60
  104. package/src/Render.svelte +3 -1
  105. package/src/api_docs/ApiDocs.svelte +1 -1
  106. package/src/api_docs/ApiRecorder.svelte +1 -1
@@ -0,0 +1,135 @@
1
+ // eslint-disable-next-line complexity
2
+ export function represent_value(value, type, lang = null) {
3
+ if (type === undefined) {
4
+ return lang === "py" ? "None" : null;
5
+ }
6
+ if (value === null && lang === "py") {
7
+ return "None";
8
+ }
9
+ if (type === "string" || type === "str") {
10
+ return lang === null ? value : '"' + value + '"';
11
+ }
12
+ else if (type === "number") {
13
+ return lang === null ? parseFloat(value) : value;
14
+ }
15
+ else if (type === "boolean" || type == "bool") {
16
+ if (lang === "py") {
17
+ value = String(value);
18
+ return value === "true" ? "True" : "False";
19
+ }
20
+ else if (lang === "js" || lang === "bash") {
21
+ return value;
22
+ }
23
+ return value === "true";
24
+ }
25
+ else if (type === "List[str]") {
26
+ value = JSON.stringify(value);
27
+ return value;
28
+ }
29
+ else if (type.startsWith("Literal['")) {
30
+ // a literal of strings
31
+ return '"' + value + '"';
32
+ }
33
+ // assume object type
34
+ if (lang === null) {
35
+ return value === "" ? null : JSON.parse(value);
36
+ }
37
+ else if (typeof value === "string") {
38
+ if (value === "") {
39
+ return lang === "py" ? "None" : "null";
40
+ }
41
+ return value;
42
+ }
43
+ if (lang === "bash") {
44
+ value = simplify_file_data(value);
45
+ }
46
+ if (lang === "py") {
47
+ value = replace_file_data_with_file_function(value);
48
+ }
49
+ return stringify_except_file_function(value);
50
+ }
51
+ export function is_potentially_nested_file_data(obj) {
52
+ if (typeof obj === "object" && obj !== null) {
53
+ if (obj.hasOwnProperty("url") && obj.hasOwnProperty("meta")) {
54
+ if (typeof obj.meta === "object" &&
55
+ obj.meta !== null &&
56
+ obj.meta._type === "gradio.FileData") {
57
+ return true;
58
+ }
59
+ }
60
+ }
61
+ if (typeof obj === "object" && obj !== null) {
62
+ for (let key in obj) {
63
+ if (typeof obj[key] === "object") {
64
+ let result = is_potentially_nested_file_data(obj[key]);
65
+ if (result) {
66
+ return true;
67
+ }
68
+ }
69
+ }
70
+ }
71
+ return false;
72
+ }
73
+ function simplify_file_data(obj) {
74
+ if (typeof obj === "object" && obj !== null && !Array.isArray(obj)) {
75
+ if ("url" in obj &&
76
+ obj.url &&
77
+ "meta" in obj &&
78
+ obj.meta?._type === "gradio.FileData") {
79
+ return { path: obj.url };
80
+ }
81
+ }
82
+ if (Array.isArray(obj)) {
83
+ obj.forEach((item, index) => {
84
+ if (typeof item === "object" && item !== null) {
85
+ obj[index] = simplify_file_data(item); // Recurse and update array elements
86
+ }
87
+ });
88
+ }
89
+ else if (typeof obj === "object" && obj !== null) {
90
+ Object.keys(obj).forEach((key) => {
91
+ obj[key] = simplify_file_data(obj[key]); // Recurse and update object properties
92
+ });
93
+ }
94
+ return obj;
95
+ }
96
+ function replace_file_data_with_file_function(obj) {
97
+ if (typeof obj === "object" && obj !== null && !Array.isArray(obj)) {
98
+ if ("url" in obj &&
99
+ obj.url &&
100
+ "meta" in obj &&
101
+ obj.meta?._type === "gradio.FileData") {
102
+ return `handle_file('${obj.url}')`;
103
+ }
104
+ }
105
+ if (Array.isArray(obj)) {
106
+ obj.forEach((item, index) => {
107
+ if (typeof item === "object" && item !== null) {
108
+ obj[index] = replace_file_data_with_file_function(item); // Recurse and update array elements
109
+ }
110
+ });
111
+ }
112
+ else if (typeof obj === "object" && obj !== null) {
113
+ Object.keys(obj).forEach((key) => {
114
+ obj[key] = replace_file_data_with_file_function(obj[key]); // Recurse and update object properties
115
+ });
116
+ }
117
+ return obj;
118
+ }
119
+ function stringify_except_file_function(obj) {
120
+ let jsonString = JSON.stringify(obj, (key, value) => {
121
+ if (value === null) {
122
+ return "UNQUOTEDNone";
123
+ }
124
+ if (typeof value === "string" &&
125
+ value.startsWith("handle_file(") &&
126
+ value.endsWith(")")) {
127
+ return `UNQUOTED${value}`; // Flag the special strings
128
+ }
129
+ return value;
130
+ });
131
+ const regex = /"UNQUOTEDhandle_file\(([^)]*)\)"/g;
132
+ jsonString = jsonString.replace(regex, (match, p1) => `handle_file(${p1})`);
133
+ const regexNone = /"UNQUOTEDNone"/g;
134
+ return jsonString.replace(regexNone, "None");
135
+ }
@@ -0,0 +1,2 @@
1
+ export declare function mount_css(url: string, target: HTMLElement): Promise<void>;
2
+ export declare function prefix_css(string: string, version: string, style_element?: HTMLStyleElement): HTMLStyleElement | null;
@@ -0,0 +1,93 @@
1
+ let supports_adopted_stylesheets = false;
2
+ if ("attachShadow" in Element.prototype &&
3
+ "adoptedStyleSheets" in Document.prototype) {
4
+ // Both Shadow DOM and adoptedStyleSheets are supported
5
+ const shadow_root_test = document
6
+ .createElement("div")
7
+ .attachShadow({ mode: "open" });
8
+ supports_adopted_stylesheets = "adoptedStyleSheets" in shadow_root_test;
9
+ }
10
+ export function mount_css(url, target) {
11
+ const base = new URL(import.meta.url).origin;
12
+ const _url = new URL(url, base).href;
13
+ const existing_link = document.querySelector(`link[href='${_url}']`);
14
+ if (existing_link)
15
+ return Promise.resolve();
16
+ const link = document.createElement("link");
17
+ link.rel = "stylesheet";
18
+ link.href = _url;
19
+ return new Promise((res, rej) => {
20
+ link.addEventListener("load", () => res());
21
+ link.addEventListener("error", () => {
22
+ console.error(`Unable to preload CSS for ${_url}`);
23
+ res();
24
+ });
25
+ target.appendChild(link);
26
+ });
27
+ }
28
+ export function prefix_css(string, version, style_element = document.createElement("style")) {
29
+ if (!supports_adopted_stylesheets)
30
+ return null;
31
+ style_element.remove();
32
+ const stylesheet = new CSSStyleSheet();
33
+ stylesheet.replaceSync(string);
34
+ let importString = "";
35
+ string = string.replace(/@import\s+url\((.*?)\);\s*/g, (match, url) => {
36
+ importString += `@import url(${url});\n`;
37
+ return ""; // remove and store any @import statements from the CSS
38
+ });
39
+ const rules = stylesheet.cssRules;
40
+ let css_string = "";
41
+ let gradio_css_infix = `gradio-app .gradio-container.gradio-container-${version} .contain `;
42
+ for (let i = 0; i < rules.length; i++) {
43
+ const rule = rules[i];
44
+ let is_dark_rule = rule.cssText.includes(".dark");
45
+ if (rule instanceof CSSStyleRule) {
46
+ const selector = rule.selectorText;
47
+ if (selector) {
48
+ const new_selector = selector
49
+ .replace(".dark", "")
50
+ .split(",")
51
+ .map((s) => `${is_dark_rule ? ".dark" : ""} ${gradio_css_infix} ${s.trim()} `)
52
+ .join(",");
53
+ css_string += rule.cssText;
54
+ css_string += rule.cssText.replace(selector, new_selector);
55
+ }
56
+ }
57
+ else if (rule instanceof CSSMediaRule) {
58
+ let mediaCssString = `@media ${rule.media.mediaText} {`;
59
+ for (let j = 0; j < rule.cssRules.length; j++) {
60
+ const innerRule = rule.cssRules[j];
61
+ if (innerRule instanceof CSSStyleRule) {
62
+ let is_dark_rule = innerRule.cssText.includes(".dark ");
63
+ const selector = innerRule.selectorText;
64
+ const new_selector = selector
65
+ .replace(".dark", "")
66
+ .split(",")
67
+ .map((s) => `${is_dark_rule ? ".dark" : ""} ${gradio_css_infix} ${s.trim()} `)
68
+ .join(",");
69
+ mediaCssString += innerRule.cssText.replace(selector, new_selector);
70
+ }
71
+ }
72
+ mediaCssString += "}";
73
+ css_string += mediaCssString;
74
+ }
75
+ else if (rule instanceof CSSKeyframesRule) {
76
+ css_string += `@keyframes ${rule.name} {`;
77
+ for (let j = 0; j < rule.cssRules.length; j++) {
78
+ const innerRule = rule.cssRules[j];
79
+ if (innerRule instanceof CSSKeyframeRule) {
80
+ css_string += `${innerRule.keyText} { ${innerRule.style.cssText} }`;
81
+ }
82
+ }
83
+ css_string += "}";
84
+ }
85
+ else if (rule instanceof CSSFontFaceRule) {
86
+ css_string += `@font-face { ${rule.style.cssText} }`;
87
+ }
88
+ }
89
+ css_string = importString + css_string;
90
+ style_element.textContent = css_string;
91
+ document.head.appendChild(style_element);
92
+ return style_element;
93
+ }
@@ -0,0 +1,4 @@
1
+ import { format } from "svelte-i18n";
2
+ import { get } from "svelte/store";
3
+ export { Gradio } from "@gradio/utils";
4
+ export const formatter = get(format);
@@ -0,0 +1,6 @@
1
+ type LangsRecord = Record<string, {
2
+ [key: string]: any;
3
+ }>;
4
+ export declare function process_langs(): LangsRecord;
5
+ export declare function setupi18n(): Promise<void>;
6
+ export {};
@@ -0,0 +1,22 @@
1
+ import { addMessages, init, getLocaleFromNavigator } from "svelte-i18n";
2
+ const langs = import.meta.glob("./lang/*.json", {
3
+ eager: true
4
+ });
5
+ export function process_langs() {
6
+ let _langs = {};
7
+ for (const lang in langs) {
8
+ const code = lang.split("/").pop().split(".").shift();
9
+ _langs[code] = langs[lang].default;
10
+ }
11
+ return _langs;
12
+ }
13
+ const processed_langs = process_langs();
14
+ for (const lang in processed_langs) {
15
+ addMessages(lang, processed_langs[lang]);
16
+ }
17
+ export async function setupi18n() {
18
+ await init({
19
+ fallbackLocale: "en",
20
+ initialLocale: getLocaleFromNavigator()
21
+ });
22
+ }
@@ -0,0 +1,2 @@
1
+ <!-- Lightning https://iconscout.com/icons/lightning by IconLauk https://iconscout.com/contributors/icon-lauk on IconScout https://iconscout.com" -->
2
+ <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 32 32" viewBox="0 0 32 32" id="lightning"><path fill="#ff7c00" d="M26.9,10.5C26.7,10.2,26.4,10,26,10h-9V2c0-0.4-0.3-0.8-0.7-1c-0.4-0.1-0.9,0-1.1,0.4l-10,14c-0.2,0.3-0.3,0.7-0.1,1 C5.3,16.8,5.6,17,6,17h8.8L13,29.9c-0.1,0.5,0.2,0.9,0.6,1.1c0.1,0,0.2,0.1,0.3,0.1c0.3,0,0.7-0.2,0.8-0.5l12-19 C27,11.2,27,10.8,26.9,10.5z"/></svg>
@@ -0,0 +1,19 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="576" height="576" viewBox="0 0 576 576" fill="none">
2
+ <path d="M287.5 229L86 344.5L287.5 460L489 344.5L287.5 229Z" stroke="url(#paint0_linear_102_7)" stroke-width="59" stroke-linejoin="round"/>
3
+ <path d="M287.5 116L86 231.5L287.5 347L489 231.5L287.5 116Z" stroke="url(#paint1_linear_102_7)" stroke-width="59" stroke-linejoin="round"/>
4
+ <path d="M86 344L288 229" stroke="url(#paint2_linear_102_7)" stroke-width="59" stroke-linejoin="bevel"/>
5
+ <defs>
6
+ <linearGradient id="paint0_linear_102_7" x1="60" y1="341" x2="429.5" y2="344" gradientUnits="userSpaceOnUse">
7
+ <stop stop-color="#F9D100"/>
8
+ <stop offset="1" stop-color="#F97700"/>
9
+ </linearGradient>
10
+ <linearGradient id="paint1_linear_102_7" x1="513.5" y1="231" x2="143.5" y2="231" gradientUnits="userSpaceOnUse">
11
+ <stop stop-color="#F9D100"/>
12
+ <stop offset="1" stop-color="#F97700"/>
13
+ </linearGradient>
14
+ <linearGradient id="paint2_linear_102_7" x1="60" y1="344" x2="428.987" y2="341.811" gradientUnits="userSpaceOnUse">
15
+ <stop stop-color="#F9D100"/>
16
+ <stop offset="1" stop-color="#F97700"/>
17
+ </linearGradient>
18
+ </defs>
19
+ </svg>
@@ -0,0 +1,2 @@
1
+ <!-- Play https://iconscout.com/icons/play by Alexandru Stoica https://iconscout.com/contributors/alexandru-stoica on IconScout https://iconscout.com" -->
2
+ <svg xmlns="http://www.w3.org/2000/svg" width="6" height="7" viewBox="0 0 6 7" id="play"><g fill="#999b9e" transform="translate(-347 -3766)"><g transform="translate(56 160)"><path d="M296.495 3608.573l-3.994-2.43c-.669-.408-1.501.107-1.501.926v4.862c0 .82.832 1.333 1.5.927l3.995-2.43c.673-.41.673-1.445 0-1.855"/></g></g></svg>
@@ -0,0 +1,7 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" fill="none">
2
+ <path fill="#FF3270" d="M1.93 6.03v2.04h2.04V6.03H1.93Z"/>
3
+ <path fill="#861FFF" d="M6.03 6.03v2.04h2.04V6.03H6.03Z"/>
4
+ <path fill="#097EFF" d="M1.93 1.93v2.04h2.04V1.93H1.93Z"/>
5
+ <path fill="#000" fill-rule="evenodd" d="M.5 1.4c0-.5.4-.9.9-.9h3.1a.9.9 0 0 1 .87.67A2.44 2.44 0 0 1 9.5 2.95c0 .65-.25 1.24-.67 1.68.39.1.67.46.67.88v3.08c0 .5-.4.91-.9.91H1.4a.9.9 0 0 1-.9-.9V1.4Zm1.43.53v2.04h2.04V1.93H1.93Zm0 6.14V6.03h2.04v2.04H1.93Zm4.1 0V6.03h2.04v2.04H6.03Zm0-5.12a1.02 1.02 0 1 1 2.04 0 1.02 1.02 0 0 1-2.04 0Z" clip-rule="evenodd"/>
6
+ <path fill="#FFD702" d="M7.05 1.93a1.02 1.02 0 1 0 0 2.04 1.02 1.02 0 0 0 0-2.04Z"/>
7
+ </svg>
@@ -0,0 +1,107 @@
1
+ import { type Writable } from "svelte/store";
2
+ import type { ComponentMeta, Dependency, LayoutNode, TargetMap, LoadingComponent } from "./types";
3
+ import type { client_return } from "@gradio/client";
4
+ import { create_loading_status_store } from "./stores";
5
+ export interface UpdateTransaction {
6
+ id: number;
7
+ value: any;
8
+ prop: string;
9
+ }
10
+ /**
11
+ * Create a store with the layout and a map of targets
12
+ * @returns A store with the layout and a map of targets
13
+ */
14
+ export declare function create_components(): {
15
+ layout: Writable<ComponentMeta>;
16
+ targets: Writable<TargetMap>;
17
+ update_value: (updates: UpdateTransaction[]) => void;
18
+ get_data: (id: number) => any | Promise<any>;
19
+ loading_status: ReturnType<typeof create_loading_status_store>;
20
+ scheduled_updates: Writable<boolean>;
21
+ create_layout: (args: {
22
+ app: client_return;
23
+ components: ComponentMeta[];
24
+ layout: LayoutNode;
25
+ dependencies: Dependency[];
26
+ root: string;
27
+ options: {
28
+ fill_height: boolean;
29
+ };
30
+ }) => void;
31
+ rerender_layout: (args: {
32
+ render_id: number;
33
+ components: ComponentMeta[];
34
+ layout: LayoutNode;
35
+ root: string;
36
+ dependencies: Dependency[];
37
+ }) => void;
38
+ };
39
+ /** An async version of 'new Function' */
40
+ export declare const AsyncFunction: new (...args: string[]) => (...args: any[]) => Promise<any>;
41
+ /**
42
+ * Takes a string of source code and returns a function that can be called with arguments
43
+ * @param source the source code
44
+ * @param backend_fn if there is also a backend function
45
+ * @param input_length the number of inputs
46
+ * @param output_length the number of outputs
47
+ * @returns The function, or null if the source code is invalid or missing
48
+ */
49
+ export declare function process_frontend_fn(source: string | null | undefined | false, backend_fn: boolean, input_length: number, output_length: number): ((...args: unknown[]) => Promise<unknown[]>) | null;
50
+ /**
51
+ * `Dependency.targets` is an array of `[id, trigger]` pairs with the ids as the `fn_id`.
52
+ * This function take a single list of `Dependency.targets` and add those to the target_map.
53
+ * @param targets the targets array
54
+ * @param fn_id the function index
55
+ * @param target_map the target map
56
+ * @returns the tagert map
57
+ */
58
+ export declare function create_target_meta(targets: Dependency["targets"], fn_id: number, target_map: TargetMap): TargetMap;
59
+ /**
60
+ * Get all component ids that are an input or output of a dependency
61
+ * @param dep the dependency
62
+ * @param inputs the set of inputs
63
+ * @param outputs the set of outputs
64
+ * @returns a tuple of the inputs and outputs
65
+ */
66
+ export declare function get_inputs_outputs(dep: Dependency, inputs: Set<number>, outputs: Set<number>): [Set<number>, Set<number>];
67
+ /**
68
+ * Determines if a component is interactive
69
+ * @param id component id
70
+ * @param interactive_prop value of the interactive prop
71
+ * @param value the main value of the component
72
+ * @param inputs set of ids that are inputs to a dependency
73
+ * @param outputs set of ids that are outputs to a dependency
74
+ * @returns if the component is interactive
75
+ */
76
+ export declare function determine_interactivity(id: number, interactive_prop: boolean | undefined, value: any, inputs: Set<number>, outputs: Set<number>): boolean;
77
+ type ServerFunctions = Record<string, (...args: any[]) => Promise<any>>;
78
+ /**
79
+ * Process the server function names and return a dictionary of functions
80
+ * @param id the component id
81
+ * @param server_fns the server function names
82
+ * @param app the client instance
83
+ * @returns the actual server functions
84
+ */
85
+ export declare function process_server_fn(id: number, server_fns: string[] | undefined, app: client_return): ServerFunctions;
86
+ /**
87
+ * Get a component from the backend
88
+ * @param type the type of the component
89
+ * @param class_id the class id of the component
90
+ * @param root the root url of the app
91
+ * @param components the list of component metadata
92
+ * @param example_components the list of example components
93
+ * @returns the component and its name
94
+ */
95
+ export declare function get_component(type: string, class_id: string, root: string, components: ComponentMeta[], example_components?: string[]): {
96
+ component: LoadingComponent;
97
+ name: ComponentMeta["type"];
98
+ example_components?: Map<ComponentMeta["type"], LoadingComponent>;
99
+ };
100
+ /**
101
+ * Preload all components
102
+ * @param components A list of component metadata
103
+ * @param root The root url of the app
104
+ * @returns A map of component ids to their constructors
105
+ */
106
+ export declare function preload_all_components(components: ComponentMeta[], root: string): Map<ComponentMeta["type"], LoadingComponent>;
107
+ export {};